This commit is contained in:
liwei1dao 2023-08-15 10:37:21 +08:00
commit 097459164a
3 changed files with 34 additions and 19 deletions

View File

@ -65,19 +65,18 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq
} }
// 校验是否是心愿招募 // 校验是否是心愿招募
if req.DrawType == comm.DrawCardType6 && req.DrawCount == 1 { if req.DrawType == comm.DrawCardType6 && req.DrawCount == 1 {
atn := this.module.ModuleTools.GetGlobalConf().ExchangeHero // 校验消耗数量 // 心愿消耗 走单独配置
if errdata = this.module.CheckRes(session, []*cfg.Gameatn{atn}); errdata != nil {
return
}
// 校验许愿英雄 // 校验许愿英雄
var cd int64 var cd int64
var drcount int32 var drcount int32
if heroRecord.WishHero == "" { // 如果当前许愿英雄是空 则读取 默认许愿英雄 //atn := this.module.ModuleTools.GetGlobalConf().ExchangeHero // 校验消耗数量
if conf := this.module.configure.GetWishHeroReplaceConfig(); conf != nil { if conf := this.module.configure.GetWishHeroReplaceConfig(); conf != nil {
if heroRecord.WishHero == "" { // 如果当前许愿英雄是空 则读取 默认许愿英雄
heroRecord.WishHero = conf.InitHero heroRecord.WishHero = conf.InitHero
cd = int64(conf.Cond[heroRecord.WishHero].cd) cd = int64(conf.Cond[heroRecord.WishHero].cd)
drcount = conf.Cond[heroRecord.WishHero].num drcount = conf.Cond[heroRecord.WishHero].num
}
} }
// 校验该抽卡是否在CD 中 // 校验该抽卡是否在CD 中
if outTime, ok := heroRecord.Wish[heroRecord.WishHero]; ok { if outTime, ok := heroRecord.Wish[heroRecord.WishHero]; ok {
@ -88,6 +87,18 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq
return return
} }
} }
costRes = append(costRes, conf.Cond[heroRecord.WishHero].buyCos)
if errdata = this.module.CheckRes(session, costRes); errdata != nil {
return
}
} else { // 配置错误
errdata = &pb.ErrorData{
Code: pb.ErrorCode_ConfigNoFound,
Title: pb.ErrorCode_ConfigNoFound.ToString(),
Message: fmt.Sprintf("GetWishHeroReplaceConfig is nil"),
}
return
}
// 校验 解锁所需抽奖次数 // 校验 解锁所需抽奖次数
if drcount > heroRecord.Race[comm.DrawCardType0] { if drcount > heroRecord.Race[comm.DrawCardType0] {
errdata = &pb.ErrorData{ errdata = &pb.ErrorData{
@ -109,10 +120,14 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq
} }
} }
} else { } else {
errdata = &pb.ErrorData{
Code: pb.ErrorCode_ReqParameterError,
Title: pb.ErrorCode_ReqParameterError.ToString(),
}
return return
} }
if errdata = this.module.ConsumeRes(session, []*cfg.Gameatn{atn}, true); errdata != nil { if errdata = this.module.ConsumeRes(session, costRes, true); errdata != nil {
return return
} }
// 修改recode 数据 // 修改recode 数据

View File

@ -46,6 +46,7 @@ const (
type CondData struct { type CondData struct {
cd int32 cd int32
num int32 num int32
buyCos *cfg.Gameatn
} }
type Replace struct { type Replace struct {
InitHero string // 默认英雄 InitHero string // 默认英雄
@ -178,6 +179,7 @@ func (this *configureComp) Init(service core.IService, module core.IModule, comp
this.appoint.Cond[v.HeroReplace] = &CondData{ this.appoint.Cond[v.HeroReplace] = &CondData{
cd: v.ReplaceCd, cd: v.ReplaceCd,
num: v.ReplaceNum, num: v.ReplaceNum,
buyCos: v.BuyCos,
} }
} else if v.Pool == 2 { } else if v.Pool == 2 {
this.wish.InitHero = v.HeroInitial this.wish.InitHero = v.HeroInitial

View File

@ -98,8 +98,6 @@ func (this *configureComp) Init(service core.IService, module core.IModule, comp
configure.RegisterConfigure(game_buffconf, cfg.NewGameStoneBuff, this.LoadGameStoneBuff) configure.RegisterConfigure(game_buffconf, cfg.NewGameStoneBuff, this.LoadGameStoneBuff)
configure.RegisterConfigure(game_storyconf, cfg.NewGameStoneStory, this.LoadGameStoneStory) configure.RegisterConfigure(game_storyconf, cfg.NewGameStoneStory, this.LoadGameStoneStory)
this.GetEventGroupDataByLottery(0)
this.GetRoomGroupDataByLottery(16010101)
return return
} }