From c737007e20d663333708627bffba1412feaf63f5 Mon Sep 17 00:00:00 2001 From: sk <123456@qq.com> Date: Thu, 21 Nov 2024 11:38:06 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=88=BF=E5=8D=A1=E6=89=A3?= =?UTF-8?q?=E9=99=A4=E5=92=8C=E6=8B=9B=E5=8B=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- worldsrv/action_game.go | 6 ++--- worldsrv/scenemgr.go | 6 +++++ worldsrv/scenepolicydata.go | 52 +++++++++++++++++++++---------------- 3 files changed, 39 insertions(+), 25 deletions(-) diff --git a/worldsrv/action_game.go b/worldsrv/action_game.go index 483db78..c6c36a1 100644 --- a/worldsrv/action_game.go +++ b/worldsrv/action_game.go @@ -1347,9 +1347,9 @@ func CSCreatePrivateRoomHandler(s *netlib.Session, packetId int, data interface{ return nil } - if costType == 2 { - sp.CostPayment(scene, p.SnId) - } + //if costType == 2 { + // sp.CostPayment(scene, p.SnId) + //} code = gamehall.OpResultCode_Game_OPRC_Sucess_Game pack = &gamehall.SCCreatePrivateRoom{ diff --git a/worldsrv/scenemgr.go b/worldsrv/scenemgr.go index c104853..69b90ea 100644 --- a/worldsrv/scenemgr.go +++ b/worldsrv/scenemgr.go @@ -402,6 +402,12 @@ func (m *SceneMgr) FindCustomInviteRoom(p *Player) *Scene { if !PlatformMgrSingleton.CustomIsOn(p.Platform, v.CustomParam.GetRoomConfigId()) { continue } + // 系统房只剩一人才推荐 + if v.creator == 0 && v.RoomConfigSystem != nil { + if int(v.RoomConfigSystem.GetPlayerNum())-v.GetPlayerCnt() != 1 { + continue + } + } ret = append(ret, v) } diff --git a/worldsrv/scenepolicydata.go b/worldsrv/scenepolicydata.go index cf56e8a..b078faa 100644 --- a/worldsrv/scenepolicydata.go +++ b/worldsrv/scenepolicydata.go @@ -39,10 +39,10 @@ func (spd *ScenePolicyData) OnStart(s *Scene) { func (spd *ScenePolicyData) OnStop(s *Scene) { s.NotifyPrivateRoom(common.ListDel) - // 房主付费,房间没有玩就解散了,返还房主建房费用 - if s.IsCustom() && s.CustomParam.GetCostType() == 2 && s.currRound == 0 { - s.sp.GiveCostPayment(s, s.creator) - } + //// 房主付费,房间没有玩就解散了,返还房主建房费用 + //if s.IsCustom() && s.CustomParam.GetCostType() == 2 && s.currRound == 0 { + // s.sp.GiveCostPayment(s, s.creator) + //} // 系统房间解散后自动创建 if s.RoomConfigSystem != nil { CustomRoomMgrSingle.Release(s.platform.IdStr, s.RoomConfigSystem.GetId()) @@ -56,6 +56,14 @@ func (spd *ScenePolicyData) OnTick(s *Scene) { func (spd *ScenePolicyData) OnPlayerEnter(s *Scene, snid int32) { s.NotifyPrivateRoom(common.ListModify) + if s.IsCustom() { + if s.CustomParam.GetCostType() == 1 { // AA + spd.CostPayment(s, snid) + } + if s.CustomParam.GetCostType() == 2 && snid == s.creator { // 房主付费 + spd.CostPayment(s, s.creator) + } + } } func (spd *ScenePolicyData) OnPlayerLeave(s *Scene, snid int32) { @@ -71,21 +79,21 @@ func (spd *ScenePolicyData) OnSceneState(s *Scene, state int) { case common.SceneStateStart: s.NotifyPrivateRoom(common.ListModify) if s.IsCustom() { - if s.CustomParam.GetCostType() == 1 { - for _, v := range s.players { - spd.CostPayment(s, v.SnId) - } - } - if s.CustomParam.GetCostType() == 2 { // 房主付费 - n := 0 - cfg := PlatformMgrSingleton.GetConfig(s.platform.IdStr).RoomConfig[s.CustomParam.GetRoomConfigId()] - for _, v := range cfg.GetCost() { - if v != nil && v.GetItemId() == common.ItemIDRoomCard { - n += int(v.GetItemNum()) - } - } - LotteryMgrInst.AddCostRoomCard(s.platform.IdStr, s.creator, int64(n)) - } + //if s.CustomParam.GetCostType() == 1 { + // for _, v := range s.players { + // spd.CostPayment(s, v.SnId) + // } + //} + //if s.CustomParam.GetCostType() == 2 { // 房主付费 + // n := 0 + // cfg := PlatformMgrSingleton.GetConfig(s.platform.IdStr).RoomConfig[s.CustomParam.GetRoomConfigId()] + // for _, v := range cfg.GetCost() { + // if v != nil && v.GetItemId() == common.ItemIDRoomCard { + // n += int(v.GetItemNum()) + // } + // } + // LotteryMgrInst.AddCostRoomCard(s.platform.IdStr, s.creator, int64(n)) + //} s.IsRecruit = false s.RecruitTimes = 0 } @@ -176,9 +184,9 @@ func (spd *ScenePolicyData) CostPayment(s *Scene, snid int32) bool { GameFreeId: int64(s.dbGameFree.GetId()), RoomConfigId: roomConfig.GetId(), }) - if s.CustomParam.GetCostType() == 1 { // AA 是在游戏开始后扣的 - LotteryMgrInst.AddCostRoomCard(p.Platform, p.SnId, int64(n)) - } + //if s.CustomParam.GetCostType() == 1 { // AA 是在游戏开始后扣的 + LotteryMgrInst.AddCostRoomCard(p.Platform, p.SnId, int64(n)) + //} }) }