Skip to content

Commit

Permalink
remove potion order highlighting strategies
Browse files Browse the repository at this point in the history
  • Loading branch information
hex-agon committed Oct 9, 2024
1 parent f53ee9f commit cbb7258
Show file tree
Hide file tree
Showing 7 changed files with 4 additions and 203 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,6 @@ public interface MasteringMixologyConfig extends Config {
)
String HIGHLIGHTS = "Highlights";

@ConfigItem(
keyName = "strategy",
name = "Strategy",
description = "Selects the potion order highlighting strategy",
position = 1
)
default Strategy strategy() {
return Strategy.FAVOR_EXPERIENCE;
}

@ConfigItem(
keyName = "highlightLevers",
name = "Highlight levers",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import net.runelite.client.ui.overlay.OverlayManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import work.fking.masteringmixology.evaluator.PotionOrderEvaluator.EvaluatorContext;

import javax.inject.Inject;
import java.awt.Color;
Expand Down Expand Up @@ -105,7 +104,6 @@ public class MasteringMixologyPlugin extends Plugin {

private final Map<AlchemyObject, HighlightedObject> highlightedObjects = new LinkedHashMap<>();
private List<PotionOrder> potionOrders = Collections.emptyList();
private PotionOrder bestPotionOrder;
private boolean inLab = false;

private PotionType alembicPotionType;
Expand Down Expand Up @@ -394,11 +392,10 @@ public void onScriptPostFired(ScriptPostFired event) {
if (textComponents.size() < 4) {
return;
}
var bestPotionOrderIdx = bestPotionOrder != null ? bestPotionOrder.idx() : -1;

for (var order : potionOrders) {
// The first text widget is always the interface title 'Potion Orders'
appendPotionRecipe(textComponents.get(order.idx()), order.idx(), bestPotionOrderIdx == order.idx(), order.fulfilled());
appendPotionRecipe(textComponents.get(order.idx()), order.idx(), order.fulfilled());
}
}

Expand Down Expand Up @@ -482,18 +479,7 @@ private void unHighlightLevers() {
private void updatePotionOrders() {
LOGGER.debug("Updating potion orders");
potionOrders = getPotionOrders();
var strategy = config.strategy();

if (strategy != Strategy.NONE) {
var evaluatorContext = new EvaluatorContext(
potionOrders,
client.getVarpValue(VARP_LYE_RESIN),
client.getVarpValue(VARP_AGA_RESIN),
client.getVarpValue(VARP_MOX_RESIN)
);
bestPotionOrder = strategy.evaluator().evaluate(evaluatorContext);
LOGGER.debug("Best potion order: {}", bestPotionOrder);
}

// Trigger a fake varbit update to force run the clientscript proc
var varbitType = client.getVarbit(VARBIT_POTION_ORDER_1);

Expand All @@ -515,19 +501,13 @@ private List<Widget> findTextComponents(Widget parent) {
return textComponents;
}

private void appendPotionRecipe(Widget component, int orderIdx, boolean highlight, boolean fulfilled) {
private void appendPotionRecipe(Widget component, int orderIdx, boolean fulfilled) {
var potionType = getPotionType(orderIdx);

if (potionType == null) {
return;
}
var builder = new StringBuilder();

if (highlight) {
builder.append("<col=00ff00>").append(component.getText()).append("</col>");
} else {
builder.append(component.getText());
}
var builder = new StringBuilder(component.getText());

if (fulfilled) {
builder.append(" (<col=00ff00>done!</col>)");
Expand Down
33 changes: 0 additions & 33 deletions src/main/java/work/fking/masteringmixology/Strategy.java

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit cbb7258

Please sign in to comment.