排行榜: 获取排行榜
This commit is contained in:
+54
-14
@@ -4,6 +4,7 @@ import { RoleUpdate, RoleType } from "../db/Role";
|
||||
import { reduceCe } from "../pubUtils/util";
|
||||
import { GuildUpdateParam } from "../db/Guild";
|
||||
import { currentId } from "async_hooks";
|
||||
import { HeroType } from "../db/Hero";
|
||||
|
||||
// 排行榜返回玩家值
|
||||
export class RankParam {
|
||||
@@ -17,7 +18,7 @@ export class RankParam {
|
||||
title: number;
|
||||
ce: number;
|
||||
|
||||
constructor(role: RoleUpdate, needReduceCe = false) {
|
||||
constructor(role: RoleUpdate) {
|
||||
this.roleName = role.roleName;
|
||||
this.lv = role.lv;
|
||||
this.vLv = role.vLv;
|
||||
@@ -25,11 +26,11 @@ export class RankParam {
|
||||
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.guildName = role.guildName||"";
|
||||
if(role.isReducedCe) {
|
||||
this.ce = role.ce;
|
||||
} else {
|
||||
this.ce = reduceCe(role.ce);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -39,16 +40,26 @@ export class RoleRankInfo extends RankParam {
|
||||
roleId: string;
|
||||
num: number;
|
||||
time: number;
|
||||
hero: LineupParam[];
|
||||
lineup: LineupParam[];
|
||||
|
||||
setInfo(rank: number, roleId: string, num: number, time: number) {
|
||||
setInfo(rank: number, myId: myIdInter, num: number, time: number) {
|
||||
this.rank = rank;
|
||||
this.roleId = roleId;
|
||||
this.roleId = myId.roleId;
|
||||
this.num = num;
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
isMyInfo(myId: string) {
|
||||
return this.roleId == myId;
|
||||
isMyInfo(myId: myIdInter) {
|
||||
return this.roleId == myId.roleId;
|
||||
}
|
||||
|
||||
setTopLine(lineup: LineupParam[]){
|
||||
this.lineup = lineup;
|
||||
}
|
||||
|
||||
setSingleHero(hero: LineupParam[]){
|
||||
this.hero = hero;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,15 +96,15 @@ export class GuildRankInfo extends GuildRankParam {
|
||||
num: number;
|
||||
time: number;
|
||||
|
||||
setInfo(rank: number, code: string, num: number, time: number) {
|
||||
setInfo(rank: number, myId: myIdInter, num: number, time: number) {
|
||||
this.rank = rank;
|
||||
this.code = code;
|
||||
this.code = myId.guildCode;
|
||||
this.num = num;
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
isMyInfo(myId: string) {
|
||||
return this.code == myId;
|
||||
isMyInfo(myId: myIdInter) {
|
||||
return this.code == myId.guildCode;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,6 +126,25 @@ export class GuildLeader {
|
||||
}
|
||||
}
|
||||
|
||||
// 排行榜返回玩家值
|
||||
export class LineupParam {
|
||||
hid: number;
|
||||
star: number;
|
||||
colorStar: number;
|
||||
lv: number;
|
||||
quality: number;
|
||||
job: number;
|
||||
|
||||
constructor(hero: HeroType) {
|
||||
this.hid = hero.hid;
|
||||
this.star = hero.star;
|
||||
this.colorStar = hero.colorStar;
|
||||
this.lv = hero.lv;
|
||||
this.quality = hero.quality;
|
||||
this.job = hero.job;
|
||||
}
|
||||
}
|
||||
|
||||
export class SimpleGuildRankParam {
|
||||
rank: number = 0;
|
||||
code: string = "";
|
||||
@@ -163,12 +193,14 @@ export class KeyName {
|
||||
serverId?: number;
|
||||
guildCode?: string;
|
||||
cityId?: number;
|
||||
hid?: number;
|
||||
|
||||
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;
|
||||
if(param.hid) this.hid = param.hid;
|
||||
}
|
||||
|
||||
public getName() {
|
||||
@@ -176,6 +208,7 @@ export class KeyName {
|
||||
if(this.serverId) res += `:${this.serverId}`;
|
||||
if(this.guildCode) res += `:${this.guildCode}`;
|
||||
if(this.cityId) res += `:${this.cityId}`;
|
||||
if(this.hid) res += `:${this.hid}`;
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -196,4 +229,11 @@ export class KeyName {
|
||||
}
|
||||
}
|
||||
|
||||
export type KeyNameParam = Partial<KeyName>;
|
||||
export type KeyNameParam = Partial<KeyName>;
|
||||
|
||||
|
||||
export interface myIdInter {
|
||||
roleId?: string;
|
||||
guildCode?: string;
|
||||
hid?: number;
|
||||
}
|
||||
Reference in New Issue
Block a user