types

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

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

Go to latest
Published: Feb 14, 2017 License: MIT Imports: 5 Imported by: 11

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ColorRegex = regexp.MustCompile("([@#][0-6]|@@|##)")

Functions

func Colorize

func Colorize(color Color, text string) string

Wraps the given text in the given color, followed by a color reset

func ProcessColors

func ProcessColors(text string, cm ColorMode) string

Strips MUD color codes and replaces them with ansi color codes

func StripColors

func StripColors(text string) string

Types

type Area

type Area interface {
	Object
	Nameable
}

type AreaList

type AreaList []Area

type Character

type Character interface {
	Object
	Nameable
	Locateable
	Container
	SetRoomId(Id)
	Hit(int)
	Heal(int)
	GetHitPoints() int
	SetHitPoints(int)
	GetHealth() int
	SetHealth(int)
	GetSkills() []Id
	AddSkill(Id)
}

type CharacterList

type CharacterList []Character

func (CharacterList) Names

func (self CharacterList) Names() []string

type Color

type Color string
const (
	ColorRed     Color = "@0"
	ColorGreen   Color = "@1"
	ColorYellow  Color = "@2"
	ColorBlue    Color = "@3"
	ColorMagenta Color = "@4"
	ColorCyan    Color = "@5"
	ColorWhite   Color = "@6"

	ColorDarkRed     Color = "#0"
	ColorDarkGreen   Color = "#1"
	ColorDarkYellow  Color = "#2"
	ColorDarkBlue    Color = "#3"
	ColorDarkMagenta Color = "#4"
	ColorDarkCyan    Color = "#5"
	ColorBlack       Color = "#6"

	ColorGray   Color = "@@"
	ColorNormal Color = "##"
)

type ColorMode

type ColorMode int
const (
	ColorModeLight ColorMode = iota
	ColorModeDark  ColorMode = iota
	ColorModeNone  ColorMode = iota
)

type Communicable

type Communicable interface {
	WriteLine(string, ...interface{})
	Write(string)
	GetInput(prompt string) string
	GetWindowSize() (int, int)
}

type Container

type Container interface {
	AddCash(int)
	RemoveCash(int)
	GetCash() int
	SetCapacity(int)
	GetCapacity() int
}

type Coordinate

type Coordinate struct {
	X int
	Y int
	Z int
}

func (*Coordinate) Next

func (self *Coordinate) Next(direction Direction) Coordinate

type Destroyable

type Destroyable interface {
	Destroy()
	IsDestroyed() bool
}

type Direction

type Direction string
const (
	DirectionNorth     Direction = "North"
	DirectionNorthEast Direction = "NorthEast"
	DirectionEast      Direction = "East"
	DirectionSouthEast Direction = "SouthEast"
	DirectionSouth     Direction = "South"
	DirectionSouthWest Direction = "SouthWest"
	DirectionWest      Direction = "West"
	DirectionNorthWest Direction = "NorthWest"
	DirectionUp        Direction = "Up"
	DirectionDown      Direction = "Down"
	DirectionNone      Direction = "None"
)

func StringToDirection

func StringToDirection(str string) Direction

func (Direction) Opposite

func (self Direction) Opposite() Direction

func (Direction) ToString

func (dir Direction) ToString() string

type Effect

type Effect interface {
	Object
	Nameable
	SetPower(int)
	GetPower() int
	SetCost(int)
	GetCost() int
	GetType() EffectKind
	SetType(EffectKind)
	GetVariance() int
	SetVariance(int)
	GetSpeed() int
	SetSpeed(int)
	GetTime() int
	SetTime(int)
}

type EffectKind

type EffectKind string
const (
	HitpointEffect EffectKind = "hitpoint"
	SilenceEffect  EffectKind = "silence"
	StunEffect     EffectKind = "stun"
)

type EffectList

type EffectList []Effect

func (EffectList) Names

func (self EffectList) Names() []string

type Id

type Id interface {
	String() string
	Hex() string
}

type Identifiable

type Identifiable interface {
	GetId() Id
}

type Item

type Item interface {
	Object
	Container
	GetTemplateId() Id
	GetName() string
	GetValue() int
	SetLocked(bool)
	IsLocked() bool
	GetContainerId() Id
	SetContainerId(Id, Id) bool
}

type ItemList

type ItemList []Item

func (ItemList) Len

func (self ItemList) Len() int

func (ItemList) Less

func (self ItemList) Less(i, j int) bool

func (ItemList) Names

func (self ItemList) Names() []string

func (ItemList) Swap

func (self ItemList) Swap(i, j int)

type Locateable

type Locateable interface {
	GetRoomId() Id
}

type Loginable

type Loginable interface {
	IsOnline() bool
	SetOnline(bool)
}

type NPC

type NPC interface {
	Character
	SetRoaming(bool)
	GetRoaming() bool
	SetConversation(string)
	GetConversation() string
	PrettyConversation() string
}

type NPCList

type NPCList []NPC

func (NPCList) Characters

func (self NPCList) Characters() CharacterList

type Nameable

type Nameable interface {
	GetName() string
	SetName(string)
}

type Object

type Object interface {
	Identifiable
	ReadLockable
	Destroyable
	SetId(Id)
}

type ObjectType

type ObjectType string
const (
	NpcType      ObjectType = "Npc"
	PcType       ObjectType = "Pc"
	SpawnerType  ObjectType = "Spawner"
	UserType     ObjectType = "User"
	ZoneType     ObjectType = "Zone"
	AreaType     ObjectType = "Area"
	RoomType     ObjectType = "Room"
	TemplateType ObjectType = "Template"
	ItemType     ObjectType = "Item"
	SkillType    ObjectType = "Skill"
	EffectType   ObjectType = "Effect"
	StoreType    ObjectType = "Store"
	WorldType    ObjectType = "World"
)

type PC

type PC interface {
	Character
	Loginable
}

type PCList

type PCList []PC

func (PCList) Characters

func (self PCList) Characters() CharacterList

type Purchaser

type Purchaser interface {
	GetId() Id
	AddCash(int)
	RemoveCash(int)
}

type ReadLockable

type ReadLockable interface {
	ReadLock()
	ReadUnlock()
}

type Room

type Room interface {
	Object
	Container
	GetZoneId() Id
	GetAreaId() Id
	SetAreaId(Id)
	GetLocation() Coordinate
	SetExitEnabled(Direction, bool)
	HasExit(Direction) bool
	NextLocation(Direction) Coordinate
	GetExits() []Direction
	GetTitle() string
	SetTitle(string)
	GetDescription() string
	SetDescription(string)
	SetLink(string, Id)
	RemoveLink(string)
	GetLinks() map[string]Id
	LinkNames() []string
	SetLocked(Direction, bool)
	IsLocked(Direction) bool
}

type RoomList

type RoomList []Room

type Skill

type Skill interface {
	Object
	Nameable
	GetEffects() []Id
	AddEffect(Id)
	RemoveEffect(Id)
	HasEffect(Id) bool
}

type SkillList

type SkillList []Skill

func (SkillList) Names

func (self SkillList) Names() []string

type Spawner

type Spawner interface {
	Character
	GetAreaId() Id
	SetCount(int)
	GetCount() int
}

type SpawnerList

type SpawnerList []Spawner

type Store

type Store interface {
	Object
	Nameable
	Container
}

type Template

type Template interface {
	Object
	Nameable
	SetValue(int)
	GetValue() int
	SetWeight(int)
	GetWeight() int
	GetCapacity() int
	SetCapacity(int)
}

type TemplateList

type TemplateList []Template

func (TemplateList) Len

func (self TemplateList) Len() int

func (TemplateList) Less

func (self TemplateList) Less(i, j int) bool

func (TemplateList) Names

func (self TemplateList) Names() []string

func (TemplateList) Swap

func (self TemplateList) Swap(i, j int)

type Time

type Time interface {
	String() string
}

type User

type User interface {
	Object
	Nameable
	Loginable
	Communicable
	VerifyPassword(string) bool
	SetConnection(net.Conn)
	GetConnection() net.Conn
	SetWindowSize(int, int)
	SetTerminalType(string)
	GetTerminalType() string
	GetColorMode() ColorMode
	SetColorMode(ColorMode)
	IsAdmin() bool
	SetAdmin(bool)
}

type UserList

type UserList []User

func (UserList) Len

func (self UserList) Len() int

func (UserList) Less

func (self UserList) Less(i, j int) bool

func (UserList) Swap

func (self UserList) Swap(i, j int)

type World

type World interface {
	GetTime() Time
	AdvanceTime()
}

type Zone

type Zone interface {
	Object
	Nameable
}

type ZoneList

type ZoneList []Zone

Jump to

Keyboard shortcuts

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