aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/io')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java3
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java1
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java32
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/TradeWindow.java349
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/auction/APIManager.java3
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java85
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java106
7 files changed, 456 insertions, 123 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java
index d5dd1184..c0932fcf 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java
@@ -834,6 +834,9 @@ public class NEUManager {
}
item.add("item_contents", bytesArr);
}
+ if(ea.hasKey("dungeon_item_level")) {
+ item.addProperty("dungeon_item_level", ea.getInteger("dungeon_item_level"));
+ }
}
if(lore != null && lore.length > 0) {
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java
index a13177ca..a3670a86 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java
@@ -1570,6 +1570,7 @@ public class NEUOverlay extends Gui {
return;
}
FontRenderer fr = Minecraft.getMinecraft().fontRendererObj;
+
scaledresolution = new ScaledResolution(Minecraft.getMinecraft());
int width = scaledresolution.getScaledWidth();
int height = scaledresolution.getScaledHeight();
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java
index ab0de3cb..b2908d52 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java
@@ -317,8 +317,14 @@ public class NotEnoughUpdates {
overallScore += wolf*wolf/81f;
overallScore += avgSkillLVL/20f;
+
+ int cata = profile.getDungeonCatacombsLevel(null);
+ EnumChatFormatting cataPrefix = cata>15?(cata>25?EnumChatFormatting.GREEN:EnumChatFormatting.YELLOW):EnumChatFormatting.RED;
+
Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(
- g+"Combat: "+combatPrefix+(int)Math.floor(combat) +g+" - AVG Skill: " + avgPrefix+(int)Math.floor(avgSkillLVL)));
+ g+"Combat: "+combatPrefix+(int)Math.floor(combat) +
+ (cata > 0 ? g+" - Cata: "+cataPrefix+cata : "")+
+ g+" - AVG: " + avgPrefix+(int)Math.floor(avgSkillLVL)));
Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(
g+"Slayer: "+zombiePrefix+(int)Math.floor(zombie)+g+"-"+
spiderPrefix+(int)Math.floor(spider)+g+"-"+wolfPrefix+(int)Math.floor(wolf)));
@@ -346,23 +352,17 @@ public class NotEnoughUpdates {
float bankBalance = Utils.getElementAsFloat(Utils.getElement(profileInfo, "banking.balance"), -1);
float purseBalance = Utils.getElementAsFloat(Utils.getElement(profileInfo, "coin_purse"), 0);
- EnumChatFormatting moneyPrefix = (bankBalance+purseBalance)>10*1000*1000?
- ((bankBalance+purseBalance)>50*1000*1000?EnumChatFormatting.GREEN:EnumChatFormatting.YELLOW):EnumChatFormatting.RED;
- Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(
- g+"Purse : "+moneyPrefix+Utils.shortNumberFormat(purseBalance, 0) + g+" - Bank: " +
- (bankBalance == -1 ? EnumChatFormatting.YELLOW+"Disabled" : moneyPrefix+
- (isMe?"4.8b":Utils.shortNumberFormat(bankBalance, 0)))));
-
long networth = profile.getNetWorth(null);
- if(networth > 0) {
- EnumChatFormatting moneyPrefix2 = networth>50*1000*1000?
- (networth>200*1000*1000?EnumChatFormatting.GREEN:EnumChatFormatting.YELLOW):EnumChatFormatting.RED;
- Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(
- g+"Networth : "+moneyPrefix2+Utils.shortNumberFormat(networth, 0)));
- }
- if(networth == -1) networth = (long)(bankBalance+purseBalance);
+ float money = Math.max(bankBalance+purseBalance, networth);
+ EnumChatFormatting moneyPrefix = money>50*1000*1000?
+ (money>200*1000*1000?EnumChatFormatting.GREEN:EnumChatFormatting.YELLOW):EnumChatFormatting.RED;
+ Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(
+ g+"Purse: "+moneyPrefix+Utils.shortNumberFormat(purseBalance, 0) + g+" - Bank: " +
+ (bankBalance == -1 ? EnumChatFormatting.YELLOW+"N/A" : moneyPrefix+
+ (isMe?"4.8b":Utils.shortNumberFormat(bankBalance, 0))) +
+ (networth > 0 ? g+" - Net: "+moneyPrefix+Utils.shortNumberFormat(networth, 0) : "")));
- overallScore += Math.min(2, networth/(100f*1000*1000));
+ overallScore += Math.min(2, money/(100f*1000*1000));
String activePet = Utils.getElementAsString(Utils.getElement(profile.getPetsInfo(null), "active_pet.type"),
"None Active");
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/TradeWindow.java b/src/main/java/io/github/moulberry/notenoughupdates/TradeWindow.java
index a046f939..1669d617 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/TradeWindow.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/TradeWindow.java
@@ -13,6 +13,7 @@ import net.minecraft.client.gui.inventory.GuiEditSign;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.inventory.ContainerChest;
import net.minecraft.inventory.Slot;
+import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompressedStreamTools;
import net.minecraft.nbt.NBTTagCompound;
@@ -98,6 +99,137 @@ public class TradeWindow {
new Color(64, 64, 64, 255).getRGB());
}
+ private static int processTopItems(ItemStack stack, Map<Integer, Set<String>> topItems,
+ Map<String, ItemStack> topItemsStack, Map<String, Integer> topItemsCount) {
+ String internalname = NotEnoughUpdates.INSTANCE.manager.getInternalNameForItem(stack);
+ if(internalname == null) {
+ if(stack.getDisplayName().endsWith(" coins")) {
+ String clean = Utils.cleanColour(stack.getDisplayName());
+
+ int mult = 1;
+ StringBuilder sb = new StringBuilder();
+ for(int index = 0; index < clean.length(); index++) {
+ char c = clean.charAt(index);
+ if("0123456789".indexOf(c) >= 0) {
+ sb.append(c);
+ } else {
+ switch(c) {
+ case 'k':
+ mult = 1000; break;
+ case 'm':
+ mult = 1000000; break;
+ case 'b':
+ mult = 1000000000; break;
+ default:
+ break;
+ }
+ break;
+ }
+ }
+ try {
+ int coins = Integer.parseInt(sb.toString())*mult;
+
+ topItemsStack.putIfAbsent("TRADE_COINS", stack);
+
+ int existingPrice = coins;
+ Set<Integer> toRemove = new HashSet<>();
+ for(Map.Entry<Integer, Set<String>> entry : topItems.entrySet()) {
+ if(entry.getValue().contains("TRADE_COINS")) {
+ entry.getValue().remove("TRADE_COINS");
+ existingPrice += entry.getKey();
+ }
+ if(entry.getValue().isEmpty()) toRemove.add(entry.getKey());
+ }
+ topItems.keySet().removeAll(toRemove);
+
+ Set<String> items = topItems.computeIfAbsent(existingPrice, k->new HashSet<>());
+ items.add("TRADE_COINS");
+
+ return coins;
+
+ } catch(Exception ignored) {}
+ }
+ } else {
+ JsonObject info = NotEnoughUpdates.INSTANCE.manager.auctionManager.getItemAuctionInfo(internalname);
+ int pricePer = -1;
+ if(info != null && !NotEnoughUpdates.INSTANCE.manager.auctionManager.isVanillaItem(internalname) &&
+ info.has("price") && info.has("count")) {
+ int auctionPricePer = (int)(info.get("price").getAsFloat() / info.get("count").getAsFloat());
+
+ pricePer = auctionPricePer;
+ } else {
+ JsonObject bazaarInfo = NotEnoughUpdates.INSTANCE.manager.auctionManager.getBazaarInfo(internalname);
+ if(bazaarInfo != null && bazaarInfo.has("avg_buy")) {
+ pricePer = (int)bazaarInfo.get("avg_buy").getAsFloat();
+ }
+ }
+ if(pricePer > 0) {
+ topItemsStack.putIfAbsent(internalname, stack);
+
+ int price = pricePer * stack.stackSize;
+ int priceInclBackpack = price;
+
+ NBTTagCompound tag = stack.getTagCompound();
+ if(tag != null && tag.hasKey("ExtraAttributes", 10)) {
+ NBTTagCompound ea = tag.getCompoundTag("ExtraAttributes");
+
+ byte[] bytes = null;
+ for (String key : ea.getKeySet()) {
+ if (key.endsWith("backpack_data") || key.equals("new_year_cake_bag_data")) {
+ bytes = ea.getByteArray(key);
+ break;
+ }
+ }
+ if(bytes != null) {
+ try {
+ NBTTagCompound contents_nbt = CompressedStreamTools.readCompressed(new ByteArrayInputStream(bytes));
+ NBTTagList items = contents_nbt.getTagList("i", 10);
+ for(int k=0; k<items.tagCount(); k++) {
+ if(items.getCompoundTagAt(k).getKeySet().size() > 0) {
+ NBTTagCompound nbt = items.getCompoundTagAt(k).getCompoundTag("tag");
+
+ int id2 = items.getCompoundTagAt(k).getShort("id");
+ int count2 = items.getCompoundTagAt(k).getByte("Count");
+ int damage2 = items.getCompoundTagAt(k).getShort("Damage");
+
+ if(id2 == 141) id2 = 391; //for some reason hypixel thinks carrots have id 141
+
+ Item mcItem = Item.getItemById(id2);
+ if(mcItem == null) continue;
+
+ ItemStack stack2 = new ItemStack(mcItem, count2, damage2);
+ stack2.setTagCompound(nbt);
+
+ priceInclBackpack += processTopItems(stack2, topItems, topItemsStack, topItemsCount);
+ }
+ }
+ } catch(Exception e) { }
+ }
+ }
+
+ int existingPrice = price;
+ Set<Integer> toRemove = new HashSet<>();
+ for(Map.Entry<Integer, Set<String>> entry : topItems.entrySet()) {
+ if(entry.getValue().contains(internalname)) {
+ entry.getValue().remove(internalname);
+ existingPrice += entry.getKey();
+ }
+ if(entry.getValue().isEmpty()) toRemove.add(entry.getKey());
+ }
+ topItems.keySet().removeAll(toRemove);
+
+ Set<String> items = topItems.computeIfAbsent(existingPrice, k->new HashSet<>());
+ items.add(internalname);
+
+ int count = topItemsCount.computeIfAbsent(internalname, l->0);
+ topItemsCount.put(internalname, count+stack.stackSize);
+
+ return priceInclBackpack;
+ }
+ }
+ return 0;
+ }
+
private static int getBackpackValue(ItemStack stack) {
int price = 0;
@@ -136,7 +268,6 @@ public class TradeWindow {
}
if(pricePer2 > 0) {
int count2 = items.getCompoundTagAt(k).getByte("Count");
- System.out.println("adding" + pricePer2*count2);
price += pricePer2 * count2;
}
}
@@ -180,8 +311,43 @@ public class TradeWindow {
String internalname = NotEnoughUpdates.INSTANCE.manager.getInternalNameForItem(stack);
if(internalname == null) {
- List<Integer> list = ourTradeMap.computeIfAbsent(-1, k -> new ArrayList<>());
- list.add(containerIndex);
+ if(stack.getDisplayName().endsWith(" coins")) {
+ String clean = Utils.cleanColour(stack.getDisplayName());
+
+ int mult = 1;
+ StringBuilder sb = new StringBuilder();
+ for(int index = 0; index < clean.length(); index++) {
+ char c = clean.charAt(index);
+ if("0123456789".indexOf(c) >= 0) {
+ sb.append(c);
+ } else {
+ switch(c) {
+ case 'k':
+ mult = 1000; break;
+ case 'm':
+ mult = 1000000; break;
+ case 'b':
+ mult = 1000000000; break;
+ default:
+ break;
+ }
+ break;
+ }
+ }
+ try {
+ int coins = Integer.parseInt(sb.toString())*mult;
+
+ List<Integer> list = ourTradeMap.computeIfAbsent(coins, k -> new ArrayList<>());
+ list.add(containerIndex);
+
+ } catch(Exception ignored) {
+ List<Integer> list = ourTradeMap.computeIfAbsent(-1, k -> new ArrayList<>());
+ list.add(containerIndex);
+ }
+ } else {
+ List<Integer> list = ourTradeMap.computeIfAbsent(-1, k -> new ArrayList<>());
+ list.add(containerIndex);
+ }
} else {
JsonObject info = NotEnoughUpdates.INSTANCE.manager.auctionManager.getItemAuctionInfo(internalname);
int price = -1;
@@ -205,6 +371,7 @@ public class TradeWindow {
long currentTime = System.currentTimeMillis();
List<String> theirTradeCurrent = new ArrayList<>();
TreeMap<Integer, List<Integer>> theirTradeMap = new TreeMap<>();
+ HashMap<String, Integer> displayCountMap = new HashMap<>();
for(int i=0; i<16; i++) {
theirTradeIndexes[i] = -1;
if(theirTradeChangesMillis[i] == null || currentTime - theirTradeChangesMillis[i] > CHANGE_EXCLAM_MILLIS) {
@@ -226,17 +393,56 @@ public class TradeWindow {
if (ea.hasKey("uuid", 8)) {
uuid = ea.getString("uuid");
} else {
- uuid = stack.getDisplayName();
+ int displayCount = displayCountMap.computeIfAbsent(stack.getDisplayName(), k->0);
+ uuid = stack.getDisplayName() + ":" + displayCount;
+ displayCountMap.put(stack.getDisplayName(), displayCount+1);
}
} else {
- uuid = stack.getDisplayName();
+ int displayCount = displayCountMap.computeIfAbsent(stack.getDisplayName(), k->0);
+ uuid = stack.getDisplayName() + ":" + displayCount;
+ displayCountMap.put(stack.getDisplayName(), displayCount+1);
}
if(uuid != null) theirTradeCurrent.add(uuid);
String internalname = NotEnoughUpdates.INSTANCE.manager.getInternalNameForItem(stack);
if(internalname == null) {
- List<Integer> list = theirTradeMap.computeIfAbsent(-1, k -> new ArrayList<>());
- list.add(containerIndex);
+ if(stack.getDisplayName().endsWith(" coins")) {
+ String clean = Utils.cleanColour(stack.getDisplayName());
+
+ int mult = 1;
+ StringBuilder sb = new StringBuilder();
+ for(int index = 0; index < clean.length(); index++) {
+ char c = clean.charAt(index);
+ if("0123456789".indexOf(c) >= 0) {
+ sb.append(c);
+ } else {
+ switch(c) {
+ case 'k':
+ mult = 1000; break;
+ case 'm':
+ mult = 1000000; break;
+ case 'b':
+ mult = 1000000000; break;
+ default:
+ break;
+ }
+ break;
+ }
+ }
+ try {
+ int coins = Integer.parseInt(sb.toString())*mult;
+
+ List<Integer> list = theirTradeMap.computeIfAbsent(coins, k -> new ArrayList<>());
+ list.add(containerIndex);
+
+ } catch(Exception ignored) {
+ List<Integer> list = theirTradeMap.computeIfAbsent(-1, k -> new ArrayList<>());
+ list.add(containerIndex);
+ }
+ } else {
+ List<Integer> list = theirTradeMap.computeIfAbsent(-1, k -> new ArrayList<>());
+ list.add(containerIndex);
+ }
} else {
JsonObject info = NotEnoughUpdates.INSTANCE.manager.auctionManager.getItemAuctionInfo(internalname);
int price = -1;
@@ -282,6 +488,7 @@ public class TradeWindow {
theirTradeOld[i] = null;
}
int theirTradeIndex = 0;
+ displayCountMap.clear();
j=0;
for(Map.Entry<Integer, List<Integer>> entry : theirTradeMap.descendingMap().entrySet()) {
for(Integer index : entry.getValue()) {
@@ -301,12 +508,16 @@ public class TradeWindow {
if (ea.hasKey("uuid", 8)) {
uuid = ea.getString("uuid");
} else {
- uuid = stack.getDisplayName();
+ int displayCount = displayCountMap.computeIfAbsent(stack.getDisplayName(), k->0);
+ uuid = stack.getDisplayName() + ":" + displayCount;
+ displayCountMap.put(stack.getDisplayName(), displayCount+1);
}
} else {
- uuid = stack.getDisplayName();
+ int displayCount = displayCountMap.computeIfAbsent(stack.getDisplayName(), k->0);
+ uuid = stack.getDisplayName() + ":" + displayCount;
+ displayCountMap.put(stack.getDisplayName(), displayCount+1);
}
- if(uuid != null) theirTradeCurrent.add(uuid);
+ //System.out.println(uuid);
theirTradeOld[theirTradeIndex] = uuid;
j++;
@@ -511,8 +722,9 @@ public class TradeWindow {
}
if(NotEnoughUpdates.INSTANCE.manager.config.customTradePrices.value) {
- int ourTopItemsCount = 0;
- TreeMap<Integer, Set<Integer>> ourTopItems = new TreeMap<>();
+ TreeMap<Integer, Set<String>> ourTopItems = new TreeMap<>();
+ TreeMap<String, ItemStack> ourTopItemsStack = new TreeMap<>();
+ TreeMap<String, Integer> ourTopItemsCount = new TreeMap<>();
int ourPrice = 0;
for(int i=0; i<16; i++) {
int x = i % 4;
@@ -522,37 +734,11 @@ public class TradeWindow {
ItemStack stack = chest.inventorySlots.getInventory().get(containerIndex);
if(stack == null) continue;
- String internalname = NotEnoughUpdates.INSTANCE.manager.getInternalNameForItem(stack);
- if(internalname != null) {
- if(NotEnoughUpdates.INSTANCE.manager.auctionManager.isVanillaItem(internalname)) continue;
-
- JsonObject info = NotEnoughUpdates.INSTANCE.manager.auctionManager.getItemAuctionInfo(internalname);
- int pricePer = -1;
- if(info != null && info.has("price") && info.has("count")) {
- int auctionPricePer = (int)(info.get("price").getAsFloat() / info.get("count").getAsFloat());
-
- pricePer = auctionPricePer * stack.stackSize;
- } else {
- JsonObject bazaarInfo = NotEnoughUpdates.INSTANCE.manager.auctionManager.getBazaarInfo(internalname);
- if(bazaarInfo != null && bazaarInfo.has("avg_buy")) {
- pricePer = (int)bazaarInfo.get("avg_buy").getAsFloat();
- }
- }
- if(pricePer > 0) {
- int price = pricePer * stack.stackSize;
-
- price += getBackpackValue(stack);
-
- Set<Integer> items = ourTopItems.computeIfAbsent(price, k->new HashSet<>());
- items.add(containerIndex);
-
- ourTopItemsCount++;
- ourPrice += price;
- }
- }
+ ourPrice += processTopItems(stack, ourTopItems, ourTopItemsStack, ourTopItemsCount);
}
- int theirTopItemsCount = 0;
- TreeMap<Integer, Set<Integer>> theirTopItems = new TreeMap<>();
+ TreeMap<Integer, Set<String>> theirTopItems = new TreeMap<>();
+ TreeMap<String, ItemStack> theirTopItemsStack = new TreeMap<>();
+ TreeMap<String, Integer> theirTopItemsCount = new TreeMap<>();
int theirPrice = 0;
for(int i=0; i<16; i++) {
int x = i % 4;
@@ -562,34 +748,7 @@ public class TradeWindow {
ItemStack stack = chest.inventorySlots.getInventory().get(containerIndex);
if(stack == null) continue;
- String internalname = NotEnoughUpdates.INSTANCE.manager.getInternalNameForItem(stack);
- if(internalname != null) {
- if(NotEnoughUpdates.INSTANCE.manager.auctionManager.isVanillaItem(internalname)) continue;
-
- JsonObject info = NotEnoughUpdates.INSTANCE.manager.auctionManager.getItemAuctionInfo(internalname);
- int pricePer = -1;
- if(info != null && info.has("price") && info.has("count")) {
- int auctionPricePer = (int)(info.get("price").getAsFloat() / info.get("count").getAsFloat());
-
- pricePer = auctionPricePer;
- } else {
- JsonObject bazaarInfo = NotEnoughUpdates.INSTANCE.manager.auctionManager.getBazaarInfo(internalname);
- if(bazaarInfo != null && bazaarInfo.has("avg_buy")) {
- pricePer = (int)bazaarInfo.get("avg_buy").getAsFloat();
- }
- }
- if(pricePer > 0) {
- int price = pricePer * stack.stackSize;
-
- price += getBackpackValue(stack);
-
- Set<Integer> items = theirTopItems.computeIfAbsent(price, k->new HashSet<>());
- items.add(containerIndex);
-
- theirTopItemsCount++;
- theirPrice += price;
- }
- }
+ theirPrice += processTopItems(stack, theirTopItems, theirTopItemsStack, theirTopItemsCount);
}
NumberFormat format = NumberFormat.getInstance(Locale.US);
@@ -604,15 +763,28 @@ public class TradeWindow {
drawStringShadow(EnumChatFormatting.GOLD.toString()+EnumChatFormatting.BOLD+format.format(ourPrice),
guiLeft-40-3, guiTop+21, 72);
- int ourTopIndex = Math.max(0, 3-ourTopItemsCount);
+ int ourTopIndex = Math.max(0, 3-ourTopItemsStack.size());
out:
- for(Map.Entry<Integer, Set<Integer>> entry : ourTopItems.descendingMap().entrySet()) {
- for(int ourTopItem : entry.getValue()) {
- ItemStack stack = chest.inventorySlots.getInventory().get(ourTopItem);
+ for(Map.Entry<Integer, Set<String>> entry : ourTopItems.descendingMap().entrySet()) {
+ for(String ourTopItemInternal : entry.getValue()) {
+ ItemStack stack = ourTopItemsStack.get(ourTopItemInternal);
if(stack == null) continue;
if(NotEnoughUpdates.INSTANCE.manager.config.customTradePriceStyle.value) {
- Utils.drawItemStack(stack, guiLeft-75-3, guiTop+49+18*ourTopIndex);
+ String countS = "";
+ if(ourTopItemsCount.containsKey(ourTopItemInternal)) {
+ int count = ourTopItemsCount.get(ourTopItemInternal);
+ if(count > 999999) {
+ countS = Math.floor(count/10000f)/100f+"m";
+ } else if(count > 999) {
+ countS = Math.floor(count/10f)/100f+"k";
+ } else {
+ countS = ""+count;
+ }
+ }
+
+ Utils.drawItemStackWithText(stack, guiLeft-75-3, guiTop+49+18*ourTopIndex, countS);
+
GlStateManager.disableLighting();
GlStateManager.disableBlend();
GlStateManager.color(1, 1, 1, 1);
@@ -620,7 +792,7 @@ public class TradeWindow {
guiLeft-29-3, guiTop+57+18*ourTopIndex, 52);
GlStateManager.enableBlend();
} else {
- drawStringShadow(stack.getDisplayName(),
+ drawStringShadow(stack.getDisplayName() + EnumChatFormatting.GRAY+"x"+ourTopItemsCount.get(ourTopItemInternal),
guiLeft-40-3, guiTop+46+20*ourTopIndex, 72);
drawStringShadow(EnumChatFormatting.GOLD.toString()+EnumChatFormatting.BOLD+format.format(entry.getKey()),
guiLeft-40-3, guiTop+56+20*ourTopIndex, 72);
@@ -639,15 +811,28 @@ public class TradeWindow {
drawStringShadow(EnumChatFormatting.GOLD.toString()+EnumChatFormatting.BOLD+format.format(theirPrice),
guiLeft+xSize+3+40, guiTop+21, 72);
- int theirTopIndex = Math.max(0, 3-theirTopItemsCount);
+ int theirTopIndex = Math.max(0, 3-theirTopItemsStack.size());
out:
- for(Map.Entry<Integer, Set<Integer>> entry : theirTopItems.descendingMap().entrySet()) {
- for(int theirTopItem : entry.getValue()) {
- ItemStack stack = chest.inventorySlots.getInventory().get(theirTopItem);
+ for(Map.Entry<Integer, Set<String>> entry : theirTopItems.descendingMap().entrySet()) {
+ for(String theirTopItemInternal : entry.getValue()) {
+ ItemStack stack = theirTopItemsStack.get(theirTopItemInternal);
if(stack == null) continue;
if(NotEnoughUpdates.INSTANCE.manager.config.customTradePriceStyle.value) {
- Utils.drawItemStack(stack, guiLeft+xSize+3+5, guiTop+49+18*theirTopIndex);
+ String countS = "";
+ if(theirTopItemsCount.containsKey(theirTopItemInternal)) {
+ int count = theirTopItemsCount.get(theirTopItemInternal);
+ if(count > 999999) {
+ countS = Math.floor(count/10000f)/100f+"m";
+ } else if(count > 999) {
+ countS = Math.floor(count/10f)/100f+"k";
+ } else {
+ countS = ""+count;
+ }
+ }
+
+ Utils.drawItemStackWithText(stack, guiLeft+xSize+25+3-16, guiTop+49+18*theirTopIndex, countS);
+
GlStateManager.disableLighting();
GlStateManager.disableBlend();
GlStateManager.color(1, 1, 1, 1);
@@ -844,6 +1029,4 @@ public class TradeWindow {
return Keyboard.getEventKey() != Keyboard.KEY_ESCAPE;
}
-
-
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/auction/APIManager.java b/src/main/java/io/github/moulberry/notenoughupdates/auction/APIManager.java
index dadcbd3f..82b33611 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/auction/APIManager.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/auction/APIManager.java
@@ -659,7 +659,8 @@ public class APIManager {
}
private static final List<String> hardcodedVanillaItems = Utils.createList(
- "WOOD_AXE", "WOOD_HOE", "WOOD_PICKAXE","WOOD_SPADE", "WOOD_SWORD"
+ "WOOD_AXE", "WOOD_HOE", "WOOD_PICKAXE","WOOD_SPADE", "WOOD_SWORD",
+ "GOLD_AXE", "GOLD_HOE", "GOLD_PICKAXE", "GOLD_SPADE", "GOLD_SWORD"
);
public boolean isVanillaItem(String internalname) {
if(hardcodedVanillaItems.contains(internalname)) return true;
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java
index 14966b2f..ae64c548 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java
@@ -1406,6 +1406,30 @@ public class GuiProfileViewer extends GuiScreen {
inventoryTextField.render(guiLeft+19, guiTop+sizeY-26-20);
+ if(armorItems == null) {
+ armorItems = new ItemStack[4];
+ JsonArray armor = Utils.getElement(inventoryInfo, "inv_armor").getAsJsonArray();
+ for(int i=0; i<armor.size(); i++) {
+ if(armor.get(i) == null || !armor.get(i).isJsonObject()) continue;
+ armorItems[i] = NotEnoughUpdates.INSTANCE.manager.jsonToStack(armor.get(i).getAsJsonObject(), false);
+ }
+ }
+
+ for(int i=0; i<armorItems.length; i++) {
+ ItemStack stack = armorItems[i];
+ if(stack != null) {
+ Utils.drawItemStack(stack, guiLeft+173, guiTop+67-18*i);
+ if(stack != fillerStack) {
+ if(mouseX >= guiLeft+173-1 && mouseX <= guiLeft+173+16+1) {
+ if(mouseY >= guiTop+67-18*i-1 && mouseY <= guiTop+67-18*i+16+1) {
+ tooltipToDisplay = stack.getTooltip(Minecraft.getMinecraft().thePlayer,
+ Minecraft.getMinecraft().gameSettings.advancedItemTooltips);
+ }
+ }
+ }
+ }
+ }
+
ItemStack[][][] inventories = getItemsForInventory(inventoryInfo, collectionInfo, selectedInventory);
if(currentInventoryIndex >= inventories.length) currentInventoryIndex = inventories.length-1;
if(currentInventoryIndex < 0) currentInventoryIndex = 0;
@@ -1448,29 +1472,6 @@ public class GuiProfileViewer extends GuiScreen {
}
}
- if(armorItems == null) {
- armorItems = new ItemStack[4];
- JsonArray armor = Utils.getElement(inventoryInfo, "inv_armor").getAsJsonArray();
- for(int i=0; i<armor.size(); i++) {
- if(armor.get(i) == null || !armor.get(i).isJsonObject()) continue;
- armorItems[i] = NotEnoughUpdates.INSTANCE.manager.jsonToStack(armor.get(i).getAsJsonObject(), false);
- }
- }
-
- for(int i=0; i<armorItems.length; i++) {
- ItemStack stack = armorItems[i];
- if(stack != null) {
- Utils.drawItemStack(stack, guiLeft+173, guiTop+67-18*i);
- if(stack != fillerStack) {
- if(mouseX >= guiLeft+173-1 && mouseX <= guiLeft+173+16+1) {
- if(mouseY >= guiTop+67-18*i-1 && mouseY <= guiTop+67-18*i+16+1) {
- tooltipToDisplay = stack.getTooltip(Minecraft.getMinecraft().thePlayer, false);
- }
- }
- }
- }
- }
-
if(arrowCount == -1) {
arrowCount = countItemsInInventory("ARROW", inventoryInfo, "quiver");
}
@@ -2002,6 +2003,11 @@ public class GuiProfileViewer extends GuiScreen {
}
}
+ long networth = profile.getNetWorth(profileId);
+ if(networth > 0) {
+ Utils.drawStringCentered(EnumChatFormatting.GREEN+"Net Worth: "+EnumChatFormatting.GOLD+numberFormat.format(networth), fr, guiLeft+63, guiTop+38, true, 0);
+ }
+
if(status != null) {
JsonElement onlineElement = Utils.getElement(status, "online");
boolean online = onlineElement != null && onlineElement.isJsonPrimitive() && onlineElement.getAsBoolean();
@@ -2172,6 +2178,39 @@ public class GuiProfileViewer extends GuiScreen {
guiLeft+172, guiTop+101+10, true, 0);
}
+ int cata = profile.getDungeonCatacombsLevel(profileId);
+
+ if(cata > 0) {
+ int yPosition = 3;
+ int xPosition = 1;
+
+ int x = guiLeft+237+86*xPosition;
+ int y = guiTop+31+21*yPosition;
+
+ renderAlignedString(EnumChatFormatting.GRAY+"Catacombs", EnumChatFormatting.WHITE.toString()+cata, x+14, y-4, 60);
+
+ renderBar(x, y+6, 80, cata/50f);
+
+ if(mouseX > x && mouseX < x+80) {
+ if(mouseY > y-4 && mouseY < y+13) {
+ String levelStr;
+ if(cata == 50) {
+ levelStr = EnumChatFormatting.GOLD+"MAXED!";
+ } else {
+ levelStr = EnumChatFormatting.DARK_PURPLE.toString() + cata + "/50";
+ }
+
+ tooltipToDisplay = Utils.createList(levelStr);
+ }
+ }
+
+ GL11.glTranslatef((x), (y-6f), 0);
+ GL11.glScalef(0.7f, 0.7f, 1);
+ Utils.drawItemStackLinear(new ItemStack(Item.getItemFromBlock(Blocks.deadbush)), 0, 0);
+ GL11.glScalef(1/0.7f, 1/0.7f, 1);
+ GL11.glTranslatef(-(x), -(y-6f), 0);
+ }
+
if(skillInfo != null) {
int position = 0;
for(Map.Entry<String, ItemStack> entry : ProfileViewer.getSkillToSkillDisplayMap().entrySet()) {
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java
index ea177804..b6a0ce06 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java
@@ -276,6 +276,7 @@ public class ProfileViewer {
private HashMap<String, PlayerStats.Stats> stats = new HashMap<>();
private HashMap<String, PlayerStats.Stats> passiveStats = new HashMap<>();
private long networth = -1;
+ private int dungeonCatacombsLevel = -1;
public Profile(String uuid) {
this.uuid = uuid;
@@ -306,6 +307,110 @@ public class ProfileViewer {
return null;
}
+ public int getDungeonCatacombsLevel(String profileId) {
+ if (dungeonCatacombsLevel != -1) return dungeonCatacombsLevel;
+ if (getInventoryInfo(profileId) == null) return -1;
+
+ JsonObject inventoryInfo = getInventoryInfo(profileId);
+
+ Pattern pattern = Pattern.compile("\\u00A77[A-Za-z ]+: \\u00A7[a-f0-9]\\+(\\d+).+\\u00A78\\(\\+?([0-9\\.]+)(%| HP)?\\)");
+
+ List<Float> nums = new ArrayList<>();
+
+ try {
+ for(Map.Entry<String, JsonElement> entry : inventoryInfo.entrySet()) {
+ if(entry.getValue().isJsonArray()) {
+ for(JsonElement element : entry.getValue().getAsJsonArray()) {
+ if(element != null && element.isJsonObject()) {
+ JsonObject item = element.getAsJsonObject();
+ String internalname = item.get("internalname").getAsString();
+
+ //TODO: Make sure item is a catacombs level (using internalname)
+
+ int dungeon_item_level = 0;
+ if(item.has("dungeon_item_level")) {
+ dungeon_item_level = item.get("dungeon_item_level").getAsInt();
+ }
+
+ if(item.has("lore") && item.get("lore").isJsonArray()) {
+ for(JsonElement lineElement : item.get("lore").getAsJsonArray()) {
+ if(lineElement.isJsonPrimitive()) {
+ String line = lineElement.getAsString();
+ Matcher matcher = pattern.matcher(line);
+ if(matcher.matches()) {
+ String num1S = matcher.group(1);
+ String num2S = matcher.group(2);
+
+ int num1 = Integer.parseInt(num1S);
+ float num2 = Float.parseFloat(num2S);
+
+ float bonus = num2/num1 - dungeon_item_level*0.1f;
+
+ if(bonus > 1) nums.add(bonus);
+ }
+ }
+ }
+ }
+
+ try {
+ if(item.has("item_contents")) {
+ JsonArray bytesArr = item.get("item_contents").getAsJsonArray();
+ byte[] bytes = new byte[bytesArr.size()];
+ for (int bytesArrI = 0; bytesArrI < bytesArr.size(); bytesArrI++) {
+ bytes[bytesArrI] = bytesArr.get(bytesArrI).getAsByte();
+ }
+ NBTTagCompound contents_nbt = CompressedStreamTools.readCompressed(new ByteArrayInputStream(bytes));
+ NBTTagList items = contents_nbt.getTagList("i", 10);
+ for(int j=0; j<items.tagCount(); j++) {
+ if(items.getCompoundTagAt(j).getKeySet().size() > 0) {
+ JsonObject item2 = manager.getJsonFromNBTEntry(items.getCompoundTagAt(j));
+
+ int dungeon_item_level2 = 0;
+ if(item2.has("dungeon_item_level")) {
+ dungeon_item_level2 = item2.get("dungeon_item_level").getAsInt();
+ }
+
+ if(item2.has("lore") && item2.get("lore").isJsonArray()) {
+ for(JsonElement lineElement : item2.get("lore").getAsJsonArray()) {
+ if(lineElement.isJsonPrimitive()) {
+ String line = lineElement.getAsString();
+ Matcher matcher = pattern.matcher(line);
+ if(matcher.matches()) {
+ String num1S = matcher.group(1);
+ String num2S = matcher.group(2);
+
+ int num1 = Integer.parseInt(num1S);
+ float num2 = Float.parseFloat(num2S);
+
+ float bonus = num2/num1 - dungeon_item_level2*0.1f;
+
+ if(bonus > 1) nums.add(bonus);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ } catch(IOException ignored) {}
+ }
+ }
+ }
+ }
+ } catch(Exception ignored) {}
+
+ if(nums.size() > 0) {
+ nums.sort(Comparator.naturalOrder());
+ int bonus = -100+Math.round(100*nums.get(nums.size()/2));
+ dungeonCatacombsLevel = 0;
+ while(bonus > 0) {
+ dungeonCatacombsLevel++;
+ bonus -= 3+Math.ceil(dungeonCatacombsLevel/5f);
+ }
+ }
+ return dungeonCatacombsLevel;
+ }
+
public long getNetWorth(String profileId) {
if(networth != -1) return networth;
if(getProfileInformation(profileId) == null) return -1;
@@ -542,6 +647,7 @@ public class ProfileViewer {
inventoryInfoMap.clear();
collectionInfoMap.clear();
networth = -1;
+ dungeonCatacombsLevel = -1;
}
private class Level {