[Sync] Project Sync plus Revision changes

The main revision system changes are based on FoeReapers work in:
b37de3b83e
This commit is contained in:
Antz 2016-03-24 17:58:53 +00:00 committed by Antz
parent f5e2d53ccc
commit bf4b6fafc5
39 changed files with 684 additions and 416 deletions

View file

@ -46,7 +46,7 @@ bool ChatHandler::HandleHelpCommand(char* args)
else
{
if (!ShowHelpForCommand(getCommandTable(), args))
SendSysMessage(LANG_NO_CMD);
{ SendSysMessage(LANG_NO_CMD); }
}
return true;
@ -62,7 +62,7 @@ bool ChatHandler::HandleAccountCommand(char* args)
{
// let show subcommands at unexpected data in args
if (*args)
return false;
{ return false; }
AccountTypes gmlevel = GetAccessLevel();
PSendSysMessage(LANG_ACCOUNT_LEVEL, uint32(gmlevel));
@ -108,15 +108,14 @@ bool ChatHandler::HandleServerInfoCommand(char* /*args*/)
{
char const* ver = sScriptMgr.GetScriptLibraryVersion();
if (ver && *ver)
PSendSysMessage(LANG_USING_SCRIPT_LIB, ver);
{ PSendSysMessage(LANG_USING_SCRIPT_LIB, ver); }
else
SendSysMessage(LANG_USING_SCRIPT_LIB_UNKNOWN);
{ SendSysMessage(LANG_USING_SCRIPT_LIB_UNKNOWN); }
}
else
SendSysMessage(LANG_USING_SCRIPT_LIB_NONE);
{ SendSysMessage(LANG_USING_SCRIPT_LIB_NONE); }
PSendSysMessage(LANG_USING_WORLD_DB, sWorld.GetDBVersion());
PSendSysMessage(LANG_USING_EVENT_AI, sWorld.GetCreatureEventAIVersion());
PSendSysMessage(LANG_CONNECTED_USERS, activeClientsNum, maxActiveClientsNum, queuedClientsNum, maxQueuedClientsNum);
PSendSysMessage(LANG_UPTIME, str.c_str());
@ -125,23 +124,25 @@ bool ChatHandler::HandleServerInfoCommand(char* /*args*/)
bool ChatHandler::HandleDismountCommand(char* /*args*/)
{
Player* player = m_session->GetPlayer();
// If player is not mounted, so go out :)
if (!m_session->GetPlayer()->IsMounted())
if (!player->IsMounted())
{
SendSysMessage(LANG_CHAR_NON_MOUNTED);
SetSentErrorMessage(true);
return false;
}
if (m_session->GetPlayer()->IsTaxiFlying())
if (player->IsTaxiFlying())
{
SendSysMessage(LANG_YOU_IN_FLIGHT);
SetSentErrorMessage(true);
return false;
}
m_session->GetPlayer()->Unmount();
m_session->GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_MOUNTED);
player->Unmount();
player->RemoveSpellsCausingAura(SPELL_AURA_MOUNTED);
return true;
}
@ -160,7 +161,7 @@ bool ChatHandler::HandleSaveCommand(char* /*args*/)
// save or plan save after 20 sec (logout delay) if current next save time more this value and _not_ output any messages to prevent cheat planning
uint32 save_interval = sWorld.getConfig(CONFIG_UINT32_INTERVAL_SAVE);
if (save_interval == 0 || (save_interval > 20 * IN_MILLISECONDS && player->GetSaveTimer() <= save_interval - 20 * IN_MILLISECONDS))
player->SaveToDB();
{ player->SaveToDB(); }
return true;
}
@ -176,8 +177,8 @@ bool ChatHandler::HandleGMListIngameCommand(char* /*args*/)
{
AccountTypes itr_sec = itr->second->GetSession()->GetSecurity();
if ((itr->second->isGameMaster() || (itr_sec > SEC_PLAYER && itr_sec <= (AccountTypes)sWorld.getConfig(CONFIG_UINT32_GM_LEVEL_IN_GM_LIST))) &&
(!m_session || itr->second->IsVisibleGloballyFor(m_session->GetPlayer())))
names.push_back(std::make_pair<std::string, bool>(GetNameLink(itr->second), itr->second->isAcceptWhispers()));
(!m_session || itr->second->IsVisibleGloballyFor(m_session->GetPlayer())))
{ names.push_back(std::make_pair<std::string, bool>(GetNameLink(itr->second), itr->second->isAcceptWhispers())); }
}
}
@ -188,10 +189,10 @@ bool ChatHandler::HandleGMListIngameCommand(char* /*args*/)
char const* accepts = GetMangosString(LANG_GM_ACCEPTS_WHISPER);
char const* not_accept = GetMangosString(LANG_GM_NO_WHISPER);
for (std::list<std::pair< std::string, bool> >::const_iterator iter = names.begin(); iter != names.end(); ++iter)
PSendSysMessage("%s - %s", iter->first.c_str(), iter->second ? accepts : not_accept);
{ PSendSysMessage("%s - %s", iter->first.c_str(), iter->second ? accepts : not_accept); }
}
else
SendSysMessage(LANG_GMS_NOT_LOGGED);
{ SendSysMessage(LANG_GMS_NOT_LOGGED); }
return true;
}
@ -212,7 +213,7 @@ bool ChatHandler::HandleAccountPasswordCommand(char* args)
char* new_pass_c = ExtractQuotedOrLiteralArg(&args);
if (!old_pass || !new_pass || !new_pass_c)
return false;
{ return false; }
std::string password_old = old_pass;
std::string password_new = new_pass;

View file

@ -230,7 +230,7 @@ std::string Warden::Penalty(WardenCheck* check /*= NULL*/)
banReason << "Warden Anticheat Violation";
// Check can be NULL, for example if the client sent a wrong signature in the warden packet (CHECKSUM FAIL)
if (check)
banReason << ": " << check->Comment << " (CheckId: " << check->CheckId << ")";
banReason << ": " << (check->Comment.empty() ? std::string("Undocumented Check") : check->Comment) << " (CheckId: " << check->CheckId << ")";
sWorld.BanAccount(BAN_ACCOUNT, accountName, sWorld.getConfig(CONFIG_UINT32_WARDEN_CLIENT_BAN_DURATION), banReason.str(), "Warden");

View file

@ -33,6 +33,9 @@
#include "WardenCheckMgr.h"
#include "Database/DatabaseEnv.h"
// the default client version with info in warden_checks; for other version checks, see warden_build_specific
#define DEFAULT_CLIENT_BUILD 5875
enum WardenOpcodes
{
// Client->Server

View file

@ -66,6 +66,7 @@ void WardenCheckMgr::LoadWardenChecks()
CheckStore.resize(maxCheckId + 1);
delete result;
// 0 1 2 3 4 5 6 7
result = WorldDatabase.Query("SELECT id, type, data, result, address, length, str, comment FROM warden_checks ORDER BY id ASC");
@ -147,7 +148,7 @@ void WardenCheckMgr::LoadWardenChecks()
}
if (comment.empty())
wardenCheck->Comment = "Undocumented Check";
wardenCheck->Comment = "";
else
wardenCheck->Comment = comment;
@ -155,6 +156,81 @@ void WardenCheckMgr::LoadWardenChecks()
} while (result->NextRow());
sLog.outWarden(">> Loaded %u warden checks.", count);
delete result;
// 0 1 2 3 4 5 6
result = WorldDatabase.Query("SELECT id, build, data, result, address, length, str FROM warden_build_specific ORDER BY id ASC");
if (!result)
{
sLog.outString("[Warden]: >> Loaded 0 warden client build-specific data.");
return;
}
count = 0;
do
{
fields = result->Fetch();
uint16 id = fields[0].GetUInt16();
if (id >= CheckStore.size())
{
sLog.outWarden("ERROR: Build-specific, check is missing in warden_checks, skipping id %u.", id);
continue;
}
uint16 build = fields[1].GetUInt16();
if (build == DEFAULT_CLIENT_BUILD)
{
sLog.outWarden("ERROR: Build-specific table may not contain checks for default %u build, skipping id %u.", DEFAULT_CLIENT_BUILD, id);
continue;
}
//std::string data = fields[2].GetString(); //unused for now
std::string checkResult = fields[3].GetString();
uint32 address = fields[4].GetUInt32();
uint8 length = fields[5].GetUInt8();
std::string str = fields[6].GetString();
WardenCheck* wardenCheck = new WardenCheck();
wardenCheck->CheckId = id;
wardenCheck->Type = CheckStore[id]->Type;
WardenCheckResult* wr = new WardenCheckResult();
switch (wardenCheck->Type)
{
case MEM_CHECK:
wardenCheck->Address = address;
wardenCheck->Length = length;
wardenCheck->Str = str;
wr->Result.SetHexStr(checkResult.c_str());
{
int len = checkResult.size() / 2;
if (wr->Result.GetNumBytes() < len)
{
uint8 *temp = new uint8[len];
memset(temp, 0, len);
memcpy(temp, wr->Result.AsByteArray(), wr->Result.GetNumBytes());
std::reverse(temp, temp + len);
wr->Result.SetBinary((uint8*)temp, len);
delete[] temp;
}
}
break;
default:
sLog.outWarden("The check type %u is considered as build-independent, skipping id %u.", wardenCheck->Type, id);
delete wr;
delete wardenCheck;
continue;
}
MCheckStore[ComposeMultiCheckKey(build, id)] = wardenCheck;
MCheckResultStore[ComposeMultiCheckKey(build, id)] = wr;
++count;
} while (result->NextRow());
sLog.outString(">> Loaded %u warden client build-specific check overrides.", count);
}
void WardenCheckMgr::LoadWardenOverrides()
@ -203,18 +279,34 @@ void WardenCheckMgr::LoadWardenOverrides()
sLog.outWarden(">> Loaded %u warden action overrides.", count);
}
WardenCheck* WardenCheckMgr::GetWardenDataById(uint16 Id)
WardenCheck* WardenCheckMgr::GetWardenDataById(uint16 build, uint16 Id)
{
if (Id < CheckStore.size())
{
if (build != DEFAULT_CLIENT_BUILD)
{
MultiCheckContainer::const_iterator it = MCheckStore.find(ComposeMultiCheckKey(build, Id));
if (it != MCheckStore.end())
return it->second;
}
return CheckStore[Id];
}
return NULL;
}
WardenCheckResult* WardenCheckMgr::GetWardenResultById(uint16 Id)
WardenCheckResult* WardenCheckMgr::GetWardenResultById(uint16 build, uint16 Id)
{
if (build != DEFAULT_CLIENT_BUILD)
{
MultiResultContainer::const_iterator it = MCheckResultStore.find(ComposeMultiCheckKey(build, Id));
if (it != MCheckResultStore.end())
return it->second;
}
CheckResultContainer::const_iterator itr = CheckResultStore.find(Id);
if (itr != CheckResultStore.end())
return itr->second;
return NULL;
}

View file

@ -66,12 +66,8 @@ class WardenCheckMgr
return &instance;
}
// We have a linear key without any gaps, so we use vector for fast access
typedef std::vector<WardenCheck*> CheckContainer;
typedef std::map<uint32, WardenCheckResult*> CheckResultContainer;
WardenCheck* GetWardenDataById(uint16 Id);
WardenCheckResult* GetWardenResultById(uint16 Id);
WardenCheck* GetWardenDataById(uint16 build, uint16 Id);
WardenCheckResult* GetWardenResultById(uint16 build, uint16 Id);
std::vector<uint16> MemChecksIdPool;
std::vector<uint16> OtherChecksIdPool;
@ -82,8 +78,21 @@ class WardenCheckMgr
ACE_RW_Mutex _checkStoreLock;
private:
uint32 inline ComposeMultiCheckKey(uint16 clientBuild, uint16 checkID) { return (uint32(checkID) << 16) | clientBuild; }
// We have a linear key without any gaps, so we use vector for fast access
typedef std::vector<WardenCheck*> CheckContainer;
typedef std::map<uint32, WardenCheckResult*> CheckResultContainer;
CheckContainer CheckStore;
CheckResultContainer CheckResultStore;
// here we have just few checks, vector is not appropriate; key is from ComposeMultiCheckKey
typedef std::map<uint32 /*MultiCheckKey*/, WardenCheck*> MultiCheckContainer;
typedef std::map<uint32 /*MultiCheckKey*/, WardenCheckResult*> MultiResultContainer;
MultiCheckContainer MCheckStore;
MultiResultContainer MCheckResultStore;
};
#define sWardenCheckMgr WardenCheckMgr::instance()

View file

@ -61,7 +61,7 @@ void WardenMac::Init(WorldSession* pClient, BigNumber* K)
_inputCrypto.Init(_inputKey);
_outputCrypto.Init(_outputKey);
sLog.outWarden("Server side warden for client %u initializing...", pClient->GetAccountId());
sLog.outWarden("Server side Mac warden for client %u (build %u) initializing...", pClient->GetAccountId(), _session->GetClientBuild());
sLog.outWarden("C->S Key: %s", ByteArrayToHexStr(_inputKey, 16).c_str());
sLog.outWarden("S->C Key: %s", ByteArrayToHexStr(_outputKey, 16).c_str());
sLog.outWarden(" Seed: %s", ByteArrayToHexStr(_seed, 16).c_str());

View file

@ -56,7 +56,7 @@ void WardenWin::Init(WorldSession* session, BigNumber* k)
_inputCrypto.Init(_inputKey);
_outputCrypto.Init(_outputKey);
sLog.outWarden("Server side warden for client %u initializing...", session->GetAccountId());
sLog.outWarden("Server side warden for client %u (build %u) initializing...", session->GetAccountId(), _session->GetClientBuild());
sLog.outWarden("C->S Key: %s", ByteArrayToHexStr(_inputKey, 16).c_str());
sLog.outWarden("S->C Key: %s", ByteArrayToHexStr(_outputKey, 16).c_str());
sLog.outWarden(" Seed: %s", ByteArrayToHexStr(_seed, 16).c_str());
@ -210,7 +210,7 @@ void WardenWin::RequestData()
// Add the id to the list sent in this cycle
_currentChecks.push_back(id);
wd = sWardenCheckMgr->GetWardenDataById(id);
wd = sWardenCheckMgr->GetWardenDataById(_session->GetClientBuild(), id);
switch (wd->Type)
{
@ -235,7 +235,7 @@ void WardenWin::RequestData()
for (std::list<uint16>::iterator itr = _currentChecks.begin(); itr != _currentChecks.end(); ++itr)
{
wd = sWardenCheckMgr->GetWardenDataById(*itr);
wd = sWardenCheckMgr->GetWardenDataById(_session->GetClientBuild(), *itr);
type = wd->Type;
buff << uint8(type ^ xorByte);
@ -360,8 +360,8 @@ void WardenWin::HandleData(ByteBuffer &buff)
for (std::list<uint16>::iterator itr = _currentChecks.begin(); itr != _currentChecks.end(); ++itr)
{
rd = sWardenCheckMgr->GetWardenDataById(*itr);
rs = sWardenCheckMgr->GetWardenResultById(*itr);
rd = sWardenCheckMgr->GetWardenDataById(_session->GetClientBuild(), *itr);
rs = sWardenCheckMgr->GetWardenResultById(_session->GetClientBuild(), *itr);
type = rd->Type;
switch (type)
@ -475,7 +475,7 @@ void WardenWin::HandleData(ByteBuffer &buff)
if (checkFailed > 0)
{
WardenCheck* check = sWardenCheckMgr->GetWardenDataById(checkFailed); //note it IS NOT NULL here
WardenCheck* check = sWardenCheckMgr->GetWardenDataById(_session->GetClientBuild(), checkFailed); //note it IS NOT NULL here
sLog.outWarden("%s failed Warden check %u. Action: %s", _session->GetPlayerName(), checkFailed, Penalty(check).c_str());
LogPositiveToDB(check);
}

View file

@ -71,7 +71,7 @@ struct WardenInitModuleRequest
#endif
class WorldSession;
class Warden;
//class Warden;
class WardenWin : public Warden
{

View file

@ -84,6 +84,9 @@
// Warden
#include "WardenCheckMgr.h"
#include <iostream>
#include <sstream>
INSTANTIATE_SINGLETON_1(World);
extern void LoadGameObjectModelList();
@ -122,16 +125,16 @@ World::World()
m_availableDbcLocaleMask = 0;
for (int i = 0; i < CONFIG_UINT32_VALUE_COUNT; ++i)
m_configUint32Values[i] = 0;
{ m_configUint32Values[i] = 0; }
for (int i = 0; i < CONFIG_INT32_VALUE_COUNT; ++i)
m_configInt32Values[i] = 0;
{ m_configInt32Values[i] = 0; }
for (int i = 0; i < CONFIG_FLOAT_VALUE_COUNT; ++i)
m_configFloatValues[i] = 0.0f;
{ m_configFloatValues[i] = 0.0f; }
for (int i = 0; i < CONFIG_BOOL_VALUE_COUNT; ++i)
m_configBoolValues[i] = false;
{ m_configBoolValues[i] = false; }
}
/// World destructor
@ -153,7 +156,7 @@ World::~World()
CliCommandHolder* command = NULL;
while (cliCmdQueue.next(command))
delete command;
{ delete command; }
VMAP::VMapFactory::clear();
MMAP::MMapFactory::clear();
@ -167,6 +170,9 @@ void World::CleanupsBeforeStop()
KickAll(); // save and kick all players
UpdateSessions(1); // real players unload required UpdateSessions call
sBattleGroundMgr.DeleteAllBattleGrounds(); // unload battleground templates before different singletons destroyed
#ifdef ENABLE_ELUNA
Eluna::Uninitialize();
#endif
}
/// Find a player in a specified zone
@ -196,9 +202,9 @@ WorldSession* World::FindSession(uint32 id) const
SessionMap::const_iterator itr = m_sessions.find(id);
if (itr != m_sessions.end())
return itr->second; // also can return NULL for kicked session
{ return itr->second; } // also can return NULL for kicked session
else
return NULL;
{ return NULL; }
}
/// Remove a given session
@ -210,7 +216,7 @@ bool World::RemoveSession(uint32 id)
if (itr != m_sessions.end() && itr->second)
{
if (itr->second->PlayerLoading())
return false;
{ return false; }
itr->second->KickPlayer();
}
@ -250,7 +256,7 @@ World::AddSession_(WorldSession* s)
{
// prevent decrease sessions count if session queued
if (RemoveQueuedSession(old->second))
decrease_session = false;
{ decrease_session = false; }
// not remove replaced session form queue if listed
delete old->second;
}
@ -265,7 +271,7 @@ World::AddSession_(WorldSession* s)
// so we don't count the user trying to
// login as a session and queue the socket that we are using
if (decrease_session)
--Sessions;
{ --Sessions; }
if (pLimit > 0 && Sessions >= pLimit && s->GetSecurity() == SEC_PLAYER)
{
@ -322,7 +328,7 @@ int32 World::GetQueuedSessionPos(WorldSession* sess)
for (Queue::const_iterator iter = m_QueuedSessions.begin(); iter != m_QueuedSessions.end(); ++iter, ++position)
if ((*iter) == sess)
return position;
{ return position; }
return 0;
}
@ -378,7 +384,7 @@ bool World::RemoveQueuedSession(WorldSession* sess)
// if session not queued then we need decrease sessions count
if (!found && sessions)
--sessions;
{ --sessions; }
// accept first in queue
if ((!m_playerLimit || (int32)sessions < m_playerLimit) && !m_QueuedSessions.empty())
@ -405,7 +411,7 @@ bool World::RemoveQueuedSession(WorldSession* sess)
// update position from iter to end()
// iter point to first not updated socket, position store new position
for (; iter != m_QueuedSessions.end(); ++iter, ++position)
(*iter)->SendAuthWaitQue(position);
{ (*iter)->SendAuthWaitQue(position); }
return found;
}
@ -580,22 +586,22 @@ void World::LoadConfigSettings(bool reload)
setConfigMin(CONFIG_UINT32_INTERVAL_GRIDCLEAN, "GridCleanUpDelay", 5 * MINUTE * IN_MILLISECONDS, MIN_GRID_DELAY);
if (reload)
sMapMgr.SetGridCleanUpDelay(getConfig(CONFIG_UINT32_INTERVAL_GRIDCLEAN));
{ sMapMgr.SetGridCleanUpDelay(getConfig(CONFIG_UINT32_INTERVAL_GRIDCLEAN)); }
setConfigMin(CONFIG_UINT32_INTERVAL_MAPUPDATE, "MapUpdateInterval", 100, MIN_MAP_UPDATE_DELAY);
if (reload)
sMapMgr.SetMapUpdateInterval(getConfig(CONFIG_UINT32_INTERVAL_MAPUPDATE));
{ sMapMgr.SetMapUpdateInterval(getConfig(CONFIG_UINT32_INTERVAL_MAPUPDATE)); }
setConfig(CONFIG_UINT32_INTERVAL_CHANGEWEATHER, "ChangeWeatherInterval", 10 * MINUTE * IN_MILLISECONDS);
if (configNoReload(reload, CONFIG_UINT32_PORT_WORLD, "WorldServerPort", DEFAULT_WORLDSERVER_PORT))
setConfig(CONFIG_UINT32_PORT_WORLD, "WorldServerPort", DEFAULT_WORLDSERVER_PORT);
{ setConfig(CONFIG_UINT32_PORT_WORLD, "WorldServerPort", DEFAULT_WORLDSERVER_PORT); }
if (configNoReload(reload, CONFIG_UINT32_GAME_TYPE, "GameType", 0))
setConfig(CONFIG_UINT32_GAME_TYPE, "GameType", 0);
{ setConfig(CONFIG_UINT32_GAME_TYPE, "GameType", 0); }
if (configNoReload(reload, CONFIG_UINT32_REALM_ZONE, "RealmZone", REALM_ZONE_DEVELOPMENT))
setConfig(CONFIG_UINT32_REALM_ZONE, "RealmZone", REALM_ZONE_DEVELOPMENT);
{ setConfig(CONFIG_UINT32_REALM_ZONE, "RealmZone", REALM_ZONE_DEVELOPMENT); }
setConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_ACCOUNTS, "AllowTwoSide.Accounts", true);
setConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_CHAT, "AllowTwoSide.Interaction.Chat", false);
@ -630,7 +636,7 @@ void World::LoadConfigSettings(bool reload)
setConfigMinMax(CONFIG_UINT32_SKIP_CINEMATICS, "SkipCinematics", 0, 0, 2);
if (configNoReload(reload, CONFIG_UINT32_MAX_PLAYER_LEVEL, "MaxPlayerLevel", DEFAULT_MAX_LEVEL))
setConfigMinMax(CONFIG_UINT32_MAX_PLAYER_LEVEL, "MaxPlayerLevel", DEFAULT_MAX_LEVEL, 1, DEFAULT_MAX_LEVEL);
{ setConfigMinMax(CONFIG_UINT32_MAX_PLAYER_LEVEL, "MaxPlayerLevel", DEFAULT_MAX_LEVEL, 1, DEFAULT_MAX_LEVEL); }
setConfigMinMax(CONFIG_UINT32_START_PLAYER_LEVEL, "StartPlayerLevel", 1, 1, getConfig(CONFIG_UINT32_MAX_PLAYER_LEVEL));
setConfigMinMax(CONFIG_UINT32_START_HEROIC_PLAYER_LEVEL, "StartHeroicPlayerLevel", 55, 1, getConfig(CONFIG_UINT32_MAX_PLAYER_LEVEL));
@ -904,9 +910,9 @@ void World::LoadConfigSettings(bool reload)
setConfig(CONFIG_UINT32_CHARDELETE_KEEP_DAYS, "CharDelete.KeepDays", 30);
if (configNoReload(reload, CONFIG_UINT32_GUID_RESERVE_SIZE_CREATURE, "GuidReserveSize.Creature", 100))
setConfig(CONFIG_UINT32_GUID_RESERVE_SIZE_CREATURE, "GuidReserveSize.Creature", 100);
{ setConfig(CONFIG_UINT32_GUID_RESERVE_SIZE_CREATURE, "GuidReserveSize.Creature", 100); }
if (configNoReload(reload, CONFIG_UINT32_GUID_RESERVE_SIZE_GAMEOBJECT, "GuidReserveSize.GameObject", 100))
setConfig(CONFIG_UINT32_GUID_RESERVE_SIZE_GAMEOBJECT, "GuidReserveSize.GameObject", 100);
{ setConfig(CONFIG_UINT32_GUID_RESERVE_SIZE_GAMEOBJECT, "GuidReserveSize.GameObject", 100); }
setConfig(CONFIG_UINT32_MIN_LEVEL_FOR_RAID, "Raid.MinLevel", 10);
@ -915,15 +921,15 @@ void World::LoadConfigSettings(bool reload)
// for empty string use current dir as for absent case
if (dataPath.empty())
dataPath = "./";
{ dataPath = "./"; }
// normalize dir path to path/ or path\ form
else if (dataPath.at(dataPath.length() - 1) != '/' && dataPath.at(dataPath.length() - 1) != '\\')
dataPath.append("/");
{ dataPath.append("/"); }
if (reload)
{
if (dataPath != m_dataPath)
sLog.outError("DataDir option can't be changed at mangosd.conf reload, using current value (%s).", m_dataPath.c_str());
{ sLog.outError("DataDir option can't be changed at mangosd.conf reload, using current value (%s).", m_dataPath.c_str()); }
}
else
{
@ -937,7 +943,7 @@ void World::LoadConfigSettings(bool reload)
std::string ignoreSpellIds = sConfig.GetStringDefault("vmap.ignoreSpellIds", "");
if (!enableHeight)
sLog.outError("VMAP height use disabled! Creatures movements and other things will be in broken state.");
{ sLog.outError("VMAP height use disabled! Creatures movements and other things will be in broken state."); }
VMAP::VMapFactory::createOrGetVMapManager()->setEnableLineOfSightCalc(enableLOS);
VMAP::VMapFactory::createOrGetVMapManager()->setEnableHeightCalc(enableHeight);
@ -950,6 +956,13 @@ void World::LoadConfigSettings(bool reload)
std::string ignoreMapIds = sConfig.GetStringDefault("mmap.ignoreMapIds", "");
MMAP::MMapFactory::preventPathfindingOnMaps(ignoreMapIds.c_str());
sLog.outString("WORLD: mmap pathfinding %sabled", getConfig(CONFIG_BOOL_MMAP_ENABLED) ? "en" : "dis");
setConfig(CONFIG_BOOL_ELUNA_ENABLED, "Eluna.Enabled", true);
#ifdef ENABLE_ELUNA
if (reload)
sEluna->OnConfigLoad(reload);
#endif /* ENABLE_ELUNA */
}
/// Initialize the World
@ -2012,7 +2025,7 @@ void World::ShutdownMsg(bool show /*= false*/, Player* player /*= NULL*/)
{
// not show messages for idle shutdown mode
if (m_ShutdownMask & SHUTDOWN_MASK_IDLE)
return;
{ return; }
///- Display a message every 12 hours, 1 hour, 5 minutes, 1 minute and 15 seconds
if (show ||
@ -2036,7 +2049,7 @@ void World::ShutdownCancel()
{
// nothing cancel or too later
if (!m_ShutdownTimer || m_stopEvent)
return;
{ return; }
ServerMessageType msgid = (m_ShutdownMask & SHUTDOWN_MASK_RESTART) ? SERVER_MSG_RESTART_CANCELLED : SERVER_MSG_SHUTDOWN_CANCELLED;
@ -2046,6 +2059,11 @@ void World::ShutdownCancel()
SendServerMessage(msgid);
DEBUG_LOG("Server %s cancelled.", (m_ShutdownMask & SHUTDOWN_MASK_RESTART ? "restart" : "shutdown"));
///- Used by Eluna
#ifdef ENABLE_ELUNA
sEluna->OnShutdownCancel();
#endif /* ENABLE_ELUNA */
}
void World::UpdateSessions(uint32 diff)
@ -2053,7 +2071,7 @@ void World::UpdateSessions(uint32 diff)
///- Add new sessions
WorldSession* sess;
while (addSessQueue.next(sess))
AddSession_(sess);
{ AddSession_(sess); }
///- Then send an update signal to remaining ones
for (SessionMap::iterator itr = m_sessions.begin(), next; itr != m_sessions.end(); itr = next)
@ -2088,7 +2106,7 @@ void World::ProcessCliCommands()
handler.ParseCommands(command->m_command);
if (command->m_commandFinished)
command->m_commandFinished(callbackArg, !handler.HasSentErrorMessage());
{ command->m_commandFinished(callbackArg, !handler.HasSentErrorMessage()); }
delete command;
}
@ -2400,24 +2418,27 @@ void World::UpdateMaxSessionCounters()
void World::LoadDBVersion()
{
QueryResult* result = WorldDatabase.Query("SELECT version, creature_ai_version, cache_id FROM db_version LIMIT 1");
QueryResult* result = WorldDatabase.Query("SELECT version, structure, content FROM db_version ORDER BY version DESC, structure DESC, content DESC LIMIT 1");
if (result)
{
Field* fields = result->Fetch();
m_DBVersion = fields[0].GetCppString();
m_CreatureEventAIVersion = fields[1].GetCppString();
uint32 version = fields[0].GetUInt32();
uint32 structure = fields[1].GetUInt32();
uint32 content = fields[2].GetUInt32();
// will be overwrite by config values if different and non-0
setConfig(CONFIG_UINT32_CLIENTCACHE_VERSION, fields[2].GetUInt32());
delete result;
std::stringstream ss;
ss << "Version: " << version << ", Structure: " << structure << ", Content: " << content;
m_DBVersion = ss.str();
}
if (m_DBVersion.empty())
m_DBVersion = "Unknown world database.";
if (m_CreatureEventAIVersion.empty())
m_CreatureEventAIVersion = "Unknown creature EventAI.";
{ m_DBVersion = "Unknown world database."; }
}
void World::setConfig(eConfigUInt64Values index, char const* fieldname, uint64 defvalue)
@ -2598,11 +2619,11 @@ void World::setConfigMinMax(eConfigFloatValues index, char const* fieldname, flo
bool World::configNoReload(bool reload, eConfigUInt32Values index, char const* fieldname, uint32 defvalue)
{
if (!reload)
return true;
{ return true; }
uint32 val = sConfig.GetIntDefault(fieldname, defvalue);
if (val != getConfig(index))
sLog.outError("%s option can't be changed at mangosd.conf reload, using current value (%u).", fieldname, getConfig(index));
{ sLog.outError("%s option can't be changed at mangosd.conf reload, using current value (%u).", fieldname, getConfig(index)); }
return false;
}
@ -2610,11 +2631,11 @@ bool World::configNoReload(bool reload, eConfigUInt32Values index, char const* f
bool World::configNoReload(bool reload, eConfigInt32Values index, char const* fieldname, int32 defvalue)
{
if (!reload)
return true;
{ return true; }
int32 val = sConfig.GetIntDefault(fieldname, defvalue);
if (val != getConfig(index))
sLog.outError("%s option can't be changed at mangosd.conf reload, using current value (%i).", fieldname, getConfig(index));
{ sLog.outError("%s option can't be changed at mangosd.conf reload, using current value (%i).", fieldname, getConfig(index)); }
return false;
}
@ -2622,11 +2643,11 @@ bool World::configNoReload(bool reload, eConfigInt32Values index, char const* fi
bool World::configNoReload(bool reload, eConfigFloatValues index, char const* fieldname, float defvalue)
{
if (!reload)
return true;
{ return true; }
float val = sConfig.GetFloatDefault(fieldname, defvalue);
if (val != getConfig(index))
sLog.outError("%s option can't be changed at mangosd.conf reload, using current value (%f).", fieldname, getConfig(index));
{ sLog.outError("%s option can't be changed at mangosd.conf reload, using current value (%f).", fieldname, getConfig(index)); }
return false;
}
@ -2634,11 +2655,11 @@ bool World::configNoReload(bool reload, eConfigFloatValues index, char const* fi
bool World::configNoReload(bool reload, eConfigBoolValues index, char const* fieldname, bool defvalue)
{
if (!reload)
return true;
{ return true; }
bool val = sConfig.GetBoolDefault(fieldname, defvalue);
if (val != getConfig(index))
sLog.outError("%s option can't be changed at mangosd.conf reload, using current value (%s).", fieldname, getConfig(index) ? "'true'" : "'false'");
{ sLog.outError("%s option can't be changed at mangosd.conf reload, using current value (%s).", fieldname, getConfig(index) ? "'true'" : "'false'"); }
return false;
}

View file

@ -39,6 +39,7 @@
#include <list>
class Object;
class ObjectGuid;
class WorldPacket;
class WorldSession;
class Player;
@ -379,6 +380,7 @@ enum eConfigBoolValues
CONFIG_BOOL_VMAP_INDOOR_CHECK,
CONFIG_BOOL_PET_UNSUMMON_AT_MOUNT,
CONFIG_BOOL_MMAP_ENABLED,
CONFIG_BOOL_ELUNA_ENABLED,
CONFIG_BOOL_PLAYER_COMMANDS,
CONFIG_BOOL_GUILD_LEVELING_ENABLED,
// Warden
@ -641,7 +643,6 @@ class World
// used World DB version
void LoadDBVersion();
char const* GetDBVersion() { return m_DBVersion.c_str(); }
char const* GetCreatureEventAIVersion() { return m_CreatureEventAIVersion.c_str(); }
void UpdatePhaseDefinitions();
@ -748,7 +749,6 @@ class World
// used versions
std::string m_DBVersion;
std::string m_CreatureEventAIVersion;
};
extern uint32 realmID;