aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/Hidden.java3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/CrimsonIsleReputationHelper.kt9
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailykuudra/DailyKuudraBossHelper.kt91
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailykuudra/KuudraTier.kt5
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/DailyQuestHelper.kt22
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/QuestLoader.kt6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/quest/KuudraQuest.kt6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/quest/QuestCategory.kt1
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/miniboss/CrimsonMiniBoss.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/miniboss/DailyMiniBossHelper.kt21
10 files changed, 139 insertions, 27 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/Hidden.java b/src/main/java/at/hannibal2/skyhanni/config/features/Hidden.java
index 7a26ace3b..dbe5d61b1 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/Hidden.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/Hidden.java
@@ -29,4 +29,7 @@ public class Hidden {
@Expose
public List<String> crimsonIsleMiniBossesDoneToday = new ArrayList<>();
+
+ @Expose
+ public List<String> crimsonIsleKuudraTiersDone = new ArrayList<>();
}
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 5e2af04ca..5e7f06aac 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
@@ -4,6 +4,7 @@ import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.data.HyPixelData
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
@@ -19,6 +20,7 @@ class CrimsonIsleReputationHelper(skyHanniMod: SkyHanniMod) {
val questHelper = DailyQuestHelper(this)
val miniBossHelper = DailyMiniBossHelper(this)
+ val kuudraBossHelper = DailyKuudraBossHelper(this)
var repoData: JsonObject = JsonObject()
@@ -29,6 +31,7 @@ class CrimsonIsleReputationHelper(skyHanniMod: SkyHanniMod) {
init {
skyHanniMod.loadModule(questHelper)
skyHanniMod.loadModule(miniBossHelper)
+ skyHanniMod.loadModule(kuudraBossHelper)
}
@SubscribeEvent
@@ -39,9 +42,11 @@ class CrimsonIsleReputationHelper(skyHanniMod: SkyHanniMod) {
loaded = true
miniBossHelper.init()
+ kuudraBossHelper.init()
questHelper.loadConfig()
miniBossHelper.loadConfig()
+ kuudraBossHelper.loadConfig()
}
}
@@ -62,6 +67,8 @@ class CrimsonIsleReputationHelper(skyHanniMod: SkyHanniMod) {
display.add("Reputation Helper:")
questHelper.render(display)
miniBossHelper.render(display)
+ //TODO check if mage
+ kuudraBossHelper.render(display)
}
@SubscribeEvent(priority = EventPriority.LOWEST)
@@ -80,6 +87,7 @@ class CrimsonIsleReputationHelper(skyHanniMod: SkyHanniMod) {
questHelper.saveConfig()
miniBossHelper.saveConfig()
+ kuudraBossHelper.saveConfig()
}
fun reset() {
@@ -87,6 +95,7 @@ class CrimsonIsleReputationHelper(skyHanniMod: SkyHanniMod) {
questHelper.reset()
miniBossHelper.reset()
+ kuudraBossHelper.reset()
update()
}
} \ 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
new file mode 100644
index 000000000..3fb4c38fb
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailykuudra/DailyKuudraBossHelper.kt
@@ -0,0 +1,91 @@
+package at.hannibal2.skyhanni.features.nether.reputationhelper.dailykuudra
+
+import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.data.HyPixelData
+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.utils.LorenzUtils
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+import java.util.regex.Pattern
+
+class DailyKuudraBossHelper(private val reputationHelper: CrimsonIsleReputationHelper) {
+ val kuudraTiers = mutableListOf<KuudraTier>()
+ private val pattern = Pattern.compile(" Kuudra's Hollow \\(T(.*)\\)")
+
+ fun init() {
+ val repoData = reputationHelper.repoData
+ val jsonElement = repoData["KUUDRA"]
+ val asJsonArray = jsonElement.asJsonArray
+ var tier = 1
+ for (entry in asJsonArray) {
+ val displayName = entry.asString
+ kuudraTiers.add(KuudraTier(displayName, tier))
+ tier++
+ }
+ }
+
+ @SubscribeEvent
+ fun onChat(event: LorenzChatEvent) {
+ if (!HyPixelData.skyBlock) return
+ if (LorenzUtils.skyBlockIsland != IslandType.KUUDRA_ARENA) return
+ if (!SkyHanniMod.feature.misc.crimsonIsleReputationHelper) return
+
+ val message = event.message
+ if (message != " §r§6§lKUUDRA DOWN!") return
+
+ for (line in ScoreboardData.sidebarLines) {
+ val matcher = pattern.matcher(line)
+ if (matcher.matches()) {
+ val tier = matcher.group(1).toInt()
+ val kuudraTier = getByTier(tier)!!
+ finished(kuudraTier)
+ return
+ }
+ }
+ }
+
+ private fun finished(kuudraTier: KuudraTier) {
+ LorenzUtils.debug("Detected kuudra tier done: $kuudraTier")
+ reputationHelper.questHelper.finishKuudra(kuudraTier)
+ kuudraTier.doneToday = true
+ reputationHelper.update()
+ }
+
+ fun render(display: MutableList<String>) {
+ val done = kuudraTiers.count { it.doneToday }
+ display.add("")
+ display.add("Daily Kuudra ($done/2 killed)")
+ if (done != 2) {
+ for (tier in kuudraTiers) {
+ val result = if (tier.doneToday) "§7Done" else "§bTodo"
+ val displayName = tier.getDisplayName()
+ display.add(" $displayName: $result")
+ }
+ }
+ }
+
+ fun reset() {
+ for (miniBoss in kuudraTiers) {
+ miniBoss.doneToday = false
+ }
+ }
+
+ fun saveConfig() {
+ SkyHanniMod.feature.hidden.crimsonIsleKuudraTiersDone.clear()
+
+ kuudraTiers.filter { it.doneToday }
+ .forEach { SkyHanniMod.feature.hidden.crimsonIsleKuudraTiersDone.add(it.name) }
+ }
+
+ fun loadConfig() {
+ for (name in SkyHanniMod.feature.hidden.crimsonIsleKuudraTiersDone) {
+ getByDisplayName(name)!!.doneToday = true
+ }
+ }
+
+ private fun getByDisplayName(name: String) = kuudraTiers.firstOrNull { it.name == name }
+
+ private fun getByTier(number: Int) = kuudraTiers.firstOrNull { it.tierNumber == number }
+} \ No newline at end of file
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
new file mode 100644
index 000000000..88d9e1e78
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailykuudra/KuudraTier.kt
@@ -0,0 +1,5 @@
+package at.hannibal2.skyhanni.features.nether.reputationhelper.dailykuudra
+
+class KuudraTier(val name: String, 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 32dfbe991..dfe8eb3a3 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
@@ -7,6 +7,7 @@ import at.hannibal2.skyhanni.events.GuiContainerEvent
import at.hannibal2.skyhanni.events.LorenzChatEvent
import at.hannibal2.skyhanni.events.ProfileApiDataLoadedEvent
import at.hannibal2.skyhanni.features.nether.reputationhelper.CrimsonIsleReputationHelper
+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.utils.InventoryUtils.getInventoryName
@@ -202,19 +203,10 @@ class DailyQuestHelper(val reputationHelper: CrimsonIsleReputationHelper) {
fun render(display: MutableList<String>) {
val done = quests.count { it.state == QuestState.COLLECTED }
-// val sneaking = Minecraft.getMinecraft().thePlayer.isSneaking
-// if (done != 5 || sneaking) {
display.add("")
display.add("Daily Quests ($done/5 collected)")
if (done != 5) {
- for (quest in quests) {
-// if (!sneaking) {
-// if (quest.state == QuestState.COLLECTED) {
-// continue
-// }
-// }
- display.add(" " + renderQuest(quest))
- }
+ quests.mapTo(display) { " " + renderQuest(it) }
}
}
@@ -265,6 +257,16 @@ class DailyQuestHelper(val reputationHelper: CrimsonIsleReputationHelper) {
}
}
+ fun finishKuudra(kuudraTier: KuudraTier) {
+ val kuudraQuest = getQuest<KuudraQuest>() ?: return
+ if (kuudraQuest.kuudraTier == kuudraTier) {
+ //TODO make inline method for this two lines
+ if (kuudraQuest.state == QuestState.ACCEPTED) {
+ kuudraQuest.state = QuestState.READY_TO_COLLECT
+ }
+ }
+ }
+
fun reset() {
quests.clear()
latestTrophyFishInInventory = 0
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 6a3fd894b..055823fa7 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
@@ -72,6 +72,12 @@ class QuestLoader(val dailyQuestHelper: DailyQuestHelper) {
return MiniBossQuest(miniBoss, state, needAmount)
}
}
+ for (kuudraTier in dailyQuestHelper.reputationHelper.kuudraBossHelper.kuudraTiers) {
+ val kuudraName = kuudraTier.name
+ if (name == "Kill Kuudra $kuudraName Tier") {
+ return KuudraQuest(kuudraTier, state)
+ }
+ }
for (entry in dailyQuestHelper.reputationHelper.repoData.entrySet()) {
val category = entry.key
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
new file mode 100644
index 000000000..3ef08e400
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/quest/KuudraQuest.kt
@@ -0,0 +1,6 @@
+package at.hannibal2.skyhanni.features.nether.reputationhelper.dailyquest.quest
+
+import at.hannibal2.skyhanni.features.nether.reputationhelper.dailykuudra.KuudraTier
+
+class KuudraQuest(val kuudraTier: KuudraTier, state: QuestState) :
+ Quest(QuestCategory.KUUDRA, "Kill Kuudra ${kuudraTier.name} Tier", state, displayName = kuudraTier.getDisplayName()) \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/quest/QuestCategory.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/quest/QuestCategory.kt
index 933c5c007..6cef4782a 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/quest/QuestCategory.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/quest/QuestCategory.kt
@@ -6,6 +6,7 @@ enum class QuestCategory(val displayName: String) {
MINIBOSS("Mini Boss"),
FETCH("Item Fetch"),
DOJO("Dojo Task"),
+ KUUDRA("Kuudra Kill"),
UNKNOWN("§cUnknown"),
} \ 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 d8ea3bd2e..a9d4fb871 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
@@ -2,4 +2,4 @@ package at.hannibal2.skyhanni.features.nether.reputationhelper.miniboss
import java.util.regex.Pattern
-class CrimsonMiniBoss(val displayName: String, val pattern: Pattern, var doneToday: Boolean = false, ) \ No newline at end of file
+class CrimsonMiniBoss(val displayName: String, 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 b959c3776..051a428df 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
@@ -14,8 +14,6 @@ class DailyMiniBossHelper(private val reputationHelper: CrimsonIsleReputationHel
val miniBosses = mutableListOf<CrimsonMiniBoss>()
fun init() {
- if (miniBosses.isNotEmpty()) return
-
val repoData = reputationHelper.repoData
val jsonElement = repoData["MINIBOSS"]
val asJsonArray = jsonElement.asJsonArray
@@ -49,23 +47,17 @@ class DailyMiniBossHelper(private val reputationHelper: CrimsonIsleReputationHel
fun render(display: MutableList<String>) {
val done = miniBosses.count { it.doneToday }
-// val sneaking = Minecraft.getMinecraft().thePlayer.isSneaking
-// if (done != 5 || sneaking) {
display.add("")
display.add("Daily Bosses ($done/5 killed)")
if (done != 5) {
for (miniBoss in miniBosses) {
- display.add(" " + renderBoss(miniBoss))
+ val result = if (miniBoss.doneToday) "§7Done" else "§bTodo"
+ val displayName = miniBoss.displayName
+ display.add(" $displayName: $result")
}
}
}
- private fun renderBoss(miniBoss: CrimsonMiniBoss): String {
- val color = if (miniBoss.doneToday) "§7Done" else "§bTodo"
- val displayName = miniBoss.displayName
- return "$displayName: $color"
- }
-
fun reset() {
for (miniBoss in miniBosses) {
miniBoss.doneToday = false
@@ -75,11 +67,8 @@ class DailyMiniBossHelper(private val reputationHelper: CrimsonIsleReputationHel
fun saveConfig() {
SkyHanniMod.feature.hidden.crimsonIsleMiniBossesDoneToday.clear()
- for (miniBoss in miniBosses) {
- if (miniBoss.doneToday) {
- SkyHanniMod.feature.hidden.crimsonIsleMiniBossesDoneToday.add(miniBoss.displayName)
- }
- }
+ miniBosses.filter { it.doneToday }
+ .forEach { SkyHanniMod.feature.hidden.crimsonIsleMiniBossesDoneToday.add(it.displayName) }
}
fun loadConfig() {