Merge branch 'feature/equip'
This commit is contained in:
@@ -52,7 +52,11 @@ export class EquipHandler {
|
||||
let newEquip = new EPlace(ePlaceId, dicEquip.id);
|
||||
let newEplace = [...oldEplace, newEquip];
|
||||
|
||||
hero = await calPlayerCeAndSave(HERO_SYSTEM_TYPE.COMPOSE_EQUIP, sid, roleId, hero, { ePlace: newEplace }, [ePlaceId]);
|
||||
let update = {
|
||||
ePlace: newEplace,
|
||||
consumes: addConsumeToHero(hero.consumes, dicEquip.composeMaterial),
|
||||
}
|
||||
hero = await calPlayerCeAndSave(HERO_SYSTEM_TYPE.COMPOSE_EQUIP, sid, roleId, hero, update, [ePlaceId]);
|
||||
await checkTaskInComposeEquip(serverId, roleId, sid, oldEplace, newEplace, ePlaceId);
|
||||
|
||||
return resResult(STATUS.SUCCESS, {
|
||||
@@ -415,13 +419,13 @@ export class EquipHandler {
|
||||
|
||||
let updateConsumes = hero.consumes;
|
||||
if(gid > 0) {
|
||||
addConsumeToHero(updateConsumes, [{ id: gid, count: 1 }]);
|
||||
updateConsumes = addConsumeToHero(updateConsumes, [{ id: gid, count: 1 }]);
|
||||
let consumeResult = await handleCost(roleId, sid, [{ id: gid, count: 1 }], ITEM_CHANGE_REASON.EQUIP_FILL_HOLE);
|
||||
if (!consumeResult) return resResult(STATUS.ROLE_MATERIAL_NOT_ENOUGH);
|
||||
}
|
||||
|
||||
if(curStone.stone > 0) { // 返回石头
|
||||
addConsumeToHero(updateConsumes, [{ id: curStone.stone, count: -1 }]);
|
||||
updateConsumes = addConsumeToHero(updateConsumes, [{ id: curStone.stone, count: -1 }]);
|
||||
await addItems(roleId, roleName, sid, [{ id: curStone.stone, count: 1 }], ITEM_CHANGE_REASON.EQUIP_FILL_HOLE);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Application, BackendSession, ChannelService, HandlerService, } from 'pinus';
|
||||
import { handleCost, addItems, unlockFigure, createHeroes, createHero, CheckMeterial } from '../../../services/rewardService';
|
||||
import { calPlayerCeAndSave, calAllHeroCe } from '../../../services/playerCeService';
|
||||
import { resResult, deepCopy } from '../../../pubUtils/util';
|
||||
import { resResult, deepCopy, reduceCe } from '../../../pubUtils/util';
|
||||
import { STATUS } from '../../../consts/statusCode';
|
||||
import { HeroModel, Connect, HeroSkin, HeroUpdate, EPlace } from '../../../db/Hero';
|
||||
import { CURRENCY_BY_TYPE, CURRENCY_TYPE, CONSUME_TYPE, HERO_GROW_MAX, HERO_SYSTEM_TYPE, ABI_STAGE, DEBUG_MAGIC_WORD, HERO_INITIAL_QUALITY, REDIS_KEY, TASK_TYPE, ITEM_CHANGE_REASON } from '../../../consts';
|
||||
@@ -14,7 +14,7 @@ import { pushComposeOrangeHero, pushHeroQualityUpMsg, pushHeroStarMax, pushHeroW
|
||||
import { calculatetopLineup } from '../../../pubUtils/playerCe';
|
||||
import { PvpDefenseModel } from '../../../db/PvpDefense';
|
||||
import { checkTaskWithHero, checkTask, checkActivityTask } from '../../../services/taskService';
|
||||
import { pick } from 'underscore';
|
||||
import { isNumber, pick } from 'underscore';
|
||||
import { updateEplaces } from '../../../services/equipService';
|
||||
import { addConsumeToHero } from '../../../services/roleService';
|
||||
import { getCoinObject, getGoldObject } from '../../../pubUtils/itemUtils';
|
||||
@@ -649,6 +649,8 @@ export class HeroHandler {
|
||||
let sid: string = session.get('sid');
|
||||
|
||||
let { hid } = msg;
|
||||
if(!isNumber(hid) && !hid) return resResult(STATUS.WRONG_PARMS);
|
||||
|
||||
// 武将初始,但是皮肤这里不初始
|
||||
let hero = await HeroModel.findByHidAndRole(hid, roleId);
|
||||
if(!hero) return resResult(STATUS.HERO_NOT_FIND);
|
||||
@@ -687,11 +689,11 @@ export class HeroHandler {
|
||||
}
|
||||
|
||||
let { heros } = await calAllHeroCe(HERO_SYSTEM_TYPE.REBIRTH, sid, roleId, {}, [hid], { originHero: hero, heroUpdate: initInfo });
|
||||
let curHeo = heros.find(cur => cur.hid == hid);
|
||||
let curHero = heros.find(cur => cur.hid == hid);
|
||||
|
||||
let goods = await addItems(roleId, roleName, sid, consumes, ITEM_CHANGE_REASON.REBIRTH);
|
||||
|
||||
return resResult(STATUS.SUCCESS, { curHeo, curJewels, goods });
|
||||
return resResult(STATUS.SUCCESS, { curHero: { ...curHero, ce: reduceCe(curHero.ce) }, curJewels, goods });
|
||||
}
|
||||
|
||||
// ! debug接口 一键全武将
|
||||
|
||||
@@ -176,7 +176,7 @@ export class SendMailFun {
|
||||
let originMail = await MailModel.addMail({ roleId, ...mapTemp.getCreateMailParams() });
|
||||
this.mails.push(originMail);
|
||||
}
|
||||
await GMMailModel.sendMail(mapTemp.gmmail._id, mapTemp.sendTime);
|
||||
if(mapTemp.gmmail) await GMMailModel.sendMail(mapTemp.gmmail._id, mapTemp.sendTime);
|
||||
}
|
||||
|
||||
// 生成多人邮件
|
||||
@@ -187,7 +187,7 @@ export class SendMailFun {
|
||||
return { roleId, status: MAIL_STATUS.CREATE }
|
||||
})
|
||||
let originMail = await GroupMailModel.addMail({ roleStatus, guildCode, ...mapTemp.getCreateMailParams() });
|
||||
await GMMailModel.sendMail(mapTemp.gmmail._id, mapTemp.sendTime);
|
||||
if(mapTemp.gmmail) await GMMailModel.sendMail(mapTemp.gmmail._id, mapTemp.sendTime);
|
||||
this.groupMails.push(originMail);
|
||||
}
|
||||
|
||||
@@ -199,7 +199,7 @@ export class SendMailFun {
|
||||
let originMail = await ServerMailModel.addMail({ serverId, ...mapTemp.getCreateMailParams() });
|
||||
this.serverMails.push(originMail);
|
||||
}
|
||||
await GMMailModel.sendMail(mapTemp.gmmail._id, mapTemp.sendTime);
|
||||
if(mapTemp.gmmail) await GMMailModel.sendMail(mapTemp.gmmail._id, mapTemp.sendTime);
|
||||
}
|
||||
|
||||
public async setMails(mails: MailType[], groupMails: GroupMailType[], serverMails: ServerMailType[]) {
|
||||
|
||||
@@ -71,6 +71,7 @@ export async function reCalAllHeroCe(type: number, roleId: string, update: RoleU
|
||||
let pushHeros = new Array<{ hid: number, ce: number, incHeroCe: number }>();
|
||||
|
||||
let allIncCe = 0;
|
||||
let resultHeroes = [];
|
||||
for (let hero of heros) {
|
||||
let { attr: heroAttrs, lv } = hero;
|
||||
let newAttr = new AttributeCal();
|
||||
@@ -81,8 +82,11 @@ export async function reCalAllHeroCe(type: number, roleId: string, update: RoleU
|
||||
let incHeroCe = heroCe - hero.ce;
|
||||
allIncCe += incHeroCe;
|
||||
pushHeros.push({ hid: hero.hid, ce: reduceCe(heroCe), incHeroCe: reduceCe(incHeroCe) });
|
||||
await HeroModel.updateHeroInfo(roleId, hero.hid, { ce: heroCe });
|
||||
let resultHero = await HeroModel.updateHeroInfo(roleId, hero.hid, { ce: heroCe });
|
||||
resultHeroes.push(resultHero);
|
||||
await PvpDefenseModel.updateCe(roleId, hero.hid, reduceCe(incHeroCe)); // 更新pvp防守阵战力
|
||||
} else {
|
||||
resultHeroes.push(hero);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -100,7 +104,7 @@ export async function reCalAllHeroCe(type: number, roleId: string, update: RoleU
|
||||
let guild = await GuildModel.updateCe(roleId, allIncCe); // 公会更新战力
|
||||
|
||||
saveCeChangeLog(role, allIncCe, role.ce, type, args);
|
||||
return { role, pushHeros, ce: role.ce, topLineupCe: role.topLineupCe, guild, serverId: role.serverId, heros }
|
||||
return { role, pushHeros, ce: role.ce, topLineupCe: role.topLineupCe, guild, serverId: role.serverId, heros: resultHeroes }
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
"max": 2,
|
||||
"honourConsume": "40005&60",
|
||||
"fundConsume": 19000,
|
||||
"timeConsume": 1200
|
||||
"timeConsume": 20
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
@@ -30,7 +30,7 @@
|
||||
"max": 3,
|
||||
"honourConsume": "40005&50",
|
||||
"fundConsume": 27000,
|
||||
"timeConsume": 1800
|
||||
"timeConsume": 30
|
||||
},
|
||||
{
|
||||
"id": 4,
|
||||
@@ -41,7 +41,7 @@
|
||||
"max": 1,
|
||||
"honourConsume": "40005&70",
|
||||
"fundConsume": 40000,
|
||||
"timeConsume": 2700
|
||||
"timeConsume": 40
|
||||
},
|
||||
{
|
||||
"id": 5,
|
||||
@@ -52,7 +52,7 @@
|
||||
"max": 2,
|
||||
"honourConsume": "40005&60",
|
||||
"fundConsume": 40000,
|
||||
"timeConsume": 2700
|
||||
"timeConsume": 50
|
||||
},
|
||||
{
|
||||
"id": 6,
|
||||
@@ -63,7 +63,7 @@
|
||||
"max": 3,
|
||||
"honourConsume": "40005&50",
|
||||
"fundConsume": 31000,
|
||||
"timeConsume": 2700
|
||||
"timeConsume": 60
|
||||
},
|
||||
{
|
||||
"id": 7,
|
||||
@@ -74,7 +74,7 @@
|
||||
"max": 1,
|
||||
"honourConsume": "40005&70",
|
||||
"fundConsume": 45000,
|
||||
"timeConsume": 4800
|
||||
"timeConsume": 70
|
||||
},
|
||||
{
|
||||
"id": 8,
|
||||
@@ -85,7 +85,7 @@
|
||||
"max": 2,
|
||||
"honourConsume": "40005&60",
|
||||
"fundConsume": 60000,
|
||||
"timeConsume": 7200
|
||||
"timeConsume": 80
|
||||
},
|
||||
{
|
||||
"id": 9,
|
||||
@@ -96,7 +96,7 @@
|
||||
"max": 3,
|
||||
"honourConsume": "40005&50",
|
||||
"fundConsume": 40000,
|
||||
"timeConsume": 2700
|
||||
"timeConsume": 90
|
||||
},
|
||||
{
|
||||
"id": 10,
|
||||
@@ -107,7 +107,7 @@
|
||||
"max": 1,
|
||||
"honourConsume": "40005&70",
|
||||
"fundConsume": 48000,
|
||||
"timeConsume": 5400
|
||||
"timeConsume": 100
|
||||
},
|
||||
{
|
||||
"id": 11,
|
||||
@@ -118,7 +118,7 @@
|
||||
"max": 2,
|
||||
"honourConsume": "40005&60",
|
||||
"fundConsume": 66000,
|
||||
"timeConsume": 8400
|
||||
"timeConsume": 110
|
||||
},
|
||||
{
|
||||
"id": 12,
|
||||
@@ -129,7 +129,7 @@
|
||||
"max": 3,
|
||||
"honourConsume": "40005&50",
|
||||
"fundConsume": 86000,
|
||||
"timeConsume": 10800
|
||||
"timeConsume": 120
|
||||
},
|
||||
{
|
||||
"id": 13,
|
||||
@@ -140,7 +140,7 @@
|
||||
"max": 1,
|
||||
"honourConsume": "40005&70",
|
||||
"fundConsume": 40000,
|
||||
"timeConsume": 2700
|
||||
"timeConsume": 130
|
||||
},
|
||||
{
|
||||
"id": 14,
|
||||
@@ -151,7 +151,7 @@
|
||||
"max": 2,
|
||||
"honourConsume": "40005&60",
|
||||
"fundConsume": 84000,
|
||||
"timeConsume": 10800
|
||||
"timeConsume": 140
|
||||
},
|
||||
{
|
||||
"id": 15,
|
||||
@@ -162,6 +162,6 @@
|
||||
"max": 3,
|
||||
"honourConsume": "40005&50",
|
||||
"fundConsume": 115000,
|
||||
"timeConsume": 16800
|
||||
"timeConsume": 150
|
||||
}
|
||||
]
|
||||
Executable → Regular
+108
-3132
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
+287
-3171
File diff suppressed because it is too large
Load Diff
@@ -37,22 +37,22 @@
|
||||
},
|
||||
{
|
||||
"typeid": 11,
|
||||
"name": "二星套装"
|
||||
"name": "蓝品图纸"
|
||||
},
|
||||
{
|
||||
"typeid": 12,
|
||||
"name": "三星套装"
|
||||
"name": "紫品图纸"
|
||||
},
|
||||
{
|
||||
"typeid": 13,
|
||||
"name": "四星套装"
|
||||
"name": "橙品图纸"
|
||||
},
|
||||
{
|
||||
"typeid": 14,
|
||||
"name": "五星套装"
|
||||
"name": "红品图纸"
|
||||
},
|
||||
{
|
||||
"typeid": 15,
|
||||
"name": "六星套装"
|
||||
"name": "金品图纸"
|
||||
}
|
||||
]
|
||||
Reference in New Issue
Block a user