API:1/event_details

From Guild Wars 2 Wiki
Jump to: navigation, search

/v1/event_details.json

HTTP method
GET
Format
json
API version
version 1
Release date
 ?
Scope
none
Optional
none

This resource returns static details about available events.

Parameters

Optional parameters
  • event_id – Only list this event.
  • lang – Show localized texts in the specified language.

Response

The response is an object with the single property events which contains an object where event ids are mapped to an event details object, containing the following properties:

  • name (string) – The name of the event.
  • level (int) – The event level.
  • map_id (int) – The map where the event takes place.
  • flags (list) – A list of additional flags. Possible flags are:
    • "group_event" – For group events
    • "map_wide" – For map-wide events
    • "meta_event" – For meta events
    • "dungeon_event"
  • location (object) – The location of the event.
    • type (string) – The type of the event location, can be sphere, cylinder or poly.

Example

https://api.guildwars2.com/v1/event_details.json

{
  "events": {
    "EED8A79F-B374-4AE6-BA6F-B7B98D9D7142": {
      "name": "Defeat the renegade charr.",
      "level": 42,
      "map_id": 20,
      "flags": [],
      "location": {
        "type": "sphere",
        "center": [ -9463.6, -40310.2, -785.799 ],
        "radius": 2500,
        "rotation": 0
      }
    },
    "3A2B85C5-DE73-4402-BD84-8F53AA394A52": {
      "name": "Bonus Event: Cull the Flame Legion",
      "level": 80,
      "map_id": 929,
      "flags": [ "group_event" ],
      "location": {
        "type": "cylinder",
        "center": [ -38.7202, -176.915, -892.494 ],
        "height": 2027.5,
        "radius": 10314.4,
        "rotation": 0
      }
    },
    "CEA84FBF-2368-467C-92EA-7FA60D527C7B": {
      "name": "Find a way to open the door and escape the armory.",
      "level": 8,
      "map_id": 19,
      "flags": [ "group_event" ],
      "location": {
        "type": "poly",
        "center": [ -45685.2, -13819.6, -1113 ],
        "z_range": [ -2389, 163 ],
        "points": [
          [ -49395.8, -15845.5 ],
          [ -42699.7, -15794.1 ],
          [ -43053, -14081.4 ],
          [ -43629.7, -11725.4 ],
          [ -49647.8, -11651.7 ]
        ]
      }
    },
    ...
  }
}

Coordinate recalculation

Graphical visualization of coordinate translation. Coordinates depicted are [9835, -17597] and [12058, 13661] in the map and continent coordinate system respectively. Note that the y axis of the continent is inverse to that of the map coordinate system. The ratio between the distance of a map coordinate from the sides of the map (one side for x (magenta) and y (yellow) depicted) to the width and height of the map respectively is preserved throughout the translation to the continent system.

A simple code example in Javascript to recalculate the event (and Mumble Link) coordinates from the maps coordinate system to the world coordinate system. (more on that topic on the official forums):

/**
 * @param {[]} continent_rect  taken from maps.json or map_floor.json
 * @param {[]} map_rect        taken from maps.json or map_floor.json
 * @param {[]} coords          from event_details.json or Mumble Link data.
 * @returns {*[]}
 *
 * @example for the Shadow Behemoth event on the map of Queensdale (31CEBA08-E44D-472F-81B0-7143D73797F5):
 *          scale_coords([[9856,11648],[13440,14080]], [[-43008,-27648],[43008,30720]], [9835,-17597])
 *          -> [12058, 13661]
 */
function scale_coords(continent_rect, map_rect, coords){
	return [
		Math.round(continent_rect[0][0]+(continent_rect[1][0]-continent_rect[0][0])*(coords[0]-map_rect[0][0])/(map_rect[1][0]-map_rect[0][0])),
		Math.round(continent_rect[0][1]+(continent_rect[1][1]-continent_rect[0][1])*(1-(coords[1]-map_rect[0][1])/(map_rect[1][1]-map_rect[0][1])))
	]
}

To recalculate the length values like radius and height, use the following function:

/**
 * @param {[]}     map_rect   taken from maps.json or map_floor.json
 * @param {number} length     from event_details.json or Mumble Link data.
 * @returns {number}
 */
function scale_length(map_rect, length){
	length = length / (1/24); // length values are given in inches

	let scalex = (length - map_rect[0][0]) / (map_rect[1][0] - map_rect[0][0]);
	let scaley = (length - map_rect[0][1]) / (map_rect[1][1] - map_rect[0][1]);
	return Math.sqrt((scalex * scalex) + (scaley * scaley));
}