Compare commits
9 Commits
05b76cec5c
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 914acb0a09 | |||
|
|
5fab2afa16 | ||
|
|
f4a6c08dd5 | ||
|
|
2ff302571d | ||
| 963f0b7d1c | |||
| 0613b011a1 | |||
| 0cb93c4925 | |||
|
|
046348a71e | ||
|
|
d0e2ecfdea |
@@ -1,7 +1,7 @@
|
|||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name IITC plugin: ResTools BB Watch Reloaded
|
// @name IITC plugin: ResTools BB Watch Reloaded
|
||||||
// @namespace https://git.martinvylet.cz/vykend/ResTools-BB-Watch-Reloaded
|
// @namespace https://git.martinvylet.cz/vykend/ResTools-BB-Watch-Reloaded
|
||||||
// @version 0.5.2
|
// @version 0.9.1
|
||||||
// @description Scan window for BBs on ornamented portals, then check results
|
// @description Scan window for BBs on ornamented portals, then check results
|
||||||
// @author vikend
|
// @author vikend
|
||||||
// @icon
|
// @icon
|
||||||
@@ -27,20 +27,19 @@ function wrapper(plugin_info)
|
|||||||
window.plugin.restoolsBBWatchReloaded.LAYERS = {};
|
window.plugin.restoolsBBWatchReloaded.LAYERS = {};
|
||||||
window.plugin.restoolsBBWatchReloaded.LAYERGROUP = null;
|
window.plugin.restoolsBBWatchReloaded.LAYERGROUP = null;
|
||||||
window.plugin.restoolsBBWatchReloaded.BB_STORAGE = 'plugin-restools-bbwatch-reloaded';
|
window.plugin.restoolsBBWatchReloaded.BB_STORAGE = 'plugin-restools-bbwatch-reloaded';
|
||||||
window.plugin.restoolsBBWatchReloaded.WAVE_PORTALS = [[[],[]],[[],[]],[[],[]],[[],[]],[[],[]],[[],[]],[[],[]]];
|
window.plugin.restoolsBBWatchReloaded.WAVE_PORTALS = [[[],[]],[[],[]],[[],[]],[[],[]],[[],[]],[[],[]]];
|
||||||
window.plugin.restoolsBBWatchReloaded.timezone = 0;
|
window.plugin.restoolsBBWatchReloaded.timezone = 0;
|
||||||
//struct of WAVE_PORTALS: [ wave: [ ornamented[], results[] ] ]
|
//struct of WAVE_PORTALS: [ wave: [ ornamented[], results[] ] ]
|
||||||
|
|
||||||
//edit this with start times according to YOUR local times (ie. as seen in COMM)
|
//edit this with start times according to YOUR local times (ie. as seen in COMM)
|
||||||
window.plugin.restoolsBBWatchReloaded.TIMETABLE = {
|
window.plugin.restoolsBBWatchReloaded.TIMETABLE = {
|
||||||
wave1: "14:00",
|
wave1: "14:00",
|
||||||
wave2: "14:25",
|
wave2: "14:30",
|
||||||
wave3: "14:50",
|
wave3: "15:00",
|
||||||
wave4: "15:15",
|
wave4: "15:30",
|
||||||
wave5: "15:40",
|
wave5: "16:00",
|
||||||
wave6: "16:05",
|
wave6: "16:30",
|
||||||
wave7: "16:30",
|
wave7: "17:00", //needed for calculations, put there end of wave 6
|
||||||
wave8: "16:55" //needed for calculations, put there end of wave 7
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -86,7 +85,7 @@ function wrapper(plugin_info)
|
|||||||
const offsetMilliseconds = timezoneOffsetHours * 60 * 60 * 1000; // Convert offset to milliseconds
|
const offsetMilliseconds = timezoneOffsetHours * 60 * 60 * 1000; // Convert offset to milliseconds
|
||||||
const currentTimeWithOffset = new Date(currentTime.getTime() + offsetMilliseconds);
|
const currentTimeWithOffset = new Date(currentTime.getTime() + offsetMilliseconds);
|
||||||
const currentTimeString = currentTimeWithOffset.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit', hour12: false });
|
const currentTimeString = currentTimeWithOffset.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit', hour12: false });
|
||||||
const currentTimePlus5Minutes = (new Date(currentTimeWithOffset.getTime() + 5 * 60000)).toLocaleTimeString([], { hour: '2-digit', minute: '2-digit', hour12: false });
|
const currentTimePlus5Minutes = (new Date(currentTimeWithOffset.getTime() + 10 * 60000)).toLocaleTimeString([], { hour: '2-digit', minute: '2-digit', hour12: false });
|
||||||
|
|
||||||
let currentWave = 0;
|
let currentWave = 0;
|
||||||
let battleOver = false;
|
let battleOver = false;
|
||||||
@@ -121,14 +120,14 @@ function wrapper(plugin_info)
|
|||||||
{
|
{
|
||||||
let ornaments = portal.options.data.ornaments;
|
let ornaments = portal.options.data.ornaments;
|
||||||
|
|
||||||
if (ornaments.indexOf("ap1") != -1 || ornaments.indexOf("peBN_RES_WINNER") != -1 || ornaments.indexOf("peBN_ENL_WINNER") != -1)
|
if (ornaments.indexOf("ap1") != -1 || ornaments.indexOf("ap2") != -1 || ornaments.indexOf("ap3") != -1 || ornaments.indexOf("ap1_v") != -1 || ornaments.indexOf("ap2_v") != -1 || ornaments.indexOf("ap3_v") != -1 || ornaments.indexOf("peBN_RES_WINNER-60") != -1 || ornaments.indexOf("peBN_ENL_WINNER-60") != -1)
|
||||||
{
|
{
|
||||||
let portalUpload = {
|
let portalUpload = {
|
||||||
Guid: portal.options.guid,
|
Guid: portal.options.guid,
|
||||||
IsOrnamented: (ornaments.indexOf("ap1") != -1),
|
IsOrnamented: (ornaments.indexOf("ap1") != -1 || ornaments.indexOf("ap1_v") != -1 || ornaments.indexOf("ap2") != -1 || ornaments.indexOf("ap2_v") != -1 || ornaments.indexOf("ap3") != -1 || ornaments.indexOf("ap3_v") != -1),
|
||||||
IsVolatile: (ornaments.indexOf("ap1_v") != -1),
|
IsVolatile: (ornaments.indexOf("ap1_v") != -1 ||ornaments.indexOf("ap2_v") != -1||ornaments.indexOf("ap3_v") != -1),
|
||||||
IsWinnerRes: (ornaments.indexOf("peBN_RES_WINNER") != -1),
|
IsWinnerRes: (ornaments.indexOf("peBN_RES_WINNER-60") != -1),
|
||||||
IsWinnerEnl: (ornaments.indexOf("peBN_ENL_WINNER") != -1),
|
IsWinnerEnl: (ornaments.indexOf("peBN_ENL_WINNER-60") != -1),
|
||||||
IsBeaconActive: (ornaments.indexOf("peBB_BATTLE_RARE") != -1),
|
IsBeaconActive: (ornaments.indexOf("peBB_BATTLE_RARE") != -1),
|
||||||
Beacons: ornaments.join(','),
|
Beacons: ornaments.join(','),
|
||||||
};
|
};
|
||||||
@@ -165,11 +164,14 @@ function wrapper(plugin_info)
|
|||||||
//this should record all ornamented portals in each wave.
|
//this should record all ornamented portals in each wave.
|
||||||
//plugin considers 5-minute-window at the end of each wave (or before start of the next one) as window where to check for BBs results
|
//plugin considers 5-minute-window at the end of each wave (or before start of the next one) as window where to check for BBs results
|
||||||
// = records ornamented portals to another array
|
// = records ornamented portals to another array
|
||||||
|
if (!waveBattleOver) {
|
||||||
if(portal.IsOrnamented) {
|
if(portal.IsOrnamented) {
|
||||||
if (!(window.plugin.restoolsBBWatchReloaded.WAVE_PORTALS[waveNo][waveBattleOver].find((obj) => obj.Guid === portal.Guid))) {
|
if (!(window.plugin.restoolsBBWatchReloaded.WAVE_PORTALS[waveNo][0].find((obj) => obj.Guid === portal.Guid))) {
|
||||||
portalsToBeAdded.push(portal);
|
portalsToBeAdded.push(portal);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else { //battle over
|
||||||
|
|
||||||
//if ornaments disappear too quickly, it is needed to add 2nd check
|
//if ornaments disappear too quickly, it is needed to add 2nd check
|
||||||
//has the portal winners beacon?
|
//has the portal winners beacon?
|
||||||
@@ -177,7 +179,7 @@ function wrapper(plugin_info)
|
|||||||
|
|
||||||
if(portal.IsWinnerRes || portal.IsWinnerEnl) {
|
if(portal.IsWinnerRes || portal.IsWinnerEnl) {
|
||||||
//check if portal wasnt already added in previous waves
|
//check if portal wasnt already added in previous waves
|
||||||
if (!(window.plugin.restoolsBBWatchReloaded.WAVE_PORTALS[waveNo][waveBattleOver].find((obj) => obj.Guid === portal.Guid))) {
|
if (!(window.plugin.restoolsBBWatchReloaded.WAVE_PORTALS[waveNo][1].find((obj) => obj.Guid === portal.Guid))) {
|
||||||
|
|
||||||
//check if portal isn't already in portalsToBeAdded
|
//check if portal isn't already in portalsToBeAdded
|
||||||
if (!(portalsToBeAdded.find((obj) => obj.Guid === portal.Guid))) {
|
if (!(portalsToBeAdded.find((obj) => obj.Guid === portal.Guid))) {
|
||||||
@@ -191,6 +193,7 @@ function wrapper(plugin_info)
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
window.plugin.restoolsBBWatchReloaded.WAVE_PORTALS[waveNo][waveBattleOver] = window.plugin.restoolsBBWatchReloaded.WAVE_PORTALS[waveNo][waveBattleOver].concat(portalsToBeAdded);
|
window.plugin.restoolsBBWatchReloaded.WAVE_PORTALS[waveNo][waveBattleOver] = window.plugin.restoolsBBWatchReloaded.WAVE_PORTALS[waveNo][waveBattleOver].concat(portalsToBeAdded);
|
||||||
window.plugin.restoolsBBWatchReloaded.saveStorage(window.plugin.restoolsBBWatchReloaded.WAVE_PORTALS);
|
window.plugin.restoolsBBWatchReloaded.saveStorage(window.plugin.restoolsBBWatchReloaded.WAVE_PORTALS);
|
||||||
console.log("BBWatchReloaded: Portals updated");
|
console.log("BBWatchReloaded: Portals updated");
|
||||||
@@ -206,15 +209,16 @@ function wrapper(plugin_info)
|
|||||||
for (let i in results) {
|
for (let i in results) {
|
||||||
let portal = results[i];
|
let portal = results[i];
|
||||||
if (ornamented.find((obj) => obj.Guid === portal.Guid)) {
|
if (ornamented.find((obj) => obj.Guid === portal.Guid)) {
|
||||||
|
var foundObj = ornamented.find((obj) => obj.Guid === portal.Guid);
|
||||||
if (portal.IsWinnerRes) {
|
if (portal.IsWinnerRes) {
|
||||||
resWin++;
|
resWin++;
|
||||||
if (portal.IsVolatile) {
|
if (foundObj.IsVolatile) {
|
||||||
resVolatiles++;
|
resVolatiles++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (portal.IsWinnerEnl) {
|
else if (portal.IsWinnerEnl) {
|
||||||
enlWin++;
|
enlWin++;
|
||||||
if (portal.IsVolatile) {
|
if (foundObj.IsVolatile) {
|
||||||
enlVolatiles++;
|
enlVolatiles++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -235,13 +239,20 @@ function wrapper(plugin_info)
|
|||||||
{
|
{
|
||||||
let waves = [];
|
let waves = [];
|
||||||
for (let i in window.plugin.restoolsBBWatchReloaded.WAVE_PORTALS) {
|
for (let i in window.plugin.restoolsBBWatchReloaded.WAVE_PORTALS) {
|
||||||
|
var volatiles = 0;
|
||||||
|
|
||||||
|
for (var j = 0; j < window.plugin.restoolsBBWatchReloaded.WAVE_PORTALS[i][0].length; j++) {
|
||||||
|
if (window.plugin.restoolsBBWatchReloaded.WAVE_PORTALS[i][0][j].IsVolatile === true) {
|
||||||
|
volatiles++;
|
||||||
|
}
|
||||||
|
}
|
||||||
let results = window.plugin.restoolsBBWatchReloaded.computeBeacons(i);
|
let results = window.plugin.restoolsBBWatchReloaded.computeBeacons(i);
|
||||||
let wave = {
|
let wave = {
|
||||||
WaveNumber: Number(i) +1,
|
WaveNumber: Number(i) +1,
|
||||||
volatilesCount: 0,
|
volatilesCount: volatiles,
|
||||||
beaconCount: window.plugin.restoolsBBWatchReloaded.WAVE_PORTALS[i][0].length,
|
beaconCount: window.plugin.restoolsBBWatchReloaded.WAVE_PORTALS[i][0].length,
|
||||||
PercentageRes: window.plugin.restoolsBBWatchReloaded.WAVE_PORTALS[i][0].length/results.resWin,
|
PercentageRes: (results.resWin/window.plugin.restoolsBBWatchReloaded.WAVE_PORTALS[i][0].length)*100,
|
||||||
PercentageEnl: window.plugin.restoolsBBWatchReloaded.WAVE_PORTALS[i][0].length/results.enlWin,
|
PercentageEnl: (results.enlWin/window.plugin.restoolsBBWatchReloaded.WAVE_PORTALS[i][0].length)*100,
|
||||||
BeaconsWonRes: results.resWin,
|
BeaconsWonRes: results.resWin,
|
||||||
BeaconsWonResVolatiles: results.resVolatiles,
|
BeaconsWonResVolatiles: results.resVolatiles,
|
||||||
BeaconsWonEnl: results.enlWin,
|
BeaconsWonEnl: results.enlWin,
|
||||||
@@ -320,16 +331,16 @@ function wrapper(plugin_info)
|
|||||||
<tr>
|
<tr>
|
||||||
<td>`+ wave.WaveNumber +`</td>
|
<td>`+ wave.WaveNumber +`</td>
|
||||||
<td>`+ wave.beaconCount + " (" + wave.volatilesCount + ")" + `</td>
|
<td>`+ wave.beaconCount + " (" + wave.volatilesCount + ")" + `</td>
|
||||||
<td>`+ wave.PercentageRes +`</td>
|
<td>`+ wave.PercentageRes.toFixed(2) +`</td>
|
||||||
<td>`+ wave.PercentageEnl +`</td>
|
<td>`+ wave.PercentageEnl.toFixed(2) +`</td>
|
||||||
<td>`+ wave.BeaconsWonRes + " (" + wave.BeaconsWonResVolatiles + ")" + `</td>
|
<td>`+ wave.BeaconsWonRes + " (" + wave.BeaconsWonResVolatiles + ")" + `</td>
|
||||||
<td>`+ wave.BeaconsWonEnl + " (" + wave.BeaconsWonEnlVolatiles + ")" + `</td>
|
<td>`+ wave.BeaconsWonEnl + " (" + wave.BeaconsWonEnlVolatiles + ")" + `</td>
|
||||||
</tr>
|
</tr>
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
let bestScore = `<p style="font-weight: bold;">BB SCORING ESTIMATE: RES ` + maxBeaconsWonRes/(maxBeaconsWonRes+maxBeaconsWonEnl) + `:` + maxBeaconsWonEnl/(maxBeaconsWonRes+maxBeaconsWonEnl)+ ` ENL</p>`;
|
let bestScore = `<p style="font-weight: bold;">BB SCORING ESTIMATE: RES ` + (maxBeaconsWonRes/(maxBeaconsWonRes+maxBeaconsWonEnl)*100).toFixed(2) + `:` + (maxBeaconsWonEnl/(maxBeaconsWonRes+maxBeaconsWonEnl)*100).toFixed(2) + ` ENL</p>`;
|
||||||
let bestScoreVolatiles = `<p style="font-weight: bold;">BB SCORING ESTIMATE (including volatiles, speculative): RES ` + (maxBeaconsWonRes+ 2*volatilesBeaconsWonResInBestWave)/((maxBeaconsWonRes+ 2*volatilesBeaconsWonResInBestWave)+(maxBeaconsWonEnl+ 2*volatilesBeaconsWonEnlInBestWave)) + `:` + (maxBeaconsWonEnl+ 2*volatilesBeaconsWonEnlInBestWave)/((maxBeaconsWonRes+ 2*volatilesBeaconsWonResInBestWave)+(maxBeaconsWonEnl+ 2*volatilesBeaconsWonEnlInBestWave))+ ` ENL</p>`;
|
let bestScoreVolatiles = `<p style="font-weight: bold;">BB SCORING ESTIMATE (including volatiles, speculative): RES ` + ((maxBeaconsWonRes+ 2*volatilesBeaconsWonResInBestWave)/((maxBeaconsWonRes+ 2*volatilesBeaconsWonResInBestWave)+(maxBeaconsWonEnl+ 2*volatilesBeaconsWonEnlInBestWave))*100).toFixed(2) + `:` + ((maxBeaconsWonEnl+ 2*volatilesBeaconsWonEnlInBestWave)/((maxBeaconsWonRes+ 2*volatilesBeaconsWonResInBestWave)+(maxBeaconsWonEnl+ 2*volatilesBeaconsWonEnlInBestWave))*100).toFixed(2)+ ` ENL</p>`;
|
||||||
|
|
||||||
let htmlEnd = `
|
let htmlEnd = `
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|||||||
Reference in New Issue
Block a user