diff --git a/apps/openmw-mp/Script/Functions/Stats.cpp b/apps/openmw-mp/Script/Functions/Stats.cpp index 2c0928e61..dbe108a52 100644 --- a/apps/openmw-mp/Script/Functions/Stats.cpp +++ b/apps/openmw-mp/Script/Functions/Stats.cpp @@ -386,6 +386,28 @@ void StatsFunctions::SetSkillCurrent(unsigned short pid, unsigned short skill, i player->NpcStats()->mSkills[skill].mCurrent = value; } +int StatsFunctions::GetSkillProgress(unsigned short pid, unsigned short skill) noexcept +{ + Player *player; + GET_PLAYER(pid, player, 0); + + if (skill >= Skill::Length) + return 0; + + return player->NpcStats()->mSkills[skill].mProgress; +} + +void StatsFunctions::SetSkillProgress(unsigned short pid, unsigned short skill, int value) noexcept +{ + Player *player; + GET_PLAYER(pid, player, ); + + if (skill >= Skill::Length) + return; + + player->NpcStats()->mSkills[skill].mProgress = value; +} + int StatsFunctions::GetSkillIncrease(unsigned short pid, unsigned int pos) noexcept { Player *player; diff --git a/apps/openmw-mp/Script/Functions/Stats.hpp b/apps/openmw-mp/Script/Functions/Stats.hpp index d9f9708b9..15bc1439a 100644 --- a/apps/openmw-mp/Script/Functions/Stats.hpp +++ b/apps/openmw-mp/Script/Functions/Stats.hpp @@ -38,10 +38,13 @@ {"SetAttributeBase", StatsFunctions::SetAttributeBase},\ {"GetAttributeCurrent", StatsFunctions::GetAttributeCurrent},\ {"SetAttributeCurrent", StatsFunctions::SetAttributeCurrent},\ + \ {"GetSkillBase", StatsFunctions::GetSkillBase},\ {"SetSkillBase", StatsFunctions::SetSkillBase},\ {"GetSkillCurrent", StatsFunctions::GetSkillCurrent},\ {"SetSkillCurrent", StatsFunctions::SetSkillCurrent},\ + {"GetSkillProgress", StatsFunctions::GetSkillProgress},\ + {"SetSkillProgress", StatsFunctions::SetSkillProgress},\ \ {"GetHealthBase", StatsFunctions::GetHealthBase},\ {"SetHealthBase", StatsFunctions::SetHealthBase},\ @@ -125,6 +128,8 @@ public: static void SetSkillBase(unsigned short pid, unsigned short skill, int value) noexcept; static int GetSkillCurrent(unsigned short pid, unsigned short skill) noexcept; static void SetSkillCurrent(unsigned short pid, unsigned short skill, int value) noexcept; + static int GetSkillProgress(unsigned short pid, unsigned short skill) noexcept; + static void SetSkillProgress(unsigned short pid, unsigned short skill, int value) noexcept; static int GetSkillIncrease(unsigned short pid, unsigned int pos) noexcept; static void SetSkillIncrease(unsigned short pid, unsigned int pos, int value) noexcept;