TrinityCore
Loading...
Searching...
No Matches
boss_tomb_of_seven.cpp
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#include "ScriptMgr.h"
19#include "blackrock_depths.h"
20#include "InstanceScript.h"
21#include "Player.h"
22#include "ScriptedCreature.h"
23#include "ScriptedGossip.h"
24
30
32{
34};
35
36enum Misc
37{
39};
40
42{
44 PHASE_TWO = 2
45};
46
47#define GOSSIP_ITEM_TEACH_1 "Teach me the art of smelting dark iron"
48#define GOSSIP_ITEM_TEACH_2 "Continue..."
49#define GOSSIP_ITEM_TEACH_3 "[PH] Continue..."
50#define GOSSIP_ITEM_TRIBUTE "I want to pay tribute"
51
53{
54 public:
55 boss_gloomrel() : CreatureScript("boss_gloomrel") { }
56
58 {
59 boss_gloomrelAI(Creature* creature) : ScriptedAI(creature), instance(creature->GetInstanceScript()) { }
60
62
63 bool OnGossipSelect(Player* player, uint32 /*menuId*/, uint32 gossipListId) override
64 {
65 uint32 const action = player->PlayerTalkClass->GetGossipOptionAction(gossipListId);
66 ClearGossipMenuFor(player);
67 switch (action)
68 {
71 SendGossipMenuFor(player, 2606, me->GetGUID());
72 break;
73 case GOSSIP_ACTION_INFO_DEF + 11:
74 CloseGossipMenuFor(player);
75 player->CastSpell(player, SPELL_LEARN_SMELT, false);
76 break;
79 SendGossipMenuFor(player, 2604, me->GetGUID());
80 break;
81 case GOSSIP_ACTION_INFO_DEF + 22:
82 CloseGossipMenuFor(player);
83 //are 5 minutes expected? go template may have data to despawn when used at quest
85 break;
86 }
87 return true;
88 }
89
101 };
102
103 CreatureAI* GetAI(Creature* creature) const override
104 {
105 return GetBlackrockDepthsAI<boss_gloomrelAI>(creature);
106 }
107};
108
133
135{
136 public:
137 boss_doomrel() : CreatureScript("boss_doomrel") { }
138
140 {
141 boss_doomrelAI(Creature* creature) : ScriptedAI(creature)
142 {
143 Initialize();
144 _instance = creature->GetInstanceScript();
145 }
146
148 {
149 _voidwalkers = false;
150 }
151
152 void Reset() override
153 {
154 Initialize();
155
157
158 // was set before event start, so set again
159 me->SetImmuneToPC(true);
160
163 else
165 }
166
174
175 void DamageTaken(Unit* /*attacker*/, uint32& /*damage*/, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
176 {
177 if (!_voidwalkers && !HealthAbovePct(50))
178 {
180 _voidwalkers = true;
181 }
182 }
183
190
191 void JustDied(Unit* /*killer*/) override
192 {
194 }
195
196 void UpdateAI(uint32 diff) override
197 {
198 if (!UpdateVictim())
199 return;
200
201 _events.Update(diff);
202
203 while (uint32 eventId = _events.ExecuteEvent())
204 {
205 switch (eventId)
206 {
210 break;
211 case EVENT_IMMOLATE:
212 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100.0f, true))
213 DoCast(target, SPELL_IMMOLATE);
215 break;
219 break;
220 case EVENT_DEMONARMOR:
223 break;
224 default:
225 break;
226 }
227 }
228
230 }
231
232 bool OnGossipSelect(Player* player, uint32 /*menuId*/, uint32 gossipListId) override
233 {
234 uint32 const action = player->PlayerTalkClass->GetGossipOptionAction(gossipListId);
235 ClearGossipMenuFor(player);
236
237 switch (action)
238 {
239 case GOSSIP_ACTION_INFO_DEF + 1:
242 SendGossipMenuFor(player, 2605, me->GetGUID());
243 break;
244 case GOSSIP_ACTION_INFO_DEF + 2:
245 CloseGossipMenuFor(player);
246 //start event here
248 me->SetImmuneToPC(false);
249 me->AI()->AttackStart(player);
250
252 break;
253 }
254 return true;
255 }
256
257 bool OnGossipHello(Player* player) override
258 {
261 SendGossipMenuFor(player, 2601, me->GetGUID());
262
263 return true;
264 }
265
266 private:
270 };
271
272 CreatureAI* GetAI(Creature* creature) const override
273 {
274 return GetBlackrockDepthsAI<boss_doomrelAI>(creature);
275 }
276};
277
279{
280 new boss_gloomrel();
281 new boss_doomrel();
282}
uint32_t uint32
Definition Define.h:133
@ GOSSIP_ICON_CHAT
Definition GossipDef.h:60
Spells
Definition PlayerAI.cpp:32
void SendGossipMenuFor(Player *player, uint32 npcTextID, ObjectGuid const &guid)
void AddGossipItemFor(Player *player, GossipOptionIcon icon, std::string const &text, uint32 sender, uint32 action)
void ClearGossipMenuFor(Player *player)
void InitGossipMenuFor(Player *player, uint32 menuId)
void CloseGossipMenuFor(Player *player)
@ GOSSIP_SENDER_MAIN
@ GOSSIP_ACTION_INFO_DEF
@ FACTION_FRIENDLY
@ FACTION_DARK_IRON_DWARVES
@ SKILL_MINING
@ UNIT_NPC_FLAG_GOSSIP
DamageEffectType
Definition Unit.h:352
@ DATA_EVENSTARTER
@ DATA_GHOSTKILL
@ DATA_GO_CHALICE
#define GOSSIP_ITEM_TEACH_2
@ SPELL_CURSEOFWEAKNESS
@ SPELL_IMMOLATE
@ SPELL_DEMONARMOR
@ SPELL_SUMMON_VOIDWALKERS
@ SPELL_SHADOWBOLTVOLLEY
@ QUEST_SPECTRAL_CHALICE
@ DATA_SKILLPOINT_MIN
@ SPELL_SMELT_DARK_IRON
@ SPELL_LEARN_SMELT
void AddSC_boss_tomb_of_seven()
#define GOSSIP_ITEM_TEACH_3
#define GOSSIP_ITEM_TEACH_1
#define GOSSIP_ITEM_TRIBUTE
@ GOSSIP_SELECT_DOOMREL
@ GOSSIP_MENU_CHALLENGE
@ GOSSIP_MENU_ID_CHALLENGE
@ GOSSIP_MENU_ID_CONTINUE
@ EVENT_IMMOLATE
@ EVENT_SHADOW_BOLT_VOLLEY
@ EVENT_CURSE_OF_WEAKNESS
@ EVENT_SUMMON_VOIDWALKERS
@ EVENT_DEMONARMOR
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:82
virtual void EnterEvadeMode(EvadeReason why=EVADE_REASON_OTHER)
void SetImmuneToPC(bool apply) override
Definition Creature.h:129
CreatureAI * AI() const
Definition Creature.h:154
void Update(uint32 time)
Definition EventMap.h:67
EventId ExecuteEvent()
Definition EventMap.cpp:73
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:36
virtual ObjectGuid GetGuidData(uint32 type) const override
void DoRespawnGameObject(ObjectGuid guid, Seconds timeToDespawn=1min)
static ObjectGuid const Empty
Definition ObjectGuid.h:140
static ObjectGuid GetGUID(Object const *o)
Definition Object.h:78
uint32 GetGossipOptionAction(uint32 selection) const
Definition GossipDef.h:269
uint16 GetSkillValue(uint32 skill) const
Definition Player.cpp:5892
bool GetQuestRewardStatus(uint32 quest_id) const
Definition Player.cpp:15626
bool HasSpell(uint32 spell) const override
Definition Player.cpp:3853
uint32 GetGossipTextId(uint32 menuId, WorldObject *source)
Definition Player.cpp:14233
PlayerMenu * PlayerTalkClass
Definition Player.h:1969
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:54
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.cpp:166
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition UnitAI.cpp:96
virtual void AttackStart(Unit *)
Definition UnitAI.cpp:30
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:106
Definition Unit.h:769
void SetFaction(uint32 faction) override
Definition Unit.h:974
void RemoveNpcFlag(NPCFlags flags)
Definition Unit.h:1098
void SetNpcFlag(NPCFlags flags)
Definition Unit.h:1097
InstanceScript * GetInstanceScript() const
Definition Object.cpp:1087
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2832
virtual uint32 GetData(uint32) const
Definition ZoneScript.h:55
virtual void SetData(uint32, uint32)
Definition ZoneScript.h:56
virtual void SetGuidData(uint32, ObjectGuid)
Definition ZoneScript.h:49
CreatureAI * GetAI(Creature *creature) const override
CreatureAI * GetAI(Creature *creature) const override
bool HealthAbovePct(uint32 pct) const
void UpdateAI(uint32 diff) override
bool OnGossipHello(Player *player) override
void JustEngagedWith(Unit *) override
bool OnGossipSelect(Player *player, uint32, uint32 gossipListId) override
void DamageTaken(Unit *, uint32 &, DamageEffectType, SpellInfo const *) override
void EnterEvadeMode(EvadeReason why) override
bool OnGossipHello(Player *player) override
bool OnGossipSelect(Player *player, uint32, uint32 gossipListId) override