Unverified Commit afbd0de6 authored by 33cn's avatar 33cn Committed by GitHub

Merge pull request #141 from jpeng-go/pokerbull

Pokerbull问题修复
parents 62cbbdc6 66bcc4fb
...@@ -56,19 +56,15 @@ func pokerbullStart(cmd *cobra.Command, args []string) { ...@@ -56,19 +56,15 @@ func pokerbullStart(cmd *cobra.Command, args []string) {
rpcLaddr, _ := cmd.Flags().GetString("rpc_laddr") rpcLaddr, _ := cmd.Flags().GetString("rpc_laddr")
value, _ := cmd.Flags().GetUint64("value") value, _ := cmd.Flags().GetUint64("value")
playerCount, _ := cmd.Flags().GetUint32("playerCount") playerCount, _ := cmd.Flags().GetUint32("playerCount")
fee, _ := cmd.Flags().GetFloat64("fee")
feeInt64 := int64(fee * 1e4) params := &rpctypes.CreateTxIn{
amountInt64 := int64(value) Execer: types.ExecName(pkt.PokerBullX),
ActionName: pkt.CreateStartTx,
params := &pkt.PBStartTxReq{ Payload: []byte(fmt.Sprintf("{\"value\":%d,\"playerNum\":%d}", int64(value)*types.Coin, int32(playerCount))),
Value: amountInt64 * types.Coin,
PlayerNum: int32(playerCount),
Fee: feeInt64,
} }
var res string var res string
ctx := jsonrpc.NewRPCCtx(rpcLaddr, "pokerbull.PokerBullStartTx", params, &res) ctx := jsonrpc.NewRPCCtx(rpcLaddr, "Chain33.CreateTransaction", params, &res)
ctx.RunWithoutMarshal() ctx.RunWithoutMarshal()
} }
...@@ -91,17 +87,15 @@ func addPokerbullContinueFlags(cmd *cobra.Command) { ...@@ -91,17 +87,15 @@ func addPokerbullContinueFlags(cmd *cobra.Command) {
func pokerbullContinue(cmd *cobra.Command, args []string) { func pokerbullContinue(cmd *cobra.Command, args []string) {
rpcLaddr, _ := cmd.Flags().GetString("rpc_laddr") rpcLaddr, _ := cmd.Flags().GetString("rpc_laddr")
gameID, _ := cmd.Flags().GetString("gameID") gameID, _ := cmd.Flags().GetString("gameID")
fee, _ := cmd.Flags().GetFloat64("fee")
feeInt64 := int64(fee * 1e4)
params := &pkt.PBContinueTxReq{ params := &rpctypes.CreateTxIn{
GameId: gameID, Execer: types.ExecName(pkt.PokerBullX),
Fee: feeInt64, ActionName: pkt.CreateContinueTx,
Payload: []byte(fmt.Sprintf("{\"gameId\":\"%s\"}", gameID)),
} }
var res string var res string
ctx := jsonrpc.NewRPCCtx(rpcLaddr, "pokerbull.PokerBullContinueTx", params, &res) ctx := jsonrpc.NewRPCCtx(rpcLaddr, "Chain33.CreateTransaction", params, &res)
ctx.RunWithoutMarshal() ctx.RunWithoutMarshal()
} }
...@@ -124,17 +118,15 @@ func addPokerbullQuitFlags(cmd *cobra.Command) { ...@@ -124,17 +118,15 @@ func addPokerbullQuitFlags(cmd *cobra.Command) {
func pokerbullQuit(cmd *cobra.Command, args []string) { func pokerbullQuit(cmd *cobra.Command, args []string) {
rpcLaddr, _ := cmd.Flags().GetString("rpc_laddr") rpcLaddr, _ := cmd.Flags().GetString("rpc_laddr")
gameID, _ := cmd.Flags().GetString("gameID") gameID, _ := cmd.Flags().GetString("gameID")
fee, _ := cmd.Flags().GetFloat64("fee")
feeInt64 := int64(fee * 1e4)
params := &pkt.PBContinueTxReq{ params := &rpctypes.CreateTxIn{
GameId: gameID, Execer: types.ExecName(pkt.PokerBullX),
Fee: feeInt64, ActionName: pkt.CreatequitTx,
Payload: []byte(fmt.Sprintf("{\"gameId\":\"%s\"}", gameID)),
} }
var res string var res string
ctx := jsonrpc.NewRPCCtx(rpcLaddr, "pokerbull.PokerBullQuitTx", params, &res) ctx := jsonrpc.NewRPCCtx(rpcLaddr, "Chain33.CreateTransaction", params, &res)
ctx.RunWithoutMarshal() ctx.RunWithoutMarshal()
} }
...@@ -155,6 +147,7 @@ func addPokerbullQueryFlags(cmd *cobra.Command) { ...@@ -155,6 +147,7 @@ func addPokerbullQueryFlags(cmd *cobra.Command) {
cmd.Flags().StringP("index", "i", "", "index") cmd.Flags().StringP("index", "i", "", "index")
cmd.Flags().StringP("status", "s", "", "status") cmd.Flags().StringP("status", "s", "", "status")
cmd.Flags().StringP("gameIDs", "d", "", "gameIDs") cmd.Flags().StringP("gameIDs", "d", "", "gameIDs")
cmd.Flags().StringP("round", "r", "", "round")
} }
func pokerbullQuery(cmd *cobra.Command, args []string) { func pokerbullQuery(cmd *cobra.Command, args []string) {
...@@ -166,6 +159,7 @@ func pokerbullQuery(cmd *cobra.Command, args []string) { ...@@ -166,6 +159,7 @@ func pokerbullQuery(cmd *cobra.Command, args []string) {
indexstr, _ := cmd.Flags().GetString("index") indexstr, _ := cmd.Flags().GetString("index")
index, _ := strconv.ParseInt(indexstr, 10, 64) index, _ := strconv.ParseInt(indexstr, 10, 64)
gameIDs, _ := cmd.Flags().GetString("gameIDs") gameIDs, _ := cmd.Flags().GetString("gameIDs")
round, _ := cmd.Flags().GetString("round")
var params rpctypes.Query4Jrpc var params rpctypes.Query4Jrpc
params.Execer = pkt.PokerBullX params.Execer = pkt.PokerBullX
...@@ -177,10 +171,27 @@ func pokerbullQuery(cmd *cobra.Command, args []string) { ...@@ -177,10 +171,27 @@ func pokerbullQuery(cmd *cobra.Command, args []string) {
} }
params.Payload = types.MustPBToJSON(req) params.Payload = types.MustPBToJSON(req)
if gameID != "" { if gameID != "" {
params.FuncName = pkt.FuncNameQueryGameByID if round == "" {
var res pkt.ReplyPBGame params.FuncName = pkt.FuncNameQueryGameByID
ctx := jsonrpc.NewRPCCtx(rpcLaddr, "Chain33.Query", params, &res) var res pkt.ReplyPBGame
ctx.Run() ctx := jsonrpc.NewRPCCtx(rpcLaddr, "Chain33.Query", params, &res)
ctx.Run()
} else {
params.FuncName = pkt.FuncNameQueryGameByRound
roundInt, err := strconv.ParseInt(round, 10, 32)
if err != nil {
fmt.Println(err)
return
}
req := &pkt.QueryPBGameByRound{
GameId: gameID,
Round: int32(roundInt),
}
params.Payload = types.MustPBToJSON(req)
var res pkt.ReplyPBGameByRound
ctx := jsonrpc.NewRPCCtx(rpcLaddr, "Chain33.Query", params, &res)
ctx.Run()
}
} else if address != "" { } else if address != "" {
params.FuncName = pkt.FuncNameQueryGameByAddr params.FuncName = pkt.FuncNameQueryGameByAddr
var res pkt.PBGameRecords var res pkt.PBGameRecords
......
...@@ -70,7 +70,7 @@ func calcPBGameStatusKey(status int32, index int64) []byte { ...@@ -70,7 +70,7 @@ func calcPBGameStatusKey(status int32, index int64) []byte {
} }
func calcPBGameStatusAndPlayerKey(status, player int32, value, index int64) []byte { func calcPBGameStatusAndPlayerKey(status, player int32, value, index int64) []byte {
key := fmt.Sprintf("LODB-pokerbull-status:%d:%d:%d:%018d", status, player, value, index) key := fmt.Sprintf("LODB-pokerbull-status:%d:%d:%015d:%018d", status, player, value, index)
return []byte(key) return []byte(key)
} }
...@@ -79,7 +79,7 @@ func calcPBGameStatusAndPlayerPrefix(status, player int32, value int64) []byte { ...@@ -79,7 +79,7 @@ func calcPBGameStatusAndPlayerPrefix(status, player int32, value int64) []byte {
if value == 0 { if value == 0 {
key = fmt.Sprintf("LODB-pokerbull-status:%d:%d:", status, player) key = fmt.Sprintf("LODB-pokerbull-status:%d:%d:", status, player)
} else { } else {
key = fmt.Sprintf("LODB-pokerbull-status:%d:%d:%d", status, player, value) key = fmt.Sprintf("LODB-pokerbull-status:%d:%d:%015d", status, player, value)
} }
return []byte(key) return []byte(key)
......
...@@ -18,19 +18,6 @@ import ( ...@@ -18,19 +18,6 @@ import (
pkt "github.com/33cn/plugin/plugin/dapp/pokerbull/types" pkt "github.com/33cn/plugin/plugin/dapp/pokerbull/types"
) )
const (
// ListDESC 降序
ListDESC = int32(0)
// DefaultCount 默认一次取多少条记录
DefaultCount = int32(20)
// MaxPlayerNum 最大玩家数
MaxPlayerNum = 5
// MinPlayValue 最小赌注
MinPlayValue = 10 * types.Coin
// DefaultStyle 默认游戏类型
DefaultStyle = pkt.PlayStyleDefault
)
// Action 斗牛action结构 // Action 斗牛action结构
type Action struct { type Action struct {
coinsAccount *account.DB coinsAccount *account.DB
...@@ -57,7 +44,7 @@ func NewAction(pb *PokerBull, tx *types.Transaction, index int) *Action { ...@@ -57,7 +44,7 @@ func NewAction(pb *PokerBull, tx *types.Transaction, index int) *Action {
func (action *Action) CheckExecAccountBalance(fromAddr string, ToFrozen, ToActive int64) bool { func (action *Action) CheckExecAccountBalance(fromAddr string, ToFrozen, ToActive int64) bool {
// 赌注为零,按照最小赌注冻结 // 赌注为零,按照最小赌注冻结
if ToFrozen == 0 { if ToFrozen == 0 {
ToFrozen = MinPlayValue ToFrozen = pkt.MinPlayValue
} }
acc := action.coinsAccount.LoadExecAccount(fromAddr, action.execaddr) acc := action.coinsAccount.LoadExecAccount(fromAddr, action.execaddr)
...@@ -69,7 +56,7 @@ func (action *Action) CheckExecAccountBalance(fromAddr string, ToFrozen, ToActiv ...@@ -69,7 +56,7 @@ func (action *Action) CheckExecAccountBalance(fromAddr string, ToFrozen, ToActiv
// Key 获取key值 // Key 获取key值
func Key(id string) (key []byte) { func Key(id string) (key []byte) {
key = append(key, []byte("mavl-"+types.ExecName(pkt.PokerBullX)+"-")...) key = append(key, []byte("mavl-"+pkt.PokerBullX+"-")...)
key = append(key, []byte(id)...) key = append(key, []byte(id)...)
return key return key
} }
...@@ -77,14 +64,14 @@ func Key(id string) (key []byte) { ...@@ -77,14 +64,14 @@ func Key(id string) (key []byte) {
func readGame(db dbm.KV, id string) (*pkt.PokerBull, error) { func readGame(db dbm.KV, id string) (*pkt.PokerBull, error) {
data, err := db.Get(Key(id)) data, err := db.Get(Key(id))
if err != nil { if err != nil {
logger.Error("query data have err:", err.Error()) logger.Error("query data have err:", "err", err)
return nil, err return nil, err
} }
var game pkt.PokerBull var game pkt.PokerBull
//decode //decode
err = types.Decode(data, &game) err = types.Decode(data, &game)
if err != nil { if err != nil {
logger.Error("decode game have err:", err.Error()) logger.Error("decode game have err:", "err", err)
return nil, err return nil, err
} }
return &game, nil return &game, nil
...@@ -108,14 +95,13 @@ func getGameListByAddr(db dbm.Lister, addr string, index int64) (types.Message, ...@@ -108,14 +95,13 @@ func getGameListByAddr(db dbm.Lister, addr string, index int64) (types.Message,
var values [][]byte var values [][]byte
var err error var err error
if index == 0 { if index == 0 {
values, err = db.List(calcPBGameAddrPrefix(addr), nil, DefaultCount, ListDESC) values, err = db.List(calcPBGameAddrPrefix(addr), nil, pkt.DefaultCount, pkt.ListDESC)
} else { } else {
values, err = db.List(calcPBGameAddrPrefix(addr), calcPBGameAddrKey(addr, index), DefaultCount, ListDESC) values, err = db.List(calcPBGameAddrPrefix(addr), calcPBGameAddrKey(addr, index), pkt.DefaultCount, pkt.ListDESC)
} }
if err != nil { if err != nil {
return nil, err return nil, err
} }
var gameIds []*pkt.PBGameRecord var gameIds []*pkt.PBGameRecord
for _, value := range values { for _, value := range values {
var record pkt.PBGameRecord var record pkt.PBGameRecord
...@@ -125,7 +111,9 @@ func getGameListByAddr(db dbm.Lister, addr string, index int64) (types.Message, ...@@ -125,7 +111,9 @@ func getGameListByAddr(db dbm.Lister, addr string, index int64) (types.Message,
} }
gameIds = append(gameIds, &record) gameIds = append(gameIds, &record)
} }
if len(gameIds) == 0 {
return nil, types.ErrNotFound
}
return &pkt.PBGameRecords{Records: gameIds}, nil return &pkt.PBGameRecords{Records: gameIds}, nil
} }
...@@ -133,17 +121,17 @@ func getGameListByStatus(db dbm.Lister, status int32, index int64) (types.Messag ...@@ -133,17 +121,17 @@ func getGameListByStatus(db dbm.Lister, status int32, index int64) (types.Messag
var values [][]byte var values [][]byte
var err error var err error
if index == 0 { if index == 0 {
values, err = db.List(calcPBGameStatusPrefix(status), nil, DefaultCount, ListDESC) values, err = db.List(calcPBGameStatusPrefix(status), nil, pkt.DefaultCount, pkt.ListDESC)
} else { } else {
values, err = db.List(calcPBGameStatusPrefix(status), calcPBGameStatusKey(status, index), DefaultCount, ListDESC) values, err = db.List(calcPBGameStatusPrefix(status), calcPBGameStatusKey(status, index), pkt.DefaultCount, pkt.ListDESC)
} }
if err != nil { if err != nil {
return nil, err return nil, err
} }
var gameIds []*pkt.PBGameRecord var gameIds []*pkt.PBGameIndexRecord
for _, value := range values { for _, value := range values {
var record pkt.PBGameRecord var record pkt.PBGameIndexRecord
err := types.Decode(value, &record) err := types.Decode(value, &record)
if err != nil { if err != nil {
continue continue
...@@ -151,11 +139,11 @@ func getGameListByStatus(db dbm.Lister, status int32, index int64) (types.Messag ...@@ -151,11 +139,11 @@ func getGameListByStatus(db dbm.Lister, status int32, index int64) (types.Messag
gameIds = append(gameIds, &record) gameIds = append(gameIds, &record)
} }
return &pkt.PBGameRecords{Records: gameIds}, nil return &pkt.PBGameIndexRecords{Records: gameIds}, nil
} }
func queryGameListByStatusAndPlayer(db dbm.Lister, stat int32, player int32, value int64) ([]string, error) { func queryGameListByStatusAndPlayer(db dbm.Lister, stat int32, player int32, value int64) ([]string, error) {
values, err := db.List(calcPBGameStatusAndPlayerPrefix(stat, player, value), nil, DefaultCount, ListDESC) values, err := db.List(calcPBGameStatusAndPlayerPrefix(stat, player, value), nil, pkt.DefaultCount, pkt.ListDESC)
if err != nil { if err != nil {
return nil, err return nil, err
} }
...@@ -210,6 +198,7 @@ func (action *Action) GetReceiptLog(game *pkt.PokerBull) *types.ReceiptLog { ...@@ -210,6 +198,7 @@ func (action *Action) GetReceiptLog(game *pkt.PokerBull) *types.ReceiptLog {
} }
} }
r.PreStatus = game.PreStatus r.PreStatus = game.PreStatus
r.Round = game.Round
log.Log = types.Encode(r) log.Log = types.Encode(r)
return log return log
} }
...@@ -411,11 +400,38 @@ func (action *Action) settleDefaultAccount(lastAddress string, game *pkt.PokerBu ...@@ -411,11 +400,38 @@ func (action *Action) settleDefaultAccount(lastAddress string, game *pkt.PokerBu
} }
} }
// 扣除开发者佣金
receipt := action.defaultFeeTransfer(result.Winner, pkt.DeveloperAddress, pkt.DeveloperFee, game.GetValue())
if receipt != nil {
logs = append(logs, receipt.Logs...)
kv = append(kv, receipt.KV...)
}
// 扣除平台佣金
receipt = action.defaultFeeTransfer(result.Winner, pkt.PlatformAddress, pkt.PlatformFee, game.GetValue())
if receipt != nil {
logs = append(logs, receipt.Logs...)
kv = append(kv, receipt.KV...)
}
return logs, kv, nil return logs, kv, nil
} }
// 佣金扣除
func (action *Action) defaultFeeTransfer(winner string, feeAddr string, fee int64, value int64) *types.Receipt {
receipt, err := action.coinsAccount.ExecTransfer(winner, feeAddr, action.execaddr, (value/types.Coin)*fee /**int64(result.Leverage)*/) //TODO Dealer:暂时不支持倍数
if err != nil {
action.coinsAccount.ExecFrozen(winner, action.execaddr, (value/types.Coin)*fee) // rollback
logger.Error("GameSettleDefault.ExecTransfer", "addr", winner, "execaddr", action.execaddr, "amount",
(value/types.Coin)*fee /**int64(result.Leverage)*/, "err", err) //TODO Dealer:暂时不支持倍数
return nil
}
return receipt
}
func (action *Action) settleAccount(lastAddress string, game *pkt.PokerBull) ([]*types.ReceiptLog, []*types.KeyValue, error) { func (action *Action) settleAccount(lastAddress string, game *pkt.PokerBull) ([]*types.ReceiptLog, []*types.KeyValue, error) {
if DefaultStyle == pkt.PlayStyleDealer { if pkt.DefaultStyle == pkt.PlayStyleDealer {
return action.settleDealerAccount(lastAddress, game) return action.settleDealerAccount(lastAddress, game)
} }
return action.settleDefaultAccount(lastAddress, game) return action.settleDefaultAccount(lastAddress, game)
...@@ -453,11 +469,11 @@ func (action *Action) newGame(gameID string, start *pkt.PBGameStart) (*pkt.Poker ...@@ -453,11 +469,11 @@ func (action *Action) newGame(gameID string, start *pkt.PBGameStart) (*pkt.Poker
// 不指定赌注,默认按照最低赌注 // 不指定赌注,默认按照最低赌注
if start.GetValue() == 0 { if start.GetValue() == 0 {
start.Value = MinPlayValue start.Value = pkt.MinPlayValue
} }
//TODO 庄家检查闲家数量倍数的资金 //TODO 庄家检查闲家数量倍数的资金
if DefaultStyle == pkt.PlayStyleDealer { if pkt.DefaultStyle == pkt.PlayStyleDealer {
if !action.CheckExecAccountBalance(action.fromaddr, start.GetValue()*PokerbullLeverageMax*int64(start.PlayerNum-1), 0) { if !action.CheckExecAccountBalance(action.fromaddr, start.GetValue()*PokerbullLeverageMax*int64(start.PlayerNum-1), 0) {
logger.Error("GameStart", "addr", action.fromaddr, "execaddr", action.execaddr, "id", logger.Error("GameStart", "addr", action.fromaddr, "execaddr", action.execaddr, "id",
gameID, "err", types.ErrNoBalance) gameID, "err", types.ErrNoBalance)
...@@ -477,9 +493,11 @@ func (action *Action) newGame(gameID string, start *pkt.PBGameStart) (*pkt.Poker ...@@ -477,9 +493,11 @@ func (action *Action) newGame(gameID string, start *pkt.PBGameStart) (*pkt.Poker
DealerAddr: action.fromaddr, DealerAddr: action.fromaddr,
IsWaiting: true, IsWaiting: true,
PreStatus: 0, PreStatus: 0,
Round: 1,
} }
Shuffle(game.Poker, action.blocktime) //洗牌 Shuffle(game.Poker, action.blocktime) //洗牌
logger.Debug(fmt.Sprintf("Start a new game %s for player %s", game.GameId, action.fromaddr))
return game, nil return game, nil
} }
...@@ -500,7 +518,7 @@ func (action *Action) selectGameFromIds(ids []string, value int64) *pkt.PokerBul ...@@ -500,7 +518,7 @@ func (action *Action) selectGameFromIds(ids []string, value int64) *pkt.PokerBul
} }
//选择合适赌注的游戏 //选择合适赌注的游戏
if value == 0 && game.GetValue() != MinPlayValue { if value == 0 && game.GetValue() != pkt.MinPlayValue {
if !action.CheckExecAccountBalance(action.fromaddr, game.GetValue(), 0) { if !action.CheckExecAccountBalance(action.fromaddr, game.GetValue(), 0) {
logger.Error("GameStart", "addr", action.fromaddr, "execaddr", action.execaddr, "id", id, "err", types.ErrNoBalance) logger.Error("GameStart", "addr", action.fromaddr, "execaddr", action.execaddr, "id", id, "err", types.ErrNoBalance)
continue continue
...@@ -513,32 +531,33 @@ func (action *Action) selectGameFromIds(ids []string, value int64) *pkt.PokerBul ...@@ -513,32 +531,33 @@ func (action *Action) selectGameFromIds(ids []string, value int64) *pkt.PokerBul
return gameRet return gameRet
} }
func (action *Action) checkPlayerExistInGame() bool { //func (action *Action) checkPlayerExistInGame() bool {
values, err := action.localDB.List(calcPBGameAddrPrefix(action.fromaddr), nil, DefaultCount, ListDESC) // values, err := action.localDB.List(calcPBGameAddrPrefix(action.fromaddr), nil, pkt.DefaultCount, pkt.ListDESC)
if err == types.ErrNotFound { // if err == types.ErrNotFound {
return false // return false
} // }
//
var value pkt.PBGameRecord // var value pkt.PBGameRecord
length := len(values) // length := len(values)
if length != 0 { // if length != 0 {
valueBytes := values[length-1] // valueBytes := values[length-1]
err := types.Decode(valueBytes, &value) // err := types.Decode(valueBytes, &value)
if err == nil && value.Status == pkt.PBGameActionQuit { // if err == nil && value.Status == pkt.PBGameActionQuit {
return false // return false
} // }
} // }
return true // return true
} //}
// GameStart 游戏开始 // GameStart 游戏开始
func (action *Action) GameStart(start *pkt.PBGameStart) (*types.Receipt, error) { func (action *Action) GameStart(start *pkt.PBGameStart) (*types.Receipt, error) {
var logs []*types.ReceiptLog var logs []*types.ReceiptLog
var kv []*types.KeyValue var kv []*types.KeyValue
if start.PlayerNum > MaxPlayerNum { logger.Debug(fmt.Sprintf("Pokerbull game start for %s", action.fromaddr))
if start.PlayerNum > pkt.MaxPlayerNum {
logger.Error("GameStart", "addr", action.fromaddr, "execaddr", action.execaddr, logger.Error("GameStart", "addr", action.fromaddr, "execaddr", action.execaddr,
"err", fmt.Sprintf("The maximum player number is %d", MaxPlayerNum)) "err", fmt.Sprintf("The maximum player number is %d", pkt.MaxPlayerNum))
return nil, types.ErrInvalidParam return nil, types.ErrInvalidParam
} }
...@@ -548,10 +567,11 @@ func (action *Action) GameStart(start *pkt.PBGameStart) (*types.Receipt, error) ...@@ -548,10 +567,11 @@ func (action *Action) GameStart(start *pkt.PBGameStart) (*types.Receipt, error)
return nil, 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") //if action.checkPlayerExistInGame() {
return nil, fmt.Errorf("Address is already in a game") // 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 var game *pkt.PokerBull
ids, err := queryGameListByStatusAndPlayer(action.localDB, pkt.PBGameActionStart, start.PlayerNum, start.Value) ids, err := queryGameListByStatusAndPlayer(action.localDB, pkt.PBGameActionStart, start.PlayerNum, start.Value)
...@@ -573,6 +593,7 @@ func (action *Action) GameStart(start *pkt.PBGameStart) (*types.Receipt, error) ...@@ -573,6 +593,7 @@ func (action *Action) GameStart(start *pkt.PBGameStart) (*types.Receipt, error)
return nil, err return nil, err
} }
} }
logger.Debug(fmt.Sprintf("Match a new game %s for player %s", game.GameId, game.GameId))
} }
//发牌随机数取txhash //发牌随机数取txhash
...@@ -590,6 +611,7 @@ func (action *Action) GameStart(start *pkt.PBGameStart) (*types.Receipt, error) ...@@ -590,6 +611,7 @@ func (action *Action) GameStart(start *pkt.PBGameStart) (*types.Receipt, error)
// 如果人数达标,则发牌计算斗牛结果 // 如果人数达标,则发牌计算斗牛结果
if len(game.Players) == int(game.PlayerNum) { if len(game.Players) == int(game.PlayerNum) {
logger.Debug(fmt.Sprintf("Game start: %s", game.GameId))
logsH, kvH, err := action.settleAccount(action.fromaddr, game) logsH, kvH, err := action.settleAccount(action.fromaddr, game)
if err != nil { if err != nil {
return nil, err return nil, err
...@@ -603,6 +625,7 @@ func (action *Action) GameStart(start *pkt.PBGameStart) (*types.Receipt, error) ...@@ -603,6 +625,7 @@ func (action *Action) GameStart(start *pkt.PBGameStart) (*types.Receipt, error)
game.PreStatus = pkt.PBGameActionStart game.PreStatus = pkt.PBGameActionStart
game.IsWaiting = false game.IsWaiting = false
} else { } else {
logger.Debug(fmt.Sprintf("Game waiting: %s", game.GameId))
receipt, err := action.coinsAccount.ExecFrozen(action.fromaddr, action.execaddr, start.GetValue()*PokerbullLeverageMax) //冻结子账户资金, 最后一位玩家不需要冻结 receipt, err := action.coinsAccount.ExecFrozen(action.fromaddr, action.execaddr, start.GetValue()*PokerbullLeverageMax) //冻结子账户资金, 最后一位玩家不需要冻结
if err != nil { if err != nil {
logger.Error("GameCreate.ExecFrozen", "addr", action.fromaddr, "execaddr", action.execaddr, "amount", start.GetValue(), "err", err.Error()) logger.Error("GameCreate.ExecFrozen", "addr", action.fromaddr, "execaddr", action.execaddr, "amount", start.GetValue(), "err", err.Error())
...@@ -644,16 +667,17 @@ func (action *Action) GameContinue(pbcontinue *pkt.PBGameContinue) (*types.Recei ...@@ -644,16 +667,17 @@ func (action *Action) GameContinue(pbcontinue *pkt.PBGameContinue) (*types.Recei
game, err := action.readGame(pbcontinue.GetGameId()) game, err := action.readGame(pbcontinue.GetGameId())
if err != nil { if err != nil {
logger.Error("GameContinue", "addr", action.fromaddr, "execaddr", action.execaddr, "get game failed", logger.Error("GameContinue", "addr", action.fromaddr, "execaddr", action.execaddr, "get game failed, gameID",
pbcontinue.GetGameId(), "err", err) pbcontinue.GetGameId(), "err", err)
return nil, err return nil, err
} }
if game.Status != pkt.PBGameActionContinue { if game.Status != pkt.PBGameActionContinue {
logger.Error("GameContinue", "addr", action.fromaddr, "execaddr", action.execaddr, "Status error", logger.Error("GameContinue", "addr", action.fromaddr, "execaddr", action.execaddr, "Status error, gameID",
pbcontinue.GetGameId()) pbcontinue.GetGameId())
return nil, err return nil, err
} }
logger.Debug(fmt.Sprintf("Pokerbull game %s continue for %s", game.GameId, action.fromaddr))
// 检查余额,庄家检查闲家数量倍数的资金 // 检查余额,庄家检查闲家数量倍数的资金
checkValue := game.GetValue() * PokerbullLeverageMax checkValue := game.GetValue() * PokerbullLeverageMax
...@@ -688,6 +712,7 @@ func (action *Action) GameContinue(pbcontinue *pkt.PBGameContinue) (*types.Recei ...@@ -688,6 +712,7 @@ func (action *Action) GameContinue(pbcontinue *pkt.PBGameContinue) (*types.Recei
pbplayer.Ready = true pbplayer.Ready = true
if getReadyPlayerNum(game.Players) == int(game.PlayerNum) { if getReadyPlayerNum(game.Players) == int(game.PlayerNum) {
logger.Debug(fmt.Sprintf("Game start: %s", game.GameId))
logsH, kvH, err := action.settleAccount(action.fromaddr, game) logsH, kvH, err := action.settleAccount(action.fromaddr, game)
if err != nil { if err != nil {
return nil, err return nil, err
...@@ -699,6 +724,11 @@ func (action *Action) GameContinue(pbcontinue *pkt.PBGameContinue) (*types.Recei ...@@ -699,6 +724,11 @@ func (action *Action) GameContinue(pbcontinue *pkt.PBGameContinue) (*types.Recei
game.IsWaiting = false game.IsWaiting = false
game.PreStatus = pkt.PBGameActionContinue game.PreStatus = pkt.PBGameActionContinue
} else { } else {
logger.Debug(fmt.Sprintf("Game waiting: %s", game.GameId))
// 回合数加一次
if !game.IsWaiting {
game.Round++
}
receipt, err := action.coinsAccount.ExecFrozen(action.fromaddr, action.execaddr, game.GetValue()*PokerbullLeverageMax) //冻结子账户资金,最后一位玩家不需要冻结 receipt, err := action.coinsAccount.ExecFrozen(action.fromaddr, action.execaddr, game.GetValue()*PokerbullLeverageMax) //冻结子账户资金,最后一位玩家不需要冻结
if err != nil { if err != nil {
logger.Error("GameCreate.ExecFrozen", "addr", action.fromaddr, "execaddr", action.execaddr, "amount", game.GetValue(), "err", err.Error()) logger.Error("GameCreate.ExecFrozen", "addr", action.fromaddr, "execaddr", action.execaddr, "amount", game.GetValue(), "err", err.Error())
......
...@@ -29,7 +29,6 @@ func (g *PokerBull) Query_QueryGameByAddr(in *pkt.QueryPBGameInfo) (types.Messag ...@@ -29,7 +29,6 @@ func (g *PokerBull) Query_QueryGameByAddr(in *pkt.QueryPBGameInfo) (types.Messag
if err != nil { if err != nil {
return nil, err return nil, err
} }
return gameIds, nil return gameIds, nil
} }
...@@ -42,3 +41,49 @@ func (g *PokerBull) Query_QueryGameByStatus(in *pkt.QueryPBGameInfo) (types.Mess ...@@ -42,3 +41,49 @@ func (g *PokerBull) Query_QueryGameByStatus(in *pkt.QueryPBGameInfo) (types.Mess
return gameIds, nil return gameIds, nil
} }
// Query_QueryGameByRound 查询某一回合游戏结果
func (g *PokerBull) Query_QueryGameByRound(in *pkt.QueryPBGameByRound) (types.Message, error) {
game, err := readGame(g.GetStateDB(), in.GetGameId())
if err != nil {
return nil, err
}
if in.Round > game.Round {
return nil, types.ErrInvalidParam
}
var roundPlayers []*pkt.PBPlayer
for _, player := range game.Players {
var isReady bool
if in.Round == game.Round {
isReady = player.Ready
} else {
isReady = false
}
roundPlayer := &pkt.PBPlayer{
Address: player.Address,
Ready: isReady,
}
roundPlayers = append(roundPlayers, roundPlayer)
}
var result *pkt.PBResult
if len(game.Results) < int(in.Round) {
result = nil
} else {
result = game.Results[in.Round-1]
}
gameInfo := &pkt.ReplyPBGameByRound{
GameId: game.GameId,
Status: game.Status,
Result: result,
IsWaiting: game.IsWaiting,
Value: game.Value,
Players: roundPlayers,
Return: (game.Value / types.Coin) * pkt.WinnerReturn,
}
return gameInfo, nil
}
...@@ -8,7 +8,6 @@ import ( ...@@ -8,7 +8,6 @@ import (
"github.com/33cn/chain33/pluginmgr" "github.com/33cn/chain33/pluginmgr"
"github.com/33cn/plugin/plugin/dapp/pokerbull/commands" "github.com/33cn/plugin/plugin/dapp/pokerbull/commands"
"github.com/33cn/plugin/plugin/dapp/pokerbull/executor" "github.com/33cn/plugin/plugin/dapp/pokerbull/executor"
"github.com/33cn/plugin/plugin/dapp/pokerbull/rpc"
"github.com/33cn/plugin/plugin/dapp/pokerbull/types" "github.com/33cn/plugin/plugin/dapp/pokerbull/types"
) )
...@@ -18,6 +17,5 @@ func init() { ...@@ -18,6 +17,5 @@ func init() {
ExecName: executor.GetName(), ExecName: executor.GetName(),
Exec: executor.Init, Exec: executor.Init,
Cmd: commands.PokerBullCmd, Cmd: commands.PokerBullCmd,
RPC: rpc.Init,
}) })
} }
syntax = "proto3"; syntax = "proto3";
import "transaction.proto";
package types; package types;
//斗牛游戏内容 //斗牛游戏内容
message PokerBull { message PokerBull {
string gameId = 1; //默认是由创建这局游戏的txHash作为gameId string gameId = 1; //默认是由创建这局游戏的txHash作为gameId
int32 status = 2; // Start 1 -> Continue 2 -> Quit 3 int32 status = 2; // Start 1 -> Continue 2 -> Quit 3
int64 startTime = 3; //开始时间 int64 startTime = 3; //开始时间
string startTxHash = 4; //游戏启动交易hash string startTxHash = 4; //游戏启动交易hash
int64 value = 5; //赌注 int64 value = 5; //赌注
PBPoker poker = 6; //扑克牌 PBPoker poker = 6; //扑克牌
repeated PBPlayer players = 7; //玩家历史牌和结果集 repeated PBPlayer players = 7; //玩家历史牌和结果集
int32 playerNum = 8; //玩家数 int32 playerNum = 8; //玩家数
repeated PBResult results = 9; //游戏结果集 repeated PBResult results = 9; //游戏结果集
int64 index = 10; //索引 int64 index = 10; //索引
int64 prevIndex = 11; //上级索引 int64 prevIndex = 11; //上级索引
int64 quitTime = 12; //游戏结束时间 int64 quitTime = 12; //游戏结束时间
string quitTxHash = 13; //游戏结束交易hash string quitTxHash = 13; //游戏结束交易hash
string dealerAddr = 14; //下局庄家地址 string dealerAddr = 14; //下局庄家地址
bool isWaiting = 15; //游戏是否处于等待状态 bool isWaiting = 15; //游戏是否处于等待状态
int32 preStatus = 16; //上一index的状态 int32 preStatus = 16; //上一index的状态
int32 round = 17; //当前游戏回合数
} }
//一把牌 //一把牌
...@@ -111,6 +110,10 @@ message PBGameRecords { ...@@ -111,6 +110,10 @@ message PBGameRecords {
repeated PBGameRecord records = 1; repeated PBGameRecord records = 1;
} }
message PBGameIndexRecords {
repeated PBGameIndexRecord records = 1;
}
message QueryPBGameInfo { message QueryPBGameInfo {
string gameId = 1; string gameId = 1;
string addr = 2; string addr = 2;
...@@ -130,6 +133,23 @@ message ReplyPBGameList { ...@@ -130,6 +133,23 @@ message ReplyPBGameList {
repeated PokerBull games = 1; repeated PokerBull games = 1;
} }
// QueryPBGameByRound 根据gameId和回合数查询某回合的游戏结果
message QueryPBGameByRound {
string gameId = 1;
int32 round = 2;
}
// ReplyPBGameByRound 某一回合游戏结果
message ReplyPBGameByRound {
string gameId = 1;
int32 status = 2;
PBResult result = 3;
bool isWaiting = 4;
int64 value = 5;
repeated PBPlayer players = 6;
int64 return = 7;
}
message ReceiptPBGame { message ReceiptPBGame {
string gameId = 1; string gameId = 1;
int32 status = 2; int32 status = 2;
...@@ -140,7 +160,8 @@ message ReceiptPBGame { ...@@ -140,7 +160,8 @@ message ReceiptPBGame {
int64 value = 7; int64 value = 7;
bool isWaiting = 8; bool isWaiting = 8;
repeated string players = 9; repeated string players = 9;
int32 preStatus = 10; int32 preStatus = 10;
int32 round = 11;
} }
message PBStartTxReq { message PBStartTxReq {
...@@ -164,12 +185,3 @@ message PBQueryReq { ...@@ -164,12 +185,3 @@ message PBQueryReq {
int64 fee = 2; int64 fee = 2;
} }
// pokerbull 对外提供服务的接口
service pokerbull {
//游戏开始
rpc Start(PBGameStart) returns (UnsignTx) {}
//游戏继续
rpc Continue(PBGameContinue) returns (UnsignTx) {}
//游戏结束
rpc Quit(PBGameQuit) returns (UnsignTx) {}
}
// 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/pokerbull/types"
)
// PokerBullStartTx 创建游戏开始交易
func (c *Jrpc) PokerBullStartTx(parm *pb.PBStartTxReq, result *interface{}) error {
if parm == nil {
return types.ErrInvalidParam
}
head := &pb.PBGameStart{
Value: parm.Value,
PlayerNum: parm.PlayerNum,
}
reply, err := c.cli.Start(context.Background(), head)
if err != nil {
return err
}
*result = hex.EncodeToString(reply.Data)
return nil
}
// PokerBullContinueTx 创建游戏继续交易
func (c *Jrpc) PokerBullContinueTx(parm *pb.PBContinueTxReq, result *interface{}) error {
if parm == nil {
return types.ErrInvalidParam
}
head := &pb.PBGameContinue{
GameId: parm.GameId,
}
reply, err := c.cli.Continue(context.Background(), head)
if err != nil {
return err
}
*result = hex.EncodeToString(reply.Data)
return nil
}
// PokerBullQuitTx 创建游戏推出交易
func (c *Jrpc) PokerBullQuitTx(parm *pb.PBQuitTxReq, result *interface{}) error {
if parm == nil {
return types.ErrInvalidParam
}
head := &pb.PBGameQuit{
GameId: parm.GameId,
}
reply, err := c.cli.Quit(context.Background(), head)
if err != nil {
return err
}
*result = hex.EncodeToString(reply.Data)
return nil
}
// PokerBullQueryTx 创建游戏查询交易
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
}
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
package rpc_test package rpc_test
import ( import (
"strings" "fmt"
"testing" "testing"
commonlog "github.com/33cn/chain33/common/log" commonlog "github.com/33cn/chain33/common/log"
...@@ -41,45 +41,75 @@ func TestJRPCChannel(t *testing.T) { ...@@ -41,45 +41,75 @@ func TestJRPCChannel(t *testing.T) {
{fn: testStartRawTxCmd}, {fn: testStartRawTxCmd},
{fn: testContinueRawTxCmd}, {fn: testContinueRawTxCmd},
{fn: testQuitRawTxCmd}, {fn: testQuitRawTxCmd},
}
for _, testCase := range testCases {
err := testCase.fn(t, jrpcClient)
assert.Nil(t, err)
}
testCases = []struct {
fn func(*testing.T, *jsonclient.JSONClient) error
}{
{fn: testQueryGameByID}, {fn: testQueryGameByID},
{fn: testQueryGameByAddr}, {fn: testQueryGameByAddr},
{fn: testQueryGameByStatus},
{fn: testQueryGameByRound},
} }
for index, testCase := range testCases { for index, testCase := range testCases {
err := testCase.fn(t, jrpcClient) err := testCase.fn(t, jrpcClient)
if err == nil { assert.Equal(t, err, types.ErrNotFound, fmt.Sprint(index))
continue }
}
assert.NotEqualf(t, err, types.ErrActionNotSupport, "test index %d", index) testCases = []struct {
if strings.Contains(err.Error(), "rpc: can't find") { fn func(*testing.T, *jsonclient.JSONClient) error
assert.FailNowf(t, err.Error(), "test index %d", index) }{
} {fn: testQueryGameByIDs},
}
for index, testCase := range testCases {
err := testCase.fn(t, jrpcClient)
assert.Equal(t, err, nil, fmt.Sprint(index))
} }
} }
func testStartRawTxCmd(t *testing.T, jrpc *jsonclient.JSONClient) error { func testStartRawTxCmd(t *testing.T, jrpc *jsonclient.JSONClient) error {
params := pty.PBStartTxReq{} payload := &pty.PBGameStart{Value: 123}
params := &rpctypes.CreateTxIn{
Execer: types.ExecName(pty.PokerBullX),
ActionName: pty.CreateStartTx,
Payload: types.MustPBToJSON(payload),
}
var res string var res string
return jrpc.Call("pokerbull.PokerBullStartTx", params, &res) return jrpc.Call("Chain33.CreateTransaction", params, &res)
} }
func testContinueRawTxCmd(t *testing.T, jrpc *jsonclient.JSONClient) error { func testContinueRawTxCmd(t *testing.T, jrpc *jsonclient.JSONClient) error {
params := pty.PBContinueTxReq{} payload := &pty.PBGameContinue{GameId: "123"}
params := &rpctypes.CreateTxIn{
Execer: types.ExecName(pty.PokerBullX),
ActionName: pty.CreateContinueTx,
Payload: types.MustPBToJSON(payload),
}
var res string var res string
return jrpc.Call("pokerbull.PokerBullContinueTx", params, &res) return jrpc.Call("Chain33.CreateTransaction", params, &res)
} }
func testQuitRawTxCmd(t *testing.T, jrpc *jsonclient.JSONClient) error { func testQuitRawTxCmd(t *testing.T, jrpc *jsonclient.JSONClient) error {
params := pty.PBContinueTxReq{} payload := &pty.PBGameQuit{GameId: "123"}
params := &rpctypes.CreateTxIn{
Execer: types.ExecName(pty.PokerBullX),
ActionName: pty.CreatequitTx,
Payload: types.MustPBToJSON(payload),
}
var res string var res string
return jrpc.Call("pokerbull.PokerBullQuitTx", params, &res) return jrpc.Call("Chain33.CreateTransaction", params, &res)
} }
func testQueryGameByID(t *testing.T, jrpc *jsonclient.JSONClient) error { func testQueryGameByID(t *testing.T, jrpc *jsonclient.JSONClient) error {
var rep interface{} var rep interface{}
var params rpctypes.Query4Jrpc var params rpctypes.Query4Jrpc
req := &pty.QueryPBGameInfo{} req := &pty.QueryPBGameInfo{}
params.Execer = "pokerbull" params.Execer = pty.PokerBullX
params.FuncName = "QueryGameByID" params.FuncName = pty.FuncNameQueryGameByID
params.Payload = types.MustPBToJSON(req) params.Payload = types.MustPBToJSON(req)
rep = &pty.ReplyPBGame{} rep = &pty.ReplyPBGame{}
return jrpc.Call("Chain33.Query", params, rep) return jrpc.Call("Chain33.Query", params, rep)
...@@ -89,8 +119,41 @@ func testQueryGameByAddr(t *testing.T, jrpc *jsonclient.JSONClient) error { ...@@ -89,8 +119,41 @@ func testQueryGameByAddr(t *testing.T, jrpc *jsonclient.JSONClient) error {
var rep interface{} var rep interface{}
var params rpctypes.Query4Jrpc var params rpctypes.Query4Jrpc
req := &pty.QueryPBGameInfo{} req := &pty.QueryPBGameInfo{}
params.Execer = "pokerbull" params.Execer = pty.PokerBullX
params.FuncName = "QueryGameByAddr" params.FuncName = pty.FuncNameQueryGameByAddr
params.Payload = types.MustPBToJSON(req)
rep = &pty.PBGameRecords{}
return jrpc.Call("Chain33.Query", params, rep)
}
func testQueryGameByIDs(t *testing.T, jrpc *jsonclient.JSONClient) error {
var rep interface{}
var params rpctypes.Query4Jrpc
req := &pty.QueryPBGameInfos{}
params.Execer = pty.PokerBullX
params.FuncName = pty.FuncNameQueryGameListByIDs
params.Payload = types.MustPBToJSON(req)
rep = &pty.ReplyPBGameList{}
return jrpc.Call("Chain33.Query", params, rep)
}
func testQueryGameByStatus(t *testing.T, jrpc *jsonclient.JSONClient) error {
var rep interface{}
var params rpctypes.Query4Jrpc
req := &pty.QueryPBGameInfo{}
params.Execer = pty.PokerBullX
params.FuncName = pty.FuncNameQueryGameByStatus
params.Payload = types.MustPBToJSON(req)
rep = &pty.PBGameRecords{}
return jrpc.Call("Chain33.Query", params, rep)
}
func testQueryGameByRound(t *testing.T, jrpc *jsonclient.JSONClient) error {
var rep interface{}
var params rpctypes.Query4Jrpc
req := &pty.QueryPBGameByRound{}
params.Execer = pty.PokerBullX
params.FuncName = pty.FuncNameQueryGameByRound
params.Payload = types.MustPBToJSON(req) params.Payload = types.MustPBToJSON(req)
rep = &pty.PBGameRecords{} rep = &pty.PBGameRecords{}
return jrpc.Call("Chain33.Query", params, rep) return jrpc.Call("Chain33.Query", params, rep)
......
// 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"
"github.com/33cn/chain33/types"
"github.com/33cn/plugin/plugin/dapp/pokerbull/executor"
pb "github.com/33cn/plugin/plugin/dapp/pokerbull/types"
"github.com/pkg/errors"
)
func (c *channelClient) Start(ctx context.Context, head *pb.PBGameStart) (*types.UnsignTx, error) {
if head.PlayerNum > executor.MaxPlayerNum {
return nil, errors.New("Player number should be maximum 5")
}
val := &pb.PBGameAction{
Ty: pb.PBGameActionStart,
Value: &pb.PBGameAction_Start{Start: 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
}
func (c *channelClient) Continue(ctx context.Context, head *pb.PBGameContinue) (*types.UnsignTx, error) {
val := &pb.PBGameAction{
Ty: pb.PBGameActionContinue,
Value: &pb.PBGameAction_Continue{Continue: 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
}
func (c *channelClient) Quit(ctx context.Context, head *pb.PBGameQuit) (*types.UnsignTx, error) {
val := &pb.PBGameAction{
Ty: pb.PBGameActionQuit,
Value: &pb.PBGameAction_Quit{Quit: 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
}
func (c *channelClient) Show(ctx context.Context, head *pb.PBGameQuery) (*types.UnsignTx, error) {
val := &pb.PBGameAction{
Ty: pb.PBGameActionQuery,
Value: &pb.PBGameAction_Query{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
}
// 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"
)
// Jrpc jrpc句柄
type Jrpc struct {
cli *channelClient
}
// Grpc grpc句柄
type Grpc struct {
*channelClient
}
type channelClient struct {
types.ChannelClient
}
// Init 初始化rpc
func Init(name string, s types.RPCServer) {
cli := &channelClient{}
grpc := &Grpc{channelClient: cli}
cli.Init(name, s, &Jrpc{cli: cli}, grpc)
}
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
package types package types
import "github.com/33cn/chain33/types"
//game action ty //game action ty
const ( const (
PBGameActionStart = iota + 1 PBGameActionStart = iota + 1
...@@ -48,4 +50,35 @@ const ( ...@@ -48,4 +50,35 @@ const (
FuncNameQueryGameByAddr = "QueryGameByAddr" FuncNameQueryGameByAddr = "QueryGameByAddr"
// FuncNameQueryGameByStatus 根据status查询game // FuncNameQueryGameByStatus 根据status查询game
FuncNameQueryGameByStatus = "QueryGameByStatus" FuncNameQueryGameByStatus = "QueryGameByStatus"
// FuncNameQueryGameByRound 查询某一回合游戏结果
FuncNameQueryGameByRound = "QueryGameByRound"
// CreateStartTx 创建开始交易
CreateStartTx = "Start"
// CreateContinueTx 创建继续交易
CreateContinueTx = "Continue"
// CreatequitTx 创建退出交易
CreatequitTx = "Quit"
)
const (
// ListDESC 降序
ListDESC = int32(0)
// DefaultCount 默认一次取多少条记录
DefaultCount = int32(20)
// MaxPlayerNum 最大玩家数
MaxPlayerNum = 5
// MinPlayValue 最小赌注
MinPlayValue = 10 * types.Coin
// DefaultStyle 默认游戏类型
DefaultStyle = PlayStyleDefault
// PlatformAddress 平台地址
PlatformAddress = "1PHtChNt3UcfssR7v7trKSk3WJtAWjKjjX"
// PlatformFee 平台佣金
PlatformFee = int64(0.005 * float64(types.Coin))
// DeveloperAddress 开发着地址
DeveloperAddress = "1D6RFZNp2rh6QdbcZ1d7RWuBUz61We6SD7"
// DeveloperFee 开发者佣金
DeveloperFee = int64(0.005 * float64(types.Coin))
// WinnerReturn 赢家回报率
WinnerReturn = types.Coin - DeveloperFee
) )
...@@ -4,13 +4,10 @@ ...@@ -4,13 +4,10 @@
package types package types
import ( import (
context "context"
fmt "fmt" fmt "fmt"
math "math" math "math"
types "github.com/33cn/chain33/types"
proto "github.com/golang/protobuf/proto" proto "github.com/golang/protobuf/proto"
grpc "google.golang.org/grpc"
) )
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
...@@ -42,6 +39,7 @@ type PokerBull struct { ...@@ -42,6 +39,7 @@ type PokerBull struct {
DealerAddr string `protobuf:"bytes,14,opt,name=dealerAddr,proto3" json:"dealerAddr,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"` IsWaiting bool `protobuf:"varint,15,opt,name=isWaiting,proto3" json:"isWaiting,omitempty"`
PreStatus int32 `protobuf:"varint,16,opt,name=preStatus,proto3" json:"preStatus,omitempty"` PreStatus int32 `protobuf:"varint,16,opt,name=preStatus,proto3" json:"preStatus,omitempty"`
Round int32 `protobuf:"varint,17,opt,name=round,proto3" json:"round,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"` XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"` XXX_sizecache int32 `json:"-"`
...@@ -184,6 +182,13 @@ func (m *PokerBull) GetPreStatus() int32 { ...@@ -184,6 +182,13 @@ func (m *PokerBull) GetPreStatus() int32 {
return 0 return 0
} }
func (m *PokerBull) GetRound() int32 {
if m != nil {
return m.Round
}
return 0
}
//一把牌 //一把牌
type PBHand struct { type PBHand struct {
Cards []int32 `protobuf:"varint,1,rep,packed,name=cards,proto3" json:"cards,omitempty"` Cards []int32 `protobuf:"varint,1,rep,packed,name=cards,proto3" json:"cards,omitempty"`
...@@ -1027,6 +1032,45 @@ func (m *PBGameRecords) GetRecords() []*PBGameRecord { ...@@ -1027,6 +1032,45 @@ func (m *PBGameRecords) GetRecords() []*PBGameRecord {
return nil return nil
} }
type PBGameIndexRecords struct {
Records []*PBGameIndexRecord `protobuf:"bytes,1,rep,name=records,proto3" json:"records,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *PBGameIndexRecords) Reset() { *m = PBGameIndexRecords{} }
func (m *PBGameIndexRecords) String() string { return proto.CompactTextString(m) }
func (*PBGameIndexRecords) ProtoMessage() {}
func (*PBGameIndexRecords) Descriptor() ([]byte, []int) {
return fileDescriptor_8d22e4ee2313e311, []int{14}
}
func (m *PBGameIndexRecords) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_PBGameIndexRecords.Unmarshal(m, b)
}
func (m *PBGameIndexRecords) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_PBGameIndexRecords.Marshal(b, m, deterministic)
}
func (m *PBGameIndexRecords) XXX_Merge(src proto.Message) {
xxx_messageInfo_PBGameIndexRecords.Merge(m, src)
}
func (m *PBGameIndexRecords) XXX_Size() int {
return xxx_messageInfo_PBGameIndexRecords.Size(m)
}
func (m *PBGameIndexRecords) XXX_DiscardUnknown() {
xxx_messageInfo_PBGameIndexRecords.DiscardUnknown(m)
}
var xxx_messageInfo_PBGameIndexRecords proto.InternalMessageInfo
func (m *PBGameIndexRecords) GetRecords() []*PBGameIndexRecord {
if m != nil {
return m.Records
}
return nil
}
type QueryPBGameInfo struct { type QueryPBGameInfo struct {
GameId string `protobuf:"bytes,1,opt,name=gameId,proto3" json:"gameId,omitempty"` GameId string `protobuf:"bytes,1,opt,name=gameId,proto3" json:"gameId,omitempty"`
Addr string `protobuf:"bytes,2,opt,name=addr,proto3" json:"addr,omitempty"` Addr string `protobuf:"bytes,2,opt,name=addr,proto3" json:"addr,omitempty"`
...@@ -1041,7 +1085,7 @@ func (m *QueryPBGameInfo) Reset() { *m = QueryPBGameInfo{} } ...@@ -1041,7 +1085,7 @@ func (m *QueryPBGameInfo) Reset() { *m = QueryPBGameInfo{} }
func (m *QueryPBGameInfo) String() string { return proto.CompactTextString(m) } func (m *QueryPBGameInfo) String() string { return proto.CompactTextString(m) }
func (*QueryPBGameInfo) ProtoMessage() {} func (*QueryPBGameInfo) ProtoMessage() {}
func (*QueryPBGameInfo) Descriptor() ([]byte, []int) { func (*QueryPBGameInfo) Descriptor() ([]byte, []int) {
return fileDescriptor_8d22e4ee2313e311, []int{14} return fileDescriptor_8d22e4ee2313e311, []int{15}
} }
func (m *QueryPBGameInfo) XXX_Unmarshal(b []byte) error { func (m *QueryPBGameInfo) XXX_Unmarshal(b []byte) error {
...@@ -1101,7 +1145,7 @@ func (m *ReplyPBGame) Reset() { *m = ReplyPBGame{} } ...@@ -1101,7 +1145,7 @@ func (m *ReplyPBGame) Reset() { *m = ReplyPBGame{} }
func (m *ReplyPBGame) String() string { return proto.CompactTextString(m) } func (m *ReplyPBGame) String() string { return proto.CompactTextString(m) }
func (*ReplyPBGame) ProtoMessage() {} func (*ReplyPBGame) ProtoMessage() {}
func (*ReplyPBGame) Descriptor() ([]byte, []int) { func (*ReplyPBGame) Descriptor() ([]byte, []int) {
return fileDescriptor_8d22e4ee2313e311, []int{15} return fileDescriptor_8d22e4ee2313e311, []int{16}
} }
func (m *ReplyPBGame) XXX_Unmarshal(b []byte) error { func (m *ReplyPBGame) XXX_Unmarshal(b []byte) error {
...@@ -1140,7 +1184,7 @@ func (m *QueryPBGameInfos) Reset() { *m = QueryPBGameInfos{} } ...@@ -1140,7 +1184,7 @@ func (m *QueryPBGameInfos) Reset() { *m = QueryPBGameInfos{} }
func (m *QueryPBGameInfos) String() string { return proto.CompactTextString(m) } func (m *QueryPBGameInfos) String() string { return proto.CompactTextString(m) }
func (*QueryPBGameInfos) ProtoMessage() {} func (*QueryPBGameInfos) ProtoMessage() {}
func (*QueryPBGameInfos) Descriptor() ([]byte, []int) { func (*QueryPBGameInfos) Descriptor() ([]byte, []int) {
return fileDescriptor_8d22e4ee2313e311, []int{16} return fileDescriptor_8d22e4ee2313e311, []int{17}
} }
func (m *QueryPBGameInfos) XXX_Unmarshal(b []byte) error { func (m *QueryPBGameInfos) XXX_Unmarshal(b []byte) error {
...@@ -1179,7 +1223,7 @@ func (m *ReplyPBGameList) Reset() { *m = ReplyPBGameList{} } ...@@ -1179,7 +1223,7 @@ func (m *ReplyPBGameList) Reset() { *m = ReplyPBGameList{} }
func (m *ReplyPBGameList) String() string { return proto.CompactTextString(m) } func (m *ReplyPBGameList) String() string { return proto.CompactTextString(m) }
func (*ReplyPBGameList) ProtoMessage() {} func (*ReplyPBGameList) ProtoMessage() {}
func (*ReplyPBGameList) Descriptor() ([]byte, []int) { func (*ReplyPBGameList) Descriptor() ([]byte, []int) {
return fileDescriptor_8d22e4ee2313e311, []int{17} return fileDescriptor_8d22e4ee2313e311, []int{18}
} }
func (m *ReplyPBGameList) XXX_Unmarshal(b []byte) error { func (m *ReplyPBGameList) XXX_Unmarshal(b []byte) error {
...@@ -1207,6 +1251,142 @@ func (m *ReplyPBGameList) GetGames() []*PokerBull { ...@@ -1207,6 +1251,142 @@ func (m *ReplyPBGameList) GetGames() []*PokerBull {
return nil return nil
} }
// QueryPBGameByRound 根据gameId和回合数查询某回合的游戏结果
type QueryPBGameByRound struct {
GameId string `protobuf:"bytes,1,opt,name=gameId,proto3" json:"gameId,omitempty"`
Round int32 `protobuf:"varint,2,opt,name=round,proto3" json:"round,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *QueryPBGameByRound) Reset() { *m = QueryPBGameByRound{} }
func (m *QueryPBGameByRound) String() string { return proto.CompactTextString(m) }
func (*QueryPBGameByRound) ProtoMessage() {}
func (*QueryPBGameByRound) Descriptor() ([]byte, []int) {
return fileDescriptor_8d22e4ee2313e311, []int{19}
}
func (m *QueryPBGameByRound) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_QueryPBGameByRound.Unmarshal(m, b)
}
func (m *QueryPBGameByRound) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_QueryPBGameByRound.Marshal(b, m, deterministic)
}
func (m *QueryPBGameByRound) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryPBGameByRound.Merge(m, src)
}
func (m *QueryPBGameByRound) XXX_Size() int {
return xxx_messageInfo_QueryPBGameByRound.Size(m)
}
func (m *QueryPBGameByRound) XXX_DiscardUnknown() {
xxx_messageInfo_QueryPBGameByRound.DiscardUnknown(m)
}
var xxx_messageInfo_QueryPBGameByRound proto.InternalMessageInfo
func (m *QueryPBGameByRound) GetGameId() string {
if m != nil {
return m.GameId
}
return ""
}
func (m *QueryPBGameByRound) GetRound() int32 {
if m != nil {
return m.Round
}
return 0
}
// ReplyPBGameByRound 某一回合游戏结果
type ReplyPBGameByRound 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"`
Result *PBResult `protobuf:"bytes,3,opt,name=result,proto3" json:"result,omitempty"`
IsWaiting bool `protobuf:"varint,4,opt,name=isWaiting,proto3" json:"isWaiting,omitempty"`
Value int64 `protobuf:"varint,5,opt,name=value,proto3" json:"value,omitempty"`
Players []*PBPlayer `protobuf:"bytes,6,rep,name=players,proto3" json:"players,omitempty"`
Return int64 `protobuf:"varint,7,opt,name=return,proto3" json:"return,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *ReplyPBGameByRound) Reset() { *m = ReplyPBGameByRound{} }
func (m *ReplyPBGameByRound) String() string { return proto.CompactTextString(m) }
func (*ReplyPBGameByRound) ProtoMessage() {}
func (*ReplyPBGameByRound) Descriptor() ([]byte, []int) {
return fileDescriptor_8d22e4ee2313e311, []int{20}
}
func (m *ReplyPBGameByRound) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ReplyPBGameByRound.Unmarshal(m, b)
}
func (m *ReplyPBGameByRound) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ReplyPBGameByRound.Marshal(b, m, deterministic)
}
func (m *ReplyPBGameByRound) XXX_Merge(src proto.Message) {
xxx_messageInfo_ReplyPBGameByRound.Merge(m, src)
}
func (m *ReplyPBGameByRound) XXX_Size() int {
return xxx_messageInfo_ReplyPBGameByRound.Size(m)
}
func (m *ReplyPBGameByRound) XXX_DiscardUnknown() {
xxx_messageInfo_ReplyPBGameByRound.DiscardUnknown(m)
}
var xxx_messageInfo_ReplyPBGameByRound proto.InternalMessageInfo
func (m *ReplyPBGameByRound) GetGameId() string {
if m != nil {
return m.GameId
}
return ""
}
func (m *ReplyPBGameByRound) GetStatus() int32 {
if m != nil {
return m.Status
}
return 0
}
func (m *ReplyPBGameByRound) GetResult() *PBResult {
if m != nil {
return m.Result
}
return nil
}
func (m *ReplyPBGameByRound) GetIsWaiting() bool {
if m != nil {
return m.IsWaiting
}
return false
}
func (m *ReplyPBGameByRound) GetValue() int64 {
if m != nil {
return m.Value
}
return 0
}
func (m *ReplyPBGameByRound) GetPlayers() []*PBPlayer {
if m != nil {
return m.Players
}
return nil
}
func (m *ReplyPBGameByRound) GetReturn() int64 {
if m != nil {
return m.Return
}
return 0
}
type ReceiptPBGame struct { type ReceiptPBGame struct {
GameId string `protobuf:"bytes,1,opt,name=gameId,proto3" json:"gameId,omitempty"` GameId string `protobuf:"bytes,1,opt,name=gameId,proto3" json:"gameId,omitempty"`
Status int32 `protobuf:"varint,2,opt,name=status,proto3" json:"status,omitempty"` Status int32 `protobuf:"varint,2,opt,name=status,proto3" json:"status,omitempty"`
...@@ -1218,6 +1398,7 @@ type ReceiptPBGame struct { ...@@ -1218,6 +1398,7 @@ type ReceiptPBGame struct {
IsWaiting bool `protobuf:"varint,8,opt,name=isWaiting,proto3" json:"isWaiting,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"` Players []string `protobuf:"bytes,9,rep,name=players,proto3" json:"players,omitempty"`
PreStatus int32 `protobuf:"varint,10,opt,name=preStatus,proto3" json:"preStatus,omitempty"` PreStatus int32 `protobuf:"varint,10,opt,name=preStatus,proto3" json:"preStatus,omitempty"`
Round int32 `protobuf:"varint,11,opt,name=round,proto3" json:"round,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"` XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"` XXX_sizecache int32 `json:"-"`
...@@ -1227,7 +1408,7 @@ func (m *ReceiptPBGame) Reset() { *m = ReceiptPBGame{} } ...@@ -1227,7 +1408,7 @@ func (m *ReceiptPBGame) Reset() { *m = ReceiptPBGame{} }
func (m *ReceiptPBGame) String() string { return proto.CompactTextString(m) } func (m *ReceiptPBGame) String() string { return proto.CompactTextString(m) }
func (*ReceiptPBGame) ProtoMessage() {} func (*ReceiptPBGame) ProtoMessage() {}
func (*ReceiptPBGame) Descriptor() ([]byte, []int) { func (*ReceiptPBGame) Descriptor() ([]byte, []int) {
return fileDescriptor_8d22e4ee2313e311, []int{18} return fileDescriptor_8d22e4ee2313e311, []int{21}
} }
func (m *ReceiptPBGame) XXX_Unmarshal(b []byte) error { func (m *ReceiptPBGame) XXX_Unmarshal(b []byte) error {
...@@ -1318,6 +1499,13 @@ func (m *ReceiptPBGame) GetPreStatus() int32 { ...@@ -1318,6 +1499,13 @@ func (m *ReceiptPBGame) GetPreStatus() int32 {
return 0 return 0
} }
func (m *ReceiptPBGame) GetRound() int32 {
if m != nil {
return m.Round
}
return 0
}
type PBStartTxReq struct { type PBStartTxReq struct {
Value int64 `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"` Value int64 `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"`
PlayerNum int32 `protobuf:"varint,2,opt,name=playerNum,proto3" json:"playerNum,omitempty"` PlayerNum int32 `protobuf:"varint,2,opt,name=playerNum,proto3" json:"playerNum,omitempty"`
...@@ -1331,7 +1519,7 @@ func (m *PBStartTxReq) Reset() { *m = PBStartTxReq{} } ...@@ -1331,7 +1519,7 @@ func (m *PBStartTxReq) Reset() { *m = PBStartTxReq{} }
func (m *PBStartTxReq) String() string { return proto.CompactTextString(m) } func (m *PBStartTxReq) String() string { return proto.CompactTextString(m) }
func (*PBStartTxReq) ProtoMessage() {} func (*PBStartTxReq) ProtoMessage() {}
func (*PBStartTxReq) Descriptor() ([]byte, []int) { func (*PBStartTxReq) Descriptor() ([]byte, []int) {
return fileDescriptor_8d22e4ee2313e311, []int{19} return fileDescriptor_8d22e4ee2313e311, []int{22}
} }
func (m *PBStartTxReq) XXX_Unmarshal(b []byte) error { func (m *PBStartTxReq) XXX_Unmarshal(b []byte) error {
...@@ -1385,7 +1573,7 @@ func (m *PBContinueTxReq) Reset() { *m = PBContinueTxReq{} } ...@@ -1385,7 +1573,7 @@ func (m *PBContinueTxReq) Reset() { *m = PBContinueTxReq{} }
func (m *PBContinueTxReq) String() string { return proto.CompactTextString(m) } func (m *PBContinueTxReq) String() string { return proto.CompactTextString(m) }
func (*PBContinueTxReq) ProtoMessage() {} func (*PBContinueTxReq) ProtoMessage() {}
func (*PBContinueTxReq) Descriptor() ([]byte, []int) { func (*PBContinueTxReq) Descriptor() ([]byte, []int) {
return fileDescriptor_8d22e4ee2313e311, []int{20} return fileDescriptor_8d22e4ee2313e311, []int{23}
} }
func (m *PBContinueTxReq) XXX_Unmarshal(b []byte) error { func (m *PBContinueTxReq) XXX_Unmarshal(b []byte) error {
...@@ -1432,7 +1620,7 @@ func (m *PBQuitTxReq) Reset() { *m = PBQuitTxReq{} } ...@@ -1432,7 +1620,7 @@ func (m *PBQuitTxReq) Reset() { *m = PBQuitTxReq{} }
func (m *PBQuitTxReq) String() string { return proto.CompactTextString(m) } func (m *PBQuitTxReq) String() string { return proto.CompactTextString(m) }
func (*PBQuitTxReq) ProtoMessage() {} func (*PBQuitTxReq) ProtoMessage() {}
func (*PBQuitTxReq) Descriptor() ([]byte, []int) { func (*PBQuitTxReq) Descriptor() ([]byte, []int) {
return fileDescriptor_8d22e4ee2313e311, []int{21} return fileDescriptor_8d22e4ee2313e311, []int{24}
} }
func (m *PBQuitTxReq) XXX_Unmarshal(b []byte) error { func (m *PBQuitTxReq) XXX_Unmarshal(b []byte) error {
...@@ -1479,7 +1667,7 @@ func (m *PBQueryReq) Reset() { *m = PBQueryReq{} } ...@@ -1479,7 +1667,7 @@ func (m *PBQueryReq) Reset() { *m = PBQueryReq{} }
func (m *PBQueryReq) String() string { return proto.CompactTextString(m) } func (m *PBQueryReq) String() string { return proto.CompactTextString(m) }
func (*PBQueryReq) ProtoMessage() {} func (*PBQueryReq) ProtoMessage() {}
func (*PBQueryReq) Descriptor() ([]byte, []int) { func (*PBQueryReq) Descriptor() ([]byte, []int) {
return fileDescriptor_8d22e4ee2313e311, []int{22} return fileDescriptor_8d22e4ee2313e311, []int{25}
} }
func (m *PBQueryReq) XXX_Unmarshal(b []byte) error { func (m *PBQueryReq) XXX_Unmarshal(b []byte) error {
...@@ -1529,10 +1717,13 @@ func init() { ...@@ -1529,10 +1717,13 @@ func init() {
proto.RegisterType((*PBGameRecord)(nil), "types.PBGameRecord") proto.RegisterType((*PBGameRecord)(nil), "types.PBGameRecord")
proto.RegisterType((*PBGameIndexRecord)(nil), "types.PBGameIndexRecord") proto.RegisterType((*PBGameIndexRecord)(nil), "types.PBGameIndexRecord")
proto.RegisterType((*PBGameRecords)(nil), "types.PBGameRecords") proto.RegisterType((*PBGameRecords)(nil), "types.PBGameRecords")
proto.RegisterType((*PBGameIndexRecords)(nil), "types.PBGameIndexRecords")
proto.RegisterType((*QueryPBGameInfo)(nil), "types.QueryPBGameInfo") proto.RegisterType((*QueryPBGameInfo)(nil), "types.QueryPBGameInfo")
proto.RegisterType((*ReplyPBGame)(nil), "types.ReplyPBGame") proto.RegisterType((*ReplyPBGame)(nil), "types.ReplyPBGame")
proto.RegisterType((*QueryPBGameInfos)(nil), "types.QueryPBGameInfos") proto.RegisterType((*QueryPBGameInfos)(nil), "types.QueryPBGameInfos")
proto.RegisterType((*ReplyPBGameList)(nil), "types.ReplyPBGameList") proto.RegisterType((*ReplyPBGameList)(nil), "types.ReplyPBGameList")
proto.RegisterType((*QueryPBGameByRound)(nil), "types.QueryPBGameByRound")
proto.RegisterType((*ReplyPBGameByRound)(nil), "types.ReplyPBGameByRound")
proto.RegisterType((*ReceiptPBGame)(nil), "types.ReceiptPBGame") proto.RegisterType((*ReceiptPBGame)(nil), "types.ReceiptPBGame")
proto.RegisterType((*PBStartTxReq)(nil), "types.PBStartTxReq") proto.RegisterType((*PBStartTxReq)(nil), "types.PBStartTxReq")
proto.RegisterType((*PBContinueTxReq)(nil), "types.PBContinueTxReq") proto.RegisterType((*PBContinueTxReq)(nil), "types.PBContinueTxReq")
...@@ -1543,211 +1734,69 @@ func init() { ...@@ -1543,211 +1734,69 @@ func init() {
func init() { proto.RegisterFile("pokerbull.proto", fileDescriptor_8d22e4ee2313e311) } func init() { proto.RegisterFile("pokerbull.proto", fileDescriptor_8d22e4ee2313e311) }
var fileDescriptor_8d22e4ee2313e311 = []byte{ var fileDescriptor_8d22e4ee2313e311 = []byte{
// 984 bytes of a gzipped FileDescriptorProto // 1021 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x56, 0xdd, 0x6e, 0xe3, 0x44, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 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 0xc6, 0xab, 0xf4, 0x0c, 0xa8, 0xb7, 0xec, 0x2d, 0xab, 0x5c, 0x37, 0x60,
0x7b, 0xec, 0x3b, 0x18, 0x14, 0xd3, 0xb1, 0x7d, 0x07, 0xb4, 0xdd, 0x7a, 0x0e, 0x5d, 0x9c, 0x94, 0xef, 0xba, 0xe1, 0xd9, 0x0d, 0x81, 0x10, 0x74, 0x49, 0x1b, 0xa1, 0x90, 0x37, 0xff, 0x07, 0xb0,
0x1f, 0x2e, 0x81, 0x16, 0xed, 0xd7, 0x3d, 0xfc, 0x8a, 0x9e, 0xfd, 0x1b, 0x00, 0x00, 0xff, 0xff, 0xd9, 0x21, 0xb4, 0xdf, 0x49, 0xb3, 0x7e, 0xaa, 0xa3, 0xff, 0x23, 0x8c, 0x96, 0x73, 0x03, 0xdf,
0x0c, 0xc9, 0x5f, 0x3c, 0xb7, 0x0a, 0x00, 0x00, 0x64, 0x78, 0x5f, 0x01, 0xf4, 0xe5, 0x56, 0x75, 0xf9, 0x07, 0x85, 0xd7, 0x17, 0xb8, 0x83, 0x3d,
} 0xee, 0xe2, 0xf7, 0x6a, 0x1c, 0xe0, 0x17, 0x79, 0xd4, 0xbd, 0xb7, 0x5d, 0x5c, 0xc8, 0xcf, 0xfe,
0x09, 0x00, 0x00, 0xff, 0xff, 0xda, 0x14, 0x34, 0x44, 0xa3, 0x0b, 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
// PokerbullClient is the client API for Pokerbull service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
type PokerbullClient interface {
//游戏开始
Start(ctx context.Context, in *PBGameStart, opts ...grpc.CallOption) (*types.UnsignTx, error)
//游戏继续
Continue(ctx context.Context, in *PBGameContinue, opts ...grpc.CallOption) (*types.UnsignTx, error)
//游戏结束
Quit(ctx context.Context, in *PBGameQuit, opts ...grpc.CallOption) (*types.UnsignTx, error)
}
type pokerbullClient struct {
cc *grpc.ClientConn
}
func NewPokerbullClient(cc *grpc.ClientConn) PokerbullClient {
return &pokerbullClient{cc}
}
func (c *pokerbullClient) Start(ctx context.Context, in *PBGameStart, opts ...grpc.CallOption) (*types.UnsignTx, error) {
out := new(types.UnsignTx)
err := c.cc.Invoke(ctx, "/types.pokerbull/Start", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *pokerbullClient) Continue(ctx context.Context, in *PBGameContinue, opts ...grpc.CallOption) (*types.UnsignTx, error) {
out := new(types.UnsignTx)
err := c.cc.Invoke(ctx, "/types.pokerbull/Continue", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *pokerbullClient) Quit(ctx context.Context, in *PBGameQuit, opts ...grpc.CallOption) (*types.UnsignTx, error) {
out := new(types.UnsignTx)
err := c.cc.Invoke(ctx, "/types.pokerbull/Quit", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// PokerbullServer is the server API for Pokerbull service.
type PokerbullServer interface {
//游戏开始
Start(context.Context, *PBGameStart) (*types.UnsignTx, error)
//游戏继续
Continue(context.Context, *PBGameContinue) (*types.UnsignTx, error)
//游戏结束
Quit(context.Context, *PBGameQuit) (*types.UnsignTx, error)
}
func RegisterPokerbullServer(s *grpc.Server, srv PokerbullServer) {
s.RegisterService(&_Pokerbull_serviceDesc, srv)
}
func _Pokerbull_Start_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(PBGameStart)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PokerbullServer).Start(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/types.pokerbull/Start",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PokerbullServer).Start(ctx, req.(*PBGameStart))
}
return interceptor(ctx, in, info, handler)
}
func _Pokerbull_Continue_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(PBGameContinue)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PokerbullServer).Continue(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/types.pokerbull/Continue",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PokerbullServer).Continue(ctx, req.(*PBGameContinue))
}
return interceptor(ctx, in, info, handler)
}
func _Pokerbull_Quit_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(PBGameQuit)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PokerbullServer).Quit(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/types.pokerbull/Quit",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PokerbullServer).Quit(ctx, req.(*PBGameQuit))
}
return interceptor(ctx, in, info, handler)
}
var _Pokerbull_serviceDesc = grpc.ServiceDesc{
ServiceName: "types.pokerbull",
HandlerType: (*PokerbullServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "Start",
Handler: _Pokerbull_Start_Handler,
},
{
MethodName: "Continue",
Handler: _Pokerbull_Continue_Handler,
},
{
MethodName: "Quit",
Handler: _Pokerbull_Quit_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "pokerbull.proto",
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment