gw2#

Guild Wars 2 utilities, data, and API access.

Submodules

Functions#

gw2.currentspecialization()#

Return the information on the player’s current (elite) specialization.

This uses MumbleLink to determine what specialization is in the player’s third build slot.

See gw2.data.specialization() and GW2 API: v2/specializations

Note

This function will return nil if the MumbleLink data is invalid, such as before a character has been logged in for the first time.

Return type:

table

Version History

Version

Notes

0.3.0

Added

Classes#

class gw2.basicapi#

A class that provides basic API access.

This is an intermediate level wrapper, but does not rely upon particular schemas or features of the API to function.

Example#
local gw2 = require 'gw2'
local overlay = require 'eg-overlay'

local api = gw2.basicapi.new()

-- by default requests are not authenticated
local build = api:get('/build')
overlay.loginfo(string.format("GW2 Build ID: %d", build.id))

-- user can specify an API key
api:useauth('XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXXXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX')

local acount = api:get('/account')
overlay.loginfo(string.format('Account ID = %s', account.id))
new()#

Create a new basicapi object.

Return type:

basicapi

Version History

Version

Notes

0.3.0

Added

get(endpoint[, params])#

Perform a GET against endpoint and return the JSON results as a Lua table.

Warning

This function will coroutine.yield while the request is pending.

Parameters:

endpoint (string) – Any valid GW2 v2 API endpoint, such as '/account'. See GW2 API.

Returns:

A table or nil on failure, HTTP status code, HTTP response headers

Version History

Version

Notes

0.3.0

Added

useauth(key)#

Sets the API authentication key to use when performing API requests.

By default no key is used. If nil is specified, no key will be used.

Parameters:

key (string) – A valid GW2 API Key or nil.

Version History

Version

Notes

0.3.0

Added

class gw2.coordinateconverter#
new([mapid])#

Create a new coordinate converter for the given map.

If mapid is omitted or nil, the new converter will be created for the current map, based on mumble-link.

Return type:

coordinateconverter

Version History

Version

Notes

0.3.0

Added

map2continent(mapx, mapz)#

Convert map x, z to continent continent x, y coordinates.

Note

This needs the X and Z coordinates from the map coordinates, NOT X and Y.

Returns:

2 numbers

Version History

Version

Notes

0.3.0

Added