spec counter: add config option for infoboxes

This commit is contained in:
Adam
2022-06-10 15:47:45 -04:00
parent ceb1c96134
commit 05567739b9
3 changed files with 21 additions and 2 deletions

View File

@@ -66,6 +66,17 @@ public interface SpecialCounterConfig extends Config
return Color.WHITE;
}
@ConfigItem(
position = 3,
keyName = "infobox",
name = "Infobox",
description = "Adds an infobox counting special attacks"
)
default boolean infobox()
{
return true;
}
@ConfigItem(
position = 10,
keyName = "dragonWarhammerThreshold",

View File

@@ -293,7 +293,10 @@ public class SpecialCounterPlugin extends Plugin
int hit = getHit(specialWeapon, hitsplat);
int localPlayerId = client.getLocalPlayer().getId();
if (config.infobox())
{
updateCounter(specialWeapon, null, hit);
}
if (!party.getMembers().isEmpty())
{
@@ -358,9 +361,12 @@ public class SpecialCounterPlugin extends Plugin
// Otherwise we only add the count if it is against a npc we are already tracking
if (interactedNpcIds.contains(event.getNpcId()))
{
if (config.infobox())
{
updateCounter(event.getWeapon(), name, event.getHit());
}
}
if (event.getWorld() == client.getWorld())
{

View File

@@ -115,6 +115,8 @@ public class SpecialCounterPluginTest
{
Guice.createInjector(BoundFieldModule.of(this)).injectMembers(this);
when(specialCounterConfig.infobox()).thenReturn(true);
// Set up spec weapon
ItemContainer equipment = mock(ItemContainer.class);
when(equipment.getItem(EquipmentInventorySlot.WEAPON.getSlotIdx())).thenReturn(new Item(ItemID.BANDOS_GODSWORD, 1));