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

The World. More...

#include <World.h>

Public Types

typedef std::list< WorldSession * > Queue
 

Public Member Functions

WorldSessionFindSession (uint32 id) const
 Find a session by its id. More...
 
void AddSession (WorldSession *s)
 
void AddInstanceSocket (std::weak_ptr< WorldSocket > sock, uint64 connectToKey)
 
void SendAutoBroadcast ()
 
bool RemoveSession (uint32 id)
 Remove a given session. More...
 
void UpdateMaxSessionCounters ()
 Get the number of current active sessions. More...
 
const SessionMapGetAllSessions () const
 
uint32 GetActiveAndQueuedSessionCount () const
 
uint32 GetActiveSessionCount () const
 
uint32 GetQueuedSessionCount () const
 
uint32 GetMaxQueuedSessionCount () const
 Get the maximum number of parallel sessions on the server since last reboot. More...
 
uint32 GetMaxActiveSessionCount () const
 
uint32 GetPlayerCount () const
 Get number of players. More...
 
uint32 GetMaxPlayerCount () const
 
void IncreasePlayerCount ()
 Increase/Decrease number of players. More...
 
void DecreasePlayerCount ()
 
PlayerFindPlayerInZone (uint32 zone)
 Find a player in a specified zone. More...
 
bool IsClosed () const
 Deny clients? More...
 
void SetClosed (bool val)
 Close world. More...
 
AccountTypes GetPlayerSecurityLimit () const
 Security level limitations. More...
 
void SetPlayerSecurityLimit (AccountTypes sec)
 
void LoadDBAllowedSecurityLevel ()
 
void SetPlayerAmountLimit (uint32 limit)
 Active session server limit. More...
 
uint32 GetPlayerAmountLimit () const
 
void AddQueuedPlayer (WorldSession *)
 
bool RemoveQueuedPlayer (WorldSession *session)
 
int32 GetQueuePos (WorldSession *)
 
bool HasRecentlyDisconnected (WorldSession *)
 
bool getAllowMovement () const
 
void SetAllowMovement (bool allow)
 Allow/Disallow object movements. More...
 
void SetMotd (std::string motd)
 Set a new Message of the Day. More...
 
std::vector< std::string > constGetMotd () const
 Get the current Message of the Day. More...
 
void SetNewCharString (std::string const &str)
 Set the string for new characters (first login) More...
 
std::string constGetNewCharString () const
 Get the string for new characters (first login) More...
 
LocaleConstant GetDefaultDbcLocale () const
 
std::string constGetDataPath () const
 Get the path where data (dbc, maps) are stored on disk. More...
 
time_t constGetStartTime () const
 When server started? More...
 
time_t constGetGameTime () const
 What time is it? More...
 
uint32 GetUptime () const
 Uptime (in secs) More...
 
uint32 GetUpdateTime () const
 Update time. More...
 
void SetRecordDiffInterval (int32 t)
 
time_t GetNextDailyQuestsResetTime () const
 Next daily quests and random bg reset time. More...
 
time_t GetNextWeeklyQuestsResetTime () const
 
time_t GetNextRandomBGResetTime () const
 
uint16 GetConfigMaxSkillValue () const
 Get the maximum skill level a player can reach. More...
 
void SetInitialWorldSettings ()
 Initialize the World. More...
 
void LoadConfigSettings (bool reload=false)
 Initialize config values. More...
 
void SendWorldText (uint32 string_id,...)
 Send a System Message to all players (except self if mentioned) More...
 
void SendGlobalText (const char *text, WorldSession *self)
 DEPRECATED, only for debug purpose. Send a System Message to all players (except self if mentioned) More...
 
void SendGMText (uint32 string_id,...)
 Send a System Message to all GMs (except self if mentioned) More...
 
void SendServerMessage (ServerMessageType messageID, std::string stringParam="", Player *player=NULL)
 Send a server message to the user(s) More...
 
void SendGlobalMessage (WorldPacket const *packet, WorldSession *self=nullptr, uint32 team=0)
 Send a packet to all players (except self if mentioned) More...
 
void SendGlobalGMMessage (WorldPacket const *packet, WorldSession *self=nullptr, uint32 team=0)
 Send a packet to all GMs (except self if mentioned) More...
 
bool SendZoneMessage (uint32 zone, WorldPacket const *packet, WorldSession *self=nullptr, uint32 team=0)
 Send a packet to all players (or players selected team) in the zone (except self if mentioned) More...
 
void SendZoneText (uint32 zone, const char *text, WorldSession *self=nullptr, uint32 team=0)
 Send a System Message to all players in the zone (except self if mentioned) More...
 
bool IsShuttingDown () const
 Are we in the middle of a shutdown? More...
 
uint32 GetShutDownTimeLeft () const
 
void ShutdownServ (uint32 time, uint32 options, uint8 exitcode, const std::string &reason=std::string())
 Shutdown the server. More...
 
void ShutdownCancel ()
 Cancel a planned server shutdown. More...
 
void ShutdownMsg (bool show=false, Player *player=NULL, const std::string &reason=std::string())
 Display a shutdown message to the user(s) More...
 
void Update (uint32 diff)
 Update the World ! More...
 
void UpdateSessions (uint32 diff)
 
void setRate (Rates rate, float value)
 Set a server rate (see Rates) More...
 
float getRate (Rates rate) const
 Get a server rate (see Rates) More...
 
void setBoolConfig (WorldBoolConfigs index, bool value)
 Set a server configuration element (see #WorldConfigs) More...
 
bool getBoolConfig (WorldBoolConfigs index) const
 Get a server configuration element (see #WorldConfigs) More...
 
void setFloatConfig (WorldFloatConfigs index, float value)
 Set a server configuration element (see #WorldConfigs) More...
 
float getFloatConfig (WorldFloatConfigs index) const
 Get a server configuration element (see #WorldConfigs) More...
 
void setIntConfig (WorldIntConfigs index, uint32 value)
 Set a server configuration element (see #WorldConfigs) More...
 
uint32 getIntConfig (WorldIntConfigs index) const
 Get a server configuration element (see #WorldConfigs) More...
 
void setWorldState (uint32 index, uint64 value)
 
uint64 getWorldState (uint32 index) const
 
void LoadWorldStates ()
 
bool IsPvPRealm () const
 Are we on a "Player versus Player" server? More...
 
bool IsFFAPvPRealm () const
 
void KickAll ()
 Kick (and save) all players. More...
 
void KickAllLess (AccountTypes sec)
 Kick (and save) all players with security level less sec More...
 
BanReturn BanAccount (BanMode mode, std::string const &nameOrIP, std::string const &duration, std::string const &reason, std::string const &author)
 Ban an account or ban an IP address, duration will be parsed using TimeStringToSecs if it is positive, otherwise permban. More...
 
BanReturn BanAccount (BanMode mode, std::string const &nameOrIP, uint32 duration_secs, std::string const &reason, std::string const &author)
 Ban an account or ban an IP address, duration is in seconds if positive, otherwise permban. More...
 
bool RemoveBanAccount (BanMode mode, std::string const &nameOrIP)
 Remove a ban from an account or IP address. More...
 
BanReturn BanCharacter (std::string const &name, std::string const &duration, std::string const &reason, std::string const &author)
 Ban an account or ban an IP address, duration will be parsed using TimeStringToSecs if it is positive, otherwise permban. More...
 
bool RemoveBanCharacter (std::string const &name)
 Remove a ban from a character. More...
 
void ProcessCliCommands ()
 
void QueueCliCommand (CliCommandHolder *commandHolder)
 
void ForceGameEventUpdate ()
 
void UpdateRealmCharCount (uint32 accid)
 
LocaleConstant GetAvailableDbcLocale (LocaleConstant locale) const
 
void LoadDBVersion ()
 
char constGetDBVersion () const
 
void ResetTimeDiffRecord ()
 
void RecordTimeDiff (std::string const &text)
 
void LoadAutobroadcasts ()
 
void UpdateAreaDependentAuras ()
 
CharacterInfo constGetCharacterInfo (ObjectGuid const &guid) const
 Loads several pieces of information on server startup with the GUID There is no further database query necessary. These are a number of methods that work into the calling function. More...
 
void AddCharacterInfo (ObjectGuid const &guid, uint32 accountId, std::string const &name, uint8 gender, uint8 race, uint8 playerClass, uint8 level, bool isDeleted)
 
void DeleteCharacterInfo (ObjectGuid const &guid)
 
bool HasCharacterInfo (ObjectGuid const &guid)
 
void UpdateCharacterInfo (ObjectGuid const &guid, std::string const &name, uint8 gender=GENDER_NONE, uint8 race=RACE_NONE)
 
void UpdateCharacterInfoLevel (ObjectGuid const &guid, uint8 level)
 
void UpdateCharacterInfoDeleted (ObjectGuid const &guid, bool deleted, std::string const *name=nullptr)
 
uint32 GetCleaningFlags () const
 
void SetCleaningFlags (uint32 flags)
 
void ResetEventSeasonalQuests (uint16 event_id)
 
void ReloadRBAC ()
 
void RemoveOldCorpses ()
 

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 int32 GetVisibilityNotifyPeriodOnContinents ()
 
static int32 GetVisibilityNotifyPeriodInInstances ()
 
static int32 GetVisibilityNotifyPeriodInBGArenas ()
 

Static Public Attributes

static std::atomic< uint32m_worldLoopCounter
 

Protected Member Functions

void _UpdateGameTime ()
 Update the game time. More...
 
void _UpdateRealmCharCount (PreparedQueryResult resultCharCount)
 
void InitDailyQuestResetTime ()
 
void InitWeeklyQuestResetTime ()
 
void InitMonthlyQuestResetTime ()
 
void InitRandomBGResetTime ()
 
void InitGuildResetTime ()
 
void InitCurrencyResetTime ()
 
void DailyReset ()
 
void ResetWeeklyQuests ()
 
void ResetMonthlyQuests ()
 
void ResetRandomBG ()
 
void ResetGuildCap ()
 
void ResetCurrencyWeekCap ()
 

Private Types

typedef std::unordered_map
< uint32, time_t > 
DisconnectMap
 
typedef std::map< uint32, uint64WorldStatesMap
 
typedef std::map< uint8,
std::string > 
AutobroadcastsMap
 
typedef std::map< uint8, uint8AutobroadcastsWeightMap
 
typedef std::map< ObjectGuid,
CharacterInfo
CharacterInfoContainer
 

Private Member Functions

 World ()
 World constructor. More...
 
 ~World ()
 World destructor. More...
 
void AddSession_ (WorldSession *s)
 
void ProcessLinkInstanceSocket (std::pair< std::weak_ptr< WorldSocket >, uint64 > linkInfo)
 
void LoadCharacterInfoStore ()
 
void ProcessQueryCallbacks ()
 

Private Attributes

uint32 m_ShutdownTimer
 
uint32 m_ShutdownMask
 
uint32 m_CleaningFlags
 
bool m_isClosed
 
time_t m_startTime
 
time_t m_gameTime
 
IntervalTimer m_timers [WUPDATE_COUNT]
 
time_t mail_timer
 
time_t mail_timer_expires
 
uint32 m_updateTime
 
uint32 m_updateTimeSum
 
uint32 m_updateTimeCount
 
uint32 m_currentTime
 
SessionMap m_sessions
 
DisconnectMap m_disconnects
 
uint32 m_maxActiveSessionCount
 
uint32 m_maxQueuedSessionCount
 
uint32 m_PlayerCount
 
uint32 m_MaxPlayerCount
 
std::string m_newCharString
 
float rate_values [MAX_RATES]
 
uint32 m_int_configs [INT_CONFIG_VALUE_COUNT]
 
bool m_bool_configs [BOOL_CONFIG_VALUE_COUNT]
 
float m_float_configs [FLOAT_CONFIG_VALUE_COUNT]
 
WorldStatesMap m_worldstates
 
uint32 m_playerLimit
 
AccountTypes m_allowedSecurityLevel
 
LocaleConstant m_defaultDbcLocale
 
uint32 m_availableDbcLocaleMask
 
bool m_allowMovement
 
std::vector< std::string > _motd
 
std::string m_dataPath
 
LockedQueue< CliCommandHolder * > cliCmdQueue
 
time_t m_NextDailyQuestReset
 
time_t m_NextWeeklyQuestReset
 
time_t m_NextMonthlyQuestReset
 
time_t m_NextRandomBGReset
 
time_t m_NextGuildReset
 
time_t m_NextCurrencyReset
 
Queue m_QueuedPlayer
 
LockedQueue< WorldSession * > addSessQueue
 
LockedQueue< std::pair
< std::weak_ptr< WorldSocket >
, uint64 > > 
_linkSocketQueue
 
std::string m_DBVersion
 
AutobroadcastsMap m_Autobroadcasts
 
AutobroadcastsWeightMap m_AutobroadcastsWeights
 
CharacterInfoContainer _characterInfoStore
 
std::deque
< PreparedQueryResultFuture
m_realmCharCallbacks
 

Static Private Attributes

static std::atomic< boolm_stopEvent
 
static uint8 m_ExitCode = SHUTDOWN_EXIT_CODE
 
static float m_MaxVisibleDistanceOnContinents = DEFAULT_VISIBILITY_DISTANCE
 
static float m_MaxVisibleDistanceInInstances = DEFAULT_VISIBILITY_INSTANCE
 
static float m_MaxVisibleDistanceInBGArenas = DEFAULT_VISIBILITY_BGARENAS
 
static int32 m_visibility_notify_periodOnContinents = DEFAULT_VISIBILITY_NOTIFY_PERIOD
 
static int32 m_visibility_notify_periodInInstances = DEFAULT_VISIBILITY_NOTIFY_PERIOD
 
static int32 m_visibility_notify_periodInBGArenas = DEFAULT_VISIBILITY_NOTIFY_PERIOD
 

Detailed Description

The World.

Member Typedef Documentation

typedef std::map<uint8, std::string> World::AutobroadcastsMap
private
typedef std::map<uint8, uint8> World::AutobroadcastsWeightMap
private
typedef std::unordered_map<uint32, time_t> World::DisconnectMap
private
typedef std::list<WorldSession*> World::Queue
typedef std::map<uint32, uint64> World::WorldStatesMap
private

Constructor & Destructor Documentation

World::World ( )
private

World constructor.

93 {
94  m_playerLimit = 0;
96  m_allowMovement = true;
97  m_ShutdownMask = 0;
98  m_ShutdownTimer = 0;
99  m_gameTime = time(NULL);
103  m_PlayerCount = 0;
104  m_MaxPlayerCount = 0;
109  m_NextGuildReset = 0;
111 
114 
115  mail_timer = 0;
116  mail_timer_expires = 0;
117  m_updateTime = 0;
118  m_updateTimeSum = 0;
119  m_updateTimeCount = 0;
120  m_currentTime = 0;
121 
122  m_isClosed = false;
123 
124  m_CleaningFlags = 0;
125 
126  memset(rate_values, 0, sizeof(rate_values));
127  memset(m_int_configs, 0, sizeof(m_int_configs));
128  memset(m_bool_configs, 0, sizeof(m_bool_configs));
129  memset(m_float_configs, 0, sizeof(m_float_configs));
130 }
time_t m_NextMonthlyQuestReset
Definition: World.h:851
uint32 m_CleaningFlags
Definition: World.h:799
time_t m_NextDailyQuestReset
Definition: World.h:849
uint32 m_updateTimeCount
Definition: World.h:809
bool m_isClosed
Definition: World.h:801
time_t m_NextGuildReset
Definition: World.h:853
uint32 m_PlayerCount
Definition: World.h:817
Definition: Common.h:108
AccountTypes m_allowedSecurityLevel
Definition: World.h:829
time_t m_gameTime
Definition: World.h:804
arena_t NULL
Definition: jemalloc_internal.h:624
uint32 m_maxActiveSessionCount
Definition: World.h:815
uint32 m_availableDbcLocaleMask
Definition: World.h:831
bool m_bool_configs[BOOL_CONFIG_VALUE_COUNT]
Definition: World.h:824
time_t mail_timer
Definition: World.h:806
time_t m_startTime
Definition: World.h:803
uint32 m_updateTime
Definition: World.h:808
uint32 m_int_configs[INT_CONFIG_VALUE_COUNT]
Definition: World.h:823
float m_float_configs[FLOAT_CONFIG_VALUE_COUNT]
Definition: World.h:825
uint32 m_ShutdownMask
Definition: World.h:797
uint32 m_MaxPlayerCount
Definition: World.h:818
uint32 m_maxQueuedSessionCount
Definition: World.h:816
time_t mail_timer_expires
Definition: World.h:807
time_t m_NextRandomBGReset
Definition: World.h:852
float rate_values[MAX_RATES]
Definition: World.h:822
uint32 m_updateTimeSum
Definition: World.h:808
time_t m_NextCurrencyReset
Definition: World.h:854
Definition: Common.h:117
uint32 m_currentTime
Definition: World.h:810
LocaleConstant m_defaultDbcLocale
Definition: World.h:830
bool m_allowMovement
Definition: World.h:832
uint32 m_ShutdownTimer
Definition: World.h:796
uint32 m_playerLimit
Definition: World.h:828
time_t m_NextWeeklyQuestReset
Definition: World.h:850
World::~World ( )
private

World destructor.

  • Empty the kicked session set
Todo:
free addSessQueue
134 {
136  while (!m_sessions.empty())
137  {
138  // not remove from queue, prevent loading new sessions
139  delete m_sessions.begin()->second;
140  m_sessions.erase(m_sessions.begin());
141  }
142 
143  CliCommandHolder* command = NULL;
144  while (cliCmdQueue.next(command))
145  delete command;
146 
149 
151 }
SessionMap m_sessions
Definition: World.h:812
static void clear()
Definition: MMapFactory.cpp:36
arena_t NULL
Definition: jemalloc_internal.h:624
Storage class for commands issued for delayed execution.
Definition: World.h:507
static void clear()
Definition: VMapFactory.cpp:37
bool next(T &result)
Gets the next result in the queue, if any.
Definition: LockedQueue.h:69
LockedQueue< CliCommandHolder * > cliCmdQueue
Definition: World.h:846

+ Here is the call graph for this function:

Member Function Documentation

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
2725 {
2727  time_t thisTime = time(NULL);
2728  uint32 elapsed = uint32(thisTime - m_gameTime);
2729  m_gameTime = thisTime;
2730 
2732  if (!IsStopped() && m_ShutdownTimer > 0 && elapsed > 0)
2733  {
2735  if (m_ShutdownTimer <= elapsed)
2736  {
2738  m_stopEvent = true; // exist code already set
2739  else
2740  m_ShutdownTimer = 1; // minimum timer value to wait idle state
2741  }
2743  else
2744  {
2745  m_ShutdownTimer -= elapsed;
2746 
2747  ShutdownMsg();
2748  }
2749  }
2750 }
static std::atomic< bool > m_stopEvent
Definition: World.h:794
uint32 GetActiveAndQueuedSessionCount() const
Definition: World.h:559
time_t m_gameTime
Definition: World.h:804
arena_t NULL
Definition: jemalloc_internal.h:624
static bool IsStopped()
Definition: World.h:663
uint32_t uint32
Definition: Define.h:150
uint32 m_ShutdownMask
Definition: World.h:797
void ShutdownMsg(bool show=false, Player *player=NULL, const std::string &reason=std::string())
Display a shutdown message to the user(s)
Definition: World.cpp:2781
uint32 m_ShutdownTimer
Definition: World.h:796
uint32_t uint32
Definition: g3dmath.h:168
Definition: World.h:68

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void World::_UpdateRealmCharCount ( PreparedQueryResult  resultCharCount)
protected
2949 {
2950  if (resultCharCount)
2951  {
2952  Field* fields = resultCharCount->Fetch();
2953  uint32 accountId = fields[0].GetUInt32();
2954  uint8 charCount = uint8(fields[1].GetUInt64());
2955 
2957  stmt->setUInt32(0, accountId);
2958  stmt->setUInt32(1, realm.Id.Realm);
2959  LoginDatabase.Execute(stmt);
2960 
2962  stmt->setUInt8(0, charCount);
2963  stmt->setUInt32(1, accountId);
2964  stmt->setUInt32(2, realm.Id.Realm);
2965  LoginDatabase.Execute(stmt);
2966  }
2967 }
uint32 Realm
Definition: Realm.h:53
void Execute(const char *sql)
Definition: DatabaseWorkerPool.h:87
Realm realm
Definition: World.cpp:3485
Class used to access individual fields of database query result.
Definition: Field.h:56
void setUInt8(const uint8 index, const uint8 value)
Definition: PreparedStatement.cpp:97
Definition: PreparedStatement.h:74
LoginDatabaseWorkerPool LoginDatabase
Accessor to the realm/login database.
Definition: DatabaseEnv.cpp:22
Definition: LoginDatabase.h:58
Battlenet::RealmHandle Id
Definition: Realm.h:86
uint32_t uint32
Definition: Define.h:150
Definition: LoginDatabase.h:56
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
void setUInt32(const uint8 index, const uint32 value)
Definition: PreparedStatement.cpp:115
uint8_t uint8
Definition: g3dmath.h:164
uint32 GetUInt32() const
Definition: Field.h:146
uint8_t uint8
Definition: Define.h:152

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void World::AddCharacterInfo ( ObjectGuid const guid,
uint32  accountId,
std::string const name,
uint8  gender,
uint8  race,
uint8  playerClass,
uint8  level,
bool  isDeleted 
)
3420 {
3421  CharacterInfo& data = _characterInfoStore[guid];
3422  data.Name = name;
3423  data.AccountId = accountId;
3424  data.Race = race;
3425  data.Sex = gender;
3426  data.Class = playerClass;
3427  data.Level = level;
3428  data.IsDeleted = isDeleted;
3429 }
std::string Name
Definition: World.h:534
CharacterInfoContainer _characterInfoStore
Definition: World.h:876
uint8 Sex
Definition: World.h:538
bool IsDeleted
Definition: World.h:540
uint8 Level
Definition: World.h:539
uint8 Race
Definition: World.h:537
Definition: World.h:532
uint32 AccountId
Definition: World.h:535
uint8 Class
Definition: World.h:536

+ Here is the caller graph for this function:

void World::AddInstanceSocket ( std::weak_ptr< WorldSocket sock,
uint64  connectToKey 
)
240 {
241  _linkSocketQueue.add(std::make_pair(sock, connectToKey));
242 }
void add(const T &item)
Adds an item to the queue.
Definition: LockedQueue.h:51
LockedQueue< std::pair< std::weak_ptr< WorldSocket >, uint64 > > _linkSocketQueue
Definition: World.h:864

+ Here is the call graph for this function:

void World::AddQueuedPlayer ( WorldSession sess)
368 {
369  sess->SetInQueue(true);
370  m_QueuedPlayer.push_back(sess);
371 
372  // The 1st SMSG_AUTH_RESPONSE needs to contain other info too.
373  sess->SendAuthResponse(ERROR_OK, true, GetQueuePos(sess));
374 }
void SetInQueue(bool state)
Session in auth.queue currently.
Definition: WorldSession.h:940
Queue m_QueuedPlayer
Definition: World.h:857
void SendAuthResponse(uint32 code, bool queued, uint32 queuePos=0)
Definition: AuthHandler.cpp:25
Definition: BattlenetRpcErrorCodes.h:25
int32 GetQueuePos(WorldSession *)
Definition: World.cpp:356

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void World::AddSession ( WorldSession s)
235 {
236  addSessQueue.add(s);
237 }
LockedQueue< WorldSession * > addSessQueue
Definition: World.h:861
void add(const T &item)
Adds an item to the queue.
Definition: LockedQueue.h:51

+ Here is the call graph for this function:

void World::AddSession_ ( WorldSession s)
private
  • kick already loaded player with same account (if any) and remove session
  • if player is in loading and want to load again, return
245 {
246  ASSERT(s);
247 
248  //NOTE - Still there is race condition in WorldSession* being used in the Sockets
249 
252  if (!RemoveSession (s->GetAccountId()))
253  {
254  s->KickPlayer();
255  delete s; // session not added yet in session list, so not listed in queue
256  return;
257  }
258 
259  // decrease session counts only at not reconnection case
260  bool decrease_session = true;
261 
262  // if session already exist, prepare to it deleting at next world update
263  // NOTE - KickPlayer() should be called on "old" in RemoveSession()
264  {
265  SessionMap::const_iterator old = m_sessions.find(s->GetAccountId());
266 
267  if (old != m_sessions.end())
268  {
269  // prevent decrease sessions count if session queued
270  if (RemoveQueuedPlayer(old->second))
271  decrease_session = false;
272  // not remove replaced session form queue if listed
273  delete old->second;
274  }
275  }
276 
277  m_sessions[s->GetAccountId()] = s;
278 
280  uint32 pLimit = GetPlayerAmountLimit();
281  uint32 QueueSize = GetQueuedSessionCount(); //number of players in the queue
282 
283  //so we don't count the user trying to
284  //login as a session and queue the socket that we are using
285  if (decrease_session)
286  --Sessions;
287 
288  if (pLimit > 0 && Sessions >= pLimit && !s->HasPermission(rbac::RBAC_PERM_SKIP_QUEUE) && !HasRecentlyDisconnected(s))
289  {
290  AddQueuedPlayer(s);
292  TC_LOG_INFO("misc", "PlayerQueue: Account id %u is in Queue Position (%u).", s->GetAccountId(), ++QueueSize);
293  return;
294  }
295 
296  s->InitializeSession();
297 
299 
300  // Updates the population
301  if (pLimit > 0)
302  {
303  float popu = (float)GetActiveSessionCount(); // updated number of users on the server
304  popu /= pLimit;
305  popu *= 2;
306  TC_LOG_INFO("misc", "Server Population (%f).", popu);
307  }
308 }
void UpdateMaxSessionCounters()
Get the number of current active sessions.
Definition: World.cpp:3256
uint32 GetActiveAndQueuedSessionCount() const
Definition: World.h:559
SessionMap m_sessions
Definition: World.h:812
bool HasRecentlyDisconnected(WorldSession *)
Definition: World.cpp:334
uint32 GetAccountId() const
Definition: WorldSession.h:922
void KickPlayer()
Kick a player out of the World.
Definition: WorldSession.cpp:646
uint32_t uint32
Definition: Define.h:150
bool RemoveQueuedPlayer(WorldSession *session)
Definition: World.cpp:376
void InitializeSession()
Definition: WorldSession.cpp:1189
uint32 GetPlayerAmountLimit() const
Definition: World.h:591
uint32 GetQueuedSessionCount() const
Definition: World.h:561
bool RemoveSession(uint32 id)
Remove a given session.
Definition: World.cpp:218
void AddQueuedPlayer(WorldSession *)
Definition: World.cpp:367
#define ASSERT
Definition: Errors.h:55
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
bool HasPermission(uint32 permissionId)
Definition: WorldSession.cpp:1259
uint32 GetActiveSessionCount() const
Definition: World.h:560
Definition: RBAC.h:54

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

BanReturn World::BanAccount ( BanMode  mode,
std::string const nameOrIP,
std::string const duration,
std::string const reason,
std::string const author 
)

Ban an account or ban an IP address, duration will be parsed using TimeStringToSecs if it is positive, otherwise permban.

2554 {
2555  uint32 duration_secs = TimeStringToSecs(duration);
2556  return BanAccount(mode, nameOrIP, duration_secs, reason, author);
2557 }
BanReturn BanAccount(BanMode mode, std::string const &nameOrIP, std::string const &duration, std::string const &reason, std::string const &author)
Ban an account or ban an IP address, duration will be parsed using TimeStringToSecs if it is positive...
Definition: World.cpp:2553
uint32 TimeStringToSecs(const std::string &timestring)
Definition: Util.cpp:163
uint32_t uint32
Definition: Define.h:150

+ Here is the call graph for this function:

BanReturn World::BanAccount ( BanMode  mode,
std::string const nameOrIP,
uint32  duration_secs,
std::string const reason,
std::string const author 
)

Ban an account or ban an IP address, duration is in seconds if positive, otherwise permban.

  • Update the database with ban information
  • Disconnect all affected players (for IP it can be several)
2561 {
2562  PreparedQueryResult resultAccounts = PreparedQueryResult(NULL); //used for kicking
2563  PreparedStatement* stmt = NULL;
2564 
2566  switch (mode)
2567  {
2568  case BAN_IP:
2569  // No SQL injection with prepared statements
2571  stmt->setString(0, nameOrIP);
2572  resultAccounts = LoginDatabase.Query(stmt);
2574  stmt->setString(0, nameOrIP);
2575  stmt->setUInt32(1, duration_secs);
2576  stmt->setString(2, author);
2577  stmt->setString(3, reason);
2578  LoginDatabase.Execute(stmt);
2579  break;
2580  case BAN_ACCOUNT:
2581  // No SQL injection with prepared statements
2583  stmt->setString(0, nameOrIP);
2584  resultAccounts = LoginDatabase.Query(stmt);
2585  break;
2586  case BAN_CHARACTER:
2587  // No SQL injection with prepared statements
2589  stmt->setString(0, nameOrIP);
2590  resultAccounts = CharacterDatabase.Query(stmt);
2591  break;
2592  default:
2593  return BAN_SYNTAX_ERROR;
2594  }
2595 
2596  if (!resultAccounts)
2597  {
2598  if (mode == BAN_IP)
2599  return BAN_SUCCESS; // ip correctly banned but nobody affected (yet)
2600  else
2601  return BAN_NOTFOUND; // Nobody to ban
2602  }
2603 
2606  do
2607  {
2608  Field* fieldsAccount = resultAccounts->Fetch();
2609  uint32 account = fieldsAccount[0].GetUInt32();
2610 
2611  if (mode != BAN_IP)
2612  {
2613  // make sure there is only one active ban
2615  stmt->setUInt32(0, account);
2616  trans->Append(stmt);
2617  // No SQL injection with prepared statements
2619  stmt->setUInt32(0, account);
2620  stmt->setUInt32(1, duration_secs);
2621  stmt->setString(2, author);
2622  stmt->setString(3, reason);
2623  trans->Append(stmt);
2624  }
2625 
2626  if (WorldSession* sess = FindSession(account))
2627  if (std::string(sess->GetPlayerName()) != author)
2628  sess->KickPlayer();
2629  } while (resultAccounts->NextRow());
2630 
2632 
2633  return BAN_SUCCESS;
2634 }
WorldSession * FindSession(uint32 id) const
Find a session by its id.
Definition: World.cpp:207
void Execute(const char *sql)
Definition: DatabaseWorkerPool.h:87
std::shared_ptr< PreparedResultSet > PreparedQueryResult
Definition: QueryResult.h:107
Definition: LoginDatabase.h:49
Definition: SharedDefines.h:4544
Class used to access individual fields of database query result.
Definition: Field.h:56
SQLTransaction BeginTransaction()
Begins an automanaged transaction pointer that will automatically rollback if not commited...
Definition: DatabaseWorkerPool.h:221
void setString(const uint8 index, const std::string &value)
Definition: PreparedStatement.cpp:187
arena_t NULL
Definition: jemalloc_internal.h:624
Definition: SharedDefines.h:4537
Definition: PreparedStatement.h:74
Definition: SharedDefines.h:4535
void CommitTransaction(SQLTransaction transaction)
Definition: DatabaseWorkerPool.cpp:179
LoginDatabaseWorkerPool LoginDatabase
Accessor to the realm/login database.
Definition: DatabaseEnv.cpp:22
Definition: SharedDefines.h:4545
uint32_t uint32
Definition: Define.h:150
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
Definition: SharedDefines.h:4536
void setUInt32(const uint8 index, const uint32 value)
Definition: PreparedStatement.cpp:115
Definition: LoginDatabase.h:44
Definition: SharedDefines.h:4543
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
uint32 GetUInt32() const
Definition: Field.h:146
Definition: LoginDatabase.h:54
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
Player session in the World.
Definition: WorldSession.h:882
Definition: LoginDatabase.h:55
Definition: LoginDatabase.h:48
Definition: CharacterDatabase.h:150
std::shared_ptr< Transaction > SQLTransaction
Definition: Transaction.h:58

+ Here is the call graph for this function:

BanReturn World::BanCharacter ( std::string const name,
std::string const duration,
std::string const reason,
std::string const author 
)

Ban an account or ban an IP address, duration will be parsed using TimeStringToSecs if it is positive, otherwise permban.

Pick a player to ban if not online

2667 {
2669  ObjectGuid guid;
2670 
2671  uint32 duration_secs = TimeStringToSecs(duration);
2672 
2674  if (!pBanned)
2675  {
2676  guid = ObjectMgr::GetPlayerGUIDByName(name);
2677  if (guid.IsEmpty())
2678  return BAN_NOTFOUND; // Nobody to ban
2679  }
2680  else
2681  guid = pBanned->GetGUID();
2682 
2683  // make sure there is only one active ban
2685  stmt->setUInt64(0, guid.GetCounter());
2686  CharacterDatabase.Execute(stmt);
2687 
2689  stmt->setUInt64(0, guid.GetCounter());
2690  stmt->setUInt32(1, duration_secs);
2691  stmt->setString(2, author);
2692  stmt->setString(3, reason);
2693  CharacterDatabase.Execute(stmt);
2694 
2695  if (pBanned)
2696  pBanned->GetSession()->KickPlayer();
2697 
2698  return BAN_SUCCESS;
2699 }
void Execute(const char *sql)
Definition: DatabaseWorkerPool.h:87
TC_GAME_API Player * FindConnectedPlayerByName(std::string const &name)
Definition: ObjectAccessor.cpp:240
void setString(const uint8 index, const std::string &value)
Definition: PreparedStatement.cpp:187
Definition: PreparedStatement.h:74
Definition: CharacterDatabase.h:41
Definition: SharedDefines.h:4545
uint32 TimeStringToSecs(const std::string &timestring)
Definition: Util.cpp:163
static ObjectGuid GetPlayerGUIDByName(std::string const &name)
Definition: ObjectMgr.cpp:2247
uint32_t uint32
Definition: Define.h:150
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
void setUInt32(const uint8 index, const uint32 value)
Definition: PreparedStatement.cpp:115
Definition: SharedDefines.h:4543
void setUInt64(const uint8 index, const uint64 value)
Definition: PreparedStatement.cpp:124
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
Definition: ObjectGuid.h:189
Definition: CharacterDatabase.h:42
bool IsEmpty() const
Definition: ObjectGuid.h:242
LowType GetCounter() const
Definition: ObjectGuid.h:221

+ Here is the call graph for this function:

void World::DailyReset ( )
protected
3105 {
3106  TC_LOG_INFO("misc", "Daily quests reset for all characters.");
3107 
3109  CharacterDatabase.Execute(stmt);
3110 
3112  stmt->setUInt32(0, 1);
3113  CharacterDatabase.Execute(stmt);
3114 
3115  for (SessionMap::const_iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr)
3116  if (itr->second->GetPlayer())
3117  itr->second->GetPlayer()->DailyReset();
3118 
3119  // change available dailies
3120  sPoolMgr->ChangeDailyQuests();
3121 }
void Execute(const char *sql)
Definition: DatabaseWorkerPool.h:87
SessionMap m_sessions
Definition: World.h:812
Definition: CharacterDatabase.h:584
Definition: PreparedStatement.h:74
#define sPoolMgr
Definition: PoolMgr.h:166
Definition: CharacterDatabase.h:89
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
void setUInt32(const uint8 index, const uint32 value)
Definition: PreparedStatement.cpp:115
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void World::DecreasePlayerCount ( )
inline
574 { m_PlayerCount--; }
uint32 m_PlayerCount
Definition: World.h:817
void World::DeleteCharacterInfo ( ObjectGuid const guid)
inline
759 { _characterInfoStore.erase(guid); }
CharacterInfoContainer _characterInfoStore
Definition: World.h:876
Player * World::FindPlayerInZone ( uint32  zone)

Find a player in a specified zone.

  • circle through active sessions and return the first player found in the zone
161 {
163  SessionMap::const_iterator itr;
164  for (itr = m_sessions.begin(); itr != m_sessions.end(); ++itr)
165  {
166  if (!itr->second)
167  continue;
168 
169  Player* player = itr->second->GetPlayer();
170  if (!player)
171  continue;
172 
173  if (player->IsInWorld() && player->GetZoneId() == zone)
174  return player;
175  }
176  return NULL;
177 }
SessionMap m_sessions
Definition: World.h:812
arena_t NULL
Definition: jemalloc_internal.h:624
WorldSession * World::FindSession ( uint32  id) const

Find a session by its id.

208 {
209  SessionMap::const_iterator itr = m_sessions.find(id);
210 
211  if (itr != m_sessions.end())
212  return itr->second; // also can return NULL for kicked session
213  else
214  return NULL;
215 }
SessionMap m_sessions
Definition: World.h:812
arena_t NULL
Definition: jemalloc_internal.h:624

+ Here is the caller graph for this function:

void World::ForceGameEventUpdate ( )
2346 {
2347  m_timers[WUPDATE_EVENTS].Reset(); // to give time for Update() to be processed
2348  uint32 nextGameEvent = sGameEventMgr->Update();
2349  m_timers[WUPDATE_EVENTS].SetInterval(nextGameEvent);
2351 }
IntervalTimer m_timers[WUPDATE_COUNT]
Definition: World.h:805
void SetInterval(time_t interval)
Definition: Timer.h:79
uint32_t uint32
Definition: Define.h:150
void Reset()
Definition: Timer.h:68
#define sGameEventMgr
Definition: GameEventMgr.h:184
Definition: World.h:86

+ Here is the call graph for this function:

uint32 World::GetActiveAndQueuedSessionCount ( ) const
inline
559 { return uint32(m_sessions.size()); }
SessionMap m_sessions
Definition: World.h:812
uint32_t uint32
Definition: g3dmath.h:168

+ Here is the caller graph for this function:

uint32 World::GetActiveSessionCount ( ) const
inline
560 { return uint32(m_sessions.size() - m_QueuedPlayer.size()); }
SessionMap m_sessions
Definition: World.h:812
Queue m_QueuedPlayer
Definition: World.h:857
uint32_t uint32
Definition: g3dmath.h:168

+ Here is the caller graph for this function:

bool World::getAllowMovement ( ) const
inline
Todo:
Actions on m_allowMovement still to be implemented Is movement allowed?
602 { return m_allowMovement; }
bool m_allowMovement
Definition: World.h:832
const SessionMap& World::GetAllSessions ( ) const
inline
558 { return m_sessions; }
SessionMap m_sessions
Definition: World.h:812
LocaleConstant World::GetAvailableDbcLocale ( LocaleConstant  locale) const
inline
744 { if (m_availableDbcLocaleMask & (1 << locale)) return locale; else return m_defaultDbcLocale; }
uint32 m_availableDbcLocaleMask
Definition: World.h:831
LocaleConstant m_defaultDbcLocale
Definition: World.h:830
bool World::getBoolConfig ( WorldBoolConfigs  index) const
inline

Get a server configuration element (see #WorldConfigs)

682  {
683  return index < BOOL_CONFIG_VALUE_COUNT ? m_bool_configs[index] : 0;
684  }
bool m_bool_configs[BOOL_CONFIG_VALUE_COUNT]
Definition: World.h:824
Definition: World.h:181
CharacterInfo const * World::GetCharacterInfo ( ObjectGuid const guid) const

Loads several pieces of information on server startup with the GUID There is no further database query necessary. These are a number of methods that work into the calling function.

Parameters
guidRequires a guid to call
Returns
Name, Sex, Race, Class and Level of player character Example Usage:
CharacterInfo const* characterInfo = sWorld->GetCharacterInfo(GUID);
if (!nameData)
return;
std::string playerName = characterInfo->Name;
uint8 playerGender = characterInfo->Sex;
uint8 playerRace = characterInfo->Race;
uint8 playerClass = characterInfo->Class;
uint8 playerLevel = characterInfo->Level;
3387 {
3388  CharacterInfoContainer::const_iterator itr = _characterInfoStore.find(guid);
3389  if (itr != _characterInfoStore.end())
3390  return &itr->second;
3391 
3392  return nullptr;
3393 }
CharacterInfoContainer _characterInfoStore
Definition: World.h:876
uint32 World::GetCleaningFlags ( ) const
inline
765 { return m_CleaningFlags; }
uint32 m_CleaningFlags
Definition: World.h:799
uint16 World::GetConfigMaxSkillValue ( ) const
inline

Get the maximum skill level a player can reach.

638  {
640  return lvl > 60 ? 300 + ((lvl - 60) * 75) / 10 : lvl * 5;
641  }
uint8_t uint8
Definition: g3dmath.h:164
uint8_t uint8
Definition: Define.h:152
Definition: World.h:235
uint32 getIntConfig(WorldIntConfigs index) const
Get a server configuration element (see #WorldConfigs)
Definition: World.h:707
std::string const& World::GetDataPath ( ) const
inline

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

619 { return m_dataPath; }
std::string m_dataPath
Definition: World.h:834
char const* World::GetDBVersion ( ) const
inline
748 { return m_DBVersion.c_str(); }
std::string m_DBVersion
Definition: World.h:867
LocaleConstant World::GetDefaultDbcLocale ( ) const
inline
616 { return m_defaultDbcLocale; }
LocaleConstant m_defaultDbcLocale
Definition: World.h:830

+ Here is the caller graph for this function:

static uint8 World::GetExitCode ( )
inlinestatic
661 { return m_ExitCode; }
static uint8 m_ExitCode
Definition: World.h:795

+ Here is the caller graph for this function:

float World::getFloatConfig ( WorldFloatConfigs  index) const
inline

Get a server configuration element (see #WorldConfigs)

695  {
696  return index < FLOAT_CONFIG_VALUE_COUNT ? m_float_configs[index] : 0;
697  }
Definition: World.h:204
float m_float_configs[FLOAT_CONFIG_VALUE_COUNT]
Definition: World.h:825
time_t const& World::GetGameTime ( ) const
inline

What time is it?

624 { return m_gameTime; }
time_t m_gameTime
Definition: World.h:804
uint32 World::getIntConfig ( WorldIntConfigs  index) const
inline

Get a server configuration element (see #WorldConfigs)

708  {
709  return index < INT_CONFIG_VALUE_COUNT ? m_int_configs[index] : 0;
710  }
Definition: World.h:377
uint32 m_int_configs[INT_CONFIG_VALUE_COUNT]
Definition: World.h:823

+ Here is the caller graph for this function:

uint32 World::GetMaxActiveSessionCount ( ) const
inline
564 { return m_maxActiveSessionCount; }
uint32 m_maxActiveSessionCount
Definition: World.h:815
uint32 World::GetMaxPlayerCount ( ) const
inline
567 { return m_MaxPlayerCount; }
uint32 m_MaxPlayerCount
Definition: World.h:818

+ Here is the caller graph for this function:

uint32 World::GetMaxQueuedSessionCount ( ) const
inline

Get the maximum number of parallel sessions on the server since last reboot.

563 { return m_maxQueuedSessionCount; }
uint32 m_maxQueuedSessionCount
Definition: World.h:816
static float World::GetMaxVisibleDistanceInBGArenas ( )
inlinestatic
static float m_MaxVisibleDistanceInBGArenas
Definition: World.h:839

+ Here is the caller graph for this function:

static float World::GetMaxVisibleDistanceInInstances ( )
inlinestatic
static float m_MaxVisibleDistanceInInstances
Definition: World.h:838

+ Here is the caller graph for this function:

static float World::GetMaxVisibleDistanceOnContinents ( )
inlinestatic
static float m_MaxVisibleDistanceOnContinents
Definition: World.h:837

+ Here is the caller graph for this function:

std::vector< std::string > const & World::GetMotd ( ) const

Get the current Message of the Day.

202 {
203  return _motd;
204 }
std::vector< std::string > _motd
Definition: World.h:833
std::string const& World::GetNewCharString ( ) const
inline

Get the string for new characters (first login)

614 { return m_newCharString; }
std::string m_newCharString
Definition: World.h:820
time_t World::GetNextDailyQuestsResetTime ( ) const
inline

Next daily quests and random bg reset time.

632 { return m_NextDailyQuestReset; }
time_t m_NextDailyQuestReset
Definition: World.h:849
time_t World::GetNextRandomBGResetTime ( ) const
inline
634 { return m_NextRandomBGReset; }
time_t m_NextRandomBGReset
Definition: World.h:852
time_t World::GetNextWeeklyQuestsResetTime ( ) const
inline
633 { return m_NextWeeklyQuestReset; }
time_t m_NextWeeklyQuestReset
Definition: World.h:850
uint32 World::GetPlayerAmountLimit ( ) const
inline
591 { return m_playerLimit; }
uint32 m_playerLimit
Definition: World.h:828

+ Here is the caller graph for this function:

uint32 World::GetPlayerCount ( ) const
inline

Get number of players.

566 { return m_PlayerCount; }
uint32 m_PlayerCount
Definition: World.h:817
AccountTypes World::GetPlayerSecurityLimit ( ) const
inline

Security level limitations.

585 { return m_allowedSecurityLevel; }
AccountTypes m_allowedSecurityLevel
Definition: World.h:829
uint32 World::GetQueuedSessionCount ( ) const
inline
561 { return uint32(m_QueuedPlayer.size()); }
Queue m_QueuedPlayer
Definition: World.h:857
uint32_t uint32
Definition: g3dmath.h:168

+ Here is the caller graph for this function:

int32 World::GetQueuePos ( WorldSession sess)
357 {
358  uint32 position = 1;
359 
360  for (Queue::const_iterator iter = m_QueuedPlayer.begin(); iter != m_QueuedPlayer.end(); ++iter, ++position)
361  if ((*iter) == sess)
362  return position;
363 
364  return 0;
365 }
Queue m_QueuedPlayer
Definition: World.h:857
uint32_t uint32
Definition: Define.h:150

+ Here is the caller graph for this function:

float World::getRate ( Rates  rate) const
inline

Get a server rate (see Rates)

671 { return rate_values[rate]; }
float rate_values[MAX_RATES]
Definition: World.h:822

+ Here is the caller graph for this function:

uint32 World::GetShutDownTimeLeft ( ) const
inline
657 { return m_ShutdownTimer; }
uint32 m_ShutdownTimer
Definition: World.h:796
time_t const& World::GetStartTime ( ) const
inline

When server started?

622 { return m_startTime; }
time_t m_startTime
Definition: World.h:803
uint32 World::GetUpdateTime ( ) const
inline

Update time.

628 { return m_updateTime; }
uint32 m_updateTime
Definition: World.h:808
uint32 World::GetUptime ( ) const
inline

Uptime (in secs)

626 { return uint32(m_gameTime - m_startTime); }
time_t m_gameTime
Definition: World.h:804
time_t m_startTime
Definition: World.h:803
uint32_t uint32
Definition: g3dmath.h:168
static int32 World::GetVisibilityNotifyPeriodInBGArenas ( )
inlinestatic
static int32 m_visibility_notify_periodInBGArenas
Definition: World.h:843

+ Here is the caller graph for this function:

static int32 World::GetVisibilityNotifyPeriodInInstances ( )
inlinestatic
static int32 m_visibility_notify_periodInInstances
Definition: World.h:842

+ Here is the caller graph for this function:

static int32 World::GetVisibilityNotifyPeriodOnContinents ( )
inlinestatic
static int32 m_visibility_notify_periodOnContinents
Definition: World.h:841

+ Here is the caller graph for this function:

uint64 World::getWorldState ( uint32  index) const
3342 {
3343  WorldStatesMap::const_iterator it = m_worldstates.find(index);
3344  return it != m_worldstates.end() ? it->second : 0;
3345 }
WorldStatesMap m_worldstates
Definition: World.h:827

+ Here is the caller graph for this function:

bool World::HasCharacterInfo ( ObjectGuid const guid)
inline
760 { return _characterInfoStore.find(guid) != _characterInfoStore.end(); }
CharacterInfoContainer _characterInfoStore
Definition: World.h:876
bool World::HasRecentlyDisconnected ( WorldSession session)
335 {
336  if (!session)
337  return false;
338 
340  {
341  for (DisconnectMap::iterator i = m_disconnects.begin(); i != m_disconnects.end();)
342  {
343  if (difftime(i->second, time(NULL)) < tolerance)
344  {
345  if (i->first == session->GetAccountId())
346  return true;
347  ++i;
348  }
349  else
350  m_disconnects.erase(i++);
351  }
352  }
353  return false;
354  }
arena_t NULL
Definition: jemalloc_internal.h:624
uint32 GetAccountId() const
Definition: WorldSession.h:922
uint32_t uint32
Definition: Define.h:150
DisconnectMap m_disconnects
Definition: World.h:814
uint32 getIntConfig(WorldIntConfigs index) const
Get a server configuration element (see #WorldConfigs)
Definition: World.h:707

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void World::IncreasePlayerCount ( )
inline

Increase/Decrease number of players.

570  {
571  m_PlayerCount++;
573  }
uint32 m_PlayerCount
Definition: World.h:817
T max(const T &x, const T &y)
Definition: g3dmath.h:320
uint32 m_MaxPlayerCount
Definition: World.h:818

+ Here is the call graph for this function:

void World::InitCurrencyResetTime ( )
protected
3075 {
3076  time_t currencytime = sWorld->getWorldState(WS_CURRENCY_RESET_TIME);
3077  if (!currencytime)
3078  m_NextCurrencyReset = time(NULL); // game time not yet init
3079 
3080  // generate time by config
3081  time_t curTime = time(NULL);
3082  tm localTm;
3083  localtime_r(&curTime, &localTm);
3084 
3085  localTm.tm_wday = getIntConfig(CONFIG_CURRENCY_RESET_DAY);
3086  localTm.tm_hour = getIntConfig(CONFIG_CURRENCY_RESET_HOUR);
3087  localTm.tm_min = 0;
3088  localTm.tm_sec = 0;
3089 
3090  // current week reset time
3091  time_t nextWeekResetTime = mktime(&localTm);
3092 
3093  // next reset time before current moment
3094  if (curTime >= nextWeekResetTime)
3095  nextWeekResetTime += getIntConfig(CONFIG_CURRENCY_RESET_INTERVAL) * DAY;
3096 
3097  // normalize reset time
3098  m_NextCurrencyReset = currencytime < curTime ? nextWeekResetTime - getIntConfig(CONFIG_CURRENCY_RESET_INTERVAL) * DAY : nextWeekResetTime;
3099 
3100  if (!currencytime)
3102 }
arena_t NULL
Definition: jemalloc_internal.h:624
uint64_t uint64
Definition: g3dmath.h:170
#define sWorld
Definition: World.h:887
Definition: World.h:250
Definition: Common.h:99
#define WS_CURRENCY_RESET_TIME
Definition: BattlegroundMgr.h:32
Definition: World.h:251
Definition: World.h:249
time_t m_NextCurrencyReset
Definition: World.h:854
TC_COMMON_API struct tm * localtime_r(const time_t *time, struct tm *result)
uint32 getIntConfig(WorldIntConfigs index) const
Get a server configuration element (see #WorldConfigs)
Definition: World.h:707

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void World::InitDailyQuestResetTime ( )
protected
2977 {
2978  time_t mostRecentQuestTime;
2979 
2980  QueryResult result = CharacterDatabase.Query("SELECT MAX(time) FROM character_queststatus_daily");
2981  if (result)
2982  {
2983  Field* fields = result->Fetch();
2984  mostRecentQuestTime = time_t(fields[0].GetUInt32());
2985  }
2986  else
2987  mostRecentQuestTime = 0;
2988 
2989  // client built-in time for reset is 6:00 AM
2990  // FIX ME: client not show day start time
2991  time_t curTime = time(NULL);
2992  tm localTm;
2993  localtime_r(&curTime, &localTm);
2994  localTm.tm_hour = 6;
2995  localTm.tm_min = 0;
2996  localTm.tm_sec = 0;
2997 
2998  // current day reset time
2999  time_t curDayResetTime = mktime(&localTm);
3000 
3001  // last reset time before current moment
3002  time_t resetTime = (curTime < curDayResetTime) ? curDayResetTime - DAY : curDayResetTime;
3003 
3004  // need reset (if we have quest time before last reset time (not processed by some reason)
3005  if (mostRecentQuestTime && mostRecentQuestTime <= resetTime)
3006  m_NextDailyQuestReset = mostRecentQuestTime;
3007  else // plan next reset time
3008  m_NextDailyQuestReset = (curTime >= curDayResetTime) ? curDayResetTime + DAY : curDayResetTime;
3009 }
time_t m_NextDailyQuestReset
Definition: World.h:849
Class used to access individual fields of database query result.
Definition: Field.h:56
arena_t NULL
Definition: jemalloc_internal.h:624
Definition: Common.h:99
std::shared_ptr< ResultSet > QueryResult
Definition: QueryResult.h:61
TC_COMMON_API struct tm * localtime_r(const time_t *time, struct tm *result)
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void World::InitGuildResetTime ( )
protected
3047 {
3048  time_t gtime = getWorldState(WS_GUILD_DAILY_RESET_TIME);
3049  if (!gtime)
3050  m_NextGuildReset = time(NULL); // game time not yet init
3051 
3052  // generate time by config
3053  time_t curTime = time(NULL);
3054  tm localTm;
3055  localtime_r(&curTime, &localTm);
3056  localTm.tm_hour = getIntConfig(CONFIG_GUILD_RESET_HOUR);
3057  localTm.tm_min = 0;
3058  localTm.tm_sec = 0;
3059 
3060  // current day reset time
3061  time_t nextDayResetTime = mktime(&localTm);
3062 
3063  // next reset time before current moment
3064  if (curTime >= nextDayResetTime)
3065  nextDayResetTime += DAY;
3066 
3067  // normalize reset time
3068  m_NextGuildReset = gtime < curTime ? nextDayResetTime - DAY : nextDayResetTime;
3069 
3070  if (!gtime)
3072 }
time_t m_NextGuildReset
Definition: World.h:853
arena_t NULL
Definition: jemalloc_internal.h:624
uint64_t uint64
Definition: g3dmath.h:170
#define sWorld
Definition: World.h:887
uint64 getWorldState(uint32 index) const
Definition: World.cpp:3341
Definition: World.h:331
Definition: Common.h:99
Definition: World.h:498
TC_COMMON_API struct tm * localtime_r(const time_t *time, struct tm *result)
uint32 getIntConfig(WorldIntConfigs index) const
Get a server configuration element (see #WorldConfigs)
Definition: World.h:707

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void World::InitMonthlyQuestResetTime ( )
protected
3012 {
3013  time_t wstime = sWorld->getWorldState(WS_MONTHLY_QUEST_RESET_TIME);
3014  time_t curtime = time(NULL);
3015  m_NextMonthlyQuestReset = wstime < curtime ? curtime : wstime;
3016 }
time_t m_NextMonthlyQuestReset
Definition: World.h:851
Definition: World.h:499
arena_t NULL
Definition: jemalloc_internal.h:624
#define sWorld
Definition: World.h:887

+ Here is the caller graph for this function:

void World::InitRandomBGResetTime ( )
protected
3019 {
3020  time_t bgtime = sWorld->getWorldState(WS_BG_DAILY_RESET_TIME);
3021  if (!bgtime)
3022  m_NextRandomBGReset = time(NULL); // game time not yet init
3023 
3024  // generate time by config
3025  time_t curTime = time(NULL);
3026  tm localTm;
3027  localtime_r(&curTime, &localTm);
3028  localTm.tm_hour = getIntConfig(CONFIG_RANDOM_BG_RESET_HOUR);
3029  localTm.tm_min = 0;
3030  localTm.tm_sec = 0;
3031 
3032  // current day reset time
3033  time_t nextDayResetTime = mktime(&localTm);
3034 
3035  // next reset time before current moment
3036  if (curTime >= nextDayResetTime)
3037  nextDayResetTime += DAY;
3038 
3039  // normalize reset time
3040  m_NextRandomBGReset = bgtime < curTime ? nextDayResetTime - DAY : nextDayResetTime;
3041 
3042  if (!bgtime)
3044 }
Definition: World.h:330
Definition: World.h:496
arena_t NULL
Definition: jemalloc_internal.h:624
uint64_t uint64
Definition: g3dmath.h:170
#define sWorld
Definition: World.h:887
Definition: Common.h:99
time_t m_NextRandomBGReset
Definition: World.h:852
TC_COMMON_API struct tm * localtime_r(const time_t *time, struct tm *result)
uint32 getIntConfig(WorldIntConfigs index) const
Get a server configuration element (see #WorldConfigs)
Definition: World.h:707

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void World::InitWeeklyQuestResetTime ( )
protected
2970 {
2971  time_t wstime = sWorld->getWorldState(WS_WEEKLY_QUEST_RESET_TIME);
2972  time_t curtime = time(NULL);
2973  m_NextWeeklyQuestReset = wstime < curtime ? curtime : wstime;
2974 }
arena_t NULL
Definition: jemalloc_internal.h:624
#define sWorld
Definition: World.h:887
Definition: World.h:495
time_t m_NextWeeklyQuestReset
Definition: World.h:850

+ Here is the caller graph for this function:

World * World::instance ( )
static
154 {
155  static World instance;
156  return &instance;
157 }
static World * instance()
Definition: World.cpp:153
The World.
Definition: World.h:544
bool World::IsClosed ( ) const

Deny clients?

180 {
181  return m_isClosed;
182 }
bool m_isClosed
Definition: World.h:801
bool World::IsFFAPvPRealm ( ) const
inline
Definition: World.h:219
uint32 getIntConfig(WorldIntConfigs index) const
Get a server configuration element (see #WorldConfigs)
Definition: World.h:707
Definition: Realm.h:79

+ Here is the caller graph for this function:

bool World::IsPvPRealm ( ) const
inline

Are we on a "Player versus Player" server?

Definition: Realm.h:72
Definition: Realm.h:75
Definition: World.h:219
uint32 getIntConfig(WorldIntConfigs index) const
Get a server configuration element (see #WorldConfigs)
Definition: World.h:707
Definition: Realm.h:79
bool World::IsShuttingDown ( ) const
inline

Are we in the middle of a shutdown?

656 { return m_ShutdownTimer > 0; }
uint32 m_ShutdownTimer
Definition: World.h:796
static bool World::IsStopped ( )
inlinestatic
663 { return m_stopEvent; }
static std::atomic< bool > m_stopEvent
Definition: World.h:794

+ Here is the caller graph for this function:

void World::KickAll ( )

Kick (and save) all players.

2535 {
2536  m_QueuedPlayer.clear(); // prevent send queue update packet and login queued sessions
2537 
2538  // session not removed at kick and will removed in next update tick
2539  for (SessionMap::const_iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr)
2540  itr->second->KickPlayer();
2541 }
SessionMap m_sessions
Definition: World.h:812
Queue m_QueuedPlayer
Definition: World.h:857
void World::KickAllLess ( AccountTypes  sec)

Kick (and save) all players with security level less sec

2545 {
2546  // session not removed at kick and will removed in next update tick
2547  for (SessionMap::const_iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr)
2548  if (itr->second->GetSecurity() < sec)
2549  itr->second->KickPlayer();
2550 }
SessionMap m_sessions
Definition: World.h:812

+ Here is the caller graph for this function:

void World::LoadAutobroadcasts ( )
2094 {
2095  uint32 oldMSTime = getMSTime();
2096 
2097  m_Autobroadcasts.clear();
2098  m_AutobroadcastsWeights.clear();
2099 
2100  uint32 realmId = sConfigMgr->GetIntDefault("RealmID", 0);
2102  stmt->setInt32(0, realmId);
2103  PreparedQueryResult result = LoginDatabase.Query(stmt);
2104 
2105  if (!result)
2106  {
2107  TC_LOG_INFO("server.loading", ">> Loaded 0 autobroadcasts definitions. DB table `autobroadcast` is empty for this realm!");
2108  return;
2109  }
2110 
2111  uint32 count = 0;
2112 
2113  do
2114  {
2115  Field* fields = result->Fetch();
2116  uint8 id = fields[0].GetUInt8();
2117 
2118  m_Autobroadcasts[id] = fields[2].GetString();
2119  m_AutobroadcastsWeights[id] = fields[1].GetUInt8();
2120 
2121  ++count;
2122  } while (result->NextRow());
2123 
2124  TC_LOG_INFO("server.loading", ">> Loaded %u autobroadcast definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
2125 }
std::shared_ptr< PreparedResultSet > PreparedQueryResult
Definition: QueryResult.h:107
AutobroadcastsMap m_Autobroadcasts
Definition: World.h:870
Definition: LoginDatabase.h:96
Class used to access individual fields of database query result.
Definition: Field.h:56
uint32 getMSTime()
Definition: Timer.h:24
#define sConfigMgr
Definition: Config.h:61
Definition: PreparedStatement.h:74
LoginDatabaseWorkerPool LoginDatabase
Accessor to the realm/login database.
Definition: DatabaseEnv.cpp:22
uint8 GetUInt8() const
Definition: Field.h:70
uint32_t uint32
Definition: Define.h:150
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
AutobroadcastsWeightMap m_AutobroadcastsWeights
Definition: World.h:873
void setInt32(const uint8 index, const int32 value)
Definition: PreparedStatement.cpp:151
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
uint8_t uint8
Definition: Define.h:152
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
std::string GetString() const
Definition: Field.h:276

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void World::LoadCharacterInfoStore ( )
private
3396 {
3397  TC_LOG_INFO("server.loading", "Loading character info store");
3398 
3399  _characterInfoStore.clear();
3400 
3401  QueryResult result = CharacterDatabase.Query("SELECT guid, name, account, race, gender, class, level, deleteDate FROM characters");
3402  if (!result)
3403  {
3404  TC_LOG_INFO("server.loading", "No character name data loaded, empty query");
3405  return;
3406  }
3407 
3408  do
3409  {
3410  Field* fields = result->Fetch();
3411  AddCharacterInfo(ObjectGuid::Create<HighGuid::Player>(fields[0].GetUInt64()), fields[2].GetUInt32(), fields[1].GetString(),
3412  fields[4].GetUInt8() /*gender*/, fields[3].GetUInt8() /*race*/, fields[5].GetUInt8() /*class*/, fields[6].GetUInt8() /*level*/, fields[7].GetUInt32() != 0);
3413  }
3414  while (result->NextRow());
3415 
3416  TC_LOG_INFO("server.loading", "Loaded character infos for " SZFMTD " characters", _characterInfoStore.size());
3417 }
CharacterInfoContainer _characterInfoStore
Definition: World.h:876
#define SZFMTD
Definition: Define.h:143
Class used to access individual fields of database query result.
Definition: Field.h:56
std::shared_ptr< ResultSet > QueryResult
Definition: QueryResult.h:61
void AddCharacterInfo(ObjectGuid const &guid, uint32 accountId, std::string const &name, uint8 gender, uint8 race, uint8 playerClass, uint8 level, bool isDeleted)
Definition: World.cpp:3419
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void World::LoadConfigSettings ( bool  reload = false)

Initialize config values.

  • Read the player limit and the Message of the day from the config file
  • Read support system setting from the config file
  • Get string for new logins (newly created characters)
  • Send server info on login?
  • Read all rates from the config file
  • Read other configuration items from the config file
Todo:
Add MonsterSight and GuarderSight (with meaning) in worldserver.conf or put them as define
  • Load the CharDelete related config options
  • Read the "Data" directory from the config file
428 {
429  if (reload)
430  {
431  std::string configError;
432  if (!sConfigMgr->Reload(configError))
433  {
434  TC_LOG_ERROR("misc", "World settings reload fail: %s.", configError.c_str());
435  return;
436  }
437  sLog->LoadFromConfig();
438  }
439 
440  m_defaultDbcLocale = LocaleConstant(sConfigMgr->GetIntDefault("DBC.Locale", 0));
441 
443  {
444  TC_LOG_ERROR("server.loading", "Incorrect DBC.Locale! Must be >= 0 and < %d and not %d (set to 0)", TOTAL_LOCALES, LOCALE_none);
446  }
447 
448  TC_LOG_INFO("server.loading", "Using %s DBC Locale", localeNames[m_defaultDbcLocale]);
449 
451  SetPlayerAmountLimit(sConfigMgr->GetIntDefault("PlayerLimit", 100));
452  SetMotd(sConfigMgr->GetStringDefault("Motd", "Welcome to a Trinity Core Server."));
453 
455  m_bool_configs[CONFIG_SUPPORT_ENABLED] = sConfigMgr->GetBoolDefault("Support.Enabled", true);
456  m_bool_configs[CONFIG_SUPPORT_TICKETS_ENABLED] = sConfigMgr->GetBoolDefault("Support.TicketsEnabled", false);
457  m_bool_configs[CONFIG_SUPPORT_BUGS_ENABLED] = sConfigMgr->GetBoolDefault("Support.BugsEnabled", false);
458  m_bool_configs[CONFIG_SUPPORT_COMPLAINTS_ENABLED] = sConfigMgr->GetBoolDefault("Support.ComplaintsEnabled", false);
459  m_bool_configs[CONFIG_SUPPORT_SUGGESTIONS_ENABLED] = sConfigMgr->GetBoolDefault("Support.SuggestionsEnabled", false);
460  if (reload)
461  {
462  sSupportMgr->SetSupportSystemStatus(m_bool_configs[CONFIG_SUPPORT_ENABLED]);
463  sSupportMgr->SetTicketSystemStatus(m_bool_configs[CONFIG_SUPPORT_TICKETS_ENABLED]);
464  sSupportMgr->SetBugSystemStatus(m_bool_configs[CONFIG_SUPPORT_BUGS_ENABLED]);
465  sSupportMgr->SetComplaintSystemStatus(m_bool_configs[CONFIG_SUPPORT_COMPLAINTS_ENABLED]);
466  sSupportMgr->SetSuggestionSystemStatus(m_bool_configs[CONFIG_SUPPORT_SUGGESTIONS_ENABLED]);
467  }
468 
469 
471  SetNewCharString(sConfigMgr->GetStringDefault("PlayerStart.String", ""));
472 
474  m_int_configs[CONFIG_ENABLE_SINFO_LOGIN] = sConfigMgr->GetIntDefault("Server.LoginInfo", 0);
475 
477  rate_values[RATE_HEALTH] = sConfigMgr->GetFloatDefault("Rate.Health", 1.0f);
478  if (rate_values[RATE_HEALTH] < 0)
479  {
480  TC_LOG_ERROR("server.loading", "Rate.Health (%f) must be > 0. Using 1 instead.", rate_values[RATE_HEALTH]);
482  }
483  rate_values[RATE_POWER_MANA] = sConfigMgr->GetFloatDefault("Rate.Mana", 1.0f);
484  if (rate_values[RATE_POWER_MANA] < 0)
485  {
486  TC_LOG_ERROR("server.loading", "Rate.Mana (%f) must be > 0. Using 1 instead.", rate_values[RATE_POWER_MANA]);
488  }
489  rate_values[RATE_POWER_RAGE_INCOME] = sConfigMgr->GetFloatDefault("Rate.Rage.Income", 1.0f);
490  rate_values[RATE_POWER_RAGE_LOSS] = sConfigMgr->GetFloatDefault("Rate.Rage.Loss", 1.0f);
492  {
493  TC_LOG_ERROR("server.loading", "Rate.Rage.Loss (%f) must be > 0. Using 1 instead.", rate_values[RATE_POWER_RAGE_LOSS]);
495  }
496  rate_values[RATE_POWER_RUNICPOWER_INCOME] = sConfigMgr->GetFloatDefault("Rate.RunicPower.Income", 1.0f);
497  rate_values[RATE_POWER_RUNICPOWER_LOSS] = sConfigMgr->GetFloatDefault("Rate.RunicPower.Loss", 1.0f);
499  {
500  TC_LOG_ERROR("server.loading", "Rate.RunicPower.Loss (%f) must be > 0. Using 1 instead.", rate_values[RATE_POWER_RUNICPOWER_LOSS]);
502  }
503  rate_values[RATE_POWER_FOCUS] = sConfigMgr->GetFloatDefault("Rate.Focus", 1.0f);
504  rate_values[RATE_POWER_ENERGY] = sConfigMgr->GetFloatDefault("Rate.Energy", 1.0f);
505 
506  rate_values[RATE_SKILL_DISCOVERY] = sConfigMgr->GetFloatDefault("Rate.Skill.Discovery", 1.0f);
507 
508  rate_values[RATE_DROP_ITEM_POOR] = sConfigMgr->GetFloatDefault("Rate.Drop.Item.Poor", 1.0f);
509  rate_values[RATE_DROP_ITEM_NORMAL] = sConfigMgr->GetFloatDefault("Rate.Drop.Item.Normal", 1.0f);
510  rate_values[RATE_DROP_ITEM_UNCOMMON] = sConfigMgr->GetFloatDefault("Rate.Drop.Item.Uncommon", 1.0f);
511  rate_values[RATE_DROP_ITEM_RARE] = sConfigMgr->GetFloatDefault("Rate.Drop.Item.Rare", 1.0f);
512  rate_values[RATE_DROP_ITEM_EPIC] = sConfigMgr->GetFloatDefault("Rate.Drop.Item.Epic", 1.0f);
513  rate_values[RATE_DROP_ITEM_LEGENDARY] = sConfigMgr->GetFloatDefault("Rate.Drop.Item.Legendary", 1.0f);
514  rate_values[RATE_DROP_ITEM_ARTIFACT] = sConfigMgr->GetFloatDefault("Rate.Drop.Item.Artifact", 1.0f);
515  rate_values[RATE_DROP_ITEM_REFERENCED] = sConfigMgr->GetFloatDefault("Rate.Drop.Item.Referenced", 1.0f);
516  rate_values[RATE_DROP_ITEM_REFERENCED_AMOUNT] = sConfigMgr->GetFloatDefault("Rate.Drop.Item.ReferencedAmount", 1.0f);
517  rate_values[RATE_DROP_MONEY] = sConfigMgr->GetFloatDefault("Rate.Drop.Money", 1.0f);
518  rate_values[RATE_XP_KILL] = sConfigMgr->GetFloatDefault("Rate.XP.Kill", 1.0f);
519  rate_values[RATE_XP_BG_KILL] = sConfigMgr->GetFloatDefault("Rate.XP.BattlegroundKill", 1.0f);
520  rate_values[RATE_XP_QUEST] = sConfigMgr->GetFloatDefault("Rate.XP.Quest", 1.0f);
521  rate_values[RATE_XP_EXPLORE] = sConfigMgr->GetFloatDefault("Rate.XP.Explore", 1.0f);
522  rate_values[RATE_REPAIRCOST] = sConfigMgr->GetFloatDefault("Rate.RepairCost", 1.0f);
523  if (rate_values[RATE_REPAIRCOST] < 0.0f)
524  {
525  TC_LOG_ERROR("server.loading", "Rate.RepairCost (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_REPAIRCOST]);
527  }
528  rate_values[RATE_REPUTATION_GAIN] = sConfigMgr->GetFloatDefault("Rate.Reputation.Gain", 1.0f);
529  rate_values[RATE_REPUTATION_LOWLEVEL_KILL] = sConfigMgr->GetFloatDefault("Rate.Reputation.LowLevel.Kill", 1.0f);
530  rate_values[RATE_REPUTATION_LOWLEVEL_QUEST] = sConfigMgr->GetFloatDefault("Rate.Reputation.LowLevel.Quest", 1.0f);
531  rate_values[RATE_REPUTATION_RECRUIT_A_FRIEND_BONUS] = sConfigMgr->GetFloatDefault("Rate.Reputation.RecruitAFriendBonus", 0.1f);
532  rate_values[RATE_CREATURE_NORMAL_DAMAGE] = sConfigMgr->GetFloatDefault("Rate.Creature.Normal.Damage", 1.0f);
533  rate_values[RATE_CREATURE_ELITE_ELITE_DAMAGE] = sConfigMgr->GetFloatDefault("Rate.Creature.Elite.Elite.Damage", 1.0f);
534  rate_values[RATE_CREATURE_ELITE_RAREELITE_DAMAGE] = sConfigMgr->GetFloatDefault("Rate.Creature.Elite.RAREELITE.Damage", 1.0f);
535  rate_values[RATE_CREATURE_ELITE_WORLDBOSS_DAMAGE] = sConfigMgr->GetFloatDefault("Rate.Creature.Elite.WORLDBOSS.Damage", 1.0f);
536  rate_values[RATE_CREATURE_ELITE_RARE_DAMAGE] = sConfigMgr->GetFloatDefault("Rate.Creature.Elite.RARE.Damage", 1.0f);
537  rate_values[RATE_CREATURE_NORMAL_HP] = sConfigMgr->GetFloatDefault("Rate.Creature.Normal.HP", 1.0f);
538  rate_values[RATE_CREATURE_ELITE_ELITE_HP] = sConfigMgr->GetFloatDefault("Rate.Creature.Elite.Elite.HP", 1.0f);
539  rate_values[RATE_CREATURE_ELITE_RAREELITE_HP] = sConfigMgr->GetFloatDefault("Rate.Creature.Elite.RAREELITE.HP", 1.0f);
540  rate_values[RATE_CREATURE_ELITE_WORLDBOSS_HP] = sConfigMgr->GetFloatDefault("Rate.Creature.Elite.WORLDBOSS.HP", 1.0f);
541  rate_values[RATE_CREATURE_ELITE_RARE_HP] = sConfigMgr->GetFloatDefault("Rate.Creature.Elite.RARE.HP", 1.0f);
542  rate_values[RATE_CREATURE_NORMAL_SPELLDAMAGE] = sConfigMgr->GetFloatDefault("Rate.Creature.Normal.SpellDamage", 1.0f);
543  rate_values[RATE_CREATURE_ELITE_ELITE_SPELLDAMAGE] = sConfigMgr->GetFloatDefault("Rate.Creature.Elite.Elite.SpellDamage", 1.0f);
544  rate_values[RATE_CREATURE_ELITE_RAREELITE_SPELLDAMAGE] = sConfigMgr->GetFloatDefault("Rate.Creature.Elite.RAREELITE.SpellDamage", 1.0f);
545  rate_values[RATE_CREATURE_ELITE_WORLDBOSS_SPELLDAMAGE] = sConfigMgr->GetFloatDefault("Rate.Creature.Elite.WORLDBOSS.SpellDamage", 1.0f);
546  rate_values[RATE_CREATURE_ELITE_RARE_SPELLDAMAGE] = sConfigMgr->GetFloatDefault("Rate.Creature.Elite.RARE.SpellDamage", 1.0f);
547  rate_values[RATE_CREATURE_AGGRO] = sConfigMgr->GetFloatDefault("Rate.Creature.Aggro", 1.0f);
548  rate_values[RATE_REST_INGAME] = sConfigMgr->GetFloatDefault("Rate.Rest.InGame", 1.0f);
549  rate_values[RATE_REST_OFFLINE_IN_TAVERN_OR_CITY] = sConfigMgr->GetFloatDefault("Rate.Rest.Offline.InTavernOrCity", 1.0f);
550  rate_values[RATE_REST_OFFLINE_IN_WILDERNESS] = sConfigMgr->GetFloatDefault("Rate.Rest.Offline.InWilderness", 1.0f);
551  rate_values[RATE_DAMAGE_FALL] = sConfigMgr->GetFloatDefault("Rate.Damage.Fall", 1.0f);
552  rate_values[RATE_AUCTION_TIME] = sConfigMgr->GetFloatDefault("Rate.Auction.Time", 1.0f);
553  rate_values[RATE_AUCTION_DEPOSIT] = sConfigMgr->GetFloatDefault("Rate.Auction.Deposit", 1.0f);
554  rate_values[RATE_AUCTION_CUT] = sConfigMgr->GetFloatDefault("Rate.Auction.Cut", 1.0f);
555  rate_values[RATE_HONOR] = sConfigMgr->GetFloatDefault("Rate.Honor", 1.0f);
556  rate_values[RATE_INSTANCE_RESET_TIME] = sConfigMgr->GetFloatDefault("Rate.InstanceResetTime", 1.0f);
557  rate_values[RATE_TALENT] = sConfigMgr->GetFloatDefault("Rate.Talent", 1.0f);
558  if (rate_values[RATE_TALENT] < 0.0f)
559  {
560  TC_LOG_ERROR("server.loading", "Rate.Talent (%f) must be > 0. Using 1 instead.", rate_values[RATE_TALENT]);
561  rate_values[RATE_TALENT] = 1.0f;
562  }
563  rate_values[RATE_MOVESPEED] = sConfigMgr->GetFloatDefault("Rate.MoveSpeed", 1.0f);
564  if (rate_values[RATE_MOVESPEED] < 0)
565  {
566  TC_LOG_ERROR("server.loading", "Rate.MoveSpeed (%f) must be > 0. Using 1 instead.", rate_values[RATE_MOVESPEED]);
567  rate_values[RATE_MOVESPEED] = 1.0f;
568  }
570  rate_values[RATE_CORPSE_DECAY_LOOTED] = sConfigMgr->GetFloatDefault("Rate.Corpse.Decay.Looted", 0.5f);
571 
572  rate_values[RATE_TARGET_POS_RECALCULATION_RANGE] = sConfigMgr->GetFloatDefault("TargetPosRecalculateRange", 1.5f);
574  {
575  TC_LOG_ERROR("server.loading", "TargetPosRecalculateRange (%f) must be >= %f. Using %f instead.", rate_values[RATE_TARGET_POS_RECALCULATION_RANGE], CONTACT_DISTANCE, CONTACT_DISTANCE);
577  }
579  {
580  TC_LOG_ERROR("server.loading", "TargetPosRecalculateRange (%f) must be <= %f. Using %f instead.",
583  }
584 
585  rate_values[RATE_DURABILITY_LOSS_ON_DEATH] = sConfigMgr->GetFloatDefault("DurabilityLoss.OnDeath", 10.0f);
587  {
588  TC_LOG_ERROR("server.loading", "DurabilityLoss.OnDeath (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_ON_DEATH]);
590  }
592  {
593  TC_LOG_ERROR("server.loading", "DurabilityLoss.OnDeath (%f) must be <= 100. Using 100.0 instead.", rate_values[RATE_DURABILITY_LOSS_ON_DEATH]);
595  }
597 
598  rate_values[RATE_DURABILITY_LOSS_DAMAGE] = sConfigMgr->GetFloatDefault("DurabilityLossChance.Damage", 0.5f);
600  {
601  TC_LOG_ERROR("server.loading", "DurabilityLossChance.Damage (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_DAMAGE]);
603  }
604  rate_values[RATE_DURABILITY_LOSS_ABSORB] = sConfigMgr->GetFloatDefault("DurabilityLossChance.Absorb", 0.5f);
606  {
607  TC_LOG_ERROR("server.loading", "DurabilityLossChance.Absorb (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_ABSORB]);
609  }
610  rate_values[RATE_DURABILITY_LOSS_PARRY] = sConfigMgr->GetFloatDefault("DurabilityLossChance.Parry", 0.05f);
612  {
613  TC_LOG_ERROR("server.loading", "DurabilityLossChance.Parry (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_PARRY]);
615  }
616  rate_values[RATE_DURABILITY_LOSS_BLOCK] = sConfigMgr->GetFloatDefault("DurabilityLossChance.Block", 0.05f);
618  {
619  TC_LOG_ERROR("server.loading", "DurabilityLossChance.Block (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_BLOCK]);
621  }
622  rate_values[RATE_MONEY_QUEST] = sConfigMgr->GetFloatDefault("Rate.Quest.Money.Reward", 1.0f);
623  if (rate_values[RATE_MONEY_QUEST] < 0.0f)
624  {
625  TC_LOG_ERROR("server.loading", "Rate.Quest.Money.Reward (%f) must be >=0. Using 0 instead.", rate_values[RATE_MONEY_QUEST]);
627  }
628  rate_values[RATE_MONEY_MAX_LEVEL_QUEST] = sConfigMgr->GetFloatDefault("Rate.Quest.Money.Max.Level.Reward", 1.0f);
630  {
631  TC_LOG_ERROR("server.loading", "Rate.Quest.Money.Max.Level.Reward (%f) must be >=0. Using 0 instead.", rate_values[RATE_MONEY_MAX_LEVEL_QUEST]);
633  }
635 
636  m_bool_configs[CONFIG_DURABILITY_LOSS_IN_PVP] = sConfigMgr->GetBoolDefault("DurabilityLoss.InPvP", false);
637 
638  m_int_configs[CONFIG_COMPRESSION] = sConfigMgr->GetIntDefault("Compression", 1);
639  if (m_int_configs[CONFIG_COMPRESSION] < 1 || m_int_configs[CONFIG_COMPRESSION] > 9)
640  {
641  TC_LOG_ERROR("server.loading", "Compression level (%i) must be in range 1..9. Using default compression level (1).", m_int_configs[CONFIG_COMPRESSION]);
642  m_int_configs[CONFIG_COMPRESSION] = 1;
643  }
644  m_bool_configs[CONFIG_ADDON_CHANNEL] = sConfigMgr->GetBoolDefault("AddonChannel", true);
645  m_bool_configs[CONFIG_CLEAN_CHARACTER_DB] = sConfigMgr->GetBoolDefault("CleanCharacterDB", false);
646  m_int_configs[CONFIG_PERSISTENT_CHARACTER_CLEAN_FLAGS] = sConfigMgr->GetIntDefault("PersistentCharacterCleanFlags", 0);
647  m_int_configs[CONFIG_CHAT_CHANNEL_LEVEL_REQ] = sConfigMgr->GetIntDefault("ChatLevelReq.Channel", 1);
648  m_int_configs[CONFIG_CHAT_WHISPER_LEVEL_REQ] = sConfigMgr->GetIntDefault("ChatLevelReq.Whisper", 1);
649  m_int_configs[CONFIG_CHAT_SAY_LEVEL_REQ] = sConfigMgr->GetIntDefault("ChatLevelReq.Say", 1);
650  m_int_configs[CONFIG_TRADE_LEVEL_REQ] = sConfigMgr->GetIntDefault("LevelReq.Trade", 1);
651  m_int_configs[CONFIG_AUCTION_LEVEL_REQ] = sConfigMgr->GetIntDefault("LevelReq.Auction", 1);
652  m_int_configs[CONFIG_MAIL_LEVEL_REQ] = sConfigMgr->GetIntDefault("LevelReq.Mail", 1);
653  m_bool_configs[CONFIG_PRESERVE_CUSTOM_CHANNELS] = sConfigMgr->GetBoolDefault("PreserveCustomChannels", false);
654  m_int_configs[CONFIG_PRESERVE_CUSTOM_CHANNEL_DURATION] = sConfigMgr->GetIntDefault("PreserveCustomChannelDuration", 14);
655  m_bool_configs[CONFIG_GRID_UNLOAD] = sConfigMgr->GetBoolDefault("GridUnload", true);
656  m_int_configs[CONFIG_INTERVAL_SAVE] = sConfigMgr->GetIntDefault("PlayerSaveInterval", 15 * MINUTE * IN_MILLISECONDS);
657  m_int_configs[CONFIG_INTERVAL_DISCONNECT_TOLERANCE] = sConfigMgr->GetIntDefault("DisconnectToleranceInterval", 0);
658  m_bool_configs[CONFIG_STATS_SAVE_ONLY_ON_LOGOUT] = sConfigMgr->GetBoolDefault("PlayerSave.Stats.SaveOnlyOnLogout", true);
659 
660  m_int_configs[CONFIG_MIN_LEVEL_STAT_SAVE] = sConfigMgr->GetIntDefault("PlayerSave.Stats.MinLevel", 0);
661  if (m_int_configs[CONFIG_MIN_LEVEL_STAT_SAVE] > MAX_LEVEL)
662  {
663  TC_LOG_ERROR("server.loading", "PlayerSave.Stats.MinLevel (%i) must be in range 0..80. Using default, do not save character stats (0).", m_int_configs[CONFIG_MIN_LEVEL_STAT_SAVE]);
664  m_int_configs[CONFIG_MIN_LEVEL_STAT_SAVE] = 0;
665  }
666 
667  m_int_configs[CONFIG_INTERVAL_GRIDCLEAN] = sConfigMgr->GetIntDefault("GridCleanUpDelay", 5 * MINUTE * IN_MILLISECONDS);
668  if (m_int_configs[CONFIG_INTERVAL_GRIDCLEAN] < MIN_GRID_DELAY)
669  {
670  TC_LOG_ERROR("server.loading", "GridCleanUpDelay (%i) must be greater %u. Use this minimal value.", m_int_configs[CONFIG_INTERVAL_GRIDCLEAN], MIN_GRID_DELAY);
671  m_int_configs[CONFIG_INTERVAL_GRIDCLEAN] = MIN_GRID_DELAY;
672  }
673  if (reload)
674  sMapMgr->SetGridCleanUpDelay(m_int_configs[CONFIG_INTERVAL_GRIDCLEAN]);
675 
676  m_int_configs[CONFIG_INTERVAL_MAPUPDATE] = sConfigMgr->GetIntDefault("MapUpdateInterval", 100);
677  if (m_int_configs[CONFIG_INTERVAL_MAPUPDATE] < MIN_MAP_UPDATE_DELAY)
678  {
679  TC_LOG_ERROR("server.loading", "MapUpdateInterval (%i) must be greater %u. Use this minimal value.", m_int_configs[CONFIG_INTERVAL_MAPUPDATE], MIN_MAP_UPDATE_DELAY);
681  }
682  if (reload)
683  sMapMgr->SetMapUpdateInterval(m_int_configs[CONFIG_INTERVAL_MAPUPDATE]);
684 
685  m_int_configs[CONFIG_INTERVAL_CHANGEWEATHER] = sConfigMgr->GetIntDefault("ChangeWeatherInterval", 10 * MINUTE * IN_MILLISECONDS);
686 
687  if (reload)
688  {
689  uint32 val = sConfigMgr->GetIntDefault("WorldServerPort", 8085);
690  if (val != m_int_configs[CONFIG_PORT_WORLD])
691  TC_LOG_ERROR("server.loading", "WorldServerPort option can't be changed at worldserver.conf reload, using current value (%u).", m_int_configs[CONFIG_PORT_WORLD]);
692 
693  val = sConfigMgr->GetIntDefault("InstanceServerPort", 8086);
694  if (val != m_int_configs[CONFIG_PORT_INSTANCE])
695  TC_LOG_ERROR("server.loading", "InstanceServerPort option can't be changed at worldserver.conf reload, using current value (%u).", m_int_configs[CONFIG_PORT_INSTANCE]);
696  }
697  else
698  {
699  m_int_configs[CONFIG_PORT_WORLD] = sConfigMgr->GetIntDefault("WorldServerPort", 8085);
700  m_int_configs[CONFIG_PORT_INSTANCE] = sConfigMgr->GetIntDefault("InstanceServerPort", 8086);
701  }
702 
703  m_int_configs[CONFIG_SOCKET_TIMEOUTTIME] = sConfigMgr->GetIntDefault("SocketTimeOutTime", 900000);
704  m_int_configs[CONFIG_SESSION_ADD_DELAY] = sConfigMgr->GetIntDefault("SessionAddDelay", 10000);
705 
706  m_float_configs[CONFIG_GROUP_XP_DISTANCE] = sConfigMgr->GetFloatDefault("MaxGroupXPDistance", 74.0f);
707  m_float_configs[CONFIG_MAX_RECRUIT_A_FRIEND_DISTANCE] = sConfigMgr->GetFloatDefault("MaxRecruitAFriendBonusDistance", 100.0f);
708 
710  m_float_configs[CONFIG_SIGHT_MONSTER] = sConfigMgr->GetFloatDefault("MonsterSight", 50.0f);
711  m_float_configs[CONFIG_SIGHT_GUARDER] = sConfigMgr->GetFloatDefault("GuarderSight", 50.0f);
712 
713  if (reload)
714  {
715  uint32 val = sConfigMgr->GetIntDefault("GameType", 0);
716  if (val != m_int_configs[CONFIG_GAME_TYPE])
717  TC_LOG_ERROR("server.loading", "GameType option can't be changed at worldserver.conf reload, using current value (%u).", m_int_configs[CONFIG_GAME_TYPE]);
718  }
719  else
720  m_int_configs[CONFIG_GAME_TYPE] = sConfigMgr->GetIntDefault("GameType", 0);
721 
722  if (reload)
723  {
724  uint32 val = sConfigMgr->GetIntDefault("RealmZone", REALM_ZONE_DEVELOPMENT);
725  if (val != m_int_configs[CONFIG_REALM_ZONE])
726  TC_LOG_ERROR("server.loading", "RealmZone option can't be changed at worldserver.conf reload, using current value (%u).", m_int_configs[CONFIG_REALM_ZONE]);
727  }
728  else
729  m_int_configs[CONFIG_REALM_ZONE] = sConfigMgr->GetIntDefault("RealmZone", REALM_ZONE_DEVELOPMENT);
730 
731  m_bool_configs[CONFIG_ALLOW_TWO_SIDE_INTERACTION_CALENDAR]= sConfigMgr->GetBoolDefault("AllowTwoSide.Interaction.Calendar", false);
732  m_bool_configs[CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL] = sConfigMgr->GetBoolDefault("AllowTwoSide.Interaction.Channel", false);
733  m_bool_configs[CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP] = sConfigMgr->GetBoolDefault("AllowTwoSide.Interaction.Group", false);
734  m_bool_configs[CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD] = sConfigMgr->GetBoolDefault("AllowTwoSide.Interaction.Guild", false);
735  m_bool_configs[CONFIG_ALLOW_TWO_SIDE_INTERACTION_AUCTION] = sConfigMgr->GetBoolDefault("AllowTwoSide.Interaction.Auction", false);
736  m_bool_configs[CONFIG_ALLOW_TWO_SIDE_TRADE] = sConfigMgr->GetBoolDefault("AllowTwoSide.Trade", false);
737  m_int_configs[CONFIG_STRICT_PLAYER_NAMES] = sConfigMgr->GetIntDefault ("StrictPlayerNames", 0);
738  m_int_configs[CONFIG_STRICT_CHARTER_NAMES] = sConfigMgr->GetIntDefault ("StrictCharterNames", 0);
739  m_int_configs[CONFIG_STRICT_PET_NAMES] = sConfigMgr->GetIntDefault ("StrictPetNames", 0);
740 
741  m_int_configs[CONFIG_MIN_PLAYER_NAME] = sConfigMgr->GetIntDefault ("MinPlayerName", 2);
742  if (m_int_configs[CONFIG_MIN_PLAYER_NAME] < 1 || m_int_configs[CONFIG_MIN_PLAYER_NAME] > MAX_PLAYER_NAME)
743  {
744  TC_LOG_ERROR("server.loading", "MinPlayerName (%i) must be in range 1..%u. Set to 2.", m_int_configs[CONFIG_MIN_PLAYER_NAME], MAX_PLAYER_NAME);
745  m_int_configs[CONFIG_MIN_PLAYER_NAME] = 2;
746  }
747 
748  m_int_configs[CONFIG_MIN_CHARTER_NAME] = sConfigMgr->GetIntDefault ("MinCharterName", 2);
749  if (m_int_configs[CONFIG_MIN_CHARTER_NAME] < 1 || m_int_configs[CONFIG_MIN_CHARTER_NAME] > MAX_CHARTER_NAME)
750  {
751  TC_LOG_ERROR("server.loading", "MinCharterName (%i) must be in range 1..%u. Set to 2.", m_int_configs[CONFIG_MIN_CHARTER_NAME], MAX_CHARTER_NAME);
752  m_int_configs[CONFIG_MIN_CHARTER_NAME] = 2;
753  }
754 
755  m_int_configs[CONFIG_MIN_PET_NAME] = sConfigMgr->GetIntDefault ("MinPetName", 2);
756  if (m_int_configs[CONFIG_MIN_PET_NAME] < 1 || m_int_configs[CONFIG_MIN_PET_NAME] > MAX_PET_NAME)
757  {
758  TC_LOG_ERROR("server.loading", "MinPetName (%i) must be in range 1..%u. Set to 2.", m_int_configs[CONFIG_MIN_PET_NAME], MAX_PET_NAME);
759  m_int_configs[CONFIG_MIN_PET_NAME] = 2;
760  }
761 
762  m_int_configs[CONFIG_CHARTER_COST_GUILD] = sConfigMgr->GetIntDefault("Guild.CharterCost", 1000);
763  m_int_configs[CONFIG_CHARTER_COST_ARENA_2v2] = sConfigMgr->GetIntDefault("ArenaTeam.CharterCost.2v2", 800000);
764  m_int_configs[CONFIG_CHARTER_COST_ARENA_3v3] = sConfigMgr->GetIntDefault("ArenaTeam.CharterCost.3v3", 1200000);
765  m_int_configs[CONFIG_CHARTER_COST_ARENA_5v5] = sConfigMgr->GetIntDefault("ArenaTeam.CharterCost.5v5", 2000000);
766 
767  m_int_configs[CONFIG_CHARACTER_CREATING_DISABLED] = sConfigMgr->GetIntDefault("CharacterCreating.Disabled", 0);
768  m_int_configs[CONFIG_CHARACTER_CREATING_DISABLED_RACEMASK] = sConfigMgr->GetIntDefault("CharacterCreating.Disabled.RaceMask", 0);
769  m_int_configs[CONFIG_CHARACTER_CREATING_DISABLED_CLASSMASK] = sConfigMgr->GetIntDefault("CharacterCreating.Disabled.ClassMask", 0);
770 
771  m_int_configs[CONFIG_CHARACTERS_PER_REALM] = sConfigMgr->GetIntDefault("CharactersPerRealm", MAX_CHARACTERS_PER_REALM);
772  if (m_int_configs[CONFIG_CHARACTERS_PER_REALM] < 1 || m_int_configs[CONFIG_CHARACTERS_PER_REALM] > MAX_CHARACTERS_PER_REALM)
773  {
774  TC_LOG_ERROR("server.loading", "CharactersPerRealm (%i) must be in range 1..10. Set to 10.", m_int_configs[CONFIG_CHARACTERS_PER_REALM]);
776  }
777 
778  // must be after CONFIG_CHARACTERS_PER_REALM
779  m_int_configs[CONFIG_CHARACTERS_PER_ACCOUNT] = sConfigMgr->GetIntDefault("CharactersPerAccount", 50);
780  if (m_int_configs[CONFIG_CHARACTERS_PER_ACCOUNT] < m_int_configs[CONFIG_CHARACTERS_PER_REALM])
781  {
782  TC_LOG_ERROR("server.loading", "CharactersPerAccount (%i) can't be less than CharactersPerRealm (%i).", m_int_configs[CONFIG_CHARACTERS_PER_ACCOUNT], m_int_configs[CONFIG_CHARACTERS_PER_REALM]);
783  m_int_configs[CONFIG_CHARACTERS_PER_ACCOUNT] = m_int_configs[CONFIG_CHARACTERS_PER_REALM];
784  }
785 
786  m_int_configs[CONFIG_HEROIC_CHARACTERS_PER_REALM] = sConfigMgr->GetIntDefault("HeroicCharactersPerRealm", 1);
787  if (int32(m_int_configs[CONFIG_HEROIC_CHARACTERS_PER_REALM]) < 0 || m_int_configs[CONFIG_HEROIC_CHARACTERS_PER_REALM] > 10)
788  {
789  TC_LOG_ERROR("server.loading", "HeroicCharactersPerRealm (%i) must be in range 0..10. Set to 1.", m_int_configs[CONFIG_HEROIC_CHARACTERS_PER_REALM]);
790  m_int_configs[CONFIG_HEROIC_CHARACTERS_PER_REALM] = 1;
791  }
792 
793  m_int_configs[CONFIG_CHARACTER_CREATING_MIN_LEVEL_FOR_HEROIC_CHARACTER] = sConfigMgr->GetIntDefault("CharacterCreating.MinLevelForHeroicCharacter", 55);
794 
795  m_int_configs[CONFIG_SKIP_CINEMATICS] = sConfigMgr->GetIntDefault("SkipCinematics", 0);
796  if (int32(m_int_configs[CONFIG_SKIP_CINEMATICS]) < 0 || m_int_configs[CONFIG_SKIP_CINEMATICS] > 2)
797  {
798  TC_LOG_ERROR("server.loading", "SkipCinematics (%i) must be in range 0..2. Set to 0.", m_int_configs[CONFIG_SKIP_CINEMATICS]);
799  m_int_configs[CONFIG_SKIP_CINEMATICS] = 0;
800  }
801 
802  if (reload)
803  {
804  uint32 val = sConfigMgr->GetIntDefault("MaxPlayerLevel", DEFAULT_MAX_LEVEL);
805  if (val != m_int_configs[CONFIG_MAX_PLAYER_LEVEL])
806  TC_LOG_ERROR("server.loading", "MaxPlayerLevel option can't be changed at config reload, using current value (%u).", m_int_configs[CONFIG_MAX_PLAYER_LEVEL]);
807  }
808  else
809  m_int_configs[CONFIG_MAX_PLAYER_LEVEL] = sConfigMgr->GetIntDefault("MaxPlayerLevel", DEFAULT_MAX_LEVEL);
810 
811  if (m_int_configs[CONFIG_MAX_PLAYER_LEVEL] > MAX_LEVEL)
812  {
813  TC_LOG_ERROR("server.loading", "MaxPlayerLevel (%i) must be in range 1..%u. Set to %u.", m_int_configs[CONFIG_MAX_PLAYER_LEVEL], MAX_LEVEL, MAX_LEVEL);
814  m_int_configs[CONFIG_MAX_PLAYER_LEVEL] = MAX_LEVEL;
815  }
816 
817  m_int_configs[CONFIG_MIN_DUALSPEC_LEVEL] = sConfigMgr->GetIntDefault("MinDualSpecLevel", 40);
818 
819  m_int_configs[CONFIG_START_PLAYER_LEVEL] = sConfigMgr->GetIntDefault("StartPlayerLevel", 1);
820  if (m_int_configs[CONFIG_START_PLAYER_LEVEL] < 1)
821  {
822  TC_LOG_ERROR("server.loading", "StartPlayerLevel (%i) must be in range 1..MaxPlayerLevel(%u). Set to 1.", m_int_configs[CONFIG_START_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL]);
823  m_int_configs[CONFIG_START_PLAYER_LEVEL] = 1;
824  }
825  else if (m_int_configs[CONFIG_START_PLAYER_LEVEL] > m_int_configs[CONFIG_MAX_PLAYER_LEVEL])
826  {
827  TC_LOG_ERROR("server.loading", "StartPlayerLevel (%i) must be in range 1..MaxPlayerLevel(%u). Set to %u.", m_int_configs[CONFIG_START_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL]);
828  m_int_configs[CONFIG_START_PLAYER_LEVEL] = m_int_configs[CONFIG_MAX_PLAYER_LEVEL];
829  }
830 
831  m_int_configs[CONFIG_START_HEROIC_PLAYER_LEVEL] = sConfigMgr->GetIntDefault("StartHeroicPlayerLevel", 55);
832  if (m_int_configs[CONFIG_START_HEROIC_PLAYER_LEVEL] < 1)
833  {
834  TC_LOG_ERROR("server.loading", "StartHeroicPlayerLevel (%i) must be in range 1..MaxPlayerLevel(%u). Set to 55.",
835  m_int_configs[CONFIG_START_HEROIC_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL]);
836  m_int_configs[CONFIG_START_HEROIC_PLAYER_LEVEL] = 55;
837  }
838  else if (m_int_configs[CONFIG_START_HEROIC_PLAYER_LEVEL] > m_int_configs[CONFIG_MAX_PLAYER_LEVEL])
839  {
840  TC_LOG_ERROR("server.loading", "StartHeroicPlayerLevel (%i) must be in range 1..MaxPlayerLevel(%u). Set to %u.",
841  m_int_configs[CONFIG_START_HEROIC_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL]);
842  m_int_configs[CONFIG_START_HEROIC_PLAYER_LEVEL] = m_int_configs[CONFIG_MAX_PLAYER_LEVEL];
843  }
844 
845  m_int_configs[CONFIG_START_PLAYER_MONEY] = sConfigMgr->GetIntDefault("StartPlayerMoney", 0);
846  if (int32(m_int_configs[CONFIG_START_PLAYER_MONEY]) < 0)
847  {
848  TC_LOG_ERROR("server.loading", "StartPlayerMoney (%i) must be in range 0.." UI64FMTD ". Set to %u.", m_int_configs[CONFIG_START_PLAYER_MONEY], uint64(MAX_MONEY_AMOUNT), 0);
849  m_int_configs[CONFIG_START_PLAYER_MONEY] = 0;
850  }
851  else if (m_int_configs[CONFIG_START_PLAYER_MONEY] > 0x7FFFFFFF-1) // TODO: (See MAX_MONEY_AMOUNT)
852  {
853  TC_LOG_ERROR("server.loading", "StartPlayerMoney (%i) must be in range 0..%u. Set to %u.",
854  m_int_configs[CONFIG_START_PLAYER_MONEY], 0x7FFFFFFF-1, 0x7FFFFFFF-1);
855  m_int_configs[CONFIG_START_PLAYER_MONEY] = 0x7FFFFFFF-1;
856  }
857 
858  m_int_configs[CONFIG_CURRENCY_RESET_HOUR] = sConfigMgr->GetIntDefault("Currency.ResetHour", 3);
859  if (m_int_configs[CONFIG_CURRENCY_RESET_HOUR] > 23)
860  {
861  TC_LOG_ERROR("server.loading", "Currency.ResetHour (%i) can't be load. Set to 6.", m_int_configs[CONFIG_CURRENCY_RESET_HOUR]);
862  m_int_configs[CONFIG_CURRENCY_RESET_HOUR] = 3;
863  }
864  m_int_configs[CONFIG_CURRENCY_RESET_DAY] = sConfigMgr->GetIntDefault("Currency.ResetDay", 3);
865  if (m_int_configs[CONFIG_CURRENCY_RESET_DAY] > 6)
866  {
867  TC_LOG_ERROR("server.loading", "Currency.ResetDay (%i) can't be load. Set to 3.", m_int_configs[CONFIG_CURRENCY_RESET_DAY]);
868  m_int_configs[CONFIG_CURRENCY_RESET_DAY] = 3;
869  }
870  m_int_configs[CONFIG_CURRENCY_RESET_INTERVAL] = sConfigMgr->GetIntDefault("Currency.ResetInterval", 7);
871  if (int32(m_int_configs[CONFIG_CURRENCY_RESET_INTERVAL]) <= 0)
872  {
873  TC_LOG_ERROR("server.loading", "Currency.ResetInterval (%i) must be > 0, set to default 7.", m_int_configs[CONFIG_CURRENCY_RESET_INTERVAL]);
874  m_int_configs[CONFIG_CURRENCY_RESET_INTERVAL] = 7;
875  }
876 
877  m_int_configs[CONFIG_CURRENCY_START_HONOR_POINTS] = sConfigMgr->GetIntDefault("Currency.StartHonorPoints", 0);
878  if (int32(m_int_configs[CONFIG_CURRENCY_START_HONOR_POINTS]) < 0)
879  {
880  TC_LOG_ERROR("server.loading", "Currency.StartHonorPoints (%i) must be >= 0, set to default 0.", m_int_configs[CONFIG_CURRENCY_START_HONOR_POINTS]);
881  m_int_configs[CONFIG_CURRENCY_START_HONOR_POINTS] = 0;
882  }
883  m_int_configs[CONFIG_CURRENCY_MAX_HONOR_POINTS] = sConfigMgr->GetIntDefault("Currency.MaxHonorPoints", 4000);
884  if (int32(m_int_configs[CONFIG_CURRENCY_MAX_HONOR_POINTS]) < 0)
885  {
886  TC_LOG_ERROR("server.loading", "Currency.MaxHonorPoints (%i) can't be negative. Set to default 4000.", m_int_configs[CONFIG_CURRENCY_MAX_HONOR_POINTS]);
887  m_int_configs[CONFIG_CURRENCY_MAX_HONOR_POINTS] = 4000;
888  }
889  m_int_configs[CONFIG_CURRENCY_MAX_HONOR_POINTS] *= 100; //precision mod
890 
891  m_int_configs[CONFIG_CURRENCY_START_APEXIS_CRYSTALS] = sConfigMgr->GetIntDefault("Currency.StartApexisCrystals", 0);
892  if (int32(m_int_configs[CONFIG_CURRENCY_START_APEXIS_CRYSTALS]) < 0)
893  {
894  TC_LOG_ERROR("server.loading", "Currency.StartApexisCrystals (%i) must be >= 0, set to default 0.", m_int_configs[CONFIG_CURRENCY_START_APEXIS_CRYSTALS]);
895  m_int_configs[CONFIG_CURRENCY_START_APEXIS_CRYSTALS] = 0;
896  }
897  m_int_configs[CONFIG_CURRENCY_MAX_APEXIS_CRYSTALS] = sConfigMgr->GetIntDefault("Currency.MaxApexisCrystals", 20000);
898  if (int32(m_int_configs[CONFIG_CURRENCY_MAX_APEXIS_CRYSTALS]) < 0)
899  {
900  TC_LOG_ERROR("server.loading", "Currency.MaxApexisCrystals (%i) can't be negative. Set to default 20000.", m_int_configs[CONFIG_CURRENCY_MAX_APEXIS_CRYSTALS]);
901  m_int_configs[CONFIG_CURRENCY_MAX_APEXIS_CRYSTALS] = 20000;
902  }
903  m_int_configs[CONFIG_CURRENCY_MAX_APEXIS_CRYSTALS] *= 100; //precision mod
904 
905  m_int_configs[CONFIG_CURRENCY_START_JUSTICE_POINTS] = sConfigMgr->GetIntDefault("Currency.StartJusticePoints", 0);
906  if (int32(m_int_configs[CONFIG_CURRENCY_START_JUSTICE_POINTS]) < 0)
907  {
908  TC_LOG_ERROR("server.loading", "Currency.StartJusticePoints (%i) must be >= 0, set to default 0.", m_int_configs[CONFIG_CURRENCY_START_JUSTICE_POINTS]);
909  m_int_configs[CONFIG_CURRENCY_START_JUSTICE_POINTS] = 0;
910  }
911  m_int_configs[CONFIG_CURRENCY_MAX_JUSTICE_POINTS] = sConfigMgr->GetIntDefault("Currency.MaxJusticePoints", 4000);
912  if (int32(m_int_configs[CONFIG_CURRENCY_MAX_JUSTICE_POINTS]) < 0)
913  {
914  TC_LOG_ERROR("server.loading", "Currency.MaxJusticePoints (%i) can't be negative. Set to default 4000.", m_int_configs[CONFIG_CURRENCY_MAX_JUSTICE_POINTS]);
915  m_int_configs[CONFIG_CURRENCY_MAX_JUSTICE_POINTS] = 4000;
916  }
917  m_int_configs[CONFIG_CURRENCY_MAX_JUSTICE_POINTS] *= 100; //precision mod
918 
919  m_int_configs[CONFIG_CURRENCY_START_CONQUEST_POINTS] = sConfigMgr->GetIntDefault("Currency.StartConquestPoints", 0);
920  if (int32(m_int_configs[CONFIG_CURRENCY_START_CONQUEST_POINTS]) < 0)
921  {
922  TC_LOG_ERROR("server.loading", "Currency.StartConquestPoints (%i) must be >= 0, set to default 0.", m_int_configs[CONFIG_CURRENCY_START_CONQUEST_POINTS]);
923  m_int_configs[CONFIG_CURRENCY_START_CONQUEST_POINTS] = 0;
924  }
925  m_int_configs[CONFIG_CURRENCY_CONQUEST_POINTS_WEEK_CAP] = sConfigMgr->GetIntDefault("Currency.ConquestPointsWeekCap", 1650);
926  if (int32(m_int_configs[CONFIG_CURRENCY_CONQUEST_POINTS_WEEK_CAP]) <= 0)
927  {
928  TC_LOG_ERROR("server.loading", "Currency.ConquestPointsWeekCap (%i) must be > 0, set to default 1650.", m_int_configs[CONFIG_CURRENCY_CONQUEST_POINTS_WEEK_CAP]);
929  m_int_configs[CONFIG_CURRENCY_CONQUEST_POINTS_WEEK_CAP] = 1650;
930  }
931  m_int_configs[CONFIG_CURRENCY_CONQUEST_POINTS_WEEK_CAP] *= 100; //precision mod
932 
933  m_int_configs[CONFIG_CURRENCY_CONQUEST_POINTS_ARENA_REWARD] = sConfigMgr->GetIntDefault("Currency.ConquestPointsArenaReward", 180);
934  if (int32(m_int_configs[CONFIG_CURRENCY_CONQUEST_POINTS_ARENA_REWARD]) <= 0)
935  {
936  TC_LOG_ERROR("server.loading", "Currency.ConquestPointsArenaReward (%i) must be > 0, set to default 180.", m_int_configs[CONFIG_CURRENCY_CONQUEST_POINTS_ARENA_REWARD]);
938  }
939  m_int_configs[CONFIG_CURRENCY_CONQUEST_POINTS_ARENA_REWARD] *= 100; //precision mod
940 
941  m_int_configs[CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL] = sConfigMgr->GetIntDefault("RecruitAFriend.MaxLevel", 85);
942  if (m_int_configs[CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL] > m_int_configs[CONFIG_MAX_PLAYER_LEVEL])
943  {
944  TC_LOG_ERROR("server.loading", "RecruitAFriend.MaxLevel (%i) must be in the range 0..MaxLevel(%u). Set to %u.",
945  m_int_configs[CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL], 85);
947  }
948 
949  m_int_configs[CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL_DIFFERENCE] = sConfigMgr->GetIntDefault("RecruitAFriend.MaxDifference", 4);
950  m_bool_configs[CONFIG_ALL_TAXI_PATHS] = sConfigMgr->GetBoolDefault("AllFlightPaths", false);
951  m_bool_configs[CONFIG_INSTANT_TAXI] = sConfigMgr->GetBoolDefault("InstantFlightPaths", false);
952 
953  m_bool_configs[CONFIG_INSTANCE_IGNORE_LEVEL] = sConfigMgr->GetBoolDefault("Instance.IgnoreLevel", false);
954  m_bool_configs[CONFIG_INSTANCE_IGNORE_RAID] = sConfigMgr->GetBoolDefault("Instance.IgnoreRaid", false);
955 
956  m_bool_configs[CONFIG_CAST_UNSTUCK] = sConfigMgr->GetBoolDefault("CastUnstuck", true);
957  m_int_configs[CONFIG_INSTANCE_RESET_TIME_HOUR] = sConfigMgr->GetIntDefault("Instance.ResetTimeHour", 4);
958  m_int_configs[CONFIG_INSTANCE_UNLOAD_DELAY] = sConfigMgr->GetIntDefault("Instance.UnloadDelay", 30 * MINUTE * IN_MILLISECONDS);
959 
960  m_int_configs[CONFIG_MAX_PRIMARY_TRADE_SKILL] = sConfigMgr->GetIntDefault("MaxPrimaryTradeSkill", 2);
961  m_int_configs[CONFIG_MIN_PETITION_SIGNS] = sConfigMgr->GetIntDefault("MinPetitionSigns", 4);
962  if (m_int_configs[CONFIG_MIN_PETITION_SIGNS] > 4)
963  {
964  TC_LOG_ERROR("server.loading", "MinPetitionSigns (%i) must be in range 0..4. Set to 4.", m_int_configs[CONFIG_MIN_PETITION_SIGNS]);
965  m_int_configs[CONFIG_MIN_PETITION_SIGNS] = 4;
966  }
967 
968  m_int_configs[CONFIG_GM_LOGIN_STATE] = sConfigMgr->GetIntDefault("GM.LoginState", 2);
969  m_int_configs[CONFIG_GM_VISIBLE_STATE] = sConfigMgr->GetIntDefault("GM.Visible", 2);
970  m_int_configs[CONFIG_GM_CHAT] = sConfigMgr->GetIntDefault("GM.Chat", 2);
971  m_int_configs[CONFIG_GM_WHISPERING_TO] = sConfigMgr->GetIntDefault("GM.WhisperingTo", 2);
972  m_int_configs[CONFIG_GM_FREEZE_DURATION] = sConfigMgr->GetIntDefault("GM.FreezeAuraDuration", 0);
973 
974  m_int_configs[CONFIG_GM_LEVEL_IN_GM_LIST] = sConfigMgr->GetIntDefault("GM.InGMList.Level", SEC_ADMINISTRATOR);
975  m_int_configs[CONFIG_GM_LEVEL_IN_WHO_LIST] = sConfigMgr->GetIntDefault("GM.InWhoList.Level", SEC_ADMINISTRATOR);
976  m_int_configs[CONFIG_START_GM_LEVEL] = sConfigMgr->GetIntDefault("GM.StartLevel", 1);
977  if (m_int_configs[CONFIG_START_GM_LEVEL] < m_int_configs[CONFIG_START_PLAYER_LEVEL])
978  {
979  TC_LOG_ERROR("server.loading", "GM.StartLevel (%i) must be in range StartPlayerLevel(%u)..%u. Set to %u.",
980  m_int_configs[CONFIG_START_GM_LEVEL], m_int_configs[CONFIG_START_PLAYER_LEVEL], MAX_LEVEL, m_int_configs[CONFIG_START_PLAYER_LEVEL]);
981  m_int_configs[CONFIG_START_GM_LEVEL] = m_int_configs[CONFIG_START_PLAYER_LEVEL];
982  }
983  else if (m_int_configs[CONFIG_START_GM_LEVEL] > MAX_LEVEL)
984  {
985  TC_LOG_ERROR("server.loading", "GM.StartLevel (%i) must be in range 1..%u. Set to %u.", m_int_configs[CONFIG_START_GM_LEVEL], MAX_LEVEL, MAX_LEVEL);
986  m_int_configs[CONFIG_START_GM_LEVEL] = MAX_LEVEL;
987  }
988  m_bool_configs[CONFIG_ALLOW_GM_GROUP] = sConfigMgr->GetBoolDefault("GM.AllowInvite", false);
989  m_bool_configs[CONFIG_GM_LOWER_SECURITY] = sConfigMgr->GetBoolDefault("GM.LowerSecurity", false);
990 
991  m_int_configs[CONFIG_GROUP_VISIBILITY] = sConfigMgr->GetIntDefault("Visibility.GroupMode", 1);
992 
993  m_int_configs[CONFIG_MAIL_DELIVERY_DELAY] = sConfigMgr->GetIntDefault("MailDeliveryDelay", HOUR);
994 
995  m_int_configs[CONFIG_UPTIME_UPDATE] = sConfigMgr->GetIntDefault("UpdateUptimeInterval", 10);
996  if (int32(m_int_configs[CONFIG_UPTIME_UPDATE]) <= 0)
997  {
998  TC_LOG_ERROR("server.loading", "UpdateUptimeInterval (%i) must be > 0, set to default 10.", m_int_configs[CONFIG_UPTIME_UPDATE]);
999  m_int_configs[CONFIG_UPTIME_UPDATE] = 10;
1000  }
1001  if (reload)
1002  {
1003  m_timers[WUPDATE_UPTIME].SetInterval(m_int_configs[CONFIG_UPTIME_UPDATE]*MINUTE*IN_MILLISECONDS);
1005  }
1006 
1007  // log db cleanup interval
1008  m_int_configs[CONFIG_LOGDB_CLEARINTERVAL] = sConfigMgr->GetIntDefault("LogDB.Opt.ClearInterval", 10);
1009  if (int32(m_int_configs[CONFIG_LOGDB_CLEARINTERVAL]) <= 0)
1010  {
1011  TC_LOG_ERROR("server.loading", "LogDB.Opt.ClearInterval (%i) must be > 0, set to default 10.", m_int_configs[CONFIG_LOGDB_CLEARINTERVAL]);
1012  m_int_configs[CONFIG_LOGDB_CLEARINTERVAL] = 10;
1013  }
1014  if (reload)
1015  {
1016  m_timers[WUPDATE_CLEANDB].SetInterval(m_int_configs[CONFIG_LOGDB_CLEARINTERVAL] * MINUTE * IN_MILLISECONDS);
1018  }
1019  m_int_configs[CONFIG_LOGDB_CLEARTIME] = sConfigMgr->GetIntDefault("LogDB.Opt.ClearTime", 1209600); // 14 days default
1020  TC_LOG_INFO("server.loading", "Will clear `logs` table of entries older than %i seconds every %u minutes.",
1021  m_int_configs[CONFIG_LOGDB_CLEARTIME], m_int_configs[CONFIG_LOGDB_CLEARINTERVAL]);
1022 
1023  m_int_configs[CONFIG_SKILL_CHANCE_ORANGE] = sConfigMgr->GetIntDefault("SkillChance.Orange", 100);
1024  m_int_configs[CONFIG_SKILL_CHANCE_YELLOW] = sConfigMgr->GetIntDefault("SkillChance.Yellow", 75);
1025  m_int_configs[CONFIG_SKILL_CHANCE_GREEN] = sConfigMgr->GetIntDefault("SkillChance.Green", 25);
1026  m_int_configs[CONFIG_SKILL_CHANCE_GREY] = sConfigMgr->GetIntDefault("SkillChance.Grey", 0);
1027 
1028  m_int_configs[CONFIG_SKILL_CHANCE_MINING_STEPS] = sConfigMgr->GetIntDefault("SkillChance.MiningSteps", 75);
1029  m_int_configs[CONFIG_SKILL_CHANCE_SKINNING_STEPS] = sConfigMgr->GetIntDefault("SkillChance.SkinningSteps", 75);
1030 
1031  m_bool_configs[CONFIG_SKILL_PROSPECTING] = sConfigMgr->GetBoolDefault("SkillChance.Prospecting", false);
1032  m_bool_configs[CONFIG_SKILL_MILLING] = sConfigMgr->GetBoolDefault("SkillChance.Milling", false);
1033 
1034  m_int_configs[CONFIG_SKILL_GAIN_CRAFTING] = sConfigMgr->GetIntDefault("SkillGain.Crafting", 1);
1035 
1036  m_int_configs[CONFIG_SKILL_GAIN_GATHERING] = sConfigMgr->GetIntDefault("SkillGain.Gathering", 1);
1037 
1038  m_int_configs[CONFIG_MAX_OVERSPEED_PINGS] = sConfigMgr->GetIntDefault("MaxOverspeedPings", 2);
1039 
1040  if (m_int_configs[CONFIG_MAX_OVERSPEED_PINGS] != 0 && m_int_configs[CONFIG_MAX_OVERSPEED_PINGS] < 2)
1041  {
1042  TC_LOG_ERROR("server.loading", "MaxOverspeedPings (%i) must be in range 2..infinity (or 0 to disable check). Set to 2.", m_int_configs[CONFIG_MAX_OVERSPEED_PINGS]);
1043  m_int_configs[CONFIG_MAX_OVERSPEED_PINGS] = 2;
1044  }
1045 
1046  m_bool_configs[CONFIG_SAVE_RESPAWN_TIME_IMMEDIATELY] = sConfigMgr->GetBoolDefault("SaveRespawnTimeImmediately", true);
1047  if (!m_bool_configs[CONFIG_SAVE_RESPAWN_TIME_IMMEDIATELY])
1048  {
1049  TC_LOG_WARN("server.loading", "SaveRespawnTimeImmediately triggers assertions when disabled, overridden to Enabled");
1050  m_bool_configs[CONFIG_SAVE_RESPAWN_TIME_IMMEDIATELY] = true;
1051  }
1052 
1053  m_bool_configs[CONFIG_WEATHER] = sConfigMgr->GetBoolDefault("ActivateWeather", true);
1054 
1055  m_int_configs[CONFIG_DISABLE_BREATHING] = sConfigMgr->GetIntDefault("DisableWaterBreath", SEC_CONSOLE);
1056 
1057  if (reload)
1058  {
1059  uint32 val = sConfigMgr->GetIntDefault("Expansion", CURRENT_EXPANSION);
1060  if (val != m_int_configs[CONFIG_EXPANSION])
1061  TC_LOG_ERROR("server.loading", "Expansion option can't be changed at worldserver.conf reload, using current value (%u).", m_int_configs[CONFIG_EXPANSION]);
1062  }
1063  else
1064  m_int_configs[CONFIG_EXPANSION] = sConfigMgr->GetIntDefault("Expansion", CURRENT_EXPANSION);
1065 
1066  m_int_configs[CONFIG_CHATFLOOD_MESSAGE_COUNT] = sConfigMgr->GetIntDefault("ChatFlood.MessageCount", 10);
1067  m_int_configs[CONFIG_CHATFLOOD_MESSAGE_DELAY] = sConfigMgr->GetIntDefault("ChatFlood.MessageDelay", 1);
1068  m_int_configs[CONFIG_CHATFLOOD_MUTE_TIME] = sConfigMgr->GetIntDefault("ChatFlood.MuteTime", 10);
1069 
1070  m_bool_configs[CONFIG_EVENT_ANNOUNCE] = sConfigMgr->GetBoolDefault("Event.Announce", false);
1071 
1072  m_float_configs[CONFIG_CREATURE_FAMILY_FLEE_ASSISTANCE_RADIUS] = sConfigMgr->GetFloatDefault("CreatureFamilyFleeAssistanceRadius", 30.0f);
1073  m_float_configs[CONFIG_CREATURE_FAMILY_ASSISTANCE_RADIUS] = sConfigMgr->GetFloatDefault("CreatureFamilyAssistanceRadius", 10.0f);
1074  m_int_configs[CONFIG_CREATURE_FAMILY_ASSISTANCE_DELAY] = sConfigMgr->GetIntDefault("CreatureFamilyAssistanceDelay", 1500);
1075  m_int_configs[CONFIG_CREATURE_FAMILY_FLEE_DELAY] = sConfigMgr->GetIntDefault("CreatureFamilyFleeDelay", 7000);
1076 
1077  m_int_configs[CONFIG_WORLD_BOSS_LEVEL_DIFF] = sConfigMgr->GetIntDefault("WorldBossLevelDiff", 3);
1078 
1079  m_bool_configs[CONFIG_QUEST_ENABLE_QUEST_TRACKER] = sConfigMgr->GetBoolDefault("Quests.EnableQuestTracker", false);
1080 
1081  // note: disable value (-1) will assigned as 0xFFFFFFF, to prevent overflow at calculations limit it to max possible player level MAX_LEVEL(100)
1082  m_int_configs[CONFIG_QUEST_LOW_LEVEL_HIDE_DIFF] = sConfigMgr->GetIntDefault("Quests.LowLevelHideDiff", 4);
1083  if (m_int_configs[CONFIG_QUEST_LOW_LEVEL_HIDE_DIFF] > MAX_LEVEL)
1085  m_int_configs[CONFIG_QUEST_HIGH_LEVEL_HIDE_DIFF] = sConfigMgr->GetIntDefault("Quests.HighLevelHideDiff", 7);
1086  if (m_int_configs[CONFIG_QUEST_HIGH_LEVEL_HIDE_DIFF] > MAX_LEVEL)
1088  m_bool_configs[CONFIG_QUEST_IGNORE_RAID] = sConfigMgr->GetBoolDefault("Quests.IgnoreRaid", false);
1089  m_bool_configs[CONFIG_QUEST_IGNORE_AUTO_ACCEPT] = sConfigMgr->GetBoolDefault("Quests.IgnoreAutoAccept", false);
1090  m_bool_configs[CONFIG_QUEST_IGNORE_AUTO_COMPLETE] = sConfigMgr->GetBoolDefault("Quests.IgnoreAutoComplete", false);
1091 
1092  m_int_configs[CONFIG_RANDOM_BG_RESET_HOUR] = sConfigMgr->GetIntDefault("Battleground.Random.ResetHour", 6);
1093  if (m_int_configs[CONFIG_RANDOM_BG_RESET_HOUR] > 23)
1094  {
1095  TC_LOG_ERROR("server.loading", "Battleground.Random.ResetHour (%i) can't be load. Set to 6.", m_int_configs[CONFIG_RANDOM_BG_RESET_HOUR]);
1096  m_int_configs[CONFIG_RANDOM_BG_RESET_HOUR] = 6;
1097  }
1098 
1099  m_int_configs[CONFIG_GUILD_RESET_HOUR] = sConfigMgr->GetIntDefault("Guild.ResetHour", 6);
1100  if (m_int_configs[CONFIG_GUILD_RESET_HOUR] > 23)
1101  {
1102  TC_LOG_ERROR("misc", "Guild.ResetHour (%i) can't be load. Set to 6.", m_int_configs[CONFIG_GUILD_RESET_HOUR]);
1103  m_int_configs[CONFIG_GUILD_RESET_HOUR] = 6;
1104  }
1105 
1106  m_bool_configs[CONFIG_DETECT_POS_COLLISION] = sConfigMgr->GetBoolDefault("DetectPosCollision", true);
1107 
1108  m_bool_configs[CONFIG_RESTRICTED_LFG_CHANNEL] = sConfigMgr->GetBoolDefault("Channel.RestrictedLfg", true);
1109  m_bool_configs[CONFIG_TALENTS_INSPECTING] = sConfigMgr->GetBoolDefault("TalentsInspecting", true);
1110  m_bool_configs[CONFIG_CHAT_FAKE_MESSAGE_PREVENTING] = sConfigMgr->GetBoolDefault("ChatFakeMessagePreventing", false);
1111  m_int_configs[CONFIG_CHAT_STRICT_LINK_CHECKING_SEVERITY] = sConfigMgr->GetIntDefault("ChatStrictLinkChecking.Severity", 0);
1112  m_int_configs[CONFIG_CHAT_STRICT_LINK_CHECKING_KICK] = sConfigMgr->GetIntDefault("ChatStrictLinkChecking.Kick", 0);
1113 
1114  m_int_configs[CONFIG_CORPSE_DECAY_NORMAL] = sConfigMgr->GetIntDefault("Corpse.Decay.NORMAL", 60);
1115  m_int_configs[CONFIG_CORPSE_DECAY_RARE] = sConfigMgr->GetIntDefault("Corpse.Decay.RARE", 300);
1116  m_int_configs[CONFIG_CORPSE_DECAY_ELITE] = sConfigMgr->GetIntDefault("Corpse.Decay.ELITE", 300);
1117  m_int_configs[CONFIG_CORPSE_DECAY_RAREELITE] = sConfigMgr->GetIntDefault("Corpse.Decay.RAREELITE", 300);
1118  m_int_configs[CONFIG_CORPSE_DECAY_WORLDBOSS] = sConfigMgr->GetIntDefault("Corpse.Decay.WORLDBOSS", 3600);
1119 
1120  m_int_configs[CONFIG_DEATH_SICKNESS_LEVEL] = sConfigMgr->GetIntDefault ("Death.SicknessLevel", 11);
1121  m_bool_configs[CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVP] = sConfigMgr->GetBoolDefault("Death.CorpseReclaimDelay.PvP", true);
1122  m_bool_configs[CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVE] = sConfigMgr->GetBoolDefault("Death.CorpseReclaimDelay.PvE", true);
1123  m_bool_configs[CONFIG_DEATH_BONES_WORLD] = sConfigMgr->GetBoolDefault("Death.Bones.World", true);
1124  m_bool_configs[CONFIG_DEATH_BONES_BG_OR_ARENA] = sConfigMgr->GetBoolDefault("Death.Bones.BattlegroundOrArena", true);
1125 
1126  m_bool_configs[CONFIG_DIE_COMMAND_MODE] = sConfigMgr->GetBoolDefault("Die.Command.Mode", true);
1127 
1128  m_float_configs[CONFIG_THREAT_RADIUS] = sConfigMgr->GetFloatDefault("ThreatRadius", 60.0f);
1129 
1130  // always use declined names in the russian client
1131  m_bool_configs[CONFIG_DECLINED_NAMES_USED] =
1132 
1133  (m_int_configs[CONFIG_REALM_ZONE] == REALM_ZONE_RUSSIAN) ? true : sConfigMgr->GetBoolDefault("DeclinedNames", false);
1134 
1135  m_float_configs[CONFIG_LISTEN_RANGE_SAY] = sConfigMgr->GetFloatDefault("ListenRange.Say", 25.0f);
1136  m_float_configs[CONFIG_LISTEN_RANGE_TEXTEMOTE] = sConfigMgr->GetFloatDefault("ListenRange.TextEmote", 25.0f);
1137  m_float_configs[CONFIG_LISTEN_RANGE_YELL] = sConfigMgr->GetFloatDefault("ListenRange.Yell", 300.0f);
1138 
1139  m_bool_configs[CONFIG_BATTLEGROUND_CAST_DESERTER] = sConfigMgr->GetBoolDefault("Battleground.CastDeserter", true);
1140  m_bool_configs[CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_ENABLE] = sConfigMgr->GetBoolDefault("Battleground.QueueAnnouncer.Enable", false);
1141  m_bool_configs[CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_PLAYERONLY] = sConfigMgr->GetBoolDefault("Battleground.QueueAnnouncer.PlayerOnly", false);
1142  m_bool_configs[CONFIG_BATTLEGROUND_STORE_STATISTICS_ENABLE] = sConfigMgr->GetBoolDefault("Battleground.StoreStatistics.Enable", false);
1143  m_int_configs[CONFIG_BATTLEGROUND_INVITATION_TYPE] = sConfigMgr->GetIntDefault ("Battleground.InvitationType", 0);
1144  m_int_configs[CONFIG_BATTLEGROUND_PREMATURE_FINISH_TIMER] = sConfigMgr->GetIntDefault ("Battleground.PrematureFinishTimer", 5 * MINUTE * IN_MILLISECONDS);
1145  m_int_configs[CONFIG_BATTLEGROUND_PREMADE_GROUP_WAIT_FOR_MATCH] = sConfigMgr->GetIntDefault ("Battleground.PremadeGroupWaitForMatch", 30 * MINUTE * IN_MILLISECONDS);
1146  m_bool_configs[CONFIG_BG_XP_FOR_KILL] = sConfigMgr->GetBoolDefault("Battleground.GiveXPForKills", false);
1147  m_int_configs[CONFIG_ARENA_MAX_RATING_DIFFERENCE] = sConfigMgr->GetIntDefault ("Arena.MaxRatingDifference", 150);
1148  m_int_configs[CONFIG_ARENA_RATING_DISCARD_TIMER] = sConfigMgr->GetIntDefault ("Arena.RatingDiscardTimer", 10 * MINUTE * IN_MILLISECONDS);
1149  m_int_configs[CONFIG_ARENA_RATED_UPDATE_TIMER] = sConfigMgr->GetIntDefault ("Arena.RatedUpdateTimer", 5 * IN_MILLISECONDS);
1150  m_bool_configs[CONFIG_ARENA_QUEUE_ANNOUNCER_ENABLE] = sConfigMgr->GetBoolDefault("Arena.QueueAnnouncer.Enable", false);
1151  m_int_configs[CONFIG_ARENA_SEASON_ID] = sConfigMgr->GetIntDefault ("Arena.ArenaSeason.ID", 15);
1152  m_int_configs[CONFIG_ARENA_START_RATING] = sConfigMgr->GetIntDefault ("Arena.ArenaStartRating", 0);
1153  m_int_configs[CONFIG_ARENA_START_PERSONAL_RATING] = sConfigMgr->GetIntDefault ("Arena.ArenaStartPersonalRating", 1000);
1154  m_int_configs[CONFIG_ARENA_START_MATCHMAKER_RATING] = sConfigMgr->GetIntDefault ("Arena.ArenaStartMatchmakerRating", 1500);
1155  m_bool_configs[CONFIG_ARENA_SEASON_IN_PROGRESS] = sConfigMgr->GetBoolDefault("Arena.ArenaSeason.InProgress", false);
1156  m_bool_configs[CONFIG_ARENA_LOG_EXTENDED_INFO] = sConfigMgr->GetBoolDefault("ArenaLog.ExtendedInfo", false);
1157  m_float_configs[CONFIG_ARENA_WIN_RATING_MODIFIER_1] = sConfigMgr->GetFloatDefault("Arena.ArenaWinRatingModifier1", 48.0f);
1158  m_float_configs[CONFIG_ARENA_WIN_RATING_MODIFIER_2] = sConfigMgr->GetFloatDefault("Arena.ArenaWinRatingModifier2", 24.0f);
1159  m_float_configs[CONFIG_ARENA_LOSE_RATING_MODIFIER] = sConfigMgr->GetFloatDefault("Arena.ArenaLoseRatingModifier", 24.0f);
1160  m_float_configs[CONFIG_ARENA_MATCHMAKER_RATING_MODIFIER] = sConfigMgr->GetFloatDefault("Arena.ArenaMatchmakerRatingModifier", 24.0f);
1161 
1162  m_bool_configs[CONFIG_OFFHAND_CHECK_AT_SPELL_UNLEARN] = sConfigMgr->GetBoolDefault("OffhandCheckAtSpellUnlearn", true);
1163 
1164  m_int_configs[CONFIG_CREATURE_PICKPOCKET_REFILL] = sConfigMgr->GetIntDefault("Creature.PickPocketRefillDelay", 10 * MINUTE);
1165 
1166  if (int32 clientCacheId = sConfigMgr->GetIntDefault("ClientCacheVersion", 0))
1167  {
1168  // overwrite DB/old value
1169  if (clientCacheId > 0)
1170  {
1171  m_int_configs[CONFIG_CLIENTCACHE_VERSION] = clientCacheId;
1172  TC_LOG_INFO("server.loading", "Client cache version set to: %u", clientCacheId);
1173  }
1174  else
1175  TC_LOG_ERROR("server.loading", "ClientCacheVersion can't be negative %d, ignored.", clientCacheId);
1176  }
1177 
1178  m_int_configs[CONFIG_GUILD_NEWS_LOG_COUNT] = sConfigMgr->GetIntDefault("Guild.NewsLogRecordsCount", GUILD_NEWSLOG_MAX_RECORDS);
1181  m_int_configs[CONFIG_GUILD_EVENT_LOG_COUNT] = sConfigMgr->GetIntDefault("Guild.EventLogRecordsCount", GUILD_EVENTLOG_MAX_RECORDS);
1184  m_int_configs[CONFIG_GUILD_BANK_EVENT_LOG_COUNT] = sConfigMgr->GetIntDefault("Guild.BankEventLogRecordsCount", GUILD_BANKLOG_MAX_RECORDS);
1187 
1188  //visibility on continents
1189  m_MaxVisibleDistanceOnContinents = sConfigMgr->GetFloatDefault("Visibility.Distance.Continents", DEFAULT_VISIBILITY_DISTANCE);
1190  if (m_MaxVisibleDistanceOnContinents < 45*sWorld->getRate(RATE_CREATURE_AGGRO))
1191  {
1192  TC_LOG_ERROR("server.loading", "Visibility.Distance.Continents can't be less max aggro radius %f", 45*sWorld->getRate(RATE_CREATURE_AGGRO));
1194  }
1195  else if (m_MaxVisibleDistanceOnContinents > MAX_VISIBILITY_DISTANCE)
1196  {
1197  TC_LOG_ERROR("server.loading", "Visibility.Distance.Continents can't be greater %f", MAX_VISIBILITY_DISTANCE);
1198  m_MaxVisibleDistanceOnContinents = MAX_VISIBILITY_DISTANCE;
1199  }
1200 
1201  //visibility in instances
1202  m_MaxVisibleDistanceInInstances = sConfigMgr->GetFloatDefault("Visibility.Distance.Instances", DEFAULT_VISIBILITY_INSTANCE);
1203  if (m_MaxVisibleDistanceInInstances < 45*sWorld->getRate(RATE_CREATURE_AGGRO))
1204  {
1205  TC_LOG_ERROR("server.loading", "Visibility.Distance.Instances can't be less max aggro radius %f", 45*sWorld->getRate(RATE_CREATURE_AGGRO));
1207  }
1208  else if (m_MaxVisibleDistanceInInstances > MAX_VISIBILITY_DISTANCE)
1209  {
1210  TC_LOG_ERROR("server.loading", "Visibility.Distance.Instances can't be greater %f", MAX_VISIBILITY_DISTANCE);
1211  m_MaxVisibleDistanceInInstances = MAX_VISIBILITY_DISTANCE;
1212  }
1213 
1214  //visibility in BG/Arenas
1215  m_MaxVisibleDistanceInBGArenas = sConfigMgr->GetFloatDefault("Visibility.Distance.BGArenas", DEFAULT_VISIBILITY_BGARENAS);
1216  if (m_MaxVisibleDistanceInBGArenas < 45*sWorld->getRate(RATE_CREATURE_AGGRO))
1217  {
1218  TC_LOG_ERROR("server.loading", "Visibility.Distance.BGArenas can't be less max aggro radius %f", 45*sWorld->getRate(RATE_CREATURE_AGGRO));
1220  }
1221  else if (m_MaxVisibleDistanceInBGArenas > MAX_VISIBILITY_DISTANCE)
1222  {
1223  TC_LOG_ERROR("server.loading", "Visibility.Distance.BGArenas can't be greater %f", MAX_VISIBILITY_DISTANCE);
1224  m_MaxVisibleDistanceInBGArenas = MAX_VISIBILITY_DISTANCE;
1225  }
1226 
1227  m_visibility_notify_periodOnContinents = sConfigMgr->GetIntDefault("Visibility.Notify.Period.OnContinents", DEFAULT_VISIBILITY_NOTIFY_PERIOD);
1228  m_visibility_notify_periodInInstances = sConfigMgr->GetIntDefault("Visibility.Notify.Period.InInstances", DEFAULT_VISIBILITY_NOTIFY_PERIOD);
1229  m_visibility_notify_periodInBGArenas = sConfigMgr->GetIntDefault("Visibility.Notify.Period.InBGArenas", DEFAULT_VISIBILITY_NOTIFY_PERIOD);
1230 
1232  m_int_configs[CONFIG_CHARDELETE_METHOD] = sConfigMgr->GetIntDefault("CharDelete.Method", 0);
1233  m_int_configs[CONFIG_CHARDELETE_MIN_LEVEL] = sConfigMgr->GetIntDefault("CharDelete.MinLevel", 0);
1234  m_int_configs[CONFIG_CHARDELETE_HEROIC_MIN_LEVEL] = sConfigMgr->GetIntDefault("CharDelete.Heroic.MinLevel", 0);
1235  m_int_configs[CONFIG_CHARDELETE_KEEP_DAYS] = sConfigMgr->GetIntDefault("CharDelete.KeepDays", 30);
1236 
1237  // No aggro from gray mobs
1238  m_int_configs[CONFIG_NO_GRAY_AGGRO_ABOVE] = sConfigMgr->GetIntDefault("NoGrayAggro.Above", 0);
1239  m_int_configs[CONFIG_NO_GRAY_AGGRO_BELOW] = sConfigMgr->GetIntDefault("NoGrayAggro.Below", 0);
1240  if (m_int_configs[CONFIG_NO_GRAY_AGGRO_ABOVE] > m_int_configs[CONFIG_MAX_PLAYER_LEVEL])
1241  {
1242  TC_LOG_ERROR("server.loading", "NoGrayAggro.Above (%i) must be in range 0..%u. Set to %u.", m_int_configs[CONFIG_NO_GRAY_AGGRO_ABOVE], m_int_configs[CONFIG_MAX_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL]);
1243  m_int_configs[CONFIG_NO_GRAY_AGGRO_ABOVE] = m_int_configs[CONFIG_MAX_PLAYER_LEVEL];
1244  }
1245  if (m_int_configs[CONFIG_NO_GRAY_AGGRO_BELOW] > m_int_configs[CONFIG_MAX_PLAYER_LEVEL])
1246  {
1247  TC_LOG_ERROR("server.loading", "NoGrayAggro.Below (%i) must be in range 0..%u. Set to %u.", m_int_configs[CONFIG_NO_GRAY_AGGRO_BELOW], m_int_configs[CONFIG_MAX_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL]);
1248  m_int_configs[CONFIG_NO_GRAY_AGGRO_BELOW] = m_int_configs[CONFIG_MAX_PLAYER_LEVEL];
1249  }
1250  if (m_int_configs[CONFIG_NO_GRAY_AGGRO_ABOVE] > 0 && m_int_configs[CONFIG_NO_GRAY_AGGRO_ABOVE] < m_int_configs[CONFIG_NO_GRAY_AGGRO_BELOW])
1251  {
1252  TC_LOG_ERROR("server.loading", "NoGrayAggro.Below (%i) cannot be greater than NoGrayAggro.Above (%i). Set to %i.", m_int_configs[CONFIG_NO_GRAY_AGGRO_BELOW], m_int_configs[CONFIG_NO_GRAY_AGGRO_ABOVE], m_int_configs[CONFIG_NO_GRAY_AGGRO_ABOVE]);
1253  m_int_configs[CONFIG_NO_GRAY_AGGRO_BELOW] = m_int_configs[CONFIG_NO_GRAY_AGGRO_ABOVE];
1254  }
1255 
1257  std::string dataPath = sConfigMgr->GetStringDefault("DataDir", "./");
1258  if (dataPath.empty() || (dataPath.at(dataPath.length()-1) != '/' && dataPath.at(dataPath.length()-1) != '\\'))
1259  dataPath.push_back('/');
1260 
1261 #if PLATFORM == PLATFORM_UNIX || PLATFORM == PLATFORM_APPLE
1262  if (dataPath[0] == '~')
1263  {
1264  const char* home = getenv("HOME");
1265  if (home)
1266  dataPath.replace(0, 1, home);
1267  }
1268 #endif
1269 
1270  if (reload)
1271  {
1272  if (dataPath != m_dataPath)
1273  TC_LOG_ERROR("server.loading", "DataDir option can't be changed at worldserver.conf reload, using current value (%s).", m_dataPath.c_str());
1274  }
1275  else
1276  {
1277  m_dataPath = dataPath;
1278  TC_LOG_INFO("server.loading", "Using DataDir %s", m_dataPath.c_str());
1279  }
1280 
1281  m_bool_configs[CONFIG_ENABLE_MMAPS] = sConfigMgr->GetBoolDefault("mmap.enablePathFinding", false);
1282  TC_LOG_INFO("server.loading", "WORLD: MMap data directory is: %smmaps", m_dataPath.c_str());
1283 
1284  m_bool_configs[CONFIG_VMAP_INDOOR_CHECK] = sConfigMgr->GetBoolDefault("vmap.enableIndoorCheck", 0);
1285  bool enableIndoor = sConfigMgr->GetBoolDefault("vmap.enableIndoorCheck", true);
1286  bool enableLOS = sConfigMgr->GetBoolDefault("vmap.enableLOS", true);
1287  bool enableHeight = sConfigMgr->GetBoolDefault("vmap.enableHeight", true);
1288 
1289  if (!enableHeight)
1290  TC_LOG_ERROR("server.loading", "VMap height checking disabled! Creatures movements and other various things WILL be broken! Expect no support.");
1291 
1294  TC_LOG_INFO("server.loading", "VMap support included. LineOfSight: %i, getHeight: %i, indoorCheck: %i", enableLOS, enableHeight, enableIndoor);
1295  TC_LOG_INFO("server.loading", "VMap data directory is: %svmaps", m_dataPath.c_str());
1296 
1297  m_int_configs[CONFIG_MAX_WHO] = sConfigMgr->GetIntDefault("MaxWhoListReturns", 49);
1298  m_bool_configs[CONFIG_START_ALL_SPELLS] = sConfigMgr->GetBoolDefault("PlayerStart.AllSpells", false);
1299  if (m_bool_configs[CONFIG_START_ALL_SPELLS])
1300  TC_LOG_WARN("server.loading", "PlayerStart.AllSpells enabled - may not function as intended!");
1301  m_int_configs[CONFIG_HONOR_AFTER_DUEL] = sConfigMgr->GetIntDefault("HonorPointsAfterDuel", 0);
1302  m_bool_configs[CONFIG_RESET_DUEL_COOLDOWNS] = sConfigMgr->GetBoolDefault("ResetDuelCooldowns", false);
1303  m_bool_configs[CONFIG_RESET_DUEL_HEALTH_MANA] = sConfigMgr->GetBoolDefault("ResetDuelHealthMana", false);
1304  m_bool_configs[CONFIG_START_ALL_EXPLORED] = sConfigMgr->GetBoolDefault("PlayerStart.MapsExplored", false);
1305  m_bool_configs[CONFIG_START_ALL_REP] = sConfigMgr->GetBoolDefault("PlayerStart.AllReputation", false);
1306  m_bool_configs[CONFIG_ALWAYS_MAXSKILL] = sConfigMgr->GetBoolDefault("AlwaysMaxWeaponSkill", false);
1307  m_bool_configs[CONFIG_PVP_TOKEN_ENABLE] = sConfigMgr->GetBoolDefault("PvPToken.Enable", false);
1308  m_int_configs[CONFIG_PVP_TOKEN_MAP_TYPE] = sConfigMgr->GetIntDefault("PvPToken.MapAllowType", 4);
1309  m_int_configs[CONFIG_PVP_TOKEN_ID] = sConfigMgr->GetIntDefault("PvPToken.ItemID", 29434);
1310  m_int_configs[CONFIG_PVP_TOKEN_COUNT] = sConfigMgr->GetIntDefault("PvPToken.ItemCount", 1);
1311  if (m_int_configs[CONFIG_PVP_TOKEN_COUNT] < 1)
1312  m_int_configs[CONFIG_PVP_TOKEN_COUNT] = 1;
1313 
1314  m_bool_configs[CONFIG_ALLOW_TRACK_BOTH_RESOURCES] = sConfigMgr->GetBoolDefault("AllowTrackBothResources", false);
1315  m_bool_configs[CONFIG_NO_RESET_TALENT_COST] = sConfigMgr->GetBoolDefault("NoResetTalentsCost", false);
1316  m_bool_configs[CONFIG_SHOW_KICK_IN_WORLD] = sConfigMgr->GetBoolDefault("ShowKickInWorld", false);
1317  m_bool_configs[CONFIG_SHOW_MUTE_IN_WORLD] = sConfigMgr->GetBoolDefault("ShowMuteInWorld", false);
1318  m_bool_configs[CONFIG_SHOW_BAN_IN_WORLD] = sConfigMgr->GetBoolDefault("ShowBanInWorld", false);
1319  m_int_configs[CONFIG_INTERVAL_LOG_UPDATE] = sConfigMgr->GetIntDefault("RecordUpdateTimeDiffInterval", 60000);
1320  m_int_configs[CONFIG_MIN_LOG_UPDATE] = sConfigMgr->GetIntDefault("MinRecordUpdateTimeDiff", 100);
1321  m_int_configs[CONFIG_NUMTHREADS] = sConfigMgr->GetIntDefault("MapUpdate.Threads", 1);
1322  m_int_configs[CONFIG_MAX_RESULTS_LOOKUP_COMMANDS] = sConfigMgr->GetIntDefault("Command.LookupMaxResults", 0);
1323 
1324  // Warden
1325  m_bool_configs[CONFIG_WARDEN_ENABLED] = sConfigMgr->GetBoolDefault("Warden.Enabled", false);
1326  m_int_configs[CONFIG_WARDEN_NUM_MEM_CHECKS] = sConfigMgr->GetIntDefault("Warden.NumMemChecks", 3);
1327  m_int_configs[CONFIG_WARDEN_NUM_OTHER_CHECKS] = sConfigMgr->GetIntDefault("Warden.NumOtherChecks", 7);
1328  m_int_configs[CONFIG_WARDEN_CLIENT_BAN_DURATION] = sConfigMgr->GetIntDefault("Warden.BanDuration", 86400);
1329  m_int_configs[CONFIG_WARDEN_CLIENT_CHECK_HOLDOFF] = sConfigMgr->GetIntDefault("Warden.ClientCheckHoldOff", 30);
1330  m_int_configs[CONFIG_WARDEN_CLIENT_FAIL_ACTION] = sConfigMgr->GetIntDefault("Warden.ClientCheckFailAction", 0);
1331  m_int_configs[CONFIG_WARDEN_CLIENT_RESPONSE_DELAY] = sConfigMgr->GetIntDefault("Warden.ClientResponseDelay", 600);
1332 
1333  // Feature System
1334  m_bool_configs[CONFIG_FEATURE_SYSTEM_BPAY_STORE_ENABLED] = sConfigMgr->GetBoolDefault("FeatureSystem.BpayStore.Enabled", false);
1335  m_bool_configs[CONFIG_FEATURE_SYSTEM_CHARACTER_UNDELETE_ENABLED] = sConfigMgr->GetBoolDefault("FeatureSystem.CharacterUndelete.Enabled", false);
1336  m_int_configs[CONFIG_FEATURE_SYSTEM_CHARACTER_UNDELETE_COOLDOWN] = sConfigMgr->GetIntDefault("FeatureSystem.CharacterUndelete.Cooldown", 2592000);
1337 
1338  // Dungeon finder
1339  m_int_configs[CONFIG_LFG_OPTIONSMASK] = sConfigMgr->GetIntDefault("DungeonFinder.OptionsMask", 1);
1340 
1341  // DBC_ItemAttributes
1342  m_bool_configs[CONFIG_DBC_ENFORCE_ITEM_ATTRIBUTES] = sConfigMgr->GetBoolDefault("DBC.EnforceItemAttributes", true);
1343 
1344  // Accountpassword Secruity
1345  m_int_configs[CONFIG_ACC_PASSCHANGESEC] = sConfigMgr->GetIntDefault("Account.PasswordChangeSecurity", 0);
1346 
1347  // Random Battleground Rewards
1348  m_int_configs[CONFIG_BG_REWARD_WINNER_HONOR_FIRST] = sConfigMgr->GetIntDefault("Battleground.RewardWinnerHonorFirst", 27000);
1349  m_int_configs[CONFIG_BG_REWARD_WINNER_CONQUEST_FIRST] = sConfigMgr->GetIntDefault("Battleground.RewardWinnerConquestFirst", 10000);
1350  m_int_configs[CONFIG_BG_REWARD_WINNER_HONOR_LAST] = sConfigMgr->GetIntDefault("Battleground.RewardWinnerHonorLast", 13500);
1351  m_int_configs[CONFIG_BG_REWARD_WINNER_CONQUEST_LAST] = sConfigMgr->GetIntDefault("Battleground.RewardWinnerConquestLast", 5000);
1352  m_int_configs[CONFIG_BG_REWARD_LOSER_HONOR_FIRST] = sConfigMgr->GetIntDefault("Battleground.RewardLoserHonorFirst", 4500);
1353  m_int_configs[CONFIG_BG_REWARD_LOSER_HONOR_LAST] = sConfigMgr->GetIntDefault("Battleground.RewardLoserHonorLast", 3500);
1354 
1355  // Max instances per hour
1356  m_int_configs[CONFIG_MAX_INSTANCES_PER_HOUR] = sConfigMgr->GetIntDefault("AccountInstancesPerHour", 5);
1357 
1358  // Anounce reset of instance to whole party
1359  m_bool_configs[CONFIG_INSTANCES_RESET_ANNOUNCE] = sConfigMgr->GetBoolDefault("InstancesResetAnnounce", false);
1360 
1361  // AutoBroadcast
1362  m_bool_configs[CONFIG_AUTOBROADCAST] = sConfigMgr->GetBoolDefault("AutoBroadcast.On", false);
1363  m_int_configs[CONFIG_AUTOBROADCAST_CENTER] = sConfigMgr->GetIntDefault("AutoBroadcast.Center", 0);
1364  m_int_configs[CONFIG_AUTOBROADCAST_INTERVAL] = sConfigMgr->GetIntDefault("AutoBroadcast.Timer", 60000);
1365  if (reload)
1366  {
1369  }
1370 
1371  // MySQL ping time interval
1372  m_int_configs[CONFIG_DB_PING_INTERVAL] = sConfigMgr->GetIntDefault("MaxPingTime", 30);
1373 
1374  // Guild save interval
1375  m_int_configs[CONFIG_GUILD_SAVE_INTERVAL] = sConfigMgr->GetIntDefault("Guild.SaveInterval", 15);
1376  m_int_configs[CONFIG_GUILD_UNDELETABLE_LEVEL] = sConfigMgr->GetIntDefault("Guild.UndeletableLevel", 4);
1377 
1378  // misc
1379  m_bool_configs[CONFIG_PDUMP_NO_PATHS] = sConfigMgr->GetBoolDefault("PlayerDump.DisallowPaths", true);
1380  m_bool_configs[CONFIG_PDUMP_NO_OVERWRITE] = sConfigMgr->GetBoolDefault("PlayerDump.DisallowOverwrite", true);
1381  m_bool_configs[CONFIG_UI_QUESTLEVELS_IN_DIALOGS] = sConfigMgr->GetBoolDefault("UI.ShowQuestLevelsInDialogs", false);
1382 
1383  // Wintergrasp battlefield
1384  m_bool_configs[CONFIG_WINTERGRASP_ENABLE] = sConfigMgr->GetBoolDefault("Wintergrasp.Enable", false);
1385  m_int_configs[CONFIG_WINTERGRASP_PLR_MAX] = sConfigMgr->GetIntDefault("Wintergrasp.PlayerMax", 100);
1386  m_int_configs[CONFIG_WINTERGRASP_PLR_MIN] = sConfigMgr->GetIntDefault("Wintergrasp.PlayerMin", 0);
1387  m_int_configs[CONFIG_WINTERGRASP_PLR_MIN_LVL] = sConfigMgr->GetIntDefault("Wintergrasp.PlayerMinLvl", 77);
1388  m_int_configs[CONFIG_WINTERGRASP_BATTLETIME] = sConfigMgr->GetIntDefault("Wintergrasp.BattleTimer", 30);
1389  m_int_configs[CONFIG_WINTERGRASP_NOBATTLETIME] = sConfigMgr->GetIntDefault("Wintergrasp.NoBattleTimer", 150);
1390  m_int_configs[CONFIG_WINTERGRASP_RESTART_AFTER_CRASH] = sConfigMgr->GetIntDefault("Wintergrasp.CrashRestartTimer", 10);
1391 
1392  // Stats limits
1393  m_bool_configs[CONFIG_STATS_LIMITS_ENABLE] = sConfigMgr->GetBoolDefault("Stats.Limits.Enable", false);
1394  m_float_configs[CONFIG_STATS_LIMITS_DODGE] = sConfigMgr->GetFloatDefault("Stats.Limits.Dodge", 95.0f);
1395  m_float_configs[CONFIG_STATS_LIMITS_PARRY] = sConfigMgr->GetFloatDefault("Stats.Limits.Parry", 95.0f);
1396  m_float_configs[CONFIG_STATS_LIMITS_BLOCK] = sConfigMgr->GetFloatDefault("Stats.Limits.Block", 95.0f);
1397  m_float_configs[CONFIG_STATS_LIMITS_CRIT] = sConfigMgr->GetFloatDefault("Stats.Limits.Crit", 95.0f);
1398 
1399  //packet spoof punishment
1400  m_int_configs[CONFIG_PACKET_SPOOF_POLICY] = sConfigMgr->GetIntDefault("PacketSpoof.Policy", (uint32)WorldSession::DosProtection::POLICY_KICK);
1401  m_int_configs[CONFIG_PACKET_SPOOF_BANMODE] = sConfigMgr->GetIntDefault("PacketSpoof.BanMode", (uint32)BAN_ACCOUNT);
1402  if (m_int_configs[CONFIG_PACKET_SPOOF_BANMODE] == BAN_CHARACTER || m_int_configs[CONFIG_PACKET_SPOOF_BANMODE] > BAN_IP)
1403  m_int_configs[CONFIG_PACKET_SPOOF_BANMODE] = BAN_ACCOUNT;
1404 
1405  m_int_configs[CONFIG_PACKET_SPOOF_BANDURATION] = sConfigMgr->GetIntDefault("PacketSpoof.BanDuration", 86400);
1406 
1407  m_bool_configs[CONFIG_IP_BASED_ACTION_LOGGING] = sConfigMgr->GetBoolDefault("Allow.IP.Based.Action.Logging", false);
1408 
1409  // AHBot
1410  m_int_configs[CONFIG_AHBOT_UPDATE_INTERVAL] = sConfigMgr->GetIntDefault("AuctionHouseBot.Update.Interval", 20);
1411 
1412  m_bool_configs[CONFIG_CALCULATE_CREATURE_ZONE_AREA_DATA] = sConfigMgr->GetBoolDefault("Calculate.Creature.Zone.Area.Data", false);
1413  m_bool_configs[CONFIG_CALCULATE_GAMEOBJECT_ZONE_AREA_DATA] = sConfigMgr->GetBoolDefault("Calculate.Gameoject.Zone.Area.Data", false);
1414 
1415  // call ScriptMgr if we're reloading the configuration
1416  if (reload)
1417  sScriptMgr->OnConfigLoad(reload);
1418 }
Definition: World.h:440
Definition: SharedDefines.h:4347
Definition: World.h:307
Definition: World.h:310
Definition: World.h:122
Definition: World.h:157
Definition: World.h:392
Definition: World.h:255
static int32 m_visibility_notify_periodOnContinents
Definition: World.h:841
Definition: World.h:111
#define MIN_GRID_DELAY
Definition: GridDefines.h:44
Definition: World.h:277
Definition: World.h:256
Definition: World.h:117
Definition: World.h:315
Definition: World.h:144
Definition: World.h:296
Definition: World.h:166
Definition: World.h:186
Definition: World.h:234
uint64 const MAX_MONEY_AMOUNT
Definition: Player.cpp:130
Definition: World.h:393
Definition: World.h:275
Definition: World.h:330
#define MAX_MOVE_TYPE
Definition: Unit.h:610
Definition: World.h:294
Definition: World.h:416
Definition: World.h:337
Definition: World.h:159
Definition: World.h:153
Definition: SharedDefines.h:4346
Definition: World.h:143
Definition: World.h:133
void setEnableLineOfSightCalc(bool pVal)
Definition: IVMapManager.h:79
Definition: World.h:363
Definition: World.h:149
Definition: World.h:327
Definition: World.h:138
Definition: World.h:427
Definition: World.h:350
#define DEFAULT_VISIBILITY_INSTANCE
Definition: Object.h:41
Definition: World.h:254
Definition: Common.h:98
Definition: World.h:313
Definition: Common.h:126
Definition: World.h:155
Definition: World.h:265
Definition: World.h:358
Definition: World.h:368
Definition: World.h:356
Definition: World.h:152
Definition: World.h:162
Definition: World.h:281
Definition: World.h:375
Definition: World.h:332
Definition: World.h:349
Definition: World.h:412
Definition: World.h:421
#define CURRENT_EXPANSION
Definition: SharedDefines.h:88
Definition: World.h:403
Definition: World.h:216
Definition: World.h:329
Definition: World.h:415
Definition: World.h:410
Definition: World.h:385
Definition: World.h:441
Definition: Common.h:111
Definition: World.h:437
Definition: World.h:386
Definition: World.h:346
Definition: World.h:180
Definition: World.h:271
Definition: World.h:104
Definition: World.h:224
Definition: World.h:123
Definition: World.h:219
Definition: World.h:140
Definition: World.h:113
#define sConfigMgr
Definition: Config.h:61
#define DEFAULT_VISIBILITY_NOTIFY_PERIOD
Definition: NGrid.h:30
Definition: World.h:434
Definition: World.h:398
Definition: World.h:190
Definition: World.h:220
Definition: World.h:318
Definition: World.h:266
Definition: World.h:397
#define sLog
Definition: Log.h:154
Definition: World.h:134
Definition: World.h:163
Definition: World.h:147
Definition: World.h:168
uint64_t uint64
Definition: g3dmath.h:170
Definition: SharedDefines.h:4537
Definition: World.h:371
Definition: World.h:257
bool m_bool_configs[BOOL_CONFIG_VALUE_COUNT]
Definition: World.h:824
Definition: World.h:188
Definition: World.h:124
#define sWorld
Definition: World.h:887
Definition: World.h:285
Definition: World.h:286
Definition: World.h:197
Definition: World.h:225
Definition: World.h:364
Definition: World.h:258
Definition: World.h:334
Definition: WorldSession.h:1758
Definition: World.h:262
Definition: World.h:174
Definition: World.h:284
Definition: World.h:413
Definition: World.h:407
Definition: World.h:112
Definition: World.h:400
Definition: World.h:326
Definition: World.h:202
Definition: Common.h:97
Definition: World.h:394
Definition: World.h:372
Definition: World.h:213
Definition: World.h:401
Definition: World.h:336
Definition: World.h:130
Definition: World.h:270
Definition: World.h:335
Definition: SharedDefines.h:4535
Definition: World.h:399
Definition: World.h:165
Definition: World.h:170
Definition: World.h:338
Definition: World.h:446
Definition: World.h:198
Definition: World.h:445
Definition: World.h:297
Definition: World.h:436
IntervalTimer m_timers[WUPDATE_COUNT]
Definition: World.h:805
Definition: World.h:339
Definition: World.h:443
Definition: World.h:316
Definition: World.h:160
Definition: World.h:226
void SetInterval(time_t interval)
Definition: Timer.h:79
Definition: World.h:150
Definition: World.h:465
Definition: World.h:105
float getRate(Rates rate) const
Get a server rate (see Rates)
Definition: World.h:671
Definition: World.h:119
Definition: World.h:390
Definition: World.h:250
void SetPlayerAmountLimit(uint32 limit)
Active session server limit.
Definition: World.h:590
Definition: World.h:290
Definition: World.h:328
Definition: World.h:348
Definition: World.h:376
Definition: World.h:259
static float m_MaxVisibleDistanceOnContinents
Definition: World.h:837
Definition: World.h:342
Definition: World.h:243
Definition: World.h:115
Definition: World.h:331
Definition: World.h:317
Definition: World.h:283
Definition: World.h:151
Definition: World.h:171
Definition: World.h:357
Definition: World.h:201
Definition: World.h:309
Definition: World.h:244
Definition: World.h:311
Definition: World.h:302
Definition: World.h:279
#define DEFAULT_VISIBILITY_BGARENAS
Definition: Object.h:42
LocaleConstant
Definition: Common.h:115
static int32 m_visibility_notify_periodInInstances
Definition: World.h:842
Definition: World.h:306
Definition: World.h:158
Definition: World.h:103
Definition: World.h:435
Definition: World.h:323
Definition: World.h:276
Definition: World.h:161
uint32 m_int_configs[INT_CONFIG_VALUE_COUNT]
Definition: World.h:823
Definition: World.h:274
Definition: World.h:230
Definition: World.h:402
#define UI64FMTD
Definition: Define.h:137
float m_float_configs[FLOAT_CONFIG_VALUE_COUNT]
Definition: World.h:825
std::string m_dataPath
Definition: World.h:834
int32_t int32
Definition: Define.h:146
Definition: World.h:114
Definition: World.h:406
Definition: World.h:300
uint32_t uint32
Definition: Define.h:150
Definition: World.h:172
Definition: World.h:353
Definition: World.h:145
Definition: World.h:245
Definition: World.h:267
Definition: World.h:273
#define MIN_MAP_UPDATE_DELAY
Definition: GridDefines.h:45
Definition: World.h:433
float playerBaseMoveSpeed[MAX_MOVE_TYPE]
Definition: Unit.cpp:88
static float m_MaxVisibleDistanceInBGArenas
Definition: World.h:839
Definition: World.h:432
Definition: World.h:261
Definition: World.h:454
Definition: World.h:388
Definition: World.h:325
Definition: DBCEnums.h:50
Definition: World.h:298
static int32 m_visibility_notify_periodInBGArenas
Definition: World.h:843
Definition: World.h:118
Definition: World.h:223
void Reset()
Definition: Timer.h:68
Definition: World.h:167
Definition: SharedDefines.h:4536
Definition: World.h:408
Definition: World.h:125
Definition: World.h:343
Definition: World.h:126
Definition: World.h:365
Definition: Common.h:112
Definition: World.h:384
Definition: World.h:195
Definition: World.h:215
Definition: World.h:120
Definition: World.h:218
Definition: World.h:251
Definition: World.h:237
Definition: World.h:404
Definition: World.h:417
Definition: World.h:148
float rate_values[MAX_RATES]
Definition: World.h:822
Definition: World.h:249
Definition: World.h:116
Definition: World.h:227
void setEnableHeightCalc(bool pVal)
Definition: IVMapManager.h:84
Definition: World.h:293
#define MAX_VISIBILITY_DISTANCE
Definition: Object.h:38
Definition: World.h:264
Definition: World.h:278
Definition: World.h:324
Definition: World.h:269
Definition: DBCEnums.h:46
Definition: SharedDefines.h:4348
Definition: World.h:173
Definition: World.h:196
#define sSupportMgr
Definition: SupportMgr.h:296
Definition: World.h:369
Definition: World.h:345
Definition: World.h:239
Definition: World.h:319
Definition: World.h:387
Definition: World.h:280
void SetMotd(std::string motd)
Set a new Message of the Day.
Definition: World.cpp:192
Definition: World.h:442
Definition: World.h:333
Definition: World.h:141
Definition: World.h:88
#define MAX_CHARTER_NAME
Definition: ObjectMgr.h:647
TC_COMMON_API char const * localeNames[TOTAL_LOCALES]
Definition: Common.cpp:21
Definition: World.h:428
Definition: World.h:396
Definition: World.h:414
Definition: World.h:238
Definition: World.h:87
Definition: World.h:373
void SetNewCharString(std::string const &str)
Set the string for new characters (first login)
Definition: World.h:612
Definition: World.h:291
Definition: Common.h:117
#define MAX_PLAYER_NAME
Definition: ObjectMgr.h:644
LocaleConstant m_defaultDbcLocale
Definition: World.h:830
Definition: World.h:438
Definition: World.h:395
Definition: World.h:210
Definition: World.h:221
Definition: World.h:191
Definition: World.h:308
Definition: Common.h:103
#define NOMINAL_MELEE_RANGE
Definition: Object.h:47
Definition: World.h:374
Definition: World.h:217
#define sMapMgr
Definition: MapManager.h:194
#define MAX_PET_NAME
Definition: ObjectMgr.h:646
Definition: World.h:383
Definition: World.h:132
int32_t int32
Definition: g3dmath.h:167
float baseMoveSpeed[MAX_MOVE_TYPE]
Definition: Unit.cpp:75
Definition: World.h:391
Definition: World.h:347
#define TC_LOG_WARN(filterType__,...)
Definition: Log.h:204
Definition: World.h:101
uint8_t uint8
Definition: Define.h:152
static IVMapManager * createOrGetVMapManager()
Definition: VMapFactory.cpp:28
Definition: World.h:192
Definition: World.h:320
Definition: World.h:199
Definition: World.h:447
Definition: World.h:100
Definition: World.h:189
Definition: World.h:179
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
Definition: World.h:295
Definition: World.h:222
#define sScriptMgr
Definition: ScriptMgr.h:837
Definition: World.h:430
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
Definition: World.h:268
Definition: World.h:351
Definition: World.h:211
Definition: World.h:409
#define CONTACT_DISTANCE
Definition: Object.h:33
Definition: World.h:164
Definition: World.h:131
Definition: World.h:154
Definition: World.h:292
static float m_MaxVisibleDistanceInInstances
Definition: World.h:838
Definition: World.h:418
Definition: World.h:231
Definition: World.h:84
Definition: World.h:354
Definition: World.h:389
Definition: World.h:272
Definition: World.h:314
#define MAX_CHARACTERS_PER_REALM
Definition: World.h:504
Definition: World.h:235
Definition: World.h:169
Definition: World.h:299
Definition: World.h:422
Definition: World.h:359
Definition: World.h:263
Definition: World.h:444
Definition: World.h:360
Definition: World.h:289
Definition: World.h:200
Definition: World.h:209
Definition: World.h:352
Definition: World.h:146
Definition: World.h:236
Definition: Common.h:130
Definition: World.h:212
Definition: World.h:156
Definition: World.h:431
Definition: World.h:322
Definition: World.h:232
#define DEFAULT_VISIBILITY_DISTANCE
Definition: Object.h:40
Definition: World.h:361
Definition: World.h:260

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void World::LoadDBAllowedSecurityLevel ( )
3136 {
3138  stmt->setInt32(0, int32(realm.Id.Realm));
3139  PreparedQueryResult result = LoginDatabase.Query(stmt);
3140 
3141  if (result)
3142  SetPlayerSecurityLimit(AccountTypes(result->Fetch()->GetUInt8()));
3143 }
uint32 Realm
Definition: Realm.h:53
std::shared_ptr< PreparedResultSet > PreparedQueryResult
Definition: QueryResult.h:107
Realm realm
Definition: World.cpp:3485
Definition: PreparedStatement.h:74
LoginDatabaseWorkerPool LoginDatabase
Accessor to the realm/login database.
Definition: DatabaseEnv.cpp:22
Definition: LoginDatabase.h:93
Battlenet::RealmHandle Id
Definition: Realm.h:86
AccountTypes
Definition: Common.h:106
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
void setInt32(const uint8 index, const int32 value)
Definition: PreparedStatement.cpp:151
void SetPlayerSecurityLimit(AccountTypes sec)
Definition: World.cpp:3145
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
int32_t int32
Definition: g3dmath.h:167

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void World::LoadDBVersion ( )
3263 {
3264  QueryResult result = WorldDatabase.Query("SELECT db_version, cache_id FROM version LIMIT 1");
3265  if (result)
3266  {
3267  Field* fields = result->Fetch();
3268 
3269  m_DBVersion = fields[0].GetString();
3270  // will be overwrite by config values if different and non-0
3272  }
3273 
3274  if (m_DBVersion.empty())
3275  m_DBVersion = "Unknown world database.";
3276 }
Class used to access individual fields of database query result.
Definition: Field.h:56
WorldDatabaseWorkerPool WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
std::string m_DBVersion
Definition: World.h:867
uint32 m_int_configs[INT_CONFIG_VALUE_COUNT]
Definition: World.h:823
std::shared_ptr< ResultSet > QueryResult
Definition: QueryResult.h:61
Definition: World.h:325
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
uint32 GetUInt32() const
Definition: Field.h:146
std::string GetString() const
Definition: Field.h:276

+ Here is the call graph for this function:

void World::LoadWorldStates ( )
3290 {
3291  uint32 oldMSTime = getMSTime();
3292 
3293  QueryResult result = CharacterDatabase.Query("SELECT entry, value FROM worldstates");
3294 
3295  if (!result)
3296  {
3297  TC_LOG_INFO("server.loading", ">> Loaded 0 world states. DB table `worldstates` is empty!");
3298 
3299  return;
3300  }
3301 
3302  uint32 count = 0;
3303 
3304  do
3305  {
3306  Field* fields = result->Fetch();
3307  m_worldstates[fields[0].GetUInt32()] = fields[1].GetUInt32();
3308  ++count;
3309  }
3310  while (result->NextRow());
3311 
3312  TC_LOG_INFO("server.loading", ">> Loaded %u world states in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
3313 
3314 }
WorldStatesMap m_worldstates
Definition: World.h:827
Class used to access individual fields of database query result.
Definition: Field.h:56
uint32 getMSTime()
Definition: Timer.h:24
uint32_t uint32
Definition: Define.h:150
std::shared_ptr< ResultSet > QueryResult
Definition: QueryResult.h:61
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
uint32 GetUInt32() const
Definition: Field.h:146
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void World::ProcessCliCommands ( )
2874 {
2875  CliCommandHolder::Print* zprint = NULL;
2876  void* callbackArg = NULL;
2877  CliCommandHolder* command = NULL;
2878  while (cliCmdQueue.next(command))
2879  {
2880  TC_LOG_INFO("misc", "CLI command under processing...");
2881  zprint = command->m_print;
2882  callbackArg = command->m_callbackArg;
2883  CliHandler handler(callbackArg, zprint);
2884  handler.ParseCommands(command->m_command);
2885  if (command->m_commandFinished)
2886  command->m_commandFinished(callbackArg, !handler.HasSentErrorMessage());
2887  delete command;
2888  }
2889 }
CommandFinished * m_commandFinished
Definition: World.h:516
char * m_command
Definition: World.h:513
arena_t NULL
Definition: jemalloc_internal.h:624
Storage class for commands issued for delayed execution.
Definition: World.h:507
void Print(void *, const char *)
Definition: World.h:509
Print * m_print
Definition: World.h:514
bool next(T &result)
Gets the next result in the queue, if any.
Definition: LockedQueue.h:69
void * m_callbackArg
Definition: World.h:512
Definition: Chat.h:157
LockedQueue< CliCommandHolder * > cliCmdQueue
Definition: World.h:846
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void World::ProcessLinkInstanceSocket ( std::pair< std::weak_ptr< WorldSocket >, uint64 linkInfo)
private
311 {
312  if (std::shared_ptr<WorldSocket> sock = linkInfo.first.lock())
313  {
314  if (!sock->IsOpen())
315  return;
316 
318  key.Raw = linkInfo.second;
319 
321  if (!session || session->GetConnectToInstanceKey() != linkInfo.second)
322  {
323  sock->SendAuthResponseError(ERROR_TIMED_OUT);
324  sock->DelayedCloseSocket();
325  return;
326  }
327 
328  sock->SetWorldSession(session);
329  session->AddInstanceConnection(sock);
330  session->HandleContinuePlayerLogin();
331  }
332 }
void AddInstanceConnection(std::shared_ptr< WorldSocket > sock)
Definition: WorldSession.h:900
WorldSession * FindSession(uint32 id) const
Find a session by its id.
Definition: World.cpp:207
void HandleContinuePlayerLogin()
Definition: CharacterHandler.cpp:855
uint64 GetConnectToInstanceKey() const
Definition: WorldSession.h:1724
uint64 AccountId
Definition: WorldSession.h:1716
uint64 Raw
Definition: WorldSession.h:1721
Definition: BattlenetRpcErrorCodes.h:27
struct WorldSession::ConnectToKey::@321 Fields
Player session in the World.
Definition: WorldSession.h:882
uint32_t uint32
Definition: g3dmath.h:168
Definition: WorldSession.h:1712

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void World::ProcessQueryCallbacks ( )
private
3348 {
3349  PreparedQueryResult result;
3350 
3351  for (std::deque<PreparedQueryResultFuture>::iterator itr = m_realmCharCallbacks.begin(); itr != m_realmCharCallbacks.end(); )
3352  {
3353  if ((*itr).wait_for(std::chrono::seconds(0)) != std::future_status::ready)
3354  {
3355  ++itr;
3356  continue;
3357  }
3358 
3359  result = (*itr).get();
3360  _UpdateRealmCharCount(result);
3361  itr = m_realmCharCallbacks.erase(itr);
3362  }
3363 }
std::deque< PreparedQueryResultFuture > m_realmCharCallbacks
Definition: World.h:880
std::shared_ptr< PreparedResultSet > PreparedQueryResult
Definition: QueryResult.h:107
float seconds()
Definition: units.h:97
void _UpdateRealmCharCount(PreparedQueryResult resultCharCount)
Definition: World.cpp:2948

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void World::QueueCliCommand ( CliCommandHolder commandHolder)
inline
738 { cliCmdQueue.add(commandHolder); }
void add(const T &item)
Adds an item to the queue.
Definition: LockedQueue.h:51
LockedQueue< CliCommandHolder * > cliCmdQueue
Definition: World.h:846
void World::RecordTimeDiff ( std::string const text)
2080 {
2081  if (m_updateTimeCount != 1)
2082  return;
2083 
2084  uint32 thisTime = getMSTime();
2085  uint32 diff = getMSTimeDiff(m_currentTime, thisTime);
2086 
2088  TC_LOG_INFO("misc", "Difftime %s: %u.", text.c_str(), diff);
2089 
2090  m_currentTime = thisTime;
2091 }
uint32 m_updateTimeCount
Definition: World.h:809
uint32 getMSTimeDiff(uint32 oldMSTime, uint32 newMSTime)
Definition: Timer.h:33
uint32 getMSTime()
Definition: Timer.h:24
uint32 m_int_configs[INT_CONFIG_VALUE_COUNT]
Definition: World.h:823
uint32_t uint32
Definition: Define.h:150
Definition: World.h:319
uint32 m_currentTime
Definition: World.h:810
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void World::ReloadRBAC ( )
3472 {
3473  // Passive reload, we mark the data as invalidated and next time a permission is checked it will be reloaded
3474  TC_LOG_INFO("rbac", "World::ReloadRBAC()");
3475  for (SessionMap::const_iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr)
3476  if (WorldSession* session = itr->second)
3477  session->InvalidateRBACData();
3478 }
SessionMap m_sessions
Definition: World.h:812
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
Player session in the World.
Definition: WorldSession.h:882
bool World::RemoveBanAccount ( BanMode  mode,
std::string const nameOrIP 
)

Remove a ban from an account or IP address.

2638 {
2639  PreparedStatement* stmt = NULL;
2640  if (mode == BAN_IP)
2641  {
2643  stmt->setString(0, nameOrIP);
2644  LoginDatabase.Execute(stmt);
2645  }
2646  else
2647  {
2648  uint32 account = 0;
2649  if (mode == BAN_ACCOUNT)
2650  account = AccountMgr::GetId(nameOrIP);
2651  else if (mode == BAN_CHARACTER)
2652  account = ObjectMgr::GetPlayerAccountIdByPlayerName(nameOrIP);
2653 
2654  if (!account)
2655  return false;
2656 
2657  //NO SQL injection as account is uint32
2659  stmt->setUInt32(0, account);
2660  LoginDatabase.Execute(stmt);
2661  }
2662  return true;
2663 }
void Execute(const char *sql)
Definition: DatabaseWorkerPool.h:87
void setString(const uint8 index, const std::string &value)
Definition: PreparedStatement.cpp:187
arena_t NULL
Definition: jemalloc_internal.h:624
Definition: SharedDefines.h:4537
Definition: PreparedStatement.h:74
Definition: SharedDefines.h:4535
LoginDatabaseWorkerPool LoginDatabase
Accessor to the realm/login database.
Definition: DatabaseEnv.cpp:22
static uint32 GetId(std::string const &username)
Definition: AccountMgr.cpp:275
uint32_t uint32
Definition: Define.h:150
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
Definition: SharedDefines.h:4536
void setUInt32(const uint8 index, const uint32 value)
Definition: PreparedStatement.cpp:115
Definition: LoginDatabase.h:50
static uint32 GetPlayerAccountIdByPlayerName(std::string const &name)
Definition: ObjectMgr.cpp:2310
Definition: LoginDatabase.h:55

+ Here is the call graph for this function:

bool World::RemoveBanCharacter ( std::string const name)

Remove a ban from a character.

Pick a player to ban if not online

2703 {
2705  ObjectGuid guid;
2706 
2708  if (!pBanned)
2709  {
2710  guid = ObjectMgr::GetPlayerGUIDByName(name);
2711  if (guid.IsEmpty())
2712  return false; // Nobody to ban
2713  }
2714  else
2715  guid = pBanned->GetGUID();
2716 
2718  stmt->setUInt64(0, guid.GetCounter());
2719  CharacterDatabase.Execute(stmt);
2720  return true;
2721 }
void Execute(const char *sql)
Definition: DatabaseWorkerPool.h:87
TC_GAME_API Player * FindConnectedPlayerByName(std::string const &name)
Definition: ObjectAccessor.cpp:240
Definition: PreparedStatement.h:74
static ObjectGuid GetPlayerGUIDByName(std::string const &name)
Definition: ObjectMgr.cpp:2247
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
void setUInt64(const uint8 index, const uint64 value)
Definition: PreparedStatement.cpp:124
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
Definition: ObjectGuid.h:189
Definition: CharacterDatabase.h:42
bool IsEmpty() const
Definition: ObjectGuid.h:242
LowType GetCounter() const
Definition: ObjectGuid.h:221

+ Here is the call graph for this function:

void World::RemoveOldCorpses ( )
3481 {
3483 }
IntervalTimer m_timers[WUPDATE_COUNT]
Definition: World.h:805
Definition: World.h:85
void SetCurrent(time_t current)
Definition: Timer.h:74

+ Here is the call graph for this function:

bool World::RemoveQueuedPlayer ( WorldSession session)
377 {
378  // sessions count including queued to remove (if removed_session set)
379  uint32 sessions = GetActiveSessionCount();
380 
381  uint32 position = 1;
382  Queue::iterator iter = m_QueuedPlayer.begin();
383 
384  // search to remove and count skipped positions
385  bool found = false;
386 
387  for (; iter != m_QueuedPlayer.end(); ++iter, ++position)
388  {
389  if (*iter == sess)
390  {
391  sess->SetInQueue(false);
392  sess->ResetTimeOutTime();
393  iter = m_QueuedPlayer.erase(iter);
394  found = true; // removing queued session
395  break;
396  }
397  }
398 
399  // iter point to next socked after removed or end()
400  // position store position of removed socket and then new position next socket after removed
401 
402  // if session not queued then we need decrease sessions count
403  if (!found && sessions)
404  --sessions;
405 
406  // accept first in queue
407  if ((!m_playerLimit || sessions < m_playerLimit) && !m_QueuedPlayer.empty())
408  {
409  WorldSession* pop_sess = m_QueuedPlayer.front();
410  pop_sess->InitializeSession();
411  m_QueuedPlayer.pop_front();
412 
413  // update iter to point first queued socket or end() if queue is empty now
414  iter = m_QueuedPlayer.begin();
415  position = 1;
416  }
417 
418  // update position from iter to end()
419  // iter point to first not updated socket, position store new position
420  for (; iter != m_QueuedPlayer.end(); ++iter, ++position)
421  (*iter)->SendAuthWaitQue(position);
422 
423  return found;
424 }
Queue m_QueuedPlayer
Definition: World.h:857
uint32_t uint32
Definition: Define.h:150
void InitializeSession()
Definition: WorldSession.cpp:1189
Player session in the World.
Definition: WorldSession.h:882
uint32 m_playerLimit
Definition: World.h:828
uint32 GetActiveSessionCount() const
Definition: World.h:560

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool World::RemoveSession ( uint32  id)

Remove a given session.

  • Find the session, kick the user, but we can't delete session at this moment to prevent iterator invalidation
219 {
221  SessionMap::const_iterator itr = m_sessions.find(id);
222 
223  if (itr != m_sessions.end() && itr->second)
224  {
225  if (itr->second->PlayerLoading())
226  return false;
227 
228  itr->second->KickPlayer();
229  }
230 
231  return true;
232 }
SessionMap m_sessions
Definition: World.h:812

+ Here is the caller graph for this function:

void World::ResetCurrencyWeekCap ( )
protected
3124 {
3125  CharacterDatabase.Execute("UPDATE `character_currency` SET `WeeklyQuantity` = 0");
3126 
3127  for (SessionMap::const_iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr)
3128  if (itr->second->GetPlayer())
3129  itr->second->GetPlayer()->ResetCurrencyWeekCap();
3130 
3133 }
void Execute(const char *sql)
Definition: DatabaseWorkerPool.h:87
SessionMap m_sessions
Definition: World.h:812
uint64_t uint64
Definition: g3dmath.h:170
#define sWorld
Definition: World.h:887
Definition: Common.h:99
#define WS_CURRENCY_RESET_TIME
Definition: BattlegroundMgr.h:32
Definition: World.h:251
time_t m_NextCurrencyReset
Definition: World.h:854
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
uint32 getIntConfig(WorldIntConfigs index) const
Get a server configuration element (see #WorldConfigs)
Definition: World.h:707

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void World::ResetEventSeasonalQuests ( uint16  event_id)
3217 {
3218  TC_LOG_INFO("misc", "Seasonal quests reset for all characters.");
3219 
3221  stmt->setUInt16(0, event_id);
3222  CharacterDatabase.Execute(stmt);
3223 
3224  for (SessionMap::const_iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr)
3225  if (itr->second->GetPlayer())
3226  itr->second->GetPlayer()->ResetSeasonalQuestStatus(event_id);
3227 }
void Execute(const char *sql)
Definition: DatabaseWorkerPool.h:87
SessionMap m_sessions
Definition: World.h:812
Definition: PreparedStatement.h:74
void setUInt16(const uint8 index, const uint16 value)
Definition: PreparedStatement.cpp:106
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201

+ Here is the call graph for this function:

void World::ResetGuildCap ( )
protected
3245 {
3249  week = week < 7 ? week + 1 : 1;
3250 
3251  TC_LOG_INFO("misc", "Guild Daily Cap reset. Week: %u", week == 1);
3252  sWorld->setWorldState(WS_GUILD_WEEKLY_RESET_TIME, week);
3253  sGuildMgr->ResetTimes(week == 1);
3254 }
#define sGuildMgr
Definition: GuildMgr.h:61
time_t m_NextGuildReset
Definition: World.h:853
uint64_t uint64
Definition: g3dmath.h:170
#define sWorld
Definition: World.h:887
uint64 getWorldState(uint32 index) const
Definition: World.cpp:3341
Definition: Common.h:99
uint32_t uint32
Definition: Define.h:150
Definition: World.h:498
Definition: World.h:501
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void World::ResetMonthlyQuests ( )
protected
3173 {
3174  TC_LOG_INFO("misc", "Monthly quests reset for all characters.");
3175 
3177  CharacterDatabase.Execute(stmt);
3178 
3179  for (SessionMap::const_iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr)
3180  if (itr->second->GetPlayer())
3181  itr->second->GetPlayer()->ResetMonthlyQuestStatus();
3182 
3183  // generate time
3184  time_t curTime = time(NULL);
3185  tm localTm;
3186  localtime_r(&curTime, &localTm);
3187 
3188  int month = localTm.tm_mon;
3189  int year = localTm.tm_year;
3190 
3191  ++month;
3192 
3193  // month 11 is december, next is january (0)
3194  if (month > 11)
3195  {
3196  month = 0;
3197  year += 1;
3198  }
3199 
3200  // reset time for next month
3201  localTm.tm_year = year;
3202  localTm.tm_mon = month;
3203  localTm.tm_mday = 1; // don't know if we really need config option for day / hour
3204  localTm.tm_hour = 0;
3205  localTm.tm_min = 0;
3206  localTm.tm_sec = 0;
3207 
3208  time_t nextMonthResetTime = mktime(&localTm);
3209 
3210  // plan next reset time
3211  m_NextMonthlyQuestReset = (curTime >= nextMonthResetTime) ? nextMonthResetTime + MONTH : nextMonthResetTime;
3212 
3214 }
time_t m_NextMonthlyQuestReset
Definition: World.h:851
Definition: World.h:499
void Execute(const char *sql)
Definition: DatabaseWorkerPool.h:87
SessionMap m_sessions
Definition: World.h:812
arena_t NULL
Definition: jemalloc_internal.h:624
Definition: Common.h:101
uint64_t uint64
Definition: g3dmath.h:170
#define sWorld
Definition: World.h:887
Definition: PreparedStatement.h:74
Definition: CharacterDatabase.h:91
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
TC_COMMON_API struct tm * localtime_r(const time_t *time, struct tm *result)
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void World::ResetRandomBG ( )
protected
3230 {
3231  TC_LOG_INFO("misc", "Random BG status reset for all characters.");
3232 
3234  CharacterDatabase.Execute(stmt);
3235 
3236  for (SessionMap::const_iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr)
3237  if (itr->second->GetPlayer())
3238  itr->second->GetPlayer()->SetRandomWinner(false);
3239 
3242 }
void Execute(const char *sql)
Definition: DatabaseWorkerPool.h:87
SessionMap m_sessions
Definition: World.h:812
Definition: World.h:496
uint64_t uint64
Definition: g3dmath.h:170
#define sWorld
Definition: World.h:887
Definition: PreparedStatement.h:74
Definition: CharacterDatabase.h:64
Definition: Common.h:99
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
time_t m_NextRandomBGReset
Definition: World.h:852
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void World::ResetTimeDiffRecord ( )
2072 {
2073  if (m_updateTimeCount != 1)
2074  return;
2075 
2077 }
uint32 m_updateTimeCount
Definition: World.h:809
uint32 getMSTime()
Definition: Timer.h:24
uint32 m_currentTime
Definition: World.h:810

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void World::ResetWeeklyQuests ( )
protected
3155 {
3156  TC_LOG_INFO("misc", "Weekly quests reset for all characters.");
3157 
3159  CharacterDatabase.Execute(stmt);
3160 
3161  for (SessionMap::const_iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr)
3162  if (itr->second->GetPlayer())
3163  itr->second->GetPlayer()->ResetWeeklyQuestStatus();
3164 
3167 
3168  // change available weeklies
3169  sPoolMgr->ChangeWeeklyQuests();
3170 }
void Execute(const char *sql)
Definition: DatabaseWorkerPool.h:87
SessionMap m_sessions
Definition: World.h:812
uint64_t uint64
Definition: g3dmath.h:170
#define sWorld
Definition: World.h:887
Definition: PreparedStatement.h:74
Definition: CharacterDatabase.h:90
#define sPoolMgr
Definition: PoolMgr.h:166
Definition: Common.h:100
Definition: World.h:495
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
time_t m_NextWeeklyQuestReset
Definition: World.h:850

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void World::SendAutoBroadcast ( )
2892 {
2893  if (m_Autobroadcasts.empty())
2894  return;
2895 
2896  uint32 weight = 0;
2897  AutobroadcastsWeightMap selectionWeights;
2898  std::string msg;
2899 
2900  for (AutobroadcastsWeightMap::const_iterator it = m_AutobroadcastsWeights.begin(); it != m_AutobroadcastsWeights.end(); ++it)
2901  {
2902  if (it->second)
2903  {
2904  weight += it->second;
2905  selectionWeights[it->first] = it->second;
2906  }
2907  }
2908 
2909  if (weight)
2910  {
2911  uint32 selectedWeight = urand(0, weight - 1);
2912  weight = 0;
2913  for (AutobroadcastsWeightMap::const_iterator it = selectionWeights.begin(); it != selectionWeights.end(); ++it)
2914  {
2915  weight += it->second;
2916  if (selectedWeight < weight)
2917  {
2918  msg = m_Autobroadcasts[it->first];
2919  break;
2920  }
2921  }
2922  }
2923  else
2924  msg = m_Autobroadcasts[urand(0, m_Autobroadcasts.size())];
2925 
2926  uint32 abcenter = sWorld->getIntConfig(CONFIG_AUTOBROADCAST_CENTER);
2927 
2928  if (abcenter == 0)
2929  sWorld->SendWorldText(LANG_AUTO_BROADCAST, msg.c_str());
2930  else if (abcenter == 1)
2931  sWorld->SendGlobalMessage(WorldPackets::Chat::PrintNotification(msg).Write());
2932  else if (abcenter == 2)
2933  {
2934  sWorld->SendWorldText(LANG_AUTO_BROADCAST, msg.c_str());
2935  sWorld->SendGlobalMessage(WorldPackets::Chat::PrintNotification(msg).Write());
2936  }
2937 
2938  TC_LOG_DEBUG("misc", "AutoBroadcast: '%s'", msg.c_str());
2939 }
Definition: Language.h:1199
AutobroadcastsMap m_Autobroadcasts
Definition: World.h:870
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:198
#define sWorld
Definition: World.h:887
Definition: World.h:336
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:45
uint32_t uint32
Definition: Define.h:150
AutobroadcastsWeightMap m_AutobroadcastsWeights
Definition: World.h:873
std::map< uint8, uint8 > AutobroadcastsWeightMap
Definition: World.h:872
Definition: ChatPackets.h:220

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void World::SendGlobalGMMessage ( WorldPacket const packet,
WorldSession self = nullptr,
uint32  team = 0 
)

Send a packet to all GMs (except self if mentioned)

2372 {
2373  for (SessionMap::const_iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr)
2374  {
2375  // check if session and can receive global GM Messages and its not self
2376  WorldSession* session = itr->second;
2377  if (!session || session == self || !session->HasPermission(rbac::RBAC_PERM_RECEIVE_GLOBAL_GM_TEXTMESSAGE))
2378  continue;
2379 
2380  // Player should be in world
2381  Player* player = session->GetPlayer();
2382  if (!player || !player->IsInWorld())
2383  continue;
2384 
2385  // Send only to same team, if team is given
2386  if (!team || player->GetTeam() == team)
2387  session->SendPacket(packet);
2388  }
2389 }
SessionMap m_sessions
Definition: World.h:812
Player * GetPlayer() const
Definition: WorldSession.h:927
void SendPacket(WorldPacket const *packet, bool forced=false)
Send a packet to the client.
Definition: WorldSession.cpp:211
Player session in the World.
Definition: WorldSession.h:882
bool HasPermission(uint32 permissionId)
Definition: WorldSession.cpp:1259

+ Here is the call graph for this function:

void World::SendGlobalMessage ( WorldPacket const packet,
WorldSession self = nullptr,
uint32  team = 0 
)

Send a packet to all players (except self if mentioned)

2355 {
2356  SessionMap::const_iterator itr;
2357  for (itr = m_sessions.begin(); itr != m_sessions.end(); ++itr)
2358  {
2359  if (itr->second &&
2360  itr->second->GetPlayer() &&
2361  itr->second->GetPlayer()->IsInWorld() &&
2362  itr->second != self &&
2363  (team == 0 || itr->second->GetPlayer()->GetTeam() == team))
2364  {
2365  itr->second->SendPacket(packet);
2366  }
2367  }
2368 }
SessionMap m_sessions
Definition: World.h:812

+ Here is the caller graph for this function:

void World::SendGlobalText ( const char *  text,
WorldSession self 
)

DEPRECATED, only for debug purpose. Send a System Message to all players (except self if mentioned)

2487 {
2488  // need copy to prevent corruption by strtok call in LineFromMessage original string
2489  char* buf = strdup(text);
2490  char* pos = buf;
2491 
2492  while (char* line = ChatHandler::LineFromMessage(pos))
2493  {
2494  WorldPackets::Chat::Chat packet;
2495  packet.Initialize(CHAT_MSG_SYSTEM, LANG_UNIVERSAL, nullptr, nullptr, line);
2496  SendGlobalMessage(packet.Write(), self);
2497  }
2498 
2499  free(buf);
2500 }
Definition: SharedDefines.h:961
static char * LineFromMessage(char *&pos)
Definition: Chat.h:63
void SendGlobalMessage(WorldPacket const *packet, WorldSession *self=nullptr, uint32 team=0)
Send a packet to all players (except self if mentioned)
Definition: World.cpp:2354
Definition: ChatPackets.h:150
WorldPacket const * Write() override
Definition: ChatPackets.cpp:162
void Initialize(ChatMsg chatType, Language language, WorldObject const *sender, WorldObject const *receiver, std::string message, uint32 achievementId=0, std::string channelName="", LocaleConstant locale=DEFAULT_LOCALE, std::string addonPrefix="")
Definition: ChatPackets.cpp:104
Definition: SharedDefines.h:4231

+ Here is the call graph for this function:

void World::SendGMText ( uint32  string_id,
  ... 
)

Send a System Message to all GMs (except self if mentioned)

2461 {
2462  va_list ap;
2463  va_start(ap, string_id);
2464 
2465  Trinity::WorldWorldTextBuilder wt_builder(string_id, &ap);
2467  for (SessionMap::const_iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr)
2468  {
2469  // Session should have permissions to receive global gm messages
2470  WorldSession* session = itr->second;
2472  continue;
2473 
2474  // Player should be in world
2475  Player* player = session->GetPlayer();
2476  if (!player || !player->IsInWorld())
2477  continue;
2478 
2479  wt_do(player);
2480  }
2481 
2482  va_end(ap);
2483 }
SessionMap m_sessions
Definition: World.h:812
Definition: World.cpp:2393
Player * GetPlayer() const
Definition: WorldSession.h:927
Definition: GridNotifiers.h:1419
Player session in the World.
Definition: WorldSession.h:882
bool HasPermission(uint32 permissionId)
Definition: WorldSession.cpp:1259

+ Here is the call graph for this function:

void World::SendServerMessage ( ServerMessageType  messageID,
std::string  stringParam = "",
Player player = NULL 
)

Send a server message to the user(s)

2827 {
2828  WorldPackets::Chat::ChatServerMessage chatServerMessage;
2829  chatServerMessage.MessageID = int32(messageID);
2830  if (messageID <= SERVER_MSG_STRING)
2831  chatServerMessage.StringParam = stringParam;
2832 
2833  if (player)
2834  player->GetSession()->SendPacket(chatServerMessage.Write());
2835  else
2836  SendGlobalMessage(chatServerMessage.Write());
2837 }
void SendGlobalMessage(WorldPacket const *packet, WorldSession *self=nullptr, uint32 team=0)
Send a packet to all players (except self if mentioned)
Definition: World.cpp:2354
int32 MessageID
Definition: ChatPackets.h:255
std::string StringParam
Definition: ChatPackets.h:256
WorldPacket const * Write() override
Definition: ChatPackets.cpp:240
int32_t int32
Definition: g3dmath.h:167
Definition: ChatPackets.h:248
Definition: World.h:52

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void World::SendWorldText ( uint32  string_id,
  ... 
)

Send a System Message to all players (except self if mentioned)

2442 {
2443  va_list ap;
2444  va_start(ap, string_id);
2445 
2446  Trinity::WorldWorldTextBuilder wt_builder(string_id, &ap);
2448  for (SessionMap::const_iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr)
2449  {
2450  if (!itr->second || !itr->second->GetPlayer() || !itr->second->GetPlayer()->IsInWorld())
2451  continue;
2452 
2453  wt_do(itr->second->GetPlayer());
2454  }
2455 
2456  va_end(ap);
2457 }
SessionMap m_sessions
Definition: World.h:812
Definition: World.cpp:2393
Definition: GridNotifiers.h:1419
bool World::SendZoneMessage ( uint32  zone,
WorldPacket const packet,
WorldSession self = nullptr,
uint32  team = 0 
)

Send a packet to all players (or players selected team) in the zone (except self if mentioned)

2504 {
2505  bool foundPlayerToSend = false;
2506  SessionMap::const_iterator itr;
2507 
2508  for (itr = m_sessions.begin(); itr != m_sessions.end(); ++itr)
2509  {
2510  if (itr->second &&
2511  itr->second->GetPlayer() &&
2512  itr->second->GetPlayer()->IsInWorld() &&
2513  itr->second->GetPlayer()->GetZoneId() == zone &&
2514  itr->second != self &&
2515  (team == 0 || itr->second->GetPlayer()->GetTeam() == team))
2516  {
2517  itr->second->SendPacket(packet);
2518  foundPlayerToSend = true;
2519  }
2520  }
2521 
2522  return foundPlayerToSend;
2523 }
SessionMap m_sessions
Definition: World.h:812

+ Here is the caller graph for this function:

void World::SendZoneText ( uint32  zone,
const char *  text,
WorldSession self = nullptr,
uint32  team = 0 
)

Send a System Message to all players in the zone (except self if mentioned)

2527 {
2528  WorldPackets::Chat::Chat packet;
2529  packet.Initialize(CHAT_MSG_SYSTEM, LANG_UNIVERSAL, nullptr, nullptr, text);
2530  SendZoneMessage(zone, packet.Write(), self, team);
2531 }
Definition: SharedDefines.h:961
Definition: ChatPackets.h:150
WorldPacket const * Write() override
Definition: ChatPackets.cpp:162
void Initialize(ChatMsg chatType, Language language, WorldObject const *sender, WorldObject const *receiver, std::string message, uint32 achievementId=0, std::string channelName="", LocaleConstant locale=DEFAULT_LOCALE, std::string addonPrefix="")
Definition: ChatPackets.cpp:104
Definition: SharedDefines.h:4231
bool SendZoneMessage(uint32 zone, WorldPacket const *packet, WorldSession *self=nullptr, uint32 team=0)
Send a packet to all players (or players selected team) in the zone (except self if mentioned) ...
Definition: World.cpp:2503

+ Here is the call graph for this function:

void World::SetAllowMovement ( bool  allow)
inline

Allow/Disallow object movements.

604 { m_allowMovement = allow; }
bool m_allowMovement
Definition: World.h:832
void World::setBoolConfig ( WorldBoolConfigs  index,
bool  value 
)
inline

Set a server configuration element (see #WorldConfigs)

675  {
676  if (index < BOOL_CONFIG_VALUE_COUNT)
677  m_bool_configs[index] = value;
678  }
bool m_bool_configs[BOOL_CONFIG_VALUE_COUNT]
Definition: World.h:824
Definition: World.h:181
const FieldDescriptor value
Definition: descriptor.h:1522
void World::SetCleaningFlags ( uint32  flags)
inline
766 { m_CleaningFlags = flags; }
uint32 m_CleaningFlags
Definition: World.h:799
uint8 flags
Definition: DisableMgr.cpp:44
void World::SetClosed ( bool  val)

Close world.

185 {
186  m_isClosed = val;
187 
188  // Invert the value, for simplicity for scripters.
189  sScriptMgr->OnOpenStateChange(!val);
190 }
bool m_isClosed
Definition: World.h:801
#define sScriptMgr
Definition: ScriptMgr.h:837
void World::setFloatConfig ( WorldFloatConfigs  index,
float  value 
)
inline

Set a server configuration element (see #WorldConfigs)

688  {
689  if (index < FLOAT_CONFIG_VALUE_COUNT)
690  m_float_configs[index] = value;
691  }
Definition: World.h:204
float m_float_configs[FLOAT_CONFIG_VALUE_COUNT]
Definition: World.h:825
const FieldDescriptor value
Definition: descriptor.h:1522
void World::SetInitialWorldSettings ( )

Initialize the World.

  • Server startup begin
  • Initialize the random number generator
  • Initialize detour memory management
  • Initialize VMapManager 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 races' startup 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
  • Load DBCs
  • Load DB2s
  • Close hotfix database - it is only used during DB2 loading
  • Load GameTables
  • Load dynamic data tables from the database
  • Handle outdated emails (delete/return)
  • Load and initialize scripts
  • Initialize game time and timers
Todo:
Get rid of magic numbers
  • Initilize static helper structures
  • Initialize MapManager
  • Initialize Battlegrounds
  • Initialize outdoor pvp
  • Initialize Battlefield
  • Initialize Warden
1422 {
1424  uint32 startupBegin = getMSTime();
1425 
1427  srand((unsigned int)time(NULL));
1428 
1431 
1433  if (VMAP::VMapManager2* vmmgr2 = dynamic_cast<VMAP::VMapManager2*>(VMAP::VMapFactory::createOrGetVMapManager()))
1434  {
1435  vmmgr2->GetLiquidFlagsPtr = &GetLiquidFlags;
1436  vmmgr2->IsVMAPDisabledForPtr = &DisableMgr::IsVMAPDisabledFor;
1437  }
1438 
1441 
1444 
1446  sObjectMgr->SetHighestGuids();
1447 
1449  if (!MapManager::ExistMapAndVMap(0, -6240.32f, 331.033f)
1450  || !MapManager::ExistMapAndVMap(0, -8949.95f, -132.493f)
1451  || !MapManager::ExistMapAndVMap(1, -618.518f, -4251.67f)
1452  || !MapManager::ExistMapAndVMap(0, 1676.35f, 1677.45f)
1453  || !MapManager::ExistMapAndVMap(1, 10311.3f, 832.463f)
1454  || !MapManager::ExistMapAndVMap(1, -2917.58f, -257.98f)
1456  !MapManager::ExistMapAndVMap(530, 10349.6f, -6357.29f) ||
1457  !MapManager::ExistMapAndVMap(530, -3961.64f, -13931.2f))))
1458  {
1459  TC_LOG_FATAL("server.loading", "Unable to load critical files - server shutting down !!!");
1460  exit(1);
1461  }
1462 
1464  sPoolMgr->Initialize();
1465 
1467  sGameEventMgr->Initialize();
1468 
1470 
1471  TC_LOG_INFO("server.loading", "Loading Trinity strings...");
1472  if (!sObjectMgr->LoadTrinityStrings())
1473  exit(1); // Error message displayed in function already
1474 
1476  //No SQL injection as values are treated as integers
1477 
1478  // not send custom type REALM_FFA_PVP to realm list
1480  uint32 realm_zone = getIntConfig(CONFIG_REALM_ZONE);
1481 
1482  LoginDatabase.PExecute("UPDATE realmlist SET icon = %u, timezone = %u WHERE id = '%d'", server_type, realm_zone, realm.Id.Realm); // One-time query
1483 
1484  TC_LOG_INFO("server.loading", "Initialize data stores...");
1489  TC_LOG_INFO("misc", "Loading hotfix info...");
1490  sDB2Manager.LoadHotfixData();
1495 
1496  //Load weighted graph on taxi nodes path
1497  sTaxiPathGraph.Initialize();
1498 
1499  sSpellMgr->LoadPetFamilySpellsStore();
1500 
1501  std::unordered_map<uint32, std::vector<uint32>> mapData;
1502  for (MapEntry const* mapEntry : sMapStore)
1503  {
1504  mapData.insert(std::unordered_map<uint32, std::vector<uint32>>::value_type(mapEntry->ID, std::vector<uint32>()));
1505  if (mapEntry->ParentMapID != -1)
1506  mapData[mapEntry->ParentMapID].push_back(mapEntry->ID);
1507  }
1508 
1509  if (VMAP::VMapManager2* vmmgr2 = dynamic_cast<VMAP::VMapManager2*>(VMAP::VMapFactory::createOrGetVMapManager()))
1510  vmmgr2->InitializeThreadUnsafe(mapData);
1511 
1513  mmmgr->InitializeThreadUnsafe(mapData);
1514 
1515  TC_LOG_INFO("server.loading", "Loading SpellInfo store...");
1516  sSpellMgr->LoadSpellInfoStore();
1517 
1518  TC_LOG_INFO("server.loading", "Loading SpellInfo corrections...");
1519  sSpellMgr->LoadSpellInfoCorrections();
1520 
1521  TC_LOG_INFO("server.loading", "Loading SkillLineAbilityMultiMap Data...");
1522  sSpellMgr->LoadSkillLineAbilityMap();
1523 
1524  TC_LOG_INFO("server.loading", "Loading SpellInfo custom attributes...");
1525  sSpellMgr->LoadSpellInfoCustomAttributes();
1526 
1527  TC_LOG_INFO("server.loading", "Loading GameObject models...");
1529 
1530  TC_LOG_INFO("server.loading", "Loading Script Names...");
1531  sObjectMgr->LoadScriptNames();
1532 
1533  TC_LOG_INFO("server.loading", "Loading Instance Template...");
1534  sObjectMgr->LoadInstanceTemplate();
1535 
1536  // Must be called before `creature_respawn`/`gameobject_respawn` tables
1537  TC_LOG_INFO("server.loading", "Loading instances...");
1538  sInstanceSaveMgr->LoadInstances();
1539 
1540  TC_LOG_INFO("server.loading", "Loading Localization strings...");
1541  uint32 oldMSTime = getMSTime();
1542  sObjectMgr->LoadCreatureLocales();
1543  sObjectMgr->LoadGameObjectLocales();
1544  sObjectMgr->LoadQuestTemplateLocale();
1545  sObjectMgr->LoadQuestObjectivesLocale();
1546  sObjectMgr->LoadPageTextLocales();
1547  sObjectMgr->LoadGossipMenuItemsLocales();
1548  sObjectMgr->LoadPointOfInterestLocales();
1549 
1550  sObjectMgr->SetDBCLocaleIndex(GetDefaultDbcLocale()); // Get once for all the locale index of DBC language (console/broadcasts)
1551  TC_LOG_INFO("server.loading", ">> Localization strings loaded in %u ms", GetMSTimeDiffToNow(oldMSTime));
1552 
1553  TC_LOG_INFO("server.loading", "Loading Account Roles and Permissions...");
1554  sAccountMgr->LoadRBAC();
1555 
1556  TC_LOG_INFO("server.loading", "Loading Page Texts...");
1557  sObjectMgr->LoadPageTexts();
1558 
1559  TC_LOG_INFO("server.loading", "Loading Game Object Templates..."); // must be after LoadPageTexts
1560  sObjectMgr->LoadGameObjectTemplate();
1561 
1562  TC_LOG_INFO("server.loading", "Loading Transport templates...");
1563  sTransportMgr->LoadTransportTemplates();
1564 
1565  TC_LOG_INFO("server.loading", "Loading Spell Rank Data...");
1566  sSpellMgr->LoadSpellRanks();
1567 
1568  TC_LOG_INFO("server.loading", "Loading Spell Required Data...");
1569  sSpellMgr->LoadSpellRequired();
1570 
1571  TC_LOG_INFO("server.loading", "Loading Spell Group types...");
1572  sSpellMgr->LoadSpellGroups();
1573 
1574  TC_LOG_INFO("server.loading", "Loading Spell Learn Skills...");
1575  sSpellMgr->LoadSpellLearnSkills(); // must be after LoadSpellRanks
1576 
1577  TC_LOG_INFO("server.loading", "Loading Spell Learn Spells...");
1578  sSpellMgr->LoadSpellLearnSpells();
1579 
1580  TC_LOG_INFO("server.loading", "Loading Spell Proc Event conditions...");
1581  sSpellMgr->LoadSpellProcEvents();
1582 
1583  TC_LOG_INFO("server.loading", "Loading Spell Proc conditions and data...");
1584  sSpellMgr->LoadSpellProcs();
1585 
1586  TC_LOG_INFO("server.loading", "Loading Aggro Spells Definitions...");
1587  sSpellMgr->LoadSpellThreats();
1588 
1589  TC_LOG_INFO("server.loading", "Loading Spell Group Stack Rules...");
1590  sSpellMgr->LoadSpellGroupStackRules();
1591 
1592  TC_LOG_INFO("server.loading", "Loading NPC Texts...");
1593  sObjectMgr->LoadNPCText();
1594 
1595  TC_LOG_INFO("server.loading", "Loading Enchant Spells Proc datas...");
1596  sSpellMgr->LoadSpellEnchantProcData();
1597 
1598  TC_LOG_INFO("server.loading", "Loading Item Random Enchantments Table...");
1600 
1601  TC_LOG_INFO("server.loading", "Loading Disables"); // must be before loading quests and items
1603 
1604  TC_LOG_INFO("server.loading", "Loading Items..."); // must be after LoadRandomEnchantmentsTable and LoadPageTexts
1605  sObjectMgr->LoadItemTemplates();
1606 
1607  TC_LOG_INFO("server.loading", "Loading Item set names..."); // must be after LoadItemPrototypes
1608  sObjectMgr->LoadItemTemplateAddon();
1609 
1610  TC_LOG_INFO("misc", "Loading Item Scripts..."); // must be after LoadItemPrototypes
1611  sObjectMgr->LoadItemScriptNames();
1612 
1613  TC_LOG_INFO("server.loading", "Loading Creature Model Based Info Data...");
1614  sObjectMgr->LoadCreatureModelInfo();
1615 
1616  TC_LOG_INFO("server.loading", "Loading Creature templates...");
1617  sObjectMgr->LoadCreatureTemplates();
1618 
1619  TC_LOG_INFO("server.loading", "Loading Equipment templates..."); // must be after LoadCreatureTemplates
1620  sObjectMgr->LoadEquipmentTemplates();
1621 
1622  TC_LOG_INFO("server.loading", "Loading Creature template addons...");
1623  sObjectMgr->LoadCreatureTemplateAddons();
1624 
1625  TC_LOG_INFO("server.loading", "Loading Reputation Reward Rates...");
1626  sObjectMgr->LoadReputationRewardRate();
1627 
1628  TC_LOG_INFO("server.loading", "Loading Creature Reputation OnKill Data...");
1629  sObjectMgr->LoadReputationOnKill();
1630 
1631  TC_LOG_INFO("server.loading", "Loading Reputation Spillover Data...");
1632  sObjectMgr->LoadReputationSpilloverTemplate();
1633 
1634  TC_LOG_INFO("server.loading", "Loading Points Of Interest Data...");
1635  sObjectMgr->LoadPointsOfInterest();
1636 
1637  TC_LOG_INFO("server.loading", "Loading Creature Base Stats...");
1638  sObjectMgr->LoadCreatureClassLevelStats();
1639 
1640  TC_LOG_INFO("server.loading", "Loading Creature Data...");
1641  sObjectMgr->LoadCreatures();
1642 
1643  TC_LOG_INFO("server.loading", "Loading Temporary Summon Data...");
1644  sObjectMgr->LoadTempSummons(); // must be after LoadCreatureTemplates() and LoadGameObjectTemplates()
1645 
1646  TC_LOG_INFO("server.loading", "Loading pet levelup spells...");
1647  sSpellMgr->LoadPetLevelupSpellMap();
1648 
1649  TC_LOG_INFO("server.loading", "Loading pet default spells additional to levelup spells...");
1650  sSpellMgr->LoadPetDefaultSpells();
1651 
1652  TC_LOG_INFO("server.loading", "Loading Creature Addon Data...");
1653  sObjectMgr->LoadCreatureAddons(); // must be after LoadCreatureTemplates() and LoadCreatures()
1654 
1655  TC_LOG_INFO("server.loading", "Loading Gameobject Data...");
1656  sObjectMgr->LoadGameobjects();
1657 
1658  TC_LOG_INFO("server.loading", "Loading GameObject Addon Data...");
1659  sObjectMgr->LoadGameObjectAddons(); // must be after LoadGameObjectTemplate() and LoadGameobjects()
1660 
1661  TC_LOG_INFO("server.loading", "Loading GameObject Quest Items...");
1662  sObjectMgr->LoadGameObjectQuestItems();
1663 
1664  TC_LOG_INFO("server.loading", "Loading Creature Quest Items...");
1665  sObjectMgr->LoadCreatureQuestItems();
1666 
1667  TC_LOG_INFO("server.loading", "Loading Creature Linked Respawn...");
1668  sObjectMgr->LoadLinkedRespawn(); // must be after LoadCreatures(), LoadGameObjects()
1669 
1670  TC_LOG_INFO("server.loading", "Loading Weather Data...");
1672 
1673  TC_LOG_INFO("server.loading", "Loading Quests...");
1674  sObjectMgr->LoadQuests(); // must be loaded after DBCs, creature_template, item_template, gameobject tables
1675 
1676  TC_LOG_INFO("server.loading", "Checking Quest Disables");
1677  DisableMgr::CheckQuestDisables(); // must be after loading quests
1678 
1679  TC_LOG_INFO("server.loading", "Loading Quest POI");
1680  sObjectMgr->LoadQuestPOI();
1681 
1682  TC_LOG_INFO("server.loading", "Loading Quests Starters and Enders...");
1683  sObjectMgr->LoadQuestStartersAndEnders(); // must be after quest load
1684 
1685  TC_LOG_INFO("server.loading", "Loading Quest Greetings...");
1686  sObjectMgr->LoadQuestGreetings();
1687 
1688  TC_LOG_INFO("server.loading", "Loading Objects Pooling Data...");
1689  sPoolMgr->LoadFromDB();
1690 
1691  TC_LOG_INFO("server.loading", "Loading Game Event Data..."); // must be after loading pools fully
1692  sGameEventMgr->LoadFromDB();
1693 
1694  TC_LOG_INFO("server.loading", "Loading UNIT_NPC_FLAG_SPELLCLICK Data..."); // must be after LoadQuests
1695  sObjectMgr->LoadNPCSpellClickSpells();
1696 
1697  TC_LOG_INFO("server.loading", "Loading Vehicle Template Accessories...");
1698  sObjectMgr->LoadVehicleTemplateAccessories(); // must be after LoadCreatureTemplates() and LoadNPCSpellClickSpells()
1699 
1700  TC_LOG_INFO("server.loading", "Loading Vehicle Accessories...");
1701  sObjectMgr->LoadVehicleAccessories(); // must be after LoadCreatureTemplates() and LoadNPCSpellClickSpells()
1702 
1703  TC_LOG_INFO("server.loading", "Loading SpellArea Data..."); // must be after quest load
1704  sSpellMgr->LoadSpellAreas();
1705 
1706  TC_LOG_INFO("server.loading", "Loading AreaTrigger definitions...");
1707  sObjectMgr->LoadAreaTriggerTeleports();
1708 
1709  TC_LOG_INFO("server.loading", "Loading Access Requirements...");
1710  sObjectMgr->LoadAccessRequirements(); // must be after item template load
1711 
1712  TC_LOG_INFO("server.loading", "Loading Quest Area Triggers...");
1713  sObjectMgr->LoadQuestAreaTriggers(); // must be after LoadQuests
1714 
1715  TC_LOG_INFO("server.loading", "Loading Tavern Area Triggers...");
1716  sObjectMgr->LoadTavernAreaTriggers();
1717 
1718  TC_LOG_INFO("server.loading", "Loading AreaTrigger script names...");
1719  sObjectMgr->LoadAreaTriggerScripts();
1720 
1721  TC_LOG_INFO("server.loading", "Loading LFG entrance positions..."); // Must be after areatriggers
1722  sLFGMgr->LoadLFGDungeons();
1723 
1724  TC_LOG_INFO("server.loading", "Loading Dungeon boss data...");
1725  sObjectMgr->LoadInstanceEncounters();
1726 
1727  TC_LOG_INFO("server.loading", "Loading LFG rewards...");
1728  sLFGMgr->LoadRewards();
1729 
1730  TC_LOG_INFO("server.loading", "Loading Graveyard-zone links...");
1731  sObjectMgr->LoadGraveyardZones();
1732 
1733  TC_LOG_INFO("server.loading", "Loading spell pet auras...");
1734  sSpellMgr->LoadSpellPetAuras();
1735 
1736  TC_LOG_INFO("server.loading", "Loading Spell target coordinates...");
1737  sSpellMgr->LoadSpellTargetPositions();
1738 
1739  TC_LOG_INFO("server.loading", "Loading enchant custom attributes...");
1740  sSpellMgr->LoadEnchantCustomAttr();
1741 
1742  TC_LOG_INFO("server.loading", "Loading linked spells...");
1743  sSpellMgr->LoadSpellLinked();
1744 
1745  TC_LOG_INFO("server.loading", "Loading Player Create Data...");
1746  sObjectMgr->LoadPlayerInfo();
1747 
1748  TC_LOG_INFO("server.loading", "Loading Exploration BaseXP Data...");
1749  sObjectMgr->LoadExplorationBaseXP();
1750 
1751  TC_LOG_INFO("server.loading", "Loading Pet Name Parts...");
1752  sObjectMgr->LoadPetNames();
1753 
1755 
1756  TC_LOG_INFO("server.loading", "Loading the max pet number...");
1757  sObjectMgr->LoadPetNumber();
1758 
1759  TC_LOG_INFO("server.loading", "Loading pet level stats...");
1760  sObjectMgr->LoadPetLevelInfo();
1761 
1762  TC_LOG_INFO("server.loading", "Loading Player level dependent mail rewards...");
1763  sObjectMgr->LoadMailLevelRewards();
1764 
1765  // Loot tables
1766  LoadLootTables();
1767 
1768  TC_LOG_INFO("server.loading", "Loading Skill Discovery Table...");
1770 
1771  TC_LOG_INFO("server.loading", "Loading Skill Extra Item Table...");
1773 
1774  TC_LOG_INFO("server.loading", "Loading Skill Perfection Data Table...");
1776 
1777  TC_LOG_INFO("server.loading", "Loading Skill Fishing base level requirements...");
1778  sObjectMgr->LoadFishingBaseSkillLevel();
1779 
1780  TC_LOG_INFO("server.loading", "Loading skill tier info...");
1781  sObjectMgr->LoadSkillTiers();
1782 
1783  TC_LOG_INFO("server.loading", "Loading Achievements...");
1784  sAchievementMgr->LoadAchievementReferenceList();
1785  TC_LOG_INFO("server.loading", "Loading Achievement Criteria Modifier trees...");
1786  sAchievementMgr->LoadAchievementCriteriaModifiersTree();
1787  TC_LOG_INFO("server.loading", "Loading Achievement Criteria Lists...");
1788  sAchievementMgr->LoadAchievementCriteriaList();
1789  TC_LOG_INFO("server.loading", "Loading Achievement Criteria Data...");
1790  sAchievementMgr->LoadAchievementCriteriaData();
1791  TC_LOG_INFO("server.loading", "Loading Achievement Rewards...");
1792  sAchievementMgr->LoadRewards();
1793  TC_LOG_INFO("server.loading", "Loading Achievement Reward Locales...");
1794  sAchievementMgr->LoadRewardLocales();
1795  TC_LOG_INFO("server.loading", "Loading Completed Achievements...");
1796  sAchievementMgr->LoadCompletedAchievements();
1797 
1799  TC_LOG_INFO("server.loading", "Loading Item Auctions...");
1800  sAuctionMgr->LoadAuctionItems();
1801 
1802  TC_LOG_INFO("server.loading", "Loading Auctions...");
1803  sAuctionMgr->LoadAuctions();
1804 
1805  TC_LOG_INFO("server.loading", "Loading Guild rewards...");
1806  sGuildMgr->LoadGuildRewards();
1807 
1808  TC_LOG_INFO("server.loading", "Loading Guilds...");
1809  sGuildMgr->LoadGuilds();
1810 
1811  sGuildFinderMgr->LoadFromDB();
1812 
1813  TC_LOG_INFO("server.loading", "Loading ArenaTeams...");
1814  sArenaTeamMgr->LoadArenaTeams();
1815 
1816  TC_LOG_INFO("server.loading", "Loading Groups...");
1817  sGroupMgr->LoadGroups();
1818 
1819  TC_LOG_INFO("server.loading", "Loading ReservedNames...");
1820  sObjectMgr->LoadReservedPlayersNames();
1821 
1822  TC_LOG_INFO("server.loading", "Loading GameObjects for quests...");
1823  sObjectMgr->LoadGameObjectForQuests();
1824 
1825  TC_LOG_INFO("server.loading", "Loading BattleMasters...");
1826  sBattlegroundMgr->LoadBattleMastersEntry(); // must be after load CreatureTemplate
1827 
1828  TC_LOG_INFO("server.loading", "Loading GameTeleports...");
1829  sObjectMgr->LoadGameTele();
1830 
1831  TC_LOG_INFO("server.loading", "Loading Gossip menu...");
1832  sObjectMgr->LoadGossipMenu();
1833 
1834  TC_LOG_INFO("server.loading", "Loading Gossip menu options...");
1835  sObjectMgr->LoadGossipMenuItems();
1836 
1837  TC_LOG_INFO("server.loading", "Loading Vendors...");
1838  sObjectMgr->LoadVendors(); // must be after load CreatureTemplate and ItemTemplate
1839 
1840  TC_LOG_INFO("server.loading", "Loading Trainers...");
1841  sObjectMgr->LoadTrainerSpell(); // must be after load CreatureTemplate
1842 
1843  TC_LOG_INFO("server.loading", "Loading Waypoints...");
1844  sWaypointMgr->Load();
1845 
1846  TC_LOG_INFO("server.loading", "Loading SmartAI Waypoints...");
1847  sSmartWaypointMgr->LoadFromDB();
1848 
1849  TC_LOG_INFO("server.loading", "Loading Creature Formations...");
1850  sFormationMgr->LoadCreatureFormations();
1851 
1852  TC_LOG_INFO("server.loading", "Loading World States..."); // must be loaded before battleground, outdoor PvP and conditions
1853  LoadWorldStates();
1854 
1855  TC_LOG_INFO("server.loading", "Loading Terrain Phase definitions...");
1856  sObjectMgr->LoadTerrainPhaseInfo();
1857 
1858  TC_LOG_INFO("server.loading", "Loading Terrain Swap Default definitions...");
1859  sObjectMgr->LoadTerrainSwapDefaults();
1860 
1861  TC_LOG_INFO("server.loading", "Loading Terrain World Map definitions...");
1862  sObjectMgr->LoadTerrainWorldMaps();
1863 
1864  TC_LOG_INFO("server.loading", "Loading Phase Area definitions...");
1865  sObjectMgr->LoadAreaPhases();
1866 
1867  TC_LOG_INFO("server.loading", "Loading Conditions...");
1868  sConditionMgr->LoadConditions();
1869 
1870  TC_LOG_INFO("server.loading", "Loading faction change achievement pairs...");
1871  sObjectMgr->LoadFactionChangeAchievements();
1872 
1873  TC_LOG_INFO("server.loading", "Loading faction change spell pairs...");
1874  sObjectMgr->LoadFactionChangeSpells();
1875 
1876  TC_LOG_INFO("server.loading", "Loading faction change quest pairs...");
1877  sObjectMgr->LoadFactionChangeQuests();
1878 
1879  TC_LOG_INFO("server.loading", "Loading faction change item pairs...");
1880  sObjectMgr->LoadFactionChangeItems();
1881 
1882  TC_LOG_INFO("server.loading", "Loading faction change reputation pairs...");
1883  sObjectMgr->LoadFactionChangeReputations();
1884 
1885  TC_LOG_INFO("server.loading", "Loading faction change title pairs...");
1886  sObjectMgr->LoadFactionChangeTitles();
1887 
1888  TC_LOG_INFO("server.loading", "Loading GM bugs...");
1889  sSupportMgr->LoadBugTickets();
1890 
1891  TC_LOG_INFO("server.loading", "Loading GM complaints...");
1892  sSupportMgr->LoadComplaintTickets();
1893 
1894  TC_LOG_INFO("server.loading", "Loading GM suggestions...");
1895  sSupportMgr->LoadSuggestionTickets();
1896 
1897  /*TC_LOG_INFO("server.loading", "Loading GM surveys...");
1898  sSupportMgr->LoadSurveys();*/
1899 
1900  TC_LOG_INFO("server.loading", "Loading client addons...");
1902 
1903  TC_LOG_INFO("server.loading", "Loading garrison info...");
1904  sGarrisonMgr.Initialize();
1905 
1907  TC_LOG_INFO("server.loading", "Returning old mails...");
1908  sObjectMgr->ReturnOrDeleteOldMails(false);
1909 
1910  TC_LOG_INFO("server.loading", "Loading Autobroadcasts...");
1912 
1914  sObjectMgr->LoadSpellScripts(); // must be after load Creature/Gameobject(Template/Data)
1915  sObjectMgr->LoadEventScripts(); // must be after load Creature/Gameobject(Template/Data)
1916  sObjectMgr->LoadWaypointScripts();
1917 
1918  TC_LOG_INFO("server.loading", "Loading spell script names...");
1919  sObjectMgr->LoadSpellScriptNames();
1920 
1921  TC_LOG_INFO("server.loading", "Loading Creature Texts...");
1922  sCreatureTextMgr->LoadCreatureTexts();
1923 
1924  TC_LOG_INFO("server.loading", "Loading Creature Text Locales...");
1925  sCreatureTextMgr->LoadCreatureTextLocales();
1926 
1927  TC_LOG_INFO("server.loading", "Initializing Scripts...");
1928  sScriptMgr->Initialize();
1929  sScriptMgr->OnConfigLoad(false); // must be done after the ScriptMgr has been properly initialized
1930 
1931  TC_LOG_INFO("server.loading", "Validating spell scripts...");
1932  sObjectMgr->ValidateSpellScripts();
1933 
1934  TC_LOG_INFO("server.loading", "Loading SmartAI scripts...");
1935  sSmartScriptMgr->LoadSmartAIFromDB();
1936 
1937  TC_LOG_INFO("server.loading", "Loading Calendar data...");
1938  sCalendarMgr->LoadFromDB();
1939 
1941  TC_LOG_INFO("server.loading", "Initialize game time and timers");
1942  m_gameTime = time(NULL);
1944 
1945  LoginDatabase.PExecute("INSERT INTO uptime (realmid, starttime, uptime, revision) VALUES(%u, %u, 0, '%s')",
1946  realm.Id.Realm, uint32(m_startTime), GitRevision::GetFullVersion()); // One-time query
1947 
1952  //Update "uptime" table based on configuration entry in minutes.
1953  m_timers[WUPDATE_CORPSES].SetInterval(20 * MINUTE * IN_MILLISECONDS);
1954  //erase corpses every 20 minutes
1956  // clean logs table every 14 days by default
1958  m_timers[WUPDATE_DELETECHARS].SetInterval(DAY*IN_MILLISECONDS); // check for chars to delete every day
1959 
1960  // for AhBot
1961  m_timers[WUPDATE_AHBOT].SetInterval(getIntConfig(CONFIG_AHBOT_UPDATE_INTERVAL) * IN_MILLISECONDS); // every 20 sec
1962 
1963  m_timers[WUPDATE_PINGDB].SetInterval(getIntConfig(CONFIG_DB_PING_INTERVAL)*MINUTE*IN_MILLISECONDS); // Mysql ping time in minutes
1964 
1966 
1967  //to set mailtimer to return mails every day between 4 and 5 am
1968  //mailtimer is increased when updating auctions
1969  //one second is 1000 -(tested on win system)
1971  tm localTm;
1972  localtime_r(&m_gameTime, &localTm);
1973  mail_timer = ((((localTm.tm_hour + 20) % 24)* HOUR * IN_MILLISECONDS) / m_timers[WUPDATE_AUCTIONS].GetInterval());
1974  //1440
1975  mail_timer_expires = ((DAY * IN_MILLISECONDS) / (m_timers[WUPDATE_AUCTIONS].GetInterval()));
1976  TC_LOG_INFO("server.loading", "Mail timer set to: " UI64FMTD ", mail return is called every " UI64FMTD " minutes", uint64(mail_timer), uint64(mail_timer_expires));
1977 
1980 
1982  TC_LOG_INFO("server.loading", "Starting Map System");
1983  sMapMgr->Initialize();
1984 
1985  TC_LOG_INFO("server.loading", "Starting Game Event system...");
1986  uint32 nextGameEvent = sGameEventMgr->StartSystem();
1987  m_timers[WUPDATE_EVENTS].SetInterval(nextGameEvent); //depend on next event
1988 
1989  // Delete all characters which have been deleted X days before
1990  Player::DeleteOldCharacters();
1991 
1992  TC_LOG_INFO("server.loading", "Initialize AuctionHouseBot...");
1993  sAuctionBot->Initialize();
1994 
1995  // Delete all custom channels which haven't been used for PreserveCustomChannelDuration days.
1997 
1998  TC_LOG_INFO("server.loading", "Initializing Opcodes...");
2000 
2001  TC_LOG_INFO("server.loading", "Starting Arena Season...");
2002  sGameEventMgr->StartArenaSeason();
2003 
2004  sSupportMgr->Initialize();
2005 
2007  TC_LOG_INFO("server.loading", "Starting Battleground System");
2008  sBattlegroundMgr->LoadBattlegroundTemplates();
2009 
2011  TC_LOG_INFO("server.loading", "Starting Outdoor PvP System");
2012  sOutdoorPvPMgr->InitOutdoorPvP();
2013 
2015  TC_LOG_INFO("server.loading", "Starting Battlefield System");
2016  sBattlefieldMgr->InitBattlefield();
2017 
2018  TC_LOG_INFO("server.loading", "Loading Transports...");
2019  sTransportMgr->SpawnContinentTransports();
2020 
2022  TC_LOG_INFO("server.loading", "Loading Warden Checks...");
2023  sWardenCheckMgr->LoadWardenChecks();
2024 
2025  TC_LOG_INFO("server.loading", "Loading Warden Action Overrides...");
2026  sWardenCheckMgr->LoadWardenOverrides();
2027 
2028  TC_LOG_INFO("server.loading", "Deleting expired bans...");
2029  LoginDatabase.Execute("DELETE FROM ip_banned WHERE unbandate <= UNIX_TIMESTAMP() AND unbandate<>bandate"); // One-time query
2030 
2031  TC_LOG_INFO("server.loading", "Calculate next daily quest reset time...");
2033 
2034  TC_LOG_INFO("server.loading", "Calculate next weekly quest reset time...");
2036 
2037  TC_LOG_INFO("server.loading", "Calculate next monthly quest reset time...");
2039 
2040  TC_LOG_INFO("server.loading", "Calculate random battleground reset time...");
2042 
2043  TC_LOG_INFO("server.loading", "Calculate guild limitation(s) reset time...");
2045 
2046  TC_LOG_INFO("server.loading", "Calculate next currency reset time...");
2048 
2050 
2051  TC_LOG_INFO("server.loading", "Loading race and class expansion requirements...");
2052  sObjectMgr->LoadRaceAndClassExpansionRequirements();
2053 
2054  TC_LOG_INFO("server.loading", "Loading character templates...");
2055  sObjectMgr->LoadCharacterTemplates();
2056 
2057  TC_LOG_INFO("server.loading", "Loading realm names...");
2058  sObjectMgr->LoadRealmNames();
2059 
2060  TC_LOG_INFO("server.loading", "Loading battle pets info...");
2062 
2063  uint32 startupDuration = GetMSTimeDiffToNow(startupBegin);
2064 
2065  TC_LOG_INFO("server.worldserver", "World initialized in %u minutes %u seconds", (startupDuration / 60000), ((startupDuration % 60000) / 1000));
2066 
2067  if (uint32 realmId = sConfigMgr->GetIntDefault("RealmID", 0)) // 0 reserved for auth
2068  sLog->SetRealmId(realmId);
2069 }
void dtAllocSetCustom(dtAllocFunc *allocFunc, dtFreeFunc *freeFunc)
Definition: DetourAlloc.cpp:35
#define sDB2Manager
Definition: DB2Stores.h:224
uint32 GetLiquidFlags(uint32 liquidType)
Definition: DBCStores.cpp:794
uint32 Realm
Definition: Realm.h:53
void Execute(const char *sql)
Definition: DatabaseWorkerPool.h:87
OpcodeTable opcodeTable
Definition: Opcodes.cpp:49
Definition: VMapManager2.h:78
void LoadGameTables(const std::string &dataPath, uint32 defaultLocale)
Definition: DBCStores.cpp:500
#define sCalendarMgr
Definition: CalendarMgr.h:334
Definition: World.h:337
void LoadConfigSettings(bool reload=false)
Initialize config values.
Definition: World.cpp:427
#define sOutdoorPvPMgr
Definition: OutdoorPvPMgr.h:105
void InitRandomBGResetTime()
Definition: World.cpp:3018
Definition: Common.h:98
Definition: World.h:356
Definition: Realm.h:72
Realm realm
Definition: World.cpp:3485
#define sGuildMgr
Definition: GuildMgr.h:61
void LoadFromDB()
Definition: AddonMgr.cpp:40
void InitializeThreadUnsafe(std::unordered_map< uint32, std::vector< uint32 >> const &mapData)
Definition: MMapManager.cpp:39
void LoadDBAllowedSecurityLevel()
Definition: World.cpp:3135
Definition: World.h:219
uint32 getMSTime()
Definition: Timer.h:24
#define sConfigMgr
Definition: Config.h:61
Definition: DBCStructure.h:830
#define sTransportMgr
Definition: TransportMgr.h:162
time_t m_gameTime
Definition: World.h:804
arena_t NULL
Definition: jemalloc_internal.h:624
Definition: World.h:220
TC_COMMON_API char const * GetFullVersion()
Definition: GitRevision.cpp:51
Definition: World.h:83
void CheckQuestDisables()
Definition: DisableMgr.cpp:248
#define sLog
Definition: Log.h:154
static bool ExistMapAndVMap(uint32 mapid, float x, float y)
Definition: MapManager.cpp:237
uint64_t uint64
Definition: g3dmath.h:170
void LoadGameObjectModelList(std::string const &dataPath)
Definition: GameObjectModel.cpp:43
Definition: World.h:92
void LoadDisables()
Definition: DisableMgr.cpp:58
void LoadAutobroadcasts()
Definition: World.cpp:2093
void LoadSkillExtraItemTable()
Definition: SkillExtraItems.cpp:139
#define sObjectMgr
Definition: ObjectMgr.h:1567
void Close()
Definition: DatabaseWorkerPool.cpp:72
Definition: World.h:93
Definition: Common.h:97
LocaleConstant GetDefaultDbcLocale() const
Definition: World.h:616
time_t mail_timer
Definition: World.h:806
LoginDatabaseWorkerPool LoginDatabase
Accessor to the realm/login database.
Definition: DatabaseEnv.cpp:22
void InitDailyQuestResetTime()
Definition: World.cpp:2976
void PExecute(Format &&sql, Args &&...args)
Definition: DatabaseWorkerPool.h:99
IntervalTimer m_timers[WUPDATE_COUNT]
Definition: World.h:805
Definition: World.h:339
void SetInterval(time_t interval)
Definition: Timer.h:79
void LoadSkillDiscoveryTable()
Definition: SkillDiscovery.cpp:47
void LoadSkillPerfectItemTable()
Definition: SkillExtraItems.cpp:52
#define sWaypointMgr
Definition: WaypointManager.h:75
Definition: World.h:81
time_t m_startTime
Definition: World.h:803
#define sPoolMgr
Definition: PoolMgr.h:166
TC_GAME_API void CleanDatabase()
Definition: CharacterDatabaseCleaner.cpp:28
void * dtCustomAlloc(int size, dtAllocHint)
Definition: Memory.h:9
Battlenet::RealmHandle Id
Definition: Realm.h:86
Definition: World.h:323
Definition: World.h:91
Definition: Common.h:99
#define sLFGMgr
Definition: LFGMgr.h:481
uint32 m_int_configs[INT_CONFIG_VALUE_COUNT]
Definition: World.h:823
bool IsVMAPDisabledFor(uint32 entry, uint8 flags)
Definition: DisableMgr.cpp:375
void dtCustomFree(void *ptr)
Definition: Memory.h:14
#define UI64FMTD
Definition: Define.h:137
#define sSpellMgr
Definition: SpellMgr.h:756
void LoadWeatherData()
Definition: WeatherMgr.cpp:83
std::string m_dataPath
Definition: World.h:834
#define sCreatureTextMgr
Definition: CreatureTextMgr.h:113
bool IsFFAPvPRealm() const
Definition: World.h:718
uint32_t uint32
Definition: Define.h:150
#define sGroupMgr
Definition: GroupMgr.h:59
#define sGarrisonMgr
Definition: GarrisonMgr.h:77
#define sAuctionBot
Definition: AuctionHouseBot.h:305
#define sSmartWaypointMgr
Definition: SmartScriptMgr.h:1670
HotfixDatabaseWorkerPool HotfixDatabase
Accessor to the hotfix database.
Definition: DatabaseEnv.cpp:23
#define sConditionMgr
Definition: ConditionMgr.h:307
void Initialize()
Correspondence between opcodes and their names.
Definition: Opcodes.cpp:111
#define sAccountMgr
Definition: AccountMgr.h:98
#define sInstanceSaveMgr
Definition: InstanceSaveMgr.h:243
time_t mail_timer_expires
Definition: World.h:807
Definition: World.h:278
#define sBattlefieldMgr
Definition: BattlefieldMgr.h:67
#define sSupportMgr
Definition: SupportMgr.h:296
Definition: World.h:369
void InitMonthlyQuestResetTime()
Definition: World.cpp:3011
TC_COMMON_API struct tm * localtime_r(const time_t *time, struct tm *result)
void InitWeeklyQuestResetTime()
Definition: World.cpp:2969
Definition: World.h:88
Definition: MMapManager.h:93
#define sGameEventMgr
Definition: GameEventMgr.h:184
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
Definition: World.h:87
void LoadCharacterInfoStore()
Definition: World.cpp:3395
#define TC_LOG_FATAL(filterType__,...)
Definition: Log.h:210
DBCStorage< MapEntry > sMapStore(Mapfmt)
LocaleConstant m_defaultDbcLocale
Definition: World.h:830
Definition: World.h:90
#define sTaxiPathGraph
Definition: TaxiPathGraph.h:65
Definition: World.h:85
Definition: Common.h:103
#define sWardenCheckMgr
Definition: WardenCheckMgr.h:80
#define sMapMgr
Definition: MapManager.h:194
#define sFormationMgr
Definition: CreatureGroups.h:84
#define sAuctionMgr
Definition: AuctionHouseMgr.h:199
#define sBattlegroundMgr
Definition: BattlegroundMgr.h:181
static IVMapManager * createOrGetVMapManager()
Definition: VMapFactory.cpp:28
static MMapManager * createOrGetMMapManager()
Definition: MMapFactory.cpp:28
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
#define sArenaTeamMgr
Definition: ArenaTeamMgr.h:53
void LoadDBCStores(const std::string &dataPath, uint32 defaultLocale)
Definition: DBCStores.cpp:288
#define sScriptMgr
Definition: ScriptMgr.h:837
void Initialize()
Definition: CreatureAIRegistry.cpp:34
Definition: World.h:268
uint32_t uint32
Definition: g3dmath.h:168
void LoadWorldStates()
Definition: World.cpp:3289
#define sGuildFinderMgr
Definition: GuildFinderMgr.h:271
TC_GAME_API void LoadRandomEnchantmentsTable()
Definition: ItemEnchantmentMgr.cpp:47
Definition: World.h:84
static void CleanOldChannelsInDB()
Definition: Channel.cpp:136
Definition: World.h:86
Definition: World.h:82
void LoadLootTables()
Definition: LootMgr.cpp:1881
uint32 getIntConfig(WorldIntConfigs index) const
Get a server configuration element (see #WorldConfigs)
Definition: World.h:707
#define sAchievementMgr
Definition: AchievementMgr.h:501
void InitGuildResetTime()
Definition: World.cpp:3046
#define sSmartScriptMgr
Definition: SmartScriptMgr.h:1669
void InitCurrencyResetTime()
Definition: World.cpp:3074
static void Initialize()
Definition: BattlePetMgr.cpp:79

+ Here is the call graph for this function:

void World::setIntConfig ( WorldIntConfigs  index,
uint32  value 
)
inline

Set a server configuration element (see #WorldConfigs)

701  {
702  if (index < INT_CONFIG_VALUE_COUNT)
703  m_int_configs[index] = value;
704  }
Definition: World.h:377
uint32 m_int_configs[INT_CONFIG_VALUE_COUNT]
Definition: World.h:823
const FieldDescriptor value
Definition: descriptor.h:1522
void World::SetMotd ( std::string  motd)

Set a new Message of the Day.

we are using a string copy here to allow modifications in script hooks

193 {
195  sScriptMgr->OnMotdChange(motd);
196 
197  _motd.clear();
198  boost::split(_motd, motd, boost::is_any_of("@"));
199 }
#define sScriptMgr
Definition: ScriptMgr.h:837
std::vector< std::string > _motd
Definition: World.h:833

+ Here is the caller graph for this function:

void World::SetNewCharString ( std::string const str)
inline

Set the string for new characters (first login)

612 { m_newCharString = str; }
std::string m_newCharString
Definition: World.h:820

+ Here is the caller graph for this function:

void World::SetPlayerAmountLimit ( uint32  limit)
inline

Active session server limit.

590 { m_playerLimit = limit; }
uint32 m_playerLimit
Definition: World.h:828

+ Here is the caller graph for this function:

void World::SetPlayerSecurityLimit ( AccountTypes  sec)
3146 {
3147  AccountTypes sec = _sec < SEC_CONSOLE ? _sec : SEC_PLAYER;
3148  bool update = sec > m_allowedSecurityLevel;
3149  m_allowedSecurityLevel = sec;
3150  if (update)
3151  KickAllLess(m_allowedSecurityLevel);
3152 }
Definition: Common.h:108
AccountTypes m_allowedSecurityLevel
Definition: World.h:829
AccountTypes
Definition: Common.h:106
Definition: Common.h:112
void KickAllLess(AccountTypes sec)
Kick (and save) all players with security level less sec
Definition: World.cpp:2544

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void World::setRate ( Rates  rate,
float  value 
)
inline

Set a server rate (see Rates)

669 { rate_values[rate]=value; }
float rate_values[MAX_RATES]
Definition: World.h:822
const FieldDescriptor value
Definition: descriptor.h:1522
void World::SetRecordDiffInterval ( int32  t)
inline
629 { if (t >= 0) m_int_configs[CONFIG_INTERVAL_LOG_UPDATE] = (uint32)t; }
Definition: World.h:318
uint32 m_int_configs[INT_CONFIG_VALUE_COUNT]
Definition: World.h:823
uint32_t uint32
Definition: g3dmath.h:168
void World::setWorldState ( uint32  index,
uint64  value 
)
3318 {
3319  WorldStatesMap::const_iterator it = m_worldstates.find(index);
3320  if (it != m_worldstates.end())
3321  {
3323 
3324  stmt->setUInt32(0, uint32(value));
3325  stmt->setUInt32(1, index);
3326 
3327  CharacterDatabase.Execute(stmt);
3328  }
3329  else
3330  {
3332 
3333  stmt->setUInt32(0, index);
3334  stmt->setUInt32(1, uint32(value));
3335 
3336  CharacterDatabase.Execute(stmt);
3337  }
3338  m_worldstates[index] = value;
3339 }
void Execute(const char *sql)
Definition: DatabaseWorkerPool.h:87
WorldStatesMap m_worldstates
Definition: World.h:827
Definition: CharacterDatabase.h:358
Definition: PreparedStatement.h:74
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
void setUInt32(const uint8 index, const uint32 value)
Definition: PreparedStatement.cpp:115
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
const FieldDescriptor value
Definition: descriptor.h:1522
uint32_t uint32
Definition: g3dmath.h:168
Definition: CharacterDatabase.h:359

+ Here is the call graph for this function:

void World::ShutdownCancel ( )

Cancel a planned server shutdown.

2808 {
2809  // nothing cancel or too later
2810  if (!m_ShutdownTimer || m_stopEvent)
2811  return;
2812 
2814 
2815  m_ShutdownMask = 0;
2816  m_ShutdownTimer = 0;
2817  m_ExitCode = SHUTDOWN_EXIT_CODE; // to default value
2818  SendServerMessage(msgid);
2819 
2820  TC_LOG_DEBUG("misc", "Server %s cancelled.", (m_ShutdownMask & SHUTDOWN_MASK_RESTART ? "restart" : "shuttingdown"));
2821 
2822  sScriptMgr->OnShutdownCancel();
2823 }
static std::atomic< bool > m_stopEvent
Definition: World.h:794
Definition: World.h:53
void SendServerMessage(ServerMessageType messageID, std::string stringParam="", Player *player=NULL)
Send a server message to the user(s)
Definition: World.cpp:2826
Definition: World.h:67
static uint8 m_ExitCode
Definition: World.h:795
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:198
Definition: World.h:54
ServerMessageType
Definition: World.h:48
uint32 m_ShutdownMask
Definition: World.h:797
Definition: World.h:73
uint32 m_ShutdownTimer
Definition: World.h:796
#define sScriptMgr
Definition: ScriptMgr.h:837

+ Here is the call graph for this function:

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

Display a shutdown message to the user(s)

  • Display a message every 12 hours, hours, 5 minutes, minute, 5 seconds and finally seconds
2782 {
2783  // not show messages for idle shutdown mode
2785  return;
2786 
2788  if (show ||
2789  (m_ShutdownTimer < 5* MINUTE && (m_ShutdownTimer % 15) == 0) || // < 5 min; every 15 sec
2790  (m_ShutdownTimer < 15 * MINUTE && (m_ShutdownTimer % MINUTE) == 0) || // < 15 min ; every 1 min
2791  (m_ShutdownTimer < 30 * MINUTE && (m_ShutdownTimer % (5 * MINUTE)) == 0) || // < 30 min ; every 5 min
2792  (m_ShutdownTimer < 12 * HOUR && (m_ShutdownTimer % HOUR) == 0) || // < 12 h ; every 1 h
2793  (m_ShutdownTimer > 12 * HOUR && (m_ShutdownTimer % (12 * HOUR)) == 0)) // > 12 h ; every 12 h
2794  {
2795  std::string str = secsToTimeString(m_ShutdownTimer);
2796  if (!reason.empty())
2797  str += " - " + reason;
2798 
2800 
2801  SendServerMessage(msgid, str, player);
2802  TC_LOG_DEBUG("misc", "Server is %s in %s", (m_ShutdownMask & SHUTDOWN_MASK_RESTART ? "restart" : "shuttingdown"), str.c_str());
2803  }
2804 }
void SendServerMessage(ServerMessageType messageID, std::string stringParam="", Player *player=NULL)
Send a server message to the user(s)
Definition: World.cpp:2826
Definition: World.h:51
std::string secsToTimeString(uint64 timeInSecs, bool shortText, bool hoursOnly)
Definition: Util.cpp:109
Definition: Common.h:98
Definition: World.h:67
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:198
Definition: Common.h:97
ServerMessageType
Definition: World.h:48
uint32 m_ShutdownMask
Definition: World.h:797
Definition: World.h:50
uint32 m_ShutdownTimer
Definition: World.h:796
Definition: World.h:68

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

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
2754 {
2755  // ignore if server shutdown at next tick
2756  if (IsStopped())
2757  return;
2758 
2759  m_ShutdownMask = options;
2760  m_ExitCode = exitcode;
2761 
2763  if (time == 0)
2764  {
2765  if (!(options & SHUTDOWN_MASK_IDLE) || GetActiveAndQueuedSessionCount() == 0)
2766  m_stopEvent = true; // exist code already set
2767  else
2768  m_ShutdownTimer = 1; //So that the session count is re-evaluated at next world tick
2769  }
2771  else
2772  {
2773  m_ShutdownTimer = time;
2774  ShutdownMsg(true, nullptr, reason);
2775  }
2776 
2777  sScriptMgr->OnShutdownInitiate(ShutdownExitCode(exitcode), ShutdownMask(options));
2778 }
static std::atomic< bool > m_stopEvent
Definition: World.h:794
uint32 GetActiveAndQueuedSessionCount() const
Definition: World.h:559
static bool IsStopped()
Definition: World.h:663
static uint8 m_ExitCode
Definition: World.h:795
ShutdownMask
Definition: World.h:65
uint32 m_ShutdownMask
Definition: World.h:797
void ShutdownMsg(bool show=false, Player *player=NULL, const std::string &reason=std::string())
Display a shutdown message to the user(s)
Definition: World.cpp:2781
uint32 m_ShutdownTimer
Definition: World.h:796
#define sScriptMgr
Definition: ScriptMgr.h:837
ShutdownExitCode
Definition: World.h:71
Definition: World.h:68

+ Here is the call graph for this function:

static void World::StopNow ( uint8  exitcode)
inlinestatic
662 { m_stopEvent = true; m_ExitCode = exitcode; }
static std::atomic< bool > m_stopEvent
Definition: World.h:794
static uint8 m_ExitCode
Definition: World.h:795

+ Here is the caller graph for this function:

void World::Update ( uint32  diff)

Update the World !

  • Update the different timers
  • Update the game time and check for shutdown time

Handle daily quests reset time

Handle weekly quests reset time

Handle monthly quests reset time

  • Handle auctions when the timer has passed

    • Update mails (return old mails with item, or delete them)
    • Handle expired auctions

  • Handle AHBot operations

  • Handle session updates when the timer has passed

  • Handle weather updates when the timer has passed

  • Update uptime table

  • Clean logs table

  • Handle all other objects
    • Update objects when the timer has passed (maps, transport, creatures, ...)
    • Delete all characters which have been deleted X days before
    • Erase corpses once every 20 minutes
    • Process Game events when necessary
    • Ping to keep MySQL connections alive
2129 {
2130  m_updateTime = diff;
2131 
2133  {
2135  {
2136  TC_LOG_DEBUG("misc", "Update time diff: %u. Players online: %u.", m_updateTimeSum / m_updateTimeCount, GetActiveSessionCount());
2138  m_updateTimeCount = 1;
2139  }
2140  else
2141  {
2144  }
2145  }
2146 
2148  for (int i = 0; i < WUPDATE_COUNT; ++i)
2149  {
2150  if (m_timers[i].GetCurrent() >= 0)
2151  m_timers[i].Update(diff);
2152  else
2153  m_timers[i].SetCurrent(0);
2154  }
2155 
2157  _UpdateGameTime();
2158 
2161  {
2162  DailyReset();
2164  }
2165 
2169 
2173 
2175  ResetRandomBG();
2176 
2178  ResetGuildCap();
2179 
2182 
2184  if (m_timers[WUPDATE_AUCTIONS].Passed())
2185  {
2187 
2189  //(tested... works on win)
2191  {
2192  mail_timer = 0;
2193  sObjectMgr->ReturnOrDeleteOldMails(true);
2194  }
2195 
2197  sAuctionMgr->Update();
2198  }
2199 
2200  if (m_timers[WUPDATE_AUCTIONS_PENDING].Passed())
2201  {
2203 
2204  sAuctionMgr->UpdatePendingAuctions();
2205  }
2206 
2208  if (m_timers[WUPDATE_AHBOT].Passed())
2209  {
2210  sAuctionBot->Update();
2212  }
2213 
2216  UpdateSessions(diff);
2217  RecordTimeDiff("UpdateSessions");
2218 
2220  if (m_timers[WUPDATE_WEATHERS].Passed())
2221  {
2224  }
2225 
2227  if (m_timers[WUPDATE_UPTIME].Passed())
2228  {
2229  uint32 tmpDiff = uint32(m_gameTime - m_startTime);
2230  uint32 maxOnlinePlayers = GetMaxPlayerCount();
2231 
2233 
2235 
2236  stmt->setUInt32(0, tmpDiff);
2237  stmt->setUInt16(1, uint16(maxOnlinePlayers));
2238  stmt->setUInt32(2, realm.Id.Realm);
2239  stmt->setUInt32(3, uint32(m_startTime));
2240 
2241  LoginDatabase.Execute(stmt);
2242  }
2243 
2245  if (sWorld->getIntConfig(CONFIG_LOGDB_CLEARTIME) > 0) // if not enabled, ignore the timer
2246  {
2247  if (m_timers[WUPDATE_CLEANDB].Passed())
2248  {
2250 
2252 
2253  stmt->setUInt32(0, sWorld->getIntConfig(CONFIG_LOGDB_CLEARTIME));
2254  stmt->setUInt32(1, uint32(time(0)));
2255 
2256  LoginDatabase.Execute(stmt);
2257  }
2258  }
2259 
2263  sMapMgr->Update(diff);
2264  RecordTimeDiff("UpdateMapMgr");
2265 
2266  if (sWorld->getBoolConfig(CONFIG_AUTOBROADCAST))
2267  {
2268  if (m_timers[WUPDATE_AUTOBROADCAST].Passed())
2269  {
2272  }
2273  }
2274 
2275  sBattlegroundMgr->Update(diff);
2276  RecordTimeDiff("UpdateBattlegroundMgr");
2277 
2278  sOutdoorPvPMgr->Update(diff);
2279  RecordTimeDiff("UpdateOutdoorPvPMgr");
2280 
2281  sBattlefieldMgr->Update(diff);
2282  RecordTimeDiff("BattlefieldMgr");
2283 
2285  if (m_timers[WUPDATE_DELETECHARS].Passed())
2286  {
2288  Player::DeleteOldCharacters();
2289  }
2290 
2291  sLFGMgr->Update(diff);
2292  RecordTimeDiff("UpdateLFGMgr");
2293 
2294  sGroupMgr->Update(diff);
2295  RecordTimeDiff("GroupMgr");
2296 
2297  // execute callbacks from sql queries that were queued recently
2299  RecordTimeDiff("ProcessQueryCallbacks");
2300 
2302  if (m_timers[WUPDATE_CORPSES].Passed())
2303  {
2305  sMapMgr->DoForAllMaps([](Map* map)
2306  {
2307  map->RemoveOldCorpses();
2308  });
2309  }
2310 
2312  if (m_timers[WUPDATE_EVENTS].Passed())
2313  {
2314  m_timers[WUPDATE_EVENTS].Reset(); // to give time for Update() to be processed
2315  uint32 nextGameEvent = sGameEventMgr->Update();
2316  m_timers[WUPDATE_EVENTS].SetInterval(nextGameEvent);
2318  }
2319 
2321  if (m_timers[WUPDATE_PINGDB].Passed())
2322  {
2324  TC_LOG_DEBUG("misc", "Ping MySQL to keep connection alive");
2328  }
2329 
2330  if (m_timers[WUPDATE_GUILDSAVE].Passed())
2331  {
2333  sGuildMgr->SaveGuilds();
2334  }
2335 
2336  // update the instance reset times
2337  sInstanceSaveMgr->Update();
2338 
2339  // And last, but not least handle the issued cli commands
2341 
2342  sScriptMgr->OnWorldUpdate(diff);
2343 }
void ProcessQueryCallbacks()
Definition: World.cpp:3347
time_t m_NextMonthlyQuestReset
Definition: World.h:851
uint32 Realm
Definition: Realm.h:53
void Execute(const char *sql)
Definition: DatabaseWorkerPool.h:87
void ResetTimeDiffRecord()
Definition: World.cpp:2071
Definition: World.h:153
time_t m_NextDailyQuestReset
Definition: World.h:849
#define sOutdoorPvPMgr
Definition: OutdoorPvPMgr.h:105
void RemoveOldCorpses()
Definition: Map.cpp:3853
uint32 m_updateTimeCount
Definition: World.h:809
void _UpdateGameTime()
Update the game time.
Definition: World.cpp:2724
Realm realm
Definition: World.cpp:3485
#define sGuildMgr
Definition: GuildMgr.h:61
void KeepAlive()
Keeps all our MySQL connections alive, prevent the server from disconnecting us.
Definition: DatabaseWorkerPool.cpp:243
time_t m_NextGuildReset
Definition: World.h:853
time_t m_gameTime
Definition: World.h:804
Definition: World.h:318
WorldDatabaseWorkerPool WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
Definition: World.h:83
void ResetGuildCap()
Definition: World.cpp:3244
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:198
Definition: World.h:92
#define sWorld
Definition: World.h:887
void DailyReset()
Definition: World.cpp:3104
#define sObjectMgr
Definition: ObjectMgr.h:1567
uint16_t uint16
Definition: g3dmath.h:166
Definition: PreparedStatement.h:74
Definition: World.h:93
time_t mail_timer
Definition: World.h:806
LoginDatabaseWorkerPool LoginDatabase
Accessor to the realm/login database.
Definition: DatabaseEnv.cpp:22
IntervalTimer m_timers[WUPDATE_COUNT]
Definition: World.h:805
void SetInterval(time_t interval)
Definition: Timer.h:79
void ResetCurrencyWeekCap()
Definition: World.cpp:3123
Definition: World.h:81
time_t m_startTime
Definition: World.h:803
void ResetWeeklyQuests()
Definition: World.cpp:3154
Definition: LoginDatabase.h:75
Battlenet::RealmHandle Id
Definition: Realm.h:86
uint32 m_updateTime
Definition: World.h:808
Definition: World.h:91
Definition: Common.h:99
#define sLFGMgr
Definition: LFGMgr.h:481
uint32 m_int_configs[INT_CONFIG_VALUE_COUNT]
Definition: World.h:823
void setUInt16(const uint8 index, const uint16 value)
Definition: PreparedStatement.cpp:106
uint32_t uint32
Definition: Define.h:150
#define sGroupMgr
Definition: GroupMgr.h:59
#define sAuctionBot
Definition: AuctionHouseBot.h:305
void ResetRandomBG()
Definition: World.cpp:3229
uint32 GetMaxPlayerCount() const
Definition: World.h:567
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
void Reset()
Definition: Timer.h:68
Definition: Map.h:259
void setUInt32(const uint8 index, const uint32 value)
Definition: PreparedStatement.cpp:115
#define sInstanceSaveMgr
Definition: InstanceSaveMgr.h:243
time_t mail_timer_expires
Definition: World.h:807
time_t m_NextRandomBGReset
Definition: World.h:852
uint32 m_updateTimeSum
Definition: World.h:808
time_t m_NextCurrencyReset
Definition: World.h:854
Definition: World.h:324
#define sBattlefieldMgr
Definition: BattlefieldMgr.h:67
Definition: World.h:319
Definition: World.h:88
void SendAutoBroadcast()
Definition: World.cpp:2891
#define sGameEventMgr
Definition: GameEventMgr.h:184
Definition: World.h:87
Definition: World.h:90
Definition: World.h:85
#define sMapMgr
Definition: MapManager.h:194
void Update(time_t diff)
Definition: Timer.h:56
#define sAuctionMgr
Definition: AuctionHouseMgr.h:199
#define sBattlegroundMgr
Definition: BattlegroundMgr.h:181
Definition: World.h:94
void ProcessCliCommands()
Definition: World.cpp:2873
void UpdateSessions(uint32 diff)
Definition: World.cpp:2839
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
#define sScriptMgr
Definition: ScriptMgr.h:837
uint32_t uint32
Definition: g3dmath.h:168
void SetCurrent(time_t current)
Definition: Timer.h:74
Definition: LoginDatabase.h:76
Definition: World.h:84
Definition: World.h:86
Definition: World.h:82
void RecordTimeDiff(std::string const &text)
Definition: World.cpp:2079
uint32 GetActiveSessionCount() const
Definition: World.h:560
void Update(uint32 diff)
Definition: WeatherMgr.cpp:150
void ResetMonthlyQuests()
Definition: World.cpp:3172
time_t m_NextWeeklyQuestReset
Definition: World.h:850

+ Here is the call graph for this function:

void World::UpdateAreaDependentAuras ( )
3279 {
3280  SessionMap::const_iterator itr;
3281  for (itr = m_sessions.begin(); itr != m_sessions.end(); ++itr)
3282  if (itr->second && itr->second->GetPlayer() && itr->second->GetPlayer()->IsInWorld())
3283  {
3284  itr->second->GetPlayer()->UpdateAreaDependentAuras(itr->second->GetPlayer()->GetAreaId());
3285  itr->second->GetPlayer()->UpdateZoneDependentAuras(itr->second->GetPlayer()->GetZoneId());
3286  }
3287 }
SessionMap m_sessions
Definition: World.h:812
void World::UpdateCharacterInfo ( ObjectGuid const guid,
std::string const name,
uint8  gender = GENDER_NONE,
uint8  race = RACE_NONE 
)
3432 {
3433  CharacterInfoContainer::iterator itr = _characterInfoStore.find(guid);
3434  if (itr == _characterInfoStore.end())
3435  return;
3436 
3437  itr->second.Name = name;
3438 
3439  if (gender != GENDER_NONE)
3440  itr->second.Sex = gender;
3441 
3442  if (race != RACE_NONE)
3443  itr->second.Race = race;
3444 
3446  data.Guid = guid;
3447  SendGlobalMessage(data.Write());
3448 }
CharacterInfoContainer _characterInfoStore
Definition: World.h:876
void SendGlobalMessage(WorldPacket const *packet, WorldSession *self=nullptr, uint32 team=0)
Send a packet to all players (except self if mentioned)
Definition: World.cpp:2354
Definition: SharedDefines.h:101
WorldPacket const * Write() override
Definition: MiscPackets.cpp:30
Definition: MiscPackets.h:70
ObjectGuid Guid
Definition: MiscPackets.h:77
Definition: SharedDefines.h:95

+ Here is the call graph for this function:

void World::UpdateCharacterInfoDeleted ( ObjectGuid const guid,
bool  deleted,
std::string const name = nullptr 
)
3460 {
3461  CharacterInfoContainer::iterator itr = _characterInfoStore.find(guid);
3462  if (itr == _characterInfoStore.end())
3463  return;
3464 
3465  itr->second.IsDeleted = deleted;
3466 
3467  if (name)
3468  itr->second.Name = *name;
3469 }
CharacterInfoContainer _characterInfoStore
Definition: World.h:876
void World::UpdateCharacterInfoLevel ( ObjectGuid const guid,
uint8  level 
)
3451 {
3452  CharacterInfoContainer::iterator itr = _characterInfoStore.find(guid);
3453  if (itr == _characterInfoStore.end())
3454  return;
3455 
3456  itr->second.Level = level;
3457 }
CharacterInfoContainer _characterInfoStore
Definition: World.h:876
void World::UpdateMaxSessionCounters ( )

Get the number of current active sessions.

3257 {
3260 }
SessionMap m_sessions
Definition: World.h:812
uint32 m_maxActiveSessionCount
Definition: World.h:815
T max(const T &x, const T &y)
Definition: g3dmath.h:320
Queue m_QueuedPlayer
Definition: World.h:857
uint32 m_maxQueuedSessionCount
Definition: World.h:816
uint32_t uint32
Definition: g3dmath.h:168

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void World::UpdateRealmCharCount ( uint32  accid)
2942 {
2944  stmt->setUInt32(0, accountId);
2946 }
std::deque< PreparedQueryResultFuture > m_realmCharCallbacks
Definition: World.h:880
Definition: CharacterDatabase.h:154
QueryResultFuture AsyncQuery(const char *sql)
Definition: DatabaseWorkerPool.cpp:149
Definition: PreparedStatement.h:74
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
void setUInt32(const uint8 index, const uint32 value)
Definition: PreparedStatement.cpp:115
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21

+ Here is the call graph for this function:

void World::UpdateSessions ( uint32  diff)
  • Add new sessions
  • Then send an update signal to remaining ones
  • and remove not active sessions from the list
2840 {
2841  std::pair<std::weak_ptr<WorldSocket>, uint64> linkInfo;
2842  while (_linkSocketQueue.next(linkInfo))
2843  ProcessLinkInstanceSocket(std::move(linkInfo));
2844 
2846  WorldSession* sess = NULL;
2847  while (addSessQueue.next(sess))
2848  AddSession_ (sess);
2849 
2851  for (SessionMap::iterator itr = m_sessions.begin(), next; itr != m_sessions.end(); itr = next)
2852  {
2853  next = itr;
2854  ++next;
2855 
2857  WorldSession* pSession = itr->second;
2858  WorldSessionFilter updater(pSession);
2859 
2860  if (!pSession->Update(diff, updater)) // As interval = 0
2861  {
2862  if (!RemoveQueuedPlayer(itr->second) && itr->second && getIntConfig(CONFIG_INTERVAL_DISCONNECT_TOLERANCE))
2863  m_disconnects[itr->second->GetAccountId()] = time(NULL);
2864  RemoveQueuedPlayer(pSession);
2865  m_sessions.erase(itr);
2866  delete pSession;
2867 
2868  }
2869  }
2870 }
void ProcessLinkInstanceSocket(std::pair< std::weak_ptr< WorldSocket >, uint64 > linkInfo)
Definition: World.cpp:310
SessionMap m_sessions
Definition: World.h:812
int next(int i, int n)
Definition: RecastContour.cpp:469
arena_t NULL
Definition: jemalloc_internal.h:624
Definition: WorldSession.h:865
LockedQueue< WorldSession * > addSessQueue
Definition: World.h:861
void AddSession_(WorldSession *s)
Definition: World.cpp:244
bool Update(uint32 diff, PacketFilter &updater)
Update the WorldSession (triggered by World update)
Definition: WorldSession.cpp:327
bool next(T &result)
Gets the next result in the queue, if any.
Definition: LockedQueue.h:69
uint64_t uint64
Definition: Define.h:149
bool RemoveQueuedPlayer(WorldSession *session)
Definition: World.cpp:376
DisconnectMap m_disconnects
Definition: World.h:814
LockedQueue< std::pair< std::weak_ptr< WorldSocket >, uint64 > > _linkSocketQueue
Definition: World.h:864
Player session in the World.
Definition: WorldSession.h:882
uint32 getIntConfig(WorldIntConfigs index) const
Get a server configuration element (see #WorldConfigs)
Definition: World.h:707

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Member Data Documentation

CharacterInfoContainer World::_characterInfoStore
private
LockedQueue<std::pair<std::weak_ptr<WorldSocket>, uint64> > World::_linkSocketQueue
private
std::vector<std::string> World::_motd
private
LockedQueue<WorldSession*> World::addSessQueue
private
LockedQueue<CliCommandHolder*> World::cliCmdQueue
private
AccountTypes World::m_allowedSecurityLevel
private
bool World::m_allowMovement
private
AutobroadcastsMap World::m_Autobroadcasts
private
AutobroadcastsWeightMap World::m_AutobroadcastsWeights
private
uint32 World::m_availableDbcLocaleMask
private
bool World::m_bool_configs[BOOL_CONFIG_VALUE_COUNT]
private
uint32 World::m_CleaningFlags
private
uint32 World::m_currentTime
private
std::string World::m_dataPath
private
std::string World::m_DBVersion
private
LocaleConstant World::m_defaultDbcLocale
private
DisconnectMap World::m_disconnects
private
TC_GAME_API uint8 World::m_ExitCode = SHUTDOWN_EXIT_CODE
staticprivate
float World::m_float_configs[FLOAT_CONFIG_VALUE_COUNT]
private
time_t World::m_gameTime
private
uint32 World::m_int_configs[INT_CONFIG_VALUE_COUNT]
private
bool World::m_isClosed
private
uint32 World::m_maxActiveSessionCount
private
uint32 World::m_MaxPlayerCount
private
uint32 World::m_maxQueuedSessionCount
private
TC_GAME_API float World::m_MaxVisibleDistanceInBGArenas = DEFAULT_VISIBILITY_BGARENAS
staticprivate
TC_GAME_API float World::m_MaxVisibleDistanceInInstances = DEFAULT_VISIBILITY_INSTANCE
staticprivate
TC_GAME_API float World::m_MaxVisibleDistanceOnContinents = DEFAULT_VISIBILITY_DISTANCE
staticprivate
std::string World::m_newCharString
private
time_t World::m_NextCurrencyReset
private
time_t World::m_NextDailyQuestReset
private
time_t World::m_NextGuildReset
private
time_t World::m_NextMonthlyQuestReset
private
time_t World::m_NextRandomBGReset
private
time_t World::m_NextWeeklyQuestReset
private
uint32 World::m_PlayerCount
private
uint32 World::m_playerLimit
private
Queue World::m_QueuedPlayer
private
std::deque<PreparedQueryResultFuture> World::m_realmCharCallbacks
private
SessionMap World::m_sessions
private
uint32 World::m_ShutdownMask
private
uint32 World::m_ShutdownTimer
private
time_t World::m_startTime
private
TC_GAME_API std::atomic< bool > World::m_stopEvent
staticprivate
IntervalTimer World::m_timers[WUPDATE_COUNT]
private
uint32 World::m_updateTime
private
uint32 World::m_updateTimeCount
private
uint32 World::m_updateTimeSum
private
TC_GAME_API int32 World::m_visibility_notify_periodInBGArenas = DEFAULT_VISIBILITY_NOTIFY_PERIOD
staticprivate
TC_GAME_API int32 World::m_visibility_notify_periodInInstances = DEFAULT_VISIBILITY_NOTIFY_PERIOD
staticprivate
TC_GAME_API int32 World::m_visibility_notify_periodOnContinents = DEFAULT_VISIBILITY_NOTIFY_PERIOD
staticprivate
TC_GAME_API std::atomic< uint32 > World::m_worldLoopCounter
static
WorldStatesMap World::m_worldstates
private
time_t World::mail_timer
private
time_t World::mail_timer_expires
private
float World::rate_values[MAX_RATES]
private

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