Skip to content

Commit

Permalink
Backend: Carnival graph area (#2759)
Browse files Browse the repository at this point in the history
Co-authored-by: hannibal2 <[email protected]>
  • Loading branch information
hannibal002 and hannibal002 authored Oct 18, 2024
1 parent 1cfd04c commit 5dae347
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
package at.hannibal2.skyhanni.features.event.carnival

import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.api.event.HandleEvent
import at.hannibal2.skyhanni.data.Perk
import at.hannibal2.skyhanni.data.ProfileStorageData
import at.hannibal2.skyhanni.events.GuiRenderEvent
import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent
import at.hannibal2.skyhanni.events.LorenzChatEvent
import at.hannibal2.skyhanni.events.ProfileJoinEvent
import at.hannibal2.skyhanni.events.skyblock.GraphAreaChangeEvent
import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
import at.hannibal2.skyhanni.utils.ItemUtils.getLore
import at.hannibal2.skyhanni.utils.LorenzUtils
Expand Down Expand Up @@ -192,6 +194,7 @@ enum class CarnivalGoal(
}

private var display = emptyList<Renderable>()
private var inCarnival = false

@SubscribeEvent
fun onGuiRenderGuiOverlayRender(event: GuiRenderEvent.GuiOverlayRenderEvent) {
Expand All @@ -205,8 +208,13 @@ enum class CarnivalGoal(
config.goalsPosition.renderRenderables(display, posLabel = "Carnival Goals")
}

@HandleEvent
fun onAreaChange(event: GraphAreaChangeEvent) {
inCarnival = event.area == "Carnival"
}

fun isEnabled() =
LorenzUtils.inSkyBlock && config.showGoals && Perk.CHIVALROUS_CARNIVAL.isActive && LorenzUtils.skyBlockArea == "Carnival"
LorenzUtils.inSkyBlock && config.showGoals && Perk.CHIVALROUS_CARNIVAL.isActive && inCarnival

private enum class GoalType(val item: Item, display: String) {
FRUIT_DIGGING(Item.getItemFromBlock(Blocks.sand), "§6Fruit Digging"),
Expand All @@ -232,5 +240,4 @@ enum class CarnivalGoal(
val getGoals get() = CarnivalGoal.entries.filter { it.type == this }
}
}

}

0 comments on commit 5dae347

Please sign in to comment.