Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
plugin
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
link33
plugin
Commits
6ed5261f
Commit
6ed5261f
authored
Nov 23, 2018
by
张振华
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
guess
parent
d467a916
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
5391 additions
and
0 deletions
+5391
-0
game.go
plugin/dapp/guess/commands/game.go
+270
-0
doc.go
plugin/dapp/guess/executor/doc.go
+48
-0
exec.go
plugin/dapp/guess/executor/exec.go
+26
-0
exec_del_local.go
plugin/dapp/guess/executor/exec_del_local.go
+55
-0
exec_local.go
plugin/dapp/guess/executor/exec_local.go
+86
-0
guess.go
plugin/dapp/guess/executor/guess.go
+137
-0
guessdb.go
plugin/dapp/guess/executor/guessdb.go
+806
-0
poker.go
plugin/dapp/guess/executor/poker.go
+234
-0
query.go
plugin/dapp/guess/executor/query.go
+40
-0
plugin.go
plugin/dapp/guess/plugin.go
+23
-0
Makefile
plugin/dapp/guess/proto/Makefile
+2
-0
create_protobuf.sh
plugin/dapp/guess/proto/create_protobuf.sh
+2
-0
guess.proto
plugin/dapp/guess/proto/guess.proto
+288
-0
jrpc.go
plugin/dapp/guess/rpc/jrpc.go
+110
-0
jrpc_channel_test.go
plugin/dapp/guess/rpc/jrpc_channel_test.go
+96
-0
rpc.go
plugin/dapp/guess/rpc/rpc.go
+83
-0
tx.go
plugin/dapp/guess/rpc/tx.go
+26
-0
types.go
plugin/dapp/guess/rpc/types.go
+27
-0
const.go
plugin/dapp/guess/types/const.go
+57
-0
guess.pb.go
plugin/dapp/guess/types/guess.pb.go
+2888
-0
types.go
plugin/dapp/guess/types/types.go
+87
-0
No files found.
plugin/dapp/guess/commands/game.go
0 → 100644
View file @
6ed5261f
// Copyright Fuzamei Corp. 2018 All Rights Reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package
commands
import
(
"fmt"
"go.uber.org/zap"
"strconv"
jsonrpc
"github.com/33cn/chain33/rpc/jsonclient"
"github.com/33cn/chain33/types"
pkt
"github.com/33cn/plugin/plugin/dapp/guess/types"
"github.com/spf13/cobra"
)
func
GuessCmd
()
*
cobra
.
Command
{
cmd
:=
&
cobra
.
Command
{
Use
:
"guess"
,
Short
:
"guess game management"
,
Args
:
cobra
.
MinimumNArgs
(
1
),
}
cmd
.
AddCommand
(
GuessStartRawTxCmd
(),
GuessBetRawTxCmd
(),
GuessAbortRawTxCmd
(),
GuessQueryRawTxCmd
(),
GuessPublishRawTxCmd
(),
)
return
cmd
}
func
GuessStartRawTxCmd
()
*
cobra
.
Command
{
cmd
:=
&
cobra
.
Command
{
Use
:
"start"
,
Short
:
"start a new guess game"
,
Run
:
guessStart
,
}
addGuessStartFlags
(
cmd
)
return
cmd
}
func
addGuessStartFlags
(
cmd
*
cobra
.
Command
)
{
cmd
.
Flags
()
.
StringP
(
"topic"
,
"t"
,
""
,
"topic"
)
cmd
.
MarkFlagRequired
(
"topic"
)
cmd
.
Flags
()
.
StringP
(
"options"
,
"o"
,
""
,
"options"
)
cmd
.
MarkFlagRequired
(
"options"
)
cmd
.
Flags
()
.
Uint32P
(
"maxHeight"
,
"h"
,
0
,
"max height to bet"
)
cmd
.
MarkFlagRequired
(
"maxHeight"
)
cmd
.
Flags
()
.
StringP
(
"symbol"
,
"s"
,
"bty"
,
"token symbol"
)
cmd
.
Flags
()
.
StringP
(
"exec"
,
"e"
,
"coins"
,
"excutor name"
)
cmd
.
Flags
()
.
Uint32P
(
"oneBet"
,
"b"
,
0
,
"one bet number"
)
cmd
.
MarkFlagRequired
(
"oneBet"
)
cmd
.
Flags
()
.
Uint32P
(
"maxBets"
,
"m"
,
0
,
"max bets one time"
)
cmd
.
MarkFlagRequired
(
"maxBets"
)
cmd
.
Flags
()
.
Uint32P
(
"maxBetsNumber"
,
"n"
,
100
,
"max bets number"
)
cmd
.
MarkFlagRequired
(
"maxBetsNumber"
)
cmd
.
Flags
()
.
Float64P
(
"fee"
,
"f"
,
0
,
"fee"
)
cmd
.
Flags
()
.
StringP
(
"feeAddr"
,
"a"
,
""
,
"fee address"
)
}
func
guessStart
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
rpcLaddr
,
_
:=
cmd
.
Flags
()
.
GetString
(
"rpc_laddr"
)
topic
,
_
:=
cmd
.
Flags
()
.
GetString
(
"topic"
)
options
,
_
:=
cmd
.
Flags
()
.
GetString
(
"options"
)
maxHeight
,
_
:=
cmd
.
Flags
()
.
GetUint32
(
"maxHeight"
)
symbol
,
_
:=
cmd
.
Flags
()
.
GetString
(
"symbol"
)
exec
,
_
:=
cmd
.
Flags
()
.
GetString
(
"exec"
)
oneBet
,
_
:=
cmd
.
Flags
()
.
GetUint32
(
"oneBet"
)
maxBets
,
_
:=
cmd
.
Flags
()
.
GetUint32
(
"maxBets"
)
maxBetsNumber
,
_
:=
cmd
.
Flags
()
.
GetUint32
(
"maxBetsNumber"
)
fee
,
_
:=
cmd
.
Flags
()
.
GetFloat64
(
"fee"
)
feeAddr
,
_
:=
cmd
.
Flags
()
.
GetString
(
"feeAddr"
)
feeInt64
:=
uint64
(
fee
*
1e4
)
params
:=
&
pkt
.
GuessStartTxReq
{
Topic
:
topic
,
Options
:
options
,
MaxHeight
:
maxHeight
,
Symbol
:
symbol
,
Exec
:
exec
,
OneBet
:
oneBet
,
MaxBets
:
maxBets
,
MaxBetsNumber
:
maxBetsNumber
,
Fee
:
feeInt64
,
FeeAddr
:
feeAddr
,
}
var
res
string
ctx
:=
jsonrpc
.
NewRpcCtx
(
rpcLaddr
,
"guess.GuessStartTx"
,
params
,
&
res
)
ctx
.
RunWithoutMarshal
()
}
func
GuessBetRawTxCmd
()
*
cobra
.
Command
{
cmd
:=
&
cobra
.
Command
{
Use
:
"bet"
,
Short
:
"bet for one option in a guess game"
,
Run
:
guessBet
,
}
addGuessBetFlags
(
cmd
)
return
cmd
}
func
addGuessBetFlags
(
cmd
*
cobra
.
Command
)
{
cmd
.
Flags
()
.
StringP
(
"gameId"
,
"g"
,
""
,
"game ID"
)
cmd
.
MarkFlagRequired
(
"gameId"
)
cmd
.
Flags
()
.
StringP
(
"option"
,
"o"
,
""
,
"option"
)
cmd
.
MarkFlagRequired
(
"option"
)
cmd
.
Flags
()
.
Uint32P
(
"betsNumber"
,
"b"
,
1
,
"bets number for one option in a guess game"
)
cmd
.
MarkFlagRequired
(
"betsNumber"
)
}
func
guessBet
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
rpcLaddr
,
_
:=
cmd
.
Flags
()
.
GetString
(
"rpc_laddr"
)
gameId
,
_
:=
cmd
.
Flags
()
.
GetString
(
"gameId"
)
option
,
_
:=
cmd
.
Flags
()
.
GetString
(
"option"
)
betsNumber
,
_
:=
cmd
.
Flags
()
.
GetUint32
(
"betsNumber"
)
params
:=
&
pkt
.
GuessBetTxReq
{
GameId
:
gameId
,
Option
:
option
,
Bets
:
betsNumber
,
}
var
res
string
ctx
:=
jsonrpc
.
NewRpcCtx
(
rpcLaddr
,
"guess.GuessBetTx"
,
params
,
&
res
)
ctx
.
RunWithoutMarshal
()
}
func
GuessAbortRawTxCmd
()
*
cobra
.
Command
{
cmd
:=
&
cobra
.
Command
{
Use
:
"abort"
,
Short
:
"abort a guess game"
,
Run
:
guessAbort
,
}
addGuessAbortFlags
(
cmd
)
return
cmd
}
func
addGuessAbortFlags
(
cmd
*
cobra
.
Command
)
{
cmd
.
Flags
()
.
StringP
(
"gameId"
,
"g"
,
""
,
"game Id"
)
cmd
.
MarkFlagRequired
(
"gameId"
)
}
func
guessAbort
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
rpcLaddr
,
_
:=
cmd
.
Flags
()
.
GetString
(
"rpc_laddr"
)
gameId
,
_
:=
cmd
.
Flags
()
.
GetString
(
"gameId"
)
params
:=
&
pkt
.
GuessAbortTxReq
{
GameId
:
gameId
,
}
var
res
string
ctx
:=
jsonrpc
.
NewRpcCtx
(
rpcLaddr
,
"guess.GuessAbortTx"
,
params
,
&
res
)
ctx
.
RunWithoutMarshal
()
}
func
GuessPublishRawTxCmd
()
*
cobra
.
Command
{
cmd
:=
&
cobra
.
Command
{
Use
:
"publish"
,
Short
:
"publish the result of a guess game"
,
Run
:
guessPublish
,
}
addGuessPublishFlags
(
cmd
)
return
cmd
}
func
addGuessPublishFlags
(
cmd
*
cobra
.
Command
)
{
cmd
.
Flags
()
.
StringP
(
"gameId"
,
"g"
,
""
,
"game Id of a guess game"
)
cmd
.
MarkFlagRequired
(
"gameId"
)
cmd
.
Flags
()
.
StringP
(
"result"
,
"r"
,
""
,
"result of a guess game"
)
cmd
.
MarkFlagRequired
(
"result"
)
}
func
guessPublish
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
rpcLaddr
,
_
:=
cmd
.
Flags
()
.
GetString
(
"rpc_laddr"
)
gameId
,
_
:=
cmd
.
Flags
()
.
GetString
(
"gameId"
)
result
,
_
:=
cmd
.
Flags
()
.
GetString
(
"result"
)
params
:=
&
pkt
.
GuessPublishTxReq
{
GameId
:
gameId
,
Result
:
result
,
}
var
res
string
ctx
:=
jsonrpc
.
NewRpcCtx
(
rpcLaddr
,
"guess.GuessPublishTx"
,
params
,
&
res
)
ctx
.
RunWithoutMarshal
()
}
func
GuessQueryRawTxCmd
()
*
cobra
.
Command
{
cmd
:=
&
cobra
.
Command
{
Use
:
"query"
,
Short
:
"Query result"
,
Run
:
guessQuery
,
}
addGuessQueryFlags
(
cmd
)
return
cmd
}
func
addGuessQueryFlags
(
cmd
*
cobra
.
Command
)
{
cmd
.
Flags
()
.
StringP
(
"gameID"
,
"g"
,
""
,
"game ID"
)
cmd
.
Flags
()
.
StringP
(
"address"
,
"a"
,
""
,
"address"
)
cmd
.
Flags
()
.
StringP
(
"index"
,
"i"
,
""
,
"index"
)
cmd
.
Flags
()
.
StringP
(
"status"
,
"s"
,
""
,
"status"
)
cmd
.
Flags
()
.
StringP
(
"gameIDs"
,
"d"
,
""
,
"gameIDs"
)
}
func
guessQuery
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
rpcLaddr
,
_
:=
cmd
.
Flags
()
.
GetString
(
"rpc_laddr"
)
gameID
,
_
:=
cmd
.
Flags
()
.
GetString
(
"gameID"
)
address
,
_
:=
cmd
.
Flags
()
.
GetString
(
"address"
)
statusStr
,
_
:=
cmd
.
Flags
()
.
GetString
(
"status"
)
status
,
_
:=
strconv
.
ParseInt
(
statusStr
,
10
,
32
)
indexstr
,
_
:=
cmd
.
Flags
()
.
GetString
(
"index"
)
index
,
_
:=
strconv
.
ParseInt
(
indexstr
,
10
,
64
)
gameIDs
,
_
:=
cmd
.
Flags
()
.
GetString
(
"gameIDs"
)
var
params
types
.
Query4Cli
params
.
Execer
=
pkt
.
PokerBullX
req
:=
&
pkt
.
QueryPBGameInfo
{
GameId
:
gameID
,
Addr
:
address
,
Status
:
int32
(
status
),
Index
:
index
,
}
params
.
Payload
=
req
if
gameID
!=
""
{
params
.
FuncName
=
pkt
.
FuncName_QueryGameById
var
res
pkt
.
ReplyPBGame
ctx
:=
jsonrpc
.
NewRpcCtx
(
rpcLaddr
,
"Chain33.Query"
,
params
,
&
res
)
ctx
.
Run
()
}
else
if
address
!=
""
{
params
.
FuncName
=
pkt
.
FuncName_QueryGameByAddr
var
res
pkt
.
PBGameRecords
ctx
:=
jsonrpc
.
NewRpcCtx
(
rpcLaddr
,
"Chain33.Query"
,
params
,
&
res
)
ctx
.
Run
()
}
else
if
statusStr
!=
""
{
params
.
FuncName
=
pkt
.
FuncName_QueryGameByStatus
var
res
pkt
.
PBGameRecords
ctx
:=
jsonrpc
.
NewRpcCtx
(
rpcLaddr
,
"Chain33.Query"
,
params
,
&
res
)
ctx
.
Run
()
}
else
if
gameIDs
!=
""
{
params
.
FuncName
=
pkt
.
FuncName_QueryGameListByIds
var
gameIDsS
[]
string
gameIDsS
=
append
(
gameIDsS
,
gameIDs
)
gameIDsS
=
append
(
gameIDsS
,
gameIDs
)
req
:=
&
pkt
.
QueryPBGameInfos
{
gameIDsS
}
params
.
Payload
=
req
var
res
pkt
.
ReplyPBGameList
ctx
:=
jsonrpc
.
NewRpcCtx
(
rpcLaddr
,
"Chain33.Query"
,
params
,
&
res
)
ctx
.
Run
()
}
else
{
fmt
.
Println
(
"Error: requeres at least one of gameID, address or status"
)
cmd
.
Help
()
}
}
plugin/dapp/guess/executor/doc.go
0 → 100644
View file @
6ed5261f
// Copyright Fuzamei Corp. 2018 All Rights Reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package
executor
/*
区块链卡牌游戏:斗牛
一、玩法简介:
游戏可以由2-5人进行,总共52张牌(除大小王),系统将随机发给玩家每人5张牌,并根据5张牌进行排列组合,进行大小比较确定胜负。
支持两种游戏玩法,普通玩法和庄家玩法
普通玩法:没有庄家,所有玩家直接比大小,最大的玩家赢得所有筹码
庄家玩法:玩家只和庄家比大小,比庄家大则赢得庄家筹码,反之则输给庄家筹码,庄家有创建者开始按加入游戏的顺序轮换
二、发牌和洗牌
1、洗牌由游戏创建者发起交易的区块时间blocktime作为随机数因子,所以排序链上可见
2、发牌使用各玩家加入游戏所在交易的hash作为随机数因子,由于nonce的存在,txhash本身具有随机性,且每个玩家每一局的txhash都不一样,可以保证发牌具有随机性
三、制胜策略
将玩家a的5张牌分为两组(3+2)后,与玩家b进行大小比较。
1、第一组3张牌的比较规则:要求将5张牌中取出任意3张组成10、20、30的整数(加法运算)。数字A-10的扑克牌数字代表其大小,JQK统一以10计算。
若玩家a和b有那么三张牌能凑成10或20或30的整数,我们称之为有牛,那么则进行第2组两张牌的大小比较。若玩家a或b有某人无法使用3张牌凑成10或20
或30的整数,我们称之为没牛,同时该玩家判定为输。
2、第二组牌的比较则把剩下的两张牌按照加法计算,10的整数倍数最大,1最小,若大于10小于20则取个位数计算。数字越大则牌型越大,数字越小则牌型
越小。若第2组牌数字为1我们称之为牛一,若第2组数字为10或20我们称之为牛牛,其他以牛二、牛三等名称称呼。牌型从小到大排序为:没牛-牛一-牛二……牛八-牛九-牛牛。
3、若玩家a和b都无法使用3张牌凑成10或20或30的整数,即两家均无牛,则此时进行5张牌中最大一张牌的比较,大小次序为K-Q-J-10-9……A,若最大一
张牌也相同则根据花色进行比较,大小次序为黑桃、红桃、梅花、方片。
4、牌型翻倍
没牛、牛1-6: 1倍
牛7-9: 2倍
牛牛: 3倍
四花: 4倍
五花: 5倍
四、游戏过程和状态
1、充值,往pokerbull合约对应的合约账户充值
2、玩家指定游戏人数和筹码加入游戏,如果有等待状态的游戏,直接加入,如果没有,创建新游戏
3、等待指定游戏人数的玩家加入,等待期间,可发送quit交易退出
4、最后一名玩家加入,游戏开始、发牌,计算结果
5、根据结果,划转筹码
6、合约账户提现到真实账户
7、状态:start->continue->quit
*/
plugin/dapp/guess/executor/exec.go
0 → 100644
View file @
6ed5261f
// Copyright Fuzamei Corp. 2018 All Rights Reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package
executor
import
(
"github.com/33cn/chain33/types"
pkt
"github.com/33cn/plugin/plugin/dapp/guess/types"
)
func
(
c
*
Guess
)
Exec_Start
(
payload
*
pkt
.
GuessGameStart
,
tx
*
types
.
Transaction
,
index
int
)
(
*
types
.
Receipt
,
error
)
{
action
:=
NewAction
(
c
,
tx
,
index
)
return
action
.
GameStart
(
payload
)
}
func
(
c
*
Guess
)
Exec_Continue
(
payload
*
pkt
.
PBGameContinue
,
tx
*
types
.
Transaction
,
index
int
)
(
*
types
.
Receipt
,
error
)
{
action
:=
NewAction
(
c
,
tx
,
index
)
return
action
.
GameContinue
(
payload
)
}
func
(
c
*
Guess
)
Exec_Quit
(
payload
*
pkt
.
PBGameQuit
,
tx
*
types
.
Transaction
,
index
int
)
(
*
types
.
Receipt
,
error
)
{
action
:=
NewAction
(
c
,
tx
,
index
)
return
action
.
GameQuit
(
payload
)
}
\ No newline at end of file
plugin/dapp/guess/executor/exec_del_local.go
0 → 100644
View file @
6ed5261f
// Copyright Fuzamei Corp. 2018 All Rights Reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package
executor
import
(
"github.com/33cn/chain33/types"
pkt
"github.com/33cn/plugin/plugin/dapp/pokerbull/types"
)
func
(
g
*
PokerBull
)
rollbackIndex
(
log
*
pkt
.
ReceiptPBGame
)
(
kvs
[]
*
types
.
KeyValue
)
{
kvs
=
append
(
kvs
,
delPBGameStatusAndPlayer
(
log
.
Status
,
log
.
PlayerNum
,
log
.
Value
,
log
.
Index
))
kvs
=
append
(
kvs
,
addPBGameStatusAndPlayer
(
log
.
PreStatus
,
log
.
PlayerNum
,
log
.
PrevIndex
,
log
.
Value
,
log
.
GameId
))
kvs
=
append
(
kvs
,
delPBGameStatusIndexKey
(
log
.
Status
,
log
.
Index
))
kvs
=
append
(
kvs
,
addPBGameStatusIndexKey
(
log
.
PreStatus
,
log
.
GameId
,
log
.
PrevIndex
))
for
_
,
v
:=
range
log
.
Players
{
kvs
=
append
(
kvs
,
delPBGameAddrIndexKey
(
v
,
log
.
Index
))
kvs
=
append
(
kvs
,
addPBGameAddrIndexKey
(
log
.
PreStatus
,
v
,
log
.
GameId
,
log
.
PrevIndex
))
}
return
kvs
}
func
(
g
*
PokerBull
)
execDelLocal
(
receiptData
*
types
.
ReceiptData
)
(
*
types
.
LocalDBSet
,
error
)
{
dbSet
:=
&
types
.
LocalDBSet
{}
if
receiptData
.
GetTy
()
!=
types
.
ExecOk
{
return
dbSet
,
nil
}
for
_
,
log
:=
range
receiptData
.
Logs
{
switch
log
.
GetTy
()
{
case
pkt
.
TyLogPBGameStart
,
pkt
.
TyLogPBGameContinue
,
pkt
.
TyLogPBGameQuit
:
receiptGame
:=
&
pkt
.
ReceiptPBGame
{}
if
err
:=
types
.
Decode
(
log
.
Log
,
receiptGame
);
err
!=
nil
{
return
nil
,
err
}
kv
:=
g
.
rollbackIndex
(
receiptGame
)
dbSet
.
KV
=
append
(
dbSet
.
KV
,
kv
...
)
}
}
return
dbSet
,
nil
}
func
(
g
*
PokerBull
)
ExecDelLocal_Start
(
payload
*
pkt
.
PBGameStart
,
tx
*
types
.
Transaction
,
receiptData
*
types
.
ReceiptData
,
index
int
)
(
*
types
.
LocalDBSet
,
error
)
{
return
g
.
execDelLocal
(
receiptData
)
}
func
(
g
*
PokerBull
)
ExecDelLocal_Continue
(
payload
*
pkt
.
PBGameContinue
,
tx
*
types
.
Transaction
,
receiptData
*
types
.
ReceiptData
,
index
int
)
(
*
types
.
LocalDBSet
,
error
)
{
return
g
.
execDelLocal
(
receiptData
)
}
func
(
g
*
PokerBull
)
ExecDelLocal_Quit
(
payload
*
pkt
.
PBGameQuit
,
tx
*
types
.
Transaction
,
receiptData
*
types
.
ReceiptData
,
index
int
)
(
*
types
.
LocalDBSet
,
error
)
{
return
g
.
execDelLocal
(
receiptData
)
}
plugin/dapp/guess/executor/exec_local.go
0 → 100644
View file @
6ed5261f
// Copyright Fuzamei Corp. 2018 All Rights Reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package
executor
import
(
"github.com/33cn/chain33/types"
pkt
"github.com/33cn/plugin/plugin/dapp/pokerbull/types"
)
func
(
c
*
PokerBull
)
updateIndex
(
log
*
pkt
.
ReceiptPBGame
)
(
kvs
[]
*
types
.
KeyValue
)
{
//先保存本次Action产生的索引
kvs
=
append
(
kvs
,
addPBGameStatusAndPlayer
(
log
.
Status
,
log
.
PlayerNum
,
log
.
Value
,
log
.
Index
,
log
.
GameId
))
kvs
=
append
(
kvs
,
addPBGameStatusIndexKey
(
log
.
Status
,
log
.
GameId
,
log
.
Index
))
kvs
=
append
(
kvs
,
addPBGameAddrIndexKey
(
log
.
Status
,
log
.
Addr
,
log
.
GameId
,
log
.
Index
))
/*
//状态更新
if log.Status == pkt.PBGameActionStart {
kvs = append(kvs, delPBGameStatusAndPlayer(pkt.PBGameActionStart, log.PlayerNum, log.Value, log.PrevIndex))
kvs = append(kvs, delPBGameStatusIndexKey(pkt.PBGameActionStart, log.PrevIndex))
}
if log.Status == pkt.PBGameActionContinue {
kvs = append(kvs, delPBGameStatusAndPlayer(pkt.PBGameActionStart, log.PlayerNum, log.Value, log.PrevIndex))
kvs = append(kvs, delPBGameStatusAndPlayer(pkt.PBGameActionContinue, log.PlayerNum, log.Value, log.PrevIndex))
kvs = append(kvs, delPBGameStatusIndexKey(pkt.PBGameActionStart, log.PrevIndex))
kvs = append(kvs, delPBGameStatusIndexKey(pkt.PBGameActionContinue, log.PrevIndex))
}
if log.Status == pkt.PBGameActionQuit {
kvs = append(kvs, delPBGameStatusAndPlayer(pkt.PBGameActionStart, log.PlayerNum, log.Value, log.PrevIndex))
kvs = append(kvs, delPBGameStatusAndPlayer(pkt.PBGameActionContinue, log.PlayerNum, log.Value, log.PrevIndex))
kvs = append(kvs, delPBGameStatusIndexKey(pkt.PBGameActionStart, log.PrevIndex))
kvs = append(kvs, delPBGameStatusIndexKey(pkt.PBGameActionContinue, log.PrevIndex))
}*/
//结束一局,更新所有玩家地址状态
if
!
log
.
IsWaiting
{
for
_
,
v
:=
range
log
.
Players
{
if
v
!=
log
.
Addr
{
kvs
=
append
(
kvs
,
addPBGameAddrIndexKey
(
log
.
Status
,
v
,
log
.
GameId
,
log
.
Index
))
}
kvs
=
append
(
kvs
,
delPBGameAddrIndexKey
(
v
,
log
.
PrevIndex
))
}
kvs
=
append
(
kvs
,
delPBGameStatusAndPlayer
(
log
.
PreStatus
,
log
.
PlayerNum
,
log
.
Value
,
log
.
PrevIndex
))
kvs
=
append
(
kvs
,
delPBGameStatusIndexKey
(
log
.
PreStatus
,
log
.
PrevIndex
))
}
return
kvs
}
func
(
c
*
PokerBull
)
execLocal
(
receipt
*
types
.
ReceiptData
)
(
*
types
.
LocalDBSet
,
error
)
{
dbSet
:=
&
types
.
LocalDBSet
{}
if
receipt
.
GetTy
()
!=
types
.
ExecOk
{
return
dbSet
,
nil
}
for
i
:=
0
;
i
<
len
(
receipt
.
Logs
);
i
++
{
item
:=
receipt
.
Logs
[
i
]
if
item
.
Ty
==
pkt
.
TyLogPBGameStart
||
item
.
Ty
==
pkt
.
TyLogPBGameContinue
||
item
.
Ty
==
pkt
.
TyLogPBGameQuit
{
var
Gamelog
pkt
.
ReceiptPBGame
err
:=
types
.
Decode
(
item
.
Log
,
&
Gamelog
)
if
err
!=
nil
{
panic
(
err
)
//数据错误了,已经被修改了
}
kv
:=
c
.
updateIndex
(
&
Gamelog
)
dbSet
.
KV
=
append
(
dbSet
.
KV
,
kv
...
)
}
}
return
dbSet
,
nil
}
func
(
c
*
PokerBull
)
ExecLocal_Start
(
payload
*
pkt
.
PBGameStart
,
tx
*
types
.
Transaction
,
receiptData
*
types
.
ReceiptData
,
index
int
)
(
*
types
.
LocalDBSet
,
error
)
{
return
c
.
execLocal
(
receiptData
)
}
func
(
c
*
PokerBull
)
ExecLocal_Continue
(
payload
*
pkt
.
PBGameContinue
,
tx
*
types
.
Transaction
,
receiptData
*
types
.
ReceiptData
,
index
int
)
(
*
types
.
LocalDBSet
,
error
)
{
return
c
.
execLocal
(
receiptData
)
}
func
(
c
*
PokerBull
)
ExecLocal_Quit
(
payload
*
pkt
.
PBGameQuit
,
tx
*
types
.
Transaction
,
receiptData
*
types
.
ReceiptData
,
index
int
)
(
*
types
.
LocalDBSet
,
error
)
{
return
c
.
execLocal
(
receiptData
)
}
plugin/dapp/guess/executor/guess.go
0 → 100644
View file @
6ed5261f
// Copyright Fuzamei Corp. 2018 All Rights Reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package
executor
import
(
"fmt"
log
"github.com/33cn/chain33/common/log/log15"
drivers
"github.com/33cn/chain33/system/dapp"
"github.com/33cn/chain33/types"
pkt
"github.com/33cn/plugin/plugin/dapp/guess/types"
)
var
logger
=
log
.
New
(
"module"
,
"execs.guess"
)
func
Init
(
name
string
,
sub
[]
byte
)
{
drivers
.
Register
(
newGuessGame
()
.
GetName
(),
newGuessGame
,
types
.
GetDappFork
(
driverName
,
"Enable"
))
}
var
driverName
=
pkt
.
GuessX
func
init
()
{
ety
:=
types
.
LoadExecutorType
(
driverName
)
ety
.
InitFuncList
(
types
.
ListMethod
(
&
Guess
{}))
}
type
Guess
struct
{
drivers
.
DriverBase
}
func
newGuessGame
()
drivers
.
Driver
{
t
:=
&
Guess
{}
t
.
SetChild
(
t
)
t
.
SetExecutorType
(
types
.
LoadExecutorType
(
driverName
))
return
t
}
func
GetName
()
string
{
return
newGuessGame
()
.
GetName
()
}
func
(
g
*
Guess
)
GetDriverName
()
string
{
return
pkt
.
GuessX
}
func
calcPBGameAddrPrefix
(
addr
string
)
[]
byte
{
key
:=
fmt
.
Sprintf
(
"LODB-guess-addr:%s:"
,
addr
)
return
[]
byte
(
key
)
}
func
calcPBGameAddrKey
(
addr
string
,
index
int64
)
[]
byte
{
key
:=
fmt
.
Sprintf
(
"LODB-guess-addr:%s:%018d"
,
addr
,
index
)
return
[]
byte
(
key
)
}
func
calcPBGameStatusPrefix
(
status
int32
)
[]
byte
{
key
:=
fmt
.
Sprintf
(
"LODB-guess-status-index:%d:"
,
status
)
return
[]
byte
(
key
)
}
func
calcPBGameStatusKey
(
status
int32
,
index
int64
)
[]
byte
{
key
:=
fmt
.
Sprintf
(
"LODB-guess-status-index:%d:%018d"
,
status
,
index
)
return
[]
byte
(
key
)
}
func
calcPBGameStatusAndPlayerKey
(
status
,
player
int32
,
value
,
index
int64
)
[]
byte
{
key
:=
fmt
.
Sprintf
(
"LODB-guess-status:%d:%d:%d:%018d"
,
status
,
player
,
value
,
index
)
return
[]
byte
(
key
)
}
func
calcPBGameStatusAndPlayerPrefix
(
status
,
player
int32
,
value
int64
)
[]
byte
{
var
key
string
if
value
==
0
{
key
=
fmt
.
Sprintf
(
"LODB-guess-status:%d:%d:"
,
status
,
player
)
}
else
{
key
=
fmt
.
Sprintf
(
"LODB-guess-status:%d:%d:%d"
,
status
,
player
,
value
)
}
return
[]
byte
(
key
)
}
func
addPBGameStatusIndexKey
(
status
int32
,
gameID
string
,
index
int64
)
*
types
.
KeyValue
{
kv
:=
&
types
.
KeyValue
{}
kv
.
Key
=
calcPBGameStatusKey
(
status
,
index
)
record
:=
&
pkt
.
PBGameIndexRecord
{
GameId
:
gameID
,
Index
:
index
,
}
kv
.
Value
=
types
.
Encode
(
record
)
return
kv
}
func
delPBGameStatusIndexKey
(
status
int32
,
index
int64
)
*
types
.
KeyValue
{
kv
:=
&
types
.
KeyValue
{}
kv
.
Key
=
calcPBGameStatusKey
(
status
,
index
)
kv
.
Value
=
nil
return
kv
}
func
addPBGameAddrIndexKey
(
status
int32
,
addr
,
gameID
string
,
index
int64
)
*
types
.
KeyValue
{
kv
:=
&
types
.
KeyValue
{}
kv
.
Key
=
calcPBGameAddrKey
(
addr
,
index
)
record
:=
&
pkt
.
PBGameRecord
{
GameId
:
gameID
,
Status
:
status
,
Index
:
index
,
}
kv
.
Value
=
types
.
Encode
(
record
)
return
kv
}
func
delPBGameAddrIndexKey
(
addr
string
,
index
int64
)
*
types
.
KeyValue
{
kv
:=
&
types
.
KeyValue
{}
kv
.
Key
=
calcPBGameAddrKey
(
addr
,
index
)
kv
.
Value
=
nil
return
kv
}
func
addPBGameStatusAndPlayer
(
status
int32
,
player
int32
,
value
,
index
int64
,
gameId
string
)
*
types
.
KeyValue
{
kv
:=
&
types
.
KeyValue
{}
kv
.
Key
=
calcPBGameStatusAndPlayerKey
(
status
,
player
,
value
,
index
)
record
:=
&
pkt
.
PBGameIndexRecord
{
GameId
:
gameId
,
Index
:
index
,
}
kv
.
Value
=
types
.
Encode
(
record
)
return
kv
}
func
delPBGameStatusAndPlayer
(
status
int32
,
player
int32
,
value
,
index
int64
)
*
types
.
KeyValue
{
kv
:=
&
types
.
KeyValue
{}
kv
.
Key
=
calcPBGameStatusAndPlayerKey
(
status
,
player
,
value
,
index
)
kv
.
Value
=
nil
return
kv
}
plugin/dapp/guess/executor/guessdb.go
0 → 100644
View file @
6ed5261f
// Copyright Fuzamei Corp. 2018 All Rights Reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package
executor
import
(
"errors"
"fmt"
"sort"
"strconv"
"github.com/33cn/chain33/account"
"github.com/33cn/chain33/common"
dbm
"github.com/33cn/chain33/common/db"
"github.com/33cn/chain33/system/dapp"
"github.com/33cn/chain33/types"
pkt
"github.com/33cn/plugin/plugin/dapp/guess/types"
)
const
(
ListDESC
=
int32
(
0
)
ListASC
=
int32
(
1
)
DefaultCount
=
int32
(
20
)
//默认一次取多少条记录
MAX_PLAYER_NUM
=
5
MIN_PLAY_VALUE
=
10
*
types
.
Coin
//DefaultStyle = pkt.PlayStyleDefault
)
type
Action
struct
{
coinsAccount
*
account
.
DB
db
dbm
.
KV
txhash
[]
byte
fromaddr
string
blocktime
int64
height
int64
execaddr
string
localDB
dbm
.
Lister
index
int
}
func
NewAction
(
guess
*
Guess
,
tx
*
types
.
Transaction
,
index
int
)
*
Action
{
hash
:=
tx
.
Hash
()
fromAddr
:=
tx
.
From
()
return
&
Action
{
coinsAccount
:
guess
.
GetCoinsAccount
(),
db
:
guess
.
GetStateDB
(),
txhash
:
hash
,
fromaddr
:
fromAddr
,
blocktime
:
guess
.
GetBlockTime
(),
height
:
guess
.
GetHeight
(),
execaddr
:
dapp
.
ExecAddress
(
string
(
tx
.
Execer
)),
localDB
:
guess
.
GetLocalDB
(),
index
:
index
,
}
}
func
(
action
*
Action
)
CheckExecAccountBalance
(
fromAddr
string
,
ToFrozen
,
ToActive
int64
)
bool
{
// 赌注为零,按照最小赌注冻结
if
ToFrozen
==
0
{
ToFrozen
=
MIN_PLAY_VALUE
}
acc
:=
action
.
coinsAccount
.
LoadExecAccount
(
fromAddr
,
action
.
execaddr
)
if
acc
.
GetBalance
()
>=
ToFrozen
&&
acc
.
GetFrozen
()
>=
ToActive
{
return
true
}
return
false
}
func
Key
(
id
string
)
(
key
[]
byte
)
{
key
=
append
(
key
,
[]
byte
(
"mavl-"
+
types
.
ExecName
(
pkt
.
GuessX
)
+
"-"
)
...
)
key
=
append
(
key
,
[]
byte
(
id
)
...
)
return
key
}
func
readGame
(
db
dbm
.
KV
,
id
string
)
(
*
pkt
.
GuessGame
,
error
)
{
data
,
err
:=
db
.
Get
(
Key
(
id
))
if
err
!=
nil
{
logger
.
Error
(
"query data have err:"
,
err
.
Error
())
return
nil
,
err
}
var
game
pkt
.
GuessGame
//decode
err
=
types
.
Decode
(
data
,
&
game
)
if
err
!=
nil
{
logger
.
Error
(
"decode game have err:"
,
err
.
Error
())
return
nil
,
err
}
return
&
game
,
nil
}
//安全批量查询方式,防止因为脏数据导致查询接口奔溃
func
GetGameList
(
db
dbm
.
KV
,
values
[]
string
)
[]
*
pkt
.
GuessGame
{
var
games
[]
*
pkt
.
GuessGame
for
_
,
value
:=
range
values
{
game
,
err
:=
readGame
(
db
,
value
)
if
err
!=
nil
{
continue
}
games
=
append
(
games
,
game
)
}
return
games
}
func
Infos
(
db
dbm
.
KV
,
infos
*
pkt
.
QueryPBGameInfos
)
(
types
.
Message
,
error
)
{
var
games
[]
*
pkt
.
PokerBull
for
i
:=
0
;
i
<
len
(
infos
.
GameIds
);
i
++
{
id
:=
infos
.
GameIds
[
i
]
game
,
err
:=
readGame
(
db
,
id
)
if
err
!=
nil
{
return
nil
,
err
}
games
=
append
(
games
,
game
)
}
return
&
pkt
.
ReplyPBGameList
{
Games
:
games
},
nil
}
func
getGameListByAddr
(
db
dbm
.
Lister
,
addr
string
,
index
int64
)
(
types
.
Message
,
error
)
{
var
values
[][]
byte
var
err
error
if
index
==
0
{
values
,
err
=
db
.
List
(
calcPBGameAddrPrefix
(
addr
),
nil
,
DefaultCount
,
ListDESC
)
}
else
{
values
,
err
=
db
.
List
(
calcPBGameAddrPrefix
(
addr
),
calcPBGameAddrKey
(
addr
,
index
),
DefaultCount
,
ListDESC
)
}
if
err
!=
nil
{
return
nil
,
err
}
var
gameIds
[]
*
pkt
.
PBGameRecord
for
_
,
value
:=
range
values
{
var
record
pkt
.
PBGameRecord
err
:=
types
.
Decode
(
value
,
&
record
)
if
err
!=
nil
{
continue
}
gameIds
=
append
(
gameIds
,
&
record
)
}
return
&
pkt
.
PBGameRecords
{
gameIds
},
nil
}
func
getGameListByStatus
(
db
dbm
.
Lister
,
status
int32
,
index
int64
)
(
types
.
Message
,
error
)
{
var
values
[][]
byte
var
err
error
if
index
==
0
{
values
,
err
=
db
.
List
(
calcPBGameStatusPrefix
(
status
),
nil
,
DefaultCount
,
ListDESC
)
}
else
{
values
,
err
=
db
.
List
(
calcPBGameStatusPrefix
(
status
),
calcPBGameStatusKey
(
status
,
index
),
DefaultCount
,
ListDESC
)
}
if
err
!=
nil
{
return
nil
,
err
}
var
gameIds
[]
*
pkt
.
PBGameRecord
for
_
,
value
:=
range
values
{
var
record
pkt
.
PBGameRecord
err
:=
types
.
Decode
(
value
,
&
record
)
if
err
!=
nil
{
continue
}
gameIds
=
append
(
gameIds
,
&
record
)
}
return
&
pkt
.
PBGameRecords
{
gameIds
},
nil
}
func
queryGameListByStatusAndPlayer
(
db
dbm
.
Lister
,
stat
int32
,
player
int32
,
value
int64
)
([]
string
,
error
)
{
values
,
err
:=
db
.
List
(
calcPBGameStatusAndPlayerPrefix
(
stat
,
player
,
value
),
nil
,
DefaultCount
,
ListDESC
)
if
err
!=
nil
{
return
nil
,
err
}
var
gameIds
[]
string
for
_
,
value
:=
range
values
{
var
record
pkt
.
PBGameIndexRecord
err
:=
types
.
Decode
(
value
,
&
record
)
if
err
!=
nil
{
continue
}
gameIds
=
append
(
gameIds
,
record
.
GetGameId
())
}
return
gameIds
,
nil
}
func
(
action
*
Action
)
saveGame
(
game
*
pkt
.
PokerBull
)
(
kvset
[]
*
types
.
KeyValue
)
{
value
:=
types
.
Encode
(
game
)
action
.
db
.
Set
(
Key
(
game
.
GetGameId
()),
value
)
kvset
=
append
(
kvset
,
&
types
.
KeyValue
{
Key
(
game
.
GameId
),
value
})
return
kvset
}
func
(
action
*
Action
)
getIndex
(
game
*
pkt
.
PokerBull
)
int64
{
return
action
.
height
*
types
.
MaxTxsPerBlock
+
int64
(
action
.
index
)
}
func
(
action
*
Action
)
GetReceiptLog
(
game
*
pkt
.
PokerBull
)
*
types
.
ReceiptLog
{
log
:=
&
types
.
ReceiptLog
{}
r
:=
&
pkt
.
ReceiptPBGame
{}
r
.
Addr
=
action
.
fromaddr
if
game
.
Status
==
pkt
.
PBGameActionStart
{
log
.
Ty
=
pkt
.
TyLogPBGameStart
}
else
if
game
.
Status
==
pkt
.
PBGameActionContinue
{
log
.
Ty
=
pkt
.
TyLogPBGameContinue
}
else
if
game
.
Status
==
pkt
.
PBGameActionQuit
{
log
.
Ty
=
pkt
.
TyLogPBGameQuit
}
r
.
GameId
=
game
.
GameId
r
.
Status
=
game
.
Status
r
.
Index
=
game
.
GetIndex
()
r
.
PrevIndex
=
game
.
GetPrevIndex
()
r
.
PlayerNum
=
game
.
PlayerNum
r
.
Value
=
game
.
Value
r
.
IsWaiting
=
game
.
IsWaiting
if
!
r
.
IsWaiting
{
for
_
,
v
:=
range
game
.
Players
{
r
.
Players
=
append
(
r
.
Players
,
v
.
Address
)
}
}
r
.
PreStatus
=
game
.
PreStatus
log
.
Log
=
types
.
Encode
(
r
)
return
log
}
func
(
action
*
Action
)
readGame
(
id
string
)
(
*
pkt
.
PokerBull
,
error
)
{
data
,
err
:=
action
.
db
.
Get
(
Key
(
id
))
if
err
!=
nil
{
return
nil
,
err
}
var
game
pkt
.
PokerBull
//decode
err
=
types
.
Decode
(
data
,
&
game
)
if
err
!=
nil
{
return
nil
,
err
}
return
&
game
,
nil
}
func
(
action
*
Action
)
calculate
(
game
*
pkt
.
PokerBull
)
*
pkt
.
PBResult
{
var
handS
HandSlice
for
_
,
player
:=
range
game
.
Players
{
hand
:=
&
pkt
.
PBHand
{}
hand
.
Cards
=
Deal
(
game
.
Poker
,
player
.
TxHash
)
//发牌
hand
.
Result
=
Result
(
hand
.
Cards
)
//计算结果
hand
.
Address
=
player
.
Address
//存入玩家数组
player
.
Hands
=
append
(
player
.
Hands
,
hand
)
//存入临时切片待比大小排序
handS
=
append
(
handS
,
hand
)
//为下一个continue状态初始化player
player
.
Ready
=
false
}
// 升序排列
if
!
sort
.
IsSorted
(
handS
)
{
sort
.
Sort
(
handS
)
}
winner
:=
handS
[
len
(
handS
)
-
1
]
// 将有序的临时切片加入到结果数组
result
:=
&
pkt
.
PBResult
{}
result
.
Winner
=
winner
.
Address
//TODO Dealer:暂时不支持倍数
//result.Leverage = Leverage(winner)
result
.
Hands
=
make
([]
*
pkt
.
PBHand
,
len
(
handS
))
copy
(
result
.
Hands
,
handS
)
game
.
Results
=
append
(
game
.
Results
,
result
)
return
result
}
func
(
action
*
Action
)
calculateDealer
(
game
*
pkt
.
PokerBull
)
*
pkt
.
PBResult
{
var
handS
HandSlice
var
dealer
*
pkt
.
PBHand
for
_
,
player
:=
range
game
.
Players
{
hand
:=
&
pkt
.
PBHand
{}
hand
.
Cards
=
Deal
(
game
.
Poker
,
player
.
TxHash
)
//发牌
hand
.
Result
=
Result
(
hand
.
Cards
)
//计算结果
hand
.
Address
=
player
.
Address
//存入玩家数组
player
.
Hands
=
append
(
player
.
Hands
,
hand
)
//存入临时切片待比大小排序
handS
=
append
(
handS
,
hand
)
//为下一个continue状态初始化player
player
.
Ready
=
false
//记录庄家
if
player
.
Address
==
game
.
DealerAddr
{
dealer
=
hand
}
}
for
_
,
hand
:=
range
handS
{
if
hand
.
Address
==
game
.
DealerAddr
{
continue
}
if
CompareResult
(
hand
,
dealer
)
{
hand
.
IsWin
=
false
}
else
{
hand
.
IsWin
=
true
hand
.
Leverage
=
Leverage
(
hand
)
}
}
// 将有序的临时切片加入到结果数组
result
:=
&
pkt
.
PBResult
{}
result
.
Dealer
=
game
.
DealerAddr
result
.
DealerLeverage
=
Leverage
(
dealer
)
result
.
Hands
=
make
([]
*
pkt
.
PBHand
,
len
(
handS
))
copy
(
result
.
Hands
,
handS
)
game
.
Results
=
append
(
game
.
Results
,
result
)
return
result
}
func
(
action
*
Action
)
nextDealer
(
game
*
pkt
.
PokerBull
)
string
{
var
flag
=
-
1
for
i
,
player
:=
range
game
.
Players
{
if
player
.
Address
==
game
.
DealerAddr
{
flag
=
i
}
}
if
flag
==
-
1
{
logger
.
Error
(
"Get next dealer failed."
)
return
game
.
DealerAddr
}
if
flag
==
len
(
game
.
Players
)
-
1
{
return
game
.
Players
[
0
]
.
Address
}
return
game
.
Players
[
flag
+
1
]
.
Address
}
func
(
action
*
Action
)
settleDealerAccount
(
lastAddress
string
,
game
*
pkt
.
PokerBull
)
([]
*
types
.
ReceiptLog
,
[]
*
types
.
KeyValue
,
error
)
{
var
logs
[]
*
types
.
ReceiptLog
var
kv
[]
*
types
.
KeyValue
result
:=
action
.
calculateDealer
(
game
)
for
_
,
hand
:=
range
result
.
Hands
{
// 最后一名玩家没有冻结
if
hand
.
Address
!=
lastAddress
{
receipt
,
err
:=
action
.
coinsAccount
.
ExecActive
(
hand
.
Address
,
action
.
execaddr
,
game
.
GetValue
()
*
POKERBULL_LEVERAGE_MAX
)
if
err
!=
nil
{
logger
.
Error
(
"GameSettleDealer.ExecActive"
,
"addr"
,
hand
.
Address
,
"execaddr"
,
action
.
execaddr
,
"amount"
,
game
.
GetValue
(),
"err"
,
err
)
return
nil
,
nil
,
err
}
logs
=
append
(
logs
,
receipt
.
Logs
...
)
kv
=
append
(
kv
,
receipt
.
KV
...
)
}
//给赢家转账
var
receipt
*
types
.
Receipt
var
err
error
if
hand
.
Address
!=
result
.
Dealer
{
if
hand
.
IsWin
{
receipt
,
err
=
action
.
coinsAccount
.
ExecTransfer
(
result
.
Dealer
,
hand
.
Address
,
action
.
execaddr
,
game
.
GetValue
()
*
int64
(
hand
.
Leverage
))
if
err
!=
nil
{
action
.
coinsAccount
.
ExecFrozen
(
hand
.
Address
,
action
.
execaddr
,
game
.
GetValue
())
// rollback
logger
.
Error
(
"GameSettleDealer.ExecTransfer"
,
"addr"
,
hand
.
Address
,
"execaddr"
,
action
.
execaddr
,
"amount"
,
game
.
GetValue
()
*
int64
(
hand
.
Leverage
),
"err"
,
err
)
return
nil
,
nil
,
err
}
}
else
{
receipt
,
err
=
action
.
coinsAccount
.
ExecTransfer
(
hand
.
Address
,
result
.
Dealer
,
action
.
execaddr
,
game
.
GetValue
()
*
int64
(
result
.
DealerLeverage
))
if
err
!=
nil
{
action
.
coinsAccount
.
ExecFrozen
(
hand
.
Address
,
action
.
execaddr
,
game
.
GetValue
())
// rollback
logger
.
Error
(
"GameSettleDealer.ExecTransfer"
,
"addr"
,
hand
.
Address
,
"execaddr"
,
action
.
execaddr
,
"amount"
,
game
.
GetValue
()
*
int64
(
result
.
DealerLeverage
),
"err"
,
err
)
return
nil
,
nil
,
err
}
}
logs
=
append
(
logs
,
receipt
.
Logs
...
)
kv
=
append
(
kv
,
receipt
.
KV
...
)
}
}
game
.
DealerAddr
=
action
.
nextDealer
(
game
)
return
logs
,
kv
,
nil
}
func
(
action
*
Action
)
settleDefaultAccount
(
lastAddress
string
,
game
*
pkt
.
PokerBull
)
([]
*
types
.
ReceiptLog
,
[]
*
types
.
KeyValue
,
error
)
{
var
logs
[]
*
types
.
ReceiptLog
var
kv
[]
*
types
.
KeyValue
result
:=
action
.
calculate
(
game
)
for
_
,
player
:=
range
game
.
Players
{
// 最后一名玩家没有冻结
if
player
.
Address
!=
lastAddress
{
receipt
,
err
:=
action
.
coinsAccount
.
ExecActive
(
player
.
GetAddress
(),
action
.
execaddr
,
game
.
GetValue
()
*
POKERBULL_LEVERAGE_MAX
)
if
err
!=
nil
{
logger
.
Error
(
"GameSettleDefault.ExecActive"
,
"addr"
,
player
.
GetAddress
(),
"execaddr"
,
action
.
execaddr
,
"amount"
,
game
.
GetValue
()
*
POKERBULL_LEVERAGE_MAX
,
"err"
,
err
)
return
nil
,
nil
,
err
}
logs
=
append
(
logs
,
receipt
.
Logs
...
)
kv
=
append
(
kv
,
receipt
.
KV
...
)
}
//给赢家转账
if
player
.
Address
!=
result
.
Winner
{
receipt
,
err
:=
action
.
coinsAccount
.
ExecTransfer
(
player
.
Address
,
result
.
Winner
,
action
.
execaddr
,
game
.
GetValue
()
/**int64(result.Leverage)*/
)
//TODO Dealer:暂时不支持倍数
if
err
!=
nil
{
action
.
coinsAccount
.
ExecFrozen
(
result
.
Winner
,
action
.
execaddr
,
game
.
GetValue
())
// rollback
logger
.
Error
(
"GameSettleDefault.ExecTransfer"
,
"addr"
,
result
.
Winner
,
"execaddr"
,
action
.
execaddr
,
"amount"
,
game
.
GetValue
()
/**int64(result.Leverage)*/
,
"err"
,
err
)
//TODO Dealer:暂时不支持倍数
return
nil
,
nil
,
err
}
logs
=
append
(
logs
,
receipt
.
Logs
...
)
kv
=
append
(
kv
,
receipt
.
KV
...
)
}
}
return
logs
,
kv
,
nil
}
func
(
action
*
Action
)
settleAccount
(
lastAddress
string
,
game
*
pkt
.
PokerBull
)
([]
*
types
.
ReceiptLog
,
[]
*
types
.
KeyValue
,
error
)
{
if
DefaultStyle
==
pkt
.
PlayStyleDealer
{
return
action
.
settleDealerAccount
(
lastAddress
,
game
)
}
else
{
return
action
.
settleDefaultAccount
(
lastAddress
,
game
)
}
}
func
(
action
*
Action
)
genTxRnd
(
txhash
[]
byte
)
(
int64
,
error
)
{
randbyte
:=
make
([]
byte
,
7
)
for
i
:=
0
;
i
<
7
;
i
++
{
randbyte
[
i
]
=
txhash
[
i
]
}
randstr
:=
common
.
ToHex
(
randbyte
)
randint
,
err
:=
strconv
.
ParseInt
(
randstr
,
0
,
64
)
if
err
!=
nil
{
return
0
,
err
}
return
randint
,
nil
}
func
(
action
*
Action
)
checkDupPlayerAddress
(
id
string
,
pbPlayers
[]
*
pkt
.
PBPlayer
)
error
{
for
_
,
player
:=
range
pbPlayers
{
if
action
.
fromaddr
==
player
.
Address
{
logger
.
Error
(
"Poker bull game start"
,
"addr"
,
action
.
fromaddr
,
"execaddr"
,
action
.
execaddr
,
"Already in a game"
,
id
)
return
errors
.
New
(
"Address is already in a game"
)
}
}
return
nil
}
// 新建一局游戏
func
(
action
*
Action
)
newGame
(
gameId
string
,
start
*
pkt
.
PBGameStart
)
(
*
pkt
.
PokerBull
,
error
)
{
var
game
*
pkt
.
PokerBull
// 不指定赌注,默认按照最低赌注
if
start
.
GetValue
()
==
0
{
start
.
Value
=
MIN_PLAY_VALUE
}
//TODO 庄家检查闲家数量倍数的资金
if
DefaultStyle
==
pkt
.
PlayStyleDealer
{
if
!
action
.
CheckExecAccountBalance
(
action
.
fromaddr
,
start
.
GetValue
()
*
POKERBULL_LEVERAGE_MAX
*
int64
(
start
.
PlayerNum
-
1
),
0
)
{
logger
.
Error
(
"GameStart"
,
"addr"
,
action
.
fromaddr
,
"execaddr"
,
action
.
execaddr
,
"id"
,
gameId
,
"err"
,
types
.
ErrNoBalance
)
return
nil
,
types
.
ErrNoBalance
}
}
game
=
&
pkt
.
PokerBull
{
GameId
:
gameId
,
Status
:
pkt
.
PBGameActionStart
,
StartTime
:
action
.
blocktime
,
StartTxHash
:
gameId
,
Value
:
start
.
GetValue
(),
Poker
:
NewPoker
(),
PlayerNum
:
start
.
PlayerNum
,
Index
:
action
.
getIndex
(
game
),
DealerAddr
:
action
.
fromaddr
,
IsWaiting
:
true
,
PreStatus
:
0
,
}
Shuffle
(
game
.
Poker
,
action
.
blocktime
)
//洗牌
return
game
,
nil
}
// 筛选合适的牌局
func
(
action
*
Action
)
selectGameFromIds
(
ids
[]
string
,
value
int64
)
*
pkt
.
PokerBull
{
var
gameRet
*
pkt
.
PokerBull
=
nil
for
_
,
id
:=
range
ids
{
game
,
err
:=
action
.
readGame
(
id
)
if
err
!=
nil
{
logger
.
Error
(
"Poker bull game start"
,
"addr"
,
action
.
fromaddr
,
"execaddr"
,
action
.
execaddr
,
"get game failed"
,
id
,
"err"
,
err
)
continue
}
//不能自己和自己玩
if
action
.
checkDupPlayerAddress
(
id
,
game
.
Players
)
!=
nil
{
continue
}
//选择合适赌注的游戏
if
value
==
0
&&
game
.
GetValue
()
!=
MIN_PLAY_VALUE
{
if
!
action
.
CheckExecAccountBalance
(
action
.
fromaddr
,
game
.
GetValue
(),
0
)
{
logger
.
Error
(
"GameStart"
,
"addr"
,
action
.
fromaddr
,
"execaddr"
,
action
.
execaddr
,
"id"
,
id
,
"err"
,
types
.
ErrNoBalance
)
continue
}
}
gameRet
=
game
break
}
return
gameRet
}
func
(
action
*
Action
)
checkPlayerExistInGame
()
bool
{
values
,
err
:=
action
.
localDB
.
List
(
calcPBGameAddrPrefix
(
action
.
fromaddr
),
nil
,
DefaultCount
,
ListDESC
)
if
err
==
types
.
ErrNotFound
{
return
false
}
var
value
pkt
.
PBGameRecord
lenght
:=
len
(
values
)
if
lenght
!=
0
{
valueBytes
:=
values
[
lenght
-
1
]
err
:=
types
.
Decode
(
valueBytes
,
&
value
)
if
err
==
nil
&&
value
.
Status
==
pkt
.
PBGameActionQuit
{
return
false
}
}
return
true
}
func
(
action
*
Action
)
GameStart
(
start
*
pkt
.
PBGameStart
)
(
*
types
.
Receipt
,
error
)
{
var
logs
[]
*
types
.
ReceiptLog
var
kv
[]
*
types
.
KeyValue
if
start
.
PlayerNum
>
MAX_PLAYER_NUM
{
logger
.
Error
(
"GameStart"
,
"addr"
,
action
.
fromaddr
,
"execaddr"
,
action
.
execaddr
,
"err"
,
fmt
.
Sprintf
(
"The maximum player number is %d"
,
MAX_PLAYER_NUM
))
return
nil
,
types
.
ErrInvalidParam
}
gameId
:=
common
.
ToHex
(
action
.
txhash
)
if
!
action
.
CheckExecAccountBalance
(
action
.
fromaddr
,
start
.
GetValue
()
*
POKERBULL_LEVERAGE_MAX
,
0
)
{
logger
.
Error
(
"GameStart"
,
"addr"
,
action
.
fromaddr
,
"execaddr"
,
action
.
execaddr
,
"id"
,
gameId
,
"err"
,
types
.
ErrNoBalance
)
return
nil
,
types
.
ErrNoBalance
}
if
action
.
checkPlayerExistInGame
()
{
logger
.
Error
(
"GameStart"
,
"addr"
,
action
.
fromaddr
,
"execaddr"
,
action
.
execaddr
,
"err"
,
"Address is already in a game"
)
return
nil
,
fmt
.
Errorf
(
"Address is already in a game"
)
}
var
game
*
pkt
.
PokerBull
=
nil
ids
,
err
:=
queryGameListByStatusAndPlayer
(
action
.
localDB
,
pkt
.
PBGameActionStart
,
start
.
PlayerNum
,
start
.
Value
)
if
err
!=
nil
||
len
(
ids
)
==
0
{
if
err
!=
types
.
ErrNotFound
{
return
nil
,
err
}
game
,
err
=
action
.
newGame
(
gameId
,
start
)
if
err
!=
nil
{
return
nil
,
err
}
}
else
{
game
=
action
.
selectGameFromIds
(
ids
,
start
.
GetValue
())
if
game
==
nil
{
// 如果也没有匹配到游戏,则按照最低赌注创建
game
,
err
=
action
.
newGame
(
gameId
,
start
)
if
err
!=
nil
{
return
nil
,
err
}
}
}
//发牌随机数取txhash
txrng
,
err
:=
action
.
genTxRnd
(
action
.
txhash
)
if
err
!=
nil
{
return
nil
,
err
}
//加入当前玩家信息
game
.
Players
=
append
(
game
.
Players
,
&
pkt
.
PBPlayer
{
Address
:
action
.
fromaddr
,
TxHash
:
txrng
,
Ready
:
false
,
})
// 如果人数达标,则发牌计算斗牛结果
if
len
(
game
.
Players
)
==
int
(
game
.
PlayerNum
)
{
logsH
,
kvH
,
err
:=
action
.
settleAccount
(
action
.
fromaddr
,
game
)
if
err
!=
nil
{
return
nil
,
err
}
logs
=
append
(
logs
,
logsH
...
)
kv
=
append
(
kv
,
kvH
...
)
game
.
PrevIndex
=
game
.
Index
game
.
Index
=
action
.
getIndex
(
game
)
game
.
Status
=
pkt
.
PBGameActionContinue
// 更新游戏状态
game
.
PreStatus
=
pkt
.
PBGameActionStart
game
.
IsWaiting
=
false
}
else
{
receipt
,
err
:=
action
.
coinsAccount
.
ExecFrozen
(
action
.
fromaddr
,
action
.
execaddr
,
start
.
GetValue
()
*
POKERBULL_LEVERAGE_MAX
)
//冻结子账户资金, 最后一位玩家不需要冻结
if
err
!=
nil
{
logger
.
Error
(
"GameCreate.ExecFrozen"
,
"addr"
,
action
.
fromaddr
,
"execaddr"
,
action
.
execaddr
,
"amount"
,
start
.
GetValue
(),
"err"
,
err
.
Error
())
return
nil
,
err
}
logs
=
append
(
logs
,
receipt
.
Logs
...
)
kv
=
append
(
kv
,
receipt
.
KV
...
)
}
receiptLog
:=
action
.
GetReceiptLog
(
game
)
logs
=
append
(
logs
,
receiptLog
)
kv
=
append
(
kv
,
action
.
saveGame
(
game
)
...
)
return
&
types
.
Receipt
{
types
.
ExecOk
,
kv
,
logs
},
nil
}
func
getReadyPlayerNum
(
players
[]
*
pkt
.
PBPlayer
)
int
{
var
readyC
=
0
for
_
,
player
:=
range
players
{
if
player
.
Ready
{
readyC
++
}
}
return
readyC
}
func
getPlayerFromAddress
(
players
[]
*
pkt
.
PBPlayer
,
addr
string
)
*
pkt
.
PBPlayer
{
for
_
,
player
:=
range
players
{
if
player
.
Address
==
addr
{
return
player
}
}
return
nil
}
func
(
action
*
Action
)
GameContinue
(
pbcontinue
*
pkt
.
PBGameContinue
)
(
*
types
.
Receipt
,
error
)
{
var
logs
[]
*
types
.
ReceiptLog
var
kv
[]
*
types
.
KeyValue
game
,
err
:=
action
.
readGame
(
pbcontinue
.
GetGameId
())
if
err
!=
nil
{
logger
.
Error
(
"GameContinue"
,
"addr"
,
action
.
fromaddr
,
"execaddr"
,
action
.
execaddr
,
"get game failed"
,
pbcontinue
.
GetGameId
(),
"err"
,
err
)
return
nil
,
err
}
if
game
.
Status
!=
pkt
.
PBGameActionContinue
{
logger
.
Error
(
"GameContinue"
,
"addr"
,
action
.
fromaddr
,
"execaddr"
,
action
.
execaddr
,
"Status error"
,
pbcontinue
.
GetGameId
())
return
nil
,
err
}
// 检查余额,庄家检查闲家数量倍数的资金
checkValue
:=
game
.
GetValue
()
*
POKERBULL_LEVERAGE_MAX
if
action
.
fromaddr
==
game
.
DealerAddr
{
checkValue
=
checkValue
*
int64
(
game
.
PlayerNum
-
1
)
}
if
!
action
.
CheckExecAccountBalance
(
action
.
fromaddr
,
checkValue
,
0
)
{
logger
.
Error
(
"GameContinue"
,
"addr"
,
action
.
fromaddr
,
"execaddr"
,
action
.
execaddr
,
"id"
,
pbcontinue
.
GetGameId
(),
"err"
,
types
.
ErrNoBalance
)
return
nil
,
types
.
ErrNoBalance
}
// 寻找对应玩家
pbplayer
:=
getPlayerFromAddress
(
game
.
Players
,
action
.
fromaddr
)
if
pbplayer
==
nil
{
logger
.
Error
(
"GameContinue"
,
"addr"
,
action
.
fromaddr
,
"execaddr"
,
action
.
execaddr
,
"get game player failed"
,
pbcontinue
.
GetGameId
(),
"err"
,
types
.
ErrNotFound
)
return
nil
,
types
.
ErrNotFound
}
if
pbplayer
.
Ready
{
logger
.
Error
(
"GameContinue"
,
"addr"
,
action
.
fromaddr
,
"execaddr"
,
action
.
execaddr
,
"player has been ready"
,
pbcontinue
.
GetGameId
(),
"player"
,
pbplayer
.
Address
)
return
nil
,
fmt
.
Errorf
(
"player %s has been ready"
,
pbplayer
.
Address
)
}
//发牌随机数取txhash
txrng
,
err
:=
action
.
genTxRnd
(
action
.
txhash
)
if
err
!=
nil
{
return
nil
,
err
}
pbplayer
.
TxHash
=
txrng
pbplayer
.
Ready
=
true
if
getReadyPlayerNum
(
game
.
Players
)
==
int
(
game
.
PlayerNum
)
{
logsH
,
kvH
,
err
:=
action
.
settleAccount
(
action
.
fromaddr
,
game
)
if
err
!=
nil
{
return
nil
,
err
}
logs
=
append
(
logs
,
logsH
...
)
kv
=
append
(
kv
,
kvH
...
)
game
.
PrevIndex
=
game
.
Index
game
.
Index
=
action
.
getIndex
(
game
)
game
.
IsWaiting
=
false
game
.
PreStatus
=
pkt
.
PBGameActionContinue
}
else
{
receipt
,
err
:=
action
.
coinsAccount
.
ExecFrozen
(
action
.
fromaddr
,
action
.
execaddr
,
game
.
GetValue
()
*
POKERBULL_LEVERAGE_MAX
)
//冻结子账户资金,最后一位玩家不需要冻结
if
err
!=
nil
{
logger
.
Error
(
"GameCreate.ExecFrozen"
,
"addr"
,
action
.
fromaddr
,
"execaddr"
,
action
.
execaddr
,
"amount"
,
game
.
GetValue
(),
"err"
,
err
.
Error
())
return
nil
,
err
}
logs
=
append
(
logs
,
receipt
.
Logs
...
)
kv
=
append
(
kv
,
receipt
.
KV
...
)
game
.
IsWaiting
=
true
}
receiptLog
:=
action
.
GetReceiptLog
(
game
)
logs
=
append
(
logs
,
receiptLog
)
kv
=
append
(
kv
,
action
.
saveGame
(
game
)
...
)
return
&
types
.
Receipt
{
types
.
ExecOk
,
kv
,
logs
},
nil
}
func
(
action
*
Action
)
GameQuit
(
pbend
*
pkt
.
PBGameQuit
)
(
*
types
.
Receipt
,
error
)
{
var
logs
[]
*
types
.
ReceiptLog
var
kv
[]
*
types
.
KeyValue
game
,
err
:=
action
.
readGame
(
pbend
.
GetGameId
())
if
err
!=
nil
{
logger
.
Error
(
"GameEnd"
,
"addr"
,
action
.
fromaddr
,
"execaddr"
,
action
.
execaddr
,
"get game failed"
,
pbend
.
GetGameId
(),
"err"
,
err
)
return
nil
,
err
}
// 如果游戏没有开始,激活冻结账户
if
game
.
IsWaiting
{
if
game
.
Status
==
pkt
.
PBGameActionStart
{
for
_
,
player
:=
range
game
.
Players
{
receipt
,
err
:=
action
.
coinsAccount
.
ExecActive
(
player
.
Address
,
action
.
execaddr
,
game
.
GetValue
()
*
POKERBULL_LEVERAGE_MAX
)
if
err
!=
nil
{
logger
.
Error
(
"GameSettleDealer.ExecActive"
,
"addr"
,
player
.
Address
,
"execaddr"
,
action
.
execaddr
,
"amount"
,
game
.
GetValue
(),
"err"
,
err
)
continue
}
logs
=
append
(
logs
,
receipt
.
Logs
...
)
kv
=
append
(
kv
,
receipt
.
KV
...
)
}
}
else
if
game
.
Status
==
pkt
.
PBGameActionContinue
{
for
_
,
player
:=
range
game
.
Players
{
if
!
player
.
Ready
{
continue
}
receipt
,
err
:=
action
.
coinsAccount
.
ExecActive
(
player
.
Address
,
action
.
execaddr
,
game
.
GetValue
()
*
POKERBULL_LEVERAGE_MAX
)
if
err
!=
nil
{
logger
.
Error
(
"GameSettleDealer.ExecActive"
,
"addr"
,
player
.
Address
,
"execaddr"
,
action
.
execaddr
,
"amount"
,
game
.
GetValue
(),
"err"
,
err
)
continue
}
logs
=
append
(
logs
,
receipt
.
Logs
...
)
kv
=
append
(
kv
,
receipt
.
KV
...
)
}
}
game
.
IsWaiting
=
false
}
game
.
PreStatus
=
game
.
Status
game
.
Status
=
pkt
.
PBGameActionQuit
game
.
PrevIndex
=
game
.
Index
game
.
Index
=
action
.
getIndex
(
game
)
game
.
QuitTime
=
action
.
blocktime
game
.
QuitTxHash
=
common
.
ToHex
(
action
.
txhash
)
receiptLog
:=
action
.
GetReceiptLog
(
game
)
logs
=
append
(
logs
,
receiptLog
)
kv
=
append
(
kv
,
action
.
saveGame
(
game
)
...
)
return
&
types
.
Receipt
{
types
.
ExecOk
,
kv
,
logs
},
nil
}
type
HandSlice
[]
*
pkt
.
PBHand
func
(
h
HandSlice
)
Len
()
int
{
return
len
(
h
)
}
func
(
h
HandSlice
)
Swap
(
i
,
j
int
)
{
h
[
i
],
h
[
j
]
=
h
[
j
],
h
[
i
]
}
func
(
h
HandSlice
)
Less
(
i
,
j
int
)
bool
{
if
i
>=
h
.
Len
()
||
j
>=
h
.
Len
()
{
logger
.
Error
(
"length error. slice length:"
,
h
.
Len
(),
" compare lenth: "
,
i
,
" "
,
j
)
}
if
h
[
i
]
==
nil
||
h
[
j
]
==
nil
{
logger
.
Error
(
"nil pointer at "
,
i
,
" "
,
j
)
}
return
CompareResult
(
h
[
i
],
h
[
j
])
}
plugin/dapp/guess/executor/poker.go
0 → 100644
View file @
6ed5261f
// Copyright Fuzamei Corp. 2018 All Rights Reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package
executor
import
(
"fmt"
"math/rand"
"sort"
"github.com/33cn/plugin/plugin/dapp/pokerbull/types"
)
var
POKER_CARD_NUM
=
52
//4 * 13 不带大小王
var
COLOR_OFFSET
uint32
=
8
var
COLOR_BIT_MAST
=
0xFF
var
COLOR_NUM
=
4
var
CARD_NUM_PER_COLOR
=
13
var
CARD_NUM_PER_GAME
=
5
const
(
POKERBULL_RESULT_X1
=
1
POKERBULL_RESULT_X2
=
2
POKERBULL_RESULT_X3
=
3
POKERBULL_RESULT_X4
=
4
POKERBULL_RESULT_X5
=
5
POKERBULL_LEVERAGE_MAX
=
POKERBULL_RESULT_X1
)
func
NewPoker
()
*
types
.
PBPoker
{
poker
:=
new
(
types
.
PBPoker
)
poker
.
Cards
=
make
([]
int32
,
POKER_CARD_NUM
)
poker
.
Pointer
=
int32
(
POKER_CARD_NUM
-
1
)
for
i
:=
0
;
i
<
POKER_CARD_NUM
;
i
++
{
color
:=
i
/
CARD_NUM_PER_COLOR
num
:=
i
%
CARD_NUM_PER_COLOR
+
1
poker
.
Cards
[
i
]
=
int32
(
color
<<
COLOR_OFFSET
+
num
)
}
return
poker
}
// 洗牌
func
Shuffle
(
poker
*
types
.
PBPoker
,
rng
int64
)
{
rndn
:=
rand
.
New
(
rand
.
NewSource
(
rng
))
for
i
:=
0
;
i
<
POKER_CARD_NUM
;
i
++
{
idx
:=
rndn
.
Intn
(
POKER_CARD_NUM
-
1
)
tmpV
:=
poker
.
Cards
[
idx
]
poker
.
Cards
[
idx
]
=
poker
.
Cards
[
POKER_CARD_NUM
-
i
-
1
]
poker
.
Cards
[
POKER_CARD_NUM
-
i
-
1
]
=
tmpV
}
poker
.
Pointer
=
int32
(
POKER_CARD_NUM
-
1
)
}
// 发牌
func
Deal
(
poker
*
types
.
PBPoker
,
rng
int64
)
[]
int32
{
if
poker
.
Pointer
<
int32
(
CARD_NUM_PER_GAME
)
{
logger
.
Error
(
fmt
.
Sprintf
(
"Wait to be shuffled: deal cards [%d], left [%d]"
,
CARD_NUM_PER_GAME
,
poker
.
Pointer
+
1
))
Shuffle
(
poker
,
rng
+
int64
(
poker
.
Cards
[
0
]))
}
rndn
:=
rand
.
New
(
rand
.
NewSource
(
rng
))
res
:=
make
([]
int32
,
CARD_NUM_PER_GAME
)
for
i
:=
0
;
i
<
CARD_NUM_PER_GAME
;
i
++
{
idx
:=
rndn
.
Intn
(
int
(
poker
.
Pointer
))
tmpV
:=
poker
.
Cards
[
poker
.
Pointer
]
res
[
i
]
=
poker
.
Cards
[
idx
]
poker
.
Cards
[
idx
]
=
tmpV
poker
.
Cards
[
poker
.
Pointer
]
=
res
[
i
]
poker
.
Pointer
--
}
return
res
}
// 计算斗牛结果
func
Result
(
cards
[]
int32
)
int32
{
temp
:=
0
r
:=
-
1
//是否有牛标志
pk
:=
newcolorCard
(
cards
)
//花牌等于10
cardsC
:=
make
([]
int
,
len
(
cards
))
for
i
:=
0
;
i
<
len
(
pk
);
i
++
{
if
pk
[
i
]
.
num
>
10
{
cardsC
[
i
]
=
10
}
else
{
cardsC
[
i
]
=
pk
[
i
]
.
num
}
}
//斗牛算法
result
:=
make
([]
int
,
10
)
var
offset
=
0
for
x
:=
0
;
x
<
3
;
x
++
{
for
y
:=
x
+
1
;
y
<
4
;
y
++
{
for
z
:=
y
+
1
;
z
<
5
;
z
++
{
if
(
cardsC
[
x
]
+
cardsC
[
y
]
+
cardsC
[
z
])
%
10
==
0
{
for
j
:=
0
;
j
<
len
(
cardsC
);
j
++
{
if
j
!=
x
&&
j
!=
y
&&
j
!=
z
{
temp
+=
cardsC
[
j
]
}
}
if
temp
%
10
==
0
{
r
=
10
//若有牛,且剩下的两个数也是牛十
}
else
{
r
=
temp
%
10
//若有牛,剩下的不是牛十
}
result
[
offset
]
=
r
offset
++
}
}
}
}
//没有牛
if
r
==
-
1
{
return
-
1
}
return
int32
(
result
[
0
])
}
// 计算结果倍数
func
Leverage
(
hand
*
types
.
PBHand
)
int32
{
result
:=
hand
.
Result
// 小牛 [1, 6]
if
result
<
7
{
return
POKERBULL_RESULT_X1
}
// 大牛 [7, 9]
if
result
>=
7
&&
result
<
10
{
return
POKERBULL_RESULT_X2
}
var
flowers
=
0
if
result
==
10
{
for
_
,
card
:=
range
hand
.
Cards
{
if
(
int
(
card
)
&
COLOR_BIT_MAST
)
>
10
{
flowers
++
}
}
// 牛牛
if
flowers
<
4
{
return
POKERBULL_RESULT_X3
}
// 四花
if
flowers
==
4
{
return
POKERBULL_RESULT_X4
}
// 五花
if
flowers
==
5
{
return
POKERBULL_RESULT_X5
}
}
return
POKERBULL_RESULT_X1
}
type
pokerCard
struct
{
num
int
color
int
}
type
colorCardSlice
[]
*
pokerCard
func
(
p
colorCardSlice
)
Len
()
int
{
return
len
(
p
)
}
func
(
p
colorCardSlice
)
Swap
(
i
,
j
int
)
{
p
[
i
],
p
[
j
]
=
p
[
j
],
p
[
i
]
}
func
(
p
colorCardSlice
)
Less
(
i
,
j
int
)
bool
{
if
i
>=
p
.
Len
()
||
j
>=
p
.
Len
()
{
logger
.
Error
(
"length error. slice length:"
,
p
.
Len
(),
" compare lenth: "
,
i
,
" "
,
j
)
}
if
p
[
i
]
==
nil
||
p
[
j
]
==
nil
{
logger
.
Error
(
"nil pointer at "
,
i
,
" "
,
j
)
}
return
p
[
i
]
.
num
<
p
[
j
]
.
num
}
func
newcolorCard
(
a
[]
int32
)
colorCardSlice
{
var
cardS
[]
*
pokerCard
for
i
:=
0
;
i
<
len
(
a
);
i
++
{
num
:=
int
(
a
[
i
])
&
COLOR_BIT_MAST
color
:=
int
(
a
[
i
])
>>
COLOR_OFFSET
cardS
=
append
(
cardS
,
&
pokerCard
{
num
,
color
})
}
return
cardS
}
func
CompareResult
(
i
,
j
*
types
.
PBHand
)
bool
{
if
i
.
Result
<
j
.
Result
{
return
true
}
if
i
.
Result
==
j
.
Result
{
return
Compare
(
i
.
Cards
,
j
.
Cards
)
}
return
false
}
func
Compare
(
a
[]
int32
,
b
[]
int32
)
bool
{
cardA
:=
newcolorCard
(
a
)
cardB
:=
newcolorCard
(
b
)
if
!
sort
.
IsSorted
(
cardA
)
{
sort
.
Sort
(
cardA
)
}
if
!
sort
.
IsSorted
(
cardB
)
{
sort
.
Sort
(
cardB
)
}
maxA
:=
cardA
[
len
(
a
)
-
1
]
maxB
:=
cardB
[
len
(
b
)
-
1
]
if
maxA
.
num
!=
maxB
.
num
{
return
maxA
.
num
<
maxB
.
num
}
return
maxA
.
color
<
maxB
.
color
}
plugin/dapp/guess/executor/query.go
0 → 100644
View file @
6ed5261f
// Copyright Fuzamei Corp. 2018 All Rights Reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package
executor
import
(
"github.com/33cn/chain33/types"
pkt
"github.com/33cn/plugin/plugin/dapp/pokerbull/types"
)
func
(
g
*
PokerBull
)
Query_QueryGameListByIds
(
in
*
pkt
.
QueryPBGameInfos
)
(
types
.
Message
,
error
)
{
return
Infos
(
g
.
GetStateDB
(),
in
)
}
func
(
g
*
PokerBull
)
Query_QueryGameById
(
in
*
pkt
.
QueryPBGameInfo
)
(
types
.
Message
,
error
)
{
game
,
err
:=
readGame
(
g
.
GetStateDB
(),
in
.
GetGameId
())
if
err
!=
nil
{
return
nil
,
err
}
return
&
pkt
.
ReplyPBGame
{
game
},
nil
}
func
(
g
*
PokerBull
)
Query_QueryGameByAddr
(
in
*
pkt
.
QueryPBGameInfo
)
(
types
.
Message
,
error
)
{
gameIds
,
err
:=
getGameListByAddr
(
g
.
GetLocalDB
(),
in
.
Addr
,
in
.
Index
)
if
err
!=
nil
{
return
nil
,
err
}
return
gameIds
,
nil
}
func
(
g
*
PokerBull
)
Query_QueryGameByStatus
(
in
*
pkt
.
QueryPBGameInfo
)
(
types
.
Message
,
error
)
{
gameIds
,
err
:=
getGameListByStatus
(
g
.
GetLocalDB
(),
in
.
Status
,
in
.
Index
)
if
err
!=
nil
{
return
nil
,
err
}
return
gameIds
,
nil
}
plugin/dapp/guess/plugin.go
0 → 100644
View file @
6ed5261f
// Copyright Fuzamei Corp. 2018 All Rights Reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package
guess
import
(
"github.com/33cn/chain33/pluginmgr"
"github.com/33cn/plugin/plugin/dapp/guess/commands"
"github.com/33cn/plugin/plugin/dapp/guess/executor"
"github.com/33cn/plugin/plugin/dapp/guess/rpc"
"github.com/33cn/plugin/plugin/dapp/guess/types"
)
func
init
()
{
pluginmgr
.
Register
(
&
pluginmgr
.
PluginBase
{
Name
:
types
.
PokerBullX
,
ExecName
:
executor
.
GetName
(),
Exec
:
executor
.
Init
,
Cmd
:
commands
.
GuessCmd
,
RPC
:
rpc
.
Init
,
})
}
plugin/dapp/guess/proto/Makefile
0 → 100644
View file @
6ed5261f
all
:
sh ./create_protobuf.sh
plugin/dapp/guess/proto/create_protobuf.sh
0 → 100755
View file @
6ed5261f
#!/bin/sh
protoc
--go_out
=
plugins
=
grpc:../types ./
*
.proto
--proto_path
=
.
--proto_path
=
"../../../../vendor/github.com/33cn/chain33/types/proto/"
plugin/dapp/guess/proto/guess.proto
0 → 100644
View file @
6ed5261f
syntax
=
"proto3"
;
import
"transaction.proto"
;
package
types
;
//竞猜游戏内容
message
GuessGame
{
string
gameId
=
1
;
//游戏ID
uint32
status
=
2
;
//游戏的状态:创建->投注->截止投注->开奖
int64
startTime
=
3
;
//创建游戏的时间
string
startTxHash
=
4
;
//创建游戏的交易hash
string
topic
=
5
;
//主题
string
options
=
6
;
//选项
int64
stopTime
=
7
;
//截止下注时间
uint32
maxHeight
=
8
;
//截止下注的块高
string
symbol
=
9
;
//bty或者具体token
string
exec
=
10
;
//coins或者token
uint32
oneBet
=
11
;
//一注等于多少bty或者token
uint32
maxBets
=
12
;
//单次可以下多少注,默认100
uint32
maxBetsNumber
=
13
;
//最多可以下多少注
uint32
fee
=
14
;
//收取费用,不带则表示不收费
string
feeAddr
=
15
;
//收费地址
string
adminAddr
=
16
;
//游戏创建者地址,只有该地址可以开奖
uint32
betsNumber
=
17
;
//已下注数,如果数量达到maxBetsNumber,则不允许再下注
repeated
GuessPlayer
plays
=
18
;
//参与游戏下注的玩家投注信息
string
result
=
19
;
repeated
GuessBet
bets
=
20
;
}
message
GuessPlayer
{
string
addr
=
1
;
repeated
GuessBet
bets
=
2
;
}
message
GuessBet
{
string
option
=
1
;
uint32
betsNumber
=
2
;
}
//斗牛游戏内容
message
PokerBull
{
string
gameId
=
1
;
//默认是由创建这局游戏的txHash作为gameId
int32
status
=
2
;
// Start 1 -> Continue 2 -> Quit 3
int64
startTime
=
3
;
//开始时间
string
startTxHash
=
4
;
//游戏启动交易hash
int64
value
=
5
;
//赌注
PBPoker
poker
=
6
;
//扑克牌
repeated
PBPlayer
players
=
7
;
//玩家历史牌和结果集
int32
playerNum
=
8
;
//玩家数
repeated
PBResult
results
=
9
;
//游戏结果集
int64
index
=
10
;
//索引
int64
prevIndex
=
11
;
//上级索引
int64
quitTime
=
12
;
//游戏结束时间
string
quitTxHash
=
13
;
//游戏结束交易hash
string
dealerAddr
=
14
;
//下局庄家地址
bool
isWaiting
=
15
;
//游戏是否处于等待状态
int32
preStatus
=
16
;
//上一index的状态
}
//一把牌
message
PBHand
{
repeated
int32
cards
=
1
;
//一把牌,五张
int32
result
=
2
;
//斗牛结果 (没牛:0, 牛1-9:1-9, 牛牛:10)
string
address
=
3
;
//玩家地址
bool
isWin
=
4
;
//是否赢庄家
int32
leverage
=
5
;
//赌注倍数
}
//玩家
message
PBPlayer
{
repeated
PBHand
hands
=
1
;
//历史发牌和斗牛结果
string
address
=
2
;
//玩家地址
int64
txHash
=
3
;
//发牌随机数因子txhash的整数格式
bool
ready
=
4
;
// continue状态下,是否ready
}
//本局游戏结果
message
PBResult
{
repeated
PBHand
hands
=
1
;
//本局所有玩家的牌和结果,按牛大小升序排序
string
winner
=
2
;
//赢家地址
int32
leverage
=
3
;
//赢得赌注倍数
string
dealer
=
4
;
//庄家
int32
dealerLeverage
=
5
;
//庄家赌注倍数
}
//扑克牌
message
PBPoker
{
repeated
int32
cards
=
1
;
// 52张牌
int32
pointer
=
2
;
//已发牌偏移
}
//游戏状态
message
PBGameAction
{
oneof
value
{
PBGameStart
start
=
1
;
PBGameContinue
continue
=
2
;
PBGameQuit
quit
=
3
;
PBGameQuery
query
=
4
;
}
int32
ty
=
10
;
}
//游戏启动
message
PBGameStart
{
int64
value
=
1
;
int32
playerNum
=
2
;
}
//游戏继续
message
PBGameContinue
{
string
gameId
=
1
;
}
//游戏结束
message
PBGameQuit
{
string
gameId
=
1
;
}
//查询游戏结果
message
PBGameQuery
{
string
gameId
=
1
;
}
//游戏状态
message
GuessGameAction
{
oneof
value
{
GuessGameStart
start
=
1
;
GuessGameBet
bet
=
2
;
GuessGameAbort
abort
=
3
;
GuessGamePublish
publish
=
4
;
GuessGameQuery
query
=
5
;
}
uint32
ty
=
6
;
}
//游戏启动
message
GuessGameStart
{
string
topic
=
1
;
string
options
=
2
;
uint32
maxHeight
=
3
;
string
symbol
=
4
;
string
exec
=
5
;
uint32
oneBet
=
6
;
uint32
maxBets
=
7
;
uint32
maxBetsNumber
=
8
;
uint64
fee
=
9
;
string
feeAddr
=
10
;
}
//参与游戏下注
message
GuessGameBet
{
string
gameId
=
1
;
string
option
=
2
;
uint32
betsNum
=
3
;
}
//游戏异常终止,退还下注
message
GuessGameAbort
{
string
gameId
=
1
;
}
//游戏结果揭晓
message
GuessGamePublish
{
string
gameId
=
1
;
string
result
=
2
;
}
//查询游戏结果
message
GuessGameQuery
{
string
gameId
=
1
;
uint32
ty
=
2
;
}
//根据状态和游戏人数查找
message
QueryPBGameListByStatusAndPlayerNum
{
int32
status
=
1
;
int32
playerNum
=
2
;
int64
index
=
3
;
}
// 索引value值
message
PBGameRecord
{
string
gameId
=
1
;
int32
status
=
2
;
int64
index
=
3
;
}
message
PBGameIndexRecord
{
string
gameId
=
1
;
int64
index
=
2
;
}
message
PBGameRecords
{
repeated
PBGameRecord
records
=
1
;
}
message
QueryPBGameInfo
{
string
gameId
=
1
;
string
addr
=
2
;
int32
status
=
3
;
int64
index
=
4
;
}
message
ReplyPBGame
{
PokerBull
game
=
1
;
}
message
QueryPBGameInfos
{
repeated
string
gameIds
=
1
;
}
message
ReplyPBGameList
{
repeated
PokerBull
games
=
1
;
}
message
ReceiptPBGame
{
string
gameId
=
1
;
int32
status
=
2
;
string
addr
=
3
;
int64
index
=
4
;
int64
prevIndex
=
5
;
int32
playerNum
=
6
;
int64
value
=
7
;
bool
isWaiting
=
8
;
repeated
string
players
=
9
;
int32
preStatus
=
10
;
}
message
GuessStartTxReq
{
string
topic
=
1
;
string
options
=
2
;
int64
startTime
=
3
;
int64
stopTime
=
4
;
uint32
maxHeight
=
5
;
string
symbol
=
6
;
string
exec
=
7
;
uint32
oneBet
=
8
;
uint32
maxBets
=
9
;
uint32
maxBetsNumber
=
10
;
uint64
fee
=
11
;
string
feeAddr
=
12
;
}
message
GuessBetTxReq
{
string
gameId
=
1
;
string
option
=
2
;
uint32
bets
=
3
;
}
message
GuessAbortTxReq
{
string
gameId
=
1
;
}
message
GuessPublishTxReq
{
string
gameId
=
1
;
string
result
=
2
;
}
message
PBContinueTxReq
{
string
gameId
=
1
;
int64
fee
=
2
;
}
message
PBQuitTxReq
{
string
gameId
=
1
;
int64
fee
=
2
;
}
message
PBQueryReq
{
string
gameId
=
1
;
int64
fee
=
2
;
}
// pokerbull 对外提供服务的接口
service
guess
{
//游戏开始
rpc
GuessStart
(
GuessGameStart
)
returns
(
UnsignTx
)
{}
//游戏下注
rpc
GuessBet
(
GuessGameBet
)
returns
(
UnsignTx
)
{}
//游戏异常终止
rpc
GuessAbort
(
GuessGameAbort
)
returns
(
UnsignTx
)
{}
//游戏结束
rpc
GuessPublish
(
GuessGamePublish
)
returns
(
UnsignTx
)
{}
}
plugin/dapp/guess/rpc/jrpc.go
0 → 100644
View file @
6ed5261f
// Copyright Fuzamei Corp. 2018 All Rights Reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package
rpc
import
(
"context"
"encoding/hex"
"github.com/33cn/chain33/types"
pb
"github.com/33cn/plugin/plugin/dapp/guess/types"
)
func
(
c
*
Jrpc
)
GuessStartTx
(
parm
*
pb
.
GuessStartTxReq
,
result
*
interface
{})
error
{
if
parm
==
nil
{
return
types
.
ErrInvalidParam
}
head
:=
&
pb
.
GuessGameStart
{
Topic
:
parm
.
Topic
,
Options
:
parm
.
Options
,
MaxHeight
:
parm
.
MaxHeight
,
Symbol
:
parm
.
Symbol
,
Exec
:
parm
.
Exec
,
OneBet
:
parm
.
OneBet
,
MaxBets
:
parm
.
MaxBets
,
MaxBetsNumber
:
parm
.
MaxBetsNumber
,
Fee
:
parm
.
Fee
,
FeeAddr
:
parm
.
FeeAddr
,
}
reply
,
err
:=
c
.
cli
.
GuessStart
(
context
.
Background
(),
head
)
if
err
!=
nil
{
return
err
}
*
result
=
hex
.
EncodeToString
(
reply
.
Data
)
return
nil
}
func
(
c
*
Jrpc
)
GuessBetTx
(
parm
*
pb
.
GuessBetTxReq
,
result
*
interface
{})
error
{
if
parm
==
nil
{
return
types
.
ErrInvalidParam
}
head
:=
&
pb
.
GuessGameBet
{
GameId
:
parm
.
GameId
,
Option
:
parm
.
Option
,
BetsNum
:
parm
.
Bets
,
}
reply
,
err
:=
c
.
cli
.
GuessBet
(
context
.
Background
(),
head
)
if
err
!=
nil
{
return
err
}
*
result
=
hex
.
EncodeToString
(
reply
.
Data
)
return
nil
}
func
(
c
*
Jrpc
)
GuessAbortTx
(
parm
*
pb
.
GuessAbortTxReq
,
result
*
interface
{})
error
{
if
parm
==
nil
{
return
types
.
ErrInvalidParam
}
head
:=
&
pb
.
GuessGameAbort
{
GameId
:
parm
.
GameId
,
}
reply
,
err
:=
c
.
cli
.
GuessAbort
(
context
.
Background
(),
head
)
if
err
!=
nil
{
return
err
}
*
result
=
hex
.
EncodeToString
(
reply
.
Data
)
return
nil
}
func
(
c
*
Jrpc
)
GuessPublishTx
(
parm
*
pb
.
GuessPublishTxReq
,
result
*
interface
{})
error
{
if
parm
==
nil
{
return
types
.
ErrInvalidParam
}
head
:=
&
pb
.
GuessGamePublish
{
GameId
:
parm
.
GameId
,
Result
:
parm
.
Result
,
}
reply
,
err
:=
c
.
cli
.
GuessPublish
(
context
.
Background
(),
head
)
if
err
!=
nil
{
return
err
}
*
result
=
hex
.
EncodeToString
(
reply
.
Data
)
return
nil
}
func
(
c
*
Jrpc
)
PokerBullQueryTx
(
parm
*
pb
.
PBQueryReq
,
result
*
interface
{})
error
{
if
parm
==
nil
{
return
types
.
ErrInvalidParam
}
head
:=
&
pb
.
PBGameQuery
{
GameId
:
parm
.
GameId
,
}
reply
,
err
:=
c
.
cli
.
Show
(
context
.
Background
(),
head
)
if
err
!=
nil
{
return
err
}
*
result
=
hex
.
EncodeToString
(
reply
.
Data
)
return
nil
}
plugin/dapp/guess/rpc/jrpc_channel_test.go
0 → 100644
View file @
6ed5261f
// Copyright Fuzamei Corp. 2018 All Rights Reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package
rpc_test
import
(
"strings"
"testing"
commonlog
"github.com/33cn/chain33/common/log"
"github.com/33cn/chain33/rpc/jsonclient"
"github.com/33cn/chain33/types"
"github.com/33cn/chain33/util/testnode"
pty
"github.com/33cn/plugin/plugin/dapp/pokerbull/types"
"github.com/stretchr/testify/assert"
_
"github.com/33cn/chain33/system"
_
"github.com/33cn/plugin/plugin"
)
func
init
()
{
commonlog
.
SetLogLevel
(
"error"
)
}
func
TestJRPCChannel
(
t
*
testing
.
T
)
{
// 启动RPCmocker
mocker
:=
testnode
.
New
(
"--notset--"
,
nil
)
defer
func
()
{
mocker
.
Close
()
}()
mocker
.
Listen
()
jrpcClient
:=
mocker
.
GetJsonC
()
assert
.
NotNil
(
t
,
jrpcClient
)
testCases
:=
[]
struct
{
fn
func
(
*
testing
.
T
,
*
jsonclient
.
JSONClient
)
error
}{
{
fn
:
testStartRawTxCmd
},
{
fn
:
testContinueRawTxCmd
},
{
fn
:
testQuitRawTxCmd
},
{
fn
:
testQueryGameById
},
{
fn
:
testQueryGameByAddr
},
}
for
index
,
testCase
:=
range
testCases
{
err
:=
testCase
.
fn
(
t
,
jrpcClient
)
if
err
==
nil
{
continue
}
assert
.
NotEqualf
(
t
,
err
,
types
.
ErrActionNotSupport
,
"test index %d"
,
index
)
if
strings
.
Contains
(
err
.
Error
(),
"rpc: can't find"
)
{
assert
.
FailNowf
(
t
,
err
.
Error
(),
"test index %d"
,
index
)
}
}
}
func
testStartRawTxCmd
(
t
*
testing
.
T
,
jrpc
*
jsonclient
.
JSONClient
)
error
{
params
:=
pty
.
PBStartTxReq
{}
var
res
string
return
jrpc
.
Call
(
"pokerbull.PokerBullStartTx"
,
params
,
&
res
)
}
func
testContinueRawTxCmd
(
t
*
testing
.
T
,
jrpc
*
jsonclient
.
JSONClient
)
error
{
params
:=
pty
.
PBContinueTxReq
{}
var
res
string
return
jrpc
.
Call
(
"pokerbull.PokerBullContinueTx"
,
params
,
&
res
)
}
func
testQuitRawTxCmd
(
t
*
testing
.
T
,
jrpc
*
jsonclient
.
JSONClient
)
error
{
params
:=
pty
.
PBContinueTxReq
{}
var
res
string
return
jrpc
.
Call
(
"pokerbull.PokerBullQuitTx"
,
params
,
&
res
)
}
func
testQueryGameById
(
t
*
testing
.
T
,
jrpc
*
jsonclient
.
JSONClient
)
error
{
var
rep
interface
{}
var
params
types
.
Query4Cli
req
:=
&
pty
.
QueryPBGameInfo
{}
params
.
Execer
=
"pokerbull"
params
.
FuncName
=
"QueryGameById"
params
.
Payload
=
req
rep
=
&
pty
.
ReplyPBGame
{}
return
jrpc
.
Call
(
"Chain33.Query"
,
params
,
rep
)
}
func
testQueryGameByAddr
(
t
*
testing
.
T
,
jrpc
*
jsonclient
.
JSONClient
)
error
{
var
rep
interface
{}
var
params
types
.
Query4Cli
req
:=
&
pty
.
QueryPBGameInfo
{}
params
.
Execer
=
"pokerbull"
params
.
FuncName
=
"QueryGameByAddr"
params
.
Payload
=
req
rep
=
&
pty
.
PBGameRecords
{}
return
jrpc
.
Call
(
"Chain33.Query"
,
params
,
rep
)
}
plugin/dapp/guess/rpc/rpc.go
0 → 100644
View file @
6ed5261f
// Copyright Fuzamei Corp. 2018 All Rights Reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package
rpc
import
(
"context"
"fmt"
"github.com/33cn/chain33/types"
pb
"github.com/33cn/plugin/plugin/dapp/guess/types"
"github.com/33cn/plugin/plugin/dapp/pokerbull/executor"
)
func
(
c
*
channelClient
)
GuessStart
(
ctx
context
.
Context
,
head
*
pb
.
GuessGameStart
)
(
*
types
.
UnsignTx
,
error
)
{
if
head
.
MaxBetsNumber
>
executor
.
MaxBetsNumber
{
return
nil
,
fmt
.
Errorf
(
"Max Bets Number Should Be Maximum %d"
,
executor
.
MaxBetsNumber
)
}
val
:=
&
pb
.
GuessGameAction
{
Ty
:
pb
.
GuessGameActionStart
,
Value
:
&
pb
.
GuessGameAction_Start
{
head
},
}
tx
,
err
:=
types
.
CreateFormatTx
(
pb
.
GuessX
,
types
.
Encode
(
val
))
if
err
!=
nil
{
return
nil
,
err
}
data
:=
types
.
Encode
(
tx
)
return
&
types
.
UnsignTx
{
Data
:
data
},
nil
}
func
(
c
*
channelClient
)
GuessBet
(
ctx
context
.
Context
,
head
*
pb
.
GuessGameBet
)
(
*
types
.
UnsignTx
,
error
)
{
val
:=
&
pb
.
GuessGameAction
{
Ty
:
pb
.
GuessGameActionBet
,
Value
:
&
pb
.
GuessGameAction_Bet
{
head
},
}
tx
,
err
:=
types
.
CreateFormatTx
(
pb
.
GuessX
,
types
.
Encode
(
val
))
if
err
!=
nil
{
return
nil
,
err
}
data
:=
types
.
Encode
(
tx
)
return
&
types
.
UnsignTx
{
Data
:
data
},
nil
}
func
(
c
*
channelClient
)
GuessAbort
(
ctx
context
.
Context
,
head
*
pb
.
GuessGameAbort
)
(
*
types
.
UnsignTx
,
error
)
{
val
:=
&
pb
.
GuessGameAction
{
Ty
:
pb
.
GuessGameActionAbort
,
Value
:
&
pb
.
GuessGameAction_Abort
{
head
},
}
tx
,
err
:=
types
.
CreateFormatTx
(
pb
.
GuessX
,
types
.
Encode
(
val
))
if
err
!=
nil
{
return
nil
,
err
}
data
:=
types
.
Encode
(
tx
)
return
&
types
.
UnsignTx
{
Data
:
data
},
nil
}
func
(
c
*
channelClient
)
GuessPublish
(
ctx
context
.
Context
,
head
*
pb
.
GuessGamePublish
)
(
*
types
.
UnsignTx
,
error
)
{
val
:=
&
pb
.
GuessGameAction
{
Ty
:
pb
.
GuessGameActionPublish
,
Value
:
&
pb
.
GuessGameAction_Publish
{
head
},
}
tx
,
err
:=
types
.
CreateFormatTx
(
pb
.
GuessX
,
types
.
Encode
(
val
))
if
err
!=
nil
{
return
nil
,
err
}
data
:=
types
.
Encode
(
tx
)
return
&
types
.
UnsignTx
{
Data
:
data
},
nil
}
func
(
c
*
channelClient
)
Show
(
ctx
context
.
Context
,
head
*
pb
.
PBGameQuery
)
(
*
types
.
UnsignTx
,
error
)
{
val
:=
&
pb
.
PBGameAction
{
Ty
:
pb
.
PBGameActionQuery
,
Value
:
&
pb
.
PBGameAction_Query
{
head
},
}
tx
,
err
:=
types
.
CreateFormatTx
(
pb
.
PokerBullX
,
types
.
Encode
(
val
))
if
err
!=
nil
{
return
nil
,
err
}
data
:=
types
.
Encode
(
tx
)
return
&
types
.
UnsignTx
{
Data
:
data
},
nil
}
plugin/dapp/guess/rpc/tx.go
0 → 100644
View file @
6ed5261f
// Copyright Fuzamei Corp. 2018 All Rights Reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package
rpc
type
PokerBullStartTx
struct
{
Value
int64
`json:"value"`
PlayerNum
int32
`json:"playerNum"`
Fee
int64
`json:"fee"`
}
type
PBContinueTxReq
struct
{
GameId
string
`json:"gameId"`
Fee
int64
`json:"fee"`
}
type
PBQuitTxReq
struct
{
GameId
string
`json:"gameId"`
Fee
int64
`json:"fee"`
}
type
PBQueryReq
struct
{
GameId
string
`json:"GameId"`
Fee
int64
`json:"fee"`
}
plugin/dapp/guess/rpc/types.go
0 → 100644
View file @
6ed5261f
// Copyright Fuzamei Corp. 2018 All Rights Reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package
rpc
import
(
"github.com/33cn/chain33/rpc/types"
)
type
Jrpc
struct
{
cli
*
channelClient
}
type
Grpc
struct
{
*
channelClient
}
type
channelClient
struct
{
types
.
ChannelClient
}
func
Init
(
name
string
,
s
types
.
RPCServer
)
{
cli
:=
&
channelClient
{}
grpc
:=
&
Grpc
{
channelClient
:
cli
}
cli
.
Init
(
name
,
s
,
&
Jrpc
{
cli
:
cli
},
grpc
)
}
plugin/dapp/guess/types/const.go
0 → 100644
View file @
6ed5261f
// Copyright Fuzamei Corp. 2018 All Rights Reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package
types
//game action ty
const
(
PBGameActionStart
=
iota
+
1
PBGameActionContinue
PBGameActionQuit
PBGameActionQuery
GuessGameActionStart
=
iota
+
1
GuessGameActionBet
GuessGameActionAbort
GuessGameActionPublish
)
const
(
PlayStyleDefault
=
iota
+
1
PlayStyleDealer
)
const
(
//log for PBgame
TyLogPBGameStart
=
721
TyLogPBGameContinue
=
722
TyLogPBGameQuit
=
723
TyLogPBGameQuery
=
724
TyLogGuessGameStart
=
901
TyLogGuessGameBet
=
902
TyLogGuessGameDraw
=
903
TyLogGuessGameClose
=
904
)
//包的名字可以通过配置文件来配置
//建议用github的组织名称,或者用户名字开头, 再加上自己的插件的名字
//如果发生重名,可以通过配置文件修改这些名字
var
(
JRPCName
=
"pokerbull"
PokerBullX
=
"pokerbull"
ExecerPokerBull
=
[]
byte
(
PokerBullX
)
JRPCName
=
"guess"
GuessX
=
"guess"
ExecerGuess
=
[]
byte
(
GuessX
)
)
const
(
//查询方法名
FuncName_QueryGameListByIds
=
"QueryGameListByIds"
FuncName_QueryGameById
=
"QueryGameById"
FuncName_QueryGameByAddr
=
"QueryGameByAddr"
FuncName_QueryGameByStatus
=
"QueryGameByStatus"
)
plugin/dapp/guess/types/guess.pb.go
0 → 100644
View file @
6ed5261f
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: guess.proto
package
types
import
(
context
"context"
fmt
"fmt"
types
"github.com/33cn/chain33/types"
proto
"github.com/golang/protobuf/proto"
grpc
"google.golang.org/grpc"
math
"math"
)
// Reference imports to suppress errors if they are not otherwise used.
var
_
=
proto
.
Marshal
var
_
=
fmt
.
Errorf
var
_
=
math
.
Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const
_
=
proto
.
ProtoPackageIsVersion2
// please upgrade the proto package
//竞猜游戏内容
type
GuessGame
struct
{
GameId
string
`protobuf:"bytes,1,opt,name=gameId,proto3" json:"gameId,omitempty"`
Status
uint32
`protobuf:"varint,2,opt,name=status,proto3" json:"status,omitempty"`
StartTime
int64
`protobuf:"varint,3,opt,name=startTime,proto3" json:"startTime,omitempty"`
StartTxHash
string
`protobuf:"bytes,4,opt,name=startTxHash,proto3" json:"startTxHash,omitempty"`
Topic
string
`protobuf:"bytes,5,opt,name=topic,proto3" json:"topic,omitempty"`
Options
string
`protobuf:"bytes,6,opt,name=options,proto3" json:"options,omitempty"`
StopTime
int64
`protobuf:"varint,7,opt,name=stopTime,proto3" json:"stopTime,omitempty"`
MaxHeight
uint32
`protobuf:"varint,8,opt,name=maxHeight,proto3" json:"maxHeight,omitempty"`
Symbol
string
`protobuf:"bytes,9,opt,name=symbol,proto3" json:"symbol,omitempty"`
Exec
string
`protobuf:"bytes,10,opt,name=exec,proto3" json:"exec,omitempty"`
OneBet
uint32
`protobuf:"varint,11,opt,name=oneBet,proto3" json:"oneBet,omitempty"`
MaxBets
uint32
`protobuf:"varint,12,opt,name=maxBets,proto3" json:"maxBets,omitempty"`
MaxBetsNumber
uint32
`protobuf:"varint,13,opt,name=maxBetsNumber,proto3" json:"maxBetsNumber,omitempty"`
Fee
uint32
`protobuf:"varint,14,opt,name=fee,proto3" json:"fee,omitempty"`
FeeAddr
string
`protobuf:"bytes,15,opt,name=feeAddr,proto3" json:"feeAddr,omitempty"`
AdminAddr
string
`protobuf:"bytes,16,opt,name=adminAddr,proto3" json:"adminAddr,omitempty"`
BetsNumber
uint32
`protobuf:"varint,17,opt,name=betsNumber,proto3" json:"betsNumber,omitempty"`
Plays
[]
*
GuessPlayer
`protobuf:"bytes,18,rep,name=plays,proto3" json:"plays,omitempty"`
Result
string
`protobuf:"bytes,19,opt,name=result,proto3" json:"result,omitempty"`
Bets
[]
*
GuessBet
`protobuf:"bytes,20,rep,name=bets,proto3" json:"bets,omitempty"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
XXX_unrecognized
[]
byte
`json:"-"`
XXX_sizecache
int32
`json:"-"`
}
func
(
m
*
GuessGame
)
Reset
()
{
*
m
=
GuessGame
{}
}
func
(
m
*
GuessGame
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
GuessGame
)
ProtoMessage
()
{}
func
(
*
GuessGame
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_7574406c5d3430e8
,
[]
int
{
0
}
}
func
(
m
*
GuessGame
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_GuessGame
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
GuessGame
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_GuessGame
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
GuessGame
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_GuessGame
.
Merge
(
m
,
src
)
}
func
(
m
*
GuessGame
)
XXX_Size
()
int
{
return
xxx_messageInfo_GuessGame
.
Size
(
m
)
}
func
(
m
*
GuessGame
)
XXX_DiscardUnknown
()
{
xxx_messageInfo_GuessGame
.
DiscardUnknown
(
m
)
}
var
xxx_messageInfo_GuessGame
proto
.
InternalMessageInfo
func
(
m
*
GuessGame
)
GetGameId
()
string
{
if
m
!=
nil
{
return
m
.
GameId
}
return
""
}
func
(
m
*
GuessGame
)
GetStatus
()
uint32
{
if
m
!=
nil
{
return
m
.
Status
}
return
0
}
func
(
m
*
GuessGame
)
GetStartTime
()
int64
{
if
m
!=
nil
{
return
m
.
StartTime
}
return
0
}
func
(
m
*
GuessGame
)
GetStartTxHash
()
string
{
if
m
!=
nil
{
return
m
.
StartTxHash
}
return
""
}
func
(
m
*
GuessGame
)
GetTopic
()
string
{
if
m
!=
nil
{
return
m
.
Topic
}
return
""
}
func
(
m
*
GuessGame
)
GetOptions
()
string
{
if
m
!=
nil
{
return
m
.
Options
}
return
""
}
func
(
m
*
GuessGame
)
GetStopTime
()
int64
{
if
m
!=
nil
{
return
m
.
StopTime
}
return
0
}
func
(
m
*
GuessGame
)
GetMaxHeight
()
uint32
{
if
m
!=
nil
{
return
m
.
MaxHeight
}
return
0
}
func
(
m
*
GuessGame
)
GetSymbol
()
string
{
if
m
!=
nil
{
return
m
.
Symbol
}
return
""
}
func
(
m
*
GuessGame
)
GetExec
()
string
{
if
m
!=
nil
{
return
m
.
Exec
}
return
""
}
func
(
m
*
GuessGame
)
GetOneBet
()
uint32
{
if
m
!=
nil
{
return
m
.
OneBet
}
return
0
}
func
(
m
*
GuessGame
)
GetMaxBets
()
uint32
{
if
m
!=
nil
{
return
m
.
MaxBets
}
return
0
}
func
(
m
*
GuessGame
)
GetMaxBetsNumber
()
uint32
{
if
m
!=
nil
{
return
m
.
MaxBetsNumber
}
return
0
}
func
(
m
*
GuessGame
)
GetFee
()
uint32
{
if
m
!=
nil
{
return
m
.
Fee
}
return
0
}
func
(
m
*
GuessGame
)
GetFeeAddr
()
string
{
if
m
!=
nil
{
return
m
.
FeeAddr
}
return
""
}
func
(
m
*
GuessGame
)
GetAdminAddr
()
string
{
if
m
!=
nil
{
return
m
.
AdminAddr
}
return
""
}
func
(
m
*
GuessGame
)
GetBetsNumber
()
uint32
{
if
m
!=
nil
{
return
m
.
BetsNumber
}
return
0
}
func
(
m
*
GuessGame
)
GetPlays
()
[]
*
GuessPlayer
{
if
m
!=
nil
{
return
m
.
Plays
}
return
nil
}
func
(
m
*
GuessGame
)
GetResult
()
string
{
if
m
!=
nil
{
return
m
.
Result
}
return
""
}
func
(
m
*
GuessGame
)
GetBets
()
[]
*
GuessBet
{
if
m
!=
nil
{
return
m
.
Bets
}
return
nil
}
type
GuessPlayer
struct
{
Addr
string
`protobuf:"bytes,1,opt,name=addr,proto3" json:"addr,omitempty"`
Bets
[]
*
GuessBet
`protobuf:"bytes,2,rep,name=bets,proto3" json:"bets,omitempty"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
XXX_unrecognized
[]
byte
`json:"-"`
XXX_sizecache
int32
`json:"-"`
}
func
(
m
*
GuessPlayer
)
Reset
()
{
*
m
=
GuessPlayer
{}
}
func
(
m
*
GuessPlayer
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
GuessPlayer
)
ProtoMessage
()
{}
func
(
*
GuessPlayer
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_7574406c5d3430e8
,
[]
int
{
1
}
}
func
(
m
*
GuessPlayer
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_GuessPlayer
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
GuessPlayer
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_GuessPlayer
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
GuessPlayer
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_GuessPlayer
.
Merge
(
m
,
src
)
}
func
(
m
*
GuessPlayer
)
XXX_Size
()
int
{
return
xxx_messageInfo_GuessPlayer
.
Size
(
m
)
}
func
(
m
*
GuessPlayer
)
XXX_DiscardUnknown
()
{
xxx_messageInfo_GuessPlayer
.
DiscardUnknown
(
m
)
}
var
xxx_messageInfo_GuessPlayer
proto
.
InternalMessageInfo
func
(
m
*
GuessPlayer
)
GetAddr
()
string
{
if
m
!=
nil
{
return
m
.
Addr
}
return
""
}
func
(
m
*
GuessPlayer
)
GetBets
()
[]
*
GuessBet
{
if
m
!=
nil
{
return
m
.
Bets
}
return
nil
}
type
GuessBet
struct
{
Option
string
`protobuf:"bytes,1,opt,name=option,proto3" json:"option,omitempty"`
BetsNumber
uint32
`protobuf:"varint,2,opt,name=betsNumber,proto3" json:"betsNumber,omitempty"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
XXX_unrecognized
[]
byte
`json:"-"`
XXX_sizecache
int32
`json:"-"`
}
func
(
m
*
GuessBet
)
Reset
()
{
*
m
=
GuessBet
{}
}
func
(
m
*
GuessBet
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
GuessBet
)
ProtoMessage
()
{}
func
(
*
GuessBet
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_7574406c5d3430e8
,
[]
int
{
2
}
}
func
(
m
*
GuessBet
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_GuessBet
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
GuessBet
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_GuessBet
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
GuessBet
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_GuessBet
.
Merge
(
m
,
src
)
}
func
(
m
*
GuessBet
)
XXX_Size
()
int
{
return
xxx_messageInfo_GuessBet
.
Size
(
m
)
}
func
(
m
*
GuessBet
)
XXX_DiscardUnknown
()
{
xxx_messageInfo_GuessBet
.
DiscardUnknown
(
m
)
}
var
xxx_messageInfo_GuessBet
proto
.
InternalMessageInfo
func
(
m
*
GuessBet
)
GetOption
()
string
{
if
m
!=
nil
{
return
m
.
Option
}
return
""
}
func
(
m
*
GuessBet
)
GetBetsNumber
()
uint32
{
if
m
!=
nil
{
return
m
.
BetsNumber
}
return
0
}
//斗牛游戏内容
type
PokerBull
struct
{
GameId
string
`protobuf:"bytes,1,opt,name=gameId,proto3" json:"gameId,omitempty"`
Status
int32
`protobuf:"varint,2,opt,name=status,proto3" json:"status,omitempty"`
StartTime
int64
`protobuf:"varint,3,opt,name=startTime,proto3" json:"startTime,omitempty"`
StartTxHash
string
`protobuf:"bytes,4,opt,name=startTxHash,proto3" json:"startTxHash,omitempty"`
Value
int64
`protobuf:"varint,5,opt,name=value,proto3" json:"value,omitempty"`
Poker
*
PBPoker
`protobuf:"bytes,6,opt,name=poker,proto3" json:"poker,omitempty"`
Players
[]
*
PBPlayer
`protobuf:"bytes,7,rep,name=players,proto3" json:"players,omitempty"`
PlayerNum
int32
`protobuf:"varint,8,opt,name=playerNum,proto3" json:"playerNum,omitempty"`
Results
[]
*
PBResult
`protobuf:"bytes,9,rep,name=results,proto3" json:"results,omitempty"`
Index
int64
`protobuf:"varint,10,opt,name=index,proto3" json:"index,omitempty"`
PrevIndex
int64
`protobuf:"varint,11,opt,name=prevIndex,proto3" json:"prevIndex,omitempty"`
QuitTime
int64
`protobuf:"varint,12,opt,name=quitTime,proto3" json:"quitTime,omitempty"`
QuitTxHash
string
`protobuf:"bytes,13,opt,name=quitTxHash,proto3" json:"quitTxHash,omitempty"`
DealerAddr
string
`protobuf:"bytes,14,opt,name=dealerAddr,proto3" json:"dealerAddr,omitempty"`
IsWaiting
bool
`protobuf:"varint,15,opt,name=isWaiting,proto3" json:"isWaiting,omitempty"`
PreStatus
int32
`protobuf:"varint,16,opt,name=preStatus,proto3" json:"preStatus,omitempty"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
XXX_unrecognized
[]
byte
`json:"-"`
XXX_sizecache
int32
`json:"-"`
}
func
(
m
*
PokerBull
)
Reset
()
{
*
m
=
PokerBull
{}
}
func
(
m
*
PokerBull
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
PokerBull
)
ProtoMessage
()
{}
func
(
*
PokerBull
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_7574406c5d3430e8
,
[]
int
{
3
}
}
func
(
m
*
PokerBull
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_PokerBull
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
PokerBull
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_PokerBull
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
PokerBull
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_PokerBull
.
Merge
(
m
,
src
)
}
func
(
m
*
PokerBull
)
XXX_Size
()
int
{
return
xxx_messageInfo_PokerBull
.
Size
(
m
)
}
func
(
m
*
PokerBull
)
XXX_DiscardUnknown
()
{
xxx_messageInfo_PokerBull
.
DiscardUnknown
(
m
)
}
var
xxx_messageInfo_PokerBull
proto
.
InternalMessageInfo
func
(
m
*
PokerBull
)
GetGameId
()
string
{
if
m
!=
nil
{
return
m
.
GameId
}
return
""
}
func
(
m
*
PokerBull
)
GetStatus
()
int32
{
if
m
!=
nil
{
return
m
.
Status
}
return
0
}
func
(
m
*
PokerBull
)
GetStartTime
()
int64
{
if
m
!=
nil
{
return
m
.
StartTime
}
return
0
}
func
(
m
*
PokerBull
)
GetStartTxHash
()
string
{
if
m
!=
nil
{
return
m
.
StartTxHash
}
return
""
}
func
(
m
*
PokerBull
)
GetValue
()
int64
{
if
m
!=
nil
{
return
m
.
Value
}
return
0
}
func
(
m
*
PokerBull
)
GetPoker
()
*
PBPoker
{
if
m
!=
nil
{
return
m
.
Poker
}
return
nil
}
func
(
m
*
PokerBull
)
GetPlayers
()
[]
*
PBPlayer
{
if
m
!=
nil
{
return
m
.
Players
}
return
nil
}
func
(
m
*
PokerBull
)
GetPlayerNum
()
int32
{
if
m
!=
nil
{
return
m
.
PlayerNum
}
return
0
}
func
(
m
*
PokerBull
)
GetResults
()
[]
*
PBResult
{
if
m
!=
nil
{
return
m
.
Results
}
return
nil
}
func
(
m
*
PokerBull
)
GetIndex
()
int64
{
if
m
!=
nil
{
return
m
.
Index
}
return
0
}
func
(
m
*
PokerBull
)
GetPrevIndex
()
int64
{
if
m
!=
nil
{
return
m
.
PrevIndex
}
return
0
}
func
(
m
*
PokerBull
)
GetQuitTime
()
int64
{
if
m
!=
nil
{
return
m
.
QuitTime
}
return
0
}
func
(
m
*
PokerBull
)
GetQuitTxHash
()
string
{
if
m
!=
nil
{
return
m
.
QuitTxHash
}
return
""
}
func
(
m
*
PokerBull
)
GetDealerAddr
()
string
{
if
m
!=
nil
{
return
m
.
DealerAddr
}
return
""
}
func
(
m
*
PokerBull
)
GetIsWaiting
()
bool
{
if
m
!=
nil
{
return
m
.
IsWaiting
}
return
false
}
func
(
m
*
PokerBull
)
GetPreStatus
()
int32
{
if
m
!=
nil
{
return
m
.
PreStatus
}
return
0
}
//一把牌
type
PBHand
struct
{
Cards
[]
int32
`protobuf:"varint,1,rep,packed,name=cards,proto3" json:"cards,omitempty"`
Result
int32
`protobuf:"varint,2,opt,name=result,proto3" json:"result,omitempty"`
Address
string
`protobuf:"bytes,3,opt,name=address,proto3" json:"address,omitempty"`
IsWin
bool
`protobuf:"varint,4,opt,name=isWin,proto3" json:"isWin,omitempty"`
Leverage
int32
`protobuf:"varint,5,opt,name=leverage,proto3" json:"leverage,omitempty"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
XXX_unrecognized
[]
byte
`json:"-"`
XXX_sizecache
int32
`json:"-"`
}
func
(
m
*
PBHand
)
Reset
()
{
*
m
=
PBHand
{}
}
func
(
m
*
PBHand
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
PBHand
)
ProtoMessage
()
{}
func
(
*
PBHand
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_7574406c5d3430e8
,
[]
int
{
4
}
}
func
(
m
*
PBHand
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_PBHand
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
PBHand
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_PBHand
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
PBHand
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_PBHand
.
Merge
(
m
,
src
)
}
func
(
m
*
PBHand
)
XXX_Size
()
int
{
return
xxx_messageInfo_PBHand
.
Size
(
m
)
}
func
(
m
*
PBHand
)
XXX_DiscardUnknown
()
{
xxx_messageInfo_PBHand
.
DiscardUnknown
(
m
)
}
var
xxx_messageInfo_PBHand
proto
.
InternalMessageInfo
func
(
m
*
PBHand
)
GetCards
()
[]
int32
{
if
m
!=
nil
{
return
m
.
Cards
}
return
nil
}
func
(
m
*
PBHand
)
GetResult
()
int32
{
if
m
!=
nil
{
return
m
.
Result
}
return
0
}
func
(
m
*
PBHand
)
GetAddress
()
string
{
if
m
!=
nil
{
return
m
.
Address
}
return
""
}
func
(
m
*
PBHand
)
GetIsWin
()
bool
{
if
m
!=
nil
{
return
m
.
IsWin
}
return
false
}
func
(
m
*
PBHand
)
GetLeverage
()
int32
{
if
m
!=
nil
{
return
m
.
Leverage
}
return
0
}
//玩家
type
PBPlayer
struct
{
Hands
[]
*
PBHand
`protobuf:"bytes,1,rep,name=hands,proto3" json:"hands,omitempty"`
Address
string
`protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"`
TxHash
int64
`protobuf:"varint,3,opt,name=txHash,proto3" json:"txHash,omitempty"`
Ready
bool
`protobuf:"varint,4,opt,name=ready,proto3" json:"ready,omitempty"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
XXX_unrecognized
[]
byte
`json:"-"`
XXX_sizecache
int32
`json:"-"`
}
func
(
m
*
PBPlayer
)
Reset
()
{
*
m
=
PBPlayer
{}
}
func
(
m
*
PBPlayer
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
PBPlayer
)
ProtoMessage
()
{}
func
(
*
PBPlayer
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_7574406c5d3430e8
,
[]
int
{
5
}
}
func
(
m
*
PBPlayer
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_PBPlayer
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
PBPlayer
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_PBPlayer
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
PBPlayer
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_PBPlayer
.
Merge
(
m
,
src
)
}
func
(
m
*
PBPlayer
)
XXX_Size
()
int
{
return
xxx_messageInfo_PBPlayer
.
Size
(
m
)
}
func
(
m
*
PBPlayer
)
XXX_DiscardUnknown
()
{
xxx_messageInfo_PBPlayer
.
DiscardUnknown
(
m
)
}
var
xxx_messageInfo_PBPlayer
proto
.
InternalMessageInfo
func
(
m
*
PBPlayer
)
GetHands
()
[]
*
PBHand
{
if
m
!=
nil
{
return
m
.
Hands
}
return
nil
}
func
(
m
*
PBPlayer
)
GetAddress
()
string
{
if
m
!=
nil
{
return
m
.
Address
}
return
""
}
func
(
m
*
PBPlayer
)
GetTxHash
()
int64
{
if
m
!=
nil
{
return
m
.
TxHash
}
return
0
}
func
(
m
*
PBPlayer
)
GetReady
()
bool
{
if
m
!=
nil
{
return
m
.
Ready
}
return
false
}
//本局游戏结果
type
PBResult
struct
{
Hands
[]
*
PBHand
`protobuf:"bytes,1,rep,name=hands,proto3" json:"hands,omitempty"`
Winner
string
`protobuf:"bytes,2,opt,name=winner,proto3" json:"winner,omitempty"`
Leverage
int32
`protobuf:"varint,3,opt,name=leverage,proto3" json:"leverage,omitempty"`
Dealer
string
`protobuf:"bytes,4,opt,name=dealer,proto3" json:"dealer,omitempty"`
DealerLeverage
int32
`protobuf:"varint,5,opt,name=dealerLeverage,proto3" json:"dealerLeverage,omitempty"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
XXX_unrecognized
[]
byte
`json:"-"`
XXX_sizecache
int32
`json:"-"`
}
func
(
m
*
PBResult
)
Reset
()
{
*
m
=
PBResult
{}
}
func
(
m
*
PBResult
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
PBResult
)
ProtoMessage
()
{}
func
(
*
PBResult
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_7574406c5d3430e8
,
[]
int
{
6
}
}
func
(
m
*
PBResult
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_PBResult
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
PBResult
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_PBResult
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
PBResult
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_PBResult
.
Merge
(
m
,
src
)
}
func
(
m
*
PBResult
)
XXX_Size
()
int
{
return
xxx_messageInfo_PBResult
.
Size
(
m
)
}
func
(
m
*
PBResult
)
XXX_DiscardUnknown
()
{
xxx_messageInfo_PBResult
.
DiscardUnknown
(
m
)
}
var
xxx_messageInfo_PBResult
proto
.
InternalMessageInfo
func
(
m
*
PBResult
)
GetHands
()
[]
*
PBHand
{
if
m
!=
nil
{
return
m
.
Hands
}
return
nil
}
func
(
m
*
PBResult
)
GetWinner
()
string
{
if
m
!=
nil
{
return
m
.
Winner
}
return
""
}
func
(
m
*
PBResult
)
GetLeverage
()
int32
{
if
m
!=
nil
{
return
m
.
Leverage
}
return
0
}
func
(
m
*
PBResult
)
GetDealer
()
string
{
if
m
!=
nil
{
return
m
.
Dealer
}
return
""
}
func
(
m
*
PBResult
)
GetDealerLeverage
()
int32
{
if
m
!=
nil
{
return
m
.
DealerLeverage
}
return
0
}
//扑克牌
type
PBPoker
struct
{
Cards
[]
int32
`protobuf:"varint,1,rep,packed,name=cards,proto3" json:"cards,omitempty"`
Pointer
int32
`protobuf:"varint,2,opt,name=pointer,proto3" json:"pointer,omitempty"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
XXX_unrecognized
[]
byte
`json:"-"`
XXX_sizecache
int32
`json:"-"`
}
func
(
m
*
PBPoker
)
Reset
()
{
*
m
=
PBPoker
{}
}
func
(
m
*
PBPoker
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
PBPoker
)
ProtoMessage
()
{}
func
(
*
PBPoker
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_7574406c5d3430e8
,
[]
int
{
7
}
}
func
(
m
*
PBPoker
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_PBPoker
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
PBPoker
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_PBPoker
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
PBPoker
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_PBPoker
.
Merge
(
m
,
src
)
}
func
(
m
*
PBPoker
)
XXX_Size
()
int
{
return
xxx_messageInfo_PBPoker
.
Size
(
m
)
}
func
(
m
*
PBPoker
)
XXX_DiscardUnknown
()
{
xxx_messageInfo_PBPoker
.
DiscardUnknown
(
m
)
}
var
xxx_messageInfo_PBPoker
proto
.
InternalMessageInfo
func
(
m
*
PBPoker
)
GetCards
()
[]
int32
{
if
m
!=
nil
{
return
m
.
Cards
}
return
nil
}
func
(
m
*
PBPoker
)
GetPointer
()
int32
{
if
m
!=
nil
{
return
m
.
Pointer
}
return
0
}
//游戏状态
type
PBGameAction
struct
{
// Types that are valid to be assigned to Value:
// *PBGameAction_Start
// *PBGameAction_Continue
// *PBGameAction_Quit
// *PBGameAction_Query
Value
isPBGameAction_Value
`protobuf_oneof:"value"`
Ty
int32
`protobuf:"varint,10,opt,name=ty,proto3" json:"ty,omitempty"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
XXX_unrecognized
[]
byte
`json:"-"`
XXX_sizecache
int32
`json:"-"`
}
func
(
m
*
PBGameAction
)
Reset
()
{
*
m
=
PBGameAction
{}
}
func
(
m
*
PBGameAction
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
PBGameAction
)
ProtoMessage
()
{}
func
(
*
PBGameAction
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_7574406c5d3430e8
,
[]
int
{
8
}
}
func
(
m
*
PBGameAction
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_PBGameAction
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
PBGameAction
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_PBGameAction
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
PBGameAction
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_PBGameAction
.
Merge
(
m
,
src
)
}
func
(
m
*
PBGameAction
)
XXX_Size
()
int
{
return
xxx_messageInfo_PBGameAction
.
Size
(
m
)
}
func
(
m
*
PBGameAction
)
XXX_DiscardUnknown
()
{
xxx_messageInfo_PBGameAction
.
DiscardUnknown
(
m
)
}
var
xxx_messageInfo_PBGameAction
proto
.
InternalMessageInfo
type
isPBGameAction_Value
interface
{
isPBGameAction_Value
()
}
type
PBGameAction_Start
struct
{
Start
*
PBGameStart
`protobuf:"bytes,1,opt,name=start,proto3,oneof"`
}
type
PBGameAction_Continue
struct
{
Continue
*
PBGameContinue
`protobuf:"bytes,2,opt,name=continue,proto3,oneof"`
}
type
PBGameAction_Quit
struct
{
Quit
*
PBGameQuit
`protobuf:"bytes,3,opt,name=quit,proto3,oneof"`
}
type
PBGameAction_Query
struct
{
Query
*
PBGameQuery
`protobuf:"bytes,4,opt,name=query,proto3,oneof"`
}
func
(
*
PBGameAction_Start
)
isPBGameAction_Value
()
{}
func
(
*
PBGameAction_Continue
)
isPBGameAction_Value
()
{}
func
(
*
PBGameAction_Quit
)
isPBGameAction_Value
()
{}
func
(
*
PBGameAction_Query
)
isPBGameAction_Value
()
{}
func
(
m
*
PBGameAction
)
GetValue
()
isPBGameAction_Value
{
if
m
!=
nil
{
return
m
.
Value
}
return
nil
}
func
(
m
*
PBGameAction
)
GetStart
()
*
PBGameStart
{
if
x
,
ok
:=
m
.
GetValue
()
.
(
*
PBGameAction_Start
);
ok
{
return
x
.
Start
}
return
nil
}
func
(
m
*
PBGameAction
)
GetContinue
()
*
PBGameContinue
{
if
x
,
ok
:=
m
.
GetValue
()
.
(
*
PBGameAction_Continue
);
ok
{
return
x
.
Continue
}
return
nil
}
func
(
m
*
PBGameAction
)
GetQuit
()
*
PBGameQuit
{
if
x
,
ok
:=
m
.
GetValue
()
.
(
*
PBGameAction_Quit
);
ok
{
return
x
.
Quit
}
return
nil
}
func
(
m
*
PBGameAction
)
GetQuery
()
*
PBGameQuery
{
if
x
,
ok
:=
m
.
GetValue
()
.
(
*
PBGameAction_Query
);
ok
{
return
x
.
Query
}
return
nil
}
func
(
m
*
PBGameAction
)
GetTy
()
int32
{
if
m
!=
nil
{
return
m
.
Ty
}
return
0
}
// XXX_OneofFuncs is for the internal use of the proto package.
func
(
*
PBGameAction
)
XXX_OneofFuncs
()
(
func
(
msg
proto
.
Message
,
b
*
proto
.
Buffer
)
error
,
func
(
msg
proto
.
Message
,
tag
,
wire
int
,
b
*
proto
.
Buffer
)
(
bool
,
error
),
func
(
msg
proto
.
Message
)
(
n
int
),
[]
interface
{})
{
return
_PBGameAction_OneofMarshaler
,
_PBGameAction_OneofUnmarshaler
,
_PBGameAction_OneofSizer
,
[]
interface
{}{
(
*
PBGameAction_Start
)(
nil
),
(
*
PBGameAction_Continue
)(
nil
),
(
*
PBGameAction_Quit
)(
nil
),
(
*
PBGameAction_Query
)(
nil
),
}
}
func
_PBGameAction_OneofMarshaler
(
msg
proto
.
Message
,
b
*
proto
.
Buffer
)
error
{
m
:=
msg
.
(
*
PBGameAction
)
// value
switch
x
:=
m
.
Value
.
(
type
)
{
case
*
PBGameAction_Start
:
b
.
EncodeVarint
(
1
<<
3
|
proto
.
WireBytes
)
if
err
:=
b
.
EncodeMessage
(
x
.
Start
);
err
!=
nil
{
return
err
}
case
*
PBGameAction_Continue
:
b
.
EncodeVarint
(
2
<<
3
|
proto
.
WireBytes
)
if
err
:=
b
.
EncodeMessage
(
x
.
Continue
);
err
!=
nil
{
return
err
}
case
*
PBGameAction_Quit
:
b
.
EncodeVarint
(
3
<<
3
|
proto
.
WireBytes
)
if
err
:=
b
.
EncodeMessage
(
x
.
Quit
);
err
!=
nil
{
return
err
}
case
*
PBGameAction_Query
:
b
.
EncodeVarint
(
4
<<
3
|
proto
.
WireBytes
)
if
err
:=
b
.
EncodeMessage
(
x
.
Query
);
err
!=
nil
{
return
err
}
case
nil
:
default
:
return
fmt
.
Errorf
(
"PBGameAction.Value has unexpected type %T"
,
x
)
}
return
nil
}
func
_PBGameAction_OneofUnmarshaler
(
msg
proto
.
Message
,
tag
,
wire
int
,
b
*
proto
.
Buffer
)
(
bool
,
error
)
{
m
:=
msg
.
(
*
PBGameAction
)
switch
tag
{
case
1
:
// value.start
if
wire
!=
proto
.
WireBytes
{
return
true
,
proto
.
ErrInternalBadWireType
}
msg
:=
new
(
PBGameStart
)
err
:=
b
.
DecodeMessage
(
msg
)
m
.
Value
=
&
PBGameAction_Start
{
msg
}
return
true
,
err
case
2
:
// value.continue
if
wire
!=
proto
.
WireBytes
{
return
true
,
proto
.
ErrInternalBadWireType
}
msg
:=
new
(
PBGameContinue
)
err
:=
b
.
DecodeMessage
(
msg
)
m
.
Value
=
&
PBGameAction_Continue
{
msg
}
return
true
,
err
case
3
:
// value.quit
if
wire
!=
proto
.
WireBytes
{
return
true
,
proto
.
ErrInternalBadWireType
}
msg
:=
new
(
PBGameQuit
)
err
:=
b
.
DecodeMessage
(
msg
)
m
.
Value
=
&
PBGameAction_Quit
{
msg
}
return
true
,
err
case
4
:
// value.query
if
wire
!=
proto
.
WireBytes
{
return
true
,
proto
.
ErrInternalBadWireType
}
msg
:=
new
(
PBGameQuery
)
err
:=
b
.
DecodeMessage
(
msg
)
m
.
Value
=
&
PBGameAction_Query
{
msg
}
return
true
,
err
default
:
return
false
,
nil
}
}
func
_PBGameAction_OneofSizer
(
msg
proto
.
Message
)
(
n
int
)
{
m
:=
msg
.
(
*
PBGameAction
)
// value
switch
x
:=
m
.
Value
.
(
type
)
{
case
*
PBGameAction_Start
:
s
:=
proto
.
Size
(
x
.
Start
)
n
+=
1
// tag and wire
n
+=
proto
.
SizeVarint
(
uint64
(
s
))
n
+=
s
case
*
PBGameAction_Continue
:
s
:=
proto
.
Size
(
x
.
Continue
)
n
+=
1
// tag and wire
n
+=
proto
.
SizeVarint
(
uint64
(
s
))
n
+=
s
case
*
PBGameAction_Quit
:
s
:=
proto
.
Size
(
x
.
Quit
)
n
+=
1
// tag and wire
n
+=
proto
.
SizeVarint
(
uint64
(
s
))
n
+=
s
case
*
PBGameAction_Query
:
s
:=
proto
.
Size
(
x
.
Query
)
n
+=
1
// tag and wire
n
+=
proto
.
SizeVarint
(
uint64
(
s
))
n
+=
s
case
nil
:
default
:
panic
(
fmt
.
Sprintf
(
"proto: unexpected type %T in oneof"
,
x
))
}
return
n
}
//游戏启动
type
PBGameStart
struct
{
Value
int64
`protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"`
PlayerNum
int32
`protobuf:"varint,2,opt,name=playerNum,proto3" json:"playerNum,omitempty"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
XXX_unrecognized
[]
byte
`json:"-"`
XXX_sizecache
int32
`json:"-"`
}
func
(
m
*
PBGameStart
)
Reset
()
{
*
m
=
PBGameStart
{}
}
func
(
m
*
PBGameStart
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
PBGameStart
)
ProtoMessage
()
{}
func
(
*
PBGameStart
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_7574406c5d3430e8
,
[]
int
{
9
}
}
func
(
m
*
PBGameStart
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_PBGameStart
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
PBGameStart
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_PBGameStart
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
PBGameStart
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_PBGameStart
.
Merge
(
m
,
src
)
}
func
(
m
*
PBGameStart
)
XXX_Size
()
int
{
return
xxx_messageInfo_PBGameStart
.
Size
(
m
)
}
func
(
m
*
PBGameStart
)
XXX_DiscardUnknown
()
{
xxx_messageInfo_PBGameStart
.
DiscardUnknown
(
m
)
}
var
xxx_messageInfo_PBGameStart
proto
.
InternalMessageInfo
func
(
m
*
PBGameStart
)
GetValue
()
int64
{
if
m
!=
nil
{
return
m
.
Value
}
return
0
}
func
(
m
*
PBGameStart
)
GetPlayerNum
()
int32
{
if
m
!=
nil
{
return
m
.
PlayerNum
}
return
0
}
//游戏继续
type
PBGameContinue
struct
{
GameId
string
`protobuf:"bytes,1,opt,name=gameId,proto3" json:"gameId,omitempty"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
XXX_unrecognized
[]
byte
`json:"-"`
XXX_sizecache
int32
`json:"-"`
}
func
(
m
*
PBGameContinue
)
Reset
()
{
*
m
=
PBGameContinue
{}
}
func
(
m
*
PBGameContinue
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
PBGameContinue
)
ProtoMessage
()
{}
func
(
*
PBGameContinue
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_7574406c5d3430e8
,
[]
int
{
10
}
}
func
(
m
*
PBGameContinue
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_PBGameContinue
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
PBGameContinue
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_PBGameContinue
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
PBGameContinue
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_PBGameContinue
.
Merge
(
m
,
src
)
}
func
(
m
*
PBGameContinue
)
XXX_Size
()
int
{
return
xxx_messageInfo_PBGameContinue
.
Size
(
m
)
}
func
(
m
*
PBGameContinue
)
XXX_DiscardUnknown
()
{
xxx_messageInfo_PBGameContinue
.
DiscardUnknown
(
m
)
}
var
xxx_messageInfo_PBGameContinue
proto
.
InternalMessageInfo
func
(
m
*
PBGameContinue
)
GetGameId
()
string
{
if
m
!=
nil
{
return
m
.
GameId
}
return
""
}
//游戏结束
type
PBGameQuit
struct
{
GameId
string
`protobuf:"bytes,1,opt,name=gameId,proto3" json:"gameId,omitempty"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
XXX_unrecognized
[]
byte
`json:"-"`
XXX_sizecache
int32
`json:"-"`
}
func
(
m
*
PBGameQuit
)
Reset
()
{
*
m
=
PBGameQuit
{}
}
func
(
m
*
PBGameQuit
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
PBGameQuit
)
ProtoMessage
()
{}
func
(
*
PBGameQuit
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_7574406c5d3430e8
,
[]
int
{
11
}
}
func
(
m
*
PBGameQuit
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_PBGameQuit
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
PBGameQuit
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_PBGameQuit
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
PBGameQuit
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_PBGameQuit
.
Merge
(
m
,
src
)
}
func
(
m
*
PBGameQuit
)
XXX_Size
()
int
{
return
xxx_messageInfo_PBGameQuit
.
Size
(
m
)
}
func
(
m
*
PBGameQuit
)
XXX_DiscardUnknown
()
{
xxx_messageInfo_PBGameQuit
.
DiscardUnknown
(
m
)
}
var
xxx_messageInfo_PBGameQuit
proto
.
InternalMessageInfo
func
(
m
*
PBGameQuit
)
GetGameId
()
string
{
if
m
!=
nil
{
return
m
.
GameId
}
return
""
}
//查询游戏结果
type
PBGameQuery
struct
{
GameId
string
`protobuf:"bytes,1,opt,name=gameId,proto3" json:"gameId,omitempty"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
XXX_unrecognized
[]
byte
`json:"-"`
XXX_sizecache
int32
`json:"-"`
}
func
(
m
*
PBGameQuery
)
Reset
()
{
*
m
=
PBGameQuery
{}
}
func
(
m
*
PBGameQuery
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
PBGameQuery
)
ProtoMessage
()
{}
func
(
*
PBGameQuery
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_7574406c5d3430e8
,
[]
int
{
12
}
}
func
(
m
*
PBGameQuery
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_PBGameQuery
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
PBGameQuery
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_PBGameQuery
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
PBGameQuery
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_PBGameQuery
.
Merge
(
m
,
src
)
}
func
(
m
*
PBGameQuery
)
XXX_Size
()
int
{
return
xxx_messageInfo_PBGameQuery
.
Size
(
m
)
}
func
(
m
*
PBGameQuery
)
XXX_DiscardUnknown
()
{
xxx_messageInfo_PBGameQuery
.
DiscardUnknown
(
m
)
}
var
xxx_messageInfo_PBGameQuery
proto
.
InternalMessageInfo
func
(
m
*
PBGameQuery
)
GetGameId
()
string
{
if
m
!=
nil
{
return
m
.
GameId
}
return
""
}
//游戏状态
type
GuessGameAction
struct
{
// Types that are valid to be assigned to Value:
// *GuessGameAction_Start
// *GuessGameAction_Bet
// *GuessGameAction_Abort
// *GuessGameAction_Publish
// *GuessGameAction_Query
Value
isGuessGameAction_Value
`protobuf_oneof:"value"`
Ty
uint32
`protobuf:"varint,6,opt,name=ty,proto3" json:"ty,omitempty"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
XXX_unrecognized
[]
byte
`json:"-"`
XXX_sizecache
int32
`json:"-"`
}
func
(
m
*
GuessGameAction
)
Reset
()
{
*
m
=
GuessGameAction
{}
}
func
(
m
*
GuessGameAction
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
GuessGameAction
)
ProtoMessage
()
{}
func
(
*
GuessGameAction
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_7574406c5d3430e8
,
[]
int
{
13
}
}
func
(
m
*
GuessGameAction
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_GuessGameAction
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
GuessGameAction
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_GuessGameAction
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
GuessGameAction
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_GuessGameAction
.
Merge
(
m
,
src
)
}
func
(
m
*
GuessGameAction
)
XXX_Size
()
int
{
return
xxx_messageInfo_GuessGameAction
.
Size
(
m
)
}
func
(
m
*
GuessGameAction
)
XXX_DiscardUnknown
()
{
xxx_messageInfo_GuessGameAction
.
DiscardUnknown
(
m
)
}
var
xxx_messageInfo_GuessGameAction
proto
.
InternalMessageInfo
type
isGuessGameAction_Value
interface
{
isGuessGameAction_Value
()
}
type
GuessGameAction_Start
struct
{
Start
*
GuessGameStart
`protobuf:"bytes,1,opt,name=start,proto3,oneof"`
}
type
GuessGameAction_Bet
struct
{
Bet
*
GuessGameBet
`protobuf:"bytes,2,opt,name=bet,proto3,oneof"`
}
type
GuessGameAction_Abort
struct
{
Abort
*
GuessGameAbort
`protobuf:"bytes,3,opt,name=abort,proto3,oneof"`
}
type
GuessGameAction_Publish
struct
{
Publish
*
GuessGamePublish
`protobuf:"bytes,4,opt,name=publish,proto3,oneof"`
}
type
GuessGameAction_Query
struct
{
Query
*
GuessGameQuery
`protobuf:"bytes,5,opt,name=query,proto3,oneof"`
}
func
(
*
GuessGameAction_Start
)
isGuessGameAction_Value
()
{}
func
(
*
GuessGameAction_Bet
)
isGuessGameAction_Value
()
{}
func
(
*
GuessGameAction_Abort
)
isGuessGameAction_Value
()
{}
func
(
*
GuessGameAction_Publish
)
isGuessGameAction_Value
()
{}
func
(
*
GuessGameAction_Query
)
isGuessGameAction_Value
()
{}
func
(
m
*
GuessGameAction
)
GetValue
()
isGuessGameAction_Value
{
if
m
!=
nil
{
return
m
.
Value
}
return
nil
}
func
(
m
*
GuessGameAction
)
GetStart
()
*
GuessGameStart
{
if
x
,
ok
:=
m
.
GetValue
()
.
(
*
GuessGameAction_Start
);
ok
{
return
x
.
Start
}
return
nil
}
func
(
m
*
GuessGameAction
)
GetBet
()
*
GuessGameBet
{
if
x
,
ok
:=
m
.
GetValue
()
.
(
*
GuessGameAction_Bet
);
ok
{
return
x
.
Bet
}
return
nil
}
func
(
m
*
GuessGameAction
)
GetAbort
()
*
GuessGameAbort
{
if
x
,
ok
:=
m
.
GetValue
()
.
(
*
GuessGameAction_Abort
);
ok
{
return
x
.
Abort
}
return
nil
}
func
(
m
*
GuessGameAction
)
GetPublish
()
*
GuessGamePublish
{
if
x
,
ok
:=
m
.
GetValue
()
.
(
*
GuessGameAction_Publish
);
ok
{
return
x
.
Publish
}
return
nil
}
func
(
m
*
GuessGameAction
)
GetQuery
()
*
GuessGameQuery
{
if
x
,
ok
:=
m
.
GetValue
()
.
(
*
GuessGameAction_Query
);
ok
{
return
x
.
Query
}
return
nil
}
func
(
m
*
GuessGameAction
)
GetTy
()
uint32
{
if
m
!=
nil
{
return
m
.
Ty
}
return
0
}
// XXX_OneofFuncs is for the internal use of the proto package.
func
(
*
GuessGameAction
)
XXX_OneofFuncs
()
(
func
(
msg
proto
.
Message
,
b
*
proto
.
Buffer
)
error
,
func
(
msg
proto
.
Message
,
tag
,
wire
int
,
b
*
proto
.
Buffer
)
(
bool
,
error
),
func
(
msg
proto
.
Message
)
(
n
int
),
[]
interface
{})
{
return
_GuessGameAction_OneofMarshaler
,
_GuessGameAction_OneofUnmarshaler
,
_GuessGameAction_OneofSizer
,
[]
interface
{}{
(
*
GuessGameAction_Start
)(
nil
),
(
*
GuessGameAction_Bet
)(
nil
),
(
*
GuessGameAction_Abort
)(
nil
),
(
*
GuessGameAction_Publish
)(
nil
),
(
*
GuessGameAction_Query
)(
nil
),
}
}
func
_GuessGameAction_OneofMarshaler
(
msg
proto
.
Message
,
b
*
proto
.
Buffer
)
error
{
m
:=
msg
.
(
*
GuessGameAction
)
// value
switch
x
:=
m
.
Value
.
(
type
)
{
case
*
GuessGameAction_Start
:
b
.
EncodeVarint
(
1
<<
3
|
proto
.
WireBytes
)
if
err
:=
b
.
EncodeMessage
(
x
.
Start
);
err
!=
nil
{
return
err
}
case
*
GuessGameAction_Bet
:
b
.
EncodeVarint
(
2
<<
3
|
proto
.
WireBytes
)
if
err
:=
b
.
EncodeMessage
(
x
.
Bet
);
err
!=
nil
{
return
err
}
case
*
GuessGameAction_Abort
:
b
.
EncodeVarint
(
3
<<
3
|
proto
.
WireBytes
)
if
err
:=
b
.
EncodeMessage
(
x
.
Abort
);
err
!=
nil
{
return
err
}
case
*
GuessGameAction_Publish
:
b
.
EncodeVarint
(
4
<<
3
|
proto
.
WireBytes
)
if
err
:=
b
.
EncodeMessage
(
x
.
Publish
);
err
!=
nil
{
return
err
}
case
*
GuessGameAction_Query
:
b
.
EncodeVarint
(
5
<<
3
|
proto
.
WireBytes
)
if
err
:=
b
.
EncodeMessage
(
x
.
Query
);
err
!=
nil
{
return
err
}
case
nil
:
default
:
return
fmt
.
Errorf
(
"GuessGameAction.Value has unexpected type %T"
,
x
)
}
return
nil
}
func
_GuessGameAction_OneofUnmarshaler
(
msg
proto
.
Message
,
tag
,
wire
int
,
b
*
proto
.
Buffer
)
(
bool
,
error
)
{
m
:=
msg
.
(
*
GuessGameAction
)
switch
tag
{
case
1
:
// value.start
if
wire
!=
proto
.
WireBytes
{
return
true
,
proto
.
ErrInternalBadWireType
}
msg
:=
new
(
GuessGameStart
)
err
:=
b
.
DecodeMessage
(
msg
)
m
.
Value
=
&
GuessGameAction_Start
{
msg
}
return
true
,
err
case
2
:
// value.bet
if
wire
!=
proto
.
WireBytes
{
return
true
,
proto
.
ErrInternalBadWireType
}
msg
:=
new
(
GuessGameBet
)
err
:=
b
.
DecodeMessage
(
msg
)
m
.
Value
=
&
GuessGameAction_Bet
{
msg
}
return
true
,
err
case
3
:
// value.abort
if
wire
!=
proto
.
WireBytes
{
return
true
,
proto
.
ErrInternalBadWireType
}
msg
:=
new
(
GuessGameAbort
)
err
:=
b
.
DecodeMessage
(
msg
)
m
.
Value
=
&
GuessGameAction_Abort
{
msg
}
return
true
,
err
case
4
:
// value.publish
if
wire
!=
proto
.
WireBytes
{
return
true
,
proto
.
ErrInternalBadWireType
}
msg
:=
new
(
GuessGamePublish
)
err
:=
b
.
DecodeMessage
(
msg
)
m
.
Value
=
&
GuessGameAction_Publish
{
msg
}
return
true
,
err
case
5
:
// value.query
if
wire
!=
proto
.
WireBytes
{
return
true
,
proto
.
ErrInternalBadWireType
}
msg
:=
new
(
GuessGameQuery
)
err
:=
b
.
DecodeMessage
(
msg
)
m
.
Value
=
&
GuessGameAction_Query
{
msg
}
return
true
,
err
default
:
return
false
,
nil
}
}
func
_GuessGameAction_OneofSizer
(
msg
proto
.
Message
)
(
n
int
)
{
m
:=
msg
.
(
*
GuessGameAction
)
// value
switch
x
:=
m
.
Value
.
(
type
)
{
case
*
GuessGameAction_Start
:
s
:=
proto
.
Size
(
x
.
Start
)
n
+=
1
// tag and wire
n
+=
proto
.
SizeVarint
(
uint64
(
s
))
n
+=
s
case
*
GuessGameAction_Bet
:
s
:=
proto
.
Size
(
x
.
Bet
)
n
+=
1
// tag and wire
n
+=
proto
.
SizeVarint
(
uint64
(
s
))
n
+=
s
case
*
GuessGameAction_Abort
:
s
:=
proto
.
Size
(
x
.
Abort
)
n
+=
1
// tag and wire
n
+=
proto
.
SizeVarint
(
uint64
(
s
))
n
+=
s
case
*
GuessGameAction_Publish
:
s
:=
proto
.
Size
(
x
.
Publish
)
n
+=
1
// tag and wire
n
+=
proto
.
SizeVarint
(
uint64
(
s
))
n
+=
s
case
*
GuessGameAction_Query
:
s
:=
proto
.
Size
(
x
.
Query
)
n
+=
1
// tag and wire
n
+=
proto
.
SizeVarint
(
uint64
(
s
))
n
+=
s
case
nil
:
default
:
panic
(
fmt
.
Sprintf
(
"proto: unexpected type %T in oneof"
,
x
))
}
return
n
}
//游戏启动
type
GuessGameStart
struct
{
Topic
string
`protobuf:"bytes,1,opt,name=topic,proto3" json:"topic,omitempty"`
Options
string
`protobuf:"bytes,2,opt,name=options,proto3" json:"options,omitempty"`
MaxHeight
uint32
`protobuf:"varint,3,opt,name=maxHeight,proto3" json:"maxHeight,omitempty"`
Symbol
string
`protobuf:"bytes,4,opt,name=symbol,proto3" json:"symbol,omitempty"`
Exec
string
`protobuf:"bytes,5,opt,name=exec,proto3" json:"exec,omitempty"`
OneBet
uint32
`protobuf:"varint,6,opt,name=oneBet,proto3" json:"oneBet,omitempty"`
MaxBets
uint32
`protobuf:"varint,7,opt,name=maxBets,proto3" json:"maxBets,omitempty"`
MaxBetsNumber
uint32
`protobuf:"varint,8,opt,name=maxBetsNumber,proto3" json:"maxBetsNumber,omitempty"`
Fee
uint64
`protobuf:"varint,9,opt,name=fee,proto3" json:"fee,omitempty"`
FeeAddr
string
`protobuf:"bytes,10,opt,name=feeAddr,proto3" json:"feeAddr,omitempty"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
XXX_unrecognized
[]
byte
`json:"-"`
XXX_sizecache
int32
`json:"-"`
}
func
(
m
*
GuessGameStart
)
Reset
()
{
*
m
=
GuessGameStart
{}
}
func
(
m
*
GuessGameStart
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
GuessGameStart
)
ProtoMessage
()
{}
func
(
*
GuessGameStart
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_7574406c5d3430e8
,
[]
int
{
14
}
}
func
(
m
*
GuessGameStart
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_GuessGameStart
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
GuessGameStart
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_GuessGameStart
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
GuessGameStart
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_GuessGameStart
.
Merge
(
m
,
src
)
}
func
(
m
*
GuessGameStart
)
XXX_Size
()
int
{
return
xxx_messageInfo_GuessGameStart
.
Size
(
m
)
}
func
(
m
*
GuessGameStart
)
XXX_DiscardUnknown
()
{
xxx_messageInfo_GuessGameStart
.
DiscardUnknown
(
m
)
}
var
xxx_messageInfo_GuessGameStart
proto
.
InternalMessageInfo
func
(
m
*
GuessGameStart
)
GetTopic
()
string
{
if
m
!=
nil
{
return
m
.
Topic
}
return
""
}
func
(
m
*
GuessGameStart
)
GetOptions
()
string
{
if
m
!=
nil
{
return
m
.
Options
}
return
""
}
func
(
m
*
GuessGameStart
)
GetMaxHeight
()
uint32
{
if
m
!=
nil
{
return
m
.
MaxHeight
}
return
0
}
func
(
m
*
GuessGameStart
)
GetSymbol
()
string
{
if
m
!=
nil
{
return
m
.
Symbol
}
return
""
}
func
(
m
*
GuessGameStart
)
GetExec
()
string
{
if
m
!=
nil
{
return
m
.
Exec
}
return
""
}
func
(
m
*
GuessGameStart
)
GetOneBet
()
uint32
{
if
m
!=
nil
{
return
m
.
OneBet
}
return
0
}
func
(
m
*
GuessGameStart
)
GetMaxBets
()
uint32
{
if
m
!=
nil
{
return
m
.
MaxBets
}
return
0
}
func
(
m
*
GuessGameStart
)
GetMaxBetsNumber
()
uint32
{
if
m
!=
nil
{
return
m
.
MaxBetsNumber
}
return
0
}
func
(
m
*
GuessGameStart
)
GetFee
()
uint64
{
if
m
!=
nil
{
return
m
.
Fee
}
return
0
}
func
(
m
*
GuessGameStart
)
GetFeeAddr
()
string
{
if
m
!=
nil
{
return
m
.
FeeAddr
}
return
""
}
//参与游戏下注
type
GuessGameBet
struct
{
GameId
string
`protobuf:"bytes,1,opt,name=gameId,proto3" json:"gameId,omitempty"`
Option
string
`protobuf:"bytes,2,opt,name=option,proto3" json:"option,omitempty"`
BetsNum
uint32
`protobuf:"varint,3,opt,name=betsNum,proto3" json:"betsNum,omitempty"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
XXX_unrecognized
[]
byte
`json:"-"`
XXX_sizecache
int32
`json:"-"`
}
func
(
m
*
GuessGameBet
)
Reset
()
{
*
m
=
GuessGameBet
{}
}
func
(
m
*
GuessGameBet
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
GuessGameBet
)
ProtoMessage
()
{}
func
(
*
GuessGameBet
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_7574406c5d3430e8
,
[]
int
{
15
}
}
func
(
m
*
GuessGameBet
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_GuessGameBet
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
GuessGameBet
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_GuessGameBet
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
GuessGameBet
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_GuessGameBet
.
Merge
(
m
,
src
)
}
func
(
m
*
GuessGameBet
)
XXX_Size
()
int
{
return
xxx_messageInfo_GuessGameBet
.
Size
(
m
)
}
func
(
m
*
GuessGameBet
)
XXX_DiscardUnknown
()
{
xxx_messageInfo_GuessGameBet
.
DiscardUnknown
(
m
)
}
var
xxx_messageInfo_GuessGameBet
proto
.
InternalMessageInfo
func
(
m
*
GuessGameBet
)
GetGameId
()
string
{
if
m
!=
nil
{
return
m
.
GameId
}
return
""
}
func
(
m
*
GuessGameBet
)
GetOption
()
string
{
if
m
!=
nil
{
return
m
.
Option
}
return
""
}
func
(
m
*
GuessGameBet
)
GetBetsNum
()
uint32
{
if
m
!=
nil
{
return
m
.
BetsNum
}
return
0
}
//游戏异常终止,退还下注
type
GuessGameAbort
struct
{
GameId
string
`protobuf:"bytes,1,opt,name=gameId,proto3" json:"gameId,omitempty"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
XXX_unrecognized
[]
byte
`json:"-"`
XXX_sizecache
int32
`json:"-"`
}
func
(
m
*
GuessGameAbort
)
Reset
()
{
*
m
=
GuessGameAbort
{}
}
func
(
m
*
GuessGameAbort
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
GuessGameAbort
)
ProtoMessage
()
{}
func
(
*
GuessGameAbort
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_7574406c5d3430e8
,
[]
int
{
16
}
}
func
(
m
*
GuessGameAbort
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_GuessGameAbort
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
GuessGameAbort
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_GuessGameAbort
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
GuessGameAbort
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_GuessGameAbort
.
Merge
(
m
,
src
)
}
func
(
m
*
GuessGameAbort
)
XXX_Size
()
int
{
return
xxx_messageInfo_GuessGameAbort
.
Size
(
m
)
}
func
(
m
*
GuessGameAbort
)
XXX_DiscardUnknown
()
{
xxx_messageInfo_GuessGameAbort
.
DiscardUnknown
(
m
)
}
var
xxx_messageInfo_GuessGameAbort
proto
.
InternalMessageInfo
func
(
m
*
GuessGameAbort
)
GetGameId
()
string
{
if
m
!=
nil
{
return
m
.
GameId
}
return
""
}
//游戏结果揭晓
type
GuessGamePublish
struct
{
GameId
string
`protobuf:"bytes,1,opt,name=gameId,proto3" json:"gameId,omitempty"`
Result
string
`protobuf:"bytes,2,opt,name=result,proto3" json:"result,omitempty"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
XXX_unrecognized
[]
byte
`json:"-"`
XXX_sizecache
int32
`json:"-"`
}
func
(
m
*
GuessGamePublish
)
Reset
()
{
*
m
=
GuessGamePublish
{}
}
func
(
m
*
GuessGamePublish
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
GuessGamePublish
)
ProtoMessage
()
{}
func
(
*
GuessGamePublish
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_7574406c5d3430e8
,
[]
int
{
17
}
}
func
(
m
*
GuessGamePublish
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_GuessGamePublish
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
GuessGamePublish
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_GuessGamePublish
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
GuessGamePublish
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_GuessGamePublish
.
Merge
(
m
,
src
)
}
func
(
m
*
GuessGamePublish
)
XXX_Size
()
int
{
return
xxx_messageInfo_GuessGamePublish
.
Size
(
m
)
}
func
(
m
*
GuessGamePublish
)
XXX_DiscardUnknown
()
{
xxx_messageInfo_GuessGamePublish
.
DiscardUnknown
(
m
)
}
var
xxx_messageInfo_GuessGamePublish
proto
.
InternalMessageInfo
func
(
m
*
GuessGamePublish
)
GetGameId
()
string
{
if
m
!=
nil
{
return
m
.
GameId
}
return
""
}
func
(
m
*
GuessGamePublish
)
GetResult
()
string
{
if
m
!=
nil
{
return
m
.
Result
}
return
""
}
//查询游戏结果
type
GuessGameQuery
struct
{
GameId
string
`protobuf:"bytes,1,opt,name=gameId,proto3" json:"gameId,omitempty"`
Ty
uint32
`protobuf:"varint,2,opt,name=ty,proto3" json:"ty,omitempty"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
XXX_unrecognized
[]
byte
`json:"-"`
XXX_sizecache
int32
`json:"-"`
}
func
(
m
*
GuessGameQuery
)
Reset
()
{
*
m
=
GuessGameQuery
{}
}
func
(
m
*
GuessGameQuery
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
GuessGameQuery
)
ProtoMessage
()
{}
func
(
*
GuessGameQuery
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_7574406c5d3430e8
,
[]
int
{
18
}
}
func
(
m
*
GuessGameQuery
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_GuessGameQuery
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
GuessGameQuery
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_GuessGameQuery
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
GuessGameQuery
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_GuessGameQuery
.
Merge
(
m
,
src
)
}
func
(
m
*
GuessGameQuery
)
XXX_Size
()
int
{
return
xxx_messageInfo_GuessGameQuery
.
Size
(
m
)
}
func
(
m
*
GuessGameQuery
)
XXX_DiscardUnknown
()
{
xxx_messageInfo_GuessGameQuery
.
DiscardUnknown
(
m
)
}
var
xxx_messageInfo_GuessGameQuery
proto
.
InternalMessageInfo
func
(
m
*
GuessGameQuery
)
GetGameId
()
string
{
if
m
!=
nil
{
return
m
.
GameId
}
return
""
}
func
(
m
*
GuessGameQuery
)
GetTy
()
uint32
{
if
m
!=
nil
{
return
m
.
Ty
}
return
0
}
//根据状态和游戏人数查找
type
QueryPBGameListByStatusAndPlayerNum
struct
{
Status
int32
`protobuf:"varint,1,opt,name=status,proto3" json:"status,omitempty"`
PlayerNum
int32
`protobuf:"varint,2,opt,name=playerNum,proto3" json:"playerNum,omitempty"`
Index
int64
`protobuf:"varint,3,opt,name=index,proto3" json:"index,omitempty"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
XXX_unrecognized
[]
byte
`json:"-"`
XXX_sizecache
int32
`json:"-"`
}
func
(
m
*
QueryPBGameListByStatusAndPlayerNum
)
Reset
()
{
*
m
=
QueryPBGameListByStatusAndPlayerNum
{}
}
func
(
m
*
QueryPBGameListByStatusAndPlayerNum
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
QueryPBGameListByStatusAndPlayerNum
)
ProtoMessage
()
{}
func
(
*
QueryPBGameListByStatusAndPlayerNum
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_7574406c5d3430e8
,
[]
int
{
19
}
}
func
(
m
*
QueryPBGameListByStatusAndPlayerNum
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_QueryPBGameListByStatusAndPlayerNum
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
QueryPBGameListByStatusAndPlayerNum
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_QueryPBGameListByStatusAndPlayerNum
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
QueryPBGameListByStatusAndPlayerNum
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_QueryPBGameListByStatusAndPlayerNum
.
Merge
(
m
,
src
)
}
func
(
m
*
QueryPBGameListByStatusAndPlayerNum
)
XXX_Size
()
int
{
return
xxx_messageInfo_QueryPBGameListByStatusAndPlayerNum
.
Size
(
m
)
}
func
(
m
*
QueryPBGameListByStatusAndPlayerNum
)
XXX_DiscardUnknown
()
{
xxx_messageInfo_QueryPBGameListByStatusAndPlayerNum
.
DiscardUnknown
(
m
)
}
var
xxx_messageInfo_QueryPBGameListByStatusAndPlayerNum
proto
.
InternalMessageInfo
func
(
m
*
QueryPBGameListByStatusAndPlayerNum
)
GetStatus
()
int32
{
if
m
!=
nil
{
return
m
.
Status
}
return
0
}
func
(
m
*
QueryPBGameListByStatusAndPlayerNum
)
GetPlayerNum
()
int32
{
if
m
!=
nil
{
return
m
.
PlayerNum
}
return
0
}
func
(
m
*
QueryPBGameListByStatusAndPlayerNum
)
GetIndex
()
int64
{
if
m
!=
nil
{
return
m
.
Index
}
return
0
}
// 索引value值
type
PBGameRecord
struct
{
GameId
string
`protobuf:"bytes,1,opt,name=gameId,proto3" json:"gameId,omitempty"`
Status
int32
`protobuf:"varint,2,opt,name=status,proto3" json:"status,omitempty"`
Index
int64
`protobuf:"varint,3,opt,name=index,proto3" json:"index,omitempty"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
XXX_unrecognized
[]
byte
`json:"-"`
XXX_sizecache
int32
`json:"-"`
}
func
(
m
*
PBGameRecord
)
Reset
()
{
*
m
=
PBGameRecord
{}
}
func
(
m
*
PBGameRecord
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
PBGameRecord
)
ProtoMessage
()
{}
func
(
*
PBGameRecord
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_7574406c5d3430e8
,
[]
int
{
20
}
}
func
(
m
*
PBGameRecord
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_PBGameRecord
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
PBGameRecord
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_PBGameRecord
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
PBGameRecord
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_PBGameRecord
.
Merge
(
m
,
src
)
}
func
(
m
*
PBGameRecord
)
XXX_Size
()
int
{
return
xxx_messageInfo_PBGameRecord
.
Size
(
m
)
}
func
(
m
*
PBGameRecord
)
XXX_DiscardUnknown
()
{
xxx_messageInfo_PBGameRecord
.
DiscardUnknown
(
m
)
}
var
xxx_messageInfo_PBGameRecord
proto
.
InternalMessageInfo
func
(
m
*
PBGameRecord
)
GetGameId
()
string
{
if
m
!=
nil
{
return
m
.
GameId
}
return
""
}
func
(
m
*
PBGameRecord
)
GetStatus
()
int32
{
if
m
!=
nil
{
return
m
.
Status
}
return
0
}
func
(
m
*
PBGameRecord
)
GetIndex
()
int64
{
if
m
!=
nil
{
return
m
.
Index
}
return
0
}
type
PBGameIndexRecord
struct
{
GameId
string
`protobuf:"bytes,1,opt,name=gameId,proto3" json:"gameId,omitempty"`
Index
int64
`protobuf:"varint,2,opt,name=index,proto3" json:"index,omitempty"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
XXX_unrecognized
[]
byte
`json:"-"`
XXX_sizecache
int32
`json:"-"`
}
func
(
m
*
PBGameIndexRecord
)
Reset
()
{
*
m
=
PBGameIndexRecord
{}
}
func
(
m
*
PBGameIndexRecord
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
PBGameIndexRecord
)
ProtoMessage
()
{}
func
(
*
PBGameIndexRecord
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_7574406c5d3430e8
,
[]
int
{
21
}
}
func
(
m
*
PBGameIndexRecord
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_PBGameIndexRecord
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
PBGameIndexRecord
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_PBGameIndexRecord
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
PBGameIndexRecord
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_PBGameIndexRecord
.
Merge
(
m
,
src
)
}
func
(
m
*
PBGameIndexRecord
)
XXX_Size
()
int
{
return
xxx_messageInfo_PBGameIndexRecord
.
Size
(
m
)
}
func
(
m
*
PBGameIndexRecord
)
XXX_DiscardUnknown
()
{
xxx_messageInfo_PBGameIndexRecord
.
DiscardUnknown
(
m
)
}
var
xxx_messageInfo_PBGameIndexRecord
proto
.
InternalMessageInfo
func
(
m
*
PBGameIndexRecord
)
GetGameId
()
string
{
if
m
!=
nil
{
return
m
.
GameId
}
return
""
}
func
(
m
*
PBGameIndexRecord
)
GetIndex
()
int64
{
if
m
!=
nil
{
return
m
.
Index
}
return
0
}
type
PBGameRecords
struct
{
Records
[]
*
PBGameRecord
`protobuf:"bytes,1,rep,name=records,proto3" json:"records,omitempty"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
XXX_unrecognized
[]
byte
`json:"-"`
XXX_sizecache
int32
`json:"-"`
}
func
(
m
*
PBGameRecords
)
Reset
()
{
*
m
=
PBGameRecords
{}
}
func
(
m
*
PBGameRecords
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
PBGameRecords
)
ProtoMessage
()
{}
func
(
*
PBGameRecords
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_7574406c5d3430e8
,
[]
int
{
22
}
}
func
(
m
*
PBGameRecords
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_PBGameRecords
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
PBGameRecords
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_PBGameRecords
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
PBGameRecords
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_PBGameRecords
.
Merge
(
m
,
src
)
}
func
(
m
*
PBGameRecords
)
XXX_Size
()
int
{
return
xxx_messageInfo_PBGameRecords
.
Size
(
m
)
}
func
(
m
*
PBGameRecords
)
XXX_DiscardUnknown
()
{
xxx_messageInfo_PBGameRecords
.
DiscardUnknown
(
m
)
}
var
xxx_messageInfo_PBGameRecords
proto
.
InternalMessageInfo
func
(
m
*
PBGameRecords
)
GetRecords
()
[]
*
PBGameRecord
{
if
m
!=
nil
{
return
m
.
Records
}
return
nil
}
type
QueryPBGameInfo
struct
{
GameId
string
`protobuf:"bytes,1,opt,name=gameId,proto3" json:"gameId,omitempty"`
Addr
string
`protobuf:"bytes,2,opt,name=addr,proto3" json:"addr,omitempty"`
Status
int32
`protobuf:"varint,3,opt,name=status,proto3" json:"status,omitempty"`
Index
int64
`protobuf:"varint,4,opt,name=index,proto3" json:"index,omitempty"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
XXX_unrecognized
[]
byte
`json:"-"`
XXX_sizecache
int32
`json:"-"`
}
func
(
m
*
QueryPBGameInfo
)
Reset
()
{
*
m
=
QueryPBGameInfo
{}
}
func
(
m
*
QueryPBGameInfo
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
QueryPBGameInfo
)
ProtoMessage
()
{}
func
(
*
QueryPBGameInfo
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_7574406c5d3430e8
,
[]
int
{
23
}
}
func
(
m
*
QueryPBGameInfo
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_QueryPBGameInfo
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
QueryPBGameInfo
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_QueryPBGameInfo
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
QueryPBGameInfo
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_QueryPBGameInfo
.
Merge
(
m
,
src
)
}
func
(
m
*
QueryPBGameInfo
)
XXX_Size
()
int
{
return
xxx_messageInfo_QueryPBGameInfo
.
Size
(
m
)
}
func
(
m
*
QueryPBGameInfo
)
XXX_DiscardUnknown
()
{
xxx_messageInfo_QueryPBGameInfo
.
DiscardUnknown
(
m
)
}
var
xxx_messageInfo_QueryPBGameInfo
proto
.
InternalMessageInfo
func
(
m
*
QueryPBGameInfo
)
GetGameId
()
string
{
if
m
!=
nil
{
return
m
.
GameId
}
return
""
}
func
(
m
*
QueryPBGameInfo
)
GetAddr
()
string
{
if
m
!=
nil
{
return
m
.
Addr
}
return
""
}
func
(
m
*
QueryPBGameInfo
)
GetStatus
()
int32
{
if
m
!=
nil
{
return
m
.
Status
}
return
0
}
func
(
m
*
QueryPBGameInfo
)
GetIndex
()
int64
{
if
m
!=
nil
{
return
m
.
Index
}
return
0
}
type
ReplyPBGame
struct
{
Game
*
PokerBull
`protobuf:"bytes,1,opt,name=game,proto3" json:"game,omitempty"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
XXX_unrecognized
[]
byte
`json:"-"`
XXX_sizecache
int32
`json:"-"`
}
func
(
m
*
ReplyPBGame
)
Reset
()
{
*
m
=
ReplyPBGame
{}
}
func
(
m
*
ReplyPBGame
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
ReplyPBGame
)
ProtoMessage
()
{}
func
(
*
ReplyPBGame
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_7574406c5d3430e8
,
[]
int
{
24
}
}
func
(
m
*
ReplyPBGame
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_ReplyPBGame
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
ReplyPBGame
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_ReplyPBGame
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
ReplyPBGame
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_ReplyPBGame
.
Merge
(
m
,
src
)
}
func
(
m
*
ReplyPBGame
)
XXX_Size
()
int
{
return
xxx_messageInfo_ReplyPBGame
.
Size
(
m
)
}
func
(
m
*
ReplyPBGame
)
XXX_DiscardUnknown
()
{
xxx_messageInfo_ReplyPBGame
.
DiscardUnknown
(
m
)
}
var
xxx_messageInfo_ReplyPBGame
proto
.
InternalMessageInfo
func
(
m
*
ReplyPBGame
)
GetGame
()
*
PokerBull
{
if
m
!=
nil
{
return
m
.
Game
}
return
nil
}
type
QueryPBGameInfos
struct
{
GameIds
[]
string
`protobuf:"bytes,1,rep,name=gameIds,proto3" json:"gameIds,omitempty"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
XXX_unrecognized
[]
byte
`json:"-"`
XXX_sizecache
int32
`json:"-"`
}
func
(
m
*
QueryPBGameInfos
)
Reset
()
{
*
m
=
QueryPBGameInfos
{}
}
func
(
m
*
QueryPBGameInfos
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
QueryPBGameInfos
)
ProtoMessage
()
{}
func
(
*
QueryPBGameInfos
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_7574406c5d3430e8
,
[]
int
{
25
}
}
func
(
m
*
QueryPBGameInfos
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_QueryPBGameInfos
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
QueryPBGameInfos
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_QueryPBGameInfos
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
QueryPBGameInfos
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_QueryPBGameInfos
.
Merge
(
m
,
src
)
}
func
(
m
*
QueryPBGameInfos
)
XXX_Size
()
int
{
return
xxx_messageInfo_QueryPBGameInfos
.
Size
(
m
)
}
func
(
m
*
QueryPBGameInfos
)
XXX_DiscardUnknown
()
{
xxx_messageInfo_QueryPBGameInfos
.
DiscardUnknown
(
m
)
}
var
xxx_messageInfo_QueryPBGameInfos
proto
.
InternalMessageInfo
func
(
m
*
QueryPBGameInfos
)
GetGameIds
()
[]
string
{
if
m
!=
nil
{
return
m
.
GameIds
}
return
nil
}
type
ReplyPBGameList
struct
{
Games
[]
*
PokerBull
`protobuf:"bytes,1,rep,name=games,proto3" json:"games,omitempty"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
XXX_unrecognized
[]
byte
`json:"-"`
XXX_sizecache
int32
`json:"-"`
}
func
(
m
*
ReplyPBGameList
)
Reset
()
{
*
m
=
ReplyPBGameList
{}
}
func
(
m
*
ReplyPBGameList
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
ReplyPBGameList
)
ProtoMessage
()
{}
func
(
*
ReplyPBGameList
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_7574406c5d3430e8
,
[]
int
{
26
}
}
func
(
m
*
ReplyPBGameList
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_ReplyPBGameList
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
ReplyPBGameList
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_ReplyPBGameList
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
ReplyPBGameList
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_ReplyPBGameList
.
Merge
(
m
,
src
)
}
func
(
m
*
ReplyPBGameList
)
XXX_Size
()
int
{
return
xxx_messageInfo_ReplyPBGameList
.
Size
(
m
)
}
func
(
m
*
ReplyPBGameList
)
XXX_DiscardUnknown
()
{
xxx_messageInfo_ReplyPBGameList
.
DiscardUnknown
(
m
)
}
var
xxx_messageInfo_ReplyPBGameList
proto
.
InternalMessageInfo
func
(
m
*
ReplyPBGameList
)
GetGames
()
[]
*
PokerBull
{
if
m
!=
nil
{
return
m
.
Games
}
return
nil
}
type
ReceiptPBGame
struct
{
GameId
string
`protobuf:"bytes,1,opt,name=gameId,proto3" json:"gameId,omitempty"`
Status
int32
`protobuf:"varint,2,opt,name=status,proto3" json:"status,omitempty"`
Addr
string
`protobuf:"bytes,3,opt,name=addr,proto3" json:"addr,omitempty"`
Index
int64
`protobuf:"varint,4,opt,name=index,proto3" json:"index,omitempty"`
PrevIndex
int64
`protobuf:"varint,5,opt,name=prevIndex,proto3" json:"prevIndex,omitempty"`
PlayerNum
int32
`protobuf:"varint,6,opt,name=playerNum,proto3" json:"playerNum,omitempty"`
Value
int64
`protobuf:"varint,7,opt,name=value,proto3" json:"value,omitempty"`
IsWaiting
bool
`protobuf:"varint,8,opt,name=isWaiting,proto3" json:"isWaiting,omitempty"`
Players
[]
string
`protobuf:"bytes,9,rep,name=players,proto3" json:"players,omitempty"`
PreStatus
int32
`protobuf:"varint,10,opt,name=preStatus,proto3" json:"preStatus,omitempty"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
XXX_unrecognized
[]
byte
`json:"-"`
XXX_sizecache
int32
`json:"-"`
}
func
(
m
*
ReceiptPBGame
)
Reset
()
{
*
m
=
ReceiptPBGame
{}
}
func
(
m
*
ReceiptPBGame
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
ReceiptPBGame
)
ProtoMessage
()
{}
func
(
*
ReceiptPBGame
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_7574406c5d3430e8
,
[]
int
{
27
}
}
func
(
m
*
ReceiptPBGame
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_ReceiptPBGame
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
ReceiptPBGame
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_ReceiptPBGame
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
ReceiptPBGame
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_ReceiptPBGame
.
Merge
(
m
,
src
)
}
func
(
m
*
ReceiptPBGame
)
XXX_Size
()
int
{
return
xxx_messageInfo_ReceiptPBGame
.
Size
(
m
)
}
func
(
m
*
ReceiptPBGame
)
XXX_DiscardUnknown
()
{
xxx_messageInfo_ReceiptPBGame
.
DiscardUnknown
(
m
)
}
var
xxx_messageInfo_ReceiptPBGame
proto
.
InternalMessageInfo
func
(
m
*
ReceiptPBGame
)
GetGameId
()
string
{
if
m
!=
nil
{
return
m
.
GameId
}
return
""
}
func
(
m
*
ReceiptPBGame
)
GetStatus
()
int32
{
if
m
!=
nil
{
return
m
.
Status
}
return
0
}
func
(
m
*
ReceiptPBGame
)
GetAddr
()
string
{
if
m
!=
nil
{
return
m
.
Addr
}
return
""
}
func
(
m
*
ReceiptPBGame
)
GetIndex
()
int64
{
if
m
!=
nil
{
return
m
.
Index
}
return
0
}
func
(
m
*
ReceiptPBGame
)
GetPrevIndex
()
int64
{
if
m
!=
nil
{
return
m
.
PrevIndex
}
return
0
}
func
(
m
*
ReceiptPBGame
)
GetPlayerNum
()
int32
{
if
m
!=
nil
{
return
m
.
PlayerNum
}
return
0
}
func
(
m
*
ReceiptPBGame
)
GetValue
()
int64
{
if
m
!=
nil
{
return
m
.
Value
}
return
0
}
func
(
m
*
ReceiptPBGame
)
GetIsWaiting
()
bool
{
if
m
!=
nil
{
return
m
.
IsWaiting
}
return
false
}
func
(
m
*
ReceiptPBGame
)
GetPlayers
()
[]
string
{
if
m
!=
nil
{
return
m
.
Players
}
return
nil
}
func
(
m
*
ReceiptPBGame
)
GetPreStatus
()
int32
{
if
m
!=
nil
{
return
m
.
PreStatus
}
return
0
}
type
GuessStartTxReq
struct
{
Topic
string
`protobuf:"bytes,1,opt,name=topic,proto3" json:"topic,omitempty"`
Options
string
`protobuf:"bytes,2,opt,name=options,proto3" json:"options,omitempty"`
StartTime
int64
`protobuf:"varint,3,opt,name=startTime,proto3" json:"startTime,omitempty"`
StopTime
int64
`protobuf:"varint,4,opt,name=stopTime,proto3" json:"stopTime,omitempty"`
MaxHeight
uint32
`protobuf:"varint,5,opt,name=maxHeight,proto3" json:"maxHeight,omitempty"`
Symbol
string
`protobuf:"bytes,6,opt,name=symbol,proto3" json:"symbol,omitempty"`
Exec
string
`protobuf:"bytes,7,opt,name=exec,proto3" json:"exec,omitempty"`
OneBet
uint32
`protobuf:"varint,8,opt,name=oneBet,proto3" json:"oneBet,omitempty"`
MaxBets
uint32
`protobuf:"varint,9,opt,name=maxBets,proto3" json:"maxBets,omitempty"`
MaxBetsNumber
uint32
`protobuf:"varint,10,opt,name=maxBetsNumber,proto3" json:"maxBetsNumber,omitempty"`
Fee
uint64
`protobuf:"varint,11,opt,name=fee,proto3" json:"fee,omitempty"`
FeeAddr
string
`protobuf:"bytes,12,opt,name=feeAddr,proto3" json:"feeAddr,omitempty"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
XXX_unrecognized
[]
byte
`json:"-"`
XXX_sizecache
int32
`json:"-"`
}
func
(
m
*
GuessStartTxReq
)
Reset
()
{
*
m
=
GuessStartTxReq
{}
}
func
(
m
*
GuessStartTxReq
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
GuessStartTxReq
)
ProtoMessage
()
{}
func
(
*
GuessStartTxReq
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_7574406c5d3430e8
,
[]
int
{
28
}
}
func
(
m
*
GuessStartTxReq
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_GuessStartTxReq
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
GuessStartTxReq
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_GuessStartTxReq
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
GuessStartTxReq
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_GuessStartTxReq
.
Merge
(
m
,
src
)
}
func
(
m
*
GuessStartTxReq
)
XXX_Size
()
int
{
return
xxx_messageInfo_GuessStartTxReq
.
Size
(
m
)
}
func
(
m
*
GuessStartTxReq
)
XXX_DiscardUnknown
()
{
xxx_messageInfo_GuessStartTxReq
.
DiscardUnknown
(
m
)
}
var
xxx_messageInfo_GuessStartTxReq
proto
.
InternalMessageInfo
func
(
m
*
GuessStartTxReq
)
GetTopic
()
string
{
if
m
!=
nil
{
return
m
.
Topic
}
return
""
}
func
(
m
*
GuessStartTxReq
)
GetOptions
()
string
{
if
m
!=
nil
{
return
m
.
Options
}
return
""
}
func
(
m
*
GuessStartTxReq
)
GetStartTime
()
int64
{
if
m
!=
nil
{
return
m
.
StartTime
}
return
0
}
func
(
m
*
GuessStartTxReq
)
GetStopTime
()
int64
{
if
m
!=
nil
{
return
m
.
StopTime
}
return
0
}
func
(
m
*
GuessStartTxReq
)
GetMaxHeight
()
uint32
{
if
m
!=
nil
{
return
m
.
MaxHeight
}
return
0
}
func
(
m
*
GuessStartTxReq
)
GetSymbol
()
string
{
if
m
!=
nil
{
return
m
.
Symbol
}
return
""
}
func
(
m
*
GuessStartTxReq
)
GetExec
()
string
{
if
m
!=
nil
{
return
m
.
Exec
}
return
""
}
func
(
m
*
GuessStartTxReq
)
GetOneBet
()
uint32
{
if
m
!=
nil
{
return
m
.
OneBet
}
return
0
}
func
(
m
*
GuessStartTxReq
)
GetMaxBets
()
uint32
{
if
m
!=
nil
{
return
m
.
MaxBets
}
return
0
}
func
(
m
*
GuessStartTxReq
)
GetMaxBetsNumber
()
uint32
{
if
m
!=
nil
{
return
m
.
MaxBetsNumber
}
return
0
}
func
(
m
*
GuessStartTxReq
)
GetFee
()
uint64
{
if
m
!=
nil
{
return
m
.
Fee
}
return
0
}
func
(
m
*
GuessStartTxReq
)
GetFeeAddr
()
string
{
if
m
!=
nil
{
return
m
.
FeeAddr
}
return
""
}
type
GuessBetTxReq
struct
{
GameId
string
`protobuf:"bytes,1,opt,name=gameId,proto3" json:"gameId,omitempty"`
Option
string
`protobuf:"bytes,2,opt,name=option,proto3" json:"option,omitempty"`
Bets
uint32
`protobuf:"varint,3,opt,name=bets,proto3" json:"bets,omitempty"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
XXX_unrecognized
[]
byte
`json:"-"`
XXX_sizecache
int32
`json:"-"`
}
func
(
m
*
GuessBetTxReq
)
Reset
()
{
*
m
=
GuessBetTxReq
{}
}
func
(
m
*
GuessBetTxReq
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
GuessBetTxReq
)
ProtoMessage
()
{}
func
(
*
GuessBetTxReq
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_7574406c5d3430e8
,
[]
int
{
29
}
}
func
(
m
*
GuessBetTxReq
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_GuessBetTxReq
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
GuessBetTxReq
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_GuessBetTxReq
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
GuessBetTxReq
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_GuessBetTxReq
.
Merge
(
m
,
src
)
}
func
(
m
*
GuessBetTxReq
)
XXX_Size
()
int
{
return
xxx_messageInfo_GuessBetTxReq
.
Size
(
m
)
}
func
(
m
*
GuessBetTxReq
)
XXX_DiscardUnknown
()
{
xxx_messageInfo_GuessBetTxReq
.
DiscardUnknown
(
m
)
}
var
xxx_messageInfo_GuessBetTxReq
proto
.
InternalMessageInfo
func
(
m
*
GuessBetTxReq
)
GetGameId
()
string
{
if
m
!=
nil
{
return
m
.
GameId
}
return
""
}
func
(
m
*
GuessBetTxReq
)
GetOption
()
string
{
if
m
!=
nil
{
return
m
.
Option
}
return
""
}
func
(
m
*
GuessBetTxReq
)
GetBets
()
uint32
{
if
m
!=
nil
{
return
m
.
Bets
}
return
0
}
type
GuessAbortTxReq
struct
{
GameId
string
`protobuf:"bytes,1,opt,name=gameId,proto3" json:"gameId,omitempty"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
XXX_unrecognized
[]
byte
`json:"-"`
XXX_sizecache
int32
`json:"-"`
}
func
(
m
*
GuessAbortTxReq
)
Reset
()
{
*
m
=
GuessAbortTxReq
{}
}
func
(
m
*
GuessAbortTxReq
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
GuessAbortTxReq
)
ProtoMessage
()
{}
func
(
*
GuessAbortTxReq
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_7574406c5d3430e8
,
[]
int
{
30
}
}
func
(
m
*
GuessAbortTxReq
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_GuessAbortTxReq
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
GuessAbortTxReq
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_GuessAbortTxReq
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
GuessAbortTxReq
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_GuessAbortTxReq
.
Merge
(
m
,
src
)
}
func
(
m
*
GuessAbortTxReq
)
XXX_Size
()
int
{
return
xxx_messageInfo_GuessAbortTxReq
.
Size
(
m
)
}
func
(
m
*
GuessAbortTxReq
)
XXX_DiscardUnknown
()
{
xxx_messageInfo_GuessAbortTxReq
.
DiscardUnknown
(
m
)
}
var
xxx_messageInfo_GuessAbortTxReq
proto
.
InternalMessageInfo
func
(
m
*
GuessAbortTxReq
)
GetGameId
()
string
{
if
m
!=
nil
{
return
m
.
GameId
}
return
""
}
type
GuessPublishTxReq
struct
{
GameId
string
`protobuf:"bytes,1,opt,name=gameId,proto3" json:"gameId,omitempty"`
Result
string
`protobuf:"bytes,2,opt,name=result,proto3" json:"result,omitempty"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
XXX_unrecognized
[]
byte
`json:"-"`
XXX_sizecache
int32
`json:"-"`
}
func
(
m
*
GuessPublishTxReq
)
Reset
()
{
*
m
=
GuessPublishTxReq
{}
}
func
(
m
*
GuessPublishTxReq
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
GuessPublishTxReq
)
ProtoMessage
()
{}
func
(
*
GuessPublishTxReq
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_7574406c5d3430e8
,
[]
int
{
31
}
}
func
(
m
*
GuessPublishTxReq
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_GuessPublishTxReq
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
GuessPublishTxReq
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_GuessPublishTxReq
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
GuessPublishTxReq
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_GuessPublishTxReq
.
Merge
(
m
,
src
)
}
func
(
m
*
GuessPublishTxReq
)
XXX_Size
()
int
{
return
xxx_messageInfo_GuessPublishTxReq
.
Size
(
m
)
}
func
(
m
*
GuessPublishTxReq
)
XXX_DiscardUnknown
()
{
xxx_messageInfo_GuessPublishTxReq
.
DiscardUnknown
(
m
)
}
var
xxx_messageInfo_GuessPublishTxReq
proto
.
InternalMessageInfo
func
(
m
*
GuessPublishTxReq
)
GetGameId
()
string
{
if
m
!=
nil
{
return
m
.
GameId
}
return
""
}
func
(
m
*
GuessPublishTxReq
)
GetResult
()
string
{
if
m
!=
nil
{
return
m
.
Result
}
return
""
}
type
PBContinueTxReq
struct
{
GameId
string
`protobuf:"bytes,1,opt,name=gameId,proto3" json:"gameId,omitempty"`
Fee
int64
`protobuf:"varint,2,opt,name=fee,proto3" json:"fee,omitempty"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
XXX_unrecognized
[]
byte
`json:"-"`
XXX_sizecache
int32
`json:"-"`
}
func
(
m
*
PBContinueTxReq
)
Reset
()
{
*
m
=
PBContinueTxReq
{}
}
func
(
m
*
PBContinueTxReq
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
PBContinueTxReq
)
ProtoMessage
()
{}
func
(
*
PBContinueTxReq
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_7574406c5d3430e8
,
[]
int
{
32
}
}
func
(
m
*
PBContinueTxReq
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_PBContinueTxReq
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
PBContinueTxReq
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_PBContinueTxReq
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
PBContinueTxReq
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_PBContinueTxReq
.
Merge
(
m
,
src
)
}
func
(
m
*
PBContinueTxReq
)
XXX_Size
()
int
{
return
xxx_messageInfo_PBContinueTxReq
.
Size
(
m
)
}
func
(
m
*
PBContinueTxReq
)
XXX_DiscardUnknown
()
{
xxx_messageInfo_PBContinueTxReq
.
DiscardUnknown
(
m
)
}
var
xxx_messageInfo_PBContinueTxReq
proto
.
InternalMessageInfo
func
(
m
*
PBContinueTxReq
)
GetGameId
()
string
{
if
m
!=
nil
{
return
m
.
GameId
}
return
""
}
func
(
m
*
PBContinueTxReq
)
GetFee
()
int64
{
if
m
!=
nil
{
return
m
.
Fee
}
return
0
}
type
PBQuitTxReq
struct
{
GameId
string
`protobuf:"bytes,1,opt,name=gameId,proto3" json:"gameId,omitempty"`
Fee
int64
`protobuf:"varint,2,opt,name=fee,proto3" json:"fee,omitempty"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
XXX_unrecognized
[]
byte
`json:"-"`
XXX_sizecache
int32
`json:"-"`
}
func
(
m
*
PBQuitTxReq
)
Reset
()
{
*
m
=
PBQuitTxReq
{}
}
func
(
m
*
PBQuitTxReq
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
PBQuitTxReq
)
ProtoMessage
()
{}
func
(
*
PBQuitTxReq
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_7574406c5d3430e8
,
[]
int
{
33
}
}
func
(
m
*
PBQuitTxReq
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_PBQuitTxReq
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
PBQuitTxReq
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_PBQuitTxReq
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
PBQuitTxReq
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_PBQuitTxReq
.
Merge
(
m
,
src
)
}
func
(
m
*
PBQuitTxReq
)
XXX_Size
()
int
{
return
xxx_messageInfo_PBQuitTxReq
.
Size
(
m
)
}
func
(
m
*
PBQuitTxReq
)
XXX_DiscardUnknown
()
{
xxx_messageInfo_PBQuitTxReq
.
DiscardUnknown
(
m
)
}
var
xxx_messageInfo_PBQuitTxReq
proto
.
InternalMessageInfo
func
(
m
*
PBQuitTxReq
)
GetGameId
()
string
{
if
m
!=
nil
{
return
m
.
GameId
}
return
""
}
func
(
m
*
PBQuitTxReq
)
GetFee
()
int64
{
if
m
!=
nil
{
return
m
.
Fee
}
return
0
}
type
PBQueryReq
struct
{
GameId
string
`protobuf:"bytes,1,opt,name=gameId,proto3" json:"gameId,omitempty"`
Fee
int64
`protobuf:"varint,2,opt,name=fee,proto3" json:"fee,omitempty"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
XXX_unrecognized
[]
byte
`json:"-"`
XXX_sizecache
int32
`json:"-"`
}
func
(
m
*
PBQueryReq
)
Reset
()
{
*
m
=
PBQueryReq
{}
}
func
(
m
*
PBQueryReq
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
PBQueryReq
)
ProtoMessage
()
{}
func
(
*
PBQueryReq
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_7574406c5d3430e8
,
[]
int
{
34
}
}
func
(
m
*
PBQueryReq
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_PBQueryReq
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
PBQueryReq
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_PBQueryReq
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
PBQueryReq
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_PBQueryReq
.
Merge
(
m
,
src
)
}
func
(
m
*
PBQueryReq
)
XXX_Size
()
int
{
return
xxx_messageInfo_PBQueryReq
.
Size
(
m
)
}
func
(
m
*
PBQueryReq
)
XXX_DiscardUnknown
()
{
xxx_messageInfo_PBQueryReq
.
DiscardUnknown
(
m
)
}
var
xxx_messageInfo_PBQueryReq
proto
.
InternalMessageInfo
func
(
m
*
PBQueryReq
)
GetGameId
()
string
{
if
m
!=
nil
{
return
m
.
GameId
}
return
""
}
func
(
m
*
PBQueryReq
)
GetFee
()
int64
{
if
m
!=
nil
{
return
m
.
Fee
}
return
0
}
func
init
()
{
proto
.
RegisterType
((
*
GuessGame
)(
nil
),
"types.GuessGame"
)
proto
.
RegisterType
((
*
GuessPlayer
)(
nil
),
"types.GuessPlayer"
)
proto
.
RegisterType
((
*
GuessBet
)(
nil
),
"types.GuessBet"
)
proto
.
RegisterType
((
*
PokerBull
)(
nil
),
"types.PokerBull"
)
proto
.
RegisterType
((
*
PBHand
)(
nil
),
"types.PBHand"
)
proto
.
RegisterType
((
*
PBPlayer
)(
nil
),
"types.PBPlayer"
)
proto
.
RegisterType
((
*
PBResult
)(
nil
),
"types.PBResult"
)
proto
.
RegisterType
((
*
PBPoker
)(
nil
),
"types.PBPoker"
)
proto
.
RegisterType
((
*
PBGameAction
)(
nil
),
"types.PBGameAction"
)
proto
.
RegisterType
((
*
PBGameStart
)(
nil
),
"types.PBGameStart"
)
proto
.
RegisterType
((
*
PBGameContinue
)(
nil
),
"types.PBGameContinue"
)
proto
.
RegisterType
((
*
PBGameQuit
)(
nil
),
"types.PBGameQuit"
)
proto
.
RegisterType
((
*
PBGameQuery
)(
nil
),
"types.PBGameQuery"
)
proto
.
RegisterType
((
*
GuessGameAction
)(
nil
),
"types.GuessGameAction"
)
proto
.
RegisterType
((
*
GuessGameStart
)(
nil
),
"types.GuessGameStart"
)
proto
.
RegisterType
((
*
GuessGameBet
)(
nil
),
"types.GuessGameBet"
)
proto
.
RegisterType
((
*
GuessGameAbort
)(
nil
),
"types.GuessGameAbort"
)
proto
.
RegisterType
((
*
GuessGamePublish
)(
nil
),
"types.GuessGamePublish"
)
proto
.
RegisterType
((
*
GuessGameQuery
)(
nil
),
"types.GuessGameQuery"
)
proto
.
RegisterType
((
*
QueryPBGameListByStatusAndPlayerNum
)(
nil
),
"types.QueryPBGameListByStatusAndPlayerNum"
)
proto
.
RegisterType
((
*
PBGameRecord
)(
nil
),
"types.PBGameRecord"
)
proto
.
RegisterType
((
*
PBGameIndexRecord
)(
nil
),
"types.PBGameIndexRecord"
)
proto
.
RegisterType
((
*
PBGameRecords
)(
nil
),
"types.PBGameRecords"
)
proto
.
RegisterType
((
*
QueryPBGameInfo
)(
nil
),
"types.QueryPBGameInfo"
)
proto
.
RegisterType
((
*
ReplyPBGame
)(
nil
),
"types.ReplyPBGame"
)
proto
.
RegisterType
((
*
QueryPBGameInfos
)(
nil
),
"types.QueryPBGameInfos"
)
proto
.
RegisterType
((
*
ReplyPBGameList
)(
nil
),
"types.ReplyPBGameList"
)
proto
.
RegisterType
((
*
ReceiptPBGame
)(
nil
),
"types.ReceiptPBGame"
)
proto
.
RegisterType
((
*
GuessStartTxReq
)(
nil
),
"types.GuessStartTxReq"
)
proto
.
RegisterType
((
*
GuessBetTxReq
)(
nil
),
"types.GuessBetTxReq"
)
proto
.
RegisterType
((
*
GuessAbortTxReq
)(
nil
),
"types.GuessAbortTxReq"
)
proto
.
RegisterType
((
*
GuessPublishTxReq
)(
nil
),
"types.GuessPublishTxReq"
)
proto
.
RegisterType
((
*
PBContinueTxReq
)(
nil
),
"types.PBContinueTxReq"
)
proto
.
RegisterType
((
*
PBQuitTxReq
)(
nil
),
"types.PBQuitTxReq"
)
proto
.
RegisterType
((
*
PBQueryReq
)(
nil
),
"types.PBQueryReq"
)
}
func
init
()
{
proto
.
RegisterFile
(
"guess.proto"
,
fileDescriptor_7574406c5d3430e8
)
}
var
fileDescriptor_7574406c5d3430e8
=
[]
byte
{
// 1498 bytes of a gzipped FileDescriptorProto
0x1f
,
0x8b
,
0x08
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x02
,
0xff
,
0xac
,
0x58
,
0xdd
,
0x6e
,
0xdb
,
0xc6
,
0x12
,
0xb6
,
0x48
,
0x51
,
0x94
,
0x86
,
0x96
,
0x6c
,
0x6f
,
0x7e
,
0x0e
,
0x11
,
0x1c
,
0x1c
,
0x18
,
0x8c
,
0x4f
,
0xa2
,
0x1c
,
0x9c
,
0xe4
,
0x42
,
0x06
,
0xd2
,
0xa6
,
0x05
,
0x0a
,
0x98
,
0x01
,
0x1a
,
0x07
,
0x08
,
0x02
,
0x65
,
0x9d
,
0x22
,
0xbd
,
0xa5
,
0xa4
,
0x8d
,
0x43
,
0x44
,
0x22
,
0x65
,
0x92
,
0x4a
,
0xac
,
0xdb
,
0x3e
,
0x40
,
0x81
,
0x5e
,
0xf4
,
0x09
,
0xfa
,
0x16
,
0x7d
,
0x83
,
0x3e
,
0x44
,
0xaf
,
0xfb
,
0x08
,
0xbd
,
0x2d
,
0x76
,
0x66
,
0x57
,
0xfc
,
0x09
,
0x29
,
0xc7
,
0x45
,
0xef
,
0x38
,
0x3b
,
0xb3
,
0xb3
,
0xf3
,
0xb7
,
0x33
,
0xdf
,
0x12
,
0x9c
,
0xf3
,
0x95
,
0x48
,
0xd3
,
0x47
,
0xcb
,
0x24
,
0xce
,
0x62
,
0x66
,
0x65
,
0xeb
,
0xa5
,
0x48
,
0xef
,
0x1c
,
0x64
,
0x49
,
0x10
,
0xa5
,
0xc1
,
0x34
,
0x0b
,
0xe3
,
0x88
,
0x38
,
0xde
,
0xaf
,
0x6d
,
0xe8
,
0x3d
,
0x93
,
0x92
,
0xcf
,
0x82
,
0x85
,
0x60
,
0xb7
,
0xa1
,
0x73
,
0x1e
,
0x2c
,
0xc4
,
0xf3
,
0x99
,
0xdb
,
0x3a
,
0x6c
,
0x0d
,
0x7b
,
0x5c
,
0x51
,
0x72
,
0x3d
,
0xcd
,
0x82
,
0x6c
,
0x95
,
0xba
,
0xc6
,
0x61
,
0x6b
,
0xd8
,
0xe7
,
0x8a
,
0x62
,
0xff
,
0x86
,
0x5e
,
0x9a
,
0x05
,
0x49
,
0xf6
,
0x3a
,
0x5c
,
0x08
,
0xd7
,
0x3c
,
0x6c
,
0x0d
,
0x4d
,
0x9e
,
0x2f
,
0xb0
,
0x43
,
0x70
,
0x88
,
0xb8
,
0x3c
,
0x0d
,
0xd2
,
0x77
,
0x6e
,
0x1b
,
0x55
,
0x16
,
0x97
,
0xd8
,
0x4d
,
0xb0
,
0xb2
,
0x78
,
0x19
,
0x4e
,
0x5d
,
0x0b
,
0x79
,
0x44
,
0x30
,
0x17
,
0xec
,
0x78
,
0x29
,
0x6d
,
0x4c
,
0xdd
,
0x0e
,
0xae
,
0x6b
,
0x92
,
0xdd
,
0x81
,
0x6e
,
0x9a
,
0xc5
,
0x4b
,
0x3c
,
0xce
,
0xc6
,
0xe3
,
0x36
,
0xb4
,
0xb4
,
0x65
,
0x11
,
0x5c
,
0x9e
,
0x8a
,
0xf0
,
0xfc
,
0x5d
,
0xe6
,
0x76
,
0xd1
,
0xcc
,
0x7c
,
0x01
,
0x3d
,
0x58
,
0x2f
,
0x26
,
0xf1
,
0xdc
,
0xed
,
0x91
,
0x67
,
0x44
,
0x31
,
0x06
,
0x6d
,
0x71
,
0x29
,
0xa6
,
0x2e
,
0xe0
,
0x2a
,
0x7e
,
0x4b
,
0xd9
,
0x38
,
0x12
,
0xbe
,
0xc8
,
0x5c
,
0x87
,
0xbc
,
0x25
,
0x4a
,
0xda
,
0xb5
,
0x08
,
0x2e
,
0x7d
,
0x91
,
0xa5
,
0xee
,
0x2e
,
0x32
,
0x34
,
0xc9
,
0x8e
,
0xa0
,
0xaf
,
0x3e
,
0x5f
,
0xae
,
0x16
,
0x13
,
0x91
,
0xb8
,
0x7d
,
0xe4
,
0x97
,
0x17
,
0xd9
,
0x3e
,
0x98
,
0x6f
,
0x85
,
0x70
,
0x07
,
0xc8
,
0x93
,
0x9f
,
0x52
,
0xe3
,
0x5b
,
0x21
,
0x4e
,
0x66
,
0xb3
,
0xc4
,
0xdd
,
0x23
,
0x4f
,
0x15
,
0x29
,
0xbd
,
0x09
,
0x66
,
0x8b
,
0x30
,
0x42
,
0xde
,
0x3e
,
0xf2
,
0xf2
,
0x05
,
0xf6
,
0x1f
,
0x80
,
0x49
,
0x7e
,
0xd8
,
0x01
,
0x2a
,
0x2c
,
0xac
,
0xb0
,
0x21
,
0x58
,
0xcb
,
0x79
,
0xb0
,
0x4e
,
0x5d
,
0x76
,
0x68
,
0x0e
,
0x9d
,
0x11
,
0x7b
,
0x84
,
0xf9
,
0x7f
,
0x84
,
0x89
,
0x1e
,
0xcf
,
0x83
,
0xb5
,
0x48
,
0x38
,
0x09
,
0x48
,
0x5f
,
0x13
,
0x91
,
0xae
,
0xe6
,
0x99
,
0x7b
,
0x83
,
0xe2
,
0x42
,
0x14
,
0xbb
,
0x0b
,
0x6d
,
0xa9
,
0xcf
,
0xbd
,
0x89
,
0x0a
,
0xf6
,
0x8a
,
0x0a
,
0x7c
,
0x91
,
0x71
,
0x64
,
0x7a
,
0xdf
,
0x82
,
0x53
,
0x50
,
0x29
,
0x63
,
0x19
,
0x48
,
0x73
,
0xa9
,
0x76
,
0xf0
,
0x7b
,
0xa3
,
0xc7
,
0xd8
,
0xa6
,
0xc7
,
0x87
,
0xae
,
0x5e
,
0xc1
,
0xe0
,
0x63
,
0xb6
,
0x75
,
0x09
,
0x12
,
0x55
,
0x71
,
0xd9
,
0xa8
,
0xba
,
0xec
,
0xfd
,
0x69
,
0x42
,
0x6f
,
0x1c
,
0xbf
,
0x17
,
0x89
,
0xbf
,
0x9a
,
0xcf
,
0x3f
,
0xb3
,
0x90
,
0xad
,
0x7f
,
0xb2
,
0x90
,
0x3f
,
0x04
,
0xf3
,
0x95
,
0xc0
,
0x42
,
0x36
,
0x39
,
0x11
,
0xec
,
0x08
,
0xac
,
0xa5
,
0x34
,
0x09
,
0xcb
,
0xd8
,
0x19
,
0x0d
,
0x94
,
0xf7
,
0x63
,
0x1f
,
0x0d
,
0xe5
,
0xc4
,
0x64
,
0x0f
,
0xc0
,
0x5e
,
0x62
,
0x00
,
0x53
,
0xd7
,
0x2e
,
0x45
,
0x69
,
0xec
,
0xab
,
0x5c
,
0x69
,
0xbe
,
0x34
,
0x93
,
0x3e
,
0x5f
,
0xae
,
0x16
,
0x58
,
0xe3
,
0x16
,
0xcf
,
0x17
,
0xa4
,
0x22
,
0xca
,
0x5e
,
0xea
,
0xf6
,
0x2a
,
0x8a
,
0x38
,
0xae
,
0x73
,
0xcd
,
0x97
,
0xf6
,
0x86
,
0xd1
,
0x4c
,
0x5c
,
0x62
,
0xdd
,
0x9b
,
0x9c
,
0x08
,
0x54
,
0x9f
,
0x88
,
0x0f
,
0xcf
,
0x91
,
0xe3
,
0x50
,
0x14
,
0x36
,
0x0b
,
0xf2
,
0xf2
,
0x5d
,
0xac
,
0x42
,
0x0a
,
0xd1
,
0x2e
,
0x5d
,
0x3e
,
0x4d
,
0xcb
,
0xec
,
0xe0
,
0x37
,
0x05
,
0xa8
,
0x8f
,
0x01
,
0x2a
,
0xac
,
0x48
,
0xfe
,
0x4c
,
0x04
,
0x73
,
0x91
,
0x60
,
0x3d
,
0x0f
,
0x88
,
0x9f
,
0xaf
,
0xc8
,
0x93
,
0xc3
,
0xf4
,
0x4d
,
0x10
,
0x66
,
0x61
,
0x74
,
0x8e
,
0x57
,
0xa1
,
0xcb
,
0xf3
,
0x05
,
0x65
,
0xd7
,
0x19
,
0x25
,
0x6e
,
0x5f
,
0xb9
,
0xad
,
0x17
,
0xbc
,
0x1f
,
0x5a
,
0xd0
,
0x19
,
0xfb
,
0xa7
,
0x41
,
0x34
,
0x93
,
0x6e
,
0x4d
,
0x83
,
0x64
,
0x96
,
0xba
,
0xad
,
0x43
,
0x73
,
0x68
,
0x71
,
0x22
,
0x0a
,
0x35
,
0xae
,
0x92
,
0xae
,
0x6a
,
0xdc
,
0x05
,
0x5b
,
0xd6
,
0xa8
,
0x48
,
0x53
,
0x4c
,
0x79
,
0x8f
,
0x6b
,
0x12
,
0xc3
,
0x93
,
0xbe
,
0x09
,
0x23
,
0x4c
,
0x75
,
0x97
,
0x13
,
0x21
,
0x03
,
0x30
,
0x17
,
0x1f
,
0x44
,
0x12
,
0x9c
,
0x53
,
0x9e
,
0x2d
,
0xbe
,
0xa1
,
0xbd
,
0x8f
,
0xd0
,
0xd5
,
0xe9
,
0x62
,
0x77
,
0xc1
,
0x7a
,
0x17
,
0x44
,
0xca
,
0x0a
,
0x67
,
0xd4
,
0xdf
,
0x64
,
0x41
,
0xda
,
0xc8
,
0x89
,
0x57
,
0x3c
,
0xdc
,
0x28
,
0x1f
,
0x7e
,
0x1b
,
0x3a
,
0x19
,
0xc5
,
0x91
,
0x0a
,
0x51
,
0x51
,
0xd2
,
0xa8
,
0x44
,
0x04
,
0xb3
,
0xb5
,
0x36
,
0x0a
,
0x09
,
0xef
,
0x97
,
0x96
,
0x3c
,
0x99
,
0xeb
,
0x5b
,
0xfb
,
0x19
,
0x27
,
0xdf
,
0x86
,
0xce
,
0xc7
,
0x30
,
0x8a
,
0xd4
,
0x2d
,
0xea
,
0x71
,
0x45
,
0x95
,
0xdc
,
0x33
,
0xcb
,
0xee
,
0xc9
,
0x3d
,
0x94
,
0x2d
,
0x55
,
0xfc
,
0x8a
,
0x62
,
0xf7
,
0x60
,
0x40
,
0x5f
,
0x2f
,
0xca
,
0x81
,
0xa9
,
0xac
,
0x7a
,
0x4f
,
0xc0
,
0x56
,
0x55
,
0xdf
,
0x90
,
0x23
,
0x17
,
0xec
,
0x65
,
0x1c
,
0x46
,
0x99
,
0xb2
,
0xca
,
0xe2
,
0x9a
,
0xf4
,
0x7e
,
0x6f
,
0xc1
,
0xee
,
0xd8
,
0x97
,
0xe3
,
0xe9
,
0x04
,
0x07
,
0x17
,
0xfb
,
0x1f
,
0x58
,
0x78
,
0xf5
,
0xf0
,
0x6a
,
0xe7
,
0xcd
,
0x8d
,
0x64
,
0xce
,
0x24
,
0xe7
,
0x74
,
0x87
,
0x93
,
0x08
,
0x3b
,
0x86
,
0xee
,
0x34
,
0x8e
,
0xb2
,
0x30
,
0x5a
,
0x09
,
0xd4
,
0xeb
,
0x8c
,
0x6e
,
0x95
,
0xc4
,
0x9f
,
0x2a
,
0xe6
,
0xe9
,
0x0e
,
0xdf
,
0x08
,
0xb2
,
0xfb
,
0xd0
,
0x96
,
0xa5
,
0x8b
,
0x41
,
0x70
,
0x46
,
0x07
,
0xa5
,
0x0d
,
0xaf
,
0x56
,
0xa1
,
0x54
,
0x8f
,
0x02
,
0xd2
,
0x92
,
0x8b
,
0x95
,
0x48
,
0x28
,
0x23
,
0x55
,
0x4b
,
0x5e
,
0x49
,
0x8e
,
0xb4
,
0x04
,
0x45
,
0xd8
,
0x00
,
0x8c
,
0x6c
,
0x8d
,
0xd7
,
0xcd
,
0xe2
,
0x46
,
0xb6
,
0xf6
,
0x6d
,
0xd5
,
0x31
,
0xbc
,
0x13
,
0x70
,
0x0a
,
0xa6
,
0xe7
,
0x9d
,
0xa4
,
0x55
,
0xec
,
0x24
,
0xa5
,
0x8b
,
0x6f
,
0x54
,
0x2e
,
0xbe
,
0x37
,
0x84
,
0x41
,
0xd9
,
0x9d
,
0xa6
,
0xfe
,
0xe7
,
0x1d
,
0x01
,
0xe4
,
0x7e
,
0x34
,
0x4a
,
0xfd
,
0x57
,
0x9b
,
0x84
,
0x3e
,
0x34
,
0x8a
,
0xfd
,
0x6c
,
0xc0
,
0xde
,
0x06
,
0x3b
,
0xa8
,
0xe4
,
0x3c
,
0x2c
,
0x27
,
0xe7
,
0x56
,
0xb1
,
0xe1
,
0xd7
,
0xe4
,
0xe7
,
0x3e
,
0x98
,
0x13
,
0x91
,
0xa9
,
0xd4
,
0xdc
,
0xa8
,
0x0a
,
0xfb
,
0x42
,
0x8a
,
0x4a
,
0x09
,
0xa9
,
0x37
,
0x98
,
0xc4
,
0x89
,
0x4e
,
0xca
,
0x27
,
0x7a
,
0x4f
,
0x24
,
0x53
,
0xea
,
0x45
,
0x29
,
0x76
,
0x0c
,
0xf6
,
0x72
,
0x35
,
0x99
,
0x87
,
0xaa
,
0x5b
,
0x3b
,
0xa3
,
0x7f
,
0x55
,
0x37
,
0x8c
,
0x89
,
0x7d
,
0xba
,
0xc3
,
0xb5
,
0xa4
,
0x3c
,
0x83
,
0xd2
,
0x69
,
0xd5
,
0x9f
,
0x51
,
0x9b
,
0xd1
,
0x0e
,
0x4e
,
0xa2
,
0x52
,
0x46
,
0x7f
,
0x34
,
0x60
,
0x50
,
0x76
,
0x38
,
0x07
,
0x3a
,
0xad
,
0x06
,
0xa0
,
0x63
,
0x94
,
0x81
,
0x4e
,
0x09
,
0xcc
,
0x98
,
0xcd
,
0x60
,
0xa6
,
0x5d
,
0x0b
,
0x66
,
0xac
,
0x5a
,
0x30
,
0xd3
,
0x69
,
0x02
,
0x33
,
0xf6
,
0x15
,
0x60
,
0xa6
,
0xbb
,
0x05
,
0xcc
,
0x48
,
0x34
,
0xd5
,
0xfe
,
0x04
,
0xcc
,
0x40
,
0x09
,
0xcc
,
0x78
,
0xdf
,
0xc3
,
0x6e
,
0x31
,
0xa7
,
0xdb
,
0xa6
,
0xb3
,
0x9a
,
0xfd
,
0x46
,
0x69
,
0xf6
,
0xbb
,
0x60
,
0xab
,
0x49
,
0xaf
,
0x62
,
0xa1
,
0x49
,
0x59
,
0xf9
,
0xe5
,
0x12
,
0x68
,
0x2c
,
0x56
,
0x1f
,
0xf6
,
0xab
,
0xb9
,
0xdf
,
0x66
,
0x47
,
0x61
,
0x60
,
0x6c
,
0x40
,
0x91
,
0xf7
,
0x65
,
0xe1
,
0xb4
,
0xad
,
0x57
,
0x43
,
0xd5
,
0x86
,
0xa1
,
0x6b
,
0xc3
,
0xbb
,
0x80
,
0xbb
,
0xb8
,
0x81
,
0xae
,
0xd5
,
0x8b
,
0x30
,
0xcd
,
0xfc
,
0x35
,
0x8d
,
0xaf
,
0x93
,
0x68
,
0x36
,
0xde
,
0x4c
,
0xf0
,
0x1c
,
0x9e
,
0xb4
,
0xaa
,
0xf0
,
0xa4
,
0xf9
,
0xfa
,
0xe7
,
0xc3
,
0xdc
,
0x2c
,
0x0c
,
0x73
,
0xef
,
0xb5
,
0x6e
,
0x9b
,
0x5c
,
0x4c
,
0xe3
,
0x64
,
0x76
,
0x6d
,
0x48
,
0x54
,
0xaf
,
0xf5
,
0x04
,
0x0e
,
0x48
,
0x2b
,
0x62
,
0x82
,
0x2b
,
0x54
,
0x6f
,
0x54
,
0x18
,
0x45
,
0x15
,
0xdf
,
0x40
,
0xbf
,
0x68
,
0x58
,
0xca
,
0x1e
,
0x4a
,
0xdc
,
0x82
,
0x9f
,
0x6a
,
0x6e
,
0xdd
,
0x28
,
0x35
,
0x52
,
0x12
,
0xe3
,
0x5a
,
0xc6
,
0x7b
,
0x0f
,
0x7b
,
0x85
,
0x58
,
0x3e
,
0x8f
,
0xde
,
0xc6
,
0x8d
,
0x06
,
0x68
,
0x44
,
0x6a
,
0x14
,
0x10
,
0x69
,
0xee
,
0xaf
,
0x59
,
0xef
,
0x6f
,
0xbb
,
0x68
,
0xec
,
0x31
,
0x38
,
0x5c
,
0x2c
,
0xe7
,
0xea
,
0x30
,
0x76
,
0x04
,
0x6d
,
0xa9
,
0x5a
,
0x75
,
0xb7
,
0x7d
,
0x6d
,
0xa7
,
0xc6
,
0x9d
,
0x1c
,
0xb9
,
0xde
,
0xff
,
0x61
,
0xbf
,
0x62
,
0x21
,
0x0e
,
0x38
,
0x32
,
0x8a
,
0x9c
,
0xec
,
0x71
,
0x4d
,
0x7a
,
0x4f
,
0x60
,
0xaf
,
0x70
,
0x84
,
0xac
,
0x0d
,
0x76
,
0x0f
,
0x2c
,
0xc9
,
0xd5
,
0xf1
,
0xf8
,
0xf4
,
0x1c
,
0x62
,
0x7b
,
0x3f
,
0x19
,
0xd0
,
0xe7
,
0x62
,
0x2a
,
0xc2
,
0x65
,
0xa6
,
0x0c
,
0xbc
,
0x6e
,
0x96
,
0x75
,
0x84
,
0xcc
,
0x42
,
0x84
,
0x6a
,
0x23
,
0x51
,
0x06
,
0x87
,
0x56
,
0x15
,
0x1c
,
0x96
,
0x2a
,
0xb4
,
0x53
,
0x53
,
0xa1
,
0x34
,
0xd4
,
0xec
,
0xca
,
0x50
,
0xcb
,
0x41
,
0x5f
,
0xb7
,
0x0a
,
0xfa
,
0xdc
,
0x1c
,
0x16
,
0xf7
,
0x28
,
0x60
,
0x45
,
0x14
,
0xbc
,
0x81
,
0x83
,
0x50
,
0x85
,
0x83
,
0xbf
,
0xe9
,
0xa9
,
0x74
,
0x46
,
0xf8
,
0x9c
,
0x8b
,
0x8b
,
0xbf
,
0xd3
,
0x7e
,
0xb7
,
0x3c
,
0x07
,
0x8a
,
0xaf
,
0xd0
,
0xf6
,
0xb6
,
0x57
,
0xa8
,
0xd5
,
0xdc
,
0xb8
,
0x3b
,
0xb5
,
0x8d
,
0xdb
,
0xae
,
0x6d
,
0xdc
,
0xdd
,
0xa6
,
0xc6
,
0xdd
,
0xbb
,
0xa2
,
0x71
,
0xc3
,
0x96
,
0xc6
,
0xed
,
0xd4
,
0x36
,
0xee
,
0xdd
,
0x72
,
0xe3
,
0x3e
,
0x83
,
0xbe
,
0x7e
,
0x98
,
0x51
,
0x20
,
0xaf
,
0xdb
,
0xb9
,
0x99
,
0x7a
,
0xfe
,
0x51
,
0xdb
,
0xa6
,
0xd7
,
0xde
,
0x03
,
0x95
,
0x1f
,
0xec
,
0xd7
,
0x5b
,
0xd5
,
0x7a
,
0x4f
,
0xe1
,
0x80
,
0x1e
,
0x98
,
0xd4
,
0xb0
,
0xaf
,
0xb4
,
0xa1
,
0xb6
,
0x6b
,
0x7f
,
0x0d
,
0x7b
,
0x63
,
0x5f
,
0x23
,
0xa3
,
0xed
,
0x2a
,
0x54
,
0x6c
,
0xa8
,
0x5d
,
0xc9
,
0x4f
,
0xef
,
0x0b
,
0x09
,
0x85
,
0x5e
,
0xe1
,
0x43
,
0xe6
,
0x7a
,
0x1b
,
0x1f
,
0x4b
,
0xa4
,
0x85
,
0x5d
,
0xe0
,
0x5a
,
0xfb
,
0x46
,
0x7f
,
0xb4
,
0xc0
,
0xc2
,
0x5f
,
0x37
,
0xec
,
0x31
,
0x40
,
0x5e
,
0xc7
,
0xac
,
0x1e
,
0x49
,
0xdd
,
0xd1
,
0x4f
,
0xbc
,
0xef
,
0xa2
,
0x34
,
0x3c
,
0x8f
,
0x5e
,
0x5f
,
0x7a
,
0x3b
,
0x6c
,
0x54
,
0x78
,
0x4d
,
0xd7
,
0x41
,
0xaa
,
0xba
,
0x3d
,
0xfa
,
0x2c
,
0x9a
,
0xa1
,
0xf5
,
0xe8
,
0xaa
,
0x6e
,
0xdf
,
0x57
,
0x6a
,
0xb2
,
0xeb
,
0x89
,
0xda
,
0x04
,
0xb3
,
0x6a
,
0xf6
,
0x4e
,
0x3a
,
0xf8
,
0x07
,
0xea
,
0xf8
,
0xaf
,
0x00
,
0x00
,
0x00
,
0xff
,
0xff
,
0xb8
,
0xdf
,
0x08
,
0x12
,
0xaa
,
0x12
,
0x00
,
0x00
,
}
// Reference imports to suppress errors if they are not otherwise used.
var
_
context
.
Context
var
_
grpc
.
ClientConn
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
const
_
=
grpc
.
SupportPackageIsVersion4
// GuessClient is the client API for Guess service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
type
GuessClient
interface
{
//游戏开始
GuessStart
(
ctx
context
.
Context
,
in
*
GuessGameStart
,
opts
...
grpc
.
CallOption
)
(
*
types
.
UnsignTx
,
error
)
//游戏下注
GuessBet
(
ctx
context
.
Context
,
in
*
GuessGameBet
,
opts
...
grpc
.
CallOption
)
(
*
types
.
UnsignTx
,
error
)
//游戏异常终止
GuessAbort
(
ctx
context
.
Context
,
in
*
GuessGameAbort
,
opts
...
grpc
.
CallOption
)
(
*
types
.
UnsignTx
,
error
)
//游戏结束
GuessPublish
(
ctx
context
.
Context
,
in
*
GuessGamePublish
,
opts
...
grpc
.
CallOption
)
(
*
types
.
UnsignTx
,
error
)
}
type
guessClient
struct
{
cc
*
grpc
.
ClientConn
}
func
NewGuessClient
(
cc
*
grpc
.
ClientConn
)
GuessClient
{
return
&
guessClient
{
cc
}
}
func
(
c
*
guessClient
)
GuessStart
(
ctx
context
.
Context
,
in
*
GuessGameStart
,
opts
...
grpc
.
CallOption
)
(
*
types
.
UnsignTx
,
error
)
{
out
:=
new
(
types
.
UnsignTx
)
err
:=
c
.
cc
.
Invoke
(
ctx
,
"/types.guess/GuessStart"
,
in
,
out
,
opts
...
)
if
err
!=
nil
{
return
nil
,
err
}
return
out
,
nil
}
func
(
c
*
guessClient
)
GuessBet
(
ctx
context
.
Context
,
in
*
GuessGameBet
,
opts
...
grpc
.
CallOption
)
(
*
types
.
UnsignTx
,
error
)
{
out
:=
new
(
types
.
UnsignTx
)
err
:=
c
.
cc
.
Invoke
(
ctx
,
"/types.guess/GuessBet"
,
in
,
out
,
opts
...
)
if
err
!=
nil
{
return
nil
,
err
}
return
out
,
nil
}
func
(
c
*
guessClient
)
GuessAbort
(
ctx
context
.
Context
,
in
*
GuessGameAbort
,
opts
...
grpc
.
CallOption
)
(
*
types
.
UnsignTx
,
error
)
{
out
:=
new
(
types
.
UnsignTx
)
err
:=
c
.
cc
.
Invoke
(
ctx
,
"/types.guess/GuessAbort"
,
in
,
out
,
opts
...
)
if
err
!=
nil
{
return
nil
,
err
}
return
out
,
nil
}
func
(
c
*
guessClient
)
GuessPublish
(
ctx
context
.
Context
,
in
*
GuessGamePublish
,
opts
...
grpc
.
CallOption
)
(
*
types
.
UnsignTx
,
error
)
{
out
:=
new
(
types
.
UnsignTx
)
err
:=
c
.
cc
.
Invoke
(
ctx
,
"/types.guess/GuessPublish"
,
in
,
out
,
opts
...
)
if
err
!=
nil
{
return
nil
,
err
}
return
out
,
nil
}
// GuessServer is the server API for Guess service.
type
GuessServer
interface
{
//游戏开始
GuessStart
(
context
.
Context
,
*
GuessGameStart
)
(
*
types
.
UnsignTx
,
error
)
//游戏下注
GuessBet
(
context
.
Context
,
*
GuessGameBet
)
(
*
types
.
UnsignTx
,
error
)
//游戏异常终止
GuessAbort
(
context
.
Context
,
*
GuessGameAbort
)
(
*
types
.
UnsignTx
,
error
)
//游戏结束
GuessPublish
(
context
.
Context
,
*
GuessGamePublish
)
(
*
types
.
UnsignTx
,
error
)
}
func
RegisterGuessServer
(
s
*
grpc
.
Server
,
srv
GuessServer
)
{
s
.
RegisterService
(
&
_Guess_serviceDesc
,
srv
)
}
func
_Guess_GuessStart_Handler
(
srv
interface
{},
ctx
context
.
Context
,
dec
func
(
interface
{})
error
,
interceptor
grpc
.
UnaryServerInterceptor
)
(
interface
{},
error
)
{
in
:=
new
(
GuessGameStart
)
if
err
:=
dec
(
in
);
err
!=
nil
{
return
nil
,
err
}
if
interceptor
==
nil
{
return
srv
.
(
GuessServer
)
.
GuessStart
(
ctx
,
in
)
}
info
:=
&
grpc
.
UnaryServerInfo
{
Server
:
srv
,
FullMethod
:
"/types.guess/GuessStart"
,
}
handler
:=
func
(
ctx
context
.
Context
,
req
interface
{})
(
interface
{},
error
)
{
return
srv
.
(
GuessServer
)
.
GuessStart
(
ctx
,
req
.
(
*
GuessGameStart
))
}
return
interceptor
(
ctx
,
in
,
info
,
handler
)
}
func
_Guess_GuessBet_Handler
(
srv
interface
{},
ctx
context
.
Context
,
dec
func
(
interface
{})
error
,
interceptor
grpc
.
UnaryServerInterceptor
)
(
interface
{},
error
)
{
in
:=
new
(
GuessGameBet
)
if
err
:=
dec
(
in
);
err
!=
nil
{
return
nil
,
err
}
if
interceptor
==
nil
{
return
srv
.
(
GuessServer
)
.
GuessBet
(
ctx
,
in
)
}
info
:=
&
grpc
.
UnaryServerInfo
{
Server
:
srv
,
FullMethod
:
"/types.guess/GuessBet"
,
}
handler
:=
func
(
ctx
context
.
Context
,
req
interface
{})
(
interface
{},
error
)
{
return
srv
.
(
GuessServer
)
.
GuessBet
(
ctx
,
req
.
(
*
GuessGameBet
))
}
return
interceptor
(
ctx
,
in
,
info
,
handler
)
}
func
_Guess_GuessAbort_Handler
(
srv
interface
{},
ctx
context
.
Context
,
dec
func
(
interface
{})
error
,
interceptor
grpc
.
UnaryServerInterceptor
)
(
interface
{},
error
)
{
in
:=
new
(
GuessGameAbort
)
if
err
:=
dec
(
in
);
err
!=
nil
{
return
nil
,
err
}
if
interceptor
==
nil
{
return
srv
.
(
GuessServer
)
.
GuessAbort
(
ctx
,
in
)
}
info
:=
&
grpc
.
UnaryServerInfo
{
Server
:
srv
,
FullMethod
:
"/types.guess/GuessAbort"
,
}
handler
:=
func
(
ctx
context
.
Context
,
req
interface
{})
(
interface
{},
error
)
{
return
srv
.
(
GuessServer
)
.
GuessAbort
(
ctx
,
req
.
(
*
GuessGameAbort
))
}
return
interceptor
(
ctx
,
in
,
info
,
handler
)
}
func
_Guess_GuessPublish_Handler
(
srv
interface
{},
ctx
context
.
Context
,
dec
func
(
interface
{})
error
,
interceptor
grpc
.
UnaryServerInterceptor
)
(
interface
{},
error
)
{
in
:=
new
(
GuessGamePublish
)
if
err
:=
dec
(
in
);
err
!=
nil
{
return
nil
,
err
}
if
interceptor
==
nil
{
return
srv
.
(
GuessServer
)
.
GuessPublish
(
ctx
,
in
)
}
info
:=
&
grpc
.
UnaryServerInfo
{
Server
:
srv
,
FullMethod
:
"/types.guess/GuessPublish"
,
}
handler
:=
func
(
ctx
context
.
Context
,
req
interface
{})
(
interface
{},
error
)
{
return
srv
.
(
GuessServer
)
.
GuessPublish
(
ctx
,
req
.
(
*
GuessGamePublish
))
}
return
interceptor
(
ctx
,
in
,
info
,
handler
)
}
var
_Guess_serviceDesc
=
grpc
.
ServiceDesc
{
ServiceName
:
"types.guess"
,
HandlerType
:
(
*
GuessServer
)(
nil
),
Methods
:
[]
grpc
.
MethodDesc
{
{
MethodName
:
"GuessStart"
,
Handler
:
_Guess_GuessStart_Handler
,
},
{
MethodName
:
"GuessBet"
,
Handler
:
_Guess_GuessBet_Handler
,
},
{
MethodName
:
"GuessAbort"
,
Handler
:
_Guess_GuessAbort_Handler
,
},
{
MethodName
:
"GuessPublish"
,
Handler
:
_Guess_GuessPublish_Handler
,
},
},
Streams
:
[]
grpc
.
StreamDesc
{},
Metadata
:
"guess.proto"
,
}
plugin/dapp/guess/types/types.go
0 → 100644
View file @
6ed5261f
// Copyright Fuzamei Corp. 2018 All Rights Reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package
types
import
(
"reflect"
"github.com/33cn/chain33/types"
)
func
init
()
{
// init executor type
types
.
RegistorExecutor
(
GuessX
,
NewType
())
types
.
AllowUserExec
=
append
(
types
.
AllowUserExec
,
ExecerGuess
)
types
.
RegisterDappFork
(
GuessX
,
"Enable"
,
0
)
}
// exec
type
PokerBullType
struct
{
types
.
ExecTypeBase
}
func
NewType
()
*
PokerBullType
{
c
:=
&
PokerBullType
{}
c
.
SetChild
(
c
)
return
c
}
func
(
t
*
PokerBullType
)
GetPayload
()
types
.
Message
{
return
&
PBGameAction
{}
}
func
(
t
*
PokerBullType
)
GetTypeMap
()
map
[
string
]
int32
{
return
map
[
string
]
int32
{
"Start"
:
PBGameActionStart
,
"Continue"
:
PBGameActionContinue
,
"Quit"
:
PBGameActionQuit
,
"Query"
:
PBGameActionQuery
,
}
}
func
(
t
*
PokerBullType
)
GetLogMap
()
map
[
int64
]
*
types
.
LogInfo
{
return
map
[
int64
]
*
types
.
LogInfo
{
TyLogPBGameStart
:
{
reflect
.
TypeOf
(
ReceiptPBGame
{}),
"TyLogPBGameStart"
},
TyLogPBGameContinue
:
{
reflect
.
TypeOf
(
ReceiptPBGame
{}),
"TyLogPBGameContinue"
},
TyLogPBGameQuit
:
{
reflect
.
TypeOf
(
ReceiptPBGame
{}),
"TyLogPBGameQuit"
},
TyLogPBGameQuery
:
{
reflect
.
TypeOf
(
ReceiptPBGame
{}),
"TyLogPBGameQuery"
},
}
}
// exec
type
GuessType
struct
{
types
.
ExecTypeBase
}
func
NewType
()
*
GuessType
{
c
:=
&
GuessType
{}
c
.
SetChild
(
c
)
return
c
}
func
(
t
*
GuessType
)
GetPayload
()
types
.
Message
{
return
&
GuessGameAction
{}
}
func
(
t
*
GuessType
)
GetTypeMap
()
map
[
string
]
int32
{
return
map
[
string
]
int32
{
"Start"
:
PBGameActionStart
,
"Continue"
:
PBGameActionContinue
,
"Quit"
:
PBGameActionQuit
,
"Query"
:
PBGameActionQuery
,
}
}
func
(
t
*
PokerBullType
)
GetLogMap
()
map
[
int64
]
*
types
.
LogInfo
{
return
map
[
int64
]
*
types
.
LogInfo
{
TyLogPBGameStart
:
{
reflect
.
TypeOf
(
ReceiptPBGame
{}),
"TyLogPBGameStart"
},
TyLogPBGameContinue
:
{
reflect
.
TypeOf
(
ReceiptPBGame
{}),
"TyLogPBGameContinue"
},
TyLogPBGameQuit
:
{
reflect
.
TypeOf
(
ReceiptPBGame
{}),
"TyLogPBGameQuit"
},
TyLogPBGameQuery
:
{
reflect
.
TypeOf
(
ReceiptPBGame
{}),
"TyLogPBGameQuery"
},
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment