diff options
author | _manuel_ <manue.l@live.com.ar> | 2010-05-24 12:10:09 -0300 |
---|---|---|
committer | _manuel_ <manue.l@live.com.ar> | 2010-05-24 12:10:09 -0300 |
commit | a7ebcc91cf030e19c51677e34ecf79c8c9e55376 (patch) | |
tree | 210db2189ea8c5e97818557191275a009e9bcb72 /src/scripts/outland/hellfire_peninsula.cpp | |
parent | c7ff7de08bfacf87a49b51b7470c02386a2bfb40 (diff) |
- Applied TrinityScript Developing Standards.
- Now the fellhunter will move to the corpse and then cast the spell.
- Removed code from Reset() that can cause crash, check if the owner exist before do MoveFollow.
--HG--
branch : trunk
Diffstat (limited to 'src/scripts/outland/hellfire_peninsula.cpp')
-rw-r--r-- | src/scripts/outland/hellfire_peninsula.cpp | 57 |
1 files changed, 38 insertions, 19 deletions
diff --git a/src/scripts/outland/hellfire_peninsula.cpp b/src/scripts/outland/hellfire_peninsula.cpp index 41e534d1cb5..fce8ac6f59e 100644 --- a/src/scripts/outland/hellfire_peninsula.cpp +++ b/src/scripts/outland/hellfire_peninsula.cpp @@ -411,39 +411,58 @@ bool QuestAccept_npc_wounded_blood_elf(Player* pPlayer, Creature* pCreature, Que enum eFelGuard { -SPELL_SUMMON_POO = 37688, + SPELL_SUMMON_POO = 37688, -DERANGED_HELBOAR = 16863 + NPC_DERANGED_HELBOAR = 16863 }; -struct npc_fel_guard_houndAI : public ScriptedAI +struct npc_fel_guard_houndAI : public ScriptedAI { - npc_fel_guard_houndAI(Creature* c) : ScriptedAI(c) {} + npc_fel_guard_houndAI(Creature* pCreature) : ScriptedAI(pCreature) {} - uint32 checkTimer; - uint64 lastHelboar; //store last helboar GUID to prevent multiple spawns of poo with the same mob + uint32 uiCheckTimer; + uint64 uiHelboarGUID; void Reset() { - me->GetMotionMaster()->MoveFollow(me->GetOwner(), PET_FOLLOW_DIST, PET_FOLLOW_ANGLE); - checkTimer = 5000; //check for creature every 5 sec + uiCheckTimer = 5000; //check for creature every 5 sec + uiHelboarGUID = 0; } - void Aggro(Unit* /*pWho*/) {} - - void UpdateAI(const uint32 diff) + void MovementInform(uint32 uiType, uint32 uiId) + { + if (uiType != POINT_MOTION_TYPE || uiId != 1) + return; + + if (Creature* pHelboar = me->GetCreature(*me,uiHelboarGUID)) + { + pHelboar->RemoveCorpse(); + DoCast(SPELL_SUMMON_POO); + + if (Player* pOwner = me->GetCharmerOrOwnerPlayerOrPlayerItself()) + me->GetMotionMaster()->MoveFollow(pOwner,0.0f,0.0f); + } + } + + void UpdateAI(const uint32 uiDiff) { - if (checkTimer < diff) + if (uiCheckTimer <= uiDiff) { - Creature* pHelboar = me->FindNearestCreature(DERANGED_HELBOAR, 10, false); - if (pHelboar && pHelboar->GetGUID() != lastHelboar) + if (Creature* pHelboar = me->FindNearestCreature(NPC_DERANGED_HELBOAR, 10.0f, false)) { - lastHelboar = pHelboar->GetGUID(); - DoCast(me, SPELL_SUMMON_POO); - pHelboar->RemoveCorpse(); - checkTimer = 5000; + if (pHelboar->GetGUID() != uiHelboarGUID && me->GetMotionMaster()->GetCurrentMovementGeneratorType() != POINT_MOTION_TYPE && !me->FindCurrentSpellBySpellId(SPELL_SUMMON_POO)) + { + uiHelboarGUID = pHelboar->GetGUID(); + me->GetMotionMaster()->MovePoint(1,pHelboar->GetPositionX(),pHelboar->GetPositionY(),pHelboar->GetPositionZ()); + } } - }else checkTimer -= diff; + uiCheckTimer = 5000; + }else uiCheckTimer -= uiDiff; + + if (!UpdateVictim()) + return; + + DoMeleeAttackIfReady(); } }; |