diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-06-16 01:36:06 +0200 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-06-16 01:36:06 +0200 |
commit | 33758826af724a59ad98129c906ee9dec2e88d4c (patch) | |
tree | a239b55c81ab7ec2d4760f891433e025997b48f4 /src/main/java | |
parent | 82531dc49116a76052b44cc4f42c8e0be46afd58 (diff) | |
download | skyhanni-33758826af724a59ad98129c906ee9dec2e88d4c.tar.gz skyhanni-33758826af724a59ad98129c906ee9dec2e88d4c.tar.bz2 skyhanni-33758826af724a59ad98129c906ee9dec2e88d4c.zip |
Added option to delete items from the slayer profit display by control + click
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerItemProfitTracker.kt | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerItemProfitTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerItemProfitTracker.kt index 1bed3270e..59f854ef0 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerItemProfitTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerItemProfitTracker.kt @@ -177,7 +177,8 @@ object SlayerItemProfitTracker { val price = (getPrice(internalName) * amount).toLong() - var name = SlayerAPI.getNameWithEnchantmentFor(internalName) ?: internalName + val cleanName = SlayerAPI.getNameWithEnchantmentFor(internalName) ?: internalName + var name = cleanName val priceFormat = NumberUtil.format(price) val hidden = itemProfit.hidden if (hidden) { @@ -192,18 +193,24 @@ object SlayerItemProfitTracker { val percentage = timesDropped.toDouble() / itemLog.slayerCompletedCount val perBoss = LorenzUtils.formatPercentage(percentage.coerceAtMost(1.0)) - val renderable = if (inventoryOpen) Renderable.clickAndHover( text, listOf( "§7Dropped §e$timesDropped §7times.", "§7Your drop rate: §c$perBoss", "", - "§eClick to " + (if (hidden) "show" else "hide") + "!" + "§eClick to " + (if (hidden) "show" else "hide") + "!", + "§eControl + Click to remove this item!", ) ) { if (System.currentTimeMillis() > lastClickDelay + 150) { - lastClickDelay = System.currentTimeMillis() - itemProfit.hidden = !hidden + + if (LorenzUtils.isControlKeyDown()) { + itemLog.items.remove(internalName) + LorenzUtils.chat("§e[SkyHanni] Removed $cleanName §efrom slayer profit display.") + lastClickDelay = System.currentTimeMillis() + 500 + } else { + itemProfit.hidden = !hidden + } update() } } else Renderable.string(text) |