Advertisement
Rellyx

configmanager.h

Sep 22nd, 2018
245
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.29 KB | None | 0 0
  1. /**
  2.  * The Forgotten Server - a free and open-source MMORPG server emulator
  3.  * Copyright (C) 2018  Mark Samman <mark.samman@gmail.com>
  4.  *
  5.  * This program is free software; you can redistribute it and/or modify
  6.  * it under the terms of the GNU General Public License as published by
  7.  * the Free Software Foundation; either version 2 of the License, or
  8.  * (at your option) any later version.
  9.  *
  10.  * This program is distributed in the hope that it will be useful,
  11.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13.  * GNU General Public License for more details.
  14.  *
  15.  * You should have received a copy of the GNU General Public License along
  16.  * with this program; if not, write to the Free Software Foundation, Inc.,
  17.  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  18.  */
  19.  
  20. #ifndef FS_CONFIGMANAGER_H_6BDD23BD0B8344F4B7C40E8BE6AF6F39
  21. #define FS_CONFIGMANAGER_H_6BDD23BD0B8344F4B7C40E8BE6AF6F39
  22.  
  23. class ConfigManager
  24. {
  25.     public:
  26.         enum boolean_config_t {
  27.             ALLOW_CHANGEOUTFIT,
  28.             ONE_PLAYER_ON_ACCOUNT,
  29.             AIMBOT_HOTKEY_ENABLED,
  30.             REMOVE_RUNE_CHARGES,
  31.             EXPERIENCE_FROM_PLAYERS,
  32.             FREE_PREMIUM,
  33.             REPLACE_KICK_ON_LOGIN,
  34.             ALLOW_CLONES,
  35.             BIND_ONLY_GLOBAL_ADDRESS,
  36.             OPTIMIZE_DATABASE,
  37.             MARKET_PREMIUM,
  38.             EMOTE_SPELLS,
  39.             STAMINA_SYSTEM,
  40.             WARN_UNSAFE_SCRIPTS,
  41.             CONVERT_UNSAFE_SCRIPTS,
  42.             CLASSIC_EQUIPMENT_SLOTS,
  43.             CLASSIC_ATTACK_SPEED,
  44.             ALLOW_DUAL_WIELDING,
  45.  
  46.             LAST_BOOLEAN_CONFIG /* this must be the last one */
  47.         };
  48.  
  49.         enum string_config_t {
  50.             MAP_NAME,
  51.             HOUSE_RENT_PERIOD,
  52.             SERVER_NAME,
  53.             OWNER_NAME,
  54.             OWNER_EMAIL,
  55.             URL,
  56.             LOCATION,
  57.             IP,
  58.             MOTD,
  59.             WORLD_TYPE,
  60.             MYSQL_HOST,
  61.             MYSQL_USER,
  62.             MYSQL_PASS,
  63.             MYSQL_DB,
  64.             MYSQL_SOCK,
  65.             DEFAULT_PRIORITY,
  66.             MAP_AUTHOR,
  67.  
  68.             LAST_STRING_CONFIG /* this must be the last one */
  69.         };
  70.  
  71.         enum integer_config_t {
  72.             SQL_PORT,
  73.             MAX_PLAYERS,
  74.             PZ_LOCKED,
  75.             DEFAULT_DESPAWNRANGE,
  76.             DEFAULT_DESPAWNRADIUS,
  77.             RATE_EXPERIENCE,
  78.             RATE_SKILL,
  79.             RATE_LOOT,
  80.             RATE_MAGIC,
  81.             RATE_SPAWN,
  82.             HOUSE_PRICE,
  83.             KILLS_TO_RED,
  84.             KILLS_TO_BLACK,
  85.             MAX_MESSAGEBUFFER,
  86.             DUAL_WIELDING_SPEED_RATE,
  87.             DUAL_WIELDING_DAMAGE_RATE,
  88.             ACTIONS_DELAY_INTERVAL,
  89.             EX_ACTIONS_DELAY_INTERVAL,
  90.             KICK_AFTER_MINUTES,
  91.             PROTECTION_LEVEL,
  92.             DEATH_LOSE_PERCENT,
  93.             STATUSQUERY_TIMEOUT,
  94.             FRAG_TIME,
  95.             WHITE_SKULL_TIME,
  96.             GAME_PORT,
  97.             LOGIN_PORT,
  98.             STATUS_PORT,
  99.             STAIRHOP_DELAY,
  100.             MARKET_OFFER_DURATION,
  101.             CHECK_EXPIRED_MARKET_OFFERS_EACH_MINUTES,
  102.             MAX_MARKET_OFFERS_AT_A_TIME_PER_PLAYER,
  103.             EXP_FROM_PLAYERS_LEVEL_RANGE,
  104.             MAX_PACKETS_PER_SECOND,
  105.  
  106.             LAST_INTEGER_CONFIG /* this must be the last one */
  107.         };
  108.  
  109.         enum floating_config_t {
  110.             MLVL_BONUSDMG,
  111.             MLVL_BONUSSPEED,
  112.             MLVL_BONUSHP,
  113.             LAST_FLOATING_CONFIG
  114.         };
  115.  
  116.         bool load();
  117.         bool reload();
  118.  
  119.         const std::string& getString(string_config_t what) const;
  120.         int32_t getNumber(integer_config_t what) const;
  121.         bool getBoolean(boolean_config_t what) const;
  122.         float getFloat(floating_config_t what) const;
  123.  
  124.     private:
  125.         std::string string[LAST_STRING_CONFIG] = {};
  126.         int32_t integer[LAST_INTEGER_CONFIG] = {};
  127.         bool boolean[LAST_BOOLEAN_CONFIG] = {};
  128.         float floating[LAST_FLOATING_CONFIG] = {};
  129.  
  130.         bool loaded = false;
  131. };
  132.  
  133. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement