// Code generated by excel export. DO NOT EDIT. package data import ( "f1-game/internal/enum" "f1-game/internal/types" ) var ExchangeGoods = &exchangeGoodsConfig{} func init() { _allList = append(_allList, ExchangeGoods) } type ( ExchangeGoodsRow struct { ID int32 `json:"ID"` // 商品ID ExchangeType enum.ExchangeType `json:"ExchangeType"` // 交易所类型 ItemType enum.ExchangeItemType `json:"ItemType"` // 商品分类 ItemID int32 `json:"ItemID"` // 交易道具ID MinPrice int32 `json:"MinPrice"` // 单位价格区间(下限) MaxPrice int32 `json:"MaxPrice"` // 单位价区间(上限) UnitQty int32 `json:"unitQty"` // 数量单位 MaxCount int32 `json:"MaxCount"` // 最大数量 MinCount int32 `json:"MinCount"` // 最小数量 FeeRate int32 `json:"FeeRate"` // 手续费(百分比) MinFee int32 `json:"MinFee"` // 最低手续费 UnbindCost types.Assets `json:"UnbindCost"` // 装备解绑消耗 } exchangeGoodsConfig struct { baseConfig list []*ExchangeGoodsRow // all list idUniMaps map[int32]*ExchangeGoodsRow // key:id } ) func (p *exchangeGoodsConfig) Name() string { return "exchange_goods" } func (p *exchangeGoodsConfig) Init() { p.idUniMaps = map[int32]*ExchangeGoodsRow{} } func (p *exchangeGoodsConfig) OnLoad(maps interface{}, reload bool) (int, error) { if reload && p.denyLoad { return 0, nil } var list []*ExchangeGoodsRow if err := DecodeData(maps, &list); err != nil { return 0, err } p.list = list idUniMaps := map[int32]*ExchangeGoodsRow{} for _, row := range list { idUniMaps[row.ID] = row } p.idUniMaps = idUniMaps return len(list), nil } // func (p *exchangeGoodsConfig) OnAfterLoad(_ bool) { // } func (p *exchangeGoodsConfig) List() []*ExchangeGoodsRow { return p.list } func (p *exchangeGoodsConfig) GetByID(id int32) (*ExchangeGoodsRow, bool) { value, found := p.idUniMaps[id] return value, found } func (p *exchangeGoodsConfig) ContainID(id int32) bool { _, found := p.idUniMaps[id] return found }