game_sync/worldsrv/action_game.go

1258 lines
39 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package main
import (
"fmt"
"math/rand"
"time"
"mongo.games.com/goserver/core/basic"
"mongo.games.com/goserver/core/logger"
"mongo.games.com/goserver/core/netlib"
"mongo.games.com/goserver/core/task"
"mongo.games.com/game/common"
"mongo.games.com/game/model"
"mongo.games.com/game/proto"
"mongo.games.com/game/protocol/gamehall"
"mongo.games.com/game/protocol/server"
webapiproto "mongo.games.com/game/protocol/webapi"
"mongo.games.com/game/srvdata"
)
type CSEnterRoomPacketFactory struct {
}
type CSEnterRoomHandler struct {
}
func (this *CSEnterRoomPacketFactory) CreatePacket() interface{} {
pack := &gamehall.CSEnterRoom{}
return pack
}
func (this *CSEnterRoomHandler) Process(s *netlib.Session, packetid int, data interface{}, sid int64) error {
logger.Logger.Trace("CSEnterRoomHandler Process recv ", data)
msg, ok := data.(*gamehall.CSEnterRoom)
if !ok {
return nil
}
p := PlayerMgrSington.GetPlayer(sid)
if p == nil {
return nil
}
var code = gamehall.OpResultCode_Game_OPRC_Sucess_Game
var sp ScenePolicy
var dbGameFree *server.DB_GameFree
var roomId int
var gameId int
var gameMode int
var cfg *webapiproto.GameFree
oldPlatform := p.Platform
// 进入原来的房间
scene := p.scene
if scene != nil {
code = gamehall.OpResultCode_Game_OPRC_GameStarting_Game
roomId = scene.sceneId
gameId = scene.gameId
gameMode = scene.gameMode
logger.Logger.Tracef("CSEnterRoomHandler had scene(%d)", scene.sceneId)
goto failed
}
// 房间查询
scene = SceneMgrSingleton.GetScene(int(msg.GetRoomId()))
if scene == nil {
code = gamehall.OpResultCode_Game_OPRC_RoomNotExist_Game
logger.Logger.Trace("CSEnterRoomHandler scene == nil")
goto failed
}
gameId = scene.gameId
gameMode = scene.gameMode
roomId = scene.sceneId
if p.IsRob {
p.Platform = scene.limitPlatform.IdStr
}
cfg = PlatformMgrSingleton.GetGameFree(p.Platform, scene.dbGameFree.Id)
if cfg != nil && (cfg.GroupId != scene.groupId || cfg.GroupId == 0) {
if scene.limitPlatform != nil {
if scene.limitPlatform.Isolated && p.Platform != scene.limitPlatform.IdStr {
code = gamehall.OpResultCode_Game_OPRC_RoomNotExist_Game
logger.Logger.Tracef("CSEnterRoomHandler ScenePolicy(gameid:%v mode:%v) scene.limitPlatform.Isolated && p.Platform != scene.limitPlatform.Name", scene.gameId, scene.gameMode)
goto failed
}
}
}
if scene.deleting {
code = gamehall.OpResultCode_Game_OPRC_RoomNotExist_Game
logger.Logger.Trace("CSEnterRoomHandler scene is deleting")
goto failed
}
if scene.closed {
code = gamehall.OpResultCode_Game_OPRC_RoomHadClosed_Game
logger.Logger.Trace("CSEnterRoomHandler scene is closed")
goto failed
}
dbGameFree = scene.dbGameFree
if dbGameFree != nil {
if common.IsLocalGame(scene.gameId) {
if !p.IsRob {
limitCoin := srvdata.CreateRoomMgrSington.GetLimitCoinByBaseScore(int32(scene.gameId), int32(scene.gameSite), scene.BaseScore)
if p.Coin < limitCoin {
code = gamehall.OpResultCode_Game_OPRC_CoinNotEnough_Game
logger.Logger.Trace("CSEnterRoomHandler scene is closed")
goto failed
}
}
}
}
//检测房间状态是否开启
if !scene.IsMatchScene() && !PlatformMgrSingleton.CheckGameState(scene.limitPlatform.IdStr, dbGameFree.Id) {
code = gamehall.OpResultCode_Game_OPRC_GameHadClosed
logger.Logger.Tracef("CSEnterRoomHandler SnId:%v GameFreeId:%v GameHadClosed", p.SnId, dbGameFree.Id)
goto failed
}
sp = GetScenePolicy(scene.gameId, scene.gameMode)
if sp == nil {
code = gamehall.OpResultCode_Game_OPRC_GameNotExist_Game
logger.Logger.Tracef("CSEnterRoomHandler ScenePolicy(gameid:%v mode:%v) not registe", scene.gameId, scene.gameMode)
goto failed
}
if reason := sp.CanEnter(scene, p); reason != 0 {
code = gamehall.OpResultCode_Game(reason)
logger.Logger.Trace("CSEnterRoomHandler sp.CanEnter(scene, p) reason ", reason)
goto failed
}
if scene.IsFull() {
code = gamehall.OpResultCode_Game_OPRC_RoomIsFull_Game
logger.Logger.Trace("CSEnterRoomHandler ScenePolicy.IsFull = true")
goto failed
}
if scene.IsMatchScene() && p.IsRob {
grade := int32(1000)
snid := p.SnId
roleId := int32(2000001)
if p.Roles != nil {
roleId = p.Roles.ModId
}
skinId := int32(300001)
var tm *TmMatch
if len(scene.params) > 3 {
sortId := scene.params[0]
tm = TournamentMgr.GetTm(sortId)
if tm != nil && tm.copyRobotGrades != nil && len(tm.copyRobotGrades) > 0 {
randIndex := rand.Intn(len(tm.copyRobotGrades))
grade = tm.copyRobotGrades[randIndex].grade
snid = tm.copyRobotGrades[randIndex].copySnid
roleId = tm.copyRobotGrades[randIndex].copyRoleId
skinId = tm.copyRobotGrades[randIndex].CopySkinId
tm.copyRobotGrades = append(tm.copyRobotGrades[:randIndex], tm.copyRobotGrades[randIndex+1:]...)
}
}
mc := NewMatchContext(p, tm, grade, snid, 1, roleId, skinId, 0)
if mc != nil {
mc.gaming = true
p.matchCtx = mc
}
}
if !scene.PlayerEnter(p, -1, true) {
code = gamehall.OpResultCode_Game_OPRC_Error_Game
}
failed:
if code != gamehall.OpResultCode_Game_OPRC_Sucess_Game {
resp := &gamehall.SCEnterRoom{
GameId: proto.Int(gameId),
ModeType: proto.Int(gameMode),
RoomId: proto.Int(roomId),
OpRetCode: code,
}
p.Platform = oldPlatform
proto.SetDefaults(resp)
p.SendToClient(int(gamehall.GameHallPacketID_PACKET_SC_ENTERROOM), resp)
}
return nil
}
type CSAudienceEnterRoomHandler struct {
}
func (this *CSAudienceEnterRoomHandler) Process(s *netlib.Session, packetid int, data interface{}, sid int64) error {
logger.Logger.Trace("CSAudienceEnterRoomHandler Process recv ", data)
if msg, ok := data.(*gamehall.CSEnterRoom); ok {
p := PlayerMgrSington.GetPlayer(sid)
if p == nil {
return nil
}
var code = gamehall.OpResultCode_Game_OPRC_Sucess_Game
var sp ScenePolicy
var dbGameFree *server.DB_GameFree
var cfg *webapiproto.GameFree
scene := SceneMgrSingleton.GetScene(int(msg.GetRoomId()))
if scene == nil {
code = gamehall.OpResultCode_Game_OPRC_RoomNotExist_Game
logger.Logger.Trace("CSAudienceEnterRoomHandler scene == nil")
goto failed
}
if scene.IsMatchScene() {
code = gamehall.OpResultCode_Game_OPRC_RoomNotExist_Game
logger.Logger.Tracef("CSAudienceEnterRoomHandler scene.IsMatchScene() %v", scene.sceneId)
goto failed
}
if p.scene != nil {
code = gamehall.OpResultCode_Game_OPRC_CannotWatchReasonInOther_Game
logger.Logger.Trace("CSAudienceEnterRoomHandler p.scene != nil")
goto failed
}
cfg = PlatformMgrSingleton.GetGameFree(p.Platform, scene.dbGameFree.Id)
if cfg != nil && (cfg.GroupId != scene.groupId || cfg.GroupId == 0) {
if scene.limitPlatform != nil {
if scene.limitPlatform.Isolated && p.Platform != scene.limitPlatform.IdStr {
code = gamehall.OpResultCode_Game_OPRC_RoomNotExist_Game
logger.Logger.Tracef("CSEnterRoomHandler ScenePolicy(gameid:%v mode:%v) scene.limitPlatform.Isolated && p.Platform != scene.limitPlatform.Name", scene.gameId, scene.gameMode)
goto failed
}
}
}
//if !scene.starting {
// code = gamehall.OpResultCode_Game_OPRC_CannotWatchReasonRoomNotStart_Game
// logger.Logger.Trace("CSAudienceEnterRoomHandler !scene.starting")
// goto failed
//}
if scene.deleting {
code = gamehall.OpResultCode_Game_OPRC_RoomNotExist_Game
logger.Logger.Trace("CSAudienceEnterRoomHandler scene is deleting")
goto failed
}
if scene.closed {
code = gamehall.OpResultCode_Game_OPRC_RoomHadClosed_Game
logger.Logger.Trace("CSAudienceEnterRoomHandler scene is closed")
goto failed
}
//if scene.IsCoinScene() || scene.IsHundredScene() {
// code = gamehall.OpResultCode_Game_OPRC_Error_Game
// logger.Logger.Trace("CSAudienceEnterRoomHandler scene is IsCoinScene IsHundredScene")
// goto failed
//}
sp = GetScenePolicy(scene.gameId, scene.gameMode)
if sp == nil {
code = gamehall.OpResultCode_Game_OPRC_GameNotExist_Game
logger.Logger.Tracef("CSAudienceEnterRoomHandler ScenePolicy(gameid:%v mode:%v) not registe", scene.gameId, scene.gameMode)
goto failed
}
dbGameFree = scene.dbGameFree
code = gamehall.OpResultCode_Game(CoinSceneMgrSingleton.AudienceEnter(p, dbGameFree.GetId(), msg.GetRoomId(), nil, true))
failed:
if code != gamehall.OpResultCode_Game_OPRC_Sucess_Game {
resp := &gamehall.SCEnterRoom{
OpRetCode: code,
}
proto.SetDefaults(resp)
p.SendToClient(int(gamehall.GameHallPacketID_PACKET_SC_ENTERROOM), resp)
}
}
return nil
}
type CSReturnRoomPacketFactory struct {
}
type CSReturnRoomHandler struct {
}
func (this *CSReturnRoomPacketFactory) CreatePacket() interface{} {
pack := &gamehall.CSReturnRoom{}
return pack
}
func (this *CSReturnRoomHandler) Process(s *netlib.Session, packetid int, data interface{}, sid int64) error {
logger.Logger.Trace("CSReturnRoomHandler Process recv ", data)
if msg, ok := data.(*gamehall.CSReturnRoom); ok {
p := PlayerMgrSington.GetPlayer(sid)
if p == nil {
return nil
}
scene := p.scene
pack := &gamehall.SCReturnRoom{}
if scene == nil {
//miniGameScene := MiniGameMgrSington.GetAllSceneByPlayer(p)
isExist := false
//for _, s := range miniGameScene {
// if s.sceneId == int(msg.GetRoomId()) {
// isExist = true
// }
//}
if isExist {
//如果存在这尝试返回到房间内
//MiniGameMgrSington.OnPlayerReturnScene(p)
} else {
pack.OpRetCode = gamehall.OpResultCode_Game_OPRC_RoomNotExist_Game
//如果不存在则直接返回
goto done
}
} else {
pack.RoomId = proto.Int(scene.sceneId)
pack.GameId = proto.Int(scene.gameId)
pack.ModeType = proto.Int(scene.gameMode)
pack.Params = common.CopySliceInt64ToInt32(scene.params)
pack.HallId = proto.Int32(scene.hallId)
gameVers := srvdata.GetGameVers(p.PackageID)
if ver, ok := gameVers[fmt.Sprintf("%v,%v", scene.gameId, p.Channel)]; ok {
pack.MinApkVer = proto.Int32(ver.MinApkVer)
pack.MinResVer = proto.Int32(ver.MinResVer)
pack.LatestApkVer = proto.Int32(ver.LatestApkVer)
pack.LatestResVer = proto.Int32(ver.LatestResVer)
if msg.GetApkVer() < ver.MinApkVer {
pack.OpRetCode = gamehall.OpResultCode_Game_OPRC_YourAppVerIsLow_Game
goto done
}
if msg.GetResVer() < ver.MinResVer {
pack.OpRetCode = gamehall.OpResultCode_Game_OPRC_YourResVerIsLow_Game
goto done
}
}
scene = p.ReturnScene(msg.GetIsLoaded())
if scene == nil {
pack.OpRetCode = gamehall.OpResultCode_Game_OPRC_RoomNotExist_Game
} else {
//成功返回房间的消息在gamesrv上发送为了确保房间消息的顺序
return nil
//pack.OpRetCode = gamehall.OpResultCode_Game_OPRC_Sucess_Game
}
}
done:
proto.SetDefaults(pack)
p.SendToClient(int(gamehall.GameHallPacketID_PACKET_SC_RETURNROOM), pack)
}
return nil
}
type CSQueryRoomInfoPacketFactory struct {
}
type CSQueryRoomInfoHandler struct {
}
func (this *CSQueryRoomInfoPacketFactory) CreatePacket() interface{} {
pack := &gamehall.CSQueryRoomInfo{}
return pack
}
func (this *CSQueryRoomInfoHandler) Process(s *netlib.Session, packetid int, data interface{}, sid int64) error {
//msg, ok := data.(*gamehall.CSQueryRoomInfo)
//if !ok {
// return nil
//}
//if len(msg.GetId()) > 0 {
// return this.ProcessId(s, packetid, data, sid)
//}
return this.ProcessLocalGame(s, packetid, data, sid)
}
func (this *CSQueryRoomInfoHandler) ProcessLocalGame(s *netlib.Session, packetid int, data interface{}, sid int64) error {
logger.Logger.Trace("CSQueryRoomInfoHandler Process recv ProcessLocalGame", data)
if msg, ok := data.(*gamehall.CSQueryRoomInfo); ok {
p := PlayerMgrSington.GetPlayer(sid)
if p == nil {
logger.Logger.Warn("CSQueryRoomInfoHandler p == nil")
return nil
}
pack := &gamehall.SCQueryRoomInfo{
GameSite: proto.Int32(msg.GetGameSite()),
}
mapGameCfg := PlatformMgrSingleton.GetGameFrees(p.Platform)
for _, gameid := range msg.GetGameIds() {
pack.GameIds = append(pack.GameIds, gameid)
scenes := SceneMgrSingleton.GetScenesByGame(int(gameid))
for _, scene := range scenes {
if scene == nil {
continue
}
var isShow bool
if mapGameCfg != nil {
if cfg, have := mapGameCfg[scene.dbGameFree.Id]; have && cfg.GroupId != 0 && cfg.GroupId == scene.groupId {
isShow = true
}
}
if p.Platform == scene.limitPlatform.IdStr || isShow {
if scene.sceneMode == int(msg.GetSceneMode()) && len(scene.players) != 0 {
if scene.gameId == int(gameid) && scene.gameSite == int(msg.GetGameSite()) {
// 私人房需要是好友
if scene.sceneMode == common.SceneMode_Private {
if !FriendMgrSington.IsFriend(p.Platform, p.SnId, scene.creator) {
continue
}
}
roomInfo := &gamehall.QRoomInfo{
GameFreeId: proto.Int32(scene.dbGameFree.GetId()),
GameId: proto.Int32(scene.dbGameFree.GetGameId()),
RoomId: proto.Int(scene.sceneId),
BaseCoin: proto.Int64(int64(scene.BaseScore)),
LimitCoin: proto.Int64(scene.dbGameFree.GetLimitCoin()),
CurrNum: proto.Int(scene.GetPlayerCnt()),
MaxPlayer: proto.Int(scene.playerNum),
Creator: proto.Int32(scene.creator),
CreateTs: proto.Int32(int32(scene.createTime.Unix())),
Params: common.CopySliceInt64ToInt32(scene.params),
}
pack.RoomInfo = append(pack.RoomInfo, roomInfo)
}
}
}
}
}
pack.OpRetCode = gamehall.OpResultCode_Game_OPRC_Sucess_Game
proto.SetDefaults(pack)
p.SendToClient(int(gamehall.GameHallPacketID_PACKET_SC_QUERYROOMINFO), pack)
logger.Logger.Trace("SCQueryRoomInfo: ", pack)
}
return nil
}
// 获取指定游戏配置 包括分场信息
type CSGetGameConfigPacketFactory struct {
}
type CSGetGameConfigHandler struct {
}
func (this *CSGetGameConfigPacketFactory) CreatePacket() interface{} {
pack := &gamehall.CSGetGameConfig{}
return pack
}
func (this *CSGetGameConfigHandler) Process(s *netlib.Session, packetid int, data interface{}, sid int64) error {
logger.Logger.Trace("CSGetGameConfigHandler Process recv ", data)
if msg, ok := data.(*gamehall.CSGetGameConfig); ok {
p := PlayerMgrSington.GetPlayer(sid)
if p == nil {
logger.Logger.Warn("CSGetGameConfigHandler p == nil")
return nil
}
plf := msg.GetPlatform()
if plf == "" {
logger.Logger.Warn("CSGetGameConfigHandler plf == ''")
return nil
}
chl := msg.GetChannel()
if chl == "" {
logger.Logger.Warn("CSGetGameConfigHandler chl == ''")
return nil
}
gameId := msg.GetGameId()
if gameId == 0 {
logger.Logger.Warn("CSGetGameConfigHandler gameId == 0")
return nil
}
p.SendGameConfig(gameId, plf, chl)
}
return nil
}
// 进入游戏操作
type CSEnterGamePacketFactory struct {
}
type CSEnterGameHandler struct {
}
func (this *CSEnterGamePacketFactory) CreatePacket() interface{} {
pack := &gamehall.CSEnterGame{}
return pack
}
func (this *CSEnterGameHandler) Process(s *netlib.Session, packetid int, data interface{}, sid int64) error {
logger.Logger.Trace("CSEnterGameHandler Process recv ", data)
msg, ok := data.(*gamehall.CSEnterGame)
if !ok {
return nil
}
gameId := msg.GetId() //gameid
if gameId > 10000 {
gameId = msg.GetId() / 10000 //gamefreeid
}
if common.IsLocalGame(int(gameId)) {
return this.ProcessLocal(s, packetid, data, sid)
}
return this.ProcessNormal(s, packetid, data, sid)
}
func (this *CSEnterGameHandler) ProcessLocal(s *netlib.Session, packetid int, data interface{}, sid int64) error {
logger.Logger.Trace("CSEnterGameHandler ProcessLocal recv ", data)
msg, ok := data.(*gamehall.CSEnterGame)
if !ok {
return nil
}
p := PlayerMgrSington.GetPlayer(sid)
if p == nil {
return nil
}
// 返回消息
var ret gamehall.OpResultCode_Game
pack := &gamehall.SCEnterGame{
Id: msg.Id,
}
oldPlatform := p.Platform
sendEnterGame := func() {
//机器人要避免身上的平台标记被污染
if p.IsRob {
if ret != gamehall.OpResultCode_Game_OPRC_Sucess_Game {
p.Platform = oldPlatform
}
}
pack.OpCode = ret
proto.SetDefaults(pack)
p.SendToClient(int(gamehall.GameHallPacketID_PACKET_SC_ENTERGAME), pack)
}
// 进入原房间
if p.scene != nil {
if p.thrscene > 0 {
ret = gamehall.OpResultCode_Game_OPRC_InOtherGameIng_Game
sendEnterGame()
return nil
}
logger.Logger.Warnf("CSEnterGameHandler found snid:%v had in scene:%v gameid:%v", p.SnId, p.scene.sceneId, p.scene.gameId)
p.ReturnScene(true)
return nil
}
// 获取gameId
gameId := msg.GetId() //gameid
if gameId > 10000 {
gameId = msg.GetId() / 10000 //gamefreeid
}
// 本地游戏入场规则
playerTakeCoin := p.Coin
gameSite := srvdata.CreateRoomMgrSington.GetGameSiteByGameId(gameId, playerTakeCoin)
if gameSite == 0 {
ret = gamehall.OpResultCode_Game_OPRC_CoinNotEnough_Game
sendEnterGame()
return nil
}
gamefreeid := gameId*10000 + gameSite
gps := PlatformMgrSingleton.GetGameFree(p.Platform, gamefreeid)
if gps == nil {
ret = gamehall.OpResultCode_Game_OPRC_RoomHadClosed_Game
sendEnterGame()
return nil
}
dbGameFree := gps.DbGameFree
var roomId int32
params := msg.GetOpParams()
if dbGameFree == nil {
ret = gamehall.OpResultCode_Game_OPRC_RoomHadClosed_Game
sendEnterGame()
return nil
}
if len(params) != 0 {
roomId = params[0]
platformName := CoinSceneMgrSingleton.GetPlatformBySceneId(int(roomId))
if p.IsRob {
p.Platform = platformName
} else if p.GMLevel > 0 && p.Platform == platformName { //允许GM直接按房间ID进场
roomId = params[0]
}
}
if len(msg.GetPlatform()) > 0 && p.IsRob {
p.Platform = msg.GetPlatform()
}
if len(params) != 0 && (p.GMLevel > 0 || dbGameFree.GetCreateRoomNum() != 0) { //允许GM|或者可选房间的游戏直接按房间ID进场
s := SceneMgrSingleton.GetScene(int(params[0]))
if s != nil {
if s.limitPlatform.IdStr == p.Platform || (gps.GroupId != 0 && s.groupId == gps.GroupId) {
roomId = params[0]
}
}
}
excludeSceneIds := p.lastSceneId[gamefreeid]
ret = gamehall.OpResultCode_Game(CoinSceneMgrSingleton.PlayerEnter(p, gamefreeid, roomId, excludeSceneIds, true))
if p.scene != nil {
pack.OpParams = append(pack.OpParams, int32(p.scene.sceneId))
// 有房间还进入失败尝试returnroom
if ret != gamehall.OpResultCode_Game_OPRC_Sucess_Game {
p.ReturnScene(true)
return nil
}
}
sendEnterGame()
return nil
}
func (this *CSEnterGameHandler) ProcessNormal(s *netlib.Session, packetid int, data interface{}, sid int64) error {
logger.Logger.Trace("CSEnterGameHandler ProcessNormal recv ", data)
msg, ok := data.(*gamehall.CSEnterGame)
if !ok {
return nil
}
p := PlayerMgrSington.GetPlayer(sid)
if p == nil {
return nil
}
// 返回消息
var ret gamehall.OpResultCode_Game
pack := &gamehall.SCEnterGame{
Id: msg.Id,
}
oldPlatform := p.Platform
sendEnterGame := func() {
//机器人要避免身上的平台标记被污染
if p.IsRob {
if ret != gamehall.OpResultCode_Game_OPRC_Sucess_Game {
p.Platform = oldPlatform
}
}
pack.OpCode = ret
proto.SetDefaults(pack)
p.SendToClient(int(gamehall.GameHallPacketID_PACKET_SC_ENTERGAME), pack)
}
// 进入原房间
if p.scene != nil {
if p.thrscene > 0 {
ret = gamehall.OpResultCode_Game_OPRC_InOtherGameIng_Game
sendEnterGame()
return nil
}
logger.Logger.Warnf("CSEnterGameHandler found snid:%v had in scene:%v gameid:%v", p.SnId, p.scene.sceneId, p.scene.gameId)
p.ReturnScene(true)
return nil
}
// 其他游戏入场规则
gps := PlatformMgrSingleton.GetGameFree(p.Platform, msg.GetId())
if gps == nil {
ret = gamehall.OpResultCode_Game_OPRC_RoomHadClosed_Game
sendEnterGame()
return nil
}
dbGameFree := gps.DbGameFree
if dbGameFree == nil {
ret = gamehall.OpResultCode_Game_OPRC_RoomHadClosed_Game
sendEnterGame()
return nil
}
gameType := dbGameFree.GetGameType()
var roomId int32
params := msg.GetOpParams() // 0:房间id
switch {
case common.IsHundredType(gameType):
if len(params) != 0 {
roomId = params[0]
name, ok := HundredSceneMgrSington.GetPlatformNameBySceneId(roomId)
if p.IsRob {
//机器人先伪装成对应平台的用户
if ok {
p.Platform = name
}
} else if p.GMLevel > 0 && p.Platform == name { //允许GM直接按房间ID进场
roomId = params[0]
}
}
if len(params) != 0 && p.GMLevel > 0 { //允许GM直接按房间ID进场
s := SceneMgrSingleton.GetScene(int(params[0]))
if s != nil {
if s.limitPlatform.IdStr == p.Platform || (s.groupId != 0 && s.groupId == gps.GroupId) {
roomId = params[0]
}
}
}
ret = gamehall.OpResultCode_Game(HundredSceneMgrSington.PlayerEnter(p, msg.GetId()))
if p.scene != nil {
pack.OpParams = append(pack.OpParams, msg.GetId())
if ret != gamehall.OpResultCode_Game_OPRC_Sucess_Game {
p.ReturnScene(true)
return nil
}
}
case common.IsCoinSceneType(gameType):
if len(params) != 0 {
roomId = params[0]
platformName := CoinSceneMgrSingleton.GetPlatformBySceneId(int(roomId))
if p.IsRob {
p.Platform = platformName
} else if p.GMLevel > 0 && p.Platform == platformName { //允许GM直接按房间ID进场
roomId = params[0]
}
}
if len(msg.GetPlatform()) > 0 && p.IsRob {
p.Platform = msg.GetPlatform()
}
if len(params) != 0 && (p.GMLevel > 0 || dbGameFree.GetCreateRoomNum() != 0) { //允许GM|或者可选房间的游戏直接按房间ID进场
s := SceneMgrSingleton.GetScene(int(params[0]))
if s != nil {
if s.limitPlatform.IdStr == p.Platform || (gps.GroupId != 0 && s.groupId == gps.GroupId) {
roomId = params[0]
}
}
}
excludeSceneIds := p.lastSceneId[msg.GetId()]
ret = gamehall.OpResultCode_Game(CoinSceneMgrSingleton.PlayerEnter(p, msg.GetId(), roomId, excludeSceneIds, true))
if p.scene != nil {
pack.OpParams = append(pack.OpParams, int32(p.scene.sceneId))
if ret != gamehall.OpResultCode_Game_OPRC_Sucess_Game {
p.ReturnScene(true)
return nil
}
}
default:
}
sendEnterGame()
return nil
}
// 退出游戏操作
type CSQuitGamePacketFactory struct {
}
type CSQuitGameHandler struct {
}
func (this *CSQuitGamePacketFactory) CreatePacket() interface{} {
pack := &gamehall.CSQuitGame{}
return pack
}
func (this *CSQuitGameHandler) Process(s *netlib.Session, packetid int, data interface{}, sid int64) error {
logger.Logger.Trace("CSQuitGameHandler Process recv ", data)
if msg, ok := data.(*gamehall.CSQuitGame); ok {
p := PlayerMgrSington.GetPlayer(sid)
if p != nil {
var ret gamehall.OpResultCode_Game
pack := &gamehall.SCQuitGame{
Id: msg.Id,
}
dbGameFree := srvdata.PBDB_GameFreeMgr.GetData(msg.GetId())
gameType := dbGameFree.GetGameType()
if common.IsHundredType(gameType) {
ret = gamehall.OpResultCode_Game(HundredSceneMgrSington.PlayerTryLeave(p))
} else if common.IsCoinSceneType(gameType) {
ret = gamehall.OpResultCode_Game(CoinSceneMgrSingleton.PlayerTryLeave(p, msg.IsAudience))
if gamehall.OpResultCode_Game_OPRC_OpYield_Game == ret {
return nil
}
}
pack.OpCode = ret
proto.SetDefaults(pack)
p.SendToClient(int(gamehall.GameHallPacketID_PACKET_SC_QUITGAME), pack)
}
}
return nil
}
type CSCreateRoomPacketFactory struct {
}
type CSCreateRoomHandler struct {
}
func (this *CSCreateRoomPacketFactory) CreatePacket() interface{} {
pack := &gamehall.CSCreateRoom{}
return pack
}
func (this *CSCreateRoomHandler) Process(s *netlib.Session, packetid int, data interface{}, sid int64) error {
logger.Logger.Trace("CSCreateRoomHandler Process recv ", data)
msg, ok := data.(*gamehall.CSCreateRoom)
if !ok {
return nil
}
switch {
case common.IsLocalGame(int(msg.GetGameId())):
return this.ProcessLocalGame(s, packetid, data, sid)
default:
logger.Logger.Errorf("CSCreateRoomHandler no create function %v", msg.GetGameId())
return nil
}
}
func (this *CSCreateRoomHandler) ProcessLocalGame(s *netlib.Session, packetid int, data interface{}, sid int64) error {
msg, ok := data.(*gamehall.CSCreateRoom)
if !ok {
return nil
}
p := PlayerMgrSington.GetPlayer(sid)
if p == nil {
return nil
}
var code gamehall.OpResultCode_Game
var betRange []int32
var inRange bool
var dbCreateRoom *server.DB_Createroom
var dbGameFree *server.DB_GameFree
var dbGameRule *server.DB_GameRule
var playerTakeCoin = p.GetCoin()
var maxPlayerNum = int(msg.GetMaxPlayerNum())
var gameId = msg.GetGameId()
var params = common.CopySliceInt32ToInt64(msg.GetParams())
var roomId int
var scene *Scene
var sp ScenePolicy
var gamefreeId int32
var gameSite int32
var csp *CoinScenePool
var baseScore int32
var gps *webapiproto.GameFree
//根据携带金额取可创房间 DB_Createroom
arrs := srvdata.PBDB_CreateroomMgr.Datas.Arr
for i := len(arrs) - 1; i >= 0; i-- {
if arrs[i].GetGameId() == msg.GetGameId() {
goldRange := arrs[i].GoldRange
if len(goldRange) == 0 {
continue
}
if playerTakeCoin >= int64(goldRange[0]) {
dbCreateRoom = arrs[i]
break
}
}
}
if dbCreateRoom == nil {
code = gamehall.OpResultCode_Game_OPRC_GameNotExist_Game
logger.Logger.Tracef("CSCreateRoomHandler SnId:%v GameFreeId:%v not exist", p.SnId, dbCreateRoom)
goto failed
}
//校验下gameid
if dbCreateRoom.GetGameId() != gameId {
code = gamehall.OpResultCode_Game_OPRC_GameNotExist_Game
logger.Logger.Tracef("CSCreateRoomHandler PBDB_Createroom Id:%v GameId:%v not exist", dbCreateRoom.GetGameId(), gameId)
goto failed
}
gameSite = dbCreateRoom.GetGameSite()
gamefreeId = gameId*10000 + gameSite
gps = PlatformMgrSingleton.GetGameFree(p.Platform, gamefreeId)
if gps == nil {
code = gamehall.OpResultCode_Game_OPRC_GameNotExist_Game
logger.Logger.Tracef("CSCreateRoomHandler SnId:%v GameFreeId:%v not exist", p.SnId, gamefreeId)
goto failed
}
dbGameFree = gps.DbGameFree
//dbGameFree = srvdata.PBDB_GameFreeMgr.GetData(gamefreeId)
if dbGameFree == nil {
code = gamehall.OpResultCode_Game_OPRC_GameNotExist_Game
logger.Logger.Tracef("CSCreateRoomHandler SnId:%v GameFreeId:%v not exist", p.SnId, gamefreeId)
goto failed
}
//检测房间状态是否开启
if !PlatformMgrSingleton.CheckGameState(p.Platform, dbGameFree.Id) {
code = gamehall.OpResultCode_Game_OPRC_GameHadClosed
logger.Logger.Tracef("CSCreateRoomHandler SnId:%v GameFreeId:%v GameHadClosed", p.SnId, gamefreeId)
goto failed
}
dbGameRule = srvdata.PBDB_GameRuleMgr.GetData(dbGameFree.GetGameRule())
if dbGameRule == nil {
code = gamehall.OpResultCode_Game_OPRC_GameNotExist_Game
logger.Logger.Tracef("CSCreateRoomHandler SnId:%v GameFreeId:%v gamerule not exist", p.SnId, gamefreeId)
goto failed
}
if len(params) == 0 {
params = common.CopySliceInt32ToInt64(dbGameRule.GetParams())
}
sp = GetScenePolicy(int(dbGameFree.GetGameId()), int(dbGameFree.GetGameMode()))
if sp == nil {
code = gamehall.OpResultCode_Game_OPRC_GameNotExist_Game
logger.Logger.Tracef("CSCreateRoomHandler SnId:%v ScenePolicy(gameid:%v mode:%v) not registe", p.SnId, dbGameFree.GetGameId(), dbGameFree.GetGameMode())
goto failed
}
if p.scene != nil {
code = gamehall.OpResultCode_Game_OPRC_RoomHadExist_Game
logger.Logger.Tracef("CSCreateRoomHandler had scene(%d)", p.scene.sceneId)
goto failed
}
//校验底分
betRange = dbCreateRoom.GetBetRange()
inRange = false
for _, bet := range betRange {
if msg.GetBaseCoin() == bet {
inRange = true
break
}
}
if !inRange || msg.GetBaseCoin() == 0 {
code = gamehall.OpResultCode_Game_OPRC_Error_Game
logger.Logger.Tracef("CSCreateRoomHandler BaseCoin:%v not in BetRange ", msg.GetBaseCoin())
goto failed
}
//修正底注
baseScore = msg.GetBaseCoin()
// 如果人数为0人数从建房参数中获取如果没有就用gameconfig中的默认最大人数
// 再添加新游戏人数放在建房参数params中
//校验人数
maxPlayerNum = int(msg.GetMaxPlayerNum())
if maxPlayerNum != 4 && maxPlayerNum != 2 {
code = gamehall.OpResultCode_Game_OPRC_Error_Game
logger.Logger.Tracef("CSCreateRoomHandler GameId_TienLen_maxPlayerNum:%v ", maxPlayerNum)
maxPlayerNum = 0
}
//创建房间
csp = CoinSceneMgrSingleton.GetCoinScenePool(p.GetPlatform().IdStr, dbGameFree.GetId())
roomId = SceneMgrSingleton.GenOneCoinSceneId()
if roomId == common.RANDID_INVALID {
code = gamehall.OpResultCode_Game_OPRC_AllocRoomIdFailed_Game
logger.Logger.Tracef("CSCreateRoomHandler SnId:%v GameId:%v sceneId == -1 ", p.SnId, gameId)
goto failed
}
scene, code = p.CreateLocalGameScene(roomId, int(gameId), int(gameSite), int(msg.GetSceneMode()), maxPlayerNum,
params, dbGameFree, baseScore, csp.groupId)
if scene != nil && code == gamehall.OpResultCode_Game_OPRC_Sucess_Game {
logger.Logger.Tracef("CSCreateRoomHandler SnId:%v Create Sucess GameId:%v", p.SnId, gameId)
csp.AddScene(scene)
if !scene.PlayerEnter(p, -1, true) {
code = gamehall.OpResultCode_Game_OPRC_Error_Game
}
}
failed:
resp := &gamehall.SCCreateRoom{
GameId: msg.GetGameId(),
BaseCoin: msg.GetBaseCoin(),
SceneMode: msg.GetSceneMode(),
MaxPlayerNum: msg.GetMaxPlayerNum(),
Params: msg.GetParams(),
OpRetCode: code,
}
proto.SetDefaults(resp)
p.SendToClient(int(gamehall.GameHallPacketID_PACKET_SC_CREATEROOM), resp)
return nil
}
func (this *CSCreateRoomHandler) ProcessThirteen(s *netlib.Session, packetid int, data interface{}, sid int64) error {
msg, ok := data.(*gamehall.CSCreateRoom)
if !ok {
return nil
}
p := PlayerMgrSington.GetPlayer(sid)
if p == nil {
return nil
}
var code gamehall.OpResultCode_Game
var dbGameFree *server.DB_GameFree
var dbGameRule *server.DB_GameRule
var params = common.CopySliceInt32ToInt64(msg.GetParams())
var baseScore = msg.GetBaseCoin()
var sp ScenePolicy
var gamefreeId = msg.GetId()
var gps *webapiproto.GameFree
var maxPlayerNum = int(msg.GetMaxPlayerNum())
var csp *CoinScenePool
var roomId int
var scene *Scene
var gameId = gamefreeId / 10000
var spd *ScenePolicyData
gps = PlatformMgrSingleton.GetGameFree(p.Platform, gamefreeId)
if gps == nil {
code = gamehall.OpResultCode_Game_OPRC_GameNotExist_Game
logger.Logger.Tracef("CSCreateRoomHandler SnId:%v GameFreeId:%v not exist", p.SnId, gamefreeId)
goto failed
}
dbGameFree = gps.DbGameFree
if dbGameFree == nil {
code = gamehall.OpResultCode_Game_OPRC_GameNotExist_Game
logger.Logger.Tracef("CSCreateRoomHandler SnId:%v GameFreeId:%v not exist", p.SnId, gamefreeId)
goto failed
}
//检测房间状态是否开启
if !PlatformMgrSingleton.CheckGameState(p.Platform, dbGameFree.Id) {
code = gamehall.OpResultCode_Game_OPRC_GameHadClosed
logger.Logger.Tracef("CSCreateRoomHandler SnId:%v GameFreeId:%v GameHadClosed", p.SnId, gamefreeId)
goto failed
}
dbGameRule = srvdata.PBDB_GameRuleMgr.GetData(dbGameFree.GetGameRule())
if dbGameRule == nil {
code = gamehall.OpResultCode_Game_OPRC_GameNotExist_Game
logger.Logger.Tracef("CSCreateRoomHandler SnId:%v GameFreeId:%v gamerule not exist", p.SnId, gamefreeId)
goto failed
}
sp = GetScenePolicy(int(gameId), 0)
if sp == nil {
code = gamehall.OpResultCode_Game_OPRC_GameNotExist_Game
logger.Logger.Tracef("CSCreateRoomHandler SnId:%v GameFreeId:%v not exist", p.SnId, gamefreeId)
goto failed
}
spd, ok = sp.(*ScenePolicyData)
if ok {
//todo 参数校验
_ = spd
}
if p.scene != nil {
code = gamehall.OpResultCode_Game_OPRC_RoomHadExist_Game
logger.Logger.Tracef("CSCreateRoomHandler had scene(%d)", p.scene.sceneId)
goto failed
}
//创建房间
csp = CoinSceneMgrSingleton.GetCoinScenePool(p.GetPlatform().IdStr, dbGameFree.GetId())
roomId = SceneMgrSingleton.GenOneCoinSceneId()
if roomId == common.RANDID_INVALID {
code = gamehall.OpResultCode_Game_OPRC_AllocRoomIdFailed_Game
logger.Logger.Tracef("CSCreateRoomHandler SnId:%v GameId:%v sceneId == -1 ", p.SnId, gameId)
goto failed
}
scene, code = p.CreateLocalGameScene(roomId, int(gameId), int(dbGameFree.GetSceneType()), int(msg.GetSceneMode()),
maxPlayerNum, params, dbGameFree, baseScore, csp.groupId)
if scene != nil {
if code == gamehall.OpResultCode_Game_OPRC_Sucess_Game {
logger.Logger.Tracef("CSCreateRoomHandler SnId:%v Create Sucess GameId:%v", p.SnId, gameId)
// try enter scene
csp.scenes[scene.sceneId] = scene
scene.csp = csp
if !scene.PlayerEnter(p, -1, true) {
code = gamehall.OpResultCode_Game_OPRC_Error_Game
}
}
}
failed:
resp := &gamehall.SCCreateRoom{
GameId: msg.GetGameId(),
BaseCoin: msg.GetBaseCoin(),
SceneMode: msg.GetSceneMode(),
MaxPlayerNum: msg.GetMaxPlayerNum(),
Params: msg.GetParams(),
OpRetCode: code,
}
proto.SetDefaults(resp)
p.SendToClient(int(gamehall.GameHallPacketID_PACKET_SC_CREATEROOM), resp)
return nil
}
// 观众坐下
type CSAudienceSitPacketFactory struct {
}
type CSAudienceSitHandler struct {
}
func (this *CSAudienceSitPacketFactory) CreatePacket() interface{} {
pack := &gamehall.CSAudienceSit{}
return pack
}
func (this *CSAudienceSitHandler) Process(s *netlib.Session, packetid int, data interface{}, sid int64) error {
logger.Logger.Trace("CSAudienceSitHandler Process recv ", data)
if msg, ok := data.(*gamehall.CSAudienceSit); ok {
p := PlayerMgrSington.GetPlayer(sid)
if p == nil {
logger.Logger.Warn("CSAudienceSitHandler p == nil")
return nil
}
if p.scene == nil {
logger.Logger.Warn("CSAudienceSitHandler scene == nil")
return nil
}
if int32(p.scene.sceneId) != msg.GetRoomId() {
logger.Logger.Warn("CSAudienceSitHandler sceneId != roomId")
return nil
}
newPlayer := PlayerMgrSington.GetPlayerBySnId(p.SnId)
if newPlayer != nil {
pack := &gamehall.SCAudienceSit{
RoomId: proto.Int32(msg.GetRoomId()),
}
if !p.scene.IsTestScene() {
// 入场限额检查
limitCoin := srvdata.CreateRoomMgrSington.GetLimitCoinByBaseScore(int32(p.scene.gameId), int32(p.scene.gameSite), p.scene.BaseScore)
if p.Coin < limitCoin {
pack.OpCode = gamehall.OpResultCode_Game_OPRC_MoneyNotEnough_Game
newPlayer.SendToClient(int(gamehall.GameHallPacketID_PACKET_SC_AUDIENCESIT), pack)
return nil
}
}
// 是否还有空座位
if p.scene.IsFull() {
pack.OpCode = gamehall.OpResultCode_Game_OPRC_RoomIsFull_Game
newPlayer.SendToClient(int(gamehall.GameHallPacketID_PACKET_SC_AUDIENCESIT), pack)
return nil
}
p.scene.AudienceSit(newPlayer, -1)
pack.OpCode = gamehall.OpResultCode_Game_OPRC_Sucess_Game
newPlayer.SendToClient(int(gamehall.GameHallPacketID_PACKET_SC_AUDIENCESIT), pack)
}
}
return nil
}
// 我的游戏信息及平台公告
type CSRecordAndNoticePacketFactory struct {
}
type CSRecordAndNoticeHandler struct {
}
func (this *CSRecordAndNoticePacketFactory) CreatePacket() interface{} {
pack := &gamehall.CSRecordAndNotice{}
return pack
}
func (this *CSRecordAndNoticeHandler) Process(s *netlib.Session, packetid int, data interface{}, sid int64) error {
logger.Logger.Trace("CSRecordAndNoticeHandler Process recv ", data)
msg, ok := data.(*gamehall.CSRecordAndNotice)
if !ok {
return nil
}
p := PlayerMgrSington.GetPlayer(sid)
if p == nil {
logger.Logger.Warn("CSRecordAndNoticeHandler p == nil")
return nil
}
pack := &gamehall.SCRecordAndNotice{
OpCode: gamehall.OpResultCode_Game_OPRC_Sucess_Game,
}
switch msg.GetOpt() {
case 0:
// 公告
list := PlatformMgrSingleton.GetCommonNotice(p.Platform)
if list != nil {
for _, v := range list.List {
pack.List = append(pack.List, &gamehall.CommonNotice{
Sort: v.Sort, // 排序 第几位
Title: v.Title, // 标题
Content: v.Content, // 内容
TypeName: v.TypeName, // 大标题
Type: v.Type, // 大标题类型
StartTime: int32(v.StartTime), // 开始显示时间
EndTime: int32(v.EndTime), // 结束显示时间
CategoryType: v.CategoryType,
ImgUrl: v.ImgUrl,
NoticeId: v.NoticeId,
IsLoop: v.IsLoop,
LoopTime: v.LoopTime,
OnChannelName: v.OnChannelName,
Url: v.Url,
})
}
}
p.SendToClient(int(gamehall.GameHallPacketID_PACKET_SC_COMNOTICE), pack)
logger.Logger.Trace("CSRecordAndNoticeHandler Process send ", pack)
case 1:
// 战绩日期列表
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
gdi := model.GetPlayerExistListByTs(p.SnId, p.Platform, msg.StartTime, 7)
return &gdi
}), task.CompleteNotifyWrapper(func(data interface{}, t task.Task) {
if data != nil && data.(*[]int64) != nil {
gamets := data.(*[]int64)
pack.GlistTs = append(pack.GlistTs, *gamets...)
} else {
pack.OpCode = gamehall.OpResultCode_Game_OPRC_Error_Game
}
p.SendToClient(int(gamehall.GameHallPacketID_PACKET_SC_COMNOTICE), pack)
}), "SCRecordAndNotice").Start()
case 2:
// 当日战绩
starttime := msg.StartTime
time := time.Unix(starttime, 0)
endtime := time.AddDate(0, 0, 1).Unix() - 1 //23:59:59
var list model.GamePlayerListType
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
list = model.GetPlayerListByHallExAPI(p.SnId, p.Platform, starttime, endtime, int(msg.PageNo), int(msg.PageSize))
return nil
}), task.CompleteNotifyWrapper(func(data interface{}, t task.Task) {
for _, v := range list.Data {
pack.Glist = append(pack.Glist, &gamehall.PlayerRecord{
GameFreeid: v.GameFreeid,
GameDetailedLogId: v.GameDetailedLogId,
TotalIn: v.TotalIn,
TotalOut: v.TotalOut,
Ts: v.Ts,
MatchType: proto.Int32(v.MatchType),
})
}
p.SendToClient(int(gamehall.GameHallPacketID_PACKET_SC_COMNOTICE), pack)
}), "SCRecordAndNotice").Start()
}
return nil
}
func init() {
// 观众进入房间
common.RegisterHandler(int(gamehall.GameHallPacketID_PACKET_CS_AUDIENCE_ENTERROOM), &CSAudienceEnterRoomHandler{})
netlib.RegisterFactory(int(gamehall.GameHallPacketID_PACKET_CS_AUDIENCE_ENTERROOM), &CSEnterRoomPacketFactory{})
// 返回房间
common.RegisterHandler(int(gamehall.GameHallPacketID_PACKET_CS_RETURNROOM), &CSReturnRoomHandler{})
netlib.RegisterFactory(int(gamehall.GameHallPacketID_PACKET_CS_RETURNROOM), &CSReturnRoomPacketFactory{})
//观众坐下
common.RegisterHandler(int(gamehall.GameHallPacketID_PACKET_CS_AUDIENCESIT), &CSAudienceSitHandler{})
netlib.RegisterFactory(int(gamehall.GameHallPacketID_PACKET_CS_AUDIENCESIT), &CSAudienceSitPacketFactory{})
//获取指定游戏配置 包括分场信息
common.RegisterHandler(int(gamehall.GameHallPacketID_PACKET_CS_GETGAMECONFIG), &CSGetGameConfigHandler{})
netlib.RegisterFactory(int(gamehall.GameHallPacketID_PACKET_CS_GETGAMECONFIG), &CSGetGameConfigPacketFactory{})
//玩家进入游戏
common.RegisterHandler(int(gamehall.GameHallPacketID_PACKET_CS_ENTERGAME), &CSEnterGameHandler{})
netlib.RegisterFactory(int(gamehall.GameHallPacketID_PACKET_CS_ENTERGAME), &CSEnterGamePacketFactory{})
//玩家进入房间
common.RegisterHandler(int(gamehall.GameHallPacketID_PACKET_CS_ENTERROOM), &CSEnterRoomHandler{})
netlib.RegisterFactory(int(gamehall.GameHallPacketID_PACKET_CS_ENTERROOM), &CSEnterRoomPacketFactory{})
//玩家退出游戏
common.RegisterHandler(int(gamehall.GameHallPacketID_PACKET_CS_QUITGAME), &CSQuitGameHandler{})
netlib.RegisterFactory(int(gamehall.GameHallPacketID_PACKET_CS_QUITGAME), &CSQuitGamePacketFactory{})
//创建房间
common.RegisterHandler(int(gamehall.GameHallPacketID_PACKET_CS_CREATEROOM), &CSCreateRoomHandler{})
netlib.RegisterFactory(int(gamehall.GameHallPacketID_PACKET_CS_CREATEROOM), &CSCreateRoomPacketFactory{})
//查询公共房间列表
common.RegisterHandler(int(gamehall.GameHallPacketID_PACKET_CS_QUERYROOMINFO), &CSQueryRoomInfoHandler{})
netlib.RegisterFactory(int(gamehall.GameHallPacketID_PACKET_CS_QUERYROOMINFO), &CSQueryRoomInfoPacketFactory{})
//我的游戏信息及平台公告
common.RegisterHandler(int(gamehall.GameHallPacketID_PACKET_CS_COMNOTICE), &CSRecordAndNoticeHandler{})
netlib.RegisterFactory(int(gamehall.GameHallPacketID_PACKET_CS_COMNOTICE), &CSRecordAndNoticePacketFactory{})
}