compost tracking: fix tracking fertile soil with ash covered tome
This commit is contained in:
@@ -76,7 +76,7 @@ public class CompostTracker
|
||||
private static final Pattern COMPOST_USED_ON_PATCH = Pattern.compile(
|
||||
"You treat the .+ with (?<compostType>ultra|super|)compost\\.");
|
||||
private static final Pattern FERTILE_SOIL_CAST = Pattern.compile(
|
||||
"The .+ has been treated with (?<compostType>ultra|super|)compost\\.");
|
||||
"^The .+ has been treated with (?<compostType>ultra|super|)compost");
|
||||
private static final Pattern ALREADY_TREATED = Pattern.compile(
|
||||
"This .+ has already been (treated|fertilised) with (?<compostType>ultra|super|)compost(?: - the spell can't make it any more fertile)?\\.");
|
||||
private static final Pattern INSPECT_PATCH = Pattern.compile(
|
||||
@@ -271,7 +271,7 @@ public class CompostTracker
|
||||
|
||||
Matcher matcher;
|
||||
if ((matcher = COMPOST_USED_ON_PATCH.matcher(chatMessage)).matches() ||
|
||||
(matcher = FERTILE_SOIL_CAST.matcher(chatMessage)).matches() ||
|
||||
(matcher = FERTILE_SOIL_CAST.matcher(chatMessage)).find() ||
|
||||
(matcher = ALREADY_TREATED.matcher(chatMessage)).matches() ||
|
||||
(matcher = INSPECT_PATCH.matcher(chatMessage)).matches())
|
||||
{
|
||||
|
||||
@@ -320,4 +320,16 @@ public class CompostTrackerTest
|
||||
verify(configManager).setRSProfileConfiguration("timetracking", "MOCK.compost", CompostState.SUPERCOMPOST);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onChatMessage_volcanicAsh()
|
||||
{
|
||||
ChatMessage chatEvent = mock(ChatMessage.class);
|
||||
when(chatEvent.getType()).thenReturn(ChatMessageType.SPAM);
|
||||
when(chatEvent.getMessage()).thenReturn("The fruit tree patch has been treated with ultracompost consuming 2 of your volcanic ash.");
|
||||
|
||||
compostTracker.pendingCompostActions.put(farmingPatch, new CompostTracker.PendingCompost(Instant.MAX, worldPoint, farmingPatch));
|
||||
compostTracker.onChatMessage(chatEvent);
|
||||
|
||||
verify(configManager).setRSProfileConfiguration("timetracking", "MOCK.compost", CompostState.ULTRACOMPOST);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user