diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2022-08-09 23:52:31 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-09 21:52:31 +0000 |
commit | 5308904bb63a3abcec0dadb1af57f590e0e5a021 (patch) | |
tree | 96ceedf7156803f77e200196718a9d125f0b98d8 /src/main/java | |
parent | 197e463ad2909708e78e693ba1f9a820295cea5a (diff) | |
download | NotEnoughUpdates-5308904bb63a3abcec0dadb1af57f590e0e5a021.tar.gz NotEnoughUpdates-5308904bb63a3abcec0dadb1af57f590e0e5a021.tar.bz2 NotEnoughUpdates-5308904bb63a3abcec0dadb1af57f590e0e5a021.zip |
adding >2.1b support for custom ah (#214)
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/io/github/moulberry/notenoughupdates/auction/APIManager.java | 6 | ||||
-rw-r--r-- | src/main/java/io/github/moulberry/notenoughupdates/auction/CustomAH.java | 28 |
2 files changed, 17 insertions, 17 deletions
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 7c58cb4d..29b5f4a5 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/auction/APIManager.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/auction/APIManager.java @@ -123,7 +123,7 @@ public class APIManager { public class Auction { public String auctioneerUuid; public long end; - public int starting_bid; + public long starting_bid; public int highest_bid_amount; public int bid_count; public boolean bin; @@ -137,7 +137,7 @@ public class APIManager { public int enchLevel = 0; //0 = clean, 1 = ench, 2 = ench/hpb public Auction( - String auctioneerUuid, long end, int starting_bid, int highest_bid_amount, int bid_count, + 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; @@ -540,7 +540,7 @@ public class APIManager { 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(); + 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; diff --git a/src/main/java/io/github/moulberry/notenoughupdates/auction/CustomAH.java b/src/main/java/io/github/moulberry/notenoughupdates/auction/CustomAH.java index d8fedecb..f0ef1ec6 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/auction/CustomAH.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/auction/CustomAH.java @@ -94,7 +94,7 @@ public class CustomAH extends Gui { private boolean shouldUpdateSearch = false; private boolean shouldSortItems = false; - private int startingBid = 0; + private long startingBid = 0; private String currentAucId = null; private int clickedMainCategory = -1; @@ -640,7 +640,7 @@ public class CustomAH extends Gui { } } if (priceNumbers.length() > 0) { - startingBid = Integer.parseInt(priceNumbers.toString()); + startingBid = Long.parseLong(priceNumbers.toString()); } } } @@ -1578,18 +1578,18 @@ public class CustomAH extends Gui { if (auc2 == null) return -1; if (sortMode == SORT_MODE_HIGH) { - int price1 = Math.max(auc1.highest_bid_amount, auc1.starting_bid); - int price2 = Math.max(auc2.highest_bid_amount, auc2.starting_bid); - int diff = price2 - price1; + 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 diff; + return Long.compare(price2, price1); } } else if (sortMode == SORT_MODE_LOW) { - int price1 = Math.max(auc1.highest_bid_amount, auc1.starting_bid); - int price2 = Math.max(auc2.highest_bid_amount, auc2.starting_bid); - int diff = price1 - price2; + 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 diff; + return Long.compare(price1, price2); } } else { long end1 = auc1.end; @@ -1679,16 +1679,16 @@ public class CustomAH extends Gui { priceField.setText((int) (priceI * factor) + end); } - private int getPriceFilterAmount() { + private long getPriceFilterAmount() { return getNumberFromTextBox(priceFilterField); } - private int getNumberFromTextBox(GuiTextField textField) { + private long getNumberFromTextBox(GuiTextField textField) { if (textField.getText().equals("")) { return -2; } try { - int parsed = Integer.parseInt(textField.getText()); + long parsed = Long.parseLong(textField.getText()); if (parsed < 0) { return -1; } @@ -1698,7 +1698,7 @@ public class CustomAH extends Gui { } } - private int getBinPriceFilterAmount() { + private long getBinPriceFilterAmount() { return getNumberFromTextBox(binPriceFilterField); } |