add 竞技馆房间入场限制
This commit is contained in:
parent
f5475e8a7c
commit
fcfe862f99
|
|
@ -763,7 +763,7 @@ func (this *SceneBaseStateTienLen) OnPlayerOp(s *base.Scene, p *base.Player, opc
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 检查余额
|
// 检查余额
|
||||||
if less || afterCoin < int64(sceneEx.GetBaseScore()) {
|
if less || afterCoin < int64(sceneEx.GetBaseScore()) || afterCoin < sceneEx.GetCustom().GetLimitCoin() {
|
||||||
sceneEx.PlayerLeave(p, common.PlayerLeaveReason_Bekickout, true)
|
sceneEx.PlayerLeave(p, common.PlayerLeaveReason_Bekickout, true)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -108,8 +108,9 @@ func (this *CSEnterRoomHandler) Process(s *netlib.Session, packetid int, data in
|
||||||
if scene.IsCustom() {
|
if scene.IsCustom() {
|
||||||
cfg := PlatformMgrSingleton.GetConfig(p.Platform).RoomConfig[scene.CustomParam.RoomConfigId]
|
cfg := PlatformMgrSingleton.GetConfig(p.Platform).RoomConfig[scene.CustomParam.RoomConfigId]
|
||||||
|
|
||||||
|
limitCoin := int64(0)
|
||||||
if len(cfg.GetLimitCoin()) > 0 {
|
if len(cfg.GetLimitCoin()) > 0 {
|
||||||
limitCoin := cfg.GetLimitCoin()[slices.Index(cfg.GetBaseScore(), scene.BaseScore)]
|
limitCoin = cfg.GetLimitCoin()[slices.Index(cfg.GetBaseScore(), scene.BaseScore)]
|
||||||
if limitCoin > 0 && p.GetCoin() < limitCoin {
|
if limitCoin > 0 && p.GetCoin() < limitCoin {
|
||||||
code = gamehall.OpResultCode_Game_OPRC_CoinNotEnough_Game
|
code = gamehall.OpResultCode_Game_OPRC_CoinNotEnough_Game
|
||||||
goto failed
|
goto failed
|
||||||
|
|
@ -129,7 +130,7 @@ func (this *CSEnterRoomHandler) Process(s *netlib.Session, packetid int, data in
|
||||||
afterCoin -= v.GetNum()
|
afterCoin -= v.GetNum()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if afterCoin <= 0 || (scene.dbGameFree.GetLimitCoin() > 0 && afterCoin < scene.dbGameFree.GetLimitCoin()) {
|
if afterCoin <= 0 || (scene.dbGameFree.GetLimitCoin() > 0 && afterCoin < scene.dbGameFree.GetLimitCoin()) || (limitCoin > 0 && afterCoin < limitCoin) {
|
||||||
code = gamehall.OpResultCode_Game_OPRC_CoinNotEnough_Game
|
code = gamehall.OpResultCode_Game_OPRC_CoinNotEnough_Game
|
||||||
logger.Logger.Trace("CSEnterRoomHandler cost after coin too little error")
|
logger.Logger.Trace("CSEnterRoomHandler cost after coin too little error")
|
||||||
goto failed
|
goto failed
|
||||||
|
|
@ -1376,7 +1377,7 @@ func CSCreatePrivateRoomHandler(s *netlib.Session, packetId int, data interface{
|
||||||
// 创建房间
|
// 创建房间
|
||||||
csp := CoinSceneMgrSingleton.GetCoinScenePool(p.GetPlatform().IdStr, msg.GetGameFreeId())
|
csp := CoinSceneMgrSingleton.GetCoinScenePool(p.GetPlatform().IdStr, msg.GetGameFreeId())
|
||||||
|
|
||||||
if afterCoin <= 0 || (csp.dbGameFree.GetLimitCoin() > 0 && afterCoin < csp.dbGameFree.GetLimitCoin()) {
|
if afterCoin <= 0 || (csp.dbGameFree.GetLimitCoin() > 0 && afterCoin < csp.dbGameFree.GetLimitCoin()) || (limitCoin > 0 && afterCoin < limitCoin) {
|
||||||
code = gamehall.OpResultCode_Game_OPRC_CoinNotEnough_Game
|
code = gamehall.OpResultCode_Game_OPRC_CoinNotEnough_Game
|
||||||
send()
|
send()
|
||||||
return nil
|
return nil
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue