69 lines
2.1 KiB
TypeScript
69 lines
2.1 KiB
TypeScript
import { ServerInfo } from '../../db/Game';
|
|
import { RoleType } from '../../db/Role';
|
|
import { getSeconds } from '../../pubUtils/timeUtil';
|
|
|
|
export class ServerParam {
|
|
id: number; // 区号
|
|
serverStr: string; // 显示的区号 S1
|
|
name: string; // 区名
|
|
host: string; // pinus地址
|
|
port: number; // pinus端口
|
|
status: number; // 状态
|
|
openTime: number; // 开服时间
|
|
serverType: string; // 分区类型 官服 测试服 开发服
|
|
|
|
constructor(server: ServerInfo) {
|
|
this.id = server.id;
|
|
this.serverStr = `S${this.id}`;
|
|
this.name = server.name;
|
|
this.host = server.host;
|
|
this.port = server.port;
|
|
this.status = server.status;
|
|
this.openTime = getSeconds(server.openTime);
|
|
this.serverType = server.serverType;
|
|
}
|
|
}
|
|
|
|
export class GroupParam {
|
|
groupId: number; // 大区号
|
|
groupName: string; // 大区名
|
|
groupStr: string; // 大区内小区编号 S1-S10
|
|
servers: ServerParam[]; // 区
|
|
|
|
constructor(server: ServerInfo) {
|
|
this.groupId = server.groupId;
|
|
this.groupName = server.groupName;
|
|
this.groupStr = `S${server.id}-S${server.id + 9}`;
|
|
this.servers = new Array<ServerParam>();
|
|
}
|
|
|
|
public pushServer(server: ServerInfo) {
|
|
let srv = new ServerParam(server);
|
|
this.servers.push(srv);
|
|
}
|
|
}
|
|
|
|
export class ServerParamWithRole extends ServerParam {
|
|
groupId: number; // 大区号
|
|
groupName: string; // 大区名
|
|
|
|
roleId: string; // 玩家账号
|
|
roleName: string; // 玩家名
|
|
headHid: number; // 头像
|
|
sHid: number; // 形象
|
|
lv: number; // 等级
|
|
updatedAt: Date;
|
|
|
|
constructor(role: RoleType, server: ServerInfo) {
|
|
super(server);
|
|
this.groupId = server.groupId;
|
|
this.groupName = server.groupName;
|
|
|
|
this.roleId = role.roleId;
|
|
this.roleName = role.roleName;
|
|
this.headHid = role.headHid;
|
|
this.sHid = role.sHid;
|
|
this.lv = role.lv;
|
|
this.updatedAt = role.updatedAt;
|
|
}
|
|
} |