Replace opcode constants with ScriptOpcodes field refs in rsclient

This commit is contained in:
Lucas
2019-07-07 00:19:36 +02:00
parent 742bf7338d
commit aaea8ec0d5
32 changed files with 916 additions and 427 deletions

View File

@@ -2,6 +2,7 @@ import net.runelite.mapping.Export;
import net.runelite.mapping.Implements;
import net.runelite.mapping.ObfuscatedName;
import net.runelite.mapping.ObfuscatedSignature;
import net.runelite.rs.ScriptOpcodes;
@ObfuscatedName("kx")
@Implements("FontName")
@@ -96,7 +97,7 @@ public class FontName {
garbageValue = "-1336396061"
)
static int method5639(int var0, Script var1, boolean var2) {
if (var0 == 3600) {
if (var0 == ScriptOpcodes.FRIEND_COUNT) {
if (WorldMapArea.friendSystem.field357 == 0) {
Interpreter.Interpreter_intStack[++RouteStrategy.Interpreter_intStackSize - 1] = -2;
} else if (WorldMapArea.friendSystem.field357 == 1) {
@@ -108,7 +109,7 @@ public class FontName {
return 1;
} else {
int var3;
if (var0 == 3601) {
if (var0 == ScriptOpcodes.FRIEND_GETNAME) {
var3 = Interpreter.Interpreter_intStack[--RouteStrategy.Interpreter_intStackSize];
if (WorldMapArea.friendSystem.method99() && var3 >= 0 && var3 < WorldMapArea.friendSystem.friendsList.size()) {
Friend var6 = (Friend)WorldMapArea.friendSystem.friendsList.get(var3);
@@ -120,7 +121,7 @@ public class FontName {
}
return 1;
} else if (var0 == 3602) {
} else if (var0 == ScriptOpcodes.FRIEND_GETWORLD) {
var3 = Interpreter.Interpreter_intStack[--RouteStrategy.Interpreter_intStackSize];
if (WorldMapArea.friendSystem.method99() && var3 >= 0 && var3 < WorldMapArea.friendSystem.friendsList.size()) {
Interpreter.Interpreter_intStack[++RouteStrategy.Interpreter_intStackSize - 1] = ((Buddy)WorldMapArea.friendSystem.friendsList.get(var3)).world0;
@@ -129,7 +130,7 @@ public class FontName {
}
return 1;
} else if (var0 == 3603) {
} else if (var0 == ScriptOpcodes.FRIEND_GETRANK) {
var3 = Interpreter.Interpreter_intStack[--RouteStrategy.Interpreter_intStackSize];
if (WorldMapArea.friendSystem.method99() && var3 >= 0 && var3 < WorldMapArea.friendSystem.friendsList.size()) {
Interpreter.Interpreter_intStack[++RouteStrategy.Interpreter_intStackSize - 1] = ((Buddy)WorldMapArea.friendSystem.friendsList.get(var3)).rank;
@@ -140,33 +141,33 @@ public class FontName {
return 1;
} else {
String var4;
if (var0 == 3604) {
if (var0 == ScriptOpcodes.FRIEND_SETRANK) {
var4 = Interpreter.Interpreter_stringStack[--Interpreter.Interpreter_stringStackSize];
int var8 = Interpreter.Interpreter_intStack[--RouteStrategy.Interpreter_intStackSize];
method5638(var4, var8);
return 1;
} else if (var0 == 3605) {
} else if (var0 == ScriptOpcodes.FRIEND_ADD) {
var4 = Interpreter.Interpreter_stringStack[--Interpreter.Interpreter_stringStackSize];
WorldMapArea.friendSystem.method103(var4);
WorldMapArea.friendSystem.addFriend(var4);
return 1;
} else if (var0 == 3606) {
} else if (var0 == ScriptOpcodes.FRIEND_DEL) {
var4 = Interpreter.Interpreter_stringStack[--Interpreter.Interpreter_stringStackSize];
WorldMapArea.friendSystem.removeFriend(var4);
return 1;
} else if (var0 == 3607) {
} else if (var0 == ScriptOpcodes.IGNORE_ADD) {
var4 = Interpreter.Interpreter_stringStack[--Interpreter.Interpreter_stringStackSize];
WorldMapArea.friendSystem.method105(var4);
WorldMapArea.friendSystem.addIgnore(var4);
return 1;
} else if (var0 == 3608) {
} else if (var0 == ScriptOpcodes.IGNORE_DEL) {
var4 = Interpreter.Interpreter_stringStack[--Interpreter.Interpreter_stringStackSize];
WorldMapArea.friendSystem.removeIgnore(var4);
return 1;
} else if (var0 == 3609) {
} else if (var0 == ScriptOpcodes.FRIEND_TEST) {
var4 = Interpreter.Interpreter_stringStack[--Interpreter.Interpreter_stringStackSize];
var4 = NPCDefinition.method5161(var4);
Interpreter.Interpreter_intStack[++RouteStrategy.Interpreter_intStackSize - 1] = WorldMapArea.friendSystem.isFriended(new Username(var4, KeyHandler.loginType), false) ? 1 : 0;
return 1;
} else if (var0 == 3611) {
} else if (var0 == ScriptOpcodes.CLAN_GETCHATDISPLAYNAME) {
if (PacketWriter.clanChat != null) {
Interpreter.Interpreter_stringStack[++Interpreter.Interpreter_stringStackSize - 1] = PacketWriter.clanChat.name;
} else {
@@ -174,7 +175,7 @@ public class FontName {
}
return 1;
} else if (var0 == 3612) {
} else if (var0 == ScriptOpcodes.CLAN_GETCHATCOUNT) {
if (PacketWriter.clanChat != null) {
Interpreter.Interpreter_intStack[++RouteStrategy.Interpreter_intStackSize - 1] = PacketWriter.clanChat.size();
} else {
@@ -182,7 +183,7 @@ public class FontName {
}
return 1;
} else if (var0 == 3613) {
} else if (var0 == ScriptOpcodes.CLAN_GETCHATUSERNAME) {
var3 = Interpreter.Interpreter_intStack[--RouteStrategy.Interpreter_intStackSize];
if (PacketWriter.clanChat != null && var3 < PacketWriter.clanChat.size()) {
Interpreter.Interpreter_stringStack[++Interpreter.Interpreter_stringStackSize - 1] = PacketWriter.clanChat.get(var3).username().getName();
@@ -191,7 +192,7 @@ public class FontName {
}
return 1;
} else if (var0 == 3614) {
} else if (var0 == ScriptOpcodes.CLAN_GETCHATUSERWORLD) {
var3 = Interpreter.Interpreter_intStack[--RouteStrategy.Interpreter_intStackSize];
if (PacketWriter.clanChat != null && var3 < PacketWriter.clanChat.size()) {
Interpreter.Interpreter_intStack[++RouteStrategy.Interpreter_intStackSize - 1] = ((Buddy)PacketWriter.clanChat.get(var3)).world();
@@ -200,7 +201,7 @@ public class FontName {
}
return 1;
} else if (var0 == 3615) {
} else if (var0 == ScriptOpcodes.CLAN_GETCHATUSERRANK) {
var3 = Interpreter.Interpreter_intStack[--RouteStrategy.Interpreter_intStackSize];
if (PacketWriter.clanChat != null && var3 < PacketWriter.clanChat.size()) {
Interpreter.Interpreter_intStack[++RouteStrategy.Interpreter_intStackSize - 1] = ((Buddy)PacketWriter.clanChat.get(var3)).rank;
@@ -209,24 +210,24 @@ public class FontName {
}
return 1;
} else if (var0 == 3616) {
} else if (var0 == ScriptOpcodes.CLAN_GETCHATMINKICK) {
Interpreter.Interpreter_intStack[++RouteStrategy.Interpreter_intStackSize - 1] = PacketWriter.clanChat != null ? PacketWriter.clanChat.field96 : 0;
return 1;
} else if (var0 == 3617) {
} else if (var0 == ScriptOpcodes.CLAN_KICKUSER) {
var4 = Interpreter.Interpreter_stringStack[--Interpreter.Interpreter_stringStackSize];
IndexStoreActionHandler.method4655(var4);
return 1;
} else if (var0 == 3618) {
} else if (var0 == ScriptOpcodes.CLAN_GETCHATRANK) {
Interpreter.Interpreter_intStack[++RouteStrategy.Interpreter_intStackSize - 1] = PacketWriter.clanChat != null ? PacketWriter.clanChat.rank : 0;
return 1;
} else if (var0 == 3619) {
} else if (var0 == ScriptOpcodes.CLAN_JOINCHAT) {
var4 = Interpreter.Interpreter_stringStack[--Interpreter.Interpreter_stringStackSize];
class31.method574(var4);
return 1;
} else if (var0 == 3620) {
} else if (var0 == ScriptOpcodes.CLAN_LEAVECHAT) {
class12.method158();
return 1;
} else if (var0 == 3621) {
} else if (var0 == ScriptOpcodes.IGNORE_COUNT) {
if (!WorldMapArea.friendSystem.method99()) {
Interpreter.Interpreter_intStack[++RouteStrategy.Interpreter_intStackSize - 1] = -1;
} else {
@@ -234,7 +235,7 @@ public class FontName {
}
return 1;
} else if (var0 == 3622) {
} else if (var0 == ScriptOpcodes.IGNORE_GETNAME) {
var3 = Interpreter.Interpreter_intStack[--RouteStrategy.Interpreter_intStackSize];
if (WorldMapArea.friendSystem.method99() && var3 >= 0 && var3 < WorldMapArea.friendSystem.ignoreList.size()) {
Ignored var7 = (Ignored)WorldMapArea.friendSystem.ignoreList.get(var3);
@@ -246,12 +247,12 @@ public class FontName {
}
return 1;
} else if (var0 == 3623) {
} else if (var0 == ScriptOpcodes.IGNORE_TEST) {
var4 = Interpreter.Interpreter_stringStack[--Interpreter.Interpreter_stringStackSize];
var4 = NPCDefinition.method5161(var4);
Interpreter.Interpreter_intStack[++RouteStrategy.Interpreter_intStackSize - 1] = WorldMapArea.friendSystem.isIgnored(new Username(var4, KeyHandler.loginType)) ? 1 : 0;
return 1;
} else if (var0 == 3624) {
} else if (var0 == ScriptOpcodes.CLAN_ISSELF) {
var3 = Interpreter.Interpreter_intStack[--RouteStrategy.Interpreter_intStackSize];
if (PacketWriter.clanChat != null && var3 < PacketWriter.clanChat.size() && PacketWriter.clanChat.get(var3).username().equals(Canvas.localPlayer.username)) {
Interpreter.Interpreter_intStack[++RouteStrategy.Interpreter_intStackSize - 1] = 1;
@@ -260,7 +261,7 @@ public class FontName {
}
return 1;
} else if (var0 == 3625) {
} else if (var0 == ScriptOpcodes.CLAN_GETCHATOWNERNAME) {
if (PacketWriter.clanChat != null && PacketWriter.clanChat.owner != null) {
Interpreter.Interpreter_stringStack[++Interpreter.Interpreter_stringStackSize - 1] = PacketWriter.clanChat.owner;
} else {
@@ -268,7 +269,7 @@ public class FontName {
}
return 1;
} else if (var0 == 3626) {
} else if (var0 == ScriptOpcodes.CLAN_ISFRIEND) {
var3 = Interpreter.Interpreter_intStack[--RouteStrategy.Interpreter_intStackSize];
if (PacketWriter.clanChat != null && var3 < PacketWriter.clanChat.size() && ((ClanMate)PacketWriter.clanChat.get(var3)).isFriend()) {
Interpreter.Interpreter_intStack[++RouteStrategy.Interpreter_intStackSize - 1] = 1;
@@ -277,7 +278,7 @@ public class FontName {
}
return 1;
} else if (var0 != 3627) {
} else if (var0 != ScriptOpcodes.CLAN_ISIGNORE) {
if (var0 == 3628) {
WorldMapArea.friendSystem.friendsList.removeComparator();
return 1;