errdata 对象返回
This commit is contained in:
parent
42becbca4e
commit
04a478e3a9
@ -65,15 +65,18 @@ func (this *apiComp) GotoCity(session comm.IUserSession, req *pb.CaravanGotoCity
|
|||||||
// list.Task = event.Worldtask // 对应世界任务组
|
// list.Task = event.Worldtask // 对应世界任务组
|
||||||
// }
|
// }
|
||||||
} else {
|
} else {
|
||||||
code = pb.ErrorCode_DataNotFound
|
errdata = &pb.ErrorData{
|
||||||
data = &pb.ErrorData{
|
Code: pb.ErrorCode_ConfigNoFound,
|
||||||
Title: pb.GetErrorCodeMsg(code),
|
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
||||||
Message: e.Error(),
|
Message: e.Error(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if list.Curcity == req.City {
|
if list.Curcity == req.City {
|
||||||
code = pb.ErrorCode_TrollCity
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_TrollCity,
|
||||||
|
Title: pb.ErrorCode_TrollCity.ToString(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// 校验门票
|
// 校验门票
|
||||||
|
@ -33,11 +33,10 @@ func (this *apiComp) Awaken(session comm.IUserSession, req *pb.HeroAwakenReq) (e
|
|||||||
)
|
)
|
||||||
_heroMap = make(map[string]interface{}, 0)
|
_heroMap = make(map[string]interface{}, 0)
|
||||||
chanegCard = make([]*pb.DBHero, 0)
|
chanegCard = make([]*pb.DBHero, 0)
|
||||||
code = this.AwakenCheck(session, req) // check
|
if errdata = this.AwakenCheck(session, req); errdata != nil {
|
||||||
if errdata != nil {
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
_hero, code = this.module.GetHeroByObjID(session.GetUserId(), req.HeroObjID)
|
_hero, errdata = this.module.GetHeroByObjID(session.GetUserId(), req.HeroObjID)
|
||||||
if errdata != nil {
|
if errdata != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -49,10 +48,6 @@ func (this *apiComp) Awaken(session comm.IUserSession, req *pb.HeroAwakenReq) (e
|
|||||||
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
||||||
Message: err.Error(),
|
Message: err.Error(),
|
||||||
}
|
}
|
||||||
data = &pb.ErrorData{
|
|
||||||
Title: pb.GetErrorCodeMsg(code),
|
|
||||||
Message: err.Error(),
|
|
||||||
}
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if len(awakenData.Phasebonus) < 2 { // 配置校验
|
if len(awakenData.Phasebonus) < 2 { // 配置校验
|
||||||
@ -66,12 +61,14 @@ func (this *apiComp) Awaken(session comm.IUserSession, req *pb.HeroAwakenReq) (e
|
|||||||
|
|
||||||
//条件判断
|
//条件判断
|
||||||
if awakenData.Condition > _hero.Lv {
|
if awakenData.Condition > _hero.Lv {
|
||||||
code = pb.ErrorCode_HeroLvNoEnough
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_HeroLvNoEnough,
|
||||||
|
Title: pb.ErrorCode_HeroLvNoEnough.ToString(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// 消耗校验
|
// 消耗校验
|
||||||
code = this.module.ConsumeRes(session, awakenData.Phaseneed, true)
|
if errdata = this.module.ConsumeRes(session, awakenData.Phaseneed, true); errdata != nil {
|
||||||
if errdata != nil {
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -166,10 +163,7 @@ func (this *apiComp) Awaken(session comm.IUserSession, req *pb.HeroAwakenReq) (e
|
|||||||
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
||||||
Message: err.Error(),
|
Message: err.Error(),
|
||||||
}
|
}
|
||||||
data = &pb.ErrorData{
|
|
||||||
Title: pb.GetErrorCodeMsg(code),
|
|
||||||
Message: err.Error(),
|
|
||||||
}
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
go this.module.ModuleBuried.TriggerBuried(session.GetUserId(), szTask...)
|
go this.module.ModuleBuried.TriggerBuried(session.GetUserId(), szTask...)
|
||||||
|
@ -39,7 +39,11 @@ func (this *apiComp) Buy(session comm.IUserSession, req *pb.HeroBuyReq) (errdata
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
if udata = this.module.ModuleUser.GetUser(session.GetUserId()); udata == nil {
|
if udata = this.module.ModuleUser.GetUser(session.GetUserId()); udata == nil {
|
||||||
code = pb.ErrorCode_SystemError
|
|
||||||
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_UserNofound, // 没找到玩家数据
|
||||||
|
Title: pb.ErrorCode_UserNofound.ToString(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -49,16 +53,15 @@ func (this *apiComp) Buy(session comm.IUserSession, req *pb.HeroBuyReq) (errdata
|
|||||||
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
||||||
Message: err.Error(),
|
Message: err.Error(),
|
||||||
}
|
}
|
||||||
data = &pb.ErrorData{
|
|
||||||
Title: pb.GetErrorCodeMsg(code),
|
|
||||||
Message: err.Error(),
|
|
||||||
}
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
record, err := this.module.modelRecord.GetHeroRecord(session.GetUserId())
|
record, err := this.module.modelRecord.GetHeroRecord(session.GetUserId())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
code = pb.ErrorCode_SystemError
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_HeroNoExist, // 没找到英雄扩展数据数据
|
||||||
|
Title: pb.ErrorCode_HeroNoExist.ToString(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
global = this.module.ModuleTools.GetGlobalConf()
|
global = this.module.ModuleTools.GetGlobalConf()
|
||||||
@ -80,8 +83,11 @@ func (this *apiComp) Buy(session comm.IUserSession, req *pb.HeroBuyReq) (errdata
|
|||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if totalCount > conf.Buymaxnum { // 购买达到上限
|
if totalCount > conf.Buymaxnum {
|
||||||
code = pb.ErrorCode_ShopGoodsIsSoldOut
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_ShopGoodsIsSoldOut, // 购买达到上限
|
||||||
|
Title: pb.ErrorCode_ShopGoodsIsSoldOut.ToString(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,9 +30,9 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq
|
|||||||
cfgDraw *cfg.GameGlobalData
|
cfgDraw *cfg.GameGlobalData
|
||||||
costAtn *cfg.Gameatn
|
costAtn *cfg.Gameatn
|
||||||
heroRecord *pb.DBHeroRecord
|
heroRecord *pb.DBHeroRecord
|
||||||
pool string // 当前抽对应的卡池
|
pool string // 当前抽对应的卡池
|
||||||
|
atno []*pb.UserAtno // 最终获得的资源
|
||||||
strPool []string // 10连跨多个卡池情况
|
strPool []string // 10连跨多个卡池情况
|
||||||
update map[string]interface{}
|
update map[string]interface{}
|
||||||
normalDraw bool // 是否是普通抽
|
normalDraw bool // 是否是普通抽
|
||||||
)
|
)
|
||||||
@ -41,8 +41,7 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq
|
|||||||
if cfgDraw == nil {
|
if cfgDraw == nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
code = this.DrawCardCheck(session, req)
|
if errdata = this.DrawCardCheck(session, req); errdata != nil {
|
||||||
if errdata != nil {
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
szCards = make([]string, 0)
|
szCards = make([]string, 0)
|
||||||
@ -59,8 +58,7 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq
|
|||||||
costAtn = cfgDraw.BasePool10cost
|
costAtn = cfgDraw.BasePool10cost
|
||||||
}
|
}
|
||||||
costRes = append(costRes, costAtn)
|
costRes = append(costRes, costAtn)
|
||||||
code = this.module.CheckRes(session, costRes)
|
if errdata = this.module.CheckRes(session, costRes); errdata != nil { // 消耗数量不足直接返回
|
||||||
if errdata != nil { // 消耗数量不足直接返回
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -245,8 +243,7 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq
|
|||||||
costRes = append(costRes, costAtn)
|
costRes = append(costRes, costAtn)
|
||||||
|
|
||||||
//阵营消耗
|
//阵营消耗
|
||||||
code = this.module.CheckRes(session, costRes)
|
if errdata = this.module.CheckRes(session, costRes); errdata != nil { // 消耗数量不足直接返回
|
||||||
if errdata != nil { // 消耗数量不足直接返回
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
for {
|
for {
|
||||||
@ -276,10 +273,6 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq
|
|||||||
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
||||||
Message: err.Error(),
|
Message: err.Error(),
|
||||||
}
|
}
|
||||||
data = &pb.ErrorData{
|
|
||||||
Title: pb.GetErrorCodeMsg(code),
|
|
||||||
Message: err.Error(),
|
|
||||||
}
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
sz := make([]int32, 0)
|
sz := make([]int32, 0)
|
||||||
@ -314,8 +307,7 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 消耗道具
|
// 消耗道具
|
||||||
code = this.module.ConsumeRes(session, costRes, true)
|
if errdata = this.module.ConsumeRes(session, costRes, true); errdata != nil {
|
||||||
if errdata != nil {
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
heroRecord.Totalcount += req.DrawCount
|
heroRecord.Totalcount += req.DrawCount
|
||||||
@ -329,30 +321,30 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq
|
|||||||
rsp := &pb.HeroDrawCardResp{
|
rsp := &pb.HeroDrawCardResp{
|
||||||
Data: []*pb.AtnoData{},
|
Data: []*pb.AtnoData{},
|
||||||
}
|
}
|
||||||
|
var addRes []*cfg.Gameatn
|
||||||
for _, heroId := range szCards {
|
for _, heroId := range szCards {
|
||||||
|
addRes = append(addRes, &cfg.Gameatn{
|
||||||
res := &cfg.Gameatn{
|
|
||||||
A: "hero",
|
A: "hero",
|
||||||
T: heroId,
|
T: heroId,
|
||||||
N: 1,
|
N: 1,
|
||||||
}
|
})
|
||||||
if code, atno := this.module.DispenseAtno(session, []*cfg.Gameatn{res}, true); code == pb.ErrorCode_Success {
|
}
|
||||||
|
|
||||||
rsp.Data = append(rsp.Data, &pb.AtnoData{
|
if errdata, atno = this.module.DispenseAtno(session, addRes, true); errdata == nil {
|
||||||
Atno: atno,
|
|
||||||
})
|
rsp.Data = append(rsp.Data, &pb.AtnoData{Atno: atno})
|
||||||
for _, v := range atno {
|
for _, v := range atno {
|
||||||
if v.A == "hero" && v.N == 1 {
|
if v.A == "hero" && v.N == 1 {
|
||||||
if user := this.module.ModuleUser.GetUser(session.GetUserId()); user != nil { // 广播 首次获得英雄
|
if user := this.module.ModuleUser.GetUser(session.GetUserId()); user != nil { // 广播 首次获得英雄
|
||||||
this.chat.SendSysChatToWorld(comm.ChatSystem13, nil, 0, 0, user.Name, v.T)
|
this.chat.SendSysChatToWorld(comm.ChatSystem13, nil, 0, 0, user.Name, v.T)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
session.SendMsg(string(this.module.GetType()), DrawCard, rsp)
|
session.SendMsg(string(this.module.GetType()), DrawCard, rsp)
|
||||||
|
|
||||||
// 任务统计
|
// 任务统计
|
||||||
this.module.SendTaskMsg(session, szStar, req.DrawCount, normalDraw)
|
this.module.SendTaskMsg(session, szStar, req.DrawCount, normalDraw)
|
||||||
return
|
return
|
||||||
|
@ -34,13 +34,9 @@ func (this *apiComp) Fusion(session comm.IUserSession, req *pb.HeroFusionReq) (e
|
|||||||
conf, err := this.module.configure.GetHeroFucionConfig(req.HeroId)
|
conf, err := this.module.configure.GetHeroFucionConfig(req.HeroId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
errdata = &pb.ErrorData{
|
errdata = &pb.ErrorData{
|
||||||
Code: pb.ErrorCode_ConfigNoFound,
|
Code: pb.ErrorCode_ConfigNoFound, // 配置没找到
|
||||||
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
||||||
Message: err.Error(),
|
Message: err.Error(),
|
||||||
} // 配置没找到
|
|
||||||
data = &pb.ErrorData{
|
|
||||||
Title: pb.GetErrorCodeMsg(code),
|
|
||||||
Message: err.Error(),
|
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -57,8 +53,9 @@ func (this *apiComp) Fusion(session comm.IUserSession, req *pb.HeroFusionReq) (e
|
|||||||
for k, v := range req.Heros {
|
for k, v := range req.Heros {
|
||||||
// 校验英雄是否存在
|
// 校验英雄是否存在
|
||||||
_obj, c := this.module.GetHeroByObjID(session.GetUserId(), k)
|
_obj, c := this.module.GetHeroByObjID(session.GetUserId(), k)
|
||||||
if c != pb.ErrorCode_Success || _obj.SameCount < v {
|
if c != nil || _obj.SameCount < v {
|
||||||
code = pb.ErrorCode_HeroNoExist
|
errdata = c
|
||||||
|
return
|
||||||
}
|
}
|
||||||
mapHero[_obj.HeroID] += v
|
mapHero[_obj.HeroID] += v
|
||||||
_costMaphero[k] = _obj
|
_costMaphero[k] = _obj
|
||||||
@ -85,8 +82,7 @@ func (this *apiComp) Fusion(session comm.IUserSession, req *pb.HeroFusionReq) (e
|
|||||||
}
|
}
|
||||||
for k, v := range req.Heros {
|
for k, v := range req.Heros {
|
||||||
//mapHero[_costMaphero[k].HeroID]
|
//mapHero[_costMaphero[k].HeroID]
|
||||||
code = this.module.DelCard(session.GetUserId(), _costMaphero[k], v)
|
if errdata = this.module.DelCard(session.GetUserId(), _costMaphero[k], v); errdata != nil {
|
||||||
if errdata != nil {
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
ChangeList = append(ChangeList, _costMaphero[k])
|
ChangeList = append(ChangeList, _costMaphero[k])
|
||||||
@ -99,9 +95,8 @@ func (this *apiComp) Fusion(session comm.IUserSession, req *pb.HeroFusionReq) (e
|
|||||||
N: 1,
|
N: 1,
|
||||||
}
|
}
|
||||||
if errdata = this.module.DispenseRes(session, []*cfg.Gameatn{res}, false); errdata != nil {
|
if errdata = this.module.DispenseRes(session, []*cfg.Gameatn{res}, false); errdata != nil {
|
||||||
|
this.module.Errorf("err:%v,create hero:%s,uid,%ss", errdata, conf.Hero, session.GetUserId())
|
||||||
this.module.Errorf("err:%v,create hero:%s,uid,%ss", code, conf.Hero, session.GetUserId())
|
return
|
||||||
code = pb.ErrorCode_HeroCreate // 创建新英雄失败
|
|
||||||
}
|
}
|
||||||
session.SendMsg(string(this.module.GetType()), HeroFusionResp, &pb.HeroFusionResp{Heroid: conf.Hero})
|
session.SendMsg(string(this.module.GetType()), HeroFusionResp, &pb.HeroFusionResp{Heroid: conf.Hero})
|
||||||
// 通过融合获得指定英雄
|
// 通过融合获得指定英雄
|
||||||
|
@ -24,12 +24,10 @@ func (this *apiComp) Lock(session comm.IUserSession, req *pb.HeroLockReq) (errda
|
|||||||
var (
|
var (
|
||||||
_hero *pb.DBHero
|
_hero *pb.DBHero
|
||||||
)
|
)
|
||||||
code = this.LockCheck(session, req) // check
|
if errdata = this.LockCheck(session, req); errdata != nil {
|
||||||
if errdata != nil {
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
_hero, code = this.module.GetHeroByObjID(session.GetUserId(), req.Heroid)
|
if _hero, errdata = this.module.GetHeroByObjID(session.GetUserId(), req.Heroid); errdata != nil {
|
||||||
if errdata != nil {
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
_hero.Block = !_hero.Block // 修改是否锁定状态
|
_hero.Block = !_hero.Block // 修改是否锁定状态
|
||||||
|
@ -22,13 +22,16 @@ func (this *apiComp) GetSpecifiedCheck(session comm.IUserSession, req *pb.HeroGe
|
|||||||
/// 获取指定星级或等级的英雄 GM 协议
|
/// 获取指定星级或等级的英雄 GM 协议
|
||||||
func (this *apiComp) GetSpecified(session comm.IUserSession, req *pb.HeroGetSpecifiedReq) (errdata *pb.ErrorData) {
|
func (this *apiComp) GetSpecified(session comm.IUserSession, req *pb.HeroGetSpecifiedReq) (errdata *pb.ErrorData) {
|
||||||
|
|
||||||
code = this.GetSpecifiedCheck(session, req) // check
|
if errdata = this.GetSpecifiedCheck(session, req); errdata != nil {
|
||||||
if errdata != nil {
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
hero, err := this.module.modelHero.createSpecialHero(session.GetUserId(), req.HeroCoinfigID)
|
hero, err := this.module.modelHero.createSpecialHero(session.GetUserId(), req.HeroCoinfigID)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
code = pb.ErrorCode_HeroNoExist
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_HeroNoExist,
|
||||||
|
Title: pb.ErrorCode_HeroNoExist.ToString(),
|
||||||
|
}
|
||||||
|
return
|
||||||
}
|
}
|
||||||
hero.Lv = req.Lv
|
hero.Lv = req.Lv
|
||||||
hero.Star = req.Star
|
hero.Star = req.Star
|
||||||
|
@ -28,12 +28,10 @@ func (this *apiComp) StrengthenUpSkill(session comm.IUserSession, req *pb.HeroSt
|
|||||||
cost []*cfg.Gameatn // 技能升级消耗
|
cost []*cfg.Gameatn // 技能升级消耗
|
||||||
lvUpCount int32 // 技能升级的次数
|
lvUpCount int32 // 技能升级的次数
|
||||||
)
|
)
|
||||||
code = this.StrengthenUpSkillCheck(session, req) // check
|
if errdata = this.StrengthenUpSkillCheck(session, req); errdata != nil {
|
||||||
if errdata != nil {
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
_hero, code = this.module.GetHeroByObjID(session.GetUserId(), req.HeroObjID) // 查询目标卡是否存在
|
if _hero, errdata = this.module.GetHeroByObjID(session.GetUserId(), req.HeroObjID); errdata != nil { // 查询目标卡是否存在
|
||||||
if errdata != nil {
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// 查询配置表 找出原始品质
|
// 查询配置表 找出原始品质
|
||||||
@ -44,10 +42,7 @@ func (this *apiComp) StrengthenUpSkill(session comm.IUserSession, req *pb.HeroSt
|
|||||||
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
||||||
Message: err.Error(),
|
Message: err.Error(),
|
||||||
}
|
}
|
||||||
data = &pb.ErrorData{
|
|
||||||
Title: pb.GetErrorCodeMsg(code),
|
|
||||||
Message: err.Error(),
|
|
||||||
}
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
for _, v := range heroCfg.Heroskillup {
|
for _, v := range heroCfg.Heroskillup {
|
||||||
@ -61,7 +56,6 @@ func (this *apiComp) StrengthenUpSkill(session comm.IUserSession, req *pb.HeroSt
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 消耗获取
|
// 消耗获取
|
||||||
|
|
||||||
atn := this.module.configure.GetHeroSkillCost(heroCfg.Star)
|
atn := this.module.configure.GetHeroSkillCost(heroCfg.Star)
|
||||||
for _, v := range atn {
|
for _, v := range atn {
|
||||||
res := &cfg.Gameatn{
|
res := &cfg.Gameatn{
|
||||||
@ -89,10 +83,7 @@ func (this *apiComp) StrengthenUpSkill(session comm.IUserSession, req *pb.HeroSt
|
|||||||
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
||||||
Message: err.Error(),
|
Message: err.Error(),
|
||||||
}
|
}
|
||||||
data = &pb.ErrorData{
|
|
||||||
Title: pb.GetErrorCodeMsg(code),
|
|
||||||
Message: err.Error(),
|
|
||||||
}
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
sz = append(sz, skillData.Probability[skill.SkillLv])
|
sz = append(sz, skillData.Probability[skill.SkillLv])
|
||||||
@ -100,7 +91,10 @@ func (this *apiComp) StrengthenUpSkill(session comm.IUserSession, req *pb.HeroSt
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if len(sz) == 0 {
|
if len(sz) == 0 {
|
||||||
code = pb.ErrorCode_HeroMaxSkillLv
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_HeroMaxSkillLv,
|
||||||
|
Title: pb.ErrorCode_HeroMaxSkillLv.ToString(),
|
||||||
|
}
|
||||||
this.module.Errorf("技能升级失败:uid:%s,oid:%s", session.GetUserId(), _hero.Id)
|
this.module.Errorf("技能升级失败:uid:%s,oid:%s", session.GetUserId(), _hero.Id)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -26,45 +26,36 @@ func (this *apiComp) StrengthenUpStar(session comm.IUserSession, req *pb.HeroStr
|
|||||||
_hero *pb.DBHero // 目标英雄
|
_hero *pb.DBHero // 目标英雄
|
||||||
err error
|
err error
|
||||||
)
|
)
|
||||||
code = this.StrengthenUpStarCheck(session, req) // check
|
if errdata = this.StrengthenUpStarCheck(session, req); errdata != nil {
|
||||||
if errdata != nil {
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
_hero, code = this.module.GetHeroByObjID(session.GetUserId(), req.HeroObjID)
|
if _hero, errdata = this.module.GetHeroByObjID(session.GetUserId(), req.HeroObjID); errdata != nil {
|
||||||
if errdata != nil {
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 校验指定英雄
|
// 校验指定英雄
|
||||||
starConf, err = this.module.configure.GetHeroStarupConfig(_hero.HeroID, _hero.Star)
|
if starConf, err = this.module.configure.GetHeroStarupConfig(_hero.HeroID, _hero.Star); err != nil {
|
||||||
if err != nil {
|
|
||||||
errdata = &pb.ErrorData{
|
errdata = &pb.ErrorData{
|
||||||
Code: pb.ErrorCode_ConfigNoFound,
|
Code: pb.ErrorCode_ConfigNoFound,
|
||||||
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
||||||
Message: err.Error(),
|
Message: err.Error(),
|
||||||
}
|
}
|
||||||
data = &pb.ErrorData{
|
|
||||||
Title: pb.GetErrorCodeMsg(code),
|
|
||||||
Message: err.Error(),
|
|
||||||
}
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
heroConf, err := this.module.configure.GetHeroConfig(_hero.HeroID)
|
if _, err = this.module.configure.GetHeroConfig(_hero.HeroID); err != nil {
|
||||||
if err != nil {
|
|
||||||
errdata = &pb.ErrorData{
|
errdata = &pb.ErrorData{
|
||||||
Code: pb.ErrorCode_ConfigNoFound,
|
Code: pb.ErrorCode_ConfigNoFound,
|
||||||
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
||||||
Message: err.Error(),
|
Message: err.Error(),
|
||||||
}
|
}
|
||||||
data = &pb.ErrorData{
|
|
||||||
Title: pb.GetErrorCodeMsg(code),
|
|
||||||
Message: err.Error(),
|
|
||||||
}
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
nextHeroConfig, _ := this.module.configure.GetHeroStarupConfig(_hero.HeroID, _hero.Star+1)
|
nextHeroConfig, _ := this.module.configure.GetHeroStarupConfig(_hero.HeroID, _hero.Star+1)
|
||||||
if nextHeroConfig == nil && heroConf.Type != comm.CardTypeStar {
|
if nextHeroConfig == nil {
|
||||||
code = pb.ErrorCode_HeroMaxStarLv
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_HeroMaxStarLv,
|
||||||
|
Title: pb.ErrorCode_HeroMaxStarLv.ToString(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package hero
|
package hero
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"go_dreamfactory/comm"
|
"go_dreamfactory/comm"
|
||||||
"go_dreamfactory/pb"
|
"go_dreamfactory/pb"
|
||||||
cfg "go_dreamfactory/sys/configure/structs"
|
cfg "go_dreamfactory/sys/configure/structs"
|
||||||
@ -28,13 +29,11 @@ func (this *apiComp) StrengthenUplv(session comm.IUserSession, req *pb.HeroStren
|
|||||||
_hero *pb.DBHero // 目标英雄
|
_hero *pb.DBHero // 目标英雄
|
||||||
cost []*cfg.Gameatn // 消耗的道具
|
cost []*cfg.Gameatn // 消耗的道具
|
||||||
)
|
)
|
||||||
code = this.StrengthenUplvCheck(session, req) // check
|
if errdata = this.StrengthenUplvCheck(session, req); errdata != nil {
|
||||||
if errdata != nil {
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
_hero, code = this.module.GetHeroByObjID(session.GetUserId(), req.HeroObjID)
|
if _hero, errdata = this.module.GetHeroByObjID(session.GetUserId(), req.HeroObjID); errdata != nil {
|
||||||
if errdata != nil {
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
for k, v := range req.Item {
|
for k, v := range req.Item {
|
||||||
@ -56,10 +55,6 @@ func (this *apiComp) StrengthenUplv(session comm.IUserSession, req *pb.HeroStren
|
|||||||
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
||||||
Message: err.Error(),
|
Message: err.Error(),
|
||||||
}
|
}
|
||||||
data = &pb.ErrorData{
|
|
||||||
Title: pb.GetErrorCodeMsg(code),
|
|
||||||
Message: err.Error(),
|
|
||||||
}
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -74,22 +69,28 @@ func (this *apiComp) StrengthenUplv(session comm.IUserSession, req *pb.HeroStren
|
|||||||
}
|
}
|
||||||
|
|
||||||
if addExp == 0 {
|
if addExp == 0 {
|
||||||
code = pb.ErrorCode_HeroExpTypeErr
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_HeroExpTypeErr,
|
||||||
|
Title: pb.ErrorCode_HeroExpTypeErr.ToString(),
|
||||||
|
Message: fmt.Sprintf("addExp:%d", addExp),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// 校验当前能不能升级
|
// 校验当前能不能升级
|
||||||
if _hero.Lv >= this.module.configure.GetHeroMaxLv(_hero.Star) { // 达到最大等级
|
if _hero.Lv >= this.module.configure.GetHeroMaxLv(_hero.Star) { // 达到最大等级
|
||||||
code = pb.ErrorCode_HeroMaxLv
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_HeroMaxLv,
|
||||||
|
Title: pb.ErrorCode_HeroMaxLv.ToString(),
|
||||||
|
Message: fmt.Sprintf("addExp:%d", addExp),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// 执行升级逻辑
|
// 执行升级逻辑
|
||||||
_, code = this.module.modelHero.AddCardExp(session, _hero, addExp, nil) // 加经验
|
if _, errdata = this.module.modelHero.AddCardExp(session, _hero, addExp, nil); errdata != nil { // 加经验
|
||||||
if errdata != nil {
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// 消耗金币
|
// 消耗金币
|
||||||
if errdata = this.module.ConsumeRes(session, cost, true); errdata != nil { //道具扣除
|
if errdata = this.module.ConsumeRes(session, cost, true); errdata != nil { //道具扣除
|
||||||
code = pb.ErrorCode_ItemsNoEnough
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,7 +34,11 @@ func (this *apiComp) TalentLearn(session comm.IUserSession, req *pb.HeroTalentLe
|
|||||||
}
|
}
|
||||||
if req.ObjId != "" {
|
if req.ObjId != "" {
|
||||||
if talent, err = this.module.modelTalent.GetHerotalentByObjId(session.GetUserId(), req.ObjId); err != nil {
|
if talent, err = this.module.modelTalent.GetHerotalentByObjId(session.GetUserId(), req.ObjId); err != nil {
|
||||||
code = pb.ErrorCode_SystemError
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_SystemError,
|
||||||
|
Title: pb.ErrorCode_SystemError.ToString(),
|
||||||
|
Message: err.Error(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.module.Debugf("%v", talent)
|
this.module.Debugf("%v", talent)
|
||||||
@ -73,21 +77,18 @@ func (this *apiComp) TalentLearn(session comm.IUserSession, req *pb.HeroTalentLe
|
|||||||
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
||||||
Message: err.Error(),
|
Message: err.Error(),
|
||||||
}
|
}
|
||||||
data = &pb.ErrorData{
|
|
||||||
Title: pb.GetErrorCodeMsg(code),
|
|
||||||
Message: err.Error(),
|
|
||||||
}
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
user := this.module.ModuleUser.GetUser(session.GetUserId())
|
user := this.module.ModuleUser.GetUser(session.GetUserId())
|
||||||
if user != nil {
|
if user != nil {
|
||||||
// 校验玩家等级
|
// 校验玩家等级
|
||||||
if talentConf.Condition < user.Lv { // 等级不满足
|
if talentConf.Condition < user.Lv { // 等级不满足
|
||||||
code = pb.ErrorCode_UserLvNoEnough
|
errdata = &pb.ErrorData{
|
||||||
data = &pb.ErrorData{
|
Code: pb.ErrorCode_UserLvNoEnough,
|
||||||
Title: pb.GetErrorCodeMsg(code),
|
Title: pb.ErrorCode_UserLvNoEnough.ToString(),
|
||||||
Message: fmt.Sprintf("等级不满足要求:curLv = %d,lv = %d", user.Lv, talentConf.Condition),
|
Message: fmt.Sprintf("等级不满足要求:curLv = %d,lv = %d", user.Lv, talentConf.Condition),
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -98,13 +99,21 @@ func (this *apiComp) TalentLearn(session comm.IUserSession, req *pb.HeroTalentLe
|
|||||||
talent.Talent = make(map[int32]int32)
|
talent.Talent = make(map[int32]int32)
|
||||||
}
|
}
|
||||||
if _, ok := talent.Talent[req.TalentID]; ok {
|
if _, ok := talent.Talent[req.TalentID]; ok {
|
||||||
code = pb.ErrorCode_TalentRepeatLearn // 重复激活
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_TalentRepeatLearn, // 重复激活
|
||||||
|
Title: pb.ErrorCode_TalentRepeatLearn.ToString(),
|
||||||
|
Message: err.Error(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for _, v := range talentConf.Before {
|
for _, v := range talentConf.Before {
|
||||||
if _, ok := talent.Talent[v]; !ok {
|
if _, ok := talent.Talent[v]; !ok {
|
||||||
code = pb.ErrorCode_TalentUnLockerBefore // 前置技能不满足
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_TalentUnLockerBefore, // 前置技能不满足
|
||||||
|
Title: pb.ErrorCode_TalentUnLockerBefore.ToString(),
|
||||||
|
Message: err.Error(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -124,7 +133,7 @@ func (this *apiComp) TalentLearn(session comm.IUserSession, req *pb.HeroTalentLe
|
|||||||
N: leftCount,
|
N: leftCount,
|
||||||
}
|
}
|
||||||
if errdata = this.module.CheckRes(session, []*cfg.Gameatn{fp}); errdata != nil {
|
if errdata = this.module.CheckRes(session, []*cfg.Gameatn{fp}); errdata != nil {
|
||||||
code = pb.ErrorCode_ItemsNoEnough
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
res = append(res, fp)
|
res = append(res, fp)
|
||||||
|
@ -29,11 +29,17 @@ func (this *apiComp) TalentReset(session comm.IUserSession, req *pb.HeroTalentRe
|
|||||||
|
|
||||||
_talent, err1 := this.module.modelTalent.GetHerotalentByObjId(session.GetUserId(), req.ObjId) //根据对象id 获取数据
|
_talent, err1 := this.module.modelTalent.GetHerotalentByObjId(session.GetUserId(), req.ObjId) //根据对象id 获取数据
|
||||||
if err1 != nil {
|
if err1 != nil {
|
||||||
code = pb.ErrorCode_TalentErrData
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_TalentErrData,
|
||||||
|
Title: pb.ErrorCode_TalentErrData.ToString(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if len(_talent.Talent) == 0 { // 已经是重置状态
|
if len(_talent.Talent) == 0 { // 已经是重置状态
|
||||||
code = pb.ErrorCode_TalentResetState
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_TalentResetState,
|
||||||
|
Title: pb.ErrorCode_TalentResetState.ToString(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,10 +59,6 @@ func (this *apiComp) TalentReset(session comm.IUserSession, req *pb.HeroTalentRe
|
|||||||
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
||||||
Message: err.Error(),
|
Message: err.Error(),
|
||||||
}
|
}
|
||||||
data = &pb.ErrorData{
|
|
||||||
Title: pb.GetErrorCodeMsg(code),
|
|
||||||
Message: err.Error(),
|
|
||||||
}
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -510,7 +510,10 @@ func (this *ModelHero) AddCardExp(session comm.IUserSession, hero *pb.DBHero, ex
|
|||||||
update map[string]interface{} // 属性变化
|
update map[string]interface{} // 属性变化
|
||||||
)
|
)
|
||||||
if hero == nil {
|
if hero == nil {
|
||||||
code = pb.ErrorCode_HeroNoExist
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_HeroNoExist,
|
||||||
|
Title: pb.ErrorCode_HeroNoExist.ToString(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
update = make(map[string]interface{}, 0)
|
update = make(map[string]interface{}, 0)
|
||||||
|
@ -106,32 +106,44 @@ func (this *Hero) createRepeatHero(session comm.IUserSession, heroCfgId string,
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
code = pb.ErrorCode_HeroCreate
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_HeroCreate,
|
||||||
|
Title: pb.ErrorCode_HeroCreate.ToString(),
|
||||||
|
Message: err.Error(),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取英雄
|
// 获取英雄
|
||||||
func (this *Hero) GetHeroByObjID(uid, heroId string) (*pb.DBHero, pb.ErrorCode) {
|
func (this *Hero) GetHeroByObjID(uid, heroId string) (hero *pb.DBHero, errdata *pb.ErrorData) {
|
||||||
hero := this.modelHero.getOneHero(uid, heroId)
|
hero = this.modelHero.getOneHero(uid, heroId)
|
||||||
if hero == nil {
|
if hero != nil {
|
||||||
return nil, pb.ErrorCode_HeroNoExist
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_HeroNoExist,
|
||||||
|
Title: pb.ErrorCode_HeroNoExist.ToString(),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return hero, pb.ErrorCode_Success
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 佩戴装备
|
// 佩戴装备
|
||||||
func (this *Hero) UpdateEquipment(session comm.IUserSession, hero *pb.DBHero, equip []*pb.DB_Equipment) (errdata *pb.ErrorData) {
|
func (this *Hero) UpdateEquipment(session comm.IUserSession, hero *pb.DBHero, equip []*pb.DB_Equipment) (errdata *pb.ErrorData) {
|
||||||
|
|
||||||
if hero == nil {
|
if hero == nil {
|
||||||
code = pb.ErrorCode_HeroNoExist
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_HeroNoExist,
|
||||||
|
Title: pb.ErrorCode_HeroNoExist.ToString(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
list := make([]*pb.DBHero, 0)
|
list := make([]*pb.DBHero, 0)
|
||||||
if newHero, err := this.modelHero.setEquipment(session.GetUserId(), hero); err != nil {
|
if newHero, err := this.modelHero.setEquipment(session.GetUserId(), hero); err != nil {
|
||||||
code = pb.ErrorCode_HeroEquipUpdate
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_HeroEquipUpdate,
|
||||||
|
Title: pb.ErrorCode_HeroEquipUpdate.ToString(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
} else {
|
} else {
|
||||||
if newHero != nil {
|
if newHero != nil {
|
||||||
@ -214,7 +226,11 @@ func (this *Hero) CleanData(uid string) {
|
|||||||
// 创建一些特殊的英雄
|
// 创建一些特殊的英雄
|
||||||
func (this *Hero) GetSpecifiedHero(session comm.IUserSession, heroConfId string, star, lv int32) (errdata *pb.ErrorData) {
|
func (this *Hero) GetSpecifiedHero(session comm.IUserSession, heroConfId string, star, lv int32) (errdata *pb.ErrorData) {
|
||||||
if session.GetUserId() == "" || heroConfId == "" || star == 0 || lv == 0 {
|
if session.GetUserId() == "" || heroConfId == "" || star == 0 || lv == 0 {
|
||||||
return pb.ErrorCode_ReqParameterError
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_ReqParameterError,
|
||||||
|
Title: pb.ErrorCode_ReqParameterError.ToString(),
|
||||||
|
}
|
||||||
|
return
|
||||||
}
|
}
|
||||||
// 等级校验
|
// 等级校验
|
||||||
conf, _ := this.configure.GetHeroConfig(heroConfId)
|
conf, _ := this.configure.GetHeroConfig(heroConfId)
|
||||||
@ -248,7 +264,11 @@ func (this *Hero) GetSpecifiedHero(session comm.IUserSession, heroConfId string,
|
|||||||
}
|
}
|
||||||
hero, err := this.modelHero.createSpecialHero(session.GetUserId(), heroConfId)
|
hero, err := this.modelHero.createSpecialHero(session.GetUserId(), heroConfId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return pb.ErrorCode_HeroCreate
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_HeroCreate,
|
||||||
|
Title: pb.ErrorCode_HeroCreate.ToString(),
|
||||||
|
Message: err.Error(),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
hero.Lv = lv
|
hero.Lv = lv
|
||||||
hero.Star = star
|
hero.Star = star
|
||||||
@ -285,7 +305,7 @@ func (this *Hero) CreateRepeatHeros(session comm.IUserSession, heros map[string]
|
|||||||
if num == 0 { // 数量为0 不做处理
|
if num == 0 { // 数量为0 不做处理
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if hero, bFirst, atno, code = this.createRepeatHero(session, heroCfgId, num); errdata != nil {
|
if hero, bFirst, atno, errdata = this.createRepeatHero(session, heroCfgId, num); errdata != nil {
|
||||||
this.Errorf("create hero %s failed", heroCfgId)
|
this.Errorf("create hero %s failed", heroCfgId)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
@ -327,18 +347,18 @@ func (this *Hero) AddHeroExp(session comm.IUserSession, heroObjID string, exp in
|
|||||||
this.Errorf("err:%v", err)
|
this.Errorf("err:%v", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
curAddExp, code = this.modelHero.AddCardExp(session, _hero, exp, model)
|
curAddExp, errdata = this.modelHero.AddCardExp(session, _hero, exp, model)
|
||||||
if errdata != nil {
|
if errdata != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
_hero, code = this.GetHeroByObjID(session.GetUserId(), heroObjID)
|
_hero, errdata = this.GetHeroByObjID(session.GetUserId(), heroObjID)
|
||||||
if errdata != nil {
|
if errdata != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
curAddExp, code = this.modelHero.AddCardExp(session, _hero, exp, nil)
|
curAddExp, errdata = this.modelHero.AddCardExp(session, _hero, exp, nil)
|
||||||
if errdata != nil {
|
if errdata != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -367,14 +387,18 @@ func (this *Hero) KungFuHero(session comm.IUserSession, heroObjID string, bKongf
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
_hero, code = this.GetHeroByObjID(session.GetUserId(), heroObjID)
|
_hero, errdata = this.GetHeroByObjID(session.GetUserId(), heroObjID)
|
||||||
if errdata != nil {
|
if errdata != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if bKongfu && _hero.Status == pb.HeroType_HeroTypeKongFu {
|
if bKongfu && _hero.Status == pb.HeroType_HeroTypeKongFu {
|
||||||
code = pb.ErrorCode_HeroAlreadyKongFuStatus // 已经是练功状态
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_HeroAlreadyKongFuStatus, // 已经是练功状态
|
||||||
|
Title: pb.ErrorCode_HeroAlreadyKongFuStatus.ToString(),
|
||||||
|
Message: err.Error(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -693,7 +717,11 @@ func (this *Hero) GetAllMaxHero(session comm.IUserSession) (errdata *pb.ErrorDat
|
|||||||
// 开始创建英雄
|
// 开始创建英雄
|
||||||
hero, err := this.modelHero.createSpecialHero(session.GetUserId(), v.Hid)
|
hero, err := this.modelHero.createSpecialHero(session.GetUserId(), v.Hid)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return pb.ErrorCode_HeroCreate
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_HeroCreate,
|
||||||
|
Title: pb.ErrorCode_HeroCreate.ToString(),
|
||||||
|
Message: err.Error(),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// 获取满级技能
|
// 获取满级技能
|
||||||
for _, skill := range hero.NormalSkill {
|
for _, skill := range hero.NormalSkill {
|
||||||
@ -879,9 +907,9 @@ func (this *Hero) RegisterInstructor(session comm.IUserSession, heroOid []string
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for _, v := range heroOid {
|
for _, v := range heroOid {
|
||||||
_hero, c := this.GetHeroByObjID(session.GetUserId(), v)
|
_hero, err := this.GetHeroByObjID(session.GetUserId(), v)
|
||||||
if c != pb.ErrorCode_Success {
|
if err != nil {
|
||||||
code = c
|
errdata = err
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
_szHero = append(_szHero, _hero)
|
_szHero = append(_szHero, _hero)
|
||||||
@ -895,14 +923,20 @@ func (this *Hero) RegisterInstructor(session comm.IUserSession, heroOid []string
|
|||||||
} else if v.Fulllvenr == 0 && fulllvenr != 0 {
|
} else if v.Fulllvenr == 0 && fulllvenr != 0 {
|
||||||
// 校验有没有满级
|
// 校验有没有满级
|
||||||
if v.Lv < this.configure.GetHeroMaxLv(v.Star) {
|
if v.Lv < this.configure.GetHeroMaxLv(v.Star) {
|
||||||
code = pb.ErrorCode_HeroLvNoEnough // 必须满级
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_HeroLvNoEnough,
|
||||||
|
Title: pb.ErrorCode_HeroLvNoEnough.ToString(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
v.Fulllvenr = fulllvenr
|
v.Fulllvenr = fulllvenr
|
||||||
_heroMap["fulllvenr"] = v.Fulllvenr
|
_heroMap["fulllvenr"] = v.Fulllvenr
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
code = pb.ErrorCode_HeroIsRegister
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_HeroIsRegister,
|
||||||
|
Title: pb.ErrorCode_HeroIsRegister.ToString(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if this.IsCross() {
|
if this.IsCross() {
|
||||||
|
Loading…
Reference in New Issue
Block a user