TrinityCore
Loading...
Searching...
No Matches
razorfen_downs.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/* ScriptData
19SDName: Razorfen_Downs
20SD%Complete: 100
21SDComment: Support for Henry Stern(2 recipes)
22SDCategory: Razorfen Downs
23EndScriptData */
24
25/* ContentData
26npc_henry_stern
27EndContentData */
28
29#include "ScriptMgr.h"
30#include "CellImpl.h"
31#include "GameObjectAI.h"
32#include "GridNotifiersImpl.h"
33#include "InstanceScript.h"
34#include "MotionMaster.h"
35#include "Player.h"
36#include "razorfen_downs.h"
37#include "ScriptedCreature.h"
38#include "ScriptedGossip.h"
39#include "TemporarySummon.h"
40
41/*###
42## npc_belnistrasz for Quest 3525 "Extinguishing the Idol"
43######*/
44
46{
47 { 2582.789f, 954.3925f, 52.48214f, 3.787364f },
48 { 2569.42f, 956.3801f, 52.27323f, 5.427974f },
49 { 2570.62f, 942.3934f, 53.7433f, 0.715585f }
50};
51
81
83{
84public:
85 npc_belnistrasz() : CreatureScript("npc_belnistrasz") { }
86
88 {
89 npc_belnistraszAI(Creature* creature) : ScriptedAI(creature)
90 {
91 instance = creature->GetInstanceScript();
92 eventInProgress = false;
93 channeling = false;
94 eventProgress = 0;
95 spawnerCount = 0;
96 }
97
98 void Reset() override
99 {
100 if (!eventInProgress)
101 {
104
105 channeling = false;
106 eventProgress = 0;
107 spawnerCount = 0;
109 }
110 }
111
112 void JustEngagedWith(Unit* who) override
113 {
114 if (channeling)
115 Talk(SAY_WATCH_OUT, who);
116 else
117 {
120 if (urand(0, 100) > 40)
121 Talk(SAY_AGGRO, who);
122 }
123 }
124
125 void JustDied(Unit* /*killer*/) override
126 {
129 }
130
131 void OnQuestAccept(Player* /*player*/, Quest const* quest) override
132 {
134 {
135 eventInProgress = true;
140 }
141 }
142
143 void MovementInform(uint32 type, uint32 id) override
144 {
145 if (type == WAYPOINT_MOTION_TYPE && id == POINT_REACH_IDOL)
146 {
147 channeling = true;
149 }
150 }
151
152 void UpdateAI(uint32 diff) override
153 {
154 if (!eventInProgress)
155 return;
156
157 events.Update(diff);
158
159 while (uint32 eventId = events.ExecuteEvent())
160 {
161 switch (eventId)
162 {
163 case EVENT_CHANNEL:
168 break;
171 creature->AI()->SetData(0, spawnerCount);
172 if (++spawnerCount < 8)
174 break;
175 case EVENT_PROGRESS:
176 {
177 switch (eventProgress)
178 {
179 case 0:
183 break;
184 case 1:
188 break;
189 case 2:
193 break;
194 case 3:
199 break;
200 }
201 break;
202 }
203 case EVENT_COMPLETE:
204 {
206 me->SummonGameObject(GO_BELNISTRASZS_BRAZIER, 2577.196f, 947.0781f, 53.16757f, 2.356195f, QuaternionData(0.f, 0.f, 0.9238796f, 0.3826832f), 1h, GO_SUMMON_TIMED_DESPAWN);
207 std::list<WorldObject*> ClusterList;
208 Trinity::AllWorldObjectsInRange objects(me, 50.0f);
210 Cell::VisitAllObjects(me, searcher, 50.0f);
211 for (std::list<WorldObject*>::const_iterator itr = ClusterList.begin(); itr != ClusterList.end(); ++itr)
212 {
213 if (Player* player = (*itr)->ToPlayer())
214 {
215 if (player->GetQuestStatus(QUEST_EXTINGUISHING_THE_IDOL) == QUEST_STATUS_INCOMPLETE)
216 player->GroupEventHappens(QUEST_EXTINGUISHING_THE_IDOL, me);
217 }
218 else if (GameObject* go = (*itr)->ToGameObject())
219 {
220 if (go->GetEntry() == GO_IDOL_OVEN_FIRE || go->GetEntry() == GO_IDOL_CUP_FIRE || go->GetEntry() == GO_IDOL_MOUTH_FIRE)
221 go->Delete();
222 }
223 }
226 break;
227 }
228 case EVENT_FIREBALL:
230 return;
233 break;
234 case EVENT_FROST_NOVA:
236 return;
239 break;
240 }
241 }
242 if (!channeling)
244 }
245
246 private:
253 };
254
255 CreatureAI* GetAI(Creature* creature) const override
256 {
257 return GetRazorfenDownsAI<npc_belnistraszAI>(creature);
258 }
259};
260
262{
263public:
264 npc_idol_room_spawner() : CreatureScript("npc_idol_room_spawner") { }
265
267 {
269 {
270 instance = creature->GetInstanceScript();
271 }
272
273 void Reset() override { }
274
275 void SetData(uint32 /*type*/, uint32 data) override
276 {
277 if (data < 7)
278 {
280 if (data > 0 && me->GetOrientation() < 4.0f)
282 me->SummonCreature(NPC_DEATHS_HEAD_GEOMANCER, me->GetPositionX() + (std::cos(me->GetOrientation() - (float(M_PI) / 2)) * 2), me->GetPositionY() + (std::sin(me->GetOrientation() - (float(M_PI) / 2)) * 2), me->GetPositionZ(), me->GetOrientation());
283 me->SummonCreature(NPC_WITHERED_QUILGUARD, me->GetPositionX() + (std::cos(me->GetOrientation() + (float(M_PI) / 2)) * 2), me->GetPositionY() + (std::sin(me->GetOrientation() + (float(M_PI) / 2)) * 2), me->GetPositionZ(), me->GetOrientation());
284 }
285 else if (data == 7)
287 }
288
289 private:
291 };
292
293 CreatureAI* GetAI(Creature* creature) const override
294 {
295 return GetRazorfenDownsAI<npc_idol_room_spawnerAI>(creature);
296 }
297};
298
306
308{
309public:
310 npc_tomb_creature() : CreatureScript("npc_tomb_creature") { }
311
313 {
315 {
316 instance = creature->GetInstanceScript();
317 }
318
327
328 void JustDied(Unit* /*killer*/) override
329 {
331 }
332
333 void JustEngagedWith(Unit* /*who*/) override
334 {
336 }
337
338 void UpdateAI(uint32 diff) override
339 {
340 if (!UpdateVictim())
341 return;
342
343 events.Update(diff);
344
345 while (uint32 eventId = events.ExecuteEvent())
346 {
347 switch (eventId)
348 {
349 case EVENT_WEB:
352 break;
353 }
354 }
356 }
357
358 private:
361 };
362
363 CreatureAI* GetAI(Creature* creature) const override
364 {
365 return GetRazorfenDownsAI<npc_tomb_creatureAI>(creature);
366 }
367};
368
369/*######
370## go_gong
371######*/
372
374{
375public:
376 go_gong() : GameObjectScript("go_gong") { }
377
378 struct go_gongAI : public GameObjectAI
379 {
380 go_gongAI(GameObject* go) : GameObjectAI(go), instance(go->GetInstanceScript()) { }
381
383
384 bool OnGossipHello(Player* /*player*/) override
385 {
386 me->SendCustomAnim(0);
388 return true;
389 }
390 };
391
392 GameObjectAI* GetAI(GameObject* go) const override
393 {
394 return GetRazorfenDownsAI<go_gongAI>(go);
395 }
396};
397
399{
400 new npc_belnistrasz();
402 new npc_tomb_creature();
403 new go_gong();
404}
#define M_PI
Definition Common.h:72
uint8_t uint8
Definition Define.h:135
uint32_t uint32
Definition Define.h:133
@ IN_PROGRESS
@ DONE
@ WAYPOINT_MOTION_TYPE
@ TEMPSUMMON_TIMED_DESPAWN
@ GO_SUMMON_TIMED_DESPAWN
@ QUEST_STATUS_INCOMPLETE
Definition QuestDef.h:107
uint32 urand(uint32 min, uint32 max)
Definition Random.cpp:42
@ FACTION_ESCORTEE_N_NEUTRAL_ACTIVE
@ UNIT_NPC_FLAG_QUESTGIVER
@ CURRENT_CHANNELED_SPELL
Definition Unit.h:608
@ UNIT_STATE_CASTING
Definition Unit.h:235
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:82
void DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
void Update(uint32 time)
Definition EventMap.h:67
EventId ExecuteEvent()
Definition EventMap.cpp:73
void CancelEvent(EventId eventId)
Definition EventMap.cpp:151
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:36
GameObject *const me
void SendCustomAnim(uint32 anim)
virtual bool SetBossState(uint32 id, EncounterState state)
void MovePath(uint32 pathId, bool repeatable)
static GameObject * ToGameObject(Object *o)
Definition Object.h:198
uint32 GetEntry() const
Definition Object.h:81
static Player * ToPlayer(Object *o)
Definition Object.h:180
uint32 GetQuestId() const
Definition QuestDef.h:229
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:54
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:241
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.cpp:166
SpellCastResult DoCastAOE(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:243
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:106
Definition Unit.h:769
void SetFaction(uint32 faction) override
Definition Unit.h:974
MotionMaster * GetMotionMaster()
Definition Unit.h:1667
void RemoveNpcFlag(NPCFlags flags)
Definition Unit.h:1098
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition Unit.cpp:4535
void InterruptSpell(CurrentSpellTypes spellType, bool withDelayed=true, bool withInstant=true, SpellCastResult result=SPELL_FAILED_INTERRUPTED, Optional< SpellCastResult > resultOther={})
Definition Unit.cpp:3021
void SetNpcFlag(NPCFlags flags)
Definition Unit.h:1097
bool HasUnitState(const uint32 f) const
Definition Unit.h:876
InstanceScript * GetInstanceScript() const
Definition Object.cpp:1087
TempSummon * SummonCreature(uint32 entry, Position const &pos, TempSummonType despawnType=TEMPSUMMON_MANUAL_DESPAWN, Milliseconds despawnTime=0s, uint32 vehId=0, uint32 spellId=0, ObjectGuid privateObjectOwner=ObjectGuid::Empty)
Definition Object.cpp:1992
GameObject * SummonGameObject(uint32 entry, Position const &pos, QuaternionData const &rot, Seconds respawnTime, GOSummonType summonType=GO_SUMMON_TIMED_OR_CORPSE_DESPAWN)
Definition Object.cpp:2015
virtual void SetData(uint32, uint32)
Definition ZoneScript.h:56
GameObjectAI * GetAI(GameObject *go) const override
CreatureAI * GetAI(Creature *creature) const override
CreatureAI * GetAI(Creature *creature) const override
CreatureAI * GetAI(Creature *creature) const override
Position const PosSummonSpawner[3]
void AddSC_razorfen_downs()
Belnistrasz
@ SAY_EVENT_TWO_MIN_LEFT
@ EVENT_IDOL_ROOM_SPAWNER
@ SAY_EVENT_THREE_MIN_LEFT
@ EVENT_COMPLETE
@ EVENT_FIREBALL
@ EVENT_CHANNEL
@ SAY_AGGRO
@ SAY_EVENT_START
@ SAY_EVENT_END
@ SPELL_IDOM_ROOM_CAMERA_SHAKE
@ SPELL_ARCANE_INTELLECT
@ SPELL_FIREBALL
@ SPELL_IDOL_SHUTDOWN_VISUAL
@ EVENT_PROGRESS
@ SAY_WATCH_OUT
@ PATH_ESCORT
@ SAY_QUEST_ACCEPTED
@ SAY_EVENT_ONE_MIN_LEFT
@ QUEST_EXTINGUISHING_THE_IDOL
@ SPELL_FROST_NOVA
@ EVENT_FROST_NOVA
@ POINT_REACH_IDOL
TombCreature
@ EVENT_WEB
@ SPELL_WEB
@ SPELL_POISON_PROC
@ SPELL_VIRULENT_POISON_PROC
@ GO_IDOL_CUP_FIRE
@ GO_IDOL_OVEN_FIRE
@ GO_IDOL_MOUTH_FIRE
@ GO_BELNISTRASZS_BRAZIER
@ NPC_TOMB_FIEND
@ NPC_WITHERED_BATTLE_BOAR
@ NPC_IDOL_ROOM_SPAWNER
@ NPC_PLAGUEMAW_THE_ROTTING
@ NPC_WITHERED_QUILGUARD
@ NPC_DEATHS_HEAD_GEOMANCER
@ NPC_TOMB_REAVER
@ DATA_EXTINGUISHING_THE_IDOL
@ DATA_WAVE
static void VisitAllObjects(WorldObject const *obj, T &visitor, float radius, bool dont_load=true)
Definition CellImpl.h:192
float GetPositionZ() const
Definition Position.h:81
float GetOrientation() const
Definition Position.h:82
float GetPositionX() const
Definition Position.h:79
float GetPositionY() const
Definition Position.h:80
InstanceScript * instance
bool OnGossipHello(Player *) override
go_gongAI(GameObject *go)
void UpdateAI(uint32 diff) override
void OnQuestAccept(Player *, Quest const *quest) override
void JustEngagedWith(Unit *who) override
void MovementInform(uint32 type, uint32 id) override
void SetData(uint32, uint32 data) override