战力计算,远征战力筛选
This commit is contained in:
@@ -212,6 +212,7 @@ export class NormalBattleHandler {
|
||||
let condition2 = await BattleRecordModel.getBattleRecordByIdAndStar(roleId, battleId, 3);
|
||||
if(!condition2) warReward.setCondition(1, true);
|
||||
}
|
||||
if(towerReward) warReward.setFixReward(towerReward);
|
||||
|
||||
await updateWarStar(roleId, battleId, warInfo.warType, star);
|
||||
}
|
||||
@@ -235,7 +236,7 @@ export class NormalBattleHandler {
|
||||
// towerStatus: false-本层未通过, true-本层已通过
|
||||
return resResult(STATUS.SUCCESS, {
|
||||
battleCode, battleId, status, towerStatus,
|
||||
...reward, towerReward,
|
||||
...reward,
|
||||
apJson,
|
||||
dailyNum,
|
||||
heroes: curHeroes,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { ChatRemote } from '../remote/chatRemote';
|
||||
import {Application, BackendSession} from 'pinus';
|
||||
import { FrontendSession } from 'pinus';
|
||||
import { HeroModel } from '../../../db/Hero';
|
||||
import Actor from '../../../pubUtils/actor';
|
||||
import { updateCe } from '../../../pubUtils/util';
|
||||
|
||||
export default function(app: Application) {
|
||||
return new ChatHandler(app);
|
||||
@@ -10,8 +11,15 @@ export class ChatHandler {
|
||||
constructor(private app: Application) {
|
||||
}
|
||||
|
||||
async test(msg: {content: string , target: string}, session: BackendSession) {
|
||||
console.log('test')
|
||||
async test(msg: {}, session: BackendSession) {
|
||||
let roleId = session.get('roleId')
|
||||
let hero = await HeroModel.find().limit(1000);
|
||||
for(let h of hero) {
|
||||
let actor = new Actor(h);
|
||||
let ce = actor.calculateCE();
|
||||
await updateCe(roleId, h);
|
||||
}
|
||||
return 'success'
|
||||
}
|
||||
/**
|
||||
* Send messages to users
|
||||
|
||||
@@ -10,6 +10,7 @@ import { resResult } from '../../../pubUtils/util';
|
||||
import { startEvent } from '../../../services/eventSercive';
|
||||
import { EVENT_START_LV } from '../../../consts/consts';
|
||||
import { getAp } from '../../../services/actionPointService';
|
||||
import Actor from '../../../pubUtils/actor';
|
||||
|
||||
export default function (app: Application) {
|
||||
return new EntryHandler(app);
|
||||
@@ -64,6 +65,7 @@ export class EntryHandler {
|
||||
session.on('closed', this.onUserLeave.bind(this));
|
||||
|
||||
|
||||
|
||||
if(role.lv >= EVENT_START_LV && !role.eventStatus) {
|
||||
startEvent(self.app, session);
|
||||
}
|
||||
@@ -79,6 +81,12 @@ export class EntryHandler {
|
||||
// let users = await self.app.rpc.chat.chatRemote.add.route(session)(role.roleId, self.app.get('serverId'), rid, true);
|
||||
let heros = await HeroModel.findByRole(role.roleId);
|
||||
let equips = await EquipModel.findbyRole(role.roleId);
|
||||
|
||||
for(let hero of heros) {
|
||||
let actor = new Actor(hero);
|
||||
actor.calculateCE();
|
||||
}
|
||||
|
||||
role['heros'] = heros;
|
||||
role['equips'] = equips;
|
||||
let apJson = await getAp(Date.now(), role.roleId);
|
||||
|
||||
@@ -29,12 +29,14 @@ export class RoleHandler {
|
||||
async initHeros(roleId: string, roleName: string) {
|
||||
const seqId = await CounterModel.getNewCounter('hid');
|
||||
let ce = calculateCE({hid: 1, lv: 1});
|
||||
|
||||
const heroInfo = {
|
||||
roleId,
|
||||
roleName,
|
||||
hid: 1,
|
||||
hName: '曹操',
|
||||
seqId,
|
||||
star: 0,
|
||||
ce
|
||||
}
|
||||
await HeroModel.createHero(heroInfo);
|
||||
|
||||
Reference in New Issue
Block a user