Merge pull request #3185 from open-osrs/shift-click

This commit is contained in:
Owain van Brakel
2022-04-30 23:11:36 +02:00
committed by GitHub
2 changed files with 59 additions and 27 deletions

View File

@@ -38,6 +38,56 @@ public abstract class RuneLiteMenuEntryMixin implements RSRuneLiteMenuEntry
@Shadow("client") @Shadow("client")
private static RSClient client; private static RSClient client;
@Override
public int getItemOp()
{
MenuAction var1 = this.getType();
if (var1 == MenuAction.CC_OP || var1 == 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;
}
@Inject @Inject
@Override @Override
public int getItemId() public int getItemId()
@@ -47,6 +97,7 @@ public abstract class RuneLiteMenuEntryMixin implements RSRuneLiteMenuEntry
{ {
int param1 = this.getParam1(); int param1 = this.getParam1();
int param0 = this.getParam0(); int param0 = this.getParam0();
if (param1 == 9764864) if (param1 == 9764864)
{ {
Widget widget = client.getWidget(param1); Widget widget = client.getWidget(param1);

View File

@@ -328,11 +328,15 @@ public class RuneLiteMenuEntry implements MenuEntry
public boolean isItemOp() public boolean isItemOp()
{ {
MenuAction var1 = this.getType(); MenuAction var1 = this.getType();
if (var1 == MenuAction.CC_OP || var1 == MenuAction.CC_OP_LOW_PRIORITY) { if (var1 == MenuAction.CC_OP || var1 == MenuAction.CC_OP_LOW_PRIORITY)
{
int var2 = this.getIdentifier(); int var2 = this.getIdentifier();
int var3 = this.getParam1(); int var3 = this.getParam1();
if (var3 == 9764864) { if (var3 == 9764864)
switch(var2) { {
switch (var2)
{
case 1:
case 2: case 2:
case 3: case 3:
case 4: case 4:
@@ -350,30 +354,7 @@ public class RuneLiteMenuEntry implements MenuEntry
@Override @Override
public int getItemOp() public int getItemOp()
{ {
MenuAction var1 = this.getType(); throw new NotImplementedException();
if (var1 == MenuAction.CC_OP || var1 == MenuAction.CC_OP_LOW_PRIORITY) {
int var2 = this.getIdentifier();
int var3 = this.getParam1();
if (var3 == 9764864) {
switch(var2) {
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 @Override