🐞 fix(gvg): 激战期队伍下发格式修改

This commit is contained in:
luying
2023-02-24 18:03:11 +08:00
parent 42401b317f
commit d7b9167e0f
3 changed files with 16 additions and 9 deletions

View File

@@ -279,17 +279,18 @@ export class GVGBattleHandler {
let serverNames = await getAllServerName();
let teamObj = getGVGBattleData(groupKey);
let result: GVGAreaInMap[] = [];
let result: GVGTeamSpineInMap[] = [];
for(let areaId of areaIds) {
let teams = teamObj.findTeamsByArea(areaId);
let spines = teams.map(team => new GVGTeamSpineInMap(team, serverNames));
result.push({ areaId, spines })
for(let team of teams) {
result.push(new GVGTeamSpineInMap(team, serverNames))
}
}
// 加入频道
await leaveGVGAreaChannel(roleId, sid);
await addRoleToAreaChannel(roleId, groupKey, areaIds, sid);
return resResult(STATUS.SUCCESS, { cityId, areas: result });
return resResult(STATUS.SUCCESS, { cityId, spines: result });
}
// 点击自己的编队获取区域列表
@@ -426,7 +427,7 @@ export class GVGBattleHandler {
const curTeam = await GVGTeamModel.settlePoint(teamCode, 0);
await GVGCityAreaPointModel.leavePoint(configId, groupKey, pointId);
let teamObj = getGVGBattleData(groupKey);
teamObj.teamSettle(roleId, teamCode, pointId);
teamObj.teamSettle(roleId, teamCode, 0);
return resResult(STATUS.SUCCESS, { curTeam: new MyTeamInfo(curTeam) });
}

View File

@@ -402,15 +402,19 @@ export async function gvgBattleSeconds() {
await redisAddSettleScore(team, addScore);
}
// 向下推送区域数据
let spinesByCity = new Map<number, GVGTeamSpineInMap[]>();
for(let areaId of teamObj.findAreas()) {
let dicArea = gameData.gvgArea.get(areaId);
let teams = teamObj.findTeamsByArea(areaId);
let result = teams.map(team => new GVGTeamSpineInMap(team, serverNames));
await sendMessageToGVGAreaWithSuc(teamObj.groupKey, areaId, PUSH_ROUTE.GVG_AREA_SPINE_CHANGE, { cityId: dicArea.cityId, areaId, spines: result });
let spines = teams.map(team => new GVGTeamSpineInMap(team, serverNames));
if(!spinesByCity.has(dicArea.cityId)) spinesByCity.set(dicArea.cityId, []);
spinesByCity.get(dicArea.cityId).push(...spines);
let index = keys.findIndex(cur => cur.cityId == dicArea.cityId && cur.groupKey == teamObj.groupKey);
if(index == -1) keys.push({ groupKey: teamObj.groupKey, cityId: dicArea.cityId });
}
for(let [cityId, spines] of spinesByCity) {
await sendMessageToGVGCityWithSuc(teamObj.groupKey, cityId, PUSH_ROUTE.GVG_AREA_SPINE_CHANGE, { cityId, spines });
}
}

View File

@@ -655,6 +655,7 @@ export class GVGTeamSpineInMap {
moveCdTime: number = 0;
isMoving: boolean = false;
pointId: number = 0;
areaId: number = 0;
fromAreaId: number = 0;
teamCode: string = '';
leagueCode: string = '';
@@ -669,6 +670,7 @@ export class GVGTeamSpineInMap {
this.stopMoveTime = obj.stopMoveTime;
this.moveCdTime = obj.moveCdTime;
this.isMoving = nowSeconds() < this.stopMoveTime;
this.areaId = obj.areaId;
this.pointId = obj.pointId;
this.fromAreaId = obj.fromAreaId;
this.teamCode = obj.teamCode;
@@ -791,7 +793,7 @@ export class MyTeamInfo {
this.teamCode = team.teamCode;
this.index = team.index;
this.head = team.head;
this.frame = team.spine;
this.frame = team.frame;
if(team.lineup) this.lineup = team.lineup.map(({ actorId, dataId, outIndex }) => ({ actorId, dataId, order: outIndex }));
this.durability = team.durability;
this.maxDurability = team.maxDurability;