装备:分解

This commit is contained in:
luying
2022-02-17 14:26:07 +08:00
parent 2bfc27356f
commit ee32f1cdee
5 changed files with 76 additions and 75 deletions
+13 -7
View File
@@ -11,7 +11,7 @@ import { addJewels, addBags, addSkin, addFigure, unlockFigure as pubUnlockFigure
import { ItemInter, RewardInter, } from '../pubUtils/interface';
import { gameData } from '../pubUtils/data';
import { uniq } from 'underscore';
import { HeroModel, HeroType, HeroUpdate } from '../db/Hero';
import { EPlace, HeroModel, HeroType, HeroUpdate } from '../db/Hero';
import { Figure } from '../domain/dbGeneral';
import { Rank } from './rankService';
import { checkActivityTask, checkTaskWithHero, pushActivityUpdate, pushTaskUpdate } from './taskService';
@@ -28,6 +28,7 @@ import { getActivities } from './activity/activityService';
import { reportTAEvent, reportTAUserSet } from './sdkService';
import { saveCoinChangeLog, saveFigureInfoLog, saveGoldChangeLog, saveItemChangeLog } from '../pubUtils/logUtil';
import { JewelModel, JewelType } from '../db/Jewel';
import { updateEplaces } from './equipService';
export class CheckMeterial {
private roleId: string;
@@ -138,12 +139,17 @@ export async function handleCost(roleId: string, sid: string, goods: Array<ItemI
}
}
for(let [_hid, {hero, jewels} ] of heroMap) {
// TODO 脱下天晶石
// for(let equip of jewels) {
// hero = await HeroModel.putOffJewel(roleId, hero.hid, equip.ePlaceId, equip._id);
// }
// await calPlayerCeAndSave(HERO_SYSTEM_TYPE.EQUIP, sid, roleId, hero, {}, args);
// 脱下天晶石
let update = new Map<number, Partial<EPlace>>();
for(let jewel of jewels) {
await JewelModel.putOnOrOff(jewel.id, 0, 0);
let curEquip = hero.ePlace.find(cur => cur.jewel == jewel.id);
if(!!curEquip) {
update.set(curEquip.id, { jewel: 0 });
}
}
let { newEplace } = updateEplaces(hero.ePlace, update);
await calPlayerCeAndSave(HERO_SYSTEM_TYPE.EQUIP_STRENGTH, sid, roleId, hero, { ePlace: newEplace }, [...update.keys()]);
}