project(mixins): Convert menu entry from partly mixin to just rsc

This commit is contained in:
Owain van Brakel
2022-05-12 01:51:10 +02:00
parent 28dcc47ac8
commit 1a3d36abc1
2 changed files with 94 additions and 151 deletions

View File

@@ -2,10 +2,13 @@ import java.util.function.Consumer;
import net.runelite.api.MenuAction;
import net.runelite.api.MenuEntry;
import net.runelite.api.widgets.Widget;
import net.runelite.rs.api.RSClient;
import sun.reflect.generics.reflectiveObjects.NotImplementedException;
public class RuneLiteMenuEntry implements MenuEntry
{
private static RSClient client;
public Consumer consumer;
public int idx;
@@ -328,14 +331,15 @@ public class RuneLiteMenuEntry implements MenuEntry
@Override
public boolean isItemOp()
{
MenuAction var1 = this.getType();
if (var1 == MenuAction.CC_OP || var1 == MenuAction.CC_OP_LOW_PRIORITY)
MenuAction menuAction = this.getType();
if (menuAction == MenuAction.CC_OP || menuAction == MenuAction.CC_OP_LOW_PRIORITY)
{
int var2 = this.getIdentifier();
int var3 = this.getParam1();
if (var3 == 9764864)
int identifier = this.getIdentifier();
int param1 = this.getParam1();
if (param1 == 9764864)
{
switch (var2)
switch (identifier)
{
case 1:
case 2:
@@ -355,19 +359,100 @@ public class RuneLiteMenuEntry implements MenuEntry
@Override
public int getItemOp()
{
throw new NotImplementedException();
MenuAction menuAction = this.getType();
if (menuAction == MenuAction.CC_OP || menuAction == MenuAction.CC_OP_LOW_PRIORITY)
{
int identifier = this.getIdentifier();
int param0 = this.getParam0();
int param1 = this.getParam1();
if (param1 == 9764864)
{
switch (identifier)
{
case 1:
Widget widget = client.getWidget(param1);
if (widget != null && param0 != -1)
{
widget = widget.getChild(param0);
if (widget != null && widget.getItemId() > -1)
{
int shiftClickActionIndex = client.getItemComposition(widget.getItemId()).getShiftClickActionIndex();
if (shiftClickActionIndex >= 0)
{
return shiftClickActionIndex + 1;
}
}
}
break;
case 2:
return 1;
case 3:
return 2;
case 4:
return 3;
case 5:
default:
break;
case 6:
return 4;
case 7:
return 5;
}
}
}
return -1;
}
@Override
public int getItemId()
{
throw new NotImplementedException();
MenuAction menuAction = this.getType();
if (menuAction == MenuAction.CC_OP || menuAction == MenuAction.CC_OP_LOW_PRIORITY)
{
int param1 = this.getParam1();
int param0 = this.getParam0();
if (param1 == 9764864)
{
Widget widget = client.getWidget(param1);
if (param0 != -1)
{
widget = widget.getChild(param0);
return widget.getItemId();
}
}
}
return -1;
}
@Override
public Widget getWidget()
{
throw new NotImplementedException();
int param1 = this.getParam1();
int param0 = this.getParam0();
Widget widget = client.getWidget(param1);
if (widget == null)
{
return null;
}
if (param0 != -1)
{
Widget child = widget.getChild(param0);
if (child != null)
{
return child;
}
}
return widget;
}
@Override