2006Scape compatibility
- Fix welcome-back interface rendering and player icon decoding - Configure world-aware login and on-demand connections - Add Java Sound playback and restart title music after logout - Target Java 8 builds
This commit is contained in:
1 parent
87fdd5eea9
commit
b7ce15cbbf
8 files changed
+333
-60
No files matched your search
Vendored
+16
@@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
// Use IntelliSense to learn about possible attributes.
|
||||||
|
// Hover to view descriptions of existing attributes.
|
||||||
|
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||||
|
"version": "0.2.0",
|
||||||
|
"configurations": [
|
||||||
|
|
||||||
|
{
|
||||||
|
"type": "jdk",
|
||||||
|
"request": "launch",
|
||||||
|
"name": "Launch Client",
|
||||||
|
"mainClass": "Game",
|
||||||
|
"args": "0 0 highmem members 0"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -17,8 +17,8 @@
|
|||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<version>3.13.0</version>
|
<version>3.13.0</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<source>21</source>
|
<source>1.8</source>
|
||||||
<target>21</target>
|
<target>1.8</target>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
|
||||||
|
import java.math.BigInteger;
|
||||||
|
|
||||||
|
public class ClientSettings {
|
||||||
|
|
||||||
|
public static final String SERVER_HOST = "server.2006scape.org";
|
||||||
|
public static final int SERVER_WORLD = 1;
|
||||||
|
public static final boolean SINGLE_ONDEMAND = true;
|
||||||
|
public static final String SERVER_NAME = "2006Scape";
|
||||||
|
public static final BigInteger RSA_MODULUS = new BigInteger("91553247461173033466542043374346300088148707506479543786501537350363031301992107112953015516557748875487935404852620239974482067336878286174236183516364787082711186740254168914127361643305190640280157664988536979163450791820893999053469529344247707567448479470137716627440246788713008490213212272520901741443");
|
||||||
|
public static final BigInteger RSA_EXPONENT = new BigInteger("65537");
|
||||||
|
|
||||||
|
public static int getWorldPort(int portOffset) {
|
||||||
|
return (SERVER_WORLD == 1) ? (43594 + portOffset) : (43596 + SERVER_WORLD + portOffset);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int getOnDemandPort(int portOffset) {
|
||||||
|
return (SINGLE_ONDEMAND || (SERVER_WORLD == 1)) ? 43594 : getWorldPort(portOffset);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
+154
-47
@@ -2,15 +2,13 @@
|
|||||||
// Jad home page: http://www.kpdus.com/jad.html
|
// Jad home page: http://www.kpdus.com/jad.html
|
||||||
// Decompiler options: packimports(3)
|
// Decompiler options: packimports(3)
|
||||||
|
|
||||||
import org.apache.commons.math3.random.ISAACRandom;
|
import java.awt.Color;
|
||||||
|
import java.awt.Graphics;
|
||||||
import java.awt.*;
|
|
||||||
import java.awt.event.KeyEvent;
|
import java.awt.event.KeyEvent;
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
import java.io.EOFException;
|
import java.io.EOFException;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.math.BigInteger;
|
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
import java.net.Socket;
|
import java.net.Socket;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
@@ -18,13 +16,15 @@ import java.net.UnknownHostException;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.zip.CRC32;
|
import java.util.zip.CRC32;
|
||||||
|
|
||||||
|
import org.apache.commons.math3.random.ISAACRandom;
|
||||||
|
|
||||||
public class Game extends GameShell {
|
public class Game extends GameShell {
|
||||||
|
|
||||||
|
private static final int WELCOME_SCREEN_INTERFACE_ID = 15244;
|
||||||
|
private static final int WELCOME_SCREEN_FOOTER_INTERFACE_ID = 15801;
|
||||||
|
|
||||||
public static final int[][] designPartColor = {{6798, 107, 10283, 16, 4797, 7744, 5799, 4634, 33697, 22433, 2983, 54193}, {8741, 12, 64030, 43162, 7735, 8404, 1701, 38430, 24094, 10153, 56621, 4783, 1341, 16578, 35003, 25239}, {25238, 8742, 12, 64030, 43162, 7735, 8404, 1701, 38430, 24094, 10153, 56621, 4783, 1341, 16578, 35003}, {4626, 11146, 6439, 12, 4758, 10270}, {4550, 4537, 5681, 5673, 5790, 6806, 8076, 4574}};
|
public static final int[][] designPartColor = {{6798, 107, 10283, 16, 4797, 7744, 5799, 4634, 33697, 22433, 2983, 54193}, {8741, 12, 64030, 43162, 7735, 8404, 1701, 38430, 24094, 10153, 56621, 4783, 1341, 16578, 35003, 25239}, {25238, 8742, 12, 64030, 43162, 7735, 8404, 1701, 38430, 24094, 10153, 56621, 4783, 1341, 16578, 35003}, {4626, 11146, 6439, 12, 4758, 10270}, {4550, 4537, 5681, 5673, 5790, 6806, 8076, 4574}};
|
||||||
public static final int[] designHairColor = {9104, 10275, 7595, 3610, 7975, 8526, 918, 38802, 24466, 10145, 58654, 5027, 1457, 16565, 34991, 25486};
|
public static final int[] designHairColor = {9104, 10275, 7595, 3610, 7975, 8526, 918, 38802, 24466, 10145, 58654, 5027, 1457, 16565, 34991, 25486};
|
||||||
public static final BigInteger RSA_MODULUS = new BigInteger("7162900525229798032761816791230527296329313291232324290237849263501208207972894053929065636522363163621000728841182238772712427862772219676577293600221789");
|
|
||||||
public static final int[] levelExperience;
|
|
||||||
public static final BigInteger RSA_EXPONENT = new BigInteger("58778699976184461502525193738213253649000149147835990136706041084440742975821");
|
|
||||||
public static final String VALID_CHAT_CHARACTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!\"\243$%^&*()-_=+[{]};:'@#~,<.>/?\\| ";
|
public static final String VALID_CHAT_CHARACTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!\"\243$%^&*()-_=+[{]};:'@#~,<.>/?\\| ";
|
||||||
public static final int[] BITMASK;
|
public static final int[] BITMASK;
|
||||||
public static final int MAX_PLAYER_COUNT = 2048;
|
public static final int MAX_PLAYER_COUNT = 2048;
|
||||||
@@ -46,6 +46,7 @@ public class Game extends GameShell {
|
|||||||
public static final int[] OBJ_IOP_ACTION = {74, 454, 539, 493, 847};
|
public static final int[] OBJ_IOP_ACTION = {74, 454, 539, 493, 847};
|
||||||
public static final int[] LOC_OP_ACTION = {502, 900, 113, 872, 1062};
|
public static final int[] LOC_OP_ACTION = {502, 900, 113, 872, 1062};
|
||||||
public static final int[] NPC_OP_ACTION = {20, 412, 225, 965, 478};
|
public static final int[] NPC_OP_ACTION = {20, 412, 225, 965, 478};
|
||||||
|
public static int[] levelExperience;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
levelExperience = new int[99];
|
levelExperience = new int[99];
|
||||||
@@ -467,7 +468,9 @@ public class Game extends GameShell {
|
|||||||
public int[] menuParamB = new int[500];
|
public int[] menuParamB = new int[500];
|
||||||
public int[] menuAction = new int[500];
|
public int[] menuAction = new int[500];
|
||||||
public int[] menuParamC = new int[500];
|
public int[] menuParamC = new int[500];
|
||||||
public Image24[] imageHeadicons = new Image24[20];
|
public Image24[] imageHeadicons = new Image24[8];
|
||||||
|
public Image24[] imageHeadiconsPk = new Image24[3];
|
||||||
|
public Image24[] imageHeadiconsHint = new Image24[6];
|
||||||
|
|
||||||
public boolean redrawSideicons = false;
|
public boolean redrawSideicons = false;
|
||||||
public int systemUpdateTimer;
|
public int systemUpdateTimer;
|
||||||
@@ -568,6 +571,9 @@ public class Game extends GameShell {
|
|||||||
public DrawArea areaSidebar;
|
public DrawArea areaSidebar;
|
||||||
public DrawArea areaMapback;
|
public DrawArea areaMapback;
|
||||||
public DrawArea areaViewport;
|
public DrawArea areaViewport;
|
||||||
|
private DrawArea areaWelcomeScreen;
|
||||||
|
private int[] areaWelcomeScreenOffsets;
|
||||||
|
private boolean welcomeScreenWasOpen;
|
||||||
public DrawArea areaChatback;
|
public DrawArea areaChatback;
|
||||||
public int daysSinceRecoveriesChanged;
|
public int daysSinceRecoveriesChanged;
|
||||||
public Connection connection;
|
public Connection connection;
|
||||||
@@ -613,6 +619,7 @@ public class Game extends GameShell {
|
|||||||
public boolean redrawChatback = false;
|
public boolean redrawChatback = false;
|
||||||
public int chatbackInputType;
|
public int chatbackInputType;
|
||||||
public int song;
|
public int song;
|
||||||
|
private int titleSong;
|
||||||
public boolean songFading = true;
|
public boolean songFading = true;
|
||||||
public CollisionMap[] levelCollisionMap = new CollisionMap[4];
|
public CollisionMap[] levelCollisionMap = new CollisionMap[4];
|
||||||
public boolean redrawPrivacySettings = false;
|
public boolean redrawPrivacySettings = false;
|
||||||
@@ -687,7 +694,7 @@ public class Game extends GameShell {
|
|||||||
|
|
||||||
public URI getCodeBase() {
|
public URI getCodeBase() {
|
||||||
try {
|
try {
|
||||||
return new URI("http://" + server + ":" + (80 + portOffset));
|
return new URI("http://" + ClientSettings.SERVER_HOST + ":" + (80 + portOffset));
|
||||||
} catch (Exception ignored) {
|
} catch (Exception ignored) {
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
@@ -754,15 +761,15 @@ public class Game extends GameShell {
|
|||||||
Model.init(ondemand.getFileCount(0), ondemand);
|
Model.init(ondemand.getFileCount(0), ondemand);
|
||||||
|
|
||||||
if (!lowmem) {
|
if (!lowmem) {
|
||||||
song = 7;
|
song = 0;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
song = Integer.parseInt(getParameter("music"));
|
song = Integer.parseInt(getParameter("music"));
|
||||||
} catch (Exception ignored) {
|
} catch (Exception ignored) {
|
||||||
}
|
}
|
||||||
|
|
||||||
songFading = true;
|
titleSong = song;
|
||||||
ondemand.request(2, song);
|
requestTitleMusic();
|
||||||
|
|
||||||
while (ondemand.remaining() > 0) {
|
while (ondemand.remaining() > 0) {
|
||||||
handleOnDemandRequests();
|
handleOnDemandRequests();
|
||||||
@@ -941,11 +948,14 @@ public class Game extends GameShell {
|
|||||||
}
|
}
|
||||||
} catch (Exception ignored) {
|
} catch (Exception ignored) {
|
||||||
}
|
}
|
||||||
try {
|
for (int i = 0; i < imageHeadicons.length; i++) {
|
||||||
for (int i = 0; i < 20; i++) {
|
imageHeadicons[i] = new Image24(archiveMedia, "headicons_prayer", i);
|
||||||
imageHeadicons[i] = new Image24(archiveMedia, "headicons", i);
|
}
|
||||||
}
|
for (int i = 0; i < imageHeadiconsPk.length; i++) {
|
||||||
} catch (Exception ignored) {
|
imageHeadiconsPk[i] = new Image24(archiveMedia, "headicons_pk", i);
|
||||||
|
}
|
||||||
|
for (int i = 0; i < imageHeadiconsHint.length; i++) {
|
||||||
|
imageHeadiconsHint[i] = new Image24(archiveMedia, "headicons_hint", i);
|
||||||
}
|
}
|
||||||
imageMapmarker0 = new Image24(archiveMedia, "mapmarker", 0);
|
imageMapmarker0 = new Image24(archiveMedia, "mapmarker", 0);
|
||||||
imageMapmarker1 = new Image24(archiveMedia, "mapmarker", 1);
|
imageMapmarker1 = new Image24(archiveMedia, "mapmarker", 1);
|
||||||
@@ -1151,6 +1161,8 @@ public class Game extends GameShell {
|
|||||||
areaSidebar = null;
|
areaSidebar = null;
|
||||||
areaMapback = null;
|
areaMapback = null;
|
||||||
areaViewport = null;
|
areaViewport = null;
|
||||||
|
areaWelcomeScreen = null;
|
||||||
|
areaWelcomeScreenOffsets = null;
|
||||||
areaChatback = null;
|
areaChatback = null;
|
||||||
areaBackbase1 = null;
|
areaBackbase1 = null;
|
||||||
areaBackbase2 = null;
|
areaBackbase2 = null;
|
||||||
@@ -1184,6 +1196,8 @@ public class Game extends GameShell {
|
|||||||
imageCompass = null;
|
imageCompass = null;
|
||||||
imageHitmarks = null;
|
imageHitmarks = null;
|
||||||
imageHeadicons = null;
|
imageHeadicons = null;
|
||||||
|
imageHeadiconsPk = null;
|
||||||
|
imageHeadiconsHint = null;
|
||||||
imageCrosses = null;
|
imageCrosses = null;
|
||||||
imageMapdot0 = null;
|
imageMapdot0 = null;
|
||||||
imageMapdot1 = null;
|
imageMapdot1 = null;
|
||||||
@@ -1323,10 +1337,20 @@ public class Game extends GameShell {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void stopMidi() {
|
public void stopMidi() {
|
||||||
Signlink.midifade = 0;
|
Signlink.midiLoopEnabled = false;
|
||||||
Signlink.midi = "stop";
|
Signlink.midi = "stop";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void requestTitleMusic() {
|
||||||
|
if (lowmem || !midiEnabled) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
song = titleSong;
|
||||||
|
songFading = true;
|
||||||
|
ondemand.request(2, song);
|
||||||
|
}
|
||||||
|
|
||||||
public void loadArchiveChecksums() throws IOException {
|
public void loadArchiveChecksums() throws IOException {
|
||||||
int wait = 5;
|
int wait = 5;
|
||||||
int retries = 0;
|
int retries = 0;
|
||||||
@@ -1474,7 +1498,7 @@ public class Game extends GameShell {
|
|||||||
|
|
||||||
if (type == 0) {
|
if (type == 0) {
|
||||||
if ((y > 0) && (y < 110)) {
|
if ((y > 0) && (y < 110)) {
|
||||||
font.drawString(messageText[i], 4, y, 0);
|
font.drawStringTaggable(messageText[i], 4, y, 0, false);
|
||||||
}
|
}
|
||||||
line++;
|
line++;
|
||||||
}
|
}
|
||||||
@@ -1493,10 +1517,10 @@ public class Game extends GameShell {
|
|||||||
x += 14;
|
x += 14;
|
||||||
}
|
}
|
||||||
|
|
||||||
font.drawString(sender + ":", x, y, 0);
|
font.drawStringTaggable(sender + ":", x, y, 0, false);
|
||||||
x += font.stringWidthTaggable(sender) + 8;
|
x += font.stringWidthTaggable(sender) + 8;
|
||||||
|
|
||||||
font.drawString(messageText[i], x, y, 255);
|
font.drawStringTaggable(messageText[i], x, y, 255, false);
|
||||||
}
|
}
|
||||||
line++;
|
line++;
|
||||||
}
|
}
|
||||||
@@ -1505,7 +1529,7 @@ public class Game extends GameShell {
|
|||||||
if ((y > 0) && (y < 110)) {
|
if ((y > 0) && (y < 110)) {
|
||||||
int x = 4;
|
int x = 4;
|
||||||
|
|
||||||
font.drawString("From", x, y, 0);
|
font.drawStringTaggable("From", x, y, 0, false);
|
||||||
x += font.stringWidthTaggable("From ");
|
x += font.stringWidthTaggable("From ");
|
||||||
|
|
||||||
if (icon == 1) {
|
if (icon == 1) {
|
||||||
@@ -1518,39 +1542,39 @@ public class Game extends GameShell {
|
|||||||
x += 14;
|
x += 14;
|
||||||
}
|
}
|
||||||
|
|
||||||
font.drawString(sender + ":", x, y, 0);
|
font.drawStringTaggable(sender + ":", x, y, 0, false);
|
||||||
x += font.stringWidthTaggable(sender) + 8;
|
x += font.stringWidthTaggable(sender) + 8;
|
||||||
|
|
||||||
font.drawString(messageText[i], x, y, 0x800000);
|
font.drawStringTaggable(messageText[i], x, y, 0x800000, false);
|
||||||
}
|
}
|
||||||
line++;
|
line++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((type == 4) && ((tradeChatSetting == 0) || ((tradeChatSetting == 1) && isFriend(sender)))) {
|
if ((type == 4) && ((tradeChatSetting == 0) || ((tradeChatSetting == 1) && isFriend(sender)))) {
|
||||||
if ((y > 0) && (y < 110)) {
|
if ((y > 0) && (y < 110)) {
|
||||||
font.drawString(sender + " " + messageText[i], 4, y, 0x800080);
|
font.drawStringTaggable(sender + " " + messageText[i], 4, y, 0x800080, false);
|
||||||
}
|
}
|
||||||
line++;
|
line++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((type == 5) && (splitPrivateChat == 0) && (privateChatSetting < 2)) {
|
if ((type == 5) && (splitPrivateChat == 0) && (privateChatSetting < 2)) {
|
||||||
if ((y > 0) && (y < 110)) {
|
if ((y > 0) && (y < 110)) {
|
||||||
font.drawString(messageText[i], 4, y, 0x800000);
|
font.drawStringTaggable(messageText[i], 4, y, 0x800000, false);
|
||||||
}
|
}
|
||||||
line++;
|
line++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((type == 6) && (splitPrivateChat == 0) && (privateChatSetting < 2)) {
|
if ((type == 6) && (splitPrivateChat == 0) && (privateChatSetting < 2)) {
|
||||||
if ((y > 0) && (y < 110)) {
|
if ((y > 0) && (y < 110)) {
|
||||||
font.drawString("To " + sender + ":", 4, y, 0);
|
font.drawStringTaggable("To " + sender + ":", 4, y, 0, false);
|
||||||
font.drawString(messageText[i], 12 + font.stringWidthTaggable("To " + sender), y, 0x800000);
|
font.drawStringTaggable(messageText[i], 12 + font.stringWidthTaggable("To " + sender), y, 0x800000, false);
|
||||||
}
|
}
|
||||||
line++;
|
line++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((type == 8) && ((tradeChatSetting == 0) || ((tradeChatSetting == 1) && isFriend(sender)))) {
|
if ((type == 8) && ((tradeChatSetting == 0) || ((tradeChatSetting == 1) && isFriend(sender)))) {
|
||||||
if ((y > 0) && (y < 110)) {
|
if ((y > 0) && (y < 110)) {
|
||||||
font.drawString(sender + " " + messageText[i], 4, y, 0x7e3200);
|
font.drawStringTaggable(sender + " " + messageText[i], 4, y, 0x7e3200, false);
|
||||||
}
|
}
|
||||||
line++;
|
line++;
|
||||||
}
|
}
|
||||||
@@ -1579,10 +1603,8 @@ public class Game extends GameShell {
|
|||||||
Draw2D.drawLineX(0, 77, 479, 0);
|
Draw2D.drawLineX(0, 77, 479, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static String server = "";
|
|
||||||
|
|
||||||
public Socket openSocket(int port) throws IOException {
|
public Socket openSocket(int port) throws IOException {
|
||||||
return new Socket(InetAddress.getByName(server), port);
|
return new Socket(InetAddress.getByName(ClientSettings.SERVER_HOST), port);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void handleMouseInput() {
|
public void handleMouseInput() {
|
||||||
@@ -1721,8 +1743,8 @@ public class Game extends GameShell {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void midisave(boolean fade, byte[] data) {
|
public void midisave(boolean loop, byte[] data) {
|
||||||
Signlink.midifade = fade ? 1 : 0;
|
Signlink.midiLoopEnabled = loop;
|
||||||
Signlink.midisave(data, data.length);
|
Signlink.midisave(data, data.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2107,12 +2129,19 @@ public class Game extends GameShell {
|
|||||||
public void handleInterfaceInput(IfType parent, int x, int y, int scrollPosition) {
|
public void handleInterfaceInput(IfType parent, int x, int y, int scrollPosition) {
|
||||||
int mx = super.mouseX;
|
int mx = super.mouseX;
|
||||||
int my = super.mouseY;
|
int my = super.mouseY;
|
||||||
|
int right = x + parent.width;
|
||||||
|
int bottom = y + parent.height;
|
||||||
|
|
||||||
|
if ((parent.id == WELCOME_SCREEN_INTERFACE_ID) || (parent.id == WELCOME_SCREEN_FOOTER_INTERFACE_ID)) {
|
||||||
|
right = super.screenWidth;
|
||||||
|
bottom = super.screenHeight;
|
||||||
|
}
|
||||||
|
|
||||||
if ((parent.type != IfType.TYPE_PARENT) || (parent.childID == null) || parent.hide) {
|
if ((parent.type != IfType.TYPE_PARENT) || (parent.childID == null) || parent.hide) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((mx < x) || (my < y) || (mx > (x + parent.width)) || (my > (y + parent.height))) {
|
if ((mx < x) || (my < y) || (mx > right) || (my > bottom)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2489,15 +2518,17 @@ public class Game extends GameShell {
|
|||||||
|
|
||||||
int y = 30;
|
int y = 30;
|
||||||
|
|
||||||
if (player.headicons != 0) {
|
if ((player.headIcon < 7) || (player.skullIcon < 2)) {
|
||||||
projectFromGround(player, player.height + 15);
|
projectFromGround(player, player.height + 15);
|
||||||
|
|
||||||
if (projectX > -1) {
|
if (projectX > -1) {
|
||||||
for (int icon = 0; icon < 8; icon++) {
|
if (player.skullIcon < 2) {
|
||||||
if ((player.headicons & (1 << icon)) != 0) {
|
imageHeadiconsPk[player.skullIcon].draw(projectX - 12, projectY - y);
|
||||||
imageHeadicons[icon].draw(projectX - 12, projectY - y);
|
y += 25;
|
||||||
y -= 25;
|
}
|
||||||
}
|
if (player.headIcon < 7) {
|
||||||
|
imageHeadicons[player.headIcon].draw(projectX - 12, projectY - y);
|
||||||
|
y += 18;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2506,7 +2537,7 @@ public class Game extends GameShell {
|
|||||||
projectFromGround(player, player.height + 15);
|
projectFromGround(player, player.height + 15);
|
||||||
|
|
||||||
if (projectX > -1) {
|
if (projectX > -1) {
|
||||||
imageHeadicons[7].draw(projectX - 12, projectY - y);
|
imageHeadiconsHint[1].draw(projectX - 12, projectY - y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -2522,7 +2553,7 @@ public class Game extends GameShell {
|
|||||||
if ((hintType == 1) && (hintNPC == npcIDs[index - playerCount]) && ((loopCycle % 20) < 10)) {
|
if ((hintType == 1) && (hintNPC == npcIDs[index - playerCount]) && ((loopCycle % 20) < 10)) {
|
||||||
projectFromGround(entity, entity.height + 15);
|
projectFromGround(entity, entity.height + 15);
|
||||||
if (projectX > -1) {
|
if (projectX > -1) {
|
||||||
imageHeadicons[2].draw(projectX - 12, projectY - 28);
|
imageHeadiconsHint[0].draw(projectX - 12, projectY - 28);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3079,6 +3110,7 @@ public class Game extends GameShell {
|
|||||||
nextSong = -1;
|
nextSong = -1;
|
||||||
song = -1;
|
song = -1;
|
||||||
nextSongDelay = 0;
|
nextSongDelay = 0;
|
||||||
|
requestTitleMusic();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void validateCharacterDesign() {
|
public void validateCharacterDesign() {
|
||||||
@@ -4088,7 +4120,7 @@ public class Game extends GameShell {
|
|||||||
projectFromGround(((hintTileX - sceneBaseTileX) << 7) + hintOffsetX, hintHeight * 2, ((hintTileZ - sceneBaseTileZ) << 7) + hintOffsetZ);
|
projectFromGround(((hintTileX - sceneBaseTileX) << 7) + hintOffsetX, hintHeight * 2, ((hintTileZ - sceneBaseTileZ) << 7) + hintOffsetZ);
|
||||||
|
|
||||||
if ((projectX > -1) && ((loopCycle % 20) < 10)) {
|
if ((projectX > -1) && ((loopCycle % 20) < 10)) {
|
||||||
imageHeadicons[2].draw(projectX - 12, projectY - 28);
|
imageHeadiconsHint[0].draw(projectX - 12, projectY - 28);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -6827,6 +6859,12 @@ public class Game extends GameShell {
|
|||||||
menuAction[0] = 1107;
|
menuAction[0] = 1107;
|
||||||
menuSize = 1;
|
menuSize = 1;
|
||||||
|
|
||||||
|
if (viewportInterfaceID == WELCOME_SCREEN_INTERFACE_ID) {
|
||||||
|
handleWelcomeScreenInput();
|
||||||
|
sortMenuOptions();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
handlePrivateChatInput();
|
handlePrivateChatInput();
|
||||||
handleViewportInput();
|
handleViewportInput();
|
||||||
handleSidebarInput();
|
handleSidebarInput();
|
||||||
@@ -6835,6 +6873,15 @@ public class Game extends GameShell {
|
|||||||
sortMenuOptions();
|
sortMenuOptions();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void handleWelcomeScreenInput() {
|
||||||
|
lastHoveredInterfaceID = 0;
|
||||||
|
handleInterfaceInput(IfType.instances[WELCOME_SCREEN_INTERFACE_ID], 0, 0, 0);
|
||||||
|
|
||||||
|
if (lastHoveredInterfaceID != viewportHoveredInterfaceID) {
|
||||||
|
viewportHoveredInterfaceID = lastHoveredInterfaceID;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void handleChatInput() {
|
private void handleChatInput() {
|
||||||
lastHoveredInterfaceID = 0;
|
lastHoveredInterfaceID = 0;
|
||||||
|
|
||||||
@@ -6964,7 +7011,7 @@ public class Game extends GameShell {
|
|||||||
drawTitleScreen(true);
|
drawTitleScreen(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
connection = new Connection(this, openSocket(43594 + portOffset));
|
connection = new Connection(this, openSocket(ClientSettings.getWorldPort(portOffset)));
|
||||||
|
|
||||||
long name37 = StringUtil.toBase37(username);
|
long name37 = StringUtil.toBase37(username);
|
||||||
int namePart = (int) ((name37 >> 16) & 31L);
|
int namePart = (int) ((name37 >> 16) & 31L);
|
||||||
@@ -7004,7 +7051,7 @@ public class Game extends GameShell {
|
|||||||
out.write32(Signlink.uid);
|
out.write32(Signlink.uid);
|
||||||
out.writeString(username);
|
out.writeString(username);
|
||||||
out.writeString(password);
|
out.writeString(password);
|
||||||
out.encrypt(RSA_EXPONENT, RSA_MODULUS);
|
out.encrypt(ClientSettings.RSA_EXPONENT, ClientSettings.RSA_MODULUS);
|
||||||
|
|
||||||
login.position = 0;
|
login.position = 0;
|
||||||
login.write8(reconnect ? 18 : 16);
|
login.write8(reconnect ? 18 : 16);
|
||||||
@@ -8370,6 +8417,23 @@ public class Game extends GameShell {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void drawGame() {
|
public void drawGame() {
|
||||||
|
if (welcomeScreenWasOpen && (viewportInterfaceID != WELCOME_SCREEN_INTERFACE_ID)) {
|
||||||
|
welcomeScreenWasOpen = false;
|
||||||
|
viewportHoveredInterfaceID = 0;
|
||||||
|
lastHoveredInterfaceID = 0;
|
||||||
|
redrawTitleBackground = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (viewportInterfaceID == WELCOME_SCREEN_INTERFACE_ID) {
|
||||||
|
if (!menuVisible) {
|
||||||
|
handleInput();
|
||||||
|
}
|
||||||
|
drawWelcomeScreenOverlay();
|
||||||
|
welcomeScreenWasOpen = true;
|
||||||
|
delta = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (redrawTitleBackground) {
|
if (redrawTitleBackground) {
|
||||||
redrawTitleBackground = false;
|
redrawTitleBackground = false;
|
||||||
areaBackleft1.draw(super.graphics, 0, 4);
|
areaBackleft1.draw(super.graphics, 0, 4);
|
||||||
@@ -8690,7 +8754,15 @@ public class Game extends GameShell {
|
|||||||
int right = Draw2D.right;
|
int right = Draw2D.right;
|
||||||
int bottom = Draw2D.bottom;
|
int bottom = Draw2D.bottom;
|
||||||
|
|
||||||
Draw2D.setBounds(px, py, px + parent.width, py + parent.height);
|
int parentRight = px + parent.width;
|
||||||
|
int parentBottom = py + parent.height;
|
||||||
|
|
||||||
|
if ((parent.id == WELCOME_SCREEN_INTERFACE_ID) || (parent.id == WELCOME_SCREEN_FOOTER_INTERFACE_ID)) {
|
||||||
|
parentRight = super.screenWidth;
|
||||||
|
parentBottom = super.screenHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
Draw2D.setBounds(px, py, parentRight, parentBottom);
|
||||||
|
|
||||||
for (int i = 0; i < parent.childID.length; i++) {
|
for (int i = 0; i < parent.childID.length; i++) {
|
||||||
int x = parent.childX[i] + px;
|
int x = parent.childX[i] + px;
|
||||||
@@ -9186,6 +9258,41 @@ public class Game extends GameShell {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void drawWelcomeScreenOverlay() {
|
||||||
|
if ((areaWelcomeScreen == null) || (areaWelcomeScreen.width != super.screenWidth) || (areaWelcomeScreen.height != super.screenHeight)) {
|
||||||
|
areaWelcomeScreen = new DrawArea(super.screenWidth, super.screenHeight);
|
||||||
|
areaWelcomeScreenOffsets = new int[super.screenHeight];
|
||||||
|
for (int y = 0; y < super.screenHeight; y++) {
|
||||||
|
areaWelcomeScreenOffsets[y] = super.screenWidth * y;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int[] viewportOffsets = Draw3D.lineOffset;
|
||||||
|
int viewportCenterX = Draw3D.centerX;
|
||||||
|
int viewportCenterY = Draw3D.centerY;
|
||||||
|
Draw3D.lineOffset = areaWelcomeScreenOffsets;
|
||||||
|
Draw3D.centerX = super.screenWidth / 2;
|
||||||
|
Draw3D.centerY = super.screenHeight / 2;
|
||||||
|
|
||||||
|
try {
|
||||||
|
areaWelcomeScreen.bind();
|
||||||
|
Draw2D.clear();
|
||||||
|
updateInterfaceAnimation(delta, WELCOME_SCREEN_FOOTER_INTERFACE_ID);
|
||||||
|
drawParentInterface(IfType.instances[WELCOME_SCREEN_FOOTER_INTERFACE_ID], 0, 0, 0);
|
||||||
|
updateInterfaceAnimation(delta, WELCOME_SCREEN_INTERFACE_ID);
|
||||||
|
drawParentInterface(IfType.instances[WELCOME_SCREEN_INTERFACE_ID], 0, 0, 0);
|
||||||
|
if (menuVisible) {
|
||||||
|
drawMenu();
|
||||||
|
}
|
||||||
|
areaWelcomeScreen.draw(super.graphics, 0, 0);
|
||||||
|
} finally {
|
||||||
|
Draw3D.lineOffset = viewportOffsets;
|
||||||
|
Draw3D.centerX = viewportCenterX;
|
||||||
|
Draw3D.centerY = viewportCenterY;
|
||||||
|
areaViewport.bind();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void drawMouseCrosses() {
|
private void drawMouseCrosses() {
|
||||||
if (crossMode == 1) {
|
if (crossMode == 1) {
|
||||||
imageCrosses[crossCycle / 100].draw(crossX - 8 - 4, crossY - 8 - 4);
|
imageCrosses[crossCycle / 100].draw(crossX - 8 - 4, crossY - 8 - 4);
|
||||||
|
|||||||
@@ -2,8 +2,9 @@
|
|||||||
// Jad home page: http://www.kpdus.com/jad.html
|
// Jad home page: http://www.kpdus.com/jad.html
|
||||||
// Decompiler options: packimports(3)
|
// Decompiler options: packimports(3)
|
||||||
|
|
||||||
import javax.swing.*;
|
import java.awt.BorderLayout;
|
||||||
import java.awt.*;
|
|
||||||
|
import javax.swing.JFrame;
|
||||||
|
|
||||||
public class GameFrame extends JFrame {
|
public class GameFrame extends JFrame {
|
||||||
|
|
||||||
@@ -11,7 +12,7 @@ public class GameFrame extends JFrame {
|
|||||||
|
|
||||||
public GameFrame(GameShell shell) {
|
public GameFrame(GameShell shell) {
|
||||||
this.shell = shell;
|
this.shell = shell;
|
||||||
setTitle("Jagex");
|
setTitle(ClientSettings.SERVER_NAME + " World " + ClientSettings.SERVER_WORLD);
|
||||||
setResizable(false);
|
setResizable(false);
|
||||||
setLayout(new BorderLayout());
|
setLayout(new BorderLayout());
|
||||||
add(shell, BorderLayout.CENTER);
|
add(shell, BorderLayout.CENTER);
|
||||||
|
|||||||
@@ -290,7 +290,7 @@ public class OnDemand implements Runnable {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
socketOpenTime = now;
|
socketOpenTime = now;
|
||||||
socket = game.openSocket(43594 + Game.portOffset);
|
socket = game.openSocket(ClientSettings.getOnDemandPort(Game.portOffset));
|
||||||
in = socket.getInputStream();
|
in = socket.getInputStream();
|
||||||
out = socket.getOutputStream();
|
out = socket.getOutputStream();
|
||||||
out.write(15);
|
out.write(15);
|
||||||
|
|||||||
@@ -16,7 +16,8 @@ public class PlayerEntity extends PathingEntity {
|
|||||||
public int gender;
|
public int gender;
|
||||||
public String name;
|
public String name;
|
||||||
public int combatLevel;
|
public int combatLevel;
|
||||||
public int headicons;
|
public int headIcon;
|
||||||
|
public int skullIcon;
|
||||||
public int locStartCycle;
|
public int locStartCycle;
|
||||||
public int locStopCycle;
|
public int locStopCycle;
|
||||||
public int y;
|
public int y;
|
||||||
@@ -117,7 +118,8 @@ public class PlayerEntity extends PathingEntity {
|
|||||||
public void read(Buffer in) {
|
public void read(Buffer in) {
|
||||||
in.position = 0;
|
in.position = 0;
|
||||||
gender = in.readU8();
|
gender = in.readU8();
|
||||||
headicons = in.readU8();
|
headIcon = in.readU8();
|
||||||
|
skullIcon = in.readU8();
|
||||||
transmogrify = null;
|
transmogrify = null;
|
||||||
team = 0;
|
team = 0;
|
||||||
|
|
||||||
|
|||||||
+131
-5
@@ -8,6 +8,15 @@ import java.net.InetAddress;
|
|||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
|
import javax.sound.midi.MidiChannel;
|
||||||
|
import javax.sound.midi.MidiSystem;
|
||||||
|
import javax.sound.midi.Sequencer;
|
||||||
|
import javax.sound.midi.Synthesizer;
|
||||||
|
import javax.sound.sampled.AudioInputStream;
|
||||||
|
import javax.sound.sampled.AudioSystem;
|
||||||
|
import javax.sound.sampled.Clip;
|
||||||
|
import javax.sound.sampled.FloatControl;
|
||||||
|
import javax.sound.sampled.LineEvent;
|
||||||
|
|
||||||
public class Signlink implements Runnable {
|
public class Signlink implements Runnable {
|
||||||
|
|
||||||
@@ -20,18 +29,20 @@ public class Signlink implements Runnable {
|
|||||||
public static String dnsreq = null;
|
public static String dnsreq = null;
|
||||||
public static String dns = null;
|
public static String dns = null;
|
||||||
public static int savelen;
|
public static int savelen;
|
||||||
public static String savereq = null;
|
public static volatile String savereq = null;
|
||||||
public static byte[] savebuf = null;
|
public static byte[] savebuf = null;
|
||||||
public static boolean midiplay;
|
public static boolean midiplay;
|
||||||
public static int midipos;
|
public static int midipos;
|
||||||
public static String midi = null;
|
public static volatile String midi = null;
|
||||||
public static int midivol;
|
public static volatile int midivol;
|
||||||
public static int midifade;
|
public static boolean midiLoopEnabled;
|
||||||
public static boolean waveplay;
|
public static boolean waveplay;
|
||||||
public static int wavepos;
|
public static int wavepos;
|
||||||
public static String wave = null;
|
public static String wave = null;
|
||||||
public static int wavevol;
|
public static volatile int wavevol;
|
||||||
public static boolean reporterror = true;
|
public static boolean reporterror = true;
|
||||||
|
private Sequencer midiSequencer;
|
||||||
|
private Synthesizer midiSynthesizer;
|
||||||
|
|
||||||
public static void startpriv() {
|
public static void startpriv() {
|
||||||
threadliveid = (int) (Math.random() * 99999999D);
|
threadliveid = (int) (Math.random() * 99999999D);
|
||||||
@@ -164,6 +175,119 @@ public class Signlink implements Runnable {
|
|||||||
public Signlink() {
|
public Signlink() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void processAudioRequests() {
|
||||||
|
String waveRequest = wave;
|
||||||
|
if (waveRequest != null) {
|
||||||
|
wave = null;
|
||||||
|
try {
|
||||||
|
playWave(waveRequest);
|
||||||
|
} catch (Exception exception) {
|
||||||
|
exception.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String midiRequest = midi;
|
||||||
|
if (midiRequest != null) {
|
||||||
|
midi = null;
|
||||||
|
try {
|
||||||
|
if ("stop".equals(midiRequest)) {
|
||||||
|
stopMidi();
|
||||||
|
} else if ("voladjust".equals(midiRequest)) {
|
||||||
|
setMidiVolume();
|
||||||
|
} else {
|
||||||
|
playMidi(midiRequest);
|
||||||
|
}
|
||||||
|
} catch (Exception exception) {
|
||||||
|
exception.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void playWave(String file) throws Exception {
|
||||||
|
Clip clip = AudioSystem.getClip();
|
||||||
|
boolean started = false;
|
||||||
|
try {
|
||||||
|
try (AudioInputStream stream = AudioSystem.getAudioInputStream(new File(file))) {
|
||||||
|
clip.open(stream);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (clip.isControlSupported(FloatControl.Type.MASTER_GAIN)) {
|
||||||
|
FloatControl gain = (FloatControl) clip.getControl(FloatControl.Type.MASTER_GAIN);
|
||||||
|
float volume = Math.max(gain.getMinimum(), Math.min(gain.getMaximum(), wavevol / 100.0f));
|
||||||
|
gain.setValue(volume);
|
||||||
|
}
|
||||||
|
|
||||||
|
clip.addLineListener(event -> {
|
||||||
|
if (event.getType() == LineEvent.Type.STOP) {
|
||||||
|
clip.close();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
clip.start();
|
||||||
|
started = true;
|
||||||
|
} finally {
|
||||||
|
if (!started) {
|
||||||
|
clip.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void playMidi(String file) throws Exception {
|
||||||
|
ensureMidi();
|
||||||
|
midiSequencer.stop();
|
||||||
|
midiSequencer.setSequence(MidiSystem.getSequence(new File(file)));
|
||||||
|
midiSequencer.setLoopCount(midiLoopEnabled ? Sequencer.LOOP_CONTINUOUSLY : 0);
|
||||||
|
setMidiVolume();
|
||||||
|
midiSequencer.setTickPosition(0);
|
||||||
|
midiSequencer.start();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ensureMidi() throws Exception {
|
||||||
|
if (midiSequencer != null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Sequencer sequencer = MidiSystem.getSequencer(false);
|
||||||
|
Synthesizer synthesizer = MidiSystem.getSynthesizer();
|
||||||
|
try {
|
||||||
|
sequencer.open();
|
||||||
|
synthesizer.open();
|
||||||
|
sequencer.getTransmitter().setReceiver(synthesizer.getReceiver());
|
||||||
|
midiSequencer = sequencer;
|
||||||
|
midiSynthesizer = synthesizer;
|
||||||
|
} catch (Exception exception) {
|
||||||
|
sequencer.close();
|
||||||
|
synthesizer.close();
|
||||||
|
throw exception;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setMidiVolume() {
|
||||||
|
if (midiSynthesizer == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int volume = (int) Math.round(127.0 * Math.pow(10.0, midivol / 2000.0));
|
||||||
|
volume = Math.max(0, Math.min(127, volume));
|
||||||
|
for (MidiChannel channel : midiSynthesizer.getChannels()) {
|
||||||
|
if (channel != null) {
|
||||||
|
channel.controlChange(7, volume);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void stopMidi() {
|
||||||
|
if (midiSequencer != null) {
|
||||||
|
midiSequencer.stop();
|
||||||
|
}
|
||||||
|
if (midiSynthesizer != null) {
|
||||||
|
for (MidiChannel channel : midiSynthesizer.getChannels()) {
|
||||||
|
if (channel != null) {
|
||||||
|
channel.allSoundOff();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
active = true;
|
active = true;
|
||||||
@@ -209,6 +333,8 @@ public class Signlink implements Runnable {
|
|||||||
savereq = null;
|
savereq = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
processAudioRequests();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Thread.sleep(50L);
|
Thread.sleep(50L);
|
||||||
} catch (Exception ignored) {
|
} catch (Exception ignored) {
|
||||||
|
|||||||
Reference in new issue
Block a user