aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features/misc
diff options
context:
space:
mode:
authorNetheriteMiner <88792142+NetheriteMiner@users.noreply.github.com>2023-09-26 04:10:19 -0400
committerGitHub <noreply@github.com>2023-09-26 10:10:19 +0200
commit2b2c1cc43c08874a82123356adc7af24cfe09227 (patch)
treedbf6986ff16f16c1ee3946aa21b624db8813cb85 /src/main/java/at/hannibal2/skyhanni/features/misc
parent0ecab5ab4f94dce8b4b01bdad5d4b03a590e8345 (diff)
downloadskyhanni-2b2c1cc43c08874a82123356adc7af24cfe09227.tar.gz
skyhanni-2b2c1cc43c08874a82123356adc7af24cfe09227.tar.bz2
skyhanni-2b2c1cc43c08874a82123356adc7af24cfe09227.zip
Rich Presence Dynamic Priority Box and Dungeons #429
* Rich Presence Dynamic Priority Box and Dungeons * Merge branch 'beta' into discordrpc * Merge branch 'beta' into discordrpc * code cleanup * Fix according to requested changes * I blame IntelliJ auto formatting * Merge branch 'beta' into discordrpc * resolve merge conflict
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/misc')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/ParticleHider.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordStatus.kt56
2 files changed, 42 insertions, 18 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/ParticleHider.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/ParticleHider.kt
index 74d33cbd9..4b177722d 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/ParticleHider.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/ParticleHider.kt
@@ -2,7 +2,7 @@ package at.hannibal2.skyhanni.features.misc
import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.events.ReceiveParticleEvent
-import at.hannibal2.skyhanni.features.dungeon.DungeonData
+import at.hannibal2.skyhanni.features.dungeon.DungeonAPI
import at.hannibal2.skyhanni.utils.EntityUtils
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.getLorenzVec
@@ -12,7 +12,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
class ParticleHider {
- private fun inM7Boss() = LorenzUtils.inDungeons && DungeonData.dungeonFloor == "M7" && DungeonData.inBossRoom
+ private fun inM7Boss() = LorenzUtils.inDungeons && DungeonAPI.dungeonFloor == "M7" && DungeonAPI.inBossRoom
@SubscribeEvent
fun onHypExplosions(event: ReceiveParticleEvent) {
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordStatus.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordStatus.kt
index 9b1c920bd..69574b486 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordStatus.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordStatus.kt
@@ -6,12 +6,17 @@ import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.data.*
import at.hannibal2.skyhanni.data.GardenCropMilestones.getCounter
import at.hannibal2.skyhanni.data.GardenCropMilestones.getTierForCropCount
+import at.hannibal2.skyhanni.data.GardenCropMilestones.isMaxed
import at.hannibal2.skyhanni.data.GardenCropMilestones.progressToNextLevel
+import at.hannibal2.skyhanni.features.dungeon.DungeonAPI
+import at.hannibal2.skyhanni.features.dungeon.DungeonAPI.DungeonFloor
+import at.hannibal2.skyhanni.features.dungeon.DungeonAPI.DungeonFloor.Companion.toBoss
import at.hannibal2.skyhanni.features.garden.GardenAPI.getCropType
import at.hannibal2.skyhanni.features.rift.RiftAPI
import at.hannibal2.skyhanni.utils.InventoryUtils
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.LorenzUtils.colorCodeToRarity
+import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators
import at.hannibal2.skyhanni.utils.StringUtils.firstLetterUppercase
import at.hannibal2.skyhanni.utils.StringUtils.removeColor
import at.hannibal2.skyhanni.utils.TabListData.Companion.getTabList
@@ -235,7 +240,7 @@ enum class DiscordStatus(private val displayMessageSupplier: Supplier<String>?)
else if (noColorLine == "Boss slain!") bossAlive = "slain"
}
- if (slayerLevel == "") "Planning to do a slayer quest"// selected slayer in rpc but hasn't started a quest
+ if (slayerLevel == "") AutoStatus.SLAYER.placeholderText // selected slayer in rpc but hasn't started a quest
else if (bossAlive == "spawning") "Spawning a $slayerName $slayerLevel boss."
else if (bossAlive == "slaying") "Slaying a $slayerName $slayerLevel boss."
else if (bossAlive == "slain") "Finished slaying a $slayerName $slayerLevel boss."
@@ -247,17 +252,22 @@ enum class DiscordStatus(private val displayMessageSupplier: Supplier<String>?)
}),
AUTO({
- val slayerResult = SLAYER.displayMessageSupplier!!.get()
- val stackingResult = STACKING.displayMessageSupplier!!.get()
- val milestoneResult = CROP_MILESTONES.displayMessageSupplier!!.get()
- if (slayerResult != "Planning to do a slayer quest") slayerResult
- else if (milestoneResult != "Not farming!") milestoneResult
- else if (stackingResult != "") stackingResult
- else {
- val statusNoAuto = entries.toMutableList()
+ var autoReturn = ""
+ for (statusID in SkyHanniMod.feature.misc.discordRPC.autoPriority) { // for every dynamic that the user wants to see...
+ val autoStatus = AutoStatus.entries[statusID]
+ val result =
+ autoStatus.correspondingDiscordStatus.getDisplayString() // get what would happen if we were to display it
+ if (result != autoStatus.placeholderText) { // if that value is useful, display it
+ autoReturn = result
+ break
+ }
+ }
+ if (autoReturn == "") { // if we didn't find any useful information, display the fallback
+ val statusNoAuto = DiscordStatus.entries.toMutableList()
statusNoAuto.remove(AUTO)
- statusNoAuto[SkyHanniMod.feature.misc.discordRPC.auto.get()].getDisplayString()
+ autoReturn = statusNoAuto[SkyHanniMod.feature.misc.discordRPC.auto.get()].getDisplayString()
}
+ autoReturn
}),
CROP_MILESTONES({
@@ -270,10 +280,8 @@ enum class DiscordStatus(private val displayMessageSupplier: Supplier<String>?)
} ?: 100 // percentage to next milestone
if (tier != null) {
- "${crop.cropName}: Milestone $tier ($progress)"
- } else {
- "Not farming!"
- }
+ "${crop.cropName}: ${if (!crop.isMaxed()) "Milestone $tier ($progress)" else "MAXED (${cropCounter.addSeparators()} crops collected"})"
+ } else AutoStatus.CROP_MILESTONES.placeholderText
}),
PETS({
@@ -319,7 +327,7 @@ enum class DiscordStatus(private val displayMessageSupplier: Supplier<String>?)
return percent
}
- var stackingReturn = ""
+ var stackingReturn = AutoStatus.STACKING.placeholderText
if (extraAttributes != null) {
val enchantments = extraAttributes.getCompoundTag("enchantments")
var stackingEnchant = ""
@@ -335,11 +343,20 @@ enum class DiscordStatus(private val displayMessageSupplier: Supplier<String>?)
val stackingPercent = getProgressPercent(amount, levels)
stackingReturn =
- if (stackingPercent == "" || amount == 0) "" // outdated info is useless for AUTO; empty strings are manually ignored
+ if (stackingPercent == "" || amount == 0) AutoStatus.STACKING.placeholderText // outdated info is useless for AUTO
else "$itemName: ${stackingEnchant.firstLetterUppercase()} $level ($stackingPercent)" // Hecatomb 100: (55.55%)
}
stackingReturn
+ }),
+
+ DUNGEONS({
+ val floor = DungeonAPI.getFloor() ?: -1 // -1 if not in dungeons/failed to find a floor
+ val boss: DungeonFloor? = if (floor != -1) floor.toBoss() else null
+ if (floor == -1) AutoStatus.DUNGEONS.placeholderText
+ else if (boss == null) "Unknown boss"
+ else "$boss Kills: ${DungeonAPI.bossStorage?.get(boss) ?: "Unknown"} (${DungeonAPI.getTime()})"
+
})
;
@@ -350,3 +367,10 @@ enum class DiscordStatus(private val displayMessageSupplier: Supplier<String>?)
return ""
}
}
+
+enum class AutoStatus(val placeholderText: String, val correspondingDiscordStatus: DiscordStatus) {
+ CROP_MILESTONES("Not farming!", DiscordStatus.CROP_MILESTONES),
+ SLAYER("Planning to do a slayer quest", DiscordStatus.SLAYER),
+ STACKING("Stacking placeholder (should never be visible)", DiscordStatus.STACKING),
+ DUNGEONS("Dungeons placeholder (should never be visible)", DiscordStatus.DUNGEONS);
+} \ No newline at end of file