games

package
v0.0.0-...-db24ddd Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2023 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckAllPlayers

func CheckAllPlayers(g Game) bool

func ClearGame

func ClearGame(channelId string, c cache.Cache) error

func ClearGestures

func ClearGestures(g Game)

func FindTarget

func FindTarget(g Game, selector string) (*wavinghands.Living, error)

func GetCurrentPlayer

func GetCurrentPlayer(g Game, name string) (*wavinghands.Wizard, error)

func PromptForGestures

func PromptForGestures(g Game, event BotGame) error

func SetChannelGame

func SetChannelGame(channelId string, g WHGameData, c cache.Cache) error

Types

type BotGame

type BotGame struct {
	ReplyChannel *model.Channel

	ResponseChannel chan comms.Response
	Cache           cache.Cache
	// contains filtered or unexported fields
}

func (BotGame) Farkle

func (bg BotGame) Farkle(event BotGame) (response Response, err error)

func (BotGame) Help

func (gc BotGame) Help(event BotGame) error

func (BotGame) Rps

func (bg BotGame) Rps(event BotGame) error

func (BotGame) Ttt

func (bg BotGame) Ttt(event BotGame) error

func (BotGame) Wh

func (bg BotGame) Wh(event BotGame) error

type BotGameHelp

type BotGameHelp struct{}

func (BotGameHelp) Ttt

func (h BotGameHelp) Ttt(request BotGame) (response HelpResponse)

type Game

type Game struct {
	Channel *model.Channel
	// contains filtered or unexported fields
}

func NewWavingHands

func NewWavingHands(event BotGame) (Game, error)

func StartWavingHands

func StartWavingHands(event BotGame) (Game, error)

type GameData

type GameData struct {
	Players []users.User  `json:"players,omitempty"`
	Game    ttt.TicTacToe `json:"game"`
}

type Games

type Games struct {
	Mm         *mmclient.MMClient
	Settings   *settings.Settings
	Cache      cache.Cache
	GameTigger string // TODO: This should come from settings
	// contains filtered or unexported fields
}

func NewGames

func NewGames(settings *settings.Settings, mm *mmclient.MMClient, cache cache.Cache) *Games

func (*Games) CallGame

func (g *Games) CallGame(botGame BotGame) (err error)

func (*Games) NewBotGame

func (g *Games) NewBotGame(post string, sender string) (BotGame, error)

type HelpResponse

type HelpResponse struct {
	Description string
	Help        string
}

type Method

type Method struct {
	// contains filtered or unexported fields
}

type Response

type Response struct {
	Message string
	Type    string
	Channel string
}

type TicTacToeGame

type TicTacToeGame struct {
	Data    GameData
	Channel *model.Channel
	Cache   cache.Cache
	Player  string
}

func NewTicTacToeGame

func NewTicTacToeGame(event BotGame) (*TicTacToeGame, error)

func (*TicTacToeGame) CacheGameData

func (tttg *TicTacToeGame) CacheGameData() error

func (*TicTacToeGame) DeleteGameData

func (tttg *TicTacToeGame) DeleteGameData()

func (*TicTacToeGame) GetGameData

func (tttg *TicTacToeGame) GetGameData() (GameData, bool, error)

func (*TicTacToeGame) PrintBoard

func (tttg *TicTacToeGame) PrintBoard() string

func (*TicTacToeGame) PrintHelp

func (tttg *TicTacToeGame) PrintHelp() string

type WHGameData

type WHGameData struct {
	State   string               `json:"state"`
	Players []wavinghands.Wizard `json:"players"`
	Round   int                  `json:"round"`
}

func GetChannelGame

func GetChannelGame(channelId string, c cache.Cache) (WHGameData, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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