aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/de/cowtipper/cowlection/config
diff options
context:
space:
mode:
authorCow <cow@volloeko.de>2021-03-20 00:50:13 +0100
committerCow <cow@volloeko.de>2021-03-20 02:10:31 +0100
commit27811afe485ce639bbc920d885fb98d4b052bcc6 (patch)
tree8814e2900b183622e92e980e042b9013f1928131 /src/main/java/de/cowtipper/cowlection/config
parente09fc0d1f07da1fe5def7cb80c2128cf71a6ad4f (diff)
downloadCowlection-27811afe485ce639bbc920d885fb98d4b052bcc6.tar.gz
Cowlection-27811afe485ce639bbc920d885fb98d4b052bcc6.tar.bz2
Cowlection-27811afe485ce639bbc920d885fb98d4b052bcc6.zip
Added Auction house related features
- show price for each lvl 1 enchantment book required to craft a higher tier book - mark sold/ended/expired auctions
Diffstat (limited to 'src/main/java/de/cowtipper/cowlection/config')
-rw-r--r--src/main/java/de/cowtipper/cowlection/config/MooConfig.java41
-rw-r--r--src/main/java/de/cowtipper/cowlection/config/gui/MooConfigCategoryScrolling.java7
2 files changed, 46 insertions, 2 deletions
diff --git a/src/main/java/de/cowtipper/cowlection/config/MooConfig.java b/src/main/java/de/cowtipper/cowlection/config/MooConfig.java
index 533a767..a19218e 100644
--- a/src/main/java/de/cowtipper/cowlection/config/MooConfig.java
+++ b/src/main/java/de/cowtipper/cowlection/config/MooConfig.java
@@ -77,6 +77,8 @@ public class MooConfig {
private static String showPetExp;
private static String numeralSystem;
private static String tooltipAuctionHousePriceEach;
+ public static String[] tooltipAuctionHousePriceEachEnchantments;
+ private static String auctionHouseMarkEndedAuctions;
private static String bazaarConnectGraphsNodes;
public static int bazaarConnectGraphsLineWidth;
public static String bestiaryOverviewOrder;
@@ -112,6 +114,7 @@ public class MooConfig {
private final Cowlection main;
private Property propMooCmdAlias;
private Property propTabCompletableNamesCommands;
+ private Property propTooltipAuctionHousePriceEachEnchantments;
private List<Property> logSearchProperties;
public MooConfig(Cowlection main, Configuration configuration) {
@@ -362,7 +365,7 @@ public class MooConfig {
"notifyServerAge", true, "Show server age notifications?"));
// Sub-Category: Tooltip enhancements
- subCat = configCat.addSubCategory("Tooltip enhancements");
+ subCat = configCat.addSubCategory("Tooltip & GUI enhancements");
Property propTooltipToggleKeyBinding = subCat.addConfigEntry(cfg.get(configCat.getConfigName(),
"tooltipToggleKeyBinding", Keyboard.KEY_LSHIFT, "Key to toggle tooltip"));
@@ -399,6 +402,13 @@ public class MooConfig {
Property propTooltipAuctionHousePriceEach = subCat.addConfigEntry(cfg.get(configCat.getConfigName(),
"tooltipAuctionHousePriceEach", "always", "Add price per item if multiple items are bought or sold", new String[]{"always", "key press", "never"}), ahItemPreview);
+ propTooltipAuctionHousePriceEachEnchantments = subCat.addConfigEntry(cfg.get(configCat.getConfigName(),
+ "tooltipAuctionHousePriceEachEnchantments", new String[]{"overload", "rejuvenate"}, "Price per lvl 1 book enchantment")
+ .setValidationPattern(Pattern.compile("^[A-Za-z_ -]+$")));
+
+ Property propAuctionHouseMarkEndedAuctions = subCat.addConfigEntry(cfg.get(configCat.getConfigName(),
+ "auctionHouseMarkEndedAuctions", "a letter", "Mark ended auctions", new String[]{"a letter", "a word", "disabled"}));
+
MooConfigPreview bazaarGraphPreview = new MooConfigPreview(MooConfigPreview.createDemoItem("paper", "§aBuy Price §731d §77d §e24h", new String[]{
"§7The price at which buy orders have been filled.", "",
"§r┌----------------------------------------------┐", "§r│§66. 1k§r+§bxxxxxx§8·································§bxx§r│",
@@ -571,6 +581,8 @@ public class MooConfig {
String mooCmdAliasPreChange = mooCmdAlias;
boolean modifiedTabCompletableCommandsList = false;
String[] tabCompletableCommandsPreChange = tabCompletableNamesCommands != null ? tabCompletableNamesCommands.clone() : null;
+ boolean modifiedTooltipAuctionHousePriceEachEnchantments = false;
+ String[] tooltipAuctionHousePriceEachEnchantmentsPreChange = tooltipAuctionHousePriceEachEnchantments != null ? tooltipAuctionHousePriceEachEnchantments.clone() : null;
if (readFieldsFromConfig) {
// Category: General
configGuiExplanations = propConfigGuiExplanations.getString();
@@ -600,6 +612,8 @@ public class MooConfig {
showPetExp = propShowPetExp.getString();
numeralSystem = propNumeralSystem.getString();
tooltipAuctionHousePriceEach = propTooltipAuctionHousePriceEach.getString();
+ tooltipAuctionHousePriceEachEnchantments = propTooltipAuctionHousePriceEachEnchantments.getStringList();
+ auctionHouseMarkEndedAuctions = propAuctionHouseMarkEndedAuctions.getString();
bazaarConnectGraphsNodes = propBazaarConnectGraphsNodes.getString();
bazaarConnectGraphsLineWidth = propBazaarConnectGraphsLineWidth.getInt();
bestiaryOverviewOrder = propBestiaryOverviewOrder.getString();
@@ -629,13 +643,15 @@ public class MooConfig {
dungMarkPartiesWithMage = propDungMarkPartiesWithMage.getString();
dungMarkPartiesWithTank = propDungMarkPartiesWithTank.getString();
-
if (!StringUtils.equals(mooCmdAliasPreChange, mooCmdAlias)) {
modifiedMooCmdAlias = true;
}
if (!Arrays.equals(tabCompletableCommandsPreChange, tabCompletableNamesCommands)) {
modifiedTabCompletableCommandsList = true;
}
+ if (!Arrays.equals(tooltipAuctionHousePriceEachEnchantmentsPreChange, tooltipAuctionHousePriceEachEnchantments)) {
+ modifiedTooltipAuctionHousePriceEachEnchantments = true;
+ }
}
// Category: General
@@ -666,6 +682,8 @@ public class MooConfig {
propShowPetExp.set(showPetExp);
propNumeralSystem.set(numeralSystem);
propTooltipAuctionHousePriceEach.set(tooltipAuctionHousePriceEach);
+ propTooltipAuctionHousePriceEachEnchantments.set(tooltipAuctionHousePriceEachEnchantments);
+ propAuctionHouseMarkEndedAuctions.set(auctionHouseMarkEndedAuctions);
propBazaarConnectGraphsNodes.set(bazaarConnectGraphsNodes);
propBazaarConnectGraphsLineWidth.set(bazaarConnectGraphsLineWidth);
propBestiaryOverviewOrder.set(bestiaryOverviewOrder);
@@ -736,6 +754,15 @@ public class MooConfig {
propTabCompletableNamesCommands.set(tabCompletableNamesCommands);
}
}
+ if (modifiedTooltipAuctionHousePriceEachEnchantments) {
+ for (int i = 0, enchantmentsLength = tooltipAuctionHousePriceEachEnchantments.length; i < enchantmentsLength; i++) {
+ // standardize enchantment names to match their names in the NBT data
+ String enchantmentName = tooltipAuctionHousePriceEachEnchantments[i];
+ String standardizedEnchantmentName = enchantmentName.toLowerCase().replace(' ', '_');
+ tooltipAuctionHousePriceEachEnchantments[i] = standardizedEnchantmentName;
+ }
+ propTooltipAuctionHousePriceEachEnchantments.set(tooltipAuctionHousePriceEachEnchantments);
+ }
cfg.save();
}
@@ -803,6 +830,10 @@ public class MooConfig {
return Setting.get(tooltipAuctionHousePriceEach);
}
+ public static Setting getMarkAuctionHouseEndedAuctions() {
+ return Setting.get(auctionHouseMarkEndedAuctions);
+ }
+
public static Setting getBazaarConnectGraphsNodes() {
return Setting.get(bazaarConnectGraphsNodes);
}
@@ -965,6 +996,10 @@ public class MooConfig {
return logSearchProperties;
}
+ public Property getTooltipAuctionHousePriceEachEnchantmentsProperty() {
+ return propTooltipAuctionHousePriceEachEnchantments;
+ }
+
public class ConfigEventHandler {
@SubscribeEvent(priority = EventPriority.NORMAL)
@@ -989,6 +1024,7 @@ public class MooConfig {
return TOOLTIP;
case "in chat":
case "as text":
+ case "a word":
return TEXT;
case "hidden":
case "never":
@@ -997,6 +1033,7 @@ public class MooConfig {
case "on SkyBlock":
case "key press":
case "as tooltip ①§0⬛":
+ case "a letter":
return SPECIAL;
default:
return UNKNOWN;
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 7e8f3eb..27e6914 100644
--- a/src/main/java/de/cowtipper/cowlection/config/gui/MooConfigCategoryScrolling.java
+++ b/src/main/java/de/cowtipper/cowlection/config/gui/MooConfigCategoryScrolling.java
@@ -133,6 +133,13 @@ public class MooConfigCategoryScrolling extends GuiListExtended {
Cowlection.MODID, "cowlectionMooCmdAlias", false, false,
EnumChatFormatting.GOLD + "Press Done to save changes. " + EnumChatFormatting.RED + "Requires a game restart to take effect!"))));
continue;
+ } else if (configEntry.equals(Cowlection.getInstance().getConfig().getTooltipAuctionHousePriceEachEnchantmentsProperty())) {
+ this.listEntries.add(new GuiSwitchEntry("tooltipAuctionHousePriceEachEnchantments", "➡ modify", () ->
+ mc.displayGuiScreen(new GuiConfig(MooConfigCategoryScrolling.this.parent,
+ Lists.newArrayList(new ConfigElement(Cowlection.getInstance().getConfig().getTooltipAuctionHousePriceEachEnchantmentsProperty())),
+ Cowlection.MODID, "cowlectionTooltipAuctionHousePriceEachEnchantments", false, false,
+ EnumChatFormatting.GOLD + "Press 2x Done to save changes. " + EnumChatFormatting.LIGHT_PURPLE + EnumChatFormatting.BOLD + "Ultimate" + EnumChatFormatting.RESET + EnumChatFormatting.RED + " and " + EnumChatFormatting.YELLOW + "Turbo-Crop" + EnumChatFormatting.RED + " enchants are always included!"))));
+ continue;
} else if (configEntry.getValidValues() != null && configEntry.getValidValues().length > 0) {
if ("dungOverlayTextBorder".equals(configEntry.getName())) {
// special case: Dung Performance Overlay: show preview on button click