Skip to content

Commit

Permalink
correct typo in Designer Sweatpants regexp (#71)
Browse files Browse the repository at this point in the history
* correct typo in Designer Sweatpants regexp

* make sweatpants less noisy (#72)

* make sweatpants less noisy

* use bar as delimiter instead

* Update packages/excavator-projects/projects/designerSweatpants.ts

* Update packages/excavator-projects/projects/designerSweatpants.ts

---------

Co-authored-by: Joe Kirchoff <Kirchoff.Joseph.P@gmail.com>

---------

Co-authored-by: Joe Kirchoff <Kirchoff.Joseph.P@gmail.com>
  • Loading branch information
horrible-little-slime and Rinn committed Apr 12, 2024
1 parent e8bf7c7 commit 319e4b2
Showing 1 changed file with 27 additions and 5 deletions.
32 changes: 27 additions & 5 deletions packages/excavator-projects/projects/designerSweatpants.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
import { currentRound, Item, equippedItem, Slot, myLocation } from "kolmafia";
import {
currentRound,
Item,
equippedItem,
Slot,
myLocation,
getProperty,
setProperty,
} from "kolmafia";

import { ExcavatorProject } from "../type";
import { toNormalisedString } from "../utils";
Expand All @@ -9,13 +17,27 @@ function spadeSweatpants(encounter: string, page: string) {
!Item.get(["designer sweatpants", "replica designer sweatpants"]).includes(
equippedItem(Slot.get("pants")),
)
)
) {
return null;
const sweat = page.match(/You get (\d)% sweatier/)?.[1];
}

const sweat = Number(page.match(/You get (\d)% Sweatier/)?.[1]);
if (!sweat) return null;

const location = toNormalisedString(myLocation());
const reportedLocations = getProperty("excavatorSweatpantsLocations").split(
"|",
);
if (reportedLocations.includes(location)) return null;

setProperty(
"excavatorSweatpantsLocations",
[...reportedLocations, location].join("|"),
);

return {
location: toNormalisedString(myLocation()),
sweat: Number(sweat),
location,
sweat,
};
}

Expand Down

0 comments on commit 319e4b2

Please sign in to comment.