103 lines
2.5 KiB
Go
103 lines
2.5 KiB
Go
package models
|
|
|
|
import (
|
|
"encoding/json"
|
|
"sync"
|
|
)
|
|
|
|
var _ = json.RawMessage{}
|
|
var _ = sync.Mutex{}
|
|
|
|
// XLCH rules for the four-player link entries. Sources: MahjongHelpConfig,
|
|
// MahjongConfig and TingHelper in build 4229938. Scores are table points only.
|
|
type MahjongRules4229938 struct {
|
|
Seats []Seat `json:"seats"`
|
|
Actions []Ledger `json:"actions"`
|
|
Events []Event `json:"events"`
|
|
WonTiles []int32 `json:"wonTiles"`
|
|
Banker int32 `json:"banker"`
|
|
ExchangeStep int32 `json:"exchangeStep"`
|
|
BaseScore int32 `json:"baseScore"`
|
|
Wall []int32 `json:"wall"`
|
|
State byte `json:"state"`
|
|
Turn int32 `json:"turn"`
|
|
LastTurn int32 `json:"lastTurn"`
|
|
LastDrawSeat int32 `json:"lastDrawSeat"`
|
|
DrawnTile int32 `json:"drawnTile"`
|
|
Version int32 `json:"version"`
|
|
Round int32 `json:"round"`
|
|
Remaining int32 `json:"remaining"`
|
|
Waiting bool `json:"waiting"`
|
|
PendingTile int32 `json:"pendingTile"`
|
|
PendingSource int32 `json:"pendingSource"`
|
|
RobKong bool `json:"robKong"`
|
|
Offers map[int32]Options `json:"offers"`
|
|
Responses map[int32]any `json:"responses"`
|
|
LastKongs []Ledger `json:"lastKongs"`
|
|
Uninterrupted bool `json:"uninterrupted"`
|
|
AfterKong bool `json:"afterKong"`
|
|
}
|
|
|
|
type Meld struct {
|
|
Source int32 `json:"source"`
|
|
Tile int32 `json:"tile"`
|
|
Selected []int32 `json:"selected"`
|
|
Kind byte `json:"kind"`
|
|
Tiles []int32 `json:"tiles"`
|
|
}
|
|
|
|
type Win struct {
|
|
Pattern byte `json:"pattern"`
|
|
Roots int32 `json:"roots"`
|
|
Fan int32 `json:"fan"`
|
|
Flags int32 `json:"flags"`
|
|
}
|
|
|
|
type Ledger struct {
|
|
Kind byte `json:"kind"`
|
|
Owner int32 `json:"owner"`
|
|
Targets []int32 `json:"targets"`
|
|
Score int32 `json:"score"`
|
|
Tile int32 `json:"tile"`
|
|
Pattern byte `json:"pattern"`
|
|
Roots int32 `json:"roots"`
|
|
Fan int32 `json:"fan"`
|
|
Flags int32 `json:"flags"`
|
|
}
|
|
|
|
type Event struct {
|
|
Kind string `json:"kind"`
|
|
Seat int32 `json:"seat"`
|
|
Tile int32 `json:"tile"`
|
|
Tiles []int32 `json:"tiles"`
|
|
Value int32 `json:"value"`
|
|
Source int32 `json:"source"`
|
|
Seats []int32 `json:"seats"`
|
|
Flags []int32 `json:"flags"`
|
|
Hands [][]int32 `json:"hands"`
|
|
}
|
|
|
|
type Options struct {
|
|
Tile int32 `json:"tile"`
|
|
Hu bool `json:"hu"`
|
|
Discard bool `json:"discard"`
|
|
Peng []Meld `json:"peng"`
|
|
Gang []Meld `json:"gang"`
|
|
}
|
|
|
|
type Seat struct {
|
|
Holds []int32 `json:"holds"`
|
|
Folds []int32 `json:"folds"`
|
|
HuTiles []int32 `json:"huTiles"`
|
|
Melds []Meld `json:"melds"`
|
|
PassedPeng []int32 `json:"passedPeng"`
|
|
Exchange []int32 `json:"exchange"`
|
|
Received []int32 `json:"received"`
|
|
Que byte `json:"que"`
|
|
Score int32 `json:"score"`
|
|
Draws int32 `json:"draws"`
|
|
Discards int32 `json:"discards"`
|
|
HasWon bool `json:"hasWon"`
|
|
}
|
|
|