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<