diff --git a/data/DB_GameFree.dat b/data/DB_GameFree.dat index 10d42c9..93a0b0d 100644 Binary files a/data/DB_GameFree.dat and b/data/DB_GameFree.dat differ diff --git a/data/DB_GameFree.json b/data/DB_GameFree.json index 564a1f9..b08696a 100644 --- a/data/DB_GameFree.json +++ b/data/DB_GameFree.json @@ -6674,7 +6674,7 @@ 0 ], "OtherIntParams": [ - 1 + 0 ], "RobotNumRng": [ 0 @@ -6707,7 +6707,7 @@ 0 ], "OtherIntParams": [ - 1 + 0 ], "RobotNumRng": [ 0 @@ -6740,7 +6740,7 @@ 0 ], "OtherIntParams": [ - 2 + 1 ], "RobotNumRng": [ 0 @@ -6773,7 +6773,7 @@ 0 ], "OtherIntParams": [ - 2 + 1 ], "RobotNumRng": [ 0 diff --git a/data/DB_PropExchange.dat b/data/DB_PropExchange.dat index 12cce5f..3094b57 100644 Binary files a/data/DB_PropExchange.dat and b/data/DB_PropExchange.dat differ diff --git a/data/DB_Task.dat b/data/DB_Task.dat index f5a92be..fb5fdb1 100644 Binary files a/data/DB_Task.dat and b/data/DB_Task.dat differ diff --git a/dbproxy/svc/u_bag.go b/dbproxy/svc/u_bag.go index 48afcfd..cc07df2 100644 --- a/dbproxy/svc/u_bag.go +++ b/dbproxy/svc/u_bag.go @@ -101,7 +101,8 @@ func (svc *BagSvc) AddBagItem(args *model.BagInfo, ret *bool) error { for id, v := range args.BagItem { if item, exist := bag.BagItem[id]; !exist { if v.ItemNum <= 0 { - continue + err = errors.New("item num not enough") + break } bag.BagItem[id] = &model.Item{ ItemId: v.ItemId, @@ -110,7 +111,8 @@ func (svc *BagSvc) AddBagItem(args *model.BagInfo, ret *bool) error { } } else { if v.ItemNum < 0 && -v.ItemNum > item.ItemNum { - v.ItemNum = -item.ItemNum + err = errors.New("item num not enough") + break } item.ItemNum += v.ItemNum } @@ -119,10 +121,18 @@ func (svc *BagSvc) AddBagItem(args *model.BagInfo, ret *bool) error { vCard = v.ItemNum } } + + if err != nil { + *ret = false + logger.Logger.Errorf("AddBagItem error: %v", err) + return err + } + _, err = cbag.Upsert(bson.M{"_id": bag.BagId}, bag) if err != nil { *ret = false logger.Logger.Info("AddBagItem error ", err) + return err } // v卡返还 diff --git a/dbproxy/svc/u_player.go b/dbproxy/svc/u_player.go index bf6b7c1..62cb522 100644 --- a/dbproxy/svc/u_player.go +++ b/dbproxy/svc/u_player.go @@ -227,7 +227,7 @@ func (svc *PlayerDataSvc) CreatePlayerDataByThird(args *model.CreatePlayer, ret var dataParams model.PlayerParams json.Unmarshal([]byte(a.Params), &dataParams) pd = model.NewPlayerDataThird(acc, name, args.HeadUrl, id, a.Channel, a.Platform, a.Params, - a.Tel, a.PackegeTag, dataParams.Ip, a.TagKey, a.AccountType, a.DeviceOs) + a.Tel, a.PackegeTag, dataParams.Ip, a.TagKey, a.AccountType, a.DeviceOs, a.ChannelId) if pd != nil { err = cplayerdata.Insert(pd) if err != nil { diff --git a/gamesrv/action/action_machine.go b/gamesrv/action/action_machine.go index c577f4e..fb287f2 100644 --- a/gamesrv/action/action_machine.go +++ b/gamesrv/action/action_machine.go @@ -35,15 +35,11 @@ func MSDollMachineListHandler(session *netlib.Session, packetId int, data interf } // 获取空闲娃娃机标识 -func GetFreeDollMachineId() int { - // 获取互斥锁 - MachineMapLock.Lock() - defer MachineMapLock.Unlock() - for i, v := range MachineMap { - if v.Status == false { - v.Status = true - return i - } +func GetFreeDollMachineId(id int32) int { + if MachineMap[int(id)] != nil && MachineMap[int(id)].MachineStatus == 1 { + return int(id) + } else { + return 0 } return 0 } diff --git a/gamesrv/action/action_server.go b/gamesrv/action/action_server.go index 8826281..664ab9b 100644 --- a/gamesrv/action/action_server.go +++ b/gamesrv/action/action_server.go @@ -73,7 +73,7 @@ func HandleWGBuyRecTimeItem(session *netlib.Session, packetId int, data interfac // return nil //} -func CreateSceneHandler(session *netlib.Session, packetId int, data interface{}) error { +func CreateScene(session *netlib.Session, packetId int, data interface{}) error { logger.Logger.Tracef("receive CreateScene %v", data) msg, ok := data.(*server.WGCreateScene) if !ok { @@ -86,52 +86,53 @@ func CreateSceneHandler(session *netlib.Session, packetId int, data interface{}) return nil } +func DestroyScene(session *netlib.Session, packetId int, data interface{}) error { + logger.Logger.Trace("receive WGDestroyScene:", data) + msg, ok := data.(*server.WGDestroyScene) + if !ok { + return nil + } + + if !msg.IsGrace { + // 立刻删除,不管游戏是否结束 + for _, v := range msg.Ids { + s := base.SceneMgrSington.GetScene(int(v)) + if s == nil { + continue + } + if gameScene, ok := s.ExtraData.(base.GameScene); ok { + gameScene.SceneDestroy(true) + } + } + return nil + } + + // 游戏结束后删除房间 + for _, v := range msg.Ids { + s := base.SceneMgrSington.GetScene(int(v)) + if s == nil { + continue + } + if s.IsHundredScene() || s.Gaming { + s.SetGraceDestroy() + } else { + if s.IsMatchScene() { + s.SetGraceDestroy() + } + if gameScene, ok := s.ExtraData.(base.GameScene); ok { + gameScene.SceneDestroy(true) + } + } + } + + return nil +} + func init() { // 创建房间 - netlib.Register(int(server.SSPacketID_PACKET_WG_CREATESCENE), &server.WGCreateScene{}, CreateSceneHandler) - - //删除场景 - // 立刻删除,不管游戏是否结束 - netlib.RegisterFactory(int(server.SSPacketID_PACKET_WG_DESTROYSCENE), netlib.PacketFactoryWrapper(func() interface{} { - return &server.WGDestroyScene{} - })) - netlib.RegisterHandler(int(server.SSPacketID_PACKET_WG_DESTROYSCENE), netlib.HandlerWrapper(func(s *netlib.Session, packetid int, pack interface{}) error { - logger.Logger.Trace("receive WGDestroyScene:", pack) - msg, ok := pack.(*server.WGDestroyScene) - if !ok { - return nil - } - if !msg.IsGrace { - // 立刻删除,不管游戏是否结束 - for _, v := range msg.Ids { - s := base.SceneMgrSington.GetScene(int(v)) - if s != nil { - if gameScene, ok := s.ExtraData.(base.GameScene); ok { - gameScene.SceneDestroy(true) - } - } - } - } else { - // 游戏结束后删除房间 - for _, v := range msg.Ids { - s := base.SceneMgrSington.GetScene(int(v)) - if s != nil { - if s.IsHundredScene() || s.Gaming { - s.SetGraceDestroy(true) - } else { - if s.IsMatchScene() { - s.SetGraceDestroy(true) - } - if gameScene, ok := s.ExtraData.(base.GameScene); ok { - gameScene.SceneDestroy(true) - } - } - } - } - } - - return nil - })) + netlib.Register(int(server.SSPacketID_PACKET_WG_CREATESCENE), &server.WGCreateScene{}, CreateScene) + // 删除房间 + netlib.Register(int(server.SSPacketID_PACKET_WG_DESTROYSCENE), &server.WGDestroyScene{}, DestroyScene) //玩家进入 netlib.RegisterFactory(int(server.SSPacketID_PACKET_WG_PLAYERENTER), netlib.PacketFactoryWrapper(func() interface{} { diff --git a/gamesrv/base/scene.go b/gamesrv/base/scene.go index 5f5b0e3..7f32058 100644 --- a/gamesrv/base/scene.go +++ b/gamesrv/base/scene.go @@ -4,6 +4,7 @@ import ( "fmt" "math" "math/rand" + "mongo.games.com/game/protocol/webapi" "strconv" "time" @@ -297,8 +298,8 @@ func (this *Scene) SetScenePolicy(sp ScenePolicy) { func (this *Scene) GetGraceDestroy() bool { return this.graceDestroy } -func (this *Scene) SetGraceDestroy(graceDestroy bool) { - this.graceDestroy = graceDestroy +func (this *Scene) SetGraceDestroy() { + this.graceDestroy = true } func (this *Scene) GetCpControlled() bool { @@ -2553,15 +2554,16 @@ func (this *Scene) TryRelease() { this.Destroy(true) } } -func (this *Scene) GetMachineServerSecret(MachineId int32, platform string) (AppId int64, ServerSecret string) { +func (this *Scene) GetMachineServerInfo(MachineId int32, platform string) *webapi.MachineInfo { config := ConfigMgrInst.GetConfig(platform).MachineConfig + logger.Logger.Tracef("========GetMachineServerInfo=========== platform=%s, MachineId=%d ,config = %v", platform, MachineId, config) if config == nil { - return 0, "" + return nil } for _, info := range config.Info { if info.MachineId == MachineId { - return info.AppId, info.ServerSecret + return info } } - return 0, "" + return nil } diff --git a/gamesrv/base/srvsessmgr.go b/gamesrv/base/srvsessmgr.go index c401c26..3e95b69 100644 --- a/gamesrv/base/srvsessmgr.go +++ b/gamesrv/base/srvsessmgr.go @@ -1,7 +1,6 @@ package base import ( - "fmt" "mongo.games.com/game/common" "mongo.games.com/game/protocol/machine" "mongo.games.com/goserver/core/logger" @@ -32,7 +31,7 @@ func (this *SrvSessMgr) OnRegiste(s *netlib.Session) { } else if srvInfo.GetType() == 10 { logger.Logger.Warn("(this *SrvSessMgr) OnRegiste (Machine):", s) s.Send(int(machine.DollMachinePacketID_PACKET_SMGameLinkSucceed), &machine.SMGameLinkSucceed{}) - fmt.Printf("与娃娃机服务器连接成功\n") + logger.Logger.Info("与娃娃机服务器连接成功\n") } } } diff --git a/gamesrv/clawdoll/action_clawdoll.go b/gamesrv/clawdoll/action_clawdoll.go index 11fddd2..bd83ddc 100644 --- a/gamesrv/clawdoll/action_clawdoll.go +++ b/gamesrv/clawdoll/action_clawdoll.go @@ -2,7 +2,6 @@ package clawdoll import ( "mongo.games.com/game/common" - rule "mongo.games.com/game/gamerule/clawdoll" "mongo.games.com/game/gamesrv/base" "mongo.games.com/game/protocol/clawdoll" "mongo.games.com/game/protocol/machine" @@ -60,15 +59,6 @@ func MSDollMachineoCoinResultHandler(session *netlib.Session, packetId int, data return nil } - scene := p.GetScene() - if scene == nil { - return nil - } - sceneEx, ok := scene.ExtraData.(*SceneEx) - if !ok { - return nil - } - switch msg.TypeId { case 1: if msg.Result == 1 { @@ -82,13 +72,6 @@ func MSDollMachineoCoinResultHandler(session *netlib.Session, packetId int, data } else { logger.Logger.Tracef("下抓失败!!!!!!!!!!!!snid = ", msg.Snid) } - - scene.ChangeSceneState(rule.ClawDollSceneStateBilled) - - sceneEx.SetPlayingState(int32(rule.ClawDollSceneStateBilled)) - - ClawdollBroadcastRoomState(scene) - ClawdollSendPlayerInfo(scene) } } return nil @@ -127,14 +110,17 @@ func (h *CSGetTokenHandler) Process(s *netlib.Session, packetid int, data interf } machineId := scene.GetDBGameFree().GetId() % 6080000 - appId, serverSecret := sceneEx.GetMachineServerSecret(machineId, p.Platform) - logger.Logger.Tracef("获取娃娃机 appId = %v, serverSecret = %v", appId, serverSecret) - if serverSecret == "" || appId == 0 { + machineInfo := sceneEx.GetMachineServerInfo(machineId, p.Platform) + if machineInfo == nil { return nil } - pack.ServerSecret = serverSecret - pack.AppId = appId + logger.Logger.Tracef("获取娃娃机 appId = %v, serverSecret = %v, streamId = %v", machineInfo.AppId, machineInfo.ServerSecret, machineInfo.StreamId) + + pack.ServerSecret = machineInfo.ServerSecret + pack.AppId = machineInfo.AppId + pack.StreamId = machineInfo.StreamId + sceneEx.SendToMachine(int(machine.DollMachinePacketID_PACKET_SMGetToken), pack) } return nil @@ -158,9 +144,10 @@ func MSSendTokenHandler(session *netlib.Session, packetId int, data interface{}) } pack := &clawdoll.SCCLAWDOLLSendToken{ - LogicId: scene.DBGameFree.GetId(), - Appid: msg.Appid, - Token: token, + LogicId: scene.DBGameFree.GetId(), + Appid: msg.Appid, + Token: token, + StreamId: msg.StreamId, } p.SendToClient(int(clawdoll.CLAWDOLLPacketID_PACKET_SC_SENDTOKEN), pack) } diff --git a/gamesrv/clawdoll/scene_clawdoll.go b/gamesrv/clawdoll/scene_clawdoll.go index 3347ea6..8c3070d 100644 --- a/gamesrv/clawdoll/scene_clawdoll.go +++ b/gamesrv/clawdoll/scene_clawdoll.go @@ -102,12 +102,35 @@ func (this *SceneEx) BroadcastPlayerLeave(p *base.Player, reason int) { // 玩家进入事件 func (this *SceneEx) OnPlayerEnter(p *base.Player, reason int) { this.BroadcastPlayerEnter(p, reason) + + machineId := this.GetDBGameFree().GetId() % 6080000 + machineInfo := this.GetMachineServerInfo(machineId, p.Platform) + if machineInfo == nil { + return + } + + if this.GetPlayerNum() > 0 { + // 发送http Get请求 打开直播间流 + + } } // 玩家离开事件 func (this *SceneEx) OnPlayerLeave(p *base.Player, reason int) { this.delPlayer(p) this.BroadcastPlayerLeave(p, reason) + + machineId := this.GetDBGameFree().GetId() % 6080000 + machineInfo := this.GetMachineServerInfo(machineId, p.Platform) + if machineInfo == nil { + return + } + + if this.GetPlayerNum() <= 0 { + // 发送http Get请求 关闭直播间流 + + } + } func (this *SceneEx) SceneDestroy(force bool) { //销毁房间 @@ -288,7 +311,7 @@ func (this *SceneEx) GetPlayGrabType(player *PlayerEx) int32 { return rule.ClawWeak } - if this.RoundId%100 == 0 && this.RoundId != 0 { + if this.RoundId/2 == 0 && this.RoundId != 0 { return rule.ClawStrong } @@ -348,7 +371,11 @@ func (this *SceneEx) SetPlayingState(state int32) { // 时间到 系统开始下抓 func (this *SceneEx) TimeOutPlayGrab() bool { - this.OnPlayerSMGrabOp(this.playingSnid, int32(this.machineId), rule.ClawWeak) + playerEx := this.players[this.playingSnid] + if playerEx != nil { + grapType := this.GetPlayGrabType(playerEx) + this.OnPlayerSMGrabOp(this.playingSnid, int32(this.machineId), grapType) + } return true } diff --git a/gamesrv/clawdoll/scenepolicy_clawdoll.go b/gamesrv/clawdoll/scenepolicy_clawdoll.go index 713da22..3d31f96 100644 --- a/gamesrv/clawdoll/scenepolicy_clawdoll.go +++ b/gamesrv/clawdoll/scenepolicy_clawdoll.go @@ -67,7 +67,8 @@ func (this *PolicyClawdoll) OnTick(s *base.Scene) { sceneEx, ok := s.ExtraData.(*SceneEx) if ok { if sceneEx.machineId == 0 { - sceneEx.machineId = action.GetFreeDollMachineId() + machineId := s.DBGameFree.GetId() % 6080000 + sceneEx.machineId = action.GetFreeDollMachineId(machineId) } if sceneEx.machineId != 0 { machineStatus := action.GetDollMachineStatus(sceneEx.machineId) @@ -285,14 +286,16 @@ func (this *PolicyClawdoll) SendGetVideoToken(s *base.Scene, p *base.Player, sce pack.Snid = p.SnId machineId := s.DBGameFree.GetId() % 6080000 - appId, serverSecret := sceneEx.GetMachineServerSecret(machineId, p.Platform) - logger.Logger.Tracef("获取娃娃机 appId = %v, serverSecret = %v", appId, serverSecret) - if serverSecret == "" || appId == 0 { + machineinfo := sceneEx.GetMachineServerInfo(machineId, p.Platform) + if machineinfo == nil { return } - pack.ServerSecret = serverSecret - pack.AppId = appId + logger.Logger.Tracef("获取娃娃机 appId = %v, serverSecret = %v, streamId = %v", machineinfo.AppId, machineinfo.ServerSecret, machineinfo.StreamId) + + pack.ServerSecret = machineinfo.ServerSecret + pack.AppId = machineinfo.AppId + pack.StreamId = machineinfo.StreamId sceneEx.SendToMachine(int(machine.DollMachinePacketID_PACKET_SMGetToken), pack) } @@ -666,6 +669,12 @@ func (this *PlayGame) OnPlayerOp(s *base.Scene, p *base.Player, opcode int, para //1-弱力抓 2 -强力抓 sceneEx.OnPlayerSMGrabOp(p.SnId, int32(sceneEx.machineId), grapType) + s.ChangeSceneState(rule.ClawDollSceneStateBilled) + sceneEx.SetPlayingState(int32(rule.ClawDollSceneStateBilled)) + + ClawdollBroadcastRoomState(s) + ClawdollSendPlayerInfo(s) + case rule.ClawDollPlayerOpMove: if !sceneEx.CheckMoveOp(playerEx) { @@ -693,9 +702,14 @@ func (this *PlayGame) OnTick(s *base.Scene) { if time.Now().Sub(sceneEx.StateStartTime) > rule.ClawDollScenePlayTimeout { if sceneEx.TimeOutPlayGrab() { - logger.Logger.Trace("PlayGame OnTick TimeOutPlayGrab SnId", sceneEx.playingSnid, " machineId:", sceneEx.machineId) + //logger.Logger.Trace("PlayGame OnTick TimeOutPlayGrab SnId", sceneEx.playingSnid, " machineId:", sceneEx.machineId) } + s.ChangeSceneState(rule.ClawDollSceneStateBilled) + sceneEx.SetPlayingState(int32(rule.ClawDollSceneStateBilled)) + + ClawdollBroadcastRoomState(s) + ClawdollSendPlayerInfo(s) return } } diff --git a/machine/action/action_server.go b/machine/action/action_server.go index 6138a53..afa8cd6 100644 --- a/machine/action/action_server.go +++ b/machine/action/action_server.go @@ -169,7 +169,7 @@ func DollMachineGrabResult(session *netlib.Session, conn *machinedoll.Conn, snid num := int64(1) for { // 读取数据 - logger.Logger.Trace("监听抓取结果返回!") + //logger.Logger.Trace("监听抓取结果返回!") buf := make([]byte, 1024) n, err := conn.Read(buf) if err != nil { @@ -178,7 +178,7 @@ func DollMachineGrabResult(session *netlib.Session, conn *machinedoll.Conn, snid } // 将读取到的数据按照 221 进行分割 parts := bytes.Split(buf[:n], []byte{221}) - fmt.Println("获取到的返回值:", parts) + //fmt.Println("获取到的返回值:", parts) instruction := []byte{0xAA, 0x05, 0x02, 0x50, 0x09, 0x00} instruction1 := []byte{0xAA, 0x05, 0x02, 0x50, 0x09, 0x01} // 遍历分割结果,打印出每个部分 @@ -187,11 +187,11 @@ func DollMachineGrabResult(session *netlib.Session, conn *machinedoll.Conn, snid part = part[:len(part)-1] // 去除最后一个字节,该字节为分隔符 //fmt.Println("比较返回结果 part = ", part) if bytes.Contains(part, instruction) && num != 1 { - fmt.Printf("Part %d: %s\n", i+1, part) + //fmt.Printf("Part %d: %s\n", i+1, part) //回应数据 _, err = conn.Write([]byte{0xAA, 0x04, 0x01, 0x50, 0x09, 0x5c, 0xdd}) if err != nil { - fmt.Println("Failed to read response from server:", err) + //fmt.Println("Failed to read response from server:", err) return } session.Send(int(machine.DollMachinePacketID_PACKET_MSDollMachineoPerateResult), &machine.MSDollMachineoPerateResult{ @@ -300,6 +300,7 @@ func SMGetTokenHandler(session *netlib.Session, packetId int, data interface{}) info.Snid = msg.Snid info.Token = token info.Appid = msg.AppId + info.StreamId = msg.StreamId session.Send(int(machine.DollMachinePacketID_PACKET_MSSendToken), info) logger.Logger.Tracef("向游戏服务器发送娃娃机token:%v", info) diff --git a/model/player.go b/model/player.go index ca719c8..c26829f 100644 --- a/model/player.go +++ b/model/player.go @@ -981,7 +981,7 @@ func NewPlayerData(acc string, name string, id int32, channel, platform string, } func NewPlayerDataThird(acc string, name, headUrl string, id int32, channel, platform string, params, tel string, - packTag, ip string, tagkey, accountType int32, deviceOS string) *PlayerData { + packTag, ip string, tagkey, accountType int32, deviceOS, channelId string) *PlayerData { if len(name) == 0 { logger.Logger.Trace("New player name is empty.") return nil @@ -992,6 +992,7 @@ func NewPlayerDataThird(acc string, name, headUrl string, id int32, channel, pla AccountId: acc, Name: name, Channel: channel, + ChannelId: channelId, Platform: platform, SnId: id, Head: rand.Int31n(common.HeadRange), diff --git a/protocol/clawdoll/clawdoll.pb.go b/protocol/clawdoll/clawdoll.pb.go index 010b9fb..098f4ca 100644 --- a/protocol/clawdoll/clawdoll.pb.go +++ b/protocol/clawdoll/clawdoll.pb.go @@ -881,9 +881,10 @@ type SCCLAWDOLLSendToken struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - LogicId int32 `protobuf:"varint,1,opt,name=LogicId,proto3" json:"LogicId,omitempty"` - Appid int64 `protobuf:"varint,2,opt,name=Appid,proto3" json:"Appid,omitempty"` - Token string `protobuf:"bytes,3,opt,name=Token,proto3" json:"Token,omitempty"` + LogicId int32 `protobuf:"varint,1,opt,name=LogicId,proto3" json:"LogicId,omitempty"` + Appid int64 `protobuf:"varint,2,opt,name=Appid,proto3" json:"Appid,omitempty"` + Token string `protobuf:"bytes,3,opt,name=Token,proto3" json:"Token,omitempty"` + StreamId string `protobuf:"bytes,4,opt,name=StreamId,proto3" json:"StreamId,omitempty"` } func (x *SCCLAWDOLLSendToken) Reset() { @@ -939,6 +940,13 @@ func (x *SCCLAWDOLLSendToken) GetToken() string { return "" } +func (x *SCCLAWDOLLSendToken) GetStreamId() string { + if x != nil { + return x.StreamId + } + return "" +} + type CLAWDOLLWaitPlayers struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -1145,59 +1153,61 @@ var file_clawdoll_proto_rawDesc = []byte{ 0x61, 0x79, 0x65, 0x72, 0x4c, 0x65, 0x61, 0x76, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x53, 0x6e, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x53, 0x6e, 0x49, 0x64, 0x22, 0x14, 0x0a, 0x12, 0x43, 0x53, 0x43, 0x4c, 0x41, 0x57, 0x44, 0x4f, 0x4c, 0x4c, 0x47, 0x65, 0x74, 0x54, 0x6f, - 0x6b, 0x65, 0x6e, 0x22, 0x5b, 0x0a, 0x13, 0x53, 0x43, 0x43, 0x4c, 0x41, 0x57, 0x44, 0x4f, 0x4c, + 0x6b, 0x65, 0x6e, 0x22, 0x77, 0x0a, 0x13, 0x53, 0x43, 0x43, 0x4c, 0x41, 0x57, 0x44, 0x4f, 0x4c, 0x4c, 0x53, 0x65, 0x6e, 0x64, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x4c, 0x6f, 0x67, 0x69, 0x63, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x4c, 0x6f, 0x67, 0x69, 0x63, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x41, 0x70, 0x70, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x41, 0x70, 0x70, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x54, 0x6f, 0x6b, 0x65, 0x6e, - 0x22, 0x63, 0x0a, 0x13, 0x43, 0x4c, 0x41, 0x57, 0x44, 0x4f, 0x4c, 0x4c, 0x57, 0x61, 0x69, 0x74, - 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x12, 0x4c, 0x0a, 0x0f, 0x57, 0x61, 0x69, 0x74, 0x50, - 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x49, 0x6e, 0x66, 0x6f, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x22, 0x2e, 0x63, 0x6c, 0x61, 0x77, 0x64, 0x6f, 0x6c, 0x6c, 0x2e, 0x43, 0x4c, 0x41, 0x57, - 0x44, 0x4f, 0x4c, 0x4c, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x44, 0x69, 0x67, 0x65, 0x73, 0x74, - 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x0f, 0x57, 0x61, 0x69, 0x74, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, - 0x73, 0x49, 0x6e, 0x66, 0x6f, 0x22, 0x70, 0x0a, 0x18, 0x43, 0x4c, 0x41, 0x57, 0x44, 0x4f, 0x4c, - 0x4c, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x44, 0x69, 0x67, 0x65, 0x73, 0x74, 0x49, 0x6e, 0x66, - 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x53, 0x6e, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, - 0x04, 0x53, 0x6e, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x48, 0x65, 0x61, 0x64, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x05, 0x52, 0x04, 0x48, 0x65, 0x61, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x48, 0x65, 0x61, - 0x64, 0x55, 0x72, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x48, 0x65, 0x61, 0x64, - 0x55, 0x72, 0x6c, 0x12, 0x12, 0x0a, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x2a, 0xfd, 0x02, 0x0a, 0x10, 0x43, 0x4c, 0x41, 0x57, - 0x44, 0x4f, 0x4c, 0x4c, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x49, 0x44, 0x12, 0x0f, 0x0a, 0x0b, - 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x5a, 0x45, 0x52, 0x4f, 0x10, 0x00, 0x12, 0x17, 0x0a, - 0x12, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x52, 0x4f, 0x4f, 0x4d, 0x49, - 0x4e, 0x46, 0x4f, 0x10, 0xe1, 0x2b, 0x12, 0x17, 0x0a, 0x12, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, - 0x5f, 0x43, 0x53, 0x5f, 0x50, 0x4c, 0x41, 0x59, 0x45, 0x52, 0x4f, 0x50, 0x10, 0xe2, 0x2b, 0x12, - 0x17, 0x0a, 0x12, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x50, 0x4c, 0x41, - 0x59, 0x45, 0x52, 0x4f, 0x50, 0x10, 0xe3, 0x2b, 0x12, 0x18, 0x0a, 0x13, 0x50, 0x41, 0x43, 0x4b, - 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x52, 0x4f, 0x4f, 0x4d, 0x53, 0x54, 0x41, 0x54, 0x45, 0x10, - 0xe4, 0x2b, 0x12, 0x19, 0x0a, 0x14, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, - 0x47, 0x41, 0x4d, 0x45, 0x42, 0x49, 0x4c, 0x4c, 0x45, 0x44, 0x10, 0xe5, 0x2b, 0x12, 0x1a, 0x0a, - 0x15, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x50, 0x6c, 0x61, 0x79, 0x65, - 0x72, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x10, 0xe6, 0x2b, 0x12, 0x1a, 0x0a, 0x15, 0x50, 0x41, 0x43, - 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x4c, 0x65, 0x61, - 0x76, 0x65, 0x10, 0xe7, 0x2b, 0x12, 0x19, 0x0a, 0x14, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, - 0x53, 0x43, 0x5f, 0x50, 0x4c, 0x41, 0x59, 0x45, 0x52, 0x49, 0x4e, 0x46, 0x4f, 0x10, 0xe8, 0x2b, - 0x12, 0x17, 0x0a, 0x12, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x43, 0x53, 0x5f, 0x47, 0x45, - 0x54, 0x54, 0x4f, 0x4b, 0x45, 0x4e, 0x10, 0xe9, 0x2b, 0x12, 0x18, 0x0a, 0x13, 0x50, 0x41, 0x43, - 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x53, 0x45, 0x4e, 0x44, 0x54, 0x4f, 0x4b, 0x45, 0x4e, - 0x10, 0xea, 0x2b, 0x12, 0x1a, 0x0a, 0x15, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x43, 0x53, - 0x5f, 0x57, 0x41, 0x49, 0x54, 0x50, 0x4c, 0x41, 0x59, 0x45, 0x52, 0x53, 0x10, 0xeb, 0x2b, 0x12, - 0x1a, 0x0a, 0x15, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x57, 0x41, 0x49, - 0x54, 0x50, 0x4c, 0x41, 0x59, 0x45, 0x52, 0x53, 0x10, 0xec, 0x2b, 0x12, 0x1a, 0x0a, 0x15, 0x50, - 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x50, 0x4c, 0x41, 0x59, 0x49, 0x4e, 0x47, - 0x49, 0x4e, 0x46, 0x4f, 0x10, 0xed, 0x2b, 0x2a, 0x64, 0x0a, 0x0c, 0x4f, 0x70, 0x52, 0x65, 0x73, - 0x75, 0x6c, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x10, 0x0a, 0x0c, 0x4f, 0x50, 0x52, 0x43, 0x5f, - 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x10, 0x00, 0x12, 0x0e, 0x0a, 0x0a, 0x4f, 0x50, 0x52, - 0x43, 0x5f, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x10, 0x01, 0x12, 0x16, 0x0a, 0x12, 0x4f, 0x50, 0x52, - 0x43, 0x5f, 0x43, 0x6f, 0x69, 0x6e, 0x4e, 0x6f, 0x74, 0x45, 0x6e, 0x6f, 0x75, 0x67, 0x68, 0x10, - 0x02, 0x12, 0x1a, 0x0a, 0x16, 0x4f, 0x50, 0x52, 0x43, 0x5f, 0x50, 0x6f, 0x73, 0x41, 0x6c, 0x52, - 0x65, 0x61, 0x64, 0x79, 0x50, 0x6c, 0x61, 0x79, 0x69, 0x6e, 0x67, 0x10, 0x03, 0x42, 0x28, 0x5a, - 0x26, 0x6d, 0x6f, 0x6e, 0x67, 0x6f, 0x2e, 0x67, 0x61, 0x6d, 0x65, 0x73, 0x2e, 0x63, 0x6f, 0x6d, - 0x2f, 0x67, 0x61, 0x6d, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2f, 0x63, - 0x6c, 0x61, 0x77, 0x64, 0x6f, 0x6c, 0x6c, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x12, 0x1a, 0x0a, 0x08, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x49, 0x64, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x08, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x49, 0x64, 0x22, 0x63, 0x0a, 0x13, + 0x43, 0x4c, 0x41, 0x57, 0x44, 0x4f, 0x4c, 0x4c, 0x57, 0x61, 0x69, 0x74, 0x50, 0x6c, 0x61, 0x79, + 0x65, 0x72, 0x73, 0x12, 0x4c, 0x0a, 0x0f, 0x57, 0x61, 0x69, 0x74, 0x50, 0x6c, 0x61, 0x79, 0x65, + 0x72, 0x73, 0x49, 0x6e, 0x66, 0x6f, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x63, + 0x6c, 0x61, 0x77, 0x64, 0x6f, 0x6c, 0x6c, 0x2e, 0x43, 0x4c, 0x41, 0x57, 0x44, 0x4f, 0x4c, 0x4c, + 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x44, 0x69, 0x67, 0x65, 0x73, 0x74, 0x49, 0x6e, 0x66, 0x6f, + 0x52, 0x0f, 0x57, 0x61, 0x69, 0x74, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x49, 0x6e, 0x66, + 0x6f, 0x22, 0x70, 0x0a, 0x18, 0x43, 0x4c, 0x41, 0x57, 0x44, 0x4f, 0x4c, 0x4c, 0x50, 0x6c, 0x61, + 0x79, 0x65, 0x72, 0x44, 0x69, 0x67, 0x65, 0x73, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x12, 0x0a, + 0x04, 0x53, 0x6e, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x53, 0x6e, 0x49, + 0x64, 0x12, 0x12, 0x0a, 0x04, 0x48, 0x65, 0x61, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, + 0x04, 0x48, 0x65, 0x61, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x48, 0x65, 0x61, 0x64, 0x55, 0x72, 0x6c, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x48, 0x65, 0x61, 0x64, 0x55, 0x72, 0x6c, 0x12, + 0x12, 0x0a, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x4e, + 0x61, 0x6d, 0x65, 0x2a, 0xfd, 0x02, 0x0a, 0x10, 0x43, 0x4c, 0x41, 0x57, 0x44, 0x4f, 0x4c, 0x4c, + 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x49, 0x44, 0x12, 0x0f, 0x0a, 0x0b, 0x50, 0x41, 0x43, 0x4b, + 0x45, 0x54, 0x5f, 0x5a, 0x45, 0x52, 0x4f, 0x10, 0x00, 0x12, 0x17, 0x0a, 0x12, 0x50, 0x41, 0x43, + 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x52, 0x4f, 0x4f, 0x4d, 0x49, 0x4e, 0x46, 0x4f, 0x10, + 0xe1, 0x2b, 0x12, 0x17, 0x0a, 0x12, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x43, 0x53, 0x5f, + 0x50, 0x4c, 0x41, 0x59, 0x45, 0x52, 0x4f, 0x50, 0x10, 0xe2, 0x2b, 0x12, 0x17, 0x0a, 0x12, 0x50, + 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x50, 0x4c, 0x41, 0x59, 0x45, 0x52, 0x4f, + 0x50, 0x10, 0xe3, 0x2b, 0x12, 0x18, 0x0a, 0x13, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, + 0x43, 0x5f, 0x52, 0x4f, 0x4f, 0x4d, 0x53, 0x54, 0x41, 0x54, 0x45, 0x10, 0xe4, 0x2b, 0x12, 0x19, + 0x0a, 0x14, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x47, 0x41, 0x4d, 0x45, + 0x42, 0x49, 0x4c, 0x4c, 0x45, 0x44, 0x10, 0xe5, 0x2b, 0x12, 0x1a, 0x0a, 0x15, 0x50, 0x41, 0x43, + 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x45, 0x6e, 0x74, + 0x65, 0x72, 0x10, 0xe6, 0x2b, 0x12, 0x1a, 0x0a, 0x15, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, + 0x53, 0x43, 0x5f, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x4c, 0x65, 0x61, 0x76, 0x65, 0x10, 0xe7, + 0x2b, 0x12, 0x19, 0x0a, 0x14, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x50, + 0x4c, 0x41, 0x59, 0x45, 0x52, 0x49, 0x4e, 0x46, 0x4f, 0x10, 0xe8, 0x2b, 0x12, 0x17, 0x0a, 0x12, + 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x43, 0x53, 0x5f, 0x47, 0x45, 0x54, 0x54, 0x4f, 0x4b, + 0x45, 0x4e, 0x10, 0xe9, 0x2b, 0x12, 0x18, 0x0a, 0x13, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, + 0x53, 0x43, 0x5f, 0x53, 0x45, 0x4e, 0x44, 0x54, 0x4f, 0x4b, 0x45, 0x4e, 0x10, 0xea, 0x2b, 0x12, + 0x1a, 0x0a, 0x15, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x43, 0x53, 0x5f, 0x57, 0x41, 0x49, + 0x54, 0x50, 0x4c, 0x41, 0x59, 0x45, 0x52, 0x53, 0x10, 0xeb, 0x2b, 0x12, 0x1a, 0x0a, 0x15, 0x50, + 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x57, 0x41, 0x49, 0x54, 0x50, 0x4c, 0x41, + 0x59, 0x45, 0x52, 0x53, 0x10, 0xec, 0x2b, 0x12, 0x1a, 0x0a, 0x15, 0x50, 0x41, 0x43, 0x4b, 0x45, + 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x50, 0x4c, 0x41, 0x59, 0x49, 0x4e, 0x47, 0x49, 0x4e, 0x46, 0x4f, + 0x10, 0xed, 0x2b, 0x2a, 0x64, 0x0a, 0x0c, 0x4f, 0x70, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x43, + 0x6f, 0x64, 0x65, 0x12, 0x10, 0x0a, 0x0c, 0x4f, 0x50, 0x52, 0x43, 0x5f, 0x53, 0x75, 0x63, 0x63, + 0x65, 0x73, 0x73, 0x10, 0x00, 0x12, 0x0e, 0x0a, 0x0a, 0x4f, 0x50, 0x52, 0x43, 0x5f, 0x45, 0x72, + 0x72, 0x6f, 0x72, 0x10, 0x01, 0x12, 0x16, 0x0a, 0x12, 0x4f, 0x50, 0x52, 0x43, 0x5f, 0x43, 0x6f, + 0x69, 0x6e, 0x4e, 0x6f, 0x74, 0x45, 0x6e, 0x6f, 0x75, 0x67, 0x68, 0x10, 0x02, 0x12, 0x1a, 0x0a, + 0x16, 0x4f, 0x50, 0x52, 0x43, 0x5f, 0x50, 0x6f, 0x73, 0x41, 0x6c, 0x52, 0x65, 0x61, 0x64, 0x79, + 0x50, 0x6c, 0x61, 0x79, 0x69, 0x6e, 0x67, 0x10, 0x03, 0x42, 0x28, 0x5a, 0x26, 0x6d, 0x6f, 0x6e, + 0x67, 0x6f, 0x2e, 0x67, 0x61, 0x6d, 0x65, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x61, 0x6d, + 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2f, 0x63, 0x6c, 0x61, 0x77, 0x64, + 0x6f, 0x6c, 0x6c, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/protocol/clawdoll/clawdoll.proto b/protocol/clawdoll/clawdoll.proto index a3f075b..2dea4f0 100644 --- a/protocol/clawdoll/clawdoll.proto +++ b/protocol/clawdoll/clawdoll.proto @@ -117,6 +117,7 @@ message SCCLAWDOLLSendToken { int32 LogicId = 1; int64 Appid = 2; string Token = 3; + string StreamId = 4; } message CLAWDOLLWaitPlayers { diff --git a/protocol/machine/machine.pb.go b/protocol/machine/machine.pb.go index 464b384..e3cc943 100644 --- a/protocol/machine/machine.pb.go +++ b/protocol/machine/machine.pb.go @@ -505,6 +505,7 @@ type SMGetToken struct { Snid int32 `protobuf:"varint,1,opt,name=Snid,proto3" json:"Snid,omitempty"` AppId int64 `protobuf:"varint,2,opt,name=AppId,proto3" json:"AppId,omitempty"` ServerSecret string `protobuf:"bytes,3,opt,name=ServerSecret,proto3" json:"ServerSecret,omitempty"` + StreamId string `protobuf:"bytes,4,opt,name=StreamId,proto3" json:"StreamId,omitempty"` } func (x *SMGetToken) Reset() { @@ -560,15 +561,23 @@ func (x *SMGetToken) GetServerSecret() string { return "" } +func (x *SMGetToken) GetStreamId() string { + if x != nil { + return x.StreamId + } + return "" +} + //返回token type MSSendToken struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Snid int32 `protobuf:"varint,1,opt,name=Snid,proto3" json:"Snid,omitempty"` - Appid int64 `protobuf:"varint,2,opt,name=Appid,proto3" json:"Appid,omitempty"` - Token string `protobuf:"bytes,3,opt,name=Token,proto3" json:"Token,omitempty"` + Snid int32 `protobuf:"varint,1,opt,name=Snid,proto3" json:"Snid,omitempty"` + Appid int64 `protobuf:"varint,2,opt,name=Appid,proto3" json:"Appid,omitempty"` + Token string `protobuf:"bytes,3,opt,name=Token,proto3" json:"Token,omitempty"` + StreamId string `protobuf:"bytes,4,opt,name=StreamId,proto3" json:"StreamId,omitempty"` } func (x *MSSendToken) Reset() { @@ -624,6 +633,13 @@ func (x *MSSendToken) GetToken() string { return "" } +func (x *MSSendToken) GetStreamId() string { + if x != nil { + return x.StreamId + } + return "" +} + var File_machine_proto protoreflect.FileDescriptor var file_machine_proto_rawDesc = []byte{ @@ -661,40 +677,44 @@ var file_machine_proto_rawDesc = []byte{ 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x41, 0x64, 0x64, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x41, - 0x64, 0x64, 0x72, 0x22, 0x5a, 0x0a, 0x0a, 0x53, 0x4d, 0x47, 0x65, 0x74, 0x54, 0x6f, 0x6b, 0x65, + 0x64, 0x64, 0x72, 0x22, 0x76, 0x0a, 0x0a, 0x53, 0x4d, 0x47, 0x65, 0x74, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x53, 0x6e, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x53, 0x6e, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x41, 0x70, 0x70, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x41, 0x70, 0x70, 0x49, 0x64, 0x12, 0x22, 0x0a, 0x0c, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x0c, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x22, - 0x4d, 0x0a, 0x0b, 0x4d, 0x53, 0x53, 0x65, 0x6e, 0x64, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x12, - 0x0a, 0x04, 0x53, 0x6e, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x53, 0x6e, - 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x41, 0x70, 0x70, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x03, 0x52, 0x05, 0x41, 0x70, 0x70, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x54, 0x6f, 0x6b, 0x65, - 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x2a, 0xb9, - 0x02, 0x0a, 0x13, 0x44, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x50, 0x61, - 0x63, 0x6b, 0x65, 0x74, 0x49, 0x44, 0x12, 0x1c, 0x0a, 0x18, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, - 0x5f, 0x53, 0x4d, 0x44, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x5a, 0x65, - 0x72, 0x6f, 0x10, 0x00, 0x12, 0x1e, 0x0a, 0x18, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, - 0x4d, 0x47, 0x61, 0x6d, 0x65, 0x4c, 0x69, 0x6e, 0x6b, 0x53, 0x75, 0x63, 0x63, 0x65, 0x65, 0x64, - 0x10, 0xa0, 0x9c, 0x01, 0x12, 0x20, 0x0a, 0x1a, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, - 0x4d, 0x44, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x50, 0x65, 0x72, 0x61, - 0x74, 0x65, 0x10, 0xa1, 0x9c, 0x01, 0x12, 0x1e, 0x0a, 0x18, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, - 0x5f, 0x53, 0x4d, 0x44, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x47, 0x72, - 0x61, 0x62, 0x10, 0xa2, 0x9c, 0x01, 0x12, 0x1e, 0x0a, 0x18, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, - 0x5f, 0x4d, 0x53, 0x44, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x4c, 0x69, - 0x73, 0x74, 0x10, 0xa3, 0x9c, 0x01, 0x12, 0x26, 0x0a, 0x20, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, - 0x5f, 0x4d, 0x53, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x44, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x63, - 0x68, 0x69, 0x6e, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x10, 0xa4, 0x9c, 0x01, 0x12, 0x27, - 0x0a, 0x21, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x4d, 0x53, 0x44, 0x6f, 0x6c, 0x6c, 0x4d, - 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x6f, 0x50, 0x65, 0x72, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, - 0x75, 0x6c, 0x74, 0x10, 0xa5, 0x9c, 0x01, 0x12, 0x17, 0x0a, 0x11, 0x50, 0x41, 0x43, 0x4b, 0x45, - 0x54, 0x5f, 0x53, 0x4d, 0x47, 0x65, 0x74, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x10, 0xa6, 0x9c, 0x01, - 0x12, 0x18, 0x0a, 0x12, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x4d, 0x53, 0x53, 0x65, 0x6e, - 0x64, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x10, 0xa7, 0x9c, 0x01, 0x42, 0x27, 0x5a, 0x25, 0x6d, 0x6f, - 0x6e, 0x67, 0x6f, 0x2e, 0x67, 0x61, 0x6d, 0x65, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x61, - 0x6d, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2f, 0x6d, 0x61, 0x63, 0x68, - 0x69, 0x6e, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x09, 0x52, 0x0c, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x12, + 0x1a, 0x0a, 0x08, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x49, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x08, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x49, 0x64, 0x22, 0x69, 0x0a, 0x0b, 0x4d, + 0x53, 0x53, 0x65, 0x6e, 0x64, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x53, 0x6e, + 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x53, 0x6e, 0x69, 0x64, 0x12, 0x14, + 0x0a, 0x05, 0x41, 0x70, 0x70, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x41, + 0x70, 0x70, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x05, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x53, 0x74, + 0x72, 0x65, 0x61, 0x6d, 0x49, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x53, 0x74, + 0x72, 0x65, 0x61, 0x6d, 0x49, 0x64, 0x2a, 0xb9, 0x02, 0x0a, 0x13, 0x44, 0x6f, 0x6c, 0x6c, 0x4d, + 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x49, 0x44, 0x12, 0x1c, + 0x0a, 0x18, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x4d, 0x44, 0x6f, 0x6c, 0x6c, 0x4d, + 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x5a, 0x65, 0x72, 0x6f, 0x10, 0x00, 0x12, 0x1e, 0x0a, 0x18, + 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x4d, 0x47, 0x61, 0x6d, 0x65, 0x4c, 0x69, 0x6e, + 0x6b, 0x53, 0x75, 0x63, 0x63, 0x65, 0x65, 0x64, 0x10, 0xa0, 0x9c, 0x01, 0x12, 0x20, 0x0a, 0x1a, + 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x4d, 0x44, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x63, + 0x68, 0x69, 0x6e, 0x65, 0x50, 0x65, 0x72, 0x61, 0x74, 0x65, 0x10, 0xa1, 0x9c, 0x01, 0x12, 0x1e, + 0x0a, 0x18, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x4d, 0x44, 0x6f, 0x6c, 0x6c, 0x4d, + 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x47, 0x72, 0x61, 0x62, 0x10, 0xa2, 0x9c, 0x01, 0x12, 0x1e, + 0x0a, 0x18, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x4d, 0x53, 0x44, 0x6f, 0x6c, 0x6c, 0x4d, + 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x10, 0xa3, 0x9c, 0x01, 0x12, 0x26, + 0x0a, 0x20, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x4d, 0x53, 0x55, 0x70, 0x64, 0x61, 0x74, + 0x65, 0x44, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x53, 0x74, 0x61, 0x74, + 0x75, 0x73, 0x10, 0xa4, 0x9c, 0x01, 0x12, 0x27, 0x0a, 0x21, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, + 0x5f, 0x4d, 0x53, 0x44, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x6f, 0x50, + 0x65, 0x72, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x10, 0xa5, 0x9c, 0x01, 0x12, + 0x17, 0x0a, 0x11, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x4d, 0x47, 0x65, 0x74, 0x54, + 0x6f, 0x6b, 0x65, 0x6e, 0x10, 0xa6, 0x9c, 0x01, 0x12, 0x18, 0x0a, 0x12, 0x50, 0x41, 0x43, 0x4b, + 0x45, 0x54, 0x5f, 0x4d, 0x53, 0x53, 0x65, 0x6e, 0x64, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x10, 0xa7, + 0x9c, 0x01, 0x42, 0x27, 0x5a, 0x25, 0x6d, 0x6f, 0x6e, 0x67, 0x6f, 0x2e, 0x67, 0x61, 0x6d, 0x65, + 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x61, 0x6d, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x63, 0x6f, 0x6c, 0x2f, 0x6d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, } var ( diff --git a/protocol/machine/machine.proto b/protocol/machine/machine.proto index 472cb4b..a109267 100644 --- a/protocol/machine/machine.proto +++ b/protocol/machine/machine.proto @@ -64,10 +64,12 @@ message SMGetToken{ int32 Snid = 1; int64 AppId = 2; string ServerSecret = 3; + string StreamId = 4; } //返回token message MSSendToken{ int32 Snid = 1; int64 Appid = 2; string Token = 3; + string StreamId = 4; } \ No newline at end of file diff --git a/worldsrv/action_player.go b/worldsrv/action_player.go index d800fbe..66abe75 100644 --- a/worldsrv/action_player.go +++ b/worldsrv/action_player.go @@ -1938,6 +1938,9 @@ func CSPlayerData(s *netlib.Session, packetid int, data interface{}, sid int64) if (p.Channel == "" || p.Channel == "0") && p.Channel != msg.AppChannel { p.Channel = msg.AppChannel } + if ls.als.acc.ChannelId != "" && p.ChannelId == "" { + p.ChannelId = ls.als.acc.ChannelId + } if ls.clog != nil { PlayerSubjectSign.UpdateHeadUrl(p.SnId, ls.clog.HeadUrl) diff --git a/worldsrv/etcd.go b/worldsrv/etcd.go index d78a051..606899b 100644 --- a/worldsrv/etcd.go +++ b/worldsrv/etcd.go @@ -93,80 +93,10 @@ func init() { etcd.Register(etcd.ETCDKEY_MatchAudience, webapi.MatchAudience{}, handlerEvent) // 小精灵配置 etcd.Register(etcd.ETCDKEY_Spirit, webapi.SpiritConfig{}, platformConfigEvent) - - PlatformMgrSingleton.GetConfig("1").RoomType = map[int32]*webapi.RoomType{ - 1: { - Platform: "1", - Id: 1, - Name: "{\"zh\":\"话费赛\",\"kh\":\"话费赛\",\"vi\":\"话费赛\",\"en\":\"话费赛\"}", - On: 1, - SortId: 1, - }, - 2: { - Platform: "1", - Id: 2, - Name: "{\"zh\":\"物品赛\",\"kh\":\"物品赛\",\"vi\":\"物品赛\",\"en\":\"物品赛\"}", - On: 1, - SortId: 2, - }, - } - - PlatformMgrSingleton.UpdateRoomConfig(&webapi.RoomConfig{ - Platform: "1", - Id: 1, - Name: "{\"zh\":\"1元话费赛\",\"kh\":\"1元话费赛\",\"vi\":\"1元话费赛\",\"en\":\"1元话费赛\"}", - RoomType: 1, - On: 1, - SortId: 1, - Cost: []*webapi.ItemInfo{ - { - ItemId: 100001, - ItemNum: 12, - }, - }, - Reward: []*webapi.ItemInfo{ - { - ItemId: 100001, - ItemNum: 12, - }, - }, - OnChannelName: []string{common.ChannelOfficial, common.ChannelWeb, common.ChannelGooglePlay}, - GameFreeId: []int32{2150001, 2160001, 2170001, 2180001}, - Round: []int32{1, 2, 3, 4}, - PlayerNum: []int32{2, 3, 4}, - NeedPassword: 3, - CostType: 3, - Voice: 3, - ImageURI: "", - }) - PlatformMgrSingleton.UpdateRoomConfig(&webapi.RoomConfig{ - Platform: "1", - Id: 2, - Name: "{\"zh\":\"2元话费赛\",\"kh\":\"2元话费赛\",\"vi\":\"2元话费赛\",\"en\":\"2元话费赛\"}", - RoomType: 1, - On: 1, - SortId: 2, - Cost: []*webapi.ItemInfo{ - { - ItemId: 100001, - ItemNum: 12, - }, - }, - Reward: []*webapi.ItemInfo{ - { - ItemId: 100001, - ItemNum: 12, - }, - }, - OnChannelName: []string{common.ChannelOfficial, common.ChannelWeb, common.ChannelGooglePlay}, - GameFreeId: []int32{2150001, 2160001, 2170001, 2180001}, - Round: []int32{1, 2, 3, 4}, - PlayerNum: []int32{2, 3, 4}, - NeedPassword: 3, - CostType: 3, - Voice: 3, - ImageURI: "", - }) + // 竞技馆房间配置 + etcd.Register(etcd.ETCDKEY_RoomConfig, webapi.RoomConfig{}, handlerEvent) + // 竞技馆房间类型配置 + etcd.Register(etcd.ETCDKEY_RoomType, webapi.RoomType{}, handlerEvent) } func platformConfigEvent(ctx context.Context, completeKey string, isInit bool, event *clientv3.Event, data interface{}) { @@ -555,7 +485,7 @@ func handlerEvent(ctx context.Context, completeKey string, isInit bool, event *c config := data.(*webapi.RoomType) PlatformMgrSingleton.UpdateRoomType(config) if !isInit { - PlayerMgrSington.BroadcastMessageToPlatform(config.GetPlatform(), int(0), nil) + //PlayerMgrSington.BroadcastMessageToPlatform(config.GetPlatform(), int(0), nil) } case clientv3.EventTypeDelete: if plt == "" || len(param) == 0 { @@ -563,7 +493,7 @@ func handlerEvent(ctx context.Context, completeKey string, isInit bool, event *c } PlatformMgrSingleton.DelRoomType(plt, int32(param[0])) if !isInit { - PlayerMgrSington.BroadcastMessageToPlatform(plt, int(0), nil) + //PlayerMgrSington.BroadcastMessageToPlatform(plt, int(0), nil) } } diff --git a/worldsrv/scene.go b/worldsrv/scene.go index 333f90e..093a35e 100644 --- a/worldsrv/scene.go +++ b/worldsrv/scene.go @@ -514,8 +514,6 @@ func (this *Scene) lastScene(p *Player) { } func (this *Scene) DelPlayer(p *Player) bool { - FirePlayerLeaveScene(p, this) - this.sp.OnPlayerLeave(this, p) if p.scene != this { roomId := 0 if p.scene != nil { @@ -556,6 +554,8 @@ func (this *Scene) DelPlayer(p *Player) bool { if !p.IsRob { this.lastTime = time.Now() } + FirePlayerLeaveScene(p, this) + this.sp.OnPlayerLeave(this, p) return true } diff --git a/worldsrv/scenemgr.go b/worldsrv/scenemgr.go index 42c33e6..702bc49 100644 --- a/worldsrv/scenemgr.go +++ b/worldsrv/scenemgr.go @@ -192,25 +192,26 @@ func (m *SceneMgr) MarshalAllRoom(platform string, groupId, gameId int, gameMode } si := &webapiproto.RoomInfo{ - Platform: platformName, - SceneId: int32(s.sceneId), - GameId: int32(s.gameId), - GameMode: int32(s.gameMode), - SceneMode: int32(s.sceneMode), - GroupId: s.groupId, - Creator: s.creator, - ReplayCode: s.replayCode, - Params: common.CopySliceInt64ToInt32(s.params), - PlayerCnt: int32(len(s.players) - s.robotNum), - RobotCnt: int32(s.robotNum), - CreateTime: s.createTime.Unix(), - BaseScore: s.dbGameFree.BaseScore, - GameFreeId: s.dbGameFree.GetId(), - MaxRound: s.totalRound, - Password: s.GetPassword(), - CostType: s.GetCostType(), - Voice: s.GetVoice(), - CurrRound: s.currRound, + Platform: platformName, + SceneId: int32(s.sceneId), + GameId: int32(s.gameId), + GameMode: int32(s.gameMode), + SceneMode: int32(s.sceneMode), + GroupId: s.groupId, + GameFreeId: s.dbGameFree.GetId(), + Creator: s.creator, + ReplayCode: s.replayCode, + Params: common.CopySliceInt64ToInt32(s.params), + PlayerCnt: int32(len(s.players) - s.robotNum), + RobotCnt: int32(s.robotNum), + CreateTime: s.createTime.Unix(), + BaseScore: s.dbGameFree.BaseScore, + RoomConfigId: s.GetRoomConfigId(), + CurrRound: s.currRound, + MaxRound: s.totalRound, + Password: s.GetPassword(), + CostType: s.GetCostType(), + Voice: s.GetVoice(), } if s.starting { si.Start = 1 diff --git a/worldsrv/trascate_webapi.go b/worldsrv/trascate_webapi.go index 454fedd..bb2e4e6 100644 --- a/worldsrv/trascate_webapi.go +++ b/worldsrv/trascate_webapi.go @@ -3761,15 +3761,21 @@ func init() { p := PlayerMgrSington.GetPlayerBySnId(msg.GetSnid()) if p != nil { //获取道具Id - BagMgrSingleton.AddItemsV2(&model.AddItemParam{ + _, _, ok := BagMgrSingleton.AddItemsV2(&model.AddItemParam{ P: p.PlayerData, Change: items, GainWay: msg.GetTypeId(), Operator: "system", Remark: msg.GetRemark(), }) + if !ok { + logger.Logger.Errorf("player delete %v err: %v", msg, err) + pack.Tag = webapiproto.TagCode_FAILED + pack.Msg = "修改道具失败" + return common.ResponseTag_Ok, pack + } pack.Tag = webapiproto.TagCode_SUCCESS - pack.Msg = "AddItem success" + pack.Msg = "修改道具成功" return common.ResponseTag_Ok, pack } else { BagMgrSingleton.AddItemsOffline(msg.Platform, msg.Snid, items, msg.GetTypeId(), diff --git a/xlsx/DB_GameFree.xlsx b/xlsx/DB_GameFree.xlsx index f1116a6..ac8e3ac 100644 Binary files a/xlsx/DB_GameFree.xlsx and b/xlsx/DB_GameFree.xlsx differ