Changes made as per feedback.

This commit is contained in:
lulwut
2019-05-17 13:49:58 +12:00
parent 72f1d0ab6f
commit 833e1523e8

View File

@@ -53,8 +53,6 @@ import net.runelite.api.events.ItemContainerChanged;
import net.runelite.api.events.MenuEntryAdded; import net.runelite.api.events.MenuEntryAdded;
import net.runelite.api.events.NpcDespawned; import net.runelite.api.events.NpcDespawned;
import net.runelite.api.events.NpcSpawned; import net.runelite.api.events.NpcSpawned;
import net.runelite.api.widgets.Widget;
import net.runelite.api.widgets.WidgetInfo;
import net.runelite.client.Notifier; import net.runelite.client.Notifier;
import net.runelite.client.config.ConfigManager; import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.Subscribe; import net.runelite.client.eventbus.Subscribe;
@@ -169,41 +167,35 @@ public class RunecraftPlugin extends Plugin
@Subscribe @Subscribe
public void onMenuEntryAdded(MenuEntryAdded entry) public void onMenuEntryAdded(MenuEntryAdded entry)
{ {
if (client.getGameState() != GameState.LOGGED_IN) if (wearingCape || wearingTiara)
{ {
return;
}
Widget loginScreenOne = client.getWidget(WidgetInfo.LOGIN_CLICK_TO_PLAY_SCREEN);
Widget loginScreenTwo = client.getWidget(WidgetInfo.LOGIN_CLICK_TO_PLAY_SCREEN_MESSAGE_OF_THE_DAY);
if (loginScreenOne != null || loginScreenTwo != null)
{
return;
}
final String option = Text.removeTags(entry.getOption()).toLowerCase(); final String option = Text.removeTags(entry.getOption()).toLowerCase();
final String target = Text.removeTags(entry.getTarget()).toLowerCase(); final String target = Text.removeTags(entry.getTarget()).toLowerCase();
final int id = entry.getIdentifier();
final int type = entry.getType();
if (target.contains("pouch") && !target.startsWith("rune"))
Widget widgetBankTitleBar = client.getWidget(WidgetInfo.BANK_TITLE_BAR);
if (isEssencePouch(target))
{ {
if (widgetBankTitleBar == null || widgetBankTitleBar.isHidden()) if (option.contains("deposit") && type == 57 && id == 2) //swap pouches based on empty/full and in ban
{ //swap pouches based on empty/full and in bank
swap(client, "Empty", option, target);
}
else
{ {
swap(client, "Fill", option, target); //Due to RuneLite issues the "Deposit" menutext will always show even though it is on fill swap(client, "fill", option, target);
swap(client, "cancel", option, "", target);
}
else if (option.equals("fill") && id != 9)
{
swap(client, "empty", option, target); //Due to RuneLite issues the "Deposit" menutext will always show even though it is on fill
} }
} }
else if (target.contains("ring of dueling") && option.contains("withdraw")) if (target.contains("ring of dueling") && option.contains("withdraw"))//withdraw-1 ring of dueling
{ //withdraw-1 ring of dueling {
swap(client, "withdraw-1", option, target); swap(client, "withdraw-1", option, target);
} }
else if (target.contains("binding necklace") && option.contains("withdraw")) else if (target.contains("binding necklace") && option.contains("withdraw")) //withdraw-1 binding necklace
{ //withdraw-1 binding necklace {
swap(client, "withdraw-1", option, target);
}
else if (target.contains("stamina") && option.contains("withdraw"))
{ //withdraw-1 stam
swap(client, "withdraw-1", option, target); swap(client, "withdraw-1", option, target);
} }
else if (target.contains("ring of dueling") && option.contains("remove")) else if (target.contains("ring of dueling") && option.contains("remove"))
@@ -217,26 +209,26 @@ public class RunecraftPlugin extends Plugin
swap(client, "castle wars", option, target); swap(client, "castle wars", option, target);
} }
} }
else if (target.contains("crafting cape") && option.contains("remove")) else if (target.contains("crafting cape") && option.contains("remove")) //teleport for crafting cape
{ //teleport for crafting cape {
swap(client, "Teleport", option, target); swap(client, "Teleport", option, target);
} }
else if (target.contains("max cape") && option.contains("remove")) else if (target.contains("max cape") && option.contains("remove")) //teleport for max cape
{ //teleport for max cape {
swap(client, "Crafting Guild", option, target); swap(client, "Crafting Guild", option, target);
} }
else if (target.contains("altar") && option.contains("craft")) // Don't accidentally click the altar to craft else if (target.contains("altar") && option.contains("craft")) // Don't accidentally click the altar to craft
{ {
hide(option, target, true); hide(option, target, true);
} }
else if (target.contains("pure")) // Don't accidentally use pure essence on altar else if (target.contains("pure") && option.contains("use")) // Don't accidentally use pure essence on altar
{ {
hide("use", target, true); hide("use", target, true);
hide("drop", target, true); hide("drop", target, true);
} }
} }
}
private void hide(String option, String target, boolean contains) private void hide(String option, String target, boolean contains)
{ {
final MenuEntry[] entries = client.getMenuEntries(); final MenuEntry[] entries = client.getMenuEntries();
@@ -282,11 +274,6 @@ public class RunecraftPlugin extends Plugin
} }
private boolean isEssencePouch(String target)
{
return (target.equalsIgnoreCase("Small Pouch") || target.equalsIgnoreCase("Medium Pouch") || target.equalsIgnoreCase("Large Pouch") || target.equalsIgnoreCase("Giant Pouch"));
}
@Subscribe @Subscribe
public void onDecorativeObjectSpawned(DecorativeObjectSpawned event) public void onDecorativeObjectSpawned(DecorativeObjectSpawned event)
{ {
@@ -334,8 +321,9 @@ public class RunecraftPlugin extends Plugin
{ {
final Item[] items = event.getItemContainer().getItems(); final Item[] items = event.getItemContainer().getItems();
wearingTiara = config.Lavas() && items[EquipmentInventorySlot.HEAD.getSlotIdx()].getId() == ItemID.FIRE_TIARA; wearingTiara = config.Lavas() && items[EquipmentInventorySlot.HEAD.getSlotIdx()].getId() == ItemID.FIRE_TIARA;
wearingCape = config.Lavas() && items[EquipmentInventorySlot.CAPE.getSlotIdx()].getId() == ItemID.RUNECRAFT_CAPE || items[EquipmentInventorySlot.CAPE.getSlotIdx()].getId() == ItemID.RUNECRAFT_CAPET; wearingCape = config.Lavas() && items[EquipmentInventorySlot.CAPE.getSlotIdx()].getId() == ItemID.RUNECRAFT_CAPE || config.Lavas() && items[EquipmentInventorySlot.CAPE.getSlotIdx()].getId() == ItemID.RUNECRAFT_CAPET || config.Lavas() && items[EquipmentInventorySlot.CAPE.getSlotIdx()].getId() == ItemID.MAX_CAPE_13342;
System.out.println("item changed");
System.out.println("item changed" + wearingCape);
} }
} }