From c37e8bb98d04801a31b1f0dd1c74f5117c534aeb Mon Sep 17 00:00:00 2001 From: syeyoung Date: Fri, 22 Jan 2021 13:06:37 +0900 Subject: categorize feature impls --- .../dungeonsguide/features/FeatureRegistry.java | 8 +- .../features/impl/FeatureAutoReparty.java | 30 -- .../features/impl/FeatureBoxSkelemaster.java | 51 ---- .../features/impl/FeatureBoxStarMobs.java | 50 ---- .../features/impl/FeatureChestPrice.java | 101 ------- .../features/impl/FeatureCooldownCounter.java | 47 --- .../features/impl/FeatureDisableMessage.java | 68 ----- .../features/impl/FeatureDungeonDeaths.java | 94 ------ .../features/impl/FeatureDungeonMap.java | 322 --------------------- .../features/impl/FeatureDungeonMilestone.java | 74 ----- .../features/impl/FeatureDungeonRealTime.java | 58 ---- .../features/impl/FeatureDungeonSBTime.java | 82 ------ .../features/impl/FeatureDungeonScore.java | 211 -------------- .../features/impl/FeatureDungeonSecrets.java | 72 ----- .../features/impl/FeatureDungeonTombs.java | 51 ---- .../features/impl/FeatureInstaCloseChest.java | 124 -------- .../features/impl/FeatureTooltipDungeonStat.java | 35 --- .../features/impl/FeatureTooltipPrice.java | 93 ------ .../features/impl/FeatureWarnLowHealth.java | 74 ----- .../features/impl/boss/FeatureAutoReparty.java | 30 ++ .../features/impl/boss/FeatureChestPrice.java | 93 ++++++ .../impl/dungeon/FeatureBoxSkelemaster.java | 51 ++++ .../features/impl/dungeon/FeatureBoxStarMobs.java | 50 ++++ .../impl/dungeon/FeatureDungeonDeaths.java | 94 ++++++ .../features/impl/dungeon/FeatureDungeonMap.java | 322 +++++++++++++++++++++ .../impl/dungeon/FeatureDungeonMilestone.java | 74 +++++ .../impl/dungeon/FeatureDungeonRealTime.java | 58 ++++ .../impl/dungeon/FeatureDungeonSBTime.java | 82 ++++++ .../features/impl/dungeon/FeatureDungeonScore.java | 211 ++++++++++++++ .../impl/dungeon/FeatureDungeonSecrets.java | 72 +++++ .../features/impl/dungeon/FeatureDungeonTombs.java | 51 ++++ .../impl/dungeon/FeatureInstaCloseChest.java | 124 ++++++++ .../impl/dungeon/FeatureWarnLowHealth.java | 74 +++++ .../features/impl/etc/FeatureCooldownCounter.java | 47 +++ .../features/impl/etc/FeatureDisableMessage.java | 60 ++++ .../impl/etc/FeatureTooltipDungeonStat.java | 34 +++ .../features/impl/etc/FeatureTooltipPrice.java | 92 ++++++ 37 files changed, 1626 insertions(+), 1638 deletions(-) delete mode 100644 src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureAutoReparty.java delete mode 100644 src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureBoxSkelemaster.java delete mode 100644 src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureBoxStarMobs.java delete mode 100644 src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureChestPrice.java delete mode 100644 src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureCooldownCounter.java delete mode 100644 src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDisableMessage.java delete mode 100644 src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonDeaths.java delete mode 100644 src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonMap.java delete mode 100644 src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonMilestone.java delete mode 100644 src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonRealTime.java delete mode 100644 src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonSBTime.java delete mode 100644 src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonScore.java delete mode 100644 src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonSecrets.java delete mode 100644 src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonTombs.java delete mode 100644 src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureInstaCloseChest.java delete mode 100644 src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureTooltipDungeonStat.java delete mode 100644 src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureTooltipPrice.java delete mode 100644 src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureWarnLowHealth.java create mode 100644 src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureAutoReparty.java create mode 100644 src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureChestPrice.java create mode 100644 src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureBoxSkelemaster.java create mode 100644 src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureBoxStarMobs.java create mode 100644 src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonDeaths.java create mode 100644 src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonMap.java create mode 100644 src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonMilestone.java create mode 100644 src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonRealTime.java create mode 100644 src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonSBTime.java create mode 100644 src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonScore.java create mode 100644 src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonSecrets.java create mode 100644 src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonTombs.java create mode 100644 src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureInstaCloseChest.java create mode 100644 src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureWarnLowHealth.java create mode 100644 src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureCooldownCounter.java create mode 100644 src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureDisableMessage.java create mode 100644 src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureTooltipDungeonStat.java create mode 100644 src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureTooltipPrice.java (limited to 'src/main/java/kr/syeyoung/dungeonsguide/features') diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java b/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java index 5de307cc..ac42cb2e 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java @@ -1,6 +1,12 @@ package kr.syeyoung.dungeonsguide.features; -import kr.syeyoung.dungeonsguide.features.impl.*; +import kr.syeyoung.dungeonsguide.features.impl.boss.FeatureAutoReparty; +import kr.syeyoung.dungeonsguide.features.impl.boss.FeatureChestPrice; +import kr.syeyoung.dungeonsguide.features.impl.dungeon.*; +import kr.syeyoung.dungeonsguide.features.impl.etc.FeatureCooldownCounter; +import kr.syeyoung.dungeonsguide.features.impl.etc.FeatureDisableMessage; +import kr.syeyoung.dungeonsguide.features.impl.etc.FeatureTooltipDungeonStat; +import kr.syeyoung.dungeonsguide.features.impl.etc.FeatureTooltipPrice; import lombok.Getter; import java.util.ArrayList; diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureAutoReparty.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureAutoReparty.java deleted file mode 100644 index 2ff4ff2d..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureAutoReparty.java +++ /dev/null @@ -1,30 +0,0 @@ -package kr.syeyoung.dungeonsguide.features.impl; - -import kr.syeyoung.dungeonsguide.e; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; -import kr.syeyoung.dungeonsguide.features.listener.DungeonEndListener; -import kr.syeyoung.dungeonsguide.features.listener.GuiBackgroundRenderListener; -import kr.syeyoung.dungeonsguide.utils.TextUtils; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.Gui; -import net.minecraft.client.gui.inventory.GuiChest; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.inventory.ContainerChest; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; -import net.minecraftforge.client.event.GuiScreenEvent; -import org.lwjgl.opengl.GL11; - -public class FeatureAutoReparty extends SimpleFeature implements DungeonEndListener { - public FeatureAutoReparty() { - super("Bossfight", "Auto reparty when dungeon finishes","Auto reparty on dungeon finish\n\nThis automates player chatting action, (disbanding, repartying) Thus it might be against hypixel's rules.\nBut mods like auto-gg exist so I'm leaving this feature.\nThis option is use-at-your-risk and you'll be responsible for ban if you somehow get banned because of this feature\n(Although it is not likely to happen)\nDefaults to off", "bossfight.autoreparty", false); - } - - @Override - public void onDungeonEnd() { - if (isEnabled()) e.getDungeonsGuide().getCommandReparty().requestReparty(); - } -} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureBoxSkelemaster.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureBoxSkelemaster.java deleted file mode 100644 index e8eddf85..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureBoxSkelemaster.java +++ /dev/null @@ -1,51 +0,0 @@ -package kr.syeyoung.dungeonsguide.features.impl; - -import com.google.common.base.Predicate; -import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.e; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; -import kr.syeyoung.dungeonsguide.features.listener.WorldRenderListener; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; -import net.minecraft.client.Minecraft; -import net.minecraft.entity.item.EntityArmorStand; -import net.minecraft.entity.monster.EntitySkeleton; -import net.minecraft.util.BlockPos; -import org.jetbrains.annotations.Nullable; - -import java.awt.*; -import java.util.List; - - -public class FeatureBoxSkelemaster extends SimpleFeature implements WorldRenderListener { - public FeatureBoxSkelemaster() { - super("Dungeon", "Box Skeleton Masters", "Box skeleton masters in dungeons", "dungeon.skeletonmasterbox", true); - parameters.put("radius", new FeatureParameter("radius", "Highlight Radius", "The maximum distance between player and skeletonmaster to be boxed", 20, "integer")); - parameters.put("color", new FeatureParameter("color", "Highlight Color", "Highlight Color of Skeleton master", new AColor(255,0,0,50), "acolor")); - } - - - private SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); - @Override - public void drawWorld(float partialTicks) { - if (!isEnabled()) return; - if (!skyblockStatus.isOnDungeon()) return; - - final BlockPos player = Minecraft.getMinecraft().thePlayer.getPosition(); - int val = this.getParameter("radius").getValue(); - final int sq = val * val; - - List skeletonList = Minecraft.getMinecraft().theWorld.getEntities(EntityArmorStand.class, new Predicate() { - @Override - public boolean apply(@Nullable EntityArmorStand input) { - if (player.distanceSq(input.getPosition()) > sq) return false; - return input.getName().contains("Skeleton Master"); - } - }); - Color c = this.getParameter("color").getValue(); - for (EntityArmorStand entitySkeleton : skeletonList) { - RenderUtils.highlightBox(entitySkeleton, c, partialTicks, true); - } - } -} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureBoxStarMobs.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureBoxStarMobs.java deleted file mode 100644 index dd61ce15..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureBoxStarMobs.java +++ /dev/null @@ -1,50 +0,0 @@ -package kr.syeyoung.dungeonsguide.features.impl; - -import com.google.common.base.Predicate; -import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.e; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; -import kr.syeyoung.dungeonsguide.features.listener.WorldRenderListener; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; -import net.minecraft.client.Minecraft; -import net.minecraft.entity.item.EntityArmorStand; -import net.minecraft.util.BlockPos; -import org.jetbrains.annotations.Nullable; - -import java.awt.*; -import java.util.List; - - -public class FeatureBoxStarMobs extends SimpleFeature implements WorldRenderListener { - public FeatureBoxStarMobs() { - super("Dungeon", "Box Starred mobs", "Box Starred mobs in dungeons", "dungeon.starmobbox", false); - parameters.put("radius", new FeatureParameter("radius", "Highlight Radius", "The maximum distance between player and skeletonmaster to be boxed", 20, "integer")); - parameters.put("color", new FeatureParameter("color", "Highlight Color", "Highlight Color of Skeleton master", new AColor(0,255,255,50), "acolor")); - } - - - private SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); - @Override - public void drawWorld(float partialTicks) { - if (!isEnabled()) return; - if (!skyblockStatus.isOnDungeon()) return; - - final BlockPos player = Minecraft.getMinecraft().thePlayer.getPosition(); - int val = this.getParameter("radius").getValue(); - final int sq = val * val; - - List skeletonList = Minecraft.getMinecraft().theWorld.getEntities(EntityArmorStand.class, new Predicate() { - @Override - public boolean apply(@Nullable EntityArmorStand input) { - if (player.distanceSq(input.getPosition()) > sq) return false; - return input.getName().contains("✯"); - } - }); - Color c = this.getParameter("color").getValue(); - for (EntityArmorStand entitySkeleton : skeletonList) { - RenderUtils.highlightBox(entitySkeleton, c, partialTicks, true); - } - } -} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureChestPrice.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureChestPrice.java deleted file mode 100644 index d98a3bbc..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureChestPrice.java +++ /dev/null @@ -1,101 +0,0 @@ -package kr.syeyoung.dungeonsguide.features.impl; - -import kr.syeyoung.dungeonsguide.e; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; -import kr.syeyoung.dungeonsguide.features.listener.GuiBackgroundRenderListener; -import kr.syeyoung.dungeonsguide.features.listener.GuiPostRenderListener; -import kr.syeyoung.dungeonsguide.features.listener.GuiPreRenderListener; -import kr.syeyoung.dungeonsguide.utils.TextUtils; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.Gui; -import net.minecraft.client.gui.GuiScreen; -import net.minecraft.client.gui.inventory.GuiChest; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.inventory.ContainerChest; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.StatCollector; -import net.minecraftforge.client.event.GuiScreenEvent; -import org.lwjgl.opengl.GL11; - -import java.util.HashMap; -import java.util.TreeMap; - -public class FeatureChestPrice extends SimpleFeature implements GuiBackgroundRenderListener { - public FeatureChestPrice() { - super("Bossfight", "Show Profit of Dungeon Chests","Show Profit of Dungeon Chests", "bossfight.profitchest", true); - } - - @Override - public void onGuiBGRender(GuiScreenEvent.BackgroundDrawnEvent rendered) { - if (!isEnabled()) return; - if (!(rendered.gui instanceof GuiChest)) return; - if (!e.getDungeonsGuide().getSkyblockStatus().isOnDungeon()) return; - - GlStateManager.disableLighting(); - - ContainerChest chest = (ContainerChest) ((GuiChest) rendered.gui).inventorySlots; - if (!chest.getLowerChestInventory().getName().endsWith("Chest")) return; - IInventory actualChest = chest.getLowerChestInventory(); - - int chestPrice = 0; - int itemPrice = 0; - for (int i = 0; i 0) { - for (int j1 = 0; j1 < nbttaglist1.tagCount(); ++j1) { - String str = nbttaglist1.getStringTagAt(j1); - if (str.endsWith("Coins")) { - String coins = TextUtils.stripColor(str).replace(" Coins", "").replace(",",""); - try { - chestPrice = Integer.parseInt(coins); - } catch (Exception e) { - - } - } - } - } - } - } - } - itemPrice += FeatureInstaCloseChest.getPrice(item) * item.stackSize; - } - } - - int i = 222; - int j = i - 108; - int ySize = j + (actualChest.getSizeInventory() / 9) * 18; - int left = (rendered.gui.width + 176) / 2; - int top = (rendered.gui.height - ySize ) / 2; - - int width = 120; - - GlStateManager.pushMatrix(); - GlStateManager.translate(left, top, 0); - Gui.drawRect( 0,0,width, 30, 0xFFDDDDDD); - - FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; - fr.drawString("BIN/AH Price: ", 5,5, 0xFF000000); - String str = TextUtils.format(itemPrice); - fr.drawString(str, width - fr.getStringWidth(str) - 5, 5, 0xFF000000); - - fr.drawString("Profit: ", 5,15, 0xFF000000); - str = (itemPrice > chestPrice ? "+" : "") +TextUtils.format(itemPrice - chestPrice); - fr.drawString(str, width - fr.getStringWidth(str) - 5, 15, itemPrice > chestPrice ? 0xFF00CC00 : 0xFFCC0000); - - GlStateManager.popMatrix(); - } -} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureCooldownCounter.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureCooldownCounter.java deleted file mode 100644 index 28fc7d0e..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureCooldownCounter.java +++ /dev/null @@ -1,47 +0,0 @@ -package kr.syeyoung.dungeonsguide.features.impl; - -import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.e; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.GuiFeature; -import kr.syeyoung.dungeonsguide.features.listener.DungeonQuitListener; -import kr.syeyoung.dungeonsguide.features.listener.TickListener; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.renderer.GlStateManager; -import org.lwjgl.opengl.GL11; - -import java.awt.*; - -public class FeatureCooldownCounter extends GuiFeature implements DungeonQuitListener { - public FeatureCooldownCounter() { - super("ETC", "Dungeon Cooldown Counter", "Counts 10 seconds after leaving dungeon", "qol.cooldown", true, getFontRenderer().getStringWidth("Cooldown: 10s "), getFontRenderer().FONT_HEIGHT); - parameters.put("color", new FeatureParameter("color", "Color", "Color of text", Color.white, "color")); - } - - private long leftDungeonTime = 0L; - private boolean wasInDungeon = false; - @Override - public void drawHUD(float partialTicks) { - if (System.currentTimeMillis() - leftDungeonTime > 20000) return; - FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; - double scale = getFeatureRect().getHeight() / fr.FONT_HEIGHT; - GlStateManager.scale(scale, scale, 0); - fr.drawString("Cooldown: "+(20 - (System.currentTimeMillis() - leftDungeonTime) / 1000)+"s", 0,0,this.getParameter("color").getValue().getRGB()); - } - - @Override - public void drawDemo(float partialTicks) { - FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; - double scale = getFeatureRect().getHeight() / fr.FONT_HEIGHT; - GlStateManager.scale(scale, scale, 0); - fr.drawString("Cooldown: 20s", 0,0,this.getParameter("color").getValue().getRGB()); - } - - SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); - - @Override - public void onDungeonQuit() { - leftDungeonTime = System.currentTimeMillis(); - } -} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDisableMessage.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDisableMessage.java deleted file mode 100644 index 50bb0211..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDisableMessage.java +++ /dev/null @@ -1,68 +0,0 @@ -package kr.syeyoung.dungeonsguide.features.impl; - -import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.e; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.GuiFeature; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; -import kr.syeyoung.dungeonsguide.features.listener.ChatListener; -import kr.syeyoung.dungeonsguide.utils.TextUtils; -import lombok.AllArgsConstructor; -import lombok.Data; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.network.NetworkPlayerInfo; -import net.minecraft.scoreboard.ScorePlayerTeam; -import net.minecraftforge.client.event.ClientChatReceivedEvent; -import org.lwjgl.opengl.GL11; - -import java.awt.*; -import java.util.regex.Pattern; - -public class FeatureDisableMessage extends SimpleFeature implements ChatListener { - @Data - @AllArgsConstructor - public static class MessageData { - private Pattern pattern; - private String name; - private String description; - private String key; - } - - private static final MessageData[] PRE_DEFINED = new MessageData[] { - new MessageData(Pattern.compile("§r§cThere are blocks in the way!§r"), "Aote block message", "\"There are blocks in the way!\"", "aote"), - new MessageData(Pattern.compile("§r§cThis ability is currently on cooldown for .+ more seconds?\\.§r"), "Ability cooldown message", "\"This ability is currently on cooldown for 3 more seconds.\"", "cooldown"), - new MessageData(Pattern.compile("§r§cWhow! Slow down there!§r"), "Grappling hook cooldown", "\"Whow! Slow down there!\"", "grappling"), - new MessageData(Pattern.compile("§r§cNo more charges, next one in §r§e.+§r§cs!§r"), "Zombie Sword Charging", "\"No more charges, next one in 3s!\"", "zombie"), - new MessageData(Pattern.compile("§r§7Your .+ hit §r§c.+ §r§7enem(?:y|ies) for §r§c.+ §r§7damage\\.§r"), "Ability Damage", "\"Your blahblah hit 42 enemy for a lots of damage\"", "ability"), - new MessageData(Pattern.compile("§r§cYou do not have enough mana to do this!§r"), "Not enough mana", "\"You do not have enough mana to do this!\"", "mana"), - new MessageData(Pattern.compile("§r§aUsed §r.+§r§a!§r"), "Dungeon Ability Usage", "\"Used Guided Sheep!\" and such", "dungeonability"), - new MessageData(Pattern.compile("§r.+§r§a is ready to use! Press §r.+§r§a to activate it!§r"), "Ready to use message", "\"Blah is ready to use! Press F to activate it!", "readytouse"), - new MessageData(Pattern.compile("§r.+ §r§ais now available!§r"), "Ability Available","\"blah is now available!\"", "available"), - new MessageData(Pattern.compile("§r§cThe Stone doesn't seem to do anything here\\.§r"), "Stone Message", "\"The Stone doesn't seem to do anything here\"", "stone") - }; - - public FeatureDisableMessage() { - super("fixes", "Disable ability messages", "Do not let ability messages show up in chatbox\nclick on Edit for more precise settings", "fixes.messagedisable", true); - for (MessageData messageData : PRE_DEFINED) { - this.parameters.put(messageData.key, new FeatureParameter(messageData.key, messageData.name, messageData.description, true, "boolean")); - } - } - - SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); - - @Override - public void onChat(ClientChatReceivedEvent clientChatReceivedEvent) { - if (clientChatReceivedEvent.type == 2) return; - if (!isEnabled()) return; - if (!skyblockStatus.isOnSkyblock()) return; - String msg = clientChatReceivedEvent.message.getFormattedText(); - System.out.println(msg); - for (MessageData md:PRE_DEFINED) { - if (this.getParameter(md.key).getValue() && md.pattern.matcher(msg).matches()) { - clientChatReceivedEvent.setCanceled(true); - return; - } - } - } -} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonDeaths.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonDeaths.java deleted file mode 100644 index a100496b..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonDeaths.java +++ /dev/null @@ -1,94 +0,0 @@ -package kr.syeyoung.dungeonsguide.features.impl; - -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.features.listener.TickListener; -import kr.syeyoung.dungeonsguide.utils.TextUtils; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.util.ChatComponentText; -import net.minecraftforge.client.event.ClientChatReceivedEvent; -import org.lwjgl.opengl.GL11; - -import java.awt.*; -import java.util.Map; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -public class FeatureDungeonDeaths extends GuiFeature implements ChatListener { - public FeatureDungeonDeaths() { - super("Dungeon", "Display Deaths", "Display names of player and death count in dungeon run", "dungeon.stats.deaths", false, getFontRenderer().getStringWidth("longestplayernamepos: 100"), getFontRenderer().FONT_HEIGHT * 6); - this.setEnabled(false); - parameters.put("color", new FeatureParameter("color", "Color", "Color of text", Color.orange, "color")); - } - - SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); - @Override - public void drawHUD(float partialTicks) { - if (!skyblockStatus.isOnDungeon()) return; - DungeonContext context = skyblockStatus.getContext(); - if (context == null) return; - Map deaths = context.getDeaths(); - int i = 0; - int deathsCnt = 0; - FontRenderer fr = getFontRenderer(); - for (Map.Entry death:deaths.entrySet()) { - fr.drawString(death.getKey()+": "+death.getValue(), 0,i, this.getParameter("color").getValue().getRGB()); - i += 8; - deathsCnt += death.getValue(); - } - fr.drawString("Total Deaths: "+deathsCnt, 0,i, this.getParameter("color").getValue().getRGB()); - } - - public int getTotalDeaths() { - if (!skyblockStatus.isOnDungeon()) return 0; - DungeonContext context = skyblockStatus.getContext(); - if (context == null) return 0; - int d = 0; - for (Integer value : context.getDeaths().values()) { - d += value; - } - return d; - } - - @Override - public void drawDemo(float partialTicks) { - FontRenderer fr = getFontRenderer(); - fr.drawString("syeyoung: -130", 0,0, this.getParameter("color").getValue().getRGB()); - fr.drawString("notsyeyoung: -13", 0,8, this.getParameter("color").getValue().getRGB()); - fr.drawString("dungeonsguide: -42", 0,16, this.getParameter("color").getValue().getRGB()); - fr.drawString("--not more--", 0,24, this.getParameter("color").getValue().getRGB()); - fr.drawString("--maybe more--", 0,32, this.getParameter("color").getValue().getRGB()); - fr.drawString("Total Deaths: 0", 0,40, this.getParameter("color").getValue().getRGB()); - } - - Pattern deathPattern = Pattern.compile("§r§c ☠ (.+?)§r§7 .+and became a ghost.+"); - Pattern meDeathPattern = Pattern.compile("§r§c ☠ §r§7You .+and became a ghost.+"); - - @Override - public void onChat(ClientChatReceivedEvent clientChatReceivedEvent) { - if (clientChatReceivedEvent.type == 2) return; - if (!skyblockStatus.isOnDungeon()) return; - DungeonContext context = skyblockStatus.getContext(); - if (context == null) return; - - String txt = clientChatReceivedEvent.message.getFormattedText(); - Matcher m = deathPattern.matcher(txt); - if (m.matches()) { - String nickname = TextUtils.stripColor(m.group(1)); - int deaths = context.getDeaths().containsKey(nickname) ? context.getDeaths().get(nickname) : 0; - context.getDeaths().put(nickname, deaths + 1); - e.sendDebugChat(new ChatComponentText("Death verified :: "+nickname+" / "+(deaths + 1))); - } - Matcher m2 = meDeathPattern.matcher(txt); - if (m2.matches()) { - String nickname = "me"; - int deaths = context.getDeaths().containsKey(nickname) ? context.getDeaths().get(nickname) : 0; - context.getDeaths().put(nickname, deaths + 1); - e.sendDebugChat(new ChatComponentText("Death verified :: me / "+(deaths + 1))); - } - } -} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonMap.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonMap.java deleted file mode 100644 index bab2ec33..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonMap.java +++ /dev/null @@ -1,322 +0,0 @@ -package kr.syeyoung.dungeonsguide.features.impl; - -import com.google.common.collect.ComparisonChain; -import com.google.common.collect.Ordering; -import com.mojang.authlib.GameProfile; -import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.dungeon.DungeonContext; -import kr.syeyoung.dungeonsguide.dungeon.MapProcessor; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.e; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.GuiFeature; -import kr.syeyoung.dungeonsguide.features.listener.BossroomEnterListener; -import kr.syeyoung.dungeonsguide.features.listener.ChatListener; -import kr.syeyoung.dungeonsguide.features.listener.DungeonEndListener; -import kr.syeyoung.dungeonsguide.features.listener.DungeonStartListener; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; -import kr.syeyoung.dungeonsguide.utils.TextUtils; -import net.minecraft.block.material.MapColor; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.Gui; -import net.minecraft.client.gui.GuiPlayerTabOverlay; -import net.minecraft.client.gui.MapItemRenderer; -import net.minecraft.client.network.NetworkPlayerInfo; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.WorldRenderer; -import net.minecraft.client.renderer.texture.DynamicTexture; -import net.minecraft.client.renderer.vertex.DefaultVertexFormats; -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EnumPlayerModelParts; -import net.minecraft.scoreboard.ScorePlayerTeam; -import net.minecraft.util.ChatComponentText; -import net.minecraft.util.MathHelper; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.Vec4b; -import net.minecraft.world.WorldSettings; -import net.minecraft.world.storage.MapData; -import net.minecraftforge.client.event.ClientChatReceivedEvent; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; -import org.lwjgl.opengl.GL11; - -import java.awt.*; -import java.util.List; -import java.util.Comparator; -import java.util.Map; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -public class FeatureDungeonMap extends GuiFeature implements DungeonEndListener, DungeonStartListener, BossroomEnterListener { - public FeatureDungeonMap() { - super("Dungeon", "Dungeon Map", "Display dungeon map!", "dungeon.map", true, 128,128); - this.setEnabled(false); - parameters.put("scale", new FeatureParameter("scale", "Scale map", "Whether to scale map to fit screen", true, "boolean")); - parameters.put("playerCenter", new FeatureParameter("playerCenter", "Center map at player", "Render you in the center", false, "boolean")); - parameters.put("rotate", new FeatureParameter("rotate", "Rotate map centered at player", "Only works with Center map at player enabled", false, "boolean")); - parameters.put("postScale", new FeatureParameter("postScale", "Scale factor of map", "Only works with Center map at player enabled", 1.0f, "float")); - parameters.put("showotherplayers", new FeatureParameter("showotherplayers", "Show other players", "Option to show other players in map", true, "boolean")); - parameters.put("showtotalsecrets", new FeatureParameter("showtotalsecrets", "Show Total secrets in the room", "Option to overlay total secrets in the specific room", true, "boolean")); - parameters.put("playerheadscale", new FeatureParameter("playerheadscale", "Player head scale", "Scale factor of player heads, defaults to 1", 1.0f, "float")); - parameters.put("textScale", new FeatureParameter("textScale", "Text scale", "Scale factor of texts on map, defaults to 1", 1.0f, "float")); - parameters.put("border_color", new FeatureParameter("border_color", "Color of the border", "Same as name", new AColor(255,255,255,255), "acolor")); - parameters.put("background_color", new FeatureParameter("background_color", "Color of the background", "Same as name", new AColor(0x22000000, true), "acolor")); - parameters.put("chromaborder", new FeatureParameter("chromaborder", "Chroma border", "Rainbow!!! (Overrides border color option)", false, "boolean")); - parameters.put("player_color", new FeatureParameter("player_color", "Color of the player border", "Same as name", new AColor(255,255,255,0), "acolor")); - parameters.put("player_chroma", new FeatureParameter("player_chroma", "Chroma border for player", "Rainbow!!! (Overrides border color option)", false, "boolean")); - } - - SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); - public static final Ordering field_175252_a = Ordering.from(new PlayerComparator()); - - private boolean on = false; - - @Override - public void onDungeonEnd() { - on = false; - } - - @Override - public void onDungeonStart() { - on = true; - } - - @Override - public void onBossroomEnter() { - on = false; - } - - @SideOnly(Side.CLIENT) - static class PlayerComparator implements Comparator - { - private PlayerComparator() - { - } - - public int compare(NetworkPlayerInfo p_compare_1_, NetworkPlayerInfo p_compare_2_) - { - ScorePlayerTeam scoreplayerteam = p_compare_1_.getPlayerTeam(); - ScorePlayerTeam scoreplayerteam1 = p_compare_2_.getPlayerTeam(); - return ComparisonChain.start().compareTrueFirst(p_compare_1_.getGameType() != WorldSettings.GameType.SPECTATOR, p_compare_2_.getGameType() != WorldSettings.GameType.SPECTATOR).compare(scoreplayerteam != null ? scoreplayerteam.getRegisteredName() : "", scoreplayerteam1 != null ? scoreplayerteam1.getRegisteredName() : "").compare(p_compare_1_.getGameProfile().getName(), p_compare_2_.getGameProfile().getName()).result(); - } - } - @Override - public void drawHUD(float partialTicks) { - if (!skyblockStatus.isOnDungeon()) return; - if (skyblockStatus.getContext() == null | !skyblockStatus.getContext().getMapProcessor().isInitialized()) return; - if (!on) return;; - - DungeonContext context = skyblockStatus.getContext(); - MapProcessor mapProcessor = context.getMapProcessor(); - MapData mapData = mapProcessor.getLastMapData2(); - Gui.drawRect(0,0,getFeatureRect().width, getFeatureRect().height, this.getParameter("background_color").getValue().getRGB()); - GlStateManager.color(1,1,1,1); - GlStateManager.pushMatrix();; - if (mapData == null) { - Gui.drawRect(0,0,getFeatureRect().width, getFeatureRect().height, 0xFFFF0000); - } else { - renderMap(partialTicks,mapProcessor,mapData,context); - } - GlStateManager.popMatrix(); - GL11.glLineWidth(2); - RenderUtils.drawUnfilledBox(0,0,getFeatureRect().width, getFeatureRect().height, this.getParameter("border_color").getValue().getRGB(), this.getParameter("chromaborder").getValue()); - } - - @Override - public void drawDemo(float partialTicks) { - if (skyblockStatus.isOnDungeon() && skyblockStatus.getContext() != null && skyblockStatus.getContext().getMapProcessor().isInitialized() && on) { - drawHUD(partialTicks); - return; - } - Gui.drawRect(0,0,getFeatureRect().width, getFeatureRect().height, this.getParameter("background_color").getValue().getRGB()); - FontRenderer fr = getFontRenderer(); - fr.drawString("Please join a dungeon to see preview", getFeatureRect().width / 2 - fr.getStringWidth("Please join a dungeon to see preview") / 2, getFeatureRect().height / 2 - fr.FONT_HEIGHT / 2, 0xFFFFFFFF); - GL11.glLineWidth(2); - RenderUtils.drawUnfilledBox(0,0,getFeatureRect().width, getFeatureRect().height, this.getParameter("border_color").getValue().getRGB(), this.getParameter("chromaborder").getValue()); - } - - public void renderMap(float partialTicks, MapProcessor mapProcessor, MapData mapData, DungeonContext context){ - float postScale = this.getParameter("playerCenter").getValue() ? this.getParameter("postScale").getValue() : 1; - int width = getFeatureRect().width; - float scale = (this.getParameter("scale").getValue() ? width / 128.0f : 1); - GlStateManager.translate(width / 2, width / 2, 0); - GlStateManager.scale(scale, scale, 0); - GlStateManager.scale(postScale, postScale,0); - EntityPlayer p = Minecraft.getMinecraft().thePlayer; - Point pt = mapProcessor.worldPointToMapPoint(p.getPositionEyes(partialTicks)); - double yaw = p.prevRotationYawHead + (p.rotationYaw - p.prevRotationYawHead) * partialTicks; - if (this.getParameter("playerCenter").getValue()) { - if (this.getParameter("rotate").getValue()) { - GlStateManager.rotate((float) (180.0 - yaw), 0,0,1); - } - GlStateManager.translate( -pt.x, -pt.y, 0); - } else { - GlStateManager.translate( -64, -64, 0); - } - updateMapTexture(mapData.colors, mapProcessor, context.getDungeonRoomList()); - render(mapData, false); - - - GlStateManager.enableBlend(); - GlStateManager.tryBlendFuncSeparate(1, 771, 0, 1); - - - - List list = field_175252_a.sortedCopy(Minecraft.getMinecraft().thePlayer.sendQueue.getPlayerInfoMap()); - if (list.size() < 40) return; - for (int i = 1; i < 20; i++) { - NetworkPlayerInfo networkPlayerInfo = list.get(i); - String name = networkPlayerInfo.getDisplayName() != null ? networkPlayerInfo.getDisplayName().getFormattedText() : ScorePlayerTeam.formatPlayerName(networkPlayerInfo.getPlayerTeam(), networkPlayerInfo.getGameProfile().getName()); - if (name.trim().equals("§r") || name.startsWith("§r ")) continue; - String actual = TextUtils.stripColor(name).trim().split(" ")[0]; - EntityPlayer entityplayer = Minecraft.getMinecraft().theWorld.getPlayerEntityByName(actual); - if (TextUtils.stripColor(name).endsWith("(DEAD)") && entityplayer != Minecraft.getMinecraft().thePlayer) { - continue; - } - Point pt2; - double yaw2; - - if (entityplayer != null) { - pt2 = mapProcessor.worldPointToMapPoint(entityplayer.getPositionEyes(partialTicks)); - yaw2 = entityplayer.prevRotationYawHead + (entityplayer.rotationYawHead - entityplayer.prevRotationYawHead) * partialTicks; - } else { - String iconName = mapProcessor.getMapIconToPlayerMap().get(actual); - if (iconName == null) continue; - Vec4b vec = mapData.mapDecorations.get(iconName); - if (vec == null) { - continue; - } else { - pt2 = new Point(vec.func_176112_b() / 2 + 64, vec.func_176113_c() / 2 + 64); - yaw2 = vec.func_176111_d() * 360 / 16.0f ; - } - } - GlStateManager.pushMatrix(); - if (entityplayer == Minecraft.getMinecraft().thePlayer || this.getParameter("showotherplayers").getValue()) - { - boolean flag1 = entityplayer != null && entityplayer.isWearing(EnumPlayerModelParts.CAPE); - GlStateManager.enableTexture2D(); - Minecraft.getMinecraft().getTextureManager().bindTexture(networkPlayerInfo.getLocationSkin()); - int l2 = 8 + (flag1 ? 8 : 0); - int i3 = 8 * (flag1 ? -1 : 1); - - GlStateManager.translate(pt2.x, pt2.y, 0); - GlStateManager.rotate((float) (yaw2 - 180), 0, 0, 1); - - GlStateManager.scale(1 / scale, 1 / scale, 0); - GlStateManager.scale(1 / postScale, 1 / postScale, 0); - float s = this.getParameter("playerheadscale").getValue(); - GlStateManager.scale(s,s,0); - Gui.drawScaledCustomSizeModalRect(-4, -4, 8.0F, (float) l2, 8, i3, 8, 8, 64.0F, 64.0F); - GL11.glLineWidth(1); - RenderUtils.drawUnfilledBox(-4,-4,4, 4, this.getParameter("player_color").getValue().getRGB(), this.getParameter("player_chroma").getValue()); - } - GlStateManager.popMatrix(); - } - FontRenderer fr = getFontRenderer(); - if (this.getParameter("showtotalsecrets").getValue()) { - for (DungeonRoom dungeonRoom : context.getDungeonRoomList()) { - GlStateManager.pushMatrix(); - GlStateManager.pushAttrib(); - Point mapPt = mapProcessor.roomPointToMapPoint(dungeonRoom.getUnitPoints().get(0)); - GlStateManager.translate(mapPt.x + mapProcessor.getUnitRoomDimension().width / 2, mapPt.y + mapProcessor.getUnitRoomDimension().height / 2, 0); - - if (this.getParameter("playerCenter").getValue() && this.getParameter("rotate").getValue()) { - GlStateManager.rotate((float) (yaw - 180), 0, 0, 1); - } - GlStateManager.scale(1 / scale, 1 / scale, 0); - GlStateManager.scale(1 / postScale, 1 / postScale, 0); - float s = this.getParameter("textScale").getValue(); - GlStateManager.scale(s,s,0); - String str = ""; - str += dungeonRoom.getTotalSecrets() == -1 ? "?" : String.valueOf(dungeonRoom.getTotalSecrets()); - str += " "; - if (dungeonRoom.getCurrentState() == DungeonRoom.RoomState.FINISHED) { - str += "✔"; - } else if (dungeonRoom.getCurrentState() == DungeonRoom.RoomState.COMPLETE_WITHOUT_SECRETS) { - str += "☑"; - } else if (dungeonRoom.getCurrentState() == DungeonRoom.RoomState.DISCOVERED) { - str += "☐"; - } else if (dungeonRoom.getCurrentState() == DungeonRoom.RoomState.FAILED) { - str += "❌"; - } - - fr.drawString(str, -(fr.getStringWidth(str) / 2), -(fr.FONT_HEIGHT / 2), dungeonRoom.getColor() == 74 ? 0xff000000 : 0xFFFFFFFF); - GlStateManager.popAttrib(); - GlStateManager.popMatrix(); - } - } - - } - - - - private DynamicTexture mapTexture = new DynamicTexture(128, 128); - private ResourceLocation location = Minecraft.getMinecraft().getTextureManager().getDynamicTextureLocation("dungeonmap/map", mapTexture); - private int[] mapTextureData = mapTexture.getTextureData(); - - private void updateMapTexture(byte[] colors, MapProcessor mapProcessor, List dungeonRooms) { - for (int i = 0; i < 16384; ++i) { - int j = colors[i] & 255; - - if (j / 4 == 0) { - this.mapTextureData[i] = 0x00000000; - } else { - this.mapTextureData[i] = MapColor.mapColorArray[j / 4].func_151643_b(j & 3); - } - } - - if (this.getParameter("showtotalsecrets").getValue()) { - for (DungeonRoom dungeonRoom : dungeonRooms) { - for (Point pt : dungeonRoom.getUnitPoints()) { - for (int y1 = 0; y1 < mapProcessor.getUnitRoomDimension().height; y1++) { - for (int x1 = 0; x1 < mapProcessor.getUnitRoomDimension().width; x1++) { - int x = MathHelper.clamp_int(pt.x * (mapProcessor.getUnitRoomDimension().width + mapProcessor.getDoorDimension().height) + x1 + mapProcessor.getTopLeftMapPoint().x, 0, 128); - int y = MathHelper.clamp_int(pt.y * (mapProcessor.getUnitRoomDimension().height + mapProcessor.getDoorDimension().height) + y1 + mapProcessor.getTopLeftMapPoint().y, 0, 128); - int i = y * 128 + x; - int j = dungeonRoom.getColor(); - - if (j / 4 == 0) { - this.mapTextureData[i] = 0x00000000; - } else { - this.mapTextureData[i] = MapColor.mapColorArray[j / 4].func_151643_b(j & 3); - } - } - } - } - } - } - - - this.mapTexture.updateDynamicTexture(); - } - - private void render(MapData mapData, boolean noOverlayRendering) { - int i = 0; - int j = 0; - Tessellator tessellator = Tessellator.getInstance(); - WorldRenderer worldrenderer = tessellator.getWorldRenderer(); - float f = 0.0F; - Minecraft.getMinecraft().getTextureManager().bindTexture(this.location); - GlStateManager.enableBlend(); - GlStateManager.tryBlendFuncSeparate(1, 771, 0, 1); - GlStateManager.disableAlpha(); - worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX); - worldrenderer.pos((float)(i) + f, (double)((float)(j + 128) - f), -0.009999999776482582D).tex(0.0D, 1.0D).endVertex(); - worldrenderer.pos((float)(i + 128) - f, (double)((float)(j + 128) - f), -0.009999999776482582D).tex(1.0D, 1.0D).endVertex(); - worldrenderer.pos((float)(i + 128) - f, (double)((float)(j) + f), -0.009999999776482582D).tex(1.0D, 0.0D).endVertex(); - worldrenderer.pos((float)(i) + f, (double)((float)(j) + f), -0.009999999776482582D).tex(0.0D, 0.0D).endVertex(); - tessellator.draw(); - GlStateManager.enableAlpha(); - GlStateManager.disableBlend(); - - GlStateManager.pushMatrix(); - GlStateManager.translate(0.0F, 0.0F, -0.04F); - GlStateManager.scale(1.0F, 1.0F, 1.0F); - GlStateManager.popMatrix(); - } - -} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonMilestone.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonMilestone.java deleted file mode 100644 index 05956c3f..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonMilestone.java +++ /dev/null @@ -1,74 +0,0 @@ -package kr.syeyoung.dungeonsguide.features.impl; - -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.FeatureRegistry; -import kr.syeyoung.dungeonsguide.features.GuiFeature; -import kr.syeyoung.dungeonsguide.features.listener.ChatListener; -import kr.syeyoung.dungeonsguide.features.listener.TickListener; -import kr.syeyoung.dungeonsguide.utils.TextUtils; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.network.NetworkPlayerInfo; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.scoreboard.ScorePlayerTeam; -import net.minecraft.util.ChatComponentText; -import net.minecraftforge.client.event.ClientChatReceivedEvent; -import org.lwjgl.opengl.GL11; - -import java.awt.*; -import java.util.regex.Pattern; - -public class FeatureDungeonMilestone extends GuiFeature implements ChatListener { - public FeatureDungeonMilestone() { - super("Dungeon", "Display Current Class Milestone", "Display current class milestone of yourself", "dungeon.stats.milestone", true, getFontRenderer().getStringWidth("Milestone: 12"), getFontRenderer().FONT_HEIGHT); - this.setEnabled(false); - parameters.put("color", new FeatureParameter("color", "Color", "Color of text", Color.orange, "color")); - } - - SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); - @Override - public void drawHUD(float partialTicks) { - if (!skyblockStatus.isOnDungeon()) return; - FontRenderer fr = getFontRenderer(); - double scale = getFeatureRect().getHeight() / fr.FONT_HEIGHT; - GlStateManager.scale(scale, scale, 0); - for (NetworkPlayerInfo networkPlayerInfoIn : Minecraft.getMinecraft().thePlayer.sendQueue.getPlayerInfoMap()) { - String name = networkPlayerInfoIn.getDisplayName() != null ? networkPlayerInfoIn.getDisplayName().getFormattedText() : ScorePlayerTeam.formatPlayerName(networkPlayerInfoIn.getPlayerTeam(), networkPlayerInfoIn.getGameProfile().getName()); - if (name.startsWith("§r Milestone: §r")) { - String milestone = TextUtils.stripColor(name).substring(13); - fr.drawString("Milestone: "+milestone, 0,0, this.getParameter("color").getValue().getRGB()); - return; - } - } - fr.drawString("Milestone: ?", 0,0, this.getParameter("color").getValue().getRGB()); - } - - @Override - public void drawDemo(float partialTicks) { - FontRenderer fr = getFontRenderer(); - double scale = getFeatureRect().getHeight() / fr.FONT_HEIGHT; - GlStateManager.scale(scale, scale, 0); - fr.drawString("Milestone: 9", 0,0, this.getParameter("color").getValue().getRGB()); - } - public static final Pattern milestone_pattern = Pattern.compile("§r§e§l(.+) Milestone §r§e(.)§r§7: .+ §r§a(.+)§r"); - - - @Override - public void onChat(ClientChatReceivedEvent clientChatReceivedEvent) { - if (clientChatReceivedEvent.type == 2) return;; - if (!skyblockStatus.isOnDungeon()) return; - DungeonContext context = skyblockStatus.getContext(); - if (context == null) return; - String txt = clientChatReceivedEvent.message.getFormattedText(); - if (milestone_pattern.matcher(txt).matches()) { - context.getMilestoneReached().add(new String[] { - TextUtils.formatTime(FeatureRegistry.DUNGEON_REALTIME.getTimeElapsed()), - TextUtils.formatTime(FeatureRegistry.DUNGEON_SBTIME.getTimeElapsed()) - }); - e.sendDebugChat(new ChatComponentText("Reached Milestone At " + TextUtils.formatTime(FeatureRegistry.DUNGEON_REALTIME.getTimeElapsed()) + " / "+TextUtils.formatTime(FeatureRegistry.DUNGEON_SBTIME.getTimeElapsed()))); - } - } -} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonRealTime.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonRealTime.java deleted file mode 100644 index 0efcd9b4..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonRealTime.java +++ /dev/null @@ -1,58 +0,0 @@ -package kr.syeyoung.dungeonsguide.features.impl; - -import kr.syeyoung.dungeonsguide.SkyblockStatus; -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.features.listener.DungeonEndListener; -import kr.syeyoung.dungeonsguide.features.listener.DungeonStartListener; -import kr.syeyoung.dungeonsguide.features.listener.TickListener; -import kr.syeyoung.dungeonsguide.utils.TextUtils; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraftforge.client.event.ClientChatReceivedEvent; -import org.lwjgl.opengl.GL11; - -import java.awt.*; -import java.text.SimpleDateFormat; - -public class FeatureDungeonRealTime extends GuiFeature implements DungeonStartListener, DungeonEndListener { - public FeatureDungeonRealTime() { - super("Dungeon", "Display Real Time-Dungeon Time", "Display how much real time has passed since dungeon run started", "dungeon.stats.realtime", true, getFontRenderer().getStringWidth("Time(Real): 59m 59s"), getFontRenderer().FONT_HEIGHT); - this.setEnabled(false); - parameters.put("color", new FeatureParameter("color", "Color", "Color of text", Color.orange, "color")); - } - - private long started = -1; - @Override - public void drawHUD(float partialTicks) { - if (started == -1) return; - FontRenderer fr = getFontRenderer(); - double scale = getFeatureRect().getHeight() / fr.FONT_HEIGHT; - GlStateManager.scale(scale, scale, 0); - fr.drawString("Time(Real): "+TextUtils.formatTime(getTimeElapsed()), 0,0, this.getParameter("color").getValue().getRGB()); - } - - public long getTimeElapsed() { - return System.currentTimeMillis() - started; - } - - @Override - public void drawDemo(float partialTicks) { - FontRenderer fr = getFontRenderer(); - double scale = getFeatureRect().getHeight() / fr.FONT_HEIGHT; - GlStateManager.scale(scale, scale, 0); - fr.drawString("Time(Real): -42h", 0,0, this.getParameter("color").getValue().getRGB()); - } - - @Override - public void onDungeonEnd() { - started = -1; - } - - @Override - public void onDungeonStart() { - started= System.currentTimeMillis(); - } -} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonSBTime.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonSBTime.java deleted file mode 100644 index 6cf8aa29..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonSBTime.java +++ /dev/null @@ -1,82 +0,0 @@ -package kr.syeyoung.dungeonsguide.features.impl; - -import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.e; -import kr.syeyoung.dungeonsguide.events.DungeonEndedEvent; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.GuiFeature; -import kr.syeyoung.dungeonsguide.features.listener.*; -import kr.syeyoung.dungeonsguide.utils.TextUtils; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.scoreboard.Score; -import net.minecraft.scoreboard.ScoreObjective; -import net.minecraft.scoreboard.ScorePlayerTeam; -import net.minecraft.scoreboard.Scoreboard; -import net.minecraftforge.client.event.ClientChatReceivedEvent; -import org.lwjgl.opengl.GL11; - -import java.awt.*; -import java.util.Collection; - -public class FeatureDungeonSBTime extends GuiFeature { - - private SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); - - public FeatureDungeonSBTime() { - super("Dungeon", "Display Ingame Dungeon Time", "Display how much time skyblock thinks has passed since dungeon run started", "dungeon.stats.igtime", true, getFontRenderer().getStringWidth("Time(IG): 1h 59m 59s"), getFontRenderer().FONT_HEIGHT); - this.setEnabled(false); - parameters.put("color", new FeatureParameter("color", "Color", "Color of text", Color.orange, "color")); - } - @Override - public void drawHUD(float partialTicks) { - if (!skyblockStatus.isOnDungeon()) return; - FontRenderer fr = getFontRenderer(); - double scale = getFeatureRect().getHeight() / fr.FONT_HEIGHT; - GlStateManager.scale(scale, scale, 0); - Scoreboard scoreboard = Minecraft.getMinecraft().theWorld.getScoreboard(); - ScoreObjective objective = scoreboard.getObjectiveInDisplaySlot(1); - Collection scores = scoreboard.getSortedScores(objective); - String time = "unknown"; - for (Score sc:scores) { - ScorePlayerTeam scorePlayerTeam = scoreboard.getPlayersTeam(sc.getPlayerName()); - String strippedLine = TextUtils.keepScoreboardCharacters(TextUtils.stripColor(ScorePlayerTeam.formatPlayerName(scorePlayerTeam, sc.getPlayerName()))).trim(); - if (strippedLine.startsWith("Time Elapsed: ")) { - time = strippedLine.substring(14); - } - } - fr.drawString("Time(Ig): "+time, 0,0, this.getParameter("color").getValue().getRGB()); - } - public int getTimeElapsed() { - Scoreboard scoreboard = Minecraft.getMinecraft().theWorld.getScoreboard(); - ScoreObjective objective = scoreboard.getObjectiveInDisplaySlot(1); - Collection scores = scoreboard.getSortedScores(objective); - String time = "idkyet"; - for (Score sc:scores) { - ScorePlayerTeam scorePlayerTeam = scoreboard.getPlayersTeam(sc.getPlayerName()); - String strippedLine = TextUtils.keepScoreboardCharacters(TextUtils.stripColor(ScorePlayerTeam.formatPlayerName(scorePlayerTeam, sc.getPlayerName()))).trim(); - if (strippedLine.startsWith("Time Elapsed: ")) { - time = strippedLine.substring(14); - } - } - time = time.replace(" ", ""); - int hour = time.indexOf('h') == -1 ? 0 : Integer.parseInt(time.substring(0, time.indexOf('h'))); - if (time.contains("h")) time = time.substring(time.indexOf('h') + 1); - int minute = time.indexOf('m') == -1 ? 0 : Integer.parseInt(time.substring(0, time.indexOf('m'))); - if (time.contains("m")) time = time.substring(time.indexOf('m') + 1); - int second = time.indexOf('s') == -1 ? 0 : Integer.parseInt(time.substring(0, time.indexOf('s'))); - - int time2 = hour * 60 * 60 + minute * 60 + second; - return time2 * 1000; - } - - @Override - public void drawDemo(float partialTicks) { - FontRenderer fr = getFontRenderer(); - double scale = getFeatureRect().getHeight() / fr.FONT_HEIGHT; - GlStateManager.scale(scale, scale, 0); - - fr.drawString("Time(Ig): -42h", 0,0, this.getParameter("color").getValue().getRGB()); - } -} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonScore.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonScore.java deleted file mode 100644 index 7390e649..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonScore.java +++ /dev/null @@ -1,211 +0,0 @@ -package kr.syeyoung.dungeonsguide.features.impl; - -import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.dungeon.DungeonContext; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.e; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.features.GuiFeature; -import kr.syeyoung.dungeonsguide.utils.TextUtils; -import lombok.AllArgsConstructor; -import lombok.Data; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.network.NetworkPlayerInfo; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.scoreboard.ScorePlayerTeam; -import net.minecraft.util.MathHelper; -import org.lwjgl.opengl.GL11; - -import java.awt.*; - -public class FeatureDungeonScore extends GuiFeature { - public FeatureDungeonScore() { - super("Dungeon", "Display Current Score", "Calculate and Display current score\nThis data is from pure calculation and can be different from actual score.", "dungeon.stats.score", false, 200, getFontRenderer().FONT_HEIGHT * 4); - this.setEnabled(false); - parameters.put("color", new FeatureParameter("color", "Color", "Color of text", Color.orange, "color")); - parameters.put("verbose", new FeatureParameter("verbose", "Show each score instead of sum", "Skill: 100 Explore: 58 S->S+(5 tombs) instead of Score: 305", true, "boolean")); - } - - SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); - @Override - public void drawHUD(float partialTicks) { - if (!skyblockStatus.isOnDungeon()) return; - FontRenderer fr = getFontRenderer(); - ScoreCalculation score = calculateScore(); - if (score == null) return; - int sum = score.time + score.skill + score.explorer + score.bonus; - if (this.getParameter("verbose").getValue()) { - String req = buildRequirement(score); - int rgb = this.getParameter("color").getValue().getRGB(); - fr.drawString("Skill: "+score.skill+" ("+score.deaths+" Deaths)", 0, 0, rgb); - fr.drawString("Explorer: "+score.explorer+" (Rooms "+(score.fullyCleared ? "O" : "X") + " secrets "+score.secrets+"/"+score.totalSecrets+(score.totalSecretsKnown ? "": "?")+")", 0, 8, rgb); - fr.drawString("Time: "+score.time+" Bonus: "+score.bonus+" ::: Total: "+sum, 0, 16, rgb); - fr.drawString(req, 0, 24, rgb); - } else { - double scale = getFeatureRect().getHeight() / fr.FONT_HEIGHT; - GlStateManager.scale(scale, scale, 0); - String letter = getLetter(sum); - fr.drawString("Score: "+sum + "("+letter+")", 0,0, this.getParameter("color").getValue().getRGB()); - } - } - - @Override - public void drawDemo(float partialTicks) { - FontRenderer fr = getFontRenderer(); - if (this.getParameter("verbose").getValue()) { - int rgb = this.getParameter("color").getValue().getRGB(); - fr.drawString("Skill: 100 (0 Deaths)", 0, 0, rgb); - fr.drawString("Explorer: 99 (Rooms O 39/40)", 0, 8, rgb); - fr.drawString("Time: 100 Bonus: 0 Total: 299", 0, 16, rgb); - fr.drawString("S->S+ (1 Required 1 tomb)", 0, 24, rgb); - } else { - double scale = getFeatureRect().getHeight() / fr.FONT_HEIGHT; - GlStateManager.scale(scale, scale, 0); - fr.drawString("Score: 305 (S+)", 0,0, this.getParameter("color").getValue().getRGB()); - } - } - - @Data - @AllArgsConstructor - public static class ScoreCalculation { - private int skill, explorer, time, bonus, tombs; - private boolean fullyCleared; - private int secrets, totalSecrets; - private boolean totalSecretsKnown; - private int deaths; - } - - public int getPercentage() { - return skyblockStatus.getPercentage(); - } - public int getCompleteRooms() { - for (NetworkPlayerInfo networkPlayerInfoIn : Minecraft.getMinecraft().thePlayer.sendQueue.getPlayerInfoMap()) { - String name = networkPlayerInfoIn.getDisplayName() != null ? networkPlayerInfoIn.getDisplayName().getFormattedText() : ScorePlayerTeam.formatPlayerName(networkPlayerInfoIn.getPlayerTeam(), networkPlayerInfoIn.getGameProfile().getName()); - if (name.startsWith("§r Completed Rooms: §r")) { - String milestone = TextUtils.stripColor(name).substring(18); - return Integer.parseInt(milestone); - } - } - return 0; - } - public int getTotalRooms() { - return (int) (100 * (getCompleteRooms() / (double)getPercentage())); - } - public int getUndiscoveredPuzzles() { - int cnt = 0; - for (NetworkPlayerInfo networkPlayerInfoIn : Minecraft.getMinecraft().thePlayer.sendQueue.getPlayerInfoMap()) { - String name = networkPlayerInfoIn.getDisplayName() != null ? networkPlayerInfoIn.getDisplayName().getFormattedText() : ScorePlayerTeam.formatPlayerName(networkPlayerInfoIn.getPlayerTeam(), networkPlayerInfoIn.getGameProfile().getName()); - if (name.startsWith("§r ???: ")) { - cnt ++; - } - } - return cnt; - } - - public ScoreCalculation calculateScore() { - if (!skyblockStatus.isOnDungeon()) return null; - DungeonContext context = skyblockStatus.getContext(); - if (context == null) return null; - if (!context.getMapProcessor().isInitialized()) return null; - - int skill = 100; - int deaths = 0; - { - deaths = FeatureRegistry.DUNGEON_DEATHS.getTotalDeaths(); - skill -= FeatureRegistry.DUNGEON_DEATHS.getTotalDeaths() * 2; - int totalCompRooms= 0; - boolean bossroomFound = false; - for (DungeonRoom dungeonRoom : context.getDungeonRoomList()) { - if (dungeonRoom.getColor() == 74) bossroomFound = true; - if (dungeonRoom.getCurrentState() != DungeonRoom.RoomState.DISCOVERED) - totalCompRooms += dungeonRoom.getUnitPoints().size(); - if (dungeonRoom.getColor() == 66 && dungeonRoom.getCurrentState() == DungeonRoom.RoomState.DISCOVERED) - skill -= 10; - if (dungeonRoom.getColor() == 74 && dungeonRoom.getCurrentState() == DungeonRoom.RoomState.DISCOVERED) - skill += 1; - skill += dungeonRoom.getCurrentState().getScoreModifier(); - } - if (!bossroomFound) skill += 1; - skill -= getUndiscoveredPuzzles() * 10; - skill -= (getTotalRooms() - totalCompRooms) * 4; - skill = MathHelper.clamp_int(skill, 0, 100); - } - int explorer = 0; - boolean fullyCleared = false; - boolean totalSecretsKnown = true; - int totalSecrets = 0; - int secrets = 0; - { - for (DungeonRoom dungeonRoom : context.getDungeonRoomList()) { - if (dungeonRoom.getTotalSecrets() != -1) - totalSecrets += dungeonRoom.getTotalSecrets(); - else totalSecretsKnown = false; - } - fullyCleared = getPercentage() == context.getDungeonRoomList().size() && context.getMapProcessor().getUndiscoveredRoom() == 0; - explorer += MathHelper.clamp_int((int) Math.floor(6.0 / 10.0 * getPercentage()), 0, 60); - explorer += MathHelper.clamp_int((int) Math.floor(40 * ((secrets = FeatureRegistry.DUNGEON_SECRETS.getSecretsFound()) / (double)totalSecrets)),0,40); - } - int time = 0; - { - double timeModifier; - if (context.getBossRoomEnterSeconds() != -1) { - timeModifier = Math.max(0, context.getBossRoomEnterSeconds() - 1200); - } else { - timeModifier = Math.max(0, FeatureRegistry.DUNGEON_SBTIME.getTimeElapsed() / 1000 - 1200); - } - time = (int) Math.floor(100 - 2.2 * timeModifier); - } - int bonus = 0; - int tombs; - { - bonus += tombs = MathHelper.clamp_int(FeatureRegistry.DUNGEON_TOMBS.getTombsFound(), 0, 5); - } - - // amazing thing - return new ScoreCalculation(skill, explorer, time, bonus, tombs, fullyCleared, secrets, totalSecrets, totalSecretsKnown, deaths); - } - public String getLetter(int score) { - if (score <= 99) return "D"; - if (score <= 159) return "C"; - if (score <= 229) return "B"; - if (score <= 269) return "A"; - if (score <= 299) return "S"; - return "S+"; - } - public int getScoreRequirement(String letter) { - if (letter.equals("D")) return 0; - if (letter.equals("C")) return 100; - if (letter.equals("B")) return 160; - if (letter.equals("A")) return 230; - if (letter.equals("S")) return 270; - if (letter.equals("S+")) return 300; - return -1; - } - public String getNextLetter(String letter) { - if (letter.equals("D")) return "C"; - if (letter.equals("C")) return "B"; - if (letter.equals("B")) return "A"; - if (letter.equals("A")) return "S"; - if (letter.equals("S")) return "S+"; - else return null; - } - public String buildRequirement(ScoreCalculation calculation) { - int current = calculation.time + calculation.bonus + calculation.explorer + calculation.skill; - String currentLetter = getLetter(current); - String nextLetter= getNextLetter(currentLetter); - if (nextLetter == null) return "S+ Expected"; - int req = getScoreRequirement(nextLetter); - int reqPT2 = req- current; - int reqPT = req - current; - - int tombsBreakable = Math.min(5 - calculation.tombs, reqPT); - reqPT -= tombsBreakable; - - double secretPer = 40.0 / calculation.totalSecrets; - int secrets = (int) Math.ceil(reqPT / secretPer); - - return currentLetter+"->"+nextLetter+" ("+reqPT2+" Req "+tombsBreakable+" crypts "+secrets+" secrets"+(calculation.totalSecretsKnown ? "" : "?")+")"; - } -} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonSecrets.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonSecrets.java deleted file mode 100644 index c82669db..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonSecrets.java +++ /dev/null @@ -1,72 +0,0 @@ -package kr.syeyoung.dungeonsguide.features.impl; - -import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.dungeon.DungeonContext; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.e; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.features.GuiFeature; -import kr.syeyoung.dungeonsguide.features.listener.ChatListener; -import kr.syeyoung.dungeonsguide.features.listener.TickListener; -import kr.syeyoung.dungeonsguide.utils.TextUtils; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.network.NetworkPlayerInfo; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.scoreboard.ScorePlayerTeam; -import net.minecraft.util.ChatComponentText; -import net.minecraftforge.client.event.ClientChatReceivedEvent; -import org.lwjgl.opengl.GL11; - -import java.awt.*; -import java.util.regex.Pattern; - -public class FeatureDungeonSecrets extends GuiFeature { - public FeatureDungeonSecrets() { - super("Dungeon", "Display #Secrets", "Display how much total secrets have been found in a dungeon run.\n+ sign means DG does not know the correct number, but it's somewhere above that number.", "dungeon.stats.secrets", true, getFontRenderer().getStringWidth("Secrets: 999/999+"), getFontRenderer().FONT_HEIGHT); - this.setEnabled(false); - parameters.put("color", new FeatureParameter("color", "Color", "Color of text", Color.orange, "color")); - } - - SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); - @Override - public void drawHUD(float partialTicks) { - if (!skyblockStatus.isOnDungeon()) return; - FontRenderer fr = getFontRenderer(); - double scale = getFeatureRect().getHeight() / fr.FONT_HEIGHT; - GlStateManager.scale(scale, scale, 0); - fr.drawString("Secrets: "+getSecretsFound() +"/"+getTotalSecrets(), 0,0, this.getParameter("color").getValue().getRGB()); - } - - @Override - public void drawDemo(float partialTicks) { - FontRenderer fr = getFontRenderer(); - double scale = getFeatureRect().getHeight() / fr.FONT_HEIGHT; - GlStateManager.scale(scale, scale, 0); - fr.drawString("Secrets: 999/2+", 0,0, this.getParameter("color").getValue().getRGB()); - } - - public int getSecretsFound() { - for (NetworkPlayerInfo networkPlayerInfoIn : Minecraft.getMinecraft().thePlayer.sendQueue.getPlayerInfoMap()) { - String name = networkPlayerInfoIn.getDisplayName() != null ? networkPlayerInfoIn.getDisplayName().getFormattedText() : ScorePlayerTeam.formatPlayerName(networkPlayerInfoIn.getPlayerTeam(), networkPlayerInfoIn.getGameProfile().getName()); - if (name.startsWith("§r Secrets Found: §r§b")) { - String noColor = TextUtils.stripColor(name); - return Integer.parseInt(noColor.substring(16)); - } - } - return 0; - } - - public String getTotalSecrets() { - DungeonContext context = skyblockStatus.getContext(); - int totalSecrets = 0; - boolean allknown = true; - for (DungeonRoom dungeonRoom : context.getDungeonRoomList()) { - if (dungeonRoom.getTotalSecrets() != -1) - totalSecrets += dungeonRoom.getTotalSecrets(); - else allknown = false; - } - return totalSecrets + (allknown ? "":"+"); - } -} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonTombs.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonTombs.java deleted file mode 100644 index 681cfd55..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonTombs.java +++ /dev/null @@ -1,51 +0,0 @@ -package kr.syeyoung.dungeonsguide.features.impl; - -import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.e; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.GuiFeature; -import kr.syeyoung.dungeonsguide.utils.TextUtils; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.network.NetworkPlayerInfo; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.scoreboard.ScorePlayerTeam; -import org.lwjgl.opengl.GL11; - -import java.awt.*; - -public class FeatureDungeonTombs extends GuiFeature { - public FeatureDungeonTombs() { - super("Dungeon", "Display #Crypts", "Display how much total crypts have been blown up in a dungeon run", "dungeon.stats.tombs", true, getFontRenderer().getStringWidth("Crypts: 42"), getFontRenderer().FONT_HEIGHT); - this.setEnabled(false); - parameters.put("color", new FeatureParameter("color", "Color", "Color of text", Color.orange, "color")); - } - - SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); - @Override - public void drawHUD(float partialTicks) { - if (!skyblockStatus.isOnDungeon()) return; - FontRenderer fr = getFontRenderer(); - double scale = getFeatureRect().getHeight() / fr.FONT_HEIGHT; - GlStateManager.scale(scale, scale, 0); - fr.drawString("Crypts: "+getTombsFound(), 0,0, this.getParameter("color").getValue().getRGB()); - } - - @Override - public void drawDemo(float partialTicks) { - FontRenderer fr = getFontRenderer(); - double scale = getFeatureRect().getHeight() / fr.FONT_HEIGHT; - GlStateManager.scale(scale, scale, 0); - fr.drawString("Crypts: 42", 0,0, this.getParameter("color").getValue().getRGB()); - } - - public int getTombsFound() { - for (NetworkPlayerInfo networkPlayerInfoIn : Minecraft.getMinecraft().thePlayer.sendQueue.getPlayerInfoMap()) { - String name = networkPlayerInfoIn.getDisplayName() != null ? networkPlayerInfoIn.getDisplayName().getFormattedText() : ScorePlayerTeam.formatPlayerName(networkPlayerInfoIn.getPlayerTeam(), networkPlayerInfoIn.getGameProfile().getName()); - if (name.startsWith("§r Crypts: §r§6")) { - return Integer.parseInt(TextUtils.stripColor(name).substring(9)); - } - } - return 0; - } -} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureInstaCloseChest.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureInstaCloseChest.java deleted file mode 100644 index db2439e5..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureInstaCloseChest.java +++ /dev/null @@ -1,124 +0,0 @@ -package kr.syeyoung.dungeonsguide.features.impl; - -import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.e; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.GuiFeature; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; -import kr.syeyoung.dungeonsguide.features.listener.GuiOpenListener; -import kr.syeyoung.dungeonsguide.features.listener.TickListener; -import kr.syeyoung.dungeonsguide.utils.AhUtils; -import kr.syeyoung.dungeonsguide.utils.TextUtils; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.GuiScreen; -import net.minecraft.client.gui.inventory.GuiChest; -import net.minecraft.inventory.ContainerChest; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.client.event.GuiOpenEvent; -import org.lwjgl.opengl.GL11; - -import java.awt.*; -import java.util.Comparator; -import java.util.HashMap; -import java.util.Set; -import java.util.TreeSet; - -public class FeatureInstaCloseChest extends SimpleFeature implements GuiOpenListener, TickListener { - public FeatureInstaCloseChest() { - super("Dungeon", "Auto-Close Secret Chest", "Automatically closes Secret Chest as soon as you open it\nCan put item price threshold by clicking edit", "qol.autoclose", false); - parameters.put("threshold", new FeatureParameter("threshold", "Price Threshold", "The maximum price of item for chest to be closed. Default 1m", 1000000, "integer")); - } - - SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); - private boolean check; - @Override - public void onGuiOpen(GuiOpenEvent event) { - if (!this.isEnabled()) return; - if (!skyblockStatus.isOnDungeon()) return; - if (!(event.gui instanceof GuiChest)) return; - - ContainerChest ch = (ContainerChest) ((GuiChest)event.gui).inventorySlots; - System.out.println(ch.getLowerChestInventory().getName()); - if (!("Large Chest".equals(ch.getLowerChestInventory().getName()) - || "Chest".equals(ch.getLowerChestInventory().getName()))) return; - check = true; - } - - public static int getPrice(ItemStack itemStack) { - if (itemStack == null) return 0; - NBTTagCompound compound = itemStack.getTagCompound(); - if (compound == null) - return 0; - if (!compound.hasKey("ExtraAttributes")) - return 0; - final String id = compound.getCompoundTag("ExtraAttributes").getString("id"); - if (id.equals("ENCHANTED_BOOK")) { - final NBTTagCompound enchants = compound.getCompoundTag("ExtraAttributes").getCompoundTag("enchantments"); - Set keys = enchants.getKeySet(); - Set actualKeys = new TreeSet(new Comparator() { - public int compare(String o1, String o2) { - String id2 = id + "::" + o1 + "-" + enchants.getInteger(o1); - AhUtils.AuctionData auctionData = AhUtils.auctions.get(id2); - int price1 = (auctionData == null) ? 0 : auctionData.lowestBin; - String id3 = id + "::" + o2 + "-" + enchants.getInteger(o2); - AhUtils.AuctionData auctionData2 = AhUtils.auctions.get(id3); - int price2 = (auctionData2 == null) ? 0 : auctionData2.lowestBin; - return (compare2(price1, price2) == 0) ? o1.compareTo(o2) : compare2(price1, price2); - } - - public int compare2(int y, int x) { - return (x < y) ? -1 : ((x == y) ? 0 : 1); - } - }); - actualKeys.addAll(keys); - int totalLowestPrice = 0; - for (String key : actualKeys) { - String id2 = id + "::" + key + "-" + enchants.getInteger(key); - AhUtils.AuctionData auctionData = AhUtils.auctions.get(id2); - totalLowestPrice += auctionData.lowestBin; - } - return totalLowestPrice; - } else { - AhUtils.AuctionData auctionData = AhUtils.auctions.get(id); - if (auctionData == null) { - return 0; - } else { - if (auctionData.sellPrice == -1 && auctionData.lowestBin != -1) return auctionData.lowestBin; - else if (auctionData.sellPrice != -1 && auctionData.lowestBin == -1) return auctionData.sellPrice; - else { - int ahPrice = auctionData.lowestBin; - if (ahPrice > auctionData.sellPrice) return ahPrice; - else return auctionData.sellPrice; - } - } - } - } - - @Override - public void onTick() { - if (!this.isEnabled()) return; - if (check) { - check = false; - - GuiScreen screen = Minecraft.getMinecraft().currentScreen; - if (screen instanceof GuiChest){ - - ContainerChest chest = (ContainerChest) ((GuiChest) screen).inventorySlots; - IInventory actualChest = chest.getLowerChestInventory(); - - int priceSum = 0; - for (int i = 0; i < actualChest.getSizeInventory(); i++) { - priceSum += getPrice(actualChest.getStackInSlot(i)); - } - - int threshold = this.getParameter("threshold").getValue(); - if (priceSum < threshold) { - Minecraft.getMinecraft().thePlayer.closeScreen(); - } - } - } - } -} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureTooltipDungeonStat.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureTooltipDungeonStat.java deleted file mode 100644 index a3f10c30..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureTooltipDungeonStat.java +++ /dev/null @@ -1,35 +0,0 @@ -package kr.syeyoung.dungeonsguide.features.impl; - -import kr.syeyoung.dungeonsguide.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; -import kr.syeyoung.dungeonsguide.features.listener.TooltipListener; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.event.entity.player.ItemTooltipEvent; - -public class FeatureTooltipDungeonStat extends SimpleFeature implements TooltipListener { - public FeatureTooltipDungeonStat() { - super("ETC", "Dungeon Item Stats", "Shows quality of dungeon items (floor, percentage)", "tooltip.dungeonitem"); - } - - @Override - public void onTooltip(ItemTooltipEvent event) { - if (!isEnabled()) return; - - ItemStack hoveredItem = event.itemStack; - NBTTagCompound compound = hoveredItem.getTagCompound(); - if (compound == null) - return; - if (!compound.hasKey("ExtraAttributes")) - return; - NBTTagCompound nbtTagCompound = compound.getCompoundTag("ExtraAttributes"); - - int floor = nbtTagCompound.getInteger("item_tier"); - int percentage = nbtTagCompound.getInteger("baseStatBoostPercentage"); - - if (nbtTagCompound.hasKey("item_tier")) - event.toolTip.add("§7Obtained in: §c"+(floor == 0 ? "Entrance" : "Floor "+floor)); - if (nbtTagCompound.hasKey("baseStatBoostPercentage")) - event.toolTip.add("§7Stat Percentage: §"+(percentage == 50 ? "6§l":"c")+(percentage * 2)+"%"); - } -} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureTooltipPrice.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureTooltipPrice.java deleted file mode 100644 index ba8422af..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureTooltipPrice.java +++ /dev/null @@ -1,93 +0,0 @@ -package kr.syeyoung.dungeonsguide.features.impl; - -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; -import kr.syeyoung.dungeonsguide.features.listener.TooltipListener; -import kr.syeyoung.dungeonsguide.utils.AhUtils; -import kr.syeyoung.dungeonsguide.utils.TextUtils; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.event.entity.player.ItemTooltipEvent; -import org.lwjgl.input.Keyboard; - -import java.util.Comparator; -import java.util.Set; -import java.util.TreeSet; - -public class FeatureTooltipPrice extends SimpleFeature implements TooltipListener { - public FeatureTooltipPrice() { - super("ETC", "Item Price", "Shows price of items", "tooltip.price"); - parameters.put("reqShift", new FeatureParameter("reqShift", "Require Shift", "If shift needs to be pressed in order for this feature to be activated", false, "boolean")); - } - - @Override - public void onTooltip(ItemTooltipEvent event) { - if (!isEnabled()) return; - - boolean activated = !this.getParameter("reqShift").getValue() || Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT); - - ItemStack hoveredItem = event.itemStack; - NBTTagCompound compound = hoveredItem.getTagCompound(); - if (compound == null) - return; - if (!compound.hasKey("ExtraAttributes")) - return; - if (!activated) { - event.toolTip.add("§7Shift to view price"); - return; - } - - final String id = compound.getCompoundTag("ExtraAttributes").getString("id"); - if (id.equals("ENCHANTED_BOOK")) { - final NBTTagCompound enchants = compound.getCompoundTag("ExtraAttributes").getCompoundTag("enchantments"); - Set keys = enchants.getKeySet(); - Set actualKeys = new TreeSet(new Comparator() { - public int compare(String o1, String o2) { - String id2 = id + "::" + o1 + "-" + enchants.getInteger(o1); - AhUtils.AuctionData auctionData = AhUtils.auctions.get(id2); - int price1 = (auctionData == null) ? 0 : auctionData.lowestBin; - String id3 = id + "::" + o2 + "-" + enchants.getInteger(o2); - AhUtils.AuctionData auctionData2 = AhUtils.auctions.get(id3); - int price2 = (auctionData2 == null) ? 0 : auctionData2.lowestBin; - return (compare2(price1, price2) == 0) ? o1.compareTo(o2) : compare2(price1, price2); - } - - public int compare2(int y, int x) { - return (x < y) ? -1 : ((x == y) ? 0 : 1); - } - }); - actualKeys.addAll(keys); - int totalLowestPrice = 0; - int iterations = 0; - for (String key : actualKeys) { - iterations++; - String id2 = id + "::" + key + "-" + enchants.getInteger(key); - AhUtils.AuctionData auctionData = AhUtils.auctions.get(id2); - if (auctionData == null) { - if (iterations < 10) - event.toolTip.add("§f"+ key + " " + enchants.getInteger(key) + "§7: §cn/a"); - continue; - } - if (iterations < 10) - event.toolTip.add("§f"+ key + " " + enchants.getInteger(key) + "§7: §e"+ TextUtils.format( auctionData.lowestBin)); - totalLowestPrice += auctionData.lowestBin; - } - if (iterations >= 10) - event.toolTip.add("§7"+ (iterations - 10) + " more enchants... "); - event.toolTip.add("§fTotal Lowest§7: §e"+ TextUtils.format(totalLowestPrice)); - } else { - AhUtils.AuctionData auctionData = AhUtils.auctions.get(id); - event.toolTip.add(""); - if (auctionData == null) { - event.toolTip.add("§fLowest ah §7: §cn/a"); - event.toolTip.add("§fBazaar sell price §7: §cn/a"); - event.toolTip.add("§fBazaar buy price §7: §cn/a"); - } else { - event.toolTip.add("§fLowest ah §7: " + ((auctionData.lowestBin != -1) ? ("§e"+ TextUtils.format(auctionData.lowestBin)) : "§cn/a")); - event.toolTip.add("§fBazaar sell price §7: " + ((auctionData.sellPrice == -1) ? "§cn/a": ("§e"+ TextUtils.format(auctionData.sellPrice)))); - event.toolTip.add("§fBazaar buy price §7: " + ((auctionData.buyPrice == -1) ? "§cn/a": ("§e"+ TextUtils.format(auctionData.buyPrice)))); - } - } - } -} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureWarnLowHealth.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureWarnLowHealth.java deleted file mode 100644 index 5c426292..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureWarnLowHealth.java +++ /dev/null @@ -1,74 +0,0 @@ -package kr.syeyoung.dungeonsguide.features.impl; - -import com.google.common.base.Predicate; -import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.e; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.GuiFeature; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; -import kr.syeyoung.dungeonsguide.features.listener.WorldRenderListener; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; -import kr.syeyoung.dungeonsguide.utils.TextUtils; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.entity.item.EntityArmorStand; -import net.minecraft.scoreboard.Score; -import net.minecraft.scoreboard.ScoreObjective; -import net.minecraft.scoreboard.ScorePlayerTeam; -import net.minecraft.scoreboard.Scoreboard; -import net.minecraft.util.BlockPos; -import org.jetbrains.annotations.Nullable; -import org.lwjgl.opengl.GL11; - -import java.awt.*; -import java.util.List; - - -public class FeatureWarnLowHealth extends GuiFeature { - public FeatureWarnLowHealth() { - super("Dungeon", "Low Health Warning", "Warn if someone is on low health", "dungeon.lowhealthwarn", false, 200, 50); - parameters.put("color", new FeatureParameter("color", "Color", "Color of playername", Color.yellow, "color")); - parameters.put("threshold", new FeatureParameter("threshold", "Health Threshold", "Health Threshold for this feature to be toggled. default to 500", 500, "integer")); - - } - - - private SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); - - @Override - public void drawDemo(float partialTicks) { - FontRenderer fr = getFontRenderer(); - double scale = getFeatureRect().getHeight() / fr.FONT_HEIGHT; - GlStateManager.scale(scale, scale, 0); - fr.drawString("DungeonsGuide: ", 0,0,this.getParameter("color").getValue().getRGB()); - fr.drawString("500hp", fr.getStringWidth("DungeonsGuide: "), 0, Color.red.getRGB()); - } - - @Override - public void drawHUD(float partialTicks) { - FontRenderer fr = getFontRenderer(); - double scale = getFeatureRect().getHeight() / fr.FONT_HEIGHT; - GlStateManager.scale(scale, scale, 0); - String lowestHealthName = ""; - int lowestHealth = 999999999; - Scoreboard scoreboard = Minecraft.getMinecraft().thePlayer.getWorldScoreboard(); - ScoreObjective objective = scoreboard.getObjectiveInDisplaySlot(1); - for (Score sc : scoreboard.getSortedScores(objective)) { - ScorePlayerTeam scorePlayerTeam = scoreboard.getPlayersTeam(sc.getPlayerName()); - String line = ScorePlayerTeam.formatPlayerName(scorePlayerTeam, sc.getPlayerName()).trim(); - String stripped = TextUtils.keepScoreboardCharacters(TextUtils.stripColor(line)); - if (line.endsWith("❤")) { - String name = stripped.split(" ")[1]; - int health = Integer.parseInt(stripped.split(" ")[2]); - if (health < lowestHealth) { - lowestHealth = health; - lowestHealthName = name; - } - } - } - if (lowestHealth > this.getParameter("threshold").getValue()) return; - fr.drawString(lowestHealthName+": ", 0,0,this.getParameter("color").getValue().getRGB()); - fr.drawString(lowestHealth+"hp", fr.getStringWidth(lowestHealthName+"DungeonsGuide: "), 0, Color.red.getRGB()); - } -} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureAutoReparty.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureAutoReparty.java new file mode 100644 index 00000000..d1ec99f3 --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureAutoReparty.java @@ -0,0 +1,30 @@ +package kr.syeyoung.dungeonsguide.features.impl.boss; + +import kr.syeyoung.dungeonsguide.e; +import kr.syeyoung.dungeonsguide.features.SimpleFeature; +import kr.syeyoung.dungeonsguide.features.listener.DungeonEndListener; +import kr.syeyoung.dungeonsguide.features.listener.GuiBackgroundRenderListener; +import kr.syeyoung.dungeonsguide.utils.TextUtils; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.gui.Gui; +import net.minecraft.client.gui.inventory.GuiChest; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.inventory.ContainerChest; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraftforge.client.event.GuiScreenEvent; +import org.lwjgl.opengl.GL11; + +public class FeatureAutoReparty extends SimpleFeature implements DungeonEndListener { + public FeatureAutoReparty() { + super("Bossfight", "Auto reparty when dungeon finishes","Auto reparty on dungeon finish\n\nThis automates player chatting action, (disbanding, repartying) Thus it might be against hypixel's rules.\nBut mods like auto-gg exist so I'm leaving this feature.\nThis option is use-at-your-risk and you'll be responsible for ban if you somehow get banned because of this feature\n(Although it is not likely to happen)\nDefaults to off", "bossfight.autoreparty", false); + } + + @Override + public void onDungeonEnd() { + if (isEnabled()) e.getDungeonsGuide().getCommandReparty().requestReparty(); + } +} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureChestPrice.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureChestPrice.java new file mode 100644 index 00000000..349af180 --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureChestPrice.java @@ -0,0 +1,93 @@ +package kr.syeyoung.dungeonsguide.features.impl.boss; + +import kr.syeyoung.dungeonsguide.e; +import kr.syeyoung.dungeonsguide.features.SimpleFeature; +import kr.syeyoung.dungeonsguide.features.impl.dungeon.FeatureInstaCloseChest; +import kr.syeyoung.dungeonsguide.features.listener.GuiBackgroundRenderListener; +import kr.syeyoung.dungeonsguide.utils.TextUtils; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.gui.Gui; +import net.minecraft.client.gui.inventory.GuiChest; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.inventory.ContainerChest; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraftforge.client.event.GuiScreenEvent; + +public class FeatureChestPrice extends SimpleFeature implements GuiBackgroundRenderListener { + public FeatureChestPrice() { + super("Bossfight", "Show Profit of Dungeon Chests","Show Profit of Dungeon Chests", "bossfight.profitchest", true); + } + + @Override + public void onGuiBGRender(GuiScreenEvent.BackgroundDrawnEvent rendered) { + if (!isEnabled()) return; + if (!(rendered.gui instanceof GuiChest)) return; + if (!e.getDungeonsGuide().getSkyblockStatus().isOnDungeon()) return; + + GlStateManager.disableLighting(); + + ContainerChest chest = (ContainerChest) ((GuiChest) rendered.gui).inventorySlots; + if (!chest.getLowerChestInventory().getName().endsWith("Chest")) return; + IInventory actualChest = chest.getLowerChestInventory(); + + int chestPrice = 0; + int itemPrice = 0; + for (int i = 0; i 0) { + for (int j1 = 0; j1 < nbttaglist1.tagCount(); ++j1) { + String str = nbttaglist1.getStringTagAt(j1); + if (str.endsWith("Coins")) { + String coins = TextUtils.stripColor(str).replace(" Coins", "").replace(",",""); + try { + chestPrice = Integer.parseInt(coins); + } catch (Exception e) { + + } + } + } + } + } + } + } + itemPrice += FeatureInstaCloseChest.getPrice(item) * item.stackSize; + } + } + + int i = 222; + int j = i - 108; + int ySize = j + (actualChest.getSizeInventory() / 9) * 18; + int left = (rendered.gui.width + 176) / 2; + int top = (rendered.gui.height - ySize ) / 2; + + int width = 120; + + GlStateManager.pushMatrix(); + GlStateManager.translate(left, top, 0); + Gui.drawRect( 0,0,width, 30, 0xFFDDDDDD); + + FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; + fr.drawString("BIN/AH Price: ", 5,5, 0xFF000000); + String str = TextUtils.format(itemPrice); + fr.drawString(str, width - fr.getStringWidth(str) - 5, 5, 0xFF000000); + + fr.drawString("Profit: ", 5,15, 0xFF000000); + str = (itemPrice > chestPrice ? "+" : "") +TextUtils.format(itemPrice - chestPrice); + fr.drawString(str, width - fr.getStringWidth(str) - 5, 15, itemPrice > chestPrice ? 0xFF00CC00 : 0xFFCC0000); + + GlStateManager.popMatrix(); + } +} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureBoxSkelemaster.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureBoxSkelemaster.java new file mode 100644 index 00000000..a4a144e5 --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureBoxSkelemaster.java @@ -0,0 +1,51 @@ +package kr.syeyoung.dungeonsguide.features.impl.dungeon; + +import com.google.common.base.Predicate; +import kr.syeyoung.dungeonsguide.SkyblockStatus; +import kr.syeyoung.dungeonsguide.config.types.AColor; +import kr.syeyoung.dungeonsguide.e; +import kr.syeyoung.dungeonsguide.features.FeatureParameter; +import kr.syeyoung.dungeonsguide.features.SimpleFeature; +import kr.syeyoung.dungeonsguide.features.listener.WorldRenderListener; +import kr.syeyoung.dungeonsguide.utils.RenderUtils; +import net.minecraft.client.Minecraft; +import net.minecraft.entity.item.EntityArmorStand; +import net.minecraft.entity.monster.EntitySkeleton; +import net.minecraft.util.BlockPos; +import org.jetbrains.annotations.Nullable; + +import java.awt.*; +import java.util.List; + + +public class FeatureBoxSkelemaster extends SimpleFeature implements WorldRenderListener { + public FeatureBoxSkelemaster() { + super("Dungeon", "Box Skeleton Masters", "Box skeleton masters in dungeons", "dungeon.skeletonmasterbox", true); + parameters.put("radius", new FeatureParameter("radius", "Highlight Radius", "The maximum distance between player and skeletonmaster to be boxed", 20, "integer")); + parameters.put("color", new FeatureParameter("color", "Highlight Color", "Highlight Color of Skeleton master", new AColor(255,0,0,50), "acolor")); + } + + + private SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); + @Override + public void drawWorld(float partialTicks) { + if (!isEnabled()) return; + if (!skyblockStatus.isOnDungeon()) return; + + final BlockPos player = Minecraft.getMinecraft().thePlayer.getPosition(); + int val = this.getParameter("radius").getValue(); + final int sq = val * val; + + List skeletonList = Minecraft.getMinecraft().theWorld.getEntities(EntityArmorStand.class, new Predicate() { + @Override + public boolean apply(@Nullable EntityArmorStand input) { + if (player.distanceSq(input.getPosition()) > sq) return false; + return input.getName().contains("Skeleton Master"); + } + }); + Color c = this.getParameter("color").getValue(); + for (EntityArmorStand entitySkeleton : skeletonList) { + RenderUtils.highlightBox(entitySkeleton, c, partialTicks, true); + } + } +} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureBoxStarMobs.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureBoxStarMobs.java new file mode 100644 index 00000000..64176d71 --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureBoxStarMobs.java @@ -0,0 +1,50 @@ +package kr.syeyoung.dungeonsguide.features.impl.dungeon; + +import com.google.common.base.Predicate; +import kr.syeyoung.dungeonsguide.SkyblockStatus; +import kr.syeyoung.dungeonsguide.config.types.AColor; +import kr.syeyoung.dungeonsguide.e; +import kr.syeyoung.dungeonsguide.features.FeatureParameter; +import kr.syeyoung.dungeonsguide.features.SimpleFeature; +import kr.syeyoung.dungeonsguide.features.listener.WorldRenderListener; +import kr.syeyoung.dungeonsguide.utils.RenderUtils; +import net.minecraft.client.Minecraft; +import net.minecraft.entity.item.EntityArmorStand; +import net.minecraft.util.BlockPos; +import org.jetbrains.annotations.Nullable; + +import java.awt.*; +import java.util.List; + + +public class FeatureBoxStarMobs extends SimpleFeature implements WorldRenderListener { + public FeatureBoxStarMobs() { + super("Dungeon", "Box Starred mobs", "Box Starred mobs in dungeons", "dungeon.starmobbox", false); + parameters.put("radius", new FeatureParameter("radius", "Highlight Radius", "The maximum distance between player and skeletonmaster to be boxed", 20, "integer")); + parameters.put("color", new FeatureParameter("color", "Highlight Color", "Highlight Color of Skeleton master", new AColor(0,255,255,50), "acolor")); + } + + + private SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); + @Override + public void drawWorld(float partialTicks) { + if (!isEnabled()) return; + if (!skyblockStatus.isOnDungeon()) return; + + final BlockPos player = Minecraft.getMinecraft().thePlayer.getPosition(); + int val = this.getParameter("radius").getValue(); + final int sq = val * val; + + List skeletonList = Minecraft.getMinecraft().theWorld.getEntities(EntityArmorStand.class, new Predicate() { + @Override + public boolean apply(@Nullable EntityArmorStand input) { + if (player.distanceSq(input.getPosition()) > sq) return false; + return input.getName().contains("✯"); + } + }); + Color c = this.getParameter("color").getValue(); + for (EntityArmorStand entitySkeleton : skeletonList) { + RenderUtils.highlightBox(entitySkeleton, c, partialTicks, true); + } + } +} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonDeaths.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonDeaths.java new file mode 100644 index 00000000..89fcc47c --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonDeaths.java @@ -0,0 +1,94 @@ +package kr.syeyoung.dungeonsguide.features.impl.dungeon; + +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.features.listener.TickListener; +import kr.syeyoung.dungeonsguide.utils.TextUtils; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.util.ChatComponentText; +import net.minecraftforge.client.event.ClientChatReceivedEvent; +import org.lwjgl.opengl.GL11; + +import java.awt.*; +import java.util.Map; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +public class FeatureDungeonDeaths extends GuiFeature implements ChatListener { + public FeatureDungeonDeaths() { + super("Dungeon", "Display Deaths", "Display names of player and death count in dungeon run", "dungeon.stats.deaths", false, getFontRenderer().getStringWidth("longestplayernamepos: 100"), getFontRenderer().FONT_HEIGHT * 6); + this.setEnabled(false); + parameters.put("color", new FeatureParameter("color", "Color", "Color of text", Color.orange, "color")); + } + + SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); + @Override + public void drawHUD(float partialTicks) { + if (!skyblockStatus.isOnDungeon()) return; + DungeonContext context = skyblockStatus.getContext(); + if (context == null) return; + Map deaths = context.getDeaths(); + int i = 0; + int deathsCnt = 0; + FontRenderer fr = getFontRenderer(); + for (Map.Entry death:deaths.entrySet()) { + fr.drawString(death.getKey()+": "+death.getValue(), 0,i, this.getParameter("color").getValue().getRGB()); + i += 8; + deathsCnt += death.getValue(); + } + fr.drawString("Total Deaths: "+deathsCnt, 0,i, this.getParameter("color").getValue().getRGB()); + } + + public int getTotalDeaths() { + if (!skyblockStatus.isOnDungeon()) return 0; + DungeonContext context = skyblockStatus.getContext(); + if (context == null) return 0; + int d = 0; + for (Integer value : context.getDeaths().values()) { + d += value; + } + return d; + } + + @Override + public void drawDemo(float partialTicks) { + FontRenderer fr = getFontRenderer(); + fr.drawString("syeyoung: -130", 0,0, this.getParameter("color").getValue().getRGB()); + fr.drawString("notsyeyoung: -13", 0,8, this.getParameter("color").getValue().getRGB()); + fr.drawString("dungeonsguide: -42", 0,16, this.getParameter("color").getValue().getRGB()); + fr.drawString("--not more--", 0,24, this.getParameter("color").getValue().getRGB()); + fr.drawString("--maybe more--", 0,32, this.getParameter("color").getValue().getRGB()); + fr.drawString("Total Deaths: 0", 0,40, this.getParameter("color").getValue().getRGB()); + } + + Pattern deathPattern = Pattern.compile("§r§c ☠ (.+?)§r§7 .+and became a ghost.+"); + Pattern meDeathPattern = Pattern.compile("§r§c ☠ §r§7You .+and became a ghost.+"); + + @Override + public void onChat(ClientChatReceivedEvent clientChatReceivedEvent) { + if (clientChatReceivedEvent.type == 2) return; + if (!skyblockStatus.isOnDungeon()) return; + DungeonContext context = skyblockStatus.getContext(); + if (context == null) return; + + String txt = clientChatReceivedEvent.message.getFormattedText(); + Matcher m = deathPattern.matcher(txt); + if (m.matches()) { + String nickname = TextUtils.stripColor(m.group(1)); + int deaths = context.getDeaths().containsKey(nickname) ? context.getDeaths().get(nickname) : 0; + context.getDeaths().put(nickname, deaths + 1); + e.sendDebugChat(new ChatComponentText("Death verified :: "+nickname+" / "+(deaths + 1))); + } + Matcher m2 = meDeathPattern.matcher(txt); + if (m2.matches()) { + String nickname = "me"; + int deaths = context.getDeaths().containsKey(nickname) ? context.getDeaths().get(nickname) : 0; + context.getDeaths().put(nickname, deaths + 1); + e.sendDebugChat(new ChatComponentText("Death verified :: me / "+(deaths + 1))); + } + } +} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonMap.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonMap.java new file mode 100644 index 00000000..f2c20965 --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonMap.java @@ -0,0 +1,322 @@ +package kr.syeyoung.dungeonsguide.features.impl.dungeon; + +import com.google.common.collect.ComparisonChain; +import com.google.common.collect.Ordering; +import com.mojang.authlib.GameProfile; +import kr.syeyoung.dungeonsguide.SkyblockStatus; +import kr.syeyoung.dungeonsguide.config.types.AColor; +import kr.syeyoung.dungeonsguide.dungeon.DungeonContext; +import kr.syeyoung.dungeonsguide.dungeon.MapProcessor; +import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.e; +import kr.syeyoung.dungeonsguide.features.FeatureParameter; +import kr.syeyoung.dungeonsguide.features.GuiFeature; +import kr.syeyoung.dungeonsguide.features.listener.BossroomEnterListener; +import kr.syeyoung.dungeonsguide.features.listener.ChatListener; +import kr.syeyoung.dungeonsguide.features.listener.DungeonEndListener; +import kr.syeyoung.dungeonsguide.features.listener.DungeonStartListener; +import kr.syeyoung.dungeonsguide.utils.RenderUtils; +import kr.syeyoung.dungeonsguide.utils.TextUtils; +import net.minecraft.block.material.MapColor; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.gui.Gui; +import net.minecraft.client.gui.GuiPlayerTabOverlay; +import net.minecraft.client.gui.MapItemRenderer; +import net.minecraft.client.network.NetworkPlayerInfo; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.texture.DynamicTexture; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EnumPlayerModelParts; +import net.minecraft.scoreboard.ScorePlayerTeam; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.MathHelper; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.Vec4b; +import net.minecraft.world.WorldSettings; +import net.minecraft.world.storage.MapData; +import net.minecraftforge.client.event.ClientChatReceivedEvent; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; +import org.lwjgl.opengl.GL11; + +import java.awt.*; +import java.util.List; +import java.util.Comparator; +import java.util.Map; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +public class FeatureDungeonMap extends GuiFeature implements DungeonEndListener, DungeonStartListener, BossroomEnterListener { + public FeatureDungeonMap() { + super("Dungeon", "Dungeon Map", "Display dungeon map!", "dungeon.map", true, 128,128); + this.setEnabled(false); + parameters.put("scale", new FeatureParameter("scale", "Scale map", "Whether to scale map to fit screen", true, "boolean")); + parameters.put("playerCenter", new FeatureParameter("playerCenter", "Center map at player", "Render you in the center", false, "boolean")); + parameters.put("rotate", new FeatureParameter("rotate", "Rotate map centered at player", "Only works with Center map at player enabled", false, "boolean")); + parameters.put("postScale", new FeatureParameter("postScale", "Scale factor of map", "Only works with Center map at player enabled", 1.0f, "float")); + parameters.put("showotherplayers", new FeatureParameter("showotherplayers", "Show other players", "Option to show other players in map", true, "boolean")); + parameters.put("showtotalsecrets", new FeatureParameter("showtotalsecrets", "Show Total secrets in the room", "Option to overlay total secrets in the specific room", true, "boolean")); + parameters.put("playerheadscale", new FeatureParameter("playerheadscale", "Player head scale", "Scale factor of player heads, defaults to 1", 1.0f, "float")); + parameters.put("textScale", new FeatureParameter("textScale", "Text scale", "Scale factor of texts on map, defaults to 1", 1.0f, "float")); + parameters.put("border_color", new FeatureParameter("border_color", "Color of the border", "Same as name", new AColor(255,255,255,255), "acolor")); + parameters.put("background_color", new FeatureParameter("background_color", "Color of the background", "Same as name", new AColor(0x22000000, true), "acolor")); + parameters.put("chromaborder", new FeatureParameter("chromaborder", "Chroma border", "Rainbow!!! (Overrides border color option)", false, "boolean")); + parameters.put("player_color", new FeatureParameter("player_color", "Color of the player border", "Same as name", new AColor(255,255,255,0), "acolor")); + parameters.put("player_chroma", new FeatureParameter("player_chroma", "Chroma border for player", "Rainbow!!! (Overrides border color option)", false, "boolean")); + } + + SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); + public static final Ordering field_175252_a = Ordering.from(new PlayerComparator()); + + private boolean on = false; + + @Override + public void onDungeonEnd() { + on = false; + } + + @Override + public void onDungeonStart() { + on = true; + } + + @Override + public void onBossroomEnter() { + on = false; + } + + @SideOnly(Side.CLIENT) + static class PlayerComparator implements Comparator + { + private PlayerComparator() + { + } + + public int compare(NetworkPlayerInfo p_compare_1_, NetworkPlayerInfo p_compare_2_) + { + ScorePlayerTeam scoreplayerteam = p_compare_1_.getPlayerTeam(); + ScorePlayerTeam scoreplayerteam1 = p_compare_2_.getPlayerTeam(); + return ComparisonChain.start().compareTrueFirst(p_compare_1_.getGameType() != WorldSettings.GameType.SPECTATOR, p_compare_2_.getGameType() != WorldSettings.GameType.SPECTATOR).compare(scoreplayerteam != null ? scoreplayerteam.getRegisteredName() : "", scoreplayerteam1 != null ? scoreplayerteam1.getRegisteredName() : "").compare(p_compare_1_.getGameProfile().getName(), p_compare_2_.getGameProfile().getName()).result(); + } + } + @Override + public void drawHUD(float partialTicks) { + if (!skyblockStatus.isOnDungeon()) return; + if (skyblockStatus.getContext() == null | !skyblockStatus.getContext().getMapProcessor().isInitialized()) return; + if (!on) return;; + + DungeonContext context = skyblockStatus.getContext(); + MapProcessor mapProcessor = context.getMapProcessor(); + MapData mapData = mapProcessor.getLastMapData2(); + Gui.drawRect(0,0,getFeatureRect().width, getFeatureRect().height, this.getParameter("background_color").getValue().getRGB()); + GlStateManager.color(1,1,1,1); + GlStateManager.pushMatrix();; + if (mapData == null) { + Gui.drawRect(0,0,getFeatureRect().width, getFeatureRect().height, 0xFFFF0000); + } else { + renderMap(partialTicks,mapProcessor,mapData,context); + } + GlStateManager.popMatrix(); + GL11.glLineWidth(2); + RenderUtils.drawUnfilledBox(0,0,getFeatureRect().width, getFeatureRect().height, this.getParameter("border_color").getValue().getRGB(), this.getParameter("chromaborder").getValue()); + } + + @Override + public void drawDemo(float partialTicks) { + if (skyblockStatus.isOnDungeon() && skyblockStatus.getContext() != null && skyblockStatus.getContext().getMapProcessor().isInitialized() && on) { + drawHUD(partialTicks); + return; + } + Gui.drawRect(0,0,getFeatureRect().width, getFeatureRect().height, this.getParameter("background_color").getValue().getRGB()); + FontRenderer fr = getFontRenderer(); + fr.drawString("Please join a dungeon to see preview", getFeatureRect().width / 2 - fr.getStringWidth("Please join a dungeon to see preview") / 2, getFeatureRect().height / 2 - fr.FONT_HEIGHT / 2, 0xFFFFFFFF); + GL11.glLineWidth(2); + RenderUtils.drawUnfilledBox(0,0,getFeatureRect().width, getFeatureRect().height, this.getParameter("border_color").getValue().getRGB(), this.getParameter("chromaborder").getValue()); + } + + public void renderMap(float partialTicks, MapProcessor mapProcessor, MapData mapData, DungeonContext context){ + float postScale = this.getParameter("playerCenter").getValue() ? this.getParameter("postScale").getValue() : 1; + int width = getFeatureRect().width; + float scale = (this.getParameter("scale").getValue() ? width / 128.0f : 1); + GlStateManager.translate(width / 2, width / 2, 0); + GlStateManager.scale(scale, scale, 0); + GlStateManager.scale(postScale, postScale,0); + EntityPlayer p = Minecraft.getMinecraft().thePlayer; + Point pt = mapProcessor.worldPointToMapPoint(p.getPositionEyes(partialTicks)); + double yaw = p.prevRotationYawHead + (p.rotationYaw - p.prevRotationYawHead) * partialTicks; + if (this.getParameter("playerCenter").getValue()) { + if (this.getParameter("rotate").getValue()) { + GlStateManager.rotate((float) (180.0 - yaw), 0,0,1); + } + GlStateManager.translate( -pt.x, -pt.y, 0); + } else { + GlStateManager.translate( -64, -64, 0); + } + updateMapTexture(mapData.colors, mapProcessor, context.getDungeonRoomList()); + render(mapData, false); + + + GlStateManager.enableBlend(); + GlStateManager.tryBlendFuncSeparate(1, 771, 0, 1); + + + + List list = field_175252_a.sortedCopy(Minecraft.getMinecraft().thePlayer.sendQueue.getPlayerInfoMap()); + if (list.size() < 40) return; + for (int i = 1; i < 20; i++) { + NetworkPlayerInfo networkPlayerInfo = list.get(i); + String name = networkPlayerInfo.getDisplayName() != null ? networkPlayerInfo.getDisplayName().getFormattedText() : ScorePlayerTeam.formatPlayerName(networkPlayerInfo.getPlayerTeam(), networkPlayerInfo.getGameProfile().getName()); + if (name.trim().equals("§r") || name.startsWith("§r ")) continue; + String actual = TextUtils.stripColor(name).trim().split(" ")[0]; + EntityPlayer entityplayer = Minecraft.getMinecraft().theWorld.getPlayerEntityByName(actual); + if (TextUtils.stripColor(name).endsWith("(DEAD)") && entityplayer != Minecraft.getMinecraft().thePlayer) { + continue; + } + Point pt2; + double yaw2; + + if (entityplayer != null) { + pt2 = mapProcessor.worldPointToMapPoint(entityplayer.getPositionEyes(partialTicks)); + yaw2 = entityplayer.prevRotationYawHead + (entityplayer.rotationYawHead - entityplayer.prevRotationYawHead) * partialTicks; + } else { + String iconName = mapProcessor.getMapIconToPlayerMap().get(actual); + if (iconName == null) continue; + Vec4b vec = mapData.mapDecorations.get(iconName); + if (vec == null) { + continue; + } else { + pt2 = new Point(vec.func_176112_b() / 2 + 64, vec.func_176113_c() / 2 + 64); + yaw2 = vec.func_176111_d() * 360 / 16.0f ; + } + } + GlStateManager.pushMatrix(); + if (entityplayer == Minecraft.getMinecraft().thePlayer || this.getParameter("showotherplayers").getValue()) + { + boolean flag1 = entityplayer != null && entityplayer.isWearing(EnumPlayerModelParts.CAPE); + GlStateManager.enableTexture2D(); + Minecraft.getMinecraft().getTextureManager().bindTexture(networkPlayerInfo.getLocationSkin()); + int l2 = 8 + (flag1 ? 8 : 0); + int i3 = 8 * (flag1 ? -1 : 1); + + GlStateManager.translate(pt2.x, pt2.y, 0); + GlStateManager.rotate((float) (yaw2 - 180), 0, 0, 1); + + GlStateManager.scale(1 / scale, 1 / scale, 0); + GlStateManager.scale(1 / postScale, 1 / postScale, 0); + float s = this.getParameter("playerheadscale").getValue(); + GlStateManager.scale(s,s,0); + Gui.drawScaledCustomSizeModalRect(-4, -4, 8.0F, (float) l2, 8, i3, 8, 8, 64.0F, 64.0F); + GL11.glLineWidth(1); + RenderUtils.drawUnfilledBox(-4,-4,4, 4, this.getParameter("player_color").getValue().getRGB(), this.getParameter("player_chroma").getValue()); + } + GlStateManager.popMatrix(); + } + FontRenderer fr = getFontRenderer(); + if (this.getParameter("showtotalsecrets").getValue()) { + for (DungeonRoom dungeonRoom : context.getDungeonRoomList()) { + GlStateManager.pushMatrix(); + GlStateManager.pushAttrib(); + Point mapPt = mapProcessor.roomPointToMapPoint(dungeonRoom.getUnitPoints().get(0)); + GlStateManager.translate(mapPt.x + mapProcessor.getUnitRoomDimension().width / 2, mapPt.y + mapProcessor.getUnitRoomDimension().height / 2, 0); + + if (this.getParameter("playerCenter").getValue() && this.getParameter("rotate").getValue()) { + GlStateManager.rotate((float) (yaw - 180), 0, 0, 1); + } + GlStateManager.scale(1 / scale, 1 / scale, 0); + GlStateManager.scale(1 / postScale, 1 / postScale, 0); + float s = this.getParameter("textScale").getValue(); + GlStateManager.scale(s,s,0); + String str = ""; + str += dungeonRoom.getTotalSecrets() == -1 ? "?" : String.valueOf(dungeonRoom.getTotalSecrets()); + str += " "; + if (dungeonRoom.getCurrentState() == DungeonRoom.RoomState.FINISHED) { + str += "✔"; + } else if (dungeonRoom.getCurrentState() == DungeonRoom.RoomState.COMPLETE_WITHOUT_SECRETS) { + str += "☑"; + } else if (dungeonRoom.getCurrentState() == DungeonRoom.RoomState.DISCOVERED) { + str += "☐"; + } else if (dungeonRoom.getCurrentState() == DungeonRoom.RoomState.FAILED) { + str += "❌"; + } + + fr.drawString(str, -(fr.getStringWidth(str) / 2), -(fr.FONT_HEIGHT / 2), dungeonRoom.getColor() == 74 ? 0xff000000 : 0xFFFFFFFF); + GlStateManager.popAttrib(); + GlStateManager.popMatrix(); + } + } + + } + + + + private DynamicTexture mapTexture = new DynamicTexture(128, 128); + private ResourceLocation location = Minecraft.getMinecraft().getTextureManager().getDynamicTextureLocation("dungeonmap/map", mapTexture); + private int[] mapTextureData = mapTexture.getTextureData(); + + private void updateMapTexture(byte[] colors, MapProcessor mapProcessor, List dungeonRooms) { + for (int i = 0; i < 16384; ++i) { + int j = colors[i] & 255; + + if (j / 4 == 0) { + this.mapTextureData[i] = 0x00000000; + } else { + this.mapTextureData[i] = MapColor.mapColorArray[j / 4].func_151643_b(j & 3); + } + } + + if (this.getParameter("showtotalsecrets").getValue()) { + for (DungeonRoom dungeonRoom : dungeonRooms) { + for (Point pt : dungeonRoom.getUnitPoints()) { + for (int y1 = 0; y1 < mapProcessor.getUnitRoomDimension().height; y1++) { + for (int x1 = 0; x1 < mapProcessor.getUnitRoomDimension().width; x1++) { + int x = MathHelper.clamp_int(pt.x * (mapProcessor.getUnitRoomDimension().width + mapProcessor.getDoorDimension().height) + x1 + mapProcessor.getTopLeftMapPoint().x, 0, 128); + int y = MathHelper.clamp_int(pt.y * (mapProcessor.getUnitRoomDimension().height + mapProcessor.getDoorDimension().height) + y1 + mapProcessor.getTopLeftMapPoint().y, 0, 128); + int i = y * 128 + x; + int j = dungeonRoom.getColor(); + + if (j / 4 == 0) { + this.mapTextureData[i] = 0x00000000; + } else { + this.mapTextureData[i] = MapColor.mapColorArray[j / 4].func_151643_b(j & 3); + } + } + } + } + } + } + + + this.mapTexture.updateDynamicTexture(); + } + + private void render(MapData mapData, boolean noOverlayRendering) { + int i = 0; + int j = 0; + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + float f = 0.0F; + Minecraft.getMinecraft().getTextureManager().bindTexture(this.location); + GlStateManager.enableBlend(); + GlStateManager.tryBlendFuncSeparate(1, 771, 0, 1); + GlStateManager.disableAlpha(); + worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX); + worldrenderer.pos((float)(i) + f, (double)((float)(j + 128) - f), -0.009999999776482582D).tex(0.0D, 1.0D).endVertex(); + worldrenderer.pos((float)(i + 128) - f, (double)((float)(j + 128) - f), -0.009999999776482582D).tex(1.0D, 1.0D).endVertex(); + worldrenderer.pos((float)(i + 128) - f, (double)((float)(j) + f), -0.009999999776482582D).tex(1.0D, 0.0D).endVertex(); + worldrenderer.pos((float)(i) + f, (double)((float)(j) + f), -0.009999999776482582D).tex(0.0D, 0.0D).endVertex(); + tessellator.draw(); + GlStateManager.enableAlpha(); + GlStateManager.disableBlend(); + + GlStateManager.pushMatrix(); + GlStateManager.translate(0.0F, 0.0F, -0.04F); + GlStateManager.scale(1.0F, 1.0F, 1.0F); + GlStateManager.popMatrix(); + } + +} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonMilestone.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonMilestone.java new file mode 100644 index 00000000..bb65cb2c --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonMilestone.java @@ -0,0 +1,74 @@ +package kr.syeyoung.dungeonsguide.features.impl.dungeon; + +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.FeatureRegistry; +import kr.syeyoung.dungeonsguide.features.GuiFeature; +import kr.syeyoung.dungeonsguide.features.listener.ChatListener; +import kr.syeyoung.dungeonsguide.features.listener.TickListener; +import kr.syeyoung.dungeonsguide.utils.TextUtils; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.network.NetworkPlayerInfo; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.scoreboard.ScorePlayerTeam; +import net.minecraft.util.ChatComponentText; +import net.minecraftforge.client.event.ClientChatReceivedEvent; +import org.lwjgl.opengl.GL11; + +import java.awt.*; +import java.util.regex.Pattern; + +public class FeatureDungeonMilestone extends GuiFeature implements ChatListener { + public FeatureDungeonMilestone() { + super("Dungeon", "Display Current Class Milestone", "Display current class milestone of yourself", "dungeon.stats.milestone", true, getFontRenderer().getStringWidth("Milestone: 12"), getFontRenderer().FONT_HEIGHT); + this.setEnabled(false); + parameters.put("color", new FeatureParameter("color", "Color", "Color of text", Color.orange, "color")); + } + + SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); + @Override + public void drawHUD(float partialTicks) { + if (!skyblockStatus.isOnDungeon()) return; + FontRenderer fr = getFontRenderer(); + double scale = getFeatureRect().getHeight() / fr.FONT_HEIGHT; + GlStateManager.scale(scale, scale, 0); + for (NetworkPlayerInfo networkPlayerInfoIn : Minecraft.getMinecraft().thePlayer.sendQueue.getPlayerInfoMap()) { + String name = networkPlayerInfoIn.getDisplayName() != null ? networkPlayerInfoIn.getDisplayName().getFormattedText() : ScorePlayerTeam.formatPlayerName(networkPlayerInfoIn.getPlayerTeam(), networkPlayerInfoIn.getGameProfile().getName()); + if (name.startsWith("§r Milestone: §r")) { + String milestone = TextUtils.stripColor(name).substring(13); + fr.drawString("Milestone: "+milestone, 0,0, this.getParameter("color").getValue().getRGB()); + return; + } + } + fr.drawString("Milestone: ?", 0,0, this.getParameter("color").getValue().getRGB()); + } + + @Override + public void drawDemo(float partialTicks) { + FontRenderer fr = getFontRenderer(); + double scale = getFeatureRect().getHeight() / fr.FONT_HEIGHT; + GlStateManager.scale(scale, scale, 0); + fr.drawString("Milestone: 9", 0,0, this.getParameter("color").getValue().getRGB()); + } + public static final Pattern milestone_pattern = Pattern.compile("§r§e§l(.+) Milestone §r§e(.)§r§7: .+ §r§a(.+)§r"); + + + @Override + public void onChat(ClientChatReceivedEvent clientChatReceivedEvent) { + if (clientChatReceivedEvent.type == 2) return;; + if (!skyblockStatus.isOnDungeon()) return; + DungeonContext context = skyblockStatus.getContext(); + if (context == null) return; + String txt = clientChatReceivedEvent.message.getFormattedText(); + if (milestone_pattern.matcher(txt).matches()) { + context.getMilestoneReached().add(new String[] { + TextUtils.formatTime(FeatureRegistry.DUNGEON_REALTIME.getTimeElapsed()), + TextUtils.formatTime(FeatureRegistry.DUNGEON_SBTIME.getTimeElapsed()) + }); + e.sendDebugChat(new ChatComponentText("Reached Milestone At " + TextUtils.formatTime(FeatureRegistry.DUNGEON_REALTIME.getTimeElapsed()) + " / "+TextUtils.formatTime(FeatureRegistry.DUNGEON_SBTIME.getTimeElapsed()))); + } + } +} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonRealTime.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonRealTime.java new file mode 100644 index 00000000..59b46542 --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonRealTime.java @@ -0,0 +1,58 @@ +package kr.syeyoung.dungeonsguide.features.impl.dungeon; + +import kr.syeyoung.dungeonsguide.SkyblockStatus; +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.features.listener.DungeonEndListener; +import kr.syeyoung.dungeonsguide.features.listener.DungeonStartListener; +import kr.syeyoung.dungeonsguide.features.listener.TickListener; +import kr.syeyoung.dungeonsguide.utils.TextUtils; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraftforge.client.event.ClientChatReceivedEvent; +import org.lwjgl.opengl.GL11; + +import java.awt.*; +import java.text.SimpleDateFormat; + +public class FeatureDungeonRealTime extends GuiFeature implements DungeonStartListener, DungeonEndListener { + public FeatureDungeonRealTime() { + super("Dungeon", "Display Real Time-Dungeon Time", "Display how much real time has passed since dungeon run started", "dungeon.stats.realtime", true, getFontRenderer().getStringWidth("Time(Real): 59m 59s"), getFontRenderer().FONT_HEIGHT); + this.setEnabled(false); + parameters.put("color", new FeatureParameter("color", "Color", "Color of text", Color.orange, "color")); + } + + private long started = -1; + @Override + public void drawHUD(float partialTicks) { + if (started == -1) return; + FontRenderer fr = getFontRenderer(); + double scale = getFeatureRect().getHeight() / fr.FONT_HEIGHT; + GlStateManager.scale(scale, scale, 0); + fr.drawString("Time(Real): "+TextUtils.formatTime(getTimeElapsed()), 0,0, this.getParameter("color").getValue().getRGB()); + } + + public long getTimeElapsed() { + return System.currentTimeMillis() - started; + } + + @Override + public void drawDemo(float partialTicks) { + FontRenderer fr = getFontRenderer(); + double scale = getFeatureRect().getHeight() / fr.FONT_HEIGHT; + GlStateManager.scale(scale, scale, 0); + fr.drawString("Time(Real): -42h", 0,0, this.getParameter("color").getValue().getRGB()); + } + + @Override + public void onDungeonEnd() { + started = -1; + } + + @Override + public void onDungeonStart() { + started= System.currentTimeMillis(); + } +} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonSBTime.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonSBTime.java new file mode 100644 index 00000000..df711f67 --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonSBTime.java @@ -0,0 +1,82 @@ +package kr.syeyoung.dungeonsguide.features.impl.dungeon; + +import kr.syeyoung.dungeonsguide.SkyblockStatus; +import kr.syeyoung.dungeonsguide.e; +import kr.syeyoung.dungeonsguide.events.DungeonEndedEvent; +import kr.syeyoung.dungeonsguide.features.FeatureParameter; +import kr.syeyoung.dungeonsguide.features.GuiFeature; +import kr.syeyoung.dungeonsguide.features.listener.*; +import kr.syeyoung.dungeonsguide.utils.TextUtils; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.scoreboard.Score; +import net.minecraft.scoreboard.ScoreObjective; +import net.minecraft.scoreboard.ScorePlayerTeam; +import net.minecraft.scoreboard.Scoreboard; +import net.minecraftforge.client.event.ClientChatReceivedEvent; +import org.lwjgl.opengl.GL11; + +import java.awt.*; +import java.util.Collection; + +public class FeatureDungeonSBTime extends GuiFeature { + + private SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); + + public FeatureDungeonSBTime() { + super("Dungeon", "Display Ingame Dungeon Time", "Display how much time skyblock thinks has passed since dungeon run started", "dungeon.stats.igtime", true, getFontRenderer().getStringWidth("Time(IG): 1h 59m 59s"), getFontRenderer().FONT_HEIGHT); + this.setEnabled(false); + parameters.put("color", new FeatureParameter("color", "Color", "Color of text", Color.orange, "color")); + } + @Override + public void drawHUD(float partialTicks) { + if (!skyblockStatus.isOnDungeon()) return; + FontRenderer fr = getFontRenderer(); + double scale = getFeatureRect().getHeight() / fr.FONT_HEIGHT; + GlStateManager.scale(scale, scale, 0); + Scoreboard scoreboard = Minecraft.getMinecraft().theWorld.getScoreboard(); + ScoreObjective objective = scoreboard.getObjectiveInDisplaySlot(1); + Collection scores = scoreboard.getSortedScores(objective); + String time = "unknown"; + for (Score sc:scores) { + ScorePlayerTeam scorePlayerTeam = scoreboard.getPlayersTeam(sc.getPlayerName()); + String strippedLine = TextUtils.keepScoreboardCharacters(TextUtils.stripColor(ScorePlayerTeam.formatPlayerName(scorePlayerTeam, sc.getPlayerName()))).trim(); + if (strippedLine.startsWith("Time Elapsed: ")) { + time = strippedLine.substring(14); + } + } + fr.drawString("Time(Ig): "+time, 0,0, this.getParameter("color").getValue().getRGB()); + } + public int getTimeElapsed() { + Scoreboard scoreboard = Minecraft.getMinecraft().theWorld.getScoreboard(); + ScoreObjective objective = scoreboard.getObjectiveInDisplaySlot(1); + Collection scores = scoreboard.getSortedScores(objective); + String time = "idkyet"; + for (Score sc:scores) { + ScorePlayerTeam scorePlayerTeam = scoreboard.getPlayersTeam(sc.getPlayerName()); + String strippedLine = TextUtils.keepScoreboardCharacters(TextUtils.stripColor(ScorePlayerTeam.formatPlayerName(scorePlayerTeam, sc.getPlayerName()))).trim(); + if (strippedLine.startsWith("Time Elapsed: ")) { + time = strippedLine.substring(14); + } + } + time = time.replace(" ", ""); + int hour = time.indexOf('h') == -1 ? 0 : Integer.parseInt(time.substring(0, time.indexOf('h'))); + if (time.contains("h")) time = time.substring(time.indexOf('h') + 1); + int minute = time.indexOf('m') == -1 ? 0 : Integer.parseInt(time.substring(0, time.indexOf('m'))); + if (time.contains("m")) time = time.substring(time.indexOf('m') + 1); + int second = time.indexOf('s') == -1 ? 0 : Integer.parseInt(time.substring(0, time.indexOf('s'))); + + int time2 = hour * 60 * 60 + minute * 60 + second; + return time2 * 1000; + } + + @Override + public void drawDemo(float partialTicks) { + FontRenderer fr = getFontRenderer(); + double scale = getFeatureRect().getHeight() / fr.FONT_HEIGHT; + GlStateManager.scale(scale, scale, 0); + + fr.drawString("Time(Ig): -42h", 0,0, this.getParameter("color").getValue().getRGB()); + } +} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonScore.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonScore.java new file mode 100644 index 00000000..60610b9d --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonScore.java @@ -0,0 +1,211 @@ +package kr.syeyoung.dungeonsguide.features.impl.dungeon; + +import kr.syeyoung.dungeonsguide.SkyblockStatus; +import kr.syeyoung.dungeonsguide.dungeon.DungeonContext; +import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.e; +import kr.syeyoung.dungeonsguide.features.FeatureParameter; +import kr.syeyoung.dungeonsguide.features.FeatureRegistry; +import kr.syeyoung.dungeonsguide.features.GuiFeature; +import kr.syeyoung.dungeonsguide.utils.TextUtils; +import lombok.AllArgsConstructor; +import lombok.Data; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.network.NetworkPlayerInfo; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.scoreboard.ScorePlayerTeam; +import net.minecraft.util.MathHelper; +import org.lwjgl.opengl.GL11; + +import java.awt.*; + +public class FeatureDungeonScore extends GuiFeature { + public FeatureDungeonScore() { + super("Dungeon", "Display Current Score", "Calculate and Display current score\nThis data is from pure calculation and can be different from actual score.", "dungeon.stats.score", false, 200, getFontRenderer().FONT_HEIGHT * 4); + this.setEnabled(false); + parameters.put("color", new FeatureParameter("color", "Color", "Color of text", Color.orange, "color")); + parameters.put("verbose", new FeatureParameter("verbose", "Show each score instead of sum", "Skill: 100 Explore: 58 S->S+(5 tombs) instead of Score: 305", true, "boolean")); + } + + SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); + @Override + public void drawHUD(float partialTicks) { + if (!skyblockStatus.isOnDungeon()) return; + FontRenderer fr = getFontRenderer(); + ScoreCalculation score = calculateScore(); + if (score == null) return; + int sum = score.time + score.skill + score.explorer + score.bonus; + if (this.getParameter("verbose").getValue()) { + String req = buildRequirement(score); + int rgb = this.getParameter("color").getValue().getRGB(); + fr.drawString("Skill: "+score.skill+" ("+score.deaths+" Deaths)", 0, 0, rgb); + fr.drawString("Explorer: "+score.explorer+" (Rooms "+(score.fullyCleared ? "O" : "X") + " secrets "+score.secrets+"/"+score.totalSecrets+(score.totalSecretsKnown ? "": "?")+")", 0, 8, rgb); + fr.drawString("Time: "+score.time+" Bonus: "+score.bonus+" ::: Total: "+sum, 0, 16, rgb); + fr.drawString(req, 0, 24, rgb); + } else { + double scale = getFeatureRect().getHeight() / fr.FONT_HEIGHT; + GlStateManager.scale(scale, scale, 0); + String letter = getLetter(sum); + fr.drawString("Score: "+sum + "("+letter+")", 0,0, this.getParameter("color").getValue().getRGB()); + } + } + + @Override + public void drawDemo(float partialTicks) { + FontRenderer fr = getFontRenderer(); + if (this.getParameter("verbose").getValue()) { + int rgb = this.getParameter("color").getValue().getRGB(); + fr.drawString("Skill: 100 (0 Deaths)", 0, 0, rgb); + fr.drawString("Explorer: 99 (Rooms O 39/40)", 0, 8, rgb); + fr.drawString("Time: 100 Bonus: 0 Total: 299", 0, 16, rgb); + fr.drawString("S->S+ (1 Required 1 tomb)", 0, 24, rgb); + } else { + double scale = getFeatureRect().getHeight() / fr.FONT_HEIGHT; + GlStateManager.scale(scale, scale, 0); + fr.drawString("Score: 305 (S+)", 0,0, this.getParameter("color").getValue().getRGB()); + } + } + + @Data + @AllArgsConstructor + public static class ScoreCalculation { + private int skill, explorer, time, bonus, tombs; + private boolean fullyCleared; + private int secrets, totalSecrets; + private boolean totalSecretsKnown; + private int deaths; + } + + public int getPercentage() { + return skyblockStatus.getPercentage(); + } + public int getCompleteRooms() { + for (NetworkPlayerInfo networkPlayerInfoIn : Minecraft.getMinecraft().thePlayer.sendQueue.getPlayerInfoMap()) { + String name = networkPlayerInfoIn.getDisplayName() != null ? networkPlayerInfoIn.getDisplayName().getFormattedText() : ScorePlayerTeam.formatPlayerName(networkPlayerInfoIn.getPlayerTeam(), networkPlayerInfoIn.getGameProfile().getName()); + if (name.startsWith("§r Completed Rooms: §r")) { + String milestone = TextUtils.stripColor(name).substring(18); + return Integer.parseInt(milestone); + } + } + return 0; + } + public int getTotalRooms() { + return (int) (100 * (getCompleteRooms() / (double)getPercentage())); + } + public int getUndiscoveredPuzzles() { + int cnt = 0; + for (NetworkPlayerInfo networkPlayerInfoIn : Minecraft.getMinecraft().thePlayer.sendQueue.getPlayerInfoMap()) { + String name = networkPlayerInfoIn.getDisplayName() != null ? networkPlayerInfoIn.getDisplayName().getFormattedText() : ScorePlayerTeam.formatPlayerName(networkPlayerInfoIn.getPlayerTeam(), networkPlayerInfoIn.getGameProfile().getName()); + if (name.startsWith("§r ???: ")) { + cnt ++; + } + } + return cnt; + } + + public ScoreCalculation calculateScore() { + if (!skyblockStatus.isOnDungeon()) return null; + DungeonContext context = skyblockStatus.getContext(); + if (context == null) return null; + if (!context.getMapProcessor().isInitialized()) return null; + + int skill = 100; + int deaths = 0; + { + deaths = FeatureRegistry.DUNGEON_DEATHS.getTotalDeaths(); + skill -= FeatureRegistry.DUNGEON_DEATHS.getTotalDeaths() * 2; + int totalCompRooms= 0; + boolean bossroomFound = false; + for (DungeonRoom dungeonRoom : context.getDungeonRoomList()) { + if (dungeonRoom.getColor() == 74) bossroomFound = true; + if (dungeonRoom.getCurrentState() != DungeonRoom.RoomState.DISCOVERED) + totalCompRooms += dungeonRoom.getUnitPoints().size(); + if (dungeonRoom.getColor() == 66 && dungeonRoom.getCurrentState() == DungeonRoom.RoomState.DISCOVERED) + skill -= 10; + if (dungeonRoom.getColor() == 74 && dungeonRoom.getCurrentState() == DungeonRoom.RoomState.DISCOVERED) + skill += 1; + skill += dungeonRoom.getCurrentState().getScoreModifier(); + } + if (!bossroomFound) skill += 1; + skill -= getUndiscoveredPuzzles() * 10; + skill -= (getTotalRooms() - totalCompRooms) * 4; + skill = MathHelper.clamp_int(skill, 0, 100); + } + int explorer = 0; + boolean fullyCleared = false; + boolean totalSecretsKnown = true; + int totalSecrets = 0; + int secrets = 0; + { + for (DungeonRoom dungeonRoom : context.getDungeonRoomList()) { + if (dungeonRoom.getTotalSecrets() != -1) + totalSecrets += dungeonRoom.getTotalSecrets(); + else totalSecretsKnown = false; + } + fullyCleared = getPercentage() == context.getDungeonRoomList().size() && context.getMapProcessor().getUndiscoveredRoom() == 0; + explorer += MathHelper.clamp_int((int) Math.floor(6.0 / 10.0 * getPercentage()), 0, 60); + explorer += MathHelper.clamp_int((int) Math.floor(40 * ((secrets = FeatureRegistry.DUNGEON_SECRETS.getSecretsFound()) / (double)totalSecrets)),0,40); + } + int time = 0; + { + double timeModifier; + if (context.getBossRoomEnterSeconds() != -1) { + timeModifier = Math.max(0, context.getBossRoomEnterSeconds() - 1200); + } else { + timeModifier = Math.max(0, FeatureRegistry.DUNGEON_SBTIME.getTimeElapsed() / 1000 - 1200); + } + time = (int) Math.floor(100 - 2.2 * timeModifier); + } + int bonus = 0; + int tombs; + { + bonus += tombs = MathHelper.clamp_int(FeatureRegistry.DUNGEON_TOMBS.getTombsFound(), 0, 5); + } + + // amazing thing + return new ScoreCalculation(skill, explorer, time, bonus, tombs, fullyCleared, secrets, totalSecrets, totalSecretsKnown, deaths); + } + public String getLetter(int score) { + if (score <= 99) return "D"; + if (score <= 159) return "C"; + if (score <= 229) return "B"; + if (score <= 269) return "A"; + if (score <= 299) return "S"; + return "S+"; + } + public int getScoreRequirement(String letter) { + if (letter.equals("D")) return 0; + if (letter.equals("C")) return 100; + if (letter.equals("B")) return 160; + if (letter.equals("A")) return 230; + if (letter.equals("S")) return 270; + if (letter.equals("S+")) return 300; + return -1; + } + public String getNextLetter(String letter) { + if (letter.equals("D")) return "C"; + if (letter.equals("C")) return "B"; + if (letter.equals("B")) return "A"; + if (letter.equals("A")) return "S"; + if (letter.equals("S")) return "S+"; + else return null; + } + public String buildRequirement(ScoreCalculation calculation) { + int current = calculation.time + calculation.bonus + calculation.explorer + calculation.skill; + String currentLetter = getLetter(current); + String nextLetter= getNextLetter(currentLetter); + if (nextLetter == null) return "S+ Expected"; + int req = getScoreRequirement(nextLetter); + int reqPT2 = req- current; + int reqPT = req - current; + + int tombsBreakable = Math.min(5 - calculation.tombs, reqPT); + reqPT -= tombsBreakable; + + double secretPer = 40.0 / calculation.totalSecrets; + int secrets = (int) Math.ceil(reqPT / secretPer); + + return currentLetter+"->"+nextLetter+" ("+reqPT2+" Req "+tombsBreakable+" crypts "+secrets+" secrets"+(calculation.totalSecretsKnown ? "" : "?")+")"; + } +} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonSecrets.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonSecrets.java new file mode 100644 index 00000000..614d7fee --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonSecrets.java @@ -0,0 +1,72 @@ +package kr.syeyoung.dungeonsguide.features.impl.dungeon; + +import kr.syeyoung.dungeonsguide.SkyblockStatus; +import kr.syeyoung.dungeonsguide.dungeon.DungeonContext; +import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.e; +import kr.syeyoung.dungeonsguide.features.FeatureParameter; +import kr.syeyoung.dungeonsguide.features.FeatureRegistry; +import kr.syeyoung.dungeonsguide.features.GuiFeature; +import kr.syeyoung.dungeonsguide.features.listener.ChatListener; +import kr.syeyoung.dungeonsguide.features.listener.TickListener; +import kr.syeyoung.dungeonsguide.utils.TextUtils; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.network.NetworkPlayerInfo; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.scoreboard.ScorePlayerTeam; +import net.minecraft.util.ChatComponentText; +import net.minecraftforge.client.event.ClientChatReceivedEvent; +import org.lwjgl.opengl.GL11; + +import java.awt.*; +import java.util.regex.Pattern; + +public class FeatureDungeonSecrets extends GuiFeature { + public FeatureDungeonSecrets() { + super("Dungeon", "Display #Secrets", "Display how much total secrets have been found in a dungeon run.\n+ sign means DG does not know the correct number, but it's somewhere above that number.", "dungeon.stats.secrets", true, getFontRenderer().getStringWidth("Secrets: 999/999+"), getFontRenderer().FONT_HEIGHT); + this.setEnabled(false); + parameters.put("color", new FeatureParameter("color", "Color", "Color of text", Color.orange, "color")); + } + + SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); + @Override + public void drawHUD(float partialTicks) { + if (!skyblockStatus.isOnDungeon()) return; + FontRenderer fr = getFontRenderer(); + double scale = getFeatureRect().getHeight() / fr.FONT_HEIGHT; + GlStateManager.scale(scale, scale, 0); + fr.drawString("Secrets: "+getSecretsFound() +"/"+getTotalSecrets(), 0,0, this.getParameter("color").getValue().getRGB()); + } + + @Override + public void drawDemo(float partialTicks) { + FontRenderer fr = getFontRenderer(); + double scale = getFeatureRect().getHeight() / fr.FONT_HEIGHT; + GlStateManager.scale(scale, scale, 0); + fr.drawString("Secrets: 999/2+", 0,0, this.getParameter("color").getValue().getRGB()); + } + + public int getSecretsFound() { + for (NetworkPlayerInfo networkPlayerInfoIn : Minecraft.getMinecraft().thePlayer.sendQueue.getPlayerInfoMap()) { + String name = networkPlayerInfoIn.getDisplayName() != null ? networkPlayerInfoIn.getDisplayName().getFormattedText() : ScorePlayerTeam.formatPlayerName(networkPlayerInfoIn.getPlayerTeam(), networkPlayerInfoIn.getGameProfile().getName()); + if (name.startsWith("§r Secrets Found: §r§b")) { + String noColor = TextUtils.stripColor(name); + return Integer.parseInt(noColor.substring(16)); + } + } + return 0; + } + + public String getTotalSecrets() { + DungeonContext context = skyblockStatus.getContext(); + int totalSecrets = 0; + boolean allknown = true; + for (DungeonRoom dungeonRoom : context.getDungeonRoomList()) { + if (dungeonRoom.getTotalSecrets() != -1) + totalSecrets += dungeonRoom.getTotalSecrets(); + else allknown = false; + } + return totalSecrets + (allknown ? "":"+"); + } +} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonTombs.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonTombs.java new file mode 100644 index 00000000..d8ee4503 --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonTombs.java @@ -0,0 +1,51 @@ +package kr.syeyoung.dungeonsguide.features.impl.dungeon; + +import kr.syeyoung.dungeonsguide.SkyblockStatus; +import kr.syeyoung.dungeonsguide.e; +import kr.syeyoung.dungeonsguide.features.FeatureParameter; +import kr.syeyoung.dungeonsguide.features.GuiFeature; +import kr.syeyoung.dungeonsguide.utils.TextUtils; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.network.NetworkPlayerInfo; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.scoreboard.ScorePlayerTeam; +import org.lwjgl.opengl.GL11; + +import java.awt.*; + +public class FeatureDungeonTombs extends GuiFeature { + public FeatureDungeonTombs() { + super("Dungeon", "Display #Crypts", "Display how much total crypts have been blown up in a dungeon run", "dungeon.stats.tombs", true, getFontRenderer().getStringWidth("Crypts: 42"), getFontRenderer().FONT_HEIGHT); + this.setEnabled(false); + parameters.put("color", new FeatureParameter("color", "Color", "Color of text", Color.orange, "color")); + } + + SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); + @Override + public void drawHUD(float partialTicks) { + if (!skyblockStatus.isOnDungeon()) return; + FontRenderer fr = getFontRenderer(); + double scale = getFeatureRect().getHeight() / fr.FONT_HEIGHT; + GlStateManager.scale(scale, scale, 0); + fr.drawString("Crypts: "+getTombsFound(), 0,0, this.getParameter("color").getValue().getRGB()); + } + + @Override + public void drawDemo(float partialTicks) { + FontRenderer fr = getFontRenderer(); + double scale = getFeatureRect().getHeight() / fr.FONT_HEIGHT; + GlStateManager.scale(scale, scale, 0); + fr.drawString("Crypts: 42", 0,0, this.getParameter("color").getValue().getRGB()); + } + + public int getTombsFound() { + for (NetworkPlayerInfo networkPlayerInfoIn : Minecraft.getMinecraft().thePlayer.sendQueue.getPlayerInfoMap()) { + String name = networkPlayerInfoIn.getDisplayName() != null ? networkPlayerInfoIn.getDisplayName().getFormattedText() : ScorePlayerTeam.formatPlayerName(networkPlayerInfoIn.getPlayerTeam(), networkPlayerInfoIn.getGameProfile().getName()); + if (name.startsWith("§r Crypts: §r§6")) { + return Integer.parseInt(TextUtils.stripColor(name).substring(9)); + } + } + return 0; + } +} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureInstaCloseChest.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureInstaCloseChest.java new file mode 100644 index 00000000..c9e58de1 --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureInstaCloseChest.java @@ -0,0 +1,124 @@ +package kr.syeyoung.dungeonsguide.features.impl.dungeon; + +import kr.syeyoung.dungeonsguide.SkyblockStatus; +import kr.syeyoung.dungeonsguide.e; +import kr.syeyoung.dungeonsguide.features.FeatureParameter; +import kr.syeyoung.dungeonsguide.features.GuiFeature; +import kr.syeyoung.dungeonsguide.features.SimpleFeature; +import kr.syeyoung.dungeonsguide.features.listener.GuiOpenListener; +import kr.syeyoung.dungeonsguide.features.listener.TickListener; +import kr.syeyoung.dungeonsguide.utils.AhUtils; +import kr.syeyoung.dungeonsguide.utils.TextUtils; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.gui.inventory.GuiChest; +import net.minecraft.inventory.ContainerChest; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.client.event.GuiOpenEvent; +import org.lwjgl.opengl.GL11; + +import java.awt.*; +import java.util.Comparator; +import java.util.HashMap; +import java.util.Set; +import java.util.TreeSet; + +public class FeatureInstaCloseChest extends SimpleFeature implements GuiOpenListener, TickListener { + public FeatureInstaCloseChest() { + super("Dungeon", "Auto-Close Secret Chest", "Automatically closes Secret Chest as soon as you open it\nCan put item price threshold by clicking edit", "qol.autoclose", false); + parameters.put("threshold", new FeatureParameter("threshold", "Price Threshold", "The maximum price of item for chest to be closed. Default 1m", 1000000, "integer")); + } + + SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); + private boolean check; + @Override + public void onGuiOpen(GuiOpenEvent event) { + if (!this.isEnabled()) return; + if (!skyblockStatus.isOnDungeon()) return; + if (!(event.gui instanceof GuiChest)) return; + + ContainerChest ch = (ContainerChest) ((GuiChest)event.gui).inventorySlots; + System.out.println(ch.getLowerChestInventory().getName()); + if (!("Large Chest".equals(ch.getLowerChestInventory().getName()) + || "Chest".equals(ch.getLowerChestInventory().getName()))) return; + check = true; + } + + public static int getPrice(ItemStack itemStack) { + if (itemStack == null) return 0; + NBTTagCompound compound = itemStack.getTagCompound(); + if (compound == null) + return 0; + if (!compound.hasKey("ExtraAttributes")) + return 0; + final String id = compound.getCompoundTag("ExtraAttributes").getString("id"); + if (id.equals("ENCHANTED_BOOK")) { + final NBTTagCompound enchants = compound.getCompoundTag("ExtraAttributes").getCompoundTag("enchantments"); + Set keys = enchants.getKeySet(); + Set actualKeys = new TreeSet(new Comparator() { + public int compare(String o1, String o2) { + String id2 = id + "::" + o1 + "-" + enchants.getInteger(o1); + AhUtils.AuctionData auctionData = AhUtils.auctions.get(id2); + int price1 = (auctionData == null) ? 0 : auctionData.lowestBin; + String id3 = id + "::" + o2 + "-" + enchants.getInteger(o2); + AhUtils.AuctionData auctionData2 = AhUtils.auctions.get(id3); + int price2 = (auctionData2 == null) ? 0 : auctionData2.lowestBin; + return (compare2(price1, price2) == 0) ? o1.compareTo(o2) : compare2(price1, price2); + } + + public int compare2(int y, int x) { + return (x < y) ? -1 : ((x == y) ? 0 : 1); + } + }); + actualKeys.addAll(keys); + int totalLowestPrice = 0; + for (String key : actualKeys) { + String id2 = id + "::" + key + "-" + enchants.getInteger(key); + AhUtils.AuctionData auctionData = AhUtils.auctions.get(id2); + totalLowestPrice += auctionData.lowestBin; + } + return totalLowestPrice; + } else { + AhUtils.AuctionData auctionData = AhUtils.auctions.get(id); + if (auctionData == null) { + return 0; + } else { + if (auctionData.sellPrice == -1 && auctionData.lowestBin != -1) return auctionData.lowestBin; + else if (auctionData.sellPrice != -1 && auctionData.lowestBin == -1) return auctionData.sellPrice; + else { + int ahPrice = auctionData.lowestBin; + if (ahPrice > auctionData.sellPrice) return ahPrice; + else return auctionData.sellPrice; + } + } + } + } + + @Override + public void onTick() { + if (!this.isEnabled()) return; + if (check) { + check = false; + + GuiScreen screen = Minecraft.getMinecraft().currentScreen; + if (screen instanceof GuiChest){ + + ContainerChest chest = (ContainerChest) ((GuiChest) screen).inventorySlots; + IInventory actualChest = chest.getLowerChestInventory(); + + int priceSum = 0; + for (int i = 0; i < actualChest.getSizeInventory(); i++) { + priceSum += getPrice(actualChest.getStackInSlot(i)); + } + + int threshold = this.getParameter("threshold").getValue(); + if (priceSum < threshold) { + Minecraft.getMinecraft().thePlayer.closeScreen(); + } + } + } + } +} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureWarnLowHealth.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureWarnLowHealth.java new file mode 100644 index 00000000..09870ba3 --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureWarnLowHealth.java @@ -0,0 +1,74 @@ +package kr.syeyoung.dungeonsguide.features.impl.dungeon; + +import com.google.common.base.Predicate; +import kr.syeyoung.dungeonsguide.SkyblockStatus; +import kr.syeyoung.dungeonsguide.e; +import kr.syeyoung.dungeonsguide.features.FeatureParameter; +import kr.syeyoung.dungeonsguide.features.GuiFeature; +import kr.syeyoung.dungeonsguide.features.SimpleFeature; +import kr.syeyoung.dungeonsguide.features.listener.WorldRenderListener; +import kr.syeyoung.dungeonsguide.utils.RenderUtils; +import kr.syeyoung.dungeonsguide.utils.TextUtils; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.entity.item.EntityArmorStand; +import net.minecraft.scoreboard.Score; +import net.minecraft.scoreboard.ScoreObjective; +import net.minecraft.scoreboard.ScorePlayerTeam; +import net.minecraft.scoreboard.Scoreboard; +import net.minecraft.util.BlockPos; +import org.jetbrains.annotations.Nullable; +import org.lwjgl.opengl.GL11; + +import java.awt.*; +import java.util.List; + + +public class FeatureWarnLowHealth extends GuiFeature { + public FeatureWarnLowHealth() { + super("Dungeon", "Low Health Warning", "Warn if someone is on low health", "dungeon.lowhealthwarn", false, 200, 50); + parameters.put("color", new FeatureParameter("color", "Color", "Color of playername", Color.yellow, "color")); + parameters.put("threshold", new FeatureParameter("threshold", "Health Threshold", "Health Threshold for this feature to be toggled. default to 500", 500, "integer")); + + } + + + private SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); + + @Override + public void drawDemo(float partialTicks) { + FontRenderer fr = getFontRenderer(); + double scale = getFeatureRect().getHeight() / fr.FONT_HEIGHT; + GlStateManager.scale(scale, scale, 0); + fr.drawString("DungeonsGuide: ", 0,0,this.getParameter("color").getValue().getRGB()); + fr.drawString("500hp", fr.getStringWidth("DungeonsGuide: "), 0, Color.red.getRGB()); + } + + @Override + public void drawHUD(float partialTicks) { + FontRenderer fr = getFontRenderer(); + double scale = getFeatureRect().getHeight() / fr.FONT_HEIGHT; + GlStateManager.scale(scale, scale, 0); + String lowestHealthName = ""; + int lowestHealth = 999999999; + Scoreboard scoreboard = Minecraft.getMinecraft().thePlayer.getWorldScoreboard(); + ScoreObjective objective = scoreboard.getObjectiveInDisplaySlot(1); + for (Score sc : scoreboard.getSortedScores(objective)) { + ScorePlayerTeam scorePlayerTeam = scoreboard.getPlayersTeam(sc.getPlayerName()); + String line = ScorePlayerTeam.formatPlayerName(scorePlayerTeam, sc.getPlayerName()).trim(); + String stripped = TextUtils.keepScoreboardCharacters(TextUtils.stripColor(line)); + if (line.endsWith("❤")) { + String name = stripped.split(" ")[1]; + int health = Integer.parseInt(stripped.split(" ")[2]); + if (health < lowestHealth) { + lowestHealth = health; + lowestHealthName = name; + } + } + } + if (lowestHealth > this.getParameter("threshold").getValue()) return; + fr.drawString(lowestHealthName+": ", 0,0,this.getParameter("color").getValue().getRGB()); + fr.drawString(lowestHealth+"hp", fr.getStringWidth(lowestHealthName+"DungeonsGuide: "), 0, Color.red.getRGB()); + } +} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureCooldownCounter.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureCooldownCounter.java new file mode 100644 index 00000000..6547196c --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureCooldownCounter.java @@ -0,0 +1,47 @@ +package kr.syeyoung.dungeonsguide.features.impl.etc; + +import kr.syeyoung.dungeonsguide.SkyblockStatus; +import kr.syeyoung.dungeonsguide.e; +import kr.syeyoung.dungeonsguide.features.FeatureParameter; +import kr.syeyoung.dungeonsguide.features.GuiFeature; +import kr.syeyoung.dungeonsguide.features.listener.DungeonQuitListener; +import kr.syeyoung.dungeonsguide.features.listener.TickListener; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.renderer.GlStateManager; +import org.lwjgl.opengl.GL11; + +import java.awt.*; + +public class FeatureCooldownCounter extends GuiFeature implements DungeonQuitListener { + public FeatureCooldownCounter() { + super("ETC", "Dungeon Cooldown Counter", "Counts 10 seconds after leaving dungeon", "qol.cooldown", true, getFontRenderer().getStringWidth("Cooldown: 10s "), getFontRenderer().FONT_HEIGHT); + parameters.put("color", new FeatureParameter("color", "Color", "Color of text", Color.white, "color")); + } + + private long leftDungeonTime = 0L; + private boolean wasInDungeon = false; + @Override + public void drawHUD(float partialTicks) { + if (System.currentTimeMillis() - leftDungeonTime > 20000) return; + FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; + double scale = getFeatureRect().getHeight() / fr.FONT_HEIGHT; + GlStateManager.scale(scale, scale, 0); + fr.drawString("Cooldown: "+(20 - (System.currentTimeMillis() - leftDungeonTime) / 1000)+"s", 0,0,this.getParameter("color").getValue().getRGB()); + } + + @Override + public void drawDemo(float partialTicks) { + FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; + double scale = getFeatureRect().getHeight() / fr.FONT_HEIGHT; + GlStateManager.scale(scale, scale, 0); + fr.drawString("Cooldown: 20s", 0,0,this.getParameter("color").getValue().getRGB()); + } + + SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); + + @Override + public void onDungeonQuit() { + leftDungeonTime = System.currentTimeMillis(); + } +} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureDisableMessage.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureDisableMessage.java new file mode 100644 index 00000000..5558b2c5 --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureDisableMessage.java @@ -0,0 +1,60 @@ +package kr.syeyoung.dungeonsguide.features.impl.etc; + +import kr.syeyoung.dungeonsguide.SkyblockStatus; +import kr.syeyoung.dungeonsguide.e; +import kr.syeyoung.dungeonsguide.features.FeatureParameter; +import kr.syeyoung.dungeonsguide.features.SimpleFeature; +import kr.syeyoung.dungeonsguide.features.listener.ChatListener; +import lombok.AllArgsConstructor; +import lombok.Data; +import net.minecraftforge.client.event.ClientChatReceivedEvent; + +import java.util.regex.Pattern; + +public class FeatureDisableMessage extends SimpleFeature implements ChatListener { + @Data + @AllArgsConstructor + public static class MessageData { + private Pattern pattern; + private String name; + private String description; + private String key; + } + + private static final MessageData[] PRE_DEFINED = new MessageData[] { + new MessageData(Pattern.compile("§r§cThere are blocks in the way!§r"), "Aote block message", "\"There are blocks in the way!\"", "aote"), + new MessageData(Pattern.compile("§r§cThis ability is currently on cooldown for .+ more seconds?\\.§r"), "Ability cooldown message", "\"This ability is currently on cooldown for 3 more seconds.\"", "cooldown"), + new MessageData(Pattern.compile("§r§cWhow! Slow down there!§r"), "Grappling hook cooldown", "\"Whow! Slow down there!\"", "grappling"), + new MessageData(Pattern.compile("§r§cNo more charges, next one in §r§e.+§r§cs!§r"), "Zombie Sword Charging", "\"No more charges, next one in 3s!\"", "zombie"), + new MessageData(Pattern.compile("§r§7Your .+ hit §r§c.+ §r§7enem(?:y|ies) for §r§c.+ §r§7damage\\.§r"), "Ability Damage", "\"Your blahblah hit 42 enemy for a lots of damage\"", "ability"), + new MessageData(Pattern.compile("§r§cYou do not have enough mana to do this!§r"), "Not enough mana", "\"You do not have enough mana to do this!\"", "mana"), + new MessageData(Pattern.compile("§r§aUsed §r.+§r§a!§r"), "Dungeon Ability Usage", "\"Used Guided Sheep!\" and such", "dungeonability"), + new MessageData(Pattern.compile("§r.+§r§a is ready to use! Press §r.+§r§a to activate it!§r"), "Ready to use message", "\"Blah is ready to use! Press F to activate it!", "readytouse"), + new MessageData(Pattern.compile("§r.+ §r§ais now available!§r"), "Ability Available","\"blah is now available!\"", "available"), + new MessageData(Pattern.compile("§r§cThe Stone doesn't seem to do anything here\\.§r"), "Stone Message", "\"The Stone doesn't seem to do anything here\"", "stone") + }; + + public FeatureDisableMessage() { + super("fixes", "Disable ability messages", "Do not let ability messages show up in chatbox\nclick on Edit for more precise settings", "fixes.messagedisable", true); + for (MessageData messageData : PRE_DEFINED) { + this.parameters.put(messageData.key, new FeatureParameter(messageData.key, messageData.name, messageData.description, true, "boolean")); + } + } + + SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); + + @Override + public void onChat(ClientChatReceivedEvent clientChatReceivedEvent) { + if (clientChatReceivedEvent.type == 2) return; + if (!isEnabled()) return; + if (!skyblockStatus.isOnSkyblock()) return; + String msg = clientChatReceivedEvent.message.getFormattedText(); + System.out.println(msg); + for (MessageData md:PRE_DEFINED) { + if (this.getParameter(md.key).getValue() && md.pattern.matcher(msg).matches()) { + clientChatReceivedEvent.setCanceled(true); + return; + } + } + } +} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureTooltipDungeonStat.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureTooltipDungeonStat.java new file mode 100644 index 00000000..d8f32b98 --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureTooltipDungeonStat.java @@ -0,0 +1,34 @@ +package kr.syeyoung.dungeonsguide.features.impl.etc; + +import kr.syeyoung.dungeonsguide.features.SimpleFeature; +import kr.syeyoung.dungeonsguide.features.listener.TooltipListener; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.event.entity.player.ItemTooltipEvent; + +public class FeatureTooltipDungeonStat extends SimpleFeature implements TooltipListener { + public FeatureTooltipDungeonStat() { + super("ETC", "Dungeon Item Stats", "Shows quality of dungeon items (floor, percentage)", "tooltip.dungeonitem"); + } + + @Override + public void onTooltip(ItemTooltipEvent event) { + if (!isEnabled()) return; + + ItemStack hoveredItem = event.itemStack; + NBTTagCompound compound = hoveredItem.getTagCompound(); + if (compound == null) + return; + if (!compound.hasKey("ExtraAttributes")) + return; + NBTTagCompound nbtTagCompound = compound.getCompoundTag("ExtraAttributes"); + + int floor = nbtTagCompound.getInteger("item_tier"); + int percentage = nbtTagCompound.getInteger("baseStatBoostPercentage"); + + if (nbtTagCompound.hasKey("item_tier")) + event.toolTip.add("§7Obtained in: §c"+(floor == 0 ? "Entrance" : "Floor "+floor)); + if (nbtTagCompound.hasKey("baseStatBoostPercentage")) + event.toolTip.add("§7Stat Percentage: §"+(percentage == 50 ? "6§l":"c")+(percentage * 2)+"%"); + } +} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureTooltipPrice.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureTooltipPrice.java new file mode 100644 index 00000000..eebb934b --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureTooltipPrice.java @@ -0,0 +1,92 @@ +package kr.syeyoung.dungeonsguide.features.impl.etc; + +import kr.syeyoung.dungeonsguide.features.FeatureParameter; +import kr.syeyoung.dungeonsguide.features.SimpleFeature; +import kr.syeyoung.dungeonsguide.features.listener.TooltipListener; +import kr.syeyoung.dungeonsguide.utils.AhUtils; +import kr.syeyoung.dungeonsguide.utils.TextUtils; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.event.entity.player.ItemTooltipEvent; +import org.lwjgl.input.Keyboard; + +import java.util.Comparator; +import java.util.Set; +import java.util.TreeSet; + +public class FeatureTooltipPrice extends SimpleFeature implements TooltipListener { + public FeatureTooltipPrice() { + super("ETC", "Item Price", "Shows price of items", "tooltip.price"); + parameters.put("reqShift", new FeatureParameter("reqShift", "Require Shift", "If shift needs to be pressed in order for this feature to be activated", false, "boolean")); + } + + @Override + public void onTooltip(ItemTooltipEvent event) { + if (!isEnabled()) return; + + boolean activated = !this.getParameter("reqShift").getValue() || Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT); + + ItemStack hoveredItem = event.itemStack; + NBTTagCompound compound = hoveredItem.getTagCompound(); + if (compound == null) + return; + if (!compound.hasKey("ExtraAttributes")) + return; + if (!activated) { + event.toolTip.add("§7Shift to view price"); + return; + } + + final String id = compound.getCompoundTag("ExtraAttributes").getString("id"); + if (id.equals("ENCHANTED_BOOK")) { + final NBTTagCompound enchants = compound.getCompoundTag("ExtraAttributes").getCompoundTag("enchantments"); + Set keys = enchants.getKeySet(); + Set actualKeys = new TreeSet(new Comparator() { + public int compare(String o1, String o2) { + String id2 = id + "::" + o1 + "-" + enchants.getInteger(o1); + AhUtils.AuctionData auctionData = AhUtils.auctions.get(id2); + int price1 = (auctionData == null) ? 0 : auctionData.lowestBin; + String id3 = id + "::" + o2 + "-" + enchants.getInteger(o2); + AhUtils.AuctionData auctionData2 = AhUtils.auctions.get(id3); + int price2 = (auctionData2 == null) ? 0 : auctionData2.lowestBin; + return (compare2(price1, price2) == 0) ? o1.compareTo(o2) : compare2(price1, price2); + } + + public int compare2(int y, int x) { + return (x < y) ? -1 : ((x == y) ? 0 : 1); + } + }); + actualKeys.addAll(keys); + int totalLowestPrice = 0; + int iterations = 0; + for (String key : actualKeys) { + iterations++; + String id2 = id + "::" + key + "-" + enchants.getInteger(key); + AhUtils.AuctionData auctionData = AhUtils.auctions.get(id2); + if (auctionData == null) { + if (iterations < 10) + event.toolTip.add("§f"+ key + " " + enchants.getInteger(key) + "§7: §cn/a"); + continue; + } + if (iterations < 10) + event.toolTip.add("§f"+ key + " " + enchants.getInteger(key) + "§7: §e"+ TextUtils.format( auctionData.lowestBin)); + totalLowestPrice += auctionData.lowestBin; + } + if (iterations >= 10) + event.toolTip.add("§7"+ (iterations - 10) + " more enchants... "); + event.toolTip.add("§fTotal Lowest§7: §e"+ TextUtils.format(totalLowestPrice)); + } else { + AhUtils.AuctionData auctionData = AhUtils.auctions.get(id); + event.toolTip.add(""); + if (auctionData == null) { + event.toolTip.add("§fLowest ah §7: §cn/a"); + event.toolTip.add("§fBazaar sell price §7: §cn/a"); + event.toolTip.add("§fBazaar buy price §7: §cn/a"); + } else { + event.toolTip.add("§fLowest ah §7: " + ((auctionData.lowestBin != -1) ? ("§e"+ TextUtils.format(auctionData.lowestBin)) : "§cn/a")); + event.toolTip.add("§fBazaar sell price §7: " + ((auctionData.sellPrice == -1) ? "§cn/a": ("§e"+ TextUtils.format(auctionData.sellPrice)))); + event.toolTip.add("§fBazaar buy price §7: " + ((auctionData.buyPrice == -1) ? "§cn/a": ("§e"+ TextUtils.format(auctionData.buyPrice)))); + } + } + } +} -- cgit