Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
black_temple.cpp
Go to the documentation of this file.
1/*
2* This file is part of Project SkyFire https://www.projectskyfire.org.
3* See LICENSE.md file for Copyright information
4*/
5
6/*
7Name: Black_Temple
8Complete: 100%
9Comment: Spirit of Olum: Player Teleporter to Seer Kanai Teleport after defeating Naj'entus and Supremus.
10*/
11
12#include "ScriptMgr.h"
13#include "ScriptedCreature.h"
14#include "ScriptedGossip.h"
15#include "black_temple.h"
16#include "Player.h"
17
19{
20 // Spirit of Olum
22 // Wrathbone Flayer
23 SPELL_CLEAVE = 15496,
26};
27
29{
32};
33
35{
36 // Wrathbone Flayer
41};
42
43// ########################################################
44// Spirit of Olum
45// ########################################################
46
48{
49public:
50 npc_spirit_of_olum() : CreatureScript("npc_spirit_of_olum") { }
51
53 {
54 npc_spirit_of_olumAI(Creature* creature) : ScriptedAI(creature) { }
55
56 void sGossipSelect(Player* player, uint32 /*sender*/, uint32 action) OVERRIDE
57 {
58 if (action == 1)
59 {
60 player->CLOSE_GOSSIP_MENU();
61 player->InterruptNonMeleeSpells(false);
62 player->CastSpell(player, SPELL_TELEPORT, false);
63 }
64 }
65 };
66
68 {
69 return new npc_spirit_of_olumAI(creature);
70 }
71};
72
73// ########################################################
74// Wrathbone Flayer
75// ########################################################
76
78{
79public:
80 npc_wrathbone_flayer() : CreatureScript("npc_wrathbone_flayer") { }
81
83 {
85 {
86 instance = creature->GetInstanceScript();
87 }
88
90 {
91 events.ScheduleEvent(EVENT_GET_CHANNELERS, 3000);
92 enteredCombat = false;
93 }
94
95 void JustDied(Unit* /*killer*/) OVERRIDE { }
96
97 void EnterCombat(Unit* /*who*/) OVERRIDE
98 {
99 events.ScheduleEvent(EVENT_CLEAVE, 5000);
100 events.ScheduleEvent(EVENT_IGNORED, 7000);
101 enteredCombat = true;
102 }
103
105 {
106 if (!enteredCombat)
107 {
108 events.Update(diff);
109
110 while (uint32 eventId = events.ExecuteEvent())
111 {
112 switch (eventId)
113 {
115 {
116 std::list<Creature*> BloodMageList;
117 me->GetCreatureListWithEntryInGrid(BloodMageList, NPC_BLOOD_MAGE, 15.0f);
118
119 if (!BloodMageList.empty())
120 for (std::list<Creature*>::const_iterator itr = BloodMageList.begin(); itr != BloodMageList.end(); ++itr)
121 {
122 bloodmage.push_back((*itr)->GetGUID());
123 if ((*itr)->isDead())
124 (*itr)->Respawn();
125 }
126
127 std::list<Creature*> DeathShaperList;
128 me->GetCreatureListWithEntryInGrid(DeathShaperList, NPC_DEATHSHAPER, 15.0f);
129
130 if (!DeathShaperList.empty())
131 for (std::list<Creature*>::const_iterator itr = DeathShaperList.begin(); itr != DeathShaperList.end(); ++itr)
132 {
133 deathshaper.push_back((*itr)->GetGUID());
134 if ((*itr)->isDead())
135 (*itr)->Respawn();
136 }
137
138 events.ScheduleEvent(EVENT_SET_CHANNELERS, 3000);
139
140 break;
141 }
143 {
144 for (std::list<uint64>::const_iterator itr = bloodmage.begin(); itr != bloodmage.end(); ++itr)
145 if (Creature* bloodmage = (Unit::GetCreature(*me, *itr)))
146 bloodmage->AI()->DoCast(SPELL_SUMMON_CHANNEL);
147
148 for (std::list<uint64>::const_iterator itr = deathshaper.begin(); itr != deathshaper.end(); ++itr)
149 if (Creature* deathshaper = (Unit::GetCreature(*me, *itr)))
150 deathshaper->AI()->DoCast(SPELL_SUMMON_CHANNEL);
151
152 events.ScheduleEvent(EVENT_SET_CHANNELERS, 12000);
153
154 break;
155 }
156 default:
157 break;
158 }
159 }
160 }
161
162 if (!UpdateVictim())
163 return;
164
165 events.Update(diff);
166
167 while (uint32 eventId = events.ExecuteEvent())
168 {
169 switch (eventId)
170 {
171 case EVENT_CLEAVE:
173 events.ScheduleEvent(EVENT_CLEAVE, std::rand() % 2000 + 1000);
174 break;
175 case EVENT_IGNORED:
176 if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
177 DoCast(target, SPELL_IGNORED);
178 events.ScheduleEvent(EVENT_IGNORED, 10000);
179 break;
180 default:
181 break;
182 }
183 }
185 }
186
187 private:
190 std::list<uint64> bloodmage;
191 std::list<uint64> deathshaper;
193 };
194
196 {
197 return new npc_wrathbone_flayerAI(creature);
198 }
199};
200
202{
203 new npc_spirit_of_olum();
205}
std::uint32_t uint32
Definition Define.h:77
#define OVERRIDE
Definition Define.h:60
@ SELECT_TARGET_RANDOM
Definition UnitAI.h:23
Creatures
@ SPELL_CLEAVE
@ EVENT_CLEAVE
void AddSC_black_temple()
@ NPC_BLOOD_MAGE
@ NPC_DEATHSHAPER
@ SPELL_CLEAVE
@ SPELL_TELEPORT
@ SPELL_SUMMON_CHANNEL
@ SPELL_IGNORED
@ EVENT_GET_CHANNELERS
@ EVENT_SET_CHANNELERS
@ EVENT_CLEAVE
@ EVENT_IGNORED
bool UpdateVictim()
CreatureScript(const char *name)
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:28
void DoCast(uint32 spellId)
Definition UnitAI.cpp:110
Unit * SelectTarget(SelectAggroTarget targetType, uint32 position=0, float dist=0.0f, bool playerOnly=false, int32 aura=0)
Definition UnitAI.cpp:66
void DoCastVictim(uint32 spellId, bool triggered=false)
Definition UnitAI.cpp:168
Definition Unit.h:1367
static Creature * GetCreature(WorldObject &object, uint64 guid)
Definition Unit.cpp:4905
InstanceScript * GetInstanceScript()
Definition Object.cpp:1612
CreatureAI * GetAI(Creature *creature) const OVERRIDE
CreatureAI * GetAI(Creature *creature) const OVERRIDE
Creature * me
ScriptedAI(Creature *creature)
void sGossipSelect(Player *player, uint32, uint32 action) OVERRIDE
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================