Files
TCPlayerbotCore/src/scripts/kalimdor/ashenvale.cpp
T

249 lines
7.2 KiB
C++
Raw Normal View History

2009-02-17 18:08:26 +01:00
/* Copyright (C) 2006 - 2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
2008-12-13 19:56:53 +01:00
* 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
2008-12-13 19:56:53 +01:00
/* ScriptData
SDName: Ashenvale
SD%Complete: 70
2009-01-10 12:45:01 +01:00
SDComment: Quest support: 6544, 6482
2008-12-13 19:56:53 +01:00
SDCategory: Ashenvale Forest
EndScriptData */
2009-10-17 15:51:44 -07:00
2008-12-13 19:56:53 +01:00
/* ContentData
npc_torek
2009-01-10 12:45:01 +01:00
npc_ruul_snowhoof
2008-12-13 19:56:53 +01:00
EndContentData */
2009-10-17 15:51:44 -07:00
2010-01-19 11:36:05 +01:00
#include "ScriptedPch.h"
#include "ScriptedEscortAI.h"
2009-10-17 15:51:44 -07:00
2008-12-13 19:56:53 +01:00
/*####
# npc_torek
####*/
2009-10-17 15:51:44 -07:00
2008-12-13 19:56:53 +01:00
#define SAY_READY -1000106
#define SAY_MOVE -1000107
#define SAY_PREPARE -1000108
#define SAY_WIN -1000109
#define SAY_END -1000110
2009-10-17 15:51:44 -07:00
2008-12-13 19:56:53 +01:00
#define SPELL_REND 11977
#define SPELL_THUNDERCLAP 8078
2009-10-17 15:51:44 -07:00
2008-12-13 19:56:53 +01:00
#define QUEST_TOREK_ASSULT 6544
2009-10-17 15:51:44 -07:00
2008-12-13 19:56:53 +01:00
#define ENTRY_SPLINTERTREE_RAIDER 12859
#define ENTRY_DURIEL 12860
#define ENTRY_SILVERWING_SENTINEL 12896
#define ENTRY_SILVERWING_WARRIOR 12897
2009-10-17 15:51:44 -07:00
2008-12-13 19:56:53 +01:00
struct TRINITY_DLL_DECL npc_torekAI : public npc_escortAI
{
npc_torekAI(Creature *c) : npc_escortAI(c) {}
2009-10-17 15:51:44 -07:00
2009-02-09 08:16:34 -05:00
uint32 Rend_Timer;
uint32 Thunderclap_Timer;
bool Completed;
2009-10-17 15:51:44 -07:00
2009-02-09 08:16:34 -05:00
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-02-09 08:16:34 -05:00
return;
2009-10-17 15:51:44 -07:00
2009-02-09 08:16:34 -05:00
switch (i)
{
case 1:
2009-08-14 00:02:13 +02:00
DoScriptText(SAY_MOVE, m_creature, pPlayer);
2009-02-09 08:16:34 -05:00
break;
case 8:
2009-08-14 00:02:13 +02:00
DoScriptText(SAY_PREPARE, m_creature, pPlayer);
2009-02-09 08:16:34 -05:00
break;
case 19:
//TODO: verify location and creatures amount.
m_creature->SummonCreature(ENTRY_DURIEL,1776.73,-2049.06,109.83,1.54,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,25000);
m_creature->SummonCreature(ENTRY_SILVERWING_SENTINEL,1774.64,-2049.41,109.83,1.40,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,25000);
m_creature->SummonCreature(ENTRY_SILVERWING_WARRIOR,1778.73,-2049.50,109.83,1.67,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,25000);
break;
case 20:
2009-08-14 00:02:13 +02:00
DoScriptText(SAY_WIN, m_creature, pPlayer);
2009-02-09 08:16:34 -05:00
Completed = true;
2009-08-17 00:29:53 +02:00
if (pPlayer)
pPlayer->GroupEventHappens(QUEST_TOREK_ASSULT, m_creature);
2009-02-09 08:16:34 -05:00
break;
case 21:
2009-08-14 00:02:13 +02:00
DoScriptText(SAY_END, m_creature, pPlayer);
2009-02-09 08:16:34 -05:00
break;
}
}
2009-10-17 15:51:44 -07:00
2009-02-09 08:16:34 -05:00
void Reset()
{
Rend_Timer = 5000;
Thunderclap_Timer = 8000;
Completed = false;
}
2009-10-17 15:51:44 -07:00
2009-04-27 21:23:42 -05:00
void EnterCombat(Unit* who)
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)
{
summoned->AI()->AttackStart(m_creature);
}
2009-10-17 15:51:44 -07:00
2009-02-09 08:16:34 -05:00
void UpdateAI(const uint32 diff)
{
npc_escortAI::UpdateAI(diff);
2009-10-17 15:51:44 -07:00
2009-02-09 08:16:34 -05:00
if (!UpdateVictim())
return;
2009-10-17 15:51:44 -07:00
2009-10-27 21:28:20 -07:00
if (Rend_Timer <= diff)
2009-02-09 08:16:34 -05:00
{
DoCast(m_creature->getVictim(), SPELL_REND);
2009-02-09 08:16:34 -05:00
Rend_Timer = 20000;
2009-10-27 21:28:20 -07:00
} else Rend_Timer -= diff;
2009-10-17 15:51:44 -07:00
2009-10-27 21:28:20 -07:00
if (Thunderclap_Timer <= diff)
2009-02-09 08:16:34 -05:00
{
DoCast(m_creature, SPELL_THUNDERCLAP);
2009-02-09 08:16:34 -05:00
Thunderclap_Timer = 30000;
2009-10-27 21:28:20 -07:00
} else Thunderclap_Timer -= diff;
2009-02-09 08:16:34 -05:00
}
2008-12-13 19:56:53 +01:00
};
2009-10-17 15:51:44 -07:00
2009-08-14 04:21:52 +02:00
bool QuestAccept_npc_torek(Player* pPlayer, Creature* pCreature, Quest const* quest)
2008-12-13 19:56:53 +01:00
{
2009-02-09 08:16:34 -05:00
if (quest->GetQuestId() == QUEST_TOREK_ASSULT)
{
//TODO: find companions, make them follow Torek, at any time (possibly done by mangos/database in future?)
2009-08-14 04:21:52 +02:00
DoScriptText(SAY_READY, pCreature, pPlayer);
pCreature->setFaction(113);
2009-10-17 15:51:44 -07:00
2009-08-14 04:21:52 +02:00
if (npc_escortAI* pEscortAI = CAST_AI(npc_torekAI, pCreature->AI()))
pEscortAI->Start(true, true, pPlayer->GetGUID());
2009-02-09 08:16:34 -05:00
}
2009-10-17 15:51:44 -07:00
2009-02-09 08:16:34 -05:00
return true;
2008-12-13 19:56:53 +01:00
}
2009-10-17 15:51:44 -07:00
2009-04-09 23:07:32 +02:00
CreatureAI* GetAI_npc_torek(Creature* pCreature)
2008-12-13 19:56:53 +01:00
{
2009-08-16 02:12:14 +02:00
return new npc_torekAI(pCreature);
2008-12-13 19:56:53 +01:00
}
2009-10-17 15:51:44 -07:00
2009-01-10 12:45:01 +01:00
/*####
# npc_ruul_snowhoof
####*/
2009-10-17 15:51:44 -07:00
#define QUEST_FREEDOM_TO_RUUL 6482
2009-01-10 12:45:01 +01:00
#define GO_CAGE 178147
2009-10-17 15:51:44 -07:00
2009-01-10 12:45:01 +01:00
struct TRINITY_DLL_DECL npc_ruul_snowhoofAI : public npc_escortAI
{
npc_ruul_snowhoofAI(Creature *c) : npc_escortAI(c) {}
2009-10-17 15:51:44 -07:00
2009-01-10 12:45:01 +01:00
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-10 12:45:01 +01:00
return;
2009-10-17 15:51:44 -07:00
2009-01-10 12:45:01 +01:00
switch(i)
{
case 0: {
2009-01-10 12:45:01 +01:00
m_creature->SetUInt32Value(UNIT_FIELD_BYTES_1, 0);
GameObject* Cage = m_creature->FindNearestGameObject(GO_CAGE, 20);
2009-08-14 00:02:13 +02:00
if (Cage)
Cage->SetGoState(GO_STATE_ACTIVE);
2009-01-10 12:45:01 +01:00
break;}
case 13:
2009-01-10 12:45:01 +01:00
m_creature->SummonCreature(3922, 3449.218018, -587.825073, 174.978867, 4.714445, TEMPSUMMON_DEAD_DESPAWN, 60000);
m_creature->SummonCreature(3921, 3446.384521, -587.830872, 175.186279, 4.714445, TEMPSUMMON_DEAD_DESPAWN, 60000);
m_creature->SummonCreature(3926, 3444.218994, -587.835327, 175.380600, 4.714445, TEMPSUMMON_DEAD_DESPAWN, 60000);
break;
2009-01-10 12:45:01 +01:00
case 19:
m_creature->SummonCreature(3922, 3508.344482, -492.024261, 186.929031, 4.145029, TEMPSUMMON_DEAD_DESPAWN, 60000);
m_creature->SummonCreature(3921, 3506.265625, -490.531006, 186.740128, 4.239277, TEMPSUMMON_DEAD_DESPAWN, 60000);
m_creature->SummonCreature(3926, 3503.682373, -489.393799, 186.629684, 4.349232, TEMPSUMMON_DEAD_DESPAWN, 60000);
break;
2009-10-17 15:51:44 -07:00
2009-01-10 12:45:01 +01:00
case 21:{
2009-08-17 00:29:53 +02:00
if (pPlayer)
pPlayer->GroupEventHappens(QUEST_FREEDOM_TO_RUUL, m_creature);
2009-10-17 15:51:44 -07:00
break; }
2009-01-10 12:45:01 +01:00
}
}
2009-10-17 15:51:44 -07:00
2009-04-27 21:23:42 -05:00
void EnterCombat(Unit* who) {}
2009-10-17 15:51:44 -07:00
2009-01-10 12:45:01 +01:00
void Reset()
{
GameObject* Cage = m_creature->FindNearestGameObject(GO_CAGE, 20);
2009-08-14 00:02:13 +02:00
if (Cage)
Cage->SetGoState(GO_STATE_READY);
2009-01-10 12:45:01 +01:00
}
2009-10-17 15:51:44 -07:00
2009-02-09 08:16:34 -05:00
void JustSummoned(Creature* summoned)
{
summoned->AI()->AttackStart(m_creature);
}
2009-10-17 15:51:44 -07:00
2009-01-10 12:45:01 +01:00
void UpdateAI(const uint32 diff)
{
npc_escortAI::UpdateAI(diff);
}
};
2009-10-17 15:51:44 -07:00
2009-08-14 04:21:52 +02:00
bool QuestAccept_npc_ruul_snowhoof(Player* pPlayer, Creature* pCreature, Quest const* quest)
2009-01-10 12:45:01 +01:00
{
if (quest->GetQuestId() == QUEST_FREEDOM_TO_RUUL)
{
2009-08-14 04:21:52 +02:00
pCreature->setFaction(113);
2009-10-17 15:51:44 -07:00
2009-08-14 04:21:52 +02:00
if (npc_escortAI* pEscortAI = CAST_AI(npc_ruul_snowhoofAI, (pCreature->AI())))
pEscortAI->Start(true, false, pPlayer->GetGUID());
2009-01-10 12:45:01 +01:00
}
return true;
}
2009-10-17 15:51:44 -07:00
2009-08-14 00:39:07 +02:00
CreatureAI* GetAI_npc_ruul_snowhoofAI(Creature* pCreature)
2009-01-10 12:45:01 +01:00
{
2009-08-16 02:12:14 +02:00
return new npc_ruul_snowhoofAI(pCreature);
2009-01-10 12:45:01 +01:00
}
2009-10-17 15:51:44 -07:00
2008-12-13 19:56:53 +01:00
void AddSC_ashenvale()
{
2009-02-09 08:16:34 -05:00
Script *newscript;
2009-10-17 15:51:44 -07:00
2009-02-09 08:16:34 -05:00
newscript = new Script;
newscript->Name = "npc_torek";
newscript->GetAI = &GetAI_npc_torek;
newscript->pQuestAccept = &QuestAccept_npc_torek;
newscript->RegisterSelf();
2009-10-17 15:51:44 -07:00
2009-02-09 08:16:34 -05:00
newscript = new Script;
2009-01-10 12:45:01 +01:00
newscript->Name = "npc_ruul_snowhoof";
newscript->GetAI = &GetAI_npc_ruul_snowhoofAI;
newscript->pQuestAccept = &QuestAccept_npc_ruul_snowhoof;
newscript->RegisterSelf();
}
2009-02-17 20:07:49 -06:00