aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features/garden
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-03-01 13:21:55 +0100
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-03-01 13:21:55 +0100
commitc5881240487d63e9497ce404205b2f2f31a48f81 (patch)
tree29bdd632306d1e1b0ee97c2667237bde44a5b22f /src/main/java/at/hannibal2/skyhanni/features/garden
parentbf65ac2d17c1cd86f6ad330c3ee5bf158bbb7a23 (diff)
downloadskyhanni-c5881240487d63e9497ce404205b2f2f31a48f81.tar.gz
skyhanni-c5881240487d63e9497ce404205b2f2f31a48f81.tar.bz2
skyhanni-c5881240487d63e9497ce404205b2f2f31a48f81.zip
Added option to always show Best Crop Time while in garden. (Default disabled)
Added option to only show title or only show chat message when a new visitor arrives.
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/garden')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropMilestoneDisplay.kt28
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/GardenVisitorFeatures.kt29
2 files changed, 32 insertions, 25 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropMilestoneDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropMilestoneDisplay.kt
index 7581a62fb..06c4c794b 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropMilestoneDisplay.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropMilestoneDisplay.kt
@@ -1,6 +1,7 @@
package at.hannibal2.skyhanni.features.garden
import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.config.features.Garden
import at.hannibal2.skyhanni.data.GardenCropMilestones
import at.hannibal2.skyhanni.data.IslandType
import at.hannibal2.skyhanni.events.CropMilestoneUpdateEvent
@@ -26,14 +27,15 @@ class GardenCropMilestoneDisplay {
private var needsInventory = false
private val cultivatingData = mutableMapOf<String, Int>()
private val timeTillNextCrop: MutableMap<String, Long> get() = SkyHanniMod.feature.hidden.gardenTimeTillNextCropMilestone
+ private val config: Garden get() = SkyHanniMod.feature.garden
@SubscribeEvent
fun onRenderOverlay(event: GuiRenderEvent.GameOverlayRenderEvent) {
if (!isEnabled()) return
- SkyHanniMod.feature.garden.cropMilestoneProgressDisplayPos.renderStringsAndItems(progressDisplay)
- if (SkyHanniMod.feature.garden.cropMilestoneBestDisplay) {
- SkyHanniMod.feature.garden.cropMilestoneNextDisplayPos.renderStringsAndItems(bestCropDisplay)
+ config.cropMilestoneProgressDisplayPos.renderStringsAndItems(progressDisplay)
+ if (config.cropMilestoneBestDisplay) {
+ config.cropMilestoneNextDisplayPos.renderStringsAndItems(bestCropDisplay)
}
}
@@ -147,14 +149,19 @@ class GardenCropMilestoneDisplay {
}
drawProgressDisplay(it, crops)
- if (SkyHanniMod.feature.garden.cropMilestoneBestDisplay) {
+ if (config.cropMilestoneBestDisplay) {
drawBestDisplay(it)
}
}
+ if (config.cropMilestoneBestAlwaysOn) {
+ if (currentCrop == null) {
+ drawBestDisplay(null)
+ }
+ }
}
- private fun drawBestDisplay(currentCrop: String) {
- val gardenExp = SkyHanniMod.feature.garden.cropMilestoneBestType == 0
+ private fun drawBestDisplay(currentCrop: String?) {
+ val gardenExp = config.cropMilestoneBestType == 0
val sorted = if (gardenExp) {
val helpMap = mutableMapOf<String, Long>()
for ((cropName, time) in timeTillNextCrop) {
@@ -181,10 +188,10 @@ class GardenCropMilestoneDisplay {
val millis = timeTillNextCrop[cropName]!!
val duration = TimeUtils.formatDuration(millis)
- val isCurrent = currentCrop == cropName
+ val isCurrent = cropName == currentCrop
val color = if (isCurrent) "§e" else ""
number++
- if (number > SkyHanniMod.feature.garden.cropMilestoneShowOnlyBest && !isCurrent) continue
+ if (number > config.cropMilestoneShowOnlyBest && !isCurrent) continue
val cropNameDisplay = "$number# $color$cropName"
if (gardenExp) {
val crops = GardenCropMilestones.cropCounter[cropName]!!
@@ -267,7 +274,6 @@ class GardenCropMilestoneDisplay {
return null
}
- private fun isEnabled() = LorenzUtils.inSkyBlock &&
- SkyHanniMod.feature.garden.cropMilestoneProgress &&
- LorenzUtils.skyBlockIsland == IslandType.GARDEN
+ private fun isEnabled() =
+ LorenzUtils.inSkyBlock && config.cropMilestoneProgress && LorenzUtils.skyBlockIsland == IslandType.GARDEN
} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenVisitorFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenVisitorFeatures.kt
index 7a9966cc7..0a064401e 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenVisitorFeatures.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenVisitorFeatures.kt
@@ -1,6 +1,7 @@
package at.hannibal2.skyhanni.features.garden
import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.config.features.Garden
import at.hannibal2.skyhanni.data.IslandType
import at.hannibal2.skyhanni.data.SendTitleHelper
import at.hannibal2.skyhanni.events.*
@@ -26,6 +27,7 @@ class GardenVisitorFeatures {
private var lastClickedNpc = 0
private var nearby = false
private var tick = 0
+ private val config: Garden get() = SkyHanniMod.feature.garden
companion object {
var inVisitorInventory = false
@@ -51,7 +53,7 @@ class GardenVisitorFeatures {
if (offerItem.name != "§aAccept Offer") return
inVisitorInventory = true
- if (!SkyHanniMod.feature.garden.visitorNeedsDisplay && !SkyHanniMod.feature.garden.visitorHighlight) return
+ if (!config.visitorNeedsDisplay && !config.visitorHighlight) return
val visitor = visitors[npcItem.name!!]!!
visitor.entityId = lastClickedNpc
@@ -76,7 +78,7 @@ class GardenVisitorFeatures {
private fun drawDisplay(): List<List<Any>> {
val newDisplay = mutableListOf<List<Any>>()
- if (!SkyHanniMod.feature.garden.visitorNeedsDisplay) return newDisplay
+ if (!config.visitorNeedsDisplay) return newDisplay
val requiredItems = mutableMapOf<String, Int>()
val newVisitors = mutableListOf<String>()
@@ -126,7 +128,7 @@ class GardenVisitorFeatures {
fun onTooltip(event: ItemTooltipEvent) {
if (!isEnabled()) return
if (!nearby) return
- if (!SkyHanniMod.feature.garden.visitorShowPrice) return
+ if (!config.visitorShowPrice) return
if (!inVisitorInventory) return
val name = event.itemStack.name ?: return
@@ -173,10 +175,7 @@ class GardenVisitorFeatures {
@SubscribeEvent
fun onTick(event: TickEvent.ClientTickEvent) {
if (!isEnabled()) return
- if (!SkyHanniMod.feature.garden.visitorNeedsDisplay &&
- !SkyHanniMod.feature.garden.visitorHighlight &&
- !SkyHanniMod.feature.garden.visitorShowPrice
- ) return
+ if (!config.visitorNeedsDisplay && !config.visitorHighlight && !config.visitorShowPrice) return
if (tick++ % 60 != 0) return
val defaultVanillaSkin = LorenzVec(8.4, 72.0, -14.1)
@@ -196,7 +195,7 @@ class GardenVisitorFeatures {
val playerLocation = LocationUtils.playerLocation()
nearby = list.map { playerLocation.distance(it) < 15 }.any { it }
- if (nearby && SkyHanniMod.feature.garden.visitorHighlight) {
+ if (nearby && config.visitorHighlight) {
checkVisitorsReady()
}
}
@@ -226,8 +225,10 @@ class GardenVisitorFeatures {
for (name in visitorsInTab) {
if (!visitors.containsKey(name)) {
visitors[name] = Visitor(-1)
- if (SkyHanniMod.feature.garden.visitorNotification) {
+ if (config.visitorNotificationTitle) {
SendTitleHelper.sendTitle("§eNew Visitor", 5_000)
+ }
+ if (config.visitorNotificationChat) {
LorenzUtils.chat("§e[SkyHanni] $name §eis visiting your garden!")
}
updateDisplay()
@@ -246,11 +247,11 @@ class GardenVisitorFeatures {
if (visitor.items.isEmpty()) {
val color = LorenzColor.DARK_AQUA.toColor().withAlpha(120)
RenderLivingEntityHelper.setEntityColor(entity, color)
- { SkyHanniMod.feature.garden.visitorHighlight }
+ { config.visitorHighlight }
} else if (isReady(visitor)) {
val color = LorenzColor.GREEN.toColor().withAlpha(120)
RenderLivingEntityHelper.setEntityColor(entity, color)
- { SkyHanniMod.feature.garden.visitorHighlight }
+ { config.visitorHighlight }
} else {
RenderLivingEntityHelper.removeEntityColor(entity)
}
@@ -297,13 +298,13 @@ class GardenVisitorFeatures {
@SubscribeEvent
fun onRenderOverlay(event: GuiRenderEvent) {
if (!isEnabled()) return
- if (!SkyHanniMod.feature.garden.visitorNeedsDisplay) return
+ if (!config.visitorNeedsDisplay) return
- if (SkyHanniMod.feature.garden.visitorNeedsOnlyWhenClose) {
+ if (config.visitorNeedsOnlyWhenClose) {
if (!nearby) return
}
- SkyHanniMod.feature.garden.visitorNeedsPos.renderStringsAndItems(display)
+ config.visitorNeedsPos.renderStringsAndItems(display)
}
class Visitor(var entityId: Int, val items: MutableMap<String, Int> = mutableMapOf())