Documentation ¶
Index ¶
- Constants
- Variables
- func DoesStringContainDigits(str string) bool
- func DoesStringContainsNumbers(str string) bool
- func GetBiggestCreatureName() (string, error)
- func GetBiggestCreatureNameRuneCount() (int, error)
- func GetBiggestCreatureWord() (string, error)
- func GetBiggestCreatureWordRuneCount() (int, error)
- func GetBiggestSpellNameOrFormula() (string, error)
- func GetBiggestSpellNameOrFormulaRuneCount() (int, error)
- func GetBiggestSpellWord() (string, error)
- func GetBiggestSpellWordRuneCount() (int, error)
- func GetSha256Sum() (string, error)
- func GetSha512Sum() (string, error)
- func GetSmallestCreatureName() (string, error)
- func GetSmallestCreatureNameRuneCount() (int, error)
- func GetSmallestCreatureWord() (string, error)
- func GetSmallestCreatureWordRuneCount() (int, error)
- func GetSmallestSpellNameOrFormula() (string, error)
- func GetSmallestSpellNameOrFormulaRuneCount() (int, error)
- func GetSmallestSpellWord() (string, error)
- func GetSmallestSpellWordRuneCount() (int, error)
- func GetTowns() ([]string, error)
- func GetWorlds() ([]string, error)
- func HouseExistsInTown(houseID int, town string) (bool, error)
- func HouseExistsRaw(houseID int) (bool, error)
- func Initiate(TibiaDataUserAgent string) error
- func IsCharacterNameValid(name string) error
- func IsCreatureNameValid(name string) (string, error)
- func IsGuildNameValid(name string) error
- func IsHighscoreCategoryValid(hs string) error
- func IsNewsIDValid(ID int) error
- func IsRestrictionMode(mode bool) error
- func IsSpellNameOrFormulaValid(name string) (string, error)
- func IsVocationValid(vocation string) error
- func TownExists(town string) (bool, error)
- func WorldExists(world string) (bool, error)
- type Creature
- type Error
- type HighscoreCategory
- type House
- type Spell
Constants ¶
const ( MaxRunesAllowedInACharacterName = 29 // Larggest character name length possible MinRunesAllowedInACharacterName = 2 // Smallest character name length possible MaxRunesAllowedInACharacterNameWord = 20 // Larggest character name word length possible (new names only 14, but older ones are longer) MinRunesAllowedInACharacterNameWord = 1 // Smallest character name word length possible MaxRunesAllowedInAGuildName = 29 // Larggest guild name length possible MinRunesAllowedInAGuildName = 3 // Smallest guild name length possible MaxRunesAllowedInAGuildNameWord = 14 // Larggest guild name word length possible MinRunesAllowedInAGuildNameWord = 2 // Smallest character name word length possible // AmountOfBoostableBosses is the amount of boostable bosses. // Last updated: Oct 08 2023 AmountOfBoostableBosses = 95 )
const ( TIBIADATA_API_TESTING = "TibiaData-API-Testing" TIBIADATA_JSON_ERROR = "Wanted json error: %s, got %s instead" )
Variables ¶
var ( // ErrorAlreadyRunning will be sent when InitiateValidator() is called but the validator is already running // Code: 10 ErrorAlreadyRunning = Error{errors.New("validator has already been initiated on this session")} // ErrorValidatorNotInitiated will be sent when a validation func is called but the validator has not been initiated // Code: 11 ErrorValidatorNotInitiated = Error{errors.New("validator func called but the validator has not been initiated")} // ErrorStringCanNotBeConvertedToInt will be sent if the request needs to be converted to an int but can't // Code: 9001 ErrorStringCanNotBeConvertedToInt = Error{errors.New("the provided string can not be converted to an integer")} // ErrorRestrictionMode will be sent if the request contains a page that is not available due to restriction mode // Code: 9002 ErrorRestrictionMode = Error{errors.New("the provided page is not available due to restriction mode")} // ErrorCharacterNameEmpty will be sent if the request contains an empty character name // Code: 10001 ErrorCharacterNameEmpty = Error{errors.New("the provided character name is an empty string")} // ErrorCharacterNameTooSmall will be sent if the request contains a character name of length < MinRunesAllowedInACharacterName // Code: 10002 ErrorCharacterNameTooSmall = Error{errors.New("the provided character name is too small")} // ErrorCharacterNameInvalid will be sent if the request contains an invalid character name // Code: 10003 ErrorCharacterNameInvalid = Error{errors.New("the provided character name is invalid")} // ErrorCharacterNameIsOnlyWhiteSpace will be sent if the request contains a name that consists of only whitespaces // Code: 10004 ErrorCharacterNameIsOnlyWhiteSpace = Error{errors.New("the provided character name consists only of whitespaces")} // ErrorCharacterNameTooBig will be sent if the request contains a character name of length > MaxRunesAllowedInACharacterName // Code: 10005 ErrorCharacterNameTooBig = Error{errors.New("the provided character name is too big")} // ErrorCharacterWordTooBig will be sent if the request contains a word with length > MaxRunesAllowedInACharacterNameWord in the character name // Code: 10006 ErrorCharacterWordTooBig = Error{errors.New("the provided character name has a word too big")} // ErrorCharacterWordTooSmall will be sent if the request contains a word with length < MinRunesAllowedInACharacterNameWord in the character name // Code: 10007 ErrorCharacterWordTooSmall = Error{errors.New("the provided character name has a word too small")} // ErrorInvalidNewsID will be sent if the request contains an invalid news ID // Code: 11001 ErrorInvalidNewsID = Error{errors.New("the provided news id is invalid")} // ErrorWorldDoesNotExist will be sent if the request contains a world that does not exist // Code: 11002 ErrorWorldDoesNotExist = Error{errors.New("the provided world does not exist")} // ErrorVocationDoesNotExist will be sent if the request contains a vocation that does not exist // Code: 11003 ErrorVocationDoesNotExist = Error{errors.New("the provided vocation does not exist")} // ErrorHighscoreCategoryDoesNotExist will be sent if the request contains a highscore catregory that does not exist // Code: 11004 ErrorHighscoreCategoryDoesNotExist = Error{errors.New("the provided highscore category does not exist")} // ErrorHouseDoesNotExist will be sent if the request contains a house that does not exist // Code: 11005 ErrorHouseDoesNotExist = Error{errors.New("the provided house does not exist")} // ErrorTownDoesNotExist will be sent if the request contains a town that does not exist // Code: 11006 ErrorTownDoesNotExist = Error{errors.New("the provided town does not exist")} // ErrorHighscorePageInvalid will be sent if the page is not valid // Code: 11007 ErrorHighscorePageInvalid = Error{errors.New("the provided page does not exist or is invalid")} // ErrorHighscorePageTooBig // Code: 11008 ErrorHighscorePageTooBig = Error{errors.New("the provided page is larger than max amount of pages")} // ErrorCreatureNameEmpty will be sent if the request contains an empty creature name // Code: 12001 ErrorCreatureNameEmpty = Error{errors.New("the provided creature name is an empty string")} // ErrorCreatureNameTooSmall will be sent if the request contains a creature name of length < smallestCreatureName // Code: 12002 ErrorCreatureNameTooSmall = Error{errors.New("the provided creature name is too smal")} // ErrorCreatureNameInvalid will be sent if the request contains an invalid creature name // Code: 12003 ErrorCreatureNameInvalid = Error{errors.New("the provided creature name is invalid")} // ErrorCreatureNameIsOnlyWhiteSpace will be sent if the request contains a name that consists of only whitespaces // Code: 12004 ErrorCreatureNameIsOnlyWhiteSpace = Error{errors.New("the provided creature name consists only of whitespaces")} // ErrorCreatureNameTooBig will be sent if the request contains a creature name of length > biggestCreatureNameRuneCount // Code: 12005 ErrorCreatureNameTooBig = Error{errors.New("the provided creature name is too big")} // ErrorCreatureWordTooBig will be sent if the request contains a word with length > biggestCreatureWordRuneCount in the creature name // Code: 12006 ErrorCreatureWordTooBig = Error{errors.New("the provided creature name has a word too big")} // ErrorCreatureWordTooSmall will be sent if the request contains a word with length < smallestCreatureWordRuneCount in the creature name // Code: 12007 ErrorCreatureWordTooSmall = Error{errors.New("the provided creature name has a word too small")} // ErrorSpellNameEmpty will be sent if the request contains an empty spell name // Code: 13001 ErrorSpellNameEmpty = Error{errors.New("the provided spell name is an empty string")} // ErrorSpellNameTooSmall will be sent if the request contains a spell name of length < smallestSpellNameOrFormulaRuneCount // Code: 13002 ErrorSpellNameTooSmall = Error{errors.New("the provided spell name is too smal")} // ErrorSpellNameInvalid will be sent if the request contains an invalid spell name // Code: 13003 ErrorSpellNameInvalid = Error{errors.New("the provided spell name is invalid")} // ErrorSpellNameIsOnlyWhiteSpace will be sent if the request contains a name that consists of only whitespaces // Code: 13004 ErrorSpellNameIsOnlyWhiteSpace = Error{errors.New("the provided spell name consists only of whitespaces")} // ErrorSpellNameTooBig will be sent if the request contains a spell name of length > biggestSpellNameOrFormulaRuneCount // Code: 13005 ErrorSpellNameTooBig = Error{errors.New("the provided spell name is too big")} // ErrorSpellWordTooBig will be sent if the request contains a word with length > biggestSpellWordRuneCount in the spell name // Code: 13006 ErrorSpellWordTooBig = Error{errors.New("the provided spell name has a word too big")} // ErrorSpellWordTooSmall will be sent if the request contains a word with length < smallestSpellWordRuneCount in the creature name // Code: 13007 ErrorSpellWordTooSmall = Error{errors.New("the provided spell name has a word too small")} // ErrorGuildNameEmpty will be sent if the request contains an empty guild name // Code: 14001 ErrorGuildNameEmpty = Error{errors.New("the provided guild name is an empty string")} // ErrorGuildNameTooSmall will be sent if the request contains a Guild name of length < MinRunesAllowedInAGuildName // Code: 14002 ErrorGuildNameTooSmall = Error{errors.New("the provided guild name is too small")} // ErrorGuildNameInvalid will be sent if the request contains an invalid guild name // Code: 14003 ErrorGuildNameInvalid = Error{errors.New("the provided guild name is invalid")} // ErrorGuildNameIsOnlyWhiteSpace will be sent if the request contains a name that consists of only whitespaces // Code: 14004 ErrorGuildNameIsOnlyWhiteSpace = Error{errors.New("the provided guild name consists only of whitespaces")} // ErrorGuildNameTooBig will be sent if the request contains a guild name of length > MaxRunesAllowedInAGuildName // Code: 14005 ErrorGuildNameTooBig = Error{errors.New("the provided guild name is too big")} // ErrorGuildWordTooBig will be sent if the request contains a word with length > MaxRunesAllowedInAGuildNameWord in the guild name // Code: 14006 ErrorGuildWordTooBig = Error{errors.New("the provided guild name has a word too big")} // ErrorGuildWordTooSmall will be sent if the request contains a word with length < MinRunesAllowedInAGuildNameWord in the guild name // Code: 14007 ErrorGuildWordTooSmall = Error{errors.New("the provided guild name has a word too smal")} // ErrorCharacterNotFound will be sent if the requested character does not exist // Code: 20001 ErrorCharacterNotFound = Error{errors.New("could not find character")} // ErrorCreatureNotFound will be sent if the requested creature does not exist // Code: 20002 ErrorCreatureNotFound = Error{errors.New("could not find creature")} // ErrorSpellNotFound will be sent if the requested spell does not exist // Code: 20003 ErrorSpellNotFound = Error{errors.New("could not find spell")} // ErrorGuildNotFound will be sent if the requested guild does not exist // Code: 20004 ErrorGuildNotFound = Error{errors.New("could not find guild")} // ErrorMaintenanceMode will be sent if there is ongoing maintenance // Code: 20005 ErrorMaintenanceMode = Error{errors.New("maintenance mode active")} // ErrStatusForbidden will be sent if tibia sent us a 403 response. // This usually happens when we are rate limited. // Code: 20006 ErrStatusForbidden = Error{errors.New("got status forbidden from tibia.com")} // ErrStatusForbidden will be sent if tibia sent us a 302 response, but it // is not in MaintenanceMode. Because if it were, we would throw a // ErrorMaintenanceMode. // Code: 20007 ErrStatusFound = Error{errors.New("got status found from tibia.com")} // ErrStatusUnknown will be sent a HTTP request we are not expecting. // Code: 20008 ErrStatusUnknown = Error{errors.New("got unknown status from tibia.com")} )
Functions ¶
func DoesStringContainDigits ¶
DoesStringContainDigits returns whether there is a digit rune in the string
func DoesStringContainsNumbers ¶
DoesStringContainsNumbers returns whether there is a number rune in the string
func GetBiggestCreatureName ¶
GetBiggestCreatureName returns the name of the creature with the biggest name
func GetBiggestCreatureNameRuneCount ¶
GetBiggestCreatureNameRuneCount returns the length of the biggest creature name
func GetBiggestCreatureWord ¶
GetBiggestCreatureWord returns the biggest word in a creature name
func GetBiggestCreatureWordRuneCount ¶
GetBiggestCreatureWordRuneCount returns the length of the biggest creature word
func GetBiggestSpellNameOrFormula ¶
GetBiggestSpellNameOrFormula returns the name of the spell with the biggest name or formula
func GetBiggestSpellNameOrFormulaRuneCount ¶
GetBiggestSpellNameOrFormulaRuneCount returns the length of the biggest spell name
func GetBiggestSpellWord ¶
GetBiggestSpellWord returns the biggest word in a spell name or formula
func GetBiggestSpellWordRuneCount ¶
GetBiggestSpellWordRuneCount returns the length of the biggest spell word
func GetSha256Sum ¶
GetSha256Sum returns the sha256sum of the data.min.json file being used
func GetSha512Sum ¶
GetSha512Sum returns the sha512sum of the data.min.json file being used
func GetSmallestCreatureName ¶
GetSmallestCreatureName returns the name of the creature with the smallest name
func GetSmallestCreatureNameRuneCount ¶
GetSmallestCreatureNameRuneCount returns the length of the smallest creature name
func GetSmallestCreatureWord ¶
GetSmallestCreatureWord returns the smallest word in a creature name
func GetSmallestCreatureWordRuneCount ¶
GetSmallestCreatureWordRuneCount returns the length of the smallest creature word
func GetSmallestSpellNameOrFormula ¶
GetSmallestSpellNameOrFormula returns the name of the spell with the smallest name or formula
func GetSmallestSpellNameOrFormulaRuneCount ¶
GetSmallestSpellNameOrFormulaRuneCount returns the length of the smallest spell name
func GetSmallestSpellWord ¶
GetSmallestSpellWord returns the smallest word in a spell name or formula
func GetSmallestSpellWordRuneCount ¶
GetSmallestSpellWordRuneCount returns the length of the smallest spell word
func HouseExistsInTown ¶
HouseExistsInTown reports whether a house exits in the specified town This function will return false AND a nil error if the specified ID doesn't exist in the specified town or if the specified town doesn't exist
func HouseExistsRaw ¶
HouseExistsRaw reports whether a house exits, independently of what town the house is from
func IsCharacterNameValid ¶
IsCharacterNameValid reports wheter the provided string represents a valid character name Check if error == nil to see whether the name is valid or not
func IsCreatureNameValid ¶
IsCreatureNameValid reports wheter the provided string represents a valid creature name Check if error == nil to see whether the creature is valid or not It will also return the creature endpoint
func IsGuildNameValid ¶
IsGuildNameValid reports wheter the provided string represents a valid guild name Check if error == nil to see whether the name is valid or not
func IsHighscoreCategoryValid ¶
IsHighscoreCategoryValid reports wheter the provided string represents a valid highscore category Check if error == nil to see whether the highscore category is valid or not
func IsNewsIDValid ¶
IsNewsIDValid reports wheter the provided int represents a valid news ID Check if error == nil to see whether the ID is valid or not
func IsRestrictionMode ¶
IsRestrictionMode reports whether the restriction mode is enabled Check if error == nil to see whether the restriction mode is enabled or not
func IsSpellNameOrFormulaValid ¶
IsSpellNameOrFormulaValid reports wheter the provided string represents a valid spell name or formula Check if error == nil to see whether the creature is valid or not It will also return the spell endpoint
func IsVocationValid ¶
IsVocationValid reports wheter the provided string represents a valid vocation Check if error == nil to see whether the vocation is valid or not
func TownExists ¶
TowndExists reports whether the specified town exists This function is case insensitive
func WorldExists ¶
WorldExists reports whether the specified world exists This function is case insensitive
Types ¶
type Creature ¶
type Creature struct { Endpoint string `json:"endpoint"` PluralName string `json:"plural_name"` Name string `json:"name"` }
func GetCreatures ¶
GetCreatures returns a list of all existing creatures
type Error ¶
type Error struct {
// contains filtered or unexported fields
}
Error represents a validation error
type HighscoreCategory ¶
type HighscoreCategory int
const ( HighScoreAchievements HighscoreCategory = iota + 1 HighScoreAxefighting HighScoreCharmpoints HighScoreClubfighting HighScoreDistancefighting HighScoreExperience HighScoreFishing HighScoreFistfighting HighScoreGoshnarstaint HighScoreLoyaltypoints HighScoreMagiclevel HighScoreShielding HighScoreSwordfighting HighScoreDromescore HighScoreBosspoints )
func HighscoreCategoryFromString ¶
func HighscoreCategoryFromString(input string) HighscoreCategory
func (HighscoreCategory) String ¶
func (hc HighscoreCategory) String() (string, error)
type House ¶
Houses represents a house
func GetHouseInTown ¶
GetHouseInTown returns a house by it's ID and town This function will return a nil house AND a nil error if the specified ID doesn't exist in the specified town or if the specified town doesn't exist
func GetHouseRaw ¶
GetHouseRaw returns a house by it's ID, independently of what town the house is from This function will return a nil house AND a nil error if the specified ID doesn't exist