From 2944be18ae281f44de1436e106b2c2010b1a1cb3 Mon Sep 17 00:00:00 2001 From: David Cernat Date: Sat, 2 Dec 2017 09:19:33 +0200 Subject: [PATCH] [Server] Actually, turn SetAttributeModifier into ClearAttributeModifier There's no way SetAttributeModifier() was going to make sense if, say, a player had drunk 3 different potions fortifying the same attribute and was wearing equipment fortifying it as well. How would one change the sum modifier of those while accounting for each specific effect's duration and magnitude? The only workable solution is to allow the server to clear the modifier. --- apps/openmw-mp/Script/Functions/Stats.cpp | 4 ++-- apps/openmw-mp/Script/Functions/Stats.hpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/openmw-mp/Script/Functions/Stats.cpp b/apps/openmw-mp/Script/Functions/Stats.cpp index fd9216469..4a18208e0 100644 --- a/apps/openmw-mp/Script/Functions/Stats.cpp +++ b/apps/openmw-mp/Script/Functions/Stats.cpp @@ -431,7 +431,7 @@ void StatsFunctions::SetAttributeBase(unsigned short pid, unsigned short attribu player->creatureStats.mAttributes[attribute].mBase = value; } -void StatsFunctions::SetAttributeModifier(unsigned short pid, unsigned short attribute, int value) noexcept +void StatsFunctions::ClearAttributeModifier(unsigned short pid, unsigned short attribute) noexcept { Player *player; GET_PLAYER(pid, player,); @@ -439,7 +439,7 @@ void StatsFunctions::SetAttributeModifier(unsigned short pid, unsigned short att if (attribute >= Attribute::Length) return; - player->creatureStats.mAttributes[attribute].mMod = value; + player->creatureStats.mAttributes[attribute].mMod = 0; } 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 6f844aeed..9259b4df4 100644 --- a/apps/openmw-mp/Script/Functions/Stats.hpp +++ b/apps/openmw-mp/Script/Functions/Stats.hpp @@ -64,7 +64,7 @@ {"SetFatigueCurrent", StatsFunctions::SetFatigueCurrent},\ \ {"SetAttributeBase", StatsFunctions::SetAttributeBase},\ - {"SetAttributeModifier", StatsFunctions::SetAttributeModifier},\ + {"ClearAttributeModifier", StatsFunctions::ClearAttributeModifier},\ \ {"SetSkillBase", StatsFunctions::SetSkillBase},\ {"SetSkillCurrent", StatsFunctions::SetSkillCurrent},\ @@ -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 SetAttributeModifier(unsigned short pid, unsigned short attribute, int value) noexcept; + static void ClearAttributeModifier(unsigned short pid, unsigned short attribute) 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;