✨ feat(gvg): 激战期数据补充、排行榜等
This commit is contained in:
@@ -7,7 +7,7 @@ import { Application, BackendSession, ChannelService, HandlerService, pinus } fr
|
||||
import { resResult, genCode } from "../../../pubUtils/util";
|
||||
import { GVGLeagueModel } from '../../../db/GVGLeague';
|
||||
import { checkGVGPeriod, getGroupIdOfServer, getGVGConfig, getGVGPeriodData, getGVGServerType } from '../../../services/gvg/gvgService';
|
||||
import { addBattleRankScore, battleEndSendMessage, calBattleScoreByCe, checkAreaIsInCity, checkGVGBattleStart, checkMoveStatus, getBattleRanks, getBirthAreaOfCity, getGVGWarId, getOppHeroes, getTechKnifeHurt, getTechReviveMinus, initRobots, pushTeamMoveMessage } from '../../../services/gvg/gvgBattleService';
|
||||
import { redisAddBattleScore, battleEndSendMessage, calBattleScoreByCe, checkAreaIsInCity, checkGVGBattleStart, checkMoveStatus, getBattleRanksByCity, getBirthAreaOfCity, getGVGWarId, getOppHeroes, getTechKnifeHurt, getTechReviveMinus, initRobots, pushTeamMoveMessage, getGVGCitiesInfo } 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, ITEM_CHANGE_REASON, STATUS } from '../../../consts';
|
||||
import { GVG_AREA_TYPE, GVG_ITEM, ITEM_CHANGE_REASON, REDIS_KEY, STATUS } from '../../../consts';
|
||||
import { GVGHeroInfo } from '../../../domain/dbGeneral';
|
||||
import { ArtifactModel } from '../../../db/Artifact';
|
||||
import { getHeroesAttributes } from '../../../services/playerCeService';
|
||||
@@ -25,6 +25,8 @@ import { GVGUserItemModel } from '../../../db/GVGUserItem';
|
||||
import { handleGVGCost } from '../../../services/gvg/gvgItemService';
|
||||
import { getGoldObject, handleCost } from '../../../services/role/rewardService';
|
||||
import { GVGCityAreaPointModel } from '../../../db/GVGCityAreaPoint';
|
||||
import { Rank } from '../../../services/rankService';
|
||||
import { LeagueRankInfo, RoleRankInfo } from '../../../domain/rank';
|
||||
|
||||
export default function (app: Application) {
|
||||
new HandlerService(app, {});
|
||||
@@ -108,16 +110,20 @@ export class GVGBattleHandler {
|
||||
|
||||
// 获取城池信息
|
||||
async getCity(msg: { cityId: number }, session: BackendSession) {
|
||||
const serverId = session.get('serverId');
|
||||
const guildCode = session.get('guildCode');
|
||||
const { cityId } = msg;
|
||||
let { configId, period } = getGVGPeriodData();
|
||||
let { startFightTime, endFightTime } = getFightTimeByPeriod(period);
|
||||
|
||||
let groupId = await getGroupIdOfServer(serverId);
|
||||
let serverType = await getGVGServerType(serverId);
|
||||
|
||||
let myLeague = await GVGLeagueModel.findLeagueByGuild(guildCode);
|
||||
if(!myLeague) return resResult(STATUS.GVG_LEAGUE_NOT_EXIST);
|
||||
|
||||
const city = await GVGCityModel.findOne({ configId, cityId }).lean();
|
||||
const { guardLeague: leagueCode = '', guardLeagueName: name = '', guardLeagueIcon: icon = 0, players } = city;
|
||||
const city = await GVGCityModel.findByCityId(configId, groupId, serverType, cityId);
|
||||
const { guardLeague: leagueCode = '', guardLeagueName: name = '', guardLeagueIcon: icon = 0, players = [] } = city||{};
|
||||
|
||||
let ourTeamCnt = 0, oppTeamCnt = 0;
|
||||
for(let { leagueCode, teamCnt } of players) {
|
||||
@@ -206,7 +212,7 @@ export class GVGBattleHandler {
|
||||
|
||||
const recs = await GVGRecModel.findByCity(cityId, configId);
|
||||
const teamResult = teams.map(team => new MyTeamInfo(team));
|
||||
const { ranks, myRank } = await getBattleRanks(configId, groupId, serverType, cityId, myLeague);
|
||||
const { ranks, myRank } = await getBattleRanksByCity(configId, groupId, serverType, cityId, myLeague);
|
||||
await leaveGVGCityTeamChannel(roleId, sid);
|
||||
await addRoleToGVGCityChannel(roleId, groupId, serverType, cityId, sid);
|
||||
|
||||
@@ -492,7 +498,8 @@ export class GVGBattleHandler {
|
||||
}
|
||||
if(defenseTeam.curTeamBreak) {
|
||||
let attackScore = calBattleScoreByCe(isSuccess, defenseTeam.lineupCe);
|
||||
await addBattleRankScore(attackTeam, attackScore);
|
||||
attackTeam = await GVGTeamModel.addScore(attackTeam.teamCode, attackScore, 0);
|
||||
await redisAddBattleScore(attackTeam, attackScore);
|
||||
}
|
||||
|
||||
// 更新内存
|
||||
@@ -547,7 +554,7 @@ export class GVGBattleHandler {
|
||||
}
|
||||
if(defenseTeam.curTeamBreak) {
|
||||
let attackScore = calBattleScoreByCe(true, defenseTeam.lineupCe);
|
||||
await addBattleRankScore(attackTeam, attackScore);
|
||||
await redisAddBattleScore(attackTeam, attackScore);
|
||||
}
|
||||
|
||||
// 更新内存
|
||||
@@ -643,6 +650,33 @@ export class GVGBattleHandler {
|
||||
return resResult(STATUS.SUCCESS, { cities: result });
|
||||
}
|
||||
|
||||
// 排行榜
|
||||
async getRanks(msg: {}, session: BackendSession) {
|
||||
const serverId = session.get('serverId');
|
||||
|
||||
let { configId } = getGVGPeriodData();
|
||||
let groupId = await getGroupIdOfServer(serverId);
|
||||
let serverType = await getGVGServerType(serverId);
|
||||
|
||||
let cities = await getGVGCitiesInfo(configId, groupId, serverType);
|
||||
|
||||
let r = new Rank(REDIS_KEY.GVG_BATTLE_LEAGUE_RANK, { configId, groupId, serverType });
|
||||
let leagueRanksRaw = await r.getRankByRange();
|
||||
let leagueRanks = leagueRanksRaw.map(obj => {
|
||||
if(obj instanceof LeagueRankInfo) return { rank: obj.rank, name: obj.name, score: obj.num }
|
||||
});
|
||||
|
||||
let r2 = new Rank(REDIS_KEY.GVG_BATTLE_RANK, { configId, groupId, serverType });
|
||||
let memberRanksRaw = await r2.getRankByRange();
|
||||
let memberRanks = memberRanksRaw.map(obj => {
|
||||
if(obj instanceof RoleRankInfo) return { rank: obj.rank, name: obj.roleName, score: obj.num }
|
||||
})
|
||||
|
||||
return resResult(STATUS.SUCCESS, {
|
||||
cities, leagueRanks, memberRanks
|
||||
})
|
||||
}
|
||||
|
||||
async debugStartSchedule() {
|
||||
await pinus.app.rpc.systimer.systimerRemote.gvgBattleStartSchedule.broadcast();
|
||||
return resResult(STATUS.SUCCESS);
|
||||
|
||||
@@ -23,33 +23,42 @@ import { GVGCityAreaPointModel } from "../../db/GVGCityAreaPoint";
|
||||
|
||||
|
||||
/**
|
||||
* TODO 检查上周是否有占领城池
|
||||
* 检查上周是否有占领城池
|
||||
* @param league
|
||||
* @returns boolean 是否占领
|
||||
*/
|
||||
export async function checkHasCities(league: GVGLeagueType) {
|
||||
return false
|
||||
let { configId } = getGVGConfig();
|
||||
return await GVGCityModel.checkLeagueHasGuard(configId, league.leagueCode);
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO 获取本联军上周占领的城池
|
||||
* 获取本联军上周占领的城池
|
||||
* @param league
|
||||
* @returns number[] 城池id
|
||||
*/
|
||||
export async function getGVGCities(league: GVGLeagueType) {
|
||||
return []
|
||||
let { configId } = getGVGConfig();
|
||||
let cities = await GVGCityModel.findGuardCityByLeague(configId, league.leagueCode, 'cityId');
|
||||
return cities.map(city => city.cityId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前城池状态
|
||||
* @returns [{cityId: number, guardLeagueCode: string, guardLeagueName: string, teamCnt: number }]
|
||||
*/
|
||||
export async function getGVGCitiesInfo(configId: number, groupId: number, serverType: number, league: GVGLeagueType): Promise<{cityId: number, guardLeagueName: string, teamCnt: number }[]> {
|
||||
let cities = await GVGCityModel.findGuardCityByLeague(configId, groupId, serverType);
|
||||
export async function getGVGCitiesInfo(configId: number, groupId: number, serverType: number, league?: GVGLeagueType) {
|
||||
let cities = await GVGCityModel.findGuardCity(configId, groupId, serverType);
|
||||
let result: GVGCityMapInfo[] = [];
|
||||
for(let city of cities) {
|
||||
let players = (city.players||[]).filter(cur => cur.leagueCode == league.leagueCode);
|
||||
let obj = new GVGCityMapInfo(city, players.length);
|
||||
let obj = new GVGCityMapInfo(city);
|
||||
if(league) {
|
||||
let players = (city.players||[]).filter(cur => cur.leagueCode == league.leagueCode);
|
||||
obj.setTeamCnt(players.length);
|
||||
let r = new Rank(REDIS_KEY.GVG_BATTLE_LEAGUE_RANK_BY_CITY, { configId, groupId, serverType });
|
||||
let score = await r.getMyScore({ leagueCode: league.leagueCode });
|
||||
obj.setScore(score||0);
|
||||
}
|
||||
result.push(obj);
|
||||
}
|
||||
return result;
|
||||
@@ -262,21 +271,29 @@ export async function catapultHurt() {
|
||||
}
|
||||
}
|
||||
|
||||
// 排行榜积分更新
|
||||
export async function addBattleRankScore(gvgTeam: GVGTeamType, incScore: number) {
|
||||
let { configId, groupId, serverType, cityId, roleId, leagueCode, isRobot } = gvgTeam;
|
||||
// 战斗积分更新
|
||||
export async function redisAddBattleScore(gvgTeam: GVGTeamType, incScore: number) {
|
||||
let { configId, groupId, serverType, cityId, roleId, isRobot } = gvgTeam;
|
||||
if(isRobot) return;
|
||||
|
||||
let r1 = new Rank(REDIS_KEY.GVG_BATTLE_RANK, { configId, groupId, serverType, cityId });
|
||||
r1.setRankWithRoleInfo(roleId, incScore, Date.now(), null, true);
|
||||
let r = new Rank(REDIS_KEY.GVG_BATTLE_RANK, { configId, groupId, serverType, cityId });
|
||||
r.setRankWithRoleInfo(roleId, incScore, Date.now(), null, true);
|
||||
}
|
||||
|
||||
let r2 = new Rank(REDIS_KEY.GVG_BATTLE_LEAGUE_RANK, { configId, groupId, serverType, cityId });
|
||||
export async function redisAddSettleScore(gvgTeam: GVGTeamType, incScore: number) {
|
||||
let { configId, groupId, serverType, cityId, leagueCode, isRobot } = gvgTeam;
|
||||
if(isRobot) return;
|
||||
|
||||
let r1 = new Rank(REDIS_KEY.GVG_BATTLE_LEAGUE_RANK, { configId, groupId, serverType });
|
||||
r1.setRankWithLeagueInfo(leagueCode, incScore, Date.now(), null, true);
|
||||
|
||||
let r2 = new Rank(REDIS_KEY.GVG_BATTLE_LEAGUE_RANK_BY_CITY, { configId, groupId, serverType, cityId });
|
||||
r2.setRankWithLeagueInfo(leagueCode, incScore, Date.now(), null, true);
|
||||
}
|
||||
|
||||
// 获取排行榜
|
||||
export async function getBattleRanks(configId: number, groupId: number, serverType: number, cityId: number, myLeague: GVGLeagueType) {
|
||||
let r = new Rank(REDIS_KEY.GVG_BATTLE_LEAGUE_RANK, { configId, groupId, serverType, cityId });
|
||||
export async function getBattleRanksByCity(configId: number, groupId: number, serverType: number, cityId: number, myLeague: GVGLeagueType) {
|
||||
let r = new Rank(REDIS_KEY.GVG_BATTLE_LEAGUE_RANK_BY_CITY, { configId, groupId, serverType, cityId });
|
||||
r.setGenerFieldsFun((obj => {
|
||||
if(obj instanceof LeagueRankInfo) {
|
||||
return { rank: obj.rank, leagueCode: obj.code, leagueName: obj.name, score: obj.num }
|
||||
@@ -302,8 +319,8 @@ export async function gvgBattleSeconds() {
|
||||
for(let teamMem of teams) {
|
||||
if(teamMem.isBroken || teamMem.durability <= 0) continue;
|
||||
let addScore = gameData.gvgAreaPoint.get(teamMem.pointId)?.score||0;
|
||||
let team = await GVGTeamModel.addScore(teamMem.teamCode, addScore);
|
||||
await addBattleRankScore(team, addScore);
|
||||
let team = await GVGTeamModel.addScore(teamMem.teamCode, 0, addScore);
|
||||
await redisAddSettleScore(team, addScore);
|
||||
}
|
||||
// 向下推送区域数据
|
||||
for(let areaId of teamObj.findAreas()) {
|
||||
@@ -319,7 +336,7 @@ export async function gvgBattleSeconds() {
|
||||
}
|
||||
|
||||
for(let { groupId, serverType, cityId } of keys) {
|
||||
let r = new Rank(REDIS_KEY.GVG_BATTLE_LEAGUE_RANK, { configId, groupId, serverType, cityId });
|
||||
let r = new Rank(REDIS_KEY.GVG_BATTLE_LEAGUE_RANK_BY_CITY, { configId, groupId, serverType, cityId });
|
||||
let rawRanks = await r.getRankByRange();
|
||||
let ranks = rawRanks.map(obj => {
|
||||
if(obj instanceof LeagueRankInfo) {
|
||||
@@ -338,25 +355,41 @@ export async function gvgBattleEnd() {
|
||||
let guardLeagueCnt = new Map<string, number>();
|
||||
|
||||
// 城池占领情况
|
||||
let keys = await findKeys(`${REDIS_KEY.GVG_BATTLE_LEAGUE_RANK}:${configId}:`);
|
||||
let keys = await findKeys(`${REDIS_KEY.GVG_BATTLE_LEAGUE_RANK_BY_CITY}:${configId}:`);
|
||||
let rankKeys = keys.map(key => {
|
||||
let [,, _groupId, _serverType, _cityId] = key.split(':');
|
||||
return { groupId: parseInt(_groupId), serverType: parseInt(_serverType), cityId: parseInt(_cityId) };
|
||||
}).sort((a, b) => b.cityId - a.cityId);
|
||||
|
||||
for(let { groupId, serverType, cityId } of rankKeys) {
|
||||
let r = new Rank(REDIS_KEY.GVG_BATTLE_LEAGUE_RANK, { configId, groupId, serverType, cityId });
|
||||
let dicCity = gameData.gvgCity.get(cityId);
|
||||
if(!dicCity) continue;
|
||||
|
||||
let r = new Rank(REDIS_KEY.GVG_BATTLE_LEAGUE_RANK_BY_CITY, { configId, groupId, serverType, cityId });
|
||||
let ranks = await r.getRankByRange();
|
||||
// 排名最高占领城池
|
||||
for(let obj of ranks) {
|
||||
let rank = <LeagueRankInfo>obj;
|
||||
let cnt = guardLeagueCnt.get(rank.code)||0;
|
||||
let rankInfo = <LeagueRankInfo>obj;
|
||||
let cnt = guardLeagueCnt.get(rankInfo.code)||0;
|
||||
if(cnt < GVG.GVG_CITY_OCCUPIED_NUMBER) {
|
||||
await GVGCityModel.guardCity(configId, groupId, serverType, cityId, rank);
|
||||
guardLeagueCnt.set(rank.code, cnt + 1);
|
||||
await GVGCityModel.guardCity(configId, groupId, serverType, cityId, rankInfo);
|
||||
let dicCityAdd = gameData.gvgCityAdd.get(dicCity.cityType);
|
||||
await sendMailToLeagueByContent(MAIL_TYPE.GVG_GUARD_CITY_REWARD, rankInfo.code, { params: [dicCity.cityName], goods: dicCityAdd.occupyReward });
|
||||
guardLeagueCnt.set(rankInfo.code, cnt + 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 联军排行榜发放奖励
|
||||
let leagueKeys = await findKeys(`${REDIS_KEY.GVG_BATTLE_LEAGUE_RANK}:${configId}:`);
|
||||
for(let key of leagueKeys) {
|
||||
let [,, _groupId, _serverType] = key.split(':');
|
||||
let groupId = parseInt(_groupId);
|
||||
let serverType = parseInt(_serverType);
|
||||
|
||||
let r = new Rank(REDIS_KEY.GVG_BATTLE_LEAGUE_RANK, { configId, groupId, serverType });
|
||||
let ranks = await r.getRankByRange();
|
||||
// 联军排行榜发放奖励
|
||||
for(let _obj of ranks) {
|
||||
let obj = <LeagueRankInfo>_obj;
|
||||
@@ -368,11 +401,10 @@ export async function gvgBattleEnd() {
|
||||
// 个人排行榜发放奖励
|
||||
let playerKeys = await findKeys(`${REDIS_KEY.GVG_BATTLE_RANK}:${configId}:`);
|
||||
for(let key of playerKeys) {
|
||||
let [,, _groupId, _serverType, _cityId] = key.split(':');
|
||||
let [,, _groupId, _serverType] = key.split(':');
|
||||
let groupId = parseInt(_groupId);
|
||||
let serverType = parseInt(_serverType);
|
||||
let cityId = parseInt(_cityId);
|
||||
let r = new Rank(REDIS_KEY.GVG_BATTLE_LEAGUE_RANK, { configId, groupId, serverType, cityId });
|
||||
let r = new Rank(REDIS_KEY.GVG_BATTLE_RANK, { configId, groupId, serverType });
|
||||
let ranks = await r.getRankByRange();
|
||||
|
||||
for(let _obj of ranks) {
|
||||
|
||||
@@ -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激战期玩家进入的城池
|
||||
|
||||
@@ -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