Files
TCPlayerbotCore/src/server/scripts/Kalimdor/tanaris.cpp
T

638 lines
20 KiB
C++
Raw Normal View History

/*
* Copyright (C) 2008-2010 TrinityCore <http://www.trinitycore.org/>
* 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, see <http://www.gnu.org/licenses/>.
*/
2009-10-17 15:51:44 -07:00
/* ScriptData
SDName: Tanaris
SD%Complete: 80
2009-08-14 15:58:37 +02:00
SDComment: Quest support: 648, 1560, 2954, 4005, 10277, 10279(Special flight path). Noggenfogger vendor
SDCategory: Tanaris
EndScriptData */
2009-10-17 15:51:44 -07:00
/* ContentData
mob_aquementas
npc_custodian_of_time
npc_marin_noggenfogger
npc_steward_of_time
npc_stone_watcher_of_norgannon
2009-01-16 14:33:21 +01:00
npc_OOX17
2009-08-14 15:58:37 +02:00
npc_tooga
EndContentData */
2009-10-17 15:51:44 -07:00
#include "ScriptPCH.h"
2010-01-19 11:36:05 +01:00
#include "ScriptedEscortAI.h"
#include "ScriptedFollowerAI.h"
2009-10-17 15:51:44 -07:00
/*######
## mob_aquementas
######*/
2009-10-17 15:51:44 -07:00
#define AGGRO_YELL_AQUE -1000350
2009-10-17 15:51:44 -07:00
#define SPELL_AQUA_JET 13586
#define SPELL_FROST_SHOCK 15089
2009-10-17 15:51:44 -07:00
2010-02-05 00:31:28 +01:00
struct mob_aquementasAI : public ScriptedAI
{
mob_aquementasAI(Creature *c) : ScriptedAI(c) {}
2009-10-17 15:51:44 -07:00
uint32 SendItem_Timer;
uint32 SwitchFaction_Timer;
bool isFriendly;
2009-10-17 15:51:44 -07:00
uint32 FrostShock_Timer;
uint32 AquaJet_Timer;
2009-10-17 15:51:44 -07:00
void Reset()
{
SendItem_Timer = 0;
SwitchFaction_Timer = 10000;
2010-04-14 23:07:41 +02:00
me->setFaction(35);
isFriendly = true;
2009-10-17 15:51:44 -07:00
AquaJet_Timer = 5000;
FrostShock_Timer = 1000;
}
2009-10-17 15:51:44 -07:00
void SendItem(Unit* receiver)
{
2009-06-04 16:36:33 -05:00
if (CAST_PLR(receiver)->HasItemCount(11169,1,false) &&
CAST_PLR(receiver)->HasItemCount(11172,11,false) &&
CAST_PLR(receiver)->HasItemCount(11173,1,false) &&
!CAST_PLR(receiver)->HasItemCount(11522,1,true))
{
ItemPosCountVec dest;
2009-08-14 00:02:13 +02:00
uint8 msg = CAST_PLR(receiver)->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, 11522, 1, false);
if (msg == EQUIP_ERR_OK)
CAST_PLR(receiver)->StoreNewItem(dest, 11522, 1, true);
}
}
2009-10-17 15:51:44 -07:00
2009-04-27 21:23:42 -05:00
void EnterCombat(Unit* who)
{
2010-04-14 23:07:41 +02:00
DoScriptText(AGGRO_YELL_AQUE, me, who);
}
2009-10-17 15:51:44 -07:00
void UpdateAI(const uint32 diff)
{
2009-08-14 00:02:13 +02:00
if (isFriendly)
{
2009-10-27 21:28:20 -07:00
if (SwitchFaction_Timer <= diff)
{
2010-04-14 23:07:41 +02:00
me->setFaction(91);
isFriendly = false;
2009-10-27 21:28:20 -07:00
} else SwitchFaction_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
2009-08-14 00:02:13 +02:00
if (!isFriendly)
{
2009-10-27 21:28:20 -07:00
if (SendItem_Timer <= diff)
{
2010-04-14 23:07:41 +02:00
if (me->getVictim()->GetTypeId() == TYPEID_PLAYER)
SendItem(me->getVictim());
SendItem_Timer = 5000;
2009-10-27 21:28:20 -07:00
} else SendItem_Timer -= diff;
}
2009-10-17 15:51:44 -07:00
2009-10-27 21:28:20 -07:00
if (FrostShock_Timer <= diff)
{
2010-04-14 23:07:41 +02:00
DoCast(me->getVictim(), SPELL_FROST_SHOCK);
FrostShock_Timer = 15000;
2009-10-27 21:28:20 -07:00
} else FrostShock_Timer -= diff;
2009-10-17 15:51:44 -07:00
2009-10-27 21:28:20 -07:00
if (AquaJet_Timer <= diff)
{
2010-04-14 23:07:41 +02:00
DoCast(me, SPELL_AQUA_JET);
AquaJet_Timer = 15000;
2009-10-27 21:28:20 -07:00
} else AquaJet_Timer -= diff;
2009-10-17 15:51:44 -07:00
DoMeleeAttackIfReady();
}
};
2009-08-14 00:39:07 +02:00
CreatureAI* GetAI_mob_aquementas(Creature* pCreature)
{
2009-08-14 00:39:07 +02:00
return new mob_aquementasAI (pCreature);
}
2009-10-17 15:51:44 -07:00
/*######
## npc_custodian_of_time
######*/
2009-10-17 15:51:44 -07:00
#define WHISPER_CUSTODIAN_1 -1000217
#define WHISPER_CUSTODIAN_2 -1000218
#define WHISPER_CUSTODIAN_3 -1000219
#define WHISPER_CUSTODIAN_4 -1000220
#define WHISPER_CUSTODIAN_5 -1000221
#define WHISPER_CUSTODIAN_6 -1000222
#define WHISPER_CUSTODIAN_7 -1000223
#define WHISPER_CUSTODIAN_8 -1000224
#define WHISPER_CUSTODIAN_9 -1000225
#define WHISPER_CUSTODIAN_10 -1000226
#define WHISPER_CUSTODIAN_11 -1000227
#define WHISPER_CUSTODIAN_12 -1000228
#define WHISPER_CUSTODIAN_13 -1000229
#define WHISPER_CUSTODIAN_14 -1000230
2009-10-17 15:51:44 -07:00
2010-02-05 00:31:28 +01:00
struct npc_custodian_of_timeAI : public npc_escortAI
{
npc_custodian_of_timeAI(Creature *c) : npc_escortAI(c) {}
2009-10-17 15:51:44 -07:00
void WaypointReached(uint32 i)
{
2009-08-17 00:29:53 +02:00
Player *pPlayer = GetPlayerForEscort();
2009-08-14 00:02:13 +02:00
if (!pPlayer)
return;
2009-10-17 15:51:44 -07:00
2009-08-14 00:02:13 +02:00
switch(i)
{
2010-04-14 23:07:41 +02:00
case 0: DoScriptText(WHISPER_CUSTODIAN_1, me, pPlayer); break;
case 1: DoScriptText(WHISPER_CUSTODIAN_2, me, pPlayer); break;
case 2: DoScriptText(WHISPER_CUSTODIAN_3, me, pPlayer); break;
case 3: DoScriptText(WHISPER_CUSTODIAN_4, me, pPlayer); break;
case 5: DoScriptText(WHISPER_CUSTODIAN_5, me, pPlayer); break;
case 6: DoScriptText(WHISPER_CUSTODIAN_6, me, pPlayer); break;
case 7: DoScriptText(WHISPER_CUSTODIAN_7, me, pPlayer); break;
case 8: DoScriptText(WHISPER_CUSTODIAN_8, me, pPlayer); break;
case 9: DoScriptText(WHISPER_CUSTODIAN_9, me, pPlayer); break;
case 10: DoScriptText(WHISPER_CUSTODIAN_4, me, pPlayer); break;
case 13: DoScriptText(WHISPER_CUSTODIAN_10, me, pPlayer); break;
case 14: DoScriptText(WHISPER_CUSTODIAN_4, me, pPlayer); break;
case 16: DoScriptText(WHISPER_CUSTODIAN_11, me, pPlayer); break;
case 17: DoScriptText(WHISPER_CUSTODIAN_12, me, pPlayer); break;
case 18: DoScriptText(WHISPER_CUSTODIAN_4, me, pPlayer); break;
case 22: DoScriptText(WHISPER_CUSTODIAN_13, me, pPlayer); break;
case 23: DoScriptText(WHISPER_CUSTODIAN_4, me, pPlayer); break;
case 24:
2010-04-14 23:07:41 +02:00
DoScriptText(WHISPER_CUSTODIAN_14, me, pPlayer);
DoCast(pPlayer, 34883);
// below here is temporary workaround, to be removed when spell works properly
pPlayer->AreaExploredOrEventHappens(10277);
break;
}
}
2009-10-17 15:51:44 -07:00
void MoveInLineOfSight(Unit *who)
{
2009-10-11 18:03:59 +02:00
if (HasEscortState(STATE_ESCORT_ESCORTING))
return;
2009-10-17 15:51:44 -07:00
2009-08-14 00:02:13 +02:00
if (who->GetTypeId() == TYPEID_PLAYER)
{
2009-08-14 00:02:13 +02:00
if (who->HasAura(34877) && CAST_PLR(who)->GetQuestStatus(10277) == QUEST_STATUS_INCOMPLETE)
{
float Radius = 10.0;
2010-04-14 23:07:41 +02:00
if (me->IsWithinDistInMap(who, Radius))
{
2009-08-13 05:47:23 +02:00
Start(false, false, who->GetGUID());
}
}
}
}
2009-10-17 15:51:44 -07:00
2010-04-19 09:26:37 +02:00
void EnterCombat(Unit* /*who*/) {}
void Reset() { }
2009-10-17 15:51:44 -07:00
void UpdateAI(const uint32 diff)
{
npc_escortAI::UpdateAI(diff);
}
};
2009-10-17 15:51:44 -07:00
2009-04-09 23:07:32 +02:00
CreatureAI* GetAI_npc_custodian_of_time(Creature* pCreature)
{
2009-08-16 02:12:14 +02:00
return new npc_custodian_of_timeAI(pCreature);
}
2009-10-17 15:51:44 -07:00
/*######
## npc_marin_noggenfogger
######*/
2009-10-17 15:51:44 -07:00
2009-08-14 00:39:07 +02:00
bool GossipHello_npc_marin_noggenfogger(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:39:07 +02:00
if (pCreature->isVendor() && pPlayer->GetQuestRewardStatus(2662))
2009-08-14 00:02:13 +02:00
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE);
2009-10-17 15:51:44 -07:00
pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID());
2009-10-17 15:51:44 -07:00
return true;
}
2009-10-17 15:51:44 -07:00
2010-04-19 09:26:37 +02:00
bool GossipSelect_npc_marin_noggenfogger(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction)
{
2009-08-15 00:32:04 +02:00
if (uiAction == GOSSIP_ACTION_TRADE)
2009-08-14 00:39:07 +02:00
pPlayer->SEND_VENDORLIST(pCreature->GetGUID());
2009-10-17 15:51:44 -07:00
return true;
}
2009-10-17 15:51:44 -07:00
/*######
## npc_steward_of_time
######*/
2009-10-17 15:51:44 -07:00
#define GOSSIP_ITEM_FLIGHT "Please take me to the master's lair."
2009-10-17 15:51:44 -07:00
2009-08-14 00:39:07 +02:00
bool GossipHello_npc_steward_of_time(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(10279) == QUEST_STATUS_INCOMPLETE || pPlayer->GetQuestRewardStatus(10279))
{
2009-08-14 00:02:13 +02:00
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_FLIGHT, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
2009-08-14 00:39:07 +02:00
pPlayer->SEND_GOSSIP_MENU(9978, pCreature->GetGUID());
}
else
2009-08-14 00:39:07 +02:00
pPlayer->SEND_GOSSIP_MENU(9977, pCreature->GetGUID());
2009-10-17 15:51:44 -07:00
return true;
}
2009-10-17 15:51:44 -07:00
2010-04-19 09:26:37 +02:00
bool QuestAccept_npc_steward_of_time(Player* pPlayer, Creature* /*pCreature*/, Quest const *quest)
{
2009-08-14 00:02:13 +02:00
if (quest->GetQuestId() == 10279) //Quest: To The Master's Lair
pPlayer->CastSpell(pPlayer,34891,true); //(Flight through Caverns)
2009-10-17 15:51:44 -07:00
return false;
}
2009-10-17 15:51:44 -07:00
2010-04-19 09:26:37 +02:00
bool GossipSelect_npc_steward_of_time(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-14 00:02:13 +02:00
pPlayer->CastSpell(pPlayer,34891,true); //(Flight through Caverns)
2009-10-17 15:51:44 -07:00
return true;
}
2009-10-17 15:51:44 -07:00
/*######
## npc_stone_watcher_of_norgannon
######*/
2009-10-17 15:51:44 -07:00
#define GOSSIP_ITEM_NORGANNON_1 "What function do you serve?"
#define GOSSIP_ITEM_NORGANNON_2 "What are the Plates of Uldum?"
#define GOSSIP_ITEM_NORGANNON_3 "Where are the Plates of Uldum?"
#define GOSSIP_ITEM_NORGANNON_4 "Excuse me? We've been \"reschedueled for visitations\"? What does that mean?!"
#define GOSSIP_ITEM_NORGANNON_5 "So, what's inside Uldum?"
#define GOSSIP_ITEM_NORGANNON_6 "I will return when i have the Plates of Uldum."
2009-10-17 15:51:44 -07:00
2009-08-14 00:39:07 +02:00
bool GossipHello_npc_stone_watcher_of_norgannon(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(2954) == QUEST_STATUS_INCOMPLETE)
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_NORGANNON_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF);
2009-10-17 15:51:44 -07:00
2009-08-14 00:39:07 +02:00
pPlayer->SEND_GOSSIP_MENU(1674, pCreature->GetGUID());
2009-10-17 15:51:44 -07:00
return true;
}
2009-10-17 15:51:44 -07:00
2010-04-19 09:26:37 +02:00
bool GossipSelect_npc_stone_watcher_of_norgannon(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction)
{
2009-08-15 00:32:04 +02:00
switch (uiAction)
{
case GOSSIP_ACTION_INFO_DEF:
2009-08-14 00:02:13 +02:00
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_NORGANNON_2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
2009-08-14 00:39:07 +02:00
pPlayer->SEND_GOSSIP_MENU(1675, pCreature->GetGUID());
break;
case GOSSIP_ACTION_INFO_DEF+1:
2009-08-14 00:02:13 +02:00
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_NORGANNON_3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2);
2009-08-14 00:39:07 +02:00
pPlayer->SEND_GOSSIP_MENU(1676, pCreature->GetGUID());
break;
case GOSSIP_ACTION_INFO_DEF+2:
2009-08-14 00:02:13 +02:00
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_NORGANNON_4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3);
2009-08-14 00:39:07 +02:00
pPlayer->SEND_GOSSIP_MENU(1677, pCreature->GetGUID());
break;
case GOSSIP_ACTION_INFO_DEF+3:
2009-08-14 00:02:13 +02:00
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_NORGANNON_5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+4);
2009-08-14 00:39:07 +02:00
pPlayer->SEND_GOSSIP_MENU(1678, pCreature->GetGUID());
break;
case GOSSIP_ACTION_INFO_DEF+4:
2009-08-14 00:02:13 +02:00
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_NORGANNON_6, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5);
2009-08-14 00:39:07 +02:00
pPlayer->SEND_GOSSIP_MENU(1679, pCreature->GetGUID());
break;
case GOSSIP_ACTION_INFO_DEF+5:
2009-08-14 00:02:13 +02:00
pPlayer->CLOSE_GOSSIP_MENU();
pPlayer->AreaExploredOrEventHappens(2954);
break;
}
return true;
}
2009-10-17 15:51:44 -07:00
2009-01-16 14:33:21 +01:00
/*######
## npc_OOX17
######*/
2009-10-17 15:51:44 -07:00
enum e00X17
2009-08-17 02:06:52 +02:00
{
//texts are signed for 7806
2009-08-17 02:06:52 +02:00
SAY_OOX_START = -1000287,
SAY_OOX_AGGRO1 = -1000288,
SAY_OOX_AGGRO2 = -1000289,
SAY_OOX_AMBUSH = -1000290,
SAY_OOX17_AMBUSH_REPLY = -1000291,
SAY_OOX_END = -1000292,
2009-10-17 15:51:44 -07:00
2009-08-17 02:06:52 +02:00
Q_OOX17 = 648,
SPAWN_FIRST = 7803,
SPAWN_SECOND_1 = 5617,
SPAWN_SECOND_2 = 7805
};
2009-10-17 15:51:44 -07:00
2010-02-05 00:31:28 +01:00
struct npc_OOX17AI : public npc_escortAI
2009-01-16 14:33:21 +01:00
{
npc_OOX17AI(Creature *c) : npc_escortAI(c) {}
2009-10-17 15:51:44 -07:00
2009-01-16 14:33:21 +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-16 14:33:21 +01:00
return;
2009-10-17 15:51:44 -07:00
2009-01-16 14:33:21 +01:00
switch(i) {
2009-02-09 08:16:34 -05:00
case 23:
2010-04-14 23:07:41 +02:00
me->SummonCreature(SPAWN_FIRST, -8350.96, -4445.79, 10.10, 6.20, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000);
me->SummonCreature(SPAWN_FIRST, -8355.96, -4447.79, 10.10, 6.27, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000);
me->SummonCreature(SPAWN_FIRST, -8353.96, -4442.79, 10.10, 6.08, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000);
DoScriptText(SAY_OOX_AMBUSH, me);
2009-02-09 08:16:34 -05:00
break;
2009-10-17 15:51:44 -07:00
2009-01-16 14:33:21 +01:00
case 56:
2010-04-14 23:07:41 +02:00
me->SummonCreature(SPAWN_SECOND_1, -7510.07, -4795.50, 9.35, 6.06, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000);
me->SummonCreature(SPAWN_SECOND_2, -7515.07, -4797.50, 9.35, 6.22, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000);
me->SummonCreature(SPAWN_SECOND_2, -7518.07, -4792.50, 9.35, 6.22, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000);
DoScriptText(SAY_OOX_AMBUSH, me);
2009-08-14 00:02:13 +02:00
if (Unit* scoff = me->FindNearestCreature(SPAWN_SECOND_2, 30))
2009-08-17 02:06:52 +02:00
DoScriptText(SAY_OOX17_AMBUSH_REPLY, scoff);
2009-01-16 14:33:21 +01:00
break;
2009-10-17 15:51:44 -07:00
2009-01-16 14:33:21 +01:00
case 86:
2009-08-14 00:02:13 +02:00
if (pPlayer)
2009-01-16 14:33:21 +01:00
{
2010-04-14 23:07:41 +02:00
DoScriptText(SAY_OOX_END, me);
pPlayer->GroupEventHappens(Q_OOX17, me);
2009-01-16 14:33:21 +01:00
}
2009-02-09 08:16:34 -05:00
break;
2009-01-16 14:33:21 +01:00
}
}
2009-10-17 15:51:44 -07:00
2009-02-09 08:16:34 -05:00
void Reset(){}
2009-10-17 15:51:44 -07:00
2010-04-19 09:26:37 +02:00
void EnterCombat(Unit* /*who*/)
2009-01-16 14:33:21 +01:00
{
2010-04-14 23:07:41 +02:00
DoScriptText(RAND(SAY_OOX_AGGRO1,SAY_OOX_AGGRO2), me);
2009-01-16 14:33:21 +01:00
}
2009-10-17 15:51:44 -07:00
2009-02-09 08:16:34 -05:00
void JustSummoned(Creature* summoned)
2009-01-16 14:33:21 +01:00
{
2010-04-14 23:07:41 +02:00
summoned->AI()->AttackStart(me);
2009-01-16 14:33:21 +01:00
}
2009-08-14 05:32:39 +02:00
};
2009-10-17 15:51:44 -07:00
2009-08-14 04:21:52 +02:00
bool QuestAccept_npc_OOX17(Player* pPlayer, Creature* pCreature, Quest const* quest)
2009-01-16 14:33:21 +01:00
{
if (quest->GetQuestId() == Q_OOX17)
{
2009-08-14 04:21:52 +02:00
pCreature->setFaction(113);
pCreature->SetHealth(pCreature->GetMaxHealth());
pCreature->SetUInt32Value(UNIT_FIELD_BYTES_1,0);
pCreature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE);
2009-08-17 02:06:52 +02:00
DoScriptText(SAY_OOX_START, pCreature);
2009-10-17 15:51:44 -07:00
2009-08-14 04:21:52 +02:00
if (npc_escortAI* pEscortAI = CAST_AI(npc_OOX17AI, pCreature->AI()))
pEscortAI->Start(true, false, pPlayer->GetGUID());
2009-01-16 14:33:21 +01:00
}
return true;
}
2009-10-17 15:51:44 -07:00
2009-08-14 00:39:07 +02:00
CreatureAI* GetAI_npc_OOX17(Creature* pCreature)
2009-01-16 14:33:21 +01:00
{
2009-08-17 00:29:53 +02:00
return new npc_OOX17AI(pCreature);
2009-01-16 14:33:21 +01:00
}
2009-10-17 15:51:44 -07:00
2009-08-14 15:58:37 +02:00
/*####
# npc_tooga
####*/
2009-10-17 15:51:44 -07:00
enum eTooga
2009-08-14 15:58:37 +02:00
{
SAY_TOOG_THIRST = -1000391,
SAY_TOOG_WORRIED = -1000392,
SAY_TOOG_POST_1 = -1000393,
SAY_TORT_POST_2 = -1000394,
SAY_TOOG_POST_3 = -1000395,
SAY_TORT_POST_4 = -1000396,
SAY_TOOG_POST_5 = -1000397,
SAY_TORT_POST_6 = -1000398,
2009-10-17 15:51:44 -07:00
2009-08-14 15:58:37 +02:00
QUEST_TOOGA = 1560,
NPC_TORTA = 6015,
2009-10-17 15:51:44 -07:00
2009-08-14 15:58:37 +02:00
POINT_ID_TO_WATER = 1,
FACTION_TOOG_ESCORTEE = 113
};
2009-10-17 15:51:44 -07:00
2009-08-14 15:58:37 +02:00
const float m_afToWaterLoc[] = {-7032.664551, -4906.199219, -1.606446};
2009-10-17 15:51:44 -07:00
2010-02-05 00:31:28 +01:00
struct npc_toogaAI : public FollowerAI
2009-08-14 15:58:37 +02:00
{
2009-08-20 02:24:53 +02:00
npc_toogaAI(Creature* pCreature) : FollowerAI(pCreature) { }
2009-10-17 15:51:44 -07:00
2009-08-20 02:24:53 +02:00
uint32 m_uiCheckSpeechTimer;
2009-08-14 15:58:37 +02:00
uint32 m_uiPostEventTimer;
uint32 m_uiPhasePostEvent;
2009-10-17 15:51:44 -07:00
uint64 TortaGUID;
2009-10-17 15:51:44 -07:00
2009-08-14 15:58:37 +02:00
void Reset()
{
2009-08-20 02:24:53 +02:00
m_uiCheckSpeechTimer = 2500;
m_uiPostEventTimer = 1000;
2009-08-14 15:58:37 +02:00
m_uiPhasePostEvent = 0;
2009-10-17 15:51:44 -07:00
TortaGUID = 0;
2009-08-14 15:58:37 +02:00
}
2009-10-17 15:51:44 -07:00
2009-08-14 15:58:37 +02:00
void MoveInLineOfSight(Unit *pWho)
{
2009-08-20 02:24:53 +02:00
FollowerAI::MoveInLineOfSight(pWho);
2009-10-17 15:51:44 -07:00
2010-04-14 23:07:41 +02:00
if (!me->getVictim() && !HasFollowState(STATE_FOLLOW_COMPLETE | STATE_FOLLOW_POSTEVENT) && pWho->GetEntry() == NPC_TORTA)
2009-08-14 15:58:37 +02:00
{
2010-04-14 23:07:41 +02:00
if (me->IsWithinDistInMap(pWho, INTERACTION_DISTANCE))
2009-08-14 15:58:37 +02:00
{
2009-08-20 02:24:53 +02:00
if (Player* pPlayer = GetLeaderForFollower())
2009-08-14 15:58:37 +02:00
{
2009-08-20 02:24:53 +02:00
if (pPlayer->GetQuestStatus(QUEST_TOOGA) == QUEST_STATUS_INCOMPLETE)
2010-04-14 23:07:41 +02:00
pPlayer->GroupEventHappens(QUEST_TOOGA, me);
2009-08-14 15:58:37 +02:00
}
2009-10-17 15:51:44 -07:00
TortaGUID = pWho->GetGUID();
2009-08-20 02:24:53 +02:00
SetFollowComplete(true);
2009-08-14 15:58:37 +02:00
}
}
}
2009-10-17 15:51:44 -07:00
2009-08-20 02:24:53 +02:00
void MovementInform(uint32 uiMotionType, uint32 uiPointId)
2009-08-14 15:58:37 +02:00
{
2009-08-20 02:24:53 +02:00
FollowerAI::MovementInform(uiMotionType, uiPointId);
2009-10-17 15:51:44 -07:00
2009-08-20 02:24:53 +02:00
if (uiMotionType != POINT_MOTION_TYPE)
2009-08-14 15:58:37 +02:00
return;
2009-10-17 15:51:44 -07:00
2009-08-14 15:58:37 +02:00
if (uiPointId == POINT_ID_TO_WATER)
2009-08-20 02:24:53 +02:00
SetFollowComplete();
2009-08-14 15:58:37 +02:00
}
2009-10-17 15:51:44 -07:00
2009-08-20 02:24:53 +02:00
void UpdateFollowerAI(const uint32 uiDiff)
2009-08-14 15:58:37 +02:00
{
if (!UpdateVictim())
{
//we are doing the post-event, or...
2009-08-20 18:50:41 +02:00
if (HasFollowState(STATE_FOLLOW_POSTEVENT))
2009-08-14 15:58:37 +02:00
{
2009-10-27 21:28:20 -07:00
if (m_uiPostEventTimer <= uiDiff)
2009-08-14 15:58:37 +02:00
{
m_uiPostEventTimer = 5000;
2009-10-17 15:51:44 -07:00
2010-04-14 23:07:41 +02:00
Unit *pTorta = Unit::GetUnit(*me, TortaGUID);
2009-08-14 15:58:37 +02:00
if (!pTorta || !pTorta->isAlive())
{
2009-08-20 02:24:53 +02:00
//something happened, so just complete
SetFollowComplete();
2009-08-14 15:58:37 +02:00
return;
}
2009-10-17 15:51:44 -07:00
2009-08-14 15:58:37 +02:00
switch(m_uiPhasePostEvent)
{
case 1:
2010-04-14 23:07:41 +02:00
DoScriptText(SAY_TOOG_POST_1, me);
2009-08-14 15:58:37 +02:00
break;
case 2:
DoScriptText(SAY_TORT_POST_2, pTorta);
break;
case 3:
2010-04-14 23:07:41 +02:00
DoScriptText(SAY_TOOG_POST_3, me);
2009-08-14 15:58:37 +02:00
break;
case 4:
DoScriptText(SAY_TORT_POST_4, pTorta);
break;
case 5:
2010-04-14 23:07:41 +02:00
DoScriptText(SAY_TOOG_POST_5, me);
2009-08-14 15:58:37 +02:00
break;
case 6:
DoScriptText(SAY_TORT_POST_6, pTorta);
2010-04-14 23:07:41 +02:00
me->GetMotionMaster()->MovePoint(POINT_ID_TO_WATER, m_afToWaterLoc[0], m_afToWaterLoc[1], m_afToWaterLoc[2]);
2009-08-14 15:58:37 +02:00
break;
}
2009-10-17 15:51:44 -07:00
2009-08-14 15:58:37 +02:00
++m_uiPhasePostEvent;
}
else
m_uiPostEventTimer -= uiDiff;
}
2009-08-20 02:24:53 +02:00
//...we are doing regular speech check
2009-08-20 18:50:41 +02:00
else if (HasFollowState(STATE_FOLLOW_INPROGRESS))
2009-08-14 15:58:37 +02:00
{
2009-10-27 21:28:20 -07:00
if (m_uiCheckSpeechTimer <= uiDiff)
2009-08-14 15:58:37 +02:00
{
2009-08-20 02:24:53 +02:00
m_uiCheckSpeechTimer = 5000;
2009-10-17 15:51:44 -07:00
if (urand(0,9) > 8)
2010-04-14 23:07:41 +02:00
DoScriptText(RAND(SAY_TOOG_THIRST,SAY_TOOG_WORRIED), me);
2009-08-14 15:58:37 +02:00
}
else
2009-08-20 02:24:53 +02:00
m_uiCheckSpeechTimer -= uiDiff;
2009-08-14 15:58:37 +02:00
}
2009-10-17 15:51:44 -07:00
2009-08-14 15:58:37 +02:00
return;
}
2009-10-17 15:51:44 -07:00
2009-08-14 15:58:37 +02:00
DoMeleeAttackIfReady();
}
};
2009-10-17 15:51:44 -07:00
2009-08-14 15:58:37 +02:00
CreatureAI* GetAI_npc_tooga(Creature* pCreature)
{
return new npc_toogaAI(pCreature);
}
2009-10-17 15:51:44 -07:00
2009-08-14 15:58:37 +02:00
bool QuestAccept_npc_tooga(Player* pPlayer, Creature* pCreature, const Quest* pQuest)
{
if (pQuest->GetQuestId() == QUEST_TOOGA)
{
if (npc_toogaAI* pToogaAI = CAST_AI(npc_toogaAI, pCreature->AI()))
2009-08-20 02:24:53 +02:00
pToogaAI->StartFollow(pPlayer, FACTION_TOOG_ESCORTEE, pQuest);
2009-08-14 15:58:37 +02:00
}
2009-10-17 15:51:44 -07:00
2009-08-14 15:58:37 +02:00
return true;
}
2009-10-17 15:51:44 -07:00
void AddSC_tanaris()
{
Script *newscript;
2009-10-17 15:51:44 -07:00
newscript = new Script;
newscript->Name = "mob_aquementas";
newscript->GetAI = &GetAI_mob_aquementas;
newscript->RegisterSelf();
2009-10-17 15:51:44 -07:00
newscript = new Script;
newscript->Name = "npc_custodian_of_time";
newscript->GetAI = &GetAI_npc_custodian_of_time;
newscript->RegisterSelf();
2009-10-17 15:51:44 -07:00
newscript = new Script;
newscript->Name = "npc_marin_noggenfogger";
newscript->pGossipHello = &GossipHello_npc_marin_noggenfogger;
newscript->pGossipSelect = &GossipSelect_npc_marin_noggenfogger;
newscript->RegisterSelf();
2009-10-17 15:51:44 -07:00
newscript = new Script;
newscript->Name = "npc_steward_of_time";
newscript->pGossipHello = &GossipHello_npc_steward_of_time;
newscript->pGossipSelect = &GossipSelect_npc_steward_of_time;
newscript->pQuestAccept = &QuestAccept_npc_steward_of_time;
newscript->RegisterSelf();
2009-10-17 15:51:44 -07:00
newscript = new Script;
newscript->Name = "npc_stone_watcher_of_norgannon";
newscript->pGossipHello = &GossipHello_npc_stone_watcher_of_norgannon;
newscript->pGossipSelect = &GossipSelect_npc_stone_watcher_of_norgannon;
2009-01-16 14:33:21 +01:00
newscript->RegisterSelf();
2009-10-17 15:51:44 -07:00
2009-02-09 08:16:34 -05:00
newscript = new Script;
2009-01-16 14:33:21 +01:00
newscript->Name = "npc_OOX17";
newscript->GetAI = &GetAI_npc_OOX17;
newscript->pQuestAccept = &QuestAccept_npc_OOX17;
newscript->RegisterSelf();
2009-10-17 15:51:44 -07:00
2009-08-14 15:58:37 +02:00
newscript = new Script;
newscript->Name = "npc_tooga";
newscript->GetAI = &GetAI_npc_tooga;
newscript->pQuestAccept = &QuestAccept_npc_tooga;
newscript->RegisterSelf();
}
2009-02-17 20:07:49 -06:00