---
# System prepended metadata

title: 龍虎鬥

---

# 龍虎鬥

## 定義表
下注, 輸贏, 籌碼限額 ...

    [虎, 龍, 和,]
## client -> server
为cli端请求srv端的cmd, 透过 cbId 做消息配对, 响应后c端先判断 err 字段是否为空作例外处理.

### RoomStatus

请求参数:

    {
      "svr": "drogontiger",              // <string> 游戏名
      "route": "drogontiger.roomStatus", // <string> 游戏名.的cmd
      "args": null,                 // <any>
      "cbId": 3
    }

<table>
  <thead class="ant-table-thead">
    <tr>
      <th key="name" style="width: 500px">名称</th>
      <th key="type">类型</th>
      <th key="required">是否必须</th>
      <th key="default">默认值</th>
      <th key="desc">备注</th>
      <th key="sub">其他信息</th>
    </tr>
  </thead>
  <tbody className="ant-table-tbody">
    <tr key="0-0">
      <td key="0">
        <span style="padding-left: 0px"
          ><span style="color: #8c8a8a"></span> svr</span
        >
      </td>
      <td key="1"><span>string</span></td>
      <td key="2">必须</td>
      <td key="3"></td>
      <td key="4"><span style="white-space: pre-wrap"></span></td>
      <td key="5"></td>
    </tr>
    <tr key="0-1">
      <td key="0">
        <span style="padding-left: 0px"
          ><span style="color: #8c8a8a"></span> route</span
        >
      </td>
      <td key="1"><span>string</span></td>
      <td key="2">必须</td>
      <td key="3"></td>
      <td key="4"><span style="white-space: pre-wrap"></span></td>
      <td key="5"></td>
    </tr>
    <tr key="0-2">
      <td key="0">
        <span style="padding-left: 0px"
          ><span style="color: #8c8a8a"></span> cbId</span
        >
      </td>
      <td key="1"><span>number</span></td>
      <td key="2">必须</td>
      <td key="3"></td>
      <td key="4"><span style="white-space: pre-wrap"></span></td>
      <td key="5"></td>
    </tr>
    <tr key="0-3">
      <td key="0">
        <span style="padding-left: 0px"
          ><span style="color: #8c8a8a"></span> args</span
        >
      </td>
      <td key="1"><span>object</span></td>
      <td key="2">必须</td>
      <td key="3"></td>
      <td key="4"><span style="white-space: pre-wrap"></span></td>
      <td key="5"></td>
    </tr>
    <tr key="0-3-0">
      <td key="0">
        <span style="padding-left: 20px"
          ><span style="color: #8c8a8a">├-</span> 1</span
        >
      </td>
      <td key="1"><span>object</span></td>
      <td key="2">必须</td>
      <td key="3"></td>
      <td key="4"><span style="white-space: pre-wrap"></span></td>
      <td key="5"></td>
    </tr>
    <tr key="0-3-0-0">
      <td key="0">
        <span style="padding-left: 40px"
          ><span style="color: #8c8a8a">├─</span> id</span
        >
      </td>
      <td key="1"><span>number</span></td>
      <td key="2">必须</td>
      <td key="3"></td>
      <td key="4"><span style="white-space: pre-wrap"></span></td>
      <td key="5"></td>
    </tr>
    <tr key="0-3-0-1">
      <td key="0">
        <span style="padding-left: 40px"
          ><span style="color: #8c8a8a">├─</span> name</span
        >
      </td>
      <td key="1"><span>string</span></td>
      <td key="2">必须</td>
      <td key="3"></td>
      <td key="4"><span style="white-space: pre-wrap">房间标题</span></td>
      <td key="5"></td>
    </tr>
    <tr key="0-3-0-2">
      <td key="0">
        <span style="padding-left: 40px"
          ><span style="color: #8c8a8a">├─</span> gametype_name</span
        >
      </td>
      <td key="1"><span>string</span></td>
      <td key="2">必须</td>
      <td key="3"></td>
      <td key="4"><span style="white-space: pre-wrap">游戏代号</span></td>
      <td key="5"></td>
    </tr>
    <tr key="0-3-0-3">
      <td key="0">
        <span style="padding-left: 40px"
          ><span style="color: #8c8a8a">├─</span> from_wallet</span
        >
      </td>
      <td key="1"><span>string</span></td>
      <td key="2">必须</td>
      <td key="3"></td>
      <td key="4"><span style="white-space: pre-wrap">钱包 from</span></td>
      <td key="5"></td>
    </tr>
    <tr key="0-3-0-4">
      <td key="0">
        <span style="padding-left: 40px"
          ><span style="color: #8c8a8a">├─</span> to_wallet</span
        >
      </td>
      <td key="1"><span>string</span></td>
      <td key="2">必须</td>
      <td key="3"></td>
      <td key="4"><span style="white-space: pre-wrap">钱包 to</span></td>
      <td key="5"></td>
    </tr>
    <tr key="0-3-0-5">
      <td key="0">
        <span style="padding-left: 40px"
          ><span style="color: #8c8a8a">├─</span> bet_level</span
        >
      </td>
      <td key="1"><span>number []</span></td>
      <td key="2">必须</td>
      <td key="3"></td>
      <td key="4"><span style="white-space: pre-wrap">筹码 下注阵列</span></td>
      <td key="5">
        <p key="3">
          <span style="font-weight: '700'">item 类型: </span><span>number</span>
        </p>
      </td>
    </tr>
    <tr key="array-1">
      <td key="0">
        <span style="padding-left: 60px"
          ><span style="color: #8c8a8a">├─</span>
        </span>
      </td>
      <td key="1"><span></span></td>
      <td key="2">必须</td>
      <td key="3"></td>
      <td key="4">
        <span style="white-space: pre-wrap">筹码 比值 1: 10000</span>
      </td>
      <td key="5"></td>
    </tr>
    <tr key="0-3-0-6">
      <td key="0">
        <span style="padding-left: 40px"
          ><span style="color: #8c8a8a">├─</span> player_bet_upper_limit</span
        >
      </td>
      <td key="1"><span>number []</span></td>
      <td key="2">必须</td>
      <td key="3"></td>
      <td key="4">
        <span style="white-space: pre-wrap">个人上限 比值 1: 10000</span>
      </td>
      <td key="5">
        <p key="3">
          <span style="font-weight: '700'">item 类型: </span><span>number</span>
        </p>
      </td>
    </tr>
    <tr key="array-2">
      <td key="0">
        <span style="padding-left: 60px"
          ><span style="color: #8c8a8a">├─</span>
        </span>
      </td>
      <td key="1"><span></span></td>
      <td key="2">必须</td>
      <td key="3"></td>
      <td key="4">
        <span style="white-space: pre-wrap"
          >[虎,龍,和,] 比值 1: 10000</span
        >
      </td>
      <td key="5"></td>
    </tr>
    <tr key="0-3-0-7">
      <td key="0">
        <span style="padding-left: 40px"
          ><span style="color: #8c8a8a">├─</span> player_bet_lower_limit</span
        >
      </td>
      <td key="1"><span>number []</span></td>
      <td key="2">必须</td>
      <td key="3"></td>
      <td key="4">
        <span style="white-space: pre-wrap">个人下限 比值 1: 10000</span>
      </td>
      <td key="5">
        <p key="3">
          <span style="font-weight: '700'">item 类型: </span><span>number</span>
        </p>
      </td>
    </tr>
    <tr key="array-3">
      <td key="0">
        <span style="padding-left: 60px"
          ><span style="color: #8c8a8a">├─</span>
        </span>
      </td>
      <td key="1"><span></span></td>
      <td key="2">必须</td>
      <td key="3"></td>
      <td key="4">
        <span style="white-space: pre-wrap"
          >[虎,龍,和,] 比值 1: 10000</span
        >
      </td>
      <td key="5"></td>
    </tr>
    <tr key="0-3-0-8">
      <td key="0">
        <span style="padding-left: 40px"
          ><span style="color: #8c8a8a">├─</span> area_bet_upper_limit</span
        >
      </td>
      <td key="1"><span>number []</span></td>
      <td key="2">必须</td>
      <td key="3"></td>
      <td key="4">
        <span style="white-space: pre-wrap">单区上限 比值 1: 10000</span>
      </td>
      <td key="5">
        <p key="3">
          <span style="font-weight: '700'">item 类型: </span><span>number</span>
        </p>
      </td>
    </tr>
    <tr key="array-4">
      <td key="0">
        <span style="padding-left: 60px"
          ><span style="color: #8c8a8a">├─</span>
        </span>
      </td>
      <td key="1"><span></span></td>
      <td key="2">必须</td>
      <td key="3"></td>
      <td key="4">
        <span style="white-space: pre-wrap"
          >[虎,龍,和,] 比值 1: 10000</span
        >
      </td>
      <td key="5"></td>
    </tr>
    <tr key="0-4">
      <td key="0">
        <span style="padding-left: 0px"
          ><span style="color: #8c8a8a"></span> err</span
        >
      </td>
      <td key="1"><span>string</span></td>
      <td key="2">必须</td>
      <td key="3"></td>
      <td key="4"><span style="white-space: pre-wrap">错误提示</span></td>
      <td key="5"></td>
    </tr>
  </tbody>
</table>


 返回数据:
```
{**
  "svr": "",
  "route": "",
  "cbId": 3,
  "args": {
    "6": {
      "id": 6,
      "name": "B106",
      "gametypename": "區塊龍虎",
      "fromwallet": "TCTfPcF1wTRDK1qFAb7w2zGjF11WE9v8DA",
      "towallet": "TRCJhQw5u4F3wZ1PkY199p3jm2XN4WjKYR",
      "betlevel": [
        5000000,
        10000000,
        20000000,
        50000000,
        100000000,
        250000000
      ],
      "playerbetupperlimit": [
        500000000,
        500000000,
        500000000
      ],
      "playerbetlowerlimit": [
        5000000,
        5000000,
        5000000
      ],
      "areabetupperlimit": [
        20000000000,
        20000000000,
        20000000000
      ]
    }
  },
  "err": null
}*
```

### JoinGame

请求参数: 

    {
      "svr": "drogontiger",
      "route": "drogontiger.joinGame",
      "args": {
        "room_id":6
      },
      "cbId": 3
    }

返回数据:

```
{
   "svr": "",
  "route": "",
  "cbId": 3,
  "args": {
    "info": {
      "id": 6,
      "name": "B106",
      "gametype_name": "區塊龍虎",
      "from_wallet": "TCTfPcF1wTRDK1qFAb7w2zGjF11WE9v8DA",
      "to_wallet": "TRCJhQw5u4F3wZ1PkY199p3jm2XN4WjKYR",
      "bet_level": [
        5000000,
        10000000,
        20000000,
        50000000,
        100000000,
        250000000
      ],
      "player_bet_upper_limit": [
        500000000,
        500000000,
        500000000
      ],
      "player_bet_lower_limit": [
        5000000,
        5000000,
        5000000
      ],
      "area_bet_upper_limit": [
        20000000000,
        20000000000,
        20000000000
      ]
    },
    "self": {
      "id": 1116126,
      "nickname": "player888"
    },
    "player_count": 1,
    "history": {
      "history": [
        [
          1,
          -1,
          -1,
          0
        ],
        [
          1,
          -1,
          -1,
          0
        ],
        [
          -1,
          1,
          -1,
          0
        ],
        [
          -1,
          1,
          -1,
          0
        ],
        [
          -1,
          1,
          -1,
          0
        ],
      
      "win_ratio": [
        50,
        44,
        5
      ],
      "count_win": [
        29,
        26,
        3
      ],
      "good_road": 0,
      "good_road_name": "沒有"
    },
    "room_chips": [
      0,
      0,
      0
    ],
    "bets": [
      0,
      0,
      0
    ],
    "room_remain_chips": [
      20000000000,
      20000000000,
      20000000000
    ],
    "round_uuid": "BDTB1062208230631",
    "bet_ratio": [
      0,虎
      0,龍
    ]
  },
  "err": null
}
```
### Leave

请求参数: 

    {
      "svr": "drogontiger",
      "route": "drogontiger.leave",
      "args": {},
      "cbId": 3
    }
  
返回数据:

    {
      "svr": "",
      "route": "",
      "cbId": 3,
      "args": "成功啦",      
      "err": ""
    }
    
### Bet

请求参数: 

    {
      "svr": "drogontiger",
      "route": "drogontiger.bet",
      "args": {
          "bets":[0,0,100000], // 虎,龍,和,
          "room_id":6
      },
      "cbId": 3
    }
    
返回数据:
  
```
{
  "svr": "",
  "route": "",
  "cbId": 3,
  "args": {
   "room_id": 6,
    "room_chips": [
      130000000,
      0,
      0,
      0
    ],
    "room_remain_chips": [
      19870000000,
      20130000000,
      20000000000,
      20000000000
    ],
    "my_bets": [
      130000000,
      0,
      0,
      0
    ],
    "before_balance": 27855000000,
    "after_balance": 27845000000,
    "bet_ratio": [
      100,
      0
    ]
  },
  "err": null
}

``````
## server -> client

 RestStage
 推送时间: 休息阶段开始
route:"drogontiger.restStage"
```
{
  "svr": "",
  "route": "drogontiger.restStage",
  "cbId": 0,
  "args": {
    "cd": 5,
    "cd_max": 5,
    "msg": "等待開局",
    "round_uuid": "BBJB1022207270313"
  },
  "err": ""
}
```

### RestStageMid

推送时间: 中途加入休息阶段

route:"drogontiger.restStageMid"

```
  {
      "svr": "",
      "route": "drogontiger.restStageMid",
      "cbId": 0,
      "args": {
        "cd": 2,
        "cd_max": 5,
        "msg": "等待開局"
      },
      "err": ""
    }
```

### BetStage
推送时间: 下注阶段开始
route:"drogontiger.restStage"

```
  {
  "svr": "",
  "route": "drogontiger.betStage",
  "cbId": 0,
  "args": {
    "cd": 25,
    "cd_max": 25,
    "msg": "開始下注"
  },
  "err": ""
}
```
### BetStageMid

推送时间: 中途加入下注阶段

route:"dorgontiger.restStageMid"

```
{
  "svr": "",
  "route": "dorgontiger.betStageMid",
  "cbId": 0,
  "args": {
    "cd": 10,
    "cd_max": 25,
    "msg": "開放下注"
  },
  "err": ""
}
```

### HashStage

推送时间: 開始取得哈希

route:"drogontiger.restStage"

    {
      "svr": "",
      "route": "drogontiger.hashStage",
      "cbId": 0,
      "args": {
        "cd": 30,
        "cd_max": 30,
        "msg": "等待哈希值"
      },
      "err": ""
    }
    
### HashStageMid

推送时间: 中途加入取哈希阶段

route:"dorgontiger.restStageMid"

```
    {
      "svr": "",
      "route": "dorgontiger.hashStageMid",
      "cbId": 0,
      "args": {
        "cd": 6,
        "cd_max": 30,
        "msg": "等待哈希值"
      },
      "err": ""
    }
```
### SettleStage

推送时间: 結算

```
{
  "svr": "",
  "route": "drogontiger.settleStage",
  "cbId": 0,
  "args": {
    "cd": 25,
    "cd_max": 25,
    "msg": "結算階段",
    "block_hash": "00000000019e5cb6def9d896731339247c080d6b46de9db8239039fc85e9e372",
    "block_number": 27155638,
    "block_tx_id": "9f67d2cc475219002c4dbc26f8bc55e00c198fd20d6df7b1bc4a41b809de1a1f",
    "Tiger_cards": [
      {
        "code": 40,
        "color": 4,
        "point": 2,
        "value": 2
      }
    ],
     "Drogon_cards": [
      {
        "code": 6,
        "color": 1,
        "point": 7,
        "value": 7
      }
    ],
    "win_area": [
      -1,
      1,
      -1
    ],
    "win_ratio": [
      41, 虎
      51, 龍
      8,  和
    ]
  },
  "err": null
}
```

### SettleStageMid

推送时间: 結算

```
{
  "svr": "",
  "route": "drogontiger.settleStageMid",
  "cbId": 0,
  "args": {
    "cd": 14,
    "cd_max": 25,
    "msg": "结算完成",
    "block_hash": "00000000019b9eec51779bca49e94692d761863dc8c81c92a87fbcaeb568f2b7",
    "block_number": 26975980,
    "block_tx_id": "d35f54ab98749094e2aa2699fcb072f94ee58b2ab0b10dfed2b8524f461d23fe",
    "Drogon_cards": [
      {
        "code": 24,
        "color": 2,
        "point": 12,
        "value": 12
      }
    ],
    "Tiger_cards": [
      {
        "code": 45,
        "color": 4,
        "point": 7,
        "value": 7
      }
    ],
    "win_area": [
      -1,
      1,
      -1
    ],
    "win_ratio": [
      48,
      49,
      3
    ]
  },
  "err": null
}
```
### RoomPlayerCounter

```
   {
      "svr": "",
      "route": "drogontiger.roomPlayerCounter",
      "cbId": 0,
      "args": 1,                           // 人數
      "err": ""
    }
```



### ChangeStage

推送时间: 加入观察者后, 每局切换都以这个做路子

route: "drogontiger.changeStage"


### RoomPlayerBet

```
{
  "svr": "",
  "route": "",
  "cbId": 3,
  "args": {
    "room_chips": [
      10000000,
      0,
      0
    ],
    "self": {
      "id": 1116126,   // 內部ID
      "nickname": "player888"//玩家暱稱
    },
    
    "room_remain_chips": [
      19990000000,
      20010000000,
      20000000000
    ],
    "my_bets": [
      10000000,
      0,
      0
    ],
    "before_balance": 995200000,
    "after_balance": 985200000,
    "bet_ratio": [
      100,
      0
    ]
  },
  "err": null
}
```

### SettleReport

```
返回數據:

{
"svr":"",
"route":"drogontiger.settleReport",
"cbId":0,
"args":{
"id":"BDTB1062208290953-08455549",
"round_uuid":"BDTB1062208290953",
"game_type":18,
"game_code":"BDT",
"game_name":"區塊龍虎",
"room_id":6,
"round":953,
"sub_round":0,
"player_id":8455549,
"dealer_id":0,
"total_bet":100000000,
"you_xiao_tou_zhu":100000000,
"you_xiao_ying_fen":100000000,
"total_winlose":100000000,
"bets":
[
100000000,
0,
0
],
"prepay":0,
"winloses":
[
100000000,
0,
0
],
"date":"",
"created_at":"2022-08-29T16:25:46.066370477+08:00",
"type":1,
"status":1,
"currency":"TWD"},
"err":null
}
```