Stats functions

class StatsFunctions

Public Static Functions

int GetAttributeCount()

Get the number of attributes.

The number is 8 before any dehardcoding is done in OpenMW.

Return
The number of attributes.

int GetSkillCount()

Get the number of skills.

The number is 27 before any dehardcoding is done in OpenMW.

Return
The number of skills.

int GetAttributeId(const char *name)

Get the numerical ID of an attribute with a certain name.

If an invalid name is used, the ID returned is -1

Return
The ID of the attribute.
Parameters
  • name: The name of the attribute.

int GetSkillId(const char *name)

Get the numerical ID of a skill with a certain name.

If an invalid name is used, the ID returned is -1

Return
The ID of the skill.
Parameters
  • name: The name of the skill.

const char *GetAttributeName(unsigned short attributeId)

Get the name of the attribute with a certain numerical ID.

If an invalid ID is used, “invalid” is returned.

Return
The name of the attribute.
Parameters
  • attributeId: The ID of the attribute.

const char *GetSkillName(unsigned short skillId)

Get the name of the skill with a certain numerical ID.

If an invalid ID is used, “invalid” is returned.

Return
The name of the skill.
Parameters
  • skillId: The ID of the skill.

const char *GetName(unsigned short pid)

Get the name of a player.

Return
The name of the player.
Parameters
  • pid: The player ID.

const char *GetRace(unsigned short pid)

Get the race of a player.

Return
The race of the player.
Parameters
  • pid: The player ID.

const char *GetHead(unsigned short pid)

Get the head mesh used by a player.

Return
The head mesh of the player.
Parameters
  • pid: The player ID.

const char *GetHairstyle(unsigned short pid)

Get the hairstyle mesh used by a player.

Return
The hairstyle mesh of the player.
Parameters
  • pid: The player ID.

int GetIsMale(unsigned short pid)

Check whether a player is male or not.

Return
Whether the player is male.
Parameters
  • pid: The player ID.

const char *GetBirthsign(unsigned short pid)

Get the birthsign of a player.

Return
The birthsign of the player.
Parameters
  • pid: The player ID.

int GetLevel(unsigned short pid)

Get the character level of a player.

Return
The level of the player.
Parameters
  • pid: The player ID.

int GetLevelProgress(unsigned short pid)

Get the player’s progress to their next character level.

Return
The level progress.
Parameters
  • pid: The player ID.

double GetHealthBase(unsigned short pid)

Get the base health of the player.

Return
The base health.
Parameters
  • pid: The player ID.

double GetHealthCurrent(unsigned short pid)

Get the current health of the player.

Return
The current health.
Parameters
  • pid: The player ID.

double GetMagickaBase(unsigned short pid)

Get the base magicka of the player.

Return
The base magicka.
Parameters
  • pid: The player ID.

double GetMagickaCurrent(unsigned short pid)

Get the current magicka of the player.

Return
The current magicka.
Parameters
  • pid: The player ID.

double GetFatigueBase(unsigned short pid)

Get the base fatigue of the player.

Return
The base fatigue.
Parameters
  • pid: The player ID.

double GetFatigueCurrent(unsigned short pid)

Get the current fatigue of the player.

Return
The current fatigue.
Parameters
  • pid: The player ID.

int GetAttributeBase(unsigned short pid, unsigned short attributeId)

Get the base value of a player’s attribute.

Return
The base value of the attribute.
Parameters
  • pid: The player ID.
  • attributeId: The attribute ID.

int GetAttributeModifier(unsigned short pid, unsigned short attributeId)

Get the modifier value of a player’s attribute.

Return
The modifier value of the attribute.
Parameters
  • pid: The player ID.
  • attributeId: The attribute ID.

int GetSkillBase(unsigned short pid, unsigned short skillId)

Get the base value of a player’s skill.

Return
The base value of the skill.
Parameters
  • pid: The player ID.
  • skillId: The skill ID.

int GetSkillModifier(unsigned short pid, unsigned short skillId)

Get the modifier value of a player’s skill.

Return
The modifier value of the skill.
Parameters
  • pid: The player ID.
  • skillId: The skill ID.

double GetSkillProgress(unsigned short pid, unsigned short skillId)

Get the progress the player has made towards increasing a certain skill by 1.

Return
The skill progress.
Parameters
  • pid: The player ID.
  • skillId: The skill ID.

int GetSkillIncrease(unsigned short pid, unsigned int attributeId)

Get the bonus applied to a certain attribute at the next level up as a result of associated skill increases.

Although confusing, the term “skill increase” for this is taken from OpenMW itself.

Return
The increase in the attribute caused by skills.
Parameters
  • pid: The player ID.
  • skillId: The attribute ID.

int GetBounty(unsigned short pid)

Get the bounty of the player.

Return
The bounty.
Parameters
  • pid: The player ID.

void SetName(unsigned short pid, const char *name)

Set the name of a player.

Return
void
Parameters
  • pid: The player ID.
  • name: The new name of the player.

void SetRace(unsigned short pid, const char *race)

Set the race of a player.

Return
void
Parameters
  • pid: The player ID.
  • race: The new race of the player.

void SetHead(unsigned short pid, const char *head)

Set the head mesh used by a player.

Return
void
Parameters
  • pid: The player ID.
  • head: The new head mesh of the player.

void SetHairstyle(unsigned short pid, const char *hairstyle)

Set the hairstyle mesh used by a player.

Return
void
Parameters
  • pid: The player ID.
  • hairstyle: The new hairstyle mesh of the player.

void SetIsMale(unsigned short pid, int state)

Set whether a player is male or not.

Return
void
Parameters
  • pid: The player ID.
  • state: Whether the player is male.

void SetBirthsign(unsigned short pid, const char *name)

Set the birthsign of a player.

Return
void
Parameters
  • pid: The player ID.
  • name: The new birthsign of the player.

void SetResetStats(unsigned short pid, bool resetStats)

Set whether the player’s stats should be reset based on their current race as the result of a PlayerBaseInfo packet.

This changes the resetState for that player in the server memory, but does not by itself send a packet.

Return
void
Parameters
  • pid: The player ID.
  • resetStats: The stat reset state.

void SetLevel(unsigned short pid, int value)

Set the character level of a player.

Return
void
Parameters
  • pid: The player ID.
  • value: The new level of the player.

void SetLevelProgress(unsigned short pid, int value)

Set the player’s progress to their next character level.

Return
void
Parameters
  • pid: The player ID.
  • value: The new level progress of the player.

void SetHealthBase(unsigned short pid, double value)

Set the base health of a player.

Return
void
Parameters
  • pid: The player ID.
  • name: The new base health of the player.

void SetHealthCurrent(unsigned short pid, double value)

Set the current health of a player.

Return
void
Parameters
  • pid: The player ID.
  • name: The new current health of the player.

void SetMagickaBase(unsigned short pid, double value)

Set the base magicka of a player.

Return
void
Parameters
  • pid: The player ID.
  • name: The new base magicka of the player.

void SetMagickaCurrent(unsigned short pid, double value)

Set the current magicka of a player.

Return
void
Parameters
  • pid: The player ID.
  • name: The new current magicka of the player.

void SetFatigueBase(unsigned short pid, double value)

Set the base fatigue of a player.

Return
void
Parameters
  • pid: The player ID.
  • name: The new base fatigue of the player.

void SetFatigueCurrent(unsigned short pid, double value)

Set the current fatigue of a player.

Return
void
Parameters
  • pid: The player ID.
  • name: The new current fatigue of the player.

void SetAttributeBase(unsigned short pid, unsigned short attributeId, int value)

Set the base value of a player’s attribute.

Return
void
Parameters
  • pid: The player ID.
  • attributeId: The attribute ID.
  • value: The new base value of the player’s attribute.

void ClearAttributeModifier(unsigned short pid, unsigned short attributeId)

Clear the modifier value of a player’s attribute.

There’s no way to set a modifier to a specific value because it can come from multiple different sources, but clearing it is a straightforward process that dispels associated effects on a client and, if necessary, unequips associated items.

Return
void
Parameters
  • pid: The player ID.
  • attributeId: The attribute ID.

void SetSkillBase(unsigned short pid, unsigned short skillId, int value)

Set the base value of a player’s skill.

Return
void
Parameters
  • pid: The player ID.
  • skillId: The skill ID.
  • value: The new base value of the player’s skill.

void ClearSkillModifier(unsigned short pid, unsigned short skillId)

Clear the modifier value of a player’s skill.

There’s no way to set a modifier to a specific value because it can come from multiple different sources, but clearing it is a straightforward process that dispels associated effects on a client and, if necessary, unequips associated items.

Return
void
Parameters
  • pid: The player ID.
  • skillId: The skill ID.

void SetSkillProgress(unsigned short pid, unsigned short skillId, double value)

Set the progress the player has made towards increasing a certain skill by 1.

Return
void
Parameters
  • pid: The player ID.
  • skillId: The skill ID.
  • value: The progress value.

void SetSkillIncrease(unsigned short pid, unsigned int attributeId, int value)

Set the bonus applied to a certain attribute at the next level up as a result of associated skill increases.

Although confusing, the term “skill increase” for this is taken from OpenMW itself.

Return
void
Parameters
  • pid: The player ID.
  • skillId: The attribute ID.
  • value: The increase in the attribute caused by skills.

void SetBounty(unsigned short pid, int value)

Set the bounty of a player.

Return
void
Parameters
  • pid: The player ID.
  • value: The new bounty.

void SetCharGenStage(unsigned short pid, int currentStage, int endStage)

Set the current and ending stages of character generation for a player.

This is used to repeat part of character generation or to only go through part of it.

Return
void
Parameters
  • pid: The player ID.
  • currentStage: The new current stage.
  • endStage: The new ending stage.

void SendBaseInfo(unsigned short pid)

Send a PlayerBaseInfo packet with a player’s name, race, head mesh, hairstyle mesh, birthsign and stat reset state.

It is always sent to all players.

Return
void
Parameters
  • pid: The player ID.

void SendStatsDynamic(unsigned short pid)

Send a PlayerStatsDynamic packet with a player’s dynamic stats (health, magicka and fatigue).

It is always sent to all players.

Return
void
Parameters
  • pid: The player ID.

void SendAttributes(unsigned short pid)

Send a PlayerAttribute packet with a player’s attributes and bonuses to those attributes at the next level up (the latter being called “skill increases” as in OpenMW).

It is always sent to all players.

Return
void
Parameters
  • pid: The player ID.

void SendSkills(unsigned short pid)

Send a PlayerSkill packet with a player’s skills.

It is always sent to all players.

Return
void
Parameters
  • pid: The player ID.

void SendLevel(unsigned short pid)

Send a PlayerLevel packet with a player’s character level and progress towards the next level up.

It is always sent to all players.

Return
void
Parameters
  • pid: The player ID.

void SendBounty(unsigned short pid)

Send a PlayerBounty packet with a player’s bounty.

It is always sent to all players.

Return
void
Parameters
  • pid: The player ID.