英雄等级获取修改

This commit is contained in:
meixiongfeng 2023-02-28 16:40:51 +08:00
parent 338c1d9a4e
commit fe2bec7979
8 changed files with 23 additions and 25 deletions

View File

@ -42,10 +42,6 @@ type Autogenerated struct {
D []interface{} D []interface{}
} }
const (
HeroStarLvRatio int32 = 10 // 卡牌等级上限系数(星级*10
)
//Api Check 错误返回结构 //Api Check 错误返回结构
type ErrorCode struct { type ErrorCode struct {
Code pb.ErrorCode Code pb.ErrorCode

View File

@ -69,7 +69,7 @@ func (this *GM) CreateCmd(session comm.IUserSession, cmd string) (code pb.ErrorC
this.Debugf("create CMD :%s", cmd) // 打印个日志方便查询 this.Debugf("create CMD :%s", cmd) // 打印个日志方便查询
datas := strings.Split(keys[1], ",") datas := strings.Split(keys[1], ",")
if len(datas) == 3 && (datas[0] == comm.AttrType || datas[0] == comm.ItemType || if len(datas) == 3 && (datas[0] == comm.AttrType || datas[0] == comm.ItemType ||
datas[0] == comm.HeroType || datas[0] == comm.EquipmentType || datas[0] == comm.VipType || datas[0] == comm.PandaType) { datas[0] == comm.HeroType || datas[0] == comm.EquipmentType || datas[0] == comm.VipType || datas[0] == comm.AtlasType || datas[0] == comm.PandaType) {
num, err := strconv.Atoi(datas[2]) num, err := strconv.Atoi(datas[2])
if err != nil { if err != nil {
code = pb.ErrorCode_ReqParameterError code = pb.ErrorCode_ReqParameterError

View File

@ -124,7 +124,7 @@ func (this *apiComp) Awaken(session comm.IUserSession, req *pb.HeroAwakenReq) (c
//xx英雄满级、共鸣、觉醒至最高状态 //xx英雄满级、共鸣、觉醒至最高状态
nextAwaken := this.module.configure.GetHeroAwakenConfig(_hero.HeroID, _hero.JuexingLv+1) nextAwaken := this.module.configure.GetHeroAwakenConfig(_hero.HeroID, _hero.JuexingLv+1)
if nextAwaken == nil { // 达到满级觉醒 if nextAwaken == nil { // 达到满级觉醒
if _hero.Lv == _hero.Star*comm.HeroStarLvRatio { if _hero.Lv == this.module.configure.GetHeroMaxLv(_hero.Star) {
this.module.ModuleRtask.SendToRtask(session, comm.Rtype37, 1, cfg.Color) this.module.ModuleRtask.SendToRtask(session, comm.Rtype37, 1, cfg.Color)
this.module.ModuleRtask.SendToRtask(session, comm.Rtype38, 1) this.module.ModuleRtask.SendToRtask(session, comm.Rtype38, 1)
} }

View File

@ -10,7 +10,7 @@ import (
//参数校验 //参数校验
func (this *apiComp) GetSpecifiedCheck(session comm.IUserSession, req *pb.HeroGetSpecifiedReq) (code pb.ErrorCode) { func (this *apiComp) GetSpecifiedCheck(session comm.IUserSession, req *pb.HeroGetSpecifiedReq) (code pb.ErrorCode) {
if req.HeroCoinfigID == "" || req.Star > 6 || req.Lv > 6*comm.HeroStarLvRatio { if req.HeroCoinfigID == "" || req.Star <= 0 || req.Lv <= 0 {
code = pb.ErrorCode_ReqParameterError code = pb.ErrorCode_ReqParameterError
return return
} }

View File

@ -66,7 +66,7 @@ func (this *apiComp) StrengthenUplv(session comm.IUserSession, req *pb.HeroStren
return return
} }
// 校验当前能不能升级 // 校验当前能不能升级
if _hero.Lv > _hero.Star*comm.HeroStarLvRatio { // 达到最大等级 if _hero.Lv >= this.module.configure.GetHeroMaxLv(_hero.Star) { // 达到最大等级
code = pb.ErrorCode_HeroMaxLv code = pb.ErrorCode_HeroMaxLv
return return
} }

View File

@ -471,18 +471,6 @@ func (this *configureComp) GetShopItemsConfigureByGroups(groupid int32, user *pb
} }
return return
} }
func (this *configureComp) GetHeroStargrowConfigByStar(star int32) int32 {
if v, err := this.GetConfigure(hero_stargrow); err == nil {
if configure, ok := v.(*cfg.GameHeroStargrow); ok {
return configure.Get(star).Maxlevel
}
} else {
err = fmt.Errorf("%T no is *cfg.GameHero", v)
}
return 1
}
// 获取英雄升级属性变化相关配置数据 // 获取英雄升级属性变化相关配置数据
func (this *configureComp) GetEquipsuit(id int32) (configure *cfg.GameEquipSuitData, err error) { func (this *configureComp) GetEquipsuit(id int32) (configure *cfg.GameEquipSuitData, err error) {
@ -511,3 +499,17 @@ func (this *configureComp) GetHeroSkillCost(star int32) (cost []*cfg.Gameatn) {
} }
return return
} }
// 获取英雄最大等级
func (this *configureComp) GetHeroMaxLv(star int32) int32 {
if v, err := this.GetConfigure(hero_stargrow); err == nil {
if configure, ok := v.(*cfg.GameHeroStargrow); ok {
return configure.Get(star).Maxlevel
}
} else {
err = fmt.Errorf("%T no is *cfg.GameHero", v)
}
return 1
}

View File

@ -504,7 +504,7 @@ func (this *ModelHero) AddCardExp(session comm.IUserSession, hero *pb.DBHero, ex
curLv = hero.Lv curLv = hero.Lv
preLv = curLv preLv = curLv
var maxLv int32 // 校验等级达到上限 var maxLv int32 // 校验等级达到上限
maxLv = hero.Star * comm.HeroStarLvRatio maxLv = this.moduleHero.configure.GetHeroMaxLv(hero.Star)
_data := this.moduleHero.configure.GetHeroLv(curLv) _data := this.moduleHero.configure.GetHeroLv(curLv)
if _data != nil { if _data != nil {
var maxExp int32 var maxExp int32
@ -577,7 +577,7 @@ func (this *ModelHero) AddCardExp(session comm.IUserSession, hero *pb.DBHero, ex
//xx英雄满级、共鸣、觉醒至最高状态 //xx英雄满级、共鸣、觉醒至最高状态
nextAwaken := this.moduleHero.configure.GetHeroAwakenConfig(hero.HeroID, hero.JuexingLv+1) nextAwaken := this.moduleHero.configure.GetHeroAwakenConfig(hero.HeroID, hero.JuexingLv+1)
if nextAwaken == nil { // 达到满级觉醒 if nextAwaken == nil { // 达到满级觉醒
if hero.Lv == hero.Star*comm.HeroStarLvRatio { if hero.Lv == this.moduleHero.configure.GetHeroMaxLv(hero.Star) {
this.moduleHero.ModuleRtask.SendToRtask(session, comm.Rtype37, 1, cfg.Color) this.moduleHero.ModuleRtask.SendToRtask(session, comm.Rtype37, 1, cfg.Color)
this.moduleHero.ModuleRtask.SendToRtask(session, comm.Rtype38, 1) this.moduleHero.ModuleRtask.SendToRtask(session, comm.Rtype38, 1)
} }

View File

@ -220,7 +220,7 @@ func (this *Hero) GetSpecifiedHero(session comm.IUserSession, heroConfId string,
// 获取最大星级 // 获取最大星级
maxStar = this.configure.GetHeroMaxStar(cid, conf.Star) maxStar = this.configure.GetHeroMaxStar(cid, conf.Star)
maxLv := this.configure.GetHeroStargrowConfigByStar(maxStar) // 最大等级 maxLv := this.configure.GetHeroMaxLv(maxStar) // 最大等级
if star > maxStar || lv > maxLv { if star > maxStar || lv > maxLv {
code = pb.ErrorCode_ReqParameterError code = pb.ErrorCode_ReqParameterError
return return
@ -629,7 +629,7 @@ func (this *Hero) GetAllMaxHero(session comm.IUserSession) (code pb.ErrorCode) {
// 获取最大星级 // 获取最大星级
maxStar = this.configure.GetHeroMaxStar(cid, v.Star) maxStar = this.configure.GetHeroMaxStar(cid, v.Star)
maxLv := this.configure.GetHeroStargrowConfigByStar(maxStar) // 最大等级 maxLv := this.configure.GetHeroMaxLv(maxStar) // 最大等级
maxJux := 1 // 最大觉醒等级 maxJux := 1 // 最大觉醒等级
for i := 1; ; i++ { for i := 1; ; i++ {
@ -806,7 +806,7 @@ func (this *Hero) RegisterInstructor(session comm.IUserSession, heroOid string,
if _hero.Fulllvenr == 0 { if _hero.Fulllvenr == 0 {
// 校验有没有满级 // 校验有没有满级
if _hero.Lv < _hero.Star*comm.HeroStarLvRatio { if _hero.Lv < this.configure.GetHeroMaxLv(_hero.Star) {
code = pb.ErrorCode_HeroLvNoEnough // 必须满级 code = pb.ErrorCode_HeroLvNoEnough // 必须满级
return return
} }