Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,12 @@ public int getHealthScale()
@Override
public WorldPoint getWorldLocation()
{
if (getWorldView() != null && getWorldView().getId() != -1) {
final WorldView worldView = getWorldView();
if (worldView != null && worldView.getId() != WorldView.TOPLEVEL) {
return Microbot.getClientThread().invoke(this::projectActorLocationToMainWorld);
}

return actor.getWorldLocation();
return Microbot.getClientThread().runOnClientThreadOptional(() -> actor.getWorldLocation()).orElse(null);
}

@Override
Expand Down Expand Up @@ -449,7 +450,12 @@ public long getHash()
}

public WorldPoint projectActorLocationToMainWorld() {
WorldPoint actorLocation = actor.getWorldLocation();
WorldPoint actorLocation = Microbot.getClientThread().runOnClientThreadOptional(() -> actor.getWorldLocation()).orElse(null);
if (actorLocation == null)
{
return getWorldLocation();
}

LocalPoint localPoint = LocalPoint.fromWorld(
getWorldView(),
actorLocation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1842,17 +1842,15 @@ public static boolean clickObject(TileObject object, String action) {
param1 = 4;
}*/

int worldViewId = -1;

if (object.getWorldView().getId() != -1) {
var worldView =Microbot.getClientThread().invoke(() -> Microbot.getClient().getLocalPlayer().getWorldView());
if (worldView == null) {
worldViewId = Microbot.getClient().getTopLevelWorldView().getId();
} else {
worldViewId = worldView
.getId();
int worldViewId = WorldView.TOPLEVEL;

final WorldView objectWorldView = object.getWorldView();
if (objectWorldView != null && objectWorldView.getId() != WorldView.TOPLEVEL) {
var worldView = Microbot.getClientThread().invoke(() -> Microbot.getClient().getLocalPlayer().getWorldView());
if (worldView != null)
{
worldViewId = worldView.getId();
}

}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class NewMenuEntry implements MenuEntry {
private Actor actor;
private TileObject gameObject;
private Widget widget;
private int worldViewId = -1;
private int worldViewId = WorldView.TOPLEVEL;

private NewMenuEntry(int param0, int param1, MenuAction type, int identifier) {
this.param0 = param0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ public static void invokeMenu(int param0, int param1, int opcode, int identifier
{
if (menuAction == null)
{
final String MENU_ACTION_DESCRIPTOR_VANILLA = "(IIIIIILjava/lang/String;Ljava/lang/String;III)V";
final String MENU_ACTION_DESCRIPTOR_VANILLA_BYTE_GARBAGE_VALUE = "(IIIIIILjava/lang/String;Ljava/lang/String;IIB)V";
final String MENU_ACTION_DESCRIPTOR_VANILLA_INT_GARBAGE_VALUE = "(IIIIIILjava/lang/String;Ljava/lang/String;III)V";
final String MENU_ACTION_DESCRIPTOR_RUNELITE = "(IILnet/runelite/api/MenuAction;IILjava/lang/String;Ljava/lang/String;)V";

final Class<?> clientClazz = Microbot.getClient().getClass();
Expand Down Expand Up @@ -72,9 +73,9 @@ else if (insnNode.getOpcode() == Opcodes.SIPUSH)
}

final MethodInsnNode menuActionVanillaInsn = (MethodInsnNode) insnNode.getNext();
if (!menuActionVanillaInsn.desc.equals(MENU_ACTION_DESCRIPTOR_VANILLA))
if (!menuActionVanillaInsn.desc.equals(MENU_ACTION_DESCRIPTOR_VANILLA_BYTE_GARBAGE_VALUE) && !menuActionVanillaInsn.desc.equals(MENU_ACTION_DESCRIPTOR_VANILLA_INT_GARBAGE_VALUE))
{
throw new RuntimeException("Menu action descriptor vanilla has changed from: " + MENU_ACTION_DESCRIPTOR_VANILLA + " to: " + menuActionVanillaInsn.desc);
throw new RuntimeException("Menu action descriptor vanilla has changed to: " + menuActionVanillaInsn.desc);
}
menuAction = Arrays.stream(Class.forName(menuActionVanillaInsn.owner).getDeclaredMethods())
.filter(m -> m.getName().equals(menuActionVanillaInsn.name))
Expand Down
Loading