From 481e9f914a63c5ed9bf572797f9b97dcb4c36549 Mon Sep 17 00:00:00 2001 From: Marco Date: Tue, 14 May 2024 13:29:42 -0300 Subject: [PATCH] fix: experience formula --- data/scripts/talkactions/god/add_skill.lua | 3 +-- src/creatures/players/player.hpp | 5 ++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/data/scripts/talkactions/god/add_skill.lua b/data/scripts/talkactions/god/add_skill.lua index 20644582325..f822a9b9013 100644 --- a/data/scripts/talkactions/god/add_skill.lua +++ b/data/scripts/talkactions/god/add_skill.lua @@ -17,8 +17,7 @@ local function getSkillId(skillName) end local function getExpForLevel(level) - level = level - 1 - return ((50 * level * level * level) - (150 * level * level) + (400 * level)) / 3 + return math.floor((((level - 6) * level + 17) * level - 12) / 6) * 100 end local addSkill = TalkAction("/addskill") diff --git a/src/creatures/players/player.hpp b/src/creatures/players/player.hpp index b3bdd875b20..086f64a7c19 100644 --- a/src/creatures/players/player.hpp +++ b/src/creatures/players/player.hpp @@ -227,9 +227,8 @@ class Player final : public Creature, public Cylinder, public Bankable { void addList() override; void removePlayer(bool displayEffect, bool forced = true); - static uint64_t getExpForLevel(int32_t lv) { - lv--; - return ((50ULL * lv * lv * lv) - (150ULL * lv * lv) + (400ULL * lv)) / 3ULL; + static uint64_t getExpForLevel(uint64_t lv) { + return (((lv - 6ULL) * lv + 17ULL) * lv - 12ULL) / 6ULL * 100ULL; } uint16_t getStaminaMinutes() const {