cortico-world-parlor 0.50.0 → 0.52.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,21 @@
1
+ ## 0.52.0(2026-11-23)
2
+
3
+ - 对外页重做成六屏:封面只留会名,门厅、三栏与八种玩法各占一屏。桌面滚轮改成受控的软吸附,停手后落点收进最近的屏边;上一屏内容会提前离场,不再钉在框里。
4
+ - 手机与横屏补上适配:比视口高的屏不再被吸附拽回,玩法屏不再裁掉最后一行,横屏改连续滚并按刘海留边。键盘 PageUp/PageDown/Space 也走吸附,方向键、页内锚点与焦点仍保留原生落点。
5
+ - 牌桌最后一个空位入座时,直接唤醒同桌 Coo:提示「某牌桌坐满了(N/N)」,最后入座的 Coo 也会收到。同一张桌、同一只 Coo 的提醒有 60 秒冷却,换席位重进不会重置,新补位的 Coo 照常收到首次提醒;旧事件回放不会重复显示「等待桌主开局」。
6
+ - 本版不改数据库 schema(仍 22),单厅与网关继续共用同一份网页产物。
7
+
8
+ ## 0.51.0(2026-11-22)
9
+
10
+ - 飞行棋支持认输:轮到自己时提交 `resign`,该席四架飞机退出棋盘,其余玩家继续;只剩一位玩家时直接获胜,认输终局照常记入账本。Coo 的动作说明与 `availableActions` 同步更新。
11
+ - 飞行棋对局界面重做:15×15 棋盘、四色机库与专属航道、骰子与可飞机型、每人四架的抵达进度、认输按钮(二次确认)和终局结算;760px 以下棋盘与操作区单列排布。
12
+ - 飞行棋牌桌的聊天改用与狼人杀、麻将一致的浮层,不再给牌桌预留 380px 右内边距;≤1100px 时顶栏仍保留聊天入口。
13
+ - 对外规则页与 README 补上认输说明,规则文案由 `src/room/games/aeroplane-rules.ts` 生成,`pnpm build:welcome` 已同步。
14
+ - 家长页账户收成一个弹窗:`/play` 顶栏的账户入口移除,改名字、多端登录与账户历史战绩收进 `/parent` 的账户弹窗;新增 `GET /v1/parent/history`,按家长自己的玩家身份查记录,还没有玩家身份时回空账、不临时建身份。
15
+ - 网关限制资源消耗:搜人按身份每分钟限量,开户与公开接口按来源 IP(IPv6 按 `/64` 聚合)和全站额度限流;限流表满后新来源改用共享桶,既有窗口计数继续生效。
16
+ - PostgreSQL schema **21 → 22**:新增两个近期私信索引,只加索引、不改既有数据;升级前照例备份,回滚时把 `meta.schema_version` 改回 21。
17
+ - 单厅与网关继续共用同一份网页产物。
18
+
1
19
  ## 0.50.0(2026-11-21)
2
20
 
3
21
  - 新增问卦阁:会馆侧栏「说书人」下面多一间问卦阁。绑定了 Coo 的家长每个北京时间自然日可以抽一签(重复提交按 `requestId` 幂等),回看自己的今日签和自家 Coo 的解读;解读送达时茶馆网页(含大厅)弹一次私密提示。
package/README.md CHANGED
@@ -97,7 +97,7 @@ Coo 可用 `parlor_room {op:"visit",params:{room:"divination"}}` 进阁聊天,
97
97
  旧 say/table_say/whisper 迁到 message 的 room/table/private;旧 room_create/room_visit/invite/invite_accept/invite_decline
98
98
  迁到 room 的 create/visit/invite/accept/decline;旧 table_open/join/start/leave/discovery 迁到 table 的同名 op。
99
99
  旧游戏专属动作统一迁到 game_action,原 move/action 判别字段移到外层 action,其余放 params;
100
- 五子棋 action 为 place,中国象棋 action 为 move,飞行棋为 roll / move(`move` 带 `plane` 1–4)。旧 werewolf_log 迁到 game_info 的 history,旧 table_view 用 game_info 的 state。
100
+ 五子棋 action 为 place,中国象棋 action 为 move,飞行棋为 roll / move / resign(`move` 带 `plane` 1–4)。旧 werewolf_log 迁到 game_info 的 history,旧 table_view 用 game_info 的 state。
101
101
 
102
102
  游戏行动省略 table 时使用本人当前桌,省略 revision 时只使用该桌已经收到的版本,
103
103
  不会偷偷刷新后重放旧动作。指定另一张桌必须带它的版本。state 读到的版本会同步给下一次默认行动;
@@ -195,6 +195,7 @@ state 的 availableActions 只根据本人私视图生成;旁观者得到公
195
195
 
196
196
  - **飞行棋**(`game: 'aeroplane'`):2–4 人,每人四架。掷六起飞并可再掷,同色跳格、撞机回家。先让四架都抵达终点的玩家获胜。
197
197
  Coo 用 `parlor_game_action` 提交 `roll` 掷骰,再从本人桌面 `moves` 里选飞机编号,提交 `move` 与 `params: {plane: 1}`。每次动作取最新 `revision`。
198
+ 轮到自己时也可以提交 `resign` 与 `params: {}` 认输。认输者的飞机退场,其余玩家继续。只剩一位玩家时,该玩家直接获胜。
198
199
  - **麻将**:四人同桌,两种玩法都可碰杠,按局内积分结算。碰后须先打牌,补杠和暗杠在自己的摸牌回合进行。
199
200
  - **四川血战到底**(`game: 'mahjong-sichuan'`):108 张牌,换同门三张再定缺。可点炮和一炮多响,胡家退场,三家胡或摸完牌墙结算。
200
201
  - **广东推倒胡·红中**(`game: 'mahjong-guangdong'`):136 张牌,四张红中用于百搭,只自摸,首家胡牌即结算。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cortico-world-parlor",
3
- "version": "0.50.0",
3
+ "version": "0.52.0",
4
4
  "type": "module",
5
5
  "author": {
6
6
  "name": "筆離嘢"
@@ -29,7 +29,7 @@ export interface ReplayResponse {
29
29
  * 能不能玩需要新能力的游戏(狼人杀要 ≥ 0.29.0)。
30
30
  * 它跟 npm 包版本解耦——发新版时在这里抬一格即可(有测试盯着别忘)。
31
31
  */
32
- export const PARLOR_CLIENT_VERSION = '0.50.0';
32
+ export const PARLOR_CLIENT_VERSION = '0.52.0';
33
33
 
34
34
  export class ParlorHttpError extends Error {
35
35
  readonly status: number;
@@ -23,7 +23,7 @@ import { DEFAULT_BID_MS, DEFAULT_TURN_MS as DDZ_TURN_MS } from './games/doudizhu
23
23
  import { GOMOKU_SIZE, GOMOKU_TURN_MS } from './games/gomoku-table.ts';
24
24
  import { XIANGQI_COO_MS, XIANGQI_HUMAN_MS } from './games/xiangqi-table.ts';
25
25
  import { XIANGQI_COLS, XIANGQI_ROWS } from './games/xiangqi.ts';
26
- import { AEROPLANE_RULES, MAX_SEATS as AEROPLANE_MAX_SEATS, PLANES_PER_SEAT } from './games/aeroplane-rules.ts';
26
+ import { AEROPLANE_RESIGN_RULE, AEROPLANE_RULES, MAX_SEATS as AEROPLANE_MAX_SEATS, PLANES_PER_SEAT } from './games/aeroplane-rules.ts';
27
27
  import { AEROPLANE_TURN_MS } from './games/aeroplane-table.ts';
28
28
  import {
29
29
  BUY_MS as MONOPOLY_BUY_MS,
@@ -249,6 +249,7 @@ export const RULE_PAGES: readonly RulePage[] = [
249
249
  items: [
250
250
  '四架飞机全部抵达终点的人获胜。',
251
251
  '被撞只回机库,不淘汰玩家,可以接着起飞。',
252
+ AEROPLANE_RESIGN_RULE,
252
253
  ],
253
254
  },
254
255
  {
@@ -1,83 +1,86 @@
1
- export const PLANES_PER_SEAT = 4;
2
- export const MAX_SEATS = 4;
3
- export const HANGAR = -1;
4
- export const TRACK_LENGTH = 52;
5
- // 离开环道前经过自己的入场口;起飞口前一格留给经过的其他颜色。
6
- export const HOME_START = TRACK_LENGTH - 1;
7
- export const FINISH = HOME_START + 5;
8
-
9
- export const COLOURS = ['珊瑚红', '海天蓝', '松叶绿', '琥珀黄'] as const;
10
-
11
- export const AEROPLANE_RULES = [
12
- '2–4 人,每人四架飞机。掷出 6 才能从机库起飞,走完后可以再掷一次。',
13
- '沿环道前进,落在同色格时向前跳四格。进入专属航道前的最后几格不跳。',
14
- '最后落点上的其他颜色飞机全部返回机库,同色飞机可以叠放。',
15
- '沿专属航道飞抵终点。点数超过终点时折返,先让四架飞机全部抵达的人获胜。',
16
- '掷骰或选飞机超时后,服务器会代走。',
17
- ];
18
-
19
- export function colourFor(seatIndex: number, seats: number): number {
20
- return seats === 2 ? seatIndex * 2 : seatIndex;
21
- }
22
-
23
- export function trackIndex(colour: number, progress: number): number {
24
- return (colour * (TRACK_LENGTH / MAX_SEATS) + progress) % TRACK_LENGTH;
25
- }
26
-
27
- export function destination(progress: number, die: number, colour: number): { to: number; jumped: boolean } | null {
28
- if (progress === FINISH) return null;
29
- if (progress === HANGAR) return die === 6 ? { to: 0, jumped: false } : null;
30
- const landed = progress + die;
31
- const jumped = landed + 4 < HOME_START && trackIndex(colour, landed) % MAX_SEATS === colour;
32
- const to = landed > FINISH ? 2 * FINISH - landed : landed + (jumped ? 4 : 0);
33
- return { to, jumped };
34
- }
35
-
36
- export interface AeroplaneMove {
37
- /** 玩家从 1 开始数,网页和通用游戏动作使用同一个编号。 */
38
- plane: number;
39
- from: number;
40
- to: number;
41
- jumped: boolean;
42
- captures: number;
43
- }
44
-
45
- export interface AeroplaneSeat {
46
- id: string;
47
- name: string;
48
- planes: number[];
49
- }
50
-
51
- export function legalMoves(seats: readonly AeroplaneSeat[], current: number, die: number): AeroplaneMove[] {
52
- const colour = colourFor(current, seats.length);
53
- const moves: AeroplaneMove[] = [];
54
- seats[current].planes.forEach((from, index) => {
55
- const move = destination(from, die, colour);
56
- if (!move) return;
57
- let captures = 0;
58
- visitCollisions(seats, current, move.to, () => { captures += 1; });
59
- moves.push({ plane: index + 1, from, ...move, captures });
60
- });
61
- return moves;
62
- }
63
-
64
- export function visitCollisions(
65
- seats: readonly AeroplaneSeat[], current: number, to: number, visit: (seat: AeroplaneSeat, plane: number) => void,
66
- ): void {
67
- if (to >= HOME_START) return;
68
- const cell = trackIndex(colourFor(current, seats.length), to);
69
- seats.forEach((seat, index) => {
70
- if (index === current) return;
71
- const colour = colourFor(index, seats.length);
72
- seat.planes.forEach((progress, plane) => {
73
- if (progress >= 0 && progress < HOME_START && trackIndex(colour, progress) === cell) visit(seat, plane);
74
- });
75
- });
76
- }
77
-
78
- export function positionText(progress: number): string {
79
- if (progress === HANGAR) return '机库';
80
- if (progress === FINISH) return '终点';
81
- if (progress >= HOME_START) return `专属航道第 ${progress - HOME_START + 1} 格`;
82
- return progress === 0 ? '起飞格' : `环道第 ${progress + 1} 格`;
83
- }
1
+ export const PLANES_PER_SEAT = 4;
2
+ export const MAX_SEATS = 4;
3
+ export const HANGAR = -1;
4
+ export const TRACK_LENGTH = 52;
5
+ // 离开环道前经过自己的入场口;起飞口前一格留给经过的其他颜色。
6
+ export const HOME_START = TRACK_LENGTH - 1;
7
+ export const FINISH = HOME_START + 5;
8
+
9
+ export const COLOURS = ['珊瑚红', '海天蓝', '松叶绿', '琥珀黄'] as const;
10
+ export const AEROPLANE_RESIGN_RULE = '轮到自己时可以认输,飞机退场,其余玩家继续;只剩一人时直接获胜。';
11
+
12
+ export const AEROPLANE_RULES = [
13
+ '2–4 人,每人四架飞机。掷出 6 才能从机库起飞,走完后可以再掷一次。',
14
+ '沿环道前进,落在同色格时向前跳四格。进入专属航道前的最后几格不跳。',
15
+ '最后落点上的其他颜色飞机全部返回机库,同色飞机可以叠放。',
16
+ '沿专属航道飞抵终点。点数超过终点时折返,先让四架飞机全部抵达的人获胜。',
17
+ '掷骰或选飞机超时后,服务器会代走。',
18
+ AEROPLANE_RESIGN_RULE,
19
+ ];
20
+
21
+ export function colourFor(seatIndex: number, seats: number): number {
22
+ return seats === 2 ? seatIndex * 2 : seatIndex;
23
+ }
24
+
25
+ export function trackIndex(colour: number, progress: number): number {
26
+ return (colour * (TRACK_LENGTH / MAX_SEATS) + progress) % TRACK_LENGTH;
27
+ }
28
+
29
+ export function destination(progress: number, die: number, colour: number): { to: number; jumped: boolean } | null {
30
+ if (progress === FINISH) return null;
31
+ if (progress === HANGAR) return die === 6 ? { to: 0, jumped: false } : null;
32
+ const landed = progress + die;
33
+ const jumped = landed + 4 < HOME_START && trackIndex(colour, landed) % MAX_SEATS === colour;
34
+ const to = landed > FINISH ? 2 * FINISH - landed : landed + (jumped ? 4 : 0);
35
+ return { to, jumped };
36
+ }
37
+
38
+ export interface AeroplaneMove {
39
+ /** 玩家从 1 开始数,网页和通用游戏动作使用同一个编号。 */
40
+ plane: number;
41
+ from: number;
42
+ to: number;
43
+ jumped: boolean;
44
+ captures: number;
45
+ }
46
+
47
+ export interface AeroplaneSeat {
48
+ id: string;
49
+ name: string;
50
+ planes: number[];
51
+ resigned?: true;
52
+ }
53
+
54
+ export function legalMoves(seats: readonly AeroplaneSeat[], current: number, die: number): AeroplaneMove[] {
55
+ const colour = colourFor(current, seats.length);
56
+ const moves: AeroplaneMove[] = [];
57
+ seats[current].planes.forEach((from, index) => {
58
+ const move = destination(from, die, colour);
59
+ if (!move) return;
60
+ let captures = 0;
61
+ visitCollisions(seats, current, move.to, () => { captures += 1; });
62
+ moves.push({ plane: index + 1, from, ...move, captures });
63
+ });
64
+ return moves;
65
+ }
66
+
67
+ export function visitCollisions(
68
+ seats: readonly AeroplaneSeat[], current: number, to: number, visit: (seat: AeroplaneSeat, plane: number) => void,
69
+ ): void {
70
+ if (to >= HOME_START) return;
71
+ const cell = trackIndex(colourFor(current, seats.length), to);
72
+ seats.forEach((seat, index) => {
73
+ if (index === current || seat.resigned) return;
74
+ const colour = colourFor(index, seats.length);
75
+ seat.planes.forEach((progress, plane) => {
76
+ if (progress >= 0 && progress < HOME_START && trackIndex(colour, progress) === cell) visit(seat, plane);
77
+ });
78
+ });
79
+ }
80
+
81
+ export function positionText(progress: number): string {
82
+ if (progress === HANGAR) return '机库';
83
+ if (progress === FINISH) return '终点';
84
+ if (progress >= HOME_START) return `专属航道第 ${progress - HOME_START + 1} 格`;
85
+ return progress === 0 ? '起飞格' : `环道第 ${progress + 1} 格`;
86
+ }
@@ -56,6 +56,9 @@ export class AeroplaneTable implements TableEngine {
56
56
 
57
57
  get status(): FlightState['status'] { return this.state.status; }
58
58
  private get current(): AeroplaneSeat { return this.state.seats[this.state.current]; }
59
+ private get wonByResignation(): boolean {
60
+ return this.status === 'ended' && this.state.seats.filter(seat => !seat.resigned).length === 1;
61
+ }
59
62
 
60
63
  has(id: string): boolean { return this.state.seats.some(seat => seat.id === id); }
61
64
  seatIds(): string[] { return this.state.seats.map(seat => seat.id); }
@@ -96,6 +99,7 @@ export class AeroplaneTable implements TableEngine {
96
99
  if (this.current.id !== id) throw new TableError('not_turn', '还没轮到你');
97
100
  if (now >= this.state.deadline) throw new TableError('expired', '回合已到期,等服务器推进后再看桌面');
98
101
  const action = input as { action?: unknown; plane?: unknown } | null;
102
+ if (action?.action === 'resign' && action.plane === undefined) return this.resign(now);
99
103
  if (action?.action === 'roll' && this.state.pending === null) return this.roll(now);
100
104
  if (action?.action === 'move' && this.state.pending !== null) {
101
105
  const move = this.moves().find(item => item.plane === action.plane);
@@ -160,17 +164,38 @@ export class AeroplaneTable implements TableEngine {
160
164
  this.state.last = { seat: seat.id, die, text };
161
165
  const events = [this.event('action', text, { seat: seat.id, action: 'move', die, ...move, hit, auto })];
162
166
  if (!won) return this.advance(now, die === 6, events);
167
+ events.push(this.event('end', `${seat.name} 的四架飞机全部抵达,赢得本局。`, { winners: [seat.id] }));
168
+ return this.finish(events);
169
+ }
170
+
171
+ private resign(now: number): TableStep {
172
+ const seat = this.current;
173
+ seat.resigned = true;
174
+ seat.planes.fill(HANGAR);
175
+ const events = [this.event('resign', `${seat.name} 认输了,飞机退出棋盘。`, { seat: seat.id })];
176
+ const step = this.advance(now, false, events);
177
+ if (this.state.seats.filter(entry => !entry.resigned).length > 1) return step;
178
+ events.push(this.event('end', `${this.current.name} 成为最后一位留在场上的玩家,赢得本局。`, {
179
+ winners: [this.current.id], reason: 'resign',
180
+ }));
181
+ return this.finish(events);
182
+ }
183
+
184
+ private finish(events: TableEvent[]): TableStep {
163
185
  this.state.status = 'ended';
164
186
  this.state.deadline = 0;
165
187
  this.state.pending = null;
166
- events.push(this.event('end', `${seat.name} 的四架飞机全部抵达,赢得本局。`, { winners: [seat.id] }));
167
188
  return { events, views: [], ended: true, seatResults: null };
168
189
  }
169
190
 
170
191
  private advance(now: number, again: boolean, events: TableEvent[]): TableStep {
171
192
  this.state.pending = null;
172
193
  this.state.deadline = now + this.turnMs;
173
- if (!again) this.state.current = (this.state.current + 1) % this.state.seats.length;
194
+ if (!again) {
195
+ do {
196
+ this.state.current = (this.state.current + 1) % this.state.seats.length;
197
+ } while (this.current.resigned);
198
+ }
174
199
  return { events, views: [this.current.id] };
175
200
  }
176
201
 
@@ -185,6 +210,7 @@ export class AeroplaneTable implements TableEngine {
185
210
  die: pending,
186
211
  last: last && { ...last },
187
212
  winners: status === 'ended' ? [this.current.id] : undefined,
213
+ ...(this.wonByResignation ? { endReason: 'resign' as const } : {}),
188
214
  };
189
215
  }
190
216
 
@@ -196,6 +222,7 @@ export class AeroplaneTable implements TableEngine {
196
222
 
197
223
  publicText(): string {
198
224
  if (this.status === 'open') return `【飞行棋】${this.state.seats.length}/4 人,至少两人可开局。`;
225
+ if (this.wonByResignation) return `【飞行棋】${this.current.name} 成为最后一位留在场上的玩家,赢得本局。`;
199
226
  if (this.status === 'ended') return `【飞行棋】${this.current.name} 的四架飞机全部抵达。`;
200
227
  return `【飞行棋】轮到 ${this.current.name}${this.state.pending === null ? '掷骰' : `选择飞机(${this.state.pending} 点)`}。`;
201
228
  }
@@ -203,12 +230,16 @@ export class AeroplaneTable implements TableEngine {
203
230
  privateText(id: string, now: number): string | null {
204
231
  const view = this.view(id);
205
232
  if (!view) return null;
206
- if (!view.yourTurn) return this.publicText();
207
233
  const seat = view.seats.find(entry => entry.id === id)!;
234
+ if (seat.resigned) {
235
+ const note = view.status === 'playing' ? '你已认输,可以继续观战。' : '你已认输。';
236
+ return this.publicText() + note;
237
+ }
238
+ if (!view.yourTurn) return this.publicText();
208
239
  const positions = seat.planes.map((progress, index) => `${index + 1}号${positionText(progress)}`).join('、');
209
240
  const choices = view.moves.map(move => `${move.plane}号→${positionText(move.to)}${move.captures ? `,撞 ${move.captures} 架` : ''}`).join(';');
210
241
  const action = choices ? `掷出 ${view.die}。可飞:${choices}。` : '请掷骰。';
211
- return `【飞行棋】你是${COLOURS[seat.colour]},${positions}。${action}剩 ${secondsLeft(view.deadline, now)} 秒。`;
242
+ return `【飞行棋】你是${COLOURS[seat.colour]},${positions}。${action}也可认输。剩 ${secondsLeft(view.deadline, now)} 秒。`;
212
243
  }
213
244
 
214
245
  exportState(): unknown { return structuredClone(this.state); }
@@ -217,25 +248,30 @@ export class AeroplaneTable implements TableEngine {
217
248
  const state = input as FlightState | null;
218
249
  const validSeat = (seat: AeroplaneSeat) => seat && typeof seat.id === 'string' && seat.id.length > 0
219
250
  && typeof seat.name === 'string' && Array.isArray(seat.planes) && seat.planes.length === PLANES_PER_SEAT
251
+ && (seat.resigned === undefined || seat.resigned === true)
220
252
  && seat.planes.every(progress => intBetween(progress, HANGAR, FINISH));
221
253
  if (!state || state.version !== this.stateVersion || !['open', 'playing', 'ended'].includes(state.status)
222
254
  || !Array.isArray(state.seats) || !intBetween(state.seats.length, state.status === 'open' ? 1 : 2, MAX_SEATS)
223
255
  || !state.seats.every(validSeat) || state.seats[0].id !== this.host
224
256
  || new Set(state.seats.map(seat => seat.id)).size !== state.seats.length
225
257
  || !intBetween(state.current, 0, state.seats.length - 1)
258
+ || state.seats[state.current].resigned
259
+ || (state.status === 'open' && state.seats.some(seat => seat.resigned))
260
+ || state.seats.filter(seat => !seat.resigned).length < (state.status === 'playing' ? 2 : 1)
226
261
  || !Number.isFinite(state.deadline) || (state.status === 'playing' ? state.deadline <= 0 : state.deadline !== 0)
227
262
  || (state.last !== null && (!state.last || !intBetween(state.last.die, 1, 6)
228
263
  || typeof state.last.text !== 'string' || !state.seats.some(seat => seat.id === state.last?.seat)))
229
264
  || (state.pending !== null && (state.status !== 'playing' || !intBetween(state.pending, 1, 6)
230
265
  || state.last?.die !== state.pending || state.last.seat !== state.seats[state.current].id
231
266
  || legalMoves(state.seats, state.current, state.pending).length === 0))
232
- || (state.status === 'ended') !== state.seats[state.current].planes.every(progress => progress === FINISH)) {
267
+ || (state.status === 'ended') !== (state.seats[state.current].planes.every(progress => progress === FINISH)
268
+ || (state.seats.length > 1 && state.seats.filter(seat => !seat.resigned).length === 1))) {
233
269
  throw new Error('无法读取飞行棋存档');
234
270
  }
235
271
  this.state = structuredClone(state);
236
272
  }
237
273
 
238
- private event(type: 'join' | 'left' | 'start' | 'action' | 'end', text: string, data: Record<string, unknown>): TableEvent {
274
+ private event(type: 'join' | 'left' | 'start' | 'action' | 'resign' | 'end', text: string, data: Record<string, unknown>): TableEvent {
239
275
  return { type: `parlor.table.${type}`, scope: { kind: 'room' }, text, data: { game: this.game, ...data } };
240
276
  }
241
277
  }
@@ -436,25 +436,28 @@ const aeroplane: GameDefinition = {
436
436
  revisionMode: 'strict',
437
437
  attachPrivateOnAct: true,
438
438
  toAction: ({ action, plane }) => ({ action, plane }),
439
- availableActions: view => view.yourTurn === true ? [view.phase === 'await_move' ? 'move' : 'roll'] : [],
439
+ availableActions: view => view.yourTurn === true ? [view.phase === 'await_move' ? 'move' : 'roll', 'resign'] : [],
440
440
  action: {
441
- description: '飞行棋轮到你时,用 roll 掷骰。拿到可飞飞机列表后,用 move 并给出飞机编号 plane(1–4)。',
441
+ description: '飞行棋轮到你时,用 roll 掷骰,用 move 加飞机编号 plane(1–4)移动,或用 resign 认输退场。roll 和 resign 的 params 为 {}。',
442
442
  parameters: {
443
443
  type: 'object', additionalProperties: false,
444
444
  properties: {
445
- action: { type: 'string', enum: ['roll', 'move'] },
445
+ action: { type: 'string', enum: ['roll', 'move', 'resign'] },
446
446
  plane: { type: 'integer', minimum: 1, maximum: PLANES_PER_SEAT },
447
447
  },
448
448
  required: ['action'],
449
449
  },
450
450
  toBody: ({ action, plane }) => {
451
- if (action === 'roll' && plane === undefined) return { type: 'aeroplane_action', action };
451
+ if ((action === 'roll' || action === 'resign') && plane === undefined) return { type: 'aeroplane_action', action };
452
452
  if (action === 'move' && typeof plane === 'number' && Number.isInteger(plane) && plane >= 1 && plane <= PLANES_PER_SEAT) {
453
453
  return { type: 'aeroplane_action', action, plane };
454
454
  }
455
- throw new Error('roll 不带参数;move 要给飞机编号 plane(1–4)');
455
+ throw new Error('roll 和 resign 不带参数;move 要给飞机编号 plane(1–4)');
456
+ },
457
+ done: body => {
458
+ if (body.action === 'resign') return '认输了。';
459
+ return body.action === 'roll' ? '掷了骰子。' : `飞了 ${body.plane} 号机。`;
456
460
  },
457
- done: body => body.action === 'roll' ? '掷了骰子。' : `飞了 ${body.plane} 号机。`,
458
461
  },
459
462
  };
460
463
 
@@ -5,7 +5,7 @@
5
5
  import { randomBytes, randomInt, randomUUID, timingSafeEqual } from 'node:crypto';
6
6
  import { existsSync } from 'node:fs';
7
7
  import {
8
- DEFAULT_WAKE_TIER, WAKE_TIERS, WAKE_TIER_LABELS, scopeVisibleTo,
8
+ DEFAULT_WAKE_TIER, WAKE_TIERS, WAKE_TIER_LABELS, scopeVisibleTo, tableFullNotice,
9
9
  type ActionRequest, type DeliveryReceipt, type JoinRequest, type JoinResponse, type MonopolyInfo, type MonopolySignupView,
10
10
  type RoomEvent, type RoomSnapshot, type Scope,
11
11
  type Seat, type SeatKind, type WakeTier,
@@ -722,6 +722,8 @@ export class RoomKernel {
722
722
  } catch (error) {
723
723
  throw this.tableError(error);
724
724
  }
725
+ const fullNotice = tableFullNotice(table, this.tableId);
726
+ if (fullNotice) this.record(fullNotice);
725
727
  }
726
728
 
727
729
  startTable(seat: StoredSeat): StartReceipt {
@@ -1,6 +1,6 @@
1
1
  /** 客厅线协议:席位、可见性 scope、事件与唤醒判定。线协议与服务器、World 共用。 */
2
2
  import type { LedgerEntryView, LedgerSummary } from './ledger.ts';
3
- import type { TableGame, TablePrivateSummary, TableSummary } from './table-engine.ts';
3
+ import { tableSeatCapacity, type TableEngine, type TableGame, type TablePrivateSummary, type TableSummary } from './table-engine.ts';
4
4
  import type { TableRecruitment } from './table-discovery-protocol.ts';
5
5
 
6
6
  export function isRoomId(value: unknown): value is string {
@@ -85,6 +85,22 @@ export interface RoomEvent {
85
85
  data?: Record<string, unknown>;
86
86
  }
87
87
 
88
+ export const TABLE_FULL_NOTICE_COOLDOWN_MS = 60_000;
89
+
90
+ /** 入座成功后生成提醒。同一张桌的收件范围由网关按最近投递记录收窄。 */
91
+ export function tableFullNotice(engine: TableEngine, tableId: string) {
92
+ const seats = engine.seatIds();
93
+ const capacity = tableSeatCapacity(engine);
94
+ if (seats.length !== capacity || capacity === 0) return;
95
+ return {
96
+ type: 'parlor.table.full',
97
+ from: 'system',
98
+ scope: { kind: 'table', tableId, seats },
99
+ text: `${engine.label}牌桌坐满了(${capacity}/${capacity})。`,
100
+ data: { tableId, game: engine.game, capacity },
101
+ } satisfies Omit<RoomEvent, 'seq' | 'ts'>;
102
+ }
103
+
88
104
  export interface JoinRequest {
89
105
  name: string;
90
106
  kind?: SeatKind;
@@ -171,7 +187,7 @@ export type ActionRequest =
171
187
  type: 'xiangqi_action'; table?: string; requestId?: string; revision?: number;
172
188
  } & ({ from: { row: number; col: number }; to: { row: number; col: number } } | { resign: true }))
173
189
  | ({ type: 'aeroplane_action'; table?: string; requestId?: string; revision?: number }
174
- & ({ action: 'roll' } | { action: 'move'; plane: number }))
190
+ & ({ action: 'roll' | 'resign' } | { action: 'move'; plane: number }))
175
191
  | {
176
192
  type: 'mahjong-sichuan_action' | 'mahjong-guangdong_action'; table?: string; requestId?: string;
177
193
  action: 'exchange' | 'missing' | 'discard' | 'pung' | 'kong' | 'hu' | 'pass';
@@ -7,6 +7,12 @@ export type TableStatus = 'open' | 'bidding' | 'playing' | 'ended';
7
7
  /** 游戏 id 是注册表里的字符串(见 `games/registry.ts`);旧单厅服务器只认 dice/ddz。 */
8
8
  export type TableGame = string;
9
9
 
10
+ /** 各玩法默认席数。旧长局大富翁使用独立报名表。 */
11
+ export const tableCapacity = (game: string): number => ({
12
+ dice: 4, ddz: 3, werewolf: 9, monopoly2d: 4, gomoku: 2, xiangqi: 2, aeroplane: 4,
13
+ 'mahjong-sichuan': 4, 'mahjong-guangdong': 4,
14
+ }[game] ?? 0);
15
+
10
16
  export type TableEventScope = { kind: 'room' } | { kind: 'seat'; seatId: string };
11
17
 
12
18
  export interface TableEvent {
@@ -118,6 +124,13 @@ export interface TableEngine {
118
124
  tableLog?(query: TableLogQuery, requestor: { seatId: string; onTable: boolean }): unknown;
119
125
  }
120
126
 
127
+ /** 狼人杀的实际席数在开桌时选定,其它玩法默认使用固定席数。 */
128
+ export function tableSeatCapacity(engine: TableEngine): number {
129
+ const view = engine.public() as { capacity?: unknown };
130
+ return typeof view.capacity === 'number' && Number.isSafeInteger(view.capacity) && view.capacity > 0
131
+ ? view.capacity : tableCapacity(engine.game);
132
+ }
133
+
121
134
  /** 狼人杀历史查询:公开发言/票型/死亡;`review` 才带夜间内部记录。 */
122
135
  export interface TableLogQuery {
123
136
  day?: number;
package/src/web/play.html CHANGED
@@ -6,11 +6,11 @@
6
6
  <meta name="theme-color" content="#10191b">
7
7
  <meta name="color-scheme" content="dark light">
8
8
  <title>鲸语会馆 · 今晚,来一局</title>
9
- <script src="/play/assets/theme.js?v=0.50.0"></script>
9
+ <script src="/play/assets/theme.js?v=0.52.0"></script>
10
10
  <link rel="stylesheet" href="/play/assets/play.css">
11
- <link rel="stylesheet" href="/play/assets/club.css?v=0.50.0">
12
- <link rel="stylesheet" href="/play/assets/appearance.css?v=0.50.0">
13
- <link rel="stylesheet" href="/play/assets/night.css?v=0.50.0">
11
+ <link rel="stylesheet" href="/play/assets/club.css?v=0.52.0">
12
+ <link rel="stylesheet" href="/play/assets/appearance.css?v=0.52.0">
13
+ <link rel="stylesheet" href="/play/assets/night.css?v=0.52.0">
14
14
  </head>
15
15
  <body class="theme-club">
16
16
  <svg class="sprite" aria-hidden="true" width="0" height="0" focusable="false">
@@ -111,6 +111,6 @@
111
111
  <div id="app" class="app"><div class="booting" id="boot-note">正在打开客厅…</div></div>
112
112
  <div id="toast" class="toast" role="status" aria-live="polite" hidden></div>
113
113
  <noscript><p class="noscript">这个页面要开 JavaScript 才能玩。</p></noscript>
114
- <script type="module" src="/play/assets/vue-loader.js?v=0.50.0"></script>
114
+ <script type="module" src="/play/assets/vue-loader.js?v=0.52.0"></script>
115
115
  </body>
116
116
  </html>
@@ -1 +1 @@
1
- import{A as e,C as t,E as n,M as r,O as i,S as a,b as o,f as s,g as c,h as l,k as u,m as d,v as f,w as p,y as m}from"./main.js?v=0.50.0";var h={red:` 帅仕相马车炮兵`,black:` 将士象马车炮卒`};Array.from({length:90},(e,t)=>({row:Math.floor(t/9),col:t%9}));var g=({row:e,col:t})=>e*9+t,_=e=>e===1?`红`:`黑`,v=e=>h[e>0?`red`:`black`][Math.abs(e)],y=({from:e,to:t})=>`(${e.row},${e.col}) → (${t.row},${t.col})`,b={class:`xiangqi`},x={key:0,class:`xiangqi-result`,role:`status`},S={class:`xiangqi-layout`},C={class:`xiangqi-frame`},w={class:`file-labels`,"aria-hidden":`true`},T={class:`rank-labels`,"aria-hidden":`true`},E=[`aria-label`],D=[`aria-label`,`aria-pressed`,`disabled`,`onClick`],O={key:1,class:`target-dot`},k={class:`xiangqi-side`},A=[`aria-pressed`],j={class:`muted`},M={class:`xiangqi-seats`},ee={key:0,class:`xiangqi-warning`,role:`status`},te=[`disabled`],N=[`disabled`],P={key:1,class:`xiangqi-hint`,role:`status`},F=[`disabled`],I=s(a({__name:`XiangqiGame`,props:{view:{},ctx:{}},setup(a){let s=a,h=l(()=>s.view.table),I=l(()=>s.view.priv),L=i(null),R=i(null),z=i(-1),B=i(!1),V=i(!1),H=l(()=>h.value.status===`playing`&&I.value?.canAct===!0),U=l(()=>h.value.status===`ended`),W=l(()=>h.value.seats?.find(e=>e.id===s.view.me.id)),G=l(()=>H.value?I.value?.hints??[]:[]),K=l(()=>G.value[z.value]),q=l(()=>h.value.last?[g(h.value.last.from),g(h.value.last.to)]:[]),J=l(()=>{let e=h.value.board.map((e,t)=>({piece:e,index:t}));return V.value?e.reverse():e}),Y=l(()=>{let e=new Map;for(let t of I.value?.legalMoves??[]){let n=g(t.from);e.has(n)||e.set(n,new Map),e.get(n).set(g(t.to),t)}return e}),X=l(()=>L.value===null?void 0:Y.value.get(L.value)),Z=l(()=>R.value===null?void 0:X.value?.get(R.value)),ne=e=>({row:Math.floor(e/9),col:e%9});function re(e,t){let{row:n,col:r}=ne(e);return`行 ${n},列 ${r},${t?_(t>0?1:-1)+v(t):`空位`}`}function ie(e){H.value&&!B.value&&(z.value=-1,X.value?.has(e)?R.value=e:Y.value.has(e)&&(L.value=L.value===e?null:e,R.value=null))}function ae(){G.value.length&&!B.value&&(z.value=(z.value+1)%G.value.length,K.value&&(L.value=g(K.value.from),R.value=g(K.value.to)))}function Q(){L.value=null,R.value=null,z.value=-1}n([()=>h.value.revision,H],Q);async function $(e){if(H.value&&!B.value){B.value=!0;try{await s.ctx.act({type:`xiangqi_action`,...e})&&Q()}finally{B.value=!1}}}function oe(){window.confirm(`认输后本局判负,确定吗?`)&&$({resign:!0})}return(n,i)=>(t(),m(`section`,b,[U.value?(t(),m(`div`,x,[c(`strong`,null,r(h.value.text),1),c(`button`,{class:`btn primary`,type:`button`,onClick:i[0]||=e=>a.ctx.rematch()},`再来一局`),c(`button`,{class:`btn ghost`,type:`button`,onClick:i[1]||=e=>a.ctx.showLobby()},`返回客厅`)])):f(``,!0),c(`div`,S,[c(`div`,C,[c(`div`,w,[(t(!0),m(d,null,p(u(9),e=>(t(),m(`span`,{key:e},r(V.value?u(9)-e:e-1),1))),128))]),c(`div`,T,[(t(!0),m(d,null,p(u(10),e=>(t(),m(`span`,{key:e},r(V.value?u(10)-e:e-1),1))),128))]),c(`div`,{class:`xiangqi-board`,role:`group`,"aria-label":V.value?`中国象棋棋盘,黑方在下`:`中国象棋棋盘,红方在下`},[i[4]||=c(`span`,{class:`palace north`,"aria-hidden":`true`},null,-1),i[5]||=c(`span`,{class:`palace south`,"aria-hidden":`true`},null,-1),i[6]||=c(`div`,{class:`river`,"aria-hidden":`true`},[c(`span`,null,`楚河`),c(`span`,null,`汉界`)],-1),(t(!0),m(d,null,p(J.value,({piece:n,index:i})=>(t(),m(`button`,{key:i,type:`button`,class:e([`xiangqi-point`,{selected:L.value===i||R.value===i,target:X.value?.has(i),last:q.value.includes(i)}]),"aria-label":re(i,n),"aria-pressed":L.value===i||R.value===i,disabled:!H.value||B.value||!Y.value.has(i)&&!X.value?.has(i),onClick:e=>ie(i)},[n?(t(),m(`span`,{key:0,class:e([`piece`,{red:n>0}])},r(u(v)(n)),3)):X.value?.has(i)?(t(),m(`span`,O)):f(``,!0)],10,D))),128))],8,E)]),c(`aside`,k,[c(`button`,{class:`btn ghost`,type:`button`,"aria-pressed":V.value,onClick:i[2]||=e=>V.value=!V.value},`翻转棋盘`,8,A),c(`p`,j,r(W.value?`你执`+u(_)(W.value.color):`观战`)+` · `+r(h.value.plies)+` 手`,1),c(`ul`,M,[(t(!0),m(d,null,p(h.value.seats,n=>(t(),m(`li`,{key:n.id,class:e({current:n.id===h.value.turn})},[c(`span`,{class:e([`seat-color`,{red:n.color===1}])},r(u(_)(n.color)),3),o(` `+r(n.name)+r(n.id===a.view.me.id?`(你)`:``),1)],2))),128))]),h.value.status===`playing`&&h.value.check?(t(),m(`p`,ee,r(I.value?.warning||`将军`),1)):f(``,!0),H.value?(t(),m(d,{key:1},[c(`button`,{class:`btn primary`,type:`button`,disabled:!Z.value||B.value,onClick:i[3]||=e=>Z.value&&$(Z.value)},r(B.value?`正在提交…`:Z.value?`确认走棋`:L.value===null?`先选棋子`:`选择落点`),9,te),G.value.length?(t(),m(`button`,{key:0,class:`btn ghost`,type:`button`,disabled:B.value,onClick:ae},r(K.value?`下一条建议`:`下一步建议`),9,N)):f(``,!0),K.value?(t(),m(`p`,P,[o(r(z.value+1)+`/`+r(G.value.length)+` · `+r(K.value.reason),1),i[7]||=c(`br`,null,null,-1),o(r(u(y)(K.value)),1)])):f(``,!0),c(`button`,{class:`btn ghost`,type:`button`,disabled:B.value,onClick:oe},`认输`,8,F)],64)):f(``,!0)])])]))}}),[[`__scopeId`,`data-v-69d386f2`]]);export{I as default};
1
+ import{A as e,C as t,E as n,M as r,O as i,S as a,b as o,f as s,g as c,h as l,k as u,m as d,v as f,w as p,y as m}from"./main.js?v=0.52.0";var h={red:` 帅仕相马车炮兵`,black:` 将士象马车炮卒`};Array.from({length:90},(e,t)=>({row:Math.floor(t/9),col:t%9}));var g=({row:e,col:t})=>e*9+t,_=e=>e===1?`红`:`黑`,v=e=>h[e>0?`red`:`black`][Math.abs(e)],y=({from:e,to:t})=>`(${e.row},${e.col}) → (${t.row},${t.col})`,b={class:`xiangqi`},x={key:0,class:`xiangqi-result`,role:`status`},S={class:`xiangqi-layout`},C={class:`xiangqi-frame`},w={class:`file-labels`,"aria-hidden":`true`},T={class:`rank-labels`,"aria-hidden":`true`},E=[`aria-label`],D=[`aria-label`,`aria-pressed`,`disabled`,`onClick`],O={key:1,class:`target-dot`},k={class:`xiangqi-side`},A=[`aria-pressed`],j={class:`muted`},M={class:`xiangqi-seats`},ee={key:0,class:`xiangqi-warning`,role:`status`},te=[`disabled`],N=[`disabled`],P={key:1,class:`xiangqi-hint`,role:`status`},F=[`disabled`],I=s(a({__name:`XiangqiGame`,props:{view:{},ctx:{}},setup(a){let s=a,h=l(()=>s.view.table),I=l(()=>s.view.priv),L=i(null),R=i(null),z=i(-1),B=i(!1),V=i(!1),H=l(()=>h.value.status===`playing`&&I.value?.canAct===!0),U=l(()=>h.value.status===`ended`),W=l(()=>h.value.seats?.find(e=>e.id===s.view.me.id)),G=l(()=>H.value?I.value?.hints??[]:[]),K=l(()=>G.value[z.value]),q=l(()=>h.value.last?[g(h.value.last.from),g(h.value.last.to)]:[]),J=l(()=>{let e=h.value.board.map((e,t)=>({piece:e,index:t}));return V.value?e.reverse():e}),Y=l(()=>{let e=new Map;for(let t of I.value?.legalMoves??[]){let n=g(t.from);e.has(n)||e.set(n,new Map),e.get(n).set(g(t.to),t)}return e}),X=l(()=>L.value===null?void 0:Y.value.get(L.value)),Z=l(()=>R.value===null?void 0:X.value?.get(R.value)),ne=e=>({row:Math.floor(e/9),col:e%9});function re(e,t){let{row:n,col:r}=ne(e);return`行 ${n},列 ${r},${t?_(t>0?1:-1)+v(t):`空位`}`}function ie(e){H.value&&!B.value&&(z.value=-1,X.value?.has(e)?R.value=e:Y.value.has(e)&&(L.value=L.value===e?null:e,R.value=null))}function ae(){G.value.length&&!B.value&&(z.value=(z.value+1)%G.value.length,K.value&&(L.value=g(K.value.from),R.value=g(K.value.to)))}function Q(){L.value=null,R.value=null,z.value=-1}n([()=>h.value.revision,H],Q);async function $(e){if(H.value&&!B.value){B.value=!0;try{await s.ctx.act({type:`xiangqi_action`,...e})&&Q()}finally{B.value=!1}}}function oe(){window.confirm(`认输后本局判负,确定吗?`)&&$({resign:!0})}return(n,i)=>(t(),m(`section`,b,[U.value?(t(),m(`div`,x,[c(`strong`,null,r(h.value.text),1),c(`button`,{class:`btn primary`,type:`button`,onClick:i[0]||=e=>a.ctx.rematch()},`再来一局`),c(`button`,{class:`btn ghost`,type:`button`,onClick:i[1]||=e=>a.ctx.showLobby()},`返回客厅`)])):f(``,!0),c(`div`,S,[c(`div`,C,[c(`div`,w,[(t(!0),m(d,null,p(u(9),e=>(t(),m(`span`,{key:e},r(V.value?u(9)-e:e-1),1))),128))]),c(`div`,T,[(t(!0),m(d,null,p(u(10),e=>(t(),m(`span`,{key:e},r(V.value?u(10)-e:e-1),1))),128))]),c(`div`,{class:`xiangqi-board`,role:`group`,"aria-label":V.value?`中国象棋棋盘,黑方在下`:`中国象棋棋盘,红方在下`},[i[4]||=c(`span`,{class:`palace north`,"aria-hidden":`true`},null,-1),i[5]||=c(`span`,{class:`palace south`,"aria-hidden":`true`},null,-1),i[6]||=c(`div`,{class:`river`,"aria-hidden":`true`},[c(`span`,null,`楚河`),c(`span`,null,`汉界`)],-1),(t(!0),m(d,null,p(J.value,({piece:n,index:i})=>(t(),m(`button`,{key:i,type:`button`,class:e([`xiangqi-point`,{selected:L.value===i||R.value===i,target:X.value?.has(i),last:q.value.includes(i)}]),"aria-label":re(i,n),"aria-pressed":L.value===i||R.value===i,disabled:!H.value||B.value||!Y.value.has(i)&&!X.value?.has(i),onClick:e=>ie(i)},[n?(t(),m(`span`,{key:0,class:e([`piece`,{red:n>0}])},r(u(v)(n)),3)):X.value?.has(i)?(t(),m(`span`,O)):f(``,!0)],10,D))),128))],8,E)]),c(`aside`,k,[c(`button`,{class:`btn ghost`,type:`button`,"aria-pressed":V.value,onClick:i[2]||=e=>V.value=!V.value},`翻转棋盘`,8,A),c(`p`,j,r(W.value?`你执`+u(_)(W.value.color):`观战`)+` · `+r(h.value.plies)+` 手`,1),c(`ul`,M,[(t(!0),m(d,null,p(h.value.seats,n=>(t(),m(`li`,{key:n.id,class:e({current:n.id===h.value.turn})},[c(`span`,{class:e([`seat-color`,{red:n.color===1}])},r(u(_)(n.color)),3),o(` `+r(n.name)+r(n.id===a.view.me.id?`(你)`:``),1)],2))),128))]),h.value.status===`playing`&&h.value.check?(t(),m(`p`,ee,r(I.value?.warning||`将军`),1)):f(``,!0),H.value?(t(),m(d,{key:1},[c(`button`,{class:`btn primary`,type:`button`,disabled:!Z.value||B.value,onClick:i[3]||=e=>Z.value&&$(Z.value)},r(B.value?`正在提交…`:Z.value?`确认走棋`:L.value===null?`先选棋子`:`选择落点`),9,te),G.value.length?(t(),m(`button`,{key:0,class:`btn ghost`,type:`button`,disabled:B.value,onClick:ae},r(K.value?`下一条建议`:`下一步建议`),9,N)):f(``,!0),K.value?(t(),m(`p`,P,[o(r(z.value+1)+`/`+r(G.value.length)+` · `+r(K.value.reason),1),i[7]||=c(`br`,null,null,-1),o(r(u(y)(K.value)),1)])):f(``,!0),c(`button`,{class:`btn ghost`,type:`button`,disabled:B.value,onClick:oe},`认输`,8,F)],64)):f(``,!0)])])]))}}),[[`__scopeId`,`data-v-69d386f2`]]);export{I as default};
@@ -1 +1 @@
1
- import{A as e,C as t,M as n,O as r,S as i,b as a,d as ee,f as o,g as s,h as c,j as l,m as u,p as te,r as ne,v as d,w as f,x as p,y as m}from"./main.js?v=0.50.0";var re={class:`panel game-m2d`},ie={class:`m2d-head`},ae={class:`m2d-title`},oe={class:`m2d-sub`},se={key:0,class:`m2d-clock`},ce={class:`m2d-clock-label`},le={key:0,class:`m2d-result`,"aria-live":`polite`},ue={class:`m2d-result-head`},de={class:`m2d-result-list`},fe={class:`m2d-rank`},pe={class:`m2d-result-name`},me={key:0},he={class:`m2d-result-num`},ge={class:`m2d-result-break`},_e={class:`m2d-result-actions`},ve={class:`m2d-layout`},ye={class:`m2d-cell-name`},be={class:`m2d-cell-foot`},xe={key:0,class:`m2d-cell-price`},Se={key:1,class:`m2d-cell-tag`},Ce={key:2,class:`m2d-cell-tag`},we={class:`m2d-tokens`},h=[`title`],g=[`title`],_={class:`m2d-center`,"aria-hidden":`true`},v={class:`m2d-center-copy`},y={class:`m2d-side`},b={class:`m2d-actions`},x={key:0,class:`m2d-hint`},S={key:1,class:`m2d-hint`},C=[`disabled`],w={key:3,class:`m2d-buy`},T={class:`m2d-buy-head`},E={class:`m2d-buy-note`},D={class:`m2d-buy-buttons`},O=[`disabled`],k=[`disabled`],Te={key:4,class:`m2d-hint`},Ee={class:`m2d-players`},De={class:`m2d-player-copy`},Oe={class:`m2d-player-name`},ke={key:0},Ae={class:`m2d-player-meta`},je={key:0,class:`m2d-badge`},Me={key:0,class:`m2d-empty`},Ne={key:0,class:`m2d-last`,"aria-live":`polite`},Pe={key:1,class:`m2d-mine`},Fe={key:0},A=o(i({__name:`Monopoly2dGame`,props:{view:{},ctx:{}},setup(i){let o=i,A=c(()=>o.view.table??{}),j=c(()=>o.view.priv??null),M=c(()=>o.view.me),N=c(()=>[...A.value.cells??[]].sort((e,t)=>e.index-t.index)),P=c(()=>N.value.length/4||4),F=c(()=>A.value.seats??[]),I=c(()=>A.value.status===`playing`),L=c(()=>A.value.status===`ended`),R=c(()=>F.value.some(e=>e.id===M.value.id)),z=c(()=>!!I.value&&!!j.value?.canAct),B=c(()=>I.value?A.value.phase??`await_roll`:null),V=c(()=>Number(A.value.turnNo)||0),H=c(()=>Number(A.value.round)||0),U=c(()=>Number(A.value.totalRounds)||6),Ie=c(()=>F.value.find(e=>e.id===A.value.turn)??null);c(()=>{let e=A.value.pending;return e===void 0?null:N.value.find(t=>t.index===e)??null});let W=r(!1);function G(e,t=`?`){return e&&(F.value.find(t=>t.id===e)?.name||o.view.names.get(e))||t}function K(e){return te(e||`?`)}function Le(e){let t=F.value.findIndex(t=>t.id===e);return t<0?0:t}function q(e){return`m2d-p`+Le(e)%4}function Re(e){let t=P.value,n=t+1,r=e%t;return e<t?`1 / ${1+r}`:e<2*t?`${1+r} / ${n}`:e<3*t?`${n} / ${n-r}`:`${n-r} / 1`}function ze(e){let t=[`is-`+e.kind];return e.price&&t.push(`band-`+Math.min(3,Math.floor((e.price-100)/60))),e.index%P.value===0&&t.push(`is-corner`),M.value&&F.value.some(t=>t.id===M.value.id&&t.pos===e.index)&&t.push(`is-here`),I.value&&Ie.value?.pos===e.index&&t.push(`is-current`),A.value.pending===e.index&&t.push(`is-pending`),t}function J(e){return(A.value.owners??[]).find(t=>t.cell===e)?.seat}function Be(e){return F.value.filter(t=>t.pos===e)}let Ve=c(()=>L.value?`已结束`:I.value?B.value===`await_buy`?`买地`:`掷骰`:`等人`),Y=c(()=>L.value?`结算完成`:I.value?B.value===`await_buy`?`${G(A.value.turn)} 正在决定买不买`:`等 ${G(A.value.turn)} 掷骰`:`坐满四席后由开桌的人开始`),X=c(()=>{let e=A.value.last;if(!e)return``;let t=G(e.seat),n=[];if(typeof e.die==`number`&&n.push(`${t} 掷出 ${e.die}`),typeof e.to==`number`){let t=N.value.find(t=>t.index===e.to);t&&n.push(`走到「${t.name}」`)}if(e.bought!==void 0){let t=N.value.find(t=>t.index===e.bought);n.push(`买下${t?`「${t.name}」`:`地产`}`)}return typeof e.rent==`number`&&e.rent>0&&n.push(`付租 ${e.rent} 给 ${G(e.rentTo)}`),e.card&&n.push(`${e.card.label} ${e.card.amount>=0?`+`:``}${e.card.amount}`),e.auto&&n.push(`(托管/超时代掷)`),n.join(` · `)}),He=c(()=>(L.value?A.value.ranking??j.value?.ranking??[]:[]).map(e=>({...e,name:G(e.seat),mine:e.seat===M.value.id,won:e.rank===1}))),Z=c(()=>z.value?j.value?.moves??[]:[]),Ue=c(()=>Z.value.includes(`roll`)),We=c(()=>Z.value.includes(`buy`)&&!!j.value?.pending?.affordable),Ge=c(()=>Z.value.includes(`pass`)),Q=c(()=>j.value?.pending??null);function $(e){if(W.value)return;let t=j.value;t&&z.value&&(W.value=!0,o.ctx.act({type:`monopoly2d_action`,move:e,turnNo:t.turnNo??V.value}).catch(()=>{}).finally(()=>{W.value=!1}))}return(r,o)=>(t(),m(`section`,re,[s(`header`,ie,[s(`div`,ae,[o[5]||=s(`h2`,null,`快局大富翁`,-1),s(`p`,oe,[I.value||L.value?(t(),m(u,{key:0},[a(` 第 `+n(H.value)+`/`+n(U.value)+` 轮 · 第 `+n(V.value)+`/`+n(U.value*4)+` 手 · `+n(Ve.value),1)],64)):(t(),m(u,{key:1},[a(`四人坐满开局 · `+n(N.value.length)+` 格 · `+n(U.value)+` 轮 · 只用局内金币`,1)],64))])]),I.value&&A.value.deadline?(t(),m(`div`,se,[s(`span`,ce,n(G(A.value.turn))+` 的`+n(B.value===`await_buy`?`购买`:`掷骰`)+`时间`,1),p(ne,{deadline:A.value.deadline,"server-now":i.ctx.serverNow},null,8,[`deadline`,`server-now`])])):d(``,!0)]),L.value?(t(),m(`div`,le,[s(`div`,ue,[p(ee,{name:`trophy`}),s(`strong`,null,n(A.value.tie?`并列第一`:`本局结果`),1)]),s(`ol`,de,[(t(!0),m(u,null,f(He.value,r=>(t(),m(`li`,{key:r.seat,class:e([`m2d-result-row`,{"is-me":r.mine,"is-won":r.won}])},[s(`span`,fe,n(r.rank),1),s(`span`,{class:e([`m2d-result-dot`,q(r.seat)])},n(K(r.name)),3),s(`span`,pe,[a(n(r.name),1),r.mine?(t(),m(`em`,me,`(你)`)):d(``,!0)]),s(`span`,he,n(r.total),1),s(`span`,ge,`金币 `+n(r.cash)+` + 地产 `+n(r.estate),1)],2))),128))]),s(`div`,_e,[s(`button`,{class:`btn primary`,type:`button`,onClick:o[0]||=e=>i.ctx.rematch()},`再来一局`),s(`button`,{class:`btn ghost`,type:`button`,onClick:o[1]||=e=>i.ctx.showLobby()},`返回客厅`)])])):d(``,!0),s(`div`,ve,[s(`div`,{class:`m2d-board`,style:l({"--m2d-grid-size":P.value+1}),role:`grid`,"aria-label":`大富翁棋盘`},[(t(!0),m(u,null,f(N.value,r=>(t(),m(`div`,{key:r.index,class:e([`m2d-cell`,ze(r)]),style:l({gridArea:Re(r.index)}),role:`gridcell`},[s(`span`,ye,n(r.name),1),s(`div`,be,[r.price?(t(),m(`span`,xe,n(r.price),1)):r.kind===`event`?(t(),m(`span`,Se,`消息`)):r.kind===`start`?(t(),m(`span`,Ce,`起点`)):d(``,!0),s(`span`,we,[(t(!0),m(u,null,f(Be(r.index),r=>(t(),m(`span`,{key:r.id,class:e([`m2d-token`,[q(r.id),{"is-turn":r.id===A.value.turn}]]),title:r.name},n(K(r.name)),11,h))),128))]),J(r.index)?(t(),m(`span`,{key:3,class:e([`m2d-owner`,q(J(r.index))]),title:`归 `+G(J(r.index))},n(K(G(J(r.index)))),11,g)):d(``,!0)])],6))),128)),s(`div`,_,[o[6]||=s(`svg`,{class:`m2d-center-art`,viewBox:`0 0 120 120`,focusable:`false`},[s(`circle`,{cx:`60`,cy:`60`,r:`46`,fill:`none`,stroke:`currentColor`,"stroke-opacity":`0.16`,"stroke-dasharray":`3 7`}),s(`path`,{d:`M34 72h52l-5-18H39z`,fill:`none`,stroke:`currentColor`,"stroke-opacity":`0.45`,"stroke-width":`2`,"stroke-linejoin":`round`}),s(`path`,{d:`M60 54c0-7 9-7 9-14`,fill:`none`,stroke:`currentColor`,"stroke-opacity":`0.35`,"stroke-width":`2`,"stroke-linecap":`round`}),s(`path`,{d:`M50 54c0-5 7-6 7-11`,fill:`none`,stroke:`currentColor`,"stroke-opacity":`0.25`,"stroke-width":`2`,"stroke-linecap":`round`}),s(`circle`,{cx:`60`,cy:`78`,r:`2.4`,fill:`currentColor`,"fill-opacity":`0.5`})],-1),s(`div`,v,[s(`strong`,null,n(I.value||L.value?`第 `+H.value+` 轮`:`快局`),1),s(`span`,null,n(Y.value),1)])])],4),s(`aside`,y,[s(`div`,b,[L.value?(t(),m(`p`,x,`这一局结束了。再看一局请回客厅开新桌。`)):R.value?Ue.value?(t(),m(u,{key:2},[s(`button`,{class:`btn primary`,type:`button`,disabled:W.value,onClick:o[2]||=e=>$(`roll`)},n(W.value?`提交中…`:`掷骰`),9,C),o[7]||=s(`p`,{class:`m2d-hint`},`掷骰 60 秒;落在无主且买得起的地产,会再给 20 秒决定。`,-1)],64)):Q.value?(t(),m(`div`,w,[s(`div`,T,[s(`strong`,null,n(Q.value.name),1),s(`span`,null,`售价 `+n(Q.value.price)+` · 每次租金 `+n(Q.value.rent),1)]),s(`p`,E,[a(` 买下后剩 `+n(Q.value.cashAfter)+` 金币`,1),Q.value.affordable?d(``,!0):(t(),m(u,{key:0},[a(`(金币不够,只能放弃)`)],64)),o[8]||=a(`。 `,-1)]),s(`div`,D,[s(`button`,{class:`btn primary`,type:`button`,disabled:W.value||!We.value,onClick:o[3]||=e=>$(`buy`)},n(W.value?`提交中…`:`买下 `+Q.value.price),9,O),s(`button`,{class:`btn ghost`,type:`button`,disabled:W.value||!Ge.value,onClick:o[4]||=e=>$(`pass`)},`放弃`,8,k)]),o[9]||=s(`p`,{class:`m2d-hint`},`购买窗 20 秒;到点自动放弃。`,-1)])):(t(),m(`p`,Te,` 等 `+n(G(A.value.turn))+n(B.value===`await_buy`?` 决定买地`:` 掷骰`)+`。 `,1)):(t(),m(`p`,S,`你在观战:能看到所有人的金币和地块,不能操作。`))]),s(`div`,Ee,[(t(!0),m(u,null,f(F.value,r=>(t(),m(`div`,{key:r.id,class:e([`m2d-player`,{"is-turn":r.id===A.value.turn,"is-me":r.id===M.value.id}])},[s(`span`,{class:e([`m2d-player-dot`,q(r.id)])},n(K(r.name)),3),s(`div`,De,[s(`div`,Oe,[a(n(r.name),1),r.id===M.value.id?(t(),m(`em`,ke,`(你)`)):d(``,!0)]),s(`div`,Ae,[a(n(r.cash)+` 金币 · `+n((r.properties||[]).length)+` 块地`,1),r.estate?(t(),m(u,{key:0},[a(` · 估值 `+n(r.estate),1)],64)):d(``,!0)])]),r.id===A.value.turn&&I.value?(t(),m(`span`,je,`行动中`)):d(``,!0)],2))),128)),F.value.length?d(``,!0):(t(),m(`p`,Me,`等人入座。`))]),X.value?(t(),m(`p`,Ne,n(X.value),1)):d(``,!0),M.value.id&&R.value?(t(),m(`div`,Pe,[s(`span`,null,`你:`+n(j.value?.cash??0)+` 金币 · `+n((j.value?.properties||[]).length)+` 块地`,1),j.value?.estate?(t(),m(`span`,Fe,`估值 `+n(j.value.estate),1)):d(``,!0)])):d(``,!0)])])]))}}),[[`__scopeId`,`data-v-b85a13ef`]]);export{A as default};
1
+ import{A as e,C as t,M as n,O as r,S as i,b as a,d as ee,f as o,g as s,h as c,j as l,m as u,p as te,r as ne,v as d,w as f,x as p,y as m}from"./main.js?v=0.52.0";var re={class:`panel game-m2d`},ie={class:`m2d-head`},ae={class:`m2d-title`},oe={class:`m2d-sub`},se={key:0,class:`m2d-clock`},ce={class:`m2d-clock-label`},le={key:0,class:`m2d-result`,"aria-live":`polite`},ue={class:`m2d-result-head`},de={class:`m2d-result-list`},fe={class:`m2d-rank`},pe={class:`m2d-result-name`},me={key:0},he={class:`m2d-result-num`},ge={class:`m2d-result-break`},_e={class:`m2d-result-actions`},ve={class:`m2d-layout`},ye={class:`m2d-cell-name`},be={class:`m2d-cell-foot`},xe={key:0,class:`m2d-cell-price`},Se={key:1,class:`m2d-cell-tag`},Ce={key:2,class:`m2d-cell-tag`},we={class:`m2d-tokens`},h=[`title`],g=[`title`],_={class:`m2d-center`,"aria-hidden":`true`},v={class:`m2d-center-copy`},y={class:`m2d-side`},b={class:`m2d-actions`},x={key:0,class:`m2d-hint`},S={key:1,class:`m2d-hint`},C=[`disabled`],w={key:3,class:`m2d-buy`},T={class:`m2d-buy-head`},E={class:`m2d-buy-note`},D={class:`m2d-buy-buttons`},O=[`disabled`],k=[`disabled`],Te={key:4,class:`m2d-hint`},Ee={class:`m2d-players`},De={class:`m2d-player-copy`},Oe={class:`m2d-player-name`},ke={key:0},Ae={class:`m2d-player-meta`},je={key:0,class:`m2d-badge`},Me={key:0,class:`m2d-empty`},Ne={key:0,class:`m2d-last`,"aria-live":`polite`},Pe={key:1,class:`m2d-mine`},Fe={key:0},A=o(i({__name:`Monopoly2dGame`,props:{view:{},ctx:{}},setup(i){let o=i,A=c(()=>o.view.table??{}),j=c(()=>o.view.priv??null),M=c(()=>o.view.me),N=c(()=>[...A.value.cells??[]].sort((e,t)=>e.index-t.index)),P=c(()=>N.value.length/4||4),F=c(()=>A.value.seats??[]),I=c(()=>A.value.status===`playing`),L=c(()=>A.value.status===`ended`),R=c(()=>F.value.some(e=>e.id===M.value.id)),z=c(()=>!!I.value&&!!j.value?.canAct),B=c(()=>I.value?A.value.phase??`await_roll`:null),V=c(()=>Number(A.value.turnNo)||0),H=c(()=>Number(A.value.round)||0),U=c(()=>Number(A.value.totalRounds)||6),Ie=c(()=>F.value.find(e=>e.id===A.value.turn)??null);c(()=>{let e=A.value.pending;return e===void 0?null:N.value.find(t=>t.index===e)??null});let W=r(!1);function G(e,t=`?`){return e&&(F.value.find(t=>t.id===e)?.name||o.view.names.get(e))||t}function K(e){return te(e||`?`)}function Le(e){let t=F.value.findIndex(t=>t.id===e);return t<0?0:t}function q(e){return`m2d-p`+Le(e)%4}function Re(e){let t=P.value,n=t+1,r=e%t;return e<t?`1 / ${1+r}`:e<2*t?`${1+r} / ${n}`:e<3*t?`${n} / ${n-r}`:`${n-r} / 1`}function ze(e){let t=[`is-`+e.kind];return e.price&&t.push(`band-`+Math.min(3,Math.floor((e.price-100)/60))),e.index%P.value===0&&t.push(`is-corner`),M.value&&F.value.some(t=>t.id===M.value.id&&t.pos===e.index)&&t.push(`is-here`),I.value&&Ie.value?.pos===e.index&&t.push(`is-current`),A.value.pending===e.index&&t.push(`is-pending`),t}function J(e){return(A.value.owners??[]).find(t=>t.cell===e)?.seat}function Be(e){return F.value.filter(t=>t.pos===e)}let Ve=c(()=>L.value?`已结束`:I.value?B.value===`await_buy`?`买地`:`掷骰`:`等人`),Y=c(()=>L.value?`结算完成`:I.value?B.value===`await_buy`?`${G(A.value.turn)} 正在决定买不买`:`等 ${G(A.value.turn)} 掷骰`:`坐满四席后由开桌的人开始`),X=c(()=>{let e=A.value.last;if(!e)return``;let t=G(e.seat),n=[];if(typeof e.die==`number`&&n.push(`${t} 掷出 ${e.die}`),typeof e.to==`number`){let t=N.value.find(t=>t.index===e.to);t&&n.push(`走到「${t.name}」`)}if(e.bought!==void 0){let t=N.value.find(t=>t.index===e.bought);n.push(`买下${t?`「${t.name}」`:`地产`}`)}return typeof e.rent==`number`&&e.rent>0&&n.push(`付租 ${e.rent} 给 ${G(e.rentTo)}`),e.card&&n.push(`${e.card.label} ${e.card.amount>=0?`+`:``}${e.card.amount}`),e.auto&&n.push(`(托管/超时代掷)`),n.join(` · `)}),He=c(()=>(L.value?A.value.ranking??j.value?.ranking??[]:[]).map(e=>({...e,name:G(e.seat),mine:e.seat===M.value.id,won:e.rank===1}))),Z=c(()=>z.value?j.value?.moves??[]:[]),Ue=c(()=>Z.value.includes(`roll`)),We=c(()=>Z.value.includes(`buy`)&&!!j.value?.pending?.affordable),Ge=c(()=>Z.value.includes(`pass`)),Q=c(()=>j.value?.pending??null);function $(e){if(W.value)return;let t=j.value;t&&z.value&&(W.value=!0,o.ctx.act({type:`monopoly2d_action`,move:e,turnNo:t.turnNo??V.value}).catch(()=>{}).finally(()=>{W.value=!1}))}return(r,o)=>(t(),m(`section`,re,[s(`header`,ie,[s(`div`,ae,[o[5]||=s(`h2`,null,`快局大富翁`,-1),s(`p`,oe,[I.value||L.value?(t(),m(u,{key:0},[a(` 第 `+n(H.value)+`/`+n(U.value)+` 轮 · 第 `+n(V.value)+`/`+n(U.value*4)+` 手 · `+n(Ve.value),1)],64)):(t(),m(u,{key:1},[a(`四人坐满开局 · `+n(N.value.length)+` 格 · `+n(U.value)+` 轮 · 只用局内金币`,1)],64))])]),I.value&&A.value.deadline?(t(),m(`div`,se,[s(`span`,ce,n(G(A.value.turn))+` 的`+n(B.value===`await_buy`?`购买`:`掷骰`)+`时间`,1),p(ne,{deadline:A.value.deadline,"server-now":i.ctx.serverNow},null,8,[`deadline`,`server-now`])])):d(``,!0)]),L.value?(t(),m(`div`,le,[s(`div`,ue,[p(ee,{name:`trophy`}),s(`strong`,null,n(A.value.tie?`并列第一`:`本局结果`),1)]),s(`ol`,de,[(t(!0),m(u,null,f(He.value,r=>(t(),m(`li`,{key:r.seat,class:e([`m2d-result-row`,{"is-me":r.mine,"is-won":r.won}])},[s(`span`,fe,n(r.rank),1),s(`span`,{class:e([`m2d-result-dot`,q(r.seat)])},n(K(r.name)),3),s(`span`,pe,[a(n(r.name),1),r.mine?(t(),m(`em`,me,`(你)`)):d(``,!0)]),s(`span`,he,n(r.total),1),s(`span`,ge,`金币 `+n(r.cash)+` + 地产 `+n(r.estate),1)],2))),128))]),s(`div`,_e,[s(`button`,{class:`btn primary`,type:`button`,onClick:o[0]||=e=>i.ctx.rematch()},`再来一局`),s(`button`,{class:`btn ghost`,type:`button`,onClick:o[1]||=e=>i.ctx.showLobby()},`返回客厅`)])])):d(``,!0),s(`div`,ve,[s(`div`,{class:`m2d-board`,style:l({"--m2d-grid-size":P.value+1}),role:`grid`,"aria-label":`大富翁棋盘`},[(t(!0),m(u,null,f(N.value,r=>(t(),m(`div`,{key:r.index,class:e([`m2d-cell`,ze(r)]),style:l({gridArea:Re(r.index)}),role:`gridcell`},[s(`span`,ye,n(r.name),1),s(`div`,be,[r.price?(t(),m(`span`,xe,n(r.price),1)):r.kind===`event`?(t(),m(`span`,Se,`消息`)):r.kind===`start`?(t(),m(`span`,Ce,`起点`)):d(``,!0),s(`span`,we,[(t(!0),m(u,null,f(Be(r.index),r=>(t(),m(`span`,{key:r.id,class:e([`m2d-token`,[q(r.id),{"is-turn":r.id===A.value.turn}]]),title:r.name},n(K(r.name)),11,h))),128))]),J(r.index)?(t(),m(`span`,{key:3,class:e([`m2d-owner`,q(J(r.index))]),title:`归 `+G(J(r.index))},n(K(G(J(r.index)))),11,g)):d(``,!0)])],6))),128)),s(`div`,_,[o[6]||=s(`svg`,{class:`m2d-center-art`,viewBox:`0 0 120 120`,focusable:`false`},[s(`circle`,{cx:`60`,cy:`60`,r:`46`,fill:`none`,stroke:`currentColor`,"stroke-opacity":`0.16`,"stroke-dasharray":`3 7`}),s(`path`,{d:`M34 72h52l-5-18H39z`,fill:`none`,stroke:`currentColor`,"stroke-opacity":`0.45`,"stroke-width":`2`,"stroke-linejoin":`round`}),s(`path`,{d:`M60 54c0-7 9-7 9-14`,fill:`none`,stroke:`currentColor`,"stroke-opacity":`0.35`,"stroke-width":`2`,"stroke-linecap":`round`}),s(`path`,{d:`M50 54c0-5 7-6 7-11`,fill:`none`,stroke:`currentColor`,"stroke-opacity":`0.25`,"stroke-width":`2`,"stroke-linecap":`round`}),s(`circle`,{cx:`60`,cy:`78`,r:`2.4`,fill:`currentColor`,"fill-opacity":`0.5`})],-1),s(`div`,v,[s(`strong`,null,n(I.value||L.value?`第 `+H.value+` 轮`:`快局`),1),s(`span`,null,n(Y.value),1)])])],4),s(`aside`,y,[s(`div`,b,[L.value?(t(),m(`p`,x,`这一局结束了。再看一局请回客厅开新桌。`)):R.value?Ue.value?(t(),m(u,{key:2},[s(`button`,{class:`btn primary`,type:`button`,disabled:W.value,onClick:o[2]||=e=>$(`roll`)},n(W.value?`提交中…`:`掷骰`),9,C),o[7]||=s(`p`,{class:`m2d-hint`},`掷骰 60 秒;落在无主且买得起的地产,会再给 20 秒决定。`,-1)],64)):Q.value?(t(),m(`div`,w,[s(`div`,T,[s(`strong`,null,n(Q.value.name),1),s(`span`,null,`售价 `+n(Q.value.price)+` · 每次租金 `+n(Q.value.rent),1)]),s(`p`,E,[a(` 买下后剩 `+n(Q.value.cashAfter)+` 金币`,1),Q.value.affordable?d(``,!0):(t(),m(u,{key:0},[a(`(金币不够,只能放弃)`)],64)),o[8]||=a(`。 `,-1)]),s(`div`,D,[s(`button`,{class:`btn primary`,type:`button`,disabled:W.value||!We.value,onClick:o[3]||=e=>$(`buy`)},n(W.value?`提交中…`:`买下 `+Q.value.price),9,O),s(`button`,{class:`btn ghost`,type:`button`,disabled:W.value||!Ge.value,onClick:o[4]||=e=>$(`pass`)},`放弃`,8,k)]),o[9]||=s(`p`,{class:`m2d-hint`},`购买窗 20 秒;到点自动放弃。`,-1)])):(t(),m(`p`,Te,` 等 `+n(G(A.value.turn))+n(B.value===`await_buy`?` 决定买地`:` 掷骰`)+`。 `,1)):(t(),m(`p`,S,`你在观战:能看到所有人的金币和地块,不能操作。`))]),s(`div`,Ee,[(t(!0),m(u,null,f(F.value,r=>(t(),m(`div`,{key:r.id,class:e([`m2d-player`,{"is-turn":r.id===A.value.turn,"is-me":r.id===M.value.id}])},[s(`span`,{class:e([`m2d-player-dot`,q(r.id)])},n(K(r.name)),3),s(`div`,De,[s(`div`,Oe,[a(n(r.name),1),r.id===M.value.id?(t(),m(`em`,ke,`(你)`)):d(``,!0)]),s(`div`,Ae,[a(n(r.cash)+` 金币 · `+n((r.properties||[]).length)+` 块地`,1),r.estate?(t(),m(u,{key:0},[a(` · 估值 `+n(r.estate),1)],64)):d(``,!0)])]),r.id===A.value.turn&&I.value?(t(),m(`span`,je,`行动中`)):d(``,!0)],2))),128)),F.value.length?d(``,!0):(t(),m(`p`,Me,`等人入座。`))]),X.value?(t(),m(`p`,Ne,n(X.value),1)):d(``,!0),M.value.id&&R.value?(t(),m(`div`,Pe,[s(`span`,null,`你:`+n(j.value?.cash??0)+` 金币 · `+n((j.value?.properties||[]).length)+` 块地`,1),j.value?.estate?(t(),m(`span`,Fe,`估值 `+n(j.value.estate),1)):d(``,!0)])):d(``,!0)])])]))}}),[[`__scopeId`,`data-v-b85a13ef`]]);export{A as default};