抽卡活动
This commit is contained in:
parent
2b2ff06e33
commit
1c577a821f
@ -8,6 +8,7 @@ import (
|
||||
"math"
|
||||
"math/big"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
@ -31,11 +32,23 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq
|
||||
config4Count int32 // 配置表中4星保底次数
|
||||
config5Count int32 // 配置表中5星保底次数
|
||||
race int32
|
||||
upDraw []*cfg.Game_drawUpdrawData // 活动数据 英雄抽卡权重增加
|
||||
)
|
||||
upDraw = make([]*cfg.Game_drawUpdrawData, 0)
|
||||
szCards = make([]string, 0)
|
||||
rsp := &pb.HeroDrawCardResp{}
|
||||
this.module.Debugf("当前4星抽卡没中次数:%d, 当前5星抽卡没中次数:%d", curStar4Count, curStar5Count)
|
||||
|
||||
// ======记录活动数据
|
||||
cfgData, err := this.module.configure.GetDrawUpDrawConfig()
|
||||
if err != nil {
|
||||
// 校验时间
|
||||
for _, v := range cfgData.GetDataList() {
|
||||
if time.Now().Unix() > int64(v.TimeOn) && time.Now().Unix() < int64(v.TimeOff) { // 在这个时间范围之内
|
||||
upDraw = append(upDraw, v) // 记录下在这活动范围之内的数据
|
||||
}
|
||||
}
|
||||
}
|
||||
// =======活动数据记录完成
|
||||
rst, _ := this.module.modelHero.GetUserRecord(session.GetUserId())
|
||||
if req.DrawType%2 == 0 { // 转成对应阵营信息 1~5
|
||||
race = int32((int(req.DrawType)) / 2)
|
||||
@ -89,7 +102,7 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq
|
||||
for _, v := range _conf {
|
||||
totalWeight += int64(v.Weight) // 统计所有权重
|
||||
}
|
||||
//this.module.configure.GetDrawUpDrawConfig()
|
||||
|
||||
drawTimes = 1
|
||||
for i := 0; i < int(drawTimes); i++ {
|
||||
n, _ := rand.Int(rand.Reader, big.NewInt(totalWeight)) // [0,totalWeight)
|
||||
|
Loading…
Reference in New Issue
Block a user