util

package
v0.0.0-...-1e539ef Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2018 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LevelMax          = 126
	InventionLevelMax = 150
	InventionId       = 26
)

Variables

View Source
var (
	SkillNames = []string{
		"Attack",
		"Defence",
		"Strength",
		"Constitution",
		"Ranged",
		"Prayer",
		"Magic",
		"Cooking",
		"Woodcutting",
		"Fletching",
		"Fishing",
		"Firemaking",
		"Crafting",
		"Smithing",
		"Mining",
		"Herblore",
		"Agility",
		"Thieving",
		"Slayer",
		"Farming",
		"Runecrafting",
		"Hunter",
		"Construction",
		"Summoning",
		"Dungeoneering",
		"Divination",
		"Invention",
	}
	ExpThresholds          []int
	Skills                 = map[int]Skill{}
	InventionExpThresholds = []int{}/* 150 elements not displayed */

)

todo: shortened names, no params, total level, front page form

View Source
var (
	UsernameRegex = regexp.MustCompile("^_?[a-zA-Z0-9-_+]+$")

	AesKey []byte
)

Functions

func Encrypt

func Encrypt(str string) (string, error)

func Format

func Format(n int) string

func FromSuffixed

func FromSuffixed(value string) (int, error)

func GetMD5

func GetMD5(text string) string

func GetStats

func GetStats(username string) (map[int]Stat, error)

func LevelFromXP

func LevelFromXP(skill Skill, xp int) int

func LoadFont

func LoadFont(fontFile string) *truetype.Font

Load font(s) to memory

func ParseUsername

func ParseUsername(username string) string

func ServeResultPage

func ServeResultPage(writer http.ResponseWriter, url string)

func XPForLevel

func XPForLevel(skill Skill, level int) int

func XPToLevel

func XPToLevel(skill Skill, currentXp, targetLevel int) int

Types

type GoalType

type GoalType int
const (
	GoalLevel GoalType = iota
	GoalXP
)

func GetGoalType

func GetGoalType(skill Skill, goal int) GoalType

type ParsedSignatureRequest

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

func NewSignatureRequest

func NewSignatureRequest() ParsedSignatureRequest

func (ParsedSignatureRequest) AddProperty

func (s ParsedSignatureRequest) AddProperty(name string, value interface{})

func (ParsedSignatureRequest) GetProperty

func (s ParsedSignatureRequest) GetProperty(name string) interface{}

type QueryParameter

type QueryParameter struct {
	Key   string
	Value string
}

func ParseQueryParameters

func ParseQueryParameters(query string) (params []QueryParameter, err error)

Parse query parameters and return them in the right order

type Signature

type Signature struct {
	Username string
	Image    image.Image
}

type SignatureRequest

type SignatureRequest struct {
	Req  ParsedSignatureRequest
	Hash string
}

type Skill

type Skill struct {
	Name string
	Id   int
}

func GetSkillById

func GetSkillById(id int) (Skill, error)

func GetSkillByName

func GetSkillByName(name string) (Skill, error)

type Stat

type Stat struct {
	Skill Skill
	Xp    int
}

func GetStatBySkill

func GetStatBySkill(stats map[int]Stat, skill Skill) Stat

Jump to

Keyboard shortcuts

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