From 9177d20d5e53979858b1267cae8b38c6b6b2e891 Mon Sep 17 00:00:00 2001 From: sk <123456@qq.com> Date: Wed, 29 May 2024 09:17:14 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=A9=BA=E6=8C=87=E9=92=88?= =?UTF-8?q?=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gamesrv/tienlen/scenedata_tienlen.go | 163 ++++++++++++++------------- worldsrv/action_welfare.go | 4 +- 2 files changed, 84 insertions(+), 83 deletions(-) diff --git a/gamesrv/tienlen/scenedata_tienlen.go b/gamesrv/tienlen/scenedata_tienlen.go index 3b4cb8e..59ffaae 100644 --- a/gamesrv/tienlen/scenedata_tienlen.go +++ b/gamesrv/tienlen/scenedata_tienlen.go @@ -1106,88 +1106,89 @@ func (this *TienLenSceneData) SendHandCardOdds() { // 前两局不能天胡,之后根据概率给一次天胡,至少天胡一次 noviceTianHu := false noviceCtrl := false - config := srvdata.PBDB_NewPlayerMgr.GetData(int32(this.GameId)) - if config != nil && config.GetTianHuRate() > 0 && len(this.testPokers) == 0 { // 启用新手天胡体验 - rand.Shuffle(len(novicePlayers), func(i, j int) { - novicePlayers[i], novicePlayers[j] = novicePlayers[j], novicePlayers[i] - }) - keyNovice := common.GetKeyNoviceGameId(this.GameId) - for _, v := range novicePlayers { - data, ok := v.GDatas[keyNovice] - if !ok { - data = &model.PlayerGameInfo{FirstTime: time.Now()} - v.GDatas[keyNovice] = data - } - // 前两局不能天胡 - if data.Statics.GameTimes < 2 { - continue - } - if int(config.GetTianHuRate()) > this.RandInt(1000) { - var allcs []int32 - for i := 0; i < 52; i++ { - allcs = append(allcs, int32(i)) - } - rand.Shuffle(len(allcs), func(i, j int) { - allcs[i], allcs[j] = allcs[j], allcs[i] - }) - cs, _ := rule.GetTianHu() - allcs = common.DelSliceIn32s(allcs, cs) - for _, seat := range this.seats { - if seat != nil && seat.IsGameing() { - if seat != v { - f1(seat, allcs[:13]) - allcs = allcs[13:] - } else { - f1(seat, cs) - } - } - } - v.TestLog = append(v.TestLog, fmt.Sprintf("新手天胡体验,玩家:%d 发天胡 num:%v", v.SnId, data.Statics.GameTimes)) - logger.Logger.Tracef("新手天胡体验,玩家:%d 发天胡", v.SnId) - noviceTianHu = true - noviceCtrl = true - } - } - if !noviceTianHu { - // 没有新手玩家天胡,随机一个非新手玩家,如果没有天胡过,给一次天胡 - rand.Shuffle(len(notNoviceRealPlayers), func(i, j int) { - notNoviceRealPlayers[i], notNoviceRealPlayers[j] = notNoviceRealPlayers[j], notNoviceRealPlayers[i] - }) - for _, v := range notNoviceRealPlayers { - data, ok := v.GDatas[keyNovice] - if !ok { - data = &model.PlayerGameInfo{FirstTime: time.Now()} - v.GDatas[keyNovice] = data - } - - if data.Statics.GetInt(rule.StaticsTianHuTimes) == 0 { - var allcs []int32 - for i := 0; i < 52; i++ { - allcs = append(allcs, int32(i)) - } - rand.Shuffle(len(allcs), func(i, j int) { - allcs[i], allcs[j] = allcs[j], allcs[i] - }) - cs, _ := rule.GetTianHu() - allcs = common.DelSliceIn32s(allcs, cs) - for _, seat := range this.seats { - if seat != nil && seat.IsGameing() { - if seat != v { - f1(seat, allcs[:13]) - allcs = allcs[13:] - } else { - f1(seat, cs) - } - } - } - v.TestLog = append(v.TestLog, fmt.Sprintf("新手阶段没有天胡过,玩家:%d 发天胡 num:%v", v.SnId, data.Statics.GameTimes)) - logger.Logger.Tracef("新手阶段没有天胡过,玩家:%v 发天胡", v.SnId) - noviceCtrl = true - } - } - } - } + //config := srvdata.PBDB_NewPlayerMgr.GetData(int32(this.GameId)) + //if config != nil && config.GetTianHuRate() > 0 && len(this.testPokers) == 0 { // 启用新手天胡体验 + // rand.Shuffle(len(novicePlayers), func(i, j int) { + // novicePlayers[i], novicePlayers[j] = novicePlayers[j], novicePlayers[i] + // }) + // keyNovice := common.GetKeyNoviceGameId(this.GameId) + // for _, v := range novicePlayers { + // data, ok := v.GDatas[keyNovice] + // if !ok { + // data = &model.PlayerGameInfo{FirstTime: time.Now()} + // v.GDatas[keyNovice] = data + // } + // // 前两局不能天胡 + // if data.Statics.GameTimes < 2 { + // continue + // } + // if int(config.GetTianHuRate()) > this.RandInt(1000) { + // var allcs []int32 + // for i := 0; i < 52; i++ { + // allcs = append(allcs, int32(i)) + // } + // rand.Shuffle(len(allcs), func(i, j int) { + // allcs[i], allcs[j] = allcs[j], allcs[i] + // }) + // cs, _ := rule.GetTianHu() + // allcs = common.DelSliceIn32s(allcs, cs) + // for _, seat := range this.seats { + // if seat != nil && seat.IsGameing() { + // if seat != v { + // f1(seat, allcs[:13]) + // allcs = allcs[13:] + // } else { + // f1(seat, cs) + // } + // } + // } + // v.TestLog = append(v.TestLog, fmt.Sprintf("新手天胡体验,玩家:%d 发天胡 num:%v", v.SnId, data.Statics.GameTimes)) + // logger.Logger.Tracef("新手天胡体验,玩家:%d 发天胡", v.SnId) + // noviceTianHu = true + // noviceCtrl = true + // } + // } + // if !noviceTianHu { + // // 没有新手玩家天胡,随机一个非新手玩家,如果没有天胡过,给一次天胡 + // rand.Shuffle(len(notNoviceRealPlayers), func(i, j int) { + // notNoviceRealPlayers[i], notNoviceRealPlayers[j] = notNoviceRealPlayers[j], notNoviceRealPlayers[i] + // }) + // for _, v := range notNoviceRealPlayers { + // data, ok := v.GDatas[keyNovice] + // if !ok { + // data = &model.PlayerGameInfo{FirstTime: time.Now()} + // v.GDatas[keyNovice] = data + // } + // + // if data.Statics.GetInt(rule.StaticsTianHuTimes) == 0 { + // var allcs []int32 + // for i := 0; i < 52; i++ { + // allcs = append(allcs, int32(i)) + // } + // rand.Shuffle(len(allcs), func(i, j int) { + // allcs[i], allcs[j] = allcs[j], allcs[i] + // }) + // cs, _ := rule.GetTianHu() + // allcs = common.DelSliceIn32s(allcs, cs) + // for _, seat := range this.seats { + // if seat != nil && seat.IsGameing() { + // if seat != v { + // f1(seat, allcs[:13]) + // allcs = allcs[13:] + // } else { + // f1(seat, cs) + // } + // } + // } + // v.TestLog = append(v.TestLog, fmt.Sprintf("新手阶段没有天胡过,玩家:%d 发天胡 num:%v", v.SnId, data.Statics.GameTimes)) + // logger.Logger.Tracef("新手阶段没有天胡过,玩家:%v 发天胡", v.SnId) + // noviceCtrl = true + // } + // } + // } + //} + // 全局配置 gameConfig := base.ConfigMgrInst.GetConfig(this.Platform).GameConfig // testPokers 用于测试 diff --git a/worldsrv/action_welfare.go b/worldsrv/action_welfare.go index a9dcdf0..b01042a 100644 --- a/worldsrv/action_welfare.go +++ b/worldsrv/action_welfare.go @@ -454,7 +454,7 @@ func (this *CSPigBankGetInfoHandler) Process(s *netlib.Session, packetid int, da if _, ok := data.(*welfare.CSPigbankGetInfo); ok { p := PlayerMgrSington.GetPlayer(sid) if p == nil { - logger.Logger.Warnf("CSPigBankGetInfoHandler p == nil p.SnId = %v", p.SnId) + logger.Logger.Warnf("CSPigBankGetInfoHandler p == nil") return nil } WelfareMgrSington.PigbankGetInfo(p) @@ -479,7 +479,7 @@ func (this *CSPigBankTakeCoinHandler) Process(s *netlib.Session, packetid int, d if _, ok := data.(*welfare.CSPigbankTakeCoin); ok { p := PlayerMgrSington.GetPlayer(sid) if p == nil { - logger.Logger.Warnf("CSPigBankTakeCoinHandler p == nil p.SnId = %v", p.SnId) + logger.Logger.Warnf("CSPigBankTakeCoinHandler p == nil") return nil } WelfareMgrSington.PigbankTakeCoin(p)