From 083ed3c371b142914b53be53c5a74f5e85493255 Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Tue, 17 Oct 2023 10:26:34 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E9=93=81=E5=8C=A0=E9=93=BA=E9=AB=98?= =?UTF-8?q?=E6=98=9F=E6=89=93=E9=80=A0=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/smithy/api_forgeequip.go | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/modules/smithy/api_forgeequip.go b/modules/smithy/api_forgeequip.go index fee9995d0..6a6c4b174 100644 --- a/modules/smithy/api_forgeequip.go +++ b/modules/smithy/api_forgeequip.go @@ -222,8 +222,9 @@ func (this *apiComp) ForgeEquip(session comm.IUserSession, req *pb.SmithyForgeEq } } // 装备资源分发 - if customLv > 0 || bQuality { + if customLv > 0 { for i := 0; i < int(req.Count); i++ { + sz := make([]int32, 4) // 最高 4个品质 // 获得极品权重 sz[3] = this.module.modelStove.StoveToolsQualityProbability(stove) @@ -236,6 +237,32 @@ func (this *apiComp) ForgeEquip(session comm.IUserSession, req *pb.SmithyForgeEq } } + } else if bQuality { // 精炼打造 + newdrop := this.module.modelStove.CheckUnlockSuid(req.ReelId, stove.Data[req.ReelId].Lv, reelcfg.BasicDrop) + user, err := this.module.ModuleUser.GetUser(session.GetUserId()) + if err != nil { + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_SystemError, + Title: pb.ErrorCode_SystemError.ToString(), + } + return + } + var addEquipId []string // 添加的装备ID + for i := 0; i < int(req.Count); i++ { + res := this.module.ModuleTools.GetGroupDataByLottery(newdrop, user.Vip, user.Lv) + for _, v := range res { + if v.A == "equi" { + addEquipId = append(addEquipId, v.T) + } + } + } + if equip, errcode1 := this.module.ModuleEquipment.NewMaxQualityEquipment(session, addEquipId); err != nil { + errdata = errcode1 + this.module.Errorf("GetForgeEquip error: %v,req.SuiteId:%d, req.Position:%d, customLv:%d", errdata, req.SuiteId, req.Position, customLv) + return + } else { + rsp.Equip = append(rsp.Equip, equip...) + } } else { // 普通打造 // 获取掉落id newdrop := this.module.modelStove.CheckUnlockSuid(req.ReelId, stove.Data[req.ReelId].Lv, reelcfg.BasicDrop) @@ -247,6 +274,7 @@ func (this *apiComp) ForgeEquip(session comm.IUserSession, req *pb.SmithyForgeEq } return } + // 检查是否命中双倍打造 for i := 0; i < int(req.Count); i++ { res := this.module.ModuleTools.GetGroupDataByLottery(newdrop, user.Vip, user.Lv) From cfbe3558bc58ee1a16daf75c87a301f76cc4142c Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Tue, 17 Oct 2023 10:58:27 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=8E=A5=E9=BE=99=E5=A5=96=E5=8A=B1?= =?UTF-8?q?=E6=94=B9=E4=B8=80=E9=94=AE=E9=A2=86=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/jielong/api_reward.go | 71 ++++++++++++++++++----------------- pb/jielong_msg.pb.go | 32 ++++++---------- 2 files changed, 47 insertions(+), 56 deletions(-) diff --git a/modules/jielong/api_reward.go b/modules/jielong/api_reward.go index f902c813b..51fac19c0 100644 --- a/modules/jielong/api_reward.go +++ b/modules/jielong/api_reward.go @@ -3,16 +3,12 @@ package jielong import ( "go_dreamfactory/comm" "go_dreamfactory/pb" + cfg "go_dreamfactory/sys/configure/structs" ) // 参数校验 func (this *apiComp) RewardCheck(session comm.IUserSession, req *pb.JielongRewardReq) (errdata *pb.ErrorData) { - if req.Rewardkey == 0 { - errdata = &pb.ErrorData{ - Code: pb.ErrorCode_ReqParameterError, - Title: pb.ErrorCode_ReqParameterError.ToString(), - } - } + return } @@ -21,6 +17,8 @@ func (this *apiComp) Reward(session comm.IUserSession, req *pb.JielongRewardReq) list *pb.DBJielongData err error update map[string]interface{} + res []*cfg.Gameatn // 奖励 + atno []*pb.UserAtno ) update = make(map[string]interface{}, 0) if errdata = this.RewardCheck(session, req); errdata != nil { @@ -37,13 +35,7 @@ func (this *apiComp) Reward(session comm.IUserSession, req *pb.JielongRewardReq) return } if req.Cur { - if _, ok := list.Reward[req.Rewardkey]; ok { - errdata = &pb.ErrorData{ - Code: pb.ErrorCode_UserRepeadReward, - Title: pb.ErrorCode_UserRepeadReward.ToString(), - } - return - } + if c, e := this.module.configure.getGameFastDataByType(1); e != nil { errdata = &pb.ErrorData{ Code: pb.ErrorCode_ConfigNoFound, @@ -51,24 +43,18 @@ func (this *apiComp) Reward(session comm.IUserSession, req *pb.JielongRewardReq) } return } else { - if _, ok := c[req.Rewardkey]; !ok { - errdata = &pb.ErrorData{ - Code: pb.ErrorCode_ConfigNoFound, - Title: pb.ErrorCode_ConfigNoFound.ToString(), + for _, v := range c { + if list.Wincount >= v.Condition { + if _, ok := c[v.Condition]; !ok { + res = append(res, v.Reward...) + list.Reward[v.Condition] = 1 + + } } - return } + update["reward"] = list.Reward } - list.Reward[req.Rewardkey] = 1 - update["reward"] = list.Reward } else { - if _, ok := list.Gotarr[req.Rewardkey]; ok { - errdata = &pb.ErrorData{ - Code: pb.ErrorCode_UserRepeadReward, - Title: pb.ErrorCode_UserRepeadReward.ToString(), - } - return - } if c, e := this.module.configure.getGameFastDataByType(2); e != nil { errdata = &pb.ErrorData{ Code: pb.ErrorCode_ConfigNoFound, @@ -76,18 +62,33 @@ func (this *apiComp) Reward(session comm.IUserSession, req *pb.JielongRewardReq) } return } else { - if _, ok := c[req.Rewardkey]; !ok { - errdata = &pb.ErrorData{ - Code: pb.ErrorCode_ConfigNoFound, - Title: pb.ErrorCode_ConfigNoFound.ToString(), + for _, v := range c { + if list.Hisotry >= v.Condition { + if _, ok := c[v.Condition]; !ok { + res = append(res, v.Reward...) + list.Gotarr[v.Condition] = 1 + } } - return } + update["gotarr"] = list.Gotarr } - list.Gotarr[req.Rewardkey] = 1 - update["gotarr"] = list.Gotarr + } + if len(res) > 0 { + errdata, atno = this.module.DispenseAtno(session, res, true) + if errdata != nil { + return + } + } else { // 没有奖励可以领取 + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_UserRepeadReward, + Title: pb.ErrorCode_UserRepeadReward.ToString(), + } + return } this.module.modelJielong.changeJielongData(session.GetUserId(), update) - session.SendMsg(string(this.module.GetType()), "reward", &pb.JielongRewardResp{}) + session.SendMsg(string(this.module.GetType()), "reward", &pb.JielongRewardResp{ + Data: list, + Res: atno, + }) return } diff --git a/pb/jielong_msg.pb.go b/pb/jielong_msg.pb.go index f48de94ce..3dc72df33 100644 --- a/pb/jielong_msg.pb.go +++ b/pb/jielong_msg.pb.go @@ -205,8 +205,7 @@ type JielongRewardReq struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Cur bool `protobuf:"varint,1,opt,name=cur,proto3" json:"cur"` // 0 本周奖励 1 历史奖励 - Rewardkey int32 `protobuf:"varint,2,opt,name=rewardkey,proto3" json:"rewardkey"` // 奖励key + Cur bool `protobuf:"varint,1,opt,name=cur,proto3" json:"cur"` // 0 本周奖励 1 历史奖励 } func (x *JielongRewardReq) Reset() { @@ -248,20 +247,13 @@ func (x *JielongRewardReq) GetCur() bool { return false } -func (x *JielongRewardReq) GetRewardkey() int32 { - if x != nil { - return x.Rewardkey - } - return 0 -} - type JielongRewardResp struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields Data *DBJielongData `protobuf:"bytes,1,opt,name=data,proto3" json:"data"` - Res *UserAtno `protobuf:"bytes,2,opt,name=res,proto3" json:"res"` + Res []*UserAtno `protobuf:"bytes,2,rep,name=res,proto3" json:"res"` } func (x *JielongRewardResp) Reset() { @@ -303,7 +295,7 @@ func (x *JielongRewardResp) GetData() *DBJielongData { return nil } -func (x *JielongRewardResp) GetRes() *UserAtno { +func (x *JielongRewardResp) GetRes() []*UserAtno { if x != nil { return x.Res } @@ -328,17 +320,15 @@ var file_jielong_jielong_msg_proto_rawDesc = []byte{ 0x6f, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x22, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x44, 0x42, 0x4a, 0x69, 0x65, 0x6c, 0x6f, 0x6e, 0x67, 0x44, 0x61, 0x74, 0x61, 0x52, 0x04, 0x64, 0x61, 0x74, - 0x61, 0x22, 0x42, 0x0a, 0x10, 0x4a, 0x69, 0x65, 0x6c, 0x6f, 0x6e, 0x67, 0x52, 0x65, 0x77, 0x61, + 0x61, 0x22, 0x24, 0x0a, 0x10, 0x4a, 0x69, 0x65, 0x6c, 0x6f, 0x6e, 0x67, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x52, 0x65, 0x71, 0x12, 0x10, 0x0a, 0x03, 0x63, 0x75, 0x72, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x08, 0x52, 0x03, 0x63, 0x75, 0x72, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x77, 0x61, 0x72, - 0x64, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x72, 0x65, 0x77, 0x61, - 0x72, 0x64, 0x6b, 0x65, 0x79, 0x22, 0x54, 0x0a, 0x11, 0x4a, 0x69, 0x65, 0x6c, 0x6f, 0x6e, 0x67, - 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x52, 0x65, 0x73, 0x70, 0x12, 0x22, 0x0a, 0x04, 0x64, 0x61, - 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x44, 0x42, 0x4a, 0x69, 0x65, - 0x6c, 0x6f, 0x6e, 0x67, 0x44, 0x61, 0x74, 0x61, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x1b, - 0x0a, 0x03, 0x72, 0x65, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x55, 0x73, - 0x65, 0x72, 0x41, 0x74, 0x6e, 0x6f, 0x52, 0x03, 0x72, 0x65, 0x73, 0x42, 0x06, 0x5a, 0x04, 0x2e, - 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x28, 0x08, 0x52, 0x03, 0x63, 0x75, 0x72, 0x22, 0x54, 0x0a, 0x11, 0x4a, 0x69, 0x65, 0x6c, 0x6f, + 0x6e, 0x67, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x52, 0x65, 0x73, 0x70, 0x12, 0x22, 0x0a, 0x04, + 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x44, 0x42, 0x4a, + 0x69, 0x65, 0x6c, 0x6f, 0x6e, 0x67, 0x44, 0x61, 0x74, 0x61, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, + 0x12, 0x1b, 0x0a, 0x03, 0x72, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x09, 0x2e, + 0x55, 0x73, 0x65, 0x72, 0x41, 0x74, 0x6e, 0x6f, 0x52, 0x03, 0x72, 0x65, 0x73, 0x42, 0x06, 0x5a, + 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var (