TrinityCore
InstanceScript Class Reference

#include <InstanceScript.h>

Public Member Functions

 InstanceScript (InstanceMap *map)
 
virtual ~InstanceScript ()
 
virtual void Create ()
 
virtual void Load (char const *data)
 
virtual std::string GetSaveData ()
 
void SaveToDB ()
 
virtual void Update (uint32)
 
void UpdateCombatResurrection (uint32)
 
virtual bool IsEncounterInProgress () const
 
virtual void OnCreatureCreate (Creature *creature) override
 
virtual void OnCreatureRemove (Creature *creature) override
 
virtual void OnGameObjectCreate (GameObject *go) override
 
virtual void OnGameObjectRemove (GameObject *go) override
 
ObjectGuid GetObjectGuid (uint32 type) const
 
virtual ObjectGuid GetGuidData (uint32 type) const override
 
void TriggerGameEvent (uint32 gameEventId, WorldObject *source=nullptr, WorldObject *target=nullptr) override
 
CreatureGetCreature (uint32 type)
 
GameObjectGetGameObject (uint32 type)
 
virtual void OnPlayerEnter (Player *)
 
virtual void OnPlayerLeave (Player *)
 
void HandleGameObject (ObjectGuid guid, bool open, GameObject *go=nullptr)
 
void DoUseDoorOrButton (ObjectGuid guid, uint32 withRestoreTime=0, bool useAlternativeState=false)
 
void DoCloseDoorOrButton (ObjectGuid guid)
 
void DoRespawnGameObject (ObjectGuid guid, Seconds timeToDespawn=1min)
 
void DoUpdateWorldState (int32 worldStateId, int32 value)
 
void DoSendNotifyToInstance (char const *format,...)
 
void DoUpdateCriteria (CriteriaType type, uint32 miscValue1=0, uint32 miscValue2=0, Unit *unit=nullptr)
 
void DoRemoveAurasDueToSpellOnPlayers (uint32 spell, bool includePets=false, bool includeControlled=false)
 
void DoRemoveAurasDueToSpellOnPlayer (Player *player, uint32 spell, bool includePets=false, bool includeControlled=false)
 
void DoCastSpellOnPlayers (uint32 spell, bool includePets=false, bool includeControlled=false)
 
void DoCastSpellOnPlayer (Player *player, uint32 spell, bool includePets=false, bool includeControlled=false)
 
virtual bool SetBossState (uint32 id, EncounterState state)
 
EncounterState GetBossState (uint32 id) const
 
CreatureBoundary const * GetBossBoundary (uint32 id) const
 
virtual bool CheckAchievementCriteriaMeet (uint32, Player const *, Unit const *=nullptr, uint32=0)
 
virtual bool CheckRequiredBosses (uint32, Player const *=nullptr) const
 
void UpdateEncounterStateForKilledCreature (uint32 creatureId, Unit *source)
 
void UpdateEncounterStateForSpellCast (uint32 spellId, Unit *source)
 
void SetCompletedEncountersMask (uint32 newMask)
 
uint32 GetCompletedEncounterMask () const
 
uint32 GetEncounterCount () const
 
void SetEntranceLocation (uint32 worldSafeLocationId)
 
void SetTemporaryEntranceLocation (uint32 worldSafeLocationId)
 
uint32 GetEntranceLocation () const
 
void MarkAreaTriggerDone (uint32 id)
 
void ResetAreaTriggerDone (uint32 id)
 
bool IsAreaTriggerDone (uint32 id) const
 
void SendEncounterUnit (uint32 type, Unit *unit=nullptr, uint8 priority=0)
 
void SendEncounterStart (uint32 inCombatResCount=0, uint32 maxInCombatResCount=0, uint32 inCombatResChargeRecovery=0, uint32 nextCombatResChargeTime=0)
 
void SendEncounterEnd ()
 
void SendBossKillCredit (uint32 encounterId)
 
void UpdatePhasing ()
 
void InitializeCombatResurrections (uint8 charges=1, uint32 interval=0)
 
void AddCombatResurrectionCharge ()
 
void UseCombatResurrection ()
 
void ResetCombatResurrections ()
 
uint8 GetCombatResurrectionCharges () const
 
uint32 GetCombatResurrectionChargeInterval () const
 
- Public Member Functions inherited from ZoneScript
 ZoneScript ()
 
virtual ~ZoneScript ()
 
 ZoneScript (ZoneScript const &right)=delete
 
 ZoneScript (ZoneScript &&right)=delete
 
ZoneScriptoperator= (ZoneScript const &right)=delete
 
ZoneScriptoperator= (ZoneScript &&right)=delete
 
virtual uint32 GetCreatureEntry (ObjectGuid::LowType, CreatureData const *data)
 
virtual uint32 GetGameObjectEntry (ObjectGuid::LowType, uint32 entry)
 
virtual void OnUnitDeath (Unit *)
 
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, WorldObject *)
 

Static Public Member Functions

static bool ServerAllowsTwoSideGroups ()
 
static char const * GetBossStateName (uint8 state)
 

Public Attributes

InstanceMapinstance
 

Protected Member Functions

void SetHeaders (std::string const &dataHeaders)
 
void SetBossNumber (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)
 
void AddObject (GameObject *obj, bool add)
 
void AddObject (WorldObject *obj, uint32 type, bool add)
 
virtual void AddDoor (GameObject *door, bool add)
 
void AddMinion (Creature *minion, bool add)
 
virtual void UpdateDoorState (GameObject *door)
 
void UpdateMinionState (Creature *minion, EncounterState state)
 
void UpdateSpawnGroups ()
 
BossInfoGetBossInfo (uint32 id)
 
bool ReadSaveDataHeaders (std::istringstream &data)
 
void ReadSaveDataBossStates (std::istringstream &data)
 
virtual void ReadSaveDataMore (std::istringstream &)
 
void WriteSaveDataHeaders (std::ostringstream &data)
 
void WriteSaveDataBossStates (std::ostringstream &data)
 
virtual void WriteSaveDataMore (std::ostringstream &)
 
bool _SkipCheckRequiredBosses (Player const *player=nullptr) const
 

Private Member Functions

void UpdateEncounterState (EncounterCreditType type, uint32 creditEntry, Unit *source)
 

Static Private Member Functions

static void LoadObjectData (ObjectData const *creatureData, ObjectInfoMap &objectInfo)
 

Private Attributes

std::vector< char > headers
 
std::vector< BossInfobosses
 
DoorInfoMap doors
 
MinionInfoMap minions
 
ObjectInfoMap _creatureInfo
 
ObjectInfoMap _gameObjectInfo
 
ObjectGuidMap _objectGuids
 
uint32 completedEncounters
 
std::vector< InstanceSpawnGroupInfo > const *const _instanceSpawnGroups
 
std::unordered_set< uint32_activatedAreaTriggers
 
uint32 _entranceId
 
uint32 _temporaryEntranceId
 
uint32 _combatResurrectionTimer
 
uint8 _combatResurrectionCharges
 
bool _combatResurrectionTimerStarted
 

Friends

class debug_commandscript
 

Constructor & Destructor Documentation

◆ InstanceScript()

InstanceScript::InstanceScript ( InstanceMap map)
explicit
54  : instance(map), completedEncounters(0), _instanceSpawnGroups(sObjectMgr->GetInstanceSpawnGroupsForMap(map->GetId())),
56 {
57 #ifdef TRINITY_API_USE_DYNAMIC_LINKING
58  uint32 scriptId = sObjectMgr->GetInstanceTemplate(map->GetId())->ScriptId;
59  auto const scriptname = sObjectMgr->GetScriptName(scriptId);
60  ASSERT(!scriptname.empty());
61  // Acquire a strong reference from the script module
62  // to keep it loaded until this object is destroyed.
63  module_reference = sScriptMgr->AcquireModuleReferenceOfScriptName(scriptname);
64 #endif // #ifndef TRINITY_API_USE_DYNAMIC_LINKING
65 }
uint32 _entranceId
Definition: InstanceScript.h:333
uint32 _combatResurrectionTimer
Definition: InstanceScript.h:335
uint32 _temporaryEntranceId
Definition: InstanceScript.h:334
std::vector< InstanceSpawnGroupInfo > const *const _instanceSpawnGroups
Definition: InstanceScript.h:331
#define sObjectMgr
Definition: ObjectMgr.h:1967
uint32 GetId() const
Definition: Map.cpp:4410
InstanceMap * instance
Definition: InstanceScript.h:156
uint32 completedEncounters
Definition: InstanceScript.h:330
uint32_t uint32
Definition: Define.h:143
#define ASSERT
Definition: Errors.h:68
#define sScriptMgr
Definition: ScriptMgr.h:1409
uint8 _combatResurrectionCharges
Definition: InstanceScript.h:336
bool _combatResurrectionTimerStarted
Definition: InstanceScript.h:337
+ Here is the call graph for this function:

◆ ~InstanceScript()

InstanceScript::~InstanceScript ( )
virtual
68 {
69 }

Member Function Documentation

◆ _SkipCheckRequiredBosses()

bool InstanceScript::_SkipCheckRequiredBosses ( Player const *  player = nullptr) const
protected
445 {
446  return player && player->GetSession()->HasPermission(rbac::RBAC_PERM_SKIP_CHECK_INSTANCE_REQUIRED_BOSSES);
447 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ AddCombatResurrectionCharge()

void InstanceScript::AddCombatResurrectionCharge ( )
905 {
908 
910  gainCombatResurrectionCharge.InCombatResCount = _combatResurrectionCharges;
911  gainCombatResurrectionCharge.CombatResChargeRecovery = _combatResurrectionTimer;
912  instance->SendToPlayers(gainCombatResurrectionCharge.Write());
913 }
uint32 CombatResChargeRecovery
Definition: InstancePackets.h:237
uint32 _combatResurrectionTimer
Definition: InstanceScript.h:335
WorldPacket const * Write() override
Definition: InstancePackets.cpp:155
uint32 GetCombatResurrectionChargeInterval() const
Definition: InstanceScript.cpp:929
void SendToPlayers(WorldPacket const *data) const
Definition: Map.cpp:3851
InstanceMap * instance
Definition: InstanceScript.h:156
uint8 _combatResurrectionCharges
Definition: InstanceScript.h:336
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ AddDoor()

void InstanceScript::AddDoor ( GameObject door,
bool  add 
)
protectedvirtual

Reimplemented in instance_ulduar::instance_ulduar_InstanceMapScript.

339 {
340  DoorInfoMapBounds range = doors.equal_range(door->GetEntry());
341  if (range.first == range.second)
342  return;
343 
344  for (; range.first != range.second; ++range.first)
345  {
346  DoorInfo const& data = range.first->second;
347 
348  if (add)
349  {
350  data.bossInfo->door[data.type].insert(door->GetGUID());
351  }
352  else
353  data.bossInfo->door[data.type].erase(door->GetGUID());
354  }
355 
356  if (add)
357  UpdateDoorState(door);
358 }
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:156
GuidSet door[MAX_DOOR_TYPES]
Definition: InstanceScript.h:123
std::pair< DoorInfoMap::const_iterator, DoorInfoMap::const_iterator > DoorInfoMapBounds
Definition: InstanceScript.h:143
uint32 GetEntry() const
Definition: Object.h:158
Definition: InstanceScript.h:128
BossInfo * bossInfo
Definition: InstanceScript.h:132
virtual void UpdateDoorState(GameObject *door)
Definition: InstanceScript.cpp:220
DoorType type
Definition: InstanceScript.h:133
DoorInfoMap doors
Definition: InstanceScript.h:325
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ AddMinion()

void InstanceScript::AddMinion ( Creature minion,
bool  add 
)
protected
361 {
362  MinionInfoMap::iterator itr = minions.find(minion->GetEntry());
363  if (itr == minions.end())
364  return;
365 
366  if (add)
367  itr->second.bossInfo->minion.insert(minion->GetGUID());
368  else
369  itr->second.bossInfo->minion.erase(minion->GetGUID());
370 }
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:156
MinionInfoMap minions
Definition: InstanceScript.h:326
uint32 GetEntry() const
Definition: Object.h:158
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ AddObject() [1/3]

void InstanceScript::AddObject ( Creature obj,
bool  add 
)
protected
313 {
314  ObjectInfoMap::const_iterator j = _creatureInfo.find(obj->GetEntry());
315  if (j != _creatureInfo.end())
316  AddObject(obj, j->second, add);
317 }
ObjectInfoMap _creatureInfo
Definition: InstanceScript.h:327
void AddObject(Creature *obj, bool add)
Definition: InstanceScript.cpp:312
uint32 GetEntry() const
Definition: Object.h:158
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ AddObject() [2/3]

void InstanceScript::AddObject ( GameObject obj,
bool  add 
)
protected
320 {
321  ObjectInfoMap::const_iterator j = _gameObjectInfo.find(obj->GetEntry());
322  if (j != _gameObjectInfo.end())
323  AddObject(obj, j->second, add);
324 }
ObjectInfoMap _gameObjectInfo
Definition: InstanceScript.h:328
void AddObject(Creature *obj, bool add)
Definition: InstanceScript.cpp:312
uint32 GetEntry() const
Definition: Object.h:158
+ Here is the call graph for this function:

◆ AddObject() [3/3]

void InstanceScript::AddObject ( WorldObject obj,
uint32  type,
bool  add 
)
protected
327 {
328  if (add)
329  _objectGuids[type] = obj->GetGUID();
330  else
331  {
332  ObjectGuidMap::iterator i = _objectGuids.find(type);
333  if (i != _objectGuids.end() && i->second == obj->GetGUID())
334  _objectGuids.erase(i);
335  }
336 }
ObjectGuidMap _objectGuids
Definition: InstanceScript.h:329
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:156
+ Here is the call graph for this function:

◆ CheckAchievementCriteriaMeet()

bool InstanceScript::CheckAchievementCriteriaMeet ( uint32  criteria_id,
Player const *  ,
Unit const *  = nullptr,
uint32  = 0 
)
virtual

Reimplemented in instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript, instance_ulduar::instance_ulduar_InstanceMapScript, instance_trial_of_the_crusader::instance_trial_of_the_crusader_InstanceMapScript, instance_naxxramas::instance_naxxramas_InstanceMapScript, instance_onyxias_lair::instance_onyxias_lair_InstanceMapScript, and instance_vault_of_archavon::instance_vault_of_archavon_InstanceMapScript.

721 {
722  TC_LOG_ERROR("misc", "Achievement system call InstanceScript::CheckAchievementCriteriaMeet but instance script for map %u not have implementation for achievement criteria %u",
723  instance->GetId(), criteria_id);
724  return false;
725 }
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:185
uint32 GetId() const
Definition: Map.cpp:4410
InstanceMap * instance
Definition: InstanceScript.h:156
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CheckRequiredBosses()

virtual bool InstanceScript::CheckRequiredBosses ( uint32  ,
Player const *  = nullptr 
) const
inlinevirtual

◆ Create()

void InstanceScript::Create ( )
virtual
450 {
451  for (size_t i = 0; i < bosses.size(); ++i)
454 }
void UpdateSpawnGroups()
Definition: InstanceScript.cpp:270
Definition: InstanceScript.h:64
virtual bool SetBossState(uint32 id, EncounterState state)
Definition: InstanceScript.cpp:372
std::vector< BossInfo > bosses
Definition: InstanceScript.h:324
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DoCastSpellOnPlayer()

void InstanceScript::DoCastSpellOnPlayer ( Player player,
uint32  spell,
bool  includePets = false,
bool  includeControlled = false 
)
687 {
688  if (!player)
689  return;
690 
691  player->CastSpell(player, spell, true);
692 
693  if (!includePets)
694  return;
695 
696  for (uint8 itr2 = 0; itr2 < MAX_SUMMON_SLOT; ++itr2)
697  {
698  ObjectGuid summonGUID = player->m_SummonSlot[itr2];
699  if (!summonGUID.IsEmpty())
700  if (Creature* summon = instance->GetCreature(summonGUID))
701  summon->CastSpell(player, spell, true);
702  }
703 
704  if (!includeControlled)
705  return;
706 
707  for (auto itr2 = player->m_Controlled.begin(); itr2 != player->m_Controlled.end(); ++itr2)
708  {
709  if (Unit* controlled = *itr2)
710  if (controlled->IsInWorld() && controlled->GetTypeId() == TYPEID_UNIT)
711  controlled->CastSpell(player, spell, true);
712  }
713 }
ObjectGuid m_SummonSlot[MAX_SUMMON_SLOT]
Definition: Unit.h:1541
Definition: ObjectGuid.h:39
Definition: Creature.h:69
InstanceMap * instance
Definition: InstanceScript.h:156
Definition: SharedDefines.h:5922
ControlList m_Controlled
Definition: Unit.h:1296
bool IsEmpty() const
Definition: ObjectGuid.h:310
Creature * GetCreature(ObjectGuid const &guid)
Definition: Map.cpp:4607
uint8_t uint8
Definition: Define.h:145
Definition: ObjectGuid.h:258
Definition: Unit.h:746
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition: Object.cpp:2730
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DoCastSpellOnPlayers()

void InstanceScript::DoCastSpellOnPlayers ( uint32  spell,
bool  includePets = false,
bool  includeControlled = false 
)
679 {
680  instance->DoOnPlayers([this, spell, includePets, includeControlled](Player* player)
681  {
682  DoCastSpellOnPlayer(player, spell, includePets, includeControlled);
683  });
684 }
InstanceMap * instance
Definition: InstanceScript.h:156
void DoCastSpellOnPlayer(Player *player, uint32 spell, bool includePets=false, bool includeControlled=false)
Definition: InstanceScript.cpp:686
void DoOnPlayers(T &&fn)
Definition: Map.h:441
Definition: Player.h:1131
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DoCloseDoorOrButton()

void InstanceScript::DoCloseDoorOrButton ( ObjectGuid  guid)
568 {
569  if (!guid)
570  return;
571 
572  if (GameObject* go = instance->GetGameObject(guid))
573  {
574  if (go->GetGoType() == GAMEOBJECT_TYPE_DOOR || go->GetGoType() == GAMEOBJECT_TYPE_BUTTON)
575  {
576  if (go->getLootState() == GO_ACTIVATED)
577  go->ResetDoorOrButton();
578  }
579  else
580  TC_LOG_ERROR("scripts", "InstanceScript: DoCloseDoorOrButton can't use gameobject entry %u, because type is %u.", go->GetEntry(), go->GetGoType());
581  }
582  else
583  TC_LOG_DEBUG("scripts", "InstanceScript: DoCloseDoorOrButton failed");
584 }
Definition: GameObject.h:118
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:185
InstanceMap * instance
Definition: InstanceScript.h:156
Definition: SharedDefines.h:2733
Definition: GameObject.h:125
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:176
GameObject * GetGameObject(ObjectGuid const &guid)
Definition: Map.cpp:4617
Definition: SharedDefines.h:2732
+ Here is the call graph for this function:

◆ DoRemoveAurasDueToSpellOnPlayer()

void InstanceScript::DoRemoveAurasDueToSpellOnPlayer ( Player player,
uint32  spell,
bool  includePets = false,
bool  includeControlled = false 
)
650 {
651  if (!player)
652  return;
653 
654  player->RemoveAurasDueToSpell(spell);
655 
656  if (!includePets)
657  return;
658 
659  for (uint8 itr2 = 0; itr2 < MAX_SUMMON_SLOT; ++itr2)
660  {
661  ObjectGuid summonGUID = player->m_SummonSlot[itr2];
662  if (!summonGUID.IsEmpty())
663  if (Creature* summon = instance->GetCreature(summonGUID))
664  summon->RemoveAurasDueToSpell(spell);
665  }
666 
667  if (!includeControlled)
668  return;
669 
670  for (auto itr2 = player->m_Controlled.begin(); itr2 != player->m_Controlled.end(); ++itr2)
671  {
672  if (Unit* controlled = *itr2)
673  if (controlled->IsInWorld() && controlled->GetTypeId() == TYPEID_UNIT)
674  controlled->RemoveAurasDueToSpell(spell);
675  }
676 }
ObjectGuid m_SummonSlot[MAX_SUMMON_SLOT]
Definition: Unit.h:1541
Definition: ObjectGuid.h:39
Definition: Creature.h:69
InstanceMap * instance
Definition: InstanceScript.h:156
Definition: SharedDefines.h:5922
ControlList m_Controlled
Definition: Unit.h:1296
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:3686
bool IsEmpty() const
Definition: ObjectGuid.h:310
Creature * GetCreature(ObjectGuid const &guid)
Definition: Map.cpp:4607
uint8_t uint8
Definition: Define.h:145
Definition: ObjectGuid.h:258
Definition: Unit.h:746
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DoRemoveAurasDueToSpellOnPlayers()

void InstanceScript::DoRemoveAurasDueToSpellOnPlayers ( uint32  spell,
bool  includePets = false,
bool  includeControlled = false 
)
642 {
643  instance->DoOnPlayers([this, spell, includePets, includeControlled](Player* player)
644  {
645  DoRemoveAurasDueToSpellOnPlayer(player, spell, includePets, includeControlled);
646  });
647 }
InstanceMap * instance
Definition: InstanceScript.h:156
void DoRemoveAurasDueToSpellOnPlayer(Player *player, uint32 spell, bool includePets=false, bool includeControlled=false)
Definition: InstanceScript.cpp:649
void DoOnPlayers(T &&fn)
Definition: Map.h:441
Definition: Player.h:1131
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DoRespawnGameObject()

void InstanceScript::DoRespawnGameObject ( ObjectGuid  guid,
Seconds  timeToDespawn = 1min 
)
587 {
588  if (GameObject* go = instance->GetGameObject(guid))
589  {
590  switch (go->GetGoType())
591  {
596  // not expect any of these should ever be handled
597  TC_LOG_ERROR("scripts", "InstanceScript: DoRespawnGameObject can't respawn gameobject entry %u, because type is %u.", go->GetEntry(), go->GetGoType());
598  return;
599  default:
600  break;
601  }
602 
603  if (go->isSpawned())
604  return;
605 
606  go->SetRespawnTime(timeToDespawn.count());
607  }
608  else
609  TC_LOG_DEBUG("scripts", "InstanceScript: DoRespawnGameObject failed");
610 }
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:185
Definition: SharedDefines.h:2749
InstanceMap * instance
Definition: InstanceScript.h:156
Definition: SharedDefines.h:2733
Definition: GameObject.h:125
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:176
GameObject * GetGameObject(ObjectGuid const &guid)
Definition: Map.cpp:4617
Definition: SharedDefines.h:2738
Definition: SharedDefines.h:2732
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DoSendNotifyToInstance()

void InstanceScript::DoSendNotifyToInstance ( char const *  format,
  ... 
)
619 {
620  va_list ap;
621  va_start(ap, format);
622  char buff[1024];
623  vsnprintf(buff, 1024, format, ap);
624  va_end(ap);
625 
626  instance->DoOnPlayers([&buff](Player const* player)
627  {
628  player->GetSession()->SendNotification("%s", buff);
629  });
630 }
WorldSession * GetSession() const
Definition: Player.h:2082
InstanceMap * instance
Definition: InstanceScript.h:156
void SendNotification(char const *format,...) ATTR_PRINTF(2
Definition: WorldSession.cpp:739
void DoOnPlayers(T &&fn)
Definition: Map.h:441
Definition: Player.h:1131
+ Here is the call graph for this function:

◆ DoUpdateCriteria()

void InstanceScript::DoUpdateCriteria ( CriteriaType  type,
uint32  miscValue1 = 0,
uint32  miscValue2 = 0,
Unit unit = nullptr 
)
634 {
635  instance->DoOnPlayers([type, miscValue1, miscValue2, unit](Player* player)
636  {
637  player->UpdateCriteria(type, miscValue1, miscValue2, 0, unit);
638  });
639 }
void UpdateCriteria(CriteriaType type, uint64 miscValue1=0, uint64 miscValue2=0, uint64 miscValue3=0, WorldObject *ref=nullptr)
Definition: Player.cpp:26905
InstanceMap * instance
Definition: InstanceScript.h:156
void DoOnPlayers(T &&fn)
Definition: Map.h:441
Definition: Player.h:1131
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DoUpdateWorldState()

void InstanceScript::DoUpdateWorldState ( int32  worldStateId,
int32  value 
)
613 {
614  sWorldStateMgr->SetValue(worldStateId, value, instance);
615 }
#define sWorldStateMgr
Definition: WorldStateMgr.h:48
InstanceMap * instance
Definition: InstanceScript.h:156
+ Here is the caller graph for this function:

◆ DoUseDoorOrButton()

void InstanceScript::DoUseDoorOrButton ( ObjectGuid  guid,
uint32  withRestoreTime = 0,
bool  useAlternativeState = false 
)
547 {
548  if (!guid)
549  return;
550 
551  if (GameObject* go = instance->GetGameObject(guid))
552  {
553  if (go->GetGoType() == GAMEOBJECT_TYPE_DOOR || go->GetGoType() == GAMEOBJECT_TYPE_BUTTON)
554  {
555  if (go->getLootState() == GO_READY)
556  go->UseDoorOrButton(withRestoreTime, useAlternativeState);
557  else if (go->getLootState() == GO_ACTIVATED)
558  go->ResetDoorOrButton();
559  }
560  else
561  TC_LOG_ERROR("scripts", "InstanceScript: DoUseDoorOrButton can't use gameobject entry %u, because type is %u.", go->GetEntry(), go->GetGoType());
562  }
563  else
564  TC_LOG_DEBUG("scripts", "InstanceScript: DoUseDoorOrButton failed");
565 }
Definition: GameObject.h:118
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:185
InstanceMap * instance
Definition: InstanceScript.h:156
Definition: SharedDefines.h:2733
Definition: GameObject.h:125
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:176
GameObject * GetGameObject(ObjectGuid const &guid)
Definition: Map.cpp:4617
Definition: GameObject.h:117
Definition: SharedDefines.h:2732
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetBossBoundary()

CreatureBoundary const* InstanceScript::GetBossBoundary ( uint32  id) const
inline
234 { return id < bosses.size() ? &bosses[id].boundary : nullptr; }
uint32 id
Definition: EventMap.cpp:184
std::vector< BossInfo > bosses
Definition: InstanceScript.h:324
+ Here is the caller graph for this function:

◆ GetBossInfo()

BossInfo * InstanceScript::GetBossInfo ( uint32  id)
protected
307 {
308  ASSERT(id < bosses.size());
309  return &bosses[id];
310 }
uint32 id
Definition: EventMap.cpp:184
#define ASSERT
Definition: Errors.h:68
std::vector< BossInfo > bosses
Definition: InstanceScript.h:324

◆ GetBossState()

EncounterState InstanceScript::GetBossState ( uint32  id) const
inline
232 { return id < bosses.size() ? bosses[id].state : TO_BE_DECIDED; }
uint32 id
Definition: EventMap.cpp:184
Definition: InstanceScript.h:69
std::vector< BossInfo > bosses
Definition: InstanceScript.h:324
+ Here is the caller graph for this function:

◆ GetBossStateName()

char const * InstanceScript::GetBossStateName ( uint8  state)
static
862 {
863  // See enum EncounterState in InstanceScript.h
864  switch (state)
865  {
866  case NOT_STARTED:
867  return "NOT_STARTED";
868  case IN_PROGRESS:
869  return "IN_PROGRESS";
870  case FAIL:
871  return "FAIL";
872  case DONE:
873  return "DONE";
874  case SPECIAL:
875  return "SPECIAL";
876  case TO_BE_DECIDED:
877  return "TO_BE_DECIDED";
878  default:
879  return "INVALID";
880  }
881 }
Definition: InstanceScript.h:67
Definition: InstanceScript.h:66
Definition: InstanceScript.h:65
Definition: InstanceScript.h:64
Definition: InstanceScript.h:68
Definition: InstanceScript.h:69
+ Here is the caller graph for this function:

◆ GetCombatResurrectionChargeInterval()

uint32 InstanceScript::GetCombatResurrectionChargeInterval ( ) const
930 {
931  uint32 interval = 0;
932  if (uint32 playerCount = instance->GetPlayers().getSize())
933  interval = 90 * MINUTE * IN_MILLISECONDS / playerCount;
934 
935  return interval;
936 }
uint32 getSize() const
Definition: LinkedList.h:128
InstanceMap * instance
Definition: InstanceScript.h:156
Definition: Common.h:62
PlayerList const & GetPlayers() const
Definition: Map.h:438
Definition: Common.h:68
uint32_t uint32
Definition: Define.h:143
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetCombatResurrectionCharges()

uint8 InstanceScript::GetCombatResurrectionCharges ( ) const
inline
282 { return _combatResurrectionCharges; }
uint8 _combatResurrectionCharges
Definition: InstanceScript.h:336

◆ GetCompletedEncounterMask()

uint32 InstanceScript::GetCompletedEncounterMask ( ) const
inline
251 { return completedEncounters; }
uint32 completedEncounters
Definition: InstanceScript.h:330
+ Here is the caller graph for this function:

◆ GetCreature()

Creature * InstanceScript::GetCreature ( uint32  type)
152 {
153  return instance->GetCreature(GetObjectGuid(type));
154 }
ObjectGuid GetObjectGuid(uint32 type) const
Definition: InstanceScript.cpp:121
InstanceMap * instance
Definition: InstanceScript.h:156
Creature * GetCreature(ObjectGuid const &guid)
Definition: Map.cpp:4607
+ Here is the call graph for this function:

◆ GetEncounterCount()

uint32 InstanceScript::GetEncounterCount ( ) const
inline
253 { return uint32(bosses.size()); }
uint32_t uint32
Definition: Define.h:143
std::vector< BossInfo > bosses
Definition: InstanceScript.h:324
+ Here is the caller graph for this function:

◆ GetEntranceLocation()

uint32 InstanceScript::GetEntranceLocation ( ) const
inline
uint32 _entranceId
Definition: InstanceScript.h:333
uint32 _temporaryEntranceId
Definition: InstanceScript.h:334

◆ GetGameObject()

GameObject * InstanceScript::GetGameObject ( uint32  type)
157 {
158  return instance->GetGameObject(GetObjectGuid(type));
159 }
ObjectGuid GetObjectGuid(uint32 type) const
Definition: InstanceScript.cpp:121
InstanceMap * instance
Definition: InstanceScript.h:156
GameObject * GetGameObject(ObjectGuid const &guid)
Definition: Map.cpp:4617
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetGuidData()

ObjectGuid InstanceScript::GetGuidData ( uint32  type) const
overridevirtual

Reimplemented from ZoneScript.

Reimplemented in instance_ulduar::instance_ulduar_InstanceMapScript, instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript, instance_halls_of_reflection::instance_halls_of_reflection_InstanceMapScript, instance_uldaman::instance_uldaman_InstanceMapScript, instance_violet_hold::instance_violet_hold_InstanceMapScript, instance_stratholme::instance_stratholme_InstanceMapScript, instance_blackrock_spire::instance_blackrock_spireMapScript, instance_naxxramas::instance_naxxramas_InstanceMapScript, instance_blackrock_depths::instance_blackrock_depths_InstanceMapScript, instance_karazhan::instance_karazhan_InstanceMapScript, instance_serpent_shrine::instance_serpentshrine_cavern_InstanceMapScript, instance_trial_of_the_champion::instance_trial_of_the_champion_InstanceMapScript, instance_eye_of_eternity::instance_eye_of_eternity_InstanceMapScript, instance_the_black_morass::instance_the_black_morass_InstanceMapScript, instance_pit_of_saron::instance_pit_of_saron_InstanceScript, instance_oculus::instance_oculus_InstanceMapScript, instance_blackfathom_deeps::instance_blackfathom_deeps_InstanceMapScript, instance_deadmines::instance_deadmines_InstanceMapScript, instance_old_hillsbrad::instance_old_hillsbrad_InstanceMapScript, instance_onyxias_lair::instance_onyxias_lair_InstanceMapScript, instance_zulfarrak::instance_zulfarrak_InstanceMapScript, instance_shattered_halls::instance_shattered_halls_InstanceMapScript, instance_nexus::instance_nexus_InstanceMapScript, instance_shadow_labyrinth::instance_shadow_labyrinth_InstanceMapScript, instance_hyjal::instance_mount_hyjal_InstanceMapScript, instance_halls_of_origination::instance_halls_of_origination_InstanceMapScript, instance_blood_furnace::instance_blood_furnace_InstanceMapScript, instance_arcatraz::instance_arcatraz_InstanceMapScript, instance_utgarde_keep::instance_utgarde_keep_InstanceMapScript, instance_ruby_sanctum::instance_ruby_sanctum_InstanceMapScript, instance_dire_maul::instance_dire_maul_InstanceMapScript, instance_zulgurub::instance_zulgurub_InstanceMapScript, instance_drak_tharon_keep::instance_drak_tharon_keep_InstanceScript, instance_molten_core::instance_molten_core_InstanceMapScript, instance_zulaman::instance_zulaman_InstanceScript, instance_halls_of_stone::instance_halls_of_stone_InstanceMapScript, instance_sunwell_plateau::instance_sunwell_plateau_InstanceMapScript, instance_forge_of_souls::instance_forge_of_souls_InstanceScript, instance_scholomance::instance_scholomance_InstanceMapScript, instance_wailing_caverns::instance_wailing_caverns_InstanceMapScript, instance_halls_of_lightning::instance_halls_of_lightning_InstanceMapScript, instance_gnomeregan::instance_gnomeregan_InstanceMapScript, instance_obsidian_sanctum::instance_obsidian_sanctum_InstanceMapScript, instance_utgarde_pinnacle::instance_utgarde_pinnacle_InstanceMapScript, instance_firelands::instance_firelands_InstanceScript, instance_baradin_hold::instance_baradin_hold_InstanceMapScript, instance_ruins_of_ahnqiraj::instance_ruins_of_ahnqiraj_InstanceMapScript, instance_the_slave_pens::instance_the_slave_pens_InstanceMapScript, instance_gruuls_lair::instance_gruuls_lair_InstanceMapScript, and instance_the_botanica::instance_the_botanica_InstanceMapScript.

130 {
131  return GetObjectGuid(type);
132 }
ObjectGuid GetObjectGuid(uint32 type) const
Definition: InstanceScript.cpp:121
+ Here is the call graph for this function:

◆ GetObjectGuid()

ObjectGuid InstanceScript::GetObjectGuid ( uint32  type) const
122 {
123  ObjectGuidMap::const_iterator i = _objectGuids.find(type);
124  if (i != _objectGuids.end())
125  return i->second;
126  return ObjectGuid::Empty;
127 }
static ObjectGuid const Empty
Definition: ObjectGuid.h:265
ObjectGuidMap _objectGuids
Definition: InstanceScript.h:329
+ Here is the caller graph for this function:

◆ GetSaveData()

std::string InstanceScript::GetSaveData ( )
virtual

Reimplemented in instance_trial_of_the_crusader::instance_trial_of_the_crusader_InstanceMapScript, instance_uldaman::instance_uldaman_InstanceMapScript, instance_stratholme::instance_stratholme_InstanceMapScript, instance_serpent_shrine::instance_serpentshrine_cavern_InstanceMapScript, instance_blackrock_depths::instance_blackrock_depths_InstanceMapScript, instance_hyjal::instance_mount_hyjal_InstanceMapScript, instance_shadowfang_keep::instance_shadowfang_keep_InstanceMapScript, and instance_wailing_caverns::instance_wailing_caverns_InstanceMapScript.

510 {
512 
513  std::ostringstream saveStream;
514 
515  WriteSaveDataHeaders(saveStream);
516  WriteSaveDataBossStates(saveStream);
517  WriteSaveDataMore(saveStream);
518 
520 
521  return saveStream.str();
522 }
void WriteSaveDataHeaders(std::ostringstream &data)
Definition: InstanceScript.cpp:524
#define OUT_SAVE_INST_DATA
Definition: InstanceScript.h:28
virtual void WriteSaveDataMore(std::ostringstream &)
Definition: InstanceScript.h:315
void WriteSaveDataBossStates(std::ostringstream &data)
Definition: InstanceScript.cpp:530
#define OUT_SAVE_INST_DATA_COMPLETE
Definition: InstanceScript.h:29
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ HandleGameObject()

void InstanceScript::HandleGameObject ( ObjectGuid  guid,
bool  open,
GameObject go = nullptr 
)
537 {
538  if (!go)
539  go = instance->GetGameObject(guid);
540  if (go)
542  else
543  TC_LOG_DEBUG("scripts", "InstanceScript: HandleGameObject failed");
544 }
Definition: SharedDefines.h:2841
InstanceMap * instance
Definition: InstanceScript.h:156
Definition: SharedDefines.h:2840
void SetGoState(GOState state)
Definition: GameObject.cpp:3088
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:176
GameObject * GetGameObject(ObjectGuid const &guid)
Definition: Map.cpp:4617
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ InitializeCombatResurrections()

void InstanceScript::InitializeCombatResurrections ( uint8  charges = 1,
uint32  interval = 0 
)
895 {
896  _combatResurrectionCharges = charges;
897  if (!interval)
898  return;
899 
900  _combatResurrectionTimer = interval;
902 }
uint32 _combatResurrectionTimer
Definition: InstanceScript.h:335
uint8 _combatResurrectionCharges
Definition: InstanceScript.h:336
bool _combatResurrectionTimerStarted
Definition: InstanceScript.h:337
+ Here is the caller graph for this function:

◆ IsAreaTriggerDone()

bool InstanceScript::IsAreaTriggerDone ( uint32  id) const
inline
267 { return _activatedAreaTriggers.find(id) != _activatedAreaTriggers.end(); }
std::unordered_set< uint32 > _activatedAreaTriggers
Definition: InstanceScript.h:332
+ Here is the caller graph for this function:

◆ IsEncounterInProgress()

bool InstanceScript::IsEncounterInProgress ( ) const
virtual

Reimplemented in instance_serpent_shrine::instance_serpentshrine_cavern_InstanceMapScript, instance_the_black_morass::instance_the_black_morass_InstanceMapScript, instance_temple_of_ahnqiraj::instance_temple_of_ahnqiraj_InstanceMapScript, instance_hyjal::instance_mount_hyjal_InstanceMapScript, and instance_uldaman::instance_uldaman_InstanceMapScript.

89 {
90  for (std::vector<BossInfo>::const_iterator itr = bosses.begin(); itr != bosses.end(); ++itr)
91  if (itr->state == IN_PROGRESS)
92  return true;
93 
94  return false;
95 }
Definition: InstanceScript.h:65
std::vector< BossInfo > bosses
Definition: InstanceScript.h:324
+ Here is the caller graph for this function:

◆ Load()

void InstanceScript::Load ( char const *  data)
virtual

Reimplemented in instance_trial_of_the_crusader::instance_trial_of_the_crusader_InstanceMapScript, instance_uldaman::instance_uldaman_InstanceMapScript, instance_stratholme::instance_stratholme_InstanceMapScript, instance_serpent_shrine::instance_serpentshrine_cavern_InstanceMapScript, instance_blackrock_depths::instance_blackrock_depths_InstanceMapScript, instance_hyjal::instance_mount_hyjal_InstanceMapScript, instance_shadowfang_keep::instance_shadowfang_keep_InstanceMapScript, and instance_wailing_caverns::instance_wailing_caverns_InstanceMapScript.

457 {
458  if (!data)
459  {
461  return;
462  }
463 
464  OUT_LOAD_INST_DATA(data);
465 
466  std::istringstream loadStream(data);
467 
468  if (ReadSaveDataHeaders(loadStream))
469  {
470  ReadSaveDataBossStates(loadStream);
471  ReadSaveDataMore(loadStream);
472  }
473  else
475 
477 }
#define OUT_LOAD_INST_DATA_FAIL
Definition: InstanceScript.h:32
bool ReadSaveDataHeaders(std::istringstream &data)
Definition: InstanceScript.cpp:479
#define OUT_LOAD_INST_DATA_COMPLETE
Definition: InstanceScript.h:31
void ReadSaveDataBossStates(std::istringstream &data)
Definition: InstanceScript.cpp:493
virtual void ReadSaveDataMore(std::istringstream &)
Definition: InstanceScript.h:312
#define OUT_LOAD_INST_DATA(a)
Definition: InstanceScript.h:30
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ LoadBossBoundaries()

void InstanceScript::LoadBossBoundaries ( BossBoundaryData const &  data)
protected
169 {
170  for (BossBoundaryEntry const& entry : data)
171  if (entry.BossId < bosses.size())
172  bosses[entry.BossId].boundary.push_back(entry.Boundary);
173 }
Definition: InstanceScript.h:86
std::vector< BossInfo > bosses
Definition: InstanceScript.h:324
+ Here is the caller graph for this function:

◆ LoadDoorData()

void InstanceScript::LoadDoorData ( DoorData const *  data)
protected
188 {
189  while (data->entry)
190  {
191  if (data->bossId < bosses.size())
192  doors.insert(std::make_pair(data->entry, DoorInfo(&bosses[data->bossId], data->type)));
193 
194  ++data;
195  }
196  TC_LOG_DEBUG("scripts", "InstanceScript::LoadDoorData: " UI64FMTD " doors loaded.", uint64(doors.size()));
197 }
#define UI64FMTD
Definition: Define.h:127
uint64_t uint64
Definition: Define.h:142
Definition: InstanceScript.h:128
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:176
std::vector< BossInfo > bosses
Definition: InstanceScript.h:324
DoorInfoMap doors
Definition: InstanceScript.h:325
+ Here is the caller graph for this function:

◆ LoadMinionData()

void InstanceScript::LoadMinionData ( MinionData const *  data)
protected
176 {
177  while (data->entry)
178  {
179  if (data->bossId < bosses.size())
180  minions.insert(std::make_pair(data->entry, MinionInfo(&bosses[data->bossId])));
181 
182  ++data;
183  }
184  TC_LOG_DEBUG("scripts", "InstanceScript::LoadMinionData: " UI64FMTD " minions loaded.", uint64(minions.size()));
185 }
MinionInfoMap minions
Definition: InstanceScript.h:326
#define UI64FMTD
Definition: Define.h:127
uint64_t uint64
Definition: Define.h:142
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:176
Definition: InstanceScript.h:136
std::vector< BossInfo > bosses
Definition: InstanceScript.h:324
+ Here is the caller graph for this function:

◆ LoadObjectData() [1/2]

void InstanceScript::LoadObjectData ( ObjectData const *  creatureData,
ObjectData const *  gameObjectData 
)
protected
200 {
201  if (creatureData)
203 
204  if (gameObjectData)
206 
207  TC_LOG_DEBUG("scripts", "InstanceScript::LoadObjectData: " SZFMTD " objects loaded.", _creatureInfo.size() + _gameObjectInfo.size());
208 }
#define SZFMTD
Definition: Define.h:133
ObjectInfoMap _creatureInfo
Definition: InstanceScript.h:327
ObjectData const gameObjectData[]
Definition: instance_blackwing_lair.cpp:55
ObjectInfoMap _gameObjectInfo
Definition: InstanceScript.h:328
ObjectData const creatureData[]
Definition: instance_antorus_the_burning_throne.cpp:25
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:176
void LoadObjectData(ObjectData const *creatureData, ObjectData const *gameObjectData)
Definition: InstanceScript.cpp:199
+ Here is the caller graph for this function:

◆ LoadObjectData() [2/2]

void InstanceScript::LoadObjectData ( ObjectData const *  creatureData,
ObjectInfoMap objectInfo 
)
staticprivate
211 {
212  while (data->entry)
213  {
214  ASSERT(objectInfo.find(data->entry) == objectInfo.end());
215  objectInfo[data->entry] = data->type;
216  ++data;
217  }
218 }
#define ASSERT
Definition: Errors.h:68

◆ MarkAreaTriggerDone()

void InstanceScript::MarkAreaTriggerDone ( uint32  id)
inline
265 { _activatedAreaTriggers.insert(id); }
std::unordered_set< uint32 > _activatedAreaTriggers
Definition: InstanceScript.h:332
+ Here is the caller graph for this function:

◆ OnCreatureCreate()

void InstanceScript::OnCreatureCreate ( Creature creature)
overridevirtual

Reimplemented from ZoneScript.

Reimplemented in instance_culling_of_stratholme::instance_culling_of_stratholme_InstanceMapScript, instance_uldaman::instance_uldaman_InstanceMapScript, instance_ulduar::instance_ulduar_InstanceMapScript, instance_violet_hold::instance_violet_hold_InstanceMapScript, instance_serpent_shrine::instance_serpentshrine_cavern_InstanceMapScript, instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript, instance_stratholme::instance_stratholme_InstanceMapScript, instance_zulfarrak::instance_zulfarrak_InstanceMapScript, instance_trial_of_the_crusader::instance_trial_of_the_crusader_InstanceMapScript, instance_blackrock_depths::instance_blackrock_depths_InstanceMapScript, instance_naxxramas::instance_naxxramas_InstanceMapScript, instance_eye_of_eternity::instance_eye_of_eternity_InstanceMapScript, instance_the_black_morass::instance_the_black_morass_InstanceMapScript, instance_halls_of_origination::instance_halls_of_origination_InstanceMapScript, instance_black_temple::instance_black_temple_InstanceMapScript, instance_halls_of_reflection::instance_halls_of_reflection_InstanceMapScript, instance_hyjal::instance_mount_hyjal_InstanceMapScript, instance_magisters_terrace::instance_magisters_terrace_InstanceMapScript, instance_shadowfang_keep::instance_shadowfang_keep_InstanceMapScript, instance_ruby_sanctum::instance_ruby_sanctum_InstanceMapScript, instance_shattered_halls::instance_shattered_halls_InstanceMapScript, instance_blackwing_lair::instance_blackwing_lair_InstanceMapScript, instance_old_hillsbrad::instance_old_hillsbrad_InstanceMapScript, instance_magtheridons_lair::instance_magtheridons_lair_InstanceMapScript, instance_trial_of_the_champion::instance_trial_of_the_champion_InstanceMapScript, instance_dire_maul::instance_dire_maul_InstanceMapScript, instance_stonecore::instance_stonecore_InstanceScript, instance_gundrak::instance_gundrak_InstanceMapScript, instance_karazhan::instance_karazhan_InstanceMapScript, instance_blackfathom_deeps::instance_blackfathom_deeps_InstanceMapScript, instance_onyxias_lair::instance_onyxias_lair_InstanceMapScript, instance_blackrock_spire::instance_blackrock_spireMapScript, instance_blood_furnace::instance_blood_furnace_InstanceMapScript, instance_molten_core::instance_molten_core_InstanceMapScript, instance_pit_of_saron::instance_pit_of_saron_InstanceScript, instance_wailing_caverns::instance_wailing_caverns_InstanceMapScript, instance_oculus::instance_oculus_InstanceMapScript, instance_antorus_the_burning_throne::instance_antorus_the_burning_throne_InstanceMapScript, instance_gruuls_lair::instance_gruuls_lair_InstanceMapScript, instance_forge_of_souls::instance_forge_of_souls_InstanceScript, instance_utgarde_keep::instance_utgarde_keep_InstanceMapScript, instance_sethekk_halls::instance_sethekk_halls_InstanceMapScript, instance_the_slave_pens::instance_the_slave_pens_InstanceMapScript, instance_arcatraz::instance_arcatraz_InstanceMapScript, instance_gnomeregan::instance_gnomeregan_InstanceMapScript, instance_shadow_labyrinth::instance_shadow_labyrinth_InstanceMapScript, instance_baradin_hold::instance_baradin_hold_InstanceMapScript, instance_zulgurub::instance_zulgurub_InstanceMapScript, instance_obsidian_sanctum::instance_obsidian_sanctum_InstanceMapScript, instance_halls_of_lightning::instance_halls_of_lightning_InstanceMapScript, instance_nexus::instance_nexus_InstanceMapScript, instance_halls_of_stone::instance_halls_of_stone_InstanceMapScript, instance_zulaman::instance_zulaman_InstanceScript, instance_firelands::instance_firelands_InstanceScript, instance_drak_tharon_keep::instance_drak_tharon_keep_InstanceScript, instance_ruins_of_ahnqiraj::instance_ruins_of_ahnqiraj_InstanceMapScript, and instance_the_botanica::instance_the_botanica_InstanceMapScript.

98 {
99  AddObject(creature, true);
100  AddMinion(creature, true);
101 }
void AddObject(Creature *obj, bool add)
Definition: InstanceScript.cpp:312
void AddMinion(Creature *minion, bool add)
Definition: InstanceScript.cpp:360
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ OnCreatureRemove()

void InstanceScript::OnCreatureRemove ( Creature creature)
overridevirtual

Reimplemented from ZoneScript.

Reimplemented in instance_ulduar::instance_ulduar_InstanceMapScript, instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript, instance_violet_hold::instance_violet_hold_InstanceMapScript, instance_stratholme::instance_stratholme_InstanceMapScript, instance_halls_of_reflection::instance_halls_of_reflection_InstanceMapScript, instance_shadow_labyrinth::instance_shadow_labyrinth_InstanceMapScript, and instance_utgarde_keep::instance_utgarde_keep_InstanceMapScript.

104 {
105  AddObject(creature, false);
106  AddMinion(creature, false);
107 }
void AddObject(Creature *obj, bool add)
Definition: InstanceScript.cpp:312
void AddMinion(Creature *minion, bool add)
Definition: InstanceScript.cpp:360
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ OnGameObjectCreate()

void InstanceScript::OnGameObjectCreate ( GameObject go)
overridevirtual

Reimplemented from ZoneScript.

Reimplemented in instance_culling_of_stratholme::instance_culling_of_stratholme_InstanceMapScript, instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript, instance_ulduar::instance_ulduar_InstanceMapScript, instance_violet_hold::instance_violet_hold_InstanceMapScript, instance_halls_of_reflection::instance_halls_of_reflection_InstanceMapScript, instance_stratholme::instance_stratholme_InstanceMapScript, instance_naxxramas::instance_naxxramas_InstanceMapScript, instance_karazhan::instance_karazhan_InstanceMapScript, instance_serpent_shrine::instance_serpentshrine_cavern_InstanceMapScript, instance_deadmines::instance_deadmines_InstanceMapScript, instance_zulfarrak::instance_zulfarrak_InstanceMapScript, instance_blackrock_depths::instance_blackrock_depths_InstanceMapScript, instance_magisters_terrace::instance_magisters_terrace_InstanceMapScript, instance_trial_of_the_crusader::instance_trial_of_the_crusader_InstanceMapScript, instance_trial_of_the_champion::instance_trial_of_the_champion_InstanceMapScript, instance_blackrock_spire::instance_blackrock_spireMapScript, instance_oculus::instance_oculus_InstanceMapScript, instance_blackwing_lair::instance_blackwing_lair_InstanceMapScript, instance_shadowfang_keep::instance_shadowfang_keep_InstanceMapScript, instance_ruby_sanctum::instance_ruby_sanctum_InstanceMapScript, instance_black_temple::instance_black_temple_InstanceMapScript, instance_uldaman::instance_uldaman_InstanceMapScript, instance_eye_of_eternity::instance_eye_of_eternity_InstanceMapScript, instance_dire_maul::instance_dire_maul_InstanceMapScript, instance_shadow_labyrinth::instance_shadow_labyrinth_InstanceMapScript, instance_blood_furnace::instance_blood_furnace_InstanceMapScript, instance_nexus::instance_nexus_InstanceMapScript, instance_gundrak::instance_gundrak_InstanceMapScript, instance_sunken_temple::instance_sunken_temple_InstanceMapScript, instance_utgarde_keep::instance_utgarde_keep_InstanceMapScript, instance_blackfathom_deeps::instance_blackfathom_deeps_InstanceMapScript, instance_hyjal::instance_mount_hyjal_InstanceMapScript, instance_magtheridons_lair::instance_magtheridons_lair_InstanceMapScript, instance_molten_core::instance_molten_core_InstanceMapScript, instance_onyxias_lair::instance_onyxias_lair_InstanceMapScript, instance_zulaman::instance_zulaman_InstanceScript, instance_steam_vault::instance_steam_vault_InstanceMapScript, instance_halls_of_stone::instance_halls_of_stone_InstanceMapScript, instance_utgarde_pinnacle::instance_utgarde_pinnacle_InstanceMapScript, instance_arcatraz::instance_arcatraz_InstanceMapScript, instance_ahnkahet::instance_ahnkahet_InstanceScript, instance_halls_of_lightning::instance_halls_of_lightning_InstanceMapScript, instance_razorfen_downs::instance_razorfen_downs_InstanceMapScript, instance_drak_tharon_keep::instance_drak_tharon_keep_InstanceScript, instance_baradin_hold::instance_baradin_hold_InstanceMapScript, instance_stonecore::instance_stonecore_InstanceScript, instance_gnomeregan::instance_gnomeregan_InstanceMapScript, instance_halls_of_origination::instance_halls_of_origination_InstanceMapScript, instance_firelands::instance_firelands_InstanceScript, instance_razorfen_kraul::instance_razorfen_kraul_InstanceMapScript, instance_scholomance::instance_scholomance_InstanceMapScript, and instance_ramparts::instance_ramparts_InstanceMapScript.

110 {
111  AddObject(go, true);
112  AddDoor(go, true);
113 }
void AddObject(Creature *obj, bool add)
Definition: InstanceScript.cpp:312
virtual void AddDoor(GameObject *door, bool add)
Definition: InstanceScript.cpp:338
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ OnGameObjectRemove()

void InstanceScript::OnGameObjectRemove ( GameObject go)
overridevirtual

Reimplemented from ZoneScript.

Reimplemented in instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript, instance_halls_of_reflection::instance_halls_of_reflection_InstanceMapScript, instance_violet_hold::instance_violet_hold_InstanceMapScript, instance_blackwing_lair::instance_blackwing_lair_InstanceMapScript, instance_shadow_labyrinth::instance_shadow_labyrinth_InstanceMapScript, instance_onyxias_lair::instance_onyxias_lair_InstanceMapScript, instance_halls_of_origination::instance_halls_of_origination_InstanceMapScript, instance_zulaman::instance_zulaman_InstanceScript, and instance_baradin_hold::instance_baradin_hold_InstanceMapScript.

116 {
117  AddObject(go, false);
118  AddDoor(go, false);
119 }
void AddObject(Creature *obj, bool add)
Definition: InstanceScript.cpp:312
virtual void AddDoor(GameObject *door, bool add)
Definition: InstanceScript.cpp:338
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ OnPlayerEnter()

◆ OnPlayerLeave()

virtual void InstanceScript::OnPlayerLeave ( Player )
inlinevirtual

Reimplemented in instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript, and instance_eye_of_eternity::instance_eye_of_eternity_InstanceMapScript.

197 { }
+ Here is the caller graph for this function:

◆ ReadSaveDataBossStates()

void InstanceScript::ReadSaveDataBossStates ( std::istringstream &  data)
protected
494 {
495  uint32 bossId = 0;
496  for (std::vector<BossInfo>::iterator i = bosses.begin(); i != bosses.end(); ++i, ++bossId)
497  {
498  uint32 buff;
499  data >> buff;
500  if (buff == IN_PROGRESS || buff == FAIL || buff == SPECIAL)
501  buff = NOT_STARTED;
502 
503  if (buff < TO_BE_DECIDED)
504  SetBossState(bossId, EncounterState(buff));
505  }
507 }
EncounterState
Definition: InstanceScript.h:62
Definition: InstanceScript.h:66
void UpdateSpawnGroups()
Definition: InstanceScript.cpp:270
Definition: InstanceScript.h:65
Definition: InstanceScript.h:64
uint32_t uint32
Definition: Define.h:143
Definition: InstanceScript.h:68
virtual bool SetBossState(uint32 id, EncounterState state)
Definition: InstanceScript.cpp:372
Definition: InstanceScript.h:69
std::vector< BossInfo > bosses
Definition: InstanceScript.h:324
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ReadSaveDataHeaders()

bool InstanceScript::ReadSaveDataHeaders ( std::istringstream &  data)
protected
480 {
481  for (char header : headers)
482  {
483  char buff;
484  data >> buff;
485 
486  if (header != buff)
487  return false;
488  }
489 
490  return true;
491 }
std::vector< char > headers
Definition: InstanceScript.h:323
+ Here is the caller graph for this function:

◆ ReadSaveDataMore()

◆ ResetAreaTriggerDone()

void InstanceScript::ResetAreaTriggerDone ( uint32  id)
inline
266 { _activatedAreaTriggers.erase(id); }
std::unordered_set< uint32 > _activatedAreaTriggers
Definition: InstanceScript.h:332
+ Here is the caller graph for this function:

◆ ResetCombatResurrections()

void InstanceScript::ResetCombatResurrections ( )
923 {
927 }
uint32 _combatResurrectionTimer
Definition: InstanceScript.h:335
uint8 _combatResurrectionCharges
Definition: InstanceScript.h:336
bool _combatResurrectionTimerStarted
Definition: InstanceScript.h:337
+ Here is the caller graph for this function:

◆ SaveToDB()

void InstanceScript::SaveToDB ( )
72 {
74  scenario->SaveToDB();
75 
76  std::string data = GetSaveData();
77  if (data.empty())
78  return;
79 
82  stmt->setString(1, data);
83  stmt->setUInt32(2, _entranceId);
84  stmt->setUInt32(3, instance->GetInstanceId());
85  CharacterDatabase.Execute(stmt);
86 }
DatabaseWorkerPool< CharacterDatabaseConnection > CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
uint32 _entranceId
Definition: InstanceScript.h:333
uint32 GetInstanceId() const
Definition: Map.h:380
uint32 GetCompletedEncounterMask() const
Definition: InstanceScript.h:251
Definition: DatabaseEnvFwd.h:40
InstanceMap * instance
Definition: InstanceScript.h:156
void setUInt32(const uint8 index, const uint32 value)
Definition: PreparedStatement.cpp:48
void setString(const uint8 index, const std::string &value)
Definition: PreparedStatement.cpp:96
virtual std::string GetSaveData()
Definition: InstanceScript.cpp:509
InstanceScenario * GetInstanceScenario()
Definition: Map.h:959
Definition: CharacterDatabase.h:294
Definition: InstanceScenario.h:25
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SendBossKillCredit()

void InstanceScript::SendBossKillCredit ( uint32  encounterId)
793 {
794  WorldPackets::Instance::BossKill bossKillCreditMessage;
795  bossKillCreditMessage.DungeonEncounterID = encounterId;
796 
797  instance->SendToPlayers(bossKillCreditMessage.Write());
798 }
void SendToPlayers(WorldPacket const *data) const
Definition: Map.cpp:3851
InstanceMap * instance
Definition: InstanceScript.h:156
Definition: InstancePackets.h:240
WorldPacket const * Write() override
Definition: InstancePackets.cpp:163
uint32 DungeonEncounterID
Definition: InstancePackets.h:246
+ Here is the call graph for this function:

◆ SendEncounterEnd()

void InstanceScript::SendEncounterEnd ( )
787 {
789  instance->SendToPlayers(encounterEndMessage.Write());
790 }
void SendToPlayers(WorldPacket const *data) const
Definition: Map.cpp:3851
InstanceMap * instance
Definition: InstanceScript.h:156
Definition: InstancePackets.h:213
WorldPacket const * Write() override
Definition: InstancePackets.h:218
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SendEncounterStart()

void InstanceScript::SendEncounterStart ( uint32  inCombatResCount = 0,
uint32  maxInCombatResCount = 0,
uint32  inCombatResChargeRecovery = 0,
uint32  nextCombatResChargeTime = 0 
)
776 {
778  encounterStartMessage.InCombatResCount = inCombatResCount;
779  encounterStartMessage.MaxInCombatResCount = maxInCombatResCount;
780  encounterStartMessage.CombatResChargeRecovery = inCombatResChargeRecovery;
781  encounterStartMessage.NextCombatResChargeTime = nextCombatResChargeTime;
782 
783  instance->SendToPlayers(encounterStartMessage.Write());
784 }
uint32 NextCombatResChargeTime
Definition: InstancePackets.h:209
void SendToPlayers(WorldPacket const *data) const
Definition: Map.cpp:3851
InstanceMap * instance
Definition: InstanceScript.h:156
WorldPacket const * Write() override
Definition: InstancePackets.cpp:143
uint32 CombatResChargeRecovery
Definition: InstancePackets.h:208
uint32 InCombatResCount
Definition: InstancePackets.h:206
uint32 MaxInCombatResCount
Definition: InstancePackets.h:207
Definition: InstancePackets.h:199
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SendEncounterUnit()

void InstanceScript::SendEncounterUnit ( uint32  type,
Unit unit = nullptr,
uint8  priority = 0 
)
735 {
736  switch (type)
737  {
738  case ENCOUNTER_FRAME_ENGAGE: // SMSG_INSTANCE_ENCOUNTER_ENGAGE_UNIT
739  {
740  if (!unit)
741  return;
742 
744  encounterEngageMessage.Unit = unit->GetGUID();
745  encounterEngageMessage.TargetFramePriority = priority;
746  instance->SendToPlayers(encounterEngageMessage.Write());
747  break;
748  }
749  case ENCOUNTER_FRAME_DISENGAGE: // SMSG_INSTANCE_ENCOUNTER_DISENGAGE_UNIT
750  {
751  if (!unit)
752  return;
753 
755  encounterDisengageMessage.Unit = unit->GetGUID();
756  instance->SendToPlayers(encounterDisengageMessage.Write());
757  break;
758  }
759  case ENCOUNTER_FRAME_UPDATE_PRIORITY: // SMSG_INSTANCE_ENCOUNTER_CHANGE_PRIORITY
760  {
761  if (!unit)
762  return;
763 
764  WorldPackets::Instance::InstanceEncounterChangePriority encounterChangePriorityMessage;
765  encounterChangePriorityMessage.Unit = unit->GetGUID();
766  encounterChangePriorityMessage.TargetFramePriority = priority;
767  instance->SendToPlayers(encounterChangePriorityMessage.Write());
768  break;
769  }
770  default:
771  break;
772  }
773 }
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:156
void SendToPlayers(WorldPacket const *data) const
Definition: Map.cpp:3851
InstanceMap * instance
Definition: InstanceScript.h:156
ObjectGuid Unit
Definition: InstancePackets.h:185
uint8 TargetFramePriority
Definition: InstancePackets.h:196
WorldPacket const * Write() override
Definition: InstancePackets.cpp:128
ObjectGuid Unit
Definition: InstancePackets.h:174
WorldPacket const * Write() override
Definition: InstancePackets.cpp:135
ObjectGuid Unit
Definition: InstancePackets.h:195
uint8 TargetFramePriority
Definition: InstancePackets.h:175
WorldPacket const * Write() override
Definition: InstancePackets.cpp:120
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ServerAllowsTwoSideGroups()

bool InstanceScript::ServerAllowsTwoSideGroups ( )
static
716 {
717  return sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP);
718 }
#define sWorld
Definition: World.h:946
+ Here is the caller graph for this function:

◆ SetBossNumber()

void InstanceScript::SetBossNumber ( uint32  number)
inlineprotected
287 { bosses.resize(number); }
std::vector< BossInfo > bosses
Definition: InstanceScript.h:324
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetBossState()

bool InstanceScript::SetBossState ( uint32  id,
EncounterState  state 
)
virtual

Reimplemented in instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript, instance_ulduar::instance_ulduar_InstanceMapScript, instance_culling_of_stratholme::instance_culling_of_stratholme_InstanceMapScript, instance_naxxramas::instance_naxxramas_InstanceMapScript, instance_violet_hold::instance_violet_hold_InstanceMapScript, instance_halls_of_reflection::instance_halls_of_reflection_InstanceMapScript, instance_blackrock_spire::instance_blackrock_spireMapScript, instance_magisters_terrace::instance_magisters_terrace_InstanceMapScript, instance_blackfathom_deeps::instance_blackfathom_deeps_InstanceMapScript, instance_blackwing_lair::instance_blackwing_lair_InstanceMapScript, instance_black_temple::instance_black_temple_InstanceMapScript, instance_zulaman::instance_zulaman_InstanceScript, instance_trial_of_the_crusader::instance_trial_of_the_crusader_InstanceMapScript, instance_gundrak::instance_gundrak_InstanceMapScript, instance_oculus::instance_oculus_InstanceMapScript, instance_blood_furnace::instance_blood_furnace_InstanceMapScript, instance_arcatraz::instance_arcatraz_InstanceMapScript, instance_karazhan::instance_karazhan_InstanceMapScript, instance_trial_of_the_champion::instance_trial_of_the_champion_InstanceMapScript, instance_pit_of_saron::instance_pit_of_saron_InstanceScript, instance_ruby_sanctum::instance_ruby_sanctum_InstanceMapScript, instance_onyxias_lair::instance_onyxias_lair_InstanceMapScript, instance_halls_of_stone::instance_halls_of_stone_InstanceMapScript, instance_shattered_halls::instance_shattered_halls_InstanceMapScript, instance_molten_core::instance_molten_core_InstanceMapScript, instance_nexus::instance_nexus_InstanceMapScript, instance_steam_vault::instance_steam_vault_InstanceMapScript, instance_stonecore::instance_stonecore_InstanceScript, instance_razorfen_downs::instance_razorfen_downs_InstanceMapScript, instance_zulgurub::instance_zulgurub_InstanceMapScript, instance_halls_of_lightning::instance_halls_of_lightning_InstanceMapScript, instance_scholomance::instance_scholomance_InstanceMapScript, instance_the_botanica::instance_the_botanica_InstanceMapScript, instance_obsidian_sanctum::instance_obsidian_sanctum_InstanceMapScript, instance_firelands::instance_firelands_InstanceScript, instance_eye_of_eternity::instance_eye_of_eternity_InstanceMapScript, instance_sethekk_halls::instance_sethekk_halls_InstanceMapScript, instance_ruins_of_ahnqiraj::instance_ruins_of_ahnqiraj_InstanceMapScript, instance_vault_of_archavon::instance_vault_of_archavon_InstanceMapScript, instance_ramparts::instance_ramparts_InstanceMapScript, instance_mechanar::instance_mechanar_InstanceMapScript, and instance_blackrock_caverns::instance_blackrock_caverns_InstanceMapScript.

373 {
374  if (id < bosses.size())
375  {
376  BossInfo* bossInfo = &bosses[id];
377  if (bossInfo->state == TO_BE_DECIDED) // loading
378  {
379  bossInfo->state = state;
380  TC_LOG_DEBUG("scripts", "InstanceScript: Initialize boss %u state as %s (map %u, %u).", id, GetBossStateName(state), instance->GetId(), instance->GetInstanceId());
381  return false;
382  }
383  else
384  {
385  if (bossInfo->state == state)
386  return false;
387 
388  if (bossInfo->state == DONE)
389  {
390  TC_LOG_ERROR("map", "InstanceScript: Tried to set instance boss %u state from %s back to %s for map %u, instance id %u. Blocked!", id, GetBossStateName(bossInfo->state), GetBossStateName(state), instance->GetId(), instance->GetInstanceId());
391  return false;
392  }
393 
394  if (state == DONE)
395  for (GuidSet::iterator i = bossInfo->minion.begin(); i != bossInfo->minion.end(); ++i)
396  if (Creature* minion = instance->GetCreature(*i))
397  if (minion->isWorldBoss() && minion->IsAlive())
398  return false;
399 
400  switch (state)
401  {
402  case IN_PROGRESS:
403  {
405  InitializeCombatResurrections(1, resInterval);
406  SendEncounterStart(1, 9, resInterval, resInterval);
407 
408  instance->DoOnPlayers([](Player* player)
409  {
410  if (player->IsAlive())
412  });
413  break;
414  }
415  case FAIL:
416  case DONE:
419  break;
420  default:
421  break;
422  }
423 
424  bossInfo->state = state;
425  SaveToDB();
426  }
427 
428  for (uint32 type = 0; type < MAX_DOOR_TYPES; ++type)
429  for (GuidSet::iterator i = bossInfo->door[type].begin(); i != bossInfo->door[type].end(); ++i)
430  if (GameObject* door = instance->GetGameObject(*i))
431  UpdateDoorState(door);
432 
433  GuidSet minions = bossInfo->minion; // Copy to prevent iterator invalidation (minion might be unsummoned in UpdateMinionState)
434  for (GuidSet::iterator i = minions.begin(); i != minions.end(); ++i)
435  if (Creature* minion = instance->GetCreature(*i))
436  UpdateMinionState(minion, state);
437 
439  return true;
440  }
441  return false;
442 }
uint32 GetInstanceId() const
Definition: Map.h:380
uint32 id
Definition: EventMap.cpp:184
void SendEncounterStart(uint32 inCombatResCount=0, uint32 maxInCombatResCount=0, uint32 inCombatResChargeRecovery=0, uint32 nextCombatResChargeTime=0)
Definition: InstanceScript.cpp:775
static void ProcSkillsAndAuras(Unit *actor, Unit *actionTarget, ProcFlagsInit const &typeMaskActor, ProcFlagsInit const &typeMaskActionTarget, ProcFlagsSpellType spellTypeMask, ProcFlagsSpellPhase spellPhaseMask, ProcFlagsHit hitMask, Spell *spell, DamageInfo *damageInfo, HealInfo *healInfo)
Definition: Unit.cpp:5269
std::set< ObjectGuid > GuidSet
Definition: ObjectGuid.h:385
Definition: SpellMgr.h:261
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:185
Definition: SpellMgr.h:272
MinionInfoMap minions
Definition: InstanceScript.h:326
Definition: Creature.h:69
uint32 GetCombatResurrectionChargeInterval() const
Definition: InstanceScript.cpp:929
Definition: InstanceScript.h:67
GuidSet door[MAX_DOOR_TYPES]
Definition: InstanceScript.h:123
Definition: InstanceScript.h:66
void UpdateSpawnGroups()
Definition: InstanceScript.cpp:270
uint32 GetId() const
Definition: Map.cpp:4410
Definition: SpellMgr.h:181
InstanceMap * instance
Definition: InstanceScript.h:156
void InitializeCombatResurrections(uint8 charges=1, uint32 interval=0)
Definition: InstanceScript.cpp:894
Definition: SpellMgr.h:134
Definition: InstanceScript.h:65
bool IsAlive() const
Definition: Unit.h:1251
void SaveToDB()
Definition: InstanceScript.cpp:71
void SendEncounterEnd()
Definition: InstanceScript.cpp:786
Definition: SpellMgr.h:254
uint32_t uint32
Definition: Define.h:143
void ResetCombatResurrections()
Definition: InstanceScript.cpp:922
Definition: GameObject.h:125
EncounterState state
Definition: InstanceScript.h:122
Definition: InstanceScript.h:119
void UpdateMinionState(Creature *minion, EncounterState state)
Definition: InstanceScript.cpp:249
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:176
Creature * GetCreature(ObjectGuid const &guid)
Definition: Map.cpp:4607
Definition: InstanceScript.h:77
Definition: InstanceScript.h:69
static char const * GetBossStateName(uint8 state)
Definition: InstanceScript.cpp:861
void DoOnPlayers(T &&fn)
Definition: Map.h:441
GameObject * GetGameObject(ObjectGuid const &guid)
Definition: Map.cpp:4617
virtual void UpdateDoorState(GameObject *door)
Definition: InstanceScript.cpp:220
GuidSet minion
Definition: InstanceScript.h:124
Definition: Player.h:1131
std::vector< BossInfo > bosses
Definition: InstanceScript.h:324
+ Here is the call graph for this function:

◆ SetCompletedEncountersMask()

void InstanceScript::SetCompletedEncountersMask ( uint32  newMask)
inline
248 { completedEncounters = newMask; }
uint32 completedEncounters
Definition: InstanceScript.h:330
+ Here is the caller graph for this function:

◆ SetEntranceLocation()

void InstanceScript::SetEntranceLocation ( uint32  worldSafeLocationId)
728 {
729  _entranceId = worldSafeLocationId;
732 }
uint32 _entranceId
Definition: InstanceScript.h:333
uint32 _temporaryEntranceId
Definition: InstanceScript.h:334
+ Here is the caller graph for this function:

◆ SetHeaders()

void InstanceScript::SetHeaders ( std::string const &  dataHeaders)
protected
162 {
163  for (char header : dataHeaders)
164  if (isalpha(header))
165  headers.push_back(header);
166 }
std::vector< char > headers
Definition: InstanceScript.h:323
+ Here is the caller graph for this function:

◆ SetTemporaryEntranceLocation()

void InstanceScript::SetTemporaryEntranceLocation ( uint32  worldSafeLocationId)
inline
259 { _temporaryEntranceId = worldSafeLocationId; }
uint32 _temporaryEntranceId
Definition: InstanceScript.h:334

◆ TriggerGameEvent()

void InstanceScript::TriggerGameEvent ( uint32  gameEventId,
WorldObject source = nullptr,
WorldObject target = nullptr 
)
overridevirtual

Reimplemented from ZoneScript.

135 {
136  if (source)
137  {
138  ZoneScript::TriggerGameEvent(gameEventId, source, target);
139  return;
140  }
141 
142  ProcessEvent(target, gameEventId, source);
143  instance->DoOnPlayers([gameEventId](Player* player)
144  {
145  GameEvents::TriggerForPlayer(gameEventId, player);
146  });
147 
148  GameEvents::TriggerForMap(gameEventId, instance);
149 }
InstanceMap * instance
Definition: InstanceScript.h:156
virtual void TriggerGameEvent(uint32 gameEventId, WorldObject *source=nullptr, WorldObject *target=nullptr)
Definition: ZoneScript.cpp:35
void DoOnPlayers(T &&fn)
Definition: Map.h:441
TC_GAME_API void TriggerForMap(uint32 gameEventId, Map *map, WorldObject *source=nullptr, WorldObject *target=nullptr)
Definition: GameEventSender.cpp:67
TC_GAME_API void TriggerForPlayer(uint32 gameEventId, Player *source)
Definition: GameEventSender.cpp:52
Definition: Player.h:1131
virtual void ProcessEvent(WorldObject *, uint32, WorldObject *)
Definition: ZoneScript.h:65
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Update()

virtual void InstanceScript::Update ( uint32  )
inlinevirtual

Reimplemented in instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript, instance_ulduar::instance_ulduar_InstanceMapScript, instance_violet_hold::instance_violet_hold_InstanceMapScript, instance_trial_of_the_crusader::instance_trial_of_the_crusader_InstanceMapScript, instance_halls_of_reflection::instance_halls_of_reflection_InstanceMapScript, instance_stratholme::instance_stratholme_InstanceMapScript, instance_culling_of_stratholme::instance_culling_of_stratholme_InstanceMapScript, instance_naxxramas::instance_naxxramas_InstanceMapScript, instance_blackrock_depths::instance_blackrock_depths_InstanceMapScript, instance_blackrock_spire::instance_blackrock_spireMapScript, instance_uldaman::instance_uldaman_InstanceMapScript, instance_the_black_morass::instance_the_black_morass_InstanceMapScript, instance_gundrak::instance_gundrak_InstanceMapScript, instance_oculus::instance_oculus_InstanceMapScript, instance_blackwing_lair::instance_blackwing_lair_InstanceMapScript, instance_shadowfang_keep::instance_shadowfang_keep_InstanceMapScript, instance_shattered_halls::instance_shattered_halls_InstanceMapScript, instance_zulaman::instance_zulaman_InstanceScript, instance_zulfarrak::instance_zulfarrak_InstanceMapScript, instance_onyxias_lair::instance_onyxias_lair_InstanceMapScript, instance_magisters_terrace::instance_magisters_terrace_InstanceMapScript, instance_dire_maul::instance_dire_maul_InstanceMapScript, instance_serpent_shrine::instance_serpentshrine_cavern_InstanceMapScript, instance_scarlet_monastery::instance_scarlet_monastery_InstanceMapScript, instance_sunken_temple::instance_sunken_temple_InstanceMapScript, instance_deadmines::instance_deadmines_InstanceMapScript, and instance_razorfen_kraul::instance_razorfen_kraul_InstanceMapScript.

169 { }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ UpdateCombatResurrection()

void InstanceScript::UpdateCombatResurrection ( uint32  diff)
884 {
886  return;
887 
888  if (_combatResurrectionTimer <= diff)
890  else
891  _combatResurrectionTimer -= diff;
892 }
uint32 _combatResurrectionTimer
Definition: InstanceScript.h:335
void AddCombatResurrectionCharge()
Definition: InstanceScript.cpp:904
bool _combatResurrectionTimerStarted
Definition: InstanceScript.h:337
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ UpdateDoorState()

void InstanceScript::UpdateDoorState ( GameObject door)
protectedvirtual

Reimplemented in instance_ulduar::instance_ulduar_InstanceMapScript.

221 {
222  DoorInfoMapBounds range = doors.equal_range(door->GetEntry());
223  if (range.first == range.second)
224  return;
225 
226  bool open = true;
227  for (; range.first != range.second && open; ++range.first)
228  {
229  DoorInfo const& info = range.first->second;
230  switch (info.type)
231  {
232  case DOOR_TYPE_ROOM:
233  open = (info.bossInfo->state != IN_PROGRESS);
234  break;
235  case DOOR_TYPE_PASSAGE:
236  open = (info.bossInfo->state == DONE);
237  break;
239  open = (info.bossInfo->state == IN_PROGRESS);
240  break;
241  default:
242  break;
243  }
244  }
245 
246  door->SetGoState(open ? GO_STATE_ACTIVE : GO_STATE_READY);
247 }
Definition: SharedDefines.h:2841
Definition: InstanceScript.h:75
Definition: InstanceScript.h:74
Definition: InstanceScript.h:67
std::pair< DoorInfoMap::const_iterator, DoorInfoMap::const_iterator > DoorInfoMapBounds
Definition: InstanceScript.h:143
Definition: InstanceScript.h:65
Definition: SharedDefines.h:2840
void SetGoState(GOState state)
Definition: GameObject.cpp:3088
EncounterState state
Definition: InstanceScript.h:122
uint32 GetEntry() const
Definition: Object.h:158
Definition: InstanceScript.h:128
BossInfo * bossInfo
Definition: InstanceScript.h:132
Definition: InstanceScript.h:76
DoorType type
Definition: InstanceScript.h:133
DoorInfoMap doors
Definition: InstanceScript.h:325
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ UpdateEncounterState()

void InstanceScript::UpdateEncounterState ( EncounterCreditType  type,
uint32  creditEntry,
Unit source 
)
private
801 {
802  DungeonEncounterList const* encounters = sObjectMgr->GetDungeonEncounterList(instance->GetId(), instance->GetDifficultyID());
803  if (!encounters)
804  return;
805 
806  uint32 dungeonId = 0;
807 
808  for (auto const& encounter : *encounters)
809  {
810  if (encounter.creditType == type && encounter.creditEntry == creditEntry)
811  {
812  completedEncounters |= 1 << encounter.dbcEntry->Bit;
813  if (encounter.lastEncounterDungeon)
814  {
815  dungeonId = encounter.lastEncounterDungeon;
816  TC_LOG_DEBUG("lfg", "UpdateEncounterState: Instance %s (instanceId %u) completed encounter %s. Credit Dungeon: %u",
817  instance->GetMapName(), instance->GetInstanceId(), encounter.dbcEntry->Name[sWorld->GetDefaultDbcLocale()], dungeonId);
818  break;
819  }
820  }
821  }
822 
823  if (dungeonId)
824  {
825  Map::PlayerList const& players = instance->GetPlayers();
826  for (auto const& ref : players)
827  {
828  if (Player* player = ref.GetSource())
829  {
830  if (Group* grp = player->GetGroup())
831  {
832  if (grp->isLFGGroup())
833  {
834  sLFGMgr->FinishDungeon(grp->GetGUID(), dungeonId, instance);
835  return;
836  }
837  }
838  }
839  }
840  }
841 }
uint32 GetInstanceId() const
Definition: Map.h:380
Difficulty GetDifficultyID() const
Definition: Map.h:401
std::vector< DungeonEncounter > DungeonEncounterList
Definition: ObjectMgr.h:1007
#define sWorld
Definition: World.h:946
#define sObjectMgr
Definition: ObjectMgr.h:1967
uint32 GetId() const
Definition: Map.cpp:4410
InstanceMap * instance
Definition: InstanceScript.h:156
PlayerList const & GetPlayers() const
Definition: Map.h:438
uint32 completedEncounters
Definition: InstanceScript.h:330
#define sLFGMgr
Definition: LFGMgr.h:504
uint32_t uint32
Definition: Define.h:143
char const * GetMapName() const
Definition: Map.cpp:3055
Definition: MapRefManager.h:25
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:176
Definition: Player.h:1131
Definition: Group.h:221
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ UpdateEncounterStateForKilledCreature()

void InstanceScript::UpdateEncounterStateForKilledCreature ( uint32  creatureId,
Unit source 
)
844 {
846 }
void UpdateEncounterState(EncounterCreditType type, uint32 creditEntry, Unit *source)
Definition: InstanceScript.cpp:800
Definition: ObjectMgr.h:992
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ UpdateEncounterStateForSpellCast()

void InstanceScript::UpdateEncounterStateForSpellCast ( uint32  spellId,
Unit source 
)
849 {
851 }
void UpdateEncounterState(EncounterCreditType type, uint32 creditEntry, Unit *source)
Definition: InstanceScript.cpp:800
Definition: ObjectMgr.h:993
+ Here is the call graph for this function:

◆ UpdateMinionState()

void InstanceScript::UpdateMinionState ( Creature minion,
EncounterState  state 
)
protected
250 {
251  switch (state)
252  {
253  case NOT_STARTED:
254  if (!minion->IsAlive())
255  minion->Respawn();
256  else if (minion->IsInCombat())
257  minion->AI()->EnterEvadeMode();
258  break;
259  case IN_PROGRESS:
260  if (!minion->IsAlive())
261  minion->Respawn();
262  else if (!minion->GetVictim())
263  minion->AI()->DoZoneInCombat();
264  break;
265  default:
266  break;
267  }
268 }
virtual void EnterEvadeMode(EvadeReason why=EVADE_REASON_OTHER)
Definition: CreatureAI.cpp:220
bool IsInCombat() const
Definition: Unit.h:1149
void DoZoneInCombat(Creature *creature=nullptr)
Definition: CreatureAI.cpp:79
CreatureAI * AI() const
Definition: Creature.h:178
Definition: InstanceScript.h:65
bool IsAlive() const
Definition: Unit.h:1251
Definition: InstanceScript.h:64
Unit * GetVictim() const
Definition: Unit.h:833
void Respawn(bool force=false)
Definition: Creature.cpp:2192
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ UpdatePhasing()

void InstanceScript::UpdatePhasing ( )
854 {
855  instance->DoOnPlayers([](Player const* player)
856  {
858  });
859 }
InstanceMap * instance
Definition: InstanceScript.h:156
static void SendToPlayer(Player const *player, PhaseShift const &phaseShift)
Definition: PhasingHandler.cpp:478
void DoOnPlayers(T &&fn)
Definition: Map.h:441
Definition: Player.h:1131
+ Here is the call graph for this function:

◆ UpdateSpawnGroups()

void InstanceScript::UpdateSpawnGroups ( )
protected
271 {
273  return;
274  enum states { BLOCK, SPAWN, FORCEBLOCK };
275  std::unordered_map<uint32, states> newStates;
276  for (auto it = _instanceSpawnGroups->begin(), end = _instanceSpawnGroups->end(); it != end; ++it)
277  {
278  InstanceSpawnGroupInfo const& info = *it;
279  states& curValue = newStates[info.SpawnGroupId]; // makes sure there's a BLOCK value in the map
280  if (curValue == FORCEBLOCK) // nothing will change this
281  continue;
282  if (!((1 << GetBossState(info.BossStateId)) & info.BossStates))
283  continue;
286  continue;
288  curValue = FORCEBLOCK;
290  curValue = SPAWN;
291  }
292  for (auto const& pair : newStates)
293  {
294  uint32 const groupId = pair.first;
295  bool const doSpawn = (pair.second == SPAWN);
296  if (instance->IsSpawnGroupActive(groupId) == doSpawn)
297  continue; // nothing to do here
298  // if we should spawn group, then spawn it...
299  if (doSpawn)
300  instance->SpawnGroupSpawn(groupId);
301  else // otherwise, set it as inactive so it no longer respawns (but don't despawn it)
303  }
304 }
bool SpawnGroupSpawn(uint32 groupId, bool ignoreRespawn=false, bool force=false, std::vector< WorldObject *> *spawnedObjects=nullptr)
Definition: Map.cpp:3546
void SetSpawnGroupInactive(uint32 groupId)
Definition: Map.h:810
TeamId GetTeamIdInInstance() const
Definition: Map.h:973
std::vector< InstanceSpawnGroupInfo > const *const _instanceSpawnGroups
Definition: InstanceScript.h:331
Definition: ObjectMgr.h:438
Definition: ObjectMgr.h:433
uint32 SpawnGroupId
Definition: ObjectMgr.h:446
InstanceMap * instance
Definition: InstanceScript.h:156
uint8 BossStates
Definition: ObjectMgr.h:445
EncounterState GetBossState(uint32 id) const
Definition: InstanceScript.h:232
uint8 BossStateId
Definition: ObjectMgr.h:444
uint32_t uint32
Definition: Define.h:143
Definition: SharedDefines.h:1129
iterator end()
Definition: GridRefManager.h:36
bool IsSpawnGroupActive(uint32 groupId) const
Definition: Map.cpp:3672
Definition: ObjectMgr.h:440
Definition: SharedDefines.h:1130
uint8 Flags
Definition: ObjectMgr.h:447
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ UseCombatResurrection()

void InstanceScript::UseCombatResurrection ( )
916 {
918 
920 }
void SendToPlayers(WorldPacket const *data) const
Definition: Map.cpp:3851
InstanceMap * instance
Definition: InstanceScript.h:156
uint8 _combatResurrectionCharges
Definition: InstanceScript.h:336
+ Here is the call graph for this function:

◆ WriteSaveDataBossStates()

void InstanceScript::WriteSaveDataBossStates ( std::ostringstream &  data)
protected
531 {
532  for (BossInfo const& bossInfo : bosses)
533  data << uint32(bossInfo.state) << ' ';
534 }
uint32_t uint32
Definition: Define.h:143
Definition: InstanceScript.h:119
std::vector< BossInfo > bosses
Definition: InstanceScript.h:324
+ Here is the caller graph for this function:

◆ WriteSaveDataHeaders()

void InstanceScript::WriteSaveDataHeaders ( std::ostringstream &  data)
protected
525 {
526  for (char header : headers)
527  data << header << ' ';
528 }
std::vector< char > headers
Definition: InstanceScript.h:323
+ Here is the caller graph for this function:

◆ WriteSaveDataMore()

Friends And Related Function Documentation

◆ debug_commandscript

friend class debug_commandscript
friend

Member Data Documentation

◆ _activatedAreaTriggers

std::unordered_set<uint32> InstanceScript::_activatedAreaTriggers
private

◆ _combatResurrectionCharges

uint8 InstanceScript::_combatResurrectionCharges
private

◆ _combatResurrectionTimer

uint32 InstanceScript::_combatResurrectionTimer
private

◆ _combatResurrectionTimerStarted

bool InstanceScript::_combatResurrectionTimerStarted
private

◆ _creatureInfo

ObjectInfoMap InstanceScript::_creatureInfo
private

◆ _entranceId

uint32 InstanceScript::_entranceId
private

◆ _gameObjectInfo

ObjectInfoMap InstanceScript::_gameObjectInfo
private

◆ _instanceSpawnGroups

std::vector<InstanceSpawnGroupInfo> const* const InstanceScript::_instanceSpawnGroups
private

◆ _objectGuids

ObjectGuidMap InstanceScript::_objectGuids
private

◆ _temporaryEntranceId

uint32 InstanceScript::_temporaryEntranceId
private

◆ bosses

std::vector<BossInfo> InstanceScript::bosses
private

◆ completedEncounters

uint32 InstanceScript::completedEncounters
private

◆ doors

DoorInfoMap InstanceScript::doors
private

◆ headers

std::vector<char> InstanceScript::headers
private

◆ instance

InstanceMap* InstanceScript::instance

◆ minions

MinionInfoMap InstanceScript::minions
private

The documentation for this class was generated from the following files: