Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // 1 - change names to (exact) goods names and change number of elements in "goods" to number of goods types
- localStorage.setItem("goodstypes", JSON.stringify(["BioTech Crops", "Fusion Reactors", "Lubricant", "Mars Microbes", "Superalloys", "Bromine", "Compound Fluid", "Nickel", "Platinum Crystals", "Processed Materials","Promethium","Orichalcum","Mars Ore", "Asteroid Ice"]))
- localStorage.setItem("goods", JSON.stringify([0,0,0,0,0,0,0,0,0,0,0,0,0,0]))
- // 2 - open each sector you want to include and use following script
- var goods = JSON.parse(localStorage.getItem("goods"));
- var goodstypes = JSON.parse(localStorage.getItem("goodstypes"));
- for(var i = 3; i<document.getElementsByClassName("FoETable")[0].rows.length; i++){
- if(document.getElementsByClassName("FoETable")[0].rows[i].cells[3] == undefined){continue;}
- for(var n = 0; n < document.getElementsByClassName("FoETable")[0].rows[i].cells[3].childNodes.length; n += 2){
- if(document.getElementsByClassName("FoETable")[0].rows[i].cells[3].childNodes[n].alt != undefined){
- goods[goodstypes.indexOf(document.getElementsByClassName("FoETable")[0].rows[i].cells[3].childNodes[n].alt)] += parseInt(document.getElementsByClassName("FoETable")[0].rows[i].cells[3].childNodes[n+1].data);
- }else{
- goods[goodstypes.indexOf(document.getElementsByClassName("FoETable")[0].rows[i].cells[3].childNodes[n].childNodes[0].alt)] += parseInt(document.getElementsByClassName("FoETable")[0].rows[i].cells[3].childNodes[n+1].data);
- }
- }
- }
- localStorage.setItem("goods",JSON.stringify(goods));
- localStorage.setItem("goodstypes",JSON.stringify(goodstypes));
- // 3 - print results
- var testgoods = JSON.parse(localStorage.getItem("goods"));
- var testgoodstypes = JSON.parse(localStorage.getItem("goodstypes"));
- for(var i = 0; i<14; i++){
- console.log(testgoodstypes[i] + ": " + testgoods[i]);
- }
- // 4 - go back to step 2 to continue adding goods, jump to step 1 to reset count
Add Comment
Please, Sign In to add comment