Merge pull request #2486 from open-osrs/param
client: make actions follow menu entry params.
This commit is contained in:
@@ -1871,17 +1871,7 @@ public interface Client extends GameShell
|
||||
|
||||
void setRenderSelf(boolean enabled);
|
||||
|
||||
/**
|
||||
* @param param0 This is SceneX for gameObject, index for items, and 0 for npc.
|
||||
* @param param1 This is SceneY for gameObject, static for items, and 0 for npc.
|
||||
* @param opcode Menu entry Action opcode.
|
||||
* @param id Targets ID
|
||||
* @param menuEntry Do these actually matter?
|
||||
* @param targetString Do these actually matter?
|
||||
* @param canvasX Canvas X Point
|
||||
* @param canvasY Canvas Y Point
|
||||
*/
|
||||
void invokeMenuAction(int param0, int param1, int opcode, int id, String menuEntry, String targetString, int canvasX, int canvasY);
|
||||
void invokeMenuAction(String option, String target, int identifier, int opcode, int param0, int param1);
|
||||
|
||||
MouseRecorder getMouseRecorder();
|
||||
|
||||
|
||||
@@ -1396,20 +1396,20 @@ public abstract class RSClientMixin implements RSClient
|
||||
}
|
||||
|
||||
@Replace("menuAction")
|
||||
static void rl$menuAction(int param0, int param1, int opcode, int id, String menuOption, String menuTarget, int canvasX, int canvasY)
|
||||
static void rl$menuAction(int param0, int param1, int opcode, int id, String option, String target, int canvasX, int canvasY)
|
||||
{
|
||||
boolean authentic = true;
|
||||
if (menuTarget != null && menuTarget.startsWith("!AUTHENTIC"))
|
||||
if (target != null && target.startsWith("!AUTHENTIC"))
|
||||
{
|
||||
authentic = false;
|
||||
menuTarget = menuTarget.substring(10);
|
||||
target = target.substring(10);
|
||||
}
|
||||
|
||||
if (printMenuActions && client.getLogger().isDebugEnabled())
|
||||
{
|
||||
client.getLogger().debug(
|
||||
"|MenuAction|: Param0={} Param1={} Opcode={} Id={} MenuOption={} MenuTarget={} CanvasX={} CanvasY={} Authentic={}",
|
||||
param0, param1, opcode, id, menuOption, menuTarget, canvasX, canvasY, authentic
|
||||
"|MenuAction|: MenuOption={} MenuTarget={} Id={} Opcode={} Param0={} Param1={} CanvasX={} CanvasY={} Authentic={}",
|
||||
option, target, id, opcode, param0, param1, canvasX, canvasY, authentic
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1422,8 +1422,8 @@ public abstract class RSClientMixin implements RSClient
|
||||
}
|
||||
|
||||
final MenuOptionClicked menuOptionClicked = new MenuOptionClicked(
|
||||
menuOption,
|
||||
menuTarget,
|
||||
option,
|
||||
target,
|
||||
id,
|
||||
opcode,
|
||||
param0,
|
||||
@@ -1446,9 +1446,11 @@ public abstract class RSClientMixin implements RSClient
|
||||
|
||||
@Override
|
||||
@Inject
|
||||
public void invokeMenuAction(int param0, int param1, int opcode, int id, String menuOption, String menuTarget, int canvasX, int canvasY)
|
||||
public void invokeMenuAction(String option, String target, int identifier, int opcode, int param0, int param1)
|
||||
{
|
||||
client.sendMenuAction(param0, param1, opcode, id, menuOption, "!AUTHENTIC" + menuTarget, canvasX, canvasY);
|
||||
assert isClientThread();
|
||||
|
||||
client.sendMenuAction(param0, param1, opcode, identifier, option, "!AUTHENTIC" + target, 658, 384);
|
||||
}
|
||||
|
||||
@FieldHook("Login_username")
|
||||
@@ -1928,4 +1930,5 @@ public abstract class RSClientMixin implements RSClient
|
||||
{
|
||||
invertYaw = state;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ public abstract class WorldHoppingMixin implements RSClient
|
||||
public void openWorldHopper()
|
||||
{
|
||||
// The clicked x & y coordinates (the last arguments) are not processed in the game or sent to Jagex, so they don't have to be real.
|
||||
invokeMenuAction(-1, WidgetInfo.WORLD_SWITCHER_BUTTON.getId(), MenuOpcode.CC_OP.getId(), 1, "World Switcher", "", 658, 384);
|
||||
invokeMenuAction("World Switcher", "", 1, MenuOpcode.CC_OP.getId(), -1, WidgetInfo.WORLD_SWITCHER_BUTTON.getId());
|
||||
}
|
||||
|
||||
@Inject
|
||||
@@ -23,6 +23,6 @@ public abstract class WorldHoppingMixin implements RSClient
|
||||
public void hopToWorld(World world)
|
||||
{
|
||||
final int worldId = world.getId();
|
||||
invokeMenuAction(worldId, WidgetInfo.WORLD_SWITCHER_LIST.getId(), MenuOpcode.CC_OP.getId(), 1, "Switch", "<col=ff9040>" + (worldId - 300) + "</col>", 683, 244);
|
||||
invokeMenuAction("Switch", "<col=ff9040>" + (worldId - 300) + "</col>", 1, MenuOpcode.CC_OP.getId(), worldId, WidgetInfo.WORLD_SWITCHER_LIST.getId());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user