diff --git a/RestoolsBBWatchReloaded.js b/RestoolsBBWatchReloaded.js index 3c4b379..426e9be 100644 --- a/RestoolsBBWatchReloaded.js +++ b/RestoolsBBWatchReloaded.js @@ -1,7 +1,7 @@ // ==UserScript== // @name IITC plugin: ResTools BB Watch Reloaded // @namespace https://git.martinvylet.cz/vykend/ResTools-BB-Watch-Reloaded -// @version 0.7 +// @version 0.8 // @description Scan window for BBs on ornamented portals, then check results // @author vikend // @icon @@ -165,31 +165,35 @@ function wrapper(plugin_info) //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 // = records ornamented portals to another array - if(portal.IsOrnamented) { - if (!(window.plugin.restoolsBBWatchReloaded.WAVE_PORTALS[waveNo][waveBattleOver].find((obj) => obj.Guid === portal.Guid))) { - portalsToBeAdded.push(portal); - } - } - - //if ornaments disappear too quickly, it is needed to add 2nd check - //has the portal winners beacon? - //if yes, was it ornamented? - - if(portal.IsWinnerRes || portal.IsWinnerEnl) { - //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 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); - } + if (!waveBattleOver) { + if(portal.IsOrnamented) { + if (!(window.plugin.restoolsBBWatchReloaded.WAVE_PORTALS[waveNo][0].find((obj) => obj.Guid === portal.Guid))) { + portalsToBeAdded.push(portal); } } } + else { //battle over + //if ornaments disappear too quickly, it is needed to add 2nd check + //has the portal winners beacon? + //if yes, was it ornamented? + + if(portal.IsWinnerRes || portal.IsWinnerEnl) { + //check if portal wasnt already added in previous waves + if (!(window.plugin.restoolsBBWatchReloaded.WAVE_PORTALS[waveNo][1].find((obj) => obj.Guid === portal.Guid))) { + + //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); + } + } + } + } + + } } 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);