🐞 fix(gvg): 修复队伍进出城池内存更新
This commit is contained in:
@@ -2,12 +2,12 @@ import { GVGRecModel, GVGRecType } from '../../../db/GVGRec';
|
||||
import { GVGAreaInMap, GVGTeamInList, GVGTeamInListOnPoint, GVGTeamSpineInMap, LeagueGood, MyTeamInfo, MyTeamSimpleInfo } from '../../../domain/gvgField/returnData';
|
||||
import { GVGTeamModel, GVGTeamType, GVGTeamUpdate } from '../../../db/GVGTeam';
|
||||
import { GVGUserDataModel } from '../../../db/GVGUserData';
|
||||
import { GVGCityModel } from '../../../db/GVGCity';
|
||||
import { GVGCityModel, GVGCityType } from '../../../db/GVGCity';
|
||||
import { Application, BackendSession, ChannelService, HandlerService, pinus } from "pinus";
|
||||
import { resResult, genCode } from "../../../pubUtils/util";
|
||||
import { GVGLeagueModel } from '../../../db/GVGLeague';
|
||||
import { getGroupKey, getGVGConfig, getGVGPeriodData, getGVGServerType } from '../../../services/gvg/gvgService';
|
||||
import { redisAddBattleScore, battleEndSendMessage, calBattleScoreByCe, checkAreaIsInCity, checkGVGBattleStart, checkMoveStatus, getBattleRanksByCity, getBirthAreaOfCity, getGVGWarId, getOppHeroes, getTechKnifeHurt, getTechReviveMinus, initRobots, pushTeamMoveMessage, getGVGCitiesInfo, leaveCity } from '../../../services/gvg/gvgBattleService';
|
||||
import { redisAddBattleScore, battleEndSendMessage, calBattleScoreByCe, checkAreaIsInCity, checkGVGBattleStart, checkMoveStatus, getBattleRanksByCity, getBirthAreaOfCity, getGVGWarId, getOppHeroes, getTechKnifeHurt, getTechReviveMinus, initRobots, pushTeamMoveMessage, getGVGCitiesInfo, leaveCity, refreshTeams } from '../../../services/gvg/gvgBattleService';
|
||||
import { getGVGBattleData } from '../../../services/gvg/gvgBattleMemory';
|
||||
import { GVGBattleRecModel } from '../../../db/GVGBattleRec';
|
||||
import { getFightTimeByPeriod } from '../../../services/gvg/gvgFightService';
|
||||
@@ -15,7 +15,7 @@ import { gameData, getReviveGold } from '../../../pubUtils/data';
|
||||
import { getAllServerName } from '../../../services/redisService';
|
||||
import { checkBattleHeroesByHid } from '../../../services/normalBattleService';
|
||||
import { SaveTeamParam, SaveTeamUpdateParam } from '../../../domain/gvgField/gvgDb';
|
||||
import { GVG_AREA_TYPE, GVG_ITEM, GVG_REC_TYPE, ITEM_CHANGE_REASON, REDIS_KEY, STATUS } from '../../../consts';
|
||||
import { GVG_AREA_TYPE, GVG_ITEM, GVG_PERIOD, GVG_REC_TYPE, ITEM_CHANGE_REASON, REDIS_KEY, STATUS } from '../../../consts';
|
||||
import { GVGHeroInfo } from '../../../domain/dbGeneral';
|
||||
import { ArtifactModel } from '../../../db/Artifact';
|
||||
import { getHeroesAttributes } from '../../../services/playerCeService';
|
||||
@@ -65,7 +65,7 @@ export class GVGBattleHandler {
|
||||
const { cityId, index, head, spine, frame, lineup } = msg;
|
||||
|
||||
let { configId, period } = getGVGPeriodData();
|
||||
// if (period != GVG_PERIOD.BATTLE) return resResult(STATUS.GVG_NOT_BATTLE_PERIOD); // TODO 测试临时注
|
||||
if (period != GVG_PERIOD.BATTLE) return resResult(STATUS.GVG_NOT_BATTLE_PERIOD);
|
||||
|
||||
let myLeague = await GVGLeagueModel.findLeagueByGuild(guildCode);
|
||||
if(!myLeague) return resResult(STATUS.GVG_LEAGUE_NOT_EXIST);
|
||||
@@ -130,8 +130,9 @@ export class GVGBattleHandler {
|
||||
if(!myLeague) return resResult(STATUS.GVG_LEAGUE_NOT_EXIST);
|
||||
|
||||
let groupKey = await getGroupKey(serverId);
|
||||
const city = await GVGCityModel.findByCityId(configId, groupKey, cityId);
|
||||
const { guardLeague: leagueCode = '', guardLeagueName: name = '', guardLeagueIcon: icon = 0, players = [] } = city||{};
|
||||
let guardCity = await GVGCityModel.findByCityId(configId + 1, groupKey, cityId);
|
||||
if(!guardCity) guardCity = await GVGCityModel.findByCityId(configId, groupKey, cityId);
|
||||
const { guardLeague: leagueCode = '', guardLeagueName: name = '', guardLeagueIcon: icon = 0, players = [] } = guardCity||{};
|
||||
|
||||
let ourTeamCnt = 0, oppTeamCnt = 0;
|
||||
for(let { leagueCode, teamCnt } of players) {
|
||||
@@ -176,7 +177,7 @@ export class GVGBattleHandler {
|
||||
|
||||
const { cityId } = msg;
|
||||
let { configId, period } = getGVGPeriodData();
|
||||
// if (period != GVG_PERIOD.BATTLE) return resResult(STATUS.GVG_NOT_BATTLE_PERIOD); // TODO 测试临时注
|
||||
if (period != GVG_PERIOD.BATTLE) return resResult(STATUS.GVG_NOT_BATTLE_PERIOD);
|
||||
|
||||
let groupKey = await getGroupKey(serverId);
|
||||
|
||||
@@ -185,39 +186,41 @@ export class GVGBattleHandler {
|
||||
|
||||
// 初始化本城池的守擂机器人
|
||||
await initRobots(configId, groupKey, cityId);
|
||||
|
||||
let teams = await GVGTeamModel.findByRole(roleId, '-_id');
|
||||
// 每赛季初自己的几支队伍恢复耐久、城市、顺便更新一下自己的玩家名、联军
|
||||
let updateArr: GVGTeamUpdate[] = [], originCityId = 0;
|
||||
for(let team of teams) {
|
||||
if(team.configId != configId) {
|
||||
let { teamCode, maxDurability } = team;
|
||||
updateArr.push({ teamCode, durability: maxDurability, cityId: 0, areaId: 0, pointId: 0, roleName, guildCode, leagueCode: myLeague.leagueCode, leagueName: myLeague.name, groupKey });
|
||||
}
|
||||
if(team.cityId) originCityId = team.cityId;
|
||||
}
|
||||
if(updateArr.length > 0) teams = await GVGTeamModel.refreshByConfig(roleId, updateArr);
|
||||
let teams = await refreshTeams(configId, groupKey, roleId, roleName, guildCode, myLeague);
|
||||
|
||||
let gvgUserData = await GVGUserDataModel.findByRole(configId, myLeague.leagueCode, roleId);
|
||||
let originCityId = gvgUserData?.cityId||0;
|
||||
// 检测是否已经在城池中,玩家不在这个城池中时进行处理
|
||||
let city: GVGCityType;
|
||||
if (originCityId != cityId) {
|
||||
let gvgUserData = await GVGUserDataModel.findByRole(configId, myLeague.leagueCode, roleId);
|
||||
if(gvgUserData?.cityId > 0) { // 如果leaveCity没有退出成功,玩家还遗留在上一座城中,做一下处理
|
||||
await GVGCityModel.decreasePlayerByCity(configId, groupKey, gvgUserData.cityId, roleId);
|
||||
city = await GVGCityModel.decreasePlayerByCity(configId, groupKey, gvgUserData.cityId, roleId);
|
||||
}
|
||||
const roleTeamCnt = await GVGTeamModel.getTeamCntByRole(roleId);
|
||||
let city = await GVGCityModel.increasePlayer(configId, groupKey, cityId, roleId, myLeague.leagueCode, roleTeamCnt);
|
||||
city = await GVGCityModel.increasePlayer(configId, groupKey, cityId, roleId, myLeague.leagueCode, roleTeamCnt);
|
||||
if(!city) return resResult(STATUS.GVG_BATTLE_CITY_FULL);
|
||||
|
||||
gvgUserData = await GVGUserDataModel.changeCity(configId, myLeague.leagueCode, roleId, cityId);
|
||||
}
|
||||
let teamResult: MyTeamInfo[] = [];
|
||||
for(let team of teams) { // 有可能多个编队有的在城池中(驻守),有点不在(新编)
|
||||
let originCityId = team.cityId||0;
|
||||
if(originCityId == cityId) {
|
||||
teamResult.push(new MyTeamInfo(team));
|
||||
continue;
|
||||
};
|
||||
if(!city) city = await GVGCityModel.findByCityId(configId, groupKey, cityId);
|
||||
let areaId = getBirthAreaOfCity(city, myLeague.leagueCode);
|
||||
teams = await GVGTeamModel.enterCity(roleId, cityId, areaId, groupKey);
|
||||
team = await GVGTeamModel.enterCity(team.teamCode, cityId, areaId, groupKey);
|
||||
if(!team) continue;
|
||||
// 更新内存队伍信息
|
||||
let teamObj = getGVGBattleData(groupKey);
|
||||
teamObj.enterCity(...teams);
|
||||
teamObj.enterCity(team);
|
||||
teamResult.push(new MyTeamInfo(team))
|
||||
}
|
||||
|
||||
// const recs = await GVGRecModel.findBattleRecByCity(configId, groupKey, cityId);
|
||||
const teamResult = teams.map(team => new MyTeamInfo(team));
|
||||
const { ranks, myRank } = await getBattleRanksByCity(configId, groupKey, cityId, myLeague);
|
||||
await leaveGVGCityTeamChannel(roleId, sid);
|
||||
await addRoleToGVGCityChannel(roleId, groupKey, cityId, sid);
|
||||
@@ -378,7 +381,7 @@ export class GVGBattleHandler {
|
||||
const { cityId, areaId, pointId, teamCode } = msg;
|
||||
|
||||
let { configId, period } = getGVGPeriodData();
|
||||
// if (period != GVG_PERIOD.BATTLE) return resResult(STATUS.GVG_NOT_BATTLE_PERIOD); // TODO 测试临时注
|
||||
if (period != GVG_PERIOD.BATTLE) return resResult(STATUS.GVG_NOT_BATTLE_PERIOD);
|
||||
|
||||
let groupKey = await getGroupKey(serverId);
|
||||
|
||||
@@ -407,7 +410,7 @@ export class GVGBattleHandler {
|
||||
const { pointId, teamCode } = msg;
|
||||
|
||||
let { configId, period } = getGVGPeriodData();
|
||||
// if (period != GVG_PERIOD.BATTLE) return resResult(STATUS.GVG_NOT_BATTLE_PERIOD); // TODO 测试临时注
|
||||
if (period != GVG_PERIOD.BATTLE) return resResult(STATUS.GVG_NOT_BATTLE_PERIOD);
|
||||
|
||||
let groupKey = await getGroupKey(serverId);
|
||||
|
||||
@@ -433,7 +436,7 @@ export class GVGBattleHandler {
|
||||
const { teamCode, oppoTeamCode } = msg;
|
||||
|
||||
let { configId, period } = getGVGPeriodData();
|
||||
// if (period != GVG_PERIOD.BATTLE) return resResult(STATUS.GVG_NOT_BATTLE_PERIOD); // TODO 测试临时注
|
||||
if (period != GVG_PERIOD.BATTLE) return resResult(STATUS.GVG_NOT_BATTLE_PERIOD);
|
||||
|
||||
let groupKey = await getGroupKey(serverId);
|
||||
|
||||
@@ -512,7 +515,7 @@ export class GVGBattleHandler {
|
||||
if(itemId != GVG_ITEM.KNIFE) return resResult(STATUS.GVG_ITEM_CANNOT_USE);
|
||||
|
||||
let { configId, period } = getGVGPeriodData();
|
||||
// if (period != GVG_PERIOD.BATTLE) return resResult(STATUS.GVG_NOT_BATTLE_PERIOD); // TODO 测试临时注
|
||||
if (period != GVG_PERIOD.BATTLE) return resResult(STATUS.GVG_NOT_BATTLE_PERIOD);
|
||||
|
||||
let groupKey = await getGroupKey(serverId);
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ class GVGBattleData {
|
||||
let teams: GVGTeamMem[] = [];
|
||||
for(let teamCode of teamCodes) {
|
||||
let team = this.teams.get(teamCode);
|
||||
if(team) teams.push(team);
|
||||
if(team && !team.isBroken) teams.push(team);
|
||||
}
|
||||
return teams.slice(0, 20);
|
||||
}
|
||||
@@ -90,8 +90,8 @@ class GVGBattleData {
|
||||
|
||||
private setRolePoints(roleId: string, fromPointId: number, pointId: number, teamCode: string) {
|
||||
if(fromPointId > 0 && pointId == 0) { // 被打得撤离积分点
|
||||
if(this.rolePoints.has(roleId) && this.rolePoints.get(roleId).has(pointId)) {
|
||||
this.rolePoints.get(roleId).delete(pointId);
|
||||
if(this.rolePoints.has(roleId) && this.rolePoints.get(roleId).has(fromPointId)) {
|
||||
this.rolePoints.get(roleId).delete(fromPointId);
|
||||
}
|
||||
} else if (fromPointId == 0 && pointId > 0) {
|
||||
if(!this.rolePoints.has(roleId)) this.rolePoints.set(roleId, new Map());
|
||||
|
||||
@@ -7,7 +7,7 @@ import { GVG_AREA_TYPE, GVG_BATTLE_RANK_TYPE, GVG_TECH_TYPE, MAIL_TYPE, PUSH_ROU
|
||||
import { getTimeFun, nowSeconds } from "../../pubUtils/timeUtil";
|
||||
import { DicGVGAreaPoint } from "../../pubUtils/dictionary/DicGVGAreaPoint";
|
||||
import { getGVGBattleData, getGVGBattleMap } from "./gvgBattleMemory";
|
||||
import { GVGCityMapInfo, GVGTeamInList, GVGTeamInListOnPoint, GVGTeamSpineInMap } from "../../domain/gvgField/returnData";
|
||||
import { GVGAttackSpine, GVGCityMapInfo, GVGTeamInList, GVGTeamInListOnPoint, GVGTeamSpineInMap } from "../../domain/gvgField/returnData";
|
||||
import { GVG } from "../../pubUtils/dicParam";
|
||||
import { GVGHeroInfo, PvpEnemies, PvpHeroInfo } from "../../domain/dbGeneral";
|
||||
import { getGroupKey, getGVGConfig } from "./gvgService";
|
||||
@@ -18,7 +18,7 @@ import { Rank } from "../rankService";
|
||||
import { LeagueRankInfo, RoleRankInfo } from "../../domain/rank";
|
||||
import { findKeys, getAllServerName } from "../redisService";
|
||||
import { sendMessageToGVGAreaByTeamWithSuc, sendMessageToGVGAreaWithSuc, sendMessageToGVGCityWithSuc } from "../pushService";
|
||||
import { sendMailToLeagueByContent } from "../mailService";
|
||||
import { sendMailByContent, sendMailToLeagueByContent } from "../mailService";
|
||||
import { GVGCityAreaPointModel } from "../../db/GVGCityAreaPoint";
|
||||
import { addCityGuardMessage } from "./gvgRecService";
|
||||
import { GVGUserDataModel } from "../../db/GVGUserData";
|
||||
@@ -108,7 +108,8 @@ export async function initRobots(configId: number, groupKey: string, cityId: num
|
||||
}
|
||||
}
|
||||
if(updateDicPoints.length > 0) {
|
||||
robotTeams = await GVGTeamModel.initRobots(configId, groupKey, cityId, updateDicPoints);
|
||||
let lv = gameData.war.get(GVG.GVG_ROBOT_WARJSON)?.level||50;
|
||||
robotTeams = await GVGTeamModel.initRobots(configId, groupKey, cityId, updateDicPoints, lv);
|
||||
// 存入内存
|
||||
let teamObj = getGVGBattleData(groupKey);
|
||||
teamObj.enterCity(...robotTeams);
|
||||
@@ -131,6 +132,21 @@ export function calBattleScoreByCe(isSuccess: boolean, lineupCe: number) {
|
||||
return isSuccess? winScore: 0;
|
||||
}
|
||||
|
||||
export async function refreshTeams(configId: number, groupKey: string, roleId: string, roleName: string, guildCode: string, myLeague: GVGLeagueType) {
|
||||
let oldTeams = await GVGTeamModel.findByRole(roleId, '-_id');
|
||||
let teams: GVGTeamType[] = [];
|
||||
for(let team of oldTeams) {
|
||||
if(team.configId != configId) {
|
||||
let { teamCode, maxDurability } = team;
|
||||
let newTeam = await GVGTeamModel.refreshByConfig(team.teamCode, { teamCode, durability: maxDurability, cityId: 0, areaId: 0, pointId: 0, roleName, guildCode, leagueCode: myLeague.leagueCode, leagueName: myLeague.name, groupKey });
|
||||
teams.push(newTeam);
|
||||
} else {
|
||||
teams.push(team);
|
||||
}
|
||||
}
|
||||
return teams
|
||||
}
|
||||
|
||||
export async function leaveCity(isForce: boolean, roleId: string, serverId: number, guildCode: string, myLeague?: GVGLeagueType) {
|
||||
if(!myLeague) myLeague = await GVGLeagueModel.findLeagueByGuild(guildCode);
|
||||
if(!myLeague) return;
|
||||
@@ -259,7 +275,9 @@ export async function initCatapult(cityId: number, groupKey: string, leagueCode:
|
||||
let dicArea = gameData.gvgArea.get(areaId);
|
||||
return dicArea && dicArea.areaType == GVG_AREA_TYPE.CATAPULT;
|
||||
});
|
||||
let teams = await GVGTeamModel.initCatapult(configId, groupKey, cityId, leagueCode, leagueName, areaIds, atk, durability);
|
||||
|
||||
let lv = gameData.war.get(GVG.GVG_CATAPULT_WARJSON)?.level||50;
|
||||
let teams = await GVGTeamModel.initCatapult(configId, groupKey, cityId, leagueCode, leagueName, areaIds, atk, durability, lv);
|
||||
// 处理内存
|
||||
let teamObj = getGVGBattleData(groupKey);
|
||||
teamObj.enterCity(...teams);
|
||||
@@ -279,9 +297,12 @@ export async function catapultHurt() {
|
||||
let dicGVGCity = gameData.gvgCity.get(catapult.cityId);
|
||||
let teams = await GVGTeamModel.attackByCatapult(teamCodes, catapult.captapultAtk, dicGVGCity.attackBirth);
|
||||
teamObj.battleEnd(teams);
|
||||
await sendMessageToGVGAreaByTeamWithSuc(teamObj.groupKey, catapult.areaId, PUSH_ROUTE.GVG_TEAM_ATTACKED, {
|
||||
await sendMessageToGVGAreaWithSuc(teamObj.groupKey, catapult.areaId, PUSH_ROUTE.GVG_TEAM_ATTACKED, {
|
||||
cityId: catapult.cityId, areaId: catapult.areaId, attackType: 1, teams: teams.map(team => new GVGTeamInList(team))
|
||||
});
|
||||
await sendMessageToGVGAreaByTeamWithSuc(teamObj.groupKey, catapult.areaId, PUSH_ROUTE.GVG_SPINE_ATTACKED, {
|
||||
cityId: catapult.cityId, areaId: catapult.areaId, attackType: 1, teams: teams.map(team => new GVGAttackSpine(team, catapult.captapultAtk))
|
||||
});
|
||||
for(let team of teams) {
|
||||
await pushTeamBeHurtMessage(team);
|
||||
if(team.curTeamBreak && team.originPointId > 0) {
|
||||
@@ -430,7 +451,7 @@ export async function gvgBattleEnd() {
|
||||
for(let _obj of ranks) {
|
||||
let obj = <RoleRankInfo>_obj;
|
||||
let dicRank = getGVGBattleRankReward(GVG_BATTLE_RANK_TYPE.PLAYER, obj.rank);
|
||||
await sendMailToLeagueByContent(MAIL_TYPE.GVG_BATTLE_PLAYER_RANK_REWARD, obj.roleId, { params: [`${obj.rank}`], goods: dicRank.reward });
|
||||
await sendMailByContent(MAIL_TYPE.GVG_BATTLE_PLAYER_RANK_REWARD, obj.roleId, { params: [`${obj.rank}`], goods: dicRank.reward });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@ export async function createNewGVGConfig() {
|
||||
await pinus.app.rpc.guild.guildRemote.setGVGServerGroup.broadcast();
|
||||
await pinus.app.rpc.chat.chatRemote.setGVGServerGroup.broadcast();
|
||||
await pinus.app.rpc.connector.connectorRemote.setGVGServerGroup.broadcast();
|
||||
await pinus.app.rpc.guild?.guildRemote?.clearBattleMemory.broadcast();
|
||||
} catch(e) {
|
||||
console.log('remote未初始完');
|
||||
}
|
||||
@@ -176,7 +177,6 @@ export async function initLeaguePrepare() {
|
||||
for(let { leagueCode, memberCnt } of leagues) {
|
||||
await GVGLeaguePrepareModel.initData(config.configId, leagueCode, memberCnt);
|
||||
}
|
||||
pinus.app.rpc.guild?.guildRemote?.clearBattleMemory.broadcast();
|
||||
}
|
||||
|
||||
export async function setGVGServerGroup() {
|
||||
|
||||
@@ -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 队伍在地图上受到攻击
|
||||
}
|
||||
@@ -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: '' })
|
||||
|
||||
@@ -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