Merge pull request #11 from Ceikry/master

Plugin system, plugin API
This commit is contained in:
Pazaz 2022-09-25 12:06:21 -04:00 committed by GitHub
commit 9c6ada033b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
51 changed files with 2104 additions and 377 deletions

View file

@ -1,6 +1,7 @@
plugins {
id 'java'
id 'application'
id 'org.jetbrains.kotlin.jvm' version '1.4.10'
}
mainClassName = 'rt4.client'
@ -35,6 +36,8 @@ dependencies {
implementation 'lib:jogl-all-natives-linux-i586'
implementation 'lib:jogl-all-natives-macosx-universal'
implementation 'lib:jogl-all-natives-android-aarch64'
runtime 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.4.10'
}
jar {
@ -42,4 +45,5 @@ jar {
attributes 'Main-Class': "$mainClassName"
}
from { configurations.compileClasspath.collect { it.isDirectory() ? it : zipTree(it) } }
duplicatesStrategy = DuplicatesStrategy.INCLUDE
}

View file

@ -5,5 +5,6 @@
"server_port": 43594,
"wl_port": 43595,
"js5_port": 43595,
"mouseWheelZoom": true
"mouseWheelZoom": true,
"pluginsFolder": "plugins"
}

View file

@ -0,0 +1,98 @@
package plugin;
import plugin.api.MiniMenuEntry;
import rt4.Component;
import rt4.Npc;
import rt4.Player;
import rt4.Tile;
/**
* The base plugin class which is meant to be extended by plugins.
* Contains callbacks to many parts of the internal client code.
* @author ceikry
*/
public abstract class Plugin {
long timeOfLastDraw;
void _init() {
Init();
}
void _draw() {
long nowTime = System.currentTimeMillis();
Draw(nowTime - timeOfLastDraw);
timeOfLastDraw = nowTime;
}
/**
* Draw() is called by the client rendering loop so that plugins can draw information onto the screen.
* This will be called once per frame, meaning it is framerate bound.
* @param timeDelta the time (ms) elapsed since the last draw call.
*/
public void Draw(long timeDelta) {}
/**
* Init() is called when the plugin is first loaded
*/
public void Init() {}
/**
* OnXPUpdate() is called when the client receives an XP update packet. This includes at login.
* @param skill - the skill ID being updated
* @param xp - the new total XP for the skill.
*/
public void OnXPUpdate(int skill, int xp) {}
/**
* Update() is called once per tick, aka once every 600ms.
*/
public void Update() {}
/**
* PlayerOverheadDraw() is called once per frame, for every player on the screen. :) Expensive.
* @param screenX the X coordinate on the screen for overhead drawing
* @param screenY the Y coordinate on the screen for overhead drawing
*/
public void PlayerOverheadDraw(Player player, int screenX, int screenY) {}
/**
* NPCOverheadDraw() is called once per frame, for every NPC on the screen. :) Expensive.
* @param screenX the X coordinate on the screen for overhead drawing
* @param screenY the Y coordinate on the screen for overhead drawing
*/
public void NPCOverheadDraw(Npc npc, int screenX, int screenY) {}
/**
* ProcessCommand is called when a user types and sends a message prefixed with ::
* @param commandStr the command the user used - should include :: in comparisons, eg <pre>commandStr.equals("::command")</pre>
* @param args any other tokens included with the initial message. Tokens are determined by spaces.
*/
public void ProcessCommand(String commandStr, String[] args) {}
/**
* ComponentDraw is called when an interface component is being rendered by the client.
* @param componentIndex the index of the component in its parent interface.
* @param component the component itself
* @param screenX the screen X coordinate of this component
* @param screenY the screen Y coordinate of this component
*/
public void ComponentDraw(int componentIndex, Component component, int screenX, int screenY) {}
/**
* OnVarpUpdate is called when varps are updated by the server sending packets.
* @param id the ID of the varp
* @param value the value the varp is being set to.
*/
public void OnVarpUpdate(int id, int value) {}
/**
* OnLogout is called when the client logs out. This should be used to clear player-relevant plugin state.
*/
public void OnLogout() {}
/**
* DrawMiniMenu is called when a MiniMenu entry has been created.
* @param entry the entry
*/
public void DrawMiniMenu(MiniMenuEntry entry) {}
}

View file

@ -0,0 +1,73 @@
package plugin;
import plugin.annotations.PluginMeta;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.Objects;
import java.util.Properties;
/**
* A data class for storing information about plugins.
* @author ceikry
*/
class PluginInfo {
double version;
String author;
String description;
public PluginInfo(String author, String description, double version) {
this.version = version;
this.author = author;
this.description = description;
}
public static PluginInfo loadFromFile(File file) {
Properties prop = new Properties();
try {
prop.load(new FileReader(file));
} catch (FileNotFoundException e) {
System.err.println("File does not exist! - " + file.getAbsolutePath());
return new PluginInfo("", "", 0.0);
} catch (IOException e) {
e.printStackTrace();
return new PluginInfo("", "", 0.0);
}
return new PluginInfo(
prop.get("AUTHOR").toString(),
prop.get("DESCRIPTION").toString(),
Double.parseDouble(prop.get("VERSION").toString())
);
}
public static PluginInfo loadFromClass(Class<?> clazz) {
PluginMeta info = clazz.getAnnotation(PluginMeta.class);
if (info == null) {
return null;
}
return new PluginInfo(
info.author(),
info.description(),
info.version()
);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
PluginInfo that = (PluginInfo) o;
return Double.compare(that.version, version) == 0 && Objects.equals(author, that.author) && Objects.equals(description, that.description);
}
@Override
public int hashCode() {
return Objects.hash(version, author, description);
}
}

View file

@ -0,0 +1,137 @@
package plugin;
import plugin.api.MiniMenuEntry;
import plugin.api.MiniMenuType;
import rt4.*;
import java.io.File;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
/**
* Responsible for loading and broadcasting methods to all plugins.
* @author ceikry
*/
public class PluginRepository {
static HashMap<PluginInfo, Plugin> loadedPlugins = new HashMap<>();
public static void registerPlugin(PluginInfo info, Plugin plugin) {
loadedPlugins.put(info, plugin);
}
public static void reloadPlugins() {
loadedPlugins.clear();
Init();
}
public static void Init() {
File pluginsDirectory = new File(GlobalJsonConfig.instance.pluginsFolder);
if (!pluginsDirectory.exists()) {
System.out.println("Skipping plugin initialization - " + pluginsDirectory.getAbsolutePath() + " does not exist.");
return;
}
try {
URL[] classPath = {pluginsDirectory.toURI().toURL()};
URLClassLoader loader = new URLClassLoader(classPath);
for(File file : Objects.requireNonNull(pluginsDirectory.listFiles())) {
if(!file.isDirectory()) continue;
if(file.getName().equals("META-INF")) continue;
File infoFile = new File(file.getAbsoluteFile() + File.separator + "plugin.properties");
File pluginRoot = new File(file.getAbsoluteFile() + File.separator + "plugin.class");
if (!pluginRoot.exists()) {
System.err.println("Unable to load plugin " + file.getName() + " because plugin.class is absent!");
continue;
}
Class<?> clazz = loader.loadClass(file.getName() + ".plugin");
PluginInfo info;
if (infoFile.exists())
info = PluginInfo.loadFromFile(infoFile);
else
info = PluginInfo.loadFromClass(clazz);
if (info == null) {
System.err.println("Unable to load plugin " + file.getName() + " because it contains no information about author, version, etc!");
continue;
}
try {
Plugin thisPlugin = (Plugin) clazz.newInstance();
thisPlugin._init();
registerPlugin(info, thisPlugin);
} catch (Exception e) {
System.err.println("Error loading plugin " + file.getName() + ":");
e.printStackTrace();
return;
}
List<File> otherClasses = Arrays.stream(Objects.requireNonNull(file.listFiles()))
.filter((f) ->
!f.getName().equals("plugin.class") && f.getName().contains(".class"))
.collect(Collectors.toList());
for (File f : otherClasses) {
loader.loadClass(file.getName() + "." + f.getName().replace(".class",""));
}
System.out.println("Successfully loaded plugin " + file.getName() + ", version " + info.version);
}
} catch (Exception e) {
System.err.println("Unexpected exception during plugin initialization:");
e.printStackTrace();
}
}
public static void Update() {
loadedPlugins.values().forEach(Plugin::Update);
}
public static void Draw() {
loadedPlugins.values().forEach(Plugin::_draw);
}
public static void NPCOverheadDraw(Npc npc, int screenX, int screenY) {
loadedPlugins.values().forEach((plugin) -> plugin.NPCOverheadDraw(npc, screenX, screenY));
}
public static void PlayerOverheadDraw(Player player, int screenX, int screenY) {
loadedPlugins.values().forEach((plugin) -> plugin.PlayerOverheadDraw(player, screenX, screenY));
}
public static void ProcessCommand(JagString commandStr) {
String[] tokens = commandStr.toString().split(" ");
String[] args = Arrays.copyOfRange(tokens, 1, tokens.length);
loadedPlugins.values().forEach((plugin) -> plugin.ProcessCommand(tokens[0], args));
}
public static void ComponentDraw(int componentIndex, Component component, int screenX, int screenY) {
loadedPlugins.values().forEach((plugin) -> plugin.ComponentDraw(componentIndex, component, screenX, screenY));
}
public static void OnVarpUpdate(int id, int value) {
loadedPlugins.values().forEach((plugin) -> plugin.OnVarpUpdate(id, value));
}
public static void OnXPUpdate(int skill, int xp) {
loadedPlugins.values().forEach((plugin) -> plugin.OnXPUpdate(skill, xp));
}
public static void OnLogout() {
loadedPlugins.values().forEach(Plugin::OnLogout);
}
public static void DrawMiniMenu(MiniMenuEntry entry) {
loadedPlugins.values().forEach((plugin) -> plugin.DrawMiniMenu(entry));
}
}

View file

@ -0,0 +1,11 @@
package plugin.annotations;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@Retention(RetentionPolicy.RUNTIME)
public @interface PluginMeta {
String author();
String description();
double version();
}

View file

@ -0,0 +1,208 @@
package plugin.api;
import rt4.*;
import rt4.DisplayMode;
import rt4.Font;
import java.awt.*;
import java.awt.event.*;
import java.util.ArrayList;
import static rt4.MathUtils.clamp;
/**
* API used for writing plugins, so dozens of plugins don't break when we rename shit :)
* @author ceikry
*/
public class API {
public static void DrawText(FontType fontType, FontColor color, TextModifier mod, String text, int screenX, int screenY) {
JagString js = JagString.of(text);
Font font;
switch (fontType) {
case SMALL:
font = Fonts.p11Full;
break;
case LARGE:
font = Fonts.p12Full;
break;
default:
return;
}
switch (mod) {
case CENTER:
font.renderCenter(js, screenX, screenY, color.colorCode, -1);
break;
case LEFT:
font.renderLeft(js, screenX, screenY, color.colorCode, -1);
break;
case RIGHT:
font.renderRight(js, screenX, screenY, color.colorCode, -1);
break;
case SHAKE:
font.renderShake(js, screenX, screenY, color.colorCode, -1, 100);
break;
case WAVE:
font.renderWave(js, screenX, screenY, color.colorCode, -1);
break;
case WAVE_2:
font.renderWave2(js, screenX, screenY, color.colorCode, -1);
break;
}
}
public static boolean PlayerHasPrivilege(Privileges privilege) {
return LoginManager.staffModLevel >= privilege.ordinal();
}
public static boolean IsHD() {
return GlRenderer.enabled;
}
public static Sprite GetSprite(int spriteId) {
Sprite rawSprite = null;
if (client.js5Archive8.isFileReady(spriteId)) {
rawSprite = SpriteLoader.loadSprites(spriteId, client.js5Archive8);
}
return rawSprite;
}
public static Sprite GetObjSprite(int objId, int qty, boolean drawText, int outlineType, int shadowIntensity) {
return Inv.getObjectSprite(outlineType, objId, drawText, qty, shadowIntensity);
}
public static WindowMode GetWindowMode() {
int mode = DisplayMode.getWindowMode();
switch(mode) {
case 2:
return WindowMode.RESIZABLE;
case 3:
return WindowMode.FULLSCREEN;
default:
return WindowMode.FIXED;
}
}
public static Dimension GetWindowDimensions() {
return new Dimension(GameShell.canvasWidth, GameShell.canvasHeight);
}
public static void FillRect(int x, int y, int width, int height, int color, int alpha) {
if (IsHD()) {
if (alpha != 0)
GlRaster.fillRectAlpha(x,y,width,height,color,alpha);
else
GlRaster.fillRect(x,y,width,height,color);
} else {
if (alpha != 0)
SoftwareRaster.fillRectAlpha(x,y,width,height,color,alpha);
else
SoftwareRaster.fillRect(x,y,width,height,color);
}
}
public static void DrawRect(int x, int y, int width, int height, int color) {
if (IsHD()) {
GlRaster.drawRect(x, y, width, height, color);
} else {
SoftwareRaster.drawRect(x, y, width, height, color);
}
}
public static void ClipRect(int x, int y, int width, int height) {
if (IsHD()) {
GlRaster.setClip(x,y,width,height);
} else {
SoftwareRaster.setClip(x,y,width,height);
}
}
public static void AddMouseListener(MouseAdapter m) {
GameShell.canvas.addMouseListener(m);
GameShell.canvas.addMouseMotionListener(m);
}
public static void AddMouseWheelListener(MouseWheelListener mw) {
GameShell.canvas.addMouseWheelListener(mw);
}
public static void AddKeyboardListener(KeyAdapter k) {
GameShell.canvas.addKeyListener(k);
}
public static void SetCameraYaw(double targetYaw) {
Camera.yawTarget = targetYaw;
Camera.clampCameraAngle();
}
public static void UpdateCameraYaw(double yawDiff) {
Camera.yawTarget += yawDiff;
Camera.clampCameraAngle();
}
public static double GetCameraYaw() {
return Camera.yawTarget;
}
public static void SetCameraPitch(double targetPitch) {
Camera.pitchTarget = targetPitch;
Camera.clampCameraAngle();
}
public static void UpdateCameraPitch(double pitchDiff) {
Camera.pitchTarget += pitchDiff;
Camera.clampCameraAngle();
}
public static double GetCameraPitch() {
return Camera.pitchTarget;
}
public static void UpdateCameraZoom(int zoomDiff) {
Camera.ZOOM = clamp(200, 1200, Camera.ZOOM + (zoomDiff >= 0 ? 50 : -50));
}
public static void SetCameraZoom(int zoomTarget) {
Camera.ZOOM = clamp(200, 1200, zoomTarget);
}
public static int GetCameraZoom() {
return Camera.ZOOM;
}
public static int GetMouseWheelRotation() {
return ((JavaMouseWheel) client.mouseWheel).currentRotation;
}
public static int GetPreviousMouseWheelRotation() {
return ((JavaMouseWheel) client.mouseWheel).previousRotation;
}
public static int GetMouseX() {
return Mouse.currentMouseX;
}
public static int GetMouseY() {
return Mouse.currentMouseY;
}
/**
* Very simple wrapper around the already rename Keyboard checks.
* @param keycode the keycode to use. Keyboard class has named constants for these
*/
public static boolean IsKeyPressed(int keycode) {
return Keyboard.pressedKeys[keycode];
}
public static MiniMenuEntry[] GetMiniMenuEntries() {
ArrayList<MiniMenuEntry> entries = new ArrayList<>();
for (int i = 0; i < MiniMenu.size; i++) {
if (MiniMenu.opBases[i] == null) continue;
entries.add(new MiniMenuEntry(i));
}
return entries.toArray(new MiniMenuEntry[]{});
}
}

View file

@ -0,0 +1,17 @@
package plugin.api;
import java.awt.*;
public class FontColor {
public static FontColor YELLOW = new FontColor(16776960);
public final int colorCode;
public FontColor(int colorCode) {
this.colorCode = colorCode;
}
public static FontColor fromColor(Color color) {
return new FontColor((color.getRed() << 16) + (color.getGreen() << 8) + color.getBlue());
}
}

View file

@ -0,0 +1,6 @@
package plugin.api;
public enum FontType {
SMALL,
LARGE
}

View file

@ -0,0 +1,51 @@
package plugin.api;
import java.util.HashMap;
public enum MiniMenuAction {
WALK_HERE(60),
NPC_1(17),
NPC_2(16),
NPC_3(4),
NPC_4(19),
NPC_5(2),
NPC_EXAMINE(1007),
PLAYER_1(30),
PLAYER_BLOCK(34),
PLAYER_TRADE(29),
PLAYER_REQ_ASSIST(37),
PLAYER_FOLLOW(31),
PLAYER_5(57),
OBJ_1(47),
OBJ_EQUIP(5),
OBJ_4(35),
OBJ_OPERATE(23),
OBJ_5(58),
OBJ_EXAMINE(1002),
OBJSTACK_1(18),
OBJSTACK_2(20),
LOC_1(42),
LOC_2(50),
LOC_3(49),
LOC_4(46),
LOC_5(1001),
LOC_EXAMINE(1004)
;
public final short actionCode;
public static HashMap<Integer, MiniMenuAction> actionCodeMap = new HashMap<>();
MiniMenuAction(int actionCode) {
this.actionCode = (short) actionCode;
}
static {
for (MiniMenuAction a : values()) {
actionCodeMap.put((int) a.actionCode, a);
}
}
public static MiniMenuAction forActionCode(short actionCode) {
return actionCodeMap.get((int) actionCode);
}
}

View file

@ -0,0 +1,81 @@
package plugin.api;
import rt4.JagString;
import rt4.MiniMenu;
/**
* Convenience wrapper for mini menu entries
* @author ceikry
*/
public class MiniMenuEntry {
int index;
public MiniMenuEntry(int index) {
this.index = index;
}
public String getSubject() {
return MiniMenu.opBases[index].toString();
}
public void setSubject(String name) {
MiniMenu.opBases[index] = JagString.of(name);
}
public long getSubjectIndex() {
return MiniMenu.keys[index];
}
public MiniMenuType getType() {
if (getSubject().length() < 11) return MiniMenuType.TILE;
String color = getSubject().substring(5,11);
if (color.equals("00ffff")) return MiniMenuType.LOCATION;
if (color.equals("ffff00")) return MiniMenuType.NPC;
if (color.equals("ffffff")) return MiniMenuType.PLAYER;
if (color.equals("ff9040")) return MiniMenuType.OBJ;
else return MiniMenuType.TILE;
}
public String getVerb() {
return MiniMenu.ops[index].toString();
}
public void setVerb(String verb) {
MiniMenu.ops[index] = JagString.of(verb);
}
public int getIntArg1() {
return MiniMenu.intArgs1[index];
}
public int getIntArg2() {
return MiniMenu.intArgs2[index];
}
public int getCursor() {
return MiniMenu.cursors[index];
}
public MiniMenuAction getAction() {
int actionCode = MiniMenu.actions[index];
if (isStrictlySecondary()) actionCode -= 2000;
return MiniMenuAction.forActionCode((short) actionCode);
}
public short getActionCode() {
return MiniMenu.actions[index];
}
public void setAction(MiniMenuAction action) {
MiniMenu.actions[index] = action.actionCode;
}
public void toggleStrictlySecondary() {
if (isStrictlySecondary()) MiniMenu.actions[index] -= 2000;
else MiniMenu.actions[index] += 2000;
}
public boolean isStrictlySecondary() {
return MiniMenu.actions[index] >= 2000;
}
}

View file

@ -0,0 +1,10 @@
package plugin.api;
public enum MiniMenuType {
NPC,
PLAYER,
LOCATION,
TILE,
OBJ,
OBJSTACK
}

View file

@ -0,0 +1,7 @@
package plugin.api;
public enum Privileges {
NONE,
PMOD,
JMOD
}

View file

@ -0,0 +1,10 @@
package plugin.api;
public enum TextModifier {
CENTER,
LEFT,
RIGHT,
SHAKE,
WAVE,
WAVE_2
}

View file

@ -0,0 +1,7 @@
package plugin.api;
public enum WindowMode {
FIXED,
RESIZABLE,
FULLSCREEN
}

View file

@ -3,6 +3,7 @@ package rt4;
import org.openrs2.deob.annotation.OriginalArg;
import org.openrs2.deob.annotation.OriginalMember;
import org.openrs2.deob.annotation.Pc;
import plugin.PluginRepository;
public class Cheat {
@OriginalMember(owner = "client!p", name = "f", descriptor = "Lclient!na;")
@ -97,16 +98,18 @@ public class Cheat {
public static int rectDebug = 0;
@OriginalMember(owner = "client!jg", name = "e", descriptor = "Z")
public static boolean qaOpTest = false;
public static final JagString RELOADPLUGINS = JagString.parse("::reloadplugins");
@OriginalMember(owner = "client!en", name = "a", descriptor = "(IIIB)V")
public static void teleport(@OriginalArg(0) int arg0, @OriginalArg(1) int arg1, @OriginalArg(2) int arg2) {
@Pc(66) JagString local66 = JagString.concatenate(new JagString[]{aClass100_521, JagString.parseInt(arg2), Cs1ScriptRunner.aClass100_760, JagString.parseInt(arg0 >> 6), Cs1ScriptRunner.aClass100_760, JagString.parseInt(arg1 >> 6), Cs1ScriptRunner.aClass100_760, JagString.parseInt(arg0 & 0x3F), Cs1ScriptRunner.aClass100_760, JagString.parseInt(arg1 & 0x3F)});
@Pc(66) JagString local66 = JagString.concatenate(new JagString[]{aClass100_521, JagString.parseInt(arg2), JagString.aClass100_760, JagString.parseInt(arg0 >> 6), JagString.aClass100_760, JagString.parseInt(arg1 >> 6), JagString.aClass100_760, JagString.parseInt(arg0 & 0x3F), JagString.aClass100_760, JagString.parseInt(arg1 & 0x3F)});
local66.print();
execute(local66);
}
@OriginalMember(owner = "client!k", name = "a", descriptor = "(Lclient!na;Z)V")
public static void execute(@OriginalArg(0) JagString arg0) {
PluginRepository.ProcessCommand(arg0);
// if (LoginManager.staffModLevel >= 2) {
@Pc(18) int local18;
@Pc(38) int local38;
@ -228,6 +231,9 @@ public class Cheat {
shiftClick = true;
}
}
if (arg0.equalsIgnoreCase(RELOADPLUGINS)) {
PluginRepository.reloadPlugins();
}
//}
Protocol.outboundBuffer.p1isaac(44);
Protocol.outboundBuffer.p1(arg0.length() - 1);

View file

@ -7,7 +7,7 @@ import org.openrs2.deob.annotation.OriginalMember;
public final class ComponentPointer extends Node {
@OriginalMember(owner = "client!wk", name = "r", descriptor = "I")
public int anInt5878;
public int interfaceId;
@OriginalMember(owner = "client!wk", name = "s", descriptor = "I")
public int anInt5879;

View file

@ -3,6 +3,7 @@ package rt4;
import org.openrs2.deob.annotation.OriginalArg;
import org.openrs2.deob.annotation.OriginalMember;
import org.openrs2.deob.annotation.Pc;
import plugin.PluginRepository;
import java.nio.charset.StandardCharsets;
@ -33,22 +34,6 @@ public class Cs1ScriptRunner {
public static final int anInt671 = 0x332d25;
@OriginalMember(owner = "client!pg", name = "V", descriptor = "I")
public static final int anInt4504 = 50;
@OriginalMember(owner = "client!wa", name = "pb", descriptor = "Lclient!na;")
public static final JagString aClass100_556 = JagString.parse("<br>");
@OriginalMember(owner = "client!ed", name = "H", descriptor = "Lclient!na;")
public static final JagString aClass100_375 = JagString.parse("<)4col> x");
@OriginalMember(owner = "client!je", name = "db", descriptor = "Lclient!na;")
public static final JagString aClass100_589 = JagString.parse(" <col=ffffff>");
@OriginalMember(owner = "client!uf", name = "s", descriptor = "Lclient!na;")
public static final JagString aClass100_1043 = JagString.parse(" <col=00ff80>");
@OriginalMember(owner = "client!wj", name = "b", descriptor = "Lclient!na;")
public static final JagString aClass100_1101 = JagString.parse(" <col=ffff00>");
@OriginalMember(owner = "client!mi", name = "R", descriptor = "Lclient!na;")
public static final JagString aClass100_760 = JagString.parse(")1");
@OriginalMember(owner = "client!sj", name = "w", descriptor = "Lclient!na;")
public static final JagString aClass100_978 = JagString.parse("<)4col>");
@OriginalMember(owner = "client!jb", name = "c", descriptor = "Lclient!na;")
public static final JagString aClass100_583 = JagString.parse("(Y<)4col>");
@OriginalMember(owner = "client!th", name = "m", descriptor = "[Lclient!be;")
public static Component[] aClass13Array13;
@OriginalMember(owner = "client!k", name = "j", descriptor = "I")
@ -303,7 +288,7 @@ public class Cs1ScriptRunner {
}
@OriginalMember(owner = "client!gn", name = "a", descriptor = "(III[Lclient!be;IIIIBI)V")
public static void method1809(@OriginalArg(0) int arg0, @OriginalArg(1) int arg1, @OriginalArg(2) int arg2, @OriginalArg(3) Component[] components, @OriginalArg(4) int arg4, @OriginalArg(5) int layer, @OriginalArg(6) int arg6, @OriginalArg(7) int arg7, @OriginalArg(9) int parentRectangle) {
public static void renderComponent(@OriginalArg(0) int arg0, @OriginalArg(1) int arg1, @OriginalArg(2) int arg2, @OriginalArg(3) Component[] components, @OriginalArg(4) int arg4, @OriginalArg(5) int layer, @OriginalArg(6) int arg6, @OriginalArg(7) int arg7, @OriginalArg(9) int parentRectangle) {
if (GlRenderer.enabled) {
GlRaster.setClip(arg0, arg6, arg4, arg7);
} else {
@ -499,6 +484,12 @@ public class Cs1ScriptRunner {
continue;
}
if (component.clientCode == 1405) {
PluginRepository.Draw();
InterfaceList.aBooleanArray100[rectangle] = true;
InterfaceList.rectangleRedraw[rectangle] = true;
//Above are inauthentic changes to call plugin draws and redraw this interface. Below I have left intact all the authentic code.
if (!Cheat.displayFps) {
continue;
}
@ -571,9 +562,9 @@ public class Cs1ScriptRunner {
component.scrollY = 0;
}
}
method1809(local166, local114 - component.scrollY, -component.scrollX + local123, components, local302, component.id, local164, local291, rectangle);
renderComponent(local166, local114 - component.scrollY, -component.scrollX + local123, components, local302, component.id, local164, local291, rectangle);
if (component.createdComponents != null) {
method1809(local166, local114 - component.scrollY, -component.scrollX + local123, component.createdComponents, local302, component.id, local164, local291, rectangle);
renderComponent(local166, local114 - component.scrollY, -component.scrollX + local123, component.createdComponents, local302, component.id, local164, local291, rectangle);
}
@Pc(1186) ComponentPointer local1186 = (ComponentPointer) InterfaceList.openInterfaces.get(component.id);
if (local1186 != null) {
@ -584,7 +575,7 @@ public class Cs1ScriptRunner {
MiniMenu.actions[0] = 1005;
MiniMenu.opBases[0] = JagString.EMPTY;
}
method86(local1186.anInt5878, local166, local302, local123, rectangle, local291, local164, local114);
method86(local1186.interfaceId, local166, local302, local123, rectangle, local291, local164, local114);
}
if (GlRenderer.enabled) {
GlRaster.setClip(arg0, arg6, arg4, arg7);
@ -710,6 +701,7 @@ public class Cs1ScriptRunner {
local270++;
}
}
PluginRepository.ComponentDraw(i, component, local123, local114);
} else if (component.type == 3) {
if (isTrue(component)) {
local270 = component.activeColor;
@ -745,6 +737,7 @@ public class Cs1ScriptRunner {
} else {
SoftwareRaster.method2487(local123, local114, component.width, component.height, local270, 256 - (alpha & 0xFF));
}
PluginRepository.ComponentDraw(i, component, local123, local114);
} else {
@Pc(1921) Font local1921;
if (component.type == 4) {
@ -772,7 +765,7 @@ public class Cs1ScriptRunner {
local1934 = MiniMenu.NULL;
}
if ((local1989.stackable == 1 || component.objCount != 1) && component.objCount != -1) {
local1934 = JagString.concatenate(new JagString[]{MiniMenu.aClass100_32, local1934, aClass100_375, method1548(component.objCount)});
local1934 = JagString.concatenate(new JagString[]{MiniMenu.aClass100_32, local1934, JagString.aClass100_375, method1548(component.objCount)});
}
}
if (aClass13_10 == component) {
@ -783,6 +776,7 @@ public class Cs1ScriptRunner {
local1934 = interpolate(component, local1934);
}
local1921.drawInterfaceText(local1934, local123, local114, component.width, component.height, local276, component.shadowed ? 0 : -1, component.halign, component.valign, component.vpadding);
PluginRepository.ComponentDraw(i, component, local123, local114);
} else if (Component.aBoolean72) {
InterfaceList.redraw(component);
}
@ -815,6 +809,7 @@ public class Cs1ScriptRunner {
} else {
local2282.method1426(local123, local114, 256 - (alpha & 0xFF), memory, color);
}
PluginRepository.ComponentDraw(i, component, local123, local114);
} else if (local2274) {
for (local563 = 0; local563 < color; local563++) {
if (alpha == 0) {
@ -823,6 +818,7 @@ public class Cs1ScriptRunner {
local2282.method1426(local123, local114 + local563 * local468, -(alpha & 0xFF) + 256, memory, 1);
}
}
PluginRepository.ComponentDraw(i, component, local123, local114);
} else if (local2279) {
for (local563 = 0; local563 < memory; local563++) {
if (alpha == 0) {
@ -831,6 +827,7 @@ public class Cs1ScriptRunner {
local2282.method1426(local276 * local563 + local123, local114, 256 - (alpha & 0xFF), 1, color);
}
}
PluginRepository.ComponentDraw(i, component, local123, local114);
} else {
for (local563 = 0; local563 < memory; local563++) {
for (local571 = 0; local571 < color; local571++) {
@ -841,6 +838,7 @@ public class Cs1ScriptRunner {
}
}
}
PluginRepository.ComponentDraw(i, component, local123 + local276, local468 + local114);
}
GlRaster.setClip(arg0, arg6, arg4, arg7);
@ -849,7 +847,7 @@ public class Cs1ScriptRunner {
for (cardMemory = 0; cardMemory < memory; cardMemory++) {
for (local556 = 0; local556 < color; local556++) {
if (component.angle2d != 0) {
sprite.method1420(local114 + local468 * local556 + local468 / 2, component.angle2d, 4096, cardMemory * local276 + local123 + local276 / 2);
sprite.renderAngled(local114 + local468 * local556 + local468 / 2, component.angle2d, 4096, cardMemory * local276 + local123 + local276 / 2);
} else if (alpha == 0) {
sprite.render(cardMemory * local276 + local123, local468 * local556 + local114);
} else {
@ -857,21 +855,23 @@ public class Cs1ScriptRunner {
}
}
}
PluginRepository.ComponentDraw(i, component, local123 + local276, local114 + local468);
SoftwareRaster.setClip(arg0, arg6, arg4, arg7);
}
} else {
memory = component.width * 4096 / local276;
if (component.angle2d != 0) {
sprite.method1420(local114 + component.height / 2, component.angle2d, memory, local123 + component.width / 2);
sprite.renderAngled(local114 + component.height / 2, component.angle2d, memory, local123 + component.width / 2);
} else if (alpha != 0) {
sprite.method1422(local123, local114, component.width, component.height, 256 - (alpha & 0xFF));
sprite.renderAlpha(local123, local114, component.width, component.height, 256 - (alpha & 0xFF));
} else if (local276 == component.width && local468 == component.height) {
sprite.render(local123, local114);
} else {
// render icons in a container i.e bank icons
sprite.renderResized(local123, local114, component.width, component.height);
}
PluginRepository.ComponentDraw(i, component, local123, local114);
}
} else if (Component.aBoolean72) {
InterfaceList.redraw(component);
@ -990,6 +990,7 @@ public class Cs1ScriptRunner {
Rasteriser.prepareOffsets();
}
}
PluginRepository.ComponentDraw(i, component, local123 + component.width / 2, local114 + component.height / 2);
} else {
if (component.type == 7) {
local1921 = component.method491(Sprites.nameIcons);
@ -1006,9 +1007,9 @@ public class Cs1ScriptRunner {
local2611 = ObjTypeList.get(component.objTypes[local276] - 1);
@Pc(3159) JagString local3159;
if (local2611.stackable != 1 && component.objCounts[local276] == 1) {
local3159 = JagString.concatenate(new JagString[]{MiniMenu.aClass100_32, local2611.name, aClass100_978});
local3159 = JagString.concatenate(new JagString[]{MiniMenu.aClass100_32, local2611.name, JagString.aClass100_978});
} else {
local3159 = JagString.concatenate(new JagString[]{MiniMenu.aClass100_32, local2611.name, aClass100_375, method1548(component.objCounts[local276])});
local3159 = JagString.concatenate(new JagString[]{MiniMenu.aClass100_32, local2611.name, JagString.aClass100_375, method1548(component.objCounts[local276])});
}
local556 = local123 + memory * (component.invMarginX + 115);
objId = (component.invMarginY + 12) * local468 + local114;
@ -1023,6 +1024,7 @@ public class Cs1ScriptRunner {
local276++;
}
}
PluginRepository.ComponentDraw(i, component, local123 + component.invMarginX + 115, local114 + component.invMarginY + 12);
}
if (component.type == 8 && Protocol.aClass13_11 == component && Protocol.anInt5235 == anInt4504) {
local276 = 0;
@ -1032,7 +1034,7 @@ public class Cs1ScriptRunner {
local3297 = interpolate(component, local3297);
@Pc(3325) JagString local3325;
while (local3297.length() > 0) {
cardMemory = local3297.indexOf(aClass100_556);
cardMemory = local3297.indexOf(JagString.aClass100_556);
if (cardMemory == -1) {
local3325 = local3297;
local3297 = JagString.EMPTY;
@ -1070,7 +1072,7 @@ public class Cs1ScriptRunner {
objId = local556 + local3299.lineHeight + 2;
local3297 = interpolate(component, local3297);
while (local3297.length() > 0) {
local563 = local3297.indexOf(aClass100_556);
local563 = local3297.indexOf(JagString.aClass100_556);
if (local563 == -1) {
local3325 = local3297;
local3297 = JagString.EMPTY;
@ -1081,6 +1083,7 @@ public class Cs1ScriptRunner {
local3299.renderLeft(local3325, cardMemory + 3, objId, 0, -1);
objId += local3299.lineHeight + 1;
}
PluginRepository.ComponentDraw(i, component, cardMemory + 3, objId);
}
if (component.type == 9) {
if (component.aBoolean20) {
@ -1103,6 +1106,7 @@ public class Cs1ScriptRunner {
} else {
SoftwareRaster.method2494(local123, local276, local468, memory, component.color, component.lineWidth);
}
PluginRepository.ComponentDraw(i, component, local468, local276);
}
}
}
@ -1118,7 +1122,7 @@ public class Cs1ScriptRunner {
@OriginalMember(owner = "client!ag", name = "a", descriptor = "(IIIIIIIII)V")
public static void method86(@OriginalArg(1) int arg0, @OriginalArg(2) int arg1, @OriginalArg(3) int arg2, @OriginalArg(4) int arg3, @OriginalArg(5) int arg4, @OriginalArg(6) int arg5, @OriginalArg(7) int arg6, @OriginalArg(8) int arg7) {
if (InterfaceList.load(arg0)) {
method1809(arg1, arg7, arg3, InterfaceList.components[arg0], arg2, -1, arg6, arg5, arg4);
renderComponent(arg1, arg7, arg3, InterfaceList.components[arg0], arg2, -1, arg6, arg5, arg4);
} else if (arg4 == -1) {
for (@Pc(27) int local27 = 0; local27 < 100; local27++) {
InterfaceList.aBooleanArray100[local27] = true;
@ -1133,7 +1137,7 @@ public class Cs1ScriptRunner {
aClass13Array13 = null;
method86(InterfaceList.topLevelInterface, 0, GameShell.canvasWidth, 0, -1, GameShell.canvasHeight, 0, 0);
if (aClass13Array13 != null) {
method1809(0, anInt3126, anInt4696, aClass13Array13, GameShell.canvasWidth, -1412584499, 0, GameShell.canvasHeight, aClass13_1.rectangle);
renderComponent(0, anInt3126, anInt4696, aClass13Array13, GameShell.canvasWidth, -1412584499, 0, GameShell.canvasHeight, aClass13_1.rectangle);
aClass13Array13 = null;
}
}
@ -1242,14 +1246,14 @@ public class Cs1ScriptRunner {
public static JagString method1548(@OriginalArg(1) int arg0) {
@Pc(9) JagString local9 = JagString.parseInt(arg0);
for (@Pc(21) int local21 = local9.length() - 3; local21 > 0; local21 -= 3) {
local9 = JagString.concatenate(new JagString[]{local9.substring(local21, 0), aClass100_760, local9.substring(local21)});
local9 = JagString.concatenate(new JagString[]{local9.substring(local21, 0), JagString.aClass100_760, local9.substring(local21)});
}
if (local9.length() > 9) {
return JagString.concatenate(new JagString[]{aClass100_1043, local9.substring(local9.length() - 8, 0), LocalizedText.MILLION_SHORT, MiniMenu.OPEN_PARENTHESIS, local9, aClass100_583});
return JagString.concatenate(new JagString[]{JagString.aClass100_1043, local9.substring(local9.length() - 8, 0), LocalizedText.MILLION_SHORT, MiniMenu.OPEN_PARENTHESIS, local9, JagString.aClass100_583});
} else if (local9.length() > 6) {
return JagString.concatenate(new JagString[]{aClass100_589, local9.substring(local9.length() - 4, 0), LocalizedText.THOUSAND_SHORT, MiniMenu.OPEN_PARENTHESIS, local9, aClass100_583});
return JagString.concatenate(new JagString[]{JagString.aClass100_589, local9.substring(local9.length() - 4, 0), LocalizedText.THOUSAND_SHORT, MiniMenu.OPEN_PARENTHESIS, local9, JagString.aClass100_583});
} else {
return JagString.concatenate(new JagString[]{aClass100_1101, local9, aClass100_978});
return JagString.concatenate(new JagString[]{JagString.aClass100_1101, local9, JagString.aClass100_978});
}
}

View file

@ -12,16 +12,6 @@ public final class DateUtil {
@OriginalMember(owner = "client!cl", name = "K", descriptor = "Ljava/util/Calendar;")
public static final Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
@OriginalMember(owner = "client!fn", name = "Z", descriptor = "Lclient!na;")
public static final JagString aClass100_461 = JagString.parse(")1 ");
@OriginalMember(owner = "client!wb", name = "a", descriptor = "Lclient!na;")
public static final JagString aClass100_1089 = JagString.parse(")2");
@OriginalMember(owner = "client!dm", name = "j", descriptor = "Lclient!na;")
public static final JagString SPACE = JagString.parse(" ");
@OriginalMember(owner = "client!vh", name = "c", descriptor = "Lclient!na;")
public static final JagString COLON = JagString.parse(":");
@OriginalMember(owner = "client!ee", name = "a", descriptor = "Lclient!na;")
public static final JagString TIMEZONE = JagString.parse(" GMT");
@OriginalMember(owner = "client!km", name = "tc", descriptor = "Lclient!na;")
private static final JagString DEC = JagString.parse("Dec");
@ -104,6 +94,6 @@ public final class DateUtil {
@Pc(36) int local36 = calendar.get(Calendar.HOUR_OF_DAY);
@Pc(40) int local40 = calendar.get(Calendar.MINUTE);
@Pc(44) int local44 = calendar.get(Calendar.SECOND);
return JagString.concatenate(new JagString[]{DAYS[local13 - 1], aClass100_461, JagString.parseInt(local17 / 10), JagString.parseInt(local17 % 10), aClass100_1089, MONTHS[local21], aClass100_1089, JagString.parseInt(local32), SPACE, JagString.parseInt(local36 / 10), JagString.parseInt(local36 % 10), COLON, JagString.parseInt(local40 / 10), JagString.parseInt(local40 % 10), COLON, JagString.parseInt(local44 / 10), JagString.parseInt(local44 % 10), TIMEZONE});
return JagString.concatenate(new JagString[]{DAYS[local13 - 1], JagString.aClass100_461, JagString.parseInt(local17 / 10), JagString.parseInt(local17 % 10), JagString.aClass100_1089, MONTHS[local21], JagString.aClass100_1089, JagString.parseInt(local32), JagString.SPACE, JagString.parseInt(local36 / 10), JagString.parseInt(local36 % 10), JagString.COLON, JagString.parseInt(local40 / 10), JagString.parseInt(local40 % 10), JagString.COLON, JagString.parseInt(local44 / 10), JagString.parseInt(local44 % 10), JagString.TIMEZONE});
}
}

View file

@ -75,7 +75,7 @@ public final class DisplayMode {
}
@OriginalMember(owner = "client!pm", name = "a", descriptor = "(ZIZIZII)V")
public static void setWindowMode(@OriginalArg(0) boolean arg0, @OriginalArg(1) int arg1, @OriginalArg(2) boolean arg2, @OriginalArg(3) int arg3, @OriginalArg(5) int arg4, @OriginalArg(6) int arg5) {
public static void setWindowMode(@OriginalArg(0) boolean arg0, @OriginalArg(1) int arg1, @OriginalArg(2) boolean arg2, @OriginalArg(3) int mode, @OriginalArg(5) int arg4, @OriginalArg(6) int arg5) {
if (arg2) {
GlRenderer.quit();
}
@ -92,7 +92,7 @@ public final class DisplayMode {
}
}
if (arg1 == 3 && GameShell.fullScreenFrame == null) {
setWindowMode(true, Preferences.favoriteWorlds, true, arg3, -1, -1);
setWindowMode(true, Preferences.favoriteWorlds, true, mode, -1, -1);
return;
}
@Pc(85) Container local85;
@ -146,7 +146,7 @@ public final class DisplayMode {
GameShell.canvas.setLocation(GameShell.leftMargin, GameShell.topMargin);
}
}
if (arg1 == 0 && arg3 > 0) {
if (arg1 == 0 && mode > 0) {
GlRenderer.createAndDestroyContext(GameShell.canvas);
}
if (arg2 && arg1 > 0) {
@ -167,7 +167,7 @@ public final class DisplayMode {
} catch (@Pc(277) Exception local277) {
}
GameShell.method2704();
if (arg3 == 0) {
if (mode == 0) {
SoftwareRaster.frameBuffer = FrameBuffer.create(503, 765, GameShell.canvas);
} else {
SoftwareRaster.frameBuffer = null;
@ -185,10 +185,10 @@ public final class DisplayMode {
}
}
if (!GlRenderer.enabled && arg1 > 0) {
setWindowMode(true, 0, true, arg3, -1, -1);
setWindowMode(true, 0, true, mode, -1, -1);
return;
}
if (arg1 > 0 && arg3 == 0) {
if (arg1 > 0 && mode == 0) {
GameShell.thread.setPriority(5);
SoftwareRaster.frameBuffer = null;
SoftwareModel.method4580();
@ -197,7 +197,7 @@ public final class DisplayMode {
Rasteriser.setBrightness(0.7F);
}
LoginManager.method4637();
} else if (arg1 == 0 && arg3 > 0) {
} else if (arg1 == 0 && mode > 0) {
GameShell.thread.setPriority(1);
SoftwareRaster.frameBuffer = FrameBuffer.create(503, 765, GameShell.canvas);
SoftwareModel.method4583();

View file

@ -363,7 +363,7 @@ public class GlSprite extends Sprite {
@OriginalMember(owner = "client!cf", name = "b", descriptor = "(IIIII)V")
@Override
public final void method1422(@OriginalArg(0) int arg0, @OriginalArg(1) int arg1, @OriginalArg(2) int arg2, @OriginalArg(3) int arg3, @OriginalArg(4) int arg4) {
public final void renderAlpha(@OriginalArg(0) int arg0, @OriginalArg(1) int arg1, @OriginalArg(2) int arg2, @OriginalArg(3) int arg3, @OriginalArg(4) int arg4) {
if (arg2 <= 0 || arg3 <= 0) {
return;
}

View file

@ -26,5 +26,5 @@ public class GlobalJsonConfig {
int wl_port;
int js5_port;
boolean mouseWheelZoom = GlobalConfig.MOUSEWHEEL_ZOOM;
public String pluginsFolder = "plugins";
}

View file

@ -198,7 +198,7 @@ public class InterfaceList {
@OriginalMember(owner = "client!i", name = "i", descriptor = "(Z)V")
public static void redrawActiveInterfaces() {
for (@Pc(6) ComponentPointer local6 = (ComponentPointer) openInterfaces.head(); local6 != null; local6 = (ComponentPointer) openInterfaces.next()) {
@Pc(14) int local14 = local6.anInt5878;
@Pc(14) int local14 = local6.interfaceId;
if (load(local14)) {
@Pc(21) boolean local21 = true;
@Pc(25) Component[] local25 = components[local14];
@ -318,7 +318,7 @@ public class InterfaceList {
}
@Pc(66) ComponentPointer local66 = (ComponentPointer) openInterfaces.get(arg0.id);
if (local66 != null) {
method4017(local32, arg1, local66.anInt5878, local20);
method4017(local32, arg1, local66.interfaceId, local20);
}
}
@ -368,7 +368,7 @@ public class InterfaceList {
@OriginalMember(owner = "client!ke", name = "a", descriptor = "(ZLclient!wk;Z)V")
public static void closeInterface(@OriginalArg(0) boolean arg0, @OriginalArg(1) ComponentPointer arg1) {
@Pc(9) int local9 = (int) arg1.key;
@Pc(16) int local16 = arg1.anInt5878;
@Pc(16) int local16 = arg1.interfaceId;
arg1.unlink();
if (arg0) {
method2275(local16);
@ -532,7 +532,7 @@ public class InterfaceList {
@Pc(28) int local28 = arg0.id >>> 16;
@Pc(33) HashTableIterator local33 = new HashTableIterator(openInterfaces);
for (@Pc(38) ComponentPointer local38 = (ComponentPointer) local33.method2701(); local38 != null; local38 = (ComponentPointer) local33.method2700()) {
if (local28 == local38.anInt5878) {
if (local28 == local38.interfaceId) {
return getComponent((int) local38.key);
}
}
@ -575,7 +575,7 @@ public class InterfaceList {
}
@Pc(49) ComponentPointer local49 = (ComponentPointer) openInterfaces.get(local23.id);
if (local49 != null) {
runScripts(arg1, local49.anInt5878);
runScripts(arg1, local49.interfaceId);
}
}
@Pc(72) HookRequest local72;
@ -1045,7 +1045,7 @@ public class InterfaceList {
}
@Pc(1595) ComponentPointer local1595 = (ComponentPointer) openInterfaces.get(component.id);
if (local1595 != null) {
method1320(local50, local63, local55, local65, local1595.anInt5878, local61, local67);
method1320(local50, local63, local55, local65, local1595.interfaceId, local61, local67);
}
}
}
@ -1232,7 +1232,7 @@ public class InterfaceList {
}
@Pc(73) ComponentPointer local73 = (ComponentPointer) openInterfaces.get(local15.id);
if (local73 != null) {
method1949(local73.anInt5878);
method1949(local73.interfaceId);
}
}
if (local15.type == 6) {

View file

@ -19,13 +19,39 @@ public final class JagString implements StringInterface {
@OriginalMember(owner = "client!pi", name = "Q", descriptor = "Lclient!na;")
public static final JagString aClass100_853 = parse("null");
@OriginalMember(owner = "client!t", name = "C", descriptor = "Lclient!na;")
public static final JagString aClass100_994 = parse(")3");
public static final JagString PERIOD = parse(")3");
@OriginalMember(owner = "client!vk", name = "a", descriptor = "[I")
public static final int[] anIntArray471 = new int[]{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 73, 74, 76, 78, 83, 84, 85, 86, 91, 92, 93, 94, 95, 97, 103, 104, 105, 106, 107, 108, 113, 114, 115, 116, 118, 119, 120, 121, 122, 123, 124, 125, 133, 134, 136, 138, 143, 144, 145, 146, 151, 152, 153, 154, 155, 157, 163, 164, 165, 166, 168, 169, 174, 175, 176, 177, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 97, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 157, 215, 216, 117, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 66, 66, 66, 66, 66, 66, 65, 75, 79, 79, 79, 79, 87, 87, 87, 87, 77, 96, 98, 98, 98, 98, 98, 250, 251, 109, 109, 109, 109, 117, 252, 167, 126, 126, 126, 126, 126, 126, 125, 135, 139, 139, 139, 139, 147, 147, 147, 147, 137, 156, 158, 158, 158, 158, 158, 253, 254, 170, 170, 170, 170, 178, 255, 178};
@OriginalMember(owner = "client!sh", name = "e", descriptor = "Lclient!na;")
public static final JagString aClass100_967 = parse("");
@OriginalMember(owner = "client!dm", name = "n", descriptor = "Lclient!na;")
public static final JagString PERCENT_SIGN = parse("(U");
@OriginalMember(owner = "client!wa", name = "pb", descriptor = "Lclient!na;")
public static final JagString aClass100_556 = parse("<br>");
@OriginalMember(owner = "client!ed", name = "H", descriptor = "Lclient!na;")
public static final JagString aClass100_375 = parse("<)4col> x");
@OriginalMember(owner = "client!je", name = "db", descriptor = "Lclient!na;")
public static final JagString aClass100_589 = parse(" <col=ffffff>");
@OriginalMember(owner = "client!uf", name = "s", descriptor = "Lclient!na;")
public static final JagString aClass100_1043 = parse(" <col=00ff80>");
@OriginalMember(owner = "client!wj", name = "b", descriptor = "Lclient!na;")
public static final JagString aClass100_1101 = parse(" <col=ffff00>");
@OriginalMember(owner = "client!mi", name = "R", descriptor = "Lclient!na;")
public static final JagString aClass100_760 = parse(")1");
@OriginalMember(owner = "client!sj", name = "w", descriptor = "Lclient!na;")
public static final JagString aClass100_978 = parse("<)4col>");
@OriginalMember(owner = "client!jb", name = "c", descriptor = "Lclient!na;")
public static final JagString aClass100_583 = parse("(Y<)4col>");
@OriginalMember(owner = "client!fn", name = "Z", descriptor = "Lclient!na;")
public static final JagString aClass100_461 = parse(")1 ");
@OriginalMember(owner = "client!wb", name = "a", descriptor = "Lclient!na;")
public static final JagString aClass100_1089 = parse(")2");
@OriginalMember(owner = "client!dm", name = "j", descriptor = "Lclient!na;")
public static final JagString SPACE = parse(" ");
@OriginalMember(owner = "client!vh", name = "c", descriptor = "Lclient!na;")
public static final JagString COLON = parse(":");
@OriginalMember(owner = "client!ee", name = "a", descriptor = "Lclient!na;")
public static final JagString TIMEZONE = parse(" GMT");
@OriginalMember(owner = "client!li", name = "w", descriptor = "Lclient!sc;")
public static HashTable aClass133_13;
@OriginalMember(owner = "client!na", name = "T", descriptor = "[B")
@ -203,7 +229,7 @@ public final class JagString implements StringInterface {
@OriginalMember(owner = "client!oi", name = "a", descriptor = "(II)Lclient!na;")
public static JagString formatIp(@OriginalArg(0) int arg0) {
return concatenate(new JagString[]{parseInt(arg0 >> 24 & 0xFF), aClass100_994, parseInt(arg0 >> 16 & 0xFF), aClass100_994, parseInt(arg0 >> 8 & 0xFF), aClass100_994, parseInt(arg0 & 0xFF)});
return concatenate(new JagString[]{parseInt(arg0 >> 24 & 0xFF), PERIOD, parseInt(arg0 >> 16 & 0xFF), PERIOD, parseInt(arg0 >> 8 & 0xFF), PERIOD, parseInt(arg0 & 0xFF)});
}
@OriginalMember(owner = "client!nb", name = "a", descriptor = "(II)Lclient!na;")
@ -215,18 +241,21 @@ public final class JagString implements StringInterface {
return str;
}
/**
* @return A JagString consisting of the actual bytes in the provided string.
*/
@OriginalMember(owner = "client!sj", name = "a", descriptor = "(Ljava/lang/String;I)Lclient!na;")
public static JagString method3952(@OriginalArg(0) String arg0) {
@Pc(14) byte[] local14 = arg0.getBytes(StandardCharsets.ISO_8859_1);
@Pc(23) JagString local23 = new JagString();
local23.chars = local14;
local23.length = 0;
for (@Pc(31) int local31 = 0; local31 < local14.length; local31++) {
if (local14[local31] != 0) {
local14[local23.length++] = local14[local31];
public static JagString of(@OriginalArg(0) String string) {
@Pc(14) byte[] bytes = string.getBytes(StandardCharsets.ISO_8859_1);
@Pc(23) JagString js = new JagString();
js.chars = bytes;
js.length = 0;
for (@Pc(31) int i = 0; i < bytes.length; i++) {
if (bytes[i] != 0) {
bytes[js.length++] = bytes[i];
}
}
return local23;
return js;
}
@OriginalMember(owner = "client!gn", name = "a", descriptor = "(BI)Lclient!na;")
@ -983,7 +1012,7 @@ public final class JagString implements StringInterface {
public final JagString fromParameters(@OriginalArg(1) Applet arg0) {
@Pc(19) String local19 = new String(this.chars, 0, this.length);
@Pc(23) String local23 = arg0.getParameter(local19);
return local23 == null ? null : method3952(local23);
return local23 == null ? null : of(local23);
}
@OriginalMember(owner = "client!na", name = "d", descriptor = "(Z)I")

View file

@ -15,7 +15,8 @@ import static rt4.MathUtils.clamp;
public final class JavaMouseWheel extends MouseWheel implements MouseWheelListener {
@OriginalMember(owner = "client!o", name = "g", descriptor = "I")
private int anInt4233 = 0;
public int currentRotation = 0;
public int previousRotation = 0;
@OriginalMember(owner = "client!o", name = "a", descriptor = "(ZLjava/awt/Component;)V")
@Override
@ -26,21 +27,16 @@ public final class JavaMouseWheel extends MouseWheel implements MouseWheelListen
@OriginalMember(owner = "client!o", name = "a", descriptor = "(I)I")
@Override
public final synchronized int getRotation() {
@Pc(2) int local2 = this.anInt4233;
this.anInt4233 = 0;
@Pc(2) int local2 = this.currentRotation;
this.currentRotation = 0;
return local2;
}
@OriginalMember(owner = "client!o", name = "mouseWheelMoved", descriptor = "(Ljava/awt/event/MouseWheelEvent;)V")
@Override
public final synchronized void mouseWheelMoved(@OriginalArg(0) MouseWheelEvent arg0) {
int previous = this.anInt4233;
this.anInt4233 += arg0.getWheelRotation();
int diff = this.anInt4233 - previous;
if (((GlobalJsonConfig.instance != null && GlobalJsonConfig.instance.mouseWheelZoom) || (GlobalJsonConfig.instance == null && GlobalConfig.MOUSEWHEEL_ZOOM)) && Keyboard.pressedKeys[Keyboard.KEY_SHIFT]) {
Camera.ZOOM = clamp(200, 1200, Camera.ZOOM + (diff >= 0 ? 50 : -50));
}
this.previousRotation = this.currentRotation;
this.currentRotation += arg0.getWheelRotation();
}
@OriginalMember(owner = "client!o", name = "a", descriptor = "(Ljava/awt/Component;I)V")

View file

@ -3,6 +3,7 @@ package rt4;
import org.openrs2.deob.annotation.OriginalArg;
import org.openrs2.deob.annotation.OriginalMember;
import org.openrs2.deob.annotation.Pc;
import plugin.PluginRepository;
import java.io.IOException;
import java.net.Socket;
@ -690,6 +691,7 @@ public class LoginManager {
Protocol.verifyId = 0;
VarpDomain.reset();
InterfaceList.method1596(true);
PluginRepository.OnLogout();
}
@OriginalMember(owner = "client!k", name = "a", descriptor = "(IIIIZIZ)V")
@ -1446,9 +1448,9 @@ public class LoginManager {
MiniMenu.sort();
if (Cs1ScriptRunner.aBoolean108) {
if (InterfaceList.aBoolean298) {
method2297();
MiniMenu.drawB();
} else {
method2744();
MiniMenu.drawA();
}
} else if (aClass13_13 != null) {
MiniMenu.method1207(aClass13_13, Cs1ScriptRunner.anInt3484, Cs1ScriptRunner.anInt3260);
@ -1492,140 +1494,6 @@ public class LoginManager {
return Cheat.shiftClick && Keyboard.pressedKeys[Keyboard.KEY_SHIFT] && MiniMenu.size > 2 ? MiniMenu.cursors[MiniMenu.size - 2] : MiniMenu.cursors[MiniMenu.size - 1];
}
@OriginalMember(owner = "client!ij", name = "a", descriptor = "(B)V")
public static void method2297() {
@Pc(3) int local3 = InterfaceList.anInt4271;
@Pc(9) int local9 = InterfaceList.anInt5138;
@Pc(11) int local11 = InterfaceList.anInt436;
@Pc(13) int local13 = InterfaceList.anInt761;
if (aClass3_Sub2_Sub1_1 == null || aClass3_Sub2_Sub1_9 == null) {
if (client.js5Archive8.isFileReady(anInt1736) && client.js5Archive8.isFileReady(anInt4073)) {
aClass3_Sub2_Sub1_1 = SoftwareSprite.loadSoftwareAlphaSprite(client.js5Archive8, anInt1736);
aClass3_Sub2_Sub1_9 = SoftwareSprite.loadSoftwareAlphaSprite(client.js5Archive8, anInt4073);
if (GlRenderer.enabled) {
if (aClass3_Sub2_Sub1_1 instanceof SoftwareAlphaSprite) {
aClass3_Sub2_Sub1_1 = new GlAlphaSprite((SoftwareSprite) aClass3_Sub2_Sub1_1);
} else {
aClass3_Sub2_Sub1_1 = new GlSprite((SoftwareSprite) aClass3_Sub2_Sub1_1);
}
if (aClass3_Sub2_Sub1_9 instanceof SoftwareAlphaSprite) {
aClass3_Sub2_Sub1_9 = new GlAlphaSprite((SoftwareSprite) aClass3_Sub2_Sub1_9);
} else {
aClass3_Sub2_Sub1_9 = new GlSprite((SoftwareSprite) aClass3_Sub2_Sub1_9);
}
}
} else if (GlRenderer.enabled) {
GlRaster.fillRectAlpha(local3, local9, local13, 20, anInt1275, 256 - anInt2910);
} else {
SoftwareRaster.fillRectAlpha(local3, local9, local13, 20, anInt1275, 256 - anInt2910);
}
}
@Pc(112) int local112;
@Pc(114) int local114;
if (aClass3_Sub2_Sub1_1 != null && aClass3_Sub2_Sub1_9 != null) {
local112 = local13 / aClass3_Sub2_Sub1_1.width;
for (local114 = 0; local114 < local112; local114++) {
aClass3_Sub2_Sub1_1.render(local114 * aClass3_Sub2_Sub1_1.width + local3, local9);
}
aClass3_Sub2_Sub1_9.render(local3, local9);
aClass3_Sub2_Sub1_9.renderHorizontalFlip(local3 + local13 - aClass3_Sub2_Sub1_9.width, local9);
}
Fonts.b12Full.renderLeft(LocalizedText.CHOOSE_OPTION, local3 + 3, local9 + 14, anInt4581, -1);
if (GlRenderer.enabled) {
GlRaster.fillRectAlpha(local3, local9 + 20, local13, local11 - 20, anInt1275, 256 - anInt2910);
} else {
SoftwareRaster.fillRectAlpha(local3, local9 + 20, local13, local11 - 20, anInt1275, 256 - anInt2910);
}
local114 = Mouse.lastMouseY;
local112 = Mouse.lastMouseX;
@Pc(203) int local203;
@Pc(219) int local219;
for (local203 = 0; local203 < MiniMenu.size; local203++) {
local219 = (MiniMenu.size - local203 - 1) * 15 + local9 + 35;
if (local3 < local112 && local112 < local3 + local13 && local114 > local219 - 13 && local114 < local219 + 3) {
if (GlRenderer.enabled) {
GlRaster.fillRectAlpha(local3, local219 - 13, local13, 16, anInt5457, 256 - anInt5208);
} else {
SoftwareRaster.fillRectAlpha(local3, local219 - 13, local13, 16, anInt5457, 256 - anInt5208);
}
}
}
if ((aClass3_Sub2_Sub1_8 == null || aClass3_Sub2_Sub1_6 == null || aClass3_Sub2_Sub1_10 == null) && client.js5Archive8.isFileReady(anInt2261) && client.js5Archive8.isFileReady(anInt3324) && client.js5Archive8.isFileReady(anInt5556)) {
aClass3_Sub2_Sub1_8 = SoftwareSprite.loadSoftwareAlphaSprite(client.js5Archive8, anInt2261);
aClass3_Sub2_Sub1_6 = SoftwareSprite.loadSoftwareAlphaSprite(client.js5Archive8, anInt3324);
aClass3_Sub2_Sub1_10 = SoftwareSprite.loadSoftwareAlphaSprite(client.js5Archive8, anInt5556);
if (GlRenderer.enabled) {
if (aClass3_Sub2_Sub1_8 instanceof SoftwareAlphaSprite) {
aClass3_Sub2_Sub1_8 = new GlAlphaSprite((SoftwareSprite) aClass3_Sub2_Sub1_8);
} else {
aClass3_Sub2_Sub1_8 = new GlSprite((SoftwareSprite) aClass3_Sub2_Sub1_8);
}
if (aClass3_Sub2_Sub1_6 instanceof SoftwareAlphaSprite) {
aClass3_Sub2_Sub1_6 = new GlAlphaSprite((SoftwareSprite) aClass3_Sub2_Sub1_6);
} else {
aClass3_Sub2_Sub1_6 = new GlSprite((SoftwareSprite) aClass3_Sub2_Sub1_6);
}
if (aClass3_Sub2_Sub1_10 instanceof SoftwareAlphaSprite) {
aClass3_Sub2_Sub1_10 = new GlAlphaSprite((SoftwareSprite) aClass3_Sub2_Sub1_10);
} else {
aClass3_Sub2_Sub1_10 = new GlSprite((SoftwareSprite) aClass3_Sub2_Sub1_10);
}
}
}
@Pc(418) int local418;
if (aClass3_Sub2_Sub1_8 != null && aClass3_Sub2_Sub1_6 != null && aClass3_Sub2_Sub1_10 != null) {
local203 = local13 / aClass3_Sub2_Sub1_8.width;
for (local219 = 0; local219 < local203; local219++) {
aClass3_Sub2_Sub1_8.render(local3 + aClass3_Sub2_Sub1_8.width * local219, local11 + local9 + -aClass3_Sub2_Sub1_8.height);
}
local219 = (local11 - 20) / aClass3_Sub2_Sub1_6.height;
for (local418 = 0; local418 < local219; local418++) {
aClass3_Sub2_Sub1_6.render(local3, local9 + local418 * aClass3_Sub2_Sub1_6.height + 20);
aClass3_Sub2_Sub1_6.renderHorizontalFlip(local3 + local13 - aClass3_Sub2_Sub1_6.width, local9 + 20 + local418 * aClass3_Sub2_Sub1_6.height);
}
aClass3_Sub2_Sub1_10.render(local3, local11 + local9 - aClass3_Sub2_Sub1_10.height);
aClass3_Sub2_Sub1_10.renderHorizontalFlip(local3 + local13 - aClass3_Sub2_Sub1_10.width, local9 - -local11 + -aClass3_Sub2_Sub1_10.height);
}
for (local203 = 0; local203 < MiniMenu.size; local203++) {
local219 = (MiniMenu.size - local203 - 1) * 15 + local9 + 35;
local418 = anInt4581;
if (local3 < local112 && local13 + local3 > local112 && local219 - 13 < local114 && local114 < local219 + 3) {
local418 = anInt5752;
}
Fonts.b12Full.renderLeft(MiniMenu.getOp(local203), local3 + 3, local219, local418, 0);
}
InterfaceList.forceRedrawScreen(InterfaceList.anInt4271, InterfaceList.anInt5138, InterfaceList.anInt436, InterfaceList.anInt761);
}
@OriginalMember(owner = "client!lf", name = "b", descriptor = "(I)V")
public static void method2744() {
@Pc(3) int local3 = InterfaceList.anInt5138;
@Pc(9) int local9 = InterfaceList.anInt761;
@Pc(11) int local11 = InterfaceList.anInt4271;
@Pc(15) int local15 = InterfaceList.anInt436;
if (GlRenderer.enabled) {
GlRaster.fillRect(local11, local3, local9, local15, 6116423);
GlRaster.fillRect(local11 + 1, local3 + 1, local9 - 2, 16, 0);
GlRaster.drawRect(local11 + 1, local3 + 18, local9 - 2, local15 + -19, 0);
} else {
SoftwareRaster.fillRect(local11, local3, local9, local15, 6116423);
SoftwareRaster.fillRect(local11 + 1, local3 + 1, local9 - 2, 16, 0);
SoftwareRaster.drawRect(local11 + 1, local3 + 18, local9 - 2, local15 + -19, 0);
}
Fonts.b12Full.renderLeft(LocalizedText.CHOOSE_OPTION, local11 + 3, local3 + 14, 6116423, -1);
@Pc(96) int local96 = Mouse.lastMouseY;
@Pc(98) int local98 = Mouse.lastMouseX;
for (@Pc(107) int local107 = 0; local107 < MiniMenu.size; local107++) {
@Pc(127) int local127 = (MiniMenu.size - local107 - 1) * 15 + local3 + 31;
@Pc(129) int local129 = 16777215;
if (local11 < local98 && local98 < local11 + local9 && local127 - 13 < local96 && local96 < local127 + 3) {
local129 = 16776960;
}
Fonts.b12Full.renderLeft(MiniMenu.getOp(local107), local11 + 3, local127, local129, 0);
}
InterfaceList.forceRedrawScreen(InterfaceList.anInt4271, InterfaceList.anInt5138, InterfaceList.anInt436, InterfaceList.anInt761);
}
@OriginalMember(owner = "client!gn", name = "a", descriptor = "(ZI)V")
public static void method1805(@OriginalArg(0) boolean arg0) {
@Pc(7) byte local7;

View file

@ -3,6 +3,8 @@ package rt4;
import org.openrs2.deob.annotation.OriginalArg;
import org.openrs2.deob.annotation.OriginalMember;
import org.openrs2.deob.annotation.Pc;
import plugin.PluginRepository;
import plugin.api.MiniMenuEntry;
public class MiniMenu {
@OriginalMember(owner = "client!df", name = "l", descriptor = "Lclient!na;")
@ -138,6 +140,79 @@ public class MiniMenu {
@OriginalMember(owner = "client!ml", name = "Q", descriptor = "I")
public static int anInt3953 = 0;
/***********************
* Action Constants *
***********************/
/* Tiles */
public static final int WALK_HERE = 60;
/* NPCs */
public static final int NPC_ACTION_1 = 17;
public static final int NPC_ACTION_2 = 16;
public static final int NPC_ACTION_3 = 4;
public static final int NPC_ACTION_4 = 19;
public static final int NPC_ACTION_5 = 2;
public static final int NPC_EXAMINE = 1007;
/* Players */
public static final int PLAYER_ACTION_1 = 30;
public static final int PLAYER_ACTION_BLOCK = 34;
public static final int PLAYER_ACTION_TRADE = 29;
public static final int PLAYER_REQ_ASSIST_ACTION = 37;
public static final int PLAYER_FOLLOW_ACTION = 31;
public static final int PLAYER_ACTION_5 = 57;
/* Objects */
public static final int OBJ_ACTION_1 = 47;
public static final int OBJ_EQUIP_ACTION = 5;
public static final int OBJ_ACTION_4 = 35;
public static final int OBJ_OPERATE_ACTION = 23;
public static final int OBJ_ACTION_5 = 58;
public static final int OBJ_EXAMINE = 1002;
public static final int OBJ_PLAYER_ACTION = 1;
public static final int OBJ_OBJSTACK_ACTION = 33;
public static final int OBJ_NPC_ACTION = 26;
public static final int OBJ_LOC_ACTION = 14;
public static final int OBJ_OBJ_ACTION = 40;
/* Object Stacks */
public static final int OBJSTACK_ACTION_1 = 18;
public static final int OBJSTACK_ACTION_2 = 20;
/* Locations */
public static final int LOC_ACTION_1 = 42;
public static final int LOC_ACTION_2 = 50;
public static final int LOC_ACTION_3 = 49;
public static final int LOC_ACTION_4 = 46;
public static final int LOC_ACTION_5 = 1001;
public static final int LOC_ACTION_EXAMINE = 1004;
/* Components */
public static final int COMPONENT_ACTION_CLOSE = 28;
public static final int COMPONENT_OBJSTACK_ACTION = 39;
public static final int OBJ_IN_COMPONENT_ACTION_4 = 43;
public static final int COMPONENT_LOC_ACTION = 38;
public static final int LOGOUT_ACTION_2 = 59;
public static final int LOGOUT_ACTION = 51;
public static final int OBJ_IN_COMPONENT_ACTION_1 = 25;
public static final int COMPONENT_PLAYER_ACTION = 15;
public static final int COMPONENT_OBJ_ACTION = 3;
public static final int COMPONENT_NPC_ACTION = 45;
public static final int OBJ_EXAMINE_IN_COMPONENT = 1006;
/* Unknown/Unidentified */
public static final int UNKNOWN_13 = 13;
public static final int UNKNOWN_22 = 22;
public static final int UNKNOWN_48 = 48;
public static final int UNKNOWN_12 = 12;
public static final int UNKNOWN_36 = 36;
public static final int UNKNOWN_6 = 6;
public static final int UNKNOWN_24 = 24;
public static final int UNKNOWN_7 = 7;
public static final int UNKNOWN_8 = 8;
public static final int UNKNOWN_11 = 11;
public static final int UNKNOWN_32 = 32;
public static final int UNKNOWN_21 = 21;
public static final int UNKNOWN_9 = 9;
public static final int UNKNOWN_1003 = 1003;
public static final int UNKNOWN_41 = 41;
public static final int UNKNOWN_10 = 10;
public static final int UNKNOWN_44 = 44;
@OriginalMember(owner = "client!va", name = "a", descriptor = "(IZILclient!be;)V")
public static void addComponentEntries(@OriginalArg(0) int arg0, @OriginalArg(2) int arg1, @OriginalArg(3) Component component) {
if (component.buttonType == 1) {
@ -292,17 +367,18 @@ public class MiniMenu {
}
@OriginalMember(owner = "client!hj", name = "a", descriptor = "(IJBLclient!na;ISLclient!na;I)V")
public static void add(@OriginalArg(0) int cursor, @OriginalArg(1) long arg1, @OriginalArg(3) JagString arg2, @OriginalArg(4) int arg3, @OriginalArg(5) short arg4, @OriginalArg(6) JagString arg5, @OriginalArg(7) int arg6) {
public static void add(@OriginalArg(0) int cursor, @OriginalArg(1) long arg1, @OriginalArg(3) JagString opName, @OriginalArg(4) int arg3, @OriginalArg(5) short arg4, @OriginalArg(6) JagString arg5, @OriginalArg(7) int arg6) {
if (Cs1ScriptRunner.aBoolean108 || size >= 500) {
return;
}
ops[size] = arg5;
opBases[size] = arg2;
opBases[size] = opName;
cursors[size] = cursor == -1 ? anInt1092 : cursor;
actions[size] = arg4;
keys[size] = arg1;
intArgs1[size] = arg3;
intArgs2[size] = arg6;
PluginRepository.DrawMiniMenu(new MiniMenuEntry(size));
size++;
}
@ -367,14 +443,14 @@ public class MiniMenu {
}
@Pc(15) int local15 = intArgs1[arg0];
@Pc(19) int local19 = intArgs2[arg0];
@Pc(23) int local23 = actions[arg0];
if (local23 >= 2000) {
local23 -= 2000;
@Pc(23) int actionCode = actions[arg0];
if (actionCode >= 2000) {
actionCode -= 2000;
}
@Pc(31) long local31 = keys[arg0];
@Pc(36) int local36 = (int) keys[arg0];
@Pc(43) Player local43;
if (local23 == 31) {
if (actionCode == PLAYER_FOLLOW_ACTION) {
local43 = PlayerList.players[local36];
if (local43 != null) {
PathFinder.findPath(PlayerList.self.movementQueueZ[0], 0, 1, false, 0, local43.movementQueueX[0], 1, 0, 2, local43.movementQueueZ[0], PlayerList.self.movementQueueX[0]);
@ -386,14 +462,14 @@ public class MiniMenu {
Protocol.outboundBuffer.ip2add(local36);
}
}
if (local23 == 46) {
if (actionCode == LOC_ACTION_4) {
PathFinder.findPathToLoc(local31, local19, local15);
Protocol.outboundBuffer.p1isaac(247);
Protocol.outboundBuffer.ip2(Camera.originZ + local19);
Protocol.outboundBuffer.ip2add(local15 + Camera.originX);
Protocol.outboundBuffer.p2(Integer.MAX_VALUE & (int) (local31 >>> 32));
}
if (local23 == 40) {
if (actionCode == OBJ_OBJ_ACTION) {
Protocol.outboundBuffer.p1isaac(27);
Protocol.outboundBuffer.p2(anInt4370);
Protocol.outboundBuffer.ip4(local19);
@ -406,7 +482,7 @@ public class MiniMenu {
anInt5444 = local15;
}
@Pc(192) Npc local192;
if (local23 == 19) {
if (actionCode == NPC_ACTION_4) {
local192 = NpcList.npcs[local36];
if (local192 != null) {
PathFinder.findPath(PlayerList.self.movementQueueZ[0], 0, 1, false, 0, local192.movementQueueX[0], 1, 0, 2, local192.movementQueueZ[0], PlayerList.self.movementQueueX[0]);
@ -418,7 +494,7 @@ public class MiniMenu {
Protocol.outboundBuffer.p2(local36);
}
}
if (local23 == 17) {
if (actionCode == NPC_ACTION_1) {
local192 = NpcList.npcs[local36];
if (local192 != null) {
PathFinder.findPath(PlayerList.self.movementQueueZ[0], 0, 1, false, 0, local192.movementQueueX[0], 1, 0, 2, local192.movementQueueZ[0], PlayerList.self.movementQueueX[0]);
@ -430,7 +506,7 @@ public class MiniMenu {
Protocol.outboundBuffer.ip2(local36);
}
}
if (local23 == 44) {
if (actionCode == UNKNOWN_44) {
local43 = PlayerList.players[local36];
if (local43 != null) {
PathFinder.findPath(PlayerList.self.movementQueueZ[0], 0, 1, false, 0, local43.movementQueueX[0], 1, 0, 2, local43.movementQueueZ[0], PlayerList.self.movementQueueX[0]);
@ -442,7 +518,7 @@ public class MiniMenu {
Protocol.outboundBuffer.ip2(local36);
}
}
if (local23 == 58) {
if (actionCode == OBJ_ACTION_5) {
Protocol.outboundBuffer.p1isaac(135);
Protocol.outboundBuffer.p2add(local36);
Protocol.outboundBuffer.p2add(local15);
@ -451,17 +527,17 @@ public class MiniMenu {
pressedInventoryComponent = InterfaceList.getComponent(local19);
anInt5444 = local15;
}
if (local23 == 42) {
if (actionCode == LOC_ACTION_1) {
PathFinder.findPathToLoc(local31, local19, local15);
Protocol.outboundBuffer.p1isaac(254);
Protocol.outboundBuffer.ip2(local15 + Camera.originX);
Protocol.outboundBuffer.p2add((int) (local31 >>> 32) & Integer.MAX_VALUE);
Protocol.outboundBuffer.p2(local19 + Camera.originZ);
}
if (local23 == 28) {
if (actionCode == COMPONENT_ACTION_CLOSE) {
ClientProt.closeWidget();
}
if (local23 == 45) {
if (actionCode == COMPONENT_NPC_ACTION) {
local192 = NpcList.npcs[local36];
if (local192 != null) {
PathFinder.findPath(PlayerList.self.movementQueueZ[0], 0, 1, false, 0, local192.movementQueueX[0], 1, 0, 2, local192.movementQueueZ[0], PlayerList.self.movementQueueX[0]);
@ -476,7 +552,7 @@ public class MiniMenu {
}
}
@Pc(560) boolean local560;
if (local23 == 18) {
if (actionCode == OBJSTACK_ACTION_1) {
if (client.game == 1) {
PathFinder.findPath(PlayerList.self.movementQueueZ[0], 0, 1, false, 0, local15, 1, 0, 2, local19, PlayerList.self.movementQueueX[0]);
} else {
@ -494,14 +570,14 @@ public class MiniMenu {
Protocol.outboundBuffer.p2(local36);
Protocol.outboundBuffer.ip2add(local19 + Camera.originZ);
}
if (local23 == 1001) {
if (actionCode == LOC_ACTION_5) {
PathFinder.findPathToLoc(local31, local19, local15);
Protocol.outboundBuffer.p1isaac(170);
Protocol.outboundBuffer.ip2add(Integer.MAX_VALUE & (int) (local31 >>> 32));
Protocol.outboundBuffer.ip2add(local15 + Camera.originX);
Protocol.outboundBuffer.ip2add(local19 + Camera.originZ);
}
if (local23 == 1002) {
if (actionCode == OBJ_EXAMINE) {
Cross.type = 2;
Cross.x = Mouse.clickX;
Cross.y = Mouse.clickY;
@ -510,7 +586,7 @@ public class MiniMenu {
Protocol.outboundBuffer.ip2add(local36);
}
@Pc(693) Component local693;
if (local23 == 1006) {
if (actionCode == OBJ_EXAMINE_IN_COMPONENT) {
local693 = InterfaceList.getComponent(local19);
if (local693 == null || local693.objCounts[local15] < 100000) {
Protocol.outboundBuffer.p1isaac(92);
@ -522,7 +598,7 @@ public class MiniMenu {
pressedInventoryComponent = InterfaceList.getComponent(local19);
anInt5444 = local15;
}
if (local23 == 60) {
if (actionCode == WALK_HERE) {
if (local36 == 0) {
method3556(Player.plane, local15, local19);
} else if (local36 == 1) {
@ -543,7 +619,7 @@ public class MiniMenu {
}
}
}
if (local23 == 1007) {
if (actionCode == NPC_EXAMINE) {
Cross.milliseconds = 0;
Cross.type = 2;
Cross.y = Mouse.clickY;
@ -560,7 +636,7 @@ public class MiniMenu {
}
}
}
if (local23 == 47) {
if (actionCode == OBJ_ACTION_1) {
Protocol.outboundBuffer.p1isaac(156);
Protocol.outboundBuffer.ip2add(local15);
Protocol.outboundBuffer.p2add(local36);
@ -569,7 +645,7 @@ public class MiniMenu {
pressedInventoryComponent = InterfaceList.getComponent(local19);
anInt5444 = local15;
}
if (local23 == 3) {
if (actionCode == COMPONENT_OBJ_ACTION) {
Protocol.outboundBuffer.p1isaac(253);
Protocol.outboundBuffer.ip4(anInt2512);
Protocol.outboundBuffer.ip2add(local15);
@ -580,7 +656,7 @@ public class MiniMenu {
pressedInventoryComponent = InterfaceList.getComponent(local19);
anInt5444 = local15;
}
if (local23 == 10) {
if (actionCode == UNKNOWN_10) {
local43 = PlayerList.players[local36];
if (local43 != null) {
PathFinder.findPath(PlayerList.self.movementQueueZ[0], 0, 1, false, 0, local43.movementQueueX[0], 1, 0, 2, local43.movementQueueZ[0], PlayerList.self.movementQueueX[0]);
@ -592,19 +668,19 @@ public class MiniMenu {
Protocol.outboundBuffer.ip2(local36);
}
}
if (local23 == 41 && Cs1ScriptRunner.aClass13_10 == null) {
if (actionCode == UNKNOWN_41 && Cs1ScriptRunner.aClass13_10 == null) {
method10(local15, local19);
Cs1ScriptRunner.aClass13_10 = InterfaceList.method1418(local19, local15);
InterfaceList.redraw(Cs1ScriptRunner.aClass13_10);
}
if (local23 == 49) {
if (actionCode == LOC_ACTION_3) {
PathFinder.findPathToLoc(local31, local19, local15);
Protocol.outboundBuffer.p1isaac(84);
Protocol.outboundBuffer.ip2add(Integer.MAX_VALUE & (int) (local31 >>> 32));
Protocol.outboundBuffer.ip2add(Camera.originZ + local19);
Protocol.outboundBuffer.ip2(local15 + Camera.originX);
}
if (local23 == 23) {
if (actionCode == OBJ_OPERATE_ACTION) {
Protocol.outboundBuffer.p1isaac(206);
Protocol.outboundBuffer.p2add(local36);
Protocol.outboundBuffer.ip2(local15);
@ -613,7 +689,7 @@ public class MiniMenu {
pressedInventoryComponent = InterfaceList.getComponent(local19);
anInt5444 = local15;
}
if (local23 == 14 && PathFinder.findPathToLoc(local31, local19, local15)) {
if (actionCode == OBJ_LOC_ACTION && PathFinder.findPathToLoc(local31, local19, local15)) {
Protocol.outboundBuffer.p1isaac(134);
Protocol.outboundBuffer.p2add(Camera.originX + local15);
Protocol.outboundBuffer.p2(anInt4997);
@ -622,7 +698,7 @@ public class MiniMenu {
Protocol.outboundBuffer.mp4(MiniMap.anInt5062);
Protocol.outboundBuffer.p2add((int) (local31 >>> 32) & Integer.MAX_VALUE);
}
if (local23 == 37) {
if (actionCode == PLAYER_REQ_ASSIST_ACTION) {
local43 = PlayerList.players[local36];
if (local43 != null) {
PathFinder.findPath(PlayerList.self.movementQueueZ[0], 0, 1, false, 0, local43.movementQueueX[0], 1, 0, 2, local43.movementQueueZ[0], PlayerList.self.movementQueueX[0]);
@ -634,10 +710,10 @@ public class MiniMenu {
Protocol.outboundBuffer.ip2add(local36);
}
}
if (local23 == 9 || local23 == 1003) {
if (actionCode == UNKNOWN_9 || actionCode == UNKNOWN_1003) {
ClientProt.method4512(opBases[arg0], local15, local36, local19);
}
if (local23 == 5) {
if (actionCode == OBJ_EQUIP_ACTION) {
Protocol.outboundBuffer.p1isaac(55);
Protocol.outboundBuffer.ip2(local36);
Protocol.outboundBuffer.p2add(local15);
@ -646,7 +722,7 @@ public class MiniMenu {
pressedInventoryComponent = InterfaceList.getComponent(local19);
anInt5444 = local15;
}
if (local23 == 21) {
if (actionCode == UNKNOWN_21) {
if (client.game == 1) {
PathFinder.findPath(PlayerList.self.movementQueueZ[0], 0, 1, false, 0, local15, 1, 0, 2, local19, PlayerList.self.movementQueueX[0]);
} else {
@ -664,7 +740,7 @@ public class MiniMenu {
Protocol.outboundBuffer.ip2(Camera.originX + local15);
Protocol.outboundBuffer.ip2add(Camera.originZ + local19);
}
if (local23 == 4) {
if (actionCode == NPC_ACTION_3) {
local192 = NpcList.npcs[local36];
if (local192 != null) {
PathFinder.findPath(PlayerList.self.movementQueueZ[0], 0, 1, false, 0, local192.movementQueueX[0], 1, 0, 2, local192.movementQueueZ[0], PlayerList.self.movementQueueX[0]);
@ -676,7 +752,7 @@ public class MiniMenu {
Protocol.outboundBuffer.p2add(local36);
}
}
if (local23 == 32) {
if (actionCode == UNKNOWN_32) {
local693 = InterfaceList.method1418(local19, local15);
if (local693 != null) {
method1294();
@ -695,7 +771,7 @@ public class MiniMenu {
}
return;
}
if (local23 == 29) {
if (actionCode == PLAYER_ACTION_TRADE) {
local43 = PlayerList.players[local36];
if (local43 != null) {
PathFinder.findPath(PlayerList.self.movementQueueZ[0], 0, 1, false, 0, local43.movementQueueX[0], 1, 0, 2, local43.movementQueueZ[0], PlayerList.self.movementQueueX[0]);
@ -707,7 +783,7 @@ public class MiniMenu {
Protocol.outboundBuffer.ip2add(local36);
}
}
if (local23 == 35) {
if (actionCode == OBJ_ACTION_4) {
Protocol.outboundBuffer.p1isaac(161);
Protocol.outboundBuffer.ip4(local19);
Protocol.outboundBuffer.ip2add(local36);
@ -716,7 +792,7 @@ public class MiniMenu {
pressedInventoryComponent = InterfaceList.getComponent(local19);
anInt5444 = local15;
}
if (local23 == 15) {
if (actionCode == COMPONENT_PLAYER_ACTION) {
local43 = PlayerList.players[local36];
if (local43 != null) {
PathFinder.findPath(PlayerList.self.movementQueueZ[0], 0, 1, false, 0, local43.movementQueueX[0], 1, 0, 2, local43.movementQueueZ[0], PlayerList.self.movementQueueX[0]);
@ -730,7 +806,7 @@ public class MiniMenu {
Protocol.outboundBuffer.ip2add(local36);
}
}
if (local23 == 34) {
if (actionCode == PLAYER_ACTION_BLOCK) {
if (client.game == 1) {
PathFinder.findPath(PlayerList.self.movementQueueZ[0], 0, 1, false, 0, local15, 1, 0, 2, local19, PlayerList.self.movementQueueX[0]);
} else {
@ -748,7 +824,7 @@ public class MiniMenu {
Protocol.outboundBuffer.p2(local15 + Camera.originX);
Protocol.outboundBuffer.ip2add(local36);
}
if (local23 == 25) {
if (actionCode == OBJ_IN_COMPONENT_ACTION_1) {
Protocol.outboundBuffer.p1isaac(81);
Protocol.outboundBuffer.p2add(local15);
Protocol.outboundBuffer.p2(local36);
@ -757,7 +833,7 @@ public class MiniMenu {
pressedInventoryComponent = InterfaceList.getComponent(local19);
anInt5444 = local15;
}
if (local23 == 2) {
if (actionCode == NPC_ACTION_5) {
local192 = NpcList.npcs[local36];
if (local192 != null) {
PathFinder.findPath(PlayerList.self.movementQueueZ[0], 0, 1, false, 0, local192.movementQueueX[0], 1, 0, 2, local192.movementQueueZ[0], PlayerList.self.movementQueueX[0]);
@ -770,7 +846,7 @@ public class MiniMenu {
}
}
@Pc(1955) int local1955;
if (local23 == 51) {
if (actionCode == LOGOUT_ACTION) {
Protocol.outboundBuffer.p1isaac(10);
Protocol.outboundBuffer.p4(local19);
local693 = InterfaceList.getComponent(local19);
@ -782,7 +858,7 @@ public class MiniMenu {
}
}
}
if (local23 == 26) {
if (actionCode == OBJ_NPC_ACTION) {
local192 = NpcList.npcs[local36];
if (local192 != null) {
PathFinder.findPath(PlayerList.self.movementQueueZ[0], 0, 1, false, 0, local192.movementQueueX[0], 1, 0, 2, local192.movementQueueZ[0], PlayerList.self.movementQueueX[0]);
@ -797,7 +873,7 @@ public class MiniMenu {
Protocol.outboundBuffer.ip2add(anInt4997);
}
}
if (local23 == 59) {
if (actionCode == LOGOUT_ACTION_2) {
Protocol.outboundBuffer.p1isaac(10);
Protocol.outboundBuffer.p4(local19);
local693 = InterfaceList.getComponent(local19);
@ -807,7 +883,7 @@ public class MiniMenu {
VarpDomain.refreshMagicVarp(local1955);
}
}
if (local23 == 33) {
if (actionCode == OBJ_OBJSTACK_ACTION) {
local560 = PathFinder.findPath(PlayerList.self.movementQueueZ[0], 0, 0, false, 0, local15, 0, 0, 2, local19, PlayerList.self.movementQueueX[0]);
if (!local560) {
PathFinder.findPath(PlayerList.self.movementQueueZ[0], 0, 1, false, 0, local15, 1, 0, 2, local19, PlayerList.self.movementQueueX[0]);
@ -824,7 +900,7 @@ public class MiniMenu {
Protocol.outboundBuffer.ip2add(Camera.originZ + local19);
Protocol.outboundBuffer.mp4(MiniMap.anInt5062);
}
if (local23 == 1004) {
if (actionCode == LOC_ACTION_EXAMINE) {
Cross.milliseconds = 0;
Cross.x = Mouse.clickX;
Cross.type = 2;
@ -832,7 +908,7 @@ public class MiniMenu {
Protocol.outboundBuffer.p1isaac(94);
Protocol.outboundBuffer.ip2add(local36);
}
if (local23 == 11) {
if (actionCode == UNKNOWN_11) {
if (local36 == 0) {
anInt3096 = 1;
method3556(Player.plane, local15, local19);
@ -844,7 +920,7 @@ public class MiniMenu {
Protocol.outboundBuffer.p2add(local19 + Camera.originZ);
}
}
if (local23 == 8) {
if (actionCode == UNKNOWN_8) {
local693 = InterfaceList.getComponent(local19);
@Pc(2287) boolean local2287 = true;
if (local693.clientCode > 0) {
@ -855,7 +931,7 @@ public class MiniMenu {
Protocol.outboundBuffer.p4(local19);
}
}
if (local23 == 1) {
if (actionCode == OBJ_PLAYER_ACTION) {
local43 = PlayerList.players[local36];
if (local43 != null) {
PathFinder.findPath(PlayerList.self.movementQueueZ[0], 0, 1, false, 0, local43.movementQueueX[0], 1, 0, 2, local43.movementQueueZ[0], PlayerList.self.movementQueueX[0]);
@ -870,7 +946,7 @@ public class MiniMenu {
Protocol.outboundBuffer.mp4(MiniMap.anInt5062);
}
}
if (local23 == 7) {
if (actionCode == UNKNOWN_7) {
Protocol.outboundBuffer.p1isaac(85);
Protocol.outboundBuffer.imp4(local19);
Protocol.outboundBuffer.p2(local15);
@ -879,7 +955,7 @@ public class MiniMenu {
pressedInventoryComponent = InterfaceList.getComponent(local19);
anInt5444 = local15;
}
if (local23 == 24) {
if (actionCode == UNKNOWN_24) {
if (client.game == 1) {
PathFinder.findPath(PlayerList.self.movementQueueZ[0], 0, 1, false, 0, local15, 1, 0, 2, local19, PlayerList.self.movementQueueX[0]);
} else {
@ -897,7 +973,7 @@ public class MiniMenu {
Protocol.outboundBuffer.ip2add(local36);
Protocol.outboundBuffer.ip2(Camera.originZ + local19);
}
if (local23 == 38 && PathFinder.findPathToLoc(local31, local19, local15)) {
if (actionCode == COMPONENT_LOC_ACTION && PathFinder.findPathToLoc(local31, local19, local15)) {
Protocol.outboundBuffer.p1isaac(233);
Protocol.outboundBuffer.ip2add(local19 + Camera.originZ);
Protocol.outboundBuffer.p2add(Camera.originX + local15);
@ -905,7 +981,7 @@ public class MiniMenu {
Protocol.outboundBuffer.imp4(anInt2512);
Protocol.outboundBuffer.p2add((int) (local31 >>> 32) & Integer.MAX_VALUE);
}
if (local23 == 13) {
if (actionCode == UNKNOWN_13) {
Protocol.outboundBuffer.p1isaac(6);
Protocol.outboundBuffer.p4(local19);
Protocol.outboundBuffer.p2add(local15);
@ -914,7 +990,7 @@ public class MiniMenu {
pressedInventoryComponent = InterfaceList.getComponent(local19);
anInt5444 = local15;
}
if (local23 == 57) {
if (actionCode == PLAYER_ACTION_5) {
local43 = PlayerList.players[local36];
if (local43 != null) {
PathFinder.findPath(PlayerList.self.movementQueueZ[0], 0, 1, false, 0, local43.movementQueueX[0], 1, 0, 2, local43.movementQueueZ[0], PlayerList.self.movementQueueX[0]);
@ -926,7 +1002,7 @@ public class MiniMenu {
Protocol.outboundBuffer.p2add(local36);
}
}
if (local23 == 22) {
if (actionCode == UNKNOWN_22) {
method1294();
local693 = InterfaceList.getComponent(local19);
MiniMap.anInt5062 = local19;
@ -940,14 +1016,14 @@ public class MiniMenu {
}
return;
}
if (local23 == 50) {
if (actionCode == LOC_ACTION_2) {
PathFinder.findPathToLoc(local31, local19, local15);
Protocol.outboundBuffer.p1isaac(194);
Protocol.outboundBuffer.ip2add(local19 + Camera.originZ);
Protocol.outboundBuffer.ip2(Camera.originX + local15);
Protocol.outboundBuffer.p2((int) (local31 >>> 32) & Integer.MAX_VALUE);
}
if (local23 == 48) {
if (actionCode == UNKNOWN_48) {
Protocol.outboundBuffer.p1isaac(154);
Protocol.outboundBuffer.ip2(local15);
Protocol.outboundBuffer.imp4(local19);
@ -956,7 +1032,7 @@ public class MiniMenu {
pressedInventoryComponent = InterfaceList.getComponent(local19);
anInt5444 = local15;
}
if (local23 == 30) {
if (actionCode == PLAYER_ACTION_1) {
local43 = PlayerList.players[local36];
if (local43 != null) {
PathFinder.findPath(PlayerList.self.movementQueueZ[0], 0, 1, false, 0, local43.movementQueueX[0], 1, 0, 2, local43.movementQueueZ[0], PlayerList.self.movementQueueX[0]);
@ -968,7 +1044,7 @@ public class MiniMenu {
Protocol.outboundBuffer.ip2add(local36);
}
}
if (local23 == 43) {
if (actionCode == OBJ_IN_COMPONENT_ACTION_4) {
Protocol.outboundBuffer.p1isaac(153);
Protocol.outboundBuffer.ip4(local19);
Protocol.outboundBuffer.ip2(local15);
@ -977,7 +1053,7 @@ public class MiniMenu {
pressedInventoryComponent = InterfaceList.getComponent(local19);
anInt5444 = local15;
}
if (local23 == 39) {
if (actionCode == COMPONENT_OBJSTACK_ACTION) {
local560 = PathFinder.findPath(PlayerList.self.movementQueueZ[0], 0, 0, false, 0, local15, 0, 0, 2, local19, PlayerList.self.movementQueueX[0]);
if (!local560) {
PathFinder.findPath(PlayerList.self.movementQueueZ[0], 0, 1, false, 0, local15, 1, 0, 2, local19, PlayerList.self.movementQueueX[0]);
@ -993,14 +1069,14 @@ public class MiniMenu {
Protocol.outboundBuffer.ip2add(local15 + Camera.originX);
Protocol.outboundBuffer.ip2(anInt506);
}
if (local23 == 12) {
if (actionCode == UNKNOWN_12) {
Protocol.outboundBuffer.p1isaac(82);
Protocol.outboundBuffer.p2(anInt506);
Protocol.outboundBuffer.imp4(local19);
Protocol.outboundBuffer.p4(anInt2512);
Protocol.outboundBuffer.ip2add(local15);
}
if (local23 == 36) {
if (actionCode == UNKNOWN_36) {
if (local36 == 0) {
Protocol.anInt4422 = 1;
method3556(Player.plane, local15, local19);
@ -1012,7 +1088,7 @@ public class MiniMenu {
Protocol.outboundBuffer.p2(local15 + Camera.originX);
}
}
if (local23 == 6) {
if (actionCode == UNKNOWN_6) {
local43 = PlayerList.players[local36];
if (local43 != null) {
PathFinder.findPath(PlayerList.self.movementQueueZ[0], 0, 1, false, 0, local43.movementQueueX[0], 1, 0, 2, local43.movementQueueZ[0], PlayerList.self.movementQueueX[0]);
@ -1024,7 +1100,7 @@ public class MiniMenu {
Protocol.outboundBuffer.p2(local36);
}
}
if (local23 == 20) {
if (actionCode == OBJSTACK_ACTION_2) {
if (client.game == 1) {
PathFinder.findPath(PlayerList.self.movementQueueZ[0], 0, 1, false, 0, local15, 1, 0, 2, local19, PlayerList.self.movementQueueX[0]);
} else {
@ -1042,7 +1118,7 @@ public class MiniMenu {
Protocol.outboundBuffer.p2(Camera.originX + local15);
Protocol.outboundBuffer.ip2(Camera.originZ + local19);
}
if (local23 == 16) {
if (actionCode == NPC_ACTION_2) {
local192 = NpcList.npcs[local36];
if (local192 != null) {
PathFinder.findPath(PlayerList.self.movementQueueZ[0], 0, 1, false, 0, local192.movementQueueX[0], 1, 0, 2, local192.movementQueueZ[0], PlayerList.self.movementQueueX[0]);
@ -1379,7 +1455,7 @@ public class MiniMenu {
if (local129[local140] != null && local129[local140].equalsIgnoreCase(LocalizedText.ATTACK)) {
@Pc(271) short local271 = 0;
if (arg0.combatLevel > PlayerList.self.combatLevel) {
local271 = 2000;
local271 = 2000; //THIS iS FOR LEFT CLICK ATTACK
}
@Pc(281) short local281 = 0;
if (local140 == 0) {
@ -1603,4 +1679,138 @@ public class MiniMenu {
Protocol.outboundBuffer.imp4(arg1);
Protocol.outboundBuffer.ip2(arg0);
}
@OriginalMember(owner = "client!lf", name = "b", descriptor = "(I)V")
public static void drawA() {
@Pc(3) int local3 = InterfaceList.anInt5138;
@Pc(9) int local9 = InterfaceList.anInt761;
@Pc(11) int local11 = InterfaceList.anInt4271;
@Pc(15) int local15 = InterfaceList.anInt436;
if (GlRenderer.enabled) {
GlRaster.fillRect(local11, local3, local9, local15, 6116423);
GlRaster.fillRect(local11 + 1, local3 + 1, local9 - 2, 16, 0);
GlRaster.drawRect(local11 + 1, local3 + 18, local9 - 2, local15 + -19, 0);
} else {
SoftwareRaster.fillRect(local11, local3, local9, local15, 6116423);
SoftwareRaster.fillRect(local11 + 1, local3 + 1, local9 - 2, 16, 0);
SoftwareRaster.drawRect(local11 + 1, local3 + 18, local9 - 2, local15 + -19, 0);
}
Fonts.b12Full.renderLeft(LocalizedText.CHOOSE_OPTION, local11 + 3, local3 + 14, 6116423, -1);
@Pc(96) int local96 = Mouse.lastMouseY;
@Pc(98) int local98 = Mouse.lastMouseX;
for (@Pc(107) int local107 = 0; local107 < size; local107++) {
@Pc(127) int local127 = (size - local107 - 1) * 15 + local3 + 31;
@Pc(129) int color = 16777215; //WHITE
if (local11 < local98 && local98 < local11 + local9 && local127 - 13 < local96 && local96 < local127 + 3) {
color = 16776960; //YELLOW
}
Fonts.b12Full.renderLeft(getOp(local107), local11 + 3, local127, color, 0);
}
InterfaceList.forceRedrawScreen(InterfaceList.anInt4271, InterfaceList.anInt5138, InterfaceList.anInt436, InterfaceList.anInt761);
}
@OriginalMember(owner = "client!ij", name = "a", descriptor = "(B)V")
public static void drawB() {
@Pc(3) int local3 = InterfaceList.anInt4271;
@Pc(9) int local9 = InterfaceList.anInt5138;
@Pc(11) int local11 = InterfaceList.anInt436;
@Pc(13) int local13 = InterfaceList.anInt761;
if (LoginManager.aClass3_Sub2_Sub1_1 == null || LoginManager.aClass3_Sub2_Sub1_9 == null) {
if (client.js5Archive8.isFileReady(LoginManager.anInt1736) && client.js5Archive8.isFileReady(LoginManager.anInt4073)) {
LoginManager.aClass3_Sub2_Sub1_1 = SoftwareSprite.loadSoftwareAlphaSprite(client.js5Archive8, LoginManager.anInt1736);
LoginManager.aClass3_Sub2_Sub1_9 = SoftwareSprite.loadSoftwareAlphaSprite(client.js5Archive8, LoginManager.anInt4073);
if (GlRenderer.enabled) {
if (LoginManager.aClass3_Sub2_Sub1_1 instanceof SoftwareAlphaSprite) {
LoginManager.aClass3_Sub2_Sub1_1 = new GlAlphaSprite((SoftwareSprite) LoginManager.aClass3_Sub2_Sub1_1);
} else {
LoginManager.aClass3_Sub2_Sub1_1 = new GlSprite((SoftwareSprite) LoginManager.aClass3_Sub2_Sub1_1);
}
if (LoginManager.aClass3_Sub2_Sub1_9 instanceof SoftwareAlphaSprite) {
LoginManager.aClass3_Sub2_Sub1_9 = new GlAlphaSprite((SoftwareSprite) LoginManager.aClass3_Sub2_Sub1_9);
} else {
LoginManager.aClass3_Sub2_Sub1_9 = new GlSprite((SoftwareSprite) LoginManager.aClass3_Sub2_Sub1_9);
}
}
} else if (GlRenderer.enabled) {
GlRaster.fillRectAlpha(local3, local9, local13, 20, LoginManager.anInt1275, 256 - LoginManager.anInt2910);
} else {
SoftwareRaster.fillRectAlpha(local3, local9, local13, 20, LoginManager.anInt1275, 256 - LoginManager.anInt2910);
}
}
@Pc(112) int local112;
@Pc(114) int local114;
if (LoginManager.aClass3_Sub2_Sub1_1 != null && LoginManager.aClass3_Sub2_Sub1_9 != null) {
local112 = local13 / LoginManager.aClass3_Sub2_Sub1_1.width;
for (local114 = 0; local114 < local112; local114++) {
LoginManager.aClass3_Sub2_Sub1_1.render(local114 * LoginManager.aClass3_Sub2_Sub1_1.width + local3, local9);
}
LoginManager.aClass3_Sub2_Sub1_9.render(local3, local9);
LoginManager.aClass3_Sub2_Sub1_9.renderHorizontalFlip(local3 + local13 - LoginManager.aClass3_Sub2_Sub1_9.width, local9);
}
Fonts.b12Full.renderLeft(LocalizedText.CHOOSE_OPTION, local3 + 3, local9 + 14, LoginManager.anInt4581, -1);
if (GlRenderer.enabled) {
GlRaster.fillRectAlpha(local3, local9 + 20, local13, local11 - 20, LoginManager.anInt1275, 256 - LoginManager.anInt2910);
} else {
SoftwareRaster.fillRectAlpha(local3, local9 + 20, local13, local11 - 20, LoginManager.anInt1275, 256 - LoginManager.anInt2910);
}
local114 = Mouse.lastMouseY;
local112 = Mouse.lastMouseX;
@Pc(203) int local203;
@Pc(219) int local219;
for (local203 = 0; local203 < size; local203++) {
local219 = (size - local203 - 1) * 15 + local9 + 35;
if (local3 < local112 && local112 < local3 + local13 && local114 > local219 - 13 && local114 < local219 + 3) {
if (GlRenderer.enabled) {
GlRaster.fillRectAlpha(local3, local219 - 13, local13, 16, LoginManager.anInt5457, 256 - LoginManager.anInt5208);
} else {
SoftwareRaster.fillRectAlpha(local3, local219 - 13, local13, 16, LoginManager.anInt5457, 256 - LoginManager.anInt5208);
}
}
}
if ((LoginManager.aClass3_Sub2_Sub1_8 == null || LoginManager.aClass3_Sub2_Sub1_6 == null || LoginManager.aClass3_Sub2_Sub1_10 == null) && client.js5Archive8.isFileReady(LoginManager.anInt2261) && client.js5Archive8.isFileReady(LoginManager.anInt3324) && client.js5Archive8.isFileReady(LoginManager.anInt5556)) {
LoginManager.aClass3_Sub2_Sub1_8 = SoftwareSprite.loadSoftwareAlphaSprite(client.js5Archive8, LoginManager.anInt2261);
LoginManager.aClass3_Sub2_Sub1_6 = SoftwareSprite.loadSoftwareAlphaSprite(client.js5Archive8, LoginManager.anInt3324);
LoginManager.aClass3_Sub2_Sub1_10 = SoftwareSprite.loadSoftwareAlphaSprite(client.js5Archive8, LoginManager.anInt5556);
if (GlRenderer.enabled) {
if (LoginManager.aClass3_Sub2_Sub1_8 instanceof SoftwareAlphaSprite) {
LoginManager.aClass3_Sub2_Sub1_8 = new GlAlphaSprite((SoftwareSprite) LoginManager.aClass3_Sub2_Sub1_8);
} else {
LoginManager.aClass3_Sub2_Sub1_8 = new GlSprite((SoftwareSprite) LoginManager.aClass3_Sub2_Sub1_8);
}
if (LoginManager.aClass3_Sub2_Sub1_6 instanceof SoftwareAlphaSprite) {
LoginManager.aClass3_Sub2_Sub1_6 = new GlAlphaSprite((SoftwareSprite) LoginManager.aClass3_Sub2_Sub1_6);
} else {
LoginManager.aClass3_Sub2_Sub1_6 = new GlSprite((SoftwareSprite) LoginManager.aClass3_Sub2_Sub1_6);
}
if (LoginManager.aClass3_Sub2_Sub1_10 instanceof SoftwareAlphaSprite) {
LoginManager.aClass3_Sub2_Sub1_10 = new GlAlphaSprite((SoftwareSprite) LoginManager.aClass3_Sub2_Sub1_10);
} else {
LoginManager.aClass3_Sub2_Sub1_10 = new GlSprite((SoftwareSprite) LoginManager.aClass3_Sub2_Sub1_10);
}
}
}
@Pc(418) int local418;
if (LoginManager.aClass3_Sub2_Sub1_8 != null && LoginManager.aClass3_Sub2_Sub1_6 != null && LoginManager.aClass3_Sub2_Sub1_10 != null) {
local203 = local13 / LoginManager.aClass3_Sub2_Sub1_8.width;
for (local219 = 0; local219 < local203; local219++) {
LoginManager.aClass3_Sub2_Sub1_8.render(local3 + LoginManager.aClass3_Sub2_Sub1_8.width * local219, local11 + local9 + -LoginManager.aClass3_Sub2_Sub1_8.height);
}
local219 = (local11 - 20) / LoginManager.aClass3_Sub2_Sub1_6.height;
for (local418 = 0; local418 < local219; local418++) {
LoginManager.aClass3_Sub2_Sub1_6.render(local3, local9 + local418 * LoginManager.aClass3_Sub2_Sub1_6.height + 20);
LoginManager.aClass3_Sub2_Sub1_6.renderHorizontalFlip(local3 + local13 - LoginManager.aClass3_Sub2_Sub1_6.width, local9 + 20 + local418 * LoginManager.aClass3_Sub2_Sub1_6.height);
}
LoginManager.aClass3_Sub2_Sub1_10.render(local3, local11 + local9 - LoginManager.aClass3_Sub2_Sub1_10.height);
LoginManager.aClass3_Sub2_Sub1_10.renderHorizontalFlip(local3 + local13 - LoginManager.aClass3_Sub2_Sub1_10.width, local9 - -local11 + -LoginManager.aClass3_Sub2_Sub1_10.height);
}
for (local203 = 0; local203 < size; local203++) {
local219 = (size - local203 - 1) * 15 + local9 + 35;
local418 = LoginManager.anInt4581;
if (local3 < local112 && local13 + local3 > local112 && local219 - 13 < local114 && local114 < local219 + 3) {
local418 = LoginManager.anInt5752;
}
Fonts.b12Full.renderLeft(getOp(local203), local3 + 3, local219, local418, 0);
}
InterfaceList.forceRedrawScreen(InterfaceList.anInt4271, InterfaceList.anInt5138, InterfaceList.anInt436, InterfaceList.anInt761);
}
}

View file

@ -39,9 +39,9 @@ public final class Mouse implements MouseListener, MouseMotionListener, FocusLis
@OriginalMember(owner = "client!dc", name = "W", descriptor = "I")
public static volatile int anInt1313 = 0;
@OriginalMember(owner = "client!nb", name = "j", descriptor = "I")
public static volatile int anInt4039 = -1;
public static volatile int currentMouseY = -1;
@OriginalMember(owner = "client!lh", name = "u", descriptor = "I")
public static volatile int anInt3521 = -1;
public static volatile int currentMouseX = -1;
@OriginalMember(owner = "client!sa", name = "Y", descriptor = "I")
public static volatile int anInt4973 = 0;
@OriginalMember(owner = "client!wi", name = "W", descriptor = "I")
@ -50,8 +50,6 @@ public final class Mouse implements MouseListener, MouseMotionListener, FocusLis
public static long prevClickTime = 0L;
@OriginalMember(owner = "client!wl", name = "u", descriptor = "I")
public static int anInt5895 = 0;
public int mouseWheelX;
public int mouseWheelY;
@OriginalMember(owner = "client!sc", name = "a", descriptor = "(ILjava/awt/Component;)V")
public static void stop(@OriginalArg(1) Component arg0) {
@ -76,8 +74,8 @@ public final class Mouse implements MouseListener, MouseMotionListener, FocusLis
@Pc(2) Mouse local2 = instance;
synchronized (instance) {
pressedButton = anInt1759;
lastMouseX = anInt3521;
lastMouseY = anInt4039;
lastMouseX = currentMouseX;
lastMouseY = currentMouseY;
clickButton = anInt1313;
clickX = anInt1034;
anInt2467++;
@ -112,8 +110,8 @@ public final class Mouse implements MouseListener, MouseMotionListener, FocusLis
public final synchronized void mouseMoved(@OriginalArg(0) MouseEvent arg0) {
if (instance != null) {
anInt2467 = 0;
anInt3521 = arg0.getX();
anInt4039 = arg0.getY();
currentMouseX = arg0.getX();
currentMouseY = arg0.getY();
}
}
@ -130,21 +128,13 @@ public final class Mouse implements MouseListener, MouseMotionListener, FocusLis
public final synchronized void mouseDragged(@OriginalArg(0) MouseEvent event) {
int x = event.getX();
int y = event.getY();
if (SwingUtilities.isMiddleMouseButton(event)) {
int accelX = this.mouseWheelX - x;
int accelY = this.mouseWheelY - y;
this.mouseWheelX = x;
this.mouseWheelY = y;
Camera.yawTarget += accelX * 2;
Camera.pitchTarget -= accelY * 2;
Camera.clampCameraAngle();
return;
}
if (SwingUtilities.isMiddleMouseButton(event)) return;
if (instance != null) {
anInt2467 = 0;
anInt3521 = x;
anInt4039 = y;
currentMouseX = x;
currentMouseY = y;
}
}
@ -184,8 +174,6 @@ public final class Mouse implements MouseListener, MouseMotionListener, FocusLis
@Override
public final synchronized void mousePressed(@OriginalArg(0) MouseEvent event) {
if (SwingUtilities.isMiddleMouseButton(event)) {
this.mouseWheelX = event.getX();
this.mouseWheelY = event.getY();
return;
}
@ -219,8 +207,8 @@ public final class Mouse implements MouseListener, MouseMotionListener, FocusLis
public final synchronized void mouseExited(@OriginalArg(0) MouseEvent arg0) {
if (instance != null) {
anInt2467 = 0;
anInt3521 = -1;
anInt4039 = -1;
currentMouseX = -1;
currentMouseY = -1;
}
}
@ -229,8 +217,8 @@ public final class Mouse implements MouseListener, MouseMotionListener, FocusLis
public final synchronized void mouseEntered(@OriginalArg(0) MouseEvent arg0) {
if (instance != null) {
anInt2467 = 0;
anInt3521 = arg0.getX();
anInt4039 = arg0.getY();
currentMouseX = arg0.getX();
currentMouseY = arg0.getY();
}
}
}

View file

@ -132,7 +132,7 @@ public final class Npc extends PathingEntity {
@OriginalMember(owner = "client!km", name = "b", descriptor = "(I)I")
@Override
protected final int getBasId() {
public final int getBasId() {
if (client.game != 0 && this.type.multiNpcs != null) {
@Pc(17) NpcType local17 = this.type.getMultiNpc();
if (local17 != null && local17.bastypeid != -1) {

View file

@ -154,7 +154,7 @@ public final class NpcType {
private int resizeY = 128;
@OriginalMember(owner = "client!me", name = "s", descriptor = "I")
private int multiNpcVarbit = -1;
public int multiNpcVarbit = -1;
@OriginalMember(owner = "client!me", name = "fb", descriptor = "I")
public int crawlSound = -1;

View file

@ -628,7 +628,7 @@ public abstract class PathingEntity extends Entity {
}
@OriginalMember(owner = "client!fe", name = "b", descriptor = "(I)I")
protected abstract int getBasId();
public abstract int getBasId();
@OriginalMember(owner = "client!fe", name = "c", descriptor = "(I)V")
public final void method2689() {

View file

@ -300,7 +300,7 @@ public final class Player extends PathingEntity {
@OriginalMember(owner = "client!e", name = "b", descriptor = "(I)I")
@Override
protected final int getBasId() {
public final int getBasId() {
return this.anInt3365;
}

View file

@ -3,6 +3,7 @@ package rt4;
import org.openrs2.deob.annotation.OriginalArg;
import org.openrs2.deob.annotation.OriginalMember;
import org.openrs2.deob.annotation.Pc;
import plugin.PluginRepository;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
@ -967,7 +968,7 @@ public class Protocol {
} else if (opcode == ServerProt.MESSAGE_GAME) {
@Pc(245) JagString message = inboundBuffer.gjstr();
if (message.endsWith(TRADEREQ)) {
JagString name = message.substring(message.indexOf(DateUtil.COLON), 0);
JagString name = message.substring(message.indexOf(JagString.COLON), 0);
long name37 = name.encode37();
boolean ignored = false;
for (int i = 0; i < IgnoreList.size; i++) {
@ -980,7 +981,7 @@ public class Protocol {
Chat.add(name, 4, LocalizedText.TRADEREQ);
}
} else if (message.endsWith(CHALREQ)) {
JagString name = message.substring(message.indexOf(DateUtil.COLON), 0);
JagString name = message.substring(message.indexOf(JagString.COLON), 0);
long name37 = name.encode37();
boolean ignored = false;
for (int i = 0; i < IgnoreList.size; i++) {
@ -990,11 +991,11 @@ public class Protocol {
}
}
if (!ignored && Player.inTutorialIsland == 0) {
JagString local506 = message.substring(message.length() - 9, message.indexOf(DateUtil.COLON) + 1);
JagString local506 = message.substring(message.length() - 9, message.indexOf(JagString.COLON) + 1);
Chat.add(name, 8, local506);
}
} else if (message.endsWith(ASSISTREQ)) {
JagString name = message.substring(message.indexOf(DateUtil.COLON), 0);
JagString name = message.substring(message.indexOf(JagString.COLON), 0);
long name37 = name.encode37();
boolean ignored = false;
for (int i = 0; i < IgnoreList.size; i++) {
@ -1020,7 +1021,7 @@ public class Protocol {
Chat.add(JagString.EMPTY, 13, name);
}
} else if (message.endsWith(DUELSTAKE)) {
JagString name = message.substring(message.indexOf(DateUtil.COLON), 0);
JagString name = message.substring(message.indexOf(JagString.COLON), 0);
long name37 = name.encode37();
boolean ignored = false;
for (int i = 0; i < IgnoreList.size; i++) {
@ -1033,7 +1034,7 @@ public class Protocol {
Chat.add(name, 14, JagString.EMPTY);
}
} else if (message.endsWith(DUELFRIEND)) {
JagString name = message.substring(message.indexOf(DateUtil.COLON), 0);
JagString name = message.substring(message.indexOf(JagString.COLON), 0);
long name37 = name.encode37();
boolean ignored = false;
for (int local277 = 0; local277 < IgnoreList.size; local277++) {
@ -1046,7 +1047,7 @@ public class Protocol {
Chat.add(name, 15, JagString.EMPTY);
}
} else if (message.endsWith(aClass100_916)) {
JagString name = message.substring(message.indexOf(DateUtil.COLON), 0);
JagString name = message.substring(message.indexOf(JagString.COLON), 0);
long name37 = name.encode37();
boolean ignored = false;
for (int i = 0; i < IgnoreList.size; i++) {
@ -1059,7 +1060,7 @@ public class Protocol {
Chat.add(name, 16, JagString.EMPTY);
}
} else if (message.endsWith(aClass100_770)) {
JagString name = message.substring(message.indexOf(DateUtil.COLON), 0);
JagString name = message.substring(message.indexOf(JagString.COLON), 0);
long name37 = name.encode37();
boolean ignored = false;
for (int i = 0; i < IgnoreList.size; i++) {
@ -1069,7 +1070,7 @@ public class Protocol {
}
}
if (!ignored && Player.inTutorialIsland == 0) {
JagString local506 = message.substring(message.length() - 9, message.indexOf(DateUtil.COLON) + 1);
JagString local506 = message.substring(message.length() - 9, message.indexOf(JagString.COLON) + 1);
Chat.add(name, 21, local506);
}
} else {
@ -1459,6 +1460,7 @@ public class Protocol {
PlayerSkillXpTable.baseLevels[skill] = i + 2;
}
}
PluginRepository.OnXPUpdate(skill, xp);
PlayerSkillXpTable.updatedStats[PlayerSkillXpTable.updatedStatsWriterIndex++ & 0x1F] = skill;
opcode = -1;
return true;
@ -1712,7 +1714,7 @@ public class Protocol {
@Pc(3449) ComponentPointer src = (ComponentPointer) InterfaceList.openInterfaces.get(source);
ComponentPointer tgt = (ComponentPointer) InterfaceList.openInterfaces.get(target);
if (tgt != null) {
InterfaceList.closeInterface(src == null || tgt.anInt5878 != src.anInt5878, tgt);
InterfaceList.closeInterface(src == null || tgt.interfaceId != src.interfaceId, tgt);
}
if (src != null) {
src.unlink();
@ -1852,7 +1854,7 @@ public class Protocol {
setVerifyId(tracknum);
ComponentPointer ptr = (ComponentPointer) InterfaceList.openInterfaces.get(pointer);
if (ptr != null) {
InterfaceList.closeInterface(ptr.anInt5878 != component, ptr);
InterfaceList.closeInterface(ptr.interfaceId != component, ptr);
}
method1148(component, pointer, type);
opcode = -1;
@ -3472,7 +3474,7 @@ public class Protocol {
public static ComponentPointer method1148(@OriginalArg(1) int arg0, @OriginalArg(2) int arg1, @OriginalArg(3) int arg2) {
@Pc(9) ComponentPointer local9 = new ComponentPointer();
local9.anInt5879 = arg2;
local9.anInt5878 = arg0;
local9.interfaceId = arg0;
InterfaceList.openInterfaces.put(local9, arg1);
InterfaceList.method1753(arg0);
@Pc(28) Component local28 = InterfaceList.getComponent(arg1);

View file

@ -3,6 +3,7 @@ package rt4;
import org.openrs2.deob.annotation.OriginalArg;
import org.openrs2.deob.annotation.OriginalMember;
import org.openrs2.deob.annotation.Pc;
import plugin.PluginRepository;
import java.nio.charset.StandardCharsets;
import java.util.Calendar;
@ -316,14 +317,14 @@ public final class ScriptRunner {
MaterialManager.method2731(0, 0, 0, 0, 0);
client.audioLoop();
method3858();
method2726(arg4, arg3, arg2, anInt5029, arg0, anInt5029);
drawOverheads(arg4, arg3, arg2, anInt5029, arg0, anInt5029);
MiniMap.method4000(arg3, arg2, arg0, anInt5029, anInt5029, arg4);
} else {
SoftwareRaster.fillRect(arg2, arg4, arg3, arg0, 0);
SceneGraph.method2954(Camera.renderX, Camera.anInt40, Camera.renderZ, Camera.cameraPitch, Camera.cameraYaw, aByteArrayArrayArray15, anIntArray205, anIntArray338, anIntArray518, anIntArray134, anIntArray476, Player.plane + 1, local387, PlayerList.self.xFine >> 7, PlayerList.self.zFine >> 7);
client.audioLoop();
method3858();
method2726(arg4, arg3, arg2, 256, arg0, 256);
drawOverheads(arg4, arg3, arg2, 256, arg0, 256);
MiniMap.method4000(arg3, arg2, arg0, 256, 256, arg4);
}
((Js5GlTextureProvider) Rasteriser.textureProvider).method3239(Protocol.sceneDelta);
@ -350,7 +351,7 @@ public final class ScriptRunner {
}
@OriginalMember(owner = "client!lc", name = "a", descriptor = "(IIIIIII)V")
public static void method2726(@OriginalArg(0) int arg0, @OriginalArg(1) int arg1, @OriginalArg(2) int arg2, @OriginalArg(3) int arg3, @OriginalArg(4) int arg4, @OriginalArg(5) int arg5) {
public static void drawOverheads(@OriginalArg(0) int arg0, @OriginalArg(1) int arg1, @OriginalArg(2) int arg2, @OriginalArg(3) int arg3, @OriginalArg(4) int arg4, @OriginalArg(5) int arg5) {
OverheadChat.size = 0;
@Pc(5) int local5;
@Pc(642) int local642;
@ -360,18 +361,25 @@ public final class ScriptRunner {
@Pc(359) int local359;
@Pc(639) int local639;
for (local5 = -1; local5 < PlayerList.size + NpcList.size; local5++) {
@Pc(17) PathingEntity local17;
@Pc(17) PathingEntity entity;
if (local5 == -1) {
local17 = PlayerList.self;
entity = PlayerList.self;
} else if (PlayerList.size > local5) {
local17 = PlayerList.players[PlayerList.ids[local5]];
entity = PlayerList.players[PlayerList.ids[local5]];
} else {
local17 = NpcList.npcs[NpcList.ids[local5 - PlayerList.size]];
entity = NpcList.npcs[NpcList.ids[local5 - PlayerList.size]];
}
if (local17 != null && local17.isVisible()) {
if (entity != null && entity.isVisible()) {
setOverheadScreenCoordinateOffsets(arg4 >> 1, arg3, entity, arg5, entity.method2691() + 15, arg1 >> 1);
if (local5 >= PlayerList.size) {
PluginRepository.NPCOverheadDraw((Npc) entity,arg2 + anInt1951, arg0 + anInt548);
} else {
PluginRepository.PlayerOverheadDraw((Player) entity,arg2 + anInt1951, arg0 + anInt548);
}
@Pc(58) NpcType local58;
if (local17 instanceof Npc) {
local58 = ((Npc) local17).type;
if (entity instanceof Npc) {
local58 = ((Npc) entity).type;
if (local58.multiNpcs != null) {
local58 = local58.getMultiNpc();
}
@ -381,17 +389,17 @@ public final class ScriptRunner {
}
@Pc(161) int local161;
if (local5 >= PlayerList.size) {
local58 = ((Npc) local17).type;
local58 = ((Npc) entity).type;
if (local58.multiNpcs != null) {
local58 = local58.getMultiNpc();
}
if (local58.headicon >= 0 && Sprites.headiconPrayers.length > local58.headicon) {
if (local58.iconHeight == -1) {
local265 = local17.method2691() + 15;
local265 = entity.method2691() + 15;
} else {
local265 = local58.iconHeight + 15;
}
method3326(arg4 >> 1, arg3, local17, arg5, local265, arg1 >> 1);
setOverheadScreenCoordinateOffsets(arg4 >> 1, arg3, entity, arg5, local265, arg1 >> 1);
if (anInt1951 > -1) {
Sprites.headiconPrayers[local58.headicon].render(arg2 + anInt1951 - 12, arg0 + -30 - -anInt548);
}
@ -401,11 +409,11 @@ public final class ScriptRunner {
@Pc(322) MapMarker local322 = local308[local310];
if (local322 != null && local322.type == 1 && local322.actorTargetId == NpcList.ids[local5 - PlayerList.size] && client.loop % 20 < 10) {
if (local58.iconHeight == -1) {
local359 = local17.method2691() + 15;
local359 = entity.method2691() + 15;
} else {
local359 = local58.iconHeight + 15;
}
method3326(arg4 >> 1, arg3, local17, arg5, local359, arg1 >> 1);
setOverheadScreenCoordinateOffsets(arg4 >> 1, arg3, entity, arg5, local359, arg1 >> 1);
if (anInt1951 > -1) {
Sprites.headhints[local322.anInt4048].render(arg2 + anInt1951 - 12, anInt548 + -28 + arg0);
}
@ -413,9 +421,9 @@ public final class ScriptRunner {
}
} else {
local74 = 30;
@Pc(77) Player local77 = (Player) local17;
@Pc(77) Player local77 = (Player) entity;
if (local77.anInt1669 != -1 || local77.anInt1649 != -1) {
method3326(arg4 >> 1, arg3, local17, arg5, local17.method2691() + 15, arg1 >> 1);
setOverheadScreenCoordinateOffsets(arg4 >> 1, arg3, entity, arg5, entity.method2691() + 15, arg1 >> 1);
if (anInt1951 > -1) {
if (local77.anInt1669 != -1) {
Sprites.headiconPks[local77.anInt1669].render(anInt1951 + arg2 - 12, arg0 + -30 + anInt548);
@ -432,7 +440,7 @@ public final class ScriptRunner {
for (local161 = 0; local161 < local159.length; local161++) {
@Pc(173) MapMarker local173 = local159[local161];
if (local173 != null && local173.type == 10 && PlayerList.ids[local5] == local173.actorTargetId) {
method3326(arg4 >> 1, arg3, local17, arg5, local17.method2691() + 15, arg1 >> 1);
setOverheadScreenCoordinateOffsets(arg4 >> 1, arg3, entity, arg5, entity.method2691() + 15, arg1 >> 1);
if (anInt1951 > -1) {
Sprites.headhints[local173.anInt4048].render(arg2 + anInt1951 - 12, arg0 + (anInt548 - local74));
}
@ -440,25 +448,25 @@ public final class ScriptRunner {
}
}
}
if (local17.chatMessage != null && (local5 >= PlayerList.size || Chat.publicFilter == 0 || Chat.publicFilter == 3 || Chat.publicFilter == 1 && FriendsList.contains(((Player) local17).username))) {
method3326(arg4 >> 1, arg3, local17, arg5, local17.method2691(), arg1 >> 1);
if (entity.chatMessage != null && (local5 >= PlayerList.size || Chat.publicFilter == 0 || Chat.publicFilter == 3 || Chat.publicFilter == 1 && FriendsList.contains(((Player) entity).username))) {
setOverheadScreenCoordinateOffsets(arg4 >> 1, arg3, entity, arg5, entity.method2691(), arg1 >> 1);
if (anInt1951 > -1 && OverheadChat.size < OverheadChat.CAPACITY) {
OverheadChat.anIntArray389[OverheadChat.size] = Fonts.b12Full.getStringWidth(local17.chatMessage) / 2;
OverheadChat.anIntArray389[OverheadChat.size] = Fonts.b12Full.getStringWidth(entity.chatMessage) / 2;
OverheadChat.anIntArray387[OverheadChat.size] = Fonts.b12Full.lineHeight;
OverheadChat.anIntArray385[OverheadChat.size] = anInt1951;
OverheadChat.anIntArray392[OverheadChat.size] = anInt548;
OverheadChat.colors[OverheadChat.size] = local17.chatColor;
OverheadChat.effects[OverheadChat.size] = local17.chatEffect;
OverheadChat.loops[OverheadChat.size] = local17.chatLoops;
OverheadChat.messages[OverheadChat.size] = local17.chatMessage;
OverheadChat.colors[OverheadChat.size] = entity.chatColor;
OverheadChat.effects[OverheadChat.size] = entity.chatEffect;
OverheadChat.loops[OverheadChat.size] = entity.chatLoops;
OverheadChat.messages[OverheadChat.size] = entity.chatMessage;
OverheadChat.size++;
}
}
if (local17.hitpointsBarVisibleUntil > client.loop) {
if (entity.hitpointsBarVisibleUntil > client.loop) {
@Pc(508) Sprite local508 = Sprites.hitbars[0];
@Pc(512) Sprite local512 = Sprites.hitbars[1];
if (local17 instanceof Npc) {
@Pc(518) Npc local518 = (Npc) local17;
if (entity instanceof Npc) {
@Pc(518) Npc local518 = (Npc) entity;
@Pc(528) Sprite[] local528 = (Sprite[]) HitBarList.hitBars.get(local518.type.hitBarId);
if (local528 == null) {
local528 = SpriteLoader.loadAlphaSprites(local518.type.hitBarId, client.js5Archive8);
@ -472,19 +480,19 @@ public final class ScriptRunner {
}
@Pc(571) NpcType local571 = local518.type;
if (local571.iconHeight == -1) {
local310 = local17.method2691();
local310 = entity.method2691();
} else {
local310 = local571.iconHeight;
}
} else {
local310 = local17.method2691();
local310 = entity.method2691();
}
method3326(arg4 >> 1, arg3, local17, arg5, local508.height + local310 + 10, arg1 >> 1);
setOverheadScreenCoordinateOffsets(arg4 >> 1, arg3, entity, arg5, local508.height + local310 + 10, arg1 >> 1);
if (anInt1951 > -1) {
local161 = anInt1951 + arg2 - (local508.width >> 1);
local359 = anInt548 + arg0 - 3;
local508.render(local161, local359);
local639 = local508.width * local17.hitpointsBar / 255;
local639 = local508.width * entity.hitpointsBar / 255;
local642 = local508.height;
if (GlRenderer.enabled) {
GlRaster.method1183(local161, local359, local161 + local639, local359 + local642);
@ -500,19 +508,19 @@ public final class ScriptRunner {
}
}
for (local74 = 0; local74 < 4; local74++) {
if (local17.hitVisibleUntil[local74] > client.loop) {
if (local17 instanceof Npc) {
@Pc(725) Npc local725 = (Npc) local17;
if (entity.hitVisibleUntil[local74] > client.loop) {
if (entity instanceof Npc) {
@Pc(725) Npc local725 = (Npc) entity;
@Pc(728) NpcType local728 = local725.type;
if (local728.iconHeight == -1) {
local265 = local17.method2691() / 2;
local265 = entity.method2691() / 2;
} else {
local265 = local728.iconHeight / 2;
}
} else {
local265 = local17.method2691() / 2;
local265 = entity.method2691() / 2;
}
method3326(arg4 >> 1, arg3, local17, arg5, local265, arg1 >> 1);
setOverheadScreenCoordinateOffsets(arg4 >> 1, arg3, entity, arg5, local265, arg1 >> 1);
if (anInt1951 > -1) {
if (local74 == 1) {
anInt548 -= 20;
@ -525,8 +533,8 @@ public final class ScriptRunner {
anInt548 -= 10;
anInt1951 += 15;
}
Sprites.hitmarks[local17.hitTypes[local74]].render(arg2 + anInt1951 - 12, arg0 + anInt548 - 12);
Fonts.p11Full.renderCenter(JagString.parseInt(local17.hitDamages[local74]), anInt1951 + arg2 - 1, anInt548 + 3 + arg0, 16777215, 0);
Sprites.hitmarks[entity.hitTypes[local74]].render(arg2 + anInt1951 - 12, arg0 + anInt548 - 12);
Fonts.p11Full.renderCenter(JagString.parseInt(entity.hitDamages[local74]), anInt1951 + arg2 - 1, anInt548 + 3 + arg0, 16777215, 0);
}
}
}
@ -1224,7 +1232,7 @@ public final class ScriptRunner {
}
@OriginalMember(owner = "client!og", name = "a", descriptor = "(BIILclient!fe;III)V")
public static void method3326(@OriginalArg(1) int arg0, @OriginalArg(2) int arg1, @OriginalArg(3) PathingEntity arg2, @OriginalArg(4) int arg3, @OriginalArg(5) int arg4, @OriginalArg(6) int arg5) {
public static void setOverheadScreenCoordinateOffsets(@OriginalArg(1) int arg0, @OriginalArg(2) int arg1, @OriginalArg(3) PathingEntity arg2, @OriginalArg(4) int arg3, @OriginalArg(5) int arg4, @OriginalArg(6) int arg5) {
method1026(arg5, arg1, arg2.zFine, arg4, arg0, arg2.xFine, arg3);
}
@ -2981,7 +2989,7 @@ public final class ScriptRunner {
int1 = intStack[isp];
int3 = intStack[isp + 1];
@Pc(12663) ComponentPointer local12663 = (ComponentPointer) InterfaceList.openInterfaces.get(int1);
if (local12663 != null && local12663.anInt5878 == int3) {
if (local12663 != null && local12663.interfaceId == int3) {
intStack[isp++] = 1;
continue;
}

View file

@ -740,7 +740,7 @@ public final class SoftwareAlphaSprite extends SoftwareSprite {
@OriginalMember(owner = "client!am", name = "b", descriptor = "(IIIII)V")
@Override
public final void method1422(@OriginalArg(0) int arg0, @OriginalArg(1) int arg1, @OriginalArg(2) int arg2, @OriginalArg(3) int arg3, @OriginalArg(4) int arg4) {
public final void renderAlpha(@OriginalArg(0) int arg0, @OriginalArg(1) int arg1, @OriginalArg(2) int arg2, @OriginalArg(3) int arg3, @OriginalArg(4) int arg4) {
if (arg2 <= 0 || arg3 <= 0) {
return;
}

View file

@ -1213,7 +1213,7 @@ public class SoftwareSprite extends Sprite {
@OriginalMember(owner = "client!mm", name = "b", descriptor = "(IIIII)V")
@Override
public void method1422(@OriginalArg(0) int arg0, @OriginalArg(1) int arg1, @OriginalArg(2) int arg2, @OriginalArg(3) int arg3, @OriginalArg(4) int arg4) {
public void renderAlpha(@OriginalArg(0) int arg0, @OriginalArg(1) int arg1, @OriginalArg(2) int arg2, @OriginalArg(3) int arg3, @OriginalArg(4) int arg4) {
if (arg2 <= 0 || arg3 <= 0) {
return;
}

View file

@ -43,7 +43,7 @@ public abstract class Sprite extends SecondaryNode {
public abstract void renderResized(@OriginalArg(0) int arg0, @OriginalArg(1) int arg1, @OriginalArg(2) int arg2, @OriginalArg(3) int arg3);
@OriginalMember(owner = "client!qf", name = "a", descriptor = "(IIIII)V")
public final void method1420(@OriginalArg(0) int arg0, @OriginalArg(1) int arg1, @OriginalArg(2) int arg2, @OriginalArg(3) int arg3) {
public final void renderAngled(@OriginalArg(0) int arg0, @OriginalArg(1) int arg1, @OriginalArg(2) int arg2, @OriginalArg(3) int arg3) {
@Pc(8) int local8 = this.anInt1860 << 3;
@Pc(17) int local17 = this.anInt1866 << 3;
@Pc(25) int local25 = (arg3 << 4) + (local8 & 0xF);
@ -55,7 +55,7 @@ public abstract class Sprite extends SecondaryNode {
public abstract void renderHorizontalFlip(@OriginalArg(0) int arg0, @OriginalArg(1) int arg1);
@OriginalMember(owner = "client!qf", name = "b", descriptor = "(IIIII)V")
public abstract void method1422(@OriginalArg(0) int arg0, @OriginalArg(1) int arg1, @OriginalArg(2) int arg2, @OriginalArg(3) int arg3, @OriginalArg(4) int arg4);
public abstract void renderAlpha(@OriginalArg(0) int arg0, @OriginalArg(1) int arg1, @OriginalArg(2) int arg2, @OriginalArg(3) int arg3, @OriginalArg(4) int arg4);
@OriginalMember(owner = "client!qf", name = "e", descriptor = "(II)V")
public abstract void render(@OriginalArg(0) int arg0, @OriginalArg(1) int arg1);

View file

@ -3,6 +3,7 @@ package rt4;
import org.openrs2.deob.annotation.OriginalArg;
import org.openrs2.deob.annotation.OriginalMember;
import org.openrs2.deob.annotation.Pc;
import plugin.PluginRepository;
public class VarpDomain {
@OriginalMember(owner = "client!gj", name = "q", descriptor = "[I")
@ -36,6 +37,10 @@ public class VarpDomain {
@OriginalMember(owner = "client!nh", name = "a", descriptor = "(BII)V")
public static void set(@OriginalArg(1) int value, @OriginalArg(2) int id) {
PluginRepository.OnVarpUpdate(id, value);
if (id > varp.length) return;
varp[id] = value;
@Pc(20) LongNode local20 = (LongNode) aClass133_20.get(id);
if (local20 == null) {

View file

@ -3,6 +3,7 @@ package rt4;
import org.openrs2.deob.annotation.OriginalArg;
import org.openrs2.deob.annotation.OriginalMember;
import org.openrs2.deob.annotation.Pc;
import plugin.PluginRepository;
public class WorldMap {
@OriginalMember(owner = "client!nc", name = "e", descriptor = "Lclient!na;")

View file

@ -4,6 +4,7 @@ import org.openrs2.deob.annotation.OriginalArg;
import org.openrs2.deob.annotation.OriginalClass;
import org.openrs2.deob.annotation.OriginalMember;
import org.openrs2.deob.annotation.Pc;
import plugin.PluginRepository;
import java.awt.*;
import java.io.IOException;
@ -774,7 +775,7 @@ public final class client extends GameShell {
} else if (gameState == 30) {
LoginManager.method1841();
} else if (gameState == 40) {
Fonts.drawTextOnScreen(false, JagString.concatenate(new JagString[]{LocalizedText.CONLOST, Cs1ScriptRunner.aClass100_556, LocalizedText.ATTEMPT_TO_REESTABLISH}));
Fonts.drawTextOnScreen(false, JagString.concatenate(new JagString[]{LocalizedText.CONLOST, JagString.aClass100_556, LocalizedText.ATTEMPT_TO_REESTABLISH}));
}
if (GlRenderer.enabled && gameState != 0) {
GlRenderer.swapBuffers();
@ -1018,8 +1019,9 @@ public final class client extends GameShell {
}
mainLoadPrimaryText = LocalizedText.GAME0_LOADING;
if (modeWhere != 0) {
Cheat.displayFps = true;
//Cheat.displayFps = true;
}
PluginRepository.Init();
}
@OriginalMember(owner = "client!client", name = "c", descriptor = "(I)V")

View file

@ -24,4 +24,5 @@ jar {
attributes 'Main-Class': "$mainClassName"
}
from { configurations.compileClasspath.collect { it.isDirectory() ? it : zipTree(it) } }
duplicatesStrategy = DuplicatesStrategy.INCLUDE
}

View file

@ -0,0 +1,105 @@
plugins {
id 'java'
id 'org.jetbrains.kotlin.jvm' version '1.4.10'
}
version 'unspecified'
targetCompatibility = 1.8
sourceCompatibility = 1.8
repositories {
mavenCentral()
}
dependencies {
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.1'
implementation(rootProject.project("client"))
compile 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.4.10'
}
test {
useJUnitPlatform()
}
task initializeNewJavaPlugin {
doLast {
def pluginFile = new File("src/main/java/MyPlugin")
pluginFile.mkdirs()
new File(rootProject.project("plugin-playground").projectDir.absolutePath + File.separator + "src/main/java/MyPlugin/plugin.properties").text = """
AUTHOR='Me'
DESCRIPTION='Make sure to rename both the MyPlugin folder and the package statement in plugin.java!
VERSION=-1.1
"""
new File(rootProject.project("plugin-playground").projectDir.absolutePath + File.separator + "src/main/java/MyPlugin/plugin.java").text = """
package MyPlugin;
import plugin.Plugin;
public class plugin extends Plugin {
@Override
public void Init() {
//Init() is called when the plugin is loaded
}
@Override
public void Update() {
//Update() is called once per tick (600ms)
}
@Override
public void Draw(long deltaTime) {
//Draw() is called once per frame, with deltaTime being the time since last frame.
}
//Check the source of plugin.Plugin for more methods you can override! Happy hacking! <3
//There are also many methods to aid in plugin development in plugin.api.API
}
"""
}
}
task initializeNewKotlinPlugin {
doLast {
def pluginFile = new File("src/main/kotlin/MyPlugin")
pluginFile.mkdirs()
new File(rootProject.project("plugin-playground").projectDir.absolutePath + File.separator + "src/main/kotlin/MyPlugin/plugin.properties").text = """
AUTHOR='Me'
DESCRIPTION='Make sure to rename both the MyPlugin folder and the package statement in plugin.java!
VERSION=-1.1
"""
new File(rootProject.project("plugin-playground").projectDir.absolutePath + File.separator + "src/main/kotlin/MyPlugin/plugin.kt").text = """
package MyPlugin
import plugin.Plugin
class plugin : Plugin() {
override fun Init() {
//Init() is called when the plugin is loaded
}
override fun Update() {
//Update() is called once per tick (600ms)
}
override fun Draw(deltaTime: Long) {
//Draw() is called once per frame, with deltaTime being the time since last frame.
}
//Check the source of plugin.Plugin for more methods you can override! Happy hacking! <3
//There are also many methods to aid in plugin development in plugin.api.API
}
"""
}
}
task buildPlugins(type: Copy, dependsOn: classes) {
def pluginsPath = rootProject.project("client").projectDir.absolutePath + File.separator + "plugins"
from "build/classes/java/main"
into pluginsPath
from "build/classes/kotlin/main"
into pluginsPath
}

View file

@ -0,0 +1,97 @@
package InterfaceDebugPlugin;
import plugin.Plugin;
import plugin.annotations.PluginMeta;
import plugin.api.*;
import rt4.Component;
import rt4.GameShell;
import java.util.ArrayList;
import java.util.Arrays;
@PluginMeta(
author = "Ceikry",
description = "Aids in identifying interface components/varps/model IDs.",
version = 1.2
)
public class plugin extends Plugin {
private boolean isEnabled;
private boolean isVerbose;
private final ArrayList<Integer> activeVarps = new ArrayList<>();
@Override
public void ComponentDraw(int componentIndex, Component component, int screenX, int screenY) {
if (!isEnabled) return;
FontColor color = new FontColor((((component.type * 50) << 16) | 255 << 8 | Math.min(component.type * 50, 255)));
if (!isVerbose) {
if
(
component.type != 0
&& component.type != 9
&& (component.type != 5
|| (component.onOptionClick != null
|| component.onMouseOver != null
|| component.onHold != null
|| component.varpTriggers != null
|| component.onVarcstrTransmit != null
|| component.onVarcTransmit != null
|| component.cs1ComparisonOpcodes != null))
|| component.hidden
) return;
}
API.DrawText(
FontType.SMALL,
color,
TextModifier.LEFT,
componentIndex + "" + (component.modelId != 0 ? " (" + component.modelId + ")" : ""),
screenX,
screenY
);
if (component.varpTriggers != null) {
Arrays.stream(component.varpTriggers).forEach(varp -> { if(!activeVarps.contains(varp)) activeVarps.add(varp); });
}
}
@Override
public void Draw(long timeDelta) {
if (!isEnabled) return;
StringBuilder sb = new StringBuilder();
sb.append("Varps: [");
for (int varp : activeVarps) sb.append(varp).append(" ");
sb.append("]");
API.DrawText(
FontType.SMALL,
FontColor.YELLOW,
TextModifier.CENTER,
sb.toString(),
GameShell.canvasWidth / 2 - 100,
20
);
}
@Override
public void ProcessCommand(String commandStr, String[] args) {
if (!API.PlayerHasPrivilege(Privileges.JMOD)) return;
if (commandStr.equalsIgnoreCase("::debug_iface")){
isEnabled = !isEnabled;
}
if (commandStr.equalsIgnoreCase("::debug_iface_verbose")) {
isVerbose = !isVerbose;
}
if (commandStr.equalsIgnoreCase("::clear_iface_varps")) {
activeVarps.clear();
}
}
}

View file

@ -0,0 +1,65 @@
package OverheadDebugPlugin;
import plugin.Plugin;
import plugin.annotations.PluginMeta;
import plugin.api.*;
import rt4.*;
@PluginMeta(
author = "Ceikry",
description = "Draws helpful overhead debug information.",
version = 1.3
)
public class plugin extends Plugin {
private boolean isEnabled = false;
@Override
public void PlayerOverheadDraw(Player player, int screenX, int screenY) {
if (!isEnabled) return;
API.DrawText(
FontType.SMALL,
FontColor.YELLOW,
TextModifier.CENTER,
player.username.toString(),
screenX,
screenY
);
}
@Override
public void NPCOverheadDraw(Npc npc, int screenX, int screenY) {
if (!isEnabled) return;
String npcSb =
(npc.type.name.strEquals(JagString.parse("null"))
? npc.type.getMultiNpc() != null
? "Wrapper [" + npc.type.getMultiNpc().name + "]"
: "Wrapper"
: npc.type.name) +
" [G: " +
npc.spotAnimId +
"] [R: " + npc.getBasId() +
"] [A: " + npc.seqId +
"] [Vb: " +
npc.type.multiNpcVarbit + "]";
API.DrawText(
FontType.SMALL,
FontColor.YELLOW,
TextModifier.CENTER,
npcSb,
screenX,
screenY
);
}
@Override
public void ProcessCommand(String commandStr, String[] args) {
if (!API.PlayerHasPrivilege(Privileges.JMOD)) return;
if (commandStr.equalsIgnoreCase("::npcdebug")) {
isEnabled = !isEnabled;
}
}
}

View file

@ -0,0 +1,76 @@
package VarpLogPlugin;
import plugin.Plugin;
import plugin.annotations.PluginMeta;
import plugin.api.*;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
@PluginMeta(
author = "Ceikry",
description = "Adds a simple log of varp changes drawn directly to the screen.",
version = 1.0
)
public class plugin extends Plugin {
boolean isEnabled = false;
int MAX_VISIBLE_UPDATES = 5;
ArrayList<String> varpUpdates = new ArrayList<>();
ArrayList<String> updateCreationTime = new ArrayList<>();
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
@Override
public void Init() {
if (API.IsHD()) MAX_VISIBLE_UPDATES = 10;
}
@Override
public void OnVarpUpdate(int id, int value) {
if (!isEnabled) return;
if (varpUpdates.size() == MAX_VISIBLE_UPDATES) {
varpUpdates.remove(0);
updateCreationTime.remove(0);
}
varpUpdates.add(id + " =<gt> " + value);
String formattedTime = sdf.format(new Date());
updateCreationTime.add(formattedTime);
System.out.println("[VARP Update]" + formattedTime + " " + id + "->" + value);
}
@Override
public void Draw(long timeDelta) {
if (!isEnabled) return;
int startX = 10;
int startY = 30;
API.DrawText(FontType.SMALL, FontColor.YELLOW, TextModifier.LEFT, "Varp Updates:", startX, startY);
for (int i = 0; i < varpUpdates.size(); i++){
String update = varpUpdates.get(i);
String time = updateCreationTime.get(i);
API.DrawText(
FontType.SMALL,
FontColor.YELLOW,
TextModifier.LEFT,
"[" + time + "] " + update,
startX,
startY + (i + 1) * 15
);
}
}
@Override
public void ProcessCommand(String commandStr, String[] args) {
if (!API.PlayerHasPrivilege(Privileges.JMOD)) return;
if (commandStr.equalsIgnoreCase("::varplog")) {
isEnabled = !isEnabled;
}
}
}

View file

@ -0,0 +1,115 @@
package BasicInputQOL
import plugin.Plugin
import plugin.annotations.PluginMeta
import plugin.api.*
import rt4.Keyboard
import java.awt.event.*
import javax.swing.SwingUtilities
@PluginMeta(
author = "Ceikry",
description = "Provides some basic input QOL like scroll zoom, middle click panning, etc.",
version = 1.0
)
class plugin : Plugin() {
private var cameraDebugEnabled = false
private var mouseDebugEnabled = false
companion object {
private var lastMouseWheelX = 0
private var lastMouseWheelY = 0
private val defaultCameraPYZ = Triple(128.0, 0.0, 600)
}
override fun Init() {
API.AddMouseListener(MouseCallbacks)
API.AddMouseWheelListener(MouseWheelCallbacks)
}
override fun ProcessCommand(commandStr: String?, args: Array<out String>?) {
commandStr ?: return
if (API.PlayerHasPrivilege(Privileges.JMOD)) {
when(commandStr) {
"::mousedebug" -> mouseDebugEnabled = !mouseDebugEnabled
"::cameradebug" -> cameraDebugEnabled = !cameraDebugEnabled
}
}
}
override fun Draw(timeDelta: Long) {
if (mouseDebugEnabled) {
API.DrawText(
FontType.SMALL,
FontColor.YELLOW,
TextModifier.LEFT,
"Mouse Coords: (${API.GetMouseX()}, ${API.GetMouseY()})",
10,
40
)
}
if (cameraDebugEnabled) {
API.DrawText(
FontType.SMALL,
FontColor.YELLOW,
TextModifier.LEFT,
"Camera: [P=${API.GetCameraPitch()}, Y=${API.GetCameraYaw()}, Z=${API.GetCameraZoom()}]",
10,
50
)
}
}
object MouseWheelCallbacks : MouseWheelListener {
override fun mouseWheelMoved(e: MouseWheelEvent?) {
e ?: return
if (API.IsKeyPressed(Keyboard.KEY_SHIFT)) {
val previous = API.GetPreviousMouseWheelRotation()
val current = API.GetMouseWheelRotation()
val diff = current - previous
API.UpdateCameraZoom(diff)
}
}
}
object MouseCallbacks : MouseAdapter() {
override fun mouseDragged(e: MouseEvent?) {
e ?: return
if (SwingUtilities.isMiddleMouseButton(e)) {
val x = e.x
val y = e.y
val accelX = lastMouseWheelX - x
val accelY = lastMouseWheelY - y
lastMouseWheelX = x
lastMouseWheelY = y
API.UpdateCameraYaw(accelX * 2.0)
API.UpdateCameraPitch(-accelY * 2.0)
}
}
override fun mouseClicked(e: MouseEvent?) {
e ?: return
val width = API.GetWindowDimensions().width;
val compassBordersX = intArrayOf(width - 165, width - 125)
val compassBordersY = intArrayOf(0, 45)
if (
e.x in compassBordersX[0]..compassBordersX[1]
&& e.y in compassBordersY[0]..compassBordersY[1]
)
{
API.SetCameraPitch(defaultCameraPYZ.first)
API.SetCameraYaw(defaultCameraPYZ.second)
}
}
override fun mousePressed(e: MouseEvent?) {
e ?: return
if (SwingUtilities.isMiddleMouseButton(e)) {
lastMouseWheelX = e.x
lastMouseWheelY = e.y
}
}
}
}

View file

@ -0,0 +1,89 @@
package MiniMenuQOL
import plugin.Plugin
import plugin.annotations.PluginMeta
import plugin.api.*
import rt4.NpcList
import rt4.NpcType
import rt4.ObjType
import rt4.ObjTypeList
@PluginMeta(
author = "Ceikry",
description = "Provides debug and some basic QOL for the MiniMenu",
version = 1.0
)
class plugin : Plugin() {
private var debugEnabled = false
override fun ProcessCommand(commandStr: String?, args: Array<out String>?) {
when (commandStr) {
"::mmdebug" -> debugEnabled = !debugEnabled
}
}
override fun Draw(timeDelta: Long) {
if (!debugEnabled) return
val sb = StringBuilder()
val entries = API.GetMiniMenuEntries()
val strings = ArrayList<String>()
for (entry in entries) {
sb.append(entry.subject)
sb.append(" - ")
sb.append(entry.verb)
sb.append("(")
sb.append(entry.actionCode)
sb.append(")")
strings.add(sb.toString())
sb.clear()
}
if (debugEnabled) {
var screenY = 50
for (string in strings) {
API.DrawText(
FontType.SMALL,
FontColor.YELLOW,
TextModifier.LEFT,
string,
10,
screenY
)
screenY += 10
}
}
}
override fun DrawMiniMenu(entry: MiniMenuEntry) {
when (entry.type) {
MiniMenuType.NPC -> {
val index = entry.subjectIndex
val npc = NpcList.npcs[index.toInt()]
val type = npc.type
if (debugEnabled && entry.verb.equals("examine", true))
entry.subject = entry.subject + "(I:${entry.subjectIndex},ID:${type.id})"
if (entry.isStrictlySecondary)
entry.toggleStrictlySecondary()
}
MiniMenuType.LOCATION -> {
if (debugEnabled && entry.verb.equals("examine", true))
entry.subject = entry.subject + "(ID:${entry.subjectIndex})"
}
MiniMenuType.PLAYER -> {
if (debugEnabled && entry.verb.equals("follow", true))
entry.subject = entry.subject + "(I:${entry.subjectIndex})"
}
MiniMenuType.OBJ -> {
val def = ObjTypeList.get(entry.subjectIndex.toInt())
if (debugEnabled)
entry.subject = entry.subject + "(ID:${entry.subjectIndex})"
if (def.cost >= 1000)
entry.subject = "<col=cdd162>" + entry.subject.substring(12)
}
}
}
}

View file

@ -0,0 +1,159 @@
package SlayerTrackerPlugin
import plugin.Plugin
import plugin.annotations.PluginMeta
import plugin.api.API
import plugin.api.FontColor
import plugin.api.FontType
import plugin.api.TextModifier
import rt4.Sprite
import java.awt.Color
import java.lang.Exception
@PluginMeta(
author = "Ceikry",
description = "Draws a simple slayer task tracker onto the screen if one is active.",
version = 1.0
)
class plugin : Plugin() {
val boxColor = 6116423
val posX = 5
val posY = 30
val boxWidth = 90
val boxHeight = 30
val boxOpacity = 160
val textX = 65
val textY = 50
val spriteX = 7
val spriteY = 30
var slayerTaskID = -1
var slayerTaskAmount = 0
var curSprite: Sprite? = null
override fun Draw(deltaTime: Long) {
if (slayerTaskAmount == 0 || slayerTaskID == -1) return
API.FillRect(posX, posY, boxWidth, boxHeight, boxColor, boxOpacity)
curSprite?.render(spriteX, spriteY)
API.DrawText(
FontType.SMALL,
FontColor.fromColor(Color.WHITE),
TextModifier.LEFT,
slayerTaskAmount.toString(),
textX,
textY
)
}
override fun OnVarpUpdate(id: Int, value: Int) {
if (id == 2502) {
slayerTaskID = value and 0x7F
slayerTaskAmount = (value shr 7) and 0xFF
setSprite()
}
}
override fun OnLogout() {
slayerTaskID = -1
slayerTaskAmount = 0
curSprite = null
}
private fun setSprite() {
try {
val itemId: Int = when (slayerTaskID) {
0 -> 4144
1 -> 4149
2 -> 560
3 -> 10176
4 -> 4135
5 -> 4139
6 -> 14072
7 -> 948
8 -> 12189
9 -> 3098
10 -> 1747
11 -> 4141
12 -> 1751
13 -> 11047
14 -> 2349
15 -> 9008
16 -> 4521
17 -> 4134
18 -> 8900
19 -> 4520
20 -> 4137
21 -> 1739
22 -> 7982
23 -> 10149
24 -> 532
25 -> 8141
26 -> 6637
27 -> 6695
28 -> 8132
29 -> 4145
30 -> 7500
31 -> 1422
32 -> 1387
33 -> 9011
34 -> 4147
35 -> 552
36 -> 6722
37 -> 10998
38 -> 9016
39 -> 2402
40 -> 1753
41 -> 7050
42 -> 8137
43 -> 12570
44 -> 8133
45 -> 4671
46 -> 4671
47 -> 1159
48 -> 4140
49 -> 2351
50 -> 4142
51 -> 7778
52 -> 8139
53 -> 4146
54 -> 2402
55 -> 2359
56 -> 12079
57 -> 12201
58 -> 12570
59 -> 4148
60 -> 4818
61 -> 6107
62 -> 4138
63 -> 14074
64 -> 4136
65 -> 6297
66 -> 10634
67 -> 553
68 -> 8135
69 -> 11732
70 -> 10284
71 -> 13923
72 -> 2353
73 -> 8136
74 -> 4143
75 -> 6528
76 -> 10109
77 -> 1403
78 -> 2952
79 -> 958
80 -> 7594
89 -> 6811
else -> -1
}
val sprite = API.GetObjSprite(itemId, 1, false, 1, 1)
curSprite = sprite
} catch (ignored: Exception){}
}
//Check the source of plugin.Plugin for more methods you can override! Happy hacking! <3
//There are also many methods to aid in plugin development in plugin.api.API
}

View file

@ -0,0 +1,40 @@
package XPDropPlugin
import plugin.api.API
import rt4.Sprite
object XPSprites {
fun getSpriteForSkill(skillId: Int) : Sprite? {
return API.GetSprite(getSpriteId(skillId))
}
private fun getSpriteId(skillId: Int) : Int {
return when (skillId) {
0 -> 197
1 -> 199
2 -> 198
3 -> 203
4 -> 200
5 -> 201
6 -> 202
7 -> 212
8 -> 214
9 -> 208
10 -> 211
11 -> 213
12 -> 207
13 -> 210
14 -> 209
15 -> 205
16 -> 204
17 -> 206
18 -> 216
19 -> 217
20 -> 215
21 -> 220
22 -> 221
23 -> 222
else -> 222
}
}
}

View file

@ -0,0 +1,148 @@
package XPDropPlugin;
import plugin.Plugin
import plugin.annotations.PluginMeta
import plugin.api.*
import java.awt.Color
import kotlin.math.ceil
@PluginMeta(
author = "Ceikry",
description = "Draws nice and clean experience drops onto the screen.",
version = 1.2
)
class plugin : Plugin() {
private val displayTimeout = 10000L // 10 seconds
private val drawStart = 175
private val drawPadding = 25
private val drawClear = 60
private val lastXp = IntArray(24)
private var totalXp = 0
private val activeGains = ArrayList<XPGain>()
private var lastGain = 0L
override fun Draw(deltaTime: Long) {
if (System.currentTimeMillis() - lastGain >= displayTimeout && activeGains.isEmpty())
return
drawTotalXPBox()
val removeList = ArrayList<XPGain>()
var posX = API.GetWindowDimensions().width / 2
if (API.GetWindowMode() == WindowMode.FIXED)
posX += 60
for(gain in activeGains) {
gain.currentPos -= ceil(deltaTime / 20.0).toInt()
if (gain.currentPos <= drawClear) {
removeList.add(gain)
totalXp += gain.xp
} else if (gain.currentPos <= drawStart){
val sprite = XPSprites.getSpriteForSkill(skillId = gain.skill)
sprite?.render(posX - 25, gain.currentPos - 20)
API.DrawText(
FontType.SMALL,
FontColor.fromColor(Color.WHITE),
TextModifier.LEFT,
addCommas(gain.xp.toString()),
posX,
gain.currentPos
)
}
}
activeGains.removeAll(removeList.toSet())
}
override fun OnXPUpdate(skill: Int, xp: Int) {
if (xp == lastXp[skill]) return
val gain = xp - lastXp[skill]
if (gain <= 0) return
if (lastXp[skill] == 0) {
lastXp[skill] = xp
totalXp += xp
return
}
lastXp[skill] = xp
val currentTail = try {
activeGains.last().currentPos
} catch (e: Exception) {
drawStart - drawPadding
}
activeGains.add(XPGain(skill, gain, currentTail + drawPadding))
lastGain = System.currentTimeMillis()
}
override fun OnLogout() {
lastGain = 0L
for (i in 0 until 24) lastXp[i] = 0
totalXp = 0
activeGains.clear()
}
private fun drawTotalXPBox() {
var posX = API.GetWindowDimensions().width / 2
val posY = API.GetWindowDimensions().height / 4
if (API.GetWindowMode() == WindowMode.FIXED)
posX += 60
API.ClipRect(0, 0, posX * 2, posY * 4)
val horizontal = API.GetSprite(822)
val horizontalTop = API.GetSprite(820)
val tlCorner = API.GetSprite(824)
val blCorner = API.GetSprite(826)
val trCorner = API.GetSprite(825)
val brCorner = API.GetSprite(827)
val bg = API.GetSprite(657)
bg?.render(posX - 77, 10)
API.FillRect(posX - 75, 5, 140, 30, 0, 64)
blCorner?.render(posX - 77, 10)
tlCorner?.render(posX - 77, 5)
trCorner?.render(posX + 41, 5)
brCorner?.render(posX + 41, 10)
horizontalTop?.render(posX - 45, -8)
horizontal?.render(posX - 45, 22)
horizontalTop?.render(posX - 15, -8)
horizontal?.render(posX - 15, 22)
horizontalTop?.render(posX + 9, -8)
horizontal?.render(posX + 9, 22)
API.DrawText(
FontType.SMALL,
FontColor.fromColor(Color.WHITE),
TextModifier.LEFT,
"Total Xp: ${addCommas(totalXp.toString())}",
posX - 65,
28
)
}
data class XPGain(val skill: Int, val xp: Int, var currentPos: Int)
fun addCommas(num: String): String{
var newString = ""
if(num.length > 9){
return "Lots!"
}
var counter = 1
num.reversed().forEach {
if(counter % 3 == 0 && counter != num.length){
newString += "$it,"
} else {
newString += it
}
counter++
}
return newString.reversed()
}
}

View file

@ -17,3 +17,5 @@ include(
)
startParameter.excludedTaskNames << ':playground:run'
include 'plugin-playground'