Skip to content

Commit d1c3066

Browse files
committed
improve: hook on Game.RefreshStore
1 parent 26c59b9 commit d1c3066

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

main.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,16 @@ let BestDealHelper = {
108108
[...document.styleSheets[1].cssRules].filter(e => e.selectorText === ".product .content")[0].style.paddingTop = "0px";
109109
[...document.styleSheets[1].cssRules].filter(e => e.selectorText === ".price::before")[0].style.top = "0px";
110110

111-
// Trigger: wrap GameRebuildUpgrades
112-
const GameRebuildUpgrades = Game.RebuildUpgrades;
111+
// Trigger: wrap Game.RebuildUpgrades
112+
BestDealHelper.RebuildUpgrades = Game.RebuildUpgrades;
113113
Game.RebuildUpgrades = function () {
114-
GameRebuildUpgrades();
114+
BestDealHelper.RebuildUpgrades();
115+
BestDealHelper.logicLoop();
116+
};
117+
// Trigger: wrap Game.RefreshStore
118+
BestDealHelper.RefreshStore = Game.RefreshStore;
119+
Game.RefreshStore = function () {
120+
BestDealHelper.RefreshStore();
115121
BestDealHelper.logicLoop();
116122
};
117123
// Trigger: checks from time to time
@@ -147,7 +153,7 @@ let BestDealHelper = {
147153

148154
logicLoop: function () {
149155
BestDealHelper.loopCount++;
150-
if (BestDealHelper.loopCount >= 20
156+
if (BestDealHelper.loopCount >= 10
151157
|| BestDealHelper.last_cps !== Game.cookiesPs
152158
|| BestDealHelper.config.enableSort !== BestDealHelper.last_config_enableSort
153159
|| BestDealHelper.config.ignoreWizardTower !== BestDealHelper.last_config_ignoreWizardTower

0 commit comments

Comments
 (0)