CoompanionApp/server/protocol.ts

99 lines
1.9 KiB
TypeScript
Raw Normal View History

2026-02-03 13:48:56 +01:00
import type { SessionSnapshot } from "../shared/types";
export type ClientMessage =
| {
type: "chat_send";
sessionId: string;
playerId: string;
body: string;
groupId?: string | null;
}
| {
type: "transfer";
sessionId: string;
playerId: string;
toPlayerId: string;
amount: number;
note?: string | null;
}
| {
type: "banker_adjust";
sessionId: string;
bankerId: string;
targetId: string;
amount: number;
note?: string | null;
}
| {
type: "banker_force_transfer";
sessionId: string;
bankerId: string;
fromId: string;
toId: string;
amount: number;
note?: string | null;
}
| {
type: "banker_blackout";
sessionId: string;
bankerId: string;
active: boolean;
reason?: string | null;
}
| {
type: "banker_start";
sessionId: string;
bankerId: string;
}
| {
type: "banker_end";
sessionId: string;
bankerId: string;
}
| {
type: "banker_create_dummy";
sessionId: string;
bankerId: string;
name: string;
balance?: number;
}
| {
type: "group_create";
sessionId: string;
playerId: string;
name: string;
memberIds: string[];
}
| {
type: "takeover_request";
sessionId: string;
playerId: string;
dummyId: string;
}
| {
type: "banker_takeover_approve";
sessionId: string;
bankerId: string;
dummyId: string;
requesterId: string;
}
| {
type: "ping";
sessionId: string;
playerId: string;
};
export type ServerMessage =
| {
type: "state";
session: SessionSnapshot;
}
| {
type: "error";
message: string;
}
| {
type: "takeover_approved";
assignedPlayerId: string;
};