JS script - servers with available temples
DarkSpirit.7046:
Here is a fast hack of a windows scripting host scriplet to list the servers with temples that are cleared by checking their corresponding Defense events.
To run it, just copy and paste these 2 files in the same directory. Also download json2.js from the internet into the same directory. Then type this in a cmd box:
cscript events.wsf
events.wsf:
<job id="gw2events">
<Script type="text/javascript" src="json2.js" />
<Script type="text/javascript" src="gw2events.js" />
<script type="text/javascript">
var api = new GW2EVENTS();
var eventNames = api.EventNames();
var worldNames = api.WorldNames();
var mapNames = api.MapNames();
//var eventIdToCheck = "0723E056-E665-439F-99B7-20385442AD4E"; // "Protect the Cathedral of Zephyrs." - Dwayna
//var eventIdToCheck = "0372874E-59B7-4A8F-B535-2CF57B8E67E4"; // "Kill the Corrupted High Priestess" - Lyssa
//var eventIdToCheck = "989A298C-B06B-4E9B-A871-1506A6EE3FEC"; // "Defend the Pact interrupter from Risen attacks." - Melandru
//var eventIdToCheck = "DFBFF5FE-5AF0-4B65-9199-B7CACC945ABD"; // "Ensure that the Pact holds the Gates of Arah." - Arah
//var eventIdToCheck = "57A8E394-092D-4877-90A5-C238E882C320"; // "Stop the Risen Priest of Grenth from retaking the Cathedral of
Silence." - Grenth
//var eventIdToCheck = "9752677E-FAE7-4F56-A48A-275329095B8A"; // "Hold the Infinity Coil." - CoE
var eventIdToCheck = "589B1C41-DD96-4AEE-8A3A-4CC607805B05"; // "Help the Pact hold the Altar of Betrayal from the Risen." - Balthazar
for (var i in worldNames) {
if (api.IsUSWorld(worldNames[i])) {
var events = api.Events(worldNames[i].id, eventIdToCheck)
for (var j in events) {
if (events[j].state != "Fail") {
WScript.Echo(api.Name(worldNames,worldNames[i].id) + " " + events[j].state);
}
}
}
}
</script>
</job>
gw2events.js:
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
function GW2EVENTS()
{
this.Name = getName;
this.EventNames = getEventNames;
this.MapNames = getMapNames;
this.WorldNames = getWorldNames;
this.Events = getEvents;
this.IsUSWorld = IsUSWorld;
this.IsEuropeWorld = IsEuropeWorld;
function getName(list, id)
{
for (var i in list) {
if (list[i].id == id) return list[i].name;
}
return "Unknown";
}
function IsUSWorld(world)
{
return (world.id.charAt(0) == '1');
}
function IsEuropeWorld(world)
{
return (world.id.charAt(0) == '2');
}
function getEventNames()
{
return _request('event_names.json');
}
function getMapNames()
{
return _request('map_names.json');
}
function getWorldNames()
{
return _request('world_names.json');
}
function getEvents(worldId, eventId)
{
var param = "", param2 = "";
if (typeof worldId != "undefined") {
param = "world_id=" + worldId;
}
if (typeof eventId != "undefined") {
param2 = "event_id=" + eventId;
}
return _request('events.json?', param, param2).events;
}
function _request()
{
var args = Array.prototype.slice.call(arguments)
try {
_HttpGet(args);
}
catch (e)
{
WScript.Echo ("Error: " + e.number);
WScript.Echo ("Retrying...");
try {
_HttpGet(args);
}
catch (e)
{
WScript.Echo ("Error: " + e.number);
}
}
try {
var outputString = _JSONParse();
}
catch(e)
{
WScript.Echo ("JSON parsing error! Retrying...");
_HttpGet(args);
var outputString = _JSONParse();
}
return(outputString);
}
function _HttpGet(args)
{
xmlhttp.open("GET", "https://api.guildwars2.com/v1/" + args.join("&"), false);
xmlhttp.send();
}
function _JSONParse()
{
var parseString = xmlhttp.responseText;
return JSON.parse(parseString);
}
}
DarkSpirit.7046:
Unfortunately, some of the comment lines were truncated. Anyway here are the event ids:
“0723E056-E665-439F-99B7-20385442AD4E”; // “Protect the Cathedral of Zephyrs.” – Dwayna
“0372874E-59B7-4A8F-B535-2CF57B8E67E4”; // “Kill the Corrupted High Priestess” – Lyssa
“989A298C-B06B-4E9B-A871-1506A6EE3FEC”; // “Defend the Pact interrupter from Risen attacks.” – Melandru
“DFBFF5FE-5AF0-4B65-9199-B7CACC945ABD”; // “Ensure that the Pact holds the Gates of Arah.” – Arah
“57A8E394-092D-4877-90A5-C238E882C320”; // “Stop the Risen Priest of Grenth from retaking the Cathedral of Silence.” – Grenth
“589B1C41-DD96-4AEE-8A3A-4CC607805B05”; // “Help the Pact hold the Altar of Betrayal from the Risen.” – Balthazar
The discussion was held on this thread: