排行:排行rpc同进程获取函数修改
This commit is contained in:
@@ -10,7 +10,7 @@ import { getAtrrNameById } from '../../../consts/constModules/abilityConst'
|
||||
import { findIndex } from 'underscore';
|
||||
import { SclResultInter, SclPosInter } from '../../../pubUtils/interface';
|
||||
import { SchoolModel } from '../../../db/School';
|
||||
import { getTeraphStrengthenResult, getSchoolList, getDefaultRoleInfo } from '../../../services/roleService'
|
||||
import { getTeraphStrengthenResult, getSchoolList } from '../../../services/roleService'
|
||||
import { calPlayerCeAndSave, calAllHeroCe } from '../../../services/playerCeService';
|
||||
import { HERO_SYSTEM_TYPE, LINEUP_NUM, ROLE_SELECT, REDIS_KEY, TASK_TYPE, DEFAULT_HEROES, DEFAULT_HERO_LV, DEFAULT_ITEMS, DEFAULT_EQUIPS, DEFAULT_GOLD, DEFAULT_COIN } from '../../../consts';
|
||||
import { checkBattleHeroesByHid } from '../../../services/normalBattleService';
|
||||
|
||||
@@ -37,6 +37,7 @@ export class RoleRemote {
|
||||
}
|
||||
this.rankFirstRewards.get(rank.serverId).set(rank.id, rank);
|
||||
}
|
||||
this.app.set('rankFirstRewards', rankFirstRewards);
|
||||
}
|
||||
|
||||
public setRankFirst(rank: RankFirstType) {
|
||||
@@ -63,7 +64,8 @@ export class RoleRemote {
|
||||
this.figureInfo = figureInfo;
|
||||
const initRoleInfos = getDefaultRoleInfo(this.initHeroes, this.initSkins, this.initRole, this.figureInfo);
|
||||
this.app.set('initRoleInfos', initRoleInfos);
|
||||
|
||||
this.app.set('initHeroes', this.initHeroes);
|
||||
this.app.set('initSkins', this.initSkins);
|
||||
}
|
||||
|
||||
public getInitRoleInfos() {
|
||||
|
||||
@@ -10,7 +10,6 @@ import { gameData } from "../pubUtils/data";
|
||||
import { nowSeconds } from "../pubUtils/timeUtil";
|
||||
import { getWorldChannelSid } from "./chatChannelService";
|
||||
import { pinus } from "pinus";
|
||||
import ts = require("typescript");
|
||||
import { RankFirstModel, RankFirstType, RankFirstUpdateParam } from "../db/RankFirst";
|
||||
import { getRandSingleEelm } from "../pubUtils/util";
|
||||
|
||||
@@ -849,7 +848,7 @@ export class Rank {
|
||||
let ts = this;
|
||||
if (ts.isInit) return;
|
||||
let myRank = await this.getMyRank(myId);
|
||||
console.log('*******', ts.key, myRank, newScore, oldScore);
|
||||
// console.log('*******', ts.key, myRank, newScore, oldScore);
|
||||
if (myRank == 1 && newScore > oldScore) {
|
||||
let serverId = this.keyName.serverId;
|
||||
let sid = await getWorldChannelSid(serverId);
|
||||
@@ -857,7 +856,7 @@ export class Rank {
|
||||
let redisKey = RANK_TYPE_TO_KEY.get(id);
|
||||
return redisKey == ts.key
|
||||
});
|
||||
console.log('*******', dicRank);
|
||||
// console.log('*******', dicRank);
|
||||
if(dicRank) {
|
||||
let r = new Rank(ts.key, { serverId }, false, 1);
|
||||
let ranks = await r.getRankByRange();
|
||||
@@ -872,7 +871,7 @@ export class Rank {
|
||||
}
|
||||
|
||||
for(let [id, { rankId, condition }] of gameData.generalRankReward) {
|
||||
console.log(rankId, dicRank.id, oldScore, condition, newScore);
|
||||
// console.log(rankId, dicRank.id, oldScore, condition, newScore);
|
||||
if(dicRank.id == rankId && oldScore < condition && newScore >= condition) {
|
||||
let rankFirstRec = await RankFirstModel.createRankFirst(serverId, id, rankId, { userInfo, guildInfo });
|
||||
let roleServers = pinus.app.getServersByType('role');
|
||||
@@ -1055,12 +1054,15 @@ export async function getGeneralRank(role: RoleType & { rankReceived: number[] }
|
||||
let result: (RankFirstUpdateParam & {status: number})[] = [];
|
||||
|
||||
for (let [id, { rankId: type } ] of gameData.generalRankReward) {
|
||||
let roleServers = pinus.app.getServersByType('role');
|
||||
let curServer = roleServers.find(cur => cur.id == pinus.app.getServerId());
|
||||
if(!curServer) {
|
||||
curServer = getRandSingleEelm(roleServers);
|
||||
let rankFirst: RankFirstType;
|
||||
if(pinus.app.getServerType() == 'role') {
|
||||
rankFirst = pinus.app.get('rankFirstRewards').get(serverId)?.get(id);
|
||||
} else {
|
||||
let roleServers = pinus.app.getServersByType('role');
|
||||
let server = getRandSingleEelm(roleServers);
|
||||
rankFirst = await pinus.app.rpc.role.roleRemote.getRankFirstById.toServer(server.id, serverId, id);
|
||||
}
|
||||
let rankFirst = await pinus.app.rpc.role.roleRemote.getRankFirstById.toServer(curServer.id, serverId, id);
|
||||
|
||||
if(rankFirst) {
|
||||
let status = rankReceived.includes(id)?2: 1;
|
||||
result.push({...rankFirst, status});
|
||||
|
||||
@@ -23,6 +23,7 @@ import { sendMailByContent } from './mailService';
|
||||
import { calEquipSeids } from '../pubUtils/playerCe';
|
||||
import { CreateHeroes } from '../pubUtils/roleUtil';
|
||||
import { SkinUpdate } from '../db/Skin';
|
||||
import { getInitHeroById } from './roleService';
|
||||
|
||||
export class CheckMeterial {
|
||||
private roleId: string;
|
||||
@@ -448,12 +449,15 @@ export async function createHeroes(roleId: string, roleName: string, sid: string
|
||||
let { pieceId, count } = transPiece(h.hid);
|
||||
pieces.push({ id: pieceId, count: count * heroCount });
|
||||
} else {
|
||||
let roleServers = pinus.app.getServersByType('role');
|
||||
let curServer = roleServers.find(cur => cur.id == pinus.app.getServerId());
|
||||
if(!curServer) {
|
||||
curServer = getRandSingleEelm(roleServers);
|
||||
let initInfo: { heroInfo: HeroUpdate, skinInfo: SkinUpdate };
|
||||
if(pinus.app.getServerType() == 'role') {
|
||||
initInfo = getInitHeroById(h.hid);
|
||||
} else {
|
||||
let roleServers = pinus.app.getServersByType('role');
|
||||
let server = getRandSingleEelm(roleServers);
|
||||
initInfo = await pinus.app.rpc.role.roleRemote.getInitHeroById.toServer(server.id, h.hid);
|
||||
}
|
||||
let initInfo = await pinus.app.rpc.role.roleRemote.getInitHeroById.toServer(curServer.id, h.hid);
|
||||
|
||||
infos.set(h.hid, initInfo);
|
||||
userHeroesMap.set(h.hid, null);
|
||||
if (heroCount > 1) {
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Channel, pinus } from 'pinus';
|
||||
import { getRandValueByMinMax, getRandEelm, decodeIdCntArrayStr } from '../pubUtils/util';
|
||||
import { DEFAULT_HEROES, TERAPH_RANDOM } from "../consts";
|
||||
import { DicTeraph } from '../pubUtils/dictionary/DicTeraph';
|
||||
import { Teraph, RoleModel, RoleType } from '../db/Role';
|
||||
import { Teraph, RoleModel, RoleType, RoleUpdate } from '../db/Role';
|
||||
import { ROLE_SELECT } from '../consts';
|
||||
import { SCHOOL } from '../pubUtils/dicParam';
|
||||
import { gameData } from '../pubUtils/data';
|
||||
@@ -12,6 +12,7 @@ import { SclResultInter, SclPosInter } from '../pubUtils/interface';
|
||||
import { CheckMeterial } from './rewardService';
|
||||
import { HeroUpdate } from '../db/Hero';
|
||||
import { SkinUpdate } from '../db/Skin';
|
||||
import { Figure } from '../domain/dbGeneral';
|
||||
|
||||
export async function getTeraphStrengthenResult(role: RoleType, count: number, dicTeraph: DicTeraph, teraph: Teraph) {
|
||||
let criAttr: number[] = [], times = 0;
|
||||
@@ -129,7 +130,7 @@ export async function getSchoolList(roleId: string) {
|
||||
}
|
||||
|
||||
function getDefaultHeroInfos(heroes: Map<number, HeroUpdate>, skins: Map<number, SkinUpdate>) {
|
||||
const initInfos = [];
|
||||
const initInfos: { heroInfo: HeroUpdate, skinInfo: SkinUpdate}[] = [];
|
||||
for(let hid of DEFAULT_HEROES) {
|
||||
initInfos.push({
|
||||
heroInfo: heroes.get(hid),
|
||||
@@ -139,7 +140,14 @@ function getDefaultHeroInfos(heroes: Map<number, HeroUpdate>, skins: Map<number,
|
||||
return initInfos;
|
||||
}
|
||||
|
||||
export function getDefaultRoleInfo(heroes: Map<number, HeroUpdate>, skins: Map<number, SkinUpdate>, role, figureInfo) {
|
||||
export function getDefaultRoleInfo(heroes: Map<number, HeroUpdate>, skins: Map<number, SkinUpdate>, role:RoleUpdate, figureInfo: { heads: Figure[], frames: Figure[], spines: Figure[] }) {
|
||||
const initInfos = getDefaultHeroInfos(heroes, skins);
|
||||
return { initInfos, role, figureInfo };
|
||||
}
|
||||
|
||||
export function getInitHeroById(hid: number) {
|
||||
return {
|
||||
heroInfo: pinus.app.get('initHeroes').get(hid),
|
||||
skinInfo: pinus.app.get('initSkins').get(hid)
|
||||
}
|
||||
}
|
||||
@@ -476,7 +476,7 @@ export function calHeroTrainIncAttr(originHero: HeroType, update: HeroUpdate) {
|
||||
let targetAttrId = dicJob.ceAttr.get(i).id;
|
||||
let targetAttrValue = dicJob.ceAttr.get(i).attr;
|
||||
let inc = (targetAttrValue - lastAttr) * HERO_CE_RATIO;
|
||||
console.log('*******', targetAttrId, targetAttrValue, lastAttr, inc )
|
||||
// console.log('*******', targetAttrId, targetAttrValue, lastAttr, inc )
|
||||
updateHeroAttr(heroAttrs, targetAttrId, { inc: { fixUp: inc } });
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user