Fix bank GUID serialization on T5 and T6 (Refs #15)

This commit is contained in:
2026-10-12 23:45:44 -04:00
parent 3bb0b5178e
commit ab989395f7
10 changed files with 347 additions and 21 deletions
+6 -1
View File
@@ -38,13 +38,18 @@ The optional `tws_t5_bank.gsc` adds `.b`, `.d <amount|all>` and
`.w <amount|all>` and registers them in help. It requires common and telemetry
`1.0.0` or newer, the TWS t5 plugin `1.1.0`, Electric Cherry's bank API and
a private per-server credential. Follow [bank setup and recovery](../../README.md#player-bank-t5-and-t6),
including a full process restart for the plugin. Bank `2.0.0` uses only
including a full process restart for the plugin. Bank `2.0.0+` uses only
`https://ec.thewrightserver.net/api/bank` and ignores `tws_bank_url`.
Update EC agents to `1.9.1+` first. If the old endpoint differs, follow the
[endpoint upgrade procedure](../../README.md#upgrading-the-bank-endpoint):
an EC rebuild must settle legacy journals before the new scripts start.
When the endpoint already matches, only a map restart is required.
Bank `2.0.1` converts T5's `player getGuid()` result to a string before
requests or journal writes, preserving existing strings exactly. Missing or
invalid identities fail privately without changing points. Follow the shared
[identity and deployment checks](../../README.md#bank-identity-validation).
## Persistent Discord text
The HUD shows `https://discord.thewrightserver.net` in small light-gray text
+31 -1
View File
@@ -115,12 +115,42 @@ bank_request(player, args)
level.bank_busy = false;
}
bank_guid(player)
{
if (!isDefined(player))
return undefined;
guid = player getGuid();
if (!isDefined(guid) || (typeof(guid) != "string" && typeof(guid) != "int"))
return undefined;
// T5 can return a number. Preserve string identities without numeric casts.
guid = "" + guid;
if (guid.size == 0 || guid.size > 64)
return undefined;
allowed = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_.:-";
for (i = 0; i < guid.size; i++)
{
found = false;
for (j = 0; j < allowed.size; j++)
if (guid[i] == allowed[j])
found = true;
if (!found)
return undefined;
}
return guid;
}
bank_transfer(entry, args)
{
player = entry.player;
guid = bank_guid(player);
if (!isDefined(guid))
{
bank_say(entry, "^3Bank player identity unavailable. Try again shortly; points unchanged.");
return;
}
data = [];
data["server"] = level.bank_server;
data["guid"] = player getGuid();
data["guid"] = guid;
if (args[0] == ".b")
{
if (args.size != 1)