diff options
Diffstat (limited to 'src')
17 files changed, 308 insertions, 153 deletions
diff --git a/src/bindings/scripts/CMakeLists.txt b/src/bindings/scripts/CMakeLists.txt index 571dbc1b2a9..285fb004c59 100644 --- a/src/bindings/scripts/CMakeLists.txt +++ b/src/bindings/scripts/CMakeLists.txt @@ -192,6 +192,7 @@ SET(trinityscript_LIB_SRCS scripts/eastern_kingdoms/undercity.cpp scripts/eastern_kingdoms/western_plaguelands.cpp scripts/eastern_kingdoms/westfall.cpp + scripts/eastern_kingdoms/wetlands.cpp scripts/examples/example_creature.cpp scripts/examples/example_escort.cpp scripts/examples/example_gossip_codebox.cpp diff --git a/src/bindings/scripts/VC80/80ScriptDev2.vcproj b/src/bindings/scripts/VC80/80ScriptDev2.vcproj index ee1a8c87592..635f9356908 100644 --- a/src/bindings/scripts/VC80/80ScriptDev2.vcproj +++ b/src/bindings/scripts/VC80/80ScriptDev2.vcproj @@ -1162,6 +1162,10 @@ RelativePath="..\scripts\eastern_kingdoms\westfall.cpp" > </File> + <File + RelativePath="..\scripts\eastern_kingdoms\wetlands.cpp" + > + </File> </Filter> <Filter Name="examples" diff --git a/src/bindings/scripts/VC90/90ScriptDev2.vcproj b/src/bindings/scripts/VC90/90ScriptDev2.vcproj index 6cb095e68e1..c6f403470cb 100644 --- a/src/bindings/scripts/VC90/90ScriptDev2.vcproj +++ b/src/bindings/scripts/VC90/90ScriptDev2.vcproj @@ -1159,6 +1159,10 @@ RelativePath="..\scripts\eastern_kingdoms\westfall.cpp" > </File> + <File + RelativePath="..\scripts\eastern_kingdoms\wetlands.cpp" + > + </File> </Filter> <Filter Name="examples" diff --git a/src/bindings/scripts/base/escort_ai.cpp b/src/bindings/scripts/base/escort_ai.cpp index f4979487d31..2c28aa6b9a6 100644 --- a/src/bindings/scripts/base/escort_ai.cpp +++ b/src/bindings/scripts/base/escort_ai.cpp @@ -19,6 +19,25 @@ enum POINT_HOME = 0xFFFFFE }; +npc_escortAI::npc_escortAI(Creature* pCreature) : ScriptedAI(pCreature), + IsBeingEscorted(false), + IsOnHold(false), + PlayerGUID(0), + MaxPlayerDistance(DEFAULT_MAX_PLAYER_DISTANCE), + CanMelee(true), + m_uiPlayerCheckTimer(1000), + m_uiWPWaitTimer(2500), + m_bIsReturning(false), + m_bIsActiveAttacker(true), + m_bIsRunning(false), + DespawnAtEnd(true), + DespawnAtFar(true), + m_pQuestForEscort(NULL), + m_bCanInstantRespawn(false), + m_bCanReturnToStart(false), + ScriptWP(false) +{} + void npc_escortAI::AttackStart(Unit* pWho) { if (!pWho) @@ -159,7 +178,10 @@ void npc_escortAI::UpdateAI(const uint32 uiDiff) if (!IsOnHold) { m_creature->GetMotionMaster()->MovePoint(CurrentWP->id, CurrentWP->x, CurrentWP->y, CurrentWP->z); - debug_log("TSCR: EscortAI Next WP is: %u, %f, %f, %f", CurrentWP->id, CurrentWP->x, CurrentWP->y, CurrentWP->z); + debug_log("TSCR: EscortAI start waypoint %u (%f, %f, %f).", CurrentWP->id, CurrentWP->x, CurrentWP->y, CurrentWP->z); + + WaypointStart(CurrentWP->id); + m_uiWPWaitTimer = 0; } } diff --git a/src/bindings/scripts/base/escort_ai.h b/src/bindings/scripts/base/escort_ai.h index 5d27aebfec6..663e11d79f6 100644 --- a/src/bindings/scripts/base/escort_ai.h +++ b/src/bindings/scripts/base/escort_ai.h @@ -28,12 +28,12 @@ struct Escort_Waypoint struct TRINITY_DLL_DECL npc_escortAI : public ScriptedAI { public: - explicit npc_escortAI(Creature* pCreature) : ScriptedAI(pCreature), - IsBeingEscorted(false), IsOnHold(false), PlayerGUID(0), MaxPlayerDistance(DEFAULT_MAX_PLAYER_DISTANCE), CanMelee(true), m_uiPlayerCheckTimer(1000), m_uiWPWaitTimer(2500), m_bIsReturning(false), m_bIsActiveAttacker(true), m_bIsRunning(false), DespawnAtEnd(true), DespawnAtFar(true), m_pQuestForEscort(NULL), m_bCanInstantRespawn(false), m_bCanReturnToStart(false), ScriptWP(false) {} + explicit npc_escortAI(Creature* pCreature); ~npc_escortAI() {} // Pure Virtual Functions - virtual void WaypointReached(uint32) = 0; + virtual void WaypointReached(uint32 uiPointId) = 0; + virtual void WaypointStart(uint32 uiPointId) {} // CreatureAI functions void AttackStart(Unit* who); diff --git a/src/bindings/scripts/base/guard_ai.cpp b/src/bindings/scripts/base/guard_ai.cpp index 7f1daa1e2df..b55eae2dbad 100644 --- a/src/bindings/scripts/base/guard_ai.cpp +++ b/src/bindings/scripts/base/guard_ai.cpp @@ -32,6 +32,11 @@ EndScriptData */ #define SAY_GUARD_SIL_AGGRO2 -1070002 #define SAY_GUARD_SIL_AGGRO3 -1070003 +guardAI::guardAI(Creature* pCreature) : ScriptedAI(pCreature), + GlobalCooldown(0), + BuffTimer(0) +{} + void guardAI::Reset() { GlobalCooldown = 0; diff --git a/src/bindings/scripts/base/guard_ai.h b/src/bindings/scripts/base/guard_ai.h index 85baa30fb9d..a7fff32e3ab 100644 --- a/src/bindings/scripts/base/guard_ai.h +++ b/src/bindings/scripts/base/guard_ai.h @@ -9,7 +9,9 @@ struct TRINITY_DLL_DECL guardAI : public ScriptedAI { - guardAI(Creature *c) : ScriptedAI(c) {} + public: + explicit guardAI(Creature* pCreature); + ~guardAI() {} uint32 GlobalCooldown; //This variable acts like the global cooldown that players have (1.5 seconds) uint32 BuffTimer; //This variable keeps track of buffs diff --git a/src/bindings/scripts/include/sc_creature.cpp b/src/bindings/scripts/include/sc_creature.cpp index 1d423574f42..aa64a6fcbf1 100644 --- a/src/bindings/scripts/include/sc_creature.cpp +++ b/src/bindings/scripts/include/sc_creature.cpp @@ -80,7 +80,11 @@ void SummonList::DespawnAll() } } -ScriptedAI::ScriptedAI(Creature* creature) : CreatureAI(creature), m_creature(creature), IsFleeing(false), m_bCombatMovement(true), m_uiEvadeCheckCooldown(2500) +ScriptedAI::ScriptedAI(Creature* pCreature) : CreatureAI(pCreature), + m_creature(pCreature), + IsFleeing(false), + m_bCombatMovement(true), + m_uiEvadeCheckCooldown(2500) { HeroicMode = m_creature->GetMap()->IsHeroic(); } diff --git a/src/bindings/scripts/include/sc_creature.h b/src/bindings/scripts/include/sc_creature.h index 6baac76a8dd..74eea9ad599 100644 --- a/src/bindings/scripts/include/sc_creature.h +++ b/src/bindings/scripts/include/sc_creature.h @@ -43,7 +43,7 @@ class SummonList : private std::list<uint64> struct TRINITY_DLL_DECL ScriptedAI : public CreatureAI { - explicit ScriptedAI(Creature* creature); + explicit ScriptedAI(Creature* pCreature); ~ScriptedAI() {} //************* diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/dun_morogh.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/dun_morogh.cpp index 7e61df13575..29731ca83e3 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/dun_morogh.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/dun_morogh.cpp @@ -43,7 +43,7 @@ struct TRINITY_DLL_DECL npc_narm_faulkAI : public ScriptedAI void Reset() { lifeTimer = 120000; - m_creature->SetUInt32Value(UNIT_DYNAMIC_FLAGS, 32); + m_creature->SetUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); m_creature->SetStandState(UNIT_STAND_STATE_DEAD); spellHit = false; } diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/elwynn_forest.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/elwynn_forest.cpp index 67456755cd2..e44081d72ba 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/elwynn_forest.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/elwynn_forest.cpp @@ -43,7 +43,7 @@ struct TRINITY_DLL_DECL npc_henze_faulkAI : public ScriptedAI void Reset() { lifeTimer = 120000; - m_creature->SetUInt32Value(UNIT_DYNAMIC_FLAGS, 32); + m_creature->SetUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); m_creature->SetStandState(UNIT_STAND_STATE_DEAD); // lay down spellHit = false; } diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/scholomance/boss_doctor_theolen_krastinov.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/scholomance/boss_doctor_theolen_krastinov.cpp index badea0761e4..c4590243571 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/scholomance/boss_doctor_theolen_krastinov.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/scholomance/boss_doctor_theolen_krastinov.cpp @@ -24,30 +24,33 @@ EndScriptData */ #include "precompiled.h" #include "def_scholomance.h" -#define EMOTE_GENERIC_FRENZY_KILL -1000001 +enum +{ + EMOTE_GENERIC_FRENZY_KILL = -1000001, -#define SPELL_REND 18106 -#define SPELL_CLEAVE 15584 -#define SPELL_FRENZY 28371 + SPELL_REND = 16509, + SPELL_BACKHAND = 18103, + SPELL_FRENZY = 8269 +}; struct TRINITY_DLL_DECL boss_theolenkrastinovAI : public ScriptedAI { boss_theolenkrastinovAI(Creature *c) : ScriptedAI(c) {} - uint32 Rend_Timer; - uint32 Cleave_Timer; - uint32 Frenzy_Timer; + uint32 m_uiRend_Timer; + uint32 m_uiBackhand_Timer; + uint32 m_uiFrenzy_Timer; void Reset() { - Rend_Timer = 8000; - Cleave_Timer = 9000; - Frenzy_Timer =0; + m_uiRend_Timer = 8000; + m_uiBackhand_Timer = 9000; + m_uiFrenzy_Timer = 1000; } - void JustDied(Unit *killer) + void JustDied(Unit* pKiller) { - ScriptedInstance *pInstance = (m_creature->GetInstanceData()) ? (m_creature->GetInstanceData()) : NULL; + ScriptedInstance* pInstance = (m_creature->GetInstanceData()) ? (m_creature->GetInstanceData()) : NULL; if (pInstance) { pInstance->SetData(DATA_DOCTORTHEOLENKRASTINOV_DEATH, 0); @@ -57,44 +60,47 @@ struct TRINITY_DLL_DECL boss_theolenkrastinovAI : public ScriptedAI } } - void EnterCombat(Unit *who) - { - } - - void UpdateAI(const uint32 diff) + void UpdateAI(const uint32 uiDiff) { if (!UpdateVictim()) return; //Rend_Timer - if (Rend_Timer < diff) + if (m_uiRend_Timer < uiDiff) { - DoCast(m_creature->getVictim(),SPELL_REND); - Rend_Timer = 10000; - }else Rend_Timer -= diff; + DoCast(m_creature->getVictim(), SPELL_REND); + m_uiRend_Timer = 10000; + } + else + m_uiRend_Timer -= uiDiff; - //Cleave_Timer - if (Cleave_Timer < diff) + //Backhand_Timer + if (m_uiBackhand_Timer < uiDiff) { - DoCast(m_creature->getVictim(),SPELL_CLEAVE); - Cleave_Timer = 10000; - }else Cleave_Timer -= diff; + DoCast(m_creature->getVictim(), SPELL_BACKHAND); + m_uiBackhand_Timer = 10000; + } + else + m_uiBackhand_Timer -= uiDiff; //Frenzy_Timer if (m_creature->GetHealth()*100 / m_creature->GetMaxHealth() < 26) { - if (Frenzy_Timer < diff) + if (m_uiFrenzy_Timer < uiDiff) { DoCast(m_creature,SPELL_FRENZY); DoScriptText(EMOTE_GENERIC_FRENZY_KILL, m_creature); - Frenzy_Timer = 8000; - }else Frenzy_Timer -= diff; + m_uiFrenzy_Timer = 120000; + } + else + m_uiFrenzy_Timer -= uiDiff; } DoMeleeAttackIfReady(); } }; + CreatureAI* GetAI_boss_theolenkrastinov(Creature* pCreature) { return new boss_theolenkrastinovAI (pCreature); diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/scholomance/boss_vectus.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/scholomance/boss_vectus.cpp index 9d343d26a7e..f12b5473abf 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/scholomance/boss_vectus.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/scholomance/boss_vectus.cpp @@ -23,65 +23,72 @@ EndScriptData */ #include "precompiled.h" -#define EMOTE_GENERIC_FRENZY_KILL -1000001 +enum +{ + EMOTE_GENERIC_FRENZY_KILL = -1000001, -#define SPELL_FIRESHIELD 19626 -#define SPELL_BLASTWAVE 13021 -#define SPELL_FRENZY 28371 + SPELL_FLAMESTRIKE = 18399, + SPELL_BLAST_WAVE = 16046, + SPELL_FIRESHIELD = 19626, + SPELL_FRENZY = 8269 //28371, +}; struct TRINITY_DLL_DECL boss_vectusAI : public ScriptedAI { boss_vectusAI(Creature *c) : ScriptedAI(c) {} - uint32 FireShield_Timer; - uint32 BlastWave_Timer; - uint32 Frenzy_Timer; + uint32 m_uiFireShield_Timer; + uint32 m_uiBlastWave_Timer; + uint32 m_uiFrenzy_Timer; void Reset() { - FireShield_Timer = 2000; - BlastWave_Timer = 14000; - Frenzy_Timer = 0; - } - - void EnterCombat(Unit *who) - { + m_uiFireShield_Timer = 2000; + m_uiBlastWave_Timer = 14000; + m_uiFrenzy_Timer = 0; } - void UpdateAI(const uint32 diff) + void UpdateAI(const uint32 uiDiff) { if (!UpdateVictim()) return; //FireShield_Timer - if (FireShield_Timer < diff) + if (m_uiFireShield_Timer < uiDiff) { DoCast(m_creature, SPELL_FIRESHIELD); - FireShield_Timer = 90000; - }else FireShield_Timer -= diff; + m_uiFireShield_Timer = 90000; + } + else + m_uiFireShield_Timer -= uiDiff; //BlastWave_Timer - if (BlastWave_Timer < diff) + if (m_uiBlastWave_Timer < uiDiff) { - DoCast(m_creature->getVictim(),SPELL_BLASTWAVE); - BlastWave_Timer = 12000; - }else BlastWave_Timer -= diff; + DoCast(m_creature->getVictim(), SPELL_BLAST_WAVE); + m_uiBlastWave_Timer = 12000; + } + else + m_uiBlastWave_Timer -= uiDiff; //Frenzy_Timer if (m_creature->GetHealth()*100 / m_creature->GetMaxHealth() < 25) { - if (Frenzy_Timer < diff) + if (m_uiFrenzy_Timer < uiDiff) { - DoCast(m_creature,SPELL_FRENZY); + DoCast(m_creature, SPELL_FRENZY); DoScriptText(EMOTE_GENERIC_FRENZY_KILL, m_creature); - Frenzy_Timer = 24000; - }else Frenzy_Timer -= diff; + m_uiFrenzy_Timer = 24000; + } + else + m_uiFrenzy_Timer -= uiDiff; } DoMeleeAttackIfReady(); } }; + CreatureAI* GetAI_boss_vectus(Creature* pCreature) { return new boss_vectusAI (pCreature); diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/wetlands.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/wetlands.cpp new file mode 100644 index 00000000000..4a9d944cb3e --- /dev/null +++ b/src/bindings/scripts/scripts/eastern_kingdoms/wetlands.cpp @@ -0,0 +1,167 @@ +/* Copyright (C) 2006 - 2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* ScriptData +SDName: Wetlands +SD%Complete: 80 +SDComment: Quest support: 1249 +SDCategory: Wetlands +EndScriptData */ + +/* ContentData +npc_mikhail +npc_tapoke_slim_jahn +EndContentData */ + +#include "precompiled.h" +#include "escort_ai.h" + +/*###### +## npc_tapoke_slim_jahn +######*/ + +enum +{ + QUEST_MISSING_DIPLO_PT11 = 1249, + FACTION_ENEMY = 168, + SPELL_STEALTH = 1785, + NPC_SLIMS_FRIEND = 4971, + NPC_TAPOKE_SLIM_JAHN = 4962 +}; + +struct TRINITY_DLL_DECL npc_tapoke_slim_jahnAI : public npc_escortAI +{ + npc_tapoke_slim_jahnAI(Creature* pCreature) : npc_escortAI(pCreature) { } + + bool m_bFriendSummoned; + + void Reset() + { + if (!IsBeingEscorted) + m_bFriendSummoned = false; + } + + void WaypointReached(uint32 uiPointId) + { + switch(uiPointId) + { + case 2: + if (m_creature->HasStealthAura()) + m_creature->RemoveAurasDueToSpell(SPELL_AURA_MOD_STEALTH); + + SetRun(); + m_creature->setFaction(FACTION_ENEMY); + break; + } + } + + void Aggro(Unit* pWho) + { + Unit* pPlayer = Unit::GetUnit(*m_creature, PlayerGUID); + + if (IsBeingEscorted && !m_bFriendSummoned && pPlayer) + { + m_creature->SummonCreature(NPC_SLIMS_FRIEND, 0.0f, 0.0f, 0.0f, 3.10f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000); + m_creature->SummonCreature(NPC_SLIMS_FRIEND, 0.0f, 0.0f, 0.0f, 2.35f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000); + m_creature->SummonCreature(NPC_SLIMS_FRIEND, 0.0f, 0.0f, 0.0f, 2.02f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000); + m_bFriendSummoned = true; + } + } + + void JustSummoned(Creature* pSummoned) + { + if (Unit* pPlayer = Unit::GetPlayer(PlayerGUID)) + pSummoned->AI()->AttackStart(pPlayer); + } + + void AttackedBy(Unit* pAttacker) + { + if (m_creature->getVictim()) + return; + + if (m_creature->IsFriendlyTo(pAttacker)) + return; + + AttackStart(pAttacker); + } + + void DamageTaken(Unit* pDoneBy, uint32& uiDamage) + { + if (m_creature->GetHealth()*100 < m_creature->GetMaxHealth()*20) + { + if (Unit* pPlayer = Unit::GetUnit(*m_creature, PlayerGUID)) + { + if (pPlayer->GetTypeId() == TYPEID_PLAYER) + CAST_PLR(pPlayer)->GroupEventHappens(QUEST_MISSING_DIPLO_PT11, m_creature); + + uiDamage = 0; + + me->RestoreFaction(); + m_creature->RemoveAllAuras(); + m_creature->DeleteThreatList(); + m_creature->CombatStop(true); + + SetRun(false); + } + } + } +}; + +CreatureAI* GetAI_npc_tapoke_slim_jahn(Creature* pCreature) +{ + return new npc_tapoke_slim_jahnAI(pCreature); +} + +/*###### +## npc_mikhail +######*/ + +bool QuestAccept_npc_mikhail(Player* pPlayer, Creature* pCreature, const Quest* pQuest) +{ + if (pQuest->GetQuestId() == QUEST_MISSING_DIPLO_PT11) + { + Creature* pSlim = pCreature->FindNearestCreature(NPC_TAPOKE_SLIM_JAHN, 25.0f); + + if (!pSlim) + return false; + + if (!pSlim->HasStealthAura()) + pSlim->CastSpell(pSlim, SPELL_STEALTH, true); + + if (npc_tapoke_slim_jahnAI* pEscortAI = CAST_AI(npc_tapoke_slim_jahnAI, pSlim->AI())) + pEscortAI->Start(false, false, pPlayer->GetGUID(), pQuest); + } + return false; +} + +/*###### +## AddSC +######*/ + +void AddSC_wetlands() +{ + Script *newscript; + + newscript = new Script; + newscript->Name = "npc_tapoke_slim_jahn"; + newscript->GetAI = &GetAI_npc_tapoke_slim_jahn; + newscript->RegisterSelf(); + + newscript = new Script; + newscript->Name = "npc_mikhail"; + newscript->pQuestAccept = &QuestAccept_npc_mikhail; + newscript->RegisterSelf(); +} diff --git a/src/bindings/scripts/scripts/kalimdor/teldrassil.cpp b/src/bindings/scripts/scripts/kalimdor/teldrassil.cpp index 58cb2a55b2f..40e849fbbe6 100644 --- a/src/bindings/scripts/scripts/kalimdor/teldrassil.cpp +++ b/src/bindings/scripts/scripts/kalimdor/teldrassil.cpp @@ -26,6 +26,7 @@ npc_mist EndContentData */ #include "precompiled.h" +#include "follower_ai.h" /*#### # npc_mist @@ -37,31 +38,20 @@ enum EMOTE_AT_HOME = -1000412, QUEST_MIST = 938, NPC_ARYNIA = 3519, + FACTION_DARNASSUS = 79 }; -struct TRINITY_DLL_DECL npc_mistAI : public ScriptedAI +struct TRINITY_DLL_DECL npc_mistAI : public FollowerAI { - npc_mistAI(Creature *c) : ScriptedAI(c) - { - uiNpcFlags = c->GetUInt32Value(UNIT_NPC_FLAGS); - uiPlayerGUID = 0; - } - - uint64 uiPlayerGUID; - uint32 uiNpcFlags; - uint32 uiCheckPlayerTimer; - - void Reset() - { - uiCheckPlayerTimer = 2500; + npc_mistAI(Creature* pCreature) : FollowerAI(pCreature) { } - if (!uiPlayerGUID) - m_creature->SetUInt32Value(UNIT_NPC_FLAGS, uiNpcFlags); - } + void Reset() { } void MoveInLineOfSight(Unit *pWho) { - if (pWho->GetEntry() == NPC_ARYNIA) + FollowerAI::MoveInLineOfSight(pWho); + + if (!m_creature->getVictim() && !IsFollowComplete() && pWho->GetEntry() == NPC_ARYNIA) { if (m_creature->IsWithinDistInMap(pWho, 10.0f)) { @@ -71,43 +61,11 @@ struct TRINITY_DLL_DECL npc_mistAI : public ScriptedAI } } - void EnterEvadeMode() - { - m_creature->RemoveAllAuras(); - m_creature->DeleteThreatList(); - m_creature->CombatStop(true); - m_creature->LoadCreaturesAddon(); - - if (m_creature->isAlive()) - { - if (Player* pPlayer = Unit::GetPlayer(uiPlayerGUID)) - m_creature->GetMotionMaster()->MoveFollow(pPlayer, PET_FOLLOW_DIST, m_creature->GetFollowAngle()); - else - { - m_creature->GetMotionMaster()->MovementExpired(); - m_creature->GetMotionMaster()->MoveTargetedHome(); - } - } - - m_creature->SetLootRecipient(NULL); - - Reset(); - } - - void DoStart(uint64 uiPlayer) - { - uiPlayerGUID = uiPlayer; - m_creature->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE); - - if (Player* pPlayer = Unit::GetPlayer(uiPlayer)) - m_creature->GetMotionMaster()->MoveFollow(pPlayer, PET_FOLLOW_DIST, m_creature->GetFollowAngle()); - } - void DoComplete() { DoScriptText(EMOTE_AT_HOME, m_creature); - if (Player* pPlayer = Unit::GetPlayer(uiPlayerGUID)) + if (Player* pPlayer = GetLeaderForFollower()) { if (pPlayer->GetQuestStatus(QUEST_MIST) == QUEST_STATUS_INCOMPLETE) { @@ -115,55 +73,25 @@ struct TRINITY_DLL_DECL npc_mistAI : public ScriptedAI if (uiQuestLogSlot < MAX_QUEST_LOG_SIZE) { + //This will be wrong, need to check all group members (if any) for state before event if (pPlayer->GetQuestSlotState(uiQuestLogSlot) != QUEST_STATE_FAIL) pPlayer->AreaExploredOrEventHappens(QUEST_MIST); } } } - uiPlayerGUID = 0; - EnterEvadeMode(); - } - - void EnterCombat(Unit* who) { } - - void JustDied(Unit* pKiller) - { - if (Player* pPlayer = Unit::GetPlayer(uiPlayerGUID)) - pPlayer->FailQuest(QUEST_MIST); - - uiPlayerGUID = 0; - m_creature->GetMotionMaster()->MovementExpired(); + //The follow is over (and for later development to indicate a post event can now run) + SetFollowComplete(); } - void UpdateAI(const uint32 diff) + //call not needed here, no known abilities + /*void UpdateFollowerAI(const uint32 uiDiff) { - if (uiPlayerGUID) - { - if (!m_creature->isInCombat()) - { - if (uiCheckPlayerTimer < diff) - { - uiCheckPlayerTimer = 5000; - - Player* pPlayer = Unit::GetPlayer(uiPlayerGUID); - - if (pPlayer && !pPlayer->isAlive()) - { - uiPlayerGUID = 0; - EnterEvadeMode(); - } - } - else - uiCheckPlayerTimer -= diff; - } - } - if (!UpdateVictim()) return; DoMeleeAttackIfReady(); - } + }*/ }; CreatureAI* GetAI_npc_mist(Creature* pCreature) @@ -174,7 +102,10 @@ CreatureAI* GetAI_npc_mist(Creature* pCreature) bool QuestAccept_npc_mist(Player* pPlayer, Creature* pCreature, Quest const* pQuest) { if (pQuest->GetQuestId() == QUEST_MIST) - CAST_AI(npc_mistAI, (pCreature->AI()))->DoStart(pPlayer->GetGUID()); + { + if (npc_mistAI* pMistAI = CAST_AI(npc_mistAI, pCreature->AI())) + pMistAI->StartFollow(pPlayer, FACTION_DARNASSUS, pQuest); + } return true; } diff --git a/src/bindings/scripts/scripts/outland/nagrand.cpp b/src/bindings/scripts/scripts/outland/nagrand.cpp index 09435b91efe..865fc24f922 100644 --- a/src/bindings/scripts/scripts/outland/nagrand.cpp +++ b/src/bindings/scripts/scripts/outland/nagrand.cpp @@ -237,7 +237,7 @@ struct TRINITY_DLL_DECL mob_sunspring_villagerAI : public ScriptedAI void Reset() { - m_creature->SetUInt32Value(UNIT_DYNAMIC_FLAGS, 32); + m_creature->SetUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); m_creature->SetStandState(UNIT_STAND_STATE_DEAD); } diff --git a/src/bindings/scripts/system/ScriptLoader.cpp b/src/bindings/scripts/system/ScriptLoader.cpp index 85221f5cb7e..024fbe7b7a1 100644 --- a/src/bindings/scripts/system/ScriptLoader.cpp +++ b/src/bindings/scripts/system/ScriptLoader.cpp @@ -188,6 +188,7 @@ extern void AddSC_tirisfal_glades(); extern void AddSC_undercity(); extern void AddSC_western_plaguelands(); extern void AddSC_westfall(); +extern void AddSC_wetlands(); //kalimdor extern void AddSC_instance_blackfathom_deeps(); //Blackfathom Depths @@ -573,6 +574,7 @@ void AddScripts() AddSC_undercity(); AddSC_western_plaguelands(); AddSC_westfall(); + AddSC_wetlands(); //kalimdor AddSC_instance_blackfathom_deeps(); //Blackfathom Depths |