package data import ( "github.com/oylshe1314/framework/errors" "github.com/oylshe1314/framework/util" ) func (this *RigCharacterTable) check() error { for _, d := range this.l { if len(d.CostItemNum) != len(d.CostItemId) { return errors.Error("incorrect 'RigCharacter' table, error: len(d.CostItemNum) != len(d.CostItemId), id: ", d.id()) } } return nil } type RigCharacterTableExtend struct { *RigCharacterTable extList []*RigCharacter //The list of the level 1 characters extMap map[uint64]*RigCharacter } func (this *RigCharacterTableExtend) init() error { if this.RigCharacterTable == nil { return nil } this.extMap = map[uint64]*RigCharacter{} for _, d := range this.l { if d.Level == 1 { this.extList = append(this.extList, d) } this.extMap[util.Compose2uint32(uint32(d.ItemId), uint32(d.Level))] = d } return nil } func (this *RigCharacterTableExtend) List() []*RigCharacter { return this.extList } func (this *RigCharacterTableExtend) Get(itemId, level int) *RigCharacter { return this.extMap[util.Compose2uint32(uint32(itemId), uint32(level))] }