狩猎优化

This commit is contained in:
meixiongfeng 2022-12-23 16:21:15 +08:00
parent 7a0858de04
commit 8195cb6a76
4 changed files with 13 additions and 19 deletions

View File

@ -91,7 +91,7 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.EnchantCha
} }
} }
mapData["challengeTime"] = enchant.BossTime mapData["bossTime"] = enchant.BossTime
mapData["boss"] = enchant.Boss mapData["boss"] = enchant.Boss
code = this.module.ModifyEnchantData(session.GetUserId(), mapData) code = this.module.ModifyEnchantData(session.GetUserId(), mapData)
session.SendMsg(string(this.module.GetType()), EnchantChallengeOverResp, &pb.EnchantChallengeOverResp{Data: enchant}) session.SendMsg(string(this.module.GetType()), EnchantChallengeOverResp, &pb.EnchantChallengeOverResp{Data: enchant})

View File

@ -52,14 +52,12 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.HuntingChallen
} }
value, ok := hunting.Boss[req.BossType] value, ok := hunting.Boss[req.BossType]
if !ok { // 类型校验 if !ok { // 类型校验
hunting.Boss[req.BossType] = 0 hunting.Boss[req.BossType] = 1
} }
if value < req.Difficulty { if value < req.Difficulty {
if value+1 != req.Difficulty {
code = pb.ErrorCode_HuntingLvErr code = pb.ErrorCode_HuntingLvErr
return return
} }
}
code, record := this.module.battle.CreatePveBattle(session, &pb.BattlePVEReq{ code, record := this.module.battle.CreatePveBattle(session, &pb.BattlePVEReq{
Ptype: pb.PlayType_hunting, Ptype: pb.PlayType_hunting,

View File

@ -61,15 +61,15 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.HuntingCha
} }
value, ok := hunting.Boss[req.BossType] value, ok := hunting.Boss[req.BossType]
if !ok { // 类型校验 if !ok { // 类型校验
hunting.Boss[req.BossType] = 0 hunting.Boss[req.BossType] = 1
} }
if value < req.Difficulty { if value == req.Difficulty {
if value+1 != req.Difficulty {
newChallenge = true
} else if value < req.Difficulty {
code = pb.ErrorCode_HuntingLvErr code = pb.ErrorCode_HuntingLvErr
return return
} }
newChallenge = true
}
// 校验门票数量够不够 // 校验门票数量够不够
if code = this.module.ConsumeRes(session, []*cfg.Gameatn{costRes}, true); code != pb.ErrorCode_Success { if code = this.module.ConsumeRes(session, []*cfg.Gameatn{costRes}, true); code != pb.ErrorCode_Success {
return return
@ -104,10 +104,8 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.HuntingCha
mapData["boss"] = hunting.Boss mapData["boss"] = hunting.Boss
} }
for k := range hunting.Boss {
hunting.Boss[k] += 1 mapData["bossTime"] = hunting.BossTime
}
mapData["challengeTime"] = hunting.BossTime
code = this.module.ModifyHuntingData(session.GetUserId(), mapData) code = this.module.ModifyHuntingData(session.GetUserId(), mapData)
session.SendMsg(string(this.module.GetType()), HuntingChallengeOverResp, &pb.HuntingChallengeOverResp{Data: hunting}) session.SendMsg(string(this.module.GetType()), HuntingChallengeOverResp, &pb.HuntingChallengeOverResp{Data: hunting})

View File

@ -173,9 +173,7 @@ func (this *Hunting) CompleteAllLevel(session comm.IUserSession) (code pb.ErrorC
} }
mapData["boss"] = list.Boss mapData["boss"] = list.Boss
code = this.ModifyHuntingData(session.GetUserId(), mapData) code = this.ModifyHuntingData(session.GetUserId(), mapData)
for k := range list.Boss {
list.Boss[k] += 1
}
session.SendMsg(string(this.GetType()), HuntingGetListResp, &pb.HuntingGetListResp{Data: list}) session.SendMsg(string(this.GetType()), HuntingGetListResp, &pb.HuntingGetListResp{Data: list})
return return
} }