2023-09-01 11:17:24 +04:00
|
|
|
// for https://www.warframe.com/ru/droptables
|
|
|
|
/* eslint-disable */
|
|
|
|
(() => {
|
|
|
|
const result = [];
|
|
|
|
let lastItem = {};
|
|
|
|
let rotation;
|
|
|
|
Array.from(document.querySelectorAll("table")[0].children[0].children).forEach(element => {
|
|
|
|
if (element.classList.contains('blank-row')) {
|
|
|
|
result.push(lastItem);
|
|
|
|
lastItem = {};
|
|
|
|
rotation = undefined;
|
|
|
|
} else if (element.children[0].getAttribute('colspan') == 2) {
|
|
|
|
if (!lastItem.mission) {
|
2023-09-01 15:38:41 +04:00
|
|
|
const mission = element.children[0].textContent;
|
|
|
|
const formatedMission = mission.substring(0, mission.indexOf(' ('))
|
|
|
|
lastItem.mission = formatedMission;
|
|
|
|
} 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 {
|
|
|
|
if (!lastItem.rewards)
|
|
|
|
lastItem.rewards = [];
|
|
|
|
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-02 01:56:08 +04:00
|
|
|
|
2023-09-01 11:17:24 +04:00
|
|
|
lastItem.rewards.push({ chance, name, ...(rotation !== undefined && { rotation }) });
|
|
|
|
}
|
|
|
|
});
|
|
|
|
return JSON.stringify(result);
|
|
|
|
})();
|