diff options
Diffstat (limited to 'src')
5 files changed, 46 insertions, 11 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/util/StringUtils.java b/src/main/java/io/github/moulberry/notenoughupdates/core/util/StringUtils.java index 59ba0a33..b0b6e2db 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/core/util/StringUtils.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/core/util/StringUtils.java @@ -73,4 +73,10 @@ public class StringUtils { throw new RuntimeException("removeLastWord: '" + string + "'", e); } } + + public static String firstUpperLetter(String text) { + if (text.isEmpty()) return text; + String firstLetter = ("" + text.charAt(0)).toUpperCase(); + return firstLetter + text.substring(1); + } } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/MinionHelperManager.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/MinionHelperManager.java index c0604dda..dbfeffbf 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/MinionHelperManager.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/MinionHelperManager.java @@ -50,6 +50,8 @@ public class MinionHelperManager { private final Map<String, String> upgradeCostFormatCache = new HashMap<>(); private final Map<String, String> fullCostFormatCache = new HashMap<>(); private ApiData apiData = null; + private boolean shouldNotifyNoCollectionApi = false; + //TODO maybe change logic with 0 coins later or stuff private final List<String> cheapItems = Arrays.asList( "WOOD_SWORD", "WOOD_HOE", @@ -305,4 +307,12 @@ public class MinionHelperManager { public boolean isCollectionApiDisabled() { return apiData != null && apiData.isCollectionApiDisabled(); } + + public void setShouldNotifyNoCollectionApi(boolean shouldNotifyNoCollectionApi) { + this.shouldNotifyNoCollectionApi = shouldNotifyNoCollectionApi; + } + + public boolean isShouldNotifyNoCollectionApi() { + return shouldNotifyNoCollectionApi; + } } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/MinionHelperOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/MinionHelperOverlay.java index 90ad0c27..65e57079 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/MinionHelperOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/MinionHelperOverlay.java @@ -20,6 +20,7 @@ package io.github.moulberry.notenoughupdates.miscgui.minionhelper; import com.google.common.collect.ArrayListMultimap; +import com.google.common.collect.Lists; import io.github.moulberry.notenoughupdates.NotEnoughUpdates; import io.github.moulberry.notenoughupdates.miscgui.TrophyRewardOverlay; import io.github.moulberry.notenoughupdates.miscgui.minionhelper.loaders.MinionHelperRepoLoader; @@ -31,6 +32,7 @@ import io.github.moulberry.notenoughupdates.miscgui.minionhelper.sources.Craftin import io.github.moulberry.notenoughupdates.miscgui.minionhelper.sources.MinionSource; import io.github.moulberry.notenoughupdates.miscgui.minionhelper.sources.NpcSource; import io.github.moulberry.notenoughupdates.mixins.AccessorGuiContainer; +import io.github.moulberry.notenoughupdates.util.NotificationHandler; import io.github.moulberry.notenoughupdates.util.Utils; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; @@ -81,6 +83,17 @@ public class MinionHelperOverlay { public void onDrawBackground(GuiScreenEvent.BackgroundDrawnEvent event) { if (!manager.inCraftedMinionsInventory()) return; + if (manager.isShouldNotifyNoCollectionApi()) { + NotificationHandler.displayNotification(Lists.newArrayList( + "", + "§cCollection API is disabled!", + "§cMinion Helper will not filter minions that", + "§cdo not meet the collection requirements!" + ), false, true); + //TODO add tutorial how to enable collection api + manager.setShouldNotifyNoCollectionApi(false); + } + LinkedHashMap<String, RenderableObject> renderMap = getRenderMap(); renderHover(renderMap); @@ -172,10 +185,11 @@ public class MinionHelperOverlay { Minion minion = minionSource.getMinion(); lastHovered = minion; String displayName = minion.getDisplayName(); - lines.add(displayName + " " + minion.getTier()); + lines.add("§9" + displayName + " " + minion.getTier()); List<MinionRequirement> requirements = manager.getRequirements(minionSource.getMinion()); if (!requirements.isEmpty()) { for (MinionRequirement requirement : requirements) { + //TODO maybe change the §7 color String color = manager.meetRequirement(minion, requirement) ? "§a" : "§7"; if (requirement instanceof CollectionRequirement && manager.isCollectionApiDisabled()) { color = "§cAPI DISABLED! §7"; @@ -191,9 +205,9 @@ public class MinionHelperOverlay { lines.add(""); String format = manager.calculateUpgradeCostsFormat(craftingSource, true); if (minion.getTier() == 1) { - lines.add("Full crafting costs: " + format); + lines.add("§7Full crafting costs: " + format); } else { - lines.add("Upgrade costs: " + format); + lines.add("§7Upgrade costs: " + format); } formatItems(lines, grabAllItems(craftingSource.getItems())); @@ -201,9 +215,9 @@ public class MinionHelperOverlay { NpcSource npcSource = (NpcSource) minionSource; String npcName = npcSource.getNpcName(); lines.add(""); - lines.add("Buy at §9" + npcName + " (NPC)"); + lines.add("§7Buy from: §9" + npcName + " (NPC)"); lines.add(""); - lines.add("Buy costs: " + manager.calculateUpgradeCostsFormat(npcSource, true)); + lines.add("§7Buy costs: " + manager.calculateUpgradeCostsFormat(npcSource, true)); lines.add(" §8- " + manager.formatCoins(npcSource.getCoins())); formatItems(lines, grabAllItems(npcSource.getItems())); } @@ -220,9 +234,9 @@ public class MinionHelperOverlay { String name = MinionHelperRepoLoader.getInstance().getDisplayName(internalName); int amount = entry.getValue(); - String amountText = amount != 1 ? amount + "x " : ""; + String amountText = amount != 1 ? amount + "§7x " : ""; String price = manager.formatCoins(manager.getPrice(internalName) * amount); - lines.add(" §8- §f" + amountText + name + " " + price); + lines.add(" §8- §a" + amountText + "§f" + name + " " + price); } } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/loaders/MinionHelperApiLoader.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/loaders/MinionHelperApiLoader.java index 26eac09a..c17d4883 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/loaders/MinionHelperApiLoader.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/loaders/MinionHelperApiLoader.java @@ -19,6 +19,7 @@ package io.github.moulberry.notenoughupdates.miscgui.minionhelper.loaders; +import com.google.common.collect.Lists; import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonObject; @@ -28,6 +29,7 @@ import io.github.moulberry.notenoughupdates.miscgui.minionhelper.ApiData; import io.github.moulberry.notenoughupdates.miscgui.minionhelper.MinionHelperManager; import io.github.moulberry.notenoughupdates.profileviewer.ProfileViewer; import io.github.moulberry.notenoughupdates.util.Constants; +import io.github.moulberry.notenoughupdates.util.NotificationHandler; import io.github.moulberry.notenoughupdates.util.SBInfo; import io.github.moulberry.notenoughupdates.util.Utils; import net.minecraft.client.Minecraft; @@ -144,9 +146,7 @@ public class MinionHelperApiLoader { collectionApiEnabled = true; } else { if (collectionApiEnabled) { - //TODO formatting - Utils.addChatMessage("§c[NEU] Collection API is disabled!"); - Utils.addChatMessage("§c[NEU] Minion Helper will not filter minions that do not meet the collection requirements!"); + manager.setShouldNotifyNoCollectionApi(true); } collectionApiEnabled = false; } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/requirements/ReputationRequirement.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/requirements/ReputationRequirement.java index 14f065a1..525af1df 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/requirements/ReputationRequirement.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/requirements/ReputationRequirement.java @@ -19,16 +19,21 @@ package io.github.moulberry.notenoughupdates.miscgui.minionhelper.requirements; +import io.github.moulberry.notenoughupdates.core.util.StringUtils; import io.github.moulberry.notenoughupdates.util.Utils; public class ReputationRequirement extends MinionRequirement { private final String reputationType; private final int reputation; + private final String description; public ReputationRequirement(String reputationType, int reputation) { this.reputationType = reputationType; this.reputation = reputation; + + String reputationName = StringUtils.firstUpperLetter(reputationType.toLowerCase()); + description = "Reputation: " + Utils.formatNumberWithDots(reputation) + " " + reputationName + " Reputation"; } public int getReputation() { @@ -41,6 +46,6 @@ public class ReputationRequirement extends MinionRequirement { @Override public String printDescription() { - return "Reputation: " + Utils.formatNumberWithDots(reputation) + " " + reputationType.toLowerCase() + " reputation"; + return description; } } |