TrinityCore
Loading...
Searching...
No Matches
GameEventMgr Class Reference

#include <GameEventMgr.h>

Public Types

typedef std::set< uint16 > ActiveEvents
 
typedef std::vector< GameEventData > GameEventDataMap
 

Public Member Functions

ActiveEvents const & GetActiveEventList () const
 
GameEventDataMap const & GetEventMap () const
 
bool CheckOneGameEvent (uint16 entry) const
 
uint32 NextCheck (uint16 entry) const
 
void LoadFromDB ()
 
void LoadHolidayDates ()
 
uint32 Update ()
 
bool IsActiveEvent (uint16 event_id)
 
uint32 StartSystem ()
 
void Initialize ()
 
void StartArenaSeason ()
 
void StartInternalEvent (uint16 event_id)
 
bool StartEvent (uint16 event_id, bool overwrite=false)
 
void StopEvent (uint16 event_id, bool overwrite=false)
 
void HandleQuestComplete (uint32 quest_id)
 
uint32 GetNPCFlag (Creature *cr)
 

Static Public Member Functions

static GameEventMgr * instance ()
 

Public Attributes

GameEventGuidMap mGameEventCreatureGuids
 
GameEventGuidMap mGameEventGameobjectGuids
 
std::vector< uint32 > modifiedHolidays
 

Private Types

typedef std::list< ObjectGuid::LowType > GuidList
 
typedef std::list< uint32 > IdList
 
typedef std::vector< GuidList > GameEventGuidMap
 
typedef std::vector< IdList > GameEventIdMap
 
typedef std::pair< ObjectGuid::LowType, ModelEquip > ModelEquipPair
 
typedef std::list< ModelEquipPair > ModelEquipList
 
typedef std::vector< ModelEquipList > GameEventModelEquipMap
 
typedef std::pair< uint32, uint32 > QuestRelation
 
typedef std::list< QuestRelation > QuestRelList
 
typedef std::vector< QuestRelList > GameEventQuestMap
 
typedef std::list< NPCVendorEntry > NPCVendorList
 
typedef std::vector< NPCVendorList > GameEventNPCVendorMap
 
typedef std::map< uint32, GameEventQuestToEventConditionNum > QuestIdToEventConditionMap
 
typedef std::pair< ObjectGuid::LowType, uint32 > GuidNPCFlagPair
 
typedef std::list< GuidNPCFlagPair > NPCFlagList
 
typedef std::vector< NPCFlagList > GameEventNPCFlagMap
 
typedef std::vector< uint32 > GameEventBattlegroundMap
 

Private Member Functions

 GameEventMgr ()
 
 ~GameEventMgr ()
 
void SendWorldStateUpdate (Player *player, uint16 event_id)
 
void AddActiveEvent (uint16 event_id)
 
void RemoveActiveEvent (uint16 event_id)
 
void ApplyNewEvent (uint16 event_id)
 
void UnApplyEvent (uint16 event_id)
 
void GameEventSpawn (int16 event_id)
 
void GameEventUnspawn (int16 event_id)
 
void ChangeEquipOrModel (int16 event_id, bool activate)
 
void UpdateEventQuests (uint16 event_id, bool activate)
 
void UpdateWorldStates (uint16 event_id, bool Activate)
 
void UpdateEventNPCFlags (uint16 event_id)
 
void UpdateEventNPCVendor (uint16 event_id, bool activate)
 
void UpdateBattlegroundSettings ()
 
void RunSmartAIScripts (uint16 event_id, bool activate)
 
bool CheckOneGameEventConditions (uint16 event_id)
 Runs SMART_EVENT_GAME_EVENT_START/_END SAI.
 
void SaveWorldEventStateToDB (uint16 event_id)
 
bool hasCreatureQuestActiveEventExcept (uint32 quest_id, uint16 event_id)
 
bool hasGameObjectQuestActiveEventExcept (uint32 quest_id, uint16 event_id)
 
bool hasCreatureActiveEventExcept (ObjectGuid::LowType creature_guid, uint16 event_id)
 
bool hasGameObjectActiveEventExcept (ObjectGuid::LowType go_guid, uint16 event_id)
 
void SetHolidayEventTime (GameEventData &event)
 
time_t GetLastStartTime (uint16 event_id) const
 

Private Attributes

GameEventQuestMap mGameEventCreatureQuests
 
GameEventQuestMap mGameEventGameObjectQuests
 
GameEventNPCVendorMap mGameEventVendors
 
GameEventModelEquipMap mGameEventModelEquip
 
GameEventIdMap mGameEventPoolIds
 
GameEventDataMap mGameEvent
 
GameEventBattlegroundMap mGameEventBattlegroundHolidays
 
QuestIdToEventConditionMap mQuestToEventConditions
 
GameEventNPCFlagMap mGameEventNPCFlags
 
ActiveEvents m_ActiveEvents
 
bool isSystemInit
 

Detailed Description

Definition at line 101 of file GameEventMgr.h.

Member Typedef Documentation

◆ ActiveEvents

Definition at line 110 of file GameEventMgr.h.

◆ GameEventBattlegroundMap

typedef std::vector<uint32> GameEventMgr::GameEventBattlegroundMap
private

Definition at line 169 of file GameEventMgr.h.

◆ GameEventDataMap

Definition at line 111 of file GameEventMgr.h.

◆ GameEventGuidMap

typedef std::vector<GuidList> GameEventMgr::GameEventGuidMap
private

Definition at line 155 of file GameEventMgr.h.

◆ GameEventIdMap

typedef std::vector<IdList> GameEventMgr::GameEventIdMap
private

Definition at line 156 of file GameEventMgr.h.

◆ GameEventModelEquipMap

Definition at line 159 of file GameEventMgr.h.

◆ GameEventNPCFlagMap

typedef std::vector<NPCFlagList> GameEventMgr::GameEventNPCFlagMap
private

Definition at line 168 of file GameEventMgr.h.

◆ GameEventNPCVendorMap

typedef std::vector<NPCVendorList> GameEventMgr::GameEventNPCVendorMap
private

Definition at line 164 of file GameEventMgr.h.

◆ GameEventQuestMap

typedef std::vector<QuestRelList> GameEventMgr::GameEventQuestMap
private

Definition at line 162 of file GameEventMgr.h.

◆ GuidList

typedef std::list<ObjectGuid::LowType> GameEventMgr::GuidList
private

Definition at line 153 of file GameEventMgr.h.

◆ GuidNPCFlagPair

Definition at line 166 of file GameEventMgr.h.

◆ IdList

typedef std::list<uint32> GameEventMgr::IdList
private

Definition at line 154 of file GameEventMgr.h.

◆ ModelEquipList

typedef std::list<ModelEquipPair> GameEventMgr::ModelEquipList
private

Definition at line 158 of file GameEventMgr.h.

◆ ModelEquipPair

Definition at line 157 of file GameEventMgr.h.

◆ NPCFlagList

typedef std::list<GuidNPCFlagPair> GameEventMgr::NPCFlagList
private

Definition at line 167 of file GameEventMgr.h.

◆ NPCVendorList

typedef std::list<NPCVendorEntry> GameEventMgr::NPCVendorList
private

Definition at line 163 of file GameEventMgr.h.

◆ QuestIdToEventConditionMap

◆ QuestRelation

typedef std::pair<uint32, uint32> GameEventMgr::QuestRelation
private

Definition at line 160 of file GameEventMgr.h.

◆ QuestRelList

typedef std::list<QuestRelation> GameEventMgr::QuestRelList
private

Definition at line 161 of file GameEventMgr.h.

Constructor & Destructor Documentation

◆ GameEventMgr()

GameEventMgr::GameEventMgr ( )
private

Definition at line 1589 of file GameEventMgr.cpp.

◆ ~GameEventMgr()

GameEventMgr::~GameEventMgr ( )
inlineprivate

Definition at line 105 of file GameEventMgr.h.

Member Function Documentation

◆ AddActiveEvent()

void GameEventMgr::AddActiveEvent ( uint16  event_id)
inlineprivate

Definition at line 131 of file GameEventMgr.h.

Referenced by StartEvent().

◆ ApplyNewEvent()

◆ ChangeEquipOrModel()

void GameEventMgr::ChangeEquipOrModel ( int16  event_id,
bool  activate 
)
private

◆ CheckOneGameEvent()

◆ CheckOneGameEventConditions()

bool GameEventMgr::CheckOneGameEventConditions ( uint16  event_id)
private

Runs SMART_EVENT_GAME_EVENT_START/_END SAI.

Definition at line 1646 of file GameEventMgr.cpp.

References GAMEEVENT_WORLD_NEXTPHASE, GameTime::GetGameTime(), and mGameEvent.

Referenced by HandleQuestComplete(), StartEvent(), and Update().

◆ GameEventSpawn()

◆ GameEventUnspawn()

void GameEventMgr::GameEventUnspawn ( int16  event_id)
private

◆ GetActiveEventList()

ActiveEvents const & GameEventMgr::GetActiveEventList ( ) const
inline

Definition at line 112 of file GameEventMgr.h.

◆ GetEventMap()

GameEventDataMap const & GameEventMgr::GetEventMap ( ) const
inline

Definition at line 113 of file GameEventMgr.h.

◆ GetLastStartTime()

time_t GameEventMgr::GetLastStartTime ( uint16  event_id) const
private

Definition at line 1821 of file GameEventMgr.cpp.

References GAMEEVENT_NORMAL, GameTime::GetSystemTime(), and mGameEvent.

Referenced by ApplyNewEvent().

◆ GetNPCFlag()

uint32 GameEventMgr::GetNPCFlag ( Creature *  cr)

Definition at line 990 of file GameEventMgr.cpp.

References Creature::GetSpawnId(), m_ActiveEvents, and mGameEventNPCFlags.

Referenced by UpdateEventNPCFlags().

◆ HandleQuestComplete()

◆ hasCreatureActiveEventExcept()

bool GameEventMgr::hasCreatureActiveEventExcept ( ObjectGuid::LowType  creature_guid,
uint16  event_id 
)
private

Definition at line 1481 of file GameEventMgr.cpp.

References m_ActiveEvents, mGameEvent, and mGameEventCreatureGuids.

Referenced by GameEventUnspawn().

◆ hasCreatureQuestActiveEventExcept()

bool GameEventMgr::hasCreatureQuestActiveEventExcept ( uint32  quest_id,
uint16  event_id 
)
private

Definition at line 1454 of file GameEventMgr.cpp.

References m_ActiveEvents, and mGameEventCreatureQuests.

Referenced by UpdateEventQuests().

◆ hasGameObjectActiveEventExcept()

bool GameEventMgr::hasGameObjectActiveEventExcept ( ObjectGuid::LowType  go_guid,
uint16  event_id 
)
private

Definition at line 1497 of file GameEventMgr.cpp.

References m_ActiveEvents, mGameEvent, and mGameEventGameobjectGuids.

◆ hasGameObjectQuestActiveEventExcept()

bool GameEventMgr::hasGameObjectQuestActiveEventExcept ( uint32  quest_id,
uint16  event_id 
)
private

Definition at line 1468 of file GameEventMgr.cpp.

References m_ActiveEvents, and mGameEventGameObjectQuests.

Referenced by UpdateEventQuests().

◆ Initialize()

◆ instance()

GameEventMgr * GameEventMgr::instance ( )
static

Definition at line 34 of file GameEventMgr.cpp.

References instance().

Referenced by instance().

◆ IsActiveEvent()

bool GameEventMgr::IsActiveEvent ( uint16  event_id)
inline

Definition at line 119 of file GameEventMgr.h.

Referenced by HandleQuestComplete(), and Update().

◆ LoadFromDB()

◆ LoadHolidayDates()

◆ NextCheck()

uint32 GameEventMgr::NextCheck ( uint16  entry) const

◆ RemoveActiveEvent()

void GameEventMgr::RemoveActiveEvent ( uint16  event_id)
inlineprivate

Definition at line 132 of file GameEventMgr.h.

Referenced by StopEvent().

◆ RunSmartAIScripts()

void GameEventMgr::RunSmartAIScripts ( uint16  event_id,
bool  activate 
)
private

Iterate over every supported source type (creature and gameobject) Not entirely sure how this will affect units in non-loaded grids.

Definition at line 1718 of file GameEventMgr.cpp.

References Map::GetObjectsStore(), sMapMgr, and TypeContainerVisitor< VISITOR, TYPE_CONTAINER >::Visit().

Referenced by ApplyNewEvent(), and UnApplyEvent().

◆ SaveWorldEventStateToDB()

void GameEventMgr::SaveWorldEventStateToDB ( uint16  event_id)
private

◆ SendWorldStateUpdate()

void GameEventMgr::SendWorldStateUpdate ( Player *  player,
uint16  event_id 
)
private

Definition at line 1679 of file GameEventMgr.cpp.

References mGameEvent, and Player::SendUpdateWorldState().

◆ SetHolidayEventTime()

◆ StartArenaSeason()

void GameEventMgr::StartArenaSeason ( )

◆ StartEvent()

◆ StartInternalEvent()

void GameEventMgr::StartInternalEvent ( uint16  event_id)

Definition at line 117 of file GameEventMgr.cpp.

References m_ActiveEvents, mGameEvent, and StartEvent().

◆ StartSystem()

uint32 GameEventMgr::StartSystem ( )

Definition at line 1032 of file GameEventMgr.cpp.

References isSystemInit, m_ActiveEvents, and Update().

◆ StopEvent()

◆ UnApplyEvent()

void GameEventMgr::UnApplyEvent ( uint16  event_id)
private

◆ Update()

◆ UpdateBattlegroundSettings()

void GameEventMgr::UpdateBattlegroundSettings ( )
private

Definition at line 1223 of file GameEventMgr.cpp.

References m_ActiveEvents, mGameEventBattlegroundHolidays, and sBattlegroundMgr.

Referenced by ApplyNewEvent(), and UnApplyEvent().

◆ UpdateEventNPCFlags()

void GameEventMgr::UpdateEventNPCFlags ( uint16  event_id)
private

◆ UpdateEventNPCVendor()

void GameEventMgr::UpdateEventNPCVendor ( uint16  event_id,
bool  activate 
)
private

Definition at line 1231 of file GameEventMgr.cpp.

References mGameEventVendors, and sObjectMgr.

Referenced by ApplyNewEvent(), and UnApplyEvent().

◆ UpdateEventQuests()

void GameEventMgr::UpdateEventQuests ( uint16  event_id,
bool  activate 
)
private

◆ UpdateWorldStates()

Member Data Documentation

◆ isSystemInit

bool GameEventMgr::isSystemInit
private

Definition at line 182 of file GameEventMgr.h.

Referenced by StartSystem(), and Update().

◆ m_ActiveEvents

◆ mGameEvent

◆ mGameEventBattlegroundHolidays

GameEventBattlegroundMap GameEventMgr::mGameEventBattlegroundHolidays
private

Definition at line 178 of file GameEventMgr.h.

Referenced by Initialize(), LoadFromDB(), and UpdateBattlegroundSettings().

◆ mGameEventCreatureGuids

GameEventGuidMap GameEventMgr::mGameEventCreatureGuids

◆ mGameEventCreatureQuests

GameEventQuestMap GameEventMgr::mGameEventCreatureQuests
private

◆ mGameEventGameobjectGuids

GameEventGuidMap GameEventMgr::mGameEventGameobjectGuids

◆ mGameEventGameObjectQuests

GameEventQuestMap GameEventMgr::mGameEventGameObjectQuests
private

◆ mGameEventModelEquip

GameEventModelEquipMap GameEventMgr::mGameEventModelEquip
private

Definition at line 173 of file GameEventMgr.h.

Referenced by ChangeEquipOrModel(), Initialize(), and LoadFromDB().

◆ mGameEventNPCFlags

GameEventNPCFlagMap GameEventMgr::mGameEventNPCFlags
private

Definition at line 180 of file GameEventMgr.h.

Referenced by GetNPCFlag(), Initialize(), LoadFromDB(), and UpdateEventNPCFlags().

◆ mGameEventPoolIds

GameEventIdMap GameEventMgr::mGameEventPoolIds
private

Definition at line 176 of file GameEventMgr.h.

Referenced by GameEventSpawn(), Initialize(), and LoadFromDB().

◆ mGameEventVendors

GameEventNPCVendorMap GameEventMgr::mGameEventVendors
private

Definition at line 172 of file GameEventMgr.h.

Referenced by Initialize(), LoadFromDB(), and UpdateEventNPCVendor().

◆ modifiedHolidays

std::vector<uint32> GameEventMgr::modifiedHolidays

Definition at line 187 of file GameEventMgr.h.

Referenced by LoadHolidayDates().

◆ mQuestToEventConditions

QuestIdToEventConditionMap GameEventMgr::mQuestToEventConditions
private

Definition at line 179 of file GameEventMgr.h.

Referenced by HandleQuestComplete(), and LoadFromDB().


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