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