model

package
v0.0.0-...-9eed405 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2020 License: MIT Imports: 2 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Apply

func Apply(p *Player, params []string) string

Apply command

func Clothe

func Clothe(p *Player, params []string) string

Clothe command

func Go

func Go(p *Player, params []string) string

Go command: relocate player

func LookAround

func LookAround(p *Player, _ []string) string

LookAround command: description from the location + some else

func Take

func Take(p *Player, params []string) string

Take command

Types

type AbstractLocation

type AbstractLocation struct {
	Location
	// contains filtered or unexported fields
}

AbstractLocation struct

func (*AbstractLocation) AddAvailableLocation

func (a *AbstractLocation) AddAvailableLocation(location Location, barrier BarrierInterface)

AddAvailableLocation add available location

func (*AbstractLocation) AddEntryLocation

func (a *AbstractLocation) AddEntryLocation(location Location)

AddEntryLocation add entry location

func (*AbstractLocation) AvailableLocations

func (a *AbstractLocation) AvailableLocations() []Location

AvailableLocations returns available locations

func (*AbstractLocation) AvailableLocationsNames

func (a *AbstractLocation) AvailableLocationsNames() string

AvailableLocationsNames returns available locations names

func (*AbstractLocation) DeleteInventory

func (a *AbstractLocation) DeleteInventory(inventory *Inventory) bool

DeleteInventory remove inventory

func (*AbstractLocation) Description

func (a *AbstractLocation) Description() string

Description returns description

func (*AbstractLocation) DescriptionAndAvailableLocations

func (a *AbstractLocation) DescriptionAndAvailableLocations() string

DescriptionAndAvailableLocations returns description and available locations

func (*AbstractLocation) GetAvailableLocationFor

func (a *AbstractLocation) GetAvailableLocationFor(locationName string) Location

GetAvailableLocationFor returns matched location

func (*AbstractLocation) GetInventories

func (a *AbstractLocation) GetInventories() []*Inventory

GetInventories returns inventories

func (*AbstractLocation) InventoriesAndAvailableLocations

func (a *AbstractLocation) InventoriesAndAvailableLocations() string

InventoriesAndAvailableLocations returns description and available locations

func (*AbstractLocation) Name

func (a *AbstractLocation) Name() string

Name returns name

type Barrier

type Barrier struct {
	Name string
	// To        Location
	Closed    bool
	CanOpenBy *Inventory
}

Barrier struct

func NewBarrier

func NewBarrier() *Barrier

NewBarrier returns Barrier object

type BarrierInterface

type BarrierInterface interface {
}

BarrierInterface interface

type Furniture

type Furniture struct {
	Name        string
	Description string
	// contains filtered or unexported fields
}

Furniture struct

func NewFurniture

func NewFurniture(name string, description string, inventories []*Inventory) *Furniture

NewFurniture create new furniture

func (*Furniture) Info

func (f *Furniture) Info() string

Info returns information regarding furniture and his inventories

type House

type House struct {
	AbstractLocation
}

House returns location struct

func NewHouse

func NewHouse(name string, description string) *House

NewHouse returns new object

func (*House) EntryLocation

func (h *House) EntryLocation() Location

EntryLocation returns entry location

type Inventory

type Inventory struct {
	Name              string
	Clotheable        bool
	CanAddInventories bool
	Takeable          bool
	ApplicableTo      string
	Inventories       []*Inventory
}

Inventory struct

func NewInventory

func NewInventory(name string, clotheable bool, canAddInventories bool, takeable bool, applicableTo string) *Inventory

NewInventory create new inventory

type Location

type Location interface {
	Name() string
	Description() string
	AvailableLocations() []Location
	AddAvailableLocation(Location, BarrierInterface)
	GetAvailableLocationFor(string) Location
	DescriptionAndAvailableLocations() string
	InventoriesAndAvailableLocations() string
	GetInventories() []*Inventory
	DeleteInventory(*Inventory) bool
	AddEntryLocation(location Location)
	EntryLocation() Location
}

Location interface

type Player

type Player struct {
	Name string

	Location
	// contains filtered or unexported fields
}

Player returns player struct

func NewPlayer

func NewPlayer(name string) Player

NewPlayer create new player

func (*Player) HandleInput

func (p *Player) HandleInput(commandWithParams string) string

HandleInput parsed comand and interected player

type Room

type Room struct {
	AbstractLocation
	// contains filtered or unexported fields
}

Room returns location struct

func NewRoom

func NewRoom(name string, description string, positionDescription string) *Room

NewRoom returns new room object

func (*Room) DescriptionAndAvailableLocations

func (r *Room) DescriptionAndAvailableLocations() string

DescriptionAndAvailableLocations returns room description and available locations

func (*Room) EntryLocation

func (r *Room) EntryLocation() Location

EntryLocation returns entry location

func (*Room) InventoriesAndAvailableLocations

func (r *Room) InventoriesAndAvailableLocations() string

InventoriesAndAvailableLocations returns room description and available locations

type Street

type Street struct {
	AbstractLocation
}

Street returns location struct

func NewStreet

func NewStreet(name string, description string) *Street

NewStreet returns new object

func (*Street) EntryLocation

func (s *Street) EntryLocation() Location

EntryLocation returns entry location

type Task

type Task struct {
	Name     string
	Finished bool
}

Task struct

func NewTask

func NewTask(name string) *Task

NewTask create new task

Jump to

Keyboard shortcuts

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