client: Improve menumanager (#2026)
* make menumanager work with everything it didn't work with before * rebuild left click before render instead of on client tick * Remove useless checks which were breaking when dragging in bank * Change rsclient line breaks (only 5th fucking time this pr dw) * Rename arg1 & arg2 getters/fields to be more consistent
This commit is contained in:
@@ -25,10 +25,14 @@
|
||||
package net.runelite.mixins;
|
||||
|
||||
import net.runelite.api.MenuEntry;
|
||||
import net.runelite.api.events.WidgetPressed;
|
||||
import net.runelite.api.mixins.FieldHook;
|
||||
import net.runelite.api.mixins.Inject;
|
||||
import net.runelite.api.mixins.Mixin;
|
||||
import net.runelite.api.mixins.Shadow;
|
||||
import net.runelite.rs.api.RSClient;
|
||||
import net.runelite.rs.api.RSFont;
|
||||
import net.runelite.rs.api.RSMenuAction;
|
||||
|
||||
@Mixin(RSClient.class)
|
||||
public abstract class MenuMixin implements RSClient
|
||||
@@ -41,6 +45,12 @@ public abstract class MenuMixin implements RSClient
|
||||
private static final int MENU_HEADER_GRADIENT_TOP_2010 = 0x322E22;
|
||||
private static final int MENU_HEADER_GRADIENT_BOTTOM_2010 = 0x090A04;
|
||||
|
||||
@Shadow("client")
|
||||
private static RSClient client;
|
||||
|
||||
@Shadow("tempMenuAction")
|
||||
private static RSMenuAction tempMenuAction;
|
||||
|
||||
@Inject
|
||||
@Override
|
||||
public void draw2010Menu()
|
||||
@@ -140,4 +150,28 @@ public abstract class MenuMixin implements RSClient
|
||||
getMenuArguments2()[i] = entry.getParam1();
|
||||
getMenuForceLeftClick()[i] = entry.isForceLeftClick();
|
||||
}
|
||||
|
||||
@Inject
|
||||
@FieldHook("tempMenuAction")
|
||||
public static void onTempMenuActionChanged(int idx)
|
||||
{
|
||||
if (tempMenuAction != null)
|
||||
{
|
||||
client.getCallbacks().post(WidgetPressed.class, WidgetPressed.INSTANCE);
|
||||
}
|
||||
}
|
||||
|
||||
@Inject
|
||||
@Override
|
||||
public void setTempMenuEntry(MenuEntry entry)
|
||||
{
|
||||
if (entry == null || tempMenuAction == null)
|
||||
return;
|
||||
|
||||
tempMenuAction.setOption(entry.getOption());
|
||||
tempMenuAction.setOpcode(entry.getOpcode());
|
||||
tempMenuAction.setIdentifier(entry.getIdentifier());
|
||||
tempMenuAction.setParam0(entry.getParam0());
|
||||
tempMenuAction.setParam1(entry.getParam1());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,7 +100,6 @@ import net.runelite.api.events.UsernameChanged;
|
||||
import net.runelite.api.events.VarbitChanged;
|
||||
import net.runelite.api.events.VolumeChanged;
|
||||
import net.runelite.api.events.WidgetLoaded;
|
||||
import net.runelite.api.events.WidgetPressed;
|
||||
import net.runelite.api.hooks.Callbacks;
|
||||
import net.runelite.api.hooks.DrawCallbacks;
|
||||
import net.runelite.api.mixins.Copy;
|
||||
@@ -1403,16 +1402,6 @@ public abstract class RSClientMixin implements RSClient
|
||||
client.sendMenuAction(actionParam, widgetId, menuAction, id, menuOption, "!AUTHENTIC" + menuTarget, var6, var7);
|
||||
}
|
||||
|
||||
@Inject
|
||||
@FieldHook("tempMenuAction")
|
||||
public static void onTempMenuActionChanged(int idx)
|
||||
{
|
||||
if (client.getTempMenuAction() != null)
|
||||
{
|
||||
client.getCallbacks().post(WidgetPressed.class, WidgetPressed.INSTANCE);
|
||||
}
|
||||
}
|
||||
|
||||
@FieldHook("Login_username")
|
||||
@Inject
|
||||
public static void onUsernameChanged(int idx)
|
||||
|
||||
Reference in New Issue
Block a user