ex_gw2 is an Elixir library for working with Guild Wars 2 data.
The package currently focuses on Guild Wars 2 chat codes: the [&...] links
the game creates when linking items and wardrobe templates in chat.
Warning
This library is still under construction and is not fully feature complete. Proceed with caution, especially before relying on it in production code.
Installation
Add ex_gw2 to your list of dependencies in mix.exs:
def deps do
[
{:ex_gw2, "~> 0.1.0"}
]
endDocumentation can be found at https://hexdocs.pm/ex_gw2.
Usage
Decode a chat code into a typed struct:
GW2.ChatCode.decode("[&Agn2qgAA]")
#=> {:ok, %GW2.ChatCode.Item{id: 43766, quantity: 9, skin_id: nil, upgrade_ids: []}}Encode a supported struct back into a chat code:
GW2.ChatCode.encode(%GW2.ChatCode.Item{id: 46762})
#=> {:ok, "[&AgGqtgAA]"}Item chat codes support item ids, quantities, skins, and up to two upgrade component ids:
GW2.ChatCode.encode(%GW2.ChatCode.Item{
id: 30691,
skin_id: 13826,
upgrade_ids: [91439, 91607]
})
#=> {:ok, "[&AgHjdwDgAjYAAC9lAQDXZQEA]"}Wardrobe template chat codes are represented by GW2.ChatCode.WardrobeTemplate
and one GW2.ChatCode.WardrobeTemplate.Skin per equipment slot. See the online
documentation for the full slot list and field descriptions.
Supported chat codes
ex_gw2 currently supports:
- Item chat codes via
GW2.ChatCode.Item. - Wardrobe template chat codes via
GW2.ChatCode.WardrobeTemplate.
Guild Wars 2 has other chat code types, including coins, maps, skills, traits, recipes, outfits, build templates, achievements, and travel templates. These are not implemented yet. Unsupported chat code types return an error tuple when decoded.
Stability
ex_gw2 is pre-1.0. Supported chat code formats are covered by tests, but public
struct fields, error reasons, and unsupported chat code behavior may change before
1.0.0.