全局:属性修改

This commit is contained in:
luying
2021-03-04 15:33:24 +08:00
parent d4561c2e3d
commit 0966f025cf
35 changed files with 1186 additions and 1130 deletions
+10 -12
View File
@@ -1,4 +1,4 @@
import { mergeSameGoods } from '../pubUtils/util';
import { mergeSameGoods, deepCopy } from '../pubUtils/util';
import { EquipModel } from "../db/Equip";
import { HeroModel, EPlace, HeroType } from "../db/Hero";
import { getHeroJob, getGoodById, gameData, getJewelById, getHeroEquipByClassId } from "../pubUtils/data";
@@ -77,7 +77,7 @@ export async function changeEquip(roleId: string, sid: string, equip: EquipType,
return res;
}
} else if (!!hero) {//从穿戴装备的武将上卸下装备
await takeOffEquipAndCalPlayerCe(roleId, sid, seqId, hero, id);//卸下装备并重算战力
await takeOffEquipAndCalPlayerCe(roleId, sid, hero, equip, id);//卸下装备并重算战力
}
}
/**
@@ -88,15 +88,12 @@ export async function changeEquip(roleId: string, sid: string, equip: EquipType,
* @param hero
* @param id
*/
export async function takeOffEquipAndCalPlayerCe(roleId: string, sid: string, seqId: number, hero:HeroType, id: number ) {
let index = findIndex(hero.ePlace, { id });
if (index < 0)
return;
await EquipModel.updateEquipInfo(seqId, { hid: 0 });
hero.ePlace[index].equip = null;
export async function takeOffEquipAndCalPlayerCe(roleId: string, sid: string, hero:HeroType, equip: EquipType, id: number ) {
let args = calEquipSeids(hero);
await calPlayerCeAndSave(sid, roleId, [hero], HERO_SYSTEM_TYPE.EQUIP, args);
return { seqId, hid: 0};
hero = await HeroModel.removeEquip(roleId, hero.hid, id, equip._id);
await calPlayerCeAndSave(HERO_SYSTEM_TYPE.EQUIP, sid, roleId, hero, {}, args);
return { seqId: equip.seqId, hid: 0};
}
/**
* 穿戴装备并重算战力
@@ -106,9 +103,10 @@ export async function takeOffEquipAndCalPlayerCe(roleId: string, sid: string, se
* @param equip
*/
export async function dressEquip(roleId: string, sid: string, hero:HeroType, equip: EquipType) {
hero = await HeroModel.addEquip(roleId, hero.hid, equip.ePlaceId, equip._id);
let args = calEquipSeids(hero);
await calPlayerCeAndSave(sid, roleId, [hero], HERO_SYSTEM_TYPE.EQUIP, args);
hero = await HeroModel.addEquip(roleId, hero.hid, equip.ePlaceId, equip._id);
await calPlayerCeAndSave(HERO_SYSTEM_TYPE.EQUIP, sid, roleId, hero, {}, args);
return { seqId: equip.seqId, hid: hero.hid };
}
/**