Faction functions

class FactionFunctions

Public Static Functions

static void ClearFactionChanges(unsigned short pid) noexcept

Clear the last recorded faction changes for a player.

This is used to initialize the sending of new PlayerFaction packets.

Parameters

pid – The player ID whose faction changes should be used.

Returns

void

static unsigned int GetFactionChangesSize(unsigned short pid) noexcept

Get the number of indexes in a player’s latest faction changes.

Parameters

pid – The player ID whose faction changes should be used.

Returns

The number of indexes.

static unsigned char GetFactionChangesAction(unsigned short pid) noexcept

Get the action type used in a player’s latest faction changes.

Parameters

pid – The player ID whose faction changes should be used.

Returns

The action type (0 for RANK, 1 for EXPULSION, 2 for REPUTATION).

static const char *GetFactionId(unsigned short pid, unsigned int index) noexcept

Get the factionId at a certain index in a player’s latest faction changes.

Parameters
  • pid – The player ID whose faction changes should be used.

  • index – The index of the faction.

Returns

The factionId.

static int GetFactionRank(unsigned short pid, unsigned int index) noexcept

Get the rank at a certain index in a player’s latest faction changes.

Parameters
  • pid – The player ID whose faction changes should be used.

  • index – The index of the faction.

Returns

The rank.

static bool GetFactionExpulsionState(unsigned short pid, unsigned int index) noexcept

Get the expulsion state at a certain index in a player’s latest faction changes.

Parameters
  • pid – The player ID whose faction changes should be used.

  • index – The index of the faction.

Returns

The expulsion state.

static int GetFactionReputation(unsigned short pid, unsigned int index) noexcept

Get the reputation at a certain index in a player’s latest faction changes.

Parameters
  • pid – The player ID whose faction changes should be used.

  • index – The index of the faction.

Returns

The reputation.

static void SetFactionChangesAction(unsigned short pid, unsigned char action) noexcept

Set the action type in a player’s faction changes.

Parameters
  • pid – The player ID whose faction changes should be used.

  • action – The action (0 for RANK, 1 for EXPULSION, 2 for REPUTATION).

Returns

void

static void SetFactionId(const char *factionId) noexcept

Set the factionId of the temporary faction stored on the server.

Parameters

factionId – The factionId.

Returns

void

static void SetFactionRank(unsigned int rank) noexcept

Set the rank of the temporary faction stored on the server.

Parameters

rank – The rank.

Returns

void

static void SetFactionExpulsionState(bool expulsionState) noexcept

Set the expulsion state of the temporary faction stored on the server.

Parameters

expulsionState – The expulsion state.

Returns

void

static void SetFactionReputation(int reputation) noexcept

Set the reputation of the temporary faction stored on the server.

Parameters

reputation – The reputation.

Returns

void

static void AddFaction(unsigned short pid) noexcept

Add the server’s temporary faction to the faction changes for a player.

In the process, the server’s temporary faction will automatically be cleared so a new one can be set up.

Parameters

pid – The player ID whose faction changes should be used.

Returns

void

static void SendFactionChanges(unsigned short pid, bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept

Send a PlayerFaction packet with a player’s recorded faction changes.

Parameters
  • pid – The player ID whose faction changes should be used.

  • sendToOtherPlayers – Whether this packet should be sent to players other than the player attached to the packet (false by default).

  • skipAttachedPlayer – Whether the packet should skip being sent to the player attached to the packet (false by default).

Returns

void