shoehive
Version:
WebSocket-based multiplayer game framework for real-time, event-driven gameplay
53 lines (52 loc) • 2.67 kB
TypeScript
import { Table } from "../core/Table";
import { Player } from "../core/Player";
/**
* Table events
*
* This is a comprehensive list of all events that can be emitted by the Table class.
*
* You can use these events to listen for changes in the table state, or to trigger actions based on table events.
*/
export declare const TABLE_EVENTS: {
readonly CREATED: "table:created";
readonly EMPTY: "table:empty";
readonly STATE_UPDATED: "table:state:updated";
readonly ATTRIBUTE_CHANGED: "table:attribute:changed";
readonly ATTRIBUTES_CHANGED: "table:attributes:changed";
readonly PLAYER_JOINED: "table:player:joined";
readonly PLAYER_LEFT: "table:player:left";
readonly PLAYER_SAT: "table:player:sat";
readonly PLAYER_STOOD: "table:player:stood";
readonly DECK_CREATED: "table:deck:created";
readonly DECK_SHUFFLED: "table:deck:shuffled";
readonly DECK_CARD_DRAWN: "table:deck:card:drawn";
readonly CARD_DEALT: "table:card:dealt";
readonly SEAT_HAND_ADDED: "table:seat:hand:added";
readonly SEAT_HAND_REMOVED: "table:seat:hand:removed";
readonly SEAT_HAND_CLEARED: "table:seat:hand:cleared";
readonly SEATS_HANDS_CLEARED: "table:seats:hands:cleared";
};
/**
* These are the payload structures for native Table events.
*
* You can use these payloads to listen for changes in the table state, or to trigger actions based on table events.
*/
export interface DefaultTableEventPayloadMap {
[TABLE_EVENTS.CREATED]: [table: Table];
[TABLE_EVENTS.EMPTY]: [table: Table];
[TABLE_EVENTS.STATE_UPDATED]: [table: Table];
[TABLE_EVENTS.ATTRIBUTE_CHANGED]: [table: Table, key: string, value: any];
[TABLE_EVENTS.ATTRIBUTES_CHANGED]: [table: Table, changedKeys: string[], attributes: Record<string, any>];
[TABLE_EVENTS.PLAYER_JOINED]: [table: Table, player: Player];
[TABLE_EVENTS.PLAYER_LEFT]: [table: Table, player: Player];
[TABLE_EVENTS.PLAYER_SAT]: [table: Table, player: Player, seatIndex: number];
[TABLE_EVENTS.PLAYER_STOOD]: [table: Table, player: Player, seatIndex: number];
[TABLE_EVENTS.DECK_CREATED]: [table: Table, deckId: string];
[TABLE_EVENTS.DECK_SHUFFLED]: [table: Table, deckId: string];
[TABLE_EVENTS.DECK_CARD_DRAWN]: [table: Table, deckId: string, card: any];
[TABLE_EVENTS.CARD_DEALT]: [table: Table, player: Player, card: any];
[TABLE_EVENTS.SEAT_HAND_ADDED]: [table: Table, seatIndex: number, handId: string];
[TABLE_EVENTS.SEAT_HAND_REMOVED]: [table: Table, seatIndex: number, handId: string];
[TABLE_EVENTS.SEAT_HAND_CLEARED]: [table: Table, seatIndex: number];
[TABLE_EVENTS.SEATS_HANDS_CLEARED]: [table: Table];
}