diff options
author | Empa <42304516+ItsEmpa@users.noreply.github.com> | 2024-08-26 12:00:04 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-26 12:00:04 +0200 |
commit | 04fcd6c50b4d6716d5fbe5d78fc21b8143a62a5f (patch) | |
tree | 0ccebbc6e8e0f3f8f48c3790afd90cd1f1e037f5 | |
parent | 085fdbe16121954c44d30501f9a4fe4852e6e998 (diff) | |
download | skyhanni-04fcd6c50b4d6716d5fbe5d78fc21b8143a62a5f.tar.gz skyhanni-04fcd6c50b4d6716d5fbe5d78fc21b8143a62a5f.tar.bz2 skyhanni-04fcd6c50b4d6716d5fbe5d78fc21b8143a62a5f.zip |
Improvement: Mineshaft Count (#2310)
Co-authored-by: ItsEmpa <itsempa@users.noreply.github.com>
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
-rw-r--r-- | .idea/dictionaries/default_user.xml | 3 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/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 @@ <w>millenia</w> <w>minecart</w> <w>mineman</w> + <w>mineshafts</w> <w>miniboss</w> <w>mirrorverse</w> <w>misclick</w> @@ -276,4 +277,4 @@ <w>yolkar</w> </words> </dictionary> -</component>
\ No newline at end of file +</component> 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<Renderable>() @@ -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 <blocks>"), 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 |