From 6e16eb1d5264894f5c7da2b84ed253714c92ffa6 Mon Sep 17 00:00:00 2001 From: tomas Date: Tue, 10 Sep 2024 11:32:04 +0800 Subject: [PATCH] add billed code --- .../scenepolicy_fortunedragon.go | 16 ++++- gamesrv/slotspkg/assemble/datatocli.go | 4 +- protocol/fortunedragon/fortunedragon.pb.go | 62 +++++++++++-------- protocol/fortunedragon/fortunedragon.proto | 3 +- 4 files changed, 55 insertions(+), 30 deletions(-) diff --git a/gamesrv/fortunedragon/scenepolicy_fortunedragon.go b/gamesrv/fortunedragon/scenepolicy_fortunedragon.go index f35de18..fd96ab3 100644 --- a/gamesrv/fortunedragon/scenepolicy_fortunedragon.go +++ b/gamesrv/fortunedragon/scenepolicy_fortunedragon.go @@ -362,6 +362,19 @@ func (this *SceneStateStartFortuneDragon) OnPlayerOp(s *base.Scene, p *base.Play switch opcode { case fortunedragon.FortuneDragonPlayerOpStart: playerEx.Clear() + if len(params) < 4 { + pack := &protocol.SCFortuneDragonBilled{ + OpRetCode: proto.Int32(1), + } + proto.SetDefaults(pack) + logger.Logger.Trace("SCFortuneDragonBilled", pack.String()) + playerEx.SendToClient(int(protocol.FortuneDragonPID_PACKET_FORTUNEDRAGON_SCFORTUNEDRAGONOP), pack) + return true + } + playerEx.BetSizeIndex = params[0] + playerEx.BetLevelIndex = params[1] + playerEx.BetLineIndex = params[2] + playerEx.BetMode = params[3] //get data Response, err := slots.SlotsMgrSington.Play(playerEx.SlotsSession, &base.SpinReq{ GameId: int64(sceneEx.GameId), @@ -373,7 +386,7 @@ func (this *SceneStateStartFortuneDragon) OnPlayerOp(s *base.Scene, p *base.Play }) var gameEndStr string if err == nil { - data := assemble.DataToCli(Response).(assemble.TableInfo) + data := assemble.DataToCli(Response).(assemble.GameEnd) pi, _ := json.Marshal(data) gameEndStr = string(pi) playerEx.Coin = Response.Coin @@ -381,6 +394,7 @@ func (this *SceneStateStartFortuneDragon) OnPlayerOp(s *base.Scene, p *base.Play logger.Logger.Error("slots enter err:", err) } pack := &protocol.SCFortuneDragonBilled{ + OpRetCode: proto.Int32(0), GameEndStr: proto.String(gameEndStr), } proto.SetDefaults(pack) diff --git a/gamesrv/slotspkg/assemble/datatocli.go b/gamesrv/slotspkg/assemble/datatocli.go index c412acd..fa3bc95 100644 --- a/gamesrv/slotspkg/assemble/datatocli.go +++ b/gamesrv/slotspkg/assemble/datatocli.go @@ -48,7 +48,7 @@ func DataToCli(response any) interface{} { case *cli.SlotsPlayResponse: res := response2NodeTree(Response.NodeTree) ress := []*shared.Result{res} - GameEnd := shared.GameEndDto{ + gameEnd := shared.GameEndDto{ Results: ress, RoundReward: Response.NodeTree.Nodes[0].ChildrenTotalWin, TotalBet: Response.NodeTree.BetCoin.GetCoin(), @@ -60,7 +60,7 @@ func DataToCli(response any) interface{} { } //a, _ := json.Marshal(GameEnd) //logx.Error("GameEnd:", string(a)) - return GameEnd + return SpinRes2Dto(gameEnd) default: } diff --git a/protocol/fortunedragon/fortunedragon.pb.go b/protocol/fortunedragon/fortunedragon.pb.go index 29ae44e..8e97687 100644 --- a/protocol/fortunedragon/fortunedragon.pb.go +++ b/protocol/fortunedragon/fortunedragon.pb.go @@ -529,7 +529,8 @@ type SCFortuneDragonBilled struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - GameEndStr string `protobuf:"bytes,1,opt,name=GameEndStr,proto3" json:"GameEndStr,omitempty"` + OpRetCode int32 `protobuf:"varint,1,opt,name=OpRetCode,proto3" json:"OpRetCode,omitempty"` //0.spin成功 1.spin失败 + GameEndStr string `protobuf:"bytes,2,opt,name=GameEndStr,proto3" json:"GameEndStr,omitempty"` } func (x *SCFortuneDragonBilled) Reset() { @@ -564,6 +565,13 @@ func (*SCFortuneDragonBilled) Descriptor() ([]byte, []int) { return file_fortunedragon_proto_rawDescGZIP(), []int{5} } +func (x *SCFortuneDragonBilled) GetOpRetCode() int32 { + if x != nil { + return x.OpRetCode + } + return 0 +} + func (x *SCFortuneDragonBilled) GetGameEndStr() string { if x != nil { return x.GameEndStr @@ -631,32 +639,34 @@ var file_fortunedragon_proto_rawDesc = []byte{ 0x74, 0x61, 0x74, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x53, 0x75, 0x62, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x53, 0x75, 0x62, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x05, - 0x52, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x37, 0x0a, 0x15, 0x53, 0x43, 0x46, 0x6f, + 0x52, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x55, 0x0a, 0x15, 0x53, 0x43, 0x46, 0x6f, 0x72, 0x74, 0x75, 0x6e, 0x65, 0x44, 0x72, 0x61, 0x67, 0x6f, 0x6e, 0x42, 0x69, 0x6c, 0x6c, 0x65, - 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x47, 0x61, 0x6d, 0x65, 0x45, 0x6e, 0x64, 0x53, 0x74, 0x72, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x47, 0x61, 0x6d, 0x65, 0x45, 0x6e, 0x64, 0x53, 0x74, - 0x72, 0x2a, 0xa3, 0x02, 0x0a, 0x10, 0x46, 0x6f, 0x72, 0x74, 0x75, 0x6e, 0x65, 0x44, 0x72, 0x61, - 0x67, 0x6f, 0x6e, 0x50, 0x49, 0x44, 0x12, 0x1d, 0x0a, 0x19, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, - 0x5f, 0x46, 0x4f, 0x52, 0x54, 0x55, 0x4e, 0x45, 0x44, 0x52, 0x41, 0x47, 0x4f, 0x4e, 0x5f, 0x5a, - 0x45, 0x52, 0x4f, 0x10, 0x00, 0x12, 0x31, 0x0a, 0x2c, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, - 0x46, 0x4f, 0x52, 0x54, 0x55, 0x4e, 0x45, 0x44, 0x52, 0x41, 0x47, 0x4f, 0x4e, 0x5f, 0x53, 0x43, - 0x46, 0x4f, 0x52, 0x54, 0x55, 0x4e, 0x45, 0x44, 0x52, 0x41, 0x47, 0x4f, 0x4e, 0x52, 0x4f, 0x4f, - 0x4d, 0x49, 0x4e, 0x46, 0x4f, 0x10, 0xe0, 0x2b, 0x12, 0x2b, 0x0a, 0x26, 0x50, 0x41, 0x43, 0x4b, - 0x45, 0x54, 0x5f, 0x46, 0x4f, 0x52, 0x54, 0x55, 0x4e, 0x45, 0x44, 0x52, 0x41, 0x47, 0x4f, 0x4e, - 0x5f, 0x43, 0x53, 0x46, 0x4f, 0x52, 0x54, 0x55, 0x4e, 0x45, 0x44, 0x52, 0x41, 0x47, 0x4f, 0x4e, - 0x4f, 0x50, 0x10, 0xe1, 0x2b, 0x12, 0x2b, 0x0a, 0x26, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, - 0x46, 0x4f, 0x52, 0x54, 0x55, 0x4e, 0x45, 0x44, 0x52, 0x41, 0x47, 0x4f, 0x4e, 0x5f, 0x53, 0x43, - 0x46, 0x4f, 0x52, 0x54, 0x55, 0x4e, 0x45, 0x44, 0x52, 0x41, 0x47, 0x4f, 0x4e, 0x4f, 0x50, 0x10, - 0xe2, 0x2b, 0x12, 0x32, 0x0a, 0x2d, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x46, 0x4f, 0x52, - 0x54, 0x55, 0x4e, 0x45, 0x44, 0x52, 0x41, 0x47, 0x4f, 0x4e, 0x5f, 0x53, 0x43, 0x46, 0x4f, 0x52, - 0x54, 0x55, 0x4e, 0x45, 0x44, 0x52, 0x41, 0x47, 0x4f, 0x4e, 0x52, 0x4f, 0x4f, 0x4d, 0x53, 0x54, - 0x41, 0x54, 0x45, 0x10, 0xe3, 0x2b, 0x12, 0x2f, 0x0a, 0x2a, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, - 0x5f, 0x46, 0x4f, 0x52, 0x54, 0x55, 0x4e, 0x45, 0x44, 0x52, 0x41, 0x47, 0x4f, 0x4e, 0x5f, 0x53, - 0x43, 0x46, 0x4f, 0x52, 0x54, 0x55, 0x4e, 0x45, 0x44, 0x52, 0x41, 0x47, 0x4f, 0x4e, 0x42, 0x49, - 0x4c, 0x4c, 0x45, 0x44, 0x10, 0xe4, 0x2b, 0x42, 0x2d, 0x5a, 0x2b, 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, 0x66, 0x6f, 0x72, 0x74, 0x75, 0x6e, 0x65, - 0x64, 0x72, 0x61, 0x67, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x4f, 0x70, 0x52, 0x65, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x4f, 0x70, 0x52, 0x65, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x12, + 0x1e, 0x0a, 0x0a, 0x47, 0x61, 0x6d, 0x65, 0x45, 0x6e, 0x64, 0x53, 0x74, 0x72, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0a, 0x47, 0x61, 0x6d, 0x65, 0x45, 0x6e, 0x64, 0x53, 0x74, 0x72, 0x2a, + 0xa3, 0x02, 0x0a, 0x10, 0x46, 0x6f, 0x72, 0x74, 0x75, 0x6e, 0x65, 0x44, 0x72, 0x61, 0x67, 0x6f, + 0x6e, 0x50, 0x49, 0x44, 0x12, 0x1d, 0x0a, 0x19, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x46, + 0x4f, 0x52, 0x54, 0x55, 0x4e, 0x45, 0x44, 0x52, 0x41, 0x47, 0x4f, 0x4e, 0x5f, 0x5a, 0x45, 0x52, + 0x4f, 0x10, 0x00, 0x12, 0x31, 0x0a, 0x2c, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x46, 0x4f, + 0x52, 0x54, 0x55, 0x4e, 0x45, 0x44, 0x52, 0x41, 0x47, 0x4f, 0x4e, 0x5f, 0x53, 0x43, 0x46, 0x4f, + 0x52, 0x54, 0x55, 0x4e, 0x45, 0x44, 0x52, 0x41, 0x47, 0x4f, 0x4e, 0x52, 0x4f, 0x4f, 0x4d, 0x49, + 0x4e, 0x46, 0x4f, 0x10, 0xe0, 0x2b, 0x12, 0x2b, 0x0a, 0x26, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, + 0x5f, 0x46, 0x4f, 0x52, 0x54, 0x55, 0x4e, 0x45, 0x44, 0x52, 0x41, 0x47, 0x4f, 0x4e, 0x5f, 0x43, + 0x53, 0x46, 0x4f, 0x52, 0x54, 0x55, 0x4e, 0x45, 0x44, 0x52, 0x41, 0x47, 0x4f, 0x4e, 0x4f, 0x50, + 0x10, 0xe1, 0x2b, 0x12, 0x2b, 0x0a, 0x26, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x46, 0x4f, + 0x52, 0x54, 0x55, 0x4e, 0x45, 0x44, 0x52, 0x41, 0x47, 0x4f, 0x4e, 0x5f, 0x53, 0x43, 0x46, 0x4f, + 0x52, 0x54, 0x55, 0x4e, 0x45, 0x44, 0x52, 0x41, 0x47, 0x4f, 0x4e, 0x4f, 0x50, 0x10, 0xe2, 0x2b, + 0x12, 0x32, 0x0a, 0x2d, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x46, 0x4f, 0x52, 0x54, 0x55, + 0x4e, 0x45, 0x44, 0x52, 0x41, 0x47, 0x4f, 0x4e, 0x5f, 0x53, 0x43, 0x46, 0x4f, 0x52, 0x54, 0x55, + 0x4e, 0x45, 0x44, 0x52, 0x41, 0x47, 0x4f, 0x4e, 0x52, 0x4f, 0x4f, 0x4d, 0x53, 0x54, 0x41, 0x54, + 0x45, 0x10, 0xe3, 0x2b, 0x12, 0x2f, 0x0a, 0x2a, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x46, + 0x4f, 0x52, 0x54, 0x55, 0x4e, 0x45, 0x44, 0x52, 0x41, 0x47, 0x4f, 0x4e, 0x5f, 0x53, 0x43, 0x46, + 0x4f, 0x52, 0x54, 0x55, 0x4e, 0x45, 0x44, 0x52, 0x41, 0x47, 0x4f, 0x4e, 0x42, 0x49, 0x4c, 0x4c, + 0x45, 0x44, 0x10, 0xe4, 0x2b, 0x42, 0x2d, 0x5a, 0x2b, 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, 0x66, 0x6f, 0x72, 0x74, 0x75, 0x6e, 0x65, 0x64, 0x72, + 0x61, 0x67, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/protocol/fortunedragon/fortunedragon.proto b/protocol/fortunedragon/fortunedragon.proto index 879c9e5..417d7ec 100644 --- a/protocol/fortunedragon/fortunedragon.proto +++ b/protocol/fortunedragon/fortunedragon.proto @@ -63,5 +63,6 @@ message SCFortuneDragonRoomState { } //PACKET_FORTUNEDRAGON_SCFORTUNEDRAGONBILLED message SCFortuneDragonBilled{ - string GameEndStr = 1; + int32 OpRetCode = 1;//0.spin成功 1.spin失败 + string GameEndStr = 2; } \ No newline at end of file