game

package
v0.0.23 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2021 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Red        = 0
	Blue       = 1
	Green      = 2
	Pink       = 3
	Orange     = 4
	Yellow     = 5
	Black      = 6
	White      = 7
	Purple     = 8
	Brown      = 9
	Cyan       = 10
	Lime       = 11
	Maroon     = 12
	Rose       = 13
	Banana     = 14
	Gray       = 15
	Tan        = 16
	Coral      = 17
	Watermelon = 18
	Chocolate  = 19
	Skyblue    = 20
	Beige      = 21
	Hotpink    = 22
	Turquoise  = 23
	Lilac      = 24
	Rainbow    = 25
	Azure      = 26
)

Color : Int constant mapping

Variables

View Source
var ColorStrings = map[string]int{
	"red":        Red,
	"blue":       Blue,
	"green":      Green,
	"pink":       Pink,
	"orange":     Orange,
	"yellow":     Yellow,
	"black":      Black,
	"white":      White,
	"purple":     Purple,
	"brown":      Brown,
	"cyan":       Cyan,
	"lime":       Lime,
	"maroon":     Maroon,
	"rose":       Rose,
	"banana":     Banana,
	"gray":       Gray,
	"tan":        Tan,
	"coral":      Coral,
	"watermelon": Watermelon,
	"chocolate":  Chocolate,
	"slyblue":    Skyblue,
	"beige":      Beige,
	"hotpink":    Hotpink,
	"turquoise":  Turquoise,
	"lilac":      Lilac,
	"rainbow":    Rainbow,
	"azure":      Azure,
}

ColorStrings for lowercase, possibly for translation if needed

View Source
var MapNames = map[PlayMap]string{
	SKELD:   "Skeld",
	MIRA:    "Mira",
	POLUS:   "Polus",
	DLEKS:   "dlekS",
	AIRSHIP: "Airship",
}
View Source
var NameToPlayMap = map[string]int32{
	"the_skeld": (int32)(SKELD),
	"mira_hq":   (int32)(MIRA),
	"polus":     (int32)(POLUS),
	"dleks":     (int32)(DLEKS),
	"airship":   (int32)(AIRSHIP),
	"NoMap":     -1,
}
View Source
var PhaseNames = map[Phase]PhaseNameString{
	LOBBY:   "LOBBY",
	TASKS:   "TASKS",
	DISCUSS: "DISCUSSION",
	MENU:    "MENU",
}

PhaseNames for lowercase, possibly for translation if needed

Functions

func GetColorStringForInt

func GetColorStringForInt(colorint int) string

GetColorStringForInt does what it sounds like

func IsColorString

func IsColorString(test string) bool

IsColorString determines if a string is actually one of our colors

Types

type GameDelays

type GameDelays struct {
	// maps from origin->new phases, with the integer number of seconds for the delay
	Delays map[PhaseNameString]map[PhaseNameString]int `json:"delays"`
}

GameDelays struct

func MakeDefaultDelays

func MakeDefaultDelays() GameDelays

func (*GameDelays) GetDelay

func (gd *GameDelays) GetDelay(origin, dest Phase) int

type GameResult

type GameResult int16
const (
	HumansByVote GameResult = iota
	HumansByTask
	ImpostorByVote
	ImpostorByKill
	ImpostorBySabotage
	ImpostorDisconnect
	HumansDisconnect
	Unknown
)

type GameRole

type GameRole int16
const (
	CrewmateRole GameRole = iota
	ImposterRole
)

type Gameover

type Gameover struct {
	GameOverReason GameResult   `json:"GameOverReason"`
	PlayerInfos    []PlayerInfo `json:"PlayerInfos"`
}

func (*Gameover) Marshal

func (r *Gameover) Marshal() ([]byte, error)

type Lobby

type Lobby struct {
	LobbyCode string  `json:"LobbyCode"`
	Region    Region  `json:"Region"`
	PlayMap   PlayMap `json:"Map"`
}

type Phase

type Phase int

Phase type

const (
	LOBBY Phase = iota
	TASKS
	DISCUSS
	MENU
	GAMEOVER
	UNINITIALIZED
)

Phase constants

func (*Phase) ToString

func (phase *Phase) ToString() PhaseNameString

ToString for a Phase

type PhaseNameString

type PhaseNameString string

type PlayMap

type PlayMap int
const (
	SKELD PlayMap = iota
	MIRA
	POLUS
	DLEKS // Skeld backwards
	AIRSHIP
	EMPTYMAP PlayMap = 10
)

type Player

type Player struct {
	Action       PlayerAction `json:"Action"`
	Name         string       `json:"Name"`
	Color        int          `json:"Color"`
	IsDead       bool         `json:"IsDead"`
	Disconnected bool         `json:"Disconnected"`
}

Player struct

type PlayerAction

type PlayerAction int
const (
	JOINED PlayerAction = iota
	LEFT
	DIED
	CHANGECOLOR
	FORCEUPDATED
	DISCONNECTED
	EXILED
)

type PlayerInfo

type PlayerInfo struct {
	Name       string `json:"Name"`
	IsImpostor bool   `json:"IsImpostor"`
}

type Region

type Region int
const (
	NA Region = iota
	AS
	EU
)

func (Region) ToString

func (r Region) ToString() string

type VoiceRules

type VoiceRules struct {
	MuteRules map[PhaseNameString]map[string]bool
	DeafRules map[PhaseNameString]map[string]bool
}

func MakeMuteAndDeafenRules

func MakeMuteAndDeafenRules() VoiceRules

func (*VoiceRules) GetVoiceState

func (rules *VoiceRules) GetVoiceState(isAlive, isTracked bool, phase Phase) (bool, bool)

Jump to

Keyboard shortcuts

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