")[1].split("")[0]; // hide top bar
+ wiki = wiki.split("")[0]; // hide giant bottom list
+ wiki = wiki.split("
")[0]; // hide small bottom category thing
+ wiki = replacePattern.matcher(wiki).replaceAll("");
+ wiki = wiki.replaceAll(
+ "
",
+ ""
+ ); // hide beta box
+ wiki = wiki.replaceAll("
.*
", ""); // hide title
+ wiki = wiki.replace("src=\"/", "src=\"https://wiki.hypixel.net/");
+ wiki = wiki.replace("\uD83D\uDDF8", "✓"); // replace checkmark with one that renders
+ wiki = wiki.replace("\uD83E\uDC10", "\u27F5"); // replace left arrow with one that renders
+ wiki = wiki.replace("\uD83E\uDC12", "\u27F6"); // replace right arrow with one that renders
+ } else {
+ String[] split = wiki.split("");
+ wiki = split[split.length - 1]; //Remove everything before infobox
+ wiki = wiki.split("
")[0]; //Remove navbox
+ wiki = wiki.split("= barX && mouseX <= barWidth && mouseY >= barY && mouseY <= barHeight || selected;
+ Gui.drawRect(barX, barY, barWidth, barHeight, new Color(255, 255, 255, isHovered ? 150 : 100).getRGB());
+ }
} else {
scrollHeight.setValue(0);
@@ -435,6 +508,27 @@ public class HTMLInfoPane extends TextInfoPane {
@Override
public void mouseInput(int width, int height, int mouseX, int mouseY, boolean mouseDown) {
+ int paneWidth = (int) (width / 3 * overlay.getWidthMult());
+ int rightSide = (int) (width * overlay.getInfoPaneOffsetFactor());
+ int leftSide = rightSide - paneWidth;
+ int imageW = paneWidth - overlay.getBoxPadding() * 2;
+ float scaleF = IMAGE_WIDTH * ZOOM_FACTOR / (float) imageW;
+ float xSize = Math.min((paneWidth - overlay.getBoxPadding() * 2f) / imageWidth * scaleF, 1);
+ float xMax = xMin + xSize;
+ int barX = (int) (xMin * imageW) + leftSide + overlay.getBoxPadding();
+ int barY = height - overlay.getBoxPadding() - 10;
+ int barWidth = (int) (xMax * imageW) + leftSide + overlay.getBoxPadding();
+ int barHeight = height - overlay.getBoxPadding() - 5;
+ if (!mouseDown)
+ selected = false;
+ if (mouseX >= barX && mouseX <= barWidth && mouseY >= barY && mouseY <= barHeight && mouseDown || selected) {
+ if (!selected)
+ mouseOffset = mouseX - barX;
+ xMin = (mouseX - leftSide - overlay.getBoxPadding() / 2f - mouseOffset) / imageWidth * scaleF;
+ xMin = Math.max(0, xMin);
+ xMin = Math.min(xMin, 1 - xSize);
+ selected = true;
+ }
super.mouseInput(width, height, mouseX, mouseY, mouseDown);
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/infopanes/InfoPane.java b/src/main/java/io/github/moulberry/notenoughupdates/infopanes/InfoPane.java
index 70d7d65b..03cb64f6 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/infopanes/InfoPane.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/infopanes/InfoPane.java
@@ -61,10 +61,10 @@ public abstract class InfoPane extends Gui {
return HTMLInfoPane.createFromWikiUrl(overlay, manager, name, infoText);
case "WIKI":
return CompletableFuture.completedFuture(
- HTMLInfoPane.createFromWikiText(overlay, manager, name, internalName, infoText));
+ HTMLInfoPane.createFromWikiText(overlay, manager, name, internalName, infoText, false));
case "HTML":
return CompletableFuture.completedFuture(
- new HTMLInfoPane(overlay, manager, name, internalName, infoText));
+ new HTMLInfoPane(overlay, manager, name, internalName, infoText, false));
default:
return CompletableFuture.completedFuture(
new TextInfoPane(overlay, manager, name, infoText));
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 3955b35f..63a08d41 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiPriceGraph.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiPriceGraph.java
@@ -117,12 +117,11 @@ public class GuiPriceGraph extends GuiScreen {
Utils.drawStringCentered("Loading...", Minecraft.getMinecraft().fontRendererObj,
guiLeft + 166, guiTop + 116, false, 0xffffff00
);
- else if (dataPoints == null || dataPoints.get() == null || dataPoints.get().size() <= 1)
+ else if (dataPoints == null || dataPoints.get() == null || dataPoints.get().size() <= 1 || lowestValue == null)
Utils.drawStringCentered("No data found.", Minecraft.getMinecraft().fontRendererObj,
guiLeft + 166, guiTop + 116, false, 0xffff0000
);
else {
-
int graphColor = SpecialColour.specialToChromaRGB(NotEnoughUpdates.INSTANCE.config.ahGraph.graphColor);
int graphColor2 = SpecialColour.specialToChromaRGB(NotEnoughUpdates.INSTANCE.config.ahGraph.graphColor2);
Integer lowestDist = null;
@@ -399,15 +398,17 @@ public class GuiPriceGraph extends GuiScreen {
if (!file.getName().endsWith(".gz")) continue;
if (file.lastModified() <
System.currentTimeMillis() - NotEnoughUpdates.INSTANCE.config.ahGraph.dataRetention * 86400000L)
+ //noinspection ResultOfMethodCallIgnored
file.delete();
}
Date date = new Date();
Long epochSecond = date.toInstant().getEpochSecond();
File file = new File(dir, "prices_" + format.format(date) + ".gz");
HashMap prices = new HashMap<>();
- if (file.exists())
- prices = load(file);
- if (prices == null) return;
+ if (file.exists()) {
+ HashMap tempPrices = load(file);
+ if (tempPrices != null) prices = tempPrices;
+ }
for (Map.Entry item : items.entrySet()) {
if (prices.containsKey(item.getKey())) {
if (bazaar && item.getValue().getAsJsonObject().has("curr_buy") && item.getValue().getAsJsonObject().has(
@@ -493,7 +494,10 @@ public class GuiPriceGraph extends GuiScreen {
))
) {
return GSON.fromJson(reader, type);
- } catch (Exception ignored) {
+ } catch (Exception e) {
+ System.out.println("Deleting " + file.getName() + " because it is probably corrupted.");
+ //noinspection ResultOfMethodCallIgnored
+ file.delete();
}
}
return null;
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 e872bfc0..dafbe202 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
@@ -1,13 +1,7 @@
package io.github.moulberry.notenoughupdates.options.seperateSections;
import com.google.gson.annotations.Expose;
-import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigAccordionId;
-import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigEditorAccordion;
-import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigEditorBoolean;
-import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigEditorButton;
-import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigEditorDropdown;
-import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigEditorSlider;
-import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigOption;
+import io.github.moulberry.notenoughupdates.core.config.annotations.*;
public class Misc {
@Expose
@@ -147,4 +141,14 @@ public class Misc {
@ConfigEditorBoolean
public boolean disableNPCRetexturing = false;
+ @Expose
+ @ConfigOption(
+ name = "Wiki",
+ desc = "The wiki to use in the wiki renderer."
+ )
+ @ConfigEditorDropdown(values = {
+ "Hypixel",
+ "Fandom"
+ })
+ public int wiki = 0;
}
--
cgit