This commit is contained in:
wh_zcy 2023-06-06 15:05:41 +08:00
commit ee8c3927cf
49 changed files with 461 additions and 352 deletions

View File

@ -1,6 +1,7 @@
package hunting package hunting
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"
@ -23,14 +24,17 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.HuntingChallen
var ( var (
ps int32 ps int32
) )
code = this.ChallengeCheck(session, req) if errdata = this.ChallengeCheck(session, req); errdata != nil {
if errdata != nil {
return // 参数校验失败直接返回 return // 参数校验失败直接返回
} }
hunting, err := this.module.modelHunting.getHuntingList(session.GetUserId()) hunting, err := this.module.modelHunting.getHuntingList(session.GetUserId())
if err != nil { if err != nil {
code = pb.ErrorCode_PagodaNotFound errdata = &pb.ErrorData{
Code: pb.ErrorCode_PagodaNotFound,
Title: pb.ErrorCode_PagodaNotFound.ToString(),
Message: err.Error(),
}
return return
} }
cfgData, err := this.module.configure.GetHuntingBossConfigData(req.BossType, req.Difficulty) cfgData, err := this.module.configure.GetHuntingBossConfigData(req.BossType, req.Difficulty)
@ -40,10 +44,7 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.HuntingChallen
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 v1, ok := hunting.Ps[req.BossType]; ok && v1 == 0 { if v1, ok := hunting.Ps[req.BossType]; ok && v1 == 0 {
@ -101,11 +102,15 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.HuntingChallen
hunting.Boss[req.BossType] = 1 hunting.Boss[req.BossType] = 1
} }
if value < req.Difficulty-1 { if value < req.Difficulty-1 {
code = pb.ErrorCode_HuntingLvErr errdata = &pb.ErrorData{
Code: pb.ErrorCode_HuntingLvErr,
Title: pb.ErrorCode_HuntingLvErr.ToString(),
Message: fmt.Sprintf("关卡难度不匹配,当前关卡:%d,请求关卡:%d", value, req.Difficulty),
}
return return
} }
code, record := this.module.battle.CreatePveBattle(session, &pb.BattlePVEReq{ errdata, record := this.module.battle.CreatePveBattle(session, &pb.BattlePVEReq{
Ptype: pb.PlayType_hunting, Ptype: pb.PlayType_hunting,
Title: "", Title: "",
Format: req.Battle, Format: req.Battle,

View File

@ -1,6 +1,7 @@
package hunting package hunting
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"
@ -33,14 +34,16 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.HuntingCha
) )
mapData = make(map[string]interface{}, 0) mapData = make(map[string]interface{}, 0)
reward = make([]*cfg.Gameatn, 0) reward = make([]*cfg.Gameatn, 0)
code = this.ChallengeOverCheck(session, req) if errdata = this.ChallengeOverCheck(session, req); errdata != nil {
if errdata != nil {
return // 参数校验失败直接返回 return // 参数校验失败直接返回
} }
hunting, err := this.module.modelHunting.getHuntingList(session.GetUserId()) hunting, err := this.module.modelHunting.getHuntingList(session.GetUserId())
if err != nil { if err != nil {
code = pb.ErrorCode_PagodaNotFound errdata = &pb.ErrorData{
Code: pb.ErrorCode_PagodaNotFound,
Title: pb.ErrorCode_PagodaNotFound.ToString(),
}
return return
} }
cfgHunting, err := this.module.configure.GetHuntingBossConfigData(req.BossType, req.Difficulty) cfgHunting, err := this.module.configure.GetHuntingBossConfigData(req.BossType, req.Difficulty)
@ -50,10 +53,6 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.HuntingCha
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
} }
@ -63,11 +62,18 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.HuntingCha
if value, ok := hunting.Boss[req.BossType]; ok { // 类型校验 if value, ok := hunting.Boss[req.BossType]; ok { // 类型校验
if value < req.Difficulty-1 { if value < req.Difficulty-1 {
code = pb.ErrorCode_HuntingLvErr errdata = &pb.ErrorData{
Code: pb.ErrorCode_HuntingLvErr,
Title: pb.ErrorCode_HuntingLvErr.ToString(),
}
return return
} }
} else { } else {
code = pb.ErrorCode_HuntingLvErr errdata = &pb.ErrorData{
Code: pb.ErrorCode_HuntingLvErr,
Title: pb.ErrorCode_HuntingLvErr.ToString(),
Message: fmt.Sprintf("关卡参数异常:%d", req.BossType),
}
return return
} }
if hunting.Boss[req.BossType] < req.Difficulty { if hunting.Boss[req.BossType] < req.Difficulty {
@ -79,25 +85,27 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.HuntingCha
hunting.Boss[req.BossType] = maxDifficulity hunting.Boss[req.BossType] = maxDifficulity
} }
mapData["boss"] = hunting.Boss mapData["boss"] = hunting.Boss
code, bWin = this.module.battle.CheckBattleReport(session, req.Report) errdata, bWin = this.module.battle.CheckBattleReport(session, req.Report)
// if errdata = this.module.ModuleItems.RecoverTicket(session); errdata != nil { if v, ok := hunting.Ps[req.BossType]; !ok || v == 0 {
// return errdata = &pb.ErrorData{
// } Code: pb.ErrorCode_HuntingLvErr,
if !bWin { // 战斗失败了 直接返回 Title: pb.ErrorCode_HuntingLvErr.ToString(),
if v, ok := hunting.Ps[req.BossType]; ok && v > 0 { Message: fmt.Sprintf("关卡体力参数异常:%d,预扣体力:%d", session.GetUserId(), v),
if errdata = this.module.DispenseRes(session, cfgHunting.PsConsume, true); errdata != nil { // 返还预扣体力
return
} }
return
} }
hunting.Ps[req.BossType] = 0 // 清空预扣体力值 hunting.Ps[req.BossType] = 0 // 清空预扣体力值
mapData["ps"] = hunting.Ps mapData["ps"] = hunting.Ps
code = this.module.ModifyHuntingData(session.GetUserId(), mapData)
if !bWin { // 战斗失败了 直接返回
if errdata = this.module.DispenseRes(session, cfgHunting.PsConsume, true); errdata != nil { // 返还预扣体力
return
}
errdata = this.module.ModifyHuntingData(session.GetUserId(), mapData)
session.SendMsg(string(this.module.GetType()), HuntingChallengeOverResp, &pb.HuntingChallengeOverResp{Data: hunting}) session.SendMsg(string(this.module.GetType()), HuntingChallengeOverResp, &pb.HuntingChallengeOverResp{Data: hunting})
return return
} }
// if errdata = this.module.ConsumeRes(session, cfgHunting.PsConsume, true); errdata != nil {
// return
// }
key := strconv.Itoa(int(req.BossType)) + "_" + strconv.Itoa(int(req.Difficulty)) key := strconv.Itoa(int(req.BossType)) + "_" + strconv.Itoa(int(req.Difficulty))
if hunting.BossTime[key] == 0 { // 新关卡挑战通过 发放首通奖励 if hunting.BossTime[key] == 0 { // 新关卡挑战通过 发放首通奖励
mapData["boss"] = hunting.Boss mapData["boss"] = hunting.Boss
@ -136,7 +144,7 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.HuntingCha
res = append(res, v) res = append(res, v)
} }
} }
if code, atno = this.module.DispenseAtno(session, res, true); errdata != nil { if errdata, atno = this.module.DispenseAtno(session, res, true); errdata != nil {
return return
} }
if newChallenge && bWin { // 新关卡挑战通过 发放首通奖励 if newChallenge && bWin { // 新关卡挑战通过 发放首通奖励
@ -148,12 +156,8 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.HuntingCha
} }
mapData["bossTime"] = hunting.BossTime mapData["bossTime"] = hunting.BossTime
code = this.module.ModifyHuntingData(session.GetUserId(), mapData) errdata = this.module.ModifyHuntingData(session.GetUserId(), mapData)
// if session.GetUserId() != "" { // 恢复时间
// if userexpand, err := this.module.ModuleUser.GetUserExpand(session.GetUserId()); err == nil {
// hunting.RecoveryTime = userexpand.Recovertimeunifiedticket
// }
// }
session.SendMsg(string(this.module.GetType()), HuntingChallengeOverResp, &pb.HuntingChallengeOverResp{ session.SendMsg(string(this.module.GetType()), HuntingChallengeOverResp, &pb.HuntingChallengeOverResp{
Data: hunting, Data: hunting,
Asset: atno, Asset: atno,

View File

@ -13,21 +13,12 @@ func (this *apiComp) GetListCheck(session comm.IUserSession, req *pb.HuntingGetL
func (this *apiComp) GetList(session comm.IUserSession, req *pb.HuntingGetListReq) (errdata *pb.ErrorData) { func (this *apiComp) GetList(session comm.IUserSession, req *pb.HuntingGetListReq) (errdata *pb.ErrorData) {
code = this.GetListCheck(session, req) if errdata = this.GetListCheck(session, req); errdata != nil {
if errdata != nil {
return // 参数校验失败直接返回 return // 参数校验失败直接返回
} }
// 刷新挑战卷
// if errdata = this.module.ModuleItems.RecoverTicket(session); errdata != nil {
// return
// }
list, _ := this.module.modelHunting.getHuntingList(session.GetUserId()) list, _ := this.module.modelHunting.getHuntingList(session.GetUserId())
// if session.GetUserId() != "" { // 恢复时间
// if userexpand, err := this.module.ModuleUser.GetUserExpand(session.GetUserId()); err == nil {
// list.RecoveryTime = userexpand.Recovertimeunifiedticket
// }
// }
session.SendMsg(string(this.module.GetType()), HuntingGetListResp, &pb.HuntingGetListResp{Data: list}) session.SendMsg(string(this.module.GetType()), HuntingGetListResp, &pb.HuntingGetListResp{Data: list})
return return
} }

View File

@ -22,8 +22,7 @@ func (this *apiComp) RankList(session comm.IUserSession, req *pb.HuntingRankList
szRank []*pb.DBHuntingRank szRank []*pb.DBHuntingRank
rd *redis.StringSliceCmd rd *redis.StringSliceCmd
) )
code = this.RankListCheck(session, req) if errdata = this.RankListCheck(session, req); errdata != nil {
if errdata != nil {
return // 参数校验失败直接返回 return // 参数校验失败直接返回
} }
conn, _ := db.Local() conn, _ := db.Local()

View File

@ -60,7 +60,7 @@ func (this *modelHunting) checkReddot32(session comm.IUserSession) bool {
if list, err := this.module.modelHunting.getHuntingList(session.GetUserId()); err == nil { if list, err := this.module.modelHunting.getHuntingList(session.GetUserId()); err == nil {
if _, ok := list.Boss[1]; ok { if _, ok := list.Boss[1]; ok {
conf, _ := this.module.configure.GetHuntingBossConfigData(1, 1) conf, _ := this.module.configure.GetHuntingBossConfigData(1, 1)
if code := this.module.CheckRes(session, conf.PsConsume); code == pb.ErrorCode_Success { if errdata := this.module.CheckRes(session, conf.PsConsume); errdata == nil {
return true return true
} }
} }

View File

@ -202,7 +202,7 @@ func (this *Hunting) CompleteAllLevel(session comm.IUserSession) (errdata *pb.Er
} }
} }
mapData["boss"] = list.Boss mapData["boss"] = list.Boss
code = this.ModifyHuntingData(session.GetUserId(), mapData) errdata = this.ModifyHuntingData(session.GetUserId(), mapData)
session.SendMsg(string(this.GetType()), HuntingGetListResp, &pb.HuntingGetListResp{Data: list}) session.SendMsg(string(this.GetType()), HuntingGetListResp, &pb.HuntingGetListResp{Data: list})
return return

View File

@ -18,18 +18,23 @@ func (this *apiComp) ActivationFetterCheck(session comm.IUserSession, req *pb.Li
func (this *apiComp) ActivationFetter(session comm.IUserSession, req *pb.LibraryActivationFetterReq) (errdata *pb.ErrorData) { func (this *apiComp) ActivationFetter(session comm.IUserSession, req *pb.LibraryActivationFetterReq) (errdata *pb.ErrorData) {
code = this.ActivationFetterCheck(session, req) if errdata = this.ActivationFetterCheck(session, req); errdata != nil {
if errdata != nil {
return // 参数校验失败直接返回 return // 参数校验失败直接返回
} }
rsp := &pb.LibraryActivationFetterResp{} rsp := &pb.LibraryActivationFetterResp{}
fetter := this.module.modelLibrary.getOneLibrary(session.GetUserId(), req.Oid) fetter := this.module.modelLibrary.getOneLibrary(session.GetUserId(), req.Oid)
if fetter == nil { if fetter == nil {
code = pb.ErrorCode_LibraryNoData errdata = &pb.ErrorData{
Code: pb.ErrorCode_LibraryNoData,
Title: pb.ErrorCode_LibraryNoData.ToString(),
}
return return
} }
if fetter.Fidlv != 0 { if fetter.Fidlv != 0 {
code = pb.ErrorCode_LibraryActivation errdata = &pb.ErrorData{
Code: pb.ErrorCode_LibraryActivation,
Title: pb.ErrorCode_LibraryActivation.ToString(),
}
return return
} }
fetter.Fidlv = 1 fetter.Fidlv = 1

View File

@ -13,8 +13,7 @@ func (this *apiComp) GetListCheck(session comm.IUserSession, req *pb.LibraryGetL
func (this *apiComp) GetList(session comm.IUserSession, req *pb.LibraryGetListReq) (errdata *pb.ErrorData) { func (this *apiComp) GetList(session comm.IUserSession, req *pb.LibraryGetListReq) (errdata *pb.ErrorData) {
code = this.GetListCheck(session, req) if errdata = this.GetListCheck(session, req); errdata != nil {
if errdata != nil {
return // 参数校验失败直接返回 return // 参数校验失败直接返回
} }
rsp := &pb.LibraryGetListResp{} rsp := &pb.LibraryGetListResp{}

View File

@ -5,6 +5,7 @@ package library
*/ */
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"
@ -27,8 +28,7 @@ func (this *apiComp) GetStoryReward(session comm.IUserSession, req *pb.LibraryGe
) )
update = make(map[string]interface{}, 0) update = make(map[string]interface{}, 0)
resp := &pb.LibraryGetStoryRewardResp{} resp := &pb.LibraryGetStoryRewardResp{}
code = this.GetStoryRewardCheck(session, req) if errdata = this.GetStoryRewardCheck(session, req); errdata != nil {
if errdata != nil {
return // 参数校验失败直接返回 return // 参数校验失败直接返回
} }
_heroFetter := this.module.modelFetter.getOneHeroFetter(session.GetUserId(), req.Oid) _heroFetter := this.module.modelFetter.getOneHeroFetter(session.GetUserId(), req.Oid)
@ -46,16 +46,15 @@ func (this *apiComp) GetStoryReward(session comm.IUserSession, req *pb.LibraryGe
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
} }
// 领取传记往事id // 领取传记往事id
for _, v := range _heroFetter.History { for _, v := range _heroFetter.History {
if v == req.History { // 已经领取过奖励 if v == req.History { // 已经领取过奖励
code = pb.ErrorCode_LibraryReward errdata = &pb.ErrorData{
Code: pb.ErrorCode_LibraryReward,
Title: pb.ErrorCode_LibraryReward.ToString(),
}
return return
} }
} }
@ -63,7 +62,10 @@ func (this *apiComp) GetStoryReward(session comm.IUserSession, req *pb.LibraryGe
_len := len(_heroFetter.History) _len := len(_heroFetter.History)
if len(favorConf.Favorlv) < _len { if len(favorConf.Favorlv) < _len {
if favorConf.Favorlv[_len] > _heroFetter.Favorlv { // 等级不够 if favorConf.Favorlv[_len] > _heroFetter.Favorlv { // 等级不够
code = pb.ErrorCode_LibraryLvReward errdata = &pb.ErrorData{
Code: pb.ErrorCode_LibraryLvReward,
Title: pb.ErrorCode_LibraryLvReward.ToString(),
}
return return
} }
} }
@ -85,7 +87,12 @@ func (this *apiComp) GetStoryReward(session comm.IUserSession, req *pb.LibraryGe
} }
} else { } else {
this.module.Errorf("领取奖励配置错误:%d", req.History) this.module.Errorf("领取奖励配置错误:%d", req.History)
code = pb.ErrorCode_LibraryLvReward
errdata = &pb.ErrorData{
Code: pb.ErrorCode_LibraryLvReward,
Title: pb.ErrorCode_LibraryLvReward.ToString(),
Message: fmt.Sprintf("领取奖励配置错误:%d", req.History),
}
return return
} }
break break

View File

@ -5,6 +5,7 @@ package library
*/ */
import ( import (
"fmt"
"go_dreamfactory/comm" "go_dreamfactory/comm"
"go_dreamfactory/pb" "go_dreamfactory/pb"
) )
@ -24,8 +25,7 @@ func (this *apiComp) LvRewardCheck(session comm.IUserSession, req *pb.LibraryLvR
func (this *apiComp) LvReward(session comm.IUserSession, req *pb.LibraryLvRewardReq) (errdata *pb.ErrorData) { func (this *apiComp) LvReward(session comm.IUserSession, req *pb.LibraryLvRewardReq) (errdata *pb.ErrorData) {
resp := &pb.LibraryLvRewardResp{} resp := &pb.LibraryLvRewardResp{}
code = this.LvRewardCheck(session, req) if errdata = this.LvRewardCheck(session, req); errdata != nil {
if errdata != nil {
return // 参数校验失败直接返回 return // 参数校验失败直接返回
} }
_heroFetter := this.module.modelFetter.getOneHeroFetter(session.GetUserId(), req.Oid) _heroFetter := this.module.modelFetter.getOneHeroFetter(session.GetUserId(), req.Oid)
@ -41,7 +41,11 @@ func (this *apiComp) LvReward(session comm.IUserSession, req *pb.LibraryLvReward
} }
if _, ok := _heroFetter.Lvprize[req.Lv]; ok { if _, ok := _heroFetter.Lvprize[req.Lv]; ok {
code = pb.ErrorCode_LibraryReward // 重复领奖 errdata = &pb.ErrorData{ // 重复领奖
Code: pb.ErrorCode_LibraryReward,
Title: pb.ErrorCode_LibraryReward.ToString(),
Message: fmt.Sprintf("重复领奖,领奖等级:%d", req.Lv),
}
return return
} }
confData, err := this.module.configure.GetFavorability(_heroFetter.Heroid, req.Lv) confData, err := this.module.configure.GetFavorability(_heroFetter.Heroid, req.Lv)
@ -50,18 +54,14 @@ func (this *apiComp) LvReward(session comm.IUserSession, req *pb.LibraryLvReward
Code: pb.ErrorCode_ReqParameterError, Code: pb.ErrorCode_ReqParameterError,
Title: pb.ErrorCode_ReqParameterError.ToString(), Title: pb.ErrorCode_ReqParameterError.ToString(),
} }
data = &pb.ErrorData{
Title: pb.GetErrorCodeMsg(code),
Message: err.Error(),
}
return return
} }
_heroFetter.Lvprize[req.Lv] = 1 _heroFetter.Lvprize[req.Lv] = 1
// 发奖 // 发奖
code = this.module.DispenseRes(session, confData.ReturnReward, true) if errdata = this.module.DispenseRes(session, confData.ReturnReward, true); errdata != nil {
if errdata != nil {
this.module.Errorf("GetStoryReward err:add item : %v", confData.ReturnReward) this.module.Errorf("GetStoryReward err:add item : %v", confData.ReturnReward)
return
} }
mapData := make(map[string]interface{}, 0) mapData := make(map[string]interface{}, 0)
mapData["lvprize"] = _heroFetter.Lvprize mapData["lvprize"] = _heroFetter.Lvprize

View File

@ -23,8 +23,7 @@ func (this *apiComp) FetterLvUp(session comm.IUserSession, req *pb.LibraryFetter
var ( var (
totalFetterLv int32 //羁绊总等级 totalFetterLv int32 //羁绊总等级
) )
code = this.FetterLvUpCheck(session, req) if errdata = this.FetterLvUpCheck(session, req); errdata != nil {
if errdata != nil {
return // 参数校验失败直接返回 return // 参数校验失败直接返回
} }
// 配置校验 // 配置校验
@ -32,7 +31,10 @@ func (this *apiComp) FetterLvUp(session comm.IUserSession, req *pb.LibraryFetter
rsp := &pb.LibraryFetterLvUpResp{} rsp := &pb.LibraryFetterLvUpResp{}
fetter := this.module.getLibraryByObjID(session.GetUserId(), req.LibOid) fetter := this.module.getLibraryByObjID(session.GetUserId(), req.LibOid)
if fetter == nil { if fetter == nil {
code = pb.ErrorCode_LibraryNoData errdata = &pb.ErrorData{
Code: pb.ErrorCode_LibraryNoData,
Title: pb.ErrorCode_LibraryNoData.ToString(),
}
return return
} }
for _, oid := range fetter.Herofetter { for _, oid := range fetter.Herofetter {
@ -46,22 +48,24 @@ func (this *apiComp) FetterLvUp(session comm.IUserSession, req *pb.LibraryFetter
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(),
}
data = &pb.ErrorData{
Title: pb.GetErrorCodeMsg(code),
Message: e.Error(), Message: e.Error(),
} }
return return
} }
if conf[0].FavorabilityLv > totalFetterLv { if conf[0].FavorabilityLv > totalFetterLv {
code = pb.ErrorCode_LibraryLvReward errdata = &pb.ErrorData{
Code: pb.ErrorCode_LibraryLvReward,
Title: pb.ErrorCode_LibraryLvReward.ToString(),
}
return return
} }
if _, ok := fetter.Prize[fetter.Fidlv]; ok { if _, ok := fetter.Prize[fetter.Fidlv]; ok {
code = pb.ErrorCode_LibraryReward errdata = &pb.ErrorData{
Code: pb.ErrorCode_LibraryReward,
Title: pb.ErrorCode_LibraryReward.ToString(),
}
return return
} }

View File

@ -30,11 +30,6 @@ func (this *apiComp) FetterstoryTask(session comm.IUserSession, req *pb.LibraryF
rsp := &pb.LibraryFetterstoryTaskResp{ rsp := &pb.LibraryFetterstoryTaskResp{
List: list, List: list,
} }
session.SendMsg(string(this.module.GetType()), LibraryFetterstoryTaskResp, rsp)
if err := session.SendMsg(string(this.module.GetType()), LibraryFetterstoryTaskResp, rsp); err != nil {
code = pb.ErrorCode_SystemError
return
}
return return
} }

View File

@ -31,14 +31,16 @@ func (this *apiComp) UseGift(session comm.IUserSession, req *pb.LibraryUseGiftRe
sCount int32 // 赠送开始次数 sCount int32 // 赠送开始次数
) )
attenuation = make(map[int32]int32, 0) attenuation = make(map[int32]int32, 0)
code = this.UseGiftCheck(session, req) if errdata = this.UseGiftCheck(session, req); errdata != nil {
if errdata != nil {
return // 参数校验失败直接返回 return // 参数校验失败直接返回
} }
rsp := &pb.LibraryUseGiftResp{} rsp := &pb.LibraryUseGiftResp{}
_heroObj := this.module.modelFetter.getOneHeroFetter(session.GetUserId(), req.Heroid) _heroObj := this.module.modelFetter.getOneHeroFetter(session.GetUserId(), req.Heroid)
if _heroObj == nil { if _heroObj == nil {
code = pb.ErrorCode_HeroNoExist // 没找到对应的英雄信息 errdata = &pb.ErrorData{ // 没找到对应的英雄信息
Code: pb.ErrorCode_HeroNoExist,
Title: pb.ErrorCode_HeroNoExist.ToString(),
}
return return
} }
@ -49,16 +51,15 @@ func (this *apiComp) UseGift(session comm.IUserSession, req *pb.LibraryUseGiftRe
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
} }
maxLv = int32(len(_exp)) // 获取当前星级羁绊最大等级 maxLv = int32(len(_exp)) // 获取当前星级羁绊最大等级
// 达到最大等级不让继续升级 // 达到最大等级不让继续升级
if _heroObj.Favorlv >= maxLv { if _heroObj.Favorlv >= maxLv {
code = pb.ErrorCode_LibraryMaxLv errdata = &pb.ErrorData{
Code: pb.ErrorCode_LibraryMaxLv,
Title: pb.ErrorCode_LibraryMaxLv.ToString(),
}
return return
} }
sCount = _heroObj.Givecount sCount = _heroObj.Givecount
@ -66,7 +67,10 @@ func (this *apiComp) UseGift(session comm.IUserSession, req *pb.LibraryUseGiftRe
c := this.module.ModuleTools.GetGlobalConf().FavorabilityAttenuation c := this.module.ModuleTools.GetGlobalConf().FavorabilityAttenuation
maxCoun := c[len(c)-1].K + 1 maxCoun := c[len(c)-1].K + 1
if sCount+req.Counts > maxCoun { // 当天赠送次数 if sCount+req.Counts > maxCoun { // 当天赠送次数
code = pb.ErrorCode_LibraryGiveMaxCount errdata = &pb.ErrorData{
Code: pb.ErrorCode_LibraryGiveMaxCount,
Title: pb.ErrorCode_LibraryGiveMaxCount.ToString(),
}
return return
} }
var last int32 = 1 var last int32 = 1
@ -88,10 +92,6 @@ func (this *apiComp) UseGift(session comm.IUserSession, req *pb.LibraryUseGiftRe
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 _c.LikesFood { // 喜欢的食物 for _, v := range _c.LikesFood { // 喜欢的食物
@ -182,10 +182,6 @@ func (this *apiComp) UseGift(session comm.IUserSession, req *pb.LibraryUseGiftRe
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
} }
} }

View File

@ -1,6 +1,7 @@
package mail package mail
import ( import (
"fmt"
"go_dreamfactory/comm" "go_dreamfactory/comm"
"go_dreamfactory/pb" "go_dreamfactory/pb"
) )
@ -24,14 +25,17 @@ func (this *apiComp) DelAllMail(session comm.IUserSession, req *pb.MailDelAllMai
err error err error
mailData []*pb.DBMailData mailData []*pb.DBMailData
) )
code = this.DelAllMailCheck(session, req) // check if errdata = this.DelAllMailCheck(session, req); errdata != nil {
if errdata != nil {
return return
} }
mailinfo, err = this.module.modelMail.MailQueryUserMail(session.GetUserId()) mailinfo, err = this.module.modelMail.MailQueryUserMail(session.GetUserId())
if err != nil { if err != nil {
this.module.Errorf("Mail_GetList_Resp err:%v", err) this.module.Errorf("Mail_GetList_Resp err:%v", err)
code = pb.ErrorCode_CacheReadError errdata = &pb.ErrorData{
Code: pb.ErrorCode_CacheReadError,
Title: pb.ErrorCode_CacheReadError.ToString(),
Message: err.Error(),
}
return return
} }
@ -39,7 +43,11 @@ func (this *apiComp) DelAllMail(session comm.IUserSession, req *pb.MailDelAllMai
if v.Check == false || (v.Reward && len(v.Items) > 0) { if v.Check == false || (v.Reward && len(v.Items) > 0) {
bRet := this.module.modelMail.MailDelUserMail(v.ObjId) bRet := this.module.modelMail.MailDelUserMail(v.ObjId)
if !bRet { if !bRet {
code = pb.ErrorCode_MailErr // 邮件不存在 errdata = &pb.ErrorData{ // 邮件不存在
Code: pb.ErrorCode_MailErr,
Title: pb.ErrorCode_MailErr.ToString(),
Message: fmt.Sprint("邮件不存在:%s",v.ObjId),
}
return return
} }
continue continue

View File

@ -1,6 +1,7 @@
package mail package mail
import ( import (
"fmt"
"go_dreamfactory/comm" "go_dreamfactory/comm"
"go_dreamfactory/pb" "go_dreamfactory/pb"
) )
@ -19,13 +20,16 @@ func (this *apiComp) DelMailCheck(session comm.IUserSession, req *pb.MailDelMail
// 删除邮件 // 删除邮件
func (this *apiComp) DelMail(session comm.IUserSession, req *pb.MailDelMailReq) (errdata *pb.ErrorData) { func (this *apiComp) DelMail(session comm.IUserSession, req *pb.MailDelMailReq) (errdata *pb.ErrorData) {
code = this.DelMailCheck(session, req) // check if errdata = this.DelMailCheck(session, req); errdata != nil {
if errdata != nil {
return return
} }
bRet := this.module.modelMail.MailDelUserMail(req.ObjID) bRet := this.module.modelMail.MailDelUserMail(req.ObjID)
if !bRet { if !bRet {
code = pb.ErrorCode_MailErr // 邮件不存在 errdata = &pb.ErrorData{ // 邮件不存在
Code: pb.ErrorCode_MailErr,
Title: pb.ErrorCode_MailErr.ToString(),
Message: fmt.Sprint("邮件不存在:%s", req.ObjID),
}
return return
} }
session.SendMsg(string(this.module.GetType()), "delmail", &pb.MailDelMailResp{ObjID: req.ObjID}) session.SendMsg(string(this.module.GetType()), "delmail", &pb.MailDelMailResp{ObjID: req.ObjID})

View File

@ -8,7 +8,10 @@ import (
func (this *apiComp) GetUserMailAttachmentCheck(session comm.IUserSession, req *pb.MailGetUserMailAttachmentReq) (errdata *pb.ErrorData) { func (this *apiComp) GetUserMailAttachmentCheck(session comm.IUserSession, req *pb.MailGetUserMailAttachmentReq) (errdata *pb.ErrorData) {
if req.ObjID == "" { if req.ObjID == "" {
return pb.ErrorCode_ReqParameterError errdata = &pb.ErrorData{ // 邮件不存在
Code: pb.ErrorCode_ReqParameterError,
Title: pb.ErrorCode_ReqParameterError.ToString(),
}
} }
return return
} }
@ -16,17 +19,23 @@ func (this *apiComp) GetUserMailAttachmentCheck(session comm.IUserSession, req *
// 领取附件 // 领取附件
func (this *apiComp) GetUserMailAttachment(session comm.IUserSession, req *pb.MailGetUserMailAttachmentReq) (errdata *pb.ErrorData) { func (this *apiComp) GetUserMailAttachment(session comm.IUserSession, req *pb.MailGetUserMailAttachmentReq) (errdata *pb.ErrorData) {
code = this.GetUserMailAttachmentCheck(session, req) // check if errdata = this.GetUserMailAttachmentCheck(session, req); errdata != nil {
if errdata != nil {
return return
} }
mail, err := this.module.modelMail.MailGetMailAttachmentState(req.ObjID) mail, err := this.module.modelMail.MailGetMailAttachmentState(req.ObjID)
if err != nil { if err != nil {
code = pb.ErrorCode_MailErr errdata = &pb.ErrorData{
Code: pb.ErrorCode_MailErr,
Title: pb.ErrorCode_MailErr.ToString(),
Message: err.Error(),
}
return return
} }
if mail.Reward || len(mail.GetItems()) == 0 || mail.Uid != session.GetUserId() { if mail.Reward || len(mail.GetItems()) == 0 || mail.Uid != session.GetUserId() {
code = pb.ErrorCode_StateInvalid errdata = &pb.ErrorData{
Code: pb.ErrorCode_StateInvalid,
Title: pb.ErrorCode_StateInvalid.ToString(),
}
return return
} }
if _data, err := this.module.modelMail.MailGetMailAttachment(req.ObjID); err == nil { if _data, err := this.module.modelMail.MailGetMailAttachment(req.ObjID); err == nil {
@ -40,7 +49,7 @@ func (this *apiComp) GetUserMailAttachment(session comm.IUserSession, req *pb.Ma
} }
res = append(res, d) res = append(res, d)
} }
if errdata = this.module.DispenseRes(session, res, true); code == pb.ErrorCode_Success { if errdata = this.module.DispenseRes(session, res, true); errdata == nil {
// 修改状态 // 修改状态
this.module.modelMail.MailUpdateMailAttachmentState(req.ObjID) this.module.modelMail.MailUpdateMailAttachmentState(req.ObjID)
mail.Reward = true mail.Reward = true
@ -63,17 +72,23 @@ func (this *apiComp) GetAllMailAttachment(session comm.IUserSession, req *pb.Mai
var ( var (
mailIds []string mailIds []string
) )
code = this.GetAllMailAttachmentCheck(session, req) // check if errdata = this.GetAllMailAttachmentCheck(session, req); errdata != nil {
if errdata != nil {
return return
} }
mails, err := this.module.modelMail.MailQueryUserMailByReard(session.GetUserId()) mails, err := this.module.modelMail.MailQueryUserMailByReard(session.GetUserId())
if err != nil { if err != nil {
code = pb.ErrorCode_MailErr errdata = &pb.ErrorData{
Code: pb.ErrorCode_MailErr,
Title: pb.ErrorCode_MailErr.ToString(),
Message: err.Error(),
}
return return
} }
if len(mails) == 0 { if len(mails) == 0 {
code = pb.ErrorCode_MailErr errdata = &pb.ErrorData{
Code: pb.ErrorCode_MailErr,
Title: pb.ErrorCode_MailErr.ToString(),
}
return return
} }
fj := make([]*pb.UserAssets, 0) fj := make([]*pb.UserAssets, 0)
@ -89,7 +104,7 @@ func (this *apiComp) GetAllMailAttachment(session comm.IUserSession, req *pb.Mai
fj = append(fj, v1) fj = append(fj, v1)
res = append(res, d) res = append(res, d)
} }
if errdata = this.module.DispenseRes(session, res, true); code == pb.ErrorCode_Success { if errdata = this.module.DispenseRes(session, res, true); errdata == nil {
this.module.modelMail.MailUpdateMailAttachmentState(v.ObjId) this.module.modelMail.MailUpdateMailAttachmentState(v.ObjId)
v.Reward = true v.Reward = true
v.Check = true v.Check = true

View File

@ -17,13 +17,16 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.MailGetListReq)
defer func() { defer func() {
session.SendMsg(string(this.module.GetType()), "getlist", &pb.MailGetListResp{Mails: mailinfo}) session.SendMsg(string(this.module.GetType()), "getlist", &pb.MailGetListResp{Mails: mailinfo})
}() }()
code = this.GetListCheck(session, req) // check if errdata = this.GetListCheck(session, req); errdata != nil {
if errdata != nil {
return return
} }
if mailinfo, err = this.module.modelMail.MailQueryUserMail(session.GetUserId()); err != nil { if mailinfo, err = this.module.modelMail.MailQueryUserMail(session.GetUserId()); err != nil {
this.module.Errorf("Mail_GetList_Resp err:%v", err) this.module.Errorf("Mail_GetList_Resp err:%v", err)
code = pb.ErrorCode_CacheReadError errdata = &pb.ErrorData{
Code: pb.ErrorCode_CacheReadError,
Title: pb.ErrorCode_CacheReadError.ToString(),
Message: err.Error(),
}
return return
} }

View File

@ -23,9 +23,8 @@ func (this *apiComp) ReadMail(session comm.IUserSession, req *pb.MailReadMailReq
mail *pb.DBMailData mail *pb.DBMailData
) )
code = this.ReadMailCheck(session, req) // check if errdata = this.ReadMailCheck(session, req); errdata != nil {
if errdata != nil { this.module.Debugf("read mail failed err : %v", errdata)
this.module.Debugf("read mail failed%d", code)
return return
} }
mail, err = this.module.modelMail.MailReadOneMail(req.ObjID) mail, err = this.module.modelMail.MailReadOneMail(req.ObjID)

View File

@ -45,6 +45,9 @@ func (this *modelMail) MailQueryUserMail(uId string) (mail []*pb.DBMailData, err
} }
} }
} }
if len(mail) == 0 { // 没有邮件的时候 err返回空
err = nil
}
return return
} }

View File

@ -1,6 +1,7 @@
package mline package mline
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"
@ -32,7 +33,11 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.MlineChallenge
return // 参数校验失败直接返回 return // 参数校验失败直接返回
} }
if stageConf = this.module.configure.GetMainStageConf(req.StageId); stageConf == nil { // 配置文件校验 if stageConf = this.module.configure.GetMainStageConf(req.StageId); stageConf == nil { // 配置文件校验
code = pb.ErrorCode_MainlineNotFindChapter errdata = &pb.ErrorData{
Code: pb.ErrorCode_MainlineNotFindChapter,
Title: pb.ErrorCode_MainlineNotFindChapter.ToString(),
Message: fmt.Sprintf("GetMainStageConf 配置没有找到:%d", req.StageId),
}
return return
} }
@ -47,7 +52,12 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.MlineChallenge
//preStage := this.module.configure.GetMainStageConf(stageConf.Previoustage) // 新章节数据校验 //preStage := this.module.configure.GetMainStageConf(stageConf.Previoustage) // 新章节数据校验
preStageConf := this.module.configure.GetMainStageConf(stageConf.Previoustage) preStageConf := this.module.configure.GetMainStageConf(stageConf.Previoustage)
if preStageConf == nil { // 配置文件校验 if preStageConf == nil { // 配置文件校验
code = pb.ErrorCode_MainlineNotFindChapter
errdata = &pb.ErrorData{
Code: pb.ErrorCode_MainlineNotFindChapter,
Title: pb.ErrorCode_MainlineNotFindChapter.ToString(),
Message: fmt.Sprintf("GetMainStageConf 配置没有找到:%d", stageConf.Previoustage),
}
return return
} }
@ -72,7 +82,10 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.MlineChallenge
} }
} }
if curChapter == nil { if curChapter == nil {
code = pb.ErrorCode_MainlineNotFindChapter errdata = &pb.ErrorData{
Code: pb.ErrorCode_MainlineNotFindChapter,
Title: pb.ErrorCode_MainlineNotFindChapter.ToString(),
}
return return
} }
if v1, ok := curChapter.Ps[req.StageId]; ok && v1 == 0 { if v1, ok := curChapter.Ps[req.StageId]; ok && v1 == 0 {
@ -106,7 +119,7 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.MlineChallenge
"ps": curChapter.Ps, "ps": curChapter.Ps,
}) })
} }
code, record := this.module.battle.CreatePveBattle(session, &pb.BattlePVEReq{ errdata, record := this.module.battle.CreatePveBattle(session, &pb.BattlePVEReq{
Ptype: pb.PlayType_mainline, Ptype: pb.PlayType_mainline,
Title: "", Title: "",
Format: req.Battle, Format: req.Battle,

View File

@ -1,6 +1,7 @@
package mline package mline
import ( import (
"fmt"
"go_dreamfactory/comm" "go_dreamfactory/comm"
"go_dreamfactory/pb" "go_dreamfactory/pb"
@ -34,12 +35,14 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.MlineChall
) )
rsp = &pb.MlineChallengeOverResp{} rsp = &pb.MlineChallengeOverResp{}
update = make(map[string]interface{}) update = make(map[string]interface{})
code = this.ChallengeOverCheck(session, req) if errdata = this.ChallengeOverCheck(session, req); errdata != nil {
if errdata != nil {
return // 参数校验失败直接返回 return // 参数校验失败直接返回
} }
if stageConf = this.module.configure.GetMainStageConf(req.StageId); stageConf == nil { // 配置文件校验 if stageConf = this.module.configure.GetMainStageConf(req.StageId); stageConf == nil { // 配置文件校验
code = pb.ErrorCode_MainlineNotFindChapter errdata = &pb.ErrorData{
Code: pb.ErrorCode_MainlineNotFindChapter,
Title: pb.ErrorCode_MainlineNotFindChapter.ToString(),
}
return return
} }
@ -51,23 +54,33 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.MlineChall
} }
} }
if curChapter == nil { if curChapter == nil {
code = pb.ErrorCode_MainlineNotFindChapter errdata = &pb.ErrorData{
Code: pb.ErrorCode_MainlineNotFindChapter,
Title: pb.ErrorCode_MainlineNotFindChapter.ToString(),
}
return return
} }
// 校验通过 // 校验通过
code, isWin = this.module.battle.CheckBattleReport(session, req.Report) errdata, isWin = this.module.battle.CheckBattleReport(session, req.Report)
if errdata != nil { if errdata != nil {
return return
} }
if v, ok := curChapter.Ps[req.StageId]; !ok || v == 0 {
if !isWin { // 战斗失败返还扣除的体力 errdata = &pb.ErrorData{
if v, ok := curChapter.Ps[req.StageId]; ok && v > 0 { Code: pb.ErrorCode_HuntingLvErr,
if errdata = this.module.DispenseRes(session, stageConf.PsConsume, true); errdata != nil { // 返还预扣体力 Title: pb.ErrorCode_HuntingLvErr.ToString(),
return Message: fmt.Sprintf("关卡体力参数异常:%d,预扣体力:%d", session.GetUserId(), v),
} }
return
} }
curChapter.Ps[req.StageId] = 0 // 清空预扣体力值 curChapter.Ps[req.StageId] = 0 // 清空预扣体力值
update["ps"] = curChapter.Ps update["ps"] = curChapter.Ps
if !isWin { // 战斗失败返还扣除的体力
if errdata = this.module.DispenseRes(session, stageConf.PsConsume, true); errdata != nil { // 返还预扣体力
return
}
this.module.modelMline.modifyMlineData(session.GetUserId(), curChapter.Id, update) this.module.modelMline.modifyMlineData(session.GetUserId(), curChapter.Id, update)
//code = pb.ErrorCode_BattleNoWin //code = pb.ErrorCode_BattleNoWin
rsp.Data = curChapter rsp.Data = curChapter
@ -80,7 +93,6 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.MlineChall
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(),
} }
return return
} }
@ -131,9 +143,6 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.MlineChall
} }
} }
curChapter.Ps[req.StageId] = 0 // 清空预扣体力值
update["ps"] = curChapter.Ps
curChapter.StageId = req.StageId curChapter.StageId = req.StageId
update["stageId"] = curChapter.StageId update["stageId"] = curChapter.StageId

View File

@ -29,7 +29,10 @@ func (this *apiComp) CleanStage(session comm.IUserSession, req *pb.MlineCleanSta
return // 参数校验失败直接返回 return // 参数校验失败直接返回
} }
if stageConf = this.module.configure.GetMainStageConf(req.StageId); stageConf == nil { // 配置文件校验 if stageConf = this.module.configure.GetMainStageConf(req.StageId); stageConf == nil { // 配置文件校验
code = pb.ErrorCode_MainlineNotFindChapter errdata = &pb.ErrorData{
Code: pb.ErrorCode_MainlineNotFindChapter,
Title: pb.ErrorCode_MainlineNotFindChapter.ToString(),
}
return return
} }
@ -41,11 +44,17 @@ func (this *apiComp) CleanStage(session comm.IUserSession, req *pb.MlineCleanSta
} }
} }
if curChapter == nil { // 校验是不是新的数据 if curChapter == nil { // 校验是不是新的数据
code = pb.ErrorCode_MainlineNotFindChapter errdata = &pb.ErrorData{
Code: pb.ErrorCode_MainlineNotFindChapter,
Title: pb.ErrorCode_MainlineNotFindChapter.ToString(),
}
return return
} }
if v, ok := curChapter.Star[req.StageId]; !ok || v < 3 { if v, ok := curChapter.Star[req.StageId]; !ok || v < 3 {
code = pb.ErrorCode_MainlineNoEnoughStar errdata = &pb.ErrorData{
Code: pb.ErrorCode_MainlineNoEnoughStar,
Title: pb.ErrorCode_MainlineNoEnoughStar.ToString(),
}
return return
} }
if errdata = this.module.DispenseRes(session, stageConf.Commonaward, true); errdata != nil { if errdata = this.module.DispenseRes(session, stageConf.Commonaward, true); errdata != nil {

View File

@ -34,7 +34,6 @@ func (this *apiComp) GetReward(session comm.IUserSession, req *pb.MlineGetReward
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(),
} }
return return
} }
@ -46,11 +45,17 @@ func (this *apiComp) GetReward(session comm.IUserSession, req *pb.MlineGetReward
} }
} }
if curChapter == nil { if curChapter == nil {
code = pb.ErrorCode_MainlineNotFindChapter errdata = &pb.ErrorData{
Code: pb.ErrorCode_MainlineNotFindChapter,
Title: pb.ErrorCode_MainlineNotFindChapter.ToString(),
}
return return
} }
if b, ok := curChapter.Award[req.Star]; ok && b { // 重复领奖 if b, ok := curChapter.Award[req.Star]; ok && b { // 重复领奖
code = pb.ErrorCode_MainlineRepeatReward errdata = &pb.ErrorData{
Code: pb.ErrorCode_MainlineRepeatReward,
Title: pb.ErrorCode_MainlineRepeatReward.ToString(),
}
return return
} }

View File

@ -63,10 +63,6 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.MlineGetListReq)
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
} }
} }

View File

@ -23,20 +23,25 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.PagodaChalleng
pagoda *pb.DBPagoda pagoda *pb.DBPagoda
err error err error
) )
code = this.ChallengeCheck(session, req) if errdata = this.ChallengeCheck(session, req); errdata != nil {
if errdata != nil {
return // 参数校验失败直接返回 return // 参数校验失败直接返回
} }
conf := this.module.configure.GetPagodaConfigData(req.Cid) conf := this.module.configure.GetPagodaConfigData(req.Cid)
if conf == nil { if conf == nil {
code = pb.ErrorCode_PagodaNotFound errdata = &pb.ErrorData{
Code: pb.ErrorCode_PagodaNotFound,
Title: pb.ErrorCode_PagodaNotFound.ToString(),
}
return return
} }
pagoda, err = this.module.modelPagoda.getPagodaList(session.GetUserId()) pagoda, err = this.module.modelPagoda.getPagodaList(session.GetUserId())
if err != nil { if err != nil {
code = pb.ErrorCode_PagodaNotFound errdata = &pb.ErrorData{
Code: pb.ErrorCode_PagodaNotFound,
Title: pb.ErrorCode_PagodaNotFound.ToString(),
}
return return
} }
@ -44,12 +49,18 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.PagodaChalleng
if conf.LayerNum == 1 { if conf.LayerNum == 1 {
pagoda.Data[conf.Tab] = 0 pagoda.Data[conf.Tab] = 0
} else { } else {
code = pb.ErrorCode_PagodaLevlErr // 挑战关卡数据不匹配 errdata = &pb.ErrorData{ // 挑战关卡数据不匹配
Code: pb.ErrorCode_PagodaLevlErr,
Title: pb.ErrorCode_PagodaLevlErr.ToString(),
}
return return
} }
} else { } else {
if conf.LayerNum-1 != v { if conf.LayerNum-1 != v {
code = pb.ErrorCode_PagodaLevlErr // 挑战关卡数据不匹配 errdata = &pb.ErrorData{ // 挑战关卡数据不匹配
Code: pb.ErrorCode_PagodaLevlErr,
Title: pb.ErrorCode_PagodaLevlErr.ToString(),
}
return return
} }
} }
@ -57,11 +68,14 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.PagodaChalleng
// 校验条件 // 校验条件
if conf.Unlock != 0 { if conf.Unlock != 0 {
if !this.mline.CheckCommpleteStage(session.GetUserId(), conf.Unlock) { if !this.mline.CheckCommpleteStage(session.GetUserId(), conf.Unlock) {
code = pb.ErrorCode_PagodaUnlock errdata = &pb.ErrorData{
Code: pb.ErrorCode_PagodaUnlock,
Title: pb.ErrorCode_PagodaUnlock.ToString(),
}
return return
} }
} }
code, record := this.module.battle.CreatePveBattle(session, &pb.BattlePVEReq{ errdata, record := this.module.battle.CreatePveBattle(session, &pb.BattlePVEReq{
Ptype: pb.PlayType_pagoda, Ptype: pb.PlayType_pagoda,
Title: "", Title: "",
Format: req.Battle, Format: req.Battle,

View File

@ -32,19 +32,24 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.PagodaChal
err error err error
) )
mapData = make(map[string]interface{}, 0) mapData = make(map[string]interface{}, 0)
code = this.ChallengeOverCheck(session, req) if errdata = this.ChallengeOverCheck(session, req); errdata != nil {
if errdata != nil {
return // 参数校验失败直接返回 return // 参数校验失败直接返回
} }
conf := this.module.configure.GetPagodaConfigData(req.Cid) conf := this.module.configure.GetPagodaConfigData(req.Cid)
if conf == nil { if conf == nil {
code = pb.ErrorCode_PagodaNotFound errdata = &pb.ErrorData{
Code: pb.ErrorCode_PagodaNotFound,
Title: pb.ErrorCode_PagodaNotFound.ToString(),
}
return return
} }
pagoda, err = this.module.modelPagoda.getPagodaList(session.GetUserId()) pagoda, err = this.module.modelPagoda.getPagodaList(session.GetUserId())
if err != nil { if err != nil {
code = pb.ErrorCode_PagodaNotFound errdata = &pb.ErrorData{
Code: pb.ErrorCode_PagodaNotFound,
Title: pb.ErrorCode_PagodaNotFound.ToString(),
}
return return
} }
@ -52,29 +57,41 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.PagodaChal
if conf.LayerNum == 1 { if conf.LayerNum == 1 {
pagoda.Data[conf.Tab] = 0 pagoda.Data[conf.Tab] = 0
} else { } else {
code = pb.ErrorCode_PagodaLevlErr // 挑战关卡数据不匹配 errdata = &pb.ErrorData{
Code: pb.ErrorCode_PagodaLevlErr, // 挑战关卡数据不匹配
Title: pb.ErrorCode_PagodaLevlErr.ToString(),
}
return return
} }
} else { } else {
if conf.LayerNum-1 != v { if conf.LayerNum-1 != v {
code = pb.ErrorCode_PagodaLevlErr // 挑战关卡数据不匹配 errdata = &pb.ErrorData{
Code: pb.ErrorCode_PagodaLevlErr, // 挑战关卡数据不匹配
Title: pb.ErrorCode_PagodaLevlErr.ToString(),
}
return return
} }
} }
// 校验条件 // 校验条件
if conf.Unlock != 0 { if conf.Unlock != 0 {
if !this.mline.CheckCommpleteStage(session.GetUserId(), conf.Unlock) { if !this.mline.CheckCommpleteStage(session.GetUserId(), conf.Unlock) {
code = pb.ErrorCode_PagodaUnlock errdata = &pb.ErrorData{
Code: pb.ErrorCode_PagodaUnlock, // 挑战关卡未解锁
Title: pb.ErrorCode_PagodaUnlock.ToString(),
}
return return
} }
} }
// 校验通过 // 校验通过
code, isWin = this.module.battle.CheckBattleReport(session, req.Report) errdata, isWin = this.module.battle.CheckBattleReport(session, req.Report)
if errdata != nil { if errdata != nil {
return return
} }
if !isWin { // 战斗失败直接返回 if !isWin { // 战斗失败直接返回
code = pb.ErrorCode_BattleNoWin errdata = &pb.ErrorData{
Code: pb.ErrorCode_BattleNoWin,
Title: pb.ErrorCode_BattleNoWin.ToString(),
}
return return
} }
// 加经验 // 加经验
@ -92,7 +109,7 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.PagodaChal
mapData["type"] = pagoda.Type mapData["type"] = pagoda.Type
mapData["data"] = pagoda.Data mapData["data"] = pagoda.Data
code = this.module.ModifyPagodaData(session.GetUserId(), mapData) errdata = this.module.ModifyPagodaData(session.GetUserId(), mapData)
session.SendMsg(string(this.module.GetType()), PagodaChallengeOverResp, &pb.PagodaChallengeOverResp{Data: pagoda}) session.SendMsg(string(this.module.GetType()), PagodaChallengeOverResp, &pb.PagodaChallengeOverResp{Data: pagoda})
if user := this.module.ModuleUser.GetUser(session.GetUserId()); user != nil { // 发系统公告 if user := this.module.ModuleUser.GetUser(session.GetUserId()); user != nil { // 发系统公告
this.chat.SendSysChatToWorld(comm.ChatSystem4, nil, pagoda.PagodaId, 0, user.Name) this.chat.SendSysChatToWorld(comm.ChatSystem4, nil, pagoda.PagodaId, 0, user.Name)
@ -142,7 +159,7 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.PagodaChal
} }
// 通关奖励 // 通关奖励
code = this.module.DispenseRes(session, conf.Reward, true) errdata = this.module.DispenseRes(session, conf.Reward, true)
if errdata != nil { if errdata != nil {
return return
} }

View File

@ -18,8 +18,7 @@ func (this *apiComp) GetRewardCheck(session comm.IUserSession, req *pb.PagodaGet
func (this *apiComp) GetReward(session comm.IUserSession, req *pb.PagodaGetRewardReq) (errdata *pb.ErrorData) { func (this *apiComp) GetReward(session comm.IUserSession, req *pb.PagodaGetRewardReq) (errdata *pb.ErrorData) {
code = this.GetRewardCheck(session, req) if errdata = this.GetRewardCheck(session, req); errdata != nil {
if errdata != nil {
return // 参数校验失败直接返回 return // 参数校验失败直接返回
} }
@ -35,12 +34,18 @@ func (this *apiComp) GetReward(session comm.IUserSession, req *pb.PagodaGetRewar
} }
// 校验是否能领取 // 校验是否能领取
if _cfg.LayerNum > pagoda.PagodaId { if _cfg.LayerNum > pagoda.PagodaId {
code = pb.ErrorCode_PagodaConditionErr errdata = &pb.ErrorData{
Code: pb.ErrorCode_PagodaConditionErr,
Title: pb.ErrorCode_PagodaConditionErr.ToString(),
}
return return
} }
if _, ok := pagoda.Reward[req.Id]; ok { // 校验是否重复领取 if _, ok := pagoda.Reward[req.Id]; ok { // 校验是否重复领取
code = pb.ErrorCode_PagodaGetRewardErr errdata = &pb.ErrorData{
Code: pb.ErrorCode_PagodaGetRewardErr,
Title: pb.ErrorCode_PagodaGetRewardErr.ToString(),
}
return return
} }
if pagoda.Reward == nil { if pagoda.Reward == nil {
@ -53,7 +58,7 @@ func (this *apiComp) GetReward(session comm.IUserSession, req *pb.PagodaGetRewar
pagoda.Reward[req.Id] = true pagoda.Reward[req.Id] = true
mapData := make(map[string]interface{}, 0) mapData := make(map[string]interface{}, 0)
mapData["reward"] = pagoda.Reward mapData["reward"] = pagoda.Reward
code = this.module.ModifyPagodaData(session.GetUserId(), mapData) errdata = this.module.ModifyPagodaData(session.GetUserId(), mapData)
session.SendMsg(string(this.module.GetType()), PagodaGetRewardResp, &pb.PagodaGetRewardResp{Data: pagoda}) session.SendMsg(string(this.module.GetType()), PagodaGetRewardResp, &pb.PagodaGetRewardResp{Data: pagoda})
} }

View File

@ -21,8 +21,7 @@ func (this *apiComp) RankList(session comm.IUserSession, req *pb.PagodaRankListR
szRank []*pb.DBPagodaRecord szRank []*pb.DBPagodaRecord
rd *redis.StringSliceCmd rd *redis.StringSliceCmd
) )
code = this.RankListCheck(session, req) if errdata = this.RankListCheck(session, req); errdata != nil {
if errdata != nil {
return return
} }
if !req.Friend { if !req.Friend {

View File

@ -29,7 +29,10 @@ func (this *apiComp) WarOrder(session comm.IUserSession, req *pb.PagodaWarOrderR
list, _ = this.module.modelPagoda.getPagodaList(session.GetUserId()) list, _ = this.module.modelPagoda.getPagodaList(session.GetUserId())
if list.Id == "" { if list.Id == "" {
code = pb.ErrorCode_PagodaConditionErr // 领取条件没达到 errdata = &pb.ErrorData{
Code: pb.ErrorCode_PagodaConditionErr, // 领取条件没达到
Title: pb.ErrorCode_PagodaConditionErr.ToString(),
}
return return
} }
@ -46,7 +49,10 @@ func (this *apiComp) WarOrder(session comm.IUserSession, req *pb.PagodaWarOrderR
} }
if vip && bReward { if vip && bReward {
if list.PagodaId < list.VipPassCheckID { // 层数校验 if list.PagodaId < list.VipPassCheckID { // 层数校验
code = pb.ErrorCode_PagodaConditionErr // 领取条件没达到 errdata = &pb.ErrorData{
Code: pb.ErrorCode_PagodaConditionErr, // 领取条件没达到
Title: pb.ErrorCode_PagodaConditionErr.ToString(),
}
return return
} }
} }
@ -115,7 +121,7 @@ func (this *apiComp) WarOrder(session comm.IUserSession, req *pb.PagodaWarOrderR
}) })
} }
code = this.module.ModifyPagodaData(session.GetUserId(), mapData) errdata = this.module.ModifyPagodaData(session.GetUserId(), mapData)
session.SendMsg(string(this.module.GetType()), PagodaWarOrderResp, &pb.PagodaWarOrderResp{ session.SendMsg(string(this.module.GetType()), PagodaWarOrderResp, &pb.PagodaWarOrderResp{
Data: list, Data: list,
Itmes: res, Itmes: res,

View File

@ -98,7 +98,7 @@ func (this *Pagoda) ModifyPagodaFloor(session comm.IUserSession, level int32) (e
list.Complete = true list.Complete = true
mapData["complete"] = true mapData["complete"] = true
} }
code = this.ModifyPagodaData(session.GetUserId(), mapData) errdata = this.ModifyPagodaData(session.GetUserId(), mapData)
session.SendMsg(string(this.GetType()), PagodaGetListResp, &pb.PagodaGetListResp{Data: list}) session.SendMsg(string(this.GetType()), PagodaGetListResp, &pb.PagodaGetListResp{Data: list})
} }

View File

@ -26,7 +26,10 @@ func (this *apiComp) BuyGift(session comm.IUserSession, req *pb.PrivilegeBuyGift
userinfo := this.module.ModuleUser.GetUser(session.GetUserId()) userinfo := this.module.ModuleUser.GetUser(session.GetUserId())
if userinfo.Vip == 0 || userinfo.Vip < req.VipLv { if userinfo.Vip == 0 || userinfo.Vip < req.VipLv {
code = pb.ErrorCode_VipLvError // vip 等级不足 errdata = &pb.ErrorData{
Code: pb.ErrorCode_VipLvError, // vip 等级不足
Title: pb.ErrorCode_VipLvError.ToString(),
}
return return
} }
conf := this.module.configure.GetVipConfigureData(req.VipLv) conf := this.module.configure.GetVipConfigureData(req.VipLv)
@ -34,17 +37,22 @@ func (this *apiComp) BuyGift(session comm.IUserSession, req *pb.PrivilegeBuyGift
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(),
} }
return return
} }
vip, err := this.module.modelVip.getVipList(session.GetUserId()) vip, err := this.module.modelVip.getVipList(session.GetUserId())
if err != nil { if err != nil {
code = pb.ErrorCode_VipLvError // vip 等级不足 errdata = &pb.ErrorData{
Code: pb.ErrorCode_DBError,
Title: pb.ErrorCode_DBError.ToString(),
}
return return
} }
if _, ok := vip.Reward[req.VipLv]; ok { if _, ok := vip.Reward[req.VipLv]; ok {
code = pb.ErrorCode_VipBuyRepeat // 礼包重复购买 errdata = &pb.ErrorData{ // 礼包重复购买
Code: pb.ErrorCode_VipBuyRepeat,
Title: pb.ErrorCode_VipBuyRepeat.ToString(),
}
return return
} }
// 消耗检测 // 消耗检测

View File

@ -22,6 +22,6 @@ func (this *apiComp) BuyYueka(session comm.IUserSession, req *pb.PrivilegeBuyYue
if errdata = this.BuyYuekaCheck(session, req); errdata != nil { if errdata = this.BuyYuekaCheck(session, req); errdata != nil {
return return
} }
code, _ = this.module.Delivery(session, req.CID) errdata, _ = this.module.Delivery(session, req.CID)
return return
} }

View File

@ -96,8 +96,10 @@ func (this *Privilege) Delivery(session comm.IUserSession, cId string) (errdata
if v.ETime > configure.Now().Unix() { // 加时间 if v.ETime > configure.Now().Unix() { // 加时间
// 检测能否续费 // 检测能否续费
if v.ETime-configure.Now().Unix() > int64(conf.RenewDay)*24*3600 { if v.ETime-configure.Now().Unix() > int64(conf.RenewDay)*24*3600 {
errdata = &pb.ErrorData{
code = pb.ErrorCode_PayRenewTimeErr Code: pb.ErrorCode_PayRenewTimeErr,
Title: pb.ErrorCode_PayRenewTimeErr.ToString(),
}
return return
} }
v.ETime += int64(conf.AssertDay) * 24 * 3600 v.ETime += int64(conf.AssertDay) * 24 * 3600
@ -199,7 +201,12 @@ func (this *Privilege) RenewPrivilegeCard(session comm.IUserSession, cId string)
if v.CId == cId { if v.CId == cId {
conf, err := this.configure.GetPrivilegeCard(cId) conf, err := this.configure.GetPrivilegeCard(cId)
if err != nil { if err != nil {
return pb.ErrorCode_ConfigNoFound errdata = &pb.ErrorData{
Code: pb.ErrorCode_ConfigNoFound,
Title: pb.ErrorCode_ReqParameterError.ToString(),
Message: err.Error(),
}
return
} }
if conf.RenewDay >= int32(configure.Now().Unix()-v.ETime)/(24*3600) { if conf.RenewDay >= int32(configure.Now().Unix()-v.ETime)/(24*3600) {
@ -213,13 +220,18 @@ func (this *Privilege) RenewPrivilegeCard(session comm.IUserSession, cId string)
} }
session.SendMsg(string(this.GetType()), PrivilegeBuyYuekaResp, &pb.PrivilegeGetListResp{Data: list}) session.SendMsg(string(this.GetType()), PrivilegeBuyYuekaResp, &pb.PrivilegeGetListResp{Data: list})
} else { } else {
code = pb.ErrorCode_PrivilegeRenewTime errdata = &pb.ErrorData{
Code: pb.ErrorCode_PrivilegeRenewTime,
Title: pb.ErrorCode_PrivilegeRenewTime.ToString(),
}
} }
break break
} }
} }
code = pb.ErrorCode_PrivilegeNotFound errdata = &pb.ErrorData{
Code: pb.ErrorCode_PrivilegeNotFound,
Title: pb.ErrorCode_PrivilegeNotFound.ToString(),
}
return return
} }

View File

@ -22,8 +22,7 @@ func (this *apiComp) AtlasActivate(session comm.IUserSession, req *pb.SmithyAtla
addScore int32 // 更新图鉴增加的积分 addScore int32 // 更新图鉴增加的积分
szTask []*pb.BuriedParam szTask []*pb.BuriedParam
) )
code = this.AtlasActivateCheck(session, req) if errdata = this.AtlasActivateCheck(session, req); errdata != nil {
if errdata != nil {
return // 参数校验失败直接返回 return // 参数校验失败直接返回
} }
atlas, err := this.module.modelAtlas.getSmithyAtlasList(session.GetUserId()) atlas, err := this.module.modelAtlas.getSmithyAtlasList(session.GetUserId())
@ -37,10 +36,9 @@ func (this *apiComp) AtlasActivate(session comm.IUserSession, req *pb.SmithyAtla
} }
conf, err := this.module.configure.GetSmithyAtlasConf(req.Id) conf, err := this.module.configure.GetSmithyAtlasConf(req.Id)
if err != nil { if err != nil {
code = pb.ErrorCode_SmithyNoFoundAtlas errdata = &pb.ErrorData{
data = &pb.ErrorData{ Code: pb.ErrorCode_SmithyNoFoundAtlas,
Title: pb.GetErrorCodeMsg(code), Title: pb.ErrorCode_SmithyNoFoundAtlas.ToString(),
Message: err.Error(),
} }
return return
} }
@ -58,7 +56,10 @@ func (this *apiComp) AtlasActivate(session comm.IUserSession, req *pb.SmithyAtla
v.Data1 = v.Data2 v.Data1 = v.Data2
v.Data2 = nil v.Data2 = nil
} else { } else {
code = pb.ErrorCode_SmithyNoActivateAtlas errdata = &pb.ErrorData{
Code: pb.ErrorCode_SmithyNoActivateAtlas,
Title: pb.ErrorCode_SmithyNoActivateAtlas.ToString(),
}
return return
} }
} }
@ -68,7 +69,10 @@ func (this *apiComp) AtlasActivate(session comm.IUserSession, req *pb.SmithyAtla
update["score"] = atlas.Score update["score"] = atlas.Score
this.module.modelAtlas.modifySmithyAtlasList(session.GetUserId(), update) this.module.modelAtlas.modifySmithyAtlasList(session.GetUserId(), update)
} else { } else {
code = pb.ErrorCode_SmithyNoFoundAtlas errdata = &pb.ErrorData{
Code: pb.ErrorCode_SmithyNoFoundAtlas,
Title: pb.ErrorCode_SmithyNoFoundAtlas.ToString(),
}
return return
} }
@ -84,7 +88,10 @@ func (this *apiComp) AtlasActivate(session comm.IUserSession, req *pb.SmithyAtla
this.module.modelAtlas.modifySmithyAtlasList(session.GetUserId(), update) this.module.modelAtlas.modifySmithyAtlasList(session.GetUserId(), update)
} }
} else { } else {
code = pb.ErrorCode_SmithyNoFoundAtlas errdata = &pb.ErrorData{
Code: pb.ErrorCode_SmithyNoFoundAtlas,
Title: pb.ErrorCode_SmithyNoFoundAtlas.ToString(),
}
return return
} }
} }

View File

@ -18,8 +18,7 @@ func (this *apiComp) AtlasAward(session comm.IUserSession, req *pb.SmithyAtlasAw
res []*cfg.Gameatn res []*cfg.Gameatn
respRes []*pb.UserAssets respRes []*pb.UserAssets
) )
code = this.AtlasAwardCheck(session, req) if errdata = this.AtlasAwardCheck(session, req); errdata != nil {
if errdata != nil {
return // 参数校验失败直接返回 return // 参数校验失败直接返回
} }
atlas, err := this.module.modelAtlas.getSmithyAtlasList(session.GetUserId()) atlas, err := this.module.modelAtlas.getSmithyAtlasList(session.GetUserId())
@ -43,7 +42,10 @@ func (this *apiComp) AtlasAward(session comm.IUserSession, req *pb.SmithyAtlasAw
res = append(res, conf.ItemId...) res = append(res, conf.ItemId...)
} }
if len(res) == 0 { // 没有奖励可领取 if len(res) == 0 { // 没有奖励可领取
code = pb.ErrorCode_MartialhallAtlasNoReward errdata = &pb.ErrorData{
Code: pb.ErrorCode_MartialhallAtlasNoReward,
Title: pb.ErrorCode_MartialhallAtlasNoReward.ToString(),
}
return return
} }
this.module.DispenseRes(session, res, true) this.module.DispenseRes(session, res, true)

View File

@ -64,7 +64,10 @@ func (this *apiComp) ForgeEquip(session comm.IUserSession, req *pb.SmithyForgeEq
// 校验图纸是否激活 // 校验图纸是否激活
if _, ok := stove.Data[req.ReelId]; !ok { // 是不是首次打造 if _, ok := stove.Data[req.ReelId]; !ok { // 是不是首次打造
if !this.module.configure.CheckSmithyFirstReelConfigData(reelcfg.Type, req.ReelId) { // 没有激活图纸 if !this.module.configure.CheckSmithyFirstReelConfigData(reelcfg.Type, req.ReelId) { // 没有激活图纸
code = pb.ErrorCode_SmithyNoReel errdata = &pb.ErrorData{
Code: pb.ErrorCode_SmithyNoReel,
Title: pb.ErrorCode_SmithyNoReel.ToString(),
}
return return
} }
stove.Data[req.ReelId] = &pb.Mastery{ stove.Data[req.ReelId] = &pb.Mastery{
@ -107,7 +110,10 @@ func (this *apiComp) ForgeEquip(session comm.IUserSession, req *pb.SmithyForgeEq
if req.Lava == 0 { if req.Lava == 0 {
// 检查炉温 是否够 // 检查炉温 是否够
if stove.Temperature < needT { if stove.Temperature < needT {
code = pb.ErrorCode_SmithyNoTemperature // 炉温不够 直接返回 errdata = &pb.ErrorData{
Code: pb.ErrorCode_SmithyNoTemperature,
Title: pb.ErrorCode_SmithyNoTemperature.ToString(),
}
return return
} }
stove.Temperature -= needT // 消耗温度 stove.Temperature -= needT // 消耗温度
@ -167,10 +173,7 @@ func (this *apiComp) ForgeEquip(session comm.IUserSession, req *pb.SmithyForgeEq
Message: err.Error(), Message: err.Error(),
} }
this.module.Errorf("GetSmithyMake配置没找到:%d", k) this.module.Errorf("GetSmithyMake配置没找到:%d", k)
data = &pb.ErrorData{
Title: pb.GetErrorCodeMsg(code),
Message: err.Error(),
}
return return
} }
hitLen += v hitLen += v
@ -211,9 +214,9 @@ func (this *apiComp) ForgeEquip(session comm.IUserSession, req *pb.SmithyForgeEq
sz := make([]int32, 4) // 最高 4个品质 sz := make([]int32, 4) // 最高 4个品质
// 获得极品权重 // 获得极品权重
sz[3] = this.module.modelStove.StoveToolsQualityProbability(stove) sz[3] = this.module.modelStove.StoveToolsQualityProbability(stove)
if equip, code1 := this.module.ModuleEquipment.GetForgeEquip(session, req.SuiteId, req.Position, customLv, sz); code1 != pb.ErrorCode_Success { if equip, code1 := this.module.ModuleEquipment.GetForgeEquip(session, req.SuiteId, req.Position, customLv, sz); code1 != nil {
code = code1 errdata = code1
this.module.Errorf("GetForgeEquip error: %v,req.SuiteId:%d, req.Position:%d, customLv:%d", code, req.SuiteId, req.Position, customLv) this.module.Errorf("GetForgeEquip error: %v,req.SuiteId:%d, req.Position:%d, customLv:%d", errdata, req.SuiteId, req.Position, customLv)
return return
} else { } else {
rsp.Equip = append(rsp.Equip, equip) rsp.Equip = append(rsp.Equip, equip)
@ -227,18 +230,18 @@ func (this *apiComp) ForgeEquip(session comm.IUserSession, req *pb.SmithyForgeEq
for i := 0; i < int(req.Count); i++ { for i := 0; i < int(req.Count); i++ {
res := this.module.configure.GetDropReward(newdrop) res := this.module.configure.GetDropReward(newdrop)
if ok := this.module.modelStove.CheckForgetwoEquip(req.ReelId, stove.Data[req.ReelId].Lv, addProbability); ok { if ok := this.module.modelStove.CheckForgetwoEquip(req.ReelId, stove.Data[req.ReelId].Lv, addProbability); ok {
if code, atno = this.module.DispenseAtno(session, res, true); code == pb.ErrorCode_Success { if errdata, atno = this.module.DispenseAtno(session, res, true); errdata == nil {
for _, v := range atno { for _, v := range atno {
if eq, err1 := this.module.ModuleEquipment.QueryEquipment(session.GetUserId(), v.O); err1 == pb.ErrorCode_Success { if eq, e := this.module.ModuleEquipment.QueryEquipment(session.GetUserId(), v.O); e == nil {
rsp.Equip = append(rsp.Equip, eq) rsp.Equip = append(rsp.Equip, eq)
} }
} }
} }
} }
if code, atno = this.module.DispenseAtno(session, res, true); code == pb.ErrorCode_Success { if errdata, atno = this.module.DispenseAtno(session, res, true); errdata == nil {
for _, v := range atno { for _, v := range atno {
if eq, err1 := this.module.ModuleEquipment.QueryEquipment(session.GetUserId(), v.O); err1 == pb.ErrorCode_Success { if eq, err1 := this.module.ModuleEquipment.QueryEquipment(session.GetUserId(), v.O); err1 == nil {
rsp.Equip = append(rsp.Equip, eq) rsp.Equip = append(rsp.Equip, eq)
} }
} }

View File

@ -18,7 +18,6 @@ func (this *apiComp) Customer(session comm.IUserSession, req *pb.SmithyCustomerR
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(),
} }
return return
} }

View File

@ -22,7 +22,12 @@ func (this *apiComp) TaskAward(session comm.IUserSession, req *pb.SmithyTaskAwar
if err := this.module.modelTask.updateTaskRecord(session.GetUserId(), req.TaskId); err != nil { if err := this.module.modelTask.updateTaskRecord(session.GetUserId(), req.TaskId); err != nil {
var errCustom = new(comm.CustomError) var errCustom = new(comm.CustomError)
if errors.As(err, &errCustom) { if errors.As(err, &errCustom) {
code = errCustom.Code //code = errCustom.Code
errdata = &pb.ErrorData{
Code: errCustom.Code,
Title: errCustom.Code.ToString(),
Message: err.Error(),
}
} else { } else {
errdata = &pb.ErrorData{ errdata = &pb.ErrorData{
Code: pb.ErrorCode_DBError, Code: pb.ErrorCode_DBError,
@ -41,10 +46,6 @@ func (this *apiComp) TaskAward(session comm.IUserSession, req *pb.SmithyTaskAwar
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
} else { } else {
if errdata = this.module.DispenseRes(session, conf.Reword, true); errdata != nil { if errdata = this.module.DispenseRes(session, conf.Reword, true); errdata != nil {

View File

@ -14,8 +14,7 @@ func (this *apiComp) StoveUpCheck(session comm.IUserSession, req *pb.SmithyStove
// 炉子升级 // 炉子升级
func (this *apiComp) StoveUp(session comm.IUserSession, req *pb.SmithyStoveUpReq) (errdata *pb.ErrorData) { func (this *apiComp) StoveUp(session comm.IUserSession, req *pb.SmithyStoveUpReq) (errdata *pb.ErrorData) {
code = this.StoveUpCheck(session, req) if errdata = this.StoveUpCheck(session, req); errdata != nil {
if errdata != nil {
return // 参数校验失败直接返回 return // 参数校验失败直接返回
} }
stove, err := this.module.modelStove.getSmithyStoveList(session.GetUserId()) stove, err := this.module.modelStove.getSmithyStoveList(session.GetUserId())
@ -34,17 +33,13 @@ func (this *apiComp) StoveUp(session comm.IUserSession, req *pb.SmithyStoveUpReq
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
} }
_, err = this.module.configure.GetSmithyStoveConf(stove.Lv + 1) _, err = this.module.configure.GetSmithyStoveConf(stove.Lv + 1)
if err != nil { if err != nil {
code = pb.ErrorCode_SmithyStoveMaxLv errdata = &pb.ErrorData{
data = &pb.ErrorData{ Code: pb.ErrorCode_SmithyStoveMaxLv,
Title: pb.GetErrorCodeMsg(code), Title: pb.ErrorCode_SmithyStoveMaxLv.ToString(),
Message: err.Error(), Message: err.Error(),
} }
return return

View File

@ -19,8 +19,7 @@ func (this *apiComp) ToolsUpCheck(session comm.IUserSession, req *pb.SmithyTools
// 工具升级 // 工具升级
func (this *apiComp) ToolsUp(session comm.IUserSession, req *pb.SmithyToolsUpReq) (errdata *pb.ErrorData) { func (this *apiComp) ToolsUp(session comm.IUserSession, req *pb.SmithyToolsUpReq) (errdata *pb.ErrorData) {
code = this.ToolsUpCheck(session, req) if errdata = this.ToolsUpCheck(session, req); errdata != nil {
if errdata != nil {
return // 参数校验失败直接返回 return // 参数校验失败直接返回
} }
stove, err := this.module.modelStove.getSmithyStoveList(session.GetUserId()) stove, err := this.module.modelStove.getSmithyStoveList(session.GetUserId())
@ -38,10 +37,6 @@ func (this *apiComp) ToolsUp(session comm.IUserSession, req *pb.SmithyToolsUpReq
Code: pb.ErrorCode_ReqParameterError, Code: pb.ErrorCode_ReqParameterError,
Title: pb.ErrorCode_ReqParameterError.ToString(), Title: pb.ErrorCode_ReqParameterError.ToString(),
} }
data = &pb.ErrorData{
Title: pb.GetErrorCodeMsg(code),
Message: err.Error(),
}
return return
} }
// 校验前置条件 // 校验前置条件
@ -56,14 +51,13 @@ func (this *apiComp) ToolsUp(session comm.IUserSession, req *pb.SmithyToolsUpReq
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 _, ok := stove.Skill[poreConf.SkillType]; !ok { if _, ok := stove.Skill[poreConf.SkillType]; !ok {
code = pb.ErrorCode_SmithyLvToolsPre // 前置条件不满足 errdata = &pb.ErrorData{
Code: pb.ErrorCode_SmithyLvToolsPre, // 前置条件不满足
Title: pb.ErrorCode_SmithyLvToolsPre.ToString(),
}
return return
} }
} }

View File

@ -23,17 +23,6 @@ func (this *apiComp) Sell(session comm.IUserSession, req *pb.SmithySellReq) (err
} }
//校验customer类型因为有的类型是不能进入交易逻辑的 //校验customer类型因为有的类型是不能进入交易逻辑的
//TODO
// cus, err := this.module.modelTrade.getDBCustomer(session.GetUserId())
// if err != nil {
// errdata = &pb.ErrorData{
Code: pb.ErrorCode_DBError,
Title: pb.ErrorCode_DBError.ToString(),
Message: err.Error(),
}
// return
// }
this.module.ModuleEquipment.RecycleEquipments(session, req.EquipIds, this.module.modelStove.StoveToolsSellUp(session.GetUserId())) this.module.ModuleEquipment.RecycleEquipments(session, req.EquipIds, this.module.modelStove.StoveToolsSellUp(session.GetUserId()))
@ -54,10 +43,6 @@ func (this *apiComp) Sell(session comm.IUserSession, req *pb.SmithySellReq) (err
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
} }

View File

@ -80,7 +80,7 @@ func (this *modelTask) checkTaskStatus(uid string, taskId int32) bool {
if conf == nil { if conf == nil {
return false return false
} }
if ec := this.module.ModuleRtask.CheckCondi(uid, conf.TypeId); ec != pb.ErrorCode_Success { if ec := this.module.ModuleRtask.CheckCondi(uid, conf.TypeId); ec != nil {
return false return false
} }
return true return true

View File

@ -175,7 +175,7 @@ func (s *modelTrade) GetSuitRandom(uid string) (suiteId int32) {
} }
//获取玩家已有装备 //获取玩家已有装备
ec, suites := s.module.ModuleEquipment.GetActionableSuit(uid) ec, suites := s.module.ModuleEquipment.GetActionableSuit(uid)
if ec != pb.ErrorCode_Success { if ec != nil {
s.module.Error("获取玩家已有装备:", log.Field{Key: "code", Value: ec}) s.module.Error("获取玩家已有装备:", log.Field{Key: "code", Value: ec})
return return
} }

View File

@ -23,8 +23,7 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.VikingChalleng
var ( var (
ps int32 ps int32
) )
code = this.ChallengeCheck(session, req) if errdata = this.ChallengeCheck(session, req); errdata != nil {
if errdata != nil {
return // 参数校验失败直接返回 return // 参数校验失败直接返回
} }
viking, _ := this.module.modelViking.getVikingList(session.GetUserId()) viking, _ := this.module.modelViking.getVikingList(session.GetUserId())
@ -36,10 +35,6 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.VikingChalleng
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
} }
@ -96,15 +91,21 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.VikingChalleng
} }
if value, ok := viking.Boss[req.BossId]; ok { // 类型校验 if value, ok := viking.Boss[req.BossId]; ok { // 类型校验
if value < req.Difficulty-1 { if value < req.Difficulty-1 {
code = pb.ErrorCode_HuntingLvErr errdata = &pb.ErrorData{
Code: pb.ErrorCode_HuntingLvErr,
Title: pb.ErrorCode_HuntingLvErr.ToString(),
}
return return
} }
} else { } else {
code = pb.ErrorCode_HuntingLvErr errdata = &pb.ErrorData{
Code: pb.ErrorCode_HuntingLvErr,
Title: pb.ErrorCode_HuntingLvErr.ToString(),
}
return return
} }
code, record := this.module.battle.CreatePveBattle(session, &pb.BattlePVEReq{ errdata, record := this.module.battle.CreatePveBattle(session, &pb.BattlePVEReq{
Ptype: pb.PlayType_viking, Ptype: pb.PlayType_viking,
Title: "", Title: "",
Format: req.Battle, Format: req.Battle,

View File

@ -34,14 +34,16 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.VikingChal
changExp = make(map[string]int32, 0) changExp = make(map[string]int32, 0)
mapData = make(map[string]interface{}, 0) mapData = make(map[string]interface{}, 0)
reward = make([]*cfg.Gameatn, 0) reward = make([]*cfg.Gameatn, 0)
code = this.ChallengeOverCheck(session, req) if errdata = this.ChallengeOverCheck(session, req); errdata != nil {
if errdata != nil {
return // 参数校验失败直接返回 return // 参数校验失败直接返回
} }
viking, err := this.module.modelViking.getVikingList(session.GetUserId()) viking, err := this.module.modelViking.getVikingList(session.GetUserId())
if err != nil { if err != nil {
code = pb.ErrorCode_VikingBoosType errdata = &pb.ErrorData{
Code: pb.ErrorCode_VikingBoosType,
Title: pb.ErrorCode_VikingBoosType.ToString(),
}
return return
} }
@ -52,11 +54,6 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.VikingChal
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
} }
@ -66,11 +63,17 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.VikingChal
if value, ok := viking.Boss[req.BossId]; ok { // 类型校验 if value, ok := viking.Boss[req.BossId]; ok { // 类型校验
if value < req.Difficulty-1 { if value < req.Difficulty-1 {
code = pb.ErrorCode_HuntingLvErr errdata = &pb.ErrorData{
Code: pb.ErrorCode_HuntingLvErr,
Title: pb.ErrorCode_HuntingLvErr.ToString(),
}
return return
} }
} else { } else {
code = pb.ErrorCode_HuntingLvErr errdata = &pb.ErrorData{
Code: pb.ErrorCode_HuntingLvErr,
Title: pb.ErrorCode_HuntingLvErr.ToString(),
}
return return
} }
if viking.Boss[req.BossId] < req.Difficulty { if viking.Boss[req.BossId] < req.Difficulty {
@ -83,7 +86,7 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.VikingChal
} }
mapData["boss"] = viking.Boss mapData["boss"] = viking.Boss
code, bWin = this.module.battle.CheckBattleReport(session, req.Report) errdata, bWin = this.module.battle.CheckBattleReport(session, req.Report)
// if errdata = this.module.ModuleItems.RecoverTicket(session); errdata != nil { // if errdata = this.module.ModuleItems.RecoverTicket(session); errdata != nil {
// return // return
// } // }
@ -95,7 +98,7 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.VikingChal
} }
viking.Ps[req.BossId] = 0 // 清空预扣体力值 viking.Ps[req.BossId] = 0 // 清空预扣体力值
mapData["ps"] = viking.Ps mapData["ps"] = viking.Ps
code = this.module.ModifyVikingData(session.GetUserId(), mapData) errdata = this.module.ModifyVikingData(session.GetUserId(), mapData)
session.SendMsg(string(this.module.GetType()), VikingChallengeOverResp, &pb.VikingChallengeOverResp{ session.SendMsg(string(this.module.GetType()), VikingChallengeOverResp, &pb.VikingChallengeOverResp{
Data: viking, Data: viking,
}) })
@ -151,11 +154,11 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.VikingChal
} }
} }
res = append(res, vikingCfg.Manexp) //给玩家加经验 res = append(res, vikingCfg.Manexp) //给玩家加经验
if code, atno = this.module.DispenseAtno(session, res, true); errdata != nil { if errdata, atno = this.module.DispenseAtno(session, res, true); errdata != nil {
return return
} }
code = this.module.ModifyVikingData(session.GetUserId(), mapData) errdata = this.module.ModifyVikingData(session.GetUserId(), mapData)
// 加经验 // 加经验
if req.Report != nil && req.Report.Info != nil && len(req.Report.Info.Redflist) > 0 { if req.Report != nil && req.Report.Info != nil && len(req.Report.Info.Redflist) > 0 {

View File

@ -12,21 +12,12 @@ func (this *apiComp) GetListCheck(session comm.IUserSession, req *pb.VikingGetLi
} }
func (this *apiComp) GetList(session comm.IUserSession, req *pb.VikingGetListReq) (errdata *pb.ErrorData) { func (this *apiComp) GetList(session comm.IUserSession, req *pb.VikingGetListReq) (errdata *pb.ErrorData) {
code = this.GetListCheck(session, req) if errdata = this.GetListCheck(session, req); errdata != nil {
if errdata != nil {
return // 参数校验失败直接返回 return // 参数校验失败直接返回
} }
// 刷新挑战卷
// if errdata = this.module.ModuleItems.RecoverTicket(session); errdata != nil {
// return
// }
list, _ := this.module.modelViking.getVikingList(session.GetUserId()) list, _ := this.module.modelViking.getVikingList(session.GetUserId())
// if session.GetUserId() != "" { // 恢复时间
// if userexpand, err := this.module.ModuleUser.GetUserExpand(session.GetUserId()); err == nil {
// list.RecoveryTime = userexpand.Recovertimeunifiedticket
// }
// }
session.SendMsg(string(this.module.GetType()), VikingGetListResp, &pb.VikingGetListResp{Data: list}) session.SendMsg(string(this.module.GetType()), VikingGetListResp, &pb.VikingGetListResp{Data: list})
return return
} }

View File

@ -27,8 +27,7 @@ func (this *apiComp) RankList(session comm.IUserSession, req *pb.VikingRankListR
szRank []*pb.DBVikingRank szRank []*pb.DBVikingRank
rd *redis.StringSliceCmd rd *redis.StringSliceCmd
) )
code = this.RankListCheck(session, req) if errdata = this.RankListCheck(session, req); errdata != nil {
if errdata != nil {
return // 参数校验失败直接返回 return // 参数校验失败直接返回
} }
conn, _ := db.Local() conn, _ := db.Local()

View File

@ -58,7 +58,7 @@ func (this *modelViking) checkReddot31(session comm.IUserSession) bool {
if list, err := this.module.modelViking.getVikingList(session.GetUserId()); err == nil { if list, err := this.module.modelViking.getVikingList(session.GetUserId()); err == nil {
if _, ok := list.Boss[1]; ok { if _, ok := list.Boss[1]; ok {
if conf, _ := this.module.configure.GetVikingBossConfigData(1, 1); conf != nil { if conf, _ := this.module.configure.GetVikingBossConfigData(1, 1); conf != nil {
if code := this.module.CheckRes(session, conf.PsConsume); code == pb.ErrorCode_Success { if errdata := this.module.CheckRes(session, conf.PsConsume); errdata == nil {
return true return true
} }
} }

View File

@ -208,7 +208,7 @@ func (this *Viking) CompleteAllLevel(session comm.IUserSession) (errdata *pb.Err
} }
} }
mapData["boss"] = list.Boss mapData["boss"] = list.Boss
code = this.ModifyVikingData(session.GetUserId(), mapData) errdata = this.ModifyVikingData(session.GetUserId(), mapData)
session.SendMsg(string(this.GetType()), VikingGetListResp, &pb.VikingGetListResp{Data: list}) session.SendMsg(string(this.GetType()), VikingGetListResp, &pb.VikingGetListResp{Data: list})
return return
@ -216,10 +216,10 @@ func (this *Viking) CompleteAllLevel(session comm.IUserSession) (errdata *pb.Err
func (this *Viking) AutoBuyTicket(session comm.IUserSession, bossId, difficulty int32) (errdata *pb.ErrorData) { func (this *Viking) AutoBuyTicket(session comm.IUserSession, bossId, difficulty int32) (errdata *pb.ErrorData) {
conf, _ := this.configure.GetVikingBossConfigData(bossId, difficulty) conf, _ := this.configure.GetVikingBossConfigData(bossId, difficulty)
if code := this.CheckRes(session, conf.PsConsume); errdata != nil { if errdata := this.CheckRes(session, conf.PsConsume); errdata != nil {
amount := int32(this.ModuleItems.QueryItemAmount(session.GetUserId(), conf.PsConsume[0].T)) // 获取当前数量 amount := int32(this.ModuleItems.QueryItemAmount(session.GetUserId(), conf.PsConsume[0].T)) // 获取当前数量
if amount < conf.PsConsume[0].N { // 数量不足直接购买 if amount < conf.PsConsume[0].N { // 数量不足直接购买
code, _ = this.api.Buy(session, &pb.VikingBuyReq{ errdata = this.api.Buy(session, &pb.VikingBuyReq{
Count: conf.PsConsume[0].N - amount, Count: conf.PsConsume[0].N - amount,
}) })
} }
@ -235,17 +235,16 @@ func (this *Viking) AutoBattleInfo(session comm.IUserSession, battle *pb.BattleF
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(),
} }
return return
} }
code, record := this.battle.CreatePveBattle(session, &pb.BattlePVEReq{ errdata, record := this.battle.CreatePveBattle(session, &pb.BattlePVEReq{
Ptype: pb.PlayType_viking, Ptype: pb.PlayType_viking,
Title: "", Title: "",
Format: battle, Format: battle,
Mformat: cfgData.Boss, Mformat: cfgData.Boss,
}) })
if code == pb.ErrorCode_Success { if errdata == nil {
battleInfo = &pb.BattleInfo{ battleInfo = &pb.BattleInfo{
Id: record.Id, Id: record.Id,
Title: record.Title, Title: record.Title,
@ -268,32 +267,32 @@ func (this *Viking) AutoBattleOver(session comm.IUserSession, Report *pb.BattleR
atno = make([]*pb.UserAtno, 0) atno = make([]*pb.UserAtno, 0)
conf, _ := this.configure.GetVikingBossConfigData(bossId, difficulty) conf, _ := this.configure.GetVikingBossConfigData(bossId, difficulty)
tasks := make([]*pb.BuriedParam, 0) tasks := make([]*pb.BuriedParam, 0)
// costRes := this.ModuleTools.GetGlobalConf().VikingExpeditionCos
// if costRes == nil {
// errdata = &pb.ErrorData{
Code: pb.ErrorCode_ConfigNoFound,
Title: pb.ErrorCode_ConfigNoFound.ToString(),
Message: err.Error(),
}
// return
// }
if errdata = this.ConsumeRes(session, conf.PsConsume, true); errdata != nil { if errdata = this.ConsumeRes(session, conf.PsConsume, true); errdata != nil {
return return
} }
viking, err := this.modelViking.getVikingList(session.GetUserId()) viking, err := this.modelViking.getVikingList(session.GetUserId())
if err != nil { if err != nil {
code = pb.ErrorCode_VikingBoosType errdata = &pb.ErrorData{
Code: pb.ErrorCode_VikingBoosType,
Title: pb.ErrorCode_VikingBoosType.ToString(),
Message: err.Error(),
}
return return
} }
code, bWin := this.battle.CheckBattleReport(session, Report) errdata, bWin := this.battle.CheckBattleReport(session, Report)
if !bWin { // 战斗失败了 直接返回 if !bWin { // 战斗失败了 直接返回
code = pb.ErrorCode_BattleNoWin errdata = &pb.ErrorData{
Code: pb.ErrorCode_BattleNoWin,
Title: pb.ErrorCode_BattleNoWin.ToString(),
Message: err.Error(),
}
return return
} }
if autoBattle != nil { if autoBattle != nil {
if autoBattle.AutoBuy { if autoBattle.AutoBuy {
code = this.AutoBuyTicket(session, bossId, difficulty) errdata = this.AutoBuyTicket(session, bossId, difficulty)
} }
} }
mapData := make(map[string]interface{}, 0) mapData := make(map[string]interface{}, 0)
@ -310,26 +309,26 @@ func (this *Viking) AutoBattleOver(session comm.IUserSession, Report *pb.BattleR
if viking.BossTime[key] == 0 { // 新关卡挑战通过 发放首通奖励 if viking.BossTime[key] == 0 { // 新关卡挑战通过 发放首通奖励
viking.Boss[bossId]++ viking.Boss[bossId]++
mapData["boss"] = viking.Boss mapData["boss"] = viking.Boss
if c, res1 := this.DispenseAtno(session, vikingCfg.Firstprize, true); c == pb.ErrorCode_Success { if c, res1 := this.DispenseAtno(session, vikingCfg.Firstprize, true); c == nil {
atno = append(atno, res1...) atno = append(atno, res1...)
} else { } else {
code = c errdata = c
return return
} }
} }
userinfo := this.ModuleUser.GetUser(session.GetUserId()) userinfo := this.ModuleUser.GetUser(session.GetUserId())
this.CheckRank(session.GetUserId(), bossId, difficulty, Report, userinfo) this.CheckRank(session.GetUserId(), bossId, difficulty, Report, userinfo)
reward := this.configure.GetDropReward(vikingCfg.Drop) // 获取掉落奖励 reward := this.configure.GetDropReward(vikingCfg.Drop) // 获取掉落奖励
if c, res1 := this.DispenseAtno(session, reward, true); c == pb.ErrorCode_Success { if c, res1 := this.DispenseAtno(session, reward, true); c == nil {
atno = append(atno, res1...) atno = append(atno, res1...)
} else { } else {
code = c errdata = c
return return
} }
mapData["bossTime"] = viking.BossTime // 更新时间 mapData["bossTime"] = viking.BossTime // 更新时间
code = this.ModifyVikingData(session.GetUserId(), mapData) errdata = this.ModifyVikingData(session.GetUserId(), mapData)
if user := this.ModuleUser.GetUser(session.GetUserId()); user != nil { if user := this.ModuleUser.GetUser(session.GetUserId()); user != nil {
if module, err := this.service.GetModule(comm.ModuleChat); err == nil { if module, err := this.service.GetModule(comm.ModuleChat); err == nil {
@ -356,7 +355,7 @@ func (this *Viking) AutoBattleOver(session comm.IUserSession, Report *pb.BattleR
} }
func (this *Viking) CheckBattelParameter(session comm.IUserSession, battle *pb.BattleFormation, bossid, difficulty int32) (errdata *pb.ErrorData) { func (this *Viking) CheckBattelParameter(session comm.IUserSession, battle *pb.BattleFormation, bossid, difficulty int32) (errdata *pb.ErrorData) {
code, _ = this.api.Challenge(session, &pb.VikingChallengeReq{ errdata = this.api.Challenge(session, &pb.VikingChallengeReq{
BossId: bossid, BossId: bossid,
Difficulty: difficulty, Difficulty: difficulty,
Battle: battle, Battle: battle,