修改最大星级错误日志补充

This commit is contained in:
liwei1dao 2024-01-18 16:40:00 +08:00
parent 411293356f
commit 6f40d053ff
6 changed files with 77 additions and 14 deletions

View File

@ -1,6 +1,7 @@
package hero
import (
"fmt"
"go_dreamfactory/comm"
"go_dreamfactory/pb"
cfg "go_dreamfactory/sys/configure/structs"
@ -129,7 +130,16 @@ func (this *apiComp) Awaken(session comm.IUserSession, req *pb.HeroAwakenReq) (e
}
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype121, 1, cfg.Race))
if err != nil { // 达到满级觉醒
if _hero.Lv == this.module.configure.GetHeroMaxLv(_hero.Star) && bManAwaken {
var maxlv int32
if maxlv, err = this.module.configure.GetHeroMaxLv(_hero.Star); err != nil {
errdata = &pb.ErrorData{
Code: pb.ErrorCode_ConfigNoFound,
Title: pb.ErrorCode_ConfigNoFound.ToString(),
Message: fmt.Sprintf("cid:%s id:%s err:%s", _hero.HeroID, _hero.Id, err.Error()),
}
return
}
if _hero.Lv == maxlv && bManAwaken {
tasks = append(tasks, comm.GetBuriedParam2(comm.Rtype37, _hero.HeroID, cfg.Color))
tasks = append(tasks, comm.GetBuriedParam2(comm.Rtype38, _hero.HeroID))
tasks = append(tasks, comm.GetBuriedParam2(comm.Rtype36, _hero.HeroID, cfg.Color, cfg.Job, cfg.Race, _hero.JuexingLv))

View File

@ -30,6 +30,8 @@ func (this *apiComp) StrengthenUplv(session comm.IUserSession, req *pb.HeroStren
cost []*cfg.Gameatn // 消耗的道具
award []*cfg.Gameatn
atno []*pb.UserAtno
maxlv int32
err error
)
if errdata = this.StrengthenUplvCheck(session, req); errdata != nil {
return
@ -79,7 +81,14 @@ func (this *apiComp) StrengthenUplv(session comm.IUserSession, req *pb.HeroStren
return
}
// 校验当前能不能升级
if _hero.Lv >= this.module.configure.GetHeroMaxLv(_hero.Star) { // 达到最大等级
if maxlv, err = this.module.configure.GetHeroMaxLv(_hero.Star); err != nil {
errdata = &pb.ErrorData{
Code: pb.ErrorCode_ConfigNoFound,
Message: fmt.Sprintf("cid:%s id:%s err:%s", _hero.HeroID, _hero.Id, err.Error()),
}
return
}
if _hero.Lv >= maxlv { // 达到最大等级
errdata = &pb.ErrorData{
Code: pb.ErrorCode_HeroMaxLv,
Title: pb.ErrorCode_HeroMaxLv.ToString(),

View File

@ -204,7 +204,16 @@ func (this *apiComp) TalentLearn(session comm.IUserSession, req *pb.HeroTalentLe
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype40, 1, int32(len(talent.Talent))))
_, err = this.module.configure.GetHeroAwakenConfig(heroObj.HeroID, heroObj.JuexingLv+1)
if err != nil { // 达到满级觉醒
if heroObj.Lv == this.module.configure.GetHeroMaxLv(heroObj.Star) {
var maxlv int32
if maxlv, err = this.module.configure.GetHeroMaxLv(heroObj.Star); err != nil {
errdata = &pb.ErrorData{
Code: pb.ErrorCode_ConfigNoFound,
Title: pb.ErrorCode_ConfigNoFound.ToString(),
Message: fmt.Sprintf("cid:%s id:%s err:%s", heroObj.HeroID, heroObj.Id, err.Error()),
}
return
}
if heroObj.Lv == maxlv {
if this.module.configure.GetHeroTalentMaxLv(heroObj.HeroID) == int32(len(talent.Talent)) {
tasks = append(tasks, comm.GetBuriedParam2(comm.Rtype37, heroObj.HeroID, cfg.Color))

View File

@ -448,18 +448,20 @@ func (this *configureComp) GetHeroSkillCost(star int32) (cost []*cfg.Gameatn) {
}
// 获取英雄最大等级
func (this *configureComp) GetHeroMaxLv(star int32) int32 {
if v, err := this.GetConfigure(hero_stargrow); err == nil {
func (this *configureComp) GetHeroMaxLv(star int32) (maxlv int32, err error) {
var (
v interface{}
)
if v, err = this.GetConfigure(hero_stargrow); err == nil {
if configure, ok := v.(*cfg.GameHeroStargrow); ok {
if configure.Get(star) != nil {
return configure.Get(star).Maxlevel
maxlv = configure.Get(star).Maxlevel
return
}
}
}
this.module.Errorf(" GetHeroMaxLv err : star:%d", star)
return 1
err = fmt.Errorf("GetHeroMaxLv err : star:%d", star)
return
}
func (this *configureComp) GetHeroTalentMaxLv(heroid string) (maxlv int32) {
if v, err := this.GetConfigure(hero_talentbox); err == nil {

View File

@ -3,6 +3,7 @@ package hero
import (
"crypto/rand"
"errors"
"fmt"
"go_dreamfactory/comm"
"go_dreamfactory/lego/core"
"go_dreamfactory/modules"
@ -431,7 +432,13 @@ func (this *ModelHero) AddCardExp(session comm.IUserSession, heros []*pb.DBHero,
curLv = hero.Lv
preLv = curLv
var maxLv int32 // 校验等级达到上限
maxLv = this.module.configure.GetHeroMaxLv(hero.Star)
if maxLv, err = this.module.configure.GetHeroMaxLv(hero.Star); err != nil {
errdata = &pb.ErrorData{
Code: pb.ErrorCode_ConfigNoFound,
Message: fmt.Sprintf("cid:%s id:%s err:%s", hero.HeroID, hero.Id, err.Error()),
}
return
}
// 校验玩家等级
if user, err = this.module.GetUserForSession(session); err != nil {
errdata = &pb.ErrorData{
@ -542,7 +549,16 @@ func (this *ModelHero) AddCardExp(session comm.IUserSession, heros []*pb.DBHero,
//xx英雄满级、共鸣、觉醒至最高状态
nextAwaken, _ := this.module.configure.GetHeroAwakenConfig(hero.HeroID, hero.JuexingLv+1)
if nextAwaken == nil { // 达到满级觉醒
if hero.Lv == this.module.configure.GetHeroMaxLv(hero.Star) {
var maxlv int32
if maxlv, err = this.module.configure.GetHeroMaxLv(hero.Star); err != nil {
errdata = &pb.ErrorData{
Code: pb.ErrorCode_ConfigNoFound,
Title: pb.ErrorCode_ConfigNoFound.ToString(),
Message: fmt.Sprintf("cid:%s id:%s err:%s", hero.HeroID, hero.Id, err.Error()),
}
return
}
if hero.Lv == maxlv {
var _l int32
talent, err := this.module.modelTalent.GetHerotalent(session.GetUserId())
if err == nil {

View File

@ -2,6 +2,7 @@ package hero
import (
"context"
"fmt"
"go_dreamfactory/comm"
"go_dreamfactory/lego/core"
"go_dreamfactory/lego/sys/event"
@ -433,7 +434,14 @@ func (this *Hero) GetAllMaxHero(session comm.IUserSession, bTalent bool) (errdat
// 获取最大星级
maxStar = this.configure.GetHeroMaxStar(cid, v.Star)
maxLv := this.configure.GetHeroMaxLv(maxStar) // 最大等级
maxLv, err := this.configure.GetHeroMaxLv(maxStar)
if err != nil { // 最大等级
errdata = &pb.ErrorData{
Code: pb.ErrorCode_ConfigNoFound,
Title: pb.ErrorCode_ConfigNoFound.ToString(),
Message: fmt.Sprintf("cid:%s err:%s", cid, err.Error()),
}
}
maxJux := 1 // 最大觉醒等级
for i := 1; ; i++ {
@ -606,7 +614,16 @@ func (this *Hero) RegisterInstructor(session comm.IUserSession, heroOid []string
_heroMap["fulllvenr"] = 0
} else if v.Fulllvenr == 0 && fulllvenr != 0 {
// 校验有没有满级
if v.Lv < this.configure.GetHeroMaxLv(v.Star) {
var maxlv int32
if maxlv, err = this.configure.GetHeroMaxLv(v.Star); err != nil {
errdata = &pb.ErrorData{
Code: pb.ErrorCode_ConfigNoFound,
Title: pb.ErrorCode_ConfigNoFound.ToString(),
Message: fmt.Sprintf("cid:%s id:%s err:%s", v.HeroID, v.Id, err.Error()),
}
return
}
if v.Lv < maxlv {
errdata = &pb.ErrorData{
Code: pb.ErrorCode_HeroLvNoEnough,
Title: pb.ErrorCode_HeroLvNoEnough.ToString(),