Skip to content

Commit abd2332

Browse files
authored
Merge pull request SkyblockerMod#749 from Emirlol/chocolate-factory-hotfix-2
A couple of chocolate factory fixes
2 parents e46b849 + 33f4ef7 commit abd2332

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

src/main/java/de/hysky/skyblocker/skyblock/chocolatefactory/ChocolateFactorySolver.java

+7-3
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ public class ChocolateFactorySolver extends ContainerSolver {
3636
private static final Pattern CHOCOLATE_PATTERN = Pattern.compile("^([\\d,]+) Chocolate$");
3737
private static final Pattern PRESTIGE_REQUIREMENT_PATTERN = Pattern.compile("Chocolate this Prestige: ([\\d,]+) +Requires (\\S+) Chocolate this Prestige!");
3838
private static final Pattern TIME_TOWER_STATUS_PATTERN = Pattern.compile("Status: (ACTIVE|INACTIVE)");
39+
private static final Pattern TIME_TOWER_MULTIPLIER_PATTERN = Pattern.compile("by \\+([\\d.]+)x for \\dh\\.");
3940

4041
private static final ObjectArrayList<Rabbit> cpsIncreaseFactors = new ObjectArrayList<>(8);
4142
private static long totalChocolate = -1L;
@@ -149,6 +150,7 @@ private static void updateFactoryInfo(Int2ObjectMap<ItemStack> slots) {
149150
if (NumberUtils.isParsable(amountString)) {
150151
requiredUntilNextPrestige = Long.parseLong(amountString) - currentChocolate.getAsLong();
151152
}
153+
canPrestige = false;
152154
} else if (prestigeLore.endsWith("Click to prestige!")) {
153155
canPrestige = true;
154156
reachedMaxPrestige = false;
@@ -159,9 +161,11 @@ private static void updateFactoryInfo(Int2ObjectMap<ItemStack> slots) {
159161

160162
//Time Tower is in slot 39
161163
isTimeTowerMaxed = StringUtils.substringAfterLast(slots.get(TIME_TOWER_SLOT).getName().getString(), ' ').equals("XV");
162-
timeTowerMultiplier = RomanNumerals.romanToDecimal(StringUtils.substringAfterLast(slots.get(TIME_TOWER_SLOT).getName().getString(), ' ')) / 10.0; //The name holds the level, which is multiplier * 10 in roman numerals
163-
Matcher timeTowerStatusMatcher = TIME_TOWER_STATUS_PATTERN.matcher(getConcatenatedLore(slots.get(TIME_TOWER_SLOT)));
164-
if (timeTowerStatusMatcher.find()) {
164+
String timeTowerLore = getConcatenatedLore(slots.get(TIME_TOWER_SLOT));
165+
Matcher timeTowerMultiplierMatcher = TIME_TOWER_MULTIPLIER_PATTERN.matcher(timeTowerLore);
166+
RegexUtils.getDoubleFromMatcher(timeTowerMultiplierMatcher).ifPresent(d -> timeTowerMultiplier = d);
167+
Matcher timeTowerStatusMatcher = TIME_TOWER_STATUS_PATTERN.matcher(timeTowerLore);
168+
if (timeTowerStatusMatcher.find(timeTowerMultiplierMatcher.hasMatch() ? timeTowerMultiplierMatcher.end() : 0)) {
165169
isTimeTowerActive = timeTowerStatusMatcher.group(1).equals("ACTIVE");
166170
}
167171

src/main/java/de/hysky/skyblocker/skyblock/chocolatefactory/TimeTowerReminder.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@ private static void checkTempFile() {
8383
}
8484

8585
if (System.currentTimeMillis() - time >= 60 * 60 * 1000) sendMessage();
86-
else Scheduler.INSTANCE.schedule(TimeTowerReminder::sendMessage, 60 * 60 * 20 - (int) ((System.currentTimeMillis() - time) / 50)); // 50 milliseconds is 1 tick
86+
else {
87+
Scheduler.INSTANCE.schedule(TimeTowerReminder::sendMessage, 60 * 60 * 20 - (int) ((System.currentTimeMillis() - time) / 50)); // 50 milliseconds is 1 tick
88+
scheduled = true;
89+
}
8790
}
8891
}

0 commit comments

Comments
 (0)