商店:基础数据及购买
This commit is contained in:
@@ -7,9 +7,9 @@ export interface DicShop {
|
||||
// 商品id
|
||||
readonly id: number;
|
||||
// 物品表id
|
||||
readonly goodid: number;
|
||||
readonly goodId: number;
|
||||
// 物品表名
|
||||
readonly goodname: number;
|
||||
readonly goodName: number;
|
||||
// 商店id 对应 dic_zyz_shoplist的id
|
||||
readonly shop: number;
|
||||
// 商店标签 对应 dic_zyz_shopType的id
|
||||
@@ -17,7 +17,7 @@ export interface DicShop {
|
||||
// 军团等级需求
|
||||
readonly guildLvLimit: number;
|
||||
// 玩家等级需求
|
||||
readonly lvlimit: number;
|
||||
readonly lvLimit: number;
|
||||
// 购买次数限制
|
||||
readonly purchaseLimit: number;
|
||||
// vip购买次数限制
|
||||
@@ -27,26 +27,27 @@ export interface DicShop {
|
||||
// 用于购买的货币
|
||||
readonly money: number;
|
||||
// 价格
|
||||
readonly price: number;
|
||||
readonly price: string;
|
||||
}
|
||||
|
||||
export const dicShopItem = new Map<number, DicShop>(); // itemid => DicShop
|
||||
export const dicShop = new Map<number, DicShop[]>(); // shop => DicShop[]
|
||||
export const dicShopByType = new Map<string, { shop: number, type: number, items: DicShop[] }>(); // shop + type => DicShop[]
|
||||
export function loadShop() {
|
||||
dicShopItem.clear();
|
||||
dicShop.clear();
|
||||
dicShopByType.clear();
|
||||
|
||||
let arr = readFileAndParse(FILENAME.DIC_SHOP);
|
||||
|
||||
arr.forEach(o => {
|
||||
o.guildLvLimit = o.guildlvlimit == '&'?0: o.guildlvlimit;
|
||||
o.lvlimit = o.lvlimit == '&'?0: o.lvlimit;
|
||||
o.purchaseLimit = o.purchaselimit == '&'?-1: (o.purchaselimit||0);
|
||||
o.vipPurchaseLimit = o.vipPurchaseLimit == '&'?-1: (o.vipPurchaseLimit||0);
|
||||
if(!dicShop.has(o.shop)) {
|
||||
dicShop.set(o.shop, [o]);
|
||||
o.guildLvLimit = o.guildLvLimit == '&'?0: o.guildLvLimit;
|
||||
o.lvLimit = o.lvLimit == '&'?0: o.lvLimit;
|
||||
o.purchaseLimit = o.purchaseLimit == '&'?-1: (o.purchaseLimit||0);
|
||||
o.vipPurchaseLimit = o.vipPurchaseLimit == '&'? 0: (o.vipPurchaseLimit||0);
|
||||
let key = `${o.shop}_${o.type}`;
|
||||
if(!dicShopByType.has(key)) {
|
||||
dicShopByType.set(key, { shop: o.shop, type: o.type, items: [] });
|
||||
} else {
|
||||
dicShop.get(o.shop).push(o);
|
||||
dicShopByType.get(key).items.push(o);
|
||||
}
|
||||
dicShopItem.set(o.id, o);
|
||||
});
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
// 商店表
|
||||
import { readFileAndParse, parseNumberList } from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
|
||||
export interface DicShopList {
|
||||
// 商店id
|
||||
readonly shopid: number;
|
||||
// 商店名
|
||||
readonly shopname: number;
|
||||
// 商店内标签,小分类
|
||||
readonly type: number[];
|
||||
// 使用的货币
|
||||
readonly money: number[];
|
||||
}
|
||||
|
||||
export const dicShopList = new Map<number, DicShopList>();
|
||||
export function loadShopList() {
|
||||
dicShopList.clear();
|
||||
|
||||
let arr = readFileAndParse(FILENAME.DIC_SHOP_LIST);
|
||||
|
||||
arr.forEach(o => {
|
||||
o.type = parseNumberList(o.typeid);
|
||||
o.money = parseNumberList(o.moneyid);
|
||||
dicShopList.set(o.shopid, o);
|
||||
});
|
||||
arr = undefined;
|
||||
}
|
||||
26
shared/pubUtils/dictionary/DicShopType.ts
Normal file
26
shared/pubUtils/dictionary/DicShopType.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
// 商店表
|
||||
import { readFileAndParse } from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
|
||||
export interface DicShopType {
|
||||
// 商店id
|
||||
readonly shop: number;
|
||||
// 商店内标签,小分类
|
||||
readonly type: number;
|
||||
// 是否限时
|
||||
readonly isLimit: boolean;
|
||||
}
|
||||
|
||||
export const dicShopType = new Map<string, DicShopType>(); // shop+type => DicShopType
|
||||
export function loadShopType() {
|
||||
dicShopType.clear();
|
||||
let arr = readFileAndParse(FILENAME.DIC_SHOP_TYPE);
|
||||
|
||||
arr.forEach(o => {
|
||||
o.type = o.typeid;
|
||||
if(o.shop != '&') {
|
||||
dicShopType.set(`${o.shop}_${o.type}`, o);
|
||||
}
|
||||
});
|
||||
arr = undefined;
|
||||
}
|
||||
Reference in New Issue
Block a user