添加测试代码

This commit is contained in:
liwei1dao 2023-03-24 17:21:17 +08:00
parent e190aaf3ab
commit 7c33752262

View File

@ -2,6 +2,7 @@ package practice
import (
"go_dreamfactory/comm"
"go_dreamfactory/lego/sys/log"
"go_dreamfactory/pb"
"go_dreamfactory/sys/configure"
cfg "go_dreamfactory/sys/configure/structs"
@ -101,7 +102,7 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.PracticeReceiveR
exp = minutes * pillarconfigure.MinExp
}
exp1 += exp
this.module.Debug("基础经验加成", log.Field{Key: "minutes", Value: minutes}, log.Field{Key: "minExp", Value: pillarconfigure.MinExp}, log.Field{Key: "exp1", Value: exp1})
//满级英雄加层
for k, v := range room.Full {
if v > 0 {
@ -112,7 +113,8 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.PracticeReceiveR
if heroconf := this.module.configure.GetHeroConfig(hero.HeroID); heroconf != nil {
if (conf.Camp == 0 || (conf.Camp != 0 && heroconf.Race == conf.Camp)) && (conf.Occupation == 0 || (conf.Occupation != 0 && heroconf.Job == conf.Occupation)) {
// exp1 += int32(math.Floor(float64(v/conf.Register) * float64(conf.ExpBonus) / float64(100) * float64(exp)))
exp1 += minutes * int32(math.Floor(float64(v/conf.Register)*float64(conf.ExpBonus))) * exp
exp1 += minutes * int32(math.Floor(float64(v/conf.Register)*float64(conf.ExpBonus)))
this.module.Debug("满级英雄加成", log.Field{Key: "num", Value: v}, log.Field{Key: "Register", Value: conf.Register}, log.Field{Key: "exp1", Value: exp1})
}
}
}
@ -126,6 +128,7 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.PracticeReceiveR
if tconfigure != nil {
if tconfigure.Exp > 0 { //经验加成
exp1 += int32(math.Floor(float64(exp) * (float64(tconfigure.Exp) / float64(100))))
this.module.Debug("教习经验加成", log.Field{Key: "exp", Value: exp}, log.Field{Key: "tcExp", Value: tconfigure.Exp}, log.Field{Key: "exp1", Value: exp1})
}
if len(tconfigure.Ants) > 0 { //额外道具加成
ants1 = make([]*cfg.Gameatn, 0)
@ -167,6 +170,7 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.PracticeReceiveR
if pconfigure != nil {
if pconfigure.Exp > 0 { //经验加成
exp1 += int32(math.Floor(float64(exp) * (float64(pconfigure.Exp) / float64(100))))
this.module.Debug("道具经验加成", log.Field{Key: "exp", Value: exp}, log.Field{Key: "tcExp", Value: pconfigure.Exp}, log.Field{Key: "exp1", Value: exp1})
}
if len(pconfigure.Ants) > 0 { //额外道具加成
ants2 = make([]*cfg.Gameatn, 0)
@ -205,7 +209,7 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.PracticeReceiveR
}
}
}
this.module.Debug("最终经验加成", log.Field{Key: "exp", Value: exp}, log.Field{Key: "exp1", Value: exp1})
if _, code = this.module.ModuleHero.AddHeroExp(session, pillar.Hero, exp1); code != pb.ErrorCode_Success {
return
}