This commit is contained in:
aozhiwei 2024-11-22 13:39:49 +08:00
parent 66f9775489
commit 1244a13981
5 changed files with 74 additions and 0 deletions

View File

@ -0,0 +1,15 @@
package mt
import (
"f5"
"main/mtb"
)
type Buff struct {
mtb.Buff
buffList []int32
}
type BuffTable struct {
f5.IdMetaTable[Buff]
}

View File

@ -14,6 +14,7 @@ type table struct {
Global *GlobalTable
Reward *RewardTable
Task *TaskTable
Buff *BuffTable
}
var Table = f5.New(func(this *table) {
@ -62,4 +63,9 @@ var Table = f5.New(func(this *table) {
this.PrimKey = "id"
})
this.Buff = f5.New(func(this *BuffTable) {
this.FileName = "../res/buff@buff.json"
this.PrimKey = "buff_id"
})
})

View File

@ -88,6 +88,15 @@ type Task struct {
_flags2_ uint64
}
type Buff struct {
buff_id int32
buff_effect int32
duration_time int32
_flags1_ uint64
_flags2_ uint64
}
type Config struct {
_flags1_ uint64
@ -382,6 +391,30 @@ func (this *Task) HasReward() bool {
return (this._flags1_ & (uint64(1) << 7)) > 0
}
func (this *Buff) GetBuffId() int32 {
return this.buff_id
}
func (this *Buff) HasBuffId() bool {
return (this._flags1_ & (uint64(1) << 1)) > 0
}
func (this *Buff) GetBuffEffect() int32 {
return this.buff_effect
}
func (this *Buff) HasBuffEffect() bool {
return (this._flags1_ & (uint64(1) << 2)) > 0
}
func (this *Buff) GetDurationTime() int32 {
return this.duration_time
}
func (this *Buff) HasDurationTime() bool {
return (this._flags1_ & (uint64(1) << 3)) > 0
}
func (this *WheelServerCluster) LoadFromKv(kv map[string]interface{}) {
f5.ReadMetaTableField(&this.instance_id, "instance_id", &this._flags1_, 1, kv)
@ -443,5 +476,11 @@ func (this *Task) LoadFromKv(kv map[string]interface{}) {
f5.ReadMetaTableField(&this.reward, "reward", &this._flags1_, 7, kv)
}
func (this *Buff) LoadFromKv(kv map[string]interface{}) {
f5.ReadMetaTableField(&this.buff_id, "buff_id", &this._flags1_, 1, kv)
f5.ReadMetaTableField(&this.buff_effect, "buff_effect", &this._flags1_, 2, kv)
f5.ReadMetaTableField(&this.duration_time, "duration_time", &this._flags1_, 3, kv)
}
func (this *Config) LoadFromKv(kv map[string]interface{}) {
}

View File

@ -70,6 +70,13 @@ message Task
optional int32 reward = 7;
}
message Buff
{
optional int32 buff_id = 1;
optional int32 buff_effect = 2;
optional int32 duration_time = 3;
}
message Config
{
}

View File

@ -4,6 +4,7 @@ import (
"f5"
"main/model"
"main/constant"
"main/mt"
)
type buff struct {
@ -24,4 +25,10 @@ func (this *buff) List(accountId string) (error, []*model.Buff) {
}
func (this *buff) Add(accountId string, buffList []int32) {
for buffId := range(buffList) {
buffMeta := mt.Table.Buff.GetById(int64(buffId))
if buffMeta != nil {
}
}
}