NON-PRODUCTION

Horus — tài liệu ghép client

Cluster 5 cột × 6 hàng + 3 minigame: Wings of Horus, Falcon Strike, Divine Grace. Có buy minigame. Chip MG chỉ credit khi is_finish. Trang này chỉ serve khi ENVIRONMENT != production.

1. Tổng quan

MụcGiá trị
Grid5 cột × 6 hàng · reels[col][row], cluster 4-neighbor
game_type0 base · 1 Wings · 2 Falcon · 3 Divine
WingsChọn position trên dãy card
FalconTumble + active_cols / pot giữa chừng
DivineOrbs + special symbols, so sánh reels vs end_reels
BuyPOST /buy-minigame {bet, mini_game_type} — board planted, line win không credit
Base path/api/v1
Bắt buộc GET /gameplay. Restore MG từ snapshot wings_of_horus / falcon_strike / divine_grace.

2. Luồng ghép

  1. GET /gameplay — board 5×6, giá 3 MG, snapshot nếu đang dở.
  2. POST /spins. Play win_result[] (cluster tumble).
  3. Nếu is_bonus_game → gọi đúng endpoint theo bonus_game_type tới is_finish.
  4. Buy: /buy-minigame rồi vào MG (line win spin buy không cộng chip).
  5. Chip MG chỉ lấy từ user_money khi is_finish.

3. Auth & envelope

Authorization: Bearer <access_token>
Content-Type: application/json
{
  "code": 0,
  "msg": { ... }
}
codeÝ nghĩa
0OK
-1Unknown / JWT invalid
-2Invalid input
69Wrong state — chưa /gameplay, đang MG
1000Popup i18n (buy không hợp lệ)

4. Grid & symbol

Cluster board 5 cột × 6 hàng. Hàng đầu = row 0.

5
5
2
3
10
5
5
5
4
1
0
11
6
7
8
9
16
2
3
4
1
0
12
6
7
8
9
5
1
0

Ô vàng = cluster High1 (5). 10 Scatter. 11–14 Wings. 16 Sun orb / 17 Sky orb wild.

idSymbol
0–4Low 1–5
5–9High 1–5
10Scatter (trigger MG)
11–14Silver / Epic Silver / Gold / Epic Gold Wings
15Life orb
16Sun orb (wild, cộng count)
17Sky orb (wild, nhân combo)
18Multiplier (Divine)
19Empty rock (Divine)

5. GET /api/v1/gameplay

GET /api/v1/gameplay
FieldTypeClient dùng để
user_money / bet / bets / show_betsChip + bet
pay_tablefloat[][]Paytable cluster
game_typeint0–3 restore MG
init_reelsint[5][6]Preview
wings_of_horus_price / falcon_strike_price / divine_grace_priceint64Hệ số giá buy
wings_of_horusobject?cards[{symbol,multiplier}], spins, multipliers
falcon_strikeobject?active_cols, multipliers, spins, pot, max_spins
divine_graceobject?reels / symbols, multipliers, spins
{
  "code": 0,
  "msg": {
    "user_money": 500000, "bet": 1000,
    "bets": [200, 1000, 2000], "show_bets": [200, 1000, 2000],
    "pay_table": [[50,20,10],[25,10,5],[15,8,4],[10,5,2],[8,3,1.5],[40,15,8],[30,12,6],[20,8,4],[15,6,3],[10,4,2]],
    "game_type": 0,
    "init_reels": [[5,5,0,9,1,8],[5,5,11,0,0,9],[2,5,6,2,12,5],[3,4,7,3,6,1],[10,1,8,4,7,0]],
    "wings_of_horus_price": 80, "falcon_strike_price": 100, "divine_grace_price": 120
  }
}

6. POST /api/v1/spins

POST /api/v1/spins
{ "bet": 1000 }
FieldÝ nghĩa
bet / user_money / win_amountBet, chip, win base (MG chưa credit)
win_resultTumble cluster
is_bonus_game / bonus_game_typeVào MG 1/2/3
wings_of_horus / falcon_strike / divine_graceSnapshot lúc trigger

WinResult / WinLine

FieldÝ nghĩa
linessymbol, positions, win_amount, line_size, multiplier, has_wild, wild_multiplier, active_col_multiplier
reels / positionsBoard trước xóa / ô thắng
win_amount / total_win_amountBước / cộng dồn
special_symbols[{col,row,symbol,multiplier,col_multipliers,affected_cols}]
wild_bonus_multiplier / wild_multiplierHệ số wild
bonus_spins / col_multipliers / active_colsFalcon / Divine extras
{
  "code": 0,
  "msg": {
    "bet": 1000, "user_money": 499000, "win_amount": 6000,
    "is_bonus_game": true, "bonus_game_type": 1,
    "win_result": [{
      "lines": [{ "symbol": 5, "positions": [[0,1],[0,1],[1],[],[]], "win_amount": 6000, "line_size": 5, "multiplier": 8, "has_wild": false, "wild_multiplier": 0, "active_col_multiplier": 1 }],
      "reels": [[5,5,0,9,1,8],[5,5,11,0,0,9],[2,5,6,2,12,5],[3,4,7,3,6,1],[10,1,8,4,7,0]],
      "win_amount": 6000, "total_win_amount": 6000,
      "positions": [[0,1],[0,1],[1],[],[]],
      "wild_bonus_multiplier": 0, "wild_multiplier": 0, "special_symbols": [],
      "active_cols": [0,1,2], "bonus_spins": 0, "col_multipliers": [1,1,1,1,1]
    }],
    "wings_of_horus": { "cards": [{ "symbol": 0, "multiplier": 0 }, { "symbol": 0, "multiplier": 0 }], "spins": 3, "multipliers": [1,1,1,1,1] }
  }
}

7. POST /api/v1/wings-of-horus

POST /api/v1/wings-of-horus
{ "position": 2 }
FieldÝ nghĩa
positionIndex vừa chọn
symbol{symbol, multiplier} lá vừa lật
bonus_spins / spinsLượt cộng / còn lại
multipliersHệ số cột sau bước
is_finish / win_amount / user_moneyHết MG — lúc này mới credit
{
  "code": 0,
  "msg": {
    "position": 2, "symbol": { "symbol": 11, "multiplier": 2 },
    "bonus_spins": 1, "spins": 2, "multipliers": [1, 2, 1, 1, 1],
    "is_finish": false, "win_amount": 0, "user_money": 499000
  }
}

8. POST /api/v1/falcon-strike

POST /api/v1/falcon-strike
{ }
FieldÝ nghĩa
bet / user_money / win_amountChip chỉ tin khi finish
win_resultTumble bước Falcon
potCộng dồn giữa chừng — chưa credit
multipliers / spins / active_colsState cột
is_finishCredit pot
{
  "code": 0,
  "msg": {
    "bet": 1000, "user_money": 499000, "win_amount": 4000,
    "win_result": [], "pot": 12000, "multipliers": [2,2,1,1,1],
    "spins": 3, "active_cols": [true, true, true, false, false], "is_finish": false
  }
}

9. POST /api/v1/divine-grace

POST /api/v1/divine-grace
FieldÝ nghĩa
reels / end_reelsBoard trước / sau bước (Symbol {symbol,multiplier})
multipliersHệ số cột
orbs[{col,row,symbol,multiplier}]
special_symbolsWings affect cột
spins / is_finish / win_amount / user_moneyLoop / credit lúc finish
{
  "code": 0,
  "msg": {
    "reels": [[{ "symbol": 5, "multiplier": 0 }]], "end_reels": [[{ "symbol": 5, "multiplier": 2 }]],
    "multipliers": [2,1,1,1,1],
    "orbs": [{ "col": 0, "row": 1, "symbol": 18, "multiplier": 2 }],
    "special_symbols": [{ "col": 1, "row": 2, "symbol": 11, "multiplier": 2, "col_multipliers": [2,2,1,1,1], "affected_cols": [0,1] }],
    "spins": 2, "is_finish": false, "win_amount": 0, "user_money": 499000
  }
}

10. POST /api/v1/buy-minigame

POST /api/v1/buy-minigame
{ "bet": 1000, "mini_game_type": 2 }

mini_game_type: 1 Wings · 2 Falcon · 3 Divine. Giá = price field × bet. Response gần giống SpinResult: board planted, line win không credit. Rồi vào loop MG.

Nút buy chỉ khi game_type = 0 và đủ chip. Đang MG → code 1000.
{
  "code": 0,
  "msg": {
    "bet": 1000, "user_money": 400000, "win_amount": 0,
    "win_result": [], "is_bonus_game": true, "bonus_game_type": 2,
    "falcon_strike": { "active_cols": [true,true,true,true,true], "multipliers": [1,1,1,1,1], "spins": 5, "pot": 0, "max_spins": 5 }
  }
}

11. Animation

  1. Base: play tumble win_result, highlight cluster, special wings affect cột.
  2. Wings: user tap position, lật symbol, cập nhật multipliers.
  3. Falcon: tumble như base, cột active_cols sáng, cộng pot (chưa chip).
  4. Divine: interpolate reelsend_reels, overlay orbs.
  5. is_finish: cộng chip, về base.
Source of truth tiền MG là user_money lúc is_finish. Giữa chừng chỉ hiện pot / win_amount trên UI.

12. Cheat (chỉ non-prod)

{ "bet": 1000, "reels": [[5,5,0,9,1,8],[5,5,11,0,0,9],[2,5,6,2,12,5],[3,4,7,3,6,1],[10,1,8,4,7,0]] }

Falcon nhận reels cheat tương tự. Production bỏ qua.

13. Error & tiền

Tình huốngHành vi
HTTP 401Relogin
code 69GET /gameplay — restore MG
code 1000Popup buy
HTTP 400 blockedUser đang room PvP
EventChip
Base spin−bet; +win_amount (line)
Buy MG−price; line win planted không credit
MG giữa chừngKhông đổi chip
MG finish+win vào user_money

14. Checklist client