🐞 fix(gvg): 添加可以不发奖励的开关
This commit is contained in:
@@ -3,7 +3,7 @@ import { GVGLeagueModel, GVGLeagueType } from "../../db/GVGLeague";
|
||||
import { GVGTeamModel, GVGTeamType, GVGTeamUpdate } from "../../db/GVGTeam";
|
||||
import { GVGCityModel, GVGCityType } from "../../db/GVGCity";
|
||||
import { gameData, getGVGBattleRankReward } from "../../pubUtils/data";
|
||||
import { GVG_AREA_TYPE, GVG_ATTACK_TYPE, GVG_BATTLE_RANK_TYPE, GVG_PERIOD, GVG_POINT_TYPE, GVG_TECH_TYPE, MAIL_TYPE, PUSH_ROUTE, REDIS_KEY, STATUS } from "../../consts";
|
||||
import { COUNTER, GVG_AREA_TYPE, GVG_ATTACK_TYPE, GVG_BATTLE_RANK_TYPE, GVG_PERIOD, GVG_POINT_TYPE, GVG_TECH_TYPE, MAIL_TYPE, PUSH_ROUTE, REDIS_KEY, STATUS } from "../../consts";
|
||||
import { getTimeFun, nowSeconds } from "../../pubUtils/timeUtil";
|
||||
import { DicGVGAreaPoint } from "../../pubUtils/dictionary/DicGVGAreaPoint";
|
||||
import { getGVGBattleData, getGVGBattleMap } from "./gvgBattleMemory";
|
||||
@@ -16,7 +16,7 @@ import { pinus } from "pinus";
|
||||
import { dispatch } from "../../pubUtils/dispatcher";
|
||||
import { Rank } from "../rankService";
|
||||
import { KeyNameParam, LeagueRankInfo, myIdInter, RoleRankInfo } from "../../domain/rank";
|
||||
import { findKeys, getAllServerName } from "../redisService";
|
||||
import { findKeys, getAllServerName, redisClient } from "../redisService";
|
||||
import { sendMessageToGVGAreaByTeamWithSuc, sendMessageToGVGAreaWithSuc, sendMessageToGVGCityWithSuc, sendMessageToUserWithSuc } from "../pushService";
|
||||
import { sendMailByContent, sendMailToLeagueByContent } from "../mailService";
|
||||
import { GVGCityAreaPointModel } from "../../db/GVGCityAreaPoint";
|
||||
@@ -28,6 +28,7 @@ import { getRandSingleEelm } from "../../pubUtils/util";
|
||||
import { HeroModel, HeroType } from "../../db/Hero";
|
||||
import { ArtifactModel } from "../../db/Artifact";
|
||||
import { getHeroesAttributes } from "../playerCeService";
|
||||
import { CounterModel } from "../../db/Counter";
|
||||
|
||||
/**
|
||||
* 获取本联军上周占领的城池
|
||||
@@ -520,9 +521,9 @@ export async function gvgBattleSeconds() {
|
||||
export async function gvgBattleEnd() {
|
||||
console.log('######### gvgBattleEnd #######')
|
||||
let { configId } = getGVGConfig();
|
||||
|
||||
let dontSendReward = await redisClient().getAsync(REDIS_KEY.GVG_SEND_REWARD) == 'true';
|
||||
// 城池占领情况
|
||||
await calCityGuard(configId);
|
||||
await calCityGuard(configId, dontSendReward);
|
||||
|
||||
// 联军排行榜发放奖励
|
||||
let leagueKeys = await findKeys(`${REDIS_KEY.GVG_BATTLE_LEAGUE_RANK}:${configId}:`);
|
||||
@@ -534,7 +535,7 @@ export async function gvgBattleEnd() {
|
||||
for(let _obj of ranks) {
|
||||
let obj = <LeagueRankInfo>_obj;
|
||||
let dicRank = getGVGBattleRankReward(GVG_BATTLE_RANK_TYPE.LEAGUE, obj.rank);
|
||||
await sendMailToLeagueByContent(MAIL_TYPE.GVG_BATTLE_LEAGUE_RANK_REWARD, obj.code, { params: [`${obj.rank}`], goods: dicRank.reward });
|
||||
await sendMailToLeagueByContent(MAIL_TYPE.GVG_BATTLE_LEAGUE_RANK_REWARD, obj.code, { params: [`${obj.rank}`], goods: dicRank.reward }, null, dontSendReward);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -548,7 +549,7 @@ export async function gvgBattleEnd() {
|
||||
for(let _obj of ranks) {
|
||||
let obj = <RoleRankInfo>_obj;
|
||||
let dicRank = getGVGBattleRankReward(GVG_BATTLE_RANK_TYPE.PLAYER, obj.rank);
|
||||
await sendMailByContent(MAIL_TYPE.GVG_BATTLE_PLAYER_RANK_REWARD, obj.roleId, { params: [`${obj.rank}`], goods: dicRank.reward });
|
||||
await sendMailByContent(MAIL_TYPE.GVG_BATTLE_PLAYER_RANK_REWARD, obj.roleId, { params: [`${obj.rank}`], goods: dicRank.reward }, dontSendReward);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -558,7 +559,7 @@ interface SortCities { cityType: number, cityId: number, index: number, league:
|
||||
interface RankAndLastLeague { ranks: LeagueRankInfo[], lastLeague: string };
|
||||
|
||||
// 赛期末结算守城
|
||||
export async function calCityGuard(configId: number) {
|
||||
export async function calCityGuard(configId: number, canSendReward: boolean) {
|
||||
|
||||
let sortCities = new Map<string, SortCities[]>(); // groupKey => cities
|
||||
let rankByCity = new Map<string, Map<number, RankAndLastLeague>>(); // groupKey => city => {ranks, lastLeague}
|
||||
@@ -581,7 +582,7 @@ export async function calCityGuard(configId: number) {
|
||||
if(!leagueCode) continue;
|
||||
let cnt = guardLeagueCnt.get(leagueCode)||0;
|
||||
if(cnt < GVG.GVG_CITY_OCCUPIED_NUMBER) {
|
||||
await addGuardCity(configId, groupKey, cityId, leagueCode);
|
||||
await addGuardCity(configId, groupKey, cityId, leagueCode, canSendReward);
|
||||
guardLeagueCnt.set(leagueCode, cnt + 1);
|
||||
cityResult.push(cityId);
|
||||
}
|
||||
@@ -647,14 +648,13 @@ async function generateData(configId: number, sortCities: Map<string, SortCities
|
||||
}
|
||||
}
|
||||
|
||||
async function addGuardCity(configId: number, groupKey: string, cityId: number, leagueCode: string) {
|
||||
console.log('####### addGuardCity', configId, groupKey, cityId, leagueCode)
|
||||
async function addGuardCity(configId: number, groupKey: string, cityId: number, leagueCode: string, canSendReward: boolean) {
|
||||
let dicCity = gameData.gvgCity.get(cityId);
|
||||
let dicCityAdd = gameData.gvgCityAdd.get(dicCity.cityType);
|
||||
let league = await GVGLeagueModel.findByCodeWithoutPopulate(leagueCode);
|
||||
if(!league) return;
|
||||
await GVGCityModel.guardCity(configId, groupKey, cityId, league);
|
||||
await sendMailToLeagueByContent(MAIL_TYPE.GVG_GUARD_CITY_REWARD, leagueCode, { params: [dicCity.cityName], goods: dicCityAdd.occupyReward }, league);
|
||||
await sendMailToLeagueByContent(MAIL_TYPE.GVG_GUARD_CITY_REWARD, leagueCode, { params: [dicCity.cityName], goods: dicCityAdd.occupyReward }, league, canSendReward);
|
||||
await addCityGuardMessage(league, cityId);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user