Fix bank GUID serialization on T5 and T6 (Refs #15)
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user