aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCow <cow@volloeko.de>2022-10-14 14:03:51 +0200
committerCow <cow@volloeko.de>2022-10-14 14:03:51 +0200
commit544900b1ddcde53cced676a859c2080419ce1a6d (patch)
tree7e842e86f50ad0adc430420cbba386ce70ca2fcc
parent60aa1d536cba463bbe29db88c441b7114d0f5b04 (diff)
downloadCowlection-544900b1ddcde53cced676a859c2080419ce1a6d.tar.gz
Cowlection-544900b1ddcde53cced676a859c2080419ce1a6d.tar.bz2
Cowlection-544900b1ddcde53cced676a859c2080419ce1a6d.zip
Updated quick lookup for item prices and wiki
- added official wiki - replaced item price lookup
-rw-r--r--CHANGELOG.md3
-rw-r--r--README.md2
-rw-r--r--src/main/java/de/cowtipper/cowlection/config/MooConfig.java20
-rw-r--r--src/main/java/de/cowtipper/cowlection/config/gui/MooConfigCategoryScrolling.java2
-rw-r--r--src/main/java/de/cowtipper/cowlection/listener/skyblock/SkyBlockListener.java30
-rw-r--r--src/main/resources/assets/cowlection/lang/en_US.lang6
6 files changed, 44 insertions, 19 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9c9ef3a..7391669 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -26,6 +26,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- `/moo search`: Allow empty search query (= returns all log entries between start and end date)
- `/moo stalkskyblock`: replaced "last played" with "last time *someone* played on the selected profile"
+- Updated quick lookup for item prices and wiki: (`/moo config item`)
+ - wiki: also added official wiki (use <kbd>SHIFT</kbd> to switch between Fandom and official wiki; default wiki key: <kbd>I</kbd> = info)
+ - item prices: replaced stonks.gg with sky.coflnet.com (default key: <kbd>P</kbd> = price)
- (technical change: no longer fire `ClientChatReceivedEvent` when sending a mod-internal chat message, as too many other mods have had problems with it)
- Party Finder Rules Editor: increased character limit per rule from 32 to 255
diff --git a/README.md b/README.md
index ae4e7eb..c7952d5 100644
--- a/README.md
+++ b/README.md
@@ -35,7 +35,7 @@ It is a collection of different features mainly focused on Hypixel SkyBlock.
| Dungeon performance tracker and overlay: Skill score calculation, class milestone tracker, destroyed crypts tracker, and elapsed time indicator | automatically; or with `/moo dungeon` |
| Check how long current world has been loaded (≈ when the server was last restarted) | `/moo worldage` + `/moo config` &rarr; SkyBlock |
| Additional info in various tooltips (e.g. show item age, display pet exp, price per item in an auction, Bestiary overview) | `/moo config` &rarr; SkyBlock &rarr; Tooltip enhancements |
-| Quick lookup for item prices and wiki articles | Wiki: <kbd>I</kbd> *(= Info)*, Prices: <kbd>P</kbd> |
+| Quick lookup for item prices and wiki articles | Prices: <kbd>P</kbd>, Wiki: <kbd>I</kbd> *(= Info; use <kbd>SHIFT</kbd> to switch between Fandom and official wiki)* |
## Download
You can download the compiled .jar files from the [release section](https://github.com/cow-mc/Cowlection/releases).
diff --git a/src/main/java/de/cowtipper/cowlection/config/MooConfig.java b/src/main/java/de/cowtipper/cowlection/config/MooConfig.java
index 0183a76..87f6330 100644
--- a/src/main/java/de/cowtipper/cowlection/config/MooConfig.java
+++ b/src/main/java/de/cowtipper/cowlection/config/MooConfig.java
@@ -12,6 +12,7 @@ import de.cowtipper.cowlection.util.MooChatComponent;
import de.cowtipper.cowlection.util.Utils;
import net.minecraft.client.Minecraft;
import net.minecraft.client.audio.SoundCategory;
+import net.minecraft.client.gui.GuiScreen;
import net.minecraft.command.ICommand;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTBase;
@@ -98,6 +99,7 @@ public class MooConfig {
public static String bestiaryOverviewOrder;
private String[] bestiaryOverviewOrderDefaultValues;
private static int lookupWikiKeyBinding;
+ private static String lookupWikiPreferredWiki;
private static int lookupPriceKeyBinding;
public static boolean lookupItemDirectly;
// Category: SkyBlock Dungeons
@@ -560,6 +562,8 @@ public class MooConfig {
Property propLookupWikiKeyBinding = subCat.addConfigEntry(cfg.get(configCat.getConfigName(),
"lookupWikiKeyBinding", Keyboard.KEY_I, "Key to lookup wiki"));
+ Property propLookupWikiPreferredWiki = subCat.addConfigEntry(cfg.get(configCat.getConfigName(),
+ "lookupWikiPreferredWiki", "unofficial", "Prefer official or unofficial wiki?", new String[]{"unofficial", "official"}));
Property propLookupPriceKeyBinding = subCat.addConfigEntry(cfg.get(configCat.getConfigName(),
"lookupPriceKeyBinding", Keyboard.KEY_P, "Key to lookup item price"));
@@ -788,6 +792,7 @@ public class MooConfig {
bazaarConnectGraphsLineWidth = propBazaarConnectGraphsLineWidth.getInt();
bestiaryOverviewOrder = propBestiaryOverviewOrder.getString();
lookupWikiKeyBinding = propLookupWikiKeyBinding.getInt();
+ lookupWikiPreferredWiki = propLookupWikiPreferredWiki.getString();
lookupPriceKeyBinding = propLookupPriceKeyBinding.getInt();
lookupItemDirectly = propLookupItemDirectly.getBoolean();
// Category: SkyBlock Dungeons
@@ -881,6 +886,7 @@ public class MooConfig {
propBazaarConnectGraphsLineWidth.set(bazaarConnectGraphsLineWidth);
propBestiaryOverviewOrder.set(bestiaryOverviewOrder);
propLookupWikiKeyBinding.set(lookupWikiKeyBinding);
+ propLookupWikiPreferredWiki.set(lookupWikiPreferredWiki);
propLookupPriceKeyBinding.set(lookupPriceKeyBinding);
propLookupItemDirectly.set(lookupItemDirectly);
// Category: SkyBlock Dungeons
@@ -1103,7 +1109,21 @@ public class MooConfig {
return tooltipToggleKeyBinding > 0 && Keyboard.isKeyDown(tooltipToggleKeyBinding);
}
+ /**
+ * @return true if unofficial wiki is preferred but shift isn't pressed, or if unofficial wiki isn't preferred and shift is pressed
+ */
public static boolean isLookupWikiKeyBindingPressed() {
+ return isLookupAnyWikiKeyBindingPressed() && ("unofficial".equals(lookupWikiPreferredWiki) ^ GuiScreen.isShiftKeyDown());
+ }
+
+ /**
+ * @return true if official wiki is preferred but shift isn't pressed, or if official wiki isn't preferred and shift is pressed
+ */
+ public static boolean isLookupOfficialWikiKeyBindingPressed() {
+ return isLookupAnyWikiKeyBindingPressed() && ("official".equals(lookupWikiPreferredWiki) ^ GuiScreen.isShiftKeyDown());
+ }
+
+ private static boolean isLookupAnyWikiKeyBindingPressed() {
return lookupWikiKeyBinding > 0 && Keyboard.isKeyDown(lookupWikiKeyBinding);
}
diff --git a/src/main/java/de/cowtipper/cowlection/config/gui/MooConfigCategoryScrolling.java b/src/main/java/de/cowtipper/cowlection/config/gui/MooConfigCategoryScrolling.java
index 7c516c6..fd3f0b1 100644
--- a/src/main/java/de/cowtipper/cowlection/config/gui/MooConfigCategoryScrolling.java
+++ b/src/main/java/de/cowtipper/cowlection/config/gui/MooConfigCategoryScrolling.java
@@ -59,7 +59,7 @@ public class MooConfigCategoryScrolling extends GuiListExtended {
this.mc = mc;
listEntriesPreviews = new TreeMap<>();
- newConfigOptions = Sets.newHashSet("chestAnalyzerShowNpcItems");
+ newConfigOptions = Sets.newHashSet("chestAnalyzerShowNpcItems", "lookupWikiKeyBinding", "lookupWikiPreferredWiki", "lookupPriceKeyBinding");
explanations = new HashMap<>();
listEntries = new ArrayList<>();
}
diff --git a/src/main/java/de/cowtipper/cowlection/listener/skyblock/SkyBlockListener.java b/src/main/java/de/cowtipper/cowlection/listener/skyblock/SkyBlockListener.java
index 4f9b386..b6f05eb 100644
--- a/src/main/java/de/cowtipper/cowlection/listener/skyblock/SkyBlockListener.java
+++ b/src/main/java/de/cowtipper/cowlection/listener/skyblock/SkyBlockListener.java
@@ -91,6 +91,8 @@ public class SkyBlockListener {
ItemLookupType itemLookupType;
if (MooConfig.isLookupWikiKeyBindingPressed()) {
itemLookupType = ItemLookupType.WIKI;
+ } else if (MooConfig.isLookupOfficialWikiKeyBindingPressed()) {
+ itemLookupType = ItemLookupType.OFFICIAL_WIKI;
} else if (MooConfig.isLookupPriceKeyBindingPressed()) {
itemLookupType = ItemLookupType.PRICE;
} else {
@@ -105,10 +107,11 @@ public class SkyBlockListener {
ItemStack itemStack = hoveredSlot.getStack();
NBTTagCompound extraAttributes = itemStack.getSubCompound("ExtraAttributes", false);
+ String sbId = null;
if (extraAttributes != null && extraAttributes.hasKey("id")) {
// seems to be a SkyBlock item
- String sbId = extraAttributes.getString("id");
- if (itemLookupType == ItemLookupType.WIKI || (/* itemLookupType == ItemLookupType.PRICE && */ !DataHelper.AMBIGUOUS_ITEM_IDS.contains(sbId) && !sbId.contains("_GENERATOR_"))) {
+ sbId = extraAttributes.getString("id");
+ if (itemLookupType == ItemLookupType.WIKI || itemLookupType == ItemLookupType.OFFICIAL_WIKI || (/* itemLookupType == ItemLookupType.PRICE && */ !DataHelper.AMBIGUOUS_ITEM_IDS.contains(sbId) && !sbId.contains("_GENERATOR_"))) {
// open item price info or open wiki entry
Pair<String, String> sbItemBaseName = Utils.extractSbItemBaseName(itemStack.getDisplayName(), extraAttributes, false);
itemBaseName = sbItemBaseName.first();
@@ -146,7 +149,7 @@ public class SkyBlockListener {
}
}
if (itemBaseName != null) {
- String link = buildLink(EnumChatFormatting.getTextWithoutFormattingCodes(itemBaseName).trim() + querySuffix, itemLookupType);
+ String link = itemLookupType.buildLink(sbId, EnumChatFormatting.getTextWithoutFormattingCodes(itemBaseName).trim() + querySuffix);
if (link == null) {
main.getChatHelper().sendMessage(EnumChatFormatting.RED, "Error: Your operating system doesn't support UTF-8? Huh?");
return;
@@ -775,14 +778,6 @@ public class SkyBlockListener {
}
}
- private String buildLink(String itemName, ItemLookupType itemLookupType) {
- try {
- return itemLookupType.getBaseUrl() + URLEncoder.encode(itemName, "UTF-8");
- } catch (UnsupportedEncodingException ignored) {
- }
- return null;
- }
-
private boolean openLink(String link) {
try {
Desktop.getDesktop().browse(new URI(link));
@@ -800,8 +795,9 @@ public class SkyBlockListener {
}
private enum ItemLookupType {
- WIKI("wiki", "https://hypixel-skyblock.fandom.com/wiki/Special:Search?search="),
- PRICE("price info", "https://stonks.gg/search?input="),
+ OFFICIAL_WIKI("official wiki", "https://wiki.hypixel.net/?search="),
+ WIKI("unofficial wiki", "https://hypixel-skyblock.fandom.com/wiki/Special:Search?search="),
+ PRICE("price info", "https://sky.coflnet.com/item/"),
INVALID("nothing", "https://google.com/search?q=");
private final String description;
@@ -816,8 +812,12 @@ public class SkyBlockListener {
return description;
}
- public String getBaseUrl() {
- return baseUrl;
+ public String buildLink(String itemId, String itemName) {
+ try {
+ return this.baseUrl + (this == PRICE ? itemId : URLEncoder.encode(itemName, "UTF-8"));
+ } catch (UnsupportedEncodingException ignored) {
+ }
+ return null;
}
}
}
diff --git a/src/main/resources/assets/cowlection/lang/en_US.lang b/src/main/resources/assets/cowlection/lang/en_US.lang
index 2691fe9..5634376 100644
--- a/src/main/resources/assets/cowlection/lang/en_US.lang
+++ b/src/main/resources/assets/cowlection/lang/en_US.lang
@@ -89,9 +89,11 @@ cowlection.config.bazaarConnectGraphsLineWidth.tooltip=Width of the line drawn t
cowlection.config.bestiaryOverviewOrder=§7Bestiary: §roverview order by...
cowlection.config.bestiaryOverviewOrder.tooltip=Add §6§lBestiary Overview§r to the SkyBlock Bestiary (§e/bestiary§7 or §e/be§r).\nThis setting changes the order of the Bestiary Overview entries, §7which can also be changed by left-clicking the area/location icon in the Bestiary GUI §7(§e/be§7).
cowlection.config.lookupWikiKeyBinding=Key binding: lookup item wiki
-cowlection.config.lookupWikiKeyBinding.tooltip=Hover over an item in any inventory and press keybinding to open the item's wiki article.\n§7§oAccesses §e§ohypixel-skyblock.fandom.com\n§7§odefault key: §e§oI = info\n\n§7§odisable key binding: §e§oset key binding to §lESC
+cowlection.config.lookupWikiKeyBinding.tooltip=Hover over an item in any inventory and press keybinding to open the item's wiki article.\n§7§oAccesses §e§ohypixel-skyblock.fandom.com §7§oor §e§owiki.hypixel.net\n§7§odefault key: §e§oI = info §7§o(+ optionally §e§oSHIFT§7§o: see setting below)\n\n§7§odisable key binding: §e§oset key binding to §lESC
+cowlection.config.lookupWikiPreferredWiki=Prefer which wiki?
+cowlection.config.lookupWikiPreferredWiki.tooltip=Official wiki: §ewiki.hypixel.net\n§rUnofficial wiki: §ehypixel-skyblock.fandom.com\n\n§7The §6§opreferred§7 wiki can be used by pressing the §ewiki lookup keybinding§7.\n§7The §6§ounpreferred§7 wiki can be used by pressing the §ewiki lookup keybinding §6+ SHIFT§7.
cowlection.config.lookupPriceKeyBinding=Key binding: lookup item price
-cowlection.config.lookupPriceKeyBinding.tooltip=Hover over an item in any inventory and press keybinding to open the item's price details.\n§7§oAccesses §e§ostonks.gg\n§7§odefault key: §e§oP = price\n\n§7§odisable key binding: §e§oset key binding to §lESC
+cowlection.config.lookupPriceKeyBinding.tooltip=Hover over an item in any inventory and press keybinding to open the item's price details.\n§7§oAccesses §e§osky.coflnet.com\n§7§odefault key: §e§oP = price\n\n§7§odisable key binding: §e§oset key binding to §lESC
cowlection.config.lookupItemDirectly=Open website directly?
cowlection.config.lookupItemDirectly.tooltip=Should the corresponding website be opened immediately (§a✔§r) or sent as a chat message (§c✘§r)?
cowlection.config.showItemQualityAndFloor=Show item quality + obtained floor