Merge branch 'dev' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
a5c989583d
@ -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(),
|
||||
}
|
||||
return
|
||||
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
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
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(),
|
||||
}
|
||||
return
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
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
|
||||
}
|
||||
|
@ -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)
|
||||
|
@ -206,7 +206,6 @@ type JielongRewardReq struct {
|
||||
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
|
||||
}
|
||||
|
||||
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 (
|
||||
|
Loading…
Reference in New Issue
Block a user