aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorLorenz <lo.scherf@gmail.com>2022-08-10 15:46:52 +0200
committerLorenz <lo.scherf@gmail.com>2022-08-10 15:46:52 +0200
commit4181ad5f29c0a0476c160c0605d7a1c58a106067 (patch)
treefabdb7cc3223db1f4bd0c1dc1b1e76fed1f9b166 /src/main/java
parent28975d2a1e9f2ca6cac1a012f3b9d3d7d45adaf2 (diff)
parent4cf7ec9f8ee48b7ea22b2d514c3e7ff1be7daf0d (diff)
downloadNotEnoughUpdates-4181ad5f29c0a0476c160c0605d7a1c58a106067.tar.gz
NotEnoughUpdates-4181ad5f29c0a0476c160c0605d7a1c58a106067.tar.bz2
NotEnoughUpdates-4181ad5f29c0a0476c160c0605d7a1c58a106067.zip
Merge branch 'master' into minion_helper_2
# Conflicts: # src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java # src/main/java/io/github/moulberry/notenoughupdates/commands/dungeon/MapCommand.java # src/main/java/io/github/moulberry/notenoughupdates/listener/RenderListener.java
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java18
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java8
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/auction/APIManager.java6
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/auction/CustomAH.java28
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/commands/dungeon/MapCommand.java6
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/commands/misc/CalculatorCommand.java16
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/dungeons/DungeonMap.java44
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/dungeons/GuiDungeonMapEditor.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/listener/ChatListener.java10
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/listener/RenderListener.java328
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AbiphoneWarning.java215
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/BazaarSacksProfit.java182
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/EnchantingSolvers.java4
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscgui/CalendarOverlay.java26
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiPriceGraph.java20
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscgui/NeuSearchCalculator.java55
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscgui/SignCalculator.java18
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiContainer.java7
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Dungeons.java4
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Enchanting.java9
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Misc.java12
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/TooltipTweaks.java8
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java79
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java26
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/weight/lily/LilyDungeonsWeight.java145
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/weight/lily/LilySkillsWeight.java101
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/weight/lily/LilySlayerWeight.java91
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/weight/lily/LilyWeight.java48
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/weight/senither/SenitherDungeonsWeight.java80
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/weight/senither/SenitherSkillsWeight.java66
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/weight/senither/SenitherSlayerWeight.java66
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/weight/senither/SenitherWeight.java50
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/weight/weight/DungeonsWeight.java41
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/weight/weight/SkillsWeight.java39
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/weight/weight/SlayerWeight.java39
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/weight/weight/Weight.java67
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/weight/weight/WeightStruct.java54
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/util/Constants.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/util/SkytilsCompat.java64
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java4
40 files changed, 1799 insertions, 289 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java
index de050e5e..e51f118e 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java
@@ -36,9 +36,11 @@ import io.github.moulberry.notenoughupdates.mbgui.MBAnchorPoint;
import io.github.moulberry.notenoughupdates.mbgui.MBGuiElement;
import io.github.moulberry.notenoughupdates.mbgui.MBGuiGroupAligned;
import io.github.moulberry.notenoughupdates.mbgui.MBGuiGroupFloating;
+import io.github.moulberry.notenoughupdates.miscfeatures.EnchantingSolvers;
import io.github.moulberry.notenoughupdates.miscfeatures.PetInfoOverlay;
import io.github.moulberry.notenoughupdates.miscfeatures.SunTzu;
import io.github.moulberry.notenoughupdates.miscgui.GuiPriceGraph;
+import io.github.moulberry.notenoughupdates.miscgui.NeuSearchCalculator;
import io.github.moulberry.notenoughupdates.options.NEUConfigEditor;
import io.github.moulberry.notenoughupdates.util.Constants;
import io.github.moulberry.notenoughupdates.util.GuiTextures;
@@ -377,7 +379,7 @@ public class NEUOverlay extends Gui {
}
//Search bar text
- fr.drawString(textField.getText(), (int) x + 5,
+ fr.drawString(NeuSearchCalculator.format(textField.getText()), (int) x + 5,
(int) y - 4 + getHeight() / 2, Color.WHITE.getRGB()
);
@@ -548,6 +550,7 @@ public class NEUOverlay extends Gui {
@Override
public void mouseClick(float x, float y, int mouseX, int mouseY) {
if (!NotEnoughUpdates.INSTANCE.config.toolbar.quickCommands) return;
+ if (EnchantingSolvers.disableButtons()) return;
if ((NotEnoughUpdates.INSTANCE.config.toolbar.quickCommandsClickType != 0 && Mouse.getEventButtonState()) ||
(NotEnoughUpdates.INSTANCE.config.toolbar.quickCommandsClickType == 0 && !Mouse.getEventButtonState() &&
@@ -570,6 +573,7 @@ public class NEUOverlay extends Gui {
@Override
public void render(float x, float y) {
if (!NotEnoughUpdates.INSTANCE.config.toolbar.quickCommands) return;
+ if (EnchantingSolvers.disableButtons()) return;
int paddingUnscaled = getPaddingUnscaled();
int bigItemSize = getSearchBarYSize();
@@ -1947,7 +1951,7 @@ public class NEUOverlay extends Gui {
if (textField.getText().toLowerCase().contains("lunar")) {
Minecraft.getMinecraft().getTextureManager().bindTexture(ATMOULBERRYWHYISMYLUNARCLIENTBUGGING);
GlStateManager.color(1, 1, 1, 1);
- GlStateManager.translate(0,0,100);
+ GlStateManager.translate(0, 0, 100);
Utils.drawTexturedRect((width + 410) / 2f, (height + 450) / 2f - 114, 113, 64, GL11.GL_LINEAR);
GlStateManager.bindTexture(0);
}
@@ -2379,10 +2383,10 @@ public class NEUOverlay extends Gui {
Utils.drawTexturedRect((float) ((width - 224.1) / 2f), yNumber, 31, 86, GL11.GL_NEAREST);
GlStateManager.bindTexture(0);
- Utils.drawItemStack(slot1, (int) ((width - 208) / 2f), (int) ((height + 60) / 2f - 105));
- Utils.drawItemStack(slot2, (int) ((width - 208) / 2f), (int) ((height + 60) / 2f - 105) + 18);
- Utils.drawItemStack(slot3, (int) ((width - 208) / 2f), (int) ((height + 60) / 2f - 105) + 36);
- Utils.drawItemStack(slot4, (int) ((width - 208) / 2f), (int) ((height + 60) / 2f - 105) + 54);
+ Utils.drawItemStack(slot1, (int) ((width - 208) / 2f), (int) ((height + 60) / 2f - 105), true);
+ Utils.drawItemStack(slot2, (int) ((width - 208) / 2f), (int) ((height + 60) / 2f - 105) + 18, true);
+ Utils.drawItemStack(slot3, (int) ((width - 208) / 2f), (int) ((height + 60) / 2f - 105) + 36, true);
+ Utils.drawItemStack(slot4, (int) ((width - 208) / 2f), (int) ((height + 60) / 2f - 105) + 54, true);
if (slot1 == null) {
Minecraft.getMinecraft().getTextureManager().bindTexture(QUESTION_MARK);
GlStateManager.color(1, 1, 1, 1);
@@ -2565,7 +2569,7 @@ public class NEUOverlay extends Gui {
Utils.drawTexturedRect((float) ((width - 224.1) / 2f), yNumber, 31, 32, GL11.GL_NEAREST);
GlStateManager.bindTexture(0);
- Utils.drawItemStack(petInfo, (int) ((width - 208) / 2f), (int) ((height + 60) / 2f - 105) + 72);
+ Utils.drawItemStack(petInfo, (int) ((width - 208) / 2f), (int) ((height + 60) / 2f - 105) + 72, true);
renderingPetHud = true;
List<String> tooltipToDisplay = null;
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java
index 37bf160f..c604fd86 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java
@@ -34,6 +34,7 @@ import io.github.moulberry.notenoughupdates.listener.NEUEventListener;
import io.github.moulberry.notenoughupdates.listener.OldAnimationChecker;
import io.github.moulberry.notenoughupdates.listener.RenderListener;
import io.github.moulberry.notenoughupdates.miscfeatures.AuctionProfit;
+import io.github.moulberry.notenoughupdates.miscfeatures.BazaarSacksProfit;
import io.github.moulberry.notenoughupdates.miscfeatures.CrystalOverlay;
import io.github.moulberry.notenoughupdates.miscfeatures.CrystalWishingCompassSolver;
import io.github.moulberry.notenoughupdates.miscfeatures.CustomItemEffects;
@@ -111,9 +112,9 @@ import java.util.Set;
public class NotEnoughUpdates {
public static final String MODID = "notenoughupdates";
public static final String VERSION = "2.1.0-REL";
- public static final int VERSION_ID = 20200;
- public static final int PRE_VERSION_ID = 0;
- public static final int HOTFIX_VERSION_ID = 1;
+ public static final int VERSION_ID = 20000;
+ public static final int PRE_VERSION_ID = 1;
+ public static final int HOTFIX_VERSION_ID = 0;
/**
* Registers the biomes for the crystal hollows here so optifine knows they exists
*/
@@ -290,6 +291,7 @@ public class NotEnoughUpdates {
MinecraftForge.EVENT_BUS.register(new SignCalculator());
MinecraftForge.EVENT_BUS.register(TrophyRewardOverlay.getInstance());
MinecraftForge.EVENT_BUS.register(PowerStoneStatsDisplay.getInstance());
+ MinecraftForge.EVENT_BUS.register(BazaarSacksProfit.getInstance());
MinecraftForge.EVENT_BUS.register(MinionHelperManager.getInstance());
MinecraftForge.EVENT_BUS.register(navigation);
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);
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/commands/dungeon/MapCommand.java b/src/main/java/io/github/moulberry/notenoughupdates/commands/dungeon/MapCommand.java
index 807fcc27..3967edb4 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/commands/dungeon/MapCommand.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/commands/dungeon/MapCommand.java
@@ -51,12 +51,6 @@ public class MapCommand extends ClientCommandBase {
@Override
public void processCommand(ICommandSender sender, String[] args) throws CommandException {
- if (!NotEnoughUpdates.INSTANCE.config.hidden.dev) {
- Utils.addChatMessage(
- EnumChatFormatting.RED +
- "[NEU] The map does not work right now. You can use the map from other mods, for example: SkyblockAddons, DungeonsGuide or Skytils.");
- return;
- }
if (NotEnoughUpdates.INSTANCE.colourMap == null) {
try (
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/commands/misc/CalculatorCommand.java b/src/main/java/io/github/moulberry/notenoughupdates/commands/misc/CalculatorCommand.java
index e6472d04..916ce072 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/commands/misc/CalculatorCommand.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/commands/misc/CalculatorCommand.java
@@ -47,20 +47,20 @@ public class CalculatorCommand extends ClientCommandBase {
if ((args.length == 1 && Objects.equals(args[0], "help")) || args.length == 0) {
sender.addChatMessage(new ChatComponentText(
"\n§e[NEU] §5It's a calculator.\n" +
- "§eFor Example §b/neucalc 3m*7k§e.\n" +
- "§eYou can also use suffixes (k, m, b, t, s)§e.\n" +
- "§eThe \"s\" suffix acts as 64.\n" +
- "§eTurn on Sign Calculator in /neu misc to also support this in sign popups.\n"));
+ "§eFor Example §b/neucalc 3m*7k§e.\n" +
+ "§eYou can also use suffixes (k, m, b, t, s)§e.\n" +
+ "§eThe \"s\" suffix acts as 64.\n" +
+ "§eTurn on Sign Calculator in /neu misc to also support this in sign popups.\n"));
return;
}
String source = String.join(" ", args);
try {
BigDecimal calculate = Calculator.calculate(source);
- DecimalFormat formatter = new DecimalFormat("#,###.00");
- String lr = formatter.format(calculate);
+ DecimalFormat formatter = new DecimalFormat("#,##0.##");
+ String format = formatter.format(calculate);
sender.addChatMessage(new ChatComponentText(
- EnumChatFormatting.YELLOW + "[NEU] " + EnumChatFormatting.WHITE + source + " = " + EnumChatFormatting.GREEN +
- lr
+ EnumChatFormatting.YELLOW + "[NEU] " + EnumChatFormatting.WHITE + source + " " + EnumChatFormatting.YELLOW +
+ "= " + EnumChatFormatting.GREEN + format
));
} catch (Calculator.CalculatorException e) {
sender.addChatMessage(new ChatComponentText(
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/dungeons/DungeonMap.java b/src/main/java/io/github/moulberry/notenoughupdates/dungeons/DungeonMap.java
index 2693341a..d4a728be 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/dungeons/DungeonMap.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/dungeons/DungeonMap.java
@@ -65,13 +65,8 @@ import java.awt.*;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Set;
+import java.util.*;
public class DungeonMap {
private static final ResourceLocation GREEN_CHECK = new ResourceLocation(
@@ -602,8 +597,8 @@ public class DungeonMap {
GlStateManager.rotate(-rotation + 180, 0, 0, 1);
if (NotEnoughUpdates.INSTANCE.config.dungeonMap.dmCenterPlayer && playerPos != null) {
- float x = playerPos.getRenderX(0);
- float y = playerPos.getRenderY(0);
+ float x = playerPos.getRenderX();
+ float y = playerPos.getRenderY();
x -= minRoomX * (renderRoomSize + renderConnSize);
y -= minRoomY * (renderRoomSize + renderConnSize);
@@ -672,8 +667,8 @@ public class DungeonMap {
for (Map.Entry<String, MapPosition> entry : playerMarkerMapPositions.entrySet()) {
String name = entry.getKey();
MapPosition pos = entry.getValue();
- float x = pos.getRenderX(0);
- float y = pos.getRenderY(0);
+ float x = pos.getRenderX();
+ float y = pos.getRenderY();
float angle = pos.rotation;
boolean doInterp = NotEnoughUpdates.INSTANCE.config.dungeonMap.dmPlayerInterp;
@@ -681,8 +676,8 @@ public class DungeonMap {
MapPosition entityPos = playerEntityMapPositions.get(name);
angle = entityPos.rotation;
- float deltaX = entityPos.getRenderX(9) - pos.getRenderX(0);
- float deltaY = entityPos.getRenderY(9) - pos.getRenderY(0);
+ float deltaX = entityPos.getRenderX() - pos.getRenderX();
+ float deltaY = entityPos.getRenderY() - pos.getRenderY();
x += deltaX;
y += deltaY;
@@ -702,8 +697,8 @@ public class DungeonMap {
if (doInterp && playerMarkerMapPositionsLast.containsKey(name)) {
MapPosition last = playerMarkerMapPositionsLast.get(name);
- float xLast = last.getRenderX(0);
- float yLast = last.getRenderY(0);
+ float xLast = last.getRenderX();
+ float yLast = last.getRenderY();
float distSq = (x - xLast) * (x - xLast) + (y - yLast) * (y - yLast);
if (distSq < renderRoomSize * renderRoomSize / 4f) {
@@ -1100,12 +1095,12 @@ public class DungeonMap {
this.connOffsetY = connOffsetY;
}
- public float getRenderX(int blockOffset) {
- return (roomOffsetX + blockOffset) * getRenderRoomSize() + connOffsetX * getRenderConnSize();
+ public float getRenderX() {
+ return roomOffsetX * getRenderRoomSize() + connOffsetX * getRenderConnSize();
}
- public float getRenderY(int blockOffset) {
- return (roomOffsetY + blockOffset) * getRenderRoomSize() + connOffsetY * getRenderConnSize();
+ public float getRenderY() {
+ return roomOffsetY * getRenderRoomSize() + connOffsetY * getRenderConnSize();
}
@Override
@@ -1291,15 +1286,15 @@ public class DungeonMap {
if (entity instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) entity;
- float roomX = (float) player.posX / (roomSizeBlocks + 1);
- float roomY = (float) player.posZ / (roomSizeBlocks + 1);
+ float roomX = (float) (player.posX + 200) / (roomSizeBlocks + 1);
+ float roomY = (float) (player.posZ + 200) / (roomSizeBlocks + 1);
float playerRoomOffsetX = (float) Math.floor(roomX);
float playerConnOffsetX = (float) Math.floor(roomX);
float playerRoomOffsetY = (float) Math.floor(roomY);
float playerConnOffsetY = (float) Math.floor(roomY);
- float roomXInBlocks = (float) player.posX % (roomSizeBlocks + 1);
+ float roomXInBlocks = (float) (player.posX + 200) % (roomSizeBlocks + 1);
if (roomXInBlocks < 2) { //0,1
playerConnOffsetX -= 2 / 5f - roomXInBlocks / 5f;
} else if (roomXInBlocks > roomSizeBlocks - 2) { //31,30,29
@@ -1309,7 +1304,7 @@ public class DungeonMap {
playerRoomOffsetX += (roomXInBlocks - 2) / (roomSizeBlocks - 4);
}
- float roomYInBlocks = (float) player.posZ % (roomSizeBlocks + 1);
+ float roomYInBlocks = (float) (player.posZ + 200) % (roomSizeBlocks + 1);
if (roomYInBlocks < 2) { //0,1
playerConnOffsetY -= 2 / 5f - roomYInBlocks / 5f;
} else if (roomYInBlocks > roomSizeBlocks - 2) { //31,30,29
@@ -1438,8 +1433,8 @@ public class DungeonMap {
for (Map.Entry<String, MapPosition> entry : playerMarkerMapPositionsLast.entrySet()) {
HashMap<Integer, Float> deltaDists = new HashMap<>();
for (int i = 0; i < positions.size(); i++) {
- float dx = entry.getValue().getRenderX(0) - positions.get(i).getRenderX(0);
- float dy = entry.getValue().getRenderY(0) - positions.get(i).getRenderY(0);
+ float dx = entry.getValue().getRenderX() - positions.get(i).getRenderX();
+ float dy = entry.getValue().getRenderY() - positions.get(i).getRenderY();
deltaDists.put(i, dx * dx + dy * dy);
}
distanceMap.put(entry.getKey(), deltaDists);
@@ -1619,7 +1614,6 @@ public class DungeonMap {
if(player.getUniqueID().toString().charAt(14) == '4') {
actualPlayers.add(player.getName());
System.out.println(player.getName());
-
}
}*/
int players = 0;
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/dungeons/GuiDungeonMapEditor.java b/src/main/java/io/github/moulberry/notenoughupdates/dungeons/GuiDungeonMapEditor.java
index 47e85023..8ce9d505 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/dungeons/GuiDungeonMapEditor.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/dungeons/GuiDungeonMapEditor.java
@@ -284,7 +284,7 @@ public class GuiDungeonMapEditor extends GuiScreen {
break;
case 8:
mapDesc = "Simple gray border";
- mapCredit = "TomEngMaster";
+ mapCredit = "Lucy";
break;
case 9:
mapDesc = "Viney wood border";
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 379a0b6d..ea7f2f5b 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/listener/ChatListener.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/listener/ChatListener.java
@@ -215,10 +215,12 @@ public class ChatListener {
CookieWarning.resetNotification();
} else if (unformatted.startsWith("QUICK MATHS! Solve:")) {
if (Math.random() < 0.2) {
- ClientCommandHandler.instance.executeCommand(
- Minecraft.getMinecraft().thePlayer,
- "/neucalc " + unformatted.substring("QUICK MATHS! Solve: ".length())
- );
+ if (NotEnoughUpdates.INSTANCE.config.misc.calculationMode == 2) {
+ ClientCommandHandler.instance.executeCommand(
+ Minecraft.getMinecraft().thePlayer,
+ "/neucalc " + unformatted.substring("QUICK MATHS! Solve: ".length())
+ );
+ }
}
}
if (e.message.getFormattedText().contains(
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 91f5f18f..98207feb 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/listener/RenderListener.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/listener/RenderListener.java
@@ -34,10 +34,12 @@ import io.github.moulberry.notenoughupdates.commands.profile.ViewProfileCommand;
import io.github.moulberry.notenoughupdates.core.GuiScreenElementWrapper;
import io.github.moulberry.notenoughupdates.dungeons.DungeonWin;
import io.github.moulberry.notenoughupdates.itemeditor.NEUItemEditor;
+import io.github.moulberry.notenoughupdates.miscfeatures.AbiphoneWarning;
import io.github.moulberry.notenoughupdates.miscfeatures.AuctionBINWarning;
import io.github.moulberry.notenoughupdates.miscfeatures.AuctionProfit;
import io.github.moulberry.notenoughupdates.miscfeatures.BetterContainers;
import io.github.moulberry.notenoughupdates.miscfeatures.CrystalMetalDetectorSolver;
+import io.github.moulberry.notenoughupdates.miscfeatures.EnchantingSolvers;
import io.github.moulberry.notenoughupdates.miscfeatures.StorageManager;
import io.github.moulberry.notenoughupdates.miscgui.AccessoryBagOverlay;
import io.github.moulberry.notenoughupdates.miscgui.CalendarOverlay;
@@ -486,71 +488,73 @@ public class RenderListener {
int guiTop = ((AccessorGuiContainer) event.gui).getGuiTop();
if (!NEUApi.disableInventoryButtons) {
- for (NEUConfig.InventoryButton button : NotEnoughUpdates.INSTANCE.config.hidden.inventoryButtons) {
- if (!button.isActive()) continue;
- if (button.playerInvOnly && !(event.gui instanceof GuiInventory)) continue;
-
- int x = guiLeft + button.x;
- int y = guiTop + button.y;
- if (button.anchorRight) {
- x += xSize;
- }
- if (button.anchorBottom) {
- y += ySize;
- }
- if (AccessoryBagOverlay.isInAccessoryBag()) {
- if (x > guiLeft + xSize && x < guiLeft + xSize + 80 + 28 + 5 && y > guiTop - 18 && y < guiTop + 150) {
- x += 80 + 28;
+ if (!EnchantingSolvers.disableButtons()) {
+ for (NEUConfig.InventoryButton button : NotEnoughUpdates.INSTANCE.config.hidden.inventoryButtons) {
+ if (!button.isActive()) continue;
+ if (button.playerInvOnly && !(event.gui instanceof GuiInventory)) continue;
+
+ int x = guiLeft + button.x;
+ int y = guiTop + button.y;
+ if (button.anchorRight) {
+ x += xSize;
}
- }
- if (TrophyRewardOverlay.inTrophyFishingInventory()) {
- int diffX = 162;
- if (x > guiLeft + xSize && x < guiLeft + xSize + diffX + 5 && y > guiTop - 18 && y < guiTop + 120) {
- x += diffX;
+ if (button.anchorBottom) {
+ y += ySize;
+ }
+ if (AccessoryBagOverlay.isInAccessoryBag()) {
+ if (x > guiLeft + xSize && x < guiLeft + xSize + 80 + 28 + 5 && y > guiTop - 18 && y < guiTop + 150) {
+ x += 80 + 28;
+ }
+ }
+ if (TrophyRewardOverlay.inTrophyFishingInventory()) {
+ int diffX = 162;
+ if (x > guiLeft + xSize && x < guiLeft + xSize + diffX + 5 && y > guiTop - 18 && y < guiTop + 120) {
+ x += diffX;
}
}
if (MinionHelperManager.getInstance().inCraftedMinionsInventory()) {
int diffX = 172;
if (x > guiLeft + xSize && x < guiLeft + xSize + diffX + 5 && y > guiTop - 18 && y < guiTop + 128) {
x += diffX;
+ }
}
- }
- if (AuctionProfit.inAuctionPage()) {
+ if (AuctionProfit.inAuctionPage()) {
if (x + 18 > guiLeft + xSize && x + 18 < guiLeft + xSize + 4 + 28 + 20 && y > guiTop - 180 &&
y < guiTop + 56) {
- x -= 68 - 200;
+ x -= 68 - 200;
+ }
}
- }
- if (NEUOverlay.isRenderingArmorHud()) {
- if (x < guiLeft + xSize - 150 && x > guiLeft + xSize - 200 && y > guiTop && y < guiTop + 84) {
- x -= 25;
+ if (NEUOverlay.isRenderingArmorHud()) {
+ if (x < guiLeft + xSize - 150 && x > guiLeft + xSize - 200 && y > guiTop && y < guiTop + 84) {
+ x -= 25;
+ }
}
- }
- if (NEUOverlay.isRenderingPetHud()) {
- if (x < guiLeft + xSize - 150 && x > guiLeft + xSize - 200 && y > guiTop + 60 && y < guiTop + 120) {
- x -= 25;
+ if (NEUOverlay.isRenderingPetHud()) {
+ if (x < guiLeft + xSize - 150 && x > guiLeft + xSize - 200 && y > guiTop + 60 && y < guiTop + 120) {
+ x -= 25;
+ }
}
- }
- GlStateManager.color(1, 1, 1, 1f);
-
- GlStateManager.enableDepth();
- GlStateManager.enableAlpha();
- Minecraft.getMinecraft().getTextureManager().bindTexture(EDITOR);
- Utils.drawTexturedRect(
- x,
- y,
- 18,
- 18,
- button.backgroundIndex * 18 / 256f,
- (button.backgroundIndex * 18 + 18) / 256f,
- 18 / 256f,
- 36 / 256f,
- GL11.GL_NEAREST
- );
+ GlStateManager.color(1, 1, 1, 1f);
+
+ GlStateManager.enableDepth();
+ GlStateManager.enableAlpha();
+ Minecraft.getMinecraft().getTextureManager().bindTexture(EDITOR);
+ Utils.drawTexturedRect(
+ x,
+ y,
+ 18,
+ 18,
+ button.backgroundIndex * 18 / 256f,
+ (button.backgroundIndex * 18 + 18) / 256f,
+ 18 / 256f,
+ 36 / 256f,
+ GL11.GL_NEAREST
+ );
- if (button.icon != null && !button.icon.trim().isEmpty()) {
- GuiInvButtonEditor.renderIcon(button.icon, x + 1, y + 1);
+ if (button.icon != null && !button.icon.trim().isEmpty()) {
+ GuiInvButtonEditor.renderIcon(button.icon, x + 1, y + 1);
+ }
}
}
}
@@ -611,80 +615,82 @@ public class RenderListener {
int guiTop = ((AccessorGuiContainer) event.gui).getGuiTop();
if (!NEUApi.disableInventoryButtons) {
- for (NEUConfig.InventoryButton button : NotEnoughUpdates.INSTANCE.config.hidden.inventoryButtons) {
- if (!button.isActive()) continue;
- if (button.playerInvOnly && !(event.gui instanceof GuiInventory)) continue;
-
- int x = guiLeft + button.x;
- int y = guiTop + button.y;
- if (button.anchorRight) {
- x += xSize;
- }
- if (button.anchorBottom) {
- y += ySize;
- }
- if (AccessoryBagOverlay.isInAccessoryBag()) {
- if (x > guiLeft + xSize && x < guiLeft + xSize + 80 + 28 + 5 && y > guiTop - 18 && y < guiTop + 150) {
- x += 80 + 28;
+ if (!EnchantingSolvers.disableButtons()) {
+ for (NEUConfig.InventoryButton button : NotEnoughUpdates.INSTANCE.config.hidden.inventoryButtons) {
+ if (!button.isActive()) continue;
+ if (button.playerInvOnly && !(event.gui instanceof GuiInventory)) continue;
+
+ int x = guiLeft + button.x;
+ int y = guiTop + button.y;
+ if (button.anchorRight) {
+ x += xSize;
}
- }
- if (TrophyRewardOverlay.inTrophyFishingInventory()) {
- int diffX = 162;
- if (x > guiLeft + xSize && x < guiLeft + xSize + diffX + 5 && y > guiTop - 18 && y < guiTop + 120) {
- x += diffX;
+ if (button.anchorBottom) {
+ y += ySize;
+ }
+ if (AccessoryBagOverlay.isInAccessoryBag()) {
+ if (x > guiLeft + xSize && x < guiLeft + xSize + 80 + 28 + 5 && y > guiTop - 18 && y < guiTop + 150) {
+ x += 80 + 28;
+ }
+ }
+ if (TrophyRewardOverlay.inTrophyFishingInventory()) {
+ int diffX = 162;
+ if (x > guiLeft + xSize && x < guiLeft + xSize + diffX + 5 && y > guiTop - 18 && y < guiTop + 120) {
+ x += diffX;
+ }
}
- }
if (MinionHelperManager.getInstance().inCraftedMinionsInventory()) {
int diffX = 172;
if (x > guiLeft + xSize && x < guiLeft + xSize + diffX + 5 && y > guiTop - 18 && y < guiTop + 128) {
x += diffX;
}
}
- if (AuctionProfit.inAuctionPage()) {
+ if (AuctionProfit.inAuctionPage()) {
if (x + 18 > guiLeft + xSize && x + 18 < guiLeft + xSize + 4 + 28 + 20 && y > guiTop - 180 &&
y < guiTop + 56) {
- x -= 68 - 200;
+ x -= 68 - 200;
+ }
}
- }
- if (NEUOverlay.isRenderingArmorHud()) {
- if (x < guiLeft + xSize - 150 && x > guiLeft + xSize - 200 && y > guiTop && y < guiTop + 84) {
- x -= 25;
+ if (NEUOverlay.isRenderingArmorHud()) {
+ if (x < guiLeft + xSize - 150 && x > guiLeft + xSize - 200 && y > guiTop && y < guiTop + 84) {
+ x -= 25;
+ }
}
- }
- if (NEUOverlay.isRenderingPetHud()) {
- if (x < guiLeft + xSize - 150 && x > guiLeft + xSize - 200 && y > guiTop + 60 && y < guiTop + 120) {
- x -= 25;
+ if (NEUOverlay.isRenderingPetHud()) {
+ if (x < guiLeft + xSize - 150 && x > guiLeft + xSize - 200 && y > guiTop + 60 && y < guiTop + 120) {
+ x -= 25;
+ }
}
- }
- if (x - guiLeft >= 85 && x - guiLeft <= 115 && y - guiTop >= 4 && y - guiTop <= 25) {
- disableCraftingText = true;
- }
-
- if (event.mouseX >= x && event.mouseX <= x + 18 && event.mouseY >= y && event.mouseY <= y + 18) {
- hoveringButton = true;
- long currentTime = System.currentTimeMillis();
-
- if (buttonHovered != button) {
- buttonHoveredMillis = currentTime;
- buttonHovered = button;
+ if (x - guiLeft >= 85 && x - guiLeft <= 115 && y - guiTop >= 4 && y - guiTop <= 25) {
+ disableCraftingText = true;
}
- if (currentTime - buttonHoveredMillis > 600) {
- String command = button.command.trim();
- if (!command.startsWith("/")) {
- command = "/" + command;
+ if (event.mouseX >= x && event.mouseX <= x + 18 && event.mouseY >= y && event.mouseY <= y + 18) {
+ hoveringButton = true;
+ long currentTime = System.currentTimeMillis();
+
+ if (buttonHovered != button) {
+ buttonHoveredMillis = currentTime;
+ buttonHovered = button;
}
- Utils.drawHoveringText(
- Lists.newArrayList("\u00a77" + command),
- event.mouseX,
- event.mouseY,
- event.gui.width,
- event.gui.height,
- -1,
- Minecraft.getMinecraft().fontRendererObj
- );
+ if (currentTime - buttonHoveredMillis > 600) {
+ String command = button.command.trim();
+ if (!command.startsWith("/")) {
+ command = "/" + command;
+ }
+
+ Utils.drawHoveringText(
+ Lists.newArrayList("\u00a77" + command),
+ event.mouseX,
+ event.mouseY,
+ event.gui.width,
+ event.gui.height,
+ -1,
+ Minecraft.getMinecraft().fontRendererObj
+ );
+ }
}
}
}
@@ -695,6 +701,10 @@ public class RenderListener {
if (AuctionBINWarning.getInstance().shouldShow()) {
AuctionBINWarning.getInstance().render();
}
+
+ if (AbiphoneWarning.getInstance().shouldShow()) {
+ AbiphoneWarning.getInstance().render();
+ }
}
private void renderDungeonChestOverlay(GuiScreen gui) {
@@ -758,7 +768,8 @@ public class RenderListener {
if (auctionInfo.has("clean_price")) {
worth = (long) auctionInfo.get("clean_price").getAsDouble();
} else {
- worth = (long) (auctionInfo.get("price").getAsDouble() / auctionInfo.get("count").getAsDouble());
+ worth =
+ (long) (auctionInfo.get("price").getAsDouble() / auctionInfo.get("count").getAsDouble());
}
}
break;
@@ -936,6 +947,11 @@ public class RenderListener {
event.setCanceled(true);
return;
}
+ if (AbiphoneWarning.getInstance().shouldShow()) {
+ AbiphoneWarning.getInstance().mouseInput(mouseX, mouseY);
+ event.setCanceled(true);
+ return;
+ }
if (!event.isCanceled()) {
Utils.scrollTooltip(Mouse.getEventDWheel());
@@ -1026,68 +1042,71 @@ public class RenderListener {
int guiLeft = ((AccessorGuiContainer) event.gui).getGuiLeft();
int guiTop = ((AccessorGuiContainer) event.gui).getGuiTop();
if (!NEUApi.disableInventoryButtons) {
- for (NEUConfig.InventoryButton button : NotEnoughUpdates.INSTANCE.config.hidden.inventoryButtons) {
- if (!button.isActive()) continue;
- if (button.playerInvOnly && !(event.gui instanceof GuiInventory)) continue;
-
- int x = guiLeft + button.x;
- int y = guiTop + button.y;
- if (button.anchorRight) {
- x += xSize;
- }
- if (button.anchorBottom) {
- y += ySize;
- }
- if (AccessoryBagOverlay.isInAccessoryBag()) {
- if (x > guiLeft + xSize && x < guiLeft + xSize + 80 + 28 + 5 && y > guiTop - 18 && y < guiTop + 150) {
- x += 80 + 28;
+ if (!EnchantingSolvers.disableButtons()) {
+ for (NEUConfig.InventoryButton button : NotEnoughUpdates.INSTANCE.config.hidden.inventoryButtons) {
+ if (!button.isActive()) continue;
+ if (button.playerInvOnly && !(event.gui instanceof GuiInventory)) continue;
+
+ int x = guiLeft + button.x;
+ int y = guiTop + button.y;
+ if (button.anchorRight) {
+ x += xSize;
}
- }
- if (TrophyRewardOverlay.inTrophyFishingInventory()) {
- int diffX = 162;
- if (x > guiLeft + xSize && x < guiLeft + xSize + diffX + 5 && y > guiTop - 18 && y < guiTop + 120) {
- x += diffX;
+ if (button.anchorBottom) {
+ y += ySize;
+ }
+ if (AccessoryBagOverlay.isInAccessoryBag()) {
+ if (x > guiLeft + xSize && x < guiLeft + xSize + 80 + 28 + 5 && y > guiTop - 18 && y < guiTop + 150) {
+ x += 80 + 28;
+ }
+ }
+ if (TrophyRewardOverlay.inTrophyFishingInventory()) {
+ int diffX = 162;
+ if (x > guiLeft + xSize && x < guiLeft + xSize + diffX + 5 && y > guiTop - 18 && y < guiTop + 120) {
+ x += diffX;
+ }
}
- }
if (MinionHelperManager.getInstance().inCraftedMinionsInventory()) {
int diffX = 172;
if (x > guiLeft + xSize && x < guiLeft + xSize + diffX + 5 && y > guiTop - 18 && y < guiTop + 128) {
x += diffX;
}
}
- if (AuctionProfit.inAuctionPage()) {
+ if (AuctionProfit.inAuctionPage()) {
if (x + 18 > guiLeft + xSize && x + 18 < guiLeft + xSize + 4 + 28 + 20 && y > guiTop - 180 &&
y < guiTop + 56) {
- x -= 68 - 200;
+ x -= 68 - 200;
+ }
}
- }
- if (NEUOverlay.isRenderingArmorHud()) {
- if (x < guiLeft + xSize - 150 && x > guiLeft + xSize - 200 && y > guiTop && y < guiTop + 84) {
- x -= 25;
+ if (NEUOverlay.isRenderingArmorHud()) {
+ if (x < guiLeft + xSize - 150 && x > guiLeft + xSize - 200 && y > guiTop && y < guiTop + 84) {
+ x -= 25;
+ }
}
- }
- if (NEUOverlay.isRenderingPetHud()) {
- if (x < guiLeft + xSize - 150 && x > guiLeft + xSize - 200 && y > guiTop + 60 && y < guiTop + 120) {
- x -= 25;
+ if (NEUOverlay.isRenderingPetHud()) {
+ if (x < guiLeft + xSize - 150 && x > guiLeft + xSize - 200 && y > guiTop + 60 && y < guiTop + 120) {
+ x -= 25;
+ }
}
- }
- if (mouseX >= x && mouseX <= x + 18 && mouseY >= y && mouseY <= y + 18) {
- if (Minecraft.getMinecraft().thePlayer.inventory.getItemStack() == null) {
- int clickType = NotEnoughUpdates.INSTANCE.config.inventoryButtons.clickType;
- if ((clickType == 0 && Mouse.getEventButtonState()) || (clickType == 1 && !Mouse.getEventButtonState())) {
- String command = button.command.trim();
- if (!command.startsWith("/")) {
- command = "/" + command;
- }
- if (ClientCommandHandler.instance.executeCommand(Minecraft.getMinecraft().thePlayer, command) == 0) {
- NotEnoughUpdates.INSTANCE.sendChatMessage(command);
+ if (mouseX >= x && mouseX <= x + 18 && mouseY >= y && mouseY <= y + 18) {
+ if (Minecraft.getMinecraft().thePlayer.inventory.getItemStack() == null) {
+ int clickType = NotEnoughUpdates.INSTANCE.config.inventoryButtons.clickType;
+ if ((clickType == 0 && Mouse.getEventButtonState()) ||
+ (clickType == 1 && !Mouse.getEventButtonState())) {
+ String command = button.command.trim();
+ if (!command.startsWith("/")) {
+ command = "/" + command;
+ }
+ if (ClientCommandHandler.instance.executeCommand(Minecraft.getMinecraft().thePlayer, command) == 0) {
+ NotEnoughUpdates.INSTANCE.sendChatMessage(command);
+ }
}
+ } else {
+ event.setCanceled(true);
}
- } else {
- event.setCanceled(true);
+ return;
}
- return;
}
}
}
@@ -1405,6 +1424,11 @@ public class RenderListener {
event.setCanceled(true);
return;
}
+ if (AbiphoneWarning.getInstance().shouldShow()) {
+ AbiphoneWarning.getInstance().keyboardInput();
+ event.setCanceled(true);
+ return;
+ }
if (AuctionSearchOverlay.shouldReplace()) {
AuctionSearchOverlay.keyEvent();
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AbiphoneWarning.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AbiphoneWarning.java
new file mode 100644
index 00000000..75584662
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AbiphoneWarning.java
@@ -0,0 +1,215 @@
+/*
+ * 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.miscfeatures;
+
+import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
+import io.github.moulberry.notenoughupdates.core.GuiElement;
+import io.github.moulberry.notenoughupdates.core.util.render.RenderUtils;
+import io.github.moulberry.notenoughupdates.core.util.render.TextRenderUtils;
+import io.github.moulberry.notenoughupdates.util.ItemUtils;
+import io.github.moulberry.notenoughupdates.util.SBInfo;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.Gui;
+import net.minecraft.client.gui.ScaledResolution;
+import net.minecraft.client.gui.inventory.GuiChest;
+import net.minecraft.client.renderer.GlStateManager;
+import net.minecraft.inventory.Slot;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.EnumChatFormatting;
+import org.lwjgl.input.Keyboard;
+import org.lwjgl.input.Mouse;
+import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
+
+import java.util.List;
+
+public class AbiphoneWarning extends GuiElement {
+ private static final AbiphoneWarning INSTANCE = new AbiphoneWarning();
+
+ private boolean showWarning = false;
+ private String contactName = null;
+ private int contactSlot = -1;
+
+ public static AbiphoneWarning getInstance() {
+ return INSTANCE;
+ }
+
+ private boolean shouldPerformCheck() {
+ if (!NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard()) {
+ showWarning = false;
+ return false;
+ }
+
+ if (Minecraft.getMinecraft().currentScreen instanceof GuiChest &&
+ SBInfo.getInstance().lastOpenContainerName.startsWith("Abiphone ")) {
+ return true;
+ } else {
+ showWarning = false;
+ return false;
+ }
+ }
+
+ public boolean shouldShow() {
+ return shouldPerformCheck() && showWarning;
+ }
+
+ public boolean onMouseClick(Slot slotIn, int slotId, int clickedButton, int clickType) {
+ if (!shouldPerformCheck()) return false;
+ if (!NotEnoughUpdates.INSTANCE.config.misc.abiphoneWarning) return false;
+ if (slotId == -999) return false;
+ if (clickedButton == 0) return false;
+
+ GuiChest chest = (GuiChest) Minecraft.getMinecraft().currentScreen;
+
+ ItemStack clickedContact = chest.inventorySlots.getSlot(slotId).getStack();
+ if (clickedContact == null) return false;
+
+ List<String> list = ItemUtils.getLore(clickedContact);
+ if (list.isEmpty()) return false;
+
+ String last = list.get(list.size() - 1);
+ if (last.contains("Right-click to remove contact!")) {
+ showWarning = true;
+ contactName = clickedContact.getDisplayName();
+ contactSlot = slotId;
+ return true;
+ }
+
+ return false;
+ }
+
+ public void overrideIsMouseOverSlot(Slot slot, int mouseX, int mouseY, CallbackInfoReturnable<Boolean> cir) {
+ if (shouldShow()) {
+ cir.setReturnValue(false);
+ }
+ }
+
+ @Override
+ public void render() {
+ final ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
+ final int width = scaledResolution.getScaledWidth();
+ final int height = scaledResolution.getScaledHeight();
+
+ GlStateManager.disableLighting();
+
+ GlStateManager.pushMatrix();
+ GlStateManager.translate(0, 0, 500);
+
+ Gui.drawRect(0, 0, width, height, 0x80000000);
+
+ RenderUtils.drawFloatingRectDark(width / 2 - 90, height / 2 - 45, 180, 90);
+
+ int neuLength = Minecraft.getMinecraft().fontRendererObj.getStringWidth("\u00a7lNEU");
+ Minecraft.getMinecraft().fontRendererObj.drawString(
+ "\u00a7lNEU",
+ width / 2 + 90 - neuLength - 3,
+ height / 2 - 45 + 4,
+ 0xff000000
+ );
+
+ TextRenderUtils.drawStringCenteredScaledMaxWidth("Are you SURE?", Minecraft.getMinecraft().fontRendererObj,
+ width / 2, height / 2 - 45 + 10, false, 170, 0xffff4040
+ );
+
+ String sellLine = "\u00a77[ \u00a7r" + contactName + "\u00a77 ]";
+
+ TextRenderUtils.drawStringCenteredScaledMaxWidth(sellLine, Minecraft.getMinecraft().fontRendererObj,
+ width / 2, height / 2 - 45 + 25, false, 170, 0xffffffff
+ );
+
+ TextRenderUtils.drawStringCenteredScaledMaxWidth(
+ "Continue removing this contact?",
+ Minecraft.getMinecraft().fontRendererObj,
+ width / 2,
+ height / 2 - 45 + 50,
+ false,
+ 170,
+ 0xffa0a0a0
+ );
+
+ RenderUtils.drawFloatingRectDark(width / 2 - 43, height / 2 + 23, 40, 16, false);
+ RenderUtils.drawFloatingRectDark(width / 2 + 3, height / 2 + 23, 40, 16, false);
+
+ TextRenderUtils.drawStringCenteredScaledMaxWidth(
+ EnumChatFormatting.GREEN + "[Y]es",
+ Minecraft.getMinecraft().fontRendererObj,
+ width / 2 - 23,
+ height / 2 + 31,
+ true,
+ 36,
+ 0xff00ff00
+ );
+ TextRenderUtils.drawStringCenteredScaledMaxWidth(
+ EnumChatFormatting.RED + "[N]o",
+ Minecraft.getMinecraft().fontRendererObj,
+ width / 2 + 23,
+ height / 2 + 31,
+ true,
+ 36,
+ 0xffff0000
+ );
+
+ GlStateManager.popMatrix();
+ }
+
+ @Override
+ public boolean mouseInput(int mouseX, int mouseY) {
+ final ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
+ final int width = scaledResolution.getScaledWidth();
+ final int height = scaledResolution.getScaledHeight();
+
+ if (Mouse.getEventButtonState()) {
+ if (mouseY >= height / 2 + 23 && mouseY <= height / 2 + 23 + 16) {
+ if (mouseX >= width / 2 - 43 && mouseX <= width / 2 - 3) {
+ makeClick();
+ }
+ showWarning = false;
+ }
+
+ if (mouseX < width / 2 - 90 || mouseX > width / 2 + 90 ||
+ mouseY < height / 2 - 45 || mouseY > height / 2 + 45) {
+ showWarning = false;
+ }
+ }
+
+ return false;
+ }
+
+ @Override
+ public boolean keyboardInput() {
+ if (!Keyboard.getEventKeyState()) {
+ if (Keyboard.getEventKey() == Keyboard.KEY_Y || Keyboard.getEventKey() == Keyboard.KEY_RETURN) {
+ makeClick();
+ }
+ showWarning = false;
+ }
+
+ return false;
+ }
+
+ private void makeClick() {
+ if (contactSlot != -1) {
+ GuiChest chest = (GuiChest) Minecraft.getMinecraft().currentScreen;
+ Minecraft.getMinecraft().playerController.windowClick(chest.inventorySlots.windowId,
+ contactSlot, 1, 0, Minecraft.getMinecraft().thePlayer
+ );
+ contactSlot = -1;
+ }
+ }
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/BazaarSacksProfit.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/BazaarSacksProfit.java
new file mode 100644
index 00000000..51ec28dd
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/BazaarSacksProfit.java
@@ -0,0 +1,182 @@
+/*
+ * 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.miscfeatures;
+
+import com.google.gson.JsonObject;
+import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
+import io.github.moulberry.notenoughupdates.core.util.StringUtils;
+import io.github.moulberry.notenoughupdates.miscgui.TrophyRewardOverlay;
+import io.github.moulberry.notenoughupdates.util.ItemUtils;
+import net.minecraft.client.Minecraft;
+import net.minecraft.inventory.Container;
+import net.minecraft.inventory.ContainerChest;
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.client.event.GuiOpenEvent;
+import net.minecraftforge.event.entity.player.ItemTooltipEvent;
+import net.minecraftforge.fml.common.eventhandler.EventPriority;
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
+import org.lwjgl.input.Keyboard;
+
+import java.text.DecimalFormat;
+import java.text.NumberFormat;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+
+public class BazaarSacksProfit {
+
+ private static BazaarSacksProfit INSTANCE = null;
+ private boolean showSellOrderPrice = false;
+ private boolean pressedShiftLast = false;
+
+ public static BazaarSacksProfit getInstance() {
+ if (INSTANCE == null) {
+ INSTANCE = new BazaarSacksProfit();
+ }
+ return INSTANCE;
+ }
+
+ private final Map<String, Integer> prices = new HashMap<>();
+ private final Map<String, String> names = new HashMap<>();
+ private final List<String> invalidNames = new ArrayList<>();
+
+ @SubscribeEvent
+ public void onGuiOpen(GuiOpenEvent event) {
+ showSellOrderPrice = false;
+ prices.clear();
+ names.clear();
+ invalidNames.clear();
+ }
+
+ @SubscribeEvent(priority = EventPriority.LOW)
+ public void onItemTooltipLow(ItemTooltipEvent event) {
+ if (!NotEnoughUpdates.INSTANCE.config.tooltipTweaks.bazaarSacksProfit) return;
+ if (!inBazaar()) return;
+
+ ItemStack itemStack = event.itemStack;
+ String displayName = itemStack.getDisplayName();
+ if (!displayName.equals("§bSell Sacks Now")) return;
+
+ boolean shift = Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT);
+ if (!pressedShiftLast && shift) {
+ showSellOrderPrice = !showSellOrderPrice;
+ }
+ pressedShiftLast = shift;
+
+ if (prices.isEmpty()) {
+ out:
+ for (String line : ItemUtils.getLore(itemStack)) {
+ if (line.contains("§7x ")) {
+ String[] split = line.split("§7x ");
+ String rawAmount = StringUtils.cleanColour(split[0]).replace(",", "").substring(1);
+ int amount = Integer.parseInt(rawAmount);
+ String bazaarName = split[1].split(" §7for")[0];
+ for (Map.Entry<String, JsonObject> entry : NotEnoughUpdates.INSTANCE.manager
+ .getItemInformation()
+ .entrySet()) {
+ String internalName = entry.getKey();
+ JsonObject object = entry.getValue();
+ if (object.has("displayname")) {
+ String displayname = object.get("displayname").getAsString();
+ if (displayname.equals(bazaarName)) {
+ prices.put(internalName, amount);
+ names.put(internalName, bazaarName);
+ continue out;
+ }
+ }
+ }
+ System.out.println("no bazaar item in repo found for '" + bazaarName + "'");
+ invalidNames.add(bazaarName);
+ }
+ }
+ }
+
+ event.toolTip.removeIf(line -> line.contains("§7x ") || line.contains("You earn:"));
+
+ Map<String, Float> map = new HashMap<>();
+ DecimalFormat formatter = (DecimalFormat) NumberFormat.getNumberInstance(Locale.ENGLISH);
+ formatter.applyPattern("#,##0");
+ double totalPrice = 0;
+ for (Map.Entry<String, Integer> entry : prices.entrySet()) {
+ String internalName = entry.getKey();
+ int amount = entry.getValue();
+ String name = names.get(internalName);
+
+ JsonObject bazaarInfo = NotEnoughUpdates.INSTANCE.manager.auctionManager.getBazaarInfo(internalName);
+
+ float price = 0;
+ if (bazaarInfo != null) {
+
+ if (showSellOrderPrice) {
+ if (bazaarInfo.has("curr_buy")) {
+ price = bazaarInfo.get("curr_buy").getAsFloat();
+ } else {
+ System.err.println("curr_sell does not exist for '" + internalName + "'");
+ }
+ } else {
+ if (bazaarInfo.has("curr_sell")) {
+ price = bazaarInfo.get("curr_sell").getAsFloat();
+ } else {
+ System.err.println("curr_sell does not exist for '" + internalName + "'");
+ }
+ }
+ }
+ float extraPrice = price * amount;
+ String priceFormat = formatter.format(extraPrice);
+ totalPrice += extraPrice;
+ map.put("§a" + formatter.format(amount) + "§7x §f" + name + " §7for §6" + priceFormat + " coins", extraPrice);
+ }
+
+ if (showSellOrderPrice) {
+ event.toolTip.add(4, "§7Sell order price: §6" + formatter.format(totalPrice));
+ } else {
+ event.toolTip.add(4, "§7Instant sell price: §6" + formatter.format(totalPrice));
+ }
+
+ event.toolTip.add(4, "");
+ for (String name : invalidNames) {
+ event.toolTip.add(4, name + " §cMissing repo data!");
+ }
+ for (String text : TrophyRewardOverlay.sortByValue(map).keySet()) {
+ event.toolTip.add(4, text);
+ }
+
+ event.toolTip.add("");
+ if (!showSellOrderPrice) {
+ event.toolTip.add("§8[Press SHIFT to show sell order price]");
+ } else {
+ event.toolTip.add("§8[Press SHIFT to show instant sell price]");
+ }
+ }
+
+ public static boolean inBazaar() {
+ if (!NotEnoughUpdates.INSTANCE.isOnSkyblock()) return false;
+
+ Minecraft minecraft = Minecraft.getMinecraft();
+ if (minecraft == null || minecraft.thePlayer == null) return false;
+
+ Container inventoryContainer = minecraft.thePlayer.openContainer;
+ if (!(inventoryContainer instanceof ContainerChest)) return false;
+ ContainerChest containerChest = (ContainerChest) inventoryContainer;
+ return containerChest.getLowerChestInventory().getDisplayName().getUnformattedText().startsWith("Bazaar ");
+ }
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/EnchantingSolvers.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/EnchantingSolvers.java
index aaaa1e24..1032fe16 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/EnchantingSolvers.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/EnchantingSolvers.java
@@ -597,4 +597,8 @@ public class EnchantingSolvers {
processInventoryContents(true);
}
+
+ public static boolean disableButtons() {
+ return currentSolver != SolverType.NONE && NotEnoughUpdates.INSTANCE.config.enchantingSolvers.hideButtons;
+ }
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/CalendarOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/CalendarOverlay.java
index 64396905..2905a941 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/CalendarOverlay.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/CalendarOverlay.java
@@ -865,8 +865,8 @@ public class CalendarOverlay {
SBEvent firstEvent = null;
List<SBEvent> nextFavourites = new ArrayList<>();
List<Long> nextFavouritesTime = new ArrayList<>();
- long timeUntilMajor = 0;
- SBEvent nextMajorEvent = null;
+ long timeUntilMayor = 0;
+ SBEvent nextMayorEvent = null;
List<String> eventFavourites = NotEnoughUpdates.INSTANCE.config.hidden.eventFavourites;
@@ -889,10 +889,10 @@ public class CalendarOverlay {
}
}
- if (nextMajorEvent == null && !sbEvent.id.split(":")[0].equals("jacob_farming") &&
+ if (nextMayorEvent == null && !sbEvent.id.split(":")[0].equals("jacob_farming") &&
!sbEvent.id.equals("dark_auction")) {
- nextMajorEvent = sbEvent;
- timeUntilMajor = timeUntilMillis;
+ nextMayorEvent = sbEvent;
+ timeUntilMayor = timeUntilMillis;
}
if (firstEvent == null) {
@@ -919,7 +919,7 @@ public class CalendarOverlay {
}
}
- if (nextFavourites.size() >= 3 && nextMajorEvent != null) {
+ if (nextFavourites.size() >= 3 && nextMayorEvent != null) {
break out;
}
}
@@ -1000,18 +1000,18 @@ public class CalendarOverlay {
if (sbEvent.id.split(":")[0].equals("jacob_farming") && sbEvent.desc != null) {
tooltipToDisplay.addAll(sbEvent.desc);
}
- if (nextMajorEvent != null || i < nextFavourites.size() - 1) {
+ if (nextMayorEvent != null || i < nextFavourites.size() - 1) {
tooltipToDisplay.add("");
}
}
- if (nextMajorEvent != null) {
- tooltipToDisplay.add(EnumChatFormatting.YELLOW.toString() + EnumChatFormatting.BOLD + "Next Major:");
- tooltipToDisplay.add(nextMajorEvent.display);
+ if (nextMayorEvent != null) {
+ tooltipToDisplay.add(EnumChatFormatting.YELLOW.toString() + EnumChatFormatting.BOLD + "Next Mayor:");
+ tooltipToDisplay.add(nextMayorEvent.display);
tooltipToDisplay.add(EnumChatFormatting.GRAY + "Starts in: " + EnumChatFormatting.YELLOW +
- prettyTime(timeUntilMajor, false));
- if (nextMajorEvent.lastsFor >= 0) {
+ prettyTime(timeUntilMayor, false));
+ if (nextMayorEvent.lastsFor >= 0) {
tooltipToDisplay.add(EnumChatFormatting.GRAY + "Lasts for: " + EnumChatFormatting.YELLOW +
- prettyTime(nextMajorEvent.lastsFor, true));
+ prettyTime(nextMayorEvent.lastsFor, true));
}
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiPriceGraph.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiPriceGraph.java
index ed8d5d92..71a23ffb 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiPriceGraph.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiPriceGraph.java
@@ -68,10 +68,10 @@ public class GuiPriceGraph extends GuiScreen {
private static final int X_SIZE = 364;
private static final int Y_SIZE = 215;
private ItemData itemData;
- private float highestValue;
+ private double highestValue;
private long firstTime;
private long lastTime;
- private Float lowestValue = null;
+ private Double lowestValue = null;
private String itemName;
private final String itemId;
private int guiLeft;
@@ -166,7 +166,7 @@ public class GuiPriceGraph extends GuiScreen {
Integer prevX = null;
Integer prevY = null;
for (Long time : itemData.get().keySet()) {
- float price = itemData.isBz()
+ double price = itemData.isBz()
? i == 0 ? itemData.bz.get(time).b : itemData.bz.get(time).s
: itemData.ah.get(time);
int xPos = (int) map(time, firstTime, lastTime, guiLeft + 17, guiLeft + 315);
@@ -250,7 +250,7 @@ public class GuiPriceGraph extends GuiScreen {
Utils.drawDottedLine(customStart, guiTop + 197, customEnd, guiTop + 197, 2, 10, 0xFFc6c6c6);
}
if (lowestDist != null && !customSelecting) {
- float price = itemData.isBz() ? itemData.bz.get(lowestDistTime).b : itemData.ah.get(lowestDistTime);
+ double price = itemData.isBz() ? itemData.bz.get(lowestDistTime).b : itemData.ah.get(lowestDistTime);
Float price2 = itemData.isBz() ? itemData.bz.get(lowestDistTime).s : null;
int xPos = (int) map(lowestDistTime, firstTime, lastTime, guiLeft + 17, guiLeft + 315);
int yPos = (int) map(price, highestValue + 10d, lowestValue - 10d, guiTop + 35, guiTop + 198);
@@ -399,7 +399,7 @@ public class GuiPriceGraph extends GuiScreen {
highestValue = 0;
lowestValue = null;
for (long key : this.itemData.get().keySet()) {
- float value1 = this.itemData.isBz() ? this.itemData.bz.get(key).b : this.itemData.ah.get(key);
+ double value1 = this.itemData.isBz() ? this.itemData.bz.get(key).b : this.itemData.ah.get(key);
Float value2 = this.itemData.isBz() ? this.itemData.bz.get(key).s : null;
if (value1 > highestValue) {
highestValue = value1;
@@ -411,7 +411,7 @@ public class GuiPriceGraph extends GuiScreen {
lowestValue = value1;
}
if (value2 != null && value2 < lowestValue) {
- lowestValue = value2;
+ lowestValue = Double.valueOf(value2);
}
}
}
@@ -504,7 +504,7 @@ public class GuiPriceGraph extends GuiScreen {
}
} else {
if (existingItemData != null) {
- prices.get(item.getKey()).ah.put(timestamp, item.getValue().getAsBigDecimal().intValue());
+ prices.get(item.getKey()).ah.put(timestamp, item.getValue().getAsBigDecimal().longValue());
} else {
TreeMap<Long, Object> mapData = new TreeMap<>();
mapData.put(timestamp, item.getValue().getAsLong());
@@ -544,7 +544,7 @@ public class GuiPriceGraph extends GuiScreen {
if (itemData.isBz())
trimmed.bz.put(lowest, new BzData((float) (sumBuy / amount), (float) (sumSell / amount)));
else
- trimmed.ah.put(lowest, (int) (sumBuy / amount));
+ trimmed.ah.put(lowest, (long) (sumBuy / amount));
}
}
return trimmed;
@@ -593,7 +593,7 @@ public class GuiPriceGraph extends GuiScreen {
}
class ItemData {
- public TreeMap<Long, Integer> ah = null;
+ public TreeMap<Long, Long> ah = null;
public TreeMap<Long, BzData> bz = null;
public ItemData() {
@@ -603,7 +603,7 @@ class ItemData {
if (bz)
this.bz = (TreeMap<Long, BzData>) map;
else
- this.ah = (TreeMap<Long, Integer>) map;
+ this.ah = (TreeMap<Long, Long>) map;
}
public TreeMap<Long, ?> get() {
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/NeuSearchCalculator.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/NeuSearchCalculator.java
new file mode 100644
index 00000000..f7306f2a
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/NeuSearchCalculator.java
@@ -0,0 +1,55 @@
+/*
+ * 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.miscgui;
+
+import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
+import io.github.moulberry.notenoughupdates.util.Calculator;
+
+import java.math.BigDecimal;
+import java.text.DecimalFormat;
+
+public class NeuSearchCalculator {
+
+ static String lastInput = "";
+ static String lastResult = null;
+
+ public static String format(String text) {
+ String calculate = calculateInSearchBar(text);
+ return text + (calculate != null ? " §e= §a" + calculate : "");
+ }
+
+ private static String calculateInSearchBar(String input) {
+ int calculationMode = NotEnoughUpdates.INSTANCE.config.misc.calculationMode;
+ if (input.isEmpty() || calculationMode == 0 || (calculationMode == 1 && !input.startsWith("!"))) return null;
+ input = calculationMode == 1 ? input.substring(1) : input;
+
+ if (!lastInput.equals(input)) {
+ lastInput = input;
+ try {
+ BigDecimal calculate = Calculator.calculate(input);
+ lastResult = new DecimalFormat("#,##0.##").format(calculate);
+ } catch (Calculator.CalculatorException ignored) {
+ lastResult = null;
+ }
+ }
+
+ return lastResult;
+ }
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/SignCalculator.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/SignCalculator.java
index 51e1d15a..ac676a98 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/SignCalculator.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/SignCalculator.java
@@ -52,8 +52,14 @@ public class SignCalculator {
if (!isEnabled()) return;
GuiEditSign guiEditSign = (GuiEditSign) event.gui;
TileEntitySign tileSign = ((AccessorGuiEditSign) guiEditSign).getTileSign();
- if (!tileSign.signText[1].getUnformattedText().equals("^^^^^^^^^^^^^^^") && !tileSign.signText[1].getUnformattedText().equals("^^^^^^")) return;
- refresh(tileSign.signText[0].getUnformattedText());
+ if (!tileSign.signText[1].getUnformattedText().equals("^^^^^^^^^^^^^^^") &&
+ !tileSign.signText[1].getUnformattedText().equals("^^^^^^")) return;
+ String source = tileSign.signText[0].getUnformattedText();
+ refresh(source);
+
+ int calculationMode = NotEnoughUpdates.INSTANCE.config.misc.calculationMode;
+ if ((calculationMode == 1 && !source.startsWith("!"))) return;
+
Utils.drawStringCentered(
getRenderedString(),
Minecraft.getMinecraft().fontRendererObj,
@@ -77,12 +83,14 @@ public class SignCalculator {
public String getRenderedString() {
if (lastResult != null) {
- DecimalFormat formatter = new DecimalFormat("#,###.00");
+ DecimalFormat formatter = new DecimalFormat("#,##0.##");
String lr = formatter.format(lastResult);
if (Minecraft.getMinecraft().fontRendererObj.getStringWidth(lr) > 90) {
- return EnumChatFormatting.WHITE + lastSource + " = " + EnumChatFormatting.RED + "Result too long";
+ return EnumChatFormatting.WHITE + lastSource + " " + EnumChatFormatting.YELLOW + "= " + EnumChatFormatting.RED +
+ "Result too long";
}
- return EnumChatFormatting.WHITE + lastSource + " = " + EnumChatFormatting.GREEN + lr;
+ return EnumChatFormatting.WHITE + lastSource + " " + EnumChatFormatting.YELLOW + "= " + EnumChatFormatting.GREEN +
+ lr;
} else if (lastException != null) {
return EnumChatFormatting.RED + lastException.getMessage();
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiContainer.java b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiContainer.java
index e3741ac7..3bc92a9c 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiContainer.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiContainer.java
@@ -22,6 +22,7 @@ package io.github.moulberry.notenoughupdates.mixins;
import io.github.moulberry.notenoughupdates.NEUOverlay;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
import io.github.moulberry.notenoughupdates.listener.RenderListener;
+import io.github.moulberry.notenoughupdates.miscfeatures.AbiphoneWarning;
import io.github.moulberry.notenoughupdates.miscfeatures.AuctionBINWarning;
import io.github.moulberry.notenoughupdates.miscfeatures.AuctionSortModeWarning;
import io.github.moulberry.notenoughupdates.miscfeatures.BetterContainers;
@@ -189,6 +190,7 @@ public abstract class MixinGuiContainer extends GuiScreen {
StorageOverlay.getInstance().overrideIsMouseOverSlot(slotIn, mouseX, mouseY, cir);
GuiCustomEnchant.getInstance().overrideIsMouseOverSlot(slotIn, mouseX, mouseY, cir);
AuctionBINWarning.getInstance().overrideIsMouseOverSlot(slotIn, mouseX, mouseY, cir);
+ AbiphoneWarning.getInstance().overrideIsMouseOverSlot(slotIn, mouseX, mouseY, cir);
}
@Redirect(method = "drawScreen", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/inventory/GuiContainer;drawGradientRect(IIIIII)V"))
@@ -305,6 +307,11 @@ public abstract class MixinGuiContainer extends GuiScreen {
return;
}
+ if (AbiphoneWarning.getInstance().onMouseClick(slotIn, slotId, clickedButton, clickType)) {
+ ci.cancel();
+ return;
+ }
+
AtomicBoolean ret = new AtomicBoolean(false);
SlotLocking.getInstance().onWindowClick(slotIn, slotId, clickedButton, clickType, (tuple) -> {
ci.cancel();
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Dungeons.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Dungeons.java
index 8f7bc15c..fead6780 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Dungeons.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Dungeons.java
@@ -31,7 +31,7 @@ import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigEditor
import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigOption;
public class Dungeons {
- /*
+
@ConfigOption(
name = "Dungeon Map",
desc = ""
@@ -39,8 +39,6 @@ public class Dungeons {
@ConfigEditorAccordion(id = 0)
public boolean dungeonMapAccordion = false;
- */
-
@Expose
@ConfigOption(
name = "\u00A7cWarning",
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Enchanting.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Enchanting.java
index 7a49f7c2..2f3ffa36 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Enchanting.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Enchanting.java
@@ -131,6 +131,15 @@ public class Enchanting {
@Expose
@ConfigOption(
+ name = "Hide Buttons",
+ desc = "Hide Inventory Buttons and Quick Commands while in the experimentation table"
+ )
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 0)
+ public boolean hideButtons = false;
+
+ @Expose
+ @ConfigOption(
name = "Ultrasequencer Next",
desc = "Set the colour of the glass pane shown behind the element in the ultrasequencer which is next"
)
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Misc.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Misc.java
index b0e4c60b..d87082b4 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Misc.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Misc.java
@@ -217,10 +217,18 @@ public class Misc {
@Expose
@ConfigOption(
- name = "Sign Calculator",
- desc = "§7Replace calculations like §9\"1+2\"§7 with the calculation result in sign popups (AH/BZ)"
+ name = "Calculator",
+ desc = "Replace calculations like §9\"1+2\"§7 with the calculation result in sign popups (AH/BZ) and in the neu search bar"
)
@ConfigEditorDropdown(values = {"Off", "Enabled with ! Prefix", "Always enabled"})
public int calculationMode = 2;
+ @Expose
+ @ConfigOption(
+ name = "Enable Abiphone Warning",
+ desc = "Asks for confirmation when removing a contact in the abiphone"
+ )
+ @ConfigEditorBoolean
+ public boolean abiphoneWarning = true;
+
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/TooltipTweaks.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/TooltipTweaks.java
index bcb7e8a7..0729df97 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/TooltipTweaks.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/TooltipTweaks.java
@@ -180,4 +180,12 @@ public class TooltipTweaks {
)
@ConfigEditorBoolean
public boolean powerStoneStats = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Bazaar Sacks Profit",
+ desc = "Orders the items in your sacks in the bazaar inventory and adding buy order toggle"
+ )
+ @ConfigEditorBoolean
+ public boolean bazaarSacksProfit = true;
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java
index e3a2091f..a21145d1 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java
@@ -31,6 +31,8 @@ import io.github.moulberry.notenoughupdates.cosmetics.ShaderManager;
import io.github.moulberry.notenoughupdates.itemeditor.GuiElementTextField;
import io.github.moulberry.notenoughupdates.profileviewer.bestiary.BestiaryPage;
import io.github.moulberry.notenoughupdates.profileviewer.trophy.TrophyFishingPage;
+import io.github.moulberry.notenoughupdates.profileviewer.weight.lily.LilyWeight;
+import io.github.moulberry.notenoughupdates.profileviewer.weight.senither.SenitherWeight;
import io.github.moulberry.notenoughupdates.util.Constants;
import io.github.moulberry.notenoughupdates.util.SBInfo;
import io.github.moulberry.notenoughupdates.util.Utils;
@@ -100,6 +102,8 @@ import java.util.function.Supplier;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import static io.github.moulberry.notenoughupdates.util.Utils.roundToNearestInt;
+
public class GuiProfileViewer extends GuiScreen {
public static final ResourceLocation pv_basic = new ResourceLocation("notenoughupdates:pv_basic.png");
public static final ResourceLocation pv_dung = new ResourceLocation("notenoughupdates:pv_dung.png");
@@ -4621,7 +4625,6 @@ public class GuiProfileViewer extends GuiScreen {
.get("avg_buy")
.getAsDouble());
String networthIRLMoney = Long.toString(Math.round(((networthInCookies * 325) / 675) * 4.99));
-
if (mouseX > guiLeft + 8 &&
mouseX < guiLeft + 8 + fontRendererObj.getStringWidth("Net Worth: " + numberFormat.format(networth))) {
if (mouseY > guiTop + 32 && mouseY < guiTop + 32 + fontRendererObj.FONT_HEIGHT) {
@@ -4656,16 +4659,24 @@ public class GuiProfileViewer extends GuiScreen {
String locationStr = null;
if (profile.getUuid().equals("20934ef9488c465180a78f861586b4cf")) {
locationStr = "Ignoring DMs";
- } else if(profile.getUuid().equals("b876ec32e396476ba1158438d83c67d4")) {
+ } else if (profile.getUuid().equals("b876ec32e396476ba1158438d83c67d4")) {
statusStr = EnumChatFormatting.LIGHT_PURPLE + "Long live Potato King";
ItemStack potato_crown = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager
.getItemInformation()
.get("POTATO_CROWN"));
potato_crown.addEnchantment(Enchantment.unbreaking, 1656638942); // this number may be useful
- Minecraft.getMinecraft().getRenderItem().renderItemIntoGUI(new ItemStack(Items.potato), guiLeft + 35, guiTop + 160);
+ Minecraft.getMinecraft().getRenderItem().renderItemIntoGUI(
+ new ItemStack(Items.potato),
+ guiLeft + 35,
+ guiTop + 160
+ );
Minecraft.getMinecraft().getRenderItem().renderItemIntoGUI(potato_crown, guiLeft + 50, guiTop + 162);
- Minecraft.getMinecraft().getRenderItem().renderItemIntoGUI(new ItemStack(Items.potato), guiLeft + 63, guiTop + 160);
- } else {
+ Minecraft.getMinecraft().getRenderItem().renderItemIntoGUI(
+ new ItemStack(Items.potato),
+ guiLeft + 63,
+ guiTop + 160
+ );
+ } else if (online) {
locationStr = NotEnoughUpdates.INSTANCE.navigation.getNameForAreaModeOrUnknown(location);
}
if (locationStr != null) {
@@ -4937,6 +4948,64 @@ public class GuiProfileViewer extends GuiScreen {
0
);
}
+
+ renderWeight(mouseX, mouseY, skillInfo, profileInfo);
+ }
+
+ private void renderWeight(int mouseX, int mouseY, JsonObject skillInfo, JsonObject profileInfo) {
+ if (skillInfo == null) {
+ return;
+ }
+
+ if(Constants.WEIGHT == null) {
+ Utils.showOutdatedRepoNotification();
+ return;
+ }
+
+ FontRenderer fr = Minecraft.getMinecraft().fontRendererObj;
+
+ SenitherWeight senitherWeight = new SenitherWeight(skillInfo);
+ LilyWeight lilyWeight = new LilyWeight(skillInfo, profileInfo);
+
+ Utils.drawStringCentered(
+ EnumChatFormatting.GREEN + "Senither Weight: " + EnumChatFormatting.GOLD + numberFormat.format(roundToNearestInt(senitherWeight.getTotalWeight().getRaw())),
+ fr,
+ guiLeft + 63,
+ guiTop + 18,
+ true,
+ 0
+ );
+
+ int textWidth = fontRendererObj.getStringWidth("Senither Weight: " + numberFormat.format(roundToNearestInt(senitherWeight.getTotalWeight().getRaw())));
+ if (mouseX > guiLeft + 63 - textWidth / 2 &&
+ mouseX < guiLeft + 63 + textWidth / 2) {
+ if (mouseY > guiTop + 12 && mouseY < guiTop + 12 + fontRendererObj.FONT_HEIGHT) {
+ tooltipToDisplay = new ArrayList<>();
+ tooltipToDisplay.add(EnumChatFormatting.GREEN + "Skills: " + EnumChatFormatting.GOLD + numberFormat.format(roundToNearestInt(senitherWeight.getSkillsWeight().getWeightStruct().getRaw())));
+ tooltipToDisplay.add(EnumChatFormatting.GREEN + "Slayer: " + EnumChatFormatting.GOLD + numberFormat.format(roundToNearestInt(senitherWeight.getSlayerWeight().getWeightStruct().getRaw())));
+ tooltipToDisplay.add(EnumChatFormatting.GREEN + "Dungeons: " + EnumChatFormatting.GOLD + numberFormat.format(roundToNearestInt(senitherWeight.getDungeonsWeight().getWeightStruct().getRaw())));
+ }
+ }
+
+ Utils.drawStringCentered(
+ EnumChatFormatting.GREEN + "Lily Weight: " + EnumChatFormatting.GOLD + numberFormat.format(roundToNearestInt(lilyWeight.getTotalWeight().getRaw())),
+ fr,
+ guiLeft + 63,
+ guiTop + 28,
+ true,
+ 0
+ );
+
+ int fontWidth = fontRendererObj.getStringWidth("Lily Weight: " + numberFormat.format(roundToNearestInt(lilyWeight.getTotalWeight().getRaw())));
+ if (mouseX > guiLeft + 63 - fontWidth / 2 &&
+ mouseX < guiLeft + 63 + fontWidth / 2) {
+ if (mouseY > guiTop + 22 && mouseY < guiTop + 22 + fontRendererObj.FONT_HEIGHT) {
+ tooltipToDisplay = new ArrayList<>();
+ tooltipToDisplay.add(EnumChatFormatting.GREEN + "Skills: " + EnumChatFormatting.GOLD + numberFormat.format(roundToNearestInt(lilyWeight.getSkillsWeight().getWeightStruct().getRaw())));
+ tooltipToDisplay.add(EnumChatFormatting.GREEN + "Slayer: " + EnumChatFormatting.GOLD + numberFormat.format(roundToNearestInt(lilyWeight.getSlayerWeight().getWeightStruct().getRaw())));
+ tooltipToDisplay.add(EnumChatFormatting.GREEN + "Dungeons: " + EnumChatFormatting.GOLD + numberFormat.format(roundToNearestInt(lilyWeight.getDungeonsWeight().getWeightStruct().getRaw())));
+ }
+ }
}
private void renderGoldBar(float x, float y, float xSize) {
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java
index 8f9594db..98bc1896 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java
@@ -113,7 +113,7 @@ public class ProfileViewer {
"ENDER_STONE", null, "MITHRIL_ORE", "HARD_STONE", "GEMSTONE_COLLECTION"
));
put(CAT_COMBAT, Utils.createList("ROTTEN_FLESH", "BONE", "STRING", "SPIDER_EYE", "SULPHUR", "ENDER_PEARL",
- "GHAST_TEAR", "SLIME_BALL", "BLAZE_ROD", "MAGMA_CREAM", null, null, null
+ "GHAST_TEAR", "SLIME_BALL", "BLAZE_ROD", "MAGMA_CREAM", null, null, null, null, "CHILI_PEPPER"
));
put(CAT_FORAGING, Utils.createList("LOG", "LOG:1", "LOG:2", "LOG_2:1", "LOG_2", "LOG:3", null));
put(CAT_FISHING, Utils.createList("RAW_FISH", "RAW_FISH:1", "RAW_FISH:2", "RAW_FISH:3", "PRISMARINE_SHARD",
@@ -218,6 +218,11 @@ public class ProfileViewer {
put("SLIME_BALL", Utils.createItemStack(Items.slime_ball, EnumChatFormatting.RED + "Slimeball"));
put("BLAZE_ROD", Utils.createItemStack(Items.blaze_rod, EnumChatFormatting.RED + "Blaze Rod"));
put("MAGMA_CREAM", Utils.createItemStack(Items.magma_cream, EnumChatFormatting.RED + "Magma Cream"));
+ put("CHILI_PEPPER", Utils.createSkull(
+ EnumChatFormatting.RED + "Chili Pepper",
+ "3d47abaa-b40b-3826-b20c-d83a7f053bd9",
+ "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZjg1OWM4ZGYxMTA5YzA4YTc1NjI3NWYxZDI4ODdjMjc0ODA0OWZlMzM4Nzc3NjlhN2I0MTVkNTZlZGE0NjlkOCJ9fX0"
+ ));
/* FORAGING COLLECTIONS */
put("LOG", Utils.createItemStack(Item.getItemFromBlock(Blocks.log), EnumChatFormatting.DARK_GREEN + "Oak Wood"));
@@ -892,6 +897,16 @@ public class ProfileViewer {
float experience_skill_catacombs =
Utils.getElementAsFloat(Utils.getElement(profileInfo, "dungeons.dungeon_types.catacombs.experience"), 0);
+ float experience_skill_healer =
+ Utils.getElementAsFloat(Utils.getElement(profileInfo, "dungeons.player_classes.healer.experience"), 0);
+ float experience_skill_archer =
+ Utils.getElementAsFloat(Utils.getElement(profileInfo, "dungeons.player_classes.archer.experience"), 0);
+ float experience_skill_tank =
+ Utils.getElementAsFloat(Utils.getElement(profileInfo, "dungeons.player_classes.tank.experience"), 0);
+ float experience_skill_mage =
+ Utils.getElementAsFloat(Utils.getElement(profileInfo, "dungeons.player_classes.mage.experience"), 0);
+ float experience_skill_berserk =
+ Utils.getElementAsFloat(Utils.getElement(profileInfo, "dungeons.player_classes.berserk.experience"), 0);
float experience_slayer_zombie =
Utils.getElementAsFloat(Utils.getElement(profileInfo, "slayer_bosses.zombie.xp"), 0);
@@ -928,6 +943,11 @@ public class ProfileViewer {
skillInfo.addProperty("experience_skill_hotm", experience_skill_hotm);
skillInfo.addProperty("experience_skill_catacombs", experience_skill_catacombs);
+ skillInfo.addProperty("experience_skill_healer", experience_skill_healer);
+ skillInfo.addProperty("experience_skill_tank", experience_skill_tank);
+ skillInfo.addProperty("experience_skill_mage", experience_skill_mage);
+ skillInfo.addProperty("experience_skill_archer", experience_skill_archer);
+ skillInfo.addProperty("experience_skill_berserk", experience_skill_berserk);
skillInfo.addProperty("experience_slayer_zombie", experience_slayer_zombie);
skillInfo.addProperty("experience_slayer_spider", experience_slayer_spider);
@@ -1295,7 +1315,7 @@ public class ProfileViewer {
}
for (Map.Entry<String, JsonElement> entry : personalAmounts.entrySet()) {
- totalAmounts.addProperty(entry.getKey(), entry.getValue().getAsInt());
+ totalAmounts.addProperty(entry.getKey(), entry.getValue().getAsLong());
}
List<JsonObject> coopProfiles = getCoopProfileInformation(profileId);
@@ -1305,7 +1325,7 @@ public class ProfileViewer {
if (coopCollectionInfoElement != null && coopCollectionInfoElement.isJsonObject()) {
for (Map.Entry<String, JsonElement> entry : coopCollectionInfoElement.getAsJsonObject().entrySet()) {
float existing = Utils.getElementAsFloat(totalAmounts.get(entry.getKey()), 0);
- totalAmounts.addProperty(entry.getKey(), existing + entry.getValue().getAsInt());
+ totalAmounts.addProperty(entry.getKey(), existing + entry.getValue().getAsLong());
}
}
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/weight/lily/LilyDungeonsWeight.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/weight/lily/LilyDungeonsWeight.java
new file mode 100644
index 00000000..31748535
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/weight/lily/LilyDungeonsWeight.java
@@ -0,0 +1,145 @@
+/*
+ * 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.profileviewer.weight.lily;
+
+import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
+import io.github.moulberry.notenoughupdates.profileviewer.weight.weight.DungeonsWeight;
+import io.github.moulberry.notenoughupdates.profileviewer.weight.weight.WeightStruct;
+import io.github.moulberry.notenoughupdates.util.Constants;
+import io.github.moulberry.notenoughupdates.util.Utils;
+import java.util.Map;
+
+public class LilyDungeonsWeight extends DungeonsWeight {
+
+ private final JsonObject profileJson;
+
+ public LilyDungeonsWeight(JsonObject player, JsonObject profileJson) {
+ super(player);
+ this.profileJson = profileJson;
+ }
+
+ @Override
+ public void getDungeonWeight() {
+ double level = Utils.getElementAsFloat(Utils.getElement(player, "level_skill_catacombs"), 0);
+ float cataXP = Utils.getElementAsFloat(Utils.getElement(player, "experience_skill_catacombs"), 0);
+
+ double extra = 0;
+ double n = 0;
+ if (cataXP < 569809640) {
+ n = 0.2 * Math.pow(level / 50, 1.538679118869934);
+ } else {
+ extra = 500.0 * Math.pow((cataXP - CATACOMBS_LEVEL_50_XP) / 142452410.0, 1.0 / 1.781925776625157);
+ }
+
+ if (level != 0) {
+ if (cataXP < 569809640) {
+ weightStruct.add(
+ new WeightStruct(1.2733079672009226 * ((Math.pow(1.18340401286164044, (level + 1)) - 1.05994990217254) * (1 + n)))
+ );
+ } else {
+ weightStruct.add(new WeightStruct((4100 + extra) * 2));
+ }
+ }
+ }
+
+ public void getDungeonCompletionWeight(String cataMode) {
+ double max1000 = 0;
+ double mMax1000 = 0;
+ JsonObject dungeonsCompletionWorth = Utils.getElement(Constants.WEIGHT, "lily.dungeons.completion_worth").getAsJsonObject();
+ for (Map.Entry<String, JsonElement> dcwEntry : dungeonsCompletionWorth.entrySet()) {
+ if (dcwEntry.getKey().startsWith("catacombs_")) {
+ max1000 += dcwEntry.getValue().getAsDouble();
+ } else {
+ mMax1000 += dcwEntry.getValue().getAsDouble();
+ }
+ }
+ max1000 *= 1000;
+ mMax1000 *= 1000;
+ double upperBound = 1500;
+ if (cataMode.equals("normal")) {
+ if (Utils.getElement(profileJson, "dungeons.dungeon_types.catacombs.tier_completions") == null) {
+ return;
+ }
+
+ double score = 0;
+ for (Map.Entry<String, JsonElement> normalFloor : Utils
+ .getElement(profileJson, "dungeons.dungeon_types.catacombs.tier_completions")
+ .getAsJsonObject()
+ .entrySet()) {
+ int amount = normalFloor.getValue().getAsInt();
+ double excess = 0;
+ if (amount > 1000) {
+ excess = amount - 1000;
+ amount = 1000;
+ }
+
+ double floorScore = amount * dungeonsCompletionWorth.get("catacombs_" + normalFloor.getKey()).getAsDouble();
+ if (excess > 0) floorScore *= Math.log(excess / 1000 + 1) / Math.log(7.5) + 1;
+ score += floorScore;
+ }
+
+ weightStruct.add(new WeightStruct(score / max1000 * upperBound * 2));
+ } else {
+ JsonObject dungeonsCompletionBuffs = Utils.getElement(Constants.WEIGHT, "lily.dungeons.completion_buffs").getAsJsonObject();
+
+ if (Utils.getElement(profileJson, "dungeons.dungeon_types.master_catacombs.tier_completions") == null) {
+ return;
+ }
+
+ for (Map.Entry<String, JsonElement> masterFloor : Utils
+ .getElement(profileJson, "dungeons.dungeon_types.master_catacombs.tier_completions")
+ .getAsJsonObject()
+ .entrySet()) {
+ if (dungeonsCompletionBuffs.get(masterFloor.getKey()) != null) {
+ int amount = masterFloor.getValue().getAsInt();
+ double threshold = 20;
+ if (amount >= threshold) {
+ upperBound += dungeonsCompletionBuffs.get(masterFloor.getKey()).getAsInt();
+ } else {
+ upperBound +=
+ dungeonsCompletionBuffs.get(masterFloor.getKey()).getAsInt() * Math.pow((amount / threshold), 1.840896416);
+ }
+ }
+ }
+
+ double masterScore = 0;
+ for (Map.Entry<String, JsonElement> masterFloor : Utils
+ .getElement(profileJson, "dungeons.dungeon_types.master_catacombs.tier_completions")
+ .getAsJsonObject()
+ .entrySet()) {
+ int amount = masterFloor.getValue().getAsInt();
+ double excess = 0;
+ if (amount > 1000) {
+ excess = amount - 1000;
+ amount = 1000;
+ }
+
+ double floorScore = amount * dungeonsCompletionWorth.get("master_catacombs_" + masterFloor.getKey()).getAsDouble();
+ if (excess > 0) {
+ floorScore *= (Math.log((excess / 1000) + 1) / Math.log(6)) + 1;
+ }
+ masterScore += floorScore;
+ }
+
+ weightStruct.add(new WeightStruct((masterScore / mMax1000) * upperBound * 2));
+ }
+ }
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/weight/lily/LilySkillsWeight.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/weight/lily/LilySkillsWeight.java
new file mode 100644
index 00000000..bbe07a5a
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/weight/lily/LilySkillsWeight.java
@@ -0,0 +1,101 @@
+/*
+ * 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.profileviewer.weight.lily;
+
+import static io.github.moulberry.notenoughupdates.profileviewer.weight.weight.Weight.SKILL_NAMES;
+
+import com.google.gson.JsonArray;
+import com.google.gson.JsonObject;
+import io.github.moulberry.notenoughupdates.profileviewer.ProfileViewer;
+import io.github.moulberry.notenoughupdates.profileviewer.weight.weight.SkillsWeight;
+import io.github.moulberry.notenoughupdates.profileviewer.weight.weight.WeightStruct;
+import io.github.moulberry.notenoughupdates.util.Constants;
+import io.github.moulberry.notenoughupdates.util.Utils;
+
+public class LilySkillsWeight extends SkillsWeight {
+
+ public LilySkillsWeight(JsonObject player) {
+ super(player);
+ }
+
+ @Override
+ public void getSkillsWeight(String skillName) {
+ double skillAverage = 0;
+ for (String skill : SKILL_NAMES) {
+ skillAverage +=
+ (int) ProfileViewer.getLevel(
+ Utils.getElement(Constants.LEVELING, "leveling_xp").getAsJsonArray(),
+ Utils.getElementAsInt(Utils.getElement(player, "experience_skill_" + skill), 0),
+ 60,
+ false
+ )
+ .level;
+ }
+ skillAverage /= SKILL_NAMES.size();
+
+ float currentExp = Utils.getElementAsFloat(Utils.getElement(player, "experience_skill_" + skillName), 0);
+ int currentLevel = (int) ProfileViewer.getLevel(
+ Utils.getElement(Constants.LEVELING, "leveling_xp").getAsJsonArray(),
+ currentExp,
+ 60,
+ false
+ )
+ .level;
+
+ JsonArray srwTable = Utils.getElement(Constants.WEIGHT, "lily.skills.ratio_weight." + skillName).getAsJsonArray();
+ double base =
+ (
+ (12 * Math.pow((skillAverage / 60), 2.44780217148309)) *
+ srwTable.get(currentLevel).getAsDouble() *
+ srwTable.get(srwTable.size() - 1).getAsDouble()
+ ) +
+ (srwTable.get(srwTable.size() - 1).getAsDouble() * Math.pow(currentLevel / 60.0, Math.pow(2, 0.5)));
+ base *= 1.8162162162162162;
+ double overflow = 0;
+ if (currentExp > 111672425) {
+ double factor = Utils.getElementAsFloat(Utils.getElement(Constants.WEIGHT, "lily.skills.factors." + skillName), 0);
+ double effectiveOver = effectiveXP(currentExp - 111672425, factor);
+ double t =
+ (effectiveOver / 111672425) *
+ Utils.getElementAsFloat(Utils.getElement(Constants.WEIGHT, "lily.skills.overflow_multipliers." + skillName), 0);
+ if (t > 0) {
+ overflow += 1.8162162162162162 * t;
+ }
+ }
+
+ weightStruct.add(new WeightStruct(base, overflow));
+ }
+
+ private double effectiveXP(double xp, double factor) {
+ if (xp < 111672425) {
+ return xp;
+ } else {
+ double remainingXP = xp;
+ double z = 0;
+ for (int i = 0; i <= (int) (xp / 111672425); i++) {
+ if (remainingXP >= 111672425) {
+ remainingXP -= 111672425;
+ z += Math.pow(factor, i);
+ }
+ }
+ return z * 111672425;
+ }
+ }
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/weight/lily/LilySlayerWeight.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/weight/lily/LilySlayerWeight.java
new file mode 100644
index 00000000..5c55633a
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/weight/lily/LilySlayerWeight.java
@@ -0,0 +1,91 @@
+/*
+ * 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.profileviewer.weight.lily;
+
+import com.google.gson.JsonObject;
+import io.github.moulberry.notenoughupdates.profileviewer.weight.weight.SlayerWeight;
+import io.github.moulberry.notenoughupdates.profileviewer.weight.weight.WeightStruct;
+import io.github.moulberry.notenoughupdates.util.Constants;
+import io.github.moulberry.notenoughupdates.util.Utils;
+
+public class LilySlayerWeight extends SlayerWeight {
+
+ public LilySlayerWeight(JsonObject player) {
+ super(player);
+ }
+
+ public void getSlayerWeight(String slayerName) {
+ int currentSlayerXp = Utils.getElementAsInt(Utils.getElement(player, "experience_slayer_" + slayerName), 0);
+
+ double score;
+ double d = currentSlayerXp / 100000.0;
+ if (currentSlayerXp >= 6416) {
+ double D = (d - Math.pow(3, (-5.0 / 2))) * (d + Math.pow(3, -5.0 / 2));
+ double u = Math.cbrt(3 * (d + Math.sqrt(D)));
+ double v = Math.cbrt(3 * (d - Math.sqrt(D)));
+ score = u + v - 1;
+ } else {
+ score = Math.sqrt(4.0 / 3) * Math.cos(Math.acos(d * Math.pow(3, 5.0 / 2)) / 3) - 1;
+ }
+
+ double scaleFactor = Utils.getElementAsFloat(
+ Utils.getElement(Constants.WEIGHT, "lily.slayer.deprecation_scaling." + slayerName),
+ 0
+ );
+ int intScore = (int) score;
+ double distance = currentSlayerXp - actualInt(intScore);
+ double effectiveDistance = distance * Math.pow(scaleFactor, intScore);
+ double effectiveScore = effectiveInt(intScore, scaleFactor) + effectiveDistance;
+ double weight;
+ switch (slayerName) {
+ case "zombie":
+ weight = (effectiveScore / 8390.64) + (currentSlayerXp / 1000000.0);
+ break;
+ case "spider":
+ weight = (effectiveScore / 7019.57) + ((currentSlayerXp * 1.6) / 1000000);
+ break;
+ case "wolf":
+ weight = (effectiveScore / 2982.06) + ((currentSlayerXp * 3.6) / 1000000);
+ break;
+ case "enderman":
+ weight = (effectiveScore / 1118.81) + ((currentSlayerXp * 10.0) / 1000000);
+ break;
+ case "blaze":
+ weight = (effectiveScore / 751.281) + ((currentSlayerXp * 15.0) / 1000000);
+ break;
+ default:
+ return;
+ }
+
+ weightStruct.add(new WeightStruct(2 * weight));
+ }
+
+ private double actualInt(int intScore) {
+ return (((Math.pow(intScore, 3) / 6) + (Math.pow(intScore, 2) / 2) + (intScore / 3.0)) * 100000);
+ }
+
+ private double effectiveInt(int intScore, double scaleFactor) {
+ double total = 0;
+ for (int k = 0; k < intScore; k++) {
+ total += (Math.pow((k + 1), 2) + (k + 1)) * Math.pow(scaleFactor, (k + 1));
+ }
+ return 1000000 * total * (0.05 / scaleFactor);
+ }
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/weight/lily/LilyWeight.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/weight/lily/LilyWeight.java
new file mode 100644
index 00000000..9a851f12
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/weight/lily/LilyWeight.java
@@ -0,0 +1,48 @@
+/*
+ * 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.profileviewer.weight.lily;
+
+import com.google.gson.JsonObject;
+import io.github.moulberry.notenoughupdates.profileviewer.weight.weight.Weight;
+
+public class LilyWeight extends Weight {
+
+ public LilyWeight(JsonObject player, JsonObject profileJson) {
+ super(new LilySlayerWeight(player), new LilySkillsWeight(player), new LilyDungeonsWeight(player, profileJson));
+ }
+
+ @Override
+ public void calculateWeight() {
+ slayerWeight.getWeightStruct().reset();
+ skillsWeight.getWeightStruct().reset();
+ dungeonsWeight.getWeightStruct().reset();
+
+ for (String slayerName : SLAYER_NAMES) {
+ slayerWeight.getSlayerWeight(slayerName);
+ }
+ for (String skillName : SKILL_NAMES) {
+ skillsWeight.getSkillsWeight(skillName);
+ }
+
+ dungeonsWeight.getDungeonWeight();
+ ((LilyDungeonsWeight) dungeonsWeight).getDungeonCompletionWeight("normal");
+ ((LilyDungeonsWeight) dungeonsWeight).getDungeonCompletionWeight("master");
+ }
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/weight/senither/SenitherDungeonsWeight.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/weight/senither/SenitherDungeonsWeight.java
new file mode 100644
index 00000000..198d34c8
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/weight/senither/SenitherDungeonsWeight.java
@@ -0,0 +1,80 @@
+/*
+ * 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.profileviewer.weight.senither;
+
+import com.google.gson.JsonObject;
+import io.github.moulberry.notenoughupdates.profileviewer.ProfileViewer;
+import io.github.moulberry.notenoughupdates.profileviewer.weight.weight.DungeonsWeight;
+import io.github.moulberry.notenoughupdates.profileviewer.weight.weight.WeightStruct;
+import io.github.moulberry.notenoughupdates.util.Constants;
+import io.github.moulberry.notenoughupdates.util.Utils;
+
+public class SenitherDungeonsWeight extends DungeonsWeight {
+
+ public SenitherDungeonsWeight(JsonObject player) {
+ super(player);
+ }
+
+ public void getClassWeight(String className) {
+ float currentClassXp = Utils.getElementAsFloat(Utils.getElement(player, "experience_skill_" + className), 0);
+ double currentClassLevel = ProfileViewer.getLevel(
+ Utils.getElement(Constants.LEVELING, "catacombs").getAsJsonArray(),
+ currentClassXp,
+ Utils.getElementAsInt(Utils.getElement(Constants.LEVELING, "leveling_caps.catacombs"), 50),
+ false
+ )
+ .level;
+ double base =
+ Math.pow(currentClassLevel, 4.5) *
+ Utils.getElementAsFloat(Utils.getElement(Constants.WEIGHT, "senither.dungeons.classes." + className), 0);
+
+ if (currentClassXp <= CATACOMBS_LEVEL_50_XP) {
+ weightStruct.add(new WeightStruct(base));
+ return;
+ }
+
+ double remaining = currentClassXp - CATACOMBS_LEVEL_50_XP;
+ double splitter = (4 * CATACOMBS_LEVEL_50_XP) / base;
+ weightStruct.add(new WeightStruct(Math.floor(base), Math.pow(remaining / splitter, 0.968)));
+ }
+
+ @Override
+ public void getDungeonWeight() {
+ float catacombsSkillXp = Utils.getElementAsFloat(Utils.getElement(player, "experience_skill_catacombs"), 0);
+
+ double level = ProfileViewer.getLevel(
+ Utils.getElement(Constants.LEVELING, "catacombs").getAsJsonArray(),
+ catacombsSkillXp,
+ Utils.getElementAsInt(Utils.getElement(Constants.LEVELING, "leveling_caps.catacombs"), 50),
+ false
+ )
+ .level;
+ double base = Math.pow(level, 4.5) * Utils.getElementAsFloat(Utils.getElement(Constants.WEIGHT, "senither.dungeons.catacombs"), 0);
+
+ if (catacombsSkillXp <= CATACOMBS_LEVEL_50_XP) {
+ weightStruct.add(new WeightStruct(base));
+ return;
+ }
+
+ double remaining = catacombsSkillXp - CATACOMBS_LEVEL_50_XP;
+ double splitter = (4 * CATACOMBS_LEVEL_50_XP) / base;
+ weightStruct.add(new WeightStruct(Math.floor(base), Math.pow(remaining / splitter, 0.968)));
+ }
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/weight/senither/SenitherSkillsWeight.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/weight/senither/SenitherSkillsWeight.java
new file mode 100644
index 00000000..081cab6d
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/weight/senither/SenitherSkillsWeight.java
@@ -0,0 +1,66 @@
+/*
+ * 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.profileviewer.weight.senither;
+
+import com.google.gson.JsonArray;
+import com.google.gson.JsonObject;
+import io.github.moulberry.notenoughupdates.profileviewer.ProfileViewer;
+import io.github.moulberry.notenoughupdates.profileviewer.weight.weight.SkillsWeight;
+import io.github.moulberry.notenoughupdates.profileviewer.weight.weight.WeightStruct;
+import io.github.moulberry.notenoughupdates.util.Constants;
+import io.github.moulberry.notenoughupdates.util.Utils;
+
+public class SenitherSkillsWeight extends SkillsWeight {
+
+ public SenitherSkillsWeight(JsonObject player) {
+ super(player);
+ }
+
+ @Override
+ public void getSkillsWeight(String skillName) {
+ JsonArray curWeights = Utils.getElement(Constants.WEIGHT, "senither.skills." + skillName).getAsJsonArray();
+ double exponent = curWeights.get(0).getAsDouble();
+ double divider = curWeights.get(1).getAsDouble();
+
+ float currentSkillXp = Utils.getElementAsFloat(Utils.getElement(player, "experience_skill_" + skillName), 0);
+
+ if (currentSkillXp > 0) {
+ int maxLevel = skillName.equals("farming")
+ ? 60
+ : Utils.getElementAsInt(Utils.getElement(Constants.LEVELING, "leveling_caps." + skillName), 50);
+ double level = ProfileViewer.getLevel(
+ Utils.getElement(Constants.LEVELING, "leveling_xp").getAsJsonArray(),
+ currentSkillXp,
+ maxLevel,
+ false
+ )
+ .level;
+
+ double maxLevelExp = maxLevel == 50 ? 55172425 : 111672425;
+ double base = Math.pow(level * 10, 0.5 + exponent + (level / 100)) / 1250;
+ if (currentSkillXp <= maxLevelExp) {
+ weightStruct.add(new WeightStruct(base));
+ return;
+ }
+
+ weightStruct.add(new WeightStruct(Math.round(base), Math.pow((currentSkillXp - maxLevelExp) / divider, 0.968)));
+ }
+ }
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/weight/senither/SenitherSlayerWeight.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/weight/senither/SenitherSlayerWeight.java
new file mode 100644
index 00000000..3b7b2498
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/weight/senither/SenitherSlayerWeight.java
@@ -0,0 +1,66 @@
+/*
+ * 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.profileviewer.weight.senither;
+
+import com.google.gson.JsonArray;
+import com.google.gson.JsonObject;
+import io.github.moulberry.notenoughupdates.profileviewer.weight.weight.SlayerWeight;
+import io.github.moulberry.notenoughupdates.profileviewer.weight.weight.WeightStruct;
+import io.github.moulberry.notenoughupdates.util.Constants;
+import io.github.moulberry.notenoughupdates.util.Utils;
+
+public class SenitherSlayerWeight extends SlayerWeight {
+
+ public SenitherSlayerWeight(JsonObject player) {
+ super(player);
+ }
+
+ public void getSlayerWeight(String slayerName) {
+ if (slayerName.equals("blaze")) {
+ return;
+ }
+
+ JsonArray curWeights = Utils.getElement(Constants.WEIGHT, "senither.slayer." + slayerName).getAsJsonArray();
+ double divider = curWeights.get(0).getAsDouble();
+ double modifier = curWeights.get(1).getAsDouble();
+
+ int currentSlayerXp = Utils.getElementAsInt(Utils.getElement(player, "experience_slayer_" + slayerName), 0);
+
+ if (currentSlayerXp <= 1000000) {
+ weightStruct.add(new WeightStruct(currentSlayerXp == 0 ? 0 : currentSlayerXp / divider));
+ return;
+ }
+
+ double base = 1000000 / divider;
+ double remaining = currentSlayerXp - 1000000;
+ double overflow = 0;
+ double initialModifier = modifier;
+
+ while (remaining > 0) {
+ double left = Math.min(remaining, 1000000);
+
+ overflow += Math.pow(left / (divider * (1.5 + modifier)), 0.942);
+ modifier += initialModifier;
+ remaining -= left;
+ }
+
+ weightStruct.add(new WeightStruct(base, overflow));
+ }
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/weight/senither/SenitherWeight.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/weight/senither/SenitherWeight.java
new file mode 100644
index 00000000..e0a2cf36
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/weight/senither/SenitherWeight.java
@@ -0,0 +1,50 @@
+/*
+ * 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.profileviewer.weight.senither;
+
+import com.google.gson.JsonObject;
+import io.github.moulberry.notenoughupdates.profileviewer.weight.weight.Weight;
+
+public class SenitherWeight extends Weight {
+
+ public SenitherWeight(JsonObject player) {
+ super(new SenitherSlayerWeight(player), new SenitherSkillsWeight(player), new SenitherDungeonsWeight(player));
+ }
+
+ @Override
+ public void calculateWeight() {
+ slayerWeight.getWeightStruct().reset();
+ skillsWeight.getWeightStruct().reset();
+ dungeonsWeight.getWeightStruct().reset();
+
+ for (String slayerName : SLAYER_NAMES) {
+ slayerWeight.getSlayerWeight(slayerName);
+ }
+
+ for (String skillName : SKILL_NAMES) {
+ skillsWeight.getSkillsWeight(skillName);
+ }
+
+ dungeonsWeight.getDungeonWeight();
+ for (String dungeonClassName : DUNGEON_CLASS_NAMES) {
+ ((SenitherDungeonsWeight) dungeonsWeight).getClassWeight(dungeonClassName);
+ }
+ }
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/weight/weight/DungeonsWeight.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/weight/weight/DungeonsWeight.java
new file mode 100644
index 00000000..bab0346c
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/weight/weight/DungeonsWeight.java
@@ -0,0 +1,41 @@
+/*
+ * 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.profileviewer.weight.weight;
+
+import com.google.gson.JsonObject;
+
+public abstract class DungeonsWeight {
+
+ protected static final long CATACOMBS_LEVEL_50_XP = 569809640;
+
+ protected final JsonObject player;
+ protected final WeightStruct weightStruct;
+
+ public DungeonsWeight(JsonObject player) {
+ this.player = player;
+ this.weightStruct = new WeightStruct();
+ }
+
+ public WeightStruct getWeightStruct() {
+ return weightStruct;
+ }
+
+ public abstract void getDungeonWeight();
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/weight/weight/SkillsWeight.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/weight/weight/SkillsWeight.java
new file mode 100644
index 00000000..b5e4e2b5
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/weight/weight/SkillsWeight.java
@@ -0,0 +1,39 @@
+/*
+ * 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.profileviewer.weight.weight;
+
+import com.google.gson.JsonObject;
+
+public abstract class SkillsWeight {
+
+ protected final JsonObject player;
+ protected final WeightStruct weightStruct;
+
+ public SkillsWeight(JsonObject player) {
+ this.player = player;
+ this.weightStruct = new WeightStruct();
+ }
+
+ public WeightStruct getWeightStruct() {
+ return weightStruct;
+ }
+
+ public abstract void getSkillsWeight(String skillName);
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/weight/weight/SlayerWeight.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/weight/weight/SlayerWeight.java
new file mode 100644
index 00000000..1ec83689
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/weight/weight/SlayerWeight.java
@@ -0,0 +1,39 @@
+/*
+ * 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.profileviewer.weight.weight;
+
+import com.google.gson.JsonObject;
+
+public abstract class SlayerWeight {
+
+ protected final JsonObject player;
+ protected final WeightStruct weightStruct;
+
+ public SlayerWeight(JsonObject player) {
+ this.player = player;
+ this.weightStruct = new WeightStruct();
+ }
+
+ public WeightStruct getWeightStruct() {
+ return weightStruct;
+ }
+
+ public abstract void getSlayerWeight(String slayerName);
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/weight/weight/Weight.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/weight/weight/Weight.java
new file mode 100644
index 00000000..f3e0cef3
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/weight/weight/Weight.java
@@ -0,0 +1,67 @@
+/*
+ * 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.profileviewer.weight.weight;
+
+import java.util.Arrays;
+import java.util.List;
+
+public abstract class Weight {
+
+ protected static final List<String> SLAYER_NAMES = Arrays.asList("wolf", "zombie", "spider", "enderman", "blaze");
+ protected static final List<String> DUNGEON_CLASS_NAMES = Arrays.asList("healer", "mage", "berserk", "archer", "tank");
+ public static final List<String> SKILL_NAMES = Arrays.asList(
+ "taming",
+ "mining",
+ "foraging",
+ "enchanting",
+ "farming",
+ "combat",
+ "fishing",
+ "alchemy"
+ );
+ protected final SlayerWeight slayerWeight;
+ protected final SkillsWeight skillsWeight;
+ protected final DungeonsWeight dungeonsWeight;
+
+ public Weight(SlayerWeight slayerWeight, SkillsWeight skillsWeight, DungeonsWeight dungeonsWeight) {
+ this.slayerWeight = slayerWeight;
+ this.skillsWeight = skillsWeight;
+ this.dungeonsWeight = dungeonsWeight;
+ this.calculateWeight();
+ }
+
+ public WeightStruct getTotalWeight() {
+ return new WeightStruct().add(slayerWeight.getWeightStruct()).add(skillsWeight.getWeightStruct()).add(dungeonsWeight.getWeightStruct());
+ }
+
+ public SlayerWeight getSlayerWeight() {
+ return slayerWeight;
+ }
+
+ public SkillsWeight getSkillsWeight() {
+ return skillsWeight;
+ }
+
+ public DungeonsWeight getDungeonsWeight() {
+ return dungeonsWeight;
+ }
+
+ protected abstract void calculateWeight();
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/weight/weight/WeightStruct.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/weight/weight/WeightStruct.java
new file mode 100644
index 00000000..924dcb40
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/weight/weight/WeightStruct.java
@@ -0,0 +1,54 @@
+/*
+ * 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.profileviewer.weight.weight;
+
+public class WeightStruct {
+
+ private double base;
+ private double overflow;
+
+ public WeightStruct() {
+ this(0, 0);
+ }
+
+ public WeightStruct(double base) {
+ this(base, 0);
+ }
+
+ public WeightStruct(double base, double overflow) {
+ this.base = base;
+ this.overflow = overflow;
+ }
+
+ public WeightStruct add(WeightStruct o) {
+ this.base += o.base;
+ this.overflow += o.overflow;
+ return this;
+ }
+
+ public double getRaw() {
+ return base + overflow;
+ }
+
+ public void reset() {
+ this.base = 0;
+ this.overflow = 0;
+ }
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/Constants.java b/src/main/java/io/github/moulberry/notenoughupdates/util/Constants.java
index 5279ed73..1d226dc8 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/util/Constants.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/util/Constants.java
@@ -70,6 +70,7 @@ public class Constants {
public static JsonObject FAIRYSOULS;
public static JsonObject REFORGESTONES;
public static JsonObject TROPHYFISH;
+ public static JsonObject WEIGHT;
private static final ReentrantLock lock = new ReentrantLock();
@@ -90,6 +91,7 @@ public class Constants {
FAIRYSOULS = Utils.getConstant("fairy_souls", gson);
REFORGESTONES = Utils.getConstant("reforgestones", gson);
TROPHYFISH = Utils.getConstant("trophyfish", gson);
+ WEIGHT = Utils.getConstant("weight", gson);
} catch (Exception ex) {
ex.printStackTrace();
} finally {
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/SkytilsCompat.java b/src/main/java/io/github/moulberry/notenoughupdates/util/SkytilsCompat.java
index 97c11fe2..f0cb5732 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/util/SkytilsCompat.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/util/SkytilsCompat.java
@@ -24,6 +24,7 @@ import net.minecraft.item.ItemStack;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
+import java.util.Arrays;
public class SkytilsCompat {
// Defer static initialization
@@ -45,34 +46,47 @@ public class SkytilsCompat {
static Method skytilsGetShowItemRarity = null;
static {
- try {
- skytilsClass = Class.forName("gg.skytils.skytilsmod.Skytils");
- isSkytilsPresent = true;
- } catch (ClassNotFoundException ignored) {
+ Exception exception = null;
+ for (String packageStart : Arrays.asList("gg.skytils", "skytils")) {
+ isSkytilsPresent = false;
+ try {
+ skytilsClass = Class.forName(packageStart + ".skytilsmod.Skytils");
+ isSkytilsPresent = true;
+ } catch (ClassNotFoundException ignored) {
+ }
+
+ if (isSkytilsPresent) {
+ try {
+ Class<?> skytilsCompanionClass = Class.forName(packageStart + ".skytilsmod.Skytils$Companion");
+ skytilsConfigClass = Class.forName(packageStart + ".skytilsmod.core.Config");
+ Field skytilsCompanionField = skytilsClass.getField("Companion");
+ skytilsCompanionObject = skytilsCompanionField.get(null);
+ Method skytilsGetConfigMethod = skytilsCompanionClass.getMethod("getConfig");
+ skytilsConfigObject = skytilsGetConfigMethod.invoke(skytilsCompanionObject);
+ skytilsGetShowItemRarity = skytilsConfigClass.getMethod("getShowItemRarity");
+ renderUtilClass = Class.forName(packageStart + ".skytilsmod.utils.RenderUtil");
+ renderRarityMethod = renderUtilClass.getDeclaredMethod(
+ "renderRarity",
+ ItemStack.class,
+ Integer.TYPE,
+ Integer.TYPE
+ );
+ isSkytilsFullyPresent = true;
+ break;
+ } catch (ClassNotFoundException | NoSuchMethodException | NoSuchFieldException | IllegalAccessException |
+ InvocationTargetException e) {
+ exception = e;
+ }
+ }
}
- try {
- Class<?> skytilsCompanionClass = Class.forName("gg.skytils.skytilsmod.Skytils$Companion");
- skytilsConfigClass = Class.forName("gg.skytils.skytilsmod.core.Config");
- Field skytilsCompanionField = skytilsClass.getField("Companion");
- skytilsCompanionObject = skytilsCompanionField.get(null);
- Method skytilsGetConfigMethod = skytilsCompanionClass.getMethod("getConfig");
- skytilsConfigObject = skytilsGetConfigMethod.invoke(skytilsCompanionObject);
- skytilsGetShowItemRarity = skytilsConfigClass.getMethod("getShowItemRarity");
- renderUtilClass = Class.forName("gg.skytils.skytilsmod.utils.RenderUtil");
- renderRarityMethod = renderUtilClass.getDeclaredMethod(
- "renderRarity",
- ItemStack.class,
- Integer.TYPE,
- Integer.TYPE
- );
- isSkytilsFullyPresent = true;
- } catch (ClassNotFoundException | NoSuchMethodException | NoSuchFieldException | IllegalAccessException |
- InvocationTargetException e) {
- System.err.println("Failed to get Skytils class even tho Skytils mod is present. This is (probably) a NEU bug");
- e.printStackTrace();
+
+ if (!isSkytilsFullyPresent) {
+ if (exception != null) {
+ System.err.println("Failed to get Skytils class even tho Skytils mod is present. This is (probably) a NEU bug");
+ exception.printStackTrace();
+ }
}
}
-
}
public static boolean isSkytilsFullyLoaded() {
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java b/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java
index 756c8d4c..29c039b8 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java
@@ -669,6 +669,10 @@ public class Utils {
return (float) Math.round(value * scale) / scale;
}
+ public static int roundToNearestInt(double value) {
+ return (int) Math.round(value);
+ }
+
// Parses Roman numerals, allowing for single character irregular subtractive notation (e.g. IL is 49, IIL is invalid)
public static int parseRomanNumeral(String input) {
int prevVal = 0;