aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorEmpa <42304516+ItsEmpa@users.noreply.github.com>2024-03-11 17:43:10 +0100
committerGitHub <noreply@github.com>2024-03-11 17:43:10 +0100
commitc59e76b4968f18bd91bc46834913cab0fcbf670a (patch)
tree8e13c13e7741999dab62e53acb9d8da75fc4a4a5 /src/main
parentfc685f298cccbc832094bfa3c115f82bc155b228 (diff)
downloadskyhanni-c59e76b4968f18bd91bc46834913cab0fcbf670a.tar.gz
skyhanni-c59e76b4968f18bd91bc46834913cab0fcbf670a.tar.bz2
skyhanni-c59e76b4968f18bd91bc46834913cab0fcbf670a.zip
Pet rarity on pet drop message (#1136)
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/chat/ChatConfig.java10
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/chat/RareDropMessages.kt37
3 files changed, 49 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
index 77b68cf15..107998d05 100644
--- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
+++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
@@ -66,6 +66,7 @@ import at.hannibal2.skyhanni.features.chat.ChatFilter
import at.hannibal2.skyhanni.features.chat.CompactBestiaryChatMessage
import at.hannibal2.skyhanni.features.chat.CompactSplashPotionMessage
import at.hannibal2.skyhanni.features.chat.PlayerDeathMessages
+import at.hannibal2.skyhanni.features.chat.RareDropMessages
import at.hannibal2.skyhanni.features.chat.SkyblockXPInChat
import at.hannibal2.skyhanni.features.chat.Translator
import at.hannibal2.skyhanni.features.chat.WatchdogHider
@@ -769,6 +770,7 @@ class SkyHanniMod {
loadModule(SuperCraftFeatures())
loadModule(InfernoMinionFeatures())
loadModule(LimboPlaytime())
+ loadModule(RareDropMessages())
init()
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/chat/ChatConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/chat/ChatConfig.java
index 16ffec127..597096db0 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/chat/ChatConfig.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/chat/ChatConfig.java
@@ -136,4 +136,14 @@ public class ChatConfig {
@ConfigEditorBoolean
@FeatureToggle
public boolean hideSkyMall = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Pet Drop Rarity",
+ desc = "Shows what rarity the pet drop is in the pet drop message.\n" +
+ "§6§lPET DROP! §5§lEPIC §5Slug §6(§6+1300☘)"
+ )
+ @ConfigEditorBoolean
+ @FeatureToggle
+ public boolean petRarityDropMessage = true;
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/RareDropMessages.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/RareDropMessages.kt
new file mode 100644
index 000000000..6d67b757a
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/features/chat/RareDropMessages.kt
@@ -0,0 +1,37 @@
+package at.hannibal2.skyhanni.features.chat
+
+import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.events.LorenzChatEvent
+import at.hannibal2.skyhanni.utils.LorenzUtils
+import at.hannibal2.skyhanni.utils.LorenzUtils.colorCodeToRarity
+import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher
+import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern
+import net.minecraft.util.ChatComponentText
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+
+class RareDropMessages {
+
+ private val petDropPattern by RepoPattern.pattern(
+ "pet.petdropmessage",
+ "(?<typeOfDrop>§6§lPET DROP!|§5§lGREAT CATCH! §r§bYou found a §r§7\\[Lvl 1]) (?:§r)?§(?<rarityColor>.)(?<petName>[^§(.]+)(?<magicFindOrFarmingFortune>.*)"
+ )
+
+ private val config get() = SkyHanniMod.feature.chat.petRarityDropMessage
+
+ @SubscribeEvent
+ fun onChat(event: LorenzChatEvent) {
+ if (!LorenzUtils.inSkyBlock) return
+ if (!config) return
+
+ petDropPattern.matchMatcher(event.message) {
+ val typeOfDrop = group("typeOfDrop")
+ val rarityColor = group("rarityColor")
+ val petName = group("petName")
+ val magicFindOrFarmingFortune = group("magicFindOrFarmingFortune")
+
+ event.chatComponent = ChatComponentText(
+ "$typeOfDrop §$rarityColor§l${colorCodeToRarity(rarityColor.first()).uppercase()} §$rarityColor$petName$magicFindOrFarmingFortune"
+ )
+ } ?: return
+ }
+}