35 lines
752 B
Go
35 lines
752 B
Go
![]() |
package data
|
||
|
|
||
|
import "github.com/oylshe1314/framework/util"
|
||
|
|
||
|
type RigComponentTableExtend struct {
|
||
|
*RigComponentTable
|
||
|
|
||
|
extList []*RigComponent
|
||
|
extMap map[uint64]*RigComponent
|
||
|
}
|
||
|
|
||
|
func (this *RigComponentTableExtend) init() error {
|
||
|
if this.RigComponentTable == nil {
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
this.extMap = map[uint64]*RigComponent{}
|
||
|
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 *RigComponentTableExtend) List() []*RigComponent {
|
||
|
return this.extList
|
||
|
}
|
||
|
|
||
|
func (this *RigComponentTableExtend) Get(itemId, level int) *RigComponent {
|
||
|
return this.extMap[util.Compose2uint32(uint32(itemId), uint32(level))]
|
||
|
}
|