// ==UserScript==
// @name [Pokeclicker] Infinite Seasonal Events
// @namespace Pokeclicker Scripts
// @match https://www.pokeclicker.com/
// @grant none
// @version 1.1
// @author Ephenia
// @description Adds in toggable options to have seasonal events infinitely run. Events can also run simultaneously with one another. Includes custom events as well.
// @downloadURL none
// ==/UserScript==
var startDate = new Date(new Date().getFullYear(), -1);
var endDate = new Date(new Date().getFullYear(), 10000);
var getEvents = SpecialEvents.events;
var storedEvents = [];
var profileDrop = document.getElementById('startMenu').querySelectorAll('ul li')[0];
var profileModal = document.getElementById('profileModal');
//Removed setTimeout, opted to make it load like the other scrips, also helps with notifications
function initEvents() {
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, new RoamingPokemon('Ribombee'));
});
},
endDate, () => {
GameHelper.enumNumbers(GameConstants.Region).filter(i => i != GameConstants.Region.none).forEach(region => {
RoamingPokemonList.remove(region, 'Ribombee');
});
}
);
//Testing loading events in init
for (var i = 0; i < getEvents.length; i++) {
if (localStorage.getItem(getEvents[i].title) == null) {
localStorage.setItem(getEvents[i].title, 0);
}
/*
Changed the storedEvents list to contain objects that have the name of the event and active status so we can search for them
even with a different order
*/
storedEvents.push({name: getEvents[i].title, active: localStorage.getItem(getEvents[i].title)})
}
for (var ii = 0; ii < getEvents.length; ii++) {
getEvents[ii].startTime = startDate
getEvents[ii].endTime = endDate
if (getEvents[ii].hasStarted() == false && storedEvents[ii].active == 1) {
getEvents[ii].start()
}
}
if (getEvents.length != 10) {
Notifier.notify({
title: '[Outdated] Infinite Seasonal Events',
message: `Please contact Ephenia so that this script can be updated!`,
type: NotificationConstants.NotificationOption.danger,
timeout: 10000
});
}
var eventLi = document.createElement('li');
eventLi.innerHTML = `Toggle Events`
profileDrop.before(eventLi);
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 = `