✨ feat(gvg): 进驻积分点
This commit is contained in:
@@ -372,6 +372,12 @@ export const STATUS = {
|
||||
GVG_LOCK_TIME_OUT: { code: 21410, simStr: '挑战超时' },
|
||||
GVG_ATTACK_TEAM_BROKEN: { code: 21411, simStr: '挑战队伍已被击破' },
|
||||
GVG_DEFENSE_TEAM_BROKEN: { code: 21411, simStr: '对方队伍已被击破' },
|
||||
GVG_BATTLEREC_HAS_SUMMIT: { code: 21412, simStr: '该记录已结算过' },
|
||||
GVG_TEAM_IS_NOT_MINE: { code: 21413, simStr: '您不可操作此队伍' },
|
||||
GVG_SAME_LEAGUE_CANNOT_ATTACK: { code: 21414, simStr: '您不可攻击友军' },
|
||||
GVG_TEAM_NOT_SAME_AREA: { code: 21415, simStr: '对方不在同一个区域内' },
|
||||
GVG_POINT_HAS_SETTLED: { code: 21416, simStr: '该据点已经有其他队伍驻守' },
|
||||
GVG_POINT_NOT_AREA: { code: 21417, simStr: '您不在该积分点所在区域' },
|
||||
|
||||
// 通用 30000 - 30099
|
||||
DIC_DATA_NOT_FOUND: { code: 30000, simStr: '数据表未找到' },
|
||||
|
||||
@@ -52,6 +52,15 @@ export default class GVGBattleRec extends BaseModel {
|
||||
@prop({ required: true })
|
||||
battleCode: string; // 战斗记录
|
||||
|
||||
@prop({ required: true })
|
||||
configId: number; // 赛季
|
||||
|
||||
@prop({ required: true })
|
||||
groupId: number; // 战区
|
||||
|
||||
@prop({ required: true })
|
||||
serverType: number; // 1-单服 2-跨服
|
||||
|
||||
@prop({ required: true })
|
||||
warId: number; // 关卡id
|
||||
|
||||
@@ -67,9 +76,9 @@ export default class GVGBattleRec extends BaseModel {
|
||||
@prop({ required: true })
|
||||
battleEndTime: number;
|
||||
|
||||
public static async createRec(warId: number, attackTeam: GVGTeamType, defenseTeam: GVGTeamType) {
|
||||
public static async createRec(configId: number, groupId: number, serverType: number, warId: number, attackTeam: GVGTeamType, defenseTeam: GVGTeamType) {
|
||||
const battleCode = genCode(8);
|
||||
const result: GVGBattleRecType = await GVGBattleRecModel.findOneAndUpdate({ battleCode }, { $set: { warId, attackTeam, defenseTeam, isSuccess: false } }, { new: true, upsert: true }).lean();
|
||||
const result: GVGBattleRecType = await GVGBattleRecModel.findOneAndUpdate({ battleCode }, { $set: { configId, groupId, serverType, warId, attackTeam, defenseTeam, isSuccess: false } }, { new: true, upsert: true }).lean();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ export default class GVGTeam extends BaseModel {
|
||||
lockTime: number; // 正在被进攻中
|
||||
|
||||
@prop({ required: true, default: 0 })
|
||||
attackTeam: string; // 正在被这支队伍进攻中
|
||||
lockTeamCode: string; // 正在被这支队伍进攻中
|
||||
|
||||
@prop({ required: true, default: 0 })
|
||||
fromAreaId: number; // 从那个区域移动
|
||||
@@ -207,8 +207,14 @@ export default class GVGTeam extends BaseModel {
|
||||
}
|
||||
|
||||
// 防守方锁定cd
|
||||
public static async battleStartLockDefense(teamCode: string, attackTeam: string) {
|
||||
const team: GVGTeamType = await GVGTeamModel.findOneAndUpdate({ teamCode }, { $set: { lockTime: nowSeconds() + GVG.GVG_DEFAULT_ATTACK_CD, attackTeam } }, { new: true }).lean();
|
||||
public static async battleStartLockDefense(teamCode: string, lockTeamCode: string) {
|
||||
const team: GVGTeamType = await GVGTeamModel.findOneAndUpdate({ teamCode }, { $set: { lockTime: nowSeconds() + GVG.GVG_DEFAULT_ATTACK_CD, lockTeamCode } }, { new: true }).lean();
|
||||
return team;
|
||||
}
|
||||
|
||||
// 占领积分点
|
||||
public static async settlePoint(teamCode: string, pointId: number) {
|
||||
const team: GVGTeamType = await GVGTeamModel.findOneAndUpdate({ teamCode }, { $set: { pointId } }, { new: true }).lean();
|
||||
return team;
|
||||
}
|
||||
|
||||
@@ -220,7 +226,7 @@ export default class GVGTeam extends BaseModel {
|
||||
|
||||
// 结算防守方
|
||||
public static async battleEndDefense(teamCode: string, hpInc: number, playerScoreInc: number) {
|
||||
const team: GVGTeamType = await GVGTeamModel.findOneAndUpdate({ teamCode }, { $set: { defenseTime: nowSeconds() + GVG.GVG_DEFAULT_DEFENSE_CD }, $inc: { durability: hpInc, playerScore: playerScoreInc } }, { new: true }).lean();
|
||||
const team: GVGTeamType = await GVGTeamModel.findOneAndUpdate({ teamCode }, { $set: { defenseTime: nowSeconds() + GVG.GVG_DEFAULT_DEFENSE_CD, lockTime: 0, lockTeamCode: '' }, $inc: { durability: hpInc, playerScore: playerScoreInc } }, { new: true }).lean();
|
||||
return team;
|
||||
}
|
||||
|
||||
@@ -244,6 +250,12 @@ export default class GVGTeam extends BaseModel {
|
||||
const team: GVGTeamType[] = await GVGTeamModel.find({ configId, cityId: { $gt: 0 } }).lean();
|
||||
return team;
|
||||
}
|
||||
|
||||
// 这个编队上是否已经有队伍了
|
||||
public static async checkPoint(configId: number, groupId: number, serverType: number, pointId: number) {
|
||||
return await GVGTeamModel.exists({ configId, groupId, serverType, pointId });
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import { gameData } from "../../pubUtils/data";
|
||||
import { EXTERIOR, GVG } from "../../pubUtils/dicParam";
|
||||
import { DicGVGVestige } from "../../pubUtils/dictionary/DicGVGVestige";
|
||||
import { DicWarJson } from "../../pubUtils/dictionary/DicWarJson";
|
||||
import { GVGHeroInfo, PvpHeroInfo } from "../dbGeneral";
|
||||
import { GVGHeroInfo } from "../dbGeneral";
|
||||
import { LineupHero } from "../roleField/hero";
|
||||
|
||||
export class OppPlayerHeroInfo {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
|
||||
import { prop } from 'typegoose';
|
||||
import { prop } from '@typegoose/typegoose';
|
||||
import { ArtifactModelType } from '../../db/Artifact';
|
||||
import { Connect, EPlace, HeroSkin, HeroType, HeroUpdate, Talent } from '../../db/Hero';
|
||||
import { JewelSe, JewelType, RandSe } from '../../db/Jewel';
|
||||
|
||||
@@ -1219,7 +1219,7 @@ export function getGVGBattleRankReward(type: number, rank: number) {
|
||||
function parseGVGDurabilityMinus() {
|
||||
const range = parseNumberList(param.GVG.GVG_DEFAULT_DURABILITY_MINUS);
|
||||
gameData.gvgBattleDurabilityMinus.win = range[0];
|
||||
gameData.gvgBattleDurabilityMinus.fail = range[0];
|
||||
gameData.gvgBattleDurabilityMinus.fail = range[1];
|
||||
}
|
||||
|
||||
function parseGVGTeamDurability() {
|
||||
|
||||
Reference in New Issue
Block a user