aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt1
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/Garden.java6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/GardenVisitorColorNames.kt16
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/GardenVisitorFeatures.kt23
-rw-r--r--src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt52
6 files changed, 91 insertions, 9 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt
index 53ac4f37e..048f4968a 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt
+++ b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt
@@ -53,6 +53,7 @@ object Commands {
registerCommand("shreloadbingodata") { BingoCardDisplay.command() }
registerCommand("shprintbingohelper") { BingoNextStepHelper.command() }
registerCommand("shsetapikey") { ApiDataLoader.command(it) }
+ registerCommand("shtestgardenvisitors") { LorenzTest.testGardenVisitors() }
}
private fun registerCommand(name: String, function: (Array<String>) -> Unit) {
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 559bb68d3..eacdea6cd 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/Garden.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/Garden.java
@@ -89,6 +89,12 @@ public class Garden {
public boolean visitorNeedsShowPrice = true;
@Expose
+ @ConfigOption(name = "Item Preview", desc = "Show the base type for the required items next to new visitors. §cNote that some visitors may require any crop.")
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 3)
+ public boolean visitorItemPreview = true;
+
+ @Expose
@ConfigOption(name = "Visitor Inventory", desc = "")
@ConfigAccordionId(id = 1)
@ConfigEditorAccordion(id = 4)
diff --git a/src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt b/src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt
index eb9367776..cc751e526 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt
@@ -668,7 +668,7 @@ class DamageIndicatorManager {
270_000 / 2, 270_000 -> 1
0 -> 0
else -> {
- LorenzTest.text = "thorn has ${LorenzUtils.formatDouble(realHealth.toDouble())} hp!"
+ LorenzTest.displayLine = "thorn has ${LorenzUtils.formatDouble(realHealth.toDouble())} hp!"
LorenzUtils.error(
"Unexpected health of thorn in m4! (${
LorenzUtils.formatDouble(
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenVisitorColorNames.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenVisitorColorNames.kt
index 090cfd1b5..cf0df59e8 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenVisitorColorNames.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenVisitorColorNames.kt
@@ -11,13 +11,18 @@ class GardenVisitorColorNames {
@SubscribeEvent
fun onRepoReload(event: RepositoryReloadEvent) {
try {
- val map = mutableMapOf<String, String>()
+ val mapColor = mutableMapOf<String, String>()
+ val mapItems = mutableMapOf<String, List<String>>()
val garden = event.getConstant("Garden")!!
for ((name, element) in garden["visitors"].asJsonObject.entrySet()) {
- val rarity = element.asJsonObject["rarity"].asString
- map[name] = getColor(rarity)
+ val jsonObject = element.asJsonObject
+ val rarity = jsonObject["rarity"].asString
+ mapColor[name] = getColor(rarity)
+ mapItems[name] = jsonObject["need_items"].asJsonArray.map { it.asString }
+
}
- visitorColor = map
+ visitorColor = mapColor
+ visitorItems = mapItems
} catch (e: Exception) {
e.printStackTrace()
@@ -25,8 +30,9 @@ class GardenVisitorColorNames {
}
}
- companion object{
+ companion object {
private var visitorColor = mapOf<String, String>() // name -> color code
+ var visitorItems = mapOf<String, List<String>>()
fun getColoredName(name: String): String {
if (!SkyHanniMod.feature.garden.visitorColoredName) return name
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 16edfec89..5ecdad087 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenVisitorFeatures.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenVisitorFeatures.kt
@@ -139,7 +139,28 @@ class GardenVisitorFeatures {
newDisplay.add(Collections.singletonList("§e$amount §7new $visitorLabel:"))
for (visitor in newVisitors) {
val displayName = GardenVisitorColorNames.getColoredName(visitor)
- newDisplay.add(Collections.singletonList(" §7- $displayName"))
+
+ val list = mutableListOf<Any>()
+ list.add(" §7- $displayName")
+
+ if (config.visitorItemPreview) {
+ val items = GardenVisitorColorNames.visitorItems[visitor.removeColor()]!!
+ list.add(" ")
+ if (items.isEmpty()) {
+ list.add("§7(§fAny§7)")
+ } else {
+ for (item in items) {
+ try {
+ val internalName = NEUItems.getInternalName(item)
+ list.add(NEUItems.getItemStack(internalName))
+ } catch (e: Exception) {
+ list.add(" '$item' ")
+ }
+ }
+ }
+ }
+
+ newDisplay.add(list)
}
}
diff --git a/src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt b/src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt
index bc008f43a..9f78e5452 100644
--- a/src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt
+++ b/src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt
@@ -5,8 +5,10 @@ import at.hannibal2.skyhanni.events.GuiRenderEvent
import at.hannibal2.skyhanni.events.LorenzChatEvent
import at.hannibal2.skyhanni.events.PlaySoundEvent
import at.hannibal2.skyhanni.events.ReceiveParticleEvent
+import at.hannibal2.skyhanni.features.garden.GardenVisitorColorNames
import at.hannibal2.skyhanni.utils.*
import at.hannibal2.skyhanni.utils.RenderUtils.renderString
+import at.hannibal2.skyhanni.utils.RenderUtils.renderStringsAndItems
import net.minecraft.nbt.NBTTagCompound
import net.minecraftforge.common.MinecraftForge
import net.minecraftforge.event.entity.player.ItemTooltipEvent
@@ -16,7 +18,8 @@ import java.io.File
class LorenzTest {
companion object {
- var text = ""
+ var displayLine = ""
+ var displayList = listOf<List<Any>>()
var a = 1.0
var b = 60.0
@@ -64,6 +67,50 @@ class LorenzTest {
// }
}
+ fun testGardenVisitors() {
+ if (displayList.isNotEmpty()) {
+ displayList = mutableListOf()
+ return
+ }
+
+ val bigList = mutableListOf<List<Any>>()
+ var list = mutableListOf<Any>()
+ var i = 0
+ var errors = 0
+ for (item in GardenVisitorColorNames.visitorItems) {
+ val name = item.key
+ i++
+ if (i == 5) {
+ i = 0
+ bigList.add(list)
+ list = mutableListOf()
+ }
+
+ val coloredName = GardenVisitorColorNames.getColoredName(name)
+ list.add("$coloredName§7 (")
+ for (itemName in item.value) {
+ try {
+ val internalName = NEUItems.getInternalName(itemName)
+ list.add(NEUItems.getItemStack(internalName))
+ } catch (e: Exception) {
+ LorenzUtils.debug("itemName '$itemName' is invalid for visitor '$name'")
+ errors++
+ }
+ }
+ if (item.value.isEmpty()) {
+ list.add("Any")
+ }
+ list.add("§7) ")
+ }
+ bigList.add(list)
+ displayList = bigList
+ if (errors == 0) {
+ LorenzUtils.debug("Test garden visitor renderer: no errors")
+ } else {
+ LorenzUtils.debug("Test garden visitor renderer: $errors errors")
+ }
+ }
+
fun reloadListeners() {
val blockedFeatures = try {
File("config/skyhanni/blocked-features.txt").readLines().toList()
@@ -131,7 +178,8 @@ class LorenzTest {
if (!LorenzUtils.inSkyBlock) return
if (!SkyHanniMod.feature.dev.debugEnabled) return
- SkyHanniMod.feature.dev.debugPos.renderString(text, posLabel = "Test")
+ SkyHanniMod.feature.dev.debugPos.renderString(displayLine, posLabel = "Test")
+ SkyHanniMod.feature.dev.debugPos.renderStringsAndItems(displayList, posLabel = "Test Display")
}
@SubscribeEvent