modify 踢出房间规则
This commit is contained in:
parent
aabdd36720
commit
cfed6154bc
|
@ -164,7 +164,7 @@ func (this *CSPlayerSwitchFlagHandler) Process(s *netlib.Session, packetid int,
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
flag := int(msg.GetFlag())
|
flag := int(msg.GetFlag())
|
||||||
logger.Logger.Trace("CSPlayerSwitchFlagHandler Process recv SnId(%v) Mark is %v", p.SnId, msg.GetMark())
|
logger.Logger.Tracef("CSPlayerSwitchFlagHandler Process recv SnId(%v) Mark is %v", p.SnId, msg.GetMark())
|
||||||
if msg.GetMark() == 0 { //0取消状态 1设置状态
|
if msg.GetMark() == 0 { //0取消状态 1设置状态
|
||||||
oldFlag := p.GetFlag()
|
oldFlag := p.GetFlag()
|
||||||
if p.IsMarkFlag(flag) {
|
if p.IsMarkFlag(flag) {
|
||||||
|
|
|
@ -2,6 +2,7 @@ package tienlen
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"math/rand"
|
"math/rand"
|
||||||
|
"mongo.games.com/goserver/core/timer"
|
||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
@ -30,6 +31,7 @@ type TienLenPlayerData struct {
|
||||||
isNotOverLastHand bool //手牌不能压过上家出牌标志
|
isNotOverLastHand bool //手牌不能压过上家出牌标志
|
||||||
cardScore int // 手牌评分
|
cardScore int // 手牌评分
|
||||||
playerPool int // 个人水池分
|
playerPool int // 个人水池分
|
||||||
|
handlId timer.TimerHandle
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *TienLenPlayerData) init() {
|
func (this *TienLenPlayerData) init() {
|
||||||
|
|
|
@ -10,6 +10,7 @@ import (
|
||||||
|
|
||||||
"mongo.games.com/goserver/core"
|
"mongo.games.com/goserver/core"
|
||||||
"mongo.games.com/goserver/core/logger"
|
"mongo.games.com/goserver/core/logger"
|
||||||
|
"mongo.games.com/goserver/core/timer"
|
||||||
|
|
||||||
"mongo.games.com/game/common"
|
"mongo.games.com/game/common"
|
||||||
rule "mongo.games.com/game/gamerule/tienlen"
|
rule "mongo.games.com/game/gamerule/tienlen"
|
||||||
|
@ -166,7 +167,27 @@ func (this *ScenePolicyTienLen) OnPlayerDropLine(s *base.Scene, p *base.Player)
|
||||||
p.MarkFlag(base.PlayerState_Auto)
|
p.MarkFlag(base.PlayerState_Auto)
|
||||||
p.SyncFlag()
|
p.SyncFlag()
|
||||||
} else {
|
} else {
|
||||||
s.PlayerLeave(p, common.PlayerLeaveReason_DropLine, true)
|
if sceneEx.IsCustom() {
|
||||||
|
// 如果是等待状态,付费且准备的玩家不踢出,付费没有准备的延迟踢出,未付费的直接踢出
|
||||||
|
switch sceneEx.GetSceneState().GetState() {
|
||||||
|
case rule.TienLenSceneStateWaitPlayer:
|
||||||
|
playerEx, ok := p.GetExtraData().(*TienLenPlayerData)
|
||||||
|
if !ok || playerEx == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if s.GetCustom().GetCostType() == 2 && playerEx.GetSnId() != s.GetCreator() {
|
||||||
|
s.PlayerLeave(p, common.PlayerLeaveReason_DropLine, true)
|
||||||
|
} else if !playerEx.IsMarkFlag(base.PlayerState_Ready) {
|
||||||
|
playerEx.handlId, _ = timer.AfterTimer(func(h timer.TimerHandle, ud interface{}) bool {
|
||||||
|
s.PlayerLeave(p, common.PlayerLeaveReason_DropLine, true)
|
||||||
|
return true
|
||||||
|
}, nil, time.Minute)
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
s.PlayerLeave(p, common.PlayerLeaveReason_DropLine, true)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
s.FirePlayerEvent(p, base.PlayerEventDropLine, nil)
|
s.FirePlayerEvent(p, base.PlayerEventDropLine, nil)
|
||||||
|
@ -185,6 +206,14 @@ func (this *ScenePolicyTienLen) OnPlayerRehold(s *base.Scene, p *base.Player) {
|
||||||
p.SyncFlag()
|
p.SyncFlag()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 停止定时器
|
||||||
|
if playerEx, ok := p.GetExtraData().(*TienLenPlayerData); ok {
|
||||||
|
if playerEx.handlId > 0 {
|
||||||
|
timer.StopTimer(playerEx.handlId)
|
||||||
|
playerEx.handlId = 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//发送房间信息给自己
|
//发送房间信息给自己
|
||||||
TienLenSendRoomInfo(s, p, sceneEx)
|
TienLenSendRoomInfo(s, p, sceneEx)
|
||||||
s.FirePlayerEvent(p, base.PlayerEventRehold, nil)
|
s.FirePlayerEvent(p, base.PlayerEventRehold, nil)
|
||||||
|
@ -596,11 +625,6 @@ func (this *SceneBaseStateTienLen) CanChangeTo(s base.SceneState) bool {
|
||||||
|
|
||||||
// 当前状态能否换桌
|
// 当前状态能否换桌
|
||||||
func (this *SceneBaseStateTienLen) CanChangeCoinScene(s *base.Scene, p *base.Player) bool {
|
func (this *SceneBaseStateTienLen) CanChangeCoinScene(s *base.Scene, p *base.Player) bool {
|
||||||
if s.IsCustom() {
|
|
||||||
if s.NumOfGames > 0 && s.NumOfGames < int(s.TotalOfGames) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return !p.IsGameing() || s.GetDestroyed() || !s.GetGaming()
|
return !p.IsGameing() || s.GetDestroyed() || !s.GetGaming()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -869,7 +893,7 @@ func (this *SceneWaitStartStateTienLen) CanChangeTo(s base.SceneState) bool {
|
||||||
|
|
||||||
// 当前状态能否换桌
|
// 当前状态能否换桌
|
||||||
func (this *SceneWaitStartStateTienLen) CanChangeCoinScene(s *base.Scene, p *base.Player) bool {
|
func (this *SceneWaitStartStateTienLen) CanChangeCoinScene(s *base.Scene, p *base.Player) bool {
|
||||||
if s.IsMatchScene() || (s.IsCustom() && s.GetNumOfGames() > 0) {
|
if s.IsMatchScene() {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
|
|
Loading…
Reference in New Issue