导表
This commit is contained in:
parent
880811235c
commit
e722d9d20e
@ -1 +1 @@
|
||||
[{"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":1,"autopen":0,"drop":"","weight":10000,"candtypeid":0,"candgradeid":0,"additionalcandidates":""},{"id":80013,"parname":"金币","itemtypeid":1,"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":1,"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":""}]
|
||||
[{"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":""}]
|
@ -4,14 +4,14 @@ export class DropItemCfg implements Cfg{
|
||||
name: "DropItemCfg";
|
||||
|
||||
public id: number;
|
||||
public parname: number;
|
||||
public parname: string;
|
||||
public itemtypeid: number;
|
||||
public autopen: number;
|
||||
public drop: number;
|
||||
public drop: string;
|
||||
public weight: number;
|
||||
public candtypeid: number;
|
||||
public candgradeid: number;
|
||||
public additionalcandidates: number;
|
||||
public additionalcandidates: string;
|
||||
|
||||
public decode(data: any) {
|
||||
this.id = data.id;
|
||||
|
@ -4,7 +4,7 @@ export class EffectCardCfg implements Cfg{
|
||||
name: "EffectCardCfg";
|
||||
|
||||
public id: number;
|
||||
public org_gift: number;
|
||||
public org_gift: string;
|
||||
public type_id: number;
|
||||
public count: number;
|
||||
public weight: number;
|
||||
|
@ -4,8 +4,8 @@ export class FormulaCfg implements Cfg{
|
||||
name: "FormulaCfg";
|
||||
|
||||
public id: number;
|
||||
public parname: number;
|
||||
public code: number;
|
||||
public parname: string;
|
||||
public code: string;
|
||||
public number: number;
|
||||
public numtypeid: number;
|
||||
public prerequisite1id: number;
|
||||
|
@ -5,7 +5,7 @@ export class HeroCfg implements Cfg{
|
||||
|
||||
public id: number;
|
||||
public herounit_id: number;
|
||||
public org_gift: number;
|
||||
public org_gift: string;
|
||||
public ex_skill: number;
|
||||
public Unlockgroup2id: number;
|
||||
public Unlockgroup2num: number;
|
||||
|
@ -4,14 +4,14 @@ export class ItemCardCfg implements Cfg{
|
||||
name: "ItemCardCfg";
|
||||
|
||||
public id: number;
|
||||
public parname: number;
|
||||
public parname: string;
|
||||
public typeid: number;
|
||||
public gradeid: number;
|
||||
public weight: number;
|
||||
public automatic: number;
|
||||
public unlocking: number;
|
||||
public unlockingtimes: number;
|
||||
public decomposition_to_obtain: number;
|
||||
public decomposition_to_obtain: string;
|
||||
|
||||
public decode(data: any) {
|
||||
this.id = data.id;
|
||||
|
@ -4,12 +4,12 @@ export class ItemFuncCfg implements Cfg{
|
||||
name: "ItemFuncCfg";
|
||||
|
||||
public id: number;
|
||||
public parname: number;
|
||||
public consume1: number;
|
||||
public consume2: number;
|
||||
public parname: string;
|
||||
public consume1: string;
|
||||
public consume2: string;
|
||||
public selectiontimes: number;
|
||||
public actypeid: number;
|
||||
public get: number;
|
||||
public get: string;
|
||||
|
||||
public decode(data: any) {
|
||||
this.id = data.id;
|
||||
|
@ -4,10 +4,10 @@ export class MatchCfg implements Cfg{
|
||||
name: "MatchCfg";
|
||||
|
||||
public id: number;
|
||||
public parname: number;
|
||||
public consume: number;
|
||||
public winget: number;
|
||||
public failget: number;
|
||||
public parname: string;
|
||||
public consume: string;
|
||||
public winget: string;
|
||||
public failget: string;
|
||||
|
||||
public decode(data: any) {
|
||||
this.id = data.id;
|
||||
|
@ -4,7 +4,7 @@ export class SkillCfg implements Cfg{
|
||||
name: "SkillCfg";
|
||||
|
||||
public id: number;
|
||||
public skill_nameshow: number;
|
||||
public skill_nameshow: string;
|
||||
public skill_typeid: number;
|
||||
public affix1id: number;
|
||||
public affix2id: number;
|
||||
|
@ -4,7 +4,7 @@ export class UnitCfg implements Cfg{
|
||||
name: "UnitCfg";
|
||||
|
||||
public id: number;
|
||||
public unit_name: number;
|
||||
public unit_name: string;
|
||||
public unittypei_id: number;
|
||||
public hero_hp: number;
|
||||
public spell_power: number;
|
||||
|
@ -1,14 +1,31 @@
|
||||
import { DropItemCfg } from "cfg/parsers/DropItemCfg";
|
||||
import { ItemCardCfg } from "cfg/parsers/ItemCardCfg";
|
||||
import { ZError } from "common/ZError";
|
||||
import { BaseConst } from "constants/BaseConst";
|
||||
|
||||
let ItemMan = {
|
||||
// 卡牌按品质分
|
||||
_card_lvs: new Map(),
|
||||
// 卡牌按子类型分
|
||||
_card_types: new Map(),
|
||||
|
||||
useItem(itemid: number, itemcount: number = 1) {
|
||||
let obj: DropItemCfg = global.$cfg.get(BaseConst.DROPITEM).get(itemid);
|
||||
if(!obj){
|
||||
throw new ZError(1001, 'not find item!');
|
||||
}
|
||||
|
||||
|
||||
|
||||
return [{ itemid: 10001, itemnum: 1, itemtype: 1 }];
|
||||
},
|
||||
|
||||
/**
|
||||
* useItem
|
||||
* useItem:使用物品(主要指礼包类物品)
|
||||
* @param itemid : 物品卡id
|
||||
* @param itemcount :物品卡数量
|
||||
*/
|
||||
useItem(itemid: number, itemcount: number = 1) {
|
||||
useItemPackage(itemid: number, itemcount: number = 1) {
|
||||
let obj: DropItemCfg = global.$cfg.get(BaseConst.DROPITEM).get(itemid);
|
||||
if(!obj){
|
||||
throw new ZError(1001, 'not find item!');
|
||||
@ -19,8 +36,37 @@ let ItemMan = {
|
||||
return [{ itemid: 10001, itemnum: 1 }];
|
||||
},
|
||||
|
||||
initCache(){
|
||||
/**
|
||||
* decomposeItemCard:分解卡片
|
||||
* @param itemid : 物品卡id
|
||||
* @param itemcount :物品卡数量
|
||||
*/
|
||||
decomposeItemCard(itemid: number, itemcount: number = 1){
|
||||
|
||||
},
|
||||
|
||||
initCardCache(){
|
||||
this._card_lvs.clear();
|
||||
this._card_types.clear();
|
||||
|
||||
let map: Map<number, ItemCardCfg> = global.$cfg.get(BaseConst.ITEMCARD);
|
||||
map.forEach((v: ItemCardCfg, k: number) =>{
|
||||
let lst = this._card_lvs.get(v.gradeid);
|
||||
if(!lst){
|
||||
lst = [v];
|
||||
this._card_lvs.set(v.gradeid, lst);
|
||||
}else{
|
||||
lst.push(v);
|
||||
}
|
||||
|
||||
lst = this._card_types.get(v.typeid);
|
||||
if(!lst){
|
||||
lst = [v];
|
||||
this._card_types.set(v.typeid, lst);
|
||||
}else{
|
||||
lst.push(v);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
89
src/logic/ItemDef.ts
Normal file
89
src/logic/ItemDef.ts
Normal file
@ -0,0 +1,89 @@
|
||||
import { DropItemCfg } from "cfg/parsers/DropItemCfg";
|
||||
import { ItemCardCfg } from "cfg/parsers/ItemCardCfg";
|
||||
|
||||
/**
|
||||
* 1.杂物
|
||||
* 2.杂物包
|
||||
* 3.卡牌
|
||||
|
||||
* 4.卡牌包
|
||||
* 5.镶宝技能
|
||||
* 6.镶宝技能包
|
||||
*/
|
||||
export const enum COMMON_ITEM_TYPE{
|
||||
NONE = 0,
|
||||
NORMAL = 1,
|
||||
NORMAL_PKG = 2,
|
||||
CARD = 3,
|
||||
CARD_PKG = 4,
|
||||
SKILL = 5,
|
||||
SKILL_PKG = 6,
|
||||
};
|
||||
|
||||
/**
|
||||
* 1.基础(暂时不用)
|
||||
* 2.普通
|
||||
* 3.稀有
|
||||
* 4.史诗
|
||||
* 5.传奇
|
||||
* 6.神话(暂时不用)
|
||||
*/
|
||||
export const enum COMMON_ITEM_GRADE{
|
||||
NONE = 0,
|
||||
BASE = 1,
|
||||
NORMAL = 2,
|
||||
RARE = 3,
|
||||
EPIC = 4,
|
||||
LEGEND = 5,
|
||||
MYTH = 6,
|
||||
};
|
||||
|
||||
export class ItemInfo{
|
||||
id: number;
|
||||
count: number;
|
||||
weight: number = 0;
|
||||
constructor(itemid: number, itemcount: number, itemweight: number = 0){
|
||||
this.id = itemid;
|
||||
this.count = itemcount;
|
||||
this.weight = itemweight;
|
||||
}
|
||||
};
|
||||
|
||||
export class CommonItem{
|
||||
private _id: number = 0;
|
||||
|
||||
private _type: number = 0;
|
||||
private _subtype: number = 0;
|
||||
private _grade: number = 0;
|
||||
private _isautoopen: boolean = false;
|
||||
|
||||
private _weight: number = 0;
|
||||
|
||||
private _solidsubitems: ItemInfo[];
|
||||
|
||||
private _randsubitems: ItemInfo[];
|
||||
|
||||
public loadCardItem(carditem: ItemCardCfg){
|
||||
this._id = carditem.id;
|
||||
this._type = COMMON_ITEM_TYPE.CARD;
|
||||
this._subtype = carditem.typeid;
|
||||
this._grade = carditem.gradeid;
|
||||
|
||||
this._isautoopen = false;
|
||||
this._weight = carditem.weight;
|
||||
|
||||
let lst = carditem.decomposition_to_obtain.split('|');
|
||||
lst.forEach((v: string) => {
|
||||
let l = v.split(':');
|
||||
if(l.length >= 2){
|
||||
if(!this._solidsubitems){
|
||||
this._solidsubitems = [];
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
public loadDropItem(dropitem: DropItemCfg){
|
||||
|
||||
}
|
||||
};
|
Loading…
x
Reference in New Issue
Block a user