diff --git a/data/items/items.xml b/data/items/items.xml index 5542b35d43f..407f909b6e8 100644 --- a/data/items/items.xml +++ b/data/items/items.xml @@ -59786,7 +59786,7 @@ - + @@ -59826,7 +59826,7 @@ - + @@ -59836,7 +59836,7 @@ - + diff --git a/src/config/config_definitions.hpp b/src/config/config_definitions.hpp index bf86266f3a9..dc7f1caac24 100644 --- a/src/config/config_definitions.hpp +++ b/src/config/config_definitions.hpp @@ -10,7 +10,7 @@ #pragma once // Enum -enum booleanConfig_t { +enum ConfigKey_t : uint16_t { ALLOW_CHANGEOUTFIT, ONE_PLAYER_ON_ACCOUNT, AIMBOT_HOTKEY_ENABLED, @@ -91,11 +91,6 @@ enum booleanConfig_t { TOGGLE_HOUSE_TRANSFER_ON_SERVER_RESTART, TOGGLE_RECEIVE_REWARD, TOGGLE_MAINTAIN_MODE, - - LAST_BOOLEAN_CONFIG -}; - -enum stringConfig_t { MAP_NAME, MAP_DOWNLOAD_URL, MAP_AUTHOR, @@ -128,11 +123,6 @@ enum stringConfig_t { TIBIADROME_CONCOCTION_TICK_TYPE, M_CONST, MAINTAIN_MODE_MESSAGE, - - LAST_STRING_CONFIG -}; - -enum integerConfig_t { SQL_PORT, MAX_PLAYERS, PZ_LOCKED, @@ -251,53 +241,38 @@ enum integerConfig_t { PARALLELISM, BOSS_DEFAULT_TIME_TO_FIGHT_AGAIN, BOSS_DEFAULT_TIME_TO_DEFEAT, - VIP_BONUS_EXP, VIP_BONUS_LOOT, VIP_BONUS_SKILL, VIP_FAMILIAR_TIME_COOLDOWN_REDUCTION, - REWARD_CHEST_MAX_COLLECT_ITEMS, DISCORD_WEBHOOK_DELAY_MS, - PVP_MAX_LEVEL_DIFFERENCE, - - LAST_INTEGER_CONFIG -}; - -enum floatingConfig_t { BESTIARY_RATE_CHARM_SHOP_PRICE, - RATE_HEALTH_REGEN, RATE_HEALTH_REGEN_SPEED, RATE_MANA_REGEN, RATE_MANA_REGEN_SPEED, RATE_SOUL_REGEN, RATE_SOUL_REGEN_SPEED, - RATE_SPELL_COOLDOWN, RATE_ATTACK_SPEED, RATE_OFFLINE_TRAINING_SPEED, RATE_EXERCISE_TRAINING_SPEED, - RATE_MONSTER_HEALTH, RATE_MONSTER_ATTACK, RATE_MONSTER_DEFENSE, RATE_BOSS_HEALTH, RATE_BOSS_ATTACK, RATE_BOSS_DEFENSE, - RATE_NPC_HEALTH, RATE_NPC_ATTACK, RATE_NPC_DEFENSE, LOYALTY_BONUS_PERCENTAGE_MULTIPLIER, PARTY_SHARE_LOOT_BOOSTS_DIMINISHING_FACTOR, - PVP_RATE_DAMAGE_TAKEN_PER_LEVEL, PVP_RATE_DAMAGE_REDUCTION_PER_LEVEL, - HOUSE_PRICE_RENT_MULTIPLIER, HOUSE_RENT_RATE, - - LAST_FLOATING_CONFIG + LOGLEVEL, }; diff --git a/src/config/configmanager.cpp b/src/config/configmanager.cpp index 5d52ca11b2a..11b1ec90a04 100644 --- a/src/config/configmanager.cpp +++ b/src/config/configmanager.cpp @@ -19,62 +19,6 @@ #define lua_strlen lua_rawlen #endif -namespace { - - std::string getGlobalString(lua_State* L, const char* identifier, const char* defaultValue) { - lua_getglobal(L, identifier); - if (!lua_isstring(L, -1)) { - return defaultValue; - } - - size_t len = lua_strlen(L, -1); - std::string ret(lua_tostring(L, -1), len); - lua_pop(L, 1); - return ret; - } - - int32_t getGlobalNumber(lua_State* L, const char* identifier, const int32_t defaultValue = 0) { - lua_getglobal(L, identifier); - if (!lua_isnumber(L, -1)) { - return defaultValue; - } - - int32_t val = lua_tonumber(L, -1); - lua_pop(L, 1); - return val; - } - - bool getGlobalBoolean(lua_State* L, const char* identifier, const bool defaultValue) { - lua_getglobal(L, identifier); - if (!lua_isboolean(L, -1)) { - if (!lua_isstring(L, -1)) { - return defaultValue; - } - - size_t len = lua_strlen(L, -1); - std::string ret(lua_tostring(L, -1), len); - lua_pop(L, 1); - return booleanString(ret); - } - - int val = lua_toboolean(L, -1); - lua_pop(L, 1); - return val != 0; - } - - float getGlobalFloat(lua_State* L, const char* identifier, const float defaultValue = 0.0) { - lua_getglobal(L, identifier); - if (!lua_isnumber(L, -1)) { - return defaultValue; - } - - float val = lua_tonumber(L, -1); - lua_pop(L, 1); - return val; - } - -} - bool ConfigManager::load() { lua_State* L = luaL_newstate(); if (!L) { @@ -90,318 +34,318 @@ bool ConfigManager::load() { } #ifndef DEBUG_LOG - g_logger().setLevel(getGlobalString(L, "logLevel", "info")); + g_logger().setLevel(loadStringConfig(L, LOGLEVEL, "logLevel", "info")); #endif // Parse config // Info that must be loaded one time (unless we reset the modules involved) if (!loaded) { - boolean[BIND_ONLY_GLOBAL_ADDRESS] = getGlobalBoolean(L, "bindOnlyGlobalAddress", false); - boolean[OPTIMIZE_DATABASE] = getGlobalBoolean(L, "startupDatabaseOptimization", true); - boolean[TOGGLE_MAP_CUSTOM] = getGlobalBoolean(L, "toggleMapCustom", true); - boolean[TOGGLE_MAINTAIN_MODE] = getGlobalBoolean(L, "toggleMaintainMode", false); - string[MAINTAIN_MODE_MESSAGE] = getGlobalString(L, "maintainModeMessage", ""); - - string[IP] = getGlobalString(L, "ip", "127.0.0.1"); - string[MAP_NAME] = getGlobalString(L, "mapName", "canary"); - string[MAP_DOWNLOAD_URL] = getGlobalString(L, "mapDownloadUrl", ""); - string[MAP_AUTHOR] = getGlobalString(L, "mapAuthor", "Eduardo Dantas"); - - string[MAP_CUSTOM_NAME] = getGlobalString(L, "mapCustomName", ""); - string[MAP_CUSTOM_AUTHOR] = getGlobalString(L, "mapCustomAuthor", "OTServBR"); - - string[HOUSE_RENT_PERIOD] = getGlobalString(L, "houseRentPeriod", "never"); - floating[HOUSE_PRICE_RENT_MULTIPLIER] = getGlobalFloat(L, "housePriceRentMultiplier", 1.0); - floating[HOUSE_RENT_RATE] = getGlobalFloat(L, "houseRentRate", 1.0); - string[MYSQL_HOST] = getGlobalString(L, "mysqlHost", "127.0.0.1"); - string[MYSQL_USER] = getGlobalString(L, "mysqlUser", "root"); - string[MYSQL_PASS] = getGlobalString(L, "mysqlPass", ""); - string[MYSQL_DB] = getGlobalString(L, "mysqlDatabase", "canary"); - string[MYSQL_SOCK] = getGlobalString(L, "mysqlSock", ""); - - string[AUTH_TYPE] = getGlobalString(L, "authType", "password"); - boolean[RESET_SESSIONS_ON_STARTUP] = getGlobalBoolean(L, "resetSessionsOnStartup", false); - - integer[SQL_PORT] = getGlobalNumber(L, "mysqlPort", 3306); - integer[GAME_PORT] = getGlobalNumber(L, "gameProtocolPort", 7172); - integer[LOGIN_PORT] = getGlobalNumber(L, "loginProtocolPort", 7171); - integer[STATUS_PORT] = getGlobalNumber(L, "statusProtocolPort", 7171); - - integer[MARKET_OFFER_DURATION] = getGlobalNumber(L, "marketOfferDuration", 30 * 24 * 60 * 60); - - integer[FREE_DEPOT_LIMIT] = getGlobalNumber(L, "freeDepotLimit", 2000); - integer[PREMIUM_DEPOT_LIMIT] = getGlobalNumber(L, "premiumDepotLimit", 8000); - integer[DEPOT_BOXES] = getGlobalNumber(L, "depotBoxes", 20); - integer[STASH_ITEMS] = getGlobalNumber(L, "stashItemCount", 5000); - - boolean[OLD_PROTOCOL] = getGlobalBoolean(L, "allowOldProtocol", true); + loadBoolConfig(L, BIND_ONLY_GLOBAL_ADDRESS, "bindOnlyGlobalAddress", false); + loadBoolConfig(L, OPTIMIZE_DATABASE, "startupDatabaseOptimization", true); + loadBoolConfig(L, TOGGLE_MAP_CUSTOM, "toggleMapCustom", true); + loadBoolConfig(L, TOGGLE_MAINTAIN_MODE, "toggleMaintainMode", false); + loadStringConfig(L, MAINTAIN_MODE_MESSAGE, "maintainModeMessage", ""); + + loadStringConfig(L, IP, "ip", "127.0.0.1"); + loadStringConfig(L, MAP_NAME, "mapName", "canary"); + loadStringConfig(L, MAP_DOWNLOAD_URL, "mapDownloadUrl", ""); + loadStringConfig(L, MAP_AUTHOR, "mapAuthor", "Eduardo Dantas"); + + loadStringConfig(L, MAP_CUSTOM_NAME, "mapCustomName", ""); + loadStringConfig(L, MAP_CUSTOM_AUTHOR, "mapCustomAuthor", "OTServBR"); + + loadStringConfig(L, HOUSE_RENT_PERIOD, "houseRentPeriod", "never"); + loadFloatConfig(L, HOUSE_PRICE_RENT_MULTIPLIER, "housePriceRentMultiplier", 1.0); + loadFloatConfig(L, HOUSE_RENT_RATE, "houseRentRate", 1.0); + loadStringConfig(L, MYSQL_HOST, "mysqlHost", "127.0.0.1"); + loadStringConfig(L, MYSQL_USER, "mysqlUser", "root"); + loadStringConfig(L, MYSQL_PASS, "mysqlPass", ""); + loadStringConfig(L, MYSQL_DB, "mysqlDatabase", "canary"); + loadStringConfig(L, MYSQL_SOCK, "mysqlSock", ""); + + loadStringConfig(L, AUTH_TYPE, "authType", "password"); + loadBoolConfig(L, RESET_SESSIONS_ON_STARTUP, "resetSessionsOnStartup", false); + + loadIntConfig(L, SQL_PORT, "mysqlPort", 3306); + loadIntConfig(L, GAME_PORT, "gameProtocolPort", 7172); + loadIntConfig(L, LOGIN_PORT, "loginProtocolPort", 7171); + loadIntConfig(L, STATUS_PORT, "statusProtocolPort", 7171); + + loadIntConfig(L, MARKET_OFFER_DURATION, "marketOfferDuration", 30 * 24 * 60 * 60); + + loadIntConfig(L, FREE_DEPOT_LIMIT, "freeDepotLimit", 2000); + loadIntConfig(L, PREMIUM_DEPOT_LIMIT, "premiumDepotLimit", 8000); + loadIntConfig(L, DEPOT_BOXES, "depotBoxes", 20); + loadIntConfig(L, STASH_ITEMS, "stashItemCount", 5000); + + loadBoolConfig(L, OLD_PROTOCOL, "allowOldProtocol", true); } - boolean[ALLOW_CHANGEOUTFIT] = getGlobalBoolean(L, "allowChangeOutfit", true); - boolean[ONE_PLAYER_ON_ACCOUNT] = getGlobalBoolean(L, "onePlayerOnlinePerAccount", true); - boolean[AIMBOT_HOTKEY_ENABLED] = getGlobalBoolean(L, "hotkeyAimbotEnabled", true); - boolean[REMOVE_RUNE_CHARGES] = getGlobalBoolean(L, "removeChargesFromRunes", true); - boolean[EXPERIENCE_FROM_PLAYERS] = getGlobalBoolean(L, "experienceByKillingPlayers", false); - boolean[FREE_PREMIUM] = getGlobalBoolean(L, "freePremium", false); - boolean[REPLACE_KICK_ON_LOGIN] = getGlobalBoolean(L, "replaceKickOnLogin", true); - boolean[MARKET_PREMIUM] = getGlobalBoolean(L, "premiumToCreateMarketOffer", true); - boolean[EMOTE_SPELLS] = getGlobalBoolean(L, "emoteSpells", false); - boolean[STAMINA_SYSTEM] = getGlobalBoolean(L, "staminaSystem", true); - boolean[WARN_UNSAFE_SCRIPTS] = getGlobalBoolean(L, "warnUnsafeScripts", true); - boolean[CONVERT_UNSAFE_SCRIPTS] = getGlobalBoolean(L, "convertUnsafeScripts", true); - boolean[CLASSIC_ATTACK_SPEED] = getGlobalBoolean(L, "classicAttackSpeed", false); - boolean[TOGGLE_ATTACK_SPEED_ONFIST] = getGlobalBoolean(L, "toggleAttackSpeedOnFist", false); - integer[MULTIPLIER_ATTACKONFIST] = getGlobalNumber(L, "multiplierSpeedOnFist", 5); - integer[MAX_SPEED_ATTACKONFIST] = getGlobalNumber(L, "maxSpeedOnFist", 500); - boolean[SCRIPTS_CONSOLE_LOGS] = getGlobalBoolean(L, "showScriptsLogInConsole", true); - boolean[STASH_MOVING] = getGlobalBoolean(L, "stashMoving", false); - boolean[ALLOW_BLOCK_SPAWN] = getGlobalBoolean(L, "allowBlockSpawn", true); - boolean[REMOVE_WEAPON_AMMO] = getGlobalBoolean(L, "removeWeaponAmmunition", true); - boolean[REMOVE_WEAPON_CHARGES] = getGlobalBoolean(L, "removeWeaponCharges", true); - boolean[REMOVE_POTION_CHARGES] = getGlobalBoolean(L, "removeChargesFromPotions", true); - boolean[GLOBAL_SERVER_SAVE_NOTIFY_MESSAGE] = getGlobalBoolean(L, "globalServerSaveNotifyMessage", true); - boolean[GLOBAL_SERVER_SAVE_CLEAN_MAP] = getGlobalBoolean(L, "globalServerSaveCleanMap", false); - boolean[GLOBAL_SERVER_SAVE_CLOSE] = getGlobalBoolean(L, "globalServerSaveClose", false); - boolean[FORCE_MONSTERTYPE_LOAD] = getGlobalBoolean(L, "forceMonsterTypesOnLoad", true); - boolean[HOUSE_OWNED_BY_ACCOUNT] = getGlobalBoolean(L, "houseOwnedByAccount", false); - boolean[CLEAN_PROTECTION_ZONES] = getGlobalBoolean(L, "cleanProtectionZones", false); - boolean[GLOBAL_SERVER_SAVE_SHUTDOWN] = getGlobalBoolean(L, "globalServerSaveShutdown", true); - boolean[PUSH_WHEN_ATTACKING] = getGlobalBoolean(L, "pushWhenAttacking", false); - - boolean[WEATHER_RAIN] = getGlobalBoolean(L, "weatherRain", false); - boolean[WEATHER_THUNDER] = getGlobalBoolean(L, "thunderEffect", false); - boolean[ALL_CONSOLE_LOG] = getGlobalBoolean(L, "allConsoleLog", false); - boolean[TOGGLE_FREE_QUEST] = getGlobalBoolean(L, "toggleFreeQuest", true); - boolean[AUTOLOOT] = getGlobalBoolean(L, "autoLoot", false); - boolean[AUTOBANK] = getGlobalBoolean(L, "autoBank", false); - boolean[STAMINA_TRAINER] = getGlobalBoolean(L, "staminaTrainer", false); - boolean[STAMINA_PZ] = getGlobalBoolean(L, "staminaPz", false); - boolean[SORT_LOOT_BY_CHANCE] = getGlobalBoolean(L, "sortLootByChance", false); - boolean[TOGGLE_SAVE_INTERVAL] = getGlobalBoolean(L, "toggleSaveInterval", false); - boolean[TOGGLE_SAVE_INTERVAL_CLEAN_MAP] = getGlobalBoolean(L, "toggleSaveIntervalCleanMap", false); - boolean[TELEPORT_SUMMONS] = getGlobalBoolean(L, "teleportSummons", false); - boolean[ALLOW_RELOAD] = getGlobalBoolean(L, "allowReload", false); - - boolean[ONLY_PREMIUM_ACCOUNT] = getGlobalBoolean(L, "onlyPremiumAccount", false); - boolean[RATE_USE_STAGES] = getGlobalBoolean(L, "rateUseStages", false); - boolean[TOGGLE_IMBUEMENT_SHRINE_STORAGE] = getGlobalBoolean(L, "toggleImbuementShrineStorage", true); - boolean[TOGGLE_IMBUEMENT_NON_AGGRESSIVE_FIGHT_ONLY] = getGlobalBoolean(L, "toggleImbuementNonAggressiveFightOnly", false); - - boolean[TOGGLE_DOWNLOAD_MAP] = getGlobalBoolean(L, "toggleDownloadMap", false); - boolean[USE_ANY_DATAPACK_FOLDER] = getGlobalBoolean(L, "useAnyDatapackFolder", false); - boolean[INVENTORY_GLOW] = getGlobalBoolean(L, "inventoryGlowOnFiveBless", false); - boolean[XP_DISPLAY_MODE] = getGlobalBoolean(L, "experienceDisplayRates", true); - - string[DEFAULT_PRIORITY] = getGlobalString(L, "defaultPriority", "high"); - string[SERVER_NAME] = getGlobalString(L, "serverName", ""); - string[SERVER_MOTD] = getGlobalString(L, "serverMotd", ""); - string[OWNER_NAME] = getGlobalString(L, "ownerName", ""); - string[OWNER_EMAIL] = getGlobalString(L, "ownerEmail", ""); - string[URL] = getGlobalString(L, "url", ""); - string[LOCATION] = getGlobalString(L, "location", ""); - string[WORLD_TYPE] = getGlobalString(L, "worldType", "pvp"); - string[STORE_IMAGES_URL] = getGlobalString(L, "coinImagesURL", ""); - string[DISCORD_WEBHOOK_URL] = getGlobalString(L, "discordWebhookURL", ""); - string[SAVE_INTERVAL_TYPE] = getGlobalString(L, "saveIntervalType", ""); - string[GLOBAL_SERVER_SAVE_TIME] = getGlobalString(L, "globalServerSaveTime", "06:00"); - string[DATA_DIRECTORY] = getGlobalString(L, "dataPackDirectory", "data-otservbr-global"); - string[CORE_DIRECTORY] = getGlobalString(L, "coreDirectory", "data"); - - string[FORGE_FIENDISH_INTERVAL_TYPE] = getGlobalString(L, "forgeFiendishIntervalType", "hour"); - string[FORGE_FIENDISH_INTERVAL_TIME] = getGlobalString(L, "forgeFiendishIntervalTime", "1"); - - integer[MAX_PLAYERS] = getGlobalNumber(L, "maxPlayers"); - integer[PZ_LOCKED] = getGlobalNumber(L, "pzLocked", 60000); - integer[DEFAULT_DESPAWNRANGE] = getGlobalNumber(L, "deSpawnRange", 2); - integer[DEFAULT_DESPAWNRADIUS] = getGlobalNumber(L, "deSpawnRadius", 50); - integer[RATE_EXPERIENCE] = getGlobalNumber(L, "rateExp", 1); - integer[RATE_SKILL] = getGlobalNumber(L, "rateSkill", 1); - integer[RATE_LOOT] = getGlobalNumber(L, "rateLoot", 1); - integer[RATE_MAGIC] = getGlobalNumber(L, "rateMagic", 1); - integer[RATE_SPAWN] = getGlobalNumber(L, "rateSpawn", 1); - integer[RATE_KILLING_IN_THE_NAME_OF_POINTS] = getGlobalNumber(L, "rateKillingInTheNameOfPoints", 1); - - integer[HOUSE_PRICE_PER_SQM] = getGlobalNumber(L, "housePriceEachSQM", 1000); - integer[HOUSE_BUY_LEVEL] = getGlobalNumber(L, "houseBuyLevel", 0); - integer[HOUSE_LOSE_AFTER_INACTIVITY] = getGlobalNumber(L, "houseLoseAfterInactivity", 0); - boolean[HOUSE_PURSHASED_SHOW_PRICE] = getGlobalBoolean(L, "housePurchasedShowPrice", false); - boolean[ONLY_INVITED_CAN_MOVE_HOUSE_ITEMS] = getGlobalBoolean(L, "onlyInvitedCanMoveHouseItems", true); - - integer[ACTIONS_DELAY_INTERVAL] = getGlobalNumber(L, "timeBetweenActions", 200); - integer[EX_ACTIONS_DELAY_INTERVAL] = getGlobalNumber(L, "timeBetweenExActions", 1000); - integer[MAX_MESSAGEBUFFER] = getGlobalNumber(L, "maxMessageBuffer", 4); - integer[KICK_AFTER_MINUTES] = getGlobalNumber(L, "kickIdlePlayerAfterMinutes", 15); - integer[PROTECTION_LEVEL] = getGlobalNumber(L, "protectionLevel", 1); - integer[DEATH_LOSE_PERCENT] = getGlobalNumber(L, "deathLosePercent", -1); - integer[STATUSQUERY_TIMEOUT] = getGlobalNumber(L, "statusTimeout", 5000); - integer[FRAG_TIME] = getGlobalNumber(L, "timeToDecreaseFrags", 24 * 60 * 60 * 1000); - integer[WHITE_SKULL_TIME] = getGlobalNumber(L, "whiteSkullTime", 15 * 60 * 1000); - integer[STAIRHOP_DELAY] = getGlobalNumber(L, "stairJumpExhaustion", 2000); - integer[MAX_CONTAINER] = getGlobalNumber(L, "maxContainer", 500); - integer[MAX_CONTAINER_ITEM] = getGlobalNumber(L, "maxItem", 5000); - integer[EXP_FROM_PLAYERS_LEVEL_RANGE] = getGlobalNumber(L, "expFromPlayersLevelRange", 75); - integer[CHECK_EXPIRED_MARKET_OFFERS_EACH_MINUTES] = getGlobalNumber(L, "checkExpiredMarketOffersEachMinutes", 60); - integer[MAX_MARKET_OFFERS_AT_A_TIME_PER_PLAYER] = getGlobalNumber(L, "maxMarketOffersAtATimePerPlayer", 100); - integer[MAX_PACKETS_PER_SECOND] = getGlobalNumber(L, "maxPacketsPerSecond", 25); - integer[COMPRESSION_LEVEL] = getGlobalNumber(L, "packetCompressionLevel", 6); - integer[STORE_COIN_PACKET] = getGlobalNumber(L, "coinPacketSize", 25); - integer[DAY_KILLS_TO_RED] = getGlobalNumber(L, "dayKillsToRedSkull", 3); - integer[WEEK_KILLS_TO_RED] = getGlobalNumber(L, "weekKillsToRedSkull", 5); - integer[MONTH_KILLS_TO_RED] = getGlobalNumber(L, "monthKillsToRedSkull", 10); - integer[RED_SKULL_DURATION] = getGlobalNumber(L, "redSkullDuration", 30); - integer[BLACK_SKULL_DURATION] = getGlobalNumber(L, "blackSkullDuration", 45); - integer[ORANGE_SKULL_DURATION] = getGlobalNumber(L, "orangeSkullDuration", 7); - integer[GLOBAL_SERVER_SAVE_NOTIFY_DURATION] = getGlobalNumber(L, "globalServerSaveNotifyDuration", 5); - - integer[PARTY_LIST_MAX_DISTANCE] = getGlobalNumber(L, "partyListMaxDistance", 0); - - integer[PUSH_DELAY] = getGlobalNumber(L, "pushDelay", 1000); - integer[PUSH_DISTANCE_DELAY] = getGlobalNumber(L, "pushDistanceDelay", 1500); - - integer[STAMINA_ORANGE_DELAY] = getGlobalNumber(L, "staminaOrangeDelay", 1); - integer[STAMINA_GREEN_DELAY] = getGlobalNumber(L, "staminaGreenDelay", 5); - integer[STAMINA_PZ_GAIN] = getGlobalNumber(L, "staminaPzGain", 1); - integer[STAMINA_TRAINER_DELAY] = getGlobalNumber(L, "staminaTrainerDelay", 5); - integer[STAMINA_TRAINER_GAIN] = getGlobalNumber(L, "staminaTrainerGain", 1); - integer[SAVE_INTERVAL_TIME] = getGlobalNumber(L, "saveIntervalTime", 1); - integer[MAX_ALLOWED_ON_A_DUMMY] = getGlobalNumber(L, "maxAllowedOnADummy", 1); - integer[FREE_QUEST_STAGE] = getGlobalNumber(L, "freeQuestStage", 1); - integer[DEPOTCHEST] = getGlobalNumber(L, "depotChest", 4); - integer[CRITICALCHANCE] = getGlobalNumber(L, "criticalChance", 10); - - integer[ADVENTURERSBLESSING_LEVEL] = getGlobalNumber(L, "adventurersBlessingLevel", 21); - integer[FORGE_MAX_ITEM_TIER] = getGlobalNumber(L, "forgeMaxItemTier", 10); - integer[FORGE_COST_ONE_SLIVER] = getGlobalNumber(L, "forgeCostOneSliver", 20); - integer[FORGE_SLIVER_AMOUNT] = getGlobalNumber(L, "forgeSliverAmount", 3); - integer[FORGE_CORE_COST] = getGlobalNumber(L, "forgeCoreCost", 50); - integer[FORGE_MAX_DUST] = getGlobalNumber(L, "forgeMaxDust", 225); - integer[FORGE_FUSION_DUST_COST] = getGlobalNumber(L, "forgeFusionCost", 100); - integer[FORGE_TRANSFER_DUST_COST] = getGlobalNumber(L, "forgeTransferCost", 100); - integer[FORGE_BASE_SUCCESS_RATE] = getGlobalNumber(L, "forgeBaseSuccessRate", 50); - integer[FORGE_BONUS_SUCCESS_RATE] = getGlobalNumber(L, "forgeBonusSuccessRate", 15); - integer[FORGE_TIER_LOSS_REDUCTION] = getGlobalNumber(L, "forgeTierLossReduction", 50); - integer[FORGE_AMOUNT_MULTIPLIER] = getGlobalNumber(L, "forgeAmountMultiplier", 3); - integer[FORGE_MIN_SLIVERS] = getGlobalNumber(L, "forgeMinSlivers", 3); - integer[FORGE_MAX_SLIVERS] = getGlobalNumber(L, "forgeMaxSlivers", 7); - integer[FORGE_INFLUENCED_CREATURES_LIMIT] = getGlobalNumber(L, "forgeInfluencedLimit", 300); - integer[FORGE_FIENDISH_CREATURES_LIMIT] = getGlobalNumber(L, "forgeFiendishLimit", 3); - integer[DISCORD_WEBHOOK_DELAY_MS] = getGlobalNumber(L, "discordWebhookDelayMs", Webhook::DEFAULT_DELAY_MS); - - floating[BESTIARY_RATE_CHARM_SHOP_PRICE] = getGlobalFloat(L, "bestiaryRateCharmShopPrice", 1.0); - floating[RATE_HEALTH_REGEN] = getGlobalFloat(L, "rateHealthRegen", 1.0); - floating[RATE_HEALTH_REGEN_SPEED] = getGlobalFloat(L, "rateHealthRegenSpeed", 1.0); - floating[RATE_MANA_REGEN] = getGlobalFloat(L, "rateManaRegen", 1.0); - floating[RATE_MANA_REGEN_SPEED] = getGlobalFloat(L, "rateManaRegenSpeed", 1.0); - floating[RATE_SOUL_REGEN] = getGlobalFloat(L, "rateSoulRegen", 1.0); - floating[RATE_SOUL_REGEN_SPEED] = getGlobalFloat(L, "rateSoulRegenSpeed", 1.0); - floating[RATE_SPELL_COOLDOWN] = getGlobalFloat(L, "rateSpellCooldown", 1.0); - floating[RATE_ATTACK_SPEED] = getGlobalFloat(L, "rateAttackSpeed", 1.0); - floating[RATE_OFFLINE_TRAINING_SPEED] = getGlobalFloat(L, "rateOfflineTrainingSpeed", 1.0); - floating[RATE_EXERCISE_TRAINING_SPEED] = getGlobalFloat(L, "rateExerciseTrainingSpeed", 1.0); - - floating[RATE_MONSTER_HEALTH] = getGlobalFloat(L, "rateMonsterHealth", 1.0); - floating[RATE_MONSTER_ATTACK] = getGlobalFloat(L, "rateMonsterAttack", 1.0); - floating[RATE_MONSTER_DEFENSE] = getGlobalFloat(L, "rateMonsterDefense", 1.0); - floating[RATE_BOSS_HEALTH] = getGlobalFloat(L, "rateBossHealth", 1.0); - floating[RATE_BOSS_ATTACK] = getGlobalFloat(L, "rateBossAttack", 1.0); - floating[RATE_BOSS_DEFENSE] = getGlobalFloat(L, "rateBossDefense", 1.0); - integer[BOSS_DEFAULT_TIME_TO_FIGHT_AGAIN] = getGlobalNumber(L, "bossDefaultTimeToFightAgain", 20 * 60 * 60); - integer[BOSS_DEFAULT_TIME_TO_DEFEAT] = getGlobalNumber(L, "bossDefaultTimeToDefeat", 20 * 60); - - floating[RATE_NPC_HEALTH] = getGlobalFloat(L, "rateNpcHealth", 1.0); - floating[RATE_NPC_ATTACK] = getGlobalFloat(L, "rateNpcAttack", 1.0); - floating[RATE_NPC_DEFENSE] = getGlobalFloat(L, "rateNpcDefense", 1.0); - - boolean[PREY_ENABLED] = getGlobalBoolean(L, "preySystemEnabled", true); - boolean[PREY_FREE_THIRD_SLOT] = getGlobalBoolean(L, "preyFreeThirdSlot", false); - integer[PREY_REROLL_PRICE_LEVEL] = getGlobalNumber(L, "preyRerollPricePerLevel", 200); - integer[PREY_SELECTION_LIST_PRICE] = getGlobalNumber(L, "preySelectListPrice", 5); - integer[PREY_BONUS_TIME] = getGlobalNumber(L, "preyBonusTime", 7200); - integer[PREY_BONUS_REROLL_PRICE] = getGlobalNumber(L, "preyBonusRerollPrice", 1); - integer[PREY_FREE_REROLL_TIME] = getGlobalNumber(L, "preyFreeRerollTime", 72000); - - boolean[TASK_HUNTING_ENABLED] = getGlobalBoolean(L, "taskHuntingSystemEnabled", true); - boolean[TASK_HUNTING_FREE_THIRD_SLOT] = getGlobalBoolean(L, "taskHuntingFreeThirdSlot", false); - integer[TASK_HUNTING_LIMIT_EXHAUST] = getGlobalNumber(L, "taskHuntingLimitedTasksExhaust", 72000); - integer[TASK_HUNTING_REROLL_PRICE_LEVEL] = getGlobalNumber(L, "taskHuntingRerollPricePerLevel", 200); - integer[TASK_HUNTING_SELECTION_LIST_PRICE] = getGlobalNumber(L, "taskHuntingSelectListPrice", 5); - integer[TASK_HUNTING_BONUS_REROLL_PRICE] = getGlobalNumber(L, "taskHuntingBonusRerollPrice", 1); - integer[TASK_HUNTING_FREE_REROLL_TIME] = getGlobalNumber(L, "taskHuntingFreeRerollTime", 72000); - - integer[BESTIARY_KILL_MULTIPLIER] = getGlobalNumber(L, "bestiaryKillMultiplier", 1); - integer[BOSSTIARY_KILL_MULTIPLIER] = getGlobalNumber(L, "bosstiaryKillMultiplier", 1); - boolean[BOOSTED_BOSS_SLOT] = getGlobalBoolean(L, "boostedBossSlot", true); - integer[BOOSTED_BOSS_LOOT_BONUS] = getGlobalNumber(L, "boostedBossLootBonus", 250); - integer[BOOSTED_BOSS_KILL_BONUS] = getGlobalNumber(L, "boostedBossKillBonus", 3); - - integer[FAMILIAR_TIME] = getGlobalNumber(L, "familiarTime", 30); - - boolean[TOGGLE_GOLD_POUCH_ALLOW_ANYTHING] = getGlobalBoolean(L, "toggleGoldPouchAllowAnything", false); - boolean[TOGGLE_GOLD_POUCH_QUICKLOOT_ONLY] = getGlobalBoolean(L, "toggleGoldPouchQuickLootOnly", false); - boolean[TOGGLE_SERVER_IS_RETRO] = getGlobalBoolean(L, "toggleServerIsRetroPVP", false); - boolean[TOGGLE_TRAVELS_FREE] = getGlobalBoolean(L, "toggleTravelsFree", false); - integer[BUY_AOL_COMMAND_FEE] = getGlobalNumber(L, "buyAolCommandFee", 0); - integer[BUY_BLESS_COMMAND_FEE] = getGlobalNumber(L, "buyBlessCommandFee", 0); - boolean[TELEPORT_PLAYER_TO_VOCATION_ROOM] = getGlobalBoolean(L, "teleportPlayerToVocationRoom", true); - - boolean[TOGGLE_HAZARDSYSTEM] = getGlobalBoolean(L, "toogleHazardSystem", true); - integer[HAZARD_CRITICAL_INTERVAL] = getGlobalNumber(L, "hazardCriticalInterval", 2000); - integer[HAZARD_CRITICAL_CHANCE] = getGlobalNumber(L, "hazardCriticalChance", 750); - integer[HAZARD_CRITICAL_MULTIPLIER] = getGlobalNumber(L, "hazardCriticalMultiplier", 25); - integer[HAZARD_DAMAGE_MULTIPLIER] = getGlobalNumber(L, "hazardDamageMultiplier", 200); - integer[HAZARD_DODGE_MULTIPLIER] = getGlobalNumber(L, "hazardDodgeMultiplier", 85); - integer[HAZARD_PODS_DROP_MULTIPLIER] = getGlobalNumber(L, "hazardPodsDropMultiplier", 87); - integer[HAZARD_PODS_TIME_TO_DAMAGE] = getGlobalNumber(L, "hazardPodsTimeToDamage", 2000); - integer[HAZARD_PODS_TIME_TO_SPAWN] = getGlobalNumber(L, "hazardPodsTimeToSpawn", 4000); - integer[HAZARD_EXP_BONUS_MULTIPLIER] = getGlobalNumber(L, "hazardExpBonusMultiplier", 2); - integer[HAZARD_LOOT_BONUS_MULTIPLIER] = getGlobalNumber(L, "hazardLootBonusMultiplier", 2); - integer[HAZARD_PODS_DAMAGE] = getGlobalNumber(L, "hazardPodsDamage", 5); - integer[HAZARD_SPAWN_PLUNDER_MULTIPLIER] = getGlobalNumber(L, "hazardSpawnPlunderMultiplier", 25); - integer[LOW_LEVEL_BONUS_EXP] = getGlobalNumber(L, "lowLevelBonusExp", 50); - - boolean[LOYALTY_ENABLED] = getGlobalBoolean(L, "loyaltyEnabled", true); - integer[LOYALTY_POINTS_PER_CREATION_DAY] = getGlobalNumber(L, "loyaltyPointsPerCreationDay", 1); - integer[LOYALTY_POINTS_PER_PREMIUM_DAY_SPENT] = getGlobalNumber(L, "loyaltyPointsPerPremiumDaySpent", 0); - integer[LOYALTY_POINTS_PER_PREMIUM_DAY_PURCHASED] = getGlobalNumber(L, "loyaltyPointsPerPremiumDayPurchased", 0); - floating[LOYALTY_BONUS_PERCENTAGE_MULTIPLIER] = getGlobalFloat(L, "loyaltyBonusPercentageMultiplier", 1.0); - - boolean[TOGGLE_WHEELSYSTEM] = getGlobalBoolean(L, "wheelSystemEnabled", true); - integer[WHEEL_POINTS_PER_LEVEL] = getGlobalNumber(L, "wheelPointsPerLevel", 1); - - boolean[PARTY_AUTO_SHARE_EXPERIENCE] = getGlobalBoolean(L, "partyAutoShareExperience", true); - boolean[PARTY_SHARE_LOOT_BOOSTS] = getGlobalBoolean(L, "partyShareLootBoosts", true); - floating[PARTY_SHARE_LOOT_BOOSTS_DIMINISHING_FACTOR] = getGlobalFloat(L, "partyShareLootBoostsDimishingFactor", 0.7f); - integer[TIBIADROME_CONCOCTION_COOLDOWN] = getGlobalNumber(L, "tibiadromeConcoctionCooldown", 24 * 60 * 60); - integer[TIBIADROME_CONCOCTION_DURATION] = getGlobalNumber(L, "tibiadromeConcoctionDuration", 1 * 60 * 60); - string[TIBIADROME_CONCOCTION_TICK_TYPE] = getGlobalString(L, "tibiadromeConcoctionTickType", "online"); - - string[M_CONST] = getGlobalString(L, "memoryConst", "1<<16"); - integer[T_CONST] = getGlobalNumber(L, "temporaryConst", 2); - integer[PARALLELISM] = getGlobalNumber(L, "parallelism", 2); + loadBoolConfig(L, ALLOW_CHANGEOUTFIT, "allowChangeOutfit", true); + loadBoolConfig(L, ONE_PLAYER_ON_ACCOUNT, "onePlayerOnlinePerAccount", true); + loadBoolConfig(L, AIMBOT_HOTKEY_ENABLED, "hotkeyAimbotEnabled", true); + loadBoolConfig(L, REMOVE_RUNE_CHARGES, "removeChargesFromRunes", true); + loadBoolConfig(L, EXPERIENCE_FROM_PLAYERS, "experienceByKillingPlayers", false); + loadBoolConfig(L, FREE_PREMIUM, "freePremium", false); + loadBoolConfig(L, REPLACE_KICK_ON_LOGIN, "replaceKickOnLogin", true); + loadBoolConfig(L, MARKET_PREMIUM, "premiumToCreateMarketOffer", true); + loadBoolConfig(L, EMOTE_SPELLS, "emoteSpells", false); + loadBoolConfig(L, STAMINA_SYSTEM, "staminaSystem", true); + loadBoolConfig(L, WARN_UNSAFE_SCRIPTS, "warnUnsafeScripts", true); + loadBoolConfig(L, CONVERT_UNSAFE_SCRIPTS, "convertUnsafeScripts", true); + loadBoolConfig(L, CLASSIC_ATTACK_SPEED, "classicAttackSpeed", false); + loadBoolConfig(L, TOGGLE_ATTACK_SPEED_ONFIST, "toggleAttackSpeedOnFist", false); + loadIntConfig(L, MULTIPLIER_ATTACKONFIST, "multiplierSpeedOnFist", 5); + loadIntConfig(L, MAX_SPEED_ATTACKONFIST, "maxSpeedOnFist", 500); + loadBoolConfig(L, SCRIPTS_CONSOLE_LOGS, "showScriptsLogInConsole", true); + loadBoolConfig(L, STASH_MOVING, "stashMoving", false); + loadBoolConfig(L, ALLOW_BLOCK_SPAWN, "allowBlockSpawn", true); + loadBoolConfig(L, REMOVE_WEAPON_AMMO, "removeWeaponAmmunition", true); + loadBoolConfig(L, REMOVE_WEAPON_CHARGES, "removeWeaponCharges", true); + loadBoolConfig(L, REMOVE_POTION_CHARGES, "removeChargesFromPotions", true); + loadBoolConfig(L, GLOBAL_SERVER_SAVE_NOTIFY_MESSAGE, "globalServerSaveNotifyMessage", true); + loadBoolConfig(L, GLOBAL_SERVER_SAVE_CLEAN_MAP, "globalServerSaveCleanMap", false); + loadBoolConfig(L, GLOBAL_SERVER_SAVE_CLOSE, "globalServerSaveClose", false); + loadBoolConfig(L, FORCE_MONSTERTYPE_LOAD, "forceMonsterTypesOnLoad", true); + loadBoolConfig(L, HOUSE_OWNED_BY_ACCOUNT, "houseOwnedByAccount", false); + loadBoolConfig(L, CLEAN_PROTECTION_ZONES, "cleanProtectionZones", false); + loadBoolConfig(L, GLOBAL_SERVER_SAVE_SHUTDOWN, "globalServerSaveShutdown", true); + loadBoolConfig(L, PUSH_WHEN_ATTACKING, "pushWhenAttacking", false); + + loadBoolConfig(L, WEATHER_RAIN, "weatherRain", false); + loadBoolConfig(L, WEATHER_THUNDER, "thunderEffect", false); + loadBoolConfig(L, ALL_CONSOLE_LOG, "allConsoleLog", false); + loadBoolConfig(L, TOGGLE_FREE_QUEST, "toggleFreeQuest", true); + loadBoolConfig(L, AUTOLOOT, "autoLoot", false); + loadBoolConfig(L, AUTOBANK, "autoBank", false); + loadBoolConfig(L, STAMINA_TRAINER, "staminaTrainer", false); + loadBoolConfig(L, STAMINA_PZ, "staminaPz", false); + loadBoolConfig(L, SORT_LOOT_BY_CHANCE, "sortLootByChance", false); + loadBoolConfig(L, TOGGLE_SAVE_INTERVAL, "toggleSaveInterval", false); + loadBoolConfig(L, TOGGLE_SAVE_INTERVAL_CLEAN_MAP, "toggleSaveIntervalCleanMap", false); + loadBoolConfig(L, TELEPORT_SUMMONS, "teleportSummons", false); + loadBoolConfig(L, ALLOW_RELOAD, "allowReload", false); + + loadBoolConfig(L, ONLY_PREMIUM_ACCOUNT, "onlyPremiumAccount", false); + loadBoolConfig(L, RATE_USE_STAGES, "rateUseStages", false); + loadBoolConfig(L, TOGGLE_IMBUEMENT_SHRINE_STORAGE, "toggleImbuementShrineStorage", true); + loadBoolConfig(L, TOGGLE_IMBUEMENT_NON_AGGRESSIVE_FIGHT_ONLY, "toggleImbuementNonAggressiveFightOnly", false); + + loadBoolConfig(L, TOGGLE_DOWNLOAD_MAP, "toggleDownloadMap", false); + loadBoolConfig(L, USE_ANY_DATAPACK_FOLDER, "useAnyDatapackFolder", false); + loadBoolConfig(L, INVENTORY_GLOW, "inventoryGlowOnFiveBless", false); + loadBoolConfig(L, XP_DISPLAY_MODE, "experienceDisplayRates", true); + + loadStringConfig(L, DEFAULT_PRIORITY, "defaultPriority", "high"); + loadStringConfig(L, SERVER_NAME, "serverName", ""); + loadStringConfig(L, SERVER_MOTD, "serverMotd", ""); + loadStringConfig(L, OWNER_NAME, "ownerName", ""); + loadStringConfig(L, OWNER_EMAIL, "ownerEmail", ""); + loadStringConfig(L, URL, "url", ""); + loadStringConfig(L, LOCATION, "location", ""); + loadStringConfig(L, WORLD_TYPE, "worldType", "pvp"); + loadStringConfig(L, STORE_IMAGES_URL, "coinImagesURL", ""); + loadStringConfig(L, DISCORD_WEBHOOK_URL, "discordWebhookURL", ""); + loadStringConfig(L, SAVE_INTERVAL_TYPE, "saveIntervalType", ""); + loadStringConfig(L, GLOBAL_SERVER_SAVE_TIME, "globalServerSaveTime", "06:00"); + loadStringConfig(L, DATA_DIRECTORY, "dataPackDirectory", "data-otservbr-global"); + loadStringConfig(L, CORE_DIRECTORY, "coreDirectory", "data"); + + loadStringConfig(L, FORGE_FIENDISH_INTERVAL_TYPE, "forgeFiendishIntervalType", "hour"); + loadStringConfig(L, FORGE_FIENDISH_INTERVAL_TIME, "forgeFiendishIntervalTime", "1"); + + loadIntConfig(L, MAX_PLAYERS, "maxPlayers", 0); + loadIntConfig(L, PZ_LOCKED, "pzLocked", 60000); + loadIntConfig(L, DEFAULT_DESPAWNRANGE, "deSpawnRange", 2); + loadIntConfig(L, DEFAULT_DESPAWNRADIUS, "deSpawnRadius", 50); + loadIntConfig(L, RATE_EXPERIENCE, "rateExp", 1); + loadIntConfig(L, RATE_SKILL, "rateSkill", 1); + loadIntConfig(L, RATE_LOOT, "rateLoot", 1); + loadIntConfig(L, RATE_MAGIC, "rateMagic", 1); + loadIntConfig(L, RATE_SPAWN, "rateSpawn", 1); + loadIntConfig(L, RATE_KILLING_IN_THE_NAME_OF_POINTS, "rateKillingInTheNameOfPoints", 1); + + loadIntConfig(L, HOUSE_PRICE_PER_SQM, "housePriceEachSQM", 1000); + loadIntConfig(L, HOUSE_BUY_LEVEL, "houseBuyLevel", 0); + loadIntConfig(L, HOUSE_LOSE_AFTER_INACTIVITY, "houseLoseAfterInactivity", 0); + loadBoolConfig(L, HOUSE_PURSHASED_SHOW_PRICE, "housePurchasedShowPrice", false); + loadBoolConfig(L, ONLY_INVITED_CAN_MOVE_HOUSE_ITEMS, "onlyInvitedCanMoveHouseItems", true); + + loadIntConfig(L, ACTIONS_DELAY_INTERVAL, "timeBetweenActions", 200); + loadIntConfig(L, EX_ACTIONS_DELAY_INTERVAL, "timeBetweenExActions", 1000); + loadIntConfig(L, MAX_MESSAGEBUFFER, "maxMessageBuffer", 4); + loadIntConfig(L, KICK_AFTER_MINUTES, "kickIdlePlayerAfterMinutes", 15); + loadIntConfig(L, PROTECTION_LEVEL, "protectionLevel", 1); + loadIntConfig(L, DEATH_LOSE_PERCENT, "deathLosePercent", -1); + loadIntConfig(L, STATUSQUERY_TIMEOUT, "statusTimeout", 5000); + loadIntConfig(L, FRAG_TIME, "timeToDecreaseFrags", 24 * 60 * 60 * 1000); + loadIntConfig(L, WHITE_SKULL_TIME, "whiteSkullTime", 15 * 60 * 1000); + loadIntConfig(L, STAIRHOP_DELAY, "stairJumpExhaustion", 2000); + loadIntConfig(L, MAX_CONTAINER, "maxContainer", 500); + loadIntConfig(L, MAX_CONTAINER_ITEM, "maxItem", 5000); + loadIntConfig(L, EXP_FROM_PLAYERS_LEVEL_RANGE, "expFromPlayersLevelRange", 75); + loadIntConfig(L, CHECK_EXPIRED_MARKET_OFFERS_EACH_MINUTES, "checkExpiredMarketOffersEachMinutes", 60); + loadIntConfig(L, MAX_MARKET_OFFERS_AT_A_TIME_PER_PLAYER, "maxMarketOffersAtATimePerPlayer", 100); + loadIntConfig(L, MAX_PACKETS_PER_SECOND, "maxPacketsPerSecond", 25); + loadIntConfig(L, COMPRESSION_LEVEL, "packetCompressionLevel", 6); + loadIntConfig(L, STORE_COIN_PACKET, "coinPacketSize", 25); + loadIntConfig(L, DAY_KILLS_TO_RED, "dayKillsToRedSkull", 3); + loadIntConfig(L, WEEK_KILLS_TO_RED, "weekKillsToRedSkull", 5); + loadIntConfig(L, MONTH_KILLS_TO_RED, "monthKillsToRedSkull", 10); + loadIntConfig(L, RED_SKULL_DURATION, "redSkullDuration", 30); + loadIntConfig(L, BLACK_SKULL_DURATION, "blackSkullDuration", 45); + loadIntConfig(L, ORANGE_SKULL_DURATION, "orangeSkullDuration", 7); + loadIntConfig(L, GLOBAL_SERVER_SAVE_NOTIFY_DURATION, "globalServerSaveNotifyDuration", 5); + + loadIntConfig(L, PARTY_LIST_MAX_DISTANCE, "partyListMaxDistance", 0); + + loadIntConfig(L, PUSH_DELAY, "pushDelay", 1000); + loadIntConfig(L, PUSH_DISTANCE_DELAY, "pushDistanceDelay", 1500); + + loadIntConfig(L, STAMINA_ORANGE_DELAY, "staminaOrangeDelay", 1); + loadIntConfig(L, STAMINA_GREEN_DELAY, "staminaGreenDelay", 5); + loadIntConfig(L, STAMINA_PZ_GAIN, "staminaPzGain", 1); + loadIntConfig(L, STAMINA_TRAINER_DELAY, "staminaTrainerDelay", 5); + loadIntConfig(L, STAMINA_TRAINER_GAIN, "staminaTrainerGain", 1); + loadIntConfig(L, SAVE_INTERVAL_TIME, "saveIntervalTime", 1); + loadIntConfig(L, MAX_ALLOWED_ON_A_DUMMY, "maxAllowedOnADummy", 1); + loadIntConfig(L, FREE_QUEST_STAGE, "freeQuestStage", 1); + loadIntConfig(L, DEPOTCHEST, "depotChest", 4); + loadIntConfig(L, CRITICALCHANCE, "criticalChance", 10); + + loadIntConfig(L, ADVENTURERSBLESSING_LEVEL, "adventurersBlessingLevel", 21); + loadIntConfig(L, FORGE_MAX_ITEM_TIER, "forgeMaxItemTier", 10); + loadIntConfig(L, FORGE_COST_ONE_SLIVER, "forgeCostOneSliver", 20); + loadIntConfig(L, FORGE_SLIVER_AMOUNT, "forgeSliverAmount", 3); + loadIntConfig(L, FORGE_CORE_COST, "forgeCoreCost", 50); + loadIntConfig(L, FORGE_MAX_DUST, "forgeMaxDust", 225); + loadIntConfig(L, FORGE_FUSION_DUST_COST, "forgeFusionCost", 100); + loadIntConfig(L, FORGE_TRANSFER_DUST_COST, "forgeTransferCost", 100); + loadIntConfig(L, FORGE_BASE_SUCCESS_RATE, "forgeBaseSuccessRate", 50); + loadIntConfig(L, FORGE_BONUS_SUCCESS_RATE, "forgeBonusSuccessRate", 15); + loadIntConfig(L, FORGE_TIER_LOSS_REDUCTION, "forgeTierLossReduction", 50); + loadIntConfig(L, FORGE_AMOUNT_MULTIPLIER, "forgeAmountMultiplier", 3); + loadIntConfig(L, FORGE_MIN_SLIVERS, "forgeMinSlivers", 3); + loadIntConfig(L, FORGE_MAX_SLIVERS, "forgeMaxSlivers", 7); + loadIntConfig(L, FORGE_INFLUENCED_CREATURES_LIMIT, "forgeInfluencedLimit", 300); + loadIntConfig(L, FORGE_FIENDISH_CREATURES_LIMIT, "forgeFiendishLimit", 3); + loadIntConfig(L, DISCORD_WEBHOOK_DELAY_MS, "discordWebhookDelayMs", Webhook::DEFAULT_DELAY_MS); + + loadFloatConfig(L, BESTIARY_RATE_CHARM_SHOP_PRICE, "bestiaryRateCharmShopPrice", 1.0); + loadFloatConfig(L, RATE_HEALTH_REGEN, "rateHealthRegen", 1.0); + loadFloatConfig(L, RATE_HEALTH_REGEN_SPEED, "rateHealthRegenSpeed", 1.0); + loadFloatConfig(L, RATE_MANA_REGEN, "rateManaRegen", 1.0); + loadFloatConfig(L, RATE_MANA_REGEN_SPEED, "rateManaRegenSpeed", 1.0); + loadFloatConfig(L, RATE_SOUL_REGEN, "rateSoulRegen", 1.0); + loadFloatConfig(L, RATE_SOUL_REGEN_SPEED, "rateSoulRegenSpeed", 1.0); + loadFloatConfig(L, RATE_SPELL_COOLDOWN, "rateSpellCooldown", 1.0); + loadFloatConfig(L, RATE_ATTACK_SPEED, "rateAttackSpeed", 1.0); + loadFloatConfig(L, RATE_OFFLINE_TRAINING_SPEED, "rateOfflineTrainingSpeed", 1.0); + loadFloatConfig(L, RATE_EXERCISE_TRAINING_SPEED, "rateExerciseTrainingSpeed", 1.0); + + loadFloatConfig(L, RATE_MONSTER_HEALTH, "rateMonsterHealth", 1.0); + loadFloatConfig(L, RATE_MONSTER_ATTACK, "rateMonsterAttack", 1.0); + loadFloatConfig(L, RATE_MONSTER_DEFENSE, "rateMonsterDefense", 1.0); + loadFloatConfig(L, RATE_BOSS_HEALTH, "rateBossHealth", 1.0); + loadFloatConfig(L, RATE_BOSS_ATTACK, "rateBossAttack", 1.0); + loadFloatConfig(L, RATE_BOSS_DEFENSE, "rateBossDefense", 1.0); + loadIntConfig(L, BOSS_DEFAULT_TIME_TO_FIGHT_AGAIN, "bossDefaultTimeToFightAgain", 20 * 60 * 60); + loadIntConfig(L, BOSS_DEFAULT_TIME_TO_DEFEAT, "bossDefaultTimeToDefeat", 20 * 60); + + loadFloatConfig(L, RATE_NPC_HEALTH, "rateNpcHealth", 1.0); + loadFloatConfig(L, RATE_NPC_ATTACK, "rateNpcAttack", 1.0); + loadFloatConfig(L, RATE_NPC_DEFENSE, "rateNpcDefense", 1.0); + + loadBoolConfig(L, PREY_ENABLED, "preySystemEnabled", true); + loadBoolConfig(L, PREY_FREE_THIRD_SLOT, "preyFreeThirdSlot", false); + loadIntConfig(L, PREY_REROLL_PRICE_LEVEL, "preyRerollPricePerLevel", 200); + loadIntConfig(L, PREY_SELECTION_LIST_PRICE, "preySelectListPrice", 5); + loadIntConfig(L, PREY_BONUS_TIME, "preyBonusTime", 7200); + loadIntConfig(L, PREY_BONUS_REROLL_PRICE, "preyBonusRerollPrice", 1); + loadIntConfig(L, PREY_FREE_REROLL_TIME, "preyFreeRerollTime", 72000); + + loadBoolConfig(L, TASK_HUNTING_ENABLED, "taskHuntingSystemEnabled", true); + loadBoolConfig(L, TASK_HUNTING_FREE_THIRD_SLOT, "taskHuntingFreeThirdSlot", false); + loadIntConfig(L, TASK_HUNTING_LIMIT_EXHAUST, "taskHuntingLimitedTasksExhaust", 72000); + loadIntConfig(L, TASK_HUNTING_REROLL_PRICE_LEVEL, "taskHuntingRerollPricePerLevel", 200); + loadIntConfig(L, TASK_HUNTING_SELECTION_LIST_PRICE, "taskHuntingSelectListPrice", 5); + loadIntConfig(L, TASK_HUNTING_BONUS_REROLL_PRICE, "taskHuntingBonusRerollPrice", 1); + loadIntConfig(L, TASK_HUNTING_FREE_REROLL_TIME, "taskHuntingFreeRerollTime", 72000); + + loadIntConfig(L, BESTIARY_KILL_MULTIPLIER, "bestiaryKillMultiplier", 1); + loadIntConfig(L, BOSSTIARY_KILL_MULTIPLIER, "bosstiaryKillMultiplier", 1); + loadBoolConfig(L, BOOSTED_BOSS_SLOT, "boostedBossSlot", true); + loadIntConfig(L, BOOSTED_BOSS_LOOT_BONUS, "boostedBossLootBonus", 250); + loadIntConfig(L, BOOSTED_BOSS_KILL_BONUS, "boostedBossKillBonus", 3); + + loadIntConfig(L, FAMILIAR_TIME, "familiarTime", 30); + + loadBoolConfig(L, TOGGLE_GOLD_POUCH_ALLOW_ANYTHING, "toggleGoldPouchAllowAnything", false); + loadBoolConfig(L, TOGGLE_GOLD_POUCH_QUICKLOOT_ONLY, "toggleGoldPouchQuickLootOnly", false); + loadBoolConfig(L, TOGGLE_SERVER_IS_RETRO, "toggleServerIsRetroPVP", false); + loadBoolConfig(L, TOGGLE_TRAVELS_FREE, "toggleTravelsFree", false); + loadIntConfig(L, BUY_AOL_COMMAND_FEE, "buyAolCommandFee", 0); + loadIntConfig(L, BUY_BLESS_COMMAND_FEE, "buyBlessCommandFee", 0); + loadBoolConfig(L, TELEPORT_PLAYER_TO_VOCATION_ROOM, "teleportPlayerToVocationRoom", true); + + loadBoolConfig(L, TOGGLE_HAZARDSYSTEM, "toogleHazardSystem", true); + loadIntConfig(L, HAZARD_CRITICAL_INTERVAL, "hazardCriticalInterval", 2000); + loadIntConfig(L, HAZARD_CRITICAL_CHANCE, "hazardCriticalChance", 750); + loadIntConfig(L, HAZARD_CRITICAL_MULTIPLIER, "hazardCriticalMultiplier", 25); + loadIntConfig(L, HAZARD_DAMAGE_MULTIPLIER, "hazardDamageMultiplier", 200); + loadIntConfig(L, HAZARD_DODGE_MULTIPLIER, "hazardDodgeMultiplier", 85); + loadIntConfig(L, HAZARD_PODS_DROP_MULTIPLIER, "hazardPodsDropMultiplier", 87); + loadIntConfig(L, HAZARD_PODS_TIME_TO_DAMAGE, "hazardPodsTimeToDamage", 2000); + loadIntConfig(L, HAZARD_PODS_TIME_TO_SPAWN, "hazardPodsTimeToSpawn", 4000); + loadIntConfig(L, HAZARD_EXP_BONUS_MULTIPLIER, "hazardExpBonusMultiplier", 2); + loadIntConfig(L, HAZARD_LOOT_BONUS_MULTIPLIER, "hazardLootBonusMultiplier", 2); + loadIntConfig(L, HAZARD_PODS_DAMAGE, "hazardPodsDamage", 5); + loadIntConfig(L, HAZARD_SPAWN_PLUNDER_MULTIPLIER, "hazardSpawnPlunderMultiplier", 25); + loadIntConfig(L, LOW_LEVEL_BONUS_EXP, "lowLevelBonusExp", 50); + + loadBoolConfig(L, LOYALTY_ENABLED, "loyaltyEnabled", true); + loadIntConfig(L, LOYALTY_POINTS_PER_CREATION_DAY, "loyaltyPointsPerCreationDay", 1); + loadIntConfig(L, LOYALTY_POINTS_PER_PREMIUM_DAY_SPENT, "loyaltyPointsPerPremiumDaySpent", 0); + loadIntConfig(L, LOYALTY_POINTS_PER_PREMIUM_DAY_PURCHASED, "loyaltyPointsPerPremiumDayPurchased", 0); + loadFloatConfig(L, LOYALTY_BONUS_PERCENTAGE_MULTIPLIER, "loyaltyBonusPercentageMultiplier", 1.0); + + loadBoolConfig(L, TOGGLE_WHEELSYSTEM, "wheelSystemEnabled", true); + loadIntConfig(L, WHEEL_POINTS_PER_LEVEL, "wheelPointsPerLevel", 1); + + loadBoolConfig(L, PARTY_AUTO_SHARE_EXPERIENCE, "partyAutoShareExperience", true); + loadBoolConfig(L, PARTY_SHARE_LOOT_BOOSTS, "partyShareLootBoosts", true); + loadFloatConfig(L, PARTY_SHARE_LOOT_BOOSTS_DIMINISHING_FACTOR, "partyShareLootBoostsDimishingFactor", 0.7f); + loadIntConfig(L, TIBIADROME_CONCOCTION_COOLDOWN, "tibiadromeConcoctionCooldown", 24 * 60 * 60); + loadIntConfig(L, TIBIADROME_CONCOCTION_DURATION, "tibiadromeConcoctionDuration", 1 * 60 * 60); + loadStringConfig(L, TIBIADROME_CONCOCTION_TICK_TYPE, "tibiadromeConcoctionTickType", "online"); + + loadStringConfig(L, M_CONST, "memoryConst", "1<<16"); + loadIntConfig(L, T_CONST, "temporaryConst", 2); + loadIntConfig(L, PARALLELISM, "parallelism", 2); // Vip System - boolean[VIP_SYSTEM_ENABLED] = getGlobalBoolean(L, "vipSystemEnabled", false); - integer[VIP_BONUS_EXP] = getGlobalNumber(L, "vipBonusExp", 0); - integer[VIP_BONUS_LOOT] = getGlobalNumber(L, "vipBonusLoot", 0); - integer[VIP_BONUS_SKILL] = getGlobalNumber(L, "vipBonusSkill", 0); - boolean[VIP_AUTOLOOT_VIP_ONLY] = getGlobalBoolean(L, "vipAutoLootVipOnly", false); - boolean[VIP_KEEP_HOUSE] = getGlobalBoolean(L, "vipKeepHouse", false); - boolean[VIP_STAY_ONLINE] = getGlobalBoolean(L, "vipStayOnline", false); - integer[VIP_FAMILIAR_TIME_COOLDOWN_REDUCTION] = getGlobalNumber(L, "vipFamiliarTimeCooldownReduction", 0); - - boolean[REWARD_CHEST_COLLECT_ENABLED] = getGlobalBoolean(L, "rewardChestCollectEnabled", true); - integer[REWARD_CHEST_MAX_COLLECT_ITEMS] = getGlobalNumber(L, "rewardChestMaxCollectItems", 200); + loadBoolConfig(L, VIP_SYSTEM_ENABLED, "vipSystemEnabled", false); + loadIntConfig(L, VIP_BONUS_EXP, "vipBonusExp", 0); + loadIntConfig(L, VIP_BONUS_LOOT, "vipBonusLoot", 0); + loadIntConfig(L, VIP_BONUS_SKILL, "vipBonusSkill", 0); + loadBoolConfig(L, VIP_AUTOLOOT_VIP_ONLY, "vipAutoLootVipOnly", false); + loadBoolConfig(L, VIP_KEEP_HOUSE, "vipKeepHouse", false); + loadBoolConfig(L, VIP_STAY_ONLINE, "vipStayOnline", false); + loadIntConfig(L, VIP_FAMILIAR_TIME_COOLDOWN_REDUCTION, "vipFamiliarTimeCooldownReduction", 0); + + loadBoolConfig(L, REWARD_CHEST_COLLECT_ENABLED, "rewardChestCollectEnabled", true); + loadIntConfig(L, REWARD_CHEST_MAX_COLLECT_ITEMS, "rewardChestMaxCollectItems", 200); // PVP System - floating[PVP_RATE_DAMAGE_TAKEN_PER_LEVEL] = getGlobalFloat(L, "pvpRateDamageTakenPerLevel", 0.0); - floating[PVP_RATE_DAMAGE_REDUCTION_PER_LEVEL] = getGlobalFloat(L, "pvpRateDamageReductionPerLevel", 0.0); - integer[PVP_MAX_LEVEL_DIFFERENCE] = getGlobalNumber(L, "pvpMaxLevelDifference", 0); + loadFloatConfig(L, PVP_RATE_DAMAGE_TAKEN_PER_LEVEL, "pvpRateDamageTakenPerLevel", 0.0); + loadFloatConfig(L, PVP_RATE_DAMAGE_REDUCTION_PER_LEVEL, "pvpRateDamageReductionPerLevel", 0.0); + loadIntConfig(L, PVP_MAX_LEVEL_DIFFERENCE, "pvpMaxLevelDifference", 0); - boolean[TOGGLE_MOUNT_IN_PZ] = getGlobalBoolean(L, "toggleMountInProtectionZone", false); + loadBoolConfig(L, TOGGLE_MOUNT_IN_PZ, "toggleMountInProtectionZone", false); - boolean[TOGGLE_HOUSE_TRANSFER_ON_SERVER_RESTART] = getGlobalBoolean(L, "togglehouseTransferOnRestart", false); + loadBoolConfig(L, TOGGLE_HOUSE_TRANSFER_ON_SERVER_RESTART, "togglehouseTransferOnRestart", false); - boolean[TOGGLE_RECEIVE_REWARD] = getGlobalBoolean(L, "toggleReceiveReward", false); + loadBoolConfig(L, TOGGLE_RECEIVE_REWARD, "toggleReceiveReward", false); loaded = true; lua_close(L); @@ -409,51 +353,86 @@ bool ConfigManager::load() { } bool ConfigManager::reload() { - bool result = load(); + const bool result = load(); if (transformToSHA1(getString(SERVER_MOTD)) != g_game().getMotdHash()) { g_game().incrementMotdNum(); } return result; } -static std::string dummyStr; +std::string ConfigManager::loadStringConfig(lua_State* L, const ConfigKey_t &key, const char* identifier, const std::string &defaultValue) { + std::string value = defaultValue; + lua_getglobal(L, identifier); + if (lua_isstring(L, -1)) { + value = lua_tostring(L, -1); + } + configs[key] = value; + lua_pop(L, 1); + return value; +} -const std::string &ConfigManager::getString(stringConfig_t what) const { - if (what >= LAST_STRING_CONFIG) { - g_logger().warn("[ConfigManager::getString] - Accessing invalid index: {}", fmt::underlying(what)); - return dummyStr; +int32_t ConfigManager::loadIntConfig(lua_State* L, const ConfigKey_t &key, const char* identifier, const int32_t &defaultValue) { + int32_t value = defaultValue; + lua_getglobal(L, identifier); + if (lua_isnumber(L, -1)) { + value = static_cast(lua_tointeger(L, -1)); } - return string[what]; + configs[key] = value; + lua_pop(L, 1); + return value; } -int32_t ConfigManager::getNumber(integerConfig_t what) const { - if (what >= LAST_INTEGER_CONFIG) { - g_logger().warn("[ConfigManager::getNumber] - Accessing invalid index: {}", fmt::underlying(what)); - return 0; +bool ConfigManager::loadBoolConfig(lua_State* L, const ConfigKey_t &key, const char* identifier, const bool &defaultValue) { + bool value = defaultValue; + lua_getglobal(L, identifier); + if (lua_isboolean(L, -1)) { + value = static_cast(lua_toboolean(L, -1)); } - return integer[what]; + configs[key] = value; + lua_pop(L, 1); + return value; } -int16_t ConfigManager::getShortNumber(integerConfig_t what) const { - if (what >= LAST_INTEGER_CONFIG) { - g_logger().warn("[ConfigManager::getShortNumber] - Accessing invalid index: {}", fmt::underlying(what)); - return 0; +float ConfigManager::loadFloatConfig(lua_State* L, const ConfigKey_t &key, const char* identifier, const float &defaultValue) { + float value = defaultValue; + lua_getglobal(L, identifier); + if (lua_isnumber(L, -1)) { + value = static_cast(lua_tonumber(L, -1)); } - return integer[what]; + configs[key] = value; + lua_pop(L, 1); + return value; } -bool ConfigManager::getBoolean(booleanConfig_t what) const { - if (what >= LAST_BOOLEAN_CONFIG) { - g_logger().warn("[ConfigManager::getBoolean] - Accessing invalid index: {}", fmt::underlying(what)); - return false; +const std::string &ConfigManager::getString(const ConfigKey_t &key) const { + static const std::string dummyStr; + if (configs.contains(key) && std::holds_alternative(configs.at(key))) { + return std::get(configs.at(key)); + } + g_logger().warn("[ConfigManager::getString] - Accessing invalid or wrong type index: {}", fmt::underlying(key)); + return dummyStr; +} + +int32_t ConfigManager::getNumber(const ConfigKey_t &key) const { + if (configs.contains(key) && std::holds_alternative(configs.at(key))) { + return std::get(configs.at(key)); + } + g_logger().warn("[ConfigManager::getNumber] - Accessing invalid or wrong type index: {}", fmt::underlying(key)); + return 0; +} + +bool ConfigManager::getBoolean(const ConfigKey_t &key) const { + if (configs.contains(key) && std::holds_alternative(configs.at(key))) { + return std::get(configs.at(key)); } - return boolean[what]; + g_logger().warn("[ConfigManager::getBoolean] - Accessing invalid or wrong type index: {}", fmt::underlying(key)); + return false; } -float ConfigManager::getFloat(floatingConfig_t what) const { - if (what >= LAST_FLOATING_CONFIG) { - g_logger().warn("[ConfigManager::getFLoat] - Accessing invalid index: {}", fmt::underlying(what)); - return 0; +float ConfigManager::getFloat(const ConfigKey_t &key) const { + if (configs.contains(key) && std::holds_alternative(configs.at(key))) { + return std::get(configs.at(key)); } - return floating[what]; + g_logger().warn("[ConfigManager::getFloat] - Accessing invalid or wrong type index: {}", fmt::underlying(key)); + return 0.0f; } diff --git a/src/config/configmanager.hpp b/src/config/configmanager.hpp index 21e42f9e768..39d88a046f2 100644 --- a/src/config/configmanager.hpp +++ b/src/config/configmanager.hpp @@ -12,6 +12,8 @@ #include "declarations.hpp" #include "lib/di/container.hpp" +using ConfigValue = std::variant; + class ConfigManager { public: ConfigManager() = default; @@ -27,28 +29,27 @@ class ConfigManager { bool load(); bool reload(); - const std::string &getString(stringConfig_t what) const; - int32_t getNumber(integerConfig_t what) const; - int16_t getShortNumber(integerConfig_t what) const; - bool getBoolean(booleanConfig_t what) const; - float getFloat(floatingConfig_t what) const; - const std::string &setConfigFileLua(const std::string &what) { configFileLua = { what }; return configFileLua; }; - const std::string &getConfigFileLua() const { + [[nodiscard]] const std::string &getConfigFileLua() const { return configFileLua; }; -private: - std::string configFileLua = { "config.lua" }; + [[nodiscard]] const std::string &getString(const ConfigKey_t &key) const; + [[nodiscard]] int32_t getNumber(const ConfigKey_t &key) const; + [[nodiscard]] bool getBoolean(const ConfigKey_t &key) const; + [[nodiscard]] float getFloat(const ConfigKey_t &key) const; - std::string string[LAST_STRING_CONFIG] = {}; - int32_t integer[LAST_INTEGER_CONFIG] = {}; - bool boolean[LAST_BOOLEAN_CONFIG] = {}; - float floating[LAST_FLOATING_CONFIG] = {}; +private: + phmap::flat_hash_map configs; + std::string loadStringConfig(lua_State* L, const ConfigKey_t &key, const char* identifier, const std::string &defaultValue); + int32_t loadIntConfig(lua_State* L, const ConfigKey_t &key, const char* identifier, const int32_t &defaultValue); + bool loadBoolConfig(lua_State* L, const ConfigKey_t &key, const char* identifier, const bool &defaultValue); + float loadFloatConfig(lua_State* L, const ConfigKey_t &key, const char* identifier, const float &defaultValue); + std::string configFileLua = { "config.lua" }; bool loaded = false; }; diff --git a/src/lua/functions/core/game/config_functions.cpp b/src/lua/functions/core/game/config_functions.cpp index 96ce09cdcc7..dae41773882 100644 --- a/src/lua/functions/core/game/config_functions.cpp +++ b/src/lua/functions/core/game/config_functions.cpp @@ -14,265 +14,44 @@ void ConfigFunctions::init(lua_State* L) { registerTable(L, "configManager"); - registerMethod(L, "configManager", "getString", ConfigFunctions::luaConfigManagerGetString); - registerMethod(L, "configManager", "getNumber", ConfigFunctions::luaConfigManagerGetNumber); - registerMethod(L, "configManager", "getBoolean", ConfigFunctions::luaConfigManagerGetBoolean); - registerMethod(L, "configManager", "getFloat", ConfigFunctions::luaConfigManagerGetFloat); - -#define registerEnumIn(L, tableName, value) \ - do { \ - std::string enumName = #value; \ - registerVariable(L, tableName, enumName.substr(enumName.find_last_of(':') + 1), value); \ + registerMethod(L, "configManager", "getString", luaConfigManagerGetString); + registerMethod(L, "configManager", "getNumber", luaConfigManagerGetNumber); + registerMethod(L, "configManager", "getBoolean", luaConfigManagerGetBoolean); + registerMethod(L, "configManager", "getFloat", luaConfigManagerGetFloat); + +#define registerMagicEnumIn(L, tableName, enumValue) \ + do { \ + auto number = magic_enum::enum_integer(enumValue); \ + auto name = magic_enum::enum_name(enumValue).data(); \ + registerVariable(L, tableName, name, value); \ } while (0) registerTable(L, "configKeys"); - registerEnumIn(L, "configKeys", ALLOW_CHANGEOUTFIT); - registerEnumIn(L, "configKeys", ONE_PLAYER_ON_ACCOUNT); - registerEnumIn(L, "configKeys", AIMBOT_HOTKEY_ENABLED); - registerEnumIn(L, "configKeys", REMOVE_RUNE_CHARGES); - registerEnumIn(L, "configKeys", EXPERIENCE_FROM_PLAYERS); - registerEnumIn(L, "configKeys", FREE_PREMIUM); - registerEnumIn(L, "configKeys", REPLACE_KICK_ON_LOGIN); - registerEnumIn(L, "configKeys", BIND_ONLY_GLOBAL_ADDRESS); - registerEnumIn(L, "configKeys", OPTIMIZE_DATABASE); - registerEnumIn(L, "configKeys", MARKET_PREMIUM); - registerEnumIn(L, "configKeys", EMOTE_SPELLS); - registerEnumIn(L, "configKeys", STAMINA_SYSTEM); - registerEnumIn(L, "configKeys", WARN_UNSAFE_SCRIPTS); - registerEnumIn(L, "configKeys", CONVERT_UNSAFE_SCRIPTS); - registerEnumIn(L, "configKeys", ALLOW_BLOCK_SPAWN); - registerEnumIn(L, "configKeys", CLASSIC_ATTACK_SPEED); - registerEnumIn(L, "configKeys", REMOVE_WEAPON_AMMO); - registerEnumIn(L, "configKeys", REMOVE_WEAPON_CHARGES); - registerEnumIn(L, "configKeys", REMOVE_POTION_CHARGES); - registerEnumIn(L, "configKeys", WEATHER_RAIN); - registerEnumIn(L, "configKeys", ALLOW_RELOAD); - registerEnumIn(L, "configKeys", WEATHER_THUNDER); - registerEnumIn(L, "configKeys", TOGGLE_FREE_QUEST); - registerEnumIn(L, "configKeys", FREE_QUEST_STAGE); - registerEnumIn(L, "configKeys", ALL_CONSOLE_LOG); - registerEnumIn(L, "configKeys", GLOBAL_SERVER_SAVE_NOTIFY_MESSAGE); - registerEnumIn(L, "configKeys", GLOBAL_SERVER_SAVE_NOTIFY_DURATION); - registerEnumIn(L, "configKeys", XP_DISPLAY_MODE); - registerEnumIn(L, "configKeys", GLOBAL_SERVER_SAVE_CLEAN_MAP); - registerEnumIn(L, "configKeys", GLOBAL_SERVER_SAVE_CLOSE); - registerEnumIn(L, "configKeys", GLOBAL_SERVER_SAVE_SHUTDOWN); - registerEnumIn(L, "configKeys", MAP_NAME); - registerEnumIn(L, "configKeys", TOGGLE_MAP_CUSTOM); - registerEnumIn(L, "configKeys", MAP_CUSTOM_NAME); - registerEnumIn(L, "configKeys", HOUSE_RENT_PERIOD); - registerEnumIn(L, "configKeys", SERVER_NAME); - registerEnumIn(L, "configKeys", SERVER_MOTD); - registerEnumIn(L, "configKeys", OWNER_NAME); - registerEnumIn(L, "configKeys", OWNER_EMAIL); - registerEnumIn(L, "configKeys", URL); - registerEnumIn(L, "configKeys", LOCATION); - registerEnumIn(L, "configKeys", IP); - registerEnumIn(L, "configKeys", WORLD_TYPE); - registerEnumIn(L, "configKeys", MYSQL_HOST); - registerEnumIn(L, "configKeys", MYSQL_USER); - registerEnumIn(L, "configKeys", MYSQL_PASS); - registerEnumIn(L, "configKeys", MYSQL_DB); - registerEnumIn(L, "configKeys", MYSQL_SOCK); - registerEnumIn(L, "configKeys", DEFAULT_PRIORITY); - registerEnumIn(L, "configKeys", MAP_AUTHOR); - registerEnumIn(L, "configKeys", STORE_IMAGES_URL); - registerEnumIn(L, "configKeys", PARTY_LIST_MAX_DISTANCE); - registerEnumIn(L, "configKeys", SQL_PORT); - registerEnumIn(L, "configKeys", MAX_PLAYERS); - registerEnumIn(L, "configKeys", PZ_LOCKED); - registerEnumIn(L, "configKeys", DEFAULT_DESPAWNRANGE); - registerEnumIn(L, "configKeys", PREY_ENABLED); - registerEnumIn(L, "configKeys", PREY_FREE_THIRD_SLOT); - registerEnumIn(L, "configKeys", PREY_REROLL_PRICE_LEVEL); - registerEnumIn(L, "configKeys", PREY_BONUS_TIME); - registerEnumIn(L, "configKeys", PREY_BONUS_REROLL_PRICE); - registerEnumIn(L, "configKeys", PREY_FREE_REROLL_TIME); - registerEnumIn(L, "configKeys", TASK_HUNTING_ENABLED); - registerEnumIn(L, "configKeys", TASK_HUNTING_FREE_THIRD_SLOT); - registerEnumIn(L, "configKeys", TASK_HUNTING_LIMIT_EXHAUST); - registerEnumIn(L, "configKeys", TASK_HUNTING_REROLL_PRICE_LEVEL); - registerEnumIn(L, "configKeys", TASK_HUNTING_SELECTION_LIST_PRICE); - registerEnumIn(L, "configKeys", TASK_HUNTING_BONUS_REROLL_PRICE); - registerEnumIn(L, "configKeys", TASK_HUNTING_FREE_REROLL_TIME); - registerEnumIn(L, "configKeys", DEFAULT_DESPAWNRADIUS); - registerEnumIn(L, "configKeys", RATE_EXPERIENCE); - registerEnumIn(L, "configKeys", RATE_SKILL); - registerEnumIn(L, "configKeys", RATE_LOOT); - registerEnumIn(L, "configKeys", RATE_MAGIC); - registerEnumIn(L, "configKeys", RATE_SPAWN); - registerEnumIn(L, "configKeys", RATE_KILLING_IN_THE_NAME_OF_POINTS); - registerEnumIn(L, "configKeys", HOUSE_PRICE_PER_SQM); - registerEnumIn(L, "configKeys", HOUSE_BUY_LEVEL); - registerEnumIn(L, "configKeys", HOUSE_LOSE_AFTER_INACTIVITY); - registerEnumIn(L, "configKeys", MAX_MESSAGEBUFFER); - registerEnumIn(L, "configKeys", ACTIONS_DELAY_INTERVAL); - registerEnumIn(L, "configKeys", EX_ACTIONS_DELAY_INTERVAL); - registerEnumIn(L, "configKeys", KICK_AFTER_MINUTES); - registerEnumIn(L, "configKeys", PROTECTION_LEVEL); - registerEnumIn(L, "configKeys", DEATH_LOSE_PERCENT); - registerEnumIn(L, "configKeys", STATUSQUERY_TIMEOUT); - registerEnumIn(L, "configKeys", FRAG_TIME); - registerEnumIn(L, "configKeys", WHITE_SKULL_TIME); - registerEnumIn(L, "configKeys", GAME_PORT); - registerEnumIn(L, "configKeys", LOGIN_PORT); - registerEnumIn(L, "configKeys", STATUS_PORT); - registerEnumIn(L, "configKeys", STAIRHOP_DELAY); - registerEnumIn(L, "configKeys", MARKET_OFFER_DURATION); - registerEnumIn(L, "configKeys", CHECK_EXPIRED_MARKET_OFFERS_EACH_MINUTES); - registerEnumIn(L, "configKeys", MAX_MARKET_OFFERS_AT_A_TIME_PER_PLAYER); - registerEnumIn(L, "configKeys", EXP_FROM_PLAYERS_LEVEL_RANGE); - registerEnumIn(L, "configKeys", MAX_PACKETS_PER_SECOND); - registerEnumIn(L, "configKeys", STORE_COIN_PACKET); - registerEnumIn(L, "configKeys", DAY_KILLS_TO_RED); - registerEnumIn(L, "configKeys", WEEK_KILLS_TO_RED); - registerEnumIn(L, "configKeys", MONTH_KILLS_TO_RED); - registerEnumIn(L, "configKeys", RED_SKULL_DURATION); - registerEnumIn(L, "configKeys", BLACK_SKULL_DURATION); - registerEnumIn(L, "configKeys", ORANGE_SKULL_DURATION); - registerEnumIn(L, "configKeys", RATE_MONSTER_HEALTH); - registerEnumIn(L, "configKeys", RATE_MONSTER_ATTACK); - registerEnumIn(L, "configKeys", RATE_MONSTER_DEFENSE); - registerEnumIn(L, "configKeys", RATE_BOSS_HEALTH); - registerEnumIn(L, "configKeys", RATE_BOSS_ATTACK); - registerEnumIn(L, "configKeys", RATE_BOSS_DEFENSE); - registerEnumIn(L, "configKeys", BOSS_DEFAULT_TIME_TO_FIGHT_AGAIN); - registerEnumIn(L, "configKeys", BOSS_DEFAULT_TIME_TO_DEFEAT); - registerEnumIn(L, "configKeys", RATE_NPC_HEALTH); - registerEnumIn(L, "configKeys", RATE_NPC_ATTACK); - registerEnumIn(L, "configKeys", RATE_NPC_DEFENSE); - - registerEnumIn(L, "configKeys", RATE_HEALTH_REGEN); - registerEnumIn(L, "configKeys", RATE_HEALTH_REGEN_SPEED); - registerEnumIn(L, "configKeys", RATE_MANA_REGEN); - registerEnumIn(L, "configKeys", RATE_MANA_REGEN_SPEED); - registerEnumIn(L, "configKeys", RATE_SOUL_REGEN); - registerEnumIn(L, "configKeys", RATE_SOUL_REGEN_SPEED); - - registerEnumIn(L, "configKeys", RATE_SPELL_COOLDOWN); - registerEnumIn(L, "configKeys", RATE_ATTACK_SPEED); - registerEnumIn(L, "configKeys", RATE_OFFLINE_TRAINING_SPEED); - registerEnumIn(L, "configKeys", RATE_EXERCISE_TRAINING_SPEED); - - registerEnumIn(L, "configKeys", STAMINA_TRAINER); - registerEnumIn(L, "configKeys", STAMINA_PZ); - registerEnumIn(L, "configKeys", STAMINA_ORANGE_DELAY); - registerEnumIn(L, "configKeys", STAMINA_GREEN_DELAY); - registerEnumIn(L, "configKeys", STAMINA_TRAINER_DELAY); - registerEnumIn(L, "configKeys", STAMINA_PZ_GAIN); - registerEnumIn(L, "configKeys", STAMINA_TRAINER_GAIN); - registerEnumIn(L, "configKeys", SORT_LOOT_BY_CHANCE); - registerEnumIn(L, "configKeys", MAX_ALLOWED_ON_A_DUMMY); - - registerEnumIn(L, "configKeys", PUSH_WHEN_ATTACKING); - registerEnumIn(L, "configKeys", TOGGLE_SAVE_INTERVAL); - registerEnumIn(L, "configKeys", SAVE_INTERVAL_TYPE); - registerEnumIn(L, "configKeys", TOGGLE_SAVE_INTERVAL_CLEAN_MAP); - registerEnumIn(L, "configKeys", SAVE_INTERVAL_TIME); - registerEnumIn(L, "configKeys", RATE_USE_STAGES); - registerEnumIn(L, "configKeys", TOGGLE_IMBUEMENT_SHRINE_STORAGE); - registerEnumIn(L, "configKeys", TOGGLE_IMBUEMENT_NON_AGGRESSIVE_FIGHT_ONLY); - registerEnumIn(L, "configKeys", GLOBAL_SERVER_SAVE_TIME); - registerEnumIn(L, "configKeys", DATA_DIRECTORY); - registerEnumIn(L, "configKeys", CORE_DIRECTORY); - - registerEnumIn(L, "configKeys", FORGE_COST_ONE_SLIVER); - registerEnumIn(L, "configKeys", FORGE_SLIVER_AMOUNT); - registerEnumIn(L, "configKeys", FORGE_CORE_COST); - registerEnumIn(L, "configKeys", FORGE_MAX_DUST); - registerEnumIn(L, "configKeys", FORGE_FUSION_DUST_COST); - registerEnumIn(L, "configKeys", FORGE_TRANSFER_DUST_COST); - registerEnumIn(L, "configKeys", FORGE_BASE_SUCCESS_RATE); - registerEnumIn(L, "configKeys", FORGE_BONUS_SUCCESS_RATE); - registerEnumIn(L, "configKeys", FORGE_TIER_LOSS_REDUCTION); - registerEnumIn(L, "configKeys", FORGE_AMOUNT_MULTIPLIER); - registerEnumIn(L, "configKeys", FORGE_INFLUENCED_CREATURES_LIMIT); - - registerEnumIn(L, "configKeys", BESTIARY_KILL_MULTIPLIER); - registerEnumIn(L, "configKeys", BOSSTIARY_KILL_MULTIPLIER); - registerEnumIn(L, "configKeys", BOOSTED_BOSS_SLOT); - registerEnumIn(L, "configKeys", BOOSTED_BOSS_LOOT_BONUS); - registerEnumIn(L, "configKeys", BOOSTED_BOSS_KILL_BONUS); - registerEnumIn(L, "configKeys", BESTIARY_RATE_CHARM_SHOP_PRICE); - - registerEnumIn(L, "configKeys", FAMILIAR_TIME); - - registerEnumIn(L, "configKeys", TOGGLE_GOLD_POUCH_ALLOW_ANYTHING); - registerEnumIn(L, "configKeys", TOGGLE_SERVER_IS_RETRO); - registerEnumIn(L, "configKeys", TOGGLE_TRAVELS_FREE); - registerEnumIn(L, "configKeys", BUY_AOL_COMMAND_FEE); - registerEnumIn(L, "configKeys", BUY_BLESS_COMMAND_FEE); - registerEnumIn(L, "configKeys", TELEPORT_PLAYER_TO_VOCATION_ROOM); - - registerEnumIn(L, "configKeys", HAZARD_SPAWN_PLUNDER_MULTIPLIER); - registerEnumIn(L, "configKeys", HAZARD_CRITICAL_INTERVAL); - registerEnumIn(L, "configKeys", HAZARD_CRITICAL_CHANCE); - registerEnumIn(L, "configKeys", HAZARD_CRITICAL_MULTIPLIER); - registerEnumIn(L, "configKeys", HAZARD_DAMAGE_MULTIPLIER); - registerEnumIn(L, "configKeys", HAZARD_DODGE_MULTIPLIER); - registerEnumIn(L, "configKeys", HAZARD_PODS_DROP_MULTIPLIER); - registerEnumIn(L, "configKeys", HAZARD_PODS_TIME_TO_DAMAGE); - registerEnumIn(L, "configKeys", HAZARD_PODS_TIME_TO_SPAWN); - registerEnumIn(L, "configKeys", HAZARD_EXP_BONUS_MULTIPLIER); - registerEnumIn(L, "configKeys", HAZARD_LOOT_BONUS_MULTIPLIER); - registerEnumIn(L, "configKeys", HAZARD_PODS_DAMAGE); - registerEnumIn(L, "configKeys", TOGGLE_HAZARDSYSTEM); - registerEnumIn(L, "configKeys", LOW_LEVEL_BONUS_EXP); - - registerEnumIn(L, "configKeys", LOYALTY_ENABLED); - registerEnumIn(L, "configKeys", LOYALTY_POINTS_PER_CREATION_DAY); - registerEnumIn(L, "configKeys", LOYALTY_POINTS_PER_PREMIUM_DAY_SPENT); - registerEnumIn(L, "configKeys", LOYALTY_POINTS_PER_PREMIUM_DAY_PURCHASED); - registerEnumIn(L, "configKeys", LOYALTY_BONUS_PERCENTAGE_MULTIPLIER); - - registerEnumIn(L, "configKeys", PARTY_SHARE_LOOT_BOOSTS); - registerEnumIn(L, "configKeys", PARTY_SHARE_LOOT_BOOSTS_DIMINISHING_FACTOR); - registerEnumIn(L, "configKeys", TIBIADROME_CONCOCTION_COOLDOWN); - registerEnumIn(L, "configKeys", TIBIADROME_CONCOCTION_DURATION); - registerEnumIn(L, "configKeys", TIBIADROME_CONCOCTION_TICK_TYPE); - - registerEnumIn(L, "configKeys", AUTH_TYPE); - registerEnumIn(L, "configKeys", RESET_SESSIONS_ON_STARTUP); - - registerEnumIn(L, "configKeys", TOGGLE_ATTACK_SPEED_ONFIST); - registerEnumIn(L, "configKeys", MULTIPLIER_ATTACKONFIST); - registerEnumIn(L, "configKeys", MAX_SPEED_ATTACKONFIST); - - registerEnumIn(L, "configKeys", M_CONST); - registerEnumIn(L, "configKeys", T_CONST); - registerEnumIn(L, "configKeys", PARALLELISM); - - registerEnumIn(L, "configKeys", AUTOLOOT); - - registerEnumIn(L, "configKeys", VIP_SYSTEM_ENABLED); - registerEnumIn(L, "configKeys", VIP_BONUS_EXP); - registerEnumIn(L, "configKeys", VIP_BONUS_LOOT); - registerEnumIn(L, "configKeys", VIP_BONUS_SKILL); - registerEnumIn(L, "configKeys", VIP_AUTOLOOT_VIP_ONLY); - registerEnumIn(L, "configKeys", VIP_STAY_ONLINE); - registerEnumIn(L, "configKeys", VIP_FAMILIAR_TIME_COOLDOWN_REDUCTION); - - registerEnumIn(L, "configKeys", TOGGLE_HOUSE_TRANSFER_ON_SERVER_RESTART); - - registerEnumIn(L, "configKeys", TOGGLE_RECEIVE_REWARD); -#undef registerEnumIn + for (auto value : magic_enum::enum_values()) { + auto enumName = magic_enum::enum_name(value).data(); + if (enumName) { + registerMagicEnumIn(L, "configKeys", value); + g_logger().debug("Registering ConfigManager enum name '{}' value '{}' to lua", enumName, fmt::underlying(value)); + } + } +#undef registerMagicEnumIn } int ConfigFunctions::luaConfigManagerGetString(lua_State* L) { - pushString(L, g_configManager().getString(getNumber(L, -1))); + pushString(L, g_configManager().getString(getNumber(L, -1))); return 1; } int ConfigFunctions::luaConfigManagerGetNumber(lua_State* L) { - lua_pushnumber(L, g_configManager().getNumber(getNumber(L, -1))); + lua_pushnumber(L, g_configManager().getNumber(getNumber(L, -1))); return 1; } int ConfigFunctions::luaConfigManagerGetBoolean(lua_State* L) { - pushBoolean(L, g_configManager().getBoolean(getNumber(L, -1))); + pushBoolean(L, g_configManager().getBoolean(getNumber(L, -1))); return 1; } int ConfigFunctions::luaConfigManagerGetFloat(lua_State* L) { - lua_pushnumber(L, g_configManager().getFloat(getNumber(L, -1))); + lua_pushnumber(L, g_configManager().getFloat(getNumber(L, -1))); return 1; } diff --git a/src/lua/functions/core/game/lua_enums.cpp b/src/lua/functions/core/game/lua_enums.cpp index f462aaae26a..5d566920c7b 100644 --- a/src/lua/functions/core/game/lua_enums.cpp +++ b/src/lua/functions/core/game/lua_enums.cpp @@ -18,7 +18,7 @@ #include "declarations.hpp" #include "game/functions/game_reload.hpp" -#define registerEnumClass(luaState, enumClassType) \ +#define registerMagicEnum(luaState, enumClassType) \ { \ auto number = magic_enum::enum_integer(enumClassType); \ auto name = magic_enum::enum_name(enumClassType).data(); \ @@ -26,7 +26,7 @@ } \ void(0) -#define registerEnumClassNamespace(luaState, luaNamespace, enumClassType) \ +#define registerMagicEnumNamespace(luaState, luaNamespace, enumClassType) \ { \ auto number = magic_enum::enum_integer(enumClassType); \ auto name = std::string(luaNamespace) + magic_enum::enum_name(enumClassType).data(); \ @@ -277,7 +277,7 @@ void LuaEnums::initCombatEnums(lua_State* L) { void LuaEnums::initCombatParamEnums(lua_State* L) { for (auto value : magic_enum::enum_values()) { - registerEnumClass(L, value); + registerMagicEnum(L, value); } } @@ -443,7 +443,7 @@ void LuaEnums::initConditionParamEnums(lua_State* L) { void LuaEnums::initAttributeConditionSubIdEnums(lua_State* L) { std::string luaNamespace = "AttrSubId_"; for (auto value : magic_enum::enum_values()) { - registerEnumClassNamespace(L, luaNamespace, value); + registerMagicEnumNamespace(L, luaNamespace, value); } } @@ -849,7 +849,7 @@ void LuaEnums::initItemTypeEnums(lua_State* L) { void LuaEnums::initFluidEnums(lua_State* L) { for (auto value : magic_enum::enum_values()) { - registerEnumClass(L, value); + registerMagicEnum(L, value); } } @@ -920,22 +920,22 @@ void LuaEnums::initItemIdEnums(lua_State* L) { void LuaEnums::initPlayerFlagEnums(lua_State* L) { for (auto value : magic_enum::enum_values()) { - registerEnumClass(L, value); + registerMagicEnum(L, value); } } void LuaEnums::initCreatureIconEnums(lua_State* L) { std::string luaNamespace = "CreatureIconCategory_"; for (auto value : magic_enum::enum_values()) { - registerEnumClassNamespace(L, luaNamespace, value); + registerMagicEnumNamespace(L, luaNamespace, value); } luaNamespace = "CreatureIconModifications_"; for (auto value : magic_enum::enum_values()) { - registerEnumClassNamespace(L, luaNamespace, value); + registerMagicEnumNamespace(L, luaNamespace, value); } luaNamespace = "CreatureIconQuests_"; for (auto value : magic_enum::enum_values()) { - registerEnumClassNamespace(L, luaNamespace, value); + registerMagicEnumNamespace(L, luaNamespace, value); } } @@ -1205,7 +1205,7 @@ void LuaEnums::initReturnValueEnums(lua_State* L) { // Reload void LuaEnums::initReloadTypeEnums(lua_State* L) { for (auto value : magic_enum::enum_values()) { - registerEnumClass(L, value); + registerMagicEnum(L, value); } } @@ -1231,7 +1231,7 @@ void LuaEnums::initCreaturesEventEnums(lua_State* L) { void LuaEnums::initForgeEnums(lua_State* L) { for (auto value : magic_enum::enum_values()) { - registerEnumClass(L, value); + registerMagicEnum(L, value); } } @@ -1245,7 +1245,7 @@ void LuaEnums::initWebhookEnums(lua_State* L) { void LuaEnums::initBosstiaryEnums(lua_State* L) { for (auto value : magic_enum::enum_values()) { - registerEnumClass(L, value); + registerMagicEnum(L, value); } } @@ -1769,30 +1769,30 @@ void LuaEnums::initSoundEnums(lua_State* L) { void LuaEnums::initWheelEnums(lua_State* L) { std::string wheelNamespace = "WHEEL_INSTANT_"; for (auto value : magic_enum::enum_values()) { - registerEnumClassNamespace(L, wheelNamespace, value); + registerMagicEnumNamespace(L, wheelNamespace, value); } wheelNamespace = "WHEEL_STAGE_"; for (auto value : magic_enum::enum_values()) { - registerEnumClassNamespace(L, wheelNamespace, value); + registerMagicEnumNamespace(L, wheelNamespace, value); } wheelNamespace = "WHEEL_GRADE_"; for (auto value : magic_enum::enum_values()) { - registerEnumClassNamespace(L, wheelNamespace, value); + registerMagicEnumNamespace(L, wheelNamespace, value); } wheelNamespace = "WHEEL_AVATAR_SKILL_"; for (auto value : magic_enum::enum_values()) { - registerEnumClassNamespace(L, wheelNamespace, value); + registerMagicEnumNamespace(L, wheelNamespace, value); } wheelNamespace = "WHEEL_STAT_"; for (auto value : magic_enum::enum_values()) { - registerEnumClassNamespace(L, wheelNamespace, value); + registerMagicEnumNamespace(L, wheelNamespace, value); } wheelNamespace = "WHEEL_BOOST_"; for (auto value : magic_enum::enum_values()) { - registerEnumClassNamespace(L, wheelNamespace, value); + registerMagicEnumNamespace(L, wheelNamespace, value); } } diff --git a/src/pch.hpp b/src/pch.hpp index 0f5775b73d3..04f692a0bf1 100644 --- a/src/pch.hpp +++ b/src/pch.hpp @@ -95,7 +95,18 @@ #include "lua/global/shared_object.hpp" -// Magic Enum +/** + * @brief Magic Enum is a C++ library that facilitates easy conversion between enums and strings. + * By default, the range of supported enum values is from -128 to 128. We need extends that range. + * + * @def MAGIC_ENUM_RANGE_MIN + * @note Sets the lower limit of the enum value range to -500. + * + * @def MAGIC_ENUM_RANGE_MAX + * @note Sets the upper limit of the enum value range to 500. + */ +#define MAGIC_ENUM_RANGE_MIN -500 +#define MAGIC_ENUM_RANGE_MAX 500 #include // Memory Mapped File diff --git a/src/server/network/protocol/protocollogin.cpp b/src/server/network/protocol/protocollogin.cpp index 1f0a3b57ad9..4c905f58fcb 100644 --- a/src/server/network/protocol/protocollogin.cpp +++ b/src/server/network/protocol/protocollogin.cpp @@ -77,7 +77,7 @@ void ProtocolLogin::getCharacterList(const std::string &accountDescriptor, const output->addString(g_configManager().getString(SERVER_NAME)); output->addString(g_configManager().getString(IP)); - output->add(g_configManager().getShortNumber(GAME_PORT)); + output->add(g_configManager().getNumber(GAME_PORT)); output->addByte(0); diff --git a/src/server/network/protocol/protocolstatus.cpp b/src/server/network/protocol/protocolstatus.cpp index f07e5e85d18..40dcffa646b 100644 --- a/src/server/network/protocol/protocolstatus.cpp +++ b/src/server/network/protocol/protocolstatus.cpp @@ -82,7 +82,7 @@ void ProtocolStatus::sendStatusString() { uint64_t uptime = (OTSYS_TIME() - ProtocolStatus::start) / 1000; serverinfo.append_attribute("uptime") = std::to_string(uptime).c_str(); serverinfo.append_attribute("ip") = g_configManager().getString(IP).c_str(); - serverinfo.append_attribute("servername") = g_configManager().getString(stringConfig_t::SERVER_NAME).c_str(); + serverinfo.append_attribute("servername") = g_configManager().getString(ConfigKey_t::SERVER_NAME).c_str(); serverinfo.append_attribute("port") = std::to_string(g_configManager().getNumber(LOGIN_PORT)).c_str(); serverinfo.append_attribute("location") = g_configManager().getString(LOCATION).c_str(); serverinfo.append_attribute("url") = g_configManager().getString(URL).c_str(); @@ -154,7 +154,7 @@ void ProtocolStatus::sendInfo(uint16_t requestedInfo, const std::string &charact if (requestedInfo & REQUEST_BASIC_SERVER_INFO) { output->addByte(0x10); - output->addString(g_configManager().getString(stringConfig_t::SERVER_NAME)); + output->addString(g_configManager().getString(ConfigKey_t::SERVER_NAME)); output->addString(g_configManager().getString(IP)); output->addString(std::to_string(g_configManager().getNumber(LOGIN_PORT))); }