后台:重新计算玩家战力
This commit is contained in:
@@ -19,11 +19,13 @@ import { HeroModel } from '../../../db/Hero';
|
||||
import { SkinModel } from '../../../db/Skin';
|
||||
import { PvpDefenseModel } from '../../../db/PvpDefense';
|
||||
import { createHeroes } from '../../../services/role/createHero';
|
||||
import { calculateCeWithHero } from '../../../services/playerCeService';
|
||||
import { calculateCeWithHero, calculateCeWithRole } from '../../../services/playerCeService';
|
||||
import { pushChangeGuildLeader, pushGuildDismiss, pushGuildInfoUpdate } from '../../../services/guildService';
|
||||
import { sendMessageToUserWithSuc } from '../../../services/pushService';
|
||||
import { RScriptRecordModel } from '../../../db/RScriptRecord';
|
||||
import { DicWar } from '../../../pubUtils/dictionary/DicWar';
|
||||
import { SchoolModel } from '../../../db/School';
|
||||
import { JewelModel } from '../../../db/Jewel';
|
||||
|
||||
let timer: NodeJS.Timer;
|
||||
export default function (app: Application) {
|
||||
@@ -283,4 +285,16 @@ export class GmRoleHandler {
|
||||
|
||||
return resResult(STATUS.SUCCESS);
|
||||
}
|
||||
|
||||
async reCalCe(msg: { roleId: string }, session: BackendSession) {
|
||||
const { roleId } = msg;
|
||||
let role = await RoleModel.findByRoleId(roleId);
|
||||
let schools = await SchoolModel.findByRoleId(roleId);
|
||||
let jewels = await JewelModel.findbyRole(roleId);
|
||||
let heroes = await HeroModel.findByRole(roleId);
|
||||
let skins = await SkinModel.findbyRole(roleId);
|
||||
|
||||
await calculateCeWithRole(HERO_SYSTEM_TYPE.RE_CAL, roleId, role.serverId, null, {}, { role, schools, jewels, heroes, skins });
|
||||
return resResult(STATUS.SUCCESS);
|
||||
}
|
||||
}
|
||||
@@ -14,9 +14,10 @@ import { RoleCeModel } from '../db/RoleCe';
|
||||
import { PvpDefenseModel } from '../db/PvpDefense';
|
||||
import { saveCeChangeLog } from '../pubUtils/logUtil';
|
||||
import { JewelType } from '../db/Jewel';
|
||||
import { SchoolModel } from '../db/School';
|
||||
import { SchoolModel, SchoolType } from '../db/School';
|
||||
import { AttributeCal } from '../domain/roleField/attribute';
|
||||
import { sendMessageToUserWithSuc } from './pushService';
|
||||
import { SkinType } from '../db/Skin';
|
||||
|
||||
interface Param {
|
||||
isInitRole?: boolean,
|
||||
@@ -35,7 +36,11 @@ interface Param {
|
||||
preSchoolHid?: number,
|
||||
skinId?: number,
|
||||
roleUpdate?: RoleUpdate,
|
||||
roleIncUpdate?: RoleUpdate
|
||||
role?: RoleType,
|
||||
roleIncUpdate?: RoleUpdate;
|
||||
heroes?: HeroType[],
|
||||
schools?: SchoolType[];
|
||||
skins?: SkinType[]
|
||||
}
|
||||
|
||||
export async function calculateCeWithHero(type: HERO_SYSTEM_TYPE, roleId: string, serverId: number, sid: string, hid: number, heroUpdate: HeroUpdate, param: Param = {}) {
|
||||
@@ -288,10 +293,40 @@ export async function calculateCes(type: HERO_SYSTEM_TYPE, roleId: string, serve
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HERO_SYSTEM_TYPE.ROLE_LV: // 31. 玩家等级
|
||||
case HERO_SYSTEM_TYPE.RE_CAL: // 31. 玩家等级
|
||||
{
|
||||
let { lv } = roleUpdate;
|
||||
calCe.setRoleLv(lv);
|
||||
let { role, schools, jewels, heroes, skins } = param;
|
||||
calCe.clearRoleCe();
|
||||
for(let { hid, skinId, lv, quality, star, starStage, colorStar, colorStarStage, job, jobStage, connections, favourLv, skins, scrollStar, scrollQuality, scrollColorStar, ePlace } of heroes) {
|
||||
calCe.setHeroBase(hid, skinId);
|
||||
calCe.setHeroLv(hid, lv);
|
||||
calCe.setHeroStar(hid, job, quality, star, starStage, colorStar, colorStarStage);
|
||||
calCe.setJob(hid, job, jobStage);
|
||||
calCe.setFavour(hid, favourLv, connections);
|
||||
calCe.setConnection(hid, connections);
|
||||
calCe.setTalent(hid, skins);
|
||||
for(let { id, equipId, star, starStage, quality, qualityStage, lv: equipLv, stones, jewel } of ePlace) {
|
||||
calCe.setEquipQuality(hid, id, equipId, quality, qualityStage);
|
||||
calCe.setEquipStrength(hid, id, equipId, equipLv);
|
||||
calCe.setEquipStar(hid, id, equipId, star, starStage);
|
||||
let curJewel = jewels.find(cur => cur.seqId == jewel);
|
||||
calCe.setJewel(hid, id, stones, curJewel);
|
||||
calCe.setStone(hid, id, stones);
|
||||
calCe.setTitle(role.title);
|
||||
calCe.setTeraph(role.teraphs);
|
||||
}
|
||||
calCe.setEquipSuit(hid, skinId, ePlace);
|
||||
calCe.setScroll(hid, scrollStar, scrollQuality, scrollColorStar);
|
||||
}
|
||||
|
||||
for(let { schoolId, hid, } of schools) {
|
||||
let curHero = heroes.find(cur => cur.hid == hid);
|
||||
calCe.setSchool(true, hid, schoolId, curHero.star, curHero.colorStar, curHero.quality);
|
||||
}
|
||||
|
||||
for(let { id } of skins) {
|
||||
calCe.setAddSkin(id);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,10 @@ export class CalCe {
|
||||
this.originCes = this.calHeroCe();
|
||||
}
|
||||
|
||||
public clearRoleCe() {
|
||||
this.data = new CalCeData(null);
|
||||
}
|
||||
|
||||
public getRoleCeTable() {
|
||||
let attributes: Attribute[] = [];
|
||||
for(let [hid, attrs] of this.attrsByHid) {
|
||||
|
||||
@@ -31,7 +31,7 @@ export enum HERO_SYSTEM_TYPE {
|
||||
JEWEL_QUENCH = 28, // 天晶石淬炼
|
||||
REBIRTH = 29, // 武将重生
|
||||
TALENT = 30, // 天赋
|
||||
ROLE_LV = 31, // 玩家等级
|
||||
RE_CAL = 31, // 重新计算
|
||||
};
|
||||
|
||||
// 武将上限
|
||||
|
||||
@@ -824,5 +824,12 @@
|
||||
"name": "跳过序章",
|
||||
"module": "role",
|
||||
"type": "update"
|
||||
},
|
||||
{
|
||||
"id": 119,
|
||||
"api": "gm.gmRoleHandler.reCalCe",
|
||||
"name": "重新计算这个玩家的战力",
|
||||
"module": "role",
|
||||
"type": "update"
|
||||
}
|
||||
]
|
||||
Reference in New Issue
Block a user