aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal002@users.noreply.github.com>2023-05-31 13:06:27 +0200
committerGitHub <noreply@github.com>2023-05-31 13:06:27 +0200
commit744e7692843c65049e45f666973e1e37adcc7e9a (patch)
treeba31e4ff5a685f74455102209e1b127ed520cc9f /src/main/java/io
parentb40c37b653ba43d9603c578c440092c9f464935f (diff)
downloadNotEnoughUpdates-744e7692843c65049e45f666973e1e37adcc7e9a.tar.gz
NotEnoughUpdates-744e7692843c65049e45f666973e1e37adcc7e9a.tar.bz2
NotEnoughUpdates-744e7692843c65049e45f666973e1e37adcc7e9a.zip
Removing the neu AH (#627)
* Removed the neu ah. * make compile * make command say its removed * just what i wanted, an empty file --------- Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Co-authored-by: nopo <nopotheemail@gmail.com>
Diffstat (limited to 'src/main/java/io')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java4
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/auction/APIManager.java790
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/auction/CustomAH.java2001
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/auction/CustomAHGui.java32
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/listener/ChatListener.java8
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/listener/NEUEventListener.java4
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/listener/RenderListener.java68
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/mbgui/MBGuiGroupFloating.java14
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java12
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/NeuAuctionHouse.java73
10 files changed, 29 insertions, 2977 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java
index 000158a4..c6f0785d 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java
@@ -23,7 +23,6 @@ import com.google.common.collect.Lists;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
-import io.github.moulberry.notenoughupdates.auction.CustomAHGui;
import io.github.moulberry.notenoughupdates.core.BackgroundBlur;
import io.github.moulberry.notenoughupdates.core.GuiScreenElementWrapper;
import io.github.moulberry.notenoughupdates.core.util.lerp.LerpingInteger;
@@ -1567,9 +1566,6 @@ public class NEUOverlay extends Gui {
public float getWidthMult() {
float scaleFMult = 1;
if (Utils.peekGuiScale().getScaleFactor() == 4) scaleFMult *= 0.9f;
- if (manager.auctionManager.customAH.isRenderOverAuctionView() ||
- Minecraft.getMinecraft().currentScreen instanceof CustomAHGui)
- scaleFMult *= 0.8f;
return (float) Math.max(0.5, Math.min(1.5, NotEnoughUpdates.INSTANCE.config.itemlist.paneWidthMult)) * scaleFMult;
}
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 1faac488..58d8c23b 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/auction/APIManager.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/auction/APIManager.java
@@ -19,59 +19,29 @@
package io.github.moulberry.notenoughupdates.auction;
-import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import io.github.moulberry.notenoughupdates.ItemPriceInformation;
import io.github.moulberry.notenoughupdates.NEUManager;
-import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
import io.github.moulberry.notenoughupdates.miscgui.pricegraph.LocalGraphDataProvider;
import io.github.moulberry.notenoughupdates.recipes.Ingredient;
import io.github.moulberry.notenoughupdates.recipes.ItemShopRecipe;
import io.github.moulberry.notenoughupdates.recipes.NeuRecipe;
-import io.github.moulberry.notenoughupdates.util.Constants;
import io.github.moulberry.notenoughupdates.util.Utils;
-import net.minecraft.client.Minecraft;
-import net.minecraft.event.ClickEvent;
-import net.minecraft.event.HoverEvent;
import net.minecraft.item.Item;
-import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.CompressedStreamTools;
-import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.nbt.NBTTagList;
-import net.minecraft.nbt.NBTTagString;
-import net.minecraft.util.ChatComponentText;
-import net.minecraft.util.ChatStyle;
-import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.ResourceLocation;
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.util.Base64;
-import java.util.ConcurrentModificationException;
import java.util.HashMap;
import java.util.HashSet;
-import java.util.LinkedList;
import java.util.List;
import java.util.Map;
-import java.util.NoSuchElementException;
import java.util.Set;
-import java.util.TreeMap;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.function.Consumer;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class APIManager {
private final NEUManager manager;
- public final CustomAH customAH;
- private final TreeMap<String, Auction> auctionMap = new TreeMap<>();
- public HashMap<String, HashSet<String>> internalnameToAucIdMap = new HashMap<>();
- private final HashSet<String> playerBids = new HashSet<>();
- private final HashSet<String> playerBidsNotified = new HashSet<>();
- private final HashSet<String> playerBidsFinishedNotified = new HashSet<>();
private final int LOWEST_BIN_UPDATE_INTERVAL = 2 * 60 * 1000; // 2 minutes
private final int AUCTION_AVG_UPDATE_INTERVAL = 5 * 60 * 1000; // 5 minutes
private final int BAZAAR_UPDATE_INTERVAL = 5 * 60 * 1000; // 5 minutes
@@ -79,165 +49,21 @@ public class APIManager {
private JsonObject lowestBins = null;
private JsonObject auctionPricesAvgLowestBinJson = null;
- private LinkedList<Integer> pagesToDownload = null;
-
private JsonObject bazaarJson = null;
private JsonObject auctionPricesJson = null;
private final HashMap<String, CraftInfo> craftCost = new HashMap<>();
- public TreeMap<String, HashMap<Integer, HashSet<String>>> extrasToAucIdMap = new TreeMap<>();
-
private boolean didFirstUpdate = false;
- private long lastAuctionUpdate = 0;
- private long lastShortAuctionUpdate = 0;
- private long lastCustomAHSearch = 0;
- private long lastCleanup = 0;
private long lastAuctionAvgUpdate = 0;
private long lastBazaarUpdate = 0;
private long lastLowestBinUpdate = 0;
- private long lastApiUpdate = 0;
- private long firstHypixelApiUpdate = 0;
-
- public int activeAuctions = 0;
- public int uniqueItems = 0;
- public int totalTags = 0;
- public int internalnameTaggedAuctions = 0;
- public int taggedAuctions = 0;
- public int processMillis = 0;
-
public APIManager(NEUManager manager) {
this.manager = manager;
- customAH = new CustomAH(manager);
- }
-
- public TreeMap<String, Auction> getAuctionItems() {
- return auctionMap;
- }
-
- public HashSet<String> getPlayerBids() {
- return playerBids;
- }
-
- public HashSet<String> getAuctionsForInternalname(String internalname) {
- return internalnameToAucIdMap.computeIfAbsent(internalname, k -> new HashSet<>());
- }
-
- public class Auction {
- public String auctioneerUuid;
- public long end;
- public long starting_bid;
- public int highest_bid_amount;
- public int bid_count;
- public boolean bin;
- public String category;
- public String rarity;
- public int dungeonTier;
- public String item_tag_str;
- public NBTTagCompound item_tag = null;
- private ItemStack stack;
-
- public int enchLevel = 0; //0 = clean, 1 = ench, 2 = ench/hpb
-
- public Auction(
- String auctioneerUuid, long end, long starting_bid, int highest_bid_amount, int bid_count,
- boolean bin, String category, String rarity, int dungeonTier, String item_tag_str
- ) {
- this.auctioneerUuid = auctioneerUuid;
- this.end = end;
- this.starting_bid = starting_bid;
- this.highest_bid_amount = highest_bid_amount;
- this.bid_count = bid_count;
- this.bin = bin;
- this.category = category;
- this.dungeonTier = dungeonTier;
- this.rarity = rarity;
- this.item_tag_str = item_tag_str;
- }
-
- public ItemStack getStack() {
- if (item_tag == null && item_tag_str != null) {
- try {
- item_tag = CompressedStreamTools.readCompressed(
- new ByteArrayInputStream(Base64.getDecoder().decode(item_tag_str)));
- item_tag_str = null;
- } catch (IOException e) {
- return null;
- }
- }
- if (stack != null) {
- return stack;
- } else {
- JsonObject item = manager.getJsonFromNBT(item_tag);
- if (item == null) return null;
- ItemStack stack = manager.jsonToStack(item, false);
-
- JsonObject itemDefault = manager.getItemInformation().get(item.get("internalname").getAsString());
-
- if (stack != null && itemDefault != null) {
- ItemStack stackDefault = manager.jsonToStack(itemDefault, true);
- if (stack.isItemEqual(stackDefault)) {
- //Item types are the same, compare lore
-
- String[] stackLore = manager.getLoreFromNBT(stack.getTagCompound());
- String[] defaultLore = manager.getLoreFromNBT(stackDefault.getTagCompound());
-
- boolean loreMatches = stackLore != null && defaultLore != null && stackLore.length == defaultLore.length;
- if (loreMatches) {
- for (int i = 0; i < stackLore.length; i++) {
- if (!stackLore[i].equals(defaultLore[i])) {
- loreMatches = false;
- break;
- }
- }
- }
- if (loreMatches) {
- stack = stackDefault;
- }
- }
- }
- this.stack = stack;
- return stack;
- }
- }
- }
-
- public void markNeedsUpdate() {
- firstHypixelApiUpdate = 0;
- pagesToDownload = null;
-
- auctionMap.clear();
- internalnameToAucIdMap.clear();
- extrasToAucIdMap.clear();
}
public void tick() {
- customAH.tick();
long currentTime = System.currentTimeMillis();
- if (NotEnoughUpdates.INSTANCE.config.neuAuctionHouse.enableNeuAuctionHouse &&
- NotEnoughUpdates.INSTANCE.config.apiData.apiKey != null &&
- !NotEnoughUpdates.INSTANCE.config.apiData.apiKey.isEmpty()) {
- if (currentTime - lastAuctionUpdate > 60 * 1000) {
- lastAuctionUpdate = currentTime;
- updatePageTick();
- }
- if (currentTime - lastShortAuctionUpdate > 10 * 1000) {
- lastShortAuctionUpdate = currentTime;
- updatePageTickShort();
- ahNotification();
- }
- if (currentTime - lastCleanup > 60 * 1000) {
- lastCleanup = currentTime;
- cleanup();
- }
- if (currentTime - lastCustomAHSearch > 60 * 1000) {
- lastCustomAHSearch = currentTime;
- if (Minecraft.getMinecraft().currentScreen instanceof CustomAHGui || customAH.isRenderOverAuctionView()) {
- customAH.updateSearch();
- calculateStats();
- }
- }
- }
if (currentTime - lastAuctionAvgUpdate > AUCTION_AVG_UPDATE_INTERVAL) {
lastAuctionAvgUpdate = currentTime - AUCTION_AVG_UPDATE_INTERVAL + 60 * 1000; // Try again in 1 minute on failure
updateAvgPrices();
@@ -252,22 +78,6 @@ public class APIManager {
}
}
- private String niceAucId(String aucId) {
- if (aucId.length() != 32) return aucId;
-
- StringBuilder niceAucId = new StringBuilder();
- niceAucId.append(aucId, 0, 8);
- niceAucId.append("-");
- niceAucId.append(aucId, 8, 12);
- niceAucId.append("-");
- niceAucId.append(aucId, 12, 16);
- niceAucId.append("-");
- niceAucId.append(aucId, 16, 20);
- niceAucId.append("-");
- niceAucId.append(aucId, 20, 32);
- return niceAucId.toString();
- }
-
public Set<String> getLowestBinKeySet() {
if (lowestBins == null) return new HashSet<>();
HashSet<String> keys = new HashSet<>();
@@ -310,415 +120,10 @@ public class APIManager {
});
}
- private void ahNotification() {
- playerBidsNotified.retainAll(playerBids);
- playerBidsFinishedNotified.retainAll(playerBids);
- if (NotEnoughUpdates.INSTANCE.config.neuAuctionHouse.ahNotification <= 0) {
- return;
- }
- for (String aucid : playerBids) {
- Auction auc = auctionMap.get(aucid);
- if (!playerBidsNotified.contains(aucid)) {
- if (auc != null &&
- auc.end - System.currentTimeMillis() <
- 1000 * 60 * NotEnoughUpdates.INSTANCE.config.neuAuctionHouse.ahNotification) {
- ChatComponentText message = new ChatComponentText(
- EnumChatFormatting.YELLOW +
- "The " +
- auc.getStack().getDisplayName() +
- EnumChatFormatting.YELLOW +
- " you have bid on is ending soon! Click here to view.");
- ChatStyle clickEvent = new ChatStyle().setChatClickEvent(
- new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/viewauction " + niceAucId(aucid)));
- clickEvent.setChatHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ChatComponentText(
- EnumChatFormatting.YELLOW +
- "View auction")));
- message.setChatStyle(clickEvent);
- Minecraft.getMinecraft().thePlayer.addChatMessage(message);
-
- playerBidsNotified.add(aucid);
- }
- }
- if (!playerBidsFinishedNotified.contains(aucid)) {
- if (auc != null && auc.end < System.currentTimeMillis()) {
- ChatComponentText message = new ChatComponentText(
- EnumChatFormatting.YELLOW +
- "The " +
- auc.getStack().getDisplayName() +
- EnumChatFormatting.YELLOW +
- " you have bid on (might) have ended! Click here to view.");
- ChatStyle clickEvent = new ChatStyle().setChatClickEvent(
- new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/viewauction " + niceAucId(aucid)));
- clickEvent.setChatHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ChatComponentText(
- EnumChatFormatting.YELLOW +
- "View auction")));
- message.setChatStyle(clickEvent);
- Minecraft.getMinecraft().thePlayer.addChatMessage(message);
-
- playerBidsFinishedNotified.add(aucid);
- }
- }
- }
- }
-
public long getLastLowestBinUpdateTime() {
return lastLowestBinUpdate;
}
- private final ExecutorService es = Executors.newSingleThreadExecutor();
-
- private void cleanup() {
- es.submit(() -> {
- try {
- long currTime = System.currentTimeMillis();
- Set<String> toRemove = new HashSet<>();
- for (Map.Entry<String, Auction> entry : auctionMap.entrySet()) {
- long timeToEnd = entry.getValue().end - currTime;
- if (timeToEnd < -120 * 1000) { //2 minutes
- toRemove.add(entry.getKey());
- }
- }
- toRemove.removeAll(playerBids);
- remove(toRemove);
- } catch (ConcurrentModificationException e) {
- lastCleanup = System.currentTimeMillis() - 110 * 1000;
- }
- });
- }
-
- private void remove(Set<String> toRemove) {
- for (String aucid : toRemove) {
- auctionMap.remove(aucid);
- }
- for (HashMap<Integer, HashSet<String>> extrasMap : extrasToAucIdMap.values()) {
- for (HashSet<String> aucids : extrasMap.values()) {
- for (String aucid : toRemove) {
- aucids.remove(aucid);
- }
- }
- }
- for (HashSet<String> aucids : internalnameToAucIdMap.values()) {
- aucids.removeAll(toRemove);
- }
- }
-
- private void updatePageTickShort() {
- if (pagesToDownload == null || pagesToDownload.isEmpty()) return;
-
- if (firstHypixelApiUpdate == 0 || (System.currentTimeMillis() - firstHypixelApiUpdate) % (60 * 1000) > 15 * 1000)
- return;
-
- JsonObject disable = Constants.DISABLE;
- if (disable != null && disable.has("auctions_new") && disable.get("auctions_new").getAsBoolean()) return;
-
- while (!pagesToDownload.isEmpty()) {
- try {
- int page = pagesToDownload.pop();
- getPageFromAPI(page);
- } catch (NoSuchElementException ignored) {
- return;
- } //Weird race condition?
- }
- }
-
- private void updatePageTick() {
- JsonObject disable = Constants.DISABLE;
- if (disable != null && disable.has("auctions_new") && disable.get("auctions_new").getAsBoolean()) return;
-
- if (pagesToDownload == null) {
- getPageFromAPI(0);
- }
-
- Consumer<JsonObject> process = jsonObject -> {
- if (jsonObject.get("success").getAsBoolean()) {
- JsonArray new_auctions = jsonObject.get("new_auctions").getAsJsonArray();
- for (JsonElement auctionElement : new_auctions) {
- JsonObject auction = auctionElement.getAsJsonObject();
- //System.out.println("New auction " + auction);
- processAuction(auction);
- }
- JsonArray new_bids = jsonObject.get("new_bids").getAsJsonArray();
- for (JsonElement newBidElement : new_bids) {
- JsonObject newBid = newBidElement.getAsJsonObject();
- String newBidUUID = newBid.get("uuid").getAsString();
- //System.out.println("new bid" + newBidUUID);
- int newBidAmount = newBid.get("highest_bid_amount").getAsInt();
- int end = newBid.get("end").getAsInt();
- int bid_count = newBid.get("bid_count").getAsInt();
-
- Auction auc = auctionMap.get(newBidUUID);
- if (auc != null) {
- //System.out.println("Setting auction " + newBidUUID + " price to " + newBidAmount);
- auc.highest_bid_amount = newBidAmount;
- auc.end = end;
- auc.bid_count = bid_count;
- }
- }
- Set<String> toRemove = new HashSet<>();
- JsonArray removed_auctions = jsonObject.get("removed_auctions").getAsJsonArray();
- for (JsonElement removedAuctionsElement : removed_auctions) {
- String removed = removedAuctionsElement.getAsString();
- toRemove.add(removed);
- }
- remove(toRemove);
- }
- };
-
- manager.apiUtils.newMoulberryRequest("auctionLast.json.gz")
- .gunzip().requestJson().thenAcceptAsync(process);
-
- manager.apiUtils
- .newMoulberryRequest("auction.json.gz")
- .gunzip().requestJson()
- .thenAcceptAsync(jsonObject -> {
- if (jsonObject.get("success").getAsBoolean()) {
- long apiUpdate = (long) jsonObject.get("time").getAsFloat();
- if (lastApiUpdate == apiUpdate) {
- lastAuctionUpdate -= 30 * 1000;
- }
- lastApiUpdate = apiUpdate;
-
- process.accept(jsonObject);
- }
- });
-
- }
-
- public void calculateStats() {
- try {
- uniqueItems = internalnameToAucIdMap.size();
- Set<String> aucs = new HashSet<>();
- for (HashSet<String> aucids : internalnameToAucIdMap.values()) {
- aucs.addAll(aucids);
- }
- internalnameTaggedAuctions = aucs.size();
- totalTags = extrasToAucIdMap.size();
- aucs = new HashSet<>();
- for (HashMap<Integer, HashSet<String>> extrasMap : extrasToAucIdMap.values()) {
- for (HashSet<String> aucids : extrasMap.values()) {
- aucs.addAll(aucids);
- }
- }
- taggedAuctions = aucs.size();
- } catch (Exception ignored) {
- }
- }
-
- //String[] rarityArr = new String[] {
- // "COMMON", "UNCOMMON", "RARE", "EPIC", "LEGENDARY", "MYTHIC", "SPECIAL", "VERY SPECIAL", "SUPREME",
- //};
-
- public int checkItemType(String lore, boolean contains, String... typeMatches) {
- String[] split = lore.split("\n");
- for (int i = split.length - 1; i >= 0; i--) {
- String line = split[i];
- for (String rarity : Utils.rarityArr) {
- for (int j = 0; j < typeMatches.length; j++) {
- if (contains) {
- if (line.trim().contains(rarity + " " + typeMatches[j])) {
- return j;
- } else if (line.trim().contains(rarity + " DUNGEON " + typeMatches[j])) {
- return j;
- }
- } else {
- if (line.trim().endsWith(rarity + " " + typeMatches[j])) {
- return j;
- } else if (line.trim().endsWith(rarity + " DUNGEON " + typeMatches[j])) {
- return j;
- }
- }
- }
- }
- }
- return -1;
- }
-
- private final String[] romans = new String[]{
- "I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX", "X", "XI",
- "XII", "XIII", "XIV", "XV", "XVI", "XVII", "XIX", "XX"
- };
-
- String[] categoryItemType = new String[]{
- "sword", "fishingrod", "pickaxe", "axe",
- "shovel", "petitem", "travelscroll", "reforgestone", "bow"
- };
- String playerUUID = null;
-
- private void processAuction(JsonObject auction) {
- if (playerUUID == null)
- playerUUID = Minecraft.getMinecraft().thePlayer.getUniqueID().toString().replaceAll("-", "");
-
- String auctionUuid = auction.get("uuid").getAsString();
- String auctioneerUuid = auction.get("auctioneer").getAsString();
- long end = auction.get("end").getAsLong();
- long starting_bid = auction.get("starting_bid").getAsLong();
- int highest_bid_amount = auction.get("highest_bid_amount").getAsInt();
- int bid_count = auction.get("bids").getAsJsonArray().size();
- boolean bin = false;
- if (auction.has("bin")) {
- bin = auction.get("bin").getAsBoolean();
- }
- String sbCategory = auction.get("category").getAsString();
- String extras = auction.get("extra").getAsString().toLowerCase();
- String item_name = auction.get("item_name").getAsString();
- String item_lore = Utils.fixBrokenAPIColour(auction.get("item_lore").getAsString());
- String item_bytes = auction.get("item_bytes").getAsString();
- String rarity = auction.get("tier").getAsString();
- JsonArray bids = auction.get("bids").getAsJsonArray();
-
- try {
- NBTTagCompound item_tag;
- try {
- item_tag = CompressedStreamTools.readCompressed(
- new ByteArrayInputStream(Base64.getDecoder().decode(item_bytes)));
- } catch (IOException e) {
- return;
- }
-
- NBTTagCompound tag = item_tag.getTagList("i", 10).getCompoundTagAt(0).getCompoundTag("tag");
- String internalname = manager.getInternalnameFromNBT(tag);
-
- NBTTagCompound display = tag.getCompoundTag("display");
- if (display.hasKey("Lore", 9)) {
- NBTTagList loreList = new NBTTagList();
- for (String line : item_lore.split("\n")) {
- loreList.appendTag(new NBTTagString(line));
- }
- display.setTag("Lore", loreList);
- }
- tag.setTag("display", display);
- item_tag.getTagList("i", 10).getCompoundTagAt(0).setTag("tag", tag);
-
- if (tag.hasKey("ExtraAttributes", 10)) {
- NBTTagCompound ea = tag.getCompoundTag("ExtraAttributes");
-
- if (ea.hasKey("enchantments", 10)) {
- NBTTagCompound enchantments = ea.getCompoundTag("enchantments");
- for (String key : enchantments.getKeySet()) {
- String enchantname = key.toLowerCase().replace("ultimate_", "").replace("_", " ");
- int enchantlevel = enchantments.getInteger(key);
- String enchantLevelStr;
- if (enchantlevel >= 1 && enchantlevel <= 20) {
- enchantLevelStr = romans[enchantlevel - 1];
- } else {
- enchantLevelStr = String.valueOf(enchantlevel);
- }
- extras = extras.replace(enchantname, enchantname + " " + enchantLevelStr);
- }
- }
- }
-
- int index = 0;
- for (String str : extras.split(" ")) {
- str = Utils.cleanColour(str).toLowerCase();
- if (str.length() > 0) {
- HashMap<Integer, HashSet<String>> extrasMap = extrasToAucIdMap.computeIfAbsent(str, k -> new HashMap<>());
- HashSet<String> aucids = extrasMap.computeIfAbsent(index, k -> new HashSet<>());
- aucids.add(auctionUuid);
- }
- index++;
- }
-
- for (int j = 0; j < bids.size(); j++) {
- JsonObject bid = bids.get(j).getAsJsonObject();
- if (bid.get("bidder").getAsString().equalsIgnoreCase(playerUUID)) {
- playerBids.add(auctionUuid);
- }
- }
-
- int dungeonTier = -1;
- if (checkItemType(item_lore, true, "DUNGEON") >= 0) {
- dungeonTier = 0;
- for (int i = 0; i < item_name.length(); i++) {
- char c = item_name.charAt(i);
- if (c == 0x272A) {
- dungeonTier++;
- }
- }
- }
-
- //Categories
- String category = sbCategory;
- int itemType = checkItemType(item_lore, true, "SWORD", "FISHING ROD", "PICKAXE",
- "AXE", "SHOVEL", "PET ITEM", "TRAVEL SCROLL", "REFORGE STONE", "BOW"
- );
- if (itemType >= 0 && itemType < categoryItemType.length) {
- category = categoryItemType[itemType];
- }
- if (category.equals("consumables") && extras.contains("enchanted book")) category = "ebook";
- if (category.equals("consumables") && extras.endsWith("potion")) category = "potion";
- if (category.equals("misc") && extras.contains("rune")) category = "rune";
- if (category.equals("misc") && item_lore.split("\n")[0].endsWith("Furniture")) category = "furniture";
- if (item_lore.split("\n")[0].endsWith("Pet") ||
- item_lore.split("\n")[0].endsWith("Mount")) category = "pet";
-
- Auction auction1 = new Auction(auctioneerUuid, end, starting_bid, highest_bid_amount,
- bid_count, bin, category, rarity, dungeonTier, item_bytes
- );
-
- if (tag.hasKey("ench")) {
- auction1.enchLevel = 1;
- if (tag.hasKey("ExtraAttributes", 10)) {
- NBTTagCompound ea = tag.getCompoundTag("ExtraAttributes");
-
- int hotpotatocount = ea.getInteger("hot_potato_count");
- if (hotpotatocount == 10) {
- auction1.enchLevel = 2;
- }
- }
- }
-
- auctionMap.put(auctionUuid, auction1);
- internalnameToAucIdMap.computeIfAbsent(internalname, k -> new HashSet<>()).add(auctionUuid);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- private void getPageFromAPI(int page) {
- //System.out.println("downloading page:"+page);
- //System.out.println("Trying to update page: " + page);
- HashMap<String, String> args = new HashMap<>();
- args.put("page", "" + page);
- manager.apiUtils
- .newAnonymousHypixelApiRequest("skyblock/auctions")
- .requestJson()
- .thenAcceptAsync(jsonObject -> {
- if (jsonObject == null) return;
-
- if (jsonObject.get("success").getAsBoolean()) {
- if (pagesToDownload == null) {
- int totalPages = jsonObject.get("totalPages").getAsInt();
- pagesToDownload = new LinkedList<>();
- for (int i = 0; i < totalPages + 2; i++) {
- pagesToDownload.add(i);
- }
- }
- if (firstHypixelApiUpdate == 0) {
- firstHypixelApiUpdate = jsonObject.get("lastUpdated").getAsLong();
- }
- activeAuctions = jsonObject.get("totalAuctions").getAsInt();
-
- long startProcess = System.currentTimeMillis();
- JsonArray auctions = jsonObject.get("auctions").getAsJsonArray();
- for (int i = 0; i < auctions.size(); i++) {
- JsonObject auction = auctions.get(i).getAsJsonObject();
-
- processAuction(auction);
- }
- processMillis = (int) (System.currentTimeMillis() - startProcess);
- } else {
- pagesToDownload.addLast(page);
- }
- })
- .handle((ignored, ex) -> {
- if (ex != null) {
- pagesToDownload.addLast(page);
- }
- return null;
- });
- }
-
private static final Pattern BAZAAR_ENCHANTMENT_PATTERN = Pattern.compile("ENCHANTMENT_(\\D*)_(\\d+)");
public String transformHypixelBazaarToNEUItemId(String hypixelId) {
@@ -872,11 +277,11 @@ public class APIManager {
"ROOKIE_HOE"
);
- public boolean isVanillaItem(String internalname) {
- if (hardcodedVanillaItems.contains(internalname)) return true;
+ public boolean isVanillaItem(String internalName) {
+ if (hardcodedVanillaItems.contains(internalName)) return true;
//Removes trailing numbers and underscores, eg. LEAVES_2-3 -> LEAVES
- String vanillaName = internalname.split("-")[0];
+ String vanillaName = internalName.split("-")[0];
if (manager.getItemInformation().containsKey(vanillaName)) {
JsonObject json = manager.getItemInformation().get(vanillaName);
if (json != null && json.has("vanilla") && json.get("vanilla").getAsBoolean()) return true;
@@ -890,24 +295,24 @@ public class APIManager {
public double craftCost = -1;
}
- public CraftInfo getCraftCost(String internalname) {
- return getCraftCost(internalname, new HashSet<>());
+ public CraftInfo getCraftCost(String internalName) {
+ return getCraftCost(internalName, new HashSet<>());
}
/**
* Recursively calculates the cost of crafting an item from raw materials.
*/
- private CraftInfo getCraftCost(String internalname, Set<String> visited) {
- if (craftCost.containsKey(internalname)) return craftCost.get(internalname);
- if (visited.contains(internalname)) return null;
- visited.add(internalname);
+ private CraftInfo getCraftCost(String internalName, Set<String> visited) {
+ if (craftCost.containsKey(internalName)) return craftCost.get(internalName);
+ if (visited.contains(internalName)) return null;
+ visited.add(internalName);
- boolean vanillaItem = isVanillaItem(internalname);
+ boolean vanillaItem = isVanillaItem(internalName);
double craftCost = Double.POSITIVE_INFINITY;
- JsonObject auctionInfo = getItemAuctionInfo(internalname);
- double lowestBin = getLowestBin(internalname);
- JsonObject bazaarInfo = getBazaarInfo(internalname);
+ JsonObject auctionInfo = getItemAuctionInfo(internalName);
+ double lowestBin = getLowestBin(internalName);
+ JsonObject bazaarInfo = getBazaarInfo(internalName);
if (bazaarInfo != null && bazaarInfo.get("curr_buy") != null) {
craftCost = bazaarInfo.get("curr_buy").getAsFloat();
@@ -922,7 +327,7 @@ public class APIManager {
}
}
- Set<NeuRecipe> recipes = manager.getRecipesFor(internalname);
+ Set<NeuRecipe> recipes = manager.getRecipesFor(internalName);
boolean fromRecipe = false;
if (recipes != null)
RECIPE_ITER:
@@ -946,7 +351,7 @@ public class APIManager {
}
int resultCount = 0;
for (Ingredient item : recipe.getOutputs())
- if (item.getInternalItemId().equals(internalname))
+ if (item.getInternalItemId().equals(internalName))
resultCount += item.getCount();
if (resultCount == 0)
@@ -957,7 +362,7 @@ public class APIManager {
craftCost = craftPricePer;
}
}
- visited.remove(internalname);
+ visited.remove(internalName);
if (Double.isInfinite(craftCost)) {
return null;
}
@@ -965,168 +370,7 @@ public class APIManager {
craftInfo.vanillaItem = vanillaItem;
craftInfo.craftCost = craftCost;
craftInfo.fromRecipe = fromRecipe;
- this.craftCost.put(internalname, craftInfo);
+ this.craftCost.put(internalName, craftInfo);
return craftInfo;
}
-
- /**
- * Calculates the cost of enchants + other price modifiers such as pet xp, midas price, etc.
- */
- public float getCostOfEnchants(String internalname, NBTTagCompound tag) {
- float costOfEnchants = 0;
- if (true) return 0;
-
- JsonObject info = getItemAuctionInfo(internalname);
- if (info == null || !info.has("price")) {
- return 0;
- }
- if (auctionPricesJson == null || !auctionPricesJson.has("ench_prices") || !auctionPricesJson.has("ench_maximums")) {
- return 0;
- }
- JsonObject ench_prices = auctionPricesJson.getAsJsonObject("ench_prices");
- JsonObject ench_maximums = auctionPricesJson.getAsJsonObject("ench_maximums");
- if (!ench_prices.has(internalname) || !ench_maximums.has(internalname)) {
- return 0;
- }
- JsonObject iid_variables = ench_prices.getAsJsonObject(internalname);
- float ench_maximum = ench_maximums.get(internalname).getAsFloat();
-
- int enchants = 0;
- float price = getItemAuctionInfo(internalname).get("price").getAsFloat();
- if (tag.hasKey("ExtraAttributes")) {
- NBTTagCompound ea = tag.getCompoundTag("ExtraAttributes");
- if (ea.hasKey("enchantments")) {
-
- NBTTagCompound enchs = ea.getCompoundTag("enchantments");
- for (String ench : enchs.getKeySet()) {
- enchants++;
- int level = enchs.getInteger(ench);
-
- for (Map.Entry<String, JsonElement> entry : iid_variables.entrySet()) {
- if (matchEnch(ench, level, entry.getKey())) {
- costOfEnchants += entry.getValue().getAsJsonObject().get("A").getAsFloat() * price +
- entry.getValue().getAsJsonObject().get("B").getAsFloat();
- break;
- }
- }
- }
- }
- }
- return costOfEnchants;
- }
-
- /**
- * Checks whether a certain enchant (ench name + lvl) matches an enchant id
- * eg. PROTECTION_GE6 will match -> ench_name = PROTECTION, lvl >= 6
- */
- private boolean matchEnch(String ench, int level, String id) {
- if (!id.contains(":")) {
- return false;
- }
-
- String idEnch = id.split(":")[0];
- String idLevel = id.split(":")[1];
-
- if (!ench.equalsIgnoreCase(idEnch)) {
- return false;
- }
-
- if (String.valueOf(level).equalsIgnoreCase(idLevel)) {
- return true;
- }
-
- if (idLevel.startsWith("LE")) {
- int idLevelI = Integer.parseInt(idLevel.substring(2));
- return level <= idLevelI;
- } else if (idLevel.startsWith("GE")) {
- int idLevelI = Integer.parseInt(idLevel.substring(2));
- return level >= idLevelI;
- }
-
- return false;
- }
-
- /*ScheduledExecutorService auctionUpdateSES = Executors.newSingleThreadScheduledExecutor();
- private AtomicInteger auctionUpdateId = new AtomicInteger(0);
- public void updateAuctions() {
- HashMap<Integer, JsonObject> pages = new HashMap<>();
-
- HashMap<String, String> args = new HashMap<>();
- args.put("page", "0");
- AtomicInteger totalPages = new AtomicInteger(1);
- AtomicInteger currentPages = new AtomicInteger(0);
- manager.hypixelApi.getHypixelApiAsync(NotEnoughUpdates.INSTANCE.config.apiKey.apiKey, "skyblock/auctions",
- args, jsonObject -> {
- if (jsonObject.get("success").getAsBoolean()) {
- pages.put(0, jsonObject);
- totalPages.set(jsonObject.get("totalPages").getAsInt());
- currentPages.incrementAndGet();
-
- for (int i = 1; i < totalPages.get(); i++) {
- int j = i;
- HashMap<String, String> args2 = new HashMap<>();
- args2.put("page", "" + i);
- manager.hypixelApi.getHypixelApiAsync(NotEnoughUpdates.INSTANCE.config.apiKey.apiKey, "skyblock/auctions",
- args2, jsonObject2 -> {
- if (jsonObject2.get("success").getAsBoolean()) {
- pages.put(j, jsonObject2);
- currentPages.incrementAndGet();
- } else {
- currentPages.incrementAndGet();
- }
- }
- );
- }
- }
- }
- );
-
- long startTime = System.currentTimeMillis();
-
- int currentAuctionUpdateId = auctionUpdateId.incrementAndGet();
-
- auctionUpdateSES.schedule(new Runnable() {
- public void run() {
- if(auctionUpdateId.get() != currentAuctionUpdateId) return;
- System.out.println(currentPages.get() + "/" + totalPages.get());
- if (System.currentTimeMillis() - startTime > 20000) return;
-
- if (currentPages.get() == totalPages.get()) {
- TreeMap<String, Auction> auctionItemsTemp = new TreeMap<>();
-
- for (int pageNum : pages.keySet()) {
- System.out.println(pageNum + "/" + pages.size());
- JsonObject page = pages.get(pageNum);
- JsonArray auctions = page.get("auctions").getAsJsonArray();
- for (int i = 0; i < auctions.size(); i++) {
- JsonObject auction = auctions.get(i).getAsJsonObject();
-
- String auctionUuid = auction.get("uuid").getAsString();
- String auctioneerUuid = auction.get("auctioneer").getAsString();
- long end = auction.get("end").getAsLong();
- int starting_bid = auction.get("starting_bid").getAsInt();
- int highest_bid_amount = auction.get("highest_bid_amount").getAsInt();
- int bid_count = auction.get("bids").getAsJsonArray().size();
- boolean bin = false;
- if(auction.has("bin")) {
- bin = auction.get("bin").getAsBoolean();
- }
- String category = auction.get("category").getAsString();
- String extras = auction.get("item_lore").getAsString().replaceAll("\n"," ") + " " +
- auction.get("extra").getAsString();
- String item_bytes = auction.get("item_bytes").getAsString();
-
- auctionItemsTemp.put(auctionUuid, new Auction(auctioneerUuid, end, starting_bid, highest_bid_amount,
- bid_count, bin, category, extras, item_bytes));
- }
- }
- auctionItems = auctionItemsTemp;
- customAH.updateSearch();
- return;
- }
-
- auctionUpdateSES.schedule(this, 1000L, TimeUnit.MILLISECONDS);
- }
- }, 3000L, TimeUnit.MILLISECONDS);
- }*/
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/auction/CustomAH.java b/src/main/java/io/github/moulberry/notenoughupdates/auction/CustomAH.java
deleted file mode 100644
index e1ccdef7..00000000
--- a/src/main/java/io/github/moulberry/notenoughupdates/auction/CustomAH.java
+++ /dev/null
@@ -1,2001 +0,0 @@
-/*
- * Copyright (C) 2022 NotEnoughUpdates contributors
- *
- * This file is part of NotEnoughUpdates.
- *
- * NotEnoughUpdates is free software: you can redistribute it
- * and/or modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation, either
- * version 3 of the License, or (at your option) any later version.
- *
- * NotEnoughUpdates is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
- */
-
-package io.github.moulberry.notenoughupdates.auction;
-
-import com.google.gson.JsonObject;
-import io.github.moulberry.notenoughupdates.ItemPriceInformation;
-import io.github.moulberry.notenoughupdates.NEUManager;
-import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
-import io.github.moulberry.notenoughupdates.util.Utils;
-import net.minecraft.client.Minecraft;
-import net.minecraft.client.gui.FontRenderer;
-import net.minecraft.client.gui.Gui;
-import net.minecraft.client.gui.GuiTextField;
-import net.minecraft.client.gui.ScaledResolution;
-import net.minecraft.client.gui.inventory.GuiChest;
-import net.minecraft.client.gui.inventory.GuiEditSign;
-import net.minecraft.client.renderer.GlStateManager;
-import net.minecraft.client.renderer.Tessellator;
-import net.minecraft.client.renderer.WorldRenderer;
-import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
-import net.minecraft.init.Blocks;
-import net.minecraft.init.Items;
-import net.minecraft.inventory.ContainerChest;
-import net.minecraft.item.Item;
-import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.nbt.NBTTagList;
-import net.minecraft.tileentity.TileEntitySign;
-import net.minecraft.util.ChatComponentText;
-import net.minecraft.util.EnumChatFormatting;
-import net.minecraft.util.ResourceLocation;
-import org.lwjgl.input.Keyboard;
-import org.lwjgl.input.Mouse;
-import org.lwjgl.opengl.GL11;
-import org.lwjgl.opengl.GL14;
-
-import java.awt.*;
-import java.awt.datatransfer.StringSelection;
-import java.text.NumberFormat;
-import java.util.ArrayList;
-import java.util.ConcurrentModificationException;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import static io.github.moulberry.notenoughupdates.util.GuiTextures.auction_accept;
-import static io.github.moulberry.notenoughupdates.util.GuiTextures.auction_price;
-import static io.github.moulberry.notenoughupdates.util.GuiTextures.auction_view;
-import static io.github.moulberry.notenoughupdates.util.GuiTextures.auction_view_buttons;
-
-public class CustomAH extends Gui {
- private enum PriceFilter {
- Greater,
- Less,
- Equal
- }
-
- private static final ResourceLocation creativeTabSearch =
- new ResourceLocation("textures/gui/container/creative_inventory/tab_item_search.png");
- private static final ResourceLocation creativeInventoryTabs =
- new ResourceLocation("textures/gui/container/creative_inventory/tabs.png");
-
- private HashSet<String> auctionIds = new HashSet<>();
- private List<String> sortedAuctionIds = new ArrayList<>();
-
- private boolean scrollClicked = false;
-
- private long lastUpdateSearch;
- private long lastSearchFieldUpdate;
- private boolean shouldUpdateSearch = false;
- private boolean shouldSortItems = false;
-
- private long startingBid = 0;
- private String currentAucId = null;
-
- private int clickedMainCategory = -1;
- private int clickedSubCategory = -1;
-
- private GuiTextField searchField = null;
- private GuiTextField priceField = null;
- private GuiTextField priceFilterField = null;
- private GuiTextField binPriceFilterField = null;
-
- private final int binPriceFilterYOffset = 86;
-
- private boolean renderOverAuctionView = false;
- private long lastRenderDisable = 0;
-
- private long currAucIdSetTimer = 0;
- private long resetCurrAucIdTimer = 0;
-
- private int eventButton;
- private long lastMouseEvent;
- public long lastOpen;
- public long lastGuiScreenSwitch;
- private PriceFilter currentPriceFilterType = PriceFilter.Greater;
- private PriceFilter currentBinPriceFilterType = PriceFilter.Greater;
-
- private final int splits = 2;
-
- public String latestBid;
- public long latestBidMillis;
-
- private final int ySplit = 35;
- private final int ySplitSize = 18;
-
- private float scrollAmount;
-
- public int guiLeft = -1;
- public int guiTop = -1;
-
- private String lastSearch = "";
-
- private final Category CATEGORY_SWORD = new Category("sword", "Swords", "diamond_sword");
- private final Category CATEGORY_ARMOR = new Category("armor", "Armor", "diamond_chestplate");
- private final Category CATEGORY_BOWS = new Category("bow", "Bows", "bow");
- private final Category CATEGORY_ACCESSORIES = new Category("accessories", "Accessories", "diamond");
-
- private final Category CATEGORY_FISHING_ROD = new Category("fishingrod", "Fishing Rods", "fishing_rod");
- private final Category CATEGORY_PICKAXE = new Category("pickaxe", "Pickaxes", "iron_pickaxe");
- private final Category CATEGORY_AXE = new Category("axe", "Axes", "iron_axe");
- private final Category CATEGORY_SHOVEL = new Category("shovel", "Shovels", "iron_shovel");
-
- private final Category CATEGORY_PET_ITEM = new Category("petitem", "Pet Items", "lead");
-
- private final Category CATEGORY_EBOOKS = new Category("ebook", "Enchanted Books", "enchanted_book");
- private final Category CATEGORY_POTIONS = new Category("potion", "Potions", "potion");
- private final Category CATEGORY_TRAVEL_SCROLLS = new Category("travelscroll", "Travel Scrolls", "map");
-
- private final Category CATEGORY_REFORGE_STONES = new Category("reforgestone", "Reforge Stones", "anvil");
- private final Category CATEGORY_RUNES = new Category("rune", "Runes", "magma_cream");
- private final Category CATEGORY_FURNITURE = new Category("furniture", "Furniture", "armor_stand");
-
- private final Category CATEGORY_COMBAT = new Category("weapon", "Combat", "golden_sword", CATEGORY_SWORD,
- CATEGORY_BOWS, CATEGORY_ARMOR, CATEGORY_ACCESSORIES
- );
- private final Category CATEGORY_TOOL = new Category(
- "",
- "Tools",
- "diamond_pickaxe",
- CATEGORY_FISHING_ROD,
- CATEGORY_PICKAXE,
- CATEGORY_AXE,
- CATEGORY_SHOVEL
- );
- private final Category CATEGORY_PET = new Category("pet", "Pets", "bone", CATEGORY_PET_ITEM);
- private final Category CATEGORY_CONSUMABLES = new Category(
- "consumables",
- "Consumables",
- "apple",
- CATEGORY_EBOOKS,
- CATEGORY_POTIONS,
- CATEGORY_TRAVEL_SCROLLS
- );
- private final Category CATEGORY_BLOCKS = new Category("blocks", "Blocks", "cobblestone");
- private final Category CATEGORY_MISC = new Category("misc", "Misc", "stick", CATEGORY_REFORGE_STONES, CATEGORY_RUNES,
- CATEGORY_FURNITURE
- );
-
- private final Category[] mainCategories = new Category[]{
- CATEGORY_COMBAT, CATEGORY_TOOL, CATEGORY_PET,
- CATEGORY_CONSUMABLES, CATEGORY_BLOCKS, CATEGORY_MISC
- };
-
- private static final int SORT_MODE_HIGH = 0;
- private static final int SORT_MODE_LOW = 1;
- private static final int SORT_MODE_SOON = 2;
-
- private static final String[] rarityColours = {
- "" + EnumChatFormatting.WHITE,
- "" + EnumChatFormatting.GREEN, "" + EnumChatFormatting.BLUE, "" + EnumChatFormatting.DARK_PURPLE,
- "" + EnumChatFormatting.GOLD, "" + EnumChatFormatting.LIGHT_PURPLE, "" + EnumChatFormatting.RED,
- "" + EnumChatFormatting.RED, "" + EnumChatFormatting.AQUA, "" + EnumChatFormatting.AQUA
- };
-
- private static final int BIN_FILTER_ALL = 0;
- private static final int BIN_FILTER_BIN = 1;
- private static final int BIN_FILTER_AUC = 2;
-
- private static final int ENCH_FILTER_ALL = 0;
- private static final int ENCH_FILTER_CLEAN = 1;
- private static final int ENCH_FILTER_ENCH = 2;
- private static final int ENCH_FILTER_ENCHHPB = 3;
-
- private static final int DUNGEON_FILTER_ALL = 0;
- private static final int DUNGEON_FILTER_DUNGEON = 1;
- private static final int DUNGEON_FILTER_1 = 2;
- private static final int DUNGEON_FILTER_2 = 3;
- private static final int DUNGEON_FILTER_3 = 4;
- private static final int DUNGEON_FILTER_4 = 5;
- private static final int DUNGEON_FILTER_5 = 6;
-
- private int dungeonFilter = DUNGEON_FILTER_ALL;
- private int sortMode = SORT_MODE_HIGH;
- private int rarityFilter = -1;
- private boolean filterMyAuctions = false;
- private int binFilter = BIN_FILTER_ALL;
- private int enchFilter = ENCH_FILTER_ALL;
-
- private static final ItemStack DUNGEON_SORT = Utils.createItemStack(
- Item.getItemFromBlock(Blocks.deadbush),
- EnumChatFormatting.GREEN + "Dungeon Sorting"
- );
- private static final ItemStack CONTROL_SORT = Utils.createItemStack(
- Item.getItemFromBlock(Blocks.hopper),
- EnumChatFormatting.GREEN + "Sort"
- );
- private static final ItemStack CONTROL_TIER = Utils.createItemStack(
- Items.ender_eye,
- EnumChatFormatting.GREEN + "Item Tier"
- );
- private static final ItemStack CONTROL_MYAUC = Utils.createItemStack(
- Items.gold_ingot,
- EnumChatFormatting.GREEN + "My Auctions"
- );
- private static final ItemStack CONTROL_BIN = Utils.createItemStack(
- Item.getItemFromBlock(Blocks.golden_rail),
- EnumChatFormatting.GREEN + "BIN Filter"
- );
- private static final ItemStack CONTROL_ENCH = Utils.createItemStack(
- Items.enchanted_book,
- EnumChatFormatting.GREEN + "Enchant Filter"
- );
- private static final ItemStack CONTROL_STATS = Utils.createItemStack(
- Item.getItemFromBlock(Blocks.command_block),
- EnumChatFormatting.GREEN + "Stats for nerds"
- );
- private final ItemStack[] controls =
- {DUNGEON_SORT, CONTROL_SORT, CONTROL_TIER, null, CONTROL_MYAUC, null, CONTROL_BIN, CONTROL_ENCH, CONTROL_STATS};
-
- private final NEUManager manager;
-
- public CustomAH(NEUManager manager) {
- this.manager = manager;
- }
-
- public void clearSearch() {
- if (searchField == null || priceField == null) init();
- if (System.currentTimeMillis() - lastOpen < 1000) Mouse.setGrabbed(false);
-
- rarityFilter = -1;
- filterMyAuctions = false;
- enchFilter = ENCH_FILTER_ALL;
- dungeonFilter = DUNGEON_FILTER_ALL;
-
- searchField.setText("");
- searchField.setFocused(true);
- priceField.setText("");
- }
-
- public void setSearch(String search) {
- if (search == null) {
- searchField.setText(lastSearch);
- } else {
- searchField.setText(search);
- }
- updateSearch();
- }
-
- public void tick() {
- if (!NotEnoughUpdates.INSTANCE.config.neuAuctionHouse.enableNeuAuctionHouse) return;
- if (Minecraft.getMinecraft().currentScreen instanceof CustomAHGui || renderOverAuctionView) {
- if (shouldUpdateSearch) updateSearch();
- if (shouldSortItems) {
- sortItems();
- shouldSortItems = false;
- }
- }
- }
-
- public static class Category {
- public String categoryMatch;
- public Category[] subcategories;
- public String displayName;
- public ItemStack displayItem;
-
- public Category(String categoryMatch, String displayName, String displayItem, Category... subcategories) {
- this.categoryMatch = categoryMatch;
- this.subcategories = subcategories;
- this.displayName = displayName;
- this.displayItem = new ItemStack(Item.getByNameOrId(displayItem));
- }
-
- public String[] getTotalCategories() {
- String[] categories = new String[1 + subcategories.length];
- categories[0] = categoryMatch;
-
- for (int i = 0; i < subcategories.length; i++) {
- categories[i + 1] = subcategories[i].categoryMatch;
- }
- return categories;
- }
- }
-
- private void init() {
- FontRenderer fr = Minecraft.getMinecraft().fontRendererObj;
- this.searchField = new GuiTextField(0, fr, this.guiLeft + 82, this.guiTop + 6,
- 84, fr.FONT_HEIGHT
- );
- this.priceField = new GuiTextField(1, fr, this.guiLeft + 82, this.guiTop + 6,
- 84, fr.FONT_HEIGHT
- );
- this.priceFilterField = new GuiTextField(2, fr, this.guiLeft + 82, this.guiTop + 6,
- 84, fr.FONT_HEIGHT
- );
- this.binPriceFilterField = new GuiTextField(3, fr, this.guiLeft + 82, this.guiTop - 6, 84, fr.FONT_HEIGHT);
-
- this.searchField.setMaxStringLength(30);
- this.searchField.setEnableBackgroundDrawing(false);
- this.searchField.setTextColor(16777215);
- this.searchField.setVisible(true);
- this.searchField.setCanLoseFocus(true);
- this.searchField.setFocused(true);
- this.searchField.setText("");
-
- this.priceField.setMaxStringLength(10);
- this.priceField.setEnableBackgroundDrawing(false);
- this.priceField.setTextColor(16777215);
- this.priceField.setVisible(true);
- this.priceField.setCanLoseFocus(true);
- this.priceField.setFocused(false);
- this.priceField.setText("");
-
- this.priceFilterField.setMaxStringLength(10);
- this.priceFilterField.setEnableBackgroundDrawing(false);
- this.priceFilterField.setTextColor(16777215);
- this.priceFilterField.setVisible(true);
- this.priceFilterField.setCanLoseFocus(true);
- this.priceFilterField.setFocused(false);
- this.priceFilterField.setText("");
-
- this.binPriceFilterField.setMaxStringLength(10);
- this.binPriceFilterField.setEnableBackgroundDrawing(false);
- this.binPriceFilterField.setTextColor(16777215);
- this.binPriceFilterField.setVisible(true);
- this.binPriceFilterField.setCanLoseFocus(true);
- this.binPriceFilterField.setFocused(false);
- this.binPriceFilterField.setText("");
- }
-
- public boolean isRenderOverAuctionView() {
- return renderOverAuctionView || (System.currentTimeMillis() - lastRenderDisable) < 500;
- }
-
- public void setRenderOverAuctionView(boolean renderOverAuctionView) {
- if (this.renderOverAuctionView && !renderOverAuctionView) lastRenderDisable = System.currentTimeMillis();
- this.renderOverAuctionView = renderOverAuctionView;
- }
-
- public int getXSize() {
- return 195;
- }
-
- public int getYSize() {
- return 136 + ySplitSize * splits;
- }
-
- private String prettyTime(long millis) {
- long seconds = millis / 1000 % 60;
- long minutes = (millis / 1000 / 60) % 60;
- long hours = (millis / 1000 / 60 / 60) % 24;
- long days = (millis / 1000 / 60 / 60 / 24);
-
- String endsIn = "";
- if (millis < 0) {
- endsIn += "Ended!";
- } else if (minutes == 0 && hours == 0 && days == 0) {
- endsIn += seconds + "s";
- } else if (hours == 0 && days == 0) {
- endsIn += minutes + "m" + seconds + "s";
- } else if (days == 0) {
- if (hours <= 6) {
- endsIn += hours + "h" + minutes + "m" + seconds + "s";
- } else {
- endsIn += hours + "h";
- }
- } else {
- endsIn += days + "d" + hours + "h";
- }
-
- return endsIn;
- }
-
- public List<String> getTooltipForAucId(String aucId) {
- APIManager.Auction auc = manager.auctionManager.getAuctionItems().get(aucId);
-
- List<String> tooltip = new ArrayList<>();
-
- for (String line : auc.getStack().getTooltip(Minecraft.getMinecraft().thePlayer, false)) {
- tooltip.add(EnumChatFormatting.GRAY + line);
- }
-
- long timeUntilEnd = auc.end - System.currentTimeMillis();
- String endsIn = EnumChatFormatting.YELLOW + prettyTime(timeUntilEnd);
-
- NumberFormat format = NumberFormat.getInstance(Locale.US);
-
- tooltip.add(EnumChatFormatting.DARK_GRAY + "" + EnumChatFormatting.STRIKETHROUGH + "-----------------");
- tooltip.add(EnumChatFormatting.GRAY + "Seller: [CLICK TO SEE]");
-
- if (auc.bin) {
- tooltip.add(EnumChatFormatting.GRAY + "Buy it now: " +
- EnumChatFormatting.GOLD + format.format(auc.starting_bid));
- } else {
- if (auc.bid_count > 0) {
- tooltip.add(EnumChatFormatting.GRAY + "Bids: " + EnumChatFormatting.GREEN + auc.bid_count + " bids");
- tooltip.add("");
- tooltip.add(EnumChatFormatting.GRAY + "Top bid: " +
- EnumChatFormatting.GOLD + format.format(auc.highest_bid_amount));
- tooltip.add(EnumChatFormatting.GRAY + "Bidder: [CLICK TO SEE]");
- } else {
- tooltip.add(EnumChatFormatting.GRAY + "Starting bid: " +
- EnumChatFormatting.GOLD + format.format(auc.starting_bid));
- }
- }
-
- if (NotEnoughUpdates.INSTANCE.config.tooltipTweaks.showPriceInfoAucItem) {
- String internalname = NotEnoughUpdates.INSTANCE.manager.getInternalNameForItem(auc.getStack());
- if (internalname != null) {
- if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) && !Keyboard.isKeyDown(Keyboard.KEY_RSHIFT)) {
- tooltip.add("");
- tooltip.add(EnumChatFormatting.GRAY + "[SHIFT for Price Info]");
- } else {
- ItemPriceInformation.addToTooltip(tooltip, internalname, auc.getStack());
- }
- }
- }
-
- tooltip.add("");
- tooltip.add(EnumChatFormatting.GRAY + "Ends in: " + endsIn);
- tooltip.add("");
- tooltip.add(EnumChatFormatting.YELLOW + "Click to inspect!");
-
- return tooltip;
- }
-
- public boolean isEditingPrice() {
- return Minecraft.getMinecraft().currentScreen instanceof GuiEditSign;
- }
-
- private boolean isGuiFiller(ItemStack stack) {
- return stack == null || !stack.hasTagCompound() || !stack.getTagCompound().hasKey("AttributeModifiers");
- }
-
- private void drawCategorySide(int i) {
- boolean clicked = i == clickedSubCategory;
-
- int x = guiLeft - 28;
- int y = guiTop + 17 + 28 * (i + 1);
- float uMin = 28 / 256f;
- float uMax = 56 / 256f;
- float vMin = 0 + (clicked ? 32 / 256f : 0);
- float vMax = 32 / 256f + (clicked ? 32 / 256f : 0);
- float catWidth = 32;
- float catHeight = 28;
-
- GlStateManager.enableTexture2D();
- GlStateManager.enableBlend();
- GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA);
-
- GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST);
- GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST);
-
- Tessellator tessellator = Tessellator.getInstance();
- WorldRenderer worldrenderer = tessellator.getWorldRenderer();
- worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX);
- worldrenderer
- .pos(x, y + catHeight, 0.0D)
- .tex(uMax, vMin).endVertex();
- worldrenderer
- .pos(x + catWidth, y + catHeight, 0.0D)
- .tex(uMax, vMax).endVertex();
- worldrenderer
- .pos(x + catWidth, y, 0.0D)
- .tex(uMin, vMax).endVertex();
- worldrenderer
- .pos(x, y, 0.0D)
- .tex(uMin, vMin).endVertex();
- tessellator.draw();
-
- GlStateManager.disableBlend();
- }
-
- private final HashMap<Pattern, Long> timeParseMap = new HashMap<Pattern, Long>() {{
- Pattern dayPattern = Pattern.compile("([0-9]+)d");
- Pattern hourPattern = Pattern.compile("([0-9]+)h");
- Pattern minutePattern = Pattern.compile("([0-9]+)m");
- Pattern secondPattern = Pattern.compile("([0-9]+)s");
-
- put(dayPattern, 24 * 60 * 60 * 1000L);
- put(hourPattern, 60 * 60 * 1000L);
- put(minutePattern, 60 * 1000L);
- put(secondPattern, 1000L);
- }};
-
- public long prettyTimeToMillis(String endsInStr) {
- if (endsInStr != null) {
- long timeUntilEnd = 0;
-
- String timeStr = Utils.cleanColour(endsInStr);
-
- for (Map.Entry<Pattern, Long> timeEntry : timeParseMap.entrySet()) {
- Matcher matcher = timeEntry.getKey().matcher(timeStr);
- if (matcher.find()) {
- String days = matcher.group(1);
- timeUntilEnd += Long.parseLong(days) * timeEntry.getValue();
- }
- }
-
- return timeUntilEnd;
- }
-
- return -1;
- }
-
- public String findStrStart(ItemStack stack, String toFind) {
- if (stack.hasTagCompound()) {
- //§7Ends in:
- for (String line : manager.getLoreFromNBT(stack.getTagCompound())) {
- if (line.trim().startsWith(toFind)) {
- return line.substring(toFind.length());
- }
- }
- }
-
- return null;
- }
-
- public String findEndsInStr(ItemStack stack) {
- return findStrStart(stack, EnumChatFormatting.GRAY + "Ends in: ");
- }
-
- public void drawScreen(int mouseX, int mouseY) {
- if (System.currentTimeMillis() - lastOpen < 1000) Mouse.setGrabbed(false);
-
- ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
- int width = scaledResolution.getScaledWidth();
- int height = scaledResolution.getScaledHeight();
-
- boolean hasPopup = false;
-
- if (searchField == null || priceField == null || priceFilterField == null) init();
-
- GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
-
- guiLeft = (width - getXSize()) / 2;
- guiTop = (height - getYSize()) / 2;
- this.searchField.xPosition = guiLeft + 82;
- this.searchField.yPosition = guiTop + 6;
-
- if (!isEditingPrice()) priceField.setText("IAUSHDIUAH");
-
- if ((Minecraft.getMinecraft().currentScreen instanceof GuiChest ||
- Minecraft.getMinecraft().currentScreen instanceof GuiEditSign) && currentAucId == null) {
- Minecraft.getMinecraft().displayGuiScreen(null);
- }
-
- List<String> tooltipToRender = null;
- int black = Color.BLACK.getRGB();
- if (Minecraft.getMinecraft().currentScreen instanceof GuiChest) {
- resetCurrAucIdTimer = System.currentTimeMillis();
- GuiChest auctionView = (GuiChest) Minecraft.getMinecraft().currentScreen;
- ContainerChest container = (ContainerChest) auctionView.inventorySlots;
- String containerName = container.getLowerChestInventory().getDisplayName().getUnformattedText();
-
- float slideAmount = 1 - Math.max(0, Math.min(1, (System.currentTimeMillis() - lastGuiScreenSwitch) / 200f));
- int auctionViewLeft = guiLeft + getXSize() + 4 - (int) (slideAmount * (78 + 4));
- if (containerName.trim().equals("Auction View") || containerName.trim().equals("BIN Auction View")) {
- hasPopup = true;
- Minecraft.getMinecraft().getTextureManager().bindTexture(auction_view);
- this.drawTexturedModalRect(auctionViewLeft, guiTop, 0, 0, 78, 172);
-
- if (auctionViewLeft + 31 > guiLeft + getXSize()) {
- try {
- ItemStack topStack = auctionView.inventorySlots.getSlot(13).getStack();
- ItemStack leftStack = auctionView.inventorySlots.getSlot(29).getStack();
- ItemStack middleStack = auctionView.inventorySlots.getSlot(31).getStack();
- ItemStack rightStack = auctionView.inventorySlots.getSlot(33).getStack();
-
- boolean isBin = isGuiFiller(leftStack) || isGuiFiller(leftStack);
-
- if (isBin) {
- leftStack = middleStack;
- middleStack = null;
- }
-
- String endsInStr = findEndsInStr(topStack);
- if (endsInStr != null) {
- long auctionViewEndsIn = prettyTimeToMillis(endsInStr);
- if (auctionViewEndsIn > 0) {
- if (System.currentTimeMillis() - currAucIdSetTimer > 1000) {
- APIManager.Auction auc = manager.auctionManager.getAuctionItems().get(currentAucId);
- if (auc != null) {
- auc.end = auctionViewEndsIn + lastGuiScreenSwitch;
- }
- }
- endsInStr = EnumChatFormatting.DARK_PURPLE + prettyTime(
- auctionViewEndsIn + lastGuiScreenSwitch - System.currentTimeMillis());
- }
- Utils.drawStringCenteredScaledMaxWidth(endsInStr, auctionViewLeft + 39, guiTop + 20, false, 70, 4210752);
- }
-
- Utils.drawItemStack(leftStack, auctionViewLeft + 31, guiTop + 100);
-
- if (!isGuiFiller(leftStack)) {
- NBTTagCompound tag = leftStack.getTagCompound();
- NBTTagCompound display = tag.getCompoundTag("display");
- if (display.hasKey("Lore", 9)) {
- NBTTagList list = display.getTagList("Lore", 8);
- String line2 = list.getStringTagAt(1);
- line2 = Utils.cleanColour(line2);
- StringBuilder priceNumbers = new StringBuilder();
- for (int i = 0; i < line2.length(); i++) {
- char c = line2.charAt(i);
- if ((int) c >= 48 && (int) c <= 57) {
- priceNumbers.append(c);
- }
- }
- if (priceNumbers.length() > 0) {
- startingBid = Long.parseLong(priceNumbers.toString());
- }
- }
- }
-
- Utils.drawItemStack(topStack, auctionViewLeft + 31, guiTop + 35);
-
- if (!isGuiFiller(middleStack)) {
- Minecraft.getMinecraft().getTextureManager().bindTexture(auction_view_buttons);
- boolean hover = mouseX > auctionViewLeft + 31 && mouseX < auctionViewLeft + 31 + 16 &&
- mouseY > guiTop + 126 && mouseY < guiTop + 126 + 16;
- this.drawTexturedModalRect(auctionViewLeft + 31, guiTop + 126, hover ? 16 : 0, 0, 16, 16);
- } else {
- middleStack = null;
- }
-
- if (mouseX > auctionViewLeft + 31 && mouseX < auctionViewLeft + 31 + 16) {
- if (mouseY > guiTop + 35 && mouseY < guiTop + 35 + 16) {
- if (topStack != null) {
- tooltipToRender = topStack.getTooltip(Minecraft.getMinecraft().thePlayer, false);
- tooltipToRender.add("");
- tooltipToRender.add(EnumChatFormatting.YELLOW + "Click to copy seller name!");
- }
- } else if (mouseY > guiTop + 100 && mouseY < guiTop + 100 + 16) {
- if (leftStack != null)
- tooltipToRender = leftStack.getTooltip(Minecraft.getMinecraft().thePlayer, false);
- } else if (mouseY > guiTop + 61 && mouseY < guiTop + 61 + 16) {
- tooltipToRender = new ArrayList<>();
- APIManager.Auction auc = manager.auctionManager.getAuctionItems().get(currentAucId);
- if (auc != null) {
- tooltipToRender.add(EnumChatFormatting.WHITE + "Price Info");
-
- String internalname = manager.getInternalNameForItem(auc.getStack());
- JsonObject auctionInfo = manager.auctionManager.getItemAuctionInfo(internalname);
- JsonObject bazaarInfo = manager.auctionManager.getBazaarInfo(internalname);
-
- boolean hasAuctionPrice = auctionInfo != null;
- boolean hasBazaarPrice = bazaarInfo != null;
-
- long lowestBin = manager.auctionManager.getLowestBin(internalname);
-
- NumberFormat format = NumberFormat.getInstance(Locale.US);
-
- APIManager.CraftInfo craftCost = manager.auctionManager.getCraftCost(internalname);
-
- if (lowestBin > 0) {
- tooltipToRender.add(
- EnumChatFormatting.YELLOW.toString() + EnumChatFormatting.BOLD + "Lowest BIN: " +
- EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + format.format(lowestBin) + " coins");
- }
- if (hasBazaarPrice) {
- int bazaarBuyPrice = (int) bazaarInfo.get("avg_buy").getAsFloat();
- tooltipToRender.add(
- EnumChatFormatting.YELLOW.toString() + EnumChatFormatting.BOLD + "Bazaar Buy: " +
- EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + format.format(bazaarBuyPrice) + " coins");
- int bazaarSellPrice = (int) bazaarInfo.get("avg_sell").getAsFloat();
- tooltipToRender.add(
- EnumChatFormatting.YELLOW.toString() + EnumChatFormatting.BOLD + "Bazaar Sell: " +
- EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + format.format(bazaarSellPrice) + " coins");
- int bazaarInstantBuyPrice = (int) bazaarInfo.get("curr_buy").getAsFloat();
- tooltipToRender.add(
- EnumChatFormatting.YELLOW.toString() + EnumChatFormatting.BOLD + "Bazaar Insta-Buy: " +
- EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + format.format(bazaarInstantBuyPrice) +
- " coins");
- int bazaarInstantSellPrice = (int) bazaarInfo.get("curr_sell").getAsFloat();
- tooltipToRender.add(
- EnumChatFormatting.YELLOW.toString() + EnumChatFormatting.BOLD + "Bazaar Insta-Sell: " +
- EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + format.format(bazaarInstantSellPrice) +
- " coins");
- }
- if (hasAuctionPrice) {
- int auctionPrice =
- (int) (auctionInfo.get("price").getAsFloat() / auctionInfo.get("count").getAsFloat());
- tooltipToRender.add(EnumChatFormatting.YELLOW.toString() + EnumChatFormatting.BOLD + "AH Price: " +
- EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + format.format(auctionPrice) + " coins");
- tooltipToRender.add(EnumChatFormatting.YELLOW.toString() + EnumChatFormatting.BOLD + "AH Sales: " +
- EnumChatFormatting.GOLD + EnumChatFormatting.BOLD +
- format.format(auctionInfo.get("sales").getAsFloat()) + " sales/day");
- if (auctionInfo.has("clean_price")) {
- tooltipToRender.add(
- EnumChatFormatting.YELLOW.toString() + EnumChatFormatting.BOLD + "AH Price (Clean): " +
- EnumChatFormatting.GOLD + EnumChatFormatting.BOLD +
- format.format((int) auctionInfo.get("clean_price").getAsFloat()) + " coins");
- tooltipToRender.add(
- EnumChatFormatting.YELLOW.toString() + EnumChatFormatting.BOLD + "AH Sales (Clean): " +
- EnumChatFormatting.GOLD + EnumChatFormatting.BOLD +
- format.format(auctionInfo.get("clean_sales").getAsFloat()) + " sales/day");
- }
-
- }
- if (craftCost.fromRecipe) {
- tooltipToRender.add(
- EnumChatFormatting.YELLOW.toString() + EnumChatFormatting.BOLD + "Raw Craft Cost: " +
- EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + format.format((int) craftCost.craftCost) +
- " coins");
- }
- tooltipToRender.add("");
- }
- if (rightStack != null)
- tooltipToRender.addAll(rightStack.getTooltip(Minecraft.getMinecraft().thePlayer, false));
- } else if (mouseY > guiTop + 126 && mouseY < guiTop + 126 + 16) {
- if (middleStack != null)
- tooltipToRender = middleStack.getTooltip(Minecraft.getMinecraft().thePlayer, false);
- }
- }
- } catch (NullPointerException e) { //i cant be bothered
- }
- }
- } else if (containerName.trim().equals("Confirm Bid") || containerName.trim().equals("Confirm Purchase")) {
- Minecraft.getMinecraft().getTextureManager().bindTexture(auction_accept);
- this.drawTexturedModalRect(auctionViewLeft, guiTop, 0, 0, 78, 172);
-
- if (auctionViewLeft + 31 > guiLeft + getXSize()) {
- try {
- ItemStack leftStack = auctionView.inventorySlots.getSlot(11).getStack();
- ItemStack middleStack = auctionView.inventorySlots.getSlot(13).getStack();
- ItemStack rightStack = auctionView.inventorySlots.getSlot(15).getStack();
-
- Utils.drawItemStack(middleStack, auctionViewLeft + 31, guiTop + 78);
-
- boolean topHovered = false;
- boolean bottomHovered = false;
-
- if (mouseX > auctionViewLeft + 31 && mouseX < auctionViewLeft + 31 + 16) {
- if (mouseY > guiTop + 31 && mouseY < guiTop + 31 + 16) {
- if (leftStack != null) {
- topHovered = true;
- tooltipToRender = leftStack.getTooltip(Minecraft.getMinecraft().thePlayer, false);
- }
- } else if (mouseY > guiTop + 125 && mouseY < guiTop + 125 + 16) {
- if (rightStack != null) {
- bottomHovered = true;
- tooltipToRender = rightStack.getTooltip(Minecraft.getMinecraft().thePlayer, false);
- }
- } else if (mouseY > guiTop + 78 && mouseY < guiTop + 78 + 16) {
- if (middleStack != null)
- tooltipToRender = middleStack.getTooltip(Minecraft.getMinecraft().thePlayer, false);
- }
- }
- GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
- Minecraft.getMinecraft().getTextureManager().bindTexture(auction_view_buttons);
- this.drawTexturedModalRect(auctionViewLeft + 31, guiTop + 31, topHovered ? 16 : 0, 48, 16, 16);
- this.drawTexturedModalRect(auctionViewLeft + 31, guiTop + 125, bottomHovered ? 16 : 0, 64, 16, 16);
- } catch (NullPointerException blah) { //i cant be bothered
- }
- }
- }
-
- Utils.drawStringCenteredScaledMaxWidth(containerName, auctionViewLeft + 39, guiTop + 10, false, 70, 4210752);
- } else if (isEditingPrice()) {
- hasPopup = true;
- resetCurrAucIdTimer = System.currentTimeMillis();
- float slideAmount = 1 - Math.max(0, Math.min(1, (System.currentTimeMillis() - lastGuiScreenSwitch) / 200f));
- int auctionViewLeft = guiLeft + getXSize() + 4 - (int) (slideAmount * (96 + 4));
-
- if (priceField.getText().equals("IAUSHDIUAH")) priceField.setText("" + startingBid);
-
- searchField.setFocused(false);
- priceField.setFocused(true);
- priceField.xPosition = auctionViewLeft + 18;
- priceField.yPosition = guiTop + 18;
-
- Minecraft.getMinecraft().getTextureManager().bindTexture(auction_price);
- this.drawTexturedModalRect(auctionViewLeft, guiTop, 0, 0, 96, 99);
- priceField.drawTextBox();
-
- Utils.drawStringCenteredScaledMaxWidth("Bid Amount", auctionViewLeft + 39, guiTop + 10, false, 70, 4210752);
-
- GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
- Minecraft.getMinecraft().getTextureManager().bindTexture(auction_view_buttons);
- this.drawTexturedModalRect(auctionViewLeft + 16, guiTop + 32, 0, 16, 30, 16);
- this.drawTexturedModalRect(auctionViewLeft + 16 + 34, guiTop + 32, 0, 16, 30, 16);
- this.drawTexturedModalRect(auctionViewLeft + 16, guiTop + 50, 0, 16, 30, 16);
- this.drawTexturedModalRect(auctionViewLeft + 16 + 34, guiTop + 50, 0, 16, 30, 16);
- this.drawTexturedModalRect(auctionViewLeft + 16, guiTop + 68, 0, 32, 64, 16);
-
- Utils.drawStringCentered("x2", auctionViewLeft + 16 + 15, guiTop + 32 + 8, false, black);
- Utils.drawStringCentered("+50%", auctionViewLeft + 16 + 34 + 15, guiTop + 32 + 8, false, black);
- Utils.drawStringCentered("+25%", auctionViewLeft + 16 + 15, guiTop + 50 + 8, false, black);
- Utils.drawStringCentered("+10%", auctionViewLeft + 16 + 34 + 15, guiTop + 50 + 8, false, black);
- Utils.drawStringCentered("Set Amount", auctionViewLeft + 16 + 32, guiTop + 68 + 8, false, black);
- GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
-
- GuiEditSign editSign = (GuiEditSign) Minecraft.getMinecraft().currentScreen;
- TileEntitySign tes = (TileEntitySign) Utils.getField(GuiEditSign.class, editSign,
- "tileSign", "field_146848_f"
- );
- tes.lineBeingEdited = 0;
- tes.signText[0] = new ChatComponentText(priceField.getText());
- } else {
- if (System.currentTimeMillis() - resetCurrAucIdTimer > 500 &&
- System.currentTimeMillis() - currAucIdSetTimer > 500) {
- currentAucId = null;
- currAucIdSetTimer = System.currentTimeMillis();
- }
- }
-
- Minecraft.getMinecraft().getTextureManager().bindTexture(creativeInventoryTabs);
- GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
- if (mouseY > guiTop - 28 && mouseY < guiTop + 4) {
- if (mouseX > guiLeft && mouseX < guiLeft + 168) {
- int offset = mouseX - guiLeft;
- int hoveredCat = offset / 28;
- if (hoveredCat >= 0 && hoveredCat < mainCategories.length) {
- tooltipToRender = Utils.createList(mainCategories[hoveredCat].displayName);
- }
- }
- }
- if (clickedMainCategory == -1) {
- this.drawTexturedModalRect(guiLeft, guiTop - 28, 0, 0, 168, 32);
- } else {
- int selStart = clickedMainCategory * 28;
- this.drawTexturedModalRect(guiLeft, guiTop - 28, 0, 0, selStart, 32);
- this.drawTexturedModalRect(guiLeft + selStart + 28, guiTop - 28, selStart + 28, 0,
- 168 - selStart - 28, 32
- );
-
- if (clickedMainCategory >= 0 && clickedMainCategory < mainCategories.length) {
- Category mainCategory = mainCategories[clickedMainCategory];
-
- if (mouseX > guiLeft - 28 && mouseX < guiLeft) {
- int offset = mouseY - (guiTop + 17);
- if (offset > 0) {
- int hovered = offset / 28 - 1;
- if (hovered < 0) {
- tooltipToRender = Utils.createList(mainCategory.displayName);
- } else if (hovered < mainCategory.subcategories.length) {
- tooltipToRender = Utils.createList(mainCategory.subcategories[hovered].displayName);
- }
- }
- }
-
- for (int i = -1; i < mainCategory.subcategories.length; i++) {
- if (i != clickedSubCategory) drawCategorySide(i);
- }
- }
- }
-
- //Main GUI
- Minecraft.getMinecraft().getTextureManager().bindTexture(creativeTabSearch);
- GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
- this.drawTexturedModalRect(guiLeft, guiTop, 0, 0, getXSize(), ySplit);
- int y = guiTop + ySplit;
- for (int i = 0; i < splits; i++) {
- this.drawTexturedModalRect(guiLeft, y, 0, ySplit, getXSize(), ySplit + ySplitSize);
- y += ySplitSize;
- }
- this.drawTexturedModalRect(guiLeft, y, 0, ySplit, getXSize(), 136 - ySplit);
-
- //GUI Name
- Utils.drawStringCenteredScaledMaxWidth("Auction House", guiLeft + 42,
- guiTop + 10, false, 68, 4210752
- );
- GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
-
- //Categories
- Minecraft.getMinecraft().getTextureManager().bindTexture(creativeInventoryTabs);
- GlStateManager.enableBlend();
- GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA);
- if (clickedMainCategory != -1) {
- int selStart = clickedMainCategory * 28;
-
- this.drawTexturedModalRect(guiLeft + selStart, guiTop - 28, clickedMainCategory == 0 ? 0 : 28, 32, 28, 32);
-
- if (clickedMainCategory >= 0 && clickedMainCategory < mainCategories.length) {
- Category mainCategory = mainCategories[clickedMainCategory];
-
- if (clickedSubCategory >= -1 && clickedSubCategory < mainCategory.subcategories.length) {
- drawCategorySide(clickedSubCategory);
- }
- }
- }
-
- //Category icons
- for (int i = 0; i < mainCategories.length; i++) {
- Category category = mainCategories[i];
- Utils.drawItemStack(category.displayItem, guiLeft + 28 * i + 6, guiTop - 28 + 9);
- }
- if (clickedMainCategory >= 0 && clickedMainCategory < mainCategories.length) {
- Category mainCategory = mainCategories[clickedMainCategory];
-
- Utils.drawItemStack(mainCategory.displayItem, guiLeft - 19, guiTop + 23);
- for (int i = 0; i < mainCategory.subcategories.length; i++) {
- Utils.drawItemStack(mainCategory.subcategories[i].displayItem, guiLeft - 19, guiTop + 23 + 28 * (i + 1));
- }
- }
-
- for (int i = 0; i < controls.length; i++) {
- Utils.drawItemStack(controls[i], guiLeft + 9 + 18 * i, guiTop + 112 + 18 * splits);
- if (mouseX > guiLeft + 9 + 18 * i && mouseX < guiLeft + 9 + 18 * i + 16) {
- if (mouseY > guiTop + 112 + 18 * splits && mouseY < guiTop + 112 + 18 * splits + 16) {
- tooltipToRender = getTooltipForControl(i);
- }
- }
- }
-
- int totalItems = auctionIds.size();
- int itemsScroll = (int) Math.floor((totalItems * scrollAmount) / 9f) * 9;
-
- int maxItemScroll = Math.max(0, totalItems - (5 + splits) * 9);
- itemsScroll = Math.min(itemsScroll, maxItemScroll);
-
- if (NotEnoughUpdates.INSTANCE.config.neuAuctionHouse.enableNeuAuctionHouse) {
- out:
- for (int i = 0; i < 5 + splits; i++) {
- int itemY = guiTop + i * 18 + 18;
- for (int j = 0; j < 9; j++) {
- int itemX = guiLeft + j * 18 + 9;
- int id = itemsScroll + i * 9 + j;
- if (auctionIds.size() <= id) break out;
-
- try {
- String aucid = sortedAuctionIds.get(id);
-
- GL11.glTranslatef(0, 0, 100);
- ItemStack stack = manager.auctionManager.getAuctionItems().get(aucid).getStack();
- Utils.drawItemStack(stack, itemX, itemY);
- GL11.glTranslatef(0, 0, -100);
-
- if (mouseX > itemX && mouseX < itemX + 16) {
- if (mouseY > itemY && mouseY < itemY + 16) {
- tooltipToRender = getTooltipForAucId(aucid);
- }
- }
- } catch (Exception ignored) {
- }
- }
- }
- }
-
- GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
- searchField.drawTextBox();
- GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
-
-
- Minecraft.getMinecraft().getTextureManager().bindTexture(creativeInventoryTabs);
- GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
- this.drawTexturedModalRect(guiLeft + 175, guiTop + 18 + (int) ((95 + ySplitSize * 2) * scrollAmount),
- 256 - (scrollClicked ? 12 : 24), 0, 12, 15
- );
-
- if (!NotEnoughUpdates.INSTANCE.config.neuAuctionHouse.enableNeuAuctionHouse) {
- Utils.drawStringCentered(EnumChatFormatting.RED + "NEUAH is DISABLED! Enable in /neu.",
- guiLeft + getXSize() / 2, guiTop + getYSize() / 2 - 5, true, 0
- );
- }
-
- if (tooltipToRender != null) {
- List<String> tooltipGray = new ArrayList<>();
- for (String line : tooltipToRender) {
- tooltipGray.add(EnumChatFormatting.GRAY + line);
- }
- Utils.drawHoveringText(tooltipGray, mouseX, mouseY, width, height, -1);
- }
- float slideAmount = 1 - Math.max(0, Math.min(1, (System.currentTimeMillis() - lastGuiScreenSwitch) / 200f));
- int auctionViewLeft = guiLeft + getXSize() + 4 - (int) (slideAmount * (78 + 4));
-
- // Price filter
- if (!hasPopup && NotEnoughUpdates.INSTANCE.config.neuAuctionHouse.priceFiltering) {
- // Price bid filter
- priceFilterField.xPosition = auctionViewLeft + 18;
- priceFilterField.yPosition = guiTop + 18;
-
- Minecraft.getMinecraft().getTextureManager().bindTexture(auction_price);
- GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
- this.drawTexturedModalRect(auctionViewLeft, guiTop, 0, 0, 96, 83);
- if (getPriceFilterAmount() == -1) {
- priceFilterField.setTextColor(Color.RED.getRGB());
- } else {
- priceFilterField.setTextColor(16777215);
- }
- priceFilterField.drawTextBox();
-
- Utils.drawStringCenteredScaledMaxWidth("Price Filter", auctionViewLeft + 39, guiTop + 10, false, 70, 421052);
-
- GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
- Minecraft.getMinecraft().getTextureManager().bindTexture(auction_view_buttons);
- if (currentPriceFilterType == PriceFilter.Less) {
- this.drawTexturedModalRect(auctionViewLeft + 16, guiTop + 32, 30, 16, 30, 16);
- } else {
- this.drawTexturedModalRect(auctionViewLeft + 16, guiTop + 32, 0, 16, 30, 16);
- }
- if (currentPriceFilterType == PriceFilter.Greater) {
- this.drawTexturedModalRect(auctionViewLeft + 16 + 34, guiTop + 32, 30, 16, 30, 16);
- } else {
- this.drawTexturedModalRect(auctionViewLeft + 16 + 34, guiTop + 32, 0, 16, 30, 16);
- }
- if (currentPriceFilterType == PriceFilter.Equal) {
- this.drawTexturedModalRect(auctionViewLeft + 16, guiTop + 50, 64, 32, 64, 16);
- } else {
- this.drawTexturedModalRect(auctionViewLeft + 16, guiTop + 50, 0, 32, 64, 16);
- }
-
- Utils.drawStringCentered("<=", auctionViewLeft + 16 + 15, guiTop + 32 + 8, false, black);
- Utils.drawStringCentered(">=", auctionViewLeft + 16 + 34 + 15, guiTop + 32 + 8, false, black);
- Utils.drawStringCentered("==", auctionViewLeft + 16 + 32, guiTop + 50 + 8, false, black);
- GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
-
- // Bin average price filter
- binPriceFilterField.xPosition = auctionViewLeft + 18;
- binPriceFilterField.yPosition = guiTop + 18 + binPriceFilterYOffset;
-
- Minecraft.getMinecraft().getTextureManager().bindTexture(auction_price);
- this.drawTexturedModalRect(auctionViewLeft, guiTop + binPriceFilterYOffset, 0, 0, 96, 83);
- if (getBinPriceFilterAmount() == -1) {
- binPriceFilterField.setTextColor(Color.RED.getRGB());
- } else {
- binPriceFilterField.setTextColor(16777215);
- }
- binPriceFilterField.drawTextBox();
-
- Utils.drawStringCenteredScaledMaxWidth("BIN Average Filter", auctionViewLeft + 39, guiTop + 10 + binPriceFilterYOffset, false, 70, 4210752);
-
- GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
- Minecraft.getMinecraft().getTextureManager().bindTexture(auction_view_buttons);
- if (currentBinPriceFilterType == PriceFilter.Less) {
- this.drawTexturedModalRect(auctionViewLeft + 16, guiTop + 32 + binPriceFilterYOffset, 30, 16, 30, 16);
- } else {
- this.drawTexturedModalRect(auctionViewLeft + 16, guiTop + 32 + binPriceFilterYOffset, 0, 16, 30, 16);
- }
- if (currentBinPriceFilterType == PriceFilter.Greater) {
- this.drawTexturedModalRect(auctionViewLeft + 16 + 34, guiTop + 32 + binPriceFilterYOffset, 30, 16, 30, 16);
- } else {
- this.drawTexturedModalRect(auctionViewLeft + 16 + 34, guiTop + 32 + binPriceFilterYOffset, 0, 16, 30, 16);
- }
- if (currentBinPriceFilterType == PriceFilter.Equal) {
- this.drawTexturedModalRect(auctionViewLeft + 16, guiTop + 50 + binPriceFilterYOffset, 64, 32, 64, 16);
- } else {
- this.drawTexturedModalRect(auctionViewLeft + 16, guiTop + 50 + binPriceFilterYOffset, 0, 32, 64, 16);
- }
-
- Utils.drawStringCentered("<=", auctionViewLeft + 16 + 15, guiTop + 32 + 8 + binPriceFilterYOffset, false, black);
- Utils.drawStringCentered(">=", auctionViewLeft + 16 + 34 + 15, guiTop + 32 + 8 + binPriceFilterYOffset, false, black);
- Utils.drawStringCentered("==", auctionViewLeft + 16 + 32, guiTop + 50 + 8 + binPriceFilterYOffset, false, black);
- GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
- }
- }
-
- public List<String> getTooltipForControl(int index) {
- List<String> lore = new ArrayList<>();
- if (index < 0 || index >= controls.length) return lore;
- if (controls[index] == null) return lore;
-
- lore.add(controls[index].getDisplayName());
- String arrow = "\u25b6";
- String selPrefixNC = " " + arrow + " ";
- String selPrefix = EnumChatFormatting.DARK_AQUA + selPrefixNC;
- String unselPrefix = EnumChatFormatting.GRAY.toString();
- switch (index) {
- case 0:
- lore.add("");
- String gold = EnumChatFormatting.GOLD.toString();
- String gray = EnumChatFormatting.GRAY.toString();
- char s = 0x272A;
- String[] linesDung = {
- "Show All", "Any Dungeon",
- gold + s + gray + s + s + s + s,
- gold + s + s + gray + s + s + s,
- gold + s + s + s + gray + s + s,
- gold + s + s + s + s + gray + s,
- gold + s + s + s + s + s
- };
- for (int i = 0; i < linesDung.length; i++) {
- String line = linesDung[i];
- if (i == dungeonFilter) {
- line = selPrefix + line.replace(gray, EnumChatFormatting.DARK_AQUA.toString());
- } else {
- line = unselPrefix + line;
- }
- lore.add(line);
- }
- lore.add("");
- lore.add(EnumChatFormatting.AQUA + "Right-Click to go backwards!");
- lore.add(EnumChatFormatting.YELLOW + "Click to switch sort!");
- return lore;
- case 1:
- lore.add("");
- String[] linesSort = {"Highest Bid", "Lowest Bid", "Ending soon"};
- for (int i = 0; i < linesSort.length; i++) {
- String line = linesSort[i];
- if (i == sortMode) {
- line = selPrefix + line;
- } else {
- line = unselPrefix + line;
- }
- lore.add(line);
- }
- lore.add("");
- lore.add(EnumChatFormatting.YELLOW + "Click to switch sort!");
- return lore;
- case 2:
- lore.add("");
- lore.add((rarityFilter == -1 ? EnumChatFormatting.DARK_GRAY + selPrefixNC : unselPrefix) + "No Filter");
-
- for (int i = 0; i < Utils.rarityArr.length; i++) {
- lore.add((rarityFilter == i ? rarityColours[i] + selPrefixNC : unselPrefix) +
- Utils.prettyCase(Utils.rarityArr[i]));
- }
- lore.add("");
- lore.add(EnumChatFormatting.AQUA + "Right-Click to go backwards!");
- lore.add(EnumChatFormatting.YELLOW + "Click to switch filter!");
- return lore;
- case 3:
- break;
- case 4:
- lore.add("");
- String off = EnumChatFormatting.RED + "OFF";
- String on = EnumChatFormatting.GREEN + "ON";
- lore.add(unselPrefix + "Filter Own Auctions: " + (filterMyAuctions ? on : off));
- lore.add("");
- lore.add(EnumChatFormatting.YELLOW + "Click to toggle!");
- return lore;
- case 5:
- break;
- case 6:
- lore.add("");
- String[] linesBin = {"Show All", "BIN Only", "Auctions Only"};
- for (int i = 0; i < linesBin.length; i++) {
- String line = linesBin[i];
- if (i == binFilter) {
- line = selPrefix + line;
- } else {
- line = unselPrefix + line;
- }
- lore.add(line);
- }
- lore.add("");
- lore.add(EnumChatFormatting.AQUA + "Right-Click to go backwards!");
- lore.add(EnumChatFormatting.YELLOW + "Click to switch filter!");
- return lore;
- case 7:
- lore.add("");
- String[] linesEnch = {"Show All", "Clean Only", "Ench Only", "Ench/HPB Only"};
- for (int i = 0; i < linesEnch.length; i++) {
- String line = linesEnch[i];
- if (i == enchFilter) {
- line = selPrefix + line;
- } else {
- line = unselPrefix + line;
- }
- lore.add(line);
- }
- lore.add("");
- lore.add(EnumChatFormatting.AQUA + "Right-Click to go backwards!");
- lore.add(EnumChatFormatting.YELLOW + "Click to switch filter!");
- return lore;
- case 8:
- lore.add("");
- lore.add("Current aucid: " + currentAucId);
- if (currentAucId != null) {
- APIManager.Auction auc = manager.auctionManager.getAuctionItems().get(currentAucId);
- if (auc != null) {
- lore.add("Current auc category: " + auc.category);
- }
- }
- lore.add(" --- Processing");
- lore.add("Page Process Millis: " + manager.auctionManager.processMillis);
- lore.add(" --- Auction Stats");
- lore.add("Active Auctions: " + manager.auctionManager.activeAuctions);
- lore.add("Tracked Auctions: " + manager.auctionManager.getAuctionItems().size());
- lore.add("Displayed Auctions: " + auctionIds.size());
- lore.add("Tracked Player Auctions: " + manager.auctionManager.getPlayerBids().size());
- lore.add("Unique Items: " + manager.auctionManager.uniqueItems);
- lore.add("ID Tagged Auctions: " + manager.auctionManager.internalnameTaggedAuctions);
- lore.add("Total Tags: " + manager.auctionManager.totalTags);
- lore.add("Tagged Auctions: " + manager.auctionManager.taggedAuctions);
- lore.add("");
- lore.add(EnumChatFormatting.AQUA + "Right-Click to copy current aucid to clipboard!");
- lore.add(EnumChatFormatting.YELLOW + "Click to refresh!");
- return lore;
- }
- return new ArrayList<>();
- }
-
- public void handleMouseInput() {
- if (!NotEnoughUpdates.INSTANCE.config.neuAuctionHouse.enableNeuAuctionHouse) {
- return;
- }
-
- ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
- int width = scaledResolution.getScaledWidth();
- int height = scaledResolution.getScaledHeight();
-
- int mouseX = Mouse.getEventX() * width / Minecraft.getMinecraft().displayWidth;
- int mouseY = height - Mouse.getEventY() * height / Minecraft.getMinecraft().displayHeight - 1;
- int mouseButton = Mouse.getEventButton();
-
- if (Mouse.getEventButtonState()) {
- this.eventButton = mouseButton;
- this.lastMouseEvent = Minecraft.getSystemTime();
- mouseClicked(mouseX, mouseY, this.eventButton);
- } else if (mouseButton != -1) {
- this.eventButton = -1;
- mouseReleased(mouseX, mouseY, mouseButton);
- } else if (this.eventButton != -1 && this.lastMouseEvent > 0L) {
- long l = Minecraft.getSystemTime() - this.lastMouseEvent;
- mouseClickMove(mouseX, mouseY, this.eventButton, l);
- }
-
- if (!NotEnoughUpdates.INSTANCE.config.neuAuctionHouse.disableAhScroll) {
- int dWheel = Mouse.getEventDWheel();
- dWheel = Math.max(-1, Math.min(1, dWheel));
-
- scrollAmount = scrollAmount - dWheel / (float) (auctionIds.size() / 9 - (5 + splits));
- scrollAmount = Math.max(0, Math.min(1, scrollAmount));
- }
- }
-
- public String niceAucId(String aucId) {
- if (aucId.length() != 32) return aucId;
-
- return aucId.substring(0, 8) +
- "-" + aucId.substring(8, 12) +
- "-" + aucId.substring(12, 16) +
- "-" + aucId.substring(16, 20) +
- "-" + aucId.substring(20, 32);
- }
-
- public Category getCurrentCategory() {
- if (clickedMainCategory < 0 || clickedMainCategory >= mainCategories.length) {
- return null;
- }
- Category mainCategory = mainCategories[clickedMainCategory];
- if (clickedSubCategory < 0 || clickedSubCategory >= mainCategory.subcategories.length) {
- return mainCategory;
- }
- return mainCategory.subcategories[clickedSubCategory];
- }
-
- private boolean doesAucMatch(APIManager.Auction auc) {
- if (auc == null) return false;
-
- Category currentCategory = getCurrentCategory();
-
- boolean match = true;
- if (currentCategory != null) {
- match = false;
- String[] categories = currentCategory.getTotalCategories();
- for (String category : categories) {
- match |= category.equalsIgnoreCase(auc.category);
- }
- }
-
- if (rarityFilter >= 0 && rarityFilter < Utils.rarityArr.length) {
- match &= Utils.rarityArr[rarityFilter].equals(auc.rarity);
- }
-
- if (binFilter == BIN_FILTER_BIN) {
- match &= auc.bin;
- } else if (binFilter == BIN_FILTER_AUC) {
- match &= !auc.bin;
- }
-
- if (enchFilter > ENCH_FILTER_ALL) {
- switch (enchFilter) {
- case ENCH_FILTER_CLEAN:
- match &= auc.enchLevel == 0;
- break;
- case ENCH_FILTER_ENCH:
- match &= auc.enchLevel >= 1;
- break;
- case ENCH_FILTER_ENCHHPB:
- match &= auc.enchLevel == 2;
- break;
- }
- }
-
- if (dungeonFilter > DUNGEON_FILTER_ALL) {
- if (dungeonFilter == DUNGEON_FILTER_DUNGEON && auc.dungeonTier < 0) {
- match = false;
- } else {
- match &= dungeonFilter == auc.dungeonTier + 1;
- }
- }
-
- if (getPriceFilterAmount() > -1) {
- if (currentPriceFilterType == PriceFilter.Greater) {
- match &= auc.highest_bid_amount != 0
- ? (auc.highest_bid_amount >= getPriceFilterAmount())
- : auc.starting_bid >= getPriceFilterAmount();
- }
- if (currentPriceFilterType == PriceFilter.Less) {
- match &= auc.highest_bid_amount != 0
- ? (auc.highest_bid_amount <= getPriceFilterAmount())
- : auc.starting_bid <= getPriceFilterAmount();
- }
- if (currentPriceFilterType == PriceFilter.Equal) {
- match &= auc.highest_bid_amount != 0
- ? (auc.highest_bid_amount == getPriceFilterAmount())
- : auc.starting_bid == getPriceFilterAmount();
- }
- }
- if (getBinPriceFilterAmount() > -1) {
- long lowestBin =
- NotEnoughUpdates.INSTANCE.manager.auctionManager.getLowestBin(NotEnoughUpdates.INSTANCE.manager.getInternalNameForItem(
- auc.getStack()));
- if (lowestBin > 0) {
- if (currentBinPriceFilterType == PriceFilter.Greater) {
- match &= lowestBin >= getBinPriceFilterAmount();
- }
- if (currentBinPriceFilterType == PriceFilter.Less) {
- match &= lowestBin <= getBinPriceFilterAmount();
- }
- if (currentBinPriceFilterType == PriceFilter.Equal) {
- match &= lowestBin == getBinPriceFilterAmount();
- }
- } else {
- match = false;
- }
- }
- return match;
- }
-
- private HashSet<String> search(String query, Set<String> dontMatch) {
- query = query.trim();
- HashSet<String> matches = new HashSet<>();
-
- Set<String> itemMatches = manager.search(query);
- for (String internalname : itemMatches) {
- for (String aucid : manager.auctionManager.getAuctionsForInternalname(internalname)) {
- APIManager.Auction auc = manager.auctionManager.getAuctionItems().get(aucid);
- if (!doesAucMatch(auc)) {
- dontMatch.add(aucid);
- }
- }
- }
-
- HashMap<String, List<Integer>> extrasMatches = new HashMap<>();
- HashMap<String, List<Integer>> extrasMatchesCurrent = new HashMap<>();
- boolean first = true;
- for (String subQuery : query.split(" ")) {
- for (HashMap<Integer, HashSet<String>> extrasMap : manager.subMapWithKeysThatAreSuffixes(
- subQuery.toLowerCase(),
- manager.auctionManager.extrasToAucIdMap
- ).values()) {
- for (int index : extrasMap.keySet()) {
- for (String aucid : extrasMap.get(index)) {
- APIManager.Auction auc = manager.auctionManager.getAuctionItems().get(aucid);
- if (!dontMatch.contains(aucid) && doesAucMatch(auc)) {
- if (first) {
- List<Integer> indexList = extrasMatchesCurrent.computeIfAbsent(aucid, k -> new ArrayList<>());
- indexList.add(index);
- } else {
- List<Integer> indexList = extrasMatches.computeIfAbsent(aucid, k -> new ArrayList<>());
- if (indexList.contains(index - 1)) {
- List<Integer> indexListCurrent = extrasMatchesCurrent.computeIfAbsent(aucid, k -> new ArrayList<>());
- indexListCurrent.add(index);
- }
- }
- } else {
- dontMatch.add(aucid);
- }
- }
- }
-
- }
-
- extrasMatches = (HashMap<String, List<Integer>>) extrasMatchesCurrent.clone();
- extrasMatchesCurrent.clear();
- first = false;
- }
- matches.addAll(extrasMatches.keySet());
-
- return matches;
- }
-
- private final ExecutorService es = Executors.newSingleThreadExecutor();
-
- public void updateSearch() {
- if (!NotEnoughUpdates.INSTANCE.config.neuAuctionHouse.enableNeuAuctionHouse) {
- return;
- }
-
- if (searchField == null || priceField == null || priceFilterField == null || binPriceFilterField == null)
- init();
- long currentTime = System.currentTimeMillis();
-
- es.submit(() -> {
- if (currentTime - lastUpdateSearch < 100) {
- shouldUpdateSearch = true;
- return;
- }
-
- lastUpdateSearch = currentTime;
- shouldUpdateSearch = false;
-
- scrollAmount = 0;
- try {
- HashSet<String> auctionIdsNew = new HashSet<>();
- auctionIdsNew.clear();
- if (filterMyAuctions) {
- for (String aucid : manager.auctionManager.getPlayerBids()) {
- APIManager.Auction auc = manager.auctionManager.getAuctionItems().get(aucid);
- if (doesAucMatch(auc)) {
- auctionIdsNew.add(aucid);
- }
- }
- } else if (searchField.getText().length() == 0) {
- for (Map.Entry<String, APIManager.Auction> entry : manager.auctionManager.getAuctionItems().entrySet()) {
- if (doesAucMatch(entry.getValue())) {
- auctionIdsNew.add(entry.getKey());
- }
- }
- if (NotEnoughUpdates.INSTANCE.config.neuAuctionHouse.saveLastSearch) {
- lastSearch = "";
- }
- } else {
- String query = searchField.getText();
-
- if (NotEnoughUpdates.INSTANCE.config.neuAuctionHouse.saveLastSearch) {
- lastSearch = query;
- }
- Set<String> dontMatch = new HashSet<>();
-
- HashSet<String> allMatch = new HashSet<>();
- if (query.contains("!")) { //only used for inverted queries, so dont need to populate unless ! in query
- for (Map.Entry<String, APIManager.Auction> entry : manager.auctionManager.getAuctionItems().entrySet()) {
- if (doesAucMatch(entry.getValue())) {
- allMatch.add(entry.getKey());
- } else {
- dontMatch.add(entry.getKey());
- }
- }
- }
-
- boolean invert = false;
-
- StringBuilder query2 = new StringBuilder();
- char lastOp = '|';
- for (char c : query.toCharArray()) {
- if (query2.toString().trim().isEmpty() && c == '!') {
- invert = true;
- } else if (c == '|' || c == '&') {
- if (lastOp == '|') {
- HashSet<String> result = search(query2.toString(), dontMatch);
- if (!invert) {
- auctionIdsNew.addAll(result);
- } else {
- HashSet<String> allClone = (HashSet<String>) allMatch.clone();
- allClone.removeAll(result);
- auctionIdsNew.addAll(allClone);
- }
- } else if (lastOp == '&') {
- HashSet<String> result = search(query2.toString(), dontMatch);
- if (!invert) {
- auctionIdsNew.retainAll(result);
- } else {
- auctionIdsNew.removeAll(result);
- }
- }
-
- query2 = new StringBuilder();
- invert = false;
- lastOp = c;
- } else {
- query2.append(c);
- }
- }
- if (lastOp == '|') {
- HashSet<String> result = search(query2.toString(), dontMatch);
- if (!invert) {
- auctionIdsNew.addAll(result);
- } else {
- HashSet<String> allClone = (HashSet<String>) allMatch.clone();
- allClone.removeAll(result);
- auctionIdsNew.addAll(allClone);
- }
- } else if (lastOp == '&') {
- HashSet<String> result = search(query2.toString(), dontMatch);
- if (!invert) {
- auctionIdsNew.retainAll(result);
- } else {
- auctionIdsNew.removeAll(result);
- }
- }
- }
- auctionIds = auctionIdsNew;
- sortItems();
- } catch (Exception e) {
- shouldUpdateSearch = true;
- }
- });
- }
-
- public void sortItems() throws ConcurrentModificationException {
- if (!NotEnoughUpdates.INSTANCE.config.neuAuctionHouse.enableNeuAuctionHouse) {
- return;
- }
-
- try {
- List<String> sortedAuctionIdsNew = new ArrayList<>();
-
- sortedAuctionIdsNew.addAll(auctionIds);
- sortedAuctionIdsNew.sort((o1, o2) -> {
- APIManager.Auction auc1 = manager.auctionManager.getAuctionItems().get(o1);
- APIManager.Auction auc2 = manager.auctionManager.getAuctionItems().get(o2);
-
- if (auc1 == null) return 1;
- if (auc2 == null) return -1;
-
- if (sortMode == SORT_MODE_HIGH) {
- long price1 = Math.max(auc1.highest_bid_amount, auc1.starting_bid);
- long price2 = Math.max(auc2.highest_bid_amount, auc2.starting_bid);
- long diff = price2 - price1;
- if (diff != 0) {
- return Long.compare(price2, price1);
- }
- } else if (sortMode == SORT_MODE_LOW) {
- long price1 = Math.max(auc1.highest_bid_amount, auc1.starting_bid);
- long price2 = Math.max(auc2.highest_bid_amount, auc2.starting_bid);
- long diff = price1 - price2;
- if (diff != 0) {
- return Long.compare(price1, price2);
- }
- } else {
- long end1 = auc1.end;
- long end2 = auc2.end;
-
- if (end1 < System.currentTimeMillis()) return 999999;
- if (end2 < System.currentTimeMillis()) return -999999;
-
- int diff = (int) (end1 - end2);
- if (diff != 0) {
- return diff;
- }
- }
- return o1.compareTo(o2);
- });
-
- sortedAuctionIds = sortedAuctionIdsNew;
- } catch (Exception e) {
- shouldSortItems = true;
- }
- }
-
- public boolean keyboardInput() {
- if (!NotEnoughUpdates.INSTANCE.config.neuAuctionHouse.enableNeuAuctionHouse) {
- return false;
- }
-
- if (isEditingPrice() && Keyboard.getEventKey() == Keyboard.KEY_RETURN) {
- Minecraft.getMinecraft().displayGuiScreen(null);
- } else if (Keyboard.getEventKey() == Keyboard.KEY_ESCAPE) {
- if (Minecraft.getMinecraft().currentScreen instanceof GuiEditSign) {
- priceField.setText("");
- GuiEditSign editSign = (GuiEditSign) Minecraft.getMinecraft().currentScreen;
- TileEntitySign tes = (TileEntitySign) Utils.getField(GuiEditSign.class, editSign,
- "tileSign", "field_146848_f"
- );
- tes.lineBeingEdited = 0;
- tes.signText[0] = new ChatComponentText(priceField.getText());
- }
- return false;
- }
- if (Keyboard.getEventKeyState()) return keyTyped(Keyboard.getEventCharacter(), Keyboard.getEventKey());
- return true;
- }
-
- public boolean keyTyped(char typedChar, int keyCode) {
- if (searchField == null || priceField == null || priceFilterField == null || binPriceFilterField == null)
- init();
-
- if (!isEditingPrice()) {
- if (this.priceFilterField.textboxKeyTyped(typedChar, keyCode)) {
- this.updateSearch();
- return true;
- }
- if (this.binPriceFilterField.textboxKeyTyped(typedChar, keyCode)) {
- this.updateSearch();
- return true;
- }
- if (this.searchField.textboxKeyTyped(typedChar, keyCode)) {
- lastSearchFieldUpdate = System.currentTimeMillis();
- this.updateSearch();
- return true;
- }
- } else {
- if (!priceField.isFocused()) priceField.setFocused(searchField.isFocused() && priceFilterField.isFocused());
- return priceField.textboxKeyTyped(typedChar, keyCode);
- }
- return false;
- }
-
- private void increasePriceByFactor(float factor) {
- String price = priceField.getText().trim();
- StringBuilder priceNumbers = new StringBuilder();
- for (int i = 0; i < price.length(); i++) {
- char c = price.charAt(i);
- if ((int) c >= 48 && (int) c <= 57) {
- priceNumbers.append(c);
- } else {
- break;
- }
- }
- int priceI = 0;
- if (priceNumbers.length() > 0) {
- priceI = Integer.parseInt(priceNumbers.toString());
- }
- String end = price.substring(priceNumbers.length());
- priceField.setText((int) (priceI * factor) + end);
- }
-
- private long getPriceFilterAmount() {
- return getNumberFromTextBox(priceFilterField);
- }
-
- private long getNumberFromTextBox(GuiTextField textField) {
- if (textField.getText().equals("")) {
- return -2;
- }
- try {
- long parsed = Long.parseLong(textField.getText());
- if (parsed < 0) {
- return -1;
- }
- return parsed;
- } catch (NumberFormatException e) {
- return -1;
- }
- }
-
- private long getBinPriceFilterAmount() {
- return getNumberFromTextBox(binPriceFilterField);
- }
-
- protected void mouseClicked(int mouseX, int mouseY, int mouseButton) {
- boolean wasFocused = searchField.isFocused();
- searchField.mouseClicked(mouseX, mouseY, mouseButton);
- if (mouseButton == 1 && !wasFocused && searchField.isFocused()) {
- searchField.setText("");
- }
- priceField.mouseClicked(mouseX, mouseY, mouseButton);
- priceFilterField.mouseClicked(mouseX, mouseY, mouseButton);
- binPriceFilterField.mouseClicked(mouseX, mouseY, mouseButton);
-
- int totalItems = auctionIds.size();
- int itemsScroll = (int) Math.floor((totalItems * scrollAmount) / 9f) * 9;
-
- int maxItemScroll = Math.max(0, totalItems - (5 + splits) * 9);
- itemsScroll = Math.min(itemsScroll, maxItemScroll);
-
- //Categories
- if (mouseY > guiTop - 28 && mouseY < guiTop + 4) {
- if (mouseX > guiLeft && mouseX < guiLeft + 168) {
- int offset = mouseX - guiLeft;
- int clickedCat = offset / 28;
- if (clickedMainCategory == clickedCat) {
- clickedMainCategory = -1;
- } else {
- clickedMainCategory = clickedCat;
- }
- clickedSubCategory = -1;
- updateSearch();
- Utils.playPressSound();
- return;
- }
- }
-
- if (clickedMainCategory >= 0 && clickedMainCategory < mainCategories.length) {
- Category mainCategory = mainCategories[clickedMainCategory];
-
- if (mouseX > guiLeft - 28 && mouseX < guiLeft) {
- int offset = mouseY - (guiTop + 17);
- if (offset > 0) {
- int clicked = offset / 28 - 1;
- if (clicked != clickedSubCategory && clicked < mainCategory.subcategories.length) {
- clickedSubCategory = clicked;
- updateSearch();
- Utils.playPressSound();
- return;
- }
- }
- }
- }
-
- if (mouseY > guiTop + 112 + 18 * splits && mouseY < guiTop + 112 + 18 * splits + 16) {
- if (mouseX > guiLeft + 9 && mouseX < guiLeft + 9 + controls.length * 18 - 2) {
- int offset = mouseX - (guiLeft + 9);
- int index = offset / 18;
- boolean rightClicked = Mouse.getEventButton() == 1;
- switch (index) {
- case 0:
- if (rightClicked) {
- dungeonFilter--;
- if (dungeonFilter < DUNGEON_FILTER_ALL) dungeonFilter = DUNGEON_FILTER_5;
- } else {
- dungeonFilter++;
- if (dungeonFilter > DUNGEON_FILTER_5) dungeonFilter = DUNGEON_FILTER_ALL;
- }
- break;
- case 1:
- if (rightClicked) {
- sortMode--;
- if (sortMode < SORT_MODE_HIGH) sortMode = SORT_MODE_SOON;
- } else {
- sortMode++;
- if (sortMode > SORT_MODE_SOON) sortMode = SORT_MODE_HIGH;
- }
- break;
- case 2:
- if (rightClicked) {
- rarityFilter--;
- if (rarityFilter < -1) rarityFilter = Utils.rarityArr.length - 1;
- } else {
- rarityFilter++;
- if (rarityFilter >= Utils.rarityArr.length) rarityFilter = -1;
- }
- break;
- case 3:
- break;
- case 4:
- filterMyAuctions = !filterMyAuctions;
- break;
- case 5:
- break;
- case 6:
- if (rightClicked) {
- binFilter--;
- if (binFilter < BIN_FILTER_ALL) binFilter = BIN_FILTER_AUC;
- } else {
- binFilter++;
- if (binFilter > BIN_FILTER_AUC) binFilter = BIN_FILTER_ALL;
- }
- break;
- case 7:
- if (rightClicked) {
- enchFilter--;
- if (enchFilter < ENCH_FILTER_ALL) enchFilter = ENCH_FILTER_ENCHHPB;
- } else {
- enchFilter++;
- if (enchFilter > ENCH_FILTER_ENCHHPB) enchFilter = ENCH_FILTER_ALL;
- }
- break;
- case 8:
- if (rightClicked) {
- if (currentAucId != null) {
- StringSelection selection = new StringSelection(niceAucId(currentAucId));
- Toolkit.getDefaultToolkit().getSystemClipboard().setContents(selection, selection);
- }
- } else {
- manager.auctionManager.calculateStats();
- }
- }
- updateSearch();
- Utils.playPressSound();
- }
- }
- boolean hasPopup = false;
- if (mouseButton == 0 && Minecraft.getMinecraft().currentScreen instanceof GuiChest) {
- hasPopup = true;
- GuiChest auctionView = (GuiChest) Minecraft.getMinecraft().currentScreen;
- ContainerChest container = (ContainerChest) auctionView.inventorySlots;
- String containerName = container.getLowerChestInventory().getDisplayName().getUnformattedText();
-
- if (containerName.trim().equals("Auction View") || containerName.trim().equals("BIN Auction View")) {
-
- if (mouseX > guiLeft + getXSize() + 4 + 31 && mouseX < guiLeft + getXSize() + 4 + 31 + 16) {
- boolean leftFiller = isGuiFiller(auctionView.inventorySlots.getSlot(29).getStack());//isBin
- if (mouseY > guiTop + 35 && mouseY < guiTop + 35 + 16) {
- ItemStack topStack = auctionView.inventorySlots.getSlot(13).getStack();
- if (topStack != null) {
- String line = findStrStart(topStack, EnumChatFormatting.GRAY + "Seller: ");
- String[] split = line.split(" ");
- String seller = split[split.length - 1];
- StringSelection selection = new StringSelection(seller);
- Toolkit.getDefaultToolkit().getSystemClipboard().setContents(selection, selection);
- }
- } else if (mouseY > guiTop + 100 && mouseY < guiTop + 100 + 16) {
- int slotClick = leftFiller ? 31 : 29;
- Minecraft.getMinecraft().playerController.windowClick(auctionView.inventorySlots.windowId,
- slotClick, 2, 3, Minecraft.getMinecraft().thePlayer
- );
-
- if (!leftFiller) {
- if (auctionView.inventorySlots.getSlot(29).getStack()
- .getDisplayName().trim().equals(
- EnumChatFormatting.GOLD + "Collect Auction")) {
- manager.auctionManager.getPlayerBids().remove(currentAucId);
- auctionIds.remove(currentAucId);
- }
- }
-
- Utils.playPressSound();
- } else if (mouseY > guiTop + 126 && mouseY < guiTop + 126 + 16 && !leftFiller) {
- priceField.setFocused(true);
- Minecraft.getMinecraft().playerController.windowClick(auctionView.inventorySlots.windowId,
- 31, 2, 3, Minecraft.getMinecraft().thePlayer
- );
- Utils.playPressSound();
- }
- }
- } else if (containerName.trim().equals("Confirm Bid") || containerName.trim().equals("Confirm Purchase")) {
- if (mouseX > guiLeft + getXSize() + 4 + 31 && mouseX < guiLeft + getXSize() + 4 + 31 + 16) {
- if (mouseY > guiTop + 31 && mouseY < guiTop + 31 + 16) {
- if (currentAucId != null) {
- manager.auctionManager.getPlayerBids().add(currentAucId);
- latestBid = currentAucId;
- latestBidMillis = System.currentTimeMillis();
- //reset timer to 2m if below
- if (manager.auctionManager.getAuctionItems().get(currentAucId) != null &&
- manager.auctionManager.getAuctionItems().get(currentAucId).end -
- System.currentTimeMillis() < 2 * 60 * 1000) {
- manager.auctionManager.getAuctionItems().get(currentAucId).end =
- System.currentTimeMillis() + 2 * 60 * 1000;
- }
- }
- Minecraft.getMinecraft().playerController.windowClick(auctionView.inventorySlots.windowId,
- 11, 2, 3, Minecraft.getMinecraft().thePlayer
- );
- } else if (mouseY > guiTop + 125 && mouseY < guiTop + 125 + 16) {
- Minecraft.getMinecraft().playerController.windowClick(auctionView.inventorySlots.windowId,
- 15, 2, 3, Minecraft.getMinecraft().thePlayer
- );
- }
- Utils.playPressSound();
- }
- }
- }
- int auctionViewLeft = guiLeft + getXSize() + 4;
-
- if (mouseButton == 0 && isEditingPrice()) {
-
- if (mouseX > auctionViewLeft + 16 && mouseX < auctionViewLeft + 16 + 64) {
- if (mouseY > guiTop + 32 && mouseY < guiTop + 32 + 16) {
- if (mouseX < auctionViewLeft + 16 + 32) {
- //top left
- increasePriceByFactor(2);
- } else {
- //top right
- increasePriceByFactor(1.5f);
- }
- Utils.playPressSound();
- } else if (mouseY > guiTop + 50 && mouseY < guiTop + 50 + 16) {
- if (mouseX < auctionViewLeft + 16 + 32) {
- //mid left
- increasePriceByFactor(1.25f);
- } else {
- //mid right
- increasePriceByFactor(1.1f);
- }
- Utils.playPressSound();
- } else if (mouseY > guiTop + 68 && mouseY < guiTop + 68 + 16) {
- //bottom
- Utils.playPressSound();
- Minecraft.getMinecraft().displayGuiScreen(null);
- }
- }
-
- this.drawTexturedModalRect(auctionViewLeft + 16, guiTop + 32, 0, 16, 30, 16);
- this.drawTexturedModalRect(auctionViewLeft + 16 + 34, guiTop + 32, 0, 16, 30, 16);
- this.drawTexturedModalRect(auctionViewLeft + 16, guiTop + 50, 0, 16, 30, 16);
- this.drawTexturedModalRect(auctionViewLeft + 16 + 34, guiTop + 50, 0, 16, 30, 16);
- this.drawTexturedModalRect(auctionViewLeft + 16, guiTop + 68, 0, 32, 64, 16);
- } else if (!hasPopup && NotEnoughUpdates.INSTANCE.config.neuAuctionHouse.priceFiltering) {
-
- if (mouseX > auctionViewLeft + 16 && mouseX < auctionViewLeft + 16 + 64) {
- if (mouseY > guiTop + 32 && mouseY < guiTop + 32 + 16) {
- if (mouseX < auctionViewLeft + 16 + 32) {
- //top left
- currentPriceFilterType = PriceFilter.Less;
- } else {
- //top right
- currentPriceFilterType = PriceFilter.Greater;
- }
- Utils.playPressSound();
- updateSearch();
- } else if (mouseY > guiTop + 50 && mouseY < guiTop + 50 + 16) {
- //middle
- currentPriceFilterType = PriceFilter.Equal;
- Utils.playPressSound();
- updateSearch();
- }
- }
-
- if (mouseX > auctionViewLeft + 16 && mouseX < auctionViewLeft + 16 + 64) {
- if (mouseY > guiTop + 32 + binPriceFilterYOffset && mouseY < guiTop + 32 + 16 + binPriceFilterYOffset) {
- if (mouseX < auctionViewLeft + 16 + 32) {
- //top left
- currentBinPriceFilterType = PriceFilter.Less;
- } else {
- //top right
- currentBinPriceFilterType = PriceFilter.Greater;
- }
- Utils.playPressSound();
- updateSearch();
- } else if (mouseY > guiTop + 50 + binPriceFilterYOffset && mouseY < guiTop + 50 + 16 + binPriceFilterYOffset) {
- //middle
- currentBinPriceFilterType = PriceFilter.Equal;
- Utils.playPressSound();
- updateSearch();
- }
- }
- }
- out:
- for (int i = 0; i < 5 + splits; i++) {
- int itemY = guiTop + i * 18 + 18;
- for (int j = 0; j < 9; j++) {
- int itemX = guiLeft + j * 18 + 9;
- int id = itemsScroll + i * 9 + j;
- if (auctionIds.size() <= id) break out;
-
- String aucid;
- try {
- aucid = sortedAuctionIds.get(id);
- } catch (IndexOutOfBoundsException e) {
- break out;
- }
-
- if (aucid == null) continue;
- APIManager.Auction auc = manager.auctionManager.getAuctionItems().get(aucid);
- if (auc != null) {
- if (mouseX > itemX && mouseX < itemX + 16) {
- if (mouseY > itemY && mouseY < itemY + 16) {
- if (Minecraft.getMinecraft().currentScreen instanceof GuiEditSign) {
- priceField.setText("");
- GuiEditSign editSign = (GuiEditSign) Minecraft.getMinecraft().currentScreen;
- TileEntitySign tes = (TileEntitySign) Utils.getField(GuiEditSign.class, editSign,
- "tileSign", "field_146848_f"
- );
- tes.lineBeingEdited = 0;
- tes.signText[0] = new ChatComponentText(priceField.getText());
- }
- startingBid = Math.max(auc.starting_bid, auc.highest_bid_amount);
- currAucIdSetTimer = System.currentTimeMillis();
- currentAucId = aucid;
-
- Minecraft.getMinecraft().thePlayer.sendChatMessage("/viewauction " + niceAucId(aucid));
- Utils.playPressSound();
- }
- }
- }
- }
- }
-
- int y = guiTop + 18 + (int) ((95 + ySplitSize * 2) * scrollAmount);
- if (mouseX > guiLeft + 175 && mouseX < guiLeft + 175 + 12) {
- if (mouseY > y && mouseY < y + 15) {
- scrollClicked = true;
- return;
- }
- }
- scrollClicked = false;
- }
-
- protected void mouseReleased(int mouseX, int mouseY, int state) {
- scrollClicked = false;
- }
-
- protected void mouseClickMove(int mouseX, int mouseY, int clickedMouseButton, long timeSinceLastClick) {
- if (scrollClicked) {
- int yMin = guiTop + 18 + 8;
- int yMax = guiTop + 18 + (95 + ySplitSize * 2) + 8;
-
- scrollAmount = (mouseY - yMin) / (float) (yMax - yMin);
- scrollAmount = Math.max(0, Math.min(1, scrollAmount));
- }
- }
-}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/auction/CustomAHGui.java b/src/main/java/io/github/moulberry/notenoughupdates/auction/CustomAHGui.java
deleted file mode 100644
index ca85ca1c..00000000
--- a/src/main/java/io/github/moulberry/notenoughupdates/auction/CustomAHGui.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (C) 2022 NotEnoughUpdates contributors
- *
- * This file is part of NotEnoughUpdates.
- *
- * NotEnoughUpdates is free software: you can redistribute it
- * and/or modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation, either
- * version 3 of the License, or (at your option) any later version.
- *
- * NotEnoughUpdates is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
- */
-
-package io.github.moulberry.notenoughupdates.auction;
-
-import net.minecraft.client.gui.GuiScreen;
-
-public class CustomAHGui extends GuiScreen {
- public CustomAHGui() {
- this.allowUserInput = true;
- }
-
- public boolean doesGuiPauseGame() {
- return false;
- }
-}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/listener/ChatListener.java b/src/main/java/io/github/moulberry/notenoughupdates/listener/ChatListener.java
index 8563189c..53b796ed 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/listener/ChatListener.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/listener/ChatListener.java
@@ -277,14 +277,6 @@ public class ChatListener {
}
}
}
- if (e.message.getFormattedText().contains(
- EnumChatFormatting.YELLOW + "Visit the Auction House to collect your item!")) {
- if (NotEnoughUpdates.INSTANCE.manager.auctionManager.customAH.latestBid != null &&
- System.currentTimeMillis() - NotEnoughUpdates.INSTANCE.manager.auctionManager.customAH.latestBidMillis < 5000) {
- NotEnoughUpdates.INSTANCE.sendChatMessage("/viewauction " +
- NotEnoughUpdates.INSTANCE.manager.auctionManager.customAH.niceAucId(NotEnoughUpdates.INSTANCE.manager.auctionManager.customAH.latestBid));
- }
- }
if (r != null) {
if (neu.manager.failViewItem(r)) {
e.setCanceled(true);
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/listener/NEUEventListener.java b/src/main/java/io/github/moulberry/notenoughupdates/listener/NEUEventListener.java
index 5b388dea..4a5df63f 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/listener/NEUEventListener.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/listener/NEUEventListener.java
@@ -35,8 +35,8 @@ import io.github.moulberry.notenoughupdates.miscfeatures.NPCRetexturing;
import io.github.moulberry.notenoughupdates.miscgui.AccessoryBagOverlay;
import io.github.moulberry.notenoughupdates.miscgui.GuiCustomEnchant;
import io.github.moulberry.notenoughupdates.miscgui.GuiItemRecipe;
-import io.github.moulberry.notenoughupdates.miscgui.hex.GuiCustomHex;
import io.github.moulberry.notenoughupdates.miscgui.StorageOverlay;
+import io.github.moulberry.notenoughupdates.miscgui.hex.GuiCustomHex;
import io.github.moulberry.notenoughupdates.overlays.OverlayManager;
import io.github.moulberry.notenoughupdates.overlays.TextOverlay;
import io.github.moulberry.notenoughupdates.overlays.TextTabOverlay;
@@ -265,8 +265,6 @@ public class NEUEventListener {
}
if (currentTime - lastSkyblockScoreboard < 5 * 60 * 1000) { //5 minutes
neu.manager.auctionManager.tick();
- } else {
- neu.manager.auctionManager.markNeedsUpdate();
}
}
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/listener/RenderListener.java b/src/main/java/io/github/moulberry/notenoughupdates/listener/RenderListener.java
index d4b9a60d..9b88a094 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/listener/RenderListener.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/listener/RenderListener.java
@@ -25,7 +25,6 @@ import com.google.gson.JsonObject;
import io.github.moulberry.notenoughupdates.NEUApi;
import io.github.moulberry.notenoughupdates.NEUOverlay;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
-import io.github.moulberry.notenoughupdates.auction.CustomAHGui;
import io.github.moulberry.notenoughupdates.core.GuiScreenElementWrapper;
import io.github.moulberry.notenoughupdates.dungeons.DungeonWin;
import io.github.moulberry.notenoughupdates.events.ButtonExclusionZoneEvent;
@@ -63,7 +62,6 @@ import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.gui.inventory.GuiChest;
import net.minecraft.client.gui.inventory.GuiContainer;
-import net.minecraft.client.gui.inventory.GuiEditSign;
import net.minecraft.client.gui.inventory.GuiInventory;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.player.EntityPlayer;
@@ -246,29 +244,10 @@ public class RenderListener {
lastGuiClosed = System.currentTimeMillis();
}
- neu.manager.auctionManager.customAH.lastGuiScreenSwitch = System.currentTimeMillis();
BetterContainers.reset();
inventoryLoaded = false;
inventoryLoadedTicks = 3;
- if (event.gui == null && neu.manager.auctionManager.customAH.isRenderOverAuctionView() &&
- !(Minecraft.getMinecraft().currentScreen instanceof CustomAHGui)) {
- event.gui = new CustomAHGui();
- }
-
- if (!(event.gui instanceof GuiChest || event.gui instanceof GuiEditSign)) {
- neu.manager.auctionManager.customAH.setRenderOverAuctionView(false);
- } else if (event.gui instanceof GuiChest && (neu.manager.auctionManager.customAH.isRenderOverAuctionView() ||
- Minecraft.getMinecraft().currentScreen instanceof CustomAHGui)) {
- GuiChest chest = (GuiChest) event.gui;
- ContainerChest container = (ContainerChest) chest.inventorySlots;
- String containerName = container.getLowerChestInventory().getDisplayName().getUnformattedText();
-
- neu.manager.auctionManager.customAH.setRenderOverAuctionView(
- containerName.trim().equals("Auction View") || containerName.trim().equals("BIN Auction View") ||
- containerName.trim().equals("Confirm Bid") || containerName.trim().equals("Confirm Purchase"));
- }
-
//OPEN
if (Minecraft.getMinecraft().currentScreen == null && event.gui instanceof GuiContainer) {
neu.overlay.reset();
@@ -342,8 +321,7 @@ public class RenderListener {
}
inDungeonPage = false;
- if ((NotificationHandler.shouldRenderOverlay(event.gui) || event.gui instanceof CustomAHGui) &&
- neu.isOnSkyblock()) {
+ if (NotificationHandler.shouldRenderOverlay(event.gui) && neu.isOnSkyblock()) {
ScaledResolution scaledresolution = new ScaledResolution(Minecraft.getMinecraft());
int width = scaledresolution.getScaledWidth();
@@ -442,8 +420,6 @@ public class RenderListener {
boolean tradeWindowActive = TradeWindow.tradeWindowActive(containerName);
boolean storageOverlayActive = StorageManager.getInstance().shouldRenderStorageOverlay(containerName);
- boolean customAhActive =
- event.gui instanceof CustomAHGui || neu.manager.auctionManager.customAH.isRenderOverAuctionView();
if (storageOverlayActive) {
StorageOverlay.getInstance().render();
@@ -451,7 +427,7 @@ public class RenderListener {
return;
}
- if (tradeWindowActive || customAhActive) {
+ if (tradeWindowActive) {
event.setCanceled(true);
ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
@@ -463,19 +439,11 @@ public class RenderListener {
if (event.mouseX < width * neu.overlay.getWidthMult() / 3 ||
event.mouseX > width - width * neu.overlay.getWidthMult() / 3) {
- if (customAhActive) {
- neu.manager.auctionManager.customAH.drawScreen(event.mouseX, event.mouseY);
- } else {
- TradeWindow.render(event.mouseX, event.mouseY);
- }
+ TradeWindow.render(event.mouseX, event.mouseY);
neu.overlay.render(false);
} else {
neu.overlay.render(false);
- if (customAhActive) {
- neu.manager.auctionManager.customAH.drawScreen(event.mouseX, event.mouseY);
- } else {
- TradeWindow.render(event.mouseX, event.mouseY);
- }
+ TradeWindow.render(event.mouseX, event.mouseY);
}
}
@@ -568,10 +536,7 @@ public class RenderListener {
boolean tradeWindowActive = TradeWindow.tradeWindowActive(containerName);
boolean storageOverlayActive = StorageManager.getInstance().shouldRenderStorageOverlay(containerName);
- boolean customAhActive =
- event.gui instanceof CustomAHGui || neu.manager.auctionManager.customAH.isRenderOverAuctionView();
-
- if (!(tradeWindowActive || storageOverlayActive || customAhActive)) {
+ if (!(tradeWindowActive || storageOverlayActive)) {
if (NotificationHandler.shouldRenderOverlay(event.gui) && neu.isOnSkyblock()) {
GlStateManager.pushMatrix();
if (!focusInv) {
@@ -1001,8 +966,6 @@ public class RenderListener {
boolean tradeWindowActive = TradeWindow.tradeWindowActive(containerName);
boolean storageOverlayActive = StorageManager.getInstance().shouldRenderStorageOverlay(containerName);
- boolean customAhActive =
- event.gui instanceof CustomAHGui || neu.manager.auctionManager.customAH.isRenderOverAuctionView();
if (storageOverlayActive) {
if (StorageOverlay.getInstance().mouseInput(mouseX, mouseY)) {
@@ -1011,13 +974,9 @@ public class RenderListener {
return;
}
- if (tradeWindowActive || customAhActive) {
+ if (tradeWindowActive) {
event.setCanceled(true);
- if (customAhActive) {
- neu.manager.auctionManager.customAH.handleMouseInput();
- } else {
- TradeWindow.handleMouseInput();
- }
+ TradeWindow.handleMouseInput();
neu.overlay.mouseInput();
return;
}
@@ -1157,8 +1116,6 @@ public class RenderListener {
boolean tradeWindowActive = TradeWindow.tradeWindowActive(containerName);
boolean storageOverlayActive = StorageManager.getInstance().shouldRenderStorageOverlay(containerName);
- boolean customAhActive =
- event.gui instanceof CustomAHGui || neu.manager.auctionManager.customAH.isRenderOverAuctionView();
if (storageOverlayActive) {
if (StorageOverlay.getInstance().keyboardInput()) {
@@ -1167,22 +1124,13 @@ public class RenderListener {
}
}
- if (tradeWindowActive || customAhActive) {
- if (customAhActive) {
- if (neu.manager.auctionManager.customAH.keyboardInput()) {
- event.setCanceled(true);
- Minecraft.getMinecraft().dispatchKeypresses();
- } else if (neu.overlay.keyboardInput(focusInv)) {
- event.setCanceled(true);
- }
- } else {
+ if (tradeWindowActive) {
TradeWindow.keyboardInput();
if (Keyboard.getEventKey() != Keyboard.KEY_ESCAPE) {
event.setCanceled(true);
Minecraft.getMinecraft().dispatchKeypresses();
neu.overlay.keyboardInput(focusInv);
}
- }
return;
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mbgui/MBGuiGroupFloating.java b/src/main/java/io/github/moulberry/notenoughupdates/mbgui/MBGuiGroupFloating.java
index c57f0b74..770a8423 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/mbgui/MBGuiGroupFloating.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/mbgui/MBGuiGroupFloating.java
@@ -19,8 +19,6 @@
package io.github.moulberry.notenoughupdates.mbgui;
-import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
-import io.github.moulberry.notenoughupdates.auction.CustomAHGui;
import io.github.moulberry.notenoughupdates.miscgui.GuiItemRecipe;
import io.github.moulberry.notenoughupdates.util.Utils;
import net.minecraft.client.Minecraft;
@@ -57,9 +55,7 @@ public class MBGuiGroupFloating extends MBGuiGroup {
public Map<MBGuiElement, Vector2f> getChildrenPosition() {
GuiScreen currentScreen = Minecraft.getMinecraft().currentScreen;
- if (currentScreen instanceof GuiContainer || currentScreen instanceof GuiItemRecipe
- || currentScreen instanceof CustomAHGui ||
- NotEnoughUpdates.INSTANCE.manager.auctionManager.customAH.isRenderOverAuctionView()) {
+ if (currentScreen instanceof GuiContainer || currentScreen instanceof GuiItemRecipe) {
if (lastScreen != currentScreen) {
lastScreen = currentScreen;
@@ -83,17 +79,11 @@ public class MBGuiGroupFloating extends MBGuiGroup {
guiTop = (int) Utils.getField(GuiContainer.class, currentContainer, "guiTop", "field_147009_r");
} catch (Exception ignored) {
}
- } else if (currentScreen instanceof GuiItemRecipe) {
+ } else {
xSize = ((GuiItemRecipe) currentScreen).xSize;
ySize = ((GuiItemRecipe) currentScreen).ySize;
guiLeft = ((GuiItemRecipe) currentScreen).guiLeft;
guiTop = ((GuiItemRecipe) currentScreen).guiTop;
- } else if (currentScreen instanceof CustomAHGui ||
- NotEnoughUpdates.INSTANCE.manager.auctionManager.customAH.isRenderOverAuctionView()) {
- xSize = NotEnoughUpdates.INSTANCE.manager.auctionManager.customAH.getXSize();
- ySize = NotEnoughUpdates.INSTANCE.manager.auctionManager.customAH.getYSize();
- guiLeft = NotEnoughUpdates.INSTANCE.manager.auctionManager.customAH.guiLeft;
- guiTop = NotEnoughUpdates.INSTANCE.manager.auctionManager.customAH.guiTop;
}
if (xSize <= 0 && ySize <= 0 && guiLeft <= 0 && guiTop <= 0) {
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java b/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java
index 49053316..b5411dcd 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java
@@ -34,8 +34,6 @@ import io.github.moulberry.notenoughupdates.miscgui.GuiEnchantColour;
import io.github.moulberry.notenoughupdates.miscgui.GuiInvButtonEditor;
import io.github.moulberry.notenoughupdates.miscgui.NEUOverlayPlacements;
import io.github.moulberry.notenoughupdates.options.customtypes.NEUDebugFlag;
-import io.github.moulberry.notenoughupdates.options.seperateSections.Garden;
-import io.github.moulberry.notenoughupdates.options.seperateSections.WorldConfig;
import io.github.moulberry.notenoughupdates.options.seperateSections.AHGraph;
import io.github.moulberry.notenoughupdates.options.seperateSections.AHTweaks;
import io.github.moulberry.notenoughupdates.options.seperateSections.AccessoryBag;
@@ -47,6 +45,7 @@ import io.github.moulberry.notenoughupdates.options.seperateSections.DungeonMapC
import io.github.moulberry.notenoughupdates.options.seperateSections.Dungeons;
import io.github.moulberry.notenoughupdates.options.seperateSections.Enchanting;
import io.github.moulberry.notenoughupdates.options.seperateSections.Fishing;
+import io.github.moulberry.notenoughupdates.options.seperateSections.Garden;
import io.github.moulberry.notenoughupdates.options.seperateSections.ImprovedSBMenu;
import io.github.moulberry.notenoughupdates.options.seperateSections.InventoryButtons;
import io.github.moulberry.notenoughupdates.options.seperateSections.ItemOverlays;
@@ -57,7 +56,6 @@ import io.github.moulberry.notenoughupdates.options.seperateSections.MinionHelpe
import io.github.moulberry.notenoughupdates.options.seperateSections.Misc;
import io.github.moulberry.notenoughupdates.options.seperateSections.MiscOverlays;
import io.github.moulberry.notenoughupdates.options.seperateSections.Museum;
-import io.github.moulberry.notenoughupdates.options.seperateSections.NeuAuctionHouse;
import io.github.moulberry.notenoughupdates.options.seperateSections.Notifications;
import io.github.moulberry.notenoughupdates.options.seperateSections.PetOverlay;
import io.github.moulberry.notenoughupdates.options.seperateSections.ProfileViewer;
@@ -306,13 +304,6 @@ public class NEUConfig extends Config {
@Expose
@Category(
- name = "NEU Auction House",
- desc = "NEU Auction House"
- )
- public NeuAuctionHouse neuAuctionHouse = new NeuAuctionHouse();
-
- @Expose
- @Category(
name = "Improved SB Menus",
desc = "Improved SB Menus"
)
@@ -519,7 +510,6 @@ public class NEUConfig extends Config {
add("/storage:Storage:CHEST");
add("/wardrobe:Wardrobe:LEATHER_CHESTPLATE");
add("/pets:Pets:BONE");
- add("neuah:NEU Auction House:GOLD_BLOCK");
add("/bz:Bazaar:GOLD_BARDING");
}};
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/NeuAuctionHouse.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/NeuAuctionHouse.java
deleted file mode 100644
index 6c55fd09..00000000
--- a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/NeuAuctionHouse.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright (C) 2022 NotEnoughUpdates contributors
- *
- * This file is part of NotEnoughUpdates.
- *
- * NotEnoughUpdates is free software: you can redistribute it
- * and/or modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation, either
- * version 3 of the License, or (at your option) any later version.
- *
- * NotEnoughUpdates is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
- */
-
-package io.github.moulberry.notenoughupdates.options.seperateSections;
-
-import com.google.gson.annotations.Expose;
-import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigEditorBoolean;
-import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigEditorSlider;
-import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigOption;
-
-public class
-NeuAuctionHouse {
- @Expose
- @ConfigOption(
- name = "Enable NeuAH",
- desc = "Turn on the NEU Auction House. \u00A7cWARNING: May negatively impact performance on low-end machines"
- )
- @ConfigEditorBoolean
- public boolean enableNeuAuctionHouse = false;
-
- @Expose
- @ConfigOption(
- name = "Disable AH Scroll",
- desc = "Disable scrolling using the scroll wheel inside NeuAH.\n" +
- "This should be used if you want to be able to scroll through tooltips"
- )
- @ConfigEditorBoolean
- public boolean disableAhScroll = false;
-
- @Expose
- @ConfigOption(
- name = "AH Notification (Mins)",
- desc = "Change the amount of time (in minutes) before the \"Ending Soon\" notification for an auction you have bid on"
- )
- @ConfigEditorSlider(
- minValue = 1f,
- maxValue = 10f,
- minStep = 1f
- )
- public int ahNotification = 5;
-
- @Expose
- @ConfigOption(
- name = "Price Filtering in NEU AH",
- desc = "The ability to filter the price of items and their respective average BIN values"
- )
- @ConfigEditorBoolean
- public boolean priceFiltering = false;
-
- @Expose
- @ConfigOption(
- name = "Save Last Search",
- desc = "Saving the last query when closing the neuah"
- )
- @ConfigEditorBoolean
- public boolean saveLastSearch = true;
-}