Guest User

Untitled

a guest
Oct 15th, 2018
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.15 KB | None | 0 0
  1. /**
  2. * The Forgotten Server - a free and open-source MMORPG server emulator
  3. * Copyright (C) 2015 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. #include <lua.hpp>
  24.  
  25. class ConfigManager
  26. {
  27. public:
  28. ConfigManager();
  29.  
  30. enum boolean_config_t {
  31. ALLOW_CHANGEOUTFIT = 0,
  32. ONE_PLAYER_ON_ACCOUNT = 1,
  33. AIMBOT_HOTKEY_ENABLED = 2,
  34. REMOVE_RUNE_CHARGES = 3,
  35. EXPERIENCE_FROM_PLAYERS = 4,
  36. ALLOW_FIGHT_BACK = 5,
  37. FREE_PREMIUM = 6,
  38. REPLACE_KICK_ON_LOGIN = 7,
  39. ALLOW_CLONES = 8,
  40. BIND_ONLY_GLOBAL_ADDRESS = 9,
  41. OPTIMIZE_DATABASE = 10,
  42. MARKET_PREMIUM = 11,
  43. EMOTE_SPELLS = 12,
  44. STAMINA_SYSTEM = 13,
  45. WARN_UNSAFE_SCRIPTS = 14,
  46. CONVERT_UNSAFE_SCRIPTS = 15,
  47. CLASSIC_EQUIPMENT_SLOTS = 16,
  48. ROOKGAARD_SYSTEM = 17,
  49. UNFAIR_FIGHT_SYSTEM = 18,
  50. LAST_BOOLEAN_CONFIG /* this must be the last one */
  51. };
  52.  
  53. enum string_config_t {
  54. DUMMY_STR = 0,
  55. MAP_NAME = 1,
  56. HOUSE_RENT_PERIOD = 2,
  57. SERVER_NAME = 3,
  58. OWNER_NAME = 4,
  59. OWNER_EMAIL = 5,
  60. URL = 6,
  61. LOCATION = 7,
  62. IP = 8,
  63. MOTD = 9,
  64. WORLD_TYPE = 10,
  65. MYSQL_HOST = 11,
  66. MYSQL_USER = 12,
  67. MYSQL_PASS = 13,
  68. MYSQL_DB = 14,
  69. MYSQL_SOCK = 15,
  70. DEFAULT_PRIORITY = 16,
  71. MAP_AUTHOR = 17,
  72. LAST_STRING_CONFIG /* this must be the last one */
  73. };
  74.  
  75. enum integer_config_t {
  76. SQL_PORT = 0,
  77. MAX_PLAYERS = 1,
  78. PZ_LOCKED = 2,
  79. DEFAULT_DESPAWNRANGE = 3,
  80. DEFAULT_DESPAWNRADIUS = 4,
  81. RATE_EXPERIENCE = 5,
  82. RATE_SKILL = 6,
  83. RATE_LOOT = 7,
  84. RATE_MAGIC = 8,
  85. RATE_SPAWN = 9,
  86. HOUSE_PRICE = 10,
  87. KILLS_TO_RED = 11,
  88. KILLS_TO_BLACK = 12,
  89. MAX_MESSAGEBUFFER = 13,
  90. ACTIONS_DELAY_INTERVAL = 14,
  91. EX_ACTIONS_DELAY_INTERVAL = 15,
  92. KICK_AFTER_MINUTES = 16,
  93. PROTECTION_LEVEL = 17,
  94. DEATH_LOSE_PERCENT = 18,
  95. STATUSQUERY_TIMEOUT = 19,
  96. FRAG_TIME = 20,
  97. WHITE_SKULL_TIME = 21,
  98. GAME_PORT = 22,
  99. LOGIN_PORT = 23,
  100. STATUS_PORT = 24,
  101. STAIRHOP_DELAY = 25,
  102. MARKET_OFFER_DURATION = 26,
  103. CHECK_EXPIRED_MARKET_OFFERS_EACH_MINUTES = 27,
  104. MAX_MARKET_OFFERS_AT_A_TIME_PER_PLAYER = 28,
  105. EXP_FROM_PLAYERS_LEVEL_RANGE = 29,
  106. MAX_PACKETS_PER_SECOND = 30,
  107. HOUSE_TILE_LIMIT = 31,
  108. MASS_BATTLE_AREA_LIMIT = 32,
  109. MASS_BATTLE_AREA_SKULLS = 33,
  110. ROOKGAARD_LEVEL_TO = 34,
  111. ROOKGAARD_LEVEL_FROM = 35,
  112. ROOKGAARD_TOWN = 36,
  113. KILLS_TO_BAN = 37,
  114. KILLS_BAN_LENGTH = 38,
  115. LAST_INTEGER_CONFIG /* this must be the last one */
  116. };
  117.  
  118. enum floating_config_t {
  119. MLVL_BONUSDMG,
  120. MLVL_BONUSSPEED,
  121. MLVL_BONUSHP,
  122. LAST_FLOATING_CONFIG
  123. };
  124.  
  125. bool load();
  126. bool reload();
  127.  
  128. const std::string& getString(string_config_t _what) const;
  129. int32_t getNumber(integer_config_t _what) const;
  130. bool getBoolean(boolean_config_t _what) const;
  131. float getFloat(floating_config_t _what) const;
  132.  
  133. private:
  134. static std::string getGlobalString(lua_State* _L, const std::string& _identifier, const char* _default);
  135. static int32_t getGlobalNumber(lua_State* _L, const std::string& _identifier, const int32_t _default = 0);
  136. static float getGlobalFloat(lua_State* _L, const std::string& _identifier, const float _defaultValue = 0.0);
  137.  
  138. bool m_isLoaded;
  139. std::string m_confString[LAST_STRING_CONFIG];
  140. int32_t m_confInteger[LAST_INTEGER_CONFIG];
  141. bool m_confBoolean[LAST_BOOLEAN_CONFIG];
  142. float floating[LAST_FLOATING_CONFIG];
  143. };
  144.  
  145. #endif
Add Comment
Please, Sign In to add comment