v0.8.2

Class: Seat

Represents a seat at a table.

✅ Attribute Support

This class manages a player’s seat at a table, including their hands and attributes. It provides methods for setting and getting player information, adding and removing hands, clearing hands, and managing seat attributes.

Table of contents

Constructors

Methods

Constructors

constructor

• new Seat(): Seat

Creates a new seat with a main hand by default.

Returns

Seat

Methods

addHand

▸ addHand(handId): boolean

Adds a hand to the seat.

Parameters

Name Type Description
handId string The ID of the hand to add.

Returns

boolean

True if the hand was added, false if it already exists.


canPlayerModify

▸ canPlayerModify(playerId): boolean

Checks if a player can modify a seat. This enforces that only the player who owns the seat can modify it.

Parameters

Name Type Description
playerId string The ID of the player to check.

Returns

boolean

True if the player can modify the seat, false otherwise.


clearAllHands

▸ clearAllHands(): void

Clears all hands from the seat.

Returns

void


clearHand

▸ clearHand(handId?): boolean

Clears a hand from the seat.

Parameters

Name Type Default value Description
handId string "main" The ID of the hand to clear.

Returns

boolean

True if the hand was cleared, false if it does not exist.


getAllHands

▸ getAllHands(): Map<string, Hand>

Gets all hands from the seat.

Returns

Map<string, Hand>

A map of all hands.


getAttribute

▸ getAttribute(key): any

Gets an attribute from the seat.

Parameters

Name Type Description
key string The key of the attribute to get.

Returns

any

The value of the attribute or null if it does not exist.


getAttributes

▸ getAttributes(): Record<string, any>

Gets all attributes from the seat.

Returns

Record<string, any>

A record of all attributes.


getHand

▸ getHand(handId?): null | Hand

Gets a hand from the seat.

Parameters

Name Type Default value Description
handId string "main" The ID of the hand to get.

Returns

null | Hand

The hand or null if it does not exist.


getPlayer

▸ getPlayer(): null | Player

Gets the player for the seat.

Returns

null | Player

The player for the seat or null if no player is set.


hasAttribute

▸ hasAttribute(key): boolean

Checks if the seat has an attribute.

Parameters

Name Type Description
key string The key of the attribute to check.

Returns

boolean

True if the attribute exists, false otherwise.


removeAttribute

▸ removeAttribute(key): void

Removes an attribute from the seat.

Parameters

Name Type Description
key string The key of the attribute to remove.

Returns

void


removeHand

▸ removeHand(handId): boolean

Removes a hand from the seat.

Parameters

Name Type Description
handId string The ID of the hand to remove.

Returns

boolean

True if the hand was removed, false if it does not exist.


setAttribute

▸ setAttribute(key, value): void

Sets an attribute on the seat.

Parameters

Name Type Description
key string The key of the attribute to set.
value any The value of the attribute to set.

Returns

void


setAttributes

▸ setAttributes(attributes): void

Sets multiple attributes on the seat.

Parameters

Name Type Description
attributes Record<string, any> A record of attributes to set.

Returns

void


setPlayer

▸ setPlayer(player): void

Sets the player for the seat.

Parameters

Name Type Description
player null | Player The player to set for the seat.

Returns

void