Thread: [Zarketh]Need help starting up Source/LoginServer[Zarketh]

Results 1 to 2 of 2
  1. #1 [Zarketh]Need help starting up Source/LoginServer[Zarketh] 
    Donator


    Join Date
    Oct 2015
    Posts
    232
    Thanks given
    187
    Thanks received
    85
    Rep Power
    1516
    Alright so I recently got the Zarketh Source/Client/LoginServer and I was wondering if someone experienced could help me get a hang of it. I would just like some basic lessons in setting up the SQL, and just getting some errors through! I won't be annoying about it, and I'm a fast learner. PLEASE note that I am not trying to make a RSPS with my lack of knowledge, and I would just like to learn. Thank you. If you can help, I will add my skype, I am just looking for a friend.

    Now for a couple of errors:
    SERVER SIDED

    Code:
    [00:00:00]: DATA_DIRECTORY = C:\Users\USER\Desktop\Server\.\data\
    [00:00:00]: CHARACTER_DIRECTORY = C:\Users\USER\Desktop\Server\.\data\characters\
    [00:00:00]: CHARACTER_DATA_DIRECTORY = C:\Users\USER\Desktop\Server\.\data\characters\data\
    [00:00:00]: CHARACTER_EXTRA_DATA_1_DIRECTORY = C:\Users\USER\Desktop\Server\.\data\characters\extra_data\
    [00:00:00]: CHARACTER_EXTRA_DATA_2_DIRECTORY = C:\Users\USER\Desktop\Server\.\data\characters\extra_data_noInteger\
    [00:00:00]: CREDENTIAL_DIRECTORY = C:\Users\USER\Desktop\Server\.\data\characters\extra_data_login\
    [00:00:00]: Loading Object Definitions...
    [00:00:00]: Loading Clipping Regions...
    [00:00:04]: Loading clans...
    [00:00:04]: Initializing Handlers...
    [00:00:05]: java.lang.NullPointerException
    [00:00:05]: 	at com.zarketh.Settings.getBoolean(Settings.java:19)
    [00:00:05]: 	at com.zarketh.Server.startMinutesCounter(Server.java:217)
    [00:00:05]: 	at com.zarketh.Server.main(Server.java:148)
    Here is are the Server.Java files and Settings.java:

    Code:
    package com.zarketh;
    
    import java.io.BufferedReader;
    import java.io.BufferedWriter;
    import java.io.File;
    import java.io.FileReader;
    import java.io.FileWriter;
    import java.io.IOException;
    
    import com.zarketh.content.constants.LotterySystem;
    import com.zarketh.content.minigames.pc.PestControl;
    import com.zarketh.content.misc.Starters;
    import com.zarketh.engine.cycle.impl.GameSavingProcess;
    import com.zarketh.model.entity.npc.NPCSize;
    import com.zarketh.model.entity.player.commands.CommandManager;
    import com.zarketh.model.entity.player.packets.PacketManager;
    import com.zarketh.sql.SQLDataLoader;
    import com.zarketh.util.ExceptionHandler;
    import com.zarketh.util.Log;
    import com.zarketh.util.MACAddressFetcher;
    import com.zarketh.world.Clan;
    import com.zarketh.world.GlobalActions;
    import com.zarketh.world.ItemManager;
    import com.zarketh.world.NPCManager;
    import com.zarketh.world.PlayerManager;
    import com.zarketh.world.ShopManager;
    import com.zarketh.world.World;
    import com.zarketh.world.XMLManager;
    import com.zarketh.world.map.MapLoader;
    import com.zarketh.world.map.ObjectDefinition;
    import com.zarketh.world.map.Region;
    import com.zarketh.world.objects.ObjectManager;
    import com.zarketh.world.objects.ObjectSystem;
    
    /**
     * @author Rene
     * @author Supah Fly
     */
    public class Server {
    	/* coolguy */
    	public static boolean multiValve = true;
    	public static int bonusExp = 1;
    	public static boolean snowMode = false;
    	public static boolean updateServer = false;
    	private static Server INSTANCE = new Server();
    	protected static long start = 0;
    	private static boolean shutdownServer = false;
    	private static long minutesCounter;
    
    	public static Server getInstance() {
    		return INSTANCE;
    	}
    
    	public static int getJVMSize() {
    		final Runtime runtime = Runtime.getRuntime();
    		return (int) ((runtime.totalMemory() - runtime.freeMemory()) / 1024L);
    	}
    
    	public static long getMinutesCounter() {
    		return minutesCounter;
    	}
    
    	public static PlayerManager getPlayerManager() {
    		return PlayerManager.getSingleton();
    	}
    
    	public static String getUptime() {
    		final long uptime = (System.currentTimeMillis() - start) / 1000;
    		final int minutes = (int) (uptime / 60);
    
    		if (minutes == 0 || minutes == 1)
    			return minutes + " min";
    		else
    			return minutes + " mins";
    	}
    
    	private static void initContinuousEvents() {
    		new Thread(new GameSavingProcess()).start();
    	}
    
    	public static boolean isDebugEnabled() {
    		return Settings.getBoolean("sv_dbg");
    	}
    
    	public static boolean isRunningOnProtosPC() {
    		return false;
    	}
    
    	public static boolean isShutdown() {
    		return isShutdownServer();
    	}
    
    	public static boolean isShutdownServer() {
    		return shutdownServer;
    	}
    
    	public static void main(String[] args) {
    
    		MACAddressFetcher.initialise();
    
    		String path = "";
    
    		for (final String arg : args)
    			path += " " + arg;
    
    		path = path.trim();
    
    		if (args.length == 1)
    			try {
    				final File file = new File(path);
    				if (!file.exists()) {
    					System.out.println("Please specify a valid settings file!");
    					return;
    				}
    				Settings.load(file);
    			} catch (final IOException e) {
    				e.printStackTrace();
    			}
    		else {
    			System.out.println("Usage: Server <path to config file>");
    			return;
    		}
    		try {
    			start = System.currentTimeMillis();
    			System.setOut(new Log(System.out));
    			System.setErr(new Log(System.err));
    			Thread.setDefaultUncaughtExceptionHandler(new ExceptionHandler());
    			start = System.currentTimeMillis();
    			System.out.println("Loading " + Settings.getString("sv_name")
    					+ " (World " + Settings.getLong("sv_nodeid") + ") ...");
    			System.out.println("MAC Address : " + MACAddressFetcher.result());
    			NPCSize.load();
    			System.out.println("Loading Object Definitions...");
    			ObjectDefinition.load();
    			System.out.println("Loading Clipping Regions...");
    			Region.load();
    			Starters.appendStarters();
    			Starters.appendStarters2();
    			System.out.println("Loading clans...");
    			Clan.load();
    			System.out.println("Initializing Handlers...");
    			setShopManager(new ShopManager());
    			setNpcManager(new NPCManager());
    			setObjectManager(new ObjectManager());
    			setItemManager(new ItemManager());
    			setGlobalActions(new GlobalActions());
    			PacketManager.loadAllPackets();
    			CommandManager.loadAllCommands();
    			Server.getInstance().startMinutesCounter();
    			World.connectDatabase();
    			System.out.println("Loading All XML & SQL depedencies...");
    			SQLDataLoader.initailise();
    			XMLManager.load();
    			LotterySystem.getInstance().initiateSystem();
    			initContinuousEvents();
    			System.out.println("Loading Map Objects...");
    			MapLoader.initialize();
    			ObjectSystem.registerAllObjects();
    			World.getWorld();
    			new RS2Server().bind().start();
    			PestControl.getInstance();
    		} catch (final Exception e) {
    			e.printStackTrace();
    		}
    	}
    
    	public static void setGlobalActions(GlobalActions globalActions) {
    		InstanceDistributor.globalActions = globalActions;
    	}
    
    	public static void setItemManager(ItemManager itemManager) {
    		InstanceDistributor.itemManager = itemManager;
    	}
    
    	public static void setMinutesCounter(long minutesCounter) {
    		if (Server.isDebugEnabled())
    			return;
    
    		Server.minutesCounter = minutesCounter;
    		try {
    
    			final File f = new File(Constants.CHARACTER_DIRECTORY
    					+ "minutes.log");
    
    			if (!f.exists())
    				f.createNewFile();
    
    			final BufferedWriter minuteCounter = new BufferedWriter(
    					new FileWriter(f));
    			minuteCounter.write(Long.toString(getMinutesCounter()));
    			minuteCounter.close();
    		} catch (final IOException e) {
    			e.printStackTrace();
    		}
    	}
    
    	public static void setNpcManager(NPCManager npcManager) {
    		InstanceDistributor.npcManager = npcManager;
    	}
    
    	public static void setObjectManager(ObjectManager objectManager) {
    		InstanceDistributor.objectManager = objectManager;
    	}
    
    	public static void setShopManager(ShopManager shopManager) {
    		InstanceDistributor.shopManager = shopManager;
    	}
    
    	public static void setShutdown(boolean shutdown) {
    		setShutdownServer(shutdown);
    	}
    
    	public static void setShutdownServer(boolean shutdownServer) {
    		Server.shutdownServer = shutdownServer;
    	}
    
    	private void startMinutesCounter() {
    		if (Settings.getBoolean("sv_dbg"))
    			// We don't need this in debug mode
    			return;
    		try {
    			final File f = new File(Constants.CHARACTER_DIRECTORY
    					+ "minutes.log");
    
    			if (!f.exists())
    				f.createNewFile();
    
    			final BufferedReader minuteFile = new BufferedReader(
    					new FileReader(f));
    			Server.minutesCounter = Integer.parseInt(minuteFile.readLine());
    			minuteFile.close();
    		} catch (final Exception e) {
    			e.printStackTrace();
    		}
    	}
    
    }
    Code:
    package com.zarketh;
    
    import java.io.BufferedReader;
    import java.io.File;
    import java.io.FileReader;
    import java.io.IOException;
    import java.util.HashMap;
    
    import com.zarketh.model.entity.Location;
    
    public class Settings {
    	private static final HashMap<String, Object> vars = new HashMap<String, Object>();
    
    	public static Object get(String var) {
    		return vars.get(var);
    	}
    
    	public static boolean getBoolean(String var) {
    		return (Boolean) get(var);
    	}
    
    	public static Location getLocation(String var) {
    		return (Location) get(var);
    	}
    
    	public static long getLong(String var) {
    		return (Long) get(var);
    	}
    
    	public static String getString(String var) {
    		return (String) get(var);
    	}
    
    	public static void load(File path) throws IOException {
    		BufferedReader reader = null;
    
    		try {
    			reader = new BufferedReader(new FileReader(path));
    			String line;
    
    			while ((line = reader.readLine()) != null) {
    				String nameToken = "";
    				String valueToken = "";
    				int quoteCount = 0;
    				int tokenKind = 0;
    
    				for (int i = 0; i < line.length(); i++) {
    					final char c = line.charAt(i);
    
    					if (c == '/'
    							&& line.charAt(i + 1) == '/'
    							&& tokenKind == 2
    							&& (!valueToken.startsWith("\"")
    									|| valueToken.startsWith("\"")
    									&& valueToken.endsWith("\"") || quoteCount == 2))
    						break;
    
    					switch (tokenKind) {
    					case 0:
    						if (Character.isWhitespace(c) && !nameToken.isEmpty()) {
    							nameToken = nameToken.trim();
    							tokenKind++;
    						} else
    							nameToken += c;
    						break;
    					case 1:
    						if (Character.isWhitespace(c))
    							break;
    
    						tokenKind++;
    					case 2:
    						if (c == '"')
    							quoteCount++;
    
    						valueToken += c;
    						break;
    					}
    				}
    
    				// System.out.println(nameToken + " - " + valueToken);
    				valueToken = valueToken.trim();
    
    				if (valueToken.isEmpty() && nameToken.isEmpty())
    					continue;
    
    				if (valueToken.startsWith("\"") && valueToken.endsWith("\""))
    					set(nameToken,
    							valueToken.substring(1, valueToken.length() - 1));
    				else if (valueToken.contains(","))
    					set(nameToken, Location.parseLocation(valueToken));
    				else if (valueToken.equalsIgnoreCase("false")
    						|| valueToken.equalsIgnoreCase("true"))
    					set(nameToken, Boolean.parseBoolean(valueToken));
    				else
    					set(nameToken, Long.parseLong(valueToken));
    			}
    		} finally {
    			reader.close();
    		}
    	}
    
    	public static void set(String var, Object value) {
    		vars.put(var, value);
    	}
    }
    LOGIN SERVER ERRORS:

    This is where I need SQL help to set up a local server . Would be willing to rep++ to someone who can help .

    Code:
    HIasffsasf
    Jan 11, 2016 8:43:40 AM com.zarketh.loginserver.net.SQLDatabase initialise
    INFO: Connecting to game database..
    Jan 11, 2016 8:43:40 AM com.zarketh.loginserver.net.SQLDatabase$DatabaseConnection connect
    SEVERE: Error connecting to MySQL database (jdbc:mysql://arrav-ps.com/arravpsc_server) !
    com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
    
    The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
    	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    	at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    	at java.lang.reflect.Constructor.newInstance(Unknown Source)
    	at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
    	at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1116)
    	at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:344)
    	at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2332)
    	at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2369)
    	at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2153)
    	at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:792)
    	at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47)
    	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    	at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    	at java.lang.reflect.Constructor.newInstance(Unknown Source)
    	at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
    	at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:381)
    	at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:305)
    	at java.sql.DriverManager.getConnection(Unknown Source)
    	at java.sql.DriverManager.getConnection(Unknown Source)
    	at com.zarketh.loginserver.net.SQLDatabase$DatabaseConnection.connect(SQLDatabase.java:308)
    	at com.zarketh.loginserver.net.SQLDatabase.initialise(SQLDatabase.java:99)
    	at com.zarketh.loginserver.node.NodeManager.start(NodeManager.java:114)
    	at com.zarketh.loginserver.Server.start(Server.java:78)
    	at com.zarketh.loginserver.Server.main(Server.java:119)
    Caused by: java.net.UnknownHostException: arrav-ps.com
    	at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
    	at java.net.InetAddress$2.lookupAllHostAddr(Unknown Source)
    	at java.net.InetAddress.getAddressesFromNameService(Unknown Source)
    	at java.net.InetAddress.getAllByName0(Unknown Source)
    	at java.net.InetAddress.getAllByName(Unknown Source)
    	at java.net.InetAddress.getAllByName(Unknown Source)
    	at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:247)
    	at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:294)
    	... 19 more
    
    Jan 11, 2016 8:43:40 AM com.zarketh.loginserver.net.SQLDatabase$DatabaseConnection connect
    SEVERE: Error connecting to MySQL database (jdbc:mysql://arrav-ps.com/arravpsc_server) !
    com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
    
    The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
    	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    	at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    	at java.lang.reflect.Constructor.newInstance(Unknown Source)
    	at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
    	at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1116)
    	at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:344)
    	at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2332)
    	at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2369)
    	at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2153)
    	at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:792)
    	at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47)
    	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    	at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    	at java.lang.reflect.Constructor.newInstance(Unknown Source)
    	at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
    	at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:381)
    	at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:305)
    	at java.sql.DriverManager.getConnection(Unknown Source)
    	at java.sql.DriverManager.getConnection(Unknown Source)
    	at com.zarketh.loginserver.net.SQLDatabase$DatabaseConnection.connect(SQLDatabase.java:308)
    	at com.zarketh.loginserver.net.SQLDatabase.initialise(SQLDatabase.java:99)
    	at com.zarketh.loginserver.node.NodeManager.start(NodeManager.java:114)
    	at com.zarketh.loginserver.Server.start(Server.java:78)
    	at com.zarketh.loginserver.Server.main(Server.java:119)
    Caused by: java.net.UnknownHostException: arrav-ps.com
    	at java.net.InetAddress.getAllByName0(Unknown Source)
    	at java.net.InetAddress.getAllByName(Unknown Source)
    	at java.net.InetAddress.getAllByName(Unknown Source)
    	at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:247)
    	at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:294)
    	... 19 more
    
    Jan 11, 2016 8:43:40 AM com.zarketh.loginserver.Server start
    INFO: Binding to port : 8101..
    Jan 11, 2016 8:43:41 AM com.zarketh.loginserver.Server start
    INFO: Ready and listening on port : 8101.
    CLIENT SIDED

    Here I just need some help with the CacheDownloader.java and with everything connected.

    Code:
    Exception in thread "Thread-3" java.lang.NegativeArraySizeException
    	at CacheDownloader.download(CacheDownloader.java:69)
    	at client.startUp(client.java:9836)
    	at RSApplet.run(RSApplet.java:40)
    	at client.run(client.java:5912)
    	at java.lang.Thread.run(Unknown Source)
    CacheDownloader.java:

    Code:
    import java.io.BufferedInputStream;
    import java.io.BufferedOutputStream;
    import java.io.DataInputStream;
    import java.io.DataOutputStream;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.OutputStream;
    import java.net.URL;
    import java.net.URLConnection;
    import java.util.zip.ZipEntry;
    import java.util.zip.ZipInputStream;
    
    /**
     * Downloads and unzips a file from a {@link URL}.
     * 
     * @author Ryley Kimmel <[email protected]>
     * Aug 20, 2013
     * CacheDownloader.java
     * 
     * @see java.lang.Object
     */
    public final class CacheDownloader {
    
    	/**
    	 * An instance of {@link File} used to determine the root directory.
    	 */
    	private static final File root = new File(SignLink.findcachedir());
    
    	/**
    	 * An instance of {@link File} used to determine the root for the version file.
    	 */
    	private static final File versionFile = new File(root.getPath(), "version.dat");
    
    	/**
    	 * An instance of {@link File} used to determine the root of the archive.
    	 */
    	private static final File archive = new File(root.getPath(), "assets.zip");
    
    	/**
    	 * An <code>int</code> which represents the current file system revision.
    	 */
    	private static final int CURRENT_VERSION = 1;
    
    	/**
    	 * Downloads the file system from an {@link URL}.
    	 * @param client	The {@link client} instance is used to show the progress of the download.
    	 * @param url	The {@link URL} to download our assets from. <must be a direct link!>
    	 * @throws IOException	If some I/O exception occurs.
    	 */
    	protected static void download(client client, URL url) throws IOException {
    		if (createDirectory(root)) {
    			return;
    		}
    
    		if (versionFile.exists() && getVersion(new FileInputStream(versionFile)) == CURRENT_VERSION) {
    			return;
    		}
    
    		MessageGrabber.getAndPrint(true);
    
    		URLConnection connection = url.openConnection();
    
    		try (InputStream is = new BufferedInputStream(connection.getInputStream())) {
    			try (OutputStream os = new BufferedOutputStream(new FileOutputStream(archive))) {
    
    				byte[] buffer = new byte[(int) connection.getContentLengthLong()];
    				long total = 0;
    
    				for (int read = 0; read != -1; read = is.read(buffer)) {
    					os.write(buffer, 0, read);
    					total += read;
    					int percentage = (int) (((double) total / (double) connection.getContentLengthLong()) * 100D);
    					client.drawLoadingText(percentage, "Downloading assets " + percentage + "%");
    				}
    
    				os.flush();
    			}
    		}
    
    		unzip(client);
    	}
    
    	/**
    	 * Unzips the {@link #archive} {@link File} object.
    	 * @param client The {@link client} instance is used to show the progress of the unzip.
    	 * @throws IOException	If some I/O exception occurs.
    	 */
    	private static void unzip(client client) throws IOException {
    		try (ZipInputStream zis = new ZipInputStream(new FileInputStream(archive))) {
    
    			for (ZipEntry entry = null; entry != null; entry = zis.getNextEntry()) {
    
    				String directory = root.getPath() + File.separator + entry.getName();
    
    				if (entry.isDirectory()) {
    					if (!createDirectory(new File(directory))) {
    						break;
    					}
    				} else {
    
    					try (OutputStream os = new BufferedOutputStream(new FileOutputStream(new File(directory)))) {
    
    						int percentage = 0;
    
    						for (int read = zis.read(); read != -1; read = zis.read()) {
    							os.write(read);
    
    							percentage = percentage++ % 10;
    
    							client.drawLoadingText(percentage, "Extracting assets...");
    
    							if (percentage > 100) {
    								percentage = 0;
    							}
    						}
    
    						zis.closeEntry();
    						os.flush();
    					}
    				}
    
    			}
    
    		}
    
    		if (putVersion(new FileOutputStream(versionFile), CURRENT_VERSION)) {
    			if (!delete(archive)) {
    				throw new RuntimeException("couldn't delete archive");
    			}
    		}
    	}
    
    	/**
    	 * Deletes a specified {@link File} object.
    	 * @param file	The {@link File} object to delete/
    	 * @return	true if and only if the file or directory is successfully deleted; false otherwise.
    	 */
    	private static boolean delete(File file) {
    		return file.delete();
    	}
    
    	/**
    	 * Creates the directory named by this abstract pathname, including any necessary but nonexistent parent directories.
    	 * @param file	The {@link File} object to 
    	 * @return	true if and only if the directory was created, along with all necessary parent directories; false otherwise
    	 */
    	private static boolean createDirectory(File file) {
    		if (file.isDirectory()) {
    			return false;
    		}
    		return file.mkdirs();
    	}
    
    	/**
    	 * Puts the version to the specified {@link OutputStream}.
    	 * @param os	The {@link OutputStream} to write the version to.
    	 * @param version	The version to write to the {@link OutputStream}.
    	 * @return	<code>true</code> If and only if the version was written to the specified {@link OutputStream}.
    	 * @throws IOException	If some I/O exception occurs.
    	 */
    	private static boolean putVersion(OutputStream os, int version) throws IOException {
    		DataOutputStream dos = new DataOutputStream(os);
    		dos.write(version);
    		dos.flush();
    		dos.close();
    		return true;
    	}
    
    	/**
    	 * Gets the version from an {@link InputStream}.
    	 * @param is	The specified {@link InputStream}.
    	 * @return	The integer representation of the version.
    	 * @throws IOException	If some I/O exception occurs.
    	 */
    	private static int getVersion(InputStream is) throws IOException {
    		DataInputStream dis = new DataInputStream(is);
    		int version = dis.read();
    		dis.close();
    		return version;
    	}
    
    }
    Client startUp() snippet:

    Code:
    	void startUp() {
    		super.drawLoadingText(20, "Simplicity Is Loading");
    		try {
    			CacheDownloader.download(this, new URL("https://www.mediafire.com/?4fa0bd37vj465fd"));
    		} catch (IOException e) {
    			e.printStackTrace();
    		}
    		Calendar date = new GregorianCalendar();
    		if(date.get(Calendar.MONTH) == 11) {
    			snow = true;
    		}
    		if (SignLink.sunjava)
    			super.minDelay = 5;
    		if (aBoolean993) {
    			 //rsAlreadyLoaded = true;
    			 //return;
    		}
    		aBoolean993 = true;
    		boolean flag = true;
    		String s = getDocumentBaseHost();
    		if (SignLink.cache_dat != null) {
    			for (int i = 0; i < 5; i++)
    				decompressors[i] = new Decompressor(SignLink.cache_dat,
    						SignLink.cache_idx[i], i + 1);
    		}
    		try {
    			titleStreamLoader = streamLoaderForName(1, "title screen", "title",
    					expectedCRCs[1], 25);
    			newRegularFont2 = new TextDrawingArea(false, "p12_full",
    					titleStreamLoader);
    			smallText = new TextDrawingArea(false, "p11_full",
    					titleStreamLoader);
    			aTextDrawingArea_1271 = new TextDrawingArea(false, "p12_full",
    					titleStreamLoader);
    			chatTextDrawingArea = new TextDrawingArea(false, "b12_full",
    					titleStreamLoader);
    			TextDrawingArea aTextDrawingArea_1273 = new TextDrawingArea(true,
    					"q8_full", titleStreamLoader);
    			newRegularFont = new TextDrawingArea2(false, "p12_full",
    					titleStreamLoader);
    			newRegularFont3 = new RSFont(false, "p12_full",
    					titleStreamLoader);
    			StreamLoader streamLoader = streamLoaderForName(2, "config",
    					"config", expectedCRCs[2], 30);
    			StreamLoader streamLoader_1 = streamLoaderForName(3, "interface",
    					"interface", expectedCRCs[3], 35);
    			StreamLoader streamLoader_2 = streamLoaderForName(4, "2d graphics",
    					"media", expectedCRCs[4], 40);
    			StreamLoader streamLoader_3 = streamLoaderForName(6, "textures",
    					"textures", expectedCRCs[6], 45);
    			StreamLoader streamLoader_4 = streamLoaderForName(7, "chat system",
    					"wordenc", expectedCRCs[7], 50);
    			StreamLoader streamLoader_5 = streamLoaderForName(8,
    					"sound effects", "sounds", expectedCRCs[8], 55);
    			SpriteLoader.loadSprites(streamLoader_2);
    			cacheSprite = SpriteLoader.sprites;
    
    			drawLogo();
    			loadTitleScreen();
    			byteGroundArray = new byte[4][104][104];
    			intGroundArray = new int[4][105][105];
    			worldController = new WorldController(intGroundArray);
    			for (int j = 0; j < 4; j++)
    				aClass11Array1230[j] = new Class11();
    			aClass30_Sub2_Sub1_Sub1_1263 = new Sprite(512, 512);
    			StreamLoader streamLoader_6 = streamLoaderForName(5, "update list",
    					"versionlist", expectedCRCs[5], 60);
    			for(int i = 0; i < bgs.length; i++) {
                    bgs[i] = new Sprite("bgs/bg" + i);
                }
    			drawSmoothLoading(30, "Connecting to update server");
    			onDemandFetcher = new OnDemandFetcher();
    			onDemandFetcher.start(streamLoader_6, this);
    			Class36.method528(onDemandFetcher.getAnimCount());
    			Model.method459(onDemandFetcher.getModelCount(), onDemandFetcher);
    			// models();
    			// repackCacheIndex(1);
    			// preloadModels();
    			// maps();
    			musics();
    			DataBase.loadAnimations();
    			if (!lowMem) {
    				nextSong = 0;
    				try {
    					nextSong = Integer.parseInt(getParameter("music"));
    				} catch (Exception _ex) {
    				}
    				// songChanging = true;
    				// onDemandFetcher.method558(2, nextSong);
    				while (onDemandFetcher.getNodeCount() > 0) {
    					processOnDemandQueue();
    					try {
    						Thread.sleep(100L);
    					} catch (Exception _ex) {
    					}
    					if (onDemandFetcher.anInt1349 > 3) {
    						loadError();
    						return;
    					}
    				}
    			}
    			loadNewMap();
    			drawSmoothLoading(40, "Unpacking media");
    			/* Custom sprite unpacking */
    			try {
    				loginBox = new Sprite("title");
    				loginBoxHover = new Sprite("box_hover");
    				loginHoverWorld = new Sprite("login_hover2");
    				HPBarFull = cacheSprite[160];
    				HPBarEmpty = cacheSprite[18];
    				for (int ii1 = 0; ii1 < 14; ii1++)
    					fsSprite[ii1] = cacheSprite[ii1 + 73];
    				for (int i = 0; i < 3; i++)
    					counter[i] = cacheSprite[i + 51];
    				for (int i1 = 0; i1 < 2; ++i1)
    					chatToggle[i1] = new Sprite("fullscreen/chattoggle " + i1);
    			} catch (Exception e) {
    				e.printStackTrace();
    			}
    			magicAuto = cacheSprite[71];
    			infinity = cacheSprite[27];
    			logoutX = cacheSprite[19];
    			xpFlag = cacheSprite[50];
    			chatArea = new Sprite("chatarea");
    			tabArea = cacheSprite[15];
    			tabHover = cacheSprite[29];
    			tabClicked = cacheSprite[28];
    			for (int nSI = 0; nSI <= 14; nSI++)
    				newSideIcons[nSI] = cacheSprite[nSI];
    			tabArea2 = cacheSprite[16];
    			mapArea = cacheSprite[20];
    			backgroundFix = new Sprite("background");
    			logo = new Sprite("logo");
    			login = new Sprite("login");
    			titlebox = new Sprite("titlebox");
    			selected1 = new Sprite("selected1");
    			selected2 = new Sprite("selected2");
    			connecting = new Sprite("connecting");
    			incc = new Sprite("incc");
    			erca = new Sprite("erca");
    			acd = new Sprite("acd");
    			acal = new Sprite("acal");
    			loglim = new Sprite("loglim");
    			newTabs = new Sprite("554long");
    			orbbg = new Sprite("orbbg");
    			orbbghover = new Sprite("orbbg2");
    			for (int i = 0; i < 16; i++) {
    				ORBS[i] = cacheSprite[i + 54];
    			}
    			for (int i = 0; i <= 2; i++) {
    				globe[i] = cacheSprite[i + 95];
    			}
    			customMapArea = cacheSprite[20];
    			CustomMapBack = cacheSprite[20];
    			multiOverlay = new Sprite(streamLoader_2, "overlay_multiway", 0);
    			/**/
    			mapBack = new Background(streamLoader_2, "mapback", 0);
    			for (int c1 = 0; c1 <= 3; c1++)
    				chatButtons[c1] = new Sprite(streamLoader_2, "chatbuttons", c1);
    			for (int j3 = 0; j3 <= 12; j3++)
    				sideIcons[j3] = new Sprite(streamLoader_2, "sideicons", j3);
    			sideIcons[13] = cacheSprite[72];
    			for (int r1 = 0; r1 < 5; r1++)
    				redStones[r1] = cacheSprite[r1 + 21];
    			for (int i4 = 0; i4 < 10; i4++)
    				hitMark[i4] = cacheSprite[99 + i4];
    			for (int i4 = 0; i4 < 5; i4++)
    				hitIcon[i4] = cacheSprite[108 + i4];
    			compass = new Sprite(streamLoader_2, "compass", 0);
    			mapEdge = new Sprite(streamLoader_2, "mapedge", 0);
    			mapEdge.method345();
    			try {
    				for (int k3 = 0; k3 < 100; k3++)
    					mapScenes[k3] = new Background(streamLoader_2, "mapscene",
    							k3);
    			} catch (Exception _ex) {
    			}
    			try {
    				for (int l3 = 0; l3 < 100; l3++)
    					mapFunctions[l3] = new Sprite(streamLoader_2,
    							"mapfunction", l3);
    			} catch (Exception _ex) {
    			}
    			try {
    				for (int i4 = 0; i4 < 20; i4++)
    					hitMarks[i4] = new Sprite(streamLoader_2, "hitmarks", i4);
    			} catch (Exception _ex) {
    			}
    
    			try {
    				for (int h1 = 0; h1 < 6; h1++)
    					headIconsHint[h1] = new Sprite(streamLoader_2,
    							"headicons_hint", h1);
    			} catch (Exception _ex) {
    			}
    			try {
    				for (int j4 = 0; j4 < 8; j4++)
    					headIcons[j4] = new Sprite(streamLoader_2,
    							"headicons_prayer", j4);
    				for (int j77 = 9; j77 < 18; j77++) {// TODO
    					headIcons[j77] = cacheSprite[j77 + 30];
    				}
    				for (int j45 = 0; j45 < 3; j45++)
    					skullIcons[j45] = new Sprite(streamLoader_2,
    							"headicons_pk", j45);
    			} catch (Exception _ex) {
    				_ex.printStackTrace();
    			}
    			mapFlag = new Sprite(streamLoader_2, "mapmarker", 0);
    			mapMarker = new Sprite(streamLoader_2, "mapmarker", 1);
    			for (int k4 = 0; k4 < 8; k4++)
    				crosses[k4] = new Sprite(streamLoader_2, "cross", k4);
    
    			mapDotItem = new Sprite(streamLoader_2, "mapdots", 0);
    			mapDotNPC = new Sprite(streamLoader_2, "mapdots", 1);
    			mapDotPlayer = new Sprite(streamLoader_2, "mapdots", 2);
    			mapDotFriend = new Sprite(streamLoader_2, "mapdots", 3);
    			mapDotTeam = new Sprite(streamLoader_2, "mapdots", 4);
    			mapDotClan = new Sprite(streamLoader_2, "mapdots", 5);
    			scrollBar1 = new Sprite(streamLoader_2, "scrollbar", 0);
    			scrollBar2 = new Sprite(streamLoader_2, "scrollbar", 1);
    
    			for(int l4 = 0; l4 < 2; l4++)
    			 oldModIcons[l4] = new Background(streamLoader_2, "mod_icons", l4);
    			
    			modIcons[3] = cacheSprite[89];
    			modIcons[4] = cacheSprite[94];
    			modIcons[5] = cacheSprite[95];
    			modIcons[6] = new Sprite("support");
    			
    			newRegularFont3.unpackChatImages(modIcons);
    			Sprite sprite = new Sprite(streamLoader_2, "screenframe", 0);
    			leftFrame = new RSImageProducer(sprite.myWidth, sprite.myHeight,
    					getGameComponent());
    			// System.out.println("w:"+sprite.myWidth+"H:"+sprite.myHeight);
    			sprite.method346(0, 0);
    			sprite = new Sprite(streamLoader_2, "screenframe", 1);
    			topFrame = new RSImageProducer(sprite.myWidth, sprite.myHeight,
    					getGameComponent());
    			// System.out.println("w:"+sprite.myWidth+"H:"+sprite.myHeight);
    			sprite.method346(0, 0);
    			sprite = new Sprite(streamLoader_2, "screenframe", 2);
    			rightFrame = new RSImageProducer(sprite.myWidth, sprite.myHeight,
    					getGameComponent());
    			// System.out.println("w:"+sprite.myWidth+"H:"+sprite.myHeight);
    			sprite.method346(0, 0);
    			sprite = new Sprite(streamLoader_2, "mapedge", 0);
    			mapEdgeIP = new RSImageProducer(sprite.myWidth, sprite.myHeight,
    					getGameComponent());
    			// System.out.println("w:"+sprite.myWidth+"H:"+sprite.myHeight);
    			sprite.method346(0, 0);
    
    			int i5 = (int) (Math.random() * 21D) - 10;
    			int j5 = (int) (Math.random() * 21D) - 10;
    			int k5 = (int) (Math.random() * 21D) - 10;
    			int l5 = (int) (Math.random() * 41D) - 20;
    			for (int i6 = 0; i6 < 100; i6++) {
    				if (mapFunctions[i6] != null)
    					mapFunctions[i6].method344(i5 + l5, j5 + l5, k5 + l5);
    				if (mapScenes[i6] != null)
    					mapScenes[i6].method360(i5 + l5, j5 + l5, k5 + l5);
    			}
    
    			drawSmoothLoading(83, "Unpacking textures");
    			Texture.method368(streamLoader_3);
    			Texture.method372(0.80000000000000004D);
    			Texture.method367();
    			drawSmoothLoading(86, "Unpacking config");
    
    			try {
    				Animation.unpackConfig(streamLoader);
    				ObjectDef.unpackConfig(streamLoader);
    				Flo.unpackConfig(streamLoader);
    				ItemDef.unpackConfig(streamLoader);
    				EntityDef.unpackConfig(streamLoader);
    				IDK.unpackConfig(streamLoader);
    				SpotAnim.unpackConfig(streamLoader);
    				Varp.unpackConfig(streamLoader);
    				VarBit.unpackConfig(streamLoader);
    				ItemDef.isMembers = true;
    			} catch (Exception e) {
    				e.printStackTrace();
    			}
    			drawSmoothLoading(90, "Unpacking sounds");
    			byte abyte0[] = streamLoader_5.getDataForName("sounds.dat");
    			Stream stream = new Stream(abyte0);
    			Sounds.unpack(stream);
    			drawSmoothLoading(95, "Unpacking interfaces");
    			TextDrawingArea aclass30_sub2_sub1_sub4s[] = { smallText,
    					aTextDrawingArea_1271, chatTextDrawingArea,
    					aTextDrawingArea_1273 };
    			RSInterface.fonts = aclass30_sub2_sub1_sub4s;
    			RSInterface.unpack(streamLoader_1, aclass30_sub2_sub1_sub4s,
    					streamLoader_2);
    			drawSmoothLoading(99, "Preparing game engine");
    			//preloadModels();
    			for (int j6 = 0; j6 < 33; j6++) {
    				int k6 = 999;
    				int i7 = 0;
    				for (int k7 = 0; k7 < 34; k7++) {
    					if (mapBack.aByteArray1450[k7 + j6 * mapBack.anInt1452] == 0) {
    						if (k6 == 999)
    							k6 = k7;
    					} else {
    						if (k6 == 999)
    							continue;
    						i7 = k7;
    						break;
    					}
    				}
    
    				anIntArray968[j6] = k6;
    				anIntArray1057[j6] = i7 - k6;
    			}

    Thanks for anyone who can help!

    Fixed everything Client SIDED
    Reply With Quote  
     

  2. #2  
    Stand guard at the door of your mind

    Proto's Avatar
    Join Date
    Jul 2011
    Age
    29
    Posts
    1,234
    Thanks given
    152
    Thanks received
    413
    Rep Power
    462
    Very highly recommend you stay away from this source if you are trying to learn. A lot of people think that because of Ikovs success this source has potential but they're forgetting the months of work that was put into Ikov before it was even released the first time.

    If you want to learn Java, go check out Asteria and read a book/watch a course.

    Anyway, PM me I have a proposition




    Reply With Quote  
     

  3. Thankful user:



Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. Replies: 1
    Last Post: 07-21-2015, 03:24 PM
  2. Replies: 1
    Last Post: 07-17-2015, 08:33 PM
  3. need help setting up zarketh
    By boterkoekje12 in forum Help
    Replies: 6
    Last Post: 01-23-2015, 02:46 AM
  4. need help setting up zarketh
    By boterkoekje12 in forum Help
    Replies: 0
    Last Post: 01-20-2015, 09:44 PM
  5. I need help starting up a simple/clean website!
    By OldScoolChevy in forum Application Development
    Replies: 2
    Last Post: 01-08-2015, 11:13 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •