mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-15 23:20:36 +01:00
Core/World: Refactor World::LoadConfigSettings to unify validation of all config options and reduce its impact on compile time
This commit is contained in:
@@ -154,8 +154,6 @@ enum PlayerSpells
|
||||
|
||||
static uint32 copseReclaimDelay[MAX_DEATH_COUNT] = { 30, 60, 120 };
|
||||
|
||||
uint64 const MAX_MONEY_AMOUNT = 99999999999ULL;
|
||||
|
||||
Player::Player(WorldSession* session) : Unit(true), m_sceneMgr(this)
|
||||
{
|
||||
m_objectType |= TYPEMASK_PLAYER;
|
||||
@@ -487,7 +485,7 @@ bool Player::Create(ObjectGuid::LowType guidlow, WorldPackets::Character::Charac
|
||||
|
||||
InitRunes();
|
||||
|
||||
SetUpdateFieldValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::Coinage), sWorld->getIntConfig(CONFIG_START_PLAYER_MONEY));
|
||||
SetUpdateFieldValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::Coinage), sWorld->GetUInt64Config(CONFIG_START_PLAYER_MONEY));
|
||||
|
||||
// Played time
|
||||
m_Last_tick = GameTime::GetGameTime();
|
||||
|
||||
@@ -957,7 +957,7 @@ enum PlayerDelayedOperations
|
||||
// Player summoning auto-decline time (in secs)
|
||||
#define MAX_PLAYER_SUMMON_DELAY (2*MINUTE)
|
||||
// Maximum money amount : 2^31 - 1
|
||||
TC_GAME_API extern uint64 const MAX_MONEY_AMOUNT;
|
||||
inline constexpr uint64 MAX_MONEY_AMOUNT = 99999999999ULL;
|
||||
|
||||
enum CharDeleteMethod
|
||||
{
|
||||
|
||||
@@ -128,8 +128,8 @@ Garrison* GarrisonMap::GetGarrison()
|
||||
void GarrisonMap::InitVisibilityDistance()
|
||||
{
|
||||
//init visibility distance for instances
|
||||
m_VisibleDistance = World::GetMaxVisibleDistanceInInstances();
|
||||
m_VisibilityNotifyPeriod = World::GetVisibilityNotifyPeriodInInstances();
|
||||
m_VisibleDistance = sWorld->getFloatConfig(CONFIG_MAX_VISIBILITY_DISTANCE_INSTANCE);
|
||||
m_VisibilityNotifyPeriod = sWorld->getIntConfig(CONFIG_VISIBILITY_NOTIFY_PERIOD_INSTANCE);
|
||||
}
|
||||
|
||||
bool GarrisonMap::AddPlayerToMap(Player* player, bool initPlayer /*= true*/)
|
||||
|
||||
@@ -110,7 +110,6 @@ void WorldSession::SendFeatureSystemStatusGlueScreen()
|
||||
features.BpayStoreAvailable = false;
|
||||
features.BpayStoreDisabledByParentalControls = false;
|
||||
features.CharUndeleteEnabled = sWorld->getBoolConfig(CONFIG_FEATURE_SYSTEM_CHARACTER_UNDELETE_ENABLED);
|
||||
features.BpayStoreEnabled = sWorld->getBoolConfig(CONFIG_FEATURE_SYSTEM_BPAY_STORE_ENABLED);
|
||||
features.MaxCharactersOnThisRealm = sWorld->getIntConfig(CONFIG_CHARACTERS_PER_REALM);
|
||||
features.MinimumExpansionLevel = EXPANSION_CLASSIC;
|
||||
features.MaximumExpansionLevel = sWorld->getIntConfig(CONFIG_EXPANSION);
|
||||
|
||||
@@ -1522,7 +1522,6 @@ void WorldSession::SendFeatureSystemStatus()
|
||||
features.EuropaTicketSystemStatus->SuggestionsEnabled = sWorld->getBoolConfig(CONFIG_SUPPORT_SUGGESTIONS_ENABLED);
|
||||
|
||||
features.CharUndeleteEnabled = sWorld->getBoolConfig(CONFIG_FEATURE_SYSTEM_CHARACTER_UNDELETE_ENABLED);
|
||||
features.BpayStoreEnabled = sWorld->getBoolConfig(CONFIG_FEATURE_SYSTEM_BPAY_STORE_ENABLED);
|
||||
features.IsChatMuted = !CanSpeak();
|
||||
|
||||
features.SpeakForMeAllowed = false;
|
||||
|
||||
@@ -171,8 +171,8 @@ i_scriptLock(false), _respawnTimes(std::make_unique<RespawnListContainer>()), _r
|
||||
void Map::InitVisibilityDistance()
|
||||
{
|
||||
//init visibility for continents
|
||||
m_VisibleDistance = World::GetMaxVisibleDistanceOnContinents();
|
||||
m_VisibilityNotifyPeriod = World::GetVisibilityNotifyPeriodOnContinents();
|
||||
m_VisibleDistance = sWorld->getFloatConfig(CONFIG_MAX_VISIBILITY_DISTANCE_CONTINENT);
|
||||
m_VisibilityNotifyPeriod = sWorld->getIntConfig(CONFIG_VISIBILITY_NOTIFY_PERIOD_CONTINENT);
|
||||
}
|
||||
|
||||
// Template specialization of utility methods
|
||||
@@ -2840,8 +2840,8 @@ InstanceMap::~InstanceMap()
|
||||
void InstanceMap::InitVisibilityDistance()
|
||||
{
|
||||
//init visibility distance for instances
|
||||
m_VisibleDistance = World::GetMaxVisibleDistanceInInstances();
|
||||
m_VisibilityNotifyPeriod = World::GetVisibilityNotifyPeriodInInstances();
|
||||
m_VisibleDistance = sWorld->getFloatConfig(CONFIG_MAX_VISIBILITY_DISTANCE_INSTANCE);
|
||||
m_VisibilityNotifyPeriod = sWorld->getIntConfig(CONFIG_VISIBILITY_NOTIFY_PERIOD_INSTANCE);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -3385,8 +3385,8 @@ BattlegroundMap::~BattlegroundMap()
|
||||
void BattlegroundMap::InitVisibilityDistance()
|
||||
{
|
||||
//init visibility distance for BG/Arenas
|
||||
m_VisibleDistance = IsBattleArena() ? World::GetMaxVisibleDistanceInArenas() : World::GetMaxVisibleDistanceInBG();
|
||||
m_VisibilityNotifyPeriod = IsBattleArena() ? World::GetVisibilityNotifyPeriodInArenas() : World::GetVisibilityNotifyPeriodInBG();
|
||||
m_VisibleDistance = sWorld->getFloatConfig(IsBattleArena() ? CONFIG_MAX_VISIBILITY_DISTANCE_ARENA : CONFIG_MAX_VISIBILITY_DISTANCE_BATTLEGROUND);
|
||||
m_VisibilityNotifyPeriod = sWorld->getIntConfig(IsBattleArena() ? CONFIG_VISIBILITY_NOTIFY_PERIOD_ARENA : CONFIG_VISIBILITY_NOTIFY_PERIOD_BATTLEGROUND);
|
||||
}
|
||||
|
||||
std::string const& BattlegroundMap::GetScriptName() const
|
||||
|
||||
@@ -211,7 +211,7 @@ namespace WorldPackets
|
||||
bool BpayStoreAvailable = false; // NYI
|
||||
bool BpayStoreDisabledByParentalControls = false; // NYI
|
||||
bool CharUndeleteEnabled = false;
|
||||
bool BpayStoreEnabled = false; // NYI
|
||||
bool BpayStoreEnabled = false;
|
||||
bool CommerceServerEnabled = false; // NYI
|
||||
bool VeteranTokenRedeemWillKick = false; // NYI
|
||||
bool WorldTokenRedeemWillKick = false; // NYI
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -173,7 +173,6 @@ enum WorldBoolConfigs
|
||||
CONFIG_IP_BASED_ACTION_LOGGING,
|
||||
CONFIG_CALCULATE_CREATURE_ZONE_AREA_DATA,
|
||||
CONFIG_CALCULATE_GAMEOBJECT_ZONE_AREA_DATA,
|
||||
CONFIG_FEATURE_SYSTEM_BPAY_STORE_ENABLED,
|
||||
CONFIG_FEATURE_SYSTEM_CHARACTER_UNDELETE_ENABLED,
|
||||
CONFIG_RESET_DUEL_COOLDOWNS,
|
||||
CONFIG_RESET_DUEL_HEALTH_MANA,
|
||||
@@ -225,6 +224,10 @@ enum WorldFloatConfigs
|
||||
CONFIG_CALL_TO_ARMS_5_PCT,
|
||||
CONFIG_CALL_TO_ARMS_10_PCT,
|
||||
CONFIG_CALL_TO_ARMS_20_PCT,
|
||||
CONFIG_MAX_VISIBILITY_DISTANCE_CONTINENT,
|
||||
CONFIG_MAX_VISIBILITY_DISTANCE_INSTANCE,
|
||||
CONFIG_MAX_VISIBILITY_DISTANCE_BATTLEGROUND,
|
||||
CONFIG_MAX_VISIBILITY_DISTANCE_ARENA,
|
||||
FLOAT_CONFIG_VALUE_COUNT
|
||||
};
|
||||
|
||||
@@ -262,11 +265,6 @@ enum WorldIntConfigs
|
||||
CONFIG_START_DEMON_HUNTER_PLAYER_LEVEL,
|
||||
CONFIG_START_EVOKER_PLAYER_LEVEL,
|
||||
CONFIG_START_ALLIED_RACE_LEVEL,
|
||||
CONFIG_START_PLAYER_MONEY,
|
||||
CONFIG_CURRENCY_START_APEXIS_CRYSTALS,
|
||||
CONFIG_CURRENCY_MAX_APEXIS_CRYSTALS,
|
||||
CONFIG_CURRENCY_START_JUSTICE_POINTS,
|
||||
CONFIG_CURRENCY_MAX_JUSTICE_POINTS,
|
||||
CONFIG_CURRENCY_RESET_HOUR,
|
||||
CONFIG_CURRENCY_RESET_DAY,
|
||||
CONFIG_CURRENCY_RESET_INTERVAL,
|
||||
@@ -334,7 +332,6 @@ enum WorldIntConfigs
|
||||
CONFIG_CORPSE_DECAY_TRIVIAL,
|
||||
CONFIG_CORPSE_DECAY_MINUSMOB,
|
||||
CONFIG_DEATH_SICKNESS_LEVEL,
|
||||
CONFIG_INSTANT_LOGOUT,
|
||||
CONFIG_DISABLE_BREATHING,
|
||||
CONFIG_BATTLEGROUND_INVITATION_TYPE,
|
||||
CONFIG_BATTLEGROUND_PREMATURE_FINISH_TIMER,
|
||||
@@ -353,7 +350,6 @@ enum WorldIntConfigs
|
||||
CONFIG_PVP_TOKEN_ID,
|
||||
CONFIG_PVP_TOKEN_COUNT,
|
||||
CONFIG_ENABLE_SINFO_LOGIN,
|
||||
CONFIG_PLAYER_ALLOW_COMMANDS,
|
||||
CONFIG_NUMTHREADS,
|
||||
CONFIG_LOGDB_CLEARINTERVAL,
|
||||
CONFIG_LOGDB_CLEARTIME,
|
||||
@@ -437,13 +433,18 @@ enum WorldIntConfigs
|
||||
CONFIG_BLACKMARKET_MAXAUCTIONS,
|
||||
CONFIG_BLACKMARKET_UPDATE_PERIOD,
|
||||
CONFIG_FACTION_BALANCE_LEVEL_CHECK_DIFF,
|
||||
CONFIG_VISIBILITY_NOTIFY_PERIOD_CONTINENT,
|
||||
CONFIG_VISIBILITY_NOTIFY_PERIOD_INSTANCE,
|
||||
CONFIG_VISIBILITY_NOTIFY_PERIOD_BATTLEGROUND,
|
||||
CONFIG_VISIBILITY_NOTIFY_PERIOD_ARENA,
|
||||
INT_CONFIG_VALUE_COUNT
|
||||
};
|
||||
|
||||
enum WorldInt64Configs
|
||||
{
|
||||
CONFIG_CHARACTER_CREATING_DISABLED_RACEMASK,
|
||||
INT64_CONFIT_VALUE_COUNT
|
||||
CONFIG_START_PLAYER_MONEY,
|
||||
INT64_CONFIG_VALUE_COUNT
|
||||
};
|
||||
|
||||
/// Server rates
|
||||
@@ -482,7 +483,6 @@ enum Rates
|
||||
RATE_XP_KILL,
|
||||
RATE_XP_BG_KILL,
|
||||
RATE_XP_QUEST,
|
||||
RATE_XP_GUILD_MODIFIER,
|
||||
RATE_XP_EXPLORE,
|
||||
RATE_REPAIRCOST,
|
||||
RATE_REPUTATION_GAIN,
|
||||
@@ -717,7 +717,7 @@ class TC_GAME_API World
|
||||
|
||||
uint64 GetUInt64Config(WorldInt64Configs index) const
|
||||
{
|
||||
return index < INT64_CONFIT_VALUE_COUNT ? m_int64_configs[index] : 0;
|
||||
return index < INT64_CONFIG_VALUE_COUNT ? m_int64_configs[index] : 0;
|
||||
}
|
||||
|
||||
static PersistentWorldVariable const NextCurrencyResetTimeVarId; // Next arena distribution time
|
||||
@@ -746,17 +746,6 @@ class TC_GAME_API World
|
||||
BanReturn BanCharacter(std::string const& name, std::string const& duration, std::string const& reason, std::string const& author);
|
||||
bool RemoveBanCharacter(std::string const& name);
|
||||
|
||||
// for max speed access
|
||||
static float GetMaxVisibleDistanceOnContinents() { return m_MaxVisibleDistanceOnContinents; }
|
||||
static float GetMaxVisibleDistanceInInstances() { return m_MaxVisibleDistanceInInstances; }
|
||||
static float GetMaxVisibleDistanceInBG() { return m_MaxVisibleDistanceInBG; }
|
||||
static float GetMaxVisibleDistanceInArenas() { return m_MaxVisibleDistanceInArenas; }
|
||||
|
||||
static int32 GetVisibilityNotifyPeriodOnContinents(){ return m_visibility_notify_periodOnContinents; }
|
||||
static int32 GetVisibilityNotifyPeriodInInstances() { return m_visibility_notify_periodInInstances; }
|
||||
static int32 GetVisibilityNotifyPeriodInBG() { return m_visibility_notify_periodInBG; }
|
||||
static int32 GetVisibilityNotifyPeriodInArenas() { return m_visibility_notify_periodInArenas; }
|
||||
|
||||
void ProcessCliCommands();
|
||||
void QueueCliCommand(CliCommandHolder* commandHolder) { cliCmdQueue.add(commandHolder); }
|
||||
|
||||
@@ -843,7 +832,7 @@ class TC_GAME_API World
|
||||
|
||||
float rate_values[MAX_RATES];
|
||||
uint32 m_int_configs[INT_CONFIG_VALUE_COUNT];
|
||||
uint64 m_int64_configs[INT64_CONFIT_VALUE_COUNT];
|
||||
uint64 m_int64_configs[INT64_CONFIG_VALUE_COUNT];
|
||||
bool m_bool_configs[BOOL_CONFIG_VALUE_COUNT];
|
||||
float m_float_configs[FLOAT_CONFIG_VALUE_COUNT];
|
||||
std::unordered_map<std::string, int32> m_worldVariables;
|
||||
@@ -855,17 +844,6 @@ class TC_GAME_API World
|
||||
std::vector<std::string> _motd;
|
||||
std::string m_dataPath;
|
||||
|
||||
// for max speed access
|
||||
static float m_MaxVisibleDistanceOnContinents;
|
||||
static float m_MaxVisibleDistanceInInstances;
|
||||
static float m_MaxVisibleDistanceInBG;
|
||||
static float m_MaxVisibleDistanceInArenas;
|
||||
|
||||
static int32 m_visibility_notify_periodOnContinents;
|
||||
static int32 m_visibility_notify_periodInInstances;
|
||||
static int32 m_visibility_notify_periodInBG;
|
||||
static int32 m_visibility_notify_periodInArenas;
|
||||
|
||||
// CLI command holder to be thread safe
|
||||
LockedQueue<CliCommandHolder*> cliCmdQueue;
|
||||
|
||||
|
||||
@@ -1367,9 +1367,9 @@ DBC.EnforceItemAttributes = 1
|
||||
#
|
||||
# AccountInstancesPerHour
|
||||
# Description: Controls the max amount of different instances player can enter within hour.
|
||||
# Default: 5
|
||||
# Default: 10
|
||||
|
||||
AccountInstancesPerHour = 5
|
||||
AccountInstancesPerHour = 10
|
||||
|
||||
#
|
||||
# Account.PasswordChangeSecurity
|
||||
@@ -1399,14 +1399,6 @@ BirthdayTime = 1222964635
|
||||
|
||||
CacheDataQueries = 1
|
||||
|
||||
#
|
||||
# FeatureSystem.BpayStore.Enabled
|
||||
# Description: Not yet implemented
|
||||
# Default: 0 - (Disabled)
|
||||
# 1 - (Enabled)
|
||||
|
||||
FeatureSystem.BpayStore.Enabled = 0
|
||||
|
||||
#
|
||||
# FeatureSystem.CharacterUndelete.Enabled
|
||||
# Description: Controls Feature in CharacterList to restore delete Characters.
|
||||
|
||||
Reference in New Issue
Block a user