aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlex <8379108+Alex33856@users.noreply.github.com>2025-07-07 18:49:56 -0400
committerGitHub <noreply@github.com>2025-07-07 18:49:56 -0400
commit912cde5bf60e1ff6d887fbc4e26a153bfecc3711 (patch)
treec389a086854ff4870febe1a7b6cc207e9f27c4c8 /src
parentbf8f52a806474fc93757377bd312a6e97b627cdf (diff)
downloadSkyblocker-912cde5bf60e1ff6d887fbc4e26a153bfecc3711.tar.gz
Skyblocker-912cde5bf60e1ff6d887fbc4e26a153bfecc3711.tar.bz2
Skyblocker-912cde5bf60e1ff6d887fbc4e26a153bfecc3711.zip
Add support for new shards in Search Overlay (#1427)
* Add support for new shards in Search Overlay * Don't change id if not in bazaarstocks.json * Use Bazaar Stocks for enchants * Update NEU Repo, add Bazaar Stocks to ItemRepository, get ItemUtils#getNeuId() for attribute shards
Diffstat (limited to 'src')
-rw-r--r--src/main/java/de/hysky/skyblocker/skyblock/itemlist/ItemRepository.java15
-rw-r--r--src/main/java/de/hysky/skyblocker/skyblock/searchoverlay/SearchOverManager.java14
-rw-r--r--src/main/java/de/hysky/skyblocker/utils/ItemUtils.java7
3 files changed, 32 insertions, 4 deletions
diff --git a/src/main/java/de/hysky/skyblocker/skyblock/itemlist/ItemRepository.java b/src/main/java/de/hysky/skyblocker/skyblock/itemlist/ItemRepository.java
index 917db6f0..ac58cdcf 100644
--- a/src/main/java/de/hysky/skyblocker/skyblock/itemlist/ItemRepository.java
+++ b/src/main/java/de/hysky/skyblocker/skyblock/itemlist/ItemRepository.java
@@ -6,6 +6,10 @@ import de.hysky.skyblocker.skyblock.itemlist.recipes.SkyblockForgeRecipe;
import de.hysky.skyblocker.skyblock.itemlist.recipes.SkyblockRecipe;
import de.hysky.skyblocker.utils.ItemUtils;
import de.hysky.skyblocker.utils.NEURepoManager;
+import io.github.moulberry.repo.data.NEUCraftingRecipe;
+import io.github.moulberry.repo.data.NEUItem;
+import io.github.moulberry.repo.data.NEURecipe;
+import io.github.moulberry.repo.util.NEUId;
import io.github.moulberry.repo.data.*;
import net.minecraft.item.ItemStack;
import org.jetbrains.annotations.Nullable;
@@ -21,12 +25,14 @@ public class ItemRepository {
private static final List<ItemStack> items = new ArrayList<>();
private static final Map<String, ItemStack> itemsMap = new HashMap<>();
private static final List<SkyblockRecipe> recipes = new ArrayList<>();
+ private static final HashMap<String, @NEUId String> bazaarStocks = new HashMap<>();
private static boolean filesImported = false;
@Init
public static void init() {
NEURepoManager.runAsyncAfterLoad(ItemStackBuilder::loadPetNums);
NEURepoManager.runAsyncAfterLoad(ItemRepository::importItemFiles);
+ NEURepoManager.runAsyncAfterLoad(ItemRepository::loadBazaarStocks);
}
private static void importItemFiles() {
@@ -64,6 +70,11 @@ public class ItemRepository {
item.getRecipes().stream().map(ItemRepository::toSkyblockRecipe).filter(Objects::nonNull).forEach(recipes::add);
}
+ private static void loadBazaarStocks() {
+ bazaarStocks.clear();
+ NEURepoManager.NEU_REPO.getConstants().getBazaarStocks().getStocks().forEach((String neuId, String skyblockId) -> bazaarStocks.put(skyblockId, neuId));
+ }
+
public static String getWikiLink(String neuId, boolean useOfficial) {
NEUItem item = NEURepoManager.NEU_REPO.getItems().getItemBySkyblockId(neuId);
if (item == null || item.getInfo() == null || item.getInfo().isEmpty()) {
@@ -103,6 +114,10 @@ public class ItemRepository {
return items.stream();
}
+ public static Map<String, @NEUId String> getBazaarStocks() {
+ return bazaarStocks;
+ }
+
/**
* @param neuId the NEU item id gotten through {@link NEUItem#getSkyblockItemId()}, {@link ItemStack#getNeuName()}, or {@link ItemUtils#getNeuId(ItemStack) ItemTooltip#getNeuName(String, String)}
*/
diff --git a/src/main/java/de/hysky/skyblocker/skyblock/searchoverlay/SearchOverManager.java b/src/main/java/de/hysky/skyblocker/skyblock/searchoverlay/SearchOverManager.java
index b6362691..721db667 100644
--- a/src/main/java/de/hysky/skyblocker/skyblock/searchoverlay/SearchOverManager.java
+++ b/src/main/java/de/hysky/skyblocker/skyblock/searchoverlay/SearchOverManager.java
@@ -7,6 +7,7 @@ import de.hysky.skyblocker.annotations.Init;
import de.hysky.skyblocker.config.SkyblockerConfigManager;
import de.hysky.skyblocker.config.configs.UIAndVisualsConfig;
import de.hysky.skyblocker.skyblock.item.tooltip.info.TooltipInfoType;
+import de.hysky.skyblocker.skyblock.itemlist.ItemRepository;
import de.hysky.skyblocker.utils.BazaarProduct;
import de.hysky.skyblocker.utils.NEURepoManager;
import de.hysky.skyblocker.utils.RomanNumerals;
@@ -117,8 +118,10 @@ public class SearchOverManager {
int sellVolume = product.sellVolume();
if (sellVolume == 0)
continue; //do not add items that do not sell e.g. they are not actual in the bazaar
+
+ // Format Enchantments
Matcher matcher = BAZAAR_ENCHANTMENT_PATTERN.matcher(name);
- if (matcher.matches()) {//format enchantments
+ if (matcher.matches() && ItemRepository.getBazaarStocks().containsKey(id)) {
name = matcher.group(1);
if (!name.contains("Ultimate Wise") && !name.contains("Ultimate Jerry")) {
name = name.replace("Ultimate ", "");
@@ -132,16 +135,21 @@ public class SearchOverManager {
String level = matcher.group(2);
name += " " + RomanNumerals.decimalToRoman(Integer.parseInt(level));
bazaarItems.add(name);
- namesToNeuId.put(name, id.substring(0, id.lastIndexOf('_')).replace("ENCHANTMENT_", "") + ";" + level);
+ namesToNeuId.put(name, ItemRepository.getBazaarStocks().get(id));
continue;
}
+
+ // Format Shards
+ if (id.startsWith("SHARD_") && ItemRepository.getBazaarStocks().containsKey(id)) {
+ id = ItemRepository.getBazaarStocks().get(id);
+ }
+
//look up id for name
NEUItem neuItem = NEURepoManager.NEU_REPO.getItems().getItemBySkyblockId(id);
if (neuItem != null) {
name = Formatting.strip(neuItem.getDisplayName());
bazaarItems.add(name);
namesToNeuId.put(name, id);
- continue;
}
}
} catch (Exception e) {
diff --git a/src/main/java/de/hysky/skyblocker/utils/ItemUtils.java b/src/main/java/de/hysky/skyblocker/utils/ItemUtils.java
index d9161332..d278ebc0 100644
--- a/src/main/java/de/hysky/skyblocker/utils/ItemUtils.java
+++ b/src/main/java/de/hysky/skyblocker/utils/ItemUtils.java
@@ -16,6 +16,7 @@ import de.hysky.skyblocker.skyblock.hunting.Attributes;
import de.hysky.skyblocker.skyblock.item.PetInfo;
import de.hysky.skyblocker.skyblock.item.tooltip.adders.ObtainedDateTooltip;
import de.hysky.skyblocker.skyblock.item.tooltip.info.TooltipInfoType;
+import de.hysky.skyblocker.skyblock.itemlist.ItemRepository;
import de.hysky.skyblocker.utils.networth.NetworthCalculator;
import it.unimi.dsi.fastutil.doubles.DoubleBooleanPair;
import it.unimi.dsi.fastutil.ints.IntIntPair;
@@ -242,7 +243,11 @@ public final class ItemUtils {
yield rune.toUpperCase(Locale.ENGLISH) + "_RUNE;" + runes.getInt(rune, 0);
}
case "POTION" -> "POTION_" + customData.getString("potion", "").toUpperCase(Locale.ENGLISH) + ";" + customData.getInt("potion_level", 0);
- case "ATTRIBUTE_SHARD" -> "ATTRIBUTE_SHARD";
+ case "ATTRIBUTE_SHARD" -> {
+ Attribute attribute = Attributes.getAttributeFromItemName(stack);
+ if (attribute == null) yield id;
+ yield ItemRepository.getBazaarStocks().getOrDefault(attribute.apiId(), id);
+ }
case "PARTY_HAT_CRAB", "BALLOON_HAT_2024", "BALLOON_HAT_2025" -> id + "_" + customData.getString("party_hat_color", "").toUpperCase(Locale.ENGLISH);
case "PARTY_HAT_CRAB_ANIMATED" -> "PARTY_HAT_CRAB_" + customData.getString("party_hat_color", "").toUpperCase(Locale.ENGLISH) + "_ANIMATED";
case "PARTY_HAT_SLOTH" -> id + "_" + customData.getString("party_hat_emoji", "").toUpperCase(Locale.ENGLISH);