item charges: fix rof tracking with varrock platebody
When the varrock armour effect triggers it will smelt two bars at once, using two charges, unless there is only one ore remaining where it will use only one charge. Co-authored-by: Jason Barr <58792686+JBarr2710@users.noreply.github.com>
This commit is contained in:
@@ -89,6 +89,7 @@ public class ItemChargePlugin extends Plugin
|
||||
"You can smelt ([0-9]+|one) more pieces? of iron ore before a ring melts\\.");
|
||||
private static final String RING_OF_FORGING_USED_TEXT = "You retrieve a bar of iron.";
|
||||
private static final String RING_OF_FORGING_BREAK_TEXT = "Your Ring of Forging has melted.";
|
||||
private static final String RING_OF_FORGING_VARROCK_PLATEBODY = "The Varrock platebody enabled you to smelt your next ore simultaneously.";
|
||||
private static final Pattern AMULET_OF_CHEMISTRY_CHECK_PATTERN = Pattern.compile(
|
||||
"Your amulet of chemistry has (\\d) charges? left\\."
|
||||
);
|
||||
@@ -317,8 +318,9 @@ public class ItemChargePlugin extends Plugin
|
||||
}
|
||||
updateRingOfForgingCharges(charges);
|
||||
}
|
||||
else if (message.equals(RING_OF_FORGING_USED_TEXT))
|
||||
else if (message.equals(RING_OF_FORGING_USED_TEXT) || message.equals(RING_OF_FORGING_VARROCK_PLATEBODY))
|
||||
{
|
||||
final ItemContainer inventory = client.getItemContainer(InventoryID.INVENTORY);
|
||||
final ItemContainer equipment = client.getItemContainer(InventoryID.EQUIPMENT);
|
||||
|
||||
// Determine if the player smelted with a Ring of Forging equipped.
|
||||
@@ -327,7 +329,7 @@ public class ItemChargePlugin extends Plugin
|
||||
return;
|
||||
}
|
||||
|
||||
if (equipment.contains(ItemID.RING_OF_FORGING))
|
||||
if (equipment.contains(ItemID.RING_OF_FORGING) && (message.equals(RING_OF_FORGING_USED_TEXT) || inventory.count(ItemID.IRON_ORE) > 1))
|
||||
{
|
||||
int charges = Ints.constrainToRange(getItemCharges(ItemChargeConfig.KEY_RING_OF_FORGING) - 1, 0, MAX_RING_OF_FORGING_CHARGES);
|
||||
updateRingOfForgingCharges(charges);
|
||||
|
||||
Reference in New Issue
Block a user