战斗奖励优化
This commit is contained in:
parent
f0dcc396d8
commit
203e75da21
@ -5,6 +5,7 @@ import (
|
|||||||
"go_dreamfactory/pb"
|
"go_dreamfactory/pb"
|
||||||
"go_dreamfactory/sys/configure"
|
"go_dreamfactory/sys/configure"
|
||||||
cfg "go_dreamfactory/sys/configure/structs"
|
cfg "go_dreamfactory/sys/configure/structs"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
@ -22,7 +23,6 @@ func (this *apiComp) ChallengeOverCheck(session comm.IUserSession, req *pb.Vikin
|
|||||||
func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.VikingChallengeOverReq) (code pb.ErrorCode, data proto.Message) {
|
func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.VikingChallengeOverReq) (code pb.ErrorCode, data proto.Message) {
|
||||||
var (
|
var (
|
||||||
mapData map[string]interface{}
|
mapData map[string]interface{}
|
||||||
newChallenge bool // 新的关卡
|
|
||||||
reward []*cfg.Gameatn
|
reward []*cfg.Gameatn
|
||||||
asset []*pb.UserAssets
|
asset []*pb.UserAssets
|
||||||
bWin bool // 战斗是否胜利
|
bWin bool // 战斗是否胜利
|
||||||
@ -63,9 +63,7 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.VikingChal
|
|||||||
if !ok { // 类型校验
|
if !ok { // 类型校验
|
||||||
viking.Boss[req.BossId] = 1
|
viking.Boss[req.BossId] = 1
|
||||||
}
|
}
|
||||||
if value == req.Difficulty {
|
if value < req.Difficulty {
|
||||||
newChallenge = true
|
|
||||||
} else if value < req.Difficulty {
|
|
||||||
code = pb.ErrorCode_HuntingLvErr
|
code = pb.ErrorCode_HuntingLvErr
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -90,11 +88,8 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.VikingChal
|
|||||||
mapData["recoveryTime"] = viking.RecoveryTime
|
mapData["recoveryTime"] = viking.RecoveryTime
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if bWin {
|
key := strconv.Itoa(int(req.BossId)) + "_" + strconv.Itoa(int(req.Difficulty))
|
||||||
this.module.CheckRank(session.GetUserId(), req.BossId, req.Difficulty, viking, req.Report)
|
if viking.BossTime[key] == 0 { // 新关卡挑战通过 发放首通奖励
|
||||||
}
|
|
||||||
mapData["bossTime"] = viking.BossTime // 更新时间
|
|
||||||
if newChallenge && bWin { // 新关卡挑战通过 发放首通奖励
|
|
||||||
viking.Boss[req.BossId]++
|
viking.Boss[req.BossId]++
|
||||||
mapData["boss"] = viking.Boss
|
mapData["boss"] = viking.Boss
|
||||||
if code = this.module.DispenseRes(session, vikingCfg.Firstprize, true); code != pb.ErrorCode_Success {
|
if code = this.module.DispenseRes(session, vikingCfg.Firstprize, true); code != pb.ErrorCode_Success {
|
||||||
@ -107,7 +102,9 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.VikingChal
|
|||||||
N: v.N,
|
N: v.N,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
if bWin {
|
||||||
|
this.module.CheckRank(session.GetUserId(), req.BossId, req.Difficulty, viking, req.Report)
|
||||||
reward = this.module.configure.GetDropReward(vikingCfg.Drop) // 获取掉落奖励
|
reward = this.module.configure.GetDropReward(vikingCfg.Drop) // 获取掉落奖励
|
||||||
if code = this.module.DispenseRes(session, reward, true); code != pb.ErrorCode_Success {
|
if code = this.module.DispenseRes(session, reward, true); code != pb.ErrorCode_Success {
|
||||||
return
|
return
|
||||||
@ -120,6 +117,8 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.VikingChal
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
mapData["bossTime"] = viking.BossTime // 更新时间
|
||||||
|
|
||||||
code = this.module.ModifyVikingData(session.GetUserId(), mapData)
|
code = this.module.ModifyVikingData(session.GetUserId(), mapData)
|
||||||
// 发放通关随机奖励
|
// 发放通关随机奖励
|
||||||
session.SendMsg(string(this.module.GetType()), VikingChallengeOverResp, &pb.VikingChallengeOverResp{
|
session.SendMsg(string(this.module.GetType()), VikingChallengeOverResp, &pb.VikingChallengeOverResp{
|
||||||
|
Loading…
Reference in New Issue
Block a user