From 88daff9676c7d85f138a2ac111de65738e143de3 Mon Sep 17 00:00:00 2001 From: Trazom62 Date: Tue, 7 Sep 2010 20:52:42 +0200 Subject: Script: Fix crash in boss_tharon_ja. Fixes issue #3356. --HG-- branch : trunk --- .../Northrend/DraktharonKeep/boss_tharon_ja.cpp | 32 ++++++++++------------ 1 file changed, 15 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/server/scripts/Northrend/DraktharonKeep/boss_tharon_ja.cpp b/src/server/scripts/Northrend/DraktharonKeep/boss_tharon_ja.cpp index 0da57724115..902b9518352 100644 --- a/src/server/scripts/Northrend/DraktharonKeep/boss_tharon_ja.cpp +++ b/src/server/scripts/Northrend/DraktharonKeep/boss_tharon_ja.cpp @@ -150,15 +150,14 @@ public: { DoScriptText(RAND(SAY_FLESH_1,SAY_FLESH_2),me); me->SetDisplayId(MODEL_FLESH); - std::list& threatlist = me->getThreatManager().getThreatList(); - for (std::list::const_iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr) + + std::list playerList; + SelectTargetList(playerList, 5, SELECT_TARGET_TOPAGGRO, 0, true); + for (std::list::const_iterator itr = playerList.begin(); itr != playerList.end(); ++itr) { - Unit *pTemp = Unit::GetUnit((*me),(*itr)->getUnitGuid()); - if (pTemp && pTemp->GetTypeId() == TYPEID_PLAYER) - { - me->AddAura(SPELL_GIFT_OF_THARON_JA,pTemp); - pTemp->SetDisplayId(MODEL_SKELETON); - } + Unit *pTemp = (*itr); + me->AddAura(SPELL_GIFT_OF_THARON_JA,pTemp); + pTemp->SetDisplayId(MODEL_SKELETON); } uiPhaseTimer = 20*IN_MILLISECONDS; uiLightningBreathTimer = urand(3*IN_MILLISECONDS,4*IN_MILLISECONDS); @@ -206,16 +205,15 @@ public: uiCurseOfLifeTimer = 1*IN_MILLISECONDS; uiRainOfFireTimer = urand(14*IN_MILLISECONDS,18*IN_MILLISECONDS); uiShadowVolleyTimer = urand(8*IN_MILLISECONDS,10*IN_MILLISECONDS); - std::list& threatlist = me->getThreatManager().getThreatList(); - for (std::list::const_iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr) + + std::list playerList; + SelectTargetList(playerList, 5, SELECT_TARGET_TOPAGGRO, 0, true); + for (std::list::const_iterator itr = playerList.begin(); itr != playerList.end(); ++itr) { - Unit *pTemp = Unit::GetUnit((*me),(*itr)->getUnitGuid()); - if (pTemp && pTemp->GetTypeId() == TYPEID_PLAYER) - { - if (pTemp->HasAura(SPELL_GIFT_OF_THARON_JA)) - pTemp->RemoveAura(SPELL_GIFT_OF_THARON_JA); - pTemp->DeMorph(); - } + Unit *pTemp = (*itr); + if (pTemp->HasAura(SPELL_GIFT_OF_THARON_JA)) + pTemp->RemoveAura(SPELL_GIFT_OF_THARON_JA); + pTemp->DeMorph(); } } else uiPhaseTimer -= diff; break; -- cgit v1.2.3