Documentation ¶
Overview ¶
Package with game wrapper struct.
Index ¶
- type Character
- func (c *Character) AddChatMessage(message objects.Message)
- func (c *Character) CombatLog() *objects.Log
- func (c *Character) Equip(it item.Equiper) error
- func (c *Character) InSight(x, y float64) bool
- func (c *Character) Name() string
- func (c *Character) PrivateLog() *objects.Log
- func (c *Character) SetDestPoint(x, y float64)
- func (c *Character) SetOnUseFunc(f func(o useaction.Usable))
- func (c *Character) SetPosition(x, y float64)
- func (c *Character) SetTarget(tar effect.Target)
- func (c *Character) Train(training *training.TrainerTraining, trainer training.Trainer)
- func (c *Character) Unequip(it item.Equiper)
- func (c *Character) Usable(id, serial string) useaction.Usable
- func (c *Character) Use(ob useaction.Usable)
- type Game
- func (g *Game) ActivePlayerChar() *Character
- func (g *Game) AddPlayerChar(char *Character) error
- func (g *Game) AnswerDialog(dialog *dialog.Dialog, answer *dialog.Answer)
- func (g *Game) Char(id, serial string) *Character
- func (g *Game) Closing() bool
- func (g *Game) Pause() bool
- func (g *Game) PlayerChars() []*Character
- func (g *Game) Server() *Server
- func (g *Game) SetActivePlayerChar(char *Character)
- func (g *Game) SetOnPlayerCharChangeFunc(f func(c *Character))
- func (g *Game) SetPause(pause bool)
- func (g *Game) SetServer(server *Server)
- func (g *Game) SpawnChar(char *Character) error
- func (g *Game) StartDialog(dialog *dialog.Dialog, target dialog.Talker)
- func (g *Game) Trade(seller, buyer item.Container, sellItems, buyItems []item.Item)
- func (g *Game) TransferItems(from, to item.Container, items ...item.Item) error
- func (g *Game) Update()
- func (g *Game) VisibleForPlayer(x, y float64) bool
- type Server
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Character ¶
Struct for game character.
func NewCharacter ¶
NewCharacter creates game wrapper for module character.
func (*Character) AddChatMessage ¶
AddChatMessage adds new message to the character chat log.
func (*Character) Equip ¶
Equip inserts specified equipable item to all compatible slots in active PC equipment.
func (*Character) InSight ¶
InSight checks if specified XY position is in sight range of the character.
func (*Character) PrivateLog ¶
PrivateLog returns character private log.
func (*Character) SetDestPoint ¶
SetDestPoint sets destination point for player character.
func (*Character) SetOnUseFunc ¶
SetOnUseFunc sets function to trigger after using an object.
func (*Character) SetPosition ¶
SetPosition sets character position and destination point.
func (*Character) Train ¶
func (c *Character) Train(training *training.TrainerTraining, trainer training.Trainer)
Train uses specified training from specified trainer.
type Game ¶
Wrapper struct for game.
func (*Game) ActivePlayerChar ¶
ActivePlayerChar returns active player character.
func (*Game) AddPlayerChar ¶
AddPlayerChar adds specified character to player characters list.
func (*Game) AnswerDialog ¶
AnswerDialog answers dialog with specified answer.
func (*Game) PlayerChars ¶
PlayerChars returns all player characters.
func (*Game) SetActivePlayerChar ¶
SetActivePlayer sets specified avatar as active player avatar.
func (*Game) SetOnPlayerCharChangeFunc ¶
SetOnPlayerChangeFunc sets function triggered on active player change.
func (*Game) SetPause ¶
SetPause pauses/unpauses the game. If game uses the remote server this function will only send the pause request to the server and return, changing the game pause variable value should happend while handling the server response in such a case.
func (*Game) SpawnChar ¶
SpawnChar sets start area and position of current chapter for specified character.
func (*Game) StartDialog ¶
StartDialog starts dialog with specified object as dialog target.
func (*Game) TransferItems ¶
TransferItems transfer items between specified objects. Items are in the form of a map with IDs as keys and serial values as values.
func (*Game) Update ¶
func (g *Game) Update()
Update updates game. It executes game update loop until game is closed.
func (*Game) VisibleForPlayer ¶
VisibleForPlayer checks whether specified position is in visibility range of any PC.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Struct for server connection.
func NewServer ¶
NewServer creates new server struct with connection to server with specified host and port number.
func (*Server) Authorized ¶
Authorized checks if server connection is authorized.
func (*Server) SetOnResponseFunc ¶
SetOnResponseFunc sets function triggered on each server response.