data

package
v0.0.0-...-34f5af7 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2023 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateAccount

func CreateAccount(db *gorm.DB, account *Account) error

CreateAccount persists the Account record to the database.

func CreatePlayerOptions

func CreatePlayerOptions(db *gorm.DB, po *PlayerOptions) error

func DeleteAccount

func DeleteAccount(db *gorm.DB, account *Account) error

DeleteAccount soft-deletes an Account record from the database.

func DeleteCharacter

func DeleteCharacter(db *gorm.DB, accountID uint, slot uint32) error

DeleteCharacter soft-deletes a character record from the database.

func PermanentlyDeleteAccount

func PermanentlyDeleteAccount(db *gorm.DB, account *Account) error

PermanentlyDeleteAccount permanently deletes an Account record from the database.

func PermanentlyDeleteCharacter

func PermanentlyDeleteCharacter(db *gorm.DB, character *Character) error

PermanentlyDeleteCharacter permanently deletes a character record from the database.

func UpdatePlayerOptions

func UpdatePlayerOptions(db *gorm.DB, po *PlayerOptions) error

func UpsertCharacter

func UpsertCharacter(db *gorm.DB, character *Character) error

UpsertCharacter updates an existing Character row with the contents of character.

Types

type Account

type Account struct {
	ID               uint64 `gorm:"primaryKey"`
	Username         string `gorm:"unique; not null"`
	Password         string `gorm:"not null"`
	Email            string `gorm:"unique"`
	RegistrationDate time.Time
	Guildcard        int  `gorm:"AUTO_INCREMENT"`
	GM               bool `gorm:"default:false"`
	Banned           bool `gorm:"default:false"`
	Active           bool `gorm:"default:true"`
	TeamID           int
	PrivilegeLevel   byte

	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt gorm.DeletedAt
}

Account contains the login information specific to each registered user.

func FindAccountByID

func FindAccountByID(db *gorm.DB, id uint) (*Account, error)

func FindAccountByUsername

func FindAccountByUsername(db *gorm.DB, username string) (*Account, error)

FindAccountByUsername searches for an account with the specified username, returning the *Account instance if found or nil if there is no match.

func FindUnscopedAccount

func FindUnscopedAccount(db *gorm.DB, username string) (*Account, error)

FindUnscopedAccount searches for a potentially soft-deleted account with the specified username, returning the *Account instance if found or nil if there is no match.

type Character

type Character struct {
	ID uint64 `gorm:"primaryKey"`

	Account   *Account
	AccountID uint64 `gorm:"uniqueIndex:character_account_slot"`

	Guildcard         uint64
	GuildcardStr      []byte
	Slot              uint32 `gorm:"uniqueIndex:character_account_slot"`
	Experience        uint32
	Level             uint32
	NameColor         uint32
	ModelType         byte
	NameColorChecksum uint32
	SectionID         byte
	Class             byte
	V2Flags           byte
	Version           byte
	V1Flags           uint32
	Costume           uint16
	Skin              uint16
	Face              uint16
	Head              uint16
	Hair              uint16
	HairRed           uint16
	HairGreen         uint16
	HairBlue          uint16
	ProportionX       float32
	ProportionY       float32
	ReadableName      string
	Name              []byte
	Playtime          uint32
	ATP               uint16
	MST               uint16
	EVP               uint16
	HP                uint16
	DFP               uint16
	ATA               uint16
	LCK               uint16
	Meseta            uint32

	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt gorm.DeletedAt
}

Character is an instance of a character in one of the slots for an account.

func FindCharacter

func FindCharacter(db *gorm.DB, accountID uint, slot uint32) (*Character, error)

FindCharacter returns the Character associated with the account in the given slot or nil if none exists.

type GuildcardEntry

type GuildcardEntry struct {
	ID uint64 `gorm:"primaryKey"`

	Account   *Account
	AccountID int

	Guildcard       uint64
	FriendGuildcard int
	Name            []byte
	TeamName        []byte
	Description     []byte
	Language        byte
	SectionID       byte
	Class           byte
	Comment         []byte
}

func FindGuildcardEntries

func FindGuildcardEntries(db *gorm.DB, accountId uint64) ([]GuildcardEntry, error)

FindGuildcardEntries returns all the GuildcardEntry rows associated with an Account.

type PlayerOptions

type PlayerOptions struct {
	ID uint64 `gorm:"primaryKey"`

	Account   *Account
	AccountID int

	KeyConfig []byte
}

func FindPlayerOptions

func FindPlayerOptions(db *gorm.DB, accountId uint64) (*PlayerOptions, error)

FindPlayerOptions returns all of hte PlayerOptions associated with an Account.

Jump to

Keyboard shortcuts

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