From 04fcd6c50b4d6716d5fbe5d78fc21b8143a62a5f Mon Sep 17 00:00:00 2001 From: Empa <42304516+ItsEmpa@users.noreply.github.com> Date: Mon, 26 Aug 2024 12:00:04 +0200 Subject: Improvement: Mineshaft Count (#2310) Co-authored-by: ItsEmpa Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com> --- .idea/dictionaries/default_user.xml | 3 +- .../features/mining/MineshaftPityDisplay.kt | 39 ++++++++++++---------- 2 files changed, 23 insertions(+), 19 deletions(-) diff --git a/.idea/dictionaries/default_user.xml b/.idea/dictionaries/default_user.xml index b94b0c94a..cb9130171 100644 --- a/.idea/dictionaries/default_user.xml +++ b/.idea/dictionaries/default_user.xml @@ -147,6 +147,7 @@ millenia minecart mineman + mineshafts miniboss mirrorverse misclick @@ -276,4 +277,4 @@ yolkar - \ No newline at end of file + diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/MineshaftPityDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/MineshaftPityDisplay.kt index 2df977737..e67341f44 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/mining/MineshaftPityDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/mining/MineshaftPityDisplay.kt @@ -73,6 +73,8 @@ object MineshaftPityDisplay { profileStorage?.mineshaftTotalCount = value } + private var sessionMineshafts = 0 + var lastMineshaftSpawn = SimpleTimeMark.farPast() private var display = listOf() @@ -104,6 +106,7 @@ object MineshaftPityDisplay { mineshaftTotalBlocks += totalBlocks mineshaftTotalCount++ + sessionMineshafts++ val message = event.message + " §e($counterUntilPity)" @@ -201,27 +204,24 @@ object MineshaftPityDisplay { ), ) - val map = buildMap { - put(MineshaftPityLine.TITLE, Renderable.string("§9§lMineshaft Pity Counter")) - put(MineshaftPityLine.COUNTER, Renderable.string("§3Pity Counter: §e$counterUntilPity§6/§e$MAX_COUNTER")) - put( - MineshaftPityLine.CHANCE, - Renderable.string( - "§3Chance: §e1§6/§e${chance.round(1).addSeparators()} §7(§b${((1.0 / chance) * 100).addSeparators()}%§7)", - ), - ) - put(MineshaftPityLine.NEEDED_TO_PITY, neededToPityRenderable) - put( - MineshaftPityLine.TIME_SINCE_MINESHAFT, + val map = mapOf( + MineshaftPityLine.TITLE to Renderable.string("§9§lMineshaft Pity Counter"), + MineshaftPityLine.COUNTER to Renderable.string("§3Pity Counter: §e$counterUntilPity§6/§e$MAX_COUNTER"), + MineshaftPityLine.CHANCE to Renderable.string( + "§3Chance: §e1§6/§e${ + chance.round(1).addSeparators() + } §7(§b${((1.0 / chance) * 100).addSeparators()}%§7)", + ), + MineshaftPityLine.NEEDED_TO_PITY to neededToPityRenderable, + MineshaftPityLine.TIME_SINCE_MINESHAFT to Renderable.string("§3Last Mineshaft: §e${lastMineshaftSpawn.passedSince().format()}"), - ) - put( - MineshaftPityLine.AVERAGE_BLOCKS_MINESHAFT, + MineshaftPityLine.AVERAGE_BLOCKS_MINESHAFT to Renderable.string( "§3Average Blocks/Mineshaft: §e${(mineshaftTotalBlocks / mineshaftTotalCount.toDouble()).addSeparators()}", ), - ) - } + MineshaftPityLine.MINESHAFTS_TOTAL to Renderable.string("§3Mineshafts total: §e${mineshaftTotalCount.addSeparators()}"), + MineshaftPityLine.MINESHAFTS_SESSION to Renderable.string("§3Mineshafts this session: §e${sessionMineshafts.addSeparators()}"), + ) display = config.mineshaftPityLines.filter { it.shouldDisplay() }.mapNotNull { map[it] } } @@ -247,6 +247,7 @@ object MineshaftPityDisplay { resetCounter() mineshaftTotalBlocks = 0 mineshaftTotalCount = 0 + sessionMineshafts = 0 lastMineshaftSpawn = SimpleTimeMark.farPast() update() } @@ -268,7 +269,9 @@ object MineshaftPityDisplay { CHANCE("§3Chance: §e1§6/§e1439 §7(§b0.069%§7)"), NEEDED_TO_PITY("§3Needed to pity:\n§7 "), TIME_SINCE_MINESHAFT("§3Last Mineshaft: §e21m 5s", { !lastMineshaftSpawn.isFarPast() }), - AVERAGE_BLOCKS_MINESHAFT("§3Average Blocks/Mineshaft: §e361.5", { mineshaftTotalCount != 0 }) + AVERAGE_BLOCKS_MINESHAFT("§3Average Blocks/Mineshaft: §e361.5", { mineshaftTotalCount != 0 }), + MINESHAFTS_TOTAL("§3Mineshafts total: §e23", { mineshaftTotalCount != 0 }), + MINESHAFTS_SESSION("§3Mineshafts this session: §e3", { sessionMineshafts != 0 }), ; override fun toString() = display -- cgit