3144 lines
95 KiB
Diff
3144 lines
95 KiB
Diff
diff -ruN a/1920/NET/worlds/console/Console.java b/1920/NET/worlds/console/Console.java
|
|
--- a/1920/NET/worlds/console/Console.java 2024-01-08 01:46:32.000000000 -0600
|
|
+++ b/1920/NET/worlds/console/Console.java 2023-08-21 23:27:17.000000000 -0500
|
|
@@ -45,6 +45,8 @@
|
|
import NET.worlds.scape.WobLoaded;
|
|
import NET.worlds.scape.WobLoader;
|
|
import NET.worlds.scape.World;
|
|
+import NET.worldstray.TrayNotifier;
|
|
+
|
|
import java.awt.CardLayout;
|
|
import java.awt.CheckboxMenuItem;
|
|
import java.awt.Container;
|
|
@@ -70,1497 +72,1498 @@
|
|
import java.util.Vector;
|
|
|
|
public abstract class Console extends SuperRoot implements URLSelf, MainCallback, NetworkObject, WobLoaded, DialogDisabled, ConnectionWaiter {
|
|
- private static Vector storedLines = new Vector();
|
|
- protected boolean disableShaperAccess = false;
|
|
- protected boolean disableSingleUserAccess = false;
|
|
- private static Console active;
|
|
- private Panel myCard;
|
|
- private static int nameCounter;
|
|
- private static Font font = new Font(message("MenuFont"), 0, 12);
|
|
- private URL targetAv;
|
|
- private static String activeTeleportURL;
|
|
- private static String lastTeleportURL;
|
|
- private static FrameEvent frameEvent;
|
|
- private static int freezeFrameEvents = 0;
|
|
- private String sleepMode = "";
|
|
- private int lastUserAction;
|
|
- private Vector parts = new Vector();
|
|
- private static MenuBar menuBar = new MenuBar();
|
|
- protected boolean enableMenu = false;
|
|
- protected MenuItem exitItem;
|
|
- private Hashtable menus = new Hashtable();
|
|
- protected static boolean autoFullVIP = IniFile.override().getIniInt("tieredVIP", 0) == 0;
|
|
- protected static boolean isRedLightWorld = IniFile.override().getIniString("ProductName", "").equalsIgnoreCase("RedLightWorld") || IniFile.override().getIniString("ProductName", "").equalsIgnoreCase("RedLightCenter");
|
|
- protected static int vip;
|
|
- protected static int spguest;
|
|
- private boolean canBroadcast = false;
|
|
- protected URL lastPilotRequested;
|
|
- public String pendingPilot = "";
|
|
- protected boolean setFromMenu = false;
|
|
- private String postFix = "";
|
|
- public static boolean selfCustom;
|
|
- protected Vector callbacks = new Vector();
|
|
- private String defaultAction = "";
|
|
- protected String tempCarAvatar = "";
|
|
- protected static String defaultConsole;
|
|
- private static Hashtable defConsoles;
|
|
- private static Console defaultUnshared;
|
|
- private int refcnt = 0;
|
|
- protected Pilot pilotSoulTemplate;
|
|
- protected Drone droneSoulTemplate;
|
|
- protected Pilot pilot;
|
|
- public boolean targetValid = false;
|
|
- private String sleepStr = message("asleep");
|
|
- protected static GammaFrame frame;
|
|
- protected Galaxy galaxy = null;
|
|
- protected URL _galaxyURL;
|
|
- private Cursor cursor = new Cursor(URL.make("system:WAIT_CURSOR"));
|
|
- private Vector tempArea = new Vector();
|
|
- private static Object classCookie;
|
|
-
|
|
- static {
|
|
- vip = IniFile.gamma().getIniInt("VIP", 0) != 0 ? (autoFullVIP ? 2 : 1) : 0;
|
|
- spguest = IniFile.gamma().getIniInt("SPGUEST", 0) != 0 ? 2 : 0;
|
|
- selfCustom = false;
|
|
- defaultConsole = IniFile.gamma().getIniString("DEFAULTCONSOLE", "NET.worlds.console.DefaultConsole");
|
|
- defConsoles = new Hashtable();
|
|
- frame = new GammaFrame();
|
|
- WhisperManager.whisperManager().setParent(frame);
|
|
- classCookie = new Object();
|
|
- }
|
|
-
|
|
- public static synchronized void println(String msg) {
|
|
- if (active != null) {
|
|
- active.printLine(msg);
|
|
- } else {
|
|
- storedLines.addElement(msg);
|
|
- }
|
|
-
|
|
- }
|
|
-
|
|
- public static void printWhisper(String from, String msg) {
|
|
- if (active != null) {
|
|
- active.printWhisperFrom(from, msg);
|
|
- }
|
|
-
|
|
- }
|
|
-
|
|
- public static void printOwnWhisper(String to, String msg) {
|
|
- if (active != null) {
|
|
- active.printWhisperTo(to, msg);
|
|
- }
|
|
-
|
|
- }
|
|
-
|
|
- public static void startWhispering(String to) {
|
|
- if (active != null) {
|
|
- active.startWhisperingTo(to);
|
|
- }
|
|
-
|
|
- }
|
|
-
|
|
- public static synchronized String message(String Id) {
|
|
- Locale currentLocale = Locale.getDefault();
|
|
-
|
|
- try {
|
|
- String bundlePrefix = IniFile.override().getIniString("BundlePrefix", "MessagesBundle");
|
|
- ResourceBundle messages = ResourceBundle.getBundle(bundlePrefix, currentLocale);
|
|
- String mess = messages.getString(Id);
|
|
- if (mess.indexOf(123) == -1 && mess.indexOf(125) == -1) {
|
|
- mess = Std.replaceStr(mess, "''", "'");
|
|
- }
|
|
-
|
|
- if (mess.lastIndexOf(".gif") > 0 || mess.lastIndexOf(".jpg") > 0 || mess.lastIndexOf(".bmp") > 0) {
|
|
- File f = new File(mess);
|
|
- if (!f.exists()) {
|
|
- return Id;
|
|
- }
|
|
- }
|
|
-
|
|
- return mess;
|
|
- } catch (MissingResourceException var6) {
|
|
- if (Galaxy.getDebugLevel() != 0) {
|
|
- System.out.println("MRE: " + var6.getClassName() + " " + var6.getKey());
|
|
- System.out.println("NO MESSAGE for " + Id);
|
|
- }
|
|
-
|
|
- return Id;
|
|
- }
|
|
- }
|
|
-
|
|
- public static synchronized String parseUnicode(String s) {
|
|
- if (s == null) {
|
|
- return s;
|
|
- } else {
|
|
- int idx;
|
|
- while((idx = s.indexOf("\\u")) != -1) {
|
|
- if (idx >= s.length() - 5) {
|
|
- return s;
|
|
- }
|
|
-
|
|
- String x = s.substring(idx + 2, idx + 6);
|
|
- char p = (char)Integer.parseInt(x, 16);
|
|
- String tmp = s.substring(0, idx) + p + s.substring(idx + 6);
|
|
- s = tmp;
|
|
- }
|
|
-
|
|
- return s;
|
|
- }
|
|
- }
|
|
-
|
|
- public static synchronized Vector parseUnicode(Vector cc) {
|
|
- for(int i = 0; i < cc.size(); ++i) {
|
|
- String s = (String)cc.elementAt(i);
|
|
- String s2 = parseUnicode(s);
|
|
- cc.setElementAt(s2, i);
|
|
- }
|
|
-
|
|
- return cc;
|
|
- }
|
|
-
|
|
- public static synchronized String parseExtended(String s) {
|
|
- String uc = "";
|
|
-
|
|
- for(int i = 0; i < s.length(); ++i) {
|
|
- char c = s.charAt(i);
|
|
- if (c > 255) {
|
|
- int ii = c;
|
|
+ private static Vector<String> storedLines = new Vector();
|
|
+ protected boolean disableShaperAccess = false;
|
|
+ protected boolean disableSingleUserAccess = false;
|
|
+ private static Console active;
|
|
+ private Panel myCard;
|
|
+ private static int nameCounter;
|
|
+ private static Font font = new Font(message("MenuFont"), 0, 12);
|
|
+ private URL targetAv;
|
|
+ private static String activeTeleportURL;
|
|
+ private static String lastTeleportURL;
|
|
+ private static FrameEvent frameEvent;
|
|
+ private static int freezeFrameEvents = 0;
|
|
+ private String sleepMode = "";
|
|
+ private int lastUserAction;
|
|
+ private Vector<FramePart> parts = new Vector();
|
|
+ private static MenuBar menuBar = new MenuBar();
|
|
+ protected boolean enableMenu = false;
|
|
+ protected MenuItem exitItem;
|
|
+ private Hashtable<String, Menu> menus = new Hashtable();
|
|
+ protected static boolean autoFullVIP = IniFile.override().getIniInt("tieredVIP", 0) == 0;
|
|
+ protected static boolean isRedLightWorld = IniFile.override().getIniString("ProductName", "").equalsIgnoreCase("RedLightWorld") || IniFile.override().getIniString("ProductName", "").equalsIgnoreCase("RedLightCenter");
|
|
+ protected static int vip;
|
|
+ protected static int spguest;
|
|
+ private boolean canBroadcast = false;
|
|
+ protected URL lastPilotRequested;
|
|
+ public String pendingPilot = "";
|
|
+ protected boolean setFromMenu = false;
|
|
+ private String postFix = "";
|
|
+ public static boolean selfCustom;
|
|
+ protected Vector<LoadedURLSelf> callbacks = new Vector();
|
|
+ private String defaultAction = "";
|
|
+ protected String tempCarAvatar = "";
|
|
+ protected static String defaultConsole;
|
|
+ private static Hashtable<URL, Console> defConsoles;
|
|
+ private static Console defaultUnshared;
|
|
+ private int refcnt = 0;
|
|
+ protected Pilot pilotSoulTemplate;
|
|
+ protected Drone droneSoulTemplate;
|
|
+ protected Pilot pilot;
|
|
+ public boolean targetValid = false;
|
|
+ private String sleepStr = message("asleep");
|
|
+ protected static GammaFrame frame;
|
|
+ protected Galaxy galaxy = null;
|
|
+ protected URL _galaxyURL;
|
|
+ private Cursor cursor = new Cursor(URL.make("system:WAIT_CURSOR"));
|
|
+ private Vector<Object> tempArea = new Vector();
|
|
+ private static Object classCookie;
|
|
+ public static TrayNotifier tray = new TrayNotifier();
|
|
+
|
|
+ static {
|
|
+ vip = IniFile.gamma().getIniInt("VIP", 0) != 0 ? (autoFullVIP ? 2 : 1) : 0;
|
|
+ spguest = IniFile.gamma().getIniInt("SPGUEST", 0) != 0 ? 2 : 0;
|
|
+ selfCustom = false;
|
|
+ defaultConsole = IniFile.gamma().getIniString("DEFAULTCONSOLE", "NET.worlds.console.DefaultConsole");
|
|
+ defConsoles = new Hashtable();
|
|
+ frame = new GammaFrame();
|
|
+ WhisperManager.whisperManager().setParent(frame);
|
|
+ classCookie = new Object();
|
|
+ }
|
|
+
|
|
+ public static synchronized void println(String msg) {
|
|
+ if (active != null) {
|
|
+ active.printLine(msg);
|
|
+ } else {
|
|
+ storedLines.addElement(msg);
|
|
+ }
|
|
+
|
|
+ }
|
|
+
|
|
+ public static void printWhisper(String from, String msg) {
|
|
+ if (active != null) {
|
|
+ active.printWhisperFrom(from, msg);
|
|
+ }
|
|
+
|
|
+ }
|
|
+
|
|
+ public static void printOwnWhisper(String to, String msg) {
|
|
+ if (active != null) {
|
|
+ active.printWhisperTo(to, msg);
|
|
+ }
|
|
+
|
|
+ }
|
|
+
|
|
+ public static void startWhispering(String to) {
|
|
+ if (active != null) {
|
|
+ active.startWhisperingTo(to);
|
|
+ }
|
|
+
|
|
+ }
|
|
+
|
|
+ public static synchronized String message(String Id) {
|
|
+ Locale currentLocale = Locale.getDefault();
|
|
+
|
|
+ try {
|
|
+ String bundlePrefix = IniFile.override().getIniString("BundlePrefix", "MessagesBundle");
|
|
+ ResourceBundle messages = ResourceBundle.getBundle(bundlePrefix, currentLocale);
|
|
+ String mess = messages.getString(Id);
|
|
+ if (mess.indexOf(123) == -1 && mess.indexOf(125) == -1) {
|
|
+ mess = Std.replaceStr(mess, "''", "'");
|
|
+ }
|
|
+
|
|
+ if (mess.lastIndexOf(".gif") > 0 || mess.lastIndexOf(".jpg") > 0 || mess.lastIndexOf(".bmp") > 0) {
|
|
+ File f = new File(mess);
|
|
+ if (!f.exists()) {
|
|
+ return Id;
|
|
+ }
|
|
+ }
|
|
+
|
|
+ return mess;
|
|
+ } catch (MissingResourceException var6) {
|
|
+ if (Galaxy.getDebugLevel() != 0) {
|
|
+ System.out.println("MRE: " + var6.getClassName() + " " + var6.getKey());
|
|
+ System.out.println("NO MESSAGE for " + Id);
|
|
+ }
|
|
+
|
|
+ return Id;
|
|
+ }
|
|
+ }
|
|
+
|
|
+ public static synchronized String parseUnicode(String s) {
|
|
+ if (s == null) {
|
|
+ return s;
|
|
+ } else {
|
|
+ int idx;
|
|
+ while((idx = s.indexOf("\\u")) != -1) {
|
|
+ if (idx >= s.length() - 5) {
|
|
+ return s;
|
|
+ }
|
|
+
|
|
+ String x = s.substring(idx + 2, idx + 6);
|
|
+ char p = (char)Integer.parseInt(x, 16);
|
|
+ String tmp = s.substring(0, idx) + p + s.substring(idx + 6);
|
|
+ s = tmp;
|
|
+ }
|
|
+
|
|
+ return s;
|
|
+ }
|
|
+ }
|
|
+
|
|
+ public static synchronized Vector<String> parseUnicode(Vector<String> cc) {
|
|
+ for(int i = 0; i < cc.size(); ++i) {
|
|
+ String s = (String)cc.elementAt(i);
|
|
+ String s2 = parseUnicode(s);
|
|
+ cc.setElementAt(s2, i);
|
|
+ }
|
|
+
|
|
+ return cc;
|
|
+ }
|
|
+
|
|
+ public static synchronized String parseExtended(String s) {
|
|
+ String uc = "";
|
|
+
|
|
+ for(int i = 0; i < s.length(); ++i) {
|
|
+ char c = s.charAt(i);
|
|
+ if (c > 255) {
|
|
+ char ii = c;
|
|
+
|
|
+ try {
|
|
+ uc = uc + "\\u" + Integer.toHexString(ii);
|
|
+ } catch (NumberFormatException var6) {
|
|
+ uc = uc + "?";
|
|
+ }
|
|
+ } else {
|
|
+ uc = uc + c;
|
|
+ }
|
|
+ }
|
|
|
|
- try {
|
|
- uc = uc + "\\u" + Integer.toHexString(ii);
|
|
- } catch (NumberFormatException var6) {
|
|
- uc = uc + "?";
|
|
- }
|
|
- } else {
|
|
- uc = uc + c;
|
|
- }
|
|
- }
|
|
-
|
|
- return uc;
|
|
- }
|
|
-
|
|
- public static boolean wasHttpNoSuchFile(String us) {
|
|
- java.net.URL u = null;
|
|
- URLConnection uc = null;
|
|
-
|
|
- try {
|
|
- u = DNSLookup.lookup(new java.net.URL(us));
|
|
- uc = u.openConnection();
|
|
- } catch (Exception var5) {
|
|
- return true;
|
|
- }
|
|
-
|
|
- try {
|
|
- return ((HttpURLConnection)uc).getResponseCode() == 404;
|
|
- } catch (Exception var4) {
|
|
- return true;
|
|
- }
|
|
- }
|
|
-
|
|
- protected void printWhisperFrom(String from, String msg) {
|
|
- if (!msg.startsWith("&|+")) {
|
|
- Object[] arguments = new Object[]{new String(from), new String(msg)};
|
|
- println(MessageFormat.format(message("whispered"), arguments));
|
|
- }
|
|
-
|
|
- }
|
|
-
|
|
- protected void printWhisperTo(String to, String msg) {
|
|
- if (!msg.startsWith("&|+")) {
|
|
- Object[] arguments = new Object[]{new String(to), new String(msg)};
|
|
- println(MessageFormat.format(message("You-whispered"), arguments));
|
|
- }
|
|
-
|
|
- }
|
|
-
|
|
- protected void startWhisperingTo(String to) {
|
|
- Object[] arguments = new Object[]{new String(to)};
|
|
- println(MessageFormat.format(message("You-want-whisp"), arguments));
|
|
- }
|
|
-
|
|
- public void printLine(String msg) {
|
|
- System.out.println(msg);
|
|
- }
|
|
-
|
|
- public boolean isShaperAccessDisabled() {
|
|
- return this.disableShaperAccess;
|
|
- }
|
|
-
|
|
- public boolean isSingleUserAccessDisabled() {
|
|
- return this.disableSingleUserAccess;
|
|
- }
|
|
-
|
|
- public static Console getActive() {
|
|
- return active;
|
|
- }
|
|
-
|
|
- public void inventoryChanged() {
|
|
- }
|
|
-
|
|
- public void forPilotOnlyActivate() {
|
|
- if (active != this) {
|
|
- this.myCard = new Panel();
|
|
- String myCardName = "" + nameCounter++;
|
|
- Container consoleTile = frame.getConsoleTile();
|
|
- consoleTile.add(myCardName, this.myCard);
|
|
- Console prev = active;
|
|
- this.activate(this.myCard);
|
|
- ((CardLayout)consoleTile.getLayout()).show(consoleTile, myCardName);
|
|
- getFrame().validate();
|
|
- if (prev != null) {
|
|
- consoleTile.remove(prev.myCard);
|
|
- prev.myCard.removeAll();
|
|
- }
|
|
-
|
|
- }
|
|
- }
|
|
-
|
|
- protected void setEnableMenu(boolean enable) {
|
|
- this.enableMenu = enable;
|
|
- if (this == active) {
|
|
- enable |= Gamma.shaper != null;
|
|
- boolean enabled = frame.getMenuBar() == menuBar && menuBar != null;
|
|
- if (enable != enabled) {
|
|
- frame.setMenuBar(enable ? menuBar : null);
|
|
- frame.pack();
|
|
- }
|
|
- }
|
|
-
|
|
- }
|
|
-
|
|
- private static synchronized void setActive(Console active) {
|
|
- Console.active = active;
|
|
- int sz = storedLines.size();
|
|
- if (sz > 0) {
|
|
- for(int i = 0; i < sz; ++i) {
|
|
- active.printLine((String)storedLines.elementAt(i));
|
|
- }
|
|
-
|
|
- storedLines.removeAllElements();
|
|
- }
|
|
-
|
|
- }
|
|
-
|
|
- protected void activate(Container c) {
|
|
- assert this.pilot != null;
|
|
-
|
|
- Console prev = active;
|
|
- if (active != null) {
|
|
- active.deactivate();
|
|
- }
|
|
-
|
|
- setActive(this);
|
|
- Main.register(this);
|
|
- this.menus.clear();
|
|
- menuBar = new MenuBar();
|
|
- this.getMenu("File");
|
|
- if (Gamma.shaper != null) {
|
|
- Gamma.shaper.activate(this, c, prev);
|
|
- }
|
|
-
|
|
- int len = this.parts.size();
|
|
-
|
|
- for(int i = 0; i < len; ++i) {
|
|
- ((FramePart)this.parts.elementAt(i)).activate(this, c, prev);
|
|
- }
|
|
-
|
|
- this.exitItem = this.addMenuItem(message("Exit"), "File");
|
|
- if (activeTeleportURL != null) {
|
|
- teleportNotification("", activeTeleportURL);
|
|
- }
|
|
-
|
|
- this.cursor.activate();
|
|
- }
|
|
-
|
|
- protected void menuDone() {
|
|
- this.setEnableMenu(this.enableMenu);
|
|
- }
|
|
-
|
|
- protected void deactivate() {
|
|
- if (active == this) {
|
|
- setActive((Console)null);
|
|
- Main.unregister(this);
|
|
- int len = this.parts.size();
|
|
-
|
|
- for(int i = 0; i < len; ++i) {
|
|
- ((FramePart)this.parts.elementAt(i)).deactivate();
|
|
- }
|
|
-
|
|
- if (Gamma.shaper != null) {
|
|
- Gamma.shaper.deactivate();
|
|
- }
|
|
-
|
|
- this.cursor.deactivate();
|
|
- frame.deactivate();
|
|
- }
|
|
- }
|
|
-
|
|
- public String getActiveTeleportURL() {
|
|
- return lastTeleportURL == null ? "" : lastTeleportURL;
|
|
- }
|
|
-
|
|
- public static void teleportNotification(String err, String url) {
|
|
- if (err != null && err.length() == 0) {
|
|
- activeTeleportURL = url;
|
|
- lastTeleportURL = url.toString();
|
|
- } else {
|
|
- activeTeleportURL = null;
|
|
- }
|
|
-
|
|
- if (active != null) {
|
|
- if (active instanceof TeleportStatus) {
|
|
- ((TeleportStatus)active).teleportStatus(err, url);
|
|
- }
|
|
-
|
|
- int len = active.parts.size();
|
|
-
|
|
- for(int i = 0; i < len; ++i) {
|
|
- Object fp = active.parts.elementAt(i);
|
|
- if (fp instanceof TeleportStatus) {
|
|
- ((TeleportStatus)fp).teleportStatus(err, url);
|
|
- }
|
|
- }
|
|
-
|
|
- }
|
|
- }
|
|
-
|
|
- public static void setFreezeFrameEvents(boolean x) {
|
|
- if (x) {
|
|
- ++freezeFrameEvents;
|
|
- } else {
|
|
- --freezeFrameEvents;
|
|
-
|
|
- assert freezeFrameEvents >= 0;
|
|
- }
|
|
-
|
|
- }
|
|
-
|
|
- public void mainCallback() {
|
|
- if (frameEvent == null) {
|
|
- frameEvent = new FrameEvent((WObject)null, (WObject)null);
|
|
- }
|
|
-
|
|
- if (freezeFrameEvents <= 0) {
|
|
- frameEvent.newFrameTime();
|
|
- frameEvent.source = this;
|
|
- this.generateFrameEvents(frameEvent);
|
|
- frameEvent.target = null;
|
|
- frameEvent.receiver = null;
|
|
- frameEvent.source = null;
|
|
- }
|
|
- }
|
|
-
|
|
- public void generateFrameEvents(FrameEvent f) {
|
|
- World.generateFrameEvents(f);
|
|
- int now = Std.getFastTime();
|
|
- if (Window.getAndResetUserActionCount() != 0) {
|
|
- this.setSleepMode((String)null);
|
|
- this.lastUserAction = now;
|
|
- } else if (now > this.lastUserAction + 300000) {
|
|
- if (this.lastUserAction == 0) {
|
|
+ return uc;
|
|
+ }
|
|
+
|
|
+ public static boolean wasHttpNoSuchFile(String us) {
|
|
+ java.net.URL u = null;
|
|
+ URLConnection uc = null;
|
|
+
|
|
+ try {
|
|
+ u = DNSLookup.lookup(new java.net.URL(us));
|
|
+ uc = u.openConnection();
|
|
+ } catch (Exception var5) {
|
|
+ return true;
|
|
+ }
|
|
+
|
|
+ try {
|
|
+ return ((HttpURLConnection)uc).getResponseCode() == 404;
|
|
+ } catch (Exception var4) {
|
|
+ return true;
|
|
+ }
|
|
+ }
|
|
+
|
|
+ protected void printWhisperFrom(String from, String msg) {
|
|
+ if (!msg.startsWith("&|+")) {
|
|
+ Object[] arguments = new Object[]{new String(from), new String(msg)};
|
|
+ println(MessageFormat.format(message("whispered"), arguments));
|
|
+ }
|
|
+
|
|
+ }
|
|
+
|
|
+ protected void printWhisperTo(String to, String msg) {
|
|
+ if (!msg.startsWith("&|+")) {
|
|
+ Object[] arguments = new Object[]{new String(to), new String(msg)};
|
|
+ println(MessageFormat.format(message("You-whispered"), arguments));
|
|
+ }
|
|
+
|
|
+ }
|
|
+
|
|
+ protected void startWhisperingTo(String to) {
|
|
+ Object[] arguments = new Object[]{new String(to)};
|
|
+ println(MessageFormat.format(message("You-want-whisp"), arguments));
|
|
+ }
|
|
+
|
|
+ public void printLine(String msg) {
|
|
+ System.out.println(msg);
|
|
+ }
|
|
+
|
|
+ public boolean isShaperAccessDisabled() {
|
|
+ return this.disableShaperAccess;
|
|
+ }
|
|
+
|
|
+ public boolean isSingleUserAccessDisabled() {
|
|
+ return this.disableSingleUserAccess;
|
|
+ }
|
|
+
|
|
+ public static Console getActive() {
|
|
+ return active;
|
|
+ }
|
|
+
|
|
+ public void inventoryChanged() {
|
|
+ }
|
|
+
|
|
+ public void forPilotOnlyActivate() {
|
|
+ if (active != this) {
|
|
+ this.myCard = new Panel();
|
|
+ String myCardName = "" + nameCounter++;
|
|
+ Container consoleTile = frame.getConsoleTile();
|
|
+ consoleTile.add(myCardName, this.myCard);
|
|
+ Console prev = active;
|
|
+ this.activate(this.myCard);
|
|
+ ((CardLayout)consoleTile.getLayout()).show(consoleTile, myCardName);
|
|
+ getFrame().validate();
|
|
+ if (prev != null) {
|
|
+ consoleTile.remove(prev.myCard);
|
|
+ prev.myCard.removeAll();
|
|
+ }
|
|
+
|
|
+ }
|
|
+ }
|
|
+
|
|
+ protected void setEnableMenu(boolean enable) {
|
|
+ this.enableMenu = enable;
|
|
+ if (this == active) {
|
|
+ enable |= Gamma.shaper != null;
|
|
+ boolean enabled = frame.getMenuBar() == menuBar && menuBar != null;
|
|
+ if (enable != enabled) {
|
|
+ frame.setMenuBar(enable ? menuBar : null);
|
|
+ frame.pack();
|
|
+ }
|
|
+ }
|
|
+
|
|
+ }
|
|
+
|
|
+ private static synchronized void setActive(Console active) {
|
|
+ Console.active = active;
|
|
+ int sz = storedLines.size();
|
|
+ if (sz > 0) {
|
|
+ for(int i = 0; i < sz; ++i) {
|
|
+ active.printLine((String)storedLines.elementAt(i));
|
|
+ }
|
|
+
|
|
+ storedLines.removeAllElements();
|
|
+ }
|
|
+
|
|
+ }
|
|
+
|
|
+ protected void activate(Container c) {
|
|
+ assert this.pilot != null;
|
|
+
|
|
+ Console prev = active;
|
|
+ if (active != null) {
|
|
+ active.deactivate();
|
|
+ }
|
|
+
|
|
+ setActive(this);
|
|
+ Main.register(this);
|
|
+ this.menus.clear();
|
|
+ menuBar = new MenuBar();
|
|
+ this.getMenu("File");
|
|
+ if (Gamma.shaper != null) {
|
|
+ Gamma.shaper.activate(this, c, prev);
|
|
+ }
|
|
+
|
|
+ int len = this.parts.size();
|
|
+
|
|
+ for(int i = 0; i < len; ++i) {
|
|
+ ((FramePart)this.parts.elementAt(i)).activate(this, c, prev);
|
|
+ }
|
|
+
|
|
+ this.exitItem = this.addMenuItem(message("Exit"), "File");
|
|
+ if (activeTeleportURL != null) {
|
|
+ teleportNotification("", activeTeleportURL);
|
|
+ }
|
|
+
|
|
+ this.cursor.activate();
|
|
+ }
|
|
+
|
|
+ protected void menuDone() {
|
|
+ this.setEnableMenu(this.enableMenu);
|
|
+ }
|
|
+
|
|
+ protected void deactivate() {
|
|
+ if (active == this) {
|
|
+ setActive((Console)null);
|
|
+ Main.unregister(this);
|
|
+ int len = this.parts.size();
|
|
+
|
|
+ for(int i = 0; i < len; ++i) {
|
|
+ ((FramePart)this.parts.elementAt(i)).deactivate();
|
|
+ }
|
|
+
|
|
+ if (Gamma.shaper != null) {
|
|
+ Gamma.shaper.deactivate();
|
|
+ }
|
|
+
|
|
+ this.cursor.deactivate();
|
|
+ frame.deactivate();
|
|
+ }
|
|
+ }
|
|
+
|
|
+ public String getActiveTeleportURL() {
|
|
+ return lastTeleportURL == null ? "" : lastTeleportURL;
|
|
+ }
|
|
+
|
|
+ public static void teleportNotification(String err, String url) {
|
|
+ if (err != null && err.length() == 0) {
|
|
+ activeTeleportURL = url;
|
|
+ lastTeleportURL = url.toString();
|
|
+ } else {
|
|
+ activeTeleportURL = null;
|
|
+ }
|
|
+
|
|
+ if (active != null) {
|
|
+ if (active instanceof TeleportStatus) {
|
|
+ ((TeleportStatus)active).teleportStatus(err, url);
|
|
+ }
|
|
+
|
|
+ int len = active.parts.size();
|
|
+
|
|
+ for(int i = 0; i < len; ++i) {
|
|
+ Object fp = active.parts.elementAt(i);
|
|
+ if (fp instanceof TeleportStatus) {
|
|
+ ((TeleportStatus)fp).teleportStatus(err, url);
|
|
+ }
|
|
+ }
|
|
+
|
|
+ }
|
|
+ }
|
|
+
|
|
+ public static void setFreezeFrameEvents(boolean x) {
|
|
+ if (x) {
|
|
+ ++freezeFrameEvents;
|
|
+ } else {
|
|
+ --freezeFrameEvents;
|
|
+
|
|
+ assert freezeFrameEvents >= 0;
|
|
+ }
|
|
+
|
|
+ }
|
|
+
|
|
+ public void mainCallback() {
|
|
+ if (frameEvent == null) {
|
|
+ frameEvent = new FrameEvent((WObject)null, (WObject)null);
|
|
+ }
|
|
+
|
|
+ if (freezeFrameEvents <= 0) {
|
|
+ frameEvent.newFrameTime();
|
|
+ frameEvent.source = this;
|
|
+ this.generateFrameEvents(frameEvent);
|
|
+ frameEvent.target = null;
|
|
+ frameEvent.receiver = null;
|
|
+ frameEvent.source = null;
|
|
+ }
|
|
+ }
|
|
+
|
|
+ public void generateFrameEvents(FrameEvent f) {
|
|
+ World.generateFrameEvents(f);
|
|
+ int now = Std.getFastTime();
|
|
+ if (Window.getAndResetUserActionCount() != 0) {
|
|
+ this.setSleepMode((String)null);
|
|
this.lastUserAction = now;
|
|
- } else {
|
|
- this.goToSleep();
|
|
- }
|
|
- }
|
|
-
|
|
- int len = this.parts.size();
|
|
- int i;
|
|
- if (Main.profile != 0) {
|
|
- for(i = 0; i < len; ++i) {
|
|
- FramePart fp = (FramePart)this.parts.elementAt(i);
|
|
- int start = Std.getRealTime();
|
|
- long startBytes = Runtime.getRuntime().freeMemory();
|
|
- fp.handle(f);
|
|
- int dur = Std.getRealTime() - start;
|
|
- long used = startBytes - Runtime.getRuntime().freeMemory();
|
|
- if (dur > Main.profile) {
|
|
- System.out.println("Took " + dur + "ms and " + used + " bytes to call framePart " + fp);
|
|
- }
|
|
- }
|
|
- } else {
|
|
- for(i = 0; i < len; ++i) {
|
|
- ((FramePart)this.parts.elementAt(i)).handle(f);
|
|
- }
|
|
- }
|
|
-
|
|
- ProgressiveAdder.get().handle(f);
|
|
- if (this instanceof FrameHandler) {
|
|
- ((FrameHandler)this).handle(f);
|
|
- }
|
|
-
|
|
- if (this.pilot != null) {
|
|
- this.pilot.generateFrameEvents(f);
|
|
- }
|
|
-
|
|
- }
|
|
-
|
|
- public void addPart(FramePart p) {
|
|
- this.parts.addElement(p);
|
|
- }
|
|
-
|
|
- public Enumeration getParts() {
|
|
- return this.parts.elements();
|
|
- }
|
|
-
|
|
- public boolean action(Event event, Object what) {
|
|
- if (event.target == this.exitItem) {
|
|
- return maybeQuit();
|
|
- } else if (Gamma.shaper != null && Gamma.shaper.action(event, what)) {
|
|
- return true;
|
|
- } else {
|
|
- int len = this.parts.size();
|
|
-
|
|
- for(int i = 0; i < len; ++i) {
|
|
- if (((FramePart)this.parts.elementAt(i)).action(event, what)) {
|
|
- return true;
|
|
- }
|
|
- }
|
|
-
|
|
- return false;
|
|
- }
|
|
- }
|
|
-
|
|
- public boolean handleEvent(Event e) {
|
|
- return e.id == 201 ? maybeQuit() : false;
|
|
- }
|
|
-
|
|
- public boolean okToQuit() {
|
|
- return true;
|
|
- }
|
|
-
|
|
- public static void quit() {
|
|
- if (Gamma.getShaper() != null) {
|
|
- Gamma.getShaper().maybeQuit();
|
|
- } else {
|
|
- GammaFrameState.saveBorder();
|
|
- Main.end();
|
|
- }
|
|
-
|
|
- }
|
|
-
|
|
- public static boolean maybeQuit() {
|
|
- Console c = getActive();
|
|
- if (c == null || c.okToQuit()) {
|
|
- quit();
|
|
- }
|
|
-
|
|
- return true;
|
|
- }
|
|
-
|
|
- public static MenuBar getMenuBar() {
|
|
- return menuBar;
|
|
- }
|
|
-
|
|
- public Menu getMenu(String name) {
|
|
- Menu menu = (Menu)this.menus.get(name);
|
|
- if (menu == null) {
|
|
- if (!name.equals("Help") && !name.equals("Options") && !name.equals("VIP")) {
|
|
- menu = new Menu(name);
|
|
- menuBar.add((Menu)menu);
|
|
- } else {
|
|
- menu = new PopupMenu();
|
|
- }
|
|
-
|
|
- this.menus.put(name, menu);
|
|
- }
|
|
-
|
|
- return (Menu)menu;
|
|
- }
|
|
-
|
|
- public void addMenuItem(MenuItem item, String menuName) {
|
|
- this.getMenu(menuName).add(item);
|
|
- item.setFont(font);
|
|
- }
|
|
-
|
|
- public MenuItem addMenuItem(String itemName, String menuName) {
|
|
- MenuItem item = new MenuItem(itemName);
|
|
- this.getMenu(menuName).add(item);
|
|
- item.setFont(font);
|
|
- return item;
|
|
- }
|
|
-
|
|
- public MenuItem addMenuItem(String itemName, String menuName, int keyCode, boolean shiftKey) {
|
|
- MenuItem item = new MenuItem(itemName);
|
|
- MenuShortcut shortcut = new MenuShortcut(keyCode, shiftKey);
|
|
- item.setShortcut(shortcut);
|
|
- this.getMenu(menuName).add(item);
|
|
- item.setFont(font);
|
|
- return item;
|
|
- }
|
|
-
|
|
- public CheckboxMenuItem addMenuCheckbox(String itemName, String menuName) {
|
|
- CheckboxMenuItem item = new CheckboxMenuItem(itemName);
|
|
- this.getMenu(menuName).add(item);
|
|
- item.setFont(font);
|
|
- return item;
|
|
- }
|
|
-
|
|
- public void dialogDisable(boolean disable) {
|
|
- int len = this.parts.size();
|
|
-
|
|
- for(int i = 0; i < len; ++i) {
|
|
- FramePart part = (FramePart)this.parts.elementAt(i);
|
|
- if (part instanceof DialogDisabled) {
|
|
- ((DialogDisabled)part).dialogDisable(disable);
|
|
- }
|
|
- }
|
|
-
|
|
- }
|
|
-
|
|
- public static final native String encrypt(String var0);
|
|
-
|
|
- public static final native String decrypt(String var0);
|
|
-
|
|
- public static String encode(String password) {
|
|
- String coded = "";
|
|
- if (password != null) {
|
|
- char[] cryptChars = encrypt(password).toCharArray();
|
|
-
|
|
- for(int i = 0; i < cryptChars.length; ++i) {
|
|
- String hex = Integer.toHexString(cryptChars[i]);
|
|
- if (hex.length() == 1) {
|
|
- hex = "0" + hex;
|
|
- }
|
|
-
|
|
- coded = coded + hex;
|
|
- }
|
|
- }
|
|
-
|
|
- return coded;
|
|
- }
|
|
-
|
|
- public static String decode(String password) {
|
|
- try {
|
|
- int length = password.length();
|
|
- if (length != 0 && (length & 1) == 0) {
|
|
- char[] cryptChars = new char[length / 2];
|
|
- int j = 0;
|
|
-
|
|
- for(int i = 0; i < cryptChars.length; j += 2) {
|
|
- cryptChars[i] = (char)Integer.parseInt(password.substring(j, j + 2), 16);
|
|
- ++i;
|
|
- }
|
|
-
|
|
- String ret = decrypt(new String(cryptChars));
|
|
- if (ret != null && ret.length() != 0) {
|
|
- return ret;
|
|
- }
|
|
- }
|
|
- } catch (NumberFormatException var5) {
|
|
- }
|
|
-
|
|
- return null;
|
|
- }
|
|
-
|
|
- public static final native int getVolumeInfo();
|
|
-
|
|
- public boolean getVIPAvatars() {
|
|
- return vip > 0 || isRedLightWorld;
|
|
- }
|
|
-
|
|
- public boolean getVIP() {
|
|
- return vip > 0;
|
|
- }
|
|
-
|
|
- public void setVIP(boolean vip) {
|
|
- Console.vip = vip ? 1 : 0;
|
|
- this.checkCourtesyVIP();
|
|
- IniFile.gamma().setIniInt("VIP", Console.vip);
|
|
- if (autoFullVIP && vip) {
|
|
- Console.vip = 2;
|
|
- }
|
|
-
|
|
- }
|
|
-
|
|
- public boolean getFullVIP() {
|
|
- return vip == 2;
|
|
- }
|
|
-
|
|
- public void setFullVIP(boolean fullVIP) {
|
|
- if (fullVIP) {
|
|
- vip = 2;
|
|
- }
|
|
-
|
|
- IniFile.gamma().setIniInt("VIP", vip);
|
|
- }
|
|
-
|
|
- public boolean getSpecialGuest() {
|
|
- return spguest > 0;
|
|
- }
|
|
-
|
|
- public void setSpecialGuest(boolean spguest) {
|
|
- if (Console.spguest > 1 != spguest) {
|
|
- Console.spguest = spguest ? 1 : 0;
|
|
- IniFile.gamma().setIniInt("SPGUEST", Console.spguest);
|
|
- Console.spguest += Console.spguest;
|
|
- }
|
|
-
|
|
- }
|
|
-
|
|
- public void checkCourtesyVIP() {
|
|
- int oldVIP = vip;
|
|
- if (vip < 1) {
|
|
- World w = this.getPilot().getWorld();
|
|
- vip = w != null && w.isHomeWorld() && w.getCourtesyVIP() ? 1 : 0;
|
|
- }
|
|
-
|
|
- if (vip != oldVIP) {
|
|
- if (vip == 1) {
|
|
- println(message("You-VIP"));
|
|
- } else {
|
|
- println(message("You-no-VIP"));
|
|
- }
|
|
- }
|
|
-
|
|
- URL av = this.getDefaultAvatarURL();
|
|
- if (!av.equals(this.getAvatarName())) {
|
|
- this.setAvatar(av);
|
|
- }
|
|
-
|
|
- }
|
|
-
|
|
- public boolean broadcastEnabled() {
|
|
- return this.canBroadcast;
|
|
- }
|
|
-
|
|
- public void enableBroadcast(boolean enabled) {
|
|
- this.canBroadcast = enabled;
|
|
- }
|
|
-
|
|
- public abstract URL getAvatarName();
|
|
-
|
|
- public abstract void setChatname(String var1);
|
|
-
|
|
- public void serverStatus(WorldServer serv, VarErrorException ve) {
|
|
- System.out.println("status-- " + serv + ": " + ve.getMsg());
|
|
- }
|
|
-
|
|
- public void property(OldPropertyList propList) {
|
|
- assert false;
|
|
-
|
|
- }
|
|
-
|
|
- public void propertyUpdate(PropertyList propList) {
|
|
- assert false;
|
|
-
|
|
- }
|
|
-
|
|
- public WorldServer getServer() {
|
|
- URL url = this.getGalaxyURL();
|
|
- if (url != null && this.galaxy != null) {
|
|
- try {
|
|
- return this.getGalaxy().getServer(url);
|
|
- } catch (InvalidServerURLException var3) {
|
|
- println(">>" + var3.getMessage());
|
|
- return null;
|
|
- }
|
|
- } else {
|
|
- return null;
|
|
- }
|
|
- }
|
|
-
|
|
- public WorldServer getServerNew() {
|
|
- URL url = this.getGalaxyURL();
|
|
- if (url != null && this.galaxy != null) {
|
|
- try {
|
|
- return this.getGalaxy().getServer(url);
|
|
- } catch (InvalidServerURLException var3) {
|
|
- println(">>" + var3.getMessage());
|
|
- return null;
|
|
- }
|
|
- } else {
|
|
- return null;
|
|
- }
|
|
- }
|
|
-
|
|
- public String getLongID() {
|
|
- return this.galaxy.getChatname();
|
|
- }
|
|
-
|
|
- public void register() {
|
|
- }
|
|
-
|
|
- public void galaxyDisconnected() {
|
|
- this.setChatname("");
|
|
- this.galaxy.waitForConnection(this);
|
|
- }
|
|
-
|
|
- public void reacquireServer(WorldServer oldServ) {
|
|
- }
|
|
-
|
|
- public void changeChannel(Galaxy g, String oldChannel, String newChannel) {
|
|
- this.pilot.changeChannel(g, oldChannel, newChannel);
|
|
- }
|
|
-
|
|
- protected void handleVAR_BITMAP(String s) {
|
|
- if (s.charAt(0) == 0) {
|
|
- s = s.substring(2);
|
|
- }
|
|
-
|
|
- try {
|
|
- this.loadPilot(new URL(URL.getAvatar(), s));
|
|
- } catch (MalformedURLException var3) {
|
|
- this.loadPilot(URL.make("error:\"" + s + '"'));
|
|
- }
|
|
-
|
|
- }
|
|
-
|
|
- protected void loadPilot(URL url) {
|
|
- if (!url.equals(this.lastPilotRequested)) {
|
|
- this.lastPilotRequested = url;
|
|
- this.pendingPilot = url.toString();
|
|
- Pilot.load(url, this);
|
|
- this.setFromMenu = false;
|
|
- }
|
|
- }
|
|
-
|
|
- public void wobLoaded(WobLoader loader, SuperRoot w) {
|
|
- String err = null;
|
|
- if (w == null) {
|
|
- err = message("no-load-pilot");
|
|
- println(err + " " + loader.getWobName());
|
|
- } else if (!(w instanceof Pilot)) {
|
|
- err = message("not-pilot");
|
|
- println(loader.getWobName().toString() + " " + err);
|
|
- } else {
|
|
- try {
|
|
- this.setPilot((Pilot)w);
|
|
- } catch (IllegalPilotException var7) {
|
|
- err = var7.getMessage();
|
|
- }
|
|
- }
|
|
-
|
|
- if (this.pilot == null && err != null && !this.disableSingleUserAccess) {
|
|
- this.useDefaultPilot();
|
|
- err = null;
|
|
- }
|
|
-
|
|
- int end = this.callbacks.size();
|
|
-
|
|
- for(int i = 0; i < end; ++i) {
|
|
- LoadedURLSelf callback = (LoadedURLSelf)this.callbacks.elementAt(i);
|
|
- if (err == null) {
|
|
- callback.loadedURLSelf(this, this.getSourceURL(), (String)null);
|
|
- } else {
|
|
- this.decRef();
|
|
- callback.loadedURLSelf((URLSelf)null, this.getSourceURL(), err);
|
|
- }
|
|
- }
|
|
-
|
|
- this.callbacks.removeAllElements();
|
|
- }
|
|
-
|
|
- public static URL getDefaultURL() {
|
|
- String defaultAvatar = IniFile.override().getIniString("DefaultAvatar", "avatar:pengo.mov");
|
|
- return URL.make(defaultAvatar);
|
|
- }
|
|
-
|
|
- protected void useDefaultPilot() {
|
|
- try {
|
|
- this.setPilot(new HoloPilot(getDefaultURL()));
|
|
- } catch (IllegalPilotException var2) {
|
|
- assert false;
|
|
- }
|
|
-
|
|
- }
|
|
-
|
|
- public abstract void setOnlineState(boolean var1, boolean var2);
|
|
-
|
|
- public void connectionCallback(Object caller, boolean connected) {
|
|
- if (caller instanceof Galaxy) {
|
|
- if (caller != this.galaxy) {
|
|
- return;
|
|
- }
|
|
-
|
|
- if (!connected) {
|
|
- return;
|
|
- }
|
|
-
|
|
- this.setAvatar(this.lastPilotRequested);
|
|
- this.displayAds();
|
|
- }
|
|
-
|
|
- }
|
|
-
|
|
- public void displayAds() {
|
|
- Pilot p = Pilot.getActive();
|
|
- if (p != null) {
|
|
- World w = p.getWorld();
|
|
- if (w != null) {
|
|
- w.setupAdBanner();
|
|
- }
|
|
- }
|
|
-
|
|
- }
|
|
-
|
|
- public void setDefaultAction(String newda) {
|
|
- this.defaultAction = newda;
|
|
- }
|
|
-
|
|
- public String getDefaultAction() {
|
|
- return this.defaultAction;
|
|
- }
|
|
-
|
|
- public URL getDefaultAvatarURL() {
|
|
- String defAv = getDefaultURL().toString();
|
|
- String av = IniFile.gamma().getIniString("AVATAR", defAv);
|
|
- String vav = IniFile.gamma().getIniString("VIPAVATAR", "");
|
|
- boolean isVIPAv = av.toLowerCase().endsWith(".rwg");
|
|
- if (vav.equals("")) {
|
|
- vav = av;
|
|
- if (isVIPAv) {
|
|
- IniFile.gamma().setIniString("VIPAVATAR", av);
|
|
- }
|
|
- }
|
|
-
|
|
- if (this.tempCarAvatar != "") {
|
|
- av = this.tempCarAvatar;
|
|
- } else if (this.getVIPAvatars()) {
|
|
- av = vav;
|
|
- } else if (isVIPAv) {
|
|
- av = defAv;
|
|
- }
|
|
-
|
|
- return URL.make(av);
|
|
- }
|
|
-
|
|
- public Console() {
|
|
- this.add(this.cursor);
|
|
- this.galaxy = Galaxy.getAnonGalaxy();
|
|
- this.regWithGalaxy();
|
|
- this.setServerURL((URL)null);
|
|
- }
|
|
-
|
|
- public Console(URL serverURL) {
|
|
- this.add(this.cursor);
|
|
- this.galaxy = Galaxy.getAnonGalaxy();
|
|
- this.regWithGalaxy();
|
|
- this.setServerURL(serverURL);
|
|
- this.templateInit();
|
|
- }
|
|
-
|
|
- public void loadInit() {
|
|
- this.templateInit();
|
|
- this.add(this.cursor);
|
|
- }
|
|
-
|
|
- public void addCursor(Cursor c) {
|
|
- this.add(c);
|
|
- }
|
|
-
|
|
- private void templateInit() {
|
|
- this.pilotSoulTemplate = new HoloPilot();
|
|
- this.droneSoulTemplate = new HoloDrone();
|
|
- this.add(this.pilotSoulTemplate);
|
|
- this.add(this.droneSoulTemplate);
|
|
- }
|
|
-
|
|
- public static void load(URL url, LoadedURLSelf callback) {
|
|
- if (url != null && url.endsWith(".console")) {
|
|
- new ConsoleLoader(url, callback);
|
|
- } else {
|
|
- Object c;
|
|
- if (url == null) {
|
|
- c = defaultUnshared;
|
|
- } else {
|
|
- c = (Console)defConsoles.get(url);
|
|
- }
|
|
-
|
|
- if (c != null && ((Console)c).galaxy == null) {
|
|
- if (((Console)c).getGalaxyURL() == null) {
|
|
- ((Console)c).galaxy = Galaxy.getAnonGalaxy();
|
|
+ } else if (now > this.lastUserAction + 300000) {
|
|
+ if (this.lastUserAction == 0) {
|
|
+ this.lastUserAction = now;
|
|
+ } else {
|
|
+ this.goToSleep();
|
|
+ }
|
|
+ }
|
|
+
|
|
+ int len = this.parts.size();
|
|
+ int i;
|
|
+ if (Main.profile != 0) {
|
|
+ for(i = 0; i < len; ++i) {
|
|
+ FramePart fp = (FramePart)this.parts.elementAt(i);
|
|
+ int start = Std.getRealTime();
|
|
+ long startBytes = Runtime.getRuntime().freeMemory();
|
|
+ fp.handle(f);
|
|
+ int dur = Std.getRealTime() - start;
|
|
+ long used = startBytes - Runtime.getRuntime().freeMemory();
|
|
+ if (dur > Main.profile) {
|
|
+ System.out.println("Took " + dur + "ms and " + used + " bytes to call framePart " + fp);
|
|
+ }
|
|
+ }
|
|
+ } else {
|
|
+ for(i = 0; i < len; ++i) {
|
|
+ ((FramePart)this.parts.elementAt(i)).handle(f);
|
|
+ }
|
|
+ }
|
|
+
|
|
+ ProgressiveAdder.get().handle(f);
|
|
+ if (this instanceof FrameHandler) {
|
|
+ ((FrameHandler)this).handle(f);
|
|
+ }
|
|
+
|
|
+ if (this.pilot != null) {
|
|
+ this.pilot.generateFrameEvents(f);
|
|
+ }
|
|
+
|
|
+ }
|
|
+
|
|
+ public void addPart(FramePart p) {
|
|
+ this.parts.addElement(p);
|
|
+ }
|
|
+
|
|
+ public Enumeration<FramePart> getParts() {
|
|
+ return this.parts.elements();
|
|
+ }
|
|
+
|
|
+ public boolean action(Event event, Object what) {
|
|
+ if (event.target == this.exitItem) {
|
|
+ return maybeQuit();
|
|
+ } else if (Gamma.shaper != null && Gamma.shaper.action(event, what)) {
|
|
+ return true;
|
|
+ } else {
|
|
+ int len = this.parts.size();
|
|
+
|
|
+ for(int i = 0; i < len; ++i) {
|
|
+ if (((FramePart)this.parts.elementAt(i)).action(event, what)) {
|
|
+ return true;
|
|
+ }
|
|
+ }
|
|
+
|
|
+ return false;
|
|
+ }
|
|
+ }
|
|
+
|
|
+ public boolean handleEvent(Event e) {
|
|
+ return e.id == 201 ? maybeQuit() : false;
|
|
+ }
|
|
+
|
|
+ public boolean okToQuit() {
|
|
+ return true;
|
|
+ }
|
|
+
|
|
+ public static void quit() {
|
|
+ if (Gamma.getShaper() != null) {
|
|
+ Gamma.getShaper().maybeQuit();
|
|
+ } else {
|
|
+ GammaFrameState.saveBorder();
|
|
+ Main.end();
|
|
+ }
|
|
+
|
|
+ }
|
|
+
|
|
+ public static boolean maybeQuit() {
|
|
+ Console c = getActive();
|
|
+ if (c == null || c.okToQuit()) {
|
|
+ quit();
|
|
+ }
|
|
+
|
|
+ return true;
|
|
+ }
|
|
+
|
|
+ public static MenuBar getMenuBar() {
|
|
+ return menuBar;
|
|
+ }
|
|
+
|
|
+ public Menu getMenu(String name) {
|
|
+ Menu menu = (Menu)this.menus.get(name);
|
|
+ if (menu == null) {
|
|
+ if (!name.equals("Help") && !name.equals("Options") && !name.equals("VIP")) {
|
|
+ menu = new Menu(name);
|
|
+ menuBar.add((Menu)menu);
|
|
+ } else {
|
|
+ menu = new PopupMenu();
|
|
+ }
|
|
+
|
|
+ this.menus.put(name, menu);
|
|
+ }
|
|
+
|
|
+ return (Menu)menu;
|
|
+ }
|
|
+
|
|
+ public void addMenuItem(MenuItem item, String menuName) {
|
|
+ this.getMenu(menuName).add(item);
|
|
+ item.setFont(font);
|
|
+ }
|
|
+
|
|
+ public MenuItem addMenuItem(String itemName, String menuName) {
|
|
+ MenuItem item = new MenuItem(itemName);
|
|
+ this.getMenu(menuName).add(item);
|
|
+ item.setFont(font);
|
|
+ return item;
|
|
+ }
|
|
+
|
|
+ public MenuItem addMenuItem(String itemName, String menuName, int keyCode, boolean shiftKey) {
|
|
+ MenuItem item = new MenuItem(itemName);
|
|
+ MenuShortcut shortcut = new MenuShortcut(keyCode, shiftKey);
|
|
+ item.setShortcut(shortcut);
|
|
+ this.getMenu(menuName).add(item);
|
|
+ item.setFont(font);
|
|
+ return item;
|
|
+ }
|
|
+
|
|
+ public CheckboxMenuItem addMenuCheckbox(String itemName, String menuName) {
|
|
+ CheckboxMenuItem item = new CheckboxMenuItem(itemName);
|
|
+ this.getMenu(menuName).add(item);
|
|
+ item.setFont(font);
|
|
+ return item;
|
|
+ }
|
|
+
|
|
+ public void dialogDisable(boolean disable) {
|
|
+ int len = this.parts.size();
|
|
+
|
|
+ for(int i = 0; i < len; ++i) {
|
|
+ FramePart part = (FramePart)this.parts.elementAt(i);
|
|
+ if (part instanceof DialogDisabled) {
|
|
+ ((DialogDisabled)part).dialogDisable(disable);
|
|
+ }
|
|
+ }
|
|
+
|
|
+ }
|
|
+
|
|
+ public static final native String encrypt(String var0);
|
|
+
|
|
+ public static final native String decrypt(String var0);
|
|
+
|
|
+ public static String encode(String password) {
|
|
+ String coded = "";
|
|
+ if (password != null) {
|
|
+ char[] cryptChars = encrypt(password).toCharArray();
|
|
+
|
|
+ for(int i = 0; i < cryptChars.length; ++i) {
|
|
+ String hex = Integer.toHexString(cryptChars[i]);
|
|
+ if (hex.length() == 1) {
|
|
+ hex = "0" + hex;
|
|
+ }
|
|
+
|
|
+ coded = coded + hex;
|
|
+ }
|
|
+ }
|
|
+
|
|
+ return coded;
|
|
+ }
|
|
+
|
|
+ public static String decode(String password) {
|
|
+ try {
|
|
+ int length = password.length();
|
|
+ if (length != 0 && (length & 1) == 0) {
|
|
+ char[] cryptChars = new char[length / 2];
|
|
+ int j = 0;
|
|
+
|
|
+ for(int i = 0; i < cryptChars.length; j += 2) {
|
|
+ cryptChars[i] = (char)Integer.parseInt(password.substring(j, j + 2), 16);
|
|
+ ++i;
|
|
+ }
|
|
+
|
|
+ String ret = decrypt(new String(cryptChars));
|
|
+ if (ret != null && ret.length() != 0) {
|
|
+ return ret;
|
|
+ }
|
|
+ }
|
|
+ } catch (NumberFormatException var5) {
|
|
+ }
|
|
+
|
|
+ return null;
|
|
+ }
|
|
+
|
|
+ public static final native int getVolumeInfo();
|
|
+
|
|
+ public boolean getVIPAvatars() {
|
|
+ return vip > 0 || isRedLightWorld;
|
|
+ }
|
|
+
|
|
+ public boolean getVIP() {
|
|
+ return vip > 0;
|
|
+ }
|
|
+
|
|
+ public void setVIP(boolean vip) {
|
|
+ Console.vip = vip ? 1 : 0;
|
|
+ this.checkCourtesyVIP();
|
|
+ IniFile.gamma().setIniInt("VIP", Console.vip);
|
|
+ if (autoFullVIP && vip) {
|
|
+ Console.vip = 2;
|
|
+ }
|
|
+
|
|
+ }
|
|
+
|
|
+ public boolean getFullVIP() {
|
|
+ return vip == 2;
|
|
+ }
|
|
+
|
|
+ public void setFullVIP(boolean fullVIP) {
|
|
+ if (fullVIP) {
|
|
+ vip = 2;
|
|
+ }
|
|
+
|
|
+ IniFile.gamma().setIniInt("VIP", vip);
|
|
+ }
|
|
+
|
|
+ public boolean getSpecialGuest() {
|
|
+ return spguest > 0;
|
|
+ }
|
|
+
|
|
+ public void setSpecialGuest(boolean spguest) {
|
|
+ if (Console.spguest > 1 != spguest) {
|
|
+ Console.spguest = spguest ? 1 : 0;
|
|
+ IniFile.gamma().setIniInt("SPGUEST", Console.spguest);
|
|
+ Console.spguest += Console.spguest;
|
|
+ }
|
|
+
|
|
+ }
|
|
+
|
|
+ public void checkCourtesyVIP() {
|
|
+ int oldVIP = vip;
|
|
+ if (vip < 1) {
|
|
+ World w = this.getPilot().getWorld();
|
|
+ vip = w != null && w.isHomeWorld() && w.getCourtesyVIP() ? 1 : 0;
|
|
+ }
|
|
+
|
|
+ if (vip != oldVIP) {
|
|
+ if (vip == 1) {
|
|
+ println(message("You-VIP"));
|
|
} else {
|
|
- try {
|
|
- ((Console)c).galaxy = Galaxy.getGalaxy(((Console)c).getGalaxyURL());
|
|
- } catch (InvalidServerURLException var5) {
|
|
- System.out.println("Illegal ServerURL = " + ((Console)c).getGalaxyURL());
|
|
- ((Console)c).galaxy = Galaxy.getAnonGalaxy();
|
|
- ((Console)c).setServerURL((URL)null);
|
|
- }
|
|
- }
|
|
-
|
|
- ((Console)c).regWithGalaxy();
|
|
- ((Console)c).regPilot();
|
|
- }
|
|
+ println(message("You-no-VIP"));
|
|
+ }
|
|
+ }
|
|
+
|
|
+ URL av = this.getDefaultAvatarURL();
|
|
+ if (!av.equals(this.getAvatarName())) {
|
|
+ this.setAvatar(av);
|
|
+ }
|
|
+
|
|
+ }
|
|
+
|
|
+ public boolean broadcastEnabled() {
|
|
+ return this.canBroadcast;
|
|
+ }
|
|
+
|
|
+ public void enableBroadcast(boolean enabled) {
|
|
+ this.canBroadcast = enabled;
|
|
+ }
|
|
+
|
|
+ public abstract URL getAvatarName();
|
|
|
|
- assert c == null || ((Console)c).galaxy != null;
|
|
+ public abstract void setChatname(String var1);
|
|
|
|
- if (c == null) {
|
|
+ public void serverStatus(WorldServer serv, VarErrorException ve) {
|
|
+ System.out.println("status-- " + serv + ": " + ve.getMsg());
|
|
+ }
|
|
+
|
|
+ public void property(OldPropertyList propList) {
|
|
+ assert false;
|
|
+
|
|
+ }
|
|
+
|
|
+ public void propertyUpdate(PropertyList propList) {
|
|
+ assert false;
|
|
+
|
|
+ }
|
|
+
|
|
+ public WorldServer getServer() {
|
|
+ URL url = this.getGalaxyURL();
|
|
+ if (url != null && this.galaxy != null) {
|
|
try {
|
|
- Class cl = Class.forName(defaultConsole);
|
|
- c = (Console)cl.newInstance();
|
|
- } catch (Exception var4) {
|
|
- System.out.println("Can't use class " + defaultConsole + ", using DefaultConsole instead.");
|
|
- var4.printStackTrace(System.out);
|
|
- c = new DefaultConsole();
|
|
+ return this.getGalaxy().getServer(url);
|
|
+ } catch (InvalidServerURLException var3) {
|
|
+ println(">>" + var3.getMessage());
|
|
+ return null;
|
|
}
|
|
+ } else {
|
|
+ return null;
|
|
+ }
|
|
+ }
|
|
|
|
- assert c != null;
|
|
+ public WorldServer getServerNew() {
|
|
+ URL url = this.getGalaxyURL();
|
|
+ if (url != null && this.galaxy != null) {
|
|
+ try {
|
|
+ return this.getGalaxy().getServer(url);
|
|
+ } catch (InvalidServerURLException var3) {
|
|
+ println(">>" + var3.getMessage());
|
|
+ return null;
|
|
+ }
|
|
+ } else {
|
|
+ return null;
|
|
+ }
|
|
+ }
|
|
|
|
- if (((Console)c).galaxy == null) {
|
|
- ((Console)c).galaxy = Galaxy.getAnonGalaxy();
|
|
- ((Console)c).regWithGalaxy();
|
|
- ((Console)c).regPilot();
|
|
+ public String getLongID() {
|
|
+ return this.galaxy.getChatname();
|
|
+ }
|
|
+
|
|
+ public void register() {
|
|
+ }
|
|
+
|
|
+ public void galaxyDisconnected() {
|
|
+ this.setChatname("");
|
|
+ this.galaxy.waitForConnection(this);
|
|
+ }
|
|
+
|
|
+ public void reacquireServer(WorldServer oldServ) {
|
|
+ }
|
|
+
|
|
+ public void changeChannel(Galaxy g, String oldChannel, String newChannel) {
|
|
+ this.pilot.changeChannel(g, oldChannel, newChannel);
|
|
+ }
|
|
+
|
|
+ protected void handleVAR_BITMAP(String s) {
|
|
+ if (s.charAt(0) == 0) {
|
|
+ s = s.substring(2);
|
|
+ }
|
|
+
|
|
+ try {
|
|
+ this.loadPilot(new URL(URL.getAvatar(), s));
|
|
+ } catch (MalformedURLException var3) {
|
|
+ this.loadPilot(URL.make("error:\"" + s + '"'));
|
|
+ }
|
|
+
|
|
+ }
|
|
+
|
|
+ protected void loadPilot(URL url) {
|
|
+ if (!url.equals(this.lastPilotRequested)) {
|
|
+ this.lastPilotRequested = url;
|
|
+ this.pendingPilot = url.toString();
|
|
+ Pilot.load(url, this);
|
|
+ this.setFromMenu = false;
|
|
+ }
|
|
+ }
|
|
+
|
|
+ public void wobLoaded(WobLoader loader, SuperRoot w) {
|
|
+ String err = null;
|
|
+ if (w == null) {
|
|
+ err = message("no-load-pilot");
|
|
+ println(err + " " + loader.getWobName());
|
|
+ } else if (!(w instanceof Pilot)) {
|
|
+ err = message("not-pilot");
|
|
+ println(loader.getWobName().toString() + " " + err);
|
|
+ } else {
|
|
+ try {
|
|
+ this.setPilot((Pilot)w);
|
|
+ } catch (IllegalPilotException var7) {
|
|
+ err = var7.getMessage();
|
|
+ }
|
|
+ }
|
|
+
|
|
+ if (this.pilot == null && err != null && !this.disableSingleUserAccess) {
|
|
+ this.useDefaultPilot();
|
|
+ err = null;
|
|
+ }
|
|
+
|
|
+ int end = this.callbacks.size();
|
|
+
|
|
+ for(int i = 0; i < end; ++i) {
|
|
+ LoadedURLSelf callback = (LoadedURLSelf)this.callbacks.elementAt(i);
|
|
+ if (err == null) {
|
|
+ callback.loadedURLSelf(this, this.getSourceURL(), (String)null);
|
|
+ } else {
|
|
+ this.decRef();
|
|
+ callback.loadedURLSelf((URLSelf)null, this.getSourceURL(), err);
|
|
}
|
|
+ }
|
|
|
|
- assert ((Console)c).galaxy != null;
|
|
+ this.callbacks.removeAllElements();
|
|
+ }
|
|
|
|
- ((Console)c).loadInit();
|
|
- ((Console)c).setServerURL(url);
|
|
+ public static URL getDefaultURL() {
|
|
+ String defaultAvatar = IniFile.override().getIniString("DefaultAvatar", "avatar:pengo.mov");
|
|
+ return URL.make(defaultAvatar);
|
|
+ }
|
|
+
|
|
+ protected void useDefaultPilot() {
|
|
+ try {
|
|
+ this.setPilot(new HoloPilot(getDefaultURL()));
|
|
+ } catch (IllegalPilotException var2) {
|
|
+ assert false;
|
|
+ }
|
|
+
|
|
+ }
|
|
+
|
|
+ public abstract void setOnlineState(boolean var1, boolean var2);
|
|
+
|
|
+ public void connectionCallback(Object caller, boolean connected) {
|
|
+ if (caller instanceof Galaxy) {
|
|
+ if (caller != this.galaxy) {
|
|
+ return;
|
|
+ }
|
|
+
|
|
+ if (!connected) {
|
|
+ return;
|
|
+ }
|
|
+
|
|
+ this.setAvatar(this.lastPilotRequested);
|
|
+ this.displayAds();
|
|
+ }
|
|
+
|
|
+ }
|
|
+
|
|
+ public void displayAds() {
|
|
+ Pilot p = Pilot.getActive();
|
|
+ if (p != null) {
|
|
+ World w = p.getWorld();
|
|
+ if (w != null) {
|
|
+ w.setupAdBanner();
|
|
+ }
|
|
+ }
|
|
+
|
|
+ }
|
|
+
|
|
+ public void setDefaultAction(String newda) {
|
|
+ this.defaultAction = newda;
|
|
+ }
|
|
+
|
|
+ public String getDefaultAction() {
|
|
+ return this.defaultAction;
|
|
+ }
|
|
+
|
|
+ public URL getDefaultAvatarURL() {
|
|
+ String defAv = getDefaultURL().toString();
|
|
+ String av = IniFile.gamma().getIniString("AVATAR", defAv);
|
|
+ String vav = IniFile.gamma().getIniString("VIPAVATAR", "");
|
|
+ boolean isVIPAv = av.toLowerCase().endsWith(".rwg");
|
|
+ if (vav.equals("")) {
|
|
+ vav = av;
|
|
+ if (isVIPAv) {
|
|
+ IniFile.gamma().setIniString("VIPAVATAR", av);
|
|
+ }
|
|
+ }
|
|
+
|
|
+ if (this.tempCarAvatar != "") {
|
|
+ av = this.tempCarAvatar;
|
|
+ } else if (this.getVIPAvatars()) {
|
|
+ av = vav;
|
|
+ } else if (isVIPAv) {
|
|
+ av = defAv;
|
|
+ }
|
|
+
|
|
+ return URL.make(av);
|
|
+ }
|
|
+
|
|
+ public Console() {
|
|
+ this.add(this.cursor);
|
|
+ this.galaxy = Galaxy.getAnonGalaxy();
|
|
+ this.regWithGalaxy();
|
|
+ this.setServerURL((URL)null);
|
|
+ }
|
|
+
|
|
+ public Console(URL serverURL) {
|
|
+ this.add(this.cursor);
|
|
+ this.galaxy = Galaxy.getAnonGalaxy();
|
|
+ this.regWithGalaxy();
|
|
+ this.setServerURL(serverURL);
|
|
+ this.templateInit();
|
|
+ }
|
|
+
|
|
+ public void loadInit() {
|
|
+ this.templateInit();
|
|
+ this.add(this.cursor);
|
|
+ }
|
|
+
|
|
+ public void addCursor(Cursor c) {
|
|
+ this.add(c);
|
|
+ }
|
|
+
|
|
+ private void templateInit() {
|
|
+ this.pilotSoulTemplate = new HoloPilot();
|
|
+ this.droneSoulTemplate = new HoloDrone();
|
|
+ this.add(this.pilotSoulTemplate);
|
|
+ this.add(this.droneSoulTemplate);
|
|
+ }
|
|
+
|
|
+ public static void load(URL url, LoadedURLSelf callback) {
|
|
+ if (url != null && url.endsWith(".console")) {
|
|
+ new ConsoleLoader(url, callback);
|
|
+ } else {
|
|
+ Object c;
|
|
if (url == null) {
|
|
- ((Console)c).setName("unshared");
|
|
- defaultUnshared = (Console)c;
|
|
+ c = defaultUnshared;
|
|
} else {
|
|
- defConsoles.put(((Console)c).getGalaxyURL(), c);
|
|
+ c = (Console)defConsoles.get(url);
|
|
+ }
|
|
+
|
|
+ if (c != null && ((Console)c).galaxy == null) {
|
|
+ if (((Console)c).getGalaxyURL() == null) {
|
|
+ ((Console)c).galaxy = Galaxy.getAnonGalaxy();
|
|
+ } else {
|
|
+ try {
|
|
+ ((Console)c).galaxy = Galaxy.getGalaxy(((Console)c).getGalaxyURL());
|
|
+ } catch (InvalidServerURLException var5) {
|
|
+ System.out.println("Illegal ServerURL = " + ((Console)c).getGalaxyURL());
|
|
+ ((Console)c).galaxy = Galaxy.getAnonGalaxy();
|
|
+ ((Console)c).setServerURL((URL)null);
|
|
+ }
|
|
+ }
|
|
+
|
|
+ ((Console)c).regWithGalaxy();
|
|
+ ((Console)c).regPilot();
|
|
+ }
|
|
+
|
|
+ assert c == null || ((Console)c).galaxy != null;
|
|
+
|
|
+ if (c == null) {
|
|
+ try {
|
|
+ Class<?> cl = Class.forName(defaultConsole);
|
|
+ c = (Console)cl.newInstance();
|
|
+ } catch (Exception var4) {
|
|
+ System.out.println("Can't use class " + defaultConsole + ", using DefaultConsole instead.");
|
|
+ var4.printStackTrace(System.out);
|
|
+ c = new DefaultConsole();
|
|
+ }
|
|
+
|
|
+ assert c != null;
|
|
+
|
|
+ if (((Console)c).galaxy == null) {
|
|
+ ((Console)c).galaxy = Galaxy.getAnonGalaxy();
|
|
+ ((Console)c).regWithGalaxy();
|
|
+ ((Console)c).regPilot();
|
|
+ }
|
|
+
|
|
+ assert ((Console)c).galaxy != null;
|
|
+
|
|
+ ((Console)c).loadInit();
|
|
+ ((Console)c).setServerURL(url);
|
|
+ if (url == null) {
|
|
+ ((Console)c).setName("unshared");
|
|
+ defaultUnshared = (Console)c;
|
|
+ } else {
|
|
+ defConsoles.put(((Console)c).getGalaxyURL(), (Console)c);
|
|
+ }
|
|
+ }
|
|
+
|
|
+ ((Console)c).incRef();
|
|
+ ((Console)c).initPilot(url, callback);
|
|
+ }
|
|
+
|
|
+ }
|
|
+
|
|
+ protected void initPilot(URL pilotURL, LoadedURLSelf callback) {
|
|
+ this.loadPilot(this.getDefaultAvatarURL());
|
|
+ if (this.pilot == null) {
|
|
+ this.useDefaultPilot();
|
|
+ }
|
|
+
|
|
+ callback.loadedURLSelf(this, pilotURL, (String)null);
|
|
+ }
|
|
+
|
|
+ public void incRef() {
|
|
+ ++this.refcnt;
|
|
+ }
|
|
+
|
|
+ public void decRef() {
|
|
+ if (--this.refcnt == 0) {
|
|
+ if (this.galaxy != null) {
|
|
+ this.unregWithGalaxy();
|
|
+ this.unregPilot();
|
|
+ this.galaxy.decWorldCount();
|
|
+ Galaxy oldGalaxy = this.galaxy;
|
|
+ this.galaxy = null;
|
|
+ }
|
|
+
|
|
+ this.pilot = null;
|
|
+ URL url = this.getSourceURL();
|
|
+ if (url != null) {
|
|
+ if (url.endsWith(".console")) {
|
|
+ URLSelfLoader.unload(this);
|
|
+ } else {
|
|
+ defConsoles.remove(url);
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+
|
|
+ }
|
|
+
|
|
+ public String toString() {
|
|
+ return super.toString() + "[" + this.getSourceURL() + "]";
|
|
+ }
|
|
+
|
|
+ public Pilot getPilotSoulTemplate() {
|
|
+ return this.pilotSoulTemplate;
|
|
+ }
|
|
+
|
|
+ public Drone getDroneSoulTemplate() {
|
|
+ return this.droneSoulTemplate;
|
|
+ }
|
|
+
|
|
+ public Pilot getPilot() {
|
|
+ return this.pilot;
|
|
+ }
|
|
+
|
|
+ public boolean isValidAv() {
|
|
+ if (this.targetAv == null) {
|
|
+ return false;
|
|
+ } else if (!InventoryManager.getInventoryManager().inventoryInitialized()) {
|
|
+ return true;
|
|
+ } else {
|
|
+ String av = this.targetAv.getAbsolute();
|
|
+ int len = av.length();
|
|
+
|
|
+ for(int i = 1; i < len; ++i) {
|
|
+ if (av.charAt(i - 1) == '_') {
|
|
+ char firstChar = av.charAt(i);
|
|
+ if (Character.isLowerCase(firstChar)) {
|
|
+ StringBuffer item = new StringBuffer();
|
|
+ item.append(Character.toUpperCase(firstChar));
|
|
+
|
|
+ while(true) {
|
|
+ ++i;
|
|
+ if (i >= len) {
|
|
+ break;
|
|
+ }
|
|
+
|
|
+ char c = av.charAt(i);
|
|
+ if (!Character.isLowerCase(c)) {
|
|
+ break;
|
|
+ }
|
|
+
|
|
+ item.append(c);
|
|
+ }
|
|
+
|
|
+ if (InventoryManager.getInventoryManager().checkInventoryFor(item.toString()) <= 0) {
|
|
+ return false;
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+
|
|
+ return true;
|
|
+ }
|
|
+ }
|
|
+
|
|
+ public void resetAvatar() {
|
|
+ this.setAvatar(this.targetAv);
|
|
+ }
|
|
+
|
|
+ public void setAvatar(URL url) {
|
|
+ if (url != null) {
|
|
+ BlackBox.getInstance().submitEvent(new BBDroneBitmapCommand("@Pilot", url.toString()));
|
|
+ this.targetAv = url;
|
|
+ this.targetValid = true;
|
|
+ if (url.getAbsolute().length() > 220) {
|
|
+ println(message("av-too-complex"));
|
|
+ url = URL.make("avatar:holden.mov");
|
|
+ this.targetValid = false;
|
|
+ } else if (!this.isValidAv()) {
|
|
+ println(message("av-has-inventory"));
|
|
+ url = URL.make("avatar:holden.mov");
|
|
+ this.targetValid = false;
|
|
+ }
|
|
+
|
|
+ this.loadPilot(url);
|
|
+ WorldServer serv = this.getServerNew();
|
|
+ if (serv != null) {
|
|
+ assert serv.getVersion() >= 18;
|
|
+
|
|
+ PropertyList propList = new PropertyList();
|
|
+ propList.addProperty(new net2Property(5, 64, 1, url.getAbsolute()));
|
|
+
|
|
+ try {
|
|
+ serv.sendNetworkMsg(new PropertySetCmd(propList));
|
|
+ } catch (PacketTooLargeException var5) {
|
|
+ assert url.getAbsolute().length() < 220;
|
|
+
|
|
+ assert false;
|
|
+ } catch (InfiniteWaitException var6) {
|
|
+ }
|
|
+
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+
|
|
+ public static void wake() {
|
|
+ if (active != null) {
|
|
+ active.setSleepMode((String)null);
|
|
+ }
|
|
+
|
|
+ }
|
|
+
|
|
+ public void goToSleep() {
|
|
+ this.setSleepMode(this.sleepStr);
|
|
+ Window.getAndResetUserActionCount();
|
|
+ }
|
|
+
|
|
+ public boolean isSleeping() {
|
|
+ return !this.sleepMode.equals("");
|
|
+ }
|
|
+
|
|
+ protected void setSleepMode(String mode) {
|
|
+ if (mode == null) {
|
|
+ mode = "";
|
|
+ this.lastUserAction = Std.getFastTime();
|
|
+ }
|
|
+
|
|
+ if (this.pilot != null) {
|
|
+ this.pilot.setSleepMode(mode);
|
|
+ }
|
|
+
|
|
+ if (!mode.equals(this.sleepMode)) {
|
|
+ WorldServer serv = this.getServerNew();
|
|
+ if (serv != null) {
|
|
+ PropertyList propList = new PropertyList();
|
|
+ propList.addProperty(new net2Property(23, 64, 1, mode));
|
|
+
|
|
+ try {
|
|
+ serv.sendNetworkMsg(new PropertySetCmd(propList));
|
|
+ } catch (PacketTooLargeException var5) {
|
|
+ assert false;
|
|
+ } catch (InfiniteWaitException var6) {
|
|
+ }
|
|
+
|
|
+ this.sleepMode = mode;
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+
|
|
+ public void setPilot(Pilot a) throws IllegalPilotException {
|
|
+ assert a != null;
|
|
+
|
|
+ Room prevRoom = null;
|
|
+ if (this.pilot != null) {
|
|
+ prevRoom = this.pilot.getRoom();
|
|
+ this.unregPilot();
|
|
+ }
|
|
+
|
|
+ this.pilot = a;
|
|
+ this.pilot.getSharer().createDynamicFromNet();
|
|
+ this.pilot.setConsole(this);
|
|
+ this.regPilot();
|
|
+ if (active == this) {
|
|
+ Pilot.changeActiveRoom(prevRoom);
|
|
+ }
|
|
+
|
|
+ this.pilot.setSleepMode(this.sleepMode);
|
|
+ if (this instanceof DefaultConsole) {
|
|
+ ((DefaultConsole)this).resetCamera();
|
|
+ }
|
|
+
|
|
+ }
|
|
+
|
|
+ public static GammaFrame getFrame() {
|
|
+ return frame;
|
|
+ }
|
|
+
|
|
+ public Galaxy getGalaxy() {
|
|
+ assert this.galaxy != null;
|
|
+
|
|
+ return this.galaxy;
|
|
+ }
|
|
+
|
|
+ public URL getGalaxyURL() {
|
|
+ return this._galaxyURL;
|
|
+ }
|
|
+
|
|
+ public void setServerURL(URL serverURL) {
|
|
+ try {
|
|
+ if (serverURL != null) {
|
|
+ this._galaxyURL = URL.make("worldserver://" + getServerHost(serverURL) + "/");
|
|
+ }
|
|
+ } catch (InvalidServerURLException var5) {
|
|
+ println(">>" + var5.getMessage());
|
|
+
|
|
+ assert false;
|
|
+
|
|
+ this._galaxyURL = null;
|
|
+ }
|
|
+
|
|
+ Galaxy oldGalaxy = this.galaxy;
|
|
+ this.unregWithGalaxy();
|
|
+ this.unregPilot();
|
|
+ if (this._galaxyURL != null) {
|
|
+ try {
|
|
+ this.galaxy = Galaxy.getGalaxy(this._galaxyURL);
|
|
+ } catch (InvalidServerURLException var4) {
|
|
+ println(">>" + var4.getMessage());
|
|
+ this.galaxy = Galaxy.getAnonGalaxy();
|
|
}
|
|
- }
|
|
+ } else {
|
|
+ this.galaxy = Galaxy.getAnonGalaxy();
|
|
+ }
|
|
|
|
- ((Console)c).incRef();
|
|
- ((Console)c).initPilot(url, callback);
|
|
- }
|
|
+ assert this.galaxy != null;
|
|
|
|
- }
|
|
+ this.regWithGalaxy();
|
|
+ this.regPilot();
|
|
+ if (oldGalaxy != null) {
|
|
+ oldGalaxy.decWorldCount();
|
|
+ if (oldGalaxy != this.galaxy) {
|
|
+ oldGalaxy.forceObjectRereg();
|
|
+ }
|
|
+ }
|
|
|
|
- protected void initPilot(URL pilotURL, LoadedURLSelf callback) {
|
|
- this.loadPilot(this.getDefaultAvatarURL());
|
|
- if (this.pilot == null) {
|
|
- this.useDefaultPilot();
|
|
- }
|
|
+ }
|
|
|
|
- callback.loadedURLSelf(this, pilotURL, (String)null);
|
|
- }
|
|
+ private void regWithGalaxy() {
|
|
+ assert this.galaxy != null;
|
|
|
|
- public void incRef() {
|
|
- ++this.refcnt;
|
|
- }
|
|
+ this.galaxy.addConsole(this);
|
|
+ this.galaxy.waitForConnection(this);
|
|
+ }
|
|
|
|
- public void decRef() {
|
|
- if (--this.refcnt == 0) {
|
|
- if (this.galaxy != null) {
|
|
- this.unregWithGalaxy();
|
|
- this.unregPilot();
|
|
- this.galaxy.decWorldCount();
|
|
- Galaxy oldGalaxy = this.galaxy;
|
|
- this.galaxy = null;
|
|
- }
|
|
-
|
|
- this.pilot = null;
|
|
- URL url = this.getSourceURL();
|
|
- if (url != null) {
|
|
- if (url.endsWith(".console")) {
|
|
- URLSelfLoader.unload(this);
|
|
- } else {
|
|
- defConsoles.remove(url);
|
|
+ private void unregWithGalaxy() {
|
|
+ assert this.galaxy != null;
|
|
+
|
|
+ this.galaxy.delConsole(this);
|
|
+ }
|
|
+
|
|
+ protected void regPilot() {
|
|
+ if (this.pilot != null) {
|
|
+ this.pilot.getSharer().adjustShare();
|
|
+ }
|
|
+
|
|
+ }
|
|
+
|
|
+ public static String getServerHost(URL url) throws InvalidServerURLException {
|
|
+ String s = url.unalias();
|
|
+ int len = s.length();
|
|
+ if (len > 14 && s.startsWith("worldserver://")) {
|
|
+ if (s.charAt(len - 1) == '/') {
|
|
+ --len;
|
|
}
|
|
- }
|
|
- }
|
|
|
|
- }
|
|
+ s = s.substring(14, len);
|
|
+ if (s.equals("209.67.68.214:6650")) {
|
|
+ s = "www.3dcd.com:6650";
|
|
+ }
|
|
|
|
- public String toString() {
|
|
- return super.toString() + "[" + this.getSourceURL() + "]";
|
|
- }
|
|
-
|
|
- public Pilot getPilotSoulTemplate() {
|
|
- return this.pilotSoulTemplate;
|
|
- }
|
|
-
|
|
- public Drone getDroneSoulTemplate() {
|
|
- return this.droneSoulTemplate;
|
|
- }
|
|
-
|
|
- public Pilot getPilot() {
|
|
- return this.pilot;
|
|
- }
|
|
-
|
|
- public boolean isValidAv() {
|
|
- if (this.targetAv == null) {
|
|
- return false;
|
|
- } else if (!InventoryManager.getInventoryManager().inventoryInitialized()) {
|
|
- return true;
|
|
- } else {
|
|
- String av = this.targetAv.getAbsolute();
|
|
- int len = av.length();
|
|
-
|
|
- for(int i = 1; i < len; ++i) {
|
|
- if (av.charAt(i - 1) == '_') {
|
|
- char firstChar = av.charAt(i);
|
|
- if (Character.isLowerCase(firstChar)) {
|
|
- StringBuffer item = new StringBuffer();
|
|
- item.append(Character.toUpperCase(firstChar));
|
|
-
|
|
- while(true) {
|
|
- ++i;
|
|
- if (i >= len) {
|
|
- break;
|
|
- }
|
|
-
|
|
- char c = av.charAt(i);
|
|
- if (!Character.isLowerCase(c)) {
|
|
- break;
|
|
- }
|
|
-
|
|
- item.append(c);
|
|
- }
|
|
-
|
|
- if (InventoryManager.getInventoryManager().checkInventoryFor(item.toString()) <= 0) {
|
|
- return false;
|
|
- }
|
|
- }
|
|
- }
|
|
- }
|
|
-
|
|
- return true;
|
|
- }
|
|
- }
|
|
-
|
|
- public void resetAvatar() {
|
|
- this.setAvatar(this.targetAv);
|
|
- }
|
|
-
|
|
- public void setAvatar(URL url) {
|
|
- if (url != null) {
|
|
- BlackBox.getInstance().submitEvent(new BBDroneBitmapCommand("@Pilot", url.toString()));
|
|
- this.targetAv = url;
|
|
- this.targetValid = true;
|
|
- if (url.getAbsolute().length() > 220) {
|
|
- println(message("av-too-complex"));
|
|
- url = URL.make("avatar:holden.mov");
|
|
- this.targetValid = false;
|
|
- } else if (!this.isValidAv()) {
|
|
- println(message("av-has-inventory"));
|
|
- url = URL.make("avatar:holden.mov");
|
|
- this.targetValid = false;
|
|
- }
|
|
-
|
|
- this.loadPilot(url);
|
|
- WorldServer serv = this.getServerNew();
|
|
- if (serv != null) {
|
|
- assert serv.getVersion() >= 18;
|
|
+ return s;
|
|
+ } else {
|
|
+ throw new InvalidServerURLException("Bad worldserver:// URL format");
|
|
+ }
|
|
+ }
|
|
|
|
- PropertyList propList = new PropertyList();
|
|
- propList.addProperty(new net2Property(5, 64, 1, url.getAbsolute()));
|
|
+ public static URL makeServerURL(String host) {
|
|
+ assert host != null && host.length() > 0;
|
|
|
|
- try {
|
|
- serv.sendNetworkMsg(new PropertySetCmd(propList));
|
|
- } catch (PacketTooLargeException var5) {
|
|
- assert url.getAbsolute().length() < 220;
|
|
-
|
|
- assert false;
|
|
- } catch (InfiniteWaitException var6) {
|
|
- }
|
|
-
|
|
- }
|
|
- }
|
|
- }
|
|
-
|
|
- public static void wake() {
|
|
- if (active != null) {
|
|
- active.setSleepMode((String)null);
|
|
- }
|
|
-
|
|
- }
|
|
-
|
|
- public void goToSleep() {
|
|
- this.setSleepMode(this.sleepStr);
|
|
- Window.getAndResetUserActionCount();
|
|
- }
|
|
-
|
|
- public boolean isSleeping() {
|
|
- return !this.sleepMode.equals("");
|
|
- }
|
|
-
|
|
- protected void setSleepMode(String mode) {
|
|
- if (mode == null) {
|
|
- mode = "";
|
|
- this.lastUserAction = Std.getFastTime();
|
|
- }
|
|
-
|
|
- if (this.pilot != null) {
|
|
- this.pilot.setSleepMode(mode);
|
|
- }
|
|
-
|
|
- if (!mode.equals(this.sleepMode)) {
|
|
- WorldServer serv = this.getServerNew();
|
|
- if (serv != null) {
|
|
- PropertyList propList = new PropertyList();
|
|
- propList.addProperty(new net2Property(23, 64, 1, mode));
|
|
+ return URL.make("worldserver://" + host + "/");
|
|
+ }
|
|
|
|
- try {
|
|
- serv.sendNetworkMsg(new PropertySetCmd(propList));
|
|
- } catch (PacketTooLargeException var5) {
|
|
- assert false;
|
|
- } catch (InfiniteWaitException var6) {
|
|
- }
|
|
-
|
|
- this.sleepMode = mode;
|
|
- }
|
|
- }
|
|
- }
|
|
-
|
|
- public void setPilot(Pilot a) throws IllegalPilotException {
|
|
- assert a != null;
|
|
-
|
|
- Room prevRoom = null;
|
|
- if (this.pilot != null) {
|
|
- prevRoom = this.pilot.getRoom();
|
|
- this.unregPilot();
|
|
- }
|
|
-
|
|
- this.pilot = a;
|
|
- this.pilot.getSharer().createDynamicFromNet();
|
|
- this.pilot.setConsole(this);
|
|
- this.regPilot();
|
|
- if (active == this) {
|
|
- Pilot.changeActiveRoom(prevRoom);
|
|
- }
|
|
-
|
|
- this.pilot.setSleepMode(this.sleepMode);
|
|
- if (this instanceof DefaultConsole) {
|
|
- ((DefaultConsole)this).resetCamera();
|
|
- }
|
|
-
|
|
- }
|
|
-
|
|
- public static GammaFrame getFrame() {
|
|
- return frame;
|
|
- }
|
|
-
|
|
- public Galaxy getGalaxy() {
|
|
- assert this.galaxy != null;
|
|
-
|
|
- return this.galaxy;
|
|
- }
|
|
-
|
|
- public URL getGalaxyURL() {
|
|
- return this._galaxyURL;
|
|
- }
|
|
-
|
|
- public void setServerURL(URL serverURL) {
|
|
- try {
|
|
- if (serverURL != null) {
|
|
- this._galaxyURL = URL.make("worldserver://" + getServerHost(serverURL) + "/");
|
|
- }
|
|
- } catch (InvalidServerURLException var5) {
|
|
- println(">>" + var5.getMessage());
|
|
-
|
|
- assert false;
|
|
-
|
|
- this._galaxyURL = null;
|
|
- }
|
|
-
|
|
- Galaxy oldGalaxy = this.galaxy;
|
|
- this.unregWithGalaxy();
|
|
- this.unregPilot();
|
|
- if (this._galaxyURL != null) {
|
|
- try {
|
|
- this.galaxy = Galaxy.getGalaxy(this._galaxyURL);
|
|
- } catch (InvalidServerURLException var4) {
|
|
- println(">>" + var4.getMessage());
|
|
- this.galaxy = Galaxy.getAnonGalaxy();
|
|
- }
|
|
- } else {
|
|
- this.galaxy = Galaxy.getAnonGalaxy();
|
|
- }
|
|
-
|
|
- assert this.galaxy != null;
|
|
-
|
|
- this.regWithGalaxy();
|
|
- this.regPilot();
|
|
- if (oldGalaxy != null) {
|
|
- oldGalaxy.decWorldCount();
|
|
- if (oldGalaxy != this.galaxy) {
|
|
- oldGalaxy.forceObjectRereg();
|
|
- }
|
|
- }
|
|
-
|
|
- }
|
|
-
|
|
- private void regWithGalaxy() {
|
|
- assert this.galaxy != null;
|
|
-
|
|
- this.galaxy.addConsole(this);
|
|
- this.galaxy.waitForConnection(this);
|
|
- }
|
|
-
|
|
- private void unregWithGalaxy() {
|
|
- assert this.galaxy != null;
|
|
-
|
|
- this.galaxy.delConsole(this);
|
|
- }
|
|
-
|
|
- protected void regPilot() {
|
|
- if (this.pilot != null) {
|
|
- this.pilot.getSharer().adjustShare();
|
|
- }
|
|
-
|
|
- }
|
|
-
|
|
- public static String getServerHost(URL url) throws InvalidServerURLException {
|
|
- String s = url.unalias();
|
|
- int len = s.length();
|
|
- if (len > 14 && s.startsWith("worldserver://")) {
|
|
- if (s.charAt(len - 1) == '/') {
|
|
- --len;
|
|
- }
|
|
-
|
|
- s = s.substring(14, len);
|
|
- if (s.equals("209.67.68.214:6650")) {
|
|
- s = "www.3dcd.com:6650";
|
|
- }
|
|
-
|
|
- return s;
|
|
- } else {
|
|
- throw new InvalidServerURLException("Bad worldserver:// URL format");
|
|
- }
|
|
- }
|
|
-
|
|
- public static URL makeServerURL(String host) {
|
|
- assert host != null && host.length() > 0;
|
|
-
|
|
- return URL.make("worldserver://" + host + "/");
|
|
- }
|
|
-
|
|
- protected void unregPilot() {
|
|
- if (this.pilot != null) {
|
|
- this.pilot.getSharer().adjustShare();
|
|
- }
|
|
-
|
|
- }
|
|
-
|
|
- public Cursor getCursor() {
|
|
- return this.cursor;
|
|
- }
|
|
-
|
|
- public String getScriptServer() {
|
|
- String Fred = "Fred";
|
|
- String override = IniFile.override().getIniString("ScriptServer", Fred);
|
|
- if (!override.equals(Fred)) {
|
|
- return new String(override);
|
|
- } else {
|
|
- WorldServer server = this.getServerNew();
|
|
- if (server != null) {
|
|
- String sname = server.getScriptServer();
|
|
+ protected void unregPilot() {
|
|
+ if (this.pilot != null) {
|
|
+ this.pilot.getSharer().adjustShare();
|
|
+ }
|
|
+
|
|
+ }
|
|
+
|
|
+ public Cursor getCursor() {
|
|
+ return this.cursor;
|
|
+ }
|
|
+
|
|
+ public String getScriptServer() {
|
|
+ String Fred = "Fred";
|
|
+ String override = IniFile.override().getIniString("ScriptServer", Fred);
|
|
+ if (!override.equals(Fred)) {
|
|
+ return new String(override);
|
|
+ } else {
|
|
+ WorldServer server = this.getServerNew();
|
|
+ if (server != null) {
|
|
+ String sname = server.getScriptServer();
|
|
+ if (sname != null) {
|
|
+ return new String(sname);
|
|
+ }
|
|
+ }
|
|
+
|
|
+ return new String("http://www-dynamic.us.worlds.net/cgi-bin/");
|
|
+ }
|
|
+ }
|
|
+
|
|
+ public String getSmtpServer() {
|
|
+ WorldServer server = this.getServerNew();
|
|
+ if (server != null) {
|
|
+ String sname = server.getSmtpServer();
|
|
if (sname != null) {
|
|
- return new String(sname);
|
|
+ return sname;
|
|
}
|
|
- }
|
|
+ }
|
|
+
|
|
+ return "www.3dcd.com:25";
|
|
+ }
|
|
|
|
- return new String("http://www-dynamic.us.worlds.net/cgi-bin/");
|
|
- }
|
|
- }
|
|
-
|
|
- public String getSmtpServer() {
|
|
- WorldServer server = this.getServerNew();
|
|
- if (server != null) {
|
|
- String sname = server.getSmtpServer();
|
|
- if (sname != null) {
|
|
- return sname;
|
|
- }
|
|
- }
|
|
-
|
|
- return "www.3dcd.com:25";
|
|
- }
|
|
-
|
|
- public String getMailDomain() {
|
|
- WorldServer server = this.getServerNew();
|
|
- if (server != null) {
|
|
- String dname = server.getMailDomain();
|
|
- if (dname != null) {
|
|
- return dname;
|
|
- }
|
|
- }
|
|
-
|
|
- return "3dcd.com";
|
|
- }
|
|
-
|
|
- public Object properties(int index, int offset, int mode, Object value) throws NoSuchPropertyException {
|
|
- Object ret = null;
|
|
- switch (index - offset) {
|
|
- case 0:
|
|
- if (mode == 0) {
|
|
- ret = URLPropertyEditor.make((new Property(this, index, "Server URL")).allowSetNull(), (String)null);
|
|
- } else if (mode == 1) {
|
|
- ret = this.getGalaxyURL();
|
|
- } else if (mode == 2) {
|
|
- if (value == null) {
|
|
- this.setServerURL((URL)null);
|
|
- } else {
|
|
- URL u = (URL)value;
|
|
- if (u != null && !u.unalias().startsWith("worldserver:")) {
|
|
- println(message("server-URL"));
|
|
- } else {
|
|
- this.setServerURL(u);
|
|
- }
|
|
- }
|
|
- }
|
|
- break;
|
|
- case 1:
|
|
- if (mode == 0) {
|
|
- ret = BooleanPropertyEditor.make(new Property(this, index, "Enable Menu Bar"), "No", "Yes");
|
|
- } else if (mode == 1) {
|
|
- ret = new Boolean(this.enableMenu);
|
|
- } else if (mode == 2) {
|
|
- this.setEnableMenu((Boolean)value);
|
|
- }
|
|
- break;
|
|
- case 2:
|
|
- if (mode == 0) {
|
|
- ret = BooleanPropertyEditor.make(new Property(this, index, "Disable Shaper Access (irreversible!)"), "No", "Yes");
|
|
- } else if (mode == 1) {
|
|
- ret = new Boolean(this.disableShaperAccess);
|
|
- } else if (mode == 2) {
|
|
- this.disableShaperAccess = (Boolean)value;
|
|
- }
|
|
- break;
|
|
- case 3:
|
|
- if (mode == 0) {
|
|
- ret = BooleanPropertyEditor.make(new Property(this, index, "Disable Single-user Access"), "No", "Yes");
|
|
- } else if (mode == 1) {
|
|
- ret = new Boolean(this.disableSingleUserAccess);
|
|
- } else if (mode == 2) {
|
|
- this.disableSingleUserAccess = (Boolean)value;
|
|
- }
|
|
- break;
|
|
- case 4:
|
|
- if (mode == 0) {
|
|
- ret = new Property(this, index, "Pilot Soul Template");
|
|
- } else if (mode == 1) {
|
|
- ret = this.pilotSoulTemplate;
|
|
- }
|
|
- break;
|
|
- case 5:
|
|
- if (mode == 0) {
|
|
- ret = new Property(this, index, "Drone Soul Template");
|
|
- } else if (mode == 1) {
|
|
- ret = this.droneSoulTemplate;
|
|
- }
|
|
- break;
|
|
- case 6:
|
|
- if (mode == 0) {
|
|
- ret = new Property(this, index, "Cursor");
|
|
- } else if (mode == 1) {
|
|
- ret = this.getCursor();
|
|
- }
|
|
- break;
|
|
- case 7:
|
|
- if (mode == 0) {
|
|
- ret = PropAdder.make(new VectorProperty(this, index, "Temporary Area"));
|
|
- } else if (mode == 1) {
|
|
- ret = this.tempArea.clone();
|
|
- } else if (mode == 4) {
|
|
- this.tempArea.removeElement(value);
|
|
- ((SuperRoot)value).detach();
|
|
- } else if (mode == 3) {
|
|
- this.tempArea.addElement(value);
|
|
- this.add((SuperRoot)value);
|
|
- if (value instanceof Console) {
|
|
- Console c = (Console)value;
|
|
- if (c.pilotSoulTemplate == null) {
|
|
- c.loadInit();
|
|
- }
|
|
- }
|
|
- } else if (mode == 5 && value instanceof SuperRoot && !(value instanceof Room)) {
|
|
- ret = value;
|
|
- }
|
|
- break;
|
|
- case 8:
|
|
- if (mode == 0) {
|
|
- ret = StringPropertyEditor.make(new Property(this, index, "Default Action"));
|
|
- } else if (mode == 1) {
|
|
- ret = this.getDefaultAction();
|
|
- } else if (mode == 2) {
|
|
- this.setDefaultAction((String)value);
|
|
- }
|
|
- break;
|
|
- default:
|
|
- ret = super.properties(index, offset + 9, mode, value);
|
|
- }
|
|
-
|
|
- return ret;
|
|
- }
|
|
-
|
|
- public void saveState(Saver s) throws IOException {
|
|
- s.saveVersion(4, classCookie);
|
|
- super.saveState(s);
|
|
- URL.save(s, this.getGalaxyURL());
|
|
- s.saveBoolean(this.enableMenu);
|
|
- s.saveBoolean(this.disableShaperAccess);
|
|
- s.saveString(this.defaultAction);
|
|
- s.save(this.pilotSoulTemplate);
|
|
- s.save(this.droneSoulTemplate);
|
|
- s.save(this.cursor);
|
|
- }
|
|
-
|
|
- private static URL restoreOldURL(Restorer r) throws IOException {
|
|
- String s = r.restoreString();
|
|
- return s != null && !s.equals("UNSHARED") ? makeServerURL(s) : null;
|
|
- }
|
|
-
|
|
- public void restoreState(Restorer r) throws IOException, TooNewException {
|
|
- int vers = r.restoreVersion(classCookie);
|
|
- switch (vers) {
|
|
- case 0:
|
|
- case 1:
|
|
- WObject w = new WObject();
|
|
- w.restoreState(r);
|
|
- this.setName(w.getName());
|
|
- this.templateInit();
|
|
- Enumeration e = w.getAttributes();
|
|
-
|
|
- while(e.hasMoreElements()) {
|
|
- Attribute a = (Attribute)e.nextElement();
|
|
- a.setAttrID(a.getForwardAttrID());
|
|
- }
|
|
-
|
|
- Pilot.copySoul(w, this.pilotSoulTemplate);
|
|
- this.setServerURL(restoreOldURL(r));
|
|
- this.enableMenu = r.restoreBoolean();
|
|
- this.disableShaperAccess = r.restoreBoolean();
|
|
- if (vers == 1) {
|
|
- this.cursor = (Cursor)r.restore();
|
|
- }
|
|
- break;
|
|
- case 2:
|
|
- super.restoreState(r);
|
|
- this.setServerURL(restoreOldURL(r));
|
|
- this.enableMenu = r.restoreBoolean();
|
|
- this.disableShaperAccess = r.restoreBoolean();
|
|
- this.pilotSoulTemplate = (Pilot)r.restore();
|
|
- this.add(this.pilotSoulTemplate);
|
|
- this.droneSoulTemplate = (Drone)r.restore();
|
|
- this.add(this.droneSoulTemplate);
|
|
- this.cursor = (Cursor)r.restore();
|
|
- break;
|
|
- case 3:
|
|
- super.restoreState(r);
|
|
- this.setServerURL(restoreOldURL(r));
|
|
- this.enableMenu = r.restoreBoolean();
|
|
- this.disableShaperAccess = r.restoreBoolean();
|
|
- this.defaultAction = r.restoreString();
|
|
- this.pilotSoulTemplate = (Pilot)r.restore();
|
|
- this.add(this.pilotSoulTemplate);
|
|
- this.droneSoulTemplate = (Drone)r.restore();
|
|
- this.add(this.droneSoulTemplate);
|
|
- this.cursor = (Cursor)r.restore();
|
|
- break;
|
|
- case 4:
|
|
- super.restoreState(r);
|
|
- this.setServerURL(URL.restore(r));
|
|
- this.enableMenu = r.restoreBoolean();
|
|
- this.disableShaperAccess = r.restoreBoolean();
|
|
- this.defaultAction = r.restoreString();
|
|
- this.pilotSoulTemplate = (Pilot)r.restore();
|
|
- this.add(this.pilotSoulTemplate);
|
|
- this.droneSoulTemplate = (Drone)r.restore();
|
|
- this.add(this.droneSoulTemplate);
|
|
- this.cursor = (Cursor)r.restore();
|
|
- break;
|
|
- default:
|
|
- throw new TooNewException();
|
|
- }
|
|
+ public String getMailDomain() {
|
|
+ WorldServer server = this.getServerNew();
|
|
+ if (server != null) {
|
|
+ String dname = server.getMailDomain();
|
|
+ if (dname != null) {
|
|
+ return dname;
|
|
+ }
|
|
+ }
|
|
+
|
|
+ return "3dcd.com";
|
|
+ }
|
|
+
|
|
+ public Object properties(int index, int offset, int mode, Object value) throws NoSuchPropertyException {
|
|
+ Object ret = null;
|
|
+ switch(index - offset) {
|
|
+ case 0:
|
|
+ if (mode == 0) {
|
|
+ ret = URLPropertyEditor.make((new Property(this, index, "Server URL")).allowSetNull(), (String)null);
|
|
+ } else if (mode == 1) {
|
|
+ ret = this.getGalaxyURL();
|
|
+ } else if (mode == 2) {
|
|
+ if (value == null) {
|
|
+ this.setServerURL((URL)null);
|
|
+ } else {
|
|
+ URL u = (URL)value;
|
|
+ if (u != null && !u.unalias().startsWith("worldserver:")) {
|
|
+ println(message("server-URL"));
|
|
+ } else {
|
|
+ this.setServerURL(u);
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+ break;
|
|
+ case 1:
|
|
+ if (mode == 0) {
|
|
+ ret = BooleanPropertyEditor.make(new Property(this, index, "Enable Menu Bar"), "No", "Yes");
|
|
+ } else if (mode == 1) {
|
|
+ ret = new Boolean(this.enableMenu);
|
|
+ } else if (mode == 2) {
|
|
+ this.setEnableMenu((Boolean)value);
|
|
+ }
|
|
+ break;
|
|
+ case 2:
|
|
+ if (mode == 0) {
|
|
+ ret = BooleanPropertyEditor.make(new Property(this, index, "Disable Shaper Access (irreversible!)"), "No", "Yes");
|
|
+ } else if (mode == 1) {
|
|
+ ret = new Boolean(this.disableShaperAccess);
|
|
+ } else if (mode == 2) {
|
|
+ this.disableShaperAccess = (Boolean)value;
|
|
+ }
|
|
+ break;
|
|
+ case 3:
|
|
+ if (mode == 0) {
|
|
+ ret = BooleanPropertyEditor.make(new Property(this, index, "Disable Single-user Access"), "No", "Yes");
|
|
+ } else if (mode == 1) {
|
|
+ ret = new Boolean(this.disableSingleUserAccess);
|
|
+ } else if (mode == 2) {
|
|
+ this.disableSingleUserAccess = (Boolean)value;
|
|
+ }
|
|
+ break;
|
|
+ case 4:
|
|
+ if (mode == 0) {
|
|
+ ret = new Property(this, index, "Pilot Soul Template");
|
|
+ } else if (mode == 1) {
|
|
+ ret = this.pilotSoulTemplate;
|
|
+ }
|
|
+ break;
|
|
+ case 5:
|
|
+ if (mode == 0) {
|
|
+ ret = new Property(this, index, "Drone Soul Template");
|
|
+ } else if (mode == 1) {
|
|
+ ret = this.droneSoulTemplate;
|
|
+ }
|
|
+ break;
|
|
+ case 6:
|
|
+ if (mode == 0) {
|
|
+ ret = new Property(this, index, "Cursor");
|
|
+ } else if (mode == 1) {
|
|
+ ret = this.getCursor();
|
|
+ }
|
|
+ break;
|
|
+ case 7:
|
|
+ if (mode == 0) {
|
|
+ ret = PropAdder.make(new VectorProperty(this, index, "Temporary Area"));
|
|
+ } else if (mode == 1) {
|
|
+ ret = this.tempArea.clone();
|
|
+ } else if (mode == 4) {
|
|
+ this.tempArea.removeElement(value);
|
|
+ ((SuperRoot)value).detach();
|
|
+ } else if (mode == 3) {
|
|
+ this.tempArea.addElement(value);
|
|
+ this.add((SuperRoot)value);
|
|
+ if (value instanceof Console) {
|
|
+ Console c = (Console)value;
|
|
+ if (c.pilotSoulTemplate == null) {
|
|
+ c.loadInit();
|
|
+ }
|
|
+ }
|
|
+ } else if (mode == 5 && value instanceof SuperRoot && !(value instanceof Room)) {
|
|
+ ret = value;
|
|
+ }
|
|
+ break;
|
|
+ case 8:
|
|
+ if (mode == 0) {
|
|
+ ret = StringPropertyEditor.make(new Property(this, index, "Default Action"));
|
|
+ } else if (mode == 1) {
|
|
+ ret = this.getDefaultAction();
|
|
+ } else if (mode == 2) {
|
|
+ this.setDefaultAction((String)value);
|
|
+ }
|
|
+ break;
|
|
+ default:
|
|
+ ret = super.properties(index, offset + 9, mode, value);
|
|
+ }
|
|
+
|
|
+ return ret;
|
|
+ }
|
|
+
|
|
+ public void saveState(Saver s) throws IOException {
|
|
+ s.saveVersion(4, classCookie);
|
|
+ super.saveState(s);
|
|
+ URL.save(s, this.getGalaxyURL());
|
|
+ s.saveBoolean(this.enableMenu);
|
|
+ s.saveBoolean(this.disableShaperAccess);
|
|
+ s.saveString(this.defaultAction);
|
|
+ s.save(this.pilotSoulTemplate);
|
|
+ s.save(this.droneSoulTemplate);
|
|
+ s.save(this.cursor);
|
|
+ }
|
|
+
|
|
+ private static URL restoreOldURL(Restorer r) throws IOException {
|
|
+ String s = r.restoreString();
|
|
+ return s != null && !s.equals("UNSHARED") ? makeServerURL(s) : null;
|
|
+ }
|
|
+
|
|
+ public void restoreState(Restorer r) throws IOException, TooNewException {
|
|
+ int vers = r.restoreVersion(classCookie);
|
|
+ switch(vers) {
|
|
+ case 0:
|
|
+ case 1:
|
|
+ WObject w = new WObject();
|
|
+ w.restoreState(r);
|
|
+ this.setName(w.getName());
|
|
+ this.templateInit();
|
|
+ Enumeration e = w.getAttributes();
|
|
+
|
|
+ while(e.hasMoreElements()) {
|
|
+ Attribute a = (Attribute)e.nextElement();
|
|
+ a.setAttrID(a.getForwardAttrID());
|
|
+ }
|
|
+
|
|
+ Pilot.copySoul(w, this.pilotSoulTemplate);
|
|
+ this.setServerURL(restoreOldURL(r));
|
|
+ this.enableMenu = r.restoreBoolean();
|
|
+ this.disableShaperAccess = r.restoreBoolean();
|
|
+ if (vers == 1) {
|
|
+ this.cursor = (Cursor)r.restore();
|
|
+ }
|
|
+ break;
|
|
+ case 2:
|
|
+ super.restoreState(r);
|
|
+ this.setServerURL(restoreOldURL(r));
|
|
+ this.enableMenu = r.restoreBoolean();
|
|
+ this.disableShaperAccess = r.restoreBoolean();
|
|
+ this.pilotSoulTemplate = (Pilot)r.restore();
|
|
+ this.add(this.pilotSoulTemplate);
|
|
+ this.droneSoulTemplate = (Drone)r.restore();
|
|
+ this.add(this.droneSoulTemplate);
|
|
+ this.cursor = (Cursor)r.restore();
|
|
+ break;
|
|
+ case 3:
|
|
+ super.restoreState(r);
|
|
+ this.setServerURL(restoreOldURL(r));
|
|
+ this.enableMenu = r.restoreBoolean();
|
|
+ this.disableShaperAccess = r.restoreBoolean();
|
|
+ this.defaultAction = r.restoreString();
|
|
+ this.pilotSoulTemplate = (Pilot)r.restore();
|
|
+ this.add(this.pilotSoulTemplate);
|
|
+ this.droneSoulTemplate = (Drone)r.restore();
|
|
+ this.add(this.droneSoulTemplate);
|
|
+ this.cursor = (Cursor)r.restore();
|
|
+ break;
|
|
+ case 4:
|
|
+ super.restoreState(r);
|
|
+ this.setServerURL(URL.restore(r));
|
|
+ this.enableMenu = r.restoreBoolean();
|
|
+ this.disableShaperAccess = r.restoreBoolean();
|
|
+ this.defaultAction = r.restoreString();
|
|
+ this.pilotSoulTemplate = (Pilot)r.restore();
|
|
+ this.add(this.pilotSoulTemplate);
|
|
+ this.droneSoulTemplate = (Drone)r.restore();
|
|
+ this.add(this.droneSoulTemplate);
|
|
+ this.cursor = (Cursor)r.restore();
|
|
+ break;
|
|
+ default:
|
|
+ throw new TooNewException();
|
|
+ }
|
|
|
|
- this.add(this.cursor);
|
|
- }
|
|
+ this.add(this.cursor);
|
|
+ }
|
|
}
|
|
diff -ruN a/1920/NET/worlds/network/whisperCmd.java b/1920/NET/worlds/network/whisperCmd.java
|
|
--- a/1920/NET/worlds/network/whisperCmd.java 2024-01-08 01:46:34.000000000 -0600
|
|
+++ b/1920/NET/worlds/network/whisperCmd.java 2023-08-21 23:27:17.000000000 -0500
|
|
@@ -4,62 +4,66 @@
|
|
import NET.worlds.console.FriendsListPart;
|
|
import NET.worlds.console.MuteListPart;
|
|
import NET.worlds.scape.WorldScriptManager;
|
|
+import NET.worldstray.TrayNotifier;
|
|
+
|
|
import java.text.MessageFormat;
|
|
|
|
public class whisperCmd extends textCmd {
|
|
- public static final byte WHISPERCMD = 17;
|
|
- private static String rejectMsg = Console.message("not-whispers");
|
|
+ public static final byte WHISPERCMD = 17;
|
|
+ private static String rejectMsg = Console.message("not-whispers");
|
|
+ TrayNotifier tray = Console.tray;
|
|
+
|
|
+ public whisperCmd() {
|
|
+ this._commandType = 17;
|
|
+ }
|
|
+
|
|
+ public whisperCmd(String who, String text) {
|
|
+ super(text);
|
|
+ WorldScriptManager.getInstance().onConversation(who, text);
|
|
+ this._commandType = 17;
|
|
+ this._objID = new ObjID(who);
|
|
+ }
|
|
+
|
|
+ void process(WorldServer _serv) throws Exception {
|
|
+ String name;
|
|
+ Object[] arguments;
|
|
+ if (this._senderID.longID() == null) {
|
|
+ arguments = new Object[]{new String(String.valueOf(this._senderID.shortID()))};
|
|
+ name = MessageFormat.format(Console.message("Unknown-Name"), arguments);
|
|
+ } else {
|
|
+ name = this._senderID.longID();
|
|
+ if (MuteListPart.isMuted(_serv, name)) {
|
|
+ try {
|
|
+ _serv.sendNetworkMsg(new whisperCmd(name, Console.message("have-you-muted")));
|
|
+ } catch (InfiniteWaitException var4) {
|
|
+ } catch (PacketTooLargeException var5) {
|
|
+ }
|
|
|
|
- public whisperCmd() {
|
|
- this._commandType = 17;
|
|
- }
|
|
-
|
|
- public whisperCmd(String who, String text) {
|
|
- super(text);
|
|
- WorldScriptManager.getInstance().onConversation(who, text);
|
|
- this._commandType = 17;
|
|
- this._objID = new ObjID(who);
|
|
- }
|
|
-
|
|
- void process(WorldServer _serv) throws Exception {
|
|
- String name;
|
|
- Object[] arguments;
|
|
- if (this._senderID.longID() == null) {
|
|
- arguments = new Object[]{new String(String.valueOf(this._senderID.shortID()))};
|
|
- name = MessageFormat.format(Console.message("Unknown-Name"), arguments);
|
|
- } else {
|
|
- name = this._senderID.longID();
|
|
- if (MuteListPart.isMuted(_serv, name)) {
|
|
- try {
|
|
- _serv.sendNetworkMsg(new whisperCmd(name, Console.message("have-you-muted")));
|
|
- } catch (InfiniteWaitException var4) {
|
|
- } catch (PacketTooLargeException var5) {
|
|
+ return;
|
|
}
|
|
|
|
- return;
|
|
- }
|
|
+ if (!this._text.startsWith("&|+") && MuteListPart.isRejecting(_serv)) {
|
|
+ try {
|
|
+ if (!this._text.equals(rejectMsg)) {
|
|
+ arguments = new Object[]{new String(name)};
|
|
+ Console.println(MessageFormat.format(Console.message("You-rejected"), arguments));
|
|
+ _serv.sendNetworkMsg(new whisperCmd(name, rejectMsg));
|
|
+ }
|
|
+ } catch (InfiniteWaitException var6) {
|
|
+ } catch (PacketTooLargeException var7) {
|
|
+ }
|
|
|
|
- if (!this._text.startsWith("&|+") && MuteListPart.isRejecting(_serv)) {
|
|
- try {
|
|
- if (!this._text.equals(rejectMsg)) {
|
|
- arguments = new Object[]{new String(name)};
|
|
- Console.println(MessageFormat.format(Console.message("You-rejected"), arguments));
|
|
- _serv.sendNetworkMsg(new whisperCmd(name, rejectMsg));
|
|
- }
|
|
- } catch (InfiniteWaitException var6) {
|
|
- } catch (PacketTooLargeException var7) {
|
|
+ return;
|
|
}
|
|
+ }
|
|
|
|
- return;
|
|
- }
|
|
- }
|
|
-
|
|
- FriendsListPart.processWhisper(_serv, name, this._text);
|
|
- handleActionText(_serv, this._text, name, this._senderID);
|
|
- Console.printWhisper(name, FilthFilter.get().filter(this._text));
|
|
- }
|
|
-
|
|
- public String toString(WorldServer serv) {
|
|
- return Console.message("WHISPER") + " " + this._senderID.toString(serv) + " --> " + this._objID.toString(serv) + ": " + this._text;
|
|
- }
|
|
+ FriendsListPart.processWhisper(_serv, name, this._text);
|
|
+ if (!this._text.startsWith("&|+")) tray.notify("Whisper from " + name, this._text);
|
|
+ handleActionText(_serv, this._text, name, this._senderID);
|
|
+ Console.printWhisper(name, FilthFilter.get().filter(this._text));
|
|
+ }
|
|
+
|
|
+ public String toString(WorldServer serv) {
|
|
+ return Console.message("WHISPER") + " " + this._senderID.toString(serv) + " --> " + this._objID.toString(serv) + ": " + this._text;
|
|
+ }
|
|
}
|
|
diff -ruN a/1920/NET/worldstray/TrayNotifier.java b/1920/NET/worldstray/TrayNotifier.java
|
|
--- a/1920/NET/worldstray/TrayNotifier.java 1969-12-31 18:00:00.000000000 -0600
|
|
+++ b/1920/NET/worldstray/TrayNotifier.java 2023-08-21 23:27:17.000000000 -0500
|
|
@@ -0,0 +1,47 @@
|
|
+package NET.worldstray;
|
|
+
|
|
+import NET.worlds.console.Console;
|
|
+
|
|
+import java.awt.*;
|
|
+import java.awt.TrayIcon.MessageType;
|
|
+
|
|
+public class TrayNotifier {
|
|
+
|
|
+ public TrayNotifier() {
|
|
+ if (SystemTray.isSupported()) {
|
|
+ this.displayTray();
|
|
+ } else {
|
|
+ System.err.println("System tray not supported!");
|
|
+ }
|
|
+ }
|
|
+
|
|
+ SystemTray tray = null;
|
|
+ TrayIcon trayIcon = null;
|
|
+
|
|
+ public void displayTray() {
|
|
+ //Obtain only one instance of the SystemTray object
|
|
+
|
|
+ tray = SystemTray.getSystemTray();
|
|
+
|
|
+ //If the icon is a file
|
|
+ Image image = Toolkit.getDefaultToolkit().createImage("icon.png");
|
|
+
|
|
+ trayIcon = new TrayIcon(image, "WorldsPlayer");
|
|
+ trayIcon.setImageAutoSize(true);
|
|
+ trayIcon.setToolTip("WorldsPlayer by Worlds Inc.");
|
|
+ try {
|
|
+ tray.add(trayIcon);
|
|
+ } catch (AWTException e) {
|
|
+ e.printStackTrace();
|
|
+ }
|
|
+ }
|
|
+
|
|
+ public void notify(String title, String message) {
|
|
+ notify(title, message, MessageType.NONE);
|
|
+ }
|
|
+
|
|
+ public void notify(String title, String message, MessageType type) {
|
|
+ trayIcon.displayMessage(title, message, type);
|
|
+ }
|
|
+
|
|
+}
|