diff --git a/bin/json/game_drawcom.json b/bin/json/game_drawcom.json index 9eab1dd7d..195027285 100644 --- a/bin/json/game_drawcom.json +++ b/bin/json/game_drawcom.json @@ -1,58 +1,18 @@ [ { "key": "star3_click", - "value": "2" + "value": 2 }, { "key": "star4_click", - "value": "4" + "value": 4 }, { "key": "star5_click", - "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" + "value": 6 }, { "key": "progress_bar_time", - "value": "10" + "value": 10 } ] \ No newline at end of file diff --git a/bin/json/game_drawcost.json b/bin/json/game_drawcost.json index 6c819e033..6fb741b05 100644 --- a/bin/json/game_drawcost.json +++ b/bin/json/game_drawcost.json @@ -6,7 +6,11 @@ "a": "item", "t": "10001", "n": 1 - } + }, + "floor4": 50, + "floor5": 100, + "floor4cards": 2, + "floor5cards": 11 }, { "key": 2, @@ -15,7 +19,11 @@ "a": "item", "t": "10001", "n": 10 - } + }, + "floor4": 50, + "floor5": 100, + "floor4cards": 2, + "floor5cards": 11 }, { "key": 3, @@ -24,7 +32,11 @@ "a": "item", "t": "10002", "n": 1 - } + }, + "floor4": 50, + "floor5": 100, + "floor4cards": 2, + "floor5cards": 11 }, { "key": 4, @@ -33,7 +45,11 @@ "a": "item", "t": "10002", "n": 10 - } + }, + "floor4": 50, + "floor5": 100, + "floor4cards": 2, + "floor5cards": 11 }, { "key": 5, @@ -42,7 +58,11 @@ "a": "item", "t": "10003", "n": 1 - } + }, + "floor4": 50, + "floor5": 100, + "floor4cards": 2, + "floor5cards": 11 }, { "key": 6, @@ -51,7 +71,11 @@ "a": "item", "t": "10003", "n": 10 - } + }, + "floor4": 50, + "floor5": 100, + "floor4cards": 2, + "floor5cards": 11 }, { "key": 7, @@ -60,7 +84,11 @@ "a": "item", "t": "10004", "n": 1 - } + }, + "floor4": 50, + "floor5": 100, + "floor4cards": 2, + "floor5cards": 11 }, { "key": 8, @@ -69,7 +97,11 @@ "a": "item", "t": "10004", "n": 10 - } + }, + "floor4": 50, + "floor5": 100, + "floor4cards": 2, + "floor5cards": 11 }, { "key": 9, @@ -78,7 +110,11 @@ "a": "item", "t": "10005", "n": 1 - } + }, + "floor4": 50, + "floor5": 100, + "floor4cards": 2, + "floor5cards": 11 }, { "key": 10, @@ -87,6 +123,10 @@ "a": "item", "t": "10005", "n": 10 - } + }, + "floor4": 50, + "floor5": 100, + "floor4cards": 2, + "floor5cards": 11 } ] \ No newline at end of file diff --git a/comm/const.go b/comm/const.go index 6bc86bc3e..b8f3749f3 100644 --- a/comm/const.go +++ b/comm/const.go @@ -110,16 +110,3 @@ const ( TASK_ACHIEVE TaskTag = 3 //成就 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" -) diff --git a/comm/imodule.go b/comm/imodule.go index f3769da60..f1d9f5c41 100644 --- a/comm/imodule.go +++ b/comm/imodule.go @@ -43,10 +43,10 @@ type ( // heroId 英雄ID 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 - // + // CleanData(uid string) } diff --git a/modules/equipment/api_equip.go b/modules/equipment/api_equip.go index 492fdff2d..d77745832 100644 --- a/modules/equipment/api_equip.go +++ b/modules/equipment/api_equip.go @@ -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 { log.Errorf("Equip err%v", err) code = pb.ErrorCode_SystemError diff --git a/modules/equipment/api_upgrade.go b/modules/equipment/api_upgrade.go index ae443bda5..e2852eefe 100644 --- a/modules/equipment/api_upgrade.go +++ b/modules/equipment/api_upgrade.go @@ -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}) diff --git a/modules/hero/api_drawCard.go b/modules/hero/api_drawCard.go index 0cc2d6ac4..bf0e86e65 100644 --- a/modules/hero/api_drawCard.go +++ b/modules/hero/api_drawCard.go @@ -29,8 +29,9 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq hitStar int32 // 抽中几星 curStar4Count int32 // 当前4星没抽到的次数 curStar5Count int32 // 当前5星没抽到的次数 - // floor4Count int32 // 4星保底次数 - // floor5Count int32 // 5星保底次数 + floor4Count int32 // 4星保底次数 + floor5Count int32 // 5星保底次数 + ) szCards = make([]int32, 0) rsp := &pb.HeroDrawCardResp{} @@ -51,6 +52,12 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq code = pb.ErrorCode_ConfigNoFound 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 = append(sz, _costConf.Cost) code = this.module.CheckRes(session, sz) // 消耗校验 @@ -88,8 +95,14 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq } hitStar4++ hitStar5++ - // 达到保底次数了 修改当前卡牌星级 + if hitStar4 >= floor4Count { // 达到保底次数了 修改当前卡牌星级 + break + } + if hitStar5 >= floor5Count { // 触发5星保底 + // 5星卡池找 + break + } break } } diff --git a/modules/hero/configure_comp.go b/modules/hero/configure_comp.go index 49f6fa47d..68d6b7d05 100644 --- a/modules/hero/configure_comp.go +++ b/modules/hero/configure_comp.go @@ -22,7 +22,6 @@ const ( hero_awaken = "game_heroawaken.json" // 英雄觉醒 hero_drawcard = "game_drawcard.json" // 抽卡 hero_drawupdraw = "game_drawupdraw.json" // 抽卡概率调整 - hero_drawcom = "game_drawcom.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_drawcard: cfg.NewGame_drawCard, hero_drawupdraw: cfg.NewGame_drawUpdraw, - hero_drawcom: cfg.NewGame_drawCom, hero_drawcost: cfg.NewGame_drawCost, }) @@ -390,24 +388,6 @@ func (this *configureComp) GetDrawUpDrawConfig() (configure *cfg.Game_drawUpdraw 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) { var ( diff --git a/modules/hero/model_hero.go b/modules/hero/model_hero.go index 9531dddc6..b54ecffeb 100644 --- a/modules/hero/model_hero.go +++ b/modules/hero/model_hero.go @@ -415,6 +415,8 @@ func (this *ModelHero) HeroStarUp(session comm.IUserSession, hero *pb.DBHero) (c "star": hero.Star + 1, "isOverlying": false, } + // 触发星级任务 + this.moduleHero.ModuleTask.SendToTask(session.GetUserId(), comm.TaskTypeGetHero, &pb.TaskParam{First: hero.Star + 1}) // 保存数据 err1 := this.modifyHeroData(session.GetUserId(), hero.Id, _heroMap) if err1 != nil { diff --git a/modules/hero/module.go b/modules/hero/module.go index 2c3912acb..64738ba1f 100644 --- a/modules/hero/module.go +++ b/modules/hero/module.go @@ -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 { code = pb.ErrorCode_HeroNoExist return @@ -69,6 +69,12 @@ func (this *Hero) UpdateEquipment(hero *pb.DBHero, equip []*pb.DB_Equipment) (co return } this.modelHero.setEquipProperty(hero, equip) + + err1 := this.modelHero.PushHeroProperty(session, hero.Id) // 推送属性变化 + if err1 != nil { + code = pb.ErrorCode_Unknown + this.Errorf("PushHeroProperty err!") + } return } diff --git a/sys/configure/structs/game.drawComData.go b/sys/configure/structs/game.drawComData.go index 04b26d1bb..038eea745 100644 --- a/sys/configure/structs/game.drawComData.go +++ b/sys/configure/structs/game.drawComData.go @@ -12,7 +12,7 @@ import "errors" type Game_drawComData struct { Key string - Value string + Value int32 } 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) { _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.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 } diff --git a/sys/configure/structs/game.drawCostData.go b/sys/configure/structs/game.drawCostData.go index 962a039ce..6cf30b45f 100644 --- a/sys/configure/structs/game.drawCostData.go +++ b/sys/configure/structs/game.drawCostData.go @@ -14,6 +14,10 @@ type Game_drawCostData struct { Key int32 Count int32 Cost *Game_atn + Floor4 int32 + Floor5 int32 + Floor4cards int32 + Floor5cards int32 } 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["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 _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 }