🐞 fix(gvg): 激战期推送相关修改
This commit is contained in:
@@ -49,7 +49,8 @@ export default class GVGCity extends BaseModel {
|
||||
|
||||
// 添加人数
|
||||
public static async increasePlayer(configId: number, groupKey: string, cityId: number, roleId: string, leagueCode: string, teamCnt: number) {
|
||||
const city: GVGCityType = await GVGCityModel.findOneAndUpdate({ configId, groupKey, cityId, userCnt: { $lt: 200 } }, { $inc: { userCnt: 1 }, $push: { players: { roleId, leagueCode, teamCnt } }}, { new: true, upsert: true }).lean();
|
||||
await GVGCityModel.findOneAndUpdate({ configId, groupKey, cityId }, { $setOnInsert: { userCnt: 0, players: [] } }, { upsert: true }).lean()
|
||||
const city: GVGCityType = await GVGCityModel.findOneAndUpdate({ configId, groupKey, cityId, userCnt: { $lt: 200 } }, { $inc: { userCnt: 1 }, $push: { players: { roleId, leagueCode, teamCnt } }}, { new: true }).lean();
|
||||
return city;
|
||||
}
|
||||
|
||||
@@ -98,7 +99,7 @@ export default class GVGCity extends BaseModel {
|
||||
public static async guardCity(configId: number, groupKey: string, cityId: number, league: LeagueRankInfo) {
|
||||
const city: GVGCityType = await GVGCityModel.findOneAndUpdate({ configId: configId + 1, cityId, groupKey }, { $set: {
|
||||
hasGuard: true, guardLeague: league.code, guardLeagueName: league.name, guardLeagueIcon: league.icon
|
||||
} }, { upsert: true, new: true }).lean();
|
||||
}, $setOnInsert: { userCnt: 0, players: [] } }, { upsert: true, new: true }).lean();
|
||||
return city;
|
||||
}
|
||||
|
||||
|
||||
@@ -282,7 +282,7 @@ export default class GVGTeam extends BaseModel {
|
||||
|
||||
// 结算防守方
|
||||
public static async battleEndDefense(teamCode: string, hpInc: number, rebirthAreaId: number, reviveCd: number) {
|
||||
let team: GVGTeamType = await GVGTeamModel.findOneAndUpdate({ teamCode }, { $set: { defenseTime: nowSeconds() + GVG.GVG_DEFAULT_DEFENSE_CD, lockTime: 0, lockTeamCode: '' }, $inc: { durability: hpInc } }, { new: true }).lean();
|
||||
let team: GVGTeamType = await GVGTeamModel.findOneAndUpdate({ teamCode }, { $set: { defenseTime: nowSeconds() + GVG.GVG_DEFAULT_DEFENSE_CD, lockTime: 0, lockTeamCode: '' }, $inc: { durability: -hpInc } }, { new: true }).lean();
|
||||
if(team.durability <= 0) {
|
||||
let originPointId = team.pointId;
|
||||
team = await GVGTeamModel.teamBreak(teamCode, team.isRobot, team.maxDurability, rebirthAreaId, team.areaId, reviveCd);
|
||||
@@ -294,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, pointId: 0 } }, { 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, pointId: 0, durability: 0, isBroken: true } }, { new: true }).lean();
|
||||
const team: GVGTeamType = await GVGTeamModel.findOneAndUpdate({ teamCode }, { $set: { fromAreaId, durability: 0, isBroken: true } }, { new: true }).lean();
|
||||
team.curTeamBreak = true;
|
||||
return team;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user