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

702 lines
22 KiB
C++
Raw Normal View History

2009-02-17 18:08:26 +01: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
/* ScriptData
SDName: The_Barrens
SD%Complete: 90
SDComment: Quest support: 863, 898, 1719, 2458, 4921, 6981,
SDCategory: Barrens
EndScriptData */
2009-10-17 15:51:44 -07:00
/* ContentData
npc_beaten_corpse
2009-08-14 05:32:39 +02:00
npc_gilthares
npc_sputtervalve
2009-01-22 22:05:51 +01:00
npc_taskmaster_fizzule
2009-01-10 21:16:05 +01:00
npc_twiggy_flathead
npc_wizzlecrank_shredder
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
/*######
## npc_beaten_corpse
######*/
2009-10-17 15:51:44 -07:00
2009-01-22 21:20:21 +01:00
#define GOSSIP_CORPSE "Examine corpse in detail..."
2009-10-17 15:51:44 -07:00
2009-10-17 07:42:48 -07:00
enum eQuests
2009-08-13 05:47:23 +02:00
{
QUEST_LOST_IN_BATTLE = 4921
};
2009-10-17 15:51:44 -07:00
2009-08-13 05:47:23 +02:00
bool GossipHello_npc_beaten_corpse(Player* pPlayer, Creature* pCreature)
{
2009-08-14 00:02:13 +02:00
if (pPlayer->GetQuestStatus(QUEST_LOST_IN_BATTLE) == QUEST_STATUS_INCOMPLETE || pPlayer->GetQuestStatus(QUEST_LOST_IN_BATTLE) == QUEST_STATUS_COMPLETE)
2009-08-13 05:47:23 +02:00
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_CORPSE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
2009-10-17 15:51:44 -07:00
2009-08-13 05:47:23 +02:00
pPlayer->SEND_GOSSIP_MENU(3557, pCreature->GetGUID());
return true;
}
2009-10-17 15:51:44 -07:00
2009-08-15 00:32:04 +02:00
bool GossipSelect_npc_beaten_corpse(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction)
{
2009-08-15 00:32:04 +02:00
if (uiAction == GOSSIP_ACTION_INFO_DEF +1)
{
2009-08-13 05:47:23 +02:00
pPlayer->SEND_GOSSIP_MENU(3558, pCreature->GetGUID());
pPlayer->TalkedToCreature(pCreature->GetEntry(), pCreature->GetGUID());
}
return true;
}
2009-10-17 15:51:44 -07:00
2009-08-14 05:32:39 +02:00
/*######
# npc_gilthares
######*/
2009-10-17 15:51:44 -07:00
2009-10-17 07:42:48 -07:00
enum eGilthares
2009-08-14 05:32:39 +02:00
{
SAY_GIL_START = -1000370,
SAY_GIL_AT_LAST = -1000371,
SAY_GIL_PROCEED = -1000372,
SAY_GIL_FREEBOOTERS = -1000373,
SAY_GIL_AGGRO_1 = -1000374,
SAY_GIL_AGGRO_2 = -1000375,
SAY_GIL_AGGRO_3 = -1000376,
SAY_GIL_AGGRO_4 = -1000377,
SAY_GIL_ALMOST = -1000378,
SAY_GIL_SWEET = -1000379,
SAY_GIL_FREED = -1000380,
2009-10-17 15:51:44 -07:00
2009-08-14 05:32:39 +02:00
QUEST_FREE_FROM_HOLD = 898,
AREA_MERCHANT_COAST = 391,
FACTION_ESCORTEE = 232 //guessed, possible not needed for this quest
};
2009-10-17 15:51:44 -07:00
2010-02-05 00:31:28 +01:00
struct npc_giltharesAI : public npc_escortAI
2009-08-14 05:32:39 +02:00
{
npc_giltharesAI(Creature* pCreature) : npc_escortAI(pCreature) { }
2009-10-17 15:51:44 -07:00
2009-08-14 05:32:39 +02:00
void Reset() { }
2009-10-17 15:51:44 -07:00
2009-08-14 05:32:39 +02:00
void WaypointReached(uint32 uiPointId)
{
2009-08-17 00:29:53 +02:00
Player* pPlayer = GetPlayerForEscort();
2009-10-17 15:51:44 -07:00
2009-08-14 05:32:39 +02:00
if (!pPlayer)
return;
2009-10-17 15:51:44 -07:00
2009-08-14 05:32:39 +02:00
switch(uiPointId)
{
case 16:
DoScriptText(SAY_GIL_AT_LAST, m_creature, pPlayer);
break;
case 17:
DoScriptText(SAY_GIL_PROCEED, m_creature, pPlayer);
break;
case 18:
DoScriptText(SAY_GIL_FREEBOOTERS, m_creature, pPlayer);
break;
case 37:
DoScriptText(SAY_GIL_ALMOST, m_creature, pPlayer);
break;
case 47:
DoScriptText(SAY_GIL_SWEET, m_creature, pPlayer);
break;
case 53:
DoScriptText(SAY_GIL_FREED, m_creature, pPlayer);
pPlayer->GroupEventHappens(QUEST_FREE_FROM_HOLD, m_creature);
break;
}
}
2009-10-17 15:51:44 -07:00
2009-08-14 05:32:39 +02:00
void Aggro(Unit* pWho)
{
//not always use
if (rand()%4)
return;
2009-10-17 15:51:44 -07:00
2009-08-14 05:32:39 +02:00
//only aggro text if not player and only in this area
if (pWho->GetTypeId() != TYPEID_PLAYER && m_creature->GetAreaId() == AREA_MERCHANT_COAST)
{
//appears to be pretty much random (possible only if escorter not in combat with pWho yet?)
2009-10-17 06:56:45 -07:00
DoScriptText(RAND(SAY_GIL_AGGRO_1, SAY_GIL_AGGRO_2, SAY_GIL_AGGRO_3, SAY_GIL_AGGRO_4), m_creature, pWho);
2009-08-14 05:32:39 +02:00
}
}
};
2009-10-17 15:51:44 -07:00
2009-08-14 05:32:39 +02:00
CreatureAI* GetAI_npc_gilthares(Creature* pCreature)
{
2009-08-16 02:12:14 +02:00
return new npc_giltharesAI(pCreature);
2009-08-14 05:32:39 +02:00
}
2009-10-17 15:51:44 -07:00
2009-08-14 05:32:39 +02:00
bool QuestAccept_npc_gilthares(Player* pPlayer, Creature* pCreature, const Quest* pQuest)
{
if (pQuest->GetQuestId() == QUEST_FREE_FROM_HOLD)
{
pCreature->setFaction(FACTION_ESCORTEE);
pCreature->SetStandState(UNIT_STAND_STATE_STAND);
2009-10-17 15:51:44 -07:00
2009-08-14 05:32:39 +02:00
DoScriptText(SAY_GIL_START, pCreature, pPlayer);
2009-10-17 15:51:44 -07:00
2009-08-14 05:32:39 +02:00
if (npc_giltharesAI* pEscortAI = CAST_AI(npc_giltharesAI, pCreature->AI()))
pEscortAI->Start(false, false, pPlayer->GetGUID(), pQuest);
}
return true;
}
2009-10-17 15:51:44 -07:00
/*######
## npc_sputtervalve
######*/
2009-10-17 15:51:44 -07:00
2009-01-22 21:20:21 +01:00
#define GOSSIP_SPUTTERVALVE "Can you tell me about this shard?"
2009-10-17 15:51:44 -07:00
2009-08-14 00:39:07 +02:00
bool GossipHello_npc_sputtervalve(Player* pPlayer, Creature* pCreature)
{
2009-08-14 00:39:07 +02:00
if (pCreature->isQuestGiver())
pPlayer->PrepareQuestMenu(pCreature->GetGUID());
2009-10-17 15:51:44 -07:00
2009-08-14 00:02:13 +02:00
if (pPlayer->GetQuestStatus(6981) == QUEST_STATUS_INCOMPLETE)
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SPUTTERVALVE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF);
2009-10-17 15:51:44 -07:00
pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID());
return true;
}
2009-10-17 15:51:44 -07:00
2009-08-15 00:32:04 +02:00
bool GossipSelect_npc_sputtervalve(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction)
{
2009-08-15 00:32:04 +02:00
if (uiAction == GOSSIP_ACTION_INFO_DEF)
{
2009-08-14 00:39:07 +02:00
pPlayer->SEND_GOSSIP_MENU(2013, pCreature->GetGUID());
2009-08-14 00:02:13 +02:00
pPlayer->AreaExploredOrEventHappens(6981);
}
return true;
}
2009-10-17 15:51:44 -07:00
/*######
## npc_taskmaster_fizzule
######*/
2009-10-17 15:51:44 -07:00
2009-10-17 07:42:48 -07:00
enum eEnums
2009-03-22 23:11:55 +01:00
{
FACTION_FRIENDLY_F = 35,
SPELL_FLARE = 10113,
SPELL_FOLLY = 10137,
};
2009-10-17 15:51:44 -07:00
2010-02-05 00:31:28 +01:00
struct npc_taskmaster_fizzuleAI : public ScriptedAI
{
2009-03-22 23:11:55 +01:00
npc_taskmaster_fizzuleAI(Creature* c) : ScriptedAI(c)
{
factionNorm = c->getFaction();
}
2009-10-17 15:51:44 -07:00
2009-03-22 23:11:55 +01:00
uint32 factionNorm;
bool IsFriend;
uint32 Reset_Timer;
2009-03-22 23:11:55 +01:00
uint8 FlareCount;
2009-10-17 15:51:44 -07:00
void Reset()
{
IsFriend = false;
Reset_Timer = 120000;
FlareCount = 0;
2009-03-22 23:11:55 +01:00
m_creature->setFaction(factionNorm);
}
2009-10-17 15:51:44 -07:00
2009-03-22 23:11:55 +01:00
void DoFriend()
{
m_creature->RemoveAllAuras();
m_creature->DeleteThreatList();
2009-06-17 03:35:23 +02:00
m_creature->CombatStop(true);
2009-10-17 15:51:44 -07:00
2009-03-22 23:11:55 +01:00
m_creature->StopMoving();
m_creature->GetMotionMaster()->MoveIdle();
2009-10-17 15:51:44 -07:00
2009-03-22 23:11:55 +01:00
m_creature->setFaction(FACTION_FRIENDLY_F);
m_creature->HandleEmoteCommand(EMOTE_ONESHOT_SALUTE);
}
2009-10-17 15:51:44 -07:00
void SpellHit(Unit *caster, const SpellEntry *spell)
{
2009-03-22 23:11:55 +01:00
if (spell->Id == SPELL_FLARE || spell->Id == SPELL_FOLLY)
{
++FlareCount;
2009-10-17 15:51:44 -07:00
2009-03-22 23:11:55 +01:00
if (FlareCount >= 2)
IsFriend = true;
}
}
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
void UpdateAI(const uint32 diff)
{
2009-03-22 23:11:55 +01:00
if (IsFriend)
{
2009-10-27 21:28:20 -07:00
if (Reset_Timer <= diff)
{
EnterEvadeMode();
2009-05-01 01:06:19 +02:00
return;
} else Reset_Timer -= diff;
}
2009-10-17 15:51:44 -07:00
2009-01-30 18:10:05 -06:00
if (!UpdateVictim())
return;
2009-10-17 15:51:44 -07:00
DoMeleeAttackIfReady();
}
2009-10-17 15:51:44 -07:00
2009-08-08 21:29:12 +02:00
void ReceiveEmote(Player* pPlayer, uint32 emote)
{
if (emote == TEXTEMOTE_SALUTE)
{
if (FlareCount >= 2)
{
if (m_creature->getFaction() == FACTION_FRIENDLY_F)
return;
2009-10-17 15:51:44 -07:00
2009-06-15 02:52:06 +02:00
DoFriend();
}
}
}
};
2009-10-17 15:51:44 -07:00
2009-03-22 23:11:55 +01:00
CreatureAI* GetAI_npc_taskmaster_fizzule(Creature* pCreature)
{
2009-03-22 23:11:55 +01:00
return new npc_taskmaster_fizzuleAI(pCreature);
}
2009-10-17 15:51:44 -07:00
/*#####
## npc_twiggy_flathead
#####*/
2009-10-17 15:51:44 -07:00
2009-11-28 17:09:14 +01:00
enum eTwiggyFlathead
{
NPC_BIG_WILL = 6238,
NPC_AFFRAY_CHALLENGER = 6240,
SAY_BIG_WILL_READY = -1000123,
SAY_TWIGGY_FLATHEAD_BEGIN = -1000124,
SAY_TWIGGY_FLATHEAD_FRAY = -1000125,
SAY_TWIGGY_FLATHEAD_DOWN = -1000126,
SAY_TWIGGY_FLATHEAD_OVER = -1000127,
};
2009-10-17 15:51:44 -07:00
float AffrayChallengerLoc[6][4]=
{
{-1683, -4326, 2.79, 0},
{-1682, -4329, 2.79, 0},
{-1683, -4330, 2.79, 0},
{-1680, -4334, 2.79, 1.49},
{-1674, -4326, 2.79, 3.49},
{-1677, -4334, 2.79, 1.66}
};
2009-10-17 15:51:44 -07:00
2010-02-05 00:31:28 +01:00
struct npc_twiggy_flatheadAI : public ScriptedAI
{
npc_twiggy_flatheadAI(Creature *c) : ScriptedAI(c) {}
2009-10-17 15:51:44 -07:00
bool EventInProgress;
bool EventGrate;
bool EventBigWill;
bool Challenger_down[6];
uint32 Wave;
uint32 Wave_Timer;
uint32 Challenger_checker;
uint64 PlayerGUID;
uint64 AffrayChallenger[6];
uint64 BigWill;
2009-10-17 15:51:44 -07:00
void Reset()
{
EventInProgress = false;
EventGrate = false;
EventBigWill = false;
Wave_Timer = 600000;
Challenger_checker = 0;
Wave = 0;
PlayerGUID = 0;
2009-10-17 15:51:44 -07:00
2009-10-17 16:20:24 -07:00
for (uint8 i = 0; i < 6; ++i)
2009-01-22 21:20:21 +01:00
{
AffrayChallenger[i] = 0;
Challenger_down[i] = false;
}
BigWill = 0;
}
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
void MoveInLineOfSight(Unit *who)
{
2009-08-14 00:02:13 +02:00
if (!who || (!who->isAlive())) return;
2009-10-17 15:51:44 -07:00
2009-06-04 16:36:33 -05:00
if (m_creature->IsWithinDistInMap(who, 10.0f) && (who->GetTypeId() == TYPEID_PLAYER) && CAST_PLR(who)->GetQuestStatus(1719) == QUEST_STATUS_INCOMPLETE && !EventInProgress)
{
PlayerGUID = who->GetGUID();
EventInProgress = true;
}
}
2009-10-17 15:51:44 -07:00
void KilledUnit(Unit *victim) { }
2009-10-17 15:51:44 -07:00
void UpdateAI(const uint32 diff)
{
if (EventInProgress) {
Player* pWarrior = NULL;
2009-10-17 15:51:44 -07:00
2009-08-14 00:02:13 +02:00
if (PlayerGUID)
pWarrior = Unit::GetPlayer(PlayerGUID);
2009-10-17 15:51:44 -07:00
2009-08-14 00:02:13 +02:00
if (!pWarrior)
return;
2009-10-17 15:51:44 -07:00
2009-08-14 00:02:13 +02:00
if (!pWarrior->isAlive() && pWarrior->GetQuestStatus(1719) == QUEST_STATUS_INCOMPLETE) {
EventInProgress = false;
2009-01-22 21:20:21 +01:00
DoScriptText(SAY_TWIGGY_FLATHEAD_DOWN, m_creature);
pWarrior->FailQuest(1719);
2009-10-17 15:51:44 -07:00
2009-10-17 16:20:24 -07:00
for (uint8 i = 0; i < 6; ++i)
2009-01-22 21:20:21 +01:00
{
if (AffrayChallenger[i])
2009-01-22 21:20:21 +01:00
{
Creature* pCreature = Unit::GetCreature((*m_creature), AffrayChallenger[i]);
2009-08-14 00:02:13 +02:00
if (pCreature) {
if (pCreature->isAlive())
2009-01-22 21:20:21 +01:00
{
pCreature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT);
pCreature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
pCreature->setDeathState(JUST_DIED);
}
}
}
AffrayChallenger[i] = 0;
Challenger_down[i] = false;
}
2009-10-17 15:51:44 -07:00
if (BigWill)
2009-01-22 21:20:21 +01:00
{
Creature* pCreature = Unit::GetCreature((*m_creature), BigWill);
2009-08-14 00:02:13 +02:00
if (pCreature) {
if (pCreature->isAlive()) {
pCreature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT);
pCreature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
pCreature->setDeathState(JUST_DIED);
}
}
}
BigWill = 0;
}
2009-10-17 15:51:44 -07:00
if (!EventGrate && EventInProgress)
2009-01-22 21:20:21 +01:00
{
float x,y,z;
pWarrior->GetPosition(x, y, z);
2009-10-17 15:51:44 -07:00
if (x >= -1684 && x <= -1674 && y >= -4334 && y <= -4324) {
pWarrior->AreaExploredOrEventHappens(1719);
2009-01-22 21:20:21 +01:00
DoScriptText(SAY_TWIGGY_FLATHEAD_BEGIN, m_creature);
2009-10-17 15:51:44 -07:00
2009-10-17 16:20:24 -07:00
for (uint8 i = 0; i < 6; ++i)
2009-01-22 21:20:21 +01:00
{
2009-11-28 17:09:14 +01:00
Creature* pCreature = m_creature->SummonCreature(NPC_AFFRAY_CHALLENGER, AffrayChallengerLoc[i][0], AffrayChallengerLoc[i][1], AffrayChallengerLoc[i][2], AffrayChallengerLoc[i][3], TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 600000);
2009-08-14 00:02:13 +02:00
if (!pCreature)
2008-10-21 14:31:24 -05:00
continue;
pCreature->setFaction(35);
pCreature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
pCreature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
2009-01-22 21:20:21 +01:00
pCreature->HandleEmoteCommand(EMOTE_ONESHOT_ROAR);
AffrayChallenger[i] = pCreature->GetGUID();
}
Wave_Timer = 5000;
Challenger_checker = 1000;
EventGrate = true;
}
}
else if (EventInProgress)
2009-01-22 21:20:21 +01:00
{
2009-10-27 21:28:20 -07:00
if (Challenger_checker <= diff)
2009-01-22 21:20:21 +01:00
{
2009-10-17 16:20:24 -07:00
for (uint8 i = 0; i < 6; ++i)
2009-01-22 21:20:21 +01:00
{
if (AffrayChallenger[i])
2009-01-22 21:20:21 +01:00
{
Creature* pCreature = Unit::GetCreature((*m_creature), AffrayChallenger[i]);
2009-08-14 00:02:13 +02:00
if ((!pCreature || (!pCreature->isAlive())) && !Challenger_down[i])
2009-01-22 21:20:21 +01:00
{
DoScriptText(SAY_TWIGGY_FLATHEAD_DOWN, m_creature);
Challenger_down[i] = true;
}
}
}
Challenger_checker = 1000;
} else Challenger_checker -= diff;
2009-10-17 15:51:44 -07:00
2009-10-27 21:28:20 -07:00
if (Wave_Timer <= diff)
2009-01-22 21:20:21 +01:00
{
if (AffrayChallenger[Wave] && Wave < 6 && !EventBigWill)
2009-01-22 21:20:21 +01:00
{
DoScriptText(SAY_TWIGGY_FLATHEAD_FRAY, m_creature);
Creature* pCreature = Unit::GetCreature((*m_creature), AffrayChallenger[Wave]);
2009-08-14 00:02:13 +02:00
if (pCreature && (pCreature->isAlive()))
2009-01-22 21:20:21 +01:00
{
pCreature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
pCreature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
2009-01-22 21:20:21 +01:00
pCreature->HandleEmoteCommand(EMOTE_ONESHOT_ROAR);
pCreature->setFaction(14);
2009-10-27 21:28:20 -07:00
pCreature->AI()->AttackStart(pWarrior);
2009-01-22 21:20:21 +01:00
++Wave;
Wave_Timer = 20000;
}
}
else if (Wave >= 6 && !EventBigWill) {
2009-11-28 17:09:14 +01:00
if (Creature* pCreature = m_creature->SummonCreature(NPC_BIG_WILL, -1722, -4341, 6.12, 6.26, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 480000))
2008-10-21 14:31:24 -05:00
{
BigWill = pCreature->GetGUID();
//pCreature->GetMotionMaster()->MovePoint(0, -1693, -4343, 4.32);
//pCreature->GetMotionMaster()->MovePoint(1, -1684, -4333, 2.78);
pCreature->GetMotionMaster()->MovePoint(2, -1682, -4329, 2.79);
2009-01-22 21:20:21 +01:00
pCreature->HandleEmoteCommand(EMOTE_STATE_READYUNARMED);
2008-10-21 14:31:24 -05:00
EventBigWill = true;
Wave_Timer = 1000;
}
}
else if (Wave >= 6 && EventBigWill && BigWill)
2009-01-22 21:20:21 +01:00
{
Creature* pCreature = Unit::GetCreature((*m_creature), BigWill);
if (!pCreature || !pCreature->isAlive())
2009-01-22 21:20:21 +01:00
{
DoScriptText(SAY_TWIGGY_FLATHEAD_OVER, m_creature);
EventInProgress = false;
EventBigWill = false;
EventGrate = false;
PlayerGUID = 0;
Wave = 0;
}
}
} else Wave_Timer -= diff;
}
}
}
};
2009-10-17 15:51:44 -07:00
2009-08-14 00:39:07 +02:00
CreatureAI* GetAI_npc_twiggy_flathead(Creature* pCreature)
{
2009-08-14 00:39:07 +02:00
return new npc_twiggy_flatheadAI (pCreature);
}
2009-10-17 15:51:44 -07:00
2009-01-10 21:16:05 +01:00
/*#####
2009-01-22 21:20:21 +01:00
## npc_wizzlecrank_shredder
2009-01-11 02:23:57 +01:00
#####*/
2009-10-17 15:51:44 -07:00
2009-10-17 07:42:48 -07:00
enum eEnums_Wizzlecrank
2009-05-19 23:48:48 +02:00
{
SAY_START = -1000298,
SAY_STARTUP1 = -1000299,
SAY_STARTUP2 = -1000300,
SAY_MERCENARY = -1000301,
SAY_PROGRESS_1 = -1000302,
SAY_PROGRESS_2 = -1000303,
SAY_PROGRESS_3 = -1000304,
SAY_END = -1000305,
2009-10-17 15:51:44 -07:00
2009-05-19 23:48:48 +02:00
QUEST_ESCAPE = 863,
FACTION_RATCHET = 637,
2009-08-17 00:29:53 +02:00
NPC_PILOT_WIZZ = 3451,
NPC_MERCENARY = 3282,
2009-05-19 23:48:48 +02:00
};
2009-10-17 15:51:44 -07:00
2010-02-05 00:31:28 +01:00
struct npc_wizzlecrank_shredderAI : public npc_escortAI
2009-01-10 21:16:05 +01:00
{
2009-08-17 00:29:53 +02:00
npc_wizzlecrank_shredderAI(Creature* pCreature) : npc_escortAI(pCreature)
{
m_bIsPostEvent = false;
m_uiPostEventTimer = 1000;
m_uiPostEventCount = 0;
}
2009-10-17 15:51:44 -07:00
2009-08-17 00:29:53 +02:00
bool m_bIsPostEvent;
uint32 m_uiPostEventTimer;
uint32 m_uiPostEventCount;
2009-10-17 15:51:44 -07:00
2009-08-17 00:29:53 +02:00
void Reset()
2009-02-09 08:16:34 -05:00
{
2009-10-11 18:03:59 +02:00
if (!HasEscortState(STATE_ESCORT_ESCORTING))
2009-08-17 00:29:53 +02:00
{
if (m_creature->getStandState() == UNIT_STAND_STATE_DEAD)
m_creature->SetStandState(UNIT_STAND_STATE_STAND);
2009-10-17 15:51:44 -07:00
2009-08-17 00:29:53 +02:00
m_bIsPostEvent = false;
m_uiPostEventTimer = 1000;
m_uiPostEventCount = 0;
}
}
2009-10-17 15:51:44 -07:00
2009-08-17 00:29:53 +02:00
void WaypointReached(uint32 uiPointId)
{
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-08-17 00:29:53 +02:00
switch(uiPointId)
2009-02-09 08:16:34 -05:00
{
2009-08-17 00:29:53 +02:00
case 0:
DoScriptText(SAY_STARTUP1, m_creature);
break;
case 9:
SetRun(false);
break;
case 17:
if (Creature* pTemp = m_creature->SummonCreature(NPC_MERCENARY, 1128.489f, -3037.611f, 92.701f, 1.472f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000))
2009-02-09 08:16:34 -05:00
{
2009-08-17 00:29:53 +02:00
DoScriptText(SAY_MERCENARY, pTemp);
m_creature->SummonCreature(NPC_MERCENARY, 1160.172f, -2980.168f, 97.313f, 3.690f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000);
2009-02-09 08:16:34 -05:00
}
2009-08-17 00:29:53 +02:00
break;
case 24:
m_bIsPostEvent = true;
2009-02-09 08:16:34 -05:00
break;
}
}
2009-10-17 15:51:44 -07:00
2009-08-17 00:29:53 +02:00
void WaypointStart(uint32 uiPointId)
2009-02-09 08:16:34 -05:00
{
2009-08-17 00:29:53 +02:00
Player* pPlayer = GetPlayerForEscort();
2009-10-17 15:51:44 -07:00
2009-08-17 00:29:53 +02:00
if (!pPlayer)
return;
2009-10-17 15:51:44 -07:00
2009-08-17 00:29:53 +02:00
switch(uiPointId)
2009-05-19 23:48:48 +02:00
{
2009-08-17 00:29:53 +02:00
case 9:
DoScriptText(SAY_STARTUP2, m_creature, pPlayer);
break;
case 18:
DoScriptText(SAY_PROGRESS_1, m_creature, pPlayer);
SetRun();
break;
2009-05-19 23:48:48 +02:00
}
2009-02-09 08:16:34 -05:00
}
2009-10-17 15:51:44 -07:00
2009-08-17 00:29:53 +02:00
void JustSummoned(Creature* pSummoned)
{
if (pSummoned->GetEntry() == NPC_PILOT_WIZZ)
m_creature->SetStandState(UNIT_STAND_STATE_DEAD);
2009-10-17 15:51:44 -07:00
2009-08-17 00:29:53 +02:00
if (pSummoned->GetEntry() == NPC_MERCENARY)
pSummoned->AI()->AttackStart(m_creature);
}
2009-10-17 15:51:44 -07:00
2009-08-17 00:29:53 +02:00
void UpdateEscortAI(const uint32 uiDiff)
{
if (!UpdateVictim())
{
if (m_bIsPostEvent)
{
2009-10-27 21:28:20 -07:00
if (m_uiPostEventTimer <= uiDiff)
2009-08-17 00:29:53 +02:00
{
switch(m_uiPostEventCount)
{
case 0:
DoScriptText(SAY_PROGRESS_2, m_creature);
break;
case 1:
DoScriptText(SAY_PROGRESS_3, m_creature);
break;
case 2:
DoScriptText(SAY_END, m_creature);
break;
case 3:
if (Player* pPlayer = GetPlayerForEscort())
{
pPlayer->GroupEventHappens(QUEST_ESCAPE, m_creature);
m_creature->SummonCreature(NPC_PILOT_WIZZ, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 180000);
}
break;
}
2009-10-17 15:51:44 -07:00
2009-08-17 00:29:53 +02:00
++m_uiPostEventCount;
m_uiPostEventTimer = 5000;
}
else
m_uiPostEventTimer -= uiDiff;
}
2009-10-17 15:51:44 -07:00
2009-08-17 00:29:53 +02:00
return;
}
2009-10-17 15:51:44 -07:00
2009-08-17 00:29:53 +02:00
DoMeleeAttackIfReady();
}
2009-01-10 21:16:05 +01:00
};
2009-10-17 15:51:44 -07:00
2009-08-14 04:21:52 +02:00
bool QuestAccept_npc_wizzlecrank_shredder(Player* pPlayer, Creature* pCreature, Quest const* quest)
2009-01-10 21:16:05 +01:00
{
if (quest->GetQuestId() == QUEST_ESCAPE)
{
2009-08-14 04:21:52 +02:00
pCreature->setFaction(FACTION_RATCHET);
if (npc_escortAI* pEscortAI = CAST_AI(npc_wizzlecrank_shredderAI, pCreature->AI()))
pEscortAI->Start(true, false, pPlayer->GetGUID());
2009-01-10 21:16:05 +01:00
}
return true;
}
2009-10-17 15:51:44 -07:00
2009-08-14 00:39:07 +02:00
CreatureAI* GetAI_npc_wizzlecrank_shredderAI(Creature* pCreature)
2009-01-10 21:16:05 +01:00
{
2009-08-17 00:29:53 +02:00
return new npc_wizzlecrank_shredderAI(pCreature);
2009-01-11 02:23:57 +01:00
}
2009-10-17 15:51:44 -07:00
void AddSC_the_barrens()
{
Script *newscript;
2009-10-17 15:51:44 -07:00
newscript = new Script;
newscript->Name = "npc_beaten_corpse";
newscript->pGossipHello = &GossipHello_npc_beaten_corpse;
newscript->pGossipSelect = &GossipSelect_npc_beaten_corpse;
newscript->RegisterSelf();
2009-10-17 15:51:44 -07:00
2009-08-14 05:32:39 +02:00
newscript = new Script;
newscript->Name = "npc_gilthares";
newscript->GetAI = &GetAI_npc_gilthares;
newscript->pQuestAccept = &QuestAccept_npc_gilthares;
newscript->RegisterSelf();
2009-10-17 15:51:44 -07:00
newscript = new Script;
newscript->Name = "npc_sputtervalve";
newscript->pGossipHello = &GossipHello_npc_sputtervalve;
newscript->pGossipSelect = &GossipSelect_npc_sputtervalve;
newscript->RegisterSelf();
2009-10-17 15:51:44 -07:00
newscript = new Script;
newscript->Name = "npc_taskmaster_fizzule";
newscript->GetAI = &GetAI_npc_taskmaster_fizzule;
newscript->RegisterSelf();
2009-10-17 15:51:44 -07:00
newscript = new Script;
newscript->Name = "npc_twiggy_flathead";
newscript->GetAI = &GetAI_npc_twiggy_flathead;
newscript->RegisterSelf();
2009-10-17 15:51:44 -07:00
2009-02-09 08:16:34 -05:00
newscript = new Script;
newscript->Name = "npc_wizzlecrank_shredder";
2009-02-09 08:16:34 -05:00
newscript->GetAI = &GetAI_npc_wizzlecrank_shredderAI;
newscript->pQuestAccept = &QuestAccept_npc_wizzlecrank_shredder;
newscript->RegisterSelf();
}
2009-02-17 20:07:49 -06:00