diff options
15 files changed, 36 insertions, 59 deletions
diff --git a/src/server/game/AI/CoreAI/PetAI.cpp b/src/server/game/AI/CoreAI/PetAI.cpp index 1f312de73f6..18daf1ef8de 100644 --- a/src/server/game/AI/CoreAI/PetAI.cpp +++ b/src/server/game/AI/CoreAI/PetAI.cpp @@ -409,7 +409,7 @@ Unit* PetAI::SelectNextTarget(bool allowAutoSelect) const if (me->HasReactState(REACT_AGGRESSIVE) && allowAutoSelect) { if (!me->GetCharmInfo()->IsReturning() || me->GetCharmInfo()->IsFollowing() || me->GetCharmInfo()->IsAtStay()) - if (Unit* nearTarget = me->ToCreature()->SelectNearestHostileUnitInAggroRange(true)) + if (Unit* nearTarget = me->SelectNearestHostileUnitInAggroRange(true)) return nearTarget; } diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index 7555471e091..ecfe35345f2 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -525,9 +525,9 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(e.action.cast.spell); int32 mana = me->GetPower(POWER_MANA); - if (me->GetDistance((*itr)->ToUnit()) > spellInfo->GetMaxRange(true) || - me->GetDistance((*itr)->ToUnit()) < spellInfo->GetMinRange(true) || - !me->ToUnit()->IsWithinLOSInMap((*itr)->ToUnit()) || + if (me->GetDistance(*itr) > spellInfo->GetMaxRange(true) || + me->GetDistance(*itr) < spellInfo->GetMinRange(true) || + !me->IsWithinLOSInMap(*itr) || mana < spellInfo->CalcPowerCost(me, spellInfo->GetSchoolMask())) _allowMove = true; diff --git a/src/server/game/Battlefield/Battlefield.cpp b/src/server/game/Battlefield/Battlefield.cpp index 07dfb45150c..c446b26722d 100644 --- a/src/server/game/Battlefield/Battlefield.cpp +++ b/src/server/game/Battlefield/Battlefield.cpp @@ -821,7 +821,7 @@ Creature* Battlefield::SpawnCreature(uint32 entry, float x, float y, float z, fl return 0; } - Creature* creature = new Creature; + Creature* creature = new Creature(); if (!creature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, PHASEMASK_NORMAL, entry, 0, team, x, y, z, o)) { TC_LOG_ERROR("bg.battlefield", "Battlefield::SpawnCreature: Can't create creature entry: %u", entry); diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp index 044036ef860..58ca7b9d639 100644 --- a/src/server/game/Battlegrounds/Battleground.cpp +++ b/src/server/game/Battlegrounds/Battleground.cpp @@ -1574,7 +1574,7 @@ Creature* Battleground::AddCreature(uint32 entry, uint32 type, uint32 teamval, f if (!map) return NULL; - Creature* creature = new Creature; + Creature* creature = new Creature(); if (!creature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, PHASEMASK_NORMAL, entry, 0, teamval, x, y, z, o)) { TC_LOG_ERROR("bg.battleground", "Battleground::AddCreature: cannot create creature (entry: %u) for BG (map: %u, instance id: %u)!", diff --git a/src/server/game/Events/GameEventMgr.cpp b/src/server/game/Events/GameEventMgr.cpp index b0428de6e28..55550dc019b 100644 --- a/src/server/game/Events/GameEventMgr.cpp +++ b/src/server/game/Events/GameEventMgr.cpp @@ -1180,7 +1180,7 @@ void GameEventMgr::GameEventSpawn(int16 event_id) // We use spawn coords to spawn if (!map->Instanceable() && map->IsGridLoaded(data->posX, data->posY)) { - Creature* creature = new Creature; + Creature* creature = new Creature(); //TC_LOG_DEBUG("misc", "Spawning creature %u", *itr); if (!creature->LoadCreatureFromDB(*itr, map)) delete creature; diff --git a/src/server/game/Pools/PoolMgr.cpp b/src/server/game/Pools/PoolMgr.cpp index d4211f83a11..1eed9feb289 100644 --- a/src/server/game/Pools/PoolMgr.cpp +++ b/src/server/game/Pools/PoolMgr.cpp @@ -364,7 +364,7 @@ void PoolGroup<Creature>::Spawn1Object(PoolObject* obj) // We use spawn coords to spawn if (!map->Instanceable() && map->IsGridLoaded(data->posX, data->posY)) { - Creature* creature = new Creature; + Creature* creature = new Creature(); //TC_LOG_DEBUG("pool", "Spawning creature %u", guid); if (!creature->LoadCreatureFromDB(obj->guid, map)) { diff --git a/src/server/scripts/Commands/cs_debug.cpp b/src/server/scripts/Commands/cs_debug.cpp index a4ccbc40211..d84cf140ac1 100644 --- a/src/server/scripts/Commands/cs_debug.cpp +++ b/src/server/scripts/Commands/cs_debug.cpp @@ -923,7 +923,7 @@ public: if (!ve) return false; - Creature* v = new Creature; + Creature* v = new Creature(); Map* map = handler->GetSession()->GetPlayer()->GetMap(); diff --git a/src/server/scripts/Commands/cs_wp.cpp b/src/server/scripts/Commands/cs_wp.cpp index dc731985588..daa760c9c56 100644 --- a/src/server/scripts/Commands/cs_wp.cpp +++ b/src/server/scripts/Commands/cs_wp.cpp @@ -689,7 +689,7 @@ public: wpCreature->AddObjectToRemoveList(); } // re-create - Creature* wpCreature2 = new Creature; + Creature* wpCreature2 = new Creature(); if (!wpCreature2->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, chr->GetPhaseMaskForSpawn(), VISUAL_WAYPOINT, 0, 0, chr->GetPositionX(), chr->GetPositionY(), chr->GetPositionZ(), chr->GetOrientation())) { handler->PSendSysMessage(LANG_WAYPOINT_VP_NOTCREATED, VISUAL_WAYPOINT); @@ -913,7 +913,7 @@ public: Map* map = chr->GetMap(); float o = chr->GetOrientation(); - Creature* wpCreature = new Creature; + Creature* wpCreature = new Creature(); if (!wpCreature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, chr->GetPhaseMaskForSpawn(), id, 0, 0, x, y, z, o)) { handler->PSendSysMessage(LANG_WAYPOINT_VP_NOTCREATED, id); @@ -977,7 +977,7 @@ public: float o = chr->GetOrientation(); Map* map = chr->GetMap(); - Creature* creature = new Creature; + Creature* creature = new Creature(); if (!creature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, chr->GetPhaseMaskForSpawn(), id, 0, 0, x, y, z, o)) { handler->PSendSysMessage(LANG_WAYPOINT_VP_NOTCREATED, id); @@ -1026,7 +1026,7 @@ public: Player* chr = handler->GetSession()->GetPlayer(); Map* map = chr->GetMap(); - Creature* creature = new Creature; + Creature* creature = new Creature(); if (!creature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, chr->GetPhaseMaskForSpawn(), id, 0, 0, x, y, z, o)) { handler->PSendSysMessage(LANG_WAYPOINT_NOTCREATED, id); diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_ras_frostwhisper.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_ras_frostwhisper.cpp index 451fd46938d..f93f0a94414 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/boss_ras_frostwhisper.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_ras_frostwhisper.cpp @@ -69,7 +69,7 @@ public: DoCast(me, SPELL_ICEARMOR, true); } - void EnterCombat(Unit* /*who*/)OVERRIDE { } + void EnterCombat(Unit* /*who*/) OVERRIDE { } void UpdateAI(uint32 diff) OVERRIDE { diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp index ca5dcf5360e..80b4b98b0a4 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp @@ -351,8 +351,7 @@ public: break; } case 6: - me->SetOrientation(me->GetAngle(breathX, breathY)); - me->StopMoving(); + me->SetFacingTo(me->GetAngle(breathX, breathY)); //DoTextEmote("takes a deep breath.", NULL); events.ScheduleEvent(EVENT_FLIGHT_SEQUENCE, 10000); break; diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_jindo.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_jindo.cpp index 886e000c093..4a37f3cf597 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_jindo.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_jindo.cpp @@ -258,7 +258,7 @@ class npc_shade_of_jindo : public CreatureScript DoCast(me, SPELL_INVISIBLE, true); } - void EnterCombat(Unit* /*who*/)OVERRIDE { } + void EnterCombat(Unit* /*who*/) OVERRIDE { } void UpdateAI(uint32 diff) OVERRIDE { diff --git a/src/server/scripts/EasternKingdoms/zone_ghostlands.cpp b/src/server/scripts/EasternKingdoms/zone_ghostlands.cpp index 1b181581f5e..cf7ea882135 100644 --- a/src/server/scripts/EasternKingdoms/zone_ghostlands.cpp +++ b/src/server/scripts/EasternKingdoms/zone_ghostlands.cpp @@ -161,7 +161,7 @@ public: break; case 11: Talk(SAY_PROGRESS2, player->GetGUID()); - me->SetOrientation(4.762841f); + me->SetFacingTo(4.762841f); break; case 18: { @@ -186,11 +186,11 @@ public: player->GroupEventHappens(QUEST_ESCAPE_FROM_THE_CATACOMBS, me); break; case 32: - me->SetOrientation(2.978281f); + me->SetFacingTo(2.978281f); Talk(SAY_END1, player->GetGUID()); break; case 33: - me->SetOrientation(5.858011f); + me->SetFacingTo(5.858011f); Talk(SAY_END2, player->GetGUID()); Creature* CaptainHelios = me->FindNearestCreature(NPC_CAPTAIN_HELIOS, 50); if (CaptainHelios) diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_bug_trio.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_bug_trio.cpp index 53e09c918ea..8dd009cdb32 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_bug_trio.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_bug_trio.cpp @@ -308,18 +308,15 @@ public: { if (instance) { - Unit* pKri = Unit::GetUnit(*me, instance->GetData64(DATA_KRI)); - Unit* pVem = Unit::GetUnit(*me, instance->GetData64(DATA_VEM)); - switch (urand(0, 2)) { case 0: - if (pKri) - DoCast(pKri, SPELL_HEAL); + if (Creature* kri = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_KRI))) + DoCast(kri, SPELL_HEAL); break; case 1: - if (pVem) - DoCast(pVem, SPELL_HEAL); + if (Creature* vem = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_VEM))) + DoCast(vem, SPELL_HEAL); break; case 2: DoCast(me, SPELL_HEAL); diff --git a/src/server/scripts/Northrend/zone_storm_peaks.cpp b/src/server/scripts/Northrend/zone_storm_peaks.cpp index d08c60d373d..7a2afe5505f 100644 --- a/src/server/scripts/Northrend/zone_storm_peaks.cpp +++ b/src/server/scripts/Northrend/zone_storm_peaks.cpp @@ -551,14 +551,13 @@ public: events.ScheduleEvent(EVENT_SCRIPT_11, 6000); break; case EVENT_SCRIPT_11: - me->SetOrientation(2.932153f); - me->SendMovementFlagUpdate(true); + me->SetFacingTo(2.932153f); Talk(SAY_BRANN_3, playerGUID); + for (uint8 i = 0; i < 5; ++i) - { if (GameObject* go = ObjectAccessor::GetGameObject(*me, objectGUID[i])) go->Delete(); - } + events.ScheduleEvent(EVENT_SCRIPT_12, 6000); break; case EVENT_SCRIPT_12: diff --git a/src/server/scripts/Outland/zone_netherstorm.cpp b/src/server/scripts/Outland/zone_netherstorm.cpp index 5cf152bd6e2..e1b95aea972 100644 --- a/src/server/scripts/Outland/zone_netherstorm.cpp +++ b/src/server/scripts/Outland/zone_netherstorm.cpp @@ -400,7 +400,7 @@ public: struct npc_commander_dawnforgeAI : public ScriptedAI { - npc_commander_dawnforgeAI(Creature* creature) : ScriptedAI(creature) { Reset(); } + npc_commander_dawnforgeAI(Creature* creature) : ScriptedAI(creature) { } uint64 PlayerGUID; uint64 ardonisGUID; @@ -411,9 +411,6 @@ public: uint32 Phase_Timer; bool isEvent; - float angle_dawnforge; - float angle_ardonis; - void Reset() OVERRIDE { PlayerGUID = 0; @@ -438,21 +435,15 @@ public: { Creature* ardonis = ObjectAccessor::GetCreature(*me, ardonisGUID); Creature* pathaleon = ObjectAccessor::GetCreature(*me, pathaleonGUID); - Player* player = ObjectAccessor::GetPlayer(*me, PlayerGUID); - if (!ardonis || !pathaleon || !player) + if (!ardonis || !pathaleon) return; - //Calculate the angle to Pathaleon - angle_dawnforge = me->GetAngle(pathaleon->GetPositionX(), pathaleon->GetPositionY()); - angle_ardonis = ardonis->GetAngle(pathaleon->GetPositionX(), pathaleon->GetPositionY()); + // Turn Dawnforge + me->SetFacingToObject(pathaleon); - //Turn Dawnforge and update - me->SetOrientation(angle_dawnforge); - me->SendUpdateToPlayer(player); - //Turn Ardonis and update - ardonis->SetOrientation(angle_ardonis); - ardonis->SendUpdateToPlayer(player); + // Turn Ardonis + ardonis->SetFacingToObject(pathaleon); //Set them to kneel me->SetStandState(UNIT_STAND_STATE_KNEEL); @@ -464,20 +455,11 @@ public: { if (Unit* ardonis = ObjectAccessor::GetUnit(*me, ardonisGUID)) { - Player* player = ObjectAccessor::GetPlayer(*me, PlayerGUID); - - if (!player) - return; - - angle_dawnforge = me->GetAngle(ardonis->GetPositionX(), ardonis->GetPositionY()); - angle_ardonis = ardonis->GetAngle(me->GetPositionX(), me->GetPositionY()); + // Turn Dawnforge + me->SetFacingToObject(ardonis); - //Turn Dawnforge and update - me->SetOrientation(angle_dawnforge); - me->SendUpdateToPlayer(player); - //Turn Ardonis and update - ardonis->SetOrientation(angle_ardonis); - ardonis->SendUpdateToPlayer(player); + // Turn Ardonis + ardonis->SetFacingToObject(me); //Set state me->SetStandState(UNIT_STAND_STATE_STAND); |