diff options
author | jackpoz <giacomopoz@gmail.com> | 2015-05-17 14:50:30 +0200 |
---|---|---|
committer | DDuarte <dnpd.dd@gmail.com> | 2015-06-26 02:56:40 +0100 |
commit | d423747037dd5c9b3849d8453b29bdab0a6fdac9 (patch) | |
tree | 5d12eeb477efabcd22bae6968d5692abdee37b37 /src | |
parent | 6df2d03f7282ef9b1635304e300787806d69d70c (diff) |
Scripts/ToC: Fix doors opening/closing during Dreadscale fight
Fix doors opening/closing during Dreadscale fight by sending a CloseDoor command instead of toggling the door state when Dreadscale resets its movement.
Note that bounding the door state to boss movement makes poor sense and should be changed. Other bosses in ToC have this logic and should be updated if they show the same bug.
(cherry picked from commit b5cc8c5b17c96f281728ee08576acfff507d8039)
Diffstat (limited to 'src')
3 files changed, 22 insertions, 2 deletions
diff --git a/src/server/game/Instances/InstanceScript.cpp b/src/server/game/Instances/InstanceScript.cpp index c151183da8a..80024879a43 100644 --- a/src/server/game/Instances/InstanceScript.cpp +++ b/src/server/game/Instances/InstanceScript.cpp @@ -426,7 +426,26 @@ void InstanceScript::DoUseDoorOrButton(ObjectGuid guid, uint32 withRestoreTime / TC_LOG_ERROR("scripts", "InstanceScript: DoUseDoorOrButton can't use gameobject entry %u, because type is %u.", go->GetEntry(), go->GetGoType()); } else - TC_LOG_DEBUG("scripts", "InstanceScript: HandleGameObject failed"); + TC_LOG_DEBUG("scripts", "InstanceScript: DoUseDoorOrButton failed"); +} + +void InstanceScript::DoCloseDoorOrButton(ObjectGuid guid) +{ + if (!guid) + return; + + if (GameObject* go = instance->GetGameObject(guid)) + { + if (go->GetGoType() == GAMEOBJECT_TYPE_DOOR || go->GetGoType() == GAMEOBJECT_TYPE_BUTTON) + { + if (go->getLootState() == GO_ACTIVATED) + go->ResetDoorOrButton(); + } + else + TC_LOG_ERROR("scripts", "InstanceScript: DoCloseDoorOrButton can't use gameobject entry %u, because type is %u.", go->GetEntry(), go->GetGoType()); + } + else + TC_LOG_DEBUG("scripts", "InstanceScript: DoCloseDoorOrButton failed"); } void InstanceScript::DoRespawnGameObject(ObjectGuid guid, uint32 timeToDespawn /*= MINUTE*/) diff --git a/src/server/game/Instances/InstanceScript.h b/src/server/game/Instances/InstanceScript.h index be1956efc79..d932c24abf3 100644 --- a/src/server/game/Instances/InstanceScript.h +++ b/src/server/game/Instances/InstanceScript.h @@ -195,6 +195,7 @@ class InstanceScript : public ZoneScript // Change active state of doors or buttons void DoUseDoorOrButton(ObjectGuid guid, uint32 withRestoreTime = 0, bool useAlternativeState = false); + void DoCloseDoorOrButton(ObjectGuid guid); // Respawns a GO having negative spawntimesecs in gameobject-table void DoRespawnGameObject(ObjectGuid guid, uint32 timeToDespawn = MINUTE); diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp index 39c9fbe37a6..c56a49cb92c 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp @@ -741,7 +741,7 @@ class boss_dreadscale : public CreatureScript switch (pointId) { case 0: - instance->DoUseDoorOrButton(instance->GetGuidData(GO_MAIN_GATE_DOOR)); + instance->DoCloseDoorOrButton(instance->GetGuidData(GO_MAIN_GATE_DOOR)); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); me->SetReactState(REACT_AGGRESSIVE); me->SetInCombatWithZone(); |