diff --git a/scripts/northrend/borean_tundra.cpp b/scripts/northrend/borean_tundra.cpp index 4c00421..9d331f1 100644 --- a/scripts/northrend/borean_tundra.cpp +++ b/scripts/northrend/borean_tundra.cpp @@ -17,7 +17,7 @@ /* ScriptData SDName: Borean_Tundra SD%Complete: 100 -SDComment: Quest support: 11708, 11692, 11961, 11865. Taxi vendors. 11570 +SDComment: Quest support: 11708, 11692, 11961, 11865, 11919, 11940. Taxi vendors. 11570 SDCategory: Borean Tundra EndScriptData */ @@ -31,10 +31,13 @@ npc_sinkhole_kill_credit npc_surristrasz npc_tiare npc_lurgglbr +npc_nexus_drake_hatchling +npc_raelorasz EndContentData */ #include "precompiled.h" #include "escort_ai.h" +#include "follower_ai.h" /*###### ## npc_fizzcrank_fullthrottle @@ -744,6 +747,104 @@ CreatureAI* GetAI_npc_lurgglbr(Creature* pCreature) return new npc_lurgglbrAI(pCreature); } +/*###### +## npc_nexus_drake_hatchling +######*/ + +enum +{ + QUEST_DRAKE_HUNT = 11919, + QUEST_DRAKE_HUNT_DAILY = 11940, + SPELL_CAPTURE_TRIGGER = 46673, + SPELL_SUBDUED = 46675, + SPELL_DRAKE_HATCHLING_SUBDUED = 46691, + SPELL_STRIP_AURAS = 46693, + SPELL_DRAKE_TURN_IN = 46696, + SPELL_DRAKE_COMPLETION_PING = 46702, + SPELL_COMPLETE_IMMOLATION = 46703, + SPELL_RAELORASZ_FIREBALL = 46704, + NPC_RAELORASZ = 26117, + NPC_NEXUS_DRAKE_HATCHLING = 26127, + NPC_COLDARRA_DRAKE_HUNT_INVISMAN = 26175, + SAY_RAELORASZ_1 = -1000015 +}; + +struct MANGOS_DLL_DECL npc_nexus_drake_hatchlingAI : public FollowerAI +{ + npc_nexus_drake_hatchlingAI(Creature* pCreature) : FollowerAI(pCreature) { Reset(); } + + void Reset(){ } + + void MoveInLineOfSight(Unit *pWho) + { + FollowerAI::MoveInLineOfSight(pWho); + if (m_creature->HasAura(SPELL_SUBDUED) && !m_creature->getVictim()) + if (pWho->GetEntry() == NPC_COLDARRA_DRAKE_HUNT_INVISMAN && m_creature->IsWithinDistInMap(pWho, INTERACTION_DISTANCE*5)) + if (Player* pPlayer = GetLeaderForFollower()) + if (pPlayer->GetQuestStatus(QUEST_DRAKE_HUNT) == QUEST_STATUS_INCOMPLETE || pPlayer->GetQuestStatus(QUEST_DRAKE_HUNT_DAILY) == QUEST_STATUS_INCOMPLETE) + if (pPlayer->isAlive() && pPlayer->HasAura(SPELL_DRAKE_HATCHLING_SUBDUED)) + { + pWho->CastSpell(pPlayer, SPELL_STRIP_AURAS, true); + pPlayer->KilledMonsterCredit(NPC_COLDARRA_DRAKE_HUNT_INVISMAN); + pPlayer->CastSpell(m_creature, SPELL_DRAKE_TURN_IN, true); + } + } +}; + +bool EffectDummyCreature_npc_nexus_drake_hatchling(Unit* pCaster, uint32 spellId, SpellEffectIndex effIndex, Creature* pCreatureTarget) +{ + if (spellId == SPELL_CAPTURE_TRIGGER) + { + if (!pCaster || pCaster->GetTypeId() != TYPEID_PLAYER || !pCaster->isAlive()) + return true; + + if (!pCaster->HasAura(SPELL_DRAKE_HATCHLING_SUBDUED) || !pCreatureTarget->HasAura(SPELL_SUBDUED)) + return true; + + if (((Player*)pCaster)->GetQuestStatus(QUEST_DRAKE_HUNT) == QUEST_STATUS_INCOMPLETE || ((Player*)pCaster)->GetQuestStatus(QUEST_DRAKE_HUNT_DAILY) == QUEST_STATUS_INCOMPLETE) + if (npc_nexus_drake_hatchlingAI* pNexusDrakeHatchlingAI = dynamic_cast(pCreatureTarget->AI())) + pNexusDrakeHatchlingAI->StartFollow((Player*)pCaster, 0, 0); + + return true; + } + else if (spellId == SPELL_DRAKE_TURN_IN) + { + if (Creature* pRaelorasz = GetClosestCreatureWithEntry(pCreatureTarget, NPC_RAELORASZ, INTERACTION_DISTANCE*5)) + { + pCreatureTarget->CastSpell(pRaelorasz, SPELL_DRAKE_COMPLETION_PING, true); + return true; + } + } + return false; +} + +CreatureAI* GetAI_npc_nexus_drake_hatchling(Creature* pCreature) +{ + return new npc_nexus_drake_hatchlingAI(pCreature); +} + +/*###### +## npc_raelorasz +######*/ + +bool EffectDummyCreature_npc_raelorasz(Unit* pCaster, uint32 spellId, SpellEffectIndex effIndex, Creature* pCreatureTarget) +{ + if (spellId == SPELL_DRAKE_COMPLETION_PING) + { + DoScriptText(SAY_RAELORASZ_1, pCreatureTarget, pCaster); + return true; + } + else if (spellId == SPELL_RAELORASZ_FIREBALL) + { + if (Creature* pNexusDrakeHatchling = GetClosestCreatureWithEntry(pCreatureTarget, NPC_NEXUS_DRAKE_HATCHLING, INTERACTION_DISTANCE*5)) + { + pNexusDrakeHatchling->CastSpell(pNexusDrakeHatchling, SPELL_COMPLETE_IMMOLATION, true); + return true; + } + } + return false; +} + void AddSC_borean_tundra() { Script* pNewScript; @@ -805,4 +906,15 @@ void AddSC_borean_tundra() pNewScript->GetAI = &GetAI_npc_lurgglbr; pNewScript->pQuestAcceptNPC = &QuestAccept_npc_lurgglbr; pNewScript->RegisterSelf(); + + pNewScript = new Script; + pNewScript->Name = "npc_nexus_drake_hatchling"; + pNewScript->GetAI = &GetAI_npc_nexus_drake_hatchling; + pNewScript->pEffectDummyNPC = &EffectDummyCreature_npc_nexus_drake_hatchling; + pNewScript->RegisterSelf(); + + pNewScript = new Script; + pNewScript->Name = "npc_raelorasz"; + pNewScript->pEffectDummyNPC = &EffectDummyCreature_npc_raelorasz; + pNewScript->RegisterSelf(); }