core

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2020 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateContext

func CreateContext()

func GetHero

func GetHero(key hsk.Key) (hsk.Record, error)

func GetHeroes

func GetHeroes(page, pagesize int) (records.Page, error)

func GetRank

func GetRank(totalXP int) int

GetRank finds the ranks you're not, and subtracts one

func GetRequired

func GetRequired(totalXP int) int

GetRequired returns the amount of XP required for the next level.

func Shutdown

func Shutdown()

func XPValue

func XPValue(xp ExperienceType) int

Types

type Experience

type Experience struct {
	Type   ExperienceType
	Points int
	Date   time.Time
}

func (Experience) Valid

func (o Experience) Valid() error

type ExperienceType

type ExperienceType = int
const (
	PlaceAd ExperienceType = iota
	Transact
	Comment
	Vote
)

func GetExperienceType

func GetExperienceType(name string) ExperienceType

type Hero

type Hero struct {
	Subject     string //oidc user
	Credits     int
	Experiences []Experience
	Level       Level
	TotalXP     int
}

func (*Hero) AddCredit

func (h *Hero) AddCredit(amount int)

func (*Hero) AddExperience

func (h *Hero) AddExperience(xpType ExperienceType)

func (*Hero) AddRequisition

func (h *Hero) AddRequisition()

func (Hero) Valid

func (o Hero) Valid() error

type Level

type Level struct {
	Rank     int
	Required int
}

func (Level) Valid

func (o Level) Valid() error

Jump to

Keyboard shortcuts

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