Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvement: Hide non-clickable items mining v3 #1430

Merged
merged 30 commits into from
Apr 13, 2024
Merged
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
b9a505e
Added fossil excavator and research center to hide non clickable item…
hannibal002 Apr 12, 2024
d236f22
create a fossil excavator api
hannibal002 Apr 12, 2024
216cdd5
Merge branch 'fossil-excavator-api' into hide-not-clickable-itesm-min…
hannibal002 Apr 12, 2024
3ee7a31
Merge branch 'beta' into hide-not-clickable-itesm-mining-v3
hannibal002 Apr 12, 2024
83980b8
fix inExcavatorMenu
hannibal002 Apr 12, 2024
5d9f392
Merge branch 'fossil-excavator-api' into hide-not-clickable-itesm-min…
hannibal002 Apr 12, 2024
0f0c640
using FossilExcavatorAPI
hannibal002 Apr 12, 2024
d369bfb
Delete FossilExcavatorProfitTracker.kt
hannibal002 Apr 12, 2024
915ec59
init
hannibal002 Apr 12, 2024
8eafaa6
Merge branch 'beta' into fossil-profit-tracker
hannibal002 Apr 12, 2024
7778ad1
using FossilExcavationEvent
hannibal002 Apr 12, 2024
a97a355
added tracker
hannibal002 Apr 12, 2024
3110123
added scrap cost
hannibal002 Apr 12, 2024
2f02157
added scrap cost
hannibal002 Apr 12, 2024
1952cae
workaround
hannibal002 Apr 12, 2024
a9b7ff7
more fixes
hannibal002 Apr 12, 2024
fd2b05c
add empty line
hannibal002 Apr 12, 2024
01853bc
remove debug
hannibal002 Apr 12, 2024
282f0a7
Only show in excavation menu
hannibal002 Apr 12, 2024
524b89c
Merge branch 'beta' into hide-not-clickable-itesm-mining-v3
hannibal002 Apr 12, 2024
8111a14
Merge branch 'beta' into fossil-profit-tracker
hannibal002 Apr 12, 2024
54bb808
fix coordinate mixup
hannibal002 Apr 12, 2024
9667a62
Update src/main/java/at/hannibal2/skyhanni/features/inventory/HideNot…
hannibal002 Apr 12, 2024
cd5d029
Update src/main/java/at/hannibal2/skyhanni/features/inventory/HideNot…
hannibal002 Apr 12, 2024
3375c39
Delete src/main/java/at/hannibal2/skyhanni/features/mining/fossilexca…
hannibal002 Apr 12, 2024
0221429
Track Glacite Powder
hannibal002 Apr 12, 2024
55c02aa
Merge branch 'beta' into fossil-profit-tracker
hannibal002 Apr 13, 2024
e54690b
fix config
hannibal002 Apr 13, 2024
7c0208d
Merge branch 'fossil-profit-tracker' into hide-not-clickable-itesm-mi…
hannibal002 Apr 13, 2024
8461ead
Merge branch 'beta' into hide-not-clickable-itesm-mining-v3
hannibal002 Apr 13, 2024
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 @@ -11,16 +11,20 @@ import at.hannibal2.skyhanni.events.RepositoryReloadEvent
import at.hannibal2.skyhanni.features.garden.composter.ComposterOverlay
import at.hannibal2.skyhanni.features.garden.visitor.VisitorAPI
import at.hannibal2.skyhanni.features.inventory.bazaar.BazaarApi
import at.hannibal2.skyhanni.features.mining.fossilexcavator.FossilExcavatorAPI
import at.hannibal2.skyhanni.features.rift.RiftAPI
import at.hannibal2.skyhanni.features.rift.RiftAPI.motesNpcPrice
import at.hannibal2.skyhanni.utils.ChatUtils
import at.hannibal2.skyhanni.utils.CollectionUtils.equalsOneOf
import at.hannibal2.skyhanni.utils.InventoryUtils
import at.hannibal2.skyhanni.utils.InventoryUtils.getInventoryName
import at.hannibal2.skyhanni.utils.InventoryUtils.getLowerItems
import at.hannibal2.skyhanni.utils.ItemCategory
import at.hannibal2.skyhanni.utils.ItemUtils
import at.hannibal2.skyhanni.utils.ItemUtils.cleanName
import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName
import at.hannibal2.skyhanni.utils.ItemUtils.getInternalNameOrNull
import at.hannibal2.skyhanni.utils.ItemUtils.getItemCategoryOrNull
import at.hannibal2.skyhanni.utils.ItemUtils.getLore
import at.hannibal2.skyhanni.utils.ItemUtils.isEnchanted
import at.hannibal2.skyhanni.utils.ItemUtils.isVanilla
Expand Down Expand Up @@ -48,7 +52,7 @@ class HideNotClickableItems {
private val config get() = SkyHanniMod.feature.inventory.hideNotClickable

private var hideReason = ""
private var reverseColor = false
private var showGreenLine = false

private var lastClickTime = 0L
private var bypassUntil = 0L
Expand Down Expand Up @@ -103,7 +107,7 @@ class HideNotClickableItems {
val opacity = config.opacity
val color = LorenzColor.DARK_GRAY.addOpacity(opacity)
stack.background = color.rgb
} else if (reverseColor && config.itemsGreenLine) {
} else if (showGreenLine && config.itemsGreenLine) {
val color = LorenzColor.GREEN.addOpacity(200)
stack.borderLine = color.rgb
}
Expand Down Expand Up @@ -176,7 +180,7 @@ class HideNotClickableItems {

private fun hide(chestName: String, stack: ItemStack): Boolean {
hideReason = ""
reverseColor = false
showGreenLine = false

return when {
hideNpcSell(stack) -> true
Expand All @@ -197,16 +201,59 @@ class HideNotClickableItems {
hideComposter(chestName, stack) -> true
hideRiftMotesGrubber(chestName, stack) -> true
hideRiftTransferChest(chestName, stack) -> true
else -> {
false
}
hideFossilExcavator(stack) -> true
hideResearchCenter(chestName, stack) -> true

else -> false
}
}

private fun hideFossilExcavator(stack: ItemStack): Boolean {
if (!FossilExcavatorAPI.inExcavatorMenu) return false

showGreenLine = true

val internalName = stack.getInternalNameOrNull() ?: return true
if (internalName == "SUSPICIOUS_SCRAP".asInternalName()) {
return false
}

val category = stack.getItemCategoryOrNull() ?: return true
if (category == ItemCategory.CHISEL) {
return false
}

hideReason = "§cNot a chisel or scrap!"
return true
}

private fun hideResearchCenter(chestName: String, stack: ItemStack): Boolean {
if (chestName != "Research Center") return false

showGreenLine = true

val internalName = stack.getInternalNameOrNull() ?: return false

// TODO add more special named fossils (hypixel why)
val list = listOf(
"HELIX".asInternalName(),
)

if (internalName in list) {
return false
}
if (internalName.endsWith("_FOSSIL")) {
return false
}

hideReason = "§cNot a fossil!"
return true
}

private fun hideRiftTransferChest(chestName: String, stack: ItemStack): Boolean {
if (chestName != "Rift Transfer Chest") return false

reverseColor = true
showGreenLine = true
val riftTransferable = stack.isRiftTransferable() ?: return true
if (riftTransferable) {
return false
Expand All @@ -226,7 +273,7 @@ class HideNotClickableItems {
if (!RiftAPI.inRift()) return false
if (chestName != "Motes Grubber") return false

reverseColor = true
showGreenLine = true

if (stack.motesNpcPrice() != null) return false

Expand All @@ -237,7 +284,7 @@ class HideNotClickableItems {
private fun hideComposter(chestName: String, stack: ItemStack): Boolean {
if (!ComposterOverlay.inInventory) return false

reverseColor = true
showGreenLine = true

val internalName = stack.getInternalName()
if (internalName == ComposterOverlay.currentOrganicMatterItem) {
Expand Down Expand Up @@ -268,7 +315,7 @@ class HideNotClickableItems {
)
for (type in list) {
if (stack.getLore().any { it.contains("§l") && it.contains(type) }) {// todo use item api
reverseColor = true
showGreenLine = true
return false
}
}
Expand All @@ -285,7 +332,7 @@ class HideNotClickableItems {
private fun hideAttributeFusion(chestName: String, stack: ItemStack): Boolean {
if (!chestName.startsWith("Attribute Fusion")) return false

reverseColor = true
showGreenLine = true

if (ItemUtils.hasAttributes(stack)) return false

Expand All @@ -312,7 +359,7 @@ class HideNotClickableItems {
return true
}

reverseColor = true
showGreenLine = true
if (stack.cleanName().endsWith(" Potion") || stack.cleanName() == "Water Bottle") return false

hideReason = "This item is not a potion!"
Expand All @@ -327,7 +374,7 @@ class HideNotClickableItems {
return true
}

reverseColor = true
showGreenLine = true
if (stack.getLore().any { it.removeColor() == "Fishing Bait" }) {
return false
}
Expand All @@ -340,7 +387,7 @@ class HideNotClickableItems {
if (ItemUtils.isSkyBlockMenuItem(stack)) return false

val name = stack.cleanName()
reverseColor = true
showGreenLine = true
if (ItemUtils.isSack(stack)) return false


Expand All @@ -352,7 +399,7 @@ class HideNotClickableItems {
if (!chestName.startsWith("Accessory Bag") && !chestName.startsWith("Accessory Bag (")) return false
if (ItemUtils.isSkyBlockMenuItem(stack)) return false

reverseColor = true
showGreenLine = true
if (stack.getLore().any { it.contains("ACCESSORY") || it.contains("HATCESSORY") }) return false

hideReason = "This item is not an accessory!"
Expand Down Expand Up @@ -432,7 +479,7 @@ class HideNotClickableItems {
private fun hideNpcSell(stack: ItemStack): Boolean {
if (!ShiftClickNPCSell.inInventory) return false
if (VisitorAPI.inInventory) return false
reverseColor = true
showGreenLine = true

var name = stack.cleanName()
val size = stack.stackSize
Expand Down Expand Up @@ -480,7 +527,7 @@ class HideNotClickableItems {

private fun hideSalvage(chestName: String, stack: ItemStack): Boolean {
if (!chestName.equalsOneOf("Salvage Item", "Salvage Items")) return false
reverseColor = true
showGreenLine = true

if (ItemUtils.isRecombobulated(stack)) {
hideReason = "This item should not be salvaged! (Recombobulated)"
Expand Down Expand Up @@ -521,7 +568,7 @@ class HideNotClickableItems {
val auctionHouseInventory =
chestName == "Co-op Auction House" || chestName == "Auction House" || chestName == "Create BIN Auction" || chestName == "Create Auction"
if (!bazaarInventory && !auctionHouseInventory) return false
reverseColor = true
showGreenLine = true

if (ItemUtils.isSkyBlockMenuItem(stack)) {
if (bazaarInventory) hideReason = "The SkyBlock Menu is not a Bazaar Product!"
Expand Down
Loading