Add server stat functions for getting attribute and skill counts

pull/76/head
David Cernat 8 years ago
parent 57703482b2
commit 7ae9ea7465

@ -246,6 +246,16 @@ void StatsFunctions::SetCurrentFatigue(unsigned short pid, float value) noexcept
player->CreatureStats()->mDynamic[2].mCurrent = 0;
}
int StatsFunctions::GetAttributeCount() noexcept
{
return Attribute::Length;
}
int StatsFunctions::GetSkillCount() noexcept
{
return Skill::Length;
}
int StatsFunctions::GetAttributeId(const char *name) noexcept
{
for (int x = 0; x < Attribute::Length; x++)
@ -274,11 +284,17 @@ int StatsFunctions::GetSkillId(const char *name) noexcept
const char *StatsFunctions::GetAttributeName(unsigned short attribute) noexcept
{
if (attribute >= Attribute::Length)
return "invalid";
return Attribute::sAttributeNames[attribute].c_str();
}
const char *StatsFunctions::GetSkillName(unsigned short skill) noexcept
{
if (skill >= Skill::Length)
return "invalid";
return Skill::sSkillNames[skill].c_str();
}

@ -27,6 +27,8 @@
{"GetBirthsign", StatsFunctions::GetBirthsign},\
{"SetBirthsign", StatsFunctions::SetBirthsign},\
\
{"GetAttributeCount", StatsFunctions::GetAttributeCount},\
{"GetSkillCount", StatsFunctions::GetSkillCount},\
{"GetAttributeId", StatsFunctions::GetAttributeId},\
{"GetSkillId", StatsFunctions::GetSkillId},\
{"GetAttributeName", StatsFunctions::GetAttributeName},\
@ -108,6 +110,8 @@ public:
static float GetCurrentFatigue(unsigned short pid) noexcept;
static void SetCurrentFatigue(unsigned short pid, float value) noexcept;
static int GetAttributeCount() noexcept;
static int GetSkillCount() noexcept;
static int GetAttributeId(const char *name) noexcept;
static int GetSkillId(const char *name) noexcept;
static const char *GetAttributeName(unsigned short attribute) noexcept;

Loading…
Cancel
Save