Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function wowi(toonName,realmName)
- {
- if (toonName.length == 0)
- return null;
- var toonName = toonName.split(" ")[0];
- var publicCache = CacheService.getPublicCache();
- var toonUrl = "eu.battle.net/api/wow/character/"+realmName+"/"+toonName+"?fields=items";
- try {
- var toonJSON = UrlFetchApp.fetch(toonUrl);
- if (toonJSON.getResponseCode() == 200)
- publicCache.put(toonUrl, toonJSON.getContentText());
- } catch (e) {
- Logger.log(e);
- }
- var toonText = publicCache.get(toonUrl);
- if (toonText == null)
- return null;
- else
- return Utilities.jsonParse(toonText).items.averageItemLevelEquipped;
- }
- function wowiBatch(toonNames, realmName)
- {
- var arr = []
- for (var i = 0; i < toonNames.length; i++)
- arr.push(wowi(toonNames[i].toString(), realmName));
- return arr;
- }
- function idxc(c, v)
- {
- if (v.length == 0)
- return null;
- for (var i = 0; i < c.length; i++) {
- var cc = c[i][0];
- for (var j = 0; j < cc.length; j++) {
- var t_ij = ("" + cc[j]).split(" ");
- for (var k = 0; k < t_ij.length; k++) {
- if (t_ij[k] == v)
- return (i + 1);
- }
- }
- }
- }
- function idxcBatch(c, v)
- {
- var arr = [];
- for (var i = 0; i < v.length; i++)
- arr.push(idxc(c, v[i]));
- return arr;
- }
Add Comment
Please, Sign In to add comment