Repository: runelite/runelite
Pull request #18232 (2024-09-04 10:40:56)

chat commands: add bird's egg sacrifices kc
This adds a chat command to track the kc of bird's eggs sacrificed at the shrine in the woodcutting guild.

Discussion: https://github.com/runelite/runelite/discussions/18230

Breina: Thanks for the feedback, updated code accordingly.

In-game screenshot:

![image](https://github.com/user-attachments/assets/61c60379-5bad-4811-aedc-a157c65f3d5c)

umer-rs: I'm not 100% certain but with 1 egg offered it may say `You have made <col=ff0000>one</col> offering.
Adam-: If you can get some offering debug messages from the game and add a test case for them that would be good.
Breina: @umer-rs good call! You were right.

![image](https://github.com/user-attachments/assets/d937963c-1db8-4aee-a01c-572a9337d399)

@Adam- test case added. Sorry for not doing that in the first place.

Patch:
diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsPlugin.java
index 8524914f4..6840e258e 100644
--- a/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsPlugin.java
+++ b/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsPlugin.java
@@ -124,6 +124,7 @@ public class ChatCommandsPlugin extends Plugin
 	private static final Pattern COLLECTION_LOG_ITEM_PATTERN = Pattern.compile("New item added to your collection log: (.*)");
 	private static final Pattern GUARDIANS_OF_THE_RIFT_PATTERN = Pattern.compile("Amount of Rifts you have closed: <col=ff0000>([0-9,]+)</col>.", Pattern.CASE_INSENSITIVE);
 	private static final Pattern HUNTER_RUMOUR_KC_PATTERN = Pattern.compile("You have completed <col=[0-9a-f]{6}>([0-9,]+)</col> rumours? for the Hunter Guild.");
+	private static final Pattern BIRD_EGG_OFFERING_PATTERN = Pattern.compile("You have made <col=ff0000>(?<kc>[\\d,]+|one)</col> offerings?.");
 
 	private static final String TOTAL_LEVEL_COMMAND_STRING = "!total";
 	private static final String PRICE_COMMAND_STRING = "!price";
@@ -625,6 +626,17 @@ public class ChatCommandsPlugin extends Plugin
 			int kc = Integer.parseInt(matcher.group(1));
 			setKc("Guardians of the Rift", kc);
 		}
+
+		matcher = BIRD_EGG_OFFERING_PATTERN.matcher(message);
+		if (matcher.find())
+		{
+			String kcString = matcher.group("kc");
+			int kc = kcString.equals("one")
+				? 1
+				: Integer.parseInt(kcString.replaceAll(",", ""));
+
+			setKc("Bird's egg offerings", kc);
+		}
 	}
 
 	@VisibleForTesting
@@ -2534,6 +2546,12 @@ public class ChatCommandsPlugin extends Plugin
 			case "fortis colosseum":
 				return "Sol Heredit";
 
+			case "bird egg":
+			case "bird eggs":
+			case "bird's egg":
+			case "bird's eggs":
+				return "Bird's egg offerings";
+
 			default:
 				return WordUtils.capitalize(boss);
 		}


Test patch:
diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/chatcommands/ChatCommandsPluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/chatcommands/ChatCommandsPluginTest.java
index 4697843f5..55acf05e8 100644
--- a/runelite-client/src/test/java/net/runelite/client/plugins/chatcommands/ChatCommandsPluginTest.java
+++ b/runelite-client/src/test/java/net/runelite/client/plugins/chatcommands/ChatCommandsPluginTest.java
@@ -1272,6 +1272,25 @@ public class ChatCommandsPluginTest
 		verify(configManager).setRSProfileConfiguration("killcount", "guardians of the rift", 167);
 	}
 
+	@Test
+	public void testBirdsEgg()
+	{
+		ChatMessage chatMessage = new ChatMessage(null, GAMEMESSAGE, "", "You have made <col=ff0000>one</col> offering.", null, 0);
+		chatCommandsPlugin.onChatMessage(chatMessage);
+
+		verify(configManager).setRSProfileConfiguration("killcount", "bird's egg offerings", 1);
+
+		chatMessage = new ChatMessage(null, GAMEMESSAGE, "", "You have made <col=ff0000>420</col> offerings.", null, 0);
+		chatCommandsPlugin.onChatMessage(chatMessage);
+
+		verify(configManager).setRSProfileConfiguration("killcount", "bird's egg offerings", 420);
+
+		chatMessage = new ChatMessage(null, GAMEMESSAGE, "", "You have made <col=ff0000>10,000</col> offerings.", null, 0);
+		chatCommandsPlugin.onChatMessage(chatMessage);
+
+		verify(configManager).setRSProfileConfiguration("killcount", "bird's egg offerings", 10_000);
+	}
+
 	@Test
 	public void testHunterRumours()
 	{