EverWrath/src/server/scripts/EasternKingdoms/zone_western_plaguelands.cpp

413 lines
15 KiB
C++

/*
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU GPL v2 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-GPL2
* Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
*/
/* ScriptData
SDName: Western_Plaguelands
SD%Complete: 90
SDComment: Quest support: 5097, 5098, 5216, 5219, 5222, 5225, 5229, 5231, 5233, 5235. To obtain Vitreous Focuser (could use more spesifics about gossip items)
SDCategory: Western Plaguelands
EndScriptData */
/* ContentData
npcs_dithers_and_arbington
npc_myranda_the_hag
npc_the_scourge_cauldron
npc_andorhal_tower
EndContentData */
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "ScriptedGossip.h"
#include "ScriptedEscortAI.h"
#include "Player.h"
#include "WorldSession.h"
/*######
## npcs_dithers_and_arbington
######*/
#define GOSSIP_HDA1 "What does the Felstone Field Cauldron need?"
#define GOSSIP_HDA2 "What does the Dalson's Tears Cauldron need?"
#define GOSSIP_HDA3 "What does the Writhing Haunt Cauldron need?"
#define GOSSIP_HDA4 "What does the Gahrron's Withering Cauldron need?"
#define GOSSIP_SDA1 "Thanks, i need a Vitreous Focuser"
class npcs_dithers_and_arbington : public CreatureScript
{
public:
npcs_dithers_and_arbington() : CreatureScript("npcs_dithers_and_arbington") { }
bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) override
{
ClearGossipMenuFor(player);
switch (action)
{
case GOSSIP_ACTION_TRADE:
player->GetSession()->SendListInventory(creature->GetGUID());
break;
case GOSSIP_ACTION_INFO_DEF+1:
AddGossipItemFor(player, GOSSIP_ICON_CHAT, GOSSIP_SDA1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5);
SendGossipMenuFor(player, 3980, creature->GetGUID());
break;
case GOSSIP_ACTION_INFO_DEF+2:
AddGossipItemFor(player, GOSSIP_ICON_CHAT, GOSSIP_SDA1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5);
SendGossipMenuFor(player, 3981, creature->GetGUID());
break;
case GOSSIP_ACTION_INFO_DEF+3:
AddGossipItemFor(player, GOSSIP_ICON_CHAT, GOSSIP_SDA1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5);
SendGossipMenuFor(player, 3982, creature->GetGUID());
break;
case GOSSIP_ACTION_INFO_DEF+4:
AddGossipItemFor(player, GOSSIP_ICON_CHAT, GOSSIP_SDA1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5);
SendGossipMenuFor(player, 3983, creature->GetGUID());
break;
case GOSSIP_ACTION_INFO_DEF+5:
CloseGossipMenuFor(player);
creature->CastSpell(player, 17529, false);
break;
}
return true;
}
bool OnGossipHello(Player* player, Creature* creature) override
{
if (creature->IsQuestGiver())
player->PrepareQuestMenu(creature->GetGUID());
if (creature->IsVendor())
AddGossipItemFor(player, GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE);
if (player->GetQuestRewardStatus(5237) || player->GetQuestRewardStatus(5238))
{
AddGossipItemFor(player, GOSSIP_ICON_CHAT, GOSSIP_HDA1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
AddGossipItemFor(player, GOSSIP_ICON_CHAT, GOSSIP_HDA2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2);
AddGossipItemFor(player, GOSSIP_ICON_CHAT, GOSSIP_HDA3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3);
AddGossipItemFor(player, GOSSIP_ICON_CHAT, GOSSIP_HDA4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4);
SendGossipMenuFor(player, 3985, creature->GetGUID());
}
else
SendGossipMenuFor(player, player->GetGossipTextId(creature), creature->GetGUID());
return true;
}
};
/*######
## npc_myranda_the_hag
######*/
enum Myranda
{
QUEST_FIND_MYRANDA = 5861,
QUEST_SUBTERFUGE = 5862,
QUEST_IN_DREAMS = 5944,
SPELL_SCARLET_ILLUSION = 17961
};
#define GOSSIP_ITEM_ILLUSION "I am ready for the illusion, Myranda."
class npc_myranda_the_hag : public CreatureScript
{
public:
npc_myranda_the_hag() : CreatureScript("npc_myranda_the_hag") { }
bool OnGossipSelect(Player* player, Creature* /*creature*/, uint32 /*sender*/, uint32 action) override
{
ClearGossipMenuFor(player);
if (action == GOSSIP_ACTION_INFO_DEF + 1)
{
CloseGossipMenuFor(player);
player->CastSpell(player, SPELL_SCARLET_ILLUSION, false);
}
return true;
}
bool OnGossipHello(Player* player, Creature* creature) override
{
if (creature->IsQuestGiver())
player->PrepareQuestMenu(creature->GetGUID());
if (player->GetQuestRewardStatus(QUEST_FIND_MYRANDA) &&
!player->GetQuestRewardStatus(QUEST_IN_DREAMS) && !player->HasAura(SPELL_SCARLET_ILLUSION))
{
AddGossipItemFor(player, GOSSIP_ICON_CHAT, GOSSIP_ITEM_ILLUSION, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
SendGossipMenuFor(player, 4773, creature->GetGUID());
return true;
}
else
SendGossipMenuFor(player, player->GetGossipTextId(creature), creature->GetGUID());
return true;
}
};
/*######
## npc_the_scourge_cauldron
######*/
class npc_the_scourge_cauldron : public CreatureScript
{
public:
npc_the_scourge_cauldron() : CreatureScript("npc_the_scourge_cauldron") { }
CreatureAI* GetAI(Creature* creature) const override
{
return new npc_the_scourge_cauldronAI(creature);
}
struct npc_the_scourge_cauldronAI : public ScriptedAI
{
npc_the_scourge_cauldronAI(Creature* creature) : ScriptedAI(creature) { }
void Reset() override { }
void EnterCombat(Unit* /*who*/) override { }
void DoDie()
{
//summoner dies here
Unit::DealDamage(me, me, me->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
//override any database `spawntimesecs` to prevent duplicated summons
uint32 rTime = me->GetRespawnDelay();
if (rTime < 600)
me->SetRespawnDelay(600);
}
void MoveInLineOfSight(Unit* who) override
{
if (!who)
return;
Player* player = who->ToPlayer();
if (!player)
return;
switch (me->GetAreaId())
{
case 199: //felstone
if (player->GetQuestStatus(5216) == QUEST_STATUS_INCOMPLETE ||
player->GetQuestStatus(5229) == QUEST_STATUS_INCOMPLETE)
{
me->SummonCreature(11075, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 600000);
DoDie();
}
break;
case 200: //dalson
if (player->GetQuestStatus(5219) == QUEST_STATUS_INCOMPLETE ||
player->GetQuestStatus(5231) == QUEST_STATUS_INCOMPLETE)
{
me->SummonCreature(11077, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 600000);
DoDie();
}
break;
case 201: //gahrron
if (player->GetQuestStatus(5225) == QUEST_STATUS_INCOMPLETE ||
player->GetQuestStatus(5235) == QUEST_STATUS_INCOMPLETE)
{
me->SummonCreature(11078, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 600000);
DoDie();
}
break;
case 202: //writhing
if (player->GetQuestStatus(5222) == QUEST_STATUS_INCOMPLETE ||
player->GetQuestStatus(5233) == QUEST_STATUS_INCOMPLETE)
{
me->SummonCreature(11076, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 600000);
DoDie();
}
break;
}
}
};
};
/*######
## npcs_andorhal_tower
######*/
enum AndorhalTower
{
GO_BEACON_TORCH = 176093
};
class npc_andorhal_tower : public CreatureScript
{
public:
npc_andorhal_tower() : CreatureScript("npc_andorhal_tower") { }
CreatureAI* GetAI(Creature* creature) const override
{
return new npc_andorhal_towerAI(creature);
}
struct npc_andorhal_towerAI : public ScriptedAI
{
npc_andorhal_towerAI(Creature* creature) : ScriptedAI(creature)
{
SetCombatMovement(false);
}
void MoveInLineOfSight(Unit* who) override
{
if (!who || who->GetTypeId() != TYPEID_PLAYER)
return;
if (me->FindNearestGameObject(GO_BEACON_TORCH, 10.0f))
if (Player* player = who->ToPlayer())
player->KilledMonsterCredit(me->GetEntry(), me->GetGUID());
}
};
};
/*######
## npc_anchorite_truuen
######*/
enum Truuen
{
NPC_GHOST_UTHER = 17233,
NPC_THEL_DANIS = 1854,
NPC_GHOUL = 1791, //ambush
QUEST_TOMB_LIGHTBRINGER = 9446,
SAY_WP_0 = 0, //Beware! We are attacked!
SAY_WP_1 = 1, //It must be the purity of the Mark of the Lightbringer that is drawing forth the Scourge to attack us. We must proceed with caution lest we be overwhelmed!
SAY_WP_2 = 2, //This land truly needs to be cleansed by the Light! Let us continue on to the tomb. It isn't far now...
SAY_WP_3 = 0, //Be welcome, friends!
SAY_WP_4 = 0, //Thank you for coming here in remembrance of me. Your efforts in recovering that symbol, while unnecessary, are certainly touching to an old man's heart.
SAY_WP_5 = 1, //Please, rise my friend. Keep the Blessing as a symbol of the strength of the Light and how heroes long gone might once again rise in each of us to inspire.
SAY_WP_6 = 2 //Thank you my friend for making this possible. This is a day that I shall never forget! I think I will stay a while. Please return to High Priestess MacDonnell at the camp. I know that she'll be keenly interested to know of what has transpired here.
};
class npc_anchorite_truuen : public CreatureScript
{
public:
npc_anchorite_truuen() : CreatureScript("npc_anchorite_truuen") { }
bool OnQuestAccept(Player* player, Creature* creature, Quest const* quest) override
{
npc_escortAI* pEscortAI = CAST_AI(npc_anchorite_truuen::npc_anchorite_truuenAI, creature->AI());
if (quest->GetQuestId() == QUEST_TOMB_LIGHTBRINGER)
pEscortAI->Start(true, true, player->GetGUID());
return false;
}
CreatureAI* GetAI(Creature* creature) const override
{
return new npc_anchorite_truuenAI(creature);
}
struct npc_anchorite_truuenAI : public npc_escortAI
{
npc_anchorite_truuenAI(Creature* creature) : npc_escortAI(creature) { }
uint32 m_uiChatTimer;
uint64 UghostGUID;
uint64 TheldanisGUID;
Creature* Ughost;
Creature* Theldanis;
void Reset() override
{
m_uiChatTimer = 7000;
}
void JustSummoned(Creature* summoned) override
{
if (summoned->GetEntry() == NPC_GHOUL)
summoned->AI()->AttackStart(me);
}
void WaypointReached(uint32 waypointId) override
{
Player* player = GetPlayerForEscort();
switch (waypointId)
{
case 8:
Talk(SAY_WP_0);
me->SummonCreature(NPC_GHOUL, me->GetPositionX() + 7.0f, me->GetPositionY() + 7.0f, me->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 90000);
me->SummonCreature(NPC_GHOUL, me->GetPositionX() + 5.0f, me->GetPositionY() + 5.0f, me->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 90000);
break;
case 9:
Talk(SAY_WP_1);
break;
case 14:
me->SummonCreature(NPC_GHOUL, me->GetPositionX() + 7.0f, me->GetPositionY() + 7.0f, me->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 90000);
me->SummonCreature(NPC_GHOUL, me->GetPositionX() + 5.0f, me->GetPositionY() + 5.0f, me->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 90000);
me->SummonCreature(NPC_GHOUL, me->GetPositionX() + 10.0f, me->GetPositionY() + 10.0f, me->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 90000);
me->SummonCreature(NPC_GHOUL, me->GetPositionX() + 8.0f, me->GetPositionY() + 8.0f, me->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 90000);
break;
case 15:
Talk(SAY_WP_2);
break;
case 21:
Theldanis = GetClosestCreatureWithEntry(me, NPC_THEL_DANIS, 150);
if (Theldanis)
Theldanis->AI()->Talk(SAY_WP_3);
break;
case 23:
Ughost = me->SummonCreature(NPC_GHOST_UTHER, 971.86f, -1825.42f, 81.99f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000);
if (Ughost)
{
Ughost->SetDisableGravity(true);
Ughost->AI()->Talk(SAY_WP_4, me);
}
m_uiChatTimer = 4000;
break;
case 24:
if (Ughost)
Ughost->AI()->Talk(SAY_WP_5, me);
m_uiChatTimer = 4000;
break;
case 25:
if (Ughost)
Ughost->AI()->Talk(SAY_WP_6, me);
m_uiChatTimer = 4000;
break;
case 26:
if (player)
player->GroupEventHappens(QUEST_TOMB_LIGHTBRINGER, me);
break;
}
}
void EnterCombat(Unit* /*who*/) override { }
void JustDied(Unit* /*killer*/) override
{
if (Player* player = GetPlayerForEscort())
player->FailQuest(QUEST_TOMB_LIGHTBRINGER);
}
void UpdateAI(uint32 uiDiff) override
{
npc_escortAI::UpdateAI(uiDiff);
DoMeleeAttackIfReady();
if (HasEscortState(STATE_ESCORT_ESCORTING))
m_uiChatTimer = 6000;
}
};
};
/*######
##
######*/
void AddSC_western_plaguelands()
{
new npcs_dithers_and_arbington();
new npc_myranda_the_hag();
new npc_the_scourge_cauldron();
new npc_andorhal_tower();
new npc_anchorite_truuen();
}