This commit is contained in:
meixiongfeng 2023-06-21 17:21:41 +08:00
parent 85de666fb1
commit a70b600062

View File

@ -28,7 +28,6 @@ func (this *apiComp) DrawCardV2(session comm.IUserSession, req *pb.HeroDrawCardR
star4Max int32 // 10连抽最大4星数量 star4Max int32 // 10连抽最大4星数量
star5Max int32 // 10连抽最大5星数量 star5Max int32 // 10连抽最大5星数量
cfgDraw *cfg.GameGlobalData cfgDraw *cfg.GameGlobalData
costAtn *cfg.Gameatn
heroRecord *pb.DBHeroRecord heroRecord *pb.DBHeroRecord
pool string // 当前抽对应的卡池 pool string // 当前抽对应的卡池
atno []*pb.UserAtno // 最终获得的资源 atno []*pb.UserAtno // 最终获得的资源
@ -82,9 +81,13 @@ func (this *apiComp) DrawCardV2(session comm.IUserSession, req *pb.HeroDrawCardR
if req.DrawType == 0 { // 普通卡池抽卡 if req.DrawType == 0 { // 普通卡池抽卡
////// 获取消耗 star ////// 获取消耗 star
if req.DrawCount == 1 { if req.DrawCount == 1 {
costAtn = cfgDraw.BasePoolCost // 单抽消耗 costRes = drawConf.ConsumeA // 单抽消耗
} else { } else {
costAtn = cfgDraw.BasePool10cost // 十连消耗 costRes = drawConf.ConsumeB // 十连消耗
}
if errdata = this.module.CheckRes(session, costRes); errdata != nil { // 消耗数量不足直接返回
return
} }
///// 获取消耗 end ///// 获取消耗 end
for i := 1; i <= int(req.DrawCount); i++ { // 一张一张的抽 for i := 1; i <= int(req.DrawCount); i++ { // 一张一张的抽
@ -93,6 +96,7 @@ func (this *apiComp) DrawCardV2(session comm.IUserSession, req *pb.HeroDrawCardR
strPool = append(strPool, v) //找到了 strPool = append(strPool, v) //找到了
continue continue
} }
// 随机获取三星
} }
} else { } else {
@ -101,15 +105,14 @@ func (this *apiComp) DrawCardV2(session comm.IUserSession, req *pb.HeroDrawCardR
if req.DrawType == 0 { // 普通卡池抽卡 if req.DrawType == 0 { // 普通卡池抽卡
normalDraw = true normalDraw = true
// 获取普通抽卡池 // 获取普通抽卡池
if req.DrawCount == 1 { // if req.DrawCount == 1 {
costAtn = cfgDraw.BasePoolCost // costAtn = cfgDraw.BasePoolCost
} else { // } else {
costAtn = cfgDraw.BasePool10cost // costAtn = cfgDraw.BasePool10cost
} // }
costRes = append(costRes, costAtn) // if errdata = this.module.CheckRes(session, costRes); errdata != nil { // 消耗数量不足直接返回
if errdata = this.module.CheckRes(session, costRes); errdata != nil { // 消耗数量不足直接返回 // return
return // }
}
for i := 0; i < int(req.DrawCount); i++ { for i := 0; i < int(req.DrawCount); i++ {
drawCount += 1 drawCount += 1
@ -250,47 +253,15 @@ func (this *apiComp) DrawCardV2(session comm.IUserSession, req *pb.HeroDrawCardR
} else { // 所有阵营抽卡都走这里 } else { // 所有阵营抽卡都走这里
drawCount += req.DrawCount drawCount += req.DrawCount
if req.DrawCount == 1 { if req.DrawCount == 1 {
switch req.DrawType {
case 1:
pool = cfgDraw.Camp1Pool1
costAtn = cfgDraw.Camp1PoolCost
case 2:
pool = cfgDraw.Camp2Pool1
costAtn = cfgDraw.Camp2PoolCost
case 3:
pool = cfgDraw.Camp3Pool1
costAtn = cfgDraw.Camp3PoolCost
case 4:
pool = cfgDraw.Camp4Pool1
costAtn = cfgDraw.Camp4PoolCost
}
strPool = append(strPool, pool) strPool = append(strPool, pool)
} else { } else {
costAtn = cfgDraw.Camp1PoolCost
switch req.DrawType {
case 1:
pool = cfgDraw.Camp1Pool1
costAtn = cfgDraw.Camp1Pool10cost
case 2:
pool = cfgDraw.Camp2Pool1
costAtn = cfgDraw.Camp2Pool10cost
case 3:
pool = cfgDraw.Camp3Pool1
costAtn = cfgDraw.Camp3Pool10cost
case 4:
pool = cfgDraw.Camp4Pool1
costAtn = cfgDraw.Camp4Pool10cost
}
for i := 0; i < int(req.DrawCount); i++ { for i := 0; i < int(req.DrawCount); i++ {
strPool = append(strPool, pool) strPool = append(strPool, pool)
} }
} }
costRes = append(costRes, costAtn)
//阵营消耗 //阵营消耗
if errdata = this.module.CheckRes(session, costRes); errdata != nil { // 消耗数量不足直接返回 if errdata = this.module.CheckRes(session, costRes); errdata != nil { // 消耗数量不足直接返回
return return