EverWrath/src/server/scripts/Kalimdor/zone_stonetalon_mountains.cpp
Winfidonarleyan eb1ecc38a5
feat(Core/Scripting): move all script objects to separated files (#17860)
* feat(Core/Scripts): move all script objects to separated files

* Apply 5bfeabde81

* try gcc build

* again
2023-12-02 21:13:20 +01:00

175 lines
5.4 KiB
C++

/*
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by the
* Free Software Foundation; either version 3 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 Affero 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/>.
*/
/* ScriptData
SDName: Stonetalon_Mountains
SD%Complete: 95
SDComment: Quest support: 6627, 6523
SDCategory: Stonetalon Mountains
EndScriptData */
/* ContentData
npc_braug_dimspirit
npc_kaya_flathoof
EndContentData */
#include "CreatureScript.h"
#include "Player.h"
#include "ScriptedCreature.h"
#include "ScriptedEscortAI.h"
#include "ScriptedGossip.h"
/*######
## npc_braug_dimspirit
######*/
#define GOSSIP_HBD1 "Ysera"
#define GOSSIP_HBD2 "Neltharion"
#define GOSSIP_HBD3 "Nozdormu"
#define GOSSIP_HBD4 "Alexstrasza"
#define GOSSIP_HBD5 "Malygos"
class npc_braug_dimspirit : public CreatureScript
{
public:
npc_braug_dimspirit() : CreatureScript("npc_braug_dimspirit") { }
bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) override
{
ClearGossipMenuFor(player);
if (action == GOSSIP_ACTION_INFO_DEF + 1)
{
CloseGossipMenuFor(player);
creature->CastSpell(player, 6766, false);
}
if (action == GOSSIP_ACTION_INFO_DEF + 2)
{
CloseGossipMenuFor(player);
player->AreaExploredOrEventHappens(6627);
}
return true;
}
bool OnGossipHello(Player* player, Creature* creature) override
{
if (creature->IsQuestGiver())
player->PrepareQuestMenu(creature->GetGUID());
if (player->GetQuestStatus(6627) == QUEST_STATUS_INCOMPLETE)
{
AddGossipItemFor(player, GOSSIP_ICON_CHAT, GOSSIP_HBD1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
AddGossipItemFor(player, GOSSIP_ICON_CHAT, GOSSIP_HBD2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2);
AddGossipItemFor(player, GOSSIP_ICON_CHAT, GOSSIP_HBD3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
AddGossipItemFor(player, GOSSIP_ICON_CHAT, GOSSIP_HBD4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
AddGossipItemFor(player, GOSSIP_ICON_CHAT, GOSSIP_HBD5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
SendGossipMenuFor(player, 5820, creature->GetGUID());
}
else
SendGossipMenuFor(player, 5819, creature->GetGUID());
return true;
}
};
/*######
## npc_kaya_flathoof
######*/
enum Kaya
{
FACTION_ESCORTEE_H = 775,
NPC_GRIMTOTEM_RUFFIAN = 11910,
NPC_GRIMTOTEM_BRUTE = 11912,
NPC_GRIMTOTEM_SORCERER = 11913,
SAY_START = 0,
SAY_AMBUSH = 1,
SAY_END = 2,
QUEST_PROTECT_KAYA = 6523
};
class npc_kaya_flathoof : public CreatureScript
{
public:
npc_kaya_flathoof() : CreatureScript("npc_kaya_flathoof") { }
struct npc_kaya_flathoofAI : public npc_escortAI
{
npc_kaya_flathoofAI(Creature* creature) : npc_escortAI(creature) {}
void WaypointReached(uint32 waypointId) override
{
Player* player = GetPlayerForEscort();
if (!player)
return;
switch (waypointId)
{
case 16:
Talk(SAY_AMBUSH);
me->SummonCreature(NPC_GRIMTOTEM_BRUTE, -48.53f, -503.34f, -46.31f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000);
me->SummonCreature(NPC_GRIMTOTEM_RUFFIAN, -38.85f, -503.77f, -45.90f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000);
me->SummonCreature(NPC_GRIMTOTEM_SORCERER, -36.37f, -496.23f, -45.71f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000);
break;
case 18:
me->SetFacingToObject(player);
Talk(SAY_END);
player->GroupEventHappens(QUEST_PROTECT_KAYA, me);
break;
}
}
void JustSummoned(Creature* summoned) override
{
summoned->AI()->AttackStart(me);
}
void Reset() override {}
};
bool OnQuestAccept(Player* player, Creature* creature, Quest const* quest) override
{
if (quest->GetQuestId() == QUEST_PROTECT_KAYA)
{
if (npc_escortAI* pEscortAI = CAST_AI(npc_kaya_flathoof::npc_kaya_flathoofAI, creature->AI()))
pEscortAI->Start(true, false, player->GetGUID());
creature->AI()->Talk(SAY_START);
creature->SetFaction(FACTION_ESCORTEE_N_NEUTRAL_PASSIVE);
creature->SetImmuneToPC(false);
}
return true;
}
CreatureAI* GetAI(Creature* creature) const override
{
return new npc_kaya_flathoofAI(creature);
}
};
/*######
## AddSC
######*/
void AddSC_stonetalon_mountains()
{
new npc_braug_dimspirit();
new npc_kaya_flathoof();
}