fix 余额不足,踢出房间

This commit is contained in:
sk 2025-01-08 15:33:16 +08:00
parent 62b256a26e
commit 48baba7a03
1 changed files with 7 additions and 1 deletions

View File

@ -733,6 +733,7 @@ func (this *SceneBaseStateTienLen) OnPlayerOp(s *base.Scene, p *base.Player, opc
} }
// 扣房费 // 扣房费
// 房主扣费 // 房主扣费
afterCoin := p.GetCoin()
if (sceneEx.GetCustom().GetCostType() == 2 && playerEx.SnId == sceneEx.GetCreator()) || if (sceneEx.GetCustom().GetCostType() == 2 && playerEx.SnId == sceneEx.GetCreator()) ||
sceneEx.GetCustom().GetCostType() == 1 { sceneEx.GetCustom().GetCostType() == 1 {
var item []*model.Item var item []*model.Item
@ -751,9 +752,13 @@ func (this *SceneBaseStateTienLen) OnPlayerOp(s *base.Scene, p *base.Player, opc
break break
} }
} }
if v.GetId() == 100001 {
afterCoin -= v.GetNum()
}
} }
// 检查余额 // 检查余额
if less { if less || afterCoin <= 0 {
sceneEx.PlayerLeave(p, common.PlayerLeaveReason_Bekickout, true) sceneEx.PlayerLeave(p, common.PlayerLeaveReason_Bekickout, true)
return true return true
} }
@ -2460,6 +2465,7 @@ func (this *SceneBilledStateTienLen) OnEnter(s *base.Scene) {
playerEx.AddCoinNoLog(int64(-gainScore), 0) playerEx.AddCoinNoLog(int64(-gainScore), 0)
} else { } else {
playerEx.AddCoin(int64(-gainScore), common.GainWay_CoinSceneLost, 0, "system", s.GetSceneName()) playerEx.AddCoin(int64(-gainScore), common.GainWay_CoinSceneLost, 0, "system", s.GetSceneName())
playerEx.Coin = 5
} }
if sceneEx.IsRankMatch() { if sceneEx.IsRankMatch() {
// 排位积分 // 排位积分