后台添加装备时可以选择武将穿上

This commit is contained in:
luying
2020-12-18 15:15:01 +08:00
parent b39c9bdc8b
commit f2c124a6e4
9 changed files with 592 additions and 267 deletions

View File

@@ -34,6 +34,7 @@ export interface EquipInter {
hole: number;
randomEffect: Array<number>;
itid: number;
hid?: number;
};

View File

@@ -31,7 +31,7 @@ export async function addBags(roleId: string, roleName: string, data: BagInter)
}
export async function addEquips(roleId: string, roleName: string, weapon: EquipInter) {
let { id, name, quality, suitId, hole, randomEffect, itid } = weapon;
let { id, name, quality, suitId, hole, randomEffect, itid, hid } = weapon;
let {type} = ITID.get(itid);
let randomNum = RANDOM_SE_COUNT.get(quality);
@@ -40,9 +40,9 @@ export async function addEquips(roleId: string, roleName: string, weapon: EquipI
let randSe = new Array<RandSe>();
for(let i = 0; i < randomNum; i++) {
pool = pool.filter(cur => !chosen.includes(cur.id));
console.log(JSON.stringify(pool))
let random = getRandomByLen(pool);
if(!random) break;
chosen.push(random.id);
let rand = 0;
if(random.id > 0) rand = Math.floor(Math.random() * (random.Max - random.Min) + random.Min);
randSe.push({
@@ -58,6 +58,6 @@ export async function addEquips(roleId: string, roleName: string, weapon: EquipI
holes.push({id: i+1, isOpen: false, jewel: 0})
}
const equip = await EquipModel.createEquip({roleId, roleName, id, name, quality, suitId, randRange, ePlaceId: type, randSe, holes});
const equip = await EquipModel.createEquip({roleId, roleName, id, name, quality, suitId, randRange, ePlaceId: type, randSe, holes, hid});
return equip
}