修正角色id查询的一处错误

This commit is contained in:
yoimiya-kokomi 2022-04-10 15:08:03 +08:00
parent be044356f8
commit 243d1087e9

View File

@ -104,19 +104,23 @@ let getMeta = function (name) {
Character.get = function (val) { Character.get = function (val) {
let roleid, name; let roleid, name;
if (typeof (val) === "number") { if (typeof (val) === "number" || /^\d*$/.test(val)) {
roleid = val; roleid = val;
} else if (val.id) { } else if (val.id) {
roleid = val.id; roleid = val.id;
name = val.name || YunzaiApps.mysInfo['roleIdToName'](roleid, true); name = val.name || YunzaiApps.mysInfo['roleIdToName'](roleid, true);
} else { } else {
roleid = YunzaiApps.mysInfo['roleIdToName'](val); roleid = YunzaiApps.mysInfo['roleIdToName'](val);
}
if (!name) {
name = YunzaiApps.mysInfo['roleIdToName'](roleid, true); name = YunzaiApps.mysInfo['roleIdToName'](roleid, true);
} }
if (!name) { if (!name) {
return false; return false;
} }
return new Character(name, roleid); return new Character(name, roleid);
}; };