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_uiNightBaneGUID
 
ObjectGuid m_uiLibraryDoor
 
ObjectGuid m_uiMassiveDoor
 
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 LoadSummonData (ObjectData const *data)
 
void SetSummoner (Creature *creature)
 
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
#define DataHeader
Definition: blackrock_depths.h:23
uint32 const EncounterCount
Definition: blackrock_spire.h:23
ObjectData const gameObjectData[]
Definition: instance_karazhan.cpp:53
ObjectData const creatureData[]
Definition: instance_karazhan.cpp:36
DoorData const doorData[]
Definition: instance_karazhan.cpp:59
@ CHESS_PHASE_NOT_STARTED
Definition: karazhan.h:189
@ EVENT_OZ
Definition: karazhan.h:81
@ EVENT_RAJ
Definition: karazhan.h:83
@ TEAM_NEUTRAL
Definition: SharedDefines.h:762
@ NOT_STARTED
Definition: InstanceScript.h:57
Definition: InstanceScript.h:142
void SetBossNumber(uint32 number)
Definition: InstanceScript.h:285
void LoadDoorData(DoorData const *data)
Definition: InstanceScript.cpp:164
void SetHeaders(std::string const &dataHeaders)
Definition: InstanceScript.cpp:141
void LoadObjectData(ObjectData const *creatureData, ObjectData const *gameObjectData)
Definition: InstanceScript.cpp:176
uint32 OperaEvent
Definition: instance_karazhan.cpp:479
uint32 OzDeathCount
Definition: instance_karazhan.cpp:480
uint32 _chessTeam
Definition: instance_karazhan.cpp:482
uint32 _chessEvent
Definition: instance_karazhan.cpp:484
uint32 OptionalBossCount
Definition: instance_karazhan.cpp:481
uint32 _chessGamePhase
Definition: instance_karazhan.cpp:483

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.

416 {
417 if (actionId == ACTION_SCHEDULE_RAJ_CHECK)
418 {
419 scheduler.Schedule(10s, [this](TaskContext)
420 {
423
424 if (julliane && romulo)
425 {
428 {
429 julliane->KillSelf();
431 romulo->KillSelf();
433 }
434 else
435 {
437 {
438 julliane->AI()->DoAction(ACTION_RESS_ROMULO);
439 }
440
442 {
443 julliane->AI()->DoAction(ACTION_DO_RESURRECT);
444 }
445 }
446 }
447 });
448 }
449 }
@ 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
@ UNIT_FLAG_NOT_SELECTABLE
Definition: UnitDefines.h:254
TaskScheduler & Schedule(std::chrono::duration< _Rep, _Period > const &time, task_handler_t const &task)
Definition: TaskScheduler.h:232
Definition: TaskScheduler.h:421
virtual void DoAction(int32)
Definition: UnitAI.h:212
Definition: Creature.h:43
CreatureAI * AI() const
Definition: Creature.h:140
bool HasUnitFlag(UnitFlags flags) const
Definition: Unit.h:712
void KillSelf(bool durabilityLoss=true, WeaponAttackType attackType=BASE_ATTACK, SpellInfo const *spellProto=nullptr, Spell const *spell=nullptr)
Definition: Unit.h:1159
void RemoveUnitFlag(UnitFlags flags)
UnitFlags available in UnitDefines.h.
Definition: Unit.h:714
Creature * GetCreature(uint32 type)
Definition: InstanceScript.cpp:103
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.

397 {
398 switch (type)
399 {
401 return OperaEvent;
403 return OzDeathCount;
404 case CHESS_EVENT_TEAM:
405 return _chessTeam;
407 return _chessGamePhase;
408 case DATA_CHESS_EVENT:
409 return _chessEvent;
410 }
411
412 return 0;
413 }
@ 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.

452 {
453 switch (data)
454 {
459 case DATA_GO_CURTAINS:
460 return m_uiCurtainGUID;
462 return m_uiLibraryDoor;
464 return m_uiMassiveDoor;
466 return ImageGUID;
467 case DATA_NIGHTBANE:
468 return m_uiNightBaneGUID;
470 return _echoOfMedivhGUID;
472 return DustCoveredChest;
473 }
474
475 return ObjectGuid::Empty;
476 }
@ 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_ECHO_OF_MEDIVH
Definition: karazhan.h:65
@ DATA_IMAGE_OF_MEDIVH
Definition: karazhan.h:55
@ DATA_DUST_COVERED_CHEST
Definition: karazhan.h:66
@ 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:491
ObjectGuid _echoOfMedivhGUID
Definition: instance_karazhan.cpp:497
ObjectGuid m_uiLibraryDoor
Definition: instance_karazhan.cpp:490
ObjectGuid m_uiCurtainGUID
Definition: instance_karazhan.cpp:486
ObjectGuid DustCoveredChest
Definition: instance_karazhan.cpp:494
ObjectGuid m_uiStageDoorLeftGUID
Definition: instance_karazhan.cpp:487
ObjectGuid m_uiStageDoorRightGUID
Definition: instance_karazhan.cpp:488
ObjectGuid ImageGUID
Definition: instance_karazhan.cpp:493
ObjectGuid m_uiNightBaneGUID
Definition: instance_karazhan.cpp:489

References _echoOfMedivhGUID, DATA_DUST_COVERED_CHEST, DATA_ECHO_OF_MEDIVH, DATA_GO_CURTAINS, DATA_GO_LIBRARY_DOOR, DATA_GO_MASSIVE_DOOR, DATA_GO_STAGEDOORLEFT, DATA_GO_STAGEDOORRIGHT, DATA_IMAGE_OF_MEDIVH, DATA_NIGHTBANE, DustCoveredChest, ObjectGuid::Empty, ImageGUID, m_uiCurtainGUID, m_uiLibraryDoor, m_uiMassiveDoor, m_uiNightBaneGUID, m_uiStageDoorLeftGUID, and m_uiStageDoorRightGUID.

◆ OnCreatureCreate()

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

Reimplemented from InstanceScript.

97 {
98 switch (creature->GetEntry())
99 {
100 case NPC_NIGHTBANE:
101 m_uiNightBaneGUID = creature->GetGUID();
102 break;
103 case NPC_RELAY:
104 m_uiRelayGUID = creature->GetGUID();
105 break;
106 case NPC_BARNES:
107 _barnesGUID = creature->GetGUID();
108 if (GetBossState(DATA_OPERA_PERFORMANCE) != DONE && !creature->IsAlive())
109 {
110 creature->Respawn(true);
111 }
112 break;
113 case NPC_PAWN_H:
114 case NPC_KNIGHT_H:
115 case NPC_QUEEN_H:
116 case NPC_BISHOP_H:
117 case NPC_ROOK_H:
118 case NPC_KING_H:
119 case NPC_PAWN_A:
120 case NPC_KNIGHT_A:
121 case NPC_QUEEN_A:
122 case NPC_BISHOP_A:
123 case NPC_ROOK_A:
124 case NPC_KING_A:
125 _chessPiecesGUID.insert(creature->GetGUID());
126 creature->SetHealth(creature->GetMaxHealth());
127 break;
129 _medivhCheatFiresGUID.insert(creature->GetGUID());
130 break;
132 _echoOfMedivhGUID = creature->GetGUID();
133 break;
134 case NPC_FIENDISH_IMP:
135 if (Creature* terestrian = GetCreature(DATA_TERESTIAN))
136 {
137 if (terestrian->AI())
138 {
139 terestrian->AI()->JustSummoned(creature);
140 creature->SetInCombatWithZone();
141 }
142 }
143 break;
144 default:
145 break;
146 }
147
149 }
@ 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_PAWN_H
Definition: karazhan.h:122
@ 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
@ DATA_TERESTIAN
Definition: karazhan.h:37
@ DONE
Definition: InstanceScript.h:60
void SetInCombatWithZone()
Set in combat all units in the dungeon/raid. Affect only units with IsAIEnabled.
Definition: Creature.cpp:2811
void Respawn(bool force=false)
Definition: Creature.cpp:2035
uint32 GetEntry() const
Definition: Object.h:115
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:112
uint32 GetMaxHealth() const
Definition: Unit.h:1030
bool IsAlive() const
Definition: Unit.h:1654
void SetHealth(uint32 val)
Definition: Unit.cpp:15478
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:495
GuidSet _chessPiecesGUID
Definition: instance_karazhan.cpp:500
ObjectGuid _barnesGUID
Definition: instance_karazhan.cpp:496
GuidSet _medivhCheatFiresGUID
Definition: instance_karazhan.cpp:501

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

◆ OnGameObjectCreate()

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

Reimplemented from InstanceScript.

337 {
338 switch (go->GetEntry())
339 {
340 case GO_STAGE_CURTAIN:
341 m_uiCurtainGUID = go->GetGUID();
342 break;
347 break;
352 break;
354 m_uiLibraryDoor = go->GetGUID();
355 break;
356 case GO_MASSIVE_DOOR:
357 m_uiMassiveDoor = go->GetGUID();
360 else
362 break;
365 break;
369 else
371 break;
374 break;
375 case GO_OZ_BACKDROP:
376 case GO_OZ_HAY:
377 _operaDecorations[EVENT_OZ - 1].push_back(go->GetGUID());
378 break;
379 case GO_HOOD_BACKDROP:
380 case GO_HOOD_TREE:
381 case GO_HOOD_HOUSE:
382 _operaDecorations[EVENT_HOOD - 1].push_back(go->GetGUID());
383 break;
384 case GO_RAJ_BACKDROP:
385 case GO_RAJ_MOON:
386 case GO_RAJ_BALCONY:
387 _operaDecorations[EVENT_RAJ - 1].push_back(go->GetGUID());
388 break;
389 default:
390 break;
391 }
392
394 }
@ 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_DUST_COVERED_CHEST
Definition: karazhan.h:155
@ GO_OZ_BACKDROP
Definition: karazhan.h:158
@ GO_FLAG_LOCKED
Definition: SharedDefines.h:1604
@ IN_PROGRESS
Definition: InstanceScript.h:58
@ GO_STATE_ACTIVE
Definition: GameObjectData.h:689
void SetGoState(GOState state)
Definition: GameObject.cpp:2479
void SetGameObjectFlag(GameObjectFlags flags)
Definition: GameObject.h:218
void RemoveGameObjectFlag(GameObjectFlags flags)
Definition: GameObject.h:219
void OnGameObjectCreate(GameObject *go) override
Definition: InstanceScript.cpp:73
GuidVector _operaDecorations[EVENT_RAJ]
Definition: instance_karazhan.cpp:499
ObjectGuid m_uiGamesmansExitDoor
Definition: instance_karazhan.cpp:492

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_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_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.

152 {
153 Creature* creature = unit->ToCreature();
154 if (!creature)
155 return;
156
157 switch (creature->GetEntry())
158 {
161 case NPC_SHADOWBAT:
164 case NPC_PHASE_HOUND:
165 case NPC_DREADBEAST:
166 case NPC_SHADOWBEAST:
168 {
171 {
173 {
176 break;
179 break;
182 break;
183 }
184 }
185 }
186 break;
192 break;
193 default:
194 break;
195 }
196 }
const Position OptionalSpawn[]
Definition: instance_karazhan.cpp:29
@ 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
@ TO_BE_DECIDED
Definition: InstanceScript.h:62
Creature * ToCreature()
Definition: Object.h:205
Map * instance
Definition: InstanceScript.h:148
InstanceMap * ToInstanceMap()
Definition: Map.h:544
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:2174
void PermBindAllPlayers()
Definition: Map.cpp:3155
bool SetBossState(uint32 type, EncounterState state) override
Definition: instance_karazhan.cpp:301

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.

302 {
303 if (!InstanceScript::SetBossState(type, state))
304 return false;
305
306 switch (type)
307 {
309 if (state == DONE)
310 {
314 }
315 else if (state == FAIL)
316 {
321 }
322 break;
323 default:
324 break;
325 }
326
327 return true;
328 }
@ ENCOUNTER_CREDIT_KILL_CREATURE
Definition: Map.h:306
@ FAIL
Definition: InstanceScript.h:59
virtual bool SetBossState(uint32 id, EncounterState state)
Definition: InstanceScript.cpp:373
void HandleGameObject(ObjectGuid guid, bool open, GameObject *go=nullptr)
Definition: InstanceScript.cpp:113
void DoRespawnCreature(ObjectGuid guid, bool force=false)
Definition: InstanceScript.cpp:587
void UpdateEncounterState(EncounterCreditType type, uint32 creditEntry, Unit *source)
Definition: Map.cpp:3474

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.

199 {
200 switch (type)
201 {
203 if (data == SPECIAL)
204 ++OzDeathCount;
205 else if (data == IN_PROGRESS)
206 OzDeathCount = 0;
207 break;
209 {
210 for (ObjectGuid const& guid : _operaDecorations[data - 1])
211 {
213 }
214
215 break;
216 }
217 case DATA_CHESS_EVENT:
218 {
219 _chessEvent = data;
220
221 switch (data)
222 {
223 case IN_PROGRESS:
224 case SPECIAL:
225 {
227 for (ObjectGuid const& chessPieceGUID : _chessPiecesGUID)
228 {
229 if (Creature* piece = instance->GetCreature(chessPieceGUID))
230 {
232 {
233 if (piece->GetFaction() == CHESS_FACTION_ALLIANCE)
234 {
235 piece->SetNpcFlag(UNIT_NPC_FLAG_GOSSIP);
236 }
237 }
238 else if (_chessTeam == TEAM_HORDE)
239 {
240 if (piece->GetFaction() == CHESS_FACTION_HORDE)
241 {
242 piece->SetNpcFlag(UNIT_NPC_FLAG_GOSSIP);
243 }
244 }
245 else
246 {
247 piece->SetNpcFlag(UNIT_NPC_FLAG_GOSSIP);
248 }
249 }
250 }
251 break;
252 case DONE:
255 break;
256 }
257 default:
259 break;
260 }
261 break;
262 }
263 case CHESS_EVENT_TEAM:
264 _chessTeam = data;
265 break;
267 for (ObjectGuid const& chessPieceGUID : _chessPiecesGUID)
268 {
269 if (Creature* piece = instance->GetCreature(chessPieceGUID))
270 {
271 piece->RemoveAllAuras();
272 piece->setDeathState(DeathState::JustRespawned);
273 piece->SetHealth(piece->GetMaxHealth());
274 float x, y, z, o;
275 piece->GetHomePosition(x, y, z, o);
276 piece->NearTeleportTo(x, y, z, o);
277 piece->AI()->DoAction(ACTION_CHESS_PIECE_RESET_ORIENTATION);
278 piece->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
279 piece->AI()->Reset();
280 }
281 }
282
283 for (ObjectGuid const& medivhCheatFireGUID : _medivhCheatFiresGUID)
284 {
285 if (Creature* fire = instance->GetCreature(medivhCheatFireGUID))
286 {
287 fire->DespawnOrUnsummon();
288 }
289 }
290
291 _medivhCheatFiresGUID.clear();
292 break;
294 _chessGamePhase = data;
295 break;
296 default:
297 break;
298 }
299 }
constexpr auto DAY
Definition: Common.h:49
@ 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
@ SPECIAL
Definition: InstanceScript.h:61
@ UNIT_NPC_FLAG_GOSSIP
Definition: UnitDefines.h:294
Definition: ObjectGuid.h:118
void DoCastSpellOnPlayers(uint32 spell)
Definition: InstanceScript.cpp:676
void DoRemoveAurasDueToSpellOnPlayers(uint32 spell)
Definition: InstanceScript.cpp:665
void DoRespawnGameObject(ObjectGuid guid, uint32 timeToDespawn=MINUTE)
Definition: InstanceScript.cpp:561
Creature * GetCreature(ObjectGuid const guid)
Definition: Map.cpp:3317

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.

331 {
332 if (type == DATA_IMAGE_OF_MEDIVH)
333 ImageGUID = data;
334 }

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_uiGamesmansExitDoor

ObjectGuid instance_karazhan::instance_karazhan_InstanceMapScript::m_uiGamesmansExitDoor
private

Referenced by OnGameObjectCreate(), and SetData().

◆ 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_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

◆ 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