API:MumbleLink

From Guild Wars 2 Wiki
Jump to: navigation, search

GuildWars 2 is exposing a number of real-time contextual data using the MumbleLink specification.

This allows desktop developers to obtain information about the player state without having to query the API

MumbleLink structure

The MumbleLink specification is a Memory Shared File named "MumbleLink" using the following structure:[1]

struct LinkedMem {
#ifdef WIN32
	UINT32	uiVersion;
	DWORD	uiTick;
#else
	uint32_t uiVersion;
	uint32_t uiTick;
#endif
	float	fAvatarPosition[3];
	float	fAvatarFront[3];
	float	fAvatarTop[3];
	wchar_t	name[256];
	float	fCameraPosition[3];
	float	fCameraFront[3];
	float	fCameraTop[3];
	wchar_t	identity[256];
#ifdef WIN32
	UINT32	context_len;
#else
	uint32_t context_len;
#endif
	unsigned char context[256];
	wchar_t description[2048];
};

Value updates

  • f* vars should be updated every frame, you should safely be able to read from them 50 times a second
  • context and identity shouldn't change more than a few times per second.

Usage in Guild Wars 2

In addition to the f* vars, Guild Wars 2 utilizes the context and identity fields to store additional data.

context

The context field holds another structure containing the following data.[2]

struct MumbleContext {
    byte serverAddress[28]; // contains sockaddr_in or sockaddr_in6
    unsigned mapId;
    unsigned mapType;
    unsigned shardId;
    unsigned instance;
    unsigned buildId;
};

identity

The identity field contains a JSON string with the following fields.[3]

  • name (string) – Character name
  • profession (number) – Character's profession
    • 1 – Guardian
    • 2 – Warrior
    • 3 – Engineer
    • 4 – Ranger
    • 5 – Thief
    • 6 – Elementalist
    • 7 – Mesmer
    • 8 – Necromancer
    • 9 – Revenant
  • race (number) – Character's race
    • 0 – Asura
    • 1 – Charr
    • 2 – Human
    • 3 – Norn
    • 4 – Sylvari
  • map_id (number) – Per API:2/maps
  • world_id (number) – Formerly per API:2/worlds; not usable since the switch to the megaserver system
  • team_color_id (number) – Team color per API:2/colors (0 = white)
  • commander (boolean) – Whether the character has a commander tag active
  • fov (number) – Vertical field-of-view
  • uisz (number) – A value corresponding to the user's current UI scaling.
    • 0 – Small
    • 1 – Normal
    • 2 – Large
    • 3 – Larger

Example

{
  "name":"Irwene",
  "profession": 4,
  "race": 4,
  "map_id": 50,
  "world_id": 268435505,
  "team_color_id": 0,
  "commander": false,
  "fov": 0.873,
  "uisz": 1
}

References

  1. ^ Mumble Wiki
  2. ^ This was discovered by various forum users and confirmed by Arena Net Staff [1]
  3. ^ The meaning of some numerical values were found by users on the Guild Wars 2 API development forums [2]