aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io/github/moulberry/notenoughupdates/ItemPriceInformation.java
diff options
context:
space:
mode:
authorBuildTools <james.jenour@protonmail.com>2021-01-18 23:59:09 +0800
committerBuildTools <james.jenour@protonmail.com>2021-01-18 23:59:09 +0800
commit3255cfce951367c9303297205f64577ef1eac650 (patch)
treef43ceb889dc96aed62b378bdc4f5fe3fd3fd95ac /src/main/java/io/github/moulberry/notenoughupdates/ItemPriceInformation.java
parentc9cc530adfb39085fe4b0f9a60e0ca6e4bbb8eb9 (diff)
downloadnotenoughupdates-3255cfce951367c9303297205f64577ef1eac650.tar.gz
notenoughupdates-3255cfce951367c9303297205f64577ef1eac650.tar.bz2
notenoughupdates-3255cfce951367c9303297205f64577ef1eac650.zip
gravy
Diffstat (limited to 'src/main/java/io/github/moulberry/notenoughupdates/ItemPriceInformation.java')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/ItemPriceInformation.java43
1 files changed, 42 insertions, 1 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/ItemPriceInformation.java b/src/main/java/io/github/moulberry/notenoughupdates/ItemPriceInformation.java
index 8d71992e..cafbff05 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/ItemPriceInformation.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/ItemPriceInformation.java
@@ -2,6 +2,9 @@ package io.github.moulberry.notenoughupdates;
import com.google.gson.JsonObject;
import io.github.moulberry.notenoughupdates.auction.APIManager;
+import io.github.moulberry.notenoughupdates.util.Constants;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumChatFormatting;
import org.lwjgl.input.Keyboard;
@@ -11,7 +14,7 @@ import java.util.Locale;
public class ItemPriceInformation {
- public static boolean addToTooltip(List<String> tooltip, String internalname) {
+ public static boolean addToTooltip(List<String> tooltip, String internalname, ItemStack stack) {
JsonObject auctionInfo = NotEnoughUpdates.INSTANCE.manager.auctionManager.getItemAuctionInfo(internalname);
JsonObject bazaarInfo = NotEnoughUpdates.INSTANCE.manager.auctionManager.getBazaarInfo(internalname);
float lowestBinAvg = NotEnoughUpdates.INSTANCE.manager.auctionManager.getItemAvgBin(internalname);
@@ -106,6 +109,44 @@ public class ItemPriceInformation {
EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+format.format(lowestBinAvg)+" coins");
}
break;
+ case 6:
+ if(Constants.ESSENCECOSTS == null) break;
+ JsonObject essenceCosts = Constants.ESSENCECOSTS;
+ if(!essenceCosts.has(internalname)) {
+ break;
+ }
+ JsonObject itemCosts = essenceCosts.get(internalname).getAsJsonObject();
+ String essenceType = itemCosts.get("type").getAsString();
+
+ int dungeonItemLevel = -1;
+ if(stack != null && stack.hasTagCompound() &&
+ stack.getTagCompound().hasKey("ExtraAttributes", 10)) {
+ NBTTagCompound ea = stack.getTagCompound().getCompoundTag("ExtraAttributes");
+
+ if (ea.hasKey("dungeon_item_level", 99)) {
+ dungeonItemLevel = ea.getInteger("dungeon_item_level");
+ }
+ }
+ if(dungeonItemLevel == -1) {
+ int dungeonizeCost = 0;
+ if(itemCosts.has("dungeonize")) {
+ dungeonizeCost = itemCosts.get("dungeonize").getAsInt();
+ }
+ tooltip.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"Dungeonize Cost: " +
+ EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+dungeonizeCost+" "+essenceType);
+ } else if(dungeonItemLevel >= 0 && dungeonItemLevel <= 4) {
+ String costType = (dungeonItemLevel+1)+"";
+
+ int upgradeCost = itemCosts.get(costType).getAsInt();
+ StringBuilder star = new StringBuilder();
+ for(int i=0; i<=dungeonItemLevel; i++) {
+ star.append('\u272A');
+ }
+ tooltip.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"Upgrade to "+
+ EnumChatFormatting.GOLD+star+EnumChatFormatting.YELLOW+EnumChatFormatting.BOLD+": " +
+ EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+upgradeCost+" "+essenceType);
+ }
+ break;
}
}