| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- // Code generated by excel export. DO NOT EDIT.
- package data
- import (
- "f1-game/internal/enum"
- "f1-game/internal/types"
- )
- var EquipLevel = &equipLevelConfig{}
- func init() {
- _allList = append(_allList, EquipLevel)
- }
- type (
- EquipLevelRow struct {
- Quality enum.Quality `json:"Quality"` // 品质
- Level int32 `json:"Level"` // 等级
- EnhanceCosts types.Assets `json:"EnhanceCosts"` // 强化消耗
- DimantleRewards types.Assets `json:"DimantleRewards"` // 分解所得
- SuccessProb int32 `json:"SuccessProb"` // 成功概率
- BaseAttrAddPer int64 `json:"BaseAttrAddPer"` // 基础属性提升万分比
- }
- equipLevelConfig struct {
- baseConfig
- list []*EquipLevelRow // all list
- qualityLevelUniMaps map[enum.Quality]map[int32]*EquipLevelRow // key:quality, level
- }
- )
- func (p *equipLevelConfig) Name() string {
- return "equip_level"
- }
- func (p *equipLevelConfig) Init() {
- p.qualityLevelUniMaps = map[enum.Quality]map[int32]*EquipLevelRow{}
- }
- func (p *equipLevelConfig) OnLoad(maps interface{}, reload bool) (int, error) {
- if reload && p.denyLoad {
- return 0, nil
- }
- var list []*EquipLevelRow
- if err := DecodeData(maps, &list); err != nil {
- return 0, err
- }
- p.list = list
- qualityLevelUniMaps := map[enum.Quality]map[int32]*EquipLevelRow{}
- for _, row := range list {
- itemMap := qualityLevelUniMaps[row.Quality]
- if itemMap == nil {
- itemMap = map[int32]*EquipLevelRow{}
- qualityLevelUniMaps[row.Quality] = itemMap
- }
- itemMap[row.Level] = row
- }
- p.qualityLevelUniMaps = qualityLevelUniMaps
- return len(list), nil
- }
- // func (p *equipLevelConfig) OnAfterLoad(_ bool) {
- // }
- func (p *equipLevelConfig) List() []*EquipLevelRow {
- return p.list
- }
- func (p *equipLevelConfig) GetByQualityLevel(quality enum.Quality, level int32) (*EquipLevelRow, bool) {
- mapItem, found := p.qualityLevelUniMaps[quality]
- if !found {
- return nil, false
- }
- value, found := mapItem[level]
- return value, found
- }
- func (p *equipLevelConfig) ContainQualityLevel(quality enum.Quality, level int32) bool {
- mapItem, found := p.qualityLevelUniMaps[quality]
- if !found {
- return false
- }
- _, found = mapItem[level]
- return found
- }
|