GW2.ChatCode.WardrobeTemplate (ex_gw2 v0.1.0)

Copy Markdown View Source

Represents a Guild Wars 2 wardrobe template (fashion template) chat code.

Wardrobe template chat codes (otherwise known as fashion templates) contain the skins, dyes and visibility settings for the given fashion template.

Use this struct with GW2.ChatCode.encode/1 and GW2.ChatCode.decode/1. Each slot is represented by a GW2.ChatCode.WardrobeTemplate.Skin struct, or nil when the slot is empty.

For slots with dye channels, nil is written as four Dye Remover ids (1).

Examples

iex> GW2.ChatCode.encode(%GW2.ChatCode.WardrobeTemplate{})
{:ok, "[&DwAAAAABAAEAAQABAAAAAQABAAEAAQAAAAEAAQABAAEAAAABAAEAAQABAAAAAQABAAEAAQAAAAEAAQABAAEAAAABAAEAAQABAAAAAQABAAEAAQAAAAAAAAAAAAAAAAD/fw==]"}

iex> template = %GW2.ChatCode.WardrobeTemplate{
...>   helmet: %GW2.ChatCode.WardrobeTemplate.Skin{id: 983}
...> }
iex> GW2.ChatCode.encode(template)
{:ok, "[&DwAAAAABAAEAAQABAAAAAQABAAEAAQAAAAEAAQABAAEAAAABAAEAAQABANcDAQABAAEAAQAAAAEAAQABAAEAAAABAAEAAQABAAAAAQABAAEAAQAAAAAAAAAAAAAAAAD/fw==]"}

Summary

Types

t()

A wardrobe template link decoded from, or ready to encode as, a chat code.

Functions

Decodes a wardrobe template chat code payload into a struct.

Encodes a wardrobe template struct into the binary payload used inside a chat code.

Types

t()

@type t() :: %GW2.ChatCode.WardrobeTemplate{
  aquabreather: GW2.ChatCode.WardrobeTemplate.Skin.t() | nil,
  aquatic_weapon_a: GW2.ChatCode.WardrobeTemplate.Skin.t() | nil,
  aquatic_weapon_b: GW2.ChatCode.WardrobeTemplate.Skin.t() | nil,
  backpiece: GW2.ChatCode.WardrobeTemplate.Skin.t() | nil,
  boots: GW2.ChatCode.WardrobeTemplate.Skin.t() | nil,
  chest: GW2.ChatCode.WardrobeTemplate.Skin.t() | nil,
  gloves: GW2.ChatCode.WardrobeTemplate.Skin.t() | nil,
  helmet: GW2.ChatCode.WardrobeTemplate.Skin.t() | nil,
  leggings: GW2.ChatCode.WardrobeTemplate.Skin.t() | nil,
  outfit: GW2.ChatCode.WardrobeTemplate.Skin.t() | nil,
  shoulders: GW2.ChatCode.WardrobeTemplate.Skin.t() | nil,
  weapon_a_mainhand: GW2.ChatCode.WardrobeTemplate.Skin.t() | nil,
  weapon_a_offhand: GW2.ChatCode.WardrobeTemplate.Skin.t() | nil,
  weapon_b_mainhand: GW2.ChatCode.WardrobeTemplate.Skin.t() | nil,
  weapon_b_offhand: GW2.ChatCode.WardrobeTemplate.Skin.t() | nil
}

A wardrobe template link decoded from, or ready to encode as, a chat code.

Functions

decode(arg1)

@spec decode(binary()) :: {:ok, t()} | {:error, atom()}

Decodes a wardrobe template chat code payload into a struct.

Most applications should call GW2.ChatCode.decode/1 instead, which accepts the full chat code string.

encode(wardrobe_template)

@spec encode(t()) :: {:ok, binary()} | {:error, atom()}

Encodes a wardrobe template struct into the binary payload used inside a chat code.

Most applications should call GW2.ChatCode.encode/1 instead, which also adds the chat code wrapper and Base64-encodes the payload.