Merge pull request #162 from sdburns1998/itemcharges
Item charges update
This commit is contained in:
@@ -48,4 +48,5 @@ public class GraphicID
|
||||
public static final int NPC_CONTACT = 728;
|
||||
public static final int POT_SHARE = 733;
|
||||
public static final int BAKE_PIE = 746;
|
||||
public static final int XERIC_TELEPORT = 1612;
|
||||
}
|
||||
|
||||
@@ -130,6 +130,7 @@ public class WidgetID
|
||||
public static final int FULLSCREEN_MAP_GROUP_ID = 165;
|
||||
public static final int QUESTLIST_GROUP_ID = 399;
|
||||
public static final int SKILLS_GROUP_ID = 320;
|
||||
public static final int DIALOG_SPRITE2_ID = 11;
|
||||
public static final int EQUIPMENT_PAGE_GROUP_ID = 84;
|
||||
public static final int QUESTTAB_GROUP_ID = 629;
|
||||
public static final int MUSIC_GROUP_ID = 239;
|
||||
@@ -963,6 +964,14 @@ public class WidgetID
|
||||
static final int MINIQUEST_CONTAINER = 8;
|
||||
}
|
||||
|
||||
static class DialogSprite2
|
||||
{
|
||||
static final int SPRITE1 = 1;
|
||||
static final int TEXT = 2;
|
||||
static final int SPRITE2 = 3;
|
||||
static final int CONTINUE = 4;
|
||||
}
|
||||
|
||||
static class QuestTab
|
||||
{
|
||||
static final int QUEST_TAB = 3;
|
||||
|
||||
@@ -328,6 +328,11 @@ public enum WidgetInfo
|
||||
DIALOG_SPRITE(WidgetID.DIALOG_SPRITE_GROUP_ID, 0),
|
||||
DIALOG_SPRITE_SPRITE(WidgetID.DIALOG_SPRITE_GROUP_ID, WidgetID.DialogSprite.SPRITE),
|
||||
DIALOG_SPRITE_TEXT(WidgetID.DIALOG_SPRITE_GROUP_ID, WidgetID.DialogSprite.TEXT),
|
||||
DIALOG2_SPRITE(WidgetID.DIALOG_SPRITE2_ID, 0),
|
||||
DIALOG2_SPRITE_SPRITE1(WidgetID.DIALOG_SPRITE2_ID, WidgetID.DialogSprite2.SPRITE1),
|
||||
DIALOG2_SPRITE_SPRITE2(WidgetID.DIALOG_SPRITE2_ID, WidgetID.DialogSprite2.SPRITE2),
|
||||
DIALOG2_SPRITE_TEXT(WidgetID.DIALOG_SPRITE2_ID, WidgetID.DialogSprite2.TEXT),
|
||||
DIALOG2_SPRITE_CONTINUE(WidgetID.DIALOG_SPRITE2_ID, WidgetID.DialogSprite2.CONTINUE),
|
||||
|
||||
DIALOG_NPC(WidgetID.DIALOG_NPC_GROUP_ID, 0),
|
||||
DIALOG_NPC_NAME(WidgetID.DIALOG_NPC_GROUP_ID, WidgetID.DialogNPC.NAME),
|
||||
|
||||
@@ -172,10 +172,10 @@ public interface ItemChargeConfig extends Config
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "showBellowCharges",
|
||||
name = "Show Bellow Charges",
|
||||
description = "Configures if ogre bellow item charge is shown",
|
||||
position = 12
|
||||
keyName = "showBellowCharges",
|
||||
name = "Show Bellow Charges",
|
||||
description = "Configures if ogre bellow item charge is shown",
|
||||
position = 12
|
||||
)
|
||||
default boolean showBellowCharges()
|
||||
{
|
||||
@@ -183,10 +183,10 @@ public interface ItemChargeConfig extends Config
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "showAbyssalBraceletCharges",
|
||||
name = "Show Abyssal Bracelet Charges",
|
||||
description = "Configures if abyssal bracelet item charge is shown",
|
||||
position = 13
|
||||
keyName = "showAbyssalBraceletCharges",
|
||||
name = "Show Abyssal Bracelet Charges",
|
||||
description = "Configures if abyssal bracelet item charge is shown",
|
||||
position = 13
|
||||
)
|
||||
default boolean showAbyssalBraceletCharges()
|
||||
{
|
||||
@@ -204,11 +204,58 @@ public interface ItemChargeConfig extends Config
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "showSlayerBracelets",
|
||||
name = "Show Slayer Bracelets Charges",
|
||||
description = "Configures if slayer bracelets' item charges are shown",
|
||||
position = 15
|
||||
)
|
||||
default boolean showSlayerBracelets()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "expeditious",
|
||||
name = "",
|
||||
description = "",
|
||||
hidden = true
|
||||
)
|
||||
default int expeditious()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "expeditious",
|
||||
name = "",
|
||||
description = ""
|
||||
)
|
||||
void expeditious(int expeditious);
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "slaughter",
|
||||
name = "",
|
||||
description = "",
|
||||
hidden = true
|
||||
)
|
||||
default int slaughter()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "slaughter",
|
||||
name = "",
|
||||
description = ""
|
||||
)
|
||||
void slaughter(int slaughter);
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "showBindingNecklaceCharges",
|
||||
name = "Show Binding Necklace Charges",
|
||||
description = "Configures if binding necklace item charge is shown",
|
||||
position = 15
|
||||
position = 16
|
||||
)
|
||||
default boolean showBindingNecklaceCharges()
|
||||
{
|
||||
@@ -237,21 +284,108 @@ public interface ItemChargeConfig extends Config
|
||||
keyName = "bindingNotification",
|
||||
name = "Binding Necklace Notification",
|
||||
description = "Configures if the binding necklace breaking notification is shown",
|
||||
position = 16
|
||||
position = 17
|
||||
)
|
||||
default boolean bindingNotification()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "showXericTalismanCharges",
|
||||
name = "Show Xeric's Talisman Charges",
|
||||
description = "Configures if Xeric's Talisman item charge is shown",
|
||||
position = 18
|
||||
)
|
||||
default boolean showXericTalismanCharges()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "xericTalisman",
|
||||
name = "",
|
||||
description = "",
|
||||
hidden = true
|
||||
)
|
||||
default int xericTalisman()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "xericTalisman",
|
||||
name = "",
|
||||
description = ""
|
||||
)
|
||||
void xericTalisman(int xericTalisman);
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "showSoulBearerCharges",
|
||||
name = "Show Soul Bearer Charges",
|
||||
description = "Configures if Soul Bearer item charge is shown",
|
||||
position = 19
|
||||
)
|
||||
default boolean showSoulBearerCharges()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "soulBearer",
|
||||
name = "",
|
||||
description = "",
|
||||
hidden = true
|
||||
)
|
||||
default int soulBearer()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "soulBearer",
|
||||
name = "",
|
||||
description = ""
|
||||
)
|
||||
void soulBearer(int soulBearer);
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "showChronicleCharges",
|
||||
name = "Show Chronicle Charges",
|
||||
description = "Configures if Chronicle item charge is shown",
|
||||
position = 20
|
||||
)
|
||||
default boolean showChronicleCharges()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "chronicle",
|
||||
name = "",
|
||||
description = "",
|
||||
hidden = true
|
||||
)
|
||||
default int chronicle()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "chronicle",
|
||||
name = "",
|
||||
description = ""
|
||||
)
|
||||
void chronicle(int chronicle);
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "showInfoboxes",
|
||||
name = "Show Infoboxes",
|
||||
description = "Configures whether to show an infobox equipped charge items",
|
||||
position = 17
|
||||
position = 21
|
||||
)
|
||||
default boolean showInfoboxes()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -75,6 +75,24 @@ class ItemChargeOverlay extends WidgetItemOverlay
|
||||
|
||||
charges = config.dodgyNecklace();
|
||||
}
|
||||
else if (itemId == ItemID.BRACELET_OF_SLAUGHTER)
|
||||
{
|
||||
if (!config.showSlayerBracelets())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
charges = config.slaughter();
|
||||
}
|
||||
else if (itemId == ItemID.EXPEDITIOUS_BRACELET)
|
||||
{
|
||||
if (!config.showSlayerBracelets())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
charges = config.expeditious();
|
||||
}
|
||||
else if (itemId == ItemID.BINDING_NECKLACE)
|
||||
{
|
||||
if (!config.showBindingNecklaceCharges())
|
||||
@@ -84,7 +102,32 @@ class ItemChargeOverlay extends WidgetItemOverlay
|
||||
|
||||
charges = config.bindingNecklace();
|
||||
}
|
||||
else if (itemId == ItemID.XERICS_TALISMAN)
|
||||
{
|
||||
if (!config.showXericTalismanCharges())
|
||||
{
|
||||
return;
|
||||
}
|
||||
charges = config.xericTalisman();
|
||||
}
|
||||
else if (itemId == ItemID.SOUL_BEARER)
|
||||
{
|
||||
if (!config.showSoulBearerCharges())
|
||||
{
|
||||
return;
|
||||
}
|
||||
charges = config.soulBearer();
|
||||
}
|
||||
else if (itemId == ItemID.CHRONICLE)
|
||||
{
|
||||
if (!config.showChronicleCharges())
|
||||
{
|
||||
return;
|
||||
}
|
||||
charges = config.chronicle();
|
||||
}
|
||||
else
|
||||
|
||||
{
|
||||
ItemWithCharge chargeItem = ItemWithCharge.findItem(itemId);
|
||||
if (chargeItem == null)
|
||||
@@ -109,7 +152,9 @@ class ItemChargeOverlay extends WidgetItemOverlay
|
||||
|
||||
final Rectangle bounds = itemWidget.getCanvasBounds();
|
||||
final TextComponent textComponent = new TextComponent();
|
||||
textComponent.setPosition(new Point(bounds.x, bounds.y + 16));
|
||||
textComponent.setPosition(new
|
||||
|
||||
Point(bounds.x, bounds.y + 16));
|
||||
textComponent.setText(charges < 0 ? "?" : String.valueOf(charges));
|
||||
textComponent.setColor(itemChargePlugin.getColor(charges));
|
||||
textComponent.render(graphics);
|
||||
@@ -121,4 +166,4 @@ class ItemChargeOverlay extends WidgetItemOverlay
|
||||
|| config.showImpCharges() || config.showWateringCanCharges() || config.showWaterskinCharges()
|
||||
|| config.showBellowCharges() || config.showAbyssalBraceletCharges();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -34,12 +34,15 @@ import javax.inject.Inject;
|
||||
import net.runelite.api.ChatMessageType;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.EquipmentInventorySlot;
|
||||
import net.runelite.api.GraphicID;
|
||||
import net.runelite.api.InventoryID;
|
||||
import net.runelite.api.Item;
|
||||
import net.runelite.api.ItemContainer;
|
||||
import net.runelite.api.ItemID;
|
||||
import net.runelite.api.events.ChatMessage;
|
||||
import net.runelite.api.events.ConfigChanged;
|
||||
import net.runelite.api.events.GameTick;
|
||||
import net.runelite.api.events.GraphicChanged;
|
||||
import net.runelite.api.events.ItemContainerChanged;
|
||||
import net.runelite.api.events.ScriptCallbackEvent;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
@@ -52,6 +55,7 @@ import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.ui.overlay.OverlayManager;
|
||||
import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
|
||||
import net.runelite.client.util.Text;
|
||||
|
||||
@PluginDescriptor(
|
||||
name = "Item Charges",
|
||||
@@ -62,18 +66,56 @@ public class ItemChargePlugin extends Plugin
|
||||
{
|
||||
private static final Pattern DODGY_CHECK_PATTERN = Pattern.compile(
|
||||
"Your dodgy necklace has (\\d+) charges? left\\.");
|
||||
private static final Pattern SLAUGHTER_CHECK_PATTERN = Pattern.compile(
|
||||
"Your bracelet of slaughter has (\\d{1,2}) charge[s]? left.");
|
||||
private static final Pattern EXPEDITIOUS_CHECK_PATTERN = Pattern.compile(
|
||||
"Your expeditious bracelet has (\\d{1,2}) charge[s]? left.");
|
||||
private static final Pattern DODGY_PROTECT_PATTERN = Pattern.compile(
|
||||
"Your dodgy necklace protects you\\..*It has (\\d+) charges? left\\.");
|
||||
private static final Pattern SLAUGHTER_ACTIVATE_PATTERN = Pattern.compile(
|
||||
"Your bracelet of slaughter prevents your slayer count decreasing. It has (\\d{1,2}) charge[s]? left.");
|
||||
private static final Pattern EXPEDITIOUS_ACTIVATE_PATTERN = Pattern.compile(
|
||||
"Your expeditious bracelet helps you progress your slayer (?:task )?faster. It has (\\d{1,2}) charge[s]? left.");
|
||||
private static final Pattern DODGY_BREAK_PATTERN = Pattern.compile(
|
||||
"Your dodgy necklace protects you\\..*It then crumbles to dust\\.");
|
||||
private static final String RING_OF_RECOIL_BREAK_MESSAGE = "<col=7f007f>Your Ring of Recoil has shattered.</col>";
|
||||
private static final Pattern BINDING_CHECK_PATTERN = Pattern.compile(
|
||||
"You have ([0-9]+|one) charges? left before your Binding necklace disintegrates\\.");
|
||||
private static Pattern BINDING_CHECK_PATTERN = Pattern.compile(
|
||||
"You have ([0-9]+|one) charges? left before your Binding necklace disintegrates.");
|
||||
private static final Pattern BINDING_USED_PATTERN = Pattern.compile(
|
||||
"You bind the temple's power into (mud|lava|steam|dust|smoke|mist) runes\\.");
|
||||
private static final String BINDING_BREAK_TEXT = "Your Binding necklace has disintegrated.";
|
||||
private static final Pattern XERIC_CHECK_CHARGE_PATTERN = Pattern.compile(
|
||||
"talisman has (\\d+|one) charges?");
|
||||
private static final Pattern XERIC_RECHARGEWIDGET_PATTERN = Pattern.compile(
|
||||
"Your talisman now has (\\d+|one) charges?\\.");
|
||||
private static final Pattern XERIC_OUT_OF_CHARGES = Pattern.compile(
|
||||
"Your talisman has run out of charges");
|
||||
private static final Pattern XERIC_UNCHARGE_PATTERN = Pattern.compile(
|
||||
"lizard fangs? from your talisman\\.");
|
||||
private static final Pattern SOULBEARER_RECHARGE_PATTERN = Pattern.compile(
|
||||
"You add (\\d+|a) charges? to your soul bearer.It now has (\\d+) charges\\.");
|
||||
private static final Pattern SOULBEARER_RECHARGE_PATTERN2 = Pattern.compile(
|
||||
"Your soul bearer now has one charge\\.");
|
||||
private static final Pattern SOULBEARER_CHECK_CHARGE_PATTERN = Pattern.compile(
|
||||
"soul bearer has (\\d+|one) charges?\\.");
|
||||
private static final Pattern SOULBEARER_UNCHARGE_PATTERN = Pattern.compile(
|
||||
"You remove the runes from the soul bearer\\.");
|
||||
private static final Pattern SOULBEARER_BANKHEADS_PATTERN = Pattern.compile(
|
||||
"Your soul bearer carries the ensouled heads? to your ?bank\\. It has (\\d+|one) charges? left\\.");
|
||||
private static final Pattern SOULBEARER_OUT_OF_CHARGES = Pattern.compile(
|
||||
"Your soul bearer carries the ensouled heads? to (.+)\\. It has run out of charges\\.");
|
||||
private static final Pattern CHRONICLE_CHECK_CHARGE_PATTERN = Pattern.compile(
|
||||
"Your book has (\\d+) charges left\\.");
|
||||
private static final Pattern CHRONICLE_ADD_CHARGE_PATTERN = Pattern.compile(
|
||||
"You add (\\d+|a single) charges? to your book. It now has (\\d+) charges\\.");
|
||||
private static final Pattern CHRONICLE_LAST_CHARGE_PATTERN = Pattern.compile(
|
||||
"You have one charge left in your book\\.");
|
||||
private static final Pattern CHRONICLE_OUT_OF_CHARGES_PATTERN = Pattern.compile(
|
||||
"Your book has run out of charges\\.");
|
||||
|
||||
private static final int MAX_DODGY_CHARGES = 10;
|
||||
private static final int MAX_SLAUGHTER_CHARGES = 30;
|
||||
private static final int MAX_EXPEDITIOUS_CHARGES = 30;
|
||||
private static final int MAX_BINDING_CHARGES = 16;
|
||||
|
||||
@Inject
|
||||
@@ -149,6 +191,12 @@ public class ItemChargePlugin extends Plugin
|
||||
removeInfobox(ItemWithSlot.DODGY_NECKLACE);
|
||||
}
|
||||
|
||||
if (!config.showSlayerBracelets())
|
||||
{
|
||||
removeInfobox(ItemWithSlot.BRACELET_OF_SLAUGHTER);
|
||||
removeInfobox(ItemWithSlot.EXPEDITIOUS_BRACELET);
|
||||
}
|
||||
|
||||
if (!config.showBindingNecklaceCharges())
|
||||
{
|
||||
removeInfobox(ItemWithSlot.BINDING_NECKLACE);
|
||||
@@ -160,10 +208,21 @@ public class ItemChargePlugin extends Plugin
|
||||
{
|
||||
String message = event.getMessage();
|
||||
Matcher dodgyCheckMatcher = DODGY_CHECK_PATTERN.matcher(message);
|
||||
Matcher slaughterCheckMatcher = SLAUGHTER_CHECK_PATTERN.matcher(message);
|
||||
Matcher expeditiousCheckMatcher = EXPEDITIOUS_CHECK_PATTERN.matcher(message);
|
||||
Matcher dodgyProtectMatcher = DODGY_PROTECT_PATTERN.matcher(message);
|
||||
Matcher slaughterActivateMatcher = SLAUGHTER_ACTIVATE_PATTERN.matcher(message);
|
||||
Matcher expeditiousActivateMatcher = EXPEDITIOUS_ACTIVATE_PATTERN.matcher(message);
|
||||
Matcher dodgyBreakMatcher = DODGY_BREAK_PATTERN.matcher(message);
|
||||
Matcher bindingNecklaceCheckMatcher = BINDING_CHECK_PATTERN.matcher(event.getMessage());
|
||||
Matcher bindingNecklaceUsedMatcher = BINDING_USED_PATTERN.matcher(event.getMessage());
|
||||
Matcher xericRechargeMatcher = XERIC_CHECK_CHARGE_PATTERN.matcher(message);
|
||||
Matcher xericOutOfChargesMatcher = XERIC_OUT_OF_CHARGES.matcher(message);
|
||||
Matcher soulbearerCheckMatcher = SOULBEARER_CHECK_CHARGE_PATTERN.matcher(message);
|
||||
Matcher chronicleCheckMatcher = CHRONICLE_CHECK_CHARGE_PATTERN.matcher(message);
|
||||
Matcher chronicleRechargeMatcher = CHRONICLE_ADD_CHARGE_PATTERN.matcher(message);
|
||||
Matcher chronicleLastChargeMatcher = CHRONICLE_LAST_CHARGE_PATTERN.matcher(message);
|
||||
Matcher chronicleOutOfChargesMatcher = CHRONICLE_OUT_OF_CHARGES_PATTERN.matcher(message);
|
||||
|
||||
if (event.getType() == ChatMessageType.GAMEMESSAGE || event.getType() == ChatMessageType.SPAM)
|
||||
{
|
||||
@@ -171,6 +230,30 @@ public class ItemChargePlugin extends Plugin
|
||||
{
|
||||
notifier.notify("Your Ring of Recoil has shattered");
|
||||
}
|
||||
else if (dodgyCheckMatcher.find())
|
||||
{
|
||||
updateDodgyNecklaceCharges(Integer.parseInt(dodgyCheckMatcher.group(1)));
|
||||
}
|
||||
else if (slaughterCheckMatcher.find())
|
||||
{
|
||||
updateBraceletOfSlaughterCharges(Integer.parseInt(slaughterCheckMatcher.group(1)));
|
||||
}
|
||||
else if (expeditiousCheckMatcher.find())
|
||||
{
|
||||
updateExpeditiousCharges(Integer.parseInt(expeditiousCheckMatcher.group(1)));
|
||||
}
|
||||
else if (dodgyProtectMatcher.find())
|
||||
{
|
||||
updateDodgyNecklaceCharges(Integer.parseInt(dodgyProtectMatcher.group(1)));
|
||||
}
|
||||
else if (slaughterActivateMatcher.find())
|
||||
{
|
||||
updateBraceletOfSlaughterCharges(Integer.parseInt(slaughterActivateMatcher.group(1)));
|
||||
}
|
||||
else if (expeditiousActivateMatcher.find())
|
||||
{
|
||||
updateExpeditiousCharges(Integer.parseInt(expeditiousActivateMatcher.group(1)));
|
||||
}
|
||||
else if (dodgyBreakMatcher.find())
|
||||
{
|
||||
if (config.dodgyNotification())
|
||||
@@ -180,14 +263,6 @@ public class ItemChargePlugin extends Plugin
|
||||
|
||||
updateDodgyNecklaceCharges(MAX_DODGY_CHARGES);
|
||||
}
|
||||
else if (dodgyCheckMatcher.find())
|
||||
{
|
||||
updateDodgyNecklaceCharges(Integer.parseInt(dodgyCheckMatcher.group(1)));
|
||||
}
|
||||
else if (dodgyProtectMatcher.find())
|
||||
{
|
||||
updateDodgyNecklaceCharges(Integer.parseInt(dodgyProtectMatcher.group(1)));
|
||||
}
|
||||
else if (message.contains(BINDING_BREAK_TEXT))
|
||||
{
|
||||
if (config.bindingNotification())
|
||||
@@ -214,6 +289,41 @@ public class ItemChargePlugin extends Plugin
|
||||
|
||||
updateBindingNecklaceCharges(charges);
|
||||
}
|
||||
else if (xericRechargeMatcher.find())
|
||||
{
|
||||
final int xericCharges = xericRechargeMatcher.group(1).equals("one") ? 1 : (Integer.parseInt(xericRechargeMatcher.group(1)));
|
||||
updateXericCharges(xericCharges);
|
||||
}
|
||||
else if (xericOutOfChargesMatcher.find())
|
||||
{
|
||||
final int xericCharges = 0;
|
||||
updateXericCharges(xericCharges);
|
||||
}
|
||||
else if (soulbearerCheckMatcher.find())
|
||||
{
|
||||
final int soulbearerCharges = soulbearerCheckMatcher.group(1).equals("one") ? 1 : (Integer.parseInt(soulbearerCheckMatcher.group(1)));
|
||||
updateSoulBearerCharges(soulbearerCharges);
|
||||
}
|
||||
else if (chronicleCheckMatcher.find())
|
||||
{
|
||||
final int chronicleCharges = chronicleCheckMatcher.group(1).equals("one") ? 1 : (Integer.parseInt(chronicleCheckMatcher.group(1)));
|
||||
updateChronicleCharges(chronicleCharges);
|
||||
}
|
||||
else if (chronicleRechargeMatcher.find())
|
||||
{
|
||||
final int chronicleCharges = chronicleRechargeMatcher.group(2).equals("one") ? 1 : (Integer.parseInt(chronicleRechargeMatcher.group(2)));
|
||||
updateChronicleCharges(chronicleCharges);
|
||||
}
|
||||
else if (chronicleLastChargeMatcher.find())
|
||||
{
|
||||
final int chronicleCharges = 1;
|
||||
updateChronicleCharges(chronicleCharges);
|
||||
}
|
||||
else if (chronicleOutOfChargesMatcher.find())
|
||||
{
|
||||
final int chronicleCharges = 0;
|
||||
updateChronicleCharges(chronicleCharges);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -242,12 +352,102 @@ public class ItemChargePlugin extends Plugin
|
||||
updateJewelleryInfobox(ItemWithSlot.ABYSSAL_BRACELET, items);
|
||||
}
|
||||
|
||||
if (config.showSlayerBracelets())
|
||||
{
|
||||
updateJewelleryInfobox(ItemWithSlot.BRACELET_OF_SLAUGHTER, items);
|
||||
updateJewelleryInfobox(ItemWithSlot.EXPEDITIOUS_BRACELET, items);
|
||||
}
|
||||
|
||||
if (config.showBindingNecklaceCharges())
|
||||
{
|
||||
updateJewelleryInfobox(ItemWithSlot.BINDING_NECKLACE, items);
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onGameTick(GameTick event)
|
||||
{
|
||||
Widget braceletBreakWidget = client.getWidget(WidgetInfo.DIALOG_SPRITE_TEXT);
|
||||
|
||||
if (braceletBreakWidget != null)
|
||||
{
|
||||
String braceletText = Text.removeTags(braceletBreakWidget.getText()); //remove color and linebreaks
|
||||
if (braceletText.contains("bracelet of slaughter"))
|
||||
{
|
||||
config.slaughter(MAX_SLAUGHTER_CHARGES);
|
||||
}
|
||||
else if (braceletText.contains("expeditious bracelet"))
|
||||
{
|
||||
config.expeditious(MAX_EXPEDITIOUS_CHARGES);
|
||||
}
|
||||
}
|
||||
|
||||
Widget dialog1 = client.getWidget(WidgetInfo.DIALOG_SPRITE_TEXT);
|
||||
Widget dialog2 = client.getWidget(WidgetInfo.DIALOG2_SPRITE_TEXT);
|
||||
|
||||
if (dialog1 != null)
|
||||
{
|
||||
String widgetText = Text.removeTags(dialog1.getText());
|
||||
Matcher xericRechargeMatcher = XERIC_RECHARGEWIDGET_PATTERN.matcher(widgetText);
|
||||
Matcher soulbearerRechargeMatcher = SOULBEARER_RECHARGE_PATTERN.matcher(widgetText);
|
||||
Matcher soulbearerRecharge2Matcher = SOULBEARER_RECHARGE_PATTERN2.matcher(widgetText);
|
||||
|
||||
if (xericRechargeMatcher.find())
|
||||
{
|
||||
final int xericCharges = xericRechargeMatcher.group(1).equals("one") ? 1 : (Integer.parseInt(xericRechargeMatcher.group(1)));
|
||||
updateXericCharges(xericCharges);
|
||||
}
|
||||
else if (soulbearerRechargeMatcher.find())
|
||||
{
|
||||
final int soulbearerCharges = soulbearerRechargeMatcher.group(2).equals("one") ? 1 : (Integer.parseInt(soulbearerRechargeMatcher.group(2)));
|
||||
updateSoulBearerCharges(soulbearerCharges);
|
||||
}
|
||||
else if (soulbearerRecharge2Matcher.find())
|
||||
{
|
||||
final int soulbearerCharges = 1;
|
||||
updateSoulBearerCharges(soulbearerCharges);
|
||||
}
|
||||
}
|
||||
|
||||
if (dialog2 != null)
|
||||
{
|
||||
String widgetText = Text.removeTags(dialog2.getText());
|
||||
Matcher xericUnchargeMatcher = XERIC_UNCHARGE_PATTERN.matcher(widgetText);
|
||||
Matcher soulbearerUnchargeMatcher = SOULBEARER_UNCHARGE_PATTERN.matcher(widgetText);
|
||||
Matcher soulbearerBankHeadsMatcher = SOULBEARER_BANKHEADS_PATTERN.matcher(widgetText);
|
||||
Matcher soulbearerOutOfCharges = SOULBEARER_OUT_OF_CHARGES.matcher(widgetText);
|
||||
|
||||
if (xericUnchargeMatcher.find())
|
||||
{
|
||||
final int xericCharges = 0;
|
||||
updateXericCharges(xericCharges);
|
||||
}
|
||||
else if (soulbearerUnchargeMatcher.find() || soulbearerOutOfCharges.find())
|
||||
{
|
||||
final int soulbearerCharges = 0;
|
||||
updateSoulBearerCharges(soulbearerCharges);
|
||||
}
|
||||
else if (soulbearerBankHeadsMatcher.find())
|
||||
{
|
||||
final int soulbearerCharges = soulbearerBankHeadsMatcher.group(1).equals("one") ? 1 : (Integer.parseInt(soulbearerBankHeadsMatcher.group(1)));
|
||||
updateSoulBearerCharges(soulbearerCharges);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onGraphicChanged(GraphicChanged event)
|
||||
{
|
||||
if (event.getActor() == client.getLocalPlayer())
|
||||
{
|
||||
if (client.getLocalPlayer().getGraphic() == GraphicID.XERIC_TELEPORT)
|
||||
{
|
||||
final int xericCharges = Math.max(config.xericTalisman() - 1, 0);
|
||||
updateXericCharges(xericCharges);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onScriptCallbackEvent(ScriptCallbackEvent event)
|
||||
{
|
||||
@@ -280,6 +480,40 @@ public class ItemChargePlugin extends Plugin
|
||||
}
|
||||
}
|
||||
|
||||
private void updateBraceletOfSlaughterCharges(final int value)
|
||||
{
|
||||
config.slaughter(value);
|
||||
|
||||
if (config.showInfoboxes() && config.showSlayerBracelets())
|
||||
{
|
||||
final ItemContainer itemContainer = client.getItemContainer(InventoryID.EQUIPMENT);
|
||||
|
||||
if (itemContainer == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
updateJewelleryInfobox(ItemWithSlot.BRACELET_OF_SLAUGHTER, itemContainer.getItems());
|
||||
}
|
||||
}
|
||||
|
||||
private void updateExpeditiousCharges(final int value)
|
||||
{
|
||||
config.expeditious(value);
|
||||
|
||||
if (config.showInfoboxes() && config.showSlayerBracelets())
|
||||
{
|
||||
final ItemContainer itemContainer = client.getItemContainer(InventoryID.EQUIPMENT);
|
||||
|
||||
if (itemContainer == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
updateJewelleryInfobox(ItemWithSlot.EXPEDITIOUS_BRACELET, itemContainer.getItems());
|
||||
}
|
||||
}
|
||||
|
||||
private void updateBindingNecklaceCharges(final int value)
|
||||
{
|
||||
config.bindingNecklace(value);
|
||||
@@ -297,6 +531,21 @@ public class ItemChargePlugin extends Plugin
|
||||
}
|
||||
}
|
||||
|
||||
private void updateXericCharges(int xericCharges)
|
||||
{
|
||||
config.xericTalisman(xericCharges);
|
||||
}
|
||||
|
||||
private void updateSoulBearerCharges(int soulBearerCharges)
|
||||
{
|
||||
config.soulBearer(soulBearerCharges);
|
||||
}
|
||||
|
||||
private void updateChronicleCharges(int chronicleCharges)
|
||||
{
|
||||
config.chronicle(chronicleCharges);
|
||||
}
|
||||
|
||||
private void checkDestroyWidget()
|
||||
{
|
||||
final int currentTick = client.getTickCount();
|
||||
@@ -355,6 +604,14 @@ public class ItemChargePlugin extends Plugin
|
||||
{
|
||||
charges = config.dodgyNecklace();
|
||||
}
|
||||
else if (id == ItemID.BRACELET_OF_SLAUGHTER && type == ItemWithSlot.BRACELET_OF_SLAUGHTER)
|
||||
{
|
||||
charges = config.slaughter();
|
||||
}
|
||||
else if (id == ItemID.EXPEDITIOUS_BRACELET && type == ItemWithSlot.EXPEDITIOUS_BRACELET)
|
||||
{
|
||||
charges = config.expeditious();
|
||||
}
|
||||
else if (id == ItemID.BINDING_NECKLACE && type == ItemWithSlot.BINDING_NECKLACE)
|
||||
{
|
||||
charges = config.bindingNecklace();
|
||||
|
||||
@@ -34,5 +34,7 @@ enum ItemChargeType
|
||||
WATERCAN,
|
||||
WATERSKIN,
|
||||
DODGY_NECKLACE,
|
||||
BRACELET_OF_SLAUGHTER,
|
||||
EXPEDITIOUS_BRACELET,
|
||||
BINDING_NECKLACE
|
||||
}
|
||||
}
|
||||
@@ -30,7 +30,13 @@ import javax.annotation.Nullable;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import static net.runelite.api.ItemID.*;
|
||||
import static net.runelite.client.plugins.itemcharges.ItemChargeType.*;
|
||||
import static net.runelite.client.plugins.itemcharges.ItemChargeType.ABYSSAL_BRACELET;
|
||||
import static net.runelite.client.plugins.itemcharges.ItemChargeType.BELLOWS;
|
||||
import static net.runelite.client.plugins.itemcharges.ItemChargeType.FUNGICIDE_SPRAY;
|
||||
import static net.runelite.client.plugins.itemcharges.ItemChargeType.IMPBOX;
|
||||
import static net.runelite.client.plugins.itemcharges.ItemChargeType.TELEPORT;
|
||||
import static net.runelite.client.plugins.itemcharges.ItemChargeType.WATERCAN;
|
||||
import static net.runelite.client.plugins.itemcharges.ItemChargeType.WATERSKIN;
|
||||
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
|
||||
@@ -33,6 +33,8 @@ import net.runelite.api.EquipmentInventorySlot;
|
||||
enum ItemWithSlot
|
||||
{
|
||||
ABYSSAL_BRACELET(ItemChargeType.ABYSSAL_BRACELET, EquipmentInventorySlot.GLOVES),
|
||||
BRACELET_OF_SLAUGHTER(ItemChargeType.BRACELET_OF_SLAUGHTER, EquipmentInventorySlot.GLOVES),
|
||||
EXPEDITIOUS_BRACELET(ItemChargeType.EXPEDITIOUS_BRACELET, EquipmentInventorySlot.GLOVES),
|
||||
DODGY_NECKLACE(ItemChargeType.DODGY_NECKLACE, EquipmentInventorySlot.AMULET),
|
||||
BINDING_NECKLACE(ItemChargeType.BINDING_NECKLACE, EquipmentInventorySlot.AMULET),
|
||||
TELEPORT(ItemChargeType.TELEPORT, EquipmentInventorySlot.WEAPON, EquipmentInventorySlot.AMULET, EquipmentInventorySlot.GLOVES, EquipmentInventorySlot.RING);
|
||||
|
||||
Reference in New Issue
Block a user