menu swapper: add custom shift-click npc swap
This commit is contained in:
@@ -817,25 +817,16 @@ public class MenuEntrySwapperPlugin extends Plugin
|
|||||||
}
|
}
|
||||||
|
|
||||||
client.createMenuEntry(idx)
|
client.createMenuEntry(idx)
|
||||||
.setOption("Swap " + actions[actionIdx])
|
.setOption("Swap left click " + actions[actionIdx])
|
||||||
.setTarget(entry.getTarget())
|
.setTarget(entry.getTarget())
|
||||||
.setType(MenuAction.RUNELITE)
|
.setType(MenuAction.RUNELITE)
|
||||||
.onClick(e ->
|
.onClick(npcConsumer(composition, actions, menuIdx, menuAction, false));
|
||||||
{
|
|
||||||
final String message = new ChatMessageBuilder()
|
|
||||||
.append("The default left click option for '").append(Text.removeTags(composition.getName())).append("' ")
|
|
||||||
.append("has been set to '").append(actions[menuIdx]).append("'.")
|
|
||||||
.build();
|
|
||||||
|
|
||||||
chatMessageManager.queue(QueuedMessage.builder()
|
client.createMenuEntry(idx)
|
||||||
.type(ChatMessageType.CONSOLE)
|
.setOption("Swap shift click " + actions[actionIdx])
|
||||||
.runeLiteFormattedMessage(message)
|
.setTarget(entry.getTarget())
|
||||||
.build());
|
.setType(MenuAction.RUNELITE)
|
||||||
|
.onClick(npcConsumer(composition, actions, menuIdx, menuAction, true));
|
||||||
log.debug("Set npc swap for {} to {}", composition.getId(), menuAction);
|
|
||||||
|
|
||||||
setNpcSwapConfig(false, composition.getId(), menuIdx);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Walk here swap
|
// Walk here swap
|
||||||
@@ -879,6 +870,27 @@ public class MenuEntrySwapperPlugin extends Plugin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Consumer<MenuEntry> npcConsumer(NPCComposition composition, String[] actions, int menuIdx,
|
||||||
|
MenuAction menuAction, boolean shift)
|
||||||
|
{
|
||||||
|
return e ->
|
||||||
|
{
|
||||||
|
final String message = new ChatMessageBuilder()
|
||||||
|
.append("The default ").append(shift ? "shift" : "left").append(" click option for '").append(Text.removeTags(composition.getName())).append("' ")
|
||||||
|
.append("has been set to '").append(actions[menuIdx]).append("'.")
|
||||||
|
.build();
|
||||||
|
|
||||||
|
chatMessageManager.queue(QueuedMessage.builder()
|
||||||
|
.type(ChatMessageType.CONSOLE)
|
||||||
|
.runeLiteFormattedMessage(message)
|
||||||
|
.build());
|
||||||
|
|
||||||
|
log.debug("Set npc {} swap for {} to {}", shift ? "shift" : "left", composition.getId(), menuAction);
|
||||||
|
|
||||||
|
setNpcSwapConfig(shift, composition.getId(), menuIdx);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
private void configureWornItems(MenuOpened event)
|
private void configureWornItems(MenuOpened event)
|
||||||
{
|
{
|
||||||
if (!shiftModifier())
|
if (!shiftModifier())
|
||||||
|
|||||||
Reference in New Issue
Block a user