🐞 fix(gvg): 修复队伍进出城池内存更新
This commit is contained in:
@@ -198,4 +198,5 @@ export const PUSH_ROUTE = {
|
||||
GVG_PLAYER_AREA_ADD: 'onPlayerAddToArea', // 积分点上的驻守人变更
|
||||
GVG_PLAYER_LEAVE_AREA: 'onPlayerLeaveArea', // 积分点上的驻守人变更
|
||||
GVG_CITY_RANK_UPDATE: 'onGVGCityRankUpdate', // 城池积分排名
|
||||
GVG_SPINE_ATTACKED: 'onSpinesAttacked', // 4.7 队伍在地图上受到攻击
|
||||
}
|
||||
+1
-1
@@ -7,7 +7,7 @@ import { GVG_REC_TYPE } from '../consts';
|
||||
@index({ createTime: -1 })
|
||||
export default class GVGRec extends BaseModel {
|
||||
|
||||
@prop({ required: true, default: '' })
|
||||
@prop({ required: false, default: '' })
|
||||
leagueCode: string; // 联军id
|
||||
|
||||
@prop({ required: false, default: '' })
|
||||
|
||||
+8
-20
@@ -136,14 +136,9 @@ export default class GVGTeam extends BaseModel {
|
||||
}
|
||||
|
||||
// 玩家切换城池更新队伍信息
|
||||
public static async enterCity(roleId: string, cityId: number, areaId: number, groupKey: string) {
|
||||
let teams = await GVGTeamModel.findByRole(roleId, '-_id')
|
||||
let result: GVGTeamType[] = [];
|
||||
for(let targetTeam of teams) {
|
||||
let team: GVGTeamType = await GVGTeamModel.findOneAndUpdate({ teamCode: targetTeam.teamCode }, { $set: { cityId, areaId, fromAreaId: areaId, pointId: 0, groupKey } }, { new: true }).lean();
|
||||
result.push(team);
|
||||
}
|
||||
return result;
|
||||
public static async enterCity(teamCode: string, cityId: number, areaId: number, groupKey: string) {
|
||||
let team: GVGTeamType = await GVGTeamModel.findOneAndUpdate({ teamCode }, { $set: { cityId, areaId, fromAreaId: areaId, pointId: 0, groupKey } }, { new: true }).lean();
|
||||
return team;
|
||||
}
|
||||
|
||||
// 离开队伍
|
||||
@@ -205,16 +200,9 @@ export default class GVGTeam extends BaseModel {
|
||||
}
|
||||
|
||||
// 每赛季初刷新自己的耐久等东西
|
||||
public static async refreshByConfig(roleId: string, updateArr: GVGTeamUpdate[]) {
|
||||
await GVGTeamModel.bulkWrite(updateArr.map(obj => {
|
||||
return {
|
||||
updateOne: {
|
||||
filter: { roleId, teamCode: obj.teamCode },
|
||||
update: { $set: obj }
|
||||
}
|
||||
}
|
||||
}));
|
||||
return await GVGTeamModel.findByRole(roleId, '-_id');
|
||||
public static async refreshByConfig(teamCode: string, update: GVGTeamUpdate) {
|
||||
const team: GVGTeamType = await GVGTeamModel.findOneAndUpdate({ teamCode }, { $set: update }, { new: true }).lean();
|
||||
return team;
|
||||
}
|
||||
|
||||
public static async findRobotTeams(groupKey: string, cityId: number) {
|
||||
@@ -306,11 +294,11 @@ export default class GVGTeam extends BaseModel {
|
||||
// 队伍进入修整器
|
||||
public static async teamBreak(teamCode: string, isRobot: boolean, maxDurability: number, areaId: number, fromAreaId: number, reviveCd: number) {
|
||||
if(!isRobot) {
|
||||
const team: GVGTeamType = await GVGTeamModel.findOneAndUpdate({ teamCode }, { $set: { restartTime: nowSeconds() - reviveCd, stopMoveTime: nowSeconds(), areaId, fromAreaId, durability: maxDurability } }, { new: true }).lean();
|
||||
const team: GVGTeamType = await GVGTeamModel.findOneAndUpdate({ teamCode }, { $set: { restartTime: nowSeconds() - reviveCd, stopMoveTime: nowSeconds(), areaId, fromAreaId, durability: maxDurability, pointId: 0 } }, { new: true }).lean();
|
||||
team.curTeamBreak = true;
|
||||
return team;
|
||||
} else {
|
||||
const team: GVGTeamType = await GVGTeamModel.findOneAndUpdate({ teamCode }, { $set: { fromAreaId, durability: 0, isBroken: true } }, { new: true }).lean();
|
||||
const team: GVGTeamType = await GVGTeamModel.findOneAndUpdate({ teamCode }, { $set: { fromAreaId, pointId: 0, durability: 0, isBroken: true } }, { new: true }).lean();
|
||||
team.curTeamBreak = true;
|
||||
return team;
|
||||
}
|
||||
|
||||
@@ -698,6 +698,26 @@ export class GVGTeamInList {
|
||||
}
|
||||
}
|
||||
|
||||
// 地图右边列表上的队伍信息
|
||||
export class GVGAttackSpine {
|
||||
teamCode: string; // 队伍唯一id
|
||||
durability: number; // 耐久
|
||||
maxDurability: number; // 最大耐久
|
||||
hurt: number; // 投石车造成的伤害
|
||||
pointId: number; // 可能会被打下积分点
|
||||
areaId: number; // 被打到哪个区域
|
||||
|
||||
constructor(team: GVGTeamType, hurt: number) {
|
||||
if(!team) return;
|
||||
this.teamCode = team.teamCode;
|
||||
this.durability = team.durability;
|
||||
this.maxDurability = team.maxDurability;
|
||||
this.pointId = team.pointId;
|
||||
this.areaId = team.areaId;
|
||||
this.hurt = hurt;
|
||||
}
|
||||
}
|
||||
|
||||
export class GVGTeamInListOnPoint extends GVGTeamInList {
|
||||
pointId: number; // 积分点
|
||||
hasTeam: boolean; // 是否有队伍占领
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user