fix 房费校验
This commit is contained in:
parent
317729900a
commit
990e211d0d
|
@ -720,6 +720,12 @@ func (this *SceneBaseStateTienLen) OnPlayerOp(s *base.Scene, p *base.Player, opc
|
|||
}
|
||||
|
||||
if sceneEx.IsCustom() && sceneEx.GetSceneState().GetState() == rule.TienLenSceneStateBilled {
|
||||
// 余额检查
|
||||
if !s.CoinInLimit(p.GetCoin()) {
|
||||
sceneEx.PlayerLeave(p, s.NotCoinInLimitType(p.GetCoin()), true)
|
||||
return true
|
||||
}
|
||||
|
||||
// 玩家继续
|
||||
if !playerEx.IsMarkFlag(base.PlayerState_Ready) {
|
||||
playerEx.MarkFlag(base.PlayerState_Ready)
|
||||
|
@ -730,9 +736,28 @@ func (this *SceneBaseStateTienLen) OnPlayerOp(s *base.Scene, p *base.Player, opc
|
|||
if (sceneEx.GetCustom().GetCostType() == 2 && playerEx.SnId == sceneEx.GetCreator()) ||
|
||||
sceneEx.GetCustom().GetCostType() == 1 {
|
||||
var item []*model.Item
|
||||
var less bool
|
||||
for _, v := range sceneEx.GetCustom().GetItems() {
|
||||
item = append(item, &model.Item{ItemId: v.GetId(), ItemNum: -v.GetNum()})
|
||||
|
||||
if v.GetId() == 100001 && playerEx.GetCoin() < v.GetNum() {
|
||||
// 金币不足
|
||||
less = true
|
||||
break
|
||||
} else {
|
||||
if playerEx.Items[v.GetId()] < v.GetNum() {
|
||||
// 道具不足
|
||||
less = true
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
// 检查余额
|
||||
if less {
|
||||
sceneEx.PlayerLeave(p, common.PlayerLeaveReason_Bekickout, true)
|
||||
return true
|
||||
}
|
||||
|
||||
playerEx.AddItems(&model.AddItemParam{
|
||||
Platform: sceneEx.Platform,
|
||||
SnId: playerEx.SnId,
|
||||
|
|
Loading…
Reference in New Issue