Created
June 13, 2015 16:25
-
-
Save Grogdor/d4f2ca217c3efb4791fb to your computer and use it in GitHub Desktop.
[FUSON] IS-5 Campaign
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var appID = ""; // from https://na.wargaming.net/developers/applications/ | |
var clanID = 1000005063; // [FUSON] | |
function getClanMembers() { | |
var url = 'https://api.worldoftanks.com/wot/clan/info/?application_id=' + appID + '&clan_id=' + clanID; | |
var response = UrlFetchApp.fetch(url); | |
var json = response.getContentText(); | |
var raw = JSON.parse(json); | |
var clanMembers = raw.data[clanID].members; | |
return clanMembers; | |
} | |
function getPlayerFame(acctID) { | |
var url = 'https://api.worldoftanks.com/wot/globalwar/accountpoints/?application_id=' + appID + '&map_id=eventmap&account_id=' + acctID; | |
var response = UrlFetchApp.fetch(url); | |
var json = response.getContentText(); | |
var raw = JSON.parse(json); | |
if (raw.data[acctID]) return raw.data[acctID].points | |
else return 0; | |
} | |
function makeFame() { | |
var ss = SpreadsheetApp.getActiveSpreadsheet(); | |
//var timestamp = Utilities.formatDate(new Date(), "EST", "MMM d "); | |
//var sheet = ss.insertSheet(timestamp,1); | |
var sheet = ss.getActiveSheet(); | |
var clanMembers = getClanMembers(); | |
var playerFame; | |
sheet.clear(); | |
for (i in clanMembers) | |
{ | |
var name = clanMembers[i].account_name; | |
playerFame = getPlayerFame(i); | |
sheet.appendRow([name, playerFame]) | |
} | |
sheet.sort(2, false); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment