TrinityCore
culling_of_stratholme.h
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#ifndef CULLING_OF_STRATHOLME_H
19#define CULLING_OF_STRATHOLME_H
20
21#include "CreatureAIImpl.h"
22
23struct Position;
24
25#define DataHeader "CS"
26#define CoSScriptName "instance_culling_of_stratholme"
27
28uint32 constexpr EncounterCount = 5;
29
30/***********************************************************************************************************************\
31|************************* A DEVELOPER'S GUIDE TO FINDING YOUR WAY AROUND THIS INSTANCE SCRIPT *************************|
32|***********************************************************************************************************************|
33* The primary instance logic is split between the instance control script (instance_culling_of_stratholme.cpp) and *
34* Arthas' creature AI (npc_arthas.cpp). The instance script is responsible for global state management and control *
35* of the Scourge Wave event, as well as spawn control (ties into state management) with the help of the templated *
36* CreatureScript wrapper (CanSpawn override as well as Despawn checks on state change) defined in this very header. *
37* Arthas handles all the actual RP timings, pathing, spawns, casts and everything else, really. He also does tons *
38* of state control for himself (positional snapback and gossip/flag management). *
39* Communication between these two scripts (with some auxiliary other scripts throwing stuff in too) is handled *
40* via the SetData/SetGuidData/SetGUID methods on CreatureAI and InstanceScript (as appropriate), as well as *
41* data retrieval using GetData (instance states and the like). *
42* All values specified in this header find use across multiple files (used for communication between them) while *
43* the enums in the files themselves contain action IDs, event IDs, entries and whatnot that only find use in that *
44* particular file. *
45* Generally, any RP sequence will follow the form: *
46* 1. RP sequence is started (creature gossip sends SetGuidData with starting player GUID to InstanceScript) *
47* 2. InstanceScript verifies state consistency and advances the global instance state *
48* 3. InstanceScript passes the player GUID to Arthas AI using SetGUID. The int32 data type serves as action ID. *
49* 4. Arthas AI schedules all necessary events for the sequence and handles it from there using its UpdateAI loop. *
50* 5. At the end of the sequence, Arthas AI notifies the instance script (using SetData). *
51* 6. The instance script advances the global state again. This state change is propagated to Arthas AI (SetData). *
52* 7. Arthas AI is notified of a state change, gets current progress (GetData) and adjusts gossip availability etc. *
53* 8. The cycle repeats. RP sequences (as above) can (and do) also include combat sequences and similar. *
54|***********************************************************************************************************************|
55|*********************************************** KEY METHODS TO LOOK FOR ***********************************************|
56|***********************************************************************************************************************|
57* Arthas AI: (npc_arthas_stratholmeAI in npc_arthas.cpp) *
58* - AdvanceToState: *
59* - handles all the state updating/position consistency logic *
60* - invoked from SetData when the instance script notifies Arthas of a state change *
61* - ScheduleActionOOC: *
62* - queues the specified action to be passed to DoAction after Arthas finishes combat (JustReachedHome) *
63* - typically called during RP sequences just after ensuring Arthas has entered combat with all enemies involved *
64* - MovementInform: *
65* - handles movement notifications not just for Arthas, but also some other creatures that run RP slave AI *
66* - all movement IDs are taken from one single PointIDs enum, which means they are still unique *
67* - EnterCombat: *
68* - stores the current spline chain state so we can resume after (JustReachedHome) *
69|***********************************************************************************************************************|
70* Instance script: (instance_culling_of_stratholme in instance_culling_of_stratholme.cpp) *
71* - GetStableStateFor: *
72* - handles state regression; only certain states should be loaded after a wipe/soft reset *
73* - SetInstanceProgress: *
74* - any changing of the global instance state is done through this method *
75* - handles world state adjustments, spawn control (through AI notification) as well as reset behavior *
76* - SetWorldState/PropagateWorldStateUpdate: *
77* - the instance script stores a std::map of all current world state values for the instance *
78* - SetWorldState adjusts this map, PropagateWorldStateUpdate sends any changed values to all players *
79* - FillInitialWorldStates also draws upon this map to ensure all players have the same states at all times *
80|***********************************************************************************************************************|
81* Spawn control script: (StratholmeCreatureScript<ParentAI> in culling_of_stratholme.h) *
82* - CanSpawn override: *
83* - gets current instance state using GetData, then checks if we should be allowed to respawn (bitmask check) *
84* - StratholmeNPCAIWrapper::CheckDespawn: *
85* - gets current instance state using GetData, then checks if we should despawn ourselves (bitmask check) *
86\***********************************************************************************************************************/
87
88// Note: These are bitmask values to allow combining, but only a single bit will ever be true in instance script
90{
91 JUST_STARTED = 0x00001, // dungeon just started, crate count not visible yet; pending chromie interaction
92 CRATES_IN_PROGRESS = 0x00002, // freshly started dungeon, players are revealing scourge crates
93 CRATES_DONE = 0x00004, // all crates revealed, chromie spawns at Stratholme entrance; waiting for player input to begin first RP event
94 UTHER_TALK = 0x00008, // RP event in progress, Uther+Arthas talking
95 PURGE_PENDING = 0x00010, // RP event done, pending player input to start wave event
96 PURGE_STARTING = 0x00020, // Arthas entering Stratholme, RP sequence with Mal'ganis
97 WAVES_IN_PROGRESS = 0x00040, // first section is underway, players are battling waves
98 WAVES_DONE = 0x00080, // wave section completed; Arthas moving to take position in front of Stratholme Town Hall
99 TOWN_HALL_PENDING = 0x00100, // Arthas has reached the Town Hall; pending player input to begin escort section
100 TOWN_HALL = 0x00200, // now escorting Arthas through Stratholme Town Hall
101 TOWN_HALL_COMPLETE = 0x00400, // Town Hall event complete, third boss defeated; pending player input to begin gauntlet transition
102 GAUNTLET_TRANSITION = 0x00800, // Arthas is leading players through the secret passage from Town Hall to the gauntlet
103 GAUNTLET_PENDING = 0x01000, // Pending player input to begin escorting Arthas through the final gauntlet section
104 GAUNTLET_IN_PROGRESS = 0x02000, // Arthas is being escorted through the gauntlet section
105 GAUNTLET_COMPLETE = 0x04000, // Arthas has reached the end of the gauntlet section; player input pending to begin Mal'ganis encounter
106 MALGANIS_IN_PROGRESS = 0x08000, // Arthas has moved into the final square and Mal'ganis encounter begins
107 COMPLETE = 0x10000, // Mal'ganis encounter is completed; dungeon over
108
109 ALL = 0x1FFFF
111COSProgressStates GetStableStateFor(COSProgressStates const state); // defined by instance script
112Position const& GetArthasSnapbackFor(COSProgressStates state); // defined by arthas script
113
115{
122
124 DATA_GM_RECALL, // sent by chromie #1 in response to GM recall command (teleport all to arthas)
125 DATA_GM_OVERRIDE, // sent by chromie #1 in response to GM instance state change commands
126 DATA_ARTHAS_DIED, // failure signal, sent by arthas AI on death - regress instance
127 DATA_CRATES_START, // sent by chromie #1 creature script to initiate crate phase
128 DATA_CRATE_REVEALED, // sent by crate helper AI to trigger re-check of crate status
129 DATA_UTHER_START, // sent by chromie #2 creature script to initiate uther RP sequence
130 DATA_UTHER_FINISHED, // sent by arthas AI to signal transition to pre-purge
131 DATA_SKIP_TO_PURGE, // sent by chromie #1 creature script to skip straight to start of purge
132 DATA_START_PURGE, // sent by arthas creature script to begin pre-purge RP event
133 DATA_START_WAVES, // sent by arthas AI to begin wave event
134 DATA_NOTIFY_DEATH, // sent by wave mob AI to instance script on death
135 DATA_REACH_TOWN_HALL, // sent by arthas AI once he reaches stratholme town hall
136 DATA_START_TOWN_HALL, // sent by arthas creature script to begin town hall sequence
137 DATA_TOWN_HALL_DONE, // sent by arthas AI once Epoch is defeated
138 DATA_TO_GAUNTLET, // sent by arthas creature script to begin gauntlet transition
139 DATA_GAUNTLET_REACHED, // sent by arthas AI once he arrives at the beginning of the gauntlet section
140 DATA_START_GAUNTLET, // sent by arthas creature script to begin gauntlet escort
141 DATA_GAUNTLET_DONE, // sent by arthas AI once he arrives at the end of the gauntlet section
142 DATA_START_MALGANIS, // sent by arthas creature script to begin mal'ganis event
143 DATA_MALGANIS_DONE // sent by arthas AI once mal'ganis outro is over
145
146// these are sent by instance AI to creatures; they are passed as negative values to avoid conflicts with creature script specific actions
148{
151 ACTION_START_RP_EVENT1, // Arthas/Uther chat in front of town
152 ACTION_START_RP_EVENT2, // Arthas/Mal'ganis chat at entrance
153 ACTION_START_RP_EVENT3, // Town Hall sequence
154 ACTION_START_RP_EVENT4_1, // Bookcase transition sequence
155 ACTION_START_RP_EVENT4_2, // Gauntlet escort phase
156 ACTION_START_RP_EVENT5 // Mal'ganis encounter
158
160{
161 NPC_ARTHAS = 26499,
169
170template <class AI, class T>
171inline AI* GetCullingOfStratholmeAI(T* obj)
172{
173 return GetInstanceAI<AI>(obj, CoSScriptName);
174}
175
176#endif
uint32_t uint32
Definition: Define.h:142
Position const & GetArthasSnapbackFor(COSProgressStates state)
AI * GetCullingOfStratholmeAI(T *obj)
@ DATA_START_MALGANIS
@ DATA_SKIP_TO_PURGE
@ DATA_INSTANCE_PROGRESS
@ DATA_ARTHAS_DIED
@ DATA_GAUNTLET_DONE
@ DATA_MALGANIS_DONE
@ DATA_TO_GAUNTLET
@ DATA_START_GAUNTLET
@ DATA_START_WAVES
@ DATA_GM_OVERRIDE
@ DATA_UTHER_START
@ DATA_CRATES_START
@ DATA_TOWN_HALL_DONE
@ DATA_NOTIFY_DEATH
@ DATA_REACH_TOWN_HALL
@ DATA_START_TOWN_HALL
@ DATA_MEATHOOK
@ DATA_GM_RECALL
@ DATA_GAUNTLET_REACHED
@ DATA_START_PURGE
@ DATA_MAL_GANIS
@ DATA_INFINITE_CORRUPTOR
@ DATA_CRATE_REVEALED
@ DATA_UTHER_FINISHED
@ NUM_BOSS_ENCOUNTERS
@ DATA_SALRAMM
#define CoSScriptName
COSProgressStates GetStableStateFor(COSProgressStates const state)
COSInstanceActions
@ ACTION_START_RP_EVENT2
@ ACTION_CORRUPTOR_LEAVE
@ ACTION_PROGRESS_UPDATE
@ ACTION_START_RP_EVENT3
@ ACTION_START_RP_EVENT1
@ ACTION_START_RP_EVENT4_2
@ ACTION_START_RP_EVENT4_1
@ ACTION_START_RP_EVENT5
COSProgressStates
@ UTHER_TALK
@ JUST_STARTED
@ TOWN_HALL_COMPLETE
@ CRATES_IN_PROGRESS
@ GAUNTLET_IN_PROGRESS
@ TOWN_HALL_PENDING
@ CRATES_DONE
@ GAUNTLET_PENDING
@ WAVES_DONE
@ MALGANIS_IN_PROGRESS
@ WAVES_IN_PROGRESS
@ GAUNTLET_TRANSITION
@ PURGE_PENDING
@ PURGE_STARTING
@ GAUNTLET_COMPLETE
COSInstanceEntries
@ SPAWNGRP_UNDEAD_TRASH
@ GO_HIDDEN_PASSAGE
@ SPAWNGRP_RESIDENTS
@ SPAWNGRP_GAUNTLET_TRASH
@ SPAWNGRP_CHROMIE_MID
@ SPAWNGRP_CRATE_HELPERS
uint32 constexpr EncounterCount