This commit is contained in:
Martin Vylet
2024-02-13 09:08:15 +01:00

View File

@@ -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,11 +164,14 @@ 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 (!waveBattleOver) {
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);
}
}
}
else { //battle over
//if ornaments disappear too quickly, it is needed to add 2nd check
//has the portal winners beacon?
@@ -176,7 +179,7 @@ function wrapper(plugin_info)
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))) {
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))) {
@@ -190,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.saveStorage(window.plugin.restoolsBBWatchReloaded.WAVE_PORTALS);
console.log("BBWatchReloaded: Portals updated");