diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2022-12-27 20:12:25 +0100 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2022-12-27 20:12:25 +0100 |
commit | 2b330c3505f34b2b9ac7fed116237983eacc098d (patch) | |
tree | 41780b250b7222ee5cc77c009030d0f013ced0a2 /src/main/java/at/hannibal2/skyhanni | |
parent | 898947156b64e45cc5a0133c12aa73811d3e16f5 (diff) | |
download | skyhanni-2b330c3505f34b2b9ac7fed116237983eacc098d.tar.gz skyhanni-2b330c3505f34b2b9ac7fed116237983eacc098d.tar.bz2 skyhanni-2b330c3505f34b2b9ac7fed116237983eacc098d.zip |
Add catacombs class level color to party finder
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni')
3 files changed, 66 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java index a20ce7bc0..b3622499f 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java @@ -164,6 +164,7 @@ public class SkyHanniMod { registerEvent(new GriffinBurrowParticleFinder()); registerEvent(new BurrowWarpHelper()); registerEvent(new HighlightBonzoMasks()); + registerEvent(new DungeonLevelColor()); Commands.INSTANCE.init(); diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/Dungeon.java b/src/main/java/at/hannibal2/skyhanni/config/features/Dungeon.java index 40f58df81..f706446a1 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/Dungeon.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/Dungeon.java @@ -149,6 +149,16 @@ public class Dungeon { @ConfigAccordionId(id = 5) public Position copilotPos = new Position(10, 10, false, true); + @ConfigOption(name = "Party Finder", desc = "") + @ConfigEditorAccordion(id = 6) + public boolean partyFinder = false; + + @Expose + @ConfigOption(name = "Colored Class Level", desc = "Show the class levels in party finder in colors.") + @ConfigAccordionId(id = 6) + @ConfigEditorBoolean + public boolean partyFinderColoredClassLevel = true; + @Expose @ConfigOption(name = "Moving Skeleton Skulls", desc = "Highlight Skeleton Skulls when combining into a " + "Skeletor in orange color (not useful combined with feature Hide Skeleton Skull)") diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonLevelColor.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonLevelColor.kt new file mode 100644 index 000000000..796f93ef4 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonLevelColor.kt @@ -0,0 +1,55 @@ +package at.hannibal2.skyhanni.features.dungeon + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.utils.ItemUtils.getLore +import at.hannibal2.skyhanni.utils.LorenzUtils +import net.minecraft.client.Minecraft +import net.minecraft.client.gui.inventory.GuiChest +import net.minecraft.inventory.ContainerChest +import net.minecraftforge.event.entity.player.ItemTooltipEvent +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import java.util.regex.Pattern + +class DungeonLevelColor { + + private val pattern = Pattern.compile(" §.(.*)§f: §e(.*)§b \\(§e(.*)§b\\)") + + @SubscribeEvent + fun onItemTooltip(event: ItemTooltipEvent) { + if (!LorenzUtils.inSkyblock) return + if (!SkyHanniMod.feature.dungeon.partyFinderColoredClassLevel) return + + if (event.toolTip == null) return + val guiChest = Minecraft.getMinecraft().currentScreen + if (guiChest !is GuiChest) return + val chest = guiChest.inventorySlots as ContainerChest + val chestName = chest.lowerChestInventory.displayName.unformattedText.trim() + if (chestName != "Party Finder") return + + val stack = event.itemStack + var index = 0 + for (line in stack.getLore()) { + index++ + val matcher = pattern.matcher(line) + if (!matcher.matches()) continue + + val playerName = matcher.group(1) + val className = matcher.group(2) + val level = matcher.group(3).toInt() + val color = getColor(level) + event.toolTip[index] = " §b$playerName§f: §e$className $color$level" + } + } + + private fun getColor(level: Int): String { + if (level >= 50) return "§c§l" + if (level >= 45) return "§c" + if (level >= 40) return "§d" + if (level >= 35) return "§b" + if (level >= 30) return "§5" + if (level >= 25) return "§9" + if (level >= 20) return "§a" + if (level >= 10) return "§f" + return "§7" + } +} |