// ==UserScript==
// @name [Pokeclicker] Infinite Seasonal Events
// @namespace Pokeclicker Scripts
// @author Ephenia
// @description Adds in toggable options to have seasonal events infinitely run. Events can also run simultaneously with one another. Includes a custom event as well.
// @copyright https://github.com/Ephenia
// @license GPL-3.0 License
// @version 1.3
// @homepageURL https://github.com/Ephenia/Pokeclicker-Scripts/
// @supportURL https://github.com/Ephenia/Pokeclicker-Scripts/issues
// @match https://www.pokeclicker.com/
// @icon https://www.google.com/s2/favicons?domain=pokeclicker.com
// @grant none
// @run-at document-idle
// @downloadURL none
// ==/UserScript==
var scriptName = 'infiniteseasonalevents'
var activeSeasonalEvents = {};
//Removed setTimeout, opted to make it load like the other scrips, also helps with notifications
function initEvents() {
const NUM_EVENTS = 10;
const startDate = new Date(new Date().getFullYear(), -1);
const endDate = new Date(new Date().getFullYear(), 10000);
App.game.specialEvents.newEvent('Ephenia\'s Gift',
'Encounter Ribombee that roams across all regions.
A special thanks for using my scripts!',
startDate,
() => {
GameHelper.enumNumbers(GameConstants.Region).filter(i => i != GameConstants.Region.none).forEach(region => {
RoamingPokemonList.add(region, 0, new RoamingPokemon('Ribombee')); // Currently adding in base subregions only
});
},
endDate,
() => {
GameHelper.enumNumbers(GameConstants.Region).filter(i => i != GameConstants.Region.none).forEach(region => {
RoamingPokemonList.remove(region, 0, 'Ribombee');
});
},
true
);
//Testing loading events in init
for (const event of App.game.specialEvents.events) {
let eventActive = loadSetting(event.title, false);
activeSeasonalEvents[event.title] = eventActive;
}
for (const event of App.game.specialEvents.events) {
event.startTime = startDate;
event.endTime = endDate;
if (!event.hasStarted() && activeSeasonalEvents[event.title]) {
event.start();
}
}
if (App.game.specialEvents.events.length != NUM_EVENTS) {
Notifier.notify({
title: '[Outdated] Infinite Seasonal Events',
message: `Please contact Ephenia so that this script can be updated!`,
type: NotificationConstants.NotificationOption.danger,
timeout: 1000000
});
}
var eventLi = document.createElement('li');
eventLi.innerHTML = `Toggle Events`;
for (const node of document.querySelectorAll('#startMenu ul li')) {
if (node.querySelector('a[href="#eventsModal"]')) {
node.after(eventLi);
break;
}
}
var eventMod = document.createElement('div');
eventMod.setAttribute("class", "modal noselect fade show");
eventMod.setAttribute("id", "eventModal");
eventMod.setAttribute("tabindex", "-1");
eventMod.setAttribute("aria-labelledby", "eventModal");
eventMod.setAttribute("aria-labelledby", "eventModal");
eventMod.setAttribute("aria-modal", "true");
eventMod.setAttribute("role", "dialog");
eventMod.innerHTML = `

