Skip to content

Commit

Permalink
skill display only takes the current xp until next level instead of t…
Browse files Browse the repository at this point in the history
…otal level, fix later
  • Loading branch information
catgirlseraid committed Oct 17, 2024
1 parent e0dc471 commit 675af85
Show file tree
Hide file tree
Showing 10 changed files with 42 additions and 17 deletions.
18 changes: 18 additions & 0 deletions src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,13 @@ import at.hannibal2.skyhanni.features.garden.farming.ArmorDropTracker
import at.hannibal2.skyhanni.features.garden.farming.CropMoneyDisplay
import at.hannibal2.skyhanni.features.garden.farming.CropSpeedMeter
import at.hannibal2.skyhanni.features.garden.farming.DicerRngDropTracker
import at.hannibal2.skyhanni.features.garden.farming.EliteFarmingCollectionDisplay
import at.hannibal2.skyhanni.features.garden.farming.FarmingWeightDisplay
import at.hannibal2.skyhanni.features.garden.farming.GardenStartLocation
import at.hannibal2.skyhanni.features.garden.farming.lane.FarmingLaneCreator
import at.hannibal2.skyhanni.features.garden.fortuneguide.CaptureFarmingGear
import at.hannibal2.skyhanni.features.garden.fortuneguide.FFGuideGUI
import at.hannibal2.skyhanni.features.garden.pests.ElitePestKillsDisplay
import at.hannibal2.skyhanni.features.garden.pests.PestFinder
import at.hannibal2.skyhanni.features.garden.pests.PestProfitTracker
import at.hannibal2.skyhanni.features.garden.visitor.GardenVisitorDropStatistics
Expand All @@ -78,6 +80,7 @@ import at.hannibal2.skyhanni.features.misc.update.UpdateManager
import at.hannibal2.skyhanni.features.misc.visualwords.VisualWordGui
import at.hannibal2.skyhanni.features.rift.area.westvillage.VerminTracker
import at.hannibal2.skyhanni.features.rift.everywhere.PunchcardHighlight
import at.hannibal2.skyhanni.features.skillprogress.EliteSkillRankDisplay
import at.hannibal2.skyhanni.features.slayer.SlayerProfitTracker
import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
import at.hannibal2.skyhanni.test.DebugCommand
Expand Down Expand Up @@ -398,6 +401,21 @@ object Commands {
}

// non trackers
event.register("shrefreshfc") {
description = "Refresh the Farming Collection Display"
category = CommandCategory.USERS_RESET
callback { EliteFarmingCollectionDisplay.refresh() }
}
event.register("shrefreshsl") {
description = "Refresh the Skill Leaderboard Display"
category = CommandCategory.USERS_RESET
callback { EliteSkillRankDisplay.reset() }
}
event.register("shrefreshpl") {
description = "Refresh the Pest Kills Leaderboard Display"
category = CommandCategory.USERS_RESET
callback { ElitePestKillsDisplay.reset() }
}
event.register("shresetghostcounter") {
description = "Resets the ghost counter"
category = CommandCategory.USERS_RESET
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ enum class CropType(
"Wheat", "THEORETICAL_HOE_WHEAT", "CROPIE", 1.0,
{ ItemStack(Items.wheat) }, "wheat", FarmingItems.WHEAT
),
SEEDS(
"Seeds", "THEORETICAL_HOE_WHEAT", "CROPIE", 1.0,
{ ItemStack(Items.wheat_seeds) }, "seeds", FarmingItems.SEEDS,
),
CARROT(
"Carrot", "THEORETICAL_HOE_CARROT", "CROPIE", 3.0,
{ ItemStack(Items.carrot) }, "carrot", FarmingItems.CARROT, replenish = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ object GardenOptimalSpeed {

private fun CropType.getConfig(): Property<Float> = with(configCustomSpeed) {
when (this@getConfig) {
CropType.WHEAT -> wheat
CropType.WHEAT, CropType.SEEDS -> wheat
CropType.CARROT -> carrot
CropType.POTATO -> potato
CropType.NETHER_WART -> netherWart
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package at.hannibal2.skyhanni.features.garden.farming

import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.api.EliteBotAPI
import at.hannibal2.skyhanni.api.event.HandleEvent
import at.hannibal2.skyhanni.config.features.garden.EliteFarmingCollectionConfig.CropDisplay
import at.hannibal2.skyhanni.data.ClickType
import at.hannibal2.skyhanni.data.jsonobjects.other.EliteCollectionGraphEntry
Expand All @@ -17,7 +18,7 @@ import at.hannibal2.skyhanni.features.garden.GardenAPI
import at.hannibal2.skyhanni.features.garden.farming.GardenCropSpeed.getSpeed
import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
import at.hannibal2.skyhanni.test.command.ErrorManager
import at.hannibal2.skyhanni.utils.APIUtil
import at.hannibal2.skyhanni.utils.APIUtils
import at.hannibal2.skyhanni.utils.ChatUtils
import at.hannibal2.skyhanni.utils.CollectionUtils.addOrPut
import at.hannibal2.skyhanni.utils.ConditionalUtils.afterChange
Expand Down Expand Up @@ -114,7 +115,7 @@ object EliteFarmingCollectionDisplay {
}

//This uses the block click event instead of the crop click event, so it still works outside the garden.
@SubscribeEvent
@HandleEvent
fun onBlockClicked(event: BlockClickEvent) {
if (event.clickType == ClickType.RIGHT_CLICK) return
val crop = event.getBlockState.getCropType() ?: return
Expand All @@ -133,7 +134,7 @@ object EliteFarmingCollectionDisplay {
resetData()
}

fun onCommand(args: Array<String>) {
fun refresh() {
if (EliteBotAPI.disableRefreshCommand) {
ChatUtils.userError("§eCommand has been disabled")
} else if (commandLastUsed.passedSince() < 1.minutes) {
Expand Down Expand Up @@ -261,7 +262,7 @@ object EliteFarmingCollectionDisplay {
if (EliteBotAPI.profileID == null) return
val url =
"https://api.elitebot.dev/Leaderboard/rank/${getEliteBotLeaderboardForCrop(crop)}/${LorenzUtils.getPlayerUuid()}/${EliteBotAPI.profileID!!.toDashlessUUID()}?includeUpcoming=true"
val response = APIUtil.getJSONResponseAsElement(url)
val response = APIUtils.getJSONResponseAsElement(url)

try {
val data = eliteCollectionApiGson.fromJson<EliteLeaderboard>(response)
Expand Down Expand Up @@ -303,7 +304,7 @@ object EliteFarmingCollectionDisplay {
if (EliteBotAPI.profileID == null) return
val url =
"https://api.elitebot.dev/Graph/${LorenzUtils.getPlayerUuid()}/${EliteBotAPI.profileID!!.toDashlessUUID()}/crops?days=1"
val response = APIUtil.getJSONResponseAsElement(url)
val response = APIUtils.getJSONResponseAsElement(url)

try {
val data = eliteCollectionApiGson.fromJson<Array<EliteCollectionGraphEntry>>(response)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -589,6 +589,7 @@ object FarmingWeightDisplay {
private val backupCropWeights by lazy {
mapOf(
CropType.WHEAT to 100_000.0,
CropType.SEEDS to 0.0,
CropType.CARROT to 302_061.86,
CropType.POTATO to 300_000.0,
CropType.SUGAR_CANE to 200_000.0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ enum class FarmingItems(
private val ffCalculation: (ItemStack?) -> Map<FFTypes, Double> = { emptyMap() },
) {
WHEAT(ItemCategory.HOE),
SEEDS(ItemCategory.HOE),
CARROT(ItemCategory.HOE),
POTATO(ItemCategory.HOE),
NETHER_WART(ItemCategory.HOE),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import at.hannibal2.skyhanni.events.garden.pests.PestKillEvent
import at.hannibal2.skyhanni.features.garden.GardenAPI
import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
import at.hannibal2.skyhanni.test.command.ErrorManager
import at.hannibal2.skyhanni.utils.APIUtil
import at.hannibal2.skyhanni.utils.APIUtils
import at.hannibal2.skyhanni.utils.ChatUtils
import at.hannibal2.skyhanni.utils.CollectionUtils.addOrPut
import at.hannibal2.skyhanni.utils.ConditionalUtils.afterChange
Expand Down Expand Up @@ -127,7 +127,7 @@ object ElitePestKillsDisplay {
currentPests.addOrPut(pest, 1)
}

fun onCommand(args: Array<String>) {
fun reset() {
if (EliteBotAPI.disableRefreshCommand) {
ChatUtils.userError("§eCommand has been disabled")
} else if (commandLastUsed.passedSince() < 1.minutes) {
Expand Down Expand Up @@ -231,7 +231,7 @@ object ElitePestKillsDisplay {
if (EliteBotAPI.profileID == null) return
val url =
"https://api.elitebot.dev/Leaderboard/rank/${pest.displayName.lowercase()}/${LorenzUtils.getPlayerUuid()}/${EliteBotAPI.profileID!!.toDashlessUUID()}?includeUpcoming=true"
val response = APIUtil.getJSONResponseAsElement(url)
val response = APIUtils.getJSONResponseAsElement(url)

try {
val data = elitePestApiGson.fromJson<EliteLeaderboard>(response)
Expand Down Expand Up @@ -273,7 +273,7 @@ object ElitePestKillsDisplay {
if (EliteBotAPI.profileID == null) return
val url =
"https://api.elitebot.dev/Profile/${LorenzUtils.getPlayerUuid()}/${EliteBotAPI.profileID!!.toDashlessUUID()}/"
val response = APIUtil.getJSONResponseAsElement(url)
val response = APIUtils.getJSONResponseAsElement(url)

try {
val data = elitePestApiGson.fromJson<EliteProfileMember>(response)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,9 @@ object PestAPI {
* REGEX-TEST: §eYou received §a7x Enchanted Potato §efor killing a §6Locust§e!
* REGEX-TEST: §eYou received §a6x Enchanted Cocoa Beans §efor killing a §6Moth§e!
*/
private val pestDeathChatPattern by patternGroup.pattern(
val pestDeathChatPattern by patternGroup.pattern(
"chat.pestdeath",
"§eYou received §a(?<amount>[0-9]*)x (?<item>.*) §efor killing an? §6(?<pest>.*)§e!"
"§eYou received §a(?<amount>[0-9]*)x (?<item>.*) §efor killing an? §6(?<pest>.*)§e!",
)
private val noPestsChatPattern by patternGroup.pattern(
"chat.nopests",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ object PestProfitTracker {
fun onPestKill(event: PestKillEvent) {
if (!isEnabled()) return

tracker.addItem(event.item, event.amount)
tracker.addItem(event.item, event.amount, false)
addKill()
if (config.hideChat) event.blockedReason = "pest_drop"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import at.hannibal2.skyhanni.events.SkillExpGainEvent
import at.hannibal2.skyhanni.features.garden.GardenAPI
import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
import at.hannibal2.skyhanni.test.command.ErrorManager
import at.hannibal2.skyhanni.utils.APIUtil
import at.hannibal2.skyhanni.utils.APIUtils
import at.hannibal2.skyhanni.utils.ChatUtils
import at.hannibal2.skyhanni.utils.ConditionalUtils.afterChange
import at.hannibal2.skyhanni.utils.LorenzUtils
Expand Down Expand Up @@ -120,7 +120,7 @@ object EliteSkillRankDisplay {
resetData()
}

fun onCommand(args: Array<String>) {
fun reset() {
if (EliteBotAPI.disableRefreshCommand) {
ChatUtils.userError("§eCommand has been disabled")
} else if (commandLastUsed.passedSince() < 1.minutes) {
Expand Down Expand Up @@ -244,7 +244,7 @@ object EliteSkillRankDisplay {
val url =
"https://api.elitebot.dev/Leaderboard/rank/$skill/${LorenzUtils.getPlayerUuid()}/${EliteBotAPI.profileID!!.toDashlessUUID()}?includeUpcoming=true"

val response = APIUtil.getJSONResponseAsElement(url)
val response = APIUtils.getJSONResponseAsElement(url)

try {
val data = eliteCollectionApiGson.fromJson<EliteLeaderboard>(response)
Expand Down Expand Up @@ -286,7 +286,7 @@ object EliteSkillRankDisplay {
if (EliteBotAPI.profileID == null) return
val url =
"https://api.elitebot.dev/Graph/${LorenzUtils.getPlayerUuid()}/${EliteBotAPI.profileID!!.toDashlessUUID()}/skills?days=1"
val response = APIUtil.getJSONResponseAsElement(url)
val response = APIUtils.getJSONResponseAsElement(url)

try {
val data = eliteCollectionApiGson.fromJson<Array<EliteSkillGraphEntry>>(response)
Expand Down

0 comments on commit 675af85

Please sign in to comment.