Fix shift walk under bug (#740)
This commit is contained in:
@@ -570,6 +570,11 @@ public interface Client extends GameShell
|
|||||||
*/
|
*/
|
||||||
MenuEntry[] getMenuEntries();
|
MenuEntry[] getMenuEntries();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return amount of menu entries the client has (same as client.getMenuEntries().size())
|
||||||
|
*/
|
||||||
|
int getMenuOptionCount();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the array of open menu entries.
|
* Sets the array of open menu entries.
|
||||||
* <p>
|
* <p>
|
||||||
|
|||||||
@@ -55,4 +55,5 @@ public class GraphicID
|
|||||||
public static final int OLM_HEAL = 1363;
|
public static final int OLM_HEAL = 1363;
|
||||||
public static final int OLM_CRYSTAL = 1447;
|
public static final int OLM_CRYSTAL = 1447;
|
||||||
public static final int XERIC_TELEPORT = 1612;
|
public static final int XERIC_TELEPORT = 1612;
|
||||||
|
public static final int HYDRA_LIGHTNING = 1666;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,12 +24,16 @@
|
|||||||
*/
|
*/
|
||||||
package net.runelite.api;
|
package net.runelite.api;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A menu entry in a right-click menu.
|
* A menu entry in a right-click menu.
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@RequiredArgsConstructor
|
||||||
public class MenuEntry
|
public class MenuEntry
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ package net.runelite.api.events;
|
|||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import net.runelite.api.MenuEntry;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An event when a new entry is added to a right-click menu.
|
* An event when a new entry is added to a right-click menu.
|
||||||
@@ -35,30 +36,42 @@ import lombok.Data;
|
|||||||
public class MenuEntryAdded
|
public class MenuEntryAdded
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* The option text added to the menu (ie. "Walk here", "Use").
|
* The MenuEntry object that was actually added
|
||||||
*/
|
*/
|
||||||
private final String option;
|
private final MenuEntry menuEntry;
|
||||||
/**
|
|
||||||
* The target of the action (ie. Item or Actor name).
|
public String getOption()
|
||||||
* <p>
|
{
|
||||||
* If the option does not apply to any target, this field
|
return menuEntry.getOption();
|
||||||
* will be set to empty string.
|
}
|
||||||
*/
|
|
||||||
private final String target;
|
public String getTarget()
|
||||||
/**
|
{
|
||||||
* The action type that will be triggered.
|
return menuEntry.getTarget();
|
||||||
*/
|
}
|
||||||
private final int type;
|
|
||||||
/**
|
public int getType()
|
||||||
* An identifier value for the target of the action
|
{
|
||||||
*/
|
return menuEntry.getType();
|
||||||
private final int identifier;
|
}
|
||||||
/**
|
|
||||||
* An additional parameter for the action.
|
public int getIdentifier()
|
||||||
*/
|
{
|
||||||
private final int actionParam0;
|
return menuEntry.getIdentifier();
|
||||||
/**
|
}
|
||||||
* A second additional parameter for the action.
|
|
||||||
*/
|
public int getActionParam0()
|
||||||
private final int actionParam1;
|
{
|
||||||
|
return menuEntry.getParam0();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getActionParam1()
|
||||||
|
{
|
||||||
|
return menuEntry.getParam1();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isForceLeftClick()
|
||||||
|
{
|
||||||
|
return menuEntry.isForceLeftClick();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -173,22 +173,14 @@ public class MenuManager
|
|||||||
|
|
||||||
final MenuEntry newestEntry = menuEntries[menuEntries.length - 1];
|
final MenuEntry newestEntry = menuEntries[menuEntries.length - 1];
|
||||||
|
|
||||||
boolean isPrio = false;
|
|
||||||
for (ComparableEntry p : priorityEntries)
|
for (ComparableEntry p : priorityEntries)
|
||||||
{
|
{
|
||||||
if (p.matches(newestEntry))
|
if (p.matches(newestEntry))
|
||||||
{
|
{
|
||||||
isPrio = true;
|
currentPriorityEntries.add(newestEntry);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the last entry was a priority entry, keep track of it
|
|
||||||
if (isPrio)
|
|
||||||
{
|
|
||||||
currentPriorityEntries.add(newestEntry);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Make a copy of the menu entries, cause you can't remove from Arrays.asList()
|
// Make a copy of the menu entries, cause you can't remove from Arrays.asList()
|
||||||
List<MenuEntry> copy = Lists.newArrayList(menuEntries);
|
List<MenuEntry> copy = Lists.newArrayList(menuEntries);
|
||||||
|
|
||||||
@@ -197,7 +189,29 @@ public class MenuManager
|
|||||||
{
|
{
|
||||||
copy.retainAll(currentPriorityEntries);
|
copy.retainAll(currentPriorityEntries);
|
||||||
|
|
||||||
copy.add(0, CANCEL());
|
// This is because players existing changes walk-here target
|
||||||
|
// so without this we lose track of em
|
||||||
|
if (copy.size() != currentPriorityEntries.size())
|
||||||
|
{
|
||||||
|
for (MenuEntry e : currentPriorityEntries)
|
||||||
|
{
|
||||||
|
if (copy.contains(e))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (MenuEntry e2 : client.getMenuEntries())
|
||||||
|
{
|
||||||
|
if (e.getType() == e2.getType())
|
||||||
|
{
|
||||||
|
e.setTarget(e2.getTarget());
|
||||||
|
copy.add(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
copy.add(CANCEL());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find the current entry in the swaps map
|
// Find the current entry in the swaps map
|
||||||
|
|||||||
@@ -645,12 +645,15 @@ public abstract class RSClientMixin implements RSClient
|
|||||||
if (newCount == oldCount + 1)
|
if (newCount == oldCount + 1)
|
||||||
{
|
{
|
||||||
MenuEntryAdded event = new MenuEntryAdded(
|
MenuEntryAdded event = new MenuEntryAdded(
|
||||||
client.getMenuOptions()[newCount - 1],
|
new MenuEntry(
|
||||||
client.getMenuTargets()[newCount - 1],
|
client.getMenuOptions()[oldCount],
|
||||||
client.getMenuTypes()[newCount - 1],
|
client.getMenuTargets()[oldCount],
|
||||||
client.getMenuIdentifiers()[newCount - 1],
|
client.getMenuTypes()[oldCount],
|
||||||
client.getMenuActionParams0()[newCount - 1],
|
client.getMenuIdentifiers()[oldCount],
|
||||||
client.getMenuActionParams1()[newCount - 1]
|
client.getMenuActionParams0()[oldCount],
|
||||||
|
client.getMenuActionParams1()[oldCount],
|
||||||
|
client.getMenuForceLeftClick()[oldCount]
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
client.getCallbacks().post(event);
|
client.getCallbacks().post(event);
|
||||||
|
|||||||
@@ -298,6 +298,7 @@ public interface RSClient extends RSGameShell, Client
|
|||||||
boolean isCheckClick();
|
boolean isCheckClick();
|
||||||
|
|
||||||
@Import("menuOptionsCount")
|
@Import("menuOptionsCount")
|
||||||
|
@Override
|
||||||
int getMenuOptionCount();
|
int getMenuOptionCount();
|
||||||
|
|
||||||
@Import("menuOptionsCount")
|
@Import("menuOptionsCount")
|
||||||
|
|||||||
Reference in New Issue
Block a user