Mechanics functions¶
-
class MechanicsFunctions¶
Public Static Functions
-
static void ClearAlliedPlayersForPlayer(unsigned short pid) noexcept¶
Clear the list of players who will be regarded as being player’s allies.
- Parameters
pid – The player ID.
- Returns
void
-
static unsigned char GetMiscellaneousChangeType(unsigned short pid) noexcept¶
Get the type of a PlayerMiscellaneous packet.
- Parameters
pid – The player ID.
- Returns
The type.
-
static const char *GetMarkCell(unsigned short pid) noexcept¶
Get the cell description of a player’s Mark cell.
- Parameters
pid – The player ID.
- Returns
The cell description.
-
static double GetMarkPosX(unsigned short pid) noexcept¶
Get the X position of a player’s Mark.
- Parameters
pid – The player ID.
- Returns
The X position.
-
static double GetMarkPosY(unsigned short pid) noexcept¶
Get the Y position of a player’s Mark.
- Parameters
pid – The player ID.
- Returns
The Y position.
-
static double GetMarkPosZ(unsigned short pid) noexcept¶
Get the Z position of a player’s Mark.
- Parameters
pid – The player ID.
- Returns
The Z position.
-
static double GetMarkRotX(unsigned short pid) noexcept¶
Get the X rotation of a player’s Mark.
- Parameters
pid – The player ID.
- Returns
The X rotation.
-
static double GetMarkRotZ(unsigned short pid) noexcept¶
Get the Z rotation of a player’s Mark.
- Parameters
pid – The player ID.
- Returns
The X rotation.
-
static const char *GetSelectedSpellId(unsigned short pid) noexcept¶
Get the ID of a player’s selected spell.
- Parameters
pid – The player ID.
- Returns
The spell ID.
-
static bool DoesPlayerHavePlayerKiller(unsigned short pid) noexcept¶
Check whether the killer of a certain player is also a player.
- Parameters
pid – The player ID of the killed player.
- Returns
Whether the player was killed by another player.
-
static int GetPlayerKillerPid(unsigned short pid) noexcept¶
Get the player ID of the killer of a certain player.
- Parameters
pid – The player ID of the killed player.
- Returns
The player ID of the killer.
-
static const char *GetPlayerKillerRefId(unsigned short pid) noexcept¶
Get the refId of the actor killer of a certain player.
- Parameters
pid – The player ID of the killed player.
- Returns
The refId of the killer.
-
static unsigned int GetPlayerKillerRefNum(unsigned short pid) noexcept¶
Get the refNum of the actor killer of a certain player.
- Parameters
pid – The player ID of the killed player.
- Returns
The refNum of the killer.
-
static unsigned int GetPlayerKillerMpNum(unsigned short pid) noexcept¶
Get the mpNum of the actor killer of a certain player.
- Parameters
pid – The player ID of the killed player.
- Returns
The mpNum of the killer.
-
static const char *GetPlayerKillerName(unsigned short pid) noexcept¶
Get the name of the actor killer of a certain player.
- Parameters
pid – The player ID of the killed player.
- Returns
The name of the killer.
-
static unsigned int GetDrawState(unsigned short pid) noexcept¶
Get the draw state of a player (0 for nothing, 1 for drawn weapon, 2 for drawn spell).
- Parameters
pid – The player ID.
- Returns
The draw state.
-
static bool GetSneakState(unsigned short pid) noexcept¶
Get the sneak state of a player.
- Parameters
pid – The player ID.
- Returns
Whether the player is sneaking.
-
static void SetMarkCell(unsigned short pid, const char *cellDescription) noexcept¶
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.
- Parameters
pid – The player ID.
cellDescription – The cell description.
- Returns
void
-
static void SetMarkPos(unsigned short pid, double x, double y, double z) noexcept¶
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.
- Parameters
pid – The player ID.
x – The X position.
y – The Y position.
z – The Z position.
- Returns
void
-
static void SetMarkRot(unsigned short pid, double x, double z) noexcept¶
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.
- Parameters
pid – The player ID.
x – The X rotation.
z – The Z rotation.
- Returns
void
-
static void SetSelectedSpellId(unsigned short pid, const char *spellId) noexcept¶
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.
- Parameters
pid – The player ID.
spellId – The spell ID.
- Returns
void
-
static void AddAlliedPlayerForPlayer(unsigned short pid, unsigned short alliedPlayerPid) noexcept¶
Add an ally to a player’s list of allied players.
- Parameters
pid – The player ID.
alliedPlayerPid – The ally’s player ID.
- Returns
void
-
static void SendMarkLocation(unsigned short pid)¶
Send a PlayerMiscellaneous packet with a Mark location to a player.
- Parameters
pid – The player ID.
- Returns
void
-
static void SendSelectedSpell(unsigned short pid)¶
Send a PlayerMiscellaneous packet with a selected spell ID to a player.
- Parameters
pid – The player ID.
- Returns
void
-
static void SendAlliedPlayers(unsigned short pid, bool sendToOtherPlayers)¶
Send a PlayerAlly packet with a list of team member IDs to a player.
- Parameters
pid – The player ID.
sendToOtherPlayers – Whether this packet should be sent to players other than the player attached to the packet (false by default).
- Returns
void
-
static void Jail(unsigned short pid, int jailDays, bool ignoreJailTeleportation, bool ignoreJailSkillIncreases, const char *jailProgressText, const char *jailEndText) noexcept¶
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.
- 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.
ignoreJailSkillIncreases – 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.
- Returns
void
-
static void Resurrect(unsigned short pid, unsigned int type) noexcept¶
Send a PlayerResurrect packet about a player.
This sends the packet to all players connected to the server.
- Parameters
pid – The player ID.
type – The type of resurrection (0 for REGULAR, 1 for IMPERIAL_SHRINE, 2 for TRIBUNAL_TEMPLE).
- Returns
void
-
static void ClearAlliedPlayersForPlayer(unsigned short pid) noexcept¶