Compare commits
7 Commits
046348a71e
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 914acb0a09 | |||
|
|
5fab2afa16 | ||
|
|
f4a6c08dd5 | ||
|
|
2ff302571d | ||
| 963f0b7d1c | |||
| 0613b011a1 | |||
| 0cb93c4925 |
@@ -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,31 +164,35 @@ 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(portal.IsOrnamented) {
|
if (!waveBattleOver) {
|
||||||
if (!(window.plugin.restoolsBBWatchReloaded.WAVE_PORTALS[waveNo][waveBattleOver].find((obj) => obj.Guid === portal.Guid))) {
|
if(portal.IsOrnamented) {
|
||||||
portalsToBeAdded.push(portal);
|
if (!(window.plugin.restoolsBBWatchReloaded.WAVE_PORTALS[waveNo][0].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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
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.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);
|
||||||
|
|||||||
Reference in New Issue
Block a user