diff options
| author | joschiwald <joschiwald@online.de> | 2013-08-18 01:41:10 +0200 |
|---|---|---|
| committer | joschiwald <joschiwald@online.de> | 2013-08-18 01:41:10 +0200 |
| commit | 2b19ba1879cbdb121abe99f8d1060628a0c7243f (patch) | |
| tree | e50c7a58d55ea5e5caa6469d80aa2f8569e94fab /src/server/scripts/Outland | |
| parent | c32dbd1432b28206fee430da7e9f77d6053730fc (diff) | |
Misc: replace Unit::GetPlayer with ObjectAccessor::GetPlayer and some cosmetic changes
Diffstat (limited to 'src/server/scripts/Outland')
5 files changed, 124 insertions, 136 deletions
diff --git a/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp b/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp index 2fdfe72a6f9..f8f9bb790e0 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp @@ -31,10 +31,6 @@ EndScriptData */ #include "Player.h" #include "SpellInfo.h" -#define GETGO(obj, guid) GameObject* obj = instance->instance->GetGameObject(guid) -#define GETUNIT(unit, guid) Unit* unit = Unit::GetUnit(*me, guid) -#define GETCRE(cre, guid) Creature* cre = Unit::GetCreature(*me, guid) - #define EMOTE_UNABLE_TO_SUMMON "%s is unable to summon Maiev Shadowsong and enter Phase 4. Resetting Encounter." // Other defines @@ -409,11 +405,11 @@ public: void EnrageCheck() { - if (GETUNIT(Glaive, GlaiveGUID)) + if (Creature* glaive = ObjectAccessor::GetCreature(*me, GlaiveGUID)) { - if (!me->IsWithinDistInMap(Glaive, FLAME_ENRAGE_DISTANCE)) + if (!me->IsWithinDistInMap(glaive, FLAME_ENRAGE_DISTANCE)) { - Glaive->InterruptNonMeleeSpells(true); + glaive->InterruptNonMeleeSpells(true); DoCast(me, SPELL_FLAME_ENRAGE, true); DoResetThreat(); if (SelectTarget(SELECT_TARGET_RANDOM, 0)) @@ -424,7 +420,7 @@ public: } else if (!me->HasAura(SPELL_AZZINOTH_CHANNEL)) { - Glaive->CastSpell(me, SPELL_AZZINOTH_CHANNEL, false); + glaive->CastSpell(me, SPELL_AZZINOTH_CHANNEL, false); me->RemoveAurasDueToSpell(SPELL_FLAME_ENRAGE); } } @@ -694,13 +690,14 @@ public: } if (MaievGUID) { - GETCRE(Maiev, MaievGUID); - if (Maiev && Maiev->IsAlive()) - Maiev->AI()->DoAction(NextPhase); + if (Creature* maiev = ObjectAccessor::GetCreature(*me, MaievGUID)) + if (maiev->IsAlive()) + maiev->AI()->DoAction(NextPhase); } Phase = NextPhase; Event = EVENT_NULL; } + void CastEyeBlast() { me->InterruptNonMeleeSpells(false); @@ -738,26 +735,27 @@ public: me->SetTarget(Trigger->GetGUID()); DoCast(Trigger, SPELL_EYE_BLAST); } + void SummonFlamesOfAzzinoth() { Talk(SAY_ILLIDAN_SUMMONFLAMES); for (uint8 i = 0; i < 2; ++i) { - if (GETUNIT(Glaive, GlaiveGUID[i])) + if (Creature* glaive = ObjectAccessor::GetCreature(*me, GlaiveGUID[i])) { - Creature* Flame = me->SummonCreature(FLAME_OF_AZZINOTH, GlaivePosition[i+2].x, GlaivePosition[i+2].y, GlaivePosition[i+2].z, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000); - if (Flame) + if (Creature* flame = me->SummonCreature(FLAME_OF_AZZINOTH, GlaivePosition[i+2].x, GlaivePosition[i+2].y, GlaivePosition[i+2].z, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000)) { - Flame->setFaction(me->getFaction()); // Just in case the database has it as a different faction - Flame->SetMeleeDamageSchool(SPELL_SCHOOL_FIRE); - FlameGUID[i] = Flame->GetGUID(); // Record GUID in order to check if they're dead later on to move to the next phase - CAST_AI(npc_flame_of_azzinoth::flame_of_azzinothAI, Flame->AI())->SetGlaiveGUID(GlaiveGUID[i]); - Glaive->CastSpell(Flame, SPELL_AZZINOTH_CHANNEL, false); // Glaives do some random Beam type channel on it. + flame->setFaction(me->getFaction()); // Just in case the database has it as a different faction + flame->SetMeleeDamageSchool(SPELL_SCHOOL_FIRE); + FlameGUID[i] = flame->GetGUID(); // Record GUID in order to check if they're dead later on to move to the next phase + CAST_AI(npc_flame_of_azzinoth::flame_of_azzinothAI, flame->AI())->SetGlaiveGUID(GlaiveGUID[i]); + glaive->CastSpell(flame, SPELL_AZZINOTH_CHANNEL, false); // Glaives do some random Beam type channel on it. } } } } + void SummonMaiev() { DoCast(me, SPELL_SHADOW_PRISON, true); @@ -853,11 +851,9 @@ public: { if (GlaiveGUID[i]) { - if (GETUNIT(Glaive, GlaiveGUID[i])) - { - Glaive->SetVisible(false); - Glaive->setDeathState(JUST_DIED); // Despawn the Glaive - } + if (Creature* glaive = ObjectAccessor::GetCreature(*me, GlaiveGUID[i])) + glaive->DespawnOrUnsummon(); + GlaiveGUID[i] = 0; } } @@ -1173,9 +1169,10 @@ public: damage = 0; else { - GETUNIT(Illidan, IllidanGUID); - if (Illidan && Illidan->GetVictim() == me) - damage = me->CountPctFromMaxHealth(10); + if (Creature* illidan = ObjectAccessor::GetCreature(*me, IllidanGUID)) + if (illidan->GetVictim() == me) + damage = me->CountPctFromMaxHealth(10); + if (damage >= me->GetHealth()) damage = 0; } @@ -1190,9 +1187,9 @@ public: AttackStartNoMove(who); else if (Phase == PHASE_DEMON || Phase == PHASE_TRANSFORM_SEQUENCE) { - GETUNIT(Illidan, IllidanGUID); - if (Illidan && me->IsWithinDistInMap(Illidan, 25)) - BlinkToPlayer();// Do not let dread aura hurt her. + if (Creature* illidan = ObjectAccessor::GetCreature(*me, IllidanGUID)) + if (me->IsWithinDistInMap(illidan, 25)) + BlinkToPlayer(); // Do not let dread aura hurt her. AttackStartNoMove(who); } else @@ -1253,11 +1250,11 @@ public: void BlinkToPlayer() { - if (GETCRE(Illidan, IllidanGUID)) + if (Creature* illidan = ObjectAccessor::GetCreature(*me, IllidanGUID)) { - Unit* target = Illidan->AI()->SelectTarget(SELECT_TARGET_RANDOM, 0); + Unit* target = illidan->AI()->SelectTarget(SELECT_TARGET_RANDOM, 0); - if (!target || !me->IsWithinDistInMap(target, 80) || Illidan->IsWithinDistInMap(target, 20)) + if (!target || !me->IsWithinDistInMap(target, 80) || illidan->IsWithinDistInMap(target, 20)) { uint8 pos = rand()%4; BlinkTo(HoverPosition[pos].x, HoverPosition[pos].y, HoverPosition[pos].z); @@ -1329,8 +1326,8 @@ public: { me->SetVisible(false); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - if (GETCRE(Illidan, IllidanGUID)) - CAST_AI(boss_illidan_stormrage::boss_illidan_stormrageAI, Illidan->AI())->DeleteFromThreatList(me->GetGUID()); + if (Creature* illidan = ObjectAccessor::GetCreature(*me, IllidanGUID)) + CAST_AI(boss_illidan_stormrage::boss_illidan_stormrageAI, illidan->AI())->DeleteFromThreatList(me->GetGUID()); me->AttackStop(); Timer[EVENT_MAIEV_STEALTH] = 60000; // reappear after 1 minute MaxTimer = 1; @@ -1469,15 +1466,15 @@ public: instance->SetData(DATA_ILLIDANSTORMRAGEEVENT, IN_PROGRESS); for (uint8 i = 0; i < 2; ++i) instance->HandleGameObject(DoorGUID[i], false); - if (GETCRE(Illidan, IllidanGUID)) + if (Creature* illidan = ObjectAccessor::GetCreature(*me, IllidanGUID)) { - Illidan->RemoveAurasDueToSpell(SPELL_KNEEL); - me->SetInFront(Illidan); - Illidan->SetInFront(me); + illidan->RemoveAurasDueToSpell(SPELL_KNEEL); + me->SetInFront(illidan); + illidan->SetInFront(me); me->GetMotionMaster()->MoveIdle(); - Illidan->GetMotionMaster()->MoveIdle(); - CAST_AI(boss_illidan_stormrage::boss_illidan_stormrageAI, Illidan->AI())->AkamaGUID = me->GetGUID(); - CAST_AI(boss_illidan_stormrage::boss_illidan_stormrageAI, Illidan->AI())->EnterPhase(PHASE_TALK_SEQUENCE); + illidan->GetMotionMaster()->MoveIdle(); + CAST_AI(boss_illidan_stormrage::boss_illidan_stormrageAI, illidan->AI())->AkamaGUID = me->GetGUID(); + CAST_AI(boss_illidan_stormrage::boss_illidan_stormrageAI, illidan->AI())->EnterPhase(PHASE_TALK_SEQUENCE); } } @@ -1488,8 +1485,8 @@ public: if (!JustCreated) return; float x, y, z; - if (GETGO(Gate, GateGUID)) - Gate->GetPosition(x, y, z); + if (GameObject* gate = ObjectAccessor::GetGameObject(*me, GateGUID)) + gate->GetPosition(x, y, z); else return; // if door not spawned, don't crash server @@ -1531,8 +1528,8 @@ public: WalkCount = 0; else if (Phase == PHASE_TALK) { - if (GETCRE(Illidan, IllidanGUID)) - CAST_AI(boss_illidan_stormrage::boss_illidan_stormrageAI, Illidan->AI())->DeleteFromThreatList(me->GetGUID()); + if (Creature* illidan = ObjectAccessor::GetCreature(*me, IllidanGUID)) + CAST_AI(boss_illidan_stormrage::boss_illidan_stormrageAI, illidan->AI())->DeleteFromThreatList(me->GetGUID()); EnterEvadeMode(); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); ++WalkCount; @@ -1554,10 +1551,10 @@ public: } break; case PHASE_FIGHT_ILLIDAN: - if (GETUNIT(Illidan, IllidanGUID)) + if (Creature* illidan = ObjectAccessor::GetCreature(*me, IllidanGUID)) { - me->AddThreat(Illidan, 10000000.0f); - me->GetMotionMaster()->MoveChase(Illidan); + me->AddThreat(illidan, 10000000.0f); + me->GetMotionMaster()->MoveChase(illidan); } Timer = 30000; // chain lightning break; @@ -1584,10 +1581,10 @@ public: switch (TalkCount) { case 0: - if (GETCRE(Illidan, IllidanGUID)) + if (Creature* illidan = ObjectAccessor::GetCreature(*me, IllidanGUID)) { - CAST_AI(boss_illidan_stormrage::boss_illidan_stormrageAI, Illidan->AI())->Timer[EVENT_TAUNT] += 30000; - Illidan->AI()->Talk(SAY_ILLIDAN_MINION); + CAST_AI(boss_illidan_stormrage::boss_illidan_stormrageAI, illidan->AI())->Timer[EVENT_TAUNT] += 30000; + illidan->AI()->Talk(SAY_ILLIDAN_MINION); } Timer = 8000; break; @@ -1728,8 +1725,8 @@ public: break; case PHASE_FIGHT_ILLIDAN: { - GETUNIT(Illidan, IllidanGUID); - if (Illidan && Illidan->HealthBelowPct(90)) + Creature* illidan = ObjectAccessor::GetCreature(*me, IllidanGUID); + if (illidan && illidan->HealthBelowPct(90)) EnterPhase(PHASE_TALK); else { @@ -1752,9 +1749,9 @@ public: me->AddThreat(Elite, 1000000.0f); } Timer = urand(10000, 16000); - GETUNIT(Illidan, IllidanGUID); - if (Illidan && Illidan->HealthBelowPct(10)) - EnterPhase(PHASE_RETURN); + if (Creature* illidan = ObjectAccessor::GetCreature(*me, IllidanGUID)) + if (illidan->HealthBelowPct(10)) + EnterPhase(PHASE_RETURN); } break; default: @@ -1807,16 +1804,12 @@ void boss_illidan_stormrage::boss_illidan_stormrageAI::Reset() if (AkamaGUID) { - if (GETCRE(Akama, AkamaGUID)) + if (Creature* akama = ObjectAccessor::GetCreature(*me, AkamaGUID)) { - if (!Akama->IsAlive()) - Akama->Respawn(); + if (!akama->IsAlive()) + akama->Respawn(); else - { - CAST_AI(npc_akama_illidan::npc_akama_illidanAI, Akama->AI())->EnterEvadeMode(); - Akama->GetMotionMaster()->MoveTargetedHome(); - CAST_AI(npc_akama_illidan::npc_akama_illidanAI, Akama->AI())->Reset(); - } + akama->AI()->EnterEvadeMode(); } AkamaGUID = 0; } @@ -1908,11 +1901,11 @@ void boss_illidan_stormrage::boss_illidan_stormrageAI::HandleTalkSequence() me->SetWalk(false); break; case 9: - if (GETCRE(Akama, AkamaGUID)) + if (Creature* akama = ObjectAccessor::GetCreature(*me, AkamaGUID)) { me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE + UNIT_FLAG_NOT_SELECTABLE); - me->AddThreat(Akama, 100.0f); - CAST_AI(npc_akama_illidan::npc_akama_illidanAI, Akama->AI())->EnterPhase(PHASE_FIGHT_ILLIDAN); + me->AddThreat(akama, 100.0f); + CAST_AI(npc_akama_illidan::npc_akama_illidanAI, akama->AI())->EnterPhase(PHASE_FIGHT_ILLIDAN); EnterPhase(PHASE_NORMAL); } break; @@ -1920,23 +1913,23 @@ void boss_illidan_stormrage::boss_illidan_stormrageAI::HandleTalkSequence() SummonMaiev(); break; case 11: - if (GETUNIT(Maiev, MaievGUID)) + if (Creature* maiev = ObjectAccessor::GetCreature(*me, MaievGUID)) { - Maiev->SetVisible(true); // Maiev is now visible - Maiev->CastSpell(Maiev, SPELL_TELEPORT_VISUAL, true); // onoz she looks like she teleported! - Maiev->SetInFront(me); // Have her face us - me->SetInFront(Maiev); // Face her, so it's not rude =P - Maiev->GetMotionMaster()->MoveIdle(); + maiev->SetVisible(true); // Maiev is now visible + maiev->CastSpell(maiev, SPELL_TELEPORT_VISUAL, true); // onoz she looks like she teleported! + maiev->SetInFront(me); // Have her face us + me->SetInFront(maiev); // Face her, so it's not rude =P + maiev->GetMotionMaster()->MoveIdle(); me->GetMotionMaster()->MoveIdle(); } break; case 14: - if (GETCRE(Maiev, MaievGUID)) + if (Creature* maiev = ObjectAccessor::GetCreature(*me, MaievGUID)) { me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE + UNIT_FLAG_NOT_SELECTABLE); - Maiev->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE + UNIT_FLAG_NOT_SELECTABLE); - Maiev->AddThreat(me, 10000000.0f); // Have Maiev add a lot of threat on us so that players don't pull her off if they damage her via AOE - Maiev->AI()->AttackStart(me); // Force Maiev to attack us. + maiev->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE + UNIT_FLAG_NOT_SELECTABLE); + maiev->AddThreat(me, 10000000.0f); // Have Maiev add a lot of threat on us so that players don't pull her off if they damage her via AOE + maiev->AI()->AttackStart(me); // Force Maiev to attack us. EnterPhase(PHASE_NORMAL_MAIEV); } break; @@ -1945,26 +1938,26 @@ void boss_illidan_stormrage::boss_illidan_stormrageAI::HandleTalkSequence() Summons.DespawnAll(); break; case 17: - if (GETCRE(Akama, AkamaGUID)) + if (Creature* akama = ObjectAccessor::GetCreature(*me, AkamaGUID)) { - if (!me->IsWithinDistInMap(Akama, 15)) + if (!me->IsWithinDistInMap(akama, 15)) { float x, y, z; me->GetPosition(x, y, z); x += 10; y += 10; - Akama->GetMotionMaster()->Clear(false); + akama->GetMotionMaster()->Clear(false); // Akama->GetMotionMaster()->MoveIdle(); - Akama->SetPosition(x, y, z, 0.0f); - Akama->MonsterMoveWithSpeed(x, y, z, 0); // Illidan must not die until Akama arrives. - Akama->GetMotionMaster()->MoveChase(me); + akama->SetPosition(x, y, z, 0.0f); + akama->MonsterMoveWithSpeed(x, y, z, 0); // Illidan must not die until Akama arrives. + akama->GetMotionMaster()->MoveChase(me); } } break; case 19: // Make Maiev leave - if (GETUNIT(Maiev, MaievGUID)) + if (Creature* maiev = ObjectAccessor::GetCreature(*me, MaievGUID)) { - Maiev->CastSpell(Maiev, SPELL_TELEPORT_VISUAL, true); - Maiev->setDeathState(JUST_DIED); + maiev->CastSpell(maiev, SPELL_TELEPORT_VISUAL, true); + maiev->setDeathState(JUST_DIED); me->SetUInt32Value(UNIT_FIELD_BYTES_1, UNIT_STAND_STATE_DEAD); } break; @@ -2208,22 +2201,24 @@ public: AttackStart(target); else { - me->SetVisible(false); - me->setDeathState(JUST_DIED); + me->DespawnOrUnsummon(); return; } } if (CheckTimer <= diff) { - GETUNIT(Illidan, IllidanGUID); - if (!Illidan || Illidan->ToCreature()->IsInEvadeMode()) + Creature* illidan = ObjectAccessor::GetCreature(*me, IllidanGUID); + if (!illidan || illidan->IsInEvadeMode()) { - me->SetVisible(false); - me->setDeathState(JUST_DIED); + me->DespawnOrUnsummon(); return; - } else CheckTimer = 5000; - } else CheckTimer -= diff; + } + else + CheckTimer = 5000; + } + else + CheckTimer -= diff; DoMeleeAttackIfReady(); } diff --git a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_omor_the_unscarred.cpp b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_omor_the_unscarred.cpp index a87aefa72af..7e80182f1e8 100644 --- a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_omor_the_unscarred.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_omor_the_unscarred.cpp @@ -132,7 +132,7 @@ class boss_omor_the_unscarred : public CreatureScript { if (ShadowWhip_Timer <= diff) { - if (Player* temp = Unit::GetPlayer(*me, PlayerGUID)) + if (Player* temp = ObjectAccessor::GetPlayer(*me, PlayerGUID)) { //if unit dosen't have this flag, then no pulling back (script will attempt cast, even if orbital strike was resisted) if (temp->HasUnitMovementFlag(MOVEMENTFLAG_FALLING_FAR)) diff --git a/src/server/scripts/Outland/zone_blades_edge_mountains.cpp b/src/server/scripts/Outland/zone_blades_edge_mountains.cpp index 6273731f292..57eb587140f 100644 --- a/src/server/scripts/Outland/zone_blades_edge_mountains.cpp +++ b/src/server/scripts/Outland/zone_blades_edge_mountains.cpp @@ -500,7 +500,6 @@ public: } void MoveInLineOfSight(Unit* who) OVERRIDE - { if (!who || (!who->IsAlive())) return; @@ -516,15 +515,16 @@ public: void MovementInform(uint32 /*type*/, uint32 id) OVERRIDE { - Player* player = Unit::GetPlayer(*me, PlayerGUID); if (id == 1) { - GameObject* Keg = me->FindNearestGameObject(GO_KEG, 20); - if (Keg) + if (GameObject* Keg = me->FindNearestGameObject(GO_KEG, 20)) Keg->Delete(); + me->HandleEmoteCommand(7); me->SetReactState(REACT_AGGRESSIVE); me->GetMotionMaster()->MoveTargetedHome(); + + Player* player = ObjectAccessor::GetPlayer(*me, PlayerGUID); Creature* Credit = me->FindNearestCreature(NPC_QUEST_CREDIT, 50, true); if (player && Credit) player->KilledMonster(Credit->GetCreatureTemplate(), Credit->GetGUID()); @@ -1017,7 +1017,7 @@ class npc_simon_bunny : public CreatureScript } if (rewSpell) - if (Player* player = me->GetPlayer(*me, playerGUID)) + if (Player* player = ObjectAccessor::GetPlayer(*me, playerGUID)) DoCast(player, rewSpell, true); } @@ -1032,7 +1032,7 @@ class npc_simon_bunny : public CreatureScript { if (large) { - if (Player* player = me->GetPlayer(*me, playerGUID)) + if (Player* player = ObjectAccessor::GetPlayer(*me, playerGUID)) if (Creature* guardian = me->SummonCreature(NPC_APEXIS_GUARDIAN, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ() - zCoordCorrection, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 20000)) guardian->AI()->AttackStart(player); @@ -1042,7 +1042,7 @@ class npc_simon_bunny : public CreatureScript { fails++; - if (Player* player = me->GetPlayer(*me, playerGUID)) + if (Player* player = ObjectAccessor::GetPlayer(*me, playerGUID)) DoCast(player, SPELL_BAD_PRESS_TRIGGER, true); if (fails >= 4) @@ -1065,7 +1065,7 @@ class npc_simon_bunny : public CreatureScript // Checks if player has already die or has get too far from the current node bool CheckPlayer() { - if (Player* player = me->GetPlayer(*me, playerGUID)) + if (Player* player = ObjectAccessor::GetPlayer(*me, playerGUID)) { if (player->isDead()) return false; diff --git a/src/server/scripts/Outland/zone_netherstorm.cpp b/src/server/scripts/Outland/zone_netherstorm.cpp index 7e99275adbd..74257c95cf3 100644 --- a/src/server/scripts/Outland/zone_netherstorm.cpp +++ b/src/server/scripts/Outland/zone_netherstorm.cpp @@ -436,9 +436,9 @@ public: // Emote Ardonis and Pathaleon void Turn_to_Pathaleons_Image() { - Creature* ardonis = Unit::GetCreature(*me, ardonisGUID); - Creature* pathaleon = Unit::GetCreature(*me, pathaleonGUID); - Player* player = Unit::GetPlayer(*me, PlayerGUID); + Creature* ardonis = ObjectAccessor::GetCreature(*me, ardonisGUID); + Creature* pathaleon = ObjectAccessor::GetCreature(*me, pathaleonGUID); + Player* player = ObjectAccessor::GetPlayer(*me, PlayerGUID); if (!ardonis || !pathaleon || !player) return; @@ -462,9 +462,9 @@ public: //Set them back to each other void Turn_to_eachother() { - if (Unit* ardonis = Unit::GetUnit(*me, ardonisGUID)) + if (Unit* ardonis = ObjectAccessor::GetUnit(*me, ardonisGUID)) { - Player* player = Unit::GetPlayer(*me, PlayerGUID); + Player* player = ObjectAccessor::GetPlayer(*me, PlayerGUID); if (!player) return; @@ -519,9 +519,9 @@ public: return; } - Creature* ardonis = Creature::GetCreature(*me, ardonisGUID); - Creature* pathaleon = Creature::GetCreature(*me, pathaleonGUID); - Player* player = Unit::GetPlayer(*me, PlayerGUID); + Creature* ardonis = ObjectAccessor::GetCreature(*me, ardonisGUID); + Creature* pathaleon = ObjectAccessor::GetCreature(*me, pathaleonGUID); + Player* player = ObjectAccessor::GetPlayer(*me, PlayerGUID); if (!ardonis || !player) { @@ -821,7 +821,7 @@ public: ManaBurnTimer = 3500; } else ManaBurnTimer -= diff; - if (Player* player = Unit::GetPlayer(*me, PlayerGUID)) // start: support for quest 10190 + if (Player* player = ObjectAccessor::GetPlayer(*me, PlayerGUID)) // start: support for quest 10190 { if (!Weak && HealthBelowPct(WeakPercent) && player->GetQuestStatus(QUEST_RECHARGING_THE_BATTERIES) == QUEST_STATUS_INCOMPLETE) diff --git a/src/server/scripts/Outland/zone_shadowmoon_valley.cpp b/src/server/scripts/Outland/zone_shadowmoon_valley.cpp index b7cf46ad8ae..cb88e5a5a9c 100644 --- a/src/server/scripts/Outland/zone_shadowmoon_valley.cpp +++ b/src/server/scripts/Outland/zone_shadowmoon_valley.cpp @@ -154,11 +154,11 @@ public: DoCast(me, SPELL_JUST_EATEN); Talk(SAY_JUST_EATEN); - if (Player* pPlr = Unit::GetPlayer(*me, uiPlayerGUID)) + if (Player* player = ObjectAccessor::GetPlayer(*me, uiPlayerGUID)) { - pPlr->KilledMonsterCredit(NPC_EVENT_PINGER, 0); + player->KilledMonsterCredit(NPC_EVENT_PINGER, 0); - if (GameObject* go = pPlr->FindNearestGameObject(GO_CARCASS, 10)) + if (GameObject* go = player->FindNearestGameObject(GO_CARCASS, 10)) go->Delete(); } @@ -298,7 +298,7 @@ public: Tapped = false; if (PlayerGUID) { - Player* player = Unit::GetPlayer(*me, PlayerGUID); + Player* player = ObjectAccessor::GetPlayer(*me, PlayerGUID); if (player && player->GetQuestStatus(10854) == QUEST_STATUS_INCOMPLETE) { DoCast(player, SPELL_FORCE_OF_NELTHARAKU, true); @@ -400,7 +400,7 @@ public: { if (PlayerGUID) { - Player* player = Unit::GetPlayer(*me, PlayerGUID); + Player* player = ObjectAccessor::GetPlayer(*me, PlayerGUID); if (player && player->GetQuestStatus(11020) == QUEST_STATUS_INCOMPLETE) player->KilledMonsterCredit(23209, 0); } @@ -760,7 +760,7 @@ public: } if (PlayerGUID) { - Player* player = Unit::GetPlayer(*me, PlayerGUID); + Player* player = ObjectAccessor::GetPlayer(*me, PlayerGUID); if (player) Talk(OVERLORD_SAY_1, player->GetGUID()); } @@ -771,8 +771,8 @@ public: uint32 NextStep(uint32 Step) { - Player* player = Unit::GetPlayer(*me, PlayerGUID); - Creature* Illi = Creature::GetCreature(*me, IllidanGUID); + Player* player = ObjectAccessor::GetPlayer(*me, PlayerGUID); + Creature* Illi = ObjectAccessor::GetCreature(*me, IllidanGUID); if (!player) { @@ -1311,7 +1311,7 @@ public: me->RemoveFlag(UNIT_FIELD_BYTES_1, 8); break; case 5: - if (Player* AggroTarget = (Unit::GetPlayer(*me, AggroTargetGUID))) + if (Player* AggroTarget = ObjectAccessor::GetPlayer(*me, AggroTargetGUID)) { me->SetTarget(AggroTarget->GetGUID()); me->AddThreat(AggroTarget, 1); @@ -1319,7 +1319,7 @@ public: } break; case 6: - if (Player* AggroTarget = (Unit::GetPlayer(*me, AggroTargetGUID))) + if (Player* AggroTarget = ObjectAccessor::GetPlayer(*me, AggroTargetGUID)) { me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); me->ClearUnitState(UNIT_STATE_ROOT); @@ -1456,15 +1456,13 @@ public: void CheckEventFail() { - Player* player = Unit::GetPlayer(*me, PlayerGUID); + Player* player = ObjectAccessor::GetPlayer(*me, PlayerGUID); if (!player) return; if (Group* EventGroup = player->GetGroup()) { - Player* GroupMember; - uint8 GroupMemberCount = 0; uint8 DeadMemberCount = 0; uint8 FailedMemberCount = 0; @@ -1473,7 +1471,7 @@ public: for (Group::member_citerator itr = members.begin(); itr!= members.end(); ++itr) { - GroupMember = (Unit::GetPlayer(*me, itr->guid)); + Player* GroupMember = ObjectAccessor::GetPlayer(*me, itr->guid); if (!GroupMember) continue; if (!GroupMember->IsWithinDistInMap(me, EVENT_AREA_RADIUS) && GroupMember->GetQuestStatus(QUEST_BATTLE_OF_THE_CRIMSON_WATCH) == QUEST_STATUS_INCOMPLETE) @@ -1484,9 +1482,7 @@ public: ++GroupMemberCount; if (GroupMember->isDead()) - { ++DeadMemberCount; - } } if (GroupMemberCount == FailedMemberCount) @@ -1498,12 +1494,9 @@ public: { for (Group::member_citerator itr = members.begin(); itr!= members.end(); ++itr) { - GroupMember = Unit::GetPlayer(*me, itr->guid); - - if (GroupMember && GroupMember->GetQuestStatus(QUEST_BATTLE_OF_THE_CRIMSON_WATCH) == QUEST_STATUS_INCOMPLETE) - { - GroupMember->FailQuest(QUEST_BATTLE_OF_THE_CRIMSON_WATCH); - } + if (Player* groupMember = ObjectAccessor::GetPlayer(*me, itr->guid)) + if (groupMember->GetQuestStatus(QUEST_BATTLE_OF_THE_CRIMSON_WATCH) == QUEST_STATUS_INCOMPLETE) + groupMember->FailQuest(QUEST_BATTLE_OF_THE_CRIMSON_WATCH); } Failed = true; } @@ -1713,7 +1706,7 @@ void npc_lord_illidan_stormrage::npc_lord_illidan_stormrageAI::SummonNextWave() { if (PlayerGUID) { - if (Player* target = Unit::GetPlayer(*me, PlayerGUID)) + if (Player* target = ObjectAccessor::GetPlayer(*me, PlayerGUID)) { float x, y, z; target->GetPosition(x, y, z); |
