[Tutorial] How to make a webclient.(NEW)

Results 1 to 8 of 8
  1. #1
    Account Upgraded | Title Enabled! NaikBoi is offline
    MemberRank
    Aug 2006 Join Date
    EstoniaLocation
    279Posts

    [Tutorial] How to make a webclient.(NEW)

    3.2 - Credit:
    Ric914 - Writing/Releasing this tutorial.
    3.2 - Credit:
    Ric914 - Writing/Releasing this tutorial.
    3.2 - Credit:
    Ric914 - Writing/Releasing this tutorial.
    3.2 - Credit:
    Ric914 - Writing/Releasing this tutorial.


    Purpose: To make a webclient for your server/site.
    Browser's Tested on: Firefox. If you use a different browser and it works. Please pm me what browser you used.
    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:
    Code:
    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 from uppit to youtube.
    4/25/09 - Tutorial updated.
    4/28/09 - Step 2.6 was updated.
    5/3/09 - Step 2.3 was updated.
    1.2 - Requirements
    1. Regular Web host or VPS(Virtual Private Server) or Dedi(Dedicated Server) - For the web client page, client.jar(Should be around 600kb), cache.zip(usually is around 16mb)
    2. Jar maker - Download below
    3. A Client
    4. Patience and Time

    1.3 - Files to download:
    1. Jar Maker: http://www.goldenstudios.or.id/produ...r/JARMaker.zip

    Incase above don't work:
    http://rsric.netne.net/downloads/JARMaker.zip

    Section 2 - Tutorial:
    This video is to help you see what you gotta do.
    New webclient tutorial video: http://www.youtube.com/watch?v=l7o4uNTrdEQ&fmt=22

    --------------------------------------------------------------------------------------------------------------

    2.1 - Step 1 - Signlink.java
    Open up Signlink.java and search for findcachedir() and replace that method with this one:



    replace yourclientname with the name of your client. For example: C:/.ricscape_file_store_32/
    Save signlink.java and close it.

    --------------------------------------------------------------------------------------------------------------

    2.2 - Step 2 - Client.java
    Open up client.java and search for Class44 method67 and replace that method with this one:

    Code:
    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 HERE
    cache.zip
    which 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.zip

    The 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 client will not download the cache.
    On top of Class44 method67 put this:
    Code:
    /*
    Made by Ric914
    */
        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.
    Code:
    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.
    Open up Class30_Sub2_Sub1_Sub1.java and replace all:

    with this

    Like this:

    Do the same for the background

    Once you have changed the location your client reads the sprites from your gonna wanna save the file and close it.

    --------------------------------------------------------------------------------------------------------------

    2.4 - Jarring and Signing
    Before we start make sure you have downloaded the jar maker.(link located on top)
    If you have already downloaded it then run the jar maker and watch this video.

    Jarring and signing video: http://www.youtube.com/watch?v=9obXgxm_9qY&fmt=18

    Once you have jarred and signed the client do the following:
    Put the cache files(Everything inside the cache folder) and sprite "folder" together in a zip file.

    To understand what i mean watch this video:
    Cache + Sprites/Background Zipping:
    Youtube: http://www.youtube.com/watch?v=KUPvCEObZuk

    --------------------------------------------------------------------------------------------------------------

    2.5 - Webclient Web Page

    Replace yourclientname with the name of your client.

    --------------------------------------------------------------------------------------------------------------

    2.6 - End of tutorial details
    This is what your webclient should do if you did this tutorial right:
    http://www.youtube.com/watch?v=4wzI6JJP-Ds&fmt=22

    --------------------------------------------------------------------------------------------------------------

    Section 3 - Extra
    3.1 - Frequently Asked Questions
    Question: What's a good file host for my cache?
    Answer: You can use any host that allows direct linking. Here are some that allow direct linking:
    http://www.hotlinkfiles.com/
    http://www.fileden.com/

    Question: 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 have found a error or a misspelled word on your tutorial, what do I do?
    Answer: Send me a private message with the error or misspelled word.

    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.

    --------------------------------------------------------------------------------------------------------------

    3.2 - Credit:
    Ric914 - Writing/Releasing this tutorial.
    3.2 - Credit:
    Ric914 - Writing/Releasing this tutorial.
    3.2 - Credit:
    Ric914 - Writing/Releasing this tutorial.
    3.2 - Credit:
    Ric914 - Writing/Releasing this tutorial.


  2. #2
    I am THE DON Joe9099 is offline
    MemberRank
    Jan 2007 Join Date
    England, UkLocation
    3,655Posts

    Re: [Tutorial] How to make a webclient.(NEW)

    lol nice tutorial, well done

  3. #3
    Apprentice ajh151 is offline
    MemberRank
    Jun 2009 Join Date
    6Posts

    Re: [Tutorial] How to make a webclient.(NEW)

    am gonna try

  4. #4
    Apprentice kosom1 is offline
    MemberRank
    Mar 2009 Join Date
    XFlyFFLocation
    20Posts

    Re: [Tutorial] How to make a webclient.(NEW)

    Can anyone Just help me with this? my client works fine and doesnt connect t o localhost, i made it a webclient and follwed allthe steps ,now its fine , it loads fine , it gets to the log in screen but hten it says unable to connect ,but if you were running a server it connects to that , then i am sure its connecting to local host , i double checked , i searched all files for 0.0.0.0 , 127.0.0.1 , localhost, none of them appeared , so can anyone help me and tell me whats wrong? pm me or msn me , my email is hamzah_adwan@hotmail.com

  5. #5
    Doggie And Rice. Military is offline
    MemberRank
    Jun 2009 Join Date
    Here and AboutLocation
    3,301Posts

    Re: [Tutorial] How to make a webclient.(NEW)

    Edit:it worked just changed cache to fileden
    Last edited by Military; 28-08-09 at 10:35 PM.

  6. #6
    Apprentice kosom1 is offline
    MemberRank
    Mar 2009 Join Date
    XFlyFFLocation
    20Posts

    Re: [Tutorial] How to make a webclient.(NEW)

    well anyone knows how to fix my probz?

  7. #7
    Banned heyhowareya is offline
    BannedRank
    Sep 2009 Join Date
    290Posts

    Re: [Tutorial] How to make a webclient.(NEW)

    nice tutorial - i might make one for 508.

  8. #8
    Apprentice Danielplanto is offline
    MemberRank
    Dec 2009 Join Date
    8Posts

    Re: [Tutorial] How to make a webclient.(NEW)

    Quote Originally Posted by NaikBoi View Post
    3.2 - Credit:
    Ric914 - Writing/Releasing this tutorial.
    3.2 - Credit:
    Ric914 - Writing/Releasing this tutorial.
    3.2 - Credit:
    Ric914 - Writing/Releasing this tutorial.
    3.2 - Credit:
    Ric914 - Writing/Releasing this tutorial.

    Webclient Web Page:
    That part is empty? What am I supposed to do? It doesn't show me what to paste into the .html or .php. I even checked on runecheck or whatever from the original poster and I still did not see what to paste into the .html/.php

    Help??



Advertisement