From b79d9cb6c0b6a304ddd631ff47c9c0ade8a7758c Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Tue, 5 Sep 2023 10:42:45 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E9=AB=98=E5=93=81=E8=B4=A8=E6=89=93?= =?UTF-8?q?=E9=80=A0=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/smithy/api_forgeequip.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/smithy/api_forgeequip.go b/modules/smithy/api_forgeequip.go index 9f214eaa7..f8cd37fda 100644 --- a/modules/smithy/api_forgeequip.go +++ b/modules/smithy/api_forgeequip.go @@ -226,7 +226,7 @@ func (this *apiComp) ForgeEquip(session comm.IUserSession, req *pb.SmithyForgeEq } } // 装备资源分发 - if customLv > 0 { + if customLv > 0 || bQuality { for i := 0; i < int(req.Count); i++ { sz := make([]int32, 4) // 最高 4个品质 // 获得极品权重 From bf96d301b0f4d83c1701b6fea4a973cee01efb16 Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Tue, 5 Sep 2023 11:43:17 +0800 Subject: [PATCH 2/3] =?UTF-8?q?#33705=20=E5=AD=90=E4=BB=BB=E5=8A=A1=20?= =?UTF-8?q?=E3=80=90=E6=A2=A6=E5=B7=A5=E5=9C=BA=E7=B3=BB=E7=BB=9F=E3=80=91?= =?UTF-8?q?=20<-=E5=90=8E=E7=AB=AF->=20=E3=80=90=E9=93=81=E5=8C=A0?= =?UTF-8?q?=E7=A0=B4=E3=80=91=E5=9B=BE=E9=89=B4=E9=9C=80=E8=A6=81=E4=B8=80?= =?UTF-8?q?=E9=94=AE=E6=BF=80=E6=B4=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/smithy/api_atlasactivate.go | 119 ++++++++++++++++------------ modules/smithy/api_atlasaward.go | 2 +- modules/smithy/module.go | 4 +- 3 files changed, 72 insertions(+), 53 deletions(-) diff --git a/modules/smithy/api_atlasactivate.go b/modules/smithy/api_atlasactivate.go index 06077a8c2..e91539926 100644 --- a/modules/smithy/api_atlasactivate.go +++ b/modules/smithy/api_atlasactivate.go @@ -7,12 +7,7 @@ import ( // 参数校验 func (this *apiComp) AtlasActivateCheck(session comm.IUserSession, req *pb.SmithyAtlasActivateReq) (errdata *pb.ErrorData) { - if req.Id == "" { - errdata = &pb.ErrorData{ - Code: pb.ErrorCode_ReqParameterError, - Title: pb.ErrorCode_ReqParameterError.ToString(), - } - } + return } @@ -21,7 +16,9 @@ func (this *apiComp) AtlasActivate(session comm.IUserSession, req *pb.SmithyAtla var ( addScore int32 // 更新图鉴增加的积分 szTask []*pb.BuriedParam + update map[string]interface{} ) + update = make(map[string]interface{}, 0) if errdata = this.AtlasActivateCheck(session, req); errdata != nil { return // 参数校验失败直接返回 } @@ -34,67 +31,89 @@ func (this *apiComp) AtlasActivate(session comm.IUserSession, req *pb.SmithyAtla } return } - conf, err := this.module.configure.GetSmithyAtlasConf(req.Id) - if err != nil { - errdata = &pb.ErrorData{ - Code: pb.ErrorCode_SmithyNoFoundAtlas, - Title: pb.ErrorCode_SmithyNoFoundAtlas.ToString(), - } - return - } - if conf.TypeId == 1 { - if v, ok := atlas.Atlas[req.Id]; ok { - if !v.Activate { // 激活 + + if req.Id == "" { // 一键激活 + for _, v := range atlas.Atlas { + if !v.Activate { v.Activate = true addScore = v.Data1.Score - } else { //更新操作 - if v.Data2 != nil { - addScore = v.Data2.Score - v.Data1.Score - if addScore < 0 { // 异常校验 防止配置修改导致分数减少 - addScore = 0 - } - v.Data1 = v.Data2 - v.Data2 = nil - } else { - errdata = &pb.ErrorData{ - Code: pb.ErrorCode_SmithyNoActivateAtlas, - Title: pb.ErrorCode_SmithyNoActivateAtlas.ToString(), - } - return + } + if v.Data2 != nil { + addScore = v.Data2.Score - v.Data1.Score + if addScore < 0 { // 异常校验 防止配置修改导致分数减少 + addScore = 0 } + v.Data1 = v.Data2 + v.Data2 = nil } - update := make(map[string]interface{}, 0) - update["atlas"] = atlas.Atlas atlas.Score += addScore - update["score"] = atlas.Score - this.module.modelAtlas.modifySmithyAtlasList(session.GetUserId(), update) - } else { - errdata = &pb.ErrorData{ - Code: pb.ErrorCode_SmithyNoFoundAtlas, - Title: pb.ErrorCode_SmithyNoFoundAtlas.ToString(), - } - return } - - } else if conf.TypeId == 2 { - if v, ok := atlas.Collect[req.Id]; ok { + update["atlas"] = atlas.Atlas + for _, v := range atlas.Collect { if !v.Activate { // 激活 v.Activate = true - - update := make(map[string]interface{}, 0) - update["collect"] = atlas.Collect atlas.Score += v.Score - update["score"] = atlas.Score - this.module.modelAtlas.modifySmithyAtlasList(session.GetUserId(), update) } - } else { + } + } else { + conf, err := this.module.configure.GetSmithyAtlasConf(req.Id) + if err != nil { errdata = &pb.ErrorData{ Code: pb.ErrorCode_SmithyNoFoundAtlas, Title: pb.ErrorCode_SmithyNoFoundAtlas.ToString(), } return } + if conf.TypeId == 1 { + if v, ok := atlas.Atlas[req.Id]; ok { + if !v.Activate { // 激活 + v.Activate = true + addScore = v.Data1.Score + } else { //更新操作 + if v.Data2 != nil { + addScore = v.Data2.Score - v.Data1.Score + if addScore < 0 { // 异常校验 防止配置修改导致分数减少 + addScore = 0 + } + v.Data1 = v.Data2 + v.Data2 = nil + } else { + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_SmithyNoActivateAtlas, + Title: pb.ErrorCode_SmithyNoActivateAtlas.ToString(), + } + return + } + } + update["atlas"] = atlas.Atlas + atlas.Score += addScore + update["score"] = atlas.Score + } else { + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_SmithyNoFoundAtlas, + Title: pb.ErrorCode_SmithyNoFoundAtlas.ToString(), + } + return + } + + } else if conf.TypeId == 2 { + if v, ok := atlas.Collect[req.Id]; ok { + if !v.Activate { // 激活 + v.Activate = true + atlas.Score += v.Score + } + } else { + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_SmithyNoFoundAtlas, + Title: pb.ErrorCode_SmithyNoFoundAtlas.ToString(), + } + return + } + } } + update["score"] = atlas.Score + update["collect"] = atlas.Collect + this.module.modelAtlas.modifySmithyAtlasList(session.GetUserId(), update) szTask = append(szTask, comm.GetBuriedParam(comm.Rtype165, 1)) szTask = append(szTask, comm.GetBuriedParam(comm.Rtype166, int32(len(atlas.Collect)))) szTask = append(szTask, comm.GetBuriedParam(comm.Rtype167, atlas.Score)) diff --git a/modules/smithy/api_atlasaward.go b/modules/smithy/api_atlasaward.go index df6f2288e..c0fd1937e 100644 --- a/modules/smithy/api_atlasaward.go +++ b/modules/smithy/api_atlasaward.go @@ -32,7 +32,7 @@ func (this *apiComp) AtlasAward(session comm.IUserSession, req *pb.SmithyAtlasAw return } for { - conf, err := this.module.configure.GetSmithyAtlasLvConf(atlas.Award + 1) + conf, err := this.module.configure.GetSmithyAtlasLvConf(atlas.Award) if err != nil { break } diff --git a/modules/smithy/module.go b/modules/smithy/module.go index 5fe1f99a7..b1eb5af62 100644 --- a/modules/smithy/module.go +++ b/modules/smithy/module.go @@ -76,7 +76,7 @@ func (this *Smithy) CheckActivateAtlasCollect(uid string, id string) { atlas.Collect[id] = &pb.CollectData{ Id: id, - Score: 0, + Score: atlasConf.AtlasScore, Time: configure.Now().Unix(), Activate: false, } @@ -94,7 +94,7 @@ func (this *Smithy) CheckActivateAtlasCollect(uid string, id string) { if _, ok := atlas.Collect[id]; !ok { atlas.Collect[id] = &pb.CollectData{ Id: id, - Score: 0, + Score: atlasConf.AtlasScore, Time: configure.Now().Unix(), Activate: false, } From f8c118c3bb1852fac0dafae02f32c318f14980de Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Tue, 5 Sep 2023 13:54:38 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E9=93=81=E5=8C=A0=E9=93=BA=E8=97=8F?= =?UTF-8?q?=E5=93=81=E5=9B=BE=E9=89=B4=E7=A7=AF=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/smithy/module.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/modules/smithy/module.go b/modules/smithy/module.go index b1eb5af62..008fdadbe 100644 --- a/modules/smithy/module.go +++ b/modules/smithy/module.go @@ -107,12 +107,11 @@ func (this *Smithy) CheckActivateAtlasCollect(uid string, id string) { } } } else { - if list, err := this.modelAtlas.getSmithyAtlasList(uid); err == nil { if _, ok := list.Collect[id]; !ok { list.Collect[id] = &pb.CollectData{ Id: id, - Score: 0, + Score: atlasConf.AtlasScore, Time: configure.Now().Unix(), Activate: false, }