diff options
author | Fix3dll <serhanduzce@gmail.com> | 2022-04-03 15:27:58 +0300 |
---|---|---|
committer | Fix3dll <serhanduzce@gmail.com> | 2022-04-03 15:27:58 +0300 |
commit | e68587ae9609128f2658a6bccd1a331792b326a9 (patch) | |
tree | 7b22eef952a607498a90825d8aa4093741aa9fb4 | |
parent | 30fed24fd00dd8dfa0ff0de4c319cc9ad2273717 (diff) | |
download | Skyblocker-e68587ae9609128f2658a6bccd1a331792b326a9.tar.gz Skyblocker-e68587ae9609128f2658a6bccd1a331792b326a9.tar.bz2 Skyblocker-e68587ae9609128f2658a6bccd1a331792b326a9.zip |
fix: Fire trial interaction with Fancybar,
bazaar and lbin appearing at same time
a cleaner look for bazaar without extra tooltip
-rw-r--r-- | src/main/java/me/xmrvizzy/skyblocker/skyblock/FancyStatusBars.java | 2 | ||||
-rw-r--r-- | src/main/java/me/xmrvizzy/skyblocker/skyblock/item/PriceInfoTooltip.java | 44 |
2 files changed, 25 insertions, 21 deletions
diff --git a/src/main/java/me/xmrvizzy/skyblocker/skyblock/FancyStatusBars.java b/src/main/java/me/xmrvizzy/skyblocker/skyblock/FancyStatusBars.java index 75d232e9..5d3cf9c4 100644 --- a/src/main/java/me/xmrvizzy/skyblocker/skyblock/FancyStatusBars.java +++ b/src/main/java/me/xmrvizzy/skyblocker/skyblock/FancyStatusBars.java @@ -17,7 +17,7 @@ public class FancyStatusBars extends DrawableHelper { private static final MinecraftClient client = MinecraftClient.getInstance(); private static final Identifier BARS = new Identifier(SkyblockerMod.NAMESPACE, "textures/gui/bars.png"); private static final Pattern ACTION_BAR_MANA = Pattern.compile("§b-\\d+ Mana \\(.*\\) +"); - private static final Pattern ACTION_BAR_STATUS = Pattern.compile("^§[6c](\\d+)/(\\d+)❤(\\+§c\\d+.)?(?: +§a(\\d+)§a❈ Defense)?(?: +(\\S+(?:\\s\\S+)*))??(?: +§b(\\d+)/(\\d+)✎ +(?:Mana|§3(\\d+)ʬ))?(?: +(§[27].*))?$"); + private static final Pattern ACTION_BAR_STATUS = Pattern.compile("^§[6c](\\d+)/(\\d+)❤(\\+§c\\d+.)? +(?:§a(\\d+)§a❈ Defense|([^✎]*?))?(?: +§b(\\d+)/(\\d+)✎ +(?:Mana|§3(\\d+)ʬ))?(?: +(§[27].*))?$"); private final Resource[] resources = new Resource[]{ // Health diff --git a/src/main/java/me/xmrvizzy/skyblocker/skyblock/item/PriceInfoTooltip.java b/src/main/java/me/xmrvizzy/skyblocker/skyblock/item/PriceInfoTooltip.java index 290bd0ae..ddb290a7 100644 --- a/src/main/java/me/xmrvizzy/skyblocker/skyblock/item/PriceInfoTooltip.java +++ b/src/main/java/me/xmrvizzy/skyblocker/skyblock/item/PriceInfoTooltip.java @@ -49,6 +49,7 @@ public class PriceInfoTooltip { int count = stack.getCount(); String timestamp = getTimestamp(stack); + boolean bazaarOpened = lines.stream().anyMatch(each -> each.getString().contains("Buy price:") || each.getString().contains("Sell price:")); if (SkyblockerConfig.get().general.itemTooltip.enableNPCPrice) { if (npcPricesJson == null) { @@ -63,7 +64,28 @@ public class PriceInfoTooltip { } } - if (SkyblockerConfig.get().general.itemTooltip.enableLowestBIN) { + boolean bazaarExist = false; + if (SkyblockerConfig.get().general.itemTooltip.enableBazaarPrice + && !bazaarOpened) { + if (bazaarPricesJson == null) { + if (!nullMsgSend) { + client.player.sendMessage(new TranslatableText("skyblocker.itemTooltip.nullMessage"), false); + nullMsgSend = true; + } + } else if (bazaarPricesJson.has(name)) { + JsonObject getItem = bazaarPricesJson.getAsJsonObject(name); + lines.add(new LiteralText(String.format("%-18s", "Bazaar buy Price:")) + .formatted(Formatting.GOLD) + .append(getCoinsMessage(getItem.get("buyPrice").getAsDouble(), count))); + lines.add(new LiteralText(String.format("%-19s", "Bazaar sell Price:")) + .formatted(Formatting.GOLD) + .append(getCoinsMessage(getItem.get("sellPrice").getAsDouble(), count))); + bazaarExist = true; + } + } + + // bazaarOpened & bazaarExist check for lbin, because Skytils keeps some bazaar item data in lbin api + if (SkyblockerConfig.get().general.itemTooltip.enableLowestBIN && !bazaarOpened && !bazaarExist) { if (lowestPricesJson == null) { if (!nullMsgSend) { client.player.sendMessage(new TranslatableText("skyblocker.itemTooltip.nullMessage"), false); @@ -134,25 +156,7 @@ public class PriceInfoTooltip { } } - if (SkyblockerConfig.get().general.itemTooltip.enableBazaarPrice - && lines.stream().noneMatch(each -> each.getString().contains("Buy price:") || each.getString().contains("Sell price:"))) { - if (bazaarPricesJson == null) { - if (!nullMsgSend) { - client.player.sendMessage(new TranslatableText("skyblocker.itemTooltip.nullMessage"), false); - nullMsgSend = true; - } - } else if (bazaarPricesJson.has(name)) { - JsonObject getItem = bazaarPricesJson.getAsJsonObject(name); - lines.add(new LiteralText(String.format("%-18s", "Bazaar buy Price:")) - .formatted(Formatting.GOLD) - .append(getCoinsMessage(getItem.get("buyPrice").getAsDouble(), count))); - lines.add(new LiteralText(String.format("%-19s", "Bazaar sell Price:")) - .formatted(Formatting.GOLD) - .append(getCoinsMessage(getItem.get("sellPrice").getAsDouble(), count))); - } - } - - if (SkyblockerConfig.get().general.itemTooltip.enableMuseumDate) { + if (SkyblockerConfig.get().general.itemTooltip.enableMuseumDate && !bazaarOpened) { if (isMuseumJson == null) { if (!nullMsgSend) { client.player.sendMessage(new TranslatableText("skyblocker.itemTooltip.nullMessage"), false); |