v0.10.0

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 Object The ID of the hand to add.
handId.handId string -

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 Object The ID of the player to check.
playerId.playerId string -

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 Object {} The ID of the hand to clear.
handId.handId? string 'main' -

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): unknown

Gets an attribute from the seat.

Parameters

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

Returns

unknown

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


getAttributes

▸ getAttributes(): Record<string, unknown>

Gets all attributes from the seat.

Returns

Record<string, unknown>

A record of all attributes.


getHand

▸ getHand(handId?): null | Hand

Gets a hand from the seat.

Parameters

Name Type Default value Description
handId Object {} The ID of the hand to get.
handId.handId? string 'main' -

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 Object The key of the attribute to check.
key.key string -

Returns

boolean

True if the attribute exists, false otherwise.


removeAttribute

▸ removeAttribute(key): void

Removes an attribute from the seat.

Parameters

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

Returns

void


removeHand

▸ removeHand(handId): boolean

Removes a hand from the seat.

Parameters

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

Returns

boolean

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


setAttribute

▸ setAttribute(«destructured»): void

Sets an attribute on the seat.

Parameters

Name Type
«destructured» Object
› key string
› value unknown

Returns

void


setAttributes

▸ setAttributes(attributes): void

Sets multiple attributes on the seat.

Parameters

Name Type Description
attributes Object A record of attributes to set.
attributes.attributes Record<string, unknown> -

Returns

void


setPlayer

▸ setPlayer(player): void

Sets the player for the seat.

Parameters

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

Returns

void