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