Compare commits

...

7 Commits

Author SHA1 Message Date
914acb0a09 Updated with more recognised ornaments
Signed-off-by: vykend <mail@martinvylet.cz>
2025-03-09 21:55:14 +01:00
Martin Vylet
5fab2afa16 bump version 2024-02-13 09:10:11 +01:00
Martin Vylet
f4a6c08dd5 Merge branch 'main' of https://git.martinvylet.cz/vykend/ResTools-BB-Watch-Reloaded 2024-02-13 09:08:15 +01:00
Martin Vylet
2ff302571d Edited waves and timing for upcoming Cryptic Memories 2024-02-13 09:06:21 +01:00
963f0b7d1c Update 'RestoolsBBWatchReloaded.js' 2023-06-17 08:39:59 +02:00
0613b011a1 Update 'RestoolsBBWatchReloaded.js' 2023-06-17 07:48:14 +02:00
0cb93c4925 Update 'RestoolsBBWatchReloaded.js' 2023-06-16 09:44:32 +02:00

View File

@@ -1,11 +1,7 @@
// ==UserScript== // ==UserScript==
// @name IITC plugin: ResTools BB Watch Reloaded // @name IITC plugin: ResTools BB Watch Reloaded
// @namespace https://git.martinvylet.cz/vykend/ResTools-BB-Watch-Reloaded // @namespace https://git.martinvylet.cz/vykend/ResTools-BB-Watch-Reloaded
<<<<<<< HEAD // @version 0.9.1
// @version 0.6
=======
// @version 0.5.2
>>>>>>> 05b76cec5c49b9a62d1b257c90d75c8e9252fb89
// @description Scan window for BBs on ornamented portals, then check results // @description Scan window for BBs on ornamented portals, then check results
// @author vikend // @author vikend
// @icon // @icon
@@ -31,20 +27,19 @@ function wrapper(plugin_info)
window.plugin.restoolsBBWatchReloaded.LAYERS = {}; window.plugin.restoolsBBWatchReloaded.LAYERS = {};
window.plugin.restoolsBBWatchReloaded.LAYERGROUP = null; window.plugin.restoolsBBWatchReloaded.LAYERGROUP = null;
window.plugin.restoolsBBWatchReloaded.BB_STORAGE = 'plugin-restools-bbwatch-reloaded'; window.plugin.restoolsBBWatchReloaded.BB_STORAGE = 'plugin-restools-bbwatch-reloaded';
window.plugin.restoolsBBWatchReloaded.WAVE_PORTALS = [[[],[]],[[],[]],[[],[]],[[],[]],[[],[]],[[],[]],[[],[]]]; window.plugin.restoolsBBWatchReloaded.WAVE_PORTALS = [[[],[]],[[],[]],[[],[]],[[],[]],[[],[]],[[],[]]];
window.plugin.restoolsBBWatchReloaded.timezone = 0; window.plugin.restoolsBBWatchReloaded.timezone = 0;
//struct of WAVE_PORTALS: [ wave: [ ornamented[], results[] ] ] //struct of WAVE_PORTALS: [ wave: [ ornamented[], results[] ] ]
//edit this with start times according to YOUR local times (ie. as seen in COMM) //edit this with start times according to YOUR local times (ie. as seen in COMM)
window.plugin.restoolsBBWatchReloaded.TIMETABLE = { window.plugin.restoolsBBWatchReloaded.TIMETABLE = {
wave1: "14:00", wave1: "14:00",
wave2: "14:25", wave2: "14:30",
wave3: "14:50", wave3: "15:00",
wave4: "15:15", wave4: "15:30",
wave5: "15:40", wave5: "16:00",
wave6: "16:05", wave6: "16:30",
wave7: "16:30", wave7: "17:00", //needed for calculations, put there end of wave 6
wave8: "16:55" //needed for calculations, put there end of wave 7
}; };
@@ -90,7 +85,7 @@ function wrapper(plugin_info)
const offsetMilliseconds = timezoneOffsetHours * 60 * 60 * 1000; // Convert offset to milliseconds const offsetMilliseconds = timezoneOffsetHours * 60 * 60 * 1000; // Convert offset to milliseconds
const currentTimeWithOffset = new Date(currentTime.getTime() + offsetMilliseconds); const currentTimeWithOffset = new Date(currentTime.getTime() + offsetMilliseconds);
const currentTimeString = currentTimeWithOffset.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit', hour12: false }); const currentTimeString = currentTimeWithOffset.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit', hour12: false });
const currentTimePlus5Minutes = (new Date(currentTimeWithOffset.getTime() + 5 * 60000)).toLocaleTimeString([], { hour: '2-digit', minute: '2-digit', hour12: false }); const currentTimePlus5Minutes = (new Date(currentTimeWithOffset.getTime() + 10 * 60000)).toLocaleTimeString([], { hour: '2-digit', minute: '2-digit', hour12: false });
let currentWave = 0; let currentWave = 0;
let battleOver = false; let battleOver = false;
@@ -125,14 +120,14 @@ function wrapper(plugin_info)
{ {
let ornaments = portal.options.data.ornaments; 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("ap2") != -1 || ornaments.indexOf("ap3") != -1 || ornaments.indexOf("ap1_v") != -1 || ornaments.indexOf("ap2_v") != -1 || ornaments.indexOf("ap3_v") != -1 || ornaments.indexOf("peBN_RES_WINNER-60") != -1 || ornaments.indexOf("peBN_ENL_WINNER-60") != -1)
{ {
let portalUpload = { let portalUpload = {
Guid: portal.options.guid, Guid: portal.options.guid,
IsOrnamented: (ornaments.indexOf("ap1") != -1), IsOrnamented: (ornaments.indexOf("ap1") != -1 || ornaments.indexOf("ap1_v") != -1 || ornaments.indexOf("ap2") != -1 || ornaments.indexOf("ap2_v") != -1 || ornaments.indexOf("ap3") != -1 || ornaments.indexOf("ap3_v") != -1),
IsVolatile: (ornaments.indexOf("ap1_v") != -1), IsVolatile: (ornaments.indexOf("ap1_v") != -1 ||ornaments.indexOf("ap2_v") != -1||ornaments.indexOf("ap3_v") != -1),
IsWinnerRes: (ornaments.indexOf("peBN_RES_WINNER") != -1), IsWinnerRes: (ornaments.indexOf("peBN_RES_WINNER-60") != -1),
IsWinnerEnl: (ornaments.indexOf("peBN_ENL_WINNER") != -1), IsWinnerEnl: (ornaments.indexOf("peBN_ENL_WINNER-60") != -1),
IsBeaconActive: (ornaments.indexOf("peBB_BATTLE_RARE") != -1), IsBeaconActive: (ornaments.indexOf("peBB_BATTLE_RARE") != -1),
Beacons: ornaments.join(','), Beacons: ornaments.join(','),
}; };
@@ -169,11 +164,14 @@ function wrapper(plugin_info)
//this should record all ornamented portals in each wave. //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 //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 // = records ornamented portals to another array
if (!waveBattleOver) {
if(portal.IsOrnamented) { 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); portalsToBeAdded.push(portal);
} }
} }
}
else { //battle over
//if ornaments disappear too quickly, it is needed to add 2nd check //if ornaments disappear too quickly, it is needed to add 2nd check
//has the portal winners beacon? //has the portal winners beacon?
@@ -181,7 +179,7 @@ function wrapper(plugin_info)
if(portal.IsWinnerRes || portal.IsWinnerEnl) { if(portal.IsWinnerRes || portal.IsWinnerEnl) {
//check if portal wasnt already added in previous waves //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 //check if portal isn't already in portalsToBeAdded
if (!(portalsToBeAdded.find((obj) => obj.Guid === portal.Guid))) { if (!(portalsToBeAdded.find((obj) => obj.Guid === portal.Guid))) {
@@ -195,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.WAVE_PORTALS[waveNo][waveBattleOver] = window.plugin.restoolsBBWatchReloaded.WAVE_PORTALS[waveNo][waveBattleOver].concat(portalsToBeAdded);
window.plugin.restoolsBBWatchReloaded.saveStorage(window.plugin.restoolsBBWatchReloaded.WAVE_PORTALS); window.plugin.restoolsBBWatchReloaded.saveStorage(window.plugin.restoolsBBWatchReloaded.WAVE_PORTALS);
console.log("BBWatchReloaded: Portals updated"); console.log("BBWatchReloaded: Portals updated");