item charges: add bracelet of slaughter and expeditious bracelet
This commit is contained in:
@@ -40,8 +40,10 @@ public interface ItemChargeConfig extends Config
|
||||
String KEY_AMULET_OF_BOUNTY = "amuletOfBounty";
|
||||
String KEY_AMULET_OF_CHEMISTRY = "amuletOfChemistry";
|
||||
String KEY_BINDING_NECKLACE = "bindingNecklace";
|
||||
String KEY_BRACELET_OF_SLAUGHTER = "braceletOfSlaughter";
|
||||
String KEY_CHRONICLE = "chronicle";
|
||||
String KEY_DODGY_NECKLACE = "dodgyNecklace";
|
||||
String KEY_EXPEDITIOUS_BRACELET = "expeditiousBracelet";
|
||||
String KEY_EXPLORERS_RING = "explorerRing";
|
||||
String KEY_RING_OF_FORGING = "ringOfForging";
|
||||
|
||||
@@ -353,4 +355,52 @@ public interface ItemChargeConfig extends Config
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "showBraceletOfSlaughterCharges",
|
||||
name = "Bracelet of Slaughter Charges",
|
||||
description = "Show Bracelet of Slaughter item charges",
|
||||
position = 26,
|
||||
section = chargesSection
|
||||
)
|
||||
default boolean showBraceletOfSlaughterCharges()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "slaughterNotification",
|
||||
name = "Bracelet of Slaughter Notification",
|
||||
description = "Send a notification when a Bracelet of Slaughter breaks",
|
||||
position = 27,
|
||||
section = notificationSection
|
||||
)
|
||||
default boolean slaughterNotification()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "showExpeditiousBraceletCharges",
|
||||
name = "Expeditious Bracelet Charges",
|
||||
description = "Show Expeditious Bracelet item charges",
|
||||
position = 28,
|
||||
section = chargesSection
|
||||
)
|
||||
default boolean showExpeditiousBraceletCharges()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "expeditiousNotification",
|
||||
name = "Expeditious Bracelet Notification",
|
||||
description = "Send a notification when an Expeditious Bracelet breaks",
|
||||
position = 29,
|
||||
section = notificationSection
|
||||
)
|
||||
default boolean expeditiousNotification()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -125,6 +125,24 @@ class ItemChargeOverlay extends WidgetItemOverlay
|
||||
|
||||
charges = itemChargePlugin.getItemCharges(ItemChargeConfig.KEY_CHRONICLE);
|
||||
}
|
||||
else if (itemId == ItemID.BRACELET_OF_SLAUGHTER)
|
||||
{
|
||||
if (!config.showBraceletOfSlaughterCharges())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
charges = itemChargePlugin.getItemCharges(ItemChargeConfig.KEY_BRACELET_OF_SLAUGHTER);
|
||||
}
|
||||
else if (itemId == ItemID.EXPEDITIOUS_BRACELET)
|
||||
{
|
||||
if (!config.showExpeditiousBraceletCharges())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
charges = itemChargePlugin.getItemCharges(ItemChargeConfig.KEY_EXPEDITIOUS_BRACELET);
|
||||
}
|
||||
else
|
||||
{
|
||||
ItemWithCharge chargeItem = ItemWithCharge.findItem(itemId);
|
||||
@@ -167,7 +185,8 @@ class ItemChargeOverlay extends WidgetItemOverlay
|
||||
|| config.showImpCharges() || config.showWateringCanCharges() || config.showWaterskinCharges()
|
||||
|| config.showBellowCharges() || config.showBasketCharges() || config.showSackCharges()
|
||||
|| config.showAbyssalBraceletCharges() || config.showExplorerRingCharges() || config.showRingOfForgingCount()
|
||||
|| config.showAmuletOfChemistryCharges() || config.showAmuletOfBountyCharges() || config.showPotionDoseCount();
|
||||
|| config.showAmuletOfChemistryCharges() || config.showAmuletOfBountyCharges() || config.showPotionDoseCount()
|
||||
|| config.showBraceletOfSlaughterCharges() || config.showExpeditiousBraceletCharges();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -113,6 +113,20 @@ public class ItemChargePlugin extends Plugin
|
||||
private static final String CHRONICLE_ONE_CHARGE_TEXT = "You have one charge left in your book.";
|
||||
private static final String CHRONICLE_EMPTY_TEXT = "Your book has run out of charges.";
|
||||
private static final String CHRONICLE_NO_CHARGES_TEXT = "Your book does not have any charges. Purchase some Teleport Cards from Diango.";
|
||||
private static final Pattern BRACELET_OF_SLAUGHTER_ACTIVATE_PATTERN = Pattern.compile(
|
||||
"Your bracelet of slaughter prevents your slayer count from decreasing. (?:(?:It has (\\d{1,2}) charges? left)|(It then crumbles to dust))\\."
|
||||
);
|
||||
private static final Pattern BRACELET_OF_SLAUGHTER_CHECK_PATTERN = Pattern.compile(
|
||||
"Your bracelet of slaughter has (\\d{1,2}) charges? left\\."
|
||||
);
|
||||
private static final String BRACELET_OF_SLAUGHTER_BREAK_TEXT = "Your Bracelet of Slaughter has crumbled to dust.";
|
||||
private static final Pattern EXPEDITIOUS_BRACELET_ACTIVATE_PATTERN = Pattern.compile(
|
||||
"Your expeditious bracelet helps you progress your slayer (?:task )?faster. (?:(?:It has (\\d{1,2}) charges? left)|(It then crumbles to dust))\\."
|
||||
);
|
||||
private static final Pattern EXPEDITIOUS_BRACELET_CHECK_PATTERN = Pattern.compile(
|
||||
"Your expeditious bracelet has (\\d{1,2}) charges? left\\."
|
||||
);
|
||||
private static final String EXPEDITIOUS_BRACELET_BREAK_TEXT = "Your Expeditious Bracelet has crumbled to dust.";
|
||||
|
||||
private static final int MAX_DODGY_CHARGES = 10;
|
||||
private static final int MAX_BINDING_CHARGES = 16;
|
||||
@@ -120,6 +134,7 @@ public class ItemChargePlugin extends Plugin
|
||||
private static final int MAX_RING_OF_FORGING_CHARGES = 140;
|
||||
private static final int MAX_AMULET_OF_CHEMISTRY_CHARGES = 5;
|
||||
private static final int MAX_AMULET_OF_BOUNTY_CHARGES = 10;
|
||||
private static final int MAX_SLAYER_BRACELET_CHARGES = 30;
|
||||
|
||||
private int lastExplorerRingCharge = -1;
|
||||
|
||||
@@ -247,6 +262,10 @@ public class ItemChargePlugin extends Plugin
|
||||
Matcher amuletOfBountyUsedMatcher = AMULET_OF_BOUNTY_USED_PATTERN.matcher(message);
|
||||
Matcher chronicleAddMatcher = CHRONICLE_ADD_PATTERN.matcher(message);
|
||||
Matcher chronicleUseAndCheckMatcher = CHRONICLE_USE_AND_CHECK_PATTERN.matcher(message);
|
||||
Matcher slaughterActivateMatcher = BRACELET_OF_SLAUGHTER_ACTIVATE_PATTERN.matcher(message);
|
||||
Matcher slaughterCheckMatcher = BRACELET_OF_SLAUGHTER_CHECK_PATTERN.matcher(message);
|
||||
Matcher expeditiousActivateMatcher = EXPEDITIOUS_BRACELET_ACTIVATE_PATTERN.matcher(message);
|
||||
Matcher expeditiousCheckMatcher = EXPEDITIOUS_BRACELET_CHECK_PATTERN.matcher(message);
|
||||
|
||||
if (config.recoilNotification() && message.contains(RING_OF_RECOIL_BREAK_MESSAGE))
|
||||
{
|
||||
@@ -392,6 +411,46 @@ public class ItemChargePlugin extends Plugin
|
||||
{
|
||||
setItemCharges(ItemChargeConfig.KEY_CHRONICLE, 1000);
|
||||
}
|
||||
else if (slaughterActivateMatcher.find())
|
||||
{
|
||||
final String found = slaughterActivateMatcher.group(1);
|
||||
if (found == null)
|
||||
{
|
||||
updateBraceletOfSlaughterCharges(MAX_SLAYER_BRACELET_CHARGES);
|
||||
if (config.slaughterNotification())
|
||||
{
|
||||
notifier.notify(BRACELET_OF_SLAUGHTER_BREAK_TEXT);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
updateBraceletOfSlaughterCharges(Integer.parseInt(found));
|
||||
}
|
||||
}
|
||||
else if (slaughterCheckMatcher.find())
|
||||
{
|
||||
updateBraceletOfSlaughterCharges(Integer.parseInt(slaughterCheckMatcher.group(1)));
|
||||
}
|
||||
else if (expeditiousActivateMatcher.find())
|
||||
{
|
||||
final String found = expeditiousActivateMatcher.group(1);
|
||||
if (found == null)
|
||||
{
|
||||
updateExpeditiousBraceletCharges(MAX_SLAYER_BRACELET_CHARGES);
|
||||
if (config.expeditiousNotification())
|
||||
{
|
||||
notifier.notify(EXPEDITIOUS_BRACELET_BREAK_TEXT);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
updateExpeditiousBraceletCharges(Integer.parseInt(found));
|
||||
}
|
||||
}
|
||||
else if (expeditiousCheckMatcher.find())
|
||||
{
|
||||
updateExpeditiousBraceletCharges(Integer.parseInt(expeditiousCheckMatcher.group(1)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -444,6 +503,16 @@ public class ItemChargePlugin extends Plugin
|
||||
{
|
||||
updateJewelleryInfobox(ItemWithSlot.AMULET_OF_BOUNTY, items);
|
||||
}
|
||||
|
||||
if (config.showBraceletOfSlaughterCharges())
|
||||
{
|
||||
updateJewelleryInfobox(ItemWithSlot.BRACELET_OF_SLAUGHTER, items);
|
||||
}
|
||||
|
||||
if (config.showExpeditiousBraceletCharges())
|
||||
{
|
||||
updateJewelleryInfobox(ItemWithSlot.EXPEDITIOUS_BRACELET, items);
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
@@ -496,6 +565,14 @@ public class ItemChargePlugin extends Plugin
|
||||
log.debug("Reset amulet of chemistry");
|
||||
updateAmuletOfChemistryCharges(MAX_AMULET_OF_CHEMISTRY_CHARGES);
|
||||
break;
|
||||
case ItemID.BRACELET_OF_SLAUGHTER:
|
||||
log.debug("Reset bracelet of slaughter");
|
||||
updateBraceletOfSlaughterCharges(MAX_SLAYER_BRACELET_CHARGES);
|
||||
break;
|
||||
case ItemID.EXPEDITIOUS_BRACELET:
|
||||
log.debug("Reset expeditious bracelet");
|
||||
updateExpeditiousBraceletCharges(MAX_SLAYER_BRACELET_CHARGES);
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -605,6 +682,40 @@ public class ItemChargePlugin extends Plugin
|
||||
}
|
||||
}
|
||||
|
||||
private void updateBraceletOfSlaughterCharges(final int value)
|
||||
{
|
||||
setItemCharges(ItemChargeConfig.KEY_BRACELET_OF_SLAUGHTER, value);
|
||||
|
||||
if (config.showInfoboxes() && config.showBraceletOfSlaughterCharges())
|
||||
{
|
||||
final ItemContainer itemContainer = client.getItemContainer(InventoryID.EQUIPMENT);
|
||||
|
||||
if (itemContainer == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
updateJewelleryInfobox(ItemWithSlot.BRACELET_OF_SLAUGHTER, itemContainer.getItems());
|
||||
}
|
||||
}
|
||||
|
||||
private void updateExpeditiousBraceletCharges(final int value)
|
||||
{
|
||||
setItemCharges(ItemChargeConfig.KEY_EXPEDITIOUS_BRACELET, value);
|
||||
|
||||
if (config.showInfoboxes() && config.showExpeditiousBraceletCharges())
|
||||
{
|
||||
final ItemContainer itemContainer = client.getItemContainer(InventoryID.EQUIPMENT);
|
||||
|
||||
if (itemContainer == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
updateJewelleryInfobox(ItemWithSlot.EXPEDITIOUS_BRACELET, itemContainer.getItems());
|
||||
}
|
||||
}
|
||||
|
||||
private void checkDestroyWidget()
|
||||
{
|
||||
final int currentTick = client.getTickCount();
|
||||
@@ -679,6 +790,14 @@ public class ItemChargePlugin extends Plugin
|
||||
{
|
||||
charges = getItemCharges(ItemChargeConfig.KEY_AMULET_OF_BOUNTY);
|
||||
}
|
||||
else if (id == ItemID.BRACELET_OF_SLAUGHTER && type == ItemWithSlot.BRACELET_OF_SLAUGHTER)
|
||||
{
|
||||
charges = getItemCharges(ItemChargeConfig.KEY_BRACELET_OF_SLAUGHTER);
|
||||
}
|
||||
else if (id == ItemID.EXPEDITIOUS_BRACELET && type == ItemWithSlot.EXPEDITIOUS_BRACELET)
|
||||
{
|
||||
charges = getItemCharges(ItemChargeConfig.KEY_EXPEDITIOUS_BRACELET);
|
||||
}
|
||||
}
|
||||
else if (itemWithCharge.getType() == type.getType())
|
||||
{
|
||||
|
||||
@@ -31,6 +31,8 @@ enum ItemChargeType
|
||||
AMULET_OF_CHEMISTRY,
|
||||
AMULET_OF_BOUNTY,
|
||||
BELLOWS,
|
||||
BRACELET_OF_SLAUGHTER,
|
||||
EXPEDITIOUS_BRACELET,
|
||||
FUNGICIDE_SPRAY,
|
||||
IMPBOX,
|
||||
TELEPORT,
|
||||
|
||||
@@ -37,7 +37,9 @@ enum ItemWithSlot
|
||||
ABYSSAL_BRACELET(ItemChargeType.ABYSSAL_BRACELET, EquipmentInventorySlot.GLOVES),
|
||||
AMULET_OF_CHEMISTY(ItemChargeType.AMULET_OF_CHEMISTRY, EquipmentInventorySlot.AMULET),
|
||||
AMULET_OF_BOUNTY(ItemChargeType.AMULET_OF_BOUNTY, EquipmentInventorySlot.AMULET),
|
||||
BRACELET_OF_SLAUGHTER(ItemChargeType.BRACELET_OF_SLAUGHTER, EquipmentInventorySlot.GLOVES),
|
||||
DODGY_NECKLACE(ItemChargeType.DODGY_NECKLACE, EquipmentInventorySlot.AMULET),
|
||||
EXPEDITIOUS_BRACELET(ItemChargeType.EXPEDITIOUS_BRACELET, EquipmentInventorySlot.GLOVES),
|
||||
BINDING_NECKLACE(ItemChargeType.BINDING_NECKLACE, EquipmentInventorySlot.AMULET),
|
||||
EXPLORER_RING(ItemChargeType.EXPLORER_RING, EquipmentInventorySlot.RING),
|
||||
RING_OF_FORGING(ItemChargeType.RING_OF_FORGING, EquipmentInventorySlot.RING),
|
||||
|
||||
@@ -84,6 +84,16 @@ public class ItemChargePluginTest
|
||||
private static final String CHRONICLE_ADD_MULTIPLE_CHARGES = "You add 5 charges to your book. It now has 5 charges.";
|
||||
private static final String CHRONICLE_ADD_FULL = "Your book is fully charged! It has 1,000 charges already.";
|
||||
|
||||
private static final String CHECK_BRACELET_OF_SLAUGHTER = "Your bracelet of slaughter has 25 charges left.";
|
||||
private static final String CHECK_BRACELET_OF_SLAUGHTER_1 = "Your bracelet of slaughter has 1 charge left.";
|
||||
private static final String ACTIVATE_BRACELET_OF_SLAUGHTER = "Your bracelet of slaughter prevents your slayer count from decreasing. It has 16 charges left.";
|
||||
private static final String BREAK_BRACELET_OF_SLAUGHTER = "Your bracelet of slaughter prevents your slayer count from decreasing. <col=ff0000>It then crumbles to dust.</col>";
|
||||
|
||||
private static final String CHECK_EXPEDITIOUS_BRACELET = "Your expeditious bracelet has 6 charges left.";
|
||||
private static final String CHECK_EXPEDITIOUS_BRACELET_1 = "Your expeditious bracelet has 1 charge left.";
|
||||
private static final String ACTIVATE_EXPEDITIOUS_BRACELET = "Your expeditious bracelet helps you progress your slayer task faster. It has 11 charges left.";
|
||||
private static final String BREAK_EXPEDITIOUS_BRACELET = "Your expeditious bracelet helps you progress your slayer task faster. <col=ff0000>It then crumbles to dust.</col>";
|
||||
|
||||
@Mock
|
||||
@Bind
|
||||
private Client client;
|
||||
@@ -268,5 +278,47 @@ public class ItemChargePluginTest
|
||||
itemChargePlugin.onChatMessage(chatMessage);
|
||||
verify(configManager).setRSProfileConfiguration(ItemChargeConfig.GROUP, ItemChargeConfig.KEY_CHRONICLE, 1000);
|
||||
reset(configManager);
|
||||
|
||||
// Bracelet of Slaughter
|
||||
chatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", CHECK_BRACELET_OF_SLAUGHTER, "", 0);
|
||||
itemChargePlugin.onChatMessage(chatMessage);
|
||||
verify(configManager).setRSProfileConfiguration(ItemChargeConfig.GROUP, ItemChargeConfig.KEY_BRACELET_OF_SLAUGHTER, 25);
|
||||
reset(config);
|
||||
|
||||
chatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", CHECK_BRACELET_OF_SLAUGHTER_1, "", 0);
|
||||
itemChargePlugin.onChatMessage(chatMessage);
|
||||
verify(configManager).setRSProfileConfiguration(ItemChargeConfig.GROUP, ItemChargeConfig.KEY_BRACELET_OF_SLAUGHTER, 1);
|
||||
reset(config);
|
||||
|
||||
chatMessage = new ChatMessage(null, ChatMessageType.SPAM, "", ACTIVATE_BRACELET_OF_SLAUGHTER, "", 0);
|
||||
itemChargePlugin.onChatMessage(chatMessage);
|
||||
verify(configManager).setRSProfileConfiguration(ItemChargeConfig.GROUP, ItemChargeConfig.KEY_BRACELET_OF_SLAUGHTER, 16);
|
||||
reset(config);
|
||||
|
||||
chatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", BREAK_BRACELET_OF_SLAUGHTER, "", 0);
|
||||
itemChargePlugin.onChatMessage(chatMessage);
|
||||
verify(configManager).setRSProfileConfiguration(ItemChargeConfig.GROUP, ItemChargeConfig.KEY_BRACELET_OF_SLAUGHTER, 30);
|
||||
reset(config);
|
||||
|
||||
// Expeditious Bracelet
|
||||
chatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", CHECK_EXPEDITIOUS_BRACELET, "", 0);
|
||||
itemChargePlugin.onChatMessage(chatMessage);
|
||||
verify(configManager).setRSProfileConfiguration(ItemChargeConfig.GROUP, ItemChargeConfig.KEY_EXPEDITIOUS_BRACELET, 6);
|
||||
reset(config);
|
||||
|
||||
chatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", CHECK_EXPEDITIOUS_BRACELET_1, "", 0);
|
||||
itemChargePlugin.onChatMessage(chatMessage);
|
||||
verify(configManager).setRSProfileConfiguration(ItemChargeConfig.GROUP, ItemChargeConfig.KEY_EXPEDITIOUS_BRACELET, 1);
|
||||
reset(config);
|
||||
|
||||
chatMessage = new ChatMessage(null, ChatMessageType.SPAM, "", ACTIVATE_EXPEDITIOUS_BRACELET, "", 0);
|
||||
itemChargePlugin.onChatMessage(chatMessage);
|
||||
verify(configManager).setRSProfileConfiguration(ItemChargeConfig.GROUP, ItemChargeConfig.KEY_EXPEDITIOUS_BRACELET, 11);
|
||||
reset(config);
|
||||
|
||||
chatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", BREAK_EXPEDITIOUS_BRACELET, "", 0);
|
||||
itemChargePlugin.onChatMessage(chatMessage);
|
||||
verify(configManager).setRSProfileConfiguration(ItemChargeConfig.GROUP, ItemChargeConfig.KEY_EXPEDITIOUS_BRACELET, 30);
|
||||
reset(config);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user