diff --git a/config/dropitem_tbl.json b/config/dropitem_tbl.json index bc8cc10..e69de29 100644 --- a/config/dropitem_tbl.json +++ b/config/dropitem_tbl.json @@ -1 +0,0 @@ -[{"id":80001,"parname":"藏宝图碎片1","itemtypeid":1,"autopen":0,"drop":"","weight":10000,"candtypeid":0,"candgradeid":0,"additionalcandidates":""},{"id":80002,"parname":"藏宝图碎片2","itemtypeid":1,"autopen":0,"drop":"","weight":10000,"candtypeid":0,"candgradeid":0,"additionalcandidates":""},{"id":80003,"parname":"藏宝图碎片3","itemtypeid":1,"autopen":0,"drop":"","weight":10000,"candtypeid":0,"candgradeid":0,"additionalcandidates":""},{"id":80004,"parname":"藏宝图碎片4","itemtypeid":1,"autopen":0,"drop":"","weight":10000,"candtypeid":0,"candgradeid":0,"additionalcandidates":""},{"id":80005,"parname":"藏宝图碎片5","itemtypeid":1,"autopen":0,"drop":"","weight":10000,"candtypeid":0,"candgradeid":0,"additionalcandidates":""},{"id":80006,"parname":"藏宝图碎片6","itemtypeid":1,"autopen":0,"drop":"","weight":10000,"candtypeid":0,"candgradeid":0,"additionalcandidates":""},{"id":80007,"parname":"藏宝图碎片7","itemtypeid":1,"autopen":0,"drop":"","weight":10000,"candtypeid":0,"candgradeid":0,"additionalcandidates":""},{"id":80008,"parname":"藏宝图碎片8","itemtypeid":1,"autopen":0,"drop":"","weight":10000,"candtypeid":0,"candgradeid":0,"additionalcandidates":""},{"id":80009,"parname":"藏宝图碎片9","itemtypeid":1,"autopen":0,"drop":"","weight":10000,"candtypeid":0,"candgradeid":0,"additionalcandidates":""},{"id":80010,"parname":"藏宝图碎片10","itemtypeid":1,"autopen":0,"drop":"","weight":10000,"candtypeid":0,"candgradeid":0,"additionalcandidates":""},{"id":80011,"parname":"完整的藏宝图","itemtypeid":1,"autopen":0,"drop":"","weight":10000,"candtypeid":0,"candgradeid":0,"additionalcandidates":""},{"id":80012,"parname":"红钻石","itemtypeid":7,"autopen":0,"drop":"","weight":10000,"candtypeid":0,"candgradeid":0,"additionalcandidates":""},{"id":80013,"parname":"金币","itemtypeid":7,"autopen":0,"drop":"","weight":10000,"candtypeid":0,"candgradeid":0,"additionalcandidates":""},{"id":80014,"parname":"PVP初级胜利掉落","itemtypeid":2,"autopen":1,"drop":"80012:20|80013:2000|80024:200","weight":10000,"candtypeid":0,"candgradeid":0,"additionalcandidates":""},{"id":80015,"parname":"PVP初级失败掉落","itemtypeid":2,"autopen":1,"drop":"80012:10|80013:1000|80024:100","weight":10000,"candtypeid":0,"candgradeid":0,"additionalcandidates":""},{"id":80016,"parname":"藏宝图碎片分包","itemtypeid":2,"autopen":1,"drop":"","weight":10000,"candtypeid":0,"candgradeid":0,"additionalcandidates":""},{"id":80017,"parname":"单抽常规卡包","itemtypeid":2,"autopen":1,"drop":"","weight":10000,"candtypeid":0,"candgradeid":0,"additionalcandidates":""},{"id":80018,"parname":"十连抽常规卡包","itemtypeid":2,"autopen":1,"drop":"","weight":10000,"candtypeid":0,"candgradeid":0,"additionalcandidates":""},{"id":80019,"parname":"常规卡包普通卡","itemtypeid":2,"autopen":1,"drop":"","weight":10000,"candtypeid":3,"candgradeid":2,"additionalcandidates":""},{"id":80020,"parname":"常规卡包稀有卡","itemtypeid":2,"autopen":1,"drop":"","weight":10000,"candtypeid":3,"candgradeid":3,"additionalcandidates":""},{"id":80021,"parname":"常规卡包史诗卡","itemtypeid":2,"autopen":1,"drop":"","weight":10000,"candtypeid":3,"candgradeid":4,"additionalcandidates":""},{"id":80022,"parname":"常规卡包传奇卡","itemtypeid":2,"autopen":1,"drop":"","weight":10000,"candtypeid":3,"candgradeid":5,"additionalcandidates":""},{"id":80023,"parname":"常规卡包稀有卡以上","itemtypeid":2,"autopen":1,"drop":"","weight":10000,"candtypeid":0,"candgradeid":0,"additionalcandidates":"80020|80020|80020|80020|80021|80022"},{"id":80024,"parname":"蓝钻石","itemtypeid":7,"autopen":0,"drop":"","weight":0,"candtypeid":0,"candgradeid":0,"additionalcandidates":""},{"id":80025,"parname":"神秘的黄金牌","itemtypeid":1,"autopen":0,"drop":"","weight":0,"candtypeid":0,"candgradeid":0,"additionalcandidates":""}] \ No newline at end of file diff --git a/src/cfg/parsers/DropItemCfg.ts b/src/cfg/parsers/DropItemCfg.ts index ad624d9..12139cc 100644 --- a/src/cfg/parsers/DropItemCfg.ts +++ b/src/cfg/parsers/DropItemCfg.ts @@ -6,6 +6,7 @@ export class DropItemCfg implements Cfg{ public id: number; public parname: string; public itemtypeid: number; + public Price: number; public autopen: number; public drop: string; public weight: number; @@ -17,6 +18,7 @@ export class DropItemCfg implements Cfg{ this.id = data.id; this.parname = data.parname; this.itemtypeid = data.itemtypeid; + this.Price = data.Price; this.autopen = data.autopen; this.drop = data.drop; this.weight = data.weight; diff --git a/src/logic/ItemCtrl.ts b/src/logic/ItemCtrl.ts index 9a2ba59..9258463 100644 --- a/src/logic/ItemCtrl.ts +++ b/src/logic/ItemCtrl.ts @@ -9,6 +9,8 @@ let ItemMan = { // 卡牌按子类型分 _card_types: new Map(), + _items: new Map(), + useItem(itemid: number, itemcount: number = 1) { let obj: DropItemCfg = global.$cfg.get(BaseConst.DROPITEM).get(itemid); if(!obj){ @@ -45,7 +47,23 @@ let ItemMan = { }, - initCardCache(){ + initItems(){ + this._items.clear(); + + this.initDropItems(); + this.initCardItems(); + + this.handleItems(); + }, + + initDropItems(){ + let map: Map = global.$cfg.get(BaseConst.DROPITEM); + map.forEach((v: DropItemCfg, k: number) => { + + }); + }, + + initCardItems(){ this._card_lvs.clear(); this._card_types.clear(); @@ -67,6 +85,10 @@ let ItemMan = { lst.push(v); } }); + }, + + handleItems(){ + } }; diff --git a/src/logic/ItemDef.ts b/src/logic/ItemDef.ts index de9d5be..0d817cc 100644 --- a/src/logic/ItemDef.ts +++ b/src/logic/ItemDef.ts @@ -50,40 +50,81 @@ export class ItemInfo{ }; export class CommonItem{ - private _id: number = 0; + public _id: number = 0; - private _type: number = 0; - private _subtype: number = 0; - private _grade: number = 0; - private _isautoopen: boolean = false; + public _type: number = 0; + public _subtype: number = 0; + public _grade: number = 0; + public _isautoopen: boolean = false; - private _weight: number = 0; + public _weight: number = 0; - private _solidsubitems: ItemInfo[]; + public _randsubtype: number = 0; + public _randsubgrade: number = 0; - private _randsubitems: ItemInfo[]; + public _solidsubitems: ItemInfo[]; - public loadCardItem(carditem: ItemCardCfg){ - this._id = carditem.id; + public _randexitems: ItemInfo[]; + + public _randsubitems: ItemInfo[]; + + public loadCardItem(aitem: ItemCardCfg){ + this._id = aitem.id; this._type = COMMON_ITEM_TYPE.CARD; - this._subtype = carditem.typeid; - this._grade = carditem.gradeid; + this._subtype = aitem.typeid; + this._grade = aitem.gradeid; this._isautoopen = false; - this._weight = carditem.weight; + this._weight = aitem.weight; - let lst = carditem.decomposition_to_obtain.split('|'); + let lst = aitem.decomposition_to_obtain.split('|'); lst.forEach((v: string) => { let l = v.split(':'); if(l.length >= 2){ + let item = new ItemInfo(parseInt(l[0]), parseInt(l[1])); if(!this._solidsubitems){ - this._solidsubitems = []; + this._solidsubitems = [item]; + }else{ + this._solidsubitems.push(item); } } }); }; - public loadDropItem(dropitem: DropItemCfg){ + public loadDropItem(aitem: DropItemCfg){ + this._id = aitem.id; + this._type = aitem.itemtypeid; + this._subtype = COMMON_ITEM_TYPE.NONE; + this._grade = COMMON_ITEM_GRADE.BASE; - } + this._isautoopen = aitem.autopen == 1; + this._weight = aitem.weight; + + this._randsubtype = aitem.candtypeid; + this._randsubgrade = aitem.candgradeid; + + let lst = aitem.drop.split('|'); + lst.forEach((v: string) => { + let l = v.split(':'); + if(l.length >= 2){ + let item = new ItemInfo(parseInt(l[0]), parseInt(l[1])); + if(!this._solidsubitems){ + this._solidsubitems = [item]; + }else{ + this._solidsubitems.push(item); + } + } + }); + + lst = aitem.additionalcandidates.split('|'); + lst.forEach((v: string) => { + let item = new ItemInfo(parseInt(v), 1); + if(!this._randexitems){ + this._randexitems = [item]; + }else{ + this._randexitems.push(item); + } + }); + }; + }; \ No newline at end of file