bool ConfigManager::load() { lua_State* L = luaL_newstate(); if (!L) { throw std::runtime_error("Failed to allocate memory"); } luaL_openlibs(L); if (luaL_dofile(L, "config.lua")) { std::cout << "[Error - ConfigManager::load] " << lua_tostring(L, -1) << std::endl; lua_close(L); return false; } //parse config if (!loaded) { //info that must be loaded one time (unless we reset the modules involved) boolean[BIND_ONLY_GLOBAL_ADDRESS] = getGlobalBoolean(L, "bindOnlyGlobalAddress", false); boolean[OPTIMIZE_DATABASE] = getGlobalBoolean(L, "startupDatabaseOptimization", true); string[IP] = getGlobalString(L, "ip", "127.0.0.1"); string[MAP_NAME] = getGlobalString(L, "mapName", "forgotten"); string[MAP_AUTHOR] = getGlobalString(L, "mapAuthor", "Unknown"); string[HOUSE_RENT_PERIOD] = getGlobalString(L, "houseRentPeriod", "never"); string[MYSQL_HOST] = getGlobalString(L, "mysqlHost", "127.0.0.1"); string[MYSQL_USER] = getGlobalString(L, "mysqlUser", "forgottenserver"); string[MYSQL_PASS] = getGlobalString(L, "mysqlPass", ""); string[MYSQL_DB] = getGlobalString(L, "mysqlDatabase", "forgottenserver"); string[MYSQL_SOCK] = getGlobalString(L, "mysqlSock", ""); 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); } 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[ALLOW_CLONES] = getGlobalBoolean(L, "allowClones", false); 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_EQUIPMENT_SLOTS] = getGlobalBoolean(L, "classicEquipmentSlots", false); string[DEFAULT_PRIORITY] = getGlobalString(L, "defaultPriority", "high"); string[SERVER_NAME] = getGlobalString(L, "serverName", ""); string[OWNER_NAME] = getGlobalString(L, "ownerName", ""); string[OWNER_EMAIL] = getGlobalString(L, "ownerEmail", ""); string[URL] = getGlobalString(L, "url", ""); string[LOCATION] = getGlobalString(L, "location", ""); string[MOTD] = getGlobalString(L, "motd", ""); string[WORLD_TYPE] = getGlobalString(L, "worldType", "pvp"); 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", 5); integer[RATE_SKILL] = getGlobalNumber(L, "rateSkill", 3); integer[RATE_LOOT] = getGlobalNumber(L, "rateLoot", 2); integer[RATE_MAGIC] = getGlobalNumber(L, "rateMagic", 3); integer[RATE_SPAWN] = getGlobalNumber(L, "rateSpawn", 1); integer[HOUSE_PRICE] = getGlobalNumber(L, "housePriceEachSQM", 1000); integer[KILLS_TO_RED] = getGlobalNumber(L, "killsToRedSkull", 3); integer[KILLS_TO_BLACK] = getGlobalNumber(L, "killsToBlackSkull", 6); 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[EXP_FROM_PLAYERS_LEVEL_RANGE] = getGlobalNumber(L, "expFromPlayersLevelRange", 75); integer[MAX_PACKETS_PER_SECOND] = getGlobalNumber(L, "maxPacketsPerSecond", 25); loaded = true; lua_close(L); return true; }
bool ConfigManager::loadFile(const std::string& _filename) { if(L) lua_close(L); L = lua_open(); if(!L) return false; if(luaL_dofile(L, _filename.c_str())) { lua_close(L); L = NULL; return false; } // parse config if(!m_isLoaded) // info that must be loaded one time (unless we reset the modules involved) { m_confString[CONFIG_FILE] = _filename; // These settings might have been set from command line if(m_confString[IP] == "") m_confString[IP] = getGlobalString(L, "ip", "127.0.0.1"); if(m_confInteger[GAME_PORT] == 0) m_confInteger[GAME_PORT] = getGlobalNumber(L, "game_port"); if(m_confInteger[ADMIN_PORT] == 0) m_confInteger[ADMIN_PORT] = getGlobalNumber(L, "admin_port"); if(m_confInteger[LOGIN_PORT] == 0) m_confInteger[LOGIN_PORT] = getGlobalNumber(L, "login_port"); if(m_confInteger[STATUS_PORT] == 0) m_confInteger[STATUS_PORT] = getGlobalNumber(L, "status_port"); #if defined __CONFIG_V2__ unsigned int pos = _filename.rfind("/"); std::string configPath = ""; if(pos != std::string::npos) configPath = _filename.substr(0, pos+1); m_confString[DATA_DIRECTORY] = configPath + getGlobalString(L, "datadir", "data/"); m_confString[MAP_FILE] = m_confString[DATA_DIRECTORY] + getGlobalString(L, "map"); m_confString[MAP_STORE_FILE] = m_confString[DATA_DIRECTORY] + getGlobalString(L, "mapstore"); m_confString[HOUSE_STORE_FILE] = m_confString[DATA_DIRECTORY] + getGlobalString(L, "housestore"); #else m_confString[DATA_DIRECTORY] = getGlobalString(L, "datadir"); m_confString[MAP_FILE] = getGlobalString(L, "map"); m_confString[MAP_STORE_FILE] = getGlobalString(L, "mapstore"); m_confString[HOUSE_STORE_FILE] = getGlobalString(L, "housestore"); #endif m_confString[HOUSE_RENT_PERIOD] = getGlobalString(L, "houserentperiod", "monthly"); m_confString[MAP_KIND] = getGlobalString(L, "mapkind"); if(getGlobalString(L, "md5passwords") != ""){ std::cout << "Warning: [ConfigManager] md5passwords is deprecated. Use passwordtype instead." << std::endl; } m_confString[PASSWORD_TYPE_STR] = getGlobalString(L, "passwordtype"); m_confString[PASSWORD_SALT] = getGlobalString(L, "passwordsalt", ""); m_confString[WORLD_TYPE] = getGlobalString(L, "worldtype"); m_confString[SQL_HOST] = getGlobalString(L, "sql_host"); m_confString[SQL_USER] = getGlobalString(L, "sql_user"); m_confString[SQL_PASS] = getGlobalString(L, "sql_pass"); m_confString[SQL_DB] = getGlobalString(L, "sql_db"); m_confString[SQL_TYPE] = getGlobalString(L, "sql_type"); m_confInteger[SQL_PORT] = getGlobalNumber(L, "sql_port"); m_confInteger[PASSWORD_TYPE] = PASSWORD_TYPE_PLAIN; } m_confString[LOGIN_MSG] = getGlobalString(L, "loginmsg", "Welcome."); m_confString[SERVER_NAME] = getGlobalString(L, "servername"); m_confString[WORLD_NAME] = getGlobalString(L, "worldname", "OpenTibia"); m_confString[OWNER_NAME] = getGlobalString(L, "ownername"); m_confString[OWNER_EMAIL] = getGlobalString(L, "owneremail"); m_confString[URL] = getGlobalString(L, "url"); m_confString[LOCATION] = getGlobalString(L, "location"); m_confString[MAP_STORAGE_TYPE] = getGlobalString(L, "map_store_type", "relational"); m_confInteger[LOGIN_TRIES] = getGlobalNumber(L, "logintries", 5); m_confInteger[RETRY_TIMEOUT] = getGlobalNumber(L, "retrytimeout", 30 * 1000); m_confInteger[LOGIN_TIMEOUT] = getGlobalNumber(L, "logintimeout", 5 * 1000); m_confString[MOTD] = getGlobalString(L, "motd"); m_confInteger[MOTD_NUM] = getGlobalNumber(L, "motdnum"); m_confInteger[MAX_PLAYERS] = getGlobalNumber(L, "maxplayers"); m_confInteger[EXHAUSTED] = getGlobalNumber(L, "exhausted", 30000); m_confInteger[EXHAUSTED_ADD] = getGlobalNumber(L, "exhaustedadd", 5000); m_confInteger[COMBAT_EXHAUSTED] = getGlobalNumber(L, "fightexhausted", 2000); m_confInteger[HEAL_EXHAUSTED] = getGlobalNumber(L, "healexhausted", 1000); m_confInteger[STAIRHOP_EXHAUSTED] = getGlobalNumber(L, "stairhop_exhausted", 2*1000); m_confInteger[IN_FIGHT_DURATION] = getGlobalNumber(L, "in_fight_duration", 60 * 1000); m_confInteger[HUNTING_KILL_DURATION] = getGlobalNumber(L, "hunting_kill_duration", 60 * 1000); m_confInteger[FIELD_OWNERSHIP_DURATION] = getGlobalNumber(L, "field_ownership_duration", 5 * 1000); m_confInteger[MIN_ACTIONTIME] = getGlobalNumber(L, "minactioninterval", 200); m_confInteger[MIN_ACTIONEXTIME] = getGlobalNumber(L, "minactionexinterval", 1000); m_confInteger[DEFAULT_DESPAWNRANGE] = getGlobalNumber(L, "despawnrange", 2); m_confInteger[DEFAULT_DESPAWNRADIUS] = getGlobalNumber(L, "despawnradius", 50); m_confInteger[ALLOW_CLONES] = getGlobalBoolean(L, "allowclones", false); m_confInteger[PARTY_MEMBER_EXP_BONUS] = getGlobalNumber(L, "party_exp_mul", 5); m_confInteger[RATE_EXPERIENCE] = getGlobalNumber(L, "rate_exp", 1); m_confInteger[RATE_SKILL] = getGlobalNumber(L, "rate_skill", 1); m_confInteger[RATE_LOOT] = getGlobalNumber(L, "rate_loot", 1); m_confInteger[RATE_MAGIC] = getGlobalNumber(L, "rate_mag", 1); m_confInteger[RATE_SPAWN] = getGlobalNumber(L, "rate_spawn", 1); m_confInteger[RATE_STAMINA_LOSS] = getGlobalNumber(L, "rate_stamina_loss", 1); m_confInteger[RATE_STAMINA_GAIN] = getGlobalNumber(L, "rate_stamina_gain", 334); m_confInteger[SLOW_RATE_STAMINA_GAIN] = getGlobalNumber(L, "slow_rate_stamina_gain", 84); m_confInteger[STAMINA_EXTRA_EXPERIENCE_DURATION] = getGlobalNumber(L, "stamina_extra_experience_duration", 60 * 60 * 1000); m_confInteger[STAMINA_EXTRA_EXPERIENCE_ONLYPREM] = getGlobalBoolean(L, "stamina_extra_experience_onlyprem", true); m_confFloat[STAMINA_EXTRA_EXPERIENCE_RATE] = getGlobalFloat(L, "stamina_extra_experience_rate", 0.5); m_confInteger[HOTKEYS] = getGlobalBoolean(L, "enablehotkeys", false); m_confInteger[MAX_MESSAGEBUFFER] = getGlobalNumber(L, "maxmessagebuffer", 4); m_confInteger[SAVE_CLIENT_DEBUG_ASSERTIONS] = getGlobalBoolean(L, "saveclientdebug", true); m_confInteger[CHECK_ACCOUNTS] = getGlobalBoolean(L, "checkaccounts", true); m_confInteger[USE_BALANCE_HOUSE_PAYING] = getGlobalBoolean(L, "use_balance_house_paying", true); m_confInteger[PREMIUM_ONLY_BEDS] = getGlobalBoolean(L, "premonlybeds", true); m_confInteger[UNJUST_SKULL_DURATION] = getGlobalNumber(L, "unjust_skull_duration", 15*60*1000); m_confInteger[KILLS_PER_DAY_RED_SKULL] = getGlobalNumber(L, "kills_per_day_red_skull", 3); m_confInteger[KILLS_PER_WEEK_RED_SKULL] = getGlobalNumber(L, "kills_per_week_red_skull", 5); m_confInteger[KILLS_PER_MONTH_RED_SKULL] = getGlobalNumber(L, "kills_per_month_red_skull", 10); m_confInteger[KILLS_PER_DAY_BLACK_SKULL] = getGlobalNumber(L, "kills_per_day_black_skull", 6); m_confInteger[KILLS_PER_WEEK_BLACK_SKULL] = getGlobalNumber(L, "kills_per_week_black_skull", 10); m_confInteger[KILLS_PER_MONTH_BLACK_SKULL] = getGlobalNumber(L, "kills_per_month_black_skull", 20); m_confInteger[RED_SKULL_DURATION] = getGlobalNumber(L, "red_skull_duration", 30*24*60*60); m_confInteger[BLACK_SKULL_DURATION] = getGlobalNumber(L, "black_skull_duration", 45*24*60*60); m_confInteger[REMOVE_AMMUNITION] = getGlobalBoolean(L, "remove_ammunition", true); m_confInteger[REMOVE_RUNE_CHARGES] = getGlobalBoolean(L, "remove_rune_charges", true); m_confInteger[REMOVE_WEAPON_CHARGES] = getGlobalBoolean(L, "remove_weapon_charges", true); m_confInteger[LOGIN_ATTACK_DELAY] = getGlobalNumber(L, "login_attack_delay", 10*1000); m_confInteger[IDLE_TIME] = getGlobalNumber(L, "max_idle_time", 16*60*1000); m_confInteger[IDLE_TIME_WARNING] = getGlobalNumber(L, "max_idle_time_warning", 15*60*1000); m_confInteger[HOUSE_ONLY_PREMIUM] = getGlobalBoolean(L, "house_only_premium", true); m_confInteger[HOUSE_LEVEL] = getGlobalNumber(L, "house_level", 1); m_confInteger[HOUSE_TILE_PRICE] = getGlobalNumber(L, "house_tile_price", 100); m_confInteger[SHOW_HOUSE_PRICES] = getGlobalBoolean(L, "show_house_prices", false); m_confInteger[BROADCAST_BANISHMENTS] = getGlobalBoolean(L, "broadcast_banishments", false); m_confInteger[NOTATIONS_TO_BAN] = getGlobalNumber(L, "notations_to_banishment", 3); m_confInteger[WARNINGS_TO_FINALBAN] = getGlobalNumber(L, "warnings_to_final_banishment", 4); m_confInteger[WARNINGS_TO_DELETION] = getGlobalNumber(L, "warnings_to_deletion", 5); m_confInteger[BAN_LENGTH] = getGlobalNumber(L, "banishment_length", 7 * 86400); m_confInteger[FINALBAN_LENGTH] = getGlobalNumber(L, "final_banishment_length", 30 * 86400); m_confInteger[IPBANISHMENT_LENGTH] = getGlobalNumber(L, "ip_banishment_length", 86400); m_confInteger[ALLOW_GAMEMASTER_MULTICLIENT] = getGlobalBoolean(L, "allow_gamemaster_multiclient", false); m_confInteger[DEATH_ASSIST_COUNT] = getGlobalNumber(L, "death_assist_count", 1); m_confInteger[LAST_HIT_PZBLOCK_ONLY] = getGlobalBoolean(L, "last_hit_pzblock_only", true); m_confInteger[DEFENSIVE_PZ_LOCK] = getGlobalBoolean(L, "defensive_pz_lock", false); m_confInteger[NPC_MAX_NONESTACKABLE_SELL_AMOUNT] = getGlobalNumber(L, "npc_max_nonestackable_sell_amount", 100); m_confInteger[DISTANCE_WEAPON_INTERRUPT_SWING] = getGlobalBoolean(L, "distance_weapon_interrupt_swing", true); m_confInteger[RATES_FOR_PLAYER_KILLING] = getGlobalBoolean(L, "rates_for_player_killing", false); m_confInteger[RATE_EXPERIENCE_PVP] = getGlobalNumber(L, "rate_exp_pvp", 0); m_confInteger[ADDONS_ONLY_FOR_PREMIUM] = getGlobalBoolean(L, "addons_only_for_premium", true); m_confInteger[FIST_STRENGTH] = getGlobalNumber(L, "fist_strength", 7); m_confInteger[GUILD_WAR_FEE] = getGlobalNumber(L, "guild_war_fee", 1000); m_confInteger[STATUSQUERY_TIMEOUT] = getGlobalNumber(L, "statustimeout", 30 * 1000); m_confInteger[SHOW_NEW_SKILL_LEVEL] = getGlobalBoolean(L, "show_new_skill_level", false); m_confInteger[SHOW_HEALING] = getGlobalBoolean(L, "show_healing", false); m_confInteger[ORANGE_SPELL_TEXT] = getGlobalBoolean(L, "orange_spell_text", false); m_confInteger[SHOW_DEATH_WINDOW] = getGlobalBoolean(L, "show_death_window", true); m_confInteger[CAN_ROPE_CREATURES] = getGlobalBoolean(L, "can_rope_creatures", true); m_confString[DEATH_MSG] = getGlobalString(L, "death_msg", "You are dead."); m_confInteger[CAN_ATTACK_INVISIBLE] = getGlobalBoolean(L, "can_attack_invisible", false); m_confInteger[CAN_PASS_THROUGH] = getGlobalBoolean(L, "can_pass_through", true); m_confInteger[MIN_PVP_LEVEL] = getGlobalNumber(L, "min_pvp_level", 0); m_confInteger[MW_DISAPPEAR_ON_WALK] = getGlobalBoolean(L, "magic_wall_disappear_on_walk", true); #ifdef __MIN_PVP_LEVEL_APPLIES_TO_SUMMONS__ m_confInteger[MIN_PVP_LEVEL_APPLIES_TO_SUMMONS] = getGlobalBoolean(L, "min_pvp_level_applies_to_summons", true); #endif m_confInteger[HEIGHT_MINIMUM_FOR_IDLE] = getGlobalNumber(L, "height_minimum_for_idle", 3); m_confInteger[EXPERIENCE_STAGES] = getGlobalBoolean(L, "experience_stages", false); m_confInteger[PUSH_INTERVAL] = getGlobalNumber(L, "push_interval", 2000); m_confInteger[MOVEITEM_TIME] = getGlobalNumber(L, "move_item_interval", 500); m_confInteger[MAX_STACK_SIZE] = getGlobalNumber(L, "max_stack_size", 1000); m_confInteger[PVP_DAMAGE] = getGlobalNumber(L, "pvp_damage", 50); m_confInteger[PVP_DAMAGE_AT_BLACK_SKULLS] = getGlobalNumber(L, "pvp_damage_at_black_skulls", 100); m_confInteger[WANDS_INTERRUPT_SWING] = getGlobalBoolean(L, "wands_interrupt_swing", true); m_confInteger[PLAYER_QUERYDESTINATION_DEEPNESS] = getGlobalNumber(L, "player_querydestination_deepness", -1); m_confInteger[TILE_LIMIT] = getGlobalNumber(L, "tile_limit", 0); m_confInteger[PROTECTION_TILE_LIMIT] = getGlobalNumber(L, "protection_tile_limit", 0); m_confInteger[HOUSE_TILE_LIMIT] = getGlobalNumber(L, "house_tile_limit", 0); m_confInteger[LUA_EXCEPTED_TYPE_ERRORS_ENABLED] = getGlobalBoolean(L, "lua_excepted_type_errors_enabled", false); m_confInteger[MAX_AMOUNT_ITEMS_INSIDE_CONTAINERS] = getGlobalNumber(L, "max_amount_items_inside_containers", 2000); m_confInteger[MAX_DEEPNESS_OF_CHAIN_OF_CONTAINERS] = getGlobalNumber(L, "max_deepness_of_chain_of_containers", 500); m_confInteger[BIND_ONLY_GLOBAL_ADDRESS] = getGlobalBoolean(L, "bind_only_global_address", false); m_confInteger[MAX_CONTAINERS_INSIDE_PLAYER_INVENTORY] = getGlobalNumber(L, "max_containers_inside_player_inventory", 100); m_confInteger[GUILD_WARS_END_ONLY_ON_STARTUP] = getGlobalBoolean(L, "guild_wars_end_only_on_startup", true); m_isLoaded = true; return true; }
bool ConfigManager::load() { lua_State* L = luaL_newstate(); if (!L) { throw std::runtime_error("Failed to allocate memory"); } luaL_openlibs(L); if (luaL_dofile(L, "config.lua")) { std::cout << "[Error - ConfigManager::load] " << lua_tostring(L, -1) << std::endl; lua_close(L); return false; } //parse config if (!loaded) { //info that must be loaded one time (unless we reset the modules involved) boolean[BIND_ONLY_GLOBAL_ADDRESS] = getGlobalBoolean(L, "bindOnlyGlobalAddress", false); boolean[OPTIMIZE_DATABASE] = getGlobalBoolean(L, "startupDatabaseOptimization", true); string[IP] = getGlobalString(L, "ip", "127.0.0.1"); string[MYSQL_HOST] = getGlobalString(L, "mysqlHost", "127.0.0.1"); string[MYSQL_USER] = getGlobalString(L, "mysqlUser", "forgottenserver"); string[MYSQL_PASS] = getGlobalString(L, "mysqlPass", ""); string[MYSQL_DB] = getGlobalString(L, "mysqlDatabase", "forgottenserver"); string[MYSQL_SOCK] = getGlobalString(L, "mysqlSock", ""); string[CLIENT_VERSION_STR] = getGlobalString(L, "clientVersionStr", "10.80"); integer[SQL_PORT] = getGlobalNumber(L, "mysqlPort", 3306); integer[LOGIN_PORT] = getGlobalNumber(L, "port", 7171); integer[CLIENT_VERSION_MIN] = getGlobalNumber(L, "clientVersionMin", 1080); integer[CLIENT_VERSION_MAX] = getGlobalNumber(L, "clientVersionMax", 1080); integer[STATUS_PORT] = getGlobalNumber(L, "statusProtocolPort", 7171); string[MAP_NAME] = getGlobalString(L, "mapName", "forgotten"); string[MAP_AUTHOR] = getGlobalString(L, "mapAuthor", "Unknown"); } boolean[FREE_PREMIUM] = getGlobalBoolean(L, "freePremium", false); string[DEFAULT_PRIORITY] = getGlobalString(L, "defaultPriority", "high"); string[SERVER_NAME] = getGlobalString(L, "serverName", ""); string[OWNER_NAME] = getGlobalString(L, "ownerName", ""); string[OWNER_EMAIL] = getGlobalString(L, "ownerEmail", ""); string[URL] = getGlobalString(L, "url", ""); string[LOCATION] = getGlobalString(L, "location", ""); string[MOTD] = getGlobalString(L, "motd", ""); integer[MOTD_NUM] = getGlobalNumber(L, "motdNum", 0); integer[MAX_PLAYERS] = getGlobalNumber(L, "maxPlayers"); integer[RATE_EXPERIENCE] = getGlobalNumber(L, "rateExp", 5); integer[RATE_SKILL] = getGlobalNumber(L, "rateSkill", 3); integer[RATE_LOOT] = getGlobalNumber(L, "rateLoot", 2); integer[RATE_MAGIC] = getGlobalNumber(L, "rateMagic", 3); integer[RATE_SPAWN] = getGlobalNumber(L, "rateSpawn", 1); integer[STATUSQUERY_TIMEOUT] = getGlobalNumber(L, "statusTimeout", 5000); integer[MAX_PACKETS_PER_SECOND] = getGlobalNumber(L, "maxPacketsPerSecond", 25); integer[MONSTER_COUNT] = getGlobalNumber(L, "monsterCount", 0); integer[NPC_COUNT] = getGlobalNumber(L, "npcCount", 0); integer[MAP_WIDTH] = getGlobalNumber(L, "mapWidth", 0); integer[MAP_HEIGHT] = getGlobalNumber(L, "mapHeight", 0); loaded = true; lua_close(L); return true; }
bool ConfigManager::loadConfigData() { loadMOTD(); loadRevision(); if (!loadConfigFile()) return false; makeLogin = getGlobalByte("MakeLogin"); makeZone = getGlobalByte("MakeZone"); makePing = getGlobalByte("MakePing"); makeStatus = getGlobalByte("MakeStatus"); makeWeb = getGlobalByte("MakeWeb"); orbNamingDirectoryAddress = getGlobalString("ORB"); dBHost = getGlobalString("DBHost"); dBPort = getGlobalShort("DBPort"); dBName = getGlobalString("DBName"); dBUser = getGlobalString("DBUser"); dBPass = getGlobalString("DBPass"); dBSecret = getGlobalString("DBSecret"); mantisHost = getGlobalString("MantisHost"); mantisPort = getGlobalShort("MantisPort"); mantisName = getGlobalString("MantisName"); mantisUser = getGlobalString("MantisUser"); mantisPass = getGlobalString("MantisPass"); mantisPrfx = getGlobalString("MantisPrfx"); trePath = getGlobalString("TrePath"); loadTreFileList(); loadEnabledZones(); statusPort = getGlobalShort("StatusPort"); pingPort = getGlobalShort("PingPort"); pingAllowedConnections = getGlobalInt("PingAllowedConnections"); loginRequiredVersion = getGlobalString("LoginRequiredVersion"); loginPort = getGlobalShort("LoginPort"); loginProcessingThreads = getGlobalInt("LoginProcessingThreads"); loginAllowedConnections = getGlobalInt("LoginAllowedConnections"); autoReg = getGlobalByte("AutoReg"); zoneProcessingThreads = getGlobalInt("ZoneProcessingThreads"); zoneAllowedConnections = getGlobalInt("ZoneAllowedConnections"); zoneGalaxyID = getGlobalInt("ZoneGalaxyID"); zoneOnlineCharactersPerAccount = getGlobalInt("ZoneOnlineCharactersPerAccount"); statusAllowedConnections = getGlobalInt("StatusAllowedConnections"); statusInterval = getGlobalInt("StatusInterval"); webPorts = getGlobalString("WebPorts"); webAccessLog = getGlobalString("WebAccessLog"); webErrorLog = getGlobalString("WebErrorLog"); webSessionTimeout = getGlobalInt("WebSessionTimeout"); progressMonitors = getGlobalBoolean("ProgressMonitors"); purgeDeletedCharacters = getGlobalInt("PurgeDeletedCharacters"); return true; }