player

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2018 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type List

type List struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewList

func NewList() *List

func (*List) Add

func (ps *List) Add(p Player)

func (*List) Count

func (ps *List) Count() int

func (*List) FindByName

func (ps *List) FindByName(name string) Player

func (*List) GetAll

func (ps *List) GetAll() []Player

func (*List) Iter

func (ps *List) Iter(routine func(Player))

func (*List) Remove

func (ps *List) Remove(p Player)

type Player

type Player interface {
	Send(innerMessage interface{}) error
	GetName() string
	AddInventory(instance *object.Instance) error
	RemoveInventory(instance *object.Instance) error
	GetInventoryByName(definitionId string) (*object.Instance, bool)
	GetInventoryById(id uuid.UUID) (*object.Instance, bool)
	GetAllInventory() []*object.Instance
	FindInventory(target string) (*object.Instance, bool)
	Slots() *object.Slots
	GetCurrentHealth() int
	GetMaxHealth() int
}

see https://play.golang.org/p/zPLyr3ZOM0 (first attempt) then see https://play.golang.org/p/z5athD5fV3 (client is an interface, but now pointer woes) noinspection GoNameStartsWithPackageName

type PlayerInventory

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

noinspection GoNameStartsWithPackageName

func NewPlayerInventory

func NewPlayerInventory() *PlayerInventory

func (*PlayerInventory) Add

func (pi *PlayerInventory) Add(inst *object.Instance) error

func (*PlayerInventory) Find

func (pi *PlayerInventory) Find(target string) (*object.Instance, bool)

func (*PlayerInventory) GetAll

func (pi *PlayerInventory) GetAll() (result []*object.Instance)

func (*PlayerInventory) GetByInstanceId

func (pi *PlayerInventory) GetByInstanceId(id uuid.UUID) (inst *object.Instance, exists bool)

func (*PlayerInventory) GetByName

func (pi *PlayerInventory) GetByName(name string) (inst *object.Instance, exists bool)

func (*PlayerInventory) GetByNameOrAlias

func (pi *PlayerInventory) GetByNameOrAlias(target string) (inst *object.Instance, exists bool)

func (*PlayerInventory) Remove

func (pi *PlayerInventory) Remove(inst *object.Instance) error

type TestPlayer

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

func NewTestPlayer

func NewTestPlayer(name string) *TestPlayer

create a new test player that can track sent messages through 'sentmessages'

func (*TestPlayer) AddInventory

func (p *TestPlayer) AddInventory(instance *object.Instance) error

func (*TestPlayer) FindInventory

func (p *TestPlayer) FindInventory(target string) (*object.Instance, bool)

func (*TestPlayer) GetAllInventory

func (p *TestPlayer) GetAllInventory() []*object.Instance

func (*TestPlayer) GetCurrentHealth

func (p *TestPlayer) GetCurrentHealth() int

func (*TestPlayer) GetInventoryById

func (p *TestPlayer) GetInventoryById(id uuid.UUID) (*object.Instance, bool)

func (*TestPlayer) GetInventoryByName

func (p *TestPlayer) GetInventoryByName(name string) (*object.Instance, bool)

func (*TestPlayer) GetMaxHealth

func (p *TestPlayer) GetMaxHealth() int

func (*TestPlayer) GetName

func (p *TestPlayer) GetName() string

func (*TestPlayer) GetSentResponse

func (p *TestPlayer) GetSentResponse(i int) interface{}

func (*TestPlayer) RemoveInventory

func (p *TestPlayer) RemoveInventory(instance *object.Instance) error

func (*TestPlayer) Send

func (p *TestPlayer) Send(msg interface{}) error

func (*TestPlayer) SentMessageCount

func (p *TestPlayer) SentMessageCount() int

func (TestPlayer) Slots

func (p TestPlayer) Slots() *object.Slots

Jump to

Keyboard shortcuts

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