diff --git a/apps/openmw-mp/Script/Functions/Stats.cpp b/apps/openmw-mp/Script/Functions/Stats.cpp index 5dc4f60ac..2ebbccae6 100644 --- a/apps/openmw-mp/Script/Functions/Stats.cpp +++ b/apps/openmw-mp/Script/Functions/Stats.cpp @@ -233,7 +233,7 @@ void ScriptFunctions::SetCurrentFatigue(unsigned short pid, float value) noexcep player->CreatureStats()->mDynamic[2].mCurrent = 0; } -int ScriptFunctions::GetAttributeIdByName(const char *name) noexcept +int ScriptFunctions::GetAttributeId(const char *name) noexcept { for (int x = 0; x < 8; x++) { @@ -246,7 +246,7 @@ int ScriptFunctions::GetAttributeIdByName(const char *name) noexcept return -1; } -int ScriptFunctions::GetSkillIdByName(const char *name) noexcept +int ScriptFunctions::GetSkillId(const char *name) noexcept { for (int x = 0; x < 27; x++) { @@ -259,6 +259,16 @@ int ScriptFunctions::GetSkillIdByName(const char *name) noexcept return -1; } +const char *ScriptFunctions::GetAttributeName(unsigned short attribute) noexcept +{ + return Attribute::sAttributeNames[attribute].c_str(); +} + +const char *ScriptFunctions::GetSkillName(unsigned short skill) noexcept +{ + return Skill::sSkillNames[skill].c_str(); +} + int ScriptFunctions::GetAttribute(unsigned short pid, unsigned short attribute) noexcept { Player *player; diff --git a/apps/openmw-mp/Script/ScriptFunctions.hpp b/apps/openmw-mp/Script/ScriptFunctions.hpp index e780ea1b6..0fff26445 100644 --- a/apps/openmw-mp/Script/ScriptFunctions.hpp +++ b/apps/openmw-mp/Script/ScriptFunctions.hpp @@ -87,8 +87,10 @@ public: static float GetCurrentFatigue(unsigned short pid) noexcept; static void SetCurrentFatigue(unsigned short pid, float fatigue) noexcept; - static int GetAttributeIdByName(const char *name) noexcept; - static int GetSkillIdByName(const char *name) noexcept; + static int GetAttributeId(const char *name) noexcept; + static int GetSkillId(const char *name) noexcept; + static const char *GetAttributeName(unsigned short attribute) noexcept; + static const char *GetSkillName(unsigned short skill) noexcept; static int GetAttribute(unsigned short pid, unsigned short attribute) noexcept; static void SetAttribute(unsigned short pid, unsigned short attribute, int value) noexcept; @@ -197,8 +199,10 @@ public: {"GetBirthsign", ScriptFunctions::GetBirthsign}, {"SetBirthsign", ScriptFunctions::SetBirthsign}, - {"GetAttributeIdByName", ScriptFunctions::GetAttributeIdByName}, - {"GetSkillIdByName", ScriptFunctions::GetSkillIdByName}, + {"GetAttributeId", ScriptFunctions::GetAttributeId}, + {"GetSkillId", ScriptFunctions::GetSkillId}, + {"GetAttributeName", ScriptFunctions::GetAttributeName}, + {"GetSkillName", ScriptFunctions::GetSkillName}, {"GetAttribute", ScriptFunctions::GetAttribute}, {"SetAttribute", ScriptFunctions::SetAttribute},