抽卡保底逻辑
This commit is contained in:
parent
98575d23df
commit
fc38b7f4ca
@ -1,58 +1,18 @@
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
"key": "star3_click",
|
"key": "star3_click",
|
||||||
"value": "2"
|
"value": 2
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"key": "star4_click",
|
"key": "star4_click",
|
||||||
"value": "4"
|
"value": 4
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"key": "star5_click",
|
"key": "star5_click",
|
||||||
"value": "6"
|
"value": 6
|
||||||
},
|
|
||||||
{
|
|
||||||
"key": "ordinary_floors_star4",
|
|
||||||
"value": "20"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"key": "ordinary_floors_star5",
|
|
||||||
"value": "100"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"key": "camp1_floors_star4",
|
|
||||||
"value": "20"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"key": "camp1_floors_star5",
|
|
||||||
"value": "50"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"key": "camp2_floors_star4",
|
|
||||||
"value": "20"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"key": "camp2_floors_star5",
|
|
||||||
"value": "50"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"key": "camp3_floors_star4",
|
|
||||||
"value": "20"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"key": "camp3_floors_star5",
|
|
||||||
"value": "50"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"key": "camp4_floors_star4",
|
|
||||||
"value": "20"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"key": "camp4_floors_star5",
|
|
||||||
"value": "50"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"key": "progress_bar_time",
|
"key": "progress_bar_time",
|
||||||
"value": "10"
|
"value": 10
|
||||||
}
|
}
|
||||||
]
|
]
|
@ -6,7 +6,11 @@
|
|||||||
"a": "item",
|
"a": "item",
|
||||||
"t": "10001",
|
"t": "10001",
|
||||||
"n": 1
|
"n": 1
|
||||||
}
|
},
|
||||||
|
"floor4": 50,
|
||||||
|
"floor5": 100,
|
||||||
|
"floor4cards": 2,
|
||||||
|
"floor5cards": 11
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"key": 2,
|
"key": 2,
|
||||||
@ -15,7 +19,11 @@
|
|||||||
"a": "item",
|
"a": "item",
|
||||||
"t": "10001",
|
"t": "10001",
|
||||||
"n": 10
|
"n": 10
|
||||||
}
|
},
|
||||||
|
"floor4": 50,
|
||||||
|
"floor5": 100,
|
||||||
|
"floor4cards": 2,
|
||||||
|
"floor5cards": 11
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"key": 3,
|
"key": 3,
|
||||||
@ -24,7 +32,11 @@
|
|||||||
"a": "item",
|
"a": "item",
|
||||||
"t": "10002",
|
"t": "10002",
|
||||||
"n": 1
|
"n": 1
|
||||||
}
|
},
|
||||||
|
"floor4": 50,
|
||||||
|
"floor5": 100,
|
||||||
|
"floor4cards": 2,
|
||||||
|
"floor5cards": 11
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"key": 4,
|
"key": 4,
|
||||||
@ -33,7 +45,11 @@
|
|||||||
"a": "item",
|
"a": "item",
|
||||||
"t": "10002",
|
"t": "10002",
|
||||||
"n": 10
|
"n": 10
|
||||||
}
|
},
|
||||||
|
"floor4": 50,
|
||||||
|
"floor5": 100,
|
||||||
|
"floor4cards": 2,
|
||||||
|
"floor5cards": 11
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"key": 5,
|
"key": 5,
|
||||||
@ -42,7 +58,11 @@
|
|||||||
"a": "item",
|
"a": "item",
|
||||||
"t": "10003",
|
"t": "10003",
|
||||||
"n": 1
|
"n": 1
|
||||||
}
|
},
|
||||||
|
"floor4": 50,
|
||||||
|
"floor5": 100,
|
||||||
|
"floor4cards": 2,
|
||||||
|
"floor5cards": 11
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"key": 6,
|
"key": 6,
|
||||||
@ -51,7 +71,11 @@
|
|||||||
"a": "item",
|
"a": "item",
|
||||||
"t": "10003",
|
"t": "10003",
|
||||||
"n": 10
|
"n": 10
|
||||||
}
|
},
|
||||||
|
"floor4": 50,
|
||||||
|
"floor5": 100,
|
||||||
|
"floor4cards": 2,
|
||||||
|
"floor5cards": 11
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"key": 7,
|
"key": 7,
|
||||||
@ -60,7 +84,11 @@
|
|||||||
"a": "item",
|
"a": "item",
|
||||||
"t": "10004",
|
"t": "10004",
|
||||||
"n": 1
|
"n": 1
|
||||||
}
|
},
|
||||||
|
"floor4": 50,
|
||||||
|
"floor5": 100,
|
||||||
|
"floor4cards": 2,
|
||||||
|
"floor5cards": 11
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"key": 8,
|
"key": 8,
|
||||||
@ -69,7 +97,11 @@
|
|||||||
"a": "item",
|
"a": "item",
|
||||||
"t": "10004",
|
"t": "10004",
|
||||||
"n": 10
|
"n": 10
|
||||||
}
|
},
|
||||||
|
"floor4": 50,
|
||||||
|
"floor5": 100,
|
||||||
|
"floor4cards": 2,
|
||||||
|
"floor5cards": 11
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"key": 9,
|
"key": 9,
|
||||||
@ -78,7 +110,11 @@
|
|||||||
"a": "item",
|
"a": "item",
|
||||||
"t": "10005",
|
"t": "10005",
|
||||||
"n": 1
|
"n": 1
|
||||||
}
|
},
|
||||||
|
"floor4": 50,
|
||||||
|
"floor5": 100,
|
||||||
|
"floor4cards": 2,
|
||||||
|
"floor5cards": 11
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"key": 10,
|
"key": 10,
|
||||||
@ -87,6 +123,10 @@
|
|||||||
"a": "item",
|
"a": "item",
|
||||||
"t": "10005",
|
"t": "10005",
|
||||||
"n": 10
|
"n": 10
|
||||||
}
|
},
|
||||||
|
"floor4": 50,
|
||||||
|
"floor5": 100,
|
||||||
|
"floor4cards": 2,
|
||||||
|
"floor5cards": 11
|
||||||
}
|
}
|
||||||
]
|
]
|
@ -110,16 +110,3 @@ const (
|
|||||||
TASK_ACHIEVE TaskTag = 3 //成就
|
TASK_ACHIEVE TaskTag = 3 //成就
|
||||||
TASK_STRATEGY TaskTag = 4 // 攻略
|
TASK_STRATEGY TaskTag = 4 // 攻略
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
|
||||||
Key_ordinaryStar4 string = "ordinary_floors_star4"
|
|
||||||
Key_ordinaryStar5 string = "ordinary_floors_star5"
|
|
||||||
Key_camp1Star4 string = "camp1_floors_star4"
|
|
||||||
Key_camp1Star5 string = "camp1_floors_star5"
|
|
||||||
Key_camp2Star4 string = "camp2_floors_star4"
|
|
||||||
Key_camp2Star5 string = "camp2_floors_star5"
|
|
||||||
Key_camp3Star4 string = "camp3_floors_star4"
|
|
||||||
Key_camp3Star5 string = "camp3_floors_star5"
|
|
||||||
Key_camp4Star4 string = "camp4_floors_star4"
|
|
||||||
Key_camp4Star5 string = "camp4_floors_star5"
|
|
||||||
)
|
|
||||||
|
@ -43,7 +43,7 @@ type (
|
|||||||
// heroId 英雄ID
|
// heroId 英雄ID
|
||||||
GetHero(uid, heroId string) (*pb.DBHero, pb.ErrorCode)
|
GetHero(uid, heroId string) (*pb.DBHero, pb.ErrorCode)
|
||||||
// 佩戴装备
|
// 佩戴装备
|
||||||
UpdateEquipment(hero *pb.DBHero, equip []*pb.DB_Equipment) (code pb.ErrorCode)
|
UpdateEquipment(session IUserSession, hero *pb.DBHero, equip []*pb.DB_Equipment) (code pb.ErrorCode)
|
||||||
//获取玩家英雄列表
|
//获取玩家英雄列表
|
||||||
GetHeroList(uid string) []*pb.DBHero
|
GetHeroList(uid string) []*pb.DBHero
|
||||||
//
|
//
|
||||||
|
@ -112,7 +112,7 @@ func (this *apiComp) Equip(session comm.IUserSession, req *pb.EquipmentEquipReq)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//更新装备数据加成
|
//更新装备数据加成
|
||||||
if code = this.module.ModuleHero.UpdateEquipment(hero, equipments); code == pb.ErrorCode_Success {
|
if code = this.module.ModuleHero.UpdateEquipment(session, hero, equipments); code == pb.ErrorCode_Success {
|
||||||
if err = this.module.modelEquipment.UpdateByHeroId(session.GetUserId(), updatequipment...); err != nil {
|
if err = this.module.modelEquipment.UpdateByHeroId(session.GetUserId(), updatequipment...); err != nil {
|
||||||
log.Errorf("Equip err%v", err)
|
log.Errorf("Equip err%v", err)
|
||||||
code = pb.ErrorCode_SystemError
|
code = pb.ErrorCode_SystemError
|
||||||
|
@ -137,7 +137,7 @@ func (this *apiComp) Upgrade(session comm.IUserSession, req *pb.EquipmentUpgrade
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
code = this.module.ModuleHero.UpdateEquipment(hero, equipments)
|
code = this.module.ModuleHero.UpdateEquipment(session, hero, equipments)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
session.SendMsg(string(this.module.GetType()), "upgrade", &pb.EquipmentUpgradeResp{IsSucc: issucc, Equipment: modifyequipments})
|
session.SendMsg(string(this.module.GetType()), "upgrade", &pb.EquipmentUpgradeResp{IsSucc: issucc, Equipment: modifyequipments})
|
||||||
|
@ -29,8 +29,9 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq
|
|||||||
hitStar int32 // 抽中几星
|
hitStar int32 // 抽中几星
|
||||||
curStar4Count int32 // 当前4星没抽到的次数
|
curStar4Count int32 // 当前4星没抽到的次数
|
||||||
curStar5Count int32 // 当前5星没抽到的次数
|
curStar5Count int32 // 当前5星没抽到的次数
|
||||||
// floor4Count int32 // 4星保底次数
|
floor4Count int32 // 4星保底次数
|
||||||
// floor5Count int32 // 5星保底次数
|
floor5Count int32 // 5星保底次数
|
||||||
|
|
||||||
)
|
)
|
||||||
szCards = make([]int32, 0)
|
szCards = make([]int32, 0)
|
||||||
rsp := &pb.HeroDrawCardResp{}
|
rsp := &pb.HeroDrawCardResp{}
|
||||||
@ -51,6 +52,12 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq
|
|||||||
code = pb.ErrorCode_ConfigNoFound
|
code = pb.ErrorCode_ConfigNoFound
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
floor4Count = _costConf.Floor4 // 4星保底次数
|
||||||
|
floor5Count = _costConf.Floor5 // 五星保底次数
|
||||||
|
if floor4Count == 0 || floor5Count == 0 {
|
||||||
|
code = pb.ErrorCode_ConfigNoFound
|
||||||
|
return
|
||||||
|
}
|
||||||
sz := make([]*cfg.Game_atn, 0)
|
sz := make([]*cfg.Game_atn, 0)
|
||||||
sz = append(sz, _costConf.Cost)
|
sz = append(sz, _costConf.Cost)
|
||||||
code = this.module.CheckRes(session, sz) // 消耗校验
|
code = this.module.CheckRes(session, sz) // 消耗校验
|
||||||
@ -88,8 +95,14 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq
|
|||||||
}
|
}
|
||||||
hitStar4++
|
hitStar4++
|
||||||
hitStar5++
|
hitStar5++
|
||||||
// 达到保底次数了 修改当前卡牌星级
|
|
||||||
|
|
||||||
|
if hitStar4 >= floor4Count { // 达到保底次数了 修改当前卡牌星级
|
||||||
|
break
|
||||||
|
}
|
||||||
|
if hitStar5 >= floor5Count { // 触发5星保底
|
||||||
|
// 5星卡池找
|
||||||
|
break
|
||||||
|
}
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,6 @@ const (
|
|||||||
hero_awaken = "game_heroawaken.json" // 英雄觉醒
|
hero_awaken = "game_heroawaken.json" // 英雄觉醒
|
||||||
hero_drawcard = "game_drawcard.json" // 抽卡
|
hero_drawcard = "game_drawcard.json" // 抽卡
|
||||||
hero_drawupdraw = "game_drawupdraw.json" // 抽卡概率调整
|
hero_drawupdraw = "game_drawupdraw.json" // 抽卡概率调整
|
||||||
hero_drawcom = "game_drawcom.json" // 抽卡保底
|
|
||||||
hero_drawcost = "game_drawcost.json" // 抽卡消耗
|
hero_drawcost = "game_drawcost.json" // 抽卡消耗
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -49,7 +48,6 @@ func (this *configureComp) Init(service core.IService, module core.IModule, comp
|
|||||||
hero_awaken: cfg.NewGame_heroAwaken,
|
hero_awaken: cfg.NewGame_heroAwaken,
|
||||||
hero_drawcard: cfg.NewGame_drawCard,
|
hero_drawcard: cfg.NewGame_drawCard,
|
||||||
hero_drawupdraw: cfg.NewGame_drawUpdraw,
|
hero_drawupdraw: cfg.NewGame_drawUpdraw,
|
||||||
hero_drawcom: cfg.NewGame_drawCom,
|
|
||||||
hero_drawcost: cfg.NewGame_drawCost,
|
hero_drawcost: cfg.NewGame_drawCost,
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -390,24 +388,6 @@ func (this *configureComp) GetDrawUpDrawConfig() (configure *cfg.Game_drawUpdraw
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 抽卡保底
|
|
||||||
func (this *configureComp) GetDrawComConfig() (configure *cfg.Game_drawCom, err error) {
|
|
||||||
var (
|
|
||||||
v interface{}
|
|
||||||
ok bool
|
|
||||||
)
|
|
||||||
if v, err = this.GetConfigure(hero_drawcom); err == nil {
|
|
||||||
if configure, ok = v.(*cfg.Game_drawCom); !ok {
|
|
||||||
err = fmt.Errorf("%T no is *cfg.Game_drawCom", v)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
err = fmt.Errorf("%T no is *cfg.Game_drawCom", v)
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// 抽卡消耗
|
// 抽卡消耗
|
||||||
func (this *configureComp) GetDrawCostConfig() (configure *cfg.Game_drawCost, err error) {
|
func (this *configureComp) GetDrawCostConfig() (configure *cfg.Game_drawCost, err error) {
|
||||||
var (
|
var (
|
||||||
|
@ -415,6 +415,8 @@ func (this *ModelHero) HeroStarUp(session comm.IUserSession, hero *pb.DBHero) (c
|
|||||||
"star": hero.Star + 1,
|
"star": hero.Star + 1,
|
||||||
"isOverlying": false,
|
"isOverlying": false,
|
||||||
}
|
}
|
||||||
|
// 触发星级任务
|
||||||
|
this.moduleHero.ModuleTask.SendToTask(session.GetUserId(), comm.TaskTypeGetHero, &pb.TaskParam{First: hero.Star + 1})
|
||||||
// 保存数据
|
// 保存数据
|
||||||
err1 := this.modifyHeroData(session.GetUserId(), hero.Id, _heroMap)
|
err1 := this.modifyHeroData(session.GetUserId(), hero.Id, _heroMap)
|
||||||
if err1 != nil {
|
if err1 != nil {
|
||||||
|
@ -58,7 +58,7 @@ func (this *Hero) GetHero(uid, heroId string) (*pb.DBHero, pb.ErrorCode) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//佩戴装备
|
//佩戴装备
|
||||||
func (this *Hero) UpdateEquipment(hero *pb.DBHero, equip []*pb.DB_Equipment) (code pb.ErrorCode) {
|
func (this *Hero) UpdateEquipment(session comm.IUserSession, hero *pb.DBHero, equip []*pb.DB_Equipment) (code pb.ErrorCode) {
|
||||||
if hero == nil {
|
if hero == nil {
|
||||||
code = pb.ErrorCode_HeroNoExist
|
code = pb.ErrorCode_HeroNoExist
|
||||||
return
|
return
|
||||||
@ -69,6 +69,12 @@ func (this *Hero) UpdateEquipment(hero *pb.DBHero, equip []*pb.DB_Equipment) (co
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.modelHero.setEquipProperty(hero, equip)
|
this.modelHero.setEquipProperty(hero, equip)
|
||||||
|
|
||||||
|
err1 := this.modelHero.PushHeroProperty(session, hero.Id) // 推送属性变化
|
||||||
|
if err1 != nil {
|
||||||
|
code = pb.ErrorCode_Unknown
|
||||||
|
this.Errorf("PushHeroProperty err!")
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ import "errors"
|
|||||||
|
|
||||||
type Game_drawComData struct {
|
type Game_drawComData struct {
|
||||||
Key string
|
Key string
|
||||||
Value string
|
Value int32
|
||||||
}
|
}
|
||||||
|
|
||||||
func (Game_drawComData) GetTypeId() int {
|
func (Game_drawComData) GetTypeId() int {
|
||||||
@ -22,6 +22,6 @@ func (Game_drawComData) GetTypeId() int {
|
|||||||
func NewGame_drawComData(_buf map[string]interface{}) (_v *Game_drawComData, err error) {
|
func NewGame_drawComData(_buf map[string]interface{}) (_v *Game_drawComData, err error) {
|
||||||
_v = &Game_drawComData{}
|
_v = &Game_drawComData{}
|
||||||
{ var _ok_ bool; if _v.Key, _ok_ = _buf["key"].(string); !_ok_ { err = errors.New("key error"); return } }
|
{ var _ok_ bool; if _v.Key, _ok_ = _buf["key"].(string); !_ok_ { err = errors.New("key error"); return } }
|
||||||
{ var _ok_ bool; if _v.Value, _ok_ = _buf["value"].(string); !_ok_ { err = errors.New("value error"); return } }
|
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["value"].(float64); !_ok_ { err = errors.New("value error"); return }; _v.Value = int32(_tempNum_) }
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,10 @@ type Game_drawCostData struct {
|
|||||||
Key int32
|
Key int32
|
||||||
Count int32
|
Count int32
|
||||||
Cost *Game_atn
|
Cost *Game_atn
|
||||||
|
Floor4 int32
|
||||||
|
Floor5 int32
|
||||||
|
Floor4cards int32
|
||||||
|
Floor5cards int32
|
||||||
}
|
}
|
||||||
|
|
||||||
func (Game_drawCostData) GetTypeId() int {
|
func (Game_drawCostData) GetTypeId() int {
|
||||||
@ -25,5 +29,9 @@ func NewGame_drawCostData(_buf map[string]interface{}) (_v *Game_drawCostData, e
|
|||||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["key"].(float64); !_ok_ { err = errors.New("key error"); return }; _v.Key = int32(_tempNum_) }
|
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["key"].(float64); !_ok_ { err = errors.New("key error"); return }; _v.Key = int32(_tempNum_) }
|
||||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["count"].(float64); !_ok_ { err = errors.New("count error"); return }; _v.Count = int32(_tempNum_) }
|
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["count"].(float64); !_ok_ { err = errors.New("count error"); return }; _v.Count = int32(_tempNum_) }
|
||||||
{ var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _buf["cost"].(map[string]interface{}); !_ok_ { err = errors.New("cost error"); return }; if _v.Cost, err = NewGame_atn(_x_); err != nil { return } }
|
{ var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _buf["cost"].(map[string]interface{}); !_ok_ { err = errors.New("cost error"); return }; if _v.Cost, err = NewGame_atn(_x_); err != nil { return } }
|
||||||
|
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["floor4"].(float64); !_ok_ { err = errors.New("floor4 error"); return }; _v.Floor4 = int32(_tempNum_) }
|
||||||
|
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["floor5"].(float64); !_ok_ { err = errors.New("floor5 error"); return }; _v.Floor5 = int32(_tempNum_) }
|
||||||
|
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["floor4cards"].(float64); !_ok_ { err = errors.New("floor4cards error"); return }; _v.Floor4cards = int32(_tempNum_) }
|
||||||
|
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["floor5cards"].(float64); !_ok_ { err = errors.New("floor5cards error"); return }; _v.Floor5cards = int32(_tempNum_) }
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user