[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
0.6.2
David Cernat 7 years ago
parent c9c363ebef
commit e8d636ebc3

@ -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

@ -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;

Loading…
Cancel
Save