🐞 fix(gvg): 更新gvg战斗返回
This commit is contained in:
@@ -462,7 +462,7 @@ export class GVGBattleHandler {
|
|||||||
teamObj.setTime(defenseTeam.teamCode, defenseTeam);
|
teamObj.setTime(defenseTeam.teamCode, defenseTeam);
|
||||||
let heroes = getOppHeroes(warId, defenseTeam.isRobot, defenseTeam.lineup)
|
let heroes = getOppHeroes(warId, defenseTeam.isRobot, defenseTeam.lineup)
|
||||||
|
|
||||||
return resResult(STATUS.SUCCESS, { battleCode: battleRecord.battleCode, warId, isRobot: defenseTeam.isRobot, heroes, curTeam: new MyTeamInfo(attackTeam) });
|
return resResult(STATUS.SUCCESS, { battleCode: battleRecord.battleCode, warId, isRobot: defenseTeam.isRobot, heroes, curTeam: new MyTeamInfo(attackTeam), oppTeam: new MyTeamInfo(defenseTeam) });
|
||||||
}
|
}
|
||||||
|
|
||||||
// 队伍停止攻击
|
// 队伍停止攻击
|
||||||
@@ -655,8 +655,10 @@ export class GVGBattleHandler {
|
|||||||
let pointIds = gameData.gvgPointByAreaId.get(areaId)||[];
|
let pointIds = gameData.gvgPointByAreaId.get(areaId)||[];
|
||||||
let pointArrs: { pointId: number, guardLeagueName: string }[] = [];
|
let pointArrs: { pointId: number, guardLeagueName: string }[] = [];
|
||||||
for(let pointId of pointIds) {
|
for(let pointId of pointIds) {
|
||||||
|
let dicAreaPoint = gameData.gvgAreaPoint.get(pointId);
|
||||||
|
if(!dicAreaPoint) continue;
|
||||||
let playerPoint = points.find(cur => cur.pointId == pointId);
|
let playerPoint = points.find(cur => cur.pointId == pointId);
|
||||||
pointArrs.push({ pointId, guardLeagueName: playerPoint? (playerPoint.leagueName||"无"): GVG.GVG_ROBOT_NAME });
|
pointArrs.push({ pointId, guardLeagueName: playerPoint? (playerPoint.leagueName||"无"): dicAreaPoint.name });
|
||||||
}
|
}
|
||||||
if(pointArrs.length > 0) areas.push({ areaId, points: pointArrs });
|
if(pointArrs.length > 0) areas.push({ areaId, points: pointArrs });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -104,7 +104,8 @@ export default class GVGCity extends BaseModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static async findByConfigAndGroup(configId: number, groupKey: string) {
|
public static async findByConfigAndGroup(configId: number, groupKey: string) {
|
||||||
const cities: GVGCityType[] = await GVGCityModel.find({ configId, groupKey, hasGuard: true }).lean();
|
let cities: GVGCityType[] = await GVGCityModel.find({ configId: configId + 1, groupKey, hasGuard: true }).lean();
|
||||||
|
if(!cities || cities.length == 0) cities = await GVGCityModel.find({ configId, groupKey, hasGuard: true }).lean();
|
||||||
return cities
|
return cities
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -39,14 +39,14 @@ export default class GVGCityAreaPoint extends BaseModel {
|
|||||||
let { configId, groupKey, leagueCode, leagueName, roleId, roleName, teamCode } = team;
|
let { configId, groupKey, leagueCode, leagueName, roleId, roleName, teamCode } = team;
|
||||||
await GVGCityAreaPointModel.findOneAndUpdate({ configId, groupKey, pointId }, { $setOnInsert: { teamCode: '' }}, { upsert: true });
|
await GVGCityAreaPointModel.findOneAndUpdate({ configId, groupKey, pointId }, { $setOnInsert: { teamCode: '' }}, { upsert: true });
|
||||||
let result: GVGCityAreaPointType = await GVGCityAreaPointModel.findOneAndUpdate(
|
let result: GVGCityAreaPointType = await GVGCityAreaPointModel.findOneAndUpdate(
|
||||||
{ configId, groupKey, pointId },
|
{ configId, groupKey, pointId, teamCode: '' },
|
||||||
{ $set: { cityId, areaId, leagueCode, leagueName, roleId, roleName, teamCode } },
|
{ $set: { cityId, areaId, leagueCode, leagueName, roleId, roleName, teamCode } },
|
||||||
{ new: true }).lean();
|
{ new: true }).lean();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async leavePoint(configId: number, groupKey: string, pointId: number) {
|
public static async leavePoint(configId: number, groupKey: string, pointId: number) {
|
||||||
let result: GVGCityAreaPointType = await GVGCityAreaPointModel.findOneAndUpdate({ configId, groupKey, pointId }, { $set: { teamCode: '' }}, { new: true }).lean();
|
let result: GVGCityAreaPointType = await GVGCityAreaPointModel.findOneAndUpdate({ configId, groupKey, pointId }, { $set: { teamCode: '', roleId: '', roleName: '', leagueCode: '', leagueName: '' }}, { new: true }).lean();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -774,6 +774,7 @@ export class MyTeamInfo {
|
|||||||
head: number; // 保存头像
|
head: number; // 保存头像
|
||||||
frame: number; // 保存相框
|
frame: number; // 保存相框
|
||||||
spine: number; // 保存形象
|
spine: number; // 保存形象
|
||||||
|
lv: number;
|
||||||
lineup: {
|
lineup: {
|
||||||
actorId: number; // 武将
|
actorId: number; // 武将
|
||||||
dataId: number; // 出兵表上的位置
|
dataId: number; // 出兵表上的位置
|
||||||
@@ -788,12 +789,15 @@ export class MyTeamInfo {
|
|||||||
defenseTime: number; // 防守保护时间
|
defenseTime: number; // 防守保护时间
|
||||||
areaId: number; // 出生在的区域
|
areaId: number; // 出生在的区域
|
||||||
pointId: number;
|
pointId: number;
|
||||||
|
curTeamBreak: boolean;
|
||||||
|
|
||||||
constructor(team: GVGTeamType) {
|
constructor(team: GVGTeamType) {
|
||||||
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.frame;
|
this.frame = team.frame;
|
||||||
|
this.spine = team.spine;
|
||||||
|
this.lv = team.lv;
|
||||||
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;
|
||||||
@@ -804,5 +808,6 @@ export class MyTeamInfo {
|
|||||||
this.defenseTime = team.defenseTime;
|
this.defenseTime = team.defenseTime;
|
||||||
this.areaId = team.areaId;
|
this.areaId = team.areaId;
|
||||||
this.pointId = team.pointId;
|
this.pointId = team.pointId;
|
||||||
|
this.curTeamBreak = team.curTeamBreak;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user