Skip to content

Commit

Permalink
Coop Soulbound kuudra drops (Moulberry#299)
Browse files Browse the repository at this point in the history
  • Loading branch information
hannibal002 authored Sep 22, 2022
1 parent fc94969 commit c055595
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
import io.github.moulberry.notenoughupdates.overlays.RancherBootOverlay;
import io.github.moulberry.notenoughupdates.overlays.TextOverlay;
import io.github.moulberry.notenoughupdates.profileviewer.GuiProfileViewer;
import io.github.moulberry.notenoughupdates.util.ItemUtils;
import io.github.moulberry.notenoughupdates.util.NotificationHandler;
import io.github.moulberry.notenoughupdates.util.RequestFocusListener;
import io.github.moulberry.notenoughupdates.util.SBInfo;
Expand Down Expand Up @@ -408,7 +409,7 @@ public void onGuiBackgroundDraw(GuiScreenEvent.BackgroundDrawnEvent event) {
GL11.glTranslatef(0, 0, 10);
}
if (hoverInv) {
renderDungeonChestOverlay(event.gui);
renderDungKuudraChestOverlay(event.gui);
if (NotEnoughUpdates.INSTANCE.config.accessoryBag.enableOverlay) {
AccessoryBagOverlay.renderOverlay();
}
Expand Down Expand Up @@ -625,7 +626,7 @@ public void onGuiScreenDrawPost(GuiScreenEvent.DrawScreenEvent.Post event) {
}

if (NotificationHandler.shouldRenderOverlay(event.gui) && neu.isOnSkyblock() && !hoverInv) {
renderDungeonChestOverlay(event.gui);
renderDungKuudraChestOverlay(event.gui);
if (NotEnoughUpdates.INSTANCE.config.accessoryBag.enableOverlay) {
AccessoryBagOverlay.renderOverlay();
}
Expand Down Expand Up @@ -734,7 +735,7 @@ public void onGuiScreenDrawPost(GuiScreenEvent.DrawScreenEvent.Post event) {
}
}

private void renderDungeonChestOverlay(GuiScreen gui) {
private void renderDungKuudraChestOverlay(GuiScreen gui) {
if (NotEnoughUpdates.INSTANCE.config.dungeons.profitDisplayLoc == 3) return;
if (gui instanceof GuiChest && NotEnoughUpdates.INSTANCE.config.dungeons.profitDisplayLoc != 2) {
try {
Expand Down Expand Up @@ -771,7 +772,9 @@ private void renderDungeonChestOverlay(GuiScreen gui) {
HashMap<String, Double> itemValues = new HashMap<>();
for (int i = 0; i < 5; i++) {
ItemStack item = lower.getStackInSlot(11 + i);
String internal = neu.manager.getInternalNameForItem(item);
if (ItemUtils.isSoulbound(item)) continue;

String internal = neu.manager.createItemResolutionQuery().withItemStack(item).resolveInternalName();
String displayName = item.getDisplayName();
Matcher matcher = ESSENCE_PATTERN.matcher(displayName);
if (neu.config.dungeons.useEssenceCostFromBazaar && matcher.matches()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,4 +120,8 @@ public static String fixEnchantId(String enchId, boolean useId) {
return enchId;
}

public static boolean isSoulbound(ItemStack item) {
return ItemUtils.getLore(item).stream()
.anyMatch(line -> line.equals("§8§l* §8Co-op Soulbound §8§l*") || line.equals("§8§l* Soulbound §8§l*"));
}
}

0 comments on commit c055595

Please sign in to comment.