aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-10-11 12:28:07 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-10-11 12:28:07 +0200
commit8ccfdc9b7d22352c23d4bff5ee240fa71e302262 (patch)
treea11139ca4bdfba81fcc538ea76424fe66ca1b409
parent4f9fe89aac7b97741f7079ab1ad5f7051e0fa7f7 (diff)
downloadskyhanni-8ccfdc9b7d22352c23d4bff5ee240fa71e302262.tar.gz
skyhanni-8ccfdc9b7d22352c23d4bff5ee240fa71e302262.tar.bz2
skyhanni-8ccfdc9b7d22352c23d4bff5ee240fa71e302262.zip
code cleanup
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FFGuideGUI.kt94
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FFStats.kt17
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/pages/OverviewPage.kt8
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/TpsCounter.kt15
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordStatus.kt38
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/ghostcounter/GhostUtil.kt56
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/DanceRoomHelper.kt25
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/slayer/VampireSlayerFeatures.kt16
-rw-r--r--src/main/java/at/hannibal2/skyhanni/test/SkyHanniConfigSearchResetCommand.kt7
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/CombatUtils.kt5
10 files changed, 145 insertions, 136 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FFGuideGUI.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FFGuideGUI.kt
index fc3ad61d3..65c6c54b2 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FFGuideGUI.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FFGuideGUI.kt
@@ -217,7 +217,7 @@ open class FFGuideGUI : GuiScreen() {
fun mouseClickEvent() {
var x = guiLeft + 15
var y = guiTop - 28
- if (GuiRenderUtils.isPointInRect(mouseX, mouseY, x, y, 25, 28)) {
+ if (isMouseIn(x, y, 25, 28)) {
SoundUtils.playClickSound()
if (currentCrop != null) {
currentCrop = null
@@ -234,7 +234,7 @@ open class FFGuideGUI : GuiScreen() {
}
for (crop in CropType.entries) {
x += 30
- if (GuiRenderUtils.isPointInRect(mouseX, mouseY, x, y, 25, 28)) {
+ if (isMouseIn(x, y, 25, 28)) {
SoundUtils.playClickSound()
if (currentCrop != crop) {
currentCrop = crop
@@ -269,102 +269,109 @@ open class FFGuideGUI : GuiScreen() {
x = guiLeft - 28
y = guiTop + 15
- if (GuiRenderUtils.isPointInRect(mouseX, mouseY, x, y, 28, 25) && selectedPage != FortuneGuidePage.CROP && selectedPage != FortuneGuidePage.OVERVIEW) {
- SoundUtils.playClickSound()
- selectedPage = if (currentCrop == null) {
- FortuneGuidePage.OVERVIEW
- } else {
- FortuneGuidePage.CROP
- }
+ if (isMouseIn(x, y, 28, 25) &&
+ selectedPage != FortuneGuidePage.CROP && selectedPage != FortuneGuidePage.OVERVIEW) {
+ SoundUtils.playClickSound()
+ selectedPage = if (currentCrop == null) {
+ FortuneGuidePage.OVERVIEW
+ } else {
+ FortuneGuidePage.CROP
+ }
}
y += 30
- if (GuiRenderUtils.isPointInRect(mouseX, mouseY, x, y, 28, 25) && selectedPage != FortuneGuidePage.UPGRADES) {
- selectedPage = FortuneGuidePage.UPGRADES
- SoundUtils.playClickSound()
+ if (isMouseIn(x, y, 28, 25) && selectedPage != FortuneGuidePage.UPGRADES) {
+ selectedPage = FortuneGuidePage.UPGRADES
+ SoundUtils.playClickSound()
}
if (selectedPage != FortuneGuidePage.UPGRADES) {
if (currentCrop == null) {
when {
- GuiRenderUtils.isPointInRect(mouseX, mouseY, guiLeft + 142, guiTop + 130, 16, 16) &&
- currentPet != FarmingItems.ELEPHANT -> {
+ isMouseInRect(guiLeft + 142, guiTop + 130) && currentPet != FarmingItems.ELEPHANT -> {
SoundUtils.playClickSound()
currentPet = FarmingItems.ELEPHANT
FFStats.getTotalFF()
}
- GuiRenderUtils.isPointInRect(mouseX, mouseY, guiLeft + 162, guiTop + 130, 16, 16) &&
- currentPet != FarmingItems.MOOSHROOM_COW -> {
+
+ isMouseInRect(guiLeft + 162, guiTop + 130) && currentPet != FarmingItems.MOOSHROOM_COW -> {
SoundUtils.playClickSound()
currentPet = FarmingItems.MOOSHROOM_COW
FFStats.getTotalFF()
}
- GuiRenderUtils.isPointInRect(mouseX, mouseY, guiLeft + 182, guiTop + 130, 16, 16) &&
- currentPet != FarmingItems.RABBIT -> {
+
+ isMouseInRect(guiLeft + 182, guiTop + 130) && currentPet != FarmingItems.RABBIT -> {
SoundUtils.playClickSound()
currentPet = FarmingItems.RABBIT
FFStats.getTotalFF()
}
- GuiRenderUtils.isPointInRect(mouseX, mouseY, guiLeft + 202, guiTop + 130, 16, 16) &&
- currentPet != FarmingItems.BEE -> {
+
+ isMouseInRect(guiLeft + 202, guiTop + 130) && currentPet != FarmingItems.BEE -> {
SoundUtils.playClickSound()
currentPet = FarmingItems.BEE
FFStats.getTotalFF()
}
- GuiRenderUtils.isPointInRect(mouseX, mouseY, guiLeft + 142, guiTop + 5, 16, 16) -> {
+
+ isMouseInRect(guiLeft + 142, guiTop + 5) -> {
SoundUtils.playClickSound()
currentArmor = if (currentArmor == 1) 0 else 1
}
- GuiRenderUtils.isPointInRect(mouseX, mouseY, guiLeft + 162, guiTop + 5, 16, 16) -> {
+
+ isMouseInRect(guiLeft + 162, guiTop + 5) -> {
SoundUtils.playClickSound()
currentArmor = if (currentArmor == 2) 0 else 2
}
- GuiRenderUtils.isPointInRect(mouseX, mouseY, guiLeft + 182, guiTop + 5, 16, 16) -> {
+
+ isMouseInRect(guiLeft + 182, guiTop + 5) -> {
SoundUtils.playClickSound()
currentArmor = if (currentArmor == 3) 0 else 3
}
- GuiRenderUtils.isPointInRect(mouseX, mouseY, guiLeft + 202, guiTop + 5, 16, 16) -> {
+
+ isMouseInRect(guiLeft + 202, guiTop + 5) -> {
SoundUtils.playClickSound()
currentArmor = if (currentArmor == 4) 0 else 4
}
- GuiRenderUtils.isPointInRect(mouseX, mouseY, guiLeft + 262, guiTop + 5, 16, 16) -> {
+
+ isMouseInRect(guiLeft + 262, guiTop + 5) -> {
SoundUtils.playClickSound()
currentEquipment = if (currentEquipment == 1) 0 else 1
}
- GuiRenderUtils.isPointInRect(mouseX, mouseY, guiLeft + 282, guiTop + 5, 16, 16) -> {
+
+ isMouseInRect(guiLeft + 282, guiTop + 5) -> {
SoundUtils.playClickSound()
currentEquipment = if (currentEquipment == 2) 0 else 2
}
- GuiRenderUtils.isPointInRect(mouseX, mouseY, guiLeft + 302, guiTop + 5, 16, 16) -> {
+
+ isMouseInRect(guiLeft + 302, guiTop + 5) -> {
SoundUtils.playClickSound()
currentEquipment = if (currentEquipment == 3) 0 else 3
}
- GuiRenderUtils.isPointInRect(mouseX, mouseY, guiLeft + 322, guiTop + 5, 16, 16) -> {
+
+ isMouseInRect(guiLeft + 322, guiTop + 5) -> {
SoundUtils.playClickSound()
currentEquipment = if (currentEquipment == 4) 0 else 4
}
}
} else {
when {
- GuiRenderUtils.isPointInRect(mouseX, mouseY, guiLeft + 142, guiTop + 160, 16, 16) &&
- currentPet != FarmingItems.ELEPHANT -> {
+ isMouseInRect(guiLeft + 142, guiTop + 160) && currentPet != FarmingItems.ELEPHANT -> {
SoundUtils.playClickSound()
currentPet = FarmingItems.ELEPHANT
FFStats.getTotalFF()
}
- GuiRenderUtils.isPointInRect(mouseX, mouseY, guiLeft + 162, guiTop + 160, 16, 16) &&
- currentPet != FarmingItems.MOOSHROOM_COW -> {
+
+ isMouseInRect(guiLeft + 162, guiTop + 160) && currentPet != FarmingItems.MOOSHROOM_COW -> {
SoundUtils.playClickSound()
currentPet = FarmingItems.MOOSHROOM_COW
FFStats.getTotalFF()
}
- GuiRenderUtils.isPointInRect(mouseX, mouseY, guiLeft + 182, guiTop + 160, 16, 16) &&
- currentPet != FarmingItems.RABBIT -> {
+
+ isMouseInRect(guiLeft + 182, guiTop + 160) && currentPet != FarmingItems.RABBIT -> {
SoundUtils.playClickSound()
currentPet = FarmingItems.RABBIT
FFStats.getTotalFF()
}
- GuiRenderUtils.isPointInRect(mouseX, mouseY, guiLeft + 202, guiTop + 160, 16, 16) &&
- currentPet != FarmingItems.BEE -> {
+
+ isMouseInRect(guiLeft + 202, guiTop + 160) && currentPet != FarmingItems.BEE -> {
SoundUtils.playClickSound()
currentPet = FarmingItems.BEE
FFStats.getTotalFF()
@@ -372,12 +379,17 @@ open class FFGuideGUI : GuiScreen() {
}
}
} else {
- if (GuiRenderUtils.isPointInRect(mouseX, mouseY, guiLeft, guiTop, sizeX, sizeY)) {
+ if (isMouseIn(guiLeft, guiTop, sizeX, sizeY)) {
lastClickedHeight = mouseY
}
}
}
+ private fun isMouseInRect(left: Int, top: Int) = isMouseIn(left, top, 16, 16)
+
+ private fun isMouseIn(x: Int, y: Int, width: Int, height: Int) =
+ GuiRenderUtils.isPointInRect(mouseX, mouseY, x, y, width, height)
+
private fun renderTabs() {
var x = guiLeft + 15
var y = guiTop - 28
@@ -385,7 +397,7 @@ open class FFGuideGUI : GuiScreen() {
val notSelectedColor = 0x50303030
drawRect(x, y, x + 25, y + 28, if (currentCrop == null) selectedColor else notSelectedColor)
GuiRenderUtils.renderItemStack(ItemStack(Blocks.grass), x + 5, y + 5)
- if (GuiRenderUtils.isPointInRect(mouseX, mouseY, x, y, 25, 28)) {
+ if (isMouseIn(x, y, 25, 28)) {
tooltipToDisplay.add("§eOverview")
}
@@ -393,7 +405,7 @@ open class FFGuideGUI : GuiScreen() {
x += 30
drawRect(x, y, x + 25, y + 28, if (currentCrop == crop) selectedColor else notSelectedColor)
GuiRenderUtils.renderItemStack(crop.icon, x + 5, y + 5)
- if (GuiRenderUtils.isPointInRect(mouseX, mouseY, x, y, 25, 28)) {
+ if (isMouseIn(x, y, 25, 28)) {
tooltipToDisplay.add("§e${crop.cropName}")
}
}
@@ -407,7 +419,7 @@ open class FFGuideGUI : GuiScreen() {
if (selectedPage != FortuneGuidePage.UPGRADES) selectedColor else notSelectedColor
)
GuiRenderUtils.renderItemStack(ItemStack(Items.gold_ingot), x + 5, y + 5)
- if (GuiRenderUtils.isPointInRect(mouseX, mouseY, x, y, 28, 25)) {
+ if (isMouseIn(x, y, 28, 25)) {
tooltipToDisplay.add("§eBreakdown")
}
y += 30
@@ -417,7 +429,7 @@ open class FFGuideGUI : GuiScreen() {
if (selectedPage == FortuneGuidePage.UPGRADES) selectedColor else notSelectedColor
)
GuiRenderUtils.renderItemStack(ItemStack(Items.map), x + 5, y + 5)
- if (GuiRenderUtils.isPointInRect(mouseX, mouseY, x, y, 28, 25)) {
+ if (isMouseIn(x, y, 28, 25)) {
tooltipToDisplay.add("§eUpgrades")
}
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FFStats.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FFStats.kt
index 61a777a63..d37d94920 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FFStats.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FFStats.kt
@@ -245,21 +245,14 @@ object FFStats {
if (strength != null) {
val rawInternalName = pet.getInternalName()
return when {
- rawInternalName.contains("ELEPHANT;4") -> {
- 1.5 * petLevel
- }
+ rawInternalName.contains("ELEPHANT;4") -> 1.5 * petLevel
rawInternalName.contains("MOOSHROOM_COW;4") -> {
(10 + petLevel).toDouble() + floor(floor(strength / (40 - petLevel * .2)) * .7)
}
- rawInternalName.contains("MOOSHROOM") -> {
- (10 + petLevel).toDouble()
- }
- rawInternalName.contains("BEE;2") -> {
- 0.2 * petLevel
- }
- rawInternalName.contains("BEE;3") || rawInternalName.contains("BEE;4") -> {
- 0.3 * petLevel
- }
+
+ rawInternalName.contains("MOOSHROOM") -> (10 + petLevel).toDouble()
+ rawInternalName.contains("BEE;2") -> 0.2 * petLevel
+ rawInternalName.contains("BEE;3") || rawInternalName.contains("BEE;4") -> 0.3 * petLevel
else -> 0.0
}
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/pages/OverviewPage.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/pages/OverviewPage.kt
index 2e785ea89..4e06ee1cb 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/pages/OverviewPage.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/pages/OverviewPage.kt
@@ -92,15 +92,11 @@ class OverviewPage: FFGuideGUI.FFGuidePage() {
line = if (currentArmor == 0) "§7§2The base fortune from your armor\n§2Select a piece for more info"
else "§7§2Base fortune from your\n${armorItem.getItem().displayName}"
value = when (currentArmor) {
- 0 -> {
- if (FFStats.usingSpeedBoots) 160 else 130
- }
+ 0 -> if (FFStats.usingSpeedBoots) 160 else 130
1 -> 30
2 -> 35
3 -> 35
- else -> {
- if (FFStats.usingSpeedBoots) 60 else 30
- }
+ else -> if (FFStats.usingSpeedBoots) 60 else 30
}
GuiRenderUtils.drawFarmingBar("§2Base $word Fortune", line, armorFF[FFTypes.BASE] ?: 0,
value, FFGuideGUI.guiLeft + 135,
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/TpsCounter.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/TpsCounter.kt
index 5fa005021..8cf4f8044 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/TpsCounter.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/TpsCounter.kt
@@ -97,13 +97,12 @@ class TpsCounter {
event.move(2, "misc.tpsDisplayPosition", "gui.tpsDisplayPosition")
}
- private fun getColor(tps: Double): String {
- return when {
- tps > 19.8 -> "§2"
- tps > 19 -> "§a"
- tps > 17.5 -> "§6"
- tps > 12 -> "§c"
- else -> "§4"
- }
+ private fun getColor(tps: Double) = when {
+ tps > 19.8 -> "§2"
+ tps > 19 -> "§a"
+ tps > 17.5 -> "§6"
+ tps > 12 -> "§c"
+
+ else -> "§4"
}
}
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 9ec187ca8..433f468cb 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
@@ -103,6 +103,7 @@ enum class DiscordStatus(private val displayMessageSupplier: Supplier<String>?)
when {
island == IslandType.PRIVATE_ISLAND_GUEST -> lastKnownDisplayStrings[LOCATION] =
"${getVisitingName()}'s Island"
+
island == IslandType.GARDEN -> {
if (location.startsWith("Plot: ")) {
lastKnownDisplayStrings[LOCATION] = "Personal Garden ($location)" // Personal Garden (Plot: 8)
@@ -110,12 +111,14 @@ enum class DiscordStatus(private val displayMessageSupplier: Supplier<String>?)
lastKnownDisplayStrings[LOCATION] = "Personal Garden"
}
}
+
island == IslandType.GARDEN_GUEST -> {
lastKnownDisplayStrings[LOCATION] = "${getVisitingName()}'s Garden"
if (location.startsWith("Plot: ")) {
lastKnownDisplayStrings[LOCATION] = "${lastKnownDisplayStrings[LOCATION]} ($location)"
} // "MelonKingDe's Garden (Plot: 8)"
}
+
location != "None" && location != "invalid" -> {
lastKnownDisplayStrings[LOCATION] = location
}
@@ -132,19 +135,13 @@ enum class DiscordStatus(private val displayMessageSupplier: Supplier<String>?)
val motes = scoreboard.firstOrNull { motesRegex.matches(it.removeColor()) }?.let {
motesRegex.find(it.removeColor())?.groupValues?.get(1) ?: ""
}
- when {
- coins == "1" -> {
- lastKnownDisplayStrings[PURSE] = "1 Coin"
- }
- coins != "" && coins != null -> {
- lastKnownDisplayStrings[PURSE] = "$coins Coins"
- }
- motes == "1" -> {
- lastKnownDisplayStrings[PURSE] = "1 Mote"
- }
- motes != "" && motes != null -> {
- lastKnownDisplayStrings[PURSE] = "$motes Motes"
- }
+ lastKnownDisplayStrings[PURSE] = when {
+ coins == "1" -> "1 Coin"
+ coins != "" && coins != null -> "$coins Coins"
+ motes == "1" -> "1 Mote"
+ motes != "" && motes != null -> "$motes Motes"
+
+ else -> lastKnownDisplayStrings[PURSE] ?: ""
}
lastKnownDisplayStrings[PURSE] ?: ""
}),
@@ -218,14 +215,12 @@ enum class DiscordStatus(private val displayMessageSupplier: Supplier<String>?)
var profile = "SkyBlock Level: [$sbLevel] on "
- profile += (
- when {
- HypixelData.ironman -> "♲"
- HypixelData.bingo -> "Ⓑ"
- HypixelData.stranded -> "☀"
- else -> ""
- }
- )
+ profile += when {
+ HypixelData.ironman -> "♲"
+ HypixelData.bingo -> "Ⓑ"
+ HypixelData.stranded -> "☀"
+ else -> ""
+ }
val fruit = HypixelData.profileName.firstLetterUppercase()
if (fruit == "") profile =
@@ -251,6 +246,7 @@ enum class DiscordStatus(private val displayMessageSupplier: Supplier<String>?)
slayerName = match.group("name")
slayerLevel = match.group("level")
}
+
noColorLine == "Slay the boss!" -> bossAlive = "slaying"
noColorLine == "Boss slain!" -> bossAlive = "slain"
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/ghostcounter/GhostUtil.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/ghostcounter/GhostUtil.kt
index 365a8db0e..82acce71b 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/ghostcounter/GhostUtil.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/ghostcounter/GhostUtil.kt
@@ -35,18 +35,22 @@ object GhostUtil {
millis < 0 -> {
clear()
}
+
minutes == 0L && hours == 0L && days == 0L -> {
put("seconds", seconds.toString())
}
+
hours == 0L && days == 0L -> {
put("seconds", seconds.toString())
put("minutes", minutes.toString())
}
+
days == 0L -> {
put("seconds", seconds.toString())
put("minutes", minutes.toString())
put("hours", hours.toString())
}
+
else -> {
put("seconds", seconds.toString())
put("minutes", minutes.toString())
@@ -64,7 +68,10 @@ object GhostUtil {
LorenzUtils.chat("§e[SkyHanni] §cYou already imported GhostCounterV3 data!")
return
}
- val json = ConfigManager.gson.fromJson(FileReader(GhostCounter.ghostCounterV3File), com.google.gson.JsonObject::class.java)
+ val json = ConfigManager.gson.fromJson(
+ FileReader(GhostCounter.ghostCounterV3File),
+ com.google.gson.JsonObject::class.java
+ )
GhostData.Option.GHOSTSINCESORROW.add(json["ghostsSinceSorrow"].asDouble)
GhostData.Option.SORROWCOUNT.add(json["sorrowCount"].asDouble)
GhostData.Option.BAGOFCASH.add(json["BagOfCashCount"].asDouble)
@@ -84,32 +91,33 @@ object GhostUtil {
fun String.formatText(option: GhostData.Option) = formatText(option.getInt(), option.getInt(true))
fun String.formatText(value: Int, session: Int = -1) = Utils.chromaStringByColourCode(
- replace("%value%", value.addSeparators())
+ this.replace("%value%", value.addSeparators())
.replace("%session%", session.addSeparators())
.replace("&", "§")
)
- fun String.formatText(t: String): String {
- return Utils.chromaStringByColourCode(this.replace("%value%", t)
- .replace("&", "§"))
- }
+ fun String.formatText(t: String) = Utils.chromaStringByColourCode(this.replace("%value%", t).replace("&", "§"))
- fun String.preFormat(t: String, level: Int, nextLevel: Int): String {
- return if (nextLevel == 26) {
- val lol = Utils.chromaStringByColourCode(this.replace("%value%", t)
- .replace("%display%", "25"))
- lol
- } else {
- Utils.chromaStringByColourCode(this.replace("%value%", t)
- .replace("%display%", "$level->${if (SkyHanniMod.feature.combat.ghostCounter.showMax) "25" else nextLevel}"))
- }
+ fun String.preFormat(t: String, level: Int, nextLevel: Int) = if (nextLevel == 26) {
+ Utils.chromaStringByColourCode(
+ replace("%value%", t)
+ .replace("%display%", "25")
+ )
+ } else {
+ Utils.chromaStringByColourCode(
+ this.replace("%value%", t)
+ .replace(
+ "%display%",
+ "$level->${if (SkyHanniMod.feature.combat.ghostCounter.showMax) "25" else nextLevel}"
+ )
+ )
}
- fun String.formatText(value: Double, session: Double): String {
- return Utils.chromaStringByColourCode(this.replace("%value%", value.roundToPrecision(2).addSeparators())
+ fun String.formatText(value: Double, session: Double) = Utils.chromaStringByColourCode(
+ this.replace("%value%", value.roundToPrecision(2).addSeparators())
.replace("%session%", session.roundToPrecision(2).addSeparators())
- .replace("&", "§"))
- }
+ .replace("&", "§")
+ )
fun String.formatBestiary(currentKill: Int, killNeeded: Int): String {
val bestiaryNextLevel = GhostCounter.hidden?.bestiaryNextLevel
@@ -119,7 +127,10 @@ object GhostUtil {
?: "§cNo Bestiary Level data!"
return Utils.chromaStringByColourCode(
- this.replace("%currentKill%", if (GhostCounter.config.showMax) GhostCounter.bestiaryCurrentKill.addSeparators() else currentKill.addSeparators())
+ this.replace(
+ "%currentKill%",
+ if (GhostCounter.config.showMax) GhostCounter.bestiaryCurrentKill.addSeparators() else currentKill.addSeparators()
+ )
.replace("%percentNumber%", percent(GhostCounter.bestiaryCurrentKill.toDouble()))
.replace("%killNeeded%", NumberUtil.format(killNeeded))
.replace("%currentLevel%", currentLevel)
@@ -128,7 +139,6 @@ object GhostUtil {
)
}
- private fun percent(number: Double): String {
- return 100.0.coerceAtMost(((number / 250_000) * 100).roundToPrecision(4)).toString()
- }
+ private fun percent(number: Double) =
+ 100.0.coerceAtMost(((number / 250_000) * 100).roundToPrecision(4)).toString()
} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/DanceRoomHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/DanceRoomHelper.kt
index d66973cd3..9abad8212 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/DanceRoomHelper.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/DanceRoomHelper.kt
@@ -1,6 +1,5 @@
package at.hannibal2.skyhanni.features.rift.area.mirrorverse
-
import at.hannibal2.skyhanni.events.CheckRenderEntityEvent
import at.hannibal2.skyhanni.events.GuiRenderEvent
import at.hannibal2.skyhanni.events.LorenzTickEvent
@@ -54,16 +53,16 @@ object DanceRoomHelper {
index < size && index == lineIndex -> {
val countdown = countdown?.let { "${color.countdown.formatColor()}$it" } ?: ""
"${now.formatColor()} $format $countdown"
-
}
+
index + 1 < size && index + 1 == lineIndex -> {
"${next.formatColor()} $format"
-
}
+
index + 2 < size && (index + 2..index + config.lineToShow).contains(lineIndex) -> {
"${later.formatColor()} $format"
-
}
+
else -> null
}
}
@@ -73,14 +72,16 @@ object DanceRoomHelper {
private fun String.format() =
split(" ").joinToString(" ") { it.firstLetterUppercase().addColor().replace("&", "§") }
- private fun String.addColor() = when (this) {
- "Move" -> config.danceRoomFormatting.color.move
- "Stand" -> config.danceRoomFormatting.color.stand
- "Sneak" -> config.danceRoomFormatting.color.sneak
- "Jump" -> config.danceRoomFormatting.color.jump
- "Punch" -> config.danceRoomFormatting.color.punch
- else -> config.danceRoomFormatting.color.fallback
- } + this
+ private fun String.addColor() = with(config.danceRoomFormatting.color) {
+ when (this@addColor) {
+ "Move" -> move
+ "Stand" -> stand
+ "Sneak" -> sneak
+ "Jump" -> jump
+ "Punch" -> punch
+ else -> fallback
+ } + this
+ }
@SubscribeEvent
fun onRenderOverlay(event: GuiRenderEvent.GuiOverlayRenderEvent) {
diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/VampireSlayerFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/VampireSlayerFeatures.kt
index 308bebf7a..23aad848c 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/slayer/VampireSlayerFeatures.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/VampireSlayerFeatures.kt
@@ -184,14 +184,14 @@ object VampireSlayerFeatures {
val coopBoss = configCoopBoss.highlight && containCoop && isNPC()
val shouldRender = if (ownBoss) true else if (otherBoss) true else coopBoss
- val color =
- when {
- canUseSteak && config.changeColorWhenCanSteak -> config.steakColor.color()
- ownBoss -> configOwnBoss.highlightColor.color()
- otherBoss -> configOtherBoss.highlightColor.color()
- coopBoss -> configCoopBoss.highlightColor.color()
- else -> 0
- }
+ val color = when {
+ canUseSteak && config.changeColorWhenCanSteak -> config.steakColor.color()
+ ownBoss -> configOwnBoss.highlightColor.color()
+ otherBoss -> configOtherBoss.highlightColor.color()
+ coopBoss -> configCoopBoss.highlightColor.color()
+
+ else -> 0
+ }
val shouldSendSteakTitle =
if (canUseSteak && configOwnBoss.steakAlert && containUser) true
diff --git a/src/main/java/at/hannibal2/skyhanni/test/SkyHanniConfigSearchResetCommand.kt b/src/main/java/at/hannibal2/skyhanni/test/SkyHanniConfigSearchResetCommand.kt
index ab89d499d..72a364ec1 100644
--- a/src/main/java/at/hannibal2/skyhanni/test/SkyHanniConfigSearchResetCommand.kt
+++ b/src/main/java/at/hannibal2/skyhanni/test/SkyHanniConfigSearchResetCommand.kt
@@ -83,15 +83,16 @@ object SkyHanniConfigSearchResetCommand {
}
val root: Any = when {
- term.startsWith("config") -> {
- SkyHanniMod.feature
- }
+ term.startsWith("config") -> SkyHanniMod.feature
+
term.startsWith("playerSpecific") -> {
ProfileStorageData.playerSpecific ?: return "§cplayerSpecific is null!"
}
+
term.startsWith("profileSpecific") -> {
ProfileStorageData.profileSpecific ?: return "§cprofileSpecific is null!"
}
+
else -> return "§cUnknown config location!"
}
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/CombatUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/CombatUtils.kt
index 52916b98d..e5afd887e 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/CombatUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/CombatUtils.kt
@@ -25,7 +25,6 @@ object CombatUtils {
private var gainTimer = 0
var _isKilling = false
-
/**
* Taken from NotEnoughUpdates
*/
@@ -44,11 +43,13 @@ object CombatUtils {
xpGainQueue.add(0, delta)
calculateXPHour()
}
+
xpGainTimer > 0 -> {
xpGainTimer--
xpGainQueue.add(0, 0f)
calculateXPHour()
}
+
delta <= 0 -> {
isKilling = false
}
@@ -57,7 +58,7 @@ object CombatUtils {
lastTotalXp = totalXp
}
- private fun calculateXPHour(){
+ private fun calculateXPHour() {
while (xpGainQueue.size > 30) {
xpGainQueue.removeLast()
}