/* * This file is part of the AzerothCore Project. See AUTHORS file for Copyright information * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published by the * Free Software Foundation; either version 3 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 Affero General Public License for * more details. * * You should have received a copy of the GNU General Public License along * with this program. If not, see . */ /* Script Data Start SDName: Redridge Mountains SD%Complete: 100% SDComment: Support for quest 219. Script Data End */ #include "CreatureScript.h" #include "Player.h" #include "ScriptedCreature.h" #include "ScriptedEscortAI.h" enum CorporalKeeshan { QUEST_MISSING_IN_ACTION = 219, SAY_CORPORAL_1 = 0, SAY_CORPORAL_2 = 1, SAY_CORPORAL_3 = 2, SAY_CORPORAL_4 = 3, SAY_CORPORAL_5 = 4, SPELL_MOCKING_BLOW = 21008, SPELL_SHIELD_BASH = 11972 }; class npc_corporal_keeshan : public CreatureScript { public: npc_corporal_keeshan() : CreatureScript("npc_corporal_keeshan") { } struct npc_corporal_keeshanAI : public npc_escortAI { npc_corporal_keeshanAI(Creature* creature) : npc_escortAI(creature) { } void Reset() override { timer = 0; phase = 0; mockingBlowTimer = 5000; shieldBashTimer = 8000; me->SetImmuneToNPC(true); } void sQuestAccept(Player* player, Quest const* quest) override { if (quest->GetQuestId() == QUEST_MISSING_IN_ACTION) { Talk(SAY_CORPORAL_1, player); npc_escortAI::Start(true, false, player->GetGUID(), quest); me->SetImmuneToNPC(false); me->SetFaction(FACTION_ESCORTEE_N_NEUTRAL_ACTIVE); } } void WaypointReached(uint32 waypointId) override { Player* player = GetPlayerForEscort(); if (!player) return; if (waypointId >= 65) me->SetWalk(false); switch (waypointId) { case 39: SetEscortPaused(true); timer = 2000; phase = 1; break; case 65: me->SetWalk(false); break; case 115: player->GroupEventHappens(QUEST_MISSING_IN_ACTION, me); timer = 2000; phase = 4; break; } } void UpdateAI(uint32 diff) override { if (HasEscortState(STATE_ESCORT_NONE)) return; npc_escortAI::UpdateAI(diff); if (phase) { if (timer <= diff) { switch (phase) { case 1: me->SetStandState(UNIT_STAND_STATE_SIT); timer = 1000; phase = 2; break; case 2: Talk(SAY_CORPORAL_2); timer = 15000; phase = 3; break; case 3: Talk(SAY_CORPORAL_3); me->SetStandState(UNIT_STAND_STATE_STAND); SetEscortPaused(false); timer = 0; phase = 0; break; case 4: Talk(SAY_CORPORAL_4); timer = 2500; phase = 5; break; case 5: Talk(SAY_CORPORAL_5); timer = 0; phase = 0; break; } } else timer -= diff; } if (!UpdateVictim()) return; if (mockingBlowTimer <= diff) { DoCastVictim(SPELL_MOCKING_BLOW); mockingBlowTimer = 5000; } else mockingBlowTimer -= diff; if (shieldBashTimer <= diff) { DoCastVictim(SPELL_MOCKING_BLOW); shieldBashTimer = 8000; } else shieldBashTimer -= diff; DoMeleeAttackIfReady(); } private: uint32 phase; uint32 timer; uint32 mockingBlowTimer; uint32 shieldBashTimer; }; CreatureAI* GetAI(Creature* creature) const override { return new npc_corporal_keeshanAI(creature); } }; void AddSC_redridge_mountains() { new npc_corporal_keeshan(); }