Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvement: Carry Tracker Remove #2829

Merged
merged 7 commits into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ import at.hannibal2.skyhanni.features.mining.fossilexcavator.ExcavatorProfitTrac
import at.hannibal2.skyhanni.features.mining.glacitemineshaft.CorpseTracker
import at.hannibal2.skyhanni.features.mining.powdertracker.PowderTracker
import at.hannibal2.skyhanni.features.minion.MinionFeatures
import at.hannibal2.skyhanni.features.misc.CarryTracker
import at.hannibal2.skyhanni.features.misc.CollectionTracker
import at.hannibal2.skyhanni.features.misc.LockMouseLook
import at.hannibal2.skyhanni.features.misc.MarkedPlayerManager
Expand Down Expand Up @@ -151,10 +150,6 @@ object Commands {
description = "Using path finder to go to locations"
callback { NavigationHelper.onCommand(it) }
}
event.register("shcarry") {
description = "Keep track of carries you do."
callback { CarryTracker.onCommand(it) }
}
event.register("shmarkplayer") {
description = "Add a highlight effect to a player for better visibility"
callback { MarkedPlayerManager.command(it) }
Expand Down
40 changes: 34 additions & 6 deletions src/main/java/at/hannibal2/skyhanni/features/misc/CarryTracker.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package at.hannibal2.skyhanni.features.misc

import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.api.event.HandleEvent
import at.hannibal2.skyhanni.config.commands.CommandRegistrationEvent
import at.hannibal2.skyhanni.data.jsonobjects.repo.CarryTrackerJson
import at.hannibal2.skyhanni.events.GuiRenderEvent
import at.hannibal2.skyhanni.events.LorenzChatEvent
Expand Down Expand Up @@ -32,10 +33,10 @@ import kotlin.time.Duration.Companion.seconds
* save on restart
* support for Dungeon, Kuudra, crimson minibosses
* average spawn time per slayer customer
* change customer name color if offline, onlilne, on your island
* change customer name color if offline, online, on your island
* show time since last boss died next to slayer customer name
* highlight slayer bosses for slayer customers
* automatically mark customers with /shmarkplaayers
* automatically mark customers with /shmarkplayers
* show a line behind them
*/

Expand Down Expand Up @@ -119,12 +120,39 @@ object CarryTracker {
config.carryPosition.renderRenderables(display, posLabel = "Carry Tracker")
}

fun onCommand(args: Array<String>) {
@HandleEvent
fun onCommandRegister(event: CommandRegistrationEvent) {
event.register("shcarry") {
description = "Keep track of carries you do."
callback { onCommand(it) }
}
}

@Suppress("ReturnCount")
private fun onCommand(args: Array<String>) {
if (args.size < 2 || args.size > 3) {
ChatUtils.userError("Usage:\n§c/shcarry <customer name> <type> <amount requested>\n§c/shcarry <type> <price per>")
ChatUtils.userError(
"Usage:\n" +
"§c/shcarry <customer name> <type> <amount requested>\n" +
"§c/shcarry <type> <price per>\n" +
"§c/shcarry remove <costumer name>",
)
return
}
if (args.size == 2) {
if (args[0] == "remove") {
val customerName = args[1]
for (customer in customers) {
if (customer.name.equals(customerName, ignoreCase = true)) {
customers.remove(customer)
update()
ChatUtils.chat("Removed customer: §b$customerName")
return
}
}
ChatUtils.userError("Customer not found: §b$customerName")
return
}
setPrice(args[0], args[1])
return
}
Expand Down Expand Up @@ -235,6 +263,7 @@ object CarryTracker {
add("§7Set a price with §e/shcarry <type> <price>")
}
add("")
add("§7Run §e/shcarry remove ${customer.name} §7to remove the whole customer!")
add("§eClick to send current progress in the party chat!")
add("§eControl-click to remove this carry!")
},
Expand Down Expand Up @@ -276,8 +305,7 @@ object CarryTracker {
),
onClick = {
HypixelCommands.partyChat(
"$customerName Carry: already paid: ${paidFormat.removeColor()}, " +
"still missing: ${missingFormat.removeColor()}",
"$customerName Carry: already paid: ${paidFormat.removeColor()}, still missing: ${missingFormat.removeColor()}",
)
},
),
Expand Down
Loading