diff --git a/apps/openmw-mp/Player.cpp b/apps/openmw-mp/Player.cpp index 319cc7214..111747618 100644 --- a/apps/openmw-mp/Player.cpp +++ b/apps/openmw-mp/Player.cpp @@ -67,6 +67,9 @@ void Player::Init(LuaState &lua) "getSkill", &Player::getSkill, "setSkill", &Player::setSkill, + "getSkillIncrease", &Player::getSkillIncrease, + "setSkillIncrease", &Player::setSkillIncrease, + "getClass", &Player::getCharClass, "getSettings", &Player::getSettings, "getBooks", &Player::getBooks, @@ -483,16 +486,16 @@ void Player::setAttribute(unsigned short id, int base, int current) attributesChanged = true; } -std::tuple Player::getSkill(unsigned short id) const +std::tuple Player::getSkill(unsigned short id) const { if (id >= ESM::Skill::Length) - return make_tuple(0, 0, 0.0f, 0); + return make_tuple(0, 0, 0.0f); const auto &skill = npcStats.mSkills[id]; - return make_tuple(skill.mBase, skill.mCurrent, skill.mProgress, npcStats.mSkillIncrease[id]); + return make_tuple(skill.mBase, skill.mCurrent, skill.mProgress); } -void Player::setSkill(unsigned short id, int base, int current, float progress, int increase) +void Player::setSkill(unsigned short id, int base, int current, float progress) { if (id >= ESM::Skill::Length) return; @@ -501,7 +504,21 @@ void Player::setSkill(unsigned short id, int base, int current, float progress, skill.mBase = base; skill.mCurrent = current; skill.mProgress = progress; - npcStats.mSkillIncrease[id] = increase; + + skillsChanged = true; +} + +int Player::getSkillIncrease(unsigned short attributeId) const +{ + return npcStats.mSkillIncrease[attributeId]; +} + +void Player::setSkillIncrease(unsigned short attributeId, int increase) +{ + if (attributeId >= ESM::Attribute::Length) + return; + + npcStats.mSkillIncrease[attributeId] = increase; skillsChanged = true; } diff --git a/apps/openmw-mp/Player.hpp b/apps/openmw-mp/Player.hpp index 91c33f098..37bf427df 100644 --- a/apps/openmw-mp/Player.hpp +++ b/apps/openmw-mp/Player.hpp @@ -158,8 +158,11 @@ public: * * @return base, current, progress, increase */ - std::tuple getSkill(unsigned short id) const; - void setSkill(unsigned short id, int base, int current, float progress, int increase); + std::tuple getSkill(unsigned short id) const; + void setSkill(unsigned short id, int base, int current, float progress); + + int getSkillIncrease(unsigned short attributeId) const; + void setSkillIncrease(unsigned short attributeId, int increase); CellState getCellState(int i); size_t cellStateSize() const;