军团活动:修复活动结束之后还继续挑战的bug
This commit is contained in:
@@ -12,6 +12,7 @@ export class CityActivityObject {
|
||||
private guilds: Map<string, number> = new Map(); // 军团所在的城池 guildCode => cityId
|
||||
private historyCity: Map<string, number> = new Map(); // 获取自己打开过的城池的页面 roleId => cityId
|
||||
private sentCity: string[] = [];
|
||||
private startTime: number = 0;
|
||||
|
||||
private getKey(serverId: number, cityId: number) {
|
||||
return `${serverId}_${cityId}`;
|
||||
@@ -36,6 +37,14 @@ export class CityActivityObject {
|
||||
}
|
||||
}
|
||||
|
||||
public startActivity() {
|
||||
this.startTime = Date.now();
|
||||
}
|
||||
|
||||
public getTimeGap() {
|
||||
return Date.now() - this.startTime;
|
||||
}
|
||||
|
||||
public hasSent(serverId: number, cityId: number) {
|
||||
let key = this.getKey(serverId, cityId);
|
||||
return this.sentCity.indexOf(key) != -1;
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
// 军团活动蛮夷入侵城门血量等数据存储
|
||||
|
||||
import { Member, GateMembersRec } from "../../domain/battleField/guildActivity";
|
||||
import { GUILDACTIVITY } from "../../pubUtils/dicParam";
|
||||
|
||||
export class GateActivityObject {
|
||||
public startTime: number;
|
||||
private members: Map<string, Array<Member>> = new Map(); // 每个军团参与的成员 guildCode => [{roleId, job}]
|
||||
private membersRecord: Map<string, GateMembersRec> = new Map(); // 每个成员的回合数和敌军数,防刷 recCode => GateMembersRec
|
||||
private guilds: Map<number, string[]> = new Map(); // 参加的所有军团 server => [guildCode]
|
||||
@@ -18,6 +18,14 @@ export class GateActivityObject {
|
||||
}
|
||||
}
|
||||
|
||||
public startActivity() {
|
||||
this.startTime = Date.now();
|
||||
}
|
||||
|
||||
public getTimeGap() {
|
||||
return Date.now() - this.startTime;
|
||||
}
|
||||
|
||||
public getGuilds() {
|
||||
return this.guilds;
|
||||
}
|
||||
|
||||
@@ -660,6 +660,15 @@ export async function sendRaceStartMsg(serverId: number) {
|
||||
await calWoodenHorseAndSend(serverId);
|
||||
}
|
||||
|
||||
export async function cityActivityStart() {
|
||||
let obj = getCityActivityObj();
|
||||
obj.startActivity();
|
||||
}
|
||||
|
||||
export async function gateActivityStart() {
|
||||
let obj = getGateActivityObj();
|
||||
obj.startActivity();
|
||||
}
|
||||
|
||||
/**
|
||||
* 结算粮草先行奖励
|
||||
|
||||
Reference in New Issue
Block a user