-
Notifications
You must be signed in to change notification settings - Fork 32
/
LoadIndexes.gs
38 lines (28 loc) · 1.08 KB
/
LoadIndexes.gs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/*
A function for loading system industry indexes.
*/
function loadIndexes() {
var url="https://esi.tech.ccp.is/latest/industry/systems/?datasource=tranquility"
var parameters = {method : "get", payload : ""};
var jsonFeed = UrlFetchApp.fetch(url, parameters).getContentText();
data = JSON.parse(jsonFeed)
var systems=new Array()
systems.push(['id','manufacturing','time efficiency','material efficiency','copying','invention','reaction']);
if (data) {
for (var i = 0; i < data.length; i++) {
var system=new Object()
for (var j =0; j< data[i].cost_indices.length;j++) {
system[data[i].cost_indices[j].activity]=data[i].cost_indices[j].cost_index;
}
systems.push([data[i].solar_system_id,
system['manufacturing'],
system['researching_time_efficiency'],
system['researching_material_efficiency'],
system['copying'],
system['invention'],
system['reaction'],
]);
}
}
return systems
}