Files
ZYZ/shared/domain/gameField/serverlist.ts
2021-03-11 19:30:40 +08:00

74 lines
2.3 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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; // 玩家名
head: number; // 头像
frame: number; // 相框
spine: number; // 形象
lv: number; // 等级
updatedAt: Date;
headHid: number = 19; // TODO等客户端完成后删除这个字段
sHid: number = 19;
constructor(role: RoleType, server: ServerInfo) {
super(server);
this.groupId = server.groupId;
this.groupName = server.groupName;
this.roleId = role.roleId;
this.roleName = role.roleName;
this.head = role.head;
this.frame = role.frame;
this.spine = role.spine;
this.lv = role.lv;
this.updatedAt = role.updatedAt;
}
}