summaryrefslogtreecommitdiff
path: root/NET/worlds/console/WebControlImp.java
diff options
context:
space:
mode:
Diffstat (limited to 'NET/worlds/console/WebControlImp.java')
-rw-r--r--NET/worlds/console/WebControlImp.java122
1 files changed, 122 insertions, 0 deletions
diff --git a/NET/worlds/console/WebControlImp.java b/NET/worlds/console/WebControlImp.java
new file mode 100644
index 0000000..45cbfde
--- /dev/null
+++ b/NET/worlds/console/WebControlImp.java
@@ -0,0 +1,122 @@
+package NET.worlds.console;
+
+import NET.worlds.core.Std;
+import NET.worlds.network.NetUpdate;
+import NET.worlds.network.WorldServer;
+import NET.worlds.scape.Pilot;
+import NET.worlds.scape.Room;
+import NET.worlds.scape.TextureSurfaceRenderer;
+import java.util.Enumeration;
+import java.util.Vector;
+
+public abstract class WebControlImp implements TextureSurfaceRenderer {
+ public static final int downloadBegin = 0;
+ public static final int downloadEnd = 1;
+ public static final int titleChanged = 2;
+ public static final int propertyChanged = 3;
+ public static final int statusChanged = 4;
+ public static final int commandStateChanged = 5;
+ Vector<WebControlListener> listeners = new Vector<WebControlListener>();
+
+ WebControlImp(int hwnd) {
+ }
+
+ public static String processURL(String pURL) {
+ if (pURL.indexOf("$USERNAME") == -1
+ && pURL.indexOf("$UPGRADESERVER") == -1
+ && pURL.indexOf("$SCRIPTSERVER") == -1
+ && pURL.indexOf("$SERIALNUM") == -1
+ && pURL.indexOf("$WORLD") == -1
+ && pURL.indexOf("$ROOM") == -1) {
+ return pURL;
+ } else {
+ pURL = Std.replaceStr(pURL, "$UPGRADESERVER", NetUpdate.getUpgradeServerURL());
+ if (Console.getActive() != null) {
+ pURL = Std.replaceStr(pURL, "$SCRIPTSERVER", Console.getActive().getScriptServer());
+ } else if (pURL.indexOf("$SCRIPTSERVER") != -1) {
+ return null;
+ }
+
+ if (Pilot.getActive() != null) {
+ Pilot p = Pilot.getActive();
+ if (p != null && p.getWorld() != null) {
+ pURL = Std.replaceStr(pURL, "$WORLD", p.getWorld().toString());
+ }
+
+ Room r = Pilot.getActiveRoom();
+ if (r != null) {
+ pURL = Std.replaceStr(pURL, "$ROOM", Pilot.getActiveRoom().toString());
+ }
+
+ WorldServer w = Pilot.getActive().getServer();
+ if (w != null && w.getGalaxy() != null) {
+ String name = w.getGalaxy().getChatname();
+ if (pURL.indexOf("$USERNAME") != -1) {
+ if (name == null || name.equals("")) {
+ return null;
+ }
+
+ pURL = Std.replaceStr(pURL, "$USERNAME", name);
+ }
+
+ String serial = w.getGalaxy().getSerialNum();
+ if (pURL.indexOf("$SERIALNUM") != -1) {
+ if (serial == null || serial.equals("")) {
+ return null;
+ }
+
+ pURL = Std.replaceStr(pURL, "$SERIALNUM", serial);
+ }
+ } else if (pURL.indexOf("$SERIALNUM") != -1 || pURL.indexOf("$USERNAME") != -1) {
+ return null;
+ }
+ }
+
+ return pURL.indexOf("$SERIALNUM") == -1 && pURL.indexOf("$USERNAME") == -1 ? pURL : null;
+ }
+ }
+
+ public abstract boolean setURL(String var1);
+
+ public abstract boolean setURL(String var1, String var2);
+
+ public abstract void goBack();
+
+ public abstract void goForward();
+
+ public abstract void stop();
+
+ public abstract void refresh();
+
+ public abstract void home();
+
+ public abstract void resize(int var1, int var2, int var3, int var4);
+
+ public abstract int getHWND();
+
+ @Override
+ public abstract void renderTo(int var1);
+
+ public void addListener(WebControlListener l) {
+ this.listeners.addElement(l);
+ }
+
+ public void removeListener(WebControlListener l) {
+ this.listeners.removeElement(l);
+ }
+
+ void receiveEvent(int eventID) {
+ Enumeration<WebControlListener> e = this.listeners.elements();
+
+ while (e.hasMoreElements()) {
+ WebControlListener l = e.nextElement();
+ if (l != null) {
+ l.webControlEvent(eventID);
+ }
+ }
+ }
+
+ public void detach() {
+ this.listeners.removeAllElements();
+ }
+}