Files
TCPlayerbotCore/src/server/scripts/EasternKingdoms/eversong_woods.cpp
T

713 lines
20 KiB
C++
Raw Normal View History

/* Copyright (C) 2008 - 2010 Trinity <http://www.trinitycore.org/>
2010-07-02 16:02:40 +02:00
* Copyright (C) 2006 - 2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>.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
*/
2009-10-17 15:51:44 -07:00
/* ScriptData
SDName: Eversong_Woods
SD%Complete: 100
2009-05-20 23:08:46 +02:00
SDComment: Quest support: 8483, 8488, 8490, 9686
SDCategory: Eversong Woods
EndScriptData */
2009-10-17 15:51:44 -07:00
/* ContentData
npc_prospector_anvilward
2008-12-31 15:55:11 +01:00
npc_apprentice_mirveda
npc_infused_crystal
2009-05-20 23:08:46 +02:00
npc_kelerun_bloodmourn
go_harbinger_second_trial
EndContentData */
2009-10-17 15:51:44 -07:00
#include "ScriptPCH.h"
2010-01-19 11:36:05 +01:00
#include "ScriptedEscortAI.h"
2009-10-17 15:51:44 -07:00
/*######
## npc_prospector_anvilward
######*/
2009-10-17 15:51:44 -07:00
2009-01-22 22:05:51 +01:00
#define GOSSIP_HELLO "I need a moment of your time, sir."
#define GOSSIP_SELECT "Why... yes, of course. I've something to show you right inside this building, Mr. Anvilward."
2009-10-17 15:51:44 -07:00
2010-02-07 12:16:35 +01:00
enum eProspectorAnvilward
{
SAY_ANVIL1 = -1000209,
SAY_ANVIL2 = -1000210,
QUEST_THE_DWARVEN_SPY = 8483,
};
2009-10-17 15:51:44 -07:00
2010-02-05 00:31:28 +01:00
struct npc_prospector_anvilwardAI : public npc_escortAI
{
// CreatureAI functions
npc_prospector_anvilwardAI(Creature *c) : npc_escortAI(c) {}
2009-10-17 15:51:44 -07:00
// Pure Virtual Functions
void WaypointReached(uint32 i)
{
2009-08-17 00:29:53 +02:00
Player* pPlayer = GetPlayerForEscort();
2009-10-17 15:51:44 -07:00
2009-08-14 00:02:13 +02:00
if (!pPlayer)
2009-01-22 22:05:51 +01:00
return;
2009-10-17 15:51:44 -07:00
switch (i)
{
2010-04-14 23:07:41 +02:00
case 0: DoScriptText(SAY_ANVIL1, me, pPlayer); break;
case 5: DoScriptText(SAY_ANVIL2, me, pPlayer); break;
case 6: me->setFaction(24); break;
}
}
2009-10-17 15:51:44 -07:00
void Reset()
{
2009-08-17 00:29:53 +02:00
me->RestoreFaction();
}
2009-10-17 15:51:44 -07:00
2010-04-19 09:26:37 +02:00
void JustDied(Unit* /*killer*/)
{
2009-08-17 00:29:53 +02:00
me->RestoreFaction();
}
};
2009-10-17 15:51:44 -07:00
2009-04-09 23:07:32 +02:00
CreatureAI* GetAI_npc_prospector_anvilward(Creature* pCreature)
{
2009-08-16 02:12:14 +02:00
return new npc_prospector_anvilwardAI(pCreature);
}
2009-10-17 15:51:44 -07:00
2009-08-14 00:39:07 +02:00
bool GossipHello_npc_prospector_anvilward(Player* pPlayer, Creature* pCreature)
{
2009-08-14 00:02:13 +02:00
if (pPlayer->GetQuestStatus(QUEST_THE_DWARVEN_SPY) == QUEST_STATUS_INCOMPLETE)
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
2009-10-17 15:51:44 -07:00
2009-08-14 00:39:07 +02:00
pPlayer->SEND_GOSSIP_MENU(8239, pCreature->GetGUID());
return true;
}
2009-10-17 15:51:44 -07:00
2010-04-19 09:26:37 +02:00
bool GossipSelect_npc_prospector_anvilward(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction)
{
2009-08-15 00:32:04 +02:00
switch(uiAction)
{
case GOSSIP_ACTION_INFO_DEF+1:
2009-08-14 00:02:13 +02:00
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2);
2009-08-14 00:39:07 +02:00
pPlayer->SEND_GOSSIP_MENU(8240, pCreature->GetGUID());
break;
case GOSSIP_ACTION_INFO_DEF+2:
2009-08-14 00:02:13 +02:00
pPlayer->CLOSE_GOSSIP_MENU();
2009-08-14 04:21:52 +02:00
if (npc_escortAI* pEscortAI = CAST_AI(npc_prospector_anvilwardAI, pCreature->AI()))
pEscortAI->Start(true, false, pPlayer->GetGUID());
break;
}
return true;
}
2009-10-17 15:51:44 -07:00
/*######
## Quest 9686 Second Trial
######*/
2009-10-17 15:51:44 -07:00
#define QUEST_SECOND_TRIAL 9686
2009-10-17 15:51:44 -07:00
#define MASTER_KELERUN_BLOODMOURN 17807
2009-10-17 15:51:44 -07:00
#define CHAMPION_BLOODWRATH 17809
#define CHAMPION_LIGHTREND 17810
#define CHAMPION_SWIFTBLADE 17811
#define CHAMPION_SUNSTRIKER 17812
2009-10-17 15:51:44 -07:00
#define HARBINGER_OF_THE_SECOND_TRIAL 182052
2009-10-17 15:51:44 -07:00
#define SPELL_FLASH_OF_LIGHT 19939
#define TIMER_FLASH_OF_LIGHT 3225
2009-10-17 15:51:44 -07:00
#define SPELL_SEAL_OF_JUSTICE 20164
#define TIMER_SEAL_OF_JUSTICE 10000
2009-10-17 15:51:44 -07:00
#define SPELL_JUDGEMENT_OF_LIGHT 20271
#define TIMER_JUDGEMENT_OF_LIGHT 10000
2009-10-17 15:51:44 -07:00
#define SPELL_SEAL_OF_COMMAND 20375
#define TIMER_SEAL_OF_COMMAND 20000
2009-10-17 15:51:44 -07:00
#define OFFSET_NEXT_ATTACK 750
2009-10-17 15:51:44 -07:00
#define FACTION_HOSTILE 45
#define FACTION_FRIENDLY 7
2009-10-17 15:51:44 -07:00
// missing from db
#define TEXT_SECOND_TRIAL_1 -1645006
#define TEXT_SECOND_TRIAL_2 -1645007
#define TEXT_SECOND_TRIAL_3 -1645008
#define TEXT_SECOND_TRIAL_4 -1645009
2009-10-17 15:51:44 -07:00
struct Locations
{
float x, y, z, o;
};
2009-10-17 15:51:44 -07:00
static Locations SpawnPosition[]=
{
{5.3, -11.8, 0.361, 4.2},
{11.2, -29.17, 0.361, 2.7},
{-5.7, -34.85, 0.361, 1.09},
{-11.9, -18, 0.361, 5.87}
};
2009-10-17 15:51:44 -07:00
static uint32 PaladinEntry[] = {CHAMPION_BLOODWRATH, CHAMPION_LIGHTREND, CHAMPION_SWIFTBLADE, CHAMPION_SUNSTRIKER};
2009-10-17 15:51:44 -07:00
/*######
## npc_second_trial_paladin
######*/
2009-10-17 15:51:44 -07:00
2010-02-05 00:31:28 +01:00
struct npc_secondTrialAI : public ScriptedAI
{
npc_secondTrialAI(Creature *c) : ScriptedAI(c) {}
2009-10-17 15:51:44 -07:00
uint32 timer;
uint8 questPhase;
uint64 summonerGuid;
2009-10-17 15:51:44 -07:00
bool spellFlashLight;
bool spellJustice;
bool spellJudLight;
bool spellCommand;
2009-10-17 15:51:44 -07:00
uint32 timerFlashLight;
uint32 timerJustice;
uint32 timerJudLight;
uint32 timerCommand;
void Reset()
{
2009-10-17 15:51:44 -07:00
timer = 2000;
questPhase = 0;
summonerGuid = 0;
2009-10-17 15:51:44 -07:00
2010-04-14 23:07:41 +02:00
me->SetUInt32Value(UNIT_FIELD_BYTES_1, UNIT_STAND_STATE_KNEEL);
me->setFaction(FACTION_FRIENDLY);
2009-10-17 15:51:44 -07:00
spellFlashLight = false;
spellJustice = false;
spellJudLight = false;
spellCommand = false;
2009-10-17 15:51:44 -07:00
2010-04-14 23:07:41 +02:00
switch(me->GetEntry())
{
case CHAMPION_BLOODWRATH:
spellFlashLight = true;
timerFlashLight = TIMER_FLASH_OF_LIGHT;
break;
case CHAMPION_LIGHTREND:
spellJustice = true;
timerJustice = 500;
break;
case CHAMPION_SWIFTBLADE:
spellJudLight = false; // Misses Script Effect // http://www.wowhead.com/?spell=20271
timerJudLight = 500;
break;
case CHAMPION_SUNSTRIKER:
spellFlashLight = true;
spellJudLight = false; // Misses Script Effect // http://www.wowhead.com/?spell=20271
spellCommand = false; // Misses Dummy // http://www.wowhead.com/?spell=20375
timerFlashLight = TIMER_FLASH_OF_LIGHT;
timerJudLight = 500;
timerCommand = 1500;
break;
}
}
2009-10-17 15:51:44 -07:00
2010-04-19 09:26:37 +02:00
void EnterCombat(Unit * /*who*/) {}
2009-10-17 15:51:44 -07:00
void UpdateAI(const uint32 diff)
{
if (questPhase == 1)
2009-10-27 21:28:20 -07:00
if (timer <= diff)
{
2010-04-14 23:07:41 +02:00
me->SetUInt32Value(UNIT_FIELD_BYTES_1, UNIT_STAND_STATE_STAND);
me->setFaction(FACTION_HOSTILE);
questPhase = 0;
2009-10-27 21:28:20 -07:00
if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
{
2010-04-14 23:07:41 +02:00
me->AddThreat(pTarget, 5000000.0f);
2009-10-27 21:28:20 -07:00
AttackStart(pTarget);
}
}
else
timer -= diff;
2009-10-17 15:51:44 -07:00
if (!UpdateVictim())
return;
2009-10-17 15:51:44 -07:00
// healer
if (spellFlashLight)
2010-04-14 23:07:41 +02:00
if (me->GetHealth()*100 / me->GetMaxHealth() < 70)
2009-10-27 21:28:20 -07:00
if (timerFlashLight <= diff)
{
2010-04-14 23:07:41 +02:00
DoCast(me, SPELL_FLASH_OF_LIGHT);
timerFlashLight = TIMER_FLASH_OF_LIGHT + rand()%TIMER_FLASH_OF_LIGHT;
}
else
timerFlashLight -= diff;
2009-10-17 15:51:44 -07:00
if (spellJustice)
2009-10-27 21:28:20 -07:00
if (timerJustice <= diff)
{
2010-04-14 23:07:41 +02:00
DoCast(me, SPELL_SEAL_OF_JUSTICE);
timerJustice = TIMER_SEAL_OF_JUSTICE + rand()%TIMER_SEAL_OF_JUSTICE;
}
else
timerJustice -= diff;
2009-10-17 15:51:44 -07:00
if (spellJudLight)
2009-10-27 21:28:20 -07:00
if (timerJudLight <= diff)
{
2010-04-14 23:07:41 +02:00
DoCast(me, SPELL_JUDGEMENT_OF_LIGHT);
timerJudLight = TIMER_JUDGEMENT_OF_LIGHT + rand()%TIMER_JUDGEMENT_OF_LIGHT;
}
else
timerJudLight -= diff;
2009-10-17 15:51:44 -07:00
if (spellCommand)
2009-10-27 21:28:20 -07:00
if (timerCommand <= diff)
{
2010-04-14 23:07:41 +02:00
DoCast(me, TIMER_SEAL_OF_COMMAND);
timerCommand = TIMER_SEAL_OF_COMMAND + rand()%TIMER_SEAL_OF_COMMAND;
}
else
timerCommand -= diff;
2009-10-17 15:51:44 -07:00
DoMeleeAttackIfReady();
}
2009-10-17 15:51:44 -07:00
void Activate(uint64 summonerguid);
void KilledUnit(Unit* Killed);
void JustDied(Unit* Killer);
2009-10-17 15:51:44 -07:00
};
2009-10-17 15:51:44 -07:00
/*######
## npc_second_trial_controller
######*/
2009-10-17 15:51:44 -07:00
2010-02-05 00:31:28 +01:00
struct master_kelerun_bloodmournAI : public ScriptedAI
{
master_kelerun_bloodmournAI(Creature *c) : ScriptedAI(c) {}
2009-10-17 15:51:44 -07:00
uint8 questPhase;
uint8 paladinPhase;
uint32 timer;
2009-10-17 15:51:44 -07:00
uint64 paladinGuid[4];
2009-10-17 15:51:44 -07:00
void Reset()
{
questPhase = 0;
timer = 60000;
paladinPhase = 0;
2010-04-19 16:54:25 +02:00
for (uint8 i = 0; i < 4; ++i)
paladinGuid[i] = 0;
}
2009-10-17 15:51:44 -07:00
2010-04-19 09:26:37 +02:00
void EnterCombat(Unit * /*who*/) {}
2009-10-17 15:51:44 -07:00
void UpdateAI(const uint32 diff)
{
// Quest accepted but object not activated, object despawned (if in sync 1 minute!)
if (questPhase == 1)
{
2009-10-27 21:28:20 -07:00
if (timer <= diff)
Reset();
else
timer -= diff;
}
// fight the 4 paladin mobs phase
else if (questPhase == 2)
{
2009-10-27 21:28:20 -07:00
if (timer <= diff)
{
2010-04-14 23:07:41 +02:00
if (Creature* paladinSpawn = Unit::GetCreature((*me), paladinGuid[paladinPhase]))
{
2010-04-14 23:07:41 +02:00
CAST_AI(npc_secondTrialAI, paladinSpawn->AI())->Activate(me->GetGUID());
switch(paladinPhase)
{
case 0:
2010-04-14 23:07:41 +02:00
DoScriptText(TEXT_SECOND_TRIAL_1,me);
break;
case 1:
2010-04-14 23:07:41 +02:00
DoScriptText(TEXT_SECOND_TRIAL_2,me);
break;
case 2:
2010-04-14 23:07:41 +02:00
DoScriptText(TEXT_SECOND_TRIAL_3,me);
break;
case 3:
2010-04-14 23:07:41 +02:00
DoScriptText(TEXT_SECOND_TRIAL_4,me);
break;
}
}
else
Reset();
2009-10-17 15:51:44 -07:00
questPhase = 4;
timer = OFFSET_NEXT_ATTACK;
}
else
timer -= diff;
}
2009-10-17 15:51:44 -07:00
if (!UpdateVictim())
return;
2009-10-17 15:51:44 -07:00
DoMeleeAttackIfReady();
}
2009-10-17 15:51:44 -07:00
void StartEvent()
{
2009-10-17 15:51:44 -07:00
if (questPhase == 1)
{ // no player check, quest can be finished as group, so no complex PlayerGUID/group search code
2009-10-17 15:51:44 -07:00
for (uint8 i = 0; i < 4; ++i)
if (Creature *pSummoned = DoSpawnCreature(PaladinEntry[i], SpawnPosition[i].x, SpawnPosition[i].y, SpawnPosition[i].z, SpawnPosition[i].o, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 180000))
paladinGuid[i] = pSummoned->GetGUID();
2009-10-17 15:51:44 -07:00
timer = OFFSET_NEXT_ATTACK;
questPhase = 2;
}
}
2009-10-17 15:51:44 -07:00
void SecondTrialKill();
2010-04-19 09:26:37 +02:00
void SummonedCreatureDespawn(Creature* /*c*/) {}
};
2009-08-14 00:39:07 +02:00
bool GossipHello_master_kelerun_bloodmourn(Player* pPlayer, Creature* pCreature)
{
// quest only available if not already started
// Quest_template flag is set to : QUEST_FLAGS_EVENT
// Escort quests or any other event-driven quests. If player in party, all players that can accept this quest will receive confirmation box to accept quest.
// !not sure if this really works!
2009-10-17 15:51:44 -07:00
if (CAST_AI(master_kelerun_bloodmournAI, pCreature->AI())->questPhase == 0)
{
2009-08-14 00:39:07 +02:00
pPlayer->PrepareQuestMenu(pCreature->GetGUID());
pPlayer->SendPreparedQuest(pCreature->GetGUID());
}
2009-10-17 15:51:44 -07:00
2009-08-14 00:39:07 +02:00
pPlayer->SEND_GOSSIP_MENU(pCreature->GetEntry(), pCreature->GetGUID());
return true;
}
2009-10-17 15:51:44 -07:00
2010-04-19 09:26:37 +02:00
bool QuestAccept_master_kelerun_bloodmourn(Player* /*pPlayer*/, Creature* pCreature, Quest const *quest)
{
// One Player exclusive quest, wait for user go activation
2009-08-14 00:02:13 +02:00
if (quest->GetQuestId() == QUEST_SECOND_TRIAL)
2009-08-15 00:32:04 +02:00
CAST_AI(master_kelerun_bloodmournAI, pCreature->AI())->questPhase = 1;
2009-10-17 15:51:44 -07:00
return true;
}
2009-10-17 15:51:44 -07:00
void master_kelerun_bloodmournAI::SecondTrialKill()
{
if (questPhase > 0)
{
++paladinPhase;
2009-10-17 15:51:44 -07:00
if (paladinPhase < 4)
questPhase = 2;
else
Reset(); // Quest Complete, QuestComplete handler is in npc_secondTrialAI::JustDied
}
}
2009-10-17 15:51:44 -07:00
void npc_secondTrialAI::JustDied(Unit* Killer)
{
if (Killer->GetTypeId() == TYPEID_PLAYER)
{
2010-04-14 23:07:41 +02:00
if (Creature *pSummoner = Unit::GetCreature((*me), summonerGuid))
2009-10-18 17:10:42 -07:00
CAST_AI(master_kelerun_bloodmournAI, pSummoner->AI())->SecondTrialKill();
2009-10-17 15:51:44 -07:00
// last kill quest complete for group
2010-04-14 23:07:41 +02:00
if (me->GetEntry() == CHAMPION_SUNSTRIKER)
{
2009-08-14 00:02:13 +02:00
if (Group *pGroup = CAST_PLR(Killer)->GetGroup())
{
for (GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next())
{
Player *pGroupGuy = itr->getSource();
2009-10-17 15:51:44 -07:00
// for any leave or dead (with not released body) group member at appropriate distance
2010-04-14 23:07:41 +02:00
if (pGroupGuy && pGroupGuy->IsAtGroupRewardDistance(me) && !pGroupGuy->GetCorpse() && pGroupGuy->GetQuestStatus(QUEST_SECOND_TRIAL) == QUEST_STATUS_INCOMPLETE)
pGroupGuy->CompleteQuest(QUEST_SECOND_TRIAL);
}
}
else if (CAST_PLR(Killer)->GetQuestStatus(QUEST_SECOND_TRIAL) == QUEST_STATUS_INCOMPLETE)
CAST_PLR(Killer)->CompleteQuest(QUEST_SECOND_TRIAL);
}
}
}
2009-10-17 15:51:44 -07:00
void npc_secondTrialAI::KilledUnit(Unit* Killed)
{
if (Killed->GetTypeId() == TYPEID_PLAYER)
if (CAST_PLR(Killed)->GetQuestStatus(QUEST_SECOND_TRIAL) == QUEST_STATUS_INCOMPLETE)
CAST_PLR(Killed)->FailQuest(QUEST_SECOND_TRIAL);
}
2009-10-17 15:51:44 -07:00
void npc_secondTrialAI::Activate(uint64 summonerguid)
{
questPhase = 1;
summonerGuid = summonerguid;
}
2009-10-17 15:51:44 -07:00
2009-08-14 00:39:07 +02:00
CreatureAI* GetAI_master_kelerun_bloodmourn(Creature* pCreature)
{
2009-08-14 00:39:07 +02:00
return new master_kelerun_bloodmournAI (pCreature);
}
2009-10-17 15:51:44 -07:00
2009-08-14 00:39:07 +02:00
CreatureAI* GetAI_npc_secondTrial(Creature* pCreature)
{
2009-08-14 00:39:07 +02:00
return new npc_secondTrialAI (pCreature);
}
2009-10-17 15:51:44 -07:00
/*######
## go_second_trial
######*/
2009-10-17 15:51:44 -07:00
2010-04-19 09:26:37 +02:00
bool GOHello_go_second_trial(Player* /*pPlayer*/, GameObject* pGO)
{
// find spawn :: master_kelerun_bloodmourn
if (Creature *pCreature = pGO->FindNearestCreature(MASTER_KELERUN_BLOODMOURN, 30.0f))
2009-06-29 06:31:05 +02:00
CAST_AI(master_kelerun_bloodmournAI, pCreature->AI())->StartEvent();
2009-10-17 15:51:44 -07:00
return true;
}
2009-10-17 15:51:44 -07:00
2008-12-31 15:55:11 +01:00
/*######
## npc_apprentice_mirveda
######*/
2009-10-17 15:51:44 -07:00
2009-02-09 08:16:34 -05:00
#define QUEST_UNEXPECTED_RESULT 8488
#define MOB_GHARZUL 15958
#define MOB_ANGERSHADE 15656
2009-10-17 15:51:44 -07:00
2010-02-05 00:31:28 +01:00
struct npc_apprentice_mirvedaAI : public ScriptedAI
2008-12-31 15:55:11 +01:00
{
2010-04-14 23:07:41 +02:00
npc_apprentice_mirvedaAI(Creature* c) : ScriptedAI(c), Summons(me) {}
2009-10-17 15:51:44 -07:00
2009-02-09 08:16:34 -05:00
uint32 KillCount;
uint64 PlayerGUID;
bool Summon;
SummonList Summons;
2009-10-17 15:51:44 -07:00
2009-02-09 08:16:34 -05:00
void Reset()
{
KillCount = 0;
PlayerGUID = 0;
Summons.DespawnAll();
Summon = false;
}
2009-10-17 15:51:44 -07:00
2010-04-19 09:26:37 +02:00
void EnterCombat(Unit* /*who*/){}
2009-10-17 15:51:44 -07:00
2009-02-09 08:16:34 -05:00
void JustSummoned(Creature *summoned)
{
2010-04-14 23:07:41 +02:00
summoned->AI()->AttackStart(me);
2009-02-09 08:16:34 -05:00
Summons.Summon(summoned);
}
2009-10-17 15:51:44 -07:00
2009-02-09 08:16:34 -05:00
void SummonedCreatureDespawn(Creature* summoned)
{
Summons.Despawn(summoned);
++KillCount;
}
2009-10-17 15:51:44 -07:00
2010-04-19 09:26:37 +02:00
void JustDied(Unit* /*killer*/)
2009-02-09 08:16:34 -05:00
{
if (PlayerGUID)
if (Player* pPlayer = Unit::GetPlayer(PlayerGUID))
2009-08-14 00:02:13 +02:00
CAST_PLR(pPlayer)->FailQuest(QUEST_UNEXPECTED_RESULT);
2009-02-09 08:16:34 -05:00
}
2009-10-17 15:51:44 -07:00
2010-04-19 09:26:37 +02:00
void UpdateAI(const uint32 /*diff*/)
2009-02-09 08:16:34 -05:00
{
if (KillCount >= 3 && PlayerGUID)
if (Player* pPlayer = Unit::GetPlayer(PlayerGUID))
CAST_PLR(pPlayer)->CompleteQuest(QUEST_UNEXPECTED_RESULT);
2009-10-17 15:51:44 -07:00
2009-08-14 00:02:13 +02:00
if (Summon)
2009-02-09 08:16:34 -05:00
{
2010-04-14 23:07:41 +02:00
me->SummonCreature(MOB_GHARZUL, 8745, -7134.32, 35.22, 0, TEMPSUMMON_CORPSE_DESPAWN, 4000);
me->SummonCreature(MOB_ANGERSHADE, 8745, -7134.32, 35.22, 0, TEMPSUMMON_CORPSE_DESPAWN, 4000);
me->SummonCreature(MOB_ANGERSHADE, 8745, -7134.32, 35.22, 0, TEMPSUMMON_CORPSE_DESPAWN, 4000);
2009-02-09 08:16:34 -05:00
Summon = false;
}
}
2008-12-31 15:55:11 +01:00
};
2009-10-17 15:51:44 -07:00
2009-08-15 00:32:04 +02:00
bool QuestAccept_npc_apprentice_mirveda(Player* pPlayer, Creature* pCreature, Quest const* quest)
2008-12-31 15:55:11 +01:00
{
if (quest->GetQuestId() == QUEST_UNEXPECTED_RESULT)
{
2009-08-15 00:32:04 +02:00
CAST_AI(npc_apprentice_mirvedaAI, pCreature->AI())->Summon = true;
CAST_AI(npc_apprentice_mirvedaAI, pCreature->AI())->PlayerGUID = pPlayer->GetGUID();
2008-12-31 15:55:11 +01:00
}
return true;
}
2009-10-17 15:51:44 -07:00
2009-08-14 00:39:07 +02:00
CreatureAI* GetAI_npc_apprentice_mirvedaAI(Creature* pCreature)
2008-12-31 15:55:11 +01:00
{
2009-08-14 00:39:07 +02:00
return new npc_apprentice_mirvedaAI (pCreature);
2008-12-31 15:55:11 +01:00
}
2009-10-17 15:51:44 -07:00
2008-12-31 15:55:11 +01:00
/*######
2009-01-22 22:05:51 +01:00
## npc_infused_crystal
2008-12-31 15:55:11 +01:00
######*/
2009-10-17 15:51:44 -07:00
2009-02-09 08:16:34 -05:00
#define MOB_ENRAGED_WRAITH 17086
#define EMOTE -1000283
#define QUEST_POWERING_OUR_DEFENSES 8490
2009-10-17 15:51:44 -07:00
2008-12-31 15:55:11 +01:00
struct Location
{
float x, y, z;
};
2009-10-17 15:51:44 -07:00
static Location SpawnLocations[] =
2008-12-31 15:55:11 +01:00
{
2009-02-09 08:16:34 -05:00
{8270.68, -7188.53, 139.619},
{8284.27, -7187.78, 139.603},
{8297.43, -7193.53, 139.603},
{8303.5, -7201.96, 139.577},
{8273.22, -7241.82, 139.382},
{8254.89, -7222.12, 139.603},
{8278.51, -7242.13, 139.162},
{8267.97, -7239.17, 139.517}
2008-12-31 15:55:11 +01:00
};
2009-10-17 15:51:44 -07:00
2010-02-05 00:31:28 +01:00
struct npc_infused_crystalAI : public Scripted_NoMovementAI
2008-12-31 15:55:11 +01:00
{
npc_infused_crystalAI(Creature* c) : Scripted_NoMovementAI(c) {}
2009-10-17 15:51:44 -07:00
2009-02-09 08:16:34 -05:00
uint32 EndTimer;
uint32 WaveTimer;
bool Completed;
bool Progress;
uint64 PlayerGUID;
2009-10-17 15:51:44 -07:00
2009-02-09 08:16:34 -05:00
void Reset()
{
EndTimer = 0;
Completed = false;
Progress = false;
PlayerGUID = 0;
WaveTimer = 0;
}
2009-10-17 15:51:44 -07:00
2009-02-09 08:16:34 -05:00
void MoveInLineOfSight(Unit* who)
{
2010-04-14 23:07:41 +02:00
if (!Progress && who->GetTypeId() == TYPEID_PLAYER && me->IsWithinDistInMap(who, 10.0f))
2009-02-09 08:16:34 -05:00
{
2009-08-14 00:02:13 +02:00
if (CAST_PLR(who)->GetQuestStatus(QUEST_POWERING_OUR_DEFENSES) == QUEST_STATUS_INCOMPLETE)
2009-02-09 08:16:34 -05:00
{
PlayerGUID = who->GetGUID();
WaveTimer = 1000;
EndTimer = 60000;
Progress = true;
2009-02-09 08:16:34 -05:00
}
}
}
2009-10-17 15:51:44 -07:00
2009-02-09 08:16:34 -05:00
void JustSummoned(Creature *summoned)
{
2010-04-14 23:07:41 +02:00
summoned->AI()->AttackStart(me);
2009-02-09 08:16:34 -05:00
}
2009-10-17 15:51:44 -07:00
2010-04-19 09:26:37 +02:00
void JustDied(Unit* /*killer*/)
2009-02-09 08:16:34 -05:00
{
if (PlayerGUID && !Completed)
if (Player* pPlayer = Unit::GetPlayer(PlayerGUID))
2009-08-14 00:02:13 +02:00
CAST_PLR(pPlayer)->FailQuest(QUEST_POWERING_OUR_DEFENSES);
2009-02-09 08:16:34 -05:00
}
2009-10-17 15:51:44 -07:00
2009-02-09 08:16:34 -05:00
void UpdateAI(const uint32 diff)
{
2009-08-14 00:02:13 +02:00
if (EndTimer < diff && Progress)
2009-02-09 08:16:34 -05:00
{
2010-04-14 23:07:41 +02:00
DoScriptText(EMOTE, me);
2009-02-09 08:16:34 -05:00
Completed = true;
if (PlayerGUID)
if (Player* pPlayer = Unit::GetPlayer(PlayerGUID))
2009-08-14 00:02:13 +02:00
CAST_PLR(pPlayer)->CompleteQuest(QUEST_POWERING_OUR_DEFENSES);
2010-04-14 23:07:41 +02:00
me->DealDamage(me,me->GetHealth(),NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
me->RemoveCorpse();
} else EndTimer -= diff;
2009-10-17 15:51:44 -07:00
2009-08-14 00:02:13 +02:00
if (WaveTimer < diff && !Completed && Progress)
2009-02-09 08:16:34 -05:00
{
uint32 ran1 = rand()%8;
uint32 ran2 = rand()%8;
uint32 ran3 = rand()%8;
2010-04-14 23:07:41 +02:00
me->SummonCreature(MOB_ENRAGED_WRAITH, SpawnLocations[ran1].x, SpawnLocations[ran1].y, SpawnLocations[ran1].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 10000);
me->SummonCreature(MOB_ENRAGED_WRAITH, SpawnLocations[ran2].x, SpawnLocations[ran2].y, SpawnLocations[ran2].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 10000);
me->SummonCreature(MOB_ENRAGED_WRAITH, SpawnLocations[ran3].x, SpawnLocations[ran3].y, SpawnLocations[ran3].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 10000);
2009-02-09 08:16:34 -05:00
WaveTimer = 30000;
2009-10-27 21:28:20 -07:00
} else WaveTimer -= diff;
2009-02-09 08:16:34 -05:00
}
2008-12-31 15:55:11 +01:00
};
2009-10-17 15:51:44 -07:00
2009-08-14 00:39:07 +02:00
CreatureAI* GetAI_npc_infused_crystalAI(Creature* pCreature)
2008-12-31 15:55:11 +01:00
{
2009-08-14 00:39:07 +02:00
return new npc_infused_crystalAI (pCreature);
2008-12-31 15:55:11 +01:00
}
2009-10-17 15:51:44 -07:00
void AddSC_eversong_woods()
{
Script *newscript;
2009-10-17 15:51:44 -07:00
newscript = new Script;
newscript->Name = "npc_prospector_anvilward";
newscript->GetAI = &GetAI_npc_prospector_anvilward;
newscript->pGossipHello = &GossipHello_npc_prospector_anvilward;
newscript->pGossipSelect = &GossipSelect_npc_prospector_anvilward;
newscript->RegisterSelf();
2009-10-17 15:51:44 -07:00
newscript = new Script;
newscript->Name = "npc_second_trial_controller";
newscript->GetAI = &GetAI_master_kelerun_bloodmourn;
newscript->pGossipHello = &GossipHello_master_kelerun_bloodmourn;
newscript->pQuestAccept = &QuestAccept_master_kelerun_bloodmourn;
newscript->RegisterSelf();
2009-10-17 15:51:44 -07:00
newscript = new Script;
newscript->Name = "npc_second_trial_paladin";
newscript->GetAI = &GetAI_npc_secondTrial;
newscript->RegisterSelf();
2009-10-17 15:51:44 -07:00
newscript = new Script;
newscript->Name = "go_second_trial";
newscript->pGOHello = &GOHello_go_second_trial;
newscript->RegisterSelf();
2009-10-17 15:51:44 -07:00
2009-02-09 08:16:34 -05:00
newscript = new Script;
newscript->Name = "npc_apprentice_mirveda";
newscript->GetAI = &GetAI_npc_apprentice_mirvedaAI;
newscript->pQuestAccept = &QuestAccept_npc_apprentice_mirveda;
newscript->RegisterSelf();
2009-10-17 15:51:44 -07:00
2009-02-09 08:16:34 -05:00
newscript = new Script;
newscript->Name = "npc_infused_crystal";
newscript->GetAI = &GetAI_npc_infused_crystalAI;
newscript->RegisterSelf();
}