@@ -36,6 +36,7 @@ public class ChocolateFactorySolver extends ContainerSolver {
36
36
private static final Pattern CHOCOLATE_PATTERN = Pattern .compile ("^([\\ d,]+) Chocolate$" );
37
37
private static final Pattern PRESTIGE_REQUIREMENT_PATTERN = Pattern .compile ("Chocolate this Prestige: ([\\ d,]+) +Requires (\\ S+) Chocolate this Prestige!" );
38
38
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\\ ." );
39
40
40
41
private static final ObjectArrayList <Rabbit > cpsIncreaseFactors = new ObjectArrayList <>(8 );
41
42
private static long totalChocolate = -1L ;
@@ -149,6 +150,7 @@ private static void updateFactoryInfo(Int2ObjectMap<ItemStack> slots) {
149
150
if (NumberUtils .isParsable (amountString )) {
150
151
requiredUntilNextPrestige = Long .parseLong (amountString ) - currentChocolate .getAsLong ();
151
152
}
153
+ canPrestige = false ;
152
154
} else if (prestigeLore .endsWith ("Click to prestige!" )) {
153
155
canPrestige = true ;
154
156
reachedMaxPrestige = false ;
@@ -159,9 +161,11 @@ private static void updateFactoryInfo(Int2ObjectMap<ItemStack> slots) {
159
161
160
162
//Time Tower is in slot 39
161
163
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 )) {
165
169
isTimeTowerActive = timeTowerStatusMatcher .group (1 ).equals ("ACTIVE" );
166
170
}
167
171
0 commit comments