|
|
|
|
@@ -8,7 +8,7 @@ import { getCurTask, getPvpTask } from './task/taskService';
|
|
|
|
|
import { RoleModel, RoleType } from '../db/Role';
|
|
|
|
|
import { Application, BackendSession, FrontendOrBackendSession, pinus, RpcClient } from 'pinus';
|
|
|
|
|
import { compareVersion, getRandEelmWithWeight, resResult } from '../pubUtils/util';
|
|
|
|
|
import { STATUS, PUSH_BATCH, PUSH_INTERVAL, CONSUME_TYPE, HERO_SELECT, ENTERY_ROLE_PICK, JEWEL_SELECT, ITEM_SELECT, SKIN_SELECT, PUSH_ROUTE, ARTIFACT_SELECT, ACTIVITYITEM_SELECT, SNS_LINK_TYPE, VESTIGE_STATUS } from '../consts';
|
|
|
|
|
import { STATUS, PUSH_BATCH, PUSH_INTERVAL, CONSUME_TYPE, HERO_SELECT, ENTERY_ROLE_PICK, JEWEL_SELECT, ITEM_SELECT, SKIN_SELECT, PUSH_ROUTE, ARTIFACT_SELECT, ACTIVITYITEM_SELECT, SNS_LINK_TYPE, VESTIGE_STATUS, HERO_SYSTEM_TYPE } from '../consts';
|
|
|
|
|
import { getAllShopList } from './shopService';
|
|
|
|
|
import { getGeneralRank, getRankFirstReward } from './rankService';
|
|
|
|
|
import { getFriendList, getApplyList } from './friendService';
|
|
|
|
|
@@ -30,14 +30,14 @@ import { getBattleListOfMain, getMainChapter } from './normalBattleService';
|
|
|
|
|
import { GuildModel, GuildType } from '../db/Guild';
|
|
|
|
|
import UserGuild, { UserGuildType } from '../db/UserGuild';
|
|
|
|
|
import { getAllGuildActivityStatus } from './guildActivity/guildActivityService';
|
|
|
|
|
import { getAllOnlineRoles, getAllServers, incConnectorNum, redisClient } from './redisService';
|
|
|
|
|
import { checkRecalJewelOpen, getAllOnlineRoles, getAllServers, incConnectorNum, redisClient } from './redisService';
|
|
|
|
|
import Item, { ItemModel } from '../db/Item';
|
|
|
|
|
import { PvpDefenseModel } from '../db/PvpDefense';
|
|
|
|
|
import { getDonation } from './donateService';
|
|
|
|
|
import { refChallengeCnt, sendLastSeasonRewardIfNotSent } from './pvpService';
|
|
|
|
|
import { HeroModel } from '../db/Hero';
|
|
|
|
|
import { JewelModel } from '../db/Jewel';
|
|
|
|
|
import { SkinModel } from '../db/Skin';
|
|
|
|
|
import { HeroModel, HeroType } from '../db/Hero';
|
|
|
|
|
import { JewelModel, JewelType } from '../db/Jewel';
|
|
|
|
|
import { SkinModel, SkinType } from '../db/Skin';
|
|
|
|
|
import { getAp } from './actionPointService';
|
|
|
|
|
import { HeroParam } from '../domain/roleField/hero';
|
|
|
|
|
import { pick } from 'underscore';
|
|
|
|
|
@@ -48,7 +48,7 @@ import { INFO_WINDOW } from '../pubUtils/dicParam';
|
|
|
|
|
import { getLadderData } from './ladderService';
|
|
|
|
|
import { dispatch } from '../pubUtils/dispatcher';
|
|
|
|
|
import { PvpDataReturn } from '../domain/battleField/pvp';
|
|
|
|
|
import { ArtifactModel } from '../db/Artifact';
|
|
|
|
|
import { ArtifactModel, ArtifactModelType } from '../db/Artifact';
|
|
|
|
|
import { ActivityItemModel } from '../db/ActivityItem';
|
|
|
|
|
import { LinkModel } from '../db/Link';
|
|
|
|
|
import { getHiddenData } from './memoryCache/hiddenData';
|
|
|
|
|
@@ -59,6 +59,8 @@ import { LadderMatchRecModel } from '../db/LadderMatchRec';
|
|
|
|
|
import { GVGVestigeRecModel, GVGVestigeRecUpdate } from '../db/GVGVestigeRec';
|
|
|
|
|
import { getVestigeRecStatus } from './gvg/gvgFightService';
|
|
|
|
|
import { getRemoteRplPrefix } from '../pubUtils/battleUtils';
|
|
|
|
|
import { calculateCeWithRole } from './playerCeService';
|
|
|
|
|
import { SchoolModel } from '../db/School';
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* init: 初始的时候是否推送 true-推 false-不推
|
|
|
|
|
@@ -138,6 +140,7 @@ export async function getModuleData(type: string, data: { role: RoleType, sessio
|
|
|
|
|
let artifacts = await ArtifactModel.findbyRole(role.roleId, ARTIFACT_SELECT.ENTRY);
|
|
|
|
|
let activityItems = await ActivityItemModel.findbyRole(role.roleId, ACTIVITYITEM_SELECT.ENTRY);
|
|
|
|
|
let link = await LinkModel.findByType(SNS_LINK_TYPE.CUSTOMER);
|
|
|
|
|
await reCalJewel(role, heros, jewels, skins, artifacts);
|
|
|
|
|
role['heros'] = heros.map(hero => new HeroParam(hero));
|
|
|
|
|
role['jewels'] = jewels;
|
|
|
|
|
role['consumeGoods'] = items;
|
|
|
|
|
@@ -479,4 +482,24 @@ async function getIconShow(roleId: string, session:FrontendOrBackendSession) {
|
|
|
|
|
export async function pushIconShow(roleId: string, ladderIconShow?: boolean, gvgFightRecs?) {
|
|
|
|
|
if (!roleId) return;
|
|
|
|
|
sendMessageToUserWithSuc(roleId, PUSH_ROUTE.LADDER_OR_GVG_ICON_SHOW, { ladderIconShow, gvgFightRecs });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export async function reCalJewel(role: RoleType, heroes: HeroType[], jewels: JewelType[], skins: SkinType[], artifacts: ArtifactModelType[]) {
|
|
|
|
|
if (role.hasTreat || !await checkRecalJewelOpen()) return
|
|
|
|
|
role = await RoleModel.updateRoleInfo(role.roleId, { hasTreat: true });
|
|
|
|
|
for (let jewel of jewels) {
|
|
|
|
|
let hero = heroes.find(hero => {
|
|
|
|
|
let ePlace = hero.ePlace.find(e => e.jewel == jewel.seqId);
|
|
|
|
|
return !!ePlace;
|
|
|
|
|
});
|
|
|
|
|
if (hero && hero.hid != jewel.hid) {
|
|
|
|
|
let ePlace = hero.ePlace.find(e => e.jewel == jewel.seqId);
|
|
|
|
|
if (ePlace) {
|
|
|
|
|
await JewelModel.updateInfo(jewel.seqId, { hid: hero.hid, ePlaceId: ePlace.id });
|
|
|
|
|
jewel.hid = hero.hid; jewel.ePlaceId = ePlace.id;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
let schools = await SchoolModel.findByRoleId(role.roleId);
|
|
|
|
|
await calculateCeWithRole(HERO_SYSTEM_TYPE.RE_CAL, role.roleId, role.serverId, null, {}, { role, schools, jewels, heroes, skins, artifacts });
|
|
|
|
|
}
|