385 lines
12 KiB
Java
385 lines
12 KiB
Java
import java.awt.event.FocusEvent;
|
|
import java.awt.event.FocusListener;
|
|
import java.awt.event.MouseEvent;
|
|
import java.awt.event.MouseListener;
|
|
import java.awt.event.MouseMotionListener;
|
|
import net.runelite.mapping.Export;
|
|
import net.runelite.mapping.Implements;
|
|
import net.runelite.mapping.ObfuscatedGetter;
|
|
import net.runelite.mapping.ObfuscatedName;
|
|
import net.runelite.mapping.ObfuscatedSignature;
|
|
import net.runelite.rs.ScriptOpcodes;
|
|
|
|
@ObfuscatedName("bc")
|
|
@Implements("MouseHandler")
|
|
public class MouseHandler implements MouseListener, MouseMotionListener, FocusListener {
|
|
@ObfuscatedName("sz")
|
|
@ObfuscatedGetter(
|
|
intValue = 1607868689
|
|
)
|
|
@Export("foundItemIdCount")
|
|
static int foundItemIdCount;
|
|
@ObfuscatedName("q")
|
|
@ObfuscatedSignature(
|
|
signature = "Lbc;"
|
|
)
|
|
@Export("MouseHandler_instance")
|
|
public static MouseHandler MouseHandler_instance;
|
|
@ObfuscatedName("v")
|
|
@ObfuscatedGetter(
|
|
intValue = -1338190935
|
|
)
|
|
@Export("MouseHandler_idleCycles")
|
|
public static volatile int MouseHandler_idleCycles;
|
|
@ObfuscatedName("l")
|
|
@ObfuscatedGetter(
|
|
intValue = 252420693
|
|
)
|
|
@Export("MouseHandler_currentButtonVolatile")
|
|
public static volatile int MouseHandler_currentButtonVolatile;
|
|
@ObfuscatedName("c")
|
|
@ObfuscatedGetter(
|
|
intValue = -1728347419
|
|
)
|
|
@Export("MouseHandler_xVolatile")
|
|
public static volatile int MouseHandler_xVolatile;
|
|
@ObfuscatedName("o")
|
|
@ObfuscatedGetter(
|
|
intValue = 890239403
|
|
)
|
|
@Export("MouseHandler_yVolatile")
|
|
public static volatile int MouseHandler_yVolatile;
|
|
@ObfuscatedName("i")
|
|
@ObfuscatedGetter(
|
|
longValue = 3750789225615290729L
|
|
)
|
|
@Export("MouseHandler_lastMovedVolatile")
|
|
public static volatile long MouseHandler_lastMovedVolatile;
|
|
@ObfuscatedName("d")
|
|
@ObfuscatedGetter(
|
|
intValue = -1269401967
|
|
)
|
|
@Export("MouseHandler_currentButton")
|
|
public static int MouseHandler_currentButton;
|
|
@ObfuscatedName("m")
|
|
@ObfuscatedGetter(
|
|
intValue = 811280401
|
|
)
|
|
@Export("MouseHandler_x")
|
|
public static int MouseHandler_x;
|
|
@ObfuscatedName("p")
|
|
@ObfuscatedGetter(
|
|
intValue = 1526824115
|
|
)
|
|
@Export("MouseHandler_y")
|
|
public static int MouseHandler_y;
|
|
@ObfuscatedName("h")
|
|
@ObfuscatedGetter(
|
|
longValue = -8173787367368651405L
|
|
)
|
|
@Export("MouseHandler_millis")
|
|
public static long MouseHandler_millis;
|
|
@ObfuscatedName("k")
|
|
@ObfuscatedGetter(
|
|
intValue = -2004292417
|
|
)
|
|
@Export("MouseHandler_lastButtonVolatile")
|
|
public static volatile int MouseHandler_lastButtonVolatile;
|
|
@ObfuscatedName("x")
|
|
@ObfuscatedGetter(
|
|
intValue = 587328271
|
|
)
|
|
@Export("MouseHandler_lastPressedXVolatile")
|
|
public static volatile int MouseHandler_lastPressedXVolatile;
|
|
@ObfuscatedName("j")
|
|
@ObfuscatedGetter(
|
|
intValue = -1352074073
|
|
)
|
|
@Export("MouseHandler_lastPressedYVolatile")
|
|
public static volatile int MouseHandler_lastPressedYVolatile;
|
|
@ObfuscatedName("r")
|
|
@ObfuscatedGetter(
|
|
longValue = -4279926973257874399L
|
|
)
|
|
@Export("MouseHandler_lastPressedTimeMillisVolatile")
|
|
public static volatile long MouseHandler_lastPressedTimeMillisVolatile;
|
|
@ObfuscatedName("e")
|
|
@ObfuscatedGetter(
|
|
intValue = 268486097
|
|
)
|
|
@Export("MouseHandler_lastButton")
|
|
public static int MouseHandler_lastButton;
|
|
@ObfuscatedName("s")
|
|
@ObfuscatedGetter(
|
|
intValue = -209058807
|
|
)
|
|
@Export("MouseHandler_lastPressedX")
|
|
public static int MouseHandler_lastPressedX;
|
|
@ObfuscatedName("b")
|
|
@ObfuscatedGetter(
|
|
intValue = -775281431
|
|
)
|
|
@Export("MouseHandler_lastPressedY")
|
|
public static int MouseHandler_lastPressedY;
|
|
@ObfuscatedName("z")
|
|
@ObfuscatedGetter(
|
|
longValue = -7966461350873745939L
|
|
)
|
|
@Export("MouseHandler_lastPressedTimeMillis")
|
|
public static long MouseHandler_lastPressedTimeMillis;
|
|
@ObfuscatedName("bx")
|
|
@ObfuscatedSignature(
|
|
signature = "Lhp;"
|
|
)
|
|
static StudioGame field458;
|
|
|
|
static {
|
|
MouseHandler_instance = new MouseHandler();
|
|
MouseHandler_idleCycles = 0;
|
|
MouseHandler_currentButtonVolatile = 0;
|
|
MouseHandler_xVolatile = -1;
|
|
MouseHandler_yVolatile = -1;
|
|
MouseHandler_lastMovedVolatile = -1L;
|
|
MouseHandler_currentButton = 0;
|
|
MouseHandler_x = 0;
|
|
MouseHandler_y = 0;
|
|
MouseHandler_millis = 0L;
|
|
MouseHandler_lastButtonVolatile = 0;
|
|
MouseHandler_lastPressedXVolatile = 0;
|
|
MouseHandler_lastPressedYVolatile = 0;
|
|
MouseHandler_lastPressedTimeMillisVolatile = 0L;
|
|
MouseHandler_lastButton = 0;
|
|
MouseHandler_lastPressedX = 0;
|
|
MouseHandler_lastPressedY = 0;
|
|
MouseHandler_lastPressedTimeMillis = 0L;
|
|
}
|
|
|
|
MouseHandler() {
|
|
}
|
|
|
|
@ObfuscatedName("q")
|
|
@ObfuscatedSignature(
|
|
signature = "(Ljava/awt/event/MouseEvent;B)I",
|
|
garbageValue = "-1"
|
|
)
|
|
@Export("getButton")
|
|
final int getButton(MouseEvent var1) {
|
|
int var2 = var1.getButton();
|
|
if (!var1.isAltDown() && var2 != 2) {
|
|
return !var1.isMetaDown() && var2 != 3 ? 1 : 2;
|
|
} else {
|
|
return 4;
|
|
}
|
|
}
|
|
|
|
public final synchronized void mouseMoved(MouseEvent var1) {
|
|
if (MouseHandler_instance != null) {
|
|
MouseHandler_idleCycles = 0;
|
|
MouseHandler_xVolatile = var1.getX();
|
|
MouseHandler_yVolatile = var1.getY();
|
|
MouseHandler_lastMovedVolatile = var1.getWhen();
|
|
}
|
|
|
|
}
|
|
|
|
public final synchronized void mouseDragged(MouseEvent var1) {
|
|
this.mouseMoved(var1);
|
|
}
|
|
|
|
public final synchronized void mousePressed(MouseEvent var1) {
|
|
if (MouseHandler_instance != null) {
|
|
MouseHandler_idleCycles = 0;
|
|
MouseHandler_lastPressedXVolatile = var1.getX();
|
|
MouseHandler_lastPressedYVolatile = var1.getY();
|
|
MouseHandler_lastPressedTimeMillisVolatile = PlayerAppearance.currentTimeMillis();
|
|
MouseHandler_lastButtonVolatile = this.getButton(var1);
|
|
if (MouseHandler_lastButtonVolatile != 0) {
|
|
MouseHandler_currentButtonVolatile = MouseHandler_lastButtonVolatile;
|
|
}
|
|
}
|
|
|
|
if (var1.isPopupTrigger()) {
|
|
var1.consume();
|
|
}
|
|
|
|
}
|
|
|
|
public final synchronized void mouseReleased(MouseEvent var1) {
|
|
if (MouseHandler_instance != null) {
|
|
MouseHandler_idleCycles = 0;
|
|
MouseHandler_currentButtonVolatile = 0;
|
|
}
|
|
|
|
if (var1.isPopupTrigger()) {
|
|
var1.consume();
|
|
}
|
|
|
|
}
|
|
|
|
public final synchronized void mouseEntered(MouseEvent var1) {
|
|
this.mouseMoved(var1);
|
|
}
|
|
|
|
public final void focusGained(FocusEvent var1) {
|
|
}
|
|
|
|
public final synchronized void focusLost(FocusEvent var1) {
|
|
if (MouseHandler_instance != null) {
|
|
MouseHandler_currentButtonVolatile = 0;
|
|
}
|
|
|
|
}
|
|
|
|
public final synchronized void mouseExited(MouseEvent var1) {
|
|
if (MouseHandler_instance != null) {
|
|
MouseHandler_idleCycles = 0;
|
|
MouseHandler_xVolatile = -1;
|
|
MouseHandler_yVolatile = -1;
|
|
MouseHandler_lastMovedVolatile = var1.getWhen();
|
|
}
|
|
|
|
}
|
|
|
|
public final void mouseClicked(MouseEvent var1) {
|
|
if (var1.isPopupTrigger()) {
|
|
var1.consume();
|
|
}
|
|
|
|
}
|
|
|
|
@ObfuscatedName("af")
|
|
@ObfuscatedSignature(
|
|
signature = "(ILcj;ZB)I",
|
|
garbageValue = "-21"
|
|
)
|
|
static int method1176(int var0, Script var1, boolean var2) {
|
|
if (var0 == ScriptOpcodes.VIEWPORT_SETFOV) {
|
|
Interpreter.Interpreter_intStackSize -= 2;
|
|
Client.field881 = (short)Buddy.method5298(Interpreter.Interpreter_intStack[Interpreter.Interpreter_intStackSize]);
|
|
if (Client.field881 <= 0) {
|
|
Client.field881 = 256;
|
|
}
|
|
|
|
Client.field882 = (short)Buddy.method5298(Interpreter.Interpreter_intStack[Interpreter.Interpreter_intStackSize + 1]);
|
|
if (Client.field882 <= 0) {
|
|
Client.field882 = 256;
|
|
}
|
|
|
|
return 1;
|
|
} else if (var0 == ScriptOpcodes.VIEWPORT_SETZOOM) {
|
|
Interpreter.Interpreter_intStackSize -= 2;
|
|
Client.zoomHeight = (short)Interpreter.Interpreter_intStack[Interpreter.Interpreter_intStackSize];
|
|
if (Client.zoomHeight <= 0) {
|
|
Client.zoomHeight = 256;
|
|
}
|
|
|
|
Client.zoomWidth = (short)Interpreter.Interpreter_intStack[Interpreter.Interpreter_intStackSize + 1];
|
|
if (Client.zoomWidth <= 0) {
|
|
Client.zoomWidth = 320;
|
|
}
|
|
|
|
return 1;
|
|
} else if (var0 == ScriptOpcodes.VIEWPORT_CLAMPFOV) {
|
|
Interpreter.Interpreter_intStackSize -= 4;
|
|
Client.field885 = (short)Interpreter.Interpreter_intStack[Interpreter.Interpreter_intStackSize];
|
|
if (Client.field885 <= 0) {
|
|
Client.field885 = 1;
|
|
}
|
|
|
|
Client.field886 = (short)Interpreter.Interpreter_intStack[Interpreter.Interpreter_intStackSize + 1];
|
|
if (Client.field886 <= 0) {
|
|
Client.field886 = 32767;
|
|
} else if (Client.field886 < Client.field885) {
|
|
Client.field886 = Client.field885;
|
|
}
|
|
|
|
Client.field844 = (short)Interpreter.Interpreter_intStack[Interpreter.Interpreter_intStackSize + 2];
|
|
if (Client.field844 <= 0) {
|
|
Client.field844 = 1;
|
|
}
|
|
|
|
Client.field888 = (short)Interpreter.Interpreter_intStack[Interpreter.Interpreter_intStackSize + 3];
|
|
if (Client.field888 <= 0) {
|
|
Client.field888 = 32767;
|
|
} else if (Client.field888 < Client.field844) {
|
|
Client.field888 = Client.field844;
|
|
}
|
|
|
|
return 1;
|
|
} else if (var0 == ScriptOpcodes.VIEWPORT_GETEFFECTIVESIZE) {
|
|
if (Client.viewportWidget != null) {
|
|
Calendar.setViewportShape(0, 0, Client.viewportWidget.width, Client.viewportWidget.height, false);
|
|
Interpreter.Interpreter_intStack[++Interpreter.Interpreter_intStackSize - 1] = Client.viewportWidth;
|
|
Interpreter.Interpreter_intStack[++Interpreter.Interpreter_intStackSize - 1] = Client.viewportHeight;
|
|
} else {
|
|
Interpreter.Interpreter_intStack[++Interpreter.Interpreter_intStackSize - 1] = -1;
|
|
Interpreter.Interpreter_intStack[++Interpreter.Interpreter_intStackSize - 1] = -1;
|
|
}
|
|
|
|
return 1;
|
|
} else if (var0 == ScriptOpcodes.VIEWPORT_GETZOOM) {
|
|
Interpreter.Interpreter_intStack[++Interpreter.Interpreter_intStackSize - 1] = Client.zoomHeight;
|
|
Interpreter.Interpreter_intStack[++Interpreter.Interpreter_intStackSize - 1] = Client.zoomWidth;
|
|
return 1;
|
|
} else if (var0 == ScriptOpcodes.VIEWPORT_GETFOV) {
|
|
Interpreter.Interpreter_intStack[++Interpreter.Interpreter_intStackSize - 1] = class30.method608(Client.field881);
|
|
Interpreter.Interpreter_intStack[++Interpreter.Interpreter_intStackSize - 1] = class30.method608(Client.field882);
|
|
return 1;
|
|
} else if (var0 == 6220) {
|
|
Interpreter.Interpreter_intStack[++Interpreter.Interpreter_intStackSize - 1] = 0;
|
|
return 1;
|
|
} else if (var0 == 6221) {
|
|
Interpreter.Interpreter_intStack[++Interpreter.Interpreter_intStackSize - 1] = 0;
|
|
return 1;
|
|
} else if (var0 == 6222) {
|
|
Interpreter.Interpreter_intStack[++Interpreter.Interpreter_intStackSize - 1] = class286.canvasWidth;
|
|
return 1;
|
|
} else if (var0 == 6223) {
|
|
Interpreter.Interpreter_intStack[++Interpreter.Interpreter_intStackSize - 1] = FloorUnderlayDefinition.canvasHeight;
|
|
return 1;
|
|
} else {
|
|
return 2;
|
|
}
|
|
}
|
|
|
|
@ObfuscatedName("hx")
|
|
@ObfuscatedSignature(
|
|
signature = "(I)V",
|
|
garbageValue = "790198016"
|
|
)
|
|
static final void method1172() {
|
|
for (Projectile var0 = (Projectile)Client.projectiles.last(); var0 != null; var0 = (Projectile)Client.projectiles.previous()) {
|
|
if (var0.plane == Player.Client_plane && Client.cycle <= var0.cycleEnd) {
|
|
if (Client.cycle >= var0.cycleStart) {
|
|
if (var0.targetIndex > 0) {
|
|
NPC var1 = Client.npcs[var0.targetIndex - 1];
|
|
if (var1 != null && var1.x >= 0 && var1.x < 13312 && var1.y >= 0 && var1.y < 13312) {
|
|
var0.setDestination(var1.x, var1.y, GraphicsObject.getTileHeight(var1.x, var1.y, var0.plane) - var0.endHeight, Client.cycle);
|
|
}
|
|
}
|
|
|
|
if (var0.targetIndex < 0) {
|
|
int var2 = -var0.targetIndex - 1;
|
|
Player var3;
|
|
if (var2 == Client.localPlayerIndex) {
|
|
var3 = class215.localPlayer;
|
|
} else {
|
|
var3 = Client.players[var2];
|
|
}
|
|
|
|
if (var3 != null && var3.x >= 0 && var3.x < 13312 && var3.y >= 0 && var3.y < 13312) {
|
|
var0.setDestination(var3.x, var3.y, GraphicsObject.getTileHeight(var3.x, var3.y, var0.plane) - var0.endHeight, Client.cycle);
|
|
}
|
|
}
|
|
|
|
var0.advance(Client.field693);
|
|
WorldMapArea.scene.drawEntity(Player.Client_plane, (int)var0.x, (int)var0.y, (int)var0.z, 60, var0, var0.yaw, -1L, false);
|
|
}
|
|
} else {
|
|
var0.remove();
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|