public enum Potion {
IRIT(259, 101),
TOADFLAX(2998, 3002),
AVENTOE(261, 103),
KWUARM(263, 105),
CANDENTINE(265, 107),
LANTADYME(2481, 2483);
public final int HerbPrice;
public final int Margin;
public final int UnfinishedPrice;
public final String Name;
public final int HerbId;
public final int UnfinishedId;
private final String UnfinishedName;
Potion(int herbId, int unfinishedId) {
Name = name().substring(0,1).toUpperCase() + name().substring(1).toLowerCase();
UnfinishedName = Name + " potion (unf)";
HerbId = herbId;
UnfinishedId = unfinishedId;
// TODO: you should make your GE lookup class methods static so you dont need to instiantiate this.
GrandExchange ge = new GrandExchange();
HerbPrice = Math.max(ge.getBuyingPrice(HerbId), ge.getSellingPrice(HerbId));
UnfinishedPrice = Math.min(ge.getBuyingPrice(UnfinishedId), ge.getSellingPrice(UnfinishedId));
Margin = UnfinishedPrice - HerbPrice;
}
}
// here is how you would get the current potion you are using
Potion highestMarginPotion = Arrays.stream(Potion.values()).max(Comparator.comparingInt(p -> p.Margin)).get();
OK I understand everything so far. But how would I be able to call the price of for example the herb of the highestMarginPotion?