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