Skip to content

Commit

Permalink
used inInventory for HideNotClickableItems
Browse files Browse the repository at this point in the history
  • Loading branch information
Thunderblade73 committed Jan 11, 2024
1 parent eb516ca commit 41be1ef
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ class SkyHanniMod {
loadModule(SoopyGuessBurrow())
loadModule(DianaProfitTracker)
loadModule(MythologicalCreatureTracker)
loadModule(ShiftClickNPCSell())
loadModule(ShiftClickNPCSell)
loadModule(HighlightJerries())
loadModule(TheGreatSpook())
loadModule(GriffinBurrowHelper)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import at.hannibal2.skyhanni.data.ItemRenderBackground.Companion.background
import at.hannibal2.skyhanni.data.ItemRenderBackground.Companion.borderLine
import at.hannibal2.skyhanni.data.jsonobjects.repo.HideNotClickableItemsJson
import at.hannibal2.skyhanni.data.jsonobjects.repo.HideNotClickableItemsJson.SalvageFilter
import at.hannibal2.skyhanni.data.jsonobjects.repo.MultiFilterJson
import at.hannibal2.skyhanni.events.GuiContainerEvent
import at.hannibal2.skyhanni.events.RepositoryReloadEvent
import at.hannibal2.skyhanni.features.bazaar.BazaarApi
Expand Down Expand Up @@ -49,16 +48,12 @@ class HideNotClickableItems {

private val hideNpcSellFilter = MultiFilter()
private val hideInStorageFilter = MultiFilter()
private val tradeNpcFilter = MultiFilter()
private val itemsToSalvage = mutableListOf<String>()
private val hidePlayerTradeFilter = MultiFilter()
private val notAuctionableFilter = MultiFilter()

@SubscribeEvent
fun onRepoReload(event: RepositoryReloadEvent) {
val data = event.getConstant<MultiFilterJson>("TradeNpcs")
tradeNpcFilter.load(data)

val hideNotClickable = event.getConstant<HideNotClickableItemsJson>("HideNotClickableItems")
hideNpcSellFilter.load(hideNotClickable.hide_npc_sell)
hideInStorageFilter.load(hideNotClickable.hide_in_storage)
Expand Down Expand Up @@ -260,7 +255,7 @@ class HideNotClickableItems {
"BRACELET"
)
for (type in list) {
if (stack.getLore().any { it.contains("§l") && it.contains(type) }) {//todo use item api
if (stack.getLore().any { it.contains("§l") && it.contains(type) }) {// todo use item api
reverseColor = true
return false
}
Expand Down Expand Up @@ -289,7 +284,7 @@ class HideNotClickableItems {
private fun hidePrivateIslandChest(chestName: String, stack: ItemStack): Boolean {
if (chestName != "Chest" && chestName != "Large Chest") return false

//TODO make check if player is on private island
// TODO make check if player is on private island

if (!ItemUtils.isSoulBound(stack)) return false

Expand Down Expand Up @@ -379,7 +374,7 @@ class HideNotClickableItems {
}

private fun hideNpcSell(chestName: String, stack: ItemStack): Boolean {
if (!tradeNpcFilter.match(chestName)) return false
if (!ShiftClickNPCSell.inInventory) return false
if (VisitorAPI.inInventory) return false
reverseColor = true

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern
import net.minecraft.client.Minecraft
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent

class ShiftClickNPCSell {
object ShiftClickNPCSell {

private val config get() = SkyHanniMod.feature.inventory.shiftClickNPCSell

Expand All @@ -21,13 +21,14 @@ class ShiftClickNPCSell {
"§7them to this Shop!|§eClick to buyback!"
)

private var inInventory = false
var inInventory = false
private set

fun isEnabled() = LorenzUtils.inSkyBlock && config

@SubscribeEvent
fun onOpen(event: InventoryFullyOpenedEvent) {
if (!isEnabled()) return
if (!LorenzUtils.inSkyBlock) return
inInventory = lastLoreLineOfSellPattern.matches(event.inventoryItems[sellSlot]?.getLore()?.lastOrNull() ?: "")
}

Expand Down

0 comments on commit 41be1ef

Please sign in to comment.