✨ feat(gvg): 激战期数据补充、排行榜等
This commit is contained in:
@@ -68,6 +68,7 @@ export enum MAIL_TYPE {
|
||||
HELP_HARVEST = 38, // 帮收
|
||||
GVG_BATTLE_LEAGUE_RANK_REWARD = 39, // 激战期联军排行榜奖励
|
||||
GVG_BATTLE_PLAYER_RANK_REWARD = 40, // 激战期个人排行榜奖励
|
||||
GVG_GUARD_CITY_REWARD = 41, // 激战期城池占领奖励
|
||||
};
|
||||
|
||||
export const SEND_NAME = '系统';
|
||||
|
||||
@@ -261,6 +261,7 @@ export enum REDIS_KEY {
|
||||
LEAGUE_INFO ="leagueInfo", // 联军信息
|
||||
GVG_BATTLE_RANK ="gvgBattleUsr", // 激战期个人排行榜
|
||||
GVG_BATTLE_LEAGUE_RANK = "gvgBattleLeague", // 激战期联军排行榜
|
||||
GVG_BATTLE_LEAGUE_RANK_BY_CITY = "gvgBattleLeagueByCity", // 激战期联军排行榜
|
||||
GVG_HISTORY_AREA ='gvgHisArea', // gvg激战期玩家加入的区域
|
||||
GVG_HISTORY_AREA_TEAM ='gvgHisAreaTeam', // gvg激战期玩家加入的区域
|
||||
GVG_HISTORY_CITY ='gvgHisCity', // gvg激战期玩家进入的城池
|
||||
|
||||
+14
-2
@@ -63,8 +63,20 @@ export default class GVGCity extends BaseModel {
|
||||
}
|
||||
|
||||
// 查询联军驻守情况
|
||||
public static async findGuardCityByLeague(configId: number, groupId: number, serverType: number, ) {
|
||||
const cities: GVGCityType[] = await GVGCityModel.find({ configId, groupId, serverType, hasGuard: true }).lean();
|
||||
public static async findGuardCityByLeague(configId: number, leagueCode: string, select = '') {
|
||||
const cities: GVGCityType[] = await GVGCityModel.find({ configId, guardLeague: leagueCode, hasGuard: true }).select(select).lean();
|
||||
return cities
|
||||
}
|
||||
|
||||
// 查询联军驻守情况
|
||||
public static async checkLeagueHasGuard(configId: number, leagueCode: string) {
|
||||
return await GVGCityModel.exists({ configId, guardLeague: leagueCode, hasGuard: true });
|
||||
}
|
||||
|
||||
// 查询联军驻守情况
|
||||
public static async findGuardCity(configId: number, groupId: number, serverType: number, select = '') {
|
||||
let cities: GVGCityType[] = await GVGCityModel.find({ configId: configId + 1, groupId, serverType, hasGuard: true }).select(select).lean();
|
||||
if(cities.length == 0) cities = await GVGCityModel.find({ configId, groupId, serverType, hasGuard: true }).select(select).lean();
|
||||
return cities
|
||||
}
|
||||
|
||||
|
||||
@@ -93,7 +93,10 @@ export default class GVGTeam extends BaseModel {
|
||||
defenseTime: number; // 防守保护时间
|
||||
|
||||
@prop({ required: true, default: 0 })
|
||||
score: number; // 积分
|
||||
battleScore: number; // 积分
|
||||
|
||||
@prop({ required: true, default: 0 })
|
||||
settleScore: number; // 积分
|
||||
|
||||
@prop({ required: true, type: () => GVGHeroInfo, _id: false })
|
||||
lineup: GVGHeroInfo[];
|
||||
@@ -336,8 +339,8 @@ export default class GVGTeam extends BaseModel {
|
||||
}
|
||||
|
||||
// 加积分
|
||||
public static async addScore(teamCode: string, incScore: number) {
|
||||
let team: GVGTeamType = await GVGTeamModel.findOneAndUpdate({ teamCode }, { $inc: { score: incScore } }, { new: true }).lean();
|
||||
public static async addScore(teamCode: string, battleScore: number, settleScore: number) {
|
||||
let team: GVGTeamType = await GVGTeamModel.findOneAndUpdate({ teamCode }, { $inc: { battleScore, settleScore } }, { new: true }).lean();
|
||||
return team;
|
||||
}
|
||||
|
||||
|
||||
@@ -604,16 +604,24 @@ export class GVGCityMapInfo {
|
||||
guardLeagueCode: string; // 驻守城池的联军id
|
||||
guardLeagueName: string; // 驻守这个城池的联军
|
||||
guardLeagueIcon: number; // 驻守这个城池的联军的icon
|
||||
teamCnt: number; // 我方队伍数量
|
||||
teamCnt: number; // 我方人数
|
||||
score: number;
|
||||
|
||||
constructor(city: GVGCityType, teamCnt: number) {
|
||||
constructor(city: GVGCityType) {
|
||||
if(!city) return;
|
||||
this.cityId = city.cityId;
|
||||
this.guardLeagueCode = city.guardLeague;
|
||||
this.guardLeagueName = city.guardLeagueName;
|
||||
this.guardLeagueIcon = city.guardLeagueIcon;
|
||||
}
|
||||
|
||||
setTeamCnt(teamCnt: number) {
|
||||
this.teamCnt = teamCnt;
|
||||
}
|
||||
|
||||
setScore(score: number) {
|
||||
this.score = score;
|
||||
}
|
||||
}
|
||||
|
||||
export class GVGTeamSpineInMap {
|
||||
|
||||
@@ -421,8 +421,10 @@ export class KeyName {
|
||||
case REDIS_KEY.GVG_VESTIGE_LEAGUE:
|
||||
return `${this.key}:${this.day}:${this.groupId}:${this.serverType}`;
|
||||
case REDIS_KEY.GVG_BATTLE_RANK:
|
||||
return `${this.key}:${this.configId}:${this.groupId}:${this.serverType}:${this.cityId}`;
|
||||
return `${this.key}:${this.configId}:${this.groupId}:${this.serverType}`;
|
||||
case REDIS_KEY.GVG_BATTLE_LEAGUE_RANK:
|
||||
return `${this.key}:${this.configId}:${this.groupId}:${this.serverType}`;
|
||||
case REDIS_KEY.GVG_BATTLE_LEAGUE_RANK_BY_CITY:
|
||||
return `${this.key}:${this.configId}:${this.groupId}:${this.serverType}:${this.cityId}`;
|
||||
default:
|
||||
return this.key;
|
||||
|
||||
@@ -13,6 +13,8 @@ export interface DicGVGArea {
|
||||
readonly cityId: number;
|
||||
// 城池类型
|
||||
readonly cityType: number;
|
||||
// 城池名字
|
||||
readonly cityName: string;
|
||||
// 区域类型 1-守方备战区 2-攻方备战区 3-大据点区 4-中据点区 5-小据点区 6-投石车区
|
||||
readonly areaType: number;
|
||||
// 区域管理
|
||||
@@ -22,7 +24,7 @@ export interface DicGVGArea {
|
||||
}
|
||||
|
||||
export const dicGVGArea = new Map<number, DicGVGArea>();
|
||||
export const dicGVGCity = new Map<number, { cityType: number, areaIds: number[], defenseBirth: number, attackBirth: number }>();
|
||||
export const dicGVGCity = new Map<number, { cityType: number, areaIds: number[], defenseBirth: number, attackBirth: number, cityName: string }>();
|
||||
export function loadGVGArea() {
|
||||
dicGVGArea.clear();
|
||||
dicGVGCity.clear();
|
||||
@@ -31,7 +33,7 @@ export function loadGVGArea() {
|
||||
arr.forEach(o => {
|
||||
o.relateArea = parseNumberList(o.relateArea);
|
||||
if(!dicGVGCity.has(o.cityId)) {
|
||||
dicGVGCity.set(o.cityId, { cityType: o.cityType, areaIds: [], defenseBirth: 0, attackBirth: 0 });
|
||||
dicGVGCity.set(o.cityId, { cityType: o.cityType, areaIds: [], defenseBirth: 0, attackBirth: 0, cityName: o.cityName });
|
||||
}
|
||||
dicGVGCity.get(o.cityId)?.areaIds.push(o.areaId);
|
||||
if(o.areaType == 1) dicGVGCity.get(o.cityId).defenseBirth = o.areaId;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
// GVG城池
|
||||
import { FILENAME } from '../../consts'
|
||||
import { RewardInter } from '../interface';
|
||||
import { readFileAndParse } from '../util'
|
||||
|
||||
export interface DicGVGCityAdd {
|
||||
@@ -11,6 +12,8 @@ export interface DicGVGCityAdd {
|
||||
readonly mineralAdd: number;
|
||||
// 木头加成
|
||||
readonly woodAdd: number;
|
||||
// 占领积分
|
||||
readonly occupyReward: RewardInter[];
|
||||
}
|
||||
|
||||
export const dicGVGCityAdd = new Map<number, DicGVGCityAdd>();
|
||||
|
||||
@@ -269,7 +269,7 @@
|
||||
"id": 38,
|
||||
"title": "&",
|
||||
"sendName": "学宫驿使",
|
||||
"content": "亲爱的百家传人,联军伙伴们已帮忙收取您在领地农田中的成熟粮食,您的种植奖励已发送至邮箱,请查收",
|
||||
"content": "亲爱的百家传人,联军伙伴们已帮忙收取您在领地农田中的成熟粮食,种植奖励中的军团功勋奖励已发送至邮箱,请查收",
|
||||
"time": 720
|
||||
},
|
||||
{
|
||||
@@ -285,5 +285,12 @@
|
||||
"sendName": "学宫驿使",
|
||||
"content": "亲爱的百家传人,逐鹿中原激战期内,您为联军做出重要贡献,荣获第%d名,奖励现已发送至邮箱,请查收",
|
||||
"time": 720
|
||||
},
|
||||
{
|
||||
"id": 41,
|
||||
"title": "&",
|
||||
"sendName": "学宫驿使",
|
||||
"content": "亲爱的百家传人,逐鹿中原激战期已结束,您的联军锐不可当成功占领%d,占领奖励现已发送至邮箱,请查收",
|
||||
"time": 720
|
||||
}
|
||||
]
|
||||
Reference in New Issue
Block a user