排行榜:旧数据完成
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
import { EXTERIOR } from "../pubUtils/dicParam";
|
||||
import { WoodenHorse } from "./battleField/guildActivity";
|
||||
import { RoleUpdate, RoleType } from "../db/Role";
|
||||
import { reduceCe } from "../pubUtils/util";
|
||||
import { GuildUpdateParam } from "../db/Guild";
|
||||
import { currentId } from "async_hooks";
|
||||
|
||||
// 排行榜返回玩家值
|
||||
export class RankParam {
|
||||
@@ -11,15 +15,40 @@ export class RankParam {
|
||||
frame: number = EXTERIOR.EXTERIOR_FACECASE;
|
||||
spine: number = EXTERIOR.EXTERIOR_APPEARANCE;
|
||||
title: number;
|
||||
ce: number;
|
||||
|
||||
constructor(roleName: string, lv: number, vLv: number, head: number, frame: number, spine: number, title: number) {
|
||||
this.roleName = roleName;
|
||||
this.lv = lv;
|
||||
this.vLv = vLv;
|
||||
this.head = head;
|
||||
this.frame = frame;
|
||||
this.spine = spine;
|
||||
this.title = title;
|
||||
constructor(role: RoleUpdate, needReduceCe = false) {
|
||||
this.roleName = role.roleName;
|
||||
this.lv = role.lv;
|
||||
this.vLv = role.vLv;
|
||||
this.head = role.head;
|
||||
this.frame = role.frame;
|
||||
this.spine = role.spine;
|
||||
this.title = role.title;
|
||||
this.guildName = role.guildName;
|
||||
if(needReduceCe) {
|
||||
this.ce = reduceCe(role.ce);
|
||||
} else {
|
||||
this.ce = role.ce;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export class RoleRankInfo extends RankParam {
|
||||
rank: number;
|
||||
roleId: string;
|
||||
num: number;
|
||||
time: number;
|
||||
|
||||
setInfo(rank: number, roleId: string, num: number, time: number) {
|
||||
this.rank = rank;
|
||||
this.roleId = roleId;
|
||||
this.num = num;
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
isMyInfo(myId: string) {
|
||||
return this.roleId == myId;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,13 +68,32 @@ export class GuildRankParam {
|
||||
|
||||
}
|
||||
|
||||
constructor(icon: number, name: string, lv: number, leader: {roleName: string, title: number, lv: number, head: number, frame: number, spine: number}, memberCnt: number) {
|
||||
this.icon = icon;
|
||||
this.name = name;
|
||||
this.lv = lv;
|
||||
constructor(guild: GuildUpdateParam) {
|
||||
this.icon = guild.icon;
|
||||
this.name = guild.name;
|
||||
this.lv = guild.lv;
|
||||
let leader = <RoleType>guild.leader;
|
||||
let _leader = new GuildLeader(leader);
|
||||
this.leader = _leader;
|
||||
this.memberCnt = memberCnt;
|
||||
this.memberCnt = guild.memberCnt;
|
||||
}
|
||||
}
|
||||
|
||||
export class GuildRankInfo extends GuildRankParam {
|
||||
rank: number;
|
||||
code: string;
|
||||
num: number;
|
||||
time: number;
|
||||
|
||||
setInfo(rank: number, code: string, num: number, time: number) {
|
||||
this.rank = rank;
|
||||
this.code = code;
|
||||
this.num = num;
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
isMyInfo(myId: string) {
|
||||
return this.code == myId;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,23 +162,38 @@ export class KeyName {
|
||||
key: string;
|
||||
serverId?: number;
|
||||
guildCode?: string;
|
||||
cityId?: number;
|
||||
|
||||
constructor(key: string) {
|
||||
constructor(key: string, param: KeyNameParam) {
|
||||
this.key = key;
|
||||
if(param.serverId) this.serverId = param.serverId;
|
||||
if(param.guildCode) this.guildCode = param.guildCode;
|
||||
if(param.cityId) this.cityId = param.cityId;
|
||||
}
|
||||
|
||||
getName() {
|
||||
public getName() {
|
||||
let res = this.key;
|
||||
if(this.serverId) res += `:${this.serverId}`;
|
||||
if(this.guildCode) res += `:${this.guildCode}`;
|
||||
if(this.cityId) res += `:${this.cityId}`;
|
||||
return res;
|
||||
}
|
||||
|
||||
getNameWithPlus(...plus: string[]) {
|
||||
public getNameWithPlus(...plus: string[]) {
|
||||
let res = this.getName();
|
||||
for(let p of plus) {
|
||||
res += `:${p}`;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
public getTimeName() {
|
||||
return this.getNameWithPlus('time');
|
||||
}
|
||||
|
||||
public getUnionName() {
|
||||
return this.getNameWithPlus('union');
|
||||
}
|
||||
}
|
||||
|
||||
export type KeyNameParam = Partial<KeyName>;
|
||||
Reference in New Issue
Block a user