Skip to content

Commit

Permalink
Improvement: Add toggle to UserLuck Breakdown (hannibal002#2357)
Browse files Browse the repository at this point in the history
  • Loading branch information
martimavocado authored Aug 26, 2024
1 parent 03a1d0e commit 2b43ecc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -303,4 +303,10 @@ public class MiscConfig {
@ConfigEditorBoolean
@FeatureToggle
public boolean maintainGameVolume = false;

@Expose
@ConfigOption(name = "SkyHanni User Luck", desc = "Shows SkyHanni User Luck in the SkyBlock Stats.")
@ConfigEditorBoolean
@FeatureToggle
public boolean userluckEnabled = true;
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package at.hannibal2.skyhanni.features.misc

import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.data.ProfileStorageData
import at.hannibal2.skyhanni.events.GuiContainerEvent
import at.hannibal2.skyhanni.events.InventoryCloseEvent
Expand Down Expand Up @@ -33,6 +34,7 @@ object UserLuckBreakdown {
private var skillCalcCoolDown = SimpleTimeMark.farPast()

private val storage get() = ProfileStorageData.playerSpecific
private val config get() = SkyHanniMod.feature.misc

private lateinit var mainLuckItem: ItemStack
private val mainLuckID = "ENDER_PEARL".asInternalName()
Expand Down Expand Up @@ -71,6 +73,7 @@ object UserLuckBreakdown {

@SubscribeEvent
fun replaceItem(event: ReplaceItemEvent) {
if (!config.userluckEnabled) return
if (event.inventory !is ContainerLocalMenu) return
if (!inMiscStats) return

Expand Down Expand Up @@ -151,6 +154,7 @@ object UserLuckBreakdown {

@SubscribeEvent
fun onHoverItem(event: LorenzToolTipEvent) {
if (!config.userluckEnabled) return
if (!LorenzUtils.inSkyBlock) return
if (skillCalcCoolDown.passedSince() > 3.seconds) {
skillCalcCoolDown = SimpleTimeMark.now()
Expand Down Expand Up @@ -212,6 +216,7 @@ object UserLuckBreakdown {

@SubscribeEvent
fun onStackClick(event: GuiContainerEvent.SlotClickEvent) {
if (!config.userluckEnabled) return
if (!inMiscStats) return
val limboUserLuck = storage?.limbo?.userLuck ?: 0.0f
if (limboUserLuck == 0.0f && !showAllStats) return
Expand Down

0 comments on commit 2b43ecc

Please sign in to comment.