From 81e6801b2507cbb10ede6fba4f1d9ee6ef92f219 Mon Sep 17 00:00:00 2001 From: HiZe_ Date: Mon, 19 Jun 2023 10:41:45 +0200 Subject: Ghost Counter (#227) --- .../at/hannibal2/skyhanni/config/Features.java | 4 + .../java/at/hannibal2/skyhanni/config/Storage.java | 29 +- .../hannibal2/skyhanni/config/commands/Commands.kt | 15 +- .../skyhanni/config/features/GhostCounter.java | 325 +++++++++++++++++++++ .../hannibal2/skyhanni/config/features/Misc.java | 79 ++--- 5 files changed, 407 insertions(+), 45 deletions(-) create mode 100644 src/main/java/at/hannibal2/skyhanni/config/features/GhostCounter.java (limited to 'src/main/java/at/hannibal2/skyhanni/config') diff --git a/src/main/java/at/hannibal2/skyhanni/config/Features.java b/src/main/java/at/hannibal2/skyhanni/config/Features.java index 9a65ead70..d80195e71 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/Features.java +++ b/src/main/java/at/hannibal2/skyhanni/config/Features.java @@ -115,6 +115,10 @@ public class Features extends Config { @Category(name = "Garden", desc = "Features on the Garden island.") public Garden garden = new Garden(); + @Expose + @Category(name = "Ghost Counter", desc = "Ghost Counter settings.") + public GhostCounter ghostCounter = new GhostCounter(); + @Expose @Category(name = "Misc", desc = "Settings without a category.") public Misc misc = new Misc(); diff --git a/src/main/java/at/hannibal2/skyhanni/config/Storage.java b/src/main/java/at/hannibal2/skyhanni/config/Storage.java index f853d4a8d..0a63e5928 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/Storage.java +++ b/src/main/java/at/hannibal2/skyhanni/config/Storage.java @@ -5,6 +5,7 @@ import at.hannibal2.skyhanni.features.garden.CropAccessory; import at.hannibal2.skyhanni.features.garden.CropType; import at.hannibal2.skyhanni.features.garden.fortuneguide.FarmingItems; import at.hannibal2.skyhanni.features.garden.visitor.VisitorReward; +import at.hannibal2.skyhanni.features.misc.GhostCounter.Option; import at.hannibal2.skyhanni.utils.LorenzVec; import com.google.gson.annotations.Expose; import net.minecraft.item.ItemStack; @@ -203,6 +204,33 @@ public class Storage { public long lastComposterEmptyWarningTime = 0; } + @Expose + public GhostCounter ghostCounter = new GhostCounter(); + + public static class GhostCounter { + + @Expose + public Map data = new HashMap<>(); + + @Expose + public boolean ctDataImported = false; + + @Expose + public double bestiaryNextLevel = 0; + + @Expose + public double bestiaryCurrentKill = 0; + + @Expose + public double bestiaryKillNeeded = 0; + + @Expose + public double totalMF = 0; + + } + + public long nextCityProjectParticipationTime = 0L; + @Expose public Map slayerProfitData = new HashMap<>(); @@ -231,6 +259,5 @@ public class Storage { public boolean hidden; } } - } } \ No newline at end of file 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 d49ddf345..ebcb72d28 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt +++ b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt @@ -20,6 +20,7 @@ import at.hannibal2.skyhanni.features.garden.fortuneguide.FFGuideGUI import at.hannibal2.skyhanni.features.minion.MinionFeatures import at.hannibal2.skyhanni.features.misc.CityProjectFeatures import at.hannibal2.skyhanni.features.misc.CollectionCounter +import at.hannibal2.skyhanni.features.misc.GhostCounter import at.hannibal2.skyhanni.features.misc.MarkedPlayerManager import at.hannibal2.skyhanni.features.misc.discordrpc.DiscordRPCManager import at.hannibal2.skyhanni.features.slayer.SlayerItemProfitTracker @@ -51,7 +52,7 @@ object Commands { // main commands registerCommand("sh", openMainMenu) registerCommand("skyhanni", openMainMenu) - + registerCommand("ff") { openFortuneGuide() } // for users - regular commands @@ -65,6 +66,7 @@ object Commands { registerCommand("shcropstartlocation") { GardenStartLocation.setLocationCommand() } registerCommand("shstopcityprojectreminder") { CityProjectFeatures.disable() } registerCommand("shclearslayerprofits") { SlayerItemProfitTracker.clearProfitCommand(it) } + registerCommand("shimportghostcounterdata") { GhostCounter.importCTGhostCounterData() } registerCommand("shclearfarmingitems") { clearFarmingItems() } // for users - fix bugs @@ -100,8 +102,9 @@ object Commands { registerCommand("shcopyerror") { CopyErrorCommand.command(it) } } + @JvmStatic - fun openFortuneGuide() { + fun openFortuneGuide() { if (!LorenzUtils.inSkyBlock) { LorenzUtils.chat("§cJoin Skyblock to open the fortune guide!") } else { @@ -122,9 +125,9 @@ object Commands { } private fun createCommand(function: (Array) -> Unit) = - object : ProcessCommandRunnable() { - override fun processCommand(sender: ICommandSender?, args: Array) { - function(args.asList().toTypedArray()) + object : ProcessCommandRunnable() { + override fun processCommand(sender: ICommandSender?, args: Array) { + function(args.asList().toTypedArray()) + } } - } } \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/GhostCounter.java b/src/main/java/at/hannibal2/skyhanni/config/features/GhostCounter.java new file mode 100644 index 000000000..e0dd11e62 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/config/features/GhostCounter.java @@ -0,0 +1,325 @@ +package at.hannibal2.skyhanni.config.features; + +import akka.actor.Kill; +import at.hannibal2.skyhanni.config.core.config.Position; +import com.google.gson.annotations.Expose; +import io.github.moulberry.moulconfig.annotations.*; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +public class GhostCounter { + + @Expose + @ConfigOption(name = "Enabled", desc = "Enable ghost counter.") + @ConfigEditorBoolean + public boolean enabled = true; + + @Expose + @ConfigOption( + name = "Display Text", + desc = "Drag text to change the appearance of the overlay." + ) + @ConfigEditorDraggableList( + exampleText = { + "§6Ghosts Counter", + " §bGhost Killed: 42", + " §bSorrow: 6", + " §bGhost since Sorrow: 1", + " §bGhosts/Sorrow: 5", + " §bVolta: 6", + " §bPlasma: 8", + " §bGhostly Boots: 1", + " §bBag Of Cash: 4", + " §bAvg Magic Find: 271", + " §bScavenger Coins: 15,000", + " §bKill Combo: 14", + " §bHighest Kill Combo: 96", + " §bSkill XP Gained: 145,648", + " §bBestiary 1: 0/10", + " §bXP/h: 810,410", + " §bKills/h: 420", + " §bETA: 14d", + " §bMoney/h: 13,420,069" + } + ) + public List ghostDisplayText = new ArrayList<>(Arrays.asList(0, 1, 2, 3, 4, 9, 10, 11, 12)); + + @ConfigOption(name = "Text Formatting", desc = "") + @Accordion + @Expose + public TextFormatting textFormatting = new TextFormatting(); + + public static class TextFormatting { + + @ConfigOption(name = "§eText Formatting Info", desc = "§e%session% §ris §e§lalways §rreplaced with\n" + + "§7the count for your current session.\n" + + "§7Reset when restarting the game.\n" + + "§7You can use §e&Z §7color code to use SBA chroma") + @ConfigEditorInfoText + public boolean formatInfo = false; + + @ConfigOption(name = "Reset Formatting", desc = "Reset formatting to default text.") + @ConfigEditorButton(buttonText = "Reset") + public Runnable resetFormatting = at.hannibal2.skyhanni.features.misc.GhostCounter.INSTANCE::resetFormatting; + + @ConfigOption(name = "Export Formatting", desc = "Export current formatting to clipboard.") + @ConfigEditorButton(buttonText = "Export") + public Runnable exportFormatting = at.hannibal2.skyhanni.features.misc.GhostCounter.INSTANCE::exportFormatting; + + @ConfigOption(name = "Import Formatting", desc = "Import formatting from clipboard.") + @ConfigEditorButton(buttonText = "Import") + public Runnable importFormatting = at.hannibal2.skyhanni.features.misc.GhostCounter.INSTANCE::importFormatting; + + @Expose + @ConfigOption(name = "Title", desc = "Title Line.") + @ConfigEditorText + public String titleFormat = "&6Ghost Counter"; + + @Expose + @ConfigOption(name = "Ghost Killed", desc = "Ghost Killed line.\n§e%value% §ris replaced with\n" + + "Ghost Killed.\n" + + "§e%session% §7is replaced with Ghost killed") + @ConfigEditorText + public String ghostKiledFormat = " &6Ghost Killed: &b%value% &7(%session%)"; + + @Expose + @ConfigOption(name = "Sorrows", desc = "Sorrows drop line.\n" + + "§e%value% §7is replaced with\nsorrows dropped.") + @ConfigEditorText + public String sorrowsFormat = " &6Sorrow: &b%value% &7(%session%)"; + + @Expose + @ConfigOption(name = "Ghost Since Sorrow", desc = "Ghost Since Sorrow line.\n" + + "§e%value% §7is replaced with\nGhost since last sorrow drop.") + @ConfigEditorText + public String ghostSinceSorrowFormat = " &6Ghost since Sorrow: &b%value%"; + + @Expose + @ConfigOption(name = "Ghost Kill Per Sorrow", desc = "Ghost Kill Per Sorrow line.\n" + + "§e%value% §7is replaced with\naverage ghost kill per sorrow drop.") + @ConfigEditorText + public String ghostKillPerSorrowFormat = " &6Ghosts/Sorrow: &b%value%"; + + @Expose + @ConfigOption(name = "Voltas", desc = "Voltas drop line.\n" + + "§e%value% §7is replaced with\nvoltas dropped.") + @ConfigEditorText + public String voltasFormat = " &6Voltas: &b%value% &7(%session%)"; + + @Expose + @ConfigOption(name = "Plasmas", desc = "Plasmas drop line.\n" + + "§e%value% §7is replaced with\nplasmas dropped.") + @ConfigEditorText + public String plasmasFormat = " &6Plasmas: &b%value% &7(%session%)"; + + @Expose + @ConfigOption(name = "Ghostly Boots", desc = "Ghostly Boots drop line.\n" + + "§e%value% §7is replaced with\nGhostly Boots dropped.") + @ConfigEditorText + public String ghostlyBootsFormat = " &6Ghostly Boots: &b%value% &7(%session%)"; + + @Expose + @ConfigOption(name = "Bag Of Cash", desc = "Bag Of Cash drop line.\n" + + "§e%value% §7is replaced with\nBag Of Cash dropped.") + @ConfigEditorText + public String bagOfCashFormat = " &6Bag Of Cash: &b%value% &7(%session%)"; + + @Expose + @ConfigOption(name = "Average Magic Find", desc = "Average Magic Find line.\n" + + "§e%value% §7is replaced with\nAverage Magic Find.") + @ConfigEditorText + public String avgMagicFindFormat = " &6Avg Magic Find: &b%value%"; + + @Expose + @ConfigOption(name = "Scavenger Coins", desc = "Scavenger Coins line.\n" + + "§e%value% §7is replaced with\nCoins earned from kill ghosts.\nInclude: Scavenger Enchant, Scavenger Talismans, Kill Combo.") + @ConfigEditorText + public String scavengerCoinsFormat = " &6Scavenger Coins: &b%value% &7(%session%)"; + + @Expose + @ConfigOption(name = "Kill Combo", desc = "Kill Combo line.\n" + + "§e%value% §7is replaced with\nYour current kill combo.") + @ConfigEditorText + public String killComboFormat = " &6Kill Combo: &b%value%"; + + @Expose + @ConfigOption(name = "Highest Kill Combo", desc = "Highest Kill Combo line.\n" + + "§e%value% §7is replaced with\nYour current highest kill combo.") + @ConfigEditorText + public String highestKillComboFormat = " &6Highest Kill Combo: &b%value% &7(%session%)"; + + @Expose + @ConfigOption(name = "Skill XP Gained", desc = "Skill XP Gained line.\n" + + "§e%value% §7is replaced with\nSkill XP Gained from killing Ghosts.") + @ConfigEditorText + public String skillXPGainFormat = " &6Skill XP Gained: &b%value% &7(%session%)"; + + @ConfigOption(name = "Bestiary Formatting", desc = "") + @Accordion + @Expose + public BestiaryFormatting bestiaryFormatting = new BestiaryFormatting(); + + public static class BestiaryFormatting { + + @Expose + @ConfigOption(name = "Bestiary", desc = "Bestiary Progress line.\n§e%value% §7is replaced with\n" + + "Your current progress to next level.\n" + + "§e%currentLevel% &7is replaced with your current bestiary level\n" + + "§e%nextLevel% §7is replaced with your current bestiary level +1.\n" + + "§e%value% §7is replaced with one of the text below.") + @ConfigEditorText + public String base = " &6Bestiary %currentLevel%->%nextLevel%: &b%value%"; + + @Expose + @ConfigOption(name = "No Data", desc = "Text to show when you need to open the\nBestiary Menu to gather data.") + @ConfigEditorText + public String openMenu = "§cOpen Bestiary Menu !"; + + @Expose + @ConfigOption(name = "Maxed", desc = "Text to show when your bestiary for ghost is at max level.\n" + + "§e%currentKill% §7is replaced with your current total kill.") + @ConfigEditorText + public String maxed = "%currentKill% (&c&lMaxed!)"; + + @Expose + @ConfigOption(name = "Progress to Max", desc = "Text to show progress when the §eMaxed Bestiary §7option is §aON\n" + + "§e%currentKill% §7is replaced with your current total kill.") + @ConfigEditorText + public String showMax_progress = "%currentKill%/3M (%percentNumber%%)"; + + @Expose + @ConfigOption(name = "Progress", desc = "Text to show progress when the §eMaxed Bestiary§7 option is §cOFF\n" + + "§e%currentKill% §7is replaced with how many kill you have to the next level.\n" + + "§e%killNeeded% §7is replaced with how many kill you need to reach the next level.") + @ConfigEditorText + public String progress = "%currentKill%/%killNeeded%"; + } + + + @ConfigOption(name = "XP Per Hour Formatting", desc = "") + @Accordion + @Expose + public XPHourFormatting xpHourFormatting = new XPHourFormatting(); + + public static class XPHourFormatting { + + @Expose + @ConfigOption(name = "XP/h", desc = "XP Per Hour line.\n" + + "§e%value% §7is replaced with one of the text below.") + @ConfigEditorText + public String base = " &6XP/h: &b%value%"; + + @Expose + @ConfigOption(name = "No Data", desc = "XP Per Hour line.\n§e%value% §7is replaced with\nEstimated amount of combat xp you gain per hour.") + @ConfigEditorText + public String noData = "&bN/A"; + + @Expose + @ConfigOption(name = "Paused", desc = "Text displayed next to the time \n" + + "when you are doing nothing for a given amount of seconds") + @ConfigEditorText + public String paused = "&c(PAUSED)"; + } + + + @ConfigOption(name = "ETA Formatting", desc = "") + @Accordion + @Expose + public ETAFormatting etaFormatting = new ETAFormatting(); + + public static class ETAFormatting { + @Expose + @ConfigOption(name = "ETA to next level", desc = "ETA To Next Level Line.\n" + + "§e%value% §7is replaced with one of the text below.") + @ConfigEditorText + public String base = " &6ETA: &b%value%"; + + @Expose + @ConfigOption(name = "Maxed!", desc = "So you really maxed ghost bestiary ?") + @ConfigEditorText + public String maxed = "&c&lMAXED!"; + + @Expose + @ConfigOption(name = "No Data", desc = "Start killing some ghosts !") + @ConfigEditorText + public String noData = "&bN/A"; + + @Expose + @ConfigOption(name = "Progress", desc = "Text to show progress to next level.") + @ConfigEditorText + public String progress = "&b%value%"; + + @Expose + @ConfigOption(name = "Paused", desc = "Text displayed next to the time \n" + + "when you are doing nothing for a given amount of seconds") + @ConfigEditorText + public String paused = "&c(PAUSED)"; + } + + @ConfigOption(name = "Kill Per Hour Formatting", desc = "") + @Expose + @Accordion + public KillHourFormatting killHourFormatting = new KillHourFormatting(); + + public static class KillHourFormatting { + @Expose + @ConfigOption(name = "Kill/h", desc = "Kill Per Hour line.\n§e%value% §7is replaced with\nEstimated kills per hour you get.") + @ConfigEditorText + public String base = " &6Kill/h: &b%value%"; + + @Expose + @ConfigOption(name = "No Data", desc = "Start killing some ghosts !") + @ConfigEditorText + public String noData = "&bN/A"; + + @Expose + @ConfigOption(name = "Paused", desc = "Text displayed next to the time \n" + + "when you are doing nothing for a given amount of seconds") + @ConfigEditorText + public String paused = "&c(PAUSED)"; + } + + @Expose + @ConfigOption(name = "Money Per Hour", desc = "Money Per Hour.\n§e%value% §7is replaced with\nEstimated money you get per hour\n" + + "Calculated with your kill per hour and your average magic find.") + @ConfigEditorText + public String moneyHourFormat = " &6$/h: &b%value%"; + } + + @Expose + @ConfigOption(name = "Extra space", desc = "Space between each line of text.") + @ConfigEditorSlider( + minValue = -5, + maxValue = 10, + minStep = 1) + public int extraSpace = 1; + + @Expose + @ConfigOption(name = "Pause Timer", desc = "How many seconds does it wait before pausing.") + @ConfigEditorSlider( + minValue = 1, + maxValue = 20, + minStep = 1 + ) + public int pauseTimer = 3; + + @Expose + @ConfigOption(name = "Show only in The Mist", desc = "Show the overlay only when you are in The Mist.") + @ConfigEditorBoolean + public boolean onlyOnMist = false; + + @Expose + @ConfigOption(name = "Maxed Bestiary", desc = "Show progress to max bestiary instead of next level.") + @ConfigEditorBoolean + public boolean showMax = false; + + @ConfigOption(name = "Reset", desc = "Reset the counter.") + @ConfigEditorButton(buttonText = "Reset") + public Runnable resetCounter = at.hannibal2.skyhanni.features.misc.GhostCounter.INSTANCE::reset; + + @Expose + public Position position = new Position(50, 50, false, true); + +} diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/Misc.java b/src/main/java/at/hannibal2/skyhanni/config/features/Misc.java index 258bc517a..a5f37352d 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/Misc.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/Misc.java @@ -6,6 +6,9 @@ import io.github.moulberry.moulconfig.annotations.*; import io.github.moulberry.moulconfig.observer.Property; import org.lwjgl.input.Keyboard; +import java.util.ArrayList; +import java.util.List; + public class Misc { @Expose @@ -259,38 +262,38 @@ public class Misc { @Expose @ConfigOption(name = "First Line", desc = "Decide what to show in the first line.") @ConfigEditorDropdown(values = { - "Nothing", - "Location", - "Purse", - "Bits", - "Stats", - "Held Item", - "Skyblock Date", - "Profile (Fruit)", - "Slayer", - "Custom", - "Dynamic", - "Crop Milestone", - "Current Pet" + "Nothing", + "Location", + "Purse", + "Bits", + "Stats", + "Held Item", + "Skyblock Date", + "Profile (Fruit)", + "Slayer", + "Custom", + "Dynamic", + "Crop Milestone", + "Current Pet" }) public Property firstLine = Property.of(0); @Expose @ConfigOption(name = "Second Line", desc = "Decide what to show in the second line.") @ConfigEditorDropdown(values = { - "Nothing", - "Location", - "Purse", - "Bits", - "Stats", - "Held Item", - "Skyblock Date", - "Profile (Fruit)", - "Slayer", - "Custom", - "Dynamic", - "Crop Milestone", - "Current Pet" + "Nothing", + "Location", + "Purse", + "Bits", + "Stats", + "Held Item", + "Skyblock Date", + "Profile (Fruit)", + "Slayer", + "Custom", + "Dynamic", + "Crop Milestone", + "Current Pet" }) public Property secondLine = Property.of(0); @@ -302,18 +305,18 @@ public class Misc { @Expose @ConfigOption(name = "Dynamic", desc = "\"Dynamic\" above shows your Crop Milestone or Slayer progress while doing those, but this if you're doing neither.") @ConfigEditorDropdown(values = { - "Nothing", - "Location", - "Purse", - "Bits", - "Stats", - "Held Item", - "Skyblock Date", - "Profile (Fruit)", - "Slayer", - "Custom", - "Crop Milestone", - "Current Pet" + "Nothing", + "Location", + "Purse", + "Bits", + "Stats", + "Held Item", + "Skyblock Date", + "Profile (Fruit)", + "Slayer", + "Custom", + "Crop Milestone", + "Current Pet" }) public Property auto = Property.of(0); } -- cgit From b8e2d8cfc6ed0c5a3dfa0f36f1eb9c8b6ed028f8 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Mon, 19 Jun 2023 10:42:39 +0200 Subject: Show Ghost counter per default only in The Mist --- .../java/at/hannibal2/skyhanni/config/features/GhostCounter.java | 5 ++--- .../java/at/hannibal2/skyhanni/features/misc/GhostCounter.kt | 9 ++++----- 2 files changed, 6 insertions(+), 8 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni/config') diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/GhostCounter.java b/src/main/java/at/hannibal2/skyhanni/config/features/GhostCounter.java index e0dd11e62..955253f96 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/GhostCounter.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/GhostCounter.java @@ -1,6 +1,5 @@ package at.hannibal2.skyhanni.config.features; -import akka.actor.Kill; import at.hannibal2.skyhanni.config.core.config.Position; import com.google.gson.annotations.Expose; import io.github.moulberry.moulconfig.annotations.*; @@ -82,7 +81,7 @@ public class GhostCounter { "Ghost Killed.\n" + "§e%session% §7is replaced with Ghost killed") @ConfigEditorText - public String ghostKiledFormat = " &6Ghost Killed: &b%value% &7(%session%)"; + public String ghostKilledFormat = " &6Ghost Killed: &b%value% &7(%session%)"; @Expose @ConfigOption(name = "Sorrows", desc = "Sorrows drop line.\n" + @@ -308,7 +307,7 @@ public class GhostCounter { @Expose @ConfigOption(name = "Show only in The Mist", desc = "Show the overlay only when you are in The Mist.") @ConfigEditorBoolean - public boolean onlyOnMist = false; + public boolean onlyOnMist = true; @Expose @ConfigOption(name = "Maxed Bestiary", desc = "Show progress to max bestiary instead of next level.") diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/GhostCounter.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/GhostCounter.kt index 8440cf244..0be9f0655 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/GhostCounter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/GhostCounter.kt @@ -23,7 +23,6 @@ import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.LorenzUtils.chat import at.hannibal2.skyhanni.utils.LorenzUtils.clickableChat -import at.hannibal2.skyhanni.utils.NEUItems import at.hannibal2.skyhanni.utils.NumberUtil import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.NumberUtil.formatNumber @@ -196,7 +195,7 @@ object GhostCounter { } addAsSingletonList(Utils.chromaStringByColourCode(config.textFormatting.titleFormat.replace("&", "§"))) - addAsSingletonList(config.textFormatting.ghostKiledFormat.formatText(KILLS.getInt(), KILLS.getInt(true))) + addAsSingletonList(config.textFormatting.ghostKilledFormat.formatText(KILLS.getInt(), KILLS.getInt(true))) addAsSingletonList(config.textFormatting.sorrowsFormat.formatText(SORROWCOUNT.getInt(), SORROWCOUNT.getInt(true))) addAsSingletonList(config.textFormatting.ghostSinceSorrowFormat.formatText(GHOSTSINCESORROW.getInt())) addAsSingletonList(config.textFormatting.ghostKillPerSorrowFormat.formatText(value)) @@ -512,7 +511,7 @@ object GhostCounter { if (list.size == 30) { with(config.textFormatting) { titleFormat = list[0] - ghostKiledFormat = list[1] + ghostKilledFormat = list[1] sorrowsFormat = list[2] ghostSinceSorrowFormat = list[3] ghostKillPerSorrowFormat = list[4] @@ -557,7 +556,7 @@ object GhostCounter { val list = mutableListOf() with(config.textFormatting) { list.add(titleFormat) - list.add(ghostKiledFormat) + list.add(ghostKilledFormat) list.add(sorrowsFormat) list.add(ghostSinceSorrowFormat) list.add(ghostKillPerSorrowFormat) @@ -606,7 +605,7 @@ object GhostCounter { fun resetFormatting() { with(config.textFormatting) { titleFormat = "&6Ghost Counter" - ghostKiledFormat = " &6Ghost Killed: &b%value% &7(%session%)" + ghostKilledFormat = " &6Ghost Killed: &b%value% &7(%session%)" sorrowsFormat = " &6Sorrow: &b%value% &7(%session%)" ghostSinceSorrowFormat = " &6Ghost since Sorrow: &b%value%" ghostKillPerSorrowFormat = " &6Ghosts/Sorrow: &b%value%" -- cgit From ee7cd18b8c40d3fbb2825ff5c7178c22307d2698 Mon Sep 17 00:00:00 2001 From: NetheriteMiner <88792142+NetheriteMiner@users.noreply.github.com> Date: Mon, 19 Jun 2023 05:34:35 -0400 Subject: Add more details to "Profile" and add "Stacking" to Rich Presence (#234) --- .../hannibal2/skyhanni/config/features/Misc.java | 16 +-- .../features/misc/discordrpc/DiscordStatus.kt | 150 +++++++++++++++++++-- 2 files changed, 148 insertions(+), 18 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni/config') diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/Misc.java b/src/main/java/at/hannibal2/skyhanni/config/features/Misc.java index a5f37352d..ef99c5d90 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/Misc.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/Misc.java @@ -1,10 +1,10 @@ package at.hannibal2.skyhanni.config.features; -import at.hannibal2.skyhanni.config.core.config.Position; -import com.google.gson.annotations.Expose; +import at.hannibal2.skyhanni.config.core.config.*; +import com.google.gson.annotations.*; import io.github.moulberry.moulconfig.annotations.*; -import io.github.moulberry.moulconfig.observer.Property; -import org.lwjgl.input.Keyboard; +import io.github.moulberry.moulconfig.observer.*; +import org.lwjgl.input.*; import java.util.ArrayList; import java.util.List; @@ -269,7 +269,7 @@ public class Misc { "Stats", "Held Item", "Skyblock Date", - "Profile (Fruit)", + "Profile", "Slayer", "Custom", "Dynamic", @@ -288,7 +288,7 @@ public class Misc { "Stats", "Held Item", "Skyblock Date", - "Profile (Fruit)", + "Profile", "Slayer", "Custom", "Dynamic", @@ -303,7 +303,7 @@ public class Misc { public Property customText = Property.of(""); @Expose - @ConfigOption(name = "Dynamic", desc = "\"Dynamic\" above shows your Crop Milestone or Slayer progress while doing those, but this if you're doing neither.") + @ConfigOption(name = "Dynamic", desc = "\"Dynamic\" above shows your Crop Milestone, Slayer progress, or Stacking enchantment when possible, but this if you're doing none of them.") @ConfigEditorDropdown(values = { "Nothing", "Location", @@ -312,7 +312,7 @@ public class Misc { "Stats", "Held Item", "Skyblock Date", - "Profile (Fruit)", + "Profile", "Slayer", "Custom", "Crop Milestone", diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordStatus.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordStatus.kt index 9cf02c07d..8bd590cf2 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordStatus.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordStatus.kt @@ -16,8 +16,12 @@ import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.colorCodeToRarity import at.hannibal2.skyhanni.utils.StringUtils.firstLetterUppercase import at.hannibal2.skyhanni.utils.StringUtils.removeColor +import at.hannibal2.skyhanni.utils.TabListData.Companion.getTabList import io.github.moulberry.notenoughupdates.miscfeatures.PetInfoOverlay.getCurrentPet import io.github.moulberry.notenoughupdates.util.SkyBlockTime +import net.minecraft.client.Minecraft +import net.minecraft.item.ItemStack +import net.minecraft.nbt.NBTTagCompound import java.util.function.Supplier import java.util.regex.Pattern @@ -27,6 +31,49 @@ var lastKnownDisplayStrings: MutableMap = val purseRegex = Regex("""(?:Purse|Piggy): ([\d,]+)[\d.]*""") val bitsRegex = Regex("""Bits: ([\d|,]+)[\d|.]*""") +val stackingEnchants = mapOf( + "compact" to mapOf( + "levels" to listOf(0, 100, 500, 1500, 5000, 15000, 50000, 150000, 500000, 1000000), + "nbtNum" to "compact_blocks" + ), + "cultivating" to mapOf( + "levels" to listOf( + 0, + 1000, + 5000, + 25000, + 100000, + 300000, + 1500000, + 5000000, + 20000000, + 100000000 + ), "nbtNum" to "farmed_cultivating" + ), + "expertise" to mapOf( + "levels" to listOf(0, 50, 100, 250, 500, 1000, 2500, 5500, 10000, 15000), + "nbtNum" to "expertise_kills" + ), + "hecatomb" to mapOf( + "levels" to listOf(0, 2, 5, 10, 20, 30, 40, 60, 80, 100), + "nbtNum" to "hecatomb_s_runs" + ), + "champion" to mapOf( + "levels" to listOf( + 0, + 50000, + 100000, + 250000, + 500000, + 1000000, + 1500000, + 2000000, + 2500000, + 3000000 + ), "nbtNum" to "champion_combat_xp" + ) +) // nbtNum is the id of the enchantment in the nbt data + enum class DiscordStatus(private val displayMessageSupplier: Supplier?) { NONE(null), @@ -54,7 +101,7 @@ enum class DiscordStatus(private val displayMessageSupplier: Supplier?) val scoreboard = ScoreboardData.sidebarLinesFormatted // Matches coins amount in purse or piggy, with optional decimal points val coins = scoreboard.firstOrNull { purseRegex.matches(it.removeColor()) }?.let { - purseRegex.find(it.removeColor())?.groupValues?.get(1) + purseRegex.find(it.removeColor())?.groupValues?.get(1) ?: "" } if (coins == "1") { lastKnownDisplayStrings[PURSE] = "1 Coin" @@ -69,6 +116,7 @@ enum class DiscordStatus(private val displayMessageSupplier: Supplier?) val bits = scoreboard.firstOrNull { bitsRegex.matches(it.removeColor()) }?.let { bitsRegex.find(it.removeColor())?.groupValues?.get(1) } + when (bits) { "1" -> "1 Bit" null -> "0 Bits" @@ -119,7 +167,36 @@ enum class DiscordStatus(private val displayMessageSupplier: Supplier?) }), PROFILE({ - HypixelData.profileName.firstLetterUppercase() + val player = LorenzUtils.getPlayerName() + + val tabData = getTabList() + val levelRegex = Regex("""\[(\d{1,3})] $player""") + var sbLevel = "" +// SkyBlock Level: [999] on Lemon + for (line in tabData) { + if (line.contains(player)) { + val colorlessLine = line.removeColor() + sbLevel = levelRegex.find(colorlessLine)!!.groupValues[1] + break + } + } + + var profile = "SkyBlock Level: [$sbLevel] on " + + profile += ( + if (HypixelData.ironman) "♲" + else if (HypixelData.bingo) "Ⓑ" + else if (HypixelData.stranded) "☀" + else "" + ) + + val fruit = HypixelData.profileName.firstLetterUppercase() + if (fruit == "") profile = + lastKnownDisplayStrings[PROFILE] ?: "SkyBlock Level: [$sbLevel]" // profile fruit has not loaded in yet + else profile += fruit + + lastKnownDisplayStrings[PROFILE] = profile + profile }), SLAYER({ @@ -152,13 +229,11 @@ enum class DiscordStatus(private val displayMessageSupplier: Supplier?) AUTO({ val slayerResult = SLAYER.displayMessageSupplier!!.get() - val milestoneResult = try { - CROP_MILESTONES.displayMessageSupplier!!.get() - } catch (e: Exception) { - "Unable to get milestone" - } + val stackingResult = STACKING.displayMessageSupplier!!.get() + val milestoneResult = CROP_MILESTONES.displayMessageSupplier!!.get() if (slayerResult != "Planning to do a slayer quest") slayerResult - else if (milestoneResult != "Unable to get milestone" && milestoneResult != "Unknown Item" && milestoneResult != "") milestoneResult + else if (milestoneResult != "Not farming!") milestoneResult + else if (stackingResult != "") stackingResult else { val statusNoAuto = DiscordStatus.values().toMutableList() statusNoAuto.remove(AUTO) @@ -176,9 +251,10 @@ enum class DiscordStatus(private val displayMessageSupplier: Supplier?) } ?: 100 // percentage to next milestone if (tier != null) { - lastKnownDisplayStrings[CROP_MILESTONES] = tier.let { "${crop.cropName}: Milestone $it ($progress)" } + "${crop.cropName}: Milestone $tier ($progress)" + } else { + "Not farming!" } - lastKnownDisplayStrings[CROP_MILESTONES] ?: "" }), PETS({ @@ -189,6 +265,60 @@ enum class DiscordStatus(private val displayMessageSupplier: Supplier?) "[Lvl $petLevel] ${colorCodeToRarity(colorCode)} $petName" } ?: "No pet equipped" + }), + + // Dynamic-only + STACKING({ + // Logic for getting the currently held stacking enchant is from Skytils, except for getExtraAttributes() which they got from BiscuitDevelopment + + + fun getExtraAttributes(item: ItemStack?): NBTTagCompound? { + return if (item == null || !item.hasTagCompound()) { + null + } else item.getSubCompound("ExtraAttributes", false) + } + + val extraAttributes = getExtraAttributes(Minecraft.getMinecraft().thePlayer.inventory.getCurrentItem()) + + fun getProgressPercent(amount: Int, levels: List): String { + var currentLevel = 0 + var percent = "" + for (level in levels.indices) { + if (amount > levels[level]) { + currentLevel++ + continue + } + percent = if (amount.toDouble() == 0.0) { + "" + } else { + LorenzUtils.formatPercentage((amount.toDouble() - levels[level - 1]) / (levels[level] - levels[level - 1])) + } + break + } + return percent + } + + var stackingReturn = "" + if (extraAttributes != null) { + val enchantments = extraAttributes.getCompoundTag("enchantments") + var stackingEnchant = "" + for (enchant in stackingEnchants.keys) { + if (extraAttributes.hasKey(stackingEnchants[enchant]?.get("nbtNum").toString())) { + stackingEnchant = enchant + break + } + } + val levels = stackingEnchants[stackingEnchant]?.get("levels") as? List ?: listOf(0) + val level = enchantments.getInteger(stackingEnchant) + val amount = extraAttributes.getInteger(stackingEnchants[stackingEnchant]?.get("nbtNum").toString()) + val stackingPercent = getProgressPercent(amount, levels) + + stackingReturn = + if (stackingPercent == "" || amount == 0) "" // outdated info is useless for AUTO; empty strings are manually ignored + else "${stackingEnchant.firstLetterUppercase()} $level ($stackingPercent)" // Hecatomb 100: (55.55%) + } + stackingReturn + }) ; -- cgit From 64e59b4a917f6d71868f3722f65700a592404388 Mon Sep 17 00:00:00 2001 From: CalMWolfs <94038482+CalMWolfs@users.noreply.github.com> Date: Mon, 19 Jun 2023 19:48:18 +1000 Subject: Merge pull request #241 * BazaarApi searching * Highlight Item * Resetting on purchase and only highlights correct one * adding default value --- .../hannibal2/skyhanni/config/features/Bazaar.java | 5 ++ .../skyhanni/features/bazaar/BazaarApi.kt | 53 +++++++++++++++++++++- .../features/garden/composter/ComposterOverlay.kt | 11 +++-- .../garden/fortuneguide/pages/UpgradePage.kt | 7 +-- .../garden/visitor/GardenVisitorFeatures.kt | 6 +-- .../skyhanni/features/inventory/SackDisplay.kt | 8 +--- .../skyhanni/features/misc/CityProjectFeatures.kt | 7 ++- 7 files changed, 74 insertions(+), 23 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni/config') diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/Bazaar.java b/src/main/java/at/hannibal2/skyhanni/config/features/Bazaar.java index bfc1fdd90..f357e76fd 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/Bazaar.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/Bazaar.java @@ -7,6 +7,11 @@ import io.github.moulberry.moulconfig.annotations.ConfigOption; public class Bazaar { + @Expose + @ConfigOption(name = "Purchase Helper", desc = "Highlights the item you are trying to buy in the Bazaar.") + @ConfigEditorBoolean + public boolean purchaseHelper = true; + @Expose @ConfigOption(name = "Order Helper", desc = "Show visual hints inside the Bazaar Manage Order view when items are ready to pickup or outbid.") @ConfigEditorBoolean diff --git a/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarApi.kt b/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarApi.kt index 85267240e..9d6705da5 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarApi.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarApi.kt @@ -1,12 +1,21 @@ package at.hannibal2.skyhanni.features.bazaar +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.events.GuiContainerEvent import at.hannibal2.skyhanni.events.InventoryCloseEvent import at.hannibal2.skyhanni.events.InventoryOpenEvent +import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.ItemUtils.name +import at.hannibal2.skyhanni.utils.LorenzColor +import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.NEUItems +import at.hannibal2.skyhanni.utils.OSUtils +import at.hannibal2.skyhanni.utils.RenderUtils.highlight import at.hannibal2.skyhanni.utils.StringUtils.removeColor +import net.minecraft.client.gui.inventory.GuiChest +import net.minecraft.inventory.ContainerChest import net.minecraft.item.ItemStack import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import net.minecraftforge.fml.common.gameevent.TickEvent @@ -17,6 +26,7 @@ class BazaarApi { companion object { val holder = BazaarDataHolder() var inBazaarInventory = false + private var currentSearchedItem = "" fun getBazaarDataByName(name: String): BazaarData? = NEUItems.getInternalNameOrNull(name)?.let { getBazaarDataByInternalName(it) } @@ -32,6 +42,16 @@ class BazaarApi { fun isBazaarItem(internalName: String): Boolean { return NEUItems.manager.auctionManager.getBazaarInfo(internalName) != null } + + fun searchForBazaarItem(displayName: String, amount: Int = -1){ + if (!LorenzUtils.inSkyBlock) return + if (NEUItems.neuHasFocus()) return + if (LorenzUtils.noTradeMode) return + if (LorenzUtils.inDungeons || LorenzUtils.inKuudraFight) return + LorenzUtils.sendCommandToServer("bz ${displayName.removeColor()}") + if (amount != -1) OSUtils.copyToClipboard(amount.toString()) + currentSearchedItem = displayName.removeColor() + } } @SubscribeEvent @@ -39,7 +59,6 @@ class BazaarApi { inBazaarInventory = checkIfInBazaar(event) } - @SubscribeEvent fun onTick(event: TickEvent.ClientTickEvent) { if (event.phase != TickEvent.Phase.START) return @@ -50,6 +69,38 @@ class BazaarApi { } } + @SubscribeEvent + fun onBackgroundDrawn(event: GuiContainerEvent.BackgroundDrawnEvent) { + if (!LorenzUtils.inSkyBlock) return + if (!inBazaarInventory) return + if (!SkyHanniMod.feature.bazaar.purchaseHelper) return + if (currentSearchedItem == "") return + + if (event.gui !is GuiChest) return + val guiChest = event.gui + val chest = guiChest.inventorySlots as ContainerChest + + for (slot in chest.inventorySlots) { + if (slot == null) continue + val stack = slot.stack ?: continue + + if (chest.inventorySlots.indexOf(slot) !in 9..44) { + continue + } + + if (stack.displayName.removeColor() == currentSearchedItem) { + slot highlight LorenzColor.GREEN + } + } + } + + @SubscribeEvent + fun onChat(event: LorenzChatEvent) { + if ("\\[Bazaar] (Buy Order Setup!|Bought).*$currentSearchedItem.*".toRegex().matches(event.message.removeColor())) { + currentSearchedItem = "" + } + } + private fun checkIfInBazaar(event: InventoryOpenEvent): Boolean { val returnItem = event.inventorySize - 5 for ((slot, item) in event.inventoryItems) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt index 241f6cbcd..5c67ea67e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt @@ -3,19 +3,23 @@ package at.hannibal2.skyhanni.features.garden.composter import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.data.model.ComposterUpgrade import at.hannibal2.skyhanni.events.* +import at.hannibal2.skyhanni.features.bazaar.BazaarApi import at.hannibal2.skyhanni.features.garden.GardenAPI import at.hannibal2.skyhanni.features.garden.composter.ComposterAPI.getLevel -import at.hannibal2.skyhanni.utils.* import at.hannibal2.skyhanni.utils.ItemUtils.name +import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.LorenzUtils.addSelector import at.hannibal2.skyhanni.utils.LorenzUtils.round import at.hannibal2.skyhanni.utils.LorenzUtils.sortedDesc +import at.hannibal2.skyhanni.utils.NEUItems +import at.hannibal2.skyhanni.utils.NumberUtil import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.NumberUtil.romanToDecimalIfNeeded import at.hannibal2.skyhanni.utils.RenderUtils.renderStringsAndItems import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import at.hannibal2.skyhanni.utils.StringUtils.removeColor +import at.hannibal2.skyhanni.utils.TimeUtils import at.hannibal2.skyhanni.utils.jsonobjects.GardenJson import at.hannibal2.skyhanni.utils.renderables.Renderable import io.github.moulberry.notenoughupdates.NotEnoughUpdates @@ -389,10 +393,9 @@ class ComposterOverlay { val name = itemName.substring(0, 2) + selected + rawItemName list.add(Renderable.link("$name§r §8x${itemsNeeded.addSeparators()} §7(§6$format§7)") { onClick(internalName) - if (LorenzUtils.isControlKeyDown() && !LorenzUtils.noTradeMode) { + if (LorenzUtils.isControlKeyDown()) { inInventory = false - LorenzUtils.sendCommandToServer("bz $rawItemName") - OSUtils.copyToClipboard("${itemsNeeded.toInt()}") + BazaarApi.searchForBazaarItem(itemName, itemsNeeded.toInt()) } }) bigList.add(list) diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/pages/UpgradePage.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/pages/UpgradePage.kt index 36f67eab6..e04c0dc54 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/pages/UpgradePage.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/pages/UpgradePage.kt @@ -1,13 +1,12 @@ package at.hannibal2.skyhanni.features.garden.fortuneguide.pages +import at.hannibal2.skyhanni.features.bazaar.BazaarApi import at.hannibal2.skyhanni.features.garden.fortuneguide.FFGuideGUI import at.hannibal2.skyhanni.features.garden.fortuneguide.FortuneUpgrades import at.hannibal2.skyhanni.utils.GuiRenderUtils import at.hannibal2.skyhanni.utils.ItemUtils.nameWithEnchantment -import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.NEUItems import at.hannibal2.skyhanni.utils.NumberUtil -import at.hannibal2.skyhanni.utils.StringUtils.removeColor import net.minecraft.client.renderer.GlStateManager import net.minecraft.util.MathHelper import java.text.DecimalFormat @@ -38,9 +37,7 @@ class UpgradePage: FFGuideGUI.FFGuidePage() { var formattedUpgrade = upgradeItem.nameWithEnchantment ?: return if (adjustedY + 25 * index - 5 < FFGuideGUI.lastClickedHeight && FFGuideGUI.lastClickedHeight < adjustedY + 25 * index + 10) { FFGuideGUI.lastClickedHeight = 0 - if (!NEUItems.neuHasFocus() && !LorenzUtils.noTradeMode) { - LorenzUtils.sendCommandToServer("bz ${formattedUpgrade.removeColor()}") - } + BazaarApi.searchForBazaarItem(formattedUpgrade, upgrade.itemQuantity) } if (upgrade.itemQuantity != 1) { formattedUpgrade = "$formattedUpgrade §fx${upgrade.itemQuantity}" diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt index 973f122d5..f7fedd18c 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt @@ -4,6 +4,7 @@ import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.data.IslandType import at.hannibal2.skyhanni.data.TitleUtils import at.hannibal2.skyhanni.events.* +import at.hannibal2.skyhanni.features.bazaar.BazaarApi import at.hannibal2.skyhanni.features.garden.CropType.Companion.getByNameOrNull import at.hannibal2.skyhanni.features.garden.GardenAPI import at.hannibal2.skyhanni.features.garden.farming.GardenCropSpeed.getSpeed @@ -175,9 +176,8 @@ class GardenVisitorFeatures { list.add(Renderable.optionalLink("$name §ex${amount.addSeparators()}", { if (Minecraft.getMinecraft().currentScreen is GuiEditSign) { LorenzUtils.setTextIntoSign("$amount") - } else if (!NEUItems.neuHasFocus() && !LorenzUtils.noTradeMode) { - LorenzUtils.sendCommandToServer("bz ${name.removeColor()}") - OSUtils.copyToClipboard("$amount") + } else { + BazaarApi.searchForBazaarItem(name, amount) } }) { GardenAPI.inGarden() && !NEUItems.neuHasFocus() }) diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/SackDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/SackDisplay.kt index 6f5678bc8..acb7d6b67 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/SackDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/SackDisplay.kt @@ -186,9 +186,7 @@ class SackDisplay { add(itemStack) if (!isTrophySack) add(Renderable.optionalLink("${itemName.replace("§k", "")}: ", { - if (!NEUItems.neuHasFocus() && !LorenzUtils.noTradeMode) { - LorenzUtils.sendCommandToServer("bz ${itemName.removeColor()}") - } + BazaarApi.searchForBazaarItem(itemName) }) { !NEUItems.neuHasFocus() }) else add("${itemName.replace("§k", "")}: ") @@ -254,9 +252,7 @@ class SackDisplay { add(" §7- ") add(NEUItems.getItemStack(internalName)) add(Renderable.optionalLink("$name: ", { - if (!NEUItems.neuHasFocus() && !LorenzUtils.noTradeMode) { - LorenzUtils.sendCommandToServer("bz ${name.removeColor().dropLast(1)}") - } + BazaarApi.searchForBazaarItem(name.dropLast(1)) }) { !NEUItems.neuHasFocus() }) add(" ($rough-§a$flawed-§9$fine-§5$flawless)") val price = (roughprice + flawedprice + fineprice + flawlessprice) diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/CityProjectFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/CityProjectFeatures.kt index dee222aa2..d8d18ec6d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/CityProjectFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/CityProjectFeatures.kt @@ -6,6 +6,7 @@ import at.hannibal2.skyhanni.events.GuiContainerEvent import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.InventoryCloseEvent import at.hannibal2.skyhanni.events.InventoryOpenEvent +import at.hannibal2.skyhanni.features.bazaar.BazaarApi import at.hannibal2.skyhanni.features.garden.contest.FarmingContestAPI import at.hannibal2.skyhanni.utils.* import at.hannibal2.skyhanni.utils.ItemUtils.getLore @@ -15,7 +16,6 @@ import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.RenderUtils.highlight import at.hannibal2.skyhanni.utils.RenderUtils.renderStringsAndItems import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher -import at.hannibal2.skyhanni.utils.StringUtils.removeColor import at.hannibal2.skyhanni.utils.renderables.Renderable import net.minecraft.client.Minecraft import net.minecraft.client.gui.inventory.GuiChest @@ -136,9 +136,8 @@ class CityProjectFeatures { list.add(Renderable.optionalLink("$name §ex${amount.addSeparators()}", { if (Minecraft.getMinecraft().currentScreen is GuiEditSign) { LorenzUtils.setTextIntoSign("$amount") - } else if (!NEUItems.neuHasFocus() && !LorenzUtils.noTradeMode) { - LorenzUtils.sendCommandToServer("bz ${name.removeColor()}") - OSUtils.copyToClipboard("$amount") + } else { + BazaarApi.searchForBazaarItem(name, amount) } }) { inInventory && !NEUItems.neuHasFocus() }) -- cgit