ecs/servers/game/data_old/rig_character_star_ext.go
2025-06-04 18:17:39 +08:00

39 lines
937 B
Go

package data
import (
"github.com/oylshe1314/framework/errors"
"github.com/oylshe1314/framework/util"
)
func (this *RigCharacterStarTable) check() error {
for _, d := range this.l {
if len(d.CostItemNum) != len(d.CostItemId) {
return errors.Error("incorrect 'RigCharacterStars' table, error: len(d.CostItemNum) != len(d.CostItemId), id: ", d.id())
}
}
return nil
}
type RigCharacterStarTableExtend struct {
*RigCharacterStarTable
extMap map[uint64]*RigCharacterStar
}
func (this *RigCharacterStarTableExtend) init() error {
if this.RigCharacterStarTable == nil {
return nil
}
this.extMap = map[uint64]*RigCharacterStar{}
for _, d := range this.l {
this.extMap[util.Compose2uint32(uint32(d.ItemId), uint32(d.StarLevel))] = d
}
return nil
}
func (this *RigCharacterStarTableExtend) Get(itemId, starLevel int) *RigCharacterStar {
return this.extMap[util.Compose2uint32(uint32(itemId), uint32(starLevel))]
}