diff --git a/gamesrv/clawdoll/action_clawdoll.go b/gamesrv/clawdoll/action_clawdoll.go index 7036746..b0078c4 100644 --- a/gamesrv/clawdoll/action_clawdoll.go +++ b/gamesrv/clawdoll/action_clawdoll.go @@ -2,6 +2,7 @@ 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" @@ -52,6 +53,22 @@ func (h *CSPlayerOpHandler) Process(s *netlib.Session, packetid int, data interf func MSDollMachineoCoinResultHandler(session *netlib.Session, packetId int, data interface{}) error { logger.Logger.Tracef("收到返回上分结果!!!!!!!!!!") if msg, ok := data.(*machine.MSDollMachineoPerateResult); ok { + + p := base.PlayerMgrSington.GetPlayerBySnId(msg.GetSnid()) + if p == nil { + logger.Logger.Warn("CSGetTokenHandler p == nil") + 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 { @@ -61,10 +78,17 @@ func MSDollMachineoCoinResultHandler(session *netlib.Session, packetId int, data } case 2: if msg.Result == 1 { - logger.Logger.Tracef("下抓成功!!!!!!!!!!!!snid = ", msg.Snid) + } else { logger.Logger.Tracef("下抓失败!!!!!!!!!!!!snid = ", msg.Snid) } + + scene.ChangeSceneState(rule.ClawDollSceneStateBilled) + + sceneEx.SetPlayingState(int32(rule.ClawDollSceneStateBilled)) + + ClawdollBroadcastRoomState(scene) + ClawdollSendPlayerInfo(scene) } } return nil @@ -92,7 +116,6 @@ func (h *CSGetTokenHandler) Process(s *netlib.Session, packetid int, data interf } pack := &machine.SMGetToken{} pack.Snid = p.SnId - pack.Sid = p.GetSid() scene := p.GetScene() if scene == nil { @@ -123,7 +146,7 @@ func MSSendTokenHandler(session *netlib.Session, packetId int, data interface{}) if msg, ok := data.(*machine.MSSendToken); ok { //给客户端返回token token := msg.Token - p := base.PlayerMgrSington.GetPlayer(int64(msg.GetSid())) + p := base.PlayerMgrSington.GetPlayerBySnId(msg.GetSnid()) if p == nil { logger.Logger.Warn("MSSendTokenHandler p == nil") return nil diff --git a/gamesrv/clawdoll/player_clawdoll.go b/gamesrv/clawdoll/player_clawdoll.go index 34f3441..2fb434e 100644 --- a/gamesrv/clawdoll/player_clawdoll.go +++ b/gamesrv/clawdoll/player_clawdoll.go @@ -11,9 +11,10 @@ type PlayerEx struct { clawDollState int32 // 抓娃娃状态 dollCardsCnt int32 // 娃娃卡数量 - gainCoin int64 // 本局赢的金币 - taxCoin int64 // 本局税收 - odds int32 + winDollCardType int32 // 本局赢取娃娃的类型 + gainCoin int64 // 本局赢的金币 + taxCoin int64 // 本局税收 + odds int32 } func (this *PlayerEx) Clear(baseScore int32) { @@ -39,6 +40,12 @@ func (this *PlayerEx) CanPayCoin() bool { return true } +// 投币消耗 +func (this *PlayerEx) CostPlayCoin() bool { + + return true +} + // 能否移动 func (this *PlayerEx) CanMove() bool { diff --git a/gamesrv/clawdoll/scenepolicy_clawdoll.go b/gamesrv/clawdoll/scenepolicy_clawdoll.go index 6246929..114e41c 100644 --- a/gamesrv/clawdoll/scenepolicy_clawdoll.go +++ b/gamesrv/clawdoll/scenepolicy_clawdoll.go @@ -283,7 +283,6 @@ func (this *PolicyClawdoll) SendGetVideoToken(s *base.Scene, p *base.Player, sce } pack := &machine.SMGetToken{} pack.Snid = p.SnId - pack.Sid = p.GetSid() machineId := s.DbGameFree.GetId() % 6080000 appId, serverSecret := sceneEx.GetMachineServerSecret(machineId, p.Platform) @@ -419,6 +418,7 @@ func (this *BaseState) OnEnter(s *base.Scene) { func (this *BaseState) OnLeave(s *base.Scene) {} func (this *BaseState) OnTick(s *base.Scene) { + } func (this *BaseState) OnPlayerOp(s *base.Scene, p *base.Player, opcode int, params []int64) bool { @@ -666,10 +666,6 @@ 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)) - case rule.ClawDollPlayerOpMove: if !sceneEx.CheckMoveOp(playerEx) { @@ -697,15 +693,9 @@ 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) } - 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 561f364..ea9d138 100644 --- a/machine/action/action_server.go +++ b/machine/action/action_server.go @@ -300,7 +300,6 @@ func SMGetTokenHandler(session *netlib.Session, packetId int, data interface{}) info := &machine.MSSendToken{} info.Snid = msg.Snid info.Token = token - info.Sid = msg.GetSid() info.Appid = msg.AppId session.Send(int(machine.DollMachinePacketID_PACKET_MSSendToken), info) diff --git a/protocol/machine/machine.pb.go b/protocol/machine/machine.pb.go index 39a1133..464b384 100644 --- a/protocol/machine/machine.pb.go +++ b/protocol/machine/machine.pb.go @@ -505,7 +505,6 @@ 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"` - Sid int64 `protobuf:"varint,4,opt,name=Sid,proto3" json:"Sid,omitempty"` } func (x *SMGetToken) Reset() { @@ -561,13 +560,6 @@ func (x *SMGetToken) GetServerSecret() string { return "" } -func (x *SMGetToken) GetSid() int64 { - if x != nil { - return x.Sid - } - return 0 -} - //返回token type MSSendToken struct { state protoimpl.MessageState @@ -577,7 +569,6 @@ type MSSendToken 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"` Token string `protobuf:"bytes,3,opt,name=Token,proto3" json:"Token,omitempty"` - Sid int64 `protobuf:"varint,4,opt,name=Sid,proto3" json:"Sid,omitempty"` } func (x *MSSendToken) Reset() { @@ -633,13 +624,6 @@ func (x *MSSendToken) GetToken() string { return "" } -func (x *MSSendToken) GetSid() int64 { - if x != nil { - return x.Sid - } - return 0 -} - var File_machine_proto protoreflect.FileDescriptor var file_machine_proto_rawDesc = []byte{ @@ -677,42 +661,40 @@ 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, 0x6c, 0x0a, 0x0a, 0x53, 0x4d, 0x47, 0x65, 0x74, 0x54, 0x6f, 0x6b, 0x65, + 0x64, 0x64, 0x72, 0x22, 0x5a, 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, 0x12, - 0x10, 0x0a, 0x03, 0x53, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x53, 0x69, - 0x64, 0x22, 0x5f, 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, 0x10, 0x0a, 0x03, 0x53, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x53, - 0x69, 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, + 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, } var ( diff --git a/protocol/machine/machine.proto b/protocol/machine/machine.proto index 5cbb18e..472cb4b 100644 --- a/protocol/machine/machine.proto +++ b/protocol/machine/machine.proto @@ -64,12 +64,10 @@ message SMGetToken{ int32 Snid = 1; int64 AppId = 2; string ServerSecret = 3; - int64 Sid = 4; } //返回token message MSSendToken{ int32 Snid = 1; int64 Appid = 2; string Token = 3; - int64 Sid = 4; } \ No newline at end of file