Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,7 @@ public void addToTooltip(@Nullable Slot focusedSlot, ItemStack stack, List<Compo
final String internalID = stack.getSkyblockId();
if (TooltipInfoType.MUSEUM.hasOrNullWarning(internalID)) {
String itemCategory = TooltipInfoType.MUSEUM.getData().get(internalID);
String format = switch (itemCategory) {
case "Weapons" -> "%-18s";
case "Armor" -> "%-19s";
default -> "%-20s";
};
String format = "%-20s";

//Special case the special category so that it doesn't always display not donated
if (itemCategory.equals("Special")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import com.mojang.util.UndashedUuid;
import de.hysky.skyblocker.SkyblockerMod;
import de.hysky.skyblocker.annotations.Init;
import de.hysky.skyblocker.debug.Debug;
import de.hysky.skyblocker.events.SkyblockEvents;
import de.hysky.skyblocker.utils.Constants;
import de.hysky.skyblocker.utils.Http;
Expand Down Expand Up @@ -51,6 +52,7 @@
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Executors;
Expand All @@ -71,6 +73,7 @@ public class MuseumItemCache {
/** Set Id -> Display Item Id */
public static final Map<String, String> ARMOR_TO_ID = Object2ObjectMaps.synchronize(new Object2ObjectArrayMap<>());
private static final Map<String, String> MAPPED_IDS = Object2ObjectMaps.synchronize(new Object2ObjectArrayMap<>());
public static Set<String> MUSEUM_CATEGORIES = Set.of();
public static final ObjectList<Donation> MUSEUM_DONATIONS = ObjectLists.synchronize(new ObjectArrayList<>());
private static final ObjectList<ObjectArrayList<String>> ORDERED_UPGRADES = ObjectLists.synchronize(new ObjectArrayList<>());

Expand All @@ -95,6 +98,16 @@ private static void registerCommands(CommandDispatcher<FabricClientCommandSource

return Command.SINGLE_SUCCESS;
}))));
if (!Debug.debugEnabled()) return;
dispatcher.register(literal(SkyblockerMod.NAMESPACE).then(literal("debug").then(literal("reloadMuseumItems")
.executes(ctx -> {
ctx.getSource().sendFeedback(Component.literal("Reloading..."));
loadMuseumItems();
ctx.getSource().sendFeedback(Component.literal("Reloaded!"));
return Command.SINGLE_SUCCESS;
}))
)
);
}

/**
Expand All @@ -107,6 +120,7 @@ public static void loadMuseumItems() {
MAPPED_IDS.clear();
MUSEUM_DONATIONS.clear();
ORDERED_UPGRADES.clear();
MUSEUM_CATEGORIES = Set.of();

NEURepoFile filePath = NEURepoManager.file(CONSTANTS_MUSEUM_DATA);
if (filePath == null) return;
Expand All @@ -120,23 +134,18 @@ public static void loadMuseumItems() {
Map<String, JsonElement> setsToItems = json.get("sets_to_items").getAsJsonObject().asMap();
Map<String, JsonElement> children = json.get("children").getAsJsonObject().asMap();
Map<String, JsonElement> armorToId = json.get("armor_to_id").getAsJsonObject().asMap();

Map<String, JsonArray> allDonations = Map.of(
"weapons", json.get("weapons").getAsJsonArray(),
"armor", json.get("armor").getAsJsonArray(),
"rarities", json.get("rarities").getAsJsonArray()
);

mappedIds.forEach((s, jsonElement) -> MAPPED_IDS.put(s, jsonElement.getAsString()));

for (Map.Entry<String, JsonArray> entry : allDonations.entrySet()) {
String category = entry.getKey();
JsonArray array = entry.getValue();
Map<String, JsonElement> itemCategories = json.get("items").getAsJsonObject().asMap();
MUSEUM_CATEGORIES = itemCategories.keySet();
itemCategories.forEach((category, elem) -> {
JsonArray array = elem.getAsJsonArray();
if (category.equals("special")) return;

for (JsonElement element : array) {
String itemID = element.getAsString();
List<ObjectObjectMutablePair<String, PriceData>> set = new ArrayList<>();
if (category.equals("armor")) {
if (armorToId.containsKey(itemID)) {
boolean isEquipment = true;
for (JsonElement jsonElement : setsToItems.get(itemID).getAsJsonArray()) {
if (isEquipment) isEquipment = MuseumUtils.isEquipment(jsonElement.getAsString());
Expand Down Expand Up @@ -179,7 +188,7 @@ public static void loadMuseumItems() {

MUSEUM_DONATIONS.add(new Donation(category, itemID, set, itemXP));
}
}
});

MUSEUM_DONATIONS.forEach(donation -> {
for (List<String> list : ORDERED_UPGRADES) {
Expand Down