From 5f521c98519a636e6139113887cdc2e223300333 Mon Sep 17 00:00:00 2001 From: NopoTheGamer <40329022+NopoTheGamer@users.noreply.github.com> Date: Fri, 11 Nov 2022 13:24:50 +0000 Subject: Added support for enrichments to /hex (#428) --- .../notenoughupdates/miscgui/hex/GuiCustomHex.java | 99 +++++++++++----------- .../notenoughupdates/miscgui/hex/HexItem.java | 42 +++++++++ .../notenoughupdates/miscgui/hex/ItemType.java | 11 +++ 3 files changed, 102 insertions(+), 50 deletions(-) (limited to 'src/main/java/io') diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/hex/GuiCustomHex.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/hex/GuiCustomHex.java index 5361ae89..4dbe7f94 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/hex/GuiCustomHex.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/hex/GuiCustomHex.java @@ -773,31 +773,7 @@ public class GuiCustomHex extends Gui { if (itemId.equalsIgnoreCase("Item_Maxed_Out")) continue; if (searchField.getText().trim().isEmpty() || name.toLowerCase().contains(searchField.getText().trim().toLowerCase())) { - if (name.equalsIgnoreCase("Hot Potato Book")) { - name = "Hot Potato"; - } else if (name.equalsIgnoreCase("Fuming Potato Book")) { - name = "Fuming Potato"; - } else if (name.equalsIgnoreCase("Recombobulator 3000")) { - name = "Recombobulator"; - } else if (name.contains("Power Scroll")) { - name = name.replace("Power ", ""); - } else if (name.contains("\u272a")) { - name = name.replaceAll("[^✪]*", ""); - } else if (name.equalsIgnoreCase("First Master Star")) { - name = "Master Star \u00a7c➊"; - } else if (name.equalsIgnoreCase("Second Master Star")) { - name = "Master Star \u00a7c➋"; - } else if (name.equalsIgnoreCase("Third Master Star")) { - name = "Master Star \u00a7c➌"; - } else if (name.equalsIgnoreCase("Fourth Master Star")) { - name = "Master Star \u00a7c➍"; - } else if (name.equalsIgnoreCase("Fifth Master Star")) { - name = "Master Star \u00a7c➎"; - } else if (name.equalsIgnoreCase("The Art Of Peace")) { - name = "Art Of Peace"; - } else if (name.equalsIgnoreCase("Mana Disintegrator")) { - name = "M Disintegrator"; - } + name = fixName(name); /*if (playerEnchantIds.containsKey(itemId)) { HexItem item = new HexItem(slotIndex, name, itemId, Utils.getRawTooltip(book), false, false @@ -929,6 +905,9 @@ public class GuiCustomHex extends Gui { if (manaDisintegratorCount >= 10) removableItem.add(item); else applicableItem.add(item); + } else if (item.isEnrichment()) { + applicableItem.add(item); + } else { applicableItem.add(item); } @@ -2422,31 +2401,7 @@ public class GuiCustomHex extends Gui { //Enchant name String name = WordUtils.capitalizeFully(enchanterCurrentItem.itemId.replace("_", " ")); - if (name.equalsIgnoreCase("Hot Potato Book")) { - name = "Hot Potato"; - } else if (name.equalsIgnoreCase("Fuming Potato Book")) { - name = "Fuming Potato"; - } else if (name.equalsIgnoreCase("Recombobulator 3000")) { - name = "Recombobulator"; - } else if (name.contains("Power Scroll")) { - name = name.replace("Power ", ""); - } else if (name.contains("\u272a")) { - name = name.replaceAll("[^✪]*", ""); - } else if (name.equalsIgnoreCase("First Master Star")) { - name = "Master Star \u00a7c➊"; - } else if (name.equalsIgnoreCase("Second Master Star")) { - name = "Master Star \u00a7c➋"; - } else if (name.equalsIgnoreCase("Third Master Star")) { - name = "Master Star \u00a7c➌"; - } else if (name.equalsIgnoreCase("Fourth Master Star")) { - name = "Master Star \u00a7c➍"; - } else if (name.equalsIgnoreCase("Fifth Master Star")) { - name = "Master Star \u00a7c➎"; - } else if (name.equalsIgnoreCase("The Art Of Peace")) { - name = "Art Of Peace"; - } else if (name.equalsIgnoreCase("Mana Disintegrator")) { - name = "M Disintegrator"; - } + name = fixName(name); Utils.drawStringCentered( name, Minecraft.getMinecraft().fontRendererObj, @@ -4882,4 +4837,48 @@ public class GuiCustomHex extends Gui { (!NotEnoughUpdates.INSTANCE.config.slotLocking.enableSlotLocking || Keyboard.getEventKey() != NotEnoughUpdates.INSTANCE.config.slotLocking.slotLockKey); } + + private String fixName(String name) { + name = name.replace("Enrichment", "Enrich"); + if (name.equalsIgnoreCase("Hot Potato Book")) { + name = "Hot Potato"; + } else if (name.equalsIgnoreCase("Fuming Potato Book")) { + name = "Fuming Potato"; + } else if (name.equalsIgnoreCase("Recombobulator 3000")) { + name = "Recombobulator"; + } else if (name.contains("Power Scroll")) { + name = name.replace("Power ", ""); + } else if (name.contains("\u272a")) { + name = name.replaceAll("[^✪]*", ""); + } else if (name.equalsIgnoreCase("First Master Star")) { + name = "Master Star \u00a7c➊"; + } else if (name.equalsIgnoreCase("Second Master Star")) { + name = "Master Star \u00a7c➋"; + } else if (name.equalsIgnoreCase("Third Master Star")) { + name = "Master Star \u00a7c➌"; + } else if (name.equalsIgnoreCase("Fourth Master Star")) { + name = "Master Star \u00a7c➍"; + } else if (name.equalsIgnoreCase("Fifth Master Star")) { + name = "Master Star \u00a7c➎"; + } else if (name.equalsIgnoreCase("The Art Of Peace")) { + name = "Art Of Peace"; + } else if (name.equalsIgnoreCase("Mana Disintegrator")) { + name = "M Disintegrator"; + } else if (name.equalsIgnoreCase("Intelligence Enrich")) { + name = "Int Enrich"; + } else if (name.equalsIgnoreCase("Critical Damage Enrich")) { + name = "Cd Enrich"; + } else if (name.equalsIgnoreCase("Strength Enrich")) { + name = "Str Enrich"; + } else if (name.equalsIgnoreCase("Magic Find Enrich")) { + name = "Mf Enrich"; + } else if (name.equalsIgnoreCase("Ferocity Enrich")) { + name = "Fero Enrich"; + } else if (name.equalsIgnoreCase("Sea Creature Chance Enrich")) { + name = "SCC Enrich"; + } else if (name.equalsIgnoreCase("Attack Speed Enrich")) { + name = "Atk Spd Enrich"; + } + return name; + } } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/hex/HexItem.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/hex/HexItem.java index 5b3b30ea..8d28dd1d 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/hex/HexItem.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/hex/HexItem.java @@ -148,6 +148,39 @@ public class HexItem { case "COLOSSAL_EXPERIENCE_BOTTLE": this.itemType = ItemType.COLOSSAL_EXPERIENCE_BOTTLE; break; + case "FEROCITY_ENRICHMENT": + this.itemType = ItemType.ENRICHMENT_FEROCITY; + break; + case "SEA_CREATURE_CHANCE_ENRICHMENT": + this.itemType = ItemType.ENRICHMENT_SCC; + break; + case "ATTACK_SPEED_ENRICHMENT": + this.itemType = ItemType.ENRICHMENT_ATTACK_SPEED; + break; + case "SPEED_ENRICHMENT": + this.itemType = ItemType.ENRICHMENT_SPEED; + break; + case "INTELLIGENCE_ENRICHMENT": + this.itemType = ItemType.ENRICHMENT_INTELLIGENCE; + break; + case "CRITICAL_DAMAGE_ENRICHMENT": + this.itemType = ItemType.ENRICHMENT_CRIT_DAMAGE; + break; + case "STRENGTH_ENRICHMENT": + this.itemType = ItemType.ENRICHMENT_STRENGTH; + break; + case "DEFENSE_ENRICHMENT": + this.itemType = ItemType.ENRICHMENT_DEFENSE; + break; + case "HEALTH_ENRICHMENT": + this.itemType = ItemType.ENRICHMENT_HEALTH; + break; + case "MAGIC_FIND_ENRICHMENT": + this.itemType = ItemType.ENRICHMENT_MAGIC_FIND; + break; + case "CRITICAL_CHANCE_ENRICHMENT": + this.itemType = ItemType.ENRICHMENT_CRIT_CHANCE; + break; } if (this.itemType == ItemType.UNKNOWN) { for (String string : displayLore) { @@ -261,4 +294,13 @@ public class HexItem { itemType == ItemType.JADE_GEMSTONE || itemType == ItemType.AMBER_GEMSTONE || itemType == ItemType.OPAL_GEMSTONE || itemType == ItemType.TOPAZ_GEMSTONE; } + + public boolean isEnrichment() { + return itemType == ItemType.ENRICHMENT_DEFENSE || itemType == ItemType.ENRICHMENT_SCC || + itemType == ItemType.ENRICHMENT_HEALTH || itemType == ItemType.ENRICHMENT_STRENGTH || + itemType == ItemType.ENRICHMENT_SPEED || itemType == ItemType.ENRICHMENT_CRIT_DAMAGE || + itemType == ItemType.ENRICHMENT_CRIT_CHANCE || itemType == ItemType.ENRICHMENT_ATTACK_SPEED || + itemType == ItemType.ENRICHMENT_INTELLIGENCE || itemType == ItemType.ENRICHMENT_MAGIC_FIND || + itemType == ItemType.ENRICHMENT_FEROCITY; + } } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/hex/ItemType.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/hex/ItemType.java index 3b47a86d..48323055 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/hex/ItemType.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/hex/ItemType.java @@ -68,6 +68,17 @@ enum ItemType { GRAND_EXPERIENCE_BOTTLE, TITANIC_EXPERIENCE_BOTTLE, COLOSSAL_EXPERIENCE_BOTTLE, + ENRICHMENT_SPEED, + ENRICHMENT_INTELLIGENCE, + ENRICHMENT_CRIT_DAMAGE, + ENRICHMENT_STRENGTH, + ENRICHMENT_DEFENSE, + ENRICHMENT_HEALTH, + ENRICHMENT_MAGIC_FIND, + ENRICHMENT_FEROCITY, + ENRICHMENT_SCC, + ENRICHMENT_ATTACK_SPEED, + ENRICHMENT_CRIT_CHANCE, UNKNOWN; private int starLevel = -1; -- cgit