Mechanics functions

class MechanicsFunctions

Public Static Functions

unsigned char GetMiscellaneousChangeType(unsigned short pid)

Get the type of a PlayerMiscellaneous packet.

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

const char *GetMarkCell(unsigned short pid)

Get the cell description of a player’s Mark cell.

Return
The cell description.
Parameters
  • pid: The player ID.

double GetMarkPosX(unsigned short pid)

Get the X position of a player’s Mark.

Return
The X position.
Parameters
  • pid: The player ID.

double GetMarkPosY(unsigned short pid)

Get the Y position of a player’s Mark.

Return
The Y position.
Parameters
  • pid: The player ID.

double GetMarkPosZ(unsigned short pid)

Get the Z position of a player’s Mark.

Return
The Z position.
Parameters
  • pid: The player ID.

double GetMarkRotX(unsigned short pid)

Get the X rotation of a player’s Mark.

Return
The X rotation.
Parameters
  • pid: The player ID.

double GetMarkRotZ(unsigned short pid)

Get the Z rotation of a player’s Mark.

Return
The X rotation.
Parameters
  • pid: The player ID.

const char *GetSelectedSpellId(unsigned short pid)

Get the ID of a player’s selected spell.

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

bool DoesPlayerHavePlayerKiller(unsigned short pid)

Check whether the killer of a certain player is also a player.

Return
Whether the player was killed by another player.
Parameters
  • pid: The player ID of the killed player.

int GetPlayerKillerPid(unsigned short pid)

Get the player ID of the killer of a certain player.

Return
The player ID of the killer.
Parameters
  • pid: The player ID of the killed player.

const char *GetPlayerKillerRefId(unsigned short pid)

Get the refId of the actor killer of a certain player.

Return
The refId of the killer.
Parameters
  • pid: The player ID of the killed player.

unsigned int GetPlayerKillerRefNum(unsigned short pid)

Get the refNum of the actor killer of a certain player.

Return
The refNum of the killer.
Parameters
  • pid: The player ID of the killed player.

unsigned int GetPlayerKillerMpNum(unsigned short pid)

Get the mpNum of the actor killer of a certain player.

Return
The mpNum of the killer.
Parameters
  • pid: The player ID of the killed player.

const char *GetPlayerKillerName(unsigned short pid)

Get the name of the actor killer of a certain player.

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

unsigned int GetDrawState(unsigned short pid)

Get the draw state of a player (0 for nothing, 1 for drawn weapon, 2 for drawn spell).

Return
The draw state.
Parameters
  • pid: The player ID.

bool GetSneakState(unsigned short pid)

Get the sneak state of a player.

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

void SetMarkCell(unsigned short pid, const char *cellDescription)

Set the Mark cell of a player.

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

The cell is determined to be an exterior cell if it fits the pattern of a number followed by a comma followed by another number.

Return
void
Parameters
  • pid: The player ID.
  • cellDescription: The cell description.

void SetMarkPos(unsigned short pid, double x, double y, double z)

Set the Mark position of a player.

This changes the Mark positional coordinates recorded for that player in the server memory, but does not by itself send a packet.

Return
void
Parameters
  • pid: The player ID.
  • x: The X position.
  • y: The Y position.
  • z: The Z position.

void SetMarkRot(unsigned short pid, double x, double z)

Set the Mark rotation of a player.

This changes the Mark positional coordinates recorded for that player in the server memory, but does not by itself send a packet.

Return
void
Parameters
  • pid: The player ID.
  • x: The X rotation.
  • z: The Z rotation.

void SetSelectedSpellId(unsigned short pid, const char *spellId)

Set the ID of a player’s selected spell.

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

Return
void
Parameters
  • pid: The player ID.
  • spellId: The spell ID.

void SendMarkLocation(unsigned short pid)

Send a PlayerMiscellaneous packet with a Mark location to a player.

Return
void
Parameters
  • pid: The player ID.

void SendSelectedSpell(unsigned short pid)

Send a PlayerMiscellaneous packet with a selected spell ID to a player.

Return
void
Parameters
  • pid: The player ID.

void Jail(unsigned short pid, int jailDays, bool ignoreJailTeleportation, bool ignoreJailSkillIncreases, const char *jailProgressText, const char *jailEndText)

Send a PlayerJail packet about a player.

This is similar to the player being jailed by a guard, but provides extra parameters for increased flexibility.

It is only sent to the player being jailed, as the other players will be informed of the jailing’s actual consequences via other packets sent by the affected client.

Return
void
Parameters
  • pid: The player ID.
  • jailDays: The number of days to spend jailed, where each day affects one skill point.
  • ignoreJailTeleportation: Whether the player being teleported to the nearest jail marker should be overridden.
  • ignoreJailSkillIncrease: Whether the player’s Sneak and Security skills should be prevented from increasing as a result of the jailing, overriding default behavior.
  • jailProgressText: The text that should be displayed while jailed.
  • jailEndText: The text that should be displayed once the jailing period is over.

void Resurrect(unsigned short pid, unsigned int type)

Send a PlayerResurrect packet about a player.

This sends the packet to all players connected to the server.

Return
void
Parameters
  • pid: The player ID.
  • type: The type of resurrection (0 for REGULAR, 1 for IMPERIAL_SHRINE, 2 for TRIBUNAL_TEMPLE).