TrinityCore
Loading...
Searching...
No Matches
waycrest_manor.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 "AreaTrigger.h"
19#include "AreaTriggerAI.h"
20#include "Conversation.h"
21#include "ConversationAI.h"
22#include "Creature.h"
23#include "InstanceScript.h"
24#include "Map.h"
25#include "MotionMaster.h"
26#include "ObjectAccessor.h"
27#include "Player.h"
28#include "ScriptMgr.h"
29#include "ScriptedCreature.h"
30#include "SpellAuraEffects.h"
31#include "SpellScript.h"
32#include "TaskScheduler.h"
33#include "waycrest_manor.h"
34
56
58{
59 // Conversations after Waycrests are defeated
63
64 PATH_GORAK_TUL = 13616100
65};
66
75
76// 135329 - Matron Bryndle
78{
79 npc_matron_bryndle(Creature* creature) : ScriptedAI(creature) { }
80
85
90
91 void JustEngagedWith(Unit* /*who*/) override
92 {
93 InstanceScript* instance = me->GetInstanceScript();
95 {
98
99 if (Creature* soulboundGoliath = instance->GetCreature(DATA_SOULBOUND_GOLIATH))
100 soulboundGoliath->AI()->DoAction(ACTION_SOULBOUND_GOLIATH_INTRO);
101
103 }
104
107 }
108
109 void UpdateAI(uint32 diff) override
110 {
111 if (!UpdateVictim())
112 return;
113
114 _events.Update(diff);
115
117 return;
118
119 switch (_events.ExecuteEvent())
120 {
122 {
124 _events.Repeat(24300ms);
125 break;
126 }
128 {
130 _events.Repeat(12100ms);
131 break;
132 }
133 default:
134 break;
135 }
136 }
137
138private:
140};
141
142// 265778 - Goliath Drain Flavor
160
161// 265741 - Drain Goliath Essence
163{
164 bool Validate(SpellInfo const* /*spellInfo*/) override
165 {
167 }
168
170 {
172
173 if (Creature* hitCreature = GetHitCreature())
174 hitCreature->DespawnOrUnsummon();
175 }
176
181};
182
183// 265759 - Splinter Spike
201
202// 260564 - Wildfire
204{
205 bool Validate(SpellInfo const* /*spellInfo*/) override
206 {
208 }
209
211 {
212 static constexpr Position CircleCenterPos = { -422.13f, -258.28f, 233.8286f, 0.0f };
213
214 return GetTarget()->GetRandomPoint(CircleCenterPos, 30.0f);
215 }
216
218 {
219 static constexpr Position RectTopRight = { -452.514f, -244.098f };
220 static constexpr Position RectBottomLeft = { -529.758f, -277.167f };
221
222 float x = frand(RectBottomLeft.GetPositionX(), RectTopRight.GetPositionX());
223 float y = frand(RectBottomLeft.GetPositionY(), RectTopRight.GetPositionY());
224 float z = GetTarget()->GetPositionZ();
225
227
228 return Position(x, y, z);
229 }
230
236
241};
242
243// 17041 - Wildfire (260570)
245{
246 at_waycrest_manor_wildfire(AreaTrigger* areatrigger) : AreaTriggerAI(areatrigger) { }
247
248 void OnUnitEnter(Unit* unit) override
249 {
250 if (Player* player = unit->ToPlayer())
251 {
252 if (!player->IsGameMaster())
253 unit->CastSpell(unit, SPELL_WILDFIRE_DAMAGE, true);
254 }
255 else
256 {
257 if (!unit->IsInCombat())
258 return;
259
260 if (unit->GetEntry() == BOSS_SOULBOUND_GOLIATH)
261 {
262 if (unit->HasAura(SPELL_BURNING_BRUSH))
263 return;
264
265 unit->CastSpell(unit, SPELL_BURNING_BRUSH, true);
266 }
267 else
268 unit->CastSpell(unit, SPELL_WILDFIRE_DAMAGE_NPC, true);
269 }
270 }
271
277};
278
279// 267643 - Organ Missiles
281{
283
284 void OnCreate(Spell const* /*creatingSpell*/) override
285 {
286 _scheduler.Schedule(100ms, 300ms, [this](TaskContext& task)
287 {
288 if (Unit* caster = at->GetCaster())
290
291 task.Repeat(100ms, 300ms);
292 });
293 }
294
295 void OnRemove() override
296 {
297 if (Unit* caster = at->GetCaster())
298 {
299 Creature* casterCreature = caster->ToCreature();
300 if (!casterCreature)
301 return;
302
303 InstanceScript* instance = casterCreature->GetInstanceScript();
304 if (!instance)
305 return;
306
308 casterCreature->SetUninteractible(false);
310 }
311 }
312
313 void OnUpdate(uint32 diff) override
314 {
315 _scheduler.Update(diff);
316 }
317
318private:
320};
321
322// 267646 - Organ Missiles
324{
326 {
327 dest.RelocateOffset({ frand(-26.0f, -15.0f), frand(-26.0f, 21.0f), 0.0f, 0.0f });
328 }
329
334};
335
336// 267595 - Waycrest Manor - Waycrests Defeated (Horde)
337// 267597 - Waycrest Manor - Waycrests Defeated (Alliance)
338// 7351 - Conversation
339// 7352 - Conversation
341{
342public:
344
345 void OnStart() override
346 {
348 _events.ScheduleEvent(EVENT_GORAK_TUL_TRANSFORM, *gorakTulMoveStartTimeAlliance);
349 else if (Milliseconds const* gorakTulMoveStartTimeHorde = conversation->GetLineStartTime(DEFAULT_LOCALE, CONVERSATION_LINE_GORAK_TUL_HORDE))
350 _events.ScheduleEvent(EVENT_GORAK_TUL_TRANSFORM, *gorakTulMoveStartTimeHorde + 3s);
351 }
352
353 void OnUpdate(uint32 diff) override
354 {
355 _events.Update(diff);
356
357 switch (_events.ExecuteEvent())
358 {
360 {
362 if (!gorakTul)
363 break;
364
365 gorakTul->CastSpell(gorakTul, SPELL_COSMETIC_MISSILE_TRANSFORM);
367 break;
368 }
370 {
372 if (!gorakTul)
373 break;
374
375 // @TODO: SplineFilter nyi
376 /*
377 ServerToClient: SMSG_ON_MONSTER_MOVE (0x2DD4) Length: 191 ConnIdx: 1 Time: 07/19/2024 09:17:19.888 Number: 8254
378 MoverGUID: Full: 0x204128E8C084F840001FF700001A1123 Creature/0 R4170/S8183 Map: 1862 (Waycrest Manor) Entry: 136161 (Gorak Tul) Low: 1708323
379 Position: X: -524.88715 Y: -260.56772 Z: 182.55463
380 (MovementMonsterSpline) (MovementSpline) Flags: 2438990336 (Flying, Catmullrom, CanSwim, UncompressedPath, Unknown5, Steering, Unknown10)
381 (MovementMonsterSpline) (MovementSpline) HasSplineFilter: True
382 (MovementMonsterSpline) (MovementSpline) (MonsterSplineFilter) MonsterSplineFilterKey: 2
383 (MovementMonsterSpline) (MovementSpline) (MonsterSplineFilter) BaseSpeed: 5
384 (MovementMonsterSpline) (MovementSpline) (MonsterSplineFilter) StartOffset: 0
385 (MovementMonsterSpline) (MovementSpline) (MonsterSplineFilter) DistToPrevFilterKey: 0
386 (MovementMonsterSpline) (MovementSpline) (MonsterSplineFilter) AddedToStart: 1
387 (MovementMonsterSpline) (MovementSpline) (MonsterSplineFilter) [0] IDx: 0
388 (MovementMonsterSpline) (MovementSpline) (MonsterSplineFilter) [0] Speed: 500
389 (MovementMonsterSpline) (MovementSpline) (MonsterSplineFilter) [1] IDx: 1
390 (MovementMonsterSpline) (MovementSpline) (MonsterSplineFilter) [1] Speed: 1500
391 (MovementMonsterSpline) (MovementSpline) (MonsterSplineFilter) FilterFlags: 2
392 (MovementMonsterSpline) (MovementSpline) [0] Points: X: -525.816 Y: -261.41666 Z: 188.96046
393 (MovementMonsterSpline) (MovementSpline) [1] Points: X: -532.49304 Y: -279.55383 Z: 186.57698
394 (MovementMonsterSpline) (MovementSpline) [2] Points: X: -526.13367 Y: -292.1389 Z: 185.22873
395 (MovementMonsterSpline) (MovementSpline) [3] Points: X: -501.00696 Y: -316.64932 Z: 171.55269
396 (MovementMonsterSpline) (MovementSpline) [4] Points: X: -488.12326 Y: -329.7795 Z: 161.65425
397 (MovementMonsterSpline) (MovementSpline) [5] Points: X: -470.80383 Y: -326.80557 Z: 159.51692
398 (MovementMonsterSpline) (MovementSpline) [6] Points: X: -460.06772 Y: -335.67188 Z: 158.33897
399 (MovementMonsterSpline) (MovementSpline) [7] Points: X: -446.75 Y: -343.94272 Z: 155.77182
400 (MovementMonsterSpline) (MovementSpline) [8] Points: X: -441.15625 Y: -344.0955 Z: 157.48708
401 (MovementMonsterSpline) (MovementSpline) CalculatedSpeedXY: 46.351273
402 */
403
404 gorakTul->SetFloating(true);
405 gorakTul->GetMotionMaster()->MovePath(PATH_GORAK_TUL, false);
406 break;
407 }
408 default:
409 break;
410 }
411 }
412
413private:
415};
416
AreaTriggerExitReason
Definition AreaTrigger.h:69
#define DEFAULT_LOCALE
Definition Common.h:69
uint32_t uint32
Definition Define.h:154
std::chrono::milliseconds Milliseconds
Milliseconds shorthand typedef.
Definition Duration.h:24
@ DONE
float frand(float min, float max)
Definition Random.cpp:55
bool roll_chance(T chance)
Definition Random.h:55
#define RegisterAreaTriggerAI(ai_name)
Definition ScriptMgr.h:1428
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1383
#define RegisterConversationAI(ai_name)
Definition ScriptMgr.h:1437
SpellEffIndex
@ EFFECT_0
@ TARGET_DEST_DEST
@ SPELL_EFFECT_DUMMY
@ HORDE
@ SPELL_AURA_PERIODIC_DUMMY
@ TRIGGERED_FULL_MASK
Used when doing CastSpell with triggered == true.
@ TRIGGERED_IGNORE_CAST_IN_PROGRESS
Will not check if a current cast is in progress.
#define SpellEffectFn(F, I, N)
#define AuraEffectPeriodicFn(F, I, N)
#define SpellDestinationTargetSelectFn(F, I, N)
@ UNIT_STATE_CASTING
Definition Unit.h:276
AreaTrigger *const at
Unit * GetCaster() const
uint32 GetTickNumber() const
HookList< EffectPeriodicHandler > OnEffectPeriodic
Unit * GetTarget() const
Conversation *const conversation
Milliseconds const * GetLineStartTime(LocaleConstant locale, int32 lineId) const
Creature * GetActorCreature(uint32 actorIdx) const
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:63
void SetFloating(bool floating)
Definition Creature.h:143
uint32 ExecuteEvent()
Definition EventMap.cpp:77
void Update(uint32 time)
Definition EventMap.h:61
void Repeat(Milliseconds time)
Definition EventMap.cpp:67
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition EventMap.cpp:40
Team GetTeamInInstance() const
Definition Map.h:903
Creature * GetCreature(uint32 type)
InstanceMap * instance
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={}, Optional< bool > exactSplinePath={}, bool generatePath=true, Optional< MovementFadeObject > fadeObject={}, Scripting::v2::ActionResultSetter< MovementStopReason > &&scriptResult={})
Player * ToPlayer()
Definition Object.h:126
uint32 GetEntry() const
Definition Object.h:89
Creature * ToCreature()
Definition Object.h:121
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
Creature * GetHitCreature() const
Unit * GetCaster() const
HookList< DestinationTargetSelectHandler > OnDestinationTargetSelect
Unit * GetHitUnit() const
HookList< EffectHandler > OnEffectHitTarget
Definition Spell.h:277
TaskContext & Repeat(TaskScheduler::duration_t duration)
TaskScheduler & Schedule(duration_t time, task_handler_t task)
TaskScheduler & Update()
Update the scheduler to the current time.
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:89
Definition Unit.h:635
MotionMaster * GetMotionMaster()
Definition Unit.h:1723
void SetUninteractible(bool apply)
Definition Unit.cpp:8564
bool HasUnitState(const uint32 f) const
Definition Unit.h:743
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
Definition Unit.cpp:4804
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3974
bool IsInCombat() const
Definition Unit.h:1058
Position GetRandomPoint(Position const &srcPos, float distance, float minDistance=0.0f) const
Definition Object.cpp:680
InstanceScript * GetInstanceScript() const
Definition Object.cpp:396
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2217
void UpdateGroundPositionZ(float x, float y, float &z) const
Definition Object.cpp:700
virtual uint32 GetData(uint32) const
Definition ZoneScript.h:99
virtual void SetData(uint32, uint32)
Definition ZoneScript.h:100
conversation_waycrest_manor_waycrests_defeated(Conversation *conversation)
bool Validate(SpellInfo const *) override
void SetDest(SpellDestination &dest)
bool Validate(SpellInfo const *) override
bool Validate(SpellInfo const *) override
void HandlePeriodic(AuraEffect const *aurEff)
constexpr float GetPositionX() const
Definition Position.h:87
constexpr float GetPositionY() const
Definition Position.h:88
constexpr void GetPosition(float &x, float &y) const
Definition Position.h:92
constexpr float GetPositionZ() const
Definition Position.h:89
void RelocateOffset(Position const &offset)
Definition Spell.cpp:90
at_waycrest_manor_organ_missiles(AreaTrigger *areatrigger)
void OnUpdate(uint32 diff) override
void OnCreate(Spell const *) override
void OnUnitEnter(Unit *unit) override
at_waycrest_manor_wildfire(AreaTrigger *areatrigger)
void OnUnitExit(Unit *unit, AreaTriggerExitReason) override
void UpdateAI(uint32 diff) override
void JustReachedHome() override
npc_matron_bryndle(Creature *creature)
void JustAppeared() override
void JustEngagedWith(Unit *) override
WaycrestManorMisc
@ CONVERSATION_LINE_LUCILLE_WAYCREST
@ CONVERSATION_LINE_GORAK_TUL_HORDE
@ CONVO_ACTOR_IDX_GORAK_TUL
@ PATH_GORAK_TUL
WaycrestManorSpells
@ SPELL_SPLINTER_SPIKE_MISSILE
@ SPELL_COSMETIC_MISSILE_TRANSFORM
@ SPELL_WAYCRESTS_DEFEATED_HORDE
@ SPELL_WAYCRESTS_DEFEATED_ALLIANCE
@ SPELL_WILDFIRE_DAMAGE
@ SPELL_ORGAN_MISSILES
@ SPELL_DEATH_REALM_PHASE
@ SPELL_GOLIATH_DRAIN_FLAVOR
@ SPELL_WILDFIRE_MISSILE
@ SPELL_SPLINTER_SPIKE_SELECTOR
@ SPELL_DRAIN_GOLIATH_ESSENCE
@ SPELL_THORNED_BARRAGE
@ SPELL_WILDFIRE_DAMAGE_NPC
@ SPELL_DRAIN_GOLIATH_ESSENCE_AREA
@ SPELL_GOLIATH_DRAIN_FLAVOR_PERIODIC
WaycrestManorEvents
@ EVENT_SPLINTER_SPIKE
@ EVENT_THORNED_BARRAGE
@ EVENT_GORAK_TUL_TRANSFORM
@ EVENT_GORAK_TUL_MOVE
void AddSC_waycrest_manor()
@ SPELL_BURNING_BRUSH
#define RegisterWaycrestManorCreatureAI(ai_name)
@ DATA_SOULBOUND_GOLIATH_INTRO
@ DATA_SOULBOUND_GOLIATH
@ BOSS_SOULBOUND_GOLIATH
@ ACTION_SOULBOUND_GOLIATH_INTRO