Do not swap entries on NPCs with hint arrows (#6437)
before: https://i.imgur.com/kvXHHWd.png after: https://i.imgur.com/anFnVkt.png
This commit is contained in:
@@ -25,8 +25,10 @@
|
||||
*/
|
||||
package net.runelite.client.plugins.menuentryswapper;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.eventbus.Subscribe;
|
||||
import com.google.inject.Provides;
|
||||
import java.util.Set;
|
||||
import javax.inject.Inject;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
@@ -35,6 +37,7 @@ import net.runelite.api.GameState;
|
||||
import net.runelite.api.ItemComposition;
|
||||
import net.runelite.api.MenuAction;
|
||||
import net.runelite.api.MenuEntry;
|
||||
import net.runelite.api.NPC;
|
||||
import net.runelite.api.events.ConfigChanged;
|
||||
import net.runelite.api.events.FocusChanged;
|
||||
import net.runelite.api.events.MenuEntryAdded;
|
||||
@@ -44,7 +47,6 @@ import net.runelite.api.events.PostItemComposition;
|
||||
import net.runelite.api.events.WidgetMenuOptionClicked;
|
||||
import net.runelite.api.widgets.WidgetInfo;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.game.ItemManager;
|
||||
import net.runelite.client.game.ItemVariationMapping;
|
||||
import net.runelite.client.input.KeyManager;
|
||||
import net.runelite.client.menus.MenuManager;
|
||||
@@ -88,6 +90,14 @@ public class MenuEntrySwapperPlugin extends Plugin
|
||||
private static final WidgetMenuOption RESIZABLE_BOTTOM_LINE_INVENTORY_TAB_SAVE = new WidgetMenuOption(SAVE,
|
||||
MENU_TARGET, WidgetInfo.RESIZABLE_VIEWPORT_BOTTOM_LINE_INVENTORY_TAB);
|
||||
|
||||
private static final Set<MenuAction> NPC_MENU_TYPES = ImmutableSet.of(
|
||||
MenuAction.NPC_FIRST_OPTION,
|
||||
MenuAction.NPC_SECOND_OPTION,
|
||||
MenuAction.NPC_THIRD_OPTION,
|
||||
MenuAction.NPC_FOURTH_OPTION,
|
||||
MenuAction.NPC_FIFTH_OPTION,
|
||||
MenuAction.EXAMINE_NPC);
|
||||
|
||||
@Inject
|
||||
private Client client;
|
||||
|
||||
@@ -100,9 +110,6 @@ public class MenuEntrySwapperPlugin extends Plugin
|
||||
@Inject
|
||||
private ConfigManager configManager;
|
||||
|
||||
@Inject
|
||||
private ItemManager itemManager;
|
||||
|
||||
@Inject
|
||||
private KeyManager keyManager;
|
||||
|
||||
@@ -328,9 +335,17 @@ public class MenuEntrySwapperPlugin extends Plugin
|
||||
return;
|
||||
}
|
||||
|
||||
int itemId = event.getIdentifier();
|
||||
String option = Text.removeTags(event.getOption()).toLowerCase();
|
||||
String target = Text.removeTags(event.getTarget()).toLowerCase();
|
||||
final int eventId = event.getIdentifier();
|
||||
final String option = Text.removeTags(event.getOption()).toLowerCase();
|
||||
final String target = Text.removeTags(event.getTarget()).toLowerCase();
|
||||
final NPC hintArrowNpc = client.getHintArrowNpc();
|
||||
|
||||
if (hintArrowNpc != null
|
||||
&& hintArrowNpc.getIndex() == eventId
|
||||
&& NPC_MENU_TYPES.contains(MenuAction.of(event.getType())))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (option.equals("talk-to"))
|
||||
{
|
||||
@@ -493,7 +508,7 @@ public class MenuEntrySwapperPlugin extends Plugin
|
||||
}
|
||||
else if (config.shiftClickCustomization() && shiftModifier && !option.equals("use"))
|
||||
{
|
||||
Integer customOption = getSwapConfig(itemId);
|
||||
Integer customOption = getSwapConfig(eventId);
|
||||
|
||||
if (customOption != null && customOption == -1)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user