diff --git a/modules/entertainment/configure.go b/modules/entertainment/configure.go index dd14166e4..9ac4ce961 100644 --- a/modules/entertainment/configure.go +++ b/modules/entertainment/configure.go @@ -22,6 +22,7 @@ const ( game_passcheck = "game_passcheck.json" game_consumetask = "game_consumetask.json" consume_rank = "game_consumerank.json" + game_consumetxt = "game_consumetxt.json" ) // /配置管理组件 @@ -48,6 +49,7 @@ func (this *configureComp) Init(service core.IService, module core.IModule, comp game_playerskill: cfg.NewGamePlayerSkill, game_consumetask: cfg.NewGameConsumeTask, consume_rank: cfg.NewGameConsumeRank, + game_consumetxt: cfg.NewGameConsumeTxt, }) configure.RegisterConfigure(game_block, cfg.NewGameBlock, this.LoadGameBlock) configure.RegisterConfigure(game_passcheck, cfg.NewGamePassCheck, this.updatePassCheck) @@ -410,3 +412,18 @@ func (this *configureComp) getRankReward() (result *cfg.GameConsumeRank, err err err = comm.NewNotFoundConfErr(moduleName, consume_rank, nil) return } + +func (this *configureComp) getLianShengReward() (result []*cfg.GameConsumeTxtData, err error) { + var ( + v interface{} + ) + if v, err = this.GetConfigure(game_consumetxt); err == nil { + if c, ok := v.(*cfg.GameConsumeTxt); ok { + if result = c.GetDataList(); len(result) > 0 { + return + } + } + } + err = comm.NewNotFoundConfErr(moduleName, game_consumetxt, nil) + return +} diff --git a/modules/entertainment/room.go b/modules/entertainment/room.go index 04ebf0c4e..8e19d3eee 100644 --- a/modules/entertainment/room.go +++ b/modules/entertainment/room.go @@ -505,10 +505,11 @@ func (this *Room) GameOver(winner *pb.PlayerData) (errdata *pb.ErrorData) { return } if conf, err := this.module.configure.GetGameConsumeintegral(list.Consumeexp); err == nil { + pro := this.LianShengAdd(list.Liansheng) // 连胜加成 for _, v := range conf.Rewards { if v.A == "attr" && v.T == "consumeexp" { - list.Consumeexp += v.N - winScore = v.N + list.Consumeexp += int32(v.N*pro) / 1000 + winScore = int32(v.N*pro) / 1000 update["consumeexp"] = list.Consumeexp winner.Consumeexp = list.Consumeexp if list.Consumeexp > list.Maxconsumeexp { // 写最高积分 @@ -740,6 +741,29 @@ func (this *Room) JoinRoom(module *Entertainment, p *pb.PlayerData) (room *Room, return } +func (this *Room) LianShengAdd(liansheng int32) (permillage int32) { + var ( + result []*cfg.GameConsumeTxtData + err error + ) + if result, err = this.module.configure.getLianShengReward(); err == nil { + for pos, v := range result { + if len(result) > pos+1 { + if result[pos+1].Winningstreak >= liansheng { // 下一等级小于当前值 + permillage = result[pos].Rewarddata + return + } + } else { + permillage = v.Rewarddata + } + } + } + if permillage == 0 { + permillage = 1 + } + return +} + // 修改玩家的房间信息 func (this *Room) ModifyUserRoomInfoData() { var (