From e8d636ebc3624d1db10b052419aa87cbc2dff8b6 Mon Sep 17 00:00:00 2001 From: David Cernat Date: Thu, 30 Nov 2017 22:37:06 +0200 Subject: [PATCH] [Server] Rework Get/SetAttributeCurrent into Get/SetAttributeModifier As seen here, attributes don't use the concept of current values, but rather of value modifiers and value damage: https://github.com/OpenMW/openmw/blob/master/apps/openmw/mwmechanics/stat.cpp#L217 --- apps/openmw-mp/Script/Functions/Stats.cpp | 8 ++++---- apps/openmw-mp/Script/Functions/Stats.hpp | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/apps/openmw-mp/Script/Functions/Stats.cpp b/apps/openmw-mp/Script/Functions/Stats.cpp index 4c5deec13..fd9216469 100644 --- a/apps/openmw-mp/Script/Functions/Stats.cpp +++ b/apps/openmw-mp/Script/Functions/Stats.cpp @@ -217,7 +217,7 @@ int StatsFunctions::GetAttributeBase(unsigned short pid, unsigned short attribut return player->creatureStats.mAttributes[attribute].mBase; } -int StatsFunctions::GetAttributeCurrent(unsigned short pid, unsigned short attribute) noexcept +int StatsFunctions::GetAttributeModifier(unsigned short pid, unsigned short attribute) noexcept { Player *player; GET_PLAYER(pid, player, 0); @@ -225,7 +225,7 @@ int StatsFunctions::GetAttributeCurrent(unsigned short pid, unsigned short attri if (attribute >= Attribute::Length) return 0; - return player->creatureStats.mAttributes[attribute].mCurrent; + return player->creatureStats.mAttributes[attribute].mMod; } int StatsFunctions::GetSkillBase(unsigned short pid, unsigned short skill) noexcept @@ -431,7 +431,7 @@ void StatsFunctions::SetAttributeBase(unsigned short pid, unsigned short attribu player->creatureStats.mAttributes[attribute].mBase = value; } -void StatsFunctions::SetAttributeCurrent(unsigned short pid, unsigned short attribute, int value) noexcept +void StatsFunctions::SetAttributeModifier(unsigned short pid, unsigned short attribute, int value) noexcept { Player *player; GET_PLAYER(pid, player,); @@ -439,7 +439,7 @@ void StatsFunctions::SetAttributeCurrent(unsigned short pid, unsigned short attr if (attribute >= Attribute::Length) return; - player->creatureStats.mAttributes[attribute].mCurrent = value; + player->creatureStats.mAttributes[attribute].mMod = value; } void StatsFunctions::SetSkillBase(unsigned short pid, unsigned short skill, int value) noexcept //TODO: need packet for one value diff --git a/apps/openmw-mp/Script/Functions/Stats.hpp b/apps/openmw-mp/Script/Functions/Stats.hpp index e046ffb6a..6f844aeed 100644 --- a/apps/openmw-mp/Script/Functions/Stats.hpp +++ b/apps/openmw-mp/Script/Functions/Stats.hpp @@ -36,7 +36,7 @@ {"GetFatigueCurrent", StatsFunctions::GetFatigueCurrent},\ \ {"GetAttributeBase", StatsFunctions::GetAttributeBase},\ - {"GetAttributeCurrent", StatsFunctions::GetAttributeCurrent},\ + {"GetAttributeModifier", StatsFunctions::GetAttributeModifier},\ \ {"GetSkillBase", StatsFunctions::GetSkillBase},\ {"GetSkillCurrent", StatsFunctions::GetSkillCurrent},\ @@ -64,7 +64,7 @@ {"SetFatigueCurrent", StatsFunctions::SetFatigueCurrent},\ \ {"SetAttributeBase", StatsFunctions::SetAttributeBase},\ - {"SetAttributeCurrent", StatsFunctions::SetAttributeCurrent},\ + {"SetAttributeModifier", StatsFunctions::SetAttributeModifier},\ \ {"SetSkillBase", StatsFunctions::SetSkillBase},\ {"SetSkillCurrent", StatsFunctions::SetSkillCurrent},\ @@ -113,7 +113,7 @@ public: static double GetFatigueCurrent(unsigned short pid) noexcept; static int GetAttributeBase(unsigned short pid, unsigned short attribute) noexcept; - static int GetAttributeCurrent(unsigned short pid, unsigned short attribute) noexcept; + static int GetAttributeModifier(unsigned short pid, unsigned short attribute) noexcept; static int GetSkillBase(unsigned short pid, unsigned short skill) noexcept; static int GetSkillCurrent(unsigned short pid, unsigned short skill) noexcept; @@ -141,7 +141,7 @@ public: static void SetFatigueCurrent(unsigned short pid, double value) noexcept; static void SetAttributeBase(unsigned short pid, unsigned short attribute, int value) noexcept; - static void SetAttributeCurrent(unsigned short pid, unsigned short attribute, int value) noexcept; + static void SetAttributeModifier(unsigned short pid, unsigned short attribute, int value) noexcept; static void SetSkillBase(unsigned short pid, unsigned short skill, int value) noexcept; static void SetSkillCurrent(unsigned short pid, unsigned short skill, int value) noexcept;