军团活动:修改粮草先行

This commit is contained in:
luying
2022-04-30 19:19:15 +08:00
parent d9d0aad862
commit 2b737f2528
6 changed files with 160 additions and 123 deletions

View File

@@ -76,6 +76,8 @@ export class WoodenHorse {
@prop({required: true})
distance: number = 0; // 距离
@prop({required: true})
allStartTime: number = 0; // 全服开启世界
@prop({required: true})
startTime: number = 0; // 开始时间
@prop({required: true})
time: number = 0; // 到达时间
@@ -92,11 +94,19 @@ export class WoodenHorse {
remainItems: Map<number, { total: number, max: number }> = new Map();
constructor(guildCode: string, guildName: string, guildCe: number, serverId: number) {
constructor(guildCode: string, guildName: string, guildCe: number, serverId: number, allStartTime: number) {
this.guildCode = guildCode;
this.guildName = guildName;
this.guildCe = guildCe;
this.serverId = serverId;
this.allStartTime = allStartTime;
}
public startRace(allStartTime: number) {
this.status = RACE_ACTIVITY_STATUS.START;
this.time = Date.now();
this.startTime = Date.now();
this.allStartTime = allStartTime;
}
/**
@@ -249,6 +259,12 @@ export class WoodenHorse {
public setRemainItem(id: number, remain: number, max: number) {
this.remainItems.set(id, { total: remain, max });
}
public getTreatTime() {
console.log('#######', this.time, this.allStartTime)
return {...this, time: this.time - this.allStartTime }
}
}
export class Event {
@@ -319,4 +335,29 @@ export class CityParam {
constructor(cityId: number) {
this.cityId = cityId;
}
}
}
export class RaceActivityRankParam {
rank: number = 0;
code: string;
name: string;
time: number;
sortTime: number;
sortDistance: number;
num: number;
durability: number;
constructor(woodenHorse: WoodenHorse) {
this.code = woodenHorse.guildCode;
this.name = woodenHorse.guildName;
this.durability = woodenHorse.durability;
this.sortDistance = woodenHorse.distance
this.sortTime = woodenHorse.time - woodenHorse.allStartTime;
this.num = Math.floor(woodenHorse.distance);
this.time = Math.floor((woodenHorse.time - woodenHorse.allStartTime)/1000)
}
setRank(rank: number) {
this.rank = rank;
}
}

View File

@@ -188,7 +188,8 @@ export class GuildRankInfo extends GuildRankParam {
code: string;
num: number;
time: number;
active?: number;
num1?: number;
num2?: number;
setInfo(rank: number, myId: myIdInter, num: number, time: number) {
this.rank = rank;
@@ -197,12 +198,12 @@ export class GuildRankInfo extends GuildRankParam {
this.time = time;
}
setInfo2(rank: number, myId: myIdInter, num: number, active: number, time: number) {
setInfo2(rank: number, myId: myIdInter, num: number, num1: number, num2: number) {
this.rank = rank;
this.code = myId.guildCode;
this.num = num;
this.time = time;
this.active = active;
this.num1 = num1;
this.num2 = num2;
}
isMyInfo(myId: myIdInter) {
@@ -258,21 +259,6 @@ export class SimpleGuildRankParam {
}
}
export class SimpleGuildRankWithTimeParam extends SimpleGuildRankParam {
time: number = 0;
durability: number = 0;
constructor(rank: number, code: string, name: string, obj: WoodenHorse|{distance: number, time: number, startTime: number, durability: number}|false) {
super(rank, code, name, obj?obj.distance:0);
// console.log(JSON.stringify(obj));
if(obj) {
this.num = obj.distance;
this.time = Math.floor((obj.time - obj.startTime)/1000);
this.durability = obj.durability;
}
}
}
export class SimpleRoleRankParam {
rank: number;
roleId: string;