Documentation ¶
Index ¶
- Constants
- Variables
- func AddPlayResult(pr *PlayResult, stake Stake, results []*sgc7game.PlayResult)
- func AddWinResult(pr *PlayResult, stake Stake, playResult *sgc7game.PlayResult) error
- func BuildIPlayerState(ips sgc7game.IPlayerState, ps *PlayerState) error
- func BuildPlayerStateString(ps sgc7game.IPlayerState) (string, error)
- func BuildStake(stake Stake) *sgc7game.Stake
- func Checksum(fn string) (string, error)
- func ParsePlayerState(str string, ps *PlayerState) error
- func SaveGATIGameInfo(gi *GATIGameInfo, fn string) error
- type AnalyticEvent
- type AnalyticsData
- type BasicMissionBoostData
- type BasicMissionBoostDataMap
- type BasicMissionState
- type BasicMissionStateMap
- type BasicService
- func (sv *BasicService) Checksum(lst []*CriticalComponent) ([]*ComponentChecksum, error)
- func (sv *BasicService) Config() *sgc7game.Config
- func (sv *BasicService) Evaluate(params *EvaluateParams, id string) (*EvaluateResult, error)
- func (sv *BasicService) GetGameConfig() *GATIGameConfig
- func (sv *BasicService) Initialize() *PlayerState
- func (sv *BasicService) OnPlayBoostData(params *PlayParams, result *PlayResult) error
- func (sv *BasicService) Play(params *PlayParams) (*PlayResult, error)
- func (sv *BasicService) ProcCheat(plugin sgc7plugin.IPlugin, cheat string) error
- func (sv *BasicService) Validate(params *ValidateParams) []ValidationError
- func (sv *BasicService) Version() *VersionInfo
- type Client
- type ComponentChecksum
- type Config
- type CriticalComponent
- type EvaluateParams
- type EvaluateResult
- type GATICriticalComponent
- type GATICriticalComponents
- type GATIGameConfig
- type GATIGameInfo
- type IService
- type Jackpot
- type MissionObject
- type PlayParams
- type PlayResult
- type PlayerState
- type Result
- type ResultEvent
- type Serv
- type Stake
- type ValidateParams
- type ValidationError
- type VersionInfo
Constants ¶
const BasicURL = "/v2/games/"
BasicURL - basic url
Variables ¶
var ( // ErrUnkonow - unknow error ErrUnkonow = errors.New("unknow error") // ErrInvalidPlayerState - invalid PlayerState ErrInvalidPlayerState = errors.New("invalid PlayerState") // ErrInvalidCriticalComponentID - invalid CriticalComponentID ErrInvalidCriticalComponentID = errors.New("invalid CriticalComponentID") // ErrInvalidObjectiveID - invalid ObjectiveID ErrInvalidObjectiveID = errors.New("invalid ObjectiveID") // ErrNonStatusOK - non statusOK ErrNonStatusOK = errors.New("non statusOK") )
Functions ¶
func AddPlayResult ¶
func AddPlayResult(pr *PlayResult, stake Stake, results []*sgc7game.PlayResult)
AddPlayResult - []*sgc7game.PlayResult => *PlayResult
func AddWinResult ¶
func AddWinResult(pr *PlayResult, stake Stake, playResult *sgc7game.PlayResult) error
AddWinResult - add sgc7game.PlayResult
func BuildIPlayerState ¶
func BuildIPlayerState(ips sgc7game.IPlayerState, ps *PlayerState) error
BuildIPlayerState - PlayerState => sgc7game.IPlayerState
func BuildPlayerStateString ¶
func BuildPlayerStateString(ps sgc7game.IPlayerState) (string, error)
BuildPlayerStateString - sgc7game.IPlayerState => string
func BuildStake ¶
BuildStake - PlayerState => sgc7game.IPlayerState
func ParsePlayerState ¶
func ParsePlayerState(str string, ps *PlayerState) error
ParsePlayerState - json => PlayerState
func SaveGATIGameInfo ¶
func SaveGATIGameInfo(gi *GATIGameInfo, fn string) error
SaveGATIGameInfo - save
Types ¶
type AnalyticEvent ¶
AnalyticEvent - analytic event
type AnalyticsData ¶
type AnalyticsData struct { GameEvents []AnalyticEvent `json:"gameEvents"` ResultEvents []ResultEvent `json:"resultEvents"` }
AnalyticsData - analytics data
type BasicMissionBoostData ¶
type BasicMissionBoostData struct { ObjectiveID string `json:"objectiveId"` Counter int `json:"counter"` Arr []int `json:"arr"` Type int `json:"type"` // 0 - counter, 1 - arr }
BasicMissionBoostData -
type BasicMissionBoostDataMap ¶
type BasicMissionBoostDataMap struct {
MapBoostData map[string]*BasicMissionBoostData `json:"mapboostdata"`
}
BasicMissionBoostDataMap -
type BasicMissionState ¶
type BasicMissionState struct { ObjectiveID string `json:"objectiveId"` Goal int `json:"goal"` Current int `json:"current"` Arr []int `json:"arr"` }
BasicMissionState -
type BasicMissionStateMap ¶
type BasicMissionStateMap struct {
MapState map[string]*BasicMissionState `json:"mapstate"`
}
BasicMissionStateMap -
type BasicService ¶
type BasicService struct { Game sgc7game.IGame GameInfo *GATIGameInfo GameConfig *GATIGameConfig }
BasicService - basic service
func NewBasicService ¶
NewBasicService - new a BasicService
func (*BasicService) Checksum ¶
func (sv *BasicService) Checksum(lst []*CriticalComponent) ([]*ComponentChecksum, error)
Checksum - checksum
func (*BasicService) Config ¶
func (sv *BasicService) Config() *sgc7game.Config
Config - get configuration
func (*BasicService) Evaluate ¶
func (sv *BasicService) Evaluate(params *EvaluateParams, id string) (*EvaluateResult, error)
Evaluate -
func (*BasicService) GetGameConfig ¶
func (sv *BasicService) GetGameConfig() *GATIGameConfig
GetGameConfig - get GATIGameConfig
func (*BasicService) Initialize ¶
func (sv *BasicService) Initialize() *PlayerState
Initialize - initialize a player
func (*BasicService) OnPlayBoostData ¶
func (sv *BasicService) OnPlayBoostData(params *PlayParams, result *PlayResult) error
OnPlayBoostData - after call Play
func (*BasicService) Play ¶
func (sv *BasicService) Play(params *PlayParams) (*PlayResult, error)
Play - play game
func (*BasicService) ProcCheat ¶
func (sv *BasicService) ProcCheat(plugin sgc7plugin.IPlugin, cheat string) error
ProcCheat - process cheat
func (*BasicService) Validate ¶
func (sv *BasicService) Validate(params *ValidateParams) []ValidationError
Validate - validate game
type Client ¶
type Client struct {
ServURL string
}
Client - client
func NewClient ¶
NewClient - new Client, servurl is like http://127.0.0.1:7891/v2/games/1019/
func (*Client) Checksum ¶
func (client *Client) Checksum(arr []*CriticalComponent) ([]*ComponentChecksum, error)
Checksum - checksum
func (*Client) Initialize ¶
func (client *Client) Initialize(ps *PlayerState) error
Initialize - initialize a player
type ComponentChecksum ¶
ComponentChecksum -
type CriticalComponent ¶
type CriticalComponent struct { ID int `json:"id"` Name string `json:"name"` Location string `json:"location"` }
CriticalComponent -
type EvaluateParams ¶
type EvaluateParams struct { BoostData []*BasicMissionBoostDataMap `json:"boostData"` State *BasicMissionStateMap `json:"state"` }
EvaluateParams -
type EvaluateResult ¶
type EvaluateResult struct { Progress int `json:"progress"` State *BasicMissionStateMap `json:"state"` }
EvaluateResult -
type GATICriticalComponent ¶
type GATICriticalComponent struct { ID int `json:"id"` Name string `json:"name"` Location string `json:"location"` Filename string `json:"filename"` Checksum string `json:"checksum"` }
GATICriticalComponent -
type GATICriticalComponents ¶
type GATICriticalComponents struct {
Components map[int]*GATICriticalComponent `json:"components"`
}
GATICriticalComponents -
func GenChecksum ¶
func GenChecksum(lst []*GATICriticalComponent) (*GATICriticalComponents, error)
GenChecksum -
type GATIGameConfig ¶
type GATIGameConfig struct {
GameObjectives []*MissionObject `json:"gameObjectives"`
}
GATIGameConfig - game_configuration.json
func LoadGATIGameConfig ¶
func LoadGATIGameConfig(fn string) (*GATIGameConfig, error)
LoadGATIGameConfig - load
type GATIGameInfo ¶
type GATIGameInfo struct { Components map[int]*GATICriticalComponent `json:"components"` Info VersionInfo `json:"info"` }
GATIGameInfo - GATIGameInfo
func LoadGATIGameInfo ¶
func LoadGATIGameInfo(fn string) (*GATIGameInfo, error)
LoadGATIGameInfo - load
func (*GATIGameInfo) FindComponentChecksum ¶
func (gatiGI *GATIGameInfo) FindComponentChecksum(cc *CriticalComponent) *ComponentChecksum
Checksum - checksum
type IService ¶
type IService interface { // Config - get configuration Config() *sgc7game.Config // Initialize - initialize a player Initialize() *PlayerState // Validate - validate game Validate(params *ValidateParams) []ValidationError // Play - play game Play(params *PlayParams) (*PlayResult, error) // Checksum - checksum Checksum(lst []*CriticalComponent) ([]*ComponentChecksum, error) // Version - version Version() *VersionInfo // OnPlayBoostData - after call Play OnPlayBoostData(params *PlayParams, result *PlayResult) error // GetGameConfig - get GATIGameConfig GetGameConfig() *GATIGameConfig // Evaluate - Evaluate(params *EvaluateParams, id string) (*EvaluateResult, error) }
IService - service
type MissionObject ¶
type MissionObject struct { ObjectiveID string `json:"objectiveId"` Description string `json:"description"` Goal int `json:"goal"` Period int `json:"period"` }
MissionObject -
type PlayParams ¶
type PlayParams struct { PlayerState *PlayerState `json:"playerState"` Cheat string `json:"cheat"` Stake Stake `json:"stakeValue"` Params string `json:"clientParams"` Cmd string `json:"command"` JackpotStakeValue float64 `json:"jackpotStakeValue"` FreespinsActive bool `json:"freespinsActive"` JackpotValues map[string]Jackpot `json:"jackpotValues"` }
PlayParams - play input parameters for the game
func ParsePlayParams ¶
func ParsePlayParams(str string, ps *PlayerState) (*PlayParams, error)
ParsePlayParams - string => *PlayParams
type PlayResult ¶
type PlayResult struct { RandomNumbers []*sgc7utils.RngInfo `json:"randomNumbers"` PlayerState *PlayerState `json:"playerState"` JackpotData []string `json:"jackpotData"` Finished bool `json:"finished"` Results []*Result `json:"results"` NextCommands []string `json:"nextCommands"` AnalyticsData *AnalyticsData `json:"analyticsData"` BoostData *BasicMissionBoostDataMap `json:"boostData"` }
PlayResult - play output parameters for the game
func ParsePlayResult ¶
func ParsePlayResult(str string) (*PlayResult, error)
ParsePlayResult - string => *PlayResult
type PlayerState ¶
type PlayerState struct { Public any `json:"playerStatePublic"` Private any `json:"playerStatePrivate"` }
PlayerState - player state
func BuildPlayerState ¶
func BuildPlayerState(ips sgc7game.IPlayerState) (*PlayerState, error)
BuildPlayerState - sgc7game.IPlayerState => PlayerState
type Result ¶
type Result struct { CoinWin int `json:"coinWin"` CashWin float64 `json:"cashWin"` ClientData *sgc7game.PlayResult `json:"clientData"` }
Result - game result
type ResultEvent ¶
type ResultEvent struct { ResultIndex int `json:"resultIndex"` Events []AnalyticEvent `json:"events"` }
ResultEvent - result event
type Stake ¶
type Stake struct { CoinBet float64 `json:"coinBet"` CashBet float64 `json:"cashBet"` Currency string `json:"currency"` }
Stake - stake
type ValidateParams ¶
type ValidateParams struct { PlayerState PlayerState `json:"playerState"` Stake Stake `json:"stakeValue"` Params string `json:"clientParams"` Cmd string `json:"command"` }
ValidateParams - validate input parameters for the game
type ValidationError ¶
type ValidationError struct { ErrorCode int `json:"errorCode"` Reason string `json:"reason"` Data string `json:"data"` }
ValidationError - validate error