Compare commits
10
Commits
7c7a614a20
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b7ce15cbbf | ||
|
|
87fdd5eea9 | ||
|
|
dc20fdfc1e | ||
|
|
a4b3aad5f5 | ||
|
|
398da7f761 | ||
|
|
6fece68f2a | ||
|
|
f3058eaa99 | ||
|
|
4e773c112a | ||
|
|
2e9f7e4574 | ||
|
|
5865f59d06 |
No files matched your search
+4
-2
@@ -1,4 +1,6 @@
|
||||
|
||||
.classpath
|
||||
.project
|
||||
.settings/
|
||||
.idea/
|
||||
target/
|
||||
out/
|
||||
out/
|
||||
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"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -2,6 +2,9 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>runescape</groupId>
|
||||
@@ -12,17 +15,10 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.13.0</version>
|
||||
<configuration>
|
||||
<source>7</source>
|
||||
<target>7</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>9</source>
|
||||
<target>9</target>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
@@ -51,4 +47,4 @@
|
||||
</dependencies>
|
||||
|
||||
|
||||
</project>
|
||||
</project>
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
+157
-49
@@ -2,15 +2,13 @@
|
||||
// Jad home page: http://www.kpdus.com/jad.html
|
||||
// Decompiler options: packimports(3)
|
||||
|
||||
import org.apache.commons.math3.random.ISAACRandom;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.EOFException;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.math.BigInteger;
|
||||
import java.net.InetAddress;
|
||||
import java.net.Socket;
|
||||
import java.net.URI;
|
||||
@@ -18,13 +16,15 @@ import java.net.UnknownHostException;
|
||||
import java.util.Arrays;
|
||||
import java.util.zip.CRC32;
|
||||
|
||||
import org.apache.commons.math3.random.ISAACRandom;
|
||||
|
||||
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[] 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("150437374157649496260907284144944613391868328356428312785170855566836496148649769873303054925785940753587048471819630374797613652942136320599534564023031743563833250113572385619350489566973866283982326500382760586083379242813677444239924493338426453599564333273724064297982529208425077775100347146662074078333");
|
||||
public static final int[] levelExperience;
|
||||
public static final BigInteger RSA_EXPONENT = new BigInteger("65537");
|
||||
public static final String VALID_CHAT_CHARACTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!\"\243$%^&*()-_=+[{]};:'@#~,<.>/?\\| ";
|
||||
public static final int[] BITMASK;
|
||||
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[] LOC_OP_ACTION = {502, 900, 113, 872, 1062};
|
||||
public static final int[] NPC_OP_ACTION = {20, 412, 225, 965, 478};
|
||||
public static int[] levelExperience;
|
||||
|
||||
static {
|
||||
levelExperience = new int[99];
|
||||
@@ -98,6 +99,7 @@ public class Game extends GameShell {
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws UnknownHostException {
|
||||
System.setProperty("java.net.preferIPv6Addresses", "true");
|
||||
System.out.println("RS2 user client - release #" + 317);
|
||||
|
||||
if (args.length != 5) {
|
||||
@@ -466,7 +468,9 @@ public class Game extends GameShell {
|
||||
public int[] menuParamB = new int[500];
|
||||
public int[] menuAction = 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 int systemUpdateTimer;
|
||||
@@ -567,6 +571,9 @@ public class Game extends GameShell {
|
||||
public DrawArea areaSidebar;
|
||||
public DrawArea areaMapback;
|
||||
public DrawArea areaViewport;
|
||||
private DrawArea areaWelcomeScreen;
|
||||
private int[] areaWelcomeScreenOffsets;
|
||||
private boolean welcomeScreenWasOpen;
|
||||
public DrawArea areaChatback;
|
||||
public int daysSinceRecoveriesChanged;
|
||||
public Connection connection;
|
||||
@@ -612,6 +619,7 @@ public class Game extends GameShell {
|
||||
public boolean redrawChatback = false;
|
||||
public int chatbackInputType;
|
||||
public int song;
|
||||
private int titleSong;
|
||||
public boolean songFading = true;
|
||||
public CollisionMap[] levelCollisionMap = new CollisionMap[4];
|
||||
public boolean redrawPrivacySettings = false;
|
||||
@@ -686,7 +694,7 @@ public class Game extends GameShell {
|
||||
|
||||
public URI getCodeBase() {
|
||||
try {
|
||||
return new URI("http://" + server + ":" + (80 + portOffset));
|
||||
return new URI("http://" + ClientSettings.SERVER_HOST + ":" + (80 + portOffset));
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
return null;
|
||||
@@ -753,15 +761,15 @@ public class Game extends GameShell {
|
||||
Model.init(ondemand.getFileCount(0), ondemand);
|
||||
|
||||
if (!lowmem) {
|
||||
song = 7;
|
||||
song = 0;
|
||||
|
||||
try {
|
||||
song = Integer.parseInt(getParameter("music"));
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
|
||||
songFading = true;
|
||||
ondemand.request(2, song);
|
||||
titleSong = song;
|
||||
requestTitleMusic();
|
||||
|
||||
while (ondemand.remaining() > 0) {
|
||||
handleOnDemandRequests();
|
||||
@@ -940,11 +948,14 @@ public class Game extends GameShell {
|
||||
}
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
try {
|
||||
for (int i = 0; i < 20; i++) {
|
||||
imageHeadicons[i] = new Image24(archiveMedia, "headicons", i);
|
||||
}
|
||||
} catch (Exception ignored) {
|
||||
for (int i = 0; i < imageHeadicons.length; i++) {
|
||||
imageHeadicons[i] = new Image24(archiveMedia, "headicons_prayer", i);
|
||||
}
|
||||
for (int i = 0; i < imageHeadiconsPk.length; i++) {
|
||||
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);
|
||||
imageMapmarker1 = new Image24(archiveMedia, "mapmarker", 1);
|
||||
@@ -1150,6 +1161,8 @@ public class Game extends GameShell {
|
||||
areaSidebar = null;
|
||||
areaMapback = null;
|
||||
areaViewport = null;
|
||||
areaWelcomeScreen = null;
|
||||
areaWelcomeScreenOffsets = null;
|
||||
areaChatback = null;
|
||||
areaBackbase1 = null;
|
||||
areaBackbase2 = null;
|
||||
@@ -1183,6 +1196,8 @@ public class Game extends GameShell {
|
||||
imageCompass = null;
|
||||
imageHitmarks = null;
|
||||
imageHeadicons = null;
|
||||
imageHeadiconsPk = null;
|
||||
imageHeadiconsHint = null;
|
||||
imageCrosses = null;
|
||||
imageMapdot0 = null;
|
||||
imageMapdot1 = null;
|
||||
@@ -1322,10 +1337,20 @@ public class Game extends GameShell {
|
||||
}
|
||||
|
||||
public void stopMidi() {
|
||||
Signlink.midifade = 0;
|
||||
Signlink.midiLoopEnabled = false;
|
||||
Signlink.midi = "stop";
|
||||
}
|
||||
|
||||
private void requestTitleMusic() {
|
||||
if (lowmem || !midiEnabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
song = titleSong;
|
||||
songFading = true;
|
||||
ondemand.request(2, song);
|
||||
}
|
||||
|
||||
public void loadArchiveChecksums() throws IOException {
|
||||
int wait = 5;
|
||||
int retries = 0;
|
||||
@@ -1473,7 +1498,7 @@ public class Game extends GameShell {
|
||||
|
||||
if (type == 0) {
|
||||
if ((y > 0) && (y < 110)) {
|
||||
font.drawString(messageText[i], 4, y, 0);
|
||||
font.drawStringTaggable(messageText[i], 4, y, 0, false);
|
||||
}
|
||||
line++;
|
||||
}
|
||||
@@ -1492,10 +1517,10 @@ public class Game extends GameShell {
|
||||
x += 14;
|
||||
}
|
||||
|
||||
font.drawString(sender + ":", x, y, 0);
|
||||
font.drawStringTaggable(sender + ":", x, y, 0, false);
|
||||
x += font.stringWidthTaggable(sender) + 8;
|
||||
|
||||
font.drawString(messageText[i], x, y, 255);
|
||||
font.drawStringTaggable(messageText[i], x, y, 255, false);
|
||||
}
|
||||
line++;
|
||||
}
|
||||
@@ -1504,7 +1529,7 @@ public class Game extends GameShell {
|
||||
if ((y > 0) && (y < 110)) {
|
||||
int x = 4;
|
||||
|
||||
font.drawString("From", x, y, 0);
|
||||
font.drawStringTaggable("From", x, y, 0, false);
|
||||
x += font.stringWidthTaggable("From ");
|
||||
|
||||
if (icon == 1) {
|
||||
@@ -1517,39 +1542,39 @@ public class Game extends GameShell {
|
||||
x += 14;
|
||||
}
|
||||
|
||||
font.drawString(sender + ":", x, y, 0);
|
||||
font.drawStringTaggable(sender + ":", x, y, 0, false);
|
||||
x += font.stringWidthTaggable(sender) + 8;
|
||||
|
||||
font.drawString(messageText[i], x, y, 0x800000);
|
||||
font.drawStringTaggable(messageText[i], x, y, 0x800000, false);
|
||||
}
|
||||
line++;
|
||||
}
|
||||
|
||||
if ((type == 4) && ((tradeChatSetting == 0) || ((tradeChatSetting == 1) && isFriend(sender)))) {
|
||||
if ((y > 0) && (y < 110)) {
|
||||
font.drawString(sender + " " + messageText[i], 4, y, 0x800080);
|
||||
font.drawStringTaggable(sender + " " + messageText[i], 4, y, 0x800080, false);
|
||||
}
|
||||
line++;
|
||||
}
|
||||
|
||||
if ((type == 5) && (splitPrivateChat == 0) && (privateChatSetting < 2)) {
|
||||
if ((y > 0) && (y < 110)) {
|
||||
font.drawString(messageText[i], 4, y, 0x800000);
|
||||
font.drawStringTaggable(messageText[i], 4, y, 0x800000, false);
|
||||
}
|
||||
line++;
|
||||
}
|
||||
|
||||
if ((type == 6) && (splitPrivateChat == 0) && (privateChatSetting < 2)) {
|
||||
if ((y > 0) && (y < 110)) {
|
||||
font.drawString("To " + sender + ":", 4, y, 0);
|
||||
font.drawString(messageText[i], 12 + font.stringWidthTaggable("To " + sender), y, 0x800000);
|
||||
font.drawStringTaggable("To " + sender + ":", 4, y, 0, false);
|
||||
font.drawStringTaggable(messageText[i], 12 + font.stringWidthTaggable("To " + sender), y, 0x800000, false);
|
||||
}
|
||||
line++;
|
||||
}
|
||||
|
||||
if ((type == 8) && ((tradeChatSetting == 0) || ((tradeChatSetting == 1) && isFriend(sender)))) {
|
||||
if ((y > 0) && (y < 110)) {
|
||||
font.drawString(sender + " " + messageText[i], 4, y, 0x7e3200);
|
||||
font.drawStringTaggable(sender + " " + messageText[i], 4, y, 0x7e3200, false);
|
||||
}
|
||||
line++;
|
||||
}
|
||||
@@ -1578,10 +1603,8 @@ public class Game extends GameShell {
|
||||
Draw2D.drawLineX(0, 77, 479, 0);
|
||||
}
|
||||
|
||||
static String server = "0.0.0.0";
|
||||
|
||||
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() {
|
||||
@@ -1720,8 +1743,8 @@ public class Game extends GameShell {
|
||||
}
|
||||
}
|
||||
|
||||
public void midisave(boolean fade, byte[] data) {
|
||||
Signlink.midifade = fade ? 1 : 0;
|
||||
public void midisave(boolean loop, byte[] data) {
|
||||
Signlink.midiLoopEnabled = loop;
|
||||
Signlink.midisave(data, data.length);
|
||||
}
|
||||
|
||||
@@ -2106,12 +2129,19 @@ public class Game extends GameShell {
|
||||
public void handleInterfaceInput(IfType parent, int x, int y, int scrollPosition) {
|
||||
int mx = super.mouseX;
|
||||
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) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ((mx < x) || (my < y) || (mx > (x + parent.width)) || (my > (y + parent.height))) {
|
||||
if ((mx < x) || (my < y) || (mx > right) || (my > bottom)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2488,15 +2518,17 @@ public class Game extends GameShell {
|
||||
|
||||
int y = 30;
|
||||
|
||||
if (player.headicons != 0) {
|
||||
if ((player.headIcon < 7) || (player.skullIcon < 2)) {
|
||||
projectFromGround(player, player.height + 15);
|
||||
|
||||
if (projectX > -1) {
|
||||
for (int icon = 0; icon < 8; icon++) {
|
||||
if ((player.headicons & (1 << icon)) != 0) {
|
||||
imageHeadicons[icon].draw(projectX - 12, projectY - y);
|
||||
y -= 25;
|
||||
}
|
||||
if (player.skullIcon < 2) {
|
||||
imageHeadiconsPk[player.skullIcon].draw(projectX - 12, projectY - y);
|
||||
y += 25;
|
||||
}
|
||||
if (player.headIcon < 7) {
|
||||
imageHeadicons[player.headIcon].draw(projectX - 12, projectY - y);
|
||||
y += 18;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2505,7 +2537,7 @@ public class Game extends GameShell {
|
||||
projectFromGround(player, player.height + 15);
|
||||
|
||||
if (projectX > -1) {
|
||||
imageHeadicons[7].draw(projectX - 12, projectY - y);
|
||||
imageHeadiconsHint[1].draw(projectX - 12, projectY - y);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -2521,7 +2553,7 @@ public class Game extends GameShell {
|
||||
if ((hintType == 1) && (hintNPC == npcIDs[index - playerCount]) && ((loopCycle % 20) < 10)) {
|
||||
projectFromGround(entity, entity.height + 15);
|
||||
if (projectX > -1) {
|
||||
imageHeadicons[2].draw(projectX - 12, projectY - 28);
|
||||
imageHeadiconsHint[0].draw(projectX - 12, projectY - 28);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3078,6 +3110,7 @@ public class Game extends GameShell {
|
||||
nextSong = -1;
|
||||
song = -1;
|
||||
nextSongDelay = 0;
|
||||
requestTitleMusic();
|
||||
}
|
||||
|
||||
public void validateCharacterDesign() {
|
||||
@@ -4087,7 +4120,7 @@ public class Game extends GameShell {
|
||||
projectFromGround(((hintTileX - sceneBaseTileX) << 7) + hintOffsetX, hintHeight * 2, ((hintTileZ - sceneBaseTileZ) << 7) + hintOffsetZ);
|
||||
|
||||
if ((projectX > -1) && ((loopCycle % 20) < 10)) {
|
||||
imageHeadicons[2].draw(projectX - 12, projectY - 28);
|
||||
imageHeadiconsHint[0].draw(projectX - 12, projectY - 28);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6826,6 +6859,12 @@ public class Game extends GameShell {
|
||||
menuAction[0] = 1107;
|
||||
menuSize = 1;
|
||||
|
||||
if (viewportInterfaceID == WELCOME_SCREEN_INTERFACE_ID) {
|
||||
handleWelcomeScreenInput();
|
||||
sortMenuOptions();
|
||||
return;
|
||||
}
|
||||
|
||||
handlePrivateChatInput();
|
||||
handleViewportInput();
|
||||
handleSidebarInput();
|
||||
@@ -6834,6 +6873,15 @@ public class Game extends GameShell {
|
||||
sortMenuOptions();
|
||||
}
|
||||
|
||||
private void handleWelcomeScreenInput() {
|
||||
lastHoveredInterfaceID = 0;
|
||||
handleInterfaceInput(IfType.instances[WELCOME_SCREEN_INTERFACE_ID], 0, 0, 0);
|
||||
|
||||
if (lastHoveredInterfaceID != viewportHoveredInterfaceID) {
|
||||
viewportHoveredInterfaceID = lastHoveredInterfaceID;
|
||||
}
|
||||
}
|
||||
|
||||
private void handleChatInput() {
|
||||
lastHoveredInterfaceID = 0;
|
||||
|
||||
@@ -6963,7 +7011,7 @@ public class Game extends GameShell {
|
||||
drawTitleScreen(true);
|
||||
}
|
||||
|
||||
connection = new Connection(this, openSocket(43594 + portOffset));
|
||||
connection = new Connection(this, openSocket(ClientSettings.getWorldPort(portOffset)));
|
||||
|
||||
long name37 = StringUtil.toBase37(username);
|
||||
int namePart = (int) ((name37 >> 16) & 31L);
|
||||
@@ -7003,7 +7051,7 @@ public class Game extends GameShell {
|
||||
out.write32(Signlink.uid);
|
||||
out.writeString(username);
|
||||
out.writeString(password);
|
||||
out.encrypt(RSA_EXPONENT, RSA_MODULUS);
|
||||
out.encrypt(ClientSettings.RSA_EXPONENT, ClientSettings.RSA_MODULUS);
|
||||
|
||||
login.position = 0;
|
||||
login.write8(reconnect ? 18 : 16);
|
||||
@@ -7581,14 +7629,14 @@ public class Game extends GameShell {
|
||||
if ((seqID == npc.primarySeqID) && (seqID != -1)) {
|
||||
int style = SeqType.instances[seqID].replayStyle;
|
||||
|
||||
if (style == 0) {
|
||||
if (style == 1) {
|
||||
npc.primarySeqFrame = 0;
|
||||
npc.primarySeqCycle = 0;
|
||||
npc.primarySeqDelay = delay;
|
||||
npc.primarySeqLoop = 0;
|
||||
}
|
||||
|
||||
if (style == 1) {
|
||||
if (style == 2) {
|
||||
npc.primarySeqLoop = 0;
|
||||
}
|
||||
} else if ((seqID == -1) || (npc.primarySeqID == -1) || (SeqType.instances[seqID].priority >= SeqType.instances[npc.primarySeqID].priority)) {
|
||||
@@ -8369,6 +8417,23 @@ public class Game extends GameShell {
|
||||
}
|
||||
|
||||
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) {
|
||||
redrawTitleBackground = false;
|
||||
areaBackleft1.draw(super.graphics, 0, 4);
|
||||
@@ -8689,7 +8754,15 @@ public class Game extends GameShell {
|
||||
int right = Draw2D.right;
|
||||
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++) {
|
||||
int x = parent.childX[i] + px;
|
||||
@@ -9185,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() {
|
||||
if (crossMode == 1) {
|
||||
imageCrosses[crossCycle / 100].draw(crossX - 8 - 4, crossY - 8 - 4);
|
||||
|
||||
@@ -2,8 +2,9 @@
|
||||
// Jad home page: http://www.kpdus.com/jad.html
|
||||
// Decompiler options: packimports(3)
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.BorderLayout;
|
||||
|
||||
import javax.swing.JFrame;
|
||||
|
||||
public class GameFrame extends JFrame {
|
||||
|
||||
@@ -11,7 +12,7 @@ public class GameFrame extends JFrame {
|
||||
|
||||
public GameFrame(GameShell shell) {
|
||||
this.shell = shell;
|
||||
setTitle("Jagex");
|
||||
setTitle(ClientSettings.SERVER_NAME + " World " + ClientSettings.SERVER_WORLD);
|
||||
setResizable(false);
|
||||
setLayout(new BorderLayout());
|
||||
add(shell, BorderLayout.CENTER);
|
||||
|
||||
@@ -7,7 +7,7 @@ import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.io.IOException;
|
||||
|
||||
public abstract class GameShell extends JComponent implements Runnable, MouseListener, MouseMotionListener, KeyListener, FocusListener, WindowListener {
|
||||
public abstract class GameShell extends Canvas implements Runnable, MouseListener, MouseMotionListener, KeyListener, FocusListener, WindowListener {
|
||||
|
||||
public final long[] otim = new long[10];
|
||||
public final double[] frameTime = new double[100];
|
||||
@@ -48,6 +48,7 @@ public abstract class GameShell extends JComponent implements Runnable, MouseLis
|
||||
graphics = this.getGraphics();
|
||||
startThread(this, 1);
|
||||
requestFocus();
|
||||
setFocusTraversalKeysEnabled(false);
|
||||
}
|
||||
|
||||
public void initApplet(int width, int height) {
|
||||
|
||||
@@ -42,12 +42,12 @@ public class LocType {
|
||||
/**
|
||||
* This is where dynamically generated models go.
|
||||
*/
|
||||
public static LRUMap<Long, Model> modelCacheDynamic = new LRUMap(30);
|
||||
public static LRUMap<Long, Model> modelCacheDynamic = new LRUMap<>(30);
|
||||
public static LocType[] cache;
|
||||
/**
|
||||
* This is where basic models go.
|
||||
*/
|
||||
public static LRUMap<Long, Model> modelCacheStatic = new LRUMap(500);
|
||||
public static LRUMap<Long, Model> modelCacheStatic = new LRUMap<>(500);
|
||||
|
||||
public static LocType get(int locID) {
|
||||
if (locID >= count) {
|
||||
@@ -296,7 +296,7 @@ public class LocType {
|
||||
modelID += 0x10000;
|
||||
}
|
||||
|
||||
model = modelCacheStatic.get(modelID);
|
||||
model = modelCacheStatic.get((long) modelID);
|
||||
if (model == null) {
|
||||
model = Model.tryGet(modelID & 0xffff);
|
||||
if (model == null) {
|
||||
@@ -346,7 +346,7 @@ public class LocType {
|
||||
modelID += 0x10000;
|
||||
}
|
||||
|
||||
model = modelCacheStatic.get(modelID);
|
||||
model = modelCacheStatic.get((long) modelID);
|
||||
|
||||
if (model == null) {
|
||||
model = Model.tryGet(modelID & 0xffff);
|
||||
|
||||
@@ -290,7 +290,7 @@ public class OnDemand implements Runnable {
|
||||
return;
|
||||
}
|
||||
socketOpenTime = now;
|
||||
socket = game.openSocket(43594 + Game.portOffset);
|
||||
socket = game.openSocket(ClientSettings.getOnDemandPort(Game.portOffset));
|
||||
in = socket.getInputStream();
|
||||
out = socket.getOutputStream();
|
||||
out.write(15);
|
||||
|
||||
@@ -16,7 +16,8 @@ public class PlayerEntity extends PathingEntity {
|
||||
public int gender;
|
||||
public String name;
|
||||
public int combatLevel;
|
||||
public int headicons;
|
||||
public int headIcon;
|
||||
public int skullIcon;
|
||||
public int locStartCycle;
|
||||
public int locStopCycle;
|
||||
public int y;
|
||||
@@ -117,7 +118,8 @@ public class PlayerEntity extends PathingEntity {
|
||||
public void read(Buffer in) {
|
||||
in.position = 0;
|
||||
gender = in.readU8();
|
||||
headicons = in.readU8();
|
||||
headIcon = in.readU8();
|
||||
skullIcon = in.readU8();
|
||||
transmogrify = null;
|
||||
team = 0;
|
||||
|
||||
|
||||
@@ -108,8 +108,8 @@ public class SeqType {
|
||||
public int idleStyle = -1;
|
||||
|
||||
/**
|
||||
* If 0, restarts the sequence if already playing
|
||||
* If 1, does not restart if already playing
|
||||
* If 1, restarts the sequence if already playing
|
||||
* If 2, does not restart if already playing
|
||||
*
|
||||
* @see Game#readNPCUpdates()
|
||||
*/
|
||||
|
||||
+132
-6
@@ -8,6 +8,15 @@ import java.net.InetAddress;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
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 {
|
||||
|
||||
@@ -20,18 +29,20 @@ public class Signlink implements Runnable {
|
||||
public static String dnsreq = null;
|
||||
public static String dns = null;
|
||||
public static int savelen;
|
||||
public static String savereq = null;
|
||||
public static volatile String savereq = null;
|
||||
public static byte[] savebuf = null;
|
||||
public static boolean midiplay;
|
||||
public static int midipos;
|
||||
public static String midi = null;
|
||||
public static int midivol;
|
||||
public static int midifade;
|
||||
public static volatile String midi = null;
|
||||
public static volatile int midivol;
|
||||
public static boolean midiLoopEnabled;
|
||||
public static boolean waveplay;
|
||||
public static int wavepos;
|
||||
public static String wave = null;
|
||||
public static int wavevol;
|
||||
public static volatile int wavevol;
|
||||
public static boolean reporterror = true;
|
||||
private Sequencer midiSequencer;
|
||||
private Synthesizer midiSynthesizer;
|
||||
|
||||
public static void startpriv() {
|
||||
threadliveid = (int) (Math.random() * 99999999D);
|
||||
@@ -59,7 +70,7 @@ public class Signlink implements Runnable {
|
||||
}
|
||||
|
||||
public static String findcachedir() {
|
||||
String[] as = {"c:/windows/", "c:/winnt/", "d:/windows/", "d:/winnt/", "e:/windows/", "e:/winnt/", "f:/windows/", "f:/winnt/", "c:/", "~/", "/tmp/", "", "c:/rscache", "/rscache"};
|
||||
String[] as = {"c:/windows/", "c:/winnt/", "d:/windows/", "d:/winnt/", "e:/windows/", "e:/winnt/", "f:/windows/", "f:/winnt/", "c:/", System.getProperty("user.home") + "/", "/tmp/", "", "c:/rscache", "/rscache"};
|
||||
if ((storeid < 32) || (storeid > 34)) {
|
||||
storeid = 32;
|
||||
}
|
||||
@@ -164,6 +175,119 @@ public class Signlink implements Runnable {
|
||||
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
|
||||
public void run() {
|
||||
active = true;
|
||||
@@ -209,6 +333,8 @@ public class Signlink implements Runnable {
|
||||
savereq = null;
|
||||
}
|
||||
|
||||
processAudioRequests();
|
||||
|
||||
try {
|
||||
Thread.sleep(50L);
|
||||
} catch (Exception ignored) {
|
||||
|
||||
Reference in new issue
Block a user