feedback5 WI: server toasts and ticker lines carry msgid + params so the client shows them in the player's language
messaging.js: a toast / CUSTOM ticker line is a string (its own msgid) or a shared/i18n.js msg(); frames keep
the Chinese `text` (older clients) and add `msgid` / `params`; config.broadcasts lines carry their `args`
(the client fills the localized broadcast template; the player name {0} is never translated). Templated call
sites send msg(): the grant toast 「X:获得Y」, the summon-range and terrain withdrawals, the 联防 line,
eliminated / left lines, the 远见 / 奇迹 stack payouts and the 维多利亚 hammers; game-data names go as dn().
The protocol stays backward compatible (new fields optional). Tests that captured m.toast's argument render
it with renderMessage. No gameplay change: golden unchanged.
This commit is contained in:
1 parent
a12a539e4d
commit
5398a0cfc5
12 files changed
+166
-18
No files matched your search
@@ -23,6 +23,7 @@ import { DATA, makeMatch, give, giveItem, checkInvariants, chessOfTier } from '.
|
||||
import { botPrep, planLayout, fieldModel } from '../../server/match/bot.js';
|
||||
import { placementContext, canPlace as clientCanPlace, boardTargets, deployMap as clientDeployMap } from '../../public/js/ui/gameLogic.js';
|
||||
import { makeBattle } from '../helpers/battleHarness.js';
|
||||
import { renderMessage } from '../../shared/i18n.js';
|
||||
|
||||
const STAGE = 'act2autochess_m04';
|
||||
const WATER = ['10,6', '11,6', '12,6'];
|
||||
@@ -187,7 +188,7 @@ test('#9 hand and temp full: a re-orientation that would push 狼群 out is refu
|
||||
assert.equal(stackOf(ps, WOLF), null, 'its only copy is placed: no stack left to return onto');
|
||||
const toasts = [];
|
||||
const toast = m.toast.bind(m);
|
||||
m.toast = (p, kind, text) => { toasts.push(text); return toast(p, kind, text); };
|
||||
m.toast = (p, kind, text) => { toasts.push(renderMessage(text)); return toast(p, kind, text); }; // string or msg()
|
||||
const golden = Object.keys(DATA.items).find((id) => DATA.items[id].isGolden && DATA.items[id].itemType === 'EQUIP');
|
||||
while (ps.hand.includes(null)) giveItem(m, ps, golden);
|
||||
while (ps.temp.includes(null)) giveItem(m, ps, golden, 'temp');
|
||||
|
||||
@@ -23,6 +23,7 @@ import {
|
||||
import { planLayout } from '../../server/match/bot.js';
|
||||
import { collectViolations } from '../../server/match/invariants.js';
|
||||
import { DATA, makeMatch, give, chessOfTier, checkInvariants } from './harness.js';
|
||||
import { renderMessage } from '../../shared/i18n.js';
|
||||
|
||||
const STAGE = 'act2autochess_m01';
|
||||
const ROOT = join(dirname(fileURLToPath(import.meta.url)), '../..');
|
||||
@@ -115,7 +116,8 @@ describe('#7 the Final Assault prep deploys on the boss field', () => {
|
||||
h.drive(() => m.phase === PHASE.PREP && m.round === m.gd.bossRound);
|
||||
const toasts = [];
|
||||
const toast = m.toast.bind(m);
|
||||
m.toast = (ps, kind, text) => { toasts.push(`${ps.playerId}:${text}`); return toast(ps, kind, text); };
|
||||
// a toast is a string or a shared/i18n.js msg(): compare its Chinese rendering
|
||||
m.toast = (ps, kind, text) => { toasts.push(`${ps.playerId}:${renderMessage(text)}`); return toast(ps, kind, text); };
|
||||
const fields = [];
|
||||
m.deployFieldOf = ((orig) => function (ps) { const f = orig.call(this, ps); if (this.round === this.gd.hiddenRound) fields.push(f); return f; })(m.deployFieldOf);
|
||||
const placed = {};
|
||||
|
||||
Reference in new issue
Block a user