diff --git a/RestoolsBBWatchReloaded.js b/RestoolsBBWatchReloaded.js index 13570b8..1ba37d9 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.1 +// @version 0.6.1 // @description Scan window for BBs on ornamented portals, then check results // @author vikend // @icon @@ -120,14 +120,14 @@ function wrapper(plugin_info) { 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("ap1_v") != -1 || ornaments.indexOf("peBN_RES_WINNER-60") != -1 || ornaments.indexOf("peBN_ENL_WINNER-60") != -1) { let portalUpload = { Guid: portal.options.guid, - IsOrnamented: (ornaments.indexOf("ap1") != -1), + IsOrnamented: (ornaments.indexOf("ap1") != -1 || ornaments.indexOf("ap1_v") != -1), IsVolatile: (ornaments.indexOf("ap1_v") != -1), - IsWinnerRes: (ornaments.indexOf("peBN_RES_WINNER") != -1), - IsWinnerEnl: (ornaments.indexOf("peBN_ENL_WINNER") != -1), + IsWinnerRes: (ornaments.indexOf("peBN_RES_WINNER-60") != -1), + IsWinnerEnl: (ornaments.indexOf("peBN_ENL_WINNER-60") != -1), IsBeaconActive: (ornaments.indexOf("peBB_BATTLE_RARE") != -1), Beacons: ornaments.join(','), }; @@ -164,31 +164,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);