Skip to content

Commit

Permalink
Merge branch 'master' into goal-tracking
Browse files Browse the repository at this point in the history
  • Loading branch information
BlueSoapTurtle committed Nov 18, 2024
2 parents 4358ba3 + bcca634 commit a6ffe17
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 13 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ dependencies {
}

group = 'work.fking.rlplugins'
version = '1.6.0'
version = '1.7.0'

tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down Expand Up @@ -343,34 +352,34 @@ 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) {
agitatorQuickActionTicks = 2;
}
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();
}
Expand Down Expand Up @@ -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());

Expand Down Expand Up @@ -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());
}
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit a6ffe17

Please sign in to comment.