🐞 fix(gvg): 投石车定时任务

This commit is contained in:
luying
2023-02-17 11:00:23 +08:00
parent 4359bfd9cc
commit 7543baa8cb
17 changed files with 304 additions and 52 deletions
+9 -28
View File
@@ -1,4 +1,5 @@
import GVGTeam, { GVGTeamType } from "../../db/GVGTeam";
import { nowSeconds } from "../../pubUtils/timeUtil";
// 积分点分类统计,1-3级积分点代表从小到大
export class LeagueCityPoint {
@@ -25,27 +26,14 @@ export class GVGTeamMem extends GVGTeam {
constructor(team: GVGTeamType) {
super();
this.roleId = team.roleId;
this.roleName = team.roleName;
this.serverId = team.serverId;
this.teamCode = team.teamCode;
this.index = team.index;
this.leagueCode = team.leagueCode;
this.guildCode = team.guildCode;
this.areaId = team.areaId;
this.fromAreaId = team.fromAreaId;
this.cityId = team.cityId;
this.pointId = team.pointId;
this.head = team.head;
this.spine = team.spine;
this.frame = team.frame;
this.durability = team.durability;
this.restartTime = team.restartTime;
this.attackTime = team.attackTime;
this.defenseTime = team.defenseTime;
this.startMoveTime = team.startMoveTime;
this.stopMoveTime = team.stopMoveTime;
this.score = team.score;
this.updateTeam(team);
}
public updateTeam(team: GVGTeamType) {
for(let key in team) {
this[key] = team[key];
}
this.isMoving = this.stopMoveTime > nowSeconds();
}
public setCity(cityId: number, areaId = 0, pointId = 0) {
@@ -60,11 +48,4 @@ export class GVGTeamMem extends GVGTeam {
this.startMoveTime = startMoveTime;
this.stopMoveTime = stopMoveTime;
}
public battleEnd(team: GVGTeamType) {
this.durability = team.durability;
this.restartTime = team.restartTime;
this.defenseTime = team.defenseTime;
this.stopMoveTime = team.stopMoveTime;
}
}
+28
View File
@@ -623,6 +623,10 @@ export class GVGTeamSpineInMap {
isMoving: boolean = false;
pointId: number = 0;
fromAreaId: number = 0;
teamCode: string = '';
leagueCode: string = '';
leagueName: string = '';
constructor(obj: GVGTeamMem, serverNames: {[serverId: string]: string}) {
this.spine = obj.spine;
@@ -633,6 +637,9 @@ export class GVGTeamSpineInMap {
this.isMoving = nowSeconds() < this.stopMoveTime;
this.pointId = obj.pointId;
this.fromAreaId = obj.fromAreaId;
this.teamCode = obj.teamCode;
this.leagueCode = obj.leagueCode;
this.leagueName = obj.leagueName;
}
}
@@ -680,6 +687,27 @@ export class GVGTeamInListOnPoint extends GVGTeamInList {
}
}
export class MyTeamSimpleInfo {
teamCode: string; // 队伍唯一id
index: number; // 队伍位置
head: number; // 保存头像
frame: number; // 保存相框
spine: number; // 保存形象
lineup: {
actorId: number; // 武将
dataId: number; // 出兵表上的位置
order: number; // 行动
}[];
constructor(team: GVGTeamType) {
this.teamCode = team.teamCode;
this.index = team.index;
this.head = team.head;
this.frame = team.spine;
this.lineup = team.lineup.map(({ actorId, dataId, outIndex }) => ({ actorId, dataId, order: outIndex }));
}
}
// 更新自己队伍时候的比较详细点的数据
export class MyTeamInfo {
teamCode: string; // 队伍唯一id