client: update for if3 inventory
This commit is contained in:
@@ -34,6 +34,7 @@ import java.util.regex.Matcher;
|
|||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import net.runelite.api.AnimationID;
|
import net.runelite.api.AnimationID;
|
||||||
import net.runelite.api.ChatMessageType;
|
import net.runelite.api.ChatMessageType;
|
||||||
import net.runelite.api.Client;
|
import net.runelite.api.Client;
|
||||||
@@ -58,6 +59,8 @@ import net.runelite.api.events.GameTick;
|
|||||||
import net.runelite.api.events.ItemContainerChanged;
|
import net.runelite.api.events.ItemContainerChanged;
|
||||||
import net.runelite.api.events.MenuOptionClicked;
|
import net.runelite.api.events.MenuOptionClicked;
|
||||||
import net.runelite.api.events.ProjectileMoved;
|
import net.runelite.api.events.ProjectileMoved;
|
||||||
|
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.callback.ClientThread;
|
import net.runelite.client.callback.ClientThread;
|
||||||
import net.runelite.client.config.ConfigManager;
|
import net.runelite.client.config.ConfigManager;
|
||||||
@@ -74,6 +77,7 @@ import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
|
|||||||
description = "Show information about cannon placement and/or amount of cannonballs",
|
description = "Show information about cannon placement and/or amount of cannonballs",
|
||||||
tags = {"combat", "notifications", "ranged", "overlay"}
|
tags = {"combat", "notifications", "ranged", "overlay"}
|
||||||
)
|
)
|
||||||
|
@Slf4j
|
||||||
public class CannonPlugin extends Plugin
|
public class CannonPlugin extends Plugin
|
||||||
{
|
{
|
||||||
private static final Pattern NUMBER_PATTERN = Pattern.compile("([0-9]+)");
|
private static final Pattern NUMBER_PATTERN = Pattern.compile("([0-9]+)");
|
||||||
@@ -284,16 +288,11 @@ public class CannonPlugin extends Plugin
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check if cannonballs are being used on the cannon
|
// Check if cannonballs are being used on the cannon
|
||||||
if (event.getMenuAction() == MenuAction.ITEM_USE_ON_GAME_OBJECT)
|
if (event.getMenuAction() == MenuAction.WIDGET_TARGET_ON_GAME_OBJECT && client.getSelectedWidget().getId() == WidgetInfo.INVENTORY.getId())
|
||||||
{
|
{
|
||||||
final int idx = client.getSelectedItemIndex();
|
final Widget selected = client.getSelectedWidget();
|
||||||
final ItemContainer items = client.getItemContainer(InventoryID.INVENTORY);
|
final int itemId = selected.getItemId();
|
||||||
if (items == null)
|
if (itemId != ItemID.CANNONBALL && itemId != ItemID.GRANITE_CANNONBALL)
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
final Item item = items.getItem(idx);
|
|
||||||
if (item == null || (item.getId() != ItemID.CANNONBALL && item.getId() != ItemID.GRANITE_CANNONBALL))
|
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -306,6 +305,7 @@ public class CannonPlugin extends Plugin
|
|||||||
|
|
||||||
// Store the click location as a WorldPoint to avoid issues with scene loads
|
// Store the click location as a WorldPoint to avoid issues with scene loads
|
||||||
clickedCannonLocation = WorldPoint.fromScene(client, event.getParam0(), event.getParam1(), client.getPlane());
|
clickedCannonLocation = WorldPoint.fromScene(client, event.getParam0(), event.getParam1(), client.getPlane());
|
||||||
|
log.debug("Updated cannon location: {}", clickedCannonLocation);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
|
|||||||
@@ -325,14 +325,8 @@ public class ClueScrollPlugin extends Plugin
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final boolean itemClicked = event.getMenuAction() == MenuAction.ITEM_FIRST_OPTION
|
final boolean isXMarksTheSpotOrb = event.getItemId() == ItemID.MYSTERIOUS_ORB_23069;
|
||||||
|| event.getMenuAction() == MenuAction.ITEM_SECOND_OPTION
|
if (isXMarksTheSpotOrb || event.getMenuOption().equals("Read"))
|
||||||
|| event.getMenuAction() == MenuAction.ITEM_THIRD_OPTION
|
|
||||||
|| event.getMenuAction() == MenuAction.ITEM_FOURTH_OPTION
|
|
||||||
|| event.getMenuAction() == MenuAction.ITEM_FIFTH_OPTION;
|
|
||||||
final boolean isXMarksTheSpotOrb = event.getId() == ItemID.MYSTERIOUS_ORB_23069;
|
|
||||||
|
|
||||||
if (itemClicked && (isXMarksTheSpotOrb || event.getMenuOption().equals("Read")))
|
|
||||||
{
|
{
|
||||||
final ItemComposition itemComposition = itemManager.getItemComposition(event.getId());
|
final ItemComposition itemComposition = itemManager.getItemComposition(event.getId());
|
||||||
|
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ import net.runelite.api.Skill;
|
|||||||
import net.runelite.api.Varbits;
|
import net.runelite.api.Varbits;
|
||||||
import net.runelite.api.events.ChatMessage;
|
import net.runelite.api.events.ChatMessage;
|
||||||
import net.runelite.api.events.MenuOptionClicked;
|
import net.runelite.api.events.MenuOptionClicked;
|
||||||
|
import net.runelite.api.widgets.WidgetInfo;
|
||||||
import net.runelite.client.eventbus.Subscribe;
|
import net.runelite.client.eventbus.Subscribe;
|
||||||
import net.runelite.client.plugins.crowdsourcing.CrowdsourcingManager;
|
import net.runelite.client.plugins.crowdsourcing.CrowdsourcingManager;
|
||||||
|
|
||||||
@@ -114,7 +115,8 @@ public class CrowdsourcingCooking
|
|||||||
|| action == MenuAction.GAME_OBJECT_SECOND_OPTION
|
|| action == MenuAction.GAME_OBJECT_SECOND_OPTION
|
||||||
|| action == MenuAction.GAME_OBJECT_THIRD_OPTION
|
|| action == MenuAction.GAME_OBJECT_THIRD_OPTION
|
||||||
|| action == MenuAction.GAME_OBJECT_FOURTH_OPTION
|
|| action == MenuAction.GAME_OBJECT_FOURTH_OPTION
|
||||||
|| action == MenuAction.GAME_OBJECT_FIFTH_OPTION)
|
|| action == MenuAction.GAME_OBJECT_FIFTH_OPTION
|
||||||
|
|| action == MenuAction.WIDGET_TARGET_ON_GAME_OBJECT && client.getSelectedWidget().getId() == WidgetInfo.INVENTORY.getId())
|
||||||
{
|
{
|
||||||
lastGameObjectClicked = menuOptionClicked.getId();
|
lastGameObjectClicked = menuOptionClicked.getId();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -77,7 +77,11 @@ public class CrowdsourcingZMI
|
|||||||
public void onMenuOptionClicked(MenuOptionClicked menuOptionClicked)
|
public void onMenuOptionClicked(MenuOptionClicked menuOptionClicked)
|
||||||
{
|
{
|
||||||
MenuAction action = menuOptionClicked.getMenuAction();
|
MenuAction action = menuOptionClicked.getMenuAction();
|
||||||
|
if (menuOptionClicked.isItemOp())
|
||||||
|
{
|
||||||
|
illegalActionTick = client.getTickCount();
|
||||||
|
return;
|
||||||
|
}
|
||||||
switch (action)
|
switch (action)
|
||||||
{
|
{
|
||||||
case ITEM_FIRST_OPTION:
|
case ITEM_FIRST_OPTION:
|
||||||
|
|||||||
@@ -54,10 +54,7 @@ import lombok.Setter;
|
|||||||
import lombok.Value;
|
import lombok.Value;
|
||||||
import net.runelite.api.Client;
|
import net.runelite.api.Client;
|
||||||
import net.runelite.api.GameState;
|
import net.runelite.api.GameState;
|
||||||
import net.runelite.api.InventoryID;
|
|
||||||
import net.runelite.api.Item;
|
|
||||||
import net.runelite.api.ItemComposition;
|
import net.runelite.api.ItemComposition;
|
||||||
import net.runelite.api.ItemContainer;
|
|
||||||
import net.runelite.api.ItemID;
|
import net.runelite.api.ItemID;
|
||||||
import net.runelite.api.MenuAction;
|
import net.runelite.api.MenuAction;
|
||||||
import net.runelite.api.MenuEntry;
|
import net.runelite.api.MenuEntry;
|
||||||
@@ -72,6 +69,7 @@ import net.runelite.api.events.ItemQuantityChanged;
|
|||||||
import net.runelite.api.events.ItemSpawned;
|
import net.runelite.api.events.ItemSpawned;
|
||||||
import net.runelite.api.events.MenuEntryAdded;
|
import net.runelite.api.events.MenuEntryAdded;
|
||||||
import net.runelite.api.events.MenuOptionClicked;
|
import net.runelite.api.events.MenuOptionClicked;
|
||||||
|
import net.runelite.api.widgets.WidgetInfo;
|
||||||
import net.runelite.client.Notifier;
|
import net.runelite.client.Notifier;
|
||||||
import net.runelite.client.callback.ClientThread;
|
import net.runelite.client.callback.ClientThread;
|
||||||
import net.runelite.client.config.ConfigManager;
|
import net.runelite.client.config.ConfigManager;
|
||||||
@@ -688,28 +686,16 @@ public class GroundItemsPlugin extends Plugin
|
|||||||
@Subscribe
|
@Subscribe
|
||||||
public void onMenuOptionClicked(MenuOptionClicked menuOptionClicked)
|
public void onMenuOptionClicked(MenuOptionClicked menuOptionClicked)
|
||||||
{
|
{
|
||||||
if (menuOptionClicked.getMenuAction() == MenuAction.ITEM_FIFTH_OPTION)
|
if (menuOptionClicked.isItemOp() && menuOptionClicked.getMenuOption().equals("Drop"))
|
||||||
{
|
{
|
||||||
int itemId = menuOptionClicked.getId();
|
int itemId = menuOptionClicked.getItemId();
|
||||||
// Keep a queue of recently dropped items to better detect
|
// Keep a queue of recently dropped items to better detect
|
||||||
// item spawns that are drops
|
// item spawns that are drops
|
||||||
droppedItemQueue.add(itemId);
|
droppedItemQueue.add(itemId);
|
||||||
}
|
}
|
||||||
else if (menuOptionClicked.getMenuAction() == MenuAction.ITEM_USE_ON_GAME_OBJECT)
|
else if (menuOptionClicked.getMenuAction() == MenuAction.WIDGET_TARGET_ON_GAME_OBJECT && client.getSelectedWidget().getId() == WidgetInfo.INVENTORY.getId())
|
||||||
{
|
{
|
||||||
final ItemContainer inventory = client.getItemContainer(InventoryID.INVENTORY);
|
lastUsedItem = client.getSelectedWidget().getItemId();
|
||||||
if (inventory == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
final Item clickedItem = inventory.getItem(client.getSelectedItemIndex());
|
|
||||||
if (clickedItem == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
lastUsedItem = clickedItem.getId();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -176,8 +176,11 @@ public class InteractHighlightPlugin extends Plugin
|
|||||||
// Any menu click which clears an interaction
|
// Any menu click which clears an interaction
|
||||||
case WALK:
|
case WALK:
|
||||||
case ITEM_USE:
|
case ITEM_USE:
|
||||||
|
case WIDGET_TARGET_ON_WIDGET:
|
||||||
case ITEM_USE_ON_GROUND_ITEM:
|
case ITEM_USE_ON_GROUND_ITEM:
|
||||||
|
case WIDGET_TARGET_ON_GROUND_ITEM:
|
||||||
case ITEM_USE_ON_PLAYER:
|
case ITEM_USE_ON_PLAYER:
|
||||||
|
case WIDGET_TARGET_ON_PLAYER:
|
||||||
case ITEM_FIRST_OPTION:
|
case ITEM_FIRST_OPTION:
|
||||||
case ITEM_SECOND_OPTION:
|
case ITEM_SECOND_OPTION:
|
||||||
case ITEM_THIRD_OPTION:
|
case ITEM_THIRD_OPTION:
|
||||||
@@ -190,6 +193,13 @@ public class InteractHighlightPlugin extends Plugin
|
|||||||
case GROUND_ITEM_FIFTH_OPTION:
|
case GROUND_ITEM_FIFTH_OPTION:
|
||||||
interactedObject = null;
|
interactedObject = null;
|
||||||
interactedNpc = null;
|
interactedNpc = null;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
if (menuOptionClicked.isItemOp())
|
||||||
|
{
|
||||||
|
interactedObject = null;
|
||||||
|
interactedNpc = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -164,42 +164,43 @@ public class InventoryTagsPlugin extends Plugin
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final int widgetId = firstEntry.getParam1();
|
final int itemId;
|
||||||
|
if (firstEntry.getType() == MenuAction.WIDGET_TARGET && firstEntry.getWidget().getId() == WidgetInfo.INVENTORY.getId())
|
||||||
// Inventory item menu
|
|
||||||
if (widgetId == WidgetInfo.INVENTORY.getId())
|
|
||||||
{
|
{
|
||||||
int itemId = firstEntry.getIdentifier();
|
itemId = firstEntry.getWidget().getItemId();
|
||||||
|
}
|
||||||
|
else if (firstEntry.isItemOp())
|
||||||
|
{
|
||||||
|
itemId = firstEntry.getItemId();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (itemId == -1)
|
// Set menu to only be Cancel
|
||||||
{
|
client.setMenuEntries(Arrays.copyOf(client.getMenuEntries(), 1));
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set menu to only be Cancel
|
for (final String groupName : GROUPS)
|
||||||
client.setMenuEntries(Arrays.copyOf(client.getMenuEntries(), 1));
|
{
|
||||||
|
final String group = getTag(itemId);
|
||||||
|
final Color color = getGroupNameColor(groupName);
|
||||||
|
|
||||||
for (final String groupName : GROUPS)
|
client.createMenuEntry(-1)
|
||||||
{
|
.setOption(groupName.equals(group) ? MENU_REMOVE : MENU_SET)
|
||||||
final String group = getTag(itemId);
|
.setTarget(ColorUtil.prependColorTag(groupName, MoreObjects.firstNonNull(color, Color.WHITE)))
|
||||||
final Color color = getGroupNameColor(groupName);
|
.setType(MenuAction.RUNELITE)
|
||||||
|
.onClick(e ->
|
||||||
client.createMenuEntry(-1)
|
{
|
||||||
.setOption(groupName.equals(group) ? MENU_REMOVE : MENU_SET)
|
if (e.getOption().equals(MENU_SET))
|
||||||
.setTarget(ColorUtil.prependColorTag(groupName, MoreObjects.firstNonNull(color, Color.WHITE)))
|
|
||||||
.setType(MenuAction.RUNELITE)
|
|
||||||
.onClick(e ->
|
|
||||||
{
|
{
|
||||||
if (e.getOption().equals(MENU_SET))
|
setTag(itemId, groupName);
|
||||||
{
|
}
|
||||||
setTag(itemId, groupName);
|
else
|
||||||
}
|
{
|
||||||
else
|
unsetTag(itemId);
|
||||||
{
|
}
|
||||||
unsetTag(itemId);
|
});
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -98,11 +98,20 @@ class ItemPricesOverlay extends Overlay
|
|||||||
// Tooltip action type handling
|
// Tooltip action type handling
|
||||||
switch (action)
|
switch (action)
|
||||||
{
|
{
|
||||||
|
case WIDGET_TARGET_ON_WIDGET:
|
||||||
|
// Check target widget is the inventory
|
||||||
|
if (menuEntry.getWidget().getId() != WidgetInfo.INVENTORY.getId())
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// FALLTHROUGH
|
||||||
case WIDGET_USE_ON_ITEM:
|
case WIDGET_USE_ON_ITEM:
|
||||||
|
// Require showWhileAlching and Cast High Level Alchemy
|
||||||
if (!config.showWhileAlching() || !isAlching)
|
if (!config.showWhileAlching() || !isAlching)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
// FALLTHROUGH
|
||||||
case CC_OP:
|
case CC_OP:
|
||||||
case ITEM_USE:
|
case ITEM_USE:
|
||||||
case ITEM_FIRST_OPTION:
|
case ITEM_FIRST_OPTION:
|
||||||
@@ -110,38 +119,49 @@ class ItemPricesOverlay extends Overlay
|
|||||||
case ITEM_THIRD_OPTION:
|
case ITEM_THIRD_OPTION:
|
||||||
case ITEM_FOURTH_OPTION:
|
case ITEM_FOURTH_OPTION:
|
||||||
case ITEM_FIFTH_OPTION:
|
case ITEM_FIFTH_OPTION:
|
||||||
// Item tooltip values
|
addTooltip(menuEntry, isAlching, groupId);
|
||||||
switch (groupId)
|
|
||||||
{
|
|
||||||
case WidgetID.EXPLORERS_RING_ALCH_GROUP_ID:
|
|
||||||
if (!config.showWhileAlching())
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
case WidgetID.INVENTORY_GROUP_ID:
|
|
||||||
case WidgetID.POH_TREASURE_CHEST_INVENTORY_GROUP_ID:
|
|
||||||
if (config.hideInventory() && !(config.showWhileAlching() && isAlching))
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
// intentional fallthrough
|
|
||||||
case WidgetID.BANK_GROUP_ID:
|
|
||||||
case WidgetID.BANK_INVENTORY_GROUP_ID:
|
|
||||||
case WidgetID.SEED_VAULT_GROUP_ID:
|
|
||||||
case WidgetID.SEED_VAULT_INVENTORY_GROUP_ID:
|
|
||||||
// Make tooltip
|
|
||||||
final String text = makeValueTooltip(menuEntry);
|
|
||||||
if (text != null)
|
|
||||||
{
|
|
||||||
tooltipManager.add(new Tooltip(ColorUtil.prependColorTag(text, new Color(238, 238, 238))));
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
case WIDGET_TARGET:
|
||||||
|
// Check that this is the inventory
|
||||||
|
if (menuEntry.getWidget().getId() == WidgetInfo.INVENTORY.getId())
|
||||||
|
{
|
||||||
|
addTooltip(menuEntry, isAlching, groupId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void addTooltip(MenuEntry menuEntry, boolean isAlching, int groupId)
|
||||||
|
{
|
||||||
|
// Item tooltip values
|
||||||
|
switch (groupId)
|
||||||
|
{
|
||||||
|
case WidgetID.EXPLORERS_RING_ALCH_GROUP_ID:
|
||||||
|
if (!config.showWhileAlching())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
case WidgetID.INVENTORY_GROUP_ID:
|
||||||
|
case WidgetID.POH_TREASURE_CHEST_INVENTORY_GROUP_ID:
|
||||||
|
if (config.hideInventory() && (!config.showWhileAlching() || !isAlching))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// FALLTHROUGH
|
||||||
|
case WidgetID.BANK_GROUP_ID:
|
||||||
|
case WidgetID.BANK_INVENTORY_GROUP_ID:
|
||||||
|
case WidgetID.SEED_VAULT_GROUP_ID:
|
||||||
|
case WidgetID.SEED_VAULT_INVENTORY_GROUP_ID:
|
||||||
|
// Make tooltip
|
||||||
|
final String text = makeValueTooltip(menuEntry);
|
||||||
|
if (text != null)
|
||||||
|
{
|
||||||
|
tooltipManager.add(new Tooltip(ColorUtil.prependColorTag(text, new Color(238, 238, 238))));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private String makeValueTooltip(MenuEntry menuEntry)
|
private String makeValueTooltip(MenuEntry menuEntry)
|
||||||
{
|
{
|
||||||
// Disabling both disables all value tooltips
|
// Disabling both disables all value tooltips
|
||||||
|
|||||||
@@ -971,19 +971,19 @@ public class LootTrackerPlugin extends Plugin
|
|||||||
{
|
{
|
||||||
onInvChange(collectInvAndGroundItems(LootRecordType.EVENT, SHADE_CHEST_OBJECTS.get(event.getId())));
|
onInvChange(collectInvAndGroundItems(LootRecordType.EVENT, SHADE_CHEST_OBJECTS.get(event.getId())));
|
||||||
}
|
}
|
||||||
else if (isItemOp(event.getMenuAction()))
|
else if (event.isItemOp())
|
||||||
{
|
{
|
||||||
if (event.getMenuOption().equals("Take") && event.getId() == ItemID.SEED_PACK)
|
if (event.getMenuOption().equals("Take") && event.getItemId() == ItemID.SEED_PACK)
|
||||||
{
|
{
|
||||||
onInvChange(collectInvItems(LootRecordType.EVENT, SEEDPACK_EVENT));
|
onInvChange(collectInvItems(LootRecordType.EVENT, SEEDPACK_EVENT));
|
||||||
}
|
}
|
||||||
else if (event.getMenuOption().equals("Search") && BIRDNEST_IDS.contains(event.getId()))
|
else if (event.getMenuOption().equals("Search") && BIRDNEST_IDS.contains(event.getItemId()))
|
||||||
{
|
{
|
||||||
onInvChange(collectInvItems(LootRecordType.EVENT, BIRDNEST_EVENT));
|
onInvChange(collectInvItems(LootRecordType.EVENT, BIRDNEST_EVENT));
|
||||||
}
|
}
|
||||||
else if (event.getMenuOption().equals("Open"))
|
else if (event.getMenuOption().equals("Open"))
|
||||||
{
|
{
|
||||||
switch (event.getId())
|
switch (event.getItemId())
|
||||||
{
|
{
|
||||||
case ItemID.CASKET:
|
case ItemID.CASKET:
|
||||||
onInvChange(collectInvItems(LootRecordType.EVENT, CASKET_EVENT));
|
onInvChange(collectInvItems(LootRecordType.EVENT, CASKET_EVENT));
|
||||||
@@ -1004,7 +1004,7 @@ public class LootTrackerPlugin extends Plugin
|
|||||||
case ItemID.SIMPLE_LOCKBOX_25647:
|
case ItemID.SIMPLE_LOCKBOX_25647:
|
||||||
case ItemID.ELABORATE_LOCKBOX_25649:
|
case ItemID.ELABORATE_LOCKBOX_25649:
|
||||||
case ItemID.ORNATE_LOCKBOX_25651:
|
case ItemID.ORNATE_LOCKBOX_25651:
|
||||||
onInvChange(collectInvAndGroundItems(LootRecordType.EVENT, itemManager.getItemComposition(event.getId()).getName()));
|
onInvChange(collectInvAndGroundItems(LootRecordType.EVENT, itemManager.getItemComposition(event.getItemId()).getName()));
|
||||||
break;
|
break;
|
||||||
case ItemID.SUPPLY_CRATE_24884:
|
case ItemID.SUPPLY_CRATE_24884:
|
||||||
onInvChange(collectInvItems(LootRecordType.EVENT, MAHOGANY_CRATE_EVENT, client.getBoostedSkillLevel(Skill.CONSTRUCTION)));
|
onInvChange(collectInvItems(LootRecordType.EVENT, MAHOGANY_CRATE_EVENT, client.getBoostedSkillLevel(Skill.CONSTRUCTION)));
|
||||||
@@ -1014,14 +1014,14 @@ public class LootTrackerPlugin extends Plugin
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (event.getMenuOption().equals("Loot") && IMPLING_JARS.contains(event.getId()))
|
else if (event.getMenuOption().equals("Loot") && IMPLING_JARS.contains(event.getItemId()))
|
||||||
{
|
{
|
||||||
onInvChange(((invItems, groundItems, removedItems) ->
|
onInvChange(((invItems, groundItems, removedItems) ->
|
||||||
{
|
{
|
||||||
int cnt = removedItems.count(event.getId());
|
int cnt = removedItems.count(event.getItemId());
|
||||||
if (cnt > 0)
|
if (cnt > 0)
|
||||||
{
|
{
|
||||||
String name = itemManager.getItemComposition(event.getId()).getName();
|
String name = itemManager.getItemComposition(event.getItemId()).getName();
|
||||||
addLoot(name, -1, LootRecordType.EVENT, null, invItems, cnt);
|
addLoot(name, -1, LootRecordType.EVENT, null, invItems, cnt);
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
@@ -1038,12 +1038,6 @@ public class LootTrackerPlugin extends Plugin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isItemOp(MenuAction menuAction)
|
|
||||||
{
|
|
||||||
final int id = menuAction.getId();
|
|
||||||
return id >= MenuAction.ITEM_FIRST_OPTION.getId() && id <= MenuAction.ITEM_FIFTH_OPTION.getId();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static boolean isNPCOp(MenuAction menuAction)
|
private static boolean isNPCOp(MenuAction menuAction)
|
||||||
{
|
{
|
||||||
final int id = menuAction.getId();
|
final int id = menuAction.getId();
|
||||||
|
|||||||
@@ -132,15 +132,6 @@ public class MenuEntrySwapperPlugin extends Plugin
|
|||||||
private static final WidgetMenuOption RESIZABLE_BOTTOM_LINE_INVENTORY_TAB_SAVE_LC = new WidgetMenuOption(SAVE,
|
private static final WidgetMenuOption RESIZABLE_BOTTOM_LINE_INVENTORY_TAB_SAVE_LC = new WidgetMenuOption(SAVE,
|
||||||
LEFT_CLICK_MENU_TARGET, WidgetInfo.RESIZABLE_VIEWPORT_BOTTOM_LINE_INVENTORY_TAB);
|
LEFT_CLICK_MENU_TARGET, WidgetInfo.RESIZABLE_VIEWPORT_BOTTOM_LINE_INVENTORY_TAB);
|
||||||
|
|
||||||
private static final Set<MenuAction> ITEM_MENU_TYPES = ImmutableSet.of(
|
|
||||||
MenuAction.ITEM_FIRST_OPTION,
|
|
||||||
MenuAction.ITEM_SECOND_OPTION,
|
|
||||||
MenuAction.ITEM_THIRD_OPTION,
|
|
||||||
MenuAction.ITEM_FOURTH_OPTION,
|
|
||||||
MenuAction.ITEM_FIFTH_OPTION,
|
|
||||||
MenuAction.ITEM_USE
|
|
||||||
);
|
|
||||||
|
|
||||||
private static final List<MenuAction> NPC_MENU_TYPES = ImmutableList.of(
|
private static final List<MenuAction> NPC_MENU_TYPES = ImmutableList.of(
|
||||||
MenuAction.NPC_FIRST_OPTION,
|
MenuAction.NPC_FIRST_OPTION,
|
||||||
MenuAction.NPC_SECOND_OPTION,
|
MenuAction.NPC_SECOND_OPTION,
|
||||||
@@ -536,25 +527,27 @@ public class MenuEntrySwapperPlugin extends Plugin
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
MenuEntry firstEntry = event.getFirstEntry();
|
final MenuEntry firstEntry = event.getFirstEntry();
|
||||||
if (firstEntry == null)
|
if (firstEntry == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int widgetId = firstEntry.getParam1();
|
final int itemId;
|
||||||
if (widgetId != WidgetInfo.INVENTORY.getId())
|
if (firstEntry.getType() == MenuAction.WIDGET_TARGET && firstEntry.getWidget().getId() == WidgetInfo.INVENTORY.getId())
|
||||||
|
{
|
||||||
|
itemId = firstEntry.getWidget().getItemId();
|
||||||
|
}
|
||||||
|
else if (firstEntry.isItemOp())
|
||||||
|
{
|
||||||
|
itemId = firstEntry.getItemId();
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int itemId = firstEntry.getIdentifier();
|
int activeOp = 0;
|
||||||
if (itemId == -1)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
MenuAction activeAction = null;
|
|
||||||
final ItemComposition itemComposition = itemManager.getItemComposition(itemId);
|
final ItemComposition itemComposition = itemManager.getItemComposition(itemId);
|
||||||
|
|
||||||
if (configuringShiftClick)
|
if (configuringShiftClick)
|
||||||
@@ -565,7 +558,7 @@ public class MenuEntrySwapperPlugin extends Plugin
|
|||||||
|
|
||||||
if (shiftClickActionIndex >= 0)
|
if (shiftClickActionIndex >= 0)
|
||||||
{
|
{
|
||||||
activeAction = MenuAction.of(MenuAction.ITEM_FIRST_OPTION.getId() + shiftClickActionIndex);
|
activeOp = 1 + shiftClickActionIndex;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -573,7 +566,7 @@ public class MenuEntrySwapperPlugin extends Plugin
|
|||||||
Integer config = getItemSwapConfig(true, itemId);
|
Integer config = getItemSwapConfig(true, itemId);
|
||||||
if (config != null && config == -1)
|
if (config != null && config == -1)
|
||||||
{
|
{
|
||||||
activeAction = MenuAction.ITEM_USE;
|
activeOp = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -583,9 +576,9 @@ public class MenuEntrySwapperPlugin extends Plugin
|
|||||||
Integer config = getItemSwapConfig(false, itemId);
|
Integer config = getItemSwapConfig(false, itemId);
|
||||||
if (config != null)
|
if (config != null)
|
||||||
{
|
{
|
||||||
activeAction = config >= 0
|
activeOp = config >= 0
|
||||||
? MenuAction.of(MenuAction.ITEM_FIRST_OPTION.getId() + config)
|
? 1 + config
|
||||||
: MenuAction.ITEM_USE;
|
: -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -593,20 +586,31 @@ public class MenuEntrySwapperPlugin extends Plugin
|
|||||||
|
|
||||||
for (MenuEntry entry : entries)
|
for (MenuEntry entry : entries)
|
||||||
{
|
{
|
||||||
final MenuAction menuAction = entry.getType();
|
if (entry.getType() == MenuAction.WIDGET_TARGET && entry.getWidget().getId() == WidgetInfo.INVENTORY.getId() && entry.getWidget().getItemId() == itemId)
|
||||||
|
|
||||||
if (ITEM_MENU_TYPES.contains(menuAction) && entry.getIdentifier() == itemId)
|
|
||||||
{
|
{
|
||||||
entry.setType(MenuAction.RUNELITE);
|
entry.setType(MenuAction.RUNELITE);
|
||||||
entry.onClick(e ->
|
entry.onClick(e ->
|
||||||
{
|
{
|
||||||
int index = menuAction == MenuAction.ITEM_USE
|
log.debug("Set {} item swap for {} to USE", configuringShiftClick ? "shift" : "left", itemId);
|
||||||
? -1
|
setItemSwapConfig(configuringShiftClick, itemId, -1);
|
||||||
: menuAction.getId() - MenuAction.ITEM_FIRST_OPTION.getId();
|
|
||||||
setItemSwapConfig(configuringShiftClick, itemId, index);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if (activeAction == menuAction)
|
if (activeOp == -1)
|
||||||
|
{
|
||||||
|
entry.setOption("* " + entry.getOption());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (entry.isItemOp() && entry.getItemId() == itemId)
|
||||||
|
{
|
||||||
|
final int itemOp = entry.getItemOp();
|
||||||
|
entry.setType(MenuAction.RUNELITE);
|
||||||
|
entry.onClick(e ->
|
||||||
|
{
|
||||||
|
log.debug("Set {} item swap config for {} to {}", configuringShiftClick ? "shift" : "left", itemId, itemOp - 1);
|
||||||
|
setItemSwapConfig(configuringShiftClick, itemId, itemOp - 1);
|
||||||
|
});
|
||||||
|
|
||||||
|
if (itemOp == activeOp)
|
||||||
{
|
{
|
||||||
entry.setOption("* " + entry.getOption());
|
entry.setOption("* " + entry.getOption());
|
||||||
}
|
}
|
||||||
@@ -885,19 +889,15 @@ public class MenuEntrySwapperPlugin extends Plugin
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final boolean itemOp = menuAction == MenuAction.ITEM_FIRST_OPTION
|
final boolean itemOp = menuEntry.isItemOp();
|
||||||
|| menuAction == MenuAction.ITEM_SECOND_OPTION
|
// Custom shift-click item swap
|
||||||
|| menuAction == MenuAction.ITEM_THIRD_OPTION
|
|
||||||
|| menuAction == MenuAction.ITEM_FOURTH_OPTION
|
|
||||||
|| menuAction == MenuAction.ITEM_FIFTH_OPTION
|
|
||||||
|| menuAction == MenuAction.ITEM_USE;
|
|
||||||
if (shiftModifier() && itemOp)
|
if (shiftModifier() && itemOp)
|
||||||
{
|
{
|
||||||
// Special case use shift click due to items not actually containing a "Use" option, making
|
// Special case use shift click due to items not actually containing a "Use" option, making
|
||||||
// the client unable to perform the swap itself.
|
// the client unable to perform the swap itself.
|
||||||
if (config.shiftClickCustomization() && !option.equals("use"))
|
if (config.shiftClickCustomization() && !option.equals("use"))
|
||||||
{
|
{
|
||||||
Integer customOption = getItemSwapConfig(true, eventId);
|
Integer customOption = getItemSwapConfig(true, menuEntry.getItemId());
|
||||||
|
|
||||||
if (customOption != null && customOption == -1)
|
if (customOption != null && customOption == -1)
|
||||||
{
|
{
|
||||||
@@ -913,14 +913,18 @@ public class MenuEntrySwapperPlugin extends Plugin
|
|||||||
// Custom left-click item swap
|
// Custom left-click item swap
|
||||||
if (itemOp)
|
if (itemOp)
|
||||||
{
|
{
|
||||||
Integer swapIndex = getItemSwapConfig(false, eventId);
|
Integer swapIndex = getItemSwapConfig(false, menuEntry.getItemId());
|
||||||
if (swapIndex != null)
|
if (swapIndex != null)
|
||||||
{
|
{
|
||||||
MenuAction swapAction = swapIndex >= 0
|
final int swapAction = swapIndex >= 0
|
||||||
? MenuAction.of(MenuAction.ITEM_FIRST_OPTION.getId() + swapIndex)
|
? 1 + swapIndex
|
||||||
: MenuAction.ITEM_USE;
|
: -1;
|
||||||
|
|
||||||
if (menuAction == swapAction)
|
if (swapAction == -1)
|
||||||
|
{
|
||||||
|
swap(menuEntries, "use", target, index, true);
|
||||||
|
}
|
||||||
|
else if (swapAction == menuEntry.getItemOp())
|
||||||
{
|
{
|
||||||
swap(optionIndexes, menuEntries, index, menuEntries.length - 1);
|
swap(optionIndexes, menuEntries, index, menuEntries.length - 1);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,6 +43,10 @@ public class TestMenuEntry implements MenuEntry
|
|||||||
private int param1;
|
private int param1;
|
||||||
private boolean forceLeftClick;
|
private boolean forceLeftClick;
|
||||||
@Setter
|
@Setter
|
||||||
|
private int itemOp = -1;
|
||||||
|
@Setter
|
||||||
|
private int itemId = -1;
|
||||||
|
@Setter
|
||||||
private Widget widget;
|
private Widget widget;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -169,6 +173,24 @@ public class TestMenuEntry implements MenuEntry
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isItemOp()
|
||||||
|
{
|
||||||
|
return itemOp != -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemOp()
|
||||||
|
{
|
||||||
|
return itemOp;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemId()
|
||||||
|
{
|
||||||
|
return itemId;
|
||||||
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public Widget getWidget()
|
public Widget getWidget()
|
||||||
|
|||||||
Reference in New Issue
Block a user