mirror of
https://gitlab.com/2009scape/rt4-client.git
synced 2025-12-09 16:45:46 -07:00
KondoKit v1.0 Plugin
This commit is contained in:
parent
8462065bcf
commit
80960edaeb
20 changed files with 133161 additions and 77 deletions
|
|
@ -92,11 +92,32 @@ public abstract class Plugin {
|
|||
*/
|
||||
public void OnLogin() {}
|
||||
|
||||
|
||||
/**
|
||||
* Called when an NPC is killed.
|
||||
*
|
||||
* @param npcID the unique identifier of the NPC
|
||||
* @param x the x-coordinate where the NPC died
|
||||
* @param z the z-coordinate where the NPC died
|
||||
*/
|
||||
public void OnKillingBlowNPC(int npcID, int x, int z) {}
|
||||
|
||||
/**
|
||||
* OnLogout is called when the client logs out. This should be used to clear player-relevant plugin state.
|
||||
*/
|
||||
public void OnLogout() {}
|
||||
|
||||
/**
|
||||
* Called when the client attempts to reload plugins.
|
||||
* Implement this method to control the behavior of the plugin during a reload.
|
||||
*
|
||||
* @return {@code false} to allow the plugin to be reloaded.
|
||||
* {@code true} to prevent the plugin from being reloaded and stay loaded,
|
||||
*/
|
||||
public boolean OnPluginsReloaded() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* DrawMiniMenu is called when a MiniMenu entry has been created.
|
||||
* @param entry the entry
|
||||
|
|
|
|||
|
|
@ -43,7 +43,23 @@ public class PluginRepository {
|
|||
API.registeredWheelListeners.clear();
|
||||
API.registeredMouseListeners.clear();
|
||||
API.registeredKeyListeners.clear();
|
||||
|
||||
HashMap<PluginInfo, Plugin> pluginsToKeep = new HashMap<>();
|
||||
|
||||
// Check and store plugins with OnPluginsReloaded method
|
||||
loadedPlugins.forEach((info, plugin) -> {
|
||||
try {
|
||||
boolean keep = plugin.OnPluginsReloaded();
|
||||
if (keep) {
|
||||
pluginsToKeep.put(info, plugin);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
|
||||
loadedPlugins.clear();
|
||||
loadedPlugins.putAll(pluginsToKeep);
|
||||
SaveStorage();
|
||||
Init();
|
||||
}
|
||||
|
|
@ -98,6 +114,11 @@ public class PluginRepository {
|
|||
continue;
|
||||
}
|
||||
|
||||
if (loadedPlugins.containsKey(info)) {
|
||||
System.out.println("Skipping reloading of plugin " + file.getName() + " as it already exists and has OnPluginsReloaded.");
|
||||
continue;
|
||||
}
|
||||
|
||||
try {
|
||||
Plugin thisPlugin = (Plugin) clazz.newInstance();
|
||||
thisPlugin._init();
|
||||
|
|
@ -179,6 +200,10 @@ public class PluginRepository {
|
|||
loadedPlugins.values().forEach((plugin) -> plugin.OnLogin());
|
||||
}
|
||||
|
||||
public static void OnKillingBlowNPC(int npcId, int x, int z) {
|
||||
loadedPlugins.values().forEach((plugin) -> plugin.OnKillingBlowNPC(npcId, x, z));
|
||||
}
|
||||
|
||||
public static void SaveStorage() {
|
||||
if (pluginStorage.containsKey("_keystoreDirty")) {
|
||||
pluginStorage.remove("_keystoreDirty");
|
||||
|
|
|
|||
|
|
@ -32,6 +32,10 @@ public final class GlIndexedSprite extends IndexedSprite {
|
|||
@OriginalMember(owner = "client!oh", name = "q", descriptor = "I")
|
||||
private int anInt4284 = 0;
|
||||
|
||||
public byte[] pixels;
|
||||
|
||||
public int[] pallet;
|
||||
|
||||
@OriginalMember(owner = "client!oh", name = "<init>", descriptor = "(IIIIII[B[I)V")
|
||||
public GlIndexedSprite(@OriginalArg(0) int arg0, @OriginalArg(1) int arg1, @OriginalArg(2) int arg2, @OriginalArg(3) int arg3, @OriginalArg(4) int arg4, @OriginalArg(5) int arg5, @OriginalArg(6) byte[] arg6, @OriginalArg(7) int[] arg7) {
|
||||
this.innerWidth = arg0;
|
||||
|
|
@ -40,6 +44,8 @@ public final class GlIndexedSprite extends IndexedSprite {
|
|||
this.yOffset = arg3;
|
||||
this.width = arg4;
|
||||
this.height = arg5;
|
||||
this.pixels = arg6;
|
||||
this.pallet = arg7;
|
||||
this.method3337(arg6, arg7);
|
||||
this.method3339();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,6 +26,8 @@ public class GlSprite extends Sprite {
|
|||
@OriginalMember(owner = "client!cf", name = "ab", descriptor = "I")
|
||||
public int textureId = -1;
|
||||
|
||||
public int[] pixels;
|
||||
|
||||
@OriginalMember(owner = "client!cf", name = "Z", descriptor = "I")
|
||||
private int anInt1871 = -1;
|
||||
|
||||
|
|
@ -40,6 +42,7 @@ public class GlSprite extends Sprite {
|
|||
this.anInt1861 = arg3;
|
||||
this.width = arg4;
|
||||
this.height = arg5;
|
||||
this.pixels = arg6;
|
||||
this.method1430(arg6);
|
||||
this.method1431();
|
||||
}
|
||||
|
|
@ -52,6 +55,7 @@ public class GlSprite extends Sprite {
|
|||
this.anInt1861 = arg0.anInt1861;
|
||||
this.width = arg0.width;
|
||||
this.height = arg0.height;
|
||||
this.pixels = arg0.pixels;
|
||||
this.method1430(arg0.pixels);
|
||||
this.method1431();
|
||||
}
|
||||
|
|
@ -515,4 +519,4 @@ public class GlSprite extends Sprite {
|
|||
gl.glEnd();
|
||||
gl.glEndList();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3034,6 +3034,7 @@ public class Protocol {
|
|||
|
||||
boolean isKillingBlow = (local18 & 0x80) != 0;
|
||||
if (isKillingBlow) {
|
||||
PluginRepository.OnKillingBlowNPC(npc.type.id,npc.movementQueueX[0],npc.movementQueueZ[0]);
|
||||
local43 = inboundBuffer.g2add();
|
||||
if (local43 == 65535) {
|
||||
local43 = -1;
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ public final class SoftwareIndexedSprite extends IndexedSprite {
|
|||
public byte[] pixels;
|
||||
|
||||
@OriginalMember(owner = "client!ek", name = "n", descriptor = "[I")
|
||||
private final int[] anIntArray144;
|
||||
public final int[] pallet;
|
||||
|
||||
@OriginalMember(owner = "client!ek", name = "<init>", descriptor = "(IIIIII[B[I)V")
|
||||
public SoftwareIndexedSprite(@OriginalArg(0) int arg0, @OriginalArg(1) int arg1, @OriginalArg(2) int arg2, @OriginalArg(3) int arg3, @OriginalArg(4) int arg4, @OriginalArg(5) int arg5, @OriginalArg(6) byte[] arg6, @OriginalArg(7) int[] arg7) {
|
||||
|
|
@ -23,7 +23,7 @@ public final class SoftwareIndexedSprite extends IndexedSprite {
|
|||
this.width = arg4;
|
||||
this.height = arg5;
|
||||
this.pixels = arg6;
|
||||
this.anIntArray144 = arg7;
|
||||
this.pallet = arg7;
|
||||
}
|
||||
|
||||
@OriginalMember(owner = "client!ek", name = "<init>", descriptor = "(III)V")
|
||||
|
|
@ -32,7 +32,7 @@ public final class SoftwareIndexedSprite extends IndexedSprite {
|
|||
this.innerHeight = this.height = arg1;
|
||||
this.xOffset = this.yOffset = 0;
|
||||
this.pixels = new byte[arg0 * arg1];
|
||||
this.anIntArray144 = new int[arg2];
|
||||
this.pallet = new int[arg2];
|
||||
}
|
||||
|
||||
@OriginalMember(owner = "client!ek", name = "a", descriptor = "([I[B[IIIIIIIIII)V")
|
||||
|
|
@ -149,29 +149,29 @@ public final class SoftwareIndexedSprite extends IndexedSprite {
|
|||
|
||||
@OriginalMember(owner = "client!ek", name = "b", descriptor = "(III)V")
|
||||
public final void adjustPalette(@OriginalArg(0) int arg0, @OriginalArg(1) int arg1, @OriginalArg(2) int arg2) {
|
||||
for (@Pc(1) int local1 = 0; local1 < this.anIntArray144.length; local1++) {
|
||||
@Pc(15) int local15 = this.anIntArray144[local1] >> 16 & 0xFF;
|
||||
for (@Pc(1) int local1 = 0; local1 < this.pallet.length; local1++) {
|
||||
@Pc(15) int local15 = this.pallet[local1] >> 16 & 0xFF;
|
||||
local15 += arg0;
|
||||
if (local15 < 0) {
|
||||
local15 = 0;
|
||||
} else if (local15 > 255) {
|
||||
local15 = 255;
|
||||
}
|
||||
@Pc(38) int local38 = this.anIntArray144[local1] >> 8 & 0xFF;
|
||||
@Pc(38) int local38 = this.pallet[local1] >> 8 & 0xFF;
|
||||
local38 += arg1;
|
||||
if (local38 < 0) {
|
||||
local38 = 0;
|
||||
} else if (local38 > 255) {
|
||||
local38 = 255;
|
||||
}
|
||||
@Pc(59) int local59 = this.anIntArray144[local1] & 0xFF;
|
||||
@Pc(59) int local59 = this.pallet[local1] & 0xFF;
|
||||
local59 += arg2;
|
||||
if (local59 < 0) {
|
||||
local59 = 0;
|
||||
} else if (local59 > 255) {
|
||||
local59 = 255;
|
||||
}
|
||||
this.anIntArray144[local1] = (local15 << 16) + (local38 << 8) + local59;
|
||||
this.pallet[local1] = (local15 << 16) + (local38 << 8) + local59;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -226,7 +226,7 @@ public final class SoftwareIndexedSprite extends IndexedSprite {
|
|||
local7 += local21 * local145;
|
||||
local125 += local145;
|
||||
}
|
||||
method1394(SoftwareRaster.pixels, this.pixels, this.anIntArray144, local7, local9, local41, local125, arg2, arg3, local21, local27, local2, arg4);
|
||||
method1394(SoftwareRaster.pixels, this.pixels, this.pallet, local7, local9, local41, local125, arg2, arg3, local21, local27, local2, arg4);
|
||||
}
|
||||
|
||||
@OriginalMember(owner = "client!ek", name = "a", descriptor = "()V")
|
||||
|
|
@ -309,7 +309,7 @@ public final class SoftwareIndexedSprite extends IndexedSprite {
|
|||
local27 += local36;
|
||||
}
|
||||
if (local23 > 0 && local20 > 0) {
|
||||
method1397(SoftwareRaster.pixels, this.pixels, this.anIntArray144, local17, local15, local23, local20, local27, local29, arg2);
|
||||
method1397(SoftwareRaster.pixels, this.pixels, this.pallet, local17, local15, local23, local20, local27, local29, arg2);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -383,7 +383,7 @@ public final class SoftwareIndexedSprite extends IndexedSprite {
|
|||
local7 += local21 * local145;
|
||||
local125 += local145;
|
||||
}
|
||||
method1391(SoftwareRaster.pixels, this.pixels, this.anIntArray144, local7, local9, local41, local125, arg2, arg3, local21, local27, local2);
|
||||
method1391(SoftwareRaster.pixels, this.pixels, this.pallet, local7, local9, local41, local125, arg2, arg3, local21, local27, local2);
|
||||
}
|
||||
|
||||
@OriginalMember(owner = "client!ek", name = "a", descriptor = "(II)V")
|
||||
|
|
@ -424,7 +424,7 @@ public final class SoftwareIndexedSprite extends IndexedSprite {
|
|||
local27 += local36;
|
||||
}
|
||||
if (local23 > 0 && local20 > 0) {
|
||||
method1393(SoftwareRaster.pixels, this.pixels, this.anIntArray144, local17, local15, local23, local20, local27, local29);
|
||||
method1393(SoftwareRaster.pixels, this.pixels, this.pallet, local17, local15, local23, local20, local27, local29);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -350,15 +350,15 @@ public final class client extends GameShell {
|
|||
|
||||
@OriginalMember(owner = "client!pl", name = "a", descriptor = "(II)V")
|
||||
public static void setGameState(@OriginalArg(0) int arg0) {
|
||||
if(arg0 == 30) {
|
||||
PluginRepository.OnLogin();
|
||||
}
|
||||
if (gameState == arg0) {
|
||||
return;
|
||||
}
|
||||
if (gameState == 0) {
|
||||
LoadingBarAwt.clear();
|
||||
}
|
||||
if (gameState == 30) {
|
||||
PluginRepository.OnLogin();
|
||||
}
|
||||
if (arg0 == 40) {
|
||||
LoginManager.clear();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue