fix:个人水池全局配置读取失败
This commit is contained in:
parent
3d653d6413
commit
65aa4efebb
|
@ -1,45 +0,0 @@
|
||||||
package base
|
|
||||||
|
|
||||||
import (
|
|
||||||
"mongo.games.com/game/protocol/webapi"
|
|
||||||
"mongo.games.com/goserver/core/logger"
|
|
||||||
)
|
|
||||||
|
|
||||||
var PlatformConfigSingleton = &PlatformConfigMgr{
|
|
||||||
Platforms: make(map[string]*PlatformConfig),
|
|
||||||
}
|
|
||||||
|
|
||||||
type PlatformConfig struct {
|
|
||||||
PlayerPool *webapi.PlayerPool
|
|
||||||
GameConfig *webapi.GameConfig
|
|
||||||
}
|
|
||||||
|
|
||||||
type PlatformConfigMgr struct {
|
|
||||||
Platforms map[string]*PlatformConfig //key 是平台标记
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *PlatformConfigMgr) Get(plt string) *PlatformConfig {
|
|
||||||
ret, ok := this.Platforms[plt]
|
|
||||||
if !ok {
|
|
||||||
ret = new(PlatformConfig)
|
|
||||||
this.Platforms[plt] = ret
|
|
||||||
}
|
|
||||||
return ret
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *PlatformConfigMgr) Update(config any) {
|
|
||||||
if config == nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := config.(type) {
|
|
||||||
case *webapi.PlayerPool:
|
|
||||||
this.Get(v.GetPlatform()).PlayerPool = v
|
|
||||||
|
|
||||||
case *webapi.GameConfig:
|
|
||||||
this.Get(v.GetPlatform()).GameConfig = v
|
|
||||||
|
|
||||||
default:
|
|
||||||
logger.Logger.Error("Update config type error")
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -2436,7 +2436,7 @@ func (this *Scene) GetBaseScore() int32 {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *Scene) PlayerPoolOdds(p *Player) int32 {
|
func (this *Scene) PlayerPoolOdds(p *Player) int32 {
|
||||||
config := PlatformConfigSingleton.Get(p.Platform).PlayerPool
|
config := ConfigMgrInst.GetAllConfig(p.Platform).PlayerPool
|
||||||
if config == nil {
|
if config == nil {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
@ -2490,7 +2490,7 @@ func (this *Scene) GetPlayerOdds(p *Player, gameId int, hasRobot bool) int32 {
|
||||||
// 场次水池概率
|
// 场次水池概率
|
||||||
f = CoinPoolMgr.GetCoinPoolOdds(this.Platform, this.GetGameFreeId(), this.GroupId)
|
f = CoinPoolMgr.GetCoinPoolOdds(this.Platform, this.GetGameFreeId(), this.GroupId)
|
||||||
|
|
||||||
cfg := PlatformConfigSingleton.Get(p.Platform).PlayerPool
|
cfg := ConfigMgrInst.GetAllConfig(p.Platform).PlayerPool
|
||||||
if cfg != nil && cfg.PlayerPoolSwitch {
|
if cfg != nil && cfg.PlayerPoolSwitch {
|
||||||
if g > 0 {
|
if g > 0 {
|
||||||
t = f + (1000-f)*g/1000
|
t = f + (1000-f)*g/1000
|
||||||
|
@ -2707,7 +2707,7 @@ func (this *Scene) Statistics(param *StaticParam) {
|
||||||
|
|
||||||
// 个人输赢统计条件(个人水池)
|
// 个人输赢统计条件(个人水池)
|
||||||
// 黑白名单和新手调控,溢出金币统计到个人水池
|
// 黑白名单和新手调控,溢出金币统计到个人水池
|
||||||
cfg := PlatformConfigSingleton.Get(p.Platform).PlayerPool
|
cfg := ConfigMgrInst.GetAllConfig(p.Platform).PlayerPool
|
||||||
isPlayerPool := cfg != nil && cfg.PlayerPoolSwitch && isControl && ((wbLevel == 0 && !isNovice) || addGain > 0)
|
isPlayerPool := cfg != nil && cfg.PlayerPoolSwitch && isControl && ((wbLevel == 0 && !isNovice) || addGain > 0)
|
||||||
if isPlayerPool {
|
if isPlayerPool {
|
||||||
keyGameType := common.GetKeyGameType(int(this.GetDBGameFree().GetGameType()))
|
keyGameType := common.GetKeyGameType(int(this.GetDBGameFree().GetGameType()))
|
||||||
|
|
|
@ -1184,7 +1184,7 @@ func (this *TienLenSceneData) SendHandCardOdds() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gameConfig := base.PlatformConfigSingleton.Get(this.Platform).GameConfig
|
gameConfig := base.ConfigMgrInst.GetAllConfig(this.Platform).GameConfig
|
||||||
|
|
||||||
// testPokers 用于测试
|
// testPokers 用于测试
|
||||||
isTestPoker := false
|
isTestPoker := false
|
||||||
|
@ -1228,7 +1228,7 @@ func (this *TienLenSceneData) SendHandCardOdds() {
|
||||||
logger.Logger.Tracef("TienLen SendHandCardOdds Good:%v G:%v Bad:%v B:%v", isGood, G, isBad, B)
|
logger.Logger.Tracef("TienLen SendHandCardOdds Good:%v G:%v Bad:%v B:%v", isGood, G, isBad, B)
|
||||||
|
|
||||||
if isBad && !isTestPoker && len(robotPlayers) > 0 && !noviceCtrl && !noviceTianHu {
|
if isBad && !isTestPoker && len(robotPlayers) > 0 && !noviceCtrl && !noviceTianHu {
|
||||||
gf := base.PlatformConfigSingleton.Get(this.Platform).GameConfig
|
gf := base.ConfigMgrInst.GetAllConfig(this.Platform).GameConfig
|
||||||
items := []int32{gf.GetTianHu(), gf.GetPaiKu(), gf.GetFenCha()}
|
items := []int32{gf.GetTianHu(), gf.GetPaiKu(), gf.GetFenCha()}
|
||||||
score := this.RandInt(int(gf.GetTianHu() + gf.GetPaiKu() + gf.GetFenCha()))
|
score := this.RandInt(int(gf.GetTianHu() + gf.GetPaiKu() + gf.GetFenCha()))
|
||||||
sum := int32(0)
|
sum := int32(0)
|
||||||
|
|
Loading…
Reference in New Issue