hero

package
v0.0.0-...-7279c54 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2013 License: BSD-3-Clause Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const CryptoCost = bcrypt.DefaultCost

Variables

This section is empty.

Functions

func PlayerDisconnected

func PlayerDisconnected(p *Player)

func SaveAllPlayers

func SaveAllPlayers()

func SavePlayer

func SavePlayer(p *Player)

Types

type CraftItemType

type CraftItemType uint64
const (
	CraftLongHandle CraftItemType = iota
	CraftShortHandle
	CraftGrip
	CraftPommelCross
	CraftHilt
	CraftMaceHead
	CraftChain
	CraftHatchetHead
	CraftPickaxeHead
	CraftAxeHead
	CraftHammerHead
	CraftSpearHead
	CraftHalberdBlade
	CraftKnifeBlade
	CraftDaggerBlade
	CraftShortBlade
	CraftLongBlade
	CraftBroadBlade
	CraftThinBlade
	CraftHandleChain
	CraftMace
	CraftFlail
	CraftHatchet
	CraftPickaxe
	CraftBattleaxe
	CraftPoleaxe
	CraftWarhammer
	CraftSpear
	CraftHalberd
	CraftKnife
	CraftDagger
	CraftShortsword
	CraftLongsword
	CraftBroadsword
	CraftRapier
	CraftSwordChain
	CraftSwordChucks
)

type Equip

type Equip struct {
	world.VisibleObject
	// contains filtered or unexported fields
}

func (*Equip) Actions

func (e *Equip) Actions(player world.PlayerLike) []string

func (*Equip) AdminOnly

func (e *Equip) AdminOnly() bool

func (*Equip) AnimationType

func (e *Equip) AnimationType() string

func (*Equip) Colors

func (e *Equip) Colors() []string

func (*Equip) Examine

func (e *Equip) Examine() (string, [][][2]string)

func (*Equip) Interact

func (e *Equip) Interact(player world.PlayerLike, action string)

func (*Equip) Load

func (e *Equip) Load(version uint, data interface{}, attached []world.ObjectLike)

func (*Equip) Name

func (e *Equip) Name() string

func (*Equip) Quality

func (e *Equip) Quality() *big.Int

func (*Equip) Save

func (e *Equip) Save() (uint, interface{}, []world.ObjectLike)

func (*Equip) Scale

func (e *Equip) Scale() uint

func (*Equip) Sprite

func (e *Equip) Sprite() string

func (*Equip) SpritePos

func (e *Equip) SpritePos() (uint, uint)

func (*Equip) SpriteSize

func (e *Equip) SpriteSize() (uint, uint)

func (*Equip) Stat

func (e *Equip) Stat(stat world.Stat) *big.Int

func (*Equip) Volume

func (e *Equip) Volume() uint64

func (*Equip) Weight

func (e *Equip) Weight() uint64

type EquipSlot

type EquipSlot uint16
const (
	SlotHead EquipSlot = iota
	SlotShirt
	SlotPants
	SlotFeet
	SlotShoulders
	SlotChest
	SlotArms
	SlotHands
	SlotWaist
	SlotLegs
	SlotMainHand
	SlotOffHand
	SlotPickaxe
	SlotHatchet
)

type Gender

type Gender uint64
const (
	GenderMale Gender = iota
	GenderFemale
)

func (Gender) Name

func (g Gender) Name() string

type HUD

type HUD struct {
	Name string                 `json:"N"`
	Data map[string]interface{} `json:"D,omitempty"`
}

type Hero

type Hero struct {
	world.CombatObject
	// contains filtered or unexported fields
}

func GenerateHero

func GenerateHero(r *rand.Rand) *Hero

func GenerateHeroOccupation

func GenerateHeroOccupation(r *rand.Rand, race Race, occupation Occupation) *Hero

func GenerateHeroRace

func GenerateHeroRace(r *rand.Rand, race Race) *Hero

func (*Hero) AnimationType

func (h *Hero) AnimationType() string

func (*Hero) Attached

func (h *Hero) Attached() []world.Visible

func (*Hero) Colors

func (h *Hero) Colors() []string

func (*Hero) Equip

func (h *Hero) Equip(e *Equip)

func (*Hero) Examine

func (h *Hero) Examine() (string, [][][2]string)

func (*Hero) Gender

func (h *Hero) Gender() Gender

func (*Hero) GetEquip

func (h *Hero) GetEquip(slot EquipSlot) *Equip

func (*Hero) GiveItem

func (h *Hero) GiveItem(item world.Visible) bool

func (*Hero) Inventory

func (h *Hero) Inventory() []world.Visible

func (*Hero) Load

func (h *Hero) Load(version uint, data interface{}, attached []world.ObjectLike)

func (*Hero) MaxHealth

func (h *Hero) MaxHealth() *big.Int

func (*Hero) MaxQuality

func (h *Hero) MaxQuality() *big.Int

func (*Hero) Name

func (h *Hero) Name() string

func (*Hero) NotifyPosition

func (h *Hero) NotifyPosition(old, new *world.Tile)

func (*Hero) Occupation

func (h *Hero) Occupation() Occupation

func (*Hero) Race

func (h *Hero) Race() Race

func (*Hero) RemoveItem

func (h *Hero) RemoveItem(item world.Visible) bool

func (*Hero) Save

func (h *Hero) Save() (uint, interface{}, []world.ObjectLike)

func (*Hero) Sprite

func (h *Hero) Sprite() string

func (*Hero) SpritePos

func (h *Hero) SpritePos() (uint, uint)

func (*Hero) SpriteSize

func (h *Hero) SpriteSize() (uint, uint)

func (*Hero) Stat

func (h *Hero) Stat(stat world.Stat) *big.Int

func (*Hero) Think

func (h *Hero) Think()

func (*Hero) Unequip

func (h *Hero) Unequip(slot EquipSlot)

type HeroLike

type HeroLike interface {
	world.Combat

	Race() Race
	Gender() Gender
	Occupation() Occupation

	Equip(*Equip)
	Unequip(EquipSlot)
	GetEquip(EquipSlot) *Equip
	world.InventoryLike
	// contains filtered or unexported methods
}

type HeroName

type HeroName struct {
	FirstT NameSubtype
	First  uint64

	Nickname string

	Last1T NameSubtype
	Last1  uint64
	Last2T NameSubtype
	Last2  uint64
	Last3T NameSubtype
	Last3  uint64

	PrefixT NameSubtype
	Prefix  uint64

	SuffixT NameSubtype
	Suffix  uint64
}

func GenerateHumanName

func GenerateHumanName(r *rand.Rand, gender Gender) HeroName

GenerateHumanName randomly generates a name suitable for a human. The first name is chosen from a gender-specific list. There is a 3% chance of no surname. For the other 97% of names, 25% have a surname beginning with a male first name and ending with "son". An additional 5% have a surname of a single English word, such as "smith" or "cook". The remaining 70% have a surname generated from two syllables.

func (*HeroName) Name

func (n *HeroName) Name() string

Name converts a numeric HeroName into a human-readable string. If Name would return an empty string, it instead returns the string "unknown".

type LoginPacket

type LoginPacket struct {
	Login string `json:"U"`
	Pass  string `json:"P"`
}

type Message

type Message struct {
	Text  string `json:"T"`
	Color string `json:"C"`
}

type NameSubtype

type NameSubtype uint64
const (
	NameUtil NameSubtype = iota
	NameMaleHuman
	NameFemaleHuman
	NameSurnameConsonant
	NameSurnameVowel
	NameFrontSyllableConsonant
	NameEndConsonant
	NameEndVowel
	NameTitlePrefix
	NameTitleSuffix
)

type Occupation

type Occupation uint64
const (
	OccupationAdventurer Occupation = iota
	OccupationCitizen
	OccupationKnight
)

type Player

type Player struct {
	Hero
	// contains filtered or unexported fields
}

func Login

func Login(addr string, packet *LoginPacket) (*Player, string)

Login returns a non-nil player and an empty error string OR a nil player and an error to show to the user.

func (*Player) Actions

func (p *Player) Actions(player world.PlayerLike) []string

func (*Player) AdminCommand

func (p *Player) AdminCommand(addr string, command ...string)

func (*Player) AnimationType

func (p *Player) AnimationType() string

func (*Player) Attached

func (p *Player) Attached() []world.Visible

func (*Player) CanSpawn

func (p *Player) CanSpawn() bool

func (*Player) CharacterCreation

func (p *Player) CharacterCreation(command string)

func (*Player) Chat

func (p *Player) Chat(addr, message string)

func (*Player) ClearHUD

func (p *Player) ClearHUD()

func (*Player) Colors

func (p *Player) Colors() []string

func (*Player) Die

func (p *Player) Die()

func (*Player) Examine

func (p *Player) Examine() (string, [][][2]string)

func (*Player) Impersonate

func (p *Player) Impersonate(o world.Visible)

func (*Player) InitPlayer

func (p *Player) InitPlayer() (kick <-chan string, hud <-chan HUD, inventory <-chan []world.Visible, messages <-chan []Message)

func (*Player) Instance

func (p *Player) Instance(pos *world.Tile) world.Instance

func (*Player) IsAdmin

func (p *Player) IsAdmin() bool

func (*Player) Kick

func (p *Player) Kick(message string)

func (*Player) Load

func (p *Player) Load(version uint, data interface{}, attached []world.ObjectLike)

func (*Player) LoginPosition

func (p *Player) LoginPosition() (int64, uint8, int64, uint8, int8)

func (*Player) Name

func (p *Player) Name() string

func (*Player) NotifyPosition

func (p *Player) NotifyPosition(old, new *world.Tile)

func (*Player) Save

func (p *Player) Save() (uint, interface{}, []world.ObjectLike)

func (*Player) SaveSelf

func (p *Player) SaveSelf()

func (*Player) Scale

func (p *Player) Scale() uint

func (*Player) SendMessage

func (p *Player) SendMessage(message string)

func (*Player) SendMessageColor

func (p *Player) SendMessageColor(message, color string)

func (*Player) SetHUD

func (p *Player) SetHUD(name string, data map[string]interface{})

func (*Player) Sprite

func (p *Player) Sprite() string

func (*Player) SpritePos

func (p *Player) SpritePos() (uint, uint)

func (*Player) SpriteSize

func (p *Player) SpriteSize() (uint, uint)

func (*Player) Think

func (p *Player) Think()

func (*Player) UpdatePosition

func (p *Player) UpdatePosition()

func (*Player) Volume

func (p *Player) Volume() uint64

func (*Player) VolumeMax

func (p *Player) VolumeMax() uint64

func (*Player) Weight

func (p *Player) Weight() uint64

func (*Player) WeightMax

func (p *Player) WeightMax() uint64

type PlayerAncestry

type PlayerAncestry struct {
	world.Object
	// contains filtered or unexported fields
}

func (*PlayerAncestry) Load

func (a *PlayerAncestry) Load(version uint, data interface{}, attached []world.ObjectLike)

func (*PlayerAncestry) Save

func (a *PlayerAncestry) Save() (uint, interface{}, []world.ObjectLike)

type PlayerInstance

type PlayerInstance struct {
	world.Object
	// contains filtered or unexported fields
}

func (*PlayerInstance) Items

func (pi *PlayerInstance) Items(f func([]world.Visible) []world.Visible)

func (*PlayerInstance) Last

func (pi *PlayerInstance) Last(f func(time.Time) time.Time)

func (*PlayerInstance) Load

func (pi *PlayerInstance) Load(version uint, data interface{}, attached []world.ObjectLike)

func (*PlayerInstance) Save

func (pi *PlayerInstance) Save() (uint, interface{}, []world.ObjectLike)

type PlayerInstances

type PlayerInstances struct {
	world.Object
	// contains filtered or unexported fields
}

func (*PlayerInstances) Get

func (pi *PlayerInstances) Get(pos *world.Tile) world.Instance

func (*PlayerInstances) Load

func (pi *PlayerInstances) Load(version uint, data interface{}, attached []world.ObjectLike)

func (*PlayerInstances) Save

func (pi *PlayerInstances) Save() (uint, interface{}, []world.ObjectLike)

type Race

type Race uint64
const (
	RaceHuman Race = iota
)

func (Race) BaseHealth

func (r Race) BaseHealth() *big.Int

func (Race) Genders

func (r Race) Genders() []Gender

func (Race) Name

func (r Race) Name() string

func (Race) Occupations

func (r Race) Occupations() []Occupation

func (Race) SkinTones

func (r Race) SkinTones() []string

func (Race) Sprite

func (r Race) Sprite() string

func (Race) SpriteSize

func (r Race) SpriteSize() (uint, uint)

Jump to

Keyboard shortcuts

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