Merge branch 'dev' of http://git.legu.cc/liwei_3d/go_dreamfactory into liwei
This commit is contained in:
commit
13ef34b170
@ -41,7 +41,7 @@ type (
|
||||
CreateRepeatHero(uid string, heroCfgId string, num int32) (*pb.DBHero, error)
|
||||
// 获取英雄
|
||||
// heroId 英雄ID
|
||||
GetHero(uid, heroId string) (*pb.DBHero, pb.ErrorCode)
|
||||
GetHeroByObjID(uid, heroId string) (*pb.DBHero, pb.ErrorCode)
|
||||
// 佩戴装备
|
||||
UpdateEquipment(session IUserSession, hero *pb.DBHero, equip []*pb.DB_Equipment) (code pb.ErrorCode)
|
||||
//获取玩家英雄列表
|
||||
|
@ -37,7 +37,7 @@ func (this *apiComp) Equip(session comm.IUserSession, req *pb.EquipmentEquipReq)
|
||||
equipments = make([]*pb.DB_Equipment, len(req.EquipmentId))
|
||||
|
||||
//获取英雄数据
|
||||
if hero, code = this.module.ModuleHero.GetHero(session.GetUserId(), req.HeroCardId); code != pb.ErrorCode_Success {
|
||||
if hero, code = this.module.ModuleHero.GetHeroByObjID(session.GetUserId(), req.HeroCardId); code != pb.ErrorCode_Success {
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -119,7 +119,7 @@ func (this *apiComp) Upgrade(session comm.IUserSession, req *pb.EquipmentUpgrade
|
||||
|
||||
//已装备 重新计算属性
|
||||
if equipment.HeroId != "" {
|
||||
if hero, code = this.module.ModuleHero.GetHero(session.GetUserId(), equipment.HeroId); code != pb.ErrorCode_Success {
|
||||
if hero, code = this.module.ModuleHero.GetHeroByObjID(session.GetUserId(), equipment.HeroId); code != pb.ErrorCode_Success {
|
||||
log.Errorf("Upgrade code:%d", code)
|
||||
return
|
||||
}
|
||||
|
@ -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