Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions src/patches/botanics.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import type MwRandomizer from "../plugin";

declare global {
namespace sc {
interface MenuModel {
}
}
}

export function patch(plugin: MwRandomizer) {
sc.MenuModel.inject({
getTotalDropsFoundAndCompleted(percentage) {
const max = sc.multiworld.options.botanicsCompletionAmount;
if (max === undefined) {
return this.parent(percentage);
}

let numFound = 0;

Object.entries(this.drops).forEach(([key, drop]) => {
if (
drop.track &&
sc.stats.getMap("exploration", "dropFound-" + key) &&
this.dropCounts[key] &&
this.dropCounts[key].completed
) {
numFound++;
}
});

return percentage ? numFound / max : numFound;
}
});
}
2 changes: 2 additions & 0 deletions src/patches/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type MwRandomizer from "../plugin";

import { patch as patchMwModel } from "./multiworld-model";
import { patch as patchBotanics } from "./botanics";
import { patch as patchChest } from "./chest";
import { patch as patchEntities } from "./entity";
import { patch as patchEvent } from "./event";
Expand All @@ -18,6 +19,7 @@ import { patch as patchDeathLink } from "./deathlink.ts";

export function applyPatches(plugin: MwRandomizer) {
patchMwModel(plugin);
patchBotanics(plugin);
patchChest(plugin);
patchEntities(plugin);
patchEvent(plugin);
Expand Down
3 changes: 2 additions & 1 deletion src/types/multiworld-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ declare global {
shopSendMode?: string,
shopReceiveMode?: string,
shopDialogHints?: boolean,
chestClearanceLevels?: Record<number, keyof typeof sc.CHEST_TYPE>
chestClearanceLevels?: Record<number, keyof typeof sc.CHEST_TYPE>,
botanicsCompletionAmount?: number,
};

export type MultiworldVars = {
Expand Down