Documentation ¶
Index ¶
- Variables
- func CreateSignature(name string, gender, vocation, level int, lastlogin int64) ([]byte, error)
- func Gender(gender string) int
- func GetGender(gender int) string
- func GetHighscoreQuery(page int, highscoreType string, per int) (int, string, string)
- func GetVocation(voc int) string
- func Outfit(path string, looktype, lookhead, lookbody, looklegs, lookfeet, lookaddons int) ([]byte, error)
- func ParseConfig(path string)
- func ParseItems(path string)
- func ParseMap(path string)
- func ParseMonsters(path string)
- func ParseSpr(path string)
- func ParseStages(path string)
- func QueryToTable(r [][]interface{}, names []string) *lua.LTable
- func SetMode(mode int)
- func TableToMap(r *lua.LTable) map[string]interface{}
- func UnixToString(unix int64) string
- func ValidFormat(format string) bool
- func Validate(f interface{}) []error
- func Vocation(voc string) int
- type ConfigLUA
- type House
- type HouseList
- type ItemDefinition
- type Monster
- type MonsterHealth
- type MonsterItem
- type MonsterLook
- type MonsterSentence
- type PaypalAmount
- type PaypalAmountDetails
- type PaypalLink
- type PaypalPayer
- type PaypalPayerInfo
- type PaypalPayerInformation
- type PaypalPayment
- type PaypalPaymentCreation
- type PaypalPaymentInformation
- type PaypalPaymentProcess
- type PaypalRedirectURL
- type PaypalToken
- type PaypalTransaction
- type ServerHouses
- type ServerItems
- type ServerMonsters
- type ServerStages
- type ServerTowns
- type SpriteFile
- type StageDef
Constants ¶
This section is empty.
Variables ¶
var ( // Mode stores the AAC mode Mode int // Monsters holds all server monsters Monsters = &ServerMonsters{ m: make(map[string]*Monster), rw: &sync.RWMutex{}, } // Config contains the whole parsed config lua file Config = &ConfigLUA{ make(map[string]interface{}), &sync.RWMutex{}, } // Stages contains the server experience stages Stages = &ServerStages{ &stageDefinition{}, &sync.RWMutex{}, } // Items contains the server items xml parsed Items = &ServerItems{ make(map[int]ItemDefinition), &sync.RWMutex{}, } // Houses contains the server houses.xml Houses = &ServerHouses{ &HouseList{}, &sync.RWMutex{}, } // Towns contains the server town list Towns = &ServerTowns{ []otmap.Town{}, &sync.RWMutex{}, } // Spr contains the client spr file Spr = &SpriteFile{ rw: &sync.RWMutex{}, } )
Functions ¶
func CreateSignature ¶
CreateSignature creates a player signature image
func GetHighscoreQuery ¶
GetHighscoreQuery returns a highscore query
func Outfit ¶
func Outfit(path string, looktype, lookhead, lookbody, looklegs, lookfeet, lookaddons int) ([]byte, error)
Outfit renders a tibia outfit with the given looks
func ParseStages ¶
func ParseStages(path string)
ParseStages loads server stages with the given path
func QueryToTable ¶
func QueryToTable(r [][]interface{}, names []string) *lua.LTable
QueryToTable converts a slice of interfaces to a lua table
func TableToMap ¶
func TableToMap(r *lua.LTable) map[string]interface{}
TableToMap converts a lua table to a map
func UnixToString ¶
UnixToString converts a int64 to a string date
func ValidFormat ¶
ValidFormat checks if an image format is valid
Types ¶
type ConfigLUA ¶
type ConfigLUA struct {
// contains filtered or unexported fields
}
ConfigLUA holds the parsed config lua file
type House ¶
type House struct { ID uint32 `xml:"houseid,attr"` Name string `xml:"name,attr"` EntryX uint16 `xml:"entryx,attr"` EntryY uint16 `xml:"entryy,attr"` EntryZ uint16 `xml:"entryz,attr"` Size int `xml:"size,attr"` TownID uint32 `xml:"townid,attr"` }
House holds all information about a game house
type ItemDefinition ¶
type ItemDefinition struct { ID int `xml:"id,attr"` Name string `xml:"name,attr"` Attributes []itemAttribute `xml:"attribute"` }
ItemDefinition represents a server item
func (*ItemDefinition) GetArmor ¶
func (s *ItemDefinition) GetArmor() int
GetArmor returns an item armor value
func (*ItemDefinition) GetDescription ¶
func (s *ItemDefinition) GetDescription() string
GetDescription returns an item description
func (*ItemDefinition) GetSlot ¶
func (s *ItemDefinition) GetSlot() string
GetSlot returns an item slot type
func (*ItemDefinition) GetWeight ¶
func (s *ItemDefinition) GetWeight() int
GetWeight returns an item weight
type Monster ¶
type Monster struct { XMLName xml.Name `xml:"monster"` Name string `xml:"name,attr"` NameDescription string `xml:"nameDescription,attr"` Race string `xml:"race,attr"` Experience int `xml:"experience,attr"` Speed int `xml:"speed,attr"` ManaCost int `xml:"manacost,attr"` Health MonsterHealth `xml:"health"` Look MonsterLook `xml:"look"` Voices []MonsterSentence `xml:"voices>voice"` Loot []MonsterItem `xml:"loot>item"` }
Monster is the main monster representation
type MonsterHealth ¶
MonsterHealth struct for monster stats
type MonsterItem ¶
type MonsterItem struct { ID int `xml:"id,attr"` CountMax int `xml:"countmax,attr"` Chance int `xml:"chance,attr"` }
MonsterItem struct for monster loot
type MonsterLook ¶
type MonsterLook struct { Type int `xml:"type,attr"` Head int `xml:"head,attr"` Body int `xml:"body,attr"` Legs int `xml:"legs,attr"` Feet int `xml:"feet,attr"` Corpse int `xml:"corpse,attr"` }
MonsterLook struct for monster looktype
type MonsterSentence ¶
type MonsterSentence struct {
Sentence string `xml:"sentence,attr"`
}
MonsterSentence struct for monster talks
type PaypalAmount ¶
PaypalAmount paypal payment amount
type PaypalAmountDetails ¶
type PaypalAmountDetails struct {
Subtotal float64 `json:"subtotal"`
}
PaypalAmountDetails detials of paypal payment amount
type PaypalLink ¶
type PaypalLink struct { Href string `json:"href"` Rel string `json:"rel"` Method string `json:"method"` }
PaypalLink links of created payment
type PaypalPayer ¶
type PaypalPayer struct {
PaymentMethod string `json:"payment_method"`
}
PaypalPayer payment method
type PaypalPayerInfo ¶
type PaypalPayerInfo struct { Email string `json:"email"` FirstName string `json:"first_name"` LastName string `json:"last_name"` PayerID string `json:"payer_id"` CountryCode string `json:"country_code"` }
PaypalPayerInfo holds information about the payer
type PaypalPayerInformation ¶
type PaypalPayerInformation struct { PaymentMethod string `json:"payment_method"` Status string `json:"status"` PayerInfo PaypalPayerInfo `json:"payer_info"` }
PaypalPayerInformation holds information about the payer
type PaypalPayment ¶
type PaypalPayment struct { ID string `json:"id"` CreateTime string `json:"create_time"` UpdateTime string `json:"update_time"` State string `json:"state"` Intent string `json:"intent"` Payer PaypalPayer `json:"payer"` Transactions []PaypalTransaction `json:"transactions"` Links []PaypalLink `json:"links"` }
PaypalPayment struct for a created payment
func CreatePaypalPayment ¶
func CreatePaypalPayment(hostURL, baseURL, paypalToken, amount, description, currency string) (*PaypalPayment, error)
CreatePaypalPayment creates a paypal payment and returns the response
type PaypalPaymentCreation ¶
type PaypalPaymentCreation struct { Intent string `json:"intent"` RedirectURL PaypalRedirectURL `json:"redirect_urls"` Payer PaypalPayer `json:"payer"` Transactions []PaypalTransaction `json:"transactions"` }
PaypalPaymentCreation struct for creating paypal payments
type PaypalPaymentInformation ¶
type PaypalPaymentInformation struct { ID string Intent string `json:"intent"` State string `json:"state"` Payer PaypalPayerInformation `json:"payer"` Transactions []PaypalTransaction `json:"transactions"` }
PaypalPaymentInformation contains information about an executed payment
func ProcessPaypalPayment ¶
func ProcessPaypalPayment(baseURL, payerID, paymentID, paypalToken string) (*PaypalPaymentInformation, error)
ProcessPaypalPayment executes a paypal payment
func (*PaypalPaymentInformation) IsEmpty ¶
func (p *PaypalPaymentInformation) IsEmpty() bool
IsEmpty checks if a payment is processed
type PaypalPaymentProcess ¶
type PaypalPaymentProcess struct {
PayerID string `json:"payer_id"`
}
PaypalPaymentProcess used to execute payments
type PaypalRedirectURL ¶
type PaypalRedirectURL struct { ReturnURL string `json:"return_url"` CancelURL string `json:"cancel_url"` }
PaypalRedirectURL redirect url payment
type PaypalToken ¶
type PaypalToken struct { Scope string `json:"scope"` Token string `json:"access_token"` Type string `json:"token_type"` ExpiresIn int64 `json:"expires_in"` }
PaypalToken is the main oauth struct for paypal
func GetPaypalToken ¶
func GetPaypalToken(baseURL, public, private string) (*PaypalToken, error)
GetPaypalToken returns a new paypal oauth token
type PaypalTransaction ¶
type PaypalTransaction struct { Amount PaypalAmount `json:"amount"` Description string `json:"description"` }
PaypalTransaction array of paypal payment transactions
type ServerHouses ¶
type ServerHouses struct { List *HouseList // contains filtered or unexported fields }
ServerHouses contains the whole house list of the server
func (*ServerHouses) GetHouse ¶
func (s *ServerHouses) GetHouse(id uint32) *House
GetHouse gets a house by its ID
func (*ServerHouses) GetHouseByName ¶
func (s *ServerHouses) GetHouseByName(name string) *House
GetHouseByName gets a house by its name
func (*ServerHouses) GetList ¶
func (s *ServerHouses) GetList(id uint32) []*House
GetList returns the full list of houses by its town
type ServerItems ¶
type ServerItems struct { Items map[int]ItemDefinition // contains filtered or unexported fields }
ServerItems holds all server items
func (*ServerItems) Get ¶
func (s *ServerItems) Get(id int) *ItemDefinition
Get gets an item by its ID
type ServerMonsters ¶
type ServerMonsters struct {
// contains filtered or unexported fields
}
ServerMonsters holds all server monsters
func (*ServerMonsters) Get ¶
func (m *ServerMonsters) Get(name string) *Monster
Get returns a monster struct
type ServerStages ¶
type ServerStages struct {
// contains filtered or unexported fields
}
ServerStages holds all the server stages
func (*ServerStages) Get ¶
func (s *ServerStages) Get(index int) StageDef
Get returns an stage by its index
func (*ServerStages) GetAll ¶
func (s *ServerStages) GetAll() []StageDef
GetAll retrieves all stages
func (*ServerStages) IsEnabled ¶
func (s *ServerStages) IsEnabled() bool
IsEnabled checks if stages are enabled on the server
type ServerTowns ¶
ServerTowns contains the whole town list of the server
func (*ServerTowns) Exists ¶
func (s *ServerTowns) Exists(name string) bool
Exists checks if a town is valid
func (*ServerTowns) Get ¶
func (s *ServerTowns) Get(name string) *otmap.Town
Get returns a town by its name
func (*ServerTowns) GetByID ¶
func (s *ServerTowns) GetByID(id uint32) string
GetByID returns a town by its ID
func (*ServerTowns) GetList ¶
func (s *ServerTowns) GetList() []otmap.Town
GetList returns the whole town list
func (*ServerTowns) GetRandom ¶
func (s *ServerTowns) GetRandom() otmap.Town
GetRandom returns a random town
type SpriteFile ¶
SpriteFile contains all the information about the .spr file