TrinityCore
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 "TemporarySummon.h"
39
40/*###
41## npc_belnistrasz for Quest 3525 "Extinguishing the Idol"
42######*/
43
45{
46 { 2582.789f, 954.3925f, 52.48214f, 3.787364f },
47 { 2569.42f, 956.3801f, 52.27323f, 5.427974f },
48 { 2570.62f, 942.3934f, 53.7433f, 0.715585f }
49};
50
52{
59
60 PATH_ESCORT = 6973680,
62
64
71 SAY_AGGRO = 6, // Combat
72 SAY_WATCH_OUT = 7, // 25% chance to target random creature and say on wave spawn
73
77 SPELL_IDOL_SHUTDOWN_VISUAL = 12774, // Hits Unit Entry: 8662
78 SPELL_IDOM_ROOM_CAMERA_SHAKE = 12816 // Dummy needs scripting
79};
80
82{
83public:
84 npc_belnistrasz() : CreatureScript("npc_belnistrasz") { }
85
87 {
88 npc_belnistraszAI(Creature* creature) : ScriptedAI(creature)
89 {
90 instance = creature->GetInstanceScript();
91 eventInProgress = false;
92 channeling = false;
93 eventProgress = 0;
94 spawnerCount = 0;
95 }
96
97 void Reset() override
98 {
99 if (!eventInProgress)
100 {
103
104 channeling = false;
105 me->SetCanMelee(true);
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;
148 me->SetCanMelee(false);
150 }
151 }
152
153 void UpdateAI(uint32 diff) override
154 {
155 if (!eventInProgress)
156 return;
157
158 events.Update(diff);
159
160 while (uint32 eventId = events.ExecuteEvent())
161 {
162 switch (eventId)
163 {
164 case EVENT_CHANNEL:
169 break;
172 creature->AI()->SetData(0, spawnerCount);
173 if (++spawnerCount < 8)
175 break;
176 case EVENT_PROGRESS:
177 {
178 switch (eventProgress)
179 {
180 case 0:
184 break;
185 case 1:
189 break;
190 case 2:
194 break;
195 case 3:
200 break;
201 }
202 break;
203 }
204 case EVENT_COMPLETE:
205 {
207 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);
208 std::list<WorldObject*> ClusterList;
209 Trinity::AllWorldObjectsInRange objects(me, 50.0f);
211 Cell::VisitAllObjects(me, searcher, 50.0f);
212 for (std::list<WorldObject*>::const_iterator itr = ClusterList.begin(); itr != ClusterList.end(); ++itr)
213 {
214 if (Player* player = (*itr)->ToPlayer())
215 {
216 if (player->GetQuestStatus(QUEST_EXTINGUISHING_THE_IDOL) == QUEST_STATUS_INCOMPLETE)
217 player->GroupEventHappens(QUEST_EXTINGUISHING_THE_IDOL, me);
218 }
219 else if (GameObject* go = (*itr)->ToGameObject())
220 {
221 if (go->GetEntry() == GO_IDOL_OVEN_FIRE || go->GetEntry() == GO_IDOL_CUP_FIRE || go->GetEntry() == GO_IDOL_MOUTH_FIRE)
222 go->Delete();
223 }
224 }
227 break;
228 }
229 case EVENT_FIREBALL:
231 return;
234 break;
235 case EVENT_FROST_NOVA:
237 return;
240 break;
241 }
242 }
243 }
244
245 private:
252 };
253
254 CreatureAI* GetAI(Creature* creature) const override
255 {
256 return GetRazorfenDownsAI<npc_belnistraszAI>(creature);
257 }
258};
259
261{
262public:
263 npc_idol_room_spawner() : CreatureScript("npc_idol_room_spawner") { }
264
266 {
268 {
269 instance = creature->GetInstanceScript();
270 }
271
272 void Reset() override { }
273
274 void SetData(uint32 /*type*/, uint32 data) override
275 {
276 if (data < 7)
277 {
279 if (data > 0 && me->GetOrientation() < 4.0f)
281 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());
282 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());
283 }
284 else if (data == 7)
286 }
287
288 private:
290 };
291
292 CreatureAI* GetAI(Creature* creature) const override
293 {
294 return GetRazorfenDownsAI<npc_idol_room_spawnerAI>(creature);
295 }
296};
297
299{
303 SPELL_WEB = 745
305
307{
308public:
309 npc_tomb_creature() : CreatureScript("npc_tomb_creature") { }
310
312 {
314 {
315 instance = creature->GetInstanceScript();
316 }
317
318 void Reset() override
319 {
322
325 }
326
327 void JustDied(Unit* /*killer*/) override
328 {
330 }
331
332 void JustEngagedWith(Unit* /*who*/) override
333 {
335 }
336
337 void UpdateAI(uint32 diff) override
338 {
339 if (!UpdateVictim())
340 return;
341
342 events.Update(diff);
343
344 while (uint32 eventId = events.ExecuteEvent())
345 {
346 switch (eventId)
347 {
348 case EVENT_WEB:
351 break;
352 }
353 }
354 }
355
356 private:
359 };
360
361 CreatureAI* GetAI(Creature* creature) const override
362 {
363 return GetRazorfenDownsAI<npc_tomb_creatureAI>(creature);
364 }
365};
366
367/*######
368## go_gong
369######*/
370
372{
373public:
374 go_gong() : GameObjectScript("go_gong") { }
375
376 struct go_gongAI : public GameObjectAI
377 {
378 go_gongAI(GameObject* go) : GameObjectAI(go), instance(go->GetInstanceScript()) { }
379
381
382 bool OnGossipHello(Player* /*player*/) override
383 {
384 me->SendCustomAnim(0);
386 return true;
387 }
388 };
389
390 GameObjectAI* GetAI(GameObject* go) const override
391 {
392 return GetRazorfenDownsAI<go_gongAI>(go);
393 }
394};
395
397{
398 new npc_belnistrasz();
400 new npc_tomb_creature();
401 new go_gong();
402}
#define M_PI
Definition: Common.h:115
uint8_t uint8
Definition: Define.h:144
uint32_t uint32
Definition: Define.h:142
@ IN_PROGRESS
@ DONE
@ WAYPOINT_MOTION_TYPE
@ TEMPSUMMON_TIMED_DESPAWN
Definition: ObjectDefines.h:65
@ GO_SUMMON_TIMED_DESPAWN
Definition: ObjectDefines.h:84
@ QUEST_STATUS_INCOMPLETE
Definition: QuestDef.h:145
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:42
@ FACTION_ESCORTEE_N_NEUTRAL_ACTIVE
@ UNIT_NPC_FLAG_QUESTGIVER
Definition: UnitDefines.h:298
@ CURRENT_CHANNELED_SPELL
Definition: Unit.h:591
@ UNIT_STATE_CASTING
Definition: Unit.h:270
void Talk(uint8 id, WorldObject const *whisperTarget=nullptr)
Definition: CreatureAI.cpp:56
bool UpdateVictim()
Definition: CreatureAI.cpp:245
Creature *const me
Definition: CreatureAI.h:61
void SetCanMelee(bool canMelee, bool fleeFromMelee=false)
Definition: Creature.cpp:2822
void DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
Definition: Creature.cpp:2415
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
void CancelEvent(uint32 eventId)
Definition: EventMap.cpp:131
GameObject *const me
Definition: GameObjectAI.h:50
void SendCustomAnim(uint32 anim)
virtual bool SetBossState(uint32 id, EncounterState state)
void MovePath(uint32 pathId, bool repeatable, Optional< Milliseconds > duration={}, Optional< float > speed={}, MovementWalkRunSpeedSelectionMode speedSelectionMode=MovementWalkRunSpeedSelectionMode::Default, Optional< std::pair< Milliseconds, Milliseconds > > waitTimeRangeAtPathEnd={}, Optional< float > wanderDistanceAtPathEnds={}, Optional< bool > followPathBackwardsFromEndToStart={}, bool generatePath=true)
static GameObject * ToGameObject(Object *o)
Definition: Object.h:231
uint32 GetEntry() const
Definition: Object.h:161
static Player * ToPlayer(Object *o)
Definition: Object.h:213
uint32 GetQuestId() const
Definition: QuestDef.h:587
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.h:159
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.cpp:180
SpellCastResult DoCastAOE(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.h:161
SpellCastResult DoCast(uint32 spellId)
Definition: UnitAI.cpp:89
Definition: Unit.h:627
void SetFaction(uint32 faction) override
Definition: Unit.h:859
MotionMaster * GetMotionMaster()
Definition: Unit.h:1652
void RemoveNpcFlag(NPCFlags flags)
Definition: Unit.h:983
void SetNpcFlag(NPCFlags flags)
Definition: Unit.h:982
bool HasUnitState(const uint32 f) const
Definition: Unit.h:732
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
Definition: Unit.cpp:4664
void InterruptSpell(CurrentSpellTypes spellType, bool withDelayed=true, bool withInstant=true)
Definition: Unit.cpp:3017
InstanceScript * GetInstanceScript() const
Definition: Object.cpp:1042
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:2025
GameObject * SummonGameObject(uint32 entry, Position const &pos, QuaternionData const &rot, Seconds respawnTime, GOSummonType summonType=GO_SUMMON_TIMED_OR_CORPSE_DESPAWN)
Definition: Object.cpp:2065
virtual void SetData(uint32, uint32)
Definition: ZoneScript.h:92
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:203
constexpr float GetPositionX() const
Definition: Position.h:76
constexpr float GetPositionY() const
Definition: Position.h:77
constexpr float GetOrientation() const
Definition: Position.h:79
constexpr float GetPositionZ() const
Definition: Position.h:78
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
void UpdateAI(uint32 diff) override