TrinityCore
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
26{
29};
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
90 bool OnGossipHello(Player* player) override
91 {
94
97
98 SendGossipMenuFor(player, player->GetGossipTextId(me), me->GetGUID());
99 return true;
100 }
101 };
102
103 CreatureAI* GetAI(Creature* creature) const override
104 {
105 return GetBlackrockDepthsAI<boss_gloomrelAI>(creature);
106 }
107};
108
110{
118{
121
126{
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
167 void JustEngagedWith(Unit* /*who*/) override
168 {
173 }
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
184 void EnterEvadeMode(EvadeReason why) override
185 {
187
189 }
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 }
229
230 bool OnGossipSelect(Player* player, uint32 /*menuId*/, uint32 gossipListId) override
231 {
232 uint32 const action = player->PlayerTalkClass->GetGossipOptionAction(gossipListId);
233 ClearGossipMenuFor(player);
234
235 switch (action)
236 {
237 case GOSSIP_ACTION_INFO_DEF + 1:
240 SendGossipMenuFor(player, 2605, me->GetGUID());
241 break;
242 case GOSSIP_ACTION_INFO_DEF + 2:
243 CloseGossipMenuFor(player);
244 //start event here
246 me->SetImmuneToPC(false);
247 me->AI()->AttackStart(player);
248
250 break;
251 }
252 return true;
253 }
254
255 bool OnGossipHello(Player* player) override
256 {
259 SendGossipMenuFor(player, 2601, me->GetGUID());
260
261 return true;
262 }
263
264 private:
268 };
269
270 CreatureAI* GetAI(Creature* creature) const override
271 {
272 return GetBlackrockDepthsAI<boss_doomrelAI>(creature);
273 }
274};
275
277{
278 new boss_gloomrel();
279 new boss_doomrel();
280}
uint32_t uint32
Definition: Define.h:142
Spells
Definition: PlayerAI.cpp:32
void AddGossipItemFor(Player *player, GossipOptionNpc optionNpc, std::string text, uint32 sender, uint32 action)
void SendGossipMenuFor(Player *player, uint32 npcTextID, ObjectGuid const &guid)
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
EvadeReason
Definition: UnitAICommon.h:30
@ UNIT_NPC_FLAG_GOSSIP
Definition: UnitDefines.h:297
@ UNIT_NPC_FLAG_NONE
Definition: UnitDefines.h:296
DamageEffectType
Definition: UnitDefines.h:131
@ 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
@ PHASE_ONE
@ PHASE_TWO
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
virtual void EnterEvadeMode(EvadeReason why=EvadeReason::Other)
Definition: CreatureAI.cpp:219
bool UpdateVictim()
Definition: CreatureAI.cpp:245
void AttackStart(Unit *victim) override
== Triggered Actions Requested ==================
Definition: CreatureAI.cpp:328
Creature *const me
Definition: CreatureAI.h:61
void SetImmuneToPC(bool apply) override
Definition: Creature.h:170
CreatureAI * AI() const
Definition: Creature.h:214
uint32 ExecuteEvent()
Definition: EventMap.cpp:73
void Update(uint32 time)
Definition: EventMap.h:56
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
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:274
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:159
uint16 GetSkillValue(uint32 skill) const
Definition: Player.cpp:6052
bool GetQuestRewardStatus(uint32 quest_id) const
Definition: Player.cpp:16033
bool HasSpell(uint32 spell) const override
Definition: Player.cpp:3792
uint32 GetGossipTextId(uint32 menuId, WorldObject *source)
Definition: Player.cpp:14367
std::unique_ptr< PlayerMenu > PlayerTalkClass
Definition: Player.h:2380
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.cpp:180
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition: UnitAI.cpp:79
SpellCastResult DoCast(uint32 spellId)
Definition: UnitAI.cpp:89
Definition: Unit.h:627
void SetFaction(uint32 faction) override
Definition: Unit.h:859
void ReplaceAllNpcFlags(NPCFlags flags)
Definition: Unit.h:984
InstanceScript * GetInstanceScript() const
Definition: Object.cpp:1042
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition: Object.cpp:2896
virtual uint32 GetData(uint32) const
Definition: ZoneScript.h:91
virtual void SetData(uint32, uint32)
Definition: ZoneScript.h:92
virtual void SetGuidData(uint32, ObjectGuid)
Definition: ZoneScript.h:84
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