From 649e3a9ac59a1d24eeec3419138d0d5f11dee566 Mon Sep 17 00:00:00 2001 From: Krudor Date: Sat, 16 Jul 2016 14:58:33 +0200 Subject: 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 --- src/server/game/Instances/InstanceScript.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/server/game/Instances/InstanceScript.cpp') 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) -- cgit v1.2.3