Skip to content

Commit

Permalink
Merge pull request #341 from umbralOptimatum/misc-improvements
Browse files Browse the repository at this point in the history
Desktop bug fixes and scriptfixerupper support
  • Loading branch information
Ephenia authored Aug 17, 2023
2 parents 47254d3 + efb0436 commit ca714ad
Show file tree
Hide file tree
Showing 21 changed files with 191 additions and 132 deletions.
15 changes: 9 additions & 6 deletions additionalvisualsettings.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,6 @@ function initVisualSettings() {
function overrideNotifications() {
Notifier.oldNotifyAVS = Notifier.notify;
Notifier.notify = function(...args) {
// console.log(...args)
if (avsDisableNotifications) {
if (args.length && args[0].sound) {
args[0].sound.play();
Expand Down Expand Up @@ -379,11 +378,15 @@ function loadSetting(key, defaultVal) {
}

function loadScript(){
var oldInit = Preload.hideSplashScreen;

Preload.hideSplashScreen = function() {
var result = oldInit.apply(this, arguments)
initVisualSettings();
const oldInit = Preload.hideSplashScreen;
var hasInitialized = false;

Preload.hideSplashScreen = function (...args) {
var result = oldInit.apply(this, args)
if (App.game && !hasInitialized) {
initVisualSettings();
hasInitialized = true;
}
return result;
}

Expand Down
14 changes: 9 additions & 5 deletions autobattleitems.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,16 @@ if (!localStorage.getItem('toggleABItems')) {
battleItemState = JSON.parse(localStorage.getItem('autoBattleItems'));
ItemABPrefs = JSON.parse(localStorage.getItem('toggleABItems'));

function loadScript(){
var oldInit = Preload.hideSplashScreen
function loadScript() {
const oldInit = Preload.hideSplashScreen;
var hasInitialized = false;

Preload.hideSplashScreen = function(){
var result = oldInit.apply(this, arguments)
initAutoBattleItems()
Preload.hideSplashScreen = function (...args) {
var result = oldInit.apply(this, args)
if (App.game && !hasInitialized) {
initAutoBattleItems();
hasInitialized = true;
}
return result
}
}
Expand Down
16 changes: 10 additions & 6 deletions catchfilterfantasia.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -472,12 +472,16 @@ if (fixIt.length != 0) {
localStorage.setItem('filterBallPref', JSON.stringify(filterBallPref));
}

function loadScript(){
var oldInit = Preload.hideSplashScreen

Preload.hideSplashScreen = function(){
var result = oldInit.apply(this, arguments)
initCatchFilter()
function loadScript() {
const oldInit = Preload.hideSplashScreen;
var hasInitialized = false;

Preload.hideSplashScreen = function (...args) {
var result = oldInit.apply(this, args);
if (App.game && !hasInitialized) {
initCatchFilter();
hasInitialized = true;
}
return result
}
}
Expand Down
15 changes: 9 additions & 6 deletions custom/autoquestcompleter.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -296,13 +296,16 @@ function loadSetting(key, defaultVal) {
return val;
}


function loadScript(){
var oldInit = Preload.hideSplashScreen;

Preload.hideSplashScreen = function() {
var result = oldInit.apply(this, arguments);
initAutoQuest();
const oldInit = Preload.hideSplashScreen;
var hasInitialized = false;

Preload.hideSplashScreen = function (...args) {
var result = oldInit.apply(this, args);
if (App.game && !hasInitialized) {
initAutoQuest();
hasInitialized = true;
}
return result;
}
}
Expand Down
30 changes: 15 additions & 15 deletions custom/catchspeedadjuster.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,24 +35,20 @@ function initBallAdjust() {
document.getElementById('pokeballSelectorBody').style.maxHeight = "285px";
document.getElementById('ball-adjust').addEventListener('click', event => changeAdjust(event.target));

if (ballAdjuster == "true") {
if (ballAdjuster) {
document.getElementById('ball-adjust').checked = true;
catchDelay();
}

function changeAdjust(ele) {
if (ballAdjuster == "true") {
ballAdjuster = "false"
} else {
ballAdjuster = "true"
}
ballAdjuster = !ballAdjuster;
localStorage.setItem("ballAdjuster", ballAdjuster);
catchDelay();
}

function catchDelay() {
for (var i = 0; i < getBalls.length; i++) {
if (ballAdjuster == "true") {
if (ballAdjuster) {
getBalls[i].catchTime = 0;
} else {
getBalls[i].catchTime = defaultTime[i];
Expand All @@ -62,17 +58,21 @@ function initBallAdjust() {
}

if (localStorage.getItem('ballAdjuster') == null) {
localStorage.setItem("ballAdjuster", "false");
localStorage.setItem('ballAdjuster', 'false');
}
ballAdjuster = localStorage.getItem('ballAdjuster');
ballAdjuster = localStorage.getItem('ballAdjuster') == 'true';

function loadScript(){
var oldInit = Preload.hideSplashScreen
function loadScript() {
const oldInit = Preload.hideSplashScreen;
var hasInitialized = false;

Preload.hideSplashScreen = function(){
var result = oldInit.apply(this, arguments)
initBallAdjust()
return result
Preload.hideSplashScreen = function (...args) {
var result = oldInit.apply(this, args);
if (App.game && !hasInitialized) {
initBallAdjust();
hasInitialized = true;
}
return result;
}
}

Expand Down
16 changes: 10 additions & 6 deletions custom/challengemodechanger.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,17 @@ function initChallenger() {
}
}

function loadScript(){
var oldInit = Preload.hideSplashScreen
function loadScript() {
const oldInit = Preload.hideSplashScreen;
var hasInitialized = false;

Preload.hideSplashScreen = function(){
var result = oldInit.apply(this, arguments)
initChallenger()
return result
Preload.hideSplashScreen = function (...args) {
var result = oldInit.apply(this, args);
if (App.game && !hasInitialized) {
initChallenger();
hasInitialized = true;
}
return result;
}
}

Expand Down
18 changes: 11 additions & 7 deletions custom/discordcodegenerator.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ var resCodes;
var validPoke = [];

function initCodeGen() {
App.game.discord.codes.forEach(e => validPoke.push(e.name));
genCodes();
const saveTab = document.getElementById('saveTab');
var fragment = new DocumentFragment();
Expand Down Expand Up @@ -81,14 +82,17 @@ function randInt() {
return Math.floor((Math.random() * 65536) + 1);
}

function loadScript(){
var oldInit = Preload.hideSplashScreen
function loadScript() {
const oldInit = Preload.hideSplashScreen;
var hasInitialized = false;

Preload.hideSplashScreen = function(){
var result = oldInit.apply(this, arguments)
App.game.discord.codes.forEach(e => validPoke.push(e.name));
initCodeGen()
return result
Preload.hideSplashScreen = function (...args) {
var result = oldInit.apply(this, args);
if (App.game && !hasInitialized) {
initCodeGen();
hasInitialized = true;
}
return result;
}
}

Expand Down
16 changes: 10 additions & 6 deletions custom/infiniteseasonalevents.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,13 +231,17 @@ function toggleEvent() {
}

//Made this script load like the others for consistency
function loadScript(){
var oldInit = Preload.hideSplashScreen
function loadScript() {
const oldInit = Preload.hideSplashScreen;
var hasInitialized = false;

Preload.hideSplashScreen = function(){
var result = oldInit.apply(this, arguments)
initEvents()
return result
Preload.hideSplashScreen = function (...args) {
var result = oldInit.apply(this, args);
if (App.game && !hasInitialized) {
initEvents();
hasInitialized = true;
}
return result;
}
}

Expand Down
16 changes: 10 additions & 6 deletions custom/oakitemsunlimited.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,17 @@ function initOakItems() {
document.getElementById('oakItemsModal').querySelector('h5').innerHTML = "Oak Items Equipped: " + oakItems.activeCount() + '/' + oakMax;
}

function loadScript(){
var oldInit = Preload.hideSplashScreen
function loadScript() {
const oldInit = Preload.hideSplashScreen;
hasInitialized = false;

Preload.hideSplashScreen = function(){
var result = oldInit.apply(this, arguments)
initOakItems()
return result
Preload.hideSplashScreen = function (...args) {
var result = oldInit.apply(this, args);
if (App.game && !hasInitialized) {
initOakItems();
hasInitialized = true;
}
return result;
}
}

Expand Down
14 changes: 9 additions & 5 deletions custom/omegaproteingains.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,16 @@ function initOmegaProtein() {
}

function loadScript() {
var oldInit = Preload.hideSplashScreen
const oldInit = Preload.hideSplashScreen;
var hasInitialized = false;

Preload.hideSplashScreen = function () {
var result = oldInit.apply(this, arguments)
initOmegaProtein()
return result
Preload.hideSplashScreen = function (...args) {
var result = oldInit.apply(this, args)
if (App.game && !hasInitialized) {
initOmegaProtein();
hasInitialized = true;
}
return result;
}
}

Expand Down
10 changes: 7 additions & 3 deletions custom/overnightberrygrowth.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,10 +208,14 @@ if (![0, 1, 2].includes(overnightGrowthMode)) {

function loadScript() {
const oldInit = Preload.hideSplashScreen;
var hasInitialized = false;

Preload.hideSplashScreen = function () {
var result = oldInit.apply(this, arguments);
initSettings();
Preload.hideSplashScreen = function (...args) {
var result = oldInit.apply(this, args);
if (App.game && !hasInitialized) {
initSettings();
hasInitialized = true;
}
return result;
}
}
Expand Down
16 changes: 10 additions & 6 deletions custom/perkypokeruspandemic.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,17 @@ function initPokerusPandemic() {
}
}

function loadScript(){
var oldInit = Preload.hideSplashScreen
function loadScript() {
const oldInit = Preload.hideSplashScreen;
var hasInitialized = false;

Preload.hideSplashScreen = function(){
var result = oldInit.apply(this, arguments)
initPokerusPandemic()
return result
Preload.hideSplashScreen = function (...args) {
var result = oldInit.apply(this, args);
if (App.game && !hasInitialized) {
initPokerusPandemic();
hasInitialized = true;
}
return result;
}
}

Expand Down
14 changes: 9 additions & 5 deletions custom/simpleweatherchanger.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,16 @@ function overrideGenerateWeather() {
}
}

function loadScript(){
var oldInit = Preload.hideSplashScreen;
function loadScript() {
const oldInit = Preload.hideSplashScreen;
var hasInitialized = false;

Preload.hideSplashScreen = function() {
var result = oldInit.apply(this, arguments);
initWeatherChange();
Preload.hideSplashScreen = function (...args) {
var result = oldInit.apply(this, args);
if (App.game && !hasInitialized) {
initWeatherChange();
hasInitialized = true;
}
return result;
}
}
Expand Down
16 changes: 10 additions & 6 deletions custom/syntheticshinysynapse.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -336,12 +336,16 @@ karmaRates = JSON.parse(localStorage.getItem('shinyKarmaRates'));
shinyDOMUpdate = JSON.parse(localStorage.getItem('shinyDOMUpdate'));

function loadScript() {
var oldInit = Preload.hideSplashScreen

Preload.hideSplashScreen = function () {
var result = oldInit.apply(this, arguments)
initShinySynapse()
return result
const oldInit = Preload.hideSplashScreen;
var hasInitialized = false;

Preload.hideSplashScreen = function (...args) {
var result = oldInit.apply(this, args);
if (App.game && !hasInitialized) {
initShinySynapse();
hasInitialized = true;
}
return result;
}
}

Expand Down
Binary file modified desktop/app.asar
Binary file not shown.
4 changes: 2 additions & 2 deletions desktop/app_src/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -824,8 +824,8 @@ function startEpheniaScripts() {
externalResolve = resolve;
});
const startApp = App.start.bind(App)
App.start = function start() {
allScriptsDone.finally(() => startApp());
App.start = function start(...args) {
allScriptsDone.finally(() => startApp(args));
}
return externalResolve;
})();`);
Expand Down
10 changes: 7 additions & 3 deletions enhancedautoclicker.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -1081,10 +1081,14 @@ addGraphicsBindings();

function loadScript() {
const oldInit = Preload.hideSplashScreen;
var hasInitialized = false;

Preload.hideSplashScreen = function () {
var result = oldInit.apply(this, arguments);
initAutoClicker();
Preload.hideSplashScreen = function (...args) {
var result = oldInit.apply(this, args);
if (App.game && !hasInitialized) {
initAutoClicker();
hasInitialized = true;
}
return result;
}
}
Expand Down
Loading

0 comments on commit ca714ad

Please sign in to comment.