Merge branch 'bs_2.0.6.28' of http://git.legu.cc/liwei_3d/go_dreamfactory into bs_2.0.6.28

This commit is contained in:
liwei 2023-07-17 18:06:22 +08:00
commit 40b420d60e
4 changed files with 25 additions and 31 deletions

View File

@ -47,7 +47,8 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.HuntingChallen
return
}
if v1, ok := hunting.Ps[req.BossType]; !ok || v1 == 0 {
pskey := req.BossType<<8 + req.Difficulty
if v1, ok := hunting.Ps[pskey]; !ok || v1 == 0 {
for _, v := range cfgData.PsConsume {
if v.A == "attr" && v.T == "ps" {
@ -69,24 +70,20 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.HuntingChallen
return
}
hunting.Ps[req.BossType] = ps
hunting.Ps[pskey] = ps
this.module.modelHunting.modifyHuntingDataByObjId(session.GetUserId(), map[string]interface{}{
"ps": hunting.Ps,
})
}
if errdata = this.module.CheckRes(session, cfgData.PsConsume); errdata != nil {
if req.AutoBuy { // 不够的时候看是否能自动购买
resSell := this.module.ModuleTools.GetGlobalConf().PsItem
if errdata = this.module.CheckRes(session, []*cfg.Gameatn{resSell}); errdata != nil {
return
}
m := make(map[string]int32, 0)
m[resSell.T] = resSell.N
this.module.ModuleItems.SellItem(session, m, true)
} else {
if req.AutoBuy { // 不够的时候看是否能自动购买
resSell := this.module.ModuleTools.GetGlobalConf().PsItem
if errdata = this.module.CheckRes(session, []*cfg.Gameatn{resSell}); errdata != nil {
return
}
m := make(map[string]int32, 0)
m[resSell.T] = resSell.N
this.module.ModuleItems.SellItem(session, m, true)
}
value, ok := hunting.Boss[req.BossType]

View File

@ -74,10 +74,10 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.HuntingCha
hunting.Boss[req.BossType] = req.Difficulty
mapData["boss"] = hunting.Boss
}
pskey := req.BossType<<8 + req.Difficulty
errdata, bWin = this.module.battle.CheckBattleReport(session, req.Report)
consumPs = hunting.Ps[req.BossType]
hunting.Ps[req.BossType] = 0 // 清空预扣体力值
consumPs = hunting.Ps[pskey]
hunting.Ps[pskey] = 0 // 清空预扣体力值
mapData["ps"] = hunting.Ps
if !bWin { // 战斗失败了 直接返回

View File

@ -37,8 +37,8 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.VikingChalleng
}
return
}
if v1, ok := viking.Ps[req.BossId]; !ok || v1 == 0 {
pskey := req.BossId<<8 + req.Difficulty
if v1, ok := viking.Ps[pskey]; !ok || v1 == 0 {
for _, v := range cfgData.PsConsume {
if v.A == "attr" && v.T == "ps" {
@ -59,26 +59,22 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.VikingChalleng
return
}
viking.Ps[req.BossId] = ps
viking.Ps[pskey] = ps
this.module.modelViking.modifyVikingDataByObjId(session.GetUserId(), map[string]interface{}{
"ps": viking.Ps,
})
}
if errdata = this.module.CheckRes(session, cfgData.PsConsume); errdata != nil {
if req.AutoBuy { // 不够的时候自动使用
resSell := this.module.ModuleTools.GetGlobalConf().PsItem
if errdata = this.module.CheckRes(session, []*cfg.Gameatn{resSell}); errdata != nil {
return
}
m := make(map[string]int32, 0)
m[resSell.T] = resSell.N
this.module.ModuleItems.SellItem(session, m, true)
} else { // 体力不够
if req.AutoBuy { // 不够的时候自动使用
resSell := this.module.ModuleTools.GetGlobalConf().PsItem
if errdata = this.module.CheckRes(session, []*cfg.Gameatn{resSell}); errdata != nil {
return
}
m := make(map[string]int32, 0)
m[resSell.T] = resSell.N
this.module.ModuleItems.SellItem(session, m, true)
}
if req.Difficulty == 1 && viking.Boss[req.BossId] == 0 { // 当前难度第一次打

View File

@ -79,8 +79,9 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.VikingChal
}
errdata, bWin = this.module.battle.CheckBattleReport(session, req.Report)
consumPs = viking.Ps[req.BossId]
viking.Ps[req.BossId] = 0 // 清空预扣体力值
pskey := req.BossId<<8 + req.Difficulty
consumPs = viking.Ps[pskey]
viking.Ps[pskey] = 0 // 清空预扣体力值
mapData["ps"] = viking.Ps
if !bWin { // 战斗失败了 直接返回
if errdata = this.module.DispenseRes(session, vikingCfg.PsConsume, true); errdata != nil { // 返还预扣体力