From 783063f8e2f691ca8db5bb8ad4da6a45acc4e66f Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Fri, 24 Feb 2023 20:24:02 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=9B=BE=E7=BA=B8=E7=86=9F=E7=BB=83?= =?UTF-8?q?=E5=BA=A6=E5=88=9D=E5=A7=8B1=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/comp_configure.go | 1 + modules/smithy/api_forgeequip.go | 4 +-- modules/smithy/comp_configure.go | 52 ++++++++++++++++++++++++++++++++ 3 files changed, 55 insertions(+), 2 deletions(-) diff --git a/modules/comp_configure.go b/modules/comp_configure.go index c373a155a..762d72e88 100644 --- a/modules/comp_configure.go +++ b/modules/comp_configure.go @@ -235,6 +235,7 @@ func (this *MCompConfigure) GetDropReward(dropId int32) (result []*cfg.Gameatn) return } + func (this *MCompConfigure) GetColor(id int32) (item *cfg.GameGameColorData, err error) { var ( v interface{} diff --git a/modules/smithy/api_forgeequip.go b/modules/smithy/api_forgeequip.go index 258c7c0c6..3ca871556 100644 --- a/modules/smithy/api_forgeequip.go +++ b/modules/smithy/api_forgeequip.go @@ -54,7 +54,7 @@ func (this *apiComp) ForgeEquip(session comm.IUserSession, req *pb.SmithyForgeEq return } stove.Data[req.ReelId] = &pb.Mastery{ - Lv: 0, + Lv: 1, Value: 0, } } @@ -150,8 +150,8 @@ func (this *apiComp) ForgeEquip(session comm.IUserSession, req *pb.SmithyForgeEq return } } else { - res := this.module.configure.GetDropReward(reelcfg.BasicDrop) + //res := this.module.configure.GetSmithyDropReward(reelcfg.BasicDrop) if err, atno := this.module.DispenseAtno(session, res, true); err == pb.ErrorCode_Success { for _, v := range atno { if eq, err1 := this.module.ModuleEquipment.QueryEquipment(session.GetUserId(), v.O); err1 == pb.ErrorCode_Success { diff --git a/modules/smithy/comp_configure.go b/modules/smithy/comp_configure.go index 42c68ebde..6dc1cbc8d 100644 --- a/modules/smithy/comp_configure.go +++ b/modules/smithy/comp_configure.go @@ -1,6 +1,7 @@ package smithy import ( + "go_dreamfactory/comm" "go_dreamfactory/lego/core" "go_dreamfactory/lego/sys/log" "go_dreamfactory/modules" @@ -35,6 +36,7 @@ type configureComp struct { _mapProficile map[int64]*cfg.GameSmithyProficiencyData // 熟练度 key 卷轴ID+ 等级 _mapskill map[int64]*cfg.GameSmithyToolData // 熟练度 key 技能类型+ 技能等级等级 _mapAtlasScore map[int64]*cfg.GameSmithyAtlasScoreData // 图鉴积分 + _dropMap map[int32][]*cfg.GameSmithyDropData // 掉落表 key 是DiropId } // 组件初始化接口 @@ -73,6 +75,9 @@ func (this *configureComp) Init(service core.IService, module core.IModule, comp err = this.LoadConfigure(game_smithyatlaslv, cfg.NewGameSmithyAtlasLv) err = this.LoadConfigure(game_smithyatlasscore, cfg.NewGameSmithyAtlasScore) err = this.LoadConfigure(game_smithytask, cfg.NewGameSmithyTask) + + this._dropMap = make(map[int32][]*cfg.GameSmithyDropData, 0) + configure.RegisterConfigure(game_smithyDrop, cfg.NewGameSmithyDrop, this.LoadSmithyDropData) return } @@ -304,3 +309,50 @@ func (this *configureComp) GetSmithyTask(taskId int32) (data *cfg.GameSmithyTask this.module.Errorf("GetSmithyTask notfound taskId:%d", taskId) return } + +func (this *configureComp) GetSmithyDropData(dropId int32) (data []*cfg.GameSmithyDropData) { + data = this._dropMap[dropId] + return +} + +func (this *configureComp) GetSmithyDropReward(dropId int32) (result []*cfg.Gameatn) { + result = make([]*cfg.Gameatn, 0) + + data := this.GetSmithyDropData(dropId) + if len(data) == 0 { + return + } + szW := make([]int32, 0) + for _, value := range data { + szW = append(szW, value.P) + } + index := comm.GetRandW(szW) + result = append(result, data[index].Prize...) + + return +} +func (this *configureComp) LoadSmithyDropData() { + + if v, err := this.GetConfigure(game_smithyDrop); err == nil { + if configure, ok := v.(*cfg.GameSmithyDrop); ok { + this.hlock.Lock() + defer this.hlock.Unlock() + for _, value := range configure.GetDataList() { + if value.Condition == 0 { + this._dropMap[value.Dropid] = append(this._dropMap[value.Dropid], value) + } else { + key := value.Condition + key = value.Dropid*100 + key + this._dropMap[key] = append(this._dropMap[key], value) + for _, v1 := range this._dropMap[value.Dropid] { + this._dropMap[key] = append(this._dropMap[key], v1) + } + } + } + } + + } else { + log.Errorf("get game_pagoda conf err:%v", err) + } + return +} From 5e354c6bd674fe3e027d515eee4d57869b76a551 Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Fri, 24 Feb 2023 20:31:30 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=8A=A5=E9=94=99=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/dispatch/api_do.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/dispatch/api_do.go b/modules/dispatch/api_do.go index 113dbcd44..6b0cb4f8d 100644 --- a/modules/dispatch/api_do.go +++ b/modules/dispatch/api_do.go @@ -4,7 +4,7 @@ import ( "go_dreamfactory/comm" "go_dreamfactory/pb" - "github.com/golang/protobuf/proto" + "google.golang.org/protobuf/proto" ) // 派遣