This commit is contained in:
aozhiwei 2024-06-14 13:17:25 +08:00
parent 2bc0efc771
commit 94e1427ac6
4 changed files with 55 additions and 0 deletions

View File

@ -0,0 +1,14 @@
package mt
import (
"f5"
"mtb"
)
type Item struct {
mtb.Item
}
type ItemTable struct {
f5.IdMetaTable[Item]
}

View File

@ -8,6 +8,7 @@ type table struct {
MarketServerCluster *MarketServerClusterTable
NftDb *NftDbTable
Config *ConfigTable
Item *ItemTable
}
var Table = f5.New(func(this *table) {
@ -26,4 +27,9 @@ var Table = f5.New(func(this *table) {
this.PrimKey = ""
})
this.Item = f5.New(func(this *ItemTable) {
this.FileName = "../config/item.json"
this.PrimKey = ""
})
})

View File

@ -31,6 +31,14 @@ type Config struct {
_flags2_ uint64
}
type Item struct {
name string
item_id int32
_flags1_ uint64
_flags2_ uint64
}
func (this *MarketServerCluster) GetInstanceId() int32 {
return this.instance_id
}
@ -103,6 +111,22 @@ func (this *Config) HasGameapiUrl() bool {
return (this._flags1_ & (uint64(1) << 1)) > 0
}
func (this *Item) GetName() string {
return this.name
}
func (this *Item) HasName() bool {
return (this._flags1_ & (uint64(1) << 1)) > 0
}
func (this *Item) GetItemId() int32 {
return this.item_id
}
func (this *Item) HasItemId() bool {
return (this._flags1_ & (uint64(1) << 2)) > 0
}
func (this *MarketServerCluster) LoadFromKv(kv map[string]interface{}) {
f5.ReadMetaTableField(&this.instance_id, "instance_id", &this._flags1_, 1, kv)
@ -121,3 +145,8 @@ func (this *NftDb) LoadFromKv(kv map[string]interface{}) {
func (this *Config) LoadFromKv(kv map[string]interface{}) {
f5.ReadMetaTableField(&this.gameapi_url, "gameapi_url", &this._flags1_, 1, kv)
}
func (this *Item) LoadFromKv(kv map[string]interface{}) {
f5.ReadMetaTableField(&this.name, "name", &this._flags1_, 1, kv)
f5.ReadMetaTableField(&this.item_id, "item_id", &this._flags1_, 2, kv)
}

View File

@ -22,3 +22,9 @@ message Config
{
optional string gameapi_url = 1;
}
message Item
{
optional string name = 1;
optional int32 item_id = 2;
}