aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-01-22 13:31:48 +0100
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-01-22 13:31:48 +0100
commit41c68c40eb41d0a4d063b541138242bbfe27b30b (patch)
treeb5aac04031bc1b1a8010e8d52a7e373cfd501ae9 /src/main/java
parentc2cfade4ae1cb1b0936b46ee31aaf8a4086b94de (diff)
downloadskyhanni-41c68c40eb41d0a4d063b541138242bbfe27b30b.tar.gz
skyhanni-41c68c40eb41d0a4d063b541138242bbfe27b30b.tar.bz2
skyhanni-41c68c40eb41d0a4d063b541138242bbfe27b30b.zip
Changed load logic for ReputationHelper.
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/CrimsonIsleReputationHelper.kt25
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailykuudra/DailyKuudraBossHelper.kt48
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/DailyQuestHelper.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/QuestLoader.kt14
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/miniboss/DailyMiniBossHelper.kt39
6 files changed, 55 insertions, 77 deletions
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 48abd66ff..f98e5da94 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt
@@ -166,7 +166,7 @@ class DamageIndicatorManager {
)
if (data.dead) data.deathLocation = loc
loc
- }
+ }.add(-0.5, 0.0, -0.5)
event.drawDynamicText(location, healthText, sizeHealth, smallestDistanceVew = smallestDistanceVew)
diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/CrimsonIsleReputationHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/CrimsonIsleReputationHelper.kt
index e4fb1055b..627467f03 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/CrimsonIsleReputationHelper.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/CrimsonIsleReputationHelper.kt
@@ -6,9 +6,9 @@ import at.hannibal2.skyhanni.data.IslandType
import at.hannibal2.skyhanni.events.RepositoryReloadEvent
import at.hannibal2.skyhanni.features.nether.reputationhelper.dailykuudra.DailyKuudraBossHelper
import at.hannibal2.skyhanni.features.nether.reputationhelper.dailyquest.DailyQuestHelper
-import at.hannibal2.skyhanni.features.nether.reputationhelper.dailyquest.quest.UnknownQuest
import at.hannibal2.skyhanni.features.nether.reputationhelper.miniboss.DailyMiniBossHelper
import at.hannibal2.skyhanni.utils.LorenzUtils
+import at.hannibal2.skyhanni.utils.LorenzVec
import at.hannibal2.skyhanni.utils.RenderUtils.renderStringsAndItems
import com.google.gson.JsonObject
import net.minecraftforge.client.event.RenderGameOverlayEvent
@@ -27,7 +27,6 @@ class CrimsonIsleReputationHelper(skyHanniMod: SkyHanniMod) {
private val display = mutableListOf<List<Any>>()
private var dirty = true
- private var loaded = false
init {
skyHanniMod.loadModule(questHelper)
@@ -37,18 +36,12 @@ class CrimsonIsleReputationHelper(skyHanniMod: SkyHanniMod) {
@SubscribeEvent
fun onRepoReload(event: RepositoryReloadEvent) {
- questHelper.quests.removeIf { it is UnknownQuest}
repoData = event.getConstant("CrimsonIsleReputation")!!
- if (!loaded) {
- loaded = true
- miniBossHelper.init()
- kuudraBossHelper.init()
+ miniBossHelper.load()
+ kuudraBossHelper.load()
- questHelper.loadConfig()
- miniBossHelper.loadConfig()
- kuudraBossHelper.loadConfig()
- }
+ questHelper.load()
}
@SubscribeEvent
@@ -99,4 +92,14 @@ class CrimsonIsleReputationHelper(skyHanniMod: SkyHanniMod) {
kuudraBossHelper.reset()
update()
}
+
+ fun readLocationData(data: JsonObject): LorenzVec? {
+ val locationData = data["location"]?.asJsonArray ?: return null
+ if (locationData.size() == 0) return null
+
+ val x = locationData[0].asDouble - 1
+ val y = locationData[1].asDouble
+ val z = locationData[2].asDouble - 1
+ return LorenzVec(x, y, z)
+ }
} \ No newline at end of file
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 73fbac7dd..aff27f79a 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
@@ -24,32 +24,6 @@ class DailyKuudraBossHelper(private val reputationHelper: CrimsonIsleReputationH
private var kuudraLocation: LorenzVec? = null
private var allKuudraDone = true
- fun init() {
- val repoData = reputationHelper.repoData
- val jsonElement = repoData["KUUDRA"]
- var tier = 1
- for ((displayName, extraData) in jsonElement.asJsonObject.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)
- }
- kuudraTiers.add(KuudraTier(displayName, displayItem, location, tier))
- if (location != null) {
- kuudraLocation = location
- }
-
- tier++
- }
- }
-
@SubscribeEvent
fun onRenderWorld(event: RenderWorldLastEvent) {
if (!LorenzUtils.inSkyBlock) return
@@ -128,8 +102,26 @@ class DailyKuudraBossHelper(private val reputationHelper: CrimsonIsleReputationH
.forEach { SkyHanniMod.feature.hidden.crimsonIsleKuudraTiersDone.add(it.name) }
}
- fun loadConfig() {
- println("loadConfig")
+ fun load() {
+ kuudraTiers.clear()
+
+ //Repo
+ val repoData = reputationHelper.repoData
+ val jsonElement = repoData["KUUDRA"]
+ var tier = 1
+ for ((displayName, extraData) in jsonElement.asJsonObject.entrySet()) {
+ val data = extraData.asJsonObject
+ val displayItem = data["item"]?.asString
+ val location = reputationHelper.readLocationData(data)
+ kuudraTiers.add(KuudraTier(displayName, displayItem, location, tier))
+ if (location != null) {
+ kuudraLocation = location
+ }
+
+ tier++
+ }
+
+ //Config
for (name in SkyHanniMod.feature.hidden.crimsonIsleKuudraTiersDone) {
getByDisplayName(name)!!.doneToday = true
}
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 3a72c2f68..d31f29396 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
@@ -302,7 +302,9 @@ class DailyQuestHelper(val reputationHelper: CrimsonIsleReputationHelper) {
latestTrophyFishInInventory = 0
}
- fun loadConfig() {
+ fun load() {
+ reset()
+
loader.loadConfig()
latestTrophyFishInInventory = SkyHanniMod.feature.hidden.crimsonIsleLatestTrophyFishInInventory
}
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 d48d28fd3..e4bba6494 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,13 +5,12 @@ 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
import net.minecraft.inventory.ContainerChest
-class QuestLoader(val dailyQuestHelper: DailyQuestHelper) {
+class QuestLoader(private val dailyQuestHelper: DailyQuestHelper) {
fun loadFromTabList() {
var i = -1
@@ -86,16 +85,7 @@ 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)
- }
-
+ val location = dailyQuestHelper.reputationHelper.readLocationData(data)
if (name.startsWith("$entryName Rank ")) {
val split = name.split(" Rank ")
val dojoName = split[0]
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 17b30087f..3b3bdef44 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
@@ -8,7 +8,6 @@ import at.hannibal2.skyhanni.features.nether.reputationhelper.CrimsonIsleReputat
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
@@ -20,28 +19,6 @@ class DailyMiniBossHelper(private val reputationHelper: CrimsonIsleReputationHel
val miniBosses = mutableListOf<CrimsonMiniBoss>()
- fun init() {
- val repoData = reputationHelper.repoData
- val jsonElement = repoData["MINIBOSS"]
- for ((displayName, extraData) in jsonElement.asJsonObject.entrySet()) {
- val data = extraData.asJsonObject
- val displayItem = data["item"]?.asString
- val patterns = " *§r§6§l${displayName.uppercase()} DOWN!"
-
- 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)))
- }
- }
-
@SubscribeEvent
fun onChat(event: LorenzChatEvent) {
if (!HyPixelData.skyBlock) return
@@ -113,7 +90,21 @@ class DailyMiniBossHelper(private val reputationHelper: CrimsonIsleReputationHel
.forEach { SkyHanniMod.feature.hidden.crimsonIsleMiniBossesDoneToday.add(it.displayName) }
}
- fun loadConfig() {
+ fun load() {
+ miniBosses.clear()
+
+ //Repo
+ val repoData = reputationHelper.repoData
+ val jsonElement = repoData["MINIBOSS"]
+ for ((displayName, extraData) in jsonElement.asJsonObject.entrySet()) {
+ val data = extraData.asJsonObject
+ val displayItem = data["item"]?.asString
+ val patterns = " *§r§6§l${displayName.uppercase()} DOWN!"
+ val location = reputationHelper.readLocationData(data)
+ miniBosses.add(CrimsonMiniBoss(displayName, displayItem, location, Pattern.compile(patterns)))
+ }
+
+ //Config
for (name in SkyHanniMod.feature.hidden.crimsonIsleMiniBossesDoneToday) {
getByDisplayName(name)!!.doneToday = true
}