🐞 fix(gvg): 修复gvg显示问题
This commit is contained in:
@@ -9,6 +9,7 @@ import { RoleModel } from '../../../db/Role';
|
||||
import { getFriendRelationType } from '../../../services/friendService';
|
||||
import { GVGLeagueModel } from '../../../db/GVGLeague';
|
||||
import { getGroupIdOfServer } from '../../../services/gvg/gvgService';
|
||||
import { getGuildCodeString } from '../../../services/gvg/gvgRecService';
|
||||
|
||||
|
||||
export default function (app: Application) {
|
||||
@@ -35,7 +36,7 @@ export class ChatHandler {
|
||||
const guildCode = session.get('guildCode');
|
||||
|
||||
const sid = session.get('sid');
|
||||
let channelId = '';
|
||||
let channelId = '', otherInfo = '';
|
||||
if (channel === CHANNEL_PREFIX.WORLD) channelId = `${serverId}`;
|
||||
if (channel === CHANNEL_PREFIX.GUILD) channelId = guildCode;
|
||||
if (channel === CHANNEL_PREFIX.GVG) {
|
||||
@@ -46,8 +47,9 @@ export class ChatHandler {
|
||||
let myLeague = await GVGLeagueModel.findLeagueByGuild(guildCode);
|
||||
if(!myLeague) return resResult(STATUS.GVG_NOT_JOIN_LEAGUE);
|
||||
channelId = myLeague.leagueCode;
|
||||
otherInfo = getGuildCodeString(myLeague);
|
||||
}
|
||||
const msgData = await createGroupMsg(roleId, roleName, channel, channelId, type, MSG_SOURCE.ROLE_SEND_TEXT, content, targetRoleId, targetMsgCode);
|
||||
const msgData = await createGroupMsg(roleId, roleName, channel, channelId, type, MSG_SOURCE.ROLE_SEND_TEXT, content, targetRoleId, targetMsgCode, otherInfo);
|
||||
if (!msgData) return resResult(STATUS.WRONG_PARMS);
|
||||
await pushGroupMsgToRoom(msgData);
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import { GVGCityModel } from '../../../db/GVGCity';
|
||||
import { Application, BackendSession, ChannelService, HandlerService, pinus } from "pinus";
|
||||
import { resResult, genCode } from "../../../pubUtils/util";
|
||||
import { GVGLeagueModel } from '../../../db/GVGLeague';
|
||||
import { getGroupKey, getGVGConfig, getGVGPeriodData } from '../../../services/gvg/gvgService';
|
||||
import { getGroupKey, getGVGConfig, getGVGPeriodData, getGVGServerType } from '../../../services/gvg/gvgService';
|
||||
import { redisAddBattleScore, battleEndSendMessage, calBattleScoreByCe, checkAreaIsInCity, checkGVGBattleStart, checkMoveStatus, getBattleRanksByCity, getBirthAreaOfCity, getGVGWarId, getOppHeroes, getTechKnifeHurt, getTechReviveMinus, initRobots, pushTeamMoveMessage, getGVGCitiesInfo, leaveCity } from '../../../services/gvg/gvgBattleService';
|
||||
import { getGVGBattleData } from '../../../services/gvg/gvgBattleMemory';
|
||||
import { GVGBattleRecModel } from '../../../db/GVGBattleRec';
|
||||
@@ -214,7 +214,7 @@ export class GVGBattleHandler {
|
||||
teamObj.enterCity(...teams);
|
||||
}
|
||||
|
||||
const recs = await GVGRecModel.findBattleRecByCity(configId, groupKey, cityId);
|
||||
// const recs = await GVGRecModel.findBattleRecByCity(configId, groupKey, cityId);
|
||||
const teamResult = teams.map(team => new MyTeamInfo(team));
|
||||
const { ranks, myRank } = await getBattleRanksByCity(configId, groupKey, cityId, myLeague);
|
||||
await leaveGVGCityTeamChannel(roleId, sid);
|
||||
@@ -223,7 +223,7 @@ export class GVGBattleHandler {
|
||||
return resResult(STATUS.SUCCESS, {
|
||||
cityId,
|
||||
ranks, myRank,
|
||||
recs,
|
||||
recs: [],
|
||||
teams: teamResult,
|
||||
});
|
||||
}
|
||||
@@ -624,12 +624,14 @@ export class GVGBattleHandler {
|
||||
|
||||
let { configId } = getGVGPeriodData();
|
||||
let groupKey = await getGroupKey(serverId);
|
||||
let serverType = await getGVGServerType(serverId);
|
||||
|
||||
const cities = await GVGCityModel.findByConfig(configId, groupKey);
|
||||
const points = await GVGCityAreaPointModel.findByConfig(configId, groupKey);
|
||||
|
||||
let result: { cityId: number, guardLeagueName: string, areas: { areaId: number, points: { pointId: number, guardLeagueName: string }[] }[] }[] = [];
|
||||
for(let [ cityId, { areaIds }] of gameData.gvgCity) {
|
||||
for(let [ cityId, { mapType, areaIds }] of gameData.gvgCity) {
|
||||
if(mapType != serverType) continue;
|
||||
let areas: { areaId: number, points: {pointId: number, guardLeagueName: string }[]}[] = [];
|
||||
for(let areaId of areaIds) {
|
||||
let dicArea = gameData.gvgArea.get(areaId);
|
||||
|
||||
@@ -20,9 +20,10 @@ import { GVGUserTaskModel } from "../../db/GVGUserTask";
|
||||
import { getMyAuth } from "./gvgTeamService";
|
||||
import { pick } from "underscore";
|
||||
import { calFighterContribute, calProducerContribute } from "./gvgPrepareService";
|
||||
import { calVestigeLeagueBoxRewards } from "./gvgFightService";
|
||||
import { calVestigeLeagueBoxRewards, getFightTimeByPeriod } from "./gvgFightService";
|
||||
import { GVGVestigeLeagueRankModel } from "../../db/GVGVestigeLeagueRank";
|
||||
import { GVGVestigeSumRankModel } from "../../db/GVGVestigeSumRank";
|
||||
import { GVGTeamModel } from "../../db/GVGTeam";
|
||||
|
||||
// 定时器相关
|
||||
export async function createNewGVGConfig() {
|
||||
@@ -213,6 +214,7 @@ export async function getGVGInfoInGuild(roleId: string, guild: GuildType) {
|
||||
let hasLeague = !!guild.leagueCode;
|
||||
let serverId = guild.serverId;
|
||||
let { configId, period, countdownTime } = getGVGPeriodData();
|
||||
let { startFightTime, endFightTime } = getFightTimeByPeriod(period);
|
||||
let type = await getGVGServerType(serverId);
|
||||
|
||||
if(hasLeague && configId > 0) {
|
||||
@@ -223,11 +225,14 @@ export async function getGVGInfoInGuild(roleId: string, guild: GuildType) {
|
||||
applyCnt: await getApplyCnt(guild.leagueCode),
|
||||
...await getMainData(roleId, guild.leagueCode, configId, period, countdownTime, type),
|
||||
leagueDetailRank: await getLeagueRankBox(configId, guild.leagueCode, roleId),
|
||||
myTeamCnt: await GVGTeamModel.getTeamCntByRole(roleId),
|
||||
startFightTime, endFightTime
|
||||
}
|
||||
} else {
|
||||
return {
|
||||
hasLeague,
|
||||
configId, period, countdownTime,
|
||||
startFightTime, endFightTime,
|
||||
type,
|
||||
invitationCnt: await getInviteCnt(guild.code)
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ export default class GVGCity extends BaseModel {
|
||||
// 查询联军驻守情况
|
||||
public static async findGuardCity(configId: number, groupKey: string, select = '') {
|
||||
let cities: GVGCityType[] = await GVGCityModel.find({ configId: configId + 1, groupKey, hasGuard: true }).select(select).lean();
|
||||
if(cities) cities = await GVGCityModel.find({ configId, groupKey }).select(select).lean();
|
||||
if(cities.length <= 0) cities = await GVGCityModel.find({ configId, groupKey }).select(select).lean();
|
||||
return cities
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,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, cityName: string }>();
|
||||
export const dicGVGCity = new Map<number, { cityType: number, mapType: number, areaIds: number[], defenseBirth: number, attackBirth: number, cityName: string }>();
|
||||
export function loadGVGArea() {
|
||||
dicGVGArea.clear();
|
||||
dicGVGCity.clear();
|
||||
@@ -35,7 +35,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, cityName: o.cityName });
|
||||
dicGVGCity.set(o.cityId, { cityType: o.cityType, mapType: o.mapType, 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,7 +1,7 @@
|
||||
// GVG城池
|
||||
import { FILENAME } from '../../consts'
|
||||
import { RewardInter } from '../interface';
|
||||
import { readFileAndParse } from '../util'
|
||||
import { parseGoodStr, readFileAndParse } from '../util'
|
||||
|
||||
export interface DicGVGCityAdd {
|
||||
// 城池类型 1-大城 2-中城 3-小城
|
||||
@@ -22,6 +22,7 @@ export function loadGVGCityAdd() {
|
||||
|
||||
let arr = readFileAndParse(FILENAME.DIC_GVG_CITY_ADD);
|
||||
arr.forEach(o => {
|
||||
o.occupyReward = parseGoodStr(o.occupyReward);
|
||||
dicGVGCityAdd.set(o.cityType, o);
|
||||
});
|
||||
arr = undefined;
|
||||
|
||||
Reference in New Issue
Block a user