db

package
v0.0.0-...-1047d84 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2019 License: ISC Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Boundarys This holds the defining characteristics for all of the game's boundary scene objects, ordered by ID.

Items This holds the defining characteristics for all of the game's items, ordered by ID.

Npcs This holds the defining characteristics for all of the game's NPCs, ordered by ID.

Objects This holds the defining characteristics for all of the game's scene objects, ordered by ID.

Functions

func CreatePlayer

func CreatePlayer(username, password string) bool

CreatePlayer Creates a new entry in the player SQLite3 database with the specified credentials. Returns true if successful, otherwise returns false.

func LoadBoundaryDefinitions

func LoadBoundaryDefinitions()

LoadBoundaryDefinitions Loads game boundary object data into memory for quick access.

func LoadItemDefinitions

func LoadItemDefinitions()

LoadItemDefinitions Loads game item data into memory for quick access.

func LoadNpcDefinitions

func LoadNpcDefinitions()

LoadNpcDefinitions Loads game NPC data into memory for quick access.

func LoadObjectDefinitions

func LoadObjectDefinitions() error

LoadObjectDefinitions Loads game object data into memory for quick access.

func LoadObjectLocations

func LoadObjectLocations() int

LoadObjectLocations Loads the game objects into memory from the SQLite3 database.

func LoadPlayer

func LoadPlayer(player *world.Player, usernameHash uint64, password string, loginReply chan byte)

LoadPlayer Loads a player from the SQLite3 database, returns a login response code.

func LoadPlayerAttributes

func LoadPlayerAttributes(player *world.Player) error

LoadPlayerAttributes Looks for a player with the specified credentials in the player database. Returns nil if it finds the player, otherwise returns an error.

func LoadPlayerContacts

func LoadPlayerContacts(listType string, player *world.Player) error

LoadPlayerContacts Looks for a player with the specified credentials in the player database. Returns nil if it finds the player, otherwise returns an error.

func LoadPlayerInventory

func LoadPlayerInventory(player *world.Player) error

LoadPlayerInventory Looks for a player with the specified credentials in the player database. Returns nil if it finds the player, otherwise returns an error.

func Open

func Open(file string) *sql.DB

Open Returns an active sqlite3 database reference for the specified database file.

func SaveObjectLocations

func SaveObjectLocations() int

SaveObjectLocations Clears world.db game object locations and repopulates it with the current server locations.

func SavePlayer

func SavePlayer(player *world.Player)

SavePlayer Saves a player to the SQLite3 database.

func UsernameExists

func UsernameExists(username string) bool

UsernameExists Returns true if there is a player with the name 'username' in the player database, otherwise returns false.

func ValidateCredentials

func ValidateCredentials(usernameHash uint64, password string, loginReply chan byte, player *world.Player) error

ValidateCredentials Looks for a player with the specified credentials in the player database. Returns nil if it finds the player, otherwise returns an error.

Types

type BoundaryDefinition

type BoundaryDefinition struct {
	ID          int
	Name        string
	Commands    []string
	Description string
}

BoundaryDefinition This represents a single definition for a single boundary object in the game.

type ItemDefinition

type ItemDefinition struct {
	ID          int
	Name        string
	Description string
	Command     string
	BasePrice   int
	Stackable   bool
	Quest       bool
	Members     bool
}

ItemDefinition This represents a single definition for a single item in the game.

type NpcDefinition

type NpcDefinition struct {
	ID          int
	Name        string
	Description string
	Command     string
	Hits        int
	Attack      int
	Strength    int
	Defense     int
	Attackable  bool
}

NpcDefinition This represents a single definition for a single NPC in the game.

type ObjectDefinition

type ObjectDefinition struct {
	ID            int
	Name          string
	Commands      []string
	Description   string
	Type          int
	Width, Height int
	Length        int
}

ObjectDefinition This represents a single definition for a single object in the game.

Jump to

Keyboard shortcuts

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