From e152d6a3aabcabdebe03ee133a4ea2d69395b182 Mon Sep 17 00:00:00 2001 From: vrachv <52053491+vrachv@users.noreply.github.com> Date: Sun, 29 Dec 2024 19:13:22 +0000 Subject: [PATCH] fix(Scripts/Karazhan): Chess pieces reset to correct positions (#21061) --- .../scripts/EasternKingdoms/Karazhan/boss_chess_event.cpp | 4 ++++ .../scripts/EasternKingdoms/Karazhan/instance_karazhan.cpp | 3 --- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_chess_event.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_chess_event.cpp index 8a6869d64..84d51f7d0 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_chess_event.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_chess_event.cpp @@ -1424,6 +1424,7 @@ struct npc_chesspiece : public ScriptedAI _instance = creature->GetInstanceScript(); _currentOrientation = GetDefaultOrientationForTeam(); + _homePosition = creature->GetPosition(); _nextMoveTimer = urand(8 * IN_MILLISECONDS, 20 * IN_MILLISECONDS); @@ -1457,6 +1458,8 @@ struct npc_chesspiece : public ScriptedAI { me->SetResistance(SpellSchools(i), 0); } + + me->NearTeleportTo(_homePosition); } void EnterEvadeMode(EvadeReason /*why*/) override @@ -2044,6 +2047,7 @@ private: KarazhanChessOrientationType _currentOrientation; bool _teamControlledByRaid; + Position _homePosition; }; struct npc_chess_move_trigger : public ScriptedAI diff --git a/src/server/scripts/EasternKingdoms/Karazhan/instance_karazhan.cpp b/src/server/scripts/EasternKingdoms/Karazhan/instance_karazhan.cpp index ddc653f32..76758c950 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/instance_karazhan.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/instance_karazhan.cpp @@ -271,9 +271,6 @@ public: piece->RemoveAllAuras(); piece->setDeathState(DeathState::JustRespawned); piece->SetHealth(piece->GetMaxHealth()); - float x, y, z, o; - piece->GetHomePosition(x, y, z, o); - piece->NearTeleportTo(x, y, z, o); piece->AI()->DoAction(ACTION_CHESS_PIECE_RESET_ORIENTATION); piece->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE); piece->AI()->Reset();