From 4dc9da6c2b23d145583ef528260cc7023a60bdfa Mon Sep 17 00:00:00 2001 From: syeyoung Date: Wed, 27 Jan 2021 19:01:40 +0900 Subject: BONZO --- .../features/impl/boss/FeatureBossHealth.java | 58 ++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureBossHealth.java (limited to 'src/main/java/kr/syeyoung/dungeonsguide/features/impl') diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureBossHealth.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureBossHealth.java new file mode 100644 index 00000000..7bb0c43f --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureBossHealth.java @@ -0,0 +1,58 @@ +package kr.syeyoung.dungeonsguide.features.impl.boss; + +import kr.syeyoung.dungeonsguide.SkyblockStatus; +import kr.syeyoung.dungeonsguide.dungeon.DungeonContext; +import kr.syeyoung.dungeonsguide.e; +import kr.syeyoung.dungeonsguide.features.FeatureParameter; +import kr.syeyoung.dungeonsguide.features.GuiFeature; +import kr.syeyoung.dungeonsguide.features.listener.ChatListener; +import kr.syeyoung.dungeonsguide.roomprocessor.bossfight.HealthData; +import kr.syeyoung.dungeonsguide.utils.TextUtils; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.util.ChatComponentText; +import net.minecraftforge.client.event.ClientChatReceivedEvent; + +import java.awt.*; +import java.awt.font.TextHitInfo; +import java.util.Map; +import java.util.regex.Matcher; +import java.util.List; +import java.util.regex.Pattern; + +public class FeatureBossHealth extends GuiFeature { + public FeatureBossHealth() { + super("Bossfight", "Display Boss Health(s)", "Show the health of boss and minibosses in bossfight (Guardians, Priests..)", "bossfight.health", false, getFontRenderer().getStringWidth("The Professor: 4242m"), getFontRenderer().FONT_HEIGHT * 5); + this.setEnabled(true); + parameters.put("color", new FeatureParameter("color", "Color", "Color of text", Color.orange, "color")); + parameters.put("totalHealth", new FeatureParameter("totalHealth", "show total health", "Show total health along with current health", false, "boolean")); + parameters.put("formatHealth", new FeatureParameter("formatHealth", "format health", "1234568 -> 1m", true, "boolean")); + } + + SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); + @Override + public void drawHUD(float partialTicks) { + if (!skyblockStatus.isOnDungeon()) return; + DungeonContext context = skyblockStatus.getContext(); + if (context == null) return; + if (context.getBossfightProcessor() == null) return; + List healths = context.getBossfightProcessor().getHealths(); + int i = 0; + FontRenderer fr = getFontRenderer(); + boolean format = this.getParameter("formatHealth").getValue(); + boolean total = this.getParameter("totalHealth").getValue(); + for (HealthData heal : healths) { + fr.drawString(heal.getName() + ": " + (format ? TextUtils.format(heal.getHealth()) : heal.getHealth()) + (total ? "/"+(format ? TextUtils.format(heal.getMaxHealth()) : heal.getMaxHealth()) : ""), 0, i, this.getParameter("color").getValue().getRGB()); + i += 8; + } + } + + @Override + public void drawDemo(float partialTicks) { + FontRenderer fr = getFontRenderer(); + fr.drawString("The Professor: 3.3m", 0,0, this.getParameter("color").getValue().getRGB()); + fr.drawString("Chaos Guardian: 500k", 0,8, this.getParameter("color").getValue().getRGB()); + fr.drawString("Healing Guardian: 1m", 0,16, this.getParameter("color").getValue().getRGB()); + fr.drawString("Laser Guardian: 5m", 0,24, this.getParameter("color").getValue().getRGB()); + fr.drawString("Giant: 10m", 0,32, this.getParameter("color").getValue().getRGB()); + } +} -- cgit