diff --git a/gamesrv/action/action_server.go b/gamesrv/action/action_server.go index 10b4483..7089130 100644 --- a/gamesrv/action/action_server.go +++ b/gamesrv/action/action_server.go @@ -64,7 +64,6 @@ func init() { gameMode := int(msg.GetGameMode()) sceneMode := int(msg.GetSceneMode()) gameId := int(msg.GetGameId()) - paramsEx := msg.GetParamsEx() hallId := msg.GetHallId() groupId := msg.GetGroupId() dbGameFree := msg.GetDBGameFree() @@ -74,7 +73,7 @@ func init() { playerNum := int(msg.GetPlayerNum()) scene := base.SceneMgrSington.CreateScene(s, sceneId, gameMode, sceneMode, gameId, msg.GetPlatform(), msg.GetParams(), msg.GetAgentor(), msg.GetCreator(), msg.GetReplayCode(), hallId, groupId, totalOfGames, dbGameFree, - bEnterAfterStart, baseScore, playerNum, msg.GetChessRank(), paramsEx...) + bEnterAfterStart, baseScore, playerNum, msg.GetChessRank()) if scene != nil { if scene.IsMatchScene() { if len(scene.Params) > 0 { diff --git a/gamesrv/base/player.go b/gamesrv/base/player.go index 6611f02..b3543ee 100644 --- a/gamesrv/base/player.go +++ b/gamesrv/base/player.go @@ -628,7 +628,7 @@ func (this *Player) SaveSceneCoinLog(takeCoin, changecoin, coin, totalbet, taxco } log := model.NewSceneCoinLogEx(this.SnId, changecoin, takeCoin, coin, eventType, int64(this.scene.DbGameFree.GetBaseScore()), totalbet, int32(this.scene.GameId), this.PlayerData.Ip, - this.scene.paramsEx[0], this.Pos, this.Platform, this.Channel, this.BeUnderAgentCode, int32(this.scene.SceneId), + this.scene.GetGameFreeId(), this.Pos, this.Platform, this.Channel, this.BeUnderAgentCode, int32(this.scene.SceneId), this.scene.DbGameFree.GetGameMode(), this.scene.GetGameFreeId(), taxcoin, wincoin, jackpotWinCoin, smallGameWinCoin, this.PackageID) if log != nil { diff --git a/gamesrv/base/scene.go b/gamesrv/base/scene.go index 704027a..d4d70d1 100644 --- a/gamesrv/base/scene.go +++ b/gamesrv/base/scene.go @@ -63,7 +63,6 @@ type Scene struct { SceneType int // 场次,新手场,中级场... Platform string // 平台id Params []int64 - paramsEx []int32 Creator int32 agentor int32 hallId int32 @@ -139,7 +138,8 @@ type Scene struct { } func NewScene(ws *netlib.Session, sceneId, gameMode, sceneMode, gameId int, platform string, params []int64, - agentor, creator int32, replayCode string, hallId, groupId, totalOfGames int32, dbGameFree *server.DB_GameFree, bEnterAfterStart bool, baseScore int32, playerNum int, cherank []int32, paramsEx ...int32) *Scene { + agentor, creator int32, replayCode string, hallId, groupId, totalOfGames int32, dbGameFree *server.DB_GameFree, + bEnterAfterStart bool, baseScore int32, playerNum int, cherank []int32) *Scene { sp := GetScenePolicy(gameId, gameMode) if sp == nil { logger.Logger.Errorf("Game id %v not register in ScenePolicyPool.", gameId) @@ -154,9 +154,7 @@ func NewScene(ws *netlib.Session, sceneId, gameMode, sceneMode, gameId int, plat SceneMode: sceneMode, SceneType: int(dbGameFree.GetSceneType()), Params: params, - paramsEx: paramsEx, Creator: creator, - agentor: agentor, replayCode: replayCode, Players: make(map[int32]*Player), audiences: make(map[int32]*Player), @@ -236,23 +234,10 @@ func (this *Scene) init() bool { this.nextInviteTime = tNow.Add(time.Second * time.Duration(this.Rand.Int63n(model.GameParamData.RobotInviteInitInterval))) this.RandRobotCnt() - if len(this.paramsEx) != 0 { - if this.IsMatchScene() { - //this.mp = GetMatchPolicy(this.gameId) - baseScore := this.GetParamEx(common.PARAMEX_MATCH_BASESCORE) - this.DbGameFree.BaseScore = proto.Int32(baseScore) - } else { - if this.DbGameFree.GetSceneType() == -1 { - this.Testing = true - } else { - this.Testing = false - } - } + this.KeyGameId = strconv.Itoa(int(this.DbGameFree.GetGameId())) + this.KeyGamefreeId = strconv.Itoa(int(this.DbGameFree.GetId())) + this.KeyGameDif = this.DbGameFree.GetGameDif() - this.KeyGameId = strconv.Itoa(int(this.DbGameFree.GetGameId())) - this.KeyGamefreeId = strconv.Itoa(int(this.DbGameFree.GetId())) - this.KeyGameDif = this.DbGameFree.GetGameDif() - } // test //for i := 0; i < 100; i++ { // n := this.rand.Intn(10) @@ -284,29 +269,6 @@ func (this *Scene) IsDisbanding() bool { return this.hDisband != timer.TimerHandle(0) } -func (this *Scene) GetParamEx(idx int) int32 { - if idx < 0 || idx > len(this.paramsEx) { - return -1 - } - - return this.paramsEx[idx] -} - -func (this *Scene) SetParamEx(idx int, val int32) { - cnt := len(this.paramsEx) - if idx >= 0 && idx < cnt { - this.paramsEx[idx] = val - } -} - -func (this *Scene) GetMatchTotalOfGame() int { - return int(this.GetParamEx(common.PARAMEX_MATCH_NUMOFGAME)) -} - -func (this *Scene) GetMatchBaseScore() int32 { - return this.GetParamEx(common.PARAMEX_MATCH_BASESCORE) -} - func (this *Scene) GetGameFreeId() int32 { return this.DbGameFree.Id } @@ -394,12 +356,6 @@ func (this *Scene) GetParams() []int64 { func (this *Scene) SetParams(params []int64) { this.Params = params } -func (this *Scene) GetParamsEx() []int32 { - return this.paramsEx -} -func (this *Scene) SetParamsEx(paramsEx []int32) { - this.paramsEx = paramsEx -} func (this *Scene) GetStateStartTime() time.Time { return this.StateStartTime } @@ -433,12 +389,6 @@ func (this *Scene) SetCpCtx(cpCtx model.CoinPoolCtx) { func (this *Scene) GetAudiences() map[int32]*Player { return this.audiences } -func (this *Scene) GetAgentor() int32 { - return this.agentor -} -func (this *Scene) SetAgentor(agentor int32) { - this.agentor = agentor -} func (this *Scene) GetDisbandGen() int { return this.disbandGen } diff --git a/gamesrv/base/scene_mgr.go b/gamesrv/base/scene_mgr.go index 1b5b320..1fef20c 100644 --- a/gamesrv/base/scene_mgr.go +++ b/gamesrv/base/scene_mgr.go @@ -34,9 +34,9 @@ func (this *SceneMgr) makeKey(gameid, gamemode int) int { func (this *SceneMgr) CreateScene(s *netlib.Session, sceneId, gameMode, sceneMode, gameId int, platform string, params []int64, agentor, creator int32, replayCode string, hallId, groupId, totalOfGames int32, - dbGameFree *server.DB_GameFree, bEnterAfterStart bool, baseScore int32, playerNum int, chessRank []int32, paramsEx ...int32) *Scene { + dbGameFree *server.DB_GameFree, bEnterAfterStart bool, baseScore int32, playerNum int, chessRank []int32) *Scene { scene := NewScene(s, sceneId, gameMode, sceneMode, gameId, platform, params, agentor, creator, replayCode, - hallId, groupId, totalOfGames, dbGameFree, bEnterAfterStart, baseScore, playerNum, chessRank, paramsEx...) + hallId, groupId, totalOfGames, dbGameFree, bEnterAfterStart, baseScore, playerNum, chessRank) if scene == nil { logger.Logger.Error("(this *SceneMgr) CreateScene, scene == nil") return nil diff --git a/gamesrv/fishing/scenedata_fishing.go b/gamesrv/fishing/scenedata_fishing.go index c0ffaff..e8b4bc8 100644 --- a/gamesrv/fishing/scenedata_fishing.go +++ b/gamesrv/fishing/scenedata_fishing.go @@ -113,7 +113,6 @@ func (this *FishingSceneData) init() bool { this.testing = this.GetTesting() this.gamefreeId = this.GetGameFreeId() this.groupId = this.GetGroupId() - this.agentor = this.GetAgentor() this.sceneMode = this.GetSceneMode() this.TimePoint = 0 this.lastLittleBossTime = time.Now().Unix() diff --git a/gamesrv/thirteen/scene.go b/gamesrv/thirteen/scene.go index 2f5e805..1236c1e 100644 --- a/gamesrv/thirteen/scene.go +++ b/gamesrv/thirteen/scene.go @@ -173,7 +173,6 @@ func (this *SceneEx) ThirteenWaterCreateRoomInfoPacket(s *base.Scene, p *base.Pl Creator: proto.Int32(s.GetCreator()), GameId: proto.Int(s.GetGameId()), RoomMode: proto.Int(s.GetSceneMode()), - AgentId: proto.Int32(s.GetAgentor()), SceneType: s.GetDBGameFree().SceneType, State: proto.Int(s.GetSceneState().GetState()), TimeOut: proto.Int(s.GetSceneState().GetTimeout(s)), diff --git a/gamesrv/tienlen/scenepolicy_tienlen.go b/gamesrv/tienlen/scenepolicy_tienlen.go index 57ed170..525fe17 100644 --- a/gamesrv/tienlen/scenepolicy_tienlen.go +++ b/gamesrv/tienlen/scenepolicy_tienlen.go @@ -2780,6 +2780,11 @@ func init() { base.RegisteScenePolicy(common.GameId_TienLenRank_toend, 0, ScenePolicyTienLenSingleton) base.RegisteScenePolicy(common.GameId_TienLenRank_yl, 0, ScenePolicyTienLenSingleton) base.RegisteScenePolicy(common.GameId_TienLenRank_yl_toend, 0, ScenePolicyTienLenSingleton) + // 房卡场 + base.RegisteScenePolicy(common.GameId_TienLenCustom, 0, ScenePolicyTienLenSingleton) + base.RegisteScenePolicy(common.GameId_TienLenCustom_toend, 0, ScenePolicyTienLenSingleton) + base.RegisteScenePolicy(common.GameId_TienLenCustom_yl, 0, ScenePolicyTienLenSingleton) + base.RegisteScenePolicy(common.GameId_TienLenCustom_yl_toend, 0, ScenePolicyTienLenSingleton) return nil }) } diff --git a/model/config.go b/model/config.go index e60e6fa..bd47bb1 100644 --- a/model/config.go +++ b/model/config.go @@ -1,6 +1,7 @@ package model import ( + "mongo.games.com/game/protocol/gamehall" "strconv" "mongo.games.com/goserver/core/logger" @@ -144,7 +145,8 @@ type AllConfig struct { // 房卡场房间类型 RoomType map[int32]*webapi.RoomType // key: 房间类型id // 房卡场房间配置 - RoomConfig map[int32]*webapi.RoomConfig // key: 房间配置id + RoomConfig map[int32]*webapi.RoomConfig // key: 房间配置id + RoomTypeMap map[int32][]*webapi.RoomConfig // key: 房间类型id:房间配置 } type GlobalConfig struct { @@ -176,6 +178,7 @@ func (cm *ConfigMgr) GetConfig(platform string) *AllConfig { MatchAudience: make(map[int32]*webapi.MatchAudience), RoomType: make(map[int32]*webapi.RoomType), RoomConfig: make(map[int32]*webapi.RoomConfig), + RoomTypeMap: make(map[int32][]*webapi.RoomConfig), } cm.platform[platform] = c } @@ -396,8 +399,79 @@ func (cm *ConfigMgr) DelRoomType(plt string, id int32) { func (cm *ConfigMgr) UpdateRoomConfig(data *webapi.RoomConfig) { cm.GetConfig(data.GetPlatform()).RoomConfig[data.GetId()] = data + d := cm.GetConfig(data.GetPlatform()).RoomTypeMap[data.GetRoomType()] + if d == nil { + d = make([]*webapi.RoomConfig, 0) + } + d = append(d, data) + cm.GetConfig(data.GetPlatform()).RoomTypeMap[data.GetRoomType()] = d } func (cm *ConfigMgr) DelRoomConfig(plt string, id int32) { + d := cm.GetConfig(plt).RoomConfig[id] + if d != nil { + b := cm.GetConfig(plt).RoomTypeMap[d.GetRoomType()] + if b != nil { + for i, v := range b { + if v.GetId() == id { + b = append(b[:i], b[i+1:]...) + cm.GetConfig(plt).RoomTypeMap[d.GetRoomType()] = b + } + } + } + } delete(cm.GetConfig(plt).RoomConfig, id) } + +func (cm *ConfigMgr) GetRoomConfig(plt string) *gamehall.SCRoomConfig { + pack := &gamehall.SCRoomConfig{} + for _, v := range cm.GetConfig(plt).RoomType { + if v.GetOn() != common.On { + continue + } + var list []*gamehall.RoomConfigInfo + for _, vv := range cm.GetConfig(plt).RoomTypeMap[v.GetId()] { + if vv.GetOn() != common.On { + continue + } + var cost, reward []*gamehall.ItemInfo + for _, item := range vv.GetCost() { + cost = append(cost, &gamehall.ItemInfo{ + Id: item.GetItemId(), + Num: int32(item.GetItemNum()), + }) + } + for _, item := range vv.GetReward() { + reward = append(reward, &gamehall.ItemInfo{ + Id: item.GetItemId(), + Num: int32(item.GetItemNum()), + }) + } + list = append(list, &gamehall.RoomConfigInfo{ + Id: vv.GetId(), + Name: vv.GetName(), + RoomType: vv.GetRoomType(), + On: vv.GetOn(), + SortId: vv.GetSortId(), + Cost: cost, + Reward: reward, + OnChannelName: vv.GetOnChannelName(), + GameFreeId: vv.GetGameFreeId(), + Round: vv.GetRound(), + PlayerNum: vv.GetPlayerNum(), + NeedPassword: vv.GetNeedPassword(), + CostType: vv.GetCostType(), + Voice: vv.GetVoice(), + ImageURI: vv.GetImageURI(), + }) + } + pack.List = append(pack.List, &gamehall.RoomTypeInfo{ + Id: v.GetId(), + Name: v.GetName(), + On: v.GetOn(), + SortId: v.GetSortId(), + List: list, + }) + } + return pack +} diff --git a/protocol/server/server.pb.go b/protocol/server/server.pb.go index 19e37f1..f3d15c9 100644 --- a/protocol/server/server.pb.go +++ b/protocol/server/server.pb.go @@ -858,7 +858,7 @@ type WGCreateScene struct { Creator int32 `protobuf:"varint,5,opt,name=Creator,proto3" json:"Creator,omitempty"` Agentor int32 `protobuf:"varint,6,opt,name=Agentor,proto3" json:"Agentor,omitempty"` ReplayCode string `protobuf:"bytes,7,opt,name=ReplayCode,proto3" json:"ReplayCode,omitempty"` - ParamsEx []int32 `protobuf:"varint,8,rep,packed,name=ParamsEx,proto3" json:"ParamsEx,omitempty"` + ParamsEx []int64 `protobuf:"varint,8,rep,packed,name=ParamsEx,proto3" json:"ParamsEx,omitempty"` SceneMode int32 `protobuf:"varint,9,opt,name=SceneMode,proto3" json:"SceneMode,omitempty"` HallId int32 `protobuf:"varint,10,opt,name=HallId,proto3" json:"HallId,omitempty"` Platform string `protobuf:"bytes,11,opt,name=Platform,proto3" json:"Platform,omitempty"` @@ -957,7 +957,7 @@ func (x *WGCreateScene) GetReplayCode() string { return "" } -func (x *WGCreateScene) GetParamsEx() []int32 { +func (x *WGCreateScene) GetParamsEx() []int64 { if x != nil { return x.ParamsEx } @@ -8757,7 +8757,7 @@ var file_server_proto_rawDesc = []byte{ 0x6e, 0x74, 0x6f, 0x72, 0x12, 0x1e, 0x0a, 0x0a, 0x52, 0x65, 0x70, 0x6c, 0x61, 0x79, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x52, 0x65, 0x70, 0x6c, 0x61, 0x79, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x45, 0x78, - 0x18, 0x08, 0x20, 0x03, 0x28, 0x05, 0x52, 0x08, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x45, 0x78, + 0x18, 0x08, 0x20, 0x03, 0x28, 0x03, 0x52, 0x08, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x45, 0x78, 0x12, 0x1c, 0x0a, 0x09, 0x53, 0x63, 0x65, 0x6e, 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x53, 0x63, 0x65, 0x6e, 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x48, 0x61, 0x6c, 0x6c, 0x49, 0x64, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, diff --git a/protocol/server/server.proto b/protocol/server/server.proto index f460326..c6b140b 100644 --- a/protocol/server/server.proto +++ b/protocol/server/server.proto @@ -170,7 +170,7 @@ message WGCreateScene { int32 Creator = 5; int32 Agentor = 6; string ReplayCode = 7; - repeated int32 ParamsEx = 8; + repeated int64 ParamsEx = 8; int32 SceneMode = 9; int32 HallId = 10; string Platform = 11;