Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove potion order highlighting strategies #63

Merged
merged 1 commit into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.