Skip to content

Commit

Permalink
Change max natural price to 3b, start noting it at the end of the script
Browse files Browse the repository at this point in the history
  • Loading branch information
libraryaddict committed Jan 4, 2025
1 parent 138c016 commit 7dd2488
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 6 deletions.
25 changes: 21 additions & 4 deletions src/AccountVal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ import {
myStorageMeat,
print,
printHtml,
toInt,
toInt
} from "kolmafia";
import { AccountValLogic, ItemStatus } from "./AccountValLogic";
import {
AccountValSettings,
FieldType,
PricingSettings,
SortBy,
SortBy
} from "./AccountValSettings";
import { AccountValUtils } from "./AccountValUtils";
import { PriceType } from "./PriceResolver";
Expand Down Expand Up @@ -74,10 +74,17 @@ class AccountVal {
shelfValue = worth;
};

let exceededMax = false;

for (let no = this.logic.prices.length - 1; no >= 0; no--) {
const item = this.logic.prices[no][0];
const price = this.logic.prices[no][1];

exceededMax =
exceededMax ||
this.settings.maxNaturalPrice + 1 <
price.price * (1 / item.worthMultiplier);

// Mall extinct items should be at max natural price
const worthEach = Math.min(
this.settings.maxNaturalPrice + 1,
Expand Down Expand Up @@ -272,7 +279,7 @@ class AccountVal {
if (mallExtinct.length > 0) {
const colors: string[] = [
AccountValColors.mallExtinctColor1,
AccountValColors.mallExtinctColor2,
AccountValColors.mallExtinctColor2
];

const extinct = mallExtinct.map(
Expand Down Expand Up @@ -352,6 +359,16 @@ class AccountVal {
}

this.printMeat();

if (exceededMax) {
printHtml(
`<font color='${
AccountValColors.minorNote
}' title="The max natural price is currently set to ${AccountValUtils.getNumber(
this.settings.maxNaturalPrice
)}, you can change this by using 'max=3b' as an arg, or setting the property 'accountval_maxNaturalPrice' to a number (3b, 5,000,000, 3m1k, etc)">Some items were expensive and were marked as mall extinct. Hover for details.</font>`
);
}
}

printMeat() {
Expand Down Expand Up @@ -565,7 +582,7 @@ class AccountVal {
this.runTest("", {
doBound: true,
sortBy: SortBy.TOTAL_PRICE,
fetchInventory: true,
fetchInventory: true
});
this.runTest("sort meat!bound", { doBound: false, sortBy: SortBy.PRICE });
print("Tests Finished", "green");
Expand Down
17 changes: 15 additions & 2 deletions src/AccountValSettings.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
import { getPlayerId, isDarkMode, print, toBoolean, toFloat } from "kolmafia";
import {
getPlayerId,
getProperty,
isDarkMode,
print,
toBoolean,
toFloat
} from "kolmafia";
import {
AccountValColors,
getAccountvalColors,
Expand Down Expand Up @@ -85,7 +92,7 @@ export class AccountValSettings {
colorScheme: string = isDarkMode() ? "dark" : "default";
presets: PresetSetting[] = [];
doCategories: boolean = false;
maxNaturalPrice = 999_999_999;
maxNaturalPrice = 3_000_000_000;
showSingleItemWorth: boolean = false;

static getSettings(): ValSetting[] {
Expand Down Expand Up @@ -361,6 +368,12 @@ export class AccountValSettings {
}

doSettings(args: string[]): string[] {
if (getProperty("accountval_maxNaturalPrice").length > 0) {
this.maxNaturalPrice = this.toNumber(
getProperty("accountval_maxNaturalPrice")
);
}

const errors: string[] = [];
const defaultValues: unknown[] = [];
const wasSet: string[] = [];
Expand Down

0 comments on commit 7dd2488

Please sign in to comment.