From 1244a13981750632fe153bfcbc064008c0519410 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Fri, 22 Nov 2024 13:39:49 +0800 Subject: [PATCH] 1 --- server/wheelserver/mt/Buff.go | 15 ++++++++++ server/wheelserver/mt/export.go | 6 ++++ server/wheelserver/mtb/mtb.auto_gen.go | 39 ++++++++++++++++++++++++++ server/wheelserver/proto/mt.proto | 7 +++++ server/wheelserver/service/buff.go | 7 +++++ 5 files changed, 74 insertions(+) create mode 100644 server/wheelserver/mt/Buff.go diff --git a/server/wheelserver/mt/Buff.go b/server/wheelserver/mt/Buff.go new file mode 100644 index 00000000..83ee71c1 --- /dev/null +++ b/server/wheelserver/mt/Buff.go @@ -0,0 +1,15 @@ +package mt + +import ( + "f5" + "main/mtb" +) + +type Buff struct { + mtb.Buff + buffList []int32 +} + +type BuffTable struct { + f5.IdMetaTable[Buff] +} diff --git a/server/wheelserver/mt/export.go b/server/wheelserver/mt/export.go index 4d924a13..40141d45 100644 --- a/server/wheelserver/mt/export.go +++ b/server/wheelserver/mt/export.go @@ -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" + }) + }) diff --git a/server/wheelserver/mtb/mtb.auto_gen.go b/server/wheelserver/mtb/mtb.auto_gen.go index 368bf6e4..49fbb2ef 100644 --- a/server/wheelserver/mtb/mtb.auto_gen.go +++ b/server/wheelserver/mtb/mtb.auto_gen.go @@ -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{}) { } diff --git a/server/wheelserver/proto/mt.proto b/server/wheelserver/proto/mt.proto index 34157e2d..78a9ed0d 100644 --- a/server/wheelserver/proto/mt.proto +++ b/server/wheelserver/proto/mt.proto @@ -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 { } diff --git a/server/wheelserver/service/buff.go b/server/wheelserver/service/buff.go index ae588e30..434610e7 100644 --- a/server/wheelserver/service/buff.go +++ b/server/wheelserver/service/buff.go @@ -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 { + + } + } }