// 商店商品表 import { readFileAndParse } from '../util' import { FILENAME } from '../../consts' export interface DicShop { // 商品id readonly id: number; // 物品表id readonly goodid: number; // 物品表名 readonly goodname: number; // 商店id 对应 dic_zyz_shoplist的id readonly shop: number; // 商店标签 对应 dic_zyz_shopType的id readonly type: number; // 军团等级需求 readonly guildLvLimit: number; // 玩家等级需求 readonly lvlimit: number; // 购买次数限制 readonly purchaseLimit: number; // 刷新类型 1-每日 2-每周 3-每月 readonly refreshType: number; // 用于购买的货币 readonly money: number; // 价格 readonly price: number; } export const dicShopItem = new Map(); // itemid => DicShop export const dicShop = new Map(); // shop => DicShop[] export function loadShop() { dicShopItem.clear(); dicShop.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; if(!dicShop.has(o.shop)) { dicShop.set(o.shop, [o]); } else { dicShop.get(o.shop).push(o); } dicShopItem.set(o.id, o); }); arr = undefined; }