Please make sure to read everything and if you have a problem look at the FAQ.
This is a basic webclient tutorial for 317 clients.
Last Updated: *Check the Revision History*
Difficulty: Medium (Based on the poll above)
Purpose: To turn your 317 client into a webclient for your rsps.
Browser's Tested on: Google Chrome, Internet Explorer, Mozilla Firefox, Opera.
Client's Tested on: Should work on all 317 clients
Classes Modified: Signlink.java, Client.java, Class30_Sub2_Sub1_Sub1.java
Table of Contents:Section 1 - Updates/Requirements
1.1 - Revision History
1.2 - Requirements
1.3 - Files Needed
Section 2 - Tutorial
2.1 - Step 1 - Signlink.java
2.2 - Step 2 - Client.java
2.3 - Step 3 - Class30_Sub2_Sub1_Sub1.java(Sprites)
2.4 - Jarring and Signing
2.5 - Webclient Web Page
2.6 - End of tutorial details
Section 3 - Extra
3.1 - Frequently Asked Questions
3.2 - Credits
--------------------------------------------------------------------------------------------------------------
Section 1 - Updates/Requirements1.1 - Revision History:1/2/09 - Downloading cache percentage will appear in the client(no more jframe)
1/3/09 - Downloads cache faster.
4/1/09 - Tutorial re-written.
4/2/09 - Uploaded "Cache + Sprites Zipping" video to youtube.
4/25/09 - Tutorial updated.
4/28/09 - Step 2.6 was updated.
5/3/09 - Step 2.3 was updated.
8/22/09 - New FAQ question and updated browser's tested on list.
10/16/09 - Tutorial updated.1.2 - Requirements1. Regular Web host or VPS(Virtual Private Server) or Dedi(Dedicated Server) - For the webclient page, client.jar(Should be around 600kb), cache.zip(usually is around 16mb)
2. Jar maker - Download below
3. A 317 client
4. Patience and Time
1.3 - Files to download:Jar Maker:
http://www.goldenstudios.or.id/products/utilities/jarmaker/JARMaker.zipSection 2 - Tutorial:A video on what to do. I know it's not very well made but it might help in some way.
Webclient tutorial video: You can subscribe if you want. Maybe someday I will decide to re-make a better explained webclient tutorial video.
--------------------------------------------------------------------------------------------------------------
2.1 - Step 1 - Signlink.java Open up Signlink.java and search for
findcachedir(). In that method you will see something like this:
s = "";
s1 = "./cache/";
highlight those 2 lines and replace it with the following:
s = "C:/.yourclientname_file_store_32/";
s1 = "";
replace
yourclientname with the name of your client - no spaces. For example: C:/.ricscape_file_store_32/
Save signlink.java and close it.
--------------------------------------------------------------------------------------------------------------
2.2 - Step 2 - Client.javaOpen up client.java and search for
Class44 method67 and replace it with this one:
private Class44 method67(int i, String s, String s1, int j, byte byte0, int k)
{
byte abyte0[] = null;
int l = 5;
try
{
if(aClass14Array970[0] != null)
{
abyte0 = aClass14Array970[0].method233(true, i);
}
if(abyte0 == null)
{
method13(15, (byte)4, "Downloading Cache");
downloadcache("YOUR CACHE URL LINK HERE", "cache.zip", "", "cache");
}
if(aClass14Array970[0] != null)
{
abyte0 = aClass14Array970[0].method233(true, i);
}
}
catch(Exception exception) { }
if(abyte0 != null);
if(abyte0 != null)
{
Class44 class44 = new Class44(44820, abyte0);
return class44;
}
int i1 = 0;
do
{
if(abyte0 != null)
{
break;
}
String s2 = "Unknown error";
method13(k, (byte)4, "Client updated - please reload client");
//method13(k, (byte)4, (new StringBuilder()).append("Requesting ").append(s).toString());
Object obj = null;
try
{
int j1 = 0;
DataInputStream datainputstream = method132((new StringBuilder()).append(s1).append(j).toString());
byte abyte1[] = new byte[6];
datainputstream.readFully(abyte1, 0, 6);
Class30_Sub2_Sub2 class30_sub2_sub2 = new Class30_Sub2_Sub2(abyte1, 891);
class30_sub2_sub2.anInt1406 = 3;
int l1 = class30_sub2_sub2.method412() + 6;
int i2 = 6;
abyte0 = new byte[l1];
for(int j2 = 0; j2 < 6; j2++)
{
abyte0[j2] = abyte1[j2];
}
while(i2 < l1)
{
int k2 = l1 - i2;
if(k2 > 1000)
{
k2 = 1000;
}
int l2 = datainputstream.read(abyte0, i2, k2);
if(l2 < 0)
{
s2 = (new StringBuilder()).append("Length error: ").append(i2).append("/").append(l1).toString();
throw new IOException("EOF");
}
i2 += l2;
int i3 = (i2 * 100) / l1;
if(i3 != j1)
{
method13(k, (byte)4, (new StringBuilder()).append("Loading ").append(s).append(" - ").append(i3).append("%").toString());
}
j1 = i3;
}
datainputstream.close();
try
{
if(aClass14Array970[0] != null)
{
aClass14Array970[0].method234(abyte0.length, abyte0, (byte)2, i);
}
}
catch(Exception exception3)
{
aClass14Array970[0] = null;
}
}
catch(IOException ioexception)
{
if(s2.equals("Unknown error"))
{
s2 = "Connection error";
}
abyte0 = null;
}
catch(NullPointerException nullpointerexception)
{
s2 = "Null error";
abyte0 = null;
if(!signlink.reporterror)
{
return null;
}
}
catch(ArrayIndexOutOfBoundsException arrayindexoutofboundsexception)
{
s2 = "Bounds error";
abyte0 = null;
if(!signlink.reporterror)
{
return null;
}
}
catch(Exception exception1)
{
s2 = "Unexpected error";
abyte0 = null;
if(!signlink.reporterror)
{
return null;
}
}
if(abyte0 == null)
{
for(int k1 = l; k1 > 0; k1--)
{
if(i1 >= 3)
{
method13(k, (byte)4, "Game updated - please reload page");
k1 = 10;
} else
{
method13(k, (byte)4, (new StringBuilder()).append(s2).append(" - Retrying in ").append(k1).toString());
}
try
{
Thread.sleep(1000L);
}
catch(Exception exception2) { }
}
l *= 2;
if(l > 60)
{
l = 60;
}
aBoolean872 = !aBoolean872;
}
} while(true);
Class44 class44_1 = new Class44(44820, abyte0);
if(byte0 != -41)
{
throw new NullPointerException();
} else
{
return class44_1;
}
}
Replace the following:
YOUR CACHE URL LINK HEREcache.zipwhich is in this line:
downloadcache("YOUR CACHE URL LINK HERE", "cache.zip", "", "cache");
You only replace what's in the first 2 quotes.
The first quote is your link.
Your cache link must end with .zip
For example:
http://yoursite.com/cache.zipThe second quote is the extraction, so it would like this:
"cache.zip"
Unless your zip file has a different name. If it does then you would put:
"zipfilename.zip"
This is the most important method and without it your webclient will not work.
On top of
Class44 method67 put this:
public String name;
public String dir;
public void downloadcache(String url, String name1, String dir1, String type)
{
dir = dir1;
name = name1;
try
{
URLConnection connection = (new URL(url)).openConnection();
String f[] = url.split("/");
File file = new File(f[f.length - 1]);
int length = connection.getContentLength();
InputStream instream = connection.getInputStream();
try{new File(signlink.findcachedir()+dir).mkdir();}catch(Exception e){}
FileOutputStream outstream = new FileOutputStream(signlink.findcachedir()+dir+file);
int size = 0;
int copy;
byte[] buffer = new byte[4096];
while((copy = instream.read(buffer)) != -1)
{
outstream.write(buffer, 0, copy);
size+= copy;
int percentage = (int)(((double)size / (double)length) * 100D);
method13(percentage, (byte)4, "Downloading Cache - "+percentage+"%");
}
if(length != size)
{
instream.close();
outstream.close();
} else
{
method13(5, (byte)4, "Unpacking files...");
instream.close();
outstream.close();
unZipFile();
deleteFile();
method13(10, (byte)4, "Unpacking was complete");
}
}
catch(Exception e)
{
System.err.println("Error connecting to server.");
e.printStackTrace();
}
}
public void writeStream(InputStream In, OutputStream Out) throws IOException
{
byte Buffer[] = new byte[4096];
int Len;
while((Len = In.read(Buffer)) >= 0)
{
Out.write(Buffer, 0, Len);
}
In.close();
Out.close();
}
public void unZipFile()
{
try
{
ZipFile ZipFile = new ZipFile(signlink.findcachedir()+dir+name);
for(Enumeration Entries = ZipFile.entries(); Entries.hasMoreElements();)
{
ZipEntry Entry = (ZipEntry)Entries.nextElement();
if(Entry.isDirectory())
{
(new File(signlink.findcachedir()+dir+Entry.getName())).mkdir();
} else
{
writeStream(ZipFile.getInputStream(Entry), new BufferedOutputStream(new FileOutputStream(signlink.findcachedir()+dir+Entry.getName())));
}
}
ZipFile.close();
}
catch(Exception e)
{
e.printStackTrace();
}
}
public void deleteFile()
{
try
{
File file = new File(signlink.findcachedir()+dir+name);
file.delete();
}
catch(Exception e)
{
e.printStackTrace();
}
}
Once you have added those method's in your client.java, scroll all the way up still you see import's then add the following under the rest of them.
import java.awt.Dimension;
import java.net.URL;
import java.net.URLConnection;
import javax.swing.*;
import java.util.Enumeration;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
--------------------------------------------------------------------------------------------------------------
2.3 - Step 3 - Class30_Sub2_Sub1_Sub1.java(Sprites)Now for the sprite part. Which most people don't do right. I don't know why. =\
Open up Class30_Sub2_Sub1_Sub1.java and replace all:
./Sprites/
with this
C:/.yourclientname_file_store_32/Sprites/
Like this:

Do the same for the background
Once you have changed the location your client reads the sprites from, save the file and close it.
--------------------------------------------------------------------------------------------------------------
2.4 - Jarring and SigningBefore we start make sure you have downloaded the jar maker(located above).
Note: When you jar your client the cache and sprites folder can not be in the client folder. Move or delete them.
If you have already downloaded the jar maker then run the jar maker and watch the following video.
Jarring and signing video:
Once you have jarred and signed the client, Put the cache files(Everything inside the cache folder) and sprite "folder" in a zip file.
To understand what I mean watch this video:
--------------------------------------------------------------------------------------------------------------
2.5 - Webclient Web PageCreate a new html or php page with the following (This is an example of how it should be):
<HTML>
<HEAD>
<TITLE>Your Webclient</TITLE>
<META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
</HEAD>
<BODY>
<applet name="yourclientname" width="765" height="503" archive="client.jar" code="client.class">
<param name="java_arguments" value="-Xmx1024m">
</applet>
</BODY>
</HTML>
Replace yourclientname with the name of your client.
--------------------------------------------------------------------------------------------------------------
2.6 - End of tutorial detailsThis is what your webclient should do if you did this tutorial right:
--------------------------------------------------------------------------------------------------------------
Section 3 - Extra3.1 - Frequently Asked QuestionsQuestion: What's a good free file host for my cache.zip?
Answer: You can use any host that allows direct linking. I personally use this site:
http://www.fileden.com/Question: Ric, it's too hard. Can you make it for me?
Answer: No, I don't do this for people anymore. You gotta learn how to make a webclient for when you update your client.
Question: I get a blank page with a red X on it. What do I do?
Answer: Right click and press Java Console and read the error.
Question: The java console says it cannot find client.class, What should I do?
Answer: I recommend deleting all the class files and recompile your client.
Question: I get the 1,2,3,4,5 error. What do I do?
Answer: Something is missing, corrupted or done wrong.
Question: I get a java heap space error, What do I do?
Answer: Make sure you have <param name="java_arguments" value="-Xmx1024m"> in your applet code.
--------------------------------------------------------------------------------------------------------------
3.2 - Credit:Ric914 - Writing/Releasing this tutorial.
Moparisthebest - I used some stuff from his downloader
No credits to me! I just post this here for people who need this xD