✨ feat(gvg): 保存阵容、刷新对手、战报
This commit is contained in:
@@ -34,6 +34,7 @@ export const WAR_TYPE = {
|
||||
TRY: 19, // 试用关卡
|
||||
BOSS: 20, // 演武台
|
||||
LADDER: 21, // 名将擂台
|
||||
GVG_VESTIGE: 22, // GVG征战中原
|
||||
};
|
||||
|
||||
// 藏宝图掉落参数
|
||||
|
||||
@@ -579,6 +579,7 @@ export const FILENAME = {
|
||||
DIC_GVG_VESTIGE: 'dic_zyz_GVGVestige',
|
||||
DIC_GVG_VESTIGE_RANGE: 'dic_zyz_GVGVestigeRange',
|
||||
DIC_GVG_VESTIGE_LEAGUE_RANK: 'dic_zyz_GVGVestigeLeagueRank',
|
||||
DIC_GK_GVG_VESTIGE: 'dic_zyz_gk_GVGVestige',
|
||||
}
|
||||
|
||||
export const WAR_RELATE_TABLES = [
|
||||
@@ -602,6 +603,7 @@ export const WAR_RELATE_TABLES = [
|
||||
FILENAME.DIC_GK_ARMY_BOSS,
|
||||
FILENAME.DIC_GK_LADDER,
|
||||
FILENAME.DIC_GK_BRANCH_ELITE,
|
||||
FILENAME.DIC_GK_GVG_VESTIGE,
|
||||
]
|
||||
|
||||
// 装备栏强化类型
|
||||
|
||||
@@ -346,6 +346,7 @@ export const STATUS = {
|
||||
GVG_VESTIGE_HERO_USED: { code: 21364, simStr: '该武将在其他遗迹已使用' },
|
||||
GVG_VESTIGE_BATTLE_END_STATUS_ERR: { code: 21365, simStr: '挑战时间超时' },
|
||||
GVG_VESTIGE_RANK_NOT_INIT: { code: 21366, simStr: '玩家数据未初始' },
|
||||
GVG_VESTIGE_REFESH_CNT_MAX: { code: 21367, simStr: '遗迹刷新次数不足' },
|
||||
|
||||
// 通用 30000 - 30099
|
||||
DIC_DATA_NOT_FOUND: { code: 30000, simStr: '数据表未找到' },
|
||||
|
||||
@@ -135,6 +135,13 @@ export default class GVGVestigeRank extends BaseModel {
|
||||
session.endSession()
|
||||
}
|
||||
}
|
||||
|
||||
public static async refreshOpp(roleId: string, vestigeId: number, oppRanks: number[]) {
|
||||
let today = getZeroPoint();
|
||||
let result: GVGVestigeRankType = await GVGVestigeRankModel.findOneAndUpdate({ day: today, vestigeId, roleId }, { $set: { oppRanks }, $inc: { refreshCnt: 1 } }, { new: true, upsert: true }).lean();
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export const GVGVestigeRankModel = getModelForClass(GVGVestigeRank);
|
||||
|
||||
@@ -3,6 +3,7 @@ import BaseModel from './BaseModel';
|
||||
import { index, getModelForClass, prop, DocumentType } from '@typegoose/typegoose';
|
||||
import { OppPlayerInfo, OppPlayerHeroInfo } from '../domain/gvgField/gvgDb';
|
||||
import { genCode } from '../pubUtils/util';
|
||||
import { getTimeFunD } from '../pubUtils/timeUtil';
|
||||
|
||||
class LeagueGood {
|
||||
@prop({ required: true })
|
||||
@@ -16,7 +17,7 @@ class LeagueGood {
|
||||
}
|
||||
|
||||
@index({ battleCode: 1 })
|
||||
@index({ day: 1, groupId: 1, vestigeId: 1, rank: 1 })
|
||||
@index({ groupId: 1, vestigeId: 1, rank: 1 })
|
||||
export default class GVGVestigeRec extends BaseModel {
|
||||
|
||||
@prop({ required: true })
|
||||
@@ -74,14 +75,16 @@ export default class GVGVestigeRec extends BaseModel {
|
||||
return result;
|
||||
}
|
||||
|
||||
public static async startBattle(battleCode: string, attackHeroes: OppPlayerHeroInfo[]) {
|
||||
public static async startBattle(battleCode: string, attackHeroes: OppPlayerHeroInfo[], ce: number) {
|
||||
const result: GVGVestigeRecType = await GVGVestigeRecModel.findOneAndUpdate({ battleCode }, {
|
||||
$set: { battleTime: Date.now(), 'attackInfo.heroes': attackHeroes }
|
||||
$set: { battleTime: Date.now(), 'attackInfo.heroes': attackHeroes, 'attackInfo.ce': ce }
|
||||
}, { new: true }).lean();
|
||||
return result;
|
||||
}
|
||||
|
||||
public static async battleEnd(battleCode: string, isSuccess: boolean, endTime: number, atkNewRank?: number, defNewRank?: number) {
|
||||
console.log('battleEnd', battleCode, isSuccess, endTime, atkNewRank, defNewRank)
|
||||
|
||||
let update: GVGVestigeRecUpdate = { endTime };
|
||||
if(isSuccess) {
|
||||
update['attackInfo.isSuccess'] = true;
|
||||
@@ -99,9 +102,23 @@ export default class GVGVestigeRec extends BaseModel {
|
||||
}
|
||||
|
||||
public static async giveup(roleId: string, battleCode: string) {
|
||||
const result: GVGVestigeRecType = await GVGVestigeRecModel.findOneAndUpdate({ attackRoleId: roleId, battleCode }, { $set: { cancel: true }}, { new: true }).lean();
|
||||
const result: GVGVestigeRecType = await GVGVestigeRecModel.findOneAndUpdate({ attackRoleId: roleId, battleCode }, { $set: { cancel: true, endTime: Date.now() }}, { new: true }).lean();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
public static async updateRplStatus(battleCode: string, hasRpl: boolean) {
|
||||
let result: GVGVestigeRecType = await GVGVestigeRecModel.findOneAndUpdate({ battleCode }, { hasRpl }, { new: true }).lean();
|
||||
return result;
|
||||
}
|
||||
|
||||
public static async findRec(roleId: string, vestigeId: number) {
|
||||
let recs: GVGVestigeRecType[] = await GVGVestigeRecModel.find({
|
||||
vestigeId, $or: [{attackRoleId: roleId}, { defenseRoleId: roleId }],
|
||||
createdAt: { $gte: <Date>getTimeFunD().getBeforeDayWithHour(3) },
|
||||
}).select({ battleCode: 1, attackRoleId: 1, defenseRoleId: 1, _id: 0, endTime: 1, attackInfo: 1, defenseInfo: 1, hasRpl: 1 }).limit(1000).lean();
|
||||
return recs;
|
||||
}
|
||||
}
|
||||
|
||||
export const GVGVestigeRecModel = getModelForClass(GVGVestigeRec);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { prop } from "@typegoose/typegoose";
|
||||
import { ArtifactModelType } from "../../db/Artifact";
|
||||
import { GVGVestigeRecType } from "../../db/GVGVestigeRec";
|
||||
import { HeroType, Talent } from "../../db/Hero";
|
||||
import { RoleType } from "../../db/Role";
|
||||
import { gameData } from "../../pubUtils/data";
|
||||
@@ -203,9 +204,23 @@ export class OppDetailHeroData {
|
||||
}
|
||||
|
||||
export class OppDetailData{
|
||||
roleId: string; // 对手的id
|
||||
isRobot: boolean;
|
||||
vestigeId: number;
|
||||
battleCode: string;
|
||||
status: number;
|
||||
time: number;
|
||||
heroes: OppDetailHeroData[] = [];
|
||||
lineupCe: number = 0;
|
||||
|
||||
constructor(rec: GVGVestigeRecType, obj: {status: number, time: number}) {
|
||||
this.vestigeId = rec.vestigeId;
|
||||
this.battleCode = rec.battleCode;
|
||||
this.roleId = rec.defenseRoleId;
|
||||
this.isRobot = rec.defenseInfo.isRobot;
|
||||
this.status = obj.status;
|
||||
this.time = obj.time;
|
||||
}
|
||||
|
||||
setByPlayer(dicWarJson: DicWarJson[], defenseHeroes: OppPlayerHeroInfo[], heroes: HeroType[], artifacts: ArtifactModelType[]) {
|
||||
for(let warJson of dicWarJson) {
|
||||
|
||||
@@ -77,6 +77,9 @@ export class GVGMainData {
|
||||
// 内政相关
|
||||
resources: LeagueResource = new LeagueResource(); // 联盟的物资
|
||||
activeTech: number[] = []; // 已激活了的科技树的id
|
||||
maxMemberCnt: number; // 进入备战期总玩家人数
|
||||
producerCnt: number; // 贤臣人数
|
||||
fighterCnt: number; // 猛将人数
|
||||
|
||||
sumTime: number = 0; // 今日贡献结算时间 10位时间戳
|
||||
|
||||
@@ -109,6 +112,9 @@ export class GVGMainData {
|
||||
this.lv = leaguePrepare.lv;
|
||||
this.resources = leaguePrepare.resources;
|
||||
this.activeTech = leaguePrepare.activeTech||[];
|
||||
this.maxMemberCnt = leaguePrepare.maxMemberCnt;
|
||||
this.producerCnt = leaguePrepare.producerCnt;
|
||||
this.fighterCnt = leaguePrepare.fighterCnt;
|
||||
}
|
||||
|
||||
setPlayerInfo(userData: GVGUserDataType, auth: number, canPrepare: boolean, canChooseJob: boolean, items: GVGItem[], tasks: GVGTask[]) {
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
[
|
||||
{
|
||||
"id": 1,
|
||||
"name": "小麦",
|
||||
"name": "菽豆",
|
||||
"quality": 1,
|
||||
"type": 1,
|
||||
"refreshType": 1,
|
||||
"image_id": "&",
|
||||
"image_id": "shudou",
|
||||
"info": "&",
|
||||
"consume": "&",
|
||||
"leagueConsume": "10&1",
|
||||
@@ -17,10 +18,11 @@
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"name": "玉米",
|
||||
"name": "粟米",
|
||||
"quality": 2,
|
||||
"type": 1,
|
||||
"refreshType": 1,
|
||||
"image_id": "&",
|
||||
"image_id": "sumi",
|
||||
"info": "&",
|
||||
"consume": "31002&100",
|
||||
"leagueConsume": "10&1",
|
||||
@@ -34,9 +36,10 @@
|
||||
{
|
||||
"id": 3,
|
||||
"name": "水稻",
|
||||
"quality": 3,
|
||||
"type": 1,
|
||||
"refreshType": 1,
|
||||
"image_id": "&",
|
||||
"image_id": "shuidao",
|
||||
"info": "&",
|
||||
"consume": "31002&200",
|
||||
"leagueConsume": "10&1",
|
||||
@@ -50,9 +53,10 @@
|
||||
{
|
||||
"id": 4,
|
||||
"name": "普通铲子",
|
||||
"quality": 1,
|
||||
"type": 2,
|
||||
"refreshType": 1,
|
||||
"image_id": "&",
|
||||
"image_id": "putongchanzi",
|
||||
"info": "&",
|
||||
"consume": "&",
|
||||
"leagueConsume": "10&2",
|
||||
@@ -66,9 +70,10 @@
|
||||
{
|
||||
"id": 5,
|
||||
"name": "中级铲子",
|
||||
"quality": 2,
|
||||
"type": 2,
|
||||
"refreshType": 1,
|
||||
"image_id": "&",
|
||||
"image_id": "zhongjichanzi",
|
||||
"info": "&",
|
||||
"consume": "31002&100",
|
||||
"leagueConsume": "10&2",
|
||||
@@ -82,9 +87,10 @@
|
||||
{
|
||||
"id": 6,
|
||||
"name": "高级铲子",
|
||||
"quality": 3,
|
||||
"type": 2,
|
||||
"refreshType": 1,
|
||||
"image_id": "&",
|
||||
"image_id": "gaojichanzi",
|
||||
"info": "&",
|
||||
"consume": "31002&200",
|
||||
"leagueConsume": "10&2",
|
||||
@@ -98,9 +104,10 @@
|
||||
{
|
||||
"id": 7,
|
||||
"name": "石斧",
|
||||
"quality": 1,
|
||||
"type": 3,
|
||||
"refreshType": 1,
|
||||
"image_id": "&",
|
||||
"image_id": "shifu",
|
||||
"info": "&",
|
||||
"consume": "&",
|
||||
"leagueConsume": "10&2",
|
||||
@@ -114,9 +121,10 @@
|
||||
{
|
||||
"id": 8,
|
||||
"name": "铜斧",
|
||||
"quality": 2,
|
||||
"type": 3,
|
||||
"refreshType": 1,
|
||||
"image_id": "&",
|
||||
"image_id": "tongfu",
|
||||
"info": "&",
|
||||
"consume": "31002&100",
|
||||
"leagueConsume": "10&2",
|
||||
@@ -130,9 +138,10 @@
|
||||
{
|
||||
"id": 9,
|
||||
"name": "铁斧",
|
||||
"quality": 3,
|
||||
"type": 3,
|
||||
"refreshType": 1,
|
||||
"image_id": "&",
|
||||
"image_id": "tiefu",
|
||||
"info": "&",
|
||||
"consume": "31002&200",
|
||||
"leagueConsume": "10&2",
|
||||
@@ -146,9 +155,10 @@
|
||||
{
|
||||
"id": 10,
|
||||
"name": "内政令",
|
||||
"quality": 3,
|
||||
"type": 4,
|
||||
"refreshType": 2,
|
||||
"image_id": "&",
|
||||
"image_id": "neizhengling",
|
||||
"info": "&",
|
||||
"consume": "&",
|
||||
"leagueConsume": "&",
|
||||
@@ -162,9 +172,10 @@
|
||||
{
|
||||
"id": 11,
|
||||
"name": "征战令",
|
||||
"quality": 3,
|
||||
"type": 4,
|
||||
"refreshType": 2,
|
||||
"image_id": "&",
|
||||
"image_id": "zhengzhanling",
|
||||
"info": "&",
|
||||
"consume": "&",
|
||||
"leagueConsume": "&",
|
||||
@@ -178,9 +189,10 @@
|
||||
{
|
||||
"id": 12,
|
||||
"name": "战功",
|
||||
"quality": 3,
|
||||
"type": 5,
|
||||
"refreshType": 2,
|
||||
"image_id": "&",
|
||||
"image_id": "zhangong",
|
||||
"info": "&",
|
||||
"consume": "&",
|
||||
"leagueConsume": "&",
|
||||
@@ -194,9 +206,10 @@
|
||||
{
|
||||
"id": 13,
|
||||
"name": "复活令",
|
||||
"quality": 3,
|
||||
"type": 6,
|
||||
"refreshType": 2,
|
||||
"image_id": "&",
|
||||
"image_id": "fuhuoling",
|
||||
"info": "&",
|
||||
"consume": "&",
|
||||
"leagueConsume": "&",
|
||||
@@ -209,10 +222,11 @@
|
||||
},
|
||||
{
|
||||
"id": 14,
|
||||
"name": "匕首",
|
||||
"name": "诸葛连弩",
|
||||
"quality": 3,
|
||||
"type": 6,
|
||||
"refreshType": 2,
|
||||
"image_id": "&",
|
||||
"image_id": "zhugeliannu",
|
||||
"info": "&",
|
||||
"consume": "&",
|
||||
"leagueConsume": "&",
|
||||
@@ -225,10 +239,11 @@
|
||||
},
|
||||
{
|
||||
"id": 15,
|
||||
"name": "箭塔",
|
||||
"name": "攻城车",
|
||||
"quality": 3,
|
||||
"type": 6,
|
||||
"refreshType": 2,
|
||||
"image_id": "&",
|
||||
"image_id": "gongchengche",
|
||||
"info": "&",
|
||||
"consume": "&",
|
||||
"leagueConsume": "&",
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
6752
shared/resource/jsons/dic_zyz_gk_GVGVestige.json
Normal file
6752
shared/resource/jsons/dic_zyz_gk_GVGVestige.json
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user