aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Instances/InstanceScript.cpp
diff options
context:
space:
mode:
authorKrudor <erikstrandberg93@hotmail.com>2016-07-16 14:58:33 +0200
committerShauren <shauren.trinity@gmail.com>2016-07-16 14:58:33 +0200
commit649e3a9ac59a1d24eeec3419138d0d5f11dee566 (patch)
tree94834378e61389199ec5e734f34a02097e80d911 /src/server/game/Instances/InstanceScript.cpp
parente2d6c362f2c80346c464f053ad20b773f9e31863 (diff)
Core/Instances: Add functionality for modifying instance entrance locations
Instances have since MoP (Possibly even Cataclysm) been able to set new locations for players when they zone into the instance. A theoretic example of this could be after a certain boss has been defeated, a new entrance location is set to bring players entering the instance closer to the relevant content. A real example would be Siege of Orgrimmar changing entrance locations many times as the raid progresses. Added SetEntranceLocation for setting entrance locations that will be saved to DB the next time the instance is saved, and SetTemporaryEntranceLocation for when you don't want the value to be saved to the database. Closes #17167
Diffstat (limited to 'src/server/game/Instances/InstanceScript.cpp')
-rw-r--r--src/server/game/Instances/InstanceScript.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/server/game/Instances/InstanceScript.cpp b/src/server/game/Instances/InstanceScript.cpp
index 6ddef1ceeaa..2b415bf9a66 100644
--- a/src/server/game/Instances/InstanceScript.cpp
+++ b/src/server/game/Instances/InstanceScript.cpp
@@ -40,7 +40,7 @@ BossBoundaryData::~BossBoundaryData()
}
InstanceScript::InstanceScript(Map* map) : instance(map), completedEncounters(0),
-_combatResurrectionTimer(0), _combatResurrectionCharges(0), _combatResurrectionTimerStarted(false)
+_entranceId(0), _temporaryEntranceId(0), _combatResurrectionTimer(0), _combatResurrectionCharges(0), _combatResurrectionTimerStarted(false)
{
#ifdef TRINITY_API_USE_DYNAMIC_LINKING
uint32 scriptId = sObjectMgr->GetInstanceTemplate(map->GetId())->ScriptId;
@@ -61,7 +61,8 @@ void InstanceScript::SaveToDB()
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_INSTANCE_DATA);
stmt->setUInt32(0, GetCompletedEncounterMask());
stmt->setString(1, data);
- stmt->setUInt32(2, instance->GetInstanceId());
+ stmt->setUInt32(2, _entranceId);
+ stmt->setUInt32(3, instance->GetInstanceId());
CharacterDatabase.Execute(stmt);
}
@@ -606,6 +607,13 @@ bool InstanceScript::CheckAchievementCriteriaMeet(uint32 criteria_id, Player con
return false;
}
+void InstanceScript::SetEntranceLocation(uint32 worldSafeLocationId)
+{
+ _entranceId = worldSafeLocationId;
+ if (_temporaryEntranceId)
+ _temporaryEntranceId = 0;
+}
+
void InstanceScript::SendEncounterUnit(uint32 type, Unit* unit /*= NULL*/, uint8 priority)
{
switch (type)