| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- // Code generated by excel export. DO NOT EDIT.
- package data
- type (
- EquipAttrExtraRow struct {
- PoolID int32 `json:"PoolID"` // 池ID
- No int32 `json:"No"` // 序号
- Key int32 `json:"Key"` // 属性键
- MinValue int64 `json:"MinValue"` // 最小属性值
- MaxValue int64 `json:"MaxValue"` // 最大属性值
- Weight int32 `json:"Weight"` // 权重
- }
- equipAttrExtraConfig struct {
- baseConfig
- list []*EquipAttrExtraRow // all list
- poolIDNoUniMaps map[int32]map[int32]*EquipAttrExtraRow // key:poolID, no
- }
- )
- func (p *equipAttrExtraConfig) Name() string {
- return "equip_attr_extra"
- }
- func (p *equipAttrExtraConfig) Init() {
- p.poolIDNoUniMaps = map[int32]map[int32]*EquipAttrExtraRow{}
- }
- func (p *equipAttrExtraConfig) OnLoad(maps interface{}, reload bool) (int, error) {
- if reload && p.denyLoad {
- return 0, nil
- }
- var list []*EquipAttrExtraRow
- if err := DecodeData(maps, &list); err != nil {
- return 0, err
- }
- p.list = list
- poolIDNoUniMaps := map[int32]map[int32]*EquipAttrExtraRow{}
- for _, row := range list {
- itemMap := poolIDNoUniMaps[row.PoolID]
- if itemMap == nil {
- itemMap = map[int32]*EquipAttrExtraRow{}
- poolIDNoUniMaps[row.PoolID] = itemMap
- }
- itemMap[row.No] = row
- }
- p.poolIDNoUniMaps = poolIDNoUniMaps
- return len(list), nil
- }
- // func (p *equipAttrExtraConfig) OnAfterLoad(_ bool) {
- // }
- func (p *equipAttrExtraConfig) List() []*EquipAttrExtraRow {
- return p.list
- }
- func (p *equipAttrExtraConfig) GetByPoolIDNo(poolID int32, no int32) (*EquipAttrExtraRow, bool) {
- mapItem, found := p.poolIDNoUniMaps[poolID]
- if !found {
- return nil, false
- }
- value, found := mapItem[no]
- return value, found
- }
- func (p *equipAttrExtraConfig) ContainPoolIDNo(poolID int32, no int32) bool {
- mapItem, found := p.poolIDNoUniMaps[poolID]
- if !found {
- return false
- }
- _, found = mapItem[no]
- return found
- }
|