item charges: use RSProfiles for items with stored charges

This commit is contained in:
Hydrox6
2021-03-18 15:48:35 +00:00
committed by Adam
parent 3c5e779ec8
commit 988f90df05
4 changed files with 122 additions and 210 deletions

View File

@@ -32,9 +32,19 @@ import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem; import net.runelite.client.config.ConfigItem;
import net.runelite.client.config.ConfigSection; import net.runelite.client.config.ConfigSection;
@ConfigGroup("itemCharge") @ConfigGroup(ItemChargeConfig.GROUP)
public interface ItemChargeConfig extends Config public interface ItemChargeConfig extends Config
{ {
String GROUP = "itemCharge";
String KEY_AMULET_OF_BOUNTY = "amuletOfBounty";
String KEY_AMULET_OF_CHEMISTRY = "amuletOfChemistry";
String KEY_BINDING_NECKLACE = "bindingNecklace";
String KEY_CHRONICLE = "chronicle";
String KEY_DODGY_NECKLACE = "dodgyNecklace";
String KEY_EXPLORERS_RING = "explorerRing";
String KEY_RING_OF_FORGING = "ringOfForging";
@ConfigSection( @ConfigSection(
name = "Charge Settings", name = "Charge Settings",
description = "Configuration for which charges should be displayed", description = "Configuration for which charges should be displayed",
@@ -129,24 +139,6 @@ public interface ItemChargeConfig extends Config
return true; return true;
} }
@ConfigItem(
keyName = "dodgyNecklace",
name = "",
description = "",
hidden = true
)
default int dodgyNecklace()
{
return -1;
}
@ConfigItem(
keyName = "dodgyNecklace",
name = "",
description = ""
)
void dodgyNecklace(int dodgyNecklace);
@ConfigItem( @ConfigItem(
keyName = "showImpCharges", keyName = "showImpCharges",
name = "Imp-in-a-box charges", name = "Imp-in-a-box charges",
@@ -255,24 +247,6 @@ public interface ItemChargeConfig extends Config
return true; return true;
} }
@ConfigItem(
keyName = "amuletOfChemistry",
name = "",
description = "",
hidden = true
)
default int amuletOfChemistry()
{
return -1;
}
@ConfigItem(
keyName = "amuletOfChemistry",
name = "",
description = ""
)
void amuletOfChemistry(int amuletOfChemistry);
@ConfigItem( @ConfigItem(
keyName = "showAmuletOfBountyCharges", keyName = "showAmuletOfBountyCharges",
name = "Amulet of Bounty Charges", name = "Amulet of Bounty Charges",
@@ -285,24 +259,6 @@ public interface ItemChargeConfig extends Config
return true; return true;
} }
@ConfigItem(
keyName = "amuletOfBounty",
name = "",
description = "",
hidden = true
)
default int amuletOfBounty()
{
return -1;
}
@ConfigItem(
keyName = "amuletOfBounty",
name = "",
description = ""
)
void amuletOfBounty(int amuletOfBounty);
@ConfigItem( @ConfigItem(
keyName = "recoilNotification", keyName = "recoilNotification",
name = "Ring of Recoil Notification", name = "Ring of Recoil Notification",
@@ -327,24 +283,6 @@ public interface ItemChargeConfig extends Config
return true; return true;
} }
@ConfigItem(
keyName = "bindingNecklace",
name = "",
description = "",
hidden = true
)
default int bindingNecklace()
{
return -1;
}
@ConfigItem(
keyName = "bindingNecklace",
name = "",
description = ""
)
void bindingNecklace(int bindingNecklace);
@ConfigItem( @ConfigItem(
keyName = "bindingNotification", keyName = "bindingNotification",
name = "Binding Necklace Notification", name = "Binding Necklace Notification",
@@ -369,24 +307,6 @@ public interface ItemChargeConfig extends Config
return true; return true;
} }
@ConfigItem(
keyName = "explorerRing",
name = "",
description = "",
hidden = true
)
default int explorerRing()
{
return -1;
}
@ConfigItem(
keyName = "explorerRing",
name = "",
description = ""
)
void explorerRing(int explorerRing);
@ConfigItem( @ConfigItem(
keyName = "showRingOfForgingCount", keyName = "showRingOfForgingCount",
name = "Ring of Forging Charges", name = "Ring of Forging Charges",
@@ -399,24 +319,6 @@ public interface ItemChargeConfig extends Config
return true; return true;
} }
@ConfigItem(
keyName = "ringOfForging",
name = "",
description = "",
hidden = true
)
default int ringOfForging()
{
return -1;
}
@ConfigItem(
keyName = "ringOfForging",
name = "",
description = ""
)
void ringOfForging(int ringOfForging);
@ConfigItem( @ConfigItem(
keyName = "ringOfForgingNotification", keyName = "ringOfForgingNotification",
name = "Ring of Forging Notification", name = "Ring of Forging Notification",
@@ -451,22 +353,4 @@ public interface ItemChargeConfig extends Config
{ {
return false; return false;
} }
@ConfigItem(
keyName = "chronicle",
name = "",
description = "",
hidden = true
)
default int chronicle()
{
return -1;
}
@ConfigItem(
keyName = "chronicle",
name = "",
description = ""
)
void chronicle(int chronicle);
} }

View File

@@ -69,7 +69,7 @@ class ItemChargeOverlay extends WidgetItemOverlay
return; return;
} }
charges = config.dodgyNecklace(); charges = itemChargePlugin.getItemCharges(ItemChargeConfig.KEY_DODGY_NECKLACE);
} }
else if (itemId == ItemID.BINDING_NECKLACE) else if (itemId == ItemID.BINDING_NECKLACE)
{ {
@@ -78,7 +78,7 @@ class ItemChargeOverlay extends WidgetItemOverlay
return; return;
} }
charges = config.bindingNecklace(); charges = itemChargePlugin.getItemCharges(ItemChargeConfig.KEY_BINDING_NECKLACE);
} }
else if (itemId >= ItemID.EXPLORERS_RING_1 && itemId <= ItemID.EXPLORERS_RING_4) else if (itemId >= ItemID.EXPLORERS_RING_1 && itemId <= ItemID.EXPLORERS_RING_4)
{ {
@@ -87,7 +87,7 @@ class ItemChargeOverlay extends WidgetItemOverlay
return; return;
} }
charges = config.explorerRing(); charges = itemChargePlugin.getItemCharges(ItemChargeConfig.KEY_EXPLORERS_RING);
} }
else if (itemId == ItemID.RING_OF_FORGING) else if (itemId == ItemID.RING_OF_FORGING)
{ {
@@ -96,7 +96,7 @@ class ItemChargeOverlay extends WidgetItemOverlay
return; return;
} }
charges = config.ringOfForging(); charges = itemChargePlugin.getItemCharges(ItemChargeConfig.KEY_RING_OF_FORGING);
} }
else if (itemId == ItemID.AMULET_OF_CHEMISTRY) else if (itemId == ItemID.AMULET_OF_CHEMISTRY)
{ {
@@ -105,7 +105,7 @@ class ItemChargeOverlay extends WidgetItemOverlay
return; return;
} }
charges = config.amuletOfChemistry(); charges = itemChargePlugin.getItemCharges(ItemChargeConfig.KEY_AMULET_OF_CHEMISTRY);
} }
else if (itemId == ItemID.AMULET_OF_BOUNTY) else if (itemId == ItemID.AMULET_OF_BOUNTY)
{ {
@@ -114,7 +114,7 @@ class ItemChargeOverlay extends WidgetItemOverlay
return; return;
} }
charges = config.amuletOfBounty(); charges = itemChargePlugin.getItemCharges(ItemChargeConfig.KEY_AMULET_OF_BOUNTY);
} }
else if (itemId == ItemID.CHRONICLE) else if (itemId == ItemID.CHRONICLE)
{ {
@@ -123,7 +123,7 @@ class ItemChargeOverlay extends WidgetItemOverlay
return; return;
} }
charges = config.chronicle(); charges = itemChargePlugin.getItemCharges(ItemChargeConfig.KEY_CHRONICLE);
} }
else else
{ {

View File

@@ -129,6 +129,9 @@ public class ItemChargePlugin extends Plugin
@Inject @Inject
private ClientThread clientThread; private ClientThread clientThread;
@Inject
private ConfigManager configManager;
@Inject @Inject
private OverlayManager overlayManager; private OverlayManager overlayManager;
@@ -173,7 +176,7 @@ public class ItemChargePlugin extends Plugin
@Subscribe @Subscribe
public void onConfigChanged(ConfigChanged event) public void onConfigChanged(ConfigChanged event)
{ {
if (!event.getGroup().equals("itemCharge")) if (!event.getGroup().equals(ItemChargeConfig.GROUP))
{ {
return; return;
} }
@@ -310,7 +313,7 @@ public class ItemChargePlugin extends Plugin
} }
else if (bindingNecklaceUsedMatcher.find()) else if (bindingNecklaceUsedMatcher.find())
{ {
updateBindingNecklaceCharges(config.bindingNecklace() - 1); updateBindingNecklaceCharges(getItemCharges(ItemChargeConfig.KEY_BINDING_NECKLACE) - 1);
} }
else if (bindingNecklaceCheckMatcher.find()) else if (bindingNecklaceCheckMatcher.find())
{ {
@@ -347,7 +350,7 @@ public class ItemChargePlugin extends Plugin
if (equipment.contains(ItemID.RING_OF_FORGING)) if (equipment.contains(ItemID.RING_OF_FORGING))
{ {
int charges = Ints.constrainToRange(config.ringOfForging() - 1, 0, MAX_RING_OF_FORGING_CHARGES); int charges = Ints.constrainToRange(getItemCharges(ItemChargeConfig.KEY_RING_OF_FORGING) - 1, 0, MAX_RING_OF_FORGING_CHARGES);
updateRingOfForgingCharges(charges); updateRingOfForgingCharges(charges);
} }
} }
@@ -366,28 +369,28 @@ public class ItemChargePlugin extends Plugin
if (match.equals("one")) if (match.equals("one"))
{ {
config.chronicle(1); setItemCharges(ItemChargeConfig.KEY_CHRONICLE, 1);
} }
else else
{ {
config.chronicle(Integer.parseInt(match)); setItemCharges(ItemChargeConfig.KEY_CHRONICLE, Integer.parseInt(match));
} }
} }
else if (chronicleUseAndCheckMatcher.find()) else if (chronicleUseAndCheckMatcher.find())
{ {
config.chronicle(Integer.parseInt(chronicleUseAndCheckMatcher.group(1))); setItemCharges(ItemChargeConfig.KEY_CHRONICLE, Integer.parseInt(chronicleUseAndCheckMatcher.group(1)));
} }
else if (message.equals(CHRONICLE_ONE_CHARGE_TEXT)) else if (message.equals(CHRONICLE_ONE_CHARGE_TEXT))
{ {
config.chronicle(1); setItemCharges(ItemChargeConfig.KEY_CHRONICLE, 1);
} }
else if (message.equals(CHRONICLE_EMPTY_TEXT) || message.equals(CHRONICLE_NO_CHARGES_TEXT)) else if (message.equals(CHRONICLE_EMPTY_TEXT) || message.equals(CHRONICLE_NO_CHARGES_TEXT))
{ {
config.chronicle(0); setItemCharges(ItemChargeConfig.KEY_CHRONICLE, 0);
} }
else if (message.equals(CHRONICLE_FULL_TEXT)) else if (message.equals(CHRONICLE_FULL_TEXT))
{ {
config.chronicle(1000); setItemCharges(ItemChargeConfig.KEY_CHRONICLE, 1000);
} }
} }
} }
@@ -501,7 +504,7 @@ public class ItemChargePlugin extends Plugin
private void updateDodgyNecklaceCharges(final int value) private void updateDodgyNecklaceCharges(final int value)
{ {
config.dodgyNecklace(value); setItemCharges(ItemChargeConfig.KEY_DODGY_NECKLACE, value);
if (config.showInfoboxes() && config.showDodgyCount()) if (config.showInfoboxes() && config.showDodgyCount())
{ {
@@ -518,7 +521,7 @@ public class ItemChargePlugin extends Plugin
private void updateAmuletOfChemistryCharges(final int value) private void updateAmuletOfChemistryCharges(final int value)
{ {
config.amuletOfChemistry(value); setItemCharges(ItemChargeConfig.KEY_AMULET_OF_CHEMISTRY, value);
if (config.showInfoboxes() && config.showAmuletOfChemistryCharges()) if (config.showInfoboxes() && config.showAmuletOfChemistryCharges())
{ {
@@ -535,7 +538,7 @@ public class ItemChargePlugin extends Plugin
private void updateAmuletOfBountyCharges(final int value) private void updateAmuletOfBountyCharges(final int value)
{ {
config.amuletOfBounty(value); setItemCharges(ItemChargeConfig.KEY_AMULET_OF_BOUNTY, value);
if (config.showInfoboxes() && config.showAmuletOfBountyCharges()) if (config.showInfoboxes() && config.showAmuletOfBountyCharges())
{ {
@@ -552,7 +555,7 @@ public class ItemChargePlugin extends Plugin
private void updateBindingNecklaceCharges(final int value) private void updateBindingNecklaceCharges(final int value)
{ {
config.bindingNecklace(value); setItemCharges(ItemChargeConfig.KEY_BINDING_NECKLACE, value);
if (config.showInfoboxes() && config.showBindingNecklaceCharges()) if (config.showInfoboxes() && config.showBindingNecklaceCharges())
{ {
@@ -570,7 +573,7 @@ public class ItemChargePlugin extends Plugin
private void updateExplorerRingCharges(final int value) private void updateExplorerRingCharges(final int value)
{ {
// Note: Varbit counts upwards. We count down from the maximum charges. // Note: Varbit counts upwards. We count down from the maximum charges.
config.explorerRing(MAX_EXPLORER_RING_CHARGES - value); setItemCharges(ItemChargeConfig.KEY_EXPLORERS_RING, MAX_EXPLORER_RING_CHARGES - value);
if (config.showInfoboxes() && config.showExplorerRingCharges()) if (config.showInfoboxes() && config.showExplorerRingCharges())
{ {
@@ -587,7 +590,7 @@ public class ItemChargePlugin extends Plugin
private void updateRingOfForgingCharges(final int value) private void updateRingOfForgingCharges(final int value)
{ {
config.ringOfForging(value); setItemCharges(ItemChargeConfig.KEY_RING_OF_FORGING, value);
if (config.showInfoboxes() && config.showRingOfForgingCount()) if (config.showInfoboxes() && config.showRingOfForgingCount())
{ {
@@ -654,27 +657,27 @@ public class ItemChargePlugin extends Plugin
{ {
if (id == ItemID.DODGY_NECKLACE && type == ItemWithSlot.DODGY_NECKLACE) if (id == ItemID.DODGY_NECKLACE && type == ItemWithSlot.DODGY_NECKLACE)
{ {
charges = config.dodgyNecklace(); charges = getItemCharges(ItemChargeConfig.KEY_DODGY_NECKLACE);
} }
else if (id == ItemID.BINDING_NECKLACE && type == ItemWithSlot.BINDING_NECKLACE) else if (id == ItemID.BINDING_NECKLACE && type == ItemWithSlot.BINDING_NECKLACE)
{ {
charges = config.bindingNecklace(); charges = getItemCharges(ItemChargeConfig.KEY_BINDING_NECKLACE);
} }
else if ((id >= ItemID.EXPLORERS_RING_1 && id <= ItemID.EXPLORERS_RING_4) && type == ItemWithSlot.EXPLORER_RING) else if ((id >= ItemID.EXPLORERS_RING_1 && id <= ItemID.EXPLORERS_RING_4) && type == ItemWithSlot.EXPLORER_RING)
{ {
charges = config.explorerRing(); charges = getItemCharges(ItemChargeConfig.KEY_EXPLORERS_RING);
} }
else if (id == ItemID.RING_OF_FORGING && type == ItemWithSlot.RING_OF_FORGING) else if (id == ItemID.RING_OF_FORGING && type == ItemWithSlot.RING_OF_FORGING)
{ {
charges = config.ringOfForging(); charges = getItemCharges(ItemChargeConfig.KEY_RING_OF_FORGING);
} }
else if (id == ItemID.AMULET_OF_CHEMISTRY && type == ItemWithSlot.AMULET_OF_CHEMISTY) else if (id == ItemID.AMULET_OF_CHEMISTRY && type == ItemWithSlot.AMULET_OF_CHEMISTY)
{ {
charges = config.amuletOfChemistry(); charges = getItemCharges(ItemChargeConfig.KEY_AMULET_OF_CHEMISTRY);
} }
else if (id == ItemID.AMULET_OF_BOUNTY && type == ItemWithSlot.AMULET_OF_BOUNTY) else if (id == ItemID.AMULET_OF_BOUNTY && type == ItemWithSlot.AMULET_OF_BOUNTY)
{ {
charges = config.amuletOfBounty(); charges = getItemCharges(ItemChargeConfig.KEY_AMULET_OF_BOUNTY);
} }
} }
else if (itemWithCharge.getType() == type.getType()) else if (itemWithCharge.getType() == type.getType())
@@ -693,6 +696,26 @@ public class ItemChargePlugin extends Plugin
infoBoxManager.addInfoBox(infobox); infoBoxManager.addInfoBox(infobox);
} }
int getItemCharges(String key)
{
// Migrate old non-profile configurations
Integer i = configManager.getConfiguration(ItemChargeConfig.GROUP, key, Integer.class);
if (i != null)
{
configManager.unsetConfiguration(ItemChargeConfig.GROUP, key);
configManager.setRSProfileConfiguration(ItemChargeConfig.GROUP, key, i);
return i;
}
i = configManager.getRSProfileConfiguration(ItemChargeConfig.GROUP, key, Integer.class);
return i == null ? -1 : i;
}
private void setItemCharges(String key, int value)
{
configManager.setRSProfileConfiguration(ItemChargeConfig.GROUP, key, value);
}
private void removeInfobox(final ItemWithSlot item) private void removeInfobox(final ItemWithSlot item)
{ {
infoBoxManager.removeIf(t -> t instanceof ItemChargeInfobox && ((ItemChargeInfobox) t).getItem() == item); infoBoxManager.removeIf(t -> t instanceof ItemChargeInfobox && ((ItemChargeInfobox) t).getItem() == item);

View File

@@ -36,6 +36,7 @@ import net.runelite.api.ItemContainer;
import net.runelite.api.ItemID; import net.runelite.api.ItemID;
import net.runelite.api.events.ChatMessage; import net.runelite.api.events.ChatMessage;
import net.runelite.client.Notifier; import net.runelite.client.Notifier;
import net.runelite.client.config.ConfigManager;
import net.runelite.client.config.RuneLiteConfig; import net.runelite.client.config.RuneLiteConfig;
import net.runelite.client.ui.overlay.OverlayManager; import net.runelite.client.ui.overlay.OverlayManager;
import net.runelite.client.ui.overlay.infobox.InfoBoxManager; import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
@@ -111,6 +112,10 @@ public class ItemChargePluginTest
@Bind @Bind
private ItemChargeConfig config; private ItemChargeConfig config;
@Mock
@Bind
private ConfigManager configManager;
@Inject @Inject
private ItemChargePlugin itemChargePlugin; private ItemChargePlugin itemChargePlugin;
@@ -125,35 +130,35 @@ public class ItemChargePluginTest
{ {
ChatMessage chatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", CHECK, "", 0); ChatMessage chatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", CHECK, "", 0);
itemChargePlugin.onChatMessage(chatMessage); itemChargePlugin.onChatMessage(chatMessage);
verify(config).dodgyNecklace(10); verify(configManager).setRSProfileConfiguration(ItemChargeConfig.GROUP, ItemChargeConfig.KEY_DODGY_NECKLACE, 10);
reset(config); reset(configManager);
chatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", PROTECT, "", 0); chatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", PROTECT, "", 0);
itemChargePlugin.onChatMessage(chatMessage); itemChargePlugin.onChatMessage(chatMessage);
verify(config).dodgyNecklace(9); verify(configManager).setRSProfileConfiguration(ItemChargeConfig.GROUP, ItemChargeConfig.KEY_DODGY_NECKLACE, 9);
reset(config); reset(configManager);
chatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", PROTECT_1, "", 0); chatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", PROTECT_1, "", 0);
itemChargePlugin.onChatMessage(chatMessage); itemChargePlugin.onChatMessage(chatMessage);
verify(config).dodgyNecklace(1); verify(configManager).setRSProfileConfiguration(ItemChargeConfig.GROUP, ItemChargeConfig.KEY_DODGY_NECKLACE, 1);
reset(config); reset(configManager);
chatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", BREAK, "", 0); chatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", BREAK, "", 0);
itemChargePlugin.onChatMessage(chatMessage); itemChargePlugin.onChatMessage(chatMessage);
verify(config).dodgyNecklace(10); verify(configManager).setRSProfileConfiguration(ItemChargeConfig.GROUP, ItemChargeConfig.KEY_DODGY_NECKLACE, 10);
reset(config); reset(configManager);
chatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", CHECK_RING_OF_FORGING_ONE, "", 0); chatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", CHECK_RING_OF_FORGING_ONE, "", 0);
itemChargePlugin.onChatMessage(chatMessage); itemChargePlugin.onChatMessage(chatMessage);
verify(config).ringOfForging(1); verify(configManager).setRSProfileConfiguration(ItemChargeConfig.GROUP, ItemChargeConfig.KEY_RING_OF_FORGING, 1);
reset(config); reset(configManager);
chatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", CHECK_RING_OF_FORGING_FULL, "", 0); chatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", CHECK_RING_OF_FORGING_FULL, "", 0);
itemChargePlugin.onChatMessage(chatMessage); itemChargePlugin.onChatMessage(chatMessage);
verify(config).ringOfForging(140); verify(configManager).setRSProfileConfiguration(ItemChargeConfig.GROUP, ItemChargeConfig.KEY_RING_OF_FORGING, 140);
reset(config); reset(configManager);
when(config.ringOfForging()).thenReturn(90); when(configManager.getRSProfileConfiguration(ItemChargeConfig.GROUP, ItemChargeConfig.KEY_RING_OF_FORGING, Integer.class)).thenReturn(90);
// Create equipment inventory with ring of forging // Create equipment inventory with ring of forging
ItemContainer equipmentItemContainer = mock(ItemContainer.class); ItemContainer equipmentItemContainer = mock(ItemContainer.class);
when(client.getItemContainer(InventoryID.EQUIPMENT)).thenReturn(equipmentItemContainer); when(client.getItemContainer(InventoryID.EQUIPMENT)).thenReturn(equipmentItemContainer);
@@ -161,107 +166,107 @@ public class ItemChargePluginTest
// Run message // Run message
chatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", USED_RING_OF_FORGING, "", 0); chatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", USED_RING_OF_FORGING, "", 0);
itemChargePlugin.onChatMessage(chatMessage); itemChargePlugin.onChatMessage(chatMessage);
verify(config).ringOfForging(89); verify(configManager).setRSProfileConfiguration(ItemChargeConfig.GROUP, ItemChargeConfig.KEY_RING_OF_FORGING, 89);
reset(config); reset(configManager);
chatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", BREAK_RING_OF_FORGING, "", 0); chatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", BREAK_RING_OF_FORGING, "", 0);
itemChargePlugin.onChatMessage(chatMessage); itemChargePlugin.onChatMessage(chatMessage);
verify(config).ringOfForging(140); verify(configManager).setRSProfileConfiguration(ItemChargeConfig.GROUP, ItemChargeConfig.KEY_RING_OF_FORGING, 140);
reset(config); reset(configManager);
chatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", CHECK_AMULET_OF_CHEMISTRY, "", 0); chatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", CHECK_AMULET_OF_CHEMISTRY, "", 0);
itemChargePlugin.onChatMessage(chatMessage); itemChargePlugin.onChatMessage(chatMessage);
verify(config).amuletOfChemistry(5); verify(configManager).setRSProfileConfiguration(ItemChargeConfig.GROUP, ItemChargeConfig.KEY_AMULET_OF_CHEMISTRY, 5);
reset(config); reset(configManager);
chatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", CHECK_AMULET_OF_CHEMISTRY_1, "", 0); chatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", CHECK_AMULET_OF_CHEMISTRY_1, "", 0);
itemChargePlugin.onChatMessage(chatMessage); itemChargePlugin.onChatMessage(chatMessage);
verify(config).amuletOfChemistry(1); verify(configManager).setRSProfileConfiguration(ItemChargeConfig.GROUP, ItemChargeConfig.KEY_AMULET_OF_CHEMISTRY, 1);
reset(config); reset(configManager);
chatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", USED_AMULET_OF_CHEMISTRY, "", 0); chatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", USED_AMULET_OF_CHEMISTRY, "", 0);
itemChargePlugin.onChatMessage(chatMessage); itemChargePlugin.onChatMessage(chatMessage);
verify(config).amuletOfChemistry(4); verify(configManager).setRSProfileConfiguration(ItemChargeConfig.GROUP, ItemChargeConfig.KEY_AMULET_OF_CHEMISTRY, 4);
reset(config); reset(configManager);
chatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", USED_AMULET_OF_CHEMISTRY_3_DOSES, "", 0); chatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", USED_AMULET_OF_CHEMISTRY_3_DOSES, "", 0);
itemChargePlugin.onChatMessage(chatMessage); itemChargePlugin.onChatMessage(chatMessage);
verify(config).amuletOfChemistry(2); verify(configManager).setRSProfileConfiguration(ItemChargeConfig.GROUP, ItemChargeConfig.KEY_AMULET_OF_CHEMISTRY, 2);
reset(config); reset(configManager);
chatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", USED_AMULET_OF_CHEMISTRY_2_DOSES, "", 0); chatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", USED_AMULET_OF_CHEMISTRY_2_DOSES, "", 0);
itemChargePlugin.onChatMessage(chatMessage); itemChargePlugin.onChatMessage(chatMessage);
verify(config).amuletOfChemistry(1); verify(configManager).setRSProfileConfiguration(ItemChargeConfig.GROUP, ItemChargeConfig.KEY_AMULET_OF_CHEMISTRY, 1);
reset(config); reset(configManager);
chatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", BREAK_AMULET_OF_CHEMISTRY, "", 0); chatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", BREAK_AMULET_OF_CHEMISTRY, "", 0);
itemChargePlugin.onChatMessage(chatMessage); itemChargePlugin.onChatMessage(chatMessage);
verify(config).amuletOfChemistry(5); verify(configManager).setRSProfileConfiguration(ItemChargeConfig.GROUP, ItemChargeConfig.KEY_AMULET_OF_CHEMISTRY, 5);
reset(config); reset(configManager);
chatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", BREAK_AMULET_OF_CHEMISTRY_3_DOSES, "", 0); chatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", BREAK_AMULET_OF_CHEMISTRY_3_DOSES, "", 0);
itemChargePlugin.onChatMessage(chatMessage); itemChargePlugin.onChatMessage(chatMessage);
verify(config).amuletOfChemistry(5); verify(configManager).setRSProfileConfiguration(ItemChargeConfig.GROUP, ItemChargeConfig.KEY_AMULET_OF_CHEMISTRY, 5);
reset(config); reset(configManager);
chatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", BREAK_AMULET_OF_CHEMISTRY_2_DOSES, "", 0); chatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", BREAK_AMULET_OF_CHEMISTRY_2_DOSES, "", 0);
itemChargePlugin.onChatMessage(chatMessage); itemChargePlugin.onChatMessage(chatMessage);
verify(config).amuletOfChemistry(5); verify(configManager).setRSProfileConfiguration(ItemChargeConfig.GROUP, ItemChargeConfig.KEY_AMULET_OF_CHEMISTRY, 5);
reset(config); reset(configManager);
chatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", CHRONICLE_CHECK_CHARGES_FULL, "", 0); chatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", CHRONICLE_CHECK_CHARGES_FULL, "", 0);
itemChargePlugin.onChatMessage(chatMessage); itemChargePlugin.onChatMessage(chatMessage);
verify(config).chronicle(1000); verify(configManager).setRSProfileConfiguration(ItemChargeConfig.GROUP, ItemChargeConfig.KEY_CHRONICLE, 1000);
reset(config); reset(configManager);
chatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", CHRONICLE_CHECK_CHARGES_ONE, "", 0); chatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", CHRONICLE_CHECK_CHARGES_ONE, "", 0);
itemChargePlugin.onChatMessage(chatMessage); itemChargePlugin.onChatMessage(chatMessage);
verify(config).chronicle(1); verify(configManager).setRSProfileConfiguration(ItemChargeConfig.GROUP, ItemChargeConfig.KEY_CHRONICLE, 1);
reset(config); reset(configManager);
chatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", CHRONICLE_CHECK_CHARGES_EMPTY, "", 0); chatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", CHRONICLE_CHECK_CHARGES_EMPTY, "", 0);
itemChargePlugin.onChatMessage(chatMessage); itemChargePlugin.onChatMessage(chatMessage);
verify(config).chronicle(0); verify(configManager).setRSProfileConfiguration(ItemChargeConfig.GROUP, ItemChargeConfig.KEY_CHRONICLE, 0);
reset(config); reset(configManager);
chatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", CHRONICLE_TELEPORT, "", 0); chatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", CHRONICLE_TELEPORT, "", 0);
itemChargePlugin.onChatMessage(chatMessage); itemChargePlugin.onChatMessage(chatMessage);
verify(config).chronicle(999); verify(configManager).setRSProfileConfiguration(ItemChargeConfig.GROUP, ItemChargeConfig.KEY_CHRONICLE, 999);
reset(config); reset(configManager);
chatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", CHRONICLE_TELEPORT_ONE, "", 0); chatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", CHRONICLE_TELEPORT_ONE, "", 0);
itemChargePlugin.onChatMessage(chatMessage); itemChargePlugin.onChatMessage(chatMessage);
verify(config).chronicle(1); verify(configManager).setRSProfileConfiguration(ItemChargeConfig.GROUP, ItemChargeConfig.KEY_CHRONICLE, 1);
reset(config); reset(configManager);
chatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", CHRONICLE_TELEPORT_EMPTY, "", 0); chatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", CHRONICLE_TELEPORT_EMPTY, "", 0);
itemChargePlugin.onChatMessage(chatMessage); itemChargePlugin.onChatMessage(chatMessage);
verify(config).chronicle(0); verify(configManager).setRSProfileConfiguration(ItemChargeConfig.GROUP, ItemChargeConfig.KEY_CHRONICLE, 0);
reset(config); reset(configManager);
chatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", CHRONICLE_TELEPORT_FAIL, "", 0); chatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", CHRONICLE_TELEPORT_FAIL, "", 0);
itemChargePlugin.onChatMessage(chatMessage); itemChargePlugin.onChatMessage(chatMessage);
verify(config).chronicle(0); verify(configManager).setRSProfileConfiguration(ItemChargeConfig.GROUP, ItemChargeConfig.KEY_CHRONICLE, 0);
reset(config); reset(configManager);
chatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", CHRONICLE_ADD_SINGLE_CHARGE, "", 0); chatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", CHRONICLE_ADD_SINGLE_CHARGE, "", 0);
itemChargePlugin.onChatMessage(chatMessage); itemChargePlugin.onChatMessage(chatMessage);
verify(config).chronicle(1); verify(configManager).setRSProfileConfiguration(ItemChargeConfig.GROUP, ItemChargeConfig.KEY_CHRONICLE, 1);
reset(config); reset(configManager);
chatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", CHRONICLE_ADD_SINGLE_CHARGE_FULL, "", 0); chatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", CHRONICLE_ADD_SINGLE_CHARGE_FULL, "", 0);
itemChargePlugin.onChatMessage(chatMessage); itemChargePlugin.onChatMessage(chatMessage);
verify(config).chronicle(1000); verify(configManager).setRSProfileConfiguration(ItemChargeConfig.GROUP, ItemChargeConfig.KEY_CHRONICLE, 1000);
reset(config); reset(configManager);
chatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", CHRONICLE_ADD_MULTIPLE_CHARGES, "", 0); chatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", CHRONICLE_ADD_MULTIPLE_CHARGES, "", 0);
itemChargePlugin.onChatMessage(chatMessage); itemChargePlugin.onChatMessage(chatMessage);
verify(config).chronicle(5); verify(configManager).setRSProfileConfiguration(ItemChargeConfig.GROUP, ItemChargeConfig.KEY_CHRONICLE, 5);
reset(config); reset(configManager);
chatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", CHRONICLE_ADD_FULL, "", 0); chatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", CHRONICLE_ADD_FULL, "", 0);
itemChargePlugin.onChatMessage(chatMessage); itemChargePlugin.onChatMessage(chatMessage);
verify(config).chronicle(1000); verify(configManager).setRSProfileConfiguration(ItemChargeConfig.GROUP, ItemChargeConfig.KEY_CHRONICLE, 1000);
reset(config); reset(configManager);
} }
} }