合成装备
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import { GOOD_TYPE, ITID, CURRENCY, CURRENCY_TYPE, COUNTER, CONSUME_TYPE, getCurNameById } from './../consts/consts';
|
||||
import { GOOD_TYPE, ITID, CURRENCY, CURRENCY_TYPE, CONSUME_TYPE, getCurNameById } from './../consts/consts';
|
||||
import { EquipModel } from './../db/Equip';
|
||||
import { CounterModel } from './../db/Counter';
|
||||
import { decodeStr, resResult } from '../pubUtils/util';
|
||||
import { getGoodById } from '../pubUtils/gamedata';
|
||||
import { RoleModel } from '../db/Role';
|
||||
@@ -9,7 +8,7 @@ import { ItemModel } from '../db/Item';
|
||||
import { STATUS } from '../consts/statusCode';
|
||||
import { pinus } from 'pinus';
|
||||
import { addEquips, addBags, addSkins } from '../pubUtils/itemUtils';
|
||||
import { EquipInter } from '../pubUtils/interface';
|
||||
import { EquipInter, ItemInter, BagInter } from '../pubUtils/interface';
|
||||
import { gameData } from '../pubUtils/data';
|
||||
const _ = require('underscore');
|
||||
|
||||
@@ -126,9 +125,8 @@ async function rewardCurrency (roleId: string, dicGood: any, data: {id:number,cn
|
||||
});
|
||||
return goods;
|
||||
}
|
||||
interface Item {id?: number, count?: number, seqId?: number, type?: number};
|
||||
interface Bag {id: number, itemName: string, count: number, type: number, hid:number};
|
||||
export async function handleCost(roleId: string, sid: string, goods: Array<Item>) {
|
||||
|
||||
export async function handleCost(roleId: string, sid: string, goods: Array<ItemInter>) {
|
||||
let currencysMap: any = {};
|
||||
let equips: Array<number> = [];
|
||||
let bags: Array<{id: number, count: number}> = [];
|
||||
@@ -173,7 +171,7 @@ export async function handleCost(roleId: string, sid: string, goods: Array<Item>
|
||||
return true;
|
||||
}
|
||||
|
||||
function sortConsumes(goods: Array<Item>, bags: Array<Item>, currencysMap: any, equips: Array<number>) {
|
||||
function sortConsumes(goods: Array<ItemInter>, bags: Array<ItemInter>, currencysMap: any, equips: Array<number>) {
|
||||
for (let good of goods) {
|
||||
if (good.type == GOOD_TYPE.EQUIP) { // 装备
|
||||
if (!!good.seqId) {
|
||||
@@ -206,11 +204,11 @@ function sortConsumes(goods: Array<Item>, bags: Array<Item>, currencysMap: any,
|
||||
return true;
|
||||
}
|
||||
|
||||
export async function addItems(roleId: string, roleName: string, sid: string, goods: Array<Item>) {
|
||||
let showItems: Array<Item> = [];
|
||||
export async function addItems(roleId: string, roleName: string, sid: string, goods: Array<ItemInter>) {
|
||||
let showItems: Array<ItemInter> = [];
|
||||
let currencysMap: any = {};
|
||||
let equips: Array<EquipInter> = [];
|
||||
let bags: Array<Bag> = [];
|
||||
let bags: Array<BagInter> = [];
|
||||
let skins: Array<number> = [];
|
||||
let uids = [{uid: roleId, sid}];
|
||||
sortItems(goods, bags, skins, currencysMap, equips, showItems);
|
||||
@@ -263,7 +261,7 @@ export async function addItems(roleId: string, roleName: string, sid: string, go
|
||||
return showItems;
|
||||
}
|
||||
|
||||
function sortItems (goods: Array<Item>, bags: Array<Bag>, skins: Array<number>, currencysMap: any, equips: Array<EquipInter>, showItems: Array<Item>) {
|
||||
function sortItems (goods: Array<ItemInter>, bags: Array<BagInter>, skins: Array<number>, currencysMap: any, equips: Array<EquipInter>, showItems: Array<ItemInter>) {
|
||||
for (let good of goods) {
|
||||
let goodInfo = gameData.goods.get(good.id);
|
||||
if (goodInfo.goodType == GOOD_TYPE.EQUIP) { // 装备
|
||||
|
||||
Reference in New Issue
Block a user