Merge branch 'dev' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
ee8c3927cf
@ -1,6 +1,7 @@
|
||||
package hunting
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/pb"
|
||||
cfg "go_dreamfactory/sys/configure/structs"
|
||||
@ -23,14 +24,17 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.HuntingChallen
|
||||
var (
|
||||
ps int32
|
||||
)
|
||||
code = this.ChallengeCheck(session, req)
|
||||
if errdata != nil {
|
||||
if errdata = this.ChallengeCheck(session, req); errdata != nil {
|
||||
return // 参数校验失败直接返回
|
||||
}
|
||||
|
||||
hunting, err := this.module.modelHunting.getHuntingList(session.GetUserId())
|
||||
if err != nil {
|
||||
code = pb.ErrorCode_PagodaNotFound
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_PagodaNotFound,
|
||||
Title: pb.ErrorCode_PagodaNotFound.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
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(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
data = &pb.ErrorData{
|
||||
Title: pb.GetErrorCodeMsg(code),
|
||||
Message: err.Error(),
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
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
|
||||
}
|
||||
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
|
||||
}
|
||||
|
||||
code, record := this.module.battle.CreatePveBattle(session, &pb.BattlePVEReq{
|
||||
errdata, record := this.module.battle.CreatePveBattle(session, &pb.BattlePVEReq{
|
||||
Ptype: pb.PlayType_hunting,
|
||||
Title: "",
|
||||
Format: req.Battle,
|
||||
|
@ -1,6 +1,7 @@
|
||||
package hunting
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/pb"
|
||||
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)
|
||||
reward = make([]*cfg.Gameatn, 0)
|
||||
code = this.ChallengeOverCheck(session, req)
|
||||
if errdata != nil {
|
||||
if errdata = this.ChallengeOverCheck(session, req); errdata != nil {
|
||||
return // 参数校验失败直接返回
|
||||
}
|
||||
|
||||
hunting, err := this.module.modelHunting.getHuntingList(session.GetUserId())
|
||||
if err != nil {
|
||||
code = pb.ErrorCode_PagodaNotFound
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_PagodaNotFound,
|
||||
Title: pb.ErrorCode_PagodaNotFound.ToString(),
|
||||
}
|
||||
return
|
||||
}
|
||||
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(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
data = &pb.ErrorData{
|
||||
Title: pb.GetErrorCodeMsg(code),
|
||||
Message: err.Error(),
|
||||
}
|
||||
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 < req.Difficulty-1 {
|
||||
code = pb.ErrorCode_HuntingLvErr
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_HuntingLvErr,
|
||||
Title: pb.ErrorCode_HuntingLvErr.ToString(),
|
||||
}
|
||||
return
|
||||
}
|
||||
} else {
|
||||
code = pb.ErrorCode_HuntingLvErr
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_HuntingLvErr,
|
||||
Title: pb.ErrorCode_HuntingLvErr.ToString(),
|
||||
Message: fmt.Sprintf("关卡参数异常:%d", req.BossType),
|
||||
}
|
||||
return
|
||||
}
|
||||
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
|
||||
}
|
||||
mapData["boss"] = hunting.Boss
|
||||
code, bWin = this.module.battle.CheckBattleReport(session, req.Report)
|
||||
// if errdata = this.module.ModuleItems.RecoverTicket(session); errdata != nil {
|
||||
// return
|
||||
// }
|
||||
if !bWin { // 战斗失败了 直接返回
|
||||
if v, ok := hunting.Ps[req.BossType]; ok && v > 0 {
|
||||
if errdata = this.module.DispenseRes(session, cfgHunting.PsConsume, true); errdata != nil { // 返还预扣体力
|
||||
return
|
||||
}
|
||||
errdata, bWin = this.module.battle.CheckBattleReport(session, req.Report)
|
||||
if v, ok := hunting.Ps[req.BossType]; !ok || v == 0 {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_HuntingLvErr,
|
||||
Title: pb.ErrorCode_HuntingLvErr.ToString(),
|
||||
Message: fmt.Sprintf("关卡体力参数异常:%d,预扣体力:%d", session.GetUserId(), v),
|
||||
}
|
||||
hunting.Ps[req.BossType] = 0 // 清空预扣体力值
|
||||
mapData["ps"] = hunting.Ps
|
||||
code = this.module.ModifyHuntingData(session.GetUserId(), mapData)
|
||||
return
|
||||
}
|
||||
hunting.Ps[req.BossType] = 0 // 清空预扣体力值
|
||||
mapData["ps"] = hunting.Ps
|
||||
|
||||
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})
|
||||
return
|
||||
}
|
||||
// if errdata = this.module.ConsumeRes(session, cfgHunting.PsConsume, true); errdata != nil {
|
||||
// return
|
||||
// }
|
||||
|
||||
key := strconv.Itoa(int(req.BossType)) + "_" + strconv.Itoa(int(req.Difficulty))
|
||||
if hunting.BossTime[key] == 0 { // 新关卡挑战通过 发放首通奖励
|
||||
mapData["boss"] = hunting.Boss
|
||||
@ -136,7 +144,7 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.HuntingCha
|
||||
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
|
||||
}
|
||||
if newChallenge && bWin { // 新关卡挑战通过 发放首通奖励
|
||||
@ -148,12 +156,8 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.HuntingCha
|
||||
}
|
||||
|
||||
mapData["bossTime"] = hunting.BossTime
|
||||
code = this.module.ModifyHuntingData(session.GetUserId(), mapData)
|
||||
// if session.GetUserId() != "" { // 恢复时间
|
||||
// if userexpand, err := this.module.ModuleUser.GetUserExpand(session.GetUserId()); err == nil {
|
||||
// hunting.RecoveryTime = userexpand.Recovertimeunifiedticket
|
||||
// }
|
||||
// }
|
||||
errdata = this.module.ModifyHuntingData(session.GetUserId(), mapData)
|
||||
|
||||
session.SendMsg(string(this.module.GetType()), HuntingChallengeOverResp, &pb.HuntingChallengeOverResp{
|
||||
Data: hunting,
|
||||
Asset: atno,
|
||||
|
@ -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) {
|
||||
|
||||
code = this.GetListCheck(session, req)
|
||||
if errdata != nil {
|
||||
if errdata = this.GetListCheck(session, req); errdata != nil {
|
||||
return // 参数校验失败直接返回
|
||||
}
|
||||
// 刷新挑战卷
|
||||
// if errdata = this.module.ModuleItems.RecoverTicket(session); errdata != nil {
|
||||
// return
|
||||
// }
|
||||
|
||||
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})
|
||||
return
|
||||
}
|
||||
|
@ -22,8 +22,7 @@ func (this *apiComp) RankList(session comm.IUserSession, req *pb.HuntingRankList
|
||||
szRank []*pb.DBHuntingRank
|
||||
rd *redis.StringSliceCmd
|
||||
)
|
||||
code = this.RankListCheck(session, req)
|
||||
if errdata != nil {
|
||||
if errdata = this.RankListCheck(session, req); errdata != nil {
|
||||
return // 参数校验失败直接返回
|
||||
}
|
||||
conn, _ := db.Local()
|
||||
|
@ -60,7 +60,7 @@ func (this *modelHunting) checkReddot32(session comm.IUserSession) bool {
|
||||
if list, err := this.module.modelHunting.getHuntingList(session.GetUserId()); err == nil {
|
||||
if _, ok := list.Boss[1]; ok {
|
||||
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
|
||||
}
|
||||
}
|
||||
|
@ -202,7 +202,7 @@ func (this *Hunting) CompleteAllLevel(session comm.IUserSession) (errdata *pb.Er
|
||||
}
|
||||
}
|
||||
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})
|
||||
return
|
||||
|
@ -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) {
|
||||
|
||||
code = this.ActivationFetterCheck(session, req)
|
||||
if errdata != nil {
|
||||
if errdata = this.ActivationFetterCheck(session, req); errdata != nil {
|
||||
return // 参数校验失败直接返回
|
||||
}
|
||||
rsp := &pb.LibraryActivationFetterResp{}
|
||||
fetter := this.module.modelLibrary.getOneLibrary(session.GetUserId(), req.Oid)
|
||||
if fetter == nil {
|
||||
code = pb.ErrorCode_LibraryNoData
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_LibraryNoData,
|
||||
Title: pb.ErrorCode_LibraryNoData.ToString(),
|
||||
}
|
||||
return
|
||||
}
|
||||
if fetter.Fidlv != 0 {
|
||||
code = pb.ErrorCode_LibraryActivation
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_LibraryActivation,
|
||||
Title: pb.ErrorCode_LibraryActivation.ToString(),
|
||||
}
|
||||
return
|
||||
}
|
||||
fetter.Fidlv = 1
|
||||
|
@ -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) {
|
||||
|
||||
code = this.GetListCheck(session, req)
|
||||
if errdata != nil {
|
||||
if errdata = this.GetListCheck(session, req); errdata != nil {
|
||||
return // 参数校验失败直接返回
|
||||
}
|
||||
rsp := &pb.LibraryGetListResp{}
|
||||
|
@ -5,6 +5,7 @@ package library
|
||||
*/
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/pb"
|
||||
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)
|
||||
resp := &pb.LibraryGetStoryRewardResp{}
|
||||
code = this.GetStoryRewardCheck(session, req)
|
||||
if errdata != nil {
|
||||
if errdata = this.GetStoryRewardCheck(session, req); errdata != nil {
|
||||
return // 参数校验失败直接返回
|
||||
}
|
||||
_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(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
data = &pb.ErrorData{
|
||||
Title: pb.GetErrorCodeMsg(code),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
// 领取传记往事id
|
||||
for _, v := range _heroFetter.History {
|
||||
if v == req.History { // 已经领取过奖励
|
||||
code = pb.ErrorCode_LibraryReward
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_LibraryReward,
|
||||
Title: pb.ErrorCode_LibraryReward.ToString(),
|
||||
}
|
||||
return
|
||||
}
|
||||
}
|
||||
@ -63,7 +62,10 @@ func (this *apiComp) GetStoryReward(session comm.IUserSession, req *pb.LibraryGe
|
||||
_len := len(_heroFetter.History)
|
||||
if len(favorConf.Favorlv) < _len {
|
||||
if favorConf.Favorlv[_len] > _heroFetter.Favorlv { // 等级不够
|
||||
code = pb.ErrorCode_LibraryLvReward
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_LibraryLvReward,
|
||||
Title: pb.ErrorCode_LibraryLvReward.ToString(),
|
||||
}
|
||||
return
|
||||
}
|
||||
}
|
||||
@ -85,7 +87,12 @@ func (this *apiComp) GetStoryReward(session comm.IUserSession, req *pb.LibraryGe
|
||||
}
|
||||
} else {
|
||||
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
|
||||
}
|
||||
break
|
||||
|
@ -5,6 +5,7 @@ package library
|
||||
*/
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"go_dreamfactory/comm"
|
||||
"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) {
|
||||
|
||||
resp := &pb.LibraryLvRewardResp{}
|
||||
code = this.LvRewardCheck(session, req)
|
||||
if errdata != nil {
|
||||
if errdata = this.LvRewardCheck(session, req); errdata != nil {
|
||||
return // 参数校验失败直接返回
|
||||
}
|
||||
_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 {
|
||||
code = pb.ErrorCode_LibraryReward // 重复领奖
|
||||
errdata = &pb.ErrorData{ // 重复领奖
|
||||
Code: pb.ErrorCode_LibraryReward,
|
||||
Title: pb.ErrorCode_LibraryReward.ToString(),
|
||||
Message: fmt.Sprintf("重复领奖,领奖等级:%d", req.Lv),
|
||||
}
|
||||
return
|
||||
}
|
||||
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,
|
||||
Title: pb.ErrorCode_ReqParameterError.ToString(),
|
||||
}
|
||||
data = &pb.ErrorData{
|
||||
Title: pb.GetErrorCodeMsg(code),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
_heroFetter.Lvprize[req.Lv] = 1
|
||||
// 发奖
|
||||
code = this.module.DispenseRes(session, confData.ReturnReward, true)
|
||||
if errdata != nil {
|
||||
if errdata = this.module.DispenseRes(session, confData.ReturnReward, true); errdata != nil {
|
||||
this.module.Errorf("GetStoryReward err:add item : %v", confData.ReturnReward)
|
||||
return
|
||||
}
|
||||
mapData := make(map[string]interface{}, 0)
|
||||
mapData["lvprize"] = _heroFetter.Lvprize
|
||||
|
@ -23,8 +23,7 @@ func (this *apiComp) FetterLvUp(session comm.IUserSession, req *pb.LibraryFetter
|
||||
var (
|
||||
totalFetterLv int32 //羁绊总等级
|
||||
)
|
||||
code = this.FetterLvUpCheck(session, req)
|
||||
if errdata != nil {
|
||||
if errdata = this.FetterLvUpCheck(session, req); errdata != nil {
|
||||
return // 参数校验失败直接返回
|
||||
}
|
||||
// 配置校验
|
||||
@ -32,7 +31,10 @@ func (this *apiComp) FetterLvUp(session comm.IUserSession, req *pb.LibraryFetter
|
||||
rsp := &pb.LibraryFetterLvUpResp{}
|
||||
fetter := this.module.getLibraryByObjID(session.GetUserId(), req.LibOid)
|
||||
if fetter == nil {
|
||||
code = pb.ErrorCode_LibraryNoData
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_LibraryNoData,
|
||||
Title: pb.ErrorCode_LibraryNoData.ToString(),
|
||||
}
|
||||
return
|
||||
}
|
||||
for _, oid := range fetter.Herofetter {
|
||||
@ -46,22 +48,24 @@ func (this *apiComp) FetterLvUp(session comm.IUserSession, req *pb.LibraryFetter
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_ConfigNoFound,
|
||||
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
data = &pb.ErrorData{
|
||||
Title: pb.GetErrorCodeMsg(code),
|
||||
Message: e.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
if conf[0].FavorabilityLv > totalFetterLv {
|
||||
code = pb.ErrorCode_LibraryLvReward
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_LibraryLvReward,
|
||||
Title: pb.ErrorCode_LibraryLvReward.ToString(),
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
if _, ok := fetter.Prize[fetter.Fidlv]; ok {
|
||||
code = pb.ErrorCode_LibraryReward
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_LibraryReward,
|
||||
Title: pb.ErrorCode_LibraryReward.ToString(),
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -30,11 +30,6 @@ func (this *apiComp) FetterstoryTask(session comm.IUserSession, req *pb.LibraryF
|
||||
rsp := &pb.LibraryFetterstoryTaskResp{
|
||||
List: list,
|
||||
}
|
||||
|
||||
if err := session.SendMsg(string(this.module.GetType()), LibraryFetterstoryTaskResp, rsp); err != nil {
|
||||
code = pb.ErrorCode_SystemError
|
||||
return
|
||||
}
|
||||
|
||||
session.SendMsg(string(this.module.GetType()), LibraryFetterstoryTaskResp, rsp)
|
||||
return
|
||||
}
|
||||
|
@ -31,14 +31,16 @@ func (this *apiComp) UseGift(session comm.IUserSession, req *pb.LibraryUseGiftRe
|
||||
sCount int32 // 赠送开始次数
|
||||
)
|
||||
attenuation = make(map[int32]int32, 0)
|
||||
code = this.UseGiftCheck(session, req)
|
||||
if errdata != nil {
|
||||
if errdata = this.UseGiftCheck(session, req); errdata != nil {
|
||||
return // 参数校验失败直接返回
|
||||
}
|
||||
rsp := &pb.LibraryUseGiftResp{}
|
||||
_heroObj := this.module.modelFetter.getOneHeroFetter(session.GetUserId(), req.Heroid)
|
||||
if _heroObj == nil {
|
||||
code = pb.ErrorCode_HeroNoExist // 没找到对应的英雄信息
|
||||
errdata = &pb.ErrorData{ // 没找到对应的英雄信息
|
||||
Code: pb.ErrorCode_HeroNoExist,
|
||||
Title: pb.ErrorCode_HeroNoExist.ToString(),
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
@ -49,16 +51,15 @@ func (this *apiComp) UseGift(session comm.IUserSession, req *pb.LibraryUseGiftRe
|
||||
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
data = &pb.ErrorData{
|
||||
Title: pb.GetErrorCodeMsg(code),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
maxLv = int32(len(_exp)) // 获取当前星级羁绊最大等级
|
||||
// 达到最大等级不让继续升级
|
||||
if _heroObj.Favorlv >= maxLv {
|
||||
code = pb.ErrorCode_LibraryMaxLv
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_LibraryMaxLv,
|
||||
Title: pb.ErrorCode_LibraryMaxLv.ToString(),
|
||||
}
|
||||
return
|
||||
}
|
||||
sCount = _heroObj.Givecount
|
||||
@ -66,7 +67,10 @@ func (this *apiComp) UseGift(session comm.IUserSession, req *pb.LibraryUseGiftRe
|
||||
c := this.module.ModuleTools.GetGlobalConf().FavorabilityAttenuation
|
||||
maxCoun := c[len(c)-1].K + 1
|
||||
if sCount+req.Counts > maxCoun { // 当天赠送次数
|
||||
code = pb.ErrorCode_LibraryGiveMaxCount
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_LibraryGiveMaxCount,
|
||||
Title: pb.ErrorCode_LibraryGiveMaxCount.ToString(),
|
||||
}
|
||||
return
|
||||
}
|
||||
var last int32 = 1
|
||||
@ -88,10 +92,6 @@ func (this *apiComp) UseGift(session comm.IUserSession, req *pb.LibraryUseGiftRe
|
||||
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
data = &pb.ErrorData{
|
||||
Title: pb.GetErrorCodeMsg(code),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
for _, v := range _c.LikesFood { // 喜欢的食物
|
||||
@ -182,10 +182,6 @@ func (this *apiComp) UseGift(session comm.IUserSession, req *pb.LibraryUseGiftRe
|
||||
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
data = &pb.ErrorData{
|
||||
Title: pb.GetErrorCodeMsg(code),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package mail
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/pb"
|
||||
)
|
||||
@ -24,14 +25,17 @@ func (this *apiComp) DelAllMail(session comm.IUserSession, req *pb.MailDelAllMai
|
||||
err error
|
||||
mailData []*pb.DBMailData
|
||||
)
|
||||
code = this.DelAllMailCheck(session, req) // check
|
||||
if errdata != nil {
|
||||
if errdata = this.DelAllMailCheck(session, req); errdata != nil {
|
||||
return
|
||||
}
|
||||
mailinfo, err = this.module.modelMail.MailQueryUserMail(session.GetUserId())
|
||||
if err != nil {
|
||||
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
|
||||
}
|
||||
|
||||
@ -39,7 +43,11 @@ func (this *apiComp) DelAllMail(session comm.IUserSession, req *pb.MailDelAllMai
|
||||
if v.Check == false || (v.Reward && len(v.Items) > 0) {
|
||||
bRet := this.module.modelMail.MailDelUserMail(v.ObjId)
|
||||
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
|
||||
}
|
||||
continue
|
||||
|
@ -1,6 +1,7 @@
|
||||
package mail
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"go_dreamfactory/comm"
|
||||
"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) {
|
||||
code = this.DelMailCheck(session, req) // check
|
||||
if errdata != nil {
|
||||
if errdata = this.DelMailCheck(session, req); errdata != nil {
|
||||
return
|
||||
}
|
||||
bRet := this.module.modelMail.MailDelUserMail(req.ObjID)
|
||||
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
|
||||
}
|
||||
session.SendMsg(string(this.module.GetType()), "delmail", &pb.MailDelMailResp{ObjID: req.ObjID})
|
||||
|
@ -8,7 +8,10 @@ import (
|
||||
|
||||
func (this *apiComp) GetUserMailAttachmentCheck(session comm.IUserSession, req *pb.MailGetUserMailAttachmentReq) (errdata *pb.ErrorData) {
|
||||
if req.ObjID == "" {
|
||||
return pb.ErrorCode_ReqParameterError
|
||||
errdata = &pb.ErrorData{ // 邮件不存在
|
||||
Code: pb.ErrorCode_ReqParameterError,
|
||||
Title: pb.ErrorCode_ReqParameterError.ToString(),
|
||||
}
|
||||
}
|
||||
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) {
|
||||
|
||||
code = this.GetUserMailAttachmentCheck(session, req) // check
|
||||
if errdata != nil {
|
||||
if errdata = this.GetUserMailAttachmentCheck(session, req); errdata != nil {
|
||||
return
|
||||
}
|
||||
mail, err := this.module.modelMail.MailGetMailAttachmentState(req.ObjID)
|
||||
if err != nil {
|
||||
code = pb.ErrorCode_MailErr
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_MailErr,
|
||||
Title: pb.ErrorCode_MailErr.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
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
|
||||
}
|
||||
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)
|
||||
}
|
||||
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)
|
||||
mail.Reward = true
|
||||
@ -63,17 +72,23 @@ func (this *apiComp) GetAllMailAttachment(session comm.IUserSession, req *pb.Mai
|
||||
var (
|
||||
mailIds []string
|
||||
)
|
||||
code = this.GetAllMailAttachmentCheck(session, req) // check
|
||||
if errdata != nil {
|
||||
if errdata = this.GetAllMailAttachmentCheck(session, req); errdata != nil {
|
||||
return
|
||||
}
|
||||
mails, err := this.module.modelMail.MailQueryUserMailByReard(session.GetUserId())
|
||||
if err != nil {
|
||||
code = pb.ErrorCode_MailErr
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_MailErr,
|
||||
Title: pb.ErrorCode_MailErr.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
if len(mails) == 0 {
|
||||
code = pb.ErrorCode_MailErr
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_MailErr,
|
||||
Title: pb.ErrorCode_MailErr.ToString(),
|
||||
}
|
||||
return
|
||||
}
|
||||
fj := make([]*pb.UserAssets, 0)
|
||||
@ -89,7 +104,7 @@ func (this *apiComp) GetAllMailAttachment(session comm.IUserSession, req *pb.Mai
|
||||
fj = append(fj, v1)
|
||||
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)
|
||||
v.Reward = true
|
||||
v.Check = true
|
||||
|
@ -17,13 +17,16 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.MailGetListReq)
|
||||
defer func() {
|
||||
session.SendMsg(string(this.module.GetType()), "getlist", &pb.MailGetListResp{Mails: mailinfo})
|
||||
}()
|
||||
code = this.GetListCheck(session, req) // check
|
||||
if errdata != nil {
|
||||
if errdata = this.GetListCheck(session, req); errdata != nil {
|
||||
return
|
||||
}
|
||||
if mailinfo, err = this.module.modelMail.MailQueryUserMail(session.GetUserId()); err != nil {
|
||||
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
|
||||
}
|
||||
|
||||
|
@ -23,9 +23,8 @@ func (this *apiComp) ReadMail(session comm.IUserSession, req *pb.MailReadMailReq
|
||||
mail *pb.DBMailData
|
||||
)
|
||||
|
||||
code = this.ReadMailCheck(session, req) // check
|
||||
if errdata != nil {
|
||||
this.module.Debugf("read mail failed%d", code)
|
||||
if errdata = this.ReadMailCheck(session, req); errdata != nil {
|
||||
this.module.Debugf("read mail failed err : %v", errdata)
|
||||
return
|
||||
}
|
||||
mail, err = this.module.modelMail.MailReadOneMail(req.ObjID)
|
||||
|
@ -45,6 +45,9 @@ func (this *modelMail) MailQueryUserMail(uId string) (mail []*pb.DBMailData, err
|
||||
}
|
||||
}
|
||||
}
|
||||
if len(mail) == 0 { // 没有邮件的时候 err返回空
|
||||
err = nil
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
package mline
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/pb"
|
||||
cfg "go_dreamfactory/sys/configure/structs"
|
||||
@ -32,7 +33,11 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.MlineChallenge
|
||||
return // 参数校验失败直接返回
|
||||
}
|
||||
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
|
||||
}
|
||||
|
||||
@ -47,7 +52,12 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.MlineChallenge
|
||||
//preStage := this.module.configure.GetMainStageConf(stageConf.Previoustage) // 新章节数据校验
|
||||
preStageConf := this.module.configure.GetMainStageConf(stageConf.Previoustage)
|
||||
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
|
||||
}
|
||||
|
||||
@ -72,7 +82,10 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.MlineChallenge
|
||||
}
|
||||
}
|
||||
if curChapter == nil {
|
||||
code = pb.ErrorCode_MainlineNotFindChapter
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_MainlineNotFindChapter,
|
||||
Title: pb.ErrorCode_MainlineNotFindChapter.ToString(),
|
||||
}
|
||||
return
|
||||
}
|
||||
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,
|
||||
})
|
||||
}
|
||||
code, record := this.module.battle.CreatePveBattle(session, &pb.BattlePVEReq{
|
||||
errdata, record := this.module.battle.CreatePveBattle(session, &pb.BattlePVEReq{
|
||||
Ptype: pb.PlayType_mainline,
|
||||
Title: "",
|
||||
Format: req.Battle,
|
||||
|
@ -1,6 +1,7 @@
|
||||
package mline
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/pb"
|
||||
|
||||
@ -34,12 +35,14 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.MlineChall
|
||||
)
|
||||
rsp = &pb.MlineChallengeOverResp{}
|
||||
update = make(map[string]interface{})
|
||||
code = this.ChallengeOverCheck(session, req)
|
||||
if errdata != nil {
|
||||
if errdata = this.ChallengeOverCheck(session, req); errdata != nil {
|
||||
return // 参数校验失败直接返回
|
||||
}
|
||||
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
|
||||
}
|
||||
|
||||
@ -51,23 +54,33 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.MlineChall
|
||||
}
|
||||
}
|
||||
if curChapter == nil {
|
||||
code = pb.ErrorCode_MainlineNotFindChapter
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_MainlineNotFindChapter,
|
||||
Title: pb.ErrorCode_MainlineNotFindChapter.ToString(),
|
||||
}
|
||||
return
|
||||
}
|
||||
// 校验通过
|
||||
code, isWin = this.module.battle.CheckBattleReport(session, req.Report)
|
||||
errdata, isWin = this.module.battle.CheckBattleReport(session, req.Report)
|
||||
if errdata != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if !isWin { // 战斗失败返还扣除的体力
|
||||
if v, ok := curChapter.Ps[req.StageId]; ok && v > 0 {
|
||||
if errdata = this.module.DispenseRes(session, stageConf.PsConsume, true); errdata != nil { // 返还预扣体力
|
||||
return
|
||||
}
|
||||
if v, ok := curChapter.Ps[req.StageId]; !ok || v == 0 {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_HuntingLvErr,
|
||||
Title: pb.ErrorCode_HuntingLvErr.ToString(),
|
||||
Message: fmt.Sprintf("关卡体力参数异常:%d,预扣体力:%d", session.GetUserId(), v),
|
||||
}
|
||||
curChapter.Ps[req.StageId] = 0 // 清空预扣体力值
|
||||
update["ps"] = curChapter.Ps
|
||||
return
|
||||
}
|
||||
curChapter.Ps[req.StageId] = 0 // 清空预扣体力值
|
||||
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)
|
||||
//code = pb.ErrorCode_BattleNoWin
|
||||
rsp.Data = curChapter
|
||||
@ -78,9 +91,8 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.MlineChall
|
||||
if len(stageConf.Star) != len(stageConf.StarType) || len(stageConf.Star) != len(stageConf.StarValue) || len(stageConf.StarValue) != len(stageConf.StarType) {
|
||||
this.module.Errorf("配置错误, 参数数量不一致,StageId: %d", req.StageId)
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_ConfigNoFound,
|
||||
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
||||
Message: err.Error(),
|
||||
Code: pb.ErrorCode_ConfigNoFound,
|
||||
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
||||
}
|
||||
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
|
||||
update["stageId"] = curChapter.StageId
|
||||
|
||||
|
@ -29,7 +29,10 @@ func (this *apiComp) CleanStage(session comm.IUserSession, req *pb.MlineCleanSta
|
||||
return // 参数校验失败直接返回
|
||||
}
|
||||
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
|
||||
}
|
||||
|
||||
@ -41,11 +44,17 @@ func (this *apiComp) CleanStage(session comm.IUserSession, req *pb.MlineCleanSta
|
||||
}
|
||||
}
|
||||
if curChapter == nil { // 校验是不是新的数据
|
||||
code = pb.ErrorCode_MainlineNotFindChapter
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_MainlineNotFindChapter,
|
||||
Title: pb.ErrorCode_MainlineNotFindChapter.ToString(),
|
||||
}
|
||||
return
|
||||
}
|
||||
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
|
||||
}
|
||||
if errdata = this.module.DispenseRes(session, stageConf.Commonaward, true); errdata != nil {
|
||||
|
@ -32,9 +32,8 @@ func (this *apiComp) GetReward(session comm.IUserSession, req *pb.MlineGetReward
|
||||
mLineConf := this.module.configure.GetMainChapterConf(req.CId)
|
||||
if mLineConf == nil {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_ConfigNoFound,
|
||||
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
||||
Message: err.Error(),
|
||||
Code: pb.ErrorCode_ConfigNoFound,
|
||||
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
||||
}
|
||||
return
|
||||
}
|
||||
@ -46,11 +45,17 @@ func (this *apiComp) GetReward(session comm.IUserSession, req *pb.MlineGetReward
|
||||
}
|
||||
}
|
||||
if curChapter == nil {
|
||||
code = pb.ErrorCode_MainlineNotFindChapter
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_MainlineNotFindChapter,
|
||||
Title: pb.ErrorCode_MainlineNotFindChapter.ToString(),
|
||||
}
|
||||
return
|
||||
}
|
||||
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
|
||||
}
|
||||
|
||||
|
@ -63,10 +63,6 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.MlineGetListReq)
|
||||
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
data = &pb.ErrorData{
|
||||
Title: pb.GetErrorCodeMsg(code),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
}
|
||||
|
@ -23,20 +23,25 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.PagodaChalleng
|
||||
pagoda *pb.DBPagoda
|
||||
err error
|
||||
)
|
||||
code = this.ChallengeCheck(session, req)
|
||||
if errdata != nil {
|
||||
if errdata = this.ChallengeCheck(session, req); errdata != nil {
|
||||
return // 参数校验失败直接返回
|
||||
}
|
||||
|
||||
conf := this.module.configure.GetPagodaConfigData(req.Cid)
|
||||
if conf == nil {
|
||||
code = pb.ErrorCode_PagodaNotFound
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_PagodaNotFound,
|
||||
Title: pb.ErrorCode_PagodaNotFound.ToString(),
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
pagoda, err = this.module.modelPagoda.getPagodaList(session.GetUserId())
|
||||
if err != nil {
|
||||
code = pb.ErrorCode_PagodaNotFound
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_PagodaNotFound,
|
||||
Title: pb.ErrorCode_PagodaNotFound.ToString(),
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
@ -44,12 +49,18 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.PagodaChalleng
|
||||
if conf.LayerNum == 1 {
|
||||
pagoda.Data[conf.Tab] = 0
|
||||
} else {
|
||||
code = pb.ErrorCode_PagodaLevlErr // 挑战关卡数据不匹配
|
||||
errdata = &pb.ErrorData{ // 挑战关卡数据不匹配
|
||||
Code: pb.ErrorCode_PagodaLevlErr,
|
||||
Title: pb.ErrorCode_PagodaLevlErr.ToString(),
|
||||
}
|
||||
return
|
||||
}
|
||||
} else {
|
||||
if conf.LayerNum-1 != v {
|
||||
code = pb.ErrorCode_PagodaLevlErr // 挑战关卡数据不匹配
|
||||
errdata = &pb.ErrorData{ // 挑战关卡数据不匹配
|
||||
Code: pb.ErrorCode_PagodaLevlErr,
|
||||
Title: pb.ErrorCode_PagodaLevlErr.ToString(),
|
||||
}
|
||||
return
|
||||
}
|
||||
}
|
||||
@ -57,11 +68,14 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.PagodaChalleng
|
||||
// 校验条件
|
||||
if conf.Unlock != 0 {
|
||||
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
|
||||
}
|
||||
}
|
||||
code, record := this.module.battle.CreatePveBattle(session, &pb.BattlePVEReq{
|
||||
errdata, record := this.module.battle.CreatePveBattle(session, &pb.BattlePVEReq{
|
||||
Ptype: pb.PlayType_pagoda,
|
||||
Title: "",
|
||||
Format: req.Battle,
|
||||
|
@ -32,19 +32,24 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.PagodaChal
|
||||
err error
|
||||
)
|
||||
mapData = make(map[string]interface{}, 0)
|
||||
code = this.ChallengeOverCheck(session, req)
|
||||
if errdata != nil {
|
||||
if errdata = this.ChallengeOverCheck(session, req); errdata != nil {
|
||||
return // 参数校验失败直接返回
|
||||
}
|
||||
|
||||
conf := this.module.configure.GetPagodaConfigData(req.Cid)
|
||||
if conf == nil {
|
||||
code = pb.ErrorCode_PagodaNotFound
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_PagodaNotFound,
|
||||
Title: pb.ErrorCode_PagodaNotFound.ToString(),
|
||||
}
|
||||
return
|
||||
}
|
||||
pagoda, err = this.module.modelPagoda.getPagodaList(session.GetUserId())
|
||||
if err != nil {
|
||||
code = pb.ErrorCode_PagodaNotFound
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_PagodaNotFound,
|
||||
Title: pb.ErrorCode_PagodaNotFound.ToString(),
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
@ -52,29 +57,41 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.PagodaChal
|
||||
if conf.LayerNum == 1 {
|
||||
pagoda.Data[conf.Tab] = 0
|
||||
} else {
|
||||
code = pb.ErrorCode_PagodaLevlErr // 挑战关卡数据不匹配
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_PagodaLevlErr, // 挑战关卡数据不匹配
|
||||
Title: pb.ErrorCode_PagodaLevlErr.ToString(),
|
||||
}
|
||||
return
|
||||
}
|
||||
} else {
|
||||
if conf.LayerNum-1 != v {
|
||||
code = pb.ErrorCode_PagodaLevlErr // 挑战关卡数据不匹配
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_PagodaLevlErr, // 挑战关卡数据不匹配
|
||||
Title: pb.ErrorCode_PagodaLevlErr.ToString(),
|
||||
}
|
||||
return
|
||||
}
|
||||
}
|
||||
// 校验条件
|
||||
if conf.Unlock != 0 {
|
||||
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
|
||||
}
|
||||
}
|
||||
// 校验通过
|
||||
code, isWin = this.module.battle.CheckBattleReport(session, req.Report)
|
||||
errdata, isWin = this.module.battle.CheckBattleReport(session, req.Report)
|
||||
if errdata != nil {
|
||||
return
|
||||
}
|
||||
if !isWin { // 战斗失败直接返回
|
||||
code = pb.ErrorCode_BattleNoWin
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_BattleNoWin,
|
||||
Title: pb.ErrorCode_BattleNoWin.ToString(),
|
||||
}
|
||||
return
|
||||
}
|
||||
// 加经验
|
||||
@ -92,7 +109,7 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.PagodaChal
|
||||
mapData["type"] = pagoda.Type
|
||||
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})
|
||||
if user := this.module.ModuleUser.GetUser(session.GetUserId()); user != nil { // 发系统公告
|
||||
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 {
|
||||
return
|
||||
}
|
||||
|
@ -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) {
|
||||
|
||||
code = this.GetRewardCheck(session, req)
|
||||
if errdata != nil {
|
||||
if errdata = this.GetRewardCheck(session, req); errdata != nil {
|
||||
return // 参数校验失败直接返回
|
||||
}
|
||||
|
||||
@ -35,12 +34,18 @@ func (this *apiComp) GetReward(session comm.IUserSession, req *pb.PagodaGetRewar
|
||||
}
|
||||
// 校验是否能领取
|
||||
if _cfg.LayerNum > pagoda.PagodaId {
|
||||
code = pb.ErrorCode_PagodaConditionErr
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_PagodaConditionErr,
|
||||
Title: pb.ErrorCode_PagodaConditionErr.ToString(),
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
if _, ok := pagoda.Reward[req.Id]; ok { // 校验是否重复领取
|
||||
code = pb.ErrorCode_PagodaGetRewardErr
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_PagodaGetRewardErr,
|
||||
Title: pb.ErrorCode_PagodaGetRewardErr.ToString(),
|
||||
}
|
||||
return
|
||||
}
|
||||
if pagoda.Reward == nil {
|
||||
@ -53,7 +58,7 @@ func (this *apiComp) GetReward(session comm.IUserSession, req *pb.PagodaGetRewar
|
||||
pagoda.Reward[req.Id] = true
|
||||
mapData := make(map[string]interface{}, 0)
|
||||
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})
|
||||
}
|
||||
|
@ -21,8 +21,7 @@ func (this *apiComp) RankList(session comm.IUserSession, req *pb.PagodaRankListR
|
||||
szRank []*pb.DBPagodaRecord
|
||||
rd *redis.StringSliceCmd
|
||||
)
|
||||
code = this.RankListCheck(session, req)
|
||||
if errdata != nil {
|
||||
if errdata = this.RankListCheck(session, req); errdata != nil {
|
||||
return
|
||||
}
|
||||
if !req.Friend {
|
||||
|
@ -29,7 +29,10 @@ func (this *apiComp) WarOrder(session comm.IUserSession, req *pb.PagodaWarOrderR
|
||||
|
||||
list, _ = this.module.modelPagoda.getPagodaList(session.GetUserId())
|
||||
if list.Id == "" {
|
||||
code = pb.ErrorCode_PagodaConditionErr // 领取条件没达到
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_PagodaConditionErr, // 领取条件没达到
|
||||
Title: pb.ErrorCode_PagodaConditionErr.ToString(),
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
@ -46,7 +49,10 @@ func (this *apiComp) WarOrder(session comm.IUserSession, req *pb.PagodaWarOrderR
|
||||
}
|
||||
if vip && bReward {
|
||||
if list.PagodaId < list.VipPassCheckID { // 层数校验
|
||||
code = pb.ErrorCode_PagodaConditionErr // 领取条件没达到
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_PagodaConditionErr, // 领取条件没达到
|
||||
Title: pb.ErrorCode_PagodaConditionErr.ToString(),
|
||||
}
|
||||
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{
|
||||
Data: list,
|
||||
Itmes: res,
|
||||
|
@ -98,7 +98,7 @@ func (this *Pagoda) ModifyPagodaFloor(session comm.IUserSession, level int32) (e
|
||||
list.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})
|
||||
}
|
||||
|
||||
|
@ -26,25 +26,33 @@ func (this *apiComp) BuyGift(session comm.IUserSession, req *pb.PrivilegeBuyGift
|
||||
|
||||
userinfo := this.module.ModuleUser.GetUser(session.GetUserId())
|
||||
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
|
||||
}
|
||||
conf := this.module.configure.GetVipConfigureData(req.VipLv)
|
||||
if conf == nil {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_ConfigNoFound,
|
||||
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
||||
Message: err.Error(),
|
||||
Code: pb.ErrorCode_ConfigNoFound,
|
||||
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
||||
}
|
||||
return
|
||||
}
|
||||
vip, err := this.module.modelVip.getVipList(session.GetUserId())
|
||||
if err != nil {
|
||||
code = pb.ErrorCode_VipLvError // vip 等级不足
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_DBError,
|
||||
Title: pb.ErrorCode_DBError.ToString(),
|
||||
}
|
||||
return
|
||||
}
|
||||
if _, ok := vip.Reward[req.VipLv]; ok {
|
||||
code = pb.ErrorCode_VipBuyRepeat // 礼包重复购买
|
||||
errdata = &pb.ErrorData{ // 礼包重复购买
|
||||
Code: pb.ErrorCode_VipBuyRepeat,
|
||||
Title: pb.ErrorCode_VipBuyRepeat.ToString(),
|
||||
}
|
||||
return
|
||||
}
|
||||
// 消耗检测
|
||||
|
@ -22,6 +22,6 @@ func (this *apiComp) BuyYueka(session comm.IUserSession, req *pb.PrivilegeBuyYue
|
||||
if errdata = this.BuyYuekaCheck(session, req); errdata != nil {
|
||||
return
|
||||
}
|
||||
code, _ = this.module.Delivery(session, req.CID)
|
||||
errdata, _ = this.module.Delivery(session, req.CID)
|
||||
return
|
||||
}
|
||||
|
@ -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() > int64(conf.RenewDay)*24*3600 {
|
||||
|
||||
code = pb.ErrorCode_PayRenewTimeErr
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_PayRenewTimeErr,
|
||||
Title: pb.ErrorCode_PayRenewTimeErr.ToString(),
|
||||
}
|
||||
return
|
||||
}
|
||||
v.ETime += int64(conf.AssertDay) * 24 * 3600
|
||||
@ -199,7 +201,12 @@ func (this *Privilege) RenewPrivilegeCard(session comm.IUserSession, cId string)
|
||||
if v.CId == cId {
|
||||
conf, err := this.configure.GetPrivilegeCard(cId)
|
||||
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) {
|
||||
@ -213,13 +220,18 @@ func (this *Privilege) RenewPrivilegeCard(session comm.IUserSession, cId string)
|
||||
}
|
||||
session.SendMsg(string(this.GetType()), PrivilegeBuyYuekaResp, &pb.PrivilegeGetListResp{Data: list})
|
||||
} else {
|
||||
code = pb.ErrorCode_PrivilegeRenewTime
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_PrivilegeRenewTime,
|
||||
Title: pb.ErrorCode_PrivilegeRenewTime.ToString(),
|
||||
}
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
code = pb.ErrorCode_PrivilegeNotFound
|
||||
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_PrivilegeNotFound,
|
||||
Title: pb.ErrorCode_PrivilegeNotFound.ToString(),
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -22,8 +22,7 @@ func (this *apiComp) AtlasActivate(session comm.IUserSession, req *pb.SmithyAtla
|
||||
addScore int32 // 更新图鉴增加的积分
|
||||
szTask []*pb.BuriedParam
|
||||
)
|
||||
code = this.AtlasActivateCheck(session, req)
|
||||
if errdata != nil {
|
||||
if errdata = this.AtlasActivateCheck(session, req); errdata != nil {
|
||||
return // 参数校验失败直接返回
|
||||
}
|
||||
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)
|
||||
if err != nil {
|
||||
code = pb.ErrorCode_SmithyNoFoundAtlas
|
||||
data = &pb.ErrorData{
|
||||
Title: pb.GetErrorCodeMsg(code),
|
||||
Message: err.Error(),
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_SmithyNoFoundAtlas,
|
||||
Title: pb.ErrorCode_SmithyNoFoundAtlas.ToString(),
|
||||
}
|
||||
return
|
||||
}
|
||||
@ -58,7 +56,10 @@ func (this *apiComp) AtlasActivate(session comm.IUserSession, req *pb.SmithyAtla
|
||||
v.Data1 = v.Data2
|
||||
v.Data2 = nil
|
||||
} else {
|
||||
code = pb.ErrorCode_SmithyNoActivateAtlas
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_SmithyNoActivateAtlas,
|
||||
Title: pb.ErrorCode_SmithyNoActivateAtlas.ToString(),
|
||||
}
|
||||
return
|
||||
}
|
||||
}
|
||||
@ -68,7 +69,10 @@ func (this *apiComp) AtlasActivate(session comm.IUserSession, req *pb.SmithyAtla
|
||||
update["score"] = atlas.Score
|
||||
this.module.modelAtlas.modifySmithyAtlasList(session.GetUserId(), update)
|
||||
} else {
|
||||
code = pb.ErrorCode_SmithyNoFoundAtlas
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_SmithyNoFoundAtlas,
|
||||
Title: pb.ErrorCode_SmithyNoFoundAtlas.ToString(),
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
@ -84,7 +88,10 @@ func (this *apiComp) AtlasActivate(session comm.IUserSession, req *pb.SmithyAtla
|
||||
this.module.modelAtlas.modifySmithyAtlasList(session.GetUserId(), update)
|
||||
}
|
||||
} else {
|
||||
code = pb.ErrorCode_SmithyNoFoundAtlas
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_SmithyNoFoundAtlas,
|
||||
Title: pb.ErrorCode_SmithyNoFoundAtlas.ToString(),
|
||||
}
|
||||
return
|
||||
}
|
||||
}
|
||||
|
@ -18,8 +18,7 @@ func (this *apiComp) AtlasAward(session comm.IUserSession, req *pb.SmithyAtlasAw
|
||||
res []*cfg.Gameatn
|
||||
respRes []*pb.UserAssets
|
||||
)
|
||||
code = this.AtlasAwardCheck(session, req)
|
||||
if errdata != nil {
|
||||
if errdata = this.AtlasAwardCheck(session, req); errdata != nil {
|
||||
return // 参数校验失败直接返回
|
||||
}
|
||||
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...)
|
||||
}
|
||||
if len(res) == 0 { // 没有奖励可领取
|
||||
code = pb.ErrorCode_MartialhallAtlasNoReward
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_MartialhallAtlasNoReward,
|
||||
Title: pb.ErrorCode_MartialhallAtlasNoReward.ToString(),
|
||||
}
|
||||
return
|
||||
}
|
||||
this.module.DispenseRes(session, res, true)
|
||||
|
@ -64,7 +64,10 @@ func (this *apiComp) ForgeEquip(session comm.IUserSession, req *pb.SmithyForgeEq
|
||||
// 校验图纸是否激活
|
||||
if _, ok := stove.Data[req.ReelId]; !ok { // 是不是首次打造
|
||||
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
|
||||
}
|
||||
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 stove.Temperature < needT {
|
||||
code = pb.ErrorCode_SmithyNoTemperature // 炉温不够 直接返回
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_SmithyNoTemperature,
|
||||
Title: pb.ErrorCode_SmithyNoTemperature.ToString(),
|
||||
}
|
||||
return
|
||||
}
|
||||
stove.Temperature -= needT // 消耗温度
|
||||
@ -167,10 +173,7 @@ func (this *apiComp) ForgeEquip(session comm.IUserSession, req *pb.SmithyForgeEq
|
||||
Message: err.Error(),
|
||||
}
|
||||
this.module.Errorf("GetSmithyMake配置没找到:%d", k)
|
||||
data = &pb.ErrorData{
|
||||
Title: pb.GetErrorCodeMsg(code),
|
||||
Message: err.Error(),
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
hitLen += v
|
||||
@ -211,9 +214,9 @@ func (this *apiComp) ForgeEquip(session comm.IUserSession, req *pb.SmithyForgeEq
|
||||
sz := make([]int32, 4) // 最高 4个品质
|
||||
// 获得极品权重
|
||||
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 {
|
||||
code = code1
|
||||
this.module.Errorf("GetForgeEquip error: %v,req.SuiteId:%d, req.Position:%d, customLv:%d", code, req.SuiteId, req.Position, customLv)
|
||||
if equip, code1 := this.module.ModuleEquipment.GetForgeEquip(session, req.SuiteId, req.Position, customLv, sz); code1 != nil {
|
||||
errdata = code1
|
||||
this.module.Errorf("GetForgeEquip error: %v,req.SuiteId:%d, req.Position:%d, customLv:%d", errdata, req.SuiteId, req.Position, customLv)
|
||||
return
|
||||
} else {
|
||||
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++ {
|
||||
res := this.module.configure.GetDropReward(newdrop)
|
||||
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 {
|
||||
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)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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 {
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
@ -16,9 +16,8 @@ func (this *apiComp) Customer(session comm.IUserSession, req *pb.SmithyCustomerR
|
||||
customerCount := this.module.ModuleTools.GetGlobalConf().SmithyMaxNpc
|
||||
if customerCount <= 0 {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_ConfigNoFound,
|
||||
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
||||
Message: err.Error(),
|
||||
Code: pb.ErrorCode_ConfigNoFound,
|
||||
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
||||
}
|
||||
return
|
||||
}
|
||||
|
@ -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 {
|
||||
var errCustom = new(comm.CustomError)
|
||||
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 {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_DBError,
|
||||
@ -41,10 +46,6 @@ func (this *apiComp) TaskAward(session comm.IUserSession, req *pb.SmithyTaskAwar
|
||||
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
data = &pb.ErrorData{
|
||||
Title: pb.GetErrorCodeMsg(code),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
} else {
|
||||
if errdata = this.module.DispenseRes(session, conf.Reword, true); errdata != nil {
|
||||
|
@ -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) {
|
||||
code = this.StoveUpCheck(session, req)
|
||||
if errdata != nil {
|
||||
if errdata = this.StoveUpCheck(session, req); errdata != nil {
|
||||
return // 参数校验失败直接返回
|
||||
}
|
||||
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(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
data = &pb.ErrorData{
|
||||
Title: pb.GetErrorCodeMsg(code),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
_, err = this.module.configure.GetSmithyStoveConf(stove.Lv + 1)
|
||||
if err != nil {
|
||||
code = pb.ErrorCode_SmithyStoveMaxLv
|
||||
data = &pb.ErrorData{
|
||||
Title: pb.GetErrorCodeMsg(code),
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_SmithyStoveMaxLv,
|
||||
Title: pb.ErrorCode_SmithyStoveMaxLv.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
|
@ -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) {
|
||||
code = this.ToolsUpCheck(session, req)
|
||||
if errdata != nil {
|
||||
if errdata = this.ToolsUpCheck(session, req); errdata != nil {
|
||||
return // 参数校验失败直接返回
|
||||
}
|
||||
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,
|
||||
Title: pb.ErrorCode_ReqParameterError.ToString(),
|
||||
}
|
||||
data = &pb.ErrorData{
|
||||
Title: pb.GetErrorCodeMsg(code),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
// 校验前置条件
|
||||
@ -56,14 +51,13 @@ func (this *apiComp) ToolsUp(session comm.IUserSession, req *pb.SmithyToolsUpReq
|
||||
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
data = &pb.ErrorData{
|
||||
Title: pb.GetErrorCodeMsg(code),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
if _, ok := stove.Skill[poreConf.SkillType]; !ok {
|
||||
code = pb.ErrorCode_SmithyLvToolsPre // 前置条件不满足
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_SmithyLvToolsPre, // 前置条件不满足
|
||||
Title: pb.ErrorCode_SmithyLvToolsPre.ToString(),
|
||||
}
|
||||
return
|
||||
}
|
||||
}
|
||||
|
@ -23,23 +23,12 @@ func (this *apiComp) Sell(session comm.IUserSession, req *pb.SmithySellReq) (err
|
||||
}
|
||||
|
||||
//校验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()))
|
||||
|
||||
cus, err := this.module.modelTrade.updateCustomer(session.GetUserId(), req.CustomerId)
|
||||
if err != nil {
|
||||
errdata = &pb.ErrorData{
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_DBError,
|
||||
Title: pb.ErrorCode_DBError.ToString(),
|
||||
Message: err.Error(),
|
||||
@ -54,10 +43,6 @@ func (this *apiComp) Sell(session comm.IUserSession, req *pb.SmithySellReq) (err
|
||||
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
data = &pb.ErrorData{
|
||||
Title: pb.GetErrorCodeMsg(code),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -80,7 +80,7 @@ func (this *modelTask) checkTaskStatus(uid string, taskId int32) bool {
|
||||
if conf == nil {
|
||||
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 true
|
||||
|
@ -175,7 +175,7 @@ func (s *modelTrade) GetSuitRandom(uid string) (suiteId int32) {
|
||||
}
|
||||
//获取玩家已有装备
|
||||
ec, suites := s.module.ModuleEquipment.GetActionableSuit(uid)
|
||||
if ec != pb.ErrorCode_Success {
|
||||
if ec != nil {
|
||||
s.module.Error("获取玩家已有装备:", log.Field{Key: "code", Value: ec})
|
||||
return
|
||||
}
|
||||
|
@ -23,8 +23,7 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.VikingChalleng
|
||||
var (
|
||||
ps int32
|
||||
)
|
||||
code = this.ChallengeCheck(session, req)
|
||||
if errdata != nil {
|
||||
if errdata = this.ChallengeCheck(session, req); errdata != nil {
|
||||
return // 参数校验失败直接返回
|
||||
}
|
||||
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(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
data = &pb.ErrorData{
|
||||
Title: pb.GetErrorCodeMsg(code),
|
||||
Message: err.Error(),
|
||||
}
|
||||
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 < req.Difficulty-1 {
|
||||
code = pb.ErrorCode_HuntingLvErr
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_HuntingLvErr,
|
||||
Title: pb.ErrorCode_HuntingLvErr.ToString(),
|
||||
}
|
||||
return
|
||||
}
|
||||
} else {
|
||||
code = pb.ErrorCode_HuntingLvErr
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_HuntingLvErr,
|
||||
Title: pb.ErrorCode_HuntingLvErr.ToString(),
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
code, record := this.module.battle.CreatePveBattle(session, &pb.BattlePVEReq{
|
||||
errdata, record := this.module.battle.CreatePveBattle(session, &pb.BattlePVEReq{
|
||||
Ptype: pb.PlayType_viking,
|
||||
Title: "",
|
||||
Format: req.Battle,
|
||||
|
@ -34,14 +34,16 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.VikingChal
|
||||
changExp = make(map[string]int32, 0)
|
||||
mapData = make(map[string]interface{}, 0)
|
||||
reward = make([]*cfg.Gameatn, 0)
|
||||
code = this.ChallengeOverCheck(session, req)
|
||||
if errdata != nil {
|
||||
if errdata = this.ChallengeOverCheck(session, req); errdata != nil {
|
||||
return // 参数校验失败直接返回
|
||||
}
|
||||
|
||||
viking, err := this.module.modelViking.getVikingList(session.GetUserId())
|
||||
if err != nil {
|
||||
code = pb.ErrorCode_VikingBoosType
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_VikingBoosType,
|
||||
Title: pb.ErrorCode_VikingBoosType.ToString(),
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
@ -52,11 +54,6 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.VikingChal
|
||||
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
data = &pb.ErrorData{
|
||||
Title: pb.GetErrorCodeMsg(code),
|
||||
Message: err.Error(),
|
||||
}
|
||||
|
||||
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 < req.Difficulty-1 {
|
||||
code = pb.ErrorCode_HuntingLvErr
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_HuntingLvErr,
|
||||
Title: pb.ErrorCode_HuntingLvErr.ToString(),
|
||||
}
|
||||
return
|
||||
}
|
||||
} else {
|
||||
code = pb.ErrorCode_HuntingLvErr
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_HuntingLvErr,
|
||||
Title: pb.ErrorCode_HuntingLvErr.ToString(),
|
||||
}
|
||||
return
|
||||
}
|
||||
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
|
||||
|
||||
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 {
|
||||
// return
|
||||
// }
|
||||
@ -95,7 +98,7 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.VikingChal
|
||||
}
|
||||
viking.Ps[req.BossId] = 0 // 清空预扣体力值
|
||||
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{
|
||||
Data: viking,
|
||||
})
|
||||
@ -151,11 +154,11 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.VikingChal
|
||||
}
|
||||
}
|
||||
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
|
||||
}
|
||||
|
||||
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 {
|
||||
|
@ -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) {
|
||||
code = this.GetListCheck(session, req)
|
||||
if errdata != nil {
|
||||
if errdata = this.GetListCheck(session, req); errdata != nil {
|
||||
return // 参数校验失败直接返回
|
||||
}
|
||||
// 刷新挑战卷
|
||||
// if errdata = this.module.ModuleItems.RecoverTicket(session); errdata != nil {
|
||||
// return
|
||||
// }
|
||||
|
||||
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})
|
||||
return
|
||||
}
|
||||
|
@ -27,8 +27,7 @@ func (this *apiComp) RankList(session comm.IUserSession, req *pb.VikingRankListR
|
||||
szRank []*pb.DBVikingRank
|
||||
rd *redis.StringSliceCmd
|
||||
)
|
||||
code = this.RankListCheck(session, req)
|
||||
if errdata != nil {
|
||||
if errdata = this.RankListCheck(session, req); errdata != nil {
|
||||
return // 参数校验失败直接返回
|
||||
}
|
||||
conn, _ := db.Local()
|
||||
|
@ -58,7 +58,7 @@ func (this *modelViking) checkReddot31(session comm.IUserSession) bool {
|
||||
if list, err := this.module.modelViking.getVikingList(session.GetUserId()); err == nil {
|
||||
if _, ok := list.Boss[1]; ok {
|
||||
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
|
||||
}
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ func (this *Viking) OnInstallComp() {
|
||||
func (this *Viking) ModifyVikingData(uid string, data map[string]interface{}) (errdata *pb.ErrorData) {
|
||||
err := this.modelViking.modifyVikingDataByObjId(uid, data)
|
||||
if err != nil {
|
||||
errdata = &pb.ErrorData{
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_DBError,
|
||||
Title: pb.ErrorCode_DBError.ToString(),
|
||||
Message: err.Error(),
|
||||
@ -190,7 +190,7 @@ func (this *Viking) Reddot(session comm.IUserSession, rid ...comm.ReddotType) (r
|
||||
func (this *Viking) CompleteAllLevel(session comm.IUserSession) (errdata *pb.ErrorData) {
|
||||
list, err := this.modelViking.getVikingList(session.GetUserId())
|
||||
if err != nil {
|
||||
errdata = &pb.ErrorData{
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_DBError,
|
||||
Title: pb.ErrorCode_DBError.ToString(),
|
||||
Message: err.Error(),
|
||||
@ -208,7 +208,7 @@ func (this *Viking) CompleteAllLevel(session comm.IUserSession) (errdata *pb.Err
|
||||
}
|
||||
}
|
||||
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})
|
||||
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) {
|
||||
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)) // 获取当前数量
|
||||
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,
|
||||
})
|
||||
}
|
||||
@ -232,20 +232,19 @@ func (this *Viking) AutoBattleInfo(session comm.IUserSession, battle *pb.BattleF
|
||||
|
||||
cfgData, _ := this.configure.GetVikingBossConfigData(bossId, difficulty)
|
||||
if cfgData == nil {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_ConfigNoFound,
|
||||
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
||||
Message: err.Error(),
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_ConfigNoFound,
|
||||
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
||||
}
|
||||
return
|
||||
}
|
||||
code, record := this.battle.CreatePveBattle(session, &pb.BattlePVEReq{
|
||||
errdata, record := this.battle.CreatePveBattle(session, &pb.BattlePVEReq{
|
||||
Ptype: pb.PlayType_viking,
|
||||
Title: "",
|
||||
Format: battle,
|
||||
Mformat: cfgData.Boss,
|
||||
})
|
||||
if code == pb.ErrorCode_Success {
|
||||
if errdata == nil {
|
||||
battleInfo = &pb.BattleInfo{
|
||||
Id: record.Id,
|
||||
Title: record.Title,
|
||||
@ -268,38 +267,38 @@ func (this *Viking) AutoBattleOver(session comm.IUserSession, Report *pb.BattleR
|
||||
atno = make([]*pb.UserAtno, 0)
|
||||
conf, _ := this.configure.GetVikingBossConfigData(bossId, difficulty)
|
||||
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 {
|
||||
return
|
||||
}
|
||||
viking, err := this.modelViking.getVikingList(session.GetUserId())
|
||||
if err != nil {
|
||||
code = pb.ErrorCode_VikingBoosType
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_VikingBoosType,
|
||||
Title: pb.ErrorCode_VikingBoosType.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
code, bWin := this.battle.CheckBattleReport(session, Report)
|
||||
errdata, bWin := this.battle.CheckBattleReport(session, Report)
|
||||
if !bWin { // 战斗失败了 直接返回
|
||||
code = pb.ErrorCode_BattleNoWin
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_BattleNoWin,
|
||||
Title: pb.ErrorCode_BattleNoWin.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
if autoBattle != nil {
|
||||
if autoBattle.AutoBuy {
|
||||
code = this.AutoBuyTicket(session, bossId, difficulty)
|
||||
errdata = this.AutoBuyTicket(session, bossId, difficulty)
|
||||
}
|
||||
}
|
||||
mapData := make(map[string]interface{}, 0)
|
||||
vikingCfg, _ := this.configure.GetVikingBossConfigData(bossId, difficulty)
|
||||
if vikingCfg == nil {
|
||||
errdata = &pb.ErrorData{
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_ConfigNoFound,
|
||||
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
||||
Message: err.Error(),
|
||||
@ -310,26 +309,26 @@ func (this *Viking) AutoBattleOver(session comm.IUserSession, Report *pb.BattleR
|
||||
if viking.BossTime[key] == 0 { // 新关卡挑战通过 发放首通奖励
|
||||
viking.Boss[bossId]++
|
||||
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...)
|
||||
} else {
|
||||
code = c
|
||||
errdata = c
|
||||
return
|
||||
}
|
||||
}
|
||||
userinfo := this.ModuleUser.GetUser(session.GetUserId())
|
||||
this.CheckRank(session.GetUserId(), bossId, difficulty, Report, userinfo)
|
||||
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...)
|
||||
} else {
|
||||
code = c
|
||||
errdata = c
|
||||
return
|
||||
}
|
||||
|
||||
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 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) {
|
||||
code, _ = this.api.Challenge(session, &pb.VikingChallengeReq{
|
||||
errdata = this.api.Challenge(session, &pb.VikingChallengeReq{
|
||||
BossId: bossid,
|
||||
Difficulty: difficulty,
|
||||
Battle: battle,
|
||||
|
Loading…
Reference in New Issue
Block a user