SpaceNinjaServer/static/json/scripts/missions-drop-table-get-script.js

31 lines
8.1 KiB
JavaScript
Raw Normal View History

2023-09-01 11:17:24 +04:00
// for https://www.warframe.com/ru/droptables
/* eslint-disable */
(() => {
2023-09-03 21:25:54 +04:00
const missionNames = {"Mercury/Larunda Relay":"MercuryHUB","Venus/Vesper Relay":"VenusHUB","Earth/Strata Relay":"EarthHUB","Mars/Maroo's Bazaar":"TradeHUB1","Saturn/Kronia Relay":"SaturnHUB","Eris/Kuiper Relay":"ErisHUB","Europa/Leonov Relay":"EuropaHUB","Pluto/Orcus Relay":"PlutoHUB","Venus/Romula":"ClanNode0","Venus/Malva":"ClanNode1","Earth/Coba":"ClanNode2","Earth/Tikal":"ClanNode3","Jupiter/Sinai":"ClanNode4","Jupiter/Cameria":"ClanNode5","Europa/Larzac":"ClanNode6","Europa/Cholistan":"ClanNode7","Mars/Kadesh":"ClanNode8","Mars/Wahiba":"ClanNode9","Phobos/Memphis":"ClanNode10","Phobos/Zeugma":"ClanNode11","Saturn/Caracol":"ClanNode12","Saturn/Piscinas":"ClanNode13","Sedna/Amarna":"ClanNode14","Sedna/Sangeru":"ClanNode15","Uranus/Ur":"ClanNode16","Uranus/Assur":"ClanNode17","Eris/Akkad":"ClanNode18","Eris/Zabala":"ClanNode19","Neptune/Yursa":"ClanNode20","Neptune/Kelashin":"ClanNode21","Ceres/Seimeni":"ClanNode22","Ceres/Gabii":"ClanNode23","Pluto/Sechura":"ClanNode24","Pluto/Hieracon":"ClanNode25","Phobos/Roche":"SettlementNode1","Phobos/Skyresh":"SettlementNode2","Phobos/Stickney":"SettlementNode3","Phobos/Kepler":"SettlementNode10","Phobos/Gulliver":"SettlementNode11","Phobos/Monolith":"SettlementNode12","Phobos/Shklovsky":"SettlementNode14","Phobos/Sharpless":"SettlementNode15","Phobos/Iliad":"SettlementNode20","Neptune/Galatea":"SolNode1","Venus/Aphrodite":"SolNode2","Pluto/Acheron":"SolNode4","Neptune/Despina":"SolNode6","Uranus/Rosalind":"SolNode9","Jupiter/Thebe":"SolNode10","Mars/Tharsis":"SolNode11","Mercury/Elion":"SolNode12","Mars/Ultor":"SolNode14","Earth/Pacific":"SolNode15","Mars/Augustus":"SolNode16","Neptune/Proteus":"SolNode17","Saturn/Rhea":"SolNode18","Saturn/Enceladus":"SolNode19","Saturn/Telesto":"SolNode20","Pluto/Narcissus":"SolNode21","Venus/Tessera":"SolNode22","Venus/Cytherean":"SolNode23","Earth/Oro":"SolNode24","Jupiter/Callisto":"SolNode25","Earth/Lith":"SolNode26","Earth/E Prime":"SolNode27","Mercury/Terminus":"SolNode28","Mars/Olympus":"SolNode30","Saturn/Anthe":"SolNode31","Saturn/Tethys":"SolNode32","Uranus/Ariel":"SolNode33","Uranus/Sycorax":"SolNode34","Mars/Martialis":"SolNode36","Pluto/Minthe":"SolNode38","Earth/Everest":"SolNode39","Mars/Arval":"SolNode41","Saturn/Helene":"SolNode42","Pluto/Cerberus":"SolNode43","Mars/Ara":"SolNode45","Mars/Spear":"SolNode46","Pluto/Regna":"SolNode48","Neptune/Larissa":"SolNode49","Saturn/Numa":"SolNode50","Pluto/Hades":"SolNode51","Jupiter/Themisto":"SolNode53","Pluto/Cypress":"SolNode56","Neptune/Sao":"SolNode57","Mars/Hellas":"SolNode58","Earth/Eurasia":"SolNode59","Uranus/Caliban":"SolNode60","Venus/Ishtar":"SolNode61","Neptune/Neso":"SolNode62","Earth/Mantle":"SolNode63","Uranus/Umbriel":"SolNode64","Mars/Gradivus":"SolNode65","Venus/Unda":"SolNode66","Saturn/Dione":"SolNode67","Mars/Vallis":"SolNode68","Uranus/Ophelia":"SolNode69","Saturn/Cassini":"SolNode70","Pluto/Outer Terminus":"SolNode72","Jupiter/Ananke":"SolNode73","Jupiter/Carme":"SolNode74","Earth/Cervantes":"SolNode75","Pluto/Hydra":"SolNode76","Neptune/Triton":"SolNode78","Earth/Cambria":"SolNode79","Pluto/Palus":"SolNode81","Saturn/Calypso":"SolNode82","Uranus/Cressida":"SolNode83","Neptune/Nereid":"SolNode84","Earth/Gaia":"SolNode85","Jupiter/Ganymede":"SolNode87","Jupiter/Adrastea":"SolNode88","Earth/Mariana":"SolNode89","Saturn/Keeler":"SolNode93","Mercury/Apollodorus":"SolNode94","Saturn/Titan":"SolNode96","Jupiter/Amalthea":"SolNode97","Uranus/Desdemona":"SolNode98","Mars/War":"SolNode99","Jupiter/Elara":"SolNode100","Venus/Kiliken":"SolNode101","Pluto/Oceanum":"SolNode102","Mercury/M Prime":"SolNode103","Venus/Fossa":"SolNode104","Uranus/Titania":"SolNode105","Mars/Alator":"SolNode106","Venus/Venera":"SolNode107","Mercury/Tolstoj":"SolNode108","Venus/Linea":"SolNode109","Mars/Ares":"SolNode113","Uranus/Puck":"SolNode114","Neptune/Laomedeia":"SolNode118","Mercury/Caloris":"SolNode119","Jupiter/Carpo":"SolNode121","Uranus/Stephano":"SolNode122","Venus/V Prime":"SolNode123","Jupiter/Io":"SolNode125","Jupiter/Metis":"SolNode126","Neptune/Psamathe":"SolNode127","Venus/E G
const result = {};
let lastItem = [];
let lastItemIndex;
2023-09-01 11:17:24 +04:00
let rotation;
Array.from(document.querySelectorAll("table")[0].children[0].children).forEach(element => {
if (element.classList.contains('blank-row')) {
2023-09-03 21:25:54 +04:00
if(lastItemIndex) result[lastItemIndex]=lastItem;
lastItem = [];
lastItemIndex = undefined;
2023-09-01 11:17:24 +04:00
rotation = undefined;
} else if (element.children[0].getAttribute('colspan') == 2) {
2023-09-03 21:25:54 +04:00
if (!lastItemIndex) {
2023-09-01 15:38:41 +04:00
const mission = element.children[0].textContent;
const formatedMission = mission.substring(0, mission.indexOf(' ('))
2023-09-03 21:25:54 +04:00
lastItemIndex = missionNames[formatedMission];
2023-09-01 15:38:41 +04:00
} else{
2023-09-02 01:56:08 +04:00
rotation = element.children[0].textContent.replace('Rotation ', '');
2023-09-01 15:38:41 +04:00
}
2023-09-01 11:17:24 +04:00
} else {
const name = element.children[0].textContent;
2023-09-01 15:38:41 +04:00
const chance = parseFloat(element.children[1].textContent.match(/(\d+\.\d+)/)[0]);
2023-09-03 21:25:54 +04:00
lastItem.push({ chance, name, ...(rotation !== undefined && { rotation }) });
2023-09-01 11:17:24 +04:00
}
});
return JSON.stringify(result);
})();