Merge branch 'dev' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
1d8009f0e0
@ -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
|
||||||
|
@ -94,7 +94,7 @@ type (
|
|||||||
GetAllMaxHero(session IUserSession) (code pb.ErrorCode)
|
GetAllMaxHero(session IUserSession) (code pb.ErrorCode)
|
||||||
|
|
||||||
// 教习登记
|
// 教习登记
|
||||||
RegisterInstructor(session IUserSession, heroCid string, registerId int32) (code pb.ErrorCode)
|
RegisterInstructor(session IUserSession, heroOid string, registerId int32) (code pb.ErrorCode)
|
||||||
}
|
}
|
||||||
|
|
||||||
//玩家
|
//玩家
|
||||||
|
@ -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
|
||||||
|
@ -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)
|
||||||
}
|
}
|
||||||
|
@ -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
|
||||||
}
|
}
|
||||||
|
@ -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
|
||||||
}
|
}
|
||||||
|
@ -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
|
||||||
|
}
|
||||||
|
@ -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)
|
||||||
}
|
}
|
||||||
|
@ -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++ {
|
||||||
@ -798,24 +798,30 @@ func (this *Hero) InRange(heroRecord *pb.DBHeroRecord, strPool []string, update
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *Hero) RegisterInstructor(session comm.IUserSession, heroCid string, fulllvenr int32) (code pb.ErrorCode) {
|
func (this *Hero) RegisterInstructor(session comm.IUserSession, heroOid string, fulllvenr int32) (code pb.ErrorCode) {
|
||||||
list := this.GetHeroList(session.GetUserId())
|
_hero, code := this.GetHeroByObjID(session.GetUserId(), heroOid)
|
||||||
for _, v := range list {
|
if code != pb.ErrorCode_Success {
|
||||||
if v.HeroID == heroCid && v.Fulllvenr == 0 {
|
return
|
||||||
v.Fulllvenr = fulllvenr
|
|
||||||
_heroMap := map[string]interface{}{
|
|
||||||
"fulllvenr": v.Fulllvenr,
|
|
||||||
}
|
}
|
||||||
if err := this.modelHero.ChangeList(session.GetUserId(), v.Id, _heroMap); err != nil {
|
|
||||||
|
if _hero.Fulllvenr == 0 {
|
||||||
|
// 校验有没有满级
|
||||||
|
if _hero.Lv < this.configure.GetHeroMaxLv(_hero.Star) {
|
||||||
|
code = pb.ErrorCode_HeroLvNoEnough // 必须满级
|
||||||
|
return
|
||||||
|
}
|
||||||
|
_hero.Fulllvenr = fulllvenr
|
||||||
|
_heroMap := map[string]interface{}{
|
||||||
|
"fulllvenr": _hero.Fulllvenr,
|
||||||
|
}
|
||||||
|
if err := this.modelHero.ChangeList(session.GetUserId(), _hero.Id, _heroMap); err != nil {
|
||||||
code = pb.ErrorCode_DBError
|
code = pb.ErrorCode_DBError
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
return
|
|
||||||
} else {
|
} else {
|
||||||
code = pb.ErrorCode_HeroIsRegister // 英雄已经注册过
|
code = pb.ErrorCode_HeroIsRegister // 英雄已经注册过
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
|
||||||
code = pb.ErrorCode_HeroNoExist // 英雄不存在
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -49,8 +49,8 @@ func (this *modelMail) MailQueryUserMail(uId string) (mail []*pb.DBMailData, err
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 插入一封新的邮件
|
// 插入一封新的邮件
|
||||||
func (this *modelMail) MailInsertUserMail(mail *pb.DBMailData) (err error) {
|
|
||||||
|
|
||||||
|
func (this *modelMail) MailInsertUserMail(mail *pb.DBMailData) (err error) {
|
||||||
mail.ObjId = primitive.NewObjectID().Hex()
|
mail.ObjId = primitive.NewObjectID().Hex()
|
||||||
mail.Check = false
|
mail.Check = false
|
||||||
mail.Reward = true
|
mail.Reward = true
|
||||||
|
Loading…
Reference in New Issue
Block a user