commands

package
v0.0.0-...-332bf77 Latest Latest
Warning

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

Go to latest
Published: May 9, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Display

func Display(room *rooms.Room, game def.GameCtrl, message *m.Message) bool

Display ... executes scream command

func Look

func Look(room *rooms.Room, game def.GameCtrl, message *messages.Message) bool

Look ... executes lookat command

Types

type Command

type Command interface {
	Execute(game def.GameCtrl, message *messages.Message) bool
	Key() CommandKey
}

Command ... commands

Commands are usually parsed from player input or sent from other actions, commands usually trigger an immediate result to the originator, the room or another player. Commands can also invoke system messages that lead to other events or commands

type CommandKey

type CommandKey interface {
	Matches(key string, cmd string) bool //parts []string
}

CommandKey is used to differentiate between commands that have parameters or comands (with single or multiple words) without parameters

type CommandProcessor

type CommandProcessor struct {
	Help map[string]string
	// contains filtered or unexported fields
}

CommandProcessor ... global user struct to control logins

func NewCommandProcessor

func NewCommandProcessor() *CommandProcessor

NewCommandProcessor .. creates a new command processor

func (*CommandProcessor) Process

func (commandProcessor *CommandProcessor) Process(game def.GameCtrl, message *messages.Message) bool

Process ...asd

func (*CommandProcessor) RegisterCommand

func (commandProcessor *CommandProcessor) RegisterCommand(command Command, desc string, keys ...string)

RegisterCommand ... register

type ExactCommandKey

type ExactCommandKey struct {
}

ExactCommandKey ...

func (ExactCommandKey) Matches

func (k ExactCommandKey) Matches(key string, cmd string) bool

Matches ...

type HelpCommand

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

HelpCommand ... foo

func (*HelpCommand) Execute

func (command *HelpCommand) Execute(game def.GameCtrl, message *m.Message) bool

Execute ... executes scream command

func (*HelpCommand) Key

func (command *HelpCommand) Key() CommandKey

Key ...

type InventoryCommand

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

InventoryCommand ... foo

func (*InventoryCommand) Execute

func (command *InventoryCommand) Execute(game def.GameCtrl, message *m.Message) bool

Execute ... executes scream command

func (*InventoryCommand) Key

func (command *InventoryCommand) Key() CommandKey

Key ...

type ListCharactersCommand

type ListCharactersCommand struct {
}

ListCharactersCommand ... foo

func (*ListCharactersCommand) Execute

func (command *ListCharactersCommand) Execute(game def.GameCtrl, message *messages.Message) bool

Execute ... executes scream command

func (*ListCharactersCommand) Key

func (command *ListCharactersCommand) Key() CommandKey

Key ...

type NewCharacterCommand

type NewCharacterCommand struct {
}

NewCharacterCommand ...

func (*NewCharacterCommand) Execute

func (command *NewCharacterCommand) Execute(game def.GameCtrl, message *messages.Message) bool

Execute ... executes the command

func (*NewCharacterCommand) Key

func (command *NewCharacterCommand) Key() CommandKey

Key ...

type RoomCommand

type RoomCommand func(room *rooms.Room, game def.GameCtrl, message *messages.Message) bool

RoomCommand ...

func TakeExit

func TakeExit(exit string) RoomCommand

TakeExit ... executes scream command

type RoomProcessor

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

RoomProcessor ... handles room based commands

func NewRoomProcessor

func NewRoomProcessor() *RoomProcessor

NewRoomProcessor .. creates a new room processor

func (*RoomProcessor) Process

func (roomProcessor *RoomProcessor) Process(game def.GameCtrl, message *messages.Message) bool

Process ...asd

func (*RoomProcessor) RegisterCommand

func (roomProcessor *RoomProcessor) RegisterCommand(command RoomCommand, keys ...string)

RegisterCommand ... register

type ScreamCommand

type ScreamCommand struct {
}

ScreamCommand ... foo

func (*ScreamCommand) Execute

func (command *ScreamCommand) Execute(game def.GameCtrl, message *messages.Message) bool

Execute ... executes scream command

func (*ScreamCommand) Key

func (command *ScreamCommand) Key() CommandKey

Key ...

type SelectCharacterCommand

type SelectCharacterCommand struct {
}

SelectCharacterCommand ... select a character

func (*SelectCharacterCommand) Execute

func (command *SelectCharacterCommand) Execute(game def.GameCtrl, message *messages.Message) bool

Execute ... executes scream command

func (*SelectCharacterCommand) Key

func (command *SelectCharacterCommand) Key() CommandKey

Key ...

type ShrugCommand

type ShrugCommand struct {
}

ShrugCommand ... foo

func (*ShrugCommand) Execute

func (command *ShrugCommand) Execute(game def.GameCtrl, message *messages.Message) bool

Execute ... executes scream command

func (*ShrugCommand) Key

func (command *ShrugCommand) Key() CommandKey

Key ...

type StartsWithCommandKey

type StartsWithCommandKey struct {
}

StartsWithCommandKey ...

func (StartsWithCommandKey) Matches

func (k StartsWithCommandKey) Matches(key string, cmd string) bool

Matches ...

type WhoCommand

type WhoCommand struct {
}

WhoCommand ... foo

func (*WhoCommand) Execute

func (command *WhoCommand) Execute(game def.GameCtrl, message *messages.Message) bool

Execute ... executes who command

func (*WhoCommand) Key

func (command *WhoCommand) Key() CommandKey

Key ...

Jump to

Keyboard shortcuts

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