A React/Express online multiplayer Tombola client/server combo.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
942 B

  1. import { Socket } from "socket.io";
  2. export type SocketID = string;
  3. export interface SocketWrapper {
  4. id: SocketID,
  5. socket: Socket
  6. };
  7. export interface Player {
  8. socketData: SocketWrapper;
  9. username: string;
  10. hasTabellone: boolean;
  11. cartelle: number[];
  12. choseAllCartelle: boolean;
  13. }
  14. export interface StrippedPlayer {
  15. username: string;
  16. id: SocketID;
  17. }
  18. export enum TombolaAction {
  19. NONE,
  20. AMBO = 2,
  21. TERNO,
  22. QUATERNA,
  23. CINQUINA,
  24. TOMBOLA = 15,
  25. DONE
  26. }
  27. export type PracticalTombolaAction = Exclude<Exclude<TombolaAction, TombolaAction.NONE>, TombolaAction.DONE>;
  28. export interface Room {
  29. tabellone: number[];
  30. players: Player[];
  31. gameStarted: boolean;
  32. id: string;
  33. nextProgress: Exclude<TombolaAction, TombolaAction.NONE>;
  34. winners: {
  35. [Prog in PracticalTombolaAction]: StrippedPlayer[] | null;
  36. };
  37. };
  38. export enum RoomJoinError {
  39. NoSuchRoom,
  40. GameHasStarted
  41. }