DESKTOP-5RP3AKU\Jisol 09225a33c7 update
2023-10-26 03:06:44 +08:00

38 lines
851 B
TypeScript

import { TableGRole } from "../../../resources/config/ts/TableGRole";
import GRoleBase from "../base/role/GRoleBase";
//角色实体类
export default interface GRole {
id:number; //宠物Id
}
//角色工具类
export class GRoleUtil{
//获取存活的玩家 如果不存活则返回 null
static get<T>(player:GRoleBase<T>):() => GRoleBase<T>{
if(!player) return null;
return ():GRoleBase<T> => {
if(player)
return player.get();
return null;
}
}
//通过Id 获取 GRole
static getGRole(id:number):GRole{
let info:TableGRole;
if(!(info = TableGRole.getConfig(id))) return null;
return {
id:info.id
}
}
static getGRoles(ids:number[]):GRole[]{
return ids.map(id => GRoleUtil.getGRole(id));
}
}