From 39de966350bf3304ae59a6efc3a42c13d6e92fc3 Mon Sep 17 00:00:00 2001 From: Martin Vylet Date: Fri, 2 Jun 2023 13:55:05 +0200 Subject: [PATCH] added speculative extimate including volatiles --- RestoolsBBWatchReloaded.js | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/RestoolsBBWatchReloaded.js b/RestoolsBBWatchReloaded.js index d7fbc5a..14affba 100644 --- a/RestoolsBBWatchReloaded.js +++ b/RestoolsBBWatchReloaded.js @@ -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 = `
@@ -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 = `

BB SCORING ESTIMATE: RES ` + maxBeaconsWonRes/(maxBeaconsWonRes+maxBeaconsWonEnl) + `:` + maxBeaconsWonEnl/(maxBeaconsWonRes+maxBeaconsWonEnl)+ ` ENL

`; + let bestScoreVolatiles = `

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

`; let htmlEnd = ` - ` + bestScore + ` + ` + bestScore + bestScoreVolatiles` Reset local storage Refresh this window