accounts

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2023 License: Apache-2.0, BSD-3-Clause, ISC Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidPassword = errors.New("invalid password")
	ErrUnknownUsername = errors.New("unknown user")
)

Enumeration of possible errors that can be returned from authenticate.

Functions

This section is empty.

Types

type DecorationTypeIDs added in v0.0.3

type DecorationTypeIDs struct {
	BackgroundTypeID uint32
	FrameTypeID      uint32
	StickerTypeID    uint32
	SlotTypeID       uint32
	CutInTypeID      uint32
	TitleTypeID      uint32
}

type NewCharacterParams added in v0.0.3

type NewCharacterParams struct {
	CharTypeID         uint32
	HairColor          uint8
	Shirt              uint8
	Mastery            uint32
	DefaultPartTypeIDs [24]uint32
}

type Options

type Options struct {
	Logger   zerolog.Logger
	Database *sql.DB
	Hasher   hash.Hasher
}

Options specifies options for account services.

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service implements account services using the database.

func NewService

func NewService(opts Options) *Service

NewService creates new account services using the database.

func (*Service) AddCharacter

func (s *Service) AddCharacter(ctx context.Context, playerID int64, params NewCharacterParams) (dbmodels.Character, error)

AddCharacter adds a character for a given player.

func (*Service) AddClubSet added in v0.0.3

func (s *Service) AddClubSet(ctx context.Context, playerID int64, clubsetTypeID uint32) (dbmodels.Inventory, error)

func (*Service) AddExp added in v0.0.3

func (s *Service) AddExp(ctx context.Context, playerID int64, add int) (pangya.Rank, int, error)

func (*Service) AddPang added in v0.0.3

func (s *Service) AddPang(ctx context.Context, playerID, pang int64) (int64, error)

func (*Service) AddSession

func (s *Service) AddSession(ctx context.Context, playerID int64, address string) (dbmodels.Session, error)

AddSession adds a new session for a player.

func (*Service) Authenticate

func (s *Service) Authenticate(ctx context.Context, username, password string) (dbmodels.Player, error)

Authenticate authenticates a user using the database.

func (*Service) DeleteExpiredSessions

func (s *Service) DeleteExpiredSessions(ctx context.Context) error

DeleteExpiredSessions deletes sessions that have expired.

func (*Service) GetCharacters

func (s *Service) GetCharacters(ctx context.Context, playerID int64) ([]pangya.PlayerCharacterData, error)

GetCharacters returns the characters for a given player.

func (*Service) GetConsumables added in v0.0.3

func (s *Service) GetConsumables(ctx context.Context, playerID int64) ([10]uint32, error)

func (*Service) GetPlayer

func (s *Service) GetPlayer(ctx context.Context, playerID int64) (dbmodels.GetPlayerRow, error)

func (*Service) GetPlayerInventory added in v0.0.3

func (s *Service) GetPlayerInventory(ctx context.Context, playerID int64) ([]dbmodels.Inventory, error)

func (*Service) GetSession

func (s *Service) GetSession(ctx context.Context, sessionID int64) (dbmodels.Session, error)

GetSession gets a session by its ID.

func (*Service) GetSessionByKey

func (s *Service) GetSessionByKey(ctx context.Context, sessionKey string) (dbmodels.Session, error)

GetSessionByKey gets a session by its session key.

func (*Service) HasCharacters

func (s *Service) HasCharacters(ctx context.Context, playerID int64) (bool, error)

HasCharacters returns whether or not the player has characters.

func (*Service) PurchaseItem added in v0.0.3

func (s *Service) PurchaseItem(ctx context.Context, playerID, pangTotal, pointTotal, itemTypeID, quantity int64) (dbmodels.SetPlayerCurrencyRow, error)

func (*Service) Register

func (s *Service) Register(ctx context.Context, username, password string) (dbmodels.Player, error)

func (*Service) SetCaddie added in v0.0.3

func (s *Service) SetCaddie(ctx context.Context, playerID int64, caddieID int64) error

func (*Service) SetCharacter added in v0.0.3

func (s *Service) SetCharacter(ctx context.Context, playerID int64, characterID int64) error

func (*Service) SetCharacterParts added in v0.0.3

func (s *Service) SetCharacterParts(ctx context.Context, playerID int64, data pangya.PlayerCharacterData) error

func (*Service) SetClubSet added in v0.0.3

func (s *Service) SetClubSet(ctx context.Context, playerID int64, clubsetID int64) error

func (*Service) SetComet added in v0.0.3

func (s *Service) SetComet(ctx context.Context, playerID int64, cometTypeID uint32, player *dbmodels.GetPlayerRow) (int64, error)

func (*Service) SetConsumables added in v0.0.3

func (s *Service) SetConsumables(ctx context.Context, playerID int64, newSlots [10]uint32, player *dbmodels.GetPlayerRow) error

func (*Service) SetDecoration added in v0.0.3

func (s *Service) SetDecoration(ctx context.Context, playerId int64, decoration DecorationTypeIDs) error

func (*Service) SetNickname

func (s *Service) SetNickname(ctx context.Context, playerID int64, nickname string) (dbmodels.Player, error)

SetNickname sets the player's nickname.

func (*Service) UpdateSessionExpiry

func (s *Service) UpdateSessionExpiry(ctx context.Context, sessionID int64) (dbmodels.Session, error)

UpdateSessionExpiry bumps the session expiry value for a session.

func (*Service) UseItem added in v0.0.3

func (s *Service) UseItem(ctx context.Context, playerID, itemTypeID int64, player *dbmodels.GetPlayerRow) error

Jump to

Keyboard shortcuts

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