Bank: additional feautres + tidy up (#2122)

1) added right click option for setting placeholders
2) added right click option for releasing placeholders
3) added right click option for search
added right click option for fill bank fillers
4) tidied up the config section.
5) changed config.bla to this.bla within the plugin
This commit is contained in:
Kyle
2019-12-13 19:58:02 +00:00
committed by GitHub
parent 2f3b495c8f
commit d928f0517f
2 changed files with 141 additions and 26 deletions

View File

@@ -28,15 +28,50 @@ package net.runelite.client.plugins.bank;
import net.runelite.client.config.Config; import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup; import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem; import net.runelite.client.config.ConfigItem;
import net.runelite.client.config.ConfigSection;
@ConfigGroup("bank") @ConfigGroup("bank")
public interface BankConfig extends Config public interface BankConfig extends Config
{ {
@ConfigSection(
name = "Show Values",
description = "",
position = 0,
keyName = "ValueSection"
)
default boolean ValueSection()
{
return false;
}
@ConfigSection(
name = "Disable Left Click",
description = "",
position = 1,
keyName = "DisableLClickSection"
)
default boolean DisableLClickSection()
{
return false;
}
@ConfigSection(
name = "Bank Pin",
description = "",
position = 2,
keyName = "BankPinSection"
)
default boolean BankPinSection()
{
return false;
}
@ConfigItem( @ConfigItem(
keyName = "showGE", keyName = "showGE",
name = "Show Grand Exchange price", name = "Show Grand Exchange price",
description = "Show grand exchange price total (GE)", description = "Show grand exchange price total (GE)",
position = 1 position = 0,
section = "ValueSection"
) )
default boolean showGE() default boolean showGE()
{ {
@@ -47,7 +82,8 @@ public interface BankConfig extends Config
keyName = "showHA", keyName = "showHA",
name = "Show high alchemy price", name = "Show high alchemy price",
description = "Show high alchemy price total (HA)", description = "Show high alchemy price total (HA)",
position = 2 position = 2,
section = "ValueSection"
) )
default boolean showHA() default boolean showHA()
{ {
@@ -58,18 +94,32 @@ public interface BankConfig extends Config
keyName = "showExact", keyName = "showExact",
name = "Show exact bank value", name = "Show exact bank value",
description = "Show exact bank value", description = "Show exact bank value",
position = 3 position = 3,
section = "ValueSection"
) )
default boolean showExact() default boolean showExact()
{ {
return false; return false;
} }
@ConfigItem(
keyName = "seedVaultValue",
name = "Show seed vault value",
description = "Adds the total value of all seeds inside the seed vault to the title",
position = 4,
section = "ValueSection"
)
default boolean seedVaultValue()
{
return true;
}
@ConfigItem( @ConfigItem(
keyName = "rightClickBankInventory", keyName = "rightClickBankInventory",
name = "Disable left click bank inventory", name = "Disable left click bank inventory",
description = "Configures whether the bank inventory button will bank your inventory on left click", description = "Configures whether the bank inventory button will bank your inventory on left click",
position = 4 position = 0,
section = "DisableLClickSection"
) )
default boolean rightClickBankInventory() default boolean rightClickBankInventory()
{ {
@@ -80,7 +130,8 @@ public interface BankConfig extends Config
keyName = "rightClickBankEquip", keyName = "rightClickBankEquip",
name = "Disable left click bank equipment", name = "Disable left click bank equipment",
description = "Configures whether the bank equipment button will bank your equipment on left click", description = "Configures whether the bank equipment button will bank your equipment on left click",
position = 5 position = 1,
section = "DisableLClickSection"
) )
default boolean rightClickBankEquip() default boolean rightClickBankEquip()
{ {
@@ -91,7 +142,8 @@ public interface BankConfig extends Config
keyName = "rightClickBankLoot", keyName = "rightClickBankLoot",
name = "Disable left click bank looting bag", name = "Disable left click bank looting bag",
description = "Configures whether the bank looting bag button will bank your looting bag contents on left click", description = "Configures whether the bank looting bag button will bank your looting bag contents on left click",
position = 6 position = 2,
section = "DisableLClickSection"
) )
default boolean rightClickBankLoot() default boolean rightClickBankLoot()
{ {
@@ -99,21 +151,59 @@ public interface BankConfig extends Config
} }
@ConfigItem( @ConfigItem(
keyName = "seedVaultValue", keyName = "rightClickSetPlaceholders",
name = "Show seed vault value", name = "Disable left click set placeholders",
description = "Adds the total value of all seeds inside the seed vault to the title", description = "Configures whether the set bank placeholder button will be on left click",
position = 7 position = 3,
section = "DisableLClickSection"
) )
default boolean seedVaultValue() default boolean rightClickSetPlaceholders()
{ {
return true; return false;
}
@ConfigItem(
keyName = "rightClickReleasePlaceholders",
name = "Disable left click release placeholder",
description = "Configures whether the release bank placeholder button will be on left click",
position = 4,
section = "DisableLClickSection"
)
default boolean rightClickReleasePlaceholders()
{
return false;
}
@ConfigItem(
keyName = "rightClickFillBankFiller",
name = "Disable left click fill bank fillers",
description = "Configures whether the fill bank fillers button will be on left click",
position = 5,
section = "DisableLClickSection"
)
default boolean rightClickFillBankFiller()
{
return false;
}
@ConfigItem(
keyName = "rightClickSearch",
name = "Disable left click search",
description = "Configures whether the search button will search on left click",
position = 6,
section = "DisableLClickSection"
)
default boolean rightClickSearch()
{
return false;
} }
@ConfigItem( @ConfigItem(
keyName = "largePinNumbers", keyName = "largePinNumbers",
name = "Large bank pin numbers", name = "Large bank pin numbers",
description = "Enlarges and centers the numbers inside the bank pin buttons", description = "Enlarges and centers the numbers inside the bank pin buttons",
position = 8 position = 0,
section = "BankPinSection"
) )
default boolean largePinNumbers() default boolean largePinNumbers()
{ {

View File

@@ -110,6 +110,12 @@ public class BankPlugin extends Plugin
private static final String DEPOSIT_WORN = "Deposit worn items"; private static final String DEPOSIT_WORN = "Deposit worn items";
private static final String DEPOSIT_INVENTORY = "Deposit inventory"; private static final String DEPOSIT_INVENTORY = "Deposit inventory";
private static final String DEPOSIT_LOOT = "Deposit loot"; private static final String DEPOSIT_LOOT = "Deposit loot";
private static final String DISABLE = "Disable";
private static final String ENABLE = "Enable";
private static final String RELEASE_ALL_PLACEHOLDERS = "Release all placeholders";
private static final String SEARCH = "Search";
private static final String FILL = "Fill";
private static final String SEED_VAULT_TITLE = "Seed Vault"; private static final String SEED_VAULT_TITLE = "Seed Vault";
private static final int PIN_FONT_OFFSET = 5; private static final int PIN_FONT_OFFSET = 5;
@@ -143,13 +149,6 @@ public class BankPlugin extends Plugin
private boolean largePinNumbers; private boolean largePinNumbers;
private Multiset<Integer> itemQuantities; // bank item quantities for bank value search private Multiset<Integer> itemQuantities; // bank item quantities for bank value search
private String searchString; private String searchString;
@Provides
BankConfig getConfig(ConfigManager configManager)
{
return configManager.getConfig(BankConfig.class);
}
@Getter(AccessLevel.PACKAGE) @Getter(AccessLevel.PACKAGE)
private boolean showGE; private boolean showGE;
@Getter(AccessLevel.PACKAGE) @Getter(AccessLevel.PACKAGE)
@@ -158,6 +157,17 @@ public class BankPlugin extends Plugin
private boolean rightClickBankInventory; private boolean rightClickBankInventory;
private boolean rightClickBankEquip; private boolean rightClickBankEquip;
private boolean rightClickBankLoot; private boolean rightClickBankLoot;
private boolean seedVaultValue;
private boolean rightClickSetPlaceholders;
private boolean rightClickReleasePlaceholders;
private boolean rightClickSearch;
private boolean rightClickFillBankFiller;
@Provides
BankConfig getConfig(ConfigManager configManager)
{
return configManager.getConfig(BankConfig.class);
}
@Override @Override
protected void startUp() protected void startUp()
@@ -188,7 +198,12 @@ public class BankPlugin extends Plugin
{ {
if ((entry.getOption().equals(DEPOSIT_WORN) && this.rightClickBankEquip) if ((entry.getOption().equals(DEPOSIT_WORN) && this.rightClickBankEquip)
|| (entry.getOption().equals(DEPOSIT_INVENTORY) && this.rightClickBankInventory) || (entry.getOption().equals(DEPOSIT_INVENTORY) && this.rightClickBankInventory)
|| (entry.getOption().equals(DEPOSIT_LOOT) && this.rightClickBankLoot)) || (entry.getOption().equals(DEPOSIT_LOOT) && this.rightClickBankLoot)
|| (entry.getOption().startsWith(DISABLE) && this.rightClickSetPlaceholders)
|| (entry.getOption().startsWith(ENABLE) && this.rightClickSetPlaceholders)
|| (entry.getOption().equals(RELEASE_ALL_PLACEHOLDERS) && this.rightClickReleasePlaceholders)
|| (entry.getOption().equals(SEARCH) && this.rightClickSearch)
|| (entry.getOption().equals(FILL) && this.rightClickFillBankFiller))
{ {
event.setForceRightClick(true); event.setForceRightClick(true);
return; return;
@@ -201,7 +216,12 @@ public class BankPlugin extends Plugin
{ {
if ((event.getOption().equals(DEPOSIT_WORN) && this.rightClickBankEquip) if ((event.getOption().equals(DEPOSIT_WORN) && this.rightClickBankEquip)
|| (event.getOption().equals(DEPOSIT_INVENTORY) && this.rightClickBankInventory) || (event.getOption().equals(DEPOSIT_INVENTORY) && this.rightClickBankInventory)
|| (event.getOption().equals(DEPOSIT_LOOT) && this.rightClickBankLoot)) || (event.getOption().equals(DEPOSIT_LOOT) && this.rightClickBankLoot)
|| (event.getOption().startsWith(DISABLE) && this.rightClickSetPlaceholders)
|| (event.getOption().startsWith(ENABLE) && this.rightClickSetPlaceholders)
|| (event.getOption().equals(RELEASE_ALL_PLACEHOLDERS) && this.rightClickReleasePlaceholders)
|| (event.getOption().equals(SEARCH) && this.rightClickSearch)
|| (event.getOption().equals(FILL) && this.rightClickFillBankFiller))
{ {
forceRightClickFlag = true; forceRightClickFlag = true;
} }
@@ -255,7 +275,7 @@ public class BankPlugin extends Plugin
@Subscribe @Subscribe
private void onWidgetLoaded(WidgetLoaded event) private void onWidgetLoaded(WidgetLoaded event)
{ {
if (event.getGroupId() != WidgetID.SEED_VAULT_GROUP_ID || !config.seedVaultValue()) if (event.getGroupId() != WidgetID.SEED_VAULT_GROUP_ID || !this.seedVaultValue)
{ {
return; return;
} }
@@ -300,7 +320,7 @@ public class BankPlugin extends Plugin
{ {
itemQuantities = null; itemQuantities = null;
} }
else if (containerId == InventoryID.SEED_VAULT.getId() && config.seedVaultValue()) else if (containerId == InventoryID.SEED_VAULT.getId() && this.seedVaultValue)
{ {
updateSeedVaultTotal(); updateSeedVaultTotal();
} }
@@ -312,7 +332,7 @@ public class BankPlugin extends Plugin
final long haPrice = prices.getHighAlchPrice(); final long haPrice = prices.getHighAlchPrice();
String strCurrentTab = ""; String strCurrentTab = "";
if (config.showGE() && gePrice != 0) if (this.showGE && gePrice != 0)
{ {
strCurrentTab += " ("; strCurrentTab += " (";
@@ -471,6 +491,11 @@ public class BankPlugin extends Plugin
this.rightClickBankInventory = config.rightClickBankInventory(); this.rightClickBankInventory = config.rightClickBankInventory();
this.rightClickBankEquip = config.rightClickBankEquip(); this.rightClickBankEquip = config.rightClickBankEquip();
this.rightClickBankLoot = config.rightClickBankLoot(); this.rightClickBankLoot = config.rightClickBankLoot();
this.seedVaultValue = config.seedVaultValue();
this.rightClickSetPlaceholders = config.rightClickSetPlaceholders();
this.rightClickReleasePlaceholders = config.rightClickReleasePlaceholders();
this.rightClickSearch = config.rightClickSearch();
this.rightClickFillBankFiller = config.rightClickFillBankFiller();
} }
@VisibleForTesting @VisibleForTesting