diff --git a/README.md b/README.md index 82948b5..fa5a4d3 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,13 @@ ### Changelog +#### V1.7.0 +* Fixes stations other than the first in a batch being highlighted even with the config toggled off +* Fixes the vanilla UI enhancement for players that are boosting their herblore levels +* Adds colored inventory tags +* Improves how the `by station` potion order works to prioritize concentrate last to avoid missclicks +* Adds a `shortest past` potion order option + #### V1.6.0 * Adds support for potion order reordering in the interface. For now, the only available options are: Vanilla (default) & By Station type * Customizable notifications for digweed spawns diff --git a/build.gradle b/build.gradle index 51e0d55..fd2025a 100644 --- a/build.gradle +++ b/build.gradle @@ -24,7 +24,7 @@ dependencies { } group = 'work.fking.rlplugins' -version = '1.6.0' +version = '1.7.0' tasks.withType(JavaCompile) { options.encoding = 'UTF-8' diff --git a/src/main/java/work/fking/masteringmixology/MasteringMixologyPlugin.java b/src/main/java/work/fking/masteringmixology/MasteringMixologyPlugin.java index 0daaa8d..b957f36 100644 --- a/src/main/java/work/fking/masteringmixology/MasteringMixologyPlugin.java +++ b/src/main/java/work/fking/masteringmixology/MasteringMixologyPlugin.java @@ -204,8 +204,17 @@ public void onConfigChanged(ConfigChanged event) { clientThread.invokeLater(this::updatePotionOrders); } - if (!config.highlightStations()) { - unHighlightAllStations(); + if (event.getKey().equals("highlightStations")) { + if (!config.highlightStations()) { + unHighlightAllStations(); + } else { + clientThread.invokeLater(this::tryHighlightNextStation); + } + } + + if (event.getKey().equals("displayResin")) { + // Trigger the potion order update to refresh the resin display + clientThread.invokeLater(this::triggerPotionOrderUpdate); } if (!config.highlightDigWeed()) { @@ -343,7 +352,7 @@ public void onVarbitChanged(VarbitChanged event) { } else if (varbitId == VARBIT_AGITATOR_PROGRESS) { if (agitatorQuickActionTicks == 2) { // quick action was triggered two ticks ago, so it's now too late - resetDefaultHighlight(AlchemyObject.AGITATOR); + resetStationHighlight(AlchemyObject.AGITATOR); agitatorQuickActionTicks = 0; } if (agitatorQuickActionTicks == 1) { @@ -351,26 +360,26 @@ public void onVarbitChanged(VarbitChanged event) { } if (value < previousAgitatorProgess) { // progress was set back due to a quick action failure - resetDefaultHighlight(AlchemyObject.AGITATOR); + resetStationHighlight(AlchemyObject.AGITATOR); } previousAgitatorProgess = value; } else if (varbitId == VARBIT_ALEMBIC_PROGRESS) { if (alembicQuickActionTicks == 1) { // quick action was triggered last tick, so it's now too late - resetDefaultHighlight(AlchemyObject.ALEMBIC); + resetStationHighlight(AlchemyObject.ALEMBIC); alembicQuickActionTicks = 0; } if (value < previousAlembicProgress) { // progress was set back due to a quick action failure - resetDefaultHighlight(AlchemyObject.ALEMBIC); + resetStationHighlight(AlchemyObject.ALEMBIC); } previousAlembicProgress = value; } else if (varbitId == VARBIT_AGITATOR_QUICKACTION) { // agitator quick action was just successfully popped - resetDefaultHighlight(AlchemyObject.AGITATOR); + resetStationHighlight(AlchemyObject.AGITATOR); } else if (varbitId == VARBIT_ALEMBIC_QUICKACTION) { // alembic quick action was just successfully popped - resetDefaultHighlight(AlchemyObject.ALEMBIC); + resetStationHighlight(AlchemyObject.ALEMBIC); } else if (varpId == VARP_MOX_RESIN || varpId == VARP_AGA_RESIN || varpId == VARP_LYE_RESIN) { goalInfoBoxOverlay.markDataAsDirty(); } @@ -424,16 +433,19 @@ private void updatePotionOrdersComponent(Widget baseWidget) { return; } + int indexOffset = 0; for (int i = 0; i < potionOrders.size(); i++) { var order = potionOrders.get(i); - var orderGraphic = children[order.idx() * 2 + 1]; - var orderText = children[order.idx() * 2 + 2]; + var orderGraphic = children[order.idx() * 2 + 1 + indexOffset]; + var orderText = children[order.idx() * 2 + 2 + indexOffset]; // If anyone still has orders they don't have the herblore level to deliver there's an extra RECTANGLE component which // causes the idx calculations to select the wrong components if (orderGraphic.getType() != WidgetType.GRAPHIC || orderText.getType() != WidgetType.TEXT) { - continue; + indexOffset++; + orderGraphic = children[order.idx() * 2 + 1 + indexOffset]; + orderText = children[order.idx() * 2 + 2 + indexOffset]; } var builder = new StringBuilder(orderText.getText()); @@ -514,7 +526,7 @@ public void highlightObject(AlchemyObject alchemyObject, Color color) { } } - public void resetDefaultHighlight(AlchemyObject alchemyObject) { + public void resetStationHighlight(AlchemyObject alchemyObject) { if (config.highlightStations()) { highlightObject(alchemyObject, config.stationHighlightColor()); } @@ -558,6 +570,10 @@ private void updatePotionOrders() { LOGGER.debug("Sorted orders: {}", potionOrders); } + triggerPotionOrderUpdate(); + } + + public void triggerPotionOrderUpdate() { // Trigger a fake varbit update to force run the clientscript proc var varbitType = client.getVarbit(VARBIT_POTION_ORDER_1); @@ -597,6 +613,9 @@ private void tryFulfillOrder(PotionType potionType, PotionModifier modifier) { } private void tryHighlightNextStation() { + if (!config.highlightStations()) { + return; + } var inventory = client.getItemContainer(InventoryID.INVENTORY); if (inventory == null) {