mirror of
https://github.com/2006-Scape/Parabot.git
synced 2026-07-07 08:39:12 +00:00
Updated to V2.04
Including database server providers - loading
This commit is contained in:
@@ -44,3 +44,5 @@ parabotv2/src/META-INF/MANIFEST.MF
|
|||||||
|
|
||||||
*.idx3
|
*.idx3
|
||||||
/bin
|
/bin
|
||||||
|
|
||||||
|
.idea/uiDesigner.xml
|
||||||
|
|||||||
@@ -9,8 +9,9 @@ public class Configuration {
|
|||||||
public static final String LOGIN_SERVER = "http://www.parabot.org/community/api/login.php?username=%s&password=%s";
|
public static final String LOGIN_SERVER = "http://www.parabot.org/community/api/login.php?username=%s&password=%s";
|
||||||
public static final String SDN_SCRIPTS = "http://sdn.parabot.org/scripts.php?user=%s";
|
public static final String SDN_SCRIPTS = "http://sdn.parabot.org/scripts.php?user=%s";
|
||||||
public static final String GET_SDN_SCRIPT = "http://sdn.parabot.org/getscript.php?user=%s&pass=%s&scriptid=%d";
|
public static final String GET_SDN_SCRIPT = "http://sdn.parabot.org/getscript.php?user=%s&pass=%s&scriptid=%d";
|
||||||
public static final String GET_SERVER_PROVIDERS = "http://sdn.parabot.org/list/providers.php";
|
public static final String GET_SERVER_PROVIDERS = "http://sdn.parabot.org/providers/index.php";
|
||||||
public static final String GET_SERVER_PROVIDER = "http://sdn.parabot.org/providers/%s";
|
public static final String GET_SERVER_PROVIDER = "http://sdn.parabot.org/providers/provider.php?id=";
|
||||||
|
public static final String GET_SERVER_PROVIDER_INFO = "http://sdn.parabot.org/providers/getInformation.php?id=";
|
||||||
public static final String GET_BOT_VERSION = "http://bot.parabot.org/version.txt";
|
public static final String GET_BOT_VERSION = "http://bot.parabot.org/version.txt";
|
||||||
|
|
||||||
public static final double BOT_VERSION = 2.04; // BETA
|
public static final double BOT_VERSION = 2.04; // BETA
|
||||||
|
|||||||
@@ -98,5 +98,4 @@ public class Core {
|
|||||||
Core.verbose("Updates available...");
|
Core.verbose("Updates available...");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
package org.parabot.core.forum;
|
package org.parabot.core.forum;
|
||||||
|
|
||||||
import java.net.URLEncoder;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
import org.parabot.core.Configuration;
|
import org.parabot.core.Configuration;
|
||||||
import org.parabot.core.Core;
|
import org.parabot.core.Core;
|
||||||
import org.parabot.core.parsers.scripts.SDNScripts;
|
import org.parabot.core.parsers.scripts.SDNScripts;
|
||||||
@@ -10,6 +7,9 @@ import org.parabot.core.ui.LoginUI;
|
|||||||
import org.parabot.environment.api.utils.WebUtil;
|
import org.parabot.environment.api.utils.WebUtil;
|
||||||
import org.parabot.environment.scripts.SDNScriptExecuter;
|
import org.parabot.environment.scripts.SDNScriptExecuter;
|
||||||
|
|
||||||
|
import java.net.URLEncoder;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles logging in to parabot forum, only certain classes may use this class.
|
* Handles logging in to parabot forum, only certain classes may use this class.
|
||||||
*
|
*
|
||||||
@@ -60,9 +60,9 @@ public final class AccountManager {
|
|||||||
String contents = null;
|
String contents = null;
|
||||||
try {
|
try {
|
||||||
contents = WebUtil.getContents(String.format(
|
contents = WebUtil.getContents(String.format(
|
||||||
Configuration.LOGIN_SERVER,
|
Configuration.LOGIN_SERVER,
|
||||||
URLEncoder.encode(user, "UTF-8"),
|
URLEncoder.encode(user, "UTF-8"),
|
||||||
URLEncoder.encode(pass, "UTF-8")));
|
URLEncoder.encode(pass, "UTF-8")));
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
t.printStackTrace();
|
t.printStackTrace();
|
||||||
return false;
|
return false;
|
||||||
@@ -71,7 +71,7 @@ public final class AccountManager {
|
|||||||
if (contents.equals("correct")) {
|
if (contents.equals("correct")) {
|
||||||
account = new Account(user, pass);
|
account = new Account(user, pass);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ public class PublicServers extends ServerParser {
|
|||||||
version = Double.parseDouble(line);
|
version = Double.parseDouble(line);
|
||||||
break;
|
break;
|
||||||
case 0:
|
case 0:
|
||||||
// jarName
|
// serverID
|
||||||
ServerDescription desc = new ServerDescription(name,
|
ServerDescription desc = new ServerDescription(name,
|
||||||
author, version);
|
author, version);
|
||||||
SERVER_CACHE.put(desc, new PublicServerExecuter(name, line));
|
SERVER_CACHE.put(desc, new PublicServerExecuter(name, line));
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package org.parabot.core.ui;
|
package org.parabot.core.ui;
|
||||||
|
|
||||||
|
import org.parabot.core.Configuration;
|
||||||
import org.parabot.core.ui.components.BotToolbar;
|
import org.parabot.core.ui.components.BotToolbar;
|
||||||
import org.parabot.core.ui.components.GamePanel;
|
import org.parabot.core.ui.components.GamePanel;
|
||||||
import org.parabot.core.ui.components.LogArea;
|
import org.parabot.core.ui.components.LogArea;
|
||||||
@@ -84,7 +85,7 @@ public class BotUI extends JFrame implements ActionListener {
|
|||||||
|
|
||||||
SwingUtil.finalize(this);
|
SwingUtil.finalize(this);
|
||||||
|
|
||||||
LogArea.log("parabot v2.03 started");
|
LogArea.log("parabot " + Configuration.BOT_VERSION +" started");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,12 +1,5 @@
|
|||||||
package org.parabot.environment.servers;
|
package org.parabot.environment.servers;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.lang.reflect.Constructor;
|
|
||||||
import java.net.URL;
|
|
||||||
import java.net.URLEncoder;
|
|
||||||
|
|
||||||
import javax.swing.JOptionPane;
|
|
||||||
|
|
||||||
import org.parabot.core.Configuration;
|
import org.parabot.core.Configuration;
|
||||||
import org.parabot.core.Core;
|
import org.parabot.core.Core;
|
||||||
import org.parabot.core.Directories;
|
import org.parabot.core.Directories;
|
||||||
@@ -17,6 +10,11 @@ import org.parabot.core.ui.utils.UILog;
|
|||||||
import org.parabot.environment.api.utils.WebUtil;
|
import org.parabot.environment.api.utils.WebUtil;
|
||||||
import org.parabot.environment.servers.loader.ServerLoader;
|
import org.parabot.environment.servers.loader.ServerLoader;
|
||||||
|
|
||||||
|
import javax.swing.*;
|
||||||
|
import java.io.File;
|
||||||
|
import java.lang.reflect.Constructor;
|
||||||
|
import java.net.URL;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Fetches a server provider from the parabot sdn
|
* Fetches a server provider from the parabot sdn
|
||||||
@@ -26,26 +24,38 @@ import org.parabot.environment.servers.loader.ServerLoader;
|
|||||||
*/
|
*/
|
||||||
public class PublicServerExecuter extends ServerExecuter {
|
public class PublicServerExecuter extends ServerExecuter {
|
||||||
private String serverName = null;
|
private String serverName = null;
|
||||||
private String jarName = null;
|
private String serverID = null;
|
||||||
|
|
||||||
public PublicServerExecuter(final String serverName, final String jarName) {
|
public PublicServerExecuter(final String serverName, final String serverID) {
|
||||||
this.serverName = serverName;
|
this.serverName = serverName;
|
||||||
this.jarName = jarName;
|
this.serverID = serverID;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run(ThreadGroup tg) {
|
public void run(ThreadGroup tg) {
|
||||||
try {
|
try {
|
||||||
final File destination = new File(Directories.getCachePath(),
|
final File destination = new File(Directories.getCachePath(),
|
||||||
this.jarName);
|
this.serverID);
|
||||||
final String jarUrl = String.format(
|
final String jarUrl = Configuration.GET_SERVER_PROVIDER + this.serverID;
|
||||||
Configuration.GET_SERVER_PROVIDER,
|
final String providerInfo = Configuration.GET_SERVER_PROVIDER_INFO + this.serverID;
|
||||||
URLEncoder.encode(this.jarName, "UTF-8"));
|
|
||||||
|
try{
|
||||||
|
Integer.parseInt(this.serverID);
|
||||||
|
}catch(NumberFormatException e){
|
||||||
|
UILog.log(
|
||||||
|
"Error",
|
||||||
|
"Failed to parse the server ID for the server provider, error: [Server ID is not an integer.]",
|
||||||
|
JOptionPane.ERROR_MESSAGE);
|
||||||
|
}
|
||||||
|
|
||||||
Core.verbose("Downloading: " + jarUrl + " ...");
|
Core.verbose("Downloading: " + jarUrl + " ...");
|
||||||
|
|
||||||
WebUtil.downloadFile(new URL(jarUrl), destination,
|
WebUtil.downloadFile(new URL(jarUrl), destination,
|
||||||
VerboseLoader.get());
|
VerboseLoader.get());
|
||||||
|
|
||||||
|
WebUtil.downloadFile(new URL(providerInfo),
|
||||||
|
new File(System.getProperty("user.home") + "/serverProvider.pb"),
|
||||||
|
VerboseLoader.get());
|
||||||
|
|
||||||
Core.verbose("Server provider downloaded...");
|
Core.verbose("Server provider downloaded...");
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,5 @@
|
|||||||
package org.parabot.environment.servers;
|
package org.parabot.environment.servers;
|
||||||
|
|
||||||
import java.applet.Applet;
|
|
||||||
import java.applet.AppletStub;
|
|
||||||
import java.net.URL;
|
|
||||||
import javax.swing.JMenuBar;
|
|
||||||
|
|
||||||
import org.objectweb.asm.Opcodes;
|
import org.objectweb.asm.Opcodes;
|
||||||
import org.parabot.core.Context;
|
import org.parabot.core.Context;
|
||||||
import org.parabot.core.asm.interfaces.Injectable;
|
import org.parabot.core.asm.interfaces.Injectable;
|
||||||
@@ -13,6 +8,11 @@ import org.parabot.environment.input.Keyboard;
|
|||||||
import org.parabot.environment.input.Mouse;
|
import org.parabot.environment.input.Mouse;
|
||||||
import org.parabot.environment.scripts.Script;
|
import org.parabot.environment.scripts.Script;
|
||||||
|
|
||||||
|
import javax.swing.*;
|
||||||
|
import java.applet.Applet;
|
||||||
|
import java.applet.AppletStub;
|
||||||
|
import java.net.URL;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides a server to the bot
|
* Provides a server to the bot
|
||||||
*
|
*
|
||||||
@@ -62,8 +62,8 @@ public abstract class ServerProvider implements Opcodes {
|
|||||||
/**
|
/**
|
||||||
* Add custom items to the bot menu bar
|
* Add custom items to the bot menu bar
|
||||||
*
|
*
|
||||||
* @param menu
|
* @param bar
|
||||||
* bar to add items on
|
* menu bar to add items on
|
||||||
*/
|
*/
|
||||||
public void addMenuItems(JMenuBar bar) {
|
public void addMenuItems(JMenuBar bar) {
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user