server

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: 10 Imported by: 0

Documentation

Index

Constants

View Source
const PULSE_INTERVAL time.Duration = 1 * time.Second // 1 second

Game Server ticks every PULSE_INTERVAL time const PULSE_INTERVAL time.Duration = 100 * time.Millisecond // 0.1 seconds

View Source
const PULSE_MOBILE = 10 * time.Second

Mobs consider doing something once every PULSE_MOBILE time

View Source
const PULSE_ZONE = 1 * time.Minute

zones reset based on their lifetime, check every pulse_zone (lifetime > pulse_zone)

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientPlayer

type ClientPlayer struct {
	Name   string
	Client client.Client
	// contains filtered or unexported fields
}

func NewClientPlayer

func NewClientPlayer(name string, client client.Client) *ClientPlayer

Create a new player and set it up to work with this client

func NewTestClientPlayer

func NewTestClientPlayer(name string) (p *ClientPlayer, cli *client.TestClient)

Create a ClientPlayer connected to a new TestClient (for testing)

func (*ClientPlayer) AddInventory

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

func (*ClientPlayer) FindInventory

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

func (*ClientPlayer) GetAllInventory

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

func (*ClientPlayer) GetCurrentHealth

func (p *ClientPlayer) GetCurrentHealth() int

func (*ClientPlayer) GetInventoryById

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

func (*ClientPlayer) GetInventoryByName

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

func (*ClientPlayer) GetMaxHealth

func (p *ClientPlayer) GetMaxHealth() int

func (*ClientPlayer) GetName

func (p *ClientPlayer) GetName() string

func (*ClientPlayer) RemoveInventory

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

func (*ClientPlayer) Send

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

func (*ClientPlayer) Slots

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

func (*ClientPlayer) String

func (p *ClientPlayer) String() string

type GameServer

type GameServer struct {
	World *world.World
	// contains filtered or unexported fields
}

func NewGameServer

func NewGameServer(worldFilesDirectory string) (gs *GameServer, err error)

func (*GameServer) Logout

func (gs *GameServer) Logout(c client.Client, cause string)

func (*GameServer) Receive

func (gs *GameServer) Receive(msg *gameserver.HandlerParameter)

func (*GameServer) Run

func (gs *GameServer) Run()

noinspection SpellCheckingInspection

type PulseCount

type PulseCount int64

Max value for an int64 is math.MaxInt64 == 9223372036854775807 If PULSE_INTERVAL is 1 nanosecond, the PULSE rollover won't happen for ~29 decades. If for some reason our uptime can be longer than that, the pulse-rollover code should be reinstated.

Jump to

Keyboard shortcuts

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