From 1c3ccdf3a94b73161f0939d9541ff125b446f34e Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 2 Jun 2022 12:41:33 -0400 Subject: [PATCH] chat commands: fix !lvl cox cm The command could not work before because the capitalize in longBossName would produce a capital Of causing the hiscore skill name to not match. This normalizes from the hiscore name by removing : to compare it to our internal boss names. --- .../client/plugins/chatcommands/ChatCommandsPlugin.java | 5 ++++- .../client/plugins/chatcommands/ChatCommandsPluginTest.java | 6 +++--- 2 files changed, 7 insertions(+), 4 deletions(-) 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 32a552aebe..d1c114db9e 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 @@ -2044,6 +2044,7 @@ public class ChatCommandsPlugin extends Plugin return "Chambers of Xeric 24+ players"; // Chambers of Xeric Challenge Mode + case "chambers of xeric: challenge mode": case "cox cm": case "xeric cm": case "chambers cm": @@ -2433,7 +2434,9 @@ public class ChatCommandsPlugin extends Plugin } for (HiscoreSkill skill : HiscoreSkill.values()) { - if (skill.getName().equals(s)) + // longBossName the skill name to normalize from hiscore name + // to our internal name (removing the colon) + if (longBossName(skill.getName()).equals(s)) { return skill; } 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 08090286cd..2217626a3f 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 @@ -618,7 +618,7 @@ public class ChatCommandsPluginTest HiscoreResult hiscoreResult = new HiscoreResult(); hiscoreResult.setPlayer(PLAYER_NAME); - hiscoreResult.setZulrah(new Skill(10, 1000, -1)); + hiscoreResult.setChambersOfXericChallengeMode(new Skill(10, 1000, -1)); when(hiscoreClient.lookup(eq(PLAYER_NAME), nullable(HiscoreEndpoint.class))).thenReturn(hiscoreResult); @@ -628,9 +628,9 @@ public class ChatCommandsPluginTest chatMessage.setType(ChatMessageType.PUBLICCHAT); chatMessage.setName(PLAYER_NAME); chatMessage.setMessageNode(messageNode); - chatCommandsPlugin.playerSkillLookup(chatMessage, "!lvl zulrah"); + chatCommandsPlugin.playerSkillLookup(chatMessage, "!lvl cox cm"); - verify(messageNode).setRuneLiteFormatMessage("Level Zulrah: 1000 Rank: 10"); + verify(messageNode).setRuneLiteFormatMessage("Level Chambers of Xeric: Challenge Mode: 1000 Rank: 10"); } @Test