raid

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateEngine

func CreateEngine(dispatcher discord.Dispatcher, config map[string]Config)

Types

type Config

type Config struct {
	// RaidChannelID holds the ID of the channel where raids will be announced
	RaidChannelID string

	// RaidCategoryId holds the ID of the category where lobbies will be created
	RaidCategoryId string
}

Config holds guild configuration

type Engine

type Engine interface {

	// Transaction allows to perform transaction on raid list
	Transaction(fn ExecuteFn, rollback ...RollbackFn) (err error)
}

Engine is the raid engine

type ExecuteFn

type ExecuteFn func(raids RaidList) (err error)

Execute fn is the function to execute in transaction

type Raid

type Raid interface {

	// ID returns the raid ID
	ID() (id string)

	// Lobby returns the raid lobby ID
	Lobby() (lobbyID string)

	// OrganizerID returns the ID of the raid organizer
	OrganizerID() (user string)

	// Level returns the raid level
	Level() (level string)

	// Gym returns the name of the gym where the raid will take place
	Gym() (name string)

	// StartTime returns the raid launch time
	StartTime() (start time.Time)

	// End raid
	End()

	// PlayerCount returns the number of players in the raid
	PlayerCount() (count int)

	// InvitesRemaining returns the number of invites that remain
	InvitesRemaining() (count int)

	// GetLocalPlayers returns the player that will join the raid by their own means
	GetLocalPlayers() (users []string)

	// AddLocalPlayer add a player that will join the raid by its own means
	TryAddLocalPlayer(userID string) (added bool)

	// GetRemotePlayers returns the player that will join the raid remotely
	GetRemotePlayers() (users []string)

	// AddRemotePlayer add a player that will join the raid remotely
	TryAddRemotePlayer(userID string) (added bool)

	// TryRemovePlayer removes a player from the raid
	TryRemovePlayer(userID string) (removed bool)
}

Raid allows to perform operations on raid

type RaidInfo

type RaidInfo struct {

	// ID is the ID of the raid
	ID string

	// LobbyID is the ID of the raid lobby
	LobbyID string

	// OrganizerID is the ID of the raid organizer
	OrganizerID string

	// Level is the raid level
	Level string

	// Gym is the name of the gym where the raid will take place
	Gym string

	// Start is the raid launch time
	Start time.Time
}

type RaidList

type RaidList interface {

	// FindByID returns a raid using its ID
	FindByID(id string) (raid *Raid, ok bool)

	// FindByLobby returns a raid using its lobby
	FindByLobby(lobbyID string) (raid *Raid, ok bool)

	// Create creates a raid
	Create(id, lobbyID string, info RaidInfo)
}

RaidList holds the list of raids

type RollbackFn

type RollbackFn func(raids RaidList)

RollbackFn is the function to execute if an error occurs

Jump to

Keyboard shortcuts

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