AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
instance_karazhan::instance_karazhan_InstanceMapScript Struct Reference
Inheritance diagram for instance_karazhan::instance_karazhan_InstanceMapScript:
InstanceScript ZoneScript

Public Member Functions

 instance_karazhan_InstanceMapScript (Map *map)
 
void OnCreatureCreate (Creature *creature) override
 
void OnUnitDeath (Unit *unit) override
 
void SetData (uint32 type, uint32 data) override
 
bool SetBossState (uint32 type, EncounterState state) override
 
void SetGuidData (uint32 type, ObjectGuid data) override
 
void OnGameObjectCreate (GameObject *go) override
 
uint32 GetData (uint32 type) const override
 
void DoAction (int32 actionId) override
 
ObjectGuid GetGuidData (uint32 data) const override
 
- Public Member Functions inherited from InstanceScript
 InstanceScript (Map *map)
 
 ~InstanceScript () override
 
virtual void Initialize ()
 
virtual void Load (char const *data)
 
virtual void CreatureLooted (Creature *, LootType)
 
virtual std::string GetSaveData ()
 
void SaveToDB ()
 
virtual void Update (uint32)
 
virtual bool IsEncounterInProgress () const
 
void OnCreatureCreate (Creature *creature) override
 
void OnCreatureRemove (Creature *creature) override
 
void OnGameObjectCreate (GameObject *go) override
 
void OnGameObjectRemove (GameObject *go) override
 
ObjectGuid GetObjectGuid (uint32 type) const
 
ObjectGuid GetGuidData (uint32 type) const override
 
CreatureGetCreature (uint32 type)
 
GameObjectGetGameObject (uint32 type)
 
virtual void OnPlayerEnter (Player *)
 
virtual void OnPlayerAreaUpdate (Player *, uint32, uint32)
 
virtual void OnPlayerInWaterStateUpdate (Player *, bool)
 
void HandleGameObject (ObjectGuid guid, bool open, GameObject *go=nullptr)
 
void DoUseDoorOrButton (ObjectGuid guid, uint32 withRestoreTime=0, bool useAlternativeState=false)
 
void DoRespawnGameObject (ObjectGuid guid, uint32 timeToDespawn=MINUTE)
 
void DoRespawnCreature (ObjectGuid guid, bool force=false)
 
void DoRespawnCreature (uint32 type, bool force=false)
 
void DoUpdateWorldState (uint32 worldstateId, uint32 worldstateValue)
 
void DoSendNotifyToInstance (char const *format,...)
 
void DoUpdateAchievementCriteria (AchievementCriteriaTypes type, uint32 miscValue1=0, uint32 miscValue2=0, Unit *unit=nullptr)
 
void DoStartTimedAchievement (AchievementCriteriaTimedTypes type, uint32 entry)
 
void DoStopTimedAchievement (AchievementCriteriaTimedTypes type, uint32 entry)
 
void DoRemoveAurasDueToSpellOnPlayers (uint32 spell)
 
void DoCastSpellOnPlayers (uint32 spell)
 
void DoCastSpellOnPlayer (Player *player, uint32 spell, bool includePets, bool includeControlled)
 
bool ServerAllowsTwoSideGroups ()
 
virtual bool SetBossState (uint32 id, EncounterState state)
 
EncounterState GetBossState (uint32 id) const
 
CreatureBoundary const * GetBossBoundary (uint32 id) const
 
BossInfo const * GetBossInfo (uint32 id) const
 
uint32 GetPersistentData (uint32 index) const
 
void StorePersistentData (uint32 index, uint32 data)
 
virtual bool CheckAchievementCriteriaMeet (uint32, Player const *, Unit const *=nullptr, uint32=0)
 
virtual bool CheckRequiredBosses (uint32, Player const *=nullptr) const
 
void SetCompletedEncountersMask (uint32 newMask, bool save)
 
uint32 GetCompletedEncounterMask () const
 
void SendEncounterUnit (uint32 type, Unit *unit=nullptr, uint8 param1=0, uint8 param2=0)
 
virtual void FillInitialWorldStates (WorldPacket &)
 
uint32 GetEncounterCount () const
 
void MarkAreaTriggerDone (uint32 id)
 
void ResetAreaTriggerDone (uint32 id)
 
bool IsAreaTriggerDone (uint32 id) const
 
virtual void DoAction (int32)
 
void DoForAllMinions (uint32 id, std::function< void(Creature *)> exec)
 
void StoreGameObjectState (ObjectGuid::LowType spawnId, uint8 state)
 
uint8 GetStoredGameObjectState (ObjectGuid::LowType spawnId) const
 
void LoadInstanceSavedGameobjectStateData ()
 
bool IsBossDone (uint32 bossId) const
 
bool AllBossesDone () const
 
bool AllBossesDone (std::initializer_list< uint32 > bossIds) const
 
- Public Member Functions inherited from ZoneScript
 ZoneScript ()
 
virtual ~ZoneScript ()
 
virtual uint32 GetCreatureEntry (ObjectGuid::LowType, CreatureData const *data)
 
virtual uint32 GetGameObjectEntry (ObjectGuid::LowType, uint32 entry)
 
virtual void OnCreatureCreate (Creature *)
 
virtual void OnCreatureRemove (Creature *)
 
virtual void OnGameObjectCreate (GameObject *)
 
virtual void OnGameObjectRemove (GameObject *)
 
virtual void OnUnitDeath (Unit *)
 
virtual void OnCreatureEvade (Creature *)
 
virtual ObjectGuid GetGuidData (uint32) const
 
virtual void SetGuidData (uint32, ObjectGuid)
 
virtual uint64 GetData64 (uint32) const
 
virtual void SetData64 (uint32, uint64)
 
virtual uint32 GetData (uint32) const
 
virtual void SetData (uint32, uint32)
 
virtual void ProcessEvent (WorldObject *, uint32)
 

Private Attributes

uint32 OperaEvent
 
uint32 OzDeathCount
 
uint32 OptionalBossCount
 
uint32 _chessTeam
 
uint32 _chessGamePhase
 
uint32 _chessEvent
 
ObjectGuid m_uiCurtainGUID
 
ObjectGuid m_uiStageDoorLeftGUID
 
ObjectGuid m_uiStageDoorRightGUID
 
ObjectGuid m_uiKilrekGUID
 
ObjectGuid m_uiTerestianGUID
 
ObjectGuid m_uiMoroesGUID
 
ObjectGuid m_uiNightBaneGUID
 
ObjectGuid m_uiLibraryDoor
 
ObjectGuid m_uiMassiveDoor
 
ObjectGuid m_uiGamesmansDoor
 
ObjectGuid m_uiGamesmansExitDoor
 
ObjectGuid ImageGUID
 
ObjectGuid DustCoveredChest
 
ObjectGuid m_uiRelayGUID
 
ObjectGuid _barnesGUID
 
ObjectGuid _echoOfMedivhGUID
 
GuidVector _operaDecorations [EVENT_RAJ]
 
GuidSet _chessPiecesGUID
 
GuidSet _medivhCheatFiresGUID
 

Additional Inherited Members

- Static Public Member Functions inherited from InstanceScript
static std::string GetBossStateName (uint8 state)
 
- Public Attributes inherited from InstanceScript
Mapinstance
 
TaskScheduler scheduler
 
- Protected Member Functions inherited from InstanceScript
void SetHeaders (std::string const &dataHeaders)
 
void SetBossNumber (uint32 number)
 
void SetPersistentDataCount (uint32 number)
 
void LoadBossBoundaries (BossBoundaryData const &data)
 
void LoadDoorData (DoorData const *data)
 
void LoadMinionData (MinionData const *data)
 
void LoadObjectData (ObjectData const *creatureData, ObjectData const *gameObjectData)
 
void AddObject (Creature *obj, bool add=true)
 
void RemoveObject (Creature *obj)
 
void AddObject (GameObject *obj, bool add=true)
 
void RemoveObject (GameObject *obj)
 
void AddObject (WorldObject *obj, uint32 type, bool add=true)
 
void RemoveObject (WorldObject *obj, uint32 type)
 
void AddDoor (GameObject *door, bool add=true)
 
void RemoveDoor (GameObject *door)
 
void AddMinion (Creature *minion, bool add=true)
 
void RemoveMinion (Creature *minion)
 
void UpdateDoorState (GameObject *door)
 
void UpdateMinionState (Creature *minion, EncounterState state)
 
bool ReadSaveDataHeaders (std::istringstream &data)
 
void ReadSaveDataBossStates (std::istringstream &data)
 
void ReadSavePersistentData (std::istringstream &data)
 
virtual void ReadSaveDataMore (std::istringstream &)
 
void WriteSaveDataHeaders (std::ostringstream &data)
 
void WriteSaveDataBossStates (std::ostringstream &data)
 
void WritePersistentData (std::ostringstream &data)
 
virtual void WriteSaveDataMore (std::ostringstream &)
 

Detailed Description

Constructor & Destructor Documentation

◆ instance_karazhan_InstanceMapScript()

instance_karazhan::instance_karazhan_InstanceMapScript::instance_karazhan_InstanceMapScript ( Map map)
inline
79 : InstanceScript(map)
80 {
85
86 // 1 - OZ, 2 - HOOD, 3 - RAJ, this never gets altered.
88 OzDeathCount = 0;
90
94 }
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:44
@ NOT_STARTED
Definition: InstanceScript.h:57
#define DataHeader
Definition: blackrock_depths.h:23
uint32 const EncounterCount
Definition: blackrock_spire.h:23
@ CHESS_PHASE_NOT_STARTED
Definition: karazhan.h:189
@ EVENT_OZ
Definition: karazhan.h:81
@ EVENT_RAJ
Definition: karazhan.h:83
ObjectData const gameObjectData[]
Definition: instance_karazhan.cpp:53
ObjectData const creatureData[]
Definition: instance_karazhan.cpp:36
DoorData const doorData[]
Definition: instance_karazhan.cpp:59
@ TEAM_NEUTRAL
Definition: SharedDefines.h:762
Definition: InstanceScript.h:142
void SetBossNumber(uint32 number)
Definition: InstanceScript.h:285
void LoadDoorData(DoorData const *data)
Definition: InstanceScript.cpp:161
void SetHeaders(std::string const &dataHeaders)
Definition: InstanceScript.cpp:138
void LoadObjectData(ObjectData const *creatureData, ObjectData const *gameObjectData)
Definition: InstanceScript.cpp:173
uint32 OperaEvent
Definition: instance_karazhan.cpp:501
uint32 OzDeathCount
Definition: instance_karazhan.cpp:502
uint32 _chessTeam
Definition: instance_karazhan.cpp:504
uint32 _chessEvent
Definition: instance_karazhan.cpp:506
uint32 OptionalBossCount
Definition: instance_karazhan.cpp:503
uint32 _chessGamePhase
Definition: instance_karazhan.cpp:505

References _chessEvent, _chessGamePhase, _chessTeam, CHESS_PHASE_NOT_STARTED, creatureData, DataHeader, doorData, EncounterCount, EVENT_OZ, EVENT_RAJ, gameObjectData, InstanceScript::LoadDoorData(), InstanceScript::LoadObjectData(), NOT_STARTED, OperaEvent, OptionalBossCount, OzDeathCount, InstanceScript::SetBossNumber(), InstanceScript::SetHeaders(), TEAM_NEUTRAL, and urand().

Member Function Documentation

◆ DoAction()

void instance_karazhan::instance_karazhan_InstanceMapScript::DoAction ( int32  actionId)
inlineoverridevirtual

Reimplemented from InstanceScript.

428 {
429 if (actionId == ACTION_SCHEDULE_RAJ_CHECK)
430 {
431 scheduler.Schedule(10s, [this](TaskContext)
432 {
435
436 if (julliane && romulo)
437 {
440 {
441 julliane->KillSelf();
443 romulo->KillSelf();
445 }
446 else
447 {
449 {
450 julliane->AI()->DoAction(ACTION_RESS_ROMULO);
451 }
452
454 {
455 julliane->AI()->DoAction(ACTION_DO_RESURRECT);
456 }
457 }
458 }
459 });
460 }
461 }
@ UNIT_FLAG_NOT_SELECTABLE
Definition: UnitDefines.h:254
@ ACTION_DO_RESURRECT
Definition: karazhan.h:209
@ ACTION_SCHEDULE_RAJ_CHECK
Definition: karazhan.h:207
@ ACTION_RESS_ROMULO
Definition: karazhan.h:210
@ DATA_ROMULO
Definition: karazhan.h:70
@ DATA_JULIANNE
Definition: karazhan.h:71
TaskScheduler & Schedule(std::chrono::duration< _Rep, _Period > const &time, task_handler_t const &task)
Definition: TaskScheduler.h:229
Definition: TaskScheduler.h:415
virtual void DoAction(int32)
Definition: UnitAI.h:212
Definition: Creature.h:46
CreatureAI * AI() const
Definition: Creature.h:143
bool HasUnitFlag(UnitFlags flags) const
Definition: Unit.h:682
void KillSelf(bool durabilityLoss=true, WeaponAttackType attackType=BASE_ATTACK, SpellInfo const *spellProto=nullptr, Spell const *spell=nullptr)
Definition: Unit.h:999
void RemoveUnitFlag(UnitFlags flags)
UnitFlags available in UnitDefines.h.
Definition: Unit.h:684
Creature * GetCreature(uint32 type)
Definition: InstanceScript.cpp:100
TaskScheduler scheduler
Definition: InstanceScript.h:282

References ACTION_DO_RESURRECT, ACTION_RESS_ROMULO, ACTION_SCHEDULE_RAJ_CHECK, Creature::AI(), DATA_JULIANNE, DATA_ROMULO, UnitAI::DoAction(), InstanceScript::GetCreature(), Unit::HasUnitFlag(), Unit::KillSelf(), Unit::RemoveUnitFlag(), TaskScheduler::Schedule(), InstanceScript::scheduler, and UNIT_FLAG_NOT_SELECTABLE.

◆ GetData()

uint32 instance_karazhan::instance_karazhan_InstanceMapScript::GetData ( uint32  type) const
inlineoverridevirtual

Reimplemented from ZoneScript.

409 {
410 switch (type)
411 {
413 return OperaEvent;
415 return OzDeathCount;
416 case CHESS_EVENT_TEAM:
417 return _chessTeam;
419 return _chessGamePhase;
420 case DATA_CHESS_EVENT:
421 return _chessEvent;
422 }
423
424 return 0;
425 }
@ DATA_CHESS_GAME_PHASE
Definition: karazhan.h:64
@ DATA_CHESS_EVENT
Definition: karazhan.h:39
@ CHESS_EVENT_TEAM
Definition: karazhan.h:62
@ DATA_OPERA_OZ_DEATHCOUNT
Definition: karazhan.h:43
@ DATA_OPERA_PERFORMANCE
Definition: karazhan.h:34

References _chessEvent, _chessGamePhase, _chessTeam, CHESS_EVENT_TEAM, DATA_CHESS_EVENT, DATA_CHESS_GAME_PHASE, DATA_OPERA_OZ_DEATHCOUNT, DATA_OPERA_PERFORMANCE, OperaEvent, and OzDeathCount.

◆ GetGuidData()

ObjectGuid instance_karazhan::instance_karazhan_InstanceMapScript::GetGuidData ( uint32  data) const
inlineoverridevirtual

Reimplemented from InstanceScript.

464 {
465 switch (data)
466 {
467 case DATA_KILREK:
468 return m_uiKilrekGUID;
469 case DATA_TERESTIAN:
470 return m_uiTerestianGUID;
471 case DATA_MOROES:
472 return m_uiMoroesGUID;
477 case DATA_GO_CURTAINS:
478 return m_uiCurtainGUID;
480 return m_uiLibraryDoor;
482 return m_uiMassiveDoor;
484 return m_uiGamesmansDoor;
488 return ImageGUID;
489 case DATA_NIGHTBANE:
490 return m_uiNightBaneGUID;
492 return _echoOfMedivhGUID;
494 return DustCoveredChest;
495 }
496
497 return ObjectGuid::Empty;
498 }
@ DATA_KILREK
Definition: karazhan.h:44
@ DATA_GO_STAGEDOORRIGHT
Definition: karazhan.h:50
@ DATA_GO_CURTAINS
Definition: karazhan.h:48
@ DATA_GO_MASSIVE_DOOR
Definition: karazhan.h:52
@ DATA_GO_STAGEDOORLEFT
Definition: karazhan.h:49
@ DATA_GO_GAME_EXIT_DOOR
Definition: karazhan.h:54
@ DATA_ECHO_OF_MEDIVH
Definition: karazhan.h:65
@ DATA_IMAGE_OF_MEDIVH
Definition: karazhan.h:55
@ DATA_DUST_COVERED_CHEST
Definition: karazhan.h:66
@ DATA_TERESTIAN
Definition: karazhan.h:37
@ DATA_GO_GAME_DOOR
Definition: karazhan.h:53
@ DATA_MOROES
Definition: karazhan.h:31
@ DATA_GO_LIBRARY_DOOR
Definition: karazhan.h:51
@ DATA_NIGHTBANE
Definition: karazhan.h:41
static ObjectGuid const Empty
Definition: ObjectGuid.h:120
ObjectGuid m_uiMassiveDoor
Definition: instance_karazhan.cpp:516
ObjectGuid _echoOfMedivhGUID
Definition: instance_karazhan.cpp:523
ObjectGuid m_uiGamesmansDoor
Definition: instance_karazhan.cpp:517
ObjectGuid m_uiGamesmansExitDoor
Definition: instance_karazhan.cpp:518
ObjectGuid m_uiLibraryDoor
Definition: instance_karazhan.cpp:515
ObjectGuid m_uiKilrekGUID
Definition: instance_karazhan.cpp:511
ObjectGuid m_uiCurtainGUID
Definition: instance_karazhan.cpp:508
ObjectGuid DustCoveredChest
Definition: instance_karazhan.cpp:520
ObjectGuid m_uiStageDoorLeftGUID
Definition: instance_karazhan.cpp:509
ObjectGuid m_uiMoroesGUID
Definition: instance_karazhan.cpp:513
ObjectGuid m_uiTerestianGUID
Definition: instance_karazhan.cpp:512
ObjectGuid m_uiStageDoorRightGUID
Definition: instance_karazhan.cpp:510
ObjectGuid ImageGUID
Definition: instance_karazhan.cpp:519
ObjectGuid m_uiNightBaneGUID
Definition: instance_karazhan.cpp:514

References _echoOfMedivhGUID, DATA_DUST_COVERED_CHEST, DATA_ECHO_OF_MEDIVH, DATA_GO_CURTAINS, DATA_GO_GAME_DOOR, DATA_GO_GAME_EXIT_DOOR, DATA_GO_LIBRARY_DOOR, DATA_GO_MASSIVE_DOOR, DATA_GO_STAGEDOORLEFT, DATA_GO_STAGEDOORRIGHT, DATA_IMAGE_OF_MEDIVH, DATA_KILREK, DATA_MOROES, DATA_NIGHTBANE, DATA_TERESTIAN, DustCoveredChest, ObjectGuid::Empty, ImageGUID, m_uiCurtainGUID, m_uiGamesmansDoor, m_uiGamesmansExitDoor, m_uiKilrekGUID, m_uiLibraryDoor, m_uiMassiveDoor, m_uiMoroesGUID, m_uiNightBaneGUID, m_uiStageDoorLeftGUID, m_uiStageDoorRightGUID, and m_uiTerestianGUID.

◆ OnCreatureCreate()

void instance_karazhan::instance_karazhan_InstanceMapScript::OnCreatureCreate ( Creature creature)
inlineoverridevirtual

Reimplemented from InstanceScript.

97 {
98 switch (creature->GetEntry())
99 {
100 case NPC_KILREK:
101 m_uiKilrekGUID = creature->GetGUID();
102 break;
104 m_uiTerestianGUID = creature->GetGUID();
105 break;
106 case NPC_MOROES:
107 m_uiMoroesGUID = creature->GetGUID();
108 break;
109 case NPC_NIGHTBANE:
110 m_uiNightBaneGUID = creature->GetGUID();
111 break;
112 case NPC_RELAY:
113 m_uiRelayGUID = creature->GetGUID();
114 break;
115 case NPC_BARNES:
116 _barnesGUID = creature->GetGUID();
117 if (GetBossState(DATA_OPERA_PERFORMANCE) != DONE && !creature->IsAlive())
118 {
119 creature->Respawn(true);
120 }
121 break;
122 case NPC_PAWN_H:
123 case NPC_KNIGHT_H:
124 case NPC_QUEEN_H:
125 case NPC_BISHOP_H:
126 case NPC_ROOK_H:
127 case NPC_KING_H:
128 case NPC_PAWN_A:
129 case NPC_KNIGHT_A:
130 case NPC_QUEEN_A:
131 case NPC_BISHOP_A:
132 case NPC_ROOK_A:
133 case NPC_KING_A:
134 _chessPiecesGUID.insert(creature->GetGUID());
135 creature->SetHealth(creature->GetMaxHealth());
136 break;
138 _medivhCheatFiresGUID.insert(creature->GetGUID());
139 break;
141 _echoOfMedivhGUID = creature->GetGUID();
142 break;
143 case NPC_FIENDISH_IMP:
144 if (Creature* terestrian = GetCreature(DATA_TERESTIAN))
145 {
146 if (terestrian->AI())
147 {
148 terestrian->AI()->JustSummoned(creature);
149 creature->SetInCombatWithZone();
150 }
151 }
152 break;
153 default:
154 break;
155 }
156
158 }
@ DONE
Definition: InstanceScript.h:60
@ NPC_ECHO_OF_MEDIVH
Definition: karazhan.h:121
@ NPC_QUEEN_H
Definition: karazhan.h:126
@ NPC_ROOK_A
Definition: karazhan.h:131
@ NPC_KNIGHT_H
Definition: karazhan.h:124
@ NPC_KING_A
Definition: karazhan.h:133
@ NPC_TERESTIAN_ILLHOOF
Definition: karazhan.h:91
@ NPC_MOROES
Definition: karazhan.h:92
@ NPC_PAWN_H
Definition: karazhan.h:122
@ NPC_KILREK
Definition: karazhan.h:108
@ NPC_PAWN_A
Definition: karazhan.h:123
@ NPC_FIENDISH_IMP
Definition: karazhan.h:118
@ NPC_ROOK_H
Definition: karazhan.h:130
@ NPC_NIGHTBANE
Definition: karazhan.h:96
@ NPC_BARNES
Definition: karazhan.h:110
@ NPC_KING_H
Definition: karazhan.h:132
@ NPC_QUEEN_A
Definition: karazhan.h:127
@ NPC_BISHOP_H
Definition: karazhan.h:128
@ NPC_CHESS_EVENT_MEDIVH_CHEAT_FIRES
Definition: karazhan.h:134
@ NPC_BISHOP_A
Definition: karazhan.h:129
@ NPC_RELAY
Definition: karazhan.h:109
@ NPC_KNIGHT_A
Definition: karazhan.h:125
void SetInCombatWithZone()
Set in combat all units in the dungeon/raid. Affect only units with IsAIEnabled.
Definition: Creature.cpp:2806
void Respawn(bool force=false)
Definition: Creature.cpp:2030
uint32 GetEntry() const
Definition: Object.h:112
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:109
uint32 GetMaxHealth() const
Definition: Unit.h:870
bool IsAlive() const
Definition: Unit.h:1204
void SetHealth(uint32 val)
Definition: Unit.cpp:15433
void OnCreatureCreate(Creature *creature) override
Definition: InstanceScript.cpp:58
EncounterState GetBossState(uint32 id) const
Definition: InstanceScript.h:235
ObjectGuid m_uiRelayGUID
Definition: instance_karazhan.cpp:521
GuidSet _chessPiecesGUID
Definition: instance_karazhan.cpp:526
ObjectGuid _barnesGUID
Definition: instance_karazhan.cpp:522
GuidSet _medivhCheatFiresGUID
Definition: instance_karazhan.cpp:527

References _barnesGUID, _chessPiecesGUID, _echoOfMedivhGUID, _medivhCheatFiresGUID, DATA_OPERA_PERFORMANCE, DATA_TERESTIAN, DONE, InstanceScript::GetBossState(), InstanceScript::GetCreature(), Object::GetEntry(), Object::GetGUID(), Unit::GetMaxHealth(), Unit::IsAlive(), m_uiKilrekGUID, m_uiMoroesGUID, m_uiNightBaneGUID, m_uiRelayGUID, m_uiTerestianGUID, NPC_BARNES, NPC_BISHOP_A, NPC_BISHOP_H, NPC_CHESS_EVENT_MEDIVH_CHEAT_FIRES, NPC_ECHO_OF_MEDIVH, NPC_FIENDISH_IMP, NPC_KILREK, NPC_KING_A, NPC_KING_H, NPC_KNIGHT_A, NPC_KNIGHT_H, NPC_MOROES, NPC_NIGHTBANE, NPC_PAWN_A, NPC_PAWN_H, NPC_QUEEN_A, NPC_QUEEN_H, NPC_RELAY, NPC_ROOK_A, NPC_ROOK_H, NPC_TERESTIAN_ILLHOOF, InstanceScript::OnCreatureCreate(), Creature::Respawn(), Unit::SetHealth(), and Creature::SetInCombatWithZone().

◆ OnGameObjectCreate()

void instance_karazhan::instance_karazhan_InstanceMapScript::OnGameObjectCreate ( GameObject go)
inlineoverridevirtual

Reimplemented from InstanceScript.

346 {
347 switch (go->GetEntry())
348 {
349 case GO_STAGE_CURTAIN:
350 m_uiCurtainGUID = go->GetGUID();
351 break;
356 break;
361 break;
363 m_uiLibraryDoor = go->GetGUID();
364 break;
365 case GO_MASSIVE_DOOR:
366 m_uiMassiveDoor = go->GetGUID();
369 else
371 break;
374 break;
377 break;
381 else
383 break;
386 break;
387 case GO_OZ_BACKDROP:
388 case GO_OZ_HAY:
389 _operaDecorations[EVENT_OZ - 1].push_back(go->GetGUID());
390 break;
391 case GO_HOOD_BACKDROP:
392 case GO_HOOD_TREE:
393 case GO_HOOD_HOUSE:
394 _operaDecorations[EVENT_HOOD - 1].push_back(go->GetGUID());
395 break;
396 case GO_RAJ_BACKDROP:
397 case GO_RAJ_MOON:
398 case GO_RAJ_BALCONY:
399 _operaDecorations[EVENT_RAJ - 1].push_back(go->GetGUID());
400 break;
401 default:
402 break;
403 }
404
406 }
@ IN_PROGRESS
Definition: InstanceScript.h:58
@ GO_STATE_ACTIVE
Definition: GameObjectData.h:690
@ EVENT_HOOD
Definition: karazhan.h:82
@ DATA_ARAN
Definition: karazhan.h:36
@ GO_HOOD_BACKDROP
Definition: karazhan.h:160
@ GO_HOOD_HOUSE
Definition: karazhan.h:162
@ GO_STAGE_DOOR_RIGHT
Definition: karazhan.h:146
@ GO_STAGE_CURTAIN
Definition: karazhan.h:144
@ GO_RAJ_MOON
Definition: karazhan.h:164
@ GO_OZ_HAY
Definition: karazhan.h:159
@ GO_PRIVATE_LIBRARY_DOOR
Definition: karazhan.h:147
@ GO_RAJ_BACKDROP
Definition: karazhan.h:163
@ GO_MASSIVE_DOOR
Definition: karazhan.h:148
@ GO_RAJ_BALCONY
Definition: karazhan.h:165
@ GO_STAGE_DOOR_LEFT
Definition: karazhan.h:145
@ GO_GAMESMAN_HALL_EXIT_DOOR
Definition: karazhan.h:150
@ GO_HOOD_TREE
Definition: karazhan.h:161
@ GO_SIDE_ENTRANCE_DOOR
Definition: karazhan.h:154
@ GO_GAMESMAN_HALL_DOOR
Definition: karazhan.h:149
@ GO_DUST_COVERED_CHEST
Definition: karazhan.h:155
@ GO_OZ_BACKDROP
Definition: karazhan.h:158
@ GO_FLAG_LOCKED
Definition: SharedDefines.h:1604
void SetGoState(GOState state)
Definition: GameObject.cpp:2477
void SetGameObjectFlag(GameObjectFlags flags)
Definition: GameObject.h:219
void RemoveGameObjectFlag(GameObjectFlags flags)
Definition: GameObject.h:220
void OnGameObjectCreate(GameObject *go) override
Definition: InstanceScript.cpp:70
GuidVector _operaDecorations[EVENT_RAJ]
Definition: instance_karazhan.cpp:525

References _operaDecorations, DATA_ARAN, DATA_OPERA_PERFORMANCE, DONE, DustCoveredChest, EVENT_HOOD, EVENT_OZ, EVENT_RAJ, InstanceScript::GetBossState(), Object::GetEntry(), Object::GetGUID(), GO_DUST_COVERED_CHEST, GO_FLAG_LOCKED, GO_GAMESMAN_HALL_DOOR, GO_GAMESMAN_HALL_EXIT_DOOR, GO_HOOD_BACKDROP, GO_HOOD_HOUSE, GO_HOOD_TREE, GO_MASSIVE_DOOR, GO_OZ_BACKDROP, GO_OZ_HAY, GO_PRIVATE_LIBRARY_DOOR, GO_RAJ_BACKDROP, GO_RAJ_BALCONY, GO_RAJ_MOON, GO_SIDE_ENTRANCE_DOOR, GO_STAGE_CURTAIN, GO_STAGE_DOOR_LEFT, GO_STAGE_DOOR_RIGHT, GO_STATE_ACTIVE, IN_PROGRESS, m_uiCurtainGUID, m_uiGamesmansDoor, m_uiGamesmansExitDoor, m_uiLibraryDoor, m_uiMassiveDoor, m_uiStageDoorLeftGUID, m_uiStageDoorRightGUID, InstanceScript::OnGameObjectCreate(), GameObject::RemoveGameObjectFlag(), GameObject::SetGameObjectFlag(), and GameObject::SetGoState().

◆ OnUnitDeath()

void instance_karazhan::instance_karazhan_InstanceMapScript::OnUnitDeath ( Unit unit)
inlineoverridevirtual

Reimplemented from ZoneScript.

161 {
162 Creature* creature = unit->ToCreature();
163 if (!creature)
164 return;
165
166 switch (creature->GetEntry())
167 {
170 case NPC_SHADOWBAT:
173 case NPC_PHASE_HOUND:
174 case NPC_DREADBEAST:
175 case NPC_SHADOWBEAST:
177 {
180 {
182 {
185 break;
188 break;
191 break;
192 }
193 }
194 }
195 break;
201 break;
202 default:
203 break;
204 }
205 }
@ TO_BE_DECIDED
Definition: InstanceScript.h:62
@ NPC_VAMPIRIC_SHADOWBAT
Definition: karazhan.h:103
@ NPC_PHASE_HOUND
Definition: karazhan.h:105
@ NPC_GREATER_SHADOWBAT
Definition: karazhan.h:104
@ NPC_SHADOWBEAST
Definition: karazhan.h:107
@ NPC_ROKAD_THE_RAVAGER
Definition: karazhan.h:89
@ NPC_SHADOWBAT
Definition: karazhan.h:102
@ NPC_HYAKISS_THE_LURKER
Definition: karazhan.h:88
@ NPC_SHADIKITH_THE_GLIDER
Definition: karazhan.h:90
@ NPC_DREADBEAST
Definition: karazhan.h:106
@ NPC_COLDMIST_WIDOW
Definition: karazhan.h:100
@ NPC_COLDMIST_STALKER
Definition: karazhan.h:101
@ OPTIONAL_BOSS_REQUIRED_DEATH_COUNT
Definition: karazhan.h:170
@ DATA_OPTIONAL_BOSS
Definition: karazhan.h:33
const Position OptionalSpawn[]
Definition: instance_karazhan.cpp:29
Creature * ToCreature()
Definition: Object.h:202
Map * instance
Definition: InstanceScript.h:148
InstanceMap * ToInstanceMap()
Definition: Map.h:546
TempSummon * SummonCreature(uint32 entry, Position const &pos, SummonPropertiesEntry const *properties=nullptr, uint32 duration=0, WorldObject *summoner=nullptr, uint32 spellId=0, uint32 vehId=0, bool visibleBySummonerOnly=false)
Definition: Object.cpp:2163
void PermBindAllPlayers()
Definition: Map.cpp:3152
bool SetBossState(uint32 type, EncounterState state) override
Definition: instance_karazhan.cpp:310

References DATA_OPTIONAL_BOSS, DONE, InstanceScript::GetBossState(), Object::GetEntry(), InstanceScript::instance, NPC_COLDMIST_STALKER, NPC_COLDMIST_WIDOW, NPC_DREADBEAST, NPC_GREATER_SHADOWBAT, NPC_HYAKISS_THE_LURKER, NPC_PHASE_HOUND, NPC_ROKAD_THE_RAVAGER, NPC_SHADIKITH_THE_GLIDER, NPC_SHADOWBAT, NPC_SHADOWBEAST, NPC_VAMPIRIC_SHADOWBAT, OPTIONAL_BOSS_REQUIRED_DEATH_COUNT, OptionalBossCount, OptionalSpawn, InstanceMap::PermBindAllPlayers(), SetBossState(), Map::SummonCreature(), TO_BE_DECIDED, Object::ToCreature(), Map::ToInstanceMap(), and urand().

◆ SetBossState()

bool instance_karazhan::instance_karazhan_InstanceMapScript::SetBossState ( uint32  type,
EncounterState  state 
)
inlineoverridevirtual

Reimplemented from InstanceScript.

311 {
312 if (!InstanceScript::SetBossState(type, state))
313 return false;
314
315 switch (type)
316 {
318 if (state == DONE)
319 {
323 }
324 else if (state == FAIL)
325 {
330 }
331 break;
332 default:
333 break;
334 }
335
336 return true;
337 }
@ FAIL
Definition: InstanceScript.h:59
@ ENCOUNTER_CREDIT_KILL_CREATURE
Definition: Map.h:308
virtual bool SetBossState(uint32 id, EncounterState state)
Definition: InstanceScript.cpp:351
void HandleGameObject(ObjectGuid guid, bool open, GameObject *go=nullptr)
Definition: InstanceScript.cpp:110
void DoRespawnCreature(ObjectGuid guid, bool force=false)
Definition: InstanceScript.cpp:561
void UpdateEncounterState(EncounterCreditType type, uint32 creditEntry, Unit *source)
Definition: Map.cpp:3471

References _barnesGUID, DATA_OPERA_PERFORMANCE, DONE, InstanceScript::DoRespawnCreature(), ENCOUNTER_CREDIT_KILL_CREATURE, FAIL, InstanceScript::HandleGameObject(), InstanceScript::instance, m_uiCurtainGUID, m_uiStageDoorLeftGUID, m_uiStageDoorRightGUID, InstanceScript::SetBossState(), and Map::UpdateEncounterState().

Referenced by OnUnitDeath().

◆ SetData()

void instance_karazhan::instance_karazhan_InstanceMapScript::SetData ( uint32  type,
uint32  data 
)
inlineoverridevirtual

Reimplemented from ZoneScript.

208 {
209 switch (type)
210 {
212 if (data == SPECIAL)
213 ++OzDeathCount;
214 else if (data == IN_PROGRESS)
215 OzDeathCount = 0;
216 break;
218 {
219 for (ObjectGuid const& guid : _operaDecorations[data - 1])
220 {
222 }
223
224 break;
225 }
226 case DATA_CHESS_EVENT:
227 {
228 _chessEvent = data;
229
230 switch (data)
231 {
232 case IN_PROGRESS:
233 case SPECIAL:
234 {
236 for (ObjectGuid const& chessPieceGUID : _chessPiecesGUID)
237 {
238 if (Creature* piece = instance->GetCreature(chessPieceGUID))
239 {
241 {
242 if (piece->GetFaction() == CHESS_FACTION_ALLIANCE)
243 {
244 piece->SetNpcFlag(UNIT_NPC_FLAG_GOSSIP);
245 }
246 }
247 else if (_chessTeam == TEAM_HORDE)
248 {
249 if (piece->GetFaction() == CHESS_FACTION_HORDE)
250 {
251 piece->SetNpcFlag(UNIT_NPC_FLAG_GOSSIP);
252 }
253 }
254 else
255 {
256 piece->SetNpcFlag(UNIT_NPC_FLAG_GOSSIP);
257 }
258 }
259 }
260 break;
261 case DONE:
264 break;
265 }
266 default:
268 break;
269 }
270 break;
271 }
272 case CHESS_EVENT_TEAM:
273 _chessTeam = data;
274 break;
276 for (ObjectGuid const& chessPieceGUID : _chessPiecesGUID)
277 {
278 if (Creature* piece = instance->GetCreature(chessPieceGUID))
279 {
280 piece->RemoveAllAuras();
281 piece->setDeathState(DeathState::JustRespawned);
282 piece->SetHealth(piece->GetMaxHealth());
283 float x, y, z, o;
284 piece->GetHomePosition(x, y, z, o);
285 piece->NearTeleportTo(x, y, z, o);
286 piece->AI()->DoAction(ACTION_CHESS_PIECE_RESET_ORIENTATION);
287 piece->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
288 piece->AI()->Reset();
289 }
290 }
291
292 for (ObjectGuid const& medivhCheatFireGUID : _medivhCheatFiresGUID)
293 {
294 if (Creature* fire = instance->GetCreature(medivhCheatFireGUID))
295 {
296 fire->DespawnOrUnsummon();
297 }
298 }
299
300 _medivhCheatFiresGUID.clear();
301 break;
303 _chessGamePhase = data;
304 break;
305 default:
306 break;
307 }
308 }
constexpr auto DAY
Definition: Common.h:49
@ SPECIAL
Definition: InstanceScript.h:61
@ UNIT_NPC_FLAG_GOSSIP
Definition: UnitDefines.h:294
@ CHESS_FACTION_HORDE
Definition: karazhan.h:200
@ CHESS_FACTION_ALLIANCE
Definition: karazhan.h:201
@ SPELL_GAME_IN_SESSION
Definition: karazhan.h:182
@ ACTION_CHESS_PIECE_RESET_ORIENTATION
Definition: karazhan.h:172
@ DATA_SPAWN_OPERA_DECORATIONS
Definition: karazhan.h:58
@ DATA_CHESS_REINIT_PIECES
Definition: karazhan.h:63
@ TEAM_ALLIANCE
Definition: SharedDefines.h:760
@ TEAM_HORDE
Definition: SharedDefines.h:761
Definition: ObjectGuid.h:118
void DoCastSpellOnPlayers(uint32 spell)
Definition: InstanceScript.cpp:650
void DoRemoveAurasDueToSpellOnPlayers(uint32 spell)
Definition: InstanceScript.cpp:639
void DoRespawnGameObject(ObjectGuid guid, uint32 timeToDespawn=MINUTE)
Definition: InstanceScript.cpp:535
Creature * GetCreature(ObjectGuid const guid)
Definition: Map.cpp:3314

References _chessEvent, _chessGamePhase, _chessPiecesGUID, _chessTeam, _medivhCheatFiresGUID, _operaDecorations, ACTION_CHESS_PIECE_RESET_ORIENTATION, CHESS_EVENT_TEAM, CHESS_FACTION_ALLIANCE, CHESS_FACTION_HORDE, DATA_CHESS_EVENT, DATA_CHESS_GAME_PHASE, DATA_CHESS_REINIT_PIECES, DATA_OPERA_OZ_DEATHCOUNT, DATA_SPAWN_OPERA_DECORATIONS, DAY, InstanceScript::DoCastSpellOnPlayers(), DONE, InstanceScript::DoRemoveAurasDueToSpellOnPlayers(), InstanceScript::DoRespawnGameObject(), Map::GetCreature(), InstanceScript::HandleGameObject(), IN_PROGRESS, InstanceScript::instance, m_uiGamesmansExitDoor, OzDeathCount, InstanceMap::PermBindAllPlayers(), SPECIAL, SPELL_GAME_IN_SESSION, TEAM_ALLIANCE, TEAM_HORDE, Map::ToInstanceMap(), UNIT_FLAG_NOT_SELECTABLE, and UNIT_NPC_FLAG_GOSSIP.

◆ SetGuidData()

void instance_karazhan::instance_karazhan_InstanceMapScript::SetGuidData ( uint32  type,
ObjectGuid  data 
)
inlineoverridevirtual

Reimplemented from ZoneScript.

340 {
341 if (type == DATA_IMAGE_OF_MEDIVH)
342 ImageGUID = data;
343 }

References DATA_IMAGE_OF_MEDIVH, and ImageGUID.

Member Data Documentation

◆ _barnesGUID

ObjectGuid instance_karazhan::instance_karazhan_InstanceMapScript::_barnesGUID
private

Referenced by OnCreatureCreate(), and SetBossState().

◆ _chessEvent

uint32 instance_karazhan::instance_karazhan_InstanceMapScript::_chessEvent
private

◆ _chessGamePhase

uint32 instance_karazhan::instance_karazhan_InstanceMapScript::_chessGamePhase
private

◆ _chessPiecesGUID

GuidSet instance_karazhan::instance_karazhan_InstanceMapScript::_chessPiecesGUID
private

Referenced by OnCreatureCreate(), and SetData().

◆ _chessTeam

uint32 instance_karazhan::instance_karazhan_InstanceMapScript::_chessTeam
private

◆ _echoOfMedivhGUID

ObjectGuid instance_karazhan::instance_karazhan_InstanceMapScript::_echoOfMedivhGUID
private

Referenced by GetGuidData(), and OnCreatureCreate().

◆ _medivhCheatFiresGUID

GuidSet instance_karazhan::instance_karazhan_InstanceMapScript::_medivhCheatFiresGUID
private

Referenced by OnCreatureCreate(), and SetData().

◆ _operaDecorations

GuidVector instance_karazhan::instance_karazhan_InstanceMapScript::_operaDecorations[EVENT_RAJ]
private

Referenced by OnGameObjectCreate(), and SetData().

◆ DustCoveredChest

ObjectGuid instance_karazhan::instance_karazhan_InstanceMapScript::DustCoveredChest
private

Referenced by GetGuidData(), and OnGameObjectCreate().

◆ ImageGUID

ObjectGuid instance_karazhan::instance_karazhan_InstanceMapScript::ImageGUID
private

Referenced by GetGuidData(), and SetGuidData().

◆ m_uiCurtainGUID

ObjectGuid instance_karazhan::instance_karazhan_InstanceMapScript::m_uiCurtainGUID
private

◆ m_uiGamesmansDoor

ObjectGuid instance_karazhan::instance_karazhan_InstanceMapScript::m_uiGamesmansDoor
private

Referenced by GetGuidData(), and OnGameObjectCreate().

◆ m_uiGamesmansExitDoor

ObjectGuid instance_karazhan::instance_karazhan_InstanceMapScript::m_uiGamesmansExitDoor
private

◆ m_uiKilrekGUID

ObjectGuid instance_karazhan::instance_karazhan_InstanceMapScript::m_uiKilrekGUID
private

Referenced by GetGuidData(), and OnCreatureCreate().

◆ m_uiLibraryDoor

ObjectGuid instance_karazhan::instance_karazhan_InstanceMapScript::m_uiLibraryDoor
private

Referenced by GetGuidData(), and OnGameObjectCreate().

◆ m_uiMassiveDoor

ObjectGuid instance_karazhan::instance_karazhan_InstanceMapScript::m_uiMassiveDoor
private

Referenced by GetGuidData(), and OnGameObjectCreate().

◆ m_uiMoroesGUID

ObjectGuid instance_karazhan::instance_karazhan_InstanceMapScript::m_uiMoroesGUID
private

Referenced by GetGuidData(), and OnCreatureCreate().

◆ m_uiNightBaneGUID

ObjectGuid instance_karazhan::instance_karazhan_InstanceMapScript::m_uiNightBaneGUID
private

Referenced by GetGuidData(), and OnCreatureCreate().

◆ m_uiRelayGUID

ObjectGuid instance_karazhan::instance_karazhan_InstanceMapScript::m_uiRelayGUID
private

Referenced by OnCreatureCreate().

◆ m_uiStageDoorLeftGUID

ObjectGuid instance_karazhan::instance_karazhan_InstanceMapScript::m_uiStageDoorLeftGUID
private

◆ m_uiStageDoorRightGUID

ObjectGuid instance_karazhan::instance_karazhan_InstanceMapScript::m_uiStageDoorRightGUID
private

◆ m_uiTerestianGUID

ObjectGuid instance_karazhan::instance_karazhan_InstanceMapScript::m_uiTerestianGUID
private

Referenced by GetGuidData(), and OnCreatureCreate().

◆ OperaEvent

uint32 instance_karazhan::instance_karazhan_InstanceMapScript::OperaEvent
private

◆ OptionalBossCount

uint32 instance_karazhan::instance_karazhan_InstanceMapScript::OptionalBossCount
private

◆ OzDeathCount

uint32 instance_karazhan::instance_karazhan_InstanceMapScript::OzDeathCount
private