Documentation ¶
Index ¶
- Variables
- func CreateCharacter(sessionKey string, name string, classId int) (int, error)
- func CreateNewGame(mapName string, gameMode string, minimumLevel int, maxPlayers int) (int, error)
- func Disconnect(userToken string) error
- func GetCharacter(machineKey string, characterId int) (*model.Character, error)
- func GetGamesList() ([]model.Game, error)
- func GetMachineList() ([]model.Machine, error)
- func GetServerInfo(gameId int) (*model.HostServer, bool, error)
- func LoginAccount(username string, password string) (string, []int, error)
- func PlayerConnect(gameId int, machineKey string, sessionKey string, characterId int) (*model.Character, error)
- func PlayerDisconnect(machineKey string, gameId int, character *model.Character) error
- func ProvisionNewGame(game_id int, map_name string, game_mode string) error
- func ProvisionNewMachine()
- func RegisterAccount(username string, password string) (string, []int, error)
- func RegisterActiveGame(gameId int, machineKey string, listenPort int) error
- func RegisterMachine(remoteAddress string, servicePort int) (int, string, error)
- func SelectCharacter(sessionKey string, characterId int) (*model.Character, error)
- func ShutdownServer(machineKey string, gameId int) error
- func StoreCharacterSnapshot(charSession *CharacterSession) (bool, error)
- func TestMachineRequest()
- func UnregisterMachine(machineToken string) (bool, error)
- func UpdateCharacter(machineKey string, character *model.Character) error
- func UpdateMachineStatus(machineToken string, usageCpu float64, usageNetwork float64, ...) error
- type Account
- type AccountPublicView
- type AccountSession
- type CharacterData
- type CharacterSession
- type Vector3
- type World
- type WorldData
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrGameFull = errors.New("thordb: game is full")
View Source
var ErrGameNotExist = errors.New("thordb: game does not exist")
View Source
var ErrInvalidMachineKey = errors.New("thordb: invalid machine key")
View Source
var ErrInvalidSessionKey = errors.New("thordb: invalid session key")
errors
View Source
var GameNotExistError = errors.New("thordb: game does not exist")
Functions ¶
func CreateCharacter ¶
func CreateNewGame ¶
func Disconnect ¶
func GetGamesList ¶
func GetMachineList ¶
func GetServerInfo ¶
func GetServerInfo(gameId int) (*model.HostServer, bool, error)
func PlayerConnect ¶
func PlayerDisconnect ¶
func ProvisionNewMachine ¶
func ProvisionNewMachine()
func RegisterAccount ¶
func RegisterActiveGame ¶
func RegisterMachine ¶
func SelectCharacter ¶
func ShutdownServer ¶
func StoreCharacterSnapshot ¶
func StoreCharacterSnapshot(charSession *CharacterSession) (bool, error)
ToDo: remove this func from public, only exposed for testing this should be used internally to thordb only!
func TestMachineRequest ¶
func TestMachineRequest()
func UnregisterMachine ¶
Types ¶
type Account ¶
type Account struct { UserID int `json:"uid"` CharacterIDs []int `json:"characters"` HashedPassword []byte `json:"hashedPassword"` Salt []byte `json:"salt"` Algorithm string `json:"hashAlgorithm"` CreatedOn time.Time `json:"createdOn"` LastLogin time.Time `json:"lastLogin"` }
func (*Account) NewPublicView ¶
func (account *Account) NewPublicView() AccountPublicView
type AccountPublicView ¶
type AccountSession ¶
type CharacterData ¶
type CharacterData struct { Name string `json:"name"` Soul int `json:"soul"` World generate.Coordinate2D `json:"worldCoord"` Position Vector3 `json:"worldPosition"` Weapons []int `json:"weapons"` Inventory []int `json:"inventory"` Health float64 `json:"health"` Power float64 `json:"powerLevel"` Experience int `json:"experienceLevel"` MasteryPoints []int `json"masteryPoints"` }
func NewCharacterData ¶
func NewCharacterData() *CharacterData
type CharacterSession ¶
type CharacterSession struct { ID int `json:"id"` UserID int `json:"uid"` Token string `json:"charSessionToken"` GameId int `json:"gameId"` *CharacterData }
func NewCharacterSession ¶
func NewCharacterSession() *CharacterSession
func NewCharacterSessionFrom ¶
func NewCharacterSessionFrom(character *CharacterData) *CharacterSession
type WorldData ¶
type WorldData struct { Name string `json:"worldName"` Location generate.Coordinate2D `json:"worldCoordinate"` Soul int `json:"soul"` TerrainType int `json:"terrainType"` GameMode int `json:"gameMode"` Players []CharacterSession `json:"playerSessions"` NPCs []CharacterData `json:"nonPlayerCharacters"` }
Click to show internal directories.
Click to hide internal directories.