aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io/github/moulberry/notenoughupdates/ItemPriceInformation.java
diff options
context:
space:
mode:
authorRoman / Linnea Gräf <roman.graef@gmail.com>2023-05-31 13:04:41 +0200
committerGitHub <noreply@github.com>2023-05-31 13:04:41 +0200
commitf4a9e4011b09be043ec086abd365d0e8c443bbec (patch)
tree763a8dc14d8b1e4a4af59f5f649a465a3c721c37 /src/main/java/io/github/moulberry/notenoughupdates/ItemPriceInformation.java
parent3740ac08399d4c16802729511b5032e8f8ac6e14 (diff)
downloadnotenoughupdates-f4a9e4011b09be043ec086abd365d0e8c443bbec.tar.gz
notenoughupdates-f4a9e4011b09be043ec086abd365d0e8c443bbec.tar.bz2
notenoughupdates-f4a9e4011b09be043ec086abd365d0e8c443bbec.zip
Add NPC Sell price to tooltip (#702)
Diffstat (limited to 'src/main/java/io/github/moulberry/notenoughupdates/ItemPriceInformation.java')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/ItemPriceInformation.java47
1 files changed, 24 insertions, 23 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/ItemPriceInformation.java b/src/main/java/io/github/moulberry/notenoughupdates/ItemPriceInformation.java
index 7d408e0f..6e7f83e4 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/ItemPriceInformation.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/ItemPriceInformation.java
@@ -26,6 +26,7 @@ import io.github.moulberry.notenoughupdates.auction.APIManager;
import io.github.moulberry.notenoughupdates.core.config.KeybindHelper;
import io.github.moulberry.notenoughupdates.util.Constants;
import io.github.moulberry.notenoughupdates.util.Utils;
+import io.github.moulberry.notenoughupdates.util.hypixelapi.HypixelItemAPI;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
import org.lwjgl.input.Keyboard;
@@ -123,22 +124,18 @@ public class ItemPriceInformation {
}
}
+ int shiftStackMultiplier = useStackSize && stack.stackSize > 1 ? stack.stackSize : stack.getItem().getItemStackLimit(stack);
+ if (stack.getTagCompound() != null && stack.getTagCompound().hasKey(STACKSIZE_OVERRIDE)) {
+ shiftStackMultiplier = stack.getTagCompound().getInteger(STACKSIZE_OVERRIDE);
+ }
+ int stackMultiplier = 1;
+ boolean shiftPressed = Keyboard.isKeyDown(Keyboard.KEY_LSHIFT);
+ if (shiftPressed) {
+ stackMultiplier = shiftStackMultiplier;
+ }
+ boolean added = false;
if (bazaarItem) {
List<Integer> lines = NotEnoughUpdates.INSTANCE.config.tooltipTweaks.priceInfoBaz;
-
- boolean added = false;
-
- boolean shiftPressed = Keyboard.isKeyDown(Keyboard.KEY_LSHIFT);
-
- int stackMultiplier = 1;
- int shiftStackMultiplier = useStackSize && stack.stackSize > 1 ? stack.stackSize : 64;
- if (stack.getTagCompound() != null && stack.getTagCompound().hasKey(STACKSIZE_OVERRIDE)) {
- shiftStackMultiplier = stack.getTagCompound().getInteger(STACKSIZE_OVERRIDE);
- }
- if (shiftPressed) {
- stackMultiplier = shiftStackMultiplier;
- }
-
//values = {"", "Buy", "Sell", "Buy (Insta)", "Sell (Insta)", "Raw Craft Cost", "Instabuys (Hourly)", "Instasells (Hourly)", "Instabuys (Daily)", "Instasells (Daily)", "Instabuys (Weekly)", "Instasells (Weekly)"}
for (int lineId : lines) {
switch (lineId) {
@@ -288,7 +285,6 @@ public class ItemPriceInformation {
} else if (auctionItem && !auctionInfoErrored) {
List<Integer> lines = NotEnoughUpdates.INSTANCE.config.tooltipTweaks.priceInfoAuc;
- boolean added = false;
for (int lineId : lines) {
switch (lineId) {
@@ -444,14 +440,13 @@ public class ItemPriceInformation {
}
} else if (NotEnoughUpdates.INSTANCE.config.tooltipTweaks.rawCraft && craftCost != null && craftCost.fromRecipe) {
-
- if (craftCost.craftCost == 0) return;
- double cost = craftCost.craftCost;
- int shiftStackMultiplier = useStackSize && stack.stackSize > 1 ? stack.stackSize : 64;
- if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) cost = cost * shiftStackMultiplier;
- tooltip.add("");
- tooltip.add(formatPrice("Raw Craft Cost: ", cost));
-
+ if (craftCost.craftCost != 0) {
+ double cost = craftCost.craftCost;
+ cost = cost * stackMultiplier;
+ added = true;
+ tooltip.add("");
+ tooltip.add(formatPrice("Raw Craft Cost: ", cost));
+ }
} else if (auctionInfoErrored && NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard()) {
String message = EnumChatFormatting.RED.toString() + EnumChatFormatting.BOLD + "[NEU] API is down";
if (auctionableItems != null && !auctionableItems.isEmpty()) {
@@ -462,6 +457,12 @@ public class ItemPriceInformation {
tooltip.add(message + " and no item data is cached");
}
}
+ Double npcSellPrice = HypixelItemAPI.getNPCSellPrice(internalname);
+ if (NotEnoughUpdates.INSTANCE.config.tooltipTweaks.npcSellPrice && npcSellPrice != null) {
+ if (!added)
+ tooltip.add("");
+ tooltip.add(formatPrice("NPC Sell Price: ", npcSellPrice * stackMultiplier));
+ }
}
private static String formatPrice(String label, double price) {