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

This commit is contained in:
luying
2023-02-24 18:03:23 +08:00
parent 42401b317f
commit d7b9167e0f
3 changed files with 16 additions and 9 deletions
@@ -279,17 +279,18 @@ export class GVGBattleHandler {
let serverNames = await getAllServerName(); let serverNames = await getAllServerName();
let teamObj = getGVGBattleData(groupKey); let teamObj = getGVGBattleData(groupKey);
let result: GVGAreaInMap[] = []; let result: GVGTeamSpineInMap[] = [];
for(let areaId of areaIds) { for(let areaId of areaIds) {
let teams = teamObj.findTeamsByArea(areaId); let teams = teamObj.findTeamsByArea(areaId);
let spines = teams.map(team => new GVGTeamSpineInMap(team, serverNames)); for(let team of teams) {
result.push({ areaId, spines }) result.push(new GVGTeamSpineInMap(team, serverNames))
}
} }
// 加入频道 // 加入频道
await leaveGVGAreaChannel(roleId, sid); await leaveGVGAreaChannel(roleId, sid);
await addRoleToAreaChannel(roleId, groupKey, areaIds, 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); const curTeam = await GVGTeamModel.settlePoint(teamCode, 0);
await GVGCityAreaPointModel.leavePoint(configId, groupKey, pointId); await GVGCityAreaPointModel.leavePoint(configId, groupKey, pointId);
let teamObj = getGVGBattleData(groupKey); let teamObj = getGVGBattleData(groupKey);
teamObj.teamSettle(roleId, teamCode, pointId); teamObj.teamSettle(roleId, teamCode, 0);
return resResult(STATUS.SUCCESS, { curTeam: new MyTeamInfo(curTeam) }); return resResult(STATUS.SUCCESS, { curTeam: new MyTeamInfo(curTeam) });
} }
@@ -402,15 +402,19 @@ export async function gvgBattleSeconds() {
await redisAddSettleScore(team, addScore); await redisAddSettleScore(team, addScore);
} }
// 向下推送区域数据 // 向下推送区域数据
let spinesByCity = new Map<number, GVGTeamSpineInMap[]>();
for(let areaId of teamObj.findAreas()) { for(let areaId of teamObj.findAreas()) {
let dicArea = gameData.gvgArea.get(areaId); let dicArea = gameData.gvgArea.get(areaId);
let teams = teamObj.findTeamsByArea(areaId); let teams = teamObj.findTeamsByArea(areaId);
let result = teams.map(team => new GVGTeamSpineInMap(team, serverNames)); let spines = teams.map(team => new GVGTeamSpineInMap(team, serverNames));
await sendMessageToGVGAreaWithSuc(teamObj.groupKey, areaId, PUSH_ROUTE.GVG_AREA_SPINE_CHANGE, { cityId: dicArea.cityId, areaId, spines: result }); 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); let index = keys.findIndex(cur => cur.cityId == dicArea.cityId && cur.groupKey == teamObj.groupKey);
if(index == -1) keys.push({ groupKey: teamObj.groupKey, cityId: dicArea.cityId }); 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 });
}
} }
+3 -1
View File
@@ -655,6 +655,7 @@ export class GVGTeamSpineInMap {
moveCdTime: number = 0; moveCdTime: number = 0;
isMoving: boolean = false; isMoving: boolean = false;
pointId: number = 0; pointId: number = 0;
areaId: number = 0;
fromAreaId: number = 0; fromAreaId: number = 0;
teamCode: string = ''; teamCode: string = '';
leagueCode: string = ''; leagueCode: string = '';
@@ -669,6 +670,7 @@ export class GVGTeamSpineInMap {
this.stopMoveTime = obj.stopMoveTime; this.stopMoveTime = obj.stopMoveTime;
this.moveCdTime = obj.moveCdTime; this.moveCdTime = obj.moveCdTime;
this.isMoving = nowSeconds() < this.stopMoveTime; this.isMoving = nowSeconds() < this.stopMoveTime;
this.areaId = obj.areaId;
this.pointId = obj.pointId; this.pointId = obj.pointId;
this.fromAreaId = obj.fromAreaId; this.fromAreaId = obj.fromAreaId;
this.teamCode = obj.teamCode; this.teamCode = obj.teamCode;
@@ -791,7 +793,7 @@ export class MyTeamInfo {
this.teamCode = team.teamCode; this.teamCode = team.teamCode;
this.index = team.index; this.index = team.index;
this.head = team.head; 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 })); if(team.lineup) this.lineup = team.lineup.map(({ actorId, dataId, outIndex }) => ({ actorId, dataId, order: outIndex }));
this.durability = team.durability; this.durability = team.durability;
this.maxDurability = team.maxDurability; this.maxDurability = team.maxDurability;