Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests for quest tracking in The Sea #1313

Merged
merged 13 commits into from Nov 27, 2022
1 change: 1 addition & 0 deletions src/data/defaults.txt
Expand Up @@ -762,6 +762,7 @@ user hpAutoRecoveryTarget 1.0
user iceSculptureMonster
user iceSwagger 0
user implementGlitchItem false
user intenseCurrents false
user invalidBuffMessage You sent an amount which does not correspond to a valid buff amount.
user itemBoughtPerAscension637 false
user itemBoughtPerAscension8266 false
Expand Down
3 changes: 3 additions & 0 deletions src/net/sourceforge/kolmafia/objectpool/ItemPool.java
Expand Up @@ -1141,6 +1141,7 @@ public class ItemPool {
public static final int AQUAVIOLET_JUBJUB_BIRD = 3800;
public static final int CRIMSILION_JUBJUB_BIRD = 3801;
public static final int CHARPUCE_JUBJUB_BIRD = 3802;
public static final int MERKIN_TRAILMAP = 3808;
public static final int MERKIN_LOCKKEY = 3810;
public static final int MERKIN_STASHBOX = 3811;
public static final int SEA_RADISH = 3817;
Expand Down Expand Up @@ -1301,6 +1302,8 @@ public class ItemPool {
public static final int RAVE_VISOR = 4193;
public static final int BAGGY_RAVE_PANTS = 4194;
public static final int PACIFIER_NECKLACE = 4195;
public static final int SEA_COWBELL = 4196;
public static final int SEA_LASSO = 4198;
public static final int MERKIN_CHEATSHEET = 4204;
public static final int MERKIN_WORDQUIZ = 4205;
public static final int SKATE_PARK_MAP = 4222;
Expand Down
Expand Up @@ -296,6 +296,7 @@ public class Preferences {
"highTopPumped",
"homebodylCharges",
"iceSculptureMonster",
"intenseCurrents",
"itemBoughtPerAscension10790",
"itemBoughtPerAscension10794",
"itemBoughtPerAscension10795",
Expand Down
10 changes: 10 additions & 0 deletions src/net/sourceforge/kolmafia/request/UseItemRequest.java
Expand Up @@ -4666,6 +4666,12 @@ else if (responseText.contains("chows down")) {
// Otherwise, it is not consumed
return;

case ItemPool.MERKIN_TRAILMAP:
// You follow the Mer-kin trailmap to an area of the sea floor where the currents are
// powerful enough to rip a map right out of your hands.
Preferences.setBoolean("intenseCurrents", true);
break;

case ItemPool.MERKIN_STASHBOX:
ResultProcessor.removeItem(ItemPool.MERKIN_LOCKKEY);
break;
Expand Down Expand Up @@ -5913,6 +5919,10 @@ else if (responseText.contains("You can't figure out the angle")) {
}
// ResponseTextParser learned this recipe
break;

case ItemPool.WRIGGLING_FLYTRAP_PELLET:
QuestDatabase.setQuestProgress(Quest.SEA_MONKEES, QuestDatabase.STARTED);
break;
}

if (CampgroundRequest.isWorkshedItem(itemId)) {
Expand Down
18 changes: 15 additions & 3 deletions src/net/sourceforge/kolmafia/session/ChoiceControl.java
Expand Up @@ -4781,16 +4781,28 @@ public static void postChoice2(final String urlString, final GenericRequest requ

case 299:
// Down at the Hatch
if (ChoiceManager.lastDecision == 2) {
// The first time you take option 2, you
if (ChoiceManager.lastDecision == 1) {
// The first time you take option 1, you
// release Big Brother. Subsequent times, you
// release other creatures.
QuestDatabase.setQuestIfBetter(Quest.SEA_MONKEES, "step2");
Preferences.setBoolean("bigBrotherRescued", true);
QuestDatabase.setQuestProgress(Quest.SEA_MONKEES, "step2");
ConcoctionDatabase.setRefreshNeeded(false);
}
break;

case 302:
case 303:
// You've Hit Bottom (Pastamancer, Sauceror)
case 306:
// Not a Micro Fish (Seal Clubber, Turtle Tamer)
case 307:
// Ode to the Sea (Disco Bandit)
case 308:
// Boxing the Juke (Accordion Thief)
QuestDatabase.setQuestIfBetter(Quest.SEA_MONKEES, "step5");
break;

case 304:
// A Vent Horizon

Expand Down
70 changes: 46 additions & 24 deletions src/net/sourceforge/kolmafia/session/QuestManager.java
Expand Up @@ -210,9 +210,6 @@ public static final void handleQuestChange(GenericRequest request) {
case AdventurePool.ICE_HOLE:
handleAirportChange(location, responseText);
break;
case AdventurePool.MARINARA_TRENCH:
case AdventurePool.ANENOME_MINE:
case AdventurePool.DIVE_BAR:
case AdventurePool.MERKIN_OUTPOST:
case AdventurePool.CALIGINOUS_ABYSS:
handleSeaChange(location, responseText);
Expand Down Expand Up @@ -388,6 +385,8 @@ public static final void handleQuestChange(GenericRequest request) {
}
} else if (location.startsWith("questlog")) {
QuestLogRequest.registerQuests(false, location, responseText);
} else if (location.startsWith("sea_merkin")) {
handleSeaChange(location, responseText);
} else if (location.startsWith("seafloor")) {
handleSeaChange(location, responseText);
} else if (location.startsWith("tavern")) {
Expand Down Expand Up @@ -1256,11 +1255,21 @@ private static void handleHighlandsChange(final String location, final String re
}
}

// Easily navigating the intense currents atop your trusty seahorse
// <b>Shimmerswim</b>, you crest an undersea ridge and discover, spread
// out beneath you, a magnificent Mer-kin City!
private static final Pattern SEAHORSE_PATTERN =
Pattern.compile("atop your trusty seahorse <b>(.*?)</b>");

private static void handleSeaChange(final String location, final String responseText) {
int area = AdventureRequest.parseArea(location);
if (location.contains("action=oldman_oldman")
&& responseText.contains("have you found my boot yet?")) {
QuestDatabase.setQuestProgress(Quest.SEA_OLD_GUY, QuestDatabase.STARTED);
if (location.contains("action=oldman_oldman")) {
if (responseText.contains("I lost my favorite boot, you see.")
|| responseText.contains("have you found my boot yet?")) {
QuestDatabase.setQuestProgress(Quest.SEA_OLD_GUY, QuestDatabase.STARTED);
} else if (responseText.contains("The old man snores fitfully")) {
QuestDatabase.setQuestProgress(Quest.SEA_OLD_GUY, QuestDatabase.FINISHED);
}
}
// Little Brother
else if (location.contains("who=1")) {
Expand Down Expand Up @@ -1292,23 +1301,15 @@ else if (location.contains("action=grandpastory")) {
} else if (responseText.contains("Gonna need one of them seahorses")) {
Preferences.setBoolean("corralUnlocked", true);
}
} else if (area == AdventurePool.MARINARA_TRENCH
&& responseText.contains("Show me what you've found, Old Timer")) {
QuestDatabase.setQuestProgress(Quest.SEA_MONKEES, "step5");
} else if (area == AdventurePool.ANENOME_MINE
&& responseText.contains("Sure, kid. I can teach you a thing or two")) {
QuestDatabase.setQuestProgress(Quest.SEA_MONKEES, "step5");
} else if (area == AdventurePool.DIVE_BAR
&& (responseText.contains("What causes these things to form?")
|| responseText.contains("what is that divine instrument?"))) {
QuestDatabase.setQuestProgress(Quest.SEA_MONKEES, "step5");
} else if (area == AdventurePool.MERKIN_OUTPOST
&& responseText.contains("Phew, that was a close one")) {
QuestDatabase.setQuestProgress(Quest.SEA_MONKEES, "step9");
ConcoctionDatabase.setRefreshNeeded(false);
} else if (area == AdventurePool.CALIGINOUS_ABYSS
&& responseText.contains("I should get dinner on the table for the boys")) {
QuestDatabase.setQuestProgress(Quest.SEA_MONKEES, QuestDatabase.FINISHED);
} else if (area == AdventurePool.MERKIN_OUTPOST) {
if (responseText.contains("Phew, that was a close one")) {
QuestDatabase.setQuestProgress(Quest.SEA_MONKEES, "step9");
ConcoctionDatabase.setRefreshNeeded(false);
}
} else if (area == AdventurePool.CALIGINOUS_ABYSS) {
if (responseText.contains("I should get dinner on the table for the boys")) {
QuestDatabase.setQuestProgress(Quest.SEA_MONKEES, QuestDatabase.FINISHED);
}
}
// Learn about quest progress if visiting sea floor
else if (location.startsWith("seafloor")) {
Expand All @@ -1318,6 +1319,8 @@ else if (location.startsWith("seafloor")) {
QuestDatabase.setQuestIfBetter(Quest.SEA_MONKEES, "step6");
} else if (responseText.contains("shipwreck")) {
QuestDatabase.setQuestIfBetter(Quest.SEA_MONKEES, "step1");
} else if (responseText.contains("monkeycastle")) {
QuestDatabase.setQuestIfBetter(Quest.SEA_MONKEES, QuestDatabase.STARTED);
}

if (responseText.contains("mine")) {
Expand All @@ -1341,28 +1344,47 @@ else if (location.startsWith("seafloor")) {
Preferences.setBoolean("mapToTheDiveBarPurchased", true);
}

if (responseText.contains("reefa")) {
if (responseText.contains("reef")) {
Preferences.setBoolean("mapToMadnessReefPurchased", true);
}

if (responseText.contains("skatepark")) {
Preferences.setBoolean("mapToTheSkateParkPurchased", true);
}

if (responseText.contains("currents")) {
Preferences.setBoolean("intenseCurrents", true);
}

if (responseText.contains("corral")) {
Preferences.setBoolean("corralUnlocked", true);
}
}
// Learn about quest progress if visiting sea monkey castle
else if (location.startsWith("monkeycastle")) {
if (responseText.contains("who=4")) {
// Mom
QuestDatabase.setQuestIfBetter(Quest.SEA_MONKEES, QuestDatabase.FINISHED);
} else if (responseText.contains("whichshop=grandma")) {
// Grandma
QuestDatabase.setQuestIfBetter(Quest.SEA_MONKEES, "step9");
} else if (responseText.contains("who=3")) {
// Grandpa
QuestDatabase.setQuestIfBetter(Quest.SEA_MONKEES, "step5");
} else if (responseText.contains("who=2")) {
// Big Brother
QuestDatabase.setQuestIfBetter(Quest.SEA_MONKEES, "step2");
Preferences.setBoolean("bigBrotherRescued", true);
} else if (responseText.contains("who=1")) {
// Little Brother
QuestDatabase.setQuestIfBetter(Quest.SEA_MONKEES, QuestDatabase.STARTED);
}
}
// Learn seahorse name by visiting Mer-Kin Deepcity
else if (location.startsWith("sea_merkin")) {
Matcher m = SEAHORSE_PATTERN.matcher(responseText);
if (m.find()) {
Preferences.setString("seahorseName", m.group(1));
}
}
}
Expand Down
6 changes: 1 addition & 5 deletions src/net/sourceforge/kolmafia/session/ResultProcessor.java
Expand Up @@ -2096,12 +2096,8 @@ private static void gainItem(boolean adventureResults, AdventureResult result) {
QuestDatabase.setQuestProgress(Quest.SEA_OLD_GUY, QuestDatabase.STARTED);
break;

case ItemPool.WRIGGLING_FLYTRAP_PELLET:
QuestDatabase.setQuestProgress(Quest.SEA_MONKEES, QuestDatabase.STARTED);
break;

case ItemPool.BUBBLIN_STONE:
QuestDatabase.setQuestProgress(Quest.SEA_MONKEES, "step3");
QuestDatabase.setQuestIfBetter(Quest.SEA_MONKEES, "step3");
break;

case ItemPool.DAS_BOOT:
Expand Down