aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/Features.java22
-rw-r--r--src/main/java/at/hannibal2/skyhanni/fishing/TrophyFishMessages.kt68
3 files changed, 91 insertions, 1 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java
index ab6629ed4..b100e5b36 100644
--- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java
+++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java
@@ -9,6 +9,7 @@ import at.hannibal2.skyhanni.config.Features;
import at.hannibal2.skyhanni.config.commands.Commands;
import at.hannibal2.skyhanni.dungeon.*;
import at.hannibal2.skyhanni.dungeon.damageindicator.DungeonBossDamageIndicator;
+import at.hannibal2.skyhanni.fishing.TrophyFishMessages;
import at.hannibal2.skyhanni.items.HideNotClickableItems;
import at.hannibal2.skyhanni.items.ItemDisplayOverlayFeatures;
import at.hannibal2.skyhanni.items.abilitycooldown.ItemAbilityCooldown;
@@ -65,6 +66,7 @@ public class SkyHanniMod {
MinecraftForge.EVENT_BUS.register(new DungeonDeathCounter());
MinecraftForge.EVENT_BUS.register(new DungeonCleanEnd());
MinecraftForge.EVENT_BUS.register(new DungeonBossMessages());
+ MinecraftForge.EVENT_BUS.register(new TrophyFishMessages());
Commands.init();
diff --git a/src/main/java/at/hannibal2/skyhanni/config/Features.java b/src/main/java/at/hannibal2/skyhanni/config/Features.java
index 46bbe3482..8c40004fd 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/Features.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/Features.java
@@ -13,7 +13,9 @@ import net.minecraft.client.Minecraft;
public class Features {
private void editOverlay(String activeConfig, int width, int height, Position position) {
- Minecraft.getMinecraft().displayGuiScreen(new GuiPositionEditor(position, width, height, () -> {}, () -> {}, () -> SkyHanniMod.screenToOpen = new GuiScreenElementWrapper(new ConfigEditor(SkyHanniMod.feature, activeConfig))));
+ Minecraft.getMinecraft().displayGuiScreen(new GuiPositionEditor(position, width, height, () -> {
+ }, () -> {
+ }, () -> SkyHanniMod.screenToOpen = new GuiScreenElementWrapper(new ConfigEditor(SkyHanniMod.feature, activeConfig))));
}
public void executeRunnable(String runnableId) {
@@ -67,6 +69,10 @@ public class Features {
public Bazaar bazaar = new Bazaar();
@Expose
+ @Category(name = "Fishing", desc = "Fishing stuff.")
+ public Fishing fishing = new Fishing();
+
+ @Expose
@Category(name = "Misc", desc = "Settings without a category.")
public Misc misc = new Misc();
@@ -239,6 +245,20 @@ public class Features {
public boolean orderHelper = false;
}
+ public static class Fishing {
+
+ @Expose
+ @ConfigOption(name = "Trophy Counter", desc = "Counts every single Trohy message from chat and tells you how many you got already.")
+ @ConfigEditorBoolean
+ public boolean trophyCounter = false;
+
+ @Expose
+ @ConfigOption(name = "Hide Bronze Duplicates", desc = "Hide duplicate messages for bronze trophy fishes from chat.")
+ @ConfigEditorBoolean
+ public boolean trophyFishBronzeHider = false;
+
+ }
+
public static class Misc {
@Expose
diff --git a/src/main/java/at/hannibal2/skyhanni/fishing/TrophyFishMessages.kt b/src/main/java/at/hannibal2/skyhanni/fishing/TrophyFishMessages.kt
new file mode 100644
index 000000000..1c2160009
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/fishing/TrophyFishMessages.kt
@@ -0,0 +1,68 @@
+package at.hannibal2.skyhanni.fishing
+
+import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.events.LorenzChatEvent
+import at.hannibal2.skyhanni.events.ProfileApiDataLoadedEvent
+import at.hannibal2.skyhanni.utils.LorenzDebug
+import at.hannibal2.skyhanni.utils.LorenzUtils
+import at.hannibal2.skyhanni.utils.LorenzUtils.between
+import at.hannibal2.skyhanni.utils.LorenzUtils.removeColorCodes
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+
+class TrophyFishMessages {
+
+ private val map = mutableMapOf<String, Int>()
+
+ @SubscribeEvent
+ fun onProfileDataLoad(event: ProfileApiDataLoadedEvent) {
+ val profileData = event.profileData
+
+ map.clear()
+ val trophyFishes = profileData["trophy_fish"].asJsonObject
+ for ((rawName, value) in trophyFishes.entrySet()) {
+ val rarity = when {
+ rawName.endsWith("_silver") -> "silver"
+ rawName.endsWith("_bronze") -> "bronze"
+ rawName.endsWith("_gold") -> "gold"
+ rawName.endsWith("_diamond") -> "diamond"
+ else -> continue
+ }
+ val text = rawName.replace("_", "")
+ val displayName = text.substring(0, text.length - rarity.length)
+
+ val amount = value.asInt
+
+// LorenzDebug.log("$rarity: $displayName: $amount")
+ val name = rarity + "_" + displayName
+ map[name] = amount
+// LorenzDebug.log("loaded trophy: $name = $amount")
+ }
+ }
+
+ @SubscribeEvent
+ fun onStatusBar(event: LorenzChatEvent) {
+ if (!LorenzUtils.inSkyblock) return
+ if (!SkyHanniMod.feature.fishing.trophyCounter) return
+
+ val message = event.message
+ if (message.startsWith("§6§lTROPHY FISH! §r§bYou caught a §r")) {
+ val displayName = message.between(" a §r", "§r §r")
+ val rarity = message.between("§r §r", "§b.").lowercase().replace("§l", "")
+
+ val name = (rarity + "_" + displayName).removeColorCodes().lowercase().replace(" ", "")
+ val amount = map.getOrDefault(name, 0) + 1
+ map[name] = amount
+ event.blockedReason = "trophy_fish"
+
+ if (amount == 1) {
+ LorenzUtils.chat("§6TROPHY FISH! §c§lFIRST §r$rarity $displayName")
+ } else {
+ if (rarity.contains("bronze")) {
+ if (SkyHanniMod.feature.fishing.trophyFishBronzeHider) return
+ }
+ LorenzUtils.chat("§6TROPHY FISH! §7$amount. §r$rarity $displayName")
+ }
+// LorenzDebug.log("new trophy: $name = $amount")
+ }
+ }
+} \ No newline at end of file