data

package
v0.0.0-...-1488afb Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CurrentParties = Parties{
	Parties: make([]*Party, 0),
}

CurrentParties contains parties created by now.

Functions

This section is empty.

Types

type Parties

type Parties struct {
	Parties []*Party
	// contains filtered or unexported fields
}

Parties contains a thread-safe parties collection.

func (*Parties) AddParty

func (parties *Parties) AddParty(pa *Party)

func (*Parties) GetParties

func (parties *Parties) GetParties() []*Party

func (*Parties) RemoveParty

func (parties *Parties) RemoveParty(pa *Party)

type Party

type Party struct {
	Id            string    `json:"id"`
	Players       []*Player `json:"players"`
	AvgSkill      int       `json:"avg_skill"`
	Size          int       `json:"size"`
	Width         int       `json:"-"`
	Height        int       `json:"-"`
	MapId         string    `json:"map_id"`
	ToConnectById bool      `json:"-"`
	// contains filtered or unexported fields
}

Party represent a thread-safe object with ID, player, skill and game field properties.

func NewParty

func NewParty() Party

NewParty creates a new party with random ID, empty players and skill = 0.

func (*Party) AddPlayer

func (party *Party) AddPlayer(player *Player)

func (*Party) RemovePlayer

func (party *Party) RemovePlayer(p *Player)

type Player

type Player struct {
	Id         uuid.UUID `json:"id"`
	Name       string    `json:"name"`
	Skill      int       `json:"skill"`
	SkillDelta int       `json:"-"`
	Party      *Party    `json:"-"`
	InParty    bool      `json:"-"`
	InProcess  bool      `json:"-"`
	PartyId    string    `json:"-"`
	// contains filtered or unexported fields
}

Player represent a thread-safe object with ID, name, skill and party match-making fields.

func NewPlayer

func NewPlayer() Player

NewPlayer creates a player with skill delta = 2.

func (*Player) FindParty

func (player *Player) FindParty() (*Party, error)

func (*Player) Lock

func (player *Player) Lock()

func (*Player) Unlock

func (player *Player) Unlock()

Jump to

Keyboard shortcuts

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