Various mixin/injector additions

This commit is contained in:
Lucas
2019-06-08 11:58:34 +02:00
parent ffcb7b8b45
commit 2c38de7061
37 changed files with 852 additions and 158 deletions

View File

@@ -527,7 +527,7 @@ public class Inject
return Type.getType("L" + finalType.getName().replace('.', '/') + ";", type.getDimensions());
}
Type apiTypeToDeobfuscatedType(Type type) throws InjectionException
Type apiTypeToDeobfuscatedType(Type type)
{
if (type.isPrimitive())
{

View File

@@ -48,6 +48,7 @@ import net.runelite.asm.attributes.code.instruction.types.LVTInstruction;
import net.runelite.asm.attributes.code.instruction.types.PushConstantInstruction;
import net.runelite.asm.attributes.code.instruction.types.ReturnInstruction;
import net.runelite.asm.attributes.code.instructions.ALoad;
import net.runelite.asm.attributes.code.instructions.ANewArray;
import net.runelite.asm.attributes.code.instructions.CheckCast;
import net.runelite.asm.attributes.code.instructions.GetField;
import net.runelite.asm.attributes.code.instructions.ILoad;
@@ -229,10 +230,10 @@ public class MixinInjector
cf.addField(copy);
if (injectedFields.containsKey(field.getName()))
if (injectedFields.containsKey(field.getName()) && !field.getName().equals(ASSERTION_FIELD))
{
java.util.logging.Logger.getAnonymousLogger().severe("Duplicate field : "+ field.getName());
//throw new InjectionException("Injected field names must be globally unique");
throw new InjectionException("Injected field names must be globally unique");
}
injectedFields.put(field.getName(), copy);
@@ -654,6 +655,21 @@ public class MixinInjector
{
Instruction i = iterator.next();
if (i instanceof ANewArray)
{
Type type = ((ANewArray) i).getType_();
ClassFile deobCf = inject.getDeobfuscated().findClass(type.toString().replace("Lnet/runelite/rs/api/RS", "").replace(";", ""));
if (deobCf != null)
{
ClassFile obReturnTypeClass = inject.toObClass(deobCf);
Type newType = new Type("L" + obReturnTypeClass.getName() + ";");
((ANewArray) i).setType(newType);
logger.info("Replaced {} type {} with type {}", i, type, newType);
}
}
if (i instanceof InvokeInstruction)
{
InvokeInstruction ii = (InvokeInstruction) i;

View File

@@ -22,7 +22,7 @@ public class RenderDraw
private static final net.runelite.asm.pool.Method renderDraw = new net.runelite.asm.pool.Method(
new Class("net.runelite.client.callback.Hooks"),
"renderDraw",
new Signature("(Lapi/Renderable;IIIIIIIIJ)V")
new Signature("(Lnet/runelite/api/Renderable;IIIIIIIIJ)V")
);
private final Inject inject;

View File

@@ -4717,7 +4717,7 @@ public final class Client extends GameShell implements Usernamed {
var2 = GameShell.menuY;
var3 = class214.menuWidth;
var4 = AbstractWorldMapIcon.menuHeight;
int var5 = 6116423;
int var5 = 0x5d5447;
Rasterizer2D.Rasterizer2D_fillRectangle(var1, var2, var3, var4, var5);
Rasterizer2D.Rasterizer2D_fillRectangle(var1 + 1, var2 + 1, var3 - 2, 16, 0);
Rasterizer2D.Rasterizer2D_drawRectangle(var1 + 1, var2 + 18, var3 - 2, var4 - 19, 0);
@@ -4729,9 +4729,9 @@ public final class Client extends GameShell implements Usernamed {
int var10;
for(var8 = 0; var8 < menuOptionsCount; ++var8) {
var9 = var2 + (menuOptionsCount - 1 - var8) * 15 + 31;
var10 = 16777215;
var10 = 0xffffff;
if(var6 > var1 && var6 < var3 + var1 && var7 > var9 - 13 && var7 < var9 + 3) {
var10 = 16776960;
var10 = 0xffff00;
}
Font var11 = class2.fontBold12;
@@ -4762,9 +4762,9 @@ public final class Client extends GameShell implements Usernamed {
if(gameDrawingMode == 3) {
for(var1 = 0; var1 < rootWidgetCount; ++var1) {
if(__client_oq[var1]) {
Rasterizer2D.Rasterizer2D_moreAlpha(rootWidgetXs[var1], rootWidgetYs[var1], rootWidgetWidths[var1], rootWidgetHeights[var1], 16711935, 128);
Rasterizer2D.Rasterizer2D_moreAlpha(rootWidgetXs[var1], rootWidgetYs[var1], rootWidgetWidths[var1], rootWidgetHeights[var1], 0xff00ff, 128);
} else if(__client_ot[var1]) {
Rasterizer2D.Rasterizer2D_moreAlpha(rootWidgetXs[var1], rootWidgetYs[var1], rootWidgetWidths[var1], rootWidgetHeights[var1], 16711680, 128);
Rasterizer2D.Rasterizer2D_moreAlpha(rootWidgetXs[var1], rootWidgetYs[var1], rootWidgetWidths[var1], rootWidgetHeights[var1], 0xff0000, 128);
}
}
}

View File

@@ -581,7 +581,7 @@ public class FontName {
static final void method5635() {
for(int var0 = 0; var0 < Players.Players_count; ++var0) {
Player var1 = Client.players[Players.Players_indices[var0]];
var1.__u_128();
var1.clearIsInClanChat();
}
}

View File

@@ -163,7 +163,7 @@ public class GrandExchangeOffer {
static final void method121() {
for(int var0 = 0; var0 < Players.Players_count; ++var0) {
Player var1 = Client.players[Players.Players_indices[var0]];
var1.__q_125();
var1.clearIsFriend();
}
Iterator var2 = Messages.Messages_hashTable.iterator();

View File

@@ -384,7 +384,7 @@ public class IndexCacheLoader {
var0.drawCentered(Login.Login_response3, Login.__cu_y + 180, var48, 16776960, 0);
var48 += 15;
var48 += 7;
if(Login.__cu_aw != 4) {
if(Login.loginIndex != 4) {
var0.draw("Login: ", Login.__cu_y + 180 - 110, var48, 16777215, 0);
var49 = 200;
if(ReflectionCheck.clientPreferences.hideUsername) {
@@ -412,7 +412,7 @@ public class IndexCacheLoader {
if(Client.gameState == 10 || Client.gameState == 11) {
Login.__cu_o.__q_496(Login.__cu_y, 171);
short var5;
if(Login.__cu_aw == 0) {
if(Login.loginIndex == 0) {
var47 = 251;
var0.drawCentered("Welcome to RuneScape", Login.__cu_y + 180, var47, 16776960, 0);
var48 = var47 + 30;
@@ -423,7 +423,7 @@ public class IndexCacheLoader {
var24 = Login.__cu_y + 180 + 80;
__bd_u.__q_496(var24 - 73, var5 - 20);
var0.drawLines("Existing User", var24 - 73, var5 - 20, 144, 40, 16777215, 0, 1, 1, 0);
} else if(Login.__cu_aw == 1) {
} else if(Login.loginIndex == 1) {
var0.drawCentered(Login.Login_response0, Login.__cu_y + 180, 201, 16776960, 0);
var47 = 236;
var0.drawCentered(Login.Login_response1, Login.__cu_y + 180, var47, 16777215, 0);
@@ -439,7 +439,7 @@ public class IndexCacheLoader {
var24 = Login.__cu_y + 180 + 80;
__bd_u.__q_496(var24 - 73, var5 - 20);
var0.drawCentered("Cancel", var24, var5 + 5, 16777215, 0);
} else if(Login.__cu_aw == 2) {
} else if(Login.loginIndex == 2) {
var47 = 201;
var0.drawCentered(Login.Login_response1, Varps.__hv_h, var47, 16776960, 0);
var48 = var47 + 15;
@@ -504,7 +504,7 @@ public class IndexCacheLoader {
TilePaint.__eb_ah = new Bounds(Varps.__hv_h, var47, var1.stringWidth(AttackOption.__cj_ay), 11);
UrlRequester.__eo_ak = new Bounds(Varps.__hv_h, var47, var1.stringWidth("Still having trouble logging in?"), 11);
var1.drawCentered(AttackOption.__cj_ay, Varps.__hv_h, var47, 16777215, 0);
} else if(Login.__cu_aw == 3) {
} else if(Login.loginIndex == 3) {
var47 = 201;
var0.drawCentered("Invalid credentials.", Login.__cu_y + 180, var47, 16776960, 0);
var48 = var47 + 20;
@@ -522,7 +522,7 @@ public class IndexCacheLoader {
var2.drawCentered("Forgotten password?", var24, var5 + 5, 16777215, 0);
} else {
String var26;
if(Login.__cu_aw == 4) {
if(Login.loginIndex == 4) {
var0.drawCentered("Authenticator", Login.__cu_y + 180, 201, 16776960, 0);
var47 = 236;
var0.drawCentered(Login.Login_response1, Login.__cu_y + 180, var47, 16777215, 0);
@@ -532,7 +532,7 @@ public class IndexCacheLoader {
var0.drawCentered(Login.Login_response3, Login.__cu_y + 180, var48, 16777215, 0);
var48 += 15;
var26 = "PIN: ";
var7 = Login.__cu_ai;
var7 = Login.otp;
var25 = class168.method3450('*', var7.length());
var0.draw(var26 + var25 + (Client.cycle % 40 < 20?BufferedFile.colorStartTag(16776960) + "|":""), Login.__cu_y + 180 - 108, var48, 16777215, 0);
var48 -= 8;
@@ -560,7 +560,7 @@ public class IndexCacheLoader {
var1.drawCentered("<u=ff>Can\'t Log In?</u>", Login.__cu_y + 180, var12 + 36, 255, 0);
} else {
short var50;
if(Login.__cu_aw == 5) {
if(Login.loginIndex == 5) {
var0.drawCentered("Forgotten your password?", Login.__cu_y + 180, 201, 16776960, 0);
var47 = 221;
var2.drawCentered(Login.Login_response1, Login.__cu_y + 180, var47, 16776960, 0);
@@ -595,7 +595,7 @@ public class IndexCacheLoader {
var0.drawCentered("Back", var27, var50 + 5, 16777215, 0);
var50 = 356;
var1.drawCentered("Still having trouble logging in?", Varps.__hv_h, var50, 268435455, 0);
} else if(Login.__cu_aw == 6) {
} else if(Login.loginIndex == 6) {
var47 = 201;
var0.drawCentered(Login.Login_response1, Login.__cu_y + 180, var47, 16776960, 0);
var48 = var47 + 15;
@@ -607,7 +607,7 @@ public class IndexCacheLoader {
var5 = 321;
__bd_u.__q_496(var24 - 73, var5 - 20);
var0.drawCentered("Back", var24, var5 + 5, 16777215, 0);
} else if(Login.__cu_aw == 7) {
} else if(Login.loginIndex == 7) {
var47 = 216;
var0.drawCentered("Your date of birth isn\'t set.", Login.__cu_y + 180, var47, 16776960, 0);
var48 = var47 + 15;
@@ -622,7 +622,7 @@ public class IndexCacheLoader {
var24 = Login.__cu_y + 180 + 80;
__bd_u.__q_496(var24 - 73, var5 - 20);
var0.drawCentered("Back", var24, var5 + 5, 16777215, 0);
} else if(Login.__cu_aw == 8) {
} else if(Login.loginIndex == 8) {
var47 = 216;
var0.drawCentered("Sorry, but your account is not eligible to play.", Login.__cu_y + 180, var47, 16776960, 0);
var48 = var47 + 15;
@@ -637,7 +637,7 @@ public class IndexCacheLoader {
var24 = Login.__cu_y + 180 + 80;
__bd_u.__q_496(var24 - 73, var5 - 20);
var0.drawCentered("Back", var24, var5 + 5, 16777215, 0);
} else if(Login.__cu_aw == 12) {
} else if(Login.loginIndex == 12) {
var47 = 201;
String var4 = "";
var26 = "";

View File

@@ -267,7 +267,7 @@ public final class IsaacCipher {
} else if(var0 == -1) {
class54.method1089("No response from server.", "Please try using a different world.", "");
} else if(var0 == 3) {
Login.__cu_aw = 3;
Login.loginIndex = 3;
Login.__cu_ac = 1;
} else if(var0 == 4) {
class32.method578(0);
@@ -322,7 +322,7 @@ public final class IsaacCipher {
} else if(var0 == 38) {
class54.method1089("You need to vote to play!", "Visit runescape.com and vote,", "and then come back here!");
} else if(var0 == 55) {
Login.__cu_aw = 8;
Login.loginIndex = 8;
} else {
if(var0 == 56) {
class54.method1089("Enter the 6-digit code generated by your", "authenticator app.", "");
@@ -337,7 +337,7 @@ public final class IsaacCipher {
}
if(var0 == 61) {
Login.__cu_aw = 7;
Login.loginIndex = 7;
} else {
class54.method1089("Unexpected server response", "Please try using a different world.", "");
}

View File

@@ -72,8 +72,8 @@ public class Login {
@ObfuscatedGetter(
intValue = 1861681835
)
@Export("__cu_aw")
static int __cu_aw;
@Export("loginIndex")
static int loginIndex;
@ObfuscatedName("al")
@Export("Login_response0")
static String Login_response0;
@@ -99,8 +99,8 @@ public class Login {
@Export("__cu_ax")
static boolean __cu_ax;
@ObfuscatedName("ai")
@Export("__cu_ai")
static String __cu_ai;
@Export("otp")
static String otp;
@ObfuscatedName("ba")
@Export("__cu_ba")
static boolean __cu_ba;
@@ -157,7 +157,7 @@ public class Login {
Login_loadingText = "";
__cu_aj = -1;
__cu_ac = 1;
__cu_aw = 0;
loginIndex = 0;
Login_response0 = "";
Login_response1 = "";
Login_response2 = "";

View File

@@ -282,7 +282,7 @@ public class MouseHandler implements MouseListener, MouseMotionListener, FocusLi
Login.Login_response1 = "";
Login.Login_response2 = "Enter your username/email & password.";
Login.Login_response3 = "";
Login.__cu_aw = 2;
Login.loginIndex = 2;
if(var0) {
Login.Login_password = "";
}

View File

@@ -705,7 +705,7 @@ public class NpcDefinition extends DualNode {
switch(var0) {
case 2:
class54.method1089(Strings.__id_jr, Strings.__id_jv, Strings.__id_ju);
Login.__cu_aw = 6;
Login.loginIndex = 6;
break;
case 3:
class54.method1089("", "Error connecting to server.", "");

View File

@@ -305,7 +305,7 @@ public final class Player extends Actor {
@Export("isFriend")
boolean isFriend() {
if(this.isFriendTriBool == TriBool.TriBool_unknown) {
this.__w_126();
this.checkIsFriend();
}
return this.isFriendTriBool == TriBool.TriBool_true;
@@ -316,8 +316,8 @@ public final class Player extends Actor {
signature = "(I)V",
garbageValue = "-2059706128"
)
@Export("__q_125")
void __q_125() {
@Export("clearIsFriend")
void clearIsFriend() {
this.isFriendTriBool = TriBool.TriBool_unknown;
}
@@ -326,8 +326,8 @@ public final class Player extends Actor {
signature = "(I)V",
garbageValue = "2126310249"
)
@Export("__w_126")
void __w_126() {
@Export("checkIsFriend")
void checkIsFriend() {
this.isFriendTriBool = WorldMapArea.friendSystem.__t_161(this.username)?TriBool.TriBool_true:TriBool.TriBool_false;
}

View File

@@ -59,11 +59,11 @@ final class class2 implements class0 {
static void method27(AbstractIndexCache var0, AbstractIndexCache var1, boolean var2, int var3) {
if(Login.__cu_f) {
if(var3 == 4) {
Login.__cu_aw = 4;
Login.loginIndex = 4;
}
} else {
Login.__cu_aw = var3;
Login.loginIndex = var3;
Rasterizer2D.Rasterizer2D_clear();
byte[] var4 = var0.takeRecordByNames("title.jpg", "");
Login.__cu_g = class27.method438(var4);
@@ -109,7 +109,7 @@ final class class2 implements class0 {
}
class13.__i_af = 0;
Login.__cu_ai = "";
Login.otp = "";
Login.__cu_ba = true;
Login.__cu_bk = false;
if(!ReflectionCheck.clientPreferences.titleMusicDisabled) {

View File

@@ -78,7 +78,7 @@ public class class32 {
garbageValue = "972977798"
)
static void method578(int var0) {
Login.__cu_aw = 12;
Login.loginIndex = 12;
Login.__cu_aj = var0;
}

View File

@@ -190,7 +190,7 @@ public final class class54 {
int var7;
short var8;
if(Login.__cu_aw == 0) {
if(Login.loginIndex == 0) {
boolean var17 = false;
while(Decimator.method2490()) {
@@ -212,7 +212,7 @@ public final class class54 {
Login.Login_response1 = "This is a <col=00ffff>Beta<col=ffffff> world.";
Login.Login_response2 = "Your normal account will not be affected.";
Login.Login_response3 = "";
Login.__cu_aw = 1;
Login.loginIndex = 1;
class196.method3740();
} else if((Client.worldProperties & 4) != 0) {
if((Client.worldProperties & 1024) != 0) {
@@ -226,14 +226,14 @@ public final class class54 {
}
Login.Login_response0 = "Warning!";
Login.__cu_aw = 1;
Login.loginIndex = 1;
class196.method3740();
} else if((Client.worldProperties & 1024) != 0) {
Login.Login_response1 = "This is a <col=ffff00>High Risk<col=ffffff> world.";
Login.Login_response2 = "The Protect Item prayer will";
Login.Login_response3 = "not work on this world.";
Login.Login_response0 = "Warning!";
Login.__cu_aw = 1;
Login.loginIndex = 1;
class196.method3740();
} else {
MouseHandler.method1084(false);
@@ -242,11 +242,11 @@ public final class class54 {
} else {
int var18;
short var20;
if(Login.__cu_aw != 1) {
if(Login.loginIndex != 1) {
boolean var9;
int var10;
short var19;
if(Login.__cu_aw == 2) {
if(Login.loginIndex == 2) {
var19 = 201;
var18 = var19 + 52;
if(var3 == 1 && var16 >= var18 - 12 && var16 < var18 + 2) {
@@ -266,7 +266,7 @@ public final class class54 {
switch(Login.__cu_ac) {
case 1:
method1089("Please enter your username.", "If you created your account after November", "2010, this will be the creation email address.");
Login.__cu_aw = 5;
Login.loginIndex = 5;
return;
case 2:
WorldMapCacheName.method635("https://support.runescape.com/hc/en-gb", true, false);
@@ -296,11 +296,11 @@ public final class class54 {
var7 = Login.__cu_y + 180 + 80;
if(var3 == 1 && var15 >= var7 - 75 && var15 <= var7 + 75 && var16 >= var8 - 20 && var16 <= var8 + 20) {
Login.__cu_aw = 0;
Login.loginIndex = 0;
Login.Login_username = "";
Login.Login_password = "";
class13.__i_af = 0;
Login.__cu_ai = "";
Login.otp = "";
Login.__cu_ba = true;
}
@@ -341,11 +341,11 @@ public final class class54 {
}
if(IndexStoreAction.__ik_cn == 13) {
Login.__cu_aw = 0;
Login.loginIndex = 0;
Login.Login_username = "";
Login.Login_password = "";
class13.__i_af = 0;
Login.__cu_ai = "";
Login.otp = "";
Login.__cu_ba = true;
} else if(Login.currentLoginField == 0) {
if(IndexStoreAction.__ik_cn == 85 && Login.Login_username.length() > 0) {
@@ -394,7 +394,7 @@ public final class class54 {
return;
}
} else if(Login.__cu_aw == 3) {
} else if(Login.loginIndex == 3) {
var18 = Login.__cu_y + 180;
var20 = 276;
if(var3 == 1 && var15 >= var18 - 75 && var15 <= var18 + 75 && var16 >= var20 - 20 && var16 <= var20 + 20) {
@@ -405,23 +405,23 @@ public final class class54 {
var20 = 326;
if(var3 == 1 && var15 >= var18 - 75 && var15 <= var18 + 75 && var16 >= var20 - 20 && var16 <= var20 + 20) {
method1089("Please enter your username.", "If you created your account after November", "2010, this will be the creation email address.");
Login.__cu_aw = 5;
Login.loginIndex = 5;
return;
}
} else {
int var22;
if(Login.__cu_aw == 4) {
if(Login.loginIndex == 4) {
var18 = Login.__cu_y + 180 - 80;
var20 = 321;
if(var3 == 1 && var15 >= var18 - 75 && var15 <= var18 + 75 && var16 >= var20 - 20 && var16 <= var20 + 20) {
Login.__cu_ai.trim();
if(Login.__cu_ai.length() != 6) {
Login.otp.trim();
if(Login.otp.length() != 6) {
method1089("", "Please enter a 6-digit PIN.", "");
return;
}
class13.__i_af = Integer.parseInt(Login.__cu_ai);
Login.__cu_ai = "";
class13.__i_af = Integer.parseInt(Login.otp);
Login.otp = "";
class15.method184(true);
method1089("", "Connecting to server...", "");
GameShell.updateGameState(20);
@@ -438,11 +438,11 @@ public final class class54 {
var18 = Login.__cu_y + 180 + 80;
if(var3 == 1 && var15 >= var18 - 75 && var15 <= var18 + 75 && var16 >= var20 - 20 && var16 <= var20 + 20) {
Login.__cu_aw = 0;
Login.loginIndex = 0;
Login.Login_username = "";
Login.Login_password = "";
class13.__i_af = 0;
Login.__cu_ai = "";
Login.otp = "";
}
while(Decimator.method2490()) {
@@ -456,37 +456,37 @@ public final class class54 {
}
if(IndexStoreAction.__ik_cn == 13) {
Login.__cu_aw = 0;
Login.loginIndex = 0;
Login.Login_username = "";
Login.Login_password = "";
class13.__i_af = 0;
Login.__cu_ai = "";
Login.otp = "";
} else {
if(IndexStoreAction.__ik_cn == 85 && Login.__cu_ai.length() > 0) {
Login.__cu_ai = Login.__cu_ai.substring(0, Login.__cu_ai.length() - 1);
if(IndexStoreAction.__ik_cn == 85 && Login.otp.length() > 0) {
Login.otp = Login.otp.substring(0, Login.otp.length() - 1);
}
if(IndexStoreAction.__ik_cn == 84) {
Login.__cu_ai.trim();
if(Login.__cu_ai.length() != 6) {
Login.otp.trim();
if(Login.otp.length() != 6) {
method1089("", "Please enter a 6-digit PIN.", "");
return;
}
class13.__i_af = Integer.parseInt(Login.__cu_ai);
Login.__cu_ai = "";
class13.__i_af = Integer.parseInt(Login.otp);
Login.otp = "";
class15.method184(true);
method1089("", "Connecting to server...", "");
GameShell.updateGameState(20);
return;
}
if(var21 && Login.__cu_ai.length() < 6) {
Login.__cu_ai = Login.__cu_ai + GzipDecompressor.__go_ck;
if(var21 && Login.otp.length() < 6) {
Login.otp = Login.otp + GzipDecompressor.__go_ck;
}
}
}
} else if(Login.__cu_aw == 5) {
} else if(Login.loginIndex == 5) {
var18 = Login.__cu_y + 180 - 80;
var20 = 321;
if(var3 == 1 && var15 >= var18 - 75 && var15 <= var18 + 75 && var16 >= var20 - 20 && var16 <= var20 + 20) {
@@ -534,7 +534,7 @@ public final class class54 {
}
}
}
} else if(Login.__cu_aw == 6) {
} else if(Login.loginIndex == 6) {
while(true) {
do {
if(!Decimator.method2490()) {
@@ -549,13 +549,13 @@ public final class class54 {
MouseHandler.method1084(true);
}
} else if(Login.__cu_aw == 7) {
} else if(Login.loginIndex == 7) {
var18 = Login.__cu_y + 180 - 80;
var20 = 321;
if(var3 == 1 && var15 >= var18 - 75 && var15 <= var18 + 75 && var16 >= var20 - 20 && var16 <= var20 + 20) {
WorldMapCacheName.method635(Message.method1227("secure", true) + "m=dob/set_dob.ws", true, false);
method1089("", "Page has opened in a new window.", "(Please check your popup blocker.)");
Login.__cu_aw = 6;
Login.loginIndex = 6;
return;
}
@@ -563,13 +563,13 @@ public final class class54 {
if(var3 == 1 && var15 >= var18 - 75 && var15 <= var18 + 75 && var16 >= var20 - 20 && var16 <= var20 + 20) {
MouseHandler.method1084(true);
}
} else if(Login.__cu_aw == 8) {
} else if(Login.loginIndex == 8) {
var18 = Login.__cu_y + 180 - 80;
var20 = 321;
if(var3 == 1 && var15 >= var18 - 75 && var15 <= var18 + 75 && var16 >= var20 - 20 && var16 <= var20 + 20) {
WorldMapCacheName.method635("https://www.jagex.com/terms/privacy/#eight", true, false);
method1089("", "Page has opened in a new window.", "(Please check your popup blocker.)");
Login.__cu_aw = 6;
Login.loginIndex = 6;
return;
}
@@ -577,7 +577,7 @@ public final class class54 {
if(var3 == 1 && var15 >= var18 - 75 && var15 <= var18 + 75 && var16 >= var20 - 20 && var16 <= var20 + 20) {
MouseHandler.method1084(true);
}
} else if(Login.__cu_aw == 12) {
} else if(Login.loginIndex == 12) {
String var14 = "";
switch(Login.__cu_aj) {
case 0:
@@ -595,7 +595,7 @@ public final class class54 {
if(var3 == 1 && var15 >= var7 - 75 && var15 <= var7 + 75 && var16 >= var8 - 20 && var16 <= var8 + 20) {
WorldMapCacheName.method635(var14, true, false);
method1089("", "Page has opened in a new window.", "(Please check your popup blocker.)");
Login.__cu_aw = 6;
Login.loginIndex = 6;
return;
}
@@ -611,7 +611,7 @@ public final class class54 {
if(IndexStoreAction.__ik_cn == 84) {
MouseHandler.method1084(false);
} else if(IndexStoreAction.__ik_cn == 13) {
Login.__cu_aw = 0;
Login.loginIndex = 0;
}
}
@@ -623,7 +623,7 @@ public final class class54 {
var18 = Varps.__hv_h + 80;
if(var3 == 1 && var15 >= var18 - 75 && var15 <= var18 + 75 && var16 >= var20 - 20 && var16 <= var20 + 20) {
Login.__cu_aw = 0;
Login.loginIndex = 0;
}
}
}

View File

@@ -148,6 +148,13 @@ public interface Client extends GameShell
*/
void setPassword(String password);
/**
* Sets the 6 digit pin used for authenticator on login screen.
*
* @param otp one time password
*/
void setOtp(String otp);
/**
* Gets currently selected login field. 0 is username, and 1 is password.
*
@@ -155,6 +162,13 @@ public interface Client extends GameShell
*/
int getCurrentLoginField();
/**
* Gets index of current login state. 2 is username/password form, 4 is authenticator form
*
* @return current login state index
*/
int getLoginIndex();
/**
* Gets the account type of the logged in player.
*
@@ -1342,6 +1356,13 @@ public interface Client extends GameShell
*/
boolean isInInstancedRegion();
/**
* Get the number of client ticks an item has been pressed
*
* @return the number of client ticks an item has been pressed
*/
int getItemPressedDuration();
/**
* Sets whether the client is hiding entities.
* <p>
@@ -1383,7 +1404,6 @@ public interface Client extends GameShell
*/
void setClanMatesHidden(boolean state);
/**
* Sets whether the local player is hidden.
*
@@ -1585,6 +1605,19 @@ public interface Client extends GameShell
void checkClickbox(Model model, int orientation, int pitchSin, int pitchCos, int yawSin, int yawCos, int x, int y, int z, long hash);
/**
* Get the if1 widget whose item is being dragged
*
* @return
*/
Widget getIf1DraggedWidget();
/**
* Get the item index of the item being dragged on an if1 widget
* @return
*/
int getIf1DraggedItemIndex();
/**
* Sets if a widget is in target mode
*/

View File

@@ -41,6 +41,10 @@ public enum GameState
* The client is at the login screen.
*/
LOGIN_SCREEN(10),
/**
* The client is at the login screen entering authenticator code.
*/
LOGIN_SCREEN_AUTHENTICATOR(11),
/**
* There is a player logging in.
*/

View File

@@ -116,4 +116,14 @@ public interface MessageNode
* @param timestamp
*/
void setTimestamp(int timestamp);
/**
* Returns yes if the message is from a friend
*/
boolean isFromFriend();
/**
* Returns yes if the message is from a clanmate
*/
boolean isFromClanMate();
}

View File

@@ -227,11 +227,11 @@
<version>${runelite.orange.extensions.version}</version>
<scope>provided</scope>
</dependency>
<!-- <dependency>
<groupId>net.runelite</groupId>
<artifactId>extended-mixins</artifactId>
<version>${project.version}</version>
</dependency>-->
<dependency>
<groupId>net.runelite.rs</groupId>
<artifactId>runescape-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
@@ -339,6 +339,12 @@
<include>**</include>
</includes>
</filter>
<filter>
<artifact>net.runelite.rs:runescape-api</artifact>
<includes>
<include>**</include>
</includes>
</filter>
<filter>
<!-- net.runelit:client-patch -->
<artifact>net.runelit:client-patch</artifact>

View File

@@ -87,7 +87,7 @@ public class RuneLite
public static final File PROFILES_DIR = new File(RUNELITE_DIR, "profiles");
public static final File PLUGIN_DIR = new File(RUNELITE_DIR, "plugins");
public static final File SCREENSHOT_DIR = new File(RUNELITE_DIR, "screenshots");
static final RuneLiteSplashScreen splashScreen = new RuneLiteSplashScreen();
private static final RuneLiteSplashScreen splashScreen = new RuneLiteSplashScreen();
@Getter

View File

@@ -709,7 +709,7 @@ public class MenuManager
}
/**
* Adds to the map of swaps - Pre-baked Abstract entry
* Adds to the map of swaps - Pre-baked entry
*/
public void addSwap(ComparableEntry swapFrom, ComparableEntry swapTo)
{

View File

@@ -120,8 +120,10 @@ public class ChatFilterPlugin extends Plugin
}
MessageNode messageNode = (MessageNode) client.getMessages().get(messageId);
String name = messageNode.getName();
if (!shouldFilterPlayerMessage(name))
if (client.getLocalPlayer().getName().equals(messageNode.getName()) ||
!config.filterFriends() && messageNode.isFromFriend() ||
!config.filterClan() && messageNode.isFromClanMate())
{
return;
}

View File

@@ -0,0 +1,63 @@
/*
* Copyright (c) 2018, Jeremy Plsek <https://github.com/jplsek>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.runelite.client.plugins.inventorygrid;
import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem;
@ConfigGroup("inventorygrid")
public interface InventoryGridConfig extends Config
{
@ConfigItem(
keyName = "showItem",
name = "Show item",
description = "Show a preview of the item in the new slot"
)
default boolean showItem()
{
return true;
}
@ConfigItem(
keyName = "showGrid",
name = "Show grid",
description = "Show a grid on the inventory while dragging"
)
default boolean showGrid()
{
return true;
}
@ConfigItem(
keyName = "showHighlight",
name = "Highlight background",
description = "Show a green background highlight on the new slot"
)
default boolean showHighlight()
{
return true;
}
}

View File

@@ -0,0 +1,116 @@
/*
* Copyright (c) 2018, Jeremy Plsek <https://github.com/jplsek>
* Copyright (c) 2019, Adam <Adam@sigterm.info>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.runelite.client.plugins.inventorygrid;
import com.google.inject.Inject;
import java.awt.AlphaComposite;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.image.BufferedImage;
import net.runelite.api.Client;
import net.runelite.api.widgets.Widget;
import net.runelite.api.widgets.WidgetInfo;
import net.runelite.api.widgets.WidgetItem;
import net.runelite.client.game.ItemManager;
import net.runelite.client.ui.overlay.Overlay;
import net.runelite.client.ui.overlay.OverlayLayer;
import net.runelite.client.ui.overlay.OverlayPosition;
class InventoryGridOverlay extends Overlay
{
private static final int INVENTORY_SIZE = 28;
private static final int DRAG_DELAY = 5;
private static final Color HIGHLIGHT = new Color(0, 255, 0, 45);
private static final Color GRID = new Color(255, 255, 255, 45);
private final InventoryGridConfig config;
private final Client client;
private final ItemManager itemManager;
@Inject
private InventoryGridOverlay(InventoryGridConfig config, Client client, ItemManager itemManager)
{
this.itemManager = itemManager;
this.client = client;
this.config = config;
setPosition(OverlayPosition.DYNAMIC);
setLayer(OverlayLayer.ABOVE_WIDGETS);
}
@Override
public Dimension render(Graphics2D graphics)
{
final Widget if1DraggingWidget = client.getIf1DraggedWidget();
final Widget inventoryWidget = client.getWidget(WidgetInfo.INVENTORY);
if (if1DraggingWidget == null || if1DraggingWidget != inventoryWidget
|| client.getItemPressedDuration() < DRAG_DELAY)
{
return null;
}
final net.runelite.api.Point mouse = client.getMouseCanvasPosition();
final Point mousePoint = new Point(mouse.getX(), mouse.getY());
for (int i = 0; i < INVENTORY_SIZE; ++i)
{
WidgetItem widgetItem = inventoryWidget.getWidgetItem(i);
final Rectangle bounds = widgetItem.getCanvasBounds();
boolean inBounds = bounds.contains(mousePoint);
if (config.showItem() && inBounds)
{
final WidgetItem draggedItem = inventoryWidget.getWidgetItem(client.getIf1DraggedItemIndex());
final BufferedImage draggedItemImage = itemManager.getImage(draggedItem.getId());
final int x = (int) bounds.getX();
final int y = (int) bounds.getY();
graphics.setComposite(AlphaComposite.SrcOver.derive(0.3f));
graphics.drawImage(draggedItemImage, x, y, null);
graphics.setComposite(AlphaComposite.SrcOver);
}
if (config.showHighlight() && inBounds)
{
graphics.setColor(HIGHLIGHT);
graphics.fill(bounds);
}
else if (config.showGrid())
{
graphics.setColor(GRID);
graphics.fill(bounds);
}
}
return null;
}
}

View File

@@ -0,0 +1,66 @@
/*
* Copyright (c) 2018, Jeremy Plsek <https://github.com/jplsek>
* Copyright (c) 2019, Adam <Adam@sigterm.info>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.runelite.client.plugins.inventorygrid;
import com.google.inject.Inject;
import com.google.inject.Provides;
import net.runelite.client.config.ConfigManager;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.ui.overlay.OverlayManager;
@PluginDescriptor(
name = "Inventory Grid",
description = "Shows a grid over the inventory and a preview of where items will be dragged",
tags = {"items", "overlay"},
enabledByDefault = false
)
public class InventoryGridPlugin extends Plugin
{
@Inject
private InventoryGridOverlay overlay;
@Inject
private OverlayManager overlayManager;
@Override
public void startUp()
{
overlayManager.add(overlay);
}
@Override
public void shutDown()
{
overlayManager.remove(overlay);
}
@Provides
InventoryGridConfig getConfig(ConfigManager configManager)
{
return configManager.getConfig(InventoryGridConfig.class);
}
}

View File

@@ -0,0 +1,71 @@
/*
* Copyright (c) 2017, Seth <Sethtroll3@gmail.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.runelite.client.plugins.loginscreen;
import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem;
@ConfigGroup("loginscreen")
public interface LoginScreenConfig extends Config
{
@ConfigItem(
keyName = "syncusername",
name = "Sync username",
description = "Syncs the username that is currently remembered between computers"
)
default boolean syncUsername()
{
return true;
}
@ConfigItem(
keyName = "pasteenabled",
name = "Ctrl-V paste",
description = "Enables Ctrl+V pasting on the login screen"
)
default boolean pasteEnabled()
{
return false;
}
@ConfigItem(
keyName = "username",
name = "",
description = "",
hidden = true
)
default String username()
{
return "";
}
@ConfigItem(
keyName = "username",
name = "",
description = ""
)
void username(String key);
}

View File

@@ -0,0 +1,223 @@
/*
* Copyright (c) 2017, Seth <Sethtroll3@gmail.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.runelite.client.plugins.loginscreen;
import com.google.common.base.Strings;
import com.google.inject.Provides;
import java.awt.Toolkit;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.UnsupportedFlavorException;
import java.awt.event.KeyEvent;
import java.io.IOException;
import javax.inject.Inject;
import lombok.extern.slf4j.Slf4j;
import net.runelite.api.Client;
import net.runelite.api.GameState;
import net.runelite.api.events.GameStateChanged;
import net.runelite.client.events.SessionOpen;
import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.input.KeyListener;
import net.runelite.client.input.KeyManager;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.util.OSType;
@PluginDescriptor(
name = "Login Screen",
description = "Provides various enhancements for login screen"
)
@Slf4j
public class LoginScreenPlugin extends Plugin implements KeyListener
{
private static final int MAX_USERNAME_LENGTH = 254;
private static final int MAX_PASSWORD_LENGTH = 20;
private static final int MAX_PIN_LENGTH = 6;
@Inject
private Client client;
@Inject
private LoginScreenConfig config;
@Inject
private KeyManager keyManager;
private String usernameCache;
@Override
protected void startUp() throws Exception
{
applyUsername();
keyManager.registerKeyListener(this);
}
@Override
protected void shutDown() throws Exception
{
if (config.syncUsername())
{
client.getPreferences().setRememberedUsername(usernameCache);
}
keyManager.unregisterKeyListener(this);
}
@Provides
LoginScreenConfig getConfig(ConfigManager configManager)
{
return configManager.getConfig(LoginScreenConfig.class);
}
@Subscribe
public void onGameStateChanged(GameStateChanged event)
{
if (!config.syncUsername())
{
return;
}
if (event.getGameState() == GameState.LOGIN_SCREEN)
{
applyUsername();
}
else if (event.getGameState() == GameState.LOGGED_IN)
{
String username = "";
if (client.getPreferences().getRememberedUsername() != null)
{
username = client.getUsername();
}
if (config.username().equals(username))
{
return;
}
log.debug("Saving username: {}", username);
config.username(username);
}
}
@Subscribe
public void onSessionOpen(SessionOpen event)
{
// configuation for the account is available now, so update the username
applyUsername();
}
private void applyUsername()
{
if (!config.syncUsername())
{
return;
}
GameState gameState = client.getGameState();
if (gameState == GameState.LOGIN_SCREEN)
{
String username = config.username();
if (Strings.isNullOrEmpty(username))
{
return;
}
// Save it only once
if (usernameCache == null)
{
usernameCache = client.getPreferences().getRememberedUsername();
}
client.getPreferences().setRememberedUsername(username);
}
}
@Override
public void keyTyped(KeyEvent e)
{
}
@Override
public void keyPressed(KeyEvent e)
{
if (!config.pasteEnabled() || (
client.getGameState() != GameState.LOGIN_SCREEN &&
client.getGameState() != GameState.LOGIN_SCREEN_AUTHENTICATOR))
{
return;
}
// enable pasting on macOS with the Command (meta) key
boolean isModifierDown = OSType.getOSType() == OSType.MacOS ? e.isMetaDown() : e.isControlDown();
if (e.getKeyCode() == KeyEvent.VK_V && isModifierDown)
{
try
{
final String data = Toolkit
.getDefaultToolkit()
.getSystemClipboard()
.getData(DataFlavor.stringFlavor)
.toString()
.trim();
switch (client.getLoginIndex())
{
// Username/password form
case 2:
if (client.getCurrentLoginField() == 0)
{
// Truncate data to maximum username length if necessary
client.setUsername(data.substring(0, Math.min(data.length(), MAX_USERNAME_LENGTH)));
}
else
{
// Truncate data to maximum password length if necessary
client.setPassword(data.substring(0, Math.min(data.length(), MAX_PASSWORD_LENGTH)));
}
break;
// Authenticator form
case 4:
// Truncate data to maximum OTP code length if necessary
client.setOtp(data.substring(0, Math.min(data.length(), MAX_PIN_LENGTH)));
break;
}
}
catch (UnsupportedFlavorException | IOException ex)
{
log.warn("failed to fetch clipboard data", ex);
}
}
}
@Override
public void keyReleased(KeyEvent e)
{
}
}

View File

@@ -152,34 +152,24 @@ public class RuneLitePlusPlugin extends Plugin
return configManager.getConfig(RuneLitePlusConfig.class);
}
private RuneLitePlusKeyListener keyListener;
private RuneLitePlusKeyListener keyListener = new RuneLitePlusKeyListener();
private int entered = -1;
private int enterIdx;
@Override
protected void startUp() throws Exception
{
entered = -1;
enterIdx = 0;
if (getConfig(configManager).customPresence())
if (config.customPresence())
{
ClientUI.currentPresenceName = ("RuneLitePlus");
ClientUI.frame.setTitle(ClientUI.currentPresenceName);
}
if (config.customPresence())
{
RuneLiteProperties.discordAppID = rlPlusDiscordApp;
discordService.close();
discordService.init();
}
else
{
RuneLiteProperties.discordAppID = rlDiscordApp;
discordService.close();
discordService.init();
}
entered = -1;
enterIdx = 0;
}
@Subscribe
@@ -196,26 +186,20 @@ public class RuneLitePlusPlugin extends Plugin
{
ClientUI.currentPresenceName = ("RuneLitePlus");
ClientUI.frame.setTitle(ClientUI.currentPresenceName);
}
else
{
ClientUI.currentPresenceName = ("RuneLite");
ClientUI.frame.setTitle(ClientUI.currentPresenceName);
}
if (config.customPresence())
{
RuneLiteProperties.discordAppID = rlPlusDiscordApp;
discordService.close();
discordService.init();
}
else
{
ClientUI.currentPresenceName = ("RuneLite");
ClientUI.frame.setTitle(ClientUI.currentPresenceName);
RuneLiteProperties.discordAppID = rlDiscordApp;
discordService.close();
discordService.init();
}
}
else if (!config.keyboardPin())
{
entered = -1;
@@ -253,7 +237,6 @@ public class RuneLitePlusPlugin extends Plugin
}
// log.debug("Registering key listener");
keyListener = new RuneLitePlusKeyListener();
keyManager.registerKeyListener(keyListener);
}
@@ -266,7 +249,6 @@ public class RuneLitePlusPlugin extends Plugin
entered = -1;
enterIdx = 0;
keyManager.unregisterKeyListener(keyListener);
keyListener = null;
return;
}

View File

@@ -27,12 +27,14 @@
package net.runelite.client.rs;
import com.google.common.io.ByteStreams;
import io.sigpipe.jbsdiff.Diff;
import io.sigpipe.jbsdiff.InvalidHeaderException;
import io.sigpipe.jbsdiff.Patch;
import java.applet.Applet;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
@@ -46,15 +48,16 @@ import java.util.Map;
import java.util.jar.Attributes;
import java.util.jar.JarEntry;
import java.util.jar.JarInputStream;
import java.util.jar.JarOutputStream;
import java.util.jar.Manifest;
import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Singleton;
import lombok.extern.slf4j.Slf4j;
import net.runelite.api.Client;
import static net.runelite.client.rs.ClientUpdateCheckMode.AUTO;
import static net.runelite.client.rs.ClientUpdateCheckMode.CUSTOM;
import static net.runelite.client.rs.ClientUpdateCheckMode.NONE;
import static net.runelite.client.rs.ClientUpdateCheckMode.PATCH;
import net.runelite.http.api.RuneLiteAPI;
import okhttp3.Request;
import okhttp3.Response;
@@ -64,7 +67,9 @@ import org.apache.commons.compress.compressors.CompressorException;
@Singleton
public class ClientLoader
{
private static final File CUSTOMFILE = new File("replace me!");
private static final File CUSTOMFILE = new File("./injected-client/target/injected-client-1.5.27-SNAPSHOT.jar");
private static final File PATCHFILE = new File("replace me!");
private static final File OUTPUT = new File("replace me!");
private final ClientConfigLoader clientConfigLoader;
private ClientUpdateCheckMode updateCheckMode;
@@ -145,6 +150,44 @@ public class ClientLoader
}
}
if (updateCheckMode == PATCH)
{
log.debug("Creating patches");
int patchCount = 0;
Map<String, byte[]> injectedFile = new HashMap<>();
loadJar(injectedFile, CUSTOMFILE);
ByteArrayOutputStream patchOs = new ByteArrayOutputStream(756 * 1024);
Map<String, byte[]> patchJar = new HashMap<>();
for (Map.Entry<String, byte[]> file : zipFile.entrySet())
{
byte[] gamepackBytes = file.getValue();
byte[] injectedBytes = injectedFile.get(file.getKey());
byte[] patchBytes;
if (Arrays.equals(gamepackBytes, injectedBytes))
{
continue;
}
Diff.diff(gamepackBytes, injectedBytes, patchOs);
patchBytes = patchOs.toByteArray();
String patchName = file.getKey() + ".bs";
patchJar.put(patchName, patchBytes);
patchCount++;
patchOs.reset();
}
log.debug("Created patch files for {} files", patchCount);
saveJar(patchJar, PATCHFILE);
System.exit(0);
}
if (updateCheckMode == AUTO)
{
@@ -176,29 +219,7 @@ public class ClientLoader
if (updateCheckMode == CUSTOM)
{
JarInputStream fis = new JarInputStream(new FileInputStream(CUSTOMFILE));
byte[] tmp = new byte[4096];
ByteArrayOutputStream buffer = new ByteArrayOutputStream(756 * 1024);
for (; ; )
{
JarEntry metadata = fis.getNextJarEntry();
if (metadata == null)
{
break;
}
buffer.reset();
for (; ; )
{
int n = fis.read(tmp);
if (n <= -1)
{
break;
}
buffer.write(tmp, 0, n);
}
zipFile.replace(metadata.getName(), buffer.toByteArray());
}
loadJar(zipFile, CUSTOMFILE);
}
String initialClass = config.getInitialClass();
@@ -246,4 +267,48 @@ public class ClientLoader
Collection<? extends Certificate> certificates = certificateFactory.generateCertificates(ClientLoader.class.getResourceAsStream("jagex.crt"));
return certificates.toArray(new Certificate[0]);
}
private static void saveJar(Map<String, byte[]> fileMap, File toFile) throws IOException
{
try (JarOutputStream jout = new JarOutputStream(new FileOutputStream(toFile), new Manifest()))
{
for (Map.Entry<String, byte[]> entry : fileMap.entrySet())
{
JarEntry e = new JarEntry(entry.getKey());
jout.putNextEntry(e);
byte[] data = entry.getValue();
jout.write(data);
jout.closeEntry();
}
}
}
private static void loadJar(Map<String, byte[]> toMap, File fromFile) throws IOException
{
JarInputStream fis = new JarInputStream(new FileInputStream(fromFile));
byte[] tmp = new byte[4096];
ByteArrayOutputStream buffer = new ByteArrayOutputStream(756 * 1024);
for (; ; )
{
JarEntry metadata = fis.getNextJarEntry();
if (metadata == null)
{
break;
}
buffer.reset();
for (; ; )
{
int n = fis.read(tmp);
if (n <= -1)
{
break;
}
buffer.write(tmp, 0, n);
}
toMap.put(metadata.getName(), buffer.toByteArray());
}
}
}

View File

@@ -29,5 +29,6 @@ public enum ClientUpdateCheckMode
AUTO,
NONE,
VANILLA,
CUSTOM
CUSTOM,
PATCH
}

View File

@@ -5,6 +5,7 @@ import net.runelite.api.mixins.Inject;
import net.runelite.api.mixins.MethodHook;
import net.runelite.api.mixins.Mixin;
import net.runelite.api.mixins.Shadow;
import net.runelite.rs.api.RSClanChat;
import net.runelite.rs.api.RSClient;
import net.runelite.rs.api.RSMessage;
@@ -70,4 +71,13 @@ public abstract class RSMessageMixin implements RSMessage
runeLiteFormatMessage = null;
rl$timestamp = (int) (System.currentTimeMillis() / 1000L);
}
@Inject
@Override
public boolean isFromClanMate()
{
RSClanChat cc = client.getClanMemberManager();
return cc != null && cc.isMember(this.getSenderUsername());
}
}

View File

@@ -135,7 +135,7 @@ public abstract class RSTileMixin implements RSTile
wallObjectSpawned.setWallObject(current);
client.getCallbacks().post(wallObjectSpawned);
}
else if (current != null && previous != null)
else if (current != null)
{
WallObjectChanged wallObjectChanged = new WallObjectChanged();
wallObjectChanged.setTile(this);
@@ -168,7 +168,7 @@ public abstract class RSTileMixin implements RSTile
decorativeObjectSpawned.setDecorativeObject(current);
client.getCallbacks().post(decorativeObjectSpawned);
}
else if (current != null && previous != null)
else if (current != null)
{
DecorativeObjectChanged decorativeObjectChanged = new DecorativeObjectChanged();
decorativeObjectChanged.setTile(this);
@@ -201,7 +201,7 @@ public abstract class RSTileMixin implements RSTile
groundObjectSpawned.setGroundObject(current);
client.getCallbacks().post(groundObjectSpawned);
}
else if (current != null && previous != null)
else if (current != null)
{
GroundObjectChanged groundObjectChanged = new GroundObjectChanged();
groundObjectChanged.setTile(this);
@@ -263,7 +263,7 @@ public abstract class RSTileMixin implements RSTile
gameObjectSpawned.setGameObject(current);
client.getCallbacks().post(gameObjectSpawned);
}
else if (current != null && previous != null)
else if (current != null)
{
GameObjectChanged gameObjectsChanged = new GameObjectChanged();
gameObjectsChanged.setTile(this);

View File

@@ -258,6 +258,11 @@ public abstract class RSWidgetMixin implements RSWidget
for (int i = 0; i < itemIds.length; ++i)
{
if (itemIds[i] <= 0)
{
continue;
}
WidgetItem item = getWidgetItem(i);
if (item != null)
@@ -287,17 +292,15 @@ public abstract class RSWidgetMixin implements RSWidget
int itemId = itemIds[index];
int itemQuantity = itemQuantities[index];
Point widgetCanvasLocation = getCanvasLocation();
if (itemId <= 0 || itemQuantity <= 0 || columns <= 0)
if (columns <= 0)
{
return null;
}
int row = index / columns;
int col = index % columns;
int itemX = widgetCanvasLocation.getX() + ((ITEM_SLOT_SIZE + xPitch) * col);
int itemY = widgetCanvasLocation.getY() + ((ITEM_SLOT_SIZE + yPitch) * row);
int itemX = rl$x + ((ITEM_SLOT_SIZE + xPitch) * col);
int itemY = rl$y + ((ITEM_SLOT_SIZE + yPitch) * row);
Rectangle bounds = new Rectangle(itemX - 1, itemY - 1, ITEM_SLOT_SIZE, ITEM_SLOT_SIZE);
return new WidgetItem(itemId - 1, itemQuantity, index, bounds, this);

View File

@@ -252,10 +252,18 @@ public interface RSClient extends RSGameShell, Client
@Override
void setPassword(String password);
@Import("otp")
@Override
void setOtp(String otp);
@Import("currentLoginField")
@Override
int getCurrentLoginField();
@Import("loginIndex")
@Override
int getLoginIndex();
@Import("playerMenuActions")
@Override
String[] getPlayerOptions();
@@ -502,8 +510,6 @@ public interface RSClient extends RSGameShell, Client
/**
* Get the widget top group. widgets[topGroup] contains widgets with
* parentId -1, which are the widget roots.
*
* @return
*/
@Import("rootWidgetGroup")
int getWidgetRoot();
@@ -778,6 +784,7 @@ public interface RSClient extends RSGameShell, Client
boolean isInInstancedRegion();
@Import("itemDragDuration")
@Override
int getItemPressedDuration();
@Import("itemDragDuration")
@@ -930,6 +937,14 @@ public interface RSClient extends RSGameShell, Client
@Import("Rasterizer2D_yClipEnd")
int getEndY();
@Import("dragInventoryWidget")
@Override
RSWidget getIf1DraggedWidget();
@Import("dragItemSlotSource")
@Override
int getIf1DraggedItemIndex();
@Import("isSpellSelected")
@Override
void setSpellSelected(boolean selected);
@@ -975,6 +990,7 @@ public interface RSClient extends RSGameShell, Client
RSEvictingDualNodeHashTable getHealthBarCache();
@Import("renderSelf")
@Override
void setRenderSelf(boolean enabled);
@Import("mouseRecorder")

View File

@@ -4,6 +4,6 @@ import net.runelite.mapping.Import;
public interface RSIterableNodeDeque
{
@Import("current")
@Import("sentinel")
RSNode getCurrent();
}

View File

@@ -35,4 +35,11 @@ public interface RSMessage extends MessageNode
@Import("text")
@Override
void setValue(String value);
@Import("isFromFriend")
@Override
boolean isFromFriend();
@Import("senderUsername")
RSUsername getSenderUsername();
}

View File

@@ -132,11 +132,11 @@ under the License.
</server>
-->
<server>
<!-- <server>
<id>runelite</id>
<username>repo</username>
<password>${env.REPO_PASSWORD}</password>
</server>
</server>-->
</servers>