Stats functions

class StatsFunctions

Public Static Functions

static int GetAttributeCount() noexcept

Get the number of attributes.

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

Returns

The number of attributes.

static int GetSkillCount() noexcept

Get the number of skills.

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

Returns

The number of skills.

static int GetAttributeId(const char *name) noexcept

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

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

Parameters

name – The name of the attribute.

Returns

The ID of the attribute.

static int GetSkillId(const char *name) noexcept

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

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

Parameters

name – The name of the skill.

Returns

The ID of the skill.

static const char *GetAttributeName(unsigned short attributeId) noexcept

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

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

Parameters

attributeId – The ID of the attribute.

Returns

The name of the attribute.

static const char *GetSkillName(unsigned short skillId) noexcept

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

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

Parameters

skillId – The ID of the skill.

Returns

The name of the skill.

static const char *GetName(unsigned short pid) noexcept

Get the name of a player.

Parameters

pid – The player ID.

Returns

The name of the player.

static const char *GetRace(unsigned short pid) noexcept

Get the race of a player.

Parameters

pid – The player ID.

Returns

The race of the player.

static const char *GetHead(unsigned short pid) noexcept

Get the head mesh used by a player.

Parameters

pid – The player ID.

Returns

The head mesh of the player.

static const char *GetHairstyle(unsigned short pid) noexcept

Get the hairstyle mesh used by a player.

Parameters

pid – The player ID.

Returns

The hairstyle mesh of the player.

static int GetIsMale(unsigned short pid) noexcept

Check whether a player is male or not.

Parameters

pid – The player ID.

Returns

Whether the player is male.

static const char *GetModel(unsigned short pid) noexcept

Get the model of a player.

Parameters

pid – The player ID.

Returns

The model of the player.

static const char *GetBirthsign(unsigned short pid) noexcept

Get the birthsign of a player.

Parameters

pid – The player ID.

Returns

The birthsign of the player.

static int GetLevel(unsigned short pid) noexcept

Get the character level of a player.

Parameters

pid – The player ID.

Returns

The level of the player.

static int GetLevelProgress(unsigned short pid) noexcept

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

Parameters

pid – The player ID.

Returns

The level progress.

static double GetHealthBase(unsigned short pid) noexcept

Get the base health of the player.

Parameters

pid – The player ID.

Returns

The base health.

static double GetHealthCurrent(unsigned short pid) noexcept

Get the current health of the player.

Parameters

pid – The player ID.

Returns

The current health.

static double GetMagickaBase(unsigned short pid) noexcept

Get the base magicka of the player.

Parameters

pid – The player ID.

Returns

The base magicka.

static double GetMagickaCurrent(unsigned short pid) noexcept

Get the current magicka of the player.

Parameters

pid – The player ID.

Returns

The current magicka.

static double GetFatigueBase(unsigned short pid) noexcept

Get the base fatigue of the player.

Parameters

pid – The player ID.

Returns

The base fatigue.

static double GetFatigueCurrent(unsigned short pid) noexcept

Get the current fatigue of the player.

Parameters

pid – The player ID.

Returns

The current fatigue.

static int GetAttributeBase(unsigned short pid, unsigned short attributeId) noexcept

Get the base value of a player’s attribute.

Parameters
  • pid – The player ID.

  • attributeId – The attribute ID.

Returns

The base value of the attribute.

static int GetAttributeModifier(unsigned short pid, unsigned short attributeId) noexcept

Get the modifier value of a player’s attribute.

Parameters
  • pid – The player ID.

  • attributeId – The attribute ID.

Returns

The modifier value of the attribute.

static double GetAttributeDamage(unsigned short pid, unsigned short attributeId) noexcept

Get the amount of damage (as caused through the Damage Attribute effect) to a player’s attribute.

Parameters
  • pid – The player ID.

  • attributeId – The attribute ID.

Returns

The amount of damage to the attribute.

static int GetSkillBase(unsigned short pid, unsigned short skillId) noexcept

Get the base value of a player’s skill.

Parameters
  • pid – The player ID.

  • skillId – The skill ID.

Returns

The base value of the skill.

static int GetSkillModifier(unsigned short pid, unsigned short skillId) noexcept

Get the modifier value of a player’s skill.

Parameters
  • pid – The player ID.

  • skillId – The skill ID.

Returns

The modifier value of the skill.

static double GetSkillDamage(unsigned short pid, unsigned short skillId) noexcept

Get the amount of damage (as caused through the Damage Skill effect) to a player’s skill.

Parameters
  • pid – The player ID.

  • skillId – The skill ID.

Returns

The amount of damage to the skill.

static double GetSkillProgress(unsigned short pid, unsigned short skillId) noexcept

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

Parameters
  • pid – The player ID.

  • skillId – The skill ID.

Returns

The skill progress.

static int GetSkillIncrease(unsigned short pid, unsigned int attributeId) noexcept

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.

Parameters
  • pid – The player ID.

  • attributeId – The attribute ID.

Returns

The increase in the attribute caused by skills.

static int GetBounty(unsigned short pid) noexcept

Get the bounty of the player.

Parameters

pid – The player ID.

Returns

The bounty.

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

Set the name of a player.

Parameters
  • pid – The player ID.

  • name – The new name of the player.

Returns

void

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

Set the race of a player.

Parameters
  • pid – The player ID.

  • race – The new race of the player.

Returns

void

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

Set the head mesh used by a player.

Parameters
  • pid – The player ID.

  • head – The new head mesh of the player.

Returns

void

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

Set the hairstyle mesh used by a player.

Parameters
  • pid – The player ID.

  • hairstyle – The new hairstyle mesh of the player.

Returns

void

static void SetIsMale(unsigned short pid, int state) noexcept

Set whether a player is male or not.

Parameters
  • pid – The player ID.

  • state – Whether the player is male.

Returns

void

static void SetModel(unsigned short pid, const char *model) noexcept

Set the model of a player.

Parameters
  • pid – The player ID.

  • model – The new model of the player.

Returns

void

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

Set the birthsign of a player.

Parameters
  • pid – The player ID.

  • name – The new birthsign of the player.

Returns

void

static void SetResetStats(unsigned short pid, bool resetStats) noexcept

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.

Parameters
  • pid – The player ID.

  • resetStats – The stat reset state.

Returns

void

static void SetLevel(unsigned short pid, int value) noexcept

Set the character level of a player.

Parameters
  • pid – The player ID.

  • value – The new level of the player.

Returns

void

static void SetLevelProgress(unsigned short pid, int value) noexcept

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

Parameters
  • pid – The player ID.

  • value – The new level progress of the player.

Returns

void

static void SetHealthBase(unsigned short pid, double value) noexcept

Set the base health of a player.

Parameters
  • pid – The player ID.

  • value – The new base health of the player.

Returns

void

static void SetHealthCurrent(unsigned short pid, double value) noexcept

Set the current health of a player.

Parameters
  • pid – The player ID.

  • value – The new current health of the player.

Returns

void

static void SetMagickaBase(unsigned short pid, double value) noexcept

Set the base magicka of a player.

Parameters
  • pid – The player ID.

  • value – The new base magicka of the player.

Returns

void

static void SetMagickaCurrent(unsigned short pid, double value) noexcept

Set the current magicka of a player.

Parameters
  • pid – The player ID.

  • value – The new current magicka of the player.

Returns

void

static void SetFatigueBase(unsigned short pid, double value) noexcept

Set the base fatigue of a player.

Parameters
  • pid – The player ID.

  • value – The new base fatigue of the player.

Returns

void

static void SetFatigueCurrent(unsigned short pid, double value) noexcept

Set the current fatigue of a player.

Parameters
  • pid – The player ID.

  • value – The new current fatigue of the player.

Returns

void

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

Set the base value of a player’s attribute.

Parameters
  • pid – The player ID.

  • attributeId – The attribute ID.

  • value – The new base value of the player’s attribute.

Returns

void

static void ClearAttributeModifier(unsigned short pid, unsigned short attributeId) noexcept

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.

Parameters
  • pid – The player ID.

  • attributeId – The attribute ID.

Returns

void

static void SetAttributeDamage(unsigned short pid, unsigned short attributeId, double value) noexcept

Set the amount of damage (as caused through the Damage Attribute effect) to a player’s attribute.

Parameters
  • pid – The player ID.

  • attributeId – The attribute ID.

  • value – The amount of damage to the player’s attribute.

Returns

void

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

Set the base value of a player’s skill.

Parameters
  • pid – The player ID.

  • skillId – The skill ID.

  • value – The new base value of the player’s skill.

Returns

void

static void ClearSkillModifier(unsigned short pid, unsigned short skillId) noexcept

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.

Parameters
  • pid – The player ID.

  • skillId – The skill ID.

Returns

void

static void SetSkillDamage(unsigned short pid, unsigned short skillId, double value) noexcept

Set the amount of damage (as caused through the Damage Skill effect) to a player’s skill.

Parameters
  • pid – The player ID.

  • skillId – The skill ID.

  • value – The amount of damage to the player’s skill.

Returns

void

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

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

Parameters
  • pid – The player ID.

  • skillId – The skill ID.

  • value – The progress value.

Returns

void

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

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.

Parameters
  • pid – The player ID.

  • attributeId – The attribute ID.

  • value – The increase in the attribute caused by skills.

Returns

void

static void SetBounty(unsigned short pid, int value) noexcept

Set the bounty of a player.

Parameters
  • pid – The player ID.

  • value – The new bounty.

Returns

void

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

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.

Parameters
  • pid – The player ID.

  • currentStage – The new current stage.

  • endStage – The new ending stage.

Returns

void

static void SendBaseInfo(unsigned short pid) noexcept

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.

Parameters

pid – The player ID.

Returns

void

static void SendStatsDynamic(unsigned short pid) noexcept

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

It is always sent to all players.

Parameters

pid – The player ID.

Returns

void

static void SendAttributes(unsigned short pid) noexcept

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.

Parameters

pid – The player ID.

Returns

void

static void SendSkills(unsigned short pid) noexcept

Send a PlayerSkill packet with a player’s skills.

It is always sent to all players.

Parameters

pid – The player ID.

Returns

void

static void SendLevel(unsigned short pid) noexcept

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

It is always sent to all players.

Parameters

pid – The player ID.

Returns

void

static void SendBounty(unsigned short pid) noexcept

Send a PlayerBounty packet with a player’s bounty.

It is always sent to all players.

Parameters

pid – The player ID.

Returns

void