Bank Plugin: Add option to enlarge bank pin numbers (#1425)
* Bank Plugin: Add option to enlarge bank pin numbers * Update
This commit is contained in:
@@ -1129,7 +1129,7 @@ public class WidgetID
|
||||
static final int BUTTON_7 = 28;
|
||||
static final int BUTTON_8 = 30;
|
||||
static final int BUTTON_9 = 32;
|
||||
static final int BUTTON_0 = 34;
|
||||
static final int BUTTON_10 = 34;
|
||||
}
|
||||
|
||||
static class SeedVault
|
||||
|
||||
@@ -742,7 +742,7 @@ public enum WidgetInfo
|
||||
BANK_PIN_7(WidgetID.BANK_PIN_GROUP_ID, WidgetID.BankPin.BUTTON_7),
|
||||
BANK_PIN_8(WidgetID.BANK_PIN_GROUP_ID, WidgetID.BankPin.BUTTON_8),
|
||||
BANK_PIN_9(WidgetID.BANK_PIN_GROUP_ID, WidgetID.BankPin.BUTTON_9),
|
||||
BANK_PIN_0(WidgetID.BANK_PIN_GROUP_ID, WidgetID.BankPin.BUTTON_0),
|
||||
BANK_PIN_10(WidgetID.BANK_PIN_GROUP_ID, WidgetID.BankPin.BUTTON_10),
|
||||
|
||||
XP_DROP_1(WidgetID.EXPERIENCE_DROP_GROUP_ID, WidgetID.ExperienceDrop.DROP_1),
|
||||
XP_DROP_2(WidgetID.EXPERIENCE_DROP_GROUP_ID, WidgetID.ExperienceDrop.DROP_2),
|
||||
|
||||
@@ -108,4 +108,15 @@ public interface BankConfig extends Config
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "largePinNumbers",
|
||||
name = "Large bank pin numbers",
|
||||
description = "Enlarges and centers the numbers inside the bank pin buttons",
|
||||
position = 8
|
||||
)
|
||||
default boolean largePinNumbers()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@ import lombok.Getter;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.InventoryID;
|
||||
import net.runelite.api.Item;
|
||||
import net.runelite.api.FontID;
|
||||
import net.runelite.api.ItemContainer;
|
||||
import net.runelite.api.MenuEntry;
|
||||
import net.runelite.api.events.ConfigChanged;
|
||||
@@ -77,10 +78,24 @@ public class BankPlugin extends Plugin
|
||||
Varbits.BANK_TAB_NINE_COUNT
|
||||
);
|
||||
|
||||
private static final List<WidgetInfo> BANK_PINS = ImmutableList.of(
|
||||
WidgetInfo.BANK_PIN_1,
|
||||
WidgetInfo.BANK_PIN_2,
|
||||
WidgetInfo.BANK_PIN_3,
|
||||
WidgetInfo.BANK_PIN_4,
|
||||
WidgetInfo.BANK_PIN_5,
|
||||
WidgetInfo.BANK_PIN_6,
|
||||
WidgetInfo.BANK_PIN_7,
|
||||
WidgetInfo.BANK_PIN_8,
|
||||
WidgetInfo.BANK_PIN_9,
|
||||
WidgetInfo.BANK_PIN_10
|
||||
);
|
||||
|
||||
private static final String DEPOSIT_WORN = "Deposit worn items";
|
||||
private static final String DEPOSIT_INVENTORY = "Deposit inventory";
|
||||
private static final String DEPOSIT_LOOT = "Deposit loot";
|
||||
private static final String SEED_VAULT_TITLE = "Seed Vault";
|
||||
private static final int PIN_FONT_OFFSET = 5;
|
||||
|
||||
@Inject
|
||||
private Client client;
|
||||
@@ -104,6 +119,7 @@ public class BankPlugin extends Plugin
|
||||
private ContainerCalculation seedVaultCalculation;
|
||||
|
||||
private boolean forceRightClickFlag;
|
||||
private boolean largePinNumbers;
|
||||
|
||||
@Provides
|
||||
BankConfig getConfig(ConfigManager configManager)
|
||||
@@ -178,6 +194,11 @@ public class BankPlugin extends Plugin
|
||||
|
||||
private void onScriptCallbackEvent(ScriptCallbackEvent event)
|
||||
{
|
||||
if (event.getEventName().equals("bankPinButtons") && this.largePinNumbers)
|
||||
{
|
||||
updateBankPinSizes();
|
||||
}
|
||||
|
||||
if (!event.getEventName().equals("setBankTitle"))
|
||||
{
|
||||
return;
|
||||
@@ -338,10 +359,45 @@ public class BankPlugin extends Plugin
|
||||
updateConfig();
|
||||
}
|
||||
|
||||
private void updateBankPinSizes()
|
||||
{
|
||||
for (final WidgetInfo widgetInfo : BANK_PINS)
|
||||
{
|
||||
final Widget pin = client.getWidget(widgetInfo);
|
||||
if (pin == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
final Widget[] children = pin.getDynamicChildren();
|
||||
if (children.length < 2)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
final Widget button = children[0];
|
||||
final Widget number = children[1];
|
||||
|
||||
// Change to a bigger font size
|
||||
number.setFontId(FontID.QUILL_CAPS_LARGE);
|
||||
number.setYTextAlignment(0);
|
||||
|
||||
// Change size to match container widths
|
||||
number.setOriginalWidth(button.getWidth());
|
||||
// The large font id text isn't centered, we need to offset it slightly
|
||||
number.setOriginalHeight(button.getHeight() + PIN_FONT_OFFSET);
|
||||
number.setOriginalY(-PIN_FONT_OFFSET);
|
||||
number.setOriginalX(0);
|
||||
|
||||
number.revalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private void updateConfig()
|
||||
{
|
||||
this.showGE = config.showGE();
|
||||
this.showHA = config.showHA();
|
||||
this.largePinNumbers = config.largePinNumbers();
|
||||
this.showExact = config.showExact();
|
||||
this.rightClickBankInventory = config.rightClickBankInventory();
|
||||
this.rightClickBankEquip = config.rightClickBankEquip();
|
||||
|
||||
@@ -198,7 +198,7 @@ public class RuneLitePlusPlugin extends Plugin
|
||||
|
||||
// Script 685 will call 653, which in turn will set expectInput to true
|
||||
expectInput = false;
|
||||
client.runScript(BANK_PIN_OP, num, enterIdx, entered, BANK_PIN_EXIT_BUTTON.getId(), BANK_PIN_FORGOT_BUTTON.getId(), BANK_PIN_1.getId(), BANK_PIN_2.getId(), BANK_PIN_3.getId(), BANK_PIN_4.getId(), BANK_PIN_5.getId(), BANK_PIN_6.getId(), BANK_PIN_7.getId(), BANK_PIN_8.getId(), BANK_PIN_9.getId(), BANK_PIN_0.getId(), BANK_PIN_FIRST_ENTERED.getId(), BANK_PIN_SECOND_ENTERED.getId(), BANK_PIN_THIRD_ENTERED.getId(), BANK_PIN_FOURTH_ENTERED.getId(), BANK_PIN_INSTRUCTION_TEXT.getId());
|
||||
client.runScript(BANK_PIN_OP, num, enterIdx, entered, BANK_PIN_EXIT_BUTTON.getId(), BANK_PIN_FORGOT_BUTTON.getId(), BANK_PIN_1.getId(), BANK_PIN_2.getId(), BANK_PIN_3.getId(), BANK_PIN_4.getId(), BANK_PIN_5.getId(), BANK_PIN_6.getId(), BANK_PIN_7.getId(), BANK_PIN_8.getId(), BANK_PIN_9.getId(), BANK_PIN_10.getId(), BANK_PIN_FIRST_ENTERED.getId(), BANK_PIN_SECOND_ENTERED.getId(), BANK_PIN_THIRD_ENTERED.getId(), BANK_PIN_FOURTH_ENTERED.getId(), BANK_PIN_INSTRUCTION_TEXT.getId());
|
||||
|
||||
if (oldEnterIdx == 0)
|
||||
{
|
||||
|
||||
@@ -488,5 +488,7 @@ LABEL188:
|
||||
iload 18
|
||||
sconst "iIIIIIIIIIIIIIIIII"
|
||||
iload 3
|
||||
if_setonop
|
||||
return
|
||||
if_setonop
|
||||
sconst "bankPinButtons" ; push event name
|
||||
runelite_callback ; invoke callback
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user