二七王:result.chupai 移出 GameState,本墩结果改走 EQW_TRICK_END 事件载荷
谁最大、这墩闲家得几分是【一次性表现】(收牌动画、得分飘字),任何 deskinfo 都不下发它,
写进 GameState 就多出一处「只活在前端、服务端不知道」的对局态——出牌中途断线重连即归零,
违反红线「丢弃 this.data、仅凭最近一次服务端快照重画,界面必须一致」。
三处一起改,缺一不可:
- PlayHandler chupai3:删 result.chupai 写入,改随 EQW_TRICK_END 下发 {seat,cards,maxseat?,grade?};
aset.grade 的累加保留(它有服务端来源 PushCards.grade / chupai3.grade,是镜像量)
- ResultHandler:_apply 的 map 删掉 chupai。收尾墩不发 chupai3、整包换成 jiesuan,
不改这里则删 EXCLUDE 后必转红。收尾墩改为与 chupai3 走同一对事件、同一份载荷字段
(补 emit EQW_TRICK_END 并带上 grade),否则最后一墩的得分没有出口
- GameState:删掉 result.chupai 字段本身(声明 + reset),不留永远为 null 的死字段
test_consistency 的 EXCLUDE 随之删到只剩 table.ancard3s 一条,27 checks 仍全绿;
该条改注释标明「当前夹具(65 分坐庄、单局)无法触发,此条未经验证」,不假装它在守什么。
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -46,15 +46,20 @@ var EQW_ResultHandler = EQW_ResultHandler || {
|
||||
//—— 收尾轮的第三手:牌局在最后一手打完时【不发 chupai3】,整包换成 jiesuan(协议 §13/§14)——
|
||||
//夹具实跑一局的包数就是证据:chupai1×28 / chupai2×28 / chupai3×27。
|
||||
//只在 chupai3 归档会永远丢掉最后一轮,故在这里补齐——它必是本轮第三手,落进当前这一轮。
|
||||
//jiesuan.chupai 的字段与 chupai3 不同:只有 seat / cards / maxseat,
|
||||
//没有 order / playproc / cardsinhand / grade。
|
||||
//jiesuan.chupai 的字段与 chupai3 不同:只有 seat / cards / maxseat(+ 有分时的 grade),
|
||||
//没有 order / playproc / cardsinhand。
|
||||
//归档随后会被下面的结算收敛清掉(deskinfo step6 不带 PushCards),但 emit 是同步的:
|
||||
//落牌与收牌表现在清空之前就已取到完整的收尾轮。
|
||||
//【本墩结果只走事件载荷、不进 GameState】:谁最大、这墩得几分是一次性表现,
|
||||
//deskinfo 的 Balance 不带它(它属于「出牌过程」而非结算数据),写进 GameState
|
||||
//就会多出一处服务端不知道的对局态。收尾墩与 chupai3 走同一对事件、同一份载荷字段。
|
||||
if (d.chupai && d.chupai.hasOwnProperty('seat') && d.chupai.hasOwnProperty('cards')) {
|
||||
EQW_GameState.pushPlay(d.chupai.seat, d.chupai.cards, false);
|
||||
var lastPlay = { seat: d.chupai.seat, cards: d.chupai.cards };
|
||||
if (d.chupai.hasOwnProperty('maxseat')) { lastPlay.maxseat = d.chupai.maxseat; }
|
||||
if (d.chupai.hasOwnProperty('grade')) { lastPlay.grade = d.chupai.grade; }
|
||||
EventBus.emit(EQW_Events.EQW_CARD_PLAYED, lastPlay);
|
||||
EventBus.emit(EQW_Events.EQW_TRICK_END, lastPlay);
|
||||
}
|
||||
|
||||
//结算是"清空过程量、只留结算数据"的快照点:deskinfo step6 只带 Balance(=aset),
|
||||
@@ -85,8 +90,9 @@ var EQW_ResultHandler = EQW_ResultHandler || {
|
||||
EQW_GameState.table.liangpai = null;
|
||||
EQW_GameState.table.mingpai = null;
|
||||
|
||||
//【不写 chupai】收尾墩已在上面随事件载荷发走;deskinfo step6 的 Balance 只有
|
||||
//aset / bottom / account 三份,多存一个 chupai 就是增量路径独有的私有对局态
|
||||
EQW_GameState._apply(EQW_GameState.result, d, {
|
||||
chupai: 'chupai',
|
||||
bottom: 'bottom',
|
||||
aset: 'aset',
|
||||
account: 'account'
|
||||
|
||||
Reference in New Issue
Block a user