Files
TCPlayerbotCore/src/scripts/northrend/grizzly_hills.cpp
T

380 lines
13 KiB
C++
Raw Normal View History

2009-08-14 21:58:29 +02:00
/* 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
*/
2009-10-17 15:51:44 -07:00
2009-08-14 21:58:29 +02:00
/* ScriptData
SDName: Grizzly_Hills
SD%Complete: 80
SDComment: Quest support: 12231, 12247
2009-08-14 21:58:29 +02:00
SDCategory: Grizzly Hills
EndScriptData */
2009-10-17 15:51:44 -07:00
2009-08-14 21:58:29 +02:00
/* ContentData
npc_orsonn_and_kodian
EndContentData */
2009-10-17 15:51:44 -07:00
2010-01-19 11:36:05 +01:00
#include "ScriptedPch.h"
2010-02-19 00:20:14 +01:00
#include "ScriptedEscortAI.h"
2009-10-17 15:51:44 -07:00
2009-08-14 21:58:29 +02:00
#define GOSSIP_ITEM1 "You're free to go Orsonn, but first tell me what's wrong with the furbolg."
#define GOSSIP_ITEM2 "What happened then?"
#define GOSSIP_ITEM3 "Thank you, Son of Ursoc. I'll see what can be done."
#define GOSSIP_ITEM4 "Who was this stranger?"
#define GOSSIP_ITEM5 "Thank you, Kodian. I'll do what I can."
2009-10-17 15:51:44 -07:00
2009-10-17 07:42:48 -07:00
enum eEnums
2009-08-14 21:58:29 +02:00
{
GOSSIP_TEXTID_ORSONN1 = 12793,
GOSSIP_TEXTID_ORSONN2 = 12794,
GOSSIP_TEXTID_ORSONN3 = 12796,
2009-10-17 15:51:44 -07:00
2009-08-14 21:58:29 +02:00
GOSSIP_TEXTID_KODIAN1 = 12797,
GOSSIP_TEXTID_KODIAN2 = 12798,
2009-10-17 15:51:44 -07:00
2009-08-14 21:58:29 +02:00
NPC_ORSONN = 27274,
NPC_KODIAN = 27275,
2009-10-17 15:51:44 -07:00
2009-08-14 21:58:29 +02:00
//trigger creatures
NPC_ORSONN_CREDIT = 27322,
NPC_KODIAN_CREDIT = 27321,
2009-10-17 15:51:44 -07:00
QUEST_CHILDREN_OF_URSOC = 12247,
QUEST_THE_BEAR_GODS_OFFSPRING = 12231
2009-08-14 21:58:29 +02:00
};
2009-10-17 15:51:44 -07:00
2009-08-14 21:58:29 +02:00
bool GossipHello_npc_orsonn_and_kodian(Player* pPlayer, Creature* pCreature)
{
if (pCreature->isQuestGiver())
pPlayer->PrepareQuestMenu(pCreature->GetGUID());
2009-10-17 15:51:44 -07:00
if (pPlayer->GetQuestStatus(QUEST_CHILDREN_OF_URSOC) == QUEST_STATUS_INCOMPLETE || pPlayer->GetQuestStatus(QUEST_THE_BEAR_GODS_OFFSPRING) == QUEST_STATUS_INCOMPLETE)
2009-08-14 21:58:29 +02:00
{
switch(pCreature->GetEntry())
{
case NPC_ORSONN:
if (!pPlayer->GetReqKillOrCastCurrentCount(QUEST_CHILDREN_OF_URSOC, NPC_ORSONN_CREDIT) || !pPlayer->GetReqKillOrCastCurrentCount(QUEST_THE_BEAR_GODS_OFFSPRING, NPC_ORSONN_CREDIT))
2009-08-14 21:58:29 +02:00
{
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_ORSONN1, pCreature->GetGUID());
return true;
}
break;
case NPC_KODIAN:
if (!pPlayer->GetReqKillOrCastCurrentCount(QUEST_CHILDREN_OF_URSOC, NPC_KODIAN_CREDIT) || !pPlayer->GetReqKillOrCastCurrentCount(QUEST_THE_BEAR_GODS_OFFSPRING, NPC_KODIAN_CREDIT))
2009-08-14 21:58:29 +02:00
{
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+4);
pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_KODIAN1, pCreature->GetGUID());
return true;
}
break;
}
}
2009-10-17 15:51:44 -07:00
pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID());
2009-08-14 21:58:29 +02:00
return true;
}
2009-10-17 15:51:44 -07:00
2009-08-14 21:58:29 +02:00
bool GossipSelect_npc_orsonn_and_kodian(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction)
{
switch(uiAction)
{
case GOSSIP_ACTION_INFO_DEF+1:
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2);
pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_ORSONN2, pCreature->GetGUID());
break;
case GOSSIP_ACTION_INFO_DEF+2:
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3);
pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_ORSONN3, pCreature->GetGUID());
break;
case GOSSIP_ACTION_INFO_DEF+3:
pPlayer->CLOSE_GOSSIP_MENU();
pPlayer->TalkedToCreature(NPC_ORSONN_CREDIT, pCreature->GetGUID());
break;
2009-10-17 15:51:44 -07:00
2009-08-14 21:58:29 +02:00
case GOSSIP_ACTION_INFO_DEF+4:
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5);
pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_KODIAN2, pCreature->GetGUID());
break;
case GOSSIP_ACTION_INFO_DEF+5:
pPlayer->CLOSE_GOSSIP_MENU();
pPlayer->TalkedToCreature(NPC_KODIAN_CREDIT, pCreature->GetGUID());
break;
}
2009-10-17 15:51:44 -07:00
2009-08-14 21:58:29 +02:00
return true;
}
2009-10-17 15:51:44 -07:00
2010-02-19 00:20:14 +01:00
/*######
## Quest 12027: Mr. Floppy's Perilous Adventure
######*/
enum eFloppy
{
NPC_MRFLOPPY = 26589,
NPC_HUNGRY_WORG = 26586,
NPC_RAVENOUS_WORG = 26590, //RWORG
NPC_EMILY = 26588,
QUEST_PERILOUS_ADVENTURE = 12027,
SPELL_MRFLOPPY = 47184, //vehicle aura
SAY_WORGHAGGRO1 = -1800001, //Um... I think one of those wolves is back...
SAY_WORGHAGGRO2 = -1800002, //He's going for Mr. Floppy!
SAY_WORGRAGGRO3 = -1800003, //Oh, no! Look, it's another wolf, and it's a biiiiiig one!
SAY_WORGRAGGRO4 = -1800004, //He's gonna eat Mr. Floppy! You gotta help Mr. Floppy! You just gotta!
SAY_RANDOMAGGRO = -1800005, //There's a big meanie attacking Mr. Floppy! Help!
SAY_VICTORY1 = -1800006, //Let's get out of here before more wolves find us!
SAY_VICTORY2 = -1800007, //Don't go toward the light, Mr. Floppy!
SAY_VICTORY3 = -1800008, //Mr. Floppy, you're ok! Thank you so much for saving Mr. Floppy!
SAY_VICTORY4 = -1800009, //I think I see the camp! We're almost home, Mr. Floppy! Let's go!
TEXT_EMOTE_WP1 = -1800010, //Mr. Floppy revives
TEXT_EMOTE_AGGRO = -1800011, //The Ravenous Worg chomps down on Mr. Floppy
SAY_QUEST_ACCEPT = -1800012, //Are you ready, Mr. Floppy? Stay close to me and watch out for those wolves!
SAY_QUEST_COMPLETE = -1800013 //Thank you for helping me get back to the camp. Go tell Walter that I'm safe now!
};
//emily
struct npc_emilyAI : public npc_escortAI
{
npc_emilyAI(Creature* pCreature) : npc_escortAI(pCreature) { }
uint32 m_uiChatTimer;
uint64 RWORGGUID;
uint64 MrfloppyGUID;
Creature* Mrfloppy;
Creature* RWORG;
bool Completed;
void JustSummoned(Creature* pSummoned)
{
if (Creature* Mrfloppy = GetClosestCreatureWithEntry(m_creature, NPC_MRFLOPPY, 50.0f))
pSummoned->AI()->AttackStart(Mrfloppy);
else
pSummoned->AI()->AttackStart(m_creature->getVictim());
}
void WaypointReached(uint32 i)
{
Player* pPlayer = GetPlayerForEscort();
if (!pPlayer)
return;
switch (i)
{
case 9:
Mrfloppy = GetClosestCreatureWithEntry(m_creature, NPC_MRFLOPPY, 100.0f);
break;
case 10:
if (Mrfloppy)
{
DoScriptText(SAY_WORGHAGGRO1, m_creature);
m_creature->SummonCreature(NPC_HUNGRY_WORG,m_creature->GetPositionX()+5,m_creature->GetPositionY()+2,m_creature->GetPositionZ()+1,3.229f,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,120000);
}
break;
case 11:
Mrfloppy->GetMotionMaster()->MoveFollow(m_creature, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE);
break;
case 17:
Mrfloppy->GetMotionMaster()->MovePoint(0, m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ());
DoScriptText(SAY_WORGRAGGRO3, m_creature);
RWORG = m_creature->SummonCreature(NPC_RAVENOUS_WORG,m_creature->GetPositionX()+10,m_creature->GetPositionY()+8,m_creature->GetPositionZ()+2,3.229f,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,120000);
RWORG->setFaction(35);
break;
case 18:
if (Mrfloppy)
{
RWORG->GetMotionMaster()->MovePoint(0, Mrfloppy->GetPositionX(), Mrfloppy->GetPositionY(), Mrfloppy->GetPositionZ());
DoCast(Mrfloppy,SPELL_MRFLOPPY);
}
break;
case 19:
if (Mrfloppy->HasAura(SPELL_MRFLOPPY, 0))
Mrfloppy->EnterVehicle(RWORG);
break;
case 20:
if (Mrfloppy)
RWORG->HandleEmoteCommand(34);
break;
case 21:
if (Mrfloppy)
{
RWORG->Kill(Mrfloppy);
Mrfloppy->ExitVehicle();
RWORG->setFaction(14);
RWORG->GetMotionMaster()->MovePoint(0, RWORG->GetPositionX()+10,RWORG->GetPositionY()+80,RWORG->GetPositionZ());
DoScriptText(SAY_VICTORY2, m_creature);
}
break;
case 22:
if (Mrfloppy && Mrfloppy->isDead())
{
RWORG->DisappearAndDie();
m_creature->GetMotionMaster()->MovePoint(0, Mrfloppy->GetPositionX(), Mrfloppy->GetPositionY(), Mrfloppy->GetPositionZ());
Mrfloppy->setDeathState(ALIVE);
Mrfloppy->GetMotionMaster()->MoveFollow(m_creature, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE);
DoScriptText(SAY_VICTORY3, m_creature);
}
break;
case 24:
if (pPlayer)
{
Completed = true;
pPlayer->GroupEventHappens(QUEST_PERILOUS_ADVENTURE, m_creature);
DoScriptText(SAY_QUEST_COMPLETE, m_creature, pPlayer);
}
m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
break;
case 25:
DoScriptText(SAY_VICTORY4, m_creature);
break;
case 27:
m_creature->DisappearAndDie();
if (Mrfloppy)
Mrfloppy->DisappearAndDie();
break;
}
}
void EnterCombat(Unit* Who)
{
DoScriptText(SAY_RANDOMAGGRO, m_creature);
}
void Reset()
{
m_uiChatTimer = 4000;
Mrfloppy = NULL;
RWORG = NULL;
}
void UpdateAI(const uint32 uiDiff)
{
npc_escortAI::UpdateAI(uiDiff);
if (HasEscortState(STATE_ESCORT_ESCORTING))
{
if (m_uiChatTimer <= uiDiff)
{
m_uiChatTimer = 12000;
}
else
m_uiChatTimer -= uiDiff;
}
}
};
bool QuestAccept_npc_emily(Player* pPlayer, Creature* pCreature, Quest const* quest)
{
if (quest->GetQuestId() == QUEST_PERILOUS_ADVENTURE)
{
DoScriptText(SAY_QUEST_ACCEPT, pCreature);
if (Creature* Mrfloppy = GetClosestCreatureWithEntry(pCreature, NPC_MRFLOPPY, 180.0f))
{
Mrfloppy->GetMotionMaster()->MoveFollow(pCreature, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE);
}
if (npc_escortAI* pEscortAI = CAST_AI(npc_emilyAI, (pCreature->AI())))
pEscortAI->Start(true, false, pPlayer->GetGUID());
}
return true;
}
CreatureAI* GetAI_npc_emily(Creature* pCreature)
{
return new npc_emilyAI(pCreature);
}
//mrfloppy
struct npc_mrfloppyAI : public ScriptedAI
{
npc_mrfloppyAI(Creature *c) : ScriptedAI(c) {}
uint64 EmilyGUID;
uint64 RWORGGUID;
uint64 HWORGGUID;
Creature* HWORG;
Creature* RWORG;
Creature* Emily;
void Reset()
{
HWORG = NULL;
RWORG = NULL;
Emily = NULL;
}
void EnterCombat(Unit* Who)
{
if (Creature* Emily = GetClosestCreatureWithEntry(m_creature, NPC_EMILY, 50.0f))
{
switch(Who->GetEntry())
{
case NPC_HUNGRY_WORG:
DoScriptText(SAY_WORGHAGGRO2, Emily);
break;
case NPC_RAVENOUS_WORG:
DoScriptText(SAY_WORGRAGGRO4, Emily);
break;
default:
DoScriptText(SAY_RANDOMAGGRO, Emily);
}
}
}
void EnterEvadeMode() {}
void MoveInLineOfSight(Unit *who) {}
void UpdateAI(const uint32 diff)
{
if (!UpdateVictim())
return;
}
};
CreatureAI* GetAI_npc_mrfloppy(Creature* pCreature)
{
return new npc_mrfloppyAI(pCreature);
}
2009-08-14 21:58:29 +02:00
void AddSC_grizzly_hills()
{
Script* newscript;
2009-10-17 15:51:44 -07:00
2009-08-14 21:58:29 +02:00
newscript = new Script;
newscript->Name = "npc_orsonn_and_kodian";
newscript->pGossipHello = &GossipHello_npc_orsonn_and_kodian;
newscript->pGossipSelect = &GossipSelect_npc_orsonn_and_kodian;
newscript->RegisterSelf();
2010-02-19 00:20:14 +01:00
newscript = new Script;
newscript->Name = "npc_emily";
newscript->GetAI = &GetAI_npc_emily;
newscript->pQuestAccept = &QuestAccept_npc_emily;
newscript->RegisterSelf();
newscript = new Script;
newscript->Name = "npc_mrfloppy";
newscript->GetAI = &GetAI_npc_mrfloppy;
newscript->RegisterSelf();
2009-08-14 21:58:29 +02:00
}