menu swapper: add global npc shift-click swap

This commit is contained in:
Adam
2022-06-17 12:25:29 -04:00
parent 592e193697
commit e92dd7e47b
2 changed files with 23 additions and 2 deletions

View File

@@ -151,7 +151,7 @@ public interface MenuEntrySwapperConfig extends Config
}
@ConfigItem(
position = -2,
position = -3,
keyName = "npcLeftClickCustomization",
name = "Customizable left-click",
description = "Allows customization of left-clicks on NPCs",
@@ -162,6 +162,18 @@ public interface MenuEntrySwapperConfig extends Config
return true;
}
@ConfigItem(
position = -2,
keyName = "npcShiftClickWalkHere",
name = "Shift click Walk here",
description = "Swaps Walk here on shift click on all NPCs",
section = npcSection
)
default boolean npcShiftClickWalkHere()
{
return true;
}
@ConfigItem(
keyName = "swapAdmire",
name = "Admire",

View File

@@ -1174,9 +1174,18 @@ public class MenuEntrySwapperPlugin extends Plugin
final NPC npc = menuEntry.getNpc();
assert npc != null;
final NPCComposition composition = npc.getTransformedComposition();
assert composition != null;
Integer customOption = getNpcSwapConfig(shiftModifier(), composition.getId());
if (customOption != null)
if (customOption == null)
{
if (shiftModifier() && config.npcShiftClickWalkHere())
{
// we can achieve this by just deprioritizing the normal npc menus
menuEntry.setDeprioritized(true);
}
}
else
{
// Walk here swap
if (customOption == -1)