TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
InstanceScript Class Reference

#include <InstanceScript.h>

Public Member Functions

 InstanceScript (Map *map)
 
virtual ~InstanceScript ()
 
virtual void Initialize ()
 
virtual void Load (char const *data)
 
virtual std::string GetSaveData ()
 
void SaveToDB ()
 
virtual void Update (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
 
CreatureGetCreature (uint32 type)
 
GameObjectGetGameObject (uint32 type)
 
virtual void OnPlayerEnter (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, uint32 timeToDespawn=MINUTE)
 
void DoUpdateWorldState (uint32 worldstateId, uint32 worldstateValue)
 
void DoSendNotifyToInstance (char const *format,...)
 
void DoUpdateAchievementCriteria (AchievementCriteriaTypes type, uint32 miscValue1=0, uint32 miscValue2=0, Unit *unit=NULL)
 
void DoStartTimedAchievement (AchievementCriteriaTimedTypes type, uint32 entry)
 
void DoStopTimedAchievement (AchievementCriteriaTimedTypes type, uint32 entry)
 
void DoRemoveAurasDueToSpellOnPlayers (uint32 spell)
 
void DoCastSpellOnPlayers (uint32 spell)
 
bool ServerAllowsTwoSideGroups ()
 
virtual bool SetBossState (uint32 id, EncounterState state)
 
EncounterState GetBossState (uint32 id) const
 
CreatureBoundary constGetBossBoundary (uint32 id) const
 
virtual bool CheckAchievementCriteriaMeet (uint32, Player const *, Unit const *=NULL, uint32=0)
 
virtual bool CheckRequiredBosses (uint32, Player const *=nullptr) const
 
void UpdateEncounterState (EncounterCreditType type, uint32 creditEntry, Unit *source)
 
void SetCompletedEncountersMask (uint32 newMask)
 
uint32 GetCompletedEncounterMask () const
 
void SendEncounterUnit (uint32 type, Unit *unit=NULL, uint8 param1=0, uint8 param2=0)
 
virtual void FillInitialWorldStates (WorldPackets::WorldState::InitWorldStates &)
 
void UpdatePhasing ()
 
uint32 GetEncounterCount () 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 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)
 

Static Public Member Functions

static std::string GetBossStateName (uint8 state)
 

Public Attributes

Mapinstance
 

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)
 
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
 

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
 

Constructor & Destructor Documentation

InstanceScript::InstanceScript ( Map map)
inlineexplicit
144 : instance(map), completedEncounters(0) { }
uint32 completedEncounters
Definition: InstanceScript.h:298
Map * instance
Definition: InstanceScript.h:148
virtual InstanceScript::~InstanceScript ( )
inlinevirtual
146 { }

Member Function Documentation

bool InstanceScript::_SkipCheckRequiredBosses ( Player const player = nullptr) const
protected
314 {
315  return player && player->GetSession()->HasPermission(rbac::RBAC_PERM_SKIP_CHECK_INSTANCE_REQUIRED_BOSSES);
316 }

+ Here is the caller graph for this function:

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

Reimplemented in instance_ulduar::instance_ulduar_InstanceMapScript.

240 {
241  DoorInfoMapBounds range = doors.equal_range(door->GetEntry());
242  if (range.first == range.second)
243  return;
244 
245  for (; range.first != range.second; ++range.first)
246  {
247  DoorInfo const& data = range.first->second;
248 
249  if (add)
250  {
251  data.bossInfo->door[data.type].insert(door->GetGUID());
252  }
253  else
254  data.bossInfo->door[data.type].erase(door->GetGUID());
255  }
256 
257  if (add)
258  UpdateDoorState(door);
259 }
GuidSet door[MAX_DOOR_TYPES]
Definition: InstanceScript.h:115
std::pair< DoorInfoMap::const_iterator, DoorInfoMap::const_iterator > DoorInfoMapBounds
Definition: InstanceScript.h:135
ObjectGuid const & GetGUID() const
Definition: Object.h:105
Definition: InstanceScript.h:120
uint32 GetEntry() const
Definition: Object.h:107
BossInfo * bossInfo
Definition: InstanceScript.h:124
virtual void UpdateDoorState(GameObject *door)
Definition: InstanceScript.cpp:178
DoorType type
Definition: InstanceScript.h:125
DoorInfoMap doors
Definition: InstanceScript.h:293

+ Here is the call graph for this function:

void InstanceScript::AddMinion ( Creature minion,
bool  add 
)
protected
262 {
263  MinionInfoMap::iterator itr = minions.find(minion->GetEntry());
264  if (itr == minions.end())
265  return;
266 
267  if (add)
268  itr->second.bossInfo->minion.insert(minion->GetGUID());
269  else
270  itr->second.bossInfo->minion.erase(minion->GetGUID());
271 }
MinionInfoMap minions
Definition: InstanceScript.h:294
ObjectGuid const & GetGUID() const
Definition: Object.h:105
uint32 GetEntry() const
Definition: Object.h:107

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void InstanceScript::AddObject ( Creature obj,
bool  add 
)
protected
214 {
215  ObjectInfoMap::const_iterator j = _creatureInfo.find(obj->GetEntry());
216  if (j != _creatureInfo.end())
217  AddObject(obj, j->second, add);
218 }
ObjectInfoMap _creatureInfo
Definition: InstanceScript.h:295
void AddObject(Creature *obj, bool add)
Definition: InstanceScript.cpp:213
uint32 GetEntry() const
Definition: Object.h:107

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void InstanceScript::AddObject ( GameObject obj,
bool  add 
)
protected
221 {
222  ObjectInfoMap::const_iterator j = _gameObjectInfo.find(obj->GetEntry());
223  if (j != _gameObjectInfo.end())
224  AddObject(obj, j->second, add);
225 }
ObjectInfoMap _gameObjectInfo
Definition: InstanceScript.h:296
void AddObject(Creature *obj, bool add)
Definition: InstanceScript.cpp:213
uint32 GetEntry() const
Definition: Object.h:107

+ Here is the call graph for this function:

void InstanceScript::AddObject ( WorldObject obj,
uint32  type,
bool  add 
)
protected
228 {
229  if (add)
230  _objectGuids[type] = obj->GetGUID();
231  else
232  {
233  ObjectGuidMap::iterator i = _objectGuids.find(type);
234  if (i != _objectGuids.end() && i->second == obj->GetGUID())
235  _objectGuids.erase(i);
236  }
237 }
ObjectGuidMap _objectGuids
Definition: InstanceScript.h:297
ObjectGuid const & GetGUID() const
Definition: Object.h:105

+ Here is the call graph for this function:

bool InstanceScript::CheckAchievementCriteriaMeet ( uint32  criteria_id,
Player const ,
Unit const = NULL,
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.

569 {
570  TC_LOG_ERROR("misc", "Achievement system call InstanceScript::CheckAchievementCriteriaMeet but instance script for map %u not have implementation for achievement criteria %u",
571  instance->GetId(), criteria_id);
572  return false;
573 }
uint32 GetId(void) const
Definition: Map.h:325
Map * instance
Definition: InstanceScript.h:148
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void InstanceScript::DoCastSpellOnPlayers ( uint32  spell)
559 {
560  Map::PlayerList const &PlayerList = instance->GetPlayers();
561 
562  if (!PlayerList.isEmpty())
563  for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
564  if (Player* player = i->GetSource())
565  player->CastSpell(player, spell, true);
566 }
iterator begin()
Definition: MapRefManager.h:37
Map * instance
Definition: InstanceScript.h:148
Definition: LinkedList.h:141
bool isEmpty() const
Definition: LinkedList.h:102
PlayerList const & GetPlayers() const
Definition: Map.h:433
Definition: MapRefManager.h:26
iterator end()
Definition: MapRefManager.h:38

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void InstanceScript::DoCloseDoorOrButton ( ObjectGuid  guid)
429 {
430  if (!guid)
431  return;
432 
433  if (GameObject* go = instance->GetGameObject(guid))
434  {
435  if (go->GetGoType() == GAMEOBJECT_TYPE_DOOR || go->GetGoType() == GAMEOBJECT_TYPE_BUTTON)
436  {
437  if (go->getLootState() == GO_ACTIVATED)
438  go->ResetDoorOrButton();
439  }
440  else
441  TC_LOG_ERROR("scripts", "InstanceScript: DoCloseDoorOrButton can't use gameobject entry %u, because type is %u.", go->GetEntry(), go->GetGoType());
442  }
443  else
444  TC_LOG_DEBUG("scripts", "InstanceScript: DoCloseDoorOrButton failed");
445 }
Definition: GameObject.h:870
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:198
Definition: SharedDefines.h:2066
Map * instance
Definition: InstanceScript.h:148
Definition: GameObject.h:880
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
GameObject * GetGameObject(ObjectGuid const &guid)
Definition: Map.cpp:3545
Definition: SharedDefines.h:2065

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void InstanceScript::DoRemoveAurasDueToSpellOnPlayers ( uint32  spell)
541 {
542  Map::PlayerList const& PlayerList = instance->GetPlayers();
543  if (!PlayerList.isEmpty())
544  {
545  for (Map::PlayerList::const_iterator itr = PlayerList.begin(); itr != PlayerList.end(); ++itr)
546  {
547  if (Player* player = itr->GetSource())
548  {
549  player->RemoveAurasDueToSpell(spell);
550  if (Pet* pet = player->GetPet())
551  pet->RemoveAurasDueToSpell(spell);
552  }
553  }
554  }
555 }
iterator begin()
Definition: MapRefManager.h:37
Map * instance
Definition: InstanceScript.h:148
Definition: LinkedList.h:141
bool isEmpty() const
Definition: LinkedList.h:102
PlayerList const & GetPlayers() const
Definition: Map.h:433
Definition: MapRefManager.h:26
iterator end()
Definition: MapRefManager.h:38
Definition: Pet.h:46

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void InstanceScript::DoRespawnGameObject ( ObjectGuid  guid,
uint32  timeToDespawn = MINUTE 
)
448 {
449  if (GameObject* go = instance->GetGameObject(guid))
450  {
451  switch (go->GetGoType())
452  {
457  // not expect any of these should ever be handled
458  TC_LOG_ERROR("scripts", "InstanceScript: DoRespawnGameObject can't respawn gameobject entry %u, because type is %u.", go->GetEntry(), go->GetGoType());
459  return;
460  default:
461  break;
462  }
463 
464  if (go->isSpawned())
465  return;
466 
467  go->SetRespawnTime(timeToDespawn);
468  }
469  else
470  TC_LOG_DEBUG("scripts", "InstanceScript: DoRespawnGameObject failed");
471 }
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:198
Definition: SharedDefines.h:2082
Definition: SharedDefines.h:2066
Map * instance
Definition: InstanceScript.h:148
Definition: GameObject.h:880
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
GameObject * GetGameObject(ObjectGuid const &guid)
Definition: Map.cpp:3545
Definition: SharedDefines.h:2071
Definition: SharedDefines.h:2065

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void InstanceScript::DoSendNotifyToInstance ( char const format,
  ... 
)
489 {
490  InstanceMap::PlayerList const& players = instance->GetPlayers();
491 
492  if (!players.isEmpty())
493  {
494  va_list ap;
495  va_start(ap, format);
496  char buff[1024];
497  vsnprintf(buff, 1024, format, ap);
498  va_end(ap);
499  for (Map::PlayerList::const_iterator i = players.begin(); i != players.end(); ++i)
500  if (Player* player = i->GetSource())
501  if (WorldSession* session = player->GetSession())
502  session->SendNotification("%s", buff);
503  }
504 }
void format(BasicFormatter< Char > &f, const Char *&format_str, const T &value)
Definition: format.h:2963
iterator begin()
Definition: MapRefManager.h:37
Map * instance
Definition: InstanceScript.h:148
Definition: LinkedList.h:141
bool isEmpty() const
Definition: LinkedList.h:102
#define vsnprintf
Definition: Common.h:78
PlayerList const & GetPlayers() const
Definition: Map.h:433
Definition: MapRefManager.h:26
Player session in the World.
Definition: WorldSession.h:882
iterator end()
Definition: MapRefManager.h:38

+ Here is the call graph for this function:

void InstanceScript::DoStartTimedAchievement ( AchievementCriteriaTimedTypes  type,
uint32  entry 
)
519 {
520  Map::PlayerList const &PlayerList = instance->GetPlayers();
521 
522  if (!PlayerList.isEmpty())
523  for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
524  if (Player* player = i->GetSource())
525  player->StartTimedAchievement(type, entry);
526 }
iterator begin()
Definition: MapRefManager.h:37
Map * instance
Definition: InstanceScript.h:148
Definition: LinkedList.h:141
bool isEmpty() const
Definition: LinkedList.h:102
PlayerList const & GetPlayers() const
Definition: Map.h:433
Definition: MapRefManager.h:26
iterator end()
Definition: MapRefManager.h:38

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void InstanceScript::DoStopTimedAchievement ( AchievementCriteriaTimedTypes  type,
uint32  entry 
)
530 {
531  Map::PlayerList const &PlayerList = instance->GetPlayers();
532 
533  if (!PlayerList.isEmpty())
534  for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
535  if (Player* player = i->GetSource())
536  player->RemoveTimedAchievement(type, entry);
537 }
iterator begin()
Definition: MapRefManager.h:37
Map * instance
Definition: InstanceScript.h:148
Definition: LinkedList.h:141
bool isEmpty() const
Definition: LinkedList.h:102
PlayerList const & GetPlayers() const
Definition: Map.h:433
Definition: MapRefManager.h:26
iterator end()
Definition: MapRefManager.h:38

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void InstanceScript::DoUpdateAchievementCriteria ( AchievementCriteriaTypes  type,
uint32  miscValue1 = 0,
uint32  miscValue2 = 0,
Unit unit = NULL 
)
508 {
509  Map::PlayerList const &PlayerList = instance->GetPlayers();
510 
511  if (!PlayerList.isEmpty())
512  for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
513  if (Player* player = i->GetSource())
514  player->UpdateAchievementCriteria(type, miscValue1, miscValue2, 0, unit);
515 }
iterator begin()
Definition: MapRefManager.h:37
Map * instance
Definition: InstanceScript.h:148
Definition: LinkedList.h:141
bool isEmpty() const
Definition: LinkedList.h:102
PlayerList const & GetPlayers() const
Definition: Map.h:433
Definition: MapRefManager.h:26
iterator end()
Definition: MapRefManager.h:38

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void InstanceScript::DoUpdateWorldState ( uint32  worldstateId,
uint32  worldstateValue 
)
474 {
475  Map::PlayerList const& lPlayers = instance->GetPlayers();
476 
477  if (!lPlayers.isEmpty())
478  {
479  for (Map::PlayerList::const_iterator itr = lPlayers.begin(); itr != lPlayers.end(); ++itr)
480  if (Player* player = itr->GetSource())
481  player->SendUpdateWorldState(uiStateId, uiStateData);
482  }
483  else
484  TC_LOG_DEBUG("scripts", "DoUpdateWorldState attempt send data but no players in map.");
485 }
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:198
iterator begin()
Definition: MapRefManager.h:37
Map * instance
Definition: InstanceScript.h:148
Definition: LinkedList.h:141
bool isEmpty() const
Definition: LinkedList.h:102
PlayerList const & GetPlayers() const
Definition: Map.h:433
Definition: MapRefManager.h:26
iterator end()
Definition: MapRefManager.h:38

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void InstanceScript::DoUseDoorOrButton ( ObjectGuid  guid,
uint32  withRestoreTime = 0,
bool  useAlternativeState = false 
)
408 {
409  if (!guid)
410  return;
411 
412  if (GameObject* go = instance->GetGameObject(guid))
413  {
414  if (go->GetGoType() == GAMEOBJECT_TYPE_DOOR || go->GetGoType() == GAMEOBJECT_TYPE_BUTTON)
415  {
416  if (go->getLootState() == GO_READY)
417  go->UseDoorOrButton(withRestoreTime, useAlternativeState);
418  else if (go->getLootState() == GO_ACTIVATED)
419  go->ResetDoorOrButton();
420  }
421  else
422  TC_LOG_ERROR("scripts", "InstanceScript: DoUseDoorOrButton can't use gameobject entry %u, because type is %u.", go->GetEntry(), go->GetGoType());
423  }
424  else
425  TC_LOG_DEBUG("scripts", "InstanceScript: DoUseDoorOrButton failed");
426 }
Definition: GameObject.h:870
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:198
Definition: SharedDefines.h:2066
Map * instance
Definition: InstanceScript.h:148
Definition: GameObject.h:880
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
GameObject * GetGameObject(ObjectGuid const &guid)
Definition: Map.cpp:3545
Definition: GameObject.h:869
Definition: SharedDefines.h:2065

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

CreatureBoundary const* InstanceScript::GetBossBoundary ( uint32  id) const
inline
229 { return id < bosses.size() ? &bosses[id].boundary : NULL; }
arena_t NULL
Definition: jemalloc_internal.h:624
std::vector< BossInfo > bosses
Definition: InstanceScript.h:292

+ Here is the caller graph for this function:

BossInfo * InstanceScript::GetBossInfo ( uint32  id)
protected
208 {
209  ASSERT(id < bosses.size());
210  return &bosses[id];
211 }
#define ASSERT
Definition: Errors.h:55
std::vector< BossInfo > bosses
Definition: InstanceScript.h:292

+ Here is the caller graph for this function:

EncounterState InstanceScript::GetBossState ( uint32  id) const
inline
227 { return id < bosses.size() ? bosses[id].state : TO_BE_DECIDED; }
Definition: InstanceScript.h:63
std::vector< BossInfo > bosses
Definition: InstanceScript.h:292
std::string InstanceScript::GetBossStateName ( uint8  state)
static
655 {
656  // See enum EncounterState in InstanceScript.h
657  switch (state)
658  {
659  case NOT_STARTED:
660  return "NOT_STARTED";
661  case IN_PROGRESS:
662  return "IN_PROGRESS";
663  case FAIL:
664  return "FAIL";
665  case DONE:
666  return "DONE";
667  case SPECIAL:
668  return "SPECIAL";
669  case TO_BE_DECIDED:
670  return "TO_BE_DECIDED";
671  default:
672  return "INVALID";
673  }
674 }
Definition: inflate.h:49
Definition: InstanceScript.h:60
Definition: InstanceScript.h:59
Definition: InstanceScript.h:58
Definition: InstanceScript.h:62
Definition: InstanceScript.h:63

+ Here is the caller graph for this function:

uint32 InstanceScript::GetCompletedEncounterMask ( ) const
inline
245 { return completedEncounters; }
uint32 completedEncounters
Definition: InstanceScript.h:298

+ Here is the caller graph for this function:

Creature* InstanceScript::GetCreature ( uint32  type)
inline
181  {
182  return instance->GetCreature(GetObjectGuid(type));
183  }
ObjectGuid GetObjectGuid(uint32 type) const
Definition: InstanceScript.cpp:85
Map * instance
Definition: InstanceScript.h:148
Creature * GetCreature(ObjectGuid const &guid)
Definition: Map.cpp:3535

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uint32 InstanceScript::GetEncounterCount ( ) const
inline
254 { return uint32(bosses.size()); }
uint32_t uint32
Definition: g3dmath.h:168
std::vector< BossInfo > bosses
Definition: InstanceScript.h:292

+ Here is the caller graph for this function:

GameObject* InstanceScript::GetGameObject ( uint32  type)
inline
185  {
186  return instance->GetGameObject(GetObjectGuid(type));
187  }
ObjectGuid GetObjectGuid(uint32 type) const
Definition: InstanceScript.cpp:85
Map * instance
Definition: InstanceScript.h:148
GameObject * GetGameObject(ObjectGuid const &guid)
Definition: Map.cpp:3545

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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_trial_of_the_crusader::instance_trial_of_the_crusader_InstanceMapScript, instance_naxxramas::instance_naxxramas_InstanceMapScript, instance_stratholme::instance_stratholme_InstanceMapScript, instance_karazhan::instance_karazhan_InstanceMapScript, instance_blackrock_spire::instance_blackrock_spireMapScript, instance_blackrock_depths::instance_blackrock_depths_InstanceMapScript, instance_the_black_morass::instance_the_black_morass_InstanceMapScript, instance_eye_of_eternity::instance_eye_of_eternity_InstanceMapScript, instance_oculus::instance_oculus_InstanceMapScript, instance_trial_of_the_champion::instance_trial_of_the_champion_InstanceMapScript, instance_serpent_shrine::instance_serpentshrine_cavern_InstanceMapScript, instance_pit_of_saron::instance_pit_of_saron_InstanceScript, instance_culling_of_stratholme::instance_culling_of_stratholme_InstanceMapScript, instance_deadmines::instance_deadmines_InstanceMapScript, instance_old_hillsbrad::instance_old_hillsbrad_InstanceMapScript, instance_blackfathom_deeps::instance_blackfathom_deeps_InstanceMapScript, instance_zulfarrak::instance_zulfarrak_InstanceMapScript, instance_onyxias_lair::instance_onyxias_lair_InstanceMapScript, instance_ahnkahet::instance_ahnkahet_InstanceScript, instance_shattered_halls::instance_shattered_halls_InstanceMapScript, instance_magisters_terrace::instance_magisters_terrace_InstanceMapScript, instance_ruby_sanctum::instance_ruby_sanctum_InstanceMapScript, instance_sunwell_plateau::instance_sunwell_plateau_InstanceMapScript, instance_zulgurub::instance_zulgurub_InstanceMapScript, instance_nexus::instance_nexus_InstanceMapScript, instance_halls_of_origination::instance_halls_of_origination_InstanceMapScript, instance_utgarde_keep::instance_utgarde_keep_InstanceMapScript, instance_black_temple::instance_black_temple_InstanceMapScript, instance_arcatraz::instance_arcatraz_InstanceMapScript, instance_hyjal::instance_mount_hyjal_InstanceMapScript, instance_blood_furnace::instance_blood_furnace_InstanceMapScript, instance_utgarde_pinnacle::instance_utgarde_pinnacle_InstanceMapScript, instance_scarlet_monastery::instance_scarlet_monastery_InstanceMapScript, instance_temple_of_ahnqiraj::instance_temple_of_ahnqiraj_InstanceMapScript, instance_shadow_labyrinth::instance_shadow_labyrinth_InstanceMapScript, instance_gnomeregan::instance_gnomeregan_InstanceMapScript, instance_halls_of_stone::instance_halls_of_stone_InstanceMapScript, instance_magtheridons_lair::instance_magtheridons_lair_InstanceMapScript, instance_drak_tharon_keep::instance_drak_tharon_keep_InstanceScript, instance_halls_of_lightning::instance_halls_of_lightning_InstanceMapScript, instance_gruuls_lair::instance_gruuls_lair_InstanceMapScript, instance_zulaman::instance_zulaman_InstanceScript, instance_molten_core::instance_molten_core_InstanceMapScript, instance_the_eye::instance_the_eye_InstanceMapScript, instance_scholomance::instance_scholomance_InstanceMapScript, instance_steam_vault::instance_steam_vault_InstanceMapScript, instance_wailing_caverns::instance_wailing_caverns_InstanceMapScript, instance_forge_of_souls::instance_forge_of_souls_InstanceScript, instance_obsidian_sanctum::instance_obsidian_sanctum_InstanceMapScript, instance_ruins_of_ahnqiraj::instance_ruins_of_ahnqiraj_InstanceMapScript, instance_baradin_hold::instance_baradin_hold_InstanceMapScript, instance_vault_of_archavon::instance_vault_of_archavon_InstanceMapScript, and instance_the_botanica::instance_the_botanica_InstanceMapScript.

94 {
95  return GetObjectGuid(type);
96 }
ObjectGuid GetObjectGuid(uint32 type) const
Definition: InstanceScript.cpp:85

+ Here is the call graph for this function:

ObjectGuid InstanceScript::GetObjectGuid ( uint32  type) const
86 {
87  ObjectGuidMap::const_iterator i = _objectGuids.find(type);
88  if (i != _objectGuids.end())
89  return i->second;
90  return ObjectGuid::Empty;
91 }
static ObjectGuid const Empty
Definition: ObjectGuid.h:196
ObjectGuidMap _objectGuids
Definition: InstanceScript.h:297

+ Here is the caller graph for this function:

std::string InstanceScript::GetSaveData ( )
virtual

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

371 {
373 
374  std::ostringstream saveStream;
375 
376  WriteSaveDataHeaders(saveStream);
377  WriteSaveDataBossStates(saveStream);
378  WriteSaveDataMore(saveStream);
379 
381 
382  return saveStream.str();
383 }
void WriteSaveDataHeaders(std::ostringstream &data)
Definition: InstanceScript.cpp:385
#define OUT_SAVE_INST_DATA
Definition: InstanceScript.h:29
virtual void WriteSaveDataMore(std::ostringstream &)
Definition: InstanceScript.h:284
void WriteSaveDataBossStates(std::ostringstream &data)
Definition: InstanceScript.cpp:391
#define OUT_SAVE_INST_DATA_COMPLETE
Definition: InstanceScript.h:30

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void InstanceScript::HandleGameObject ( ObjectGuid  guid,
bool  open,
GameObject go = nullptr 
)
398 {
399  if (!go)
400  go = instance->GetGameObject(guid);
401  if (go)
403  else
404  TC_LOG_DEBUG("scripts", "InstanceScript: HandleGameObject failed");
405 }
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:198
Map * instance
Definition: InstanceScript.h:148
Definition: GameObject.h:822
Definition: GameObject.h:823
void SetGoState(GOState state)
Definition: GameObject.cpp:2137
GameObject * GetGameObject(ObjectGuid const &guid)
Definition: Map.cpp:3545

+ Here is the call graph for this function:

virtual void InstanceScript::Initialize ( )
inlinevirtual
153 { }

+ Here is the caller graph for this function:

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_serpent_shrine::instance_serpentshrine_cavern_InstanceMapScript, instance_stratholme::instance_stratholme_InstanceMapScript, instance_karazhan::instance_karazhan_InstanceMapScript, instance_blackrock_depths::instance_blackrock_depths_InstanceMapScript, instance_trial_of_the_champion::instance_trial_of_the_champion_InstanceMapScript, instance_hyjal::instance_mount_hyjal_InstanceMapScript, instance_shadowfang_keep::instance_shadowfang_keep_InstanceMapScript, instance_wailing_caverns::instance_wailing_caverns_InstanceMapScript, and instance_gnomeregan::instance_gnomeregan_InstanceMapScript.

319 {
320  if (!data)
321  {
323  return;
324  }
325 
326  OUT_LOAD_INST_DATA(data);
327 
328  std::istringstream loadStream(data);
329 
330  if (ReadSaveDataHeaders(loadStream))
331  {
332  ReadSaveDataBossStates(loadStream);
333  ReadSaveDataMore(loadStream);
334  }
335  else
337 
339 }
#define OUT_LOAD_INST_DATA_FAIL
Definition: InstanceScript.h:33
bool ReadSaveDataHeaders(std::istringstream &data)
Definition: InstanceScript.cpp:341
#define OUT_LOAD_INST_DATA_COMPLETE
Definition: InstanceScript.h:32
void ReadSaveDataBossStates(std::istringstream &data)
Definition: InstanceScript.cpp:355
virtual void ReadSaveDataMore(std::istringstream &)
Definition: InstanceScript.h:281
#define OUT_LOAD_INST_DATA(a)
Definition: InstanceScript.h:31

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void InstanceScript::LoadBossBoundaries ( BossBoundaryData const data)
protected
106 {
107  for (BossBoundaryEntry const& entry : data)
108  if (entry.BossId < bosses.size())
109  bosses[entry.BossId].boundary.insert(entry.Boundary);
110 }
Definition: InstanceScript.h:80
std::vector< BossInfo > bosses
Definition: InstanceScript.h:292

+ Here is the caller graph for this function:

void InstanceScript::LoadDoorData ( DoorData const data)
protected
125 {
126  while (data->entry)
127  {
128  if (data->bossId < bosses.size())
129  doors.insert(std::make_pair(data->entry, DoorInfo(&bosses[data->bossId], data->type)));
130 
131  ++data;
132  }
133  TC_LOG_DEBUG("scripts", "InstanceScript::LoadDoorData: " UI64FMTD " doors loaded.", uint64(doors.size()));
134 }
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:198
uint64_t uint64
Definition: g3dmath.h:170
#define UI64FMTD
Definition: Define.h:137
Definition: InstanceScript.h:120
std::vector< BossInfo > bosses
Definition: InstanceScript.h:292
DoorInfoMap doors
Definition: InstanceScript.h:293

+ Here is the caller graph for this function:

void InstanceScript::LoadMinionData ( MinionData const data)
protected
113 {
114  while (data->entry)
115  {
116  if (data->bossId < bosses.size())
117  minions.insert(std::make_pair(data->entry, MinionInfo(&bosses[data->bossId])));
118 
119  ++data;
120  }
121  TC_LOG_DEBUG("scripts", "InstanceScript::LoadMinionData: " UI64FMTD " minions loaded.", uint64(minions.size()));
122 }
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:198
uint64_t uint64
Definition: g3dmath.h:170
MinionInfoMap minions
Definition: InstanceScript.h:294
#define UI64FMTD
Definition: Define.h:137
Definition: InstanceScript.h:128
std::vector< BossInfo > bosses
Definition: InstanceScript.h:292

+ Here is the caller graph for this function:

void InstanceScript::LoadObjectData ( ObjectData const creatureData,
ObjectData const gameObjectData 
)
protected
137 {
138  if (creatureData)
140 
141  if (gameObjectData)
143 
144  TC_LOG_DEBUG("scripts", "InstanceScript::LoadObjectData: " SZFMTD " objects loaded.", _creatureInfo.size() + _gameObjectInfo.size());
145 }
#define SZFMTD
Definition: Define.h:143
ObjectData const gameObjectData[]
Definition: instance_gundrak.cpp:40
ObjectInfoMap _creatureInfo
Definition: InstanceScript.h:295
ObjectData const creatureData[]
Definition: instance_blackrock_caverns.cpp:22
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:198
ObjectInfoMap _gameObjectInfo
Definition: InstanceScript.h:296
void LoadObjectData(ObjectData const *creatureData, ObjectData const *gameObjectData)
Definition: InstanceScript.cpp:136

+ Here is the caller graph for this function:

void InstanceScript::LoadObjectData ( ObjectData const creatureData,
ObjectInfoMap objectInfo 
)
staticprivate
148 {
149  while (data->entry)
150  {
151  ASSERT(objectInfo.find(data->entry) == objectInfo.end());
152  objectInfo[data->entry] = data->type;
153  ++data;
154  }
155 }
#define ASSERT
Definition: Errors.h:55
void InstanceScript::OnCreatureCreate ( Creature creature)
overridevirtual

Reimplemented from ZoneScript.

Reimplemented in 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_naxxramas::instance_naxxramas_InstanceMapScript, instance_zulfarrak::instance_zulfarrak_InstanceMapScript, instance_the_black_morass::instance_the_black_morass_InstanceMapScript, instance_blackrock_depths::instance_blackrock_depths_InstanceMapScript, instance_eye_of_eternity::instance_eye_of_eternity_InstanceMapScript, instance_halls_of_origination::instance_halls_of_origination_InstanceMapScript, instance_shattered_halls::instance_shattered_halls_InstanceMapScript, instance_halls_of_reflection::instance_halls_of_reflection_InstanceMapScript, instance_stratholme::instance_stratholme_InstanceMapScript, instance_karazhan::instance_karazhan_InstanceMapScript, instance_hyjal::instance_mount_hyjal_InstanceMapScript, instance_shadowfang_keep::instance_shadowfang_keep_InstanceMapScript, instance_trial_of_the_crusader::instance_trial_of_the_crusader_InstanceMapScript, instance_old_hillsbrad::instance_old_hillsbrad_InstanceMapScript, instance_magisters_terrace::instance_magisters_terrace_InstanceMapScript, instance_trial_of_the_champion::instance_trial_of_the_champion_InstanceMapScript, instance_magtheridons_lair::instance_magtheridons_lair_InstanceMapScript, instance_blackwing_lair::instance_blackwing_lair_InstanceMapScript, instance_sunwell_plateau::instance_sunwell_plateau_InstanceMapScript, instance_culling_of_stratholme::instance_culling_of_stratholme_InstanceMapScript, instance_stonecore::instance_stonecore_InstanceScript, instance_gundrak::instance_gundrak_InstanceMapScript, instance_the_eye::instance_the_eye_InstanceMapScript, instance_gnomeregan::instance_gnomeregan_InstanceMapScript, instance_scarlet_monastery::instance_scarlet_monastery_InstanceMapScript, instance_temple_of_ahnqiraj::instance_temple_of_ahnqiraj_InstanceMapScript, instance_steam_vault::instance_steam_vault_InstanceMapScript, instance_blackfathom_deeps::instance_blackfathom_deeps_InstanceMapScript, instance_onyxias_lair::instance_onyxias_lair_InstanceMapScript, instance_ruby_sanctum::instance_ruby_sanctum_InstanceMapScript, instance_molten_core::instance_molten_core_InstanceMapScript, instance_blackrock_spire::instance_blackrock_spireMapScript, instance_wailing_caverns::instance_wailing_caverns_InstanceMapScript, instance_pit_of_saron::instance_pit_of_saron_InstanceScript, instance_gruuls_lair::instance_gruuls_lair_InstanceMapScript, instance_blood_furnace::instance_blood_furnace_InstanceMapScript, instance_black_temple::instance_black_temple_InstanceMapScript, instance_oculus::instance_oculus_InstanceMapScript, instance_utgarde_keep::instance_utgarde_keep_InstanceMapScript, instance_nexus::instance_nexus_InstanceMapScript, instance_utgarde_pinnacle::instance_utgarde_pinnacle_InstanceMapScript, instance_sethekk_halls::instance_sethekk_halls_InstanceMapScript, instance_ahnkahet::instance_ahnkahet_InstanceScript, instance_zulgurub::instance_zulgurub_InstanceMapScript, instance_arcatraz::instance_arcatraz_InstanceMapScript, instance_zulaman::instance_zulaman_InstanceScript, instance_vault_of_archavon::instance_vault_of_archavon_InstanceMapScript, instance_shadow_labyrinth::instance_shadow_labyrinth_InstanceMapScript, instance_obsidian_sanctum::instance_obsidian_sanctum_InstanceMapScript, instance_baradin_hold::instance_baradin_hold_InstanceMapScript, instance_forge_of_souls::instance_forge_of_souls_InstanceScript, instance_halls_of_lightning::instance_halls_of_lightning_InstanceMapScript, instance_halls_of_stone::instance_halls_of_stone_InstanceMapScript, instance_drak_tharon_keep::instance_drak_tharon_keep_InstanceScript, instance_firelands::instance_firelands_InstanceScript, instance_ruins_of_ahnqiraj::instance_ruins_of_ahnqiraj_InstanceMapScript, and instance_the_botanica::instance_the_botanica_InstanceMapScript.

62 {
63  AddObject(creature, true);
64  AddMinion(creature, true);
65 }
void AddObject(Creature *obj, bool add)
Definition: InstanceScript.cpp:213
void AddMinion(Creature *minion, bool add)
Definition: InstanceScript.cpp:261

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void InstanceScript::OnCreatureRemove ( Creature creature)
overridevirtual
void InstanceScript::OnGameObjectCreate ( GameObject go)
overridevirtual

Reimplemented from ZoneScript.

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

74 {
75  AddObject(go, true);
76  AddDoor(go, true);
77 }
void AddObject(Creature *obj, bool add)
Definition: InstanceScript.cpp:213
virtual void AddDoor(GameObject *door, bool add)
Definition: InstanceScript.cpp:239

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void InstanceScript::OnGameObjectRemove ( GameObject go)
overridevirtual

Reimplemented from ZoneScript.

Reimplemented in instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript, instance_ulduar::instance_ulduar_InstanceMapScript, instance_naxxramas::instance_naxxramas_InstanceMapScript, instance_halls_of_reflection::instance_halls_of_reflection_InstanceMapScript, instance_violet_hold::instance_violet_hold_InstanceMapScript, instance_pit_of_saron::instance_pit_of_saron_InstanceScript, instance_ruby_sanctum::instance_ruby_sanctum_InstanceMapScript, instance_sunwell_plateau::instance_sunwell_plateau_InstanceMapScript, instance_culling_of_stratholme::instance_culling_of_stratholme_InstanceMapScript, instance_utgarde_keep::instance_utgarde_keep_InstanceMapScript, instance_magisters_terrace::instance_magisters_terrace_InstanceMapScript, instance_oculus::instance_oculus_InstanceMapScript, instance_black_temple::instance_black_temple_InstanceMapScript, instance_blood_furnace::instance_blood_furnace_InstanceMapScript, instance_blackwing_lair::instance_blackwing_lair_InstanceMapScript, instance_utgarde_pinnacle::instance_utgarde_pinnacle_InstanceMapScript, instance_ahnkahet::instance_ahnkahet_InstanceScript, instance_shattered_halls::instance_shattered_halls_InstanceMapScript, instance_halls_of_stone::instance_halls_of_stone_InstanceMapScript, instance_zulgurub::instance_zulgurub_InstanceMapScript, instance_halls_of_origination::instance_halls_of_origination_InstanceMapScript, instance_gruuls_lair::instance_gruuls_lair_InstanceMapScript, instance_onyxias_lair::instance_onyxias_lair_InstanceMapScript, instance_zulaman::instance_zulaman_InstanceScript, instance_arcatraz::instance_arcatraz_InstanceMapScript, instance_baradin_hold::instance_baradin_hold_InstanceMapScript, instance_halls_of_lightning::instance_halls_of_lightning_InstanceMapScript, instance_shadow_labyrinth::instance_shadow_labyrinth_InstanceMapScript, instance_scarlet_monastery::instance_scarlet_monastery_InstanceMapScript, and instance_mechanar::instance_mechanar_InstanceMapScript.

80 {
81  AddObject(go, false);
82  AddDoor(go, false);
83 }
void AddObject(Creature *obj, bool add)
Definition: InstanceScript.cpp:213
virtual void AddDoor(GameObject *door, bool add)
Definition: InstanceScript.cpp:239

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void InstanceScript::ReadSaveDataBossStates ( std::istringstream &  data)
protected
356 {
357  uint32 bossId = 0;
358  for (std::vector<BossInfo>::iterator i = bosses.begin(); i != bosses.end(); ++i, ++bossId)
359  {
360  uint32 buff;
361  data >> buff;
362  if (buff == IN_PROGRESS || buff == SPECIAL)
363  buff = NOT_STARTED;
364 
365  if (buff < TO_BE_DECIDED)
366  SetBossState(bossId, EncounterState(buff));
367  }
368 }
EncounterState
Definition: InstanceScript.h:56
Definition: InstanceScript.h:59
Definition: InstanceScript.h:58
uint32_t uint32
Definition: Define.h:150
Definition: InstanceScript.h:62
virtual bool SetBossState(uint32 id, EncounterState state)
Definition: InstanceScript.cpp:273
Definition: InstanceScript.h:63
std::vector< BossInfo > bosses
Definition: InstanceScript.h:292

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool InstanceScript::ReadSaveDataHeaders ( std::istringstream &  data)
protected
342 {
343  for (char header : headers)
344  {
345  char buff;
346  data >> buff;
347 
348  if (header != buff)
349  return false;
350  }
351 
352  return true;
353 }
std::vector< char > headers
Definition: InstanceScript.h:291

+ Here is the caller graph for this function:

void InstanceScript::SaveToDB ( )
40 {
41  std::string data = GetSaveData();
42  if (data.empty())
43  return;
44 
47  stmt->setString(1, data);
48  stmt->setUInt32(2, instance->GetInstanceId());
50 }
void Execute(const char *sql)
Definition: DatabaseWorkerPool.h:87
void setString(const uint8 index, const std::string &value)
Definition: PreparedStatement.cpp:187
Definition: PreparedStatement.h:74
Map * instance
Definition: InstanceScript.h:148
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
void setUInt32(const uint8 index, const uint32 value)
Definition: PreparedStatement.cpp:115
uint32 GetCompletedEncounterMask() const
Definition: InstanceScript.h:245
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
virtual std::string GetSaveData()
Definition: InstanceScript.cpp:370
Definition: CharacterDatabase.h:242
uint32 GetInstanceId() const
Definition: Map.h:368

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void InstanceScript::SendEncounterUnit ( uint32  type,
Unit unit = NULL,
uint8  param1 = 0,
uint8  param2 = 0 
)
576 {
577  // size of this packet is at most 15 (usually less)
579  data << uint32(type);
580 
581  switch (type)
582  {
583  case ENCOUNTER_FRAME_ENGAGE: // SMSG_INSTANCE_ENCOUNTER_ENGAGE_UNIT
584  case ENCOUNTER_FRAME_DISENGAGE: // SMSG_INSTANCE_ENCOUNTER_DISENGAGE_UNIT
585  case ENCOUNTER_FRAME_UPDATE_PRIORITY: // SMSG_INSTANCE_ENCOUNTER_CHANGE_PRIORITY
586  if (!unit)
587  return;
588  data << unit->GetPackGUID();
589  data << uint8(param1);
590  break;
591  case ENCOUNTER_FRAME_ADD_TIMER: // SMSG_INSTANCE_ENCOUNTER_TIMER_START
592  case ENCOUNTER_FRAME_ENABLE_OBJECTIVE: // SMSG_INSTANCE_ENCOUNTER_OBJECTIVE_START
593  case ENCOUNTER_FRAME_DISABLE_OBJECTIVE: // SMSG_INSTANCE_ENCOUNTER_OBJECTIVE_COMPLETE
594  data << uint8(param1);
595  break;
596  case ENCOUNTER_FRAME_UPDATE_OBJECTIVE: // SMSG_INSTANCE_ENCOUNTER_OBJECTIVE_UPDATE
597  data << uint8(param1);
598  data << uint8(param2);
599  break;
600  default:
601  break;
602  }
603 
604  instance->SendToPlayers(&data);
605 }
Definition: InstanceScript.h:46
Definition: InstanceScript.h:50
Definition: InstanceScript.h:48
Definition: InstanceScript.h:47
Definition: InstanceScript.h:51
Definition: InstanceScript.h:45
void SendToPlayers(WorldPacket const *data) const
Definition: Map.cpp:2914
PackedGuid const & GetPackGUID() const
Definition: Object.h:106
Map * instance
Definition: InstanceScript.h:148
Definition: Opcodes.h:1129
uint8_t uint8
Definition: g3dmath.h:164
Definition: InstanceScript.h:49
uint32_t uint32
Definition: g3dmath.h:168
Definition: WorldPacket.h:26

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool InstanceScript::ServerAllowsTwoSideGroups ( )
inline
224 { return sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP); }
#define sWorld
Definition: World.h:887

+ Here is the caller graph for this function:

void InstanceScript::SetBossNumber ( uint32  number)
inlineprotected
258 { bosses.resize(number); }
std::vector< BossInfo > bosses
Definition: InstanceScript.h:292
bool InstanceScript::SetBossState ( uint32  id,
EncounterState  state 
)
virtual

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

274 {
275  if (id < bosses.size())
276  {
277  BossInfo* bossInfo = &bosses[id];
278  if (bossInfo->state == TO_BE_DECIDED) // loading
279  {
280  bossInfo->state = state;
281  //TC_LOG_ERROR("misc", "Inialize boss %u state as %u.", id, (uint32)state);
282  return false;
283  }
284  else
285  {
286  if (bossInfo->state == state)
287  return false;
288 
289  if (state == DONE)
290  for (GuidSet::iterator i = bossInfo->minion.begin(); i != bossInfo->minion.end(); ++i)
291  if (Creature* minion = instance->GetCreature(*i))
292  if (minion->isWorldBoss() && minion->IsAlive())
293  return false;
294 
295  bossInfo->state = state;
296  SaveToDB();
297  }
298 
299  for (uint32 type = 0; type < MAX_DOOR_TYPES; ++type)
300  for (GuidSet::iterator i = bossInfo->door[type].begin(); i != bossInfo->door[type].end(); ++i)
301  if (GameObject* door = instance->GetGameObject(*i))
302  UpdateDoorState(door);
303 
304  for (GuidSet::iterator i = bossInfo->minion.begin(); i != bossInfo->minion.end(); ++i)
305  if (Creature* minion = instance->GetCreature(*i))
306  UpdateMinionState(minion, state);
307 
308  return true;
309  }
310  return false;
311 }
Definition: inflate.h:49
Definition: Creature.h:467
GuidSet door[MAX_DOOR_TYPES]
Definition: InstanceScript.h:115
void SaveToDB()
Definition: InstanceScript.cpp:39
uint32_t uint32
Definition: Define.h:150
Map * instance
Definition: InstanceScript.h:148
Definition: GameObject.h:880
EncounterState state
Definition: InstanceScript.h:114
Definition: InstanceScript.h:111
void UpdateMinionState(Creature *minion, EncounterState state)
Definition: InstanceScript.cpp:157
Creature * GetCreature(ObjectGuid const &guid)
Definition: Map.cpp:3535
Definition: InstanceScript.h:71
Definition: InstanceScript.h:63
GameObject * GetGameObject(ObjectGuid const &guid)
Definition: Map.cpp:3545
virtual void UpdateDoorState(GameObject *door)
Definition: InstanceScript.cpp:178
GuidSet minion
Definition: InstanceScript.h:116
std::vector< BossInfo > bosses
Definition: InstanceScript.h:292

+ Here is the call graph for this function:

void InstanceScript::SetCompletedEncountersMask ( uint32  newMask)
inline
242 { completedEncounters = newMask; }
uint32 completedEncounters
Definition: InstanceScript.h:298

+ Here is the caller graph for this function:

void InstanceScript::SetHeaders ( std::string const dataHeaders)
protected
99 {
100  for (char header : dataHeaders)
101  if (isalpha(header))
102  headers.push_back(header);
103 }
std::vector< char > headers
Definition: InstanceScript.h:291
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_naxxramas::instance_naxxramas_InstanceMapScript, instance_halls_of_reflection::instance_halls_of_reflection_InstanceMapScript, instance_stratholme::instance_stratholme_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_oculus::instance_oculus_InstanceMapScript, instance_gundrak::instance_gundrak_InstanceMapScript, instance_culling_of_stratholme::instance_culling_of_stratholme_InstanceMapScript, instance_shattered_halls::instance_shattered_halls_InstanceMapScript, instance_shadowfang_keep::instance_shadowfang_keep_InstanceMapScript, instance_zulaman::instance_zulaman_InstanceScript, instance_blackwing_lair::instance_blackwing_lair_InstanceMapScript, instance_zulfarrak::instance_zulfarrak_InstanceMapScript, instance_magtheridons_lair::instance_magtheridons_lair_InstanceMapScript, instance_onyxias_lair::instance_onyxias_lair_InstanceMapScript, instance_magisters_terrace::instance_magisters_terrace_InstanceMapScript, instance_serpent_shrine::instance_serpentshrine_cavern_InstanceMapScript, instance_sunken_temple::instance_sunken_temple_InstanceMapScript, instance_deadmines::instance_deadmines_InstanceMapScript, and instance_razorfen_kraul::instance_razorfen_kraul_InstanceMapScript.

163 { }

+ Here is the caller graph for this function:

void InstanceScript::UpdateDoorState ( GameObject door)
protectedvirtual

Reimplemented in instance_ulduar::instance_ulduar_InstanceMapScript.

179 {
180  DoorInfoMapBounds range = doors.equal_range(door->GetEntry());
181  if (range.first == range.second)
182  return;
183 
184  bool open = true;
185  for (; range.first != range.second && open; ++range.first)
186  {
187  DoorInfo const& info = range.first->second;
188  switch (info.type)
189  {
190  case DOOR_TYPE_ROOM:
191  open = (info.bossInfo->state != IN_PROGRESS);
192  break;
193  case DOOR_TYPE_PASSAGE:
194  open = (info.bossInfo->state == DONE);
195  break;
197  open = (info.bossInfo->state == IN_PROGRESS);
198  break;
199  default:
200  break;
201  }
202  }
203 
204  door->SetGoState(open ? GO_STATE_ACTIVE : GO_STATE_READY);
205 }
Definition: InstanceScript.h:69
Definition: InstanceScript.h:68
Definition: inflate.h:49
std::pair< DoorInfoMap::const_iterator, DoorInfoMap::const_iterator > DoorInfoMapBounds
Definition: InstanceScript.h:135
Definition: InstanceScript.h:59
Definition: GameObject.h:822
Definition: GameObject.h:823
void SetGoState(GOState state)
Definition: GameObject.cpp:2137
EncounterState state
Definition: InstanceScript.h:114
Definition: InstanceScript.h:120
uint32 GetEntry() const
Definition: Object.h:107
BossInfo * bossInfo
Definition: InstanceScript.h:124
Definition: InstanceScript.h:70
DoorType type
Definition: InstanceScript.h:125
DoorInfoMap doors
Definition: InstanceScript.h:293

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void InstanceScript::UpdateEncounterState ( EncounterCreditType  type,
uint32  creditEntry,
Unit source 
)
608 {
609  DungeonEncounterList const* encounters = sObjectMgr->GetDungeonEncounterList(instance->GetId(), instance->GetDifficultyID());
610  if (!encounters)
611  return;
612 
613  uint32 dungeonId = 0;
614 
615  for (DungeonEncounterList::const_iterator itr = encounters->begin(); itr != encounters->end(); ++itr)
616  {
617  DungeonEncounter const* encounter = *itr;
618  if (encounter->creditType == type && encounter->creditEntry == creditEntry)
619  {
620  completedEncounters |= 1 << encounter->dbcEntry->OrderIndex;
621  if (encounter->lastEncounterDungeon)
622  {
623  dungeonId = encounter->lastEncounterDungeon;
624  TC_LOG_DEBUG("lfg", "UpdateEncounterState: Instance %s (instanceId %u) completed encounter %s. Credit Dungeon: %u", instance->GetMapName(), instance->GetInstanceId(), encounter->dbcEntry->Name_lang, dungeonId);
625  break;
626  }
627  }
628  }
629 
630  if (dungeonId)
631  {
632  Map::PlayerList const& players = instance->GetPlayers();
633  for (Map::PlayerList::const_iterator i = players.begin(); i != players.end(); ++i)
634  {
635  if (Player* player = i->GetSource())
636  if (Group* grp = player->GetGroup())
637  if (grp->isLFGGroup())
638  {
639  sLFGMgr->FinishDungeon(grp->GetGUID(), dungeonId);
640  return;
641  }
642  }
643  }
644 }
Definition: ObjectMgr.h:676
Difficulty GetDifficultyID() const
Definition: Map.h:390
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:198
iterator begin()
Definition: MapRefManager.h:37
EncounterCreditType creditType
Definition: ObjectMgr.h:682
#define sObjectMgr
Definition: ObjectMgr.h:1567
uint32 GetId(void) const
Definition: Map.h:325
uint32 completedEncounters
Definition: InstanceScript.h:298
uint32 OrderIndex
Definition: DBCStructure.h:361
#define sLFGMgr
Definition: LFGMgr.h:481
uint32_t uint32
Definition: Define.h:150
Map * instance
Definition: InstanceScript.h:148
Definition: LinkedList.h:141
uint32 lastEncounterDungeon
Definition: ObjectMgr.h:684
PlayerList const & GetPlayers() const
Definition: Map.h:433
char * Name_lang
Definition: DBCStructure.h:363
Definition: MapRefManager.h:26
DungeonEncounterEntry const * dbcEntry
Definition: ObjectMgr.h:681
std::list< DungeonEncounter const * > DungeonEncounterList
Definition: ObjectMgr.h:687
uint32 creditEntry
Definition: ObjectMgr.h:683
const char * GetMapName() const
Definition: Map.cpp:2644
uint32 GetInstanceId() const
Definition: Map.h:368
iterator end()
Definition: MapRefManager.h:38
Definition: Group.h:191

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void InstanceScript::UpdateMinionState ( Creature minion,
EncounterState  state 
)
protected
158 {
159  switch (state)
160  {
161  case NOT_STARTED:
162  if (!minion->IsAlive())
163  minion->Respawn();
164  else if (minion->IsInCombat())
165  minion->AI()->EnterEvadeMode();
166  break;
167  case IN_PROGRESS:
168  if (!minion->IsAlive())
169  minion->Respawn();
170  else if (!minion->GetVictim())
171  minion->AI()->DoZoneInCombat();
172  break;
173  default:
174  break;
175  }
176 }
virtual void EnterEvadeMode(EvadeReason why=EVADE_REASON_OTHER)
Definition: CreatureAI.cpp:168
void DoZoneInCombat(Creature *creature=NULL, float maxRangeToNearestTarget=50.0f)
Definition: CreatureAI.cpp:47
bool IsInCombat() const
Definition: Unit.h:1584
Definition: InstanceScript.h:59
bool IsAlive() const
Definition: Unit.h:1692
Unit * GetVictim() const
Definition: Unit.h:1379
Definition: InstanceScript.h:58
CreatureAI * AI() const
Definition: Creature.h:525
void Respawn(bool force=false)
Definition: Creature.cpp:1697

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void InstanceScript::UpdatePhasing ( )
647 {
648  Map::PlayerList const& players = instance->GetPlayers();
649  for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
650  if (Player* player = itr->GetSource())
651  player->SendUpdatePhasing();
652 }
iterator begin()
Definition: MapRefManager.h:37
Map * instance
Definition: InstanceScript.h:148
Definition: LinkedList.h:141
PlayerList const & GetPlayers() const
Definition: Map.h:433
Definition: MapRefManager.h:26
iterator end()
Definition: MapRefManager.h:38

+ Here is the call graph for this function:

void InstanceScript::WriteSaveDataBossStates ( std::ostringstream &  data)
protected
392 {
393  for (BossInfo const& bossInfo : bosses)
394  data << uint32(bossInfo.state) << ' ';
395 }
Definition: InstanceScript.h:111
uint32_t uint32
Definition: g3dmath.h:168
std::vector< BossInfo > bosses
Definition: InstanceScript.h:292

+ Here is the caller graph for this function:

void InstanceScript::WriteSaveDataHeaders ( std::ostringstream &  data)
protected
386 {
387  for (char header : headers)
388  data << header << ' ';
389 }
std::vector< char > headers
Definition: InstanceScript.h:291

+ Here is the caller graph for this function:

Member Data Documentation

ObjectInfoMap InstanceScript::_creatureInfo
private
ObjectInfoMap InstanceScript::_gameObjectInfo
private
ObjectGuidMap InstanceScript::_objectGuids
private
std::vector<BossInfo> InstanceScript::bosses
private
uint32 InstanceScript::completedEncounters
private
DoorInfoMap InstanceScript::doors
private
std::vector<char> InstanceScript::headers
private
Map* InstanceScript::instance
MinionInfoMap InstanceScript::minions
private

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