Skip to content

Commit

Permalink
Many fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
phulin committed Nov 12, 2024
1 parent 632661e commit aa4662c
Show file tree
Hide file tree
Showing 15 changed files with 98 additions and 48 deletions.
5 changes: 4 additions & 1 deletion src/components/LocationBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { parentPlaceLink } from "../util/links";
import { plural } from "../util/text";

import AutocompleteInput from "./AutocompleteInput";
import Line from "./Line";
import MainLink from "./MainLink";
import Monsters from "./Monsters";

Expand Down Expand Up @@ -105,7 +106,9 @@ const LocationBar: FC<StackProps> = (props) => {
fontSize="xs"
display={showDetails || autoHasFocus ? "flex" : "none"}
>
<Monsters location={location} />
<Line>
<Monsters location={location} />
</Line>
<Text>
Combat Queue:{" "}
{combatQueue.length === 0 ? "empty" : combatQueue.join(" → ")}
Expand Down
6 changes: 5 additions & 1 deletion src/components/Monsters.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,11 @@ const Monsters: FC<MonstersLineProps> = ({ location, target = [] }) => {
return targets.includes(monster) ? (
<Text as="b">{text}</Text>
) : banisher ? (
<Tooltip hasArrow label={`Banished: ${banisher.name}`}>
<Tooltip
display="inline"
hasArrow
label={`Banished: ${banisher.name}`}
>
<Text as="span" color="gray.500">
{text}
</Text>
Expand Down
13 changes: 9 additions & 4 deletions src/questInfo/delay.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { Location } from "kolmafia";
import { $location } from "libram";
import { $item, $location } from "libram";

import { haveUnrestricted } from "../util/available";

import { haveMachete, lianasCanBeFree } from "./hiddenCity";

interface ZoneDelay {
zone: Location;
length: number;
length: number | (() => number);
needed?: () => boolean;
}

Expand All @@ -29,7 +31,7 @@ export const DELAY_ZONES: ZoneDelay[] = [
},
{
zone: $location`The Penultimate Fantasy Airship`,
length: 25,
length: haveUnrestricted($item`bat wings`) ? 20 : 25,
},
{
zone: $location`The Hidden Park`,
Expand Down Expand Up @@ -70,6 +72,9 @@ export const DELAY_ZONES: ZoneDelay[] = [
export function remainingDelay() {
return DELAY_ZONES.map(({ zone, length, needed }) => ({
zone,
remaining: needed === undefined || needed() ? length - zone.turnsSpent : 0,
remaining:
needed === undefined || needed()
? (typeof length === "function" ? length() : length) - zone.turnsSpent
: 0,
})).filter(({ remaining }) => remaining > 0);
}
14 changes: 7 additions & 7 deletions src/sections/quests/Level10.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,13 @@ const Level10: FC = () => {
[
7,
<>
{(!haveEquipped($item`amulet of extreme plot significance`) ||
!haveEquipped($item`titanium assault umbrella`) ||
!haveEquipped($item`unbreakable umbrella`)) && (
<Line fontWeight="bold" color="red.500">
Equip an umbrella or the amulet of extreme plot significance.
</Line>
)}
{!haveEquipped($item`amulet of extreme plot significance`) &&
!haveEquipped($item`titanium assault umbrella`) &&
!haveEquipped($item`unbreakable umbrella`) && (
<Line fontWeight="bold" color="red.500">
Equip an umbrella or the amulet of extreme plot significance.
</Line>
)}
<Line>Maximize -combat and adventure in the castle basement.</Line>
</>,
],
Expand Down
4 changes: 2 additions & 2 deletions src/sections/quests/Level12.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -164,13 +164,13 @@ const Level12: FC = () => {
{step >= 1 && (
<>
{get("sidequestArenaCompleted") === "none" && (
<Arena disabled={openQuests.includes("Arena")} />
<Arena disabled={!openQuests.includes("Arena")} />
)}
{get("sidequestJunkyardCompleted") === "none" && <Junkyard />}
{get("sidequestLighthouseCompleted") === "none" && <Lighthouse />}
{get("sidequestOrchardCompleted") === "none" && <Orchard />}
{get("sidequestNunsCompleted") === "none" && (
<Nuns disabled={openQuests.includes("Nuns")} />
<Nuns disabled={!openQuests.includes("Nuns")} />
)}
{get("sidequestFarmCompleted") === "none" && <Farm />}
</>
Expand Down
10 changes: 3 additions & 7 deletions src/sections/quests/Level7.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,8 @@ const Level7: FC = () => {
id: "level-7-evil-eye-nag",
priority: NagPriority.MID,
node: evilEyeCount > 0 && nookEvil > 13 && (
<Tile
header={header}
imageUrl="/images/itemimages/zomboeye.gif"
linkedContent={$item`evil eye`}
>
<Line>
<Tile header={header} imageUrl="/images/itemimages/zomboeye.gif">
<Line command={`use ${evilEyeCount} evil eye`}>
You have {plural(evilEyeCount, "evil eye")}. Use{" "}
{evilEyeCount === 1 ? "it" : "them"} to reduce Nook evilness by{" "}
{evilEyeCount * 3}.
Expand Down Expand Up @@ -195,7 +191,7 @@ const Level7: FC = () => {
"Pick 4th option in NC.",
])}
{getZoneDisplay("Alcove", alcoveEvil, "+init, -combat", [
`${(Math.min(100, 150 + initiativeModifier()) / 10).toFixed(
`${Math.min(100, (150 + initiativeModifier()) / 10).toFixed(
1,
)}% chance of modern zmobie (${Math.ceil(
(alcoveEvil - 13) / 5,
Expand Down
17 changes: 14 additions & 3 deletions src/sections/quests/Level8.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
import { itemAmount, numericModifier, toItem } from "kolmafia";
import { $item, $location, $monster, get, have, questStep } from "libram";
import { itemAmount, myPath, numericModifier, toItem } from "kolmafia";
import {
$item,
$location,
$monster,
$path,
get,
have,
questStep,
} from "libram";
import { FC } from "react";

import Line from "../../components/Line";
Expand All @@ -25,7 +33,10 @@ const Level8: FC = () => {

const coldRes = Math.floor(numericModifier("Cold Resistance"));

const yetiCount = $location`Mist-Shrouded Peak`.turnsSpent;
const yetiCount = Math.floor(
$location`Mist-Shrouded Peak`.turnsSpent /
(myPath() === $path`Avant Guard` ? 2 : 1),
);

if (step === Step.FINISHED) return null;

Expand Down
4 changes: 2 additions & 2 deletions src/sections/quests/level11/HiddenCity.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ const Office = () => {
];
const neededFiles = have($item`McClusky file (complete)`)
? 0
: 5 - files.findIndex((file) => !have(file));
: files.filter((file) => !have(file)).length;

const office = $location`The Hidden Office Building`;
const nextHoliday = office.forceNoncombat + office.lastNoncombatTurnsSpent;
Expand Down Expand Up @@ -297,7 +297,7 @@ const BowlingAlley = () => {
<Line href={CITY_LINK} fontWeight="bold">
Hidden Bowling Alley
</Line>
{haveCcsc && !ccscEquipped && (
{haveCcsc && canSkipRoll && !ccscEquipped && (
<Line href={inventoryLink(candyCaneSwordCane)} fontWeight="bold">
Equip the candy cane sword cane to skip a roll.
</Line>
Expand Down
10 changes: 7 additions & 3 deletions src/sections/quests/level11/LordSpookyraven.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ const LordSpookyraven: FC = () => {

if (step === Step.FINISHED) return null;

const boilerFights = Math.ceil(
50.1 / (10 + Math.floor(Math.max(currentMl, 0) / 2)),
);
return (
<QuestTile
header={
Expand Down Expand Up @@ -173,11 +176,12 @@ const LordSpookyraven: FC = () => {
) : useFastRoute && haveUnstableFulminate ? (
<>
<Line href={CELLAR_LINK}>
Adventure in the haunted boiler room with +{mlNeeded} ML.
Adventure in the haunted boiler room
{mlNeeded > 0 && ` with +${mlNeeded} ML`}.
</Line>
<Line href={CELLAR_LINK}>
~{Math.ceil(50.1 / (10 + Math.floor(Math.max(currentMl, 0) / 2)))}{" "}
total boiler fights to charge fulminate.
{boilerFights > 1 ? `~${boilerFights}` : boilerFights} total boiler
fights to charge fulminate.
</Line>
</>
) : useFastRoute && !recipeWasAutoreadWithGlasses ? (
Expand Down
21 changes: 16 additions & 5 deletions src/sections/quests/level11/ZeppelinMob.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import { numericModifier } from "kolmafia";
import { haveEquipped, numericModifier } from "kolmafia";
import { $effect, $item, get, have } from "libram";

import Line from "../../../components/Line";
import { haveUnrestricted } from "../../../util/available";

const Zeppelin = () => {
const candyCaneSwordCane = $item`candy cane sword cane`;
const haveCcsc = haveUnrestricted(candyCaneSwordCane);
const sleazeProtestorsCleared = Math.max(
3,
Math.sqrt(
Expand All @@ -15,22 +18,30 @@ const Zeppelin = () => {
<>
{have($item`lynyrd musk`) && !have($effect`Musky`) && (
<Line color={"red"} href="/inventory.php?ftext=lynyrd+musk">
Use lynyrd musk
Use lynyrd musk.
</Line>
)}
{have($item`lynyrd snare`) && (
<Line href="/inventory.php?ftext=lynyrd+snare">
Possibly use lynyrd snare. (free combat)
</Line>
)}
{get("zeppelinProtestors") === 80 ? (
<Line>Adventure in the mob of protestors.</Line>
{get("zeppelinProtestors") >= 80 ? (
<Line>Finished. Adventure in the mob of protestors.</Line>
) : (
<>
{haveCcsc && !haveEquipped(candyCaneSwordCane) && (
<Line color="red.500" fontWeight="bold">
Equip your candy cane sword cane!
</Line>
)}
<Line>{80 - get("zeppelinProtestors")} protestors left.</Line>
<Line>
Sleaze damage will clear {sleazeProtestorsCleared.toFixed(1)}{" "}
protestors.
protestors
{haveCcsc &&
` (doubled to ${(sleazeProtestorsCleared * 2).toFixed(1)} with CCSC)`}
.
</Line>
</>
)}
Expand Down
7 changes: 5 additions & 2 deletions src/sections/quests/level11/ZeppelinShip.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { $item, get, have } from "libram";
import { myPath } from "kolmafia";
import { $item, $path, get, have } from "libram";

import Line from "../../../components/Line";

Expand All @@ -14,7 +15,9 @@ const ZeppelinShip = () => {
<Line color="red">Use glark cable in combat.</Line>
)}
<Line>Search for Ron in the Zeppelin</Line>
<Line>{get("_glarkCableUses")}/5 glark cables used. (free kills)</Line>
{myPath() !== $path`Avant Guard` && (
<Line>{get("_glarkCableUses")}/5 glark cables used. (free kills)</Line>
)}
</>
);
};
Expand Down
6 changes: 3 additions & 3 deletions src/sections/resources/2022/TinyStillsuit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
myInebriety,
} from "kolmafia";
import { $item, get } from "libram";
import { getHash } from "tome-kolmafia-lib";
import { getHashIfAvailable } from "tome-kolmafia-lib";

import AdviceTooltip from "../../../components/AdviceTooltip";
import Line from "../../../components/Line";
Expand Down Expand Up @@ -47,7 +47,7 @@ const TinyStillsuit = () => {
<Tile
header={`${sweatAdvs} adv stillsuit sweat booze`}
id="tiny-stillsuit-nag"
href={`/inventory.php?action=distill&pwd=${getHash()}`}
href={`/inventory.php?action=distill&pwd=${getHashIfAvailable()}`}
imageUrl="/images/itemimages/stillsuit.gif"
>
{familiarSweat > 449 ? (
Expand Down Expand Up @@ -124,7 +124,7 @@ const TinyStillsuit = () => {
<Tile
header={`${familiarSweat}/${sweatCalcSweat} drams of stillsuit sweat`}
linkedContent={tinyStillsuit}
href={`/inventory.php?action=distill&pwd=${getHash()}`}
href={`/inventory.php?action=distill&pwd=${getHashIfAvailable()}`}
>
{familiarSweat > 358 ? (
<>
Expand Down
2 changes: 1 addition & 1 deletion src/sections/resources/2023/BookOfFacts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const BookOfFacts = () => {
: "";
const eaglePhylumBanished =
get("banishedPhyla") !== ""
? Phylum.get(get("banishedPhyla").split(":")[1])
? Phylum.get(get("banishedPhyla").split(":")[0])
: null;
const olfactionString =
haveUnrestricted($skill`Transcendent Olfaction`) &&
Expand Down
2 changes: 1 addition & 1 deletion src/sections/resources/2023/PatrioticEagle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ const PatrioticEagle = () => {
const rwbMonster = get("rwbMonster");
const fightsLeft = Math.max(0, Math.min(get("rwbMonsterCount"), 2));
const screechRecharge = get("screechCombats");
const eaglePhylumBanished = Phylum.get(get("banishedPhyla").split(":")[1]);
const eaglePhylumBanished = Phylum.get(get("banishedPhyla").split(":")[0]);
const citizenOfAZone = $effect`Citizen of a Zone`;
const haveCitizen = have(citizenOfAZone);
const canUseCitizen =
Expand Down
25 changes: 19 additions & 6 deletions src/sections/resources/path/AvantGuard.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
import { ListItem, UnorderedList } from "@chakra-ui/react";
import { Monster, myPath } from "kolmafia";
import { $item, $monster, $path, get, have, questStep } from "libram";
import { Monster, myFamiliar, myPath } from "kolmafia";
import {
$familiar,
$item,
$monster,
$path,
get,
have,
questStep,
} from "libram";
import { FC } from "react";

import Line from "../../../components/Line";
Expand All @@ -12,6 +20,8 @@ const AvantGuard: FC = () => {
const pathCheck = myPath() === $path`Avant Guard`;
const charged = get("bodyguardCharge") >= 50;
const monster = get("bodyguardChatMonster");
const bodyguard = $familiar`Burly Bodyguard`;
const bodyguardOut = myFamiliar() === bodyguard;

useNag(() => {
const files = [
Expand Down Expand Up @@ -73,12 +83,14 @@ const AvantGuard: FC = () => {
(charged ? (
<Tile
header="Bodyguard ready to chat!"
href="/main.php?talktobg=1"
imageUrl="/images/itemimages/bodyguard.gif"
id="bodyguard-chat-nag"
href={bodyguardOut ? "/main.php?talktobg=1" : undefined}
linkedContent={bodyguard}
imageAlt="Burly Bodyguard"
>
<Line>
Your bodyguard is ready to talk to you. Recommended chats:
Your bodyguard is ready to talk to you.
{bodyguardOut && " Take them with you."} Recommended chats:
</Line>
<UnorderedList size="xs">
{recommended.map((monster) => (
Expand All @@ -89,6 +101,7 @@ const AvantGuard: FC = () => {
) : monster ? (
<Tile
header="Bodyguard chat next fight."
id="bodyguard-chat-nag"
imageUrl={`/images/adventureimages/${monster.image}`}
imageAlt={monster.name}
>
Expand All @@ -98,7 +111,7 @@ const AvantGuard: FC = () => {
</Tile>
) : null),
};
}, [charged, monster, pathCheck]);
}, [bodyguard, bodyguardOut, charged, monster, pathCheck]);

return null;
};
Expand Down

0 comments on commit aa4662c

Please sign in to comment.