{"action":"closed","issue":{"url":"https://api.github.com/repos/TwistedScorpio/OTHire/issues/113","repository_url":"https://api.github.com/repos/TwistedScorpio/OTHire","labels_url":"https://api.github.com/repos/TwistedScorpio/OTHire/issues/113/labels{/name}","comments_url":"https://api.github.com/repos/TwistedScorpio/OTHire/issues/113/comments","events_url":"https://api.github.com/repos/TwistedScorpio/OTHire/issues/113/events","html_url":"https://github.com/TwistedScorpio/OTHire/issues/113","id":189029085,"number":113,"title":"Maximum level","user":{"login":"LaloHao","id":3666858,"avatar_url":"https://avatars.githubusercontent.com/u/3666858?v=3","gravatar_id":"","url":"https://api.github.com/users/LaloHao","html_url":"https://github.com/LaloHao","followers_url":"https://api.github.com/users/LaloHao/followers","following_url":"https://api.github.com/users/LaloHao/following{/other_user}","gists_url":"https://api.github.com/users/LaloHao/gists{/gist_id}","starred_url":"https://api.github.com/users/LaloHao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LaloHao/subscriptions","organizations_url":"https://api.github.com/users/LaloHao/orgs","repos_url":"https://api.github.com/users/LaloHao/repos","events_url":"https://api.github.com/users/LaloHao/events{/privacy}","received_events_url":"https://api.github.com/users/LaloHao/received_events","type":"User","site_admin":false},"labels":[{"id":88582138,"url":"https://api.github.com/repos/TwistedScorpio/OTHire/labels/question","name":"question","color":"cc317c","default":true}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-11-14T04:59:27Z","updated_at":"2016-11-25T07:06:55Z","closed_at":"2016-11-25T07:06:55Z","body":"I'm trying to limit the maximum level of players, what i've modified:\r\n\r\n```diff\r\nmodified   source/configmanager.cpp\r\n@@ -205,7 +205,8 @@ bool ConfigManager::loadFile(const std::string& _filename)\r\n \tm_confInteger[USE_RUNE_LEVEL_REQUIREMENTS] = getGlobalBoolean(L, \"use_rune_level_requirements\", true);\r\n \tm_confInteger[CONTAINER_ITEMS_AUTO_STACK] = getGlobalBoolean(L, \"container_items_auto_stack\", false);\r\n \tm_confInteger[KILLS_TO_BAN] = getGlobalNumber(L, \"kills_to_ban\", 20);\r\n-\t\r\n+\tm_confInteger[MAX_LEVEL] = getGlobalNumber(L, \"max_level\", 100);\r\n+\r\n \tm_isLoaded = true;\r\n \treturn true;\r\n }\r\nmodified   source/configmanager.h\r\n@@ -163,6 +163,7 @@ public:\r\n \t\tMAX_CONTAINERS_INSIDE_PLAYER_INVENTORY,\r\n \t\tUSE_RUNE_LEVEL_REQUIREMENTS,\r\n \t\tCONTAINER_ITEMS_AUTO_STACK,\r\n+                MAX_LEVEL,\r\n \t\tLAST_INTEGER_CONFIG /* this must be the last one */\r\n \t};\r\n \r\nmodified   source/player.cpp\r\n@@ -2128,11 +2128,11 @@ void Player::addExperience(uint64_t exp)\r\n \r\n \tuint64_t currLevelExp = Player::getExpForLevel(newLevel);\r\n \tuint64_t nextLevelExp = Player::getExpForLevel(newLevel + 1);\r\n-\tif(nextLevelExp < currLevelExp) {\r\n+\tif(newLevel +1 > g_config.getNumber(ConfigManager::MAX_LEVEL)) {\r\n \t\t// Cannot gain more experience\r\n \t\t// Perhaps some sort of notice should be printed here?\r\n \t\tlevelPercent = 0;\r\n-\t\tsendStats();\r\n+\t\t// sendStats();\r\n \t\treturn;\r\n \t}\r\n \twhile(experience >= nextLevelExp) \r\n```\r\n\r\nThe player is still getting exp and if he logouts the player exp is saved\r\nIf the player gets the required exp to level up nothing happens and when he logouts the player exp is returned to the previous level.\r\n\r\nI am obviously missing something important here, i dont want the player getting any exp after the maximum level so they dont accumulate and level up multiple levels when i move the MAX_LEVEL in config\r\n\r\nEDIT: It works but the behaviour i described seems strange, i don't want to bug the players stats, last time i destroyed my own player lol"}}
{"actor":{"display_login":"LaloHao"}}