From 807a22172f0fd09a89f1e72e35e5eb7fb6816881 Mon Sep 17 00:00:00 2001 From: Adam Date: Wed, 9 Dec 2020 19:49:01 -0500 Subject: [PATCH] barrows: fix reward potential color overlay The reward text color is meant to show what is the optimal reward percent for money, assuming that blood runes are best, and death runes are second best. The percentage thresholds however were incorrect. --- .../barrows/BarrowsBrotherSlainOverlay.java | 39 ++++++++++++++++--- 1 file changed, 34 insertions(+), 5 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/barrows/BarrowsBrotherSlainOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/barrows/BarrowsBrotherSlainOverlay.java index b3cceb6d66..22103f5e79 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/barrows/BarrowsBrotherSlainOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/barrows/BarrowsBrotherSlainOverlay.java @@ -83,13 +83,42 @@ public class BarrowsBrotherSlainOverlay extends OverlayPanel .build()); } - float rewardPercent = client.getVar(Varbits.BARROWS_REWARD_POTENTIAL) / 10.0f; + final int rewardPotential = rewardPotential(); + float rewardPercent = rewardPotential / 10.12f; panelComponent.getChildren().add(LineComponent.builder() - .left("Potential") - .right(rewardPercent != 0 ? rewardPercent + "%" : "0%") - .rightColor(rewardPercent >= 73.0f && rewardPercent <= 88.0f ? Color.GREEN : rewardPercent < 65.6f ? Color.WHITE : Color.YELLOW) - .build()); + .left("Potential") + .right(rewardPercent != 0 ? rewardPercent + "%" : "0%") + .rightColor(rewardPotential >= 756 && rewardPotential < 881 ? Color.GREEN : rewardPotential < 631 ? Color.WHITE : Color.YELLOW) + .build()); return super.render(graphics); } + + /** + * Compute the barrows reward potential. Potential rewards are based off of the amount of + * potential. + *

+ * The reward potential thresholds are as follows: + * Mind rune - 381 + * Chaos rune - 506 + * Death rune - 631 + * Blood rune - 756 + * Bolt rack - 881 + * Half key - 1006 + * Dragon med - 1012 + * + * @return potential, 0-1012 inclusive + * @see source + */ + private int rewardPotential() + { + // this is from [proc,barrows_overlay_reward] + int brothers = client.getVar(Varbits.BARROWS_KILLED_AHRIM) + + client.getVar(Varbits.BARROWS_KILLED_DHAROK) + + client.getVar(Varbits.BARROWS_KILLED_GUTHAN) + + client.getVar(Varbits.BARROWS_KILLED_KARIL) + + client.getVar(Varbits.BARROWS_KILLED_TORAG) + + client.getVar(Varbits.BARROWS_KILLED_VERAC); + return client.getVar(Varbits.BARROWS_REWARD_POTENTIAL) + brothers * 2; + } }