aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/Garden.java18
-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
3 files changed, 48 insertions, 27 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/Garden.java b/src/main/java/at/hannibal2/skyhanni/config/features/Garden.java
index b0d445f5e..d05b29442 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/Garden.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/Garden.java
@@ -78,10 +78,16 @@ public class Garden {
public boolean visitorNeedsOnlyWhenClose = false;
@Expose
- @ConfigOption(name = "Notification", desc = "Show as title and in chat when a new visitor is visiting your island.")
+ @ConfigOption(name = "Notification Chat", desc = "Show in chat when a new visitor is visiting your island.")
@ConfigEditorBoolean
@ConfigAccordionId(id = 1)
- public boolean visitorNotification = true;
+ public boolean visitorNotificationChat = true;
+
+ @Expose
+ @ConfigOption(name = "Notification Title", desc = "Show a title when a new visitor is visiting your island.")
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 1)
+ public boolean visitorNotificationTitle = true;
@Expose
@ConfigOption(name = "Highlight", desc = "Highlight visitor when the required items are in the inventory or the visitor is new and needs to checked what items it needs.")
@@ -164,6 +170,14 @@ public class Garden {
public int cropMilestoneShowOnlyBest = 10;
@Expose
+ @ConfigOption(
+ name = "Always On",
+ desc = "Show the Best Display always while on the garden.")
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 6)
+ public boolean cropMilestoneBestAlwaysOn = false;
+
+ @Expose
@ConfigOption(name = "Display Position", desc = "")
@ConfigEditorButton(runnableId = "cropMilestoneNext", buttonText = "Edit")
@ConfigAccordionId(id = 6)
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())