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.
This commit is contained in:
Adam
2020-12-09 19:49:01 -05:00
parent 096f457d9f
commit 807a22172f

View File

@@ -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.
* <p>
* 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 <a href="https://twitter.com/jagexkieren/status/705428283509366785?lang=en">source</a>
*/
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;
}
}