Skip to content

Commit

Permalink
patch: Add missing hook calls for setup & postAction in Loader
Browse files Browse the repository at this point in the history
  • Loading branch information
theBGuy committed Jan 26, 2025
1 parent ea0b5c7 commit f600e1c
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion d2bs/kolbot/libs/core/Loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ const Loader = {
if (isIncluded("scripts/" + script + ".js")) {
try {
if (Loader.currentScript instanceof Runnable) {
const { startArea, bossid, preAction } = Loader.currentScript;
const { startArea, bossid, preAction, setup } = Loader.currentScript;

if (startArea && Loader.scriptIndex === 0) {
Loader.firstScriptAct = sdk.areas.actOf(startArea);
Expand All @@ -194,6 +194,10 @@ const Loader = {
continue;
}

if (setup && typeof setup === "function") {
setup(ctx);
}

if (preAction && typeof preAction === "function") {
preAction(ctx);
}
Expand Down Expand Up @@ -251,6 +255,14 @@ const Loader = {
+ "ÿc7 - Exp/minute: ÿc0" + (gain / (duration / 60000)).toFixed(2)
);
this.doneScripts.add(script);

if (Loader.currentScript instanceof Runnable) {
const { postAction } = Loader.currentScript;

if (postAction && typeof postAction === "function") {
postAction(ctx);
}
}
}
}
} catch (error) {
Expand Down Expand Up @@ -337,6 +349,10 @@ const Loader = {
return true;
}

if (setup && typeof setup === "function") {
setup(ctx);
}

if (preAction && typeof preAction === "function") {
preAction(ctx);
}
Expand Down Expand Up @@ -383,6 +399,14 @@ const Loader = {
+ "ÿc7 - Exp/minute: ÿc0" + (gain / (duration / 60000)).toFixed(2)
);
this.doneScripts.add(script);

if (Loader.currentScript instanceof Runnable) {
const { postAction } = Loader.currentScript;

if (postAction && typeof postAction === "function") {
postAction(ctx);
}
}
}
}
} catch (error) {
Expand Down

0 comments on commit f600e1c

Please sign in to comment.