added speculative extimate including volatiles

This commit is contained in:
Martin Vylet
2023-06-02 13:55:05 +02:00
parent 3bc414e084
commit 39de966350

View File

@@ -1,12 +1,12 @@
// ==UserScript==
// @name IITC plugin: ResTools BB Watch Reloaded
// @namespace https://github.com/restools/BBWatchReloaded
// @namespace https://git.martinvylet.cz/vykend/ResTools-BB-Watch-Reloaded
// @version 0.3
// @description Scan window for BBs on ornamented portals, then check results
// @author vikend
// @icon
// @updateURL https://127.0.0.1
// @downloadURL https://127.0.0.1
// @updateURL https://git.martinvylet.cz/vykend/ResTools-BB-Watch-Reloaded/raw/branch/main/RestoolsBBWatchReloaded.js
// @downloadURL https://git.martinvylet.cz/vykend/ResTools-BB-Watch-Reloaded/raw/branch/main/RestoolsBBWatchReloaded.js
// @match https://intel.ingress.com/*
// @grant none
// ==/UserScript==
@@ -167,15 +167,16 @@ function wrapper(plugin_info)
//if yes, was it ornamented?
if(portal.IsWinnerRes || portal.IsWinnerEnl) {
//check if portal wasnt already added
//check if portal wasnt already added in previous waves
if (!(window.plugin.restoolsBBWatchReloaded.WAVE_PORTALS[waveNo][waveBattleOver].find((obj) => obj.Guid === portal.Guid))) {
//check if portal isnt already in portalsToBeAdded
//check if portal isn't already in portalsToBeAdded
if (!(portalsToBeAdded.find((obj) => obj.Guid === portal.Guid))) {
//check if portal was added as ornamented before
if ((window.plugin.restoolsBBWatchReloaded.WAVE_PORTALS[waveNo][0].find((obj) => obj.Guid === portal.Guid))) {
portalsToBeAdded.push(portal);
//check if portal was added as ornamented before
if ((window.plugin.restoolsBBWatchReloaded.WAVE_PORTALS[waveNo][0].find((obj) => obj.Guid === portal.Guid))) {
portalsToBeAdded.push(portal);
}
}
}
}
@@ -266,6 +267,8 @@ function wrapper(plugin_info)
{
let maxBeaconsWonRes = -Infinity; // Initialize with a very small value
let maxBeaconsWonEnl = -Infinity;
let volatilesBeaconsWonResInBestWave = -Infinity; // Initialize with a very small value
let volatilesBeaconsWonEnlInBestWave = -Infinity;
let htmlBegin = `
<div class="restoolsBBWatchReloadedDialog">
@@ -290,9 +293,11 @@ function wrapper(plugin_info)
let wave = waves[waveIndex];
if (wave.BeaconsWonRes > maxBeaconsWonRes) {
maxBeaconsWonRes = wave.BeaconsWonRes;
volatilesBeaconsWonResInBestWave = wave.BeaconsWonResVolatiles;
}
if (wave.BeaconsWonEnl > maxBeaconsWonEnl) {
maxBeaconsWonEnl = wave.BeaconsWonEnl;
volatilesBeaconsWonEnlInBestWave = wave.BeaconsWonEnlVolatiles;
}
htmlBody += `
@@ -308,10 +313,11 @@ function wrapper(plugin_info)
}
let bestScore = `<p style="font-weight: bold;">BB SCORING ESTIMATE: RES ` + maxBeaconsWonRes/(maxBeaconsWonRes+maxBeaconsWonEnl) + `:` + maxBeaconsWonEnl/(maxBeaconsWonRes+maxBeaconsWonEnl)+ ` 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 htmlEnd = `
</tbody>
</table>` + bestScore + `
</table>` + bestScore + bestScoreVolatiles`
<a onclick="window.plugin.restoolsBBWatchReloaded.resetStorage()" title="Reset local storage (deletes data saved in your browser, do this prior to anomaly)">Reset local storage</a>
<a style="float: right;" onclick="window.plugin.restoolsBBWatchReloaded.getCurrentState()" title="Refresh this dialog window">Refresh this window</a>
</div>