AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
World Class Reference

The World. More...

#include "World.h"

Inheritance diagram for World:
IWorld

Public Member Functions

 World ()
 World constructor.
 
 ~World () override
 World destructor.
 
bool IsClosed () const override
 Deny clients?
 
void SetClosed (bool val) override
 Close world.
 
AccountTypes GetPlayerSecurityLimit () const override
 Security level limitations.
 
void SetPlayerSecurityLimit (AccountTypes sec) override
 
void LoadDBAllowedSecurityLevel () override
 
bool getAllowMovement () const override
 
void SetAllowMovement (bool allow) override
 Allow/Disallow object movements.
 
LocaleConstant GetDefaultDbcLocale () const override
 
std::string const & GetDataPath () const override
 Get the path where data (dbc, maps) are stored on disk.
 
Seconds GetNextDailyQuestsResetTime () const override
 Next daily quests and random bg reset time.
 
Seconds GetNextWeeklyQuestsResetTime () const override
 
Seconds GetNextRandomBGResetTime () const override
 
uint16 GetConfigMaxSkillValue () const override
 Get the maximum skill level a player can reach.
 
void SetInitialWorldSettings () override
 Initialize the World.
 
void LoadConfigSettings (bool reload=false) override
 Initialize config values.
 
bool IsShuttingDown () const override
 Are we in the middle of a shutdown?
 
uint32 GetShutDownTimeLeft () const override
 
void ShutdownServ (uint32 time, uint32 options, uint8 exitcode, std::string const &reason=std::string()) override
 Shutdown the server.
 
void ShutdownCancel () override
 Cancel a planned server shutdown.
 
void ShutdownMsg (bool show=false, Player *player=nullptr, std::string const &reason=std::string()) override
 Displays a shutdown message at specific intervals or immediately if required.
 
void Update (uint32 diff) override
 Update the World !
 
void setRate (ServerConfigs index, float value) override
 
float getRate (ServerConfigs index) const override
 
void setBoolConfig (ServerConfigs index, bool value) override
 
bool getBoolConfig (ServerConfigs index) const override
 
void setFloatConfig (ServerConfigs index, float value) override
 
float getFloatConfig (ServerConfigs index) const override
 
void setIntConfig (ServerConfigs index, uint32 value) override
 
uint32 getIntConfig (ServerConfigs index) const override
 
void setStringConfig (ServerConfigs index, std::string const &value) override
 
std::string_view getStringConfig (ServerConfigs index) const override
 
bool IsPvPRealm () const override
 Are we on a "Player versus Player" server?
 
bool IsFFAPvPRealm () const override
 
uint32 GetNextWhoListUpdateDelaySecs () override
 
void ProcessCliCommands () override
 
void QueueCliCommand (CliCommandHolder *commandHolder) override
 
void ForceGameEventUpdate () override
 
void UpdateRealmCharCount (uint32 accid) override
 
LocaleConstant GetAvailableDbcLocale (LocaleConstant locale) const override
 
void LoadDBVersion () override
 
char const * GetDBVersion () const override
 
void UpdateAreaDependentAuras () override
 
uint32 GetCleaningFlags () const override
 
void SetCleaningFlags (uint32 flags) override
 
void ResetEventSeasonalQuests (uint16 event_id) override
 
void ReloadRBAC () override
 
std::string const & GetRealmName () const override
 
void SetRealmName (std::string name) override
 
- Public Member Functions inherited from IWorld
virtual ~IWorld ()=default
 

Static Public Member Functions

static Worldinstance ()
 
static uint8 GetExitCode ()
 
static void StopNow (uint8 exitcode)
 
static bool IsStopped ()
 
static float GetMaxVisibleDistanceOnContinents ()
 
static float GetMaxVisibleDistanceInInstances ()
 
static float GetMaxVisibleDistanceInBGArenas ()
 

Static Public Attributes

static uint32 m_worldLoopCounter = 0
 

Protected Member Functions

void _UpdateGameTime ()
 Update the game time.
 
void _UpdateRealmCharCount (PreparedQueryResult resultCharCount, uint32 accountId)
 
void InitDailyQuestResetTime ()
 
void InitWeeklyQuestResetTime ()
 
void InitMonthlyQuestResetTime ()
 
void InitRandomBGResetTime ()
 
void InitCalendarOldEventsDeletionTime ()
 
void InitGuildResetTime ()
 
void ResetDailyQuests ()
 
void ResetWeeklyQuests ()
 
void ResetMonthlyQuests ()
 
void ResetRandomBG ()
 
void CalendarDeleteOldEvents ()
 
void ResetGuildCap ()
 

Private Member Functions

void DetectDBCLang ()
 
void ProcessQueryCallbacks ()
 
void FinalizePlayerWorldSession (WorldSession *session)
 Executed when a World Session is being finalized. Be it from a normal login or via queue popping.
 

Private Attributes

WorldConfig _worldConfig
 
uint32 _shutdownTimer
 
uint32 _shutdownMask
 
std::string _shutdownReason
 
uint32 _cleaningFlags
 
bool _isClosed
 
IntervalTimer _timers [WUPDATE_COUNT]
 
Seconds _mail_expire_check_timer
 
AccountTypes _allowedSecurityLevel
 
LocaleConstant _defaultDbcLocale
 
uint32 _availableDbcLocaleMask
 
bool _allowMovement
 
std::string _dataPath
 
std::string _realmName
 
LockedQueue< CliCommandHolder * > _cliCmdQueue
 
Seconds _nextDailyQuestReset
 
Seconds _nextWeeklyQuestReset
 
Seconds _nextMonthlyQuestReset
 
Seconds _nextRandomBGReset
 
Seconds _nextCalendarOldEventsDeletionTime
 
Seconds _nextGuildReset
 
std::string _dbVersion
 
uint32 _dbClientCacheVersion
 
QueryCallbackProcessor _queryProcessor
 

Static Private Attributes

static std::atomic_long _stopEvent = false
 
static uint8 _exitCode = SHUTDOWN_EXIT_CODE
 
static float _maxVisibleDistanceOnContinents = DEFAULT_VISIBILITY_DISTANCE
 
static float _maxVisibleDistanceInInstances = DEFAULT_VISIBILITY_INSTANCE
 
static float _maxVisibleDistanceInBGArenas = DEFAULT_VISIBILITY_BGARENAS
 

Detailed Description

The World.

Constructor & Destructor Documentation

◆ World()

World::World ( )

World constructor.

115{
117 _allowMovement = true;
118 _shutdownMask = 0;
119 _shutdownTimer = 0;
125 _nextGuildReset = 0s;
128 _isClosed = false;
129 _cleaningFlags = 0;
131}
@ LOCALE_enUS
Definition Common.h:118
@ SEC_PLAYER
Definition Common.h:57
Seconds _nextGuildReset
Definition World.h:299
uint32 _shutdownMask
Definition World.h:266
uint32 _cleaningFlags
Definition World.h:269
LocaleConstant _defaultDbcLocale
Definition World.h:277
Seconds _nextDailyQuestReset
Definition World.h:294
bool _isClosed
Definition World.h:271
uint32 _dbClientCacheVersion
Definition World.h:303
Seconds _nextMonthlyQuestReset
Definition World.h:296
Seconds _nextCalendarOldEventsDeletionTime
Definition World.h:298
Seconds _nextWeeklyQuestReset
Definition World.h:295
uint32 _shutdownTimer
Definition World.h:265
Seconds _nextRandomBGReset
Definition World.h:297
bool _allowMovement
Definition World.h:280
AccountTypes _allowedSecurityLevel
Definition World.h:276
Seconds _mail_expire_check_timer
Definition World.h:274

References _allowedSecurityLevel, _allowMovement, _cleaningFlags, _dbClientCacheVersion, _defaultDbcLocale, _isClosed, _mail_expire_check_timer, _nextCalendarOldEventsDeletionTime, _nextDailyQuestReset, _nextGuildReset, _nextMonthlyQuestReset, _nextRandomBGReset, _nextWeeklyQuestReset, _shutdownMask, _shutdownTimer, LOCALE_enUS, and SEC_PLAYER.

◆ ~World()

World::~World ( )
override

World destructor.

135{
136 CliCommandHolder* command = nullptr;
137 while (_cliCmdQueue.next(command))
138 delete command;
139
141}
bool next(T &result)
Gets the next item in the queue and removes it.
Definition LockedQueue.h:77
static void clear()
Definition VMapFactory.cpp:39
LockedQueue< CliCommandHolder * > _cliCmdQueue
Definition World.h:291
Storage class for commands issued for delayed execution.
Definition IWorld.h:35

References _cliCmdQueue, VMAP::VMapFactory::clear(), and LockedQueue< T, StorageType >::next().

Member Function Documentation

◆ _UpdateGameTime()

void World::_UpdateGameTime ( )
protected

Update the game time.

  • update the time
  • if there is a shutdown timer
  • ... and it is overdue, stop the world (set m_stopEvent)
  • ... else decrease it and if necessary display a shutdown countdown to the users
1437{
1439 Seconds lastGameTime = GameTime::GetGameTime();
1441
1442 Seconds elapsed = GameTime::GetGameTime() - lastGameTime;
1443
1445 if (!IsStopped() && _shutdownTimer > 0 && elapsed > 0s)
1446 {
1448 if (_shutdownTimer <= elapsed.count())
1449 {
1450 if (!(_shutdownMask & SHUTDOWN_MASK_IDLE) || sWorldSessionMgr->GetActiveAndQueuedSessionCount() == 0)
1451 _stopEvent = true; // exist code already set
1452 else
1453 _shutdownTimer = 1; // minimum timer value to wait idle state
1454 }
1456 else
1457 {
1458 _shutdownTimer -= elapsed.count();
1459
1460 ShutdownMsg();
1461 }
1462 }
1463}
std::chrono::seconds Seconds
Seconds shorthand typedef.
Definition Duration.h:30
#define sWorldSessionMgr
Definition WorldSessionMgr.h:108
void ShutdownMsg(bool show=false, Player *player=nullptr, std::string const &reason=std::string()) override
Displays a shutdown message at specific intervals or immediately if required.
Definition World.cpp:1508
static std::atomic_long _stopEvent
Definition World.h:263
static bool IsStopped()
Definition World.h:189
@ SHUTDOWN_MASK_IDLE
Definition World.h:48
void UpdateGameTimers()
Update all timers.
Definition GameTime.cpp:63
Seconds GetGameTime()
Definition GameTime.cpp:38

References _shutdownMask, _shutdownTimer, _stopEvent, GameTime::GetGameTime(), IsStopped(), SHUTDOWN_MASK_IDLE, ShutdownMsg(), sWorldSessionMgr, and GameTime::UpdateGameTimers().

Referenced by Update().

◆ _UpdateRealmCharCount()

void World::_UpdateRealmCharCount ( PreparedQueryResult  resultCharCount,
uint32  accountId 
)
protected
1584{
1585 uint8 charCount{0};
1586 if (resultCharCount)
1587 {
1588 Field* fields = resultCharCount->Fetch();
1589 charCount = uint8(fields[1].Get<uint64>());
1590 }
1591
1592 LoginDatabaseTransaction trans = LoginDatabase.BeginTransaction();
1593
1595 stmt->SetData(0, charCount);
1596 stmt->SetData(1, accountId);
1597 stmt->SetData(2, realm.Id.Realm);
1598 trans->Append(stmt);
1599
1600 LoginDatabase.CommitTransaction(trans);
1601}
SQLTransaction< LoginDatabaseConnection > LoginDatabaseTransaction
Definition DatabaseEnvFwd.h:70
DatabaseWorkerPool< LoginDatabaseConnection > LoginDatabase
Accessor to the realm/login database.
Definition DatabaseEnv.cpp:22
std::uint8_t uint8
Definition Define.h:109
@ LOGIN_REP_REALM_CHARACTERS
Definition LoginDatabase.h:63
Class used to access individual fields of database query result.
Definition Field.h:98
Acore::Types::is_default< T > SetData(const uint8 index, T value)
Definition PreparedStatement.h:77
Definition PreparedStatement.h:157
AC_GAME_API Realm realm
Definition World.cpp:111
uint32 Realm
Definition Realm.h:43
RealmHandle Id
Definition Realm.h:69

References Realm::Id, LOGIN_REP_REALM_CHARACTERS, LoginDatabase, realm, RealmHandle::Realm, and PreparedStatementBase::SetData().

Referenced by UpdateRealmCharCount().

◆ CalendarDeleteOldEvents()

void World::CalendarDeleteOldEvents ( )
protected
1777{
1778 LOG_INFO("server.worldserver", "Calendar deletion of old events.");
1779
1782 sCalendarMgr->DeleteOldEvents();
1783}
#define sCalendarMgr
Definition CalendarMgr.h:344
#define LOG_INFO(filterType__,...)
Definition Log.h:153
@ CONFIG_CALENDAR_DELETE_OLD_EVENTS_HOUR
Definition WorldConfig.h:307
@ WORLD_STATE_CUSTOM_DAILY_CALENDAR_DELETION_OLD_EVENTS_TIME
Definition WorldStateDefines.h:613
#define sWorldState
Definition WorldState.h:377
uint32 getIntConfig(ServerConfigs index) const override
Definition World.cpp:1367
AC_COMMON_API time_t GetNextTimeWithDayAndHour(int8 dayOfWeek, int8 hour)
Definition Timer.cpp:302

References _nextCalendarOldEventsDeletionTime, CONFIG_CALENDAR_DELETE_OLD_EVENTS_HOUR, getIntConfig(), Acore::Time::GetNextTimeWithDayAndHour(), LOG_INFO, sCalendarMgr, sWorldState, and WORLD_STATE_CUSTOM_DAILY_CALENDAR_DELETION_OLD_EVENTS_TIME.

Referenced by Update().

◆ DetectDBCLang()

void World::DetectDBCLang ( )
private
1059{
1060 uint8 m_lang_confid = sConfigMgr->GetOption<int32>("DBC.Locale", 255);
1061
1062 if (m_lang_confid != 255 && m_lang_confid >= TOTAL_LOCALES)
1063 {
1064 LOG_ERROR("server.loading", "Incorrect DBC.Locale! Must be >= 0 and < {} (set to 0)", TOTAL_LOCALES);
1065 m_lang_confid = LOCALE_enUS;
1066 }
1067
1068 ChrRacesEntry const* race = sChrRacesStore.LookupEntry(1);
1069 std::string availableLocalsStr;
1070
1071 uint8 default_locale = TOTAL_LOCALES;
1072 for (uint8 i = default_locale - 1; i < TOTAL_LOCALES; --i) // -1 will be 255 due to uint8
1073 {
1074 if (race->name[i][0] != '\0') // check by race names
1075 {
1076 default_locale = i;
1077 _availableDbcLocaleMask |= (1 << i);
1078 availableLocalsStr += localeNames[i];
1079 availableLocalsStr += " ";
1080 }
1081 }
1082
1083 if (default_locale != m_lang_confid && m_lang_confid < TOTAL_LOCALES &&
1084 (_availableDbcLocaleMask & (1 << m_lang_confid)))
1085 {
1086 default_locale = m_lang_confid;
1087 }
1088
1089 if (default_locale >= TOTAL_LOCALES)
1090 {
1091 LOG_ERROR("server.loading", "Unable to determine your DBC Locale! (corrupt DBC?)");
1092 exit(1);
1093 }
1094
1095 _defaultDbcLocale = LocaleConstant(default_locale);
1096
1097 LOG_INFO("server.loading", "Using {} DBC Locale As Default. All Available DBC locales: {}", localeNames[GetDefaultDbcLocale()], availableLocalsStr.empty() ? "<none>" : availableLocalsStr);
1098 LOG_INFO("server.loading", " ");
1099}
char const * localeNames[TOTAL_LOCALES]
Definition Common.cpp:20
LocaleConstant
Definition Common.h:117
@ TOTAL_LOCALES
Definition Common.h:128
DBCStorage< ChrRacesEntry > sChrRacesStore(ChrRacesEntryfmt)
std::int32_t int32
Definition Define.h:103
#define LOG_ERROR(filterType__,...)
Definition Log.h:145
uint32 _availableDbcLocaleMask
Definition World.h:278
LocaleConstant GetDefaultDbcLocale() const override
Definition World.h:161
#define sConfigMgr
Definition Config.h:93
Definition DBCStructure.h:679
char const * name[16]
Definition DBCStructure.h:691

References _availableDbcLocaleMask, _defaultDbcLocale, GetDefaultDbcLocale(), LOCALE_enUS, localeNames, LOG_ERROR, LOG_INFO, ChrRacesEntry::name, sChrRacesStore, sConfigMgr, and TOTAL_LOCALES.

Referenced by SetInitialWorldSettings().

◆ FinalizePlayerWorldSession()

void World::FinalizePlayerWorldSession ( WorldSession session)
inlineprivate

Executed when a World Session is being finalized. Be it from a normal login or via queue popping.

Parameters
sessionThe World Session that we are finalizing.

◆ ForceGameEventUpdate()

void World::ForceGameEventUpdate ( )
overridevirtual

Implements IWorld.

1383{
1384 _timers[WUPDATE_EVENTS].Reset(); // to give time for Update() to be processed
1385 uint32 nextGameEvent = sGameEventMgr->Update();
1386 _timers[WUPDATE_EVENTS].SetInterval(nextGameEvent);
1388}
std::uint32_t uint32
Definition Define.h:107
#define sGameEventMgr
Definition GameEventMgr.h:201
IntervalTimer _timers[WUPDATE_COUNT]
Definition World.h:273
@ WUPDATE_EVENTS
Definition World.h:62
void SetInterval(time_t interval)
Definition Timer.h:179
void Reset()
Definition Timer.h:166

References _timers, IntervalTimer::Reset(), IntervalTimer::SetInterval(), sGameEventMgr, and WUPDATE_EVENTS.

◆ getAllowMovement()

bool World::getAllowMovement ( ) const
inlineoverridevirtual
Todo:
Actions on m_allowMovement still to be implemented Is movement allowed?

Implements IWorld.

157{ return _allowMovement; }

References _allowMovement.

◆ GetAvailableDbcLocale()

LocaleConstant World::GetAvailableDbcLocale ( LocaleConstant  locale) const
inlineoverridevirtual

Implements IWorld.

227{ if (_availableDbcLocaleMask & (1 << locale)) return locale; else return _defaultDbcLocale; }

References _availableDbcLocaleMask, and _defaultDbcLocale.

◆ getBoolConfig()

bool World::getBoolConfig ( ServerConfigs  index) const
overridevirtual

Implements IWorld.

1348{
1349 return _worldConfig.GetConfigValue<bool>(index);
1350}
T GetConfigValue(ConfigEnum const config) const
Definition ConfigValueCache.h:97
WorldConfig _worldConfig
Definition World.h:261

References _worldConfig, and ConfigValueCache< ConfigEnum >::GetConfigValue().

Referenced by LoadConfigSettings(), SetInitialWorldSettings(), and Update().

◆ GetCleaningFlags()

uint32 World::GetCleaningFlags ( ) const
inlineoverridevirtual

Implements IWorld.

235{ return _cleaningFlags; }

References _cleaningFlags.

◆ GetConfigMaxSkillValue()

uint16 World::GetConfigMaxSkillValue ( ) const
inlineoverridevirtual

Get the maximum skill level a player can reach.

Implements IWorld.

173 {
175 return lvl > 60 ? 300 + ((lvl - 60) * 75) / 10 : lvl * 5;
176 }
std::uint16_t uint16
Definition Define.h:108
@ CONFIG_MAX_PLAYER_LEVEL
Definition WorldConfig.h:189

References CONFIG_MAX_PLAYER_LEVEL, and getIntConfig().

◆ GetDataPath()

std::string const & World::GetDataPath ( ) const
inlineoverridevirtual

Get the path where data (dbc, maps) are stored on disk.

Implements IWorld.

164{ return _dataPath; }
std::string _dataPath
Definition World.h:281

References _dataPath.

◆ GetDBVersion()

char const * World::GetDBVersion ( ) const
inlineoverridevirtual

Implements IWorld.

231{ return _dbVersion.c_str(); }
std::string _dbVersion
Definition World.h:302

References _dbVersion.

◆ GetDefaultDbcLocale()

LocaleConstant World::GetDefaultDbcLocale ( ) const
inlineoverridevirtual

Implements IWorld.

161{ return _defaultDbcLocale; }

References _defaultDbcLocale.

Referenced by DetectDBCLang(), and SetInitialWorldSettings().

◆ GetExitCode()

static uint8 World::GetExitCode ( )
inlinestatic
187{ return _exitCode; }
static uint8 _exitCode
Definition World.h:264

References _exitCode.

Referenced by main().

◆ getFloatConfig()

float World::getFloatConfig ( ServerConfigs  index) const
overridevirtual

Implements IWorld.

1358{
1359 return _worldConfig.GetConfigValue<float>(index);
1360}

References _worldConfig, and ConfigValueCache< ConfigEnum >::GetConfigValue().

Referenced by getRate().

◆ getIntConfig()

◆ GetMaxVisibleDistanceInBGArenas()

static float World::GetMaxVisibleDistanceInBGArenas ( )
inlinestatic
static float _maxVisibleDistanceInBGArenas
Definition World.h:286

References _maxVisibleDistanceInBGArenas.

Referenced by Battleground::_ProcessJoin(), and BattlegroundMap::InitVisibilityDistance().

◆ GetMaxVisibleDistanceInInstances()

static float World::GetMaxVisibleDistanceInInstances ( )
inlinestatic
static float _maxVisibleDistanceInInstances
Definition World.h:285

References _maxVisibleDistanceInInstances.

Referenced by InstanceMap::InitVisibilityDistance().

◆ GetMaxVisibleDistanceOnContinents()

static float World::GetMaxVisibleDistanceOnContinents ( )
inlinestatic
static float _maxVisibleDistanceOnContinents
Definition World.h:284

References _maxVisibleDistanceOnContinents.

Referenced by Map::InitVisibilityDistance().

◆ GetNextDailyQuestsResetTime()

Seconds World::GetNextDailyQuestsResetTime ( ) const
inlineoverridevirtual

Next daily quests and random bg reset time.

Implements IWorld.

167{ return _nextDailyQuestReset; }

References _nextDailyQuestReset.

◆ GetNextRandomBGResetTime()

Seconds World::GetNextRandomBGResetTime ( ) const
inlineoverridevirtual

Implements IWorld.

169{ return _nextRandomBGReset; }

References _nextRandomBGReset.

◆ GetNextWeeklyQuestsResetTime()

Seconds World::GetNextWeeklyQuestsResetTime ( ) const
inlineoverridevirtual

Implements IWorld.

168{ return _nextWeeklyQuestReset; }

References _nextWeeklyQuestReset.

◆ GetNextWhoListUpdateDelaySecs()

uint32 World::GetNextWhoListUpdateDelaySecs ( )
overridevirtual

Implements IWorld.

1839{
1840 if (_timers[WUPDATE_5_SECS].Passed())
1841 return 1;
1842
1844 t = std::min(t, (uint32)_timers[WUPDATE_5_SECS].GetInterval());
1845
1846 return uint32(std::ceil(t / 1000.0f));
1847}
@ WUPDATE_5_SECS
Definition World.h:67
time_t GetCurrent() const
Definition Timer.h:189
time_t GetInterval() const
Definition Timer.h:184

References _timers, IntervalTimer::GetCurrent(), IntervalTimer::GetInterval(), and WUPDATE_5_SECS.

◆ GetPlayerSecurityLimit()

AccountTypes World::GetPlayerSecurityLimit ( ) const
inlineoverridevirtual

Security level limitations.

Implements IWorld.

151{ return _allowedSecurityLevel; }

References _allowedSecurityLevel.

◆ getRate()

float World::getRate ( ServerConfigs  index) const
overridevirtual

Implements IWorld.

1338{
1339 return getFloatConfig(index);
1340}
float getFloatConfig(ServerConfigs index) const override
Definition World.cpp:1357

References getFloatConfig().

Referenced by LoadConfigSettings().

◆ GetRealmName()

std::string const & World::GetRealmName ( ) const
inlineoverridevirtual

Implements IWorld.

240{ return _realmName; } // pussywizard
std::string _realmName
Definition World.h:288

References _realmName.

◆ GetShutDownTimeLeft()

uint32 World::GetShutDownTimeLeft ( ) const
inlineoverridevirtual

Implements IWorld.

183{ return _shutdownTimer; }

References _shutdownTimer.

◆ getStringConfig()

std::string_view World::getStringConfig ( ServerConfigs  index) const
overridevirtual

Implements IWorld.

1378{
1379 return _worldConfig.GetConfigValue(index);
1380}

References _worldConfig, and ConfigValueCache< ConfigEnum >::GetConfigValue().

◆ InitCalendarOldEventsDeletionTime()

void World::InitCalendarOldEventsDeletionTime ( )
protected
1648{
1650 Seconds nextDeletionTime = currentDeletionTime > 0s ? currentDeletionTime : Seconds(Acore::Time::GetNextTimeWithDayAndHour(-1, getIntConfig(CONFIG_CALENDAR_DELETE_OLD_EVENTS_HOUR)));
1651
1652 if (currentDeletionTime == 0s)
1653 {
1654 sWorldState->setWorldState(WORLD_STATE_CUSTOM_DAILY_CALENDAR_DELETION_OLD_EVENTS_TIME, nextDeletionTime.count());
1655 }
1656}

References CONFIG_CALENDAR_DELETE_OLD_EVENTS_HOUR, getIntConfig(), Acore::Time::GetNextTimeWithDayAndHour(), sWorldState, and WORLD_STATE_CUSTOM_DAILY_CALENDAR_DELETION_OLD_EVENTS_TIME.

Referenced by SetInitialWorldSettings().

◆ InitDailyQuestResetTime()

void World::InitDailyQuestResetTime ( )
protected
1615{
1618
1619 if (wstime == 0s)
1620 {
1622 }
1623}
@ WORLD_STATE_CUSTOM_DAILY_QUEST_RESET_TIME
Definition WorldStateDefines.h:610

References _nextDailyQuestReset, Acore::Time::GetNextTimeWithDayAndHour(), sWorldState, and WORLD_STATE_CUSTOM_DAILY_QUEST_RESET_TIME.

Referenced by SetInitialWorldSettings().

◆ InitGuildResetTime()

void World::InitGuildResetTime ( )
protected
1659{
1661 _nextGuildReset = wstime > 0s ? wstime : Seconds(Acore::Time::GetNextTimeWithDayAndHour(-1, 6));
1662
1663 if (wstime == 0s)
1664 {
1666 }
1667}
@ WORLD_STATE_CUSTOM_GUILD_DAILY_RESET_TIME
Definition WorldStateDefines.h:611

References _nextGuildReset, Acore::Time::GetNextTimeWithDayAndHour(), sWorldState, and WORLD_STATE_CUSTOM_GUILD_DAILY_RESET_TIME.

Referenced by SetInitialWorldSettings().

◆ InitMonthlyQuestResetTime()

void World::InitMonthlyQuestResetTime ( )
protected
1626{
1629
1630 if (wstime == 0s)
1631 {
1633 }
1634}
@ WORLD_STATE_CUSTOM_MONTHLY_QUEST_RESET_TIME
Definition WorldStateDefines.h:612

References _nextMonthlyQuestReset, Acore::Time::GetNextTimeWithDayAndHour(), sWorldState, and WORLD_STATE_CUSTOM_MONTHLY_QUEST_RESET_TIME.

Referenced by SetInitialWorldSettings().

◆ InitRandomBGResetTime()

void World::InitRandomBGResetTime ( )
protected
1637{
1639 _nextRandomBGReset = wstime > 0s ? wstime : Seconds(Acore::Time::GetNextTimeWithDayAndHour(-1, 6));
1640
1641 if (wstime == 0s)
1642 {
1644 }
1645}
@ WORLD_STATE_CUSTOM_BG_DAILY_RESET_TIME
Definition WorldStateDefines.h:608

References _nextRandomBGReset, Acore::Time::GetNextTimeWithDayAndHour(), sWorldState, and WORLD_STATE_CUSTOM_BG_DAILY_RESET_TIME.

Referenced by SetInitialWorldSettings().

◆ InitWeeklyQuestResetTime()

void World::InitWeeklyQuestResetTime ( )
protected
1604{
1607
1608 if (wstime == 0s)
1609 {
1611 }
1612}
@ WORLD_STATE_CUSTOM_WEEKLY_QUEST_RESET_TIME
Definition WorldStateDefines.h:607

References _nextWeeklyQuestReset, Acore::Time::GetNextTimeWithDayAndHour(), sWorldState, and WORLD_STATE_CUSTOM_WEEKLY_QUEST_RESET_TIME.

Referenced by SetInitialWorldSettings().

◆ instance()

static World * World::instance ( )
static

◆ IsClosed()

bool World::IsClosed ( ) const
overridevirtual

Deny clients?

Implements IWorld.

150{
151 return _isClosed;
152}

References _isClosed.

◆ IsFFAPvPRealm()

bool World::IsFFAPvPRealm ( ) const
overridevirtual

Implements IWorld.

1834{
1836}
@ REALM_TYPE_FFA_PVP
Definition Realm.h:62
@ CONFIG_GAME_TYPE
Definition WorldConfig.h:171

References CONFIG_GAME_TYPE, getIntConfig(), and REALM_TYPE_FFA_PVP.

Referenced by SetInitialWorldSettings().

◆ IsPvPRealm()

bool World::IsPvPRealm ( ) const
overridevirtual

Are we on a "Player versus Player" server?

Implements IWorld.

1829{
1831}
@ REALM_TYPE_RPPVP
Definition Realm.h:58
@ REALM_TYPE_PVP
Definition Realm.h:55

References CONFIG_GAME_TYPE, getIntConfig(), REALM_TYPE_FFA_PVP, REALM_TYPE_PVP, and REALM_TYPE_RPPVP.

◆ IsShuttingDown()

bool World::IsShuttingDown ( ) const
inlineoverridevirtual

Are we in the middle of a shutdown?

Implements IWorld.

182{ return _shutdownTimer > 0; }

References _shutdownTimer.

◆ IsStopped()

static bool World::IsStopped ( )
inlinestatic

◆ LoadConfigSettings()

void World::LoadConfigSettings ( bool  reload = false)
overridevirtual

Initialize config values.

  • Read the player limit and the Message of the day from the config file
  • Read the "Data" directory from the config file

Implements IWorld.

164{
165 if (reload)
166 {
167 if (!sConfigMgr->Reload())
168 {
169 LOG_ERROR("server.loading", "World settings reload fail: can't read settings.");
170 return;
171 }
172
173 sLog->LoadFromConfig();
174 sMetric->LoadFromConfigs();
175 }
176
177 // Set realm id and enable db logging
178 sLog->SetRealmId(realm.Id.Realm);
179
180 sScriptMgr->OnBeforeConfigLoad(reload);
181
182 // load update time related configs
184
186 if (!reload)
187 sWorldSessionMgr->SetPlayerAmountLimit(sConfigMgr->GetOption<int32>("PlayerLimit", 1000));
188
189 _worldConfig.Initialize(reload);
190
191 for (uint8 i = 0; i < MAX_MOVE_TYPE; ++i)
193
194 for (uint8 i = 0; i < MAX_MOVE_TYPE; ++i)
196
197 if (reload)
198 {
199 sMapMgr->SetMapUpdateInterval(getIntConfig(CONFIG_INTERVAL_MAPUPDATE));
200
203
206
209 }
210
212 {
214 LOG_INFO("server.loading", "Client cache version set to: {}", _dbClientCacheVersion);
215 }
216
217 //visibility on continents
218 _maxVisibleDistanceOnContinents = sConfigMgr->GetOption<float>("Visibility.Distance.Continents", DEFAULT_VISIBILITY_DISTANCE);
220 {
221 LOG_ERROR("server.loading", "Visibility.Distance.Continents can't be less max aggro radius {}", 45 * getRate(RATE_CREATURE_AGGRO));
223 }
225 {
226 LOG_ERROR("server.loading", "Visibility.Distance.Continents can't be greater {}", MAX_VISIBILITY_DISTANCE);
228 }
229
230 //visibility in instances
231 _maxVisibleDistanceInInstances = sConfigMgr->GetOption<float>("Visibility.Distance.Instances", DEFAULT_VISIBILITY_INSTANCE);
233 {
234 LOG_ERROR("server.loading", "Visibility.Distance.Instances can't be less max aggro radius {}", 45 * getRate(RATE_CREATURE_AGGRO));
236 }
238 {
239 LOG_ERROR("server.loading", "Visibility.Distance.Instances can't be greater {}", MAX_VISIBILITY_DISTANCE);
241 }
242
243 //visibility in BG/Arenas
244 _maxVisibleDistanceInBGArenas = sConfigMgr->GetOption<float>("Visibility.Distance.BGArenas", DEFAULT_VISIBILITY_BGARENAS);
246 {
247 LOG_ERROR("server.loading", "Visibility.Distance.BGArenas can't be less max aggro radius {}", 45 * getRate(RATE_CREATURE_AGGRO));
249 }
251 {
252 LOG_ERROR("server.loading", "Visibility.Distance.BGArenas can't be greater {}", MAX_VISIBILITY_DISTANCE);
254 }
255
256 LOG_INFO("server.loading", "Will clear `logs` table of entries older than {} seconds every {} minutes.",
258
260 std::string dataPath = sConfigMgr->GetOption<std::string>("DataDir", "./");
261 if (dataPath.empty() || (dataPath.at(dataPath.length() - 1) != '/' && dataPath.at(dataPath.length() - 1) != '\\'))
262 dataPath.push_back('/');
263
264#if AC_PLATFORM == AC_PLATFORM_UNIX || AC_PLATFORM == AC_PLATFORM_APPLE
265 if (dataPath[0] == '~')
266 {
267 const char* home = getenv("HOME");
268 if (home)
269 dataPath.replace(0, 1, home);
270 }
271#endif
272
273 if (reload)
274 {
275 if (dataPath != _dataPath)
276 LOG_ERROR("server.loading", "DataDir option can't be changed at worldserver.conf reload, using current value ({}).", _dataPath);
277 }
278 else
279 {
280 _dataPath = dataPath;
281 LOG_INFO("server.loading", "Using DataDir {}", _dataPath);
282 }
283
284 bool const enableIndoor = getBoolConfig(CONFIG_VMAP_INDOOR_CHECK);
285 bool const enableLOS = getBoolConfig(CONFIG_VMAP_ENABLE_LOS);
286 bool const enablePetLOS = getBoolConfig(CONFIG_PET_LOS);
287 bool const enableHeight = getBoolConfig(CONFIG_VMAP_ENABLE_HEIGHT);
288 if (!enableHeight)
289 LOG_ERROR("server.loading", "VMap height checking disabled! Creatures movements and other various things WILL be broken! Expect no support.");
290
293 LOG_INFO("server.loading", "WORLD: VMap support included. LineOfSight:{}, getHeight:{}, indoorCheck:{} PetLOS:{}", enableLOS, enableHeight, enableIndoor, enablePetLOS);
294
295 // call ScriptMgr if we're reloading the configuration
296 sScriptMgr->OnAfterConfigLoad(reload);
297}
constexpr auto IN_MILLISECONDS
Definition Common.h:53
constexpr auto MINUTE
Definition Common.h:47
#define sLog
Definition Log.h:127
#define sMapMgr
Definition MapMgr.h:220
#define sMetric
Definition Metric.h:134
#define MAX_VISIBILITY_DISTANCE
Definition ObjectDefines.h:30
#define DEFAULT_VISIBILITY_DISTANCE
Definition ObjectDefines.h:39
#define DEFAULT_VISIBILITY_BGARENAS
Definition ObjectDefines.h:42
#define DEFAULT_VISIBILITY_INSTANCE
Definition ObjectDefines.h:40
#define sScriptMgr
Definition ScriptMgr.h:740
#define MAX_MOVE_TYPE
Definition UnitDefines.h:367
float baseMoveSpeed[MAX_MOVE_TYPE]
Definition Unit.cpp:79
float playerBaseMoveSpeed[MAX_MOVE_TYPE]
Definition Unit.cpp:92
WorldUpdateTime sWorldUpdateTime
Definition UpdateTime.cpp:27
@ CONFIG_VMAP_ENABLE_LOS
Definition WorldConfig.h:79
@ CONFIG_CLIENTCACHE_VERSION
Definition WorldConfig.h:302
@ RATE_CREATURE_AGGRO
Definition WorldConfig.h:468
@ CONFIG_VMAP_ENABLE_HEIGHT
Definition WorldConfig.h:80
@ CONFIG_LOGDB_CLEARTIME
Definition WorldConfig.h:300
@ CONFIG_AUTOBROADCAST_INTERVAL
Definition WorldConfig.h:313
@ RATE_MOVESPEED_PLAYER
Definition WorldConfig.h:491
@ RATE_MOVESPEED_NPC
Definition WorldConfig.h:492
@ CONFIG_VMAP_INDOOR_CHECK
Definition WorldConfig.h:78
@ CONFIG_LOGDB_CLEARINTERVAL
Definition WorldConfig.h:299
@ CONFIG_UPTIME_UPDATE
Definition WorldConfig.h:216
@ CONFIG_INTERVAL_MAPUPDATE
Definition WorldConfig.h:164
@ CONFIG_PET_LOS
Definition WorldConfig.h:81
void Initialize(bool reload)
Definition ConfigValueCache.h:45
void OverwriteConfigValue(ConfigEnum const config, T const &value)
Definition ConfigValueCache.h:86
void setEnableHeightCalc(bool pVal)
Definition IVMapMgr.h:109
void setEnableLineOfSightCalc(bool pVal)
Definition IVMapMgr.h:104
static VMapMgr2 * createOrGetVMapMgr()
Definition VMapFactory.cpp:27
void LoadFromConfig()
Definition UpdateTime.cpp:152
bool getBoolConfig(ServerConfigs index) const override
Definition World.cpp:1347
float getRate(ServerConfigs index) const override
Definition World.cpp:1337
@ WUPDATE_CLEANDB
Definition World.h:63
@ WUPDATE_AUTOBROADCAST
Definition World.h:64
@ WUPDATE_UPTIME
Definition World.h:61

References _dataPath, _dbClientCacheVersion, _maxVisibleDistanceInBGArenas, _maxVisibleDistanceInInstances, _maxVisibleDistanceOnContinents, _timers, _worldConfig, baseMoveSpeed, CONFIG_AUTOBROADCAST_INTERVAL, CONFIG_CLIENTCACHE_VERSION, CONFIG_INTERVAL_MAPUPDATE, CONFIG_LOGDB_CLEARINTERVAL, CONFIG_LOGDB_CLEARTIME, CONFIG_PET_LOS, CONFIG_UPTIME_UPDATE, CONFIG_VMAP_ENABLE_HEIGHT, CONFIG_VMAP_ENABLE_LOS, CONFIG_VMAP_INDOOR_CHECK, VMAP::VMapFactory::createOrGetVMapMgr(), DEFAULT_VISIBILITY_BGARENAS, DEFAULT_VISIBILITY_DISTANCE, DEFAULT_VISIBILITY_INSTANCE, getBoolConfig(), getIntConfig(), getRate(), Realm::Id, IN_MILLISECONDS, ConfigValueCache< ConfigEnum >::Initialize(), WorldUpdateTime::LoadFromConfig(), LOG_ERROR, LOG_INFO, MAX_MOVE_TYPE, MAX_VISIBILITY_DISTANCE, MINUTE, ConfigValueCache< ConfigEnum >::OverwriteConfigValue(), playerBaseMoveSpeed, RATE_CREATURE_AGGRO, RATE_MOVESPEED_NPC, RATE_MOVESPEED_PLAYER, realm, RealmHandle::Realm, IntervalTimer::Reset(), sConfigMgr, VMAP::IVMapMgr::setEnableHeightCalc(), VMAP::IVMapMgr::setEnableLineOfSightCalc(), IntervalTimer::SetInterval(), sLog, sMapMgr, sMetric, sScriptMgr, sWorldSessionMgr, sWorldUpdateTime, WUPDATE_AUTOBROADCAST, WUPDATE_CLEANDB, and WUPDATE_UPTIME.

Referenced by SetInitialWorldSettings().

◆ LoadDBAllowedSecurityLevel()

void World::LoadDBAllowedSecurityLevel ( )
overridevirtual

Implements IWorld.

1687{
1689 stmt->SetData(0, int32(realm.Id.Realm));
1690 PreparedQueryResult result = LoginDatabase.Query(stmt);
1691
1692 if (result)
1693 SetPlayerSecurityLimit(AccountTypes(result->Fetch()->Get<uint8>()));
1694}
AccountTypes
Definition Common.h:56
std::shared_ptr< PreparedResultSet > PreparedQueryResult
Definition DatabaseEnvFwd.h:45
@ LOGIN_SEL_REALMLIST_SECURITY_LEVEL
Definition LoginDatabase.h:99
void SetPlayerSecurityLimit(AccountTypes sec) override
Definition World.cpp:1696

References Realm::Id, LOGIN_SEL_REALMLIST_SECURITY_LEVEL, LoginDatabase, realm, RealmHandle::Realm, PreparedStatementBase::SetData(), and SetPlayerSecurityLimit().

Referenced by SetInitialWorldSettings().

◆ LoadDBVersion()

void World::LoadDBVersion ( )
overridevirtual

Implements IWorld.

1796{
1797 QueryResult result = WorldDatabase.Query("SELECT db_version, cache_id FROM version LIMIT 1");
1798 if (result)
1799 {
1800 Field* fields = result->Fetch();
1801
1802 _dbVersion = fields[0].Get<std::string>();
1803
1804 // will be overwrite by config values if different and non-0
1805 _dbClientCacheVersion = fields[1].Get<uint32>();
1806 }
1807
1808 if (_dbVersion.empty())
1809 _dbVersion = "Unknown world database.";
1810}
std::shared_ptr< ResultSet > QueryResult
Definition DatabaseEnvFwd.h:27
DatabaseWorkerPool< WorldDatabaseConnection > WorldDatabase
Accessor to the world database.
Definition DatabaseEnv.cpp:20
std::enable_if_t< std::is_arithmetic_v< T >, T > Get() const
Definition Field.h:112

References _dbClientCacheVersion, _dbVersion, Field::Get(), and WorldDatabase.

◆ ProcessCliCommands()

void World::ProcessCliCommands ( )
overridevirtual

Implements IWorld.

1559{
1560 CliCommandHolder::Print zprint = nullptr;
1561 void* callbackArg = nullptr;
1562 CliCommandHolder* command = nullptr;
1563 while (_cliCmdQueue.next(command))
1564 {
1565 LOG_DEBUG("server.worldserver", "CLI command under processing...");
1566 zprint = command->m_print;
1567 callbackArg = command->m_callbackArg;
1568 CliHandler handler(callbackArg, zprint);
1569 handler.ParseCommands(command->m_command);
1570 if (command->m_commandFinished)
1571 command->m_commandFinished(callbackArg, !handler.HasSentErrorMessage());
1572 delete command;
1573 }
1574}
#define LOG_DEBUG(filterType__,...)
Definition Log.h:157
Definition Chat.h:256
CommandFinished m_commandFinished
Definition IWorld.h:42
void * m_callbackArg
Definition IWorld.h:39
Print m_print
Definition IWorld.h:41
void(*)(void *, std::string_view) Print
Definition IWorld.h:36
char * m_command
Definition IWorld.h:40

References _cliCmdQueue, ChatHandler::HasSentErrorMessage(), LOG_DEBUG, CliCommandHolder::m_callbackArg, CliCommandHolder::m_command, CliCommandHolder::m_commandFinished, CliCommandHolder::m_print, LockedQueue< T, StorageType >::next(), and CliHandler::ParseCommands().

Referenced by Update().

◆ ProcessQueryCallbacks()

void World::ProcessQueryCallbacks ( )
private
1824{
1826}
void ProcessReadyCallbacks()
Definition AsyncCallbackProcessor.h:40
QueryCallbackProcessor _queryProcessor
Definition World.h:306

References _queryProcessor, and AsyncCallbackProcessor< T >::ProcessReadyCallbacks().

Referenced by Update().

◆ QueueCliCommand()

void World::QueueCliCommand ( CliCommandHolder commandHolder)
inlineoverridevirtual

Implements IWorld.

221{ _cliCmdQueue.add(commandHolder); }
void add(const T &item)
Adds an item to the back of the queue.
Definition LockedQueue.h:52

References _cliCmdQueue, and LockedQueue< T, StorageType >::add().

◆ ReloadRBAC()

void World::ReloadRBAC ( )
overridevirtual

Implements IWorld.

1751{
1752 // Passive reload, we mark the data as invalidated and next time a permission is checked it will be reloaded
1753 LOG_INFO("rbac", "World::ReloadRBAC()");
1754 WorldSessionMgr::SessionMap const& sessionMap = sWorldSessionMgr->GetAllSessions();
1755 for (WorldSessionMgr::SessionMap::const_iterator itr = sessionMap.begin(); itr != sessionMap.end(); ++itr)
1756 if (WorldSession* session = itr->second)
1757 session->InvalidateRBACData();
1758}
std::unordered_map< uint32, WorldSession * > SessionMap
Definition WorldSessionMgr.h:56
Player session in the World.
Definition WorldSession.h:384

References LOG_INFO, and sWorldSessionMgr.

◆ ResetDailyQuests()

void World::ResetDailyQuests ( )
protected
1670{
1672 CharacterDatabase.Execute(stmt);
1673
1674 WorldSessionMgr::SessionMap const& sessionMap = sWorldSessionMgr->GetAllSessions();
1675 for (WorldSessionMgr::SessionMap::const_iterator itr = sessionMap.begin(); itr != sessionMap.end(); ++itr)
1676 if (itr->second->GetPlayer())
1677 itr->second->GetPlayer()->ResetDailyQuestStatus();
1678
1681
1682 // change available dailies
1683 sPoolMgr->ChangeDailyQuests();
1684}
@ CHAR_DEL_QUEST_STATUS_DAILY
Definition CharacterDatabase.h:55
DatabaseWorkerPool< CharacterDatabaseConnection > CharacterDatabase
Accessor to the character database.
Definition DatabaseEnv.cpp:21
#define sPoolMgr
Definition PoolMgr.h:177

References _nextDailyQuestReset, CHAR_DEL_QUEST_STATUS_DAILY, CharacterDatabase, Acore::Time::GetNextTimeWithDayAndHour(), sPoolMgr, sWorldSessionMgr, sWorldState, and WORLD_STATE_CUSTOM_DAILY_QUEST_RESET_TIME.

Referenced by Update().

◆ ResetEventSeasonalQuests()

void World::ResetEventSeasonalQuests ( uint16  event_id)
overridevirtual

Implements IWorld.

1739{
1741 stmt->SetData(0, event_id);
1742 CharacterDatabase.Execute(stmt);
1743
1744 WorldSessionMgr::SessionMap const& sessionMap = sWorldSessionMgr->GetAllSessions();
1745 for (WorldSessionMgr::SessionMap::const_iterator itr = sessionMap.begin(); itr != sessionMap.end(); ++itr)
1746 if (itr->second->GetPlayer())
1747 itr->second->GetPlayer()->ResetSeasonalQuestStatus(event_id);
1748}
@ CHAR_DEL_QUEST_STATUS_SEASONAL
Definition CharacterDatabase.h:58

References CHAR_DEL_QUEST_STATUS_SEASONAL, CharacterDatabase, PreparedStatementBase::SetData(), and sWorldSessionMgr.

◆ ResetGuildCap()

void World::ResetGuildCap ( )
protected
1786{
1787 LOG_INFO("server.worldserver", "Guild Daily Cap reset.");
1788
1791
1792 sGuildMgr->ResetTimes();
1793}
#define sGuildMgr
Definition GuildMgr.h:51

References _nextGuildReset, Acore::Time::GetNextTimeWithDayAndHour(), LOG_INFO, sGuildMgr, sWorldState, and WORLD_STATE_CUSTOM_GUILD_DAILY_RESET_TIME.

Referenced by Update().

◆ ResetMonthlyQuests()

void World::ResetMonthlyQuests ( )
protected
1723{
1724 LOG_INFO("server.worldserver", "Monthly quests reset for all characters.");
1725
1727 CharacterDatabase.Execute(stmt);
1728
1729 WorldSessionMgr::SessionMap const& sessionMap = sWorldSessionMgr->GetAllSessions();
1730 for (WorldSessionMgr::SessionMap::const_iterator itr = sessionMap.begin(); itr != sessionMap.end(); ++itr)
1731 if (itr->second->GetPlayer())
1732 itr->second->GetPlayer()->ResetMonthlyQuestStatus();
1733
1736}
@ CHAR_DEL_QUEST_STATUS_MONTHLY
Definition CharacterDatabase.h:57
AC_COMMON_API time_t GetNextTimeWithMonthAndHour(int8 month, int8 hour)
Definition Timer.cpp:333

References _nextMonthlyQuestReset, CHAR_DEL_QUEST_STATUS_MONTHLY, CharacterDatabase, Acore::Time::GetNextTimeWithMonthAndHour(), LOG_INFO, sWorldSessionMgr, sWorldState, and WORLD_STATE_CUSTOM_MONTHLY_QUEST_RESET_TIME.

Referenced by Update().

◆ ResetRandomBG()

void World::ResetRandomBG ( )
protected
1761{
1762 LOG_DEBUG("server.worldserver", "Random BG status reset for all characters.");
1763
1765 CharacterDatabase.Execute(stmt);
1766
1767 WorldSessionMgr::SessionMap const& sessionMap = sWorldSessionMgr->GetAllSessions();
1768 for (WorldSessionMgr::SessionMap::const_iterator itr = sessionMap.begin(); itr != sessionMap.end(); ++itr)
1769 if (itr->second->GetPlayer())
1770 itr->second->GetPlayer()->SetRandomWinner(false);
1771
1774}
@ CHAR_DEL_BATTLEGROUND_RANDOM
Definition CharacterDatabase.h:63

References _nextRandomBGReset, CHAR_DEL_BATTLEGROUND_RANDOM, CharacterDatabase, Acore::Time::GetNextTimeWithDayAndHour(), LOG_DEBUG, sWorldSessionMgr, sWorldState, and WORLD_STATE_CUSTOM_BG_DAILY_RESET_TIME.

Referenced by Update().

◆ ResetWeeklyQuests()

void World::ResetWeeklyQuests ( )
protected
1706{
1708 CharacterDatabase.Execute(stmt);
1709
1710 WorldSessionMgr::SessionMap const& sessionMap = sWorldSessionMgr->GetAllSessions();
1711 for (WorldSessionMgr::SessionMap::const_iterator itr = sessionMap.begin(); itr != sessionMap.end(); ++itr)
1712 if (itr->second->GetPlayer())
1713 itr->second->GetPlayer()->ResetWeeklyQuestStatus();
1714
1717
1718 // change available weeklies
1719 sPoolMgr->ChangeWeeklyQuests();
1720}
@ CHAR_DEL_QUEST_STATUS_WEEKLY
Definition CharacterDatabase.h:56

References _nextWeeklyQuestReset, CHAR_DEL_QUEST_STATUS_WEEKLY, CharacterDatabase, Acore::Time::GetNextTimeWithDayAndHour(), sPoolMgr, sWorldSessionMgr, sWorldState, and WORLD_STATE_CUSTOM_WEEKLY_QUEST_RESET_TIME.

Referenced by Update().

◆ SetAllowMovement()

void World::SetAllowMovement ( bool  allow)
inlineoverridevirtual

Allow/Disallow object movements.

Implements IWorld.

159{ _allowMovement = allow; }

References _allowMovement.

◆ setBoolConfig()

void World::setBoolConfig ( ServerConfigs  index,
bool  value 
)
overridevirtual

Implements IWorld.

1343{
1344 _worldConfig.OverwriteConfigValue<bool>(index, value);
1345}

References _worldConfig, and ConfigValueCache< ConfigEnum >::OverwriteConfigValue().

◆ SetCleaningFlags()

void World::SetCleaningFlags ( uint32  flags)
inlineoverridevirtual

Implements IWorld.

236{ _cleaningFlags = flags; }

References _cleaningFlags.

◆ SetClosed()

void World::SetClosed ( bool  val)
overridevirtual

Close world.

Implements IWorld.

155{
156 _isClosed = val;
157
158 // Invert the value, for simplicity for scripters.
159 sScriptMgr->OnOpenStateChange(!val);
160}

References _isClosed, and sScriptMgr.

◆ setFloatConfig()

void World::setFloatConfig ( ServerConfigs  index,
float  value 
)
overridevirtual

Implements IWorld.

1353{
1354 _worldConfig.OverwriteConfigValue<float>(index, value);
1355}

References _worldConfig, and ConfigValueCache< ConfigEnum >::OverwriteConfigValue().

Referenced by setRate().

◆ SetInitialWorldSettings()

void World::SetInitialWorldSettings ( )
overridevirtual

Initialize the World.

  • Server startup begin
  • Initialize the random number generator
  • Initialize detour memory management
  • Initialize VMapMgr function pointers (to untangle game/collision circular deps)
  • Initialize config settings
  • Initialize Allowed Security Level
  • Init highest guids before any table loading to prevent using not initialized guids in some code.
  • Check the existence of the map files for all starting areas.
  • Initialize pool manager
  • Initialize game event manager
  • Loading strings. Getting no records means core load has to be canceled because no error message can be output.
  • Update the realm entry in the database with the realm type from the config file
  • Custom Hook for loading DB items
  • Load the DBC files
  • Initilize static helper structures
  • Load dynamic data tables from the database
  • Handle outdated emails (delete/return)
  • Load AutoBroadCast
  • Load Motd
  • Load and initialize scripts
  • Initialize game time and timers
  • Initialize Battlegrounds
  • Initialize outdoor pvp

Implements IWorld.

301{
303 uint32 startupBegin = getMSTime();
304
306 srand((unsigned int)GameTime::GetGameTime().count());
307
309 dtAllocSetCustom(dtCustomAlloc, dtCustomFree);
310
315
318
321
323 sObjectMgr->SetHighestGuids();
324
325 if (!sConfigMgr->isDryRun())
326 {
328 if (!MapMgr::ExistMapAndVMap(MAP_EASTERN_KINGDOMS, -6240.32f, 331.033f)
329 || !MapMgr::ExistMapAndVMap(MAP_EASTERN_KINGDOMS, -8949.95f, -132.493f)
330 || !MapMgr::ExistMapAndVMap(MAP_KALIMDOR, -618.518f, -4251.67f)
331 || !MapMgr::ExistMapAndVMap(MAP_EASTERN_KINGDOMS, 1676.35f, 1677.45f)
332 || !MapMgr::ExistMapAndVMap(MAP_KALIMDOR, 10311.3f, 832.463f)
333 || !MapMgr::ExistMapAndVMap(MAP_KALIMDOR, -2917.58f, -257.98f)
335 !MapMgr::ExistMapAndVMap(MAP_OUTLAND, 10349.6f, -6357.29f) ||
336 !MapMgr::ExistMapAndVMap(MAP_OUTLAND, -3961.64f, -13931.2f))))
337 {
338 LOG_ERROR("server.loading", "Failed to find map files for starting areas");
339 exit(1);
340 }
341 }
342
344 sPoolMgr->Initialize();
345
347 sGameEventMgr->Initialize();
348
350 LOG_INFO("server.loading", " ");
351 LOG_INFO("server.loading", "Loading Acore Strings...");
352 if (!sObjectMgr->LoadAcoreStrings())
353 exit(1); // Error message displayed in function already
354
355 LOG_INFO("server.loading", "Loading Module Strings...");
356 sObjectMgr->LoadModuleStrings();
357 LOG_INFO("server.loading", "Loading Module Strings Locale...");
358 sObjectMgr->LoadModuleStringsLocale();
359
361 //No SQL injection as values are treated as integers
362
363 // not send custom type REALM_FFA_PVP to realm list
364 uint32 server_type;
365 if (IsFFAPvPRealm())
366 server_type = REALM_TYPE_PVP;
367 else
368 server_type = getIntConfig(CONFIG_GAME_TYPE);
369
371
372 LoginDatabase.Execute("UPDATE realmlist SET icon = {}, timezone = {} WHERE id = '{}'", server_type, realm_zone, realm.Id.Realm); // One-time query
373
375 sScriptMgr->OnLoadCustomDatabaseTable();
376
378 LOG_INFO("server.loading", "Initialize Data Stores...");
381
382 // Load cinematic cameras
384
385 LOG_INFO("server.loading", "Loading Player race data...");
386 sRaceMgr->LoadRaces();
387
388 // Load IP Location Database
389 sIPLocation->Load();
390
391 LOG_INFO("server.loading", "Loading Game Graveyard...");
392 sGraveyard->LoadGraveyardFromDB();
393
394 LOG_INFO("server.loading", "Initializing PlayerDump Tables...");
396
399
400 LOG_INFO("server.loading", "Loading SpellInfo Store...");
401 sSpellMgr->LoadSpellInfoStore();
402
403 LOG_INFO("server.loading", "Loading Spell Cooldown Overrides...");
404 sSpellMgr->LoadSpellCooldownOverrides();
405
406 LOG_INFO("server.loading", "Loading SpellInfo Data Corrections...");
407 sSpellMgr->LoadSpellInfoCorrections();
408
409 LOG_INFO("server.loading", "Loading Spell Rank Data...");
410 sSpellMgr->LoadSpellRanks();
411
412 LOG_INFO("server.loading", "Loading Spell Specific And Aura State...");
413 sSpellMgr->LoadSpellSpecificAndAuraState();
414
415 LOG_INFO("server.loading", "Loading SkillLineAbilityMultiMap Data...");
416 sSpellMgr->LoadSkillLineAbilityMap();
417
418 LOG_INFO("server.loading", "Loading SpellInfo Custom Attributes...");
419 sSpellMgr->LoadSpellInfoCustomAttributes();
420
421 LOG_INFO("server.loading", "Loading Spell Jump Distances...");
422 sSpellMgr->LoadSpellJumpDistances();
423
424 LOG_INFO("server.loading", "Loading SpellInfo Immunity infos...");
425 sSpellMgr->LoadSpellInfoImmunities();
426
427 LOG_INFO("server.loading", "Loading Player Totem models...");
428 sObjectMgr->LoadPlayerTotemModels();
429
430 LOG_INFO("server.loading", "Loading Player Shapeshift models...");
431 sObjectMgr->LoadPlayerShapeshiftModels();
432
433 LOG_INFO("server.loading", "Loading GameObject Models...");
435
436 LOG_INFO("server.loading", "Loading Script Names...");
437 sObjectMgr->LoadScriptNames();
438
439 LOG_INFO("server.loading", "Loading Instance Template...");
440 sObjectMgr->LoadInstanceTemplate();
441
442 LOG_INFO("server.loading", "Loading Character Cache...");
443 sCharacterCache->LoadCharacterCacheStorage();
444
445 // Must be called before `creature_respawn`/`gameobject_respawn` tables
446 LOG_INFO("server.loading", "Loading Instances...");
447 sInstanceSaveMgr->LoadInstances();
448
449 LOG_INFO("server.loading", "Loading Broadcast Texts...");
450 sObjectMgr->LoadBroadcastTexts();
451 sObjectMgr->LoadBroadcastTextLocales();
452
453 LOG_INFO("server.loading", "Loading Localization Strings...");
454 uint32 oldMSTime = getMSTime();
455 sObjectMgr->LoadCreatureLocales();
456 sObjectMgr->LoadGameObjectLocales();
457 sObjectMgr->LoadItemLocales();
458 sObjectMgr->LoadItemSetNameLocales();
459 sObjectMgr->LoadQuestLocales();
460 sObjectMgr->LoadQuestOfferRewardLocale();
461 sObjectMgr->LoadQuestRequestItemsLocale();
462 sObjectMgr->LoadNpcTextLocales();
463 sObjectMgr->LoadPageTextLocales();
464 sObjectMgr->LoadGossipMenuItemsLocales();
465 sObjectMgr->LoadPointOfInterestLocales();
466 sObjectMgr->LoadPetNamesLocales();
467
468 sObjectMgr->SetDBCLocaleIndex(GetDefaultDbcLocale()); // Get once for all the locale index of DBC language (console/broadcasts)
469 LOG_INFO("server.loading", ">> Localization Strings loaded in {} ms", GetMSTimeDiffToNow(oldMSTime));
470 LOG_INFO("server.loading", " ");
471
472 LOG_INFO("server.loading", "Loading Account Roles and Permissions...");
473 sAccountMgr->LoadRBAC();
474
475 LOG_INFO("server.loading", "Loading Page Texts...");
476 sObjectMgr->LoadPageTexts();
477
478 LOG_INFO("server.loading", "Loading Game Object Templates..."); // must be after LoadPageTexts
479 sObjectMgr->LoadGameObjectTemplate();
480
481 LOG_INFO("server.loading", "Loading Game Object Template Addons...");
482 sObjectMgr->LoadGameObjectTemplateAddons();
483
484 LOG_INFO("server.loading", "Loading Transport Templates...");
485 sTransportMgr->LoadTransportTemplates();
486
487 LOG_INFO("server.loading", "Loading Spell Required Data...");
488 sSpellMgr->LoadSpellRequired();
489
490 LOG_INFO("server.loading", "Loading Spell Group Types...");
491 sSpellMgr->LoadSpellGroups();
492
493 LOG_INFO("server.loading", "Loading Spell Learn Skills...");
494 sSpellMgr->LoadSpellLearnSkills(); // must be after LoadSpellRanks
495
496 LOG_INFO("server.loading", "Loading Spell Proc Conditions and Data...");
497 sSpellMgr->LoadSpellProcs();
498
499 LOG_INFO("server.loading", "Loading Spell Bonus Data...");
500 sSpellMgr->LoadSpellBonuses();
501
502 LOG_INFO("server.loading", "Loading Aggro Spells Definitions...");
503 sSpellMgr->LoadSpellThreats();
504
505 LOG_INFO("server.loading", "Loading Mixology Bonuses...");
506 sSpellMgr->LoadSpellMixology();
507
508 LOG_INFO("server.loading", "Loading Spell Group Stack Rules...");
509 sSpellMgr->LoadSpellGroupStackRules();
510
511 LOG_INFO("server.loading", "Loading NPC Texts...");
512 sObjectMgr->LoadGossipText();
513
514 LOG_INFO("server.loading", "Loading Enchant Spells Proc Datas...");
515 sSpellMgr->LoadSpellEnchantProcData();
516
517 LOG_INFO("server.loading", "Loading Item Random Enchantments Table...");
519
520 LOG_INFO("server.loading", "Loading Disables");
521 sDisableMgr->LoadDisables(); // must be before loading quests and items
522
523 LOG_INFO("server.loading", "Loading Items..."); // must be after LoadRandomEnchantmentsTable and LoadPageTexts
524 sObjectMgr->LoadItemTemplates();
525
526 LOG_INFO("server.loading", "Loading Item Set Names..."); // must be after LoadItemPrototypes
527 sObjectMgr->LoadItemSetNames();
528
529 LOG_INFO("server.loading", "Loading Creature Model Based Info Data...");
530 sObjectMgr->LoadCreatureModelInfo();
531
532 LOG_INFO("server.loading", "Loading Creature Custom IDs Config...");
533 sObjectMgr->LoadCreatureCustomIDs();
534
535 LOG_INFO("server.loading", "Loading Creature Templates...");
536 sObjectMgr->LoadCreatureTemplates();
537
538 LOG_INFO("server.loading", "Loading Equipment Templates..."); // must be after LoadCreatureTemplates
539 sObjectMgr->LoadEquipmentTemplates();
540
541 LOG_INFO("server.loading", "Loading Creature Template Addons...");
542 sObjectMgr->LoadCreatureTemplateAddons();
543
544 LOG_INFO("server.loading", "Loading Reputation Reward Rates...");
545 sObjectMgr->LoadReputationRewardRate();
546
547 LOG_INFO("server.loading", "Loading Creature Reputation OnKill Data...");
548 sObjectMgr->LoadReputationOnKill();
549
550 LOG_INFO("server.loading", "Loading Reputation Spillover Data..." );
551 sObjectMgr->LoadReputationSpilloverTemplate();
552
553 LOG_INFO("server.loading", "Loading Points Of Interest Data...");
554 sObjectMgr->LoadPointsOfInterest();
555
556 LOG_INFO("server.loading", "Loading Creature Base Stats...");
557 sObjectMgr->LoadCreatureClassLevelStats();
558
559 LOG_INFO("server.loading", "Loading Spawn Group Templates...");
560 sObjectMgr->LoadSpawnGroupTemplates();
561
562 LOG_INFO("server.loading", "Loading Creature Data...");
563 sObjectMgr->LoadCreatures();
564
565 LOG_INFO("server.loading", "Loading Creature sparring...");
566 sObjectMgr->LoadCreatureSparring();
567
568 LOG_INFO("server.loading", "Loading Temporary Summon Data...");
569 sObjectMgr->LoadTempSummons(); // must be after LoadCreatureTemplates() and LoadGameObjectTemplates()
570
571 LOG_INFO("server.loading", "Loading Gameobject Summon Data...");
572 sObjectMgr->LoadGameObjectSummons(); // must be after LoadCreatureTemplates() and LoadGameObjectTemplates()
573
574 LOG_INFO("server.loading", "Loading Pet Levelup Spells...");
575 sSpellMgr->LoadPetLevelupSpellMap();
576
577 LOG_INFO("server.loading", "Loading Pet default Spells additional to Levelup Spells...");
578 sSpellMgr->LoadPetDefaultSpells();
579
580 LOG_INFO("server.loading", "Loading Creature Addon Data...");
581 sObjectMgr->LoadCreatureAddons(); // must be after LoadCreatureTemplates() and LoadCreatures()
582
583 LOG_INFO("server.loading", "Loading Creature Movement Overrides...");
584 sObjectMgr->LoadCreatureMovementOverrides(); // must be after LoadCreatures()
585
586 LOG_INFO("server.loading", "Loading Gameobject Data...");
587 sObjectMgr->LoadGameobjects();
588
589 LOG_INFO("server.loading", "Loading Spawn Group Data...");
590 sObjectMgr->LoadSpawnGroups(); // must be after LoadCreatures() and LoadGameobjects()
591
592 LOG_INFO("server.loading", "Loading GameObject Addon Data...");
593 sObjectMgr->LoadGameObjectAddons(); // must be after LoadGameObjectTemplate() and LoadGameobjects()
594
595 LOG_INFO("server.loading", "Loading GameObject Quest Items...");
596 sObjectMgr->LoadGameObjectQuestItems();
597
598 LOG_INFO("server.loading", "Loading Creature Quest Items...");
599 sObjectMgr->LoadCreatureQuestItems();
600
601 LOG_INFO("server.loading", "Loading Creature Linked Respawn...");
602 sObjectMgr->LoadLinkedRespawn(); // must be after LoadCreatures(), LoadGameObjects()
603
604 LOG_INFO("server.loading", "Loading Weather Data...");
606
607 LOG_INFO("server.loading", "Loading Quests...");
608 sObjectMgr->LoadQuests(); // must be loaded after DBCs, creature_template, item_template, gameobject tables
609
610 LOG_INFO("server.loading", "Checking Quest Disables");
611 sDisableMgr->CheckQuestDisables(); // must be after loading quests
612
613 LOG_INFO("server.loading", "Loading Quest POI");
614 sObjectMgr->LoadQuestPOI();
615
616 LOG_INFO("server.loading", "Loading Quests Starters and Enders...");
617 sObjectMgr->LoadQuestStartersAndEnders(); // must be after quest load
618
619 LOG_INFO("server.loading", "Loading Quest Greetings...");
620 sObjectMgr->LoadQuestGreetings(); // must be loaded after creature_template, gameobject_template tables
621 LOG_INFO("server.loading", "Loading Quest Greeting Locales...");
622 sObjectMgr->LoadQuestGreetingsLocales(); // must be loaded after creature_template, gameobject_template tables, quest_greeting
623
624 LOG_INFO("server.loading", "Loading Quest Money Rewards...");
625 sObjectMgr->LoadQuestMoneyRewards();
626
627 LOG_INFO("server.loading", "Loading Objects Pooling Data...");
628 sPoolMgr->LoadFromDB();
629
630 LOG_INFO("server.loading", "Loading Game Event Data..."); // must be after loading pools fully
631 sGameEventMgr->LoadHolidayDates(); // Must be after loading DBC
632 sGameEventMgr->LoadFromDB(); // Must be after loading holiday dates
633
634 LOG_INFO("server.loading", "Loading UNIT_NPC_FLAG_SPELLCLICK Data..."); // must be after LoadQuests
635 sObjectMgr->LoadNPCSpellClickSpells();
636
637 LOG_INFO("server.loading", "Loading Vehicle Template Accessories...");
638 sObjectMgr->LoadVehicleTemplateAccessories(); // must be after LoadCreatureTemplates() and LoadNPCSpellClickSpells()
639
640 LOG_INFO("server.loading", "Loading Vehicle Accessories...");
641 sObjectMgr->LoadVehicleAccessories(); // must be after LoadCreatureTemplates() and LoadNPCSpellClickSpells()
642
643 LOG_INFO("server.loading", "Loading Vehicle Seat Addon Data...");
644 sObjectMgr->LoadVehicleSeatAddon(); // must be after loading DBC
645
646 LOG_INFO("server.loading", "Loading SpellArea Data..."); // must be after quest load
647 sSpellMgr->LoadSpellAreas();
648
649 LOG_INFO("server.loading", "Loading Area Trigger Definitions");
650 sObjectMgr->LoadAreaTriggers();
651
652 LOG_INFO("server.loading", "Loading Area Trigger Teleport Definitions...");
653 sObjectMgr->LoadAreaTriggerTeleports();
654
655 LOG_INFO("server.loading", "Loading Access Requirements...");
656 sObjectMgr->LoadAccessRequirements(); // must be after item template load
657
658 LOG_INFO("server.loading", "Loading Quest Area Triggers...");
659 sObjectMgr->LoadQuestAreaTriggers(); // must be after LoadQuests
660
661 LOG_INFO("server.loading", "Loading Tavern Area Triggers...");
662 sObjectMgr->LoadTavernAreaTriggers();
663
664 LOG_INFO("server.loading", "Loading AreaTrigger Script Names...");
665 sObjectMgr->LoadAreaTriggerScripts();
666
667 LOG_INFO("server.loading", "Loading LFG Entrance Positions..."); // Must be after areatriggers
668 sLFGMgr->LoadLFGDungeons();
669
670 LOG_INFO("server.loading", "Loading Dungeon Boss Data...");
671 sObjectMgr->LoadInstanceEncounters();
672
673 LOG_INFO("server.loading", "Loading LFG Rewards...");
674 sLFGMgr->LoadRewards();
675
676 LOG_INFO("server.loading", "Loading Graveyard-Zone Links...");
677 sGraveyard->LoadGraveyardZones();
678
679 LOG_INFO("server.loading", "Loading Spell Pet Auras...");
680 sSpellMgr->LoadSpellPetAuras();
681
682 LOG_INFO("server.loading", "Loading Spell Target Coordinates...");
683 sSpellMgr->LoadSpellTargetPositions();
684
685 LOG_INFO("server.loading", "Loading Spell Cone definitions...");
686 sSpellMgr->LoadSpellCones();
687
688 LOG_INFO("server.loading", "Loading Enchant Custom Attributes...");
689 sSpellMgr->LoadEnchantCustomAttr();
690
691 LOG_INFO("server.loading", "Loading linked Spells...");
692 sSpellMgr->LoadSpellLinked();
693
694 LOG_INFO("server.loading", "Loading Player Create Data...");
695 sObjectMgr->LoadPlayerInfo();
696
697 LOG_INFO("server.loading", "Loading Exploration BaseXP Data...");
698 sObjectMgr->LoadExplorationBaseXP();
699
700 LOG_INFO("server.loading", "Loading Pet Name Parts...");
701 sObjectMgr->LoadPetNames();
702
704
705 LOG_INFO("server.loading", "Loading The Max Pet Number...");
706 sObjectMgr->LoadPetNumber();
707
708 LOG_INFO("server.loading", "Loading Pet Level Stats...");
709 sObjectMgr->LoadPetLevelInfo();
710
711 LOG_INFO("server.loading", "Loading Player Level Dependent Mail Rewards...");
712 sObjectMgr->LoadMailLevelRewards();
713
714 LOG_INFO("server.loading", "Load Mail Server definitions...");
715 sServerMailMgr->LoadMailServerTemplates();
716
717 // Loot tables
719
720 LOG_INFO("server.loading", "Loading Skill Discovery Table...");
722
723 LOG_INFO("server.loading", "Loading Skill Extra Item Table...");
725
726 LOG_INFO("server.loading", "Loading Skill Perfection Data Table...");
728
729 LOG_INFO("server.loading", "Loading Skill Fishing Base Level Requirements...");
730 sObjectMgr->LoadFishingBaseSkillLevel();
731
732 LOG_INFO("server.loading", "Loading Achievements...");
733 sAchievementMgr->LoadAchievementReferenceList();
734 LOG_INFO("server.loading", "Loading Achievement Criteria Lists...");
735 sAchievementMgr->LoadAchievementCriteriaList();
736 LOG_INFO("server.loading", "Loading Achievement Criteria Data...");
737 sAchievementMgr->LoadAchievementCriteriaData();
738 LOG_INFO("server.loading", "Loading Achievement Rewards...");
739 sAchievementMgr->LoadRewards();
740 LOG_INFO("server.loading", "Loading Achievement Reward Locales...");
741 sAchievementMgr->LoadRewardLocales();
742 LOG_INFO("server.loading", "Loading Completed Achievements...");
743 sAchievementMgr->LoadCompletedAchievements();
744
746 LOG_INFO("server.loading", "Loading Item Auctions...");
747 sAuctionMgr->LoadAuctionItems();
748 LOG_INFO("server.loading", "Loading Auctions...");
749 sAuctionMgr->LoadAuctions();
750
751 sGuildMgr->LoadGuilds();
752
753 LOG_INFO("server.loading", "Loading ArenaTeams...");
754 sArenaTeamMgr->LoadArenaTeams();
755
756 LOG_INFO("server.loading", "Loading Groups...");
757 sGroupMgr->LoadGroups();
758
759 LOG_INFO("server.loading", "Loading Reserved Names...");
760 sObjectMgr->LoadReservedPlayerNamesDB();
761 sObjectMgr->LoadReservedPlayerNamesDBC(); // Needs to be after LoadReservedPlayerNamesDB()
762
763 LOG_INFO("server.loading", "Loading Profanity Names...");
764 sObjectMgr->LoadProfanityNamesFromDB();
765 sObjectMgr->LoadProfanityNamesFromDBC(); // Needs to be after LoadProfanityNamesFromDB()
766
767 LOG_INFO("server.loading", "Loading GameObjects for Quests...");
768 sObjectMgr->LoadGameObjectForQuests();
769
770 LOG_INFO("server.loading", "Loading BattleMasters...");
771 sBattlegroundMgr->LoadBattleMastersEntry();
772
773 LOG_INFO("server.loading", "Loading GameTeleports...");
774 sObjectMgr->LoadGameTele();
775
776 LOG_INFO("server.loading", "Loading Trainers..."); // must be after LoadCreatureTemplates
777 sObjectMgr->LoadTrainers();
778
779 LOG_INFO("server.loading", "Loading Creature default trainers...");
780 sObjectMgr->LoadCreatureDefaultTrainers();
781
782 LOG_INFO("server.loading", "Loading Gossip Menu...");
783 sObjectMgr->LoadGossipMenu();
784
785 LOG_INFO("server.loading", "Loading Gossip Menu Options...");
786 sObjectMgr->LoadGossipMenuItems();
787
788 LOG_INFO("server.loading", "Loading Vendors...");
789 sObjectMgr->LoadVendors(); // must be after load CreatureTemplate and ItemTemplate
790
791 LOG_INFO("server.loading", "Loading Waypoints...");
792 sWaypointMgr->Load();
793
794 LOG_INFO("server.loading", "Loading Waypoint Addons...");
795 sWaypointMgr->LoadWaypointAddons();
796
797 LOG_INFO("server.loading", "Loading SmartAI Waypoints...");
798 sSmartWaypointMgr->LoadFromDB();
799
800 LOG_INFO("server.loading", "Loading Creature Formations...");
801 sFormationMgr->LoadCreatureFormations();
802
803 LOG_INFO("server.loading", "Loading WorldStates..."); // must be loaded before battleground, outdoor PvP and conditions
804 sWorldState->LoadWorldStates();
805
806 LOG_INFO("server.loading", "Loading Conditions...");
807 sConditionMgr->LoadConditions();
808
809 LOG_INFO("server.loading", "Loading Faction Change Achievement Pairs...");
810 sObjectMgr->LoadFactionChangeAchievements();
811
812 LOG_INFO("server.loading", "Loading Faction Change Spell Pairs...");
813 sObjectMgr->LoadFactionChangeSpells();
814
815 LOG_INFO("server.loading", "Loading Faction Change Item Pairs...");
816 sObjectMgr->LoadFactionChangeItems();
817
818 LOG_INFO("server.loading", "Loading Faction Change Reputation Pairs...");
819 sObjectMgr->LoadFactionChangeReputations();
820
821 LOG_INFO("server.loading", "Loading Faction Change Title Pairs...");
822 sObjectMgr->LoadFactionChangeTitles();
823
824 LOG_INFO("server.loading", "Loading Faction Change Quest Pairs...");
825 sObjectMgr->LoadFactionChangeQuests();
826
827 LOG_INFO("server.loading", "Loading GM Tickets...");
828 sTicketMgr->LoadTickets();
829
830 LOG_INFO("server.loading", "Loading GM Surveys...");
831 sTicketMgr->LoadSurveys();
832
833 LOG_INFO("server.loading", "Loading Client Addons...");
835
836 // pussywizard:
837 LOG_INFO("server.loading", "Deleting Invalid Mail Items...");
838 LOG_INFO("server.loading", " ");
839 CharacterDatabase.Execute("DELETE mi FROM mail_items mi LEFT JOIN item_instance ii ON mi.item_guid = ii.guid WHERE ii.guid IS NULL");
840 CharacterDatabase.Execute("DELETE mi FROM mail_items mi LEFT JOIN mail m ON mi.mail_id = m.id WHERE m.id IS NULL");
841 CharacterDatabase.Execute("UPDATE mail m LEFT JOIN mail_items mi ON m.id = mi.mail_id SET m.has_items=0 WHERE m.has_items<>0 AND mi.mail_id IS NULL");
842
844 LOG_INFO("server.loading", "Returning Old Mails...");
845 LOG_INFO("server.loading", " ");
846 sObjectMgr->ReturnOrDeleteOldMails(false);
847
849 LOG_INFO("server.loading", "Loading Autobroadcasts...");
850 sAutobroadcastMgr->LoadAutobroadcasts();
851 sAutobroadcastMgr->LoadAutobroadcastsLocalized();
852
854 LOG_INFO("server.loading", "Loading Motd...");
855 sMotdMgr->LoadMotd();
856
858 sObjectMgr->LoadSpellScripts(); // must be after load Creature/Gameobject(Template/Data)
859 sObjectMgr->LoadEventScripts(); // must be after load Creature/Gameobject(Template/Data)
860 sObjectMgr->LoadWaypointScripts();
861
862 LOG_INFO("server.loading", "Loading Spell Script Names...");
863 sObjectMgr->LoadSpellScriptNames();
864
865 LOG_INFO("server.loading", "Loading Creature Texts...");
866 sCreatureTextMgr->LoadCreatureTexts();
867
868 LOG_INFO("server.loading", "Loading Creature Text Locales...");
869 sCreatureTextMgr->LoadCreatureTextLocales();
870
871 LOG_INFO("server.loading", "Loading Scripts...");
872 sScriptMgr->LoadDatabase();
873
874 LOG_INFO("server.loading", "Validating Spell Scripts...");
875 sObjectMgr->ValidateSpellScripts();
876
877 LOG_INFO("server.loading", "Loading SmartAI Scripts...");
878 sSmartScriptMgr->LoadSmartAIFromDB();
879
880 LOG_INFO("server.loading", "Loading Calendar Data...");
881 sCalendarMgr->LoadFromDB();
882
883 LOG_INFO("server.loading", "Initializing SpellInfo Precomputed Data..."); // must be called after loading items, professions, spells and pretty much anything
884 LOG_INFO("server.loading", " ");
885 sObjectMgr->InitializeSpellInfoPrecomputedData();
886
887 LOG_INFO("server.loading", "Initialize Commands...");
889
891 LOG_INFO("server.loading", "Initialize Game Time and Timers");
892 LOG_INFO("server.loading", " ");
893
895 stmt->SetData(0, realm.Id.Realm);
896 stmt->SetData(1, uint32(GameTime::GetStartTime().count()));
898 LoginDatabase.Execute(stmt);
899
901 //Update "uptime" table based on configuration entry in minutes.
902
904 // clean logs table every 14 days by default
906
908
909 // our speed up
911
912 _timers[WUPDATE_WHO_LIST].SetInterval(5 * IN_MILLISECONDS); // update who list cache every 5 seconds
913
915
917 LOG_INFO("server.loading", "Starting Map System");
918 LOG_INFO("server.loading", " ");
919 sMapMgr->Initialize();
920
921 LOG_INFO("server.loading", "Starting Game Event system...");
922 LOG_INFO("server.loading", " ");
923 uint32 nextGameEvent = sGameEventMgr->StartSystem();
924 _timers[WUPDATE_EVENTS].SetInterval(nextGameEvent); //depend on next event
925
926 LOG_INFO("server.loading", "Loading WorldState...");
927 sWorldState->Load(); // must be called after loading game events
928
929 // Delete all characters which have been deleted X days before
931
932 // Delete all items which have been deleted X days before
934
935 // Delete all custom channels which haven't been used for PreserveCustomChannelDuration days.
937
938 LOG_INFO("server.loading", "Initializing Opcodes...");
940
941 LOG_INFO("server.loading", "Loading Arena Season Rewards...");
942 sArenaSeasonMgr->LoadRewards();
943 LOG_INFO("server.loading", "Loading Active Arena Season...");
944 sArenaSeasonMgr->LoadActiveSeason();
945
946 sTicketMgr->Initialize();
947
949 LOG_INFO("server.loading", "Starting Battleground System");
950 sBattlegroundMgr->LoadBattlegroundTemplates();
951 sBattlegroundMgr->InitAutomaticArenaPointDistribution();
952
954 LOG_INFO("server.loading", "Starting Outdoor PvP System");
955 sOutdoorPvPMgr->InitOutdoorPvP();
956
958 LOG_INFO("server.loading", "Starting Battlefield System");
959 sBattlefieldMgr->InitBattlefield();
960
961 LOG_INFO("server.loading", "Loading Transports...");
962 sTransportMgr->SpawnContinentTransports();
963
965 LOG_INFO("server.loading", "Loading Warden Checks..." );
966 sWardenCheckMgr->LoadWardenChecks();
967
968 LOG_INFO("server.loading", "Loading Warden Action Overrides..." );
969 sWardenCheckMgr->LoadWardenOverrides();
970
971 LOG_INFO("server.loading", "Deleting Expired Bans...");
972 LoginDatabase.Execute("DELETE FROM ip_banned WHERE unbandate <= UNIX_TIMESTAMP() AND unbandate<>bandate"); // One-time query
973
974 LOG_INFO("server.loading", "Calculate Next Daily Quest Reset Time...");
976
977 LOG_INFO("server.loading", "Calculate Next Weekly Quest Reset Time..." );
979
980 LOG_INFO("server.loading", "Calculate Next Monthly Quest Reset Time...");
982
983 LOG_INFO("server.loading", "Calculate Random Battleground Reset Time..." );
985
986 LOG_INFO("server.loading", "Calculate Deletion Of Old Calendar Events Time...");
988
989 LOG_INFO("server.loading", "Calculate Guild Cap Reset Time...");
990 LOG_INFO("server.loading", " ");
992
993 LOG_INFO("server.loading", "Load Petitions...");
994 sPetitionMgr->LoadPetitions();
995
996 LOG_INFO("server.loading", "Load Petition Signs...");
997 sPetitionMgr->LoadSignatures();
998
999 LOG_INFO("server.loading", "Load Stored Loot Items...");
1000 sLootItemStorage->LoadStorageFromDB();
1001
1002 LOG_INFO("server.loading", "Load Channel Rights...");
1004
1005 LOG_INFO("server.loading", "Load Channels...");
1007
1008 LOG_INFO("server.loading", "Loading AntiDos opcode policies");
1009 sWorldGlobals->LoadAntiDosOpcodePolicies();
1010
1011 sScriptMgr->OnBeforeWorldInitialized();
1012
1014 {
1015 LOG_INFO("server.loading", "Loading All Grids For All Non-Instanced Maps...");
1016
1017 for (uint32 i = 0; i < sMapStore.GetNumRows(); ++i)
1018 {
1019 MapEntry const* mapEntry = sMapStore.LookupEntry(i);
1020
1021 if (mapEntry && !mapEntry->Instanceable())
1022 {
1023 if (sMapMgr->GetMapUpdater()->activated())
1024 sMapMgr->GetMapUpdater()->schedule_map_preload(mapEntry->MapID);
1025 else
1026 {
1027 Map* map = sMapMgr->CreateBaseMap(mapEntry->MapID);
1028
1029 if (map)
1030 {
1031 LOG_INFO("server.loading", ">> Loading All Grids For Map {}", map->GetId());
1032 map->LoadAllGrids();
1033 }
1034 }
1035 }
1036 }
1037
1038 if (sMapMgr->GetMapUpdater()->activated())
1039 sMapMgr->GetMapUpdater()->wait();
1040 }
1041
1042 uint32 startupDuration = GetMSTimeDiffToNow(startupBegin);
1043
1044 LOG_INFO("server.loading", " ");
1045 LOG_INFO("server.loading", "WORLD: World Initialized In {} Minutes {} Seconds", (startupDuration / 60000), ((startupDuration % 60000) / 1000)); // outError for red color in console
1046 LOG_INFO("server.loading", " ");
1047
1048 METRIC_EVENT("events", "World initialized", "World Initialized In " + std::to_string(startupDuration / 60000) + " Minutes " + std::to_string((startupDuration % 60000) / 1000) + " Seconds");
1049
1050 if (sConfigMgr->isDryRun())
1051 {
1052 sMapMgr->UnloadAll();
1053 LOG_INFO("server.loading", "AzerothCore Dry Run Completed, Terminating.");
1054 exit(0);
1055 }
1056}
#define sAccountMgr
Definition AccountMgr.h:93
#define sAchievementMgr
Definition AchievementMgr.h:451
@ MAP_OUTLAND
Definition AreaDefines.h:217
@ MAP_KALIMDOR
Definition AreaDefines.h:187
@ MAP_EASTERN_KINGDOMS
Definition AreaDefines.h:186
#define sArenaSeasonMgr
Definition ArenaSeasonMgr.h:124
#define sArenaTeamMgr
Definition ArenaTeamMgr.h:69
#define sAuctionMgr
Definition AuctionHouseMgr.h:224
#define sAutobroadcastMgr
Definition AutobroadcastMgr.h:54
#define sBattlefieldMgr
Definition BattlefieldMgr.h:79
#define sBattlegroundMgr
Definition BattlegroundMgr.h:187
#define sCharacterCache
Definition CharacterCache.h:83
#define sConditionMgr
Definition ConditionMgr.h:296
#define sFormationMgr
Definition CreatureGroups.h:130
#define sCreatureTextMgr
Definition CreatureTextMgr.h:110
uint32 GetLiquidFlags(uint32 liquidType)
Definition DBCStores.cpp:834
DBCStorage< MapEntry > sMapStore(MapEntryfmt)
void LoadDBCStores(const std::string &dataPath)
Definition DBCStores.cpp:261
#define sDisableMgr
Definition DisableMgr.h:88
#define sGraveyard
Definition GameGraveyard.h:74
void LoadGameObjectModelList(std::string const &dataPath)
Definition GameObjectModel.cpp:46
#define sGroupMgr
Definition GroupMgr.h:51
#define sIPLocation
Definition IPLocation.h:49
#define sInstanceSaveMgr
Definition InstanceSaveMgr.h:202
void LoadRandomEnchantmentsTable()
Definition ItemEnchantmentMgr.cpp:47
#define sLFGMgr
Definition LFGMgr.h:658
@ LOGIN_INS_UPTIME
Definition LoginDatabase.h:134
#define sLootItemStorage
Definition LootItemStorage.h:73
void LoadLootTables()
Definition LootMgr.h:443
void LoadM2Cameras(std::string const &dataPath)
Definition M2Stores.cpp:173
void dtCustomFree(void *ptr)
Definition MMapMgr.h:33
void * dtCustomAlloc(std::size_t size, dtAllocHint)
Definition MMapMgr.h:28
#define METRIC_EVENT(category, title, description)
Definition Metric.h:189
#define sMotdMgr
Definition MotdMgr.h:52
#define sObjectMgr
Definition ObjectMgr.h:1723
#define sOutdoorPvPMgr
Definition OutdoorPvPMgr.h:102
#define sPetitionMgr
Definition PetitionMgr.h:104
#define sRaceMgr
Definition RaceMgr.h:52
#define sServerMailMgr
Definition ServerMailMgr.h:231
void LoadSkillDiscoveryTable()
Definition SkillDiscovery.cpp:46
void LoadSkillPerfectItemTable()
Definition SkillExtraItems.cpp:52
void LoadSkillExtraItemTable()
Definition SkillExtraItems.cpp:138
#define sSmartWaypointMgr
Definition SmartScriptMgr.h:2271
#define sSmartScriptMgr
Definition SmartScriptMgr.h:2270
#define sSpellMgr
Definition SpellMgr.h:846
#define sTicketMgr
Definition TicketMgr.h:260
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition Timer.h:131
uint32 getMSTime()
Definition Timer.h:103
#define sTransportMgr
Definition TransportMgr.h:165
#define sWardenCheckMgr
Definition WardenCheckMgr.h:89
#define sWaypointMgr
Definition WaypointMgr.h:54
@ CONFIG_PRELOAD_ALL_NON_INSTANCED_MAP_GRIDS
Definition WorldConfig.h:117
@ CONFIG_REALM_ZONE
Definition WorldConfig.h:172
@ CONFIG_EXPANSION
Definition WorldConfig.h:228
@ CONFIG_DB_PING_INTERVAL
Definition WorldConfig.h:316
#define sWorldGlobals
Definition WorldGlobals.h:42
static void LoadChannelRights()
Definition ChannelMgr.cpp:166
static void LoadChannels()
Definition ChannelMgr.cpp:50
static void CleanOldChannelsInDB()
Definition Channel.cpp:141
static bool IsVMAPDisabledFor(uint32 entry, uint8 flags)
Definition DisableMgr.cpp:440
static bool ExistMapAndVMap(uint32 mapid, float x, float y)
Definition MapMgr.cpp:305
Definition Map.h:166
void LoadAllGrids()
Definition Map.cpp:218
uint32 GetId() const
Definition Map.h:232
static void InitializeTables()
Definition PlayerDump.cpp:253
static void DeleteOldCharacters()
Definition Player.cpp:4259
static void DeleteOldRecoveryItems()
Definition Player.cpp:4294
Definition VMapMgr2.h:55
IsVMAPDisabledForFn IsVMAPDisabledForPtr
Definition VMapMgr2.h:81
GetLiquidFlagsFn GetLiquidFlagsPtr
Definition VMapMgr2.h:78
bool IsFFAPvPRealm() const override
Definition World.cpp:1833
void LoadConfigSettings(bool reload=false) override
Initialize config values.
Definition World.cpp:163
void InitCalendarOldEventsDeletionTime()
Definition World.cpp:1647
void InitDailyQuestResetTime()
Definition World.cpp:1614
void LoadDBAllowedSecurityLevel() override
Definition World.cpp:1686
void DetectDBCLang()
Definition World.cpp:1058
void InitGuildResetTime()
Definition World.cpp:1658
void InitRandomBGResetTime()
Definition World.cpp:1636
void InitWeeklyQuestResetTime()
Definition World.cpp:1603
void InitMonthlyQuestResetTime()
Definition World.cpp:1625
OpcodeTable opcodeTable
Definition Opcodes.cpp:51
void Initialize()
Correspondence between opcodes and their names.
Definition Opcodes.cpp:123
void LoadWeatherData()
Definition WeatherMgr.cpp:44
@ WUPDATE_PINGDB
Definition World.h:66
@ WUPDATE_WHO_LIST
Definition World.h:68
void Initialize()
Definition CreatureAIRegistry.cpp:34
AC_GAME_API void LoadCommandMap()
Definition ChatCommand.cpp:535
void LoadFromDB()
Definition AddonMgr.cpp:39
void CleanDatabase()
Definition CharacterDatabaseCleaner.cpp:27
Seconds GetStartTime()
Definition GameTime.cpp:33
AC_COMMON_API char const * GetFullVersion()
Definition GitRevision.cpp:82
Definition DBCStructure.h:1325
uint32 MapID
Definition DBCStructure.h:1326
bool Instanceable() const
Definition DBCStructure.h:1353

References _dataPath, _mail_expire_check_timer, _timers, CharacterDatabase, CharacterDatabaseCleaner::CleanDatabase(), Channel::CleanOldChannelsInDB(), CONFIG_AUTOBROADCAST_INTERVAL, CONFIG_DB_PING_INTERVAL, CONFIG_EXPANSION, CONFIG_GAME_TYPE, CONFIG_LOGDB_CLEARINTERVAL, CONFIG_PRELOAD_ALL_NON_INSTANCED_MAP_GRIDS, CONFIG_REALM_ZONE, CONFIG_UPTIME_UPDATE, VMAP::VMapFactory::createOrGetVMapMgr(), Player::DeleteOldCharacters(), Player::DeleteOldRecoveryItems(), DetectDBCLang(), dtCustomAlloc(), dtCustomFree(), MapMgr::ExistMapAndVMap(), getBoolConfig(), GetDefaultDbcLocale(), GitRevision::GetFullVersion(), GameTime::GetGameTime(), Map::GetId(), getIntConfig(), GetLiquidFlags(), VMAP::VMapMgr2::GetLiquidFlagsPtr, getMSTime(), GetMSTimeDiffToNow(), GameTime::GetStartTime(), Realm::Id, IN_MILLISECONDS, InitCalendarOldEventsDeletionTime(), InitDailyQuestResetTime(), InitGuildResetTime(), AIRegistry::Initialize(), OpcodeTable::Initialize(), PlayerDump::InitializeTables(), InitMonthlyQuestResetTime(), InitRandomBGResetTime(), InitWeeklyQuestResetTime(), MapEntry::Instanceable(), IsFFAPvPRealm(), DisableMgr::IsVMAPDisabledFor(), VMAP::VMapMgr2::IsVMAPDisabledForPtr, Map::LoadAllGrids(), ChannelMgr::LoadChannelRights(), ChannelMgr::LoadChannels(), Acore::ChatCommands::LoadCommandMap(), LoadConfigSettings(), LoadDBAllowedSecurityLevel(), LoadDBCStores(), AddonMgr::LoadFromDB(), LoadGameObjectModelList(), LoadLootTables(), LoadM2Cameras(), LoadRandomEnchantmentsTable(), LoadSkillDiscoveryTable(), LoadSkillExtraItemTable(), LoadSkillPerfectItemTable(), WeatherMgr::LoadWeatherData(), LOG_ERROR, LOG_INFO, LOGIN_INS_UPTIME, LoginDatabase, MAP_EASTERN_KINGDOMS, MAP_KALIMDOR, MAP_OUTLAND, MapEntry::MapID, METRIC_EVENT, MINUTE, opcodeTable, realm, RealmHandle::Realm, REALM_TYPE_PVP, sAccountMgr, sAchievementMgr, sArenaSeasonMgr, sArenaTeamMgr, sAuctionMgr, sAutobroadcastMgr, sBattlefieldMgr, sBattlegroundMgr, sCalendarMgr, sCharacterCache, sConditionMgr, sConfigMgr, sCreatureTextMgr, sDisableMgr, PreparedStatementBase::SetData(), IntervalTimer::SetInterval(), sFormationMgr, sGameEventMgr, sGraveyard, sGroupMgr, sGuildMgr, sInstanceSaveMgr, sIPLocation, sLFGMgr, sLootItemStorage, sMapMgr, sMapStore, sMotdMgr, sObjectMgr, sOutdoorPvPMgr, sPetitionMgr, sPoolMgr, sRaceMgr, sScriptMgr, sServerMailMgr, sSmartScriptMgr, sSmartWaypointMgr, sSpellMgr, sTicketMgr, sTransportMgr, sWardenCheckMgr, sWaypointMgr, sWorldGlobals, sWorldState, WUPDATE_5_SECS, WUPDATE_AUTOBROADCAST, WUPDATE_CLEANDB, WUPDATE_EVENTS, WUPDATE_PINGDB, WUPDATE_UPTIME, and WUPDATE_WHO_LIST.

◆ setIntConfig()

void World::setIntConfig ( ServerConfigs  index,
uint32  value 
)
overridevirtual

◆ SetPlayerSecurityLimit()

void World::SetPlayerSecurityLimit ( AccountTypes  sec)
overridevirtual

Implements IWorld.

1697{
1698 AccountTypes sec = _sec < SEC_CONSOLE ? _sec : SEC_PLAYER;
1699 bool update = sec > _allowedSecurityLevel;
1701 if (update)
1703}
@ SEC_CONSOLE
Definition Common.h:61

References _allowedSecurityLevel, SEC_CONSOLE, SEC_PLAYER, and sWorldSessionMgr.

Referenced by LoadDBAllowedSecurityLevel().

◆ setRate()

void World::setRate ( ServerConfigs  index,
float  value 
)
overridevirtual

Implements IWorld.

1332{
1333 setFloatConfig(index, value);
1334}
void setFloatConfig(ServerConfigs index, float value) override
Definition World.cpp:1352

References setFloatConfig().

◆ SetRealmName()

void World::SetRealmName ( std::string  name)
inlineoverridevirtual

Implements IWorld.

241{ _realmName = name; } // pussywizard

References _realmName.

◆ setStringConfig()

void World::setStringConfig ( ServerConfigs  index,
std::string const &  value 
)
overridevirtual

Implements IWorld.

1373{
1374 _worldConfig.OverwriteConfigValue<std::string>(index, value);
1375}

References _worldConfig, and ConfigValueCache< ConfigEnum >::OverwriteConfigValue().

◆ ShutdownCancel()

void World::ShutdownCancel ( )
overridevirtual

Cancel a planned server shutdown.

Implements IWorld.

1540{
1541 // nothing cancel or too later
1542 if (!_shutdownTimer || _stopEvent)
1543 return;
1544
1546
1547 _shutdownMask = 0;
1548 _shutdownTimer = 0;
1549 _exitCode = SHUTDOWN_EXIT_CODE; // to default value
1550 sWorldSessionMgr->SendServerMessage(msgid);
1551
1552 LOG_DEBUG("server.worldserver", "Server {} cancelled.", (_shutdownMask & SHUTDOWN_MASK_RESTART ? "restart" : "shuttingdown"));
1553
1554 sScriptMgr->OnShutdownCancel();
1555}
ServerMessageType
Definition IWorld.h:54
@ SERVER_MSG_SHUTDOWN_CANCELLED
Definition IWorld.h:58
@ SERVER_MSG_RESTART_CANCELLED
Definition IWorld.h:59
@ SHUTDOWN_EXIT_CODE
Definition World.h:53
@ SHUTDOWN_MASK_RESTART
Definition World.h:47

References _exitCode, _shutdownMask, _shutdownTimer, _stopEvent, LOG_DEBUG, SERVER_MSG_RESTART_CANCELLED, SERVER_MSG_SHUTDOWN_CANCELLED, SHUTDOWN_EXIT_CODE, SHUTDOWN_MASK_RESTART, sScriptMgr, and sWorldSessionMgr.

◆ ShutdownMsg()

void World::ShutdownMsg ( bool  show = false,
Player player = nullptr,
std::string const &  reason = std::string() 
)
overridevirtual

Displays a shutdown message at specific intervals or immediately if required.

Show the time remaining for a server shutdown/restart with a reason appended if one is provided. Messages are displayed at regular intervals such as every 12 hours, 1 hour, 5 minutes, 1 minute, 30 seconds, 10 seconds, and every second in the last 10 seconds.

Parameters
showForces the message to be displayed immediately.
playerThe player who should recieve the message (can be nullptr for global messages).
reasonThe reason for the shutdown, appended to the message if provided.
  • Display a message every 12 hours, hour, 5 minutes, minute, 30 seconds, 10 seconds and finally seconds

Implements IWorld.

1509{
1510 // Do not show a message for idle shutdown
1512 return;
1513
1514 bool twelveHours = (_shutdownTimer > 12 * HOUR && (_shutdownTimer % (12 * HOUR)) == 0); // > 12 h ; every 12 h
1515 bool oneHour = (_shutdownTimer < 12 * HOUR && (_shutdownTimer % HOUR) == 0); // < 12 h ; every 1 h
1516 bool fiveMin = (_shutdownTimer < 30 * MINUTE && (_shutdownTimer % (5 * MINUTE)) == 0); // < 30 min ; every 5 min
1517 bool oneMin = (_shutdownTimer < 15 * MINUTE && (_shutdownTimer % MINUTE) == 0); // < 15 min ; every 1 min
1518 bool thirtySec = (_shutdownTimer < 5 * MINUTE && (_shutdownTimer % 30) == 0); // < 5 min; every 30 sec
1519 bool tenSec = (_shutdownTimer < 1 * MINUTE && (_shutdownTimer % 10) == 0); // < 1 min; every 10 sec
1520 bool oneSec = (_shutdownTimer < 10 * SECOND && (_shutdownTimer % 1) == 0); // < 10 sec; every 1 sec
1521
1523 if (show || twelveHours || oneHour || fiveMin || oneMin || thirtySec || tenSec || oneSec)
1524 {
1525 std::string str = secsToTimeString(_shutdownTimer).append(".");
1526 if (!reason.empty())
1527 str += " - " + reason;
1528 // Display the reason every 12 hours, hour, 5 minutes, minute. At 60 seconds and at 10 seconds
1529 else if (!_shutdownReason.empty() && (twelveHours || oneHour || fiveMin || oneMin || _shutdownTimer == 60 || _shutdownTimer == 10))
1530 str += " - " + _shutdownReason;
1531
1533 sWorldSessionMgr->SendServerMessage(msgid, str, player);
1534 LOG_WARN("server.worldserver", "Server {} in {}", (_shutdownMask & SHUTDOWN_MASK_RESTART ? "restarting" : "shutdown"), str);
1535 }
1536}
constexpr auto SECOND
Definition Common.h:46
constexpr auto HOUR
Definition Common.h:48
@ SERVER_MSG_SHUTDOWN_TIME
Definition IWorld.h:55
@ SERVER_MSG_RESTART_TIME
Definition IWorld.h:56
#define LOG_WARN(filterType__,...)
Definition Log.h:149
std::string secsToTimeString(uint64 timeInSecs, bool shortText)
Definition Util.cpp:73
std::string _shutdownReason
Definition World.h:267

References _shutdownMask, _shutdownReason, _shutdownTimer, HOUR, LOG_WARN, MINUTE, SECOND, secsToTimeString(), SERVER_MSG_RESTART_TIME, SERVER_MSG_SHUTDOWN_TIME, SHUTDOWN_MASK_IDLE, SHUTDOWN_MASK_RESTART, and sWorldSessionMgr.

Referenced by _UpdateGameTime(), and ShutdownServ().

◆ ShutdownServ()

void World::ShutdownServ ( uint32  time,
uint32  options,
uint8  exitcode,
std::string const &  reason = std::string() 
)
overridevirtual

Shutdown the server.

  • If the shutdown time is 0, set m_stopEvent (except if shutdown is 'idle' with remaining sessions)
  • Else set the shutdown timer and warn users

Implements IWorld.

1467{
1468 // ignore if server shutdown at next tick
1469 if (IsStopped())
1470 return;
1471
1472 _shutdownMask = options;
1473 _exitCode = exitcode;
1474 _shutdownReason = reason;
1475
1476 LOG_DEBUG("server.worldserver", "Server shutdown called with ShutdownMask {}, ExitCode {}, Time {}, Reason {}", ShutdownMask(options), ShutdownExitCode(exitcode), secsToTimeString(time), reason);
1477
1479 if (time == 0)
1480 {
1481 if (!(options & SHUTDOWN_MASK_IDLE) || sWorldSessionMgr->GetActiveAndQueuedSessionCount() == 0)
1482 _stopEvent = true; // exist code already set
1483 else
1484 _shutdownTimer = 1; //So that the session count is re-evaluated at next world tick
1485 }
1487 else
1488 {
1489 _shutdownTimer = time;
1490 ShutdownMsg(true, nullptr, reason);
1491 }
1492
1493 sScriptMgr->OnShutdownInitiate(ShutdownExitCode(exitcode), ShutdownMask(options));
1494}
ShutdownExitCode
Definition World.h:52
ShutdownMask
Definition World.h:46

References _exitCode, _shutdownMask, _shutdownReason, _shutdownTimer, _stopEvent, IsStopped(), LOG_DEBUG, secsToTimeString(), SHUTDOWN_MASK_IDLE, ShutdownMsg(), sScriptMgr, and sWorldSessionMgr.

◆ StopNow()

◆ Update()

void World::Update ( uint32  diff)
overridevirtual

Update the World !

  • Update the game time and check for shutdown time
  • Update the different timers
  • Update Who List Cache

Handle daily quests reset time

Handle weekly quests reset time

Handle monthly quests reset time

Clean logs table

  • Update objects when the timer has passed (maps, transport, creatures, ...)

Update uptime table

  • Process Game events when necessary
  • Ping to keep MySQL connections alive

Implements IWorld.

1103{
1104 METRIC_TIMER("world_update_time_total");
1105
1108 Seconds currentGameTime = GameTime::GetGameTime();
1109
1111
1112 // Record update if recording set in log and diff is greater then minimum set in log
1114
1115 DynamicVisibilityMgr::Update(sWorldSessionMgr->GetActiveSessionCount());
1116
1118 for (int i = 0; i < WUPDATE_COUNT; ++i)
1119 {
1120 if (_timers[i].GetCurrent() >= 0)
1121 _timers[i].Update(diff);
1122 else
1123 _timers[i].SetCurrent(0);
1124 }
1125
1126 // pussywizard: our speed up and functionality
1127 if (_timers[WUPDATE_5_SECS].Passed())
1128 {
1130
1131 // moved here from HandleCharEnumOpcode
1133 CharacterDatabase.Execute(stmt);
1134 }
1135
1137 if (_timers[WUPDATE_WHO_LIST].Passed())
1138 {
1139 METRIC_TIMER("world_update_time", METRIC_TAG("type", "Update who list"));
1141 sWhoListCacheMgr->Update();
1142 }
1143
1144 {
1145 METRIC_TIMER("world_update_time", METRIC_TAG("type", "Check quest reset times"));
1146
1148 if (currentGameTime > _nextDailyQuestReset)
1149 {
1151 }
1152
1154 if (currentGameTime > _nextWeeklyQuestReset)
1155 {
1157 }
1158
1160 if (currentGameTime > _nextMonthlyQuestReset)
1161 {
1163 }
1164 }
1165
1166 if (currentGameTime > _nextRandomBGReset)
1167 {
1168 METRIC_TIMER("world_update_time", METRIC_TAG("type", "Reset random BG"));
1169 ResetRandomBG();
1170 }
1171
1172 if (currentGameTime > _nextCalendarOldEventsDeletionTime)
1173 {
1174 METRIC_TIMER("world_update_time", METRIC_TAG("type", "Delete old calendar events"));
1176 }
1177
1178 if (currentGameTime > _nextGuildReset)
1179 {
1180 METRIC_TIMER("world_update_time", METRIC_TAG("type", "Reset guild cap"));
1181 ResetGuildCap();
1182 }
1183
1184 {
1185 // pussywizard: handle expired auctions, auctions expired when realm was offline are also handled here (not during loading when many required things aren't loaded yet)
1186 METRIC_TIMER("world_update_time", METRIC_TAG("type", "Update expired auctions"));
1187 sAuctionMgr->Update(diff);
1188 }
1189
1190 if (currentGameTime > _mail_expire_check_timer)
1191 {
1192 sObjectMgr->ReturnOrDeleteOldMails(true);
1193 _mail_expire_check_timer = currentGameTime + 6h;
1194 }
1195
1196 {
1197 METRIC_TIMER("world_update_time", METRIC_TAG("type", "Update sessions"));
1198 sWorldSessionMgr->UpdateSessions(diff);
1199 }
1200
1202 if (getIntConfig(CONFIG_LOGDB_CLEARTIME) > 0) // if not enabled, ignore the timer
1203 {
1204 if (_timers[WUPDATE_CLEANDB].Passed())
1205 {
1206 METRIC_TIMER("world_update_time", METRIC_TAG("type", "Clean logs table"));
1207
1209
1212 stmt->SetData(1, uint32(currentGameTime.count()));
1213 LoginDatabase.Execute(stmt);
1214 }
1215 }
1216
1217 {
1218 METRIC_TIMER("world_update_time", METRIC_TAG("type", "Update LFG 0"));
1219 sLFGMgr->Update(diff, 0); // pussywizard: remove obsolete stuff before finding compatibility during map update
1220 }
1221
1222 {
1224 METRIC_TIMER("world_update_time", METRIC_TAG("type", "Update maps"));
1225 sMapMgr->Update(diff);
1226 }
1227
1229 {
1230 if (_timers[WUPDATE_AUTOBROADCAST].Passed())
1231 {
1232 METRIC_TIMER("world_update_time", METRIC_TAG("type", "Send autobroadcast"));
1234 sAutobroadcastMgr->SendAutobroadcasts();
1235 }
1236 }
1237
1238 {
1239 METRIC_TIMER("world_update_time", METRIC_TAG("type", "Update battlegrounds"));
1240 sBattlegroundMgr->Update(diff);
1241 }
1242
1243 {
1244 METRIC_TIMER("world_update_time", METRIC_TAG("type", "Update outdoor pvp"));
1245 sOutdoorPvPMgr->Update(diff);
1246 }
1247
1248 {
1249 METRIC_TIMER("world_update_time", METRIC_TAG("type", "Update worldstate"));
1250 sWorldState->Update(diff);
1251 }
1252
1253 {
1254 METRIC_TIMER("world_update_time", METRIC_TAG("type", "Update battlefields"));
1255 sBattlefieldMgr->Update(diff);
1256 }
1257
1258 {
1259 METRIC_TIMER("world_update_time", METRIC_TAG("type", "Update LFG 2"));
1260 sLFGMgr->Update(diff, 2); // pussywizard: handle created proposals
1261 }
1262
1263 {
1264 METRIC_TIMER("world_update_time", METRIC_TAG("type", "Process query callbacks"));
1265 // execute callbacks from sql queries that were queued recently
1267 }
1268
1270 if (_timers[WUPDATE_UPTIME].Passed())
1271 {
1272 METRIC_TIMER("world_update_time", METRIC_TAG("type", "Update uptime"));
1273
1275
1277 stmt->SetData(0, uint32(GameTime::GetUptime().count()));
1278 stmt->SetData(1, uint16(sWorldSessionMgr->GetMaxPlayerCount()));
1279 stmt->SetData(2, realm.Id.Realm);
1280 stmt->SetData(3, uint32(GameTime::GetStartTime().count()));
1281 LoginDatabase.Execute(stmt);
1282 }
1283
1285 if (_timers[WUPDATE_EVENTS].Passed())
1286 {
1287 METRIC_TIMER("world_update_time", METRIC_TAG("type", "Update game events"));
1288 _timers[WUPDATE_EVENTS].Reset(); // to give time for Update() to be processed
1289 uint32 nextGameEvent = sGameEventMgr->Update();
1290 _timers[WUPDATE_EVENTS].SetInterval(nextGameEvent);
1292 }
1293
1295 if (_timers[WUPDATE_PINGDB].Passed())
1296 {
1297 METRIC_TIMER("world_update_time", METRIC_TAG("type", "Ping MySQL"));
1299 LOG_DEBUG("sql.driver", "Ping MySQL to keep connection alive");
1300 CharacterDatabase.KeepAlive();
1301 LoginDatabase.KeepAlive();
1302 WorldDatabase.KeepAlive();
1303 }
1304
1305 {
1306 METRIC_TIMER("world_update_time", METRIC_TAG("type", "Update instance reset times"));
1307 // update the instance reset times
1308 sInstanceSaveMgr->Update();
1309 }
1310
1311 {
1312 METRIC_TIMER("world_update_time", METRIC_TAG("type", "Process cli commands"));
1313 // And last, but not least handle the issued cli commands
1315 }
1316
1317 {
1318 METRIC_TIMER("world_update_time", METRIC_TAG("type", "Update world scripts"));
1319 sScriptMgr->OnWorldUpdate(diff);
1320 }
1321
1322 {
1323 METRIC_TIMER("world_update_time", METRIC_TAG("type", "Update metrics"));
1324 // Stats logger update
1325 sMetric->Update();
1326 METRIC_VALUE("update_time_diff", diff);
1327 }
1328}
@ CHAR_DEL_EXPIRED_BANS
Definition CharacterDatabase.h:34
@ LOGIN_UPD_UPTIME_PLAYERS
Definition LoginDatabase.h:77
@ LOGIN_DEL_OLD_LOGS
Definition LoginDatabase.h:78
#define METRIC_VALUE(category, value,...)
Definition Metric.h:197
#define METRIC_TAG(name, value)
Definition Metric.h:163
#define METRIC_TIMER(category,...)
Definition Metric.h:206
#define sWhoListCacheMgr
Definition WhoListCacheMgr.h:96
@ CONFIG_AUTOBROADCAST
Definition WorldConfig.h:91
static void Update(uint32 sessionCount)
Definition DynamicVisibility.cpp:22
void UpdateWithDiff(uint32 diff)
Definition UpdateTime.cpp:102
void RecordUpdateTime(Milliseconds gameTimeMs, uint32 diff, uint32 sessionCount)
Definition UpdateTime.cpp:163
void ProcessCliCommands() override
Definition World.cpp:1558
void _UpdateGameTime()
Update the game time.
Definition World.cpp:1436
void ResetMonthlyQuests()
Definition World.cpp:1722
void ResetGuildCap()
Definition World.cpp:1785
void ResetWeeklyQuests()
Definition World.cpp:1705
void ResetRandomBG()
Definition World.cpp:1760
void ResetDailyQuests()
Definition World.cpp:1669
void CalendarDeleteOldEvents()
Definition World.cpp:1776
void ProcessQueryCallbacks()
Definition World.cpp:1823
@ WUPDATE_COUNT
Definition World.h:69
Milliseconds GetGameTimeMS()
Definition GameTime.cpp:43
Seconds GetUptime()
Uptime.
Definition GameTime.cpp:58
void Update(time_t diff)
Definition Timer.h:152
void SetCurrent(time_t current)
Definition Timer.h:174

References _mail_expire_check_timer, _nextCalendarOldEventsDeletionTime, _nextDailyQuestReset, _nextGuildReset, _nextMonthlyQuestReset, _nextRandomBGReset, _nextWeeklyQuestReset, _timers, _UpdateGameTime(), CalendarDeleteOldEvents(), CHAR_DEL_EXPIRED_BANS, CharacterDatabase, CONFIG_AUTOBROADCAST, CONFIG_LOGDB_CLEARTIME, getBoolConfig(), GameTime::GetGameTime(), GameTime::GetGameTimeMS(), getIntConfig(), GameTime::GetStartTime(), GameTime::GetUptime(), Realm::Id, LOG_DEBUG, LOGIN_DEL_OLD_LOGS, LOGIN_UPD_UPTIME_PLAYERS, LoginDatabase, METRIC_TAG, METRIC_TIMER, METRIC_VALUE, ProcessCliCommands(), ProcessQueryCallbacks(), realm, RealmHandle::Realm, WorldUpdateTime::RecordUpdateTime(), IntervalTimer::Reset(), ResetDailyQuests(), ResetGuildCap(), ResetMonthlyQuests(), ResetRandomBG(), ResetWeeklyQuests(), sAuctionMgr, sAutobroadcastMgr, sBattlefieldMgr, sBattlegroundMgr, IntervalTimer::SetCurrent(), PreparedStatementBase::SetData(), IntervalTimer::SetInterval(), sGameEventMgr, sInstanceSaveMgr, sLFGMgr, sMapMgr, sMetric, sObjectMgr, sOutdoorPvPMgr, sScriptMgr, sWhoListCacheMgr, sWorldSessionMgr, sWorldState, sWorldUpdateTime, IntervalTimer::Update(), DynamicVisibilityMgr::Update(), UpdateTime::UpdateWithDiff(), WorldDatabase, WUPDATE_5_SECS, WUPDATE_AUTOBROADCAST, WUPDATE_CLEANDB, WUPDATE_COUNT, WUPDATE_EVENTS, WUPDATE_PINGDB, WUPDATE_UPTIME, and WUPDATE_WHO_LIST.

◆ UpdateAreaDependentAuras()

void World::UpdateAreaDependentAuras ( )
overridevirtual

Implements IWorld.

1813{
1814 WorldSessionMgr::SessionMap const& sessionMap = sWorldSessionMgr->GetAllSessions();
1815 for (WorldSessionMgr::SessionMap::const_iterator itr = sessionMap.begin(); itr != sessionMap.end(); ++itr)
1816 if (itr->second && itr->second->GetPlayer() && itr->second->GetPlayer()->IsInWorld())
1817 {
1818 itr->second->GetPlayer()->UpdateAreaDependentAuras(itr->second->GetPlayer()->GetAreaId());
1819 itr->second->GetPlayer()->UpdateZoneDependentAuras(itr->second->GetPlayer()->GetZoneId());
1820 }
1821}

References sWorldSessionMgr.

◆ UpdateRealmCharCount()

void World::UpdateRealmCharCount ( uint32  accid)
overridevirtual

Implements IWorld.

1577{
1579 stmt->SetData(0, accountId);
1580 _queryProcessor.AddCallback(CharacterDatabase.AsyncQuery(stmt).WithPreparedCallback(std::bind(&World::_UpdateRealmCharCount, this, std::placeholders::_1,accountId)));
1581}
@ CHAR_SEL_CHARACTER_COUNT
Definition CharacterDatabase.h:136
T & AddCallback(T &&query)
Definition AsyncCallbackProcessor.h:34
void _UpdateRealmCharCount(PreparedQueryResult resultCharCount, uint32 accountId)
Definition World.cpp:1583

References _queryProcessor, _UpdateRealmCharCount(), AsyncCallbackProcessor< T >::AddCallback(), CHAR_SEL_CHARACTER_COUNT, CharacterDatabase, and PreparedStatementBase::SetData().

Member Data Documentation

◆ _allowedSecurityLevel

AccountTypes World::_allowedSecurityLevel
private

◆ _allowMovement

bool World::_allowMovement
private

◆ _availableDbcLocaleMask

uint32 World::_availableDbcLocaleMask
private

◆ _cleaningFlags

uint32 World::_cleaningFlags
private

◆ _cliCmdQueue

LockedQueue<CliCommandHolder*> World::_cliCmdQueue
private

◆ _dataPath

std::string World::_dataPath
private

◆ _dbClientCacheVersion

uint32 World::_dbClientCacheVersion
private

◆ _dbVersion

std::string World::_dbVersion
private

Referenced by GetDBVersion(), and LoadDBVersion().

◆ _defaultDbcLocale

LocaleConstant World::_defaultDbcLocale
private

◆ _exitCode

uint8 World::_exitCode = SHUTDOWN_EXIT_CODE
staticprivate

◆ _isClosed

bool World::_isClosed
private

Referenced by IsClosed(), SetClosed(), and World().

◆ _mail_expire_check_timer

Seconds World::_mail_expire_check_timer
private

◆ _maxVisibleDistanceInBGArenas

float World::_maxVisibleDistanceInBGArenas = DEFAULT_VISIBILITY_BGARENAS
staticprivate

◆ _maxVisibleDistanceInInstances

float World::_maxVisibleDistanceInInstances = DEFAULT_VISIBILITY_INSTANCE
staticprivate

◆ _maxVisibleDistanceOnContinents

float World::_maxVisibleDistanceOnContinents = DEFAULT_VISIBILITY_DISTANCE
staticprivate

◆ _nextCalendarOldEventsDeletionTime

Seconds World::_nextCalendarOldEventsDeletionTime
private

◆ _nextDailyQuestReset

Seconds World::_nextDailyQuestReset
private

◆ _nextGuildReset

Seconds World::_nextGuildReset
private

◆ _nextMonthlyQuestReset

Seconds World::_nextMonthlyQuestReset
private

◆ _nextRandomBGReset

Seconds World::_nextRandomBGReset
private

◆ _nextWeeklyQuestReset

Seconds World::_nextWeeklyQuestReset
private

◆ _queryProcessor

QueryCallbackProcessor World::_queryProcessor
private

◆ _realmName

std::string World::_realmName
private

Referenced by GetRealmName(), and SetRealmName().

◆ _shutdownMask

uint32 World::_shutdownMask
private

◆ _shutdownReason

std::string World::_shutdownReason
private

Referenced by ShutdownMsg(), and ShutdownServ().

◆ _shutdownTimer

◆ _stopEvent

std::atomic_long World::_stopEvent = false
staticprivate

◆ _timers

◆ _worldConfig

◆ m_worldLoopCounter

uint32 World::m_worldLoopCounter = 0
static

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