Simplify bank balance messages in T5 and T6

This commit is contained in:
2026-10-13 20:51:38 -04:00
parent 463b4bcc51
commit 2123b8f4d5
6 changed files with 30 additions and 11 deletions
+19
View File
@@ -6,6 +6,25 @@ T5/T6 script and each native plugin. Current versions are recorded in
## 2026-10-13 ## 2026-10-13
### Simplified bank balance message
| Component | Version | Affected source |
| --- | --- | --- |
| `tws_t5_bank.gsc` | `2.0.3` | `t5/scripts/tws_t5_bank.gsc` |
| `tws_t6_bank.gsc` | `2.0.3` | `t6/scripts/tws_t6_bank.gsc` |
- Both games now display `.b` as `Bank: {balance} points`, retaining the
existing colors and omitting the available amount. Update startup version
reporting and the existing balance-message fixtures. API data and point
accounting are unchanged.
- Validation: all 42 portable bank script fixture groups passed with
`node tools/check_bank.mjs`, including exact balance text for both games.
- Compatibility: no new dependency requirement; matching TWS plugins `1.2.0+`
remain required. Deployment: copy each updated bank script and restart the
map. No plugin update or full server-process restart is required for this
change. No deployment performed; GSC compilation and live T5/T6 display
verification remain required.
### Bank failure diagnostics — TWS #14 ### Bank failure diagnostics — TWS #14
| Component | Version | Affected source | | Component | Version | Affected source |
+1 -1
View File
@@ -269,7 +269,7 @@ startup. `bankVersion()` is a new linking requirement even when the bank is
disabled by dvar. No EC/agent change or new third-party dependency is required; disabled by dvar. No EC/agent change or new third-party dependency is required;
existing bank API, common/telemetry and endpoint-migration requirements still apply. existing bank API, common/telemetry and endpoint-migration requirements still apply.
Verify deployed DLL and GSC SHA-256 hashes against the built release artifacts, Verify deployed DLL and GSC SHA-256 hashes against the built release artifacts,
and confirm startup reports `script=2.0.2 plugin=1.2.0` before interpreting results. and confirm startup reports `script=2.0.3 plugin=1.2.0` before interpreting results.
An old bank script checksum on Ascension was reported in issue #14; deploying An old bank script checksum on Ascension was reported in issue #14; deploying
only the DLL does not update GSC. No deployment was performed here. only the DLL does not update GSC. No deployment was performed here.
+2 -2
View File
@@ -15,7 +15,7 @@ init()
credentials = "valid"; credentials = "valid";
if (level.bank_token.size < 40 || getSubStr(level.bank_token, 0, 8) != "ec_bank_") if (level.bank_token.size < 40 || getSubStr(level.bank_token, 0, 8) != "ec_bank_")
credentials = "invalid"; credentials = "invalid";
print("[tws_bank] startup script=2.0.2 plugin=" + bankVersion() + print("[tws_bank] startup script=2.0.3 plugin=" + bankVersion() +
" endpoint=" + level.bank_url + " server=" + bank_log_token(level.bank_server) + " endpoint=" + level.bank_url + " server=" + bank_log_token(level.bank_server) +
" credentials=" + credentials); " credentials=" + credentials);
// A private per-server cfg supplies this; never embed bank credentials. // A private per-server cfg supplies this; never embed bank credentials.
@@ -179,7 +179,7 @@ bank_transfer(entry, args)
if (!isDefined(reply) || reply["state"] != "balance") if (!isDefined(reply) || reply["state"] != "balance")
bank_say(entry, "^3Bank unavailable. Your points are unchanged."); bank_say(entry, "^3Bank unavailable. Your points are unchanged.");
else else
bank_say(entry, "^3Bank: ^7" + reply["balance"] + " ^3points; available: ^7" + reply["amount"]); bank_say(entry, "^3Bank: ^7" + reply["balance"] + " ^3points");
return; return;
} }
if (args.size != 2) if (args.size != 2)
+2 -2
View File
@@ -19,7 +19,7 @@ init()
credentials = "valid"; credentials = "valid";
if (level.bank_token.size < 40 || getSubStr(level.bank_token, 0, 8) != "ec_bank_") if (level.bank_token.size < 40 || getSubStr(level.bank_token, 0, 8) != "ec_bank_")
credentials = "invalid"; credentials = "invalid";
println("[tws_bank] startup script=2.0.2 plugin=" + bankVersion() + println("[tws_bank] startup script=2.0.3 plugin=" + bankVersion() +
" endpoint=" + level.bank_url + " server=" + bank_log_token(level.bank_server) + " endpoint=" + level.bank_url + " server=" + bank_log_token(level.bank_server) +
" credentials=" + credentials); " credentials=" + credentials);
// A private per-server cfg supplies this; never embed bank credentials. // A private per-server cfg supplies this; never embed bank credentials.
@@ -184,7 +184,7 @@ bank_transfer(entry, args)
if (!isDefined(reply) || reply["state"] != "balance") if (!isDefined(reply) || reply["state"] != "balance")
bank_say(entry, "^3Bank unavailable. Your points are unchanged."); bank_say(entry, "^3Bank unavailable. Your points are unchanged.");
else else
bank_say(entry, "^3Bank: ^7" + reply["balance"] + " ^3points; available: ^7" + reply["amount"]); bank_say(entry, "^3Bank: ^7" + reply["balance"] + " ^3points");
return; return;
} }
if (args.size != 2) if (args.size != 2)
+4 -4
View File
@@ -188,7 +188,7 @@ for (const game of ['t5','t6']) {
}); });
test('startup reports versions, scope, credential validation and journal count safely', () => { test('startup reports versions, scope, credential validation and journal count safely', () => {
const e = engine(game); const e = engine(game);
assert.match(e.logs.join('\n'), /script=2\.0\.2 plugin=1\.2\.0/); assert.match(e.logs.join('\n'), /script=2\.0\.3 plugin=1\.2\.0/);
assert(e.logs.some(line => line.includes(`endpoint=${publicEndpoint} server=server credentials=valid`))); assert(e.logs.some(line => line.includes(`endpoint=${publicEndpoint} server=server credentials=valid`)));
assert(e.logs.some(line => line.includes('journal_load=success pending=0'))); assert(e.logs.some(line => line.includes('journal_load=success pending=0')));
const invalid = engine(game, {dvars:{tws_bank_token:'secret-invalid-token'}}); const invalid = engine(game, {dvars:{tws_bank_token:'secret-invalid-token'}});
@@ -304,11 +304,11 @@ for (const game of ['t5','t6']) {
const e=engine(game); e.c.level.telemetry_match=undefined; e.run(['.d','all']); assert.equal(e.sent.length,0); const e=engine(game); e.c.level.telemetry_match=undefined; e.run(['.d','all']); assert.equal(e.sent.length,0);
}); });
test('balance reads do not journal or alter points', () => { test('balance reads do not journal or alter points', () => {
const e=engine(game); e.run(['.b']); assert.equal(e.saved.length,0); assert.equal(e.player.score,3000); assert.match(e.messages[0],/5000/); const e=engine(game); e.run(['.b']); assert.equal(e.saved.length,0); assert.equal(e.player.score,3000); assert.equal(e.messages[0], '^3Bank: ^75000 ^3points');
}); });
test('empty balance displays zero and withdrawing all reports insufficient balance', () => { test('empty balance displays zero and withdrawing all reports insufficient balance', () => {
const e = engine(game, {amount:0, balance:0}); e.run(['.b']); const e = engine(game, {amount:0, balance:0}); e.run(['.b']);
assert.equal(e.messages[0], '^3Bank: ^70 ^3points; available: ^70'); assert.equal(e.messages[0], '^3Bank: ^70 ^3points');
assert.equal(e.saved.length, 0); assert.equal(e.player.score, 3000); assert.equal(e.saved.length, 0); assert.equal(e.player.score, 3000);
const w = engine(game, {amount:0, balance:0, state:'rejected', code:'insufficient_balance'}); w.run(['.w','all']); const w = engine(game, {amount:0, balance:0, state:'rejected', code:'insufficient_balance'}); w.run(['.w','all']);
assert.match(w.messages[0], /Not enough bank balance/); assert.match(w.messages[0], /Not enough bank balance/);
@@ -356,7 +356,7 @@ for (const game of ['t5','t6']) {
} }
assert.equal(ec.requests().length, 0); assert.equal(ec.requests().length, 0);
const e = engine(game, {guid, receiver:ec.request}); const e = engine(game, {guid, receiver:ec.request});
e.run(['.b']); assert.equal(e.messages[0], '^3Bank: ^70 ^3points; available: ^70'); e.run(['.b']); assert.equal(e.messages[0], '^3Bank: ^70 ^3points');
e.run(['.w','all']); assert.match(e.messages.at(-1), /Not enough bank balance/); e.run(['.w','all']); assert.match(e.messages.at(-1), /Not enough bank balance/);
assert.equal(e.player.score, 3000); assert.equal(e.saved[0].decision, 'cancel'); assert.equal(e.player.score, 3000); assert.equal(e.saved[0].decision, 'cancel');
e.c.bank_sender().next(); assert.equal(e.saved.length, 0); e.c.bank_sender().next(); assert.equal(e.saved.length, 0);
+2 -2
View File
@@ -1,6 +1,6 @@
{ {
"tws_t5_afk.gsc": "1.0.0", "tws_t5_afk.gsc": "1.0.0",
"tws_t5_bank.gsc": "2.0.2", "tws_t5_bank.gsc": "2.0.3",
"tws_t5_common.gsc": "1.1.0", "tws_t5_common.gsc": "1.1.0",
"tws_t5_hud.gsc": "1.1.0", "tws_t5_hud.gsc": "1.1.0",
"tws_t5_join.gsc": "1.0.0", "tws_t5_join.gsc": "1.0.0",
@@ -8,7 +8,7 @@
"tws_t5_lock.gsc": "1.0.0", "tws_t5_lock.gsc": "1.0.0",
"tws_t5_telemetry.gsc": "1.0.0", "tws_t5_telemetry.gsc": "1.0.0",
"tws_t6_afk.gsc": "1.0.0", "tws_t6_afk.gsc": "1.0.0",
"tws_t6_bank.gsc": "2.0.2", "tws_t6_bank.gsc": "2.0.3",
"tws_t6_common.gsc": "1.1.0", "tws_t6_common.gsc": "1.1.0",
"tws_t6_hud.gsc": "1.1.0", "tws_t6_hud.gsc": "1.1.0",
"tws_t6_join.gsc": "1.0.1", "tws_t6_join.gsc": "1.0.1",