修正角色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) {
let roleid, name;
if (typeof (val) === "number") {
if (typeof (val) === "number" || /^\d*$/.test(val)) {
roleid = val;
} else if (val.id) {
roleid = val.id;
name = val.name || YunzaiApps.mysInfo['roleIdToName'](roleid, true);
} else {
roleid = YunzaiApps.mysInfo['roleIdToName'](val);
}
if (!name) {
name = YunzaiApps.mysInfo['roleIdToName'](roleid, true);
}
if (!name) {
return false;
}
return new Character(name, roleid);
};