sgc7game

package
v0.12.156 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 21, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// RTScatter - scatter
	RTScatter = 1
	// RTLine - line
	RTLine = 2
	// RTFullLine - full line
	// 243线游戏,最多会出现243条记录,某些游戏必须要这种方式
	RTFullLine = 3
	// RTFullLineEx - full line ex
	// 全线游戏的汇总记录,243线最多3条记录
	RTFullLineEx = 4
	// RTScatterEx - scatter只计数量
	RTScatterEx = 5
	// RTCluster - cluster,族群方式
	RTCluster = 6
	// RTScatterOnReels - scatter只统计列数
	RTScatterOnReels = 7
	// RTSymbolVal - 直接赔付
	RTSymbolVal = 8
	// RTFreeGame - 奖励FreeGame
	RTFreeGame = 9
)
View Source
const FloatValType string = "floatval"
View Source
const IntArrValType string = "intarrval"
View Source
const IntValType string = "intval"
View Source
const StrValType string = "strval"

Variables

View Source
var (
	// ErrUnkonow - unknow error
	ErrUnkonow = errors.New("unknow error")

	// ErrInvalidReelsName - invalid reels name
	ErrInvalidReelsName = errors.New("invalid reels name")

	// ErrInvalidStake - invalid stake
	ErrInvalidStake = errors.New("invalid stake")

	// ErrDuplicateGameMod - duplicate gamemod
	ErrDuplicateGameMod = errors.New("duplicate gamemod")
	// ErrInvalidGameMod - invalid GameMod
	ErrInvalidGameMod = errors.New("invalid GameMod")
	// ErrInvalidWHGameMod - invalid Width or Height in GameMod
	ErrInvalidWHGameMod = errors.New("invalid Width or Height in GameMod")

	// ErrInvalidCommand - invalid command
	ErrInvalidCommand = errors.New("invalid command")

	// ErrInvalidBasicPlayerState - invalid BasicPlayerState
	ErrInvalidBasicPlayerState = errors.New("invalid BasicPlayerState")
	// ErrInvalidPlayerPublicState - invalid PlayerPublicState
	ErrInvalidPlayerPublicState = errors.New("invalid PlayerPublicState")
	// ErrInvalidPlayerPrivateState - invalid PlayerPrivateState
	ErrInvalidPlayerPrivateState = errors.New("invalid PlayerPrivateState")

	// ErrNonGameModCalcScene - non CalcScene in GameMod
	ErrNonGameModCalcScene = errors.New("non CalcScene in GameMod")
	// ErrNonGameModPayout - non Payout in GameMod
	ErrNonGameModPayout = errors.New("non Payout in GameMod")

	// ErrInvalidWeights - invalid weights
	ErrInvalidWeights = errors.New("invalid weights")

	// ErrNullConfig - null config
	ErrNullConfig = errors.New("null config")

	// ErrInvalidArray - invalid array
	ErrInvalidArray = errors.New("invalid array")

	// ErrInvalidSceneX - invalid scene x
	ErrInvalidSceneX = errors.New("invalid scene x")

	// ErrInvalidReels - invalid reels
	ErrInvalidReels = errors.New("invalid reels")

	// ErrInvalidSymbolWeightReelsSetType1 - invalid settype1 in SymbolWeightReels
	ErrInvalidSymbolWeightReelsSetType1 = errors.New("invalid settype1 in SymbolWeightReels")

	// ErrInvalidSymbolWeightReelsSetType2 - invalid settype2 in SymbolWeightReels
	ErrInvalidSymbolWeightReelsSetType2 = errors.New("invalid settype2 in SymbolWeightReels")

	// ErrInvalidSymbolWeightWidthReels - invalid width in SymbolWeightReels
	ErrInvalidSymbolWeightWidthReels = errors.New("invalid width in SymbolWeightReels")

	// ErrInvalidReelsExcelFile - invalid reels xlsx
	ErrInvalidReelsExcelFile = errors.New("invalid reels xlsx")

	// ErrInvalidParam - invalid param
	ErrInvalidParam = errors.New("invalid param")

	// ErrInvalidValWeights - invalid ValWeights
	ErrInvalidValWeights = errors.New("invalid ValWeights")
	// ErrInvalidValWeightsVal - invalid ValWeights value
	ErrInvalidValWeightsVal = errors.New("invalid ValWeights value")

	// ErrInvalidValMapping - invalid ValMapping
	ErrInvalidValMapping = errors.New("invalid ValMapping")
)
View Source
var InitGameScenePoolSize int

Functions

func DropDownSymbols(scene *GameScene) error

DropDownSymbols - drop down symbols

func DropDownSymbols2(scene *GameScene) error

DropDownSymbols2 - drop down symbols, y0 is at the buttom

func GetPlayResultCurIndex

func GetPlayResultCurIndex(prs []*PlayResult) int

GetPlayResultCurIndex - get current index

func LoadExcel

func LoadExcel(fn string, sheet string, onheader FuncProcHeader, ondata FuncProcData) error

func LoadGameConfig

func LoadGameConfig(fn string, cfg any) error

LoadGameConfig - load configuration

func PlayResult2JSON

func PlayResult2JSON(pr *PlayResult) ([]byte, error)

PlayResult2JSON - PlayResult => json

func RandList

func RandList(plugin sgc7plugin.IPlugin, arr []int, num int) ([]int, error)

RandList - random list

func RandWithWeights

func RandWithWeights(plugin sgc7plugin.IPlugin, max int, arr []int) (int, error)

RandWithWeights - random with the weights

func RemoveSymbolWithResult

func RemoveSymbolWithResult(scene *GameScene, result *PlayResult) error

RemoveSymbolWithResult - remove symbol with win result

func RemoveSymbolWithResult2 added in v0.12.85

func RemoveSymbolWithResult2(scene *GameScene, result *PlayResult, canRemoveResult FuncCanRemoveResult, canRemoveSymbol FuncCanRemoveSymbol) error

RemoveSymbolWithResult2 - remove symbol with win result

Types

type ArrValWeights

type ArrValWeights struct {
	ArrVals   [][]int
	Weights   []int
	MaxWeight int
}

ArrValWeights

func LoadArrValWeightsFromExcel

func LoadArrValWeightsFromExcel(fn string) (*ArrValWeights, error)

LoadArrValWeightsFromExcel - load xlsx file

func NewArrValWeights

func NewArrValWeights(arrvals [][]int, weights []int) (*ArrValWeights, error)

func (*ArrValWeights) RandVal

func (vw *ArrValWeights) RandVal(plugin sgc7plugin.IPlugin) ([]int, error)

type BasicGame

type BasicGame struct {
	Cfg         *Config
	MapGameMods map[string]IGameMod
	MgrPlugins  *sgc7plugin.PluginsMgr
}

BasicGame - basic game

func NewBasicGame

func NewBasicGame(funcNewPlugin sgc7plugin.FuncNewPlugin) *BasicGame

NewBasicGame - new a BasicGame

func (*BasicGame) AddGameMod

func (game *BasicGame) AddGameMod(gmod IGameMod) error

AddGameMod - add a gamemod

func (*BasicGame) CheckStake

func (game *BasicGame) CheckStake(stake *Stake) error

CheckStake - check stake

func (*BasicGame) FreePlugin

func (game *BasicGame) FreePlugin(plugin sgc7plugin.IPlugin)

FreePlugin - free a plugin

func (*BasicGame) GetConfig

func (game *BasicGame) GetConfig() *Config

GetConfig - get config

func (*BasicGame) Initialize

func (game *BasicGame) Initialize() IPlayerState

Initialize - initialize PlayerState

func (*BasicGame) NewGameData

func (game *BasicGame) NewGameData() any

NewGameData - new GameData

func (*BasicGame) NewPlayerState

func (game *BasicGame) NewPlayerState() IPlayerState

NewPlayerState - new playerstate

func (*BasicGame) NewPlugin

func (game *BasicGame) NewPlugin() sgc7plugin.IPlugin

NewPlugin - new a plugin

func (*BasicGame) Play

func (game *BasicGame) Play(plugin sgc7plugin.IPlugin, cmd string, param string, ps IPlayerState, stake *Stake, prs []*PlayResult, gameData any) (*PlayResult, error)

Play - play

func (*BasicGame) ResetConfig

func (game *BasicGame) ResetConfig(cfg any)

ResetConfig

func (*BasicGame) SetVer

func (game *BasicGame) SetVer(ver string)

SetVer - set server version

type BasicGameConfig

type BasicGameConfig struct {
	LineData  string            `yaml:"linedata"`
	PayTables string            `yaml:"paytables"`
	Reels     map[string]string `yaml:"reels"`
}

BasicGameConfig - configuration for basic game

func (BasicGameConfig) Init5

func (bgc BasicGameConfig) Init5(ig IGame) error

Init5 - initial with 5 reels

type BasicGameMod

type BasicGameMod struct {
	Name   string
	Width  int
	Height int
}

BasicGameMod - basic gameMod

func NewBasicGameMod

func NewBasicGameMod(name string, w int, h int) *BasicGameMod

NewBasicGameMod - new a BasicGameMod

func (*BasicGameMod) GetName

func (mod *BasicGameMod) GetName() string

GetName - get mode name

func (*BasicGameMod) NewPlayResult

func (mod *BasicGameMod) NewPlayResult(gamemodparams any) *PlayResult

NewPlayResult - new a PlayResult

func (*BasicGameMod) NewPlayResult2

func (mod *BasicGameMod) NewPlayResult2(gamemodparams any, prs []*PlayResult, parentIndex int, modType string) *PlayResult

NewPlayResult2 - new a PlayResult

func (*BasicGameMod) OnPlay

func (mod *BasicGameMod) OnPlay(game IGame, plugin sgc7plugin.IPlugin, cmd string, param string, ps IPlayerState, stake *Stake, prs []*PlayResult, gameData any) (*PlayResult, error)

OnPlay - on play

func (*BasicGameMod) RandomScene

func (mod *BasicGameMod) RandomScene(game IGame, plugin sgc7plugin.IPlugin, reelsName string, gs *GameScene) (*GameScene, error)

RandomScene - on random scene

type BasicPlayerPrivateState

type BasicPlayerPrivateState struct {
}

BasicPlayerPrivateState - basic PlayerPrivateState

type BasicPlayerPublicState

type BasicPlayerPublicState struct {
	CurGameMod string `json:"curgamemod"`
	NextM      int    `json:"nextm"`
}

BasicPlayerPublicState - basic PlayerPublicState

type BasicPlayerState

type BasicPlayerState struct {
	Public  *BasicPlayerPublicState
	Private *BasicPlayerPrivateState
}

BasicPlayerState - basic PlayerState

func NewBPSNoBoostData

func NewBPSNoBoostData() *BasicPlayerState

NewBPSNoBoostData - new a BasicPlayerState without boostdata

func NewBasicPlayerState

func NewBasicPlayerState(curgamemod string) *BasicPlayerState

NewBasicPlayerState - new BasicPlayerState

func (*BasicPlayerState) GetCurGameMod

func (ps *BasicPlayerState) GetCurGameMod() string

GetCurGameMod - get current game module

func (*BasicPlayerState) GetPrivate

func (ps *BasicPlayerState) GetPrivate() any

GetPrivate - get player private state

func (*BasicPlayerState) GetPrivateJson

func (ps *BasicPlayerState) GetPrivateJson() string

GetPrivateJson - set player private state

func (*BasicPlayerState) GetPublic

func (ps *BasicPlayerState) GetPublic() any

GetPublic - get player public state

func (*BasicPlayerState) GetPublicJson

func (ps *BasicPlayerState) GetPublicJson() string

GetPublicJson - set player public state

func (*BasicPlayerState) SetCurGameMod

func (ps *BasicPlayerState) SetCurGameMod(gamemod string)

SetCurGameMod - set current game module

func (*BasicPlayerState) SetPrivate

func (ps *BasicPlayerState) SetPrivate(pri any) error

SetPrivate - set player private state

func (*BasicPlayerState) SetPrivateJson

func (ps *BasicPlayerState) SetPrivateJson(prijson string) error

SetPrivateJson - set player private state

func (*BasicPlayerState) SetPublic

func (ps *BasicPlayerState) SetPublic(pub any) error

SetPublic - set player public state

func (*BasicPlayerState) SetPublicJson

func (ps *BasicPlayerState) SetPublicJson(pubjson string) error

SetPublicJson - set player public state

type Config

type Config struct {
	Lines         *LineData                     `json:"lines"`
	Reels         map[string]*ReelsData         `json:"reels"`
	PayTables     *PayTables                    `json:"paytables"`
	Width         int                           `json:"width"`
	Height        int                           `json:"height"`
	DefaultScene  *GameScene                    `json:"defaultscene"`
	Ver           string                        `json:"ver"`
	CoreVer       string                        `json:"corever"`
	SWReels       map[string]*SymbolWeightReels `json:"-"`
	DefaultScene2 []*GameScene                  `json:"defaultscene2"`
	BetMuls       []int32                       `json:"betMuls"`
	Data          string                        `json:"data"`
}

Config - config

func NewConfig

func NewConfig() *Config

NewConfig - new a Config

func (*Config) AddDefaultSceneString2

func (cfg *Config) AddDefaultSceneString2(str string) error

AddDefaultSceneString2 - [][]int in json

func (*Config) LoadLine

func (cfg *Config) LoadLine(fn string, reels int) error

LoadLine - load linedata for reels

func (*Config) LoadLine3

func (cfg *Config) LoadLine3(fn string) error

LoadLine3 - load linedata for reels 3

func (*Config) LoadLine5

func (cfg *Config) LoadLine5(fn string) error

LoadLine5 - load linedata for reels 5

func (*Config) LoadLine6

func (cfg *Config) LoadLine6(fn string) error

LoadLine6 - load linedata for reels 6

func (*Config) LoadLineDataFromExcel

func (cfg *Config) LoadLineDataFromExcel(fn string) error

LoadLineDataFromExcel - load linedata for reels

func (*Config) LoadPayTables

func (cfg *Config) LoadPayTables(fn string, reels int) error

LoadPayTables - load paytables for reels

func (*Config) LoadPayTables15

func (cfg *Config) LoadPayTables15(fn string) error

LoadPayTables15 - load paytables for reels 15

func (*Config) LoadPayTables3

func (cfg *Config) LoadPayTables3(fn string) error

LoadPayTables3 - load paytables for reels 3

func (*Config) LoadPayTables5

func (cfg *Config) LoadPayTables5(fn string) error

LoadPayTables5 - load paytables for reels 5

func (*Config) LoadPayTables6

func (cfg *Config) LoadPayTables6(fn string) error

LoadPayTables6 - load paytables for reels 6

func (*Config) LoadPaytablesFromExcel

func (cfg *Config) LoadPaytablesFromExcel(fn string) error

LoadPaytablesFromExcel - load linedata for reels

func (*Config) LoadReels

func (cfg *Config) LoadReels(name string, fn string, reels int) error

LoadReels - load reels for reels

func (*Config) LoadReels3

func (cfg *Config) LoadReels3(name string, fn string) error

LoadReels3 - load reels 3

func (*Config) LoadReels5

func (cfg *Config) LoadReels5(name string, fn string) error

LoadReels5 - load reels 5

func (*Config) LoadReelsFromExcel

func (cfg *Config) LoadReelsFromExcel(tag string, fn string) error

LoadReelsFromExcel - load linedata for reels

func (*Config) LoadSymboloWeightReels

func (cfg *Config) LoadSymboloWeightReels(name string, fn string, reels int) error

LoadSymboloWeightReels - load reels for SymbolWeightReels

func (*Config) SetDefaultSceneString

func (cfg *Config) SetDefaultSceneString(str string) error

SetDefaultSceneString - [][]int in json

type FastReelsRandomSP

type FastReelsRandomSP struct {
	Reels    *ReelsData
	ArrIndex [][]int
}

FastReelsRandomSP - fast random for a special scene, it's like scatter x 5

func NewFastReelsRandomSP

func NewFastReelsRandomSP(reels *ReelsData, onSelectReelIndex FuncOnSelectReelIndex) *FastReelsRandomSP

NewFastReelsRandomSP - new a FastReelsRandomSP

func (*FastReelsRandomSP) Random

func (frr *FastReelsRandomSP) Random(plugin sgc7plugin.IPlugin) ([]int, error)

Random - random

type FloatVal

type FloatVal[T float32 | float64] struct {
	Val T `json:"val"`
}

FloatVal

func (*FloatVal[T]) Float32

func (val *FloatVal[T]) Float32() float32

func (*FloatVal[T]) Float32Arr

func (val *FloatVal[T]) Float32Arr() []float32

Float32Arr - return a []float32

func (*FloatVal[T]) Float64

func (val *FloatVal[T]) Float64() float64

func (*FloatVal[T]) Float64Arr

func (val *FloatVal[T]) Float64Arr() []float64

Float64Arr - return a []float64

func (*FloatVal[T]) GetInt

func (val *FloatVal[T]) GetInt(index int) int

GetInt - return val[index]

func (*FloatVal[T]) Int

func (val *FloatVal[T]) Int() int

func (*FloatVal[T]) Int32

func (val *FloatVal[T]) Int32() int32

func (*FloatVal[T]) Int32Arr

func (val *FloatVal[T]) Int32Arr() []int32

Int32Arr - return a []int32

func (*FloatVal[T]) Int64

func (val *FloatVal[T]) Int64() int64

func (*FloatVal[T]) Int64Arr

func (val *FloatVal[T]) Int64Arr() []int64

Int64Arr - return a []int64

func (*FloatVal[T]) IntArr

func (val *FloatVal[T]) IntArr() []int

IntArr - return a []int

func (*FloatVal[T]) IsSame

func (val *FloatVal[T]) IsSame(right IVal) bool

func (*FloatVal[T]) ParseString

func (val *FloatVal[T]) ParseString(str string) error

func (*FloatVal[T]) String

func (val *FloatVal[T]) String() string

func (*FloatVal[T]) StringArr

func (val *FloatVal[T]) StringArr() []string

StringArr - return a []string

func (*FloatVal[T]) Type

func (val *FloatVal[T]) Type() string

type FloatValMapping

type FloatValMapping[T int, V float32 | float64] struct {
	MapVals map[T]V `json:"mapVals"`
}

FloatValMapping

func LoadFloatValMappingFromExcel

func LoadFloatValMappingFromExcel[T int, V float32 | float64](fn string, headerType string, headerVal string) (*FloatValMapping[T, V], error)

LoadFloatValMappingFromExcel - load xlsx file

func NewFloatValMapping

func NewFloatValMapping[T int, V float32 | float64](typevals []T, vals []V) (*FloatValMapping[T, V], error)

func NewFloatValMappingEx

func NewFloatValMappingEx[T int, V float32 | float64]() *FloatValMapping[T, V]

func (*FloatValMapping[T, V]) Clone

func (vm *FloatValMapping[T, V]) Clone() *FloatValMapping[T, V]

func (*FloatValMapping[T, V]) Keys

func (vm *FloatValMapping[T, V]) Keys() []T

type FuncCalcOtherMul

type FuncCalcOtherMul func(scene *GameScene, result *Result) int

FuncCalcOtherMul - calc other multi

type FuncCalcOtherMulEx

type FuncCalcOtherMulEx func(scene *GameScene, symbol int, pos []int) int

FuncCalcOtherMulEx - calc other multi

type FuncCanRemoveResult added in v0.12.145

type FuncCanRemoveResult func(*Result) bool

type FuncCanRemoveSymbol added in v0.12.85

type FuncCanRemoveSymbol func(x, y int) bool

type FuncCountSymbolExIsSymbol

type FuncCountSymbolExIsSymbol func(cursymbol int, x, y int) bool

FuncCountSymbolExIsSymbol -

type FuncCountSymbolInReel

type FuncCountSymbolInReel func(cursymbol int, scene *GameScene, x int) int

FuncCountSymbolInReel - count symbol nums in a reel

type FuncForEach

type FuncForEach func(x, y int, val int)

FuncForEach - function for ForEach

type FuncGetMulti

type FuncGetMulti func(x, y int) int

FuncGetMulti - get multi

type FuncGetSymbol

type FuncGetSymbol func(cursymbol int) int

FuncGetSymbol - get symbol

type FuncIsInArea added in v0.12.145

type FuncIsInArea func(x, y int) bool

FuncIsInArea - check pos(x, y) is valid

type FuncIsSameSymbol

type FuncIsSameSymbol func(cursymbol int, startsymbol int) bool

FuncIsSameSymbol - cursymbol == startsymbol

type FuncIsSameSymbolEx

type FuncIsSameSymbolEx func(cursymbol int, startsymbol int, scene *GameScene, x, y int) bool

FuncIsSameSymbolEx - cursymbol == startsymbol

type FuncIsScatter

type FuncIsScatter func(scatter int, cursymbol int) bool

FuncIsScatter - cursymbol == scatter

type FuncIsSymbol

type FuncIsSymbol func(cursymbol int) bool

FuncIsSymbol - is symbol

type FuncIsValidSymbol

type FuncIsValidSymbol func(cursymbol int) bool

FuncIsValidSymbol - is it a valid symbol?

type FuncIsValidSymbolEx

type FuncIsValidSymbolEx func(cursymbol int, scene *GameScene, x, y int) bool

FuncIsValidSymbolEx - is it a valid symbol?

type FuncIsWild

type FuncIsWild func(cursymbol int) bool

FuncIsWild - cursymbol == wild

type FuncNewBasicPlayerState

type FuncNewBasicPlayerState func() *BasicPlayerState

FuncNewBasicPlayerState - new BasicPlayerState and set PlayerBoostData

type FuncNewIVal

type FuncNewIVal func() IVal

type FuncOnSelectReelIndex

type FuncOnSelectReelIndex func(reels *ReelsData, x int, y int) []int

FuncOnSelectReelIndex - onSelectReelIndex

type FuncProcData

type FuncProcData func(x int, y int, header string, data string) error

type FuncProcHeader

type FuncProcHeader func(x int, str string) string

type FuncReelsDataPos

type FuncReelsDataPos func(rd *ReelsData, x, y int) bool

主要用于BuildReelsPosData接口

type GameScene

type GameScene struct {
	Arr      [][]int `json:"arr"`
	Width    int     `json:"-"`
	Height   int     `json:"-"`
	Indexes  []int   `json:"-"`
	ValidRow []int   `json:"-"`
	HeightEx []int   `json:"-"`
	ReelName string  `json:"-"`
}

GameScene - game scene

func NewGameScene

func NewGameScene(width int, height int) (*GameScene, error)

NewGameScene - new a GameScene

func NewGameSceneEx

func NewGameSceneEx(heights []int) (*GameScene, error)

NewGameSceneEx - new a GameScene

func NewGameSceneWithArr

func NewGameSceneWithArr(w, h int, arr []int) (*GameScene, error)

NewGameSceneWithArr - new a GameScene

func NewGameSceneWithArr2

func NewGameSceneWithArr2(arr [][]int) (*GameScene, error)

NewGameSceneWithArr2 - new a GameScene

func NewGameSceneWithArr2Ex

func NewGameSceneWithArr2Ex(arr [][]int) (*GameScene, error)

NewGameSceneWithArr2Ex - new a GameScene

func NewGameSceneWithReels

func NewGameSceneWithReels(reels *ReelsData, w, h int, arr []int) (*GameScene, error)

NewGameSceneWithReels - new a GameScene

func (*GameScene) Clear added in v0.10.367

func (gs *GameScene) Clear(s int)

Clear - reset a symbol

func (*GameScene) Clone

func (gs *GameScene) Clone() *GameScene

Clone - clone

func (*GameScene) CloneEx added in v0.10.367

func (gs *GameScene) CloneEx(pool *GameScenePoolEx) *GameScene

Clone - clone

func (*GameScene) CountSymbol

func (gs *GameScene) CountSymbol(s int) int

CountSymbol - count a symbol

func (*GameScene) CountSymbolEx

func (gs *GameScene) CountSymbolEx(issymbol FuncCountSymbolExIsSymbol) int

CountSymbolEx - count a symbol

func (*GameScene) CountSymbols

func (gs *GameScene) CountSymbols(arr []int) []int

CountSymbols - count some symbols

func (*GameScene) Fill

func (gs *GameScene) Fill(reels *ReelsData, arr []int)

Fill - fill with reels and indexs

func (*GameScene) ForEach

func (gs *GameScene) ForEach(funcEach FuncForEach)

ForEach - for each all positions

func (*GameScene) ForEachAround

func (gs *GameScene) ForEachAround(x, y int, funcEachAround FuncForEach)

ForEachAround - for each around positions

func (*GameScene) HasSymbol

func (gs *GameScene) HasSymbol(s int) bool

HasSymbol - has a symbol

func (*GameScene) HasSymbols added in v0.10.285

func (gs *GameScene) HasSymbols(symbols []int) bool

HasSymbols - has symbols

func (*GameScene) Init

func (gs *GameScene) Init(w int, h int) error

Init - init scene

func (*GameScene) InitEx

func (gs *GameScene) InitEx(h []int) error

InitEx - init scene

func (*GameScene) InitWithArr

func (gs *GameScene) InitWithArr(w int, h int, arr []int) error

InitWithArr - init scene

func (*GameScene) InitWithArr2

func (gs *GameScene) InitWithArr2(arr [][]int) error

InitWithArr2 - init scene

func (*GameScene) InitWithArr2Ex

func (gs *GameScene) InitWithArr2Ex(arr [][]int) error

InitWithArr2Ex - init scene

func (*GameScene) RandExpandReelsWithReelData added in v0.10.270

func (gs *GameScene) RandExpandReelsWithReelData(reels *ReelsData, plugin sgc7plugin.IPlugin) error

RandExpandReelsWithReelData - random with reels

func (*GameScene) RandReels

func (gs *GameScene) RandReels(game IGame, plugin sgc7plugin.IPlugin, reelsName string) error

RandReels - random with reels

func (*GameScene) RandReelsEx

func (gs *GameScene) RandReelsEx(game IGame, plugin sgc7plugin.IPlugin, reelsName string, rpd *ReelsPosData, nums int) error

RandReelsEx - random with reels

func (*GameScene) RandReelsEx2

func (gs *GameScene) RandReelsEx2(game IGame, plugin sgc7plugin.IPlugin, reelsName string, rpd0 *ReelsPosData, rpd1 *ReelsPosData, nums int) error

RandReelsEx - random with reels

func (*GameScene) RandReelsEx3

func (gs *GameScene) RandReelsEx3(game IGame, plugin sgc7plugin.IPlugin, reelsName string, rpd0 *ReelsPosData, rpd1 *ReelsPosData, nums int) error

RandReelsEx3 - random with reels

func (*GameScene) RandReelsWithReelData

func (gs *GameScene) RandReelsWithReelData(reels *ReelsData, plugin sgc7plugin.IPlugin) error

RandReels - random with reels

func (*GameScene) ReplaceSymbol

func (gs *GameScene) ReplaceSymbol(src int, dst int)

ReplaceSymbol - replace a symbol

func (*GameScene) ResetReelIndex

func (gs *GameScene) ResetReelIndex(game IGame, reelsName string, x int, index int) error

ResetReelIndex - reset reel with index

某些游戏里,可能会出现重新移动某一轴,这个就是移动某一轴的接口

func (*GameScene) ResetReelIndex2 added in v0.12.155

func (gs *GameScene) ResetReelIndex2(reels *ReelsData, x int, index int) error

ResetReelIndex2 - reset reel with index

某些游戏里,可能会出现重新移动某一轴,这个就是移动某一轴的接口

func (*GameScene) SetReels

func (gs *GameScene) SetReels(game IGame, reelsName string, pos []int) error

SetReels - set reels

type GameScenePoolEx added in v0.10.367

type GameScenePoolEx struct {
	// Lock     sync.Mutex
	MapPools map[int]map[int]*gameScenePool
}

func NewGameScenePoolEx added in v0.10.367

func NewGameScenePoolEx() *GameScenePoolEx

func (*GameScenePoolEx) New added in v0.10.367

func (pool *GameScenePoolEx) New(w, h int, isNeedClear bool) *GameScene

func (*GameScenePoolEx) Put added in v0.10.367

func (pool *GameScenePoolEx) Put(scene *GameScene)

type IGame

type IGame interface {
	// NewPlugin - new a plugin
	NewPlugin() sgc7plugin.IPlugin
	// FreePlugin - free a plugin
	FreePlugin(plugin sgc7plugin.IPlugin)

	// NewPlayerState - new playerstate
	NewPlayerState() IPlayerState
	// SetVer - set server version
	SetVer(ver string)

	// GetConfig - get config
	GetConfig() *Config
	// Initialize - initialize PlayerState
	Initialize() IPlayerState

	// CheckStake - check stake
	CheckStake(stake *Stake) error
	// Play - play
	Play(plugin sgc7plugin.IPlugin, cmd string, param string, ps IPlayerState, stake *Stake, prs []*PlayResult, gameData any) (*PlayResult, error)
	// NewGameData - new GameData
	NewGameData() any

	// AddGameMod - add a gamemod
	AddGameMod(gmod IGameMod) error

	// ResetConfig
	ResetConfig(cfg any)
}

IGame - game

type IGameMod

type IGameMod interface {
	// GetName - get mode name
	GetName() string

	// OnPlay - on play
	OnPlay(game IGame, plugin sgc7plugin.IPlugin, cmd string, param string, ps IPlayerState, stake *Stake, prs []*PlayResult, gameData any) (*PlayResult, error)
}

IGameMod - game

type IPlayerState

type IPlayerState interface {
	// SetPublic - set player public state
	SetPublic(pub any) error
	// SetPrivate - set player private state
	SetPrivate(pri any) error

	// SetPublicJson - set player public state
	SetPublicJson(pub string) error
	// SetPrivateJson - set player private state
	SetPrivateJson(pri string) error

	// GetPublic - get player public state
	GetPublic() any
	// GetPrivate - get player private state
	GetPrivate() any

	// GetPublicJson - set player public state
	GetPublicJson() string
	// GetPrivateJson - set player private state
	GetPrivateJson() string

	// SetCurGameMod - set current game module
	SetCurGameMod(gamemod string)
	// GetCurGameMod - get current game module
	GetCurGameMod() string
}

IPlayerState - player state

type IVal

type IVal interface {
	// Type - get type of IVal
	Type() string

	// ParseString - str -> IVal
	ParseString(str string) error
	// IsSame - return this == right
	IsSame(right IVal) bool

	// Int32 - return a int32
	Int32() int32
	// Int64 - return a int64
	Int64() int64
	// Int - return a int
	Int() int
	// Float32 - return a float32
	Float32() float32
	// Float64 - return a float64
	Float64() float64
	// String - return a string
	String() string

	// Int32Arr - return a []int32
	Int32Arr() []int32
	// Int64Arr - return a []int64
	Int64Arr() []int64
	// IntArr - return a []int
	IntArr() []int
	// Float32Arr - return a []float32
	Float32Arr() []float32
	// Float64Arr - return a []float64
	Float64Arr() []float64
	// StringArr - return a []string
	StringArr() []string

	// GetInt - return val[index]
	GetInt(index int) int
}

IVal

func NewFloatVal

func NewFloatVal[T float32 | float64]() IVal

func NewFloatValEx

func NewFloatValEx[T float32 | float64](v T) IVal

func NewIntArrVal

func NewIntArrVal[T int | int32 | int64]() IVal

func NewIntVal

func NewIntVal[T int | int32 | int64]() IVal

func NewIntValEx

func NewIntValEx[T int | int32 | int64](v T) IVal

func NewStrVal

func NewStrVal() IVal

func NewStrValEx added in v0.12.72

func NewStrValEx(val string) IVal

type IntArrVal

type IntArrVal[T int | int32 | int64] struct {
	Vals []T `json:"vals"`
}

IntArrVal

func (*IntArrVal[T]) Float32

func (val *IntArrVal[T]) Float32() float32

func (*IntArrVal[T]) Float32Arr

func (val *IntArrVal[T]) Float32Arr() []float32

Float32Arr - return a []float32

func (*IntArrVal[T]) Float64

func (val *IntArrVal[T]) Float64() float64

func (*IntArrVal[T]) Float64Arr

func (val *IntArrVal[T]) Float64Arr() []float64

Float64Arr - return a []float64

func (*IntArrVal[T]) GetInt

func (val *IntArrVal[T]) GetInt(index int) int

GetInt - return val[index]

func (*IntArrVal[T]) Int

func (val *IntArrVal[T]) Int() int

func (*IntArrVal[T]) Int32

func (val *IntArrVal[T]) Int32() int32

func (*IntArrVal[T]) Int32Arr

func (val *IntArrVal[T]) Int32Arr() []int32

Int32Arr - return a []int32

func (*IntArrVal[T]) Int64

func (val *IntArrVal[T]) Int64() int64

func (*IntArrVal[T]) Int64Arr

func (val *IntArrVal[T]) Int64Arr() []int64

Int64Arr - return a []int64

func (*IntArrVal[T]) IntArr

func (val *IntArrVal[T]) IntArr() []int

IntArr - return a []int

func (*IntArrVal[T]) IsSame

func (val *IntArrVal[T]) IsSame(right IVal) bool

func (*IntArrVal[T]) ParseString

func (val *IntArrVal[T]) ParseString(str string) error

func (*IntArrVal[T]) String

func (val *IntArrVal[T]) String() string

func (*IntArrVal[T]) StringArr

func (val *IntArrVal[T]) StringArr() []string

StringArr - return a []string

func (*IntArrVal[T]) Type

func (val *IntArrVal[T]) Type() string

type IntVal

type IntVal[T int | int32 | int64] struct {
	Val T `json:"val"`
}

IntVal

func (*IntVal[T]) Float32

func (val *IntVal[T]) Float32() float32

func (*IntVal[T]) Float32Arr

func (val *IntVal[T]) Float32Arr() []float32

Float32Arr - return a []float32

func (*IntVal[T]) Float64

func (val *IntVal[T]) Float64() float64

func (*IntVal[T]) Float64Arr

func (val *IntVal[T]) Float64Arr() []float64

Float64Arr - return a []float64

func (*IntVal[T]) GetInt

func (val *IntVal[T]) GetInt(index int) int

GetInt - return val[index]

func (*IntVal[T]) Int

func (val *IntVal[T]) Int() int

func (*IntVal[T]) Int32

func (val *IntVal[T]) Int32() int32

func (*IntVal[T]) Int32Arr

func (val *IntVal[T]) Int32Arr() []int32

Int32Arr - return a []int32

func (*IntVal[T]) Int64

func (val *IntVal[T]) Int64() int64

func (*IntVal[T]) Int64Arr

func (val *IntVal[T]) Int64Arr() []int64

Int64Arr - return a []int64

func (*IntVal[T]) IntArr

func (val *IntVal[T]) IntArr() []int

IntArr - return a []int

func (*IntVal[T]) IsSame

func (val *IntVal[T]) IsSame(right IVal) bool

func (*IntVal[T]) ParseString

func (val *IntVal[T]) ParseString(str string) error

func (*IntVal[T]) String

func (val *IntVal[T]) String() string

func (*IntVal[T]) StringArr

func (val *IntVal[T]) StringArr() []string

StringArr - return a []string

func (*IntVal[T]) Type

func (val *IntVal[T]) Type() string

type LineData

type LineData struct {
	Lines [][]int `json:"lines"`
}

LineData - line data

func LoadLine3JSON

func LoadLine3JSON(fn string) (*LineData, error)

LoadLine3JSON - load json file

func LoadLine5JSON

func LoadLine5JSON(fn string) (*LineData, error)

LoadLine5JSON - load json file

func LoadLine6JSON

func LoadLine6JSON(fn string) (*LineData, error)

LoadLine6JSON - load json file

func LoadLineDataFromExcel

func LoadLineDataFromExcel(fn string) (*LineData, error)

LoadLineDataFromExcel - load xlsx file

type PayTables

type PayTables struct {
	MapPay     map[int][]int  `json:"paytables"`
	MapSymbols map[string]int `json:"symbols"`
}

PayTables - pay tables

func LoadPayTables15JSON

func LoadPayTables15JSON(fn string) (*PayTables, error)

LoadPayTables15JSON - load json file

func LoadPayTables25JSON

func LoadPayTables25JSON(fn string) (*PayTables, error)

LoadPayTables25JSON - load json file

func LoadPayTables3JSON

func LoadPayTables3JSON(fn string) (*PayTables, error)

LoadPayTables3JSON - load json file

func LoadPayTables5JSON

func LoadPayTables5JSON(fn string) (*PayTables, error)

LoadPayTables5JSON - load json file

func LoadPayTables6JSON

func LoadPayTables6JSON(fn string) (*PayTables, error)

LoadPayTables6JSON - load json file

func LoadPaytablesFromExcel

func LoadPaytablesFromExcel(fn string) (*PayTables, error)

LoadPaytablesFromExcel - load xlsx file

func (*PayTables) GetStringFromInt

func (pt *PayTables) GetStringFromInt(s int) string

type PlayResult

type PlayResult struct {
	CurGameMod       string       `json:"curgamemod"`
	CurGameModParams any          `json:"curgamemodparams"`
	NextGameMod      string       `json:"nextgamemod"`
	Scenes           []*GameScene `json:"scenes"`
	OtherScenes      []*GameScene `json:"otherscenes"`
	PrizeScenes      []*GameScene `json:"prizescenes"`
	PrizeCoinWin     int          `json:"prizecoinwin"`
	PrizeCashWin     int64        `json:"prizecashwin"`
	JackpotCoinWin   int          `json:"jackpotcoinwin"`
	JackpotCashWin   int64        `json:"jackpotcashwin"`
	JackpotType      int          `json:"jackpottype"`
	Results          []*Result    `json:"results"`
	MulPos           []int        `json:"mulpos"`
	NextCmds         []string     `json:"-"`
	NextCmdParams    []string     `json:"-"`
	CoinWin          int          `json:"-"`
	CashWin          int64        `json:"-"`
	IsFinish         bool         `json:"-"`
	IsWait           bool         `json:"-"`
	CurIndex         int          `json:"-"`
	ParentIndex      int          `json:"-"`
	ModType          string       `json:"-"`
}

PlayResult - result for play

func JSON2PlayResult

func JSON2PlayResult(buf []byte, pr *PlayResult) (*PlayResult, error)

JSON2PlayResult - json => PlayResult

func NewPlayResult

func NewPlayResult(curGameMod string, curIndex int, parentIndex int, modType string) *PlayResult

NewPlayResult - new a PlayResult

func (*PlayResult) CountEndingSymbols

func (pr *PlayResult) CountEndingSymbols(symbols []int) []int

CountEndingSymbols - count symbol number

type ReelsData

type ReelsData struct {
	Reels [][]int `json:"reels"`
}

ReelsData - reels data

func LoadReels3JSON

func LoadReels3JSON(fn string) (*ReelsData, error)

LoadReels3JSON - load json file

func LoadReels5JSON

func LoadReels5JSON(fn string) (*ReelsData, error)

LoadReels5JSON - load json file

func LoadReelsFromExcel

func LoadReelsFromExcel(fn string) (*ReelsData, error)

LoadReelsFromExcel - load xlsx file

func LoadReelsFromExcel2

func LoadReelsFromExcel2(fn string, paytables *PayTables) (*ReelsData, error)

LoadReelsFromExcel2 - load xlsx file

func NewReelsData

func NewReelsData(num int) *ReelsData

NewReelsData - new ReelsData

func (*ReelsData) BuildReelsPosData

func (rd *ReelsData) BuildReelsPosData(onpos FuncReelsDataPos) (*ReelsPosData, error)

BuildReelsPosData - 构建轮子坐标数据,一般用于后续的转轮算法,主要起到随机优化效率用

func (*ReelsData) DropDownIntoGameScene

func (rd *ReelsData) DropDownIntoGameScene(scene *GameScene, indexes []int) ([]int, error)

DropDownIntoGameScene - 用轮子当前位置处理下落

注意:
	1. 这个接口需要特别注意,传入indexes是上一次用过的,所以实际用应该-1
	2. 这个接口按道理只会对index做减法操作,所以不会考虑向下越界问题,只处理向上的越界

func (*ReelsData) DropDownIntoGameScene2

func (rd *ReelsData) DropDownIntoGameScene2(scene *GameScene, indexes []int) ([]int, error)

DropDownIntoGameScene2 - 用轮子当前位置处理下落

注意:
	1. 这个接口需要特别注意,传入indexes是上一次用过的,所以实际用应该-1
	2. 这个接口按道理只会对index做减法操作,所以不会考虑向下越界问题,只处理向上的越界

func (*ReelsData) SaveExcel

func (rd *ReelsData) SaveExcel(fn string) error

func (*ReelsData) SaveExcelEx

func (rd *ReelsData) SaveExcelEx(fn string, paytables *PayTables) error

func (*ReelsData) SetReel

func (rd *ReelsData) SetReel(ri int, reel []int)

type ReelsPosData

type ReelsPosData struct {
	ReelsPos [][]int `json:"reelspos"`
}

ReelsPosData - reels position data

func NewReelsPosData

func NewReelsPosData(reels *ReelsData) *ReelsPosData

func (*ReelsPosData) AddPos

func (reelspos *ReelsPosData) AddPos(x, y int)

func (*ReelsPosData) RandReel

func (reelspos *ReelsPosData) RandReel(ctx context.Context, plugin sgc7plugin.IPlugin, x int) (int, error)

type Result

type Result struct {
	Type       ResultType `json:"type"`
	LineIndex  int        `json:"lineindex"`
	Symbol     int        `json:"symbol"`
	Mul        int        `json:"mul"`
	CoinWin    int        `json:"coinwin"`
	CashWin    int        `json:"cashwin"`
	Pos        []int      `json:"pos"`
	OtherMul   int        `json:"othermul"`
	Wilds      int        `json:"wilds"`
	SymbolNums int        `json:"symbolnums"`
	Value      int        `json:"value"`
}

Result - result for slots game

func CalcClusterResult

func CalcClusterResult(scene *GameScene, pt *PayTables, bet int,
	isValidSymbol FuncIsValidSymbol,
	isWild FuncIsWild,
	isSameSymbol FuncIsSameSymbol,
	getSymbol FuncGetSymbol) ([]*Result, error)

CalcClusterResult - cluster

func CalcFullLine

func CalcFullLine(scene *GameScene, pt *PayTables, bet int,
	isValidSymbolEx FuncIsValidSymbolEx,
	isWild FuncIsWild,
	isSameSymbol FuncIsSameSymbol) []*Result

CalcFullLine - calc fullline & no wild in reel0

还是用算线的方式来计算全线游戏,效率会低一些,数据量也会大一些,但某些特殊类型的游戏只能这样计算
也没有考虑第一轴有wild的情况(后续可调整算法)

func CalcFullLineEx

func CalcFullLineEx(scene *GameScene, pt *PayTables, bet int,
	isValidSymbolEx FuncIsValidSymbolEx,
	isWild FuncIsWild,
	isSameSymbol FuncIsSameSymbol) []*Result

CalcFullLineEx - calc fullline & no wild in reel0

用数个数的方式来计算全线游戏,第一轴不能有wild

func CalcFullLineEx2

func CalcFullLineEx2(scene *GameScene, pt *PayTables, bet int,
	isValidSymbolEx FuncIsValidSymbolEx,
	isWild FuncIsWild,
	isSameSymbol FuncIsSameSymbol) []*Result

CalcFullLineEx2 - calc fullline

用数个数的方式来计算全线游戏

func CalcFullLineExWithMulti

func CalcFullLineExWithMulti(scene *GameScene, pt *PayTables, bet int,
	isValidSymbolEx FuncIsValidSymbolEx,
	isWild FuncIsWild,
	isSameSymbol FuncIsSameSymbol,
	getMulti FuncGetMulti) []*Result

CalcFullLineEx - calc fullline & no wild in reel0

用数个数的方式来计算全线游戏,第一轴不能有wild

func CalcLine

func CalcLine(scene *GameScene, pt *PayTables, ld []int, bet int,
	isValidSymbol FuncIsValidSymbol,
	isWild FuncIsWild,
	isSameSymbol FuncIsSameSymbol,
	getSymbol FuncGetSymbol) *Result

CalcLine - calc line

func CalcLine2 added in v0.12.42

func CalcLine2(scene *GameScene, pt *PayTables, ld []int, bet int,
	isValidSymbol FuncIsValidSymbol,
	isWild FuncIsWild,
	isSameSymbol FuncIsSameSymbol,
	getSymbol FuncGetSymbol,
	getMulti FuncGetMulti) *Result

CalcLine2 - calc line

func CalcLineEx

func CalcLineEx(scene *GameScene, pt *PayTables, ld []int, bet int,
	isValidSymbol FuncIsValidSymbol,
	isWild FuncIsWild,
	isSameSymbol FuncIsSameSymbol,
	calcOtherMul FuncCalcOtherMul,
	getSymbol FuncGetSymbol) *Result

CalcLineEx - calc line

func CalcLineOtherMul

func CalcLineOtherMul(scene *GameScene, pt *PayTables, ld []int, bet int,
	isValidSymbol FuncIsValidSymbol,
	isWild FuncIsWild,
	isSameSymbol FuncIsSameSymbol,
	calcOtherMul FuncCalcOtherMulEx,
	getSymbol FuncGetSymbol) *Result

CalcLineOtherMul - calc line with otherMul

func CalcLineRL added in v0.12.16

func CalcLineRL(scene *GameScene, pt *PayTables, ld []int, bet int,
	isValidSymbol FuncIsValidSymbol,
	isWild FuncIsWild,
	isSameSymbol FuncIsSameSymbol,
	getSymbol FuncGetSymbol) *Result

CalcLineRL - calc line with right->left

func CalcLineRL2 added in v0.12.42

func CalcLineRL2(scene *GameScene, pt *PayTables, ld []int, bet int,
	isValidSymbol FuncIsValidSymbol,
	isWild FuncIsWild,
	isSameSymbol FuncIsSameSymbol,
	getSymbol FuncGetSymbol,
	getMulti FuncGetMulti) *Result

CalcLineRL2 - calc line with right->left

func CalcLineRLEx added in v0.12.16

func CalcLineRLEx(scene *GameScene, pt *PayTables, ld []int, bet int,
	isValidSymbol FuncIsValidSymbol,
	isWild FuncIsWild,
	isSameSymbol FuncIsSameSymbol,
	calcOtherMul FuncCalcOtherMul,
	getSymbol FuncGetSymbol) *Result

CalcLineRLEx - calc line with right->left

func CalcScatter

func CalcScatter(scene *GameScene, pt *PayTables, scatter int, bet int, coins int,
	isScatter FuncIsScatter) *Result

CalcScatter - calc scatter

func CalcScatter2

func CalcScatter2(scene *GameScene, pt *PayTables, scatter int, bet int, coins int,
	isScatter FuncIsScatter) *Result

CalcScatter2 - calc scatter

func CalcScatter3

func CalcScatter3(scene *GameScene, pt *PayTables, scatter int, bet int, coins int,
	isScatter FuncIsScatter, isOnlyOneOnReel bool) *Result

CalcScatter3 - calc scatter

func CalcScatter4

func CalcScatter4(scene *GameScene, pt *PayTables, scatter int, bet int,
	isScatter FuncIsScatter, isOnlyOneOnReel bool) *Result

CalcScatter4 - calc scatter

func CalcScatterEx

func CalcScatterEx(scene *GameScene, scatter int, nums int, isScatter FuncIsScatter) *Result

CalcScatterEx - calc scatter

func CalcScatterOnReels

func CalcScatterOnReels(scene *GameScene, scatter int, nums int, isScatter FuncIsScatter) *Result

CalcScatterOnReels - calc scatter

func CountScatterInArea added in v0.12.145

func CountScatterInArea(scene *GameScene, scatter int, nums int, isInArea FuncIsInArea, isScatter FuncIsScatter) *Result

CountScatterInArea - count scatter

type ResultType

type ResultType int

ResultType - result type

type Stake

type Stake struct {
	CoinBet  int64
	CashBet  int64
	Currency string
}

Stake - stake

type StrVal

type StrVal struct {
	Val string `json:"val"`
}

StrVal

func (*StrVal) Float32

func (val *StrVal) Float32() float32

func (*StrVal) Float32Arr

func (val *StrVal) Float32Arr() []float32

Float32Arr - return a []float32

func (*StrVal) Float64

func (val *StrVal) Float64() float64

func (*StrVal) Float64Arr

func (val *StrVal) Float64Arr() []float64

Float64Arr - return a []float64

func (*StrVal) GetInt

func (val *StrVal) GetInt(index int) int

GetInt - return val[index]

func (*StrVal) Int

func (val *StrVal) Int() int

func (*StrVal) Int32

func (val *StrVal) Int32() int32

func (*StrVal) Int32Arr

func (val *StrVal) Int32Arr() []int32

Int32Arr - return a []int32

func (*StrVal) Int64

func (val *StrVal) Int64() int64

func (*StrVal) Int64Arr

func (val *StrVal) Int64Arr() []int64

Int64Arr - return a []int64

func (*StrVal) IntArr

func (val *StrVal) IntArr() []int

IntArr - return a []int

func (*StrVal) IsSame

func (val *StrVal) IsSame(right IVal) bool

func (*StrVal) ParseString

func (val *StrVal) ParseString(str string) error

func (*StrVal) String

func (val *StrVal) String() string

func (*StrVal) StringArr

func (val *StrVal) StringArr() []string

StringArr - return a []string

func (*StrVal) Type

func (val *StrVal) Type() string

type StrValWeights

type StrValWeights struct {
	Vals      []string
	Weights   []int
	MaxWeight int
}

StrValWeights

func LoadStrValWeightsFromExcel

func LoadStrValWeightsFromExcel(fn string) (*StrValWeights, error)

LoadStrValWeightsFromExcel - load xlsx file

func NewStrValWeights

func NewStrValWeights(vals []string, weights []int) (*StrValWeights, error)

func (*StrValWeights) Clone

func (vw *StrValWeights) Clone() *StrValWeights

func (*StrValWeights) CloneExcludeVal

func (vw *StrValWeights) CloneExcludeVal(val string) (*StrValWeights, error)

CloneExcludeVal - clone & exclude a val

func (*StrValWeights) RandIndex

func (vw *StrValWeights) RandIndex(plugin sgc7plugin.IPlugin) (int, error)

func (*StrValWeights) RandVal

func (vw *StrValWeights) RandVal(plugin sgc7plugin.IPlugin) (string, error)

type SymbolWeightReelData

type SymbolWeightReelData struct {
	Symbols    []int
	Weights    []int
	MaxWeights int
}

SymbolWeightReelData - symbol weight reel data

type SymbolWeightReels

type SymbolWeightReels struct {
	Sets  []*SymbolWeightReelsDataSet
	Width int
}

SymbolWeightReels - symbol weight reels

func LoadSymbolWeightReels5JSON

func LoadSymbolWeightReels5JSON(fn string) (*SymbolWeightReels, error)

LoadSymbolWeightReels5JSON - load json file

func (*SymbolWeightReels) RandomScene

func (swr *SymbolWeightReels) RandomScene(gs *GameScene, plugin sgc7plugin.IPlugin, si1 int, si2 int, nocheck bool) error

RandomScene -

type SymbolWeightReelsData

type SymbolWeightReelsData struct {
	Reels []*SymbolWeightReelData
}

SymbolWeightReelsData - symbol weight reels data

type SymbolWeightReelsDataSet

type SymbolWeightReelsDataSet struct {
	Arr []*SymbolWeightReelsData
}

SymbolWeightReelsDataSet - symbol weight reels data

type ValArrMapping

type ValArrMapping[T int, V int | int32 | int64] struct {
	MapVals map[T][]V `json:"mapVals"`
}

ValArrMapping

func LoadValArrMappingFromExcel

func LoadValArrMappingFromExcel[T int, V int | int32 | int64](fn string, headerType string, headerVal string) (*ValArrMapping[T, V], error)

LoadValArrMappingFromExcel - load xlsx file

func NewValArrMapping

func NewValArrMapping[T int, V int | int32 | int64](typevals []T, vals [][]V) (*ValArrMapping[T, V], error)

func NewValArrMappingEx

func NewValArrMappingEx[T int, V int | int32 | int64]() *ValArrMapping[T, V]

func (*ValArrMapping[T, V]) Clone

func (vm *ValArrMapping[T, V]) Clone() *ValArrMapping[T, V]

func (*ValArrMapping[T, V]) Keys

func (vm *ValArrMapping[T, V]) Keys() []T

type ValMapping

type ValMapping[T int, V int | int32 | int64] struct {
	MapVals map[T]V `json:"mapVals"`
}

ValMapping

func LoadValMappingFromExcel

func LoadValMappingFromExcel[T int, V int | int32 | int64](fn string, headerType string, headerVal string) (*ValMapping[T, V], error)

LoadValMappingFromExcel - load xlsx file

func NewValMapping

func NewValMapping[T int, V int | int32 | int64](typevals []T, vals []V) (*ValMapping[T, V], error)

func NewValMappingEx

func NewValMappingEx[T int, V int | int32 | int64]() *ValMapping[T, V]

func (*ValMapping[T, V]) Clone

func (vm *ValMapping[T, V]) Clone() *ValMapping[T, V]

func (*ValMapping[T, V]) Keys

func (vm *ValMapping[T, V]) Keys() []T

type ValMapping2

type ValMapping2 struct {
	MapVals map[int]IVal `json:"mapVals"`
}

ValMapping2

func LoadValMapping2FromExcel

func LoadValMapping2FromExcel(fn string, headerType string, headerVal string, funcNew FuncNewIVal) (*ValMapping2, error)

LoadValMapping2FromExcel - load xlsx file

func NewValMapping2

func NewValMapping2(typevals []int, vals []IVal) (*ValMapping2, error)

func NewValMappingEx2

func NewValMappingEx2() *ValMapping2

func (*ValMapping2) Clone

func (vm *ValMapping2) Clone() *ValMapping2

func (*ValMapping2) IsEmpty

func (vm *ValMapping2) IsEmpty() bool

func (*ValMapping2) Keys

func (vm *ValMapping2) Keys() []int

type ValWeights

type ValWeights struct {
	Vals      []int `json:"vals"`
	Weights   []int `json:"weights"`
	MaxWeight int   `json:"maxWeight"`
}

ValWeights

func LoadValWeightsFromExcel

func LoadValWeightsFromExcel(fn string) (*ValWeights, error)

LoadValWeightsFromExcel - load xlsx file

func NewValWeights

func NewValWeights(vals []int, weights []int) (*ValWeights, error)

func NewValWeightsEx

func NewValWeightsEx() *ValWeights

func (*ValWeights) Add

func (vw *ValWeights) Add(val int, weight int)

func (*ValWeights) ClearExcludeVal

func (vw *ValWeights) ClearExcludeVal(val int)

func (*ValWeights) Clone

func (vw *ValWeights) Clone() *ValWeights

func (*ValWeights) CloneExcludeVal

func (vw *ValWeights) CloneExcludeVal(val int) (*ValWeights, error)

CloneExcludeVal - clone & exclude a val

func (*ValWeights) GetWeight

func (vw *ValWeights) GetWeight(val int) int

func (*ValWeights) RandVal

func (vw *ValWeights) RandVal(plugin sgc7plugin.IPlugin) (int, error)

func (*ValWeights) Reset

func (vw *ValWeights) Reset(vals []int, weights []int)

func (*ValWeights) SortBy

func (vw *ValWeights) SortBy(dst *ValWeights) error

type ValWeights2

type ValWeights2 struct {
	Vals      []IVal `json:"vals"`
	Weights   []int  `json:"weights"`
	MaxWeight int    `json:"maxWeight"`
}

ValWeights2

func LoadValWeights2FromExcel

func LoadValWeights2FromExcel(fn string, headerVal string, headerWeight string, funcNew FuncNewIVal) (*ValWeights2, error)

LoadValWeights2FromExcel - load xlsx file

func LoadValWeights2FromExcelWithSymbols

func LoadValWeights2FromExcelWithSymbols(fn string, headerVal string, headerWeight string, paytables *PayTables) (*ValWeights2, error)

LoadValWeights2FromExcelWithSymbols - load xlsx file

func NewValWeights2

func NewValWeights2(vals []IVal, weights []int) (*ValWeights2, error)

func NewValWeights2Ex

func NewValWeights2Ex() *ValWeights2

func (*ValWeights2) Add

func (vw *ValWeights2) Add(val IVal, weight int)

func (*ValWeights2) ClearExcludeVal

func (vw *ValWeights2) ClearExcludeVal(val IVal)

func (*ValWeights2) Clone

func (vw *ValWeights2) Clone() *ValWeights2

func (*ValWeights2) CloneExcludeVal

func (vw *ValWeights2) CloneExcludeVal(val IVal) (*ValWeights2, error)

CloneExcludeVal - clone & exclude a val

func (*ValWeights2) GetWeight

func (vw *ValWeights2) GetWeight(val IVal) int

func (*ValWeights2) RandVal

func (vw *ValWeights2) RandVal(plugin sgc7plugin.IPlugin) (IVal, error)

func (*ValWeights2) RandValEx

func (vw *ValWeights2) RandValEx(plugin sgc7plugin.IPlugin) (IVal, int, error)

func (*ValWeights2) RemoveVal

func (vw *ValWeights2) RemoveVal(val IVal) error

RemoveVal - remove a val

func (*ValWeights2) Reset

func (vw *ValWeights2) Reset(vals []IVal, weights []int)

func (*ValWeights2) SortBy

func (vw *ValWeights2) SortBy(dst *ValWeights2) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL