Skip to content

Instantly share code, notes, and snippets.

@secondfry
Created January 30, 2017 23:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save secondfry/cd8296bcb8b5a8a61b28016f24201ccd to your computer and use it in GitHub Desktop.
Save secondfry/cd8296bcb8b5a8a61b28016f24201ccd to your computer and use it in GitHub Desktop.
eve-marketdata.com unique planet finder
/**
* Scripts for pages alike https://eve-marketdata.com/pi.php?step=PIPlanner2&type_name=Broadcast+Node&solarsystem_name=Resbroko
*/
var dict = {
'Aqueous Liquids': ['Barren', 'Gas', 'Ice', 'Oceanic', 'Storm', 'Temperate'],
'Autotrophs': ['Temperate'],
'Base Metals': ['Ice', 'Oceanic', 'Temperate'],
'Reactive Metals': ['Ice', 'Oceanic', 'Temperate'], // FIXME
'Carbon Compounds': ['Barren', 'Oceanic', 'Temperate'],
'Complex Organisms': ['Oceanic', 'Temperate'],
'Felsic Magma': ['Lava'],
'Heavy Metals': ['Ice', 'Lava', 'Plasma'],
'Ionic Solutions': ['Gas', 'Storm'],
'Micro Organisms': ['Barren', 'Ice', 'Oceanic', 'Temperate'],
'Microorganisms': ['Barren', 'Ice', 'Oceanic', 'Temperate'], // FIXME
'Bacteria': ['Barren', 'Ice', 'Oceanic', 'Temperate'], // FIXME
'Noble Gas': ['Gas', 'Ice', 'Storm'],
'Noble Metals': ['Barren', 'Plasma'],
'Non-CS Crystals': ['Lava', 'Plasma'],
'Planktic Colonies': ['Ice', 'Oceanic'],
'Biomass': ['Ice', 'Oceanic'], // FIXME
'Reactive Gas': ['Gas'],
'Suspended Plasma': ['Lava', 'Plasma', 'Storm'],
'Plasmoids': ['Lava', 'Plasma', 'Storm'], // FIXME
}
$.getScript('https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.4/lodash.min.js')
.done(() => {
let
unique = {},
planets = [],
unique_sorted;
_.each(dict, (v, k) => {
let size = _.size(v);
dict[k] = {size: size, data: v, key: k};
})
$('.raw').each((i, item) => {
let name = item.innerText.split('\n')[1];
if (name !== undefined) {
unique[name] = dict[name];
}
});
unique_sorted = _.sortBy(unique, ['size']);
console.log(unique, unique_sorted);
logRaw = () => {
_.each(unique, function(item) {
console.log(item);
});
}
logPlanets = () => {
_.each(unique_sorted, function(item) {
if (_.isEmpty(_.intersection(planets, item['data']))) {
planets = _.concat(planets, item['data'][0]);
}
});
console.log(planets);
}
logPlanets();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment