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