diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-01-21 08:26:38 +0100 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-01-21 08:26:38 +0100 |
commit | 9360f10e193b4bc3d634cc853e7cfd82d5ff5b76 (patch) | |
tree | 3c500a54d1aeed214798d86123f41efb5388f017 /src/main/java/at/hannibal2/skyhanni | |
parent | a66db31bd1388d411365debf2914aa686c40dae0 (diff) | |
download | skyhanni-9360f10e193b4bc3d634cc853e7cfd82d5ff5b76.tar.gz skyhanni-9360f10e193b4bc3d634cc853e7cfd82d5ff5b76.tar.bz2 skyhanni-9360f10e193b4bc3d634cc853e7cfd82d5ff5b76.zip |
Add locations for reputation quests, mini bosses and kuudra fight.
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni')
17 files changed, 293 insertions, 34 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/Misc.java b/src/main/java/at/hannibal2/skyhanni/config/features/Misc.java index 4ddfc0b01..2667337af 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/Misc.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/Misc.java @@ -121,6 +121,29 @@ public class Misc { public Position nonGodPotEffectPos = new Position(10, 10, false, true); @Expose + @ConfigOption(name = "Crimson Reputation Helper", desc = "") + @ConfigEditorAccordion(id = 6) + public boolean reputationHelper = false; + + @Expose + @ConfigOption(name = "Crimson Isle Reputation", desc = "Enable features around Reputation features in the Crimson Isle.") + @ConfigEditorBoolean + @ConfigAccordionId(id = 6) + public boolean crimsonIsleReputationHelper = true; + + @Expose + @ConfigOption(name = "Reputation Position", desc = "") + @ConfigEditorButton(runnableId = "crimsonIsleReputationHelper", buttonText = "Edit") + @ConfigAccordionId(id = 6) + public Position crimsonIsleReputationHelperPos = new Position(10, 10, false, true); + + @Expose + @ConfigOption(name = "Reputation Locations", desc = "Show locations to the points where to do stuff in the Crimson Isle to get reputation.") + @ConfigEditorBoolean + @ConfigAccordionId(id = 6) + public boolean crimsonIsleReputationLocation = true; + + @Expose @ConfigOption(name = "Exp Bottles", desc = "Hides all the experience bottles lying on the ground.") @ConfigEditorBoolean public boolean hideExpBottles = false; @@ -141,16 +164,6 @@ public class Misc { public boolean brewingStandOverlay = true; @Expose - @ConfigOption(name = "Crimson Isle Reputation", desc = "Enable features around Reputation features in the Crimson Isle") - @ConfigEditorBoolean - public boolean crimsonIsleReputationHelper = true; - - @Expose - @ConfigOption(name = "Reputation Position", desc = "") - @ConfigEditorButton(runnableId = "crimsonIsleReputationHelper", buttonText = "Edit") - public Position crimsonIsleReputationHelperPos = new Position(10, 10, false, true); - - @Expose @ConfigOption(name = "Config Button", desc = "Add a button to the pause menu to configure SkyHanni.") @ConfigEditorBoolean public boolean configButtonOnPause = true; diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailykuudra/DailyKuudraBossHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailykuudra/DailyKuudraBossHelper.kt index 169603784..73fbac7dd 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailykuudra/DailyKuudraBossHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailykuudra/DailyKuudraBossHelper.kt @@ -6,8 +6,13 @@ import at.hannibal2.skyhanni.data.IslandType import at.hannibal2.skyhanni.data.ScoreboardData import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.features.nether.reputationhelper.CrimsonIsleReputationHelper +import at.hannibal2.skyhanni.test.GriffinUtils.drawWaypointFilled +import at.hannibal2.skyhanni.utils.LorenzColor import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.LorenzVec import at.hannibal2.skyhanni.utils.NEUItems +import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText +import net.minecraftforge.client.event.RenderWorldLastEvent import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import java.util.* import java.util.regex.Pattern @@ -16,6 +21,9 @@ class DailyKuudraBossHelper(private val reputationHelper: CrimsonIsleReputationH val kuudraTiers = mutableListOf<KuudraTier>() private val pattern = Pattern.compile(" Kuudra's Hollow \\(T(.*)\\)") + private var kuudraLocation: LorenzVec? = null + private var allKuudraDone = true + fun init() { val repoData = reputationHelper.repoData val jsonElement = repoData["KUUDRA"] @@ -23,12 +31,40 @@ class DailyKuudraBossHelper(private val reputationHelper: CrimsonIsleReputationH for ((displayName, extraData) in jsonElement.asJsonObject.entrySet()) { val data = extraData.asJsonObject val displayItem = data["item"]?.asString - kuudraTiers.add(KuudraTier(displayName, displayItem, tier)) + + val locationData = data["location"]?.asJsonArray + val location: LorenzVec? = if (locationData == null || locationData.size() == 0) { + null + } else { + val x = locationData[0].asDouble + val y = locationData[1].asDouble + val z = locationData[2].asDouble + LorenzVec(x, y, z) + } + kuudraTiers.add(KuudraTier(displayName, displayItem, location, tier)) + if (location != null) { + kuudraLocation = location + } + tier++ } } @SubscribeEvent + fun onRenderWorld(event: RenderWorldLastEvent) { + if (!LorenzUtils.inSkyBlock) return + if (LorenzUtils.skyBlockIsland != IslandType.CRIMSON_ISLE) return + if (!SkyHanniMod.feature.misc.crimsonIsleReputationHelper) return + if (!SkyHanniMod.feature.misc.crimsonIsleReputationLocation) return + if (allKuudraDone) return + + kuudraLocation?.let { + event.drawWaypointFilled(it, LorenzColor.WHITE.toColor()) + event.drawDynamicText(it, "Kuudra", 1.5) + } + } + + @SubscribeEvent fun onChat(event: LorenzChatEvent) { if (!HyPixelData.skyBlock) return if (LorenzUtils.skyBlockIsland != IslandType.KUUDRA_ARENA) return @@ -52,6 +88,7 @@ class DailyKuudraBossHelper(private val reputationHelper: CrimsonIsleReputationH LorenzUtils.debug("Detected kuudra tier done: $kuudraTier") reputationHelper.questHelper.finishKuudra(kuudraTier) kuudraTier.doneToday = true + updateAllKuudraDone() reputationHelper.update() } @@ -81,6 +118,7 @@ class DailyKuudraBossHelper(private val reputationHelper: CrimsonIsleReputationH for (miniBoss in kuudraTiers) { miniBoss.doneToday = false } + updateAllKuudraDone() } fun saveConfig() { @@ -91,9 +129,16 @@ class DailyKuudraBossHelper(private val reputationHelper: CrimsonIsleReputationH } fun loadConfig() { + println("loadConfig") for (name in SkyHanniMod.feature.hidden.crimsonIsleKuudraTiersDone) { getByDisplayName(name)!!.doneToday = true } + updateAllKuudraDone() + } + + private fun updateAllKuudraDone() { + allKuudraDone = !kuudraTiers.any { !it.doneToday } + println("allKuudraDone: $allKuudraDone") } private fun getByDisplayName(name: String) = kuudraTiers.firstOrNull { it.name == name } diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailykuudra/KuudraTier.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailykuudra/KuudraTier.kt index f938ab1fd..15d0086b8 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailykuudra/KuudraTier.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailykuudra/KuudraTier.kt @@ -1,5 +1,13 @@ package at.hannibal2.skyhanni.features.nether.reputationhelper.dailykuudra -class KuudraTier(val name: String, val displayItem: String?, val tierNumber: Int, var doneToday: Boolean = false) { +import at.hannibal2.skyhanni.utils.LorenzVec + +class KuudraTier( + val name: String, + val displayItem: String?, + val location: LorenzVec?, + val tierNumber: Int, + var doneToday: Boolean = false +) { fun getDisplayName() = "Tier $tierNumber ($name)" }
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/DailyQuestHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/DailyQuestHelper.kt index 7400b4347..3a72c2f68 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/DailyQuestHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/DailyQuestHelper.kt @@ -10,16 +10,19 @@ import at.hannibal2.skyhanni.features.nether.reputationhelper.CrimsonIsleReputat import at.hannibal2.skyhanni.features.nether.reputationhelper.dailykuudra.KuudraTier import at.hannibal2.skyhanni.features.nether.reputationhelper.dailyquest.quest.* import at.hannibal2.skyhanni.features.nether.reputationhelper.miniboss.CrimsonMiniBoss +import at.hannibal2.skyhanni.test.GriffinUtils.drawWaypointFilled import at.hannibal2.skyhanni.utils.InventoryUtils.getInventoryName import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.ItemUtils.name import at.hannibal2.skyhanni.utils.LorenzColor import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.NEUItems +import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText import at.hannibal2.skyhanni.utils.RenderUtils.highlight import net.minecraft.client.Minecraft import net.minecraft.client.gui.inventory.GuiChest import net.minecraft.inventory.ContainerChest +import net.minecraftforge.client.event.RenderWorldLastEvent import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import net.minecraftforge.fml.common.gameevent.TickEvent import java.util.* @@ -203,6 +206,22 @@ class DailyQuestHelper(val reputationHelper: CrimsonIsleReputationHelper) { update() } + @SubscribeEvent + fun onRenderWorld(event: RenderWorldLastEvent) { + if (!LorenzUtils.inSkyBlock) return + if (LorenzUtils.skyBlockIsland != IslandType.CRIMSON_ISLE) return + if (!SkyHanniMod.feature.misc.crimsonIsleReputationHelper) return + if (!SkyHanniMod.feature.misc.crimsonIsleReputationLocation) return + + for (quest in quests) { + if (quest.state == QuestState.ACCEPTED) { + val location = quest.location ?: continue + event.drawWaypointFilled(location, LorenzColor.WHITE.toColor()) + event.drawDynamicText(location, quest.displayName, 1.5) + } + } + } + fun render(display: MutableList<List<Any>>) { val done = quests.count { it.state == QuestState.COLLECTED } display.add(Collections.singletonList("")) diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/QuestLoader.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/QuestLoader.kt index 61a1c4d77..d48d28fd3 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/QuestLoader.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/QuestLoader.kt @@ -5,6 +5,7 @@ import at.hannibal2.skyhanni.features.nether.reputationhelper.dailyquest.quest.* import at.hannibal2.skyhanni.utils.InventoryUtils.getInventoryName import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.LorenzVec import at.hannibal2.skyhanni.utils.TabListUtils import net.minecraft.client.Minecraft import net.minecraft.client.gui.inventory.GuiChest @@ -85,19 +86,28 @@ class QuestLoader(val dailyQuestHelper: DailyQuestHelper) { for ((entryName, extraData) in category.entrySet()) { val data = extraData.asJsonObject val displayItem = data["item"]?.asString + val locationData = data["location"]?.asJsonArray + val location: LorenzVec? = if (locationData == null || locationData.size() == 0) { + null + } else { + val x = locationData[0].asDouble + val y = locationData[1].asDouble + val z = locationData[2].asDouble + LorenzVec(x, y, z) + } if (name.startsWith("$entryName Rank ")) { val split = name.split(" Rank ") val dojoName = split[0] val dojoRankGoal = split[1] - return DojoQuest(dojoName,displayItem, dojoRankGoal, state) + return DojoQuest(dojoName, location, displayItem, dojoRankGoal, state) } if (name == entryName) { when (categoryName) { - "FISHING" -> return TrophyFishQuest(name, displayItem, state, needAmount) - "RESCUE" -> return RescueMissionQuest(displayItem, state) - "FETCH" -> return FetchQuest(name, displayItem, state, needAmount) + "FISHING" -> return TrophyFishQuest(name, location, displayItem, state, needAmount) + "RESCUE" -> return RescueMissionQuest(displayItem, location, state) + "FETCH" -> return FetchQuest(name, location, displayItem, state, needAmount) } } } @@ -161,12 +171,14 @@ class QuestLoader(val dailyQuestHelper: DailyQuestHelper) { val needAmount = split[2].toInt() val quest = addQuest(name, state, needAmount) if (quest is ProgressQuest) { - try { - val haveAmount = split[3].toInt() - quest.haveAmount = haveAmount - } catch (e: IndexOutOfBoundsException) { - println("text: '$text'") - e.printStackTrace() + if (split.size == 4) { + try { + val haveAmount = split[3].toInt() + quest.haveAmount = haveAmount + } catch (e: IndexOutOfBoundsException) { + println("text: '$text'") + e.printStackTrace() + } } } dailyQuestHelper.quests.add(quest) diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/quest/DojoQuest.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/quest/DojoQuest.kt index c8bc1a2c7..2328e963f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/quest/DojoQuest.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/quest/DojoQuest.kt @@ -1,10 +1,18 @@ package at.hannibal2.skyhanni.features.nether.reputationhelper.dailyquest.quest import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.LorenzVec -class DojoQuest(val dojoName: String, displayItem: String?, dojoRankGoal: String, state: QuestState) : +class DojoQuest( + val dojoName: String, + location: LorenzVec?, + displayItem: String?, + dojoRankGoal: String, + state: QuestState +) : Quest( displayItem, + location, QuestCategory.DOJO, "$dojoName Rank $dojoRankGoal", state, diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/quest/FetchQuest.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/quest/FetchQuest.kt index 115cbcb32..645b09fdc 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/quest/FetchQuest.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/quest/FetchQuest.kt @@ -1,4 +1,6 @@ package at.hannibal2.skyhanni.features.nether.reputationhelper.dailyquest.quest -class FetchQuest(val itemName: String, displayItem: String?, state: QuestState, needAmount: Int) : - ProgressQuest(displayItem, QuestCategory.FETCH, itemName, state, needAmount)
\ No newline at end of file +import at.hannibal2.skyhanni.utils.LorenzVec + +class FetchQuest(val itemName: String, location: LorenzVec?, displayItem: String?, state: QuestState, needAmount: Int) : + ProgressQuest(displayItem, location, QuestCategory.FETCH, itemName, state, needAmount)
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/quest/KuudraQuest.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/quest/KuudraQuest.kt index 79085a6f1..096b46267 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/quest/KuudraQuest.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/quest/KuudraQuest.kt @@ -5,6 +5,7 @@ import at.hannibal2.skyhanni.features.nether.reputationhelper.dailykuudra.Kuudra class KuudraQuest(val kuudraTier: KuudraTier, state: QuestState) : Quest( kuudraTier.displayItem, + kuudraTier.location, QuestCategory.KUUDRA, "Kill Kuudra ${kuudraTier.name} Tier", state, diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/quest/MiniBossQuest.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/quest/MiniBossQuest.kt index a36b32131..914f1e921 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/quest/MiniBossQuest.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/quest/MiniBossQuest.kt @@ -3,4 +3,11 @@ package at.hannibal2.skyhanni.features.nether.reputationhelper.dailyquest.quest import at.hannibal2.skyhanni.features.nether.reputationhelper.miniboss.CrimsonMiniBoss class MiniBossQuest(val miniBoss: CrimsonMiniBoss, state: QuestState, needAmount: Int) : - ProgressQuest(miniBoss.displayItem, QuestCategory.MINIBOSS, miniBoss.displayName, state, needAmount)
\ No newline at end of file + ProgressQuest( + miniBoss.displayItem, + miniBoss.location, + QuestCategory.MINIBOSS, + miniBoss.displayName, + state, + needAmount + )
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/quest/ProgressQuest.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/quest/ProgressQuest.kt index eac078cc0..23155eebb 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/quest/ProgressQuest.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/quest/ProgressQuest.kt @@ -1,10 +1,13 @@ package at.hannibal2.skyhanni.features.nether.reputationhelper.dailyquest.quest +import at.hannibal2.skyhanni.utils.LorenzVec + abstract class ProgressQuest( displayItem: String?, + location: LorenzVec?, questCategory: QuestCategory, displayName: String, state: QuestState, val needAmount: Int, var haveAmount: Int = 0 -) : Quest(displayItem, questCategory, displayName, state)
\ No newline at end of file +) : Quest(displayItem, location, questCategory, displayName, state)
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/quest/Quest.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/quest/Quest.kt index 5a6bf3f89..230900153 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/quest/Quest.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/quest/Quest.kt @@ -1,7 +1,10 @@ package at.hannibal2.skyhanni.features.nether.reputationhelper.dailyquest.quest +import at.hannibal2.skyhanni.utils.LorenzVec + abstract class Quest( val displayItem: String?, + val location: LorenzVec?, val category: QuestCategory, val internalName: String, var state: QuestState, diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/quest/RescueMissionQuest.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/quest/RescueMissionQuest.kt index ccc9d3c25..fbb266296 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/quest/RescueMissionQuest.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/quest/RescueMissionQuest.kt @@ -1,4 +1,6 @@ package at.hannibal2.skyhanni.features.nether.reputationhelper.dailyquest.quest -class RescueMissionQuest(displayItem: String?, state: QuestState) : - Quest(displayItem, QuestCategory.RESCUE, "Rescue Mission", state, "Rescue the NPC")
\ No newline at end of file +import at.hannibal2.skyhanni.utils.LorenzVec + +class RescueMissionQuest(displayItem: String?, location: LorenzVec?, state: QuestState) : + Quest(displayItem, location, QuestCategory.RESCUE, "Rescue Mission", state, "Rescue the NPC")
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/quest/TrophyFishQuest.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/quest/TrophyFishQuest.kt index 4a8a453c2..5b8a37a54 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/quest/TrophyFishQuest.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/quest/TrophyFishQuest.kt @@ -1,4 +1,12 @@ package at.hannibal2.skyhanni.features.nether.reputationhelper.dailyquest.quest -class TrophyFishQuest(val fishName: String, displayItem: String?, state: QuestState, needAmount: Int) : - ProgressQuest(displayItem, QuestCategory.FISHING, fishName, state, needAmount)
\ No newline at end of file +import at.hannibal2.skyhanni.utils.LorenzVec + +class TrophyFishQuest( + val fishName: String, + location: LorenzVec?, + displayItem: String?, + state: QuestState, + needAmount: Int +) : + ProgressQuest(displayItem, location, QuestCategory.FISHING, fishName, state, needAmount)
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/quest/UnknownQuest.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/quest/UnknownQuest.kt index 1c1269c57..02819a28d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/quest/UnknownQuest.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/quest/UnknownQuest.kt @@ -1,4 +1,4 @@ package at.hannibal2.skyhanni.features.nether.reputationhelper.dailyquest.quest -class UnknownQuest(unknownName: String) : Quest(null, QuestCategory.UNKNOWN, unknownName, QuestState.NOT_ACCEPTED) { -}
\ No newline at end of file +class UnknownQuest(unknownName: String) : + Quest(null, null, QuestCategory.UNKNOWN, unknownName, QuestState.NOT_ACCEPTED)
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/miniboss/CrimsonMiniBoss.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/miniboss/CrimsonMiniBoss.kt index e2ac6ddb2..ad5255aac 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/miniboss/CrimsonMiniBoss.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/miniboss/CrimsonMiniBoss.kt @@ -1,10 +1,12 @@ package at.hannibal2.skyhanni.features.nether.reputationhelper.miniboss +import at.hannibal2.skyhanni.utils.LorenzVec import java.util.regex.Pattern class CrimsonMiniBoss( val displayName: String, val displayItem: String?, + val location: LorenzVec?, val pattern: Pattern, var doneToday: Boolean = false )
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/miniboss/DailyMiniBossHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/miniboss/DailyMiniBossHelper.kt index e05e300d3..6cce8c68c 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/miniboss/DailyMiniBossHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/miniboss/DailyMiniBossHelper.kt @@ -5,8 +5,13 @@ import at.hannibal2.skyhanni.data.HyPixelData import at.hannibal2.skyhanni.data.IslandType import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.features.nether.reputationhelper.CrimsonIsleReputationHelper +import at.hannibal2.skyhanni.test.GriffinUtils.drawWaypointFilled +import at.hannibal2.skyhanni.utils.LorenzColor import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.LorenzVec import at.hannibal2.skyhanni.utils.NEUItems +import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText +import net.minecraftforge.client.event.RenderWorldLastEvent import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import java.util.* import java.util.regex.Pattern @@ -22,7 +27,18 @@ class DailyMiniBossHelper(private val reputationHelper: CrimsonIsleReputationHel val data = extraData.asJsonObject val displayItem = data["item"]?.asString val patterns = " *§r§6§l${displayName.uppercase()} DOWN!" - miniBosses.add(CrimsonMiniBoss(displayName, displayItem, Pattern.compile(patterns))) + + val locationData = data["location"]?.asJsonArray + val location: LorenzVec? = if (locationData == null || locationData.size() == 0) { + null + } else { + val x = locationData[0].asDouble + val y = locationData[1].asDouble + val z = locationData[2].asDouble + LorenzVec(x, y, z) + } + + miniBosses.add(CrimsonMiniBoss(displayName, displayItem, location, Pattern.compile(patterns))) } } @@ -40,6 +56,22 @@ class DailyMiniBossHelper(private val reputationHelper: CrimsonIsleReputationHel } } + @SubscribeEvent + fun onRenderWorld(event: RenderWorldLastEvent) { + if (!LorenzUtils.inSkyBlock) return + if (LorenzUtils.skyBlockIsland != IslandType.CRIMSON_ISLE) return + if (!SkyHanniMod.feature.misc.crimsonIsleReputationHelper) return + if (!SkyHanniMod.feature.misc.crimsonIsleReputationLocation) return + + for (miniBoss in miniBosses) { + if (!miniBoss.doneToday) { + val location = miniBoss.location ?: continue + event.drawWaypointFilled(location, LorenzColor.WHITE.toColor()) + event.drawDynamicText(location, miniBoss.displayName, 1.5) + } + } + } + private fun finished(miniBoss: CrimsonMiniBoss) { LorenzUtils.debug("Detected mini boss death: ${miniBoss.displayName}") reputationHelper.questHelper.finishMiniBoss(miniBoss) diff --git a/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt index a4e550f65..3796df912 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt @@ -396,6 +396,7 @@ object RenderUtils { } val f1 = 0.0266666688 + val width = minecraft.fontRendererObj.getStringWidth(finalText) / 2 GlStateManager.pushMatrix() GlStateManager.translate(x, y, z) @@ -624,4 +625,97 @@ object RenderUtils { factor = Math.min(1f, factor) drawStringScaled(str, fr, x, y, shadow, colour, factor) } + + fun RenderWorldLastEvent.drawDynamicText( + location: LorenzVec, + text: String, + scaleMultiplier: Double, + yOff: Float = 0f, + hideTooCloseAt: Double = 4.5 + ) { + val thePlayer = Minecraft.getMinecraft().thePlayer + val x = location.x + val y = location.y + val z = location.z + + val render = Minecraft.getMinecraft().renderViewEntity + val renderOffsetX = render.lastTickPosX + (render.posX - render.lastTickPosX) * partialTicks + val renderOffsetY = render.lastTickPosY + (render.posY - render.lastTickPosY) * partialTicks + val renderOffsetZ = render.lastTickPosZ + (render.posZ - render.lastTickPosZ) * partialTicks + val eyeHeight = thePlayer.eyeHeight + + val distToPlayerSq = + (x - renderOffsetX) * (x - renderOffsetX) + (y - (renderOffsetY + eyeHeight)) * (y - (renderOffsetY + eyeHeight)) + (z - renderOffsetZ) * (z - renderOffsetZ) + var distToPlayer = sqrt(distToPlayerSq) + //TODO this is optional maybe? + distToPlayer = distToPlayer.coerceAtLeast(8.0) + + if (distToPlayer < hideTooCloseAt) return + + val distRender = distToPlayer.coerceAtMost(50.0) + + val resultX = renderOffsetX + (x + 0.5 - renderOffsetX) / (distToPlayer / distRender) + val resultY = + (renderOffsetY + eyeHeight) + (y + 20 * distToPlayer / 300 - (renderOffsetY + eyeHeight)) / (distToPlayer / distRender) + val resultZ = renderOffsetZ + (z + 0.5 - renderOffsetZ) / (distToPlayer / distRender) + + val renderLocation = LorenzVec(resultX, resultY, resultZ) + var scale = distRender / 12 + scale *= scaleMultiplier + render(renderLocation, "§f$text", scale, false, true, yOff) + } + + private fun render( + location: LorenzVec, + text: String, + scale: Double, + depthTest: Boolean, + shadow: Boolean, + yOff: Float + ) { + if (!depthTest) { + GL11.glDisable(GL11.GL_DEPTH_TEST) + GL11.glDepthMask(false) + } + GlStateManager.pushMatrix() + GlStateManager.enableBlend() + GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0) + + val minecraft = Minecraft.getMinecraft() + val fontRenderer = minecraft.fontRendererObj + val renderManager = minecraft.renderManager + + GlStateManager.translate( + location.x - renderManager.viewerPosX, + location.y - renderManager.viewerPosY, + location.z - renderManager.viewerPosZ + ) + GlStateManager.color(1f, 1f, 1f, 0.5f) + GlStateManager.rotate(-renderManager.playerViewY, 0.0f, 1.0f, 0.0f) + GlStateManager.rotate(renderManager.playerViewX, 1.0f, 0.0f, 0.0f) + GlStateManager.scale(-scale / 25, -scale / 25, scale / 25) + val stringWidth = fontRenderer.getStringWidth(text.removeColor()) + if (shadow) { + fontRenderer.drawStringWithShadow( + text, + (-stringWidth / 2).toFloat(), + yOff, + 0 + ) + } else { + fontRenderer.drawString( + text, + -stringWidth / 2, + 0, + 0 + ) + } + GlStateManager.color(1f, 1f, 1f) + GlStateManager.disableBlend() + GlStateManager.popMatrix() + if (!depthTest) { + GL11.glEnable(GL11.GL_DEPTH_TEST) + GL11.glDepthMask(true) + } + } }
\ No newline at end of file |