Best way to get current sPvP season?
Nekres.1038:
Hey, I have a tiny little question.
Back in the early days I was always getting the current season this way out of the json:
(taken from my JavaScript)
var currSeason = parseInt(Object.keys(data).length - 1)
because the json array was layed out so that the newest season was always created at the end.
Now with season 4 the array is twisted and season 2 or 3 swapped places with 4 and now I am checking for the UUID like so (taken from my php script):
$Season_1 = '44B85826-B5ED-4890-8C77-82DDF9F2CF2B';
$Season_2 = '95D5B290-798A-421E-A919-1C2A75F74B72';
$Season_3 = 'D1777261-555B-4B72-A27E-BDC96EC393D5';
$Season_4 = '2B2E80D3-0A74-424F-B0EA-E221500B323C';
$currSeason = $Season_4;
Problem with this is that I have to manually adjust $currSeason equals $Season_X everytime a new season starts. I will have to update even my tiniest scripts.
Any ideas to get the current season automatically now with the array being messed up?
Nekres.1038:
lol I was searching for a key named ‘active’ or something in https://api.guildwars2.com/v2/pvp/seasons?id= found it after 1 minute of opening this thread. Only bad thing about this that I will have to do another request for every UUID until it finds the active one. …
Please close this and I apologize
Abominable Snowman.2036:
Why not use seasons?ids=all ?