Class PlayerInfo<RoomType>

Represents information about a player, including any cosmetics they have equipped, whether they are dead or the impostor, their role and whatever tasks they have.

Type Parameters

Hierarchy

  • PlayerInfo

Methods

  • Create a default player info object.

    Returns

    A default player info object.

    Type Parameters

    Parameters

    • gamedata: GameData<RoomType>

      The gamedata object that this player information belongs to.

    • playerId: number

      The ID of the player.

    Returns PlayerInfo<RoomType>

  • Parameters

    Returns void

  • Parameters

    Returns void

  • Clone the player info for another player.

    Parameters

    • playerId: number

    Returns PlayerInfo<RoomType>

  • Mark a task of this player as completed.

    Parameters

    Returns void

  • Delete an outfit on this player.

    Parameters

    Returns void

  • Get an outfit from this player, or create it from the player's default base outfit if it doesn't exist, or create a new one entirely if that doesn't exist.

    Parameters

    Returns PlayerOutfit

  • The player that this info is for.

    Returns undefined | PlayerData<RoomType>

  • Set whether this player is flagged as dead.

    Parameters

    • isDead: boolean

    Returns void

  • Set whether this player is flagged as disconnected.

    Parameters

    • isDisconnected: boolean

    Returns void

  • Set the flags of this player.

    Parameters

    • flags: number

    Returns void

  • Parameters

    Returns void

  • Set whether this player is flagged as an impostor.

    Parameters

    • isImpostor: boolean

    Returns void

  • Parameters

    Returns void

  • Parameters

    Returns void

  • Create or overwrite one of this player's outfits.

    Parameters

    Returns void

  • Parameters

    Returns void

  • Parameters

    Returns void

  • Set the tasks of this player.

    Parameters

    • taskIds: number[]

      The IDs of each task.

    Returns Promise<void>

  • Set the task states of this player.

    Parameters

    Returns void

  • Parameters

    Returns void

Constructors

  • Type Parameters

    Parameters

    • gamedata: GameData<RoomType>
    • playerId: number
    • outfits: Partial<Record<PlayerOutfitType, PlayerOutfit>>

      A collection of this player's outfits as they should be displayed. Somewhat of a layer system, the Default outfit shouldn't be displayed if there is another outfit in this object.

    • playerLevel: number

      This player's level/rank.

    • flags: number

      Any flags that this player has, see PlayerDataFlags.

    • roleType: typeof BaseRole

      Which player this role is. Note that this is not their actual instance of this role, see role, but is instead the class used to create the instance, and holds metadata about the role, such as the team it is for and whether it's a role for ghosts or not.

      You can use this to know what class role will be an instance of.

      Example

      if (player.playerInfo.roleType === ImpostorRole) {
      player.role instanceof ImpostorRole // true
      }
    • taskStates: TaskState[]

      All of this player's tasks, and whether or not they have been completed or not by the player.

    • friendCode: string

      The player's Innersloth friend code.

    • puid: string

      The player's global player UUID.

    Returns PlayerInfo<RoomType>

Accessors

  • get currentOutfit(): PlayerOutfit
  • Returns PlayerOutfit

  • get defaultOutfit(): PlayerOutfit
  • Returns PlayerOutfit

  • get isDead(): boolean
  • Whether this player has been flagged as dead.

    Returns boolean

  • get isDisconnected(): boolean
  • Whether this player has been flagged as disconnected.

    Returns boolean

  • get isImpostor(): boolean
  • Whether this player has been flagged as the impostor.

    Returns boolean

Properties

currentOutfitType: PlayerOutfitType
flags: number

Any flags that this player has, see PlayerDataFlags.

friendCode: string

The player's Innersloth friend code.

gamedata: GameData<RoomType>
outfits: Partial<Record<PlayerOutfitType, PlayerOutfit>>

A collection of this player's outfits as they should be displayed. Somewhat of a layer system, the Default outfit shouldn't be displayed if there is another outfit in this object.

playerId: number
playerLevel: number

This player's level/rank.

puid: string

The player's global player UUID.

roleType: typeof BaseRole

Which player this role is. Note that this is not their actual instance of this role, see role, but is instead the class used to create the instance, and holds metadata about the role, such as the team it is for and whether it's a role for ghosts or not.

You can use this to know what class role will be an instance of.

Example

if (player.playerInfo.roleType === ImpostorRole) {
player.role instanceof ImpostorRole // true
}
taskStates: TaskState[]

All of this player's tasks, and whether or not they have been completed or not by the player.

Generated using TypeDoc