Merge branches 'dev' and 'meixiongfeng' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
1d942d918f
@ -1,157 +1,157 @@
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
"key": 1,
|
"key": 1,
|
||||||
"id": "10001",
|
"id": "13001",
|
||||||
"type_id": 1,
|
"type_id": 1,
|
||||||
"weight": 1000
|
"weight": 1000
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"key": 2,
|
"key": 2,
|
||||||
"id": "10002",
|
"id": "13002",
|
||||||
"type_id": 1,
|
"type_id": 1,
|
||||||
"weight": 1000
|
"weight": 1000
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"key": 3,
|
"key": 3,
|
||||||
"id": "10003",
|
"id": "13003",
|
||||||
"type_id": 1,
|
"type_id": 1,
|
||||||
"weight": 1000
|
"weight": 1000
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"key": 4,
|
"key": 4,
|
||||||
"id": "10004",
|
"id": "13004",
|
||||||
"type_id": 1,
|
"type_id": 1,
|
||||||
"weight": 1000
|
"weight": 1000
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"key": 5,
|
"key": 5,
|
||||||
"id": "10005",
|
"id": "13005",
|
||||||
"type_id": 1,
|
"type_id": 1,
|
||||||
"weight": 1000
|
"weight": 1000
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"key": 6,
|
"key": 6,
|
||||||
"id": "10006",
|
"id": "14001",
|
||||||
"type_id": 1,
|
"type_id": 1,
|
||||||
"weight": 1000
|
"weight": 1000
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"key": 7,
|
"key": 7,
|
||||||
"id": "10007",
|
"id": "14002",
|
||||||
"type_id": 1,
|
"type_id": 1,
|
||||||
"weight": 1000
|
"weight": 1000
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"key": 8,
|
"key": 8,
|
||||||
"id": "10008",
|
"id": "14003",
|
||||||
"type_id": 1,
|
"type_id": 1,
|
||||||
"weight": 1000
|
"weight": 1000
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"key": 9,
|
"key": 9,
|
||||||
"id": "10009",
|
"id": "14004",
|
||||||
"type_id": 1,
|
"type_id": 1,
|
||||||
"weight": 1000
|
"weight": 1000
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"key": 10,
|
"key": 10,
|
||||||
"id": "10010",
|
"id": "14005",
|
||||||
"type_id": 1,
|
"type_id": 1,
|
||||||
"weight": 1000
|
"weight": 1000
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"key": 11,
|
"key": 11,
|
||||||
"id": "10011",
|
"id": "14006",
|
||||||
"type_id": 1,
|
"type_id": 1,
|
||||||
"weight": 1000
|
"weight": 1000
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"key": 12,
|
"key": 12,
|
||||||
"id": "10012",
|
"id": "14007",
|
||||||
"type_id": 1,
|
"type_id": 1,
|
||||||
"weight": 1000
|
"weight": 1000
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"key": 13,
|
"key": 13,
|
||||||
"id": "10013",
|
"id": "15001",
|
||||||
"type_id": 1,
|
"type_id": 1,
|
||||||
"weight": 1000
|
"weight": 1000
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"key": 14,
|
"key": 14,
|
||||||
"id": "10014",
|
"id": "15002",
|
||||||
"type_id": 1,
|
"type_id": 1,
|
||||||
"weight": 1000
|
"weight": 1000
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"key": 15,
|
"key": 15,
|
||||||
"id": "10015",
|
"id": "15003",
|
||||||
"type_id": 1,
|
"type_id": 1,
|
||||||
"weight": 1000
|
"weight": 1000
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"key": 16,
|
"key": 16,
|
||||||
"id": "10016",
|
"id": "15004",
|
||||||
"type_id": 1,
|
"type_id": 1,
|
||||||
"weight": 1000
|
"weight": 1000
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"key": 17,
|
"key": 17,
|
||||||
"id": "10017",
|
"id": "23001",
|
||||||
"type_id": 1,
|
"type_id": 1,
|
||||||
"weight": 1000
|
"weight": 1000
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"key": 18,
|
"key": 18,
|
||||||
"id": "10018",
|
"id": "23002",
|
||||||
"type_id": 1,
|
"type_id": 1,
|
||||||
"weight": 1000
|
"weight": 1000
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"key": 19,
|
"key": 19,
|
||||||
"id": "10019",
|
"id": "23003",
|
||||||
"type_id": 1,
|
"type_id": 1,
|
||||||
"weight": 1000
|
"weight": 1000
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"key": 20,
|
"key": 20,
|
||||||
"id": "10020",
|
"id": "23004",
|
||||||
"type_id": 1,
|
"type_id": 1,
|
||||||
"weight": 1000
|
"weight": 1000
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"key": 21,
|
"key": 21,
|
||||||
"id": "10001",
|
"id": "24001",
|
||||||
"type_id": 2,
|
"type_id": 2,
|
||||||
"weight": 1000
|
"weight": 1000
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"key": 22,
|
"key": 22,
|
||||||
"id": "10002",
|
"id": "24002",
|
||||||
"type_id": 2,
|
"type_id": 2,
|
||||||
"weight": 1000
|
"weight": 1000
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"key": 23,
|
"key": 23,
|
||||||
"id": "10001",
|
"id": "24003",
|
||||||
"type_id": 11,
|
"type_id": 11,
|
||||||
"weight": 1000
|
"weight": 1000
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"key": 24,
|
"key": 24,
|
||||||
"id": "10002",
|
"id": "24004",
|
||||||
"type_id": 11,
|
"type_id": 11,
|
||||||
"weight": 1000
|
"weight": 1000
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"key": 25,
|
"key": 25,
|
||||||
"id": "10003",
|
"id": "24005",
|
||||||
"type_id": 11,
|
"type_id": 11,
|
||||||
"weight": 1000
|
"weight": 1000
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"key": 26,
|
"key": 26,
|
||||||
"id": "10004",
|
"id": "24006",
|
||||||
"type_id": 11,
|
"type_id": 11,
|
||||||
"weight": 1000
|
"weight": 1000
|
||||||
},
|
},
|
||||||
|
@ -35,6 +35,7 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq
|
|||||||
upDraw []*cfg.Game_drawUpdrawData // 活动数据 英雄抽卡权重增加
|
upDraw []*cfg.Game_drawUpdrawData // 活动数据 英雄抽卡权重增加
|
||||||
cardW map[string]int32 // 当前卡牌卡池卡牌对应的权重
|
cardW map[string]int32 // 当前卡牌卡池卡牌对应的权重
|
||||||
)
|
)
|
||||||
|
cardW = make(map[string]int32, 0)
|
||||||
upDraw = make([]*cfg.Game_drawUpdrawData, 0)
|
upDraw = make([]*cfg.Game_drawUpdrawData, 0)
|
||||||
szCards = make([]string, 0)
|
szCards = make([]string, 0)
|
||||||
rsp := &pb.HeroDrawCardResp{}
|
rsp := &pb.HeroDrawCardResp{}
|
||||||
@ -96,6 +97,7 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq
|
|||||||
// 权重赋值
|
// 权重赋值
|
||||||
for _, v := range _conf {
|
for _, v := range _conf {
|
||||||
cardW[v.Id] += v.Weight
|
cardW[v.Id] += v.Weight
|
||||||
|
totalWeight += int64(cardW[v.Id])
|
||||||
}
|
}
|
||||||
|
|
||||||
_costConf, err := this.module.configure.GetDrawCostConfigByID(req.DrawType) // 抽卡消耗
|
_costConf, err := this.module.configure.GetDrawCostConfigByID(req.DrawType) // 抽卡消耗
|
||||||
@ -120,28 +122,26 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq
|
|||||||
|
|
||||||
drawTimes = _costConf.Count // 抽卡次数
|
drawTimes = _costConf.Count // 抽卡次数
|
||||||
|
|
||||||
drawTimes = 1
|
|
||||||
for i := 0; i < int(drawTimes); i++ {
|
for i := 0; i < int(drawTimes); i++ {
|
||||||
n, _ := rand.Int(rand.Reader, big.NewInt(totalWeight)) // [0,totalWeight)
|
n, _ := rand.Int(rand.Reader, big.NewInt(totalWeight)) // [0,totalWeight)
|
||||||
|
curWeigth = 0
|
||||||
for k, v := range cardW {
|
for k, v := range cardW {
|
||||||
curWeigth += int64(v)
|
curWeigth += int64(v)
|
||||||
if curWeigth < n.Int64() { // 命中
|
if curWeigth < n.Int64() { // 命中
|
||||||
// 获取当前星级
|
// 获取当前星级
|
||||||
_getCardCfg := this.module.configure.GetHero(k) //获取的英雄信息
|
_getCardCfg := this.module.configure.GetHero(k) //获取的英雄信息
|
||||||
if _getCardCfg != nil {
|
if _getCardCfg == nil {
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
if _getCardCfg.Star == 4 { // 当抽取到的英雄是4星的时候 清除 该类型的保底次数
|
|
||||||
curStar4Count = 0
|
|
||||||
continue
|
|
||||||
} else if _getCardCfg.Star == 5 { // 当抽取到的英雄是5星的时候 清除 该类型的保底次数
|
|
||||||
curStar5Count = 0 // 清0
|
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
curStar4Count++
|
curStar4Count++
|
||||||
curStar5Count++
|
curStar5Count++
|
||||||
bGet := false
|
if _getCardCfg.Star == 4 { // 当抽取到的英雄是4星的时候 清除 该类型的保底次数
|
||||||
|
curStar4Count = 0
|
||||||
|
|
||||||
|
} else if _getCardCfg.Star == 5 { // 当抽取到的英雄是5星的时候 清除 该类型的保底次数
|
||||||
|
curStar5Count = 0 // 清0
|
||||||
|
}
|
||||||
|
|
||||||
// 达标保底次数
|
// 达标保底次数
|
||||||
if curStar4Count >= config4Count {
|
if curStar4Count >= config4Count {
|
||||||
//_costConf.Floor4cards
|
//_costConf.Floor4cards
|
||||||
@ -158,7 +158,6 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq
|
|||||||
_tmpW += int64(v.Weight)
|
_tmpW += int64(v.Weight)
|
||||||
if n.Int64() > _tmpW { // 种族保底卡池命中
|
if n.Int64() > _tmpW { // 种族保底卡池命中
|
||||||
szCards = append(szCards, v.Id)
|
szCards = append(szCards, v.Id)
|
||||||
bGet = true
|
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -177,15 +176,13 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq
|
|||||||
_tmpW += int64(v.Weight)
|
_tmpW += int64(v.Weight)
|
||||||
if n.Int64() > _tmpW { // 种族保底卡池命中
|
if n.Int64() > _tmpW { // 种族保底卡池命中
|
||||||
szCards = append(szCards, v.Id)
|
szCards = append(szCards, v.Id)
|
||||||
bGet = true
|
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if !bGet {
|
szCards = append(szCards, k)
|
||||||
szCards = append(szCards, k)
|
break
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -165,7 +165,7 @@ func (this *ModuleBase) CheckRes(session comm.IUserSession, res []*cfg.Game_atn)
|
|||||||
// code = pb.ErrorCode_ConfigurationException
|
// code = pb.ErrorCode_ConfigurationException
|
||||||
// return
|
// return
|
||||||
// }
|
// }
|
||||||
if amount = int32(this.ModuleItems.QueryItemAmount(source, session.GetSessionId(), v.T)); amount < v.N {
|
if amount = int32(this.ModuleItems.QueryItemAmount(source, session.GetUserId(), v.T)); amount < v.N {
|
||||||
code = pb.ErrorCode_ResNoEnough
|
code = pb.ErrorCode_ResNoEnough
|
||||||
this.Errorf("道具不足:A:%s,T:%s,N:%d", v.A, v.T, v.N)
|
this.Errorf("道具不足:A:%s,T:%s,N:%d", v.A, v.T, v.N)
|
||||||
return
|
return
|
||||||
@ -199,7 +199,7 @@ func (this *ModuleBase) ConsumeRes(session comm.IUserSession, res []*cfg.Game_at
|
|||||||
// code = pb.ErrorCode_ConfigurationException
|
// code = pb.ErrorCode_ConfigurationException
|
||||||
// return
|
// return
|
||||||
// }
|
// }
|
||||||
if amount = int32(this.ModuleItems.QueryItemAmount(source, session.GetSessionId(), v.T)); amount < v.N {
|
if amount = int32(this.ModuleItems.QueryItemAmount(source, session.GetUserId(), v.T)); amount < v.N {
|
||||||
code = pb.ErrorCode_ResNoEnough
|
code = pb.ErrorCode_ResNoEnough
|
||||||
this.Errorf("道具不足:A:%s,T:%s,N:%d", v.A, v.T, v.N)
|
this.Errorf("道具不足:A:%s,T:%s,N:%d", v.A, v.T, v.N)
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user