diff --git a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt index d6454b2b47f6..40b30fd2f986 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt +++ b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt @@ -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 @@ -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 @@ -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 diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/CropType.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/CropType.kt index 9403120eb382..fa97b764482f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/CropType.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/CropType.kt @@ -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 diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenOptimalSpeed.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenOptimalSpeed.kt index 337f64675b66..1d45e1536d77 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenOptimalSpeed.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenOptimalSpeed.kt @@ -143,7 +143,7 @@ object GardenOptimalSpeed { private fun CropType.getConfig(): Property = with(configCustomSpeed) { when (this@getConfig) { - CropType.WHEAT -> wheat + CropType.WHEAT, CropType.SEEDS -> wheat CropType.CARROT -> carrot CropType.POTATO -> potato CropType.NETHER_WART -> netherWart diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/EliteFarmingCollectionDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/EliteFarmingCollectionDisplay.kt index b212f27999a7..97e401820588 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/EliteFarmingCollectionDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/EliteFarmingCollectionDisplay.kt @@ -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 @@ -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 @@ -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 @@ -133,7 +134,7 @@ object EliteFarmingCollectionDisplay { resetData() } - fun onCommand(args: Array) { + fun refresh() { if (EliteBotAPI.disableRefreshCommand) { ChatUtils.userError("§eCommand has been disabled") } else if (commandLastUsed.passedSince() < 1.minutes) { @@ -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(response) @@ -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>(response) diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingWeightDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingWeightDisplay.kt index 640661bd9797..fe3ceb620a48 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingWeightDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingWeightDisplay.kt @@ -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, diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FarmingItems.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FarmingItems.kt index bdfe98abfff2..32b969889897 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FarmingItems.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FarmingItems.kt @@ -14,6 +14,7 @@ enum class FarmingItems( private val ffCalculation: (ItemStack?) -> Map = { emptyMap() }, ) { WHEAT(ItemCategory.HOE), + SEEDS(ItemCategory.HOE), CARROT(ItemCategory.HOE), POTATO(ItemCategory.HOE), NETHER_WART(ItemCategory.HOE), diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/ElitePestKillsDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/ElitePestKillsDisplay.kt index b73e8d6908ac..b0f9a0e127b9 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/ElitePestKillsDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/ElitePestKillsDisplay.kt @@ -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 @@ -127,7 +127,7 @@ object ElitePestKillsDisplay { currentPests.addOrPut(pest, 1) } - fun onCommand(args: Array) { + fun reset() { if (EliteBotAPI.disableRefreshCommand) { ChatUtils.userError("§eCommand has been disabled") } else if (commandLastUsed.passedSince() < 1.minutes) { @@ -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(response) @@ -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(response) diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestAPI.kt index aa338ddaf424..1c7a8fe2d607 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestAPI.kt @@ -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(?[0-9]*)x (?.*) §efor killing an? §6(?.*)§e!" + "§eYou received §a(?[0-9]*)x (?.*) §efor killing an? §6(?.*)§e!", ) private val noPestsChatPattern by patternGroup.pattern( "chat.nopests", diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestProfitTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestProfitTracker.kt index 90409340dc23..b46656f791dc 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestProfitTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestProfitTracker.kt @@ -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" } diff --git a/src/main/java/at/hannibal2/skyhanni/features/skillprogress/EliteSkillRankDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/skillprogress/EliteSkillRankDisplay.kt index f9b90ec53f7b..201b98224f74 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/skillprogress/EliteSkillRankDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/skillprogress/EliteSkillRankDisplay.kt @@ -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 @@ -120,7 +120,7 @@ object EliteSkillRankDisplay { resetData() } - fun onCommand(args: Array) { + fun reset() { if (EliteBotAPI.disableRefreshCommand) { ChatUtils.userError("§eCommand has been disabled") } else if (commandLastUsed.passedSince() < 1.minutes) { @@ -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(response) @@ -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>(response)