@@ -490,7 +579,7 @@ function initSaveEditor() {
HeldItem.getSortedHeldItems().other.items.forEach((itm, idx) => {
const itmPretty = itm.name.replaceAll('_', ' ');
modalBody.querySelector('#heldItems').innerHTML += `
-
+
${itmPretty}
@@ -504,6 +593,9 @@ function initSaveEditor() {
pkdxRegFilt.innerHTML += `
${reg.charAt(0).toUpperCase() + reg.slice(1)} `;
}
pkdxRegFilt.innerHTML += '
None ';
+
+
+ loadEventHandlers();
}
/* WIP, sevii helper
From 33ec22046d23dd5ef12885d19f6039852a2e6714 Mon Sep 17 00:00:00 2001
From: iamc24 <42425100+iamc24@users.noreply.github.com>
Date: Sun, 27 Jul 2025 13:46:04 -0700
Subject: [PATCH 08/14] Update debugcheatstools.user.js
Slightly simplify event handler logic for gems, pokeballs, berries;
---
custom/debugcheatstools.user.js | 1210 +++++++++++++++----------------
1 file changed, 605 insertions(+), 605 deletions(-)
diff --git a/custom/debugcheatstools.user.js b/custom/debugcheatstools.user.js
index 158ef51..7978af6 100644
--- a/custom/debugcheatstools.user.js
+++ b/custom/debugcheatstools.user.js
@@ -24,592 +24,592 @@ const profileDrop = document.getElementById('startMenu').querySelectorAll('ul li
const profileModal = document.getElementById('profileModal');
function getPokerusImgSrc(id, pkm){
- let lpkm = pkm || App.game.party.getPokemon(id);
- return lpkm?.pokerus || 0 > 0 ? (lpkm.pokerus === 3 ? "assets/images/breeding/pokerus/Resistant.png" : "assets/images/breeding/pokerus/Contagious.png") : "assets/images/breeding/pokerus/Infected.png";
+ let lpkm = pkm || App.game.party.getPokemon(id);
+ return lpkm?.pokerus || 0 > 0 ? (lpkm.pokerus === 3 ? "assets/images/breeding/pokerus/Resistant.png" : "assets/images/breeding/pokerus/Contagious.png") : "assets/images/breeding/pokerus/Infected.png";
}
function getPokeballImgSrc(id, pkm){
- let lpkm = pkm || App.game.party.getPokemon(id);
- return lpkm ? ((lpkm?.shiny === true) ? "assets/images/pokeball/Pokeball-shiny.svg" : "assets/images/pokeball/Pokeball.svg") : "assets/images/pokeball/None.svg";
+ let lpkm = pkm || App.game.party.getPokemon(id);
+ return lpkm ? ((lpkm?.shiny === true) ? "assets/images/pokeball/Pokeball-shiny.svg" : "assets/images/pokeball/Pokeball.svg") : "assets/images/pokeball/None.svg";
}
// eslint-disable-next-line no-unused-vars
function gainPk(){
- let id = parseFloat(this.parentElement.children[0].innerHTML);
- let lpkm = App.game.party.getPokemon(id);
- if (!lpkm)
- App.game.party.gainPokemonById(id)
- else if (!(lpkm?.shiny === true))
- App.game.party.gainPokemonById(id, true);
- document.querySelectorAll(`:scope #pkdx_${id.toString().replace('.','_')} img`)[1].src = getPokeballImgSrc(id, lpkm);
- filterPkdx();
- loadEventHandlers();
+ let id = parseFloat(this.parentElement.children[0].innerHTML);
+ let lpkm = App.game.party.getPokemon(id);
+ if (!lpkm)
+ App.game.party.gainPokemonById(id)
+ else if (!(lpkm?.shiny === true))
+ App.game.party.gainPokemonById(id, true);
+ document.querySelectorAll(`:scope #pkdx_${id.toString().replace('.','_')} img`)[1].src = getPokeballImgSrc(id, lpkm);
+ filterPkdx();
+ loadEventHandlers();
}
// eslint-disable-next-line no-unused-vars
function gainPkrs(){
- let id = parseFloat(this.parentElement.children[0].innerHTML);
- let lpkm = App.game.party.getPokemon(id);
- if (!lpkm) return;
- lpkm.effortPoints = ((lpkm.pokerus < 2) ? 1 : 50) * 1000; // strange
- lpkm.pokerus = (lpkm.pokerus < 2) ? 2 : 3;
- document.querySelectorAll(`:scope #pkdx_${id.toString().replace('.','_')} img`)[2].src = getPokerusImgSrc(id, lpkm);
- filterPkdx();
- loadEventHandlers();
+ let id = parseFloat(this.parentElement.children[0].innerHTML);
+ let lpkm = App.game.party.getPokemon(id);
+ if (!lpkm) return;
+ lpkm.effortPoints = ((lpkm.pokerus < 2) ? 1 : 50) * 1000; // strange
+ lpkm.pokerus = (lpkm.pokerus < 2) ? 2 : 3;
+ document.querySelectorAll(`:scope #pkdx_${id.toString().replace('.','_')} img`)[2].src = getPokerusImgSrc(id, lpkm);
+ filterPkdx();
+ loadEventHandlers();
}
function gainCurrency() {
- let currency = parseInt(this.getAttribute("currency"));
- let changeAmount = parseInt(document.getElementById("inputAddCurrency").value || 0);
- if (changeAmount > 0) {
- App.game.wallet.addAmount(new Amount(changeAmount,currency),true);
- } else if (changeAmount < 0) {
- changeAmount = Math.abs(changeAmount);
- if (changeAmount > App.game.wallet.currencies[currency]()) {
- changeAmount = App.game.wallet.currencies[currency]();
- if (changeAmount == 0) {
- return;
- }
- }
- App.game.wallet.loseAmount(new Amount(changeAmount,currency));
- }
+ let currency = parseInt(this.getAttribute("currency"));
+ let changeAmount = parseInt(document.getElementById("inputAddCurrency").value || 0);
+ if (changeAmount > 0) {
+ App.game.wallet.addAmount(new Amount(changeAmount,currency),true);
+ } else if (changeAmount < 0) {
+ changeAmount = Math.abs(changeAmount);
+ if (changeAmount > App.game.wallet.currencies[currency]()) {
+ changeAmount = App.game.wallet.currencies[currency]();
+ if (changeAmount == 0) {
+ return;
+ }
+ }
+ App.game.wallet.loseAmount(new Amount(changeAmount,currency));
+ }
}
function filterPkdx(){
- let lst = document.querySelectorAll(':scope #pkdx tbody tr');
- for (let i = 0; i < lst.length; i++) {
- const tdb = lst[i];
- let display = true;
-
- if (document.getElementById('pkdxNameFilter').value !== ""){
- display = tdb.innerHTML.match(/
.*<\/td>/g)[3].toLowerCase().includes(document.getElementById('pkdxNameFilter').value.toLowerCase());
- }
-
- if (display === true) {
- switch (document.getElementById('pkdxRegionFilter').value) {
- case 'all':
- break;
- default:
- display = tdb.innerHTML.match(/ .*<\/td>/g)[1].toLowerCase().includes(document.getElementById('pkdxRegionFilter').value);
- break;
- }
- }
-
- if (display === true) {
- switch (document.getElementById('pkdxShinyFilter').value) {
- case 'uncaught':
- display = tdb.innerHTML.includes('None.svg');
- break;
- case 'caught':
- display = tdb.innerHTML.includes('Pokeball.svg') || tdb.innerHTML.includes('Pokeball-shiny.svg');
- break;
- case 'caught-not-shiny':
- display = tdb.innerHTML.includes('Pokeball.svg');
- break;
- case 'caught-shiny':
- display = tdb.innerHTML.includes('Pokeball-shiny.svg');
- break;
- default:
- break;
- }
- }
-
- if (display === true) {
- switch (document.getElementById('pkdxPKRSFilter').value) {
- case '0':
- display = tdb.innerHTML.includes('Infected.png');
- break;
- case '2':
- display = tdb.innerHTML.includes('Contagious.png');
- break;
- case '3':
- display = tdb.innerHTML.includes('Resistant.png');
- break;
- default:
- break;
- }
- }
-
- tdb.style.display = (display === true ? "" : "none");
- }
+ let lst = document.querySelectorAll(':scope #pkdx tbody tr');
+ for (let i = 0; i < lst.length; i++) {
+ const tdb = lst[i];
+ let display = true;
+
+ if (document.getElementById('pkdxNameFilter').value !== ""){
+ display = tdb.innerHTML.match(/ .*<\/td>/g)[3].toLowerCase().includes(document.getElementById('pkdxNameFilter').value.toLowerCase());
+ }
+
+ if (display === true) {
+ switch (document.getElementById('pkdxRegionFilter').value) {
+ case 'all':
+ break;
+ default:
+ display = tdb.innerHTML.match(/ .*<\/td>/g)[1].toLowerCase().includes(document.getElementById('pkdxRegionFilter').value);
+ break;
+ }
+ }
+
+ if (display === true) {
+ switch (document.getElementById('pkdxShinyFilter').value) {
+ case 'uncaught':
+ display = tdb.innerHTML.includes('None.svg');
+ break;
+ case 'caught':
+ display = tdb.innerHTML.includes('Pokeball.svg') || tdb.innerHTML.includes('Pokeball-shiny.svg');
+ break;
+ case 'caught-not-shiny':
+ display = tdb.innerHTML.includes('Pokeball.svg');
+ break;
+ case 'caught-shiny':
+ display = tdb.innerHTML.includes('Pokeball-shiny.svg');
+ break;
+ default:
+ break;
+ }
+ }
+
+ if (display === true) {
+ switch (document.getElementById('pkdxPKRSFilter').value) {
+ case '0':
+ display = tdb.innerHTML.includes('Infected.png');
+ break;
+ case '2':
+ display = tdb.innerHTML.includes('Contagious.png');
+ break;
+ case '3':
+ display = tdb.innerHTML.includes('Resistant.png');
+ break;
+ default:
+ break;
+ }
+ }
+
+ tdb.style.display = (display === true ? "" : "none");
+ }
}
function filterQuestLine(){
- let lst = document.querySelectorAll(':scope #questlinelist tbody tr');
- for (let i = 0; i < lst.length; i++) {
- const tdb = lst[i];
- let display = true;
-
- if (display === true) {
- switch (document.getElementById('questLineFilter').value) {
- case 'all':
- break;
- default:
- display = tdb.innerHTML.toLowerCase().includes(document.getElementById('questLineFilter').value);
- break;
- }
- }
-
- tdb.style.display = (display === true ? "" : "none");
- }
+ let lst = document.querySelectorAll(':scope #questlinelist tbody tr');
+ for (let i = 0; i < lst.length; i++) {
+ const tdb = lst[i];
+ let display = true;
+
+ if (display === true) {
+ switch (document.getElementById('questLineFilter').value) {
+ case 'all':
+ break;
+ default:
+ display = tdb.innerHTML.toLowerCase().includes(document.getElementById('questLineFilter').value);
+ break;
+ }
+ }
+
+ tdb.style.display = (display === true ? "" : "none");
+ }
}
// eslint-disable-next-line no-unused-vars
function loadPkdx(){
- let playerRegion = player.highestRegion();
- let pkdxBody = document.querySelector(':scope #pkdx tbody');
- pkdxBody.innerHTML = '';
- let toAdd = "";
- for (const pokemon of pokemonList) {
- if ((pokemon.nativeRegion <= playerRegion && pokemon.nativeRegion > -1) || (pokemon.nativeRegion == -1 && playerRegion >= GameConstants.Region.alola) || pokemon.id == 0) {
- let lpkm = App.game.party.getPokemon(pokemon.id);
- let region = GameConstants.Region[pokemon.nativeRegion].charAt(0).toUpperCase() + GameConstants.Region[pokemon.nativeRegion].slice(1);
- let hint = "";
- let getPokemonLocation = PokemonLocations.getPokemonLocations(pokemon.name, playerRegion);
- let roadLocations = getPokemonLocation[0]
- if (roadLocations) {
- for (let i = 0; i <= playerRegion; i++) {
- const reg = GameConstants.Region[i];
- let roads = "Route"
- roadLocations[i]?.forEach((route) => {
- roads += ` ${route.route},`
- });
- if (roads !== "Route")
- hint += `${hint !== "" ? `\n` : ""}${reg.charAt(0).toUpperCase() + reg.slice(1)}: ${roads.slice(0, -1)}`;
- }
- if (hint !== "")
- hint = ` title="${hint}"`;
- }
- toAdd += `
-
- ${pokemon.id}
- ${region}
-
- ${pokemon.name}
-
-
- YES') : '194, 46, 40);">NO'}
-
- `;
- }
- }
- pkdxBody.innerHTML = toAdd;
- filterPkdx();
- loadEventHandlers();
+ let playerRegion = player.highestRegion();
+ let pkdxBody = document.querySelector(':scope #pkdx tbody');
+ pkdxBody.innerHTML = '';
+ let toAdd = "";
+ for (const pokemon of pokemonList) {
+ if ((pokemon.nativeRegion <= playerRegion && pokemon.nativeRegion > -1) || (pokemon.nativeRegion == -1 && playerRegion >= GameConstants.Region.alola) || pokemon.id == 0) {
+ let lpkm = App.game.party.getPokemon(pokemon.id);
+ let region = GameConstants.Region[pokemon.nativeRegion].charAt(0).toUpperCase() + GameConstants.Region[pokemon.nativeRegion].slice(1);
+ let hint = "";
+ let getPokemonLocation = PokemonLocations.getPokemonLocations(pokemon.name, playerRegion);
+ let roadLocations = getPokemonLocation[0]
+ if (roadLocations) {
+ for (let i = 0; i <= playerRegion; i++) {
+ const reg = GameConstants.Region[i];
+ let roads = "Route"
+ roadLocations[i]?.forEach((route) => {
+ roads += ` ${route.route},`
+ });
+ if (roads !== "Route")
+ hint += `${hint !== "" ? `\n` : ""}${reg.charAt(0).toUpperCase() + reg.slice(1)}: ${roads.slice(0, -1)}`;
+ }
+ if (hint !== "")
+ hint = ` title="${hint}"`;
+ }
+ toAdd += `
+
+ ${pokemon.id}
+ ${region}
+
+ ${pokemon.name}
+
+
+ YES') : '194, 46, 40);">NO'}
+
+ `;
+ }
+ }
+ pkdxBody.innerHTML = toAdd;
+ filterPkdx();
+ loadEventHandlers();
}
function loadQuestLines() {
- let qlBody = document.querySelector(':scope #questlinelist tbody');
- qlBody.innerHTML = '';
- let toAdd = "";
-
- for (const ql of App.game.quests.questLines()) {
- let state = QuestLineState[ql.state()]
- state = state.charAt(0).toUpperCase() + state.slice(1)
-
- let stateColor;
- switch (ql.state()) {
- case 0:
- stateColor = "244, 80, 80";
- break;
- case 1:
- stateColor = "99, 144, 240";
- break;
- case 2:
- stateColor = "122, 199, 76";
- break;
- }
-
- toAdd += `
+ let qlBody = document.querySelector(':scope #questlinelist tbody');
+ qlBody.innerHTML = '';
+ let toAdd = "";
+
+ for (const ql of App.game.quests.questLines()) {
+ let state = QuestLineState[ql.state()]
+ state = state.charAt(0).toUpperCase() + state.slice(1)
+
+ let stateColor;
+ switch (ql.state()) {
+ case 0:
+ stateColor = "244, 80, 80";
+ break;
+ case 1:
+ stateColor = "99, 144, 240";
+ break;
+ case 2:
+ stateColor = "122, 199, 76";
+ break;
+ }
+
+ toAdd += `
${ql.name}
${state}
`;
- }
+ }
- // App.game.quests.questLines().filter(e => e.state() < 2).forEach(e => console.log(e.name, e.state()))
+ // App.game.quests.questLines().filter(e => e.state() < 2).forEach(e => console.log(e.name, e.state()))
- qlBody.innerHTML = toAdd;
- filterQuestLine();
- loadEventHandlers();
+ qlBody.innerHTML = toAdd;
+ filterQuestLine();
+ loadEventHandlers();
}
function loadEventHandlers() {
-
- // currency
- for (let i = 0; i < Object.keys(GameConstants.Currency).filter(isNaN).length; i++) {
- document.getElementById("currency_" + i).addEventListener("click", gainCurrency);
- }
-
- // gems
- for (let i = 0; i < Gems.nTypes; i++) {
- document.getElementById("gems_" + i).addEventListener("click", function () {
- App.game.gems.gainGems(parseInt(document.getElementById('inputAddGems').value || 0), parseInt(this.getAttribute("gem")));
- });
- }
-
- // pokeballs
- for (let i = 0; i < Object.keys(GameConstants.Pokeball).filter(isNaN).length - 1; i++) {
- document.getElementById("pokeballs_" + i).addEventListener("click", function () {
- App.game.pokeballs.gainPokeballs(parseInt(this.getAttribute("pokeball")), parseInt(document.getElementById('inputAddPokeballs').value || 0), true);
- });
- }
-
- // berries
- for (let i = 0; i < Object.keys(BerryType).filter(isNaN).length - 1; i++) {
- document.getElementById("berries_" + i).addEventListener("click", function () {
- App.game.farming.gainBerry(parseInt(this.getAttribute("berry")), parseInt(document.getElementById('inputAddBerries').value || 0), true);
- });
- }
-
- // evolutionitems
- for (let i = 0; i < Object.keys(GameConstants.StoneType).filter(isNaN).length - 1; i++) {
- document.getElementById("evolutionitems_" + i).addEventListener("click", function () {
- player.gainItem(ItemList[this.getAttribute("item")].name, parseInt(document.getElementById('inputAddEvolutionItems').value || 0), true);
- });
- }
-
- // vitamins
- for (let i = 0; i < Object.keys(GameConstants.VitaminType).filter(isNaN).length; i++) {
- document.getElementById("vitamins_" + i).addEventListener("click", function () {
- player.gainItem(ItemList[this.getAttribute("vitamin")].name, parseInt(document.getElementById('inputAddVitamins').value || 0), true);
- });
- }
-
- // heldItems
- HeldItem.getSortedHeldItems().attack.items.forEach((itm, idx) => {
- document.getElementById("attackhelditems_" + idx).addEventListener("click", function () {
- HeldItem.getSortedHeldItems().attack.items[parseInt(this.getAttribute("item"))].gain(parseInt(document.getElementById('inputAddHeldItems').value || 0));
- });
- });
- HeldItem.getSortedHeldItems().typeRestricted.items.forEach((itm, idx) => {
- document.getElementById("typehelditems_" + idx).addEventListener("click", function () {
- HeldItem.getSortedHeldItems().typeRestricted.items[parseInt(this.getAttribute("item"))].gain(parseInt(document.getElementById('inputAddHeldItems').value || 0));
- });
- });
- HeldItem.getSortedHeldItems().ev.items.forEach((itm, idx) => {
- document.getElementById("evhelditems_" + idx).addEventListener("click", function () {
- HeldItem.getSortedHeldItems().ev.items[parseInt(this.getAttribute("item"))].gain(parseInt(document.getElementById('inputAddHeldItems').value || 0));
- });
- });
- HeldItem.getSortedHeldItems().exp.items.forEach((itm, idx) => {
- document.getElementById("exphelditems_" + idx).addEventListener("click", function () {
- HeldItem.getSortedHeldItems().exp.items[parseInt(this.getAttribute("item"))].gain(parseInt(document.getElementById('inputAddHeldItems').value || 0));
- });
- });
- HeldItem.getSortedHeldItems().other.items.forEach((itm, idx) => {
- document.getElementById("otherhelditems_" + idx).addEventListener("click", function () {
- HeldItem.getSortedHeldItems().other.items[parseInt(this.getAttribute("item"))].gain(parseInt(document.getElementById('inputAddHeldItems').value || 0));
- });
- });
-
- //pokedex events
- document.getElementById("pokedex").children[1].addEventListener("click", loadPkdx);
- document.getElementById("pkdxNameFilter").addEventListener("input", filterPkdx);
- document.getElementById("pkdxRegionFilter").addEventListener("change", filterPkdx);
- document.getElementById("pkdxShinyFilter").addEventListener("change", filterPkdx);
- document.getElementById("pkdxPKRSFilter").addEventListener("change", filterPkdx);
- for (const pokemon of pokemonList) {
- let pkElement = document.getElementById("pkdx_" + pokemon.id.toString().replace('.','_'));
- if (pkElement){
- pkElement.children[4].addEventListener("click", gainPk);
- pkElement.children[5].addEventListener("click", gainPkrs);
- }
- }
- //questline events
- document.getElementById("questlines").children[1].addEventListener("click", loadQuestLines);
- document.getElementById("questLineFilter").addEventListener("change", filterQuestLine);
+ // currency
+ for (let i = 0; i < Object.keys(GameConstants.Currency).filter(isNaN).length; i++) {
+ document.getElementById("currency_" + i).addEventListener("click", gainCurrency);
+ }
+
+ // gems
+ for (let i = 0; i < Gems.nTypes; i++) {
+ document.getElementById("gems_" + i).addEventListener("click", function () {
+ App.game.gems.gainGems(parseInt(document.getElementById('inputAddGems').value || 0), i);
+ });
+ }
+
+ // pokeballs
+ for (let i = 0; i < Object.keys(GameConstants.Pokeball).filter(isNaN).length - 1; i++) {
+ document.getElementById("pokeballs_" + i).addEventListener("click", function () {
+ App.game.pokeballs.gainPokeballs(i, parseInt(document.getElementById('inputAddPokeballs').value || 0), true);
+ });
+ }
+
+ // berries
+ for (let i = 0; i < Object.keys(BerryType).filter(isNaN).length - 1; i++) {
+ document.getElementById("berries_" + i).addEventListener("click", function () {
+ App.game.farming.gainBerry(i, parseInt(document.getElementById('inputAddBerries').value || 0), true);
+ });
+ }
+
+ // evolutionitems
+ for (let i = 0; i < Object.keys(GameConstants.StoneType).filter(isNaN).length - 1; i++) {
+ document.getElementById("evolutionitems_" + i).addEventListener("click", function () {
+ player.gainItem(ItemList[this.getAttribute("item")].name, parseInt(document.getElementById('inputAddEvolutionItems').value || 0), true);
+ });
+ }
+
+ // vitamins
+ for (let i = 0; i < Object.keys(GameConstants.VitaminType).filter(isNaN).length; i++) {
+ document.getElementById("vitamins_" + i).addEventListener("click", function () {
+ player.gainItem(ItemList[this.getAttribute("vitamin")].name, parseInt(document.getElementById('inputAddVitamins').value || 0), true);
+ });
+ }
+
+ // heldItems
+ HeldItem.getSortedHeldItems().attack.items.forEach((itm, idx) => {
+ document.getElementById("attackhelditems_" + idx).addEventListener("click", function () {
+ HeldItem.getSortedHeldItems().attack.items[parseInt(this.getAttribute("item"))].gain(parseInt(document.getElementById('inputAddHeldItems').value || 0));
+ });
+ });
+ HeldItem.getSortedHeldItems().typeRestricted.items.forEach((itm, idx) => {
+ document.getElementById("typehelditems_" + idx).addEventListener("click", function () {
+ HeldItem.getSortedHeldItems().typeRestricted.items[parseInt(this.getAttribute("item"))].gain(parseInt(document.getElementById('inputAddHeldItems').value || 0));
+ });
+ });
+ HeldItem.getSortedHeldItems().ev.items.forEach((itm, idx) => {
+ document.getElementById("evhelditems_" + idx).addEventListener("click", function () {
+ HeldItem.getSortedHeldItems().ev.items[parseInt(this.getAttribute("item"))].gain(parseInt(document.getElementById('inputAddHeldItems').value || 0));
+ });
+ });
+ HeldItem.getSortedHeldItems().exp.items.forEach((itm, idx) => {
+ document.getElementById("exphelditems_" + idx).addEventListener("click", function () {
+ HeldItem.getSortedHeldItems().exp.items[parseInt(this.getAttribute("item"))].gain(parseInt(document.getElementById('inputAddHeldItems').value || 0));
+ });
+ });
+ HeldItem.getSortedHeldItems().other.items.forEach((itm, idx) => {
+ document.getElementById("otherhelditems_" + idx).addEventListener("click", function () {
+ HeldItem.getSortedHeldItems().other.items[parseInt(this.getAttribute("item"))].gain(parseInt(document.getElementById('inputAddHeldItems').value || 0));
+ });
+ });
+
+ // pokedex
+ document.getElementById("pokedex").children[1].addEventListener("click", loadPkdx);
+ document.getElementById("pkdxNameFilter").addEventListener("input", filterPkdx);
+ document.getElementById("pkdxRegionFilter").addEventListener("change", filterPkdx);
+ document.getElementById("pkdxShinyFilter").addEventListener("change", filterPkdx);
+ document.getElementById("pkdxPKRSFilter").addEventListener("change", filterPkdx);
+ for (const pokemon of pokemonList) {
+ let pkElement = document.getElementById("pkdx_" + pokemon.id.toString().replace('.','_'));
+ if (pkElement){
+ pkElement.children[4].addEventListener("click", gainPk);
+ pkElement.children[5].addEventListener("click", gainPkrs);
+ }
+ }
+
+ // questline
+ document.getElementById("questlines").children[1].addEventListener("click", loadQuestLines);
+ document.getElementById("questLineFilter").addEventListener("change", filterQuestLine);
}
function initSaveEditor() {
- // Add menu item
- let eventLi = document.createElement('li');
- eventLi.innerHTML = `
Debug Cheats `
- profileDrop.before(eventLi);
-
- // Add popup
- let eventMod = document.createElement('div');
- eventMod.setAttribute("class", "modal noselect fade show");
- eventMod.setAttribute("id", "saveEditorModal");
- eventMod.setAttribute("tabindex", "-1");
- eventMod.setAttribute("aria-labelledby", "saveEditorModal");
- eventMod.setAttribute("aria-modal", "true");
- eventMod.setAttribute("role", "dialog");
-
- eventMod.innerHTML = `
-
- `;
-
- profileModal.before(eventMod);
-
- let modalBody = document.querySelector('[id=saveEditorModal] div div [class=modal-body]');
-
- // currency
- for (let i = 0; i < Object.keys(GameConstants.Currency).filter(isNaN).length; i++) {
- const itm = GameConstants.Currency[i];
- const itmPretty = itm.charAt(0).toUpperCase() + itm.replace(/[A-Z]/g, ' $&').trim().slice(1);
- modalBody.querySelector('#currency').innerHTML += `
-
-
-
${itmPretty}
-
- `;
- }
-
- // gems
- for (let i = 0; i < Gems.nTypes; i++) {
- const itm = PokemonType[i];
- modalBody.querySelector('#gems').innerHTML += `
-
-
-
${itm}
-
- `;
- }
-
- // pokeballs
- for (let i = 0; i < Object.keys(GameConstants.Pokeball).filter(isNaN).length - 1; i++) {
- const itm = GameConstants.Pokeball[i];
- modalBody.querySelector('#pokeballs').innerHTML += `
-
-
-
${itm}
-
- `;
- }
-
- // berries
- for (let i = 0; i < Object.keys(BerryType).filter(isNaN).length - 1; i++) {
- const itm = BerryType[i];
- modalBody.querySelector('#berries').innerHTML += `
-
-
-
${itm}
-
- `;
- }
-
- // evolutionitems
- for (let i = 0; i < Object.keys(GameConstants.StoneType).filter(isNaN).length - 1; i++) {
- const itm = GameConstants.StoneType[i];
- const itmPretty = itm.replaceAll('_', ' ');
- modalBody.querySelector('#evolutionitems').innerHTML += `
-
-
-
${itmPretty}
-
- `;
- }
-
- // vitamins
- for (let i = 0; i < Object.keys(GameConstants.VitaminType).filter(isNaN).length; i++) {
- const itm = GameConstants.VitaminType[i];
- modalBody.querySelector('#vitamins').innerHTML += `
-
-
-
${itm}
-
- `;
- }
-
- // heldItems
- HeldItem.getSortedHeldItems().attack.items.forEach((itm, idx) => {
- const itmPretty = itm.name.replaceAll('_', ' ');
- modalBody.querySelector('#heldItems').innerHTML += `
-
-
-
${itmPretty}
-
- `;
- });
- HeldItem.getSortedHeldItems().typeRestricted.items.forEach((itm, idx) => {
- const itmPretty = itm.name.replaceAll('_', ' ');
- modalBody.querySelector('#heldItems').innerHTML += `
-
-
-
${itmPretty}
-
- `;
- });
- HeldItem.getSortedHeldItems().ev.items.forEach((itm, idx) => {
- const itmPretty = itm.name.replaceAll('_', ' ');
- modalBody.querySelector('#heldItems').innerHTML += `
-
-
-
${itmPretty}
-
- `;
- });
- HeldItem.getSortedHeldItems().exp.items.forEach((itm, idx) => {
- const itmPretty = itm.name.replaceAll('_', ' ');
- modalBody.querySelector('#heldItems').innerHTML += `
-
-
-
${itmPretty}
-
- `;
- });
- HeldItem.getSortedHeldItems().other.items.forEach((itm, idx) => {
- const itmPretty = itm.name.replaceAll('_', ' ');
- modalBody.querySelector('#heldItems').innerHTML += `
-
-
-
${itmPretty}
-
- `;
- });
-
- // pokedex
- const pkdxRegFilt = modalBody.querySelector('#pkdxRegionFilter');
- for (let i = 0; i <= player.highestRegion(); i++) {
- const reg = GameConstants.Region[i]
- pkdxRegFilt.innerHTML += `
${reg.charAt(0).toUpperCase() + reg.slice(1)} `;
- }
- pkdxRegFilt.innerHTML += '
None ';
-
-
- loadEventHandlers();
+ // Add menu item
+ let eventLi = document.createElement('li');
+ eventLi.innerHTML = `
Debug Cheats `
+ profileDrop.before(eventLi);
+
+ // Add popup
+ let eventMod = document.createElement('div');
+ eventMod.setAttribute("class", "modal noselect fade show");
+ eventMod.setAttribute("id", "saveEditorModal");
+ eventMod.setAttribute("tabindex", "-1");
+ eventMod.setAttribute("aria-labelledby", "saveEditorModal");
+ eventMod.setAttribute("aria-modal", "true");
+ eventMod.setAttribute("role", "dialog");
+
+ eventMod.innerHTML = `
+
+ `;
+
+ profileModal.before(eventMod);
+
+ let modalBody = document.querySelector('[id=saveEditorModal] div div [class=modal-body]');
+
+ // currency
+ for (let i = 0; i < Object.keys(GameConstants.Currency).filter(isNaN).length; i++) {
+ const itm = GameConstants.Currency[i];
+ const itmPretty = itm.charAt(0).toUpperCase() + itm.replace(/[A-Z]/g, ' $&').trim().slice(1);
+ modalBody.querySelector('#currency').innerHTML += `
+
+
+
${itmPretty}
+
+ `;
+ }
+
+ // gems
+ for (let i = 0; i < Gems.nTypes; i++) {
+ const itm = PokemonType[i];
+ modalBody.querySelector('#gems').innerHTML += `
+
+
+
${itm}
+
+ `;
+ }
+
+ // pokeballs
+ for (let i = 0; i < Object.keys(GameConstants.Pokeball).filter(isNaN).length - 1; i++) {
+ const itm = GameConstants.Pokeball[i];
+ modalBody.querySelector('#pokeballs').innerHTML += `
+
+
+
${itm}
+
+ `;
+ }
+
+ // berries
+ for (let i = 0; i < Object.keys(BerryType).filter(isNaN).length - 1; i++) {
+ const itm = BerryType[i];
+ modalBody.querySelector('#berries').innerHTML += `
+
+
+
${itm}
+
+ `;
+ }
+
+ // evolutionitems
+ for (let i = 0; i < Object.keys(GameConstants.StoneType).filter(isNaN).length - 1; i++) {
+ const itm = GameConstants.StoneType[i];
+ const itmPretty = itm.replaceAll('_', ' ');
+ modalBody.querySelector('#evolutionitems').innerHTML += `
+
+
+
${itmPretty}
+
+ `;
+ }
+
+ // vitamins
+ for (let i = 0; i < Object.keys(GameConstants.VitaminType).filter(isNaN).length; i++) {
+ const itm = GameConstants.VitaminType[i];
+ modalBody.querySelector('#vitamins').innerHTML += `
+
+
+
${itm}
+
+ `;
+ }
+
+ // heldItems
+ HeldItem.getSortedHeldItems().attack.items.forEach((itm, idx) => {
+ const itmPretty = itm.name.replaceAll('_', ' ');
+ modalBody.querySelector('#heldItems').innerHTML += `
+
+
+
${itmPretty}
+
+ `;
+ });
+ HeldItem.getSortedHeldItems().typeRestricted.items.forEach((itm, idx) => {
+ const itmPretty = itm.name.replaceAll('_', ' ');
+ modalBody.querySelector('#heldItems').innerHTML += `
+
+
+
${itmPretty}
+
+ `;
+ });
+ HeldItem.getSortedHeldItems().ev.items.forEach((itm, idx) => {
+ const itmPretty = itm.name.replaceAll('_', ' ');
+ modalBody.querySelector('#heldItems').innerHTML += `
+
+
+
${itmPretty}
+
+ `;
+ });
+ HeldItem.getSortedHeldItems().exp.items.forEach((itm, idx) => {
+ const itmPretty = itm.name.replaceAll('_', ' ');
+ modalBody.querySelector('#heldItems').innerHTML += `
+
+
+
${itmPretty}
+
+ `;
+ });
+ HeldItem.getSortedHeldItems().other.items.forEach((itm, idx) => {
+ const itmPretty = itm.name.replaceAll('_', ' ');
+ modalBody.querySelector('#heldItems').innerHTML += `
+
+
+
${itmPretty}
+
+ `;
+ });
+
+ // pokedex
+ const pkdxRegFilt = modalBody.querySelector('#pkdxRegionFilter');
+ for (let i = 0; i <= player.highestRegion(); i++) {
+ const reg = GameConstants.Region[i]
+ pkdxRegFilt.innerHTML += `
${reg.charAt(0).toUpperCase() + reg.slice(1)} `;
+ }
+ pkdxRegFilt.innerHTML += '
None ';
+
+
+ loadEventHandlers();
}
/* WIP, sevii helper
var lst = pokemonList.filter((p) => p.name.includes('Pinkan')
- || p.name.includes('Valencian')
- || p.name === 'Crystal Onix'
- || p.name === 'Ash\'s Butterfree'
- || p.name === 'Pink Butterfree');
+ || p.name.includes('Valencian')
+ || p.name === 'Crystal Onix'
+ || p.name === 'Ash\'s Butterfree'
+ || p.name === 'Pink Butterfree');
var caught = App.game.party.caughtPokemon
- .filter((p) => p.name.includes('Pinkan')
- || p.name.includes('Valencian')
- || p.name === 'Crystal Onix'
- || p.name === 'Ash\'s Butterfree'
- || p.name === 'Pink Butterfree');
+ .filter((p) => p.name.includes('Pinkan')
+ || p.name.includes('Valencian')
+ || p.name === 'Crystal Onix'
+ || p.name === 'Ash\'s Butterfree'
+ || p.name === 'Pink Butterfree');
var caughtNames = caught.map(e => e.name);
var missing = lst.filter(e => !caughtNames.includes(e.name));
@@ -618,71 +618,71 @@ console.log(missing);
*/
function loadEpheniaScript(scriptName, initFunction, priorityFunction) {
- function reportScriptError(scriptName, error) {
- console.error(`Error while initializing '${scriptName}' userscript:\n${error}`);
- Notifier.notify({
- type: NotificationConstants.NotificationOption.warning,
- title: scriptName,
- message: `The '${scriptName}' userscript crashed while loading. Check for updates or disable the script, then restart the game.\n\nReport script issues to the script developer, not to the Pokéclicker team.`,
- timeout: GameConstants.DAY,
- });
- }
- const windowObject = !App.isUsingClient ? unsafeWindow : window;
- // Inject handlers if they don't exist yet
- if (windowObject.epheniaScriptInitializers === undefined) {
- windowObject.epheniaScriptInitializers = {};
- const oldInit = Preload.hideSplashScreen;
- var hasInitialized = false;
-
- // Initializes scripts once enough of the game has loaded
- Preload.hideSplashScreen = function (...args) {
- var result = oldInit.apply(this, args);
- if (App.game && !hasInitialized) {
- // Initialize all attached userscripts
- Object.entries(windowObject.epheniaScriptInitializers).forEach(([scriptName, initFunction]) => {
- try {
- initFunction();
- } catch (e) {
- reportScriptError(scriptName, e);
- }
- });
- hasInitialized = true;
- }
- return result;
- }
- }
-
- // Prevent issues with duplicate script names
- if (windowObject.epheniaScriptInitializers[scriptName] !== undefined) {
- console.warn(`Duplicate '${scriptName}' userscripts found!`);
- Notifier.notify({
- type: NotificationConstants.NotificationOption.warning,
- title: scriptName,
- message: `Duplicate '${scriptName}' userscripts detected. This could cause unpredictable behavior and is not recommended.`,
- timeout: GameConstants.DAY,
- });
- let number = 2;
- while (windowObject.epheniaScriptInitializers[`${scriptName} ${number}`] !== undefined) {
- number++;
- }
- scriptName = `${scriptName} ${number}`;
- }
- // Add initializer for this particular script
- windowObject.epheniaScriptInitializers[scriptName] = initFunction;
- // Run any functions that need to execute before the game starts
- if (priorityFunction) {
- $(document).ready(() => {
- try {
- priorityFunction();
- } catch (e) {
- reportScriptError(scriptName, e);
- // Remove main initialization function
- windowObject.epheniaScriptInitializers[scriptName] = () => null;
- }
- });
- }
+ function reportScriptError(scriptName, error) {
+ console.error(`Error while initializing '${scriptName}' userscript:\n${error}`);
+ Notifier.notify({
+ type: NotificationConstants.NotificationOption.warning,
+ title: scriptName,
+ message: `The '${scriptName}' userscript crashed while loading. Check for updates or disable the script, then restart the game.\n\nReport script issues to the script developer, not to the Pokéclicker team.`,
+ timeout: GameConstants.DAY,
+ });
+ }
+ const windowObject = !App.isUsingClient ? unsafeWindow : window;
+ // Inject handlers if they don't exist yet
+ if (windowObject.epheniaScriptInitializers === undefined) {
+ windowObject.epheniaScriptInitializers = {};
+ const oldInit = Preload.hideSplashScreen;
+ var hasInitialized = false;
+
+ // Initializes scripts once enough of the game has loaded
+ Preload.hideSplashScreen = function (...args) {
+ var result = oldInit.apply(this, args);
+ if (App.game && !hasInitialized) {
+ // Initialize all attached userscripts
+ Object.entries(windowObject.epheniaScriptInitializers).forEach(([scriptName, initFunction]) => {
+ try {
+ initFunction();
+ } catch (e) {
+ reportScriptError(scriptName, e);
+ }
+ });
+ hasInitialized = true;
+ }
+ return result;
+ }
+ }
+
+ // Prevent issues with duplicate script names
+ if (windowObject.epheniaScriptInitializers[scriptName] !== undefined) {
+ console.warn(`Duplicate '${scriptName}' userscripts found!`);
+ Notifier.notify({
+ type: NotificationConstants.NotificationOption.warning,
+ title: scriptName,
+ message: `Duplicate '${scriptName}' userscripts detected. This could cause unpredictable behavior and is not recommended.`,
+ timeout: GameConstants.DAY,
+ });
+ let number = 2;
+ while (windowObject.epheniaScriptInitializers[`${scriptName} ${number}`] !== undefined) {
+ number++;
+ }
+ scriptName = `${scriptName} ${number}`;
+ }
+ // Add initializer for this particular script
+ windowObject.epheniaScriptInitializers[scriptName] = initFunction;
+ // Run any functions that need to execute before the game starts
+ if (priorityFunction) {
+ $(document).ready(() => {
+ try {
+ priorityFunction();
+ } catch (e) {
+ reportScriptError(scriptName, e);
+ // Remove main initialization function
+ windowObject.epheniaScriptInitializers[scriptName] = () => null;
+ }
+ });
+ }
}
if (!App.isUsingClient || localStorage.getItem('debugcheatstools') === 'true') {
- loadEpheniaScript('debugcheatstools', initSaveEditor);
+ loadEpheniaScript('debugcheatstools', initSaveEditor);
}
From fe12e37622c3b154a5b2c7549ddbf873fbf84d2b Mon Sep 17 00:00:00 2001
From: iamc24 <42425100+iamc24@users.noreply.github.com>
Date: Sun, 27 Jul 2025 13:49:30 -0700
Subject: [PATCH 09/14] Update debugcheatstools.user.js
fix indents
---
custom/debugcheatstools.user.js | 1224 +++++++++++++++----------------
1 file changed, 612 insertions(+), 612 deletions(-)
diff --git a/custom/debugcheatstools.user.js b/custom/debugcheatstools.user.js
index 7978af6..6ffab17 100644
--- a/custom/debugcheatstools.user.js
+++ b/custom/debugcheatstools.user.js
@@ -24,592 +24,592 @@ const profileDrop = document.getElementById('startMenu').querySelectorAll('ul li
const profileModal = document.getElementById('profileModal');
function getPokerusImgSrc(id, pkm){
- let lpkm = pkm || App.game.party.getPokemon(id);
- return lpkm?.pokerus || 0 > 0 ? (lpkm.pokerus === 3 ? "assets/images/breeding/pokerus/Resistant.png" : "assets/images/breeding/pokerus/Contagious.png") : "assets/images/breeding/pokerus/Infected.png";
+ let lpkm = pkm || App.game.party.getPokemon(id);
+ return lpkm?.pokerus || 0 > 0 ? (lpkm.pokerus === 3 ? "assets/images/breeding/pokerus/Resistant.png" : "assets/images/breeding/pokerus/Contagious.png") : "assets/images/breeding/pokerus/Infected.png";
}
function getPokeballImgSrc(id, pkm){
- let lpkm = pkm || App.game.party.getPokemon(id);
- return lpkm ? ((lpkm?.shiny === true) ? "assets/images/pokeball/Pokeball-shiny.svg" : "assets/images/pokeball/Pokeball.svg") : "assets/images/pokeball/None.svg";
+ let lpkm = pkm || App.game.party.getPokemon(id);
+ return lpkm ? ((lpkm?.shiny === true) ? "assets/images/pokeball/Pokeball-shiny.svg" : "assets/images/pokeball/Pokeball.svg") : "assets/images/pokeball/None.svg";
}
// eslint-disable-next-line no-unused-vars
function gainPk(){
- let id = parseFloat(this.parentElement.children[0].innerHTML);
- let lpkm = App.game.party.getPokemon(id);
- if (!lpkm)
- App.game.party.gainPokemonById(id)
- else if (!(lpkm?.shiny === true))
- App.game.party.gainPokemonById(id, true);
- document.querySelectorAll(`:scope #pkdx_${id.toString().replace('.','_')} img`)[1].src = getPokeballImgSrc(id, lpkm);
- filterPkdx();
- loadEventHandlers();
+ let id = parseFloat(this.parentElement.children[0].innerHTML);
+ let lpkm = App.game.party.getPokemon(id);
+ if (!lpkm)
+ App.game.party.gainPokemonById(id)
+ else if (!(lpkm?.shiny === true))
+ App.game.party.gainPokemonById(id, true);
+ document.querySelectorAll(`:scope #pkdx_${id.toString().replace('.','_')} img`)[1].src = getPokeballImgSrc(id, lpkm);
+ filterPkdx();
+ loadEventHandlers();
}
// eslint-disable-next-line no-unused-vars
function gainPkrs(){
- let id = parseFloat(this.parentElement.children[0].innerHTML);
- let lpkm = App.game.party.getPokemon(id);
- if (!lpkm) return;
- lpkm.effortPoints = ((lpkm.pokerus < 2) ? 1 : 50) * 1000; // strange
- lpkm.pokerus = (lpkm.pokerus < 2) ? 2 : 3;
- document.querySelectorAll(`:scope #pkdx_${id.toString().replace('.','_')} img`)[2].src = getPokerusImgSrc(id, lpkm);
- filterPkdx();
- loadEventHandlers();
+ let id = parseFloat(this.parentElement.children[0].innerHTML);
+ let lpkm = App.game.party.getPokemon(id);
+ if (!lpkm) return;
+ lpkm.effortPoints = ((lpkm.pokerus < 2) ? 1 : 50) * 1000; // strange
+ lpkm.pokerus = (lpkm.pokerus < 2) ? 2 : 3;
+ document.querySelectorAll(`:scope #pkdx_${id.toString().replace('.','_')} img`)[2].src = getPokerusImgSrc(id, lpkm);
+ filterPkdx();
+ loadEventHandlers();
}
function gainCurrency() {
- let currency = parseInt(this.getAttribute("currency"));
- let changeAmount = parseInt(document.getElementById("inputAddCurrency").value || 0);
- if (changeAmount > 0) {
- App.game.wallet.addAmount(new Amount(changeAmount,currency),true);
- } else if (changeAmount < 0) {
- changeAmount = Math.abs(changeAmount);
- if (changeAmount > App.game.wallet.currencies[currency]()) {
- changeAmount = App.game.wallet.currencies[currency]();
- if (changeAmount == 0) {
- return;
- }
- }
- App.game.wallet.loseAmount(new Amount(changeAmount,currency));
- }
+ let currency = parseInt(this.getAttribute("currency"));
+ let changeAmount = parseInt(document.getElementById("inputAddCurrency").value || 0);
+ if (changeAmount > 0) {
+ App.game.wallet.addAmount(new Amount(changeAmount,currency),true);
+ } else if (changeAmount < 0) {
+ changeAmount = Math.abs(changeAmount);
+ if (changeAmount > App.game.wallet.currencies[currency]()) {
+ changeAmount = App.game.wallet.currencies[currency]();
+ if (changeAmount == 0) {
+ return;
+ }
+ }
+ App.game.wallet.loseAmount(new Amount(changeAmount,currency));
+ }
}
function filterPkdx(){
- let lst = document.querySelectorAll(':scope #pkdx tbody tr');
- for (let i = 0; i < lst.length; i++) {
- const tdb = lst[i];
- let display = true;
-
- if (document.getElementById('pkdxNameFilter').value !== ""){
- display = tdb.innerHTML.match(/
.*<\/td>/g)[3].toLowerCase().includes(document.getElementById('pkdxNameFilter').value.toLowerCase());
- }
-
- if (display === true) {
- switch (document.getElementById('pkdxRegionFilter').value) {
- case 'all':
- break;
- default:
- display = tdb.innerHTML.match(/ .*<\/td>/g)[1].toLowerCase().includes(document.getElementById('pkdxRegionFilter').value);
- break;
- }
- }
-
- if (display === true) {
- switch (document.getElementById('pkdxShinyFilter').value) {
- case 'uncaught':
- display = tdb.innerHTML.includes('None.svg');
- break;
- case 'caught':
- display = tdb.innerHTML.includes('Pokeball.svg') || tdb.innerHTML.includes('Pokeball-shiny.svg');
- break;
- case 'caught-not-shiny':
- display = tdb.innerHTML.includes('Pokeball.svg');
- break;
- case 'caught-shiny':
- display = tdb.innerHTML.includes('Pokeball-shiny.svg');
- break;
- default:
- break;
- }
- }
-
- if (display === true) {
- switch (document.getElementById('pkdxPKRSFilter').value) {
- case '0':
- display = tdb.innerHTML.includes('Infected.png');
- break;
- case '2':
- display = tdb.innerHTML.includes('Contagious.png');
- break;
- case '3':
- display = tdb.innerHTML.includes('Resistant.png');
- break;
- default:
- break;
- }
- }
-
- tdb.style.display = (display === true ? "" : "none");
- }
+ let lst = document.querySelectorAll(':scope #pkdx tbody tr');
+ for (let i = 0; i < lst.length; i++) {
+ const tdb = lst[i];
+ let display = true;
+
+ if (document.getElementById('pkdxNameFilter').value !== ""){
+ display = tdb.innerHTML.match(/ .*<\/td>/g)[3].toLowerCase().includes(document.getElementById('pkdxNameFilter').value.toLowerCase());
+ }
+
+ if (display === true) {
+ switch (document.getElementById('pkdxRegionFilter').value) {
+ case 'all':
+ break;
+ default:
+ display = tdb.innerHTML.match(/ .*<\/td>/g)[1].toLowerCase().includes(document.getElementById('pkdxRegionFilter').value);
+ break;
+ }
+ }
+
+ if (display === true) {
+ switch (document.getElementById('pkdxShinyFilter').value) {
+ case 'uncaught':
+ display = tdb.innerHTML.includes('None.svg');
+ break;
+ case 'caught':
+ display = tdb.innerHTML.includes('Pokeball.svg') || tdb.innerHTML.includes('Pokeball-shiny.svg');
+ break;
+ case 'caught-not-shiny':
+ display = tdb.innerHTML.includes('Pokeball.svg');
+ break;
+ case 'caught-shiny':
+ display = tdb.innerHTML.includes('Pokeball-shiny.svg');
+ break;
+ default:
+ break;
+ }
+ }
+
+ if (display === true) {
+ switch (document.getElementById('pkdxPKRSFilter').value) {
+ case '0':
+ display = tdb.innerHTML.includes('Infected.png');
+ break;
+ case '2':
+ display = tdb.innerHTML.includes('Contagious.png');
+ break;
+ case '3':
+ display = tdb.innerHTML.includes('Resistant.png');
+ break;
+ default:
+ break;
+ }
+ }
+
+ tdb.style.display = (display === true ? "" : "none");
+ }
}
function filterQuestLine(){
- let lst = document.querySelectorAll(':scope #questlinelist tbody tr');
- for (let i = 0; i < lst.length; i++) {
- const tdb = lst[i];
- let display = true;
-
- if (display === true) {
- switch (document.getElementById('questLineFilter').value) {
- case 'all':
- break;
- default:
- display = tdb.innerHTML.toLowerCase().includes(document.getElementById('questLineFilter').value);
- break;
- }
- }
-
- tdb.style.display = (display === true ? "" : "none");
- }
+ let lst = document.querySelectorAll(':scope #questlinelist tbody tr');
+ for (let i = 0; i < lst.length; i++) {
+ const tdb = lst[i];
+ let display = true;
+
+ if (display === true) {
+ switch (document.getElementById('questLineFilter').value) {
+ case 'all':
+ break;
+ default:
+ display = tdb.innerHTML.toLowerCase().includes(document.getElementById('questLineFilter').value);
+ break;
+ }
+ }
+
+ tdb.style.display = (display === true ? "" : "none");
+ }
}
// eslint-disable-next-line no-unused-vars
function loadPkdx(){
- let playerRegion = player.highestRegion();
- let pkdxBody = document.querySelector(':scope #pkdx tbody');
- pkdxBody.innerHTML = '';
- let toAdd = "";
- for (const pokemon of pokemonList) {
- if ((pokemon.nativeRegion <= playerRegion && pokemon.nativeRegion > -1) || (pokemon.nativeRegion == -1 && playerRegion >= GameConstants.Region.alola) || pokemon.id == 0) {
- let lpkm = App.game.party.getPokemon(pokemon.id);
- let region = GameConstants.Region[pokemon.nativeRegion].charAt(0).toUpperCase() + GameConstants.Region[pokemon.nativeRegion].slice(1);
- let hint = "";
- let getPokemonLocation = PokemonLocations.getPokemonLocations(pokemon.name, playerRegion);
- let roadLocations = getPokemonLocation[0]
- if (roadLocations) {
- for (let i = 0; i <= playerRegion; i++) {
- const reg = GameConstants.Region[i];
- let roads = "Route"
- roadLocations[i]?.forEach((route) => {
- roads += ` ${route.route},`
- });
- if (roads !== "Route")
- hint += `${hint !== "" ? `\n` : ""}${reg.charAt(0).toUpperCase() + reg.slice(1)}: ${roads.slice(0, -1)}`;
- }
- if (hint !== "")
- hint = ` title="${hint}"`;
- }
- toAdd += `
-
- ${pokemon.id}
- ${region}
-
- ${pokemon.name}
-
-
- YES') : '194, 46, 40);">NO'}
-
- `;
- }
- }
- pkdxBody.innerHTML = toAdd;
- filterPkdx();
- loadEventHandlers();
+ let playerRegion = player.highestRegion();
+ let pkdxBody = document.querySelector(':scope #pkdx tbody');
+ pkdxBody.innerHTML = '';
+ let toAdd = "";
+ for (const pokemon of pokemonList) {
+ if ((pokemon.nativeRegion <= playerRegion && pokemon.nativeRegion > -1) || (pokemon.nativeRegion == -1 && playerRegion >= GameConstants.Region.alola) || pokemon.id == 0) {
+ let lpkm = App.game.party.getPokemon(pokemon.id);
+ let region = GameConstants.Region[pokemon.nativeRegion].charAt(0).toUpperCase() + GameConstants.Region[pokemon.nativeRegion].slice(1);
+ let hint = "";
+ let getPokemonLocation = PokemonLocations.getPokemonLocations(pokemon.name, playerRegion);
+ let roadLocations = getPokemonLocation[0]
+ if (roadLocations) {
+ for (let i = 0; i <= playerRegion; i++) {
+ const reg = GameConstants.Region[i];
+ let roads = "Route"
+ roadLocations[i]?.forEach((route) => {
+ roads += ` ${route.route},`
+ });
+ if (roads !== "Route")
+ hint += `${hint !== "" ? `\n` : ""}${reg.charAt(0).toUpperCase() + reg.slice(1)}: ${roads.slice(0, -1)}`;
+ }
+ if (hint !== "")
+ hint = ` title="${hint}"`;
+ }
+ toAdd += `
+
+ ${pokemon.id}
+ ${region}
+
+ ${pokemon.name}
+
+
+ YES') : '194, 46, 40);">NO'}
+
+ `;
+ }
+ }
+ pkdxBody.innerHTML = toAdd;
+ filterPkdx();
+ loadEventHandlers();
}
function loadQuestLines() {
- let qlBody = document.querySelector(':scope #questlinelist tbody');
- qlBody.innerHTML = '';
- let toAdd = "";
-
- for (const ql of App.game.quests.questLines()) {
- let state = QuestLineState[ql.state()]
- state = state.charAt(0).toUpperCase() + state.slice(1)
-
- let stateColor;
- switch (ql.state()) {
- case 0:
- stateColor = "244, 80, 80";
- break;
- case 1:
- stateColor = "99, 144, 240";
- break;
- case 2:
- stateColor = "122, 199, 76";
- break;
- }
-
- toAdd += `
-
- ${ql.name}
- ${state}
-
- `;
- }
-
- // App.game.quests.questLines().filter(e => e.state() < 2).forEach(e => console.log(e.name, e.state()))
-
- qlBody.innerHTML = toAdd;
- filterQuestLine();
- loadEventHandlers();
+ let qlBody = document.querySelector(':scope #questlinelist tbody');
+ qlBody.innerHTML = '';
+ let toAdd = "";
+
+ for (const ql of App.game.quests.questLines()) {
+ let state = QuestLineState[ql.state()]
+ state = state.charAt(0).toUpperCase() + state.slice(1)
+
+ let stateColor;
+ switch (ql.state()) {
+ case 0:
+ stateColor = "244, 80, 80";
+ break;
+ case 1:
+ stateColor = "99, 144, 240";
+ break;
+ case 2:
+ stateColor = "122, 199, 76";
+ break;
+ }
+
+ toAdd += `
+
+ ${ql.name}
+ ${state}
+
+ `;
+ }
+
+ // App.game.quests.questLines().filter(e => e.state() < 2).forEach(e => console.log(e.name, e.state()))
+
+ qlBody.innerHTML = toAdd;
+ filterQuestLine();
+ loadEventHandlers();
}
function loadEventHandlers() {
- // currency
- for (let i = 0; i < Object.keys(GameConstants.Currency).filter(isNaN).length; i++) {
- document.getElementById("currency_" + i).addEventListener("click", gainCurrency);
- }
-
- // gems
- for (let i = 0; i < Gems.nTypes; i++) {
- document.getElementById("gems_" + i).addEventListener("click", function () {
- App.game.gems.gainGems(parseInt(document.getElementById('inputAddGems').value || 0), i);
- });
- }
-
- // pokeballs
- for (let i = 0; i < Object.keys(GameConstants.Pokeball).filter(isNaN).length - 1; i++) {
- document.getElementById("pokeballs_" + i).addEventListener("click", function () {
- App.game.pokeballs.gainPokeballs(i, parseInt(document.getElementById('inputAddPokeballs').value || 0), true);
- });
- }
-
- // berries
- for (let i = 0; i < Object.keys(BerryType).filter(isNaN).length - 1; i++) {
- document.getElementById("berries_" + i).addEventListener("click", function () {
- App.game.farming.gainBerry(i, parseInt(document.getElementById('inputAddBerries').value || 0), true);
- });
- }
-
- // evolutionitems
- for (let i = 0; i < Object.keys(GameConstants.StoneType).filter(isNaN).length - 1; i++) {
- document.getElementById("evolutionitems_" + i).addEventListener("click", function () {
- player.gainItem(ItemList[this.getAttribute("item")].name, parseInt(document.getElementById('inputAddEvolutionItems').value || 0), true);
- });
- }
-
- // vitamins
- for (let i = 0; i < Object.keys(GameConstants.VitaminType).filter(isNaN).length; i++) {
- document.getElementById("vitamins_" + i).addEventListener("click", function () {
- player.gainItem(ItemList[this.getAttribute("vitamin")].name, parseInt(document.getElementById('inputAddVitamins').value || 0), true);
- });
- }
-
- // heldItems
- HeldItem.getSortedHeldItems().attack.items.forEach((itm, idx) => {
- document.getElementById("attackhelditems_" + idx).addEventListener("click", function () {
- HeldItem.getSortedHeldItems().attack.items[parseInt(this.getAttribute("item"))].gain(parseInt(document.getElementById('inputAddHeldItems').value || 0));
- });
- });
- HeldItem.getSortedHeldItems().typeRestricted.items.forEach((itm, idx) => {
- document.getElementById("typehelditems_" + idx).addEventListener("click", function () {
- HeldItem.getSortedHeldItems().typeRestricted.items[parseInt(this.getAttribute("item"))].gain(parseInt(document.getElementById('inputAddHeldItems').value || 0));
- });
- });
- HeldItem.getSortedHeldItems().ev.items.forEach((itm, idx) => {
- document.getElementById("evhelditems_" + idx).addEventListener("click", function () {
- HeldItem.getSortedHeldItems().ev.items[parseInt(this.getAttribute("item"))].gain(parseInt(document.getElementById('inputAddHeldItems').value || 0));
- });
- });
- HeldItem.getSortedHeldItems().exp.items.forEach((itm, idx) => {
- document.getElementById("exphelditems_" + idx).addEventListener("click", function () {
- HeldItem.getSortedHeldItems().exp.items[parseInt(this.getAttribute("item"))].gain(parseInt(document.getElementById('inputAddHeldItems').value || 0));
- });
- });
- HeldItem.getSortedHeldItems().other.items.forEach((itm, idx) => {
- document.getElementById("otherhelditems_" + idx).addEventListener("click", function () {
- HeldItem.getSortedHeldItems().other.items[parseInt(this.getAttribute("item"))].gain(parseInt(document.getElementById('inputAddHeldItems').value || 0));
- });
- });
-
- // pokedex
- document.getElementById("pokedex").children[1].addEventListener("click", loadPkdx);
- document.getElementById("pkdxNameFilter").addEventListener("input", filterPkdx);
- document.getElementById("pkdxRegionFilter").addEventListener("change", filterPkdx);
- document.getElementById("pkdxShinyFilter").addEventListener("change", filterPkdx);
- document.getElementById("pkdxPKRSFilter").addEventListener("change", filterPkdx);
- for (const pokemon of pokemonList) {
- let pkElement = document.getElementById("pkdx_" + pokemon.id.toString().replace('.','_'));
- if (pkElement){
- pkElement.children[4].addEventListener("click", gainPk);
- pkElement.children[5].addEventListener("click", gainPkrs);
- }
- }
-
- // questline
- document.getElementById("questlines").children[1].addEventListener("click", loadQuestLines);
- document.getElementById("questLineFilter").addEventListener("change", filterQuestLine);
+ // currency
+ for (let i = 0; i < Object.keys(GameConstants.Currency).filter(isNaN).length; i++) {
+ document.getElementById("currency_" + i).addEventListener("click", gainCurrency);
+ }
+
+ // gems
+ for (let i = 0; i < Gems.nTypes; i++) {
+ document.getElementById("gems_" + i).addEventListener("click", function () {
+ App.game.gems.gainGems(parseInt(document.getElementById('inputAddGems').value || 0), i);
+ });
+ }
+
+ // pokeballs
+ for (let i = 0; i < Object.keys(GameConstants.Pokeball).filter(isNaN).length - 1; i++) {
+ document.getElementById("pokeballs_" + i).addEventListener("click", function () {
+ App.game.pokeballs.gainPokeballs(i, parseInt(document.getElementById('inputAddPokeballs').value || 0), true);
+ });
+ }
+
+ // berries
+ for (let i = 0; i < Object.keys(BerryType).filter(isNaN).length - 1; i++) {
+ document.getElementById("berries_" + i).addEventListener("click", function () {
+ App.game.farming.gainBerry(i, parseInt(document.getElementById('inputAddBerries').value || 0), true);
+ });
+ }
+
+ // evolutionitems
+ for (let i = 0; i < Object.keys(GameConstants.StoneType).filter(isNaN).length - 1; i++) {
+ document.getElementById("evolutionitems_" + i).addEventListener("click", function () {
+ player.gainItem(ItemList[this.getAttribute("item")].name, parseInt(document.getElementById('inputAddEvolutionItems').value || 0), true);
+ });
+ }
+
+ // vitamins
+ for (let i = 0; i < Object.keys(GameConstants.VitaminType).filter(isNaN).length; i++) {
+ document.getElementById("vitamins_" + i).addEventListener("click", function () {
+ player.gainItem(ItemList[this.getAttribute("vitamin")].name, parseInt(document.getElementById('inputAddVitamins').value || 0), true);
+ });
+ }
+
+ // heldItems
+ HeldItem.getSortedHeldItems().attack.items.forEach((itm, idx) => {
+ document.getElementById("attackhelditems_" + idx).addEventListener("click", function () {
+ HeldItem.getSortedHeldItems().attack.items[parseInt(this.getAttribute("item"))].gain(parseInt(document.getElementById('inputAddHeldItems').value || 0));
+ });
+ });
+ HeldItem.getSortedHeldItems().typeRestricted.items.forEach((itm, idx) => {
+ document.getElementById("typehelditems_" + idx).addEventListener("click", function () {
+ HeldItem.getSortedHeldItems().typeRestricted.items[parseInt(this.getAttribute("item"))].gain(parseInt(document.getElementById('inputAddHeldItems').value || 0));
+ });
+ });
+ HeldItem.getSortedHeldItems().ev.items.forEach((itm, idx) => {
+ document.getElementById("evhelditems_" + idx).addEventListener("click", function () {
+ HeldItem.getSortedHeldItems().ev.items[parseInt(this.getAttribute("item"))].gain(parseInt(document.getElementById('inputAddHeldItems').value || 0));
+ });
+ });
+ HeldItem.getSortedHeldItems().exp.items.forEach((itm, idx) => {
+ document.getElementById("exphelditems_" + idx).addEventListener("click", function () {
+ HeldItem.getSortedHeldItems().exp.items[parseInt(this.getAttribute("item"))].gain(parseInt(document.getElementById('inputAddHeldItems').value || 0));
+ });
+ });
+ HeldItem.getSortedHeldItems().other.items.forEach((itm, idx) => {
+ document.getElementById("otherhelditems_" + idx).addEventListener("click", function () {
+ HeldItem.getSortedHeldItems().other.items[parseInt(this.getAttribute("item"))].gain(parseInt(document.getElementById('inputAddHeldItems').value || 0));
+ });
+ });
+
+ // pokedex
+ document.getElementById("pokedex").children[1].addEventListener("click", loadPkdx);
+ document.getElementById("pkdxNameFilter").addEventListener("input", filterPkdx);
+ document.getElementById("pkdxRegionFilter").addEventListener("change", filterPkdx);
+ document.getElementById("pkdxShinyFilter").addEventListener("change", filterPkdx);
+ document.getElementById("pkdxPKRSFilter").addEventListener("change", filterPkdx);
+ for (const pokemon of pokemonList) {
+ let pkElement = document.getElementById("pkdx_" + pokemon.id.toString().replace('.','_'));
+ if (pkElement){
+ pkElement.children[4].addEventListener("click", gainPk);
+ pkElement.children[5].addEventListener("click", gainPkrs);
+ }
+ }
+
+ // questline
+ document.getElementById("questlines").children[1].addEventListener("click", loadQuestLines);
+ document.getElementById("questLineFilter").addEventListener("change", filterQuestLine);
}
function initSaveEditor() {
- // Add menu item
- let eventLi = document.createElement('li');
- eventLi.innerHTML = `
Debug Cheats `
- profileDrop.before(eventLi);
-
- // Add popup
- let eventMod = document.createElement('div');
- eventMod.setAttribute("class", "modal noselect fade show");
- eventMod.setAttribute("id", "saveEditorModal");
- eventMod.setAttribute("tabindex", "-1");
- eventMod.setAttribute("aria-labelledby", "saveEditorModal");
- eventMod.setAttribute("aria-modal", "true");
- eventMod.setAttribute("role", "dialog");
-
- eventMod.innerHTML = `
-
- `;
-
- profileModal.before(eventMod);
-
- let modalBody = document.querySelector('[id=saveEditorModal] div div [class=modal-body]');
-
- // currency
- for (let i = 0; i < Object.keys(GameConstants.Currency).filter(isNaN).length; i++) {
- const itm = GameConstants.Currency[i];
- const itmPretty = itm.charAt(0).toUpperCase() + itm.replace(/[A-Z]/g, ' $&').trim().slice(1);
- modalBody.querySelector('#currency').innerHTML += `
-
-
-
${itmPretty}
-
- `;
- }
-
- // gems
- for (let i = 0; i < Gems.nTypes; i++) {
- const itm = PokemonType[i];
- modalBody.querySelector('#gems').innerHTML += `
-
-
-
${itm}
-
- `;
- }
-
- // pokeballs
- for (let i = 0; i < Object.keys(GameConstants.Pokeball).filter(isNaN).length - 1; i++) {
- const itm = GameConstants.Pokeball[i];
- modalBody.querySelector('#pokeballs').innerHTML += `
-
-
-
${itm}
-
- `;
- }
-
- // berries
- for (let i = 0; i < Object.keys(BerryType).filter(isNaN).length - 1; i++) {
- const itm = BerryType[i];
- modalBody.querySelector('#berries').innerHTML += `
-
-
-
${itm}
-
- `;
- }
-
- // evolutionitems
- for (let i = 0; i < Object.keys(GameConstants.StoneType).filter(isNaN).length - 1; i++) {
- const itm = GameConstants.StoneType[i];
- const itmPretty = itm.replaceAll('_', ' ');
- modalBody.querySelector('#evolutionitems').innerHTML += `
-
-
-
${itmPretty}
-
- `;
- }
-
- // vitamins
- for (let i = 0; i < Object.keys(GameConstants.VitaminType).filter(isNaN).length; i++) {
- const itm = GameConstants.VitaminType[i];
- modalBody.querySelector('#vitamins').innerHTML += `
-
-
-
${itm}
-
- `;
- }
-
- // heldItems
- HeldItem.getSortedHeldItems().attack.items.forEach((itm, idx) => {
- const itmPretty = itm.name.replaceAll('_', ' ');
- modalBody.querySelector('#heldItems').innerHTML += `
-
-
-
${itmPretty}
-
- `;
- });
- HeldItem.getSortedHeldItems().typeRestricted.items.forEach((itm, idx) => {
- const itmPretty = itm.name.replaceAll('_', ' ');
- modalBody.querySelector('#heldItems').innerHTML += `
-
-
-
${itmPretty}
-
- `;
- });
- HeldItem.getSortedHeldItems().ev.items.forEach((itm, idx) => {
- const itmPretty = itm.name.replaceAll('_', ' ');
- modalBody.querySelector('#heldItems').innerHTML += `
-
-
-
${itmPretty}
-
- `;
- });
- HeldItem.getSortedHeldItems().exp.items.forEach((itm, idx) => {
- const itmPretty = itm.name.replaceAll('_', ' ');
- modalBody.querySelector('#heldItems').innerHTML += `
-
-
-
${itmPretty}
-
- `;
- });
- HeldItem.getSortedHeldItems().other.items.forEach((itm, idx) => {
- const itmPretty = itm.name.replaceAll('_', ' ');
- modalBody.querySelector('#heldItems').innerHTML += `
-
-
-
${itmPretty}
-
- `;
- });
-
- // pokedex
- const pkdxRegFilt = modalBody.querySelector('#pkdxRegionFilter');
- for (let i = 0; i <= player.highestRegion(); i++) {
- const reg = GameConstants.Region[i]
- pkdxRegFilt.innerHTML += `
${reg.charAt(0).toUpperCase() + reg.slice(1)} `;
- }
- pkdxRegFilt.innerHTML += '
None ';
-
-
- loadEventHandlers();
+ // Add menu item
+ let eventLi = document.createElement('li');
+ eventLi.innerHTML = `
Debug Cheats `
+ profileDrop.before(eventLi);
+
+ // Add popup
+ let eventMod = document.createElement('div');
+ eventMod.setAttribute("class", "modal noselect fade show");
+ eventMod.setAttribute("id", "saveEditorModal");
+ eventMod.setAttribute("tabindex", "-1");
+ eventMod.setAttribute("aria-labelledby", "saveEditorModal");
+ eventMod.setAttribute("aria-modal", "true");
+ eventMod.setAttribute("role", "dialog");
+
+ eventMod.innerHTML = `
+
+ `;
+
+ profileModal.before(eventMod);
+
+ let modalBody = document.querySelector('[id=saveEditorModal] div div [class=modal-body]');
+
+ // currency
+ for (let i = 0; i < Object.keys(GameConstants.Currency).filter(isNaN).length; i++) {
+ const itm = GameConstants.Currency[i];
+ const itmPretty = itm.charAt(0).toUpperCase() + itm.replace(/[A-Z]/g, ' $&').trim().slice(1);
+ modalBody.querySelector('#currency').innerHTML += `
+
+
+
${itmPretty}
+
+ `;
+ }
+
+ // gems
+ for (let i = 0; i < Gems.nTypes; i++) {
+ const itm = PokemonType[i];
+ modalBody.querySelector('#gems').innerHTML += `
+
+
+
${itm}
+
+ `;
+ }
+
+ // pokeballs
+ for (let i = 0; i < Object.keys(GameConstants.Pokeball).filter(isNaN).length - 1; i++) {
+ const itm = GameConstants.Pokeball[i];
+ modalBody.querySelector('#pokeballs').innerHTML += `
+
+
+
${itm}
+
+ `;
+ }
+
+ // berries
+ for (let i = 0; i < Object.keys(BerryType).filter(isNaN).length - 1; i++) {
+ const itm = BerryType[i];
+ modalBody.querySelector('#berries').innerHTML += `
+
+
+
${itm}
+
+ `;
+ }
+
+ // evolutionitems
+ for (let i = 0; i < Object.keys(GameConstants.StoneType).filter(isNaN).length - 1; i++) {
+ const itm = GameConstants.StoneType[i];
+ const itmPretty = itm.replaceAll('_', ' ');
+ modalBody.querySelector('#evolutionitems').innerHTML += `
+
+
+
${itmPretty}
+
+ `;
+ }
+
+ // vitamins
+ for (let i = 0; i < Object.keys(GameConstants.VitaminType).filter(isNaN).length; i++) {
+ const itm = GameConstants.VitaminType[i];
+ modalBody.querySelector('#vitamins').innerHTML += `
+
+
+
${itm}
+
+ `;
+ }
+
+ // heldItems
+ HeldItem.getSortedHeldItems().attack.items.forEach((itm, idx) => {
+ const itmPretty = itm.name.replaceAll('_', ' ');
+ modalBody.querySelector('#heldItems').innerHTML += `
+
+
+
${itmPretty}
+
+ `;
+ });
+ HeldItem.getSortedHeldItems().typeRestricted.items.forEach((itm, idx) => {
+ const itmPretty = itm.name.replaceAll('_', ' ');
+ modalBody.querySelector('#heldItems').innerHTML += `
+
+
+
${itmPretty}
+
+ `;
+ });
+ HeldItem.getSortedHeldItems().ev.items.forEach((itm, idx) => {
+ const itmPretty = itm.name.replaceAll('_', ' ');
+ modalBody.querySelector('#heldItems').innerHTML += `
+
+
+
${itmPretty}
+
+ `;
+ });
+ HeldItem.getSortedHeldItems().exp.items.forEach((itm, idx) => {
+ const itmPretty = itm.name.replaceAll('_', ' ');
+ modalBody.querySelector('#heldItems').innerHTML += `
+
+
+
${itmPretty}
+
+ `;
+ });
+ HeldItem.getSortedHeldItems().other.items.forEach((itm, idx) => {
+ const itmPretty = itm.name.replaceAll('_', ' ');
+ modalBody.querySelector('#heldItems').innerHTML += `
+
+
+
${itmPretty}
+
+ `;
+ });
+
+ // pokedex
+ const pkdxRegFilt = modalBody.querySelector('#pkdxRegionFilter');
+ for (let i = 0; i <= player.highestRegion(); i++) {
+ const reg = GameConstants.Region[i]
+ pkdxRegFilt.innerHTML += `
${reg.charAt(0).toUpperCase() + reg.slice(1)} `;
+ }
+ pkdxRegFilt.innerHTML += '
None ';
+
+
+ loadEventHandlers();
}
/* WIP, sevii helper
var lst = pokemonList.filter((p) => p.name.includes('Pinkan')
- || p.name.includes('Valencian')
- || p.name === 'Crystal Onix'
- || p.name === 'Ash\'s Butterfree'
- || p.name === 'Pink Butterfree');
+ || p.name.includes('Valencian')
+ || p.name === 'Crystal Onix'
+ || p.name === 'Ash\'s Butterfree'
+ || p.name === 'Pink Butterfree');
var caught = App.game.party.caughtPokemon
- .filter((p) => p.name.includes('Pinkan')
- || p.name.includes('Valencian')
- || p.name === 'Crystal Onix'
- || p.name === 'Ash\'s Butterfree'
- || p.name === 'Pink Butterfree');
+ .filter((p) => p.name.includes('Pinkan')
+ || p.name.includes('Valencian')
+ || p.name === 'Crystal Onix'
+ || p.name === 'Ash\'s Butterfree'
+ || p.name === 'Pink Butterfree');
var caughtNames = caught.map(e => e.name);
var missing = lst.filter(e => !caughtNames.includes(e.name));
@@ -618,71 +618,71 @@ console.log(missing);
*/
function loadEpheniaScript(scriptName, initFunction, priorityFunction) {
- function reportScriptError(scriptName, error) {
- console.error(`Error while initializing '${scriptName}' userscript:\n${error}`);
- Notifier.notify({
- type: NotificationConstants.NotificationOption.warning,
- title: scriptName,
- message: `The '${scriptName}' userscript crashed while loading. Check for updates or disable the script, then restart the game.\n\nReport script issues to the script developer, not to the Pokéclicker team.`,
- timeout: GameConstants.DAY,
- });
- }
- const windowObject = !App.isUsingClient ? unsafeWindow : window;
- // Inject handlers if they don't exist yet
- if (windowObject.epheniaScriptInitializers === undefined) {
- windowObject.epheniaScriptInitializers = {};
- const oldInit = Preload.hideSplashScreen;
- var hasInitialized = false;
-
- // Initializes scripts once enough of the game has loaded
- Preload.hideSplashScreen = function (...args) {
- var result = oldInit.apply(this, args);
- if (App.game && !hasInitialized) {
- // Initialize all attached userscripts
- Object.entries(windowObject.epheniaScriptInitializers).forEach(([scriptName, initFunction]) => {
- try {
- initFunction();
- } catch (e) {
- reportScriptError(scriptName, e);
- }
- });
- hasInitialized = true;
- }
- return result;
- }
- }
-
- // Prevent issues with duplicate script names
- if (windowObject.epheniaScriptInitializers[scriptName] !== undefined) {
- console.warn(`Duplicate '${scriptName}' userscripts found!`);
- Notifier.notify({
- type: NotificationConstants.NotificationOption.warning,
- title: scriptName,
- message: `Duplicate '${scriptName}' userscripts detected. This could cause unpredictable behavior and is not recommended.`,
- timeout: GameConstants.DAY,
- });
- let number = 2;
- while (windowObject.epheniaScriptInitializers[`${scriptName} ${number}`] !== undefined) {
- number++;
- }
- scriptName = `${scriptName} ${number}`;
- }
- // Add initializer for this particular script
- windowObject.epheniaScriptInitializers[scriptName] = initFunction;
- // Run any functions that need to execute before the game starts
- if (priorityFunction) {
- $(document).ready(() => {
- try {
- priorityFunction();
- } catch (e) {
- reportScriptError(scriptName, e);
- // Remove main initialization function
- windowObject.epheniaScriptInitializers[scriptName] = () => null;
- }
- });
- }
+ function reportScriptError(scriptName, error) {
+ console.error(`Error while initializing '${scriptName}' userscript:\n${error}`);
+ Notifier.notify({
+ type: NotificationConstants.NotificationOption.warning,
+ title: scriptName,
+ message: `The '${scriptName}' userscript crashed while loading. Check for updates or disable the script, then restart the game.\n\nReport script issues to the script developer, not to the Pokéclicker team.`,
+ timeout: GameConstants.DAY,
+ });
+ }
+ const windowObject = !App.isUsingClient ? unsafeWindow : window;
+ // Inject handlers if they don't exist yet
+ if (windowObject.epheniaScriptInitializers === undefined) {
+ windowObject.epheniaScriptInitializers = {};
+ const oldInit = Preload.hideSplashScreen;
+ var hasInitialized = false;
+
+ // Initializes scripts once enough of the game has loaded
+ Preload.hideSplashScreen = function (...args) {
+ var result = oldInit.apply(this, args);
+ if (App.game && !hasInitialized) {
+ // Initialize all attached userscripts
+ Object.entries(windowObject.epheniaScriptInitializers).forEach(([scriptName, initFunction]) => {
+ try {
+ initFunction();
+ } catch (e) {
+ reportScriptError(scriptName, e);
+ }
+ });
+ hasInitialized = true;
+ }
+ return result;
+ }
+ }
+
+ // Prevent issues with duplicate script names
+ if (windowObject.epheniaScriptInitializers[scriptName] !== undefined) {
+ console.warn(`Duplicate '${scriptName}' userscripts found!`);
+ Notifier.notify({
+ type: NotificationConstants.NotificationOption.warning,
+ title: scriptName,
+ message: `Duplicate '${scriptName}' userscripts detected. This could cause unpredictable behavior and is not recommended.`,
+ timeout: GameConstants.DAY,
+ });
+ let number = 2;
+ while (windowObject.epheniaScriptInitializers[`${scriptName} ${number}`] !== undefined) {
+ number++;
+ }
+ scriptName = `${scriptName} ${number}`;
+ }
+ // Add initializer for this particular script
+ windowObject.epheniaScriptInitializers[scriptName] = initFunction;
+ // Run any functions that need to execute before the game starts
+ if (priorityFunction) {
+ $(document).ready(() => {
+ try {
+ priorityFunction();
+ } catch (e) {
+ reportScriptError(scriptName, e);
+ // Remove main initialization function
+ windowObject.epheniaScriptInitializers[scriptName] = () => null;
+ }
+ });
+ }
}
if (!App.isUsingClient || localStorage.getItem('debugcheatstools') === 'true') {
- loadEpheniaScript('debugcheatstools', initSaveEditor);
+ loadEpheniaScript('debugcheatstools', initSaveEditor);
}
From f513bec43367099fdb531b495d9917d27e469d82 Mon Sep 17 00:00:00 2001
From: iamc24 <42425100+iamc24@users.noreply.github.com>
Date: Wed, 30 Jul 2025 03:59:30 -0700
Subject: [PATCH 10/14] Update debugcheatstools.user.js
Fix issue with duplicate event handlers being created, multiplying the amount of currency/items added/removed
---
custom/debugcheatstools.user.js | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/custom/debugcheatstools.user.js b/custom/debugcheatstools.user.js
index 6ffab17..5e798cc 100644
--- a/custom/debugcheatstools.user.js
+++ b/custom/debugcheatstools.user.js
@@ -43,7 +43,6 @@ function gainPk(){
App.game.party.gainPokemonById(id, true);
document.querySelectorAll(`:scope #pkdx_${id.toString().replace('.','_')} img`)[1].src = getPokeballImgSrc(id, lpkm);
filterPkdx();
- loadEventHandlers();
}
// eslint-disable-next-line no-unused-vars
@@ -55,7 +54,6 @@ function gainPkrs(){
lpkm.pokerus = (lpkm.pokerus < 2) ? 2 : 3;
document.querySelectorAll(`:scope #pkdx_${id.toString().replace('.','_')} img`)[2].src = getPokerusImgSrc(id, lpkm);
filterPkdx();
- loadEventHandlers();
}
function gainCurrency() {
@@ -195,7 +193,7 @@ function loadPkdx(){
}
pkdxBody.innerHTML = toAdd;
filterPkdx();
- loadEventHandlers();
+ pkdxLoadEventHandlers();
}
function loadQuestLines() {
@@ -232,7 +230,6 @@ function loadQuestLines() {
qlBody.innerHTML = toAdd;
filterQuestLine();
- loadEventHandlers();
}
function loadEventHandlers() {
@@ -309,19 +306,22 @@ function loadEventHandlers() {
document.getElementById("pkdxRegionFilter").addEventListener("change", filterPkdx);
document.getElementById("pkdxShinyFilter").addEventListener("change", filterPkdx);
document.getElementById("pkdxPKRSFilter").addEventListener("change", filterPkdx);
- for (const pokemon of pokemonList) {
- let pkElement = document.getElementById("pkdx_" + pokemon.id.toString().replace('.','_'));
- if (pkElement){
- pkElement.children[4].addEventListener("click", gainPk);
- pkElement.children[5].addEventListener("click", gainPkrs);
- }
- }
// questline
document.getElementById("questlines").children[1].addEventListener("click", loadQuestLines);
document.getElementById("questLineFilter").addEventListener("change", filterQuestLine);
}
+function pkdxLoadEventHandlers() {
+ for (const pokemon of pokemonList) {
+ let pkElement = document.getElementById("pkdx_" + pokemon.id.toString().replace('.','_'));
+ if (pkElement){
+ pkElement.children[4].addEventListener("click", gainPk);
+ pkElement.children[5].addEventListener("click", gainPkrs);
+ }
+ }
+}
+
function initSaveEditor() {
// Add menu item
let eventLi = document.createElement('li');
From 2b9f397d0d8f34994265a99843fb02af8e2840c3 Mon Sep 17 00:00:00 2001
From: iamc24 <42425100+iamc24@users.noreply.github.com>
Date: Wed, 30 Jul 2025 16:18:56 -0700
Subject: [PATCH 11/14] Update debugcheatstools.user.js
Slightly simplify more event handlers; Fix evolution item name capitalization; Capitalize held items tab name; Improve consistency between ids and comments for evolution/held items
---
custom/debugcheatstools.user.js | 1206 ++++++++++++++++---------------
1 file changed, 604 insertions(+), 602 deletions(-)
diff --git a/custom/debugcheatstools.user.js b/custom/debugcheatstools.user.js
index 5e798cc..809ce8d 100644
--- a/custom/debugcheatstools.user.js
+++ b/custom/debugcheatstools.user.js
@@ -24,292 +24,292 @@ const profileDrop = document.getElementById('startMenu').querySelectorAll('ul li
const profileModal = document.getElementById('profileModal');
function getPokerusImgSrc(id, pkm){
- let lpkm = pkm || App.game.party.getPokemon(id);
- return lpkm?.pokerus || 0 > 0 ? (lpkm.pokerus === 3 ? "assets/images/breeding/pokerus/Resistant.png" : "assets/images/breeding/pokerus/Contagious.png") : "assets/images/breeding/pokerus/Infected.png";
+ let lpkm = pkm || App.game.party.getPokemon(id);
+ return lpkm?.pokerus || 0 > 0 ? (lpkm.pokerus === 3 ? "assets/images/breeding/pokerus/Resistant.png" : "assets/images/breeding/pokerus/Contagious.png") : "assets/images/breeding/pokerus/Infected.png";
}
function getPokeballImgSrc(id, pkm){
- let lpkm = pkm || App.game.party.getPokemon(id);
- return lpkm ? ((lpkm?.shiny === true) ? "assets/images/pokeball/Pokeball-shiny.svg" : "assets/images/pokeball/Pokeball.svg") : "assets/images/pokeball/None.svg";
+ let lpkm = pkm || App.game.party.getPokemon(id);
+ return lpkm ? ((lpkm?.shiny === true) ? "assets/images/pokeball/Pokeball-shiny.svg" : "assets/images/pokeball/Pokeball.svg") : "assets/images/pokeball/None.svg";
}
// eslint-disable-next-line no-unused-vars
function gainPk(){
- let id = parseFloat(this.parentElement.children[0].innerHTML);
- let lpkm = App.game.party.getPokemon(id);
- if (!lpkm)
- App.game.party.gainPokemonById(id)
- else if (!(lpkm?.shiny === true))
- App.game.party.gainPokemonById(id, true);
- document.querySelectorAll(`:scope #pkdx_${id.toString().replace('.','_')} img`)[1].src = getPokeballImgSrc(id, lpkm);
- filterPkdx();
+ let id = parseFloat(this.parentElement.children[0].innerHTML);
+ let lpkm = App.game.party.getPokemon(id);
+ if (!lpkm)
+ App.game.party.gainPokemonById(id)
+ else if (!(lpkm?.shiny === true))
+ App.game.party.gainPokemonById(id, true);
+ document.querySelectorAll(`:scope #pkdx_${id.toString().replace('.','_')} img`)[1].src = getPokeballImgSrc(id, lpkm);
+ filterPkdx();
}
// eslint-disable-next-line no-unused-vars
function gainPkrs(){
- let id = parseFloat(this.parentElement.children[0].innerHTML);
- let lpkm = App.game.party.getPokemon(id);
- if (!lpkm) return;
- lpkm.effortPoints = ((lpkm.pokerus < 2) ? 1 : 50) * 1000; // strange
- lpkm.pokerus = (lpkm.pokerus < 2) ? 2 : 3;
- document.querySelectorAll(`:scope #pkdx_${id.toString().replace('.','_')} img`)[2].src = getPokerusImgSrc(id, lpkm);
- filterPkdx();
+ let id = parseFloat(this.parentElement.children[0].innerHTML);
+ let lpkm = App.game.party.getPokemon(id);
+ if (!lpkm) return;
+ lpkm.effortPoints = ((lpkm.pokerus < 2) ? 1 : 50) * 1000; // strange
+ lpkm.pokerus = (lpkm.pokerus < 2) ? 2 : 3;
+ document.querySelectorAll(`:scope #pkdx_${id.toString().replace('.','_')} img`)[2].src = getPokerusImgSrc(id, lpkm);
+ filterPkdx();
}
function gainCurrency() {
- let currency = parseInt(this.getAttribute("currency"));
- let changeAmount = parseInt(document.getElementById("inputAddCurrency").value || 0);
- if (changeAmount > 0) {
- App.game.wallet.addAmount(new Amount(changeAmount,currency),true);
- } else if (changeAmount < 0) {
- changeAmount = Math.abs(changeAmount);
- if (changeAmount > App.game.wallet.currencies[currency]()) {
- changeAmount = App.game.wallet.currencies[currency]();
- if (changeAmount == 0) {
- return;
- }
- }
- App.game.wallet.loseAmount(new Amount(changeAmount,currency));
- }
+ let currency = parseInt(this.getAttribute("currency"));
+ let changeAmount = parseInt(document.getElementById("inputAddCurrency").value || 0);
+ if (changeAmount > 0) {
+ App.game.wallet.addAmount(new Amount(changeAmount,currency),true);
+ } else if (changeAmount < 0) {
+ changeAmount = Math.abs(changeAmount);
+ if (changeAmount > App.game.wallet.currencies[currency]()) {
+ changeAmount = App.game.wallet.currencies[currency]();
+ if (changeAmount == 0) {
+ return;
+ }
+ }
+ App.game.wallet.loseAmount(new Amount(changeAmount,currency));
+ }
}
function filterPkdx(){
- let lst = document.querySelectorAll(':scope #pkdx tbody tr');
- for (let i = 0; i < lst.length; i++) {
- const tdb = lst[i];
- let display = true;
-
- if (document.getElementById('pkdxNameFilter').value !== ""){
- display = tdb.innerHTML.match(/
.*<\/td>/g)[3].toLowerCase().includes(document.getElementById('pkdxNameFilter').value.toLowerCase());
- }
-
- if (display === true) {
- switch (document.getElementById('pkdxRegionFilter').value) {
- case 'all':
- break;
- default:
- display = tdb.innerHTML.match(/ .*<\/td>/g)[1].toLowerCase().includes(document.getElementById('pkdxRegionFilter').value);
- break;
- }
- }
-
- if (display === true) {
- switch (document.getElementById('pkdxShinyFilter').value) {
- case 'uncaught':
- display = tdb.innerHTML.includes('None.svg');
- break;
- case 'caught':
- display = tdb.innerHTML.includes('Pokeball.svg') || tdb.innerHTML.includes('Pokeball-shiny.svg');
- break;
- case 'caught-not-shiny':
- display = tdb.innerHTML.includes('Pokeball.svg');
- break;
- case 'caught-shiny':
- display = tdb.innerHTML.includes('Pokeball-shiny.svg');
- break;
- default:
- break;
- }
- }
-
- if (display === true) {
- switch (document.getElementById('pkdxPKRSFilter').value) {
- case '0':
- display = tdb.innerHTML.includes('Infected.png');
- break;
- case '2':
- display = tdb.innerHTML.includes('Contagious.png');
- break;
- case '3':
- display = tdb.innerHTML.includes('Resistant.png');
- break;
- default:
- break;
- }
- }
-
- tdb.style.display = (display === true ? "" : "none");
- }
+ let lst = document.querySelectorAll(':scope #pkdx tbody tr');
+ for (let i = 0; i < lst.length; i++) {
+ const tdb = lst[i];
+ let display = true;
+
+ if (document.getElementById('pkdxNameFilter').value !== ""){
+ display = tdb.innerHTML.match(/ .*<\/td>/g)[3].toLowerCase().includes(document.getElementById('pkdxNameFilter').value.toLowerCase());
+ }
+
+ if (display === true) {
+ switch (document.getElementById('pkdxRegionFilter').value) {
+ case 'all':
+ break;
+ default:
+ display = tdb.innerHTML.match(/ .*<\/td>/g)[1].toLowerCase().includes(document.getElementById('pkdxRegionFilter').value);
+ break;
+ }
+ }
+
+ if (display === true) {
+ switch (document.getElementById('pkdxShinyFilter').value) {
+ case 'uncaught':
+ display = tdb.innerHTML.includes('None.svg');
+ break;
+ case 'caught':
+ display = tdb.innerHTML.includes('Pokeball.svg') || tdb.innerHTML.includes('Pokeball-shiny.svg');
+ break;
+ case 'caught-not-shiny':
+ display = tdb.innerHTML.includes('Pokeball.svg');
+ break;
+ case 'caught-shiny':
+ display = tdb.innerHTML.includes('Pokeball-shiny.svg');
+ break;
+ default:
+ break;
+ }
+ }
+
+ if (display === true) {
+ switch (document.getElementById('pkdxPKRSFilter').value) {
+ case '0':
+ display = tdb.innerHTML.includes('Infected.png');
+ break;
+ case '2':
+ display = tdb.innerHTML.includes('Contagious.png');
+ break;
+ case '3':
+ display = tdb.innerHTML.includes('Resistant.png');
+ break;
+ default:
+ break;
+ }
+ }
+
+ tdb.style.display = (display === true ? "" : "none");
+ }
}
function filterQuestLine(){
- let lst = document.querySelectorAll(':scope #questlinelist tbody tr');
- for (let i = 0; i < lst.length; i++) {
- const tdb = lst[i];
- let display = true;
-
- if (display === true) {
- switch (document.getElementById('questLineFilter').value) {
- case 'all':
- break;
- default:
- display = tdb.innerHTML.toLowerCase().includes(document.getElementById('questLineFilter').value);
- break;
- }
- }
-
- tdb.style.display = (display === true ? "" : "none");
- }
+ let lst = document.querySelectorAll(':scope #questlinelist tbody tr');
+ for (let i = 0; i < lst.length; i++) {
+ const tdb = lst[i];
+ let display = true;
+
+ if (display === true) {
+ switch (document.getElementById('questLineFilter').value) {
+ case 'all':
+ break;
+ default:
+ display = tdb.innerHTML.toLowerCase().includes(document.getElementById('questLineFilter').value);
+ break;
+ }
+ }
+
+ tdb.style.display = (display === true ? "" : "none");
+ }
}
// eslint-disable-next-line no-unused-vars
function loadPkdx(){
- let playerRegion = player.highestRegion();
- let pkdxBody = document.querySelector(':scope #pkdx tbody');
- pkdxBody.innerHTML = '';
- let toAdd = "";
- for (const pokemon of pokemonList) {
- if ((pokemon.nativeRegion <= playerRegion && pokemon.nativeRegion > -1) || (pokemon.nativeRegion == -1 && playerRegion >= GameConstants.Region.alola) || pokemon.id == 0) {
- let lpkm = App.game.party.getPokemon(pokemon.id);
- let region = GameConstants.Region[pokemon.nativeRegion].charAt(0).toUpperCase() + GameConstants.Region[pokemon.nativeRegion].slice(1);
- let hint = "";
- let getPokemonLocation = PokemonLocations.getPokemonLocations(pokemon.name, playerRegion);
- let roadLocations = getPokemonLocation[0]
- if (roadLocations) {
- for (let i = 0; i <= playerRegion; i++) {
- const reg = GameConstants.Region[i];
- let roads = "Route"
- roadLocations[i]?.forEach((route) => {
- roads += ` ${route.route},`
- });
- if (roads !== "Route")
- hint += `${hint !== "" ? `\n` : ""}${reg.charAt(0).toUpperCase() + reg.slice(1)}: ${roads.slice(0, -1)}`;
- }
- if (hint !== "")
- hint = ` title="${hint}"`;
- }
- toAdd += `
-
- ${pokemon.id}
- ${region}
-
- ${pokemon.name}
-
-
- YES') : '194, 46, 40);">NO'}
-
- `;
- }
- }
- pkdxBody.innerHTML = toAdd;
- filterPkdx();
- pkdxLoadEventHandlers();
+ let playerRegion = player.highestRegion();
+ let pkdxBody = document.querySelector(':scope #pkdx tbody');
+ pkdxBody.innerHTML = '';
+ let toAdd = "";
+ for (const pokemon of pokemonList) {
+ if ((pokemon.nativeRegion <= playerRegion && pokemon.nativeRegion > -1) || (pokemon.nativeRegion == -1 && playerRegion >= GameConstants.Region.alola) || pokemon.id == 0) {
+ let lpkm = App.game.party.getPokemon(pokemon.id);
+ let region = GameConstants.Region[pokemon.nativeRegion].charAt(0).toUpperCase() + GameConstants.Region[pokemon.nativeRegion].slice(1);
+ let hint = "";
+ let getPokemonLocation = PokemonLocations.getPokemonLocations(pokemon.name, playerRegion);
+ let roadLocations = getPokemonLocation[0]
+ if (roadLocations) {
+ for (let i = 0; i <= playerRegion; i++) {
+ const reg = GameConstants.Region[i];
+ let roads = "Route"
+ roadLocations[i]?.forEach((route) => {
+ roads += ` ${route.route},`
+ });
+ if (roads !== "Route")
+ hint += `${hint !== "" ? `\n` : ""}${reg.charAt(0).toUpperCase() + reg.slice(1)}: ${roads.slice(0, -1)}`;
+ }
+ if (hint !== "")
+ hint = ` title="${hint}"`;
+ }
+ toAdd += `
+
+ ${pokemon.id}
+ ${region}
+
+ ${pokemon.name}
+
+
+ YES') : '194, 46, 40);">NO'}
+
+ `;
+ }
+ }
+ pkdxBody.innerHTML = toAdd;
+ filterPkdx();
+ pkdxLoadEventHandlers();
}
function loadQuestLines() {
- let qlBody = document.querySelector(':scope #questlinelist tbody');
- qlBody.innerHTML = '';
- let toAdd = "";
-
- for (const ql of App.game.quests.questLines()) {
- let state = QuestLineState[ql.state()]
- state = state.charAt(0).toUpperCase() + state.slice(1)
-
- let stateColor;
- switch (ql.state()) {
- case 0:
- stateColor = "244, 80, 80";
- break;
- case 1:
- stateColor = "99, 144, 240";
- break;
- case 2:
- stateColor = "122, 199, 76";
- break;
- }
-
- toAdd += `
-
- ${ql.name}
- ${state}
-
- `;
- }
-
- // App.game.quests.questLines().filter(e => e.state() < 2).forEach(e => console.log(e.name, e.state()))
-
- qlBody.innerHTML = toAdd;
- filterQuestLine();
+ let qlBody = document.querySelector(':scope #questlinelist tbody');
+ qlBody.innerHTML = '';
+ let toAdd = "";
+
+ for (const ql of App.game.quests.questLines()) {
+ let state = QuestLineState[ql.state()]
+ state = state.charAt(0).toUpperCase() + state.slice(1)
+
+ let stateColor;
+ switch (ql.state()) {
+ case 0:
+ stateColor = "244, 80, 80";
+ break;
+ case 1:
+ stateColor = "99, 144, 240";
+ break;
+ case 2:
+ stateColor = "122, 199, 76";
+ break;
+ }
+
+ toAdd += `
+
+ ${ql.name}
+ ${state}
+
+ `;
+ }
+
+ // App.game.quests.questLines().filter(e => e.state() < 2).forEach(e => console.log(e.name, e.state()))
+
+ qlBody.innerHTML = toAdd;
+ filterQuestLine();
}
function loadEventHandlers() {
- // currency
- for (let i = 0; i < Object.keys(GameConstants.Currency).filter(isNaN).length; i++) {
- document.getElementById("currency_" + i).addEventListener("click", gainCurrency);
- }
-
- // gems
- for (let i = 0; i < Gems.nTypes; i++) {
- document.getElementById("gems_" + i).addEventListener("click", function () {
- App.game.gems.gainGems(parseInt(document.getElementById('inputAddGems').value || 0), i);
- });
- }
-
- // pokeballs
- for (let i = 0; i < Object.keys(GameConstants.Pokeball).filter(isNaN).length - 1; i++) {
- document.getElementById("pokeballs_" + i).addEventListener("click", function () {
- App.game.pokeballs.gainPokeballs(i, parseInt(document.getElementById('inputAddPokeballs').value || 0), true);
- });
- }
-
- // berries
- for (let i = 0; i < Object.keys(BerryType).filter(isNaN).length - 1; i++) {
- document.getElementById("berries_" + i).addEventListener("click", function () {
- App.game.farming.gainBerry(i, parseInt(document.getElementById('inputAddBerries').value || 0), true);
- });
- }
-
- // evolutionitems
- for (let i = 0; i < Object.keys(GameConstants.StoneType).filter(isNaN).length - 1; i++) {
- document.getElementById("evolutionitems_" + i).addEventListener("click", function () {
- player.gainItem(ItemList[this.getAttribute("item")].name, parseInt(document.getElementById('inputAddEvolutionItems').value || 0), true);
- });
- }
-
- // vitamins
- for (let i = 0; i < Object.keys(GameConstants.VitaminType).filter(isNaN).length; i++) {
- document.getElementById("vitamins_" + i).addEventListener("click", function () {
- player.gainItem(ItemList[this.getAttribute("vitamin")].name, parseInt(document.getElementById('inputAddVitamins').value || 0), true);
- });
- }
-
- // heldItems
- HeldItem.getSortedHeldItems().attack.items.forEach((itm, idx) => {
- document.getElementById("attackhelditems_" + idx).addEventListener("click", function () {
- HeldItem.getSortedHeldItems().attack.items[parseInt(this.getAttribute("item"))].gain(parseInt(document.getElementById('inputAddHeldItems').value || 0));
- });
- });
- HeldItem.getSortedHeldItems().typeRestricted.items.forEach((itm, idx) => {
- document.getElementById("typehelditems_" + idx).addEventListener("click", function () {
- HeldItem.getSortedHeldItems().typeRestricted.items[parseInt(this.getAttribute("item"))].gain(parseInt(document.getElementById('inputAddHeldItems').value || 0));
- });
- });
- HeldItem.getSortedHeldItems().ev.items.forEach((itm, idx) => {
- document.getElementById("evhelditems_" + idx).addEventListener("click", function () {
- HeldItem.getSortedHeldItems().ev.items[parseInt(this.getAttribute("item"))].gain(parseInt(document.getElementById('inputAddHeldItems').value || 0));
- });
- });
- HeldItem.getSortedHeldItems().exp.items.forEach((itm, idx) => {
- document.getElementById("exphelditems_" + idx).addEventListener("click", function () {
- HeldItem.getSortedHeldItems().exp.items[parseInt(this.getAttribute("item"))].gain(parseInt(document.getElementById('inputAddHeldItems').value || 0));
- });
- });
- HeldItem.getSortedHeldItems().other.items.forEach((itm, idx) => {
- document.getElementById("otherhelditems_" + idx).addEventListener("click", function () {
- HeldItem.getSortedHeldItems().other.items[parseInt(this.getAttribute("item"))].gain(parseInt(document.getElementById('inputAddHeldItems').value || 0));
- });
- });
-
- // pokedex
- document.getElementById("pokedex").children[1].addEventListener("click", loadPkdx);
- document.getElementById("pkdxNameFilter").addEventListener("input", filterPkdx);
- document.getElementById("pkdxRegionFilter").addEventListener("change", filterPkdx);
- document.getElementById("pkdxShinyFilter").addEventListener("change", filterPkdx);
- document.getElementById("pkdxPKRSFilter").addEventListener("change", filterPkdx);
-
- // questline
- document.getElementById("questlines").children[1].addEventListener("click", loadQuestLines);
- document.getElementById("questLineFilter").addEventListener("change", filterQuestLine);
+ // currency
+ for (let i = 0; i < Object.keys(GameConstants.Currency).filter(isNaN).length; i++) {
+ document.getElementById("currency_" + i).addEventListener("click", gainCurrency);
+ }
+
+ // gems
+ for (let i = 0; i < Gems.nTypes; i++) {
+ document.getElementById("gems_" + i).addEventListener("click", function () {
+ App.game.gems.gainGems(parseInt(document.getElementById('inputAddGems').value || 0), i);
+ });
+ }
+
+ // pokeballs
+ for (let i = 0; i < Object.keys(GameConstants.Pokeball).filter(isNaN).length - 1; i++) {
+ document.getElementById("pokeballs_" + i).addEventListener("click", function () {
+ App.game.pokeballs.gainPokeballs(i, parseInt(document.getElementById('inputAddPokeballs').value || 0), true);
+ });
+ }
+
+ // berries
+ for (let i = 0; i < Object.keys(BerryType).filter(isNaN).length - 1; i++) {
+ document.getElementById("berries_" + i).addEventListener("click", function () {
+ App.game.farming.gainBerry(i, parseInt(document.getElementById('inputAddBerries').value || 0), true);
+ });
+ }
+
+ // evolution items
+ for (let i = 0; i < Object.keys(GameConstants.StoneType).filter(isNaN).length - 1; i++) {
+ document.getElementById("evolutionitems_" + i).addEventListener("click", function () {
+ player.gainItem(this.getAttribute("item"), parseInt(document.getElementById('inputAddEvolutionItems').value || 0), true);
+ });
+ }
+
+ // vitamins
+ for (let i = 0; i < Object.keys(GameConstants.VitaminType).filter(isNaN).length; i++) {
+ document.getElementById("vitamins_" + i).addEventListener("click", function () {
+ player.gainItem(this.getAttribute("vitamin"), parseInt(document.getElementById('inputAddVitamins').value || 0), true);
+ });
+ }
+
+ // held items
+ HeldItem.getSortedHeldItems().attack.items.forEach((itm, idx) => {
+ document.getElementById("attackhelditems_" + idx).addEventListener("click", function () {
+ HeldItem.getSortedHeldItems().attack.items[idk].gain(parseInt(document.getElementById('inputAddHeldItems').value || 0));
+ });
+ });
+ HeldItem.getSortedHeldItems().typeRestricted.items.forEach((itm, idx) => {
+ document.getElementById("typehelditems_" + idx).addEventListener("click", function () {
+ HeldItem.getSortedHeldItems().typeRestricted.items[idx].gain(parseInt(document.getElementById('inputAddHeldItems').value || 0));
+ });
+ });
+ HeldItem.getSortedHeldItems().ev.items.forEach((itm, idx) => {
+ document.getElementById("evhelditems_" + idx).addEventListener("click", function () {
+ HeldItem.getSortedHeldItems().ev.items[idx].gain(parseInt(document.getElementById('inputAddHeldItems').value || 0));
+ });
+ });
+ HeldItem.getSortedHeldItems().exp.items.forEach((itm, idx) => {
+ document.getElementById("exphelditems_" + idx).addEventListener("click", function () {
+ HeldItem.getSortedHeldItems().exp.items[idx].gain(parseInt(document.getElementById('inputAddHeldItems').value || 0));
+ });
+ });
+ HeldItem.getSortedHeldItems().other.items.forEach((itm, idx) => {
+ document.getElementById("otherhelditems_" + idx).addEventListener("click", function () {
+ HeldItem.getSortedHeldItems().other.items[idx].gain(parseInt(document.getElementById('inputAddHeldItems').value || 0));
+ });
+ });
+
+ // pokedex
+ document.getElementById("pokedex").children[1].addEventListener("click", loadPkdx);
+ document.getElementById("pkdxNameFilter").addEventListener("input", filterPkdx);
+ document.getElementById("pkdxRegionFilter").addEventListener("change", filterPkdx);
+ document.getElementById("pkdxShinyFilter").addEventListener("change", filterPkdx);
+ document.getElementById("pkdxPKRSFilter").addEventListener("change", filterPkdx);
+
+ // questline
+ document.getElementById("questlines").children[1].addEventListener("click", loadQuestLines);
+ document.getElementById("questLineFilter").addEventListener("change", filterQuestLine);
}
function pkdxLoadEventHandlers() {
@@ -323,293 +323,295 @@ function pkdxLoadEventHandlers() {
}
function initSaveEditor() {
- // Add menu item
- let eventLi = document.createElement('li');
- eventLi.innerHTML = `
Debug Cheats `
- profileDrop.before(eventLi);
-
- // Add popup
- let eventMod = document.createElement('div');
- eventMod.setAttribute("class", "modal noselect fade show");
- eventMod.setAttribute("id", "saveEditorModal");
- eventMod.setAttribute("tabindex", "-1");
- eventMod.setAttribute("aria-labelledby", "saveEditorModal");
- eventMod.setAttribute("aria-modal", "true");
- eventMod.setAttribute("role", "dialog");
-
- eventMod.innerHTML = `
-
- `;
-
- profileModal.before(eventMod);
-
- let modalBody = document.querySelector('[id=saveEditorModal] div div [class=modal-body]');
-
- // currency
- for (let i = 0; i < Object.keys(GameConstants.Currency).filter(isNaN).length; i++) {
- const itm = GameConstants.Currency[i];
- const itmPretty = itm.charAt(0).toUpperCase() + itm.replace(/[A-Z]/g, ' $&').trim().slice(1);
- modalBody.querySelector('#currency').innerHTML += `
-
-
-
${itmPretty}
-
- `;
- }
-
- // gems
- for (let i = 0; i < Gems.nTypes; i++) {
- const itm = PokemonType[i];
- modalBody.querySelector('#gems').innerHTML += `
-
-
-
${itm}
-
- `;
- }
-
- // pokeballs
- for (let i = 0; i < Object.keys(GameConstants.Pokeball).filter(isNaN).length - 1; i++) {
- const itm = GameConstants.Pokeball[i];
- modalBody.querySelector('#pokeballs').innerHTML += `
-
-
-
${itm}
-
- `;
- }
-
- // berries
- for (let i = 0; i < Object.keys(BerryType).filter(isNaN).length - 1; i++) {
- const itm = BerryType[i];
- modalBody.querySelector('#berries').innerHTML += `
-
-
-
${itm}
-
- `;
- }
-
- // evolutionitems
- for (let i = 0; i < Object.keys(GameConstants.StoneType).filter(isNaN).length - 1; i++) {
- const itm = GameConstants.StoneType[i];
- const itmPretty = itm.replaceAll('_', ' ');
- modalBody.querySelector('#evolutionitems').innerHTML += `
-
-
-
${itmPretty}
-
- `;
- }
-
- // vitamins
- for (let i = 0; i < Object.keys(GameConstants.VitaminType).filter(isNaN).length; i++) {
- const itm = GameConstants.VitaminType[i];
- modalBody.querySelector('#vitamins').innerHTML += `
-
-
-
${itm}
-
- `;
- }
-
- // heldItems
- HeldItem.getSortedHeldItems().attack.items.forEach((itm, idx) => {
- const itmPretty = itm.name.replaceAll('_', ' ');
- modalBody.querySelector('#heldItems').innerHTML += `
-
-
-
${itmPretty}
-
- `;
- });
- HeldItem.getSortedHeldItems().typeRestricted.items.forEach((itm, idx) => {
- const itmPretty = itm.name.replaceAll('_', ' ');
- modalBody.querySelector('#heldItems').innerHTML += `
-
-
-
${itmPretty}
-
- `;
- });
- HeldItem.getSortedHeldItems().ev.items.forEach((itm, idx) => {
- const itmPretty = itm.name.replaceAll('_', ' ');
- modalBody.querySelector('#heldItems').innerHTML += `
-
-
-
${itmPretty}
-
- `;
- });
- HeldItem.getSortedHeldItems().exp.items.forEach((itm, idx) => {
- const itmPretty = itm.name.replaceAll('_', ' ');
- modalBody.querySelector('#heldItems').innerHTML += `
-
-
-
${itmPretty}
-
- `;
- });
- HeldItem.getSortedHeldItems().other.items.forEach((itm, idx) => {
- const itmPretty = itm.name.replaceAll('_', ' ');
- modalBody.querySelector('#heldItems').innerHTML += `
-
-
-
${itmPretty}
-
- `;
- });
-
- // pokedex
- const pkdxRegFilt = modalBody.querySelector('#pkdxRegionFilter');
- for (let i = 0; i <= player.highestRegion(); i++) {
- const reg = GameConstants.Region[i]
- pkdxRegFilt.innerHTML += `
${reg.charAt(0).toUpperCase() + reg.slice(1)} `;
- }
- pkdxRegFilt.innerHTML += '
None ';
-
-
- loadEventHandlers();
+ // Add menu item
+ let eventLi = document.createElement('li');
+ eventLi.innerHTML = `
Debug Cheats `
+ profileDrop.before(eventLi);
+
+ // Add popup
+ let eventMod = document.createElement('div');
+ eventMod.setAttribute("class", "modal noselect fade show");
+ eventMod.setAttribute("id", "saveEditorModal");
+ eventMod.setAttribute("tabindex", "-1");
+ eventMod.setAttribute("aria-labelledby", "saveEditorModal");
+ eventMod.setAttribute("aria-modal", "true");
+ eventMod.setAttribute("role", "dialog");
+
+ eventMod.innerHTML = `
+
+ `;
+
+ profileModal.before(eventMod);
+
+ let modalBody = document.querySelector('[id=saveEditorModal] div div [class=modal-body]');
+
+ // currency
+ for (let i = 0; i < Object.keys(GameConstants.Currency).filter(isNaN).length; i++) {
+ const itm = GameConstants.Currency[i];
+ const itmPretty = itm.charAt(0).toUpperCase() + itm.replace(/[A-Z]/g, ' $&').trim().slice(1);
+ modalBody.querySelector('#currency').innerHTML += `
+
+
+
${itmPretty}
+
+ `;
+ }
+
+ // gems
+ for (let i = 0; i < Gems.nTypes; i++) {
+ const itm = PokemonType[i];
+ modalBody.querySelector('#gems').innerHTML += `
+
+
+
${itm}
+
+ `;
+ }
+
+ // pokeballs
+ for (let i = 0; i < Object.keys(GameConstants.Pokeball).filter(isNaN).length - 1; i++) {
+ const itm = GameConstants.Pokeball[i];
+ modalBody.querySelector('#pokeballs').innerHTML += `
+
+
+
${itm}
+
+ `;
+ }
+
+ // berries
+ for (let i = 0; i < Object.keys(BerryType).filter(isNaN).length - 1; i++) {
+ const itm = BerryType[i];
+ modalBody.querySelector('#berries').innerHTML += `
+
+
+
${itm}
+
+ `;
+ }
+
+ // evolution items
+ for (let i = 0; i < Object.keys(GameConstants.StoneType).filter(isNaN).length - 1; i++) {
+ const itm = GameConstants.StoneType[i];
+ const itmPretty = itm.replaceAll('_', ' ').replace(/\b\w/g, function(char) {
+ return char.toUpperCase();
+ });
+ modalBody.querySelector('#evolutionItems').innerHTML += `
+
+
+
${itmPretty}
+
+ `;
+ }
+
+ // vitamins
+ for (let i = 0; i < Object.keys(GameConstants.VitaminType).filter(isNaN).length; i++) {
+ const itm = GameConstants.VitaminType[i];
+ modalBody.querySelector('#vitamins').innerHTML += `
+
+
+
${itm}
+
+ `;
+ }
+
+ // held items
+ HeldItem.getSortedHeldItems().attack.items.forEach((itm, idx) => {
+ const itmPretty = itm.name.replaceAll('_', ' ');
+ modalBody.querySelector('#heldItems').innerHTML += `
+
+
+
${itmPretty}
+
+ `;
+ });
+ HeldItem.getSortedHeldItems().typeRestricted.items.forEach((itm, idx) => {
+ const itmPretty = itm.name.replaceAll('_', ' ');
+ modalBody.querySelector('#heldItems').innerHTML += `
+
+
+
${itmPretty}
+
+ `;
+ });
+ HeldItem.getSortedHeldItems().ev.items.forEach((itm, idx) => {
+ const itmPretty = itm.name.replaceAll('_', ' ');
+ modalBody.querySelector('#heldItems').innerHTML += `
+
+
+
${itmPretty}
+
+ `;
+ });
+ HeldItem.getSortedHeldItems().exp.items.forEach((itm, idx) => {
+ const itmPretty = itm.name.replaceAll('_', ' ');
+ modalBody.querySelector('#heldItems').innerHTML += `
+
+
+
${itmPretty}
+
+ `;
+ });
+ HeldItem.getSortedHeldItems().other.items.forEach((itm, idx) => {
+ const itmPretty = itm.name.replaceAll('_', ' ');
+ modalBody.querySelector('#heldItems').innerHTML += `
+
+
+
${itmPretty}
+
+ `;
+ });
+
+ // pokedex
+ const pkdxRegFilt = modalBody.querySelector('#pkdxRegionFilter');
+ for (let i = 0; i <= player.highestRegion(); i++) {
+ const reg = GameConstants.Region[i]
+ pkdxRegFilt.innerHTML += `
${reg.charAt(0).toUpperCase() + reg.slice(1)} `;
+ }
+ pkdxRegFilt.innerHTML += '
None ';
+
+
+ loadEventHandlers();
}
/* WIP, sevii helper
var lst = pokemonList.filter((p) => p.name.includes('Pinkan')
- || p.name.includes('Valencian')
- || p.name === 'Crystal Onix'
- || p.name === 'Ash\'s Butterfree'
- || p.name === 'Pink Butterfree');
+ || p.name.includes('Valencian')
+ || p.name === 'Crystal Onix'
+ || p.name === 'Ash\'s Butterfree'
+ || p.name === 'Pink Butterfree');
var caught = App.game.party.caughtPokemon
- .filter((p) => p.name.includes('Pinkan')
- || p.name.includes('Valencian')
- || p.name === 'Crystal Onix'
- || p.name === 'Ash\'s Butterfree'
- || p.name === 'Pink Butterfree');
+ .filter((p) => p.name.includes('Pinkan')
+ || p.name.includes('Valencian')
+ || p.name === 'Crystal Onix'
+ || p.name === 'Ash\'s Butterfree'
+ || p.name === 'Pink Butterfree');
var caughtNames = caught.map(e => e.name);
var missing = lst.filter(e => !caughtNames.includes(e.name));
@@ -618,71 +620,71 @@ console.log(missing);
*/
function loadEpheniaScript(scriptName, initFunction, priorityFunction) {
- function reportScriptError(scriptName, error) {
- console.error(`Error while initializing '${scriptName}' userscript:\n${error}`);
- Notifier.notify({
- type: NotificationConstants.NotificationOption.warning,
- title: scriptName,
- message: `The '${scriptName}' userscript crashed while loading. Check for updates or disable the script, then restart the game.\n\nReport script issues to the script developer, not to the Pokéclicker team.`,
- timeout: GameConstants.DAY,
- });
- }
- const windowObject = !App.isUsingClient ? unsafeWindow : window;
- // Inject handlers if they don't exist yet
- if (windowObject.epheniaScriptInitializers === undefined) {
- windowObject.epheniaScriptInitializers = {};
- const oldInit = Preload.hideSplashScreen;
- var hasInitialized = false;
-
- // Initializes scripts once enough of the game has loaded
- Preload.hideSplashScreen = function (...args) {
- var result = oldInit.apply(this, args);
- if (App.game && !hasInitialized) {
- // Initialize all attached userscripts
- Object.entries(windowObject.epheniaScriptInitializers).forEach(([scriptName, initFunction]) => {
- try {
- initFunction();
- } catch (e) {
- reportScriptError(scriptName, e);
- }
- });
- hasInitialized = true;
- }
- return result;
- }
- }
-
- // Prevent issues with duplicate script names
- if (windowObject.epheniaScriptInitializers[scriptName] !== undefined) {
- console.warn(`Duplicate '${scriptName}' userscripts found!`);
- Notifier.notify({
- type: NotificationConstants.NotificationOption.warning,
- title: scriptName,
- message: `Duplicate '${scriptName}' userscripts detected. This could cause unpredictable behavior and is not recommended.`,
- timeout: GameConstants.DAY,
- });
- let number = 2;
- while (windowObject.epheniaScriptInitializers[`${scriptName} ${number}`] !== undefined) {
- number++;
- }
- scriptName = `${scriptName} ${number}`;
- }
- // Add initializer for this particular script
- windowObject.epheniaScriptInitializers[scriptName] = initFunction;
- // Run any functions that need to execute before the game starts
- if (priorityFunction) {
- $(document).ready(() => {
- try {
- priorityFunction();
- } catch (e) {
- reportScriptError(scriptName, e);
- // Remove main initialization function
- windowObject.epheniaScriptInitializers[scriptName] = () => null;
- }
- });
- }
+ function reportScriptError(scriptName, error) {
+ console.error(`Error while initializing '${scriptName}' userscript:\n${error}`);
+ Notifier.notify({
+ type: NotificationConstants.NotificationOption.warning,
+ title: scriptName,
+ message: `The '${scriptName}' userscript crashed while loading. Check for updates or disable the script, then restart the game.\n\nReport script issues to the script developer, not to the Pokéclicker team.`,
+ timeout: GameConstants.DAY,
+ });
+ }
+ const windowObject = !App.isUsingClient ? unsafeWindow : window;
+ // Inject handlers if they don't exist yet
+ if (windowObject.epheniaScriptInitializers === undefined) {
+ windowObject.epheniaScriptInitializers = {};
+ const oldInit = Preload.hideSplashScreen;
+ var hasInitialized = false;
+
+ // Initializes scripts once enough of the game has loaded
+ Preload.hideSplashScreen = function (...args) {
+ var result = oldInit.apply(this, args);
+ if (App.game && !hasInitialized) {
+ // Initialize all attached userscripts
+ Object.entries(windowObject.epheniaScriptInitializers).forEach(([scriptName, initFunction]) => {
+ try {
+ initFunction();
+ } catch (e) {
+ reportScriptError(scriptName, e);
+ }
+ });
+ hasInitialized = true;
+ }
+ return result;
+ }
+ }
+
+ // Prevent issues with duplicate script names
+ if (windowObject.epheniaScriptInitializers[scriptName] !== undefined) {
+ console.warn(`Duplicate '${scriptName}' userscripts found!`);
+ Notifier.notify({
+ type: NotificationConstants.NotificationOption.warning,
+ title: scriptName,
+ message: `Duplicate '${scriptName}' userscripts detected. This could cause unpredictable behavior and is not recommended.`,
+ timeout: GameConstants.DAY,
+ });
+ let number = 2;
+ while (windowObject.epheniaScriptInitializers[`${scriptName} ${number}`] !== undefined) {
+ number++;
+ }
+ scriptName = `${scriptName} ${number}`;
+ }
+ // Add initializer for this particular script
+ windowObject.epheniaScriptInitializers[scriptName] = initFunction;
+ // Run any functions that need to execute before the game starts
+ if (priorityFunction) {
+ $(document).ready(() => {
+ try {
+ priorityFunction();
+ } catch (e) {
+ reportScriptError(scriptName, e);
+ // Remove main initialization function
+ windowObject.epheniaScriptInitializers[scriptName] = () => null;
+ }
+ });
+ }
}
if (!App.isUsingClient || localStorage.getItem('debugcheatstools') === 'true') {
- loadEpheniaScript('debugcheatstools', initSaveEditor);
+ loadEpheniaScript('debugcheatstools', initSaveEditor);
}
From 3a983e6fbe7dc388f997bebc911e3a8cec2d1877 Mon Sep 17 00:00:00 2001
From: iamc24 <42425100+iamc24@users.noreply.github.com>
Date: Wed, 30 Jul 2025 16:20:38 -0700
Subject: [PATCH 12/14] Update debugcheatstools.user.js
Fix indentation
---
custom/debugcheatstools.user.js | 1222 +++++++++++++++----------------
1 file changed, 611 insertions(+), 611 deletions(-)
diff --git a/custom/debugcheatstools.user.js b/custom/debugcheatstools.user.js
index 809ce8d..602b5bb 100644
--- a/custom/debugcheatstools.user.js
+++ b/custom/debugcheatstools.user.js
@@ -24,594 +24,594 @@ const profileDrop = document.getElementById('startMenu').querySelectorAll('ul li
const profileModal = document.getElementById('profileModal');
function getPokerusImgSrc(id, pkm){
- let lpkm = pkm || App.game.party.getPokemon(id);
- return lpkm?.pokerus || 0 > 0 ? (lpkm.pokerus === 3 ? "assets/images/breeding/pokerus/Resistant.png" : "assets/images/breeding/pokerus/Contagious.png") : "assets/images/breeding/pokerus/Infected.png";
+ let lpkm = pkm || App.game.party.getPokemon(id);
+ return lpkm?.pokerus || 0 > 0 ? (lpkm.pokerus === 3 ? "assets/images/breeding/pokerus/Resistant.png" : "assets/images/breeding/pokerus/Contagious.png") : "assets/images/breeding/pokerus/Infected.png";
}
function getPokeballImgSrc(id, pkm){
- let lpkm = pkm || App.game.party.getPokemon(id);
- return lpkm ? ((lpkm?.shiny === true) ? "assets/images/pokeball/Pokeball-shiny.svg" : "assets/images/pokeball/Pokeball.svg") : "assets/images/pokeball/None.svg";
+ let lpkm = pkm || App.game.party.getPokemon(id);
+ return lpkm ? ((lpkm?.shiny === true) ? "assets/images/pokeball/Pokeball-shiny.svg" : "assets/images/pokeball/Pokeball.svg") : "assets/images/pokeball/None.svg";
}
// eslint-disable-next-line no-unused-vars
function gainPk(){
- let id = parseFloat(this.parentElement.children[0].innerHTML);
- let lpkm = App.game.party.getPokemon(id);
- if (!lpkm)
- App.game.party.gainPokemonById(id)
- else if (!(lpkm?.shiny === true))
- App.game.party.gainPokemonById(id, true);
- document.querySelectorAll(`:scope #pkdx_${id.toString().replace('.','_')} img`)[1].src = getPokeballImgSrc(id, lpkm);
- filterPkdx();
+ let id = parseFloat(this.parentElement.children[0].innerHTML);
+ let lpkm = App.game.party.getPokemon(id);
+ if (!lpkm)
+ App.game.party.gainPokemonById(id)
+ else if (!(lpkm?.shiny === true))
+ App.game.party.gainPokemonById(id, true);
+ document.querySelectorAll(`:scope #pkdx_${id.toString().replace('.','_')} img`)[1].src = getPokeballImgSrc(id, lpkm);
+ filterPkdx();
}
// eslint-disable-next-line no-unused-vars
function gainPkrs(){
- let id = parseFloat(this.parentElement.children[0].innerHTML);
- let lpkm = App.game.party.getPokemon(id);
- if (!lpkm) return;
- lpkm.effortPoints = ((lpkm.pokerus < 2) ? 1 : 50) * 1000; // strange
- lpkm.pokerus = (lpkm.pokerus < 2) ? 2 : 3;
- document.querySelectorAll(`:scope #pkdx_${id.toString().replace('.','_')} img`)[2].src = getPokerusImgSrc(id, lpkm);
- filterPkdx();
+ let id = parseFloat(this.parentElement.children[0].innerHTML);
+ let lpkm = App.game.party.getPokemon(id);
+ if (!lpkm) return;
+ lpkm.effortPoints = ((lpkm.pokerus < 2) ? 1 : 50) * 1000; // strange
+ lpkm.pokerus = (lpkm.pokerus < 2) ? 2 : 3;
+ document.querySelectorAll(`:scope #pkdx_${id.toString().replace('.','_')} img`)[2].src = getPokerusImgSrc(id, lpkm);
+ filterPkdx();
}
function gainCurrency() {
- let currency = parseInt(this.getAttribute("currency"));
- let changeAmount = parseInt(document.getElementById("inputAddCurrency").value || 0);
- if (changeAmount > 0) {
- App.game.wallet.addAmount(new Amount(changeAmount,currency),true);
- } else if (changeAmount < 0) {
- changeAmount = Math.abs(changeAmount);
- if (changeAmount > App.game.wallet.currencies[currency]()) {
- changeAmount = App.game.wallet.currencies[currency]();
- if (changeAmount == 0) {
- return;
- }
- }
- App.game.wallet.loseAmount(new Amount(changeAmount,currency));
- }
+ let currency = parseInt(this.getAttribute("currency"));
+ let changeAmount = parseInt(document.getElementById("inputAddCurrency").value || 0);
+ if (changeAmount > 0) {
+ App.game.wallet.addAmount(new Amount(changeAmount,currency),true);
+ } else if (changeAmount < 0) {
+ changeAmount = Math.abs(changeAmount);
+ if (changeAmount > App.game.wallet.currencies[currency]()) {
+ changeAmount = App.game.wallet.currencies[currency]();
+ if (changeAmount == 0) {
+ return;
+ }
+ }
+ App.game.wallet.loseAmount(new Amount(changeAmount,currency));
+ }
}
function filterPkdx(){
- let lst = document.querySelectorAll(':scope #pkdx tbody tr');
- for (let i = 0; i < lst.length; i++) {
- const tdb = lst[i];
- let display = true;
-
- if (document.getElementById('pkdxNameFilter').value !== ""){
- display = tdb.innerHTML.match(/
.*<\/td>/g)[3].toLowerCase().includes(document.getElementById('pkdxNameFilter').value.toLowerCase());
- }
-
- if (display === true) {
- switch (document.getElementById('pkdxRegionFilter').value) {
- case 'all':
- break;
- default:
- display = tdb.innerHTML.match(/ .*<\/td>/g)[1].toLowerCase().includes(document.getElementById('pkdxRegionFilter').value);
- break;
- }
- }
-
- if (display === true) {
- switch (document.getElementById('pkdxShinyFilter').value) {
- case 'uncaught':
- display = tdb.innerHTML.includes('None.svg');
- break;
- case 'caught':
- display = tdb.innerHTML.includes('Pokeball.svg') || tdb.innerHTML.includes('Pokeball-shiny.svg');
- break;
- case 'caught-not-shiny':
- display = tdb.innerHTML.includes('Pokeball.svg');
- break;
- case 'caught-shiny':
- display = tdb.innerHTML.includes('Pokeball-shiny.svg');
- break;
- default:
- break;
- }
- }
-
- if (display === true) {
- switch (document.getElementById('pkdxPKRSFilter').value) {
- case '0':
- display = tdb.innerHTML.includes('Infected.png');
- break;
- case '2':
- display = tdb.innerHTML.includes('Contagious.png');
- break;
- case '3':
- display = tdb.innerHTML.includes('Resistant.png');
- break;
- default:
- break;
- }
- }
-
- tdb.style.display = (display === true ? "" : "none");
- }
+ let lst = document.querySelectorAll(':scope #pkdx tbody tr');
+ for (let i = 0; i < lst.length; i++) {
+ const tdb = lst[i];
+ let display = true;
+
+ if (document.getElementById('pkdxNameFilter').value !== ""){
+ display = tdb.innerHTML.match(/ .*<\/td>/g)[3].toLowerCase().includes(document.getElementById('pkdxNameFilter').value.toLowerCase());
+ }
+
+ if (display === true) {
+ switch (document.getElementById('pkdxRegionFilter').value) {
+ case 'all':
+ break;
+ default:
+ display = tdb.innerHTML.match(/ .*<\/td>/g)[1].toLowerCase().includes(document.getElementById('pkdxRegionFilter').value);
+ break;
+ }
+ }
+
+ if (display === true) {
+ switch (document.getElementById('pkdxShinyFilter').value) {
+ case 'uncaught':
+ display = tdb.innerHTML.includes('None.svg');
+ break;
+ case 'caught':
+ display = tdb.innerHTML.includes('Pokeball.svg') || tdb.innerHTML.includes('Pokeball-shiny.svg');
+ break;
+ case 'caught-not-shiny':
+ display = tdb.innerHTML.includes('Pokeball.svg');
+ break;
+ case 'caught-shiny':
+ display = tdb.innerHTML.includes('Pokeball-shiny.svg');
+ break;
+ default:
+ break;
+ }
+ }
+
+ if (display === true) {
+ switch (document.getElementById('pkdxPKRSFilter').value) {
+ case '0':
+ display = tdb.innerHTML.includes('Infected.png');
+ break;
+ case '2':
+ display = tdb.innerHTML.includes('Contagious.png');
+ break;
+ case '3':
+ display = tdb.innerHTML.includes('Resistant.png');
+ break;
+ default:
+ break;
+ }
+ }
+
+ tdb.style.display = (display === true ? "" : "none");
+ }
}
function filterQuestLine(){
- let lst = document.querySelectorAll(':scope #questlinelist tbody tr');
- for (let i = 0; i < lst.length; i++) {
- const tdb = lst[i];
- let display = true;
-
- if (display === true) {
- switch (document.getElementById('questLineFilter').value) {
- case 'all':
- break;
- default:
- display = tdb.innerHTML.toLowerCase().includes(document.getElementById('questLineFilter').value);
- break;
- }
- }
-
- tdb.style.display = (display === true ? "" : "none");
- }
+ let lst = document.querySelectorAll(':scope #questlinelist tbody tr');
+ for (let i = 0; i < lst.length; i++) {
+ const tdb = lst[i];
+ let display = true;
+
+ if (display === true) {
+ switch (document.getElementById('questLineFilter').value) {
+ case 'all':
+ break;
+ default:
+ display = tdb.innerHTML.toLowerCase().includes(document.getElementById('questLineFilter').value);
+ break;
+ }
+ }
+
+ tdb.style.display = (display === true ? "" : "none");
+ }
}
// eslint-disable-next-line no-unused-vars
function loadPkdx(){
- let playerRegion = player.highestRegion();
- let pkdxBody = document.querySelector(':scope #pkdx tbody');
- pkdxBody.innerHTML = '';
- let toAdd = "";
- for (const pokemon of pokemonList) {
- if ((pokemon.nativeRegion <= playerRegion && pokemon.nativeRegion > -1) || (pokemon.nativeRegion == -1 && playerRegion >= GameConstants.Region.alola) || pokemon.id == 0) {
- let lpkm = App.game.party.getPokemon(pokemon.id);
- let region = GameConstants.Region[pokemon.nativeRegion].charAt(0).toUpperCase() + GameConstants.Region[pokemon.nativeRegion].slice(1);
- let hint = "";
- let getPokemonLocation = PokemonLocations.getPokemonLocations(pokemon.name, playerRegion);
- let roadLocations = getPokemonLocation[0]
- if (roadLocations) {
- for (let i = 0; i <= playerRegion; i++) {
- const reg = GameConstants.Region[i];
- let roads = "Route"
- roadLocations[i]?.forEach((route) => {
- roads += ` ${route.route},`
- });
- if (roads !== "Route")
- hint += `${hint !== "" ? `\n` : ""}${reg.charAt(0).toUpperCase() + reg.slice(1)}: ${roads.slice(0, -1)}`;
- }
- if (hint !== "")
- hint = ` title="${hint}"`;
- }
- toAdd += `
-
- ${pokemon.id}
- ${region}
-
- ${pokemon.name}
-
-
- YES') : '194, 46, 40);">NO'}
-
- `;
- }
- }
- pkdxBody.innerHTML = toAdd;
- filterPkdx();
- pkdxLoadEventHandlers();
+ let playerRegion = player.highestRegion();
+ let pkdxBody = document.querySelector(':scope #pkdx tbody');
+ pkdxBody.innerHTML = '';
+ let toAdd = "";
+ for (const pokemon of pokemonList) {
+ if ((pokemon.nativeRegion <= playerRegion && pokemon.nativeRegion > -1) || (pokemon.nativeRegion == -1 && playerRegion >= GameConstants.Region.alola) || pokemon.id == 0) {
+ let lpkm = App.game.party.getPokemon(pokemon.id);
+ let region = GameConstants.Region[pokemon.nativeRegion].charAt(0).toUpperCase() + GameConstants.Region[pokemon.nativeRegion].slice(1);
+ let hint = "";
+ let getPokemonLocation = PokemonLocations.getPokemonLocations(pokemon.name, playerRegion);
+ let roadLocations = getPokemonLocation[0]
+ if (roadLocations) {
+ for (let i = 0; i <= playerRegion; i++) {
+ const reg = GameConstants.Region[i];
+ let roads = "Route"
+ roadLocations[i]?.forEach((route) => {
+ roads += ` ${route.route},`
+ });
+ if (roads !== "Route")
+ hint += `${hint !== "" ? `\n` : ""}${reg.charAt(0).toUpperCase() + reg.slice(1)}: ${roads.slice(0, -1)}`;
+ }
+ if (hint !== "")
+ hint = ` title="${hint}"`;
+ }
+ toAdd += `
+
+ ${pokemon.id}
+ ${region}
+
+ ${pokemon.name}
+
+
+ YES') : '194, 46, 40);">NO'}
+
+ `;
+ }
+ }
+ pkdxBody.innerHTML = toAdd;
+ filterPkdx();
+ pkdxLoadEventHandlers();
}
function loadQuestLines() {
- let qlBody = document.querySelector(':scope #questlinelist tbody');
- qlBody.innerHTML = '';
- let toAdd = "";
-
- for (const ql of App.game.quests.questLines()) {
- let state = QuestLineState[ql.state()]
- state = state.charAt(0).toUpperCase() + state.slice(1)
-
- let stateColor;
- switch (ql.state()) {
- case 0:
- stateColor = "244, 80, 80";
- break;
- case 1:
- stateColor = "99, 144, 240";
- break;
- case 2:
- stateColor = "122, 199, 76";
- break;
- }
-
- toAdd += `
-
- ${ql.name}
- ${state}
-
- `;
- }
-
- // App.game.quests.questLines().filter(e => e.state() < 2).forEach(e => console.log(e.name, e.state()))
-
- qlBody.innerHTML = toAdd;
- filterQuestLine();
+ let qlBody = document.querySelector(':scope #questlinelist tbody');
+ qlBody.innerHTML = '';
+ let toAdd = "";
+
+ for (const ql of App.game.quests.questLines()) {
+ let state = QuestLineState[ql.state()]
+ state = state.charAt(0).toUpperCase() + state.slice(1)
+
+ let stateColor;
+ switch (ql.state()) {
+ case 0:
+ stateColor = "244, 80, 80";
+ break;
+ case 1:
+ stateColor = "99, 144, 240";
+ break;
+ case 2:
+ stateColor = "122, 199, 76";
+ break;
+ }
+
+ toAdd += `
+
+ ${ql.name}
+ ${state}
+
+ `;
+ }
+
+ // App.game.quests.questLines().filter(e => e.state() < 2).forEach(e => console.log(e.name, e.state()))
+
+ qlBody.innerHTML = toAdd;
+ filterQuestLine();
}
function loadEventHandlers() {
- // currency
- for (let i = 0; i < Object.keys(GameConstants.Currency).filter(isNaN).length; i++) {
- document.getElementById("currency_" + i).addEventListener("click", gainCurrency);
- }
-
- // gems
- for (let i = 0; i < Gems.nTypes; i++) {
- document.getElementById("gems_" + i).addEventListener("click", function () {
- App.game.gems.gainGems(parseInt(document.getElementById('inputAddGems').value || 0), i);
- });
- }
-
- // pokeballs
- for (let i = 0; i < Object.keys(GameConstants.Pokeball).filter(isNaN).length - 1; i++) {
- document.getElementById("pokeballs_" + i).addEventListener("click", function () {
- App.game.pokeballs.gainPokeballs(i, parseInt(document.getElementById('inputAddPokeballs').value || 0), true);
- });
- }
-
- // berries
- for (let i = 0; i < Object.keys(BerryType).filter(isNaN).length - 1; i++) {
- document.getElementById("berries_" + i).addEventListener("click", function () {
- App.game.farming.gainBerry(i, parseInt(document.getElementById('inputAddBerries').value || 0), true);
- });
- }
-
- // evolution items
- for (let i = 0; i < Object.keys(GameConstants.StoneType).filter(isNaN).length - 1; i++) {
- document.getElementById("evolutionitems_" + i).addEventListener("click", function () {
- player.gainItem(this.getAttribute("item"), parseInt(document.getElementById('inputAddEvolutionItems').value || 0), true);
- });
- }
-
- // vitamins
- for (let i = 0; i < Object.keys(GameConstants.VitaminType).filter(isNaN).length; i++) {
- document.getElementById("vitamins_" + i).addEventListener("click", function () {
- player.gainItem(this.getAttribute("vitamin"), parseInt(document.getElementById('inputAddVitamins').value || 0), true);
- });
- }
-
- // held items
- HeldItem.getSortedHeldItems().attack.items.forEach((itm, idx) => {
- document.getElementById("attackhelditems_" + idx).addEventListener("click", function () {
- HeldItem.getSortedHeldItems().attack.items[idk].gain(parseInt(document.getElementById('inputAddHeldItems').value || 0));
- });
- });
- HeldItem.getSortedHeldItems().typeRestricted.items.forEach((itm, idx) => {
- document.getElementById("typehelditems_" + idx).addEventListener("click", function () {
- HeldItem.getSortedHeldItems().typeRestricted.items[idx].gain(parseInt(document.getElementById('inputAddHeldItems').value || 0));
- });
- });
- HeldItem.getSortedHeldItems().ev.items.forEach((itm, idx) => {
- document.getElementById("evhelditems_" + idx).addEventListener("click", function () {
- HeldItem.getSortedHeldItems().ev.items[idx].gain(parseInt(document.getElementById('inputAddHeldItems').value || 0));
- });
- });
- HeldItem.getSortedHeldItems().exp.items.forEach((itm, idx) => {
- document.getElementById("exphelditems_" + idx).addEventListener("click", function () {
- HeldItem.getSortedHeldItems().exp.items[idx].gain(parseInt(document.getElementById('inputAddHeldItems').value || 0));
- });
- });
- HeldItem.getSortedHeldItems().other.items.forEach((itm, idx) => {
- document.getElementById("otherhelditems_" + idx).addEventListener("click", function () {
- HeldItem.getSortedHeldItems().other.items[idx].gain(parseInt(document.getElementById('inputAddHeldItems').value || 0));
- });
- });
-
- // pokedex
- document.getElementById("pokedex").children[1].addEventListener("click", loadPkdx);
- document.getElementById("pkdxNameFilter").addEventListener("input", filterPkdx);
- document.getElementById("pkdxRegionFilter").addEventListener("change", filterPkdx);
- document.getElementById("pkdxShinyFilter").addEventListener("change", filterPkdx);
- document.getElementById("pkdxPKRSFilter").addEventListener("change", filterPkdx);
-
- // questline
- document.getElementById("questlines").children[1].addEventListener("click", loadQuestLines);
- document.getElementById("questLineFilter").addEventListener("change", filterQuestLine);
+ // currency
+ for (let i = 0; i < Object.keys(GameConstants.Currency).filter(isNaN).length; i++) {
+ document.getElementById("currency_" + i).addEventListener("click", gainCurrency);
+ }
+
+ // gems
+ for (let i = 0; i < Gems.nTypes; i++) {
+ document.getElementById("gems_" + i).addEventListener("click", function () {
+ App.game.gems.gainGems(parseInt(document.getElementById('inputAddGems').value || 0), i);
+ });
+ }
+
+ // pokeballs
+ for (let i = 0; i < Object.keys(GameConstants.Pokeball).filter(isNaN).length - 1; i++) {
+ document.getElementById("pokeballs_" + i).addEventListener("click", function () {
+ App.game.pokeballs.gainPokeballs(i, parseInt(document.getElementById('inputAddPokeballs').value || 0), true);
+ });
+ }
+
+ // berries
+ for (let i = 0; i < Object.keys(BerryType).filter(isNaN).length - 1; i++) {
+ document.getElementById("berries_" + i).addEventListener("click", function () {
+ App.game.farming.gainBerry(i, parseInt(document.getElementById('inputAddBerries').value || 0), true);
+ });
+ }
+
+ // evolution items
+ for (let i = 0; i < Object.keys(GameConstants.StoneType).filter(isNaN).length - 1; i++) {
+ document.getElementById("evolutionitems_" + i).addEventListener("click", function () {
+ player.gainItem(this.getAttribute("item"), parseInt(document.getElementById('inputAddEvolutionItems').value || 0), true);
+ });
+ }
+
+ // vitamins
+ for (let i = 0; i < Object.keys(GameConstants.VitaminType).filter(isNaN).length; i++) {
+ document.getElementById("vitamins_" + i).addEventListener("click", function () {
+ player.gainItem(this.getAttribute("vitamin"), parseInt(document.getElementById('inputAddVitamins').value || 0), true);
+ });
+ }
+
+ // held items
+ HeldItem.getSortedHeldItems().attack.items.forEach((itm, idx) => {
+ document.getElementById("attackhelditems_" + idx).addEventListener("click", function () {
+ HeldItem.getSortedHeldItems().attack.items[idk].gain(parseInt(document.getElementById('inputAddHeldItems').value || 0));
+ });
+ });
+ HeldItem.getSortedHeldItems().typeRestricted.items.forEach((itm, idx) => {
+ document.getElementById("typehelditems_" + idx).addEventListener("click", function () {
+ HeldItem.getSortedHeldItems().typeRestricted.items[idx].gain(parseInt(document.getElementById('inputAddHeldItems').value || 0));
+ });
+ });
+ HeldItem.getSortedHeldItems().ev.items.forEach((itm, idx) => {
+ document.getElementById("evhelditems_" + idx).addEventListener("click", function () {
+ HeldItem.getSortedHeldItems().ev.items[idx].gain(parseInt(document.getElementById('inputAddHeldItems').value || 0));
+ });
+ });
+ HeldItem.getSortedHeldItems().exp.items.forEach((itm, idx) => {
+ document.getElementById("exphelditems_" + idx).addEventListener("click", function () {
+ HeldItem.getSortedHeldItems().exp.items[idx].gain(parseInt(document.getElementById('inputAddHeldItems').value || 0));
+ });
+ });
+ HeldItem.getSortedHeldItems().other.items.forEach((itm, idx) => {
+ document.getElementById("otherhelditems_" + idx).addEventListener("click", function () {
+ HeldItem.getSortedHeldItems().other.items[idx].gain(parseInt(document.getElementById('inputAddHeldItems').value || 0));
+ });
+ });
+
+ // pokedex
+ document.getElementById("pokedex").children[1].addEventListener("click", loadPkdx);
+ document.getElementById("pkdxNameFilter").addEventListener("input", filterPkdx);
+ document.getElementById("pkdxRegionFilter").addEventListener("change", filterPkdx);
+ document.getElementById("pkdxShinyFilter").addEventListener("change", filterPkdx);
+ document.getElementById("pkdxPKRSFilter").addEventListener("change", filterPkdx);
+
+ // questline
+ document.getElementById("questlines").children[1].addEventListener("click", loadQuestLines);
+ document.getElementById("questLineFilter").addEventListener("change", filterQuestLine);
}
function pkdxLoadEventHandlers() {
- for (const pokemon of pokemonList) {
- let pkElement = document.getElementById("pkdx_" + pokemon.id.toString().replace('.','_'));
- if (pkElement){
- pkElement.children[4].addEventListener("click", gainPk);
- pkElement.children[5].addEventListener("click", gainPkrs);
- }
- }
+ for (const pokemon of pokemonList) {
+ let pkElement = document.getElementById("pkdx_" + pokemon.id.toString().replace('.','_'));
+ if (pkElement){
+ pkElement.children[4].addEventListener("click", gainPk);
+ pkElement.children[5].addEventListener("click", gainPkrs);
+ }
+ }
}
function initSaveEditor() {
- // Add menu item
- let eventLi = document.createElement('li');
- eventLi.innerHTML = `
Debug Cheats `
- profileDrop.before(eventLi);
-
- // Add popup
- let eventMod = document.createElement('div');
- eventMod.setAttribute("class", "modal noselect fade show");
- eventMod.setAttribute("id", "saveEditorModal");
- eventMod.setAttribute("tabindex", "-1");
- eventMod.setAttribute("aria-labelledby", "saveEditorModal");
- eventMod.setAttribute("aria-modal", "true");
- eventMod.setAttribute("role", "dialog");
-
- eventMod.innerHTML = `
-
- `;
-
- profileModal.before(eventMod);
-
- let modalBody = document.querySelector('[id=saveEditorModal] div div [class=modal-body]');
-
- // currency
- for (let i = 0; i < Object.keys(GameConstants.Currency).filter(isNaN).length; i++) {
- const itm = GameConstants.Currency[i];
- const itmPretty = itm.charAt(0).toUpperCase() + itm.replace(/[A-Z]/g, ' $&').trim().slice(1);
- modalBody.querySelector('#currency').innerHTML += `
-
-
-
${itmPretty}
-
- `;
- }
-
- // gems
- for (let i = 0; i < Gems.nTypes; i++) {
- const itm = PokemonType[i];
- modalBody.querySelector('#gems').innerHTML += `
-
-
-
${itm}
-
- `;
- }
-
- // pokeballs
- for (let i = 0; i < Object.keys(GameConstants.Pokeball).filter(isNaN).length - 1; i++) {
- const itm = GameConstants.Pokeball[i];
- modalBody.querySelector('#pokeballs').innerHTML += `
-
-
-
${itm}
-
- `;
- }
-
- // berries
- for (let i = 0; i < Object.keys(BerryType).filter(isNaN).length - 1; i++) {
- const itm = BerryType[i];
- modalBody.querySelector('#berries').innerHTML += `
-
-
-
${itm}
-
- `;
- }
-
- // evolution items
- for (let i = 0; i < Object.keys(GameConstants.StoneType).filter(isNaN).length - 1; i++) {
- const itm = GameConstants.StoneType[i];
- const itmPretty = itm.replaceAll('_', ' ').replace(/\b\w/g, function(char) {
- return char.toUpperCase();
- });
- modalBody.querySelector('#evolutionItems').innerHTML += `
-
-
-
${itmPretty}
-
- `;
- }
-
- // vitamins
- for (let i = 0; i < Object.keys(GameConstants.VitaminType).filter(isNaN).length; i++) {
- const itm = GameConstants.VitaminType[i];
- modalBody.querySelector('#vitamins').innerHTML += `
-
-
-
${itm}
-
- `;
- }
-
- // held items
- HeldItem.getSortedHeldItems().attack.items.forEach((itm, idx) => {
- const itmPretty = itm.name.replaceAll('_', ' ');
- modalBody.querySelector('#heldItems').innerHTML += `
-
-
-
${itmPretty}
-
- `;
- });
- HeldItem.getSortedHeldItems().typeRestricted.items.forEach((itm, idx) => {
- const itmPretty = itm.name.replaceAll('_', ' ');
- modalBody.querySelector('#heldItems').innerHTML += `
-
-
-
${itmPretty}
-
- `;
- });
- HeldItem.getSortedHeldItems().ev.items.forEach((itm, idx) => {
- const itmPretty = itm.name.replaceAll('_', ' ');
- modalBody.querySelector('#heldItems').innerHTML += `
-
-
-
${itmPretty}
-
- `;
- });
- HeldItem.getSortedHeldItems().exp.items.forEach((itm, idx) => {
- const itmPretty = itm.name.replaceAll('_', ' ');
- modalBody.querySelector('#heldItems').innerHTML += `
-
-
-
${itmPretty}
-
- `;
- });
- HeldItem.getSortedHeldItems().other.items.forEach((itm, idx) => {
- const itmPretty = itm.name.replaceAll('_', ' ');
- modalBody.querySelector('#heldItems').innerHTML += `
-
-
-
${itmPretty}
-
- `;
- });
-
- // pokedex
- const pkdxRegFilt = modalBody.querySelector('#pkdxRegionFilter');
- for (let i = 0; i <= player.highestRegion(); i++) {
- const reg = GameConstants.Region[i]
- pkdxRegFilt.innerHTML += `
${reg.charAt(0).toUpperCase() + reg.slice(1)} `;
- }
- pkdxRegFilt.innerHTML += '
None ';
-
-
- loadEventHandlers();
+ // Add menu item
+ let eventLi = document.createElement('li');
+ eventLi.innerHTML = `
Debug Cheats `
+ profileDrop.before(eventLi);
+
+ // Add popup
+ let eventMod = document.createElement('div');
+ eventMod.setAttribute("class", "modal noselect fade show");
+ eventMod.setAttribute("id", "saveEditorModal");
+ eventMod.setAttribute("tabindex", "-1");
+ eventMod.setAttribute("aria-labelledby", "saveEditorModal");
+ eventMod.setAttribute("aria-modal", "true");
+ eventMod.setAttribute("role", "dialog");
+
+ eventMod.innerHTML = `
+
+ `;
+
+ profileModal.before(eventMod);
+
+ let modalBody = document.querySelector('[id=saveEditorModal] div div [class=modal-body]');
+
+ // currency
+ for (let i = 0; i < Object.keys(GameConstants.Currency).filter(isNaN).length; i++) {
+ const itm = GameConstants.Currency[i];
+ const itmPretty = itm.charAt(0).toUpperCase() + itm.replace(/[A-Z]/g, ' $&').trim().slice(1);
+ modalBody.querySelector('#currency').innerHTML += `
+
+
+
${itmPretty}
+
+ `;
+ }
+
+ // gems
+ for (let i = 0; i < Gems.nTypes; i++) {
+ const itm = PokemonType[i];
+ modalBody.querySelector('#gems').innerHTML += `
+
+
+
${itm}
+
+ `;
+ }
+
+ // pokeballs
+ for (let i = 0; i < Object.keys(GameConstants.Pokeball).filter(isNaN).length - 1; i++) {
+ const itm = GameConstants.Pokeball[i];
+ modalBody.querySelector('#pokeballs').innerHTML += `
+
+
+
${itm}
+
+ `;
+ }
+
+ // berries
+ for (let i = 0; i < Object.keys(BerryType).filter(isNaN).length - 1; i++) {
+ const itm = BerryType[i];
+ modalBody.querySelector('#berries').innerHTML += `
+
+
+
${itm}
+
+ `;
+ }
+
+ // evolution items
+ for (let i = 0; i < Object.keys(GameConstants.StoneType).filter(isNaN).length - 1; i++) {
+ const itm = GameConstants.StoneType[i];
+ const itmPretty = itm.replaceAll('_', ' ').replace(/\b\w/g, function(char) {
+ return char.toUpperCase();
+ });
+ modalBody.querySelector('#evolutionItems').innerHTML += `
+
+
+
${itmPretty}
+
+ `;
+ }
+
+ // vitamins
+ for (let i = 0; i < Object.keys(GameConstants.VitaminType).filter(isNaN).length; i++) {
+ const itm = GameConstants.VitaminType[i];
+ modalBody.querySelector('#vitamins').innerHTML += `
+
+
+
${itm}
+
+ `;
+ }
+
+ // held items
+ HeldItem.getSortedHeldItems().attack.items.forEach((itm, idx) => {
+ const itmPretty = itm.name.replaceAll('_', ' ');
+ modalBody.querySelector('#heldItems').innerHTML += `
+
+
+
${itmPretty}
+
+ `;
+ });
+ HeldItem.getSortedHeldItems().typeRestricted.items.forEach((itm, idx) => {
+ const itmPretty = itm.name.replaceAll('_', ' ');
+ modalBody.querySelector('#heldItems').innerHTML += `
+
+
+
${itmPretty}
+
+ `;
+ });
+ HeldItem.getSortedHeldItems().ev.items.forEach((itm, idx) => {
+ const itmPretty = itm.name.replaceAll('_', ' ');
+ modalBody.querySelector('#heldItems').innerHTML += `
+
+
+
${itmPretty}
+
+ `;
+ });
+ HeldItem.getSortedHeldItems().exp.items.forEach((itm, idx) => {
+ const itmPretty = itm.name.replaceAll('_', ' ');
+ modalBody.querySelector('#heldItems').innerHTML += `
+
+
+
${itmPretty}
+
+ `;
+ });
+ HeldItem.getSortedHeldItems().other.items.forEach((itm, idx) => {
+ const itmPretty = itm.name.replaceAll('_', ' ');
+ modalBody.querySelector('#heldItems').innerHTML += `
+
+
+
${itmPretty}
+
+ `;
+ });
+
+ // pokedex
+ const pkdxRegFilt = modalBody.querySelector('#pkdxRegionFilter');
+ for (let i = 0; i <= player.highestRegion(); i++) {
+ const reg = GameConstants.Region[i]
+ pkdxRegFilt.innerHTML += `
${reg.charAt(0).toUpperCase() + reg.slice(1)} `;
+ }
+ pkdxRegFilt.innerHTML += '
None ';
+
+
+ loadEventHandlers();
}
/* WIP, sevii helper
var lst = pokemonList.filter((p) => p.name.includes('Pinkan')
- || p.name.includes('Valencian')
- || p.name === 'Crystal Onix'
- || p.name === 'Ash\'s Butterfree'
- || p.name === 'Pink Butterfree');
+ || p.name.includes('Valencian')
+ || p.name === 'Crystal Onix'
+ || p.name === 'Ash\'s Butterfree'
+ || p.name === 'Pink Butterfree');
var caught = App.game.party.caughtPokemon
- .filter((p) => p.name.includes('Pinkan')
- || p.name.includes('Valencian')
- || p.name === 'Crystal Onix'
- || p.name === 'Ash\'s Butterfree'
- || p.name === 'Pink Butterfree');
+ .filter((p) => p.name.includes('Pinkan')
+ || p.name.includes('Valencian')
+ || p.name === 'Crystal Onix'
+ || p.name === 'Ash\'s Butterfree'
+ || p.name === 'Pink Butterfree');
var caughtNames = caught.map(e => e.name);
var missing = lst.filter(e => !caughtNames.includes(e.name));
@@ -620,71 +620,71 @@ console.log(missing);
*/
function loadEpheniaScript(scriptName, initFunction, priorityFunction) {
- function reportScriptError(scriptName, error) {
- console.error(`Error while initializing '${scriptName}' userscript:\n${error}`);
- Notifier.notify({
- type: NotificationConstants.NotificationOption.warning,
- title: scriptName,
- message: `The '${scriptName}' userscript crashed while loading. Check for updates or disable the script, then restart the game.\n\nReport script issues to the script developer, not to the Pokéclicker team.`,
- timeout: GameConstants.DAY,
- });
- }
- const windowObject = !App.isUsingClient ? unsafeWindow : window;
- // Inject handlers if they don't exist yet
- if (windowObject.epheniaScriptInitializers === undefined) {
- windowObject.epheniaScriptInitializers = {};
- const oldInit = Preload.hideSplashScreen;
- var hasInitialized = false;
-
- // Initializes scripts once enough of the game has loaded
- Preload.hideSplashScreen = function (...args) {
- var result = oldInit.apply(this, args);
- if (App.game && !hasInitialized) {
- // Initialize all attached userscripts
- Object.entries(windowObject.epheniaScriptInitializers).forEach(([scriptName, initFunction]) => {
- try {
- initFunction();
- } catch (e) {
- reportScriptError(scriptName, e);
- }
- });
- hasInitialized = true;
- }
- return result;
- }
- }
-
- // Prevent issues with duplicate script names
- if (windowObject.epheniaScriptInitializers[scriptName] !== undefined) {
- console.warn(`Duplicate '${scriptName}' userscripts found!`);
- Notifier.notify({
- type: NotificationConstants.NotificationOption.warning,
- title: scriptName,
- message: `Duplicate '${scriptName}' userscripts detected. This could cause unpredictable behavior and is not recommended.`,
- timeout: GameConstants.DAY,
- });
- let number = 2;
- while (windowObject.epheniaScriptInitializers[`${scriptName} ${number}`] !== undefined) {
- number++;
- }
- scriptName = `${scriptName} ${number}`;
- }
- // Add initializer for this particular script
- windowObject.epheniaScriptInitializers[scriptName] = initFunction;
- // Run any functions that need to execute before the game starts
- if (priorityFunction) {
- $(document).ready(() => {
- try {
- priorityFunction();
- } catch (e) {
- reportScriptError(scriptName, e);
- // Remove main initialization function
- windowObject.epheniaScriptInitializers[scriptName] = () => null;
- }
- });
- }
+ function reportScriptError(scriptName, error) {
+ console.error(`Error while initializing '${scriptName}' userscript:\n${error}`);
+ Notifier.notify({
+ type: NotificationConstants.NotificationOption.warning,
+ title: scriptName,
+ message: `The '${scriptName}' userscript crashed while loading. Check for updates or disable the script, then restart the game.\n\nReport script issues to the script developer, not to the Pokéclicker team.`,
+ timeout: GameConstants.DAY,
+ });
+ }
+ const windowObject = !App.isUsingClient ? unsafeWindow : window;
+ // Inject handlers if they don't exist yet
+ if (windowObject.epheniaScriptInitializers === undefined) {
+ windowObject.epheniaScriptInitializers = {};
+ const oldInit = Preload.hideSplashScreen;
+ var hasInitialized = false;
+
+ // Initializes scripts once enough of the game has loaded
+ Preload.hideSplashScreen = function (...args) {
+ var result = oldInit.apply(this, args);
+ if (App.game && !hasInitialized) {
+ // Initialize all attached userscripts
+ Object.entries(windowObject.epheniaScriptInitializers).forEach(([scriptName, initFunction]) => {
+ try {
+ initFunction();
+ } catch (e) {
+ reportScriptError(scriptName, e);
+ }
+ });
+ hasInitialized = true;
+ }
+ return result;
+ }
+ }
+
+ // Prevent issues with duplicate script names
+ if (windowObject.epheniaScriptInitializers[scriptName] !== undefined) {
+ console.warn(`Duplicate '${scriptName}' userscripts found!`);
+ Notifier.notify({
+ type: NotificationConstants.NotificationOption.warning,
+ title: scriptName,
+ message: `Duplicate '${scriptName}' userscripts detected. This could cause unpredictable behavior and is not recommended.`,
+ timeout: GameConstants.DAY,
+ });
+ let number = 2;
+ while (windowObject.epheniaScriptInitializers[`${scriptName} ${number}`] !== undefined) {
+ number++;
+ }
+ scriptName = `${scriptName} ${number}`;
+ }
+ // Add initializer for this particular script
+ windowObject.epheniaScriptInitializers[scriptName] = initFunction;
+ // Run any functions that need to execute before the game starts
+ if (priorityFunction) {
+ $(document).ready(() => {
+ try {
+ priorityFunction();
+ } catch (e) {
+ reportScriptError(scriptName, e);
+ // Remove main initialization function
+ windowObject.epheniaScriptInitializers[scriptName] = () => null;
+ }
+ });
+ }
}
if (!App.isUsingClient || localStorage.getItem('debugcheatstools') === 'true') {
- loadEpheniaScript('debugcheatstools', initSaveEditor);
+ loadEpheniaScript('debugcheatstools', initSaveEditor);
}
From c6272cec16231fb2d04b62685bfe35f3e3b0399d Mon Sep 17 00:00:00 2001
From: iamc24 <42425100+iamc24@users.noreply.github.com>
Date: Wed, 30 Jul 2025 17:30:23 -0700
Subject: [PATCH 13/14] Update debugcheatstools.user.js
Re-add custom html attribute accidentally removed when simplifying event handlers; Fix minor indentation issue
---
custom/debugcheatstools.user.js | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/custom/debugcheatstools.user.js b/custom/debugcheatstools.user.js
index 602b5bb..0fd3e26 100644
--- a/custom/debugcheatstools.user.js
+++ b/custom/debugcheatstools.user.js
@@ -520,10 +520,10 @@ function initSaveEditor() {
for (let i = 0; i < Object.keys(GameConstants.StoneType).filter(isNaN).length - 1; i++) {
const itm = GameConstants.StoneType[i];
const itmPretty = itm.replaceAll('_', ' ').replace(/\b\w/g, function(char) {
- return char.toUpperCase();
- });
+ return char.toUpperCase();
+ });
modalBody.querySelector('#evolutionItems').innerHTML += `
-
+
${itmPretty}
From 3a67a4513be7ab6712f58b1fa707868c4e032077 Mon Sep 17 00:00:00 2001
From: iamc24 <42425100+iamc24@users.noreply.github.com>
Date: Wed, 30 Jul 2025 17:34:08 -0700
Subject: [PATCH 14/14] Update debugcheatstools.user.js
Fix variable typo
---
custom/debugcheatstools.user.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/custom/debugcheatstools.user.js b/custom/debugcheatstools.user.js
index 0fd3e26..f2eaca3 100644
--- a/custom/debugcheatstools.user.js
+++ b/custom/debugcheatstools.user.js
@@ -276,7 +276,7 @@ function loadEventHandlers() {
// held items
HeldItem.getSortedHeldItems().attack.items.forEach((itm, idx) => {
document.getElementById("attackhelditems_" + idx).addEventListener("click", function () {
- HeldItem.getSortedHeldItems().attack.items[idk].gain(parseInt(document.getElementById('inputAddHeldItems').value || 0));
+ HeldItem.getSortedHeldItems().attack.items[idx].gain(parseInt(document.getElementById('inputAddHeldItems').value || 0));
});
});
HeldItem.getSortedHeldItems().typeRestricted.items.forEach((itm, idx) => {