修改接口逻辑
This commit is contained in:
parent
f95b585071
commit
a5ea00cc60
@ -99,20 +99,40 @@ let ItemMan = {
|
||||
* @returns 物品列表
|
||||
*/
|
||||
getItemsByInfo(infostr: string): ItemInfo[]{
|
||||
let reslst: ItemInfo[] = [];
|
||||
let itemlst: ItemInfo[] = [];
|
||||
let lst = infostr.split('|');
|
||||
lst.forEach((v: string) =>{
|
||||
let item = new ItemInfo();
|
||||
if(item.loadInfo(v)){
|
||||
let obj = this.findItem(item.id);
|
||||
obj && (item.type = obj._type);
|
||||
reslst.push(item);
|
||||
itemlst.push(item);
|
||||
}
|
||||
});
|
||||
|
||||
let clst: CIC[] = [];
|
||||
itemlst.forEach((item: ItemInfo) =>{
|
||||
this.internalUseItem(item.id, item.count, false, clst);
|
||||
});
|
||||
|
||||
let reslst:ItemInfo[] = [];
|
||||
clst.forEach((item: CIC) => {
|
||||
reslst.push(item.info);
|
||||
});
|
||||
return reslst;
|
||||
},
|
||||
|
||||
internalUseItem(itemid: number, count: number, dpcard: boolean, reslst: CIC[]){
|
||||
let obj: CommonItem = this.findItem(itemid);
|
||||
if(!obj){
|
||||
return false;
|
||||
}
|
||||
|
||||
this._useItem(obj, count, dpcard, reslst);
|
||||
|
||||
return true;
|
||||
},
|
||||
|
||||
_useItem(item: CommonItem, count: number, dpcard: boolean, reslst: CIC[]){
|
||||
if(item.isPackage() && item._isautoopen){
|
||||
this._openItemPkg(item, count, false, reslst);
|
||||
|
Loading…
x
Reference in New Issue
Block a user