修改房卡扣除和招募

This commit is contained in:
sk 2024-11-21 11:38:06 +08:00
parent a9ffcb1c4a
commit c737007e20
3 changed files with 39 additions and 25 deletions

View File

@ -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{

View File

@ -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)
}

View File

@ -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))
//}
})
}