diff -ruN a/1890/NET/worlds/console/AboutDialog.java b/1890/NET/worlds/console/AboutDialog.java --- a/1890/NET/worlds/console/AboutDialog.java 2023-08-21 23:27:15.000000000 -0500 +++ b/1890/NET/worlds/console/AboutDialog.java 2023-08-21 23:27:17.000000000 -0500 @@ -3,6 +3,8 @@ import NET.worlds.core.IniFile; import NET.worlds.core.Std; import NET.worlds.network.NetUpdate; +import NET.worldsplus.WPlus; + import java.awt.BorderLayout; import java.awt.Button; import java.awt.Color; @@ -19,76 +21,77 @@ import java.util.Vector; public class AboutDialog extends PolledDialog { - Button okButton = new Button(Console.message("OK")); - private static Font font = new Font(Console.message("ConsoleFont"), 0, 12); - private static Font bfont = new Font(Console.message("ButtonFont"), 0, 12); - String apptitle; - - AboutDialog(String var1, Frame var2) { - super(var2, (DialogReceiver)null, Console.message("About") + Std.getProductName(), true); - this.apptitle = var1; - this.ready(); - } - - private Component setConstraints(GridBagLayout var1, Component var2, GridBagConstraints var3) { - var1.setConstraints(var2, var3); - return var2; - } - - protected void build() { - this.setBackground(Color.white); - this.setLayout(new BorderLayout()); - this.add("North", new Filler(10, 10)); - this.add("South", new Filler(10, 10)); - this.add("East", new Filler(10, 10)); - this.add("West", new Filler(10, 10)); - GridBagLayout var1 = new GridBagLayout(); - Panel var2 = new Panel(var1); - var2.setFont(font); - GridBagConstraints var3 = new GridBagConstraints(); - var3.fill = 0; - var3.weightx = 1.0D; - var3.weighty = 1.0D; - var3.gridwidth = 0; - var3.gridheight = 1; - String var4 = IniFile.override().getIniString("AboutLogo", Console.message("wlogo.gif")); - var2.add(this.setConstraints(var1, new ImageCanvas(var4), var3)); - var3.weightx = 0.0D; - var3.weighty = 0.0D; - var2.add(this.setConstraints(var1, new Label(this.apptitle), var3)); - if (Gamma.getShaper() != null) { - var2.add(this.setConstraints(var1, new Label(Console.message("about-box-build-date") + " " + Std.getBuildInfo()), var3)); - } else { - var2.add(this.setConstraints(var1, new Label(Console.message("about-box-rev") + " " + Std.getVersion()), var3)); - } - - Vector var5 = NetUpdate.aboutWorlds(); - TextArea var6 = new TextArea(10, 40); - var6.setEditable(false); - var2.add(this.setConstraints(var1, var6, var3)); - Enumeration var7 = var5.elements(); - - while(var7.hasMoreElements()) { - var6.append((String)var7.nextElement() + "\n"); - } - - var2.add(this.setConstraints(var1, new Label(Console.message("about-box-1")), var3)); - var2.add(this.setConstraints(var1, new Label(Console.message("about-box-2")), var3)); - this.okButton.setFont(bfont); - var2.add(this.setConstraints(var1, this.okButton, var3)); - this.add("Center", var2); - } - - public boolean action(Event var1, Object var2) { - return var1.target == this.okButton ? this.done(true) : false; - } - - public boolean keyDown(Event var1, int var2) { - return var2 != 27 && var2 != 10 ? super.keyDown(var1, var2) : this.done(true); - } - - public void show() { - super.show(); - this.okButton.requestFocus(); - } + Button okButton = new Button(Console.message("OK")); + private static Font font = new Font(Console.message("ConsoleFont"), 0, 12); + private static Font bfont = new Font(Console.message("ButtonFont"), 0, 12); + String apptitle; + + AboutDialog(String var1, Frame var2) { + super(var2, (DialogReceiver)null, Console.message("About") + Std.getProductName(), true); + this.apptitle = var1; + this.ready(); + } + + private Component setConstraints(GridBagLayout var1, Component var2, GridBagConstraints var3) { + var1.setConstraints(var2, var3); + return var2; + } + + protected void build() { + this.setBackground(Color.white); + this.setLayout(new BorderLayout()); + this.add("North", new Filler(10, 10)); + this.add("South", new Filler(10, 10)); + this.add("East", new Filler(10, 10)); + this.add("West", new Filler(10, 10)); + GridBagLayout var1 = new GridBagLayout(); + Panel var2 = new Panel(var1); + var2.setFont(font); + GridBagConstraints var3 = new GridBagConstraints(); + var3.fill = 0; + var3.weightx = 1.0D; + var3.weighty = 1.0D; + var3.gridwidth = 0; + var3.gridheight = 1; + String var4 = IniFile.override().getIniString("AboutLogo", Console.message("wlogo.gif")); + var2.add(this.setConstraints(var1, new ImageCanvas(var4), var3)); + var3.weightx = 0.0D; + var3.weighty = 0.0D; + var2.add(this.setConstraints(var1, new Label(this.apptitle), var3)); + if (Gamma.getShaper() != null) { + var2.add(this.setConstraints(var1, new Label(Console.message("about-box-build-date") + " " + Std.getBuildInfo()), var3)); + } else { + var2.add(this.setConstraints(var1, new Label(Console.message("about-box-rev") + " " + Std.getVersion()), var3)); + } + var2.add(this.setConstraints(var1, new Label("Worlds+ by Wirlaburla " + WPlus.getVersion()), var3)); + + Vector var5 = NetUpdate.aboutWorlds(); + TextArea var6 = new TextArea(10, 40); + var6.setEditable(false); + var2.add(this.setConstraints(var1, var6, var3)); + Enumeration var7 = var5.elements(); + + while(var7.hasMoreElements()) { + var6.append((String)var7.nextElement() + "\n"); + } + + var2.add(this.setConstraints(var1, new Label(Console.message("about-box-1")), var3)); + var2.add(this.setConstraints(var1, new Label(Console.message("about-box-2")), var3)); + this.okButton.setFont(bfont); + var2.add(this.setConstraints(var1, this.okButton, var3)); + this.add("Center", var2); + } + + public boolean action(Event var1, Object var2) { + return var1.target == this.okButton ? this.done(true) : false; + } + + public boolean keyDown(Event var1, int var2) { + return var2 != 27 && var2 != 10 ? super.keyDown(var1, var2) : this.done(true); + } + + public void show() { + super.show(); + this.okButton.requestFocus(); + } } diff -ruN a/1890/NET/worlds/console/ChatSavePart.java b/1890/NET/worlds/console/ChatSavePart.java --- a/1890/NET/worlds/console/ChatSavePart.java 1969-12-31 18:00:00.000000000 -0600 +++ b/1890/NET/worlds/console/ChatSavePart.java 2023-08-21 23:27:17.000000000 -0500 @@ -0,0 +1,49 @@ +package NET.worlds.console; + +import java.io.BufferedReader; +import java.io.FileWriter; +import java.io.IOException; +import java.io.StringReader; + +public class ChatSavePart implements DialogReceiver { + + String chat; + + ChatSavePart(String text) { + this.chat = text; + FileSysDialog fsd = new FileSysDialog(DefaultConsole.getFrame(), this, "Save Chat", 1, "Hypertext Markup|*.html|Plain Text|*.txt", "", false); + } + + public void dialogDone(Object var1, boolean var2) { + if (var2) { + FileSysDialog var3 = (FileSysDialog)var1; + String var4 = var3.fileName(); + this.doSave(var4); + } + } + + public boolean doSave(String path) { + try { + if (path != null) { + FileWriter textWriter = new FileWriter(path); + if (path.endsWith(".html") || path.endsWith(".htm")) { + BufferedReader bufReader = new BufferedReader(new StringReader(this.chat)); + String line = null; + while( (line = bufReader.readLine()) != null ) + { + textWriter.write(line + "
"); + } + } else { + textWriter.write(this.chat); + } + textWriter.close(); + Console.println("Saved chat!"); + return true; + } else return false; + } catch (IOException var5) { + Console.println("Failed to save chat: " + var5.getMessage()); + return false; + } + } + +} diff -ruN a/1890/NET/worlds/console/DefaultConsole.java b/1890/NET/worlds/console/DefaultConsole.java --- a/1890/NET/worlds/console/DefaultConsole.java 2023-08-21 23:27:15.000000000 -0500 +++ b/1890/NET/worlds/console/DefaultConsole.java 2023-08-21 23:27:17.000000000 -0500 @@ -1,3 +1,8 @@ +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by Fernflower decompiler) +// + package NET.worlds.console; import NET.worlds.core.ArchiveMaker; @@ -32,6 +37,9 @@ import NET.worlds.scape.URLPropertyEditor; import NET.worlds.scape.VehicleShape; import NET.worlds.scape.World; +import NET.worldsplus.ChatSaver; +import NET.worldsplus.IniUpdater; + import java.awt.BorderLayout; import java.awt.CardLayout; import java.awt.CheckboxMenuItem; @@ -68,1891 +76,2081 @@ import java.util.Vector; public class DefaultConsole extends Console implements DialogReceiver, ImageButtonsCallback, RemoteFileConst { - MenuItem aboutItem; - MenuItem statisticsItem; - MenuItem upgradeItem; - MenuItem channelItem; - MenuItem infoItem; - MenuItem sleepItem; - MenuItem helpItem; - MenuItem gettingStartedItem; - MenuItem serverItem; - MenuItem numVisItem; - MenuItem checkAccountItem; - MenuItem becomeVIPItem; - MenuItem toggleVoiceChatItem; - MenuItem shaperHelpItem; - MenuItem inventoryItem; - MenuItem proxyServerItem; - MenuItem musicManItem; - MenuItem condenseItem; - MenuItem expandItem; - MenuItem i18nTest; - MenuItem currentLang; - Menu switchLang; - Vector downItems = null; - Vector langItems = null; - Vector fontItems = null; - static final String LANGUAGES = "languages.lst"; - static final String FONTS = "fonts.lst"; - Vector viewItems = null; - Vector camSpeedItems = null; - CheckboxMenuItem currentViewItem; - CheckboxMenuItem currentCamSpeedItem; - ImageButtons driveButton; - ImageButtons quitButton; - ImageButtons exploreButton; - ImageButtons menuButtons; - String defaultAd = IniFile.override().getIniString("defaultAd", "home:adworlds.cmp"); - AdPart ad; - ChatPart chat; - RenderCanvas render; - Panel renderAndUniverse; - UniversePanel universe; - CardLayout renderCard; - InventoryPart inventory; - WorldsMarkPart marks; - FriendsListPart friends; - ActionsPart actions; - MuteListPart mutes; - MapPart map; - SavedAvPart savedAvs; - private static Font font = new Font(Console.message("ConsoleFont"), 0, 12); - private static Font mfont = new Font(Console.message("MenuFont"), 0, 12); - CDControl cdcontrol; - boolean playedCD; - MenuItem cdPlayerItem; - MenuItem volumeItem; - MenuItem graphicsItem; - MenuItem nametagItem; - MenuItem chatBoxItem; - MenuItem broadcastToRoom; - MenuItem broadcastToAll; - MenuItem bootSomeone; - CheckboxMenuItem orthographicViewItem; - MenuItem recorderPlayItem; - MenuItem recorderRecItem; - MenuItem recorderStopItem; - boolean universeMode; - private static final int[] menuButtonHeights = new int[]{23, 21, 21, 21, 21, 21, 25, -29}; - private Vector viewNames; - private Vector speedNames; - private static final int HELP = 0; - private static final int OPTIONS = 1; - private static final int WORLDSMAIL = 2; - private static final int WORLDSMARK = 3; - private static final int LETS = 4; - private static final int ACTIONS = 5; - private static final int VIP = 6; - static String loadingString = Console.message("Loading"); - static String arrowKeyMsg = Console.message("Use-arrow-keys"); - String statusMessage; - String overrideMessage; - String lastStatus; - int lastUpdateTime; - boolean wasTeleporting; - private int lastVMCheck; - private int lastVMBigWarning; - Component bottom; - Component top; - Label status; - Label yourName; - static String[] lNames = lpList(); - static int lLength; - static MenuItem[] lLangs; - static Locale[] newLocale; - static String[][] lCodes; - Vector lList; - Vector sList; - int[] lSizes; - int dLength; - MenuItem[] dLangs; - Locale[] newdLocale; - Vector flList; - Vector fsList; - int[] fSizes; - int fLength; - MenuItem[] dFonts; - Locale[] newfLocale; - static boolean wasDelta; - static boolean doDrive; - Panel mapPanel; - private static String signIn; - private static String signOut; - private static String signingIn; - private static String noMultiUser; - private static String enable3D; - private static String disable3D; - private static String showTags; - private static String hideTags; - private static String enableClassicChat; - private static String disableClassicChat; - Menu chatLogMenu; - AvMenu avatarMenu; - private int chooseView; - private int chooseCamSpeed; - private static String sleepStatus; - OkCancelDialog reloginDialog; - private Object nextAvatarMutex; - private URL nextAvatar; - private CheckboxMenuItem nextAvatarItem; - private CheckboxMenuItem curAvatarItem; - private static String lastWorldName; - private static String lowVMMsg; - private boolean showedMidWarn; - private static boolean startupMemCheck; - public static int physMem; - protected URL avatarURL; - private static Object classCookie; - - public UniversePanel getUniversePanel() { - return this.universe; - } - - public void printLine(String var1) { - this.chat.println(var1); - super.printLine(var1); - } - - protected void printWhisperFrom(String var1, String var2) { - WhisperManager.whisperManager().printFrom(var1, var2); - } - - protected void printWhisperTo(String var1, String var2) { - WhisperManager.whisperManager().printTo(var1, var2); - } - - protected void startWhisperingTo(String var1) { - WhisperManager.whisperManager().startTo(var1); - } - - public DefaultConsole() { - this.ad = new AdPart(URL.make(this.defaultAd)); - this.chat = new ChatPart(); - this.render = new RenderCanvas(this, new Dimension(560, 360)); - this.inventory = new InventoryPart(); - this.marks = new WorldsMarkPart(); - this.friends = new FriendsListPart(); - this.actions = new ActionsPart(); - this.mutes = new MuteListPart(); - this.map = new MapPart(); - this.savedAvs = new SavedAvPart(); - this.statusMessage = arrowKeyMsg; - this.lastStatus = ""; - this.lastUpdateTime = 0; - this.wasTeleporting = false; - this.status = new UnpaddedLabel("", 2); - this.yourName = new UnpaddedLabel("", 0); - this.lList = new Vector(); - this.sList = new Vector(); - this.lSizes = new int[]{0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - this.dLength = this.dpList(this.lList, this.sList, this.lSizes); - this.dLangs = this.dLength == 0 ? null : new MenuItem[this.dLength]; - this.newdLocale = this.dLength == 0 ? null : new Locale[this.dLength]; - this.flList = new Vector(); - this.fsList = new Vector(); - this.fSizes = new int[]{0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - this.fLength = this.fpList(this.flList, this.fsList, this.fSizes); - this.dFonts = this.fLength == 0 ? null : new MenuItem[this.fLength]; - this.newfLocale = this.fLength == 0 ? null : new Locale[this.fLength]; - this.chooseView = -1; - this.chooseCamSpeed = -1; - this.nextAvatarMutex = new Object(); - this.init(); - this.loadViewNames(); - this.speedNames = new Vector(); - this.speedNames.addElement(new DefaultConsole.CameraSpeed("Slow", 1)); - this.speedNames.addElement(new DefaultConsole.CameraSpeed("Medium", 2)); - this.speedNames.addElement(new DefaultConsole.CameraSpeed("Fast", 3)); - } - - public void loadViewNames() { - this.viewNames = new Vector(); - this.viewNames.addElement(new DefaultConsole.CameraView("First-person", 1)); - this.viewNames.addElement(new DefaultConsole.CameraView("Low-first-person", 2)); - this.viewNames.addElement(new DefaultConsole.CameraView("Waist", 3)); - this.viewNames.addElement(new DefaultConsole.CameraView("Shoulder", 4)); - this.viewNames.addElement(new DefaultConsole.CameraView("Head", 5)); - this.viewNames.addElement(new DefaultConsole.CameraView("Overhead", 6)); - this.viewNames.addElement(new DefaultConsole.CameraView("Behind", 7)); - this.viewNames.addElement(new DefaultConsole.CameraView("Wide-shot", 8)); - if (Gamma.getShaper() != null) { - this.viewNames.addElement(new DefaultConsole.CameraView("Orthographic", 9)); - } - - } - - public void setOrthoEnabled(boolean var1) { - if (this.orthographicViewItem != null) { - this.orthographicViewItem.setEnabled(var1); - } - - } - - public void loadInit() { - super.loadInit(); - } - - public void removeUseArrowStatusMsg() { - if (this.statusMessage == arrowKeyMsg) { - this.statusMessage = ""; - } - - } - - public void overrideStatusMsg(String var1) { - Label var2 = this.status; - synchronized(var2) { - this.overrideMessage = var1; - if (var1 != null) { - this.status.setText(var1); - } else { - this.status.setText(this.lastStatus); - } - - } - } - - public String message(String var1, Locale var2) { - Locale.setDefault(var2); - Console.println(var2.getDisplayName()); - - try { - ResourceBundle var3 = ResourceBundle.getBundle("MessagesBundle", var2); - return var3.getString(var1); - } catch (MissingResourceException var4) { - return "NO MESSAGE for " + var1; - } - } - - private void init() { - this.addPart(this.render); - this.addPart(this.chat); - this.addPart(this.inventory); - this.addPart(this.marks); - this.addPart(this.friends); - this.addPart(this.actions); - this.addPart(this.mutes); - this.addPart(this.ad); - this.addPart(this.map); - this.addPart(this.savedAvs); - Panel var1 = new Panel(new FlowLayout(1, 0, 0)); - String var2 = IniFile.override().getIniString("driveGif", "drive.gif"); - this.addPart(this.driveButton = new ImageButtons(var2, 81, 19, this)); - String var3 = IniFile.override().getIniString("quitGif", Console.message("quit.gif")); - this.addPart(this.quitButton = new ImageButtons(var3, 65, 19, this)); - String var4 = IniFile.override().getIniString("exploreGif", Console.message("explore.gif")); - this.addPart(this.exploreButton = new ImageButtons(var4, 98, 22, this)); - var1.add(this.driveButton); - this.driveButton.setDownUpHandler(new ImageButtonsCallback() { - public Object imageButtonsCallback(Component var1, int var2) { - if (var2 != -1) { - DefaultConsole.this.startDrive(); + MenuItem aboutItem; + MenuItem statisticsItem; + MenuItem upgradeItem; + MenuItem channelItem; + MenuItem infoItem; + MenuItem sleepItem; + MenuItem helpItem; + MenuItem gettingStartedItem; + MenuItem serverItem; + MenuItem numVisItem; + MenuItem checkAccountItem; + MenuItem becomeVIPItem; + MenuItem toggleVoiceChatItem; + MenuItem shaperHelpItem; + MenuItem inventoryItem; + MenuItem proxyServerItem; + MenuItem musicManItem; + MenuItem condenseItem; + MenuItem expandItem; + MenuItem i18nTest; + MenuItem currentLang; + Menu switchLang; + Vector downItems = null; + Vector langItems = null; + Vector fontItems = null; + static final String LANGUAGES = "languages.lst"; + static final String FONTS = "fonts.lst"; + Vector viewItems = null; + Vector camSpeedItems = null; + CheckboxMenuItem currentViewItem; + CheckboxMenuItem currentCamSpeedItem; + + Vector whisperItems = null; + Vector teleportItems = null; + CheckboxMenuItem currentWhisperItem; + CheckboxMenuItem currentTeleportItem; + + ImageButtons driveButton; + ImageButtons quitButton; + ImageButtons exploreButton; + ImageButtons menuButtons; + String defaultAd = IniFile.override().getIniString("defaultAd", "home:adworlds.cmp"); + AdPart ad; + ChatPart chat; + RenderCanvas render; + Panel renderAndUniverse; + UniversePanel universe; + CardLayout renderCard; + InventoryPart inventory; + WorldsMarkPart marks; + FriendsListPart friends; + ActionsPart actions; + MuteListPart mutes; + TarListPart tars; + MapPart map; + SavedAvPart savedAvs; + private static Font font = new Font(Console.message("ConsoleFont"), 0, 12); + private static Font mfont = new Font(Console.message("MenuFont"), 0, 12); + CDControl cdcontrol; + boolean playedCD; + MenuItem cdPlayerItem; + MenuItem volumeItem; + MenuItem graphicsItem; + MenuItem nametagItem; + MenuItem chatBoxItem; + MenuItem broadcastToRoom; + MenuItem broadcastToAll; + MenuItem bootSomeone; + MenuItem recorderPlayItem; + MenuItem recorderRecItem; + MenuItem recorderStopItem; + CheckboxMenuItem showWhispers; + CheckboxMenuItem showTeleports; + CheckboxMenuItem respondWhispers; + CheckboxMenuItem respondTeleports; + CheckboxMenuItem overrideWorldTeleport; + boolean universeMode; + private static final int[] menuButtonHeights = new int[]{23, 21, 21, 21, 21, 21, 25, -29}; + private Vector viewNames; + private Vector speedNames; + private Vector whisperNames; + private Vector teleportNames; + private static final int HELP = 0; + private static final int OPTIONS = 1; + private static final int WORLDSMAIL = 2; + private static final int WORLDSMARK = 3; + private static final int LETS = 4; + private static final int ACTIONS = 5; + private static final int VIP = 6; + static String loadingString = Console.message("Loading"); + static String arrowKeyMsg = Console.message("Use-arrow-keys"); + String statusMessage; + String overrideMessage; + String lastStatus; + int lastUpdateTime; + boolean wasTeleporting; + private int lastVMCheck; + private int lastVMBigWarning; + Component bottom; + Component top; + Label status; + Label yourName; + static String[] lNames = lpList(); + static int lLength; + static MenuItem[] lLangs; + static Locale[] newLocale; + static String[][] lCodes; + Vector lList; + Vector sList; + int[] lSizes; + int dLength; + MenuItem[] dLangs; + Locale[] newdLocale; + Vector flList; + Vector fsList; + int[] fSizes; + int fLength; + MenuItem[] dFonts; + Locale[] newfLocale; + static boolean wasDelta; + static boolean doDrive; + Panel mapPanel; + private static String signIn; + private static String signOut; + private static String signingIn; + private static String noMultiUser; + private static String enable3D; + private static String disable3D; + private static String showTags; + private static String hideTags; + private static String enableClassicChat; + private static String disableClassicChat; + Menu chatLogMenu; + AvMenu avatarMenu; + private int chooseView; + private int chooseCamSpeed; + private int chooseWhisper; + private int chooseTeleport; + private static String sleepStatus; + OkCancelDialog reloginDialog; + private Object nextAvatarMutex; + private URL nextAvatar; + private CheckboxMenuItem nextAvatarItem; + private CheckboxMenuItem curAvatarItem; + private static String lastWorldName; + private static String lowVMMsg; + private boolean showedMidWarn; + private static boolean startupMemCheck; + public static int physMem; + protected URL avatarURL; + private static Object classCookie; + + public UniversePanel getUniversePanel() { + return this.universe; + } + + public void printLine(String var1) { + this.chat.println(var1); + super.printLine(var1); + } + + protected void printWhisperFrom(String var1, String var2) { + WhisperManager.whisperManager().printFrom(var1, var2); + } + + protected void printWhisperTo(String var1, String var2) { + WhisperManager.whisperManager().printTo(var1, var2); + } + + protected void startWhisperingTo(String var1) { + WhisperManager.whisperManager().startTo(var1); + } + + public DefaultConsole() { + this.ad = new AdPart(URL.make(this.defaultAd)); + this.chat = new ChatPart(); + this.render = new RenderCanvas(this, new Dimension(560, 360)); + this.inventory = new InventoryPart(); + this.marks = new WorldsMarkPart(); + this.friends = new FriendsListPart(); + this.actions = new ActionsPart(); + this.mutes = new MuteListPart(); + this.tars = new TarListPart(); + this.map = new MapPart(); + this.savedAvs = new SavedAvPart(); + this.statusMessage = arrowKeyMsg; + this.lastStatus = ""; + this.lastUpdateTime = 0; + this.wasTeleporting = false; + this.status = new UnpaddedLabel("", 2); + this.yourName = new UnpaddedLabel("", 0); + this.lList = new Vector(); + this.sList = new Vector(); + this.lSizes = new int[]{0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + this.dLength = this.dpList(this.lList, this.sList, this.lSizes); + this.dLangs = this.dLength == 0 ? null : new MenuItem[this.dLength]; + this.newdLocale = this.dLength == 0 ? null : new Locale[this.dLength]; + this.flList = new Vector(); + this.fsList = new Vector(); + this.fSizes = new int[]{0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + this.fLength = this.fpList(this.flList, this.fsList, this.fSizes); + this.dFonts = this.fLength == 0 ? null : new MenuItem[this.fLength]; + this.newfLocale = this.fLength == 0 ? null : new Locale[this.fLength]; + this.chooseView = -1; + this.chooseCamSpeed = -1; + this.chooseWhisper = -1; + this.chooseTeleport = -1; + this.nextAvatarMutex = new Object(); + new ChatSaver(); + this.init(); + this.loadViewNames(); + this.loadSpeedNames(); + this.loadWhisperNames(); + this.loadTeleportNames(); + } + + public void loadSpeedNames() { + this.speedNames = new Vector(); + this.speedNames.addElement(new DefaultConsole.CameraSpeed("Slow", 1)); + this.speedNames.addElement(new DefaultConsole.CameraSpeed("Medium", 2)); + this.speedNames.addElement(new DefaultConsole.CameraSpeed("Fast", 3)); + this.speedNames.addElement(new DefaultConsole.CameraSpeed("Very Fast", 4)); + } + + public void loadViewNames() { + this.viewNames = new Vector(); + this.viewNames.addElement(new DefaultConsole.CameraView("First-person", 1)); + this.viewNames.addElement(new DefaultConsole.CameraView("Low-first-person", 2)); + this.viewNames.addElement(new DefaultConsole.CameraView("Waist", 3)); + this.viewNames.addElement(new DefaultConsole.CameraView("Shoulder", 4)); + this.viewNames.addElement(new DefaultConsole.CameraView("Head", 5)); + this.viewNames.addElement(new DefaultConsole.CameraView("Overhead", 6)); + this.viewNames.addElement(new DefaultConsole.CameraView("Behind", 7)); + this.viewNames.addElement(new DefaultConsole.CameraView("Wide-shot", 8)); + this.viewNames.addElement(new DefaultConsole.CameraView("Orthographic", 9)); + } + + public void loadWhisperNames() { + this.whisperNames = new Vector(); + this.whisperNames.addElement(new DefaultConsole.WhisperPrivacy("Everyone", 0)); + this.whisperNames.addElement(new DefaultConsole.WhisperPrivacy("Friends", 1)); + this.whisperNames.addElement(new DefaultConsole.WhisperPrivacy("No one", 2)); + } + + public void loadTeleportNames() { + this.teleportNames = new Vector(); + this.teleportNames.addElement(new DefaultConsole.TeleportPrivacy("Everyone", 0)); + this.teleportNames.addElement(new DefaultConsole.TeleportPrivacy("Friends", 1)); + this.teleportNames.addElement(new DefaultConsole.TeleportPrivacy("No one", 2)); + } + + public void setOrthoEnabled(boolean var1) { + + } + + public void loadInit() { + super.loadInit(); + } + + public void removeUseArrowStatusMsg() { + if (this.statusMessage.equals(arrowKeyMsg)) { + this.statusMessage = ""; + } + + } + + public void overrideStatusMsg(String var1) { + synchronized(this.status) { + this.overrideMessage = var1; + if (var1 != null) { + this.status.setText(var1); } else { - DefaultConsole.this.driveButton.drawDown(); + this.status.setText(this.lastStatus); } - return this; - } - }); - Panel var5 = new Panel(); - var5.setLayout(new GridLayout(1, 3)); - int var6 = IniFile.override().getIniInt("uiBackgroundRed", 49); - int var7 = IniFile.override().getIniInt("uiBackgroundGreen", 0); - int var8 = IniFile.override().getIniInt("uiBackgroundBlue", 255); - var5.setBackground(new Color(var6, var7, var8)); - var5.add(this.yourName); - var5.add(var1); - var5.add(this.status); - this.chat.line.setBackground(Color.black); - this.chat.line.setForeground(Color.white); - this.chat.line.setFont(font); - InsetPanel var9 = new InsetPanel(new BorderLayout(0, 3), 0, 0, 3, 0); - var9.add("North", var5); - var9.add("Center", this.chat.listen.getComponent()); - var9.add("South", this.chat.line); - this.chat.listen.setBackground(Color.black); - this.chat.listen.setForeground(Color.white); - this.chat.listen.setFont(font); - Panel var10 = new Panel(new BorderLayout()); - new Panel(new BorderLayout()); - Panel var12 = new Panel(new BorderLayout()); - Panel var13 = new Panel(new BorderLayout()); - ColorFiller var14 = new ColorFiller(65, 19); - var14.setBackground(new Color(var6, var7, var8)); - var12.add("West", this.quitButton); - var12.add("East", var14); - var13.add("North", var12); - var13.add("Center", this.ad); - var10.add("West", var13); - this.mapPanel = new Panel(new BorderLayout()); - this.mapPanel.add("Center", this.map); - this.mapPanel.setBackground(Color.black); - var12 = new Panel(new BorderLayout()); - ColorFiller var15 = new ColorFiller(60, 19); - var15.setBackground(new Color(var6, var7, var8)); - var12.add("North", var15); - ColorFiller var16 = new ColorFiller(60, 3); - int var17 = IniFile.override().getIniInt("uiBackground2Red", 0); - int var18 = IniFile.override().getIniInt("uiBackground2Green", 0); - int var19 = IniFile.override().getIniInt("uiBackground2Blue", 0); - var16.setBackground(new Color(var17, var18, var19)); - var12.add("South", var16); - Panel var11 = new Panel(new BorderLayout()); - var11.add("East", this.exploreButton); - var11.add("West", var12); - this.mapPanel.add("North", var11); - var10.add("East", this.mapPanel); - var10.add("Center", var9); - this.bottom = var10; - this.renderCard = new CardLayout(); - this.renderAndUniverse = new Panel(this.renderCard); - this.renderAndUniverse.add("render", this.render); - InsetPanel var20 = new InsetPanel(new BorderLayout(), 3, 3, 0, 0); - var20.add("Center", this.renderAndUniverse); - int var21 = IniFile.override().getIniInt("uiBackground3Red", 0); - int var22 = IniFile.override().getIniInt("uiBackground3Green", 0); - int var23 = IniFile.override().getIniInt("uiBackground3Blue", 0); - var14 = new ColorFiller(97, 1); - var14.setBackground(new Color(var21, var22, var23)); - Panel var24 = new Panel(new QuantizedStackedLayout(var14)); - String var25 = IniFile.override().getIniString("rtPanel", Console.message("rtpanel.gif")); - this.addPart(this.menuButtons = new ImageButtons(var25, 97, menuButtonHeights, this)); - var24.add(var14); - var24.add(this.menuButtons); - var24.add(this.friends); - var20.add("East", var24); - this.top = var20; - } - - public void relayoutMap() { - this.mapPanel.invalidate(); - this.mapPanel.validate(); - this.mapPanel.doLayout(); - this.mapPanel.repaint(); - } - - public void startDrive() { - this.statusMessage = Console.message("Drag-mouse"); - doDrive = true; - Window.makeJavaReleaseCapture(); - } - - public void setOnlineState(boolean var1, boolean var2) { - synchronized(this) { - if (this.serverItem != null) { - this.serverItem.setEnabled(var1); - if (!var1) { - Galaxy var4 = this.getGalaxy(); - if (var4 != null && !var4.isAnonymous()) { - this.serverItem.setLabel(signingIn); - } else { - this.serverItem.setLabel(noMultiUser); - } - } else if (var2) { - this.serverItem.setLabel(signOut); - } else { - this.serverItem.setLabel(signIn); - } - } + } + } - } - } - - private void handleNametagsItem() { - if (IniFile.gamma().getIniInt("SHOWNAMETAGS", 1) == 0) { - IniFile.gamma().setIniInt("SHOWNAMETAGS", 1); - this.nametagItem.setLabel(hideTags); - } else { - IniFile.gamma().setIniInt("SHOWNAMETAGS", 0); - this.nametagItem.setLabel(showTags); - } - - new OkCancelDialog(Console.getFrame(), (DialogReceiver)null, Console.message("Alert"), (String)null, Console.message("OK"), Console.message("Change-exit"), true); - } - - private void handleGraphicsItem() { - if (IniFile.gamma().getIniInt("UserEnabled3DHardware", 0) == 0) { - IniFile.gamma().setIniInt("UserEnabled3DHardware", 1); - this.graphicsItem.setLabel(disable3D); - } else { - IniFile.gamma().setIniInt("UserEnabled3DHardware", 0); - this.graphicsItem.setLabel(enable3D); - } - - new OkCancelDialog(Console.getFrame(), (DialogReceiver)null, Console.message("Alert"), (String)null, Console.message("OK"), Console.message("Change-exit"), true); - } - - private void handleChatBoxItem() { - if (IniFile.gamma().getIniInt("classicChatBox", 1) == 0) { - IniFile.gamma().setIniInt("classicChatBox", 1); - this.chatBoxItem.setLabel(disableClassicChat); - } else { - IniFile.gamma().setIniInt("classicChatBox", 0); - this.chatBoxItem.setLabel(enableClassicChat); - } - - new OkCancelDialog(Console.getFrame(), (DialogReceiver)null, Console.message("Alert"), (String)null, Console.message("OK"), Console.message("Change-exit"), true); - } - - public AvMenu getAvatarMenu() { - return this.avatarMenu; - } - - public void inventoryChanged() { - super.inventoryChanged(); - if (this.avatarMenu != null) { - this.avatarMenu.buildSpecialGuestMenu(); - } - - } - - public void setMenusWRTVIP() { - if (this.avatarMenu != null) { - this.avatarMenu.setEnabled(this.getVIP()); - this.avatarMenu.customize.setEnabled(this.getVIP()); - } - - if (this.savedAvs != null) { - this.savedAvs.setEnabled(this.getVIP()); - } - - if (this.chatLogMenu != null) { - this.chatLogMenu.setEnabled(this.getVIP()); - } - - if (this.toggleVoiceChatItem != null) { - this.toggleVoiceChatItem.setLabel(this.getVIP() && VoiceChat.voiceChatEnabled ? Console.message("Reject-Voice") : Console.message("Accept-Voice")); - this.toggleVoiceChatItem.setEnabled(this.getVIP() && VoiceChat.voiceChatAvailable()); - } - - if (this.becomeVIPItem != null) { - this.becomeVIPItem.setLabel(Console.vip > 0 ? (Console.vip > 1 ? Console.message("Youre-a-VIP") : Console.message("Become-full-VIP")) : Console.message("Become-VIP")); - } - - if (this.numVisItem != null) { - this.numVisItem.setEnabled(this.getVIP()); - } - - } - - public void addBroadcastMenu() { - if (this.bootSomeone == null) { - if (IniFile.gamma().getIniInt("Broadcast", 0) != 0) { - Menu var1 = new Menu(Console.message("Broadcast")); - var1.add(this.broadcastToRoom = new MenuItem(Console.message("Users"))); - var1.add(this.broadcastToAll = new MenuItem(Console.message("All-users"))); - this.addMenuItem((MenuItem)var1, "Options"); - } - - this.bootSomeone = new MenuItem(Console.message("Boot-user")); - this.addMenuItem(this.bootSomeone, "Options"); - } - - } - - private Menu updateChatLogMenu() { - if (this.chatLogMenu == null) { - this.chatLogMenu = new Menu(Console.message("View-Chat")); - } else { - this.chatLogMenu.removeAll(); - } - - ActionListener var1 = new ActionListener() { - public void actionPerformed(ActionEvent var1) { - (new SendURLAction("file:" + var1.getActionCommand())).startBrowser(); - } - }; - String[] var2 = this.logList(); - MenuItem var3 = null; - - for(int var4 = 0; var4 < var2.length; ++var4) { - int var5 = var2[var4].indexOf(".glog.html"); - if (var5 > 6) { - Object[] var6 = new Object[]{new String(var2[var4].substring(5, var5))}; - var3 = new MenuItem(MessageFormat.format(Console.message("Chat-with"), var6)); - } else { - if (var5 <= 0) { - continue; - } - - var3 = new MenuItem(Console.message("General-chat")); - } - - var3.setActionCommand(var2[var4]); - var3.addActionListener(var1); - this.chatLogMenu.add(var3); - } - - return this.chatLogMenu; - } - - private String[] logList() { - File var1 = new File("."); - FilenameFilter var2 = new FilenameFilter() { - public boolean accept(File var1, String var2) { - return var2.startsWith("chat.") && var2.endsWith(".glog.html"); - } - }; - return var1.list(var2); - } - - private static String[] lpList() { - File var0 = new File("."); - FilenameFilter var1 = new FilenameFilter() { - public boolean accept(File var1, String var2) { - return var2.startsWith("MessagesBundle") && var2.endsWith(".properties"); - } - }; - String[] var2 = var0.list(var1); - Collator var3 = Collator.getInstance(); - sortStrings(var3, var2); - return var2; - } - - private int dpList(Vector var1, Vector var2, int[] var3) { - String var4 = NetUpdate.getLanguages(URL.make(NetUpdate.getUpgradeServerURL() + "I18N/" + "languages.lst"), var1, var2, var3); - if (var4 != null) { - System.out.println(var4); - return 0; - } else { - return var1.size(); - } - } - - private int fpList(Vector var1, Vector var2, int[] var3) { - String var4 = NetUpdate.getLanguages(URL.make(NetUpdate.getUpgradeServerURL() + "I18N/" + "fonts.lst"), var1, var2, var3); - if (var4 != null) { - System.out.println(var4); - return 0; - } else { - return var1.size(); - } - } - - public static void sortStrings(Collator var0, String[] var1, Locale[] var2, String[][] var3) { - for(int var8 = 0; var8 < var1.length; ++var8) { - for(int var9 = var8 + 1; var9 < var1.length; ++var9) { - if (var0.compare(var1[var8], var1[var9]) > 0) { - String var4 = var1[var8]; - Locale var5 = var2[var8]; - String var6 = var3[var8][0]; - String var7 = var3[var8][1]; - var1[var8] = var1[var9]; - var2[var8] = var2[var9]; - var3[var8][0] = var3[var9][0]; - var3[var8][1] = var3[var9][1]; - var1[var9] = var4; - var2[var9] = var5; - var3[var9][0] = var6; - var3[var9][1] = var7; - } - } - } - - } - - public static void sortStrings(Collator var0, String[] var1, Locale[] var2, Vector var3, Vector var4) { - for(int var9 = 0; var9 < var1.length; ++var9) { - for(int var10 = var9 + 1; var10 < var1.length; ++var10) { - if (var0.compare(var1[var9], var1[var10]) > 0) { - String var5 = var1[var9]; - Locale var6 = var2[var9]; - String var7 = (String)var3.elementAt(var9); - String var8 = (String)var4.elementAt(var9); - var1[var9] = var1[var10]; - var2[var9] = var2[var10]; - var3.setElementAt(var3.elementAt(var10), var9); - var4.setElementAt(var4.elementAt(var10), var9); - var1[var10] = var5; - var2[var10] = var6; - var3.setElementAt(var7, var10); - var4.setElementAt(var8, var10); - } - } - } - - } - - public static void sortStrings(Collator var0, String[] var1) { - for(int var3 = 0; var3 < var1.length; ++var3) { - for(int var4 = var3 + 1; var4 < var1.length; ++var4) { - if (var0.compare(var1[var3], var1[var4]) > 0) { - String var2 = var1[var3]; - var1[var3] = var1[var4]; - var1[var4] = var2; - } - } - } - - } - - public void activate(Container var1) { - super.activate(var1); - var1.setBackground(Color.black); - var1.setForeground(Color.white); - var1.setLayout(new BorderLayout()); - var1.add("Center", this.top); - var1.add("South", this.bottom); - this.chat.line.setBackground(Color.white); - this.chat.line.setForeground(Color.black); - boolean var2 = Gamma.getShaper() != null; - if (var2) { - this.shaperHelpItem = this.addMenuItem(Console.message("using-shaper"), "Help"); - } - - if (NetUpdate.getInfoURL() != null) { - this.helpItem = this.addMenuItem(Console.message("Help-Contents"), "Help"); - this.infoItem = this.addMenuItem(Console.message("Latest-info"), "Help"); - } - - Object[] var3 = new Object[]{new String(Std.getProductName())}; - this.aboutItem = this.addMenuItem(MessageFormat.format(Console.message("About-product"), var3), "Help"); - int var4 = IniFile.gamma().getIniInt("CAM_MODE", 7); - int var5 = IniFile.gamma().getIniInt("CAM_SPEED", 3); - if (!var2 && var4 == 9) { - var4 = 7; - } - - super.pilot.setOutsideCameraMode(var4, var5); - Menu var6 = new Menu(Console.message("Change-View")); - this.addMenuItem((MenuItem)var6, "Options"); - MenuItem var7 = new MenuItem(Console.message("CAMERA-VIEW")); - var7.setFont(mfont); - var6.add(var7); - this.viewItems = new Vector(); - - for(int var8 = 0; var8 < this.viewNames.size(); ++var8) { - DefaultConsole.CameraView var9 = (DefaultConsole.CameraView)this.viewNames.elementAt(var8); - CheckboxMenuItem var10 = new CheckboxMenuItem(" " + Console.message(var9.viewName), var4 == var9.viewID); - if (var4 == var9.viewID) { - this.currentViewItem = var10; - } - - var10.setFont(mfont); - var6.add(var10); - this.viewItems.addElement(var10); - if (var9.viewName == "Orthographic") { - this.orthographicViewItem = var10; - } - } - - var6.addSeparator(); - MenuItem var31 = new MenuItem(Console.message("CAMERA-SPEED")); - var31.setFont(mfont); - var6.add(var31); - this.camSpeedItems = new Vector(); - - for(int var32 = 0; var32 < this.speedNames.size(); ++var32) { - DefaultConsole.CameraSpeed var11 = (DefaultConsole.CameraSpeed)this.speedNames.elementAt(var32); - CheckboxMenuItem var12 = new CheckboxMenuItem(" " + Console.message(var11.speedName), var11.speedID == var5); - if (var11.speedID == var5) { - this.currentCamSpeedItem = var12; - } - - var12.setFont(mfont); - var6.add(var12); - this.camSpeedItems.addElement(var12); - } - - this.becomeVIPItem = this.addMenuItem(Console.vip == 1 ? Console.message("Become-full-VIP") : Console.message("Become-VIP"), "VIP"); - this.addMenuItem((MenuItem)(this.avatarMenu = new AvMenu(this, super.lastPilotRequested)), "VIP"); - this.addMenuItem((MenuItem)this.savedAvs, "VIP"); - this.addMenuItem(this.avatarMenu.customize, "VIP"); - this.toggleVoiceChatItem = this.addMenuItem(Console.message("Enable-Voice"), "VIP"); - this.toggleVoiceChatItem.setEnabled(false); - this.numVisItem = this.addMenuItem(Console.message("Num-Visible"), "VIP"); - if (NetUpdate.isInternalVersion()) { - this.inventoryItem = this.addMenuItem("Check Inventory", "VIP"); - } - - this.setMenusWRTVIP(); - this.proxyServerItem = this.addMenuItem(Console.message("Proxy-Server"), "Options"); - this.checkAccountItem = this.addMenuItem(Console.message("Account-Info"), "Options"); - if (var2) { - this.statisticsItem = this.addMenuItem(Console.message("Display-Stat"), "Options"); - } - - this.upgradeItem = this.addMenuItem(Console.message("Upgrade-Now"), "Options"); - if (var2) { - this.channelItem = this.addMenuItem(Console.message("Dimension-Sel"), "Options"); - } - - this.serverItem = this.addMenuItem(signIn, "Options"); - this.setOnlineState(super.galaxy.getOnlineEnabled(), super.galaxy.getOnline()); - Menu var33; - if (IniFile.gamma().getIniInt("recorderEnabled", 1) == 1) { - var33 = new Menu(Console.message("Recorder")); - this.addMenuItem((MenuItem)var33, "Options"); - this.recorderRecItem = new MenuItem(Console.message("Record")); - var33.add(this.recorderRecItem); - this.recorderStopItem = new MenuItem(Console.message("Stop")); - var33.add(this.recorderStopItem); - this.recorderPlayItem = new MenuItem(Console.message("Play")); - var33.add(this.recorderPlayItem); - } - - if (NetUpdate.isInternalVersion()) { - var33 = new Menu(Console.message("Languages")); - this.addMenuItem((MenuItem)var33, "Options"); - Menu var34 = new Menu(Console.message("Download-Font")); - var33.add(var34); - var34.setFont(mfont); - this.fontItems = new Vector(); - - for(int var13 = 0; var13 < this.fLength; ++var13) { - if (this.flList.elementAt(var13) != null) { - String var14; - if (this.fsList.elementAt(var13) != null) { - this.newfLocale[var13] = new Locale((String)this.flList.elementAt(var13), (String)this.fsList.elementAt(var13)); - var14 = (String)this.flList.elementAt(var13) + "_" + (String)this.fsList.elementAt(var13); - if (var14.equals(Console.message(var14))) { - this.dFonts[var13] = new MenuItem(this.newfLocale[var13].getDisplayName()); - } else { - this.dFonts[var13] = new MenuItem(Console.message(var14)); - } - } else { - var14 = (String)this.flList.elementAt(var13); - if (var14.equals(Console.message(var14))) { - this.dFonts[var13] = new MenuItem((String)this.flList.elementAt(var13)); - } else { - this.dFonts[var13] = new MenuItem(Console.message(var14)); - } - } - - this.dFonts[var13].setFont(mfont); - var34.add(this.dFonts[var13]); - this.fontItems.addElement(this.dFonts[var13]); - } - } - - Menu var35 = new Menu(Console.message("Download-Language")); - var33.add(var35); - var35.setFont(mfont); - this.downItems = new Vector(); - String[] var15 = new String[this.dLength]; - - String var24; - for(int var16 = 0; var16 < this.dLength; ++var16) { - if (this.lList.elementAt(var16) != null) { - this.newdLocale[var16] = new Locale((String)this.lList.elementAt(var16), (String)this.sList.elementAt(var16)); - String var18; - if (var16 > 0) { - Locale var21 = new Locale((String)this.lList.elementAt(var16 - 1), (String)this.sList.elementAt(var16 - 1)); - var18 = var21.getDisplayName(); - } else { - var18 = this.newdLocale[var16].getDisplayName(); - } - - String var19 = this.newdLocale[var16].getDisplayName(); - var19 = var19.substring(0, var19.indexOf(40) - 1); - String var17; - if (var16 < this.dLength - 1) { - Locale var23 = new Locale((String)this.lList.elementAt(var16 + 1), (String)this.sList.elementAt(var16 + 1)); - String var20 = var23.getDisplayName(); - var20 = var20.substring(0, var20.indexOf(40) - 1); - if (var20.equals(var19)) { - var17 = this.newdLocale[var16].getDisplayName(); - } else { - var17 = var19; - } - } else if (var16 == this.dLength - 1) { - var18 = var18.substring(0, var18.indexOf(40) - 1); - if (var19.equals(var18)) { - var17 = this.newdLocale[var16].getDisplayName(); - } else { - var17 = var19; - } - } else if (var15[var16 - 1].equals(var19)) { - var17 = this.newdLocale[var16].getDisplayName(); - } else { - var17 = var19; - } - - var24 = (String)this.lList.elementAt(var16) + "_" + (String)this.sList.elementAt(var16); - if (var24.equals(Console.message(var24))) { - var15[var16] = var17; - } else { - var15[var16] = Console.message(var24); - } - } - } - - Collator var36 = Collator.getInstance(); - sortStrings(var36, var15, this.newdLocale, this.lList, this.sList); - - for(int var37 = 0; var37 < this.dLength; ++var37) { - this.dLangs[var37] = new MenuItem(var15[var37]); - this.dLangs[var37].setFont(mfont); - var35.add(this.dLangs[var37]); - this.downItems.addElement(this.dLangs[var37]); - } - - Menu var38 = new Menu(Console.message("Switch-Language")); - var33.add(var38); - var38.setFont(mfont); - this.langItems = new Vector(); - - int var22; - for(int var39 = 0; var39 < lLength; ++var39) { - int var40 = lNames[var39].indexOf(95); - if (var40 < 0) { - lCodes[var39][0] = "en"; - lCodes[var39][1] = "US"; + public String message(String var1, Locale var2) { + Locale.setDefault(var2); + Console.println(var2.getDisplayName()); + + try { + ResourceBundle var3 = ResourceBundle.getBundle("MessagesBundle", var2); + return var3.getString(var1); + } catch (MissingResourceException var4) { + return "NO MESSAGE for " + var1; + } + } + + private void init() { + this.addPart(this.render); + this.addPart(this.chat); + this.addPart(this.inventory); + this.addPart(this.marks); + this.addPart(this.friends); + this.addPart(this.actions); + this.addPart(this.mutes); + this.addPart(this.tars); + this.addPart(this.ad); + this.addPart(this.map); + this.addPart(this.savedAvs); + Panel var1 = new Panel(new FlowLayout(1, 0, 0)); + String var2 = IniFile.override().getIniString("driveGif", "drive.gif"); + this.addPart(this.driveButton = new ImageButtons(var2, 81, 19, this)); + String var3 = IniFile.override().getIniString("quitGif", Console.message("quit.gif")); + this.addPart(this.quitButton = new ImageButtons(var3, 65, 19, this)); + String var4 = IniFile.override().getIniString("exploreGif", Console.message("explore.gif")); + this.addPart(this.exploreButton = new ImageButtons(var4, 98, 22, this)); + var1.add(this.driveButton); + this.driveButton.setDownUpHandler(new ImageButtonsCallback() { + public Object imageButtonsCallback(Component var1, int var2) { + if (var2 != -1) { + DefaultConsole.this.startDrive(); + } else { + DefaultConsole.this.driveButton.drawDown(); + } + + return this; + } + }); + Panel var5 = new Panel(); + var5.setLayout(new GridLayout(1, 3)); + int var6 = IniFile.override().getIniInt("uiBackgroundRed", 49); + int var7 = IniFile.override().getIniInt("uiBackgroundGreen", 0); + int var8 = IniFile.override().getIniInt("uiBackgroundBlue", 255); + var5.setBackground(new Color(var6, var7, var8)); + var5.add(this.yourName); + var5.add(var1); + var5.add(this.status); + this.chat.line.setBackground(Color.black); + this.chat.line.setForeground(Color.white); + this.chat.line.setFont(font); + InsetPanel var9 = new InsetPanel(new BorderLayout(0, 3), 0, 0, 3, 0); + var9.add("North", var5); + var9.add("Center", this.chat.listen.getComponent()); + var9.add("South", this.chat.line); + this.chat.listen.setBackground(Color.black); + this.chat.listen.setForeground(Color.white); + this.chat.listen.setFont(font); + Panel var10 = new Panel(new BorderLayout()); + new Panel(new BorderLayout()); + Panel var12 = new Panel(new BorderLayout()); + Panel var13 = new Panel(new BorderLayout()); + ColorFiller var14 = new ColorFiller(65, 19); + var14.setBackground(new Color(var6, var7, var8)); + var12.add("West", this.quitButton); + var12.add("East", var14); + var13.add("North", var12); + var13.add("Center", this.ad); + var10.add("West", var13); + this.mapPanel = new Panel(new BorderLayout()); + this.mapPanel.add("Center", this.map); + this.mapPanel.setBackground(Color.black); + var12 = new Panel(new BorderLayout()); + ColorFiller var15 = new ColorFiller(60, 19); + var15.setBackground(new Color(var6, var7, var8)); + var12.add("North", var15); + ColorFiller var16 = new ColorFiller(60, 3); + int var17 = IniFile.override().getIniInt("uiBackground2Red", 0); + int var18 = IniFile.override().getIniInt("uiBackground2Green", 0); + int var19 = IniFile.override().getIniInt("uiBackground2Blue", 0); + var16.setBackground(new Color(var17, var18, var19)); + var12.add("South", var16); + Panel var11 = new Panel(new BorderLayout()); + var11.add("East", this.exploreButton); + var11.add("West", var12); + this.mapPanel.add("North", var11); + var10.add("East", this.mapPanel); + var10.add("Center", var9); + this.bottom = var10; + this.renderCard = new CardLayout(); + this.renderAndUniverse = new Panel(this.renderCard); + this.renderAndUniverse.add("render", this.render); + InsetPanel var20 = new InsetPanel(new BorderLayout(), 3, 3, 0, 0); + var20.add("Center", this.renderAndUniverse); + int var21 = IniFile.override().getIniInt("uiBackground3Red", 0); + int var22 = IniFile.override().getIniInt("uiBackground3Green", 0); + int var23 = IniFile.override().getIniInt("uiBackground3Blue", 0); + var14 = new ColorFiller(97, 1); + var14.setBackground(new Color(var21, var22, var23)); + Panel var24 = new Panel(new QuantizedStackedLayout(var14)); + String var25 = IniFile.override().getIniString("rtPanel", Console.message("rtpanel.gif")); + this.addPart(this.menuButtons = new ImageButtons(var25, 97, menuButtonHeights, this)); + var24.add(var14); + var24.add(this.menuButtons); + var24.add(this.friends); + var20.add("East", var24); + this.top = var20; + } + + public void relayoutMap() { + this.mapPanel.invalidate(); + this.mapPanel.validate(); + this.mapPanel.doLayout(); + this.mapPanel.repaint(); + } + + public void startDrive() { + this.statusMessage = Console.message("Drag-mouse"); + doDrive = true; + Window.makeJavaReleaseCapture(); + } + + public void setOnlineState(boolean var1, boolean var2) { + synchronized(this) { + if (this.serverItem != null) { + this.serverItem.setEnabled(var1); + if (!var1) { + Galaxy var4 = this.getGalaxy(); + if (var4 != null && !var4.isAnonymous()) { + this.serverItem.setLabel(signingIn); + } else { + this.serverItem.setLabel(noMultiUser); + } + } else if (var2) { + this.serverItem.setLabel(signOut); + } else { + this.serverItem.setLabel(signIn); + } + } + + } + } + + private void handleNametagsItem() { + if (IniFile.gamma().getIniInt("SHOWNAMETAGS", 1) == 0) { + IniFile.gamma().setIniInt("SHOWNAMETAGS", 1); + this.nametagItem.setLabel(hideTags); + } else { + IniFile.gamma().setIniInt("SHOWNAMETAGS", 0); + this.nametagItem.setLabel(showTags); + } + + new OkCancelDialog(getFrame(), (DialogReceiver)null, Console.message("Alert"), (String)null, Console.message("OK"), Console.message("Change-exit"), true); + } + + private void handleGraphicsItem() { + if (IniFile.gamma().getIniInt("UserEnabled3DHardware", 0) == 0) { + IniFile.gamma().setIniInt("UserEnabled3DHardware", 1); + this.graphicsItem.setLabel(disable3D); + } else { + IniFile.gamma().setIniInt("UserEnabled3DHardware", 0); + this.graphicsItem.setLabel(enable3D); + } + + new OkCancelDialog(getFrame(), (DialogReceiver)null, Console.message("Alert"), (String)null, Console.message("OK"), Console.message("Change-exit"), true); + } + + private void handleChatBoxItem() { + if (IniFile.gamma().getIniInt("classicChatBox", 1) == 0) { + IniFile.gamma().setIniInt("classicChatBox", 1); + this.chatBoxItem.setLabel(disableClassicChat); + } else { + IniFile.gamma().setIniInt("classicChatBox", 0); + this.chatBoxItem.setLabel(enableClassicChat); + } + + new OkCancelDialog(getFrame(), (DialogReceiver)null, Console.message("Alert"), (String)null, Console.message("OK"), Console.message("Change-exit"), true); + } + + public AvMenu getAvatarMenu() { + return this.avatarMenu; + } + + public void inventoryChanged() { + super.inventoryChanged(); + if (this.avatarMenu != null) { + this.avatarMenu.buildSpecialGuestMenu(); + } + + } + + public void setMenusWRTVIP() { + if (this.avatarMenu != null) { + this.avatarMenu.setEnabled(this.getVIP()); + this.avatarMenu.customize.setEnabled(this.getVIP()); + } + + if (this.savedAvs != null) { + this.savedAvs.setEnabled(this.getVIP()); + } + + if (this.chatLogMenu != null) { + this.chatLogMenu.setEnabled(this.getVIP()); + } + + if (this.toggleVoiceChatItem != null) { + this.toggleVoiceChatItem.setLabel(this.getVIP() && VoiceChat.voiceChatEnabled ? Console.message("Reject-Voice") : Console.message("Accept-Voice")); + this.toggleVoiceChatItem.setEnabled(this.getVIP() && VoiceChat.voiceChatAvailable()); + } + + if (this.becomeVIPItem != null) { + this.becomeVIPItem.setLabel(vip > 0 ? (vip > 1 ? Console.message("Youre-a-VIP") : Console.message("Become-full-VIP")) : Console.message("Become-VIP")); + } + + if (this.numVisItem != null) { + this.numVisItem.setEnabled(this.getVIP()); + } + + } + + public void addBroadcastMenu() { + if (this.bootSomeone == null) { + if (IniFile.gamma().getIniInt("Broadcast", 0) != 0) { + Menu var1 = new Menu(Console.message("Broadcast")); + var1.add(this.broadcastToRoom = new MenuItem(Console.message("Users"))); + var1.add(this.broadcastToAll = new MenuItem(Console.message("All-users"))); + this.addMenuItem(var1, "Options"); + } + + this.bootSomeone = new MenuItem(Console.message("Boot-user")); + this.addMenuItem(this.bootSomeone, "Options"); + } + + } + + private Menu updateChatLogMenu() { + if (this.chatLogMenu == null) { + this.chatLogMenu = new Menu(Console.message("View-Chat")); + } else { + this.chatLogMenu.removeAll(); + } + + ActionListener var1 = new ActionListener() { + public void actionPerformed(ActionEvent var1) { + (new SendURLAction("file:" + var1.getActionCommand())).startBrowser(); + } + }; + String[] var2 = this.logList(); + MenuItem var3 = null; + + for(int var4 = 0; var4 < var2.length; ++var4) { + int var5 = var2[var4].indexOf(".glog.html"); + if (var5 > 6) { + Object[] var6 = new Object[]{new String(var2[var4].substring(5, var5))}; + var3 = new MenuItem(MessageFormat.format(Console.message("Chat-with"), var6)); } else { - var22 = lNames[var39].lastIndexOf(46); - if (var22 < 0) { - var22 = 0; - } - - lCodes[var39][0] = lNames[var39].substring(var40 + 1, var40 + 3); - if (var22 > var40 + 4) { - lCodes[var39][1] = lNames[var39].substring(var40 + 4, var22); - } else { - lCodes[var39][1] = lCodes[var39][0].toUpperCase(); - } - } - } - - String[] var41 = new String[lLength]; - - for(var22 = 0; var22 < lLength; ++var22) { - newLocale[var22] = new Locale(lCodes[var22][0], lCodes[var22][1]); - if (var22 > 0) { - Locale var27 = new Locale(lCodes[var22 - 1][0], lCodes[var22 - 1][1]); - var24 = var27.getDisplayName(); + if (var5 <= 0) { + continue; + } + + var3 = new MenuItem(Console.message("General-chat")); + } + + var3.setActionCommand(var2[var4]); + var3.addActionListener(var1); + this.chatLogMenu.add(var3); + } + + return this.chatLogMenu; + } + + private String[] logList() { + File var1 = new File("."); + FilenameFilter var2 = new FilenameFilter() { + public boolean accept(File var1, String var2) { + return var2.startsWith("chat.") && var2.endsWith(".glog.html"); + } + }; + return var1.list(var2); + } + + private static String[] lpList() { + File var0 = new File("."); + FilenameFilter var1 = new FilenameFilter() { + public boolean accept(File var1, String var2) { + return var2.startsWith("MessagesBundle") && var2.endsWith(".properties"); + } + }; + String[] var2 = var0.list(var1); + Collator var3 = Collator.getInstance(); + sortStrings(var3, var2); + return var2; + } + + private int dpList(Vector var1, Vector var2, int[] var3) { + String var4 = NetUpdate.getLanguages(URL.make(NetUpdate.getUpgradeServerURL() + "I18N/" + "languages.lst"), var1, var2, var3); + if (var4 != null) { + System.out.println(var4); + return 0; + } else { + return var1.size(); + } + } + + private int fpList(Vector var1, Vector var2, int[] var3) { + String var4 = NetUpdate.getLanguages(URL.make(NetUpdate.getUpgradeServerURL() + "I18N/" + "fonts.lst"), var1, var2, var3); + if (var4 != null) { + System.out.println(var4); + return 0; + } else { + return var1.size(); + } + } + + public static void sortStrings(Collator var0, String[] var1, Locale[] var2, String[][] var3) { + for(int var8 = 0; var8 < var1.length; ++var8) { + for(int var9 = var8 + 1; var9 < var1.length; ++var9) { + if (var0.compare(var1[var8], var1[var9]) > 0) { + String var4 = var1[var8]; + Locale var5 = var2[var8]; + String var6 = var3[var8][0]; + String var7 = var3[var8][1]; + var1[var8] = var1[var9]; + var2[var8] = var2[var9]; + var3[var8][0] = var3[var9][0]; + var3[var8][1] = var3[var9][1]; + var1[var9] = var4; + var2[var9] = var5; + var3[var9][0] = var6; + var3[var9][1] = var7; + } + } + } + + } + + public static void sortStrings(Collator var0, String[] var1, Locale[] var2, Vector var3, Vector var4) { + for(int var9 = 0; var9 < var1.length; ++var9) { + for(int var10 = var9 + 1; var10 < var1.length; ++var10) { + if (var0.compare(var1[var9], var1[var10]) > 0) { + String var5 = var1[var9]; + Locale var6 = var2[var9]; + String var7 = (String)var3.elementAt(var9); + String var8 = (String)var4.elementAt(var9); + var1[var9] = var1[var10]; + var2[var9] = var2[var10]; + var3.setElementAt(var3.elementAt(var10), var9); + var4.setElementAt(var4.elementAt(var10), var9); + var1[var10] = var5; + var2[var10] = var6; + var3.setElementAt(var7, var10); + var4.setElementAt(var8, var10); + } + } + } + + } + + public static void sortStrings(Collator var0, String[] var1) { + for(int var3 = 0; var3 < var1.length; ++var3) { + for(int var4 = var3 + 1; var4 < var1.length; ++var4) { + if (var0.compare(var1[var3], var1[var4]) > 0) { + String var2 = var1[var3]; + var1[var3] = var1[var4]; + var1[var4] = var2; + } + } + } + + } + + public void activate(Container var1) { + super.activate(var1); + var1.setBackground(Color.black); + var1.setForeground(Color.white); + var1.setLayout(new BorderLayout()); + var1.add("Center", this.top); + var1.add("South", this.bottom); + this.chat.line.setBackground(Color.white); + this.chat.line.setForeground(Color.black); + boolean var2 = Gamma.getShaper() != null; + if (var2) { + this.shaperHelpItem = this.addMenuItem(Console.message("using-shaper"), "Help"); + } + + if (NetUpdate.getInfoURL() != null) { + this.helpItem = this.addMenuItem(Console.message("Help-Contents"), "Help"); + this.infoItem = this.addMenuItem(Console.message("Latest-info"), "Help"); + } + + Object[] var3 = new Object[]{new String(Std.getProductName())}; + this.aboutItem = this.addMenuItem(MessageFormat.format(Console.message("About-product"), var3), "Help"); + int var4 = IniFile.gamma().getIniInt("CAM_MODE", 7); + int var5 = IniFile.gamma().getIniInt("CAM_SPEED", 4); + + this.pilot.setOutsideCameraMode(var4, var5); + Menu var6 = new Menu(Console.message("Change-View")); + this.addMenuItem(var6, "Options"); + MenuItem var7 = new MenuItem(Console.message("CAMERA-VIEW")); + var7.setFont(mfont); + var6.add(var7); + this.viewItems = new Vector(); + + for(int var8 = 0; var8 < this.viewNames.size(); ++var8) { + DefaultConsole.CameraView var9 = (DefaultConsole.CameraView)this.viewNames.elementAt(var8); + CheckboxMenuItem var10 = new CheckboxMenuItem(" " + Console.message(var9.viewName), var4 == var9.viewID); + if (var4 == var9.viewID) { + this.currentViewItem = var10; + } + + var10.setFont(mfont); + var6.add(var10); + this.viewItems.addElement(var10); + } + + var6.addSeparator(); + MenuItem var25 = new MenuItem(Console.message("CAMERA-SPEED")); + var25.setFont(mfont); + var6.add(var25); + this.camSpeedItems = new Vector(); + + for(int var26 = 0; var26 < this.speedNames.size(); ++var26) { + DefaultConsole.CameraSpeed var28 = (DefaultConsole.CameraSpeed)this.speedNames.elementAt(var26); + CheckboxMenuItem var11 = new CheckboxMenuItem(" " + Console.message(var28.speedName), var28.speedID == var5); + if (var28.speedID == var5) { + this.currentCamSpeedItem = var11; + } + + var11.setFont(mfont); + var6.add(var11); + this.camSpeedItems.addElement(var11); + } + + Menu privacyMenu = new Menu(Console.message("privacy-settings")); + this.addMenuItem(privacyMenu, "Options"); + int whisperP = IniFile.gamma().getIniInt("WhisperPrivacy", 0); + int teleportP = IniFile.gamma().getIniInt("TeleportPrivacy", 0); + int whisperShow = IniFile.modPrivacy().getIniInt("WhisperFeedback", 1); + int teleportShow = IniFile.modPrivacy().getIniInt("TeleportFeedback", 0); + int whisperSend = IniFile.modPrivacy().getIniInt("WhisperResponse", 1); + int teleportSend = IniFile.modPrivacy().getIniInt("TeleportResponse", 0); + + Menu whisperMenu = new Menu(Console.message("whisper-settings")); + MenuItem whMenu = new MenuItem(Console.message("WHISPER-SETTINGS")); + whisperMenu.setFont(mfont); + whisperMenu.add(whMenu); + this.whisperItems = new Vector(); + privacyMenu.add(whisperMenu); + + for(int wi = 0; wi < this.whisperNames.size(); ++wi) { + DefaultConsole.WhisperPrivacy var28 = (DefaultConsole.WhisperPrivacy)this.whisperNames.elementAt(wi); + CheckboxMenuItem var11 = new CheckboxMenuItem(" " + Console.message(var28.whisperName), var28.whisperID == whisperP); + if (var28.whisperID == whisperP) { + this.currentWhisperItem = var11; + } + + var11.setFont(mfont); + whisperMenu.add(var11); + this.whisperItems.addElement(var11); + } + + whisperMenu.addSeparator(); + this.showWhispers = new CheckboxMenuItem(Console.message("reject-menu"), whisperShow == 1); + this.respondWhispers = new CheckboxMenuItem(Console.message("response-menu"), whisperSend == 1); + whisperMenu.add(this.showWhispers); + whisperMenu.add(respondWhispers); + + Menu teleportMenu = new Menu(Console.message("teleport-settings")); + MenuItem tpMenu = new MenuItem(Console.message("TELEPORT-SETTINGS")); + teleportMenu.setFont(mfont); + teleportMenu.add(tpMenu); + this.teleportItems = new Vector(); + privacyMenu.add(teleportMenu); + + for(int ti = 0; ti < this.teleportNames.size(); ++ti) { + DefaultConsole.TeleportPrivacy var28 = (DefaultConsole.TeleportPrivacy)this.teleportNames.elementAt(ti); + CheckboxMenuItem var11 = new CheckboxMenuItem(" " + Console.message(var28.teleportName), var28.teleportID == teleportP); + if (var28.teleportID == teleportP) { + this.currentTeleportItem = var11; + } + + var11.setFont(mfont); + teleportMenu.add(var11); + this.teleportItems.addElement(var11); + } + + teleportMenu.addSeparator(); + this.showTeleports = new CheckboxMenuItem(Console.message("reject-menu"), teleportShow == 1); + this.respondTeleports = new CheckboxMenuItem(Console.message("response-menu"), teleportSend == 1); + teleportMenu.add(this.showTeleports); + teleportMenu.add(respondTeleports); + + + this.becomeVIPItem = this.addMenuItem(vip == 1 ? Console.message("Become-full-VIP") : Console.message("Become-VIP"), "VIP"); + this.addMenuItem(this.avatarMenu = new AvMenu(this, this.lastPilotRequested), "VIP"); + this.addMenuItem(this.savedAvs, "VIP"); + this.addMenuItem(this.avatarMenu.customize, "VIP"); + this.toggleVoiceChatItem = this.addMenuItem(Console.message("Enable-Voice"), "VIP"); + this.toggleVoiceChatItem.setEnabled(false); + this.numVisItem = this.addMenuItem(Console.message("Num-Visible"), "VIP"); + this.chatLogMenu = new Menu("Chat Log"); + if (NetUpdate.isInternalVersion()) { + this.inventoryItem = this.addMenuItem("Check Inventory", "VIP"); + } + + this.setMenusWRTVIP(); + this.proxyServerItem = this.addMenuItem(Console.message("Proxy-Server"), "Options"); + this.checkAccountItem = this.addMenuItem(Console.message("Account-Info"), "Options"); + if (var2) { + this.statisticsItem = this.addMenuItem(Console.message("Display-Stat"), "Options"); + } + + this.upgradeItem = this.addMenuItem(Console.message("Upgrade-Now"), "Options"); + if (var2) { + this.channelItem = this.addMenuItem(Console.message("Dimension-Sel"), "Options"); + } + + this.serverItem = this.addMenuItem(signIn, "Options"); + this.setOnlineState(this.galaxy.getOnlineEnabled(), this.galaxy.getOnline()); + Menu var27; + if (IniFile.gamma().getIniInt("recorderEnabled", 1) == 1) { + var27 = new Menu(Console.message("Recorder")); + this.recorderRecItem = new MenuItem(Console.message("Record")); + var27.add(this.recorderRecItem); + this.recorderStopItem = new MenuItem(Console.message("Stop")); + var27.add(this.recorderStopItem); + this.recorderPlayItem = new MenuItem(Console.message("Play")); + var27.add(this.recorderPlayItem); + } + + if (NetUpdate.isInternalVersion()) { + var27 = new Menu(Console.message("Languages")); + this.addMenuItem(var27, "Options"); + Menu var29 = new Menu(Console.message("Download-Font")); + var27.add(var29); + var29.setFont(mfont); + this.fontItems = new Vector(); + + for(int var30 = 0; var30 < this.fLength; ++var30) { + if (this.flList.elementAt(var30) != null) { + String var12; + if (this.fsList.elementAt(var30) != null) { + this.newfLocale[var30] = new Locale((String)this.flList.elementAt(var30), (String)this.fsList.elementAt(var30)); + var12 = (String)this.flList.elementAt(var30) + "_" + (String)this.fsList.elementAt(var30); + if (var12.equals(Console.message(var12))) { + this.dFonts[var30] = new MenuItem(this.newfLocale[var30].getDisplayName()); + } else { + this.dFonts[var30] = new MenuItem(Console.message(var12)); + } + } else { + var12 = (String)this.flList.elementAt(var30); + if (var12.equals(Console.message(var12))) { + this.dFonts[var30] = new MenuItem((String)this.flList.elementAt(var30)); + } else { + this.dFonts[var30] = new MenuItem(Console.message(var12)); + } + } + + this.dFonts[var30].setFont(mfont); + var29.add(this.dFonts[var30]); + this.fontItems.addElement(this.dFonts[var30]); + } + } + + Menu var31 = new Menu(Console.message("Download-Language")); + var27.add(var31); + var31.setFont(mfont); + this.downItems = new Vector(); + String[] var32 = new String[this.dLength]; + + String var17; + for(int var13 = 0; var13 < this.dLength; ++var13) { + if (this.lList.elementAt(var13) != null) { + this.newdLocale[var13] = new Locale((String)this.lList.elementAt(var13), (String)this.sList.elementAt(var13)); + String var15; + if (var13 > 0) { + Locale var18 = new Locale((String)this.lList.elementAt(var13 - 1), (String)this.sList.elementAt(var13 - 1)); + var15 = var18.getDisplayName(); + } else { + var15 = this.newdLocale[var13].getDisplayName(); + } + + String var16 = this.newdLocale[var13].getDisplayName(); + var16 = var16.substring(0, var16.indexOf(40) - 1); + String var14; + if (var13 < this.dLength - 1) { + Locale var20 = new Locale((String)this.lList.elementAt(var13 + 1), (String)this.sList.elementAt(var13 + 1)); + var17 = var20.getDisplayName(); + var17 = var17.substring(0, var17.indexOf(40) - 1); + if (var17.equals(var16)) { + var14 = this.newdLocale[var13].getDisplayName(); + } else { + var14 = var16; + } + } else if (var13 == this.dLength - 1) { + var15 = var15.substring(0, var15.indexOf(40) - 1); + if (var16.equals(var15)) { + var14 = this.newdLocale[var13].getDisplayName(); + } else { + var14 = var16; + } + } else if (var32[var13 - 1].equals(var16)) { + var14 = this.newdLocale[var13].getDisplayName(); + } else { + var14 = var16; + } + + String var21 = (String)this.lList.elementAt(var13) + "_" + (String)this.sList.elementAt(var13); + if (var21.equals(Console.message(var21))) { + var32[var13] = var14; + } else { + var32[var13] = Console.message(var21); + } + } + } + + Collator var33 = Collator.getInstance(); + sortStrings(var33, var32, this.newdLocale, this.lList, this.sList); + + for(int var34 = 0; var34 < this.dLength; ++var34) { + this.dLangs[var34] = new MenuItem(var32[var34]); + this.dLangs[var34].setFont(mfont); + var31.add(this.dLangs[var34]); + this.downItems.addElement(this.dLangs[var34]); + } + + Menu var37 = new Menu(Console.message("Switch-Language")); + var27.add(var37); + var37.setFont(mfont); + this.langItems = new Vector(); + + int var36; + for(int var35 = 0; var35 < lLength; ++var35) { + var36 = lNames[var35].indexOf(95); + if (var36 < 0) { + lCodes[var35][0] = "en"; + lCodes[var35][1] = "US"; + } else { + int var39 = lNames[var35].lastIndexOf(46); + if (var39 < 0) { + var39 = 0; + } + + lCodes[var35][0] = lNames[var35].substring(var36 + 1, var36 + 3); + if (var39 > var36 + 4) { + lCodes[var35][1] = lNames[var35].substring(var36 + 4, var39); + } else { + lCodes[var35][1] = lCodes[var35][0].toUpperCase(); + } + } + } + + String[] var38 = new String[lLength]; + + for(var36 = 0; var36 < lLength; ++var36) { + newLocale[var36] = new Locale(lCodes[var36][0], lCodes[var36][1]); + String var40; + if (var36 > 0) { + Locale var42 = new Locale(lCodes[var36 - 1][0], lCodes[var36 - 1][1]); + var40 = var42.getDisplayName(); + } else { + var40 = newLocale[var36].getDisplayName(); + } + + String var19 = newLocale[var36].getDisplayName(); + var19 = var19.substring(0, var19.indexOf(40) - 1); + if (var36 < lLength - 1) { + Locale var23 = new Locale(lCodes[var36 + 1][0], lCodes[var36 + 1][1]); + String var41 = var23.getDisplayName(); + var41 = var41.substring(0, var41.indexOf(40) - 1); + if (var41.equals(var19)) { + var17 = newLocale[var36].getDisplayName(); + } else { + var17 = var19; + } + } else if (var36 == lLength - 1) { + var40 = var40.substring(0, var40.indexOf(40) - 1); + if (var19.equals(var40)) { + var17 = newLocale[var36].getDisplayName(); + } else { + var17 = var19; + } + } else if (var38[var36 - 1].equals(var19)) { + var17 = newLocale[var36].getDisplayName(); + } else { + var17 = var19; + } + + String var24 = lCodes[var36][0] + "_" + lCodes[var36][1]; + if (var24.equals(Console.message(var24))) { + var38[var36] = var17; + } else { + var38[var36] = Console.message(var24); + } + } + + sortStrings(var33, var38, newLocale, lCodes); + + for(var36 = 0; var36 < lLength; ++var36) { + lLangs[var36] = new MenuItem(var38[var36]); + lLangs[var36].setFont(mfont); + var37.add(lLangs[var36]); + this.langItems.addElement(lLangs[var36]); + } + + this.currentLang = new MenuItem(Console.message("Current-Language")); + var27.add(this.currentLang); + this.currentLang.setFont(mfont); + } + + if (var2) { + this.condenseItem = this.addMenuItem(Console.message("Condense-Files"), "Options"); + this.expandItem = this.addMenuItem(Console.message("Expand-Files"), "Options"); + this.musicManItem = this.addMenuItem(Console.message("Music-Manager"), "Options"); + this.i18nTest = this.addMenuItem(Console.message("I18N-Test"), "Options"); + } + + this.cdPlayerItem = this.addMenuItem(Console.message("MusicM"), "Options"); + this.volumeItem = this.addMenuItem(Console.message("Volume-control"), "Options"); + if (RenderWare.get3DHardwareAvailable()) { + if (RenderWare.get3DHardwareInUse()) { + this.graphicsItem = this.addMenuItem(disable3D, "Options"); } else { - var24 = newLocale[var22].getDisplayName(); + this.graphicsItem = this.addMenuItem(enable3D, "Options"); } + } - String var25 = newLocale[var22].getDisplayName(); - var25 = var25.substring(0, var25.indexOf(40) - 1); - String var42; - if (var22 < lLength - 1) { - Locale var29 = new Locale(lCodes[var22 + 1][0], lCodes[var22 + 1][1]); - String var26 = var29.getDisplayName(); - var26 = var26.substring(0, var26.indexOf(40) - 1); - if (var26.equals(var25)) { - var42 = newLocale[var22].getDisplayName(); - } else { - var42 = var25; - } - } else if (var22 == lLength - 1) { - var24 = var24.substring(0, var24.indexOf(40) - 1); - if (var25.equals(var24)) { - var42 = newLocale[var22].getDisplayName(); - } else { - var42 = var25; - } - } else if (var41[var22 - 1].equals(var25)) { - var42 = newLocale[var22].getDisplayName(); + if (IniFile.gamma().getIniInt("SHOWNAMETAGS", 1) == 1) { + this.nametagItem = this.addMenuItem(hideTags, "Options"); + } else { + this.nametagItem = this.addMenuItem(showTags, "Options"); + } + + if (IniFile.gamma().getIniInt("classicChatBox", 1) == 1) { + this.chatBoxItem = this.addMenuItem(disableClassicChat, "Options"); + } else { + this.chatBoxItem = this.addMenuItem(enableClassicChat, "Options"); + } + + if (Gamma.loadProgress != null) { + Gamma.loadProgress.setMessage("Preloading avatars..."); + Gamma.loadProgress.advance(); + } + + this.menuDone(); + getFrame().activate(); + LogFile.mailLogIfPresent(this.getSmtpServer()); + this.render.requestFocus(); + this.setMenusWRTVIP(); + this.bootSomeone = null; + if (this.broadcastEnabled()) { + this.addBroadcastMenu(); + } + + this.universeMode = false; + } + + public void setVIP(boolean var1) { + super.setVIP(var1); + this.setMenusWRTVIP(); + this.setNameStr(); + } + + public void checkCourtesyVIP() { + super.checkCourtesyVIP(); + this.setMenusWRTVIP(); + this.setNameStr(); + } + + public void setNameStr() { + String var1 = this.galaxy.getUsernameU(); + boolean var2 = this.galaxy.getOnline(); + if (!var2) { + this.yourName.setText(Console.message("Off-line")); + } else { + if (var1.length() > 0) { + if (var1.regionMatches(true, 0, "VIP ", 0, 4)) { + var1 = var1.substring(4); + } + + if (vip > 0) { + if (vip > 1) { + var1 = Console.message("VIP") + " " + var1; + } else { + var1 = Console.message("vip") + " " + var1; + } + } + + IniFile.gamma().setIniString("LASTCHATNAME", parseExtended(var1)); + this.yourName.setText(Console.parseUnicode(var1)); + } + + } + } + + public void enableBroadcast(boolean var1) { + super.enableBroadcast(var1); + if (var1) { + this.addBroadcastMenu(); + } + + } + + public void deactivate() { + super.deactivate(); + this.universeMode = false; + } + + protected void setSleepMode(String var1) { + super.setSleepMode(var1); + if (var1 != null && var1.equals(Console.message("asleep"))) { + this.statusMessage = sleepStatus; + } else if (this.statusMessage == sleepStatus) { + this.statusMessage = ""; + } + + } + + private void relogin() { + if (this.serverItem.getLabel().equals(signOut)) { + this.reloginDialog = new OkCancelDialog(getFrame(), this, Console.message("Re-login"), Console.message("Cancel"), Console.message("OK"), Console.message("auto-sign-out"), true); + } + + } + + public void toggleWhisperRejects() { + int mainVal = IniFile.modPrivacy().getIniInt("WhisperFeedback", 1); + boolean newVal = mainVal == 1; + IniFile.modPrivacy().setIniInt("WhisperFeedback", newVal ? 0 : 1); + this.showWhispers.setState(!newVal); + } + + public void toggleWhisperResponse() { + int mainVal = IniFile.modPrivacy().getIniInt("WhisperResponse", 1); + boolean newVal = mainVal == 1; + IniFile.modPrivacy().setIniInt("WhisperResponse", newVal ? 0 : 1); + this.respondWhispers.setState(!newVal); + } + + public void toggleTeleportRejects() { + int mainVal = IniFile.modPrivacy().getIniInt("TeleportFeedback", 1); + boolean newVal = mainVal == 1; + IniFile.modPrivacy().setIniInt("TeleportFeedback", newVal ? 0 : 1); + this.showTeleports.setState(!newVal); + } + + public void toggleTeleportResponse() { + int mainVal = IniFile.modPrivacy().getIniInt("TeleportResponse", 0); + boolean newVal = mainVal == 1; + IniFile.modPrivacy().setIniInt("TeleportResponse", mainVal == 1 ? 0 : 1); + this.respondTeleports.setState(!newVal); + } + + public boolean action(Event var1, Object var2) { + if (var1.target == this.aboutItem) { + new AboutDialog(Std.getProductName(), getFrame()); + } else if (var1.target == this.statisticsItem && this.statisticsItem != null) { + new StatisticsWindow(getFrame()); + } else if (this.viewItems.contains(var1.target)) { + this.changeView((CheckboxMenuItem)var1.target); + } else if (this.camSpeedItems.contains(var1.target)) { + this.changeCamSpeed((CheckboxMenuItem)var1.target); + } else if (this.whisperItems.contains(var1.target)) { + this.changeWhispers((CheckboxMenuItem)var1.target); + } else if (this.teleportItems.contains(var1.target)) { + this.changeTeleport((CheckboxMenuItem)var1.target); + } else if (var1.target == this.showWhispers) { + toggleWhisperRejects(); + } else if (var1.target == this.respondWhispers) { + toggleWhisperResponse(); + } else if (var1.target == this.showTeleports) { + toggleTeleportRejects(); + } else if (var1.target == this.respondTeleports) { + toggleTeleportResponse(); + } else if (var1.target == this.gettingStartedItem) { + (new SendURLAction(this.getHelpGettingStarted())).startBrowser(); + } else { + String var4; + String var15; + if (var1.target == this.shaperHelpItem) { + var15 = IniFile.override().getIniString("ShaperHelp", this.getScriptServer() + "shaperhelp.pl") + "?u="; + var4 = IniFile.gamma().getIniString("lastchatname", ""); + if (!var4.equals("")) { + if (var4.startsWith("VIP ")) { + var4 = var4.substring(4); + } + + var15 = var15 + var4; + } + + (new SendURLAction(WebControlImp.processURL(var15))).startBrowser(); + } else if (var1.target == this.helpItem) { + var15 = NetUpdate.getUpgradeServerURL(); + var4 = IniFile.override().getIniString("HelpDirectory", "help"); + String var18 = IniFile.override().getIniString("HelpPage", Std.getVersion() + Console.message(".html")); + if (wasHttpNoSuchFile(var15 + var4 + "/" + var18)) { + var18 = IniFile.override().getIniString("HelpPage", Std.getVersion() + ".html"); + } + + (new SendURLAction(var15 + var4 + "/" + var18)).startBrowser(); + } else if (var1.target == this.infoItem) { + var15 = IniFile.override().getIniString("infoOverride", ""); + if (var15.equals("")) { + NetUpdate.showInfo(); + } else { + (new SendURLAction(var15)).startBrowser(); + } + } else if (var1.target == this.i18nTest) { + Locale var23 = Locale.getDefault(); + Console.println("Default = " + var23.getDisplayName()); + DateFormat var24 = DateFormat.getDateTimeInstance(1, 1); + Date var17 = new Date(); + Console.println("Today = " + var24.format(var17)); + Locale[] var19 = DateFormat.getAvailableLocales(); + Console.println("Avaliable Locales are:"); + + for(int var7 = 0; var7 < var19.length; ++var7) { + Locale.setDefault(var19[var7]); + Console.println(var19[var7].getDisplayName() + " " + var19[var7]); + } + + new Locale("en", "US"); + Locale var8 = new Locale("fr", "FR"); + Locale var9 = new Locale("de", "DE"); + Locale var10 = new Locale("ja", "JP"); + Locale var11 = new Locale("zh", "CN"); + Locale var12 = new Locale("th", "TH"); + Locale var13 = new Locale("ru", "RU"); + Locale var14 = new Locale("iw", "IL"); + Console.println("file.encoding = " + System.getProperty("file.encoding")); + Console.println(this.message("test-language", var8)); + Console.println(this.message("test-language", var9)); + Console.println(this.message("test-language", var10)); + Console.println(this.message("test-language", var11)); + Console.println(this.message("test-language", var12)); + Console.println(this.message("test-language", var13)); + Console.println(this.message("test-language", var14)); + Console.println(this.message("test-language", var23)); + } else if (var1.target == this.checkAccountItem) { + var15 = IniFile.override().getIniString("accountOverride", ""); + if (var15.equals("")) { + var4 = IniFile.override().getIniString("accountInfoPage", "account" + Console.message(".pl")); + if (wasHttpNoSuchFile(this.getScriptServer() + var4)) { + var4 = IniFile.override().getIniString("accountInfoPage", "account.pl"); + } + + (new SendURLAction(this.getScriptServer() + var4, true)).startBrowser(); + } else { + (new SendURLAction(var15)).startBrowser(); + } + + this.relogin(); + } else if (var1.target == this.upgradeItem) { + NetUpdate.doUpdate(true); + } else if (var1.target == this.channelItem && this.channelItem != null) { + Galaxy var22 = this.getGalaxy(); + var4 = ""; + Debug.dAssert(var22 != null); + if (var22 != null) { + var4 = var22.getChannel(); + } + + new ChannelDialog(getFrame(), this, Console.message("Dimension-Sel"), var4); + } else if (var1.target == this.becomeVIPItem) { + var15 = IniFile.override().getIniString("vipOverride", ""); + if (var15.equals("")) { + var4 = IniFile.override().getIniString("vipPage", "vip" + Console.message(".pl")); + if (wasHttpNoSuchFile(this.getScriptServer() + var4)) { + var4 = IniFile.override().getIniString("vipPage", "vip.pl"); + } + + (new SendURLAction(this.getScriptServer() + var4, true)).startBrowser(); + } else { + (new SendURLAction(var15, false)).startBrowser(); + } + + this.relogin(); + } else if (var1.target == this.numVisItem) { + new SetNumVisibleAvs(); + } else if (var1.target == this.inventoryItem) { + EquipAction var21 = new EquipAction(); + var21.trigger((NET.worlds.scape.Event)null, (Persister)null); + } else if (var1.target == this.proxyServerItem) { + System.out.println("Triggering the Proxy Server dialog."); + ProxyServerDialog var20 = new ProxyServerDialog(); + var20.show(); + } else if (var1.target == this.toggleVoiceChatItem) { + VoiceChat.setVoiceChatEnabled(!VoiceChat.voiceChatEnabled); + this.setMenusWRTVIP(); + } else if (var1.target == this.serverItem) { + this.handleServerItem(); + } else if (var1.target == this.condenseItem) { + new ArchiveMaker(true); + } else if (var1.target == this.expandItem) { + new ArchiveMaker(false); + } else if (var1.target == this.musicManItem) { + MusicManager.showDialog(); + } else if (var1.target == this.cdPlayerItem) { + if (this.cdcontrol == null) { + this.playedCD = true; + this.cdcontrol = new CDControl(getFrame(), this); + } + } else if (var1.target == this.volumeItem) { + if (!CDPlayerAction.launchVolumeControlApp()) { + new OkCancelDialog(getFrame(), (DialogReceiver)null, Console.message("No-Volume"), (String)null, Console.message("OK"), Console.message("Cannot-locate"), true); + } + } else if (var1.target == this.graphicsItem) { + this.handleGraphicsItem(); + } else if (var1.target == this.nametagItem) { + this.handleNametagsItem(); + } else if (var1.target == this.chatBoxItem) { + this.handleChatBoxItem(); + } else if (var1.target == this.bootSomeone) { + new BootDialog(getFrame(), this, Console.message("Boot-user")); + } else if (var1.target == this.broadcastToRoom) { + startWhispering("room"); + } else if (var1.target == this.broadcastToAll) { + startWhispering("world"); + } else if (var1.target == this.currentLang) { + var15 = Locale.getDefault().toString(); + if (var15 == Console.message(var15)) { + Console.println(Console.message("Current-Language") + " = " + Locale.getDefault().getDisplayName()); + } else { + Console.println(Console.message("Current-Language") + " = " + Console.message(var15)); + } + } else if (var1.target == this.recorderPlayItem) { + println(Console.message("BlackBoxPlay")); + BlackBox.getInstance().play(); + } else if (var1.target == this.recorderRecItem) { + println(Console.message("BlackBoxRec")); + BlackBox.getInstance().record(); + } else if (var1.target == this.recorderStopItem) { + println(Console.message("BlackBoxStop")); + BlackBox.getInstance().stop(); } else { - var42 = var25; - } - - String var30 = lCodes[var22][0] + "_" + lCodes[var22][1]; - if (var30.equals(Console.message(var30))) { - var41[var22] = var42; + int var5; + String var6; + int var16; + if (this.fontItems != null && this.fontItems.contains(var1.target)) { + var15 = IniFile.gamma().getIniString("upgradeServer", "") + "/I18N/font_"; + + for(var16 = 0; var16 < this.fLength; ++var16) { + if (var1.target == this.fontItems.elementAt(var16)) { + if (this.fsList.elementAt(var16) != null) { + var15 = var15 + this.flList.elementAt(var16) + "_" + this.fsList.elementAt(var16) + ".EXE"; + } else { + var15 = var15 + this.flList.elementAt(var16) + ".EXE"; + } + + var5 = this.fSizes[var16]; + var6 = var15.substring(var15.lastIndexOf(47) + 1, var15.length()); + LanguageManager.handle(var15, var5, var6); + break; + } + } + } else if (this.downItems != null && this.downItems.contains(var1.target)) { + var15 = IniFile.gamma().getIniString("upgradeServer", "") + "/I18N/language_"; + + for(var16 = 0; var16 < this.dLength; ++var16) { + if (var1.target == this.downItems.elementAt(var16)) { + if (this.sList.elementAt(var16) != null) { + var15 = var15 + this.lList.elementAt(var16) + "_" + this.sList.elementAt(var16) + ".zip"; + IniFile.gamma().setIniString("DEFAULTLANGUAGE", (String)this.lList.elementAt(var16) + "_" + this.sList.elementAt(var16)); + } else { + var15 = var15 + this.lList.elementAt(var16) + ".zip"; + IniFile.gamma().setIniString("DEFAULTLANGUAGE", (String)this.lList.elementAt(var16)); + } + + var5 = this.lSizes[var16]; + var6 = var15.substring(var15.lastIndexOf(47) + 1, var15.length()); + LanguageManager.handle(var15, var5, var6); + break; + } + } + } else if (this.langItems != null && this.langItems.contains(var1.target)) { + for(int var3 = 0; var3 < lLength; ++var3) { + if (var1.target == this.langItems.elementAt(var3)) { + Locale.setDefault(newLocale[var3]); + var4 = newLocale[var3].toString(); + if (var4 == Console.message(var4)) { + Console.println(message("Setting-to") + " " + newLocale[var3].getDisplayName()); + } else { + Console.println(message("Setting-to") + " " + Console.message(var4)); + } + + IniFile.gamma().setIniString("DEFAULTLANGUAGE", lCodes[var3][0] + "_" + lCodes[var3][1]); + new OkCancelDialog(getFrame(), (DialogReceiver)null, Console.message("Alert"), (String)null, Console.message("OK"), Console.message("Change-exit"), true); + break; + } + } + } else if (this.avatarMenu == null || !this.avatarMenu.action(var1, var2)) { + return super.action(var1, var2); + } + } + } + + return true; + } + + public void setCurrentAvatarItem(CheckboxMenuItem var1) { + if (this.curAvatarItem != null) { + this.curAvatarItem.setState(false); + } + + this.curAvatarItem = var1; + if (this.curAvatarItem != null) { + this.curAvatarItem.setState(true); + } + + } + + public CheckboxMenuItem getCurrentAvatarItem() { + return this.curAvatarItem; + } + + public void deletedSavedAvatar(CheckboxMenuItem var1) { + if (this.curAvatarItem == var1) { + this.findAvatarMenuItem(this.getDefaultAvatarURL()); + } + + } + + public void setNextAvatar(URL var1, CheckboxMenuItem var2) { + synchronized(this.nextAvatarMutex) { + this.nextAvatar = var1; + this.nextAvatarItem = var2; + } + } + + private void findAvatarMenuItem(URL var1) { + synchronized(this.nextAvatarMutex) { + if (this.nextAvatarItem == null) { + Object var3; + if ((this.savedAvs == null || (var3 = this.savedAvs.findMenuItem(var1)) == null) && (this.avatarMenu == null || (var3 = this.avatarMenu.findMenuItem(var1)) == null)) { + this.setCurrentAvatarItem((CheckboxMenuItem)null); + } else { + this.setCurrentAvatarItem((CheckboxMenuItem)var3); + } + } + + } + } + + private URL getHelpGettingStarted() { + IniFile var1 = new IniFile("InstalledWorlds"); + String var2 = Console.message("Getting-started"); + String var3 = var1.getIniString("InstalledWorld0", ""); + if (!var3.equals("")) { + URL var4 = URL.make("home:" + var3 + "/" + var2); + File var5 = new File(var4.unalias()); + if (var5.exists()) { + return var4; + } + } + + return URL.make("home:" + var2); + } + + private void changeView(CheckboxMenuItem var1) { + this.chooseView = this.viewItems.indexOf(var1); + if (var1 != this.currentViewItem) { + this.currentViewItem.setState(false); + this.currentViewItem = var1; + this.currentViewItem.setState(true); + } + + } + + private int getView() { + return this.viewItems.indexOf(this.currentViewItem); + } + + private void setView(int var1) { + this.changeView((CheckboxMenuItem)this.viewItems.elementAt(var1)); + } + + private void changeCamSpeed(CheckboxMenuItem var1) { + this.chooseCamSpeed = this.camSpeedItems.indexOf(var1); + if (var1 != this.currentCamSpeedItem) { + this.currentCamSpeedItem.setState(false); + this.currentCamSpeedItem = var1; + this.currentCamSpeedItem.setState(true); + } + + } + + private void changeWhispers(CheckboxMenuItem var1) { + this.chooseWhisper = this.whisperItems.indexOf(var1); + if (var1 != this.currentWhisperItem) { + this.currentWhisperItem.setState(false); + this.currentWhisperItem = var1; + this.currentWhisperItem.setState(true); + } + } + + private void changeTeleport(CheckboxMenuItem var1) { + this.chooseTeleport = this.teleportItems.indexOf(var1); + if (var1 != this.currentTeleportItem) { + this.currentTeleportItem.setState(false); + this.currentTeleportItem = var1; + this.currentTeleportItem.setState(true); + } + } + + public void resetCamera() { + if (this.viewItems != null && this.camSpeedItems != null) { + this.chooseView = this.viewItems.indexOf(this.currentViewItem); + this.chooseCamSpeed = this.camSpeedItems.indexOf(this.currentCamSpeedItem); + } + } + + private void handleServerItem() { + if (!this.serverItem.getLabel().equals(signIn)) { + Galaxy.forceOffline(false); + } else { + this.getGalaxy().localForceOnline(); + this.getGalaxy().waitForConnection(this); + } + + } + + public UniversePanel getUniverse() { + return this.universeMode ? this.universe : null; + } + + public synchronized void setUniverseMode(boolean var1) { + if (var1 != this.universeMode) { + this.universeMode = var1; + if (this.universeMode) { + if (this.universe == null) { + this.universe = new UniversePanel(this); + this.renderAndUniverse.add("universe", this.universe); + } + + this.renderCard.show(this.renderAndUniverse, "universe"); + this.universe.startWatch(); + this.render.requestFocus(); } else { - var41[var22] = Console.message(var30); - } - } - - sortStrings(var36, var41, newLocale, lCodes); - - for(int var43 = 0; var43 < lLength; ++var43) { - lLangs[var43] = new MenuItem(var41[var43]); - lLangs[var43].setFont(mfont); - var38.add(lLangs[var43]); - this.langItems.addElement(lLangs[var43]); - } - - this.currentLang = new MenuItem(Console.message("Current-Language")); - var33.add(this.currentLang); - this.currentLang.setFont(mfont); - } - - if (var2) { - this.condenseItem = this.addMenuItem(Console.message("Condense-Files"), "Options"); - this.expandItem = this.addMenuItem(Console.message("Expand-Files"), "Options"); - this.musicManItem = this.addMenuItem(Console.message("Music-Manager"), "Options"); - this.i18nTest = this.addMenuItem(Console.message("I18N-Test"), "Options"); - } - - this.cdPlayerItem = this.addMenuItem(Console.message("MusicM"), "Options"); - this.volumeItem = this.addMenuItem(Console.message("Volume-control"), "Options"); - if (RenderWare.get3DHardwareAvailable()) { - if (RenderWare.get3DHardwareInUse()) { - this.graphicsItem = this.addMenuItem(disable3D, "Options"); - } else { - this.graphicsItem = this.addMenuItem(enable3D, "Options"); - } - } - - if (IniFile.gamma().getIniInt("SHOWNAMETAGS", 1) == 1) { - this.nametagItem = this.addMenuItem(hideTags, "Options"); - } else { - this.nametagItem = this.addMenuItem(showTags, "Options"); - } - - if (IniFile.gamma().getIniInt("classicChatBox", 1) == 1) { - this.chatBoxItem = this.addMenuItem(disableClassicChat, "Options"); - } else { - this.chatBoxItem = this.addMenuItem(enableClassicChat, "Options"); - } - - if (Gamma.loadProgress != null) { - Gamma.loadProgress.setMessage("Preloading avatars..."); - Gamma.loadProgress.advance(); - } - - this.menuDone(); - Console.getFrame().activate(); - LogFile.mailLogIfPresent(this.getSmtpServer()); - this.render.requestFocus(); - this.setMenusWRTVIP(); - this.bootSomeone = null; - if (this.broadcastEnabled()) { - this.addBroadcastMenu(); - } - - this.universeMode = false; - } - - public void setVIP(boolean var1) { - super.setVIP(var1); - this.setMenusWRTVIP(); - this.setNameStr(); - } - - public void checkCourtesyVIP() { - super.checkCourtesyVIP(); - this.setMenusWRTVIP(); - this.setNameStr(); - } - - public void setNameStr() { - String var1 = super.galaxy.getUsernameU(); - boolean var2 = super.galaxy.getOnline(); - if (!var2) { - this.yourName.setText(Console.message("Off-line")); - } else { - if (var1.length() > 0) { - if (var1.regionMatches(true, 0, "VIP ", 0, 4)) { - var1 = var1.substring(4); - } - - if (Console.vip > 0) { - if (Console.vip > 1) { - var1 = Console.message("VIP") + " " + var1; - } else { - var1 = Console.message("vip") + " " + var1; - } - } - - IniFile.gamma().setIniString("LASTCHATNAME", Console.parseExtended(var1)); - this.yourName.setText(Console.parseUnicode(var1)); - } - - } - } - - public void enableBroadcast(boolean var1) { - super.enableBroadcast(var1); - if (var1) { - this.addBroadcastMenu(); - } - - } - - public void deactivate() { - super.deactivate(); - this.universeMode = false; - } - - protected void setSleepMode(String var1) { - super.setSleepMode(var1); - if (var1 != null && var1.equals(Console.message("asleep"))) { - this.statusMessage = sleepStatus; - } else if (this.statusMessage == sleepStatus) { - this.statusMessage = ""; - } - - } - - private void relogin() { - if (this.serverItem.getLabel().equals(signOut)) { - this.reloginDialog = new OkCancelDialog(Console.getFrame(), this, Console.message("Re-login"), Console.message("Cancel"), Console.message("OK"), Console.message("auto-sign-out"), true); - } - - } - - public boolean action(Event var1, Object var2) { - if (var1.target == this.aboutItem) { - new AboutDialog(Std.getProductName(), Console.getFrame()); - } else if (var1.target == this.statisticsItem && this.statisticsItem != null) { - new StatisticsWindow(Console.getFrame()); - } else if (this.viewItems.contains(var1.target)) { - this.changeView((CheckboxMenuItem)var1.target); - } else if (this.camSpeedItems.contains(var1.target)) { - this.changeCamSpeed((CheckboxMenuItem)var1.target); - } else if (var1.target == this.gettingStartedItem) { - (new SendURLAction(this.getHelpGettingStarted())).startBrowser(); - } else { - String var4; - String var16; - if (var1.target == this.shaperHelpItem) { - var16 = IniFile.override().getIniString("ShaperHelp", this.getScriptServer() + "shaperhelp.pl") + "?u="; - var4 = IniFile.gamma().getIniString("lastchatname", ""); - if (!var4.equals("")) { - if (var4.startsWith("VIP ")) { - var4 = var4.substring(4); - } - - var16 = var16 + var4; - } - - (new SendURLAction(WebControlImp.processURL(var16))).startBrowser(); - } else if (var1.target == this.helpItem) { - var16 = NetUpdate.getUpgradeServerURL(); - var4 = IniFile.override().getIniString("HelpDirectory", "help"); - String var19 = IniFile.override().getIniString("HelpPage", Std.getVersion() + Console.message(".html")); - if (Console.wasHttpNoSuchFile(var16 + var4 + "/" + var19)) { - var19 = IniFile.override().getIniString("HelpPage", Std.getVersion() + ".html"); - } - - (new SendURLAction(var16 + var4 + "/" + var19)).startBrowser(); - } else if (var1.target == this.infoItem) { - var16 = IniFile.override().getIniString("infoOverride", ""); - if (var16.equals("")) { - NetUpdate.showInfo(); + this.renderCard.show(this.renderAndUniverse, "render"); + if (physMem < 64000000) { + this.renderAndUniverse.remove(this.universe); + this.universe.stopWatch(); + this.universe.flushImage(); + this.universe = null; + } + + this.renderAndUniverse.repaint(); + } + + } + } + + public void toggleUniverseMode() { + this.setUniverseMode(!this.universeMode); + } + + public boolean isUniverseMode() { + return this.universeMode; + } + + public Object imageButtonsCallback(Component var1, int var2) { + if (var1 != this.driveButton) { + if (var1 == this.quitButton) { + maybeQuit(); + } else if (var1 == this.exploreButton) { + this.toggleUniverseMode(); + } else if (var1 == this.menuButtons) { + switch(var2) { + case 0: + return this.getMenu("Help"); + case 1: + return this.getMenu("Options"); + case 2: + String var3 = IniFile.override().getIniString("ProductName", ""); + if (!var3.equalsIgnoreCase("RedLightWorld")) { + EMailPart.showMessage(this); + } + break; + case 3: + return (PopupMenu)this.marks.getMenu(); + case 4: + return (PopupMenu)this.marks.getLetsMenu(); + case 5: + this.actions.present(); + break; + case 6: + return this.getMenu("VIP"); + } + } + } + + return null; + } + + public RenderCanvas getRender() { + return this.render; + } + + public FriendsListPart getFriends() { + return this.friends; + } + + public MuteListPart getMutes() { + return this.mutes; + } + + public TarListPart getTars() { + return this.tars; + } + + public void generateFrameEvents(FrameEvent var1) { + if (Window.getWindowState(Window.getFrameHandle()) == 1) { + this.goToSleep(); + } + + if (doDrive) { + doDrive = false; + this.render.drive(); + wasDelta = true; + } + + super.generateFrameEvents(var1); + Pilot var2 = Pilot.getActive(); + GammaFrame var3 = getFrame(); + String var4 = var3.getTitle(); + String var5 = ""; + if (var2 != null) { + World var6 = var2.getWorld(); + if (var6 != null) { + String var7 = var6.getName(); + if (var7 != null) { + var5 = var7; + } + } + } + + if (!lastWorldName.equals(var5)) { + lastWorldName = var5; + String var14 = GammaFrame.getDefaultTitle(); + if (var5.length() != 0) { + var14 = var14 + " - " + var5; + if (!this.playedCD) { + CDAudio.startupPlay(); + this.playedCD = true; + } + } + + var3.setTitle(var14); + } + + if (var2 != null) { + if (this.chooseView != -1 || this.chooseCamSpeed != -1) { + int var15 = var2.getOutsideCameraMode(); + int var16 = var2.getOutsideCameraSpeed(); + int var8 = var15; + int var9 = var16; + if (this.chooseView != -1) { + var8 = ((DefaultConsole.CameraView)this.viewNames.elementAt(this.chooseView)).viewID; + } + + if (this.chooseCamSpeed != -1) { + var9 = ((DefaultConsole.CameraSpeed)this.speedNames.elementAt(this.chooseCamSpeed)).speedID; + } + + var2.setOutsideCameraMode(var8, var9); + if (var8 != 99) { + IniFile.gamma().setIniInt("CAM_MODE", var8); + IniFile.gamma().setIniInt("CAM_SPEED", var9); + } + + this.chooseView = -1; + this.chooseCamSpeed = -1; + } + + if (this.wasTeleporting != this.marks.isTeleporting()) { + this.wasTeleporting = this.marks.isTeleporting(); + if (this.wasTeleporting) { + this.statusMessage = loadingString; + } else if (this.statusMessage == loadingString) { + this.statusMessage = ""; + } + } + + this.checkVMWarning(); + if (wasDelta && !this.render.getDeltaMode()) { + this.statusMessage = arrowKeyMsg; + wasDelta = false; + this.driveButton.drawCursed(); + } + + if (this.chooseWhisper != -1 || this.chooseTeleport != -1) { + + int whisperValue = IniFile.gamma().getIniInt("WhisperPrivacy", 0); + int teleportValue = IniFile.gamma().getIniInt("TeleportPrivacy", 0); + + if (this.chooseWhisper != -1) { + whisperValue = ((WhisperPrivacy) this.whisperNames.elementAt(chooseWhisper)).whisperID; + } + + if (this.chooseTeleport != -1) { + teleportValue = ((TeleportPrivacy) this.teleportNames.elementAt(chooseTeleport)).teleportID; + } + + IniFile.gamma().setIniInt("WhisperPrivacy", whisperValue); + IniFile.gamma().setIniInt("TeleportPrivacy", teleportValue); + + this.chooseWhisper = -1; + this.chooseTeleport = -1; + } + + synchronized(this.status) { + if (this.statusMessage != this.lastStatus && this.overrideMessage == null) { + this.lastStatus = this.statusMessage; + this.status.setText(this.statusMessage); + } + } + + synchronized(this.nextAvatarMutex) { + if (this.nextAvatar != null) { + this.setAvatar(this.nextAvatar); + this.nextAvatar = null; + if (this.avatarMenu != null) { + this.avatarMenu.notifyOfChange(); + } + + if (this.nextAvatarItem != null) { + this.setCurrentAvatarItem(this.nextAvatarItem); + this.nextAvatarItem = null; + } + } + + } + } + } + + private void checkVMWarning() { + int var1 = Std.getFastTime(); + if (var1 > this.lastVMCheck + 10000) { + StatMemNode var2 = StatMemNode.getNode(); + var2.updateMemoryStatus(); + if (var2._availPageMem < 0) { + var2._availPageMem = 2000000000; + } + + if (var2._totPhysMem < 0) { + var2._totPhysMem = 2000000000; + } + + physMem = var2._totPhysMem; + if (var2._availPageMem >= 4194304) { + if (var2._availPageMem > 5242880 && this.lastVMBigWarning != 0) { + if (var2._availPageMem > 10485760) { + Console.println(Console.message("plenty-virt")); + this.lastVMBigWarning = 0; + } else if (!this.showedMidWarn) { + Console.println(Console.message("plenty-virt-mem")); + this.showedMidWarn = true; + } + + if (this.statusMessage == lowVMMsg) { + this.statusMessage = ""; + } + } } else { - (new SendURLAction(var16)).startBrowser(); - } - } else if (var1.target == this.i18nTest) { - Locale var24 = Locale.getDefault(); - Console.println("Default = " + var24.getDisplayName()); - DateFormat var25 = DateFormat.getDateTimeInstance(1, 1); - Date var18 = new Date(); - Console.println("Today = " + var25.format(var18)); - Locale[] var20 = DateFormat.getAvailableLocales(); - Console.println("Avaliable Locales are:"); - - for(int var7 = 0; var7 < var20.length; ++var7) { - Locale.setDefault(var20[var7]); - Console.println(var20[var7].getDisplayName() + " " + var20[var7]); - } - - new Locale("en", "US"); - Locale var9 = new Locale("fr", "FR"); - Locale var10 = new Locale("de", "DE"); - Locale var11 = new Locale("ja", "JP"); - Locale var12 = new Locale("zh", "CN"); - Locale var13 = new Locale("th", "TH"); - Locale var14 = new Locale("ru", "RU"); - Locale var15 = new Locale("iw", "IL"); - Console.println("file.encoding = " + System.getProperty("file.encoding")); - Console.println(this.message("test-language", var9)); - Console.println(this.message("test-language", var10)); - Console.println(this.message("test-language", var11)); - Console.println(this.message("test-language", var12)); - Console.println(this.message("test-language", var13)); - Console.println(this.message("test-language", var14)); - Console.println(this.message("test-language", var15)); - Console.println(this.message("test-language", var24)); - } else if (var1.target == this.checkAccountItem) { - var16 = IniFile.override().getIniString("accountOverride", ""); - if (var16.equals("")) { - var4 = IniFile.override().getIniString("accountInfoPage", "account" + Console.message(".pl")); - if (Console.wasHttpNoSuchFile(this.getScriptServer() + var4)) { - var4 = IniFile.override().getIniString("accountInfoPage", "account.pl"); - } + if (this.lastVMBigWarning == 0 || this.showedMidWarn || var1 > this.lastVMBigWarning + 300000) { + Console.println(Console.message("Low-virt-mem")); + this.lastVMBigWarning = var1; + this.showedMidWarn = false; + } - (new SendURLAction(this.getScriptServer() + var4, true)).startBrowser(); - } else { - (new SendURLAction(var16)).startBrowser(); + this.statusMessage = lowVMMsg; } - this.relogin(); - } else if (var1.target == this.upgradeItem) { - NetUpdate.doUpdate(true); - } else if (var1.target == this.channelItem && this.channelItem != null) { - Galaxy var23 = this.getGalaxy(); - var4 = ""; - Debug.dAssert(var23 != null); - if (var23 != null) { - var4 = var23.getChannel(); - } - - new ChannelDialog(Console.getFrame(), this, Console.message("Dimension-Sel"), var4); - } else if (var1.target == this.becomeVIPItem) { - var16 = IniFile.override().getIniString("vipOverride", ""); - if (var16.equals("")) { - var4 = IniFile.override().getIniString("vipPage", "vip" + Console.message(".pl")); - if (Console.wasHttpNoSuchFile(this.getScriptServer() + var4)) { - var4 = IniFile.override().getIniString("vipPage", "vip.pl"); - } + Object[] var3 = new Object[]{new String(Std.getProductName()), new Integer(24)}; + if (startupMemCheck) { + if (var2._totPhysMem < 24000000) { + String var4 = MessageFormat.format(Console.message("Mem-detected"), var3); + new OkCancelDialog(getFrame(), (DialogReceiver)null, Console.message("Too-Little-RAM"), (String)null, Console.message("OK"), var4, true); + } - (new SendURLAction(this.getScriptServer() + var4, true)).startBrowser(); - } else { - (new SendURLAction(var16, false)).startBrowser(); + startupMemCheck = false; + System.out.println("System has " + var2._totPhysMem + " bytes of physical RAM"); } - this.relogin(); - } else if (var1.target == this.numVisItem) { - new SetNumVisibleAvs(); - } else if (var1.target == this.inventoryItem) { - EquipAction var22 = new EquipAction(); - var22.trigger((NET.worlds.scape.Event)null, (Persister)null); - } else if (var1.target == this.proxyServerItem) { - System.out.println("Triggering the Proxy Server dialog."); - ProxyServerDialog var21 = new ProxyServerDialog(); - var21.show(); - } else if (var1.target == this.toggleVoiceChatItem) { - VoiceChat.setVoiceChatEnabled(!VoiceChat.voiceChatEnabled); - this.setMenusWRTVIP(); - } else if (var1.target == this.serverItem) { - this.handleServerItem(); - } else if (var1.target == this.condenseItem) { - new ArchiveMaker(true); - } else if (var1.target == this.expandItem) { - new ArchiveMaker(false); - } else if (var1.target == this.musicManItem) { - MusicManager.showDialog(); - } else if (var1.target == this.cdPlayerItem) { - if (this.cdcontrol == null) { - this.playedCD = true; - this.cdcontrol = new CDControl(Console.getFrame(), this); - } - } else if (var1.target == this.volumeItem) { - if (!CDPlayerAction.launchVolumeControlApp()) { - new OkCancelDialog(Console.getFrame(), (DialogReceiver)null, Console.message("No-Volume"), (String)null, Console.message("OK"), Console.message("Cannot-locate"), true); - } - } else if (var1.target == this.graphicsItem) { - this.handleGraphicsItem(); - } else if (var1.target == this.nametagItem) { - this.handleNametagsItem(); - } else if (var1.target == this.chatBoxItem) { - this.handleChatBoxItem(); - } else if (var1.target == this.bootSomeone) { - new BootDialog(Console.getFrame(), this, Console.message("Boot-user")); - } else if (var1.target == this.broadcastToRoom) { - Console.startWhispering("room"); - } else if (var1.target == this.broadcastToAll) { - Console.startWhispering("world"); - } else if (var1.target == this.currentLang) { - var16 = Locale.getDefault().toString(); - if (var16 == Console.message(var16)) { - Console.println(Console.message("Current-Language") + " = " + Locale.getDefault().getDisplayName()); - } else { - Console.println(Console.message("Current-Language") + " = " + Console.message(var16)); - } - } else if (var1.target == this.recorderPlayItem) { - Console.println(Console.message("BlackBoxPlay")); - BlackBox.getInstance().play(); - } else if (var1.target == this.recorderRecItem) { - Console.println(Console.message("BlackBoxRec")); - BlackBox.getInstance().record(); - } else if (var1.target == this.recorderStopItem) { - Console.println(Console.message("BlackBoxStop")); - BlackBox.getInstance().stop(); - } else { - int var5; - String var6; - int var17; - if (this.fontItems != null && this.fontItems.contains(var1.target)) { - var16 = IniFile.gamma().getIniString("upgradeServer", "") + "/I18N/font_"; - - for(var17 = 0; var17 < this.fLength; ++var17) { - if (var1.target == this.fontItems.elementAt(var17)) { - if (this.fsList.elementAt(var17) != null) { - var16 = var16 + this.flList.elementAt(var17) + "_" + this.fsList.elementAt(var17) + ".EXE"; - } else { - var16 = var16 + this.flList.elementAt(var17) + ".EXE"; - } - - var5 = this.fSizes[var17]; - var6 = var16.substring(var16.lastIndexOf(47) + 1, var16.length()); - LanguageManager.handle(var16, var5, var6); - break; - } - } - } else if (this.downItems != null && this.downItems.contains(var1.target)) { - var16 = IniFile.gamma().getIniString("upgradeServer", "") + "/I18N/language_"; - - for(var17 = 0; var17 < this.dLength; ++var17) { - if (var1.target == this.downItems.elementAt(var17)) { - if (this.sList.elementAt(var17) != null) { - var16 = var16 + this.lList.elementAt(var17) + "_" + this.sList.elementAt(var17) + ".zip"; - IniFile.gamma().setIniString("DEFAULTLANGUAGE", (String)this.lList.elementAt(var17) + "_" + this.sList.elementAt(var17)); - } else { - var16 = var16 + this.lList.elementAt(var17) + ".zip"; - IniFile.gamma().setIniString("DEFAULTLANGUAGE", (String)this.lList.elementAt(var17)); - } - - var5 = this.lSizes[var17]; - var6 = var16.substring(var16.lastIndexOf(47) + 1, var16.length()); - LanguageManager.handle(var16, var5, var6); - break; - } - } - } else if (this.langItems != null && this.langItems.contains(var1.target)) { - for(int var3 = 0; var3 < lLength; ++var3) { - if (var1.target == this.langItems.elementAt(var3)) { - Locale.setDefault(newLocale[var3]); - var4 = newLocale[var3].toString(); - if (var4 == Console.message(var4)) { - Console.println(Console.message("Setting-to") + " " + newLocale[var3].getDisplayName()); - } else { - Console.println(Console.message("Setting-to") + " " + Console.message(var4)); - } - - IniFile.gamma().setIniString("DEFAULTLANGUAGE", lCodes[var3][0] + "_" + lCodes[var3][1]); - new OkCancelDialog(Console.getFrame(), (DialogReceiver)null, Console.message("Alert"), (String)null, Console.message("OK"), Console.message("Change-exit"), true); - break; - } - } - } else if (this.avatarMenu == null || !this.avatarMenu.action(var1, var2)) { - return super.action(var1, var2); - } - } - } - - return true; - } - - public void setCurrentAvatarItem(CheckboxMenuItem var1) { - if (this.curAvatarItem != null) { - this.curAvatarItem.setState(false); - } - - this.curAvatarItem = var1; - if (this.curAvatarItem != null) { - this.curAvatarItem.setState(true); - } - - } - - public CheckboxMenuItem getCurrentAvatarItem() { - return this.curAvatarItem; - } - - public void deletedSavedAvatar(CheckboxMenuItem var1) { - if (this.curAvatarItem == var1) { - this.findAvatarMenuItem(this.getDefaultAvatarURL()); - } - - } - - public void setNextAvatar(URL var1, CheckboxMenuItem var2) { - Object var3 = this.nextAvatarMutex; - synchronized(var3) { - this.nextAvatar = var1; - this.nextAvatarItem = var2; - } - } - - private void findAvatarMenuItem(URL var1) { - Object var2 = this.nextAvatarMutex; - synchronized(var2) { - if (this.nextAvatarItem == null) { - Object var3; - if ((this.savedAvs == null || (var3 = this.savedAvs.findMenuItem(var1)) == null) && (this.avatarMenu == null || (var3 = this.avatarMenu.findMenuItem(var1)) == null)) { - this.setCurrentAvatarItem((CheckboxMenuItem)null); - } else { - this.setCurrentAvatarItem((CheckboxMenuItem)var3); - } - } + this.lastVMCheck = var1; + } - } - } + } - private URL getHelpGettingStarted() { - IniFile var1 = new IniFile("InstalledWorlds"); - String var2 = Console.message("Getting-started"); - String var3 = var1.getIniString("InstalledWorld0", ""); - if (!var3.equals("")) { - URL var4 = URL.make("home:" + var3 + "/" + var2); - File var5 = new File(var4.unalias()); - if (var5.exists()) { - return var4; - } - } - - return URL.make("home:" + var2); - } - - private void changeView(CheckboxMenuItem var1) { - this.chooseView = this.viewItems.indexOf(var1); - if (var1 != this.currentViewItem) { - this.currentViewItem.setState(false); - this.currentViewItem = var1; - this.currentViewItem.setState(true); - } - - } - - private int getView() { - return this.viewItems.indexOf(this.currentViewItem); - } - - private void setView(int var1) { - this.changeView((CheckboxMenuItem)this.viewItems.elementAt(var1)); - } - - private void changeCamSpeed(CheckboxMenuItem var1) { - this.chooseCamSpeed = this.camSpeedItems.indexOf(var1); - if (var1 != this.currentCamSpeedItem) { - this.currentCamSpeedItem.setState(false); - this.currentCamSpeedItem = var1; - this.currentCamSpeedItem.setState(true); - } - - } - - public void resetCamera() { - if (this.viewItems != null && this.camSpeedItems != null) { - this.chooseView = this.viewItems.indexOf(this.currentViewItem); - this.chooseCamSpeed = this.camSpeedItems.indexOf(this.currentCamSpeedItem); - } - } - - private void handleServerItem() { - if (!this.serverItem.getLabel().equals(signIn)) { - Galaxy.forceOffline(false); - } else { - this.getGalaxy().localForceOnline(); - this.getGalaxy().waitForConnection(this); - } - - } - - public UniversePanel getUniverse() { - return this.universeMode ? this.universe : null; - } - - public synchronized void setUniverseMode(boolean var1) { - if (var1 != this.universeMode) { - this.universeMode = var1; - if (this.universeMode) { - if (this.universe == null) { - this.universe = new UniversePanel(this); - this.renderAndUniverse.add("universe", this.universe); - } - - this.renderCard.show(this.renderAndUniverse, "universe"); - this.universe.startWatch(); - this.render.requestFocus(); - } else { - this.renderCard.show(this.renderAndUniverse, "render"); - if (physMem < 64000000) { - this.renderAndUniverse.remove(this.universe); - this.universe.stopWatch(); - this.universe.flushImage(); - this.universe = null; - } - - this.renderAndUniverse.repaint(); - } - - } - } - - public void toggleUniverseMode() { - this.setUniverseMode(!this.universeMode); - } - - public boolean isUniverseMode() { - return this.universeMode; - } - - public Object imageButtonsCallback(Component var1, int var2) { - if (var1 != this.driveButton) { - if (var1 == this.quitButton) { - Console.maybeQuit(); - } else if (var1 == this.exploreButton) { - this.toggleUniverseMode(); - } else if (var1 == this.menuButtons) { - switch(var2) { - case 0: - return this.getMenu("Help"); - case 1: - return this.getMenu("Options"); - case 2: - EMailPart.showMessage(this); - break; - case 3: - return (PopupMenu)this.marks.getMenu(); - case 4: - return (PopupMenu)this.marks.getLetsMenu(); - case 5: - this.actions.present(); - break; - case 6: - return this.getMenu("VIP"); - } - } - } - - return null; - } - - public RenderCanvas getRender() { - return this.render; - } - - public FriendsListPart getFriends() { - return this.friends; - } - - public MuteListPart getMutes() { - return this.mutes; - } - - public void generateFrameEvents(FrameEvent var1) { - if (Window.getWindowState(Window.getFrameHandle()) == 1) { - this.goToSleep(); - } - - if (doDrive) { - doDrive = false; - this.render.drive(); - wasDelta = true; - } - - super.generateFrameEvents(var1); - Pilot var2 = Pilot.getActive(); - GammaFrame var3 = Console.getFrame(); - String var4 = var3.getTitle(); - String var5 = ""; - if (var2 != null) { - World var6 = var2.getWorld(); - if (var6 != null) { - String var7 = var6.getName(); - if (var7 != null) { - var5 = var7; - } - } - } - - if (!lastWorldName.equals(var5)) { - lastWorldName = var5; - String var14 = GammaFrame.getDefaultTitle(); - if (var5.length() != 0) { - var14 = var14 + " - " + var5; - if (!this.playedCD) { - CDAudio.startupPlay(); - this.playedCD = true; - } - } - - var3.setTitle(var14); - } - - if (var2 != null) { - if (this.chooseView != -1 || this.chooseCamSpeed != -1) { - int var15 = var2.getOutsideCameraMode(); - int var16 = var2.getOutsideCameraSpeed(); - int var8 = var15; - int var9 = var16; - if (this.chooseView != -1) { - var8 = ((DefaultConsole.CameraView)this.viewNames.elementAt(this.chooseView)).viewID; - } - - if (this.chooseCamSpeed != -1) { - var9 = ((DefaultConsole.CameraSpeed)this.speedNames.elementAt(this.chooseCamSpeed)).speedID; - } - - var2.setOutsideCameraMode(var8, var9); - if (var8 != 99) { - IniFile.gamma().setIniInt("CAM_MODE", var8); - IniFile.gamma().setIniInt("CAM_SPEED", var9); - } - - this.chooseView = -1; - this.chooseCamSpeed = -1; - } - - if (this.wasTeleporting != this.marks.isTeleporting()) { - this.wasTeleporting = this.marks.isTeleporting(); - if (this.wasTeleporting) { - this.statusMessage = loadingString; - } else if (this.statusMessage == loadingString) { - this.statusMessage = ""; - } - } - - this.checkVMWarning(); - if (wasDelta && !this.render.getDeltaMode()) { - this.statusMessage = arrowKeyMsg; - wasDelta = false; - this.driveButton.drawCursed(); - } - - Label var17 = this.status; - synchronized(var17) { - if (this.statusMessage != this.lastStatus && this.overrideMessage == null) { - this.lastStatus = this.statusMessage; - this.status.setText(this.statusMessage); - } - } - - Object var10 = this.nextAvatarMutex; - synchronized(var10) { - if (this.nextAvatar != null) { - this.setAvatar(this.nextAvatar); - this.nextAvatar = null; - if (this.avatarMenu != null) { - this.avatarMenu.notifyOfChange(); - } - - if (this.nextAvatarItem != null) { - this.setCurrentAvatarItem(this.nextAvatarItem); - this.nextAvatarItem = null; - } - } - - } - } - } - - private void checkVMWarning() { - int var1 = Std.getFastTime(); - if (var1 > this.lastVMCheck + 10000) { - StatMemNode var2 = StatMemNode.getNode(); - var2.updateMemoryStatus(); - if (var2._availPageMem < 0) { - var2._availPageMem = 2000000000; - } - - if (var2._totPhysMem < 0) { - var2._totPhysMem = 2000000000; - } - - physMem = var2._totPhysMem; - if (var2._availPageMem >= 4194304) { - if (var2._availPageMem > 5242880 && this.lastVMBigWarning != 0) { - if (var2._availPageMem > 10485760) { - Console.println(Console.message("plenty-virt")); - this.lastVMBigWarning = 0; - } else if (!this.showedMidWarn) { - Console.println(Console.message("plenty-virt-mem")); - this.showedMidWarn = true; - } - - if (this.statusMessage == lowVMMsg) { - this.statusMessage = ""; - } - } - } else { - if (this.lastVMBigWarning == 0 || this.showedMidWarn || var1 > this.lastVMBigWarning + 300000) { - Console.println(Console.message("Low-virt-mem")); - this.lastVMBigWarning = var1; - this.showedMidWarn = false; - } - - this.statusMessage = lowVMMsg; - } - - Object[] var3 = new Object[]{new String(Std.getProductName()), new Integer(24)}; - if (startupMemCheck) { - if (var2._totPhysMem < 24000000) { - String var4 = MessageFormat.format(Console.message("Mem-detected"), var3); - new OkCancelDialog(Console.getFrame(), (DialogReceiver)null, Console.message("Too-Little-RAM"), (String)null, Console.message("OK"), var4, true); - } - - startupMemCheck = false; - System.out.println("System has " + var2._totPhysMem + " bytes of physical RAM"); - } - - this.lastVMCheck = var1; - } - - } - - public URL getAvatarName() { - return this.avatarURL; - } - - public void setServerURL(URL var1) { - super.setServerURL(var1); - } - - public void dialogDone(Object var1, boolean var2) { - if (var1 instanceof QuitDialog) { - if (var2) { - Console.quit(); - } - } else { - String var4; - if (var1 instanceof BootDialog) { + public URL getAvatarName() { + return this.avatarURL; + } + + public void setServerURL(URL var1) { + super.setServerURL(var1); + } + + public void dialogDone(Object var1, boolean var2) { + if (var1 instanceof QuitDialog) { if (var2) { - BootDialog var3 = (BootDialog)var1; - var4 = var3.getBoot(); - if (!var4.equals("")) { - Pilot.sendText("world", "!boot " + var4); - } + Console.quit(); } - } else if (var1 instanceof ChannelDialog) { - if (var2) { - ChannelDialog var9 = (ChannelDialog)var1; - var4 = var9.getChannel(); - Pilot var5 = Pilot.getActive(); - String var6 = var5 != null ? var5.getURL() : null; - if (var6 != null) { - int var7 = var6.indexOf("<"); - int var8 = var6.indexOf(">"); - if (var7 >= 0 && var8 > var7) { - TeleportAction.teleport(var6.substring(0, var7 + 1) + var4 + var6.substring(var8), (TeleportStatus)null); - } - } else { - Console.println(Console.message("cant-determine")); - } - } - } else if (var1 instanceof LoginWizard) { - Debug.dAssert(false); - } else if (var1 instanceof CDControl) { - if (this.cdcontrol == var1) { - this.cdcontrol = null; - } - } else if (var1 instanceof InternetConnectionDialog) { - Debug.dAssert(false); - } else if (var1 == this.reloginDialog) { - if (var2) { - Galaxy.forceOffline(true); + } else { + String var4; + if (var1 instanceof BootDialog) { + if (var2) { + BootDialog var3 = (BootDialog)var1; + var4 = var3.getBoot(); + if (!var4.equals("")) { + Pilot.sendText("world", "!boot " + var4); + } + } + } else if (var1 instanceof ChannelDialog) { + if (var2) { + ChannelDialog var9 = (ChannelDialog)var1; + var4 = var9.getChannel(); + Pilot var5 = Pilot.getActive(); + String var6 = var5 != null ? var5.getURL() : null; + if (var6 != null) { + int var7 = var6.indexOf("<"); + int var8 = var6.indexOf(">"); + if (var7 >= 0 && var8 > var7) { + TeleportAction.teleport(var6.substring(0, var7 + 1) + var4 + var6.substring(var8), (TeleportStatus)null); + } + } else { + Console.println(Console.message("cant-determine")); + } + } + } else if (var1 instanceof LoginWizard) { + Debug.dAssert(false); + } else if (var1 instanceof CDControl) { + if (this.cdcontrol == var1) { + this.cdcontrol = null; + } + } else if (var1 instanceof InternetConnectionDialog) { + Debug.dAssert(false); + } else if (var1 == this.reloginDialog) { + if (var2) { + Galaxy.forceOffline(true); + } + + this.reloginDialog = null; + } + } + + } + + public void setAvatar(URL var1) { + this.avatarURL = var1; + boolean var2 = var1.getInternal().toLowerCase().endsWith(".rwg"); + boolean var3 = var1.equals(getDefaultURL()) && !this.getGalaxy().getOnline(); + if (!this.getFullVIP() && var2 && !var3) { + Console.println(Console.message("Only-VIPs") + " '" + SelectAvatarAction.getPrettyAvatarName(var1.getBase()) + "'."); + } else if (VehicleShape.isVehicle(var1)) { + this.tempCarAvatar = var1.getAbsolute(); + super.setAvatar(var1); + } else { + this.tempCarAvatar = ""; + if (this.avatarMenu != null) { + this.avatarMenu.customize.setEnabled(!var1.getAbsolute().endsWith("mov")); + } + + if (!var1.equals(this.getDefaultAvatarURL())) { + if (this.getFullVIP()) { + if (!var2) { + IniFile.gamma().setIniString("VIPAVATAR", ""); + } else { + IniFile.gamma().setIniString("VIPAVATAR", var1.getAbsolute()); + } + } + + if (!var2) { + IniFile.gamma().setIniString("AVATAR", var1.getAbsolute()); + } + } + + super.setAvatar(var1); + } + } + + private CheckboxMenuItem findAvatar(Vector var1, String var2) { + if (var1 != null) { + int var3 = var1.size(); + + for(int var4 = 0; var4 < var3; ++var4) { + CheckboxMenuItem var5 = (CheckboxMenuItem)var1.elementAt(var4); + if (var5.getLabel().equals(var2)) { + return var5; + } + } + } + + return null; + } + + protected void loadPilot(URL var1) { + super.loadPilot(var1); + this.findAvatarMenuItem(var1); + } + + public void setChatname(String var1) { + Debug.dAssert(var1 != null); + if (var1.length() != 0) { + String var2 = (this.getVIP() ? (vip > 1 ? Console.message("VIP") + " " : Console.message("vip")) + " " : "") + "\"" + Console.parseUnicode(var1) + "\""; + this.yourName.setText(var2); + IniFile.gamma().setIniString("LASTCHATNAME", parseExtended(var2)); + } else { + this.yourName.setText(Console.message("Off-line")); + } + + } + + public void connectionCallback(Object var1, boolean var2) { + super.connectionCallback(var1, var2); + if (var1 instanceof Galaxy) { + if (var1 != this.galaxy) { + return; } - this.reloginDialog = null; - } - } - - } - - public void setAvatar(URL var1) { - this.avatarURL = var1; - boolean var2 = var1.getInternal().toLowerCase().endsWith(".rwg"); - boolean var3 = var1.equals(Console.getDefaultURL()) && !this.getGalaxy().getOnline(); - if (!this.getVIP() && var2 && !var3) { - Console.println(Console.message("Only-VIPs") + " '" + SelectAvatarAction.getPrettyAvatarName(var1.getBase()) + "'."); - } else if (VehicleShape.isVehicle(var1)) { - super.tempCarAvatar = var1.getAbsolute(); - super.setAvatar(var1); - } else { - super.tempCarAvatar = ""; - if (this.avatarMenu != null) { - this.avatarMenu.customize.setEnabled(!var1.getAbsolute().endsWith("mov")); - } - - if (!var1.equals(this.getDefaultAvatarURL())) { - if (this.getVIP()) { - if (!var2) { - IniFile.gamma().setIniString("VIPAVATAR", ""); - } else { - IniFile.gamma().setIniString("VIPAVATAR", var1.getAbsolute()); - } - } - - if (!var2) { - IniFile.gamma().setIniString("AVATAR", var1.getAbsolute()); - } - } - - super.setAvatar(var1); - } - } - - private CheckboxMenuItem findAvatar(Vector var1, String var2) { - if (var1 != null) { - int var3 = var1.size(); - - for(int var4 = 0; var4 < var3; ++var4) { - CheckboxMenuItem var5 = (CheckboxMenuItem)var1.elementAt(var4); - if (var5.getLabel().equals(var2)) { - return var5; - } - } - } - - return null; - } - - protected void loadPilot(URL var1) { - super.loadPilot(var1); - this.findAvatarMenuItem(var1); - } - - public void setChatname(String var1) { - Debug.dAssert(var1 != null); - if (var1.length() != 0) { - String var2 = (this.getVIP() ? (Console.vip > 1 ? Console.message("VIP") + " " : Console.message("vip")) + " " : "") + "\"" + Console.parseUnicode(var1) + "\""; - this.yourName.setText(var2); - IniFile.gamma().setIniString("LASTCHATNAME", Console.parseExtended(var2)); - } else { - this.yourName.setText(Console.message("Off-line")); - } - - } - - public void connectionCallback(Object var1, boolean var2) { - super.connectionCallback(var1, var2); - if (var1 instanceof Galaxy) { - if (var1 != super.galaxy) { - return; - } - - if (var2) { - WorldServer var3 = this.getServerNew(); - this.friends.setServer(var3, this.getGalaxy().getIniSection()); - this.mutes.setServer(var3, this.getGalaxy().getIniSection()); - if (Console.vip < 2) { - Console.println(Console.vip == 1 ? Console.message("Press-full-VIP") : Console.message("Press-VIP")); - } - - PosableShape.downloadPermittedNames(); - } - } - - } - - public void galaxyDisconnected() { - super.galaxyDisconnected(); - this.getFriends().maybeServerDisconnect(); - } - - public boolean okToQuit() { - int var1 = IniFile.override().getIniInt("QuitDialog", 1); - if (var1 == 1) { - new QuitDialog(Console.getFrame(), this); - return false; - } else { - return true; - } - } - - public Rectangle getBrowserPlacement() { - String var1 = IniFile.gamma().getIniString("BROWSERWINDOW", ""); - if (var1.length() != 0) { - StringTokenizer var2 = new StringTokenizer(var1, " ,"); - - try { - return new Rectangle(Integer.parseInt(var2.nextToken()), Integer.parseInt(var2.nextToken()), Integer.parseInt(var2.nextToken()), Integer.parseInt(var2.nextToken())); - } catch (NumberFormatException var10) { - } catch (NoSuchElementException var11) { - } - } - - Point var12 = this.menuButtons.getLocationOnScreen(); - int var3 = this.menuButtons.getLocationOnScreen().x - (int)((double)this.menuButtons.getSize().width * 0.7D); - int var4 = Window.getSystemMetrics(32); - int var5 = Toolkit.getDefaultToolkit().getScreenSize().width; - int var6 = Math.min(var5, 640) + 2 * var4; - int var7 = 0; - if (var3 != var6) { - if (var3 > var6) { - var7 += var3 - var6; - } - - var3 = var6; - } - - if (var3 > var5) { - var7 += -var4; - } - - int var8 = this.chat.listen.getLocationOnScreen().y + this.chat.listen.getSize().height - this.chat.line.getSize().height; - int var9 = 0; - if (var8 > 540) { - var9 += var8 - 540; - var8 = 540; - } - - return new Rectangle(var7, var9, var3, var8); - } - - public Object properties(int var1, int var2, int var3, Object var4) throws NoSuchPropertyException { - Object var5 = null; - switch(var1 - var2) { - case 0: - if (var3 == 0) { - var5 = URLPropertyEditor.make(new Property(this, var1, "Avatar"), "rwg;mov"); - } else if (var3 == 1) { - var5 = super.lastPilotRequested; - } else if (var3 == 2) { - this.setNextAvatar((URL)var4, (CheckboxMenuItem)null); - } - break; - case 1: - if (var3 == 0) { - var5 = BooleanPropertyEditor.make(new Property(this, var1, "Collect garbage"), "No", "Yes"); - } else if (var3 == 1) { - var5 = new Boolean(false); - } else if (var3 == 2 && (Boolean)var4) { - System.gc(); - System.runFinalization(); - } - break; - default: - var5 = super.properties(var1, var2 + 2, var3, var4); - } - - return var5; - } - - public void saveState(Saver var1) throws IOException { - var1.saveVersion(0, classCookie); - super.saveState(var1); - } - - public void restoreState(Restorer var1) throws IOException, TooNewException { - int var2 = var1.restoreVersion(classCookie); - switch(var2) { - case 0: - super.restoreState(var1); - return; - default: - throw new TooNewException(); - } - } - - static { - lLength = lNames.length; - lLangs = new MenuItem[lLength]; - newLocale = new Locale[lLength]; - lCodes = new String[lLength][2]; - signIn = Console.message("Sign-In"); - signOut = Console.message("Sign-Out"); - signingIn = Console.message("Signing-In"); - noMultiUser = Console.message("Network"); - enable3D = Console.message("Enable3D"); - disable3D = Console.message("Disable3D"); - showTags = Console.message("ShowNametags"); - hideTags = Console.message("HideNametags"); - enableClassicChat = Console.message("EnableClassicChat"); - disableClassicChat = Console.message("DisableClassicChat"); - sleepStatus = Console.message("Sleeping"); - lastWorldName = ""; - lowVMMsg = Console.message("Low-virt"); - startupMemCheck = true; - classCookie = new Object(); - } - - private class CameraSpeed { - public String speedName; - public int speedID; - - public CameraSpeed(String var2, int var3) { - this.speedName = var2; - this.speedID = var3; - } - } - - private class CameraView { - public String viewName; - public int viewID; - - public CameraView(String var2, int var3) { - this.viewName = var2; - this.viewID = var3; - } - } + if (var2) { + WorldServer var3 = this.getServerNew(); + this.friends.setServer(var3, this.getGalaxy().getIniSection()); + this.mutes.setServer(var3, this.getGalaxy().getIniSection()); + this.tars.setServer(var3, this.getGalaxy().getIniSection()); + if (vip < 2) { + Console.println(vip == 1 ? Console.message("Press-full-VIP") : Console.message("Press-VIP")); + } + + PosableShape.downloadPermittedNames(); + } + } + + } + + public void galaxyDisconnected() { + super.galaxyDisconnected(); + this.getFriends().maybeServerDisconnect(); + } + + public boolean okToQuit() { + int var1 = IniFile.override().getIniInt("QuitDialog", 1); + if (var1 == 1) { + new QuitDialog(getFrame(), this); + return false; + } else { + return true; + } + } + + public Rectangle getBrowserPlacement() { + String var1 = IniFile.gamma().getIniString("BROWSERWINDOW", ""); + if (var1.length() != 0) { + StringTokenizer var2 = new StringTokenizer(var1, " ,"); + + try { + return new Rectangle(Integer.parseInt(var2.nextToken()), Integer.parseInt(var2.nextToken()), Integer.parseInt(var2.nextToken()), Integer.parseInt(var2.nextToken())); + } catch (NumberFormatException var10) { + } catch (NoSuchElementException var11) { + } + } + + Point var12 = this.menuButtons.getLocationOnScreen(); + int var3 = this.menuButtons.getLocationOnScreen().x - (int)((double)this.menuButtons.getSize().width * 0.7D); + int var4 = Window.getSystemMetrics(32); + int var5 = Toolkit.getDefaultToolkit().getScreenSize().width; + int var6 = Math.min(var5, 640) + 2 * var4; + int var7 = 0; + if (var3 != var6) { + if (var3 > var6) { + var7 += var3 - var6; + } + + var3 = var6; + } + + if (var3 > var5) { + var7 += -var4; + } + + int var8 = this.chat.listen.getLocationOnScreen().y + this.chat.listen.getSize().height - this.chat.line.getSize().height; + int var9 = 0; + if (var8 > 540) { + var9 += var8 - 540; + var8 = 540; + } + + return new Rectangle(var7, var9, var3, var8); + } + + public Object properties(int var1, int var2, int var3, Object var4) throws NoSuchPropertyException { + Object var5 = null; + switch(var1 - var2) { + case 0: + if (var3 == 0) { + var5 = URLPropertyEditor.make(new Property(this, var1, "Avatar"), "rwg;mov;rwx"); + } else if (var3 == 1) { + var5 = this.lastPilotRequested; + } else if (var3 == 2) { + this.setNextAvatar((URL)var4, (CheckboxMenuItem)null); + } + break; + case 1: + if (var3 == 0) { + var5 = BooleanPropertyEditor.make(new Property(this, var1, "Collect garbage"), "No", "Yes"); + } else if (var3 == 1) { + var5 = new Boolean(false); + } else if (var3 == 2 && ((Boolean)var4).booleanValue()) { + System.gc(); + System.runFinalization(); + } + break; + default: + var5 = super.properties(var1, var2 + 2, var3, var4); + } + + return var5; + } + + public void saveState(Saver var1) throws IOException { + var1.saveVersion(0, classCookie); + super.saveState(var1); + } + + public void restoreState(Restorer var1) throws IOException, TooNewException { + int var2 = var1.restoreVersion(classCookie); + switch(var2) { + case 0: + super.restoreState(var1); + return; + default: + throw new TooNewException(); + } + } + + static { + lLength = lNames.length; + lLangs = new MenuItem[lLength]; + newLocale = new Locale[lLength]; + lCodes = new String[lLength][2]; + signIn = Console.message("Sign-In"); + signOut = Console.message("Sign-Out"); + signingIn = Console.message("Signing-In"); + noMultiUser = Console.message("Network"); + enable3D = Console.message("Enable3D"); + disable3D = Console.message("Disable3D"); + showTags = Console.message("ShowNametags"); + hideTags = Console.message("HideNametags"); + enableClassicChat = Console.message("EnableClassicChat"); + disableClassicChat = Console.message("DisableClassicChat"); + sleepStatus = Console.message("Sleeping"); + lastWorldName = ""; + lowVMMsg = Console.message("Low-virt"); + startupMemCheck = true; + classCookie = new Object(); + } + + private class CameraSpeed { + public String speedName; + public int speedID; + + public CameraSpeed(String var2, int var3) { + this.speedName = var2; + this.speedID = var3; + } + } + + private class CameraView { + public String viewName; + public int viewID; + + public CameraView(String var2, int var3) { + this.viewName = var2; + this.viewID = var3; + } + } + + private class WhisperPrivacy { + public String whisperName; + public int whisperID; + + public WhisperPrivacy(String var2, int var3) { + this.whisperName = var2; + this.whisperID = var3; + } + } + + private class TeleportPrivacy { + public String teleportName; + public int teleportID; + + public TeleportPrivacy(String var2, int var3) { + this.teleportName = var2; + this.teleportID = var3; + } + } } diff -ruN a/1890/NET/worlds/console/FriendsListPart.java b/1890/NET/worlds/console/FriendsListPart.java --- a/1890/NET/worlds/console/FriendsListPart.java 2023-08-21 23:27:15.000000000 -0500 +++ b/1890/NET/worlds/console/FriendsListPart.java 2023-08-21 23:27:17.000000000 -0500 @@ -3,14 +3,7 @@ import NET.worlds.core.Debug; import NET.worlds.core.IniFile; import NET.worlds.core.Std; -import NET.worlds.network.BuddyListUpdateCmd; -import NET.worlds.network.Galaxy; -import NET.worlds.network.InfiniteWaitException; -import NET.worlds.network.NetUpdate; -import NET.worlds.network.PacketTooLargeException; -import NET.worlds.network.WorldServer; -import NET.worlds.network.netPacket; -import NET.worlds.network.whisperCmd; +import NET.worlds.network.*; import NET.worlds.scape.AnimatedActionManager; import NET.worlds.scape.Drone; import NET.worlds.scape.FrameEvent; @@ -20,6 +13,7 @@ import NET.worlds.scape.PosableShape; import NET.worlds.scape.TeleportAction; import NET.worlds.scape.TeleportStatus; + import java.awt.Color; import java.awt.Container; import java.awt.Dimension; @@ -30,6 +24,7 @@ import java.awt.Menu; import java.awt.MenuItem; import java.awt.PopupMenu; +import java.awt.Window; import java.awt.image.ImageObserver; import java.io.IOException; import java.text.MessageFormat; @@ -38,943 +33,967 @@ import java.util.Vector; public class FriendsListPart extends QuantizedCanvas implements FramePart, DialogReceiver, DialogDisabled, NameListOwner { - private static final String oldIniItemName = "Friends"; - private static final String iniItemName = "Friend"; - private static int maxFriends = Gamma.shaperEnabled() ? 60 : 30; - private static int absMaxFriends = 100; - private static final String separator = ";"; - private static final String whereQuery = "&|+where?"; - private static final String whereResponse = "&|+where>"; - VoiceChat chatter = new VoiceChat(); - private static final int MOUSEMOVE = 0; - private static final int MOUSEDRAG = 1; - private static final int MOUSEDOWN = 2; - private static final int MOUSEUP = 3; - private static final int MOUSEENTER = 4; - private static final int MOUSEEXIT = 5; - private static final int BLANK = 0; - private static final int NORMAL = 1; - private static final int CURSED = 2; - private static final int DOWN = 3; - private static final int TELEPORT_IDLE = 0; - private static final int TELEPORT_REQUEST_LOCATION = 1; - private static final int TELEPORT_WAIT_FOR_LOCATION = 2; - private static final int buttonWidth = 97; - private static final int buttonHeight = 11; - private static final int xText = 20; - private static final int yText = 9; - private static final int xTextClip = 94; - private static Image friendsImage; - private static Image moreFriendsImage; - private static Font font; - private static FriendsListPart active; - private Vector friends = new Vector(); - private Vector onlineFriends = new Vector(); - private Vector mutedOnlineFriends = new Vector(); - private Vector serverUpdates = new Vector(); - private Object friendsMutex = new Object(); - private int cursedButton = -1; - private int clickedButton = -1; - private boolean clickedButtonDown; - private PopupMenu menu; - private MenuItem teleportItem = new MenuItem(Console.message("Go-There")); - private MenuItem emailItem = new MenuItem(Console.message("E-Mail")); - private MenuItem muteItem = new MenuItem(Console.message("Mute")); - private MenuItem whisperItem = new MenuItem(Console.message("Whisper")); - private MenuItem voiceChatItem = new MenuItem(Console.message("Voice-Chat")); - private MenuItem infoItem = new MenuItem(Console.message("Personal-I")); - private MenuItem tradeItem = new MenuItem(Console.message("Talk-Trade")); - private PopupMenu droneMenu; - private MenuItem droneAddItem = new MenuItem(Console.message("Add-2-friends")); - private MenuItem droneEmailItem = new MenuItem(Console.message("E-Mail")); - private MenuItem droneMuteItem = new MenuItem(Console.message("Mute")); - private MenuItem droneWhisperItem = new MenuItem(Console.message("Whisper")); - private MenuItem droneVoiceChatItem = new MenuItem(Console.message("Voice-Chat")); - private MenuItem droneInfoItem = new MenuItem(Console.message("Personal-I")); - private MenuItem droneTradeItem = new MenuItem(Console.message("Talk-Trade")); - private String activeFriendName = ""; - private String teleportTarget; - private int teleportState = 0; - private int teleportWaitStartTime; - private boolean teleportWaitSentMsg; - private int friendsButtons; - private int moreFriendsButton; - private boolean moreFriendsActive; - private MenuItem editItem; - private Menu actionMenu; - private MoreFriendsDialog moreFriendsDialog; - private DefaultConsole console; - private Galaxy galaxy; - private IniFile serverSection; - private boolean isDialogDisabled; - private int showMenuY = -1; - private static final String voiceChatWhisper = "&|+voicechat"; - - public FriendsListPart() { - AnimatedActionManager.get(); - if (font == null) { - String var1 = IniFile.override().getIniString("friendsGif", "friends.gif"); - friendsImage = ImageCanvas.getSystemImage(var1, this); - String var2 = IniFile.override().getIniString("moreFriendsGif", Console.message("mfriends.gif")); - moreFriendsImage = ImageCanvas.getSystemImage(var2, this); - int var3 = new Integer(Console.message("FriendsPointSize")); - font = new Font(Console.message("FriendsFont"), 0, var3); - } - - this.teleportItem.setFont(font); - this.emailItem.setFont(font); - this.muteItem.setFont(font); - this.whisperItem.setFont(font); - this.tradeItem.setFont(font); - this.voiceChatItem.setFont(font); - this.infoItem.setFont(font); - this.menu = new PopupMenu(); - this.menu.add(this.teleportItem); - this.menu.add(this.emailItem); - this.menu.add(this.muteItem); - this.menu.add(this.whisperItem); - if (NetUpdate.isInternalVersion()) { - this.menu.add(this.tradeItem); - } - - this.menu.add(this.voiceChatItem); - if (!VoiceChat.voiceChatAvailable()) { - this.voiceChatItem.setEnabled(false); - } - - this.menu.add(this.infoItem); - this.add(this.menu); - this.droneAddItem.setFont(font); - this.droneEmailItem.setFont(font); - this.droneMuteItem.setFont(font); - this.droneWhisperItem.setFont(font); - this.droneTradeItem.setFont(font); - this.droneVoiceChatItem.setFont(font); - this.droneInfoItem.setFont(font); - this.droneMenu = new PopupMenu(); - this.droneMenu.setFont(font); - this.droneMenu.add(this.droneAddItem); - this.droneMenu.add(this.droneEmailItem); - this.droneMenu.add(this.droneMuteItem); - this.droneMenu.add(this.droneWhisperItem); - if (NetUpdate.isInternalVersion()) { - this.droneMenu.add(this.droneTradeItem); - } - - this.droneMenu.add(this.droneVoiceChatItem); - if (!VoiceChat.voiceChatAvailable()) { - this.droneVoiceChatItem.setEnabled(false); - } - - this.droneMenu.add(this.droneInfoItem); - this.add(this.droneMenu); - } - - public void update(Graphics var1) { - this.paint(var1); - } - - public void paint(Graphics var1) { - int var2 = this.size().height; - int var3 = var2 / 11; - Object var4 = this.friendsMutex; - synchronized(var4) { - int var5 = this.onlineFriends.size(); - this.moreFriendsButton = var3 - 1; - if (var5 >= var3) { - this.friendsButtons = var3 - 1; - this.moreFriendsActive = true; - } else { - this.friendsButtons = var5; - this.moreFriendsActive = false; - } - - int var6 = var3 * 11; - int var7 = var2 - var6; - if (var7 > 0) { - var1.setColor(Color.black); - var1.fillRect(0, 0, 97, var7); - } - - for(int var8 = 0; var8 < var3; ++var8) { - int var9 = 1; - if (var8 >= this.friendsButtons && !this.isMoreFriendsButton(var8)) { - var9 = 0; - } else if (var8 == this.clickedButton) { - var9 = this.clickedButtonDown ? 3 : 1; - } else if (var8 == this.cursedButton) { - var9 = 2; - } - - this.drawButton(var1, var8, var9); - } - - } - } - - public int getRemainder(int var1) { - int var2 = var1 / 11; - int var3 = var2 * 11; - return var1 - var3; - } - - public Dimension preferredSize() { - return new Dimension(97, 1); - } - - public Dimension minimumSize() { - return this.preferredSize(); - } - - public boolean mouseMove(Event var1, int var2, int var3) { - return this.buttonAction(var2, var3, 0); - } - - public boolean mouseDown(Event var1, int var2, int var3) { - return this.buttonAction(var2, var3, 2); - } - - public boolean mouseUp(Event var1, int var2, int var3) { - if (this.buttonAction(var2, var3, 3)) { - if (this.showMenuY != -1) { - this.menu.show(this, 0, this.showMenuY); - this.showMenuY = -1; - } - - return true; - } else { - return false; - } - } - - public boolean mouseDrag(Event var1, int var2, int var3) { - return this.buttonAction(var2, var3, 1); - } - - public boolean mouseEnter(Event var1, int var2, int var3) { - return this.buttonAction(var2, var3, 4); - } - - public boolean mouseExit(Event var1, int var2, int var3) { - return this.buttonAction(var2, var3, 5); - } - - public boolean handleEvent(Event var1) { - return this.isDialogDisabled ? false : super.handleEvent(var1); - } - - private void loadFriends() { - if (this.friends.size() != 0) { - this.friends.removeAllElements(); - } - - if (Console.getActive().broadcastEnabled()) { - maxFriends = 100; - } - - String var2; - for(int var1 = 0; var1 < absMaxFriends; ++var1) { - var2 = this.serverSection.getIniString("Friend" + var1, ""); - if (var2.length() == 0) { - break; - } - - if (isValidUserName(var2) && !icontains(this.friends, var2)) { - this.friends.addElement(var2); - } - } - - if (this.friends.size() == 0) { - var2 = this.serverSection.getIniString("Friends", ""); - StringTokenizer var3 = new StringTokenizer(var2, ";"); - - while(var3.hasMoreTokens() && this.friends.size() < absMaxFriends) { - String var4 = var3.nextToken(); - if (isValidUserName(var4) && !icontains(this.friends, var4)) { - this.friends.addElement(var4); - } - } - if (this.friends.size() != 0) { - this.saveFriends(); - this.serverSection.setIniString("Friends", ""); - } - } - - } - - void saveFriends() { - if (this.serverSection != null) { - int var1 = this.friends.size(); - - for(int var2 = 0; var2 < var1; ++var2) { - this.serverSection.setIniString("Friend" + var2, (String)this.friends.elementAt(var2)); - } - - this.serverSection.setIniString("Friend" + var1, ""); - } - } - - private boolean isMoreFriendsButton(int var1) { - return var1 == this.moreFriendsButton && this.moreFriendsActive; - } - - private Graphics drawButton(Graphics var1, int var2, int var3) { - Image var4 = var2 == this.moreFriendsButton ? moreFriendsImage : friendsImage; - if (var1 != null || (var1 = this.getGraphics()) != null) { - int var5 = var2 * 11; - Graphics var6 = var1.create(0, var5, 97, 11); - var6.drawImage(var4, -var3 * 97, 0, (ImageObserver)null); - if (var2 >= 0 && var2 < this.friendsButtons && var2 < this.onlineFriends.size()) { - var6.clipRect(0, 0, 94, 11); - var6.setFont(font); - var6.setColor(Color.white); - var6.drawString((String)this.onlineFriends.elementAt(var2), 20, 9); - } - - var6.dispose(); - } - - return var1; - } - - private boolean buttonAction(int var1, int var2, int var3) { - Object var4 = this.friendsMutex; - synchronized(var4) { - Graphics var5 = null; - int var6 = var2 / 11; - if ((var6 < 0 || var6 >= this.friendsButtons) && !this.isMoreFriendsButton(var6)) { - var6 = -1; - } - - if (var3 != 0 && var3 != 4) { - if (var3 == 5) { - if (this.cursedButton != -1) { - var5 = this.drawButton(var5, this.cursedButton, 1); - this.cursedButton = -1; - } - - if (this.clickedButton != -1 && this.clickedButtonDown) { - var5 = this.drawButton(var5, this.clickedButton, 1); - this.clickedButtonDown = false; - } - } else if (var3 == 2) { - if (this.clickedButton != -1) { - var5 = this.drawButton(var5, this.clickedButton, 1); - this.clickedButtonDown = false; - } - - if ((this.clickedButton = var6) != -1) { - var5 = this.drawButton(var5, this.clickedButton, 3); - this.clickedButtonDown = true; - } - } else if (var3 == 1) { - if (this.clickedButton != -1) { - if (this.clickedButtonDown) { - if (var6 != this.clickedButton) { - var5 = this.drawButton(var5, this.clickedButton, 1); - this.clickedButtonDown = false; - } - } else if (var6 == this.clickedButton) { - var5 = this.drawButton(var5, this.clickedButton, 3); - this.clickedButtonDown = true; - } - } - } else if (var3 == 3) { - this.cursedButton = var6; - if (this.clickedButtonDown) { - if (this.cursedButton == this.clickedButton) { - var5 = this.drawButton(var5, this.clickedButton, 2); - } else { - var5 = this.drawButton(var5, this.clickedButton, 1); - } - - if (this.clickedButton == this.moreFriendsButton) { - if (this.moreFriendsDialog == null) { - this.moreFriendsDialog = new MoreFriendsDialog(this, this.menu, this.onlineFriends); - } - } else if (this.clickedButton >= 0 && this.clickedButton < this.onlineFriends.size()) { - this.activeFriendName = (String)this.onlineFriends.elementAt(this.clickedButton); - Debug.assert(this.activeFriendName != null); - this.showMenuY = (this.clickedButton + 1) * 11; - } - } - - if (this.cursedButton != this.clickedButton) { - var5 = this.drawButton(var5, this.cursedButton, 2); - } - - this.clickedButtonDown = false; - this.clickedButton = -1; - } - } else if (var6 != this.cursedButton) { - var5 = this.drawButton(var5, this.cursedButton, 1); - var5 = this.drawButton(var5, this.cursedButton = var6, 2); - } - - if (var5 != null) { - var5.dispose(); - } - - return true; - } - } - - private static boolean sendMsg(WorldServer var0, netPacket var1) { - try { - var0.sendNetworkMsg(var1); - return true; - } catch (InfiniteWaitException var4) { - } catch (PacketTooLargeException var5) { - } - - return false; - } - - public void activate(Console var1, Container var2, Console var3) { - active = this; - this.console = (DefaultConsole)var1; - this.editItem = var1.addMenuItem(Console.message("Edit-Friends"), "Options"); - this.editItem.setEnabled(this.friends != null); - } - - public void deactivate() { - active = null; - this.editItem = null; - } - - public boolean action(Event var1, Object var2) { - if (var1.target == this.editItem) { - new EditNamesDialog(this, Console.message("Edit-Friends2"), Console.message("Add-Friend")); - return true; - } else { - return this.maybeFriendAction(var1.target); - } - } - - public boolean handle(FrameEvent var1) { - Object var2 = this.friendsMutex; - WorldServer var4; - synchronized(var2) { - int var3 = this.serverUpdates.size(); - if (var3 != 0) { - var4 = this.console.getServerNew(); - if (var4 != null) { - while(var3-- != 0 && sendMsg(var4, (netPacket)this.serverUpdates.elementAt(0))) { - this.serverUpdates.removeElementAt(0); - } - } - } - } - - synchronized(this) { - if (this.teleportState == 1) { - var4 = this.console.getServerNew(); - if (var4 != null) { - sendMsg(var4, new whisperCmd(this.teleportTarget, "&|+where?")); - this.teleportState = 2; - this.teleportWaitStartTime = Std.getRealTime(); - this.teleportWaitSentMsg = false; + private static final String oldIniItemName = "Friends"; + private static final String iniItemName = "Friend"; + private static final String separator = ";"; + private static final String whereQuery = "&|+where?"; + private static final String whereResponse = "&|+where>"; + VoiceChat chatter = new VoiceChat(); + private static final int MOUSEMOVE = 0; + private static final int MOUSEDRAG = 1; + private static final int MOUSEDOWN = 2; + private static final int MOUSEUP = 3; + private static final int MOUSEENTER = 4; + private static final int MOUSEEXIT = 5; + private static final int BLANK = 0; + private static final int NORMAL = 1; + private static final int CURSED = 2; + private static final int DOWN = 3; + private static final int TELEPORT_IDLE = 0; + private static final int TELEPORT_REQUEST_LOCATION = 1; + private static final int TELEPORT_WAIT_FOR_LOCATION = 2; + private static final int buttonWidth = 97; + private static final int buttonHeight = 11; + private static final int xText = 20; + private static final int yText = 9; + private static final int xTextClip = 94; + private static Image friendsImage; + private static Image moreFriendsImage; + private static Font font; + public static FriendsListPart active; + public static Vector friends = new Vector(); + private Vector onlineFriends = new Vector(); + private Vector mutedOnlineFriends = new Vector(); + private Vector serverUpdates = new Vector(); + private Object friendsMutex = new Object(); + private int cursedButton = -1; + private int clickedButton = -1; + private boolean clickedButtonDown; + private PopupMenu menu; + private MenuItem teleportItem = new MenuItem(Console.message("Go-There")); + private MenuItem fremoveItem = new MenuItem(Console.message("remove-friend")); + private MenuItem whereIsItem = new MenuItem(Console.message("where-is")); + private MenuItem emailItem = new MenuItem(Console.message("E-Mail")); + private MenuItem muteItem = new MenuItem(Console.message("Mute")); + private MenuItem whisperItem = new MenuItem(Console.message("Whisper")); + private MenuItem infoItem = new MenuItem(Console.message("Personal-I")); + private MenuItem tradeItem = new MenuItem(Console.message("Talk-Trade")); + private PopupMenu droneMenu; + private MenuItem droneAddItem = new MenuItem(Console.message("Add-2-friends")); + private MenuItem droneTarItem = new MenuItem(Console.message("disable-avatar")); + private MenuItem droneEmailItem = new MenuItem(Console.message("E-Mail")); + private MenuItem droneMuteItem = new MenuItem(Console.message("Mute")); + private MenuItem droneWhisperItem = new MenuItem(Console.message("Whisper")); + private MenuItem droneInfoItem = new MenuItem(Console.message("Personal-I")); + private MenuItem droneTradeItem = new MenuItem(Console.message("Talk-Trade")); + private String activeFriendName = ""; + private String teleportTarget; + private int teleportState = 0; + private int teleportWaitStartTime; + private boolean teleportWaitSentMsg; + private int friendsButtons; + private int moreFriendsButton; + private boolean moreFriendsActive; + private MenuItem editItem; + private Menu actionMenu; + private MoreFriendsDialog moreFriendsDialog; + private DefaultConsole console; + private Galaxy galaxy; + private IniFile serverSection; + private boolean isDialogDisabled; + private int showMenuY = -1; + + + public FriendsListPart() { + AnimatedActionManager.get(); + String var1; + if(font == null) { + var1 = IniFile.override().getIniString("friendsGif", "friends.gif"); + friendsImage = ImageCanvas.getSystemImage(var1, this); + String var2 = IniFile.override().getIniString("moreFriendsGif", Console.message("mfriends.gif")); + moreFriendsImage = ImageCanvas.getSystemImage(var2, this); + int var3 = (new Integer(Console.message("FriendsPointSize"))).intValue(); + font = new Font(Console.message("FriendsFont"), 0, var3); + } + + this.teleportItem.setFont(font); + this.whereIsItem.setFont(font); + this.emailItem.setFont(font); + this.muteItem.setFont(font); + this.whisperItem.setFont(font); + this.tradeItem.setFont(font); + this.infoItem.setFont(font); + this.fremoveItem.setFont(font); + this.menu = new PopupMenu(); + this.menu.add(this.teleportItem); + this.menu.add(this.whereIsItem); + this.menu.add(this.emailItem); + this.menu.add(this.muteItem); + this.menu.add(this.whisperItem); + if(NetUpdate.isInternalVersion()) { + this.menu.add(this.tradeItem); + } + this.menu.add(this.fremoveItem); + + this.menu.add(this.infoItem); + this.add(this.menu); + this.droneAddItem.setFont(font); + this.droneTarItem.setFont(font); + this.droneEmailItem.setFont(font); + this.droneMuteItem.setFont(font); + this.droneWhisperItem.setFont(font); + this.droneTradeItem.setFont(font); + this.droneInfoItem.setFont(font); + this.droneMenu = new PopupMenu(); + this.droneMenu.setFont(font); + this.droneMenu.add(this.droneAddItem); + this.droneMenu.add(this.droneTarItem); + this.droneMenu.add(this.droneEmailItem); + this.droneMenu.add(this.droneMuteItem); + this.droneMenu.add(this.droneWhisperItem); + this.droneMenu.add(this.droneTradeItem); + this.droneMenu.add(this.droneInfoItem); + + this.add(this.droneMenu); + } + + public void update(Graphics var1) { + this.paint(var1); + } + + public void paint(Graphics var1) { + int var2 = this.size().height; + int var3 = var2 / 11; + synchronized(this.friendsMutex) { + int var5 = this.onlineFriends.size(); + this.moreFriendsButton = var3 - 1; + if(var5 >= var3) { + this.friendsButtons = var3 - 1; + this.moreFriendsActive = true; } else { - Console.println(Console.message("Cant-go-there")); - this.teleportState = 0; + this.friendsButtons = var5; + this.moreFriendsActive = false; } - } - if (this.teleportState == 2) { - int var9 = Std.getRealTime(); - if (var9 > this.teleportWaitStartTime + 5000) { - Object[] var5; - if (var9 > this.teleportWaitStartTime + 30000) { - this.teleportState = 0; - if (this.teleportWaitSentMsg) { - var5 = new Object[]{new String(this.teleportTarget)}; - Console.println(MessageFormat.format(Console.message("Cancel-teleport"), var5)); - } - } else if (!this.teleportWaitSentMsg) { - var5 = new Object[]{new String(this.teleportTarget)}; - Console.println(MessageFormat.format(Console.message("Delay-locating"), var5)); - this.teleportWaitSentMsg = true; - } - } - } - - return true; - } - } - - public void dialogDisable(boolean var1) { - if (this.isDialogDisabled = var1) { - this.cursedButton = -1; - this.clickedButton = -1; - this.clickedButtonDown = false; - this.repaint(); - } - - } - - public void setServer(WorldServer var1, IniFile var2) { - this.serverSection = var2; - this.galaxy = var1.getGalaxy(); - Debug.dAssert(var2 != null); - Debug.dAssert(this.galaxy != null); - this.loadFriends(); - if (this.editItem != null) { - this.editItem.setEnabled(true); - } - - this.sendAll(var1); - } - - public void maybeServerDisconnect() { - if (this.galaxy != null) { - if (this.editItem != null) { - this.editItem.setEnabled(false); - } - - this.clearAll(); - } - - } - - public static boolean tryToRun(String var0) { - try { - Runtime.getRuntime().exec(var0); - return true; - } catch (IOException var2) { - return false; - } - } - - private boolean maybeFriendAction(Object var1) { - if (var1 != this.emailItem && var1 != this.droneEmailItem) { - if (var1 != this.whisperItem && var1 != this.droneWhisperItem) { - if (var1 != this.voiceChatItem && var1 != this.droneVoiceChatItem) { - if (var1 == this.droneAddItem) { - if (this.mayAddNameListName(Console.getFrame())) { - this.addNameListName(this.activeFriendName); - } - } else if (var1 == this.teleportItem) { - synchronized(this) { - this.teleportTarget = this.activeFriendName; - if (this.teleportState == 2 && this.teleportWaitSentMsg) { - Console.println(Console.message("Cancel-new-tele")); - } - - this.teleportState = 1; - } - } else if (var1 != this.muteItem && var1 != this.droneMuteItem) { - if (var1 != this.infoItem && var1 != this.droneInfoItem) { - if (var1 != this.tradeItem && var1 != this.droneTradeItem) { - return false; - } - - WhisperManager.whisperManager().startToTrade(this.activeFriendName); - } else { - new PersonalInfoDownload(this.activeFriendName, this.console); - } - } else if (this.console.getMutes().mayAddNameListName(Console.getFrame())) { - this.console.getMutes().addNameListName(this.activeFriendName); - } - } else { - this.chatter.beginChat(this.activeFriendName, this.console); + int var6 = var3 * 11; + int var7 = var2 - var6; + if(var7 > 0) { + var1.setColor(Color.black); + var1.fillRect(0, 0, 97, var7); } - } else { - Console.startWhispering(this.activeFriendName); - } - } else { - EMailPart.showMessage(this.console, this.activeFriendName); - } - - return true; - } - - private void clearAll() { - if (this.galaxy != null) { - Object var1 = this.friendsMutex; - synchronized(var1) { - this.onlineFriends.removeAllElements(); - this.mutedOnlineFriends.removeAllElements(); - } - if (active == this) { - this.repaint(); - } + for(int var8 = 0; var8 < var3; ++var8) { + int var9 = 1; + if(var8 >= this.friendsButtons && !this.isMoreFriendsButton(var8)) { + var9 = 0; + } else if(var8 == this.clickedButton) { + var9 = this.clickedButtonDown?3:1; + } else if(var8 == this.cursedButton) { + var9 = 2; + } - this.galaxy.sentFriendsList(false); - } + this.drawButton(var1, var8, var9); + } - } + } + } - private void sendAll(WorldServer var1) { - if (!this.galaxy.sentFriendsList()) { - Object var2 = this.friendsMutex; - synchronized(var2) { - int var3 = this.friends.size(); - int var4 = 0; - - while(true) { - if (var4 >= var3) { - break; - } - - sendMsg(var1, new BuddyListUpdateCmd((String)this.friends.elementAt(var4), 1)); - ++var4; - } - } - - this.galaxy.sentFriendsList(true); - } - - } - - private static String getWorldName(String var0) { - int var1 = var0.indexOf(".world#"); - int var2; - return var1 == -1 || (var2 = var0.lastIndexOf(47, var1)) == -1 && (var2 = var0.lastIndexOf(58, var1)) == -1 ? null : var0.substring(var2 + 1, var1); - } - - public static void processWhisper(WorldServer var0, String var1, String var2) { - if (active != null && active.galaxy == var0.getGalaxy()) { - active.instanceProcessWhisper(var0, var1, var2); - } - - } - - private synchronized void instanceProcessWhisper(WorldServer var1, String var2, String var3) { - if (var3.startsWith("&|+where?")) { - Pilot var4; - String var5; - if ((var4 = Pilot.getActive()) != null && (var5 = var4.getTeleportURL()) != null) { - if (this.console.getSpecialGuest()) { - int var6 = var5.indexOf(60); - int var7 = var5.indexOf(62); - var5 = var5.substring(0, var6) + var5.substring(var7 + 1); - } - - if (Pilot.getActive().getRoom().getAllowTeleport()) { - sendMsg(var1, new whisperCmd(var2, "&|+where>" + var5)); - } - } - } else if (var3.startsWith("&|+where>")) { - if (this.teleportState == 2 && this.teleportTarget.equals(var2)) { - String var9 = var3.substring("&|+where>".length()); - boolean var10 = false; - String var11 = getWorldName(var9); - String var8; - if (!var9.startsWith("home:") && !var9.startsWith("http://")) { - if (var11 != null && var11.length() > 0) { - Pilot var12 = Pilot.getActive(); - if (var12 != null) { - var8 = var12.getTeleportURL(); - if (var8 != null && var11.equals(getWorldName(var8))) { - var10 = true; - var9 = var8.substring(0, var8.lastIndexOf(35)) + var9.substring(var9.lastIndexOf(35)); - } - } - } - - if (!var10) { - String var13 = WorldsMarkPart.findPackage(var11); - if (var13 != null) { - var10 = true; - var9 = "home:" + var13 + "/" + var13 + ".world" + var9.substring(var9.lastIndexOf(35)); - } - } - } else { - var10 = true; + public int getRemainder(int var1) { + int var2 = var1 / 11; + int var3 = var2 * 11; + return var1 - var3; + } + + public Dimension preferredSize() { + return new Dimension(97, 1); + } + + public Dimension minimumSize() { + return this.preferredSize(); + } + + public boolean mouseMove(Event var1, int var2, int var3) { + return this.buttonAction(var2, var3, 0); + } + + public boolean mouseDown(Event var1, int var2, int var3) { + return this.buttonAction(var2, var3, 2); + } + + public boolean mouseUp(Event var1, int var2, int var3) { + if(this.buttonAction(var2, var3, 3)) { + if(this.showMenuY != -1) { + this.menu.show(this, 0, this.showMenuY); + this.showMenuY = -1; + } + + return true; + } else { + return false; + } + } + + public boolean mouseDrag(Event var1, int var2, int var3) { + return this.buttonAction(var2, var3, 1); + } + + public boolean mouseEnter(Event var1, int var2, int var3) { + return this.buttonAction(var2, var3, 4); + } + + public boolean mouseExit(Event var1, int var2, int var3) { + return this.buttonAction(var2, var3, 5); + } + + public boolean handleEvent(Event var1) { + return this.isDialogDisabled?false:super.handleEvent(var1); + } + + private void loadFriends() { + if(this.friends.size() != 0) { + this.friends.removeAllElements(); + } + + for(int var2 = 0; var2 < Integer.MAX_VALUE; ++var2) { + String var1 = this.serverSection.getIniString("Friend" + var2, ""); + if(((String)var1).length() == 0) { + break; + } + + if(isValidUserName((String)var1) && !icontains(this.friends, (String)var1)) { + this.friends.addElement(var1); + } + } + + if(this.friends.size() == 0) { + String var5 = this.serverSection.getIniString("Friends", ""); + StringTokenizer var4 = new StringTokenizer(var5, ";"); + + while(((StringTokenizer)var4).hasMoreTokens()) { + String var3 = ((StringTokenizer)var4).nextToken(); + if(isValidUserName(var3) && !icontains(this.friends, var3)) { + this.friends.addElement(var3); + } + } + + if(this.friends.size() != 0) { + this.saveFriends(); + this.serverSection.setIniString("Friends", ""); + } + } + } + + void saveFriends() { + if(this.serverSection != null) { + int var1 = this.friends.size(); + + for(int var2 = 0; var2 < var1; ++var2) { + this.serverSection.setIniString("Friend" + var2, (String)this.friends.elementAt(var2)); } - Object[] var14; - if (var10) { - TeleportAction.teleport(var9, (TeleportStatus)null); - if (this.teleportWaitSentMsg) { - var14 = new Object[]{new String(this.teleportTarget)}; - Console.println(MessageFormat.format(Console.message("Found-tele"), var14)); - } + this.serverSection.setIniString("Friend" + var1, ""); + } + } + + private boolean isMoreFriendsButton(int var1) { + return var1 == this.moreFriendsButton && this.moreFriendsActive; + } + + private Graphics drawButton(Graphics var1, int var2, int var3) { + Image var4 = var2 == this.moreFriendsButton?moreFriendsImage:friendsImage; + if(var1 != null || (var1 = this.getGraphics()) != null) { + int var5 = var2 * 11; + Graphics var6 = var1.create(0, var5, 97, 11); + var6.drawImage(var4, -var3 * 97, 0, (ImageObserver)null); + if(var2 >= 0 && var2 < this.friendsButtons && var2 < this.onlineFriends.size()) { + var6.clipRect(0, 0, 94, 11); + var6.setFont(font); + var6.setColor(Color.white); + var6.drawString((String)this.onlineFriends.elementAt(var2), 20, 9); + } + + var6.dispose(); + } + + return var1; + } + + private boolean buttonAction(int var1, int var2, int var3) { + synchronized(this.friendsMutex) { + Graphics var5 = null; + int var6 = var2 / 11; + if((var6 < 0 || var6 >= this.friendsButtons) && !this.isMoreFriendsButton(var6)) { + var6 = -1; + } + + if(var3 != 0 && var3 != 4) { + if(var3 == 5) { + if(this.cursedButton != -1) { + var5 = this.drawButton(var5, this.cursedButton, 1); + this.cursedButton = -1; + } + + if(this.clickedButton != -1 && this.clickedButtonDown) { + var5 = this.drawButton(var5, this.clickedButton, 1); + this.clickedButtonDown = false; + } + } else if(var3 == 2) { + if(this.clickedButton != -1) { + var5 = this.drawButton(var5, this.clickedButton, 1); + this.clickedButtonDown = false; + } + + if((this.clickedButton = var6) != -1) { + var5 = this.drawButton(var5, this.clickedButton, 3); + this.clickedButtonDown = true; + } + } else if(var3 == 1) { + if(this.clickedButton != -1) { + if(this.clickedButtonDown) { + if(var6 != this.clickedButton) { + var5 = this.drawButton(var5, this.clickedButton, 1); + this.clickedButtonDown = false; + } + } else if(var6 == this.clickedButton) { + var5 = this.drawButton(var5, this.clickedButton, 3); + this.clickedButtonDown = true; + } + } + } else if(var3 == 3) { + this.cursedButton = var6; + if(this.clickedButtonDown) { + if(this.cursedButton == this.clickedButton) { + var5 = this.drawButton(var5, this.clickedButton, 2); + } else { + var5 = this.drawButton(var5, this.clickedButton, 1); + } + + if(this.clickedButton == this.moreFriendsButton) { + if(this.moreFriendsDialog == null) { + this.moreFriendsDialog = new MoreFriendsDialog(this, this.menu, this.onlineFriends); + } + } else if(this.clickedButton >= 0 && this.clickedButton < this.onlineFriends.size()) { + this.activeFriendName = (String)this.onlineFriends.elementAt(this.clickedButton); + this.showMenuY = (this.clickedButton + 1) * 11; + } + } + + if(this.cursedButton != this.clickedButton) { + var5 = this.drawButton(var5, this.cursedButton, 2); + } + + this.clickedButtonDown = false; + this.clickedButton = -1; + } + } else if(var6 != this.cursedButton) { + var5 = this.drawButton(var5, this.cursedButton, 1); + var5 = this.drawButton(var5, this.cursedButton = var6, 2); + } + + if(var5 != null) { + var5.dispose(); + } + + return true; + } + } + + private static boolean sendMsg(WorldServer var0, netPacket var1) { + try { + var0.sendNetworkMsg(var1); + return true; + } catch (InfiniteWaitException var3) { + } catch (PacketTooLargeException var4) { + } + + return false; + } + + public void activate(Console var1, Container var2, Console var3) { + active = this; + this.console = (DefaultConsole)var1; + this.editItem = var1.addMenuItem(Console.message("Edit-Friends"), "Options"); + this.editItem.setEnabled(this.friends != null); + } + + public void deactivate() { + active = null; + this.editItem = null; + } + + public boolean action(Event var1, Object var2) { + if(var1.target == this.editItem) { + new EditNamesDialog(this, Console.message("Edit-Friends2"), Console.message("Add-Friend")); + return true; + } else { + return this.maybeFriendAction(var1.target); + } + } + + public boolean handle(FrameEvent var1) { + int var4; + synchronized(this.friendsMutex) { + var4 = this.serverUpdates.size(); + if(var4 != 0) { + WorldServer var2 = this.console.getServerNew(); + if(var2 != null) { + while(var4-- != 0 && sendMsg((WorldServer)var2, (netPacket)this.serverUpdates.elementAt(0))) { + this.serverUpdates.removeElementAt(0); + } + } + } + } + + synchronized(this) { + WorldServer var10; + if(this.teleportState == 1) { + var10 = this.console.getServerNew(); + if(var10 != null) { + sendMsg(var10, new whisperCmd(this.teleportTarget, "&|+where?")); + this.teleportState = 2; + this.teleportWaitStartTime = Std.getRealTime(); + this.teleportWaitSentMsg = false; + } else { + Console.println(Console.message("Cant-go-there")); + this.teleportState = 0; + } + } + + if(this.teleportState == 2) { + var4 = Std.getRealTime(); + if(var4 > this.teleportWaitStartTime + 5000) { + Object[] var9; + if(var4 > this.teleportWaitStartTime + 30000) { + this.teleportState = 0; + if(this.teleportWaitSentMsg) { + var9 = new Object[]{new String(this.teleportTarget)}; + Console.println(MessageFormat.format(Console.message("Cancel-teleport"), (Object[])var9)); + } + } else if(!this.teleportWaitSentMsg) { + var9 = new Object[]{new String(this.teleportTarget)}; + Console.println(MessageFormat.format(Console.message("Delay-locating"), (Object[])var9)); + this.teleportWaitSentMsg = true; + } + } + } + + if(this.teleportState == -1) { + var10 = this.console.getServerNew(); + if(var10 != null) { + sendMsg(var10, new whisperCmd(this.teleportTarget, "&|+where?")); + } else { + Console.println(Console.message("Cant-go-there")); + } + + this.teleportState = -2; + } + + return true; + } + } + + public void dialogDisable(boolean var1) { + if(this.isDialogDisabled = var1) { + this.cursedButton = -1; + this.clickedButton = -1; + this.clickedButtonDown = false; + this.repaint(); + } + + } + + public void setServer(WorldServer var1, IniFile var2) { + this.serverSection = var2; + this.galaxy = var1.getGalaxy(); + Debug.dAssert(var2 != null); + Debug.dAssert(this.galaxy != null); + this.loadFriends(); + if(this.editItem != null) { + this.editItem.setEnabled(true); + } + + this.sendAll(var1); + } + + public void maybeServerDisconnect() { + if(this.galaxy != null) { + if(this.editItem != null) { + this.editItem.setEnabled(false); + } + + this.clearAll(); + } + + } + + public static boolean tryToRun(String var0) { + try { + Runtime.getRuntime().exec(var0); + return true; + } catch (IOException var2) { + return false; + } + } + + private boolean maybeFriendAction(Object var1) { + if (var1 == this.fremoveItem || var1 == this.droneAddItem) { + if (this.mayAddNameListName(Console.getFrame())) { + if (!icontains(friends, this.activeFriendName)) { + this.addNameListName(this.activeFriendName); + Console.println(MessageFormat.format(Console.message("added-status"), new String[]{this.activeFriendName})); + } else { + this.removeNameListName(friends.indexOf(this.activeFriendName)); + Console.println(MessageFormat.format(Console.message("removed-status"), new String[]{this.activeFriendName})); + } + } + } else if (var1 == this.droneTarItem) { + if (this.console.getTars().mayAddNameListName(Console.getFrame())) { + if (!icontains(this.console.getTars().tars, this.activeFriendName)) { + this.console.getTars().addNameListName(this.activeFriendName); + } else { + this.console.getTars().removeNameListName(this.console.getTars().tars.indexOf(this.activeFriendName)); + } + } + + } else if (var1 == this.whisperItem || var1 == this.droneWhisperItem) { + Console.startWhispering(this.activeFriendName); + } else if (var1 == this.emailItem || var1 == this.droneEmailItem) { + EMailPart.showMessage(this.console, this.activeFriendName); + } else if (var1 == this.teleportItem || var1 == this.whereIsItem) { + synchronized (this) { + this.teleportTarget = this.activeFriendName; + if (this.teleportState == 2 && this.teleportWaitSentMsg) { + Console.println(Console.message("Cancel-new-tele")); + } + + this.teleportState = var1 == this.teleportItem ? 1 : -1; + } + } else if (var1 == this.muteItem || var1 == this.droneMuteItem) { + this.console.getMutes().addNameListName(this.activeFriendName); + } else if (var1 == this.infoItem || var1 == this.droneInfoItem) { + new PersonalInfoDownload(this.activeFriendName, this.console); + } else if (var1 == this.tradeItem || var1 == this.droneTradeItem) { + WhisperManager.whisperManager().startToTrade(this.activeFriendName); + } else { + return false; + } + + return true; + } + + private void clearAll() { + if(this.galaxy != null) { + synchronized(this.friendsMutex) { + this.onlineFriends.removeAllElements(); + this.mutedOnlineFriends.removeAllElements(); + } + + if(active == this) { + this.repaint(); + } + + this.galaxy.sentFriendsList(false); + } + + } + + private void sendAll(WorldServer var1) { + if(!this.galaxy.sentFriendsList()) { + synchronized(this.friendsMutex) { + int var3 = this.friends.size(); + int var4 = 0; + + while(true) { + if(var4 >= var3) { + break; + } + + sendMsg(var1, new BuddyListUpdateCmd((String)this.friends.elementAt(var4), 1)); + ++var4; + } + } + + this.galaxy.sentFriendsList(true); + } + + } + + private static String getWorldName(String var0) { + int var1 = var0.indexOf(".world#"); + int var2; + return var1 != -1 && ((var2 = var0.lastIndexOf(47, var1)) != -1 || (var2 = var0.lastIndexOf(58, var1)) != -1)?var0.substring(var2 + 1, var1):null; + } + + public static void processWhisper(WorldServer var0, String var1, String var2) { + if(active != null && active.galaxy == var0.getGalaxy()) { + active.instanceProcessWhisper(var0, var1, var2); + } + + } + + private boolean allowTeleport(String player) { + int value = IniFile.gamma().getIniInt("TeleportPrivacy", 0); + if (value != 0) { + if (value == 1 && icontains(friends, player)) return true; + else return false; + } else return true; + } + + private void sendTeleportReject(String var1) { + Object[] var2 = new Object[]{"teleport", var1}; + Console.println(MessageFormat.format(Console.message("rejected"), var2)); + } + + private synchronized void instanceProcessWhisper(WorldServer var1, String var2, String var3) { + if(var3.startsWith("&|+where?")) { + if (allowTeleport(var2)) { + Pilot var4; + String var5; + if ((var4 = Pilot.getActive()) != null && (var5 = ((Pilot) var4).getTeleportURL()) != null) { + if (this.console.getSpecialGuest()) { + int var6 = var5.indexOf(60); + int var7 = var5.indexOf(62); + var5 = var5.substring(0, var6) + var5.substring(var7 + 1); + } + + if (Pilot.getActive().getRoom().getAllowTeleport()) { + sendMsg(var1, new whisperCmd(var2, "&|+where>" + var5)); + } + } } else { - var14 = new Object[]{new String(this.teleportTarget), new String(var11)}; - var8 = MessageFormat.format(Console.message("Cant-go-world"), var14); - Console.println(var8); - } - - this.teleportState = 0; - this.teleportTarget = null; - } - } else if (var3.startsWith("&|+voicechat")) { - this.chatter.handleChatWhisper(var2, var3, this.console); - } else if (var3.startsWith(VoiceChat.VCdebugCommand)) { - VoiceChat.setExtra(var3); - } else if (var3.startsWith(VoiceChat.VCdebugCommandReset)) { - VoiceChat.resetExtra(); - } - - } - - public int getNameListCount() { - return this.friends.size(); - } - - public String getNameListName(int var1) { - return (String)this.friends.elementAt(var1); - } - - public void removeNameListName(int var1) { - Object var2 = this.friendsMutex; - synchronized(var2) { - String var3 = (String)this.friends.elementAt(var1); - this.friends.removeElementAt(var1); - this.saveFriends(); - if ((var1 = iindexOf(this.onlineFriends, var3)) != -1) { - this.onlineFriends.removeElementAt(var1); - if (active == this) { - this.repaint(); - } - } - - if ((var1 = iindexOf(this.mutedOnlineFriends, var3)) != -1) { - this.mutedOnlineFriends.removeElementAt(var1); - } - - this.serverUpdates.addElement(new BuddyListUpdateCmd(var3, 0)); - } - } - - public boolean mayAddNameListName(java.awt.Window var1) { - if (this.friends.size() < maxFriends) { - return true; - } else { - Object[] var2 = new Object[]{new String("" + maxFriends)}; - new OkCancelDialog(var1, (DialogReceiver)null, Console.message("Too-many-names"), (String)null, Console.message("OK"), MessageFormat.format(Console.message("You-are-limitedF"), var2), true); - return false; - } - } - - public int addNameListName(String var1) { - Object var2 = this.friendsMutex; - synchronized(var2) { - int var3 = iindexOf(this.friends, var1); - if (var3 != -1) { - return var3; - } else { - this.friends.addElement(var1); + if (IniFile.modPrivacy().getIniInt("TeleportFeedback", 0) == 1) sendTeleportReject(var2); + if (IniFile.modPrivacy().getIniInt("TeleportResponse", 0) == 1) sendMsg(var1, new whisperCmd(var2, Console.message("not-teleports"))); + } + } else if(var3.startsWith("&|+where>")) { + boolean var11 = this.teleportState == 2 && this.teleportTarget.equals(var2); + if (var11 || this.teleportState == -2) { + String var10 = var3.substring("&|+where>".length()); + boolean var12 = false; + String var13 = getWorldName((String) var10); + String var9; + if (!((String) var10).startsWith("home:") && !((String) var10).startsWith("http://")) { + if (var13 != null && var13.length() > 0) { + Pilot var8 = Pilot.getActive(); + if (var8 != null) { + var9 = ((Pilot) var8).getTeleportURL(); + if (var9 != null && var13.equals(getWorldName(var9))) { + var12 = true; + var10 = var9.substring(0, var9.lastIndexOf(35)) + ((String) var10).substring(((String) var10).lastIndexOf(35)); + } + } + } + + if (!var12) { + String var14 = WorldsMarkPart.findPackage(var13); + if (var14 != null) { + var12 = true; + var10 = "home:" + (String) var14 + "/" + (String) var14 + ".world" + ((String) var10).substring(((String) var10).lastIndexOf(35)); + } + } + } else { + var12 = true; + } + + Object[] var15; + if (var12) { + if (var11) { + TeleportAction.teleport((String) var10, (TeleportStatus) null); + } else { + Console.println(var2 + ": " + (String) var10); + } + + if (this.teleportWaitSentMsg) { + var15 = new Object[]{new String(this.teleportTarget)}; + Console.println(MessageFormat.format(Console.message("Found-tele"), (Object[]) var15)); + } + } else { + var15 = new Object[]{new String(this.teleportTarget), new String(var13)}; + var9 = MessageFormat.format(Console.message("Cant-go-world"), (Object[]) var15); + Console.println(var9); + } + + this.teleportState = 0; + this.teleportTarget = null; + } + } + } + + public int getNameListCount() { + return this.friends.size(); + } + + public String getNameListName(int var1) { + return (String)this.friends.elementAt(var1); + } + + public void removeNameListName(int var1) { + synchronized(this.friendsMutex) { + String var3 = (String)this.friends.elementAt(var1); + this.friends.removeElementAt(var1); this.saveFriends(); - this.serverUpdates.addElement(new BuddyListUpdateCmd(var1, 1)); - int var5 = this.friends.size() - 1; - return var5; - } - } - } - - public static void droneClick(Drone var0, MouseDownEvent var1) { - if (active != null) { - active.instanceDroneClick(var0, var1); - } - - } - - private void instanceDroneClick(Drone var1, MouseDownEvent var2) { - String var3 = var1.getLongID(); - if (var3 != null) { - this.activeFriendName = var3; - Object[] var4 = new Object[]{new String(this.activeFriendName)}; - this.droneAddItem = new MenuItem(MessageFormat.format(Console.message("Add-to-friends"), var4)); - this.droneMenu.remove(0); - this.droneAddItem.setFont(font); - this.droneMenu.insert(this.droneAddItem, 0); - this.droneAddItem.setEnabled(!icontains(this.friends, this.activeFriendName)); - if (this.actionMenu != null) { - this.droneMenu.remove(this.actionMenu); - } - - if (var1 instanceof PosableDrone) { - PosableDrone var5 = (PosableDrone)var1; - PosableShape var6 = var5.getInternalPosableShape(); - if (var6 != null) { - this.actionMenu = new Menu(Console.message("Actions")); - if (AnimatedActionManager.get().buildActionMenu(this.actionMenu, var6)) { - this.droneMenu.add(this.actionMenu); - this.actionMenu.addActionListener(AnimatedActionManager.get()); - } - } - } - - this.droneMenu.show(this.console.getRender(), var2.x, var2.y); - } - - } - - public static void processBuddyListNotify(WorldServer var0, String var1, int var2) { - Galaxy var3 = var0.getGalaxy(); - Enumeration var4 = var3.getConsoles(); - - Object var5; - FriendsListPart var6; - while(var4.hasMoreElements()) { - var5 = var4.nextElement(); - if (var5 instanceof DefaultConsole) { - var6 = ((DefaultConsole)var5).getFriends(); - if (var2 < 2) { - boolean var7 = MuteListPart.isMuted(var0, var1); - if (var2 == 1) { - var6.addOnlineFriend(var1, var7); - } else { - var6.removeOnlineFriend(var1, var7); - } + if((var1 = iindexOf(this.onlineFriends, var3)) != -1) { + this.onlineFriends.removeElementAt(var1); + if(active == this) { + this.repaint(); + } + } + + if((var1 = iindexOf(this.mutedOnlineFriends, var3)) != -1) { + this.mutedOnlineFriends.removeElementAt(var1); + } + + this.serverUpdates.addElement(new BuddyListUpdateCmd(var3, 0)); + } + } + + public boolean mayAddNameListName(Window var1) { + return true; + } + + public int addNameListName(String var1) { + synchronized(this.friendsMutex) { + int var3 = iindexOf(this.friends, var1); + if(var3 != -1) { + return var3; } else { - Debug.dAssert(var1.length() == 0); - var6.clearAll(); + this.friends.addElement(var1); + this.saveFriends(); + this.serverUpdates.addElement(new BuddyListUpdateCmd(var1, 1)); + return this.friends.size() - 1; + } + } + } + + public static void droneClick(Drone var0, MouseDownEvent var1) { + if(active != null) { + active.instanceDroneClick(var0, var1); + } + + } + + private String parseVersion(int v) { + switch (v) { + case 2003110800: + return "1890"; + case 2004081600: + return "1904"; + case 2004111200: + return "1920a"; + case 2012071402: + return "1920"; + case 2020031200: + return "1922a10"; + default: + return String.valueOf(v); + } + } + + private void instanceDroneClick(Drone var1, MouseDownEvent var2) { + String var3 = var1.getLongID(); + if(var3 != null) { + this.activeFriendName = var3; + Object[] var4 = new Object[]{this.activeFriendName}; + this.droneAddItem = new MenuItem(icontains(this.friends, this.activeFriendName) ? MessageFormat.format("Remove {0} from friends list", var4) : MessageFormat.format(Console.message("Add-to-friends"), var4)); + this.droneTarItem = new MenuItem(this.console.getFriends().icontains(this.console.getTars().tars, this.activeFriendName) ? "Enable Avatar" : "Disable Avatar"); + + this.droneMenu.remove(0); + this.droneAddItem.setFont(font); + this.droneMenu.insert(this.droneAddItem, 0); + + this.droneMenu.remove(1); + this.droneTarItem.setFont(font); + this.droneMenu.insert(this.droneTarItem, 1); + + if(this.actionMenu != null) { + this.droneMenu.remove(this.actionMenu); + } + + if(var1 instanceof PosableDrone) { + PosableDrone var5 = (PosableDrone)var1; + PosableShape var6 = var5.getInternalPosableShape(); + if(var6 != null) { + this.actionMenu = new Menu(Console.message("Actions")); + if(AnimatedActionManager.get().buildActionMenu(this.actionMenu, var6)) { + this.droneMenu.add(this.actionMenu); + this.actionMenu.addActionListener(AnimatedActionManager.get()); + } + } + } + + this.droneMenu.show(this.console.getRender(), var2.x, var2.y); + } + + } + + public static void processBuddyListNotify(WorldServer var0, String var1, int var2) { + Galaxy var3 = var0.getGalaxy(); + Enumeration var4 = var3.getConsoles(); + + Object var5; + NET.worlds.console.FriendsListPart var6; + while(var4.hasMoreElements()) { + var5 = var4.nextElement(); + if(var5 instanceof DefaultConsole) { + var6 = ((DefaultConsole)var5).getFriends(); + if(var2 < 2) { + boolean var7 = MuteListPart.isMuted(var0, var1); + if(var2 == 1) { + var6.addOnlineFriend(var1, var7); + } else { + var6.removeOnlineFriend(var1, var7); + } + } else { + Debug.dAssert(var1.length() == 0); + var6.clearAll(); + } + } + } + + if(var2 == 2) { + var4 = var3.getConsoles(); + + while(var4.hasMoreElements()) { + var5 = var4.nextElement(); + if(var5 instanceof DefaultConsole) { + var6 = ((DefaultConsole)var5).getFriends(); + var6.sendAll(var0); + } + } + } + } + + public static String ilookup(Vector var0, String var1) { + int var2 = var0.size(); + + for(int var3 = 0; var3 < var2; ++var3) { + String var4 = (String)var0.elementAt(var3); + if(var4.equalsIgnoreCase(var1)) { + return var4; + } + } + + return null; + } + + public static int iindexOf(Vector var0, String var1) { + int var2 = var0.size(); + + for(int var3 = 0; var3 < var2; ++var3) { + String var4 = (String)var0.elementAt(var3); + if(var4.equalsIgnoreCase(var1)) { + return var3; + } + } + + return -1; + } + + public static boolean icontains(Vector var0, String var1) { + return iindexOf(var0, var1) != -1; + } + + public void changeMuteState(String var1, boolean var2) { + synchronized(this.friendsMutex) { + if(icontains(this.friends, var1)) { + if(var2) { + var1 = ilookup(this.onlineFriends, var1); + if(var1 != null) { + this.removeOnlineFriend(var1, false); + this.addOnlineFriend(var1, true); + } + } else { + var1 = ilookup(this.mutedOnlineFriends, var1); + if(var1 != null) { + this.removeOnlineFriend(var1, true); + this.addOnlineFriend(var1, false); + } + } + } + + } + } + + private void listChanged() { + this.cursedButton = -1; + this.clickedButton = -1; + this.clickedButtonDown = false; + this.repaint(); + } + + private void addOnlineFriend(String var1, boolean var2) { + synchronized(this.friendsMutex) { + if(this.friends != null && icontains(this.friends, var1)) { + if(!var2 && !icontains(this.onlineFriends, var1)) { + this.onlineFriends.addElement(var1); + if(active == this) { + this.listChanged(); + if(this.moreFriendsDialog != null) { + this.moreFriendsDialog.addName(var1); + } + if (IniFile.modPrivacy().getIniInt("ShowStatusUpdate", 0) == 1) Console.println(MessageFormat.format("{0} is now online.", new String[]{var1})); + } + } else if(var2 && !icontains(this.mutedOnlineFriends, var1)) { + this.mutedOnlineFriends.addElement(var1); + } + } + + } + } + + private void removeOnlineFriend(String var1, boolean var2) { + synchronized(this.friendsMutex) { + if(!var2) { + int var4 = this.onlineFriends.indexOf(var1); + if(var4 != -1) { + this.onlineFriends.removeElementAt(var4); + if(active == this) { + this.listChanged(); + if(this.moreFriendsDialog != null) { + this.moreFriendsDialog.removeName(var4); + } + if (IniFile.modPrivacy().getIniInt("ShowStatusUpdate", 0) == 1) Console.println(MessageFormat.format("{0} quit.", new String[]{var1})); + } + } + } else { + this.mutedOnlineFriends.removeElement(var1); } - } - } - if (var2 == 2) { - var4 = var3.getConsoles(); + } + } + + public void dialogDone(Object var1, boolean var2) { + System.out.println("TEST FRIEND"); + synchronized(this.friendsMutex) { + if(var1 == this.moreFriendsDialog) { + this.moreFriendsDialog = null; + } + + } + } + + public static boolean isValidUserName(String var0) { + String var1 = "_-"; + var0 = Console.parseUnicode(var0); + int var2 = var0.length(); + if(var2 >= 2 && var2 <= 16) { + char[] var3 = var0.toCharArray(); + + for(int var4 = 0; var4 < var2; ++var4) { + if(!Character.isLetterOrDigit(var3[var4]) && var1.indexOf(var3[var4]) == -1) { + return false; + } + } + + return true; + } else { + return false; + } + } + + void moreFriendsAction(String var1, MenuItem var2) { + this.activeFriendName = var1; + this.maybeFriendAction(var2); + } - while(var4.hasMoreElements()) { - var5 = var4.nextElement(); - if (var5 instanceof DefaultConsole) { - var6 = ((DefaultConsole)var5).getFriends(); - var6.sendAll(var0); - break; - } - } - } - - } - - public static String ilookup(Vector var0, String var1) { - int var2 = var0.size(); - - for(int var3 = 0; var3 < var2; ++var3) { - String var4 = (String)var0.elementAt(var3); - if (var4.equalsIgnoreCase(var1)) { - return var4; - } - } - - return null; - } - - public static int iindexOf(Vector var0, String var1) { - int var2 = var0.size(); - - for(int var3 = 0; var3 < var2; ++var3) { - String var4 = (String)var0.elementAt(var3); - if (var4.equalsIgnoreCase(var1)) { - return var3; - } - } - - return -1; - } - - public static boolean icontains(Vector var0, String var1) { - return iindexOf(var0, var1) != -1; - } - - public void changeMuteState(String var1, boolean var2) { - Object var3 = this.friendsMutex; - synchronized(var3) { - if (icontains(this.friends, var1)) { - if (var2) { - var1 = ilookup(this.onlineFriends, var1); - if (var1 != null) { - this.removeOnlineFriend(var1, false); - this.addOnlineFriend(var1, true); - } - } else { - var1 = ilookup(this.mutedOnlineFriends, var1); - if (var1 != null) { - this.removeOnlineFriend(var1, true); - this.addOnlineFriend(var1, false); - } - } - } - - } - } - - private void listChanged() { - this.cursedButton = -1; - this.clickedButton = -1; - this.clickedButtonDown = false; - this.repaint(); - } - - private void addOnlineFriend(String var1, boolean var2) { - Object var3 = this.friendsMutex; - synchronized(var3) { - if (this.friends != null && icontains(this.friends, var1)) { - if (!var2 && !icontains(this.onlineFriends, var1)) { - this.onlineFriends.addElement(var1); - if (active == this) { - this.listChanged(); - if (this.moreFriendsDialog != null) { - this.moreFriendsDialog.addName(var1); - } - } - } else if (var2 && !icontains(this.mutedOnlineFriends, var1)) { - this.mutedOnlineFriends.addElement(var1); - } - } - - } - } - - private void removeOnlineFriend(String var1, boolean var2) { - Object var3 = this.friendsMutex; - synchronized(var3) { - if (!var2) { - int var4 = this.onlineFriends.indexOf(var1); - if (var4 != -1) { - this.onlineFriends.removeElementAt(var4); - if (active == this) { - this.listChanged(); - if (this.moreFriendsDialog != null) { - this.moreFriendsDialog.removeName(var4); - } - } - } - } else { - this.mutedOnlineFriends.removeElement(var1); - } - - } - } - - public void dialogDone(Object var1, boolean var2) { - Object var3 = this.friendsMutex; - synchronized(var3) { - if (var1 == this.moreFriendsDialog) { - this.moreFriendsDialog = null; - } - - } - } - - public static boolean isValidUserName(String var0) { - String var1 = "_-"; - var0 = Console.parseUnicode(var0); - int var2 = var0.length(); - if (var2 >= 2 && var2 <= 16) { - char[] var3 = var0.toCharArray(); - - for(int var4 = 0; var4 < var2; ++var4) { - if (!Character.isLetterOrDigit(var3[var4]) && var1.indexOf(var3[var4]) == -1) { - return false; - } - } - - return true; - } else { - return false; - } - } - - void moreFriendsAction(String var1, MenuItem var2) { - this.activeFriendName = var1; - Debug.assert(this.activeFriendName != null); - this.maybeFriendAction(var2); - } } diff -ruN a/1890/NET/worlds/console/GammaTextArea.java b/1890/NET/worlds/console/GammaTextArea.java --- a/1890/NET/worlds/console/GammaTextArea.java 2023-08-21 23:27:15.000000000 -0500 +++ b/1890/NET/worlds/console/GammaTextArea.java 2023-08-21 23:27:17.000000000 -0500 @@ -2,515 +2,811 @@ import NET.worlds.core.Debug; import NET.worlds.core.IniFile; -import java.awt.Color; -import java.awt.Font; -import java.awt.FontMetrics; -import java.awt.Graphics; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Panel; -import java.awt.Scrollbar; -import java.awt.event.AdjustmentEvent; -import java.awt.event.AdjustmentListener; -import java.awt.event.FocusEvent; -import java.awt.event.KeyEvent; +import NET.worlds.scape.SendURLAction; +import NET.worlds.scape.TeleportAction; +import NET.worlds.scape.TeleportStatus; + +import java.awt.*; +import java.awt.datatransfer.Clipboard; +import java.awt.datatransfer.ClipboardOwner; +import java.awt.datatransfer.StringSelection; +import java.awt.event.*; import java.util.StringTokenizer; import java.util.Vector; -public class GammaTextArea extends Panel implements AdjustmentListener { - public static final int SCROLLBARS_BOTH = 1; - public static final int SCROLLBARS_VERTICAL_ONLY = 2; - public static final int SCROLLBARS_HORIZONTAL_ONLY = 3; - public static final int SCROLLBARS_NONE = 4; - protected static final int _margin = 2; - private int _width; - private int _height; - private StyledTextCanvas _canvas; - private String _string; - private Font _font; - private int _currentStyle; - private String _currentFontName; - private int _currentPointSize; - private Color _currentColor; - private GammaTextScrollbar _vertBar; - private GammaTextScrollbar _horzBar; - private int _numLines; - private int _canvasLines; - private int _scrollLine; - private Vector _lines; - private boolean _hasFocus; - public static String boldStartTag = ""; - public static String boldEndTag = ""; - public static String italicStartTag = ""; - public static String italicEndTag = ""; - public static String colorStartMagentaTag = ""; - public static String colorStartBlueTag = ""; - public static String colorStartRedTag = ""; - public static String colorStartGreenTag = ""; - public static String colorEndTag = ""; - public static String colorMagenta2Tag = ""; - public static String colorBlue2Tag = ""; - public static String colorRed2Tag = ""; - public static String colorGreen2Tag = ""; - public static String colorCyanTag = ""; - public static String colorDarkGrayTag = ""; - public static String colorGrayTag = ""; - public static String colorOrangeTag = ""; - public static String colorPinkTag = ""; - public static String colorYellowTag = ""; - public static String colorWhiteTag = ""; - public static String colorLightGrayTag = ""; - protected static String[] tagList; - - public Font getFont() { - return this._font; - } - - public int getWidth() { - return this._width; - } - - public int getHeight() { - return this._height; - } - - public void setWidth(int var1) { - this._width = var1 - 4; - } - - public void setHeight(int var1) { - this._height = var1 - 4; - } - - public Vector getLines() { - return this._lines; - } - - public int getScrollLine() { - return this._scrollLine; - } - - public int getCanvasLines() { - return this._canvasLines; - } - - public int getNumLines() { - return this._numLines; - } - - public boolean getHasFocus() { - return this._hasFocus; - } - - public Scrollbar getVertScrollbar() { - return this._vertBar; - } - - static Color getBackgroundColor() { - int var0 = IniFile.override().getIniInt("chatBgR", 255); - int var1 = IniFile.override().getIniInt("chatBgG", 255); - int var2 = IniFile.override().getIniInt("chatBgB", 203); - return new Color(var0, var1, var2); - } - - GammaTextArea(String var1, int var2, int var3, int var4) { - this._string = var1; - this._currentFontName = Console.message("GammaTextFont"); - this._currentStyle = 0; - this._currentPointSize = 12; - this._currentColor = Color.black; - this._font = new Font(this._currentFontName, this._currentStyle, this._currentPointSize); - this._canvas = new StyledTextCanvas(); - FontMetrics var5 = this._canvas.getFontMetrics(this._font); - Debug.dAssert(var5 != null); - int var6 = var5.getHeight(); - int var7 = var5.charWidth('M') * var3; - int var8 = var5.getHeight() * var2; - this._canvas.setSize(var7, var8); - this.setWidth(var7); - this.setHeight(var8); - this._lines = new Vector(); - this._hasFocus = false; - this._numLines = this._scrollLine = this._canvasLines = 0; - switch(var4) { - case 1: - this._vertBar = new GammaTextScrollbar(1); - this._horzBar = new GammaTextScrollbar(0); - break; - case 2: - this._vertBar = new GammaTextScrollbar(1); - this._horzBar = null; - break; - case 3: - this._vertBar = null; - this._horzBar = new GammaTextScrollbar(0); - break; - case 4: - this._vertBar = this._horzBar = null; - } - - GridBagLayout var9 = new GridBagLayout(); - this.setLayout(var9); - GridBagConstraints var10 = new GridBagConstraints(); - var10.fill = 1; - var10.weightx = 1.0D; - var10.weighty = 1.0D; - var9.setConstraints(this._canvas, var10); - this.add(this._canvas); - if (this._vertBar != null) { - var10 = new GridBagConstraints(); - var10.fill = 3; - var10.gridwidth = 0; - var9.setConstraints(this._vertBar, var10); - this.add(this._vertBar); - this._vertBar.addAdjustmentListener(this); - } - - if (this._horzBar != null) { - var10 = new GridBagConstraints(); - var10.fill = 2; - var10.gridwidth = 1; - this.add(this._horzBar); - this._horzBar.addAdjustmentListener(this); - } - - this.enableEvents(31L); - this._canvas.repaint(); - } - - public void update(Graphics var1) { - this.paint(var1); - } - - protected void processFocusEvent(FocusEvent var1) { - if (var1.getID() == 1004) { - this._hasFocus = true; - } else if (var1.getID() == 1005) { - this._hasFocus = false; - } - - this._canvas.repaint(); - super.processFocusEvent(var1); - } - - protected void processKeyEvent(KeyEvent var1) { - this._canvas.dispatchEvent(var1); - super.processKeyEvent(var1); - } - - public void adjustmentValueChanged(AdjustmentEvent var1) { - this._scrollLine = this._vertBar.getValue(); - this._canvas.repaint(); - } - - public void setEditable(boolean var1) { - if (var1) { - System.out.println("Can't set GammaTextArea to be editable."); - } - - } - - public synchronized String getText() { - return this._string; - } - - public synchronized void setText(String var1) { - this._string = var1; - this.wordWrapAll(); - this._scrollLine = this._numLines - this._canvasLines; - if (this._scrollLine < 0) { - this._scrollLine = 0; - } - - this.setScrollBounds(); - } - - public void repaint() { - this._canvas.repaint(); - super.repaint(); - } - - protected synchronized void wordWrapAll() { - this._lines.removeAllElements(); - this._numLines = 0; - this.wordWrap(this._string); - } - - protected boolean isLastLineVisible() { - return this._scrollLine == this._numLines - this._canvasLines || this._numLines <= this._canvasLines; - } - - protected boolean handleTag(String var1) { - if (var1.charAt(0) != '<') { - return false; - } else { - for(int var2 = 0; var2 < tagList.length; ++var2) { - if (var1.equals(tagList[var2])) { - switch(var2) { - case 0: - this._currentStyle |= 1; - break; - case 1: - this._currentStyle &= -2; - break; - case 2: - this._currentStyle |= 2; - break; - case 3: - this._currentStyle &= -3; - break; - case 4: - this._currentColor = Color.magenta; - break; - case 5: - this._currentColor = Color.red; - break; - case 6: - this._currentColor = Color.green; - break; - case 7: - this._currentColor = Color.blue; - break; - case 8: - this._currentColor = Color.black; - break; - case 9: - this._currentColor = Color.magenta; - break; - case 10: - this._currentColor = Color.blue; - break; - case 11: - this._currentColor = Color.red; - break; - case 12: - this._currentColor = Color.green; - break; - case 13: - this._currentColor = Color.cyan; - break; - case 14: - this._currentColor = Color.darkGray; - break; - case 15: - this._currentColor = Color.gray; - break; - case 16: - this._currentColor = Color.orange; - break; - case 17: - this._currentColor = Color.pink; - break; - case 18: - this._currentColor = Color.yellow; - break; - case 19: - this._currentColor = Color.white; - break; - case 20: - this._currentColor = Color.lightGray; - } - - try { - this._font = new Font(this._currentFontName, this._currentStyle, this._currentPointSize); - } catch (IllegalArgumentException var4) { - } - - return true; - } - } - - return false; - } - } - - protected void ClearTags(Graphics var1) { - if (this._currentStyle != 0) { - this._currentStyle = 0; - this._font = new Font(this._currentFontName, this._currentStyle, this._currentPointSize); - } - - if (this._currentColor != Color.black) { - this._currentColor = Color.black; - } - - var1.setFont(this._font); - var1.setColor(this._currentColor); - } - - protected synchronized void wordWrap(String var1) { - int var2 = this._width; - if (var2 > 0) { - StringTokenizer var3 = new StringTokenizer(var1, "\n\r"); - - label74: - while(var3.hasMoreTokens()) { - String var4 = var3.nextToken(); - StringTokenizer var5 = new StringTokenizer(var4, "\n\r\t -", true); - int var6 = 0; - String var7 = ""; - int var8 = 0; - FontMetrics var9 = this._canvas.getFontMetrics(this._font); - Debug.dAssert(var9 != null); - - while(true) { - while(true) { - String var10; - do { - do { - if (!var5.hasMoreTokens()) { - if (!var7.equals("")) { - ++this._numLines; - this._lines.addElement(var7.trim()); - } - continue label74; +public class GammaTextArea extends Panel implements AdjustmentListener, ActionListener { + public static final int SCROLLBARS_BOTH = 1; + public static final int SCROLLBARS_VERTICAL_ONLY = 2; + public static final int SCROLLBARS_HORIZONTAL_ONLY = 3; + public static final int SCROLLBARS_NONE = 4; + protected static final int _margin = 2; + private int _width; + private int _height; + private StyledTextCanvas _canvas; + private String _string; + private Font _font; + private int _currentStyle; + private String _currentFontName; + private int _currentPointSize; + private Color _currentColor; + private GammaTextScrollbar _vertBar; + private GammaTextScrollbar _horzBar; + private int _numLines; + private int _canvasLines; + private int _scrollLine; + private Vector _lines; + private Vector _pos; + private int _lastpos = 0; + protected int _curpos = 0; + private boolean _hasFocus; + protected int selectionStart = -1; + protected int selectionEnd = -1; + private static final Color skyblue = new Color(135, 206, 255); + private PopupMenu rightMenu; + private MenuItem textCopyItem = new MenuItem(Console.message("Copy")); + private MenuItem textCopyTextItem = new MenuItem(Console.message("Copy Text")); + private MenuItem textCopyAllItem = new MenuItem(Console.message("Copy All")); + private MenuItem textCopyAllTextItem = new MenuItem(Console.message("Copy All Text")); + private MenuItem textSaveItem = new MenuItem(Console.message("Save All Text")); + private MenuItem textOpenURLItem = new MenuItem(Console.message("Open URL")); + static Color bgColor = null; + private int _numColumns; + private int _numRows; + public static String boldStartTag = ""; + public static String boldEndTag = ""; + public static String italicStartTag = ""; + public static String italicEndTag = ""; + public static String colorStartMagentaTag = ""; + public static String colorStartBlueTag = ""; + public static String colorStartRedTag = ""; + public static String colorStartGreenTag = ""; + public static String colorEndTag = ""; + public static String colorMagenta2Tag = ""; + public static String colorBlue2Tag = ""; + public static String colorRed2Tag = ""; + public static String colorGreen2Tag = ""; + public static String colorCyanTag = ""; + public static String colorDarkGrayTag = ""; + public static String colorGrayTag = ""; + public static String colorOrangeTag = ""; + public static String colorPinkTag = ""; + public static String colorYellowTag = ""; + public static String colorWhiteTag = ""; + public static String colorLightGrayTag = ""; + protected static String[] tagList; + private int lastWidth = 0; + protected boolean selectionConversion = false; + protected int _initialSelection = -1; + + public Font getFont() { + return this._font; + } + + public int getWidth() { + return this._width; + } + + public int getHeight() { + return this._height; + } + + public void setWidth(int var1) { + this._width = var1 - 4; + } + + public void setHeight(int var1) { + this._height = var1 - 4; + } + + public Vector getLines() { + return this._lines; + } + + public int getScrollLine() { + return this._scrollLine; + } + + public int getCanvasLines() { + return this._canvasLines; + } + + public int getNumLines() { + return this._numLines; + } + + public boolean getHasFocus() { + return this._hasFocus; + } + + public Scrollbar getVertScrollbar() { + return this._vertBar; + } + + static Color getBackgroundColor() { + if (bgColor == null) { + int bgR = IniFile.override().getIniInt("chatBgR", 255); + int bgG = IniFile.override().getIniInt("chatBgG", 255); + int bgB = IniFile.override().getIniInt("chatBgB", 203); + bgColor = new Color(bgR, bgG, bgB); + } + + return bgColor; + } + + GammaTextArea(String text, int rows, int columns, int scrollbars) { + this._string = text; + this._numColumns = columns; + this._numRows = rows; + this._currentFontName = Console.message("GammaTextFont"); + this._currentStyle = 0; + this._currentPointSize = IniFile.gamma().getIniInt("ChatFontSize", 12); + this._currentColor = Color.black; + this._canvas = new StyledTextCanvas(); + this.setFontSize(this._currentPointSize); + this._lines = new Vector(); + this._pos = new Vector(); + this._lastpos = 0; + this._hasFocus = false; + this._numLines = this._scrollLine = this._canvasLines = 0; + switch(scrollbars) { + case 1: + this._vertBar = new GammaTextScrollbar(1); + this._horzBar = new GammaTextScrollbar(0); + break; + case 2: + this._vertBar = new GammaTextScrollbar(1); + this._horzBar = null; + break; + case 3: + this._vertBar = null; + this._horzBar = new GammaTextScrollbar(0); + break; + case 4: + this._vertBar = this._horzBar = null; + } + + GridBagLayout gridbag = new GridBagLayout(); + this.setLayout(gridbag); + GridBagConstraints c = new GridBagConstraints(); + c.fill = 1; + c.weightx = 1.0D; + c.weighty = 1.0D; + gridbag.setConstraints(this._canvas, c); + this.add(this._canvas); + if (this._vertBar != null) { + c = new GridBagConstraints(); + c.fill = 3; + c.gridwidth = 0; + gridbag.setConstraints(this._vertBar, c); + this.add(this._vertBar); + this._vertBar.addAdjustmentListener(this); + } + + if (this._horzBar != null) { + c = new GridBagConstraints(); + c.fill = 2; + c.gridwidth = 1; + this.add(this._horzBar); + this._horzBar.addAdjustmentListener(this); + } + + this.enableEvents(131231L); + this._canvas.repaint(); + } + + public synchronized void setFontSize(int fontsize) { + this._currentPointSize = fontsize; + this._font = new Font(this._currentFontName, this._currentStyle, this._currentPointSize); + this.recalcSize(); + } + + public synchronized void recalcSize() { + FontMetrics fm = this._canvas.getFontMetrics(this._font); + + if (fm == null) throw new Error(); + + int w = fm.charWidth('M') * this._numColumns; + int h = fm.getHeight() * this._numRows; + this.setWidth(w); + this.setHeight(h); + this._canvas.setSize(w, h); + this.setWidth(w); + this.setHeight(h); + } + + public void update(Graphics var1) { + this.paint(var1); + } + + protected synchronized void processMouseEvent(MouseEvent e) { + if (e.isPopupTrigger()) { + if (this.rightMenu != null && this.rightMenu.isEnabled()) { + this.hideRightMenu(); + } else { + this.showRightMenu(e.getX(), e.getY()); + } + } + + super.processMouseEvent(e); + } + + protected synchronized void processFocusEvent(FocusEvent e) { + if (e.getID() == 1004) { + this._hasFocus = true; + } else if (e.getID() == 1005) { + this._hasFocus = false; + } + + this._canvas.repaint(); + super.processFocusEvent(e); + } + + protected synchronized void processKeyEvent(KeyEvent e) { + this._canvas.dispatchEvent(e); + super.processKeyEvent(e); + } + + public synchronized void adjustmentValueChanged(AdjustmentEvent e) { + this._scrollLine = this._vertBar.getValue(); + this._canvas.repaint(); + } + + public void setEditable(boolean var1) { + if (var1) { + System.out.println("Can't set GammaTextArea to be editable."); + } + + } + + public synchronized String getText() { + return this._string; + } + + public synchronized void setText(String s) { + this._string = s; + this.wordWrapAll(); + this._scrollLine = this._numLines - this._canvasLines; + if (this._scrollLine < 0) { + this._scrollLine = 0; + } + + this.setScrollBounds(); + } + + public synchronized void repaint() { + this._canvas.repaint(); + super.repaint(); + } + + protected synchronized void wordWrapAll() { + this._lines.removeAllElements(); + this._pos.removeAllElements(); + this._numLines = 0; + this._lastpos = 0; + this.wordWrap(this._string); + } + + protected synchronized boolean isLastLineVisible() { + if (!this._canvas.mouseActive && (this.selectionStart < 0 || this.selectionEnd <= this.selectionStart)) { + return this._scrollLine >= this._numLines - this._canvasLines || this._numLines <= this._canvasLines; + } else { + return false; + } + } + + protected synchronized boolean handleTag(Graphics g, String word, int x, int y) { + String lower = word.toLowerCase(); + int color; + if (word.charAt(0) == '<') { + for (color = 0; color < tagList.length; ++color) { + if (lower.equals(tagList[color].toLowerCase())) { + switch (color) { + case 0: + this._currentStyle |= 1; + break; + case 1: + this._currentStyle &= -2; + break; + case 2: + this._currentStyle |= 2; + break; + case 3: + this._currentStyle &= -3; + break; + case 4: + this._currentColor = Color.magenta; + break; + case 5: + this._currentColor = Color.red; + break; + case 6: + this._currentColor = Color.green; + break; + case 7: + this._currentColor = Color.blue; + break; + case 8: + this._currentColor = Color.black; + break; + case 9: + this._currentColor = Color.magenta; + break; + case 10: + this._currentColor = Color.blue; + break; + case 11: + this._currentColor = Color.red; + break; + case 12: + this._currentColor = Color.green; + break; + case 13: + this._currentColor = Color.cyan; + break; + case 14: + this._currentColor = Color.darkGray; + break; + case 15: + this._currentColor = Color.gray; + break; + case 16: + this._currentColor = Color.orange; + break; + case 17: + this._currentColor = Color.pink; + break; + case 18: + this._currentColor = Color.yellow; + break; + case 19: + this._currentColor = Color.white; + break; + case 20: + this._currentColor = Color.lightGray; + } + + try { + this._font = new Font(this._currentFontName, this._currentStyle, this._currentPointSize); + } catch (IllegalArgumentException var4) { + } + + return true; + } + } + + return false; + } else return false; + } + + protected void ClearTags(Graphics var1) { + if (this._currentStyle != 0) { + this._currentStyle = 0; + this._font = new Font(this._currentFontName, this._currentStyle, this._currentPointSize); + } + + if (this._currentColor != Color.black) { + this._currentColor = Color.black; + } + + var1.setFont(this._font); + var1.setColor(this._currentColor); + } + + protected synchronized void wordWrap(String newText) { + int canvasWidth = this._width; + if (canvasWidth > 0) { + StringTokenizer rawLines = new StringTokenizer(newText, "\n\r"); + + label82: + while(rawLines.hasMoreTokens()) { + String rawLine = rawLines.nextToken(); + StringTokenizer words = new StringTokenizer(rawLine, "\n\r\t -", true); + int lineWidth = 0; + String thisLine = ""; + this.lastWidth = 0; + FontMetrics fm = this._canvas.getFontMetrics(this._font); + + if (fm == null) throw new Error(); + + while(true) { + while(true) { + String word; + do { + do { + if (!words.hasMoreTokens()) { + if (!thisLine.equals("")) { + this._pos.addElement(new Integer(this._lastpos)); + this._lastpos += thisLine.length() + 1; + ++this._numLines; + this._lines.addElement(thisLine.trim()); + } + continue label82; + } + + word = words.nextToken(); + } while(word.equals("\n")); + } while(word.equals("\r")); + + if (this.handleTag((Graphics)null, word, 0, 0)) { + lineWidth -= this.lastWidth; + thisLine = thisLine + word; + if (words.hasMoreTokens()) { + thisLine = thisLine + words.nextToken(); + } + + this.lastWidth = 0; + fm = this._canvas.getFontMetrics(this._font); + + if (fm == null) throw new Error(); + } else { + this.lastWidth = fm.stringWidth(word); + if (this.lastWidth >= canvasWidth) { + if (!thisLine.equals("")) { + this._pos.addElement(new Integer(this._lastpos)); + this._lastpos += thisLine.length(); + this._lines.addElement(thisLine.trim()); + ++this._numLines; + lineWidth = 0; + } + + while(this.lastWidth >= canvasWidth) { + word = this.breakWord(word, fm); + lineWidth = this.lastWidth = 0; + thisLine = ""; + if (word != null && word.length() > 0) { + this.lastWidth = fm.stringWidth(word); + } + } + } + + lineWidth += this.lastWidth; + if (lineWidth > 0 && word != null && word.length() > 0) { + if (lineWidth >= canvasWidth) { + this._pos.addElement(new Integer(this._lastpos)); + this._lastpos += thisLine.length(); + this._lines.addElement(thisLine.trim()); + ++this._numLines; + lineWidth = this.lastWidth; + thisLine = ""; + } + + thisLine = thisLine + word; + } } + } + } + } + + } + } + + protected String breakWord(String var1, FontMetrics var2) { + int var3 = 0; + String var4 = ""; + + for(int var5 = 0; var5 < var1.length(); ++var5) { + char var6 = var1.charAt(var5); + var3 += var2.charWidth(var6); + if (var3 >= this._width) { + this._lines.addElement(var4); + ++this._numLines; + return var1.substring(var5); + } + + var4 = var4 + var6; + } + + this._lines.addElement(var4); + ++this._numLines; + return ""; + } + + public synchronized void rewrap() { + if (this._width > 0 && this._height > 0) { + this.wordWrapAll(); + this._scrollLine = this._numLines - this._canvasLines; + if (this._scrollLine < 0) { + this._scrollLine = 0; + } + + this.setScrollBounds(); + this._canvas.repaint(); + } + + } + + private synchronized void setScrollBounds() { + FontMetrics var1 = this._canvas.getFontMetrics(this._font); + Debug.dAssert(var1 != null); + int var2 = var1.getHeight(); + this._canvasLines = this._height / var2; + if (this._vertBar != null) { + if (this._numLines <= this._canvasLines) { + this._vertBar.setEnabled(false); + } else { + this._vertBar.setEnabled(true); + this._vertBar.setValues(this._scrollLine, this._canvasLines, 0, this._numLines); + this._vertBar.setBlockIncrement(this._canvasLines); + } + } - var10 = var5.nextToken(); - } while(var10.equals("\n")); - } while(var10.equals("\r")); - - if (this.handleTag(var10)) { - var6 -= var8; - var7 = var7 + var10; - if (var5.hasMoreTokens()) { - var7 = var7 + var5.nextToken(); - } - - var8 = 0; - var9 = this._canvas.getFontMetrics(this._font); - Debug.dAssert(var9 != null); - } else { - var8 = var9.stringWidth(var10); - if (var8 >= var2) { - if (!var7.equals("")) { - this._lines.addElement(var7.trim()); - ++this._numLines; - var6 = 0; + } + + public synchronized void append(String var1) { + this._string = this._string + var1; + this.wordWrap(var1); + this._scrollLine = this._numLines - this._canvasLines; + if (this._scrollLine < 0) { + this._scrollLine = 0; + } + + this.setScrollBounds(); + } + + public synchronized void replaceRange(String var1, int var2, int var3) { + String var4 = this._string.substring(0, var2) + var1 + this._string.substring(var3); + this._string = var4; + } + + public synchronized void drawLine(Graphics g, int lineNum, int y) { + if (lineNum < this._pos.size()) { + String thisLine = (String)this._lines.elementAt(lineNum); + + if (thisLine == null) throw new Error(); + + this._curpos = ((Integer)this._pos.elementAt(lineNum)).intValue(); + StringTokenizer st = new StringTokenizer(thisLine, " \n\r", true); + int x = 0; + this.lastWidth = 0; + + while(st.hasMoreTokens()) { + String word = st.nextToken(); + if (!this.handleTag(g, word, 2 + x, y + 2)) { + this.drawString(g, word, 2 + x, y + 2); + this.lastWidth = g.getFontMetrics().stringWidth(word); + x += this.lastWidth; + } else { + x -= this.lastWidth; + if (st.hasMoreTokens()) { + this._curpos += st.nextToken().length(); + } + + this.lastWidth = 0; + g.setFont(this._font); + g.setColor(this._currentColor); + this._curpos += word.length(); + } + } + + this.ClearTags(g); + } + } + + private void drawString(Graphics g, String text, int x, int y) { + FontMetrics fm = g.getFontMetrics(); + int startdist; + int i; + if (this.selectionConversion) { + startdist = fm.getHeight(); + int pos = -1; + if (y - startdist < this._canvas.mouseY) { + if (y < this._canvas.mouseY) { + if (y < this._canvas.mouseY) { + if (this.selectionStart >= 0) { + pos = this._curpos + text.length(); + } + } else { + this.selectionConversion = false; + } + } else if (x <= this._canvas.mouseX) { + if (this._canvas.mouseX > x + g.getFontMetrics().stringWidth(text)) { + if (this.selectionStart >= 0 && this._curpos >= this.selectionStart) { + pos = this._curpos + text.length(); } + } else { + if (this._canvas.mouseDoubleClick) { + this._canvas.mouseDoubleClick = false; + this.selectionStart = this._initialSelection = this._curpos; + this.selectionEnd = this._curpos + text.length(); + pos = -1; + } else { + for(i = 0; i < text.length() - 1 && x + fm.stringWidth(text.substring(0, i + 1)) < this._canvas.mouseX; ++i) { + } - while(var8 >= var2) { - var10 = this.breakWord(var10, var9); - var6 = 0; - var7 = ""; - var8 = var9.stringWidth(var10); + pos = this._curpos + i; } - } - var6 += var8; - if (var6 >= var2) { - this._lines.addElement(var7.trim()); - ++this._numLines; - var6 = var8; - var7 = ""; - } - - var7 = var7 + var10; - } - } - } - } - - } - } - - protected String breakWord(String var1, FontMetrics var2) { - int var3 = 0; - String var4 = ""; - - for(int var5 = 0; var5 < var1.length(); ++var5) { - char var6 = var1.charAt(var5); - var3 += var2.charWidth(var6); - if (var3 >= this._width) { - this._lines.addElement(var4); - ++this._numLines; - return var1.substring(var5); - } - - var4 = var4 + var6; - } - - this._lines.addElement(var4); - ++this._numLines; - return ""; - } - - public synchronized void rewrap() { - if (this._width > 0 && this._height > 0) { - this.wordWrapAll(); - this._scrollLine = this._numLines - this._canvasLines; - if (this._scrollLine < 0) { - this._scrollLine = 0; - } + this.selectionConversion = false; + } + } else { + this.selectionConversion = false; + } + } else if (this.selectionStart >= 0 && this._curpos >= this.selectionStart) { + this.selectionConversion = false; + } + + if (pos >= 0) { + if (this.selectionStart < 0) { + this.selectionStart = this._initialSelection = pos; + this.selectionEnd = this.selectionStart + 1; + } else if (pos < this._initialSelection) { + this.selectionStart = pos; + this.selectionEnd = this._initialSelection + 1; + } else { + this.selectionStart = this._initialSelection; + this.selectionEnd = pos + 1; + } + } + } + + if (this.selectionStart >= 0 && this.selectionEnd > this.selectionStart) { + startdist = this.selectionStart - this._curpos; + if (startdist > 0) { + if (startdist < text.length()) { + i = text.length(); + if (this._curpos + i >= this.selectionEnd) { + i = this.selectionEnd - this._curpos; + } + + this.drawHighlight(g, text.substring(startdist, i), x + fm.stringWidth(text.substring(0, startdist)), y); + } + } else if (this.selectionEnd > this._curpos) { + if (this.selectionEnd - this._curpos < text.length()) { + this.drawHighlight(g, text.substring(0, this.selectionEnd - this._curpos), x, y); + } else { + this.drawHighlight(g, text, x, y); + } + } + } + + g.drawString(text, x, y); + this._curpos += text.length(); + } + + private void drawHighlight(Graphics g, String text, int x, int y) { + if (text != null && text.length() > 0) { + Color c = g.getColor(); + g.setColor(skyblue); + int height = g.getFontMetrics().getHeight(); + g.fillRect(x, y - (height - 2), g.getFontMetrics().stringWidth(text), height); + g.setColor(c); + } + + } + + public int getSelectionStart() { + return this.selectionStart; + } + + public int getSelectionEnd() { + return this.selectionEnd; + } + + public void setSelectionStart(int position) { + this.selectionStart = position; + } + + public void setSelectionEnd(int position) { + this.selectionEnd = position; + } + + public synchronized String getSelectionText() { + if (this.selectionStart >= 0 && this.selectionEnd > this.selectionStart) { + return this.getText().substring(this.selectionStart, this.selectionEnd); + } else { + return ""; + } + } + + private void initRightMenu() { + this.rightMenu = new PopupMenu(); + this.rightMenu.add(this.textCopyItem); + this.rightMenu.add(this.textCopyTextItem); + if (this.selectionStart >= 0 && this.selectionEnd > this.selectionStart) { + this.textCopyItem.setEnabled(true); + this.textCopyTextItem.setEnabled(true); + } else { + this.textCopyItem.setEnabled(false); + this.textCopyTextItem.setEnabled(false); + } + + this.rightMenu.add(this.textCopyAllItem); + this.rightMenu.add(this.textCopyAllTextItem); + this.rightMenu.add(this.textSaveItem); + this.rightMenu.add(this.textOpenURLItem); + this.rightMenu.addActionListener(this); + this.add(this.rightMenu); + } + + private void showRightMenu(int x, int y) { + if (this.rightMenu == null) { + this.initRightMenu(); + } + + this.rightMenu.show(this, x, y); + } + + private void hideRightMenu() { + this.remove(this.rightMenu); + this.rightMenu = null; + } + + public synchronized void actionPerformed(ActionEvent e) { + String text = null; + boolean doClean = false; + if (e.getActionCommand() == this.textCopyItem.getActionCommand()) { + text = this.getSelectionText(); + this.selectionStart = this.selectionEnd = -1; + this.repaint(); + } else if (e.getActionCommand() == this.textCopyTextItem.getActionCommand()) { + text = this.getSelectionText(); + doClean = true; + this.selectionStart = this.selectionEnd = -1; + this.repaint(); + } else if (e.getActionCommand() == this.textCopyAllItem.getActionCommand()) { + text = this.getText(); + } else if (e.getActionCommand() == this.textCopyAllTextItem.getActionCommand()) { + text = this.getText(); + doClean = true; + } else if (e.getActionCommand() == this.textOpenURLItem.getActionCommand()) { + text = this.getSelectionText().trim(); + if (text != null && text.length() > 5) { + if (!text.startsWith("http://") && !text.startsWith("https://") && !text.startsWith("world:")) { + text = "http://" + text; + } + + if (text.startsWith("world:") || text.indexOf(".world#") != -1 || (text.startsWith("http") || text.startsWith("file:")) && text.endsWith(".world")) { + if (text.startsWith("world:")) { + text = text.substring(6); + } + + TeleportAction.teleport(text, (TeleportStatus)null); + } else { + (new SendURLAction(text)).startBrowser(); + } + + this.selectionStart = this.selectionEnd = -1; + this.repaint(); + } + + this.hideRightMenu(); + return; + } else if (e.getActionCommand() == this.textSaveItem.getActionCommand()) { + new ChatSavePart(this._string); + return; + } + + if (doClean) { + StringTokenizer st = new StringTokenizer(text, " \n\r", true); + String newText = ""; + + while(st.hasMoreTokens()) { + String word = st.nextToken(); + if (!this.handleTag((Graphics)null, word, 0, 0)) { + newText = newText + word; + } else { + if (newText.length() > 0 && newText.substring(newText.length() - 1).toCharArray()[0] == ' ') { + newText = newText.substring(0, newText.length() - 1); + } + + if (st.hasMoreTokens()) { + st.nextToken(); + } + } + } + + text = newText; + } - this.setScrollBounds(); - this._canvas.repaint(); - } - - } - - private void setScrollBounds() { - FontMetrics var1 = this._canvas.getFontMetrics(this._font); - Debug.dAssert(var1 != null); - int var2 = var1.getHeight(); - this._canvasLines = this._height / var2; - if (this._vertBar != null) { - if (this._numLines <= this._canvasLines) { - this._vertBar.setEnabled(false); - } else { - this._vertBar.setEnabled(true); - this._vertBar.setValues(this._scrollLine, this._canvasLines, 0, this._numLines); - this._vertBar.setBlockIncrement(this._canvasLines); - } - } - - } - - public void append(String var1) { - this._string = this._string + var1; - this.wordWrap(var1); - this._scrollLine = this._numLines - this._canvasLines; - if (this._scrollLine < 0) { - this._scrollLine = 0; - } - - this.setScrollBounds(); - } - - public void replaceRange(String var1, int var2, int var3) { - String var4 = this._string.substring(0, var2) + var1 + this._string.substring(var3); - this._string = var4; - } - - public void drawLine(Graphics var1, int var2, int var3) { - String var4 = (String)this._lines.elementAt(var2); - Debug.dAssert(var4 != null); - StringTokenizer var5 = new StringTokenizer(var4, " \n\r", true); - int var6 = 0; - int var7 = 0; - - while(var5.hasMoreTokens()) { - String var8 = var5.nextToken(); - if (!this.handleTag(var8)) { - var1.drawString(var8, 2 + var6, var3 + 2); - var7 = var1.getFontMetrics().stringWidth(var8); - var6 += var7; - } else { - var6 -= var7; - if (var5.hasMoreTokens()) { - var5.nextToken(); - } - - var7 = 0; - var1.setFont(this._font); - var1.setColor(this._currentColor); - } - } - - this.ClearTags(var1); - } - - static { - tagList = new String[]{boldStartTag, boldEndTag, italicStartTag, italicEndTag, colorStartMagentaTag, colorStartRedTag, colorStartGreenTag, colorStartBlueTag, colorEndTag, colorMagenta2Tag, colorBlue2Tag, colorRed2Tag, colorGreen2Tag, colorCyanTag, colorDarkGrayTag, colorGrayTag, colorOrangeTag, colorPinkTag, colorYellowTag, colorWhiteTag, colorLightGrayTag}; - } + if (text != null && text.length() > 0) { + Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); + clipboard.setContents(new StringSelection(text), (ClipboardOwner)null); + } + + this.hideRightMenu(); + } + + static { + tagList = new String[]{boldStartTag, boldEndTag, italicStartTag, italicEndTag, colorStartMagentaTag, colorStartRedTag, colorStartGreenTag, colorStartBlueTag, colorEndTag, colorMagenta2Tag, colorBlue2Tag, colorRed2Tag, colorGreen2Tag, colorCyanTag, colorDarkGrayTag, colorGrayTag, colorOrangeTag, colorPinkTag, colorYellowTag, colorWhiteTag, colorLightGrayTag}; + } } diff -ruN a/1890/NET/worlds/console/HiddenDrone.java b/1890/NET/worlds/console/HiddenDrone.java --- a/1890/NET/worlds/console/HiddenDrone.java 1969-12-31 18:00:00.000000000 -0600 +++ b/1890/NET/worlds/console/HiddenDrone.java 2023-08-21 23:27:17.000000000 -0500 @@ -0,0 +1,4 @@ +package NET.worlds.console; + +public interface HiddenDrone { +} diff -ruN a/1890/NET/worlds/console/MuteListPart.java b/1890/NET/worlds/console/MuteListPart.java --- a/1890/NET/worlds/console/MuteListPart.java 2023-08-21 23:27:15.000000000 -0500 +++ b/1890/NET/worlds/console/MuteListPart.java 2023-08-21 23:27:17.000000000 -0500 @@ -7,242 +7,284 @@ import NET.worlds.network.WorldServer; import NET.worlds.scape.Drone; import NET.worlds.scape.FrameEvent; -import java.awt.Container; -import java.awt.Event; -import java.awt.MenuItem; -import java.text.MessageFormat; + +import java.awt.*; +import java.awt.Window; import java.util.Enumeration; import java.util.StringTokenizer; import java.util.Vector; public class MuteListPart implements FramePart, NameListOwner { - private static final String oldIniItemName = "Mutes"; - private static final String iniItemName = "Mute"; - private static final int maxMutes = 50; - private static final String separator = ";"; - private static MuteListPart active; - private Vector mutes; - private Vector syncMutes = new Vector(); - private MenuItem editItem; - private MenuItem disableWhisperItem; - private boolean rejectWhispers; - private DefaultConsole console; - private Galaxy galaxy; - private IniFile serverSection; - private Object mutesMutex = new Object(); - private Vector updates = new Vector(); - - private void loadMutes() { - this.mutes = new Vector(); - - String var2; - for(int var1 = 0; var1 < 50; ++var1) { - var2 = this.serverSection.getIniString("Mute" + var1, ""); - if (var2.length() == 0) { - break; - } - - if (FriendsListPart.isValidUserName(var2) && !FriendsListPart.icontains(this.mutes, var2)) { - this.mutes.addElement(var2); - } - } - - if (this.mutes.size() == 0) { - var2 = this.serverSection.getIniString("Mutes", ""); - StringTokenizer var3 = new StringTokenizer(var2, ";"); - - while(var3.hasMoreTokens() && this.mutes.size() < 50) { - String var4 = var3.nextToken(); - if (FriendsListPart.isValidUserName(var4) && !FriendsListPart.icontains(this.mutes, var4)) { - this.mutes.addElement(var4); + private static final String oldIniItemName = "Mutes"; + private static final String iniItemName = "Mute"; + private static final String separator = ";"; + private static MuteListPart active; + private Vector mutes; + private Vector tars; + private Vector syncMutes = new Vector(); + private MenuItem editItem; + private boolean rejectWhispers; + private boolean rejectTeleports; + private DefaultConsole console; + private Galaxy galaxy; + private IniFile serverSection; + private Object mutesMutex = new Object(); + private Object tarMutex = new Object(); + private Vector updates = new Vector(); + public static RejectHandler rej = new RejectHandler(); + + public MuteListPart() { + System.out.println("Mutes Loaded"); + } + + private void loadMutes() { + this.mutes = new Vector(); + this.tars = new Vector(); + + for(int var1 = 0; var1 < Integer.MAX_VALUE; ++var1) { + String var2 = this.serverSection.getIniString("Mute" + var1, ""); + if (var2.length() == 0) { + break; + } + + if (FriendsListPart.isValidUserName(var2) && !FriendsListPart.icontains(this.mutes, var2)) { + this.mutes.addElement(var2); + } + } + + for(int var1 = 0; var1 < Integer.MAX_VALUE; ++var1) { + String var2 = this.serverSection.getIniString("Tar" + var1, ""); + if (var2.length() == 0) { + break; + } + + if (FriendsListPart.isValidUserName(var2) && !FriendsListPart.icontains(this.tars, var2)) { + this.tars.addElement(var2); + } + } + + if (this.mutes.size() == 0) { + String var4 = this.serverSection.getIniString("Mutes", ""); + StringTokenizer var5 = new StringTokenizer(var4, ";"); + + while(var5.hasMoreTokens() && this.mutes.size() < 50) { + String var3 = var5.nextToken(); + if (FriendsListPart.isValidUserName(var3) && !FriendsListPart.icontains(this.mutes, var3)) { + this.mutes.addElement(var3); + } + } + + if (this.mutes.size() != 0) { + this.saveMutes(); + this.serverSection.setIniString("Mutes", ""); + } + } + + if (this.tars.size() == 0) { + String var4 = this.serverSection.getIniString("Tars", ""); + StringTokenizer var5 = new StringTokenizer(var4, ";"); + + while(var5.hasMoreTokens() && this.tars.size() < 50) { + String var3 = var5.nextToken(); + if (FriendsListPart.isValidUserName(var3) && !FriendsListPart.icontains(this.tars, var3)) { + this.tars.addElement(var3); + } + } + + if (this.tars.size() != 0) { + this.saveTars(); + this.serverSection.setIniString("Tars", ""); } - } + } + } - if (this.mutes.size() != 0) { + void saveMutes() { + int var2 = this.mutes.size(); + + for(int var3 = 0; var3 < var2; ++var3) { + this.serverSection.setIniString("Mute" + var3, (String)this.mutes.elementAt(var3)); + } + + this.serverSection.setIniString("Mute" + var2, ""); + } + + void saveTars() { + int var2 = this.tars.size(); + + for(int var3 = 0; var3 < var2; ++var3) { + this.serverSection.setIniString("Tar" + var3, (String)this.tars.elementAt(var3)); + } + + this.serverSection.setIniString("Tar" + var2, ""); + } + + public void activate(Console var1, Container var2, Console var3) { + active = this; + this.console = (DefaultConsole)var1; + this.editItem = var1.addMenuItem(Console.message("Edit-Mute-List"), "Options"); + this.editItem.setEnabled(this.mutes != null); + } + + public void deactivate() { + active = null; + this.editItem = null; + } + + public boolean action(Event var1, Object var2) { + if (var1.target == this.editItem) { + new EditNamesDialog(this, Console.message("Edit-Mute-List"), Console.message("Add-Mute-List")); + return true; + } else { + return false; + } + } + + public boolean handle(FrameEvent var1) { + synchronized(this.mutesMutex) { + int var3 = this.updates.size(); + if (var3 != 0) { + WorldServer var4 = this.console.getServerNew(); + if (var4 != null) { + for(int var5 = 0; var5 < var3; ++var5) { + String var6 = (String)this.updates.elementAt(var5); + boolean var7 = this.mutes.contains(var6); + NetworkObject var8 = var4.getObject(new ObjID(var6)); + if (var8 instanceof Drone) { + Drone var9 = (Drone)var8; + var9.muteStateChanged(); + } + + this.console.getFriends().changeMuteState(var6, var7); + } + + this.updates.removeAllElements(); + this.syncMutes = (Vector)this.mutes.clone(); + } + } + return true; + } + } + + public void setServer(WorldServer var1, IniFile var2) { + this.serverSection = var2; + this.galaxy = var1.getGalaxy(); + this.loadMutes(); + if (this.editItem != null) { + this.editItem.setEnabled(true); + } + + } + + public static boolean isMuted(WorldServer var0, String var1) { + if (var0 != null && var1 != null) { + Galaxy var2 = var0.getGalaxy(); + Enumeration var3 = var2.getConsoles(); + + while(var3.hasMoreElements()) { + Object var4 = var3.nextElement(); + if (var4 instanceof DefaultConsole) { + NET.worlds.console.MuteListPart var5 = ((DefaultConsole)var4).getMutes(); + if (var5.mutes != null) { + return FriendsListPart.icontains(var5.mutes, var1); + } + } + } + } + + return false; + } + + public static boolean isRejecting(WorldServer var0, String var5) { + if (var0 != null) { + Galaxy var1 = var0.getGalaxy(); + Enumeration var2 = var1.getConsoles(); + + while(var2.hasMoreElements()) { + Object var3 = var2.nextElement(); + if (var3 instanceof DefaultConsole) { + MuteListPart var4 = ((DefaultConsole)var3).getMutes(); + return var4.rejectWhispers || !allowWhisper(var5); + } + } + } + + return false; + } + + public static boolean isRejectingTele(WorldServer var0, String var5) { + if (var0 != null) { + Galaxy var1 = var0.getGalaxy(); + Enumeration var2 = var1.getConsoles(); + + while(var2.hasMoreElements()) { + Object var3 = var2.nextElement(); + if (var3 instanceof DefaultConsole) { + MuteListPart var4 = ((DefaultConsole)var3).getMutes(); + return var4.rejectTeleports || !allowTeleport(var5); + } + } + } + + return false; + } + + private static boolean allowWhisper(String player) { + int value = IniFile.gamma().getIniInt("WhisperPrivacy", 0); + if (value != 0) { + if (value == 1 && FriendsListPart.icontains(FriendsListPart.friends, player)) return true; + else return false; + } else return true; + } + + private static boolean allowTeleport(String player) { + int value = IniFile.gamma().getIniInt("TeleportPrivacy", 0); + if (value != 0) { + if (value == 1 && FriendsListPart.icontains(FriendsListPart.friends, player)) return true; + else return false; + } else return true; + } + + public int getNameListCount() { + return this.mutes.size(); + } + + public String getNameListName(int var1) { + return (String)this.mutes.elementAt(var1); + } + + public void removeNameListName(int var1) { + synchronized(this.mutesMutex) { + String var3 = (String)this.mutes.elementAt(var1); + this.mutes.removeElementAt(var1); this.saveMutes(); - this.serverSection.setIniString("Mutes", ""); - } - } - - } - - void saveMutes() { - String var1 = ""; - int var2 = this.mutes.size(); - - for(int var3 = 0; var3 < var2; ++var3) { - this.serverSection.setIniString("Mute" + var3, (String)this.mutes.elementAt(var3)); - } - - this.serverSection.setIniString("Mute" + var2, ""); - } - - private void setDisableWhisper() { - this.rejectWhispers = IniFile.gamma().getIniInt("RejectWhispers", 0) == 1; - if (this.rejectWhispers) { - this.disableWhisperItem.setLabel(Console.message("Accept-Whispers")); - } else { - this.disableWhisperItem.setLabel(Console.message("Reject-Whispers")); - } - - } - - public void activate(Console var1, Container var2, Console var3) { - active = this; - this.console = (DefaultConsole)var1; - this.editItem = var1.addMenuItem(Console.message("Edit-Mute-List"), "Options"); - this.editItem.setEnabled(this.mutes != null); - this.disableWhisperItem = var1.addMenuItem(Console.message("Reject-Whispers"), "Options"); - this.setDisableWhisper(); - } - - public void deactivate() { - active = null; - this.editItem = null; - } - - public boolean action(Event var1, Object var2) { - if (var1.target == this.editItem) { - new EditNamesDialog(this, Console.message("Edit-Mute-List"), Console.message("Add-Mute-List")); - return true; - } else { - if (var1.target == this.disableWhisperItem) { - IniFile.gamma().setIniInt("RejectWhispers", this.rejectWhispers ? 0 : 1); - this.setDisableWhisper(); - } - - return false; - } - } - - public boolean handle(FrameEvent var1) { - Object var2 = this.mutesMutex; - synchronized(var2) { - int var3 = this.updates.size(); - if (var3 != 0) { - WorldServer var4 = this.console.getServerNew(); - if (var4 != null) { - for(int var5 = 0; var5 < var3; ++var5) { - String var6 = (String)this.updates.elementAt(var5); - boolean var7 = this.mutes.contains(var6); - NetworkObject var8 = var4.getObject(new ObjID(var6)); - if (var8 instanceof Drone) { - Drone var9 = (Drone)var8; - var9.muteStateChanged(); - } - - this.console.getFriends().changeMuteState(var6, var7); - } - - this.updates.removeAllElements(); - this.syncMutes = (Vector)this.mutes.clone(); - } - } - - return true; - } - } - - public void setServer(WorldServer var1, IniFile var2) { - this.serverSection = var2; - this.galaxy = var1.getGalaxy(); - this.loadMutes(); - if (this.editItem != null) { - this.editItem.setEnabled(true); - } - - } - - public static boolean isMuted(WorldServer var0, String var1) { - if (var0 != null && var1 != null) { - Galaxy var2 = var0.getGalaxy(); - Enumeration var3 = var2.getConsoles(); - - while(var3.hasMoreElements()) { - Object var4 = var3.nextElement(); - if (var4 instanceof DefaultConsole) { - MuteListPart var5 = ((DefaultConsole)var4).getMutes(); - if (var5.mutes != null) { - return FriendsListPart.icontains(var5.mutes, var1); - } - } - } - } - - return false; - } - - public static boolean isRejecting(WorldServer var0) { - if (var0 != null) { - Galaxy var1 = var0.getGalaxy(); - Enumeration var2 = var1.getConsoles(); - - while(var2.hasMoreElements()) { - Object var3 = var2.nextElement(); - if (var3 instanceof DefaultConsole) { - MuteListPart var4 = ((DefaultConsole)var3).getMutes(); - if (var4.rejectWhispers) { - return true; - } - } - } - } - - return false; - } - - public int getNameListCount() { - return this.mutes.size(); - } - - public String getNameListName(int var1) { - return (String)this.mutes.elementAt(var1); - } - - public void removeNameListName(int var1) { - Object var2 = this.mutesMutex; - synchronized(var2) { - String var3 = (String)this.mutes.elementAt(var1); - this.mutes.removeElementAt(var1); - this.saveMutes(); - if (!this.updates.contains(var3)) { - this.updates.addElement(var3); - } - - } - } - - public boolean mayAddNameListName(java.awt.Window var1) { - if (this.mutes.size() < 50) { - return true; - } else { - Object[] var2 = new Object[]{new String("50")}; - new OkCancelDialog(var1, (DialogReceiver)null, Console.message("Too-many-names"), (String)null, Console.message("OK"), MessageFormat.format(Console.message("You-are-limitedM"), var2), true); - return false; - } - } - - public int addNameListName(String var1) { - Object var2 = this.mutesMutex; - synchronized(var2) { - if (var1.toLowerCase().startsWith("host")) { - byte var3 = -1; - return var3; - } else { - int var4 = FriendsListPart.iindexOf(this.mutes, var1); - if (var4 != -1) { - return var4; + if (!this.updates.contains(var3)) { + this.updates.addElement(var3); + } + } + } + + public boolean mayAddNameListName(Window var1) { + return true; + } + + public int addNameListName(String var1) { + synchronized(this.mutesMutex) { + if (var1.toLowerCase().startsWith("host")) { + return -1; } else { - this.mutes.addElement(var1); - this.saveMutes(); - if (!this.updates.contains(var1)) { - this.updates.addElement(var1); - } - - int var6 = this.mutes.size() - 1; - return var6; - } - } - } - } + int var3 = FriendsListPart.iindexOf(this.mutes, var1); + if (var3 != -1) { + return var3; + } else { + this.mutes.addElement(var1); + this.saveMutes(); + if (!this.updates.contains(var1)) { + this.updates.addElement(var1); + } + + return this.mutes.size() - 1; + } + } + } + } } diff -ruN a/1890/NET/worlds/console/OpenWhisperDialog.java b/1890/NET/worlds/console/OpenWhisperDialog.java --- a/1890/NET/worlds/console/OpenWhisperDialog.java 1969-12-31 18:00:00.000000000 -0600 +++ b/1890/NET/worlds/console/OpenWhisperDialog.java 2023-08-21 23:27:17.000000000 -0500 @@ -0,0 +1,83 @@ +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by FernFlower decompiler) +// + +package NET.worlds.console; + +import java.awt.Button; +import java.awt.Event; +import java.awt.Font; +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.awt.Label; +import java.awt.Panel; +import java.awt.TextField; +import java.awt.Window; + +public class OpenWhisperDialog extends PolledDialog { + private Button okButton = new Button(Console.message("OK")); + private Button cancelButton = new Button(Console.message("Cancel")); + private static Font font = new Font(Console.message("MenuFont"), 0, 12); + private static Font bfont = new Font(Console.message("ButtonFont"), 0, 12); + private TextField userField = new TextField(""); + + public OpenWhisperDialog(Window var1, DialogReceiver var2, String var3) { + super(var1, var2, var3, true); + this.ready(); + } + + public String getUser() { + return this.userField.getText(); + } + + protected void build() { + this.userField = new TextField("", 40); + this.userField.setFont(font); + GridBagLayout var1 = new GridBagLayout(); + this.setLayout(var1); + GridBagConstraints var2 = new GridBagConstraints(); + var2.fill = 0; + var2.weightx = 1.0D; + var2.weighty = 1.0D; + var2.gridwidth = 2; + var2.gridheight = 1; + this.add(var1, new Label(Console.message("Name")), var2); + var2.gridwidth = 0; + var2.fill = 2; + this.add(var1, this.userField, var2); + Panel var3 = new Panel(); + this.okButton.setFont(font); + this.cancelButton.setFont(font); + var3.add(this.okButton); + var3.add(this.cancelButton); + var2.gridwidth = 0; + var2.fill = 0; + this.add(var1, var3, var2); + } + + public void show() { + super.show(); + this.userField.requestFocus(); + this.userField.selectAll(); + } + + public boolean handleEvent(Event var1) { + return var1.id == 201 ? this.done(false) : super.handleEvent(var1); + } + + public boolean action(Event var1, Object var2) { + Object var3 = var1.target; + if (var3 == this.cancelButton) { + this.done(false); + } else if (var3 == this.okButton) { + this.done(true); + } + + return false; + } + + public boolean keyDown(Event var1, int var2) { + return var2 == 27 ? this.done(false) : super.keyDown(var1, var2); + } +} diff -ruN a/1890/NET/worlds/console/RejectHandler.java b/1890/NET/worlds/console/RejectHandler.java --- a/1890/NET/worlds/console/RejectHandler.java 1969-12-31 18:00:00.000000000 -0600 +++ b/1890/NET/worlds/console/RejectHandler.java 2023-08-21 23:27:17.000000000 -0500 @@ -0,0 +1,37 @@ +package NET.worlds.console; + +import java.util.ArrayList; +import java.util.List; + +public class RejectHandler { + + List whisperRej = null; + List teleportRej = null; + + public RejectHandler () { + if (whisperRej == null) { + whisperRej = new ArrayList(); + whisperRej.add("WORLDSMASTER"); + } + if (teleportRej == null) { + teleportRej = new ArrayList(); + teleportRej.add("WORLDSMASTER"); + } + } + + public boolean rejectTeleport(String var1) { + return teleportRej.contains(var1); + } + + public void addTeleportUser(String var1) { + teleportRej.add(var1); + } + + public boolean rejectWhisper(String var1) { + return whisperRej.contains(var1); + } + + public void addWhisperUser(String var1) { + whisperRej.add(var1); + } +} diff -ruN a/1890/NET/worlds/console/Shaper.java b/1890/NET/worlds/console/Shaper.java --- a/1890/NET/worlds/console/Shaper.java 2023-08-21 23:27:15.000000000 -0500 +++ b/1890/NET/worlds/console/Shaper.java 2023-08-21 23:27:17.000000000 -0500 @@ -1,5 +1,6 @@ package NET.worlds.console; +import NET.worlds.core.IniFile; import NET.worlds.network.URL; import NET.worlds.scape.LoadedURLSelf; import NET.worlds.scape.Manifest; @@ -9,271 +10,340 @@ import NET.worlds.scape.TeleportStatus; import NET.worlds.scape.URLSelf; import NET.worlds.scape.World; +import NET.worldsplus.ChatSaver; + import java.awt.Container; import java.awt.Event; import java.awt.Menu; import java.awt.MenuItem; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.io.FileWriter; import java.io.IOException; import java.util.Enumeration; public class Shaper implements MainCallback, DialogReceiver, LoadedURLSelf { - MenuItem newItem; - MenuItem openItem; - MenuItem saveItem; - MenuItem propItem; - MenuItem consolePropItem; - MenuItem pilotPropItem; - MenuItem undoItem; - MenuItem cutItem; - MenuItem copyItem; - MenuItem pasteItem; - MenuItem sortAttributesItem; - MenuItem snapToolItem; - MenuItem newLibraryItem; - MenuItem newLibraryEntryItem; - MenuItem iconsVisibleLibraryItem; - Menu worldsMenu; - MenuItem shaperVisibleItem; - private World newWorldTemplate; - private boolean makeNew = true; - private static URL newworld = URL.make("home:NewWorld.world"); - private boolean quitFlag; - private FileSaver fileSaver; - private boolean worldListHasChanged = false; - - public Shaper() { - Main.register(this); - } - - public void activate(Console var1, Container var2, Console var3) { - this.newItem = var1.addMenuItem(Console.message("New"), "File", 78, false); - this.openItem = var1.addMenuItem(Console.message("Open"), "File", 79, false); - this.saveItem = var1.addMenuItem(Console.message("Save"), "File", 83, false); - this.propItem = var1.addMenuItem(Console.message("World-Prop"), "File"); - this.consolePropItem = var1.addMenuItem(Console.message("Console-Prop"), "File"); - this.pilotPropItem = var1.addMenuItem(Console.message("Pilot-Prop"), "File"); - this.undoItem = var1.addMenuItem(Console.message("Undo"), "Edit", 90, false); - var1.getMenu("Edit").addSeparator(); - this.cutItem = var1.addMenuItem(Console.message("Cut"), "Edit", 88, false); - this.copyItem = var1.addMenuItem(Console.message("Copy"), "Edit", 67, false); - this.pasteItem = var1.addMenuItem(Console.message("Paste"), "Edit", 86, false); - this.sortAttributesItem = var1.addMenuItem(Console.message("Sort-Attributes"), "Edit"); - this.snapToolItem = var1.addMenuItem(Console.message("Snap-Tool-Settings"), "Edit"); - this.newLibraryItem = var1.addMenuItem(Console.message("New-Library"), "Libraries"); - this.newLibraryEntryItem = var1.addMenuItem(Console.message("New-Library-Entry"), "Libraries"); - this.iconsVisibleLibraryItem = var1.addMenuItem(Console.message("Icons-On-Off"), "Libraries", 73, false); - this.worldsMenu = var1.getMenu("Worlds"); - this.worldListChange(); - this.shaperVisibleItem = var1.addMenuItem(Console.message("Shaper-On-Off"), "Options"); - } - - public void deactivate() { - this.worldsMenu = null; - } - - public boolean action(Event var1, Object var2) { - GammaFrame var3 = Console.getFrame(); - if (var1.target == this.newItem) { - this.makeNew = true; - } else if (var1.target == this.openItem) { - new FileSysDialog(var3, this, Console.message("Open-World"), 0, "World Save Files|*.world|World Class Files|*.class|World Files|*.class;*.world", "", true); - } else if (var1.target == this.saveItem) { - new FileSysDialog(var3, this, Console.message("Save-World"), 1, "World Save Files|*.world|World Manifest (text) Files|*.mft", this.getSaveName(), true); - } else if (var1.target == this.propItem) { - if (Pilot.getActiveRoom() != null) { - var3.getEditTile().viewProperties(Pilot.getActiveWorld()); - } - } else if (var1.target == this.consolePropItem) { - var3.getEditTile().viewProperties(Console.getActive()); - } else if (var1.target == this.pilotPropItem) { - var3.getEditTile().viewProperties(Pilot.getActive()); - } else if (var1.target == this.sortAttributesItem) { - new AttributeSortPanel(var3); - } else if (var1.target == this.snapToolItem) { - new SnapToolPanel(var3); - } else if (var1.target == this.undoItem) { - var3.getEditTile().undo(); - } else if (var1.target == this.cutItem) { - var3.getEditTile().cut(); - } else if (var1.target == this.copyItem) { - var3.getEditTile().copy(); - } else if (var1.target == this.pasteItem) { - var3.getEditTile().paste(); - } else if (var1.target == this.newLibraryItem) { - var3.getLibrariesTile().addLibrary(); - } else if (var1.target == this.newLibraryEntryItem) { - var3.getLibrariesTile().addElement(); - } else if (var1.target == this.iconsVisibleLibraryItem) { - var3.getLibrariesTile().setIconsVisible(!var3.getLibrariesTile().isIconsVisible()); - } else if (var1.target == this.shaperVisibleItem) { - var3.setShaperVisible(!var3.isShaperVisible()); - } else { - int var4 = this.worldsMenu.countItems(); - - do { - --var4; - } while(var4 >= 0 && this.worldsMenu.getItem(var4) != var1.target); - - if (var4 < 0) { + MenuItem newItem; + MenuItem openItem; + MenuItem saveItem; + MenuItem propItem; + MenuItem consolePropItem; + MenuItem pilotPropItem; + MenuItem undoItem; + MenuItem cutItem; + MenuItem copyItem; + MenuItem pasteItem; + MenuItem sortAttributesItem; + MenuItem snapToolItem; + MenuItem newLibraryItem; + MenuItem newLibraryEntryItem; + MenuItem iconsVisibleLibraryItem; + Menu worldsMenu; + Menu whisperMenu; + MenuItem openWhisperItem; + MenuItem shaperVisibleItem; + private World newWorldTemplate; + private boolean makeNew = true; + private static URL newworld = URL.make("home:NewWorld.world"); + private boolean quitFlag; + private FileSaver fileSaver; + private boolean worldListHasChanged = false; + private boolean whisperListHasChanged = false; + + public Shaper() { + Main.register(this); + } + + public void activate(Console var1, Container var2, Console var3) { + this.newItem = var1.addMenuItem(Console.message("New"), "File", 78, false); + this.openItem = var1.addMenuItem(Console.message("Open"), "File", 79, false); + this.saveItem = var1.addMenuItem(Console.message("Save"), "File", 83, false); + this.propItem = var1.addMenuItem(Console.message("World-Prop"), "File"); + this.consolePropItem = var1.addMenuItem(Console.message("Console-Prop"), "File"); + this.pilotPropItem = var1.addMenuItem(Console.message("Pilot-Prop"), "File"); + this.undoItem = var1.addMenuItem(Console.message("Undo"), "Edit", 90, false); + var1.getMenu("Edit").addSeparator(); + this.cutItem = var1.addMenuItem(Console.message("Cut"), "Edit", 88, false); + this.copyItem = var1.addMenuItem(Console.message("Copy"), "Edit", 67, false); + this.pasteItem = var1.addMenuItem(Console.message("Paste"), "Edit", 86, false); + this.sortAttributesItem = var1.addMenuItem(Console.message("Sort-Attributes"), "Edit"); + this.snapToolItem = var1.addMenuItem(Console.message("Snap-Tool-Settings"), "Edit"); + this.newLibraryItem = var1.addMenuItem(Console.message("New-Library"), "Libraries"); + this.newLibraryEntryItem = var1.addMenuItem(Console.message("New-Library-Entry"), "Libraries"); + this.iconsVisibleLibraryItem = var1.addMenuItem(Console.message("Icons-On-Off"), "Libraries", 73, false); + this.worldsMenu = var1.getMenu("Worlds"); + this.whisperMenu = var1.getMenu("Whispers"); + this.openWhisperItem = var1.addMenuItem(Console.message("Open Whisper"), "Whispers"); + this.whisperMenu.addSeparator(); + + this.worldListChange(); + this.whisperListChanged(); + + this.shaperVisibleItem = var1.addMenuItem(Console.message("Shaper-On-Off"), "Options"); + } + + public void deactivate() { + this.worldsMenu = null; + this.whisperMenu = null; + } + + public boolean action(Event var1, Object var2) { + GammaFrame var3 = Console.getFrame(); + if (var1.target == this.newItem) { + this.makeNew = true; + } else if (var1.target == this.openItem) { + new FileSysDialog(var3, this, Console.message("Open-World"), 0, "World Save Files|*.world|World Class Files|*.class|World Files|*.class;*.world", "", true); + } else if (var1.target == this.saveItem) { + new FileSysDialog(var3, this, Console.message("Save-World"), 1, "World Save Files|*.world|World Manifest (text) Files|*.mft", this.getSaveName(), true); + } else if (var1.target == this.propItem) { + if (Pilot.getActiveRoom() != null) { + var3.getEditTile().viewProperties(Pilot.getActiveWorld()); + } + } else if (var1.target == this.consolePropItem) { + var3.getEditTile().viewProperties(Console.getActive()); + } else if (var1.target == this.pilotPropItem) { + var3.getEditTile().viewProperties(Pilot.getActive()); + } else if (var1.target == this.sortAttributesItem) { + new AttributeSortPanel(var3); + } else if (var1.target == this.snapToolItem) { + new SnapToolPanel(var3); + } else if (var1.target == this.undoItem) { + var3.getEditTile().undo(); + } else if (var1.target == this.cutItem) { + var3.getEditTile().cut(); + } else if (var1.target == this.copyItem) { + var3.getEditTile().copy(); + } else if (var1.target == this.pasteItem) { + var3.getEditTile().paste(); + } else if (var1.target == this.newLibraryItem) { + var3.getLibrariesTile().addLibrary(); + } else if (var1.target == this.newLibraryEntryItem) { + var3.getLibrariesTile().addElement(); + } else if (var1.target == this.iconsVisibleLibraryItem) { + var3.getLibrariesTile().setIconsVisible(!var3.getLibrariesTile().isIconsVisible()); + } else if (var1.target == this.openWhisperItem) { + new OpenWhisperDialog(var3, this, Console.message("open-whisper")); + } else if (var1.target == this.shaperVisibleItem) { + var3.setShaperVisible(!var3.isShaperVisible()); + } else { return false; - } + } + return true; + } + + public String getSaveName() { + return getSaveName(Pilot.getActive().getWorld()); + } + + public static String getSaveName(World var0) { + URL var1 = var0.getSourceURL(); + String var2 = var1.unalias(); + int var3 = var2.indexOf(58); + return var3 != -1 && var3 != 1 ? var1.getBase() : var2.replace('/', '\\'); + } + + public void dialogDone(Object var1, boolean var2) { + if (var2) { + if (var1 instanceof FileSysDialog) { + FileSysDialog var3 = (FileSysDialog) var1; + String var4 = var3.fileName(); + if (var3.getMode() == 0) { + TeleportAction.teleport(var4, (TeleportStatus) null, true); + } else { + this.doSave(var4); + } + } else if (var1 instanceof OpenWhisperDialog) { + Console.startWhispering(((OpenWhisperDialog)var1).getUser()); + } + } + } + + public void loadedURLSelf(URLSelf var1, URL var2, String var3) { + this.newWorldTemplate = (World)var1; + } + + public void mainCallback() { + if (this.quitFlag) { + if (this.fileSaver == null) { + this.fileSaver = new FileSaver(); + } + + switch(this.fileSaver.getState()) { + case 0: + GammaFrameState.saveBorder(); + Main.end(); + break; + case 2: + this.quitFlag = false; + this.fileSaver = null; + } + } + + if (this.newWorldTemplate != null) { + this.newWorldTemplate.incRef(); + } + + if (this.makeNew) { + this.makeNew = false; + if (this.newWorldTemplate == null) { + World.load(newworld, this, true); + } else { + World var1 = (World)this.newWorldTemplate.clone(); + var1.setEdited(true); + TeleportAction.teleport(var1.getSourceURL().getAbsolute(), (TeleportStatus)null); + } + } + + if (this.worldListHasChanged) { + this.worldListHasChanged = false; + this.rebuildWorldsMenu(); + } + + if (this.whisperListHasChanged) { + this.whisperListHasChanged = false; + this.rebuildWhisperMenu(); + } + } + + public void maybeQuit() { + this.quitFlag = true; + } + + public void worldListChange() { + this.worldListHasChanged = true; + } + + private void rebuildWorldsMenu() { + if (this.worldsMenu != null) { + while(this.worldsMenu.getItemCount() > 0) { + this.worldsMenu.remove(0); + } + + Enumeration var1 = World.getWorlds(); + + while(true) { + World var2; + URL var3; + String var4; + do { + if (!var1.hasMoreElements()) { + return; + } + + var2 = (World)var1.nextElement(); + var3 = var2.getSourceURL(); + if (var3 == null) { + var4 = var2.getName(); + break; + } + + var4 = var3.getAbsolute(); + } while(var3.equals(newworld)); + + if (var2.getEdited()) { + var4 = var4 + " (changed)"; + } + + MenuItem newItem = new MenuItem(var4); + newItem.addActionListener(new ActionListener() { + + public void actionPerformed(ActionEvent actionEvent) { + String var5 = ((MenuItem)actionEvent.getSource()).getLabel(); + if (var5.endsWith(" (changed)")) { + var5 = var5.substring(0, var5.length() - 10); + } + + TeleportAction.teleport(var5, (TeleportStatus) null); + } + }); + + this.worldsMenu.add(newItem); + } + } + } + + public void whisperListChanged() { + this.whisperListHasChanged = true; + } + + private void rebuildWhisperMenu() { + if (this.whisperMenu != null) { + while(this.whisperMenu.getItemCount() - 2 > 0) { + this.whisperMenu.remove(2); + } + + Enumeration var1 = WhisperManager.whisperManager().dialogs().elements(); + + + while(true) { + WhisperDialog var2; + String var4; + + do { + if (!var1.hasMoreElements()) { + return; + } + + var2 = (WhisperDialog) var1.nextElement(); + var4 = var2.partner; + } while (var4 == null); + + MenuItem newItem = new MenuItem(var4); + newItem.addActionListener(new ActionListener() { + + public void actionPerformed(ActionEvent actionEvent) { + Console.startWhispering(((MenuItem)actionEvent.getSource()).getLabel()); + } + }); + + this.whisperMenu.add(newItem); + } + } + } + + public void doSave(String var1) { + doSave(var1, Pilot.getActive().getWorld(), true); + } + + public static boolean doSave(String var0, World var1, boolean var2) { + if (var2 && var0.endsWith(".mft")) { + try { + Manifest var6 = new Manifest(var0); + var6.saveProps(var1); + var6.done(); + return true; + } catch (IOException var4) { + Console.println(Console.message("Error-manifest") + var4.toString()); + } + } else { + if (var0.toLowerCase().endsWith(".wor")) { + var0 = var0.substring(0, var0.length() - 4); + } + + if (!var0.toLowerCase().endsWith(".world")) { + var0 = var0 + ".world"; + } + + try { + Saver var3 = new Saver(new URL(URL.getCurDir(), var0)); + var3.save(var1); + var3.done(); + var1.setEdited(false); + return true; + } catch (IOException var5) { + Console.println(Console.message("Error-saving") + var5.toString()); + } + } - String var5 = (String)var2; - if (var5.endsWith(" (changed)")) { - var5 = var5.substring(0, var5.length() - 10); - } - - TeleportAction.teleport(var5, (TeleportStatus)null); - } - - return true; - } - - public String getSaveName() { - return getSaveName(Pilot.getActive().getWorld()); - } - - public static String getSaveName(World var0) { - URL var1 = var0.getSourceURL(); - String var2 = var1.unalias(); - int var3 = var2.indexOf(58); - return var3 != -1 && var3 != 1 ? var1.getBase() : var2.replace('/', '\\'); - } - - public void dialogDone(Object var1, boolean var2) { - if (var2) { - FileSysDialog var3 = (FileSysDialog)var1; - String var4 = var3.fileName(); - if (var3.getMode() == 0) { - TeleportAction.teleport(var4, (TeleportStatus)null, true); - } else { - this.doSave(var4); - } - } - - } - - public void loadedURLSelf(URLSelf var1, URL var2, String var3) { - this.newWorldTemplate = (World)var1; - } - - public void mainCallback() { - if (this.quitFlag) { - if (this.fileSaver == null) { - this.fileSaver = new FileSaver(); - } - - switch(this.fileSaver.getState()) { - case 0: - GammaFrameState.saveBorder(); - Main.end(); - break; - case 2: - this.quitFlag = false; - this.fileSaver = null; - } - } - - if (this.newWorldTemplate != null) { - this.newWorldTemplate.incRef(); - } - - if (this.makeNew) { - this.makeNew = false; - if (this.newWorldTemplate == null) { - World.load(newworld, this, true); - } else { - World var1 = (World)this.newWorldTemplate.clone(); - var1.setEdited(true); - TeleportAction.teleport(var1.getSourceURL().getAbsolute(), (TeleportStatus)null); - } - } - - if (this.worldListHasChanged) { - this.worldListHasChanged = false; - this.rebuildWorldsMenu(); - } - - } - - public void maybeQuit() { - this.quitFlag = true; - } - - public void worldListChange() { - this.worldListHasChanged = true; - } - - private void rebuildWorldsMenu() { - if (this.worldsMenu != null) { - while(this.worldsMenu.countItems() > 0) { - this.worldsMenu.remove(0); - } - - Enumeration var1 = World.getWorlds(); - - while(true) { - World var2; - URL var3; - String var4; - do { - if (!var1.hasMoreElements()) { - return; - } - - var2 = (World)var1.nextElement(); - var3 = var2.getSourceURL(); - if (var3 == null) { - var4 = var2.getName(); - break; - } - - var4 = var3.getAbsolute(); - } while(var3.equals(newworld)); - - if (var2.getEdited()) { - var4 = var4 + " (changed)"; - } - - this.worldsMenu.add(new MenuItem(var4)); - } - } - } - - public void doSave(String var1) { - doSave(var1, Pilot.getActive().getWorld(), true); - } - - public static boolean doSave(String var0, World var1, boolean var2) { - if (var2 && var0.endsWith(".mft")) { - try { - Manifest var6 = new Manifest(var0); - var6.saveProps(var1); - var6.done(); - return true; - } catch (IOException var4) { - Console.println(Console.message("Error-manifest") + var4.toString()); - } - } else { - if (var0.toLowerCase().endsWith(".wor")) { - var0 = var0.substring(0, var0.length() - 4); - } - - if (!var0.toLowerCase().endsWith(".world")) { - var0 = var0 + ".world"; - } - - try { - Saver var3 = new Saver(new URL(URL.getCurDir(), var0)); - var3.save(var1); - var3.done(); - var1.setEdited(false); - return true; - } catch (IOException var5) { - Console.println(Console.message("Error-saving") + var5.toString()); - } - } + return false; + } - return false; - } + private boolean containsItem(Menu menu, MenuItem item) { + for (int e = 0; e < menu.getItemCount(); e++) { + MenuItem curItem = menu.getItem(e); + System.out.println(curItem + " / " + item); + if (curItem == item) return true; + } + return false; + } } diff -ruN a/1890/NET/worlds/console/StyledTextCanvas.java b/1890/NET/worlds/console/StyledTextCanvas.java --- a/1890/NET/worlds/console/StyledTextCanvas.java 2023-08-21 23:27:15.000000000 -0500 +++ b/1890/NET/worlds/console/StyledTextCanvas.java 2023-08-21 23:27:17.000000000 -0500 @@ -1,5 +1,6 @@ package NET.worlds.console; +import NET.worlds.core.IniFile; import java.awt.Canvas; import java.awt.Color; import java.awt.FontMetrics; @@ -11,88 +12,196 @@ import java.awt.event.MouseEvent; class StyledTextCanvas extends Canvas { - public StyledTextCanvas() { - this.enableEvents(29L); - this.setEnabled(true); - } - - public void setBounds(int var1, int var2, int var3, int var4) { - if (this.getParent() instanceof GammaTextArea) { - GammaTextArea var5 = (GammaTextArea)this.getParent(); - var5.setWidth(var3); - var5.setHeight(var4); - var5.rewrap(); - } - - super.setBounds(var1, var2, var3, var4); - } - - protected void processMouseEvent(MouseEvent var1) { - if (var1.getID() == 500) { - this.getParent().requestFocus(); - } - - super.processMouseEvent(var1); - } - - protected void processKeyEvent(KeyEvent var1) { - if (var1.getID() == 401) { - Scrollbar var2 = null; - if (this.getParent() instanceof GammaTextArea) { - GammaTextArea var3 = (GammaTextArea)this.getParent(); - var2 = var3.getVertScrollbar(); - } - - if (var1.getKeyCode() == 33) { - if (var2 != null && var2.isEnabled()) { - var2.dispatchEvent(var1); + private static final long serialVersionUID = -2680423246934436331L; + private MouseEvent delayedMouseEvent = null; + protected int mouseX = -1; + protected int mouseY = -1; + protected int startX = -1; + protected int startY = -1; + protected int endX = -1; + protected int endY = -1; + protected long mouseWhen = 0L; + protected boolean mouseActive = false; + protected boolean mouseDoubleClick = false; + protected static long doubleClickSpeed = (long)IniFile.override().getIniInt("DoubleClickSpeed", 300); + + public StyledTextCanvas() { + this.enableEvents(61L); + this.setEnabled(true); + } + + public void sendDelayedMouseEvent(MouseEvent e) { + synchronized(this.getParent()) { + this.delayedMouseEvent = e; + } + } + + public void setBounds(int x, int y, int w, int h) { + if (this.getParent() != null && w >= 0 && h >= 0) { + synchronized(this.getParent()) { + if (this.getParent() instanceof GammaTextArea) { + GammaTextArea gta = (GammaTextArea)this.getParent(); + gta.setWidth(w); + gta.setHeight(h); + gta.rewrap(); + } + + super.setBounds(x, y, w, h); } - } else if (var1.getKeyCode() == 34 && var2 != null && var2.isEnabled()) { - var2.dispatchEvent(var1); - } - } - - super.processKeyEvent(var1); - } - - public void update(Graphics var1) { - this.paint(var1); - } - - public void paint(Graphics var1) { - if (this.getParent().isEnabled()) { - GammaTextArea var2 = (GammaTextArea)this.getParent(); - Rectangle var3 = this.getBounds(); - Image var4 = this.createImage(var3.width, var3.height); - Graphics var5 = var4.getGraphics(); - var5.setColor(GammaTextArea.getBackgroundColor()); - var5.fillRect(var3.x, var3.y, var3.width, var3.height); - var5.setColor(Color.black); - if (var2.getHasFocus()) { - var5.setColor(Color.blue); - var5.drawRect(var3.x, var3.y, var3.width - 1, var3.height - 1); - var5.drawRect(var3.x + 1, var3.y + 1, var3.width - 2, var3.height - 2); - var5.setColor(Color.black); - } - - var5.setFont(var2.getFont()); - FontMetrics var6 = var5.getFontMetrics(var2.getFont()); - int var7; - if (var2.getNumLines() <= var2.getCanvasLines()) { - for(var7 = 0; var7 < var2.getNumLines(); ++var7) { - var2.drawLine(var5, var7, (var7 + 1) * var6.getHeight()); + } + + } + + protected void processMouseMotionEvent(MouseEvent e) { + if (e.getID() == 506 && this.mouseActive) { + this.processMouseEvent(e); + } + + super.processMouseMotionEvent(e); + } + + protected void processMouseEvent(MouseEvent e) { + synchronized(this.getParent()) { + if (e.getID() == 500) { + if (this.mouseWhen > 0L && e.getWhen() - this.mouseWhen <= doubleClickSpeed) { + this.mouseDoubleClick = true; + this.mouseWhen = 0L; + this.mouseX = this.startX = this.endX = e.getX(); + this.mouseY = this.startY = this.endY = e.getY(); + ((GammaTextArea)this.getParent()).selectionConversion = true; + this.getParent().repaint(); + } else { + this.mouseDoubleClick = false; + this.mouseWhen = e.getWhen(); + if (e.getButton() == 1 && !this.mouseActive && (e.getModifiers() & 1) == 0) { + ((GammaTextArea)this.getParent()).selectionStart = -1; + ((GammaTextArea)this.getParent()).selectionEnd = -1; + } + } + + this.getParent().requestFocus(); + } else if (e.getID() == 501) { + if (e.getButton() == 1) { + if ((e.getModifiers() & 1) == 0) { + if (((GammaTextArea)this.getParent()).selectionStart >= 0 && ((GammaTextArea)this.getParent()).selectionEnd > ((GammaTextArea)this.getParent()).selectionStart) { + ((GammaTextArea)this.getParent()).selectionStart = -1; + ((GammaTextArea)this.getParent()).selectionEnd = -1; + } else { + this.mouseX = this.startX = this.endX = e.getX(); + this.mouseY = this.startY = this.endY = e.getY(); + this.mouseActive = true; + ((GammaTextArea)this.getParent()).selectionConversion = true; + } + } else { + this.mouseX = this.startX = this.endX = e.getX(); + this.mouseY = this.startY = this.endY = e.getY(); + this.mouseActive = true; + ((GammaTextArea)this.getParent()).selectionConversion = true; + } + + this.getParent().repaint(); + } + + this.getParent().requestFocus(); + } else if (!this.mouseActive || e.getID() != 506 && e.getID() != 507 && e.getID() != 507) { + if (e.getID() == 502) { + if (e.getButton() == 1 && this.mouseActive) { + this.mouseX = this.endX = e.getX(); + this.mouseY = this.endY = e.getY(); + this.mouseActive = false; + ((GammaTextArea)this.getParent()).selectionConversion = false; + this.getParent().repaint(); + } + + this.getParent().requestFocus(); + } + } else { + if ((e.getModifiers() & 16) != 0) { + this.mouseX = this.endX = e.getX(); + this.mouseY = this.endY = e.getY(); + ((GammaTextArea)this.getParent()).selectionConversion = true; + this.getParent().repaint(); + } + + this.getParent().requestFocus(); } - } else { - var7 = var2.getScrollLine(); - for(int var8 = 1; var7 < var2.getNumLines(); ++var8) { - var2.drawLine(var5, var7, var8 * var6.getHeight()); - ++var7; + ((GammaTextArea)this.getParent()).processMouseEvent(e); + super.processMouseEvent(e); + } + } + + public void update(Graphics g) { + this.paint(g); + } + + protected void processKeyEvent(KeyEvent e) { + synchronized(this.getParent()) { + if (e.getID() == 401) { + Scrollbar s = null; + if (this.getParent() instanceof GammaTextArea) { + GammaTextArea gta = (GammaTextArea)this.getParent(); + s = gta.getVertScrollbar(); + } + + if (e.getKeyCode() == 33) { + if (s != null && s.isEnabled()) { + s.dispatchEvent(e); + } + } else if (e.getKeyCode() == 34 && s != null && s.isEnabled()) { + s.dispatchEvent(e); + } } - } - var1.drawImage(var4, 0, 0, this); - } + super.processKeyEvent(e); + } + } + + public void paint(Graphics g) { + synchronized(this.getParent()) { + if (this.getParent().isEnabled()) { + GammaTextArea gta = (GammaTextArea)this.getParent(); + Rectangle r = this.getBounds(); + if (r.width <= 0 || r.height <= 0) { + return; + } + + Image offImage = this.createImage(r.width, r.height); + Graphics offGraphic = offImage.getGraphics(); + offGraphic.setColor(GammaTextArea.getBackgroundColor()); + offGraphic.fillRect(r.x, r.y, r.width, r.height); + offGraphic.setColor(Color.black); + if (gta.getHasFocus()) { + offGraphic.setColor(Color.blue); + offGraphic.drawRect(r.x, r.y, r.width - 1, r.height - 1); + offGraphic.drawRect(r.x + 1, r.y + 1, r.width - 2, r.height - 2); + offGraphic.setColor(Color.black); + } + + offGraphic.setFont(gta.getFont()); + FontMetrics fm = offGraphic.getFontMetrics(gta.getFont()); + gta._curpos = 0; + int i; + if (gta.getNumLines() <= gta.getCanvasLines()) { + for(i = 0; i < gta.getNumLines(); ++i) { + gta.drawLine(offGraphic, i, (i + 1) * fm.getHeight() - fm.getDescent()); + } + } else { + i = gta.getScrollLine(); + + for(int j = 1; i < gta.getNumLines(); ++j) { + gta.drawLine(offGraphic, i, j * fm.getHeight() - fm.getDescent()); + ++i; + } + } + + g.drawImage(offImage, 0, 0, this); + if (this.delayedMouseEvent != null) { + this.processMouseEvent(this.delayedMouseEvent); + this.delayedMouseEvent = null; + } + } - } + } + } } diff -ruN a/1890/NET/worlds/console/TarListPart.java b/1890/NET/worlds/console/TarListPart.java --- a/1890/NET/worlds/console/TarListPart.java 1969-12-31 18:00:00.000000000 -0600 +++ b/1890/NET/worlds/console/TarListPart.java 2023-08-21 23:27:17.000000000 -0500 @@ -0,0 +1,204 @@ +package NET.worlds.console; + +import NET.worlds.core.IniFile; +import NET.worlds.network.Galaxy; +import NET.worlds.network.NetworkObject; +import NET.worlds.network.ObjID; +import NET.worlds.network.WorldServer; +import NET.worlds.scape.Drone; +import NET.worlds.scape.FrameEvent; + +import java.awt.Window; +import java.awt.*; +import java.util.Enumeration; +import java.util.StringTokenizer; +import java.util.Vector; + +public class TarListPart implements FramePart, NameListOwner{ + private Galaxy galaxy; + private IniFile serverSection; + private final String name = Console.message("edit-tar-list"); + private static TarListPart active; + private DefaultConsole console; + private MenuItem editItem; + private Vector syncTars = new Vector(); + public Vector tars; + private Object tarMutex = new Object(); + private Vector updates = new Vector(); + + public void activate(Console console, Container container, Console console1) { + active = this; + this.console = (DefaultConsole)console; + this.editItem = console.addMenuItem(name, "Options"); + this.editItem.setEnabled(this.tars != null); + } + + public void deactivate() { + active = null; + this.editItem = null; + } + + public boolean action(Event event, Object o) { + if (event.target == this.editItem) { + new EditNamesDialog(this, name, Console.message("add-to-tar")); + return true; + } else { + return false; + } + } + + public boolean handle(FrameEvent frameEvent) { + synchronized(this.tarMutex) { + int var3 = this.updates.size(); + if (var3 != 0) { + WorldServer var4 = this.console.getServerNew(); + if (var4 != null) { + for(int var5 = 0; var5 < var3; ++var5) { + String var6 = (String)this.updates.elementAt(var5); + boolean var7 = this.tars.contains(var6); + NetworkObject var8 = var4.getObject(new ObjID(var6)); + if (var8 instanceof Drone) { + Drone var9 = (Drone)var8; + var9.avtStateChanged(); + } + + this.console.getFriends().changeMuteState(var6, var7); + } + + this.updates.removeAllElements(); + this.syncTars = (Vector)this.tars.clone(); + } + } + + return true; + } + } + + public int getNameListCount() { + return this.tars.size(); + } + + public String getNameListName(int i) { + return (String)this.tars.elementAt(i); + } + + public void removeNameListName(int i) { + synchronized(this.tarMutex) { + String var3 = (String)this.tars.elementAt(i); + this.tars.removeElementAt(i); + this.saveTars(); + if (!this.updates.contains(var3)) { + this.updates.addElement(var3); + } + } + } + + public boolean mayAddNameListName(Window window) { + return true; + } + + public int addNameListName(String s) { + synchronized(this.tarMutex) { + int var3 = TarListPart.iindexOf(this.tars, s); + if (var3 != -1) { + return var3; + } else { + this.tars.addElement(s); + this.saveTars(); + if (!this.updates.contains(s)) { + this.updates.addElement(s); + } + + return this.tars.size() - 1; + } + } + } + + private void loadTars() { + this.tars = new Vector(); + + for(int var1 = 0; var1 < 50; ++var1) { + String var2 = this.serverSection.getIniString("Tar" + var1, ""); + if (var2.length() == 0) { + break; + } + + if (FriendsListPart.isValidUserName(var2) && !FriendsListPart.icontains(this.tars, var2)) { + this.tars.addElement(var2); + } + } + + if (this.tars.size() == 0) { + String var4 = this.serverSection.getIniString("Tars", ""); + StringTokenizer var5 = new StringTokenizer(var4, ";"); + + while(var5.hasMoreTokens() && this.tars.size() < 50) { + String var3 = var5.nextToken(); + if (FriendsListPart.isValidUserName(var3) && !FriendsListPart.icontains(this.tars, var3)) { + this.tars.addElement(var3); + } + } + + if (this.tars.size() != 0) { + this.saveTars(); + this.serverSection.setIniString("Tars", ""); + } + } + + } + + void saveTars() { + String var1 = ""; + int var2 = this.tars.size(); + + for(int var3 = 0; var3 < var2; ++var3) { + this.serverSection.setIniString("Tar" + var3, (String)this.tars.elementAt(var3)); + } + + this.serverSection.setIniString("Tar" + var2, ""); + } + + public void setServer(WorldServer var1, IniFile var2) { + this.serverSection = var2; + this.galaxy = var1.getGalaxy(); + this.loadTars(); + if (this.editItem != null) { + this.editItem.setEnabled(true); + } + } + + public static boolean isTarred(WorldServer ws, String s) { + if (ws != null && s != null) { + Galaxy var2 = ws.getGalaxy(); + Enumeration var3 = var2.getConsoles(); + + while(var3.hasMoreElements()) { + Object var4 = var3.nextElement(); + if (var4 instanceof DefaultConsole) { + TarListPart var5 = ((DefaultConsole)var4).getTars(); + if (var5.tars != null) { + return TarListPart.icontains(var5.tars, s); + } + } + } + } + return false; + } + + public static int iindexOf(Vector var0, String var1) { + int var2 = var0.size(); + + for(int var3 = 0; var3 < var2; ++var3) { + String var4 = (String)var0.elementAt(var3); + if(var4.equalsIgnoreCase(var1)) { + return var3; + } + } + + return -1; + } + + public static boolean icontains(Vector var0, String var1) { + return iindexOf(var0, var1) != -1; + } +} diff -ruN a/1890/NET/worlds/console/WhisperManager.java b/1890/NET/worlds/console/WhisperManager.java --- a/1890/NET/worlds/console/WhisperManager.java 2023-08-21 23:27:15.000000000 -0500 +++ b/1890/NET/worlds/console/WhisperManager.java 2023-08-21 23:27:17.000000000 -0500 @@ -1,7 +1,11 @@ package NET.worlds.console; -import NET.worlds.network.NetUpdate; import NET.worlds.scape.InventoryManager; +import NET.worlds.scape.Pilot; +import NET.worldsplus.ChatSaver; + +import java.awt.Window; +import java.io.IOException; import java.util.Enumeration; import java.util.Hashtable; @@ -9,102 +13,129 @@ private static WhisperManager manager_; private Hashtable dialogs_ = new Hashtable(); private Hashtable tradeDialogs_ = new Hashtable(); - private java.awt.Window parent; + private Window parent; private String inventory = ""; final String tradeServerName = "TRADE"; - static GiftDialog outstandingGift; - private WhisperManager() { + + private WhisperManager() + { + this.dialogs_ = new Hashtable(); + this.tradeDialogs_ = new Hashtable(); } - public static WhisperManager whisperManager() { + public static WhisperManager whisperManager() + { if (manager_ == null) { manager_ = new WhisperManager(); } - return manager_; } - void setParent(java.awt.Window var1) { - this.parent = var1; + void setParent(Window p) + { + this.parent = p; } - public Hashtable dialogs() { + public Hashtable dialogs() + { return this.dialogs_; } - public Hashtable tradeDialogs() { + public Hashtable tradeDialogs() + { return this.tradeDialogs_; } - private WhisperDialog findWhisperDialog(String var1) { - return !this.dialogs_.containsKey(var1) ? null : (WhisperDialog)this.dialogs_.get(var1); + private WhisperDialog findWhisperDialog(String to) + { + if (!this.dialogs_.containsKey(to)) { + return null; + } + return (WhisperDialog)this.dialogs_.get(to); } - private TradeDialog findTradeDialog(String var1) { - return !this.tradeDialogs_.containsKey(var1) ? null : (TradeDialog)this.tradeDialogs_.get(var1); + private TradeDialog findTradeDialog(String to) + { + if (!this.tradeDialogs_.containsKey(to)) { + return null; + } + return (TradeDialog)this.tradeDialogs_.get(to); } - private WhisperDialog start(String var1, boolean var2) { - WhisperDialog var3 = this.findWhisperDialog(var1); - if (var3 == null) { - this.dialogs_.put(var1, var3 = new WhisperDialog(this.parent, var1)); + private WhisperDialog start(String to, boolean takeFocus) + { + WhisperDialog wd = findWhisperDialog(to); + if (wd == null) { + this.dialogs_.put(to, wd = new WhisperDialog(this.parent, to)); } - - if (var2) { - var3.takeFocus(); + if (takeFocus) { + wd.takeFocus(); } - - var3.ready(); - return var3; + wd.ready(); + if (Gamma.shaperEnabled()) Gamma.shaper.whisperListChanged(); + return wd; } - public void remove(String var1) { - this.dialogs_.remove(var1); + public void remove(String name) + { + this.dialogs_.remove(name); } - public void startTo(String var1) { - this.start(var1, true); + public void startTo(String to) + { + WhisperDialog wd = start(to, true); } - public TradeDialog startToTrade(String var1) { - TradeDialog var2 = this.findTradeDialog(var1); - if (var2 == null) { - this.tradeDialogs_.put(var1, var2 = new TradeDialog(this.parent, var1)); + public TradeDialog startToTrade(String to) { + TradeDialog wd = findTradeDialog(to); + if (wd == null) { + this.tradeDialogs_.put(to, wd = new TradeDialog(this.parent, to)); } + wd.takeFocus(); + wd.ready(); + wd.setTrading(true); + wd.whisperPart.println(Console.message("trade-start")); - var2.takeFocus(); - var2.ready(); - var2.setTrading(true); - var2.whisperPart.println(Console.message("trade-start")); - return var2; + return wd; } - public void printFrom(String var1, String var2) { - if (var2.startsWith("&|+")) { - if (var2.startsWith("&|+gift>") && var1.equalsIgnoreCase("TRADE")) { - maybeQueryGift(var2.substring(8)); - } else if (var2.startsWith("&|+inv>") && var1.equalsIgnoreCase("TRADE")) { - this.tradeMsg(var2.substring(7)); - } else if (var2.startsWith("&|+trade>")) { - TradeDialog var4 = this.findTradeDialog(var1); - if (var2.equals("&|+trade>cancel") && (var4 == null || !var4.isActive() || !var4.isTrading)) { - return; - } - - var4 = this.startToTrade(var1); - var4.print(var2); + public void printFrom(String from, String msg) { + try { + ChatSaver.chatSaver.saveWhisper(from, Console.getActive().getLongID(), msg); + } catch (IOException e) { + e.printStackTrace(); + } + if (!msg.startsWith("&|+")) + { + WhisperDialog it = findWhisperDialog(from); + if ((msg.equals("&|+trade>cancel")) && ( + (it == null) || (!it.isActive()) || (!it.isTrading))) { + return; } - } else { - WhisperDialog var3 = this.findWhisperDialog(var1); - if (var2.equals("&|+trade>cancel") && (var3 == null || !var3.isActive() || !var3.isTrading)) { + it = start(from, false); + it.print(msg); + } + else if ((msg.startsWith("&|+gift>")) && + (from.equalsIgnoreCase("TRADE"))) + { + maybeQueryGift(msg.substring(8)); + } + else if ((msg.startsWith("&|+inv>")) && + (from.equalsIgnoreCase("TRADE"))) + { + tradeMsg(msg.substring(7)); + } + else if (msg.startsWith("&|+trade>")) + { + TradeDialog it = findTradeDialog(from); + if ((msg.equals("&|+trade>cancel")) && ( + (it == null) || (!it.isActive()) || (!it.isTrading))) { return; } - - var3 = this.start(var1, false); - var3.print(var2); + it = startToTrade(from); + it.print(msg); } - } public void tradeMsg(String var1) { @@ -122,26 +153,23 @@ } public void printTo(String var1, String var2) { + try { + ChatSaver.chatSaver.saveWhisper(Console.getActive().getLongID(), var1, var2); + } catch (IOException e) { + e.printStackTrace(); + } if (!var1.equals("world") && !var1.equals("TRADE")) { if (!var2.startsWith("&|+") || var2.startsWith("&|+trade>")) { WhisperDialog var3 = this.start(var1, false); var3.send(var2); } - } } - public void giftDialogDone() { - outstandingGift = null; - } - - public static void maybeQueryGift(String var0) { - if (NetUpdate.isInternalVersion()) { - Console var1 = Console.getActive(); - if (var1 != null && outstandingGift == null && !var1.isSleeping()) { - outstandingGift = new GiftDialog(var0, 3000000); - } - + public static void maybeQueryGift(String inv) { + Console c = Console.getActive(); + if ((c != null)) { + TradeDialog.sendTradeMessage("&|+deal>TRADE ," + inv); } } } diff -ruN a/1890/NET/worlds/core/IniFile.java b/1890/NET/worlds/core/IniFile.java --- a/1890/NET/worlds/core/IniFile.java 2023-08-21 23:27:15.000000000 -0500 +++ b/1890/NET/worlds/core/IniFile.java 2023-08-21 23:27:17.000000000 -0500 @@ -4,7 +4,7 @@ String file; String section; static boolean initialized = false; - private static IniFile gamma_ = null; + private static final IniFile gamma_ = null; private static IniFile override_ = null; public IniFile(String var1) { @@ -17,17 +17,37 @@ this.section = var2; } - public static IniFile gamma() { - if (gamma_ == null) { - gamma_ = new IniFile("Gamma"); + public static IniFile ini(String name) { + return ini(gamma_, name); + } + + public static IniFile ini(IniFile ini, String name) { + if (!initialized) { + nativeInit(); + initialized = true; + } + + if (ini == null) { + ini = new IniFile(name); } + return ini; + } + + public static IniFile modPlus() { return ini("WorldsPlus"); } + + public static IniFile modColorfulTags() { return ini("ColorfulTags"); } + public static IniFile modChatLog() { return ini("ChatLog"); } + + public static IniFile modPrivacy() { return ini("Privacy"); } + + public static IniFile gamma() { if (!initialized) { nativeInit(); initialized = true; } - return gamma_; + return ini(gamma_, "Gamma"); } public static IniFile override() { diff -ruN a/1890/NET/worlds/network/textCmd.java b/1890/NET/worlds/network/textCmd.java --- a/1890/NET/worlds/network/textCmd.java 2023-08-21 23:27:15.000000000 -0500 +++ b/1890/NET/worlds/network/textCmd.java 2023-08-21 23:27:17.000000000 -0500 @@ -1,14 +1,12 @@ package NET.worlds.network; -import NET.worlds.console.BBChatCommand; -import NET.worlds.console.BlackBox; -import NET.worlds.console.Console; -import NET.worlds.console.GammaTextArea; -import NET.worlds.console.MuteListPart; +import NET.worlds.console.*; import NET.worlds.core.IniFile; import NET.worlds.scape.Drone; import NET.worlds.scape.Pilot; import NET.worlds.scape.PosableDrone; +import NET.worldsplus.ChatSaver; + import java.io.IOException; public class textCmd extends receivedNetPacket { @@ -17,13 +15,14 @@ protected String _text; public textCmd() { - super._commandType = 14; + this._commandType = 14; } public textCmd(String var1) { super((ObjID)null, 14); this._senderID = new ObjID(""); this._text = var1; + } void parseNetData(ServerInputStream var1) throws IOException { @@ -53,8 +52,13 @@ } } + try { + ChatSaver.chatSaver.saveRoom(this._senderID.longID(), this._text); + } catch (IOException e) { + e.printStackTrace(); + } handleActionText(var1, this._text, var2, this._senderID); - if (!this._text.startsWith("&|+")) { + if (!this._text.startsWith("&|+") || (IniFile.gamma().getIniInt("DisableAction2", 1) == 1 && this._text.startsWith("&|+action2>"))) { this.displayText(var2, this._text); } @@ -108,7 +112,7 @@ ((PosableDrone)var4).animate(var5); } - if (var1.startsWith("&|+action2>")) { + if (var1.startsWith("&|+action2>") && IniFile.gamma().getIniInt("DisableAction2", 1) == 0) { int var9 = var1.indexOf("|sender|"); var5 = null; String var6 = null; diff -ruN a/1890/NET/worlds/network/whisperCmd.java b/1890/NET/worlds/network/whisperCmd.java --- a/1890/NET/worlds/network/whisperCmd.java 2023-08-21 23:27:15.000000000 -0500 +++ b/1890/NET/worlds/network/whisperCmd.java 2023-08-21 23:27:17.000000000 -0500 @@ -3,63 +3,84 @@ import NET.worlds.console.Console; import NET.worlds.console.FriendsListPart; import NET.worlds.console.MuteListPart; +import NET.worlds.core.IniFile; import NET.worlds.scape.WorldScriptManager; +import NET.worlds.console.RejectHandler; +import NET.worldsplus.ChatSaver; + +import java.io.IOException; 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 whisperRejMSG = Console.message("not-whispers"); + private static String teleportRejMSG = Console.message("not-teleports"); + private static String reject = Console.message("rejected"); + RejectHandler rej = MuteListPart.rej; + + public whisperCmd() { + this._commandType = 17; + } + + public whisperCmd(String var1, String msg) { + super(msg); + WorldScriptManager.getInstance().onConversation(var1, msg); + this._commandType = 17; + this._objID = new ObjID(var1); + } + + void process(WorldServer var1) { + String var2; + Object[] var3; + if (this._senderID.longID() == null) { + var3 = new Object[]{new String(String.valueOf(this._senderID.shortID()))}; + var2 = MessageFormat.format(Console.message("Unknown-Name"), var3); + } else { + var2 = this._senderID.longID(); + if (MuteListPart.isMuted(var1, var2)) { + try { + ChatSaver.chatSaver.saveWhisper(var2, Console.getActive().getLongID(), this._text); + var1.sendNetworkMsg(new NET.worlds.network.whisperCmd(var2, Console.message("have-you-muted"))); + } catch (InfiniteWaitException var4) { } catch (PacketTooLargeException var5) { } catch (IOException var6) { } - public whisperCmd() { - super._commandType = 17; - } - - public whisperCmd(String var1, String var2) { - super(var2); - WorldScriptManager.getInstance().onConversation(var1, var2); - super._commandType = 17; - super._objID = new ObjID(var1); - } - - void process(WorldServer var1) throws Exception { - String var2; - Object[] var3; - if (super._senderID.longID() == null) { - var3 = new Object[]{new String(String.valueOf(super._senderID.shortID()))}; - var2 = MessageFormat.format(Console.message("Unknown-Name"), var3); - } else { - var2 = super._senderID.longID(); - if (MuteListPart.isMuted(var1, var2)) { - try { - var1.sendNetworkMsg(new whisperCmd(var2, Console.message("have-you-muted"))); - } catch (InfiniteWaitException var5) { - } catch (PacketTooLargeException var6) { + return; } - return; - } + if (!this._text.startsWith("&|+") && MuteListPart.isRejecting(var1, var2)) { + try { + if (!this._text.equals(whisperRejMSG)) { + var3 = new Object[]{"whisper", var2}; + if (IniFile.modPrivacy().getIniInt("WhisperFeedback", 1) == 1) Console.println(MessageFormat.format(Console.message("rejected"), var3)); + if (!rej.rejectWhisper(var2)) { + if (IniFile.modPrivacy().getIniInt("WhisperResponse", 1) == 1) var1.sendNetworkMsg(new NET.worlds.network.whisperCmd(var2, whisperRejMSG)); + rej.addWhisperUser(var2); + } + } + } catch (InfiniteWaitException var6) { } catch (PacketTooLargeException var7) { } catch (IOException var6) { } + return; + } - if (!super._text.startsWith("&|+") && MuteListPart.isRejecting(var1)) { - try { - if (!super._text.equals(rejectMsg)) { - var3 = new Object[]{new String(var2)}; - Console.println(MessageFormat.format(Console.message("You-rejected"), var3)); - var1.sendNetworkMsg(new whisperCmd(var2, rejectMsg)); - } - } catch (InfiniteWaitException var7) { - } catch (PacketTooLargeException var8) { + if (this._text.startsWith("&|+where?") && MuteListPart.isRejectingTele(var1, var2)) { + try { + if (!this._text.equals(teleportRejMSG)) { + var3 = new Object[]{"teleport", var2}; + if (IniFile.modPrivacy().getIniInt("TeleportFeedback", 1) == 1) Console.println(MessageFormat.format(Console.message("rejected"), var3)); + if (!rej.rejectTeleport(var2)) { + if (IniFile.modPrivacy().getIniInt("TeleportResponse", 0) == 1) var1.sendNetworkMsg(new NET.worlds.network.whisperCmd(var2, teleportRejMSG)); + rej.addTeleportUser(var2); + } + } + } catch (InfiniteWaitException var6) { } catch (PacketTooLargeException var7) { } + return; } + } - return; - } - } - - FriendsListPart.processWhisper(var1, var2, super._text); - textCmd.handleActionText(var1, super._text, var2, super._senderID); - Console.printWhisper(var2, FilthFilter.get().filter(super._text)); - } - - public String toString(WorldServer var1) { - return Console.message("WHISPER") + " " + super._senderID.toString(var1) + " --> " + super._objID.toString(var1) + ": " + super._text; - } + FriendsListPart.processWhisper(var1, var2, this._text); + handleActionText(var1, this._text, var2, this._senderID); + Console.printWhisper(var2, FilthFilter.get().filter(this._text)); + } + + public String toString(WorldServer var1) { + return Console.message("WHISPER") + " " + this._senderID.toString(var1) + " --> " + this._objID.toString(var1) + ": " + this._text; + } } diff -ruN a/1890/NET/worlds/scape/Drone.java b/1890/NET/worlds/scape/Drone.java --- a/1890/NET/worlds/scape/Drone.java 2023-09-22 14:36:46.000000000 -0500 +++ b/1890/NET/worlds/scape/Drone.java 2023-08-21 23:27:17.000000000 -0500 @@ -1,866 +1,975 @@ package NET.worlds.scape; -import NET.worlds.console.BBAppearDroneCommand; -import NET.worlds.console.BBDisappearDroneCommand; -import NET.worlds.console.BBDroneBitmapCommand; -import NET.worlds.console.BBDroneDeltaPosCommand; -import NET.worlds.console.BBMoveDroneCommand; -import NET.worlds.console.BlackBox; -import NET.worlds.console.Console; -import NET.worlds.console.FriendsListPart; -import NET.worlds.console.Main; -import NET.worlds.console.MainCallback; -import NET.worlds.console.MuteListPart; +import NET.worlds.console.*; import NET.worlds.core.Debug; import NET.worlds.core.IniFile; import NET.worlds.core.ServerTableManager; import NET.worlds.core.Std; -import NET.worlds.network.FilthFilter; -import NET.worlds.network.Galaxy; -import NET.worlds.network.InfiniteWaitException; -import NET.worlds.network.NetworkObject; -import NET.worlds.network.ObjID; -import NET.worlds.network.OldPropertyList; -import NET.worlds.network.PacketTooLargeException; -import NET.worlds.network.PropertyList; -import NET.worlds.network.URL; -import NET.worlds.network.WorldServer; -import NET.worlds.network.net2Property; -import NET.worlds.network.netProperty; -import NET.worlds.network.propReqCmd; -import java.awt.Color; +import NET.worlds.network.*; + +import java.awt.*; import java.io.IOException; import java.net.MalformedURLException; import java.util.Enumeration; import java.util.Hashtable; +import java.util.Random; import java.util.Vector; public abstract class Drone extends WObject implements NetworkObject, WobLoaded, MouseDownHandler, FrameHandler { - private int _last_FrameTime; - private int _last_PosTime; - private int _vel_x; - private int _vel_y; - private int _vel_z; - private int _vel_yaw; - private int _last_x; - private int _last_y; - private int _last_z; - private int _last_yaw; - private int _x; - private int _y; - private int _z; - private int _yaw; - private boolean inited = false; - protected WObject tag; - protected WObject tagbg; - private Console console; - private float tagHeight; - private Shape sleepBox; - static boolean showNametags; - private static String[] employeeAccounts; - private static Hashtable employeeHash; - public static Vector usableDrones; - private int lastUsed; - protected WorldServer _server; - private String sleepMode; - private static Object classCookie; - private static Object classCookieInterpolatedDrone; - - public Drone(ObjID var1, WorldServer var2) { - if (var2 != null) { - Debug.dAssert(var1 != null); - this.attachToServer(var2.getLongID(var1), var2); - } - - } - - protected Drone(String var1, WorldServer var2) { - Debug.dAssert(var1 != null); - if (var2 != null) { - this.attachToServer(var1, var2); - } - - } - - private void attachToServer(String var1, WorldServer var2) { - if (var2 != null) { - Debug.dAssert(Main.isMainThread()); - String var3 = null; - if (this.tag != null) { - var3 = this.getLongID(); - } - - this.getSharer().createDynamicFromNet(); - this.setName(var1); - String var4 = this.getLongID(); - this._server = var2; - this._server.incRefCnt(this); - this._server.regObject((String)var4, this); - - try { - this._server.sendNetworkMsg(new propReqCmd(new ObjID(this.getLongID()))); - } catch (InfiniteWaitException var7) { - } catch (PacketTooLargeException var8) { - Debug.dAssert(false); - } - - if (var4.equals(var3)) { - this.avatarHeightChangedTo(189.0F); - } else { - this.makeTag(false); - } - - Main.register(new Drone.MakeSleepBox()); - } - } - - private static void flushUnusedDrones() { - Vector var0 = usableDrones; - synchronized(var0) { - int var1 = Std.getFastTime(); - int var2 = usableDrones.size(); - - while(true) { - --var2; - if (var2 < 0) { - return; - } - - Drone var3 = (Drone)usableDrones.elementAt(var2); - if (var1 > var3.lastUsed + 2000) { - usableDrones.removeElementAt(var2); - var3.discard(); - } - } - } - } - - public static boolean isEmployeeAccount(String var0) { - if (employeeHash == null) { - employeeHash = new Hashtable(); - - for(int var1 = 0; var1 < employeeAccounts.length; ++var1) { - employeeHash.put(employeeAccounts[var1], employeeAccounts[var1]); - } - } - - return employeeHash.get(var0) != null; - } - - public void makeTag(boolean var1) { - this.tagHeight = 195.0F; - if (this.tag != null) { - this.tagHeight = this.tag.getZ(); - this.tag.detach(); - this.tag = null; - } - - if (this.tagbg != null) { - this.tagbg.detach(); - this.tagbg = null; - } - - if ((this._server != null || var1) && !(this instanceof MutedDrone) && showNametags) { - String var2 = this.getLongID(); - String var3 = FilthFilter.get().filterName(var2); - if (var3 != null && !var3.equals("")) { - Texture[] var4 = new Texture[1]; - boolean var6 = RenderWare.get3DHardwareInUse(); - boolean var7 = var3.toLowerCase().startsWith(Console.message("host")) || var3.toLowerCase().startsWith("host"); - if (var7) { - var3 = Console.message("host-upper") + var3.substring(4); - } - - boolean var8 = var3.toLowerCase().startsWith(Console.message("guest-")) || var3.toLowerCase().startsWith("guest-"); - if (var8) { - var3 = Console.message("guest-upper") + var3.substring(5); - } - - boolean var9 = isEmployeeAccount(var3); - Color var10; - if (var8) { - var10 = Color.pink; - } else if (var7) { - var10 = Color.yellow; - } else if (var9) { - var10 = Color.cyan; - } else { - var10 = Color.lightGray; + private int _last_FrameTime; + private int _last_PosTime; + private int _vel_x; + private int _vel_y; + private int _vel_z; + private int _vel_yaw; + private int _last_x; + private int _last_y; + private int _last_z; + private int _last_yaw; + private int _x; + private int _y; + private int _z; + private int _yaw; + private boolean inited = false; + protected WObject tag; + protected WObject tagbg; + private Console console; + private float tagHeight; + private Shape sleepBox; + static boolean showNametags; + private static final String[] employeeAccounts; + private static Hashtable employeeHash; + public static final Vector usableDrones; + private int lastUsed; + protected WorldServer _server; + private String sleepMode; + private static final Object classCookie; + private static final Object classCookieInterpolatedDrone; + + public Drone(ObjID var1, WorldServer var2) { + if (var2 != null) { + Debug.dAssert(var1 != null); + this.attachToServer(var2.getLongID(var1), var2); + } + + } + + protected Drone(String var1, WorldServer var2) { + Debug.dAssert(var1 != null); + if (var2 != null) { + this.attachToServer(var1, var2); + } + + } + + private void attachToServer(String var1, WorldServer var2) { + if (var2 != null) { + Debug.dAssert(Main.isMainThread()); + String var3 = null; + if (this.tag != null) { + var3 = this.getLongID(); + } + + this.getSharer().createDynamicFromNet(); + this.setName(var1); + String var4 = this.getLongID(); + this._server = var2; + this._server.incRefCnt(this); + this._server.regObject(var4, this); + + try { + this._server.sendNetworkMsg(new propReqCmd(new ObjID(this.getLongID()))); + } catch (InfiniteWaitException ignored) { + } catch (PacketTooLargeException ignored) { } - var4[0] = new StringTexture(var3, Console.message("TagFont"), 48, Color.black, var6 ? new Color(254, 254, 254) : var10); - byte var5 = 14; - int var11 = var3.length() * 10; - Hologram var12 = new Hologram((float)var11, (float)var5, var4); - var12.setViewplaneAligned(true); - var12.raise(this.tagHeight); - var12.setScaleDist(300.0F); - this.tag = var12; - this.tag.setVisible(true); - this.tag.setBumpable(false); - this.tag.setLocalShadowed(false); - this.tag.setShadowedLocally(true); - this.add(this.tag); - if (var6) { - Texture[] var13 = new Texture[]{new StringTexture(var3, Console.message("TagFont"), 48, Color.black, var10)}; - Hologram var14 = new Hologram((float)var11, (float)var5, var13); - var14.setViewplaneAligned(true); - var14.raise(this.tagHeight); - var14.setScaleDist(300.0F); - var14.setMaterial(new Material(0.75F, 0.0F, 0.0F, Color.white, (Texture)null, 0.5F, false, false)); - this.tagbg = var14; - this.tagbg.setVisible(true); - this.tagbg.setBumpable(false); - this.tagbg.setLocalShadowed(false); - this.tagbg.setShadowedLocally(true); - this.add(this.tagbg); - } - - } - } - } - - protected void avatarHeightChangedTo(float var1) { - if (this.tag != null) { - this.tag.raise(var1 + 1.0F + 5.0F - this.tag.getZ()); - } - - if (this.tagbg != null) { - this.tagbg.raise(var1 + 1.0F + 5.0F - this.tagbg.getZ()); - } - - } - - public void detachFromServer(boolean var1) { - Debug.dAssert(Main.isMainThread()); - if (this._server != null) { - this._server.delObject(new ObjID(this.getLongID())); - this._server.decRefCnt(this); - this._server = null; - } - - if (var1) { - this.lastUsed = Std.getFastTime(); - Vector var2 = usableDrones; - synchronized(var2) { - usableDrones.addElement(this); - } - } - - } - - public static Drone make(ObjID var0, WorldServer var1) { - Vector var2 = usableDrones; - synchronized(var2) { - if (!usableDrones.isEmpty() && var0 != null && var1 != null) { - String var4 = "!" + var1.getLongID(var0); - - int var5; - Drone var6; - for(var5 = usableDrones.size() - 1; var5 > 0; --var5) { - var6 = (Drone)usableDrones.elementAt(var5); - if (var6.getName().equals(var4)) { - break; - } - } - - var6 = (Drone)usableDrones.elementAt(var5); - if (!var6.getName().equals(var4) && usableDrones.size() < 5) { - HoloDrone var7 = new HoloDrone(var0, var1); - return var7; + if (var4.equals(var3)) { + this.avatarHeightChangedTo(189.0F); } else { - usableDrones.removeElementAt(var5); - var6.attachToServer(var1.getLongID(var0), var1); - return var6; - } - } else { - HoloDrone var3 = new HoloDrone(var0, var1); - return var3; - } - } - } - - public Drone() { - } - - public boolean handle(MouseDownEvent var1) { - if (this._server != null && (var1.key & 1) == 1) { - FriendsListPart.droneClick(this, var1); - } - - return true; - } - - public float animate(String var1) { - if (var1.equalsIgnoreCase("_hdb")) { - new Drone.BounceNametag(); - } - - return 0.0F; - } - - public Vector getAnimationList() { - return new Vector(); - } - - public void muteStateChanged() { - this.setAvatarNow(this.getCurrentURL()); - } - - public boolean shouldBeMuted() { - return MuteListPart.isMuted(this._server, this.getLongID()); - } - - private World getOwnerWorld() { - WObject var1 = (WObject)this.getOwner(); - Room var2 = var1 == null ? null : var1.getRoom(); - World var3 = var2 == null ? null : var2.getWorld(); - return var3; - } - - public boolean shouldBeForcedHuman() { - World var1 = this.getOwnerWorld(); - return var1 != null && var1.getForceHuman(); - } - - public URL getCurrentURL() { - return this instanceof PosableDrone ? ((PosableDrone)this).getPosableShapeURL() : this.getSourceURL(); - } - - public Drone setAvatarNow(URL var1) { - if (var1 == null) { - return this; - } else { - if (this.shouldBeForcedHuman()) { - var1 = PosableShape.getHuman(var1); - if (Console.getActive() != null) { - Console.getActive().pendingPilot = var1.toString(); - } - } - - var1 = PosableShape.getPermitted(var1, this.getWorld()); - boolean var2 = this.shouldBeMuted(); - if (var1.equals(this.getCurrentURL()) && var2 == (this instanceof MutedDrone)) { - return this; - } else if (!var1.endsWith(".rwx") && !var1.endsWith(".rwg") && !var1.endsWith(".mov")) { - String var7 = var1.getInternal(); - if (var7.endsWith(".pilot")) { - var7 = var7.substring(0, var7.length() - 6) + ".drone"; - } else if (!var7.endsWith(".drone")) { - var7 = var7 + ".drone"; + this.makeTag(false); } - var1 = URL.make(var7); - if (var1.equals(this.getSourceURL())) { - return this; + Main.register(new Drone$MakeSleepBox(this)); + } + } + + private static void flushUnusedDrones() { + synchronized(usableDrones) { + int var1 = Std.getFastTime(); + int var2 = usableDrones.size(); + + while(true) { + --var2; + if (var2 < 0) { + return; + } + + Drone var3 = (Drone)usableDrones.elementAt(var2); + if (var1 > var3.lastUsed + 2000) { + usableDrones.removeElementAt(var2); + var3.discard(); + } + } + } + } + + public static boolean isEmployeeAccount(String var0) { + if (employeeHash == null) { + employeeHash = new Hashtable(); + + for(int var1 = 0; var1 < employeeAccounts.length; ++var1) { + employeeHash.put(employeeAccounts[var1], employeeAccounts[var1]); + } + } + + return employeeHash.get(var0) != null; + } + + public void makeTag(boolean var1) { + this.tagHeight = 195.0F; + if (this.tag != null) { + this.tagHeight = this.tag.getZ(); + this.tag.detach(); + this.tag = null; + } + + if (this.tagbg != null) { + this.tagbg.detach(); + this.tagbg = null; + } + + if ((this._server != null || var1) && !(this instanceof MutedDrone) && showNametags) { + String var2 = this.getLongID(); + String var3 = FilthFilter.get().filterName(var2); + if (var3 != null && !var3.equals("")) { + Texture[] var4 = new Texture[1]; + boolean isHost = var3.toLowerCase().startsWith(Console.message("host")) || var3.toLowerCase().startsWith("host"); + if (isHost) { + var3 = Console.message("host-upper") + var3.substring(4); + } + + boolean isGuest = var3.toLowerCase().startsWith(Console.message("guest-")) || var3.toLowerCase().startsWith("guest-"); + if (isGuest) { + var3 = Console.message("guest-upper") + var3.substring(5); + } + + boolean colorfulMod = IniFile.gamma().getIniInt("ColorfulTags", 0) == 1; + boolean randomizeTag = false, underline = false; + boolean transparent = IniFile.modColorfulTags().getIniInt("Transparent", 0) == 1; + boolean isTar = TarListPart.isTarred(_server, var3); + Color userTextColor, employeeTextColor, hostTextColor, guestTextColor, tarTextColor; + Color userTagColor, employeeTagColor, hostTagColor, guestTagColor, tarTagColor; + try { + if (colorfulMod) { + randomizeTag = IniFile.modColorfulTags().getIniInt("RandomizeColors", 0) == 1; + underline = IniFile.modColorfulTags().getIniInt("UnderlineStaff", 1) == 1; + + /* + * Color Parsing + * + * This is setup like this so we don't have 3 values for each tag type. Keeps the INI clean. + * If the value isn't valid, given we are parsing a string into 3 ints, we should just use the default. + */ + + userTagColor = parseColor(IniFile.modColorfulTags().getIniString("UserTagColor", "192,192,192")); + userTextColor = parseColor(IniFile.modColorfulTags().getIniString("UserTextColor", "0,0,0")); + + employeeTagColor = parseColor(IniFile.modColorfulTags().getIniString("EmployeeTagColor", "0,255,255")); + employeeTextColor = parseColor(IniFile.modColorfulTags().getIniString("EmployeeTextColor", "0,0,0")); + + hostTagColor = parseColor(IniFile.modColorfulTags().getIniString("HostTagColor", "255,255,0")); + hostTextColor = parseColor(IniFile.modColorfulTags().getIniString("HostTextColor", "0,0,0")); + + guestTagColor = parseColor(IniFile.modColorfulTags().getIniString("GuestTagColor", "255,192,203")); + guestTextColor = parseColor(IniFile.modColorfulTags().getIniString("GuestTextColor", "0,0,0")); + + tarTagColor = parseColor(IniFile.modColorfulTags().getIniString("TarTagColor", "192,192,192")); + tarTextColor = parseColor(IniFile.modColorfulTags().getIniString("TarTextColor", "0,0,0")); + } else { + throw new Exception(); + } + } catch (Exception e1) { + userTagColor = new Color(192,192,192); + userTextColor = new Color(0,0,0); + employeeTagColor = new Color(0,255,255); + employeeTextColor = new Color(0,0,0); + hostTagColor = new Color(255,255,0); + hostTextColor = new Color(0,0,0); + guestTagColor = new Color(255,192,203); + guestTextColor = new Color(0,0,0); + tarTagColor = new Color(192, 192, 192); + tarTextColor = new Color(0,0,0); + } + boolean isEmployee = isEmployeeAccount(var3); + Color curTextColor, curTagColor; + if (isGuest) { + curTagColor = guestTagColor; + curTextColor = guestTextColor; + } else if (isHost) { + curTagColor = hostTagColor; + curTextColor = hostTextColor; + } else if (isEmployee) { + curTagColor = employeeTagColor; + curTextColor = employeeTextColor; + } else if (isTar) { + curTagColor = tarTagColor; + curTextColor = tarTextColor; + } else { + curTagColor = userTagColor; + curTextColor = userTextColor; + } + + if (randomizeTag && (!isEmployee && !isGuest && !isHost && !isTar)) { + Random rand = new Random(); + Color randomized = new Color( + rand.nextInt((255) + 1), + rand.nextInt((255) + 1), + rand.nextInt((255) + 1)).brighter(); + curTextColor = transparent ? randomized : userTextColor; + curTagColor = transparent ? userTagColor : randomized; + } + + if (transparent) { + if (isEmployee || isGuest || isHost || isTar) curTextColor = curTagColor; + curTagColor = new Color(254,254,254); + } + + boolean isSpecial = (isHost || isGuest || isEmployee); + + var4[0] = new StringTexture(var3, Console.message("TagFont"), IniFile.modColorfulTags().getIniInt("Fontsize", 48), curTextColor, curTagColor); + byte var5 = 18; + int var11 = var3.length() * 12; + Hologram var12 = new Hologram((float)var11, (float)var5, var4); + var12.setViewplaneAligned(true); + var12.raise(this.tagHeight); + var12.setScaleDist(300.0F); + this.tag = var12; + this.tag.setVisible(true); + this.tag.setBumpable(false); + this.tag.setLocalShadowed(true); + this.tag.setShadowedLocally(true); + this.add(this.tag); + if (colorfulMod && isSpecial && underline && transparent) { + StringBuffer underscore = new StringBuffer(); + for (int i = 0; i < var3.length(); i++) { + underscore.append("_"); + } + Texture[] var13 = new Texture[]{new StringTexture(underscore.toString(), Console.message("TagFont"), 48, curTextColor, curTagColor)}; + Hologram var14 = new Hologram((float) var11, (float) var5, var13); + var14.setViewplaneAligned(true); + var14.raise(this.tagHeight); + var14.setScaleDist(300.0F); + this.tagbg = var14; + this.tagbg.setVisible(true); + this.tagbg.setBumpable(false); + this.tagbg.setLocalShadowed(false); + this.tagbg.setShadowedLocally(true); + this.add(this.tagbg); + } + } + } + } + + private Color parseColor(String tag) { + String[] spl = tag.split(","); + return new Color(Integer.parseInt(spl[0]), Integer.parseInt(spl[1]), Integer.parseInt(spl[2])); + } + + protected void avatarHeightChangedTo(float var1) { + if (this.tag != null) { + this.tag.raise(var1 + 1.0F + 5.0F - this.tag.getZ()); + } + + if (this.tagbg != null) { + this.tagbg.raise(var1 + 1.0F + 5.0F - this.tagbg.getZ()); + } + + } + + public void detachFromServer(boolean var1) { + Debug.dAssert(Main.isMainThread()); + if (this._server != null) { + this._server.delObject(new ObjID(this.getLongID())); + this._server.decRefCnt(this); + this._server = null; + } + + if (var1) { + this.lastUsed = Std.getFastTime(); + synchronized(usableDrones) { + usableDrones.addElement(this); + } + } + + } + + public static Drone make(ObjID var0, WorldServer var1) { + synchronized(usableDrones) { + if (!usableDrones.isEmpty() && var0 != null && var1 != null) { + String var3 = "!" + var1.getLongID(var0); + + int var4; + Drone var5; + for(var4 = usableDrones.size() - 1; var4 > 0; --var4) { + var5 = (Drone)usableDrones.elementAt(var4); + if (var5.getName().equals(var3)) { + break; + } + } + + var5 = (Drone)usableDrones.elementAt(var4); + if (!var5.getName().equals(var3) && usableDrones.size() < 5) { + return new HoloDrone(var0, var1); + } else { + usableDrones.removeElementAt(var4); + var5.attachToServer(var1.getLongID(var0), var1); + return var5; + } } else { - new WobLoader(var1, this); - return this; + return new HoloDrone(var0, var1); } - } else { - WObject var3 = (WObject)this.getOwner(); - if (var3 == null) { - return this; + } + } + + public Drone() { + } + + public boolean handle(MouseDownEvent var1) { + if (this._server != null && (var1.key & 1) == 1) { + FriendsListPart.droneClick(this, var1); + } + + return true; + } + + public float animate(String var1) { + if (var1.equalsIgnoreCase("_hdb")) { + new Drone$BounceNametag(this); + } + + return 0.0F; + } + + public Vector getAnimationList() { + return new Vector(); + } + + public void muteStateChanged() { + this.setAvatarNow(this.getCurrentURL()); + } + + public void tarStateChanged() { + this.setAvatarNow(this.getCurrentURL()); + } + + public void avtStateChanged() { + this.setAvatarNow(URL.make("avatar:holden.mov")); + } + + public boolean shouldBeMuted() { + return MuteListPart.isMuted(this._server, this.getLongID()); + } + + public boolean shouldBeTarred() { + return TarListPart.isTarred(this._server, this.getLongID()); + } + + private World getOwnerWorld() { + WObject var1 = (WObject)this.getOwner(); + Room var2 = var1 == null ? null : var1.getRoom(); + World var3 = var2 == null ? null : var2.getWorld(); + return var3; + } + + public boolean shouldBeForcedHuman() { + return (this.getOwnerWorld() != null && this.getOwnerWorld().getForceHuman()); + } + + public URL getCurrentURL() { + return this instanceof PosableDrone ? ((PosableDrone)this).getPosableShapeURL() : this.getSourceURL(); + } + + public Drone setAvatarNow(URL var1) { + if (var1 == null) { + return this; + } else { + if (this.shouldBeForcedHuman()) { + var1 = PosableShape.getHuman(var1); + if (Console.getActive() != null) { + Console.getActive().pendingPilot = var1.toString(); + } + } + + var1 = PosableShape.getPermitted(var1, this.getWorld()); + boolean var2 = this.shouldBeMuted(); + boolean var12 = this.shouldBeTarred(); + if (var1.equals(this.getCurrentURL()) && (var2 == (this instanceof MutedDrone))) { + return this; + } else if (!var1.endsWith(".rwx") && !var1.endsWith(".rwg") && !var1.endsWith(".mov")) { + String var7 = var1.getInternal(); + if (var7.endsWith(".pilot")) { + var7 = var7.substring(0, var7.length() - 6) + ".drone"; + } else if (!var7.endsWith(".drone")) { + var7 = var7 + ".drone"; + } + + var1 = URL.make(var7); + if (var1.equals(this.getSourceURL())) { + return this; + } else { + new WobLoader(var1, this); + return this; + } } else { - WorldServer var4 = this._server; - String var5 = this.getLongID(); - this.detachFromServer(false); - this.detach(); - Object var6; - if (var2) { - var6 = new MutedDrone(new ObjID(var5), var4, var1); - } else if (var1.endsWith(".mov")) { - var6 = new HoloDrone(new ObjID(var5), var4); - ((Drone)var6).setAvatarNow(var1); - } else { - var6 = new PosableDrone(new ObjID(var5), var4, var1); - } - - if (var4 != null) { - ((Drone)var6).transferFrom(this); - ((Drone)var6).addTo(var3.getRoom()); - } else { - ((Transform)var6).makeIdentity().post(this); - ((WObject)var6).setName(this.getLongID()); - var3.add((WObject)var6); - } - - return (Drone)var6; - } - } - } - } - - public void wobLoaded(WobLoader var1, SuperRoot var2) { - if (var2 instanceof Drone) { - Debug.dAssert(var2 != null); - Drone var3 = (Drone)var2; - var3.setName(this.getLongID()); - if (this._server == null) { - WObject var7 = (WObject)this.getOwner(); - this.detach(); - var3.makeIdentity().post(this); - var7.add(var3); - } else { - WorldServer var4 = this._server; - String var5 = this.getLongID(); - this.detachFromServer(false); - Room var6 = this.getRoom(); - this.detach(); - var3.addTo(var6); - var3.attachToServer(var5, var4); - var3.transferFrom(this); - } - } - } - - public void addTo(Room var1) { - if (var1 != null) { - Console var2 = var1.getWorld().getConsole(); - if (this.console == null) { - this.console = var2; - if (var2 != null) { - Pilot.copySoul(var2.getDroneSoulTemplate(), this); - } - } - - var1.add(this); - } - } - - public void add(WObject var1) { - super.add(var1); - } - - protected void noteUnadding(SuperRoot var1) { - if (var1 instanceof WObject) { - WObject var2 = (WObject)var1; - if (var2.isDynamic()) { - var2.setVisible(true); - } - } - - super.noteUnadding(var1); - } - - public void setSleepMode(String var1) { - if (!var1.equals(this.sleepMode)) { - this.sleepMode = var1; - Main.register(new Drone.MakeSleepBox()); - } - } - - private void handleVAR_ASLEEP(String var1) { - if (var1 != null && var1.length() > 2 && var1.charAt(0) == 0) { - var1 = var1.substring(2); - } - - this.setSleepMode(var1); - } - - public Drone handleVAR_BITMAP(String var1) { - if (var1.equals("")) { - return this; - } else { - BlackBox.getInstance().submitEvent(new BBDroneBitmapCommand(this.getName(), var1)); - if (var1.charAt(0) == 0) { + WObject var3 = (WObject)this.getOwner(); + if (var3 == null) { + return this; + } else { + WorldServer var4 = this._server; + String var5 = this.getLongID(); + this.detachFromServer(false); + this.detach(); + Drone var6; + if (var2) { + var6 = new MutedDrone(new ObjID(var5), var4, var1); + } else if (var12) { + var6 = new TarredDrone(new ObjID(var5), var4, var1); + } else if (var1.endsWith(".mov")) { + var6 = new HoloDrone(new ObjID(var5), var4); + var6.setAvatarNow(var1); + } else { + if (IniFile.gamma().getIniInt("AllowAvatarRWX", 1) == 0 && var1.endsWith(".rwx")) { + var6 = new HoloDrone(new ObjID(var5), var4); + } else { + var6 = new PosableDrone(new ObjID(var5), var4, var1); + } + + } + + if (var4 != null) { + var6.transferFrom(this); + var6.addTo(var3.getRoom()); + } else { + var6.makeIdentity().post(this); + var6.setName(this.getLongID()); + var3.add(var6); + } + + return var6; + } + } + } + } + + public void wobLoaded(WobLoader var1, SuperRoot var2) { + if (var2 instanceof Drone) { + Debug.dAssert(var2 != null); + Drone var3 = (Drone)var2; + var3.setName(this.getLongID()); + if (this._server == null) { + WObject var7 = (WObject)this.getOwner(); + this.detach(); + var3.makeIdentity().post(this); + var7.add(var3); + } else { + WorldServer var4 = this._server; + String var5 = this.getLongID(); + this.detachFromServer(false); + Room var6 = this.getRoom(); + this.detach(); + var3.addTo(var6); + var3.attachToServer(var5, var4); + var3.transferFrom(this); + } + } + } + + public void addTo(Room var1) { + if (var1 != null) { + Console var2 = var1.getWorld().getConsole(); + if (this.console == null) { + this.console = var2; + if (var2 != null) { + Pilot.copySoul(var2.getDroneSoulTemplate(), this); + } + } + + var1.add(this); + } + } + + public void add(WObject var1) { + super.add(var1); + } + + protected void noteUnadding(SuperRoot var1) { + if (var1 instanceof WObject) { + WObject var2 = (WObject)var1; + if (var2.isDynamic()) { + var2.setVisible(true); + } + } + + super.noteUnadding(var1); + } + + public void setSleepMode(String var1) { + if (!var1.equals(this.sleepMode)) { + this.sleepMode = var1; + Main.register(new Drone$MakeSleepBox(this)); + } + } + + private void handleVAR_ASLEEP(String var1) { + if (var1 != null && var1.length() > 2 && var1.charAt(0) == 0) { var1 = var1.substring(2); - } + } + + this.setSleepMode(var1); + } - try { - return this.setAvatarNow(new URL(URL.getAvatar(), var1)); - } catch (MalformedURLException var3) { - Console.println(Console.message("Invalid-av") + var1); + public Drone handleVAR_BITMAP(String var1) { + if (var1.equals("")) { return this; - } - } - } - - public Point3Temp getVelocity() { - return Point3Temp.make((float)this._vel_x, (float)this._vel_y, (float)this._vel_z); - } - - public int getYawRate() { - return this._vel_yaw; - } - - public boolean handle(FrameEvent var1) { - if (this._server == null) { - return true; - } else { - int var2 = var1.time; - this.interpolate(var2, this._server.getUpdateTime(), this); - return true; - } - } - - public void interpolate(int var1, int var2, Transform var3) { - if (this.inited) { - if (var1 - this._last_PosTime > var2) { - this._last_PosTime = var1; - this._vel_x = this._last_x - this._x; - this._vel_y = this._last_y - this._y; - this._vel_z = this._last_z - this._z; - this._vel_yaw = ((this._last_yaw - this._yaw) % 360 + 360) % 360; - Debug.dAssert(this._vel_yaw >= 0); - if (this._vel_yaw > 180) { - this._vel_yaw -= 360; - } - } - - double var4 = (double)(var1 - this._last_FrameTime) / (double)var2; - if (var1 - this._last_FrameTime > var2) { - var4 = 0.0D; - } - - this._x += (int)(var4 * (double)this._vel_x); - this._y += (int)(var4 * (double)this._vel_y); - this._z += (int)(var4 * (double)this._vel_z); - this._yaw += (int)(var4 * (double)this._vel_yaw) % 360; - var3.makeIdentity().moveBy((float)this._x, (float)this._y, (float)this._z).yaw((float)this._yaw); - this._last_FrameTime = var1; - } - } - - public void reset(short var1, short var2, short var3, short var4) { - this._x = var1; - this._y = var2; - this._z = var3; - this._yaw = var4; - this._vel_x = this._vel_y = this._vel_z = 0; - this._vel_yaw = 0; - this._last_x = this._x; - this._last_y = this._y; - this._last_z = this._z; - this._last_yaw = this._yaw; - this._last_PosTime = this._last_FrameTime = Std.getRealTime(); - this.inited = true; - } - - protected void transferFrom(Drone var1) { - this.makeIdentity().post(var1); - this._x = var1._x; - this._y = var1._y; - this._z = var1._z; - this._yaw = var1._yaw; - this._vel_x = var1._vel_x; - this._vel_y = var1._vel_y; - this._vel_z = var1._vel_z; - this._vel_yaw = var1._vel_yaw; - this._last_x = var1._last_x; - this._last_y = var1._last_y; - this._last_z = var1._last_z; - this._last_yaw = var1._last_yaw; - this._last_PosTime = var1._last_PosTime; - this._last_FrameTime = var1._last_FrameTime; - this.inited = true; - } - - public void appear(Room var1, short var2, short var3, short var4, short var5) { - Debug.dAssert(var1 != null); - BlackBox.getInstance().submitEvent(new BBAppearDroneCommand(var1.toString(), this.getName(), var2, var3, var4, var5)); - if (this.getRoom() != var1) { - this.detach(); - var1.add(this); - } - - this.makeIdentity().moveBy((float)var2, (float)var3, (float)var4).yaw((float)var5); - this._x = var2; - this._y = var3; - this._z = var4; - this._yaw = var5; - this._vel_x = this._vel_y = this._vel_z = 0; - this._vel_yaw = 0; - this._last_x = var2; - this._last_y = var3; - this._last_z = var4; - this._last_yaw = var5; - this._last_PosTime = this._last_FrameTime = Std.getRealTime(); - URL var6 = this.getCurrentURL(); - if (var6 != null) { - this.setAvatarNow(var6); - } - - this.inited = true; - } - - public void disappear() { - BlackBox.getInstance().submitEvent(new BBDisappearDroneCommand(this.getName())); - this.detachFromServer(true); - this.detach(); - } - - public void longLoc(short var1, short var2, short var3, short var4) { - if (!(this.getOwner() instanceof Pilot)) { - BlackBox.getInstance().submitEvent(new BBMoveDroneCommand(this.getName(), var1, var2, var3, var4)); - } - - this._last_x = var1; - this._last_y = var2; - this._last_z = var3; - this._last_yaw = var4; - this._vel_x = this._last_x - this._x; - this._vel_y = this._last_y - this._y; - this._vel_z = this._last_z - this._z; - this._vel_yaw = ((this._last_yaw - this._yaw) % 360 + 360) % 360; - Debug.dAssert(this._vel_yaw >= 0); - if (this._vel_yaw > 180) { - this._vel_yaw -= 360; - } - - this._last_PosTime = Std.getRealTime(); - this.inited = true; - } - - public void property(OldPropertyList var1) { - int var3 = var1.size(); - - for(int var4 = 0; var4 < var3; ++var4) { - netProperty var2 = var1.elementAt(var4); - switch(var2.property()) { - case 5: - this.handleVAR_BITMAP(var2.value()); - break; - case 23: - this.handleVAR_ASLEEP(var2.value()); - break; - default: - byte[] var5 = new byte[var2.value().length()]; - var2.value().getBytes(0, var2.value().length(), var5, 0); - this.getSharer().setFromNetData(var2.property(), var5); - } - } - - } - - public void propertyUpdate(PropertyList var1) { - int var3 = var1.size(); - - for(int var4 = 0; var4 < var3; ++var4) { - net2Property var2 = var1.elementAt(var4); - switch(var2.property()) { - case 5: - this.handleVAR_BITMAP(var2.value()); - break; - case 23: - this.handleVAR_ASLEEP(var2.value()); - break; - default: - this.getSharer().setFromNetData(var2.property(), var2.data()); - } - } - - } - - public void roomChange(Room var1, short var2, short var3, short var4, short var5) { - this.detach(); - if (var1 != null) { - this.appear(var1, var2, var3, var4, var5); - } - - } - - public void shortLoc(byte var1, byte var2, byte var3) { - if (!(this.getOwner() instanceof Pilot)) { - BlackBox.getInstance().submitEvent(new BBDroneDeltaPosCommand(this.getName(), var1, var2, var3)); - } - - this._last_x += var1; - this._last_y += var2; - this._last_yaw += var3; - this._last_yaw %= 360; - this._vel_x = this._last_x - this._x; - this._vel_y = this._last_y - this._y; - this._vel_z = 0; - this._vel_yaw = ((this._last_yaw - this._yaw) % 360 + 360) % 360; - Debug.dAssert(this._vel_yaw >= 0); - if (this._vel_yaw > 180) { - this._vel_yaw -= 360; - } - - this._last_PosTime = Std.getRealTime(); - } - - public void teleport(WorldServer var1, byte var2, byte var3, Room var4, short var5, short var6, short var7, short var8) { - Debug.dAssert(var1.getObject(new ObjID(this.getLongID())) == this); - Room var9 = this.getRoom(); - switch(var2) { - default: - if (var9 != null) { - Debug.dAssert(var9 != null); - this.detach(); - } - case 0: - switch(var3) { - case 0: - this.detachFromServer(true); + } else { + BlackBox.getInstance().submitEvent(new BBDroneBitmapCommand(this.getName(), var1)); + if (var1.charAt(0) == 0) { + var1 = var1.substring(2); + } + + try { + return this.setAvatarNow(new URL(URL.getAvatar(), var1)); + } catch (MalformedURLException var3) { + Console.println(Console.message("Invalid-av") + var1); + return this; + } + } + } + + public Point3Temp getVelocity() { + return Point3Temp.make((float)this._vel_x, (float)this._vel_y, (float)this._vel_z); + } + + public int getYawRate() { + return this._vel_yaw; + } + + public boolean handle(FrameEvent var1) { + if (this._server == null) { + return true; + } else { + int var2 = var1.time; + this.interpolate(var2, this._server.getUpdateTime(), this); + return true; + } + } + + public void interpolate(int var1, int var2, Transform var3) { + if (this.inited) { + if (var1 - this._last_PosTime > var2) { + this._last_PosTime = var1; + this._vel_x = this._last_x - this._x; + this._vel_y = this._last_y - this._y; + this._vel_z = this._last_z - this._z; + this._vel_yaw = ((this._last_yaw - this._yaw) % 360 + 360) % 360; + Debug.dAssert(this._vel_yaw >= 0); + if (this._vel_yaw > 180) { + this._vel_yaw -= 360; + } + } + + double var4 = (double)(var1 - this._last_FrameTime) / (double)var2; + if (var1 - this._last_FrameTime > var2) { + var4 = 0.0D; + } + + this._x += (int)(var4 * (double)this._vel_x); + this._y += (int)(var4 * (double)this._vel_y); + this._z += (int)(var4 * (double)this._vel_z); + this._yaw += (int)(var4 * (double)this._vel_yaw) % 360; + var3.makeIdentity().moveBy((float)this._x, (float)this._y, (float)this._z).yaw((float)this._yaw); + this._last_FrameTime = var1; + } + } + + public void reset(short var1, short var2, short var3, short var4) { + this._x = var1; + this._y = var2; + this._z = var3; + this._yaw = var4; + this._vel_x = this._vel_y = this._vel_z = 0; + this._vel_yaw = 0; + this._last_x = this._x; + this._last_y = this._y; + this._last_z = this._z; + this._last_yaw = this._yaw; + this._last_PosTime = this._last_FrameTime = Std.getRealTime(); + this.inited = true; + } + + protected void transferFrom(Drone var1) { + this.makeIdentity().post(var1); + this._x = var1._x; + this._y = var1._y; + this._z = var1._z; + this._yaw = var1._yaw; + this._vel_x = var1._vel_x; + this._vel_y = var1._vel_y; + this._vel_z = var1._vel_z; + this._vel_yaw = var1._vel_yaw; + this._last_x = var1._last_x; + this._last_y = var1._last_y; + this._last_z = var1._last_z; + this._last_yaw = var1._last_yaw; + this._last_PosTime = var1._last_PosTime; + this._last_FrameTime = var1._last_FrameTime; + this.inited = true; + } + + public void appear(Room var1, short var2, short var3, short var4, short var5) { + Debug.dAssert(var1 != null); + BlackBox.getInstance().submitEvent(new BBAppearDroneCommand(var1.toString(), this.getName(), var2, var3, var4, var5)); + if (this.getRoom() != var1) { this.detach(); - break; - default: - if (var4 == null) { - this.detach(); - } else { - Debug.dAssert(var4 != null); - this.appear(var4, var5, var6, var7, var8); - } - } + var1.add(this); + } + + this.makeIdentity().moveBy((float)var2, (float)var3, (float)var4).yaw((float)var5); + this._x = var2; + this._y = var3; + this._z = var4; + this._yaw = var5; + this._vel_x = this._vel_y = this._vel_z = 0; + this._vel_yaw = 0; + this._last_x = var2; + this._last_y = var3; + this._last_z = var4; + this._last_yaw = var5; + this._last_PosTime = this._last_FrameTime = Std.getRealTime(); + URL var6 = this.getCurrentURL(); + if (var6 != null) { + this.setAvatarNow(var6); + } + + this.inited = true; + } + + public void disappear() { + BlackBox.getInstance().submitEvent(new BBDisappearDroneCommand(this.getName())); + this.detachFromServer(true); + this.detach(); + } + + public void longLoc(short var1, short var2, short var3, short var4) { + if (!(this.getOwner() instanceof Pilot)) { + BlackBox.getInstance().submitEvent(new BBMoveDroneCommand(this.getName(), var1, var2, var3, var4)); + } + + this._last_x = var1; + this._last_y = var2; + this._last_z = var3; + this._last_yaw = var4; + this._vel_x = this._last_x - this._x; + this._vel_y = this._last_y - this._y; + this._vel_z = this._last_z - this._z; + this._vel_yaw = ((this._last_yaw - this._yaw) % 360 + 360) % 360; + Debug.dAssert(this._vel_yaw >= 0); + if (this._vel_yaw > 180) { + this._vel_yaw -= 360; + } + + this._last_PosTime = Std.getRealTime(); + this.inited = true; + } + + public void property(OldPropertyList var1) { + int var3 = var1.size(); + + for(int var4 = 0; var4 < var3; ++var4) { + netProperty var2 = var1.elementAt(var4); + switch(var2.property()) { + case 5: + this.handleVAR_BITMAP(var2.value()); + break; + case 23: + this.handleVAR_ASLEEP(var2.value()); + break; + default: + byte[] var5 = new byte[var2.value().length()]; + var2.value().getBytes(0, var2.value().length(), var5, 0); + this.getSharer().setFromNetData(var2.property(), var5); + } + } + + } + + public void propertyUpdate(PropertyList var1) { + int var3 = var1.size(); + + for(int var4 = 0; var4 < var3; ++var4) { + net2Property var2 = var1.elementAt(var4); + switch(var2.property()) { + case 5: + this.handleVAR_BITMAP(var2.value()); + break; + case 23: + this.handleVAR_ASLEEP(var2.value()); + break; + default: + this.getSharer().setFromNetData(var2.property(), var2.data()); + } + } + + } + + public void roomChange(Room var1, short var2, short var3, short var4, short var5) { + this.detach(); + if (var1 != null) { + this.appear(var1, var2, var3, var4, var5); + } + + } + + public void shortLoc(byte var1, byte var2, byte var3) { + if (!(this.getOwner() instanceof Pilot)) { + BlackBox.getInstance().submitEvent(new BBDroneDeltaPosCommand(this.getName(), var1, var2, var3)); + } + + this._last_x += var1; + this._last_y += var2; + this._last_yaw += var3; + this._last_yaw %= 360; + this._vel_x = this._last_x - this._x; + this._vel_y = this._last_y - this._y; + this._vel_z = 0; + this._vel_yaw = ((this._last_yaw - this._yaw) % 360 + 360) % 360; + Debug.dAssert(this._vel_yaw >= 0); + if (this._vel_yaw > 180) { + this._vel_yaw -= 360; + } + + this._last_PosTime = Std.getRealTime(); + } + + public void teleport(WorldServer var1, byte var2, byte var3, Room var4, short var5, short var6, short var7, short var8) { + Debug.dAssert(var1.getObject(new ObjID(this.getLongID())) == this); + Room var9 = this.getRoom(); + switch(var2) { + default: + if (var9 != null) { + Debug.dAssert(var9 != null); + this.detach(); + } + case 0: + switch(var3) { + case 0: + this.detachFromServer(true); + this.detach(); + break; + default: + if (var4 == null) { + this.detach(); + } else { + Debug.dAssert(var4 != null); + this.appear(var4, var5, var6, var7, var8); + } + } + + } + } + + public WorldServer getServer() { + return this._server; + } + + public String getLongID() { + String var1 = this.getName(); + if (var1.startsWith("!")) { + var1 = var1.substring(1); + } + + return var1; + } + + public void register() { + Debug.dAssert(false); + } + + public void galaxyDisconnected() { + Debug.dAssert(false); + } + + public void reacquireServer(WorldServer var1) { + Debug.dAssert(false); + } + + public void changeChannel(Galaxy var1, String var2, String var3) { + Debug.dAssert(false); + } + + public Object properties(int var1, int var2, int var3, Object var4) throws NoSuchPropertyException { + Object var5 = null; + switch(var1 - var2) { + default: + var5 = super.properties(var1, var2 + 0, var3, var4); + return var5; + } + } + + public void saveState(Saver var1) throws IOException { + if (this.console != null) { + System.out.println("Warning: saving drone " + this.getName() + " WITH soul, which won't restore correctly!"); + } + + var1.saveVersion(0, classCookieInterpolatedDrone); + var1.saveVersion(0, classCookie); + super.saveState(var1); + } + + public void restoreStateDrone(Restorer var1) throws IOException, TooNewException { + var1.restoreVersion(classCookieInterpolatedDrone); + switch(var1.restoreVersion(classCookie)) { + case 0: + super.restoreState(var1); + Enumeration var2 = this.getContents(); + + while(var2.hasMoreElements()) { + WObject var3 = (WObject)var2.nextElement(); + if (var3 instanceof Hologram) { + Hologram var4 = (Hologram)var3; + if (var4.getMovieName() == null) { + this.tag = var4; + } + } + } + + return; + default: + throw new TooNewException(); + } + } + + public void restoreState(Restorer var1) throws IOException, TooNewException { + this.restoreStateDrone(var1); + } + + // $FF: synthetic method + static String access$000(Drone var0) { + return var0.sleepMode; + } + + // $FF: synthetic method + static Shape access$100(Drone var0) { + return var0.sleepBox; + } + + // $FF: synthetic method + static Shape access$102(Drone var0, Shape var1) { + return var0.sleepBox = var1; + } + + // $FF: synthetic method + static void access$200() { + flushUnusedDrones(); + } + + // $FF: synthetic method + static float access$300(Drone var0) { + return var0.tagHeight; + } + + static { + Main.register(new Drone$Flusher()); + showNametags = IniFile.gamma().getIniInt("SHOWNAMETAGS", 1) == 1; + employeeAccounts = ServerTableManager.instance().getTable("employeeAccounts"); + employeeHash = null; + usableDrones = new Vector(); + classCookie = new Object(); + classCookieInterpolatedDrone = new Object(); + } +} + +class Drone$MakeSleepBox implements MainCallback { + + private final Drone this$0; - } - } - public WorldServer getServer() { - return this._server; - } - - public String getLongID() { - String var1 = this.getName(); - if (var1.startsWith("!")) { - var1 = var1.substring(1); - } - - return var1; - } - - public void register() { - Debug.dAssert(false); - } - - public void galaxyDisconnected() { - Debug.dAssert(false); - } - - public void reacquireServer(WorldServer var1) { - Debug.dAssert(false); - } - - public void changeChannel(Galaxy var1, String var2, String var3) { - Debug.dAssert(false); - } - - public Object properties(int var1, int var2, int var3, Object var4) throws NoSuchPropertyException { - Object var5 = null; - switch(var1 - var2) { - default: - var5 = super.properties(var1, var2 + 0, var3, var4); - return var5; - } - } - - public void saveState(Saver var1) throws IOException { - if (this.console != null) { - System.out.println("Warning: saving drone " + this.getName() + " WITH soul, which won't restore correctly!"); - } - - var1.saveVersion(0, classCookieInterpolatedDrone); - var1.saveVersion(0, classCookie); - super.saveState(var1); - } - - public void restoreStateDrone(Restorer var1) throws IOException, TooNewException { - var1.restoreVersion(classCookieInterpolatedDrone); - switch(var1.restoreVersion(classCookie)) { - case 0: - super.restoreState(var1); - Enumeration var2 = this.getContents(); - - while(var2.hasMoreElements()) { - WObject var3 = (WObject)var2.nextElement(); - if (var3 instanceof Hologram) { - Hologram var4 = (Hologram)var3; - if (var4.getMovieName() == null) { - this.tag = var4; - } - } - } - - return; - default: - throw new TooNewException(); - } - } - - public void restoreState(Restorer var1) throws IOException, TooNewException { - this.restoreStateDrone(var1); - } - - static { - Main.register(new Drone.Flusher()); - showNametags = IniFile.gamma().getIniInt("SHOWNAMETAGS", 1) == 1; - employeeAccounts = ServerTableManager.instance().getTable("employeeAccounts"); - employeeHash = null; - usableDrones = new Vector(); - classCookie = new Object(); - classCookieInterpolatedDrone = new Object(); - } - - class BounceNametag implements MainCallback { - int start; - WObject origTag; - WObject origTagbg; + Drone$MakeSleepBox(Drone var1) { + this.this$0 = var1; + } + + public void mainCallback() { + if(Drone.access$000(this.this$0) != null && Drone.access$000(this.this$0).equals(Console.message("asleep")) && (!(this.this$0 instanceof MutedDrone))) { + if(Drone.access$100(this.this$0) == null) { + Drone.access$102(this.this$0, new Shape()); + Drone.access$100(this.this$0).setURL(URL.make("home:idle.rwg")); + Drone.access$100(this.this$0).setBumpable(false); + Drone.access$100(this.this$0).scale(100.0F); + Drone.access$100(this.this$0).spin(0.0F, 1.0F, 1.0F, 180.0F); + Drone.access$100(this.this$0).raise(189.0F); + this.this$0.add(Drone.access$100(this.this$0)); + } + } else if(Drone.access$100(this.this$0) != null) { + Drone.access$100(this.this$0).detach(); + Drone.access$102(this.this$0, (Shape)null); + } - BounceNametag() { - if (Drone.this.tag != null) { + Main.unregister(this); + } +} + +class Drone$Flusher implements MainCallback { + + int lastTime; + + + public void mainCallback() { + int var1 = Std.getFastTime(); + if(var1 > this.lastTime + 1000) { + Drone.access$200(); + this.lastTime = var1; + } + + } +} + +class Drone$BounceNametag implements MainCallback { + + int start; + WObject origTag; + WObject origTagbg; + private final Drone this$0; + + + Drone$BounceNametag(Drone var1) { + this.this$0 = var1; + if(var1.tag != null) { this.start = Std.getFastTime(); - this.origTag = Drone.this.tag; - this.origTagbg = Drone.this.tagbg; + this.origTag = var1.tag; + this.origTagbg = var1.tagbg; Main.register(this); - } + } - } + } - public void mainCallback() { - int var1 = Std.getFastTime(); - float var2 = Drone.this.tagHeight; - if (var1 <= this.start + 6000 && this.origTag == Drone.this.tag && this.origTagbg == Drone.this.tagbg) { - if (var1 < this.start + 1500) { - var2 = Drone.this.tagHeight + 200.0F * ((float)(var1 - this.start) / 1500.0F); + public void mainCallback() { + int var1 = Std.getFastTime(); + float var2 = Drone.access$300(this.this$0); + if(var1 <= this.start + 6000 && this.origTag == this.this$0.tag && this.origTagbg == this.this$0.tagbg) { + if(var1 < this.start + 1500) { + var2 = Drone.access$300(this.this$0) + 200.0F * ((float)(var1 - this.start) / 1500.0F); } else { - float var3 = (float)(var1 - this.start) / 1500.0F; - var2 = (float)(200.0D * Math.pow(1.4140000343322754D, (double)var3) * Math.cos((double)(var3 * 3.14159F))); + float var3 = (float)(var1 - this.start) / 1500.0F; + var2 = (float)(200.0D * Math.pow(1.4140000343322754D, (double)var3) * Math.cos((double)(var3 * 3.14159F))); } - } else { + } else { Main.unregister(this); - } + } - this.origTag.setZ(var2); - if (this.origTagbg != null) { + this.origTag.setZ(var2); + if(this.origTagbg != null) { this.origTagbg.setZ(var2); - } - - } - } - - static class Flusher implements MainCallback { - int lastTime; + } - public void mainCallback() { - int var1 = Std.getFastTime(); - if (var1 > this.lastTime + 1000) { - Drone.flushUnusedDrones(); - this.lastTime = var1; - } - - } - } - - class MakeSleepBox implements MainCallback { - public void mainCallback() { - if (Drone.this.sleepMode != null && Drone.this.sleepMode.equals(Console.message("asleep")) && !(Drone.this instanceof MutedDrone)) { - if (Drone.this.sleepBox == null) { - Drone.this.sleepBox = new Shape(); - Drone.this.sleepBox.setURL(URL.make("home:idle.rwg")); - Drone.this.sleepBox.setBumpable(false); - Drone.this.sleepBox.scale(100.0F); - Drone.this.sleepBox.spin(0.0F, 1.0F, 1.0F, 180.0F); - Drone.this.sleepBox.raise(189.0F); - Drone.this.add(Drone.this.sleepBox); - } - } else if (Drone.this.sleepBox != null) { - Drone.this.sleepBox.detach(); - Drone.this.sleepBox = null; - } - - Main.unregister(this); - } - } -} + } +} diff -ruN a/1890/NET/worlds/scape/HighJump.java b/1890/NET/worlds/scape/HighJump.java --- a/1890/NET/worlds/scape/HighJump.java 2023-08-21 23:27:15.000000000 -0500 +++ b/1890/NET/worlds/scape/HighJump.java 2023-08-21 23:27:17.000000000 -0500 @@ -28,18 +28,20 @@ private SmoothDriver findSD(Pilot var1) { Enumeration var2 = var1.getHandlers(); - while(var2.hasMoreElements()) { - Object var3 = var2.nextElement(); - if (var3 instanceof SmoothDriver) { - return (SmoothDriver)var3; + Object var3; + do { + if (!var2.hasMoreElements()) { + return null; } - } - return null; + var3 = var2.nextElement(); + } while(!(var3 instanceof SmoothDriver)); + + return (SmoothDriver)var3; } public boolean doAction() { - if (super.itemQuantity_ > 0) { + if (this.itemQuantity_ > 0) { Pilot var1 = Pilot.getActive(); if (var1 == null) { return false; @@ -51,7 +53,7 @@ if (this.sd != null) { Main.register(this); this.start = Std.getRealTime(); - --super.itemQuantity_; + --this.itemQuantity_; } return true; diff -ruN a/1890/NET/worlds/scape/MutedDrone.java b/1890/NET/worlds/scape/MutedDrone.java --- a/1890/NET/worlds/scape/MutedDrone.java 2023-08-21 23:27:15.000000000 -0500 +++ b/1890/NET/worlds/scape/MutedDrone.java 2023-08-21 23:27:17.000000000 -0500 @@ -1,43 +1,44 @@ package NET.worlds.scape; +import NET.worlds.console.HiddenDrone; import NET.worlds.network.ObjID; import NET.worlds.network.URL; import NET.worlds.network.WorldServer; import java.io.IOException; -public class MutedDrone extends Drone { - private static Object classCookie = new Object(); +public class MutedDrone extends Drone implements HiddenDrone { + private static Object classCookie = new Object(); - public MutedDrone(ObjID var1, WorldServer var2, URL var3) { - super(var1, var2); - this.setSourceURL(var3); - } - - public MutedDrone() { - } - - public Drone setAvatarNow(URL var1) { - if (this.shouldBeMuted()) { - this.setSourceURL(var1); - return this; - } else { - return super.setAvatarNow(var1); - } - } - - public void saveState(Saver var1) throws IOException { - var1.saveVersion(1, classCookie); - super.saveState(var1); - } - - public void restoreState(Restorer var1) throws IOException, TooNewException { - int var2 = var1.restoreVersion(classCookie); - switch(var2) { - case 1: - super.restoreState(var1); - return; - default: - throw new TooNewException(); - } - } + public MutedDrone(ObjID var1, WorldServer var2, URL var3) { + super(var1, var2); + this.setSourceURL(var3); + } + + public MutedDrone() { + } + + public Drone setAvatarNow(URL var1) { + if (this.shouldBeMuted()) { + this.setSourceURL(var1); + return this; + } else { + return super.setAvatarNow(var1); + } + } + + public void saveState(Saver var1) throws IOException { + var1.saveVersion(1, classCookie); + super.saveState(var1); + } + + public void restoreState(Restorer var1) throws IOException, TooNewException { + int var2 = var1.restoreVersion(classCookie); + switch(var2) { + case 1: + super.restoreState(var1); + return; + default: + throw new TooNewException(); + } + } } diff -ruN a/1890/NET/worlds/scape/ParallelAction.java b/1890/NET/worlds/scape/ParallelAction.java --- a/1890/NET/worlds/scape/ParallelAction.java 2023-08-21 23:27:15.000000000 -0500 +++ b/1890/NET/worlds/scape/ParallelAction.java 2023-08-21 23:27:17.000000000 -0500 @@ -6,130 +6,131 @@ import java.util.Vector; public class ParallelAction extends Action implements RunningActionCallback { - protected static final int NONE = 0; - protected static final int FIRST = 1; - protected static final int ALL = -1; - protected Vector actions = new Vector(); - protected int waitState = -1; - protected int waitingFor = 0; - protected Object currentRun = null; - private static Object classCookie = new Object(); - - public Persister trigger(Event var1, Persister var2) { - if (var2 == null) { - if (this.waitingFor == 0) { - this.currentRun = new Object(); - if (this.waitState == -1) { - this.waitingFor = this.actions.size(); - var2 = this; - } else if (this.waitState == 1) { - this.waitingFor = 1; - var2 = this; - } else { - this.waitingFor = 0; - var2 = null; - } + protected static final int NONE = 0; + protected static final int FIRST = 1; + protected static final int ALL = -1; + protected Vector actions = new Vector(); + protected int waitState = -1; + protected int waitingFor = 0; + protected Object currentRun = null; + private static Object classCookie = new Object(); + + public ParallelAction() { + } + + public Persister trigger(Event var1, Persister var2) { + if (var2 == null) { + if (this.waitingFor == 0) { + this.currentRun = new Object(); + if (this.waitState == -1) { + this.waitingFor = this.actions.size(); + var2 = this; + } else if (this.waitState == 1) { + this.waitingFor = 1; + var2 = this; + } else { + this.waitingFor = 0; + var2 = null; + } - RunningActionHandler.trigger((Vector)this.actions, this.getWorld(), var1, this, this.currentRun); - } - } else if (this.waitingFor == 0) { - var2 = null; - } - - return (Persister)var2; - } - - public void actionDone(Action var1, Event var2, Object var3) { - if (this.waitingFor > 0 && var3 == this.currentRun) { - --this.waitingFor; - } - - } - - public void setWaitForAll() { - this.waitState = -1; - } - - public void setWaitForFirst() { - this.waitState = 1; - } - - public void setWaitForNone() { - this.waitState = 0; - } - - public void addComponent(Action var1) { - Debug.dAssert(var1 != null); - this.actions.addElement(var1); - } - - public void insertComponent(Action var1, int var2) { - Debug.dAssert(var1 != null); - this.actions.insertElementAt(var1, var2); - } - - public boolean removeComponent(Action var1) { - Debug.dAssert(var1 != null); - return this.actions.removeElement(var1); - } - - public Enumeration getComponents() { - return this.actions.elements(); - } - - public Object properties(int var1, int var2, int var3, Object var4) throws NoSuchPropertyException { - Object var5 = null; - switch(var1 - var2) { - case 0: - if (var3 == 0) { - var5 = ObjectPropertyAdder.make(new VectorProperty(this, var1, "Components"), this.getRoot(), "NET.worlds.scape.Action"); - } else if (var3 == 1) { - var5 = this.actions.clone(); - } else if (var3 == 4) { - this.actions.removeElement(var4); - } else if (var3 == 3) { - this.actions.addElement((Action)var4); - } - break; - case 1: - if (var3 == 0) { - String[] var6 = new String[]{"None", "First", "All"}; - int[] var7 = new int[]{0, 1, -1}; - var5 = EnumPropertyEditor.make(new Property(this, var1, "Wait for"), var6, var7); - } else if (var3 == 1) { - var5 = new Integer(this.waitState); - } else if (var3 == 2) { - this.waitState = (Integer)var4; - } - break; - default: - var5 = super.properties(var1, var2 + 2, var3, var4); - } - - return var5; - } - - public void saveState(Saver var1) throws IOException { - var1.saveVersion(2, classCookie); - super.saveState(var1); - var1.saveVector(this.actions); - var1.saveInt(this.waitState); - } - - public void restoreState(Restorer var1) throws IOException, TooNewException { - switch(var1.restoreVersion(classCookie)) { - case 1: - super.restoreState(var1); - this.actions = var1.restoreVector(); - break; - case 2: - super.restoreState(var1); - this.actions = var1.restoreVector(); - this.waitState = var1.restoreInt(); - break; - default: - throw new TooNewException(); - } + RunningActionHandler.trigger(this.actions, this.getWorld(), var1, this, this.currentRun); + } + } else if (this.waitingFor == 0) { + var2 = null; + } + + return (Persister)var2; + } + + public void actionDone(Action var1, Event var2, Object var3) { + if (this.waitingFor > 0 && var3 == this.currentRun) { + --this.waitingFor; + } + + } + + public void setWaitForAll() { + this.waitState = -1; + } + + public void setWaitForFirst() { + this.waitState = 1; + } + + public void setWaitForNone() { + this.waitState = 0; + } + + public void addComponent(Action var1) { + Debug.dAssert(var1 != null); + this.actions.addElement(var1); + } + + public void insertComponent(Action var1, int var2) { + Debug.dAssert(var1 != null); + this.actions.insertElementAt(var1, var2); + } + + public boolean removeComponent(Action var1) { + Debug.dAssert(var1 != null); + return this.actions.removeElement(var1); + } + + public Enumeration getComponents() { + return this.actions.elements(); + } + + public Object properties(int var1, int var2, int var3, Object var4) throws NoSuchPropertyException { + Object var5 = null; + switch(var1 - var2) { + case 0: + if (var3 == 0) { + var5 = ObjectPropertyAdder.make(new VectorProperty(this, var1, "Components"), this.getRoot(), "NET.worlds.scape.Action"); + } else if (var3 == 1) { + var5 = this.actions.clone(); + } else if (var3 == 4) { + this.actions.removeElement(var4); + } else if (var3 == 3) { + this.actions.addElement((Action)var4); + } + break; + case 1: + if (var3 == 0) { + var5 = IntegerPropertyEditor.make(new Property(this, var1, "Wait for")); + } else if (var3 == 1) { + var5 = new Integer(this.waitState); + } else if (var3 == 2) { + this.waitState = ((Integer)var4).intValue(); + } + break; + default: + var5 = super.properties(var1, var2 + 2, var3, var4); + } + + return var5; + } + + public void saveState(Saver var1) throws IOException { + var1.saveVersion(2, classCookie); + super.saveState(var1); + var1.saveVector(this.actions); + var1.saveInt(this.waitState); + } + + public void restoreState(Restorer var1) throws IOException, TooNewException { + switch(var1.restoreVersion(classCookie)) { + case 1: + super.restoreState(var1); + this.actions = var1.restoreVector(); + break; + case 2: + super.restoreState(var1); + this.actions = var1.restoreVector(); + this.waitState = var1.restoreInt(); + break; + default: + throw new TooNewException(); + } - } + } } diff -ruN a/1890/NET/worlds/scape/PosableShape.java b/1890/NET/worlds/scape/PosableShape.java --- a/1890/NET/worlds/scape/PosableShape.java 2023-08-21 23:27:15.000000000 -0500 +++ b/1890/NET/worlds/scape/PosableShape.java 2023-08-21 23:27:17.000000000 -0500 @@ -131,7 +131,7 @@ } public Transform getObjectToWorldMatrix() { - return super.clumpID != 0 ? this.getJointedObjectToWorldMatrix(Transform.make()) : super.getObjectToWorldMatrix(); + return this.clumpID != 0 ? this.getJointedObjectToWorldMatrix(Transform.make()) : super.getObjectToWorldMatrix(); } public static int getFigureType(URL var0) { @@ -157,7 +157,7 @@ } public synchronized void setURL(URL var1) { - if (var1 != super.url && (var1 == null || !var1.equals(super.url))) { + if (var1 != this.url && (var1 == null || !var1.equals(this.url))) { if (var1 == null || !var1.toString().startsWith("avatar:lod")) { if (var1 != null) { this.download(var1); @@ -177,7 +177,7 @@ } this.setBaseLODURL(var1); - if (Shape.forceLODLevel != -1 && super.numDetailLevels > 0 && this.doLOD) { + if (forceLODLevel != -1 && this.numDetailLevels > 0 && this.doLOD) { this.setLOD(0.0F); return; } @@ -364,10 +364,10 @@ this.runPrepFigure = false; } - ((Transform)var10).scale(this.getScale(var22), this.getScale(var19), this.getScale(var20)); + ((Shape)var10).scale(this.getScale(var22), this.getScale(var19), this.getScale(var20)); } else if (var17 != 'Q') { if (var17 == 'C') { - Debug.assert(false); + throw new AssertionError(); } else if (var17 == 'D') { var13 += (int)(1000.0D * (Math.pow(1.0932D, (double)scanBase64(var1.charAt(this.scanPos++))) - 0.8999999761581421D)); } else if (var17 == 'A') { @@ -379,7 +379,7 @@ break; } - System.out.println("Illegal av " + super.url); + System.out.println("Illegal av " + this.url); } } } else { @@ -793,56 +793,61 @@ return var0; } else if (NetUpdate.isInternalVersion()) { return var0; - } else if (!gotServerAvatarList && !serverAvatarListError) { - return var0; - } else if (serverAvatarListError) { - return validateAvatar(var0.getAbsolute()) ? var0 : getDefAv(); } else { - Enumeration var2 = getComponentAvatars(var0); - - while(var2 != null && var2.hasMoreElements()) { - String var3 = (String)var2.nextElement(); - String var4 = getBodyType(URL.make(var3)); - if (var4 == null) { - return getDefAv(); - } - - Vector var5 = (Vector)worldHash.get(var4); - if (var5 == null) { - return getDefAv(); - } - - boolean var6 = false; - Enumeration var7 = var5.elements(); + boolean var2 = IniFile.override().getIniString("ProductName", "").equalsIgnoreCase("RedLightWorld"); + if (var2) { + return var0; + } else if (!gotServerAvatarList && !serverAvatarListError) { + return var0; + } else if (serverAvatarListError) { + return validateAvatar(var0.getAbsolute()) ? var0 : getDefAv(); + } else { + Enumeration var3 = getComponentAvatars(var0); - while(var7.hasMoreElements()) { - String var8 = (String)var7.nextElement(); - if (var8 == null) { + while(var3 != null && var3.hasMoreElements()) { + String var4 = (String)var3.nextElement(); + String var5 = getBodyType(URL.make(var4)); + if (var5 == null) { return getDefAv(); } - if (var8.equals("all")) { - var6 = true; - break; + Vector var6 = (Vector)worldHash.get(var5); + if (var6 == null) { + return getDefAv(); } - var8 = var8.replace('_', ' ').toLowerCase().trim(); - if (var1 != null) { - if (var8.equals(var1.toString().toLowerCase().trim())) { - var6 = true; + boolean var7 = false; + Enumeration var8 = var6.elements(); + + while(var8.hasMoreElements()) { + String var9 = (String)var8.nextElement(); + if (var9 == null) { + return getDefAv(); + } + + if (var9.equals("all")) { + var7 = true; break; } - } else { - var6 = true; + + var9 = var9.replace('_', ' ').toLowerCase().trim(); + if (var1 != null) { + if (var9.equals(var1.toString().toLowerCase().trim())) { + var7 = true; + break; + } + } else { + var7 = true; + } } - } - if (!var6) { - return getDefAv(); + if (!var7) { + return getDefAv(); + } } - } - return var0; + return var0; + } } } @@ -1221,7 +1226,8 @@ public boolean handle(FrameEvent var1) { float var2 = this.closestView; this.closestView = 10000.0F; - if (this.animator != null && var2 <= 900.0F && this.hasClump()) { + float distance = IniFile.gamma().getIniInt("AnimationQualityDistance", 900); + if (this.animator != null && var2 <= distance && this.hasClump()) { if (this.recomputeHeight) { if (this.runPrepFigure) { DroneAnimator.prepFigure(this, this.COG); @@ -1275,7 +1281,7 @@ } else if (var3 == 1) { var5 = new Boolean(this.COG); } else if (var3 == 2) { - this.COG = (Boolean)var4; + this.COG = ((Boolean)var4).booleanValue(); URL var6 = this.getURL(); this.setURL(defaultURL); this.setURL(var6); @@ -1338,12 +1344,12 @@ } } - for(int var1 = 1; var1 < humanList.length; var1 += 2) { - humanHash.put(humanList[var1 - 1], humanList[var1]); + for(var0 = 1; var0 < humanList.length; var0 += 2) { + humanHash.put(humanList[var0 - 1], humanList[var0]); } - for(int var2 = 0; var2 < faceList.length; var2 += 2) { - faceTextures.put(faceList[var2], faceList[var2 + 1]); + for(var0 = 0; var0 < faceList.length; var0 += 2) { + faceTextures.put(faceList[var0], faceList[var0 + 1]); } gotServerAvatarList = false; diff -ruN a/1890/NET/worlds/scape/SelectAvatarAction.java b/1890/NET/worlds/scape/SelectAvatarAction.java --- a/1890/NET/worlds/scape/SelectAvatarAction.java 2023-08-21 23:27:15.000000000 -0500 +++ b/1890/NET/worlds/scape/SelectAvatarAction.java 2023-08-21 23:27:17.000000000 -0500 @@ -1,3 +1,8 @@ +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by Fernflower decompiler) +// + package NET.worlds.scape; import NET.worlds.console.Console; @@ -8,138 +13,141 @@ import java.io.IOException; public class SelectAvatarAction extends DialogAction { - URL url = null; - String description; - static String[] avatarAliases = ServerTableManager.instance().getTable("avatarAliases"); - private static Object classCookie = new Object(); - - private URL getURLVal() { - URL var1 = this.url; - if (var1 == null) { - SuperRoot var2 = this.getOwner(); - if (var2 instanceof Drone) { - var1 = ((Drone)var2).getSourceURL(); - } else if (var2 instanceof PosableShape) { - var1 = ((Shape)var2).getURL(); - } else if (var2 instanceof Hologram) { - var1 = ((Hologram)var2).getMovieName(); - } - } - - return var1; - } - - public void doIt() { - Console var1 = Console.getActive(); - URL var2 = this.getURLVal(); - if (var1 != null && var2 != null) { - var1.setAvatar(var2); - } - - } - - public PolledDialog getDialog() { - URL var1 = this.getURLVal(); - if (!Console.getActive().getVIP() && var1.getInternal().toLowerCase().endsWith(".rwg")) { - return new OkCancelDialog(Console.getFrame(), this, Console.message("Cant-change-AV"), Console.message("OK"), (String)null, Console.message("Only-VIPs-change"), false); - } else { - String var2 = this.description; - if (var2 == null || var2.length() == 0) { - var2 = getPrettyAvatarName(var1.getBase()); - } - - return new ChangeAvatarDialog(Console.getFrame(), this, var2); - } - } - - public static String getPrettyAvatarName(String var0) { - int var1 = var0.indexOf(46); - if (var1 >= 0) { - var0 = var0.substring(0, var1).toLowerCase(); - } else { - var0 = var0.toLowerCase(); - } - - for(int var2 = 0; var2 < avatarAliases.length; var2 += 2) { - if (avatarAliases[var2].equals(var0)) { - return avatarAliases[var2 + 1]; - } - } - - String var3 = var0.substring(0, 1).toUpperCase(); - if (var0.length() > 1) { - var3 = var3 + var0.substring(1); - } - - return var3; - } - - public Persister trigger(Event var1, Persister var2) { - URL var3 = this.getURLVal(); - return var3 == null ? null : super.trigger(var1, var2); - } - - public Object properties(int var1, int var2, int var3, Object var4) throws NoSuchPropertyException { - Object var5 = null; - switch(var1 - var2) { - case 0: - if (var3 == 0) { - var5 = URLPropertyEditor.make((new Property(this, var1, "Avatar URL")).allowSetNull(), "pilot;drone;rwx;rwg;mov"); - } else if (var3 == 1) { - var5 = this.url; - } else if (var3 == 2) { - this.url = (URL)var4; - } - break; - default: - var5 = super.properties(var1, var2 + 1, var3, var4); - } - - return var5; - } - - public String toString() { - return super.toString() + "[url " + (this.url == null ? "null" : this.url.getRelativeTo((SuperRoot)this) + "]"); - } - - public void saveState(Saver var1) throws IOException { - var1.saveVersion(4, classCookie); - super.saveState(var1); - URL.save(var1, this.url); - var1.saveString(this.description); - } - - public void restoreState(Restorer var1) throws IOException, TooNewException { - int var2 = var1.restoreVersion(classCookie); - switch(var2) { - case 0: - var1.setOldFlag(); - this.dialogActionSkipRestore(var1); - this.url = URL.restore(var1, ".world"); - break; - case 1: - var1.setOldFlag(); - this.dialogActionSkipRestore(var1); - this.url = URL.restore(var1, ".world"); - super.showDialog = var1.restoreBoolean(); - break; - case 2: - this.dialogActionSkipRestore(var1); - this.url = URL.restore(var1, ".world"); - super.showDialog = var1.restoreBoolean(); - super.cancelOnly = var1.restoreBoolean(); - break; - case 3: - case 4: - super.restoreState(var1); - this.url = URL.restore(var1, ".world"); - if (var2 >= 4) { - this.description = var1.restoreString(); - } - break; - default: - throw new TooNewException(); - } + URL url = null; + String description; + static String[] avatarAliases = ServerTableManager.instance().getTable("avatarAliases"); + private static Object classCookie = new Object(); + + public SelectAvatarAction() { + } + + private URL getURLVal() { + URL var1 = this.url; + if (var1 == null) { + SuperRoot var2 = this.getOwner(); + if (var2 instanceof Drone) { + var1 = ((Drone)var2).getSourceURL(); + } else if (var2 instanceof PosableShape) { + var1 = ((Shape)var2).getURL(); + } else if (var2 instanceof Hologram) { + var1 = ((Hologram)var2).getMovieName(); + } + } + + return var1; + } + + public void doIt() { + Console var1 = Console.getActive(); + URL var2 = this.getURLVal(); + if (var1 != null && var2 != null) { + var1.setAvatar(var2); + } + + } + + public PolledDialog getDialog() { + URL var1 = this.getURLVal(); + if (!Console.getActive().getFullVIP() && var1.getInternal().toLowerCase().endsWith(".rwg")) { + return new OkCancelDialog(Console.getFrame(), this, Console.message("Cant-change-AV"), Console.message("OK"), (String)null, Console.message("Only-VIPs-change"), false); + } else { + String var2 = this.description; + if (var2 == null || var2.length() == 0) { + var2 = getPrettyAvatarName(var1.getBase()); + } + + return new ChangeAvatarDialog(Console.getFrame(), this, var2); + } + } + + public static String getPrettyAvatarName(String var0) { + int var1 = var0.indexOf(46); + if (var1 >= 1) { + var0 = var0.substring(0, var1).toLowerCase(); + } else { + var0 = var0.toLowerCase(); + } + + for(int var2 = 0; var2 < avatarAliases.length; var2 += 2) { + if (avatarAliases[var2].equals(var0)) { + return avatarAliases[var2 + 1]; + } + } + + String var3 = var0.substring(0, 1).toUpperCase(); + if (var0.length() > 1) { + var3 = var3 + var0.substring(1); + } + + return var3; + } + + public Persister trigger(Event var1, Persister var2) { + URL var3 = this.getURLVal(); + return var3 == null ? null : super.trigger(var1, var2); + } + + public Object properties(int var1, int var2, int var3, Object var4) throws NoSuchPropertyException { + Object var5 = null; + switch(var1 - var2) { + case 0: + if (var3 == 0) { + var5 = URLPropertyEditor.make((new Property(this, var1, "Avatar URL")).allowSetNull(), "pilot;drone;rwx;rwg;mov"); + } else if (var3 == 1) { + var5 = this.url; + } else if (var3 == 2) { + this.url = (URL)var4; + } + break; + default: + var5 = super.properties(var1, var2 + 1, var3, var4); + } + + return var5; + } + + public String toString() { + return super.toString() + "[url " + (this.url == null ? "null" : this.url.getRelativeTo(this) + "]"); + } + + public void saveState(Saver var1) throws IOException { + var1.saveVersion(4, classCookie); + super.saveState(var1); + URL.save(var1, this.url); + var1.saveString(this.description); + } + + public void restoreState(Restorer var1) throws IOException, TooNewException { + int var2 = var1.restoreVersion(classCookie); + switch(var2) { + case 0: + var1.setOldFlag(); + this.dialogActionSkipRestore(var1); + this.url = URL.restore(var1, ".world"); + break; + case 1: + var1.setOldFlag(); + this.dialogActionSkipRestore(var1); + this.url = URL.restore(var1, ".world"); + this.showDialog = var1.restoreBoolean(); + break; + case 2: + this.dialogActionSkipRestore(var1); + this.url = URL.restore(var1, ".world"); + this.showDialog = var1.restoreBoolean(); + this.cancelOnly = var1.restoreBoolean(); + break; + case 3: + case 4: + super.restoreState(var1); + this.url = URL.restore(var1, ".world"); + if (var2 >= 4) { + this.description = var1.restoreString(); + } + break; + default: + throw new TooNewException(); + } - } + } } diff -ruN a/1890/NET/worlds/scape/SuperRoot.java b/1890/NET/worlds/scape/SuperRoot.java --- a/1890/NET/worlds/scape/SuperRoot.java 2023-08-21 23:27:15.000000000 -0500 +++ b/1890/NET/worlds/scape/SuperRoot.java 2023-08-21 23:27:17.000000000 -0500 @@ -41,7 +41,7 @@ SuperRoot var4 = (SuperRoot)var3.nextElement(); if (var4.name != null && var4.name.startsWith(var2)) { try { - int var5 = Integer.valueOf(var4.name.substring(var2.length())); + int var5 = Integer.valueOf(var4.name.substring(var2.length())).intValue(); if (var5 > var1) { var1 = var5; } @@ -71,16 +71,18 @@ } public static SuperRoot nameSearch(Enumeration var0, String var1) { - SuperRoot var2; - do { - if (!var0.hasMoreElements()) { - return null; - } + while(true) { + if (var0.hasMoreElements()) { + SuperRoot var2 = (SuperRoot)var0.nextElement(); + if (!var1.equals(var2.name)) { + continue; + } - var2 = (SuperRoot)var0.nextElement(); - } while(!var1.equals(var2.name)); + return var2; + } - return var2; + return null; + } } public URL getHelpURL() { @@ -120,12 +122,7 @@ this.setName((String)null); } else if (var3 == 2) { String var6 = (String)var4; - if (!var6.equals(this.name) && this.owner != null && nameSearch(this.getRoot().getDeepOwned(), var6) != null) { - Object[] var7 = new Object[]{new String(var6), new String(this.getRoot().getName())}; - Console.println(MessageFormat.format(Console.message("Name-in-use"), var7)); - } else { - this.setName((String)var4); - } + this.setName((String)var4); } break; case 1: @@ -240,11 +237,11 @@ var3.done(); var4.setSourceURL(var1); return var4; - } catch (FileNotFoundException var8) { - } catch (ClassCastException var9) { - } catch (IOException var10) { - } catch (TooNewException var11) { - } catch (BadFormatException var12) { + } catch (FileNotFoundException var5) { + } catch (ClassCastException var6) { + } catch (IOException var7) { + } catch (TooNewException var8) { + } catch (BadFormatException var9) { } return null; @@ -348,7 +345,7 @@ Integer var2 = (Integer)finalizedClasses.get(var1); int var3 = 0; if (var2 != null) { - var3 = var2; + var3 = var2.intValue(); } ++var3; @@ -368,7 +365,7 @@ Integer var3 = (Integer)classCounter.get(var2); int var4 = 0; if (var3 != null) { - var4 = var3; + var4 = var3.intValue(); } var4 += var1; diff -ruN a/1890/NET/worlds/scape/TalkAction.java b/1890/NET/worlds/scape/TalkAction.java --- a/1890/NET/worlds/scape/TalkAction.java 2023-08-21 23:27:15.000000000 -0500 +++ b/1890/NET/worlds/scape/TalkAction.java 2023-08-21 23:27:17.000000000 -0500 @@ -1,61 +1,64 @@ package NET.worlds.scape; +import NET.worlds.console.Console; +import NET.worlds.core.IniFile; + import java.io.IOException; public class TalkAction extends Action { - String txt = null; - private static Object classCookie = new Object(); + String txt = null; + private static final Object classCookie = new Object(); - public TalkAction() { - } + public TalkAction() { + } - public TalkAction(String var1) { - this.txt = var1; - } - - public Persister trigger(Event var1, Persister var2) { - Pilot.getActive(); - Pilot.sendText(this.txt); - return null; - } - - public Object properties(int var1, int var2, int var3, Object var4) throws NoSuchPropertyException { - Object var5 = null; - switch(var1 - var2) { - case 0: - if (var3 == 0) { - var5 = StringPropertyEditor.make(new Property(this, var1, "Message")); - } else if (var3 == 1) { - var5 = this.txt; - } else if (var3 == 2) { - this.txt = (String)var4; - } - break; - default: - var5 = super.properties(var1, var2 + 1, var3, var4); - } - - return var5; - } - - public void saveState(Saver var1) throws IOException { - var1.saveVersion(0, classCookie); - super.saveState(var1); - var1.saveString(this.txt); - } - - public void restoreState(Restorer var1) throws IOException, TooNewException { - switch(var1.restoreVersion(classCookie)) { - case 0: - super.restoreState(var1); - this.txt = var1.restoreString(); - return; - default: - throw new TooNewException(); - } - } - - public String toString() { - return super.toString() + "[" + this.txt + "]"; - } + public TalkAction(String var1) { + this.txt = var1; + } + + public Persister trigger(Event var1, Persister var2) { + if (IniFile.gamma().getIniInt("DisableTalkAction", 1) == 1) { + if (IniFile.gamma().getIniInt("classicChatBox", 1) == 1) Pilot.getActive().console.printLine(Console.getActive().getLongID() + ": " + this.txt); + else Pilot.getActive().console.printLine(" " + Console.getActive().getLongID() + ": " + this.txt + " "); + } else { + Pilot.sendText(this.txt); + } + return null; + } + + public Object properties(int var1, int var2, int var3, Object var4) throws NoSuchPropertyException { + Object var5 = null; + if (var1 - var2 == 0) { + if (var3 == 0) { + var5 = StringPropertyEditor.make(new Property(this, var1, "Message")); + } else if (var3 == 1) { + var5 = this.txt; + } else if (var3 == 2) { + this.txt = (String) var4; + } + } else { + var5 = super.properties(var1, var2 + 1, var3, var4); + } + + return var5; + } + + public void saveState(Saver var1) throws IOException { + var1.saveVersion(0, classCookie); + super.saveState(var1); + var1.saveString(this.txt); + } + + public void restoreState(Restorer var1) throws IOException, TooNewException { + if (var1.restoreVersion(classCookie) == 0) { + super.restoreState(var1); + this.txt = var1.restoreString(); + return; + } + throw new TooNewException(); + } + + public String toString() { + return super.toString() + "[" + this.txt + "]"; + } } diff -ruN a/1890/NET/worlds/scape/TarredDrone.java b/1890/NET/worlds/scape/TarredDrone.java --- a/1890/NET/worlds/scape/TarredDrone.java 1969-12-31 18:00:00.000000000 -0600 +++ b/1890/NET/worlds/scape/TarredDrone.java 2023-08-21 23:27:17.000000000 -0500 @@ -0,0 +1,44 @@ +package NET.worlds.scape; + +import NET.worlds.console.HiddenDrone; +import NET.worlds.network.ObjID; +import NET.worlds.network.URL; +import NET.worlds.network.WorldServer; +import java.io.IOException; + +public class TarredDrone extends Drone implements HiddenDrone { + private static Object classCookie = new Object(); + + public TarredDrone(ObjID var1, WorldServer var2, URL var3) { + super(var1, var2); + this.setSourceURL(var3); + } + + public TarredDrone() { + } + + public Drone setAvatarNow(URL var1) { + if (this.shouldBeTarred()) { + this.setSourceURL(URL.make("avatar:holden.mov")); + return this; + } else { + return super.setAvatarNow(var1); + } + } + + public void saveState(Saver var1) throws IOException { + var1.saveVersion(1, classCookie); + super.saveState(var1); + } + + public void restoreState(Restorer var1) throws IOException, TooNewException { + int var2 = var1.restoreVersion(classCookie); + switch(var2) { + case 1: + super.restoreState(var1); + return; + default: + throw new TooNewException(); + } + } +} diff -ruN a/1890/NET/worlds/scape/TeleportAction.java b/1890/NET/worlds/scape/TeleportAction.java --- a/1890/NET/worlds/scape/TeleportAction.java 2023-08-21 23:27:15.000000000 -0500 +++ b/1890/NET/worlds/scape/TeleportAction.java 2023-08-21 23:27:17.000000000 -0500 @@ -1,547 +1,543 @@ package NET.worlds.scape; -import NET.worlds.console.Console; -import NET.worlds.console.DialogReceiver; -import NET.worlds.console.GammaFrame; -import NET.worlds.console.Main; -import NET.worlds.console.MainCallback; -import NET.worlds.console.WorldsMarkPart; +import NET.worlds.console.*; import NET.worlds.core.Debug; import NET.worlds.core.IniFile; import NET.worlds.network.NetUpdate; import NET.worlds.network.URL; + import java.io.IOException; import java.net.MalformedURLException; import java.text.MessageFormat; public class TeleportAction extends Action implements LoadedURLSelf, MainCallback, DialogReceiver { - private Point3 targetCoords = new Point3(); - private float targetRot = 0.0F; - private Point3 targetAxis = new Point3(0.0F, 0.0F, -1.0F); - private String targetRoomName = null; - private String targetDimension = null; - private URL targetWorldURL = null; - private boolean useDefCoordinates = false; - private boolean done = false; - private boolean showDialog = true; - private boolean forceWorldLoad = false; - private boolean forceNoWorldLoad = false; - private String targetURL; - private static TeleportAction activeTeleport = null; - private TeleportDialog dialog = null; - private TeleportStatus doneCallback; - String tempParseStr; - private static Object classCookie = new Object(); - - public TeleportAction() { - } - - public Persister trigger(Event var1, Persister var2) { - if (activeTeleport != this) { - this.targetURL = this.asURL(); - this.startTeleport(); - } - - return !this.done && activeTeleport != this ? this : null; - } - - public void stopLoading() { - this.done = true; - if (activeTeleport == this) { - this.stopTeleport((String)null); - } - - } - - public static boolean isTeleporting() { - return activeTeleport != null; - } - - public static void teleport(String var0, TeleportStatus var1) { - TeleportAction var2 = new TeleportAction(var0, var1); - if (Main.isMainThread()) { - var2.startTeleport(); - } else { - Main.register(var2); - } - - } - - public static void teleport(String var0, TeleportStatus var1, boolean var2) { - TeleportAction var3 = new TeleportAction(var0, var1); - var3.forceWorldLoad = var2; - var3.forceNoWorldLoad = !var2; - if (Main.isMainThread()) { - var3.startTeleport(); - } else { - Main.register(var3); - } - - } - - public static void teleport(String var0, TeleportStatus var1, boolean var2, boolean var3) { - TeleportAction var4 = new TeleportAction(var0, var1); - var4.showDialog = var3; - var4.forceWorldLoad = var2; - var4.forceNoWorldLoad = !var2; - if (Main.isMainThread()) { - var4.startTeleport(); - } else { - Main.register(var4); - } - - } - - public void mainCallback() { - Main.unregister(this); - this.startTeleport(); - } - - public static String toURLString(String var0) { - if (var0 == null || var0.equals("world:")) { - var0 = WorldsMarkPart.getFirstSystemMarkURL(); - } - - if (var0 == null) { - var0 = "home:NewWorld.world"; - } - - if (var0.startsWith("world:")) { - if (var0.equals("world:restart")) { - var0 = IniFile.gamma().getIniString("RestartAt", WorldsMarkPart.getFirstSystemMarkURL()); - } else if (var0.equals("world:store")) { - var0 = World.getHomeStore().getAbsolute(); - } else { - var0 = var0.substring(6); - } - - int var1 = var0.indexOf(".world?"); - if (var1 >= 0) { - var0 = var0.substring(0, var1) + ".world#" + var0.substring(var1 + 7); - } - } - - if (var0.indexOf(58) < 0) { - if (var0.indexOf(47) < 0 && var0.indexOf(92) < 0 && !var0.endsWith(".world")) { - var0 = "home:" + var0 + "/" + var0 + ".world"; - } else { - var0 = "file:" + var0; - } - } - - return var0; - } - - private TeleportAction(String var1, TeleportStatus var2) { - this.doneCallback = var2; - this.targetURL = toURLString(var1); - var1 = this.setFromURL(this.targetURL); - - try { - if (this.targetURL.startsWith("http://")) { - this.targetWorldURL = new URL(var1); - } else { - this.targetWorldURL = new URL(URL.getCurDir(), URL.maybeAddExt(var1, ".world")); - } - } catch (MalformedURLException var4) { - this.targetWorldURL = URL.make("error:\"" + var1 + '"'); - } - - } - - private float getNextFloat(float var1) { - String var2 = this.tempParseStr; - int var3 = this.tempParseStr.indexOf(44); - if (var3 == -1) { - var3 = this.tempParseStr.length(); - this.tempParseStr = ""; - } else { - this.tempParseStr = this.tempParseStr.substring(var3 + 1); - } - - try { - return Float.valueOf(var2.substring(0, var3)); - } catch (NumberFormatException var5) { - return var1; - } - } - - private String setFromURL(String var1) { - this.useDefCoordinates = true; - int var2 = var1.lastIndexOf(35); - int var4; - if (var2 >= 0) { - String var3 = var1.substring(var2 + 1); - var1 = var1.substring(0, var2); - var4 = var3.lastIndexOf(64); - if (var4 < 0) { - this.targetRoomName = var3; - } else { - this.useDefCoordinates = false; - this.targetRoomName = var3.substring(0, var4); - this.tempParseStr = var3.substring(var4 + 1); - this.targetCoords.x = this.getNextFloat(this.targetCoords.x); - this.targetCoords.y = this.getNextFloat(this.targetCoords.y); - this.targetCoords.z = this.getNextFloat(this.targetCoords.z); - this.targetRot = this.getNextFloat(this.targetRot); - this.targetAxis.x = this.getNextFloat(this.targetAxis.x); - this.targetAxis.y = this.getNextFloat(this.targetAxis.y); - this.targetAxis.z = this.getNextFloat(this.targetAxis.z); - this.tempParseStr = null; - } - } - - if (this.targetRoomName != null) { - int var5 = this.targetRoomName.lastIndexOf(62); - var4 = this.targetRoomName.lastIndexOf(60); - if (var5 + 1 == this.targetRoomName.length() && var4 >= 0) { - this.targetDimension = this.targetRoomName.substring(var4 + 1, var5); - this.targetRoomName = this.targetRoomName.substring(0, var4); - } - } - - return var1; - } - - private void makeTeleportDialog(URL var1) { - if (this.showDialog) { - GammaFrame var2 = Console.getFrame(); - if (var2 != null && var2.isShowing()) { - this.dialog = new TeleportDialog(var2, this); - } - } - - } - - private void startTeleport() { - if (activeTeleport != null) { - if (activeTeleport.doneCallback != null) { - activeTeleport.doneCallback.teleportStatus("overridden by new teleport", activeTeleport.targetURL); - } - - activeTeleport.stopTeleport((String)null); - } - - activeTeleport = this; - Console.setFreezeFrameEvents(true); - this.done = false; - Console.teleportNotification("", this.targetURL); - if (this.targetWorldURL != null) { - this.makeTeleportDialog(this.targetWorldURL); - World.load(this.targetWorldURL, this, this.forceWorldLoad); - } else { - Pilot var1 = Pilot.getActive(); - World var2; - if (var1 != null && (var2 = var1.getWorld()) != null) { - this.makeTeleportDialog(var2.getSourceURL()); - this.loadedURLSelf(var2, this.targetWorldURL, (String)null); - } else { - this.stopTeleport("Pilot not in a room for intraworld teleport"); - } - } - - } - - private Room stopTeleport(String var1) { - Debug.assert(this == activeTeleport); - this.done = true; - activeTeleport = null; - Console.setFreezeFrameEvents(false); - if (this.doneCallback != null) { - this.doneCallback.teleportStatus(var1, this.targetURL); - } - - if (var1 != null && !this.forceNoWorldLoad) { - Console.teleportNotification(var1, this.targetURL); - Console.println(var1); - } - - if (this.dialog != null) { - this.dialog.closeIt(true); - this.dialog = null; - } - - return null; - } - - public synchronized void dialogDone(Object var1, boolean var2) { - if (activeTeleport != null) { - activeTeleport.stopTeleport((String)null); - } - - } - - public static String getReadableNameOfWorld(URL var0) { - String var1 = var0.getAbsolute(); - String var2 = var1; - String var3 = null; - if (var1.startsWith("home:") && var1.length() > 6) { - var2 = var1.substring(var1.charAt(5) == '/' ? 6 : 5); - int var4 = var2.indexOf(47); - if (var4 > 0) { - var3 = var2.substring(0, var4); - if (var2.regionMatches(true, var4 + 1, var2, 0, var4)) { - var2 = var3; - String var5 = WorldsMarkPart.getExternalName(var3); - if (var5 != null) { - var2 = var5; - } - } - } - - int var6 = var2.indexOf(".world"); - if (var6 > 0) { - var2 = var2.substring(0, var6); - } - - var2 = "the " + var2 + " world"; - } - - return var2; - } - - public static String getPackageNameOfWorld(URL var0) { - String var1 = var0.getAbsolute(); - String var3 = null; - if (var1.startsWith("home:") && var1.length() > 6) { - String var2 = var1.substring(var1.charAt(5) == '/' ? 6 : 5); - int var4 = var2.indexOf(47); - if (var4 > 0) { - var3 = var2.substring(0, var4); - } - } - - return var3; - } - - public void loadedURLSelf(URLSelf var1, URL var2, String var3) { - if (activeTeleport != this) { - if (var1 != null) { - var1.decRef(); - } - - } else { - String var4; - if (var3 == null && var1 instanceof World) { - var4 = this.targetRoomName; - if (var4 == null) { - var4 = ((World)var1).getDefaultRoomName(); - } - - Room var7 = ((World)var1).getRoom(var4); - if (var7 == null) { - this.stopTeleport("Error finding room " + this.targetRoomName); - } else if (var7.getVIPOnly() && !((World)var1).getConsole().getVIP()) { - this.stopTeleport("Only VIPs may go there."); - if (this.forceNoWorldLoad) { - Console.println(Console.message("Only-VIPs-there")); - } + private Point3 targetCoords = new Point3(); + private float targetRot = 0.0F; + private Point3 targetAxis = new Point3(0.0F, 0.0F, -1.0F); + private String targetRoomName = null; + private String targetDimension = null; + private URL targetWorldURL = null; + private boolean useDefCoordinates = false; + private boolean done = false; + private boolean showDialog = true; + private boolean forceWorldLoad = false; + private boolean forceNoWorldLoad = false; + private String targetURL; + private static TeleportAction activeTeleport = null; + private TeleportDialog dialog = null; + private TeleportStatus doneCallback; + String tempParseStr; + private static final Object classCookie = new Object(); + + public TeleportAction() { + } + + public Persister trigger(Event var1, Persister var2) { + if (activeTeleport != this) { + this.targetURL = this.asURL(); + this.startTeleport(); + } + + return !this.done && activeTeleport != this ? this : null; + } + + public void stopLoading() { + this.done = true; + if (activeTeleport == this) { + this.stopTeleport((String)null); + } + + } + + public static boolean isTeleporting() { + return activeTeleport != null; + } + + public static void teleport(String var0, TeleportStatus var1) { + TeleportAction var2 = new TeleportAction(var0, var1); + if (Main.isMainThread()) { + var2.startTeleport(); + } else { + Main.register(var2); + } + + } + + public static void teleport(String var0, TeleportStatus var1, boolean var2) { + TeleportAction var3 = new TeleportAction(var0, var1); + var3.forceWorldLoad = var2; + var3.forceNoWorldLoad = !var2; + if (Main.isMainThread()) { + var3.startTeleport(); + } else { + Main.register(var3); + } + + } + + public static void teleport(String var0, TeleportStatus var1, boolean var2, boolean var3) { + TeleportAction var4 = new TeleportAction(var0, var1); + var4.showDialog = var3; + var4.forceWorldLoad = var2; + var4.forceNoWorldLoad = !var2; + if (Main.isMainThread()) { + var4.startTeleport(); + } else { + Main.register(var4); + } + + } + + public void mainCallback() { + Main.unregister(this); + this.startTeleport(); + } + + public static String toURLString(String var0) { + if (var0 == null || var0.equals("world:")) { + var0 = WorldsMarkPart.getFirstSystemMarkURL(); + } + + if (var0 == null) { + var0 = "home:NewWorld.world"; + } + + if (var0.startsWith("world:")) { + if (var0.equals("world:restart")) { + var0 = IniFile.gamma().getIniString("RestartAt", WorldsMarkPart.getFirstSystemMarkURL()); + } else if (var0.equals("world:store")) { + var0 = World.getHomeStore().getAbsolute(); + } else { + var0 = var0.substring(6); + } + + int var1 = var0.indexOf(".world?"); + if (var1 >= 0) { + var0 = var0.substring(0, var1) + ".world#" + var0.substring(var1 + 7); + } + } + if (var0.indexOf(58) < 0) { + if (var0.indexOf(47) < 0 && var0.indexOf(92) < 0 && !var0.endsWith(".world")) { + var0 = "home:" + var0 + "/" + var0 + ".world"; } else { - Console.teleportNotification((String)null, this.targetURL); - Pilot var8 = Pilot.changeActiveRoom(var7); - if (this.targetDimension != null) { - var8.changeChannel(this.targetDimension); - } - - var8.makeIdentity(); - if (this.useDefCoordinates) { - var8.moveTo(var7.getDefaultPosition()).spin(var7.getDefaultOrientationAxis(), var7.getDefaultOrientation()); - } else { - var8.moveTo(this.targetCoords).spin(this.targetAxis, this.targetRot); - } - - this.stopTeleport((String)null); - } - } else { - if (var3 == null) { - var3 = "file " + var2 + " doesn't contain a World"; - var1.decRef(); - } - - var4 = getReadableNameOfWorld(var2); - String var5 = getPackageNameOfWorld(var2); - Object[] var6 = new Object[]{new String(var4)}; - this.stopTeleport(MessageFormat.format(Console.message("cant-teleport"), var6)); - if (var5 != null && !this.forceNoWorldLoad) { - NetUpdate.loadWorld(var5, this.forceWorldLoad); - } - - } - } - } - - public Object properties(int var1, int var2, int var3, Object var4) throws NoSuchPropertyException { - Object var5 = null; - switch(var1 - var2) { - case 0: - if (var3 == 0) { - var5 = Point3PropertyEditor.make(new Property(this, var1, "X, Y, Z")); - } else if (var3 == 1) { - var5 = new Point3(this.targetCoords); - } else if (var3 == 2) { - this.targetCoords.copy((Point3)var4); - } - break; - case 1: - if (var3 == 0) { - var5 = FloatPropertyEditor.make(new Property(this, var1, "Dir")); - } else if (var3 == 1) { - var5 = new Float(this.targetRot); - } else if (var3 == 2) { - this.targetRot = (Float)var4; - } - break; - case 2: - if (var3 == 0) { - var5 = StringPropertyEditor.make((new Property(this, var1, "Room Name")).allowSetNull()); - } else if (var3 == 1) { - if (this.targetRoomName == null) { - var5 = ""; + var0 = "file:" + var0; + } + } + + return var0; + } + + private TeleportAction(String var1, TeleportStatus var2) { + this.doneCallback = var2; + this.targetURL = toURLString(var1); + var1 = this.setFromURL(this.targetURL); + + try { + if (this.targetURL.startsWith("http://") || this.targetURL.startsWith("https://")) { + this.targetWorldURL = new URL(var1); + } else { + this.targetWorldURL = new URL(URL.getCurDir(), URL.maybeAddExt(var1, ".world")); + } + } catch (MalformedURLException var4) { + this.targetWorldURL = URL.make("error:\"" + var1 + '"'); + } + + } + + private float getNextFloat(float var1) { + String var2 = this.tempParseStr; + int var3 = this.tempParseStr.indexOf(44); + if (var3 == -1) { + var3 = this.tempParseStr.length(); + this.tempParseStr = ""; + } else { + this.tempParseStr = this.tempParseStr.substring(var3 + 1); + } + + try { + return Float.valueOf(var2.substring(0, var3)).floatValue(); + } catch (NumberFormatException var5) { + return var1; + } + } + + private String setFromURL(String var1) { + this.useDefCoordinates = true; + int var2 = var1.lastIndexOf(35); + int var4; + if (var2 >= 0) { + String var3 = var1.substring(var2 + 1); + var1 = var1.substring(0, var2); + var4 = var3.lastIndexOf(64); + if (var4 < 0) { + this.targetRoomName = var3; } else { - var5 = new String(this.targetRoomName); + this.useDefCoordinates = false; + this.targetRoomName = var3.substring(0, var4); + this.tempParseStr = var3.substring(var4 + 1); + this.targetCoords.x = this.getNextFloat(this.targetCoords.x); + this.targetCoords.y = this.getNextFloat(this.targetCoords.y); + this.targetCoords.z = this.getNextFloat(this.targetCoords.z); + this.targetRot = this.getNextFloat(this.targetRot); + this.targetAxis.x = this.getNextFloat(this.targetAxis.x); + this.targetAxis.y = this.getNextFloat(this.targetAxis.y); + this.targetAxis.z = this.getNextFloat(this.targetAxis.z); + this.tempParseStr = null; } - } else if (var3 == 2) { - this.targetRoomName = (String)var4; - this.stopLoading(); - } - break; - case 3: - if (var3 == 0) { - var5 = URLPropertyEditor.make((new Property(this, var1, "World URL")).allowSetNull(), "world"); - } else if (var3 == 1) { - var5 = this.targetWorldURL; - } else if (var3 == 2) { - this.targetWorldURL = (URL)var4; - this.stopLoading(); - } - break; - case 4: - if (var3 == 0) { - var5 = BooleanPropertyEditor.make(new Property(this, var1, "Use default coordinates"), "No", "Yes"); - } else if (var3 == 1) { - var5 = new Boolean(this.useDefCoordinates); - } else if (var3 == 2) { - this.useDefCoordinates = (Boolean)var4; - } - break; - case 5: - if (var3 == 0) { - var5 = StringPropertyEditor.make((new Property(this, var1, "Dimension Name")).allowSetNull()); - } else if (var3 == 1) { - if (this.targetDimension == null) { - var5 = ""; + } + + if (this.targetRoomName != null) { + int var5 = this.targetRoomName.lastIndexOf(62); + var4 = this.targetRoomName.lastIndexOf(60); + if (var5 + 1 == this.targetRoomName.length() && var4 >= 0) { + this.targetDimension = this.targetRoomName.substring(var4 + 1, var5); + this.targetRoomName = this.targetRoomName.substring(0, var4); + } + } + + return var1; + } + + private void makeTeleportDialog(URL var1) { + if (this.showDialog) { + GammaFrame var2 = Console.getFrame(); + if (var2 != null && var2.isShowing()) { + this.dialog = new TeleportDialog(var2, this); + } + } + + } + + private void startTeleport() { + if (activeTeleport != null) { + if (activeTeleport.doneCallback != null) { + activeTeleport.doneCallback.teleportStatus("overridden by new teleport", activeTeleport.targetURL); + } + + activeTeleport.stopTeleport((String)null); + } + + activeTeleport = this; + Console.setFreezeFrameEvents(true); + this.done = false; + Console.teleportNotification("", this.targetURL); + if (this.targetWorldURL != null) { + this.makeTeleportDialog(this.targetWorldURL); + World.load(this.targetWorldURL, this, this.forceWorldLoad); + } else { + Pilot var1 = Pilot.getActive(); + World var2; + if (var1 != null && (var2 = var1.getWorld()) != null) { + this.makeTeleportDialog(var2.getSourceURL()); + this.loadedURLSelf(var2, this.targetWorldURL, (String)null); } else { - var5 = new String(this.targetDimension); + this.stopTeleport("Pilot not in a room for intraworld teleport"); + } + } + + } + + private Room stopTeleport(String var1) { + Debug.assert(this == activeTeleport); + this.done = true; + activeTeleport = null; + Console.setFreezeFrameEvents(false); + if (this.doneCallback != null) { + this.doneCallback.teleportStatus(var1, this.targetURL); + } + + if (var1 != null && !this.forceNoWorldLoad) { + Console.teleportNotification(var1, this.targetURL); + Console.println(var1); + } + + if (this.dialog != null) { + this.dialog.closeIt(true); + this.dialog = null; + } + + return null; + } + + public synchronized void dialogDone(Object var1, boolean var2) { + if (activeTeleport != null) { + activeTeleport.stopTeleport((String)null); + } + + } + + public static String getReadableNameOfWorld(URL var0) { + String var1 = var0.getAbsolute(); + String var2 = var1; + String var3 = null; + if (var1.startsWith("home:") && var1.length() > 6) { + var2 = var1.substring(var1.charAt(5) == '/' ? 6 : 5); + int var4 = var2.indexOf(47); + if (var4 > 0) { + var3 = var2.substring(0, var4); + if (var2.regionMatches(true, var4 + 1, var2, 0, var4)) { + var2 = var3; + String var5 = WorldsMarkPart.getExternalName(var3); + if (var5 != null) { + var2 = var5; + } + } + } + + int var6 = var2.indexOf(".world"); + if (var6 > 0) { + var2 = var2.substring(0, var6); + } + + var2 = "the " + var2 + " world"; + } + + return var2; + } + + public static String getPackageNameOfWorld(URL var0) { + String var1 = var0.getAbsolute(); + String var3 = null; + if (var1.startsWith("home:") && var1.length() > 6) { + String var2 = var1.substring(var1.charAt(5) == '/' ? 6 : 5); + int var4 = var2.indexOf(47); + if (var4 > 0) { + var3 = var2.substring(0, var4); + } + } + + return var3; + } + + public void loadedURLSelf(URLSelf var1, URL var2, String var3) { + if (activeTeleport != this) { + if (var1 != null) { + var1.decRef(); + } + + } else { + String var4; + if (var3 == null && var1 instanceof World) { + var4 = this.targetRoomName; + if (var4 == null) { + var4 = ((World)var1).getDefaultRoomName(); + } + + Room var7 = ((World)var1).getRoom(var4); + if (var7 == null) { + this.stopTeleport("Error finding room " + this.targetRoomName); + } else if (var7.getVIPOnly() && !((World)var1).getConsole().getVIP()) { + this.stopTeleport("Only VIPs may go there."); + if (this.forceNoWorldLoad) { + Console.println(Console.message("Only-VIPs-there")); + } + + } else { + Console.teleportNotification((String)null, this.targetURL); + Pilot var8 = Pilot.changeActiveRoom(var7); + if (this.targetDimension != null) { + var8.changeChannel(this.targetDimension); + } + + var8.makeIdentity(); + if (this.useDefCoordinates) { + var8.moveTo(var7.getDefaultPosition()).spin(var7.getDefaultOrientationAxis(), var7.getDefaultOrientation()); + } else { + var8.moveTo(this.targetCoords).spin(this.targetAxis, this.targetRot); + } + + this.stopTeleport((String)null); + } + } else { + if (var3 == null) { + var3 = "file " + var2 + " doesn't contain a World"; + var1.decRef(); + } + + var4 = getReadableNameOfWorld(var2); + String var5 = getPackageNameOfWorld(var2); + Object[] var6 = new Object[]{new String(var4)}; + this.stopTeleport(MessageFormat.format(Console.message("cant-teleport"), var6)); + if (var5 != null && !this.forceNoWorldLoad) { + NetUpdate.loadWorld(var5, this.forceWorldLoad); + } + + } + } + } + + public Object properties(int var1, int var2, int var3, Object var4) throws NoSuchPropertyException { + Object var5 = null; + switch(var1 - var2) { + case 0: + if (var3 == 0) { + var5 = Point3PropertyEditor.make(new Property(this, var1, "X, Y, Z")); + } else if (var3 == 1) { + var5 = new Point3(this.targetCoords); + } else if (var3 == 2) { + this.targetCoords.copy((Point3)var4); + } + break; + case 1: + if (var3 == 0) { + var5 = FloatPropertyEditor.make(new Property(this, var1, "Dir")); + } else if (var3 == 1) { + var5 = new Float(this.targetRot); + } else if (var3 == 2) { + this.targetRot = ((Float)var4).floatValue(); + } + break; + case 2: + if (var3 == 0) { + var5 = StringPropertyEditor.make((new Property(this, var1, "Room Name")).allowSetNull()); + } else if (var3 == 1) { + if (this.targetRoomName == null) { + var5 = ""; + } else { + var5 = new String(this.targetRoomName); + } + } else if (var3 == 2) { + this.targetRoomName = (String)var4; + this.stopLoading(); + } + break; + case 3: + if (var3 == 0) { + var5 = URLPropertyEditor.make((new Property(this, var1, "World URL")).allowSetNull(), "world"); + } else if (var3 == 1) { + var5 = this.targetWorldURL; + } else if (var3 == 2) { + this.targetWorldURL = (URL)var4; + this.stopLoading(); + } + break; + case 4: + if (var3 == 0) { + var5 = BooleanPropertyEditor.make(new Property(this, var1, "Use default coordinates"), "No", "Yes"); + } else if (var3 == 1) { + var5 = new Boolean(this.useDefCoordinates); + } else if (var3 == 2) { + this.useDefCoordinates = ((Boolean)var4).booleanValue(); + } + break; + case 5: + if (var3 == 0) { + var5 = StringPropertyEditor.make((new Property(this, var1, "Dimension Name")).allowSetNull()); + } else if (var3 == 1) { + if (this.targetDimension == null) { + var5 = ""; + } else { + var5 = new String(this.targetDimension); + } + } else if (var3 == 2) { + this.targetDimension = (String)var4; + if (this.targetDimension.equals("")) { + this.targetDimension = null; + } + + this.stopLoading(); + } + break; + case 6: + if (var3 == 0) { + var5 = BooleanPropertyEditor.make(new Property(this, var1, "Show dialog"), "No", "Yes"); + } else if (var3 == 1) { + var5 = new Boolean(this.showDialog); + } else if (var3 == 2) { + this.showDialog = ((Boolean)var4).booleanValue(); + } + break; + default: + var5 = super.properties(var1, var2 + 7, var3, var4); + } + + return var5; + } + + public void saveState(Saver var1) throws IOException { + var1.saveVersion(3, classCookie); + super.saveState(var1); + var1.save(this.targetCoords); + var1.saveFloat(this.targetRot); + var1.save(this.targetAxis); + var1.saveString(this.targetRoomName); + URL.save(var1, this.targetWorldURL); + var1.saveBoolean(this.useDefCoordinates); + var1.saveString(this.targetDimension); + } + + public void restoreState(Restorer var1) throws IOException, TooNewException { + int var2 = var1.restoreVersion(classCookie); + switch(var2) { + case 0: + super.restoreState(var1); + this.targetCoords = (Point3)var1.restore(); + this.targetRot = (float)var1.restoreInt(); + this.targetRoomName = var1.restoreString(); + this.targetWorldURL = URL.restore(var1, ".world"); + this.useDefCoordinates = var1.restoreBoolean(); + this.targetDimension = null; + break; + case 1: + case 2: + super.restoreState(var1); + this.targetCoords = (Point3)var1.restore(); + this.targetRot = var1.restoreFloat(); + this.targetAxis = (Point3)var1.restore(); + this.targetRoomName = var1.restoreString(); + this.targetWorldURL = URL.restore(var1, ".world"); + this.useDefCoordinates = var1.restoreBoolean(); + this.targetDimension = null; + break; + case 3: + super.restoreState(var1); + this.targetCoords = (Point3)var1.restore(); + this.targetRot = var1.restoreFloat(); + this.targetAxis = (Point3)var1.restore(); + this.targetRoomName = var1.restoreString(); + this.targetWorldURL = URL.restore(var1, ".world"); + this.useDefCoordinates = var1.restoreBoolean(); + this.targetDimension = var1.restoreString(); + break; + default: + throw new TooNewException(); + } + + if (var2 < 2 && this.targetAxis.x == 0.0F && this.targetAxis.y == 0.0F && this.targetAxis.z == 1.0F) { + this.targetAxis.z = -1.0F; + this.targetRot = 360.0F - this.targetRot; + } + + } + + public String toString() { + return super.toString() + "[" + this.asURL() + "]"; + } + + public String asURL() { + String var1; + if (this.targetWorldURL != null) { + var1 = this.targetWorldURL.getRelativeTo(this) + "#"; + } else { + var1 = "#"; + } + + if (this.targetRoomName != null) { + var1 = var1 + this.targetRoomName; + } + + if (this.targetDimension != null) { + var1 = var1 + "<" + this.targetDimension + ">"; + } + + if (!this.useDefCoordinates) { + var1 = var1 + "@" + this.targetCoords + "," + this.targetRot; + if (this.targetAxis.x != 0.0F || this.targetAxis.y != 0.0F || this.targetAxis.z != 1.0F) { + var1 = var1 + "," + this.targetAxis; } - } else if (var3 == 2) { - this.targetDimension = (String)var4; - if (this.targetDimension.equals("")) { - this.targetDimension = null; - } - - this.stopLoading(); - } - break; - case 6: - if (var3 == 0) { - var5 = BooleanPropertyEditor.make(new Property(this, var1, "Show dialog"), "No", "Yes"); - } else if (var3 == 1) { - var5 = new Boolean(this.showDialog); - } else if (var3 == 2) { - this.showDialog = (Boolean)var4; - } - break; - default: - var5 = super.properties(var1, var2 + 7, var3, var4); - } - - return var5; - } - - public void saveState(Saver var1) throws IOException { - var1.saveVersion(3, classCookie); - super.saveState(var1); - var1.save(this.targetCoords); - var1.saveFloat(this.targetRot); - var1.save(this.targetAxis); - var1.saveString(this.targetRoomName); - URL.save(var1, this.targetWorldURL); - var1.saveBoolean(this.useDefCoordinates); - var1.saveString(this.targetDimension); - } - - public void restoreState(Restorer var1) throws IOException, TooNewException { - int var2 = var1.restoreVersion(classCookie); - switch(var2) { - case 0: - super.restoreState(var1); - this.targetCoords = (Point3)var1.restore(); - this.targetRot = (float)var1.restoreInt(); - this.targetRoomName = var1.restoreString(); - this.targetWorldURL = URL.restore(var1, ".world"); - this.useDefCoordinates = var1.restoreBoolean(); - this.targetDimension = null; - break; - case 1: - case 2: - super.restoreState(var1); - this.targetCoords = (Point3)var1.restore(); - this.targetRot = var1.restoreFloat(); - this.targetAxis = (Point3)var1.restore(); - this.targetRoomName = var1.restoreString(); - this.targetWorldURL = URL.restore(var1, ".world"); - this.useDefCoordinates = var1.restoreBoolean(); - this.targetDimension = null; - break; - case 3: - super.restoreState(var1); - this.targetCoords = (Point3)var1.restore(); - this.targetRot = var1.restoreFloat(); - this.targetAxis = (Point3)var1.restore(); - this.targetRoomName = var1.restoreString(); - this.targetWorldURL = URL.restore(var1, ".world"); - this.useDefCoordinates = var1.restoreBoolean(); - this.targetDimension = var1.restoreString(); - break; - default: - throw new TooNewException(); - } - - if (var2 < 2 && this.targetAxis.x == 0.0F && this.targetAxis.y == 0.0F && this.targetAxis.z == 1.0F) { - this.targetAxis.z = -1.0F; - this.targetRot = 360.0F - this.targetRot; - } - - } - - public String toString() { - return super.toString() + "[" + this.asURL() + "]"; - } - - public String asURL() { - String var1; - if (this.targetWorldURL != null) { - var1 = this.targetWorldURL.getRelativeTo((SuperRoot)this) + "#"; - } else { - var1 = "#"; - } - - if (this.targetRoomName != null) { - var1 = var1 + this.targetRoomName; - } - - if (this.targetDimension != null) { - var1 = var1 + "<" + this.targetDimension + ">"; - } - - if (!this.useDefCoordinates) { - var1 = var1 + "@" + this.targetCoords + "," + this.targetRot; - if (this.targetAxis.x != 0.0F || this.targetAxis.y != 0.0F || this.targetAxis.z != 1.0F) { - var1 = var1 + "," + this.targetAxis; - } - } + } - return var1; - } + return var1; + } } diff -ruN a/1890/NET/worldsplus/ChatSaver.java b/1890/NET/worldsplus/ChatSaver.java --- a/1890/NET/worldsplus/ChatSaver.java 1969-12-31 18:00:00.000000000 -0600 +++ b/1890/NET/worldsplus/ChatSaver.java 2023-08-21 23:27:17.000000000 -0500 @@ -0,0 +1,77 @@ +package NET.worldsplus; + +import NET.worlds.console.Console; +import NET.worlds.core.Debug; +import NET.worlds.core.IniFile; +import NET.worlds.network.URL; +import NET.worlds.scape.Pilot; + +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.StringTokenizer; +import java.util.Vector; + +public class ChatSaver { + + public static ChatSaver chatSaver; + private final static String folder = IniFile.modChatLog().getIniString("Location", "home:chats/"); + private final boolean enabled = IniFile.gamma().getIniInt("EnableChatLog", 1) == 1; + public static Vector chatBlacklist = parseChatBlacklist(); + + public ChatSaver() { + if (chatSaver == null) { + System.out.println("Initialized ChatSaver module..."); + if (enabled) { + File fold = new File(URL.make(folder).unalias()); + Debug.assert( !fold.exists() || !fold.mkdir()); + } + chatSaver = this; + } + } + + private FileWriter grabWriter(String name) throws IOException { + String cname = stripInvalid(name); + File log = new File(URL.make(folder + cname + ".log").unalias()); + Debug.assert(!log.exists() || !log.createNewFile()); + return new FileWriter(log.getAbsolutePath(), true); + } + + private void save(String name, String from, String message) throws IOException { + if (enabled && !chatBlacklist.contains(name)) { + FileWriter writer = grabWriter(name); + writer.write("[" + getCurrentDate() + "] " + from + ": " + message); + writer.write(System.getProperty("line.separator")); + writer.close(); + } + } + + public void saveRoom(String user, String message) throws IOException { + save(Pilot.getActiveRoom().toString(), user, message); + } + + public void saveWhisper(String from, String to, String message) throws IOException { + save(from.equals(Console.getActive().getLongID()) ? to : from, from, message); + } + + public String getCurrentDate() { + return new SimpleDateFormat("dd/MM/yyyy HH:mm:ss").format(new Date()); + } + + private static String stripInvalid(String s) { + if (s.indexOf("<") < 0) return s; + return s.substring(0, s.indexOf("<")); + } + + private static Vector parseChatBlacklist() { + String s = IniFile.modChatLog().getIniString("ChatBlacklist", "WORLDSMASTER,trade"); + StringTokenizer sToken = new StringTokenizer(s, ","); + Vector v = new Vector(); + while(((StringTokenizer)sToken).hasMoreTokens()) { + v.add(((StringTokenizer)sToken).nextToken()); + } + return v; + } +} diff -ruN a/1890/NET/worldsplus/IniUpdater.java b/1890/NET/worldsplus/IniUpdater.java --- a/1890/NET/worldsplus/IniUpdater.java 1969-12-31 18:00:00.000000000 -0600 +++ b/1890/NET/worldsplus/IniUpdater.java 2023-08-21 23:27:17.000000000 -0500 @@ -0,0 +1,39 @@ +package NET.worldsplus; + +import NET.worlds.core.IniFile; + +public class IniUpdater { + + private final String ver = IniFile.modPlus().getIniString("Version", ""); + + public IniUpdater() { + if (needUpdate()) { + if (ver.equals("0.0.0")) { + System.out.println("INI file set to bottom version, will not update."); + } else { + // Assuming we are updating from the last version + IniFile oldPlus = IniFile.ini("Modules"); + IniFile.gamma().setIniInt("DisableTalkAction", oldPlus.getIniInt("DisableTalkAction", 1)); + IniFile.gamma().setIniInt("DisableAction2", oldPlus.getIniInt("DisableAction2", 1)); + IniFile.gamma().setIniInt("AllowSleep", oldPlus.getIniInt("AllowSleep", 1)); + IniFile.gamma().setIniInt("ColorfulTags", oldPlus.getIniInt("ColorfulTags", 0)); + IniFile.gamma().setIniInt("EnableChatLog", oldPlus.getIniInt("LogChats", 1)); + IniFile.modChatLog().setIniString("Location", oldPlus.getIniString("ChatFolder", "home:chats/")); + IniFile oldFriendly = IniFile.ini("Friendly"); + IniFile.modPrivacy().setIniInt("WhisperFeedback", oldFriendly.getIniInt("WhisperFeedback", 1)); + IniFile.modPrivacy().setIniInt("TeleportFeedback", oldFriendly.getIniInt("TeleportFeedback", 1)); + IniFile.modPrivacy().setIniInt("WhisperResponse", oldFriendly.getIniInt("WhisperResponse", 1)); + IniFile.modPrivacy().setIniInt("TeleportResponse", oldFriendly.getIniInt("TeleportResponse", 0)); + IniFile.modPrivacy().setIniInt("ShowStatusUpdate", oldFriendly.getIniInt("ShowStatusUpdate", 0)); + IniFile.modPrivacy().setIniInt("WhisperPrivacy", IniFile.gamma().getIniInt("WhisperPrivacy", 0)); + IniFile.modPrivacy().setIniInt("TeleportPrivacy", IniFile.gamma().getIniInt("TeleportPrivacy", 0)); + } + } + IniFile.modPlus().setIniString("Version", WPlus.getVersion()); + } + + public boolean needUpdate() { + return ver.equals("") || !ver.equals(WPlus.getVersion()); + } + +} diff -ruN a/1890/NET/worldsplus/WPlus.java b/1890/NET/worldsplus/WPlus.java --- a/1890/NET/worldsplus/WPlus.java 1969-12-31 18:00:00.000000000 -0600 +++ b/1890/NET/worldsplus/WPlus.java 2023-08-21 23:27:17.000000000 -0500 @@ -0,0 +1,16 @@ +package NET.worldsplus; + +import java.text.SimpleDateFormat; +import java.util.Date; + +public class WPlus { + + private static final String stable_version = "1.7.2"; + static final String dateTime = new SimpleDateFormat("dd.MM.yyyy_HH.mm.ss").format(new Date()); + private static final boolean dev = false; + + // Hardcoded for reasons, I SWEAR + public static String getVersion(){ + return dev ? dateTime + "-dev" : stable_version; + } +} diff -ruN a/1904/NET/worlds/console/AboutDialog.java b/1904/NET/worlds/console/AboutDialog.java --- a/1904/NET/worlds/console/AboutDialog.java 2020-08-06 15:46:26.000000000 -0500 +++ b/1904/NET/worlds/console/AboutDialog.java 2023-09-10 15:19:36.000000000 -0500 @@ -3,6 +3,9 @@ import NET.worlds.core.IniFile; import NET.worlds.core.Std; import NET.worlds.network.NetUpdate; +import NET.worldsplus.WPlus; +import NET.worldsplus.Themer; + import java.awt.BorderLayout; import java.awt.Button; import java.awt.Color; @@ -19,76 +22,77 @@ import java.util.Vector; public class AboutDialog extends PolledDialog { - Button okButton = new Button(Console.message("OK")); - private static Font font = new Font(Console.message("ConsoleFont"), 0, 12); - private static Font bfont = new Font(Console.message("ButtonFont"), 0, 12); - String apptitle; - - AboutDialog(String var1, Frame var2) { - super(var2, (DialogReceiver)null, Console.message("About") + Std.getProductName(), true); - this.apptitle = var1; - this.ready(); - } - - private Component setConstraints(GridBagLayout var1, Component var2, GridBagConstraints var3) { - var1.setConstraints(var2, var3); - return var2; - } - - protected void build() { - this.setBackground(Color.white); - this.setLayout(new BorderLayout()); - this.add("North", new Filler(10, 10)); - this.add("South", new Filler(10, 10)); - this.add("East", new Filler(10, 10)); - this.add("West", new Filler(10, 10)); - GridBagLayout var1 = new GridBagLayout(); - Panel var2 = new Panel(var1); - var2.setFont(font); - GridBagConstraints var3 = new GridBagConstraints(); - var3.fill = 0; - var3.weightx = 1.0D; - var3.weighty = 1.0D; - var3.gridwidth = 0; - var3.gridheight = 1; - String var4 = IniFile.override().getIniString("AboutLogo", Console.message("wlogo.gif")); - var2.add(this.setConstraints(var1, new ImageCanvas(var4), var3)); - var3.weightx = 0.0D; - var3.weighty = 0.0D; - var2.add(this.setConstraints(var1, new Label(this.apptitle), var3)); - if (Gamma.getShaper() != null) { - var2.add(this.setConstraints(var1, new Label(Console.message("about-box-build-date") + " " + Std.getBuildInfo()), var3)); - } else { - var2.add(this.setConstraints(var1, new Label(Console.message("about-box-rev") + " " + Std.getVersion()), var3)); - } - - Vector var5 = NetUpdate.aboutWorlds(); - TextArea var6 = new TextArea(10, 40); - var6.setEditable(false); - var2.add(this.setConstraints(var1, var6, var3)); - Enumeration var7 = var5.elements(); - - while(var7.hasMoreElements()) { - var6.append((String)var7.nextElement() + "\n"); - } - - var2.add(this.setConstraints(var1, new Label(Console.message("about-box-1")), var3)); - var2.add(this.setConstraints(var1, new Label(Console.message("about-box-2")), var3)); - this.okButton.setFont(bfont); - var2.add(this.setConstraints(var1, this.okButton, var3)); - this.add("Center", var2); - } - - public boolean action(Event var1, Object var2) { - return var1.target == this.okButton ? this.done(true) : false; - } - - public boolean keyDown(Event var1, int var2) { - return var2 != 27 && var2 != 10 ? super.keyDown(var1, var2) : this.done(true); - } - - public void show() { - super.show(); - this.okButton.requestFocus(); - } + Button okButton = new Button(Console.message("OK")); + private static Font font = new Font(Console.message("ConsoleFont"), 0, 12); + private static Font bfont = new Font(Console.message("ButtonFont"), 0, 12); + String apptitle; + + AboutDialog(String var1, Frame var2) { + super(var2, (DialogReceiver)null, Console.message("About") + Std.getProductName(), true); + this.apptitle = var1; + this.ready(); + } + + private Component setConstraints(GridBagLayout var1, Component var2, GridBagConstraints var3) { + var1.setConstraints(var2, var3); + return var2; + } + + protected void build() { + this.setBackground(Color.white); + this.setLayout(new BorderLayout()); + this.add("North", new Filler(10, 10)); + this.add("South", new Filler(10, 10)); + this.add("East", new Filler(10, 10)); + this.add("West", new Filler(10, 10)); + GridBagLayout var1 = new GridBagLayout(); + Panel var2 = new Panel(var1); + var2.setFont(font); + GridBagConstraints var3 = new GridBagConstraints(); + var3.fill = 0; + var3.weightx = 1.0D; + var3.weighty = 1.0D; + var3.gridwidth = 0; + var3.gridheight = 1; + String var4 = Themer.themer.asset(Console.message("wlogo.gif")); + var2.add(this.setConstraints(var1, new ImageCanvas(var4), var3)); + var3.weightx = 0.0D; + var3.weighty = 0.0D; + var2.add(this.setConstraints(var1, new Label(this.apptitle), var3)); + if (Gamma.getShaper() != null) { + var2.add(this.setConstraints(var1, new Label(Console.message("about-box-build-date") + " " + Std.getBuildInfo()), var3)); + } else { + var2.add(this.setConstraints(var1, new Label(Console.message("about-box-rev") + " " + Std.getVersion()), var3)); + } + var2.add(this.setConstraints(var1, new Label("Worlds+ by Wirlaburla " + WPlus.getVersion()), var3)); + + Vector var5 = NetUpdate.aboutWorlds(); + TextArea var6 = new TextArea(10, 40); + var6.setEditable(false); + var2.add(this.setConstraints(var1, var6, var3)); + Enumeration var7 = var5.elements(); + + while(var7.hasMoreElements()) { + var6.append((String)var7.nextElement() + "\n"); + } + + var2.add(this.setConstraints(var1, new Label(Console.message("about-box-1")), var3)); + var2.add(this.setConstraints(var1, new Label(Console.message("about-box-2")), var3)); + this.okButton.setFont(bfont); + var2.add(this.setConstraints(var1, this.okButton, var3)); + this.add("Center", var2); + } + + public boolean action(Event var1, Object var2) { + return var1.target == this.okButton ? this.done(true) : false; + } + + public boolean keyDown(Event var1, int var2) { + return var2 != 27 && var2 != 10 ? super.keyDown(var1, var2) : this.done(true); + } + + public void show() { + super.show(); + this.okButton.requestFocus(); + } } diff -ruN a/1904/NET/worlds/console/ActionDialog.java b/1904/NET/worlds/console/ActionDialog.java --- a/1904/NET/worlds/console/ActionDialog.java 2020-08-06 15:46:20.000000000 -0500 +++ b/1904/NET/worlds/console/ActionDialog.java 2023-09-10 15:52:01.000000000 -0500 @@ -2,6 +2,7 @@ import NET.worlds.core.IniFile; import NET.worlds.core.ServerTableManager; +import NET.worldsplus.Themer; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; @@ -20,9 +21,9 @@ private static final int buttonWidth = 72; private static final int[] buttonHeights = new int[]{16}; private static final int[] xText = new int[]{22}; - private static final String topImageName = IniFile.override().getIniString("actionsTopGif", Console.message("actt.gif")); - private static final String buttonImageName = IniFile.override().getIniString("actionsButtonGif", "actm.gif"); - private static final String bottomImageName = IniFile.override().getIniString("actionsBottomGif", "actb.gif"); + private static final String topImageName = Themer.themer.asset(Console.message("actt.gif")); + private static final String buttonImageName = Themer.themer.asset("actm.gif"); + private static final String bottomImageName = Themer.themer.asset("actb.gif"); ActionDialog(Vector var1) { super(Console.getFrame(), (DialogReceiver)null, Console.message("Actions"), false); diff -ruN a/1904/NET/worlds/console/ChatSavePart.java b/1904/NET/worlds/console/ChatSavePart.java --- a/1904/NET/worlds/console/ChatSavePart.java 1969-12-31 18:00:00.000000000 -0600 +++ b/1904/NET/worlds/console/ChatSavePart.java 2023-08-21 23:27:16.000000000 -0500 @@ -0,0 +1,49 @@ +package NET.worlds.console; + +import java.io.BufferedReader; +import java.io.FileWriter; +import java.io.IOException; +import java.io.StringReader; + +public class ChatSavePart implements DialogReceiver { + + String chat; + + ChatSavePart(String text) { + this.chat = text; + FileSysDialog fsd = new FileSysDialog(DefaultConsole.getFrame(), this, "Save Chat", 1, "Hypertext Markup|*.html|Plain Text|*.txt", "", false); + } + + public void dialogDone(Object var1, boolean var2) { + if (var2) { + FileSysDialog var3 = (FileSysDialog)var1; + String var4 = var3.fileName(); + this.doSave(var4); + } + } + + public boolean doSave(String path) { + try { + if (path != null) { + FileWriter textWriter = new FileWriter(path); + if (path.endsWith(".html") || path.endsWith(".htm")) { + BufferedReader bufReader = new BufferedReader(new StringReader(this.chat)); + String line = null; + while( (line = bufReader.readLine()) != null ) + { + textWriter.write(line + "
"); + } + } else { + textWriter.write(this.chat); + } + textWriter.close(); + Console.println("Saved chat!"); + return true; + } else return false; + } catch (IOException var5) { + Console.println("Failed to save chat: " + var5.getMessage()); + return false; + } + } + +} diff -ruN a/1904/NET/worlds/console/DefaultConsole.java b/1904/NET/worlds/console/DefaultConsole.java --- a/1904/NET/worlds/console/DefaultConsole.java 2020-08-06 15:46:24.000000000 -0500 +++ b/1904/NET/worlds/console/DefaultConsole.java 2023-12-15 20:37:08.000000000 -0600 @@ -1,3 +1,8 @@ +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by Fernflower decompiler) +// + package NET.worlds.console; import NET.worlds.core.ArchiveMaker; @@ -32,6 +37,10 @@ import NET.worlds.scape.URLPropertyEditor; import NET.worlds.scape.VehicleShape; import NET.worlds.scape.World; +import NET.worldsplus.ChatSaver; +import NET.worldsplus.IniUpdater; +import NET.worldsplus.Themer; + import java.awt.BorderLayout; import java.awt.CardLayout; import java.awt.CheckboxMenuItem; @@ -56,6 +65,7 @@ import java.io.File; import java.io.FilenameFilter; import java.io.IOException; +import java.net.MalformedURLException; import java.text.Collator; import java.text.DateFormat; import java.text.MessageFormat; @@ -68,1889 +78,2083 @@ import java.util.Vector; public class DefaultConsole extends Console implements DialogReceiver, ImageButtonsCallback, RemoteFileConst { - MenuItem aboutItem; - MenuItem statisticsItem; - MenuItem upgradeItem; - MenuItem channelItem; - MenuItem infoItem; - MenuItem sleepItem; - MenuItem helpItem; - MenuItem gettingStartedItem; - MenuItem serverItem; - MenuItem numVisItem; - MenuItem checkAccountItem; - MenuItem becomeVIPItem; - MenuItem toggleVoiceChatItem; - MenuItem shaperHelpItem; - MenuItem inventoryItem; - MenuItem proxyServerItem; - MenuItem musicManItem; - MenuItem condenseItem; - MenuItem expandItem; - MenuItem i18nTest; - MenuItem currentLang; - Menu switchLang; - Vector downItems = null; - Vector langItems = null; - Vector fontItems = null; - static final String LANGUAGES = "languages.lst"; - static final String FONTS = "fonts.lst"; - Vector viewItems = null; - Vector camSpeedItems = null; - CheckboxMenuItem currentViewItem; - CheckboxMenuItem currentCamSpeedItem; - ImageButtons driveButton; - ImageButtons quitButton; - ImageButtons exploreButton; - ImageButtons menuButtons; - String defaultAd = IniFile.override().getIniString("defaultAd", "home:adworlds.cmp"); - AdPart ad; - ChatPart chat; - RenderCanvas render; - Panel renderAndUniverse; - UniversePanel universe; - CardLayout renderCard; - InventoryPart inventory; - WorldsMarkPart marks; - FriendsListPart friends; - ActionsPart actions; - MuteListPart mutes; - MapPart map; - SavedAvPart savedAvs; - private static Font font = new Font(Console.message("ConsoleFont"), 0, 12); - private static Font mfont = new Font(Console.message("MenuFont"), 0, 12); - CDControl cdcontrol; - boolean playedCD; - MenuItem cdPlayerItem; - MenuItem volumeItem; - MenuItem graphicsItem; - MenuItem nametagItem; - MenuItem chatBoxItem; - MenuItem broadcastToRoom; - MenuItem broadcastToAll; - MenuItem bootSomeone; - CheckboxMenuItem orthographicViewItem; - MenuItem recorderPlayItem; - MenuItem recorderRecItem; - MenuItem recorderStopItem; - boolean universeMode; - private static final int[] menuButtonHeights = new int[]{23, 21, 21, 21, 21, 21, 25, -29}; - private Vector viewNames; - private Vector speedNames; - private static final int HELP = 0; - private static final int OPTIONS = 1; - private static final int WORLDSMAIL = 2; - private static final int WORLDSMARK = 3; - private static final int LETS = 4; - private static final int ACTIONS = 5; - private static final int VIP = 6; - static String loadingString = Console.message("Loading"); - static String arrowKeyMsg = Console.message("Use-arrow-keys"); - String statusMessage; - String overrideMessage; - String lastStatus; - int lastUpdateTime; - boolean wasTeleporting; - private int lastVMCheck; - private int lastVMBigWarning; - Component bottom; - Component top; - Label status; - Label yourName; - static String[] lNames = lpList(); - static int lLength; - static MenuItem[] lLangs; - static Locale[] newLocale; - static String[][] lCodes; - Vector lList; - Vector sList; - int[] lSizes; - int dLength; - MenuItem[] dLangs; - Locale[] newdLocale; - Vector flList; - Vector fsList; - int[] fSizes; - int fLength; - MenuItem[] dFonts; - Locale[] newfLocale; - static boolean wasDelta; - static boolean doDrive; - Panel mapPanel; - private static String signIn; - private static String signOut; - private static String signingIn; - private static String noMultiUser; - private static String enable3D; - private static String disable3D; - private static String showTags; - private static String hideTags; - private static String enableClassicChat; - private static String disableClassicChat; - Menu chatLogMenu; - AvMenu avatarMenu; - private int chooseView; - private int chooseCamSpeed; - private static String sleepStatus; - OkCancelDialog reloginDialog; - private Object nextAvatarMutex; - private URL nextAvatar; - private CheckboxMenuItem nextAvatarItem; - private CheckboxMenuItem curAvatarItem; - private static String lastWorldName; - private static String lowVMMsg; - private boolean showedMidWarn; - private static boolean startupMemCheck; - public static int physMem; - protected URL avatarURL; - private static Object classCookie; - - public UniversePanel getUniversePanel() { - return this.universe; - } - - public void printLine(String var1) { - this.chat.println(var1); - super.printLine(var1); - } - - protected void printWhisperFrom(String var1, String var2) { - WhisperManager.whisperManager().printFrom(var1, var2); - } - - protected void printWhisperTo(String var1, String var2) { - WhisperManager.whisperManager().printTo(var1, var2); - } - - protected void startWhisperingTo(String var1) { - WhisperManager.whisperManager().startTo(var1); - } - - public DefaultConsole() { - this.ad = new AdPart(URL.make(this.defaultAd)); - this.chat = new ChatPart(); - this.render = new RenderCanvas(this, new Dimension(560, 360)); - this.inventory = new InventoryPart(); - this.marks = new WorldsMarkPart(); - this.friends = new FriendsListPart(); - this.actions = new ActionsPart(); - this.mutes = new MuteListPart(); - this.map = new MapPart(); - this.savedAvs = new SavedAvPart(); - this.statusMessage = arrowKeyMsg; - this.lastStatus = ""; - this.lastUpdateTime = 0; - this.wasTeleporting = false; - this.status = new UnpaddedLabel("", 2); - this.yourName = new UnpaddedLabel("", 0); - this.lList = new Vector(); - this.sList = new Vector(); - this.lSizes = new int[]{0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - this.dLength = this.dpList(this.lList, this.sList, this.lSizes); - this.dLangs = this.dLength == 0 ? null : new MenuItem[this.dLength]; - this.newdLocale = this.dLength == 0 ? null : new Locale[this.dLength]; - this.flList = new Vector(); - this.fsList = new Vector(); - this.fSizes = new int[]{0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - this.fLength = this.fpList(this.flList, this.fsList, this.fSizes); - this.dFonts = this.fLength == 0 ? null : new MenuItem[this.fLength]; - this.newfLocale = this.fLength == 0 ? null : new Locale[this.fLength]; - this.chooseView = -1; - this.chooseCamSpeed = -1; - this.nextAvatarMutex = new Object(); - this.init(); - this.loadViewNames(); - this.speedNames = new Vector(); - this.speedNames.addElement(new DefaultConsole.CameraSpeed("Slow", 1)); - this.speedNames.addElement(new DefaultConsole.CameraSpeed("Medium", 2)); - this.speedNames.addElement(new DefaultConsole.CameraSpeed("Fast", 3)); - } - - public void loadViewNames() { - this.viewNames = new Vector(); - this.viewNames.addElement(new DefaultConsole.CameraView("First-person", 1)); - this.viewNames.addElement(new DefaultConsole.CameraView("Low-first-person", 2)); - this.viewNames.addElement(new DefaultConsole.CameraView("Waist", 3)); - this.viewNames.addElement(new DefaultConsole.CameraView("Shoulder", 4)); - this.viewNames.addElement(new DefaultConsole.CameraView("Head", 5)); - this.viewNames.addElement(new DefaultConsole.CameraView("Overhead", 6)); - this.viewNames.addElement(new DefaultConsole.CameraView("Behind", 7)); - this.viewNames.addElement(new DefaultConsole.CameraView("Wide-shot", 8)); - if (Gamma.getShaper() != null) { - this.viewNames.addElement(new DefaultConsole.CameraView("Orthographic", 9)); - } - - } - - public void setOrthoEnabled(boolean var1) { - if (this.orthographicViewItem != null) { - this.orthographicViewItem.setEnabled(var1); - } - - } - - public void loadInit() { - super.loadInit(); - } - - public void removeUseArrowStatusMsg() { - if (this.statusMessage == arrowKeyMsg) { - this.statusMessage = ""; - } - - } - - public void overrideStatusMsg(String var1) { - synchronized(this.status) { - this.overrideMessage = var1; - if (var1 != null) { - this.status.setText(var1); - } else { - this.status.setText(this.lastStatus); - } - - } - } - - public String message(String var1, Locale var2) { - Locale.setDefault(var2); - Console.println(var2.getDisplayName()); - - try { - ResourceBundle var3 = ResourceBundle.getBundle("MessagesBundle", var2); - return var3.getString(var1); - } catch (MissingResourceException var4) { - return "NO MESSAGE for " + var1; - } - } - - private void init() { - this.addPart(this.render); - this.addPart(this.chat); - this.addPart(this.inventory); - this.addPart(this.marks); - this.addPart(this.friends); - this.addPart(this.actions); - this.addPart(this.mutes); - this.addPart(this.ad); - this.addPart(this.map); - this.addPart(this.savedAvs); - Panel var1 = new Panel(new FlowLayout(1, 0, 0)); - String var2 = IniFile.override().getIniString("driveGif", "drive.gif"); - this.addPart(this.driveButton = new ImageButtons(var2, 81, 19, this)); - String var3 = IniFile.override().getIniString("quitGif", Console.message("quit.gif")); - this.addPart(this.quitButton = new ImageButtons(var3, 65, 19, this)); - String var4 = IniFile.override().getIniString("exploreGif", Console.message("explore.gif")); - this.addPart(this.exploreButton = new ImageButtons(var4, 98, 22, this)); - var1.add(this.driveButton); - this.driveButton.setDownUpHandler(new ImageButtonsCallback() { - public Object imageButtonsCallback(Component var1, int var2) { - if (var2 != -1) { - DefaultConsole.this.startDrive(); + MenuItem aboutItem; + MenuItem statisticsItem; + MenuItem upgradeItem; + MenuItem channelItem; + MenuItem infoItem; + MenuItem sleepItem; + MenuItem helpItem; + MenuItem gettingStartedItem; + MenuItem serverItem; + MenuItem numVisItem; + MenuItem checkAccountItem; + MenuItem becomeVIPItem; + MenuItem toggleVoiceChatItem; + MenuItem shaperHelpItem; + MenuItem inventoryItem; + MenuItem proxyServerItem; + MenuItem musicManItem; + MenuItem condenseItem; + MenuItem expandItem; + MenuItem i18nTest; + MenuItem currentLang; + Menu switchLang; + Vector downItems = null; + Vector langItems = null; + Vector fontItems = null; + static final String LANGUAGES = "languages.lst"; + static final String FONTS = "fonts.lst"; + Vector viewItems = null; + Vector camSpeedItems = null; + CheckboxMenuItem currentViewItem; + CheckboxMenuItem currentCamSpeedItem; + + Vector whisperItems = null; + Vector teleportItems = null; + CheckboxMenuItem currentWhisperItem; + CheckboxMenuItem currentTeleportItem; + + ImageButtons driveButton; + ImageButtons quitButton; + ImageButtons exploreButton; + ImageButtons menuButtons; + String defaultAd = IniFile.override().getIniString("defaultAd", "home:adworlds.cmp"); + AdPart ad; + ChatPart chat; + RenderCanvas render; + Panel renderAndUniverse; + UniversePanel universe; + CardLayout renderCard; + InventoryPart inventory; + WorldsMarkPart marks; + FriendsListPart friends; + ActionsPart actions; + MuteListPart mutes; + TarListPart tars; + MapPart map; + SavedAvPart savedAvs; + private static Font font = new Font(Console.message("ConsoleFont"), 0, 12); + private static Font mfont = new Font(Console.message("MenuFont"), 0, 12); + CDControl cdcontrol; + boolean playedCD; + MenuItem cdPlayerItem; + MenuItem volumeItem; + MenuItem graphicsItem; + MenuItem nametagItem; + MenuItem chatBoxItem; + MenuItem broadcastToRoom; + MenuItem broadcastToAll; + MenuItem bootSomeone; + MenuItem recorderPlayItem; + MenuItem recorderRecItem; + MenuItem recorderStopItem; + CheckboxMenuItem showWhispers; + CheckboxMenuItem showTeleports; + CheckboxMenuItem respondWhispers; + CheckboxMenuItem respondTeleports; + CheckboxMenuItem overrideWorldTeleport; + boolean universeMode; + private static final int[] menuButtonHeights = new int[]{23, 21, 21, 21, 21, 21, 25, -29}; + private Vector viewNames; + private Vector speedNames; + private Vector whisperNames; + private Vector teleportNames; + private static final int HELP = 0; + private static final int OPTIONS = 1; + private static final int WORLDSMAIL = 2; + private static final int WORLDSMARK = 3; + private static final int LETS = 4; + private static final int ACTIONS = 5; + private static final int VIP = 6; + static String loadingString = Console.message("Loading"); + static String arrowKeyMsg = Console.message("Use-arrow-keys"); + String statusMessage; + String overrideMessage; + String lastStatus; + int lastUpdateTime; + boolean wasTeleporting; + private int lastVMCheck; + private int lastVMBigWarning; + Component bottom; + Component top; + Label status; + Label yourName; + static String[] lNames = lpList(); + static int lLength; + static MenuItem[] lLangs; + static Locale[] newLocale; + static String[][] lCodes; + Vector lList; + Vector sList; + int[] lSizes; + int dLength; + MenuItem[] dLangs; + Locale[] newdLocale; + Vector flList; + Vector fsList; + int[] fSizes; + int fLength; + MenuItem[] dFonts; + Locale[] newfLocale; + static boolean wasDelta; + static boolean doDrive; + Panel mapPanel; + private static String signIn; + private static String signOut; + private static String signingIn; + private static String noMultiUser; + private static String enable3D; + private static String disable3D; + private static String showTags; + private static String hideTags; + private static String enableClassicChat; + private static String disableClassicChat; + Menu chatLogMenu; + AvMenu avatarMenu; + private int chooseView; + private int chooseCamSpeed; + private int chooseWhisper; + private int chooseTeleport; + private static String sleepStatus; + OkCancelDialog reloginDialog; + private Object nextAvatarMutex; + private URL nextAvatar; + private CheckboxMenuItem nextAvatarItem; + private CheckboxMenuItem curAvatarItem; + private static String lastWorldName; + private static String lowVMMsg; + private boolean showedMidWarn; + private static boolean startupMemCheck; + public static int physMem; + protected URL avatarURL; + private static Object classCookie; + + public UniversePanel getUniversePanel() { + return this.universe; + } + + public void printLine(String var1) { + this.chat.println(var1); + super.printLine(var1); + } + + protected void printWhisperFrom(String var1, String var2) { + WhisperManager.whisperManager().printFrom(var1, var2); + } + + protected void printWhisperTo(String var1, String var2) { + WhisperManager.whisperManager().printTo(var1, var2); + } + + protected void startWhisperingTo(String var1) { + WhisperManager.whisperManager().startTo(var1); + } + + public DefaultConsole() { + this.ad = new AdPart(URL.make(this.defaultAd)); + this.chat = new ChatPart(); + this.render = new RenderCanvas(this, new Dimension(560, 360)); + this.inventory = new InventoryPart(); + this.marks = new WorldsMarkPart(); + this.friends = new FriendsListPart(); + this.actions = new ActionsPart(); + this.mutes = new MuteListPart(); + this.tars = new TarListPart(); + this.map = new MapPart(); + this.savedAvs = new SavedAvPart(); + this.statusMessage = arrowKeyMsg; + this.lastStatus = ""; + this.lastUpdateTime = 0; + this.wasTeleporting = false; + this.status = new UnpaddedLabel("", 2); + this.yourName = new UnpaddedLabel("", 0); + this.lList = new Vector(); + this.sList = new Vector(); + this.lSizes = new int[]{0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + this.dLength = this.dpList(this.lList, this.sList, this.lSizes); + this.dLangs = this.dLength == 0 ? null : new MenuItem[this.dLength]; + this.newdLocale = this.dLength == 0 ? null : new Locale[this.dLength]; + this.flList = new Vector(); + this.fsList = new Vector(); + this.fSizes = new int[]{0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + this.fLength = this.fpList(this.flList, this.fsList, this.fSizes); + this.dFonts = this.fLength == 0 ? null : new MenuItem[this.fLength]; + this.newfLocale = this.fLength == 0 ? null : new Locale[this.fLength]; + this.chooseView = -1; + this.chooseCamSpeed = -1; + this.chooseWhisper = -1; + this.chooseTeleport = -1; + this.nextAvatarMutex = new Object(); + new ChatSaver(); + new IniUpdater(); + new Themer(); + this.init(); + this.loadViewNames(); + this.loadSpeedNames(); + this.loadWhisperNames(); + this.loadTeleportNames(); + } + + public void loadSpeedNames() { + this.speedNames = new Vector(); + this.speedNames.addElement(new DefaultConsole.CameraSpeed("Slow", 1)); + this.speedNames.addElement(new DefaultConsole.CameraSpeed("Medium", 2)); + this.speedNames.addElement(new DefaultConsole.CameraSpeed("Fast", 3)); + this.speedNames.addElement(new DefaultConsole.CameraSpeed("Very Fast", 4)); + } + + public void loadViewNames() { + this.viewNames = new Vector(); + this.viewNames.addElement(new DefaultConsole.CameraView("First-person", 1)); + this.viewNames.addElement(new DefaultConsole.CameraView("Low-first-person", 2)); + this.viewNames.addElement(new DefaultConsole.CameraView("Waist", 3)); + this.viewNames.addElement(new DefaultConsole.CameraView("Shoulder", 4)); + this.viewNames.addElement(new DefaultConsole.CameraView("Head", 5)); + this.viewNames.addElement(new DefaultConsole.CameraView("Overhead", 6)); + this.viewNames.addElement(new DefaultConsole.CameraView("Behind", 7)); + this.viewNames.addElement(new DefaultConsole.CameraView("Wide-shot", 8)); + this.viewNames.addElement(new DefaultConsole.CameraView("Orthographic", 9)); + } + + public void loadWhisperNames() { + this.whisperNames = new Vector(); + this.whisperNames.addElement(new DefaultConsole.WhisperPrivacy("Everyone", 0)); + this.whisperNames.addElement(new DefaultConsole.WhisperPrivacy("Friends", 1)); + this.whisperNames.addElement(new DefaultConsole.WhisperPrivacy("No one", 2)); + } + + public void loadTeleportNames() { + this.teleportNames = new Vector(); + this.teleportNames.addElement(new DefaultConsole.TeleportPrivacy("Everyone", 0)); + this.teleportNames.addElement(new DefaultConsole.TeleportPrivacy("Friends", 1)); + this.teleportNames.addElement(new DefaultConsole.TeleportPrivacy("No one", 2)); + } + + public void setOrthoEnabled(boolean var1) { + + } + + public void loadInit() { + super.loadInit(); + } + + public void removeUseArrowStatusMsg() { + if (this.statusMessage.equals(arrowKeyMsg)) { + this.statusMessage = ""; + } + + } + + public void overrideStatusMsg(String var1) { + synchronized(this.status) { + this.overrideMessage = var1; + if (var1 != null) { + this.status.setText(var1); } else { - DefaultConsole.this.driveButton.drawDown(); + this.status.setText(this.lastStatus); } - return this; - } - }); - Panel var5 = new Panel(); - var5.setLayout(new GridLayout(1, 3)); - int var6 = IniFile.override().getIniInt("uiBackgroundRed", 49); - int var7 = IniFile.override().getIniInt("uiBackgroundGreen", 0); - int var8 = IniFile.override().getIniInt("uiBackgroundBlue", 255); - var5.setBackground(new Color(var6, var7, var8)); - var5.add(this.yourName); - var5.add(var1); - var5.add(this.status); - this.chat.line.setBackground(Color.black); - this.chat.line.setForeground(Color.white); - this.chat.line.setFont(font); - InsetPanel var9 = new InsetPanel(new BorderLayout(0, 3), 0, 0, 3, 0); - var9.add("North", var5); - var9.add("Center", this.chat.listen.getComponent()); - var9.add("South", this.chat.line); - this.chat.listen.setBackground(Color.black); - this.chat.listen.setForeground(Color.white); - this.chat.listen.setFont(font); - Panel var10 = new Panel(new BorderLayout()); - new Panel(new BorderLayout()); - Panel var12 = new Panel(new BorderLayout()); - Panel var13 = new Panel(new BorderLayout()); - ColorFiller var14 = new ColorFiller(65, 19); - var14.setBackground(new Color(var6, var7, var8)); - var12.add("West", this.quitButton); - var12.add("East", var14); - var13.add("North", var12); - var13.add("Center", this.ad); - var10.add("West", var13); - this.mapPanel = new Panel(new BorderLayout()); - this.mapPanel.add("Center", this.map); - this.mapPanel.setBackground(Color.black); - var12 = new Panel(new BorderLayout()); - ColorFiller var15 = new ColorFiller(60, 19); - var15.setBackground(new Color(var6, var7, var8)); - var12.add("North", var15); - ColorFiller var16 = new ColorFiller(60, 3); - int var17 = IniFile.override().getIniInt("uiBackground2Red", 0); - int var18 = IniFile.override().getIniInt("uiBackground2Green", 0); - int var19 = IniFile.override().getIniInt("uiBackground2Blue", 0); - var16.setBackground(new Color(var17, var18, var19)); - var12.add("South", var16); - Panel var11 = new Panel(new BorderLayout()); - var11.add("East", this.exploreButton); - var11.add("West", var12); - this.mapPanel.add("North", var11); - var10.add("East", this.mapPanel); - var10.add("Center", var9); - this.bottom = var10; - this.renderCard = new CardLayout(); - this.renderAndUniverse = new Panel(this.renderCard); - this.renderAndUniverse.add("render", this.render); - InsetPanel var20 = new InsetPanel(new BorderLayout(), 3, 3, 0, 0); - var20.add("Center", this.renderAndUniverse); - int var21 = IniFile.override().getIniInt("uiBackground3Red", 0); - int var22 = IniFile.override().getIniInt("uiBackground3Green", 0); - int var23 = IniFile.override().getIniInt("uiBackground3Blue", 0); - var14 = new ColorFiller(97, 1); - var14.setBackground(new Color(var21, var22, var23)); - Panel var24 = new Panel(new QuantizedStackedLayout(var14)); - String var25 = IniFile.override().getIniString("rtPanel", Console.message("rtpanel.gif")); - this.addPart(this.menuButtons = new ImageButtons(var25, 97, menuButtonHeights, this)); - var24.add(var14); - var24.add(this.menuButtons); - var24.add(this.friends); - var20.add("East", var24); - this.top = var20; - } - - public void relayoutMap() { - this.mapPanel.invalidate(); - this.mapPanel.validate(); - this.mapPanel.doLayout(); - this.mapPanel.repaint(); - } - - public void startDrive() { - this.statusMessage = Console.message("Drag-mouse"); - doDrive = true; - Window.makeJavaReleaseCapture(); - } - - public void setOnlineState(boolean var1, boolean var2) { - synchronized(this) { - if (this.serverItem != null) { - this.serverItem.setEnabled(var1); - if (!var1) { - Galaxy var4 = this.getGalaxy(); - if (var4 != null && !var4.isAnonymous()) { - this.serverItem.setLabel(signingIn); - } else { - this.serverItem.setLabel(noMultiUser); - } - } else if (var2) { - this.serverItem.setLabel(signOut); - } else { - this.serverItem.setLabel(signIn); - } - } + } + } - } - } - - private void handleNametagsItem() { - if (IniFile.gamma().getIniInt("SHOWNAMETAGS", 1) == 0) { - IniFile.gamma().setIniInt("SHOWNAMETAGS", 1); - this.nametagItem.setLabel(hideTags); - } else { - IniFile.gamma().setIniInt("SHOWNAMETAGS", 0); - this.nametagItem.setLabel(showTags); - } - - new OkCancelDialog(getFrame(), (DialogReceiver)null, Console.message("Alert"), (String)null, Console.message("OK"), Console.message("Change-exit"), true); - } - - private void handleGraphicsItem() { - if (IniFile.gamma().getIniInt("UserEnabled3DHardware", 0) == 0) { - IniFile.gamma().setIniInt("UserEnabled3DHardware", 1); - this.graphicsItem.setLabel(disable3D); - } else { - IniFile.gamma().setIniInt("UserEnabled3DHardware", 0); - this.graphicsItem.setLabel(enable3D); - } - - new OkCancelDialog(getFrame(), (DialogReceiver)null, Console.message("Alert"), (String)null, Console.message("OK"), Console.message("Change-exit"), true); - } - - private void handleChatBoxItem() { - if (IniFile.gamma().getIniInt("classicChatBox", 1) == 0) { - IniFile.gamma().setIniInt("classicChatBox", 1); - this.chatBoxItem.setLabel(disableClassicChat); - } else { - IniFile.gamma().setIniInt("classicChatBox", 0); - this.chatBoxItem.setLabel(enableClassicChat); - } - - new OkCancelDialog(getFrame(), (DialogReceiver)null, Console.message("Alert"), (String)null, Console.message("OK"), Console.message("Change-exit"), true); - } - - public AvMenu getAvatarMenu() { - return this.avatarMenu; - } - - public void inventoryChanged() { - super.inventoryChanged(); - if (this.avatarMenu != null) { - this.avatarMenu.buildSpecialGuestMenu(); - } - - } - - public void setMenusWRTVIP() { - if (this.avatarMenu != null) { - this.avatarMenu.setEnabled(this.getVIP()); - this.avatarMenu.customize.setEnabled(this.getVIP()); - } - - if (this.savedAvs != null) { - this.savedAvs.setEnabled(this.getVIP()); - } - - if (this.chatLogMenu != null) { - this.chatLogMenu.setEnabled(this.getVIP()); - } - - if (this.toggleVoiceChatItem != null) { - this.toggleVoiceChatItem.setLabel(this.getVIP() && VoiceChat.voiceChatEnabled ? Console.message("Reject-Voice") : Console.message("Accept-Voice")); - this.toggleVoiceChatItem.setEnabled(this.getVIP() && VoiceChat.voiceChatAvailable()); - } - - if (this.becomeVIPItem != null) { - this.becomeVIPItem.setLabel(vip > 0 ? (vip > 1 ? Console.message("Youre-a-VIP") : Console.message("Become-full-VIP")) : Console.message("Become-VIP")); - } - - if (this.numVisItem != null) { - this.numVisItem.setEnabled(this.getVIP()); - } - - } - - public void addBroadcastMenu() { - if (this.bootSomeone == null) { - if (IniFile.gamma().getIniInt("Broadcast", 0) != 0) { - Menu var1 = new Menu(Console.message("Broadcast")); - var1.add(this.broadcastToRoom = new MenuItem(Console.message("Users"))); - var1.add(this.broadcastToAll = new MenuItem(Console.message("All-users"))); - this.addMenuItem(var1, "Options"); - } - - this.bootSomeone = new MenuItem(Console.message("Boot-user")); - this.addMenuItem(this.bootSomeone, "Options"); - } - - } - - private Menu updateChatLogMenu() { - if (this.chatLogMenu == null) { - this.chatLogMenu = new Menu(Console.message("View-Chat")); - } else { - this.chatLogMenu.removeAll(); - } - - ActionListener var1 = new ActionListener() { - public void actionPerformed(ActionEvent var1) { - (new SendURLAction("file:" + var1.getActionCommand())).startBrowser(); - } - }; - String[] var2 = this.logList(); - MenuItem var3 = null; - - for(int var4 = 0; var4 < var2.length; ++var4) { - int var5 = var2[var4].indexOf(".glog.html"); - if (var5 > 6) { - Object[] var6 = new Object[]{new String(var2[var4].substring(5, var5))}; - var3 = new MenuItem(MessageFormat.format(Console.message("Chat-with"), var6)); - } else { - if (var5 <= 0) { - continue; - } - - var3 = new MenuItem(Console.message("General-chat")); - } - - var3.setActionCommand(var2[var4]); - var3.addActionListener(var1); - this.chatLogMenu.add(var3); - } - - return this.chatLogMenu; - } - - private String[] logList() { - File var1 = new File("."); - FilenameFilter var2 = new FilenameFilter() { - public boolean accept(File var1, String var2) { - return var2.startsWith("chat.") && var2.endsWith(".glog.html"); - } - }; - return var1.list(var2); - } - - private static String[] lpList() { - File var0 = new File("."); - FilenameFilter var1 = new FilenameFilter() { - public boolean accept(File var1, String var2) { - return var2.startsWith("MessagesBundle") && var2.endsWith(".properties"); - } - }; - String[] var2 = var0.list(var1); - Collator var3 = Collator.getInstance(); - sortStrings(var3, var2); - return var2; - } - - private int dpList(Vector var1, Vector var2, int[] var3) { - String var4 = NetUpdate.getLanguages(URL.make(NetUpdate.getUpgradeServerURL() + "I18N/" + "languages.lst"), var1, var2, var3); - if (var4 != null) { - System.out.println(var4); - return 0; - } else { - return var1.size(); - } - } - - private int fpList(Vector var1, Vector var2, int[] var3) { - String var4 = NetUpdate.getLanguages(URL.make(NetUpdate.getUpgradeServerURL() + "I18N/" + "fonts.lst"), var1, var2, var3); - if (var4 != null) { - System.out.println(var4); - return 0; - } else { - return var1.size(); - } - } - - public static void sortStrings(Collator var0, String[] var1, Locale[] var2, String[][] var3) { - for(int var8 = 0; var8 < var1.length; ++var8) { - for(int var9 = var8 + 1; var9 < var1.length; ++var9) { - if (var0.compare(var1[var8], var1[var9]) > 0) { - String var4 = var1[var8]; - Locale var5 = var2[var8]; - String var6 = var3[var8][0]; - String var7 = var3[var8][1]; - var1[var8] = var1[var9]; - var2[var8] = var2[var9]; - var3[var8][0] = var3[var9][0]; - var3[var8][1] = var3[var9][1]; - var1[var9] = var4; - var2[var9] = var5; - var3[var9][0] = var6; - var3[var9][1] = var7; - } - } - } - - } - - public static void sortStrings(Collator var0, String[] var1, Locale[] var2, Vector var3, Vector var4) { - for(int var9 = 0; var9 < var1.length; ++var9) { - for(int var10 = var9 + 1; var10 < var1.length; ++var10) { - if (var0.compare(var1[var9], var1[var10]) > 0) { - String var5 = var1[var9]; - Locale var6 = var2[var9]; - String var7 = (String)var3.elementAt(var9); - String var8 = (String)var4.elementAt(var9); - var1[var9] = var1[var10]; - var2[var9] = var2[var10]; - var3.setElementAt(var3.elementAt(var10), var9); - var4.setElementAt(var4.elementAt(var10), var9); - var1[var10] = var5; - var2[var10] = var6; - var3.setElementAt(var7, var10); - var4.setElementAt(var8, var10); - } - } - } - - } - - public static void sortStrings(Collator var0, String[] var1) { - for(int var3 = 0; var3 < var1.length; ++var3) { - for(int var4 = var3 + 1; var4 < var1.length; ++var4) { - if (var0.compare(var1[var3], var1[var4]) > 0) { - String var2 = var1[var3]; - var1[var3] = var1[var4]; - var1[var4] = var2; - } - } - } - - } - - public void activate(Container var1) { - super.activate(var1); - var1.setBackground(Color.black); - var1.setForeground(Color.white); - var1.setLayout(new BorderLayout()); - var1.add("Center", this.top); - var1.add("South", this.bottom); - this.chat.line.setBackground(Color.white); - this.chat.line.setForeground(Color.black); - boolean var2 = Gamma.getShaper() != null; - if (var2) { - this.shaperHelpItem = this.addMenuItem(Console.message("using-shaper"), "Help"); - } - - if (NetUpdate.getInfoURL() != null) { - this.helpItem = this.addMenuItem(Console.message("Help-Contents"), "Help"); - this.infoItem = this.addMenuItem(Console.message("Latest-info"), "Help"); - } - - Object[] var3 = new Object[]{new String(Std.getProductName())}; - this.aboutItem = this.addMenuItem(MessageFormat.format(Console.message("About-product"), var3), "Help"); - int var4 = IniFile.gamma().getIniInt("CAM_MODE", 7); - int var5 = IniFile.gamma().getIniInt("CAM_SPEED", 3); - if (!var2 && var4 == 9) { - var4 = 7; - } - - this.pilot.setOutsideCameraMode(var4, var5); - Menu var6 = new Menu(Console.message("Change-View")); - this.addMenuItem(var6, "Options"); - MenuItem var7 = new MenuItem(Console.message("CAMERA-VIEW")); - var7.setFont(mfont); - var6.add(var7); - this.viewItems = new Vector(); - - for(int var8 = 0; var8 < this.viewNames.size(); ++var8) { - DefaultConsole.CameraView var9 = (DefaultConsole.CameraView)this.viewNames.elementAt(var8); - CheckboxMenuItem var10 = new CheckboxMenuItem(" " + Console.message(var9.viewName), var4 == var9.viewID); - if (var4 == var9.viewID) { - this.currentViewItem = var10; - } - - var10.setFont(mfont); - var6.add(var10); - this.viewItems.addElement(var10); - if (var9.viewName == "Orthographic") { - this.orthographicViewItem = var10; - } - } - - var6.addSeparator(); - MenuItem var25 = new MenuItem(Console.message("CAMERA-SPEED")); - var25.setFont(mfont); - var6.add(var25); - this.camSpeedItems = new Vector(); - - for(int var26 = 0; var26 < this.speedNames.size(); ++var26) { - DefaultConsole.CameraSpeed var28 = (DefaultConsole.CameraSpeed)this.speedNames.elementAt(var26); - CheckboxMenuItem var11 = new CheckboxMenuItem(" " + Console.message(var28.speedName), var28.speedID == var5); - if (var28.speedID == var5) { - this.currentCamSpeedItem = var11; - } - - var11.setFont(mfont); - var6.add(var11); - this.camSpeedItems.addElement(var11); - } - - this.becomeVIPItem = this.addMenuItem(vip == 1 ? Console.message("Become-full-VIP") : Console.message("Become-VIP"), "VIP"); - this.addMenuItem(this.avatarMenu = new AvMenu(this, this.lastPilotRequested), "VIP"); - this.addMenuItem(this.savedAvs, "VIP"); - this.addMenuItem(this.avatarMenu.customize, "VIP"); - this.toggleVoiceChatItem = this.addMenuItem(Console.message("Enable-Voice"), "VIP"); - this.toggleVoiceChatItem.setEnabled(false); - this.numVisItem = this.addMenuItem(Console.message("Num-Visible"), "VIP"); - if (NetUpdate.isInternalVersion()) { - this.inventoryItem = this.addMenuItem("Check Inventory", "VIP"); - } - - this.setMenusWRTVIP(); - this.proxyServerItem = this.addMenuItem(Console.message("Proxy-Server"), "Options"); - this.checkAccountItem = this.addMenuItem(Console.message("Account-Info"), "Options"); - if (var2) { - this.statisticsItem = this.addMenuItem(Console.message("Display-Stat"), "Options"); - } - - this.upgradeItem = this.addMenuItem(Console.message("Upgrade-Now"), "Options"); - if (var2) { - this.channelItem = this.addMenuItem(Console.message("Dimension-Sel"), "Options"); - } - - this.serverItem = this.addMenuItem(signIn, "Options"); - this.setOnlineState(this.galaxy.getOnlineEnabled(), this.galaxy.getOnline()); - Menu var27; - if (IniFile.gamma().getIniInt("recorderEnabled", 1) == 1) { - var27 = new Menu(Console.message("Recorder")); - this.addMenuItem(var27, "Options"); - this.recorderRecItem = new MenuItem(Console.message("Record")); - var27.add(this.recorderRecItem); - this.recorderStopItem = new MenuItem(Console.message("Stop")); - var27.add(this.recorderStopItem); - this.recorderPlayItem = new MenuItem(Console.message("Play")); - var27.add(this.recorderPlayItem); - } - - if (NetUpdate.isInternalVersion()) { - var27 = new Menu(Console.message("Languages")); - this.addMenuItem(var27, "Options"); - Menu var29 = new Menu(Console.message("Download-Font")); - var27.add(var29); - var29.setFont(mfont); - this.fontItems = new Vector(); - - for(int var30 = 0; var30 < this.fLength; ++var30) { - if (this.flList.elementAt(var30) != null) { - String var12; - if (this.fsList.elementAt(var30) != null) { - this.newfLocale[var30] = new Locale((String)this.flList.elementAt(var30), (String)this.fsList.elementAt(var30)); - var12 = (String)this.flList.elementAt(var30) + "_" + (String)this.fsList.elementAt(var30); - if (var12.equals(Console.message(var12))) { - this.dFonts[var30] = new MenuItem(this.newfLocale[var30].getDisplayName()); - } else { - this.dFonts[var30] = new MenuItem(Console.message(var12)); - } - } else { - var12 = (String)this.flList.elementAt(var30); - if (var12.equals(Console.message(var12))) { - this.dFonts[var30] = new MenuItem((String)this.flList.elementAt(var30)); - } else { - this.dFonts[var30] = new MenuItem(Console.message(var12)); - } - } - - this.dFonts[var30].setFont(mfont); - var29.add(this.dFonts[var30]); - this.fontItems.addElement(this.dFonts[var30]); - } - } - - Menu var31 = new Menu(Console.message("Download-Language")); - var27.add(var31); - var31.setFont(mfont); - this.downItems = new Vector(); - String[] var32 = new String[this.dLength]; - - String var17; - for(int var13 = 0; var13 < this.dLength; ++var13) { - if (this.lList.elementAt(var13) != null) { - this.newdLocale[var13] = new Locale((String)this.lList.elementAt(var13), (String)this.sList.elementAt(var13)); - String var15; - if (var13 > 0) { - Locale var18 = new Locale((String)this.lList.elementAt(var13 - 1), (String)this.sList.elementAt(var13 - 1)); - var15 = var18.getDisplayName(); - } else { - var15 = this.newdLocale[var13].getDisplayName(); - } - - String var16 = this.newdLocale[var13].getDisplayName(); - var16 = var16.substring(0, var16.indexOf(40) - 1); - String var14; - if (var13 < this.dLength - 1) { - Locale var20 = new Locale((String)this.lList.elementAt(var13 + 1), (String)this.sList.elementAt(var13 + 1)); - var17 = var20.getDisplayName(); - var17 = var17.substring(0, var17.indexOf(40) - 1); - if (var17.equals(var16)) { - var14 = this.newdLocale[var13].getDisplayName(); - } else { - var14 = var16; - } - } else if (var13 == this.dLength - 1) { - var15 = var15.substring(0, var15.indexOf(40) - 1); - if (var16.equals(var15)) { - var14 = this.newdLocale[var13].getDisplayName(); - } else { - var14 = var16; - } - } else if (var32[var13 - 1].equals(var16)) { - var14 = this.newdLocale[var13].getDisplayName(); - } else { - var14 = var16; - } - - String var21 = (String)this.lList.elementAt(var13) + "_" + (String)this.sList.elementAt(var13); - if (var21.equals(Console.message(var21))) { - var32[var13] = var14; - } else { - var32[var13] = Console.message(var21); - } - } - } - - Collator var33 = Collator.getInstance(); - sortStrings(var33, var32, this.newdLocale, this.lList, this.sList); - - for(int var34 = 0; var34 < this.dLength; ++var34) { - this.dLangs[var34] = new MenuItem(var32[var34]); - this.dLangs[var34].setFont(mfont); - var31.add(this.dLangs[var34]); - this.downItems.addElement(this.dLangs[var34]); - } - - Menu var37 = new Menu(Console.message("Switch-Language")); - var27.add(var37); - var37.setFont(mfont); - this.langItems = new Vector(); - - int var36; - for(int var35 = 0; var35 < lLength; ++var35) { - var36 = lNames[var35].indexOf(95); - if (var36 < 0) { - lCodes[var35][0] = "en"; - lCodes[var35][1] = "US"; + public String message(String var1, Locale var2) { + Locale.setDefault(var2); + Console.println(var2.getDisplayName()); + + try { + ResourceBundle var3 = ResourceBundle.getBundle("MessagesBundle", var2); + return var3.getString(var1); + } catch (MissingResourceException var4) { + return "NO MESSAGE for " + var1; + } + } + + private void init() { + this.addPart(this.render); + this.addPart(this.chat); + this.addPart(this.inventory); + this.addPart(this.marks); + this.addPart(this.friends); + this.addPart(this.actions); + this.addPart(this.mutes); + this.addPart(this.tars); + this.addPart(this.ad); + this.addPart(this.map); + this.addPart(this.savedAvs); + Panel var1 = new Panel(new FlowLayout(1, 0, 0)); + String var2 = Themer.themer.asset("drive.gif"); + this.addPart(this.driveButton = new ImageButtons(var2, 81, 19, this)); + String var3 = Themer.themer.asset(Console.message("quit.gif")); + this.addPart(this.quitButton = new ImageButtons(var3, 65, 19, this)); + String var4 = Themer.themer.asset(Console.message("explore.gif")); + this.addPart(this.exploreButton = new ImageButtons(var4, 98, 22, this)); + var1.add(this.driveButton); + this.driveButton.setDownUpHandler(new ImageButtonsCallback() { + public Object imageButtonsCallback(Component var1, int var2) { + if (var2 != -1) { + DefaultConsole.this.startDrive(); + } else { + DefaultConsole.this.driveButton.drawDown(); + } + + return this; + } + }); + Panel var5 = new Panel(); + var5.setLayout(new GridLayout(1, 3)); + int var6 = Themer.override().getIniInt("uiBackgroundRed", 49); + int var7 = Themer.override().getIniInt("uiBackgroundGreen", 0); + int var8 = Themer.override().getIniInt("uiBackgroundBlue", 255); + var5.setBackground(new Color(var6, var7, var8)); + var5.add(this.yourName); + var5.add(var1); + var5.add(this.status); + this.chat.line.setBackground(Color.black); + this.chat.line.setForeground(Color.white); + this.chat.line.setFont(font); + InsetPanel var9 = new InsetPanel(new BorderLayout(0, 3), 0, 0, 3, 0); + var9.add("North", var5); + var9.add("Center", this.chat.listen.getComponent()); + var9.add("South", this.chat.line); + this.chat.listen.setBackground(Color.black); + this.chat.listen.setForeground(Color.white); + this.chat.listen.setFont(font); + Panel var10 = new Panel(new BorderLayout()); + new Panel(new BorderLayout()); + Panel var12 = new Panel(new BorderLayout()); + Panel var13 = new Panel(new BorderLayout()); + ColorFiller var14 = new ColorFiller(65, 19); + var14.setBackground(new Color(var6, var7, var8)); + var12.add("West", this.quitButton); + var12.add("East", var14); + var13.add("North", var12); + var13.add("Center", this.ad); + var10.add("West", var13); + this.mapPanel = new Panel(new BorderLayout()); + this.mapPanel.add("Center", this.map); + this.mapPanel.setBackground(Color.black); + var12 = new Panel(new BorderLayout()); + ColorFiller var15 = new ColorFiller(60, 19); + var15.setBackground(new Color(var6, var7, var8)); + var12.add("North", var15); + ColorFiller var16 = new ColorFiller(60, 3); + int var17 = Themer.override().getIniInt("uiBackground2Red", 0); + int var18 = Themer.override().getIniInt("uiBackground2Green", 0); + int var19 = Themer.override().getIniInt("uiBackground2Blue", 0); + var16.setBackground(new Color(var17, var18, var19)); + var12.add("South", var16); + Panel var11 = new Panel(new BorderLayout()); + var11.add("East", this.exploreButton); + var11.add("West", var12); + this.mapPanel.add("North", var11); + var10.add("East", this.mapPanel); + var10.add("Center", var9); + this.bottom = var10; + this.renderCard = new CardLayout(); + this.renderAndUniverse = new Panel(this.renderCard); + this.renderAndUniverse.add("render", this.render); + InsetPanel var20 = new InsetPanel(new BorderLayout(), 3, 3, 0, 0); + var20.add("Center", this.renderAndUniverse); + int var21 = Themer.override().getIniInt("uiBackground3Red", 0); + int var22 = Themer.override().getIniInt("uiBackground3Green", 0); + int var23 = Themer.override().getIniInt("uiBackground3Blue", 0); + var14 = new ColorFiller(97, 1); + var14.setBackground(new Color(var21, var22, var23)); + Panel var24 = new Panel(new QuantizedStackedLayout(var14)); + String var25 = Themer.themer.asset(Console.message("rtpanel.gif")); + this.addPart(this.menuButtons = new ImageButtons(var25, 97, menuButtonHeights, this)); + var24.add(var14); + var24.add(this.menuButtons); + var24.add(this.friends); + var20.add("East", var24); + this.top = var20; + } + + public void relayoutMap() { + this.mapPanel.invalidate(); + this.mapPanel.validate(); + this.mapPanel.doLayout(); + this.mapPanel.repaint(); + } + + public void startDrive() { + this.statusMessage = Console.message("Drag-mouse"); + doDrive = true; + Window.makeJavaReleaseCapture(); + } + + public void setOnlineState(boolean var1, boolean var2) { + synchronized(this) { + if (this.serverItem != null) { + this.serverItem.setEnabled(var1); + if (!var1) { + Galaxy var4 = this.getGalaxy(); + if (var4 != null && !var4.isAnonymous()) { + this.serverItem.setLabel(signingIn); + } else { + this.serverItem.setLabel(noMultiUser); + } + } else if (var2) { + this.serverItem.setLabel(signOut); + } else { + this.serverItem.setLabel(signIn); + } + } + + } + } + + private void handleNametagsItem() { + if (IniFile.gamma().getIniInt("SHOWNAMETAGS", 1) == 0) { + IniFile.gamma().setIniInt("SHOWNAMETAGS", 1); + this.nametagItem.setLabel(hideTags); + } else { + IniFile.gamma().setIniInt("SHOWNAMETAGS", 0); + this.nametagItem.setLabel(showTags); + } + + new OkCancelDialog(getFrame(), (DialogReceiver)null, Console.message("Alert"), (String)null, Console.message("OK"), Console.message("Change-exit"), true); + } + + private void handleGraphicsItem() { + if (IniFile.gamma().getIniInt("UserEnabled3DHardware", 0) == 0) { + IniFile.gamma().setIniInt("UserEnabled3DHardware", 1); + this.graphicsItem.setLabel(disable3D); + } else { + IniFile.gamma().setIniInt("UserEnabled3DHardware", 0); + this.graphicsItem.setLabel(enable3D); + } + + new OkCancelDialog(getFrame(), (DialogReceiver)null, Console.message("Alert"), (String)null, Console.message("OK"), Console.message("Change-exit"), true); + } + + private void handleChatBoxItem() { + if (IniFile.gamma().getIniInt("classicChatBox", 1) == 0) { + IniFile.gamma().setIniInt("classicChatBox", 1); + this.chatBoxItem.setLabel(disableClassicChat); + } else { + IniFile.gamma().setIniInt("classicChatBox", 0); + this.chatBoxItem.setLabel(enableClassicChat); + } + + new OkCancelDialog(getFrame(), (DialogReceiver)null, Console.message("Alert"), (String)null, Console.message("OK"), Console.message("Change-exit"), true); + } + + public AvMenu getAvatarMenu() { + return this.avatarMenu; + } + + public void inventoryChanged() { + super.inventoryChanged(); + if (this.avatarMenu != null) { + this.avatarMenu.buildSpecialGuestMenu(); + } + + } + + public void setMenusWRTVIP() { + if (this.avatarMenu != null) { + this.avatarMenu.setEnabled(this.getVIP()); + this.avatarMenu.customize.setEnabled(this.getVIP()); + } + + if (this.savedAvs != null) { + this.savedAvs.setEnabled(this.getVIP()); + } + + if (this.chatLogMenu != null) { + this.chatLogMenu.setEnabled(this.getVIP()); + } + + if (this.toggleVoiceChatItem != null) { + this.toggleVoiceChatItem.setLabel(this.getVIP() && VoiceChat.voiceChatEnabled ? Console.message("Reject-Voice") : Console.message("Accept-Voice")); + this.toggleVoiceChatItem.setEnabled(this.getVIP() && VoiceChat.voiceChatAvailable()); + } + + if (this.becomeVIPItem != null) { + this.becomeVIPItem.setLabel(vip > 0 ? (vip > 1 ? Console.message("Youre-a-VIP") : Console.message("Become-full-VIP")) : Console.message("Become-VIP")); + } + + if (this.numVisItem != null) { + this.numVisItem.setEnabled(this.getVIP()); + } + + } + + public void addBroadcastMenu() { + if (this.bootSomeone == null) { + if (IniFile.gamma().getIniInt("Broadcast", 0) != 0) { + Menu var1 = new Menu(Console.message("Broadcast")); + var1.add(this.broadcastToRoom = new MenuItem(Console.message("Users"))); + var1.add(this.broadcastToAll = new MenuItem(Console.message("All-users"))); + this.addMenuItem(var1, "Options"); + } + + this.bootSomeone = new MenuItem(Console.message("Boot-user")); + this.addMenuItem(this.bootSomeone, "Options"); + } + + } + + private Menu updateChatLogMenu() { + if (this.chatLogMenu == null) { + this.chatLogMenu = new Menu(Console.message("View-Chat")); + } else { + this.chatLogMenu.removeAll(); + } + + ActionListener var1 = new ActionListener() { + public void actionPerformed(ActionEvent var1) { + (new SendURLAction("file:" + var1.getActionCommand())).startBrowser(); + } + }; + String[] var2 = this.logList(); + MenuItem var3 = null; + + for(int var4 = 0; var4 < var2.length; ++var4) { + int var5 = var2[var4].indexOf(".glog.html"); + if (var5 > 6) { + Object[] var6 = new Object[]{new String(var2[var4].substring(5, var5))}; + var3 = new MenuItem(MessageFormat.format(Console.message("Chat-with"), var6)); } else { - int var39 = lNames[var35].lastIndexOf(46); - if (var39 < 0) { - var39 = 0; - } - - lCodes[var35][0] = lNames[var35].substring(var36 + 1, var36 + 3); - if (var39 > var36 + 4) { - lCodes[var35][1] = lNames[var35].substring(var36 + 4, var39); - } else { - lCodes[var35][1] = lCodes[var35][0].toUpperCase(); - } - } - } - - String[] var38 = new String[lLength]; - - for(var36 = 0; var36 < lLength; ++var36) { - newLocale[var36] = new Locale(lCodes[var36][0], lCodes[var36][1]); - String var40; - if (var36 > 0) { - Locale var42 = new Locale(lCodes[var36 - 1][0], lCodes[var36 - 1][1]); - var40 = var42.getDisplayName(); + if (var5 <= 0) { + continue; + } + + var3 = new MenuItem(Console.message("General-chat")); + } + + var3.setActionCommand(var2[var4]); + var3.addActionListener(var1); + this.chatLogMenu.add(var3); + } + + return this.chatLogMenu; + } + + private String[] logList() { + File var1 = new File("."); + FilenameFilter var2 = new FilenameFilter() { + public boolean accept(File var1, String var2) { + return var2.startsWith("chat.") && var2.endsWith(".glog.html"); + } + }; + return var1.list(var2); + } + + private static String[] lpList() { + File var0 = new File("."); + FilenameFilter var1 = new FilenameFilter() { + public boolean accept(File var1, String var2) { + return var2.startsWith("MessagesBundle") && var2.endsWith(".properties"); + } + }; + String[] var2 = var0.list(var1); + Collator var3 = Collator.getInstance(); + sortStrings(var3, var2); + return var2; + } + + private int dpList(Vector var1, Vector var2, int[] var3) { + String var4 = NetUpdate.getLanguages(URL.make(NetUpdate.getUpgradeServerURL() + "I18N/" + "languages.lst"), var1, var2, var3); + if (var4 != null) { + System.out.println(var4); + return 0; + } else { + return var1.size(); + } + } + + private int fpList(Vector var1, Vector var2, int[] var3) { + String var4 = NetUpdate.getLanguages(URL.make(NetUpdate.getUpgradeServerURL() + "I18N/" + "fonts.lst"), var1, var2, var3); + if (var4 != null) { + System.out.println(var4); + return 0; + } else { + return var1.size(); + } + } + + public static void sortStrings(Collator var0, String[] var1, Locale[] var2, String[][] var3) { + for(int var8 = 0; var8 < var1.length; ++var8) { + for(int var9 = var8 + 1; var9 < var1.length; ++var9) { + if (var0.compare(var1[var8], var1[var9]) > 0) { + String var4 = var1[var8]; + Locale var5 = var2[var8]; + String var6 = var3[var8][0]; + String var7 = var3[var8][1]; + var1[var8] = var1[var9]; + var2[var8] = var2[var9]; + var3[var8][0] = var3[var9][0]; + var3[var8][1] = var3[var9][1]; + var1[var9] = var4; + var2[var9] = var5; + var3[var9][0] = var6; + var3[var9][1] = var7; + } + } + } + + } + + public static void sortStrings(Collator var0, String[] var1, Locale[] var2, Vector var3, Vector var4) { + for(int var9 = 0; var9 < var1.length; ++var9) { + for(int var10 = var9 + 1; var10 < var1.length; ++var10) { + if (var0.compare(var1[var9], var1[var10]) > 0) { + String var5 = var1[var9]; + Locale var6 = var2[var9]; + String var7 = (String)var3.elementAt(var9); + String var8 = (String)var4.elementAt(var9); + var1[var9] = var1[var10]; + var2[var9] = var2[var10]; + var3.setElementAt(var3.elementAt(var10), var9); + var4.setElementAt(var4.elementAt(var10), var9); + var1[var10] = var5; + var2[var10] = var6; + var3.setElementAt(var7, var10); + var4.setElementAt(var8, var10); + } + } + } + + } + + public static void sortStrings(Collator var0, String[] var1) { + for(int var3 = 0; var3 < var1.length; ++var3) { + for(int var4 = var3 + 1; var4 < var1.length; ++var4) { + if (var0.compare(var1[var3], var1[var4]) > 0) { + String var2 = var1[var3]; + var1[var3] = var1[var4]; + var1[var4] = var2; + } + } + } + + } + + public void activate(Container var1) { + super.activate(var1); + var1.setBackground(Color.black); + var1.setForeground(Color.white); + var1.setLayout(new BorderLayout()); + var1.add("Center", this.top); + var1.add("South", this.bottom); + this.chat.line.setBackground(Color.white); + this.chat.line.setForeground(Color.black); + boolean var2 = Gamma.getShaper() != null; + if (var2) { + this.shaperHelpItem = this.addMenuItem(Console.message("using-shaper"), "Help"); + } + + if (NetUpdate.getInfoURL() != null) { + this.helpItem = this.addMenuItem(Console.message("Help-Contents"), "Help"); + this.infoItem = this.addMenuItem(Console.message("Latest-info"), "Help"); + } + + Object[] var3 = new Object[]{new String(Std.getProductName())}; + this.aboutItem = this.addMenuItem(MessageFormat.format(Console.message("About-product"), var3), "Help"); + int var4 = IniFile.gamma().getIniInt("CAM_MODE", 7); + int var5 = IniFile.gamma().getIniInt("CAM_SPEED", 4); + + this.pilot.setOutsideCameraMode(var4, var5); + Menu var6 = new Menu(Console.message("Change-View")); + this.addMenuItem(var6, "View"); + MenuItem var7 = new MenuItem(Console.message("CAMERA-VIEW")); + var7.setFont(mfont); + var6.add(var7); + this.viewItems = new Vector(); + + for(int var8 = 0; var8 < this.viewNames.size(); ++var8) { + DefaultConsole.CameraView var9 = (DefaultConsole.CameraView)this.viewNames.elementAt(var8); + CheckboxMenuItem var10 = new CheckboxMenuItem(" " + Console.message(var9.viewName), var4 == var9.viewID); + if (var4 == var9.viewID) { + this.currentViewItem = var10; + } + + var10.setFont(mfont); + var6.add(var10); + this.viewItems.addElement(var10); + } + + var6.addSeparator(); + MenuItem var25 = new MenuItem(Console.message("CAMERA-SPEED")); + var25.setFont(mfont); + var6.add(var25); + this.camSpeedItems = new Vector(); + + for(int var26 = 0; var26 < this.speedNames.size(); ++var26) { + DefaultConsole.CameraSpeed var28 = (DefaultConsole.CameraSpeed)this.speedNames.elementAt(var26); + CheckboxMenuItem var11 = new CheckboxMenuItem(" " + Console.message(var28.speedName), var28.speedID == var5); + if (var28.speedID == var5) { + this.currentCamSpeedItem = var11; + } + + var11.setFont(mfont); + var6.add(var11); + this.camSpeedItems.addElement(var11); + } + + Menu privacyMenu = new Menu(Console.message("privacy-settings")); + this.addMenuItem(privacyMenu, "Options"); + int whisperP = IniFile.gamma().getIniInt("WhisperPrivacy", 0); + int teleportP = IniFile.gamma().getIniInt("TeleportPrivacy", 0); + int whisperShow = IniFile.modPrivacy().getIniInt("WhisperFeedback", 1); + int teleportShow = IniFile.modPrivacy().getIniInt("TeleportFeedback", 0); + int whisperSend = IniFile.modPrivacy().getIniInt("WhisperResponse", 1); + int teleportSend = IniFile.modPrivacy().getIniInt("TeleportResponse", 0); + + Menu whisperMenu = new Menu(Console.message("whisper-settings")); + MenuItem whMenu = new MenuItem(Console.message("WHISPER-SETTINGS")); + whisperMenu.setFont(mfont); + whisperMenu.add(whMenu); + this.whisperItems = new Vector(); + privacyMenu.add(whisperMenu); + + for(int wi = 0; wi < this.whisperNames.size(); ++wi) { + DefaultConsole.WhisperPrivacy var28 = (DefaultConsole.WhisperPrivacy)this.whisperNames.elementAt(wi); + CheckboxMenuItem var11 = new CheckboxMenuItem(" " + Console.message(var28.whisperName), var28.whisperID == whisperP); + if (var28.whisperID == whisperP) { + this.currentWhisperItem = var11; + } + + var11.setFont(mfont); + whisperMenu.add(var11); + this.whisperItems.addElement(var11); + } + + whisperMenu.addSeparator(); + this.showWhispers = new CheckboxMenuItem(Console.message("reject-menu"), whisperShow == 1); + this.respondWhispers = new CheckboxMenuItem(Console.message("response-menu"), whisperSend == 1); + whisperMenu.add(this.showWhispers); + whisperMenu.add(respondWhispers); + + Menu teleportMenu = new Menu(Console.message("teleport-settings")); + MenuItem tpMenu = new MenuItem(Console.message("TELEPORT-SETTINGS")); + teleportMenu.setFont(mfont); + teleportMenu.add(tpMenu); + this.teleportItems = new Vector(); + privacyMenu.add(teleportMenu); + + for(int ti = 0; ti < this.teleportNames.size(); ++ti) { + DefaultConsole.TeleportPrivacy var28 = (DefaultConsole.TeleportPrivacy)this.teleportNames.elementAt(ti); + CheckboxMenuItem var11 = new CheckboxMenuItem(" " + Console.message(var28.teleportName), var28.teleportID == teleportP); + if (var28.teleportID == teleportP) { + this.currentTeleportItem = var11; + } + + var11.setFont(mfont); + teleportMenu.add(var11); + this.teleportItems.addElement(var11); + } + + teleportMenu.addSeparator(); + this.showTeleports = new CheckboxMenuItem(Console.message("reject-menu"), teleportShow == 1); + this.respondTeleports = new CheckboxMenuItem(Console.message("response-menu"), teleportSend == 1); + teleportMenu.add(this.showTeleports); + teleportMenu.add(respondTeleports); + + + this.becomeVIPItem = this.addMenuItem(vip == 1 ? Console.message("Become-full-VIP") : Console.message("Become-VIP"), "VIP"); + this.addMenuItem(this.avatarMenu = new AvMenu(this, this.lastPilotRequested), "VIP"); + this.addMenuItem(this.savedAvs, "VIP"); + this.addMenuItem(this.avatarMenu.customize, "VIP"); + this.toggleVoiceChatItem = this.addMenuItem(Console.message("Enable-Voice"), "VIP"); + this.toggleVoiceChatItem.setEnabled(false); + this.numVisItem = this.addMenuItem(Console.message("Num-Visible"), "VIP"); + this.chatLogMenu = new Menu("Chat Log"); + if (NetUpdate.isInternalVersion()) { + this.inventoryItem = this.addMenuItem("Check Inventory", "VIP"); + } + + this.setMenusWRTVIP(); + this.proxyServerItem = this.addMenuItem(Console.message("Proxy-Server"), "Options"); + this.checkAccountItem = this.addMenuItem(Console.message("Account-Info"), "Options"); + if (var2) { + this.statisticsItem = this.addMenuItem(Console.message("Display-Stat"), "Options"); + } + + this.upgradeItem = this.addMenuItem(Console.message("Upgrade-Now"), "Options"); + if (var2) { + this.channelItem = this.addMenuItem(Console.message("Dimension-Sel"), "Options"); + } + + this.serverItem = this.addMenuItem(signIn, "Options"); + this.setOnlineState(this.galaxy.getOnlineEnabled(), this.galaxy.getOnline()); + Menu var27; + if (IniFile.gamma().getIniInt("recorderEnabled", 1) == 1) { + var27 = new Menu(Console.message("Recorder")); + this.recorderRecItem = new MenuItem(Console.message("Record")); + var27.add(this.recorderRecItem); + this.recorderStopItem = new MenuItem(Console.message("Stop")); + var27.add(this.recorderStopItem); + this.recorderPlayItem = new MenuItem(Console.message("Play")); + var27.add(this.recorderPlayItem); + } + + if (NetUpdate.isInternalVersion()) { + var27 = new Menu(Console.message("Languages")); + this.addMenuItem(var27, "Options"); + Menu var29 = new Menu(Console.message("Download-Font")); + var27.add(var29); + var29.setFont(mfont); + this.fontItems = new Vector(); + + for(int var30 = 0; var30 < this.fLength; ++var30) { + if (this.flList.elementAt(var30) != null) { + String var12; + if (this.fsList.elementAt(var30) != null) { + this.newfLocale[var30] = new Locale((String)this.flList.elementAt(var30), (String)this.fsList.elementAt(var30)); + var12 = (String)this.flList.elementAt(var30) + "_" + (String)this.fsList.elementAt(var30); + if (var12.equals(Console.message(var12))) { + this.dFonts[var30] = new MenuItem(this.newfLocale[var30].getDisplayName()); + } else { + this.dFonts[var30] = new MenuItem(Console.message(var12)); + } + } else { + var12 = (String)this.flList.elementAt(var30); + if (var12.equals(Console.message(var12))) { + this.dFonts[var30] = new MenuItem((String)this.flList.elementAt(var30)); + } else { + this.dFonts[var30] = new MenuItem(Console.message(var12)); + } + } + + this.dFonts[var30].setFont(mfont); + var29.add(this.dFonts[var30]); + this.fontItems.addElement(this.dFonts[var30]); + } + } + + Menu var31 = new Menu(Console.message("Download-Language")); + var27.add(var31); + var31.setFont(mfont); + this.downItems = new Vector(); + String[] var32 = new String[this.dLength]; + + String var17; + for(int var13 = 0; var13 < this.dLength; ++var13) { + if (this.lList.elementAt(var13) != null) { + this.newdLocale[var13] = new Locale((String)this.lList.elementAt(var13), (String)this.sList.elementAt(var13)); + String var15; + if (var13 > 0) { + Locale var18 = new Locale((String)this.lList.elementAt(var13 - 1), (String)this.sList.elementAt(var13 - 1)); + var15 = var18.getDisplayName(); + } else { + var15 = this.newdLocale[var13].getDisplayName(); + } + + String var16 = this.newdLocale[var13].getDisplayName(); + var16 = var16.substring(0, var16.indexOf(40) - 1); + String var14; + if (var13 < this.dLength - 1) { + Locale var20 = new Locale((String)this.lList.elementAt(var13 + 1), (String)this.sList.elementAt(var13 + 1)); + var17 = var20.getDisplayName(); + var17 = var17.substring(0, var17.indexOf(40) - 1); + if (var17.equals(var16)) { + var14 = this.newdLocale[var13].getDisplayName(); + } else { + var14 = var16; + } + } else if (var13 == this.dLength - 1) { + var15 = var15.substring(0, var15.indexOf(40) - 1); + if (var16.equals(var15)) { + var14 = this.newdLocale[var13].getDisplayName(); + } else { + var14 = var16; + } + } else if (var32[var13 - 1].equals(var16)) { + var14 = this.newdLocale[var13].getDisplayName(); + } else { + var14 = var16; + } + + String var21 = (String)this.lList.elementAt(var13) + "_" + (String)this.sList.elementAt(var13); + if (var21.equals(Console.message(var21))) { + var32[var13] = var14; + } else { + var32[var13] = Console.message(var21); + } + } + } + + Collator var33 = Collator.getInstance(); + sortStrings(var33, var32, this.newdLocale, this.lList, this.sList); + + for(int var34 = 0; var34 < this.dLength; ++var34) { + this.dLangs[var34] = new MenuItem(var32[var34]); + this.dLangs[var34].setFont(mfont); + var31.add(this.dLangs[var34]); + this.downItems.addElement(this.dLangs[var34]); + } + + Menu var37 = new Menu(Console.message("Switch-Language")); + var27.add(var37); + var37.setFont(mfont); + this.langItems = new Vector(); + + int var36; + for(int var35 = 0; var35 < lLength; ++var35) { + var36 = lNames[var35].indexOf(95); + if (var36 < 0) { + lCodes[var35][0] = "en"; + lCodes[var35][1] = "US"; + } else { + int var39 = lNames[var35].lastIndexOf(46); + if (var39 < 0) { + var39 = 0; + } + + lCodes[var35][0] = lNames[var35].substring(var36 + 1, var36 + 3); + if (var39 > var36 + 4) { + lCodes[var35][1] = lNames[var35].substring(var36 + 4, var39); + } else { + lCodes[var35][1] = lCodes[var35][0].toUpperCase(); + } + } + } + + String[] var38 = new String[lLength]; + + for(var36 = 0; var36 < lLength; ++var36) { + newLocale[var36] = new Locale(lCodes[var36][0], lCodes[var36][1]); + String var40; + if (var36 > 0) { + Locale var42 = new Locale(lCodes[var36 - 1][0], lCodes[var36 - 1][1]); + var40 = var42.getDisplayName(); + } else { + var40 = newLocale[var36].getDisplayName(); + } + + String var19 = newLocale[var36].getDisplayName(); + var19 = var19.substring(0, var19.indexOf(40) - 1); + if (var36 < lLength - 1) { + Locale var23 = new Locale(lCodes[var36 + 1][0], lCodes[var36 + 1][1]); + String var41 = var23.getDisplayName(); + var41 = var41.substring(0, var41.indexOf(40) - 1); + if (var41.equals(var19)) { + var17 = newLocale[var36].getDisplayName(); + } else { + var17 = var19; + } + } else if (var36 == lLength - 1) { + var40 = var40.substring(0, var40.indexOf(40) - 1); + if (var19.equals(var40)) { + var17 = newLocale[var36].getDisplayName(); + } else { + var17 = var19; + } + } else if (var38[var36 - 1].equals(var19)) { + var17 = newLocale[var36].getDisplayName(); + } else { + var17 = var19; + } + + String var24 = lCodes[var36][0] + "_" + lCodes[var36][1]; + if (var24.equals(Console.message(var24))) { + var38[var36] = var17; + } else { + var38[var36] = Console.message(var24); + } + } + + sortStrings(var33, var38, newLocale, lCodes); + + for(var36 = 0; var36 < lLength; ++var36) { + lLangs[var36] = new MenuItem(var38[var36]); + lLangs[var36].setFont(mfont); + var37.add(lLangs[var36]); + this.langItems.addElement(lLangs[var36]); + } + + this.currentLang = new MenuItem(Console.message("Current-Language")); + var27.add(this.currentLang); + this.currentLang.setFont(mfont); + } + + if (var2) { + this.condenseItem = this.addMenuItem(Console.message("Condense-Files"), "Options"); + this.expandItem = this.addMenuItem(Console.message("Expand-Files"), "Options"); + this.musicManItem = this.addMenuItem(Console.message("Music-Manager"), "Options"); + this.i18nTest = this.addMenuItem(Console.message("I18N-Test"), "Options"); + } + + this.cdPlayerItem = this.addMenuItem(Console.message("MusicM"), "Options"); + this.volumeItem = this.addMenuItem(Console.message("Volume-control"), "Options"); + if (RenderWare.get3DHardwareAvailable()) { + if (RenderWare.get3DHardwareInUse()) { + this.graphicsItem = this.addMenuItem(disable3D, "Options"); } else { - var40 = newLocale[var36].getDisplayName(); + this.graphicsItem = this.addMenuItem(enable3D, "Options"); } + } - String var19 = newLocale[var36].getDisplayName(); - var19 = var19.substring(0, var19.indexOf(40) - 1); - if (var36 < lLength - 1) { - Locale var23 = new Locale(lCodes[var36 + 1][0], lCodes[var36 + 1][1]); - String var41 = var23.getDisplayName(); - var41 = var41.substring(0, var41.indexOf(40) - 1); - if (var41.equals(var19)) { - var17 = newLocale[var36].getDisplayName(); - } else { - var17 = var19; - } - } else if (var36 == lLength - 1) { - var40 = var40.substring(0, var40.indexOf(40) - 1); - if (var19.equals(var40)) { - var17 = newLocale[var36].getDisplayName(); - } else { - var17 = var19; - } - } else if (var38[var36 - 1].equals(var19)) { - var17 = newLocale[var36].getDisplayName(); + if (IniFile.gamma().getIniInt("SHOWNAMETAGS", 1) == 1) { + this.nametagItem = this.addMenuItem(hideTags, "Options"); + } else { + this.nametagItem = this.addMenuItem(showTags, "Options"); + } + + if (IniFile.gamma().getIniInt("classicChatBox", 1) == 1) { + this.chatBoxItem = this.addMenuItem(disableClassicChat, "Options"); + } else { + this.chatBoxItem = this.addMenuItem(enableClassicChat, "Options"); + } + + if (Gamma.loadProgress != null) { + Gamma.loadProgress.setMessage("Preloading avatars..."); + Gamma.loadProgress.advance(); + } + + this.menuDone(); + getFrame().activate(); + LogFile.mailLogIfPresent(this.getSmtpServer()); + this.render.requestFocus(); + this.setMenusWRTVIP(); + this.bootSomeone = null; + if (this.broadcastEnabled()) { + this.addBroadcastMenu(); + } + + this.universeMode = false; + } + + public void setVIP(boolean var1) { + super.setVIP(var1); + this.setMenusWRTVIP(); + this.setNameStr(); + } + + public void checkCourtesyVIP() { + super.checkCourtesyVIP(); + this.setMenusWRTVIP(); + this.setNameStr(); + } + + public void setNameStr() { + String var1 = this.galaxy.getUsernameU(); + boolean var2 = this.galaxy.getOnline(); + if (!var2) { + this.yourName.setText(Console.message("Off-line")); + } else { + if (var1.length() > 0) { + if (var1.regionMatches(true, 0, "VIP ", 0, 4)) { + var1 = var1.substring(4); + } + + if (vip > 0) { + if (vip > 1) { + var1 = Console.message("VIP") + " " + var1; + } else { + var1 = Console.message("vip") + " " + var1; + } + } + + IniFile.gamma().setIniString("LASTCHATNAME", parseExtended(var1)); + this.yourName.setText(Console.parseUnicode(var1)); + } + + } + } + + public void enableBroadcast(boolean var1) { + super.enableBroadcast(var1); + if (var1) { + this.addBroadcastMenu(); + } + + } + + public void deactivate() { + super.deactivate(); + this.universeMode = false; + } + + protected void setSleepMode(String var1) { + super.setSleepMode(var1); + if (var1 != null && var1.equals(Console.message("asleep"))) { + this.statusMessage = sleepStatus; + } else if (this.statusMessage == sleepStatus) { + this.statusMessage = ""; + } + + } + + private void relogin() { + if (this.serverItem.getLabel().equals(signOut)) { + this.reloginDialog = new OkCancelDialog(getFrame(), this, Console.message("Re-login"), Console.message("Cancel"), Console.message("OK"), Console.message("auto-sign-out"), true); + } + + } + + public void toggleWhisperRejects() { + int mainVal = IniFile.modPrivacy().getIniInt("WhisperFeedback", 1); + boolean newVal = mainVal == 1; + IniFile.modPrivacy().setIniInt("WhisperFeedback", newVal ? 0 : 1); + this.showWhispers.setState(!newVal); + } + + public void toggleWhisperResponse() { + int mainVal = IniFile.modPrivacy().getIniInt("WhisperResponse", 1); + boolean newVal = mainVal == 1; + IniFile.modPrivacy().setIniInt("WhisperResponse", newVal ? 0 : 1); + this.respondWhispers.setState(!newVal); + } + + public void toggleTeleportRejects() { + int mainVal = IniFile.modPrivacy().getIniInt("TeleportFeedback", 1); + boolean newVal = mainVal == 1; + IniFile.modPrivacy().setIniInt("TeleportFeedback", newVal ? 0 : 1); + this.showTeleports.setState(!newVal); + } + + public void toggleTeleportResponse() { + int mainVal = IniFile.modPrivacy().getIniInt("TeleportResponse", 0); + boolean newVal = mainVal == 1; + IniFile.modPrivacy().setIniInt("TeleportResponse", mainVal == 1 ? 0 : 1); + this.respondTeleports.setState(!newVal); + } + + public boolean action(Event var1, Object var2) { + if (var1.target == this.aboutItem) { + new AboutDialog(Std.getProductName(), getFrame()); + } else if (var1.target == this.statisticsItem && this.statisticsItem != null) { + new StatisticsWindow(getFrame()); + } else if (this.viewItems.contains(var1.target)) { + this.changeView((CheckboxMenuItem)var1.target); + } else if (this.camSpeedItems.contains(var1.target)) { + this.changeCamSpeed((CheckboxMenuItem)var1.target); + } else if (this.whisperItems.contains(var1.target)) { + this.changeWhispers((CheckboxMenuItem)var1.target); + } else if (this.teleportItems.contains(var1.target)) { + this.changeTeleport((CheckboxMenuItem)var1.target); + } else if (var1.target == this.showWhispers) { + toggleWhisperRejects(); + } else if (var1.target == this.respondWhispers) { + toggleWhisperResponse(); + } else if (var1.target == this.showTeleports) { + toggleTeleportRejects(); + } else if (var1.target == this.respondTeleports) { + toggleTeleportResponse(); + } else if (var1.target == this.gettingStartedItem) { + (new SendURLAction(this.getHelpGettingStarted())).startBrowser(); + } else { + String var4; + String var15; + if (var1.target == this.shaperHelpItem) { + var15 = IniFile.override().getIniString("ShaperHelp", this.getScriptServer() + "shaperhelp.pl") + "?u="; + var4 = IniFile.gamma().getIniString("lastchatname", ""); + if (!var4.equals("")) { + if (var4.startsWith("VIP ")) { + var4 = var4.substring(4); + } + + var15 = var15 + var4; + } + + (new SendURLAction(WebControlImp.processURL(var15))).startBrowser(); + } else if (var1.target == this.helpItem) { + var15 = NetUpdate.getUpgradeServerURL(); + var4 = IniFile.override().getIniString("HelpDirectory", "help"); + String var18 = IniFile.override().getIniString("HelpPage", Std.getVersion() + Console.message(".html")); + if (wasHttpNoSuchFile(var15 + var4 + "/" + var18)) { + var18 = IniFile.override().getIniString("HelpPage", Std.getVersion() + ".html"); + } + + (new SendURLAction(var15 + var4 + "/" + var18)).startBrowser(); + } else if (var1.target == this.infoItem) { + var15 = IniFile.override().getIniString("infoOverride", ""); + if (var15.equals("")) { + NetUpdate.showInfo(); + } else { + (new SendURLAction(var15)).startBrowser(); + } + } else if (var1.target == this.i18nTest) { + Locale var23 = Locale.getDefault(); + Console.println("Default = " + var23.getDisplayName()); + DateFormat var24 = DateFormat.getDateTimeInstance(1, 1); + Date var17 = new Date(); + Console.println("Today = " + var24.format(var17)); + Locale[] var19 = DateFormat.getAvailableLocales(); + Console.println("Avaliable Locales are:"); + + for(int var7 = 0; var7 < var19.length; ++var7) { + Locale.setDefault(var19[var7]); + Console.println(var19[var7].getDisplayName() + " " + var19[var7]); + } + + new Locale("en", "US"); + Locale var8 = new Locale("fr", "FR"); + Locale var9 = new Locale("de", "DE"); + Locale var10 = new Locale("ja", "JP"); + Locale var11 = new Locale("zh", "CN"); + Locale var12 = new Locale("th", "TH"); + Locale var13 = new Locale("ru", "RU"); + Locale var14 = new Locale("iw", "IL"); + Console.println("file.encoding = " + System.getProperty("file.encoding")); + Console.println(this.message("test-language", var8)); + Console.println(this.message("test-language", var9)); + Console.println(this.message("test-language", var10)); + Console.println(this.message("test-language", var11)); + Console.println(this.message("test-language", var12)); + Console.println(this.message("test-language", var13)); + Console.println(this.message("test-language", var14)); + Console.println(this.message("test-language", var23)); + } else if (var1.target == this.checkAccountItem) { + var15 = IniFile.override().getIniString("accountOverride", ""); + if (var15.equals("")) { + var4 = IniFile.override().getIniString("accountInfoPage", "account" + Console.message(".pl")); + if (wasHttpNoSuchFile(this.getScriptServer() + var4)) { + var4 = IniFile.override().getIniString("accountInfoPage", "account.pl"); + } + + (new SendURLAction(this.getScriptServer() + var4, true)).startBrowser(); + } else { + (new SendURLAction(var15)).startBrowser(); + } + + this.relogin(); + } else if (var1.target == this.upgradeItem) { + NetUpdate.doUpdate(true); + } else if (var1.target == this.channelItem && this.channelItem != null) { + Galaxy var22 = this.getGalaxy(); + var4 = ""; + Debug.dAssert(var22 != null); + if (var22 != null) { + var4 = var22.getChannel(); + } + + new ChannelDialog(getFrame(), this, Console.message("Dimension-Sel"), var4); + } else if (var1.target == this.becomeVIPItem) { + var15 = IniFile.override().getIniString("vipOverride", ""); + if (var15.equals("")) { + var4 = IniFile.override().getIniString("vipPage", "vip" + Console.message(".pl")); + if (wasHttpNoSuchFile(this.getScriptServer() + var4)) { + var4 = IniFile.override().getIniString("vipPage", "vip.pl"); + } + + (new SendURLAction(this.getScriptServer() + var4, true)).startBrowser(); + } else { + (new SendURLAction(var15, false)).startBrowser(); + } + + this.relogin(); + } else if (var1.target == this.numVisItem) { + new SetNumVisibleAvs(); + } else if (var1.target == this.inventoryItem) { + EquipAction var21 = new EquipAction(); + var21.trigger((NET.worlds.scape.Event)null, (Persister)null); + } else if (var1.target == this.proxyServerItem) { + System.out.println("Triggering the Proxy Server dialog."); + ProxyServerDialog var20 = new ProxyServerDialog(); + var20.show(); + } else if (var1.target == this.toggleVoiceChatItem) { + VoiceChat.setVoiceChatEnabled(!VoiceChat.voiceChatEnabled); + this.setMenusWRTVIP(); + } else if (var1.target == this.serverItem) { + this.handleServerItem(); + } else if (var1.target == this.condenseItem) { + new ArchiveMaker(true); + } else if (var1.target == this.expandItem) { + new ArchiveMaker(false); + } else if (var1.target == this.musicManItem) { + MusicManager.showDialog(); + } else if (var1.target == this.cdPlayerItem) { + if (this.cdcontrol == null) { + this.playedCD = true; + this.cdcontrol = new CDControl(getFrame(), this); + } + } else if (var1.target == this.volumeItem) { + if (!CDPlayerAction.launchVolumeControlApp()) { + new OkCancelDialog(getFrame(), (DialogReceiver)null, Console.message("No-Volume"), (String)null, Console.message("OK"), Console.message("Cannot-locate"), true); + } + } else if (var1.target == this.graphicsItem) { + this.handleGraphicsItem(); + } else if (var1.target == this.nametagItem) { + this.handleNametagsItem(); + } else if (var1.target == this.chatBoxItem) { + this.handleChatBoxItem(); + } else if (var1.target == this.bootSomeone) { + new BootDialog(getFrame(), this, Console.message("Boot-user")); + } else if (var1.target == this.broadcastToRoom) { + startWhispering("room"); + } else if (var1.target == this.broadcastToAll) { + startWhispering("world"); + } else if (var1.target == this.currentLang) { + var15 = Locale.getDefault().toString(); + if (var15 == Console.message(var15)) { + Console.println(Console.message("Current-Language") + " = " + Locale.getDefault().getDisplayName()); + } else { + Console.println(Console.message("Current-Language") + " = " + Console.message(var15)); + } + } else if (var1.target == this.recorderPlayItem) { + println(Console.message("BlackBoxPlay")); + BlackBox.getInstance().play(); + } else if (var1.target == this.recorderRecItem) { + println(Console.message("BlackBoxRec")); + BlackBox.getInstance().record(); + } else if (var1.target == this.recorderStopItem) { + println(Console.message("BlackBoxStop")); + BlackBox.getInstance().stop(); } else { - var17 = var19; - } - - String var24 = lCodes[var36][0] + "_" + lCodes[var36][1]; - if (var24.equals(Console.message(var24))) { - var38[var36] = var17; + int var5; + String var6; + int var16; + if (this.fontItems != null && this.fontItems.contains(var1.target)) { + var15 = IniFile.gamma().getIniString("upgradeServer", "") + "/I18N/font_"; + + for(var16 = 0; var16 < this.fLength; ++var16) { + if (var1.target == this.fontItems.elementAt(var16)) { + if (this.fsList.elementAt(var16) != null) { + var15 = var15 + this.flList.elementAt(var16) + "_" + this.fsList.elementAt(var16) + ".EXE"; + } else { + var15 = var15 + this.flList.elementAt(var16) + ".EXE"; + } + + var5 = this.fSizes[var16]; + var6 = var15.substring(var15.lastIndexOf(47) + 1, var15.length()); + LanguageManager.handle(var15, var5, var6); + break; + } + } + } else if (this.downItems != null && this.downItems.contains(var1.target)) { + var15 = IniFile.gamma().getIniString("upgradeServer", "") + "/I18N/language_"; + + for(var16 = 0; var16 < this.dLength; ++var16) { + if (var1.target == this.downItems.elementAt(var16)) { + if (this.sList.elementAt(var16) != null) { + var15 = var15 + this.lList.elementAt(var16) + "_" + this.sList.elementAt(var16) + ".zip"; + IniFile.gamma().setIniString("DEFAULTLANGUAGE", (String)this.lList.elementAt(var16) + "_" + this.sList.elementAt(var16)); + } else { + var15 = var15 + this.lList.elementAt(var16) + ".zip"; + IniFile.gamma().setIniString("DEFAULTLANGUAGE", (String)this.lList.elementAt(var16)); + } + + var5 = this.lSizes[var16]; + var6 = var15.substring(var15.lastIndexOf(47) + 1, var15.length()); + LanguageManager.handle(var15, var5, var6); + break; + } + } + } else if (this.langItems != null && this.langItems.contains(var1.target)) { + for(int var3 = 0; var3 < lLength; ++var3) { + if (var1.target == this.langItems.elementAt(var3)) { + Locale.setDefault(newLocale[var3]); + var4 = newLocale[var3].toString(); + if (var4 == Console.message(var4)) { + Console.println(message("Setting-to") + " " + newLocale[var3].getDisplayName()); + } else { + Console.println(message("Setting-to") + " " + Console.message(var4)); + } + + IniFile.gamma().setIniString("DEFAULTLANGUAGE", lCodes[var3][0] + "_" + lCodes[var3][1]); + new OkCancelDialog(getFrame(), (DialogReceiver)null, Console.message("Alert"), (String)null, Console.message("OK"), Console.message("Change-exit"), true); + break; + } + } + } else if (this.avatarMenu == null || !this.avatarMenu.action(var1, var2)) { + return super.action(var1, var2); + } + } + } + + return true; + } + + public void setCurrentAvatarItem(CheckboxMenuItem var1) { + if (this.curAvatarItem != null) { + this.curAvatarItem.setState(false); + } + + this.curAvatarItem = var1; + if (this.curAvatarItem != null) { + this.curAvatarItem.setState(true); + } + + } + + public CheckboxMenuItem getCurrentAvatarItem() { + return this.curAvatarItem; + } + + public void deletedSavedAvatar(CheckboxMenuItem var1) { + if (this.curAvatarItem == var1) { + this.findAvatarMenuItem(this.getDefaultAvatarURL()); + } + + } + + public void setNextAvatar(URL var1, CheckboxMenuItem var2) { + synchronized(this.nextAvatarMutex) { + this.nextAvatar = var1; + this.nextAvatarItem = var2; + } + } + + private void findAvatarMenuItem(URL var1) { + synchronized(this.nextAvatarMutex) { + if (this.nextAvatarItem == null) { + Object var3; + if ((this.savedAvs == null || (var3 = this.savedAvs.findMenuItem(var1)) == null) && (this.avatarMenu == null || (var3 = this.avatarMenu.findMenuItem(var1)) == null)) { + this.setCurrentAvatarItem((CheckboxMenuItem)null); + } else { + this.setCurrentAvatarItem((CheckboxMenuItem)var3); + } + } + + } + } + + private URL getHelpGettingStarted() { + IniFile var1 = new IniFile("InstalledWorlds"); + String var2 = Console.message("Getting-started"); + String var3 = var1.getIniString("InstalledWorld0", ""); + if (!var3.equals("")) { + URL var4 = URL.make("home:" + var3 + "/" + var2); + File var5 = new File(var4.unalias()); + if (var5.exists()) { + return var4; + } + } + + return URL.make("home:" + var2); + } + + private void changeView(CheckboxMenuItem var1) { + this.chooseView = this.viewItems.indexOf(var1); + if (var1 != this.currentViewItem) { + this.currentViewItem.setState(false); + this.currentViewItem = var1; + this.currentViewItem.setState(true); + } + + } + + private int getView() { + return this.viewItems.indexOf(this.currentViewItem); + } + + private void setView(int var1) { + this.changeView((CheckboxMenuItem)this.viewItems.elementAt(var1)); + } + + private void changeCamSpeed(CheckboxMenuItem var1) { + this.chooseCamSpeed = this.camSpeedItems.indexOf(var1); + if (var1 != this.currentCamSpeedItem) { + this.currentCamSpeedItem.setState(false); + this.currentCamSpeedItem = var1; + this.currentCamSpeedItem.setState(true); + } + + } + + private void changeWhispers(CheckboxMenuItem var1) { + this.chooseWhisper = this.whisperItems.indexOf(var1); + if (var1 != this.currentWhisperItem) { + this.currentWhisperItem.setState(false); + this.currentWhisperItem = var1; + this.currentWhisperItem.setState(true); + } + } + + private void changeTeleport(CheckboxMenuItem var1) { + this.chooseTeleport = this.teleportItems.indexOf(var1); + if (var1 != this.currentTeleportItem) { + this.currentTeleportItem.setState(false); + this.currentTeleportItem = var1; + this.currentTeleportItem.setState(true); + } + } + + public void resetCamera() { + if (this.viewItems != null && this.camSpeedItems != null) { + this.chooseView = this.viewItems.indexOf(this.currentViewItem); + this.chooseCamSpeed = this.camSpeedItems.indexOf(this.currentCamSpeedItem); + } + } + + private void handleServerItem() { + if (!this.serverItem.getLabel().equals(signIn)) { + Galaxy.forceOffline(false); + } else { + this.getGalaxy().localForceOnline(); + this.getGalaxy().waitForConnection(this); + } + + } + + public UniversePanel getUniverse() { + return this.universeMode ? this.universe : null; + } + + public synchronized void setUniverseMode(boolean var1) { + if (var1 != this.universeMode) { + this.universeMode = var1; + if (this.universeMode) { + if (this.universe == null) { + this.universe = new UniversePanel(this); + this.renderAndUniverse.add("universe", this.universe); + } + + this.renderCard.show(this.renderAndUniverse, "universe"); + this.universe.startWatch(); + this.render.requestFocus(); } else { - var38[var36] = Console.message(var24); - } - } - - sortStrings(var33, var38, newLocale, lCodes); - - for(var36 = 0; var36 < lLength; ++var36) { - lLangs[var36] = new MenuItem(var38[var36]); - lLangs[var36].setFont(mfont); - var37.add(lLangs[var36]); - this.langItems.addElement(lLangs[var36]); - } - - this.currentLang = new MenuItem(Console.message("Current-Language")); - var27.add(this.currentLang); - this.currentLang.setFont(mfont); - } - - if (var2) { - this.condenseItem = this.addMenuItem(Console.message("Condense-Files"), "Options"); - this.expandItem = this.addMenuItem(Console.message("Expand-Files"), "Options"); - this.musicManItem = this.addMenuItem(Console.message("Music-Manager"), "Options"); - this.i18nTest = this.addMenuItem(Console.message("I18N-Test"), "Options"); - } - - this.cdPlayerItem = this.addMenuItem(Console.message("MusicM"), "Options"); - this.volumeItem = this.addMenuItem(Console.message("Volume-control"), "Options"); - if (RenderWare.get3DHardwareAvailable()) { - if (RenderWare.get3DHardwareInUse()) { - this.graphicsItem = this.addMenuItem(disable3D, "Options"); - } else { - this.graphicsItem = this.addMenuItem(enable3D, "Options"); - } - } - - if (IniFile.gamma().getIniInt("SHOWNAMETAGS", 1) == 1) { - this.nametagItem = this.addMenuItem(hideTags, "Options"); - } else { - this.nametagItem = this.addMenuItem(showTags, "Options"); - } - - if (IniFile.gamma().getIniInt("classicChatBox", 1) == 1) { - this.chatBoxItem = this.addMenuItem(disableClassicChat, "Options"); - } else { - this.chatBoxItem = this.addMenuItem(enableClassicChat, "Options"); - } - - if (Gamma.loadProgress != null) { - Gamma.loadProgress.setMessage("Preloading avatars..."); - Gamma.loadProgress.advance(); - } - - this.menuDone(); - getFrame().activate(); - LogFile.mailLogIfPresent(this.getSmtpServer()); - this.render.requestFocus(); - this.setMenusWRTVIP(); - this.bootSomeone = null; - if (this.broadcastEnabled()) { - this.addBroadcastMenu(); - } - - this.universeMode = false; - } - - public void setVIP(boolean var1) { - super.setVIP(var1); - this.setMenusWRTVIP(); - this.setNameStr(); - } - - public void checkCourtesyVIP() { - super.checkCourtesyVIP(); - this.setMenusWRTVIP(); - this.setNameStr(); - } - - public void setNameStr() { - String var1 = this.galaxy.getUsernameU(); - boolean var2 = this.galaxy.getOnline(); - if (!var2) { - this.yourName.setText(Console.message("Off-line")); - } else { - if (var1.length() > 0) { - if (var1.regionMatches(true, 0, "VIP ", 0, 4)) { - var1 = var1.substring(4); - } - - if (vip > 0) { - if (vip > 1) { - var1 = Console.message("VIP") + " " + var1; - } else { - var1 = Console.message("vip") + " " + var1; - } - } - - IniFile.gamma().setIniString("LASTCHATNAME", parseExtended(var1)); - this.yourName.setText(Console.parseUnicode(var1)); - } - - } - } - - public void enableBroadcast(boolean var1) { - super.enableBroadcast(var1); - if (var1) { - this.addBroadcastMenu(); - } - - } - - public void deactivate() { - super.deactivate(); - this.universeMode = false; - } - - protected void setSleepMode(String var1) { - super.setSleepMode(var1); - if (var1 != null && var1.equals(Console.message("asleep"))) { - this.statusMessage = sleepStatus; - } else if (this.statusMessage == sleepStatus) { - this.statusMessage = ""; - } - - } - - private void relogin() { - if (this.serverItem.getLabel().equals(signOut)) { - this.reloginDialog = new OkCancelDialog(getFrame(), this, Console.message("Re-login"), Console.message("Cancel"), Console.message("OK"), Console.message("auto-sign-out"), true); - } - - } - - public boolean action(Event var1, Object var2) { - if (var1.target == this.aboutItem) { - new AboutDialog(Std.getProductName(), getFrame()); - } else if (var1.target == this.statisticsItem && this.statisticsItem != null) { - new StatisticsWindow(getFrame()); - } else if (this.viewItems.contains(var1.target)) { - this.changeView((CheckboxMenuItem)var1.target); - } else if (this.camSpeedItems.contains(var1.target)) { - this.changeCamSpeed((CheckboxMenuItem)var1.target); - } else if (var1.target == this.gettingStartedItem) { - (new SendURLAction(this.getHelpGettingStarted())).startBrowser(); - } else { - String var4; - String var15; - if (var1.target == this.shaperHelpItem) { - var15 = IniFile.override().getIniString("ShaperHelp", this.getScriptServer() + "shaperhelp.pl") + "?u="; - var4 = IniFile.gamma().getIniString("lastchatname", ""); - if (!var4.equals("")) { - if (var4.startsWith("VIP ")) { - var4 = var4.substring(4); - } - - var15 = var15 + var4; - } - - (new SendURLAction(WebControlImp.processURL(var15))).startBrowser(); - } else if (var1.target == this.helpItem) { - var15 = NetUpdate.getUpgradeServerURL(); - var4 = IniFile.override().getIniString("HelpDirectory", "help"); - String var18 = IniFile.override().getIniString("HelpPage", Std.getVersion() + Console.message(".html")); - if (wasHttpNoSuchFile(var15 + var4 + "/" + var18)) { - var18 = IniFile.override().getIniString("HelpPage", Std.getVersion() + ".html"); - } - - (new SendURLAction(var15 + var4 + "/" + var18)).startBrowser(); - } else if (var1.target == this.infoItem) { - var15 = IniFile.override().getIniString("infoOverride", ""); - if (var15.equals("")) { - NetUpdate.showInfo(); + this.renderCard.show(this.renderAndUniverse, "render"); + if (physMem < 64000000) { + this.renderAndUniverse.remove(this.universe); + this.universe.stopWatch(); + this.universe.flushImage(); + this.universe = null; + } + + this.renderAndUniverse.repaint(); + } + + } + } + + public void toggleUniverseMode() { + this.setUniverseMode(!this.universeMode); + } + + public boolean isUniverseMode() { + return this.universeMode; + } + + public Object imageButtonsCallback(Component var1, int var2) { + if (var1 != this.driveButton) { + if (var1 == this.quitButton) { + maybeQuit(); + } else if (var1 == this.exploreButton) { + this.toggleUniverseMode(); + } else if (var1 == this.menuButtons) { + switch(var2) { + case 0: + return this.getMenu("Help"); + case 1: + return this.getMenu("Options"); + case 2: + String var3 = IniFile.override().getIniString("ProductName", ""); + if (!var3.equalsIgnoreCase("RedLightWorld")) { + EMailPart.showMessage(this); + } + break; + case 3: + return (PopupMenu)this.marks.getMenu(); + case 4: + return (PopupMenu)this.marks.getLetsMenu(); + case 5: + this.actions.present(); + break; + case 6: + return this.getMenu("VIP"); + } + } + } + + return null; + } + + public RenderCanvas getRender() { + return this.render; + } + + public FriendsListPart getFriends() { + return this.friends; + } + + public MuteListPart getMutes() { + return this.mutes; + } + + public TarListPart getTars() { + return this.tars; + } + + public void generateFrameEvents(FrameEvent var1) { + if (Window.getWindowState(Window.getFrameHandle()) == 1) { + this.goToSleep(); + } + + if (doDrive) { + doDrive = false; + this.render.drive(); + wasDelta = true; + } + + super.generateFrameEvents(var1); + Pilot var2 = Pilot.getActive(); + GammaFrame var3 = getFrame(); + String var4 = var3.getTitle(); + String var5 = ""; + if (var2 != null) { + World var6 = var2.getWorld(); + if (var6 != null) { + String var7 = var6.getName(); + if (var7 != null) { + var5 = var7; + } + } + } + + if (!lastWorldName.equals(var5)) { + lastWorldName = var5; + String var14 = GammaFrame.getDefaultTitle(); + if (var5.length() != 0) { + var14 = var14 + " - " + var5; + if (!this.playedCD) { + CDAudio.startupPlay(); + this.playedCD = true; + } + } + + var3.setTitle(var14); + } + + if (var2 != null) { + if (this.chooseView != -1 || this.chooseCamSpeed != -1) { + int var15 = var2.getOutsideCameraMode(); + int var16 = var2.getOutsideCameraSpeed(); + int var8 = var15; + int var9 = var16; + if (this.chooseView != -1) { + var8 = ((DefaultConsole.CameraView)this.viewNames.elementAt(this.chooseView)).viewID; + } + + if (this.chooseCamSpeed != -1) { + var9 = ((DefaultConsole.CameraSpeed)this.speedNames.elementAt(this.chooseCamSpeed)).speedID; + } + + var2.setOutsideCameraMode(var8, var9); + if (var8 != 99) { + IniFile.gamma().setIniInt("CAM_MODE", var8); + IniFile.gamma().setIniInt("CAM_SPEED", var9); + } + + this.chooseView = -1; + this.chooseCamSpeed = -1; + } + + if (this.wasTeleporting != this.marks.isTeleporting()) { + this.wasTeleporting = this.marks.isTeleporting(); + if (this.wasTeleporting) { + this.statusMessage = loadingString; + } else if (this.statusMessage == loadingString) { + this.statusMessage = ""; + } + } + + this.checkVMWarning(); + if (wasDelta && !this.render.getDeltaMode()) { + this.statusMessage = arrowKeyMsg; + wasDelta = false; + this.driveButton.drawCursed(); + } + + if (this.chooseWhisper != -1 || this.chooseTeleport != -1) { + + int whisperValue = IniFile.gamma().getIniInt("WhisperPrivacy", 0); + int teleportValue = IniFile.gamma().getIniInt("TeleportPrivacy", 0); + + if (this.chooseWhisper != -1) { + whisperValue = ((WhisperPrivacy) this.whisperNames.elementAt(chooseWhisper)).whisperID; + } + + if (this.chooseTeleport != -1) { + teleportValue = ((TeleportPrivacy) this.teleportNames.elementAt(chooseTeleport)).teleportID; + } + + IniFile.gamma().setIniInt("WhisperPrivacy", whisperValue); + IniFile.gamma().setIniInt("TeleportPrivacy", teleportValue); + + this.chooseWhisper = -1; + this.chooseTeleport = -1; + } + + synchronized(this.status) { + if (this.statusMessage != this.lastStatus && this.overrideMessage == null) { + this.lastStatus = this.statusMessage; + this.status.setText(this.statusMessage); + } + } + + synchronized(this.nextAvatarMutex) { + if (this.nextAvatar != null) { + this.setAvatar(this.nextAvatar); + this.nextAvatar = null; + if (this.avatarMenu != null) { + this.avatarMenu.notifyOfChange(); + } + + if (this.nextAvatarItem != null) { + this.setCurrentAvatarItem(this.nextAvatarItem); + this.nextAvatarItem = null; + } + } + + } + } + } + + private void checkVMWarning() { + int var1 = Std.getFastTime(); + if (var1 > this.lastVMCheck + 10000) { + StatMemNode var2 = StatMemNode.getNode(); + var2.updateMemoryStatus(); + if (var2._availPageMem < 0) { + var2._availPageMem = 2000000000; + } + + if (var2._totPhysMem < 0) { + var2._totPhysMem = 2000000000; + } + + physMem = var2._totPhysMem; + if (var2._availPageMem >= 4194304) { + if (var2._availPageMem > 5242880 && this.lastVMBigWarning != 0) { + if (var2._availPageMem > 10485760) { + Console.println(Console.message("plenty-virt")); + this.lastVMBigWarning = 0; + } else if (!this.showedMidWarn) { + Console.println(Console.message("plenty-virt-mem")); + this.showedMidWarn = true; + } + + if (this.statusMessage == lowVMMsg) { + this.statusMessage = ""; + } + } } else { - (new SendURLAction(var15)).startBrowser(); - } - } else if (var1.target == this.i18nTest) { - Locale var23 = Locale.getDefault(); - Console.println("Default = " + var23.getDisplayName()); - DateFormat var24 = DateFormat.getDateTimeInstance(1, 1); - Date var17 = new Date(); - Console.println("Today = " + var24.format(var17)); - Locale[] var19 = DateFormat.getAvailableLocales(); - Console.println("Avaliable Locales are:"); - - for(int var7 = 0; var7 < var19.length; ++var7) { - Locale.setDefault(var19[var7]); - Console.println(var19[var7].getDisplayName() + " " + var19[var7]); - } - - new Locale("en", "US"); - Locale var8 = new Locale("fr", "FR"); - Locale var9 = new Locale("de", "DE"); - Locale var10 = new Locale("ja", "JP"); - Locale var11 = new Locale("zh", "CN"); - Locale var12 = new Locale("th", "TH"); - Locale var13 = new Locale("ru", "RU"); - Locale var14 = new Locale("iw", "IL"); - Console.println("file.encoding = " + System.getProperty("file.encoding")); - Console.println(this.message("test-language", var8)); - Console.println(this.message("test-language", var9)); - Console.println(this.message("test-language", var10)); - Console.println(this.message("test-language", var11)); - Console.println(this.message("test-language", var12)); - Console.println(this.message("test-language", var13)); - Console.println(this.message("test-language", var14)); - Console.println(this.message("test-language", var23)); - } else if (var1.target == this.checkAccountItem) { - var15 = IniFile.override().getIniString("accountOverride", ""); - if (var15.equals("")) { - var4 = IniFile.override().getIniString("accountInfoPage", "account" + Console.message(".pl")); - if (wasHttpNoSuchFile(this.getScriptServer() + var4)) { - var4 = IniFile.override().getIniString("accountInfoPage", "account.pl"); - } + if (this.lastVMBigWarning == 0 || this.showedMidWarn || var1 > this.lastVMBigWarning + 300000) { + Console.println(Console.message("Low-virt-mem")); + this.lastVMBigWarning = var1; + this.showedMidWarn = false; + } - (new SendURLAction(this.getScriptServer() + var4, true)).startBrowser(); - } else { - (new SendURLAction(var15)).startBrowser(); + this.statusMessage = lowVMMsg; } - this.relogin(); - } else if (var1.target == this.upgradeItem) { - NetUpdate.doUpdate(true); - } else if (var1.target == this.channelItem && this.channelItem != null) { - Galaxy var22 = this.getGalaxy(); - var4 = ""; - Debug.dAssert(var22 != null); - if (var22 != null) { - var4 = var22.getChannel(); - } - - new ChannelDialog(getFrame(), this, Console.message("Dimension-Sel"), var4); - } else if (var1.target == this.becomeVIPItem) { - var15 = IniFile.override().getIniString("vipOverride", ""); - if (var15.equals("")) { - var4 = IniFile.override().getIniString("vipPage", "vip" + Console.message(".pl")); - if (wasHttpNoSuchFile(this.getScriptServer() + var4)) { - var4 = IniFile.override().getIniString("vipPage", "vip.pl"); - } + Object[] var3 = new Object[]{new String(Std.getProductName()), new Integer(24)}; + if (startupMemCheck) { + if (var2._totPhysMem < 24000000) { + String var4 = MessageFormat.format(Console.message("Mem-detected"), var3); + new OkCancelDialog(getFrame(), (DialogReceiver)null, Console.message("Too-Little-RAM"), (String)null, Console.message("OK"), var4, true); + } - (new SendURLAction(this.getScriptServer() + var4, true)).startBrowser(); - } else { - (new SendURLAction(var15, false)).startBrowser(); + startupMemCheck = false; + System.out.println("System has " + var2._totPhysMem + " bytes of physical RAM"); } - this.relogin(); - } else if (var1.target == this.numVisItem) { - new SetNumVisibleAvs(); - } else if (var1.target == this.inventoryItem) { - EquipAction var21 = new EquipAction(); - var21.trigger((NET.worlds.scape.Event)null, (Persister)null); - } else if (var1.target == this.proxyServerItem) { - System.out.println("Triggering the Proxy Server dialog."); - ProxyServerDialog var20 = new ProxyServerDialog(); - var20.show(); - } else if (var1.target == this.toggleVoiceChatItem) { - VoiceChat.setVoiceChatEnabled(!VoiceChat.voiceChatEnabled); - this.setMenusWRTVIP(); - } else if (var1.target == this.serverItem) { - this.handleServerItem(); - } else if (var1.target == this.condenseItem) { - new ArchiveMaker(true); - } else if (var1.target == this.expandItem) { - new ArchiveMaker(false); - } else if (var1.target == this.musicManItem) { - MusicManager.showDialog(); - } else if (var1.target == this.cdPlayerItem) { - if (this.cdcontrol == null) { - this.playedCD = true; - this.cdcontrol = new CDControl(getFrame(), this); - } - } else if (var1.target == this.volumeItem) { - if (!CDPlayerAction.launchVolumeControlApp()) { - new OkCancelDialog(getFrame(), (DialogReceiver)null, Console.message("No-Volume"), (String)null, Console.message("OK"), Console.message("Cannot-locate"), true); - } - } else if (var1.target == this.graphicsItem) { - this.handleGraphicsItem(); - } else if (var1.target == this.nametagItem) { - this.handleNametagsItem(); - } else if (var1.target == this.chatBoxItem) { - this.handleChatBoxItem(); - } else if (var1.target == this.bootSomeone) { - new BootDialog(getFrame(), this, Console.message("Boot-user")); - } else if (var1.target == this.broadcastToRoom) { - startWhispering("room"); - } else if (var1.target == this.broadcastToAll) { - startWhispering("world"); - } else if (var1.target == this.currentLang) { - var15 = Locale.getDefault().toString(); - if (var15 == Console.message(var15)) { - Console.println(Console.message("Current-Language") + " = " + Locale.getDefault().getDisplayName()); - } else { - Console.println(Console.message("Current-Language") + " = " + Console.message(var15)); - } - } else if (var1.target == this.recorderPlayItem) { - println(Console.message("BlackBoxPlay")); - BlackBox.getInstance().play(); - } else if (var1.target == this.recorderRecItem) { - println(Console.message("BlackBoxRec")); - BlackBox.getInstance().record(); - } else if (var1.target == this.recorderStopItem) { - println(Console.message("BlackBoxStop")); - BlackBox.getInstance().stop(); - } else { - int var5; - String var6; - int var16; - if (this.fontItems != null && this.fontItems.contains(var1.target)) { - var15 = IniFile.gamma().getIniString("upgradeServer", "") + "/I18N/font_"; - - for(var16 = 0; var16 < this.fLength; ++var16) { - if (var1.target == this.fontItems.elementAt(var16)) { - if (this.fsList.elementAt(var16) != null) { - var15 = var15 + this.flList.elementAt(var16) + "_" + this.fsList.elementAt(var16) + ".EXE"; - } else { - var15 = var15 + this.flList.elementAt(var16) + ".EXE"; - } - - var5 = this.fSizes[var16]; - var6 = var15.substring(var15.lastIndexOf(47) + 1, var15.length()); - LanguageManager.handle(var15, var5, var6); - break; - } - } - } else if (this.downItems != null && this.downItems.contains(var1.target)) { - var15 = IniFile.gamma().getIniString("upgradeServer", "") + "/I18N/language_"; - - for(var16 = 0; var16 < this.dLength; ++var16) { - if (var1.target == this.downItems.elementAt(var16)) { - if (this.sList.elementAt(var16) != null) { - var15 = var15 + this.lList.elementAt(var16) + "_" + this.sList.elementAt(var16) + ".zip"; - IniFile.gamma().setIniString("DEFAULTLANGUAGE", (String)this.lList.elementAt(var16) + "_" + this.sList.elementAt(var16)); - } else { - var15 = var15 + this.lList.elementAt(var16) + ".zip"; - IniFile.gamma().setIniString("DEFAULTLANGUAGE", (String)this.lList.elementAt(var16)); - } - - var5 = this.lSizes[var16]; - var6 = var15.substring(var15.lastIndexOf(47) + 1, var15.length()); - LanguageManager.handle(var15, var5, var6); - break; - } - } - } else if (this.langItems != null && this.langItems.contains(var1.target)) { - for(int var3 = 0; var3 < lLength; ++var3) { - if (var1.target == this.langItems.elementAt(var3)) { - Locale.setDefault(newLocale[var3]); - var4 = newLocale[var3].toString(); - if (var4 == Console.message(var4)) { - Console.println(message("Setting-to") + " " + newLocale[var3].getDisplayName()); - } else { - Console.println(message("Setting-to") + " " + Console.message(var4)); - } - - IniFile.gamma().setIniString("DEFAULTLANGUAGE", lCodes[var3][0] + "_" + lCodes[var3][1]); - new OkCancelDialog(getFrame(), (DialogReceiver)null, Console.message("Alert"), (String)null, Console.message("OK"), Console.message("Change-exit"), true); - break; - } - } - } else if (this.avatarMenu == null || !this.avatarMenu.action(var1, var2)) { - return super.action(var1, var2); - } - } - } - - return true; - } - - public void setCurrentAvatarItem(CheckboxMenuItem var1) { - if (this.curAvatarItem != null) { - this.curAvatarItem.setState(false); - } - - this.curAvatarItem = var1; - if (this.curAvatarItem != null) { - this.curAvatarItem.setState(true); - } - - } - - public CheckboxMenuItem getCurrentAvatarItem() { - return this.curAvatarItem; - } - - public void deletedSavedAvatar(CheckboxMenuItem var1) { - if (this.curAvatarItem == var1) { - this.findAvatarMenuItem(this.getDefaultAvatarURL()); - } - - } - - public void setNextAvatar(URL var1, CheckboxMenuItem var2) { - synchronized(this.nextAvatarMutex) { - this.nextAvatar = var1; - this.nextAvatarItem = var2; - } - } - - private void findAvatarMenuItem(URL var1) { - synchronized(this.nextAvatarMutex) { - if (this.nextAvatarItem == null) { - Object var3; - if ((this.savedAvs == null || (var3 = this.savedAvs.findMenuItem(var1)) == null) && (this.avatarMenu == null || (var3 = this.avatarMenu.findMenuItem(var1)) == null)) { - this.setCurrentAvatarItem((CheckboxMenuItem)null); - } else { - this.setCurrentAvatarItem((CheckboxMenuItem)var3); - } - } + this.lastVMCheck = var1; + } - } - } + } - private URL getHelpGettingStarted() { - IniFile var1 = new IniFile("InstalledWorlds"); - String var2 = Console.message("Getting-started"); - String var3 = var1.getIniString("InstalledWorld0", ""); - if (!var3.equals("")) { - URL var4 = URL.make("home:" + var3 + "/" + var2); - File var5 = new File(var4.unalias()); - if (var5.exists()) { - return var4; - } - } - - return URL.make("home:" + var2); - } - - private void changeView(CheckboxMenuItem var1) { - this.chooseView = this.viewItems.indexOf(var1); - if (var1 != this.currentViewItem) { - this.currentViewItem.setState(false); - this.currentViewItem = var1; - this.currentViewItem.setState(true); - } - - } - - private int getView() { - return this.viewItems.indexOf(this.currentViewItem); - } - - private void setView(int var1) { - this.changeView((CheckboxMenuItem)this.viewItems.elementAt(var1)); - } - - private void changeCamSpeed(CheckboxMenuItem var1) { - this.chooseCamSpeed = this.camSpeedItems.indexOf(var1); - if (var1 != this.currentCamSpeedItem) { - this.currentCamSpeedItem.setState(false); - this.currentCamSpeedItem = var1; - this.currentCamSpeedItem.setState(true); - } - - } - - public void resetCamera() { - if (this.viewItems != null && this.camSpeedItems != null) { - this.chooseView = this.viewItems.indexOf(this.currentViewItem); - this.chooseCamSpeed = this.camSpeedItems.indexOf(this.currentCamSpeedItem); - } - } - - private void handleServerItem() { - if (!this.serverItem.getLabel().equals(signIn)) { - Galaxy.forceOffline(false); - } else { - this.getGalaxy().localForceOnline(); - this.getGalaxy().waitForConnection(this); - } - - } - - public UniversePanel getUniverse() { - return this.universeMode ? this.universe : null; - } - - public synchronized void setUniverseMode(boolean var1) { - if (var1 != this.universeMode) { - this.universeMode = var1; - if (this.universeMode) { - if (this.universe == null) { - this.universe = new UniversePanel(this); - this.renderAndUniverse.add("universe", this.universe); - } - - this.renderCard.show(this.renderAndUniverse, "universe"); - this.universe.startWatch(); - this.render.requestFocus(); - } else { - this.renderCard.show(this.renderAndUniverse, "render"); - if (physMem < 64000000) { - this.renderAndUniverse.remove(this.universe); - this.universe.stopWatch(); - this.universe.flushImage(); - this.universe = null; - } - - this.renderAndUniverse.repaint(); - } - - } - } - - public void toggleUniverseMode() { - this.setUniverseMode(!this.universeMode); - } - - public boolean isUniverseMode() { - return this.universeMode; - } - - public Object imageButtonsCallback(Component var1, int var2) { - if (var1 != this.driveButton) { - if (var1 == this.quitButton) { - maybeQuit(); - } else if (var1 == this.exploreButton) { - this.toggleUniverseMode(); - } else if (var1 == this.menuButtons) { - switch(var2) { - case 0: - return this.getMenu("Help"); - case 1: - return this.getMenu("Options"); - case 2: - String var3 = IniFile.override().getIniString("ProductName", ""); - if (!var3.equalsIgnoreCase("RedLightWorld")) { - EMailPart.showMessage(this); - } - break; - case 3: - return (PopupMenu)this.marks.getMenu(); - case 4: - return (PopupMenu)this.marks.getLetsMenu(); - case 5: - this.actions.present(); - break; - case 6: - return this.getMenu("VIP"); - } - } - } - - return null; - } - - public RenderCanvas getRender() { - return this.render; - } - - public FriendsListPart getFriends() { - return this.friends; - } - - public MuteListPart getMutes() { - return this.mutes; - } - - public void generateFrameEvents(FrameEvent var1) { - if (Window.getWindowState(Window.getFrameHandle()) == 1) { - this.goToSleep(); - } - - if (doDrive) { - doDrive = false; - this.render.drive(); - wasDelta = true; - } - - super.generateFrameEvents(var1); - Pilot var2 = Pilot.getActive(); - GammaFrame var3 = getFrame(); - String var4 = var3.getTitle(); - String var5 = ""; - if (var2 != null) { - World var6 = var2.getWorld(); - if (var6 != null) { - String var7 = var6.getName(); - if (var7 != null) { - var5 = var7; - } - } - } - - if (!lastWorldName.equals(var5)) { - lastWorldName = var5; - String var14 = GammaFrame.getDefaultTitle(); - if (var5.length() != 0) { - var14 = var14 + " - " + var5; - if (!this.playedCD) { - CDAudio.startupPlay(); - this.playedCD = true; - } - } - - var3.setTitle(var14); - } - - if (var2 != null) { - if (this.chooseView != -1 || this.chooseCamSpeed != -1) { - int var15 = var2.getOutsideCameraMode(); - int var16 = var2.getOutsideCameraSpeed(); - int var8 = var15; - int var9 = var16; - if (this.chooseView != -1) { - var8 = ((DefaultConsole.CameraView)this.viewNames.elementAt(this.chooseView)).viewID; - } - - if (this.chooseCamSpeed != -1) { - var9 = ((DefaultConsole.CameraSpeed)this.speedNames.elementAt(this.chooseCamSpeed)).speedID; - } - - var2.setOutsideCameraMode(var8, var9); - if (var8 != 99) { - IniFile.gamma().setIniInt("CAM_MODE", var8); - IniFile.gamma().setIniInt("CAM_SPEED", var9); - } - - this.chooseView = -1; - this.chooseCamSpeed = -1; - } - - if (this.wasTeleporting != this.marks.isTeleporting()) { - this.wasTeleporting = this.marks.isTeleporting(); - if (this.wasTeleporting) { - this.statusMessage = loadingString; - } else if (this.statusMessage == loadingString) { - this.statusMessage = ""; - } - } - - this.checkVMWarning(); - if (wasDelta && !this.render.getDeltaMode()) { - this.statusMessage = arrowKeyMsg; - wasDelta = false; - this.driveButton.drawCursed(); - } - - synchronized(this.status) { - if (this.statusMessage != this.lastStatus && this.overrideMessage == null) { - this.lastStatus = this.statusMessage; - this.status.setText(this.statusMessage); - } - } - - synchronized(this.nextAvatarMutex) { - if (this.nextAvatar != null) { - this.setAvatar(this.nextAvatar); - this.nextAvatar = null; - if (this.avatarMenu != null) { - this.avatarMenu.notifyOfChange(); - } - - if (this.nextAvatarItem != null) { - this.setCurrentAvatarItem(this.nextAvatarItem); - this.nextAvatarItem = null; - } - } - - } - } - } - - private void checkVMWarning() { - int var1 = Std.getFastTime(); - if (var1 > this.lastVMCheck + 10000) { - StatMemNode var2 = StatMemNode.getNode(); - var2.updateMemoryStatus(); - if (var2._availPageMem < 0) { - var2._availPageMem = 2000000000; - } - - if (var2._totPhysMem < 0) { - var2._totPhysMem = 2000000000; - } - - physMem = var2._totPhysMem; - if (var2._availPageMem >= 4194304) { - if (var2._availPageMem > 5242880 && this.lastVMBigWarning != 0) { - if (var2._availPageMem > 10485760) { - Console.println(Console.message("plenty-virt")); - this.lastVMBigWarning = 0; - } else if (!this.showedMidWarn) { - Console.println(Console.message("plenty-virt-mem")); - this.showedMidWarn = true; - } - - if (this.statusMessage == lowVMMsg) { - this.statusMessage = ""; - } - } - } else { - if (this.lastVMBigWarning == 0 || this.showedMidWarn || var1 > this.lastVMBigWarning + 300000) { - Console.println(Console.message("Low-virt-mem")); - this.lastVMBigWarning = var1; - this.showedMidWarn = false; - } - - this.statusMessage = lowVMMsg; - } - - Object[] var3 = new Object[]{new String(Std.getProductName()), new Integer(24)}; - if (startupMemCheck) { - if (var2._totPhysMem < 24000000) { - String var4 = MessageFormat.format(Console.message("Mem-detected"), var3); - new OkCancelDialog(getFrame(), (DialogReceiver)null, Console.message("Too-Little-RAM"), (String)null, Console.message("OK"), var4, true); - } - - startupMemCheck = false; - System.out.println("System has " + var2._totPhysMem + " bytes of physical RAM"); - } - - this.lastVMCheck = var1; - } - - } - - public URL getAvatarName() { - return this.avatarURL; - } - - public void setServerURL(URL var1) { - super.setServerURL(var1); - } - - public void dialogDone(Object var1, boolean var2) { - if (var1 instanceof QuitDialog) { - if (var2) { - Console.quit(); - } - } else { - String var4; - if (var1 instanceof BootDialog) { + public URL getAvatarName() { + return this.avatarURL; + } + + public void setServerURL(URL var1) { + super.setServerURL(var1); + } + + public void dialogDone(Object var1, boolean var2) { + if (var1 instanceof QuitDialog) { if (var2) { - BootDialog var3 = (BootDialog)var1; - var4 = var3.getBoot(); - if (!var4.equals("")) { - Pilot.sendText("world", "!boot " + var4); - } + Console.quit(); } - } else if (var1 instanceof ChannelDialog) { - if (var2) { - ChannelDialog var9 = (ChannelDialog)var1; - var4 = var9.getChannel(); - Pilot var5 = Pilot.getActive(); - String var6 = var5 != null ? var5.getURL() : null; - if (var6 != null) { - int var7 = var6.indexOf("<"); - int var8 = var6.indexOf(">"); - if (var7 >= 0 && var8 > var7) { - TeleportAction.teleport(var6.substring(0, var7 + 1) + var4 + var6.substring(var8), (TeleportStatus)null); - } - } else { - Console.println(Console.message("cant-determine")); - } - } - } else if (var1 instanceof LoginWizard) { - Debug.dAssert(false); - } else if (var1 instanceof CDControl) { - if (this.cdcontrol == var1) { - this.cdcontrol = null; - } - } else if (var1 instanceof InternetConnectionDialog) { - Debug.dAssert(false); - } else if (var1 == this.reloginDialog) { - if (var2) { - Galaxy.forceOffline(true); + } else { + String var4; + if (var1 instanceof BootDialog) { + if (var2) { + BootDialog var3 = (BootDialog)var1; + var4 = var3.getBoot(); + if (!var4.equals("")) { + Pilot.sendText("world", "!boot " + var4); + } + } + } else if (var1 instanceof ChannelDialog) { + if (var2) { + ChannelDialog var9 = (ChannelDialog)var1; + var4 = var9.getChannel(); + Pilot var5 = Pilot.getActive(); + String var6 = var5 != null ? var5.getURL() : null; + if (var6 != null) { + int var7 = var6.indexOf("<"); + int var8 = var6.indexOf(">"); + if (var7 >= 0 && var8 > var7) { + TeleportAction.teleport(var6.substring(0, var7 + 1) + var4 + var6.substring(var8), (TeleportStatus)null); + } + } else { + Console.println(Console.message("cant-determine")); + } + } + } else if (var1 instanceof LoginWizard) { + Debug.dAssert(false); + } else if (var1 instanceof CDControl) { + if (this.cdcontrol == var1) { + this.cdcontrol = null; + } + } else if (var1 instanceof InternetConnectionDialog) { + Debug.dAssert(false); + } else if (var1 == this.reloginDialog) { + if (var2) { + Galaxy.forceOffline(true); + } + + this.reloginDialog = null; + } + } + + } + + public void setAvatar(URL var1) { + this.avatarURL = var1; + boolean var2 = var1.getInternal().toLowerCase().endsWith(".rwg"); + boolean var3 = var1.equals(getDefaultURL()) && !this.getGalaxy().getOnline(); + if (!this.getVIPAvatars() && var2 && !var3) { + Console.println(Console.message("Only-VIPs") + " '" + SelectAvatarAction.getPrettyAvatarName(var1.getBase()) + "'."); + } else if (VehicleShape.isVehicle(var1)) { + this.tempCarAvatar = var1.getAbsolute(); + super.setAvatar(var1); + } else { + this.tempCarAvatar = ""; + if (this.avatarMenu != null) { + this.avatarMenu.customize.setEnabled(!var1.getAbsolute().endsWith("mov")); + } + + if (!var1.equals(this.getDefaultAvatarURL())) { + if (this.getVIPAvatars()) { + if (!var2) { + IniFile.gamma().setIniString("VIPAVATAR", ""); + } else { + IniFile.gamma().setIniString("VIPAVATAR", var1.getAbsolute()); + } + } + + if (!var2) { + IniFile.gamma().setIniString("AVATAR", var1.getAbsolute()); + } + } + + super.setAvatar(var1); + } + } + + private CheckboxMenuItem findAvatar(Vector var1, String var2) { + if (var1 != null) { + int var3 = var1.size(); + + for(int var4 = 0; var4 < var3; ++var4) { + CheckboxMenuItem var5 = (CheckboxMenuItem)var1.elementAt(var4); + if (var5.getLabel().equals(var2)) { + return var5; + } + } + } + + return null; + } + + protected void loadPilot(URL var1) { + super.loadPilot(var1); + this.findAvatarMenuItem(var1); + } + + public void setChatname(String var1) { + Debug.dAssert(var1 != null); + if (var1.length() != 0) { + String var2 = (this.getVIP() ? (vip > 1 ? Console.message("VIP") + " " : Console.message("vip")) + " " : "") + "\"" + Console.parseUnicode(var1) + "\""; + this.yourName.setText(var2); + IniFile.gamma().setIniString("LASTCHATNAME", parseExtended(var2)); + } else { + this.yourName.setText(Console.message("Off-line")); + } + + } + + public void connectionCallback(Object var1, boolean var2) { + super.connectionCallback(var1, var2); + if (var1 instanceof Galaxy) { + if (var1 != this.galaxy) { + return; } - this.reloginDialog = null; - } - } - - } - - public void setAvatar(URL var1) { - this.avatarURL = var1; - boolean var2 = var1.getInternal().toLowerCase().endsWith(".rwg"); - boolean var3 = var1.equals(getDefaultURL()) && !this.getGalaxy().getOnline(); - if (!this.getVIPAvatars() && var2 && !var3) { - Console.println(Console.message("Only-VIPs") + " '" + SelectAvatarAction.getPrettyAvatarName(var1.getBase()) + "'."); - } else if (VehicleShape.isVehicle(var1)) { - this.tempCarAvatar = var1.getAbsolute(); - super.setAvatar(var1); - } else { - this.tempCarAvatar = ""; - if (this.avatarMenu != null) { - this.avatarMenu.customize.setEnabled(!var1.getAbsolute().endsWith("mov")); - } - - if (!var1.equals(this.getDefaultAvatarURL())) { - if (this.getVIPAvatars()) { - if (!var2) { - IniFile.gamma().setIniString("VIPAVATAR", ""); - } else { - IniFile.gamma().setIniString("VIPAVATAR", var1.getAbsolute()); - } - } - - if (!var2) { - IniFile.gamma().setIniString("AVATAR", var1.getAbsolute()); - } - } - - super.setAvatar(var1); - } - } - - private CheckboxMenuItem findAvatar(Vector var1, String var2) { - if (var1 != null) { - int var3 = var1.size(); - - for(int var4 = 0; var4 < var3; ++var4) { - CheckboxMenuItem var5 = (CheckboxMenuItem)var1.elementAt(var4); - if (var5.getLabel().equals(var2)) { - return var5; - } - } - } - - return null; - } - - protected void loadPilot(URL var1) { - super.loadPilot(var1); - this.findAvatarMenuItem(var1); - } - - public void setChatname(String var1) { - Debug.dAssert(var1 != null); - if (var1.length() != 0) { - String var2 = (this.getVIP() ? (vip > 1 ? Console.message("VIP") + " " : Console.message("vip")) + " " : "") + "\"" + Console.parseUnicode(var1) + "\""; - this.yourName.setText(var2); - IniFile.gamma().setIniString("LASTCHATNAME", parseExtended(var2)); - } else { - this.yourName.setText(Console.message("Off-line")); - } - - } - - public void connectionCallback(Object var1, boolean var2) { - super.connectionCallback(var1, var2); - if (var1 instanceof Galaxy) { - if (var1 != this.galaxy) { - return; - } - - if (var2) { - WorldServer var3 = this.getServerNew(); - this.friends.setServer(var3, this.getGalaxy().getIniSection()); - this.mutes.setServer(var3, this.getGalaxy().getIniSection()); - if (vip < 2) { - Console.println(vip == 1 ? Console.message("Press-full-VIP") : Console.message("Press-VIP")); - } - - PosableShape.downloadPermittedNames(); - } - } - - } - - public void galaxyDisconnected() { - super.galaxyDisconnected(); - this.getFriends().maybeServerDisconnect(); - } - - public boolean okToQuit() { - int var1 = IniFile.override().getIniInt("QuitDialog", 1); - if (var1 == 1) { - new QuitDialog(getFrame(), this); - return false; - } else { - return true; - } - } - - public Rectangle getBrowserPlacement() { - String var1 = IniFile.gamma().getIniString("BROWSERWINDOW", ""); - if (var1.length() != 0) { - StringTokenizer var2 = new StringTokenizer(var1, " ,"); - - try { - return new Rectangle(Integer.parseInt(var2.nextToken()), Integer.parseInt(var2.nextToken()), Integer.parseInt(var2.nextToken()), Integer.parseInt(var2.nextToken())); - } catch (NumberFormatException var10) { - } catch (NoSuchElementException var11) { - } - } - - Point var12 = this.menuButtons.getLocationOnScreen(); - int var3 = this.menuButtons.getLocationOnScreen().x - (int)((double)this.menuButtons.getSize().width * 0.7D); - int var4 = Window.getSystemMetrics(32); - int var5 = Toolkit.getDefaultToolkit().getScreenSize().width; - int var6 = Math.min(var5, 640) + 2 * var4; - int var7 = 0; - if (var3 != var6) { - if (var3 > var6) { - var7 += var3 - var6; - } - - var3 = var6; - } - - if (var3 > var5) { - var7 += -var4; - } - - int var8 = this.chat.listen.getLocationOnScreen().y + this.chat.listen.getSize().height - this.chat.line.getSize().height; - int var9 = 0; - if (var8 > 540) { - var9 += var8 - 540; - var8 = 540; - } - - return new Rectangle(var7, var9, var3, var8); - } - - public Object properties(int var1, int var2, int var3, Object var4) throws NoSuchPropertyException { - Object var5 = null; - switch(var1 - var2) { - case 0: - if (var3 == 0) { - var5 = URLPropertyEditor.make(new Property(this, var1, "Avatar"), "rwg;mov"); - } else if (var3 == 1) { - var5 = this.lastPilotRequested; - } else if (var3 == 2) { - this.setNextAvatar((URL)var4, (CheckboxMenuItem)null); - } - break; - case 1: - if (var3 == 0) { - var5 = BooleanPropertyEditor.make(new Property(this, var1, "Collect garbage"), "No", "Yes"); - } else if (var3 == 1) { - var5 = new Boolean(false); - } else if (var3 == 2 && (Boolean)var4) { - System.gc(); - System.runFinalization(); - } - break; - default: - var5 = super.properties(var1, var2 + 2, var3, var4); - } - - return var5; - } - - public void saveState(Saver var1) throws IOException { - var1.saveVersion(0, classCookie); - super.saveState(var1); - } - - public void restoreState(Restorer var1) throws IOException, TooNewException { - int var2 = var1.restoreVersion(classCookie); - switch(var2) { - case 0: - super.restoreState(var1); - return; - default: - throw new TooNewException(); - } - } - - static { - lLength = lNames.length; - lLangs = new MenuItem[lLength]; - newLocale = new Locale[lLength]; - lCodes = new String[lLength][2]; - signIn = Console.message("Sign-In"); - signOut = Console.message("Sign-Out"); - signingIn = Console.message("Signing-In"); - noMultiUser = Console.message("Network"); - enable3D = Console.message("Enable3D"); - disable3D = Console.message("Disable3D"); - showTags = Console.message("ShowNametags"); - hideTags = Console.message("HideNametags"); - enableClassicChat = Console.message("EnableClassicChat"); - disableClassicChat = Console.message("DisableClassicChat"); - sleepStatus = Console.message("Sleeping"); - lastWorldName = ""; - lowVMMsg = Console.message("Low-virt"); - startupMemCheck = true; - classCookie = new Object(); - } - - private class CameraSpeed { - public String speedName; - public int speedID; - - public CameraSpeed(String var2, int var3) { - this.speedName = var2; - this.speedID = var3; - } - } - - private class CameraView { - public String viewName; - public int viewID; - - public CameraView(String var2, int var3) { - this.viewName = var2; - this.viewID = var3; - } - } + if (var2) { + WorldServer var3 = this.getServerNew(); + this.friends.setServer(var3, this.getGalaxy().getIniSection()); + this.mutes.setServer(var3, this.getGalaxy().getIniSection()); + this.tars.setServer(var3, this.getGalaxy().getIniSection()); + if (vip < 2) { + Console.println(vip == 1 ? Console.message("Press-full-VIP") : Console.message("Press-VIP")); + } + + PosableShape.downloadPermittedNames(); + } + } + + } + + public void galaxyDisconnected() { + super.galaxyDisconnected(); + this.getFriends().maybeServerDisconnect(); + } + + public boolean okToQuit() { + int var1 = IniFile.override().getIniInt("QuitDialog", 1); + if (var1 == 1) { + new QuitDialog(getFrame(), this); + return false; + } else { + return true; + } + } + + public Rectangle getBrowserPlacement() { + String var1 = IniFile.gamma().getIniString("BROWSERWINDOW", ""); + if (var1.length() != 0) { + StringTokenizer var2 = new StringTokenizer(var1, " ,"); + + try { + return new Rectangle(Integer.parseInt(var2.nextToken()), Integer.parseInt(var2.nextToken()), Integer.parseInt(var2.nextToken()), Integer.parseInt(var2.nextToken())); + } catch (NumberFormatException var10) { + } catch (NoSuchElementException var11) { + } + } + + Point var12 = this.menuButtons.getLocationOnScreen(); + int var3 = this.menuButtons.getLocationOnScreen().x - (int)((double)this.menuButtons.getSize().width * 0.7D); + int var4 = Window.getSystemMetrics(32); + int var5 = Toolkit.getDefaultToolkit().getScreenSize().width; + int var6 = Math.min(var5, 640) + 2 * var4; + int var7 = 0; + if (var3 != var6) { + if (var3 > var6) { + var7 += var3 - var6; + } + + var3 = var6; + } + + if (var3 > var5) { + var7 += -var4; + } + + int var8 = this.chat.listen.getLocationOnScreen().y + this.chat.listen.getSize().height - this.chat.line.getSize().height; + int var9 = 0; + if (var8 > 540) { + var9 += var8 - 540; + var8 = 540; + } + + return new Rectangle(var7, var9, var3, var8); + } + + public Object properties(int var1, int var2, int var3, Object var4) throws NoSuchPropertyException { + Object var5 = null; + switch(var1 - var2) { + case 0: + if (var3 == 0) { + var5 = URLPropertyEditor.make(new Property(this, var1, "Avatar"), "rwg;mov;rwx"); + } else if (var3 == 1) { + var5 = this.lastPilotRequested; + } else if (var3 == 2) { + this.setNextAvatar((URL)var4, (CheckboxMenuItem)null); + } + break; + case 1: + if (var3 == 0) { + var5 = BooleanPropertyEditor.make(new Property(this, var1, "Collect garbage"), "No", "Yes"); + } else if (var3 == 1) { + var5 = new Boolean(false); + } else if (var3 == 2 && ((Boolean)var4).booleanValue()) { + System.gc(); + System.runFinalization(); + } + break; + default: + var5 = super.properties(var1, var2 + 2, var3, var4); + } + + return var5; + } + + public void saveState(Saver var1) throws IOException { + var1.saveVersion(0, classCookie); + super.saveState(var1); + } + + public void restoreState(Restorer var1) throws IOException, TooNewException { + int var2 = var1.restoreVersion(classCookie); + switch(var2) { + case 0: + super.restoreState(var1); + return; + default: + throw new TooNewException(); + } + } + + static { + lLength = lNames.length; + lLangs = new MenuItem[lLength]; + newLocale = new Locale[lLength]; + lCodes = new String[lLength][2]; + signIn = Console.message("Sign-In"); + signOut = Console.message("Sign-Out"); + signingIn = Console.message("Signing-In"); + noMultiUser = Console.message("Network"); + enable3D = Console.message("Enable3D"); + disable3D = Console.message("Disable3D"); + showTags = Console.message("ShowNametags"); + hideTags = Console.message("HideNametags"); + enableClassicChat = Console.message("EnableClassicChat"); + disableClassicChat = Console.message("DisableClassicChat"); + sleepStatus = Console.message("Sleeping"); + lastWorldName = ""; + lowVMMsg = Console.message("Low-virt"); + startupMemCheck = true; + classCookie = new Object(); + } + + private class CameraSpeed { + public String speedName; + public int speedID; + + public CameraSpeed(String var2, int var3) { + this.speedName = var2; + this.speedID = var3; + } + } + + private class CameraView { + public String viewName; + public int viewID; + + public CameraView(String var2, int var3) { + this.viewName = var2; + this.viewID = var3; + } + } + + private class WhisperPrivacy { + public String whisperName; + public int whisperID; + + public WhisperPrivacy(String var2, int var3) { + this.whisperName = var2; + this.whisperID = var3; + } + } + + private class TeleportPrivacy { + public String teleportName; + public int teleportID; + + public TeleportPrivacy(String var2, int var3) { + this.teleportName = var2; + this.teleportID = var3; + } + } } diff -ruN a/1904/NET/worlds/console/FriendsListPart.java b/1904/NET/worlds/console/FriendsListPart.java --- a/1904/NET/worlds/console/FriendsListPart.java 2020-08-06 15:46:22.000000000 -0500 +++ b/1904/NET/worlds/console/FriendsListPart.java 2023-09-24 20:22:11.000000000 -0500 @@ -3,14 +3,7 @@ import NET.worlds.core.Debug; import NET.worlds.core.IniFile; import NET.worlds.core.Std; -import NET.worlds.network.BuddyListUpdateCmd; -import NET.worlds.network.Galaxy; -import NET.worlds.network.InfiniteWaitException; -import NET.worlds.network.NetUpdate; -import NET.worlds.network.PacketTooLargeException; -import NET.worlds.network.WorldServer; -import NET.worlds.network.netPacket; -import NET.worlds.network.whisperCmd; +import NET.worlds.network.*; import NET.worlds.scape.AnimatedActionManager; import NET.worlds.scape.Drone; import NET.worlds.scape.FrameEvent; @@ -20,6 +13,8 @@ import NET.worlds.scape.PosableShape; import NET.worlds.scape.TeleportAction; import NET.worlds.scape.TeleportStatus; +import NET.worldsplus.Themer; + import java.awt.Color; import java.awt.Container; import java.awt.Dimension; @@ -30,6 +25,7 @@ import java.awt.Menu; import java.awt.MenuItem; import java.awt.PopupMenu; +import java.awt.Window; import java.awt.image.ImageObserver; import java.io.IOException; import java.text.MessageFormat; @@ -38,935 +34,967 @@ import java.util.Vector; public class FriendsListPart extends QuantizedCanvas implements FramePart, DialogReceiver, DialogDisabled, NameListOwner { - private static final String oldIniItemName = "Friends"; - private static final String iniItemName = "Friend"; - private static int maxFriends = Gamma.shaperEnabled() ? 60 : 30; - private static int absMaxFriends = 100; - private static final String separator = ";"; - private static final String whereQuery = "&|+where?"; - private static final String whereResponse = "&|+where>"; - VoiceChat chatter = new VoiceChat(); - private static final int MOUSEMOVE = 0; - private static final int MOUSEDRAG = 1; - private static final int MOUSEDOWN = 2; - private static final int MOUSEUP = 3; - private static final int MOUSEENTER = 4; - private static final int MOUSEEXIT = 5; - private static final int BLANK = 0; - private static final int NORMAL = 1; - private static final int CURSED = 2; - private static final int DOWN = 3; - private static final int TELEPORT_IDLE = 0; - private static final int TELEPORT_REQUEST_LOCATION = 1; - private static final int TELEPORT_WAIT_FOR_LOCATION = 2; - private static final int buttonWidth = 97; - private static final int buttonHeight = 11; - private static final int xText = 20; - private static final int yText = 9; - private static final int xTextClip = 94; - private static Image friendsImage; - private static Image moreFriendsImage; - private static Font font; - private static FriendsListPart active; - private Vector friends = new Vector(); - private Vector onlineFriends = new Vector(); - private Vector mutedOnlineFriends = new Vector(); - private Vector serverUpdates = new Vector(); - private Object friendsMutex = new Object(); - private int cursedButton = -1; - private int clickedButton = -1; - private boolean clickedButtonDown; - private PopupMenu menu; - private MenuItem teleportItem = new MenuItem(Console.message("Go-There")); - private MenuItem emailItem = new MenuItem(Console.message("E-Mail")); - private MenuItem muteItem = new MenuItem(Console.message("Mute")); - private MenuItem whisperItem = new MenuItem(Console.message("Whisper")); - private MenuItem voiceChatItem = new MenuItem(Console.message("Voice-Chat")); - private MenuItem infoItem = new MenuItem(Console.message("Personal-I")); - private MenuItem tradeItem = new MenuItem(Console.message("Talk-Trade")); - private PopupMenu droneMenu; - private MenuItem droneAddItem = new MenuItem(Console.message("Add-2-friends")); - private MenuItem droneEmailItem = new MenuItem(Console.message("E-Mail")); - private MenuItem droneMuteItem = new MenuItem(Console.message("Mute")); - private MenuItem droneWhisperItem = new MenuItem(Console.message("Whisper")); - private MenuItem droneVoiceChatItem = new MenuItem(Console.message("Voice-Chat")); - private MenuItem droneInfoItem = new MenuItem(Console.message("Personal-I")); - private MenuItem droneTradeItem = new MenuItem(Console.message("Talk-Trade")); - private String activeFriendName = ""; - private String teleportTarget; - private int teleportState = 0; - private int teleportWaitStartTime; - private boolean teleportWaitSentMsg; - private int friendsButtons; - private int moreFriendsButton; - private boolean moreFriendsActive; - private MenuItem editItem; - private Menu actionMenu; - private MoreFriendsDialog moreFriendsDialog; - private DefaultConsole console; - private Galaxy galaxy; - private IniFile serverSection; - private boolean isDialogDisabled; - private int showMenuY = -1; - private static final String voiceChatWhisper = "&|+voicechat"; - - public FriendsListPart() { - AnimatedActionManager.get(); - String var1; - if (font == null) { - var1 = IniFile.override().getIniString("friendsGif", "friends.gif"); - friendsImage = ImageCanvas.getSystemImage(var1, this); - String var2 = IniFile.override().getIniString("moreFriendsGif", Console.message("mfriends.gif")); - moreFriendsImage = ImageCanvas.getSystemImage(var2, this); - int var3 = new Integer(Console.message("FriendsPointSize")); - font = new Font(Console.message("FriendsFont"), 0, var3); - } - - this.teleportItem.setFont(font); - this.emailItem.setFont(font); - this.muteItem.setFont(font); - this.whisperItem.setFont(font); - this.tradeItem.setFont(font); - this.voiceChatItem.setFont(font); - this.infoItem.setFont(font); - this.menu = new PopupMenu(); - this.menu.add(this.teleportItem); - var1 = IniFile.override().getIniString("ProductName", ""); - if (!var1.equalsIgnoreCase("RedLightWorld")) { - this.menu.add(this.emailItem); - } - - this.menu.add(this.muteItem); - this.menu.add(this.whisperItem); - if (NetUpdate.isInternalVersion()) { - this.menu.add(this.tradeItem); - } - - this.menu.add(this.voiceChatItem); - if (!VoiceChat.voiceChatAvailable()) { - this.voiceChatItem.setEnabled(false); - } - - this.menu.add(this.infoItem); - this.add(this.menu); - this.droneAddItem.setFont(font); - this.droneEmailItem.setFont(font); - this.droneMuteItem.setFont(font); - this.droneWhisperItem.setFont(font); - this.droneTradeItem.setFont(font); - this.droneVoiceChatItem.setFont(font); - this.droneInfoItem.setFont(font); - this.droneMenu = new PopupMenu(); - this.droneMenu.setFont(font); - this.droneMenu.add(this.droneAddItem); - this.droneMenu.add(this.droneEmailItem); - this.droneMenu.add(this.droneMuteItem); - this.droneMenu.add(this.droneWhisperItem); - if (NetUpdate.isInternalVersion()) { - this.droneMenu.add(this.droneTradeItem); - } - - this.droneMenu.add(this.droneVoiceChatItem); - if (!VoiceChat.voiceChatAvailable()) { - this.droneVoiceChatItem.setEnabled(false); - } - - this.droneMenu.add(this.droneInfoItem); - this.add(this.droneMenu); - } - - public void update(Graphics var1) { - this.paint(var1); - } - - public void paint(Graphics var1) { - int var2 = this.size().height; - int var3 = var2 / 11; - synchronized(this.friendsMutex) { - int var5 = this.onlineFriends.size(); - this.moreFriendsButton = var3 - 1; - if (var5 >= var3) { - this.friendsButtons = var3 - 1; - this.moreFriendsActive = true; - } else { - this.friendsButtons = var5; - this.moreFriendsActive = false; - } - - int var6 = var3 * 11; - int var7 = var2 - var6; - if (var7 > 0) { - var1.setColor(Color.black); - var1.fillRect(0, 0, 97, var7); - } - - for(int var8 = 0; var8 < var3; ++var8) { - int var9 = 1; - if (var8 >= this.friendsButtons && !this.isMoreFriendsButton(var8)) { - var9 = 0; - } else if (var8 == this.clickedButton) { - var9 = this.clickedButtonDown ? 3 : 1; - } else if (var8 == this.cursedButton) { - var9 = 2; - } - - this.drawButton(var1, var8, var9); - } - - } - } - - public int getRemainder(int var1) { - int var2 = var1 / 11; - int var3 = var2 * 11; - return var1 - var3; - } - - public Dimension preferredSize() { - return new Dimension(97, 1); - } - - public Dimension minimumSize() { - return this.preferredSize(); - } - - public boolean mouseMove(Event var1, int var2, int var3) { - return this.buttonAction(var2, var3, 0); - } - - public boolean mouseDown(Event var1, int var2, int var3) { - return this.buttonAction(var2, var3, 2); - } - - public boolean mouseUp(Event var1, int var2, int var3) { - if (this.buttonAction(var2, var3, 3)) { - if (this.showMenuY != -1) { - this.menu.show(this, 0, this.showMenuY); - this.showMenuY = -1; - } - - return true; - } else { - return false; - } - } - - public boolean mouseDrag(Event var1, int var2, int var3) { - return this.buttonAction(var2, var3, 1); - } - - public boolean mouseEnter(Event var1, int var2, int var3) { - return this.buttonAction(var2, var3, 4); - } - - public boolean mouseExit(Event var1, int var2, int var3) { - return this.buttonAction(var2, var3, 5); - } - - public boolean handleEvent(Event var1) { - return this.isDialogDisabled ? false : super.handleEvent(var1); - } - - private void loadFriends() { - if (this.friends.size() != 0) { - this.friends.removeAllElements(); - } - - if (Console.getActive().broadcastEnabled()) { - maxFriends = 100; - } - - for(int var1 = 0; var1 < absMaxFriends; ++var1) { - String var2 = this.serverSection.getIniString("Friend" + var1, ""); - if (var2.length() == 0) { - break; - } - - if (isValidUserName(var2) && !icontains(this.friends, var2)) { - this.friends.addElement(var2); - } - } - - if (this.friends.size() == 0) { - String var4 = this.serverSection.getIniString("Friends", ""); - StringTokenizer var5 = new StringTokenizer(var4, ";"); - - while(var5.hasMoreTokens() && this.friends.size() < absMaxFriends) { - String var3 = var5.nextToken(); - if (isValidUserName(var3) && !icontains(this.friends, var3)) { - this.friends.addElement(var3); - } - } - if (this.friends.size() != 0) { - this.saveFriends(); - this.serverSection.setIniString("Friends", ""); - } - } - - } - - void saveFriends() { - if (this.serverSection != null) { - int var1 = this.friends.size(); - - for(int var2 = 0; var2 < var1; ++var2) { - this.serverSection.setIniString("Friend" + var2, (String)this.friends.elementAt(var2)); - } - - this.serverSection.setIniString("Friend" + var1, ""); - } - } - - private boolean isMoreFriendsButton(int var1) { - return var1 == this.moreFriendsButton && this.moreFriendsActive; - } - - private Graphics drawButton(Graphics var1, int var2, int var3) { - Image var4 = var2 == this.moreFriendsButton ? moreFriendsImage : friendsImage; - if (var1 != null || (var1 = this.getGraphics()) != null) { - int var5 = var2 * 11; - Graphics var6 = var1.create(0, var5, 97, 11); - var6.drawImage(var4, -var3 * 97, 0, (ImageObserver)null); - if (var2 >= 0 && var2 < this.friendsButtons && var2 < this.onlineFriends.size()) { - var6.clipRect(0, 0, 94, 11); - var6.setFont(font); - var6.setColor(Color.white); - var6.drawString((String)this.onlineFriends.elementAt(var2), 20, 9); - } - - var6.dispose(); - } - - return var1; - } - - private boolean buttonAction(int var1, int var2, int var3) { - synchronized(this.friendsMutex) { - Graphics var5 = null; - int var6 = var2 / 11; - if ((var6 < 0 || var6 >= this.friendsButtons) && !this.isMoreFriendsButton(var6)) { - var6 = -1; - } - - if (var3 != 0 && var3 != 4) { - if (var3 == 5) { - if (this.cursedButton != -1) { - var5 = this.drawButton(var5, this.cursedButton, 1); - this.cursedButton = -1; - } - - if (this.clickedButton != -1 && this.clickedButtonDown) { - var5 = this.drawButton(var5, this.clickedButton, 1); - this.clickedButtonDown = false; - } - } else if (var3 == 2) { - if (this.clickedButton != -1) { - var5 = this.drawButton(var5, this.clickedButton, 1); - this.clickedButtonDown = false; - } - - if ((this.clickedButton = var6) != -1) { - var5 = this.drawButton(var5, this.clickedButton, 3); - this.clickedButtonDown = true; - } - } else if (var3 == 1) { - if (this.clickedButton != -1) { - if (this.clickedButtonDown) { - if (var6 != this.clickedButton) { - var5 = this.drawButton(var5, this.clickedButton, 1); - this.clickedButtonDown = false; - } - } else if (var6 == this.clickedButton) { - var5 = this.drawButton(var5, this.clickedButton, 3); - this.clickedButtonDown = true; - } - } - } else if (var3 == 3) { - this.cursedButton = var6; - if (this.clickedButtonDown) { - if (this.cursedButton == this.clickedButton) { - var5 = this.drawButton(var5, this.clickedButton, 2); - } else { - var5 = this.drawButton(var5, this.clickedButton, 1); - } - - if (this.clickedButton == this.moreFriendsButton) { - if (this.moreFriendsDialog == null) { - this.moreFriendsDialog = new MoreFriendsDialog(this, this.menu, this.onlineFriends); - } - } else if (this.clickedButton >= 0 && this.clickedButton < this.onlineFriends.size()) { - this.activeFriendName = (String)this.onlineFriends.elementAt(this.clickedButton); - Debug.assert(this.activeFriendName != null); - this.showMenuY = (this.clickedButton + 1) * 11; - } - } - - if (this.cursedButton != this.clickedButton) { - var5 = this.drawButton(var5, this.cursedButton, 2); - } - - this.clickedButtonDown = false; - this.clickedButton = -1; - } - } else if (var6 != this.cursedButton) { - var5 = this.drawButton(var5, this.cursedButton, 1); - var5 = this.drawButton(var5, this.cursedButton = var6, 2); - } - - if (var5 != null) { - var5.dispose(); - } - - return true; - } - } - - private static boolean sendMsg(WorldServer var0, netPacket var1) { - try { - var0.sendNetworkMsg(var1); - return true; - } catch (InfiniteWaitException var3) { - } catch (PacketTooLargeException var4) { - } - - return false; - } - - public void activate(Console var1, Container var2, Console var3) { - active = this; - this.console = (DefaultConsole)var1; - this.editItem = var1.addMenuItem(Console.message("Edit-Friends"), "Options"); - this.editItem.setEnabled(this.friends != null); - } - - public void deactivate() { - active = null; - this.editItem = null; - } - - public boolean action(Event var1, Object var2) { - if (var1.target == this.editItem) { - new EditNamesDialog(this, Console.message("Edit-Friends2"), Console.message("Add-Friend")); - return true; - } else { - return this.maybeFriendAction(var1.target); - } - } - - public boolean handle(FrameEvent var1) { - int var3; - synchronized(this.friendsMutex) { - var3 = this.serverUpdates.size(); - if (var3 != 0) { - WorldServer var4 = this.console.getServerNew(); - if (var4 != null) { - while(var3-- != 0 && sendMsg(var4, (netPacket)this.serverUpdates.elementAt(0))) { - this.serverUpdates.removeElementAt(0); - } - } - } - } - - synchronized(this) { - if (this.teleportState == 1) { - WorldServer var9 = this.console.getServerNew(); - if (var9 != null) { - sendMsg(var9, new whisperCmd(this.teleportTarget, "&|+where?")); - this.teleportState = 2; - this.teleportWaitStartTime = Std.getRealTime(); - this.teleportWaitSentMsg = false; + private static final String oldIniItemName = "Friends"; + private static final String iniItemName = "Friend"; + private static final String separator = ";"; + private static final String whereQuery = "&|+where?"; + private static final String whereResponse = "&|+where>"; + VoiceChat chatter = new VoiceChat(); + private static final int MOUSEMOVE = 0; + private static final int MOUSEDRAG = 1; + private static final int MOUSEDOWN = 2; + private static final int MOUSEUP = 3; + private static final int MOUSEENTER = 4; + private static final int MOUSEEXIT = 5; + private static final int BLANK = 0; + private static final int NORMAL = 1; + private static final int CURSED = 2; + private static final int DOWN = 3; + private static final int TELEPORT_IDLE = 0; + private static final int TELEPORT_REQUEST_LOCATION = 1; + private static final int TELEPORT_WAIT_FOR_LOCATION = 2; + private static final int buttonWidth = 97; + private static final int buttonHeight = 11; + private static final int xText = 20; + private static final int yText = 9; + private static final int xTextClip = 94; + private static Image friendsImage; + private static Image moreFriendsImage; + private static Font font; + public static FriendsListPart active; + public static Vector friends = new Vector(); + private Vector onlineFriends = new Vector(); + private Vector mutedOnlineFriends = new Vector(); + private Vector serverUpdates = new Vector(); + private Object friendsMutex = new Object(); + private int cursedButton = -1; + private int clickedButton = -1; + private boolean clickedButtonDown; + private PopupMenu menu; + private MenuItem teleportItem = new MenuItem(Console.message("Go-There")); + private MenuItem fremoveItem = new MenuItem(Console.message("remove-friend")); + private MenuItem whereIsItem = new MenuItem(Console.message("where-is")); + private MenuItem emailItem = new MenuItem(Console.message("E-Mail")); + private MenuItem muteItem = new MenuItem(Console.message("Mute")); + private MenuItem whisperItem = new MenuItem(Console.message("Whisper")); + private MenuItem infoItem = new MenuItem(Console.message("Personal-I")); + private MenuItem tradeItem = new MenuItem(Console.message("Talk-Trade")); + private PopupMenu droneMenu; + private MenuItem droneAddItem = new MenuItem(Console.message("Add-2-friends")); + private MenuItem droneTarItem = new MenuItem(Console.message("disable-avatar")); + private MenuItem droneEmailItem = new MenuItem(Console.message("E-Mail")); + private MenuItem droneMuteItem = new MenuItem(Console.message("Mute")); + private MenuItem droneWhisperItem = new MenuItem(Console.message("Whisper")); + private MenuItem droneInfoItem = new MenuItem(Console.message("Personal-I")); + private MenuItem droneTradeItem = new MenuItem(Console.message("Talk-Trade")); + private String activeFriendName = ""; + private String teleportTarget; + private int teleportState = 0; + private int teleportWaitStartTime; + private boolean teleportWaitSentMsg; + private int friendsButtons; + private int moreFriendsButton; + private boolean moreFriendsActive; + private MenuItem editItem; + private Menu actionMenu; + private MoreFriendsDialog moreFriendsDialog; + private DefaultConsole console; + private Galaxy galaxy; + private IniFile serverSection; + private boolean isDialogDisabled; + private int showMenuY = -1; + + public FriendsListPart() { + AnimatedActionManager.get(); + String var1; + if(font == null) { + var1 = Themer.themer.asset("friends.gif"); + friendsImage = ImageCanvas.getSystemImage(var1, this); + String var2 = Themer.themer.asset(Console.message("mfriends.gif")); + moreFriendsImage = ImageCanvas.getSystemImage(var2, this); + int var3 = (new Integer(Console.message("FriendsPointSize"))).intValue(); + font = new Font(Console.message("FriendsFont"), 0, var3); + } + + this.teleportItem.setFont(font); + this.whereIsItem.setFont(font); + this.emailItem.setFont(font); + this.muteItem.setFont(font); + this.whisperItem.setFont(font); + this.tradeItem.setFont(font); + this.infoItem.setFont(font); + this.fremoveItem.setFont(font); + this.menu = new PopupMenu(); + this.menu.add(this.teleportItem); + this.menu.add(this.whereIsItem); + this.menu.add(this.emailItem); + this.menu.add(this.muteItem); + this.menu.add(this.whisperItem); + if(NetUpdate.isInternalVersion()) { + this.menu.add(this.tradeItem); + } + this.menu.add(this.fremoveItem); + + this.menu.add(this.infoItem); + this.add(this.menu); + this.droneAddItem.setFont(font); + this.droneTarItem.setFont(font); + this.droneEmailItem.setFont(font); + this.droneMuteItem.setFont(font); + this.droneWhisperItem.setFont(font); + this.droneTradeItem.setFont(font); + this.droneInfoItem.setFont(font); + this.droneMenu = new PopupMenu(); + this.droneMenu.setFont(font); + this.droneMenu.add(this.droneAddItem); + this.droneMenu.add(this.droneTarItem); + this.droneMenu.add(this.droneEmailItem); + this.droneMenu.add(this.droneMuteItem); + this.droneMenu.add(this.droneWhisperItem); + this.droneMenu.add(this.droneTradeItem); + this.droneMenu.add(this.droneInfoItem); + + this.add(this.droneMenu); + } + + + public void update(Graphics var1) { + this.paint(var1); + } + + public void paint(Graphics var1) { + int var2 = this.size().height; + int var3 = var2 / 11; + synchronized(this.friendsMutex) { + int var5 = this.onlineFriends.size(); + this.moreFriendsButton = var3 - 1; + if(var5 >= var3) { + this.friendsButtons = var3 - 1; + this.moreFriendsActive = true; } else { - Console.println(Console.message("Cant-go-there")); - this.teleportState = 0; + this.friendsButtons = var5; + this.moreFriendsActive = false; } - } - if (this.teleportState == 2) { - var3 = Std.getRealTime(); - if (var3 > this.teleportWaitStartTime + 5000) { - Object[] var10; - if (var3 > this.teleportWaitStartTime + 30000) { - this.teleportState = 0; - if (this.teleportWaitSentMsg) { - var10 = new Object[]{new String(this.teleportTarget)}; - Console.println(MessageFormat.format(Console.message("Cancel-teleport"), var10)); - } - } else if (!this.teleportWaitSentMsg) { - var10 = new Object[]{new String(this.teleportTarget)}; - Console.println(MessageFormat.format(Console.message("Delay-locating"), var10)); - this.teleportWaitSentMsg = true; - } - } - } - - return true; - } - } - - public void dialogDisable(boolean var1) { - if (this.isDialogDisabled = var1) { - this.cursedButton = -1; - this.clickedButton = -1; - this.clickedButtonDown = false; - this.repaint(); - } - - } - - public void setServer(WorldServer var1, IniFile var2) { - this.serverSection = var2; - this.galaxy = var1.getGalaxy(); - Debug.dAssert(var2 != null); - Debug.dAssert(this.galaxy != null); - this.loadFriends(); - if (this.editItem != null) { - this.editItem.setEnabled(true); - } - - this.sendAll(var1); - } - - public void maybeServerDisconnect() { - if (this.galaxy != null) { - if (this.editItem != null) { - this.editItem.setEnabled(false); - } - - this.clearAll(); - } - - } - - public static boolean tryToRun(String var0) { - try { - Runtime.getRuntime().exec(var0); - return true; - } catch (IOException var2) { - return false; - } - } - - private boolean maybeFriendAction(Object var1) { - if (var1 != this.emailItem && var1 != this.droneEmailItem) { - if (var1 != this.whisperItem && var1 != this.droneWhisperItem) { - if (var1 != this.voiceChatItem && var1 != this.droneVoiceChatItem) { - if (var1 == this.droneAddItem) { - if (this.mayAddNameListName(Console.getFrame())) { - this.addNameListName(this.activeFriendName); - } - } else if (var1 == this.teleportItem) { - synchronized(this) { - this.teleportTarget = this.activeFriendName; - if (this.teleportState == 2 && this.teleportWaitSentMsg) { - Console.println(Console.message("Cancel-new-tele")); - } - - this.teleportState = 1; - } - } else if (var1 != this.muteItem && var1 != this.droneMuteItem) { - if (var1 != this.infoItem && var1 != this.droneInfoItem) { - if (var1 != this.tradeItem && var1 != this.droneTradeItem) { - return false; - } - - WhisperManager.whisperManager().startToTrade(this.activeFriendName); - } else { - new PersonalInfoDownload(this.activeFriendName, this.console); - } - } else if (this.console.getMutes().mayAddNameListName(Console.getFrame())) { - this.console.getMutes().addNameListName(this.activeFriendName); - } - } else { - this.chatter.beginChat(this.activeFriendName, this.console); + int var6 = var3 * 11; + int var7 = var2 - var6; + if(var7 > 0) { + var1.setColor(Color.black); + var1.fillRect(0, 0, 97, var7); } - } else { - Console.startWhispering(this.activeFriendName); - } - } else { - EMailPart.showMessage(this.console, this.activeFriendName); - } - - return true; - } - - private void clearAll() { - if (this.galaxy != null) { - synchronized(this.friendsMutex) { - this.onlineFriends.removeAllElements(); - this.mutedOnlineFriends.removeAllElements(); - } - if (active == this) { - this.repaint(); - } + for(int var8 = 0; var8 < var3; ++var8) { + int var9 = 1; + if(var8 >= this.friendsButtons && !this.isMoreFriendsButton(var8)) { + var9 = 0; + } else if(var8 == this.clickedButton) { + var9 = this.clickedButtonDown?3:1; + } else if(var8 == this.cursedButton) { + var9 = 2; + } - this.galaxy.sentFriendsList(false); - } + this.drawButton(var1, var8, var9); + } - } + } + } - private void sendAll(WorldServer var1) { - if (!this.galaxy.sentFriendsList()) { - synchronized(this.friendsMutex) { - int var3 = this.friends.size(); - int var4 = 0; - - while(true) { - if (var4 >= var3) { - break; - } - - sendMsg(var1, new BuddyListUpdateCmd((String)this.friends.elementAt(var4), 1)); - ++var4; - } - } - - this.galaxy.sentFriendsList(true); - } - - } - - private static String getWorldName(String var0) { - int var1 = var0.indexOf(".world#"); - int var2; - return var1 == -1 || (var2 = var0.lastIndexOf(47, var1)) == -1 && (var2 = var0.lastIndexOf(58, var1)) == -1 ? null : var0.substring(var2 + 1, var1); - } - - public static void processWhisper(WorldServer var0, String var1, String var2) { - if (active != null && active.galaxy == var0.getGalaxy()) { - active.instanceProcessWhisper(var0, var1, var2); - } - - } - - private synchronized void instanceProcessWhisper(WorldServer var1, String var2, String var3) { - if (var3.startsWith("&|+where?")) { - Pilot var4; - String var5; - if ((var4 = Pilot.getActive()) != null && (var5 = var4.getTeleportURL()) != null) { - if (this.console.getSpecialGuest()) { - int var6 = var5.indexOf(60); - int var7 = var5.indexOf(62); - var5 = var5.substring(0, var6) + var5.substring(var7 + 1); - } - - if (Pilot.getActive().getRoom().getAllowTeleport()) { - sendMsg(var1, new whisperCmd(var2, "&|+where>" + var5)); - } - } - } else if (var3.startsWith("&|+where>")) { - if (this.teleportState == 2 && this.teleportTarget.equals(var2)) { - String var9 = var3.substring("&|+where>".length()); - boolean var10 = false; - String var11 = getWorldName(var9); - String var8; - if (!var9.startsWith("home:") && !var9.startsWith("http://")) { - if (var11 != null && var11.length() > 0) { - Pilot var12 = Pilot.getActive(); - if (var12 != null) { - var8 = var12.getTeleportURL(); - if (var8 != null && var11.equals(getWorldName(var8))) { - var10 = true; - var9 = var8.substring(0, var8.lastIndexOf(35)) + var9.substring(var9.lastIndexOf(35)); - } - } - } - - if (!var10) { - String var13 = WorldsMarkPart.findPackage(var11); - if (var13 != null) { - var10 = true; - var9 = "home:" + var13 + "/" + var13 + ".world" + var9.substring(var9.lastIndexOf(35)); - } - } - } else { - var10 = true; + public int getRemainder(int var1) { + int var2 = var1 / 11; + int var3 = var2 * 11; + return var1 - var3; + } + + public Dimension preferredSize() { + return new Dimension(97, 1); + } + + public Dimension minimumSize() { + return this.preferredSize(); + } + + public boolean mouseMove(Event var1, int var2, int var3) { + return this.buttonAction(var2, var3, 0); + } + + public boolean mouseDown(Event var1, int var2, int var3) { + return this.buttonAction(var2, var3, 2); + } + + public boolean mouseUp(Event var1, int var2, int var3) { + if(this.buttonAction(var2, var3, 3)) { + if(this.showMenuY != -1) { + this.menu.show(this, 0, this.showMenuY); + this.showMenuY = -1; + } + + return true; + } else { + return false; + } + } + + public boolean mouseDrag(Event var1, int var2, int var3) { + return this.buttonAction(var2, var3, 1); + } + + public boolean mouseEnter(Event var1, int var2, int var3) { + return this.buttonAction(var2, var3, 4); + } + + public boolean mouseExit(Event var1, int var2, int var3) { + return this.buttonAction(var2, var3, 5); + } + + public boolean handleEvent(Event var1) { + return this.isDialogDisabled?false:super.handleEvent(var1); + } + + private void loadFriends() { + if(this.friends.size() != 0) { + this.friends.removeAllElements(); + } + + for(int var2 = 0; var2 < Integer.MAX_VALUE; ++var2) { + String var1 = this.serverSection.getIniString("Friend" + var2, ""); + if(((String)var1).length() == 0) { + break; + } + + if(isValidUserName((String)var1) && !icontains(this.friends, (String)var1)) { + this.friends.addElement(var1); + } + } + + if(this.friends.size() == 0) { + String var5 = this.serverSection.getIniString("Friends", ""); + StringTokenizer var4 = new StringTokenizer(var5, ";"); + + while(((StringTokenizer)var4).hasMoreTokens()) { + String var3 = ((StringTokenizer)var4).nextToken(); + if(isValidUserName(var3) && !icontains(this.friends, var3)) { + this.friends.addElement(var3); + } + } + + if(this.friends.size() != 0) { + this.saveFriends(); + this.serverSection.setIniString("Friends", ""); + } + } + } + + void saveFriends() { + if(this.serverSection != null) { + int var1 = this.friends.size(); + + for(int var2 = 0; var2 < var1; ++var2) { + this.serverSection.setIniString("Friend" + var2, (String)this.friends.elementAt(var2)); } - Object[] var14; - if (var10) { - TeleportAction.teleport(var9, (TeleportStatus)null); - if (this.teleportWaitSentMsg) { - var14 = new Object[]{new String(this.teleportTarget)}; - Console.println(MessageFormat.format(Console.message("Found-tele"), var14)); - } + this.serverSection.setIniString("Friend" + var1, ""); + } + } + + private boolean isMoreFriendsButton(int var1) { + return var1 == this.moreFriendsButton && this.moreFriendsActive; + } + + private Graphics drawButton(Graphics var1, int var2, int var3) { + Image var4 = var2 == this.moreFriendsButton?moreFriendsImage:friendsImage; + if(var1 != null || (var1 = this.getGraphics()) != null) { + int var5 = var2 * 11; + Graphics var6 = var1.create(0, var5, 97, 11); + var6.drawImage(var4, -var3 * 97, 0, (ImageObserver)null); + if(var2 >= 0 && var2 < this.friendsButtons && var2 < this.onlineFriends.size()) { + var6.clipRect(0, 0, 94, 11); + var6.setFont(font); + var6.setColor(Color.white); + var6.drawString((String)this.onlineFriends.elementAt(var2), 20, 9); + } + + var6.dispose(); + } + + return var1; + } + + private boolean buttonAction(int var1, int var2, int var3) { + synchronized(this.friendsMutex) { + Graphics var5 = null; + int var6 = var2 / 11; + if((var6 < 0 || var6 >= this.friendsButtons) && !this.isMoreFriendsButton(var6)) { + var6 = -1; + } + + if(var3 != 0 && var3 != 4) { + if(var3 == 5) { + if(this.cursedButton != -1) { + var5 = this.drawButton(var5, this.cursedButton, 1); + this.cursedButton = -1; + } + + if(this.clickedButton != -1 && this.clickedButtonDown) { + var5 = this.drawButton(var5, this.clickedButton, 1); + this.clickedButtonDown = false; + } + } else if(var3 == 2) { + if(this.clickedButton != -1) { + var5 = this.drawButton(var5, this.clickedButton, 1); + this.clickedButtonDown = false; + } + + if((this.clickedButton = var6) != -1) { + var5 = this.drawButton(var5, this.clickedButton, 3); + this.clickedButtonDown = true; + } + } else if(var3 == 1) { + if(this.clickedButton != -1) { + if(this.clickedButtonDown) { + if(var6 != this.clickedButton) { + var5 = this.drawButton(var5, this.clickedButton, 1); + this.clickedButtonDown = false; + } + } else if(var6 == this.clickedButton) { + var5 = this.drawButton(var5, this.clickedButton, 3); + this.clickedButtonDown = true; + } + } + } else if(var3 == 3) { + this.cursedButton = var6; + if(this.clickedButtonDown) { + if(this.cursedButton == this.clickedButton) { + var5 = this.drawButton(var5, this.clickedButton, 2); + } else { + var5 = this.drawButton(var5, this.clickedButton, 1); + } + + if(this.clickedButton == this.moreFriendsButton) { + if(this.moreFriendsDialog == null) { + this.moreFriendsDialog = new MoreFriendsDialog(this, this.menu, this.onlineFriends); + } + } else if(this.clickedButton >= 0 && this.clickedButton < this.onlineFriends.size()) { + this.activeFriendName = (String)this.onlineFriends.elementAt(this.clickedButton); + this.showMenuY = (this.clickedButton + 1) * 11; + } + } + + if(this.cursedButton != this.clickedButton) { + var5 = this.drawButton(var5, this.cursedButton, 2); + } + + this.clickedButtonDown = false; + this.clickedButton = -1; + } + } else if(var6 != this.cursedButton) { + var5 = this.drawButton(var5, this.cursedButton, 1); + var5 = this.drawButton(var5, this.cursedButton = var6, 2); + } + + if(var5 != null) { + var5.dispose(); + } + + return true; + } + } + + private static boolean sendMsg(WorldServer var0, netPacket var1) { + try { + var0.sendNetworkMsg(var1); + return true; + } catch (InfiniteWaitException var3) { + } catch (PacketTooLargeException var4) { + } + + return false; + } + + public void activate(Console var1, Container var2, Console var3) { + active = this; + this.console = (DefaultConsole)var1; + this.editItem = var1.addMenuItem(Console.message("Edit-Friends"), "Options"); + this.editItem.setEnabled(this.friends != null); + } + + public void deactivate() { + active = null; + this.editItem = null; + } + + public boolean action(Event var1, Object var2) { + if(var1.target == this.editItem) { + new EditNamesDialog(this, Console.message("Edit-Friends2"), Console.message("Add-Friend")); + return true; + } else { + return this.maybeFriendAction(var1.target); + } + } + + public boolean handle(FrameEvent var1) { + int var4; + synchronized(this.friendsMutex) { + var4 = this.serverUpdates.size(); + if(var4 != 0) { + WorldServer var2 = this.console.getServerNew(); + if(var2 != null) { + while(var4-- != 0 && sendMsg((WorldServer)var2, (netPacket)this.serverUpdates.elementAt(0))) { + this.serverUpdates.removeElementAt(0); + } + } + } + } + + synchronized(this) { + WorldServer var10; + if(this.teleportState == 1) { + var10 = this.console.getServerNew(); + if(var10 != null) { + sendMsg(var10, new whisperCmd(this.teleportTarget, "&|+where?")); + this.teleportState = 2; + this.teleportWaitStartTime = Std.getRealTime(); + this.teleportWaitSentMsg = false; + } else { + Console.println(Console.message("Cant-go-there")); + this.teleportState = 0; + } + } + + if(this.teleportState == 2) { + var4 = Std.getRealTime(); + if(var4 > this.teleportWaitStartTime + 5000) { + Object[] var9; + if(var4 > this.teleportWaitStartTime + 30000) { + this.teleportState = 0; + if(this.teleportWaitSentMsg) { + var9 = new Object[]{new String(this.teleportTarget)}; + Console.println(MessageFormat.format(Console.message("Cancel-teleport"), (Object[])var9)); + } + } else if(!this.teleportWaitSentMsg) { + var9 = new Object[]{new String(this.teleportTarget)}; + Console.println(MessageFormat.format(Console.message("Delay-locating"), (Object[])var9)); + this.teleportWaitSentMsg = true; + } + } + } + + if(this.teleportState == -1) { + var10 = this.console.getServerNew(); + if(var10 != null) { + sendMsg(var10, new whisperCmd(this.teleportTarget, "&|+where?")); + } else { + Console.println(Console.message("Cant-go-there")); + } + + this.teleportState = -2; + } + + return true; + } + } + + public void dialogDisable(boolean var1) { + if(this.isDialogDisabled = var1) { + this.cursedButton = -1; + this.clickedButton = -1; + this.clickedButtonDown = false; + this.repaint(); + } + + } + + public void setServer(WorldServer var1, IniFile var2) { + this.serverSection = var2; + this.galaxy = var1.getGalaxy(); + Debug.dAssert(var2 != null); + Debug.dAssert(this.galaxy != null); + this.loadFriends(); + if(this.editItem != null) { + this.editItem.setEnabled(true); + } + + this.sendAll(var1); + } + + public void maybeServerDisconnect() { + if(this.galaxy != null) { + if(this.editItem != null) { + this.editItem.setEnabled(false); + } + + this.clearAll(); + } + + } + + public static boolean tryToRun(String var0) { + try { + Runtime.getRuntime().exec(var0); + return true; + } catch (IOException var2) { + return false; + } + } + + private boolean maybeFriendAction(Object var1) { + if (var1 == this.fremoveItem || var1 == this.droneAddItem) { + if (this.mayAddNameListName(Console.getFrame())) { + if (!icontains(friends, this.activeFriendName)) { + this.addNameListName(this.activeFriendName); + Console.println(MessageFormat.format(Console.message("added-status"), new String[]{this.activeFriendName})); + } else { + this.removeNameListName(friends.indexOf(this.activeFriendName)); + Console.println(MessageFormat.format(Console.message("removed-status"), new String[]{this.activeFriendName})); + } + } + } else if (var1 == this.droneTarItem) { + if (this.console.getTars().mayAddNameListName(Console.getFrame())) { + if (!icontains(this.console.getTars().tars, this.activeFriendName)) { + this.console.getTars().addNameListName(this.activeFriendName); + } else { + this.console.getTars().removeNameListName(this.console.getTars().tars.indexOf(this.activeFriendName)); + } + } + + } else if (var1 == this.whisperItem || var1 == this.droneWhisperItem) { + Console.startWhispering(this.activeFriendName); + } else if (var1 == this.emailItem || var1 == this.droneEmailItem) { + EMailPart.showMessage(this.console, this.activeFriendName); + } else if (var1 == this.teleportItem || var1 == this.whereIsItem) { + synchronized (this) { + this.teleportTarget = this.activeFriendName; + if (this.teleportState == 2 && this.teleportWaitSentMsg) { + Console.println(Console.message("Cancel-new-tele")); + } + + this.teleportState = var1 == this.teleportItem ? 1 : -1; + } + } else if (var1 == this.muteItem || var1 == this.droneMuteItem) { + this.console.getMutes().addNameListName(this.activeFriendName); + } else if (var1 == this.infoItem || var1 == this.droneInfoItem) { + new PersonalInfoDownload(this.activeFriendName, this.console); + } else if (var1 == this.tradeItem || var1 == this.droneTradeItem) { + WhisperManager.whisperManager().startToTrade(this.activeFriendName); + } else { + return false; + } + + return true; + } + + private void clearAll() { + if(this.galaxy != null) { + synchronized(this.friendsMutex) { + this.onlineFriends.removeAllElements(); + this.mutedOnlineFriends.removeAllElements(); + } + + if(active == this) { + this.repaint(); + } + + this.galaxy.sentFriendsList(false); + } + + } + + private void sendAll(WorldServer var1) { + if(!this.galaxy.sentFriendsList()) { + synchronized(this.friendsMutex) { + int var3 = this.friends.size(); + int var4 = 0; + + while(true) { + if(var4 >= var3) { + break; + } + + sendMsg(var1, new BuddyListUpdateCmd((String)this.friends.elementAt(var4), 1)); + ++var4; + } + } + + this.galaxy.sentFriendsList(true); + } + + } + + private static String getWorldName(String var0) { + int var1 = var0.indexOf(".world#"); + int var2; + return var1 != -1 && ((var2 = var0.lastIndexOf(47, var1)) != -1 || (var2 = var0.lastIndexOf(58, var1)) != -1)?var0.substring(var2 + 1, var1):null; + } + + public static void processWhisper(WorldServer var0, String var1, String var2) { + if(active != null && active.galaxy == var0.getGalaxy()) { + active.instanceProcessWhisper(var0, var1, var2); + } + + } + + private boolean allowTeleport(String player) { + int value = IniFile.gamma().getIniInt("TeleportPrivacy", 0); + if (value != 0) { + if (value == 1 && icontains(friends, player)) return true; + else return false; + } else return true; + } + + private void sendTeleportReject(String var1) { + Object[] var2 = new Object[]{"teleport", var1}; + Console.println(MessageFormat.format(Console.message("rejected"), var2)); + } + + private synchronized void instanceProcessWhisper(WorldServer var1, String var2, String var3) { + if(var3.startsWith("&|+where?")) { + if (allowTeleport(var2)) { + Pilot var4; + String var5; + if ((var4 = Pilot.getActive()) != null && (var5 = ((Pilot) var4).getTeleportURL()) != null) { + if (this.console.getSpecialGuest()) { + int var6 = var5.indexOf(60); + int var7 = var5.indexOf(62); + var5 = var5.substring(0, var6) + var5.substring(var7 + 1); + } + + if (Pilot.getActive().getRoom().getAllowTeleport()) { + sendMsg(var1, new whisperCmd(var2, "&|+where>" + var5)); + } + } } else { - var14 = new Object[]{new String(this.teleportTarget), new String(var11)}; - var8 = MessageFormat.format(Console.message("Cant-go-world"), var14); - Console.println(var8); - } - - this.teleportState = 0; - this.teleportTarget = null; - } - } else if (var3.startsWith("&|+voicechat")) { - this.chatter.handleChatWhisper(var2, var3, this.console); - } else if (var3.startsWith(VoiceChat.VCdebugCommand)) { - VoiceChat.setExtra(var3); - } else if (var3.startsWith(VoiceChat.VCdebugCommandReset)) { - VoiceChat.resetExtra(); - } - - } - - public int getNameListCount() { - return this.friends.size(); - } - - public String getNameListName(int var1) { - return (String)this.friends.elementAt(var1); - } - - public void removeNameListName(int var1) { - synchronized(this.friendsMutex) { - String var3 = (String)this.friends.elementAt(var1); - this.friends.removeElementAt(var1); - this.saveFriends(); - if ((var1 = iindexOf(this.onlineFriends, var3)) != -1) { - this.onlineFriends.removeElementAt(var1); - if (active == this) { - this.repaint(); - } - } - - if ((var1 = iindexOf(this.mutedOnlineFriends, var3)) != -1) { - this.mutedOnlineFriends.removeElementAt(var1); - } - - this.serverUpdates.addElement(new BuddyListUpdateCmd(var3, 0)); - } - } - - public boolean mayAddNameListName(java.awt.Window var1) { - if (this.friends.size() < maxFriends) { - return true; - } else { - Object[] var2 = new Object[]{new String("" + maxFriends)}; - new OkCancelDialog(var1, (DialogReceiver)null, Console.message("Too-many-names"), (String)null, Console.message("OK"), MessageFormat.format(Console.message("You-are-limitedF"), var2), true); - return false; - } - } - - public int addNameListName(String var1) { - synchronized(this.friendsMutex) { - int var3 = iindexOf(this.friends, var1); - if (var3 != -1) { - return var3; - } else { - this.friends.addElement(var1); + if (IniFile.modPrivacy().getIniInt("TeleportFeedback", 0) == 1) sendTeleportReject(var2); + if (IniFile.modPrivacy().getIniInt("TeleportResponse", 0) == 1) sendMsg(var1, new whisperCmd(var2, Console.message("not-teleports"))); + } + } else if(var3.startsWith("&|+where>")) { + boolean var11 = this.teleportState == 2 && this.teleportTarget.equals(var2); + if (var11 || this.teleportState == -2) { + String var10 = var3.substring("&|+where>".length()); + boolean var12 = false; + String var13 = getWorldName((String) var10); + String var9; + if (!((String) var10).startsWith("home:") && !((String) var10).startsWith("http://")) { + if (var13 != null && var13.length() > 0) { + Pilot var8 = Pilot.getActive(); + if (var8 != null) { + var9 = ((Pilot) var8).getTeleportURL(); + if (var9 != null && var13.equals(getWorldName(var9))) { + var12 = true; + var10 = var9.substring(0, var9.lastIndexOf(35)) + ((String) var10).substring(((String) var10).lastIndexOf(35)); + } + } + } + + if (!var12) { + String var14 = WorldsMarkPart.findPackage(var13); + if (var14 != null) { + var12 = true; + var10 = "home:" + (String) var14 + "/" + (String) var14 + ".world" + ((String) var10).substring(((String) var10).lastIndexOf(35)); + } + } + } else { + var12 = true; + } + + Object[] var15; + if (var12) { + if (var11) { + TeleportAction.teleport((String) var10, (TeleportStatus) null); + } else { + Console.println(var2 + ": " + (String) var10); + } + + if (this.teleportWaitSentMsg) { + var15 = new Object[]{new String(this.teleportTarget)}; + Console.println(MessageFormat.format(Console.message("Found-tele"), (Object[]) var15)); + } + } else { + var15 = new Object[]{new String(this.teleportTarget), new String(var13)}; + var9 = MessageFormat.format(Console.message("Cant-go-world"), (Object[]) var15); + Console.println(var9); + } + + this.teleportState = 0; + this.teleportTarget = null; + } + } + } + + public int getNameListCount() { + return this.friends.size(); + } + + public String getNameListName(int var1) { + return (String)this.friends.elementAt(var1); + } + + public void removeNameListName(int var1) { + synchronized(this.friendsMutex) { + String var3 = (String)this.friends.elementAt(var1); + this.friends.removeElementAt(var1); this.saveFriends(); - this.serverUpdates.addElement(new BuddyListUpdateCmd(var1, 1)); - return this.friends.size() - 1; - } - } - } - - public static void droneClick(Drone var0, MouseDownEvent var1) { - if (active != null) { - active.instanceDroneClick(var0, var1); - } - - } - - private void instanceDroneClick(Drone var1, MouseDownEvent var2) { - String var3 = var1.getLongID(); - if (var3 != null) { - this.activeFriendName = var3; - Object[] var4 = new Object[]{new String(this.activeFriendName)}; - this.droneAddItem = new MenuItem(MessageFormat.format(Console.message("Add-to-friends"), var4)); - this.droneMenu.remove(0); - this.droneAddItem.setFont(font); - this.droneMenu.insert(this.droneAddItem, 0); - this.droneAddItem.setEnabled(!icontains(this.friends, this.activeFriendName)); - if (this.actionMenu != null) { - this.droneMenu.remove(this.actionMenu); - } - - if (var1 instanceof PosableDrone) { - PosableDrone var5 = (PosableDrone)var1; - PosableShape var6 = var5.getInternalPosableShape(); - if (var6 != null) { - this.actionMenu = new Menu(Console.message("Actions")); - if (AnimatedActionManager.get().buildActionMenu(this.actionMenu, var6)) { - this.droneMenu.add(this.actionMenu); - this.actionMenu.addActionListener(AnimatedActionManager.get()); - } - } - } - - this.droneMenu.show(this.console.getRender(), var2.x, var2.y); - } - - } - - public static void processBuddyListNotify(WorldServer var0, String var1, int var2) { - Galaxy var3 = var0.getGalaxy(); - Enumeration var4 = var3.getConsoles(); - - Object var5; - FriendsListPart var6; - while(var4.hasMoreElements()) { - var5 = var4.nextElement(); - if (var5 instanceof DefaultConsole) { - var6 = ((DefaultConsole)var5).getFriends(); - if (var2 < 2) { - boolean var7 = MuteListPart.isMuted(var0, var1); - if (var2 == 1) { - var6.addOnlineFriend(var1, var7); - } else { - var6.removeOnlineFriend(var1, var7); - } + if((var1 = iindexOf(this.onlineFriends, var3)) != -1) { + this.onlineFriends.removeElementAt(var1); + if(active == this) { + this.repaint(); + } + } + + if((var1 = iindexOf(this.mutedOnlineFriends, var3)) != -1) { + this.mutedOnlineFriends.removeElementAt(var1); + } + + this.serverUpdates.addElement(new BuddyListUpdateCmd(var3, 0)); + } + } + + public boolean mayAddNameListName(Window var1) { + return true; + } + + public int addNameListName(String var1) { + synchronized(this.friendsMutex) { + int var3 = iindexOf(this.friends, var1); + if(var3 != -1) { + return var3; } else { - Debug.dAssert(var1.length() == 0); - var6.clearAll(); + this.friends.addElement(var1); + this.saveFriends(); + this.serverUpdates.addElement(new BuddyListUpdateCmd(var1, 1)); + return this.friends.size() - 1; + } + } + } + + public static void droneClick(Drone var0, MouseDownEvent var1) { + if(active != null) { + active.instanceDroneClick(var0, var1); + } + + } + + private String parseVersion(int v) { + switch (v) { + case 2003110800: + return "1890"; + case 2004081600: + return "1904"; + case 2004111200: + return "1920a"; + case 2012071402: + return "1920"; + case 2020031200: + return "1922a10"; + default: + return String.valueOf(v); + } + } + + private void instanceDroneClick(Drone var1, MouseDownEvent var2) { + String var3 = var1.getLongID(); + if(var3 != null) { + this.activeFriendName = var3; + Object[] var4 = new Object[]{this.activeFriendName}; + this.droneAddItem = new MenuItem(icontains(this.friends, this.activeFriendName) ? MessageFormat.format("Remove {0} from friends list", var4) : MessageFormat.format(Console.message("Add-to-friends"), var4)); + this.droneTarItem = new MenuItem(this.console.getFriends().icontains(this.console.getTars().tars, this.activeFriendName) ? "Enable Avatar" : "Disable Avatar"); + + this.droneMenu.remove(0); + this.droneAddItem.setFont(font); + this.droneMenu.insert(this.droneAddItem, 0); + + this.droneMenu.remove(1); + this.droneTarItem.setFont(font); + this.droneMenu.insert(this.droneTarItem, 1); + + if(this.actionMenu != null) { + this.droneMenu.remove(this.actionMenu); + } + + if(var1 instanceof PosableDrone) { + PosableDrone var5 = (PosableDrone)var1; + PosableShape var6 = var5.getInternalPosableShape(); + if(var6 != null) { + this.actionMenu = new Menu(Console.message("Actions")); + if(AnimatedActionManager.get().buildActionMenu(this.actionMenu, var6)) { + this.droneMenu.add(this.actionMenu); + this.actionMenu.addActionListener(AnimatedActionManager.get()); + } + } + } + + this.droneMenu.show(this.console.getRender(), var2.x, var2.y); + } + + } + + public static void processBuddyListNotify(WorldServer var0, String var1, int var2) { + Galaxy var3 = var0.getGalaxy(); + Enumeration var4 = var3.getConsoles(); + + Object var5; + NET.worlds.console.FriendsListPart var6; + while(var4.hasMoreElements()) { + var5 = var4.nextElement(); + if(var5 instanceof DefaultConsole) { + var6 = ((DefaultConsole)var5).getFriends(); + if(var2 < 2) { + boolean var7 = MuteListPart.isMuted(var0, var1); + if(var2 == 1) { + var6.addOnlineFriend(var1, var7); + } else { + var6.removeOnlineFriend(var1, var7); + } + } else { + Debug.dAssert(var1.length() == 0); + var6.clearAll(); + } + } + } + + if(var2 == 2) { + var4 = var3.getConsoles(); + + while(var4.hasMoreElements()) { + var5 = var4.nextElement(); + if(var5 instanceof DefaultConsole) { + var6 = ((DefaultConsole)var5).getFriends(); + var6.sendAll(var0); + } + } + } + } + + public static String ilookup(Vector var0, String var1) { + int var2 = var0.size(); + + for(int var3 = 0; var3 < var2; ++var3) { + String var4 = (String)var0.elementAt(var3); + if(var4.equalsIgnoreCase(var1)) { + return var4; + } + } + + return null; + } + + public static int iindexOf(Vector var0, String var1) { + int var2 = var0.size(); + + for(int var3 = 0; var3 < var2; ++var3) { + String var4 = (String)var0.elementAt(var3); + if(var4.equalsIgnoreCase(var1)) { + return var3; + } + } + + return -1; + } + + public static boolean icontains(Vector var0, String var1) { + return iindexOf(var0, var1) != -1; + } + + public void changeMuteState(String var1, boolean var2) { + synchronized(this.friendsMutex) { + if(icontains(this.friends, var1)) { + if(var2) { + var1 = ilookup(this.onlineFriends, var1); + if(var1 != null) { + this.removeOnlineFriend(var1, false); + this.addOnlineFriend(var1, true); + } + } else { + var1 = ilookup(this.mutedOnlineFriends, var1); + if(var1 != null) { + this.removeOnlineFriend(var1, true); + this.addOnlineFriend(var1, false); + } + } + } + + } + } + + private void listChanged() { + this.cursedButton = -1; + this.clickedButton = -1; + this.clickedButtonDown = false; + this.repaint(); + } + + private void addOnlineFriend(String var1, boolean var2) { + synchronized(this.friendsMutex) { + if(this.friends != null && icontains(this.friends, var1)) { + if(!var2 && !icontains(this.onlineFriends, var1)) { + this.onlineFriends.addElement(var1); + if(active == this) { + this.listChanged(); + if(this.moreFriendsDialog != null) { + this.moreFriendsDialog.addName(var1); + } + if (IniFile.modPrivacy().getIniInt("ShowStatusUpdate", 0) == 1) Console.println(MessageFormat.format("{0} is now online.", new String[]{var1})); + } + } else if(var2 && !icontains(this.mutedOnlineFriends, var1)) { + this.mutedOnlineFriends.addElement(var1); + } + } + + } + } + + private void removeOnlineFriend(String var1, boolean var2) { + synchronized(this.friendsMutex) { + if(!var2) { + int var4 = this.onlineFriends.indexOf(var1); + if(var4 != -1) { + this.onlineFriends.removeElementAt(var4); + if(active == this) { + this.listChanged(); + if(this.moreFriendsDialog != null) { + this.moreFriendsDialog.removeName(var4); + } + if (IniFile.modPrivacy().getIniInt("ShowStatusUpdate", 0) == 1) Console.println(MessageFormat.format("{0} quit.", new String[]{var1})); + } + } + } else { + this.mutedOnlineFriends.removeElement(var1); } - } - } - if (var2 == 2) { - var4 = var3.getConsoles(); + } + } + + public void dialogDone(Object var1, boolean var2) { + System.out.println("TEST FRIEND"); + synchronized(this.friendsMutex) { + if(var1 == this.moreFriendsDialog) { + this.moreFriendsDialog = null; + } + + } + } + + public static boolean isValidUserName(String var0) { + String var1 = "_-"; + var0 = Console.parseUnicode(var0); + int var2 = var0.length(); + if(var2 >= 2 && var2 <= 16) { + char[] var3 = var0.toCharArray(); + + for(int var4 = 0; var4 < var2; ++var4) { + if(!Character.isLetterOrDigit(var3[var4]) && var1.indexOf(var3[var4]) == -1) { + return false; + } + } + + return true; + } else { + return false; + } + } + + void moreFriendsAction(String var1, MenuItem var2) { + this.activeFriendName = var1; + this.maybeFriendAction(var2); + } - while(var4.hasMoreElements()) { - var5 = var4.nextElement(); - if (var5 instanceof DefaultConsole) { - var6 = ((DefaultConsole)var5).getFriends(); - var6.sendAll(var0); - break; - } - } - } - - } - - public static String ilookup(Vector var0, String var1) { - int var2 = var0.size(); - - for(int var3 = 0; var3 < var2; ++var3) { - String var4 = (String)var0.elementAt(var3); - if (var4.equalsIgnoreCase(var1)) { - return var4; - } - } - - return null; - } - - public static int iindexOf(Vector var0, String var1) { - int var2 = var0.size(); - - for(int var3 = 0; var3 < var2; ++var3) { - String var4 = (String)var0.elementAt(var3); - if (var4.equalsIgnoreCase(var1)) { - return var3; - } - } - - return -1; - } - - public static boolean icontains(Vector var0, String var1) { - return iindexOf(var0, var1) != -1; - } - - public void changeMuteState(String var1, boolean var2) { - synchronized(this.friendsMutex) { - if (icontains(this.friends, var1)) { - if (var2) { - var1 = ilookup(this.onlineFriends, var1); - if (var1 != null) { - this.removeOnlineFriend(var1, false); - this.addOnlineFriend(var1, true); - } - } else { - var1 = ilookup(this.mutedOnlineFriends, var1); - if (var1 != null) { - this.removeOnlineFriend(var1, true); - this.addOnlineFriend(var1, false); - } - } - } - - } - } - - private void listChanged() { - this.cursedButton = -1; - this.clickedButton = -1; - this.clickedButtonDown = false; - this.repaint(); - } - - private void addOnlineFriend(String var1, boolean var2) { - synchronized(this.friendsMutex) { - if (this.friends != null && icontains(this.friends, var1)) { - if (!var2 && !icontains(this.onlineFriends, var1)) { - this.onlineFriends.addElement(var1); - if (active == this) { - this.listChanged(); - if (this.moreFriendsDialog != null) { - this.moreFriendsDialog.addName(var1); - } - } - } else if (var2 && !icontains(this.mutedOnlineFriends, var1)) { - this.mutedOnlineFriends.addElement(var1); - } - } - - } - } - - private void removeOnlineFriend(String var1, boolean var2) { - synchronized(this.friendsMutex) { - if (!var2) { - int var4 = this.onlineFriends.indexOf(var1); - if (var4 != -1) { - this.onlineFriends.removeElementAt(var4); - if (active == this) { - this.listChanged(); - if (this.moreFriendsDialog != null) { - this.moreFriendsDialog.removeName(var4); - } - } - } - } else { - this.mutedOnlineFriends.removeElement(var1); - } - - } - } - - public void dialogDone(Object var1, boolean var2) { - synchronized(this.friendsMutex) { - if (var1 == this.moreFriendsDialog) { - this.moreFriendsDialog = null; - } - - } - } - - public static boolean isValidUserName(String var0) { - String var1 = "_-"; - var0 = Console.parseUnicode(var0); - int var2 = var0.length(); - if (var2 >= 2 && var2 <= 16) { - char[] var3 = var0.toCharArray(); - - for(int var4 = 0; var4 < var2; ++var4) { - if (!Character.isLetterOrDigit(var3[var4]) && var1.indexOf(var3[var4]) == -1) { - return false; - } - } - - return true; - } else { - return false; - } - } - - void moreFriendsAction(String var1, MenuItem var2) { - this.activeFriendName = var1; - Debug.assert(this.activeFriendName != null); - this.maybeFriendAction(var2); - } } diff -ruN a/1904/NET/worlds/console/Gamma.java b/1904/NET/worlds/console/Gamma.java --- a/1904/NET/worlds/console/Gamma.java 2020-08-06 15:46:20.000000000 -0500 +++ b/1904/NET/worlds/console/Gamma.java 2023-12-15 20:25:12.000000000 -0600 @@ -8,8 +8,10 @@ import NET.worlds.scape.TeleportAction; import NET.worlds.scape.TeleportStatus; import NET.worlds.scape.World; +import NET.worldsplus.Themer; import java.awt.Button; import java.awt.Color; +import java.awt.Cursor; import java.awt.Dimension; import java.awt.Frame; import java.awt.GridBagConstraints; @@ -29,530 +31,539 @@ import java.util.StringTokenizer; public class Gamma implements Runnable, MainCallback, TeleportStatus { - private static SplashScreen splash = null; - public static ProgressBar loadProgress; - static final int LOAD_PROGRESS_STEPS = 12; - static final float failVersion = 1.13F; - private static String _home = "file:"; - private static String _dllPath = "home:"; - private static Hashtable _params = new Hashtable(); - private static boolean _autoplay = false; - static Shaper shaper; - private String startingURL; - private String loadErr; - - static boolean checkVersion(String var0) { - StringTokenizer var1 = new StringTokenizer(var0, "._"); - float var2 = 0.0F; - - try { - Integer var3 = new Integer(var1.nextToken()); - var2 = (float)var3; - var3 = new Integer(var1.nextToken()); - float var4 = var3.floatValue() / 10.0F; - if (var4 >= 1.0F) { + private static SplashScreen splash = null; + public static ProgressBar loadProgress; + static final int LOAD_PROGRESS_STEPS = 12; + static final float failVersion = 1.13F; + private static String _home = "file:"; + private static String _dllPath = "home:"; + private static Hashtable _params = new Hashtable(); + private static boolean _autoplay = false; + static Shaper shaper; + private String startingURL; + private String loadErr; + + static boolean checkVersion(String var0) { + StringTokenizer var1 = new StringTokenizer(var0, "._"); + float var2 = 0.0F; + + try { + Integer var3 = new Integer(var1.nextToken()); + var2 = var3.floatValue(); + var3 = new Integer(var1.nextToken()); + float var4 = var3.floatValue() / 10.0F; + if (!(var4 < 1.0F)) { + return true; + } + + var2 += var4; + var3 = new Integer(var1.nextToken()); + var4 = var3.floatValue() / 100.0F; + var2 += var4; + } catch (NoSuchElementException var9) { + } + + if (var2 <= 1.13F) { + BlockingDialog var10 = new BlockingDialog(new Frame(), "Worlds.com: Error", true); + GridBagLayout var11 = new GridBagLayout(); + var10.setLayout(var11); + var10.setSize(200, 150); + MultiLineLabel var5 = new MultiLineLabel("Your system's Java Virtual Machine\nis out of date. Please download our\nfull installer and try again."); + GridBagConstraints var6 = new GridBagConstraints(); + var6.gridx = 0; + var6.gridy = 0; + var11.setConstraints(var5, var6); + var10.add(var5); + Button var7 = new Button("OK"); + var7.addActionListener(var10); + GridBagConstraints var8 = new GridBagConstraints(); + var8.gridx = 0; + var8.gridy = 1; + var11.setConstraints(var7, var8); + var10.add(var7); + var10.validate(); + var10.show(); + var10.waitForResponse(); + return false; + } else { return true; - } + } + } - var2 += var4; - var3 = new Integer(var1.nextToken()); - var4 = var3.floatValue() / 100.0F; - var2 += var4; - } catch (NoSuchElementException var9) { - } - - if (var2 <= 1.13F) { - BlockingDialog var10 = new BlockingDialog(new Frame(), "Worlds.com: Error", true); - GridBagLayout var11 = new GridBagLayout(); - var10.setLayout(var11); - var10.setSize(200, 150); - MultiLineLabel var5 = new MultiLineLabel("Your system's Java Virtual Machine\nis out of date. Please download our\nfull installer and try again."); - GridBagConstraints var6 = new GridBagConstraints(); - var6.gridx = 0; - var6.gridy = 0; - var11.setConstraints(var5, var6); - var10.add(var5); - Button var7 = new Button("OK"); - var7.addActionListener(var10); - GridBagConstraints var8 = new GridBagConstraints(); - var8.gridx = 0; - var8.gridy = 1; - var11.setConstraints(var7, var8); - var10.add(var7); - var10.validate(); - var10.show(); - var10.waitForResponse(); - return false; - } else { - return true; - } - } - - public static void main(String[] var0) { - String var1 = parseCommandLine(var0); - String var2 = System.getProperty("java.version"); - if (!checkVersion(var2)) { - System.exit(0); - } - - String var3 = System.getProperty("java.vendor"); - System.out.println("User running java version " + var2 + " from vendor " + System.getProperty("java.vendor")); - String var4 = "winawt"; - String var5 = "net"; - boolean var6 = false; - if (var3.indexOf("Microsoft") != -1) { - var4 = "MSAWT"; - var5 = "MSNET32"; - var6 = true; - } - - System.out.println("Loading: " + earlyURLUnalias(_dllPath + "gamma.dll")); - System.load(earlyURLUnalias(_dllPath + "gamma.dll")); - if (var6) { - Window.doMicrosoftVMHacks(); - } - - if (IniFile.gamma().getIniInt("MULTIRUN", 0) == 0 && !Startup.synchronizeStartup(var1, _autoplay)) { - System.exit(0); - } - - if (var2.charAt(2) <= '1' && !var6) { - try { - System.loadLibrary(var4); - } catch (UnsatisfiedLinkError var35) { - } - - try { - System.loadLibrary(var5); - } catch (UnsatisfiedLinkError var34) { - } - } else { - if (!var6) { - var4 = "awt"; - } - - new Color(0, 0, 0); - - try { - URL var8 = new URL("http://127.0.0.1/"); - URLConnection var9 = var8.openConnection(); - var9.connect(); - } catch (MalformedURLException var36) { - } catch (IOException var37) { - } - } - - if (!var6) { - Window.hookWinAPIs(var4); - } - - String var7 = earlyURLUnalias("home:worlds.ini"); - Std.initProductName(); - IniFile var38 = IniFile.override(); - String var39 = var38.getIniString("splashgif", Console.message("Opnscrnc.gif")); - splash = new SplashScreen(GammaFrame.getDefaultTitle(), var39); - splash.show(); - splash.toFront(); - String var10 = IniFile.gamma().getIniString("Proxy Server IP", ""); - String var11 = IniFile.gamma().getIniString("Proxy Server Port", ""); - if (var10.length() > 7) { - Properties var12 = System.getProperties(); - System.out.println("Using Proxy Server: " + var10 + ":" + var11); - var12.remove("socksProxyHost"); - var12.remove("socksProxyPort"); - var12.put("socksProxyHost", var10); - var12.put("socksProxyPort", var11); - System.setProperties(var12); - } - - loadProgress = new ProgressBar("Loading Worldsplayer...", 12); - Dimension var14 = splash.getSize(); - Dimension var15 = loadProgress.getSize(); - int var40 = splash.getLocationOnScreen().x + (var14.width >> 1) - (var15.width >> 1); - int var13 = splash.getLocationOnScreen().y + var14.height; - loadProgress.setLocation(var40, var13); - loadProgress.show(); - java.awt.Cursor var16 = java.awt.Cursor.getPredefinedCursor(3); - loadProgress.setCursor(var16); - splash.setCursor(var16); - if (var7.length() > 1 && var7.charAt(1) == ':') { - Startup.computeVolumeInfo("" + var7.charAt(0) + ":\\"); - } else { - Startup.computeVolumeInfo((String)null); - } - - try { - LogFile.open(); - Gamma var17 = new Gamma(var1); - Main.register(var17); - if (loadProgress != null) { - loadProgress.setMessage("Starting main thread..."); - loadProgress.advance(); - } - - Thread var18 = new Thread(var17, "Gamma Main"); - var18.setDaemon(true); - var18.start(); - new Gamma.PriorityAdjuster(var18); - if (loadProgress != null) { - loadProgress.setMessage("Initializing ActiveX..."); - loadProgress.advance(); - } - - new Netscape(); - - try { - var18.join(); - } catch (InterruptedException var30) { - throw new Error(var30.toString()); - } - - GammaFrame var20 = Console.getFrame(); - if (var20 != null) { - var20.setVisible(false); - } - } catch (OutOfMemoryError var31) { - System.out.println("ERROR: Ran out of memory!!"); - System.out.println("Details: " + var31); - } catch (Throwable var32) { - System.out.println("Uncaught throwable: " + var32); - } finally { - LogFile.close(); - } - - System.exit(0); - } - - public static void hideSplash() { - if (splash != null) { - splash.hide(); - splash.dispose(); - splash = null; - if (loadProgress != null) { - loadProgress.hide(); - loadProgress.dispose(); - loadProgress = null; - } - } - - } - - public static String earlyURLUnalias(String var0) { - if (var0.startsWith("home:")) { - var0 = _home + var0.substring(5); - } - - if (var0.startsWith("file:")) { - var0 = var0.substring(5); - } - - var0 = var0.replace('\\', '/'); - if (var0.length() < 2 || var0.charAt(1) != ':' && !var0.startsWith("//")) { - String var1 = System.getProperty("user.dir").replace('\\', '/'); - if (!var1.endsWith("/")) { - var1 = var1 + "/"; - } - - var0 = var1 + var0; - } - - return var0; - } - - public static String getParam(String var0) { - return (String)_params.get(var0); - } - - private static String parseCommandLine(String[] var0) { - String var1 = null; - - for(int var2 = 0; var2 < var0.length; ++var2) { - if (var0[var2].length() > 0 && var0[var2].charAt(0) == '-') { - if (var0[var2].equalsIgnoreCase("-help")) { - usage("Help message"); - } else if (var0[var2].equalsIgnoreCase("-home")) { - ++var2; - if (var2 == var0.length) { - usage("-home must be followed by a path:"); - } - - _home = "file:" + var0[var2]; - System.out.println("Home: " + var0[var2]); - } else if (var0[var2].equalsIgnoreCase("-dllpath")) { - ++var2; - if (var2 == var0.length) { - usage("-dllpath must be followed by a path:"); - } - - _dllPath = var0[var2]; - } else if (!var0[var2].equalsIgnoreCase("-set")) { - if (var0[var2].equalsIgnoreCase("-autoplay")) { - _autoplay = true; - } else if (!var0[var2].equalsIgnoreCase("-embedding") && !var0[var2].equalsIgnoreCase("/embedding") && !var0[var2].equalsIgnoreCase("-automation") && !var0[var2].equalsIgnoreCase("/automation")) { - usage("Unrecognized command line option: " + var0[var2]); - } - } else { - label57: { - ++var2; - if (var2 != var0.length) { - ++var2; - if (var2 != var0.length) { - break label57; - } - } + public static void main(String[] var0) { + String var1 = parseCommandLine(var0); + String var2 = System.getProperty("java.version"); + if (!checkVersion(var2)) { + System.exit(0); + } + + String var3 = System.getProperty("java.vendor"); + System.out.println("User running java version " + var2 + " from vendor " + System.getProperty("java.vendor")); + String var4 = "winawt"; + String var5 = "net"; + boolean var6 = false; + if (var3.indexOf("Microsoft") != -1) { + var4 = "MSAWT"; + var5 = "MSNET32"; + var6 = true; + } + + System.out.println("Loading: " + earlyURLUnalias(_dllPath + "gamma.dll")); + System.load(earlyURLUnalias(_dllPath + "gamma.dll")); + System.load(earlyURLUnalias(_dllPath + "mumbleworlds.dll")); + if (var6) { + Window.doMicrosoftVMHacks(); + } + + if (IniFile.gamma().getIniInt("MULTIRUN", 0) == 0 && !Startup.synchronizeStartup(var1, _autoplay)) { + System.exit(0); + } - usage("-set must be followed by a name of a parameter to set and its value"); - } + if (var2.charAt(2) <= '1' && !var6) { + try { + System.loadLibrary(var4); + } catch (UnsatisfiedLinkError var35) { + } - _params.put(var0[var2 - 1], var0[var2]); + try { + System.loadLibrary(var5); + } catch (UnsatisfiedLinkError var34) { } - } else { - if (var1 != null) { - usage("There may be only one command-line world URL"); + } else { + if (!var6) { + var4 = "awt"; } - var1 = var0[var2]; - } - } - - _home = makeEndWithSlash(_home); - _dllPath = makeEndWithSlash(_dllPath); - return var1; - } - - private static String makeEndWithSlash(String var0) { - if (!var0.endsWith("\\") && !var0.endsWith("/") && !var0.endsWith(":")) { - var0 = var0 + "\\"; - } - - return var0; - } + new Color(0, 0, 0); - public static void usage(String var0) { - System.out.println("Usage: javaw {-java_options} NET.worlds.console.Gamma {-options} WorldURL\nWorldURL is optional, the default world is the first WorldsMark.\nYes, it's gross, but the 'NET.worlds.console.Gamma' is required\nSome useful -java_options:\n -classpath Path Class search path [default is CLASSPATH env var]\n-options:\n -help Print this message (still runs Gamma)\n -home HomeDir Gamma home directory [defaults to current dir]\n -dllpath DLLPath Path to the native code DLL [current directory]\n -set Name Value Set the named parameter to the specified value"); - throw new Error(var0); - } - - public static String getHome() { - return _home; - } - - public static String getExePath() { - return getHome() + "bin\\"; - } + try { + URL var8 = new URL("http://127.0.0.1/"); + URLConnection var9 = var8.openConnection(); + var9.connect(); + } catch (MalformedURLException var36) { + } catch (IOException var37) { + } + } + + if (!var6) { + Window.hookWinAPIs(var4); + } + + new Themer(); + + String var7 = earlyURLUnalias("home:worlds.ini"); + Std.initProductName(); + String var39 = Themer.themer.asset(Console.message("Opnscrnc.gif")); + splash = new SplashScreen(GammaFrame.getDefaultTitle(), var39); + splash.show(); + splash.toFront(); + String var10 = IniFile.gamma().getIniString("Proxy Server IP", ""); + String var11 = IniFile.gamma().getIniString("Proxy Server Port", ""); + if (var10.length() > 7) { + Properties var12 = System.getProperties(); + System.out.println("Using Proxy Server: " + var10 + ":" + var11); + var12.remove("socksProxyHost"); + var12.remove("socksProxyPort"); + var12.put("socksProxyHost", var10); + var12.put("socksProxyPort", var11); + System.setProperties(var12); + } + + loadProgress = new ProgressBar("Loading Worldsplayer...", 12); + Dimension var14 = splash.getSize(); + Dimension var15 = loadProgress.getSize(); + int var40 = splash.getLocationOnScreen().x + (var14.width >> 1) - (var15.width >> 1); + int var13 = splash.getLocationOnScreen().y + var14.height; + loadProgress.setLocation(var40, var13); + loadProgress.show(); + Cursor var16 = Cursor.getPredefinedCursor(3); + loadProgress.setCursor(var16); + splash.setCursor(var16); + if (var7.length() > 1 && var7.charAt(1) == ':') { + Startup.computeVolumeInfo("" + var7.charAt(0) + ":\\"); + } else { + Startup.computeVolumeInfo((String)null); + } + + try { + LogFile.open(); + Gamma var17 = new Gamma(var1); + Main.register(var17); + if (loadProgress != null) { + loadProgress.setMessage("Starting main thread..."); + loadProgress.advance(); + } + + Thread var18 = new Thread(var17, "Gamma Main"); + var18.setDaemon(true); + var18.start(); + new Gamma.PriorityAdjuster(var18); + if (loadProgress != null) { + loadProgress.setMessage("Initializing ActiveX..."); + loadProgress.advance(); + } - public static void dllLoad(String var0) { - System.load(NET.worlds.network.URL.make(_dllPath + var0).unalias()); - } + new Netscape(); - public static Shaper getShaper() { - return shaper; - } + try { + var18.join(); + } catch (InterruptedException var30) { + throw new Error(var30.toString()); + } + + GammaFrame var20 = Console.getFrame(); + if (var20 != null) { + var20.setVisible(false); + } + } catch (OutOfMemoryError var31) { + System.out.println("ERROR: Ran out of memory!!"); + System.out.println("Details: " + var31); + } catch (Throwable var32) { + System.out.println("Uncaught throwable: " + var32); + } finally { + LogFile.close(); + } + + System.exit(0); + } + + public static void hideSplash() { + if (splash != null) { + splash.hide(); + splash.dispose(); + splash = null; + if (loadProgress != null) { + loadProgress.hide(); + loadProgress.dispose(); + loadProgress = null; + } + } + + } + + public static String earlyURLUnalias(String var0) { + if (var0.startsWith("home:")) { + var0 = _home + var0.substring(5); + } + + if (var0.startsWith("file:")) { + var0 = var0.substring(5); + } + + var0 = var0.replace('\\', '/'); + if (var0.length() < 2 || var0.charAt(1) != ':' && !var0.startsWith("//")) { + String var1 = System.getProperty("user.dir").replace('\\', '/'); + if (!var1.endsWith("/")) { + var1 = var1 + "/"; + } + + var0 = var1 + var0; + } + + return var0; + } + + public static String getParam(String var0) { + return (String)_params.get(var0); + } + + private static String parseCommandLine(String[] var0) { + String var1 = null; + + for(int var2 = 0; var2 < var0.length; ++var2) { + if (var0[var2].length() > 0 && var0[var2].charAt(0) == '-') { + if (var0[var2].equalsIgnoreCase("-help")) { + usage("Help message"); + } else if (var0[var2].equalsIgnoreCase("-home")) { + ++var2; + if (var2 == var0.length) { + usage("-home must be followed by a path:"); + } + + _home = "file:" + var0[var2]; + System.out.println("Home: " + var0[var2]); + } else if (var0[var2].equalsIgnoreCase("-dllpath")) { + ++var2; + if (var2 == var0.length) { + usage("-dllpath must be followed by a path:"); + } + + _dllPath = var0[var2]; + } else if (!var0[var2].equalsIgnoreCase("-set")) { + if (var0[var2].equalsIgnoreCase("-autoplay")) { + _autoplay = true; + } else if (!var0[var2].equalsIgnoreCase("-embedding") && !var0[var2].equalsIgnoreCase("/embedding") && !var0[var2].equalsIgnoreCase("-automation") && !var0[var2].equalsIgnoreCase("/automation")) { + usage("Unrecognized command line option: " + var0[var2]); + } + } else { + label57: { + ++var2; + if (var2 != var0.length) { + ++var2; + if (var2 != var0.length) { + break label57; + } + } - public static boolean shaperEnabled() { - return IniFile.gamma().getIniInt("DISABLESHAPER", 1) == 0 || IniFile.override().getIniInt("DISABLESHAPER", 1) == 0; - } + usage("-set must be followed by a name of a parameter to set and its value"); + } - private Gamma(String var1) { - this.startingURL = var1; - } + _params.put(var0[var2 - 1], var0[var2]); + } + } else { + if (var1 != null) { + usage("There may be only one command-line world URL"); + } + + var1 = var0[var2]; + } + } + + _home = makeEndWithSlash(_home); + _dllPath = makeEndWithSlash(_dllPath); + return var1; + } + + private static String makeEndWithSlash(String var0) { + if (!var0.endsWith("\\") && !var0.endsWith("/") && !var0.endsWith(":")) { + var0 = var0 + "\\"; + } + + return var0; + } + + public static void usage(String var0) { + System.out.println("Usage: javaw {-java_options} NET.worlds.console.Gamma {-options} WorldURL\nWorldURL is optional, the default world is the first WorldsMark.\nYes, it's gross, but the 'NET.worlds.console.Gamma' is required\nSome useful -java_options:\n -classpath Path Class search path [default is CLASSPATH env var]\n-options:\n -help Print this message (still runs Gamma)\n -home HomeDir Gamma home directory [defaults to current dir]\n -dllpath DLLPath Path to the native code DLL [current directory]\n -set Name Value Set the named parameter to the specified value"); + throw new Error(var0); + } + + public static String getHome() { + return _home; + } + + public static String getExePath() { + return getHome() + "bin\\"; + } + + public static void dllLoad(String var0) { + System.load(NET.worlds.network.URL.make(_dllPath + var0).unalias()); + } + + public static Shaper getShaper() { + return shaper; + } + + public static boolean shaperEnabled() { + return true; + //return IniFile.gamma().getIniInt("DISABLESHAPER", 1) == 0 || IniFile.override().getIniInt("DISABLESHAPER", 1) == 0; + } + + private Gamma(String var1) { + this.startingURL = var1; + } + + private void die(Throwable var1) { + var1.printStackTrace(System.out); + if (getShaper() != null) { + Console.println(Console.message("Saving-modified")); + Enumeration var2 = World.getWorlds(); + + while(true) { + World var3; + do { + if (!var2.hasMoreElements()) { + return; + } + + var3 = (World)var2.nextElement(); + } while(!var3.getEdited()); + + String var4 = var3.getSourceURL().unalias(); + if (var4.toLowerCase().endsWith(".wor")) { + var4 = var4.substring(0, var4.length() - 4); + } + + if (var4.toLowerCase().endsWith(".world")) { + var4 = var4.substring(0, var4.length() - 6); + } + + int var5 = var4.lastIndexOf("-"); + if (var5 != -1) { + for(int var6 = var5 + 1; var6 < var4.length(); ++var6) { + if (!Character.isDigit(var4.charAt(var6))) { + var5 = -1; + break; + } + } + } + + if (var5 != -1) { + var4 = var4.substring(0, var5); + } + + String var12 = var4 + ".world"; + + for(int var7 = 1; (new File(var12)).exists(); ++var7) { + var12 = var4 + "-" + var7 + ".world"; + } + + Object[] var8 = new Object[]{new String(var3.getName()), new String("" + var3.getSourceURL()), new String(var12)}; + Console.println(MessageFormat.format(Console.message("Saving-name"), var8)); + + try { + Shaper.doSave(var12, var3, false); + } catch (Exception var10) { + Console.println(Console.message("Ignoring") + var10); + } catch (Error var11) { + Console.println(Console.message("Ignoring") + var11); + } + } + } + } + + public void run() { + Main.register(new Gamma.RecordPosition()); + + try { + Main.mainLoop(); + } catch (Throwable var2) { + this.die(var2); + } + + } + + public void mainCallback() { + Main.unregister(this); + if (NetUpdate.doUpdate(false)) { + Main.end(); + } else { + File var1 = new File(earlyURLUnalias("home:bin")); + File var2 = new File(var1, "gdkup.prg"); + File var3 = new File(var1, "gdkup.exe"); + int var7; + if (var2.exists() && (!var3.exists() || var2.lastModified() > var3.lastModified())) { + if (var3.exists()) { + var3.delete(); + } + + try { + FileInputStream var4 = new FileInputStream(var2); + FileOutputStream var5 = new FileOutputStream(var3); + byte[] var6 = new byte[8192]; + + while((var7 = var4.read(var6)) > 0) { + var5.write(var6, 0, var7); + } + + var4.close(); + var5.close(); + } catch (Exception var10) { + var10.printStackTrace(System.out); + throw new Error("Can't copy gdkup.prg"); + } + } + + if (shaperEnabled()) { + shaper = new Shaper(); + } + + IniFile var11 = IniFile.override(); + String var12 = Themer.themer.asset(Console.message("Pwc.gif")); + int var13 = Themer.override().getIniInt("splashxover", 141); + var7 = Themer.override().getIniInt("splashyover", 140); + if (var13 >= 0) { + splash.addOverlay(var12, var13, var7); + } + + if (loadProgress != null) { + loadProgress.setMessage("Teleporting to start location..."); + loadProgress.advance(); + } - private void die(Throwable var1) { - var1.printStackTrace(System.out); - if (getShaper() != null) { - Console.println(Console.message("Saving-modified")); - Enumeration var2 = World.getWorlds(); + try { + TeleportAction.teleport(this.startingURL, this, false); + } catch (Exception var9) { + this.loadErr = "Couldn't teleport to " + this.startingURL + ": " + var9; + } - while(true) { - World var3; - do { - if (!var2.hasMoreElements()) { - return; - } + if (this.loadErr != null) { + System.out.println(this.loadErr); + this.loadErr = null; + TeleportAction.teleport("world:", this, false); + if (this.loadErr != null) { + this.loadErr = null; + TeleportAction.teleport("home:NewWorld.world", this, false); + if (this.loadErr != null) { + Main.end(); + return; + } + } + + Main.register(new Gamma.StartupTeleport()); + } + + new MusicManager(); + } + } - var3 = (World)var2.nextElement(); - } while(!var3.getEdited()); + public void teleportStatus(String var1, String var2) { + if (var1 == null) { + this.loadErr = null; + } else { + this.loadErr = var1; + } - String var4 = var3.getSourceURL().unalias(); - if (var4.toLowerCase().endsWith(".wor")) { - var4 = var4.substring(0, var4.length() - 4); - } + } - if (var4.toLowerCase().endsWith(".world")) { - var4 = var4.substring(0, var4.length() - 6); - } + class StartupTeleport implements MainCallback { + StartupTeleport() { + } - int var5 = var4.lastIndexOf("-"); - if (var5 != -1) { - for(int var6 = var5 + 1; var6 < var4.length(); ++var6) { - if (!Character.isDigit(var4.charAt(var6))) { - var5 = -1; - break; - } - } - } + public void mainCallback() { + if (Console.getFrame() != null && Console.getFrame().isShowing()) { + Main.unregister(this); - if (var5 != -1) { - var4 = var4.substring(0, var5); + try { + TeleportAction.teleport(Gamma.this.startingURL, Gamma.this, true); + } catch (Exception var2) { + } } - String var12 = var4 + ".world"; + } + } - for(int var7 = 1; (new File(var12)).exists(); ++var7) { - var12 = var4 + "-" + var7 + ".world"; - } + public class RecordPosition implements MainCallback, MainTerminalCallback { + public RecordPosition() { + } - Object[] var8 = new Object[]{new String(var3.getName()), new String("" + var3.getSourceURL()), new String(var12)}; - Console.println(MessageFormat.format(Console.message("Saving-name"), var8)); + public void mainCallback() { + } - try { - Shaper.doSave(var12, var3, false); - } catch (Exception var10) { - Console.println(Console.message("Ignoring") + var10); - } catch (Error var11) { - Console.println(Console.message("Ignoring") + var11); - } - } - } - } - - public void run() { - Main.register(new Gamma.RecordPosition()); - - try { - Main.mainLoop(); - } catch (Throwable var2) { - this.die(var2); - } - - } - - public void mainCallback() { - Main.unregister(this); - if (NetUpdate.doUpdate(false)) { - Main.end(); - } else { - File var1 = new File(earlyURLUnalias("home:bin")); - File var2 = new File(var1, "gdkup.prg"); - File var3 = new File(var1, "gdkup.exe"); - int var7; - if (var2.exists() && (!var3.exists() || var2.lastModified() > var3.lastModified())) { - if (var3.exists()) { - var3.delete(); + public void terminalCallback() { + Pilot var1 = Pilot.getActive(); + if (var1 != null) { + IniFile.gamma().setIniString("RestartAt", var1.getURL()); } - try { - FileInputStream var4 = new FileInputStream(var2); - FileOutputStream var5 = new FileOutputStream(var3); - byte[] var6 = new byte[8192]; - - while((var7 = var4.read(var6)) > 0) { - var5.write(var6, 0, var7); - } - - var4.close(); - var5.close(); - } catch (Exception var10) { - var10.printStackTrace(System.out); - throw new Error("Can't copy gdkup.prg"); - } - } - - if (shaperEnabled()) { - shaper = new Shaper(); - } - - IniFile var11 = IniFile.override(); - String var12 = var11.getIniString("splashover", Console.message("Pwc.gif")); - int var13 = var11.getIniInt("splashxover", 141); - var7 = var11.getIniInt("splashyover", 140); - if (var13 >= 0) { - splash.addOverlay(var12, var13, var7); - } - - if (loadProgress != null) { - loadProgress.setMessage("Teleporting to start location..."); - loadProgress.advance(); - } - - try { - TeleportAction.teleport(this.startingURL, this, false); - } catch (Exception var9) { - this.loadErr = "Couldn't teleport to " + this.startingURL + ": " + var9; - } - - if (this.loadErr != null) { - System.out.println(this.loadErr); - this.loadErr = null; - TeleportAction.teleport("world:", this, false); - if (this.loadErr != null) { - this.loadErr = null; - TeleportAction.teleport("home:NewWorld.world", this, false); - if (this.loadErr != null) { - Main.end(); - return; - } - } - - Main.register(new Gamma.StartupTeleport()); - } - - new MusicManager(); - } - } - - public void teleportStatus(String var1, String var2) { - if (var1 == null) { - this.loadErr = null; - } else { - this.loadErr = var1; - } - - } - - class StartupTeleport implements MainCallback { - public void mainCallback() { - if (Console.getFrame() != null && Console.getFrame().isShowing()) { Main.unregister(this); + } + } - try { - TeleportAction.teleport(Gamma.this.startingURL, Gamma.this, true); - } catch (Exception var2) { + static class PriorityAdjuster implements MainCallback { + private Thread mainThread; + boolean wasActivated = true; + + PriorityAdjuster(Thread var1) { + this.mainThread = var1; + this.mainThread.setPriority(5); + Main.register(this); + } + + public void mainCallback() { + if (Window.isActivated() != this.wasActivated) { + this.wasActivated = !this.wasActivated; + this.mainThread.setPriority(this.wasActivated ? 5 : 1); } - } - - } - } - - public class RecordPosition implements MainCallback, MainTerminalCallback { - public void mainCallback() { - } - - public void terminalCallback() { - Pilot var1 = Pilot.getActive(); - if (var1 != null) { - IniFile.gamma().setIniString("RestartAt", var1.getURL()); - } - - Main.unregister(this); - } - } - - static class PriorityAdjuster implements MainCallback { - private Thread mainThread; - boolean wasActivated = true; - - PriorityAdjuster(Thread var1) { - this.mainThread = var1; - this.mainThread.setPriority(5); - Main.register(this); - } - - public void mainCallback() { - if (Window.isActivated() != this.wasActivated) { - this.wasActivated = !this.wasActivated; - this.mainThread.setPriority(this.wasActivated ? 5 : 1); - } - } - } + } + } } diff -ruN a/1904/NET/worlds/console/GammaTextArea.java b/1904/NET/worlds/console/GammaTextArea.java --- a/1904/NET/worlds/console/GammaTextArea.java 2020-08-06 15:46:20.000000000 -0500 +++ b/1904/NET/worlds/console/GammaTextArea.java 2023-09-10 15:53:40.000000000 -0500 @@ -2,515 +2,827 @@ import NET.worlds.core.Debug; import NET.worlds.core.IniFile; -import java.awt.Color; -import java.awt.Font; -import java.awt.FontMetrics; -import java.awt.Graphics; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Panel; -import java.awt.Scrollbar; -import java.awt.event.AdjustmentEvent; -import java.awt.event.AdjustmentListener; -import java.awt.event.FocusEvent; +import NET.worlds.network.URL; +import NET.worlds.scape.*; +import NET.worldsplus.Themer; + +import java.awt.*; +import java.awt.datatransfer.Clipboard; +import java.awt.datatransfer.ClipboardOwner; +import java.awt.datatransfer.StringSelection; +import java.awt.event.*; import java.awt.event.KeyEvent; +import java.awt.event.MouseEvent; +import java.io.*; import java.util.StringTokenizer; import java.util.Vector; -public class GammaTextArea extends Panel implements AdjustmentListener { - public static final int SCROLLBARS_BOTH = 1; - public static final int SCROLLBARS_VERTICAL_ONLY = 2; - public static final int SCROLLBARS_HORIZONTAL_ONLY = 3; - public static final int SCROLLBARS_NONE = 4; - protected static final int _margin = 2; - private int _width; - private int _height; - private StyledTextCanvas _canvas; - private String _string; - private Font _font; - private int _currentStyle; - private String _currentFontName; - private int _currentPointSize; - private Color _currentColor; - private GammaTextScrollbar _vertBar; - private GammaTextScrollbar _horzBar; - private int _numLines; - private int _canvasLines; - private int _scrollLine; - private Vector _lines; - private boolean _hasFocus; - public static String boldStartTag = ""; - public static String boldEndTag = ""; - public static String italicStartTag = ""; - public static String italicEndTag = ""; - public static String colorStartMagentaTag = ""; - public static String colorStartBlueTag = ""; - public static String colorStartRedTag = ""; - public static String colorStartGreenTag = ""; - public static String colorEndTag = ""; - public static String colorMagenta2Tag = ""; - public static String colorBlue2Tag = ""; - public static String colorRed2Tag = ""; - public static String colorGreen2Tag = ""; - public static String colorCyanTag = ""; - public static String colorDarkGrayTag = ""; - public static String colorGrayTag = ""; - public static String colorOrangeTag = ""; - public static String colorPinkTag = ""; - public static String colorYellowTag = ""; - public static String colorWhiteTag = ""; - public static String colorLightGrayTag = ""; - protected static String[] tagList; - - public Font getFont() { - return this._font; - } - - public int getWidth() { - return this._width; - } - - public int getHeight() { - return this._height; - } - - public void setWidth(int var1) { - this._width = var1 - 4; - } - - public void setHeight(int var1) { - this._height = var1 - 4; - } - - public Vector getLines() { - return this._lines; - } - - public int getScrollLine() { - return this._scrollLine; - } - - public int getCanvasLines() { - return this._canvasLines; - } - - public int getNumLines() { - return this._numLines; - } - - public boolean getHasFocus() { - return this._hasFocus; - } - - public Scrollbar getVertScrollbar() { - return this._vertBar; - } - - static Color getBackgroundColor() { - int var0 = IniFile.override().getIniInt("chatBgR", 255); - int var1 = IniFile.override().getIniInt("chatBgG", 255); - int var2 = IniFile.override().getIniInt("chatBgB", 203); - return new Color(var0, var1, var2); - } - - GammaTextArea(String var1, int var2, int var3, int var4) { - this._string = var1; - this._currentFontName = Console.message("GammaTextFont"); - this._currentStyle = 0; - this._currentPointSize = 12; - this._currentColor = Color.black; - this._font = new Font(this._currentFontName, this._currentStyle, this._currentPointSize); - this._canvas = new StyledTextCanvas(); - FontMetrics var5 = this._canvas.getFontMetrics(this._font); - Debug.dAssert(var5 != null); - int var6 = var5.getHeight(); - int var7 = var5.charWidth('M') * var3; - int var8 = var5.getHeight() * var2; - this._canvas.setSize(var7, var8); - this.setWidth(var7); - this.setHeight(var8); - this._lines = new Vector(); - this._hasFocus = false; - this._numLines = this._scrollLine = this._canvasLines = 0; - switch(var4) { - case 1: - this._vertBar = new GammaTextScrollbar(1); - this._horzBar = new GammaTextScrollbar(0); - break; - case 2: - this._vertBar = new GammaTextScrollbar(1); - this._horzBar = null; - break; - case 3: - this._vertBar = null; - this._horzBar = new GammaTextScrollbar(0); - break; - case 4: - this._vertBar = this._horzBar = null; - } - - GridBagLayout var9 = new GridBagLayout(); - this.setLayout(var9); - GridBagConstraints var10 = new GridBagConstraints(); - var10.fill = 1; - var10.weightx = 1.0D; - var10.weighty = 1.0D; - var9.setConstraints(this._canvas, var10); - this.add(this._canvas); - if (this._vertBar != null) { - var10 = new GridBagConstraints(); - var10.fill = 3; - var10.gridwidth = 0; - var9.setConstraints(this._vertBar, var10); - this.add(this._vertBar); - this._vertBar.addAdjustmentListener(this); - } - - if (this._horzBar != null) { - var10 = new GridBagConstraints(); - var10.fill = 2; - var10.gridwidth = 1; - this.add(this._horzBar); - this._horzBar.addAdjustmentListener(this); - } - - this.enableEvents(31L); - this._canvas.repaint(); - } - - public void update(Graphics var1) { - this.paint(var1); - } - - protected void processFocusEvent(FocusEvent var1) { - if (var1.getID() == 1004) { - this._hasFocus = true; - } else if (var1.getID() == 1005) { - this._hasFocus = false; - } - - this._canvas.repaint(); - super.processFocusEvent(var1); - } - - protected void processKeyEvent(KeyEvent var1) { - this._canvas.dispatchEvent(var1); - super.processKeyEvent(var1); - } - - public void adjustmentValueChanged(AdjustmentEvent var1) { - this._scrollLine = this._vertBar.getValue(); - this._canvas.repaint(); - } - - public void setEditable(boolean var1) { - if (var1) { - System.out.println("Can't set GammaTextArea to be editable."); - } - - } - - public synchronized String getText() { - return this._string; - } - - public synchronized void setText(String var1) { - this._string = var1; - this.wordWrapAll(); - this._scrollLine = this._numLines - this._canvasLines; - if (this._scrollLine < 0) { - this._scrollLine = 0; - } - - this.setScrollBounds(); - } - - public void repaint() { - this._canvas.repaint(); - super.repaint(); - } - - protected synchronized void wordWrapAll() { - this._lines.removeAllElements(); - this._numLines = 0; - this.wordWrap(this._string); - } - - protected boolean isLastLineVisible() { - return this._scrollLine == this._numLines - this._canvasLines || this._numLines <= this._canvasLines; - } - - protected boolean handleTag(String var1) { - if (var1.charAt(0) != '<') { - return false; - } else { - for(int var2 = 0; var2 < tagList.length; ++var2) { - if (var1.equals(tagList[var2])) { - switch(var2) { - case 0: - this._currentStyle |= 1; - break; - case 1: - this._currentStyle &= -2; - break; - case 2: - this._currentStyle |= 2; - break; - case 3: - this._currentStyle &= -3; - break; - case 4: - this._currentColor = Color.magenta; - break; - case 5: - this._currentColor = Color.red; - break; - case 6: - this._currentColor = Color.green; - break; - case 7: - this._currentColor = Color.blue; - break; - case 8: - this._currentColor = Color.black; - break; - case 9: - this._currentColor = Color.magenta; - break; - case 10: - this._currentColor = Color.blue; - break; - case 11: - this._currentColor = Color.red; - break; - case 12: - this._currentColor = Color.green; - break; - case 13: - this._currentColor = Color.cyan; - break; - case 14: - this._currentColor = Color.darkGray; - break; - case 15: - this._currentColor = Color.gray; - break; - case 16: - this._currentColor = Color.orange; - break; - case 17: - this._currentColor = Color.pink; - break; - case 18: - this._currentColor = Color.yellow; - break; - case 19: - this._currentColor = Color.white; - break; - case 20: - this._currentColor = Color.lightGray; - } - - try { - this._font = new Font(this._currentFontName, this._currentStyle, this._currentPointSize); - } catch (IllegalArgumentException var4) { - } - - return true; - } - } - - return false; - } - } - - protected void ClearTags(Graphics var1) { - if (this._currentStyle != 0) { - this._currentStyle = 0; - this._font = new Font(this._currentFontName, this._currentStyle, this._currentPointSize); - } - - if (this._currentColor != Color.black) { - this._currentColor = Color.black; - } - - var1.setFont(this._font); - var1.setColor(this._currentColor); - } - - protected synchronized void wordWrap(String var1) { - int var2 = this._width; - if (var2 > 0) { - StringTokenizer var3 = new StringTokenizer(var1, "\n\r"); - - label74: - while(var3.hasMoreTokens()) { - String var4 = var3.nextToken(); - StringTokenizer var5 = new StringTokenizer(var4, "\n\r\t -", true); - int var6 = 0; - String var7 = ""; - int var8 = 0; - FontMetrics var9 = this._canvas.getFontMetrics(this._font); - Debug.dAssert(var9 != null); - - while(true) { - while(true) { - String var10; - do { - do { - if (!var5.hasMoreTokens()) { - if (!var7.equals("")) { - ++this._numLines; - this._lines.addElement(var7.trim()); - } - continue label74; +public class GammaTextArea extends Panel implements AdjustmentListener, ActionListener { + public static final int SCROLLBARS_BOTH = 1; + public static final int SCROLLBARS_VERTICAL_ONLY = 2; + public static final int SCROLLBARS_HORIZONTAL_ONLY = 3; + public static final int SCROLLBARS_NONE = 4; + protected static final int _margin = 2; + private int _width; + private int _height; + private StyledTextCanvas _canvas; + private String _string; + private Font _font; + private int _currentStyle; + private String _currentFontName; + private int _currentPointSize; + private Color _currentColor; + private GammaTextScrollbar _vertBar; + private GammaTextScrollbar _horzBar; + private int _numLines; + private int _canvasLines; + private int _scrollLine; + private Vector _lines; + private Vector _pos; + private int _lastpos = 0; + protected int _curpos = 0; + private boolean _hasFocus; + protected int selectionStart = -1; + protected int selectionEnd = -1; + private static final Color skyblue = new Color(135, 206, 255); + private PopupMenu rightMenu; + private MenuItem textCopyItem = new MenuItem(Console.message("Copy")); + private MenuItem textCopyTextItem = new MenuItem(Console.message("Copy Text")); + private MenuItem textCopyAllItem = new MenuItem(Console.message("Copy All")); + private MenuItem textCopyAllTextItem = new MenuItem(Console.message("Copy All Text")); + private MenuItem textSaveItem = new MenuItem(Console.message("Save All Text")); + private MenuItem textOpenURLItem = new MenuItem(Console.message("Open URL")); + static Color bgColor = null; + private int _numColumns; + private int _numRows; + private static int scrollWheelStep = IniFile.gamma().getIniInt("ScrollWheelStep", 3); + public static String boldStartTag = ""; + public static String boldEndTag = ""; + public static String italicStartTag = ""; + public static String italicEndTag = ""; + public static String colorStartMagentaTag = ""; + public static String colorStartBlueTag = ""; + public static String colorStartRedTag = ""; + public static String colorStartGreenTag = ""; + public static String colorEndTag = ""; + public static String colorMagenta2Tag = ""; + public static String colorBlue2Tag = ""; + public static String colorRed2Tag = ""; + public static String colorGreen2Tag = ""; + public static String colorCyanTag = ""; + public static String colorDarkGrayTag = ""; + public static String colorGrayTag = ""; + public static String colorOrangeTag = ""; + public static String colorPinkTag = ""; + public static String colorYellowTag = ""; + public static String colorWhiteTag = ""; + public static String colorLightGrayTag = ""; + protected static String[] tagList; + private int lastWidth = 0; + protected boolean selectionConversion = false; + protected int _initialSelection = -1; + + public Font getFont() { + return this._font; + } + + public int getWidth() { + return this._width; + } + + public int getHeight() { + return this._height; + } + + public void setWidth(int var1) { + this._width = var1 - 4; + } + + public void setHeight(int var1) { + this._height = var1 - 4; + } + + public Vector getLines() { + return this._lines; + } + + public int getScrollLine() { + return this._scrollLine; + } + + public int getCanvasLines() { + return this._canvasLines; + } + + public int getNumLines() { + return this._numLines; + } + + public boolean getHasFocus() { + return this._hasFocus; + } + + public Scrollbar getVertScrollbar() { + return this._vertBar; + } + + static Color getBackgroundColor() { + if (bgColor == null) { + int bgR = Themer.override().getIniInt("chatBgR", 255); + int bgG = Themer.override().getIniInt("chatBgG", 255); + int bgB = Themer.override().getIniInt("chatBgB", 203); + bgColor = new Color(bgR, bgG, bgB); + } + + return bgColor; + } + + GammaTextArea(String text, int rows, int columns, int scrollbars) { + this._string = text; + this._numColumns = columns; + this._numRows = rows; + this._currentFontName = Console.message("GammaTextFont"); + this._currentStyle = 0; + this._currentPointSize = IniFile.gamma().getIniInt("ChatFontSize", 12); + this._currentColor = Color.black; + this._canvas = new StyledTextCanvas(); + this.setFontSize(this._currentPointSize); + this._lines = new Vector(); + this._pos = new Vector(); + this._lastpos = 0; + this._hasFocus = false; + this._numLines = this._scrollLine = this._canvasLines = 0; + switch(scrollbars) { + case 1: + this._vertBar = new GammaTextScrollbar(1); + this._horzBar = new GammaTextScrollbar(0); + break; + case 2: + this._vertBar = new GammaTextScrollbar(1); + this._horzBar = null; + break; + case 3: + this._vertBar = null; + this._horzBar = new GammaTextScrollbar(0); + break; + case 4: + this._vertBar = this._horzBar = null; + } + + GridBagLayout gridbag = new GridBagLayout(); + this.setLayout(gridbag); + GridBagConstraints c = new GridBagConstraints(); + c.fill = 1; + c.weightx = 1.0D; + c.weighty = 1.0D; + gridbag.setConstraints(this._canvas, c); + this.add(this._canvas); + if (this._vertBar != null) { + c = new GridBagConstraints(); + c.fill = 3; + c.gridwidth = 0; + gridbag.setConstraints(this._vertBar, c); + this.add(this._vertBar); + this._vertBar.addAdjustmentListener(this); + } + + if (this._horzBar != null) { + c = new GridBagConstraints(); + c.fill = 2; + c.gridwidth = 1; + this.add(this._horzBar); + this._horzBar.addAdjustmentListener(this); + } + + this.enableEvents(131231L); + this._canvas.repaint(); + } + + public synchronized void setFontSize(int fontsize) { + this._currentPointSize = fontsize; + this._font = new Font(this._currentFontName, this._currentStyle, this._currentPointSize); + this.recalcSize(); + } + + public synchronized void recalcSize() { + FontMetrics fm = this._canvas.getFontMetrics(this._font); + + if (fm == null) throw new AssertionError(); + + int w = fm.charWidth('M') * this._numColumns; + int h = fm.getHeight() * this._numRows; + this.setWidth(w); + this.setHeight(h); + this._canvas.setSize(w, h); + this.setWidth(w); + this.setHeight(h); + } + + public void update(Graphics var1) { + this.paint(var1); + } + + protected synchronized void processMouseEvent(MouseEvent e) { + if (e.isPopupTrigger()) { + if (this.rightMenu != null && this.rightMenu.isEnabled()) { + this.hideRightMenu(); + } else { + this.showRightMenu(e.getX(), e.getY()); + } + } + + super.processMouseEvent(e); + } + + protected synchronized void processFocusEvent(FocusEvent e) { + if (e.getID() == 1004) { + this._hasFocus = true; + } else if (e.getID() == 1005) { + this._hasFocus = false; + } + + this._canvas.repaint(); + super.processFocusEvent(e); + } + + protected synchronized void processKeyEvent(KeyEvent e) { + this._canvas.dispatchEvent(e); + super.processKeyEvent(e); + } + + protected synchronized void processMouseWheelEvent(MouseWheelEvent e) { + if (e.getID() == 507) { + int move; + if (e.getScrollType() == 0) { + move = e.getScrollAmount() * e.getWheelRotation(); + } else { + move = scrollWheelStep * e.getWheelRotation(); + } + + if (move != 0) { + this._vertBar.setValue(this._vertBar.getValue() + move); + this.requestFocus(); + this._canvas.sendDelayedMouseEvent(e); + this.adjustmentValueChanged((AdjustmentEvent)null); + } + } + + super.processMouseWheelEvent(e); + } + + public synchronized void adjustmentValueChanged(AdjustmentEvent e) { + this._scrollLine = this._vertBar.getValue(); + this._canvas.repaint(); + } + + public void setEditable(boolean var1) { + if (var1) { + System.out.println("Can't set GammaTextArea to be editable."); + } + + } + + public synchronized String getText() { + return this._string; + } + + public synchronized void setText(String s) { + this._string = s; + this.wordWrapAll(); + this._scrollLine = this._numLines - this._canvasLines; + if (this._scrollLine < 0) { + this._scrollLine = 0; + } + + this.setScrollBounds(); + } + + public synchronized void repaint() { + this._canvas.repaint(); + super.repaint(); + } + + protected synchronized void wordWrapAll() { + this._lines.removeAllElements(); + this._pos.removeAllElements(); + this._numLines = 0; + this._lastpos = 0; + this.wordWrap(this._string); + } + + protected synchronized boolean isLastLineVisible() { + if (!this._canvas.mouseActive && (this.selectionStart < 0 || this.selectionEnd <= this.selectionStart)) { + return this._scrollLine >= this._numLines - this._canvasLines || this._numLines <= this._canvasLines; + } else { + return false; + } + } + + protected synchronized boolean handleTag(Graphics g, String word, int x, int y) { + String lower = word.toLowerCase(); + int color; + if (word.charAt(0) == '<') { + for (color = 0; color < tagList.length; ++color) { + if (lower.equals(tagList[color].toLowerCase())) { + switch (color) { + case 0: + this._currentStyle |= 1; + break; + case 1: + this._currentStyle &= -2; + break; + case 2: + this._currentStyle |= 2; + break; + case 3: + this._currentStyle &= -3; + break; + case 4: + case 9: + this._currentColor = Color.magenta; + break; + case 5: + case 11: + this._currentColor = Color.red; + break; + case 6: + case 12: + this._currentColor = Color.green; + break; + case 7: + case 10: + this._currentColor = Color.blue; + break; + case 8: + this._currentColor = Color.black; + break; + case 13: + this._currentColor = Color.cyan; + break; + case 14: + this._currentColor = Color.darkGray; + break; + case 15: + this._currentColor = Color.gray; + break; + case 16: + this._currentColor = Color.orange; + break; + case 17: + this._currentColor = Color.pink; + break; + case 18: + this._currentColor = Color.yellow; + break; + case 19: + this._currentColor = Color.white; + break; + case 20: + this._currentColor = Color.lightGray; + } + + try { + this._font = new Font(this._currentFontName, this._currentStyle, this._currentPointSize); + } catch (IllegalArgumentException ignored) { + } + + return true; + } + } + + } + return false; + } + + protected void ClearTags(Graphics var1) { + if (this._currentStyle != 0) { + this._currentStyle = 0; + this._font = new Font(this._currentFontName, this._currentStyle, this._currentPointSize); + } + + if (this._currentColor != Color.black) { + this._currentColor = Color.black; + } + + var1.setFont(this._font); + var1.setColor(this._currentColor); + } + + protected synchronized void wordWrap(String newText) { + int canvasWidth = this._width; + if (canvasWidth > 0) { + StringTokenizer rawLines = new StringTokenizer(newText, "\n\r"); + + label82: + while(rawLines.hasMoreTokens()) { + String rawLine = rawLines.nextToken(); + StringTokenizer words = new StringTokenizer(rawLine, "\n\r\t -", true); + int lineWidth = 0; + StringBuffer thisLine = new StringBuffer(); + this.lastWidth = 0; + FontMetrics fm = this._canvas.getFontMetrics(this._font); + + if (fm == null) throw new AssertionError(); + + while(true) { + while(true) { + String word; + do { + do { + if (!words.hasMoreTokens()) { + if (!thisLine.toString().equals("")) { + this._pos.addElement(new Integer(this._lastpos)); + this._lastpos += thisLine.length() + 1; + ++this._numLines; + this._lines.addElement(thisLine.toString().trim()); + } + continue label82; + } + + word = words.nextToken(); + } while(word.equals("\n")); + } while(word.equals("\r")); + + if (this.handleTag((Graphics)null, word, 0, 0)) { + lineWidth -= this.lastWidth; + thisLine.append(word); + if (words.hasMoreTokens()) { + thisLine.append(words.nextToken()); + } + + this.lastWidth = 0; + fm = this._canvas.getFontMetrics(this._font); + + if (fm == null) throw new AssertionError(); + } else { + this.lastWidth = fm.stringWidth(word); + if (this.lastWidth >= canvasWidth) { + if (!thisLine.toString().equals("")) { + this._pos.addElement(new Integer(this._lastpos)); + this._lastpos += thisLine.length(); + this._lines.addElement(thisLine.toString().trim()); + ++this._numLines; + lineWidth = 0; + } + + while(this.lastWidth >= canvasWidth) { + word = this.breakWord(word, fm); + lineWidth = this.lastWidth = 0; + thisLine = new StringBuffer(); + if (word != null && word.length() > 0) { + this.lastWidth = fm.stringWidth(word); + } + } + } + + lineWidth += this.lastWidth; + if (lineWidth > 0 && word != null && word.length() > 0) { + if (lineWidth >= canvasWidth) { + this._pos.addElement(new Integer(this._lastpos)); + this._lastpos += thisLine.length(); + this._lines.addElement(thisLine.toString().trim()); + ++this._numLines; + lineWidth = this.lastWidth; + thisLine = new StringBuffer(); + } + + thisLine.append(word); + } } + } + } + } + + } + } + + protected String breakWord(String var1, FontMetrics var2) { + int var3 = 0; + StringBuffer var4 = new StringBuffer(); + + for(int var5 = 0; var5 < var1.length(); ++var5) { + char var6 = var1.charAt(var5); + var3 += var2.charWidth(var6); + if (var3 >= this._width) { + this._lines.addElement(var4.toString()); + ++this._numLines; + return var1.substring(var5); + } + + var4.append(var6); + } + + this._lines.addElement(var4.toString()); + ++this._numLines; + return ""; + } + + public synchronized void rewrap() { + if (this._width > 0 && this._height > 0) { + this.wordWrapAll(); + this._scrollLine = this._numLines - this._canvasLines; + if (this._scrollLine < 0) { + this._scrollLine = 0; + } - var10 = var5.nextToken(); - } while(var10.equals("\n")); - } while(var10.equals("\r")); - - if (this.handleTag(var10)) { - var6 -= var8; - var7 = var7 + var10; - if (var5.hasMoreTokens()) { - var7 = var7 + var5.nextToken(); - } - - var8 = 0; - var9 = this._canvas.getFontMetrics(this._font); - Debug.dAssert(var9 != null); - } else { - var8 = var9.stringWidth(var10); - if (var8 >= var2) { - if (!var7.equals("")) { - this._lines.addElement(var7.trim()); - ++this._numLines; - var6 = 0; + this.setScrollBounds(); + this._canvas.repaint(); + } + + } + + private synchronized void setScrollBounds() { + FontMetrics var1 = this._canvas.getFontMetrics(this._font); + Debug.dAssert(var1 != null); + int var2 = var1.getHeight(); + this._canvasLines = this._height / var2; + if (this._vertBar != null) { + if (this._numLines <= this._canvasLines) { + this._vertBar.setEnabled(false); + } else { + this._vertBar.setEnabled(true); + this._vertBar.setValues(this._scrollLine, this._canvasLines, 0, this._numLines); + this._vertBar.setBlockIncrement(this._canvasLines); + } + } + + } + + public synchronized void append(String var1) { + this._string = this._string + var1; + this.wordWrap(var1); + this._scrollLine = this._numLines - this._canvasLines; + if (this._scrollLine < 0) { + this._scrollLine = 0; + } + + this.setScrollBounds(); + } + + public synchronized void replaceRange(String var1, int var2, int var3) { + String var4 = this._string.substring(0, var2) + var1 + this._string.substring(var3); + this._string = var4; + } + + public synchronized void drawLine(Graphics g, int lineNum, int y) { + if (lineNum < this._pos.size()) { + String thisLine = (String)this._lines.elementAt(lineNum); + + if (thisLine == null) throw new AssertionError(); + + this._curpos = ((Integer)this._pos.elementAt(lineNum)).intValue(); + StringTokenizer st = new StringTokenizer(thisLine, " \n\r", true); + int x = 0; + this.lastWidth = 0; + + while(st.hasMoreTokens()) { + String word = st.nextToken(); + if (!this.handleTag(g, word, 2 + x, y + 2)) { + this.drawString(g, word, 2 + x, y + 2); + this.lastWidth = g.getFontMetrics().stringWidth(word); + x += this.lastWidth; + } else { + x -= this.lastWidth; + if (st.hasMoreTokens()) { + this._curpos += st.nextToken().length(); + } + + this.lastWidth = 0; + g.setFont(this._font); + g.setColor(this._currentColor); + this._curpos += word.length(); + } + } + + this.ClearTags(g); + } + } + + private void drawString(Graphics g, String text, int x, int y) { + FontMetrics fm = g.getFontMetrics(); + int startdist; + int i; + if (this.selectionConversion) { + startdist = fm.getHeight(); + int pos = -1; + if (y - startdist < this._canvas.mouseY) { + if (y < this._canvas.mouseY) { + if (y < this._canvas.mouseY) { + if (this.selectionStart >= 0) { + pos = this._curpos + text.length(); + } + } else { + this.selectionConversion = false; + } + } else if (x <= this._canvas.mouseX) { + if (this._canvas.mouseX > x + g.getFontMetrics().stringWidth(text)) { + if (this.selectionStart >= 0 && this._curpos >= this.selectionStart) { + pos = this._curpos + text.length(); } + } else { + if (this._canvas.mouseDoubleClick) { + this._canvas.mouseDoubleClick = false; + this.selectionStart = this._initialSelection = this._curpos; + this.selectionEnd = this._curpos + text.length(); + pos = -1; + } else { + for(i = 0; i < text.length() - 1 && x + fm.stringWidth(text.substring(0, i + 1)) < this._canvas.mouseX; ++i) { + } - while(var8 >= var2) { - var10 = this.breakWord(var10, var9); - var6 = 0; - var7 = ""; - var8 = var9.stringWidth(var10); + pos = this._curpos + i; } - } - var6 += var8; - if (var6 >= var2) { - this._lines.addElement(var7.trim()); - ++this._numLines; - var6 = var8; - var7 = ""; - } - - var7 = var7 + var10; - } - } - } - } - - } - } - - protected String breakWord(String var1, FontMetrics var2) { - int var3 = 0; - String var4 = ""; - - for(int var5 = 0; var5 < var1.length(); ++var5) { - char var6 = var1.charAt(var5); - var3 += var2.charWidth(var6); - if (var3 >= this._width) { - this._lines.addElement(var4); - ++this._numLines; - return var1.substring(var5); - } - - var4 = var4 + var6; - } - - this._lines.addElement(var4); - ++this._numLines; - return ""; - } - - public synchronized void rewrap() { - if (this._width > 0 && this._height > 0) { - this.wordWrapAll(); - this._scrollLine = this._numLines - this._canvasLines; - if (this._scrollLine < 0) { - this._scrollLine = 0; - } + this.selectionConversion = false; + } + } else { + this.selectionConversion = false; + } + } else if (this.selectionStart >= 0 && this._curpos >= this.selectionStart) { + this.selectionConversion = false; + } + + if (pos >= 0) { + if (this.selectionStart < 0) { + this.selectionStart = this._initialSelection = pos; + this.selectionEnd = this.selectionStart + 1; + } else if (pos < this._initialSelection) { + this.selectionStart = pos; + this.selectionEnd = this._initialSelection + 1; + } else { + this.selectionStart = this._initialSelection; + this.selectionEnd = pos + 1; + } + } + } + + if (this.selectionStart >= 0 && this.selectionEnd > this.selectionStart) { + startdist = this.selectionStart - this._curpos; + if (startdist > 0) { + if (startdist < text.length()) { + i = text.length(); + if (this._curpos + i >= this.selectionEnd) { + i = this.selectionEnd - this._curpos; + } + + this.drawHighlight(g, text.substring(startdist, i), x + fm.stringWidth(text.substring(0, startdist)), y); + } + } else if (this.selectionEnd > this._curpos) { + if (this.selectionEnd - this._curpos < text.length()) { + this.drawHighlight(g, text.substring(0, this.selectionEnd - this._curpos), x, y); + } else { + this.drawHighlight(g, text, x, y); + } + } + } + + g.drawString(text, x, y); + this._curpos += text.length(); + } + + private void drawHighlight(Graphics g, String text, int x, int y) { + if (text != null && text.length() > 0) { + Color c = g.getColor(); + g.setColor(skyblue); + int height = g.getFontMetrics().getHeight(); + g.fillRect(x, y - (height - 2), g.getFontMetrics().stringWidth(text), height); + g.setColor(c); + } + + } + + public int getSelectionStart() { + return this.selectionStart; + } + + public int getSelectionEnd() { + return this.selectionEnd; + } + + public void setSelectionStart(int position) { + this.selectionStart = position; + } + + public void setSelectionEnd(int position) { + this.selectionEnd = position; + } + + public synchronized String getSelectionText() { + if (this.selectionStart >= 0 && this.selectionEnd > this.selectionStart) { + return this.getText().substring(this.selectionStart, this.selectionEnd); + } else { + return ""; + } + } + + private void initRightMenu() { + this.rightMenu = new PopupMenu(); + this.rightMenu.add(this.textCopyItem); + this.rightMenu.add(this.textCopyTextItem); + if (this.selectionStart >= 0 && this.selectionEnd > this.selectionStart) { + this.textCopyItem.setEnabled(true); + this.textCopyTextItem.setEnabled(true); + } else { + this.textCopyItem.setEnabled(false); + this.textCopyTextItem.setEnabled(false); + } + + this.rightMenu.add(this.textCopyAllItem); + this.rightMenu.add(this.textCopyAllTextItem); + this.rightMenu.add(this.textSaveItem); + this.rightMenu.add(this.textOpenURLItem); + this.rightMenu.addActionListener(this); + this.add(this.rightMenu); + } + + private void showRightMenu(int x, int y) { + if (this.rightMenu == null) { + this.initRightMenu(); + } + + this.rightMenu.show(this, x, y); + } + + private void hideRightMenu() { + this.remove(this.rightMenu); + this.rightMenu = null; + } + + public synchronized void actionPerformed(ActionEvent e) { + String text = null; + boolean doClean = false; + if (e.getActionCommand() == this.textCopyItem.getActionCommand()) { + text = this.getSelectionText(); + this.selectionStart = this.selectionEnd = -1; + this.repaint(); + } else if (e.getActionCommand() == this.textCopyTextItem.getActionCommand()) { + text = this.getSelectionText(); + doClean = true; + this.selectionStart = this.selectionEnd = -1; + this.repaint(); + } else if (e.getActionCommand() == this.textCopyAllItem.getActionCommand()) { + text = this.getText(); + } else if (e.getActionCommand() == this.textCopyAllTextItem.getActionCommand()) { + text = this.getText(); + doClean = true; + } else if (e.getActionCommand() == this.textOpenURLItem.getActionCommand()) { + text = this.getSelectionText().trim(); + if (text != null && text.length() > 5) { + if (!text.startsWith("http://") && !text.startsWith("https://") && !text.startsWith("world:")) { + text = "http://" + text; + } + + if (text.startsWith("world:") || text.indexOf(".world#") != -1 || (text.startsWith("http") || text.startsWith("file:")) && text.endsWith(".world")) { + if (text.startsWith("world:")) { + text = text.substring(6); + } + + TeleportAction.teleport(text, (TeleportStatus)null); + } else { + (new SendURLAction(text)).startBrowser(); + } + + this.selectionStart = this.selectionEnd = -1; + this.repaint(); + } + + this.hideRightMenu(); + return; + } else if (e.getActionCommand() == this.textSaveItem.getActionCommand()) { + new ChatSavePart(this._string); + return; + } + + if (doClean) { + StringTokenizer st = new StringTokenizer(text, " \n\r", true); + String newText = ""; + + while(st.hasMoreTokens()) { + String word = st.nextToken(); + if (!this.handleTag((Graphics)null, word, 0, 0)) { + newText = newText + word; + } else { + if (newText.length() > 0 && newText.substring(newText.length() - 1).toCharArray()[0] == ' ') { + newText = newText.substring(0, newText.length() - 1); + } + + if (st.hasMoreTokens()) { + st.nextToken(); + } + } + } + + text = newText; + } - this.setScrollBounds(); - this._canvas.repaint(); - } - - } - - private void setScrollBounds() { - FontMetrics var1 = this._canvas.getFontMetrics(this._font); - Debug.dAssert(var1 != null); - int var2 = var1.getHeight(); - this._canvasLines = this._height / var2; - if (this._vertBar != null) { - if (this._numLines <= this._canvasLines) { - this._vertBar.setEnabled(false); - } else { - this._vertBar.setEnabled(true); - this._vertBar.setValues(this._scrollLine, this._canvasLines, 0, this._numLines); - this._vertBar.setBlockIncrement(this._canvasLines); - } - } - - } - - public void append(String var1) { - this._string = this._string + var1; - this.wordWrap(var1); - this._scrollLine = this._numLines - this._canvasLines; - if (this._scrollLine < 0) { - this._scrollLine = 0; - } - - this.setScrollBounds(); - } - - public void replaceRange(String var1, int var2, int var3) { - String var4 = this._string.substring(0, var2) + var1 + this._string.substring(var3); - this._string = var4; - } - - public void drawLine(Graphics var1, int var2, int var3) { - String var4 = (String)this._lines.elementAt(var2); - Debug.dAssert(var4 != null); - StringTokenizer var5 = new StringTokenizer(var4, " \n\r", true); - int var6 = 0; - int var7 = 0; - - while(var5.hasMoreTokens()) { - String var8 = var5.nextToken(); - if (!this.handleTag(var8)) { - var1.drawString(var8, 2 + var6, var3 + 2); - var7 = var1.getFontMetrics().stringWidth(var8); - var6 += var7; - } else { - var6 -= var7; - if (var5.hasMoreTokens()) { - var5.nextToken(); - } - - var7 = 0; - var1.setFont(this._font); - var1.setColor(this._currentColor); - } - } - - this.ClearTags(var1); - } - - static { - tagList = new String[]{boldStartTag, boldEndTag, italicStartTag, italicEndTag, colorStartMagentaTag, colorStartRedTag, colorStartGreenTag, colorStartBlueTag, colorEndTag, colorMagenta2Tag, colorBlue2Tag, colorRed2Tag, colorGreen2Tag, colorCyanTag, colorDarkGrayTag, colorGrayTag, colorOrangeTag, colorPinkTag, colorYellowTag, colorWhiteTag, colorLightGrayTag}; - } + if (text != null && text.length() > 0) { + Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); + clipboard.setContents(new StringSelection(text), (ClipboardOwner)null); + } + + this.hideRightMenu(); + } + + static { + tagList = new String[]{boldStartTag, boldEndTag, italicStartTag, italicEndTag, colorStartMagentaTag, colorStartRedTag, colorStartGreenTag, colorStartBlueTag, colorEndTag, colorMagenta2Tag, colorBlue2Tag, colorRed2Tag, colorGreen2Tag, colorCyanTag, colorDarkGrayTag, colorGrayTag, colorOrangeTag, colorPinkTag, colorYellowTag, colorWhiteTag, colorLightGrayTag}; + } } diff -ruN a/1904/NET/worlds/console/HiddenDrone.java b/1904/NET/worlds/console/HiddenDrone.java --- a/1904/NET/worlds/console/HiddenDrone.java 1969-12-31 18:00:00.000000000 -0600 +++ b/1904/NET/worlds/console/HiddenDrone.java 2023-08-21 23:27:16.000000000 -0500 @@ -0,0 +1,4 @@ +package NET.worlds.console; + +public interface HiddenDrone { +} diff -ruN a/1904/NET/worlds/console/MuteListPart.java b/1904/NET/worlds/console/MuteListPart.java --- a/1904/NET/worlds/console/MuteListPart.java 2020-08-06 15:46:22.000000000 -0500 +++ b/1904/NET/worlds/console/MuteListPart.java 2023-08-21 23:27:16.000000000 -0500 @@ -7,236 +7,284 @@ import NET.worlds.network.WorldServer; import NET.worlds.scape.Drone; import NET.worlds.scape.FrameEvent; -import java.awt.Container; -import java.awt.Event; -import java.awt.MenuItem; -import java.text.MessageFormat; + +import java.awt.*; +import java.awt.Window; import java.util.Enumeration; import java.util.StringTokenizer; import java.util.Vector; public class MuteListPart implements FramePart, NameListOwner { - private static final String oldIniItemName = "Mutes"; - private static final String iniItemName = "Mute"; - private static final int maxMutes = 50; - private static final String separator = ";"; - private static MuteListPart active; - private Vector mutes; - private Vector syncMutes = new Vector(); - private MenuItem editItem; - private MenuItem disableWhisperItem; - private boolean rejectWhispers; - private DefaultConsole console; - private Galaxy galaxy; - private IniFile serverSection; - private Object mutesMutex = new Object(); - private Vector updates = new Vector(); - - private void loadMutes() { - this.mutes = new Vector(); - - for(int var1 = 0; var1 < 50; ++var1) { - String var2 = this.serverSection.getIniString("Mute" + var1, ""); - if (var2.length() == 0) { - break; - } - - if (FriendsListPart.isValidUserName(var2) && !FriendsListPart.icontains(this.mutes, var2)) { - this.mutes.addElement(var2); - } - } - - if (this.mutes.size() == 0) { - String var4 = this.serverSection.getIniString("Mutes", ""); - StringTokenizer var5 = new StringTokenizer(var4, ";"); - - while(var5.hasMoreTokens() && this.mutes.size() < 50) { - String var3 = var5.nextToken(); - if (FriendsListPart.isValidUserName(var3) && !FriendsListPart.icontains(this.mutes, var3)) { - this.mutes.addElement(var3); + private static final String oldIniItemName = "Mutes"; + private static final String iniItemName = "Mute"; + private static final String separator = ";"; + private static MuteListPart active; + private Vector mutes; + private Vector tars; + private Vector syncMutes = new Vector(); + private MenuItem editItem; + private boolean rejectWhispers; + private boolean rejectTeleports; + private DefaultConsole console; + private Galaxy galaxy; + private IniFile serverSection; + private Object mutesMutex = new Object(); + private Object tarMutex = new Object(); + private Vector updates = new Vector(); + public static RejectHandler rej = new RejectHandler(); + + public MuteListPart() { + System.out.println("Mutes Loaded"); + } + + private void loadMutes() { + this.mutes = new Vector(); + this.tars = new Vector(); + + for(int var1 = 0; var1 < Integer.MAX_VALUE; ++var1) { + String var2 = this.serverSection.getIniString("Mute" + var1, ""); + if (var2.length() == 0) { + break; + } + + if (FriendsListPart.isValidUserName(var2) && !FriendsListPart.icontains(this.mutes, var2)) { + this.mutes.addElement(var2); + } + } + + for(int var1 = 0; var1 < Integer.MAX_VALUE; ++var1) { + String var2 = this.serverSection.getIniString("Tar" + var1, ""); + if (var2.length() == 0) { + break; + } + + if (FriendsListPart.isValidUserName(var2) && !FriendsListPart.icontains(this.tars, var2)) { + this.tars.addElement(var2); + } + } + + if (this.mutes.size() == 0) { + String var4 = this.serverSection.getIniString("Mutes", ""); + StringTokenizer var5 = new StringTokenizer(var4, ";"); + + while(var5.hasMoreTokens() && this.mutes.size() < 50) { + String var3 = var5.nextToken(); + if (FriendsListPart.isValidUserName(var3) && !FriendsListPart.icontains(this.mutes, var3)) { + this.mutes.addElement(var3); + } + } + + if (this.mutes.size() != 0) { + this.saveMutes(); + this.serverSection.setIniString("Mutes", ""); + } + } + + if (this.tars.size() == 0) { + String var4 = this.serverSection.getIniString("Tars", ""); + StringTokenizer var5 = new StringTokenizer(var4, ";"); + + while(var5.hasMoreTokens() && this.tars.size() < 50) { + String var3 = var5.nextToken(); + if (FriendsListPart.isValidUserName(var3) && !FriendsListPart.icontains(this.tars, var3)) { + this.tars.addElement(var3); + } + } + + if (this.tars.size() != 0) { + this.saveTars(); + this.serverSection.setIniString("Tars", ""); } - } + } + } - if (this.mutes.size() != 0) { + void saveMutes() { + int var2 = this.mutes.size(); + + for(int var3 = 0; var3 < var2; ++var3) { + this.serverSection.setIniString("Mute" + var3, (String)this.mutes.elementAt(var3)); + } + + this.serverSection.setIniString("Mute" + var2, ""); + } + + void saveTars() { + int var2 = this.tars.size(); + + for(int var3 = 0; var3 < var2; ++var3) { + this.serverSection.setIniString("Tar" + var3, (String)this.tars.elementAt(var3)); + } + + this.serverSection.setIniString("Tar" + var2, ""); + } + + public void activate(Console var1, Container var2, Console var3) { + active = this; + this.console = (DefaultConsole)var1; + this.editItem = var1.addMenuItem(Console.message("Edit-Mute-List"), "Options"); + this.editItem.setEnabled(this.mutes != null); + } + + public void deactivate() { + active = null; + this.editItem = null; + } + + public boolean action(Event var1, Object var2) { + if (var1.target == this.editItem) { + new EditNamesDialog(this, Console.message("Edit-Mute-List"), Console.message("Add-Mute-List")); + return true; + } else { + return false; + } + } + + public boolean handle(FrameEvent var1) { + synchronized(this.mutesMutex) { + int var3 = this.updates.size(); + if (var3 != 0) { + WorldServer var4 = this.console.getServerNew(); + if (var4 != null) { + for(int var5 = 0; var5 < var3; ++var5) { + String var6 = (String)this.updates.elementAt(var5); + boolean var7 = this.mutes.contains(var6); + NetworkObject var8 = var4.getObject(new ObjID(var6)); + if (var8 instanceof Drone) { + Drone var9 = (Drone)var8; + var9.muteStateChanged(); + } + + this.console.getFriends().changeMuteState(var6, var7); + } + + this.updates.removeAllElements(); + this.syncMutes = (Vector)this.mutes.clone(); + } + } + return true; + } + } + + public void setServer(WorldServer var1, IniFile var2) { + this.serverSection = var2; + this.galaxy = var1.getGalaxy(); + this.loadMutes(); + if (this.editItem != null) { + this.editItem.setEnabled(true); + } + + } + + public static boolean isMuted(WorldServer var0, String var1) { + if (var0 != null && var1 != null) { + Galaxy var2 = var0.getGalaxy(); + Enumeration var3 = var2.getConsoles(); + + while(var3.hasMoreElements()) { + Object var4 = var3.nextElement(); + if (var4 instanceof DefaultConsole) { + NET.worlds.console.MuteListPart var5 = ((DefaultConsole)var4).getMutes(); + if (var5.mutes != null) { + return FriendsListPart.icontains(var5.mutes, var1); + } + } + } + } + + return false; + } + + public static boolean isRejecting(WorldServer var0, String var5) { + if (var0 != null) { + Galaxy var1 = var0.getGalaxy(); + Enumeration var2 = var1.getConsoles(); + + while(var2.hasMoreElements()) { + Object var3 = var2.nextElement(); + if (var3 instanceof DefaultConsole) { + MuteListPart var4 = ((DefaultConsole)var3).getMutes(); + return var4.rejectWhispers || !allowWhisper(var5); + } + } + } + + return false; + } + + public static boolean isRejectingTele(WorldServer var0, String var5) { + if (var0 != null) { + Galaxy var1 = var0.getGalaxy(); + Enumeration var2 = var1.getConsoles(); + + while(var2.hasMoreElements()) { + Object var3 = var2.nextElement(); + if (var3 instanceof DefaultConsole) { + MuteListPart var4 = ((DefaultConsole)var3).getMutes(); + return var4.rejectTeleports || !allowTeleport(var5); + } + } + } + + return false; + } + + private static boolean allowWhisper(String player) { + int value = IniFile.gamma().getIniInt("WhisperPrivacy", 0); + if (value != 0) { + if (value == 1 && FriendsListPart.icontains(FriendsListPart.friends, player)) return true; + else return false; + } else return true; + } + + private static boolean allowTeleport(String player) { + int value = IniFile.gamma().getIniInt("TeleportPrivacy", 0); + if (value != 0) { + if (value == 1 && FriendsListPart.icontains(FriendsListPart.friends, player)) return true; + else return false; + } else return true; + } + + public int getNameListCount() { + return this.mutes.size(); + } + + public String getNameListName(int var1) { + return (String)this.mutes.elementAt(var1); + } + + public void removeNameListName(int var1) { + synchronized(this.mutesMutex) { + String var3 = (String)this.mutes.elementAt(var1); + this.mutes.removeElementAt(var1); this.saveMutes(); - this.serverSection.setIniString("Mutes", ""); - } - } - - } - - void saveMutes() { - String var1 = ""; - int var2 = this.mutes.size(); - - for(int var3 = 0; var3 < var2; ++var3) { - this.serverSection.setIniString("Mute" + var3, (String)this.mutes.elementAt(var3)); - } - - this.serverSection.setIniString("Mute" + var2, ""); - } - - private void setDisableWhisper() { - this.rejectWhispers = IniFile.gamma().getIniInt("RejectWhispers", 0) == 1; - if (this.rejectWhispers) { - this.disableWhisperItem.setLabel(Console.message("Accept-Whispers")); - } else { - this.disableWhisperItem.setLabel(Console.message("Reject-Whispers")); - } - - } - - public void activate(Console var1, Container var2, Console var3) { - active = this; - this.console = (DefaultConsole)var1; - this.editItem = var1.addMenuItem(Console.message("Edit-Mute-List"), "Options"); - this.editItem.setEnabled(this.mutes != null); - this.disableWhisperItem = var1.addMenuItem(Console.message("Reject-Whispers"), "Options"); - this.setDisableWhisper(); - } - - public void deactivate() { - active = null; - this.editItem = null; - } - - public boolean action(Event var1, Object var2) { - if (var1.target == this.editItem) { - new EditNamesDialog(this, Console.message("Edit-Mute-List"), Console.message("Add-Mute-List")); - return true; - } else { - if (var1.target == this.disableWhisperItem) { - IniFile.gamma().setIniInt("RejectWhispers", this.rejectWhispers ? 0 : 1); - this.setDisableWhisper(); - } - - return false; - } - } - - public boolean handle(FrameEvent var1) { - synchronized(this.mutesMutex) { - int var3 = this.updates.size(); - if (var3 != 0) { - WorldServer var4 = this.console.getServerNew(); - if (var4 != null) { - for(int var5 = 0; var5 < var3; ++var5) { - String var6 = (String)this.updates.elementAt(var5); - boolean var7 = this.mutes.contains(var6); - NetworkObject var8 = var4.getObject(new ObjID(var6)); - if (var8 instanceof Drone) { - Drone var9 = (Drone)var8; - var9.muteStateChanged(); - } - - this.console.getFriends().changeMuteState(var6, var7); - } - - this.updates.removeAllElements(); - this.syncMutes = (Vector)this.mutes.clone(); - } - } - - return true; - } - } - - public void setServer(WorldServer var1, IniFile var2) { - this.serverSection = var2; - this.galaxy = var1.getGalaxy(); - this.loadMutes(); - if (this.editItem != null) { - this.editItem.setEnabled(true); - } - - } - - public static boolean isMuted(WorldServer var0, String var1) { - if (var0 != null && var1 != null) { - Galaxy var2 = var0.getGalaxy(); - Enumeration var3 = var2.getConsoles(); - - while(var3.hasMoreElements()) { - Object var4 = var3.nextElement(); - if (var4 instanceof DefaultConsole) { - MuteListPart var5 = ((DefaultConsole)var4).getMutes(); - if (var5.mutes != null) { - return FriendsListPart.icontains(var5.mutes, var1); - } - } - } - } - - return false; - } - - public static boolean isRejecting(WorldServer var0) { - if (var0 != null) { - Galaxy var1 = var0.getGalaxy(); - Enumeration var2 = var1.getConsoles(); - - while(var2.hasMoreElements()) { - Object var3 = var2.nextElement(); - if (var3 instanceof DefaultConsole) { - MuteListPart var4 = ((DefaultConsole)var3).getMutes(); - if (var4.rejectWhispers) { - return true; - } - } - } - } - - return false; - } - - public int getNameListCount() { - return this.mutes.size(); - } - - public String getNameListName(int var1) { - return (String)this.mutes.elementAt(var1); - } - - public void removeNameListName(int var1) { - synchronized(this.mutesMutex) { - String var3 = (String)this.mutes.elementAt(var1); - this.mutes.removeElementAt(var1); - this.saveMutes(); - if (!this.updates.contains(var3)) { - this.updates.addElement(var3); - } - - } - } - - public boolean mayAddNameListName(java.awt.Window var1) { - if (this.mutes.size() < 50) { - return true; - } else { - Object[] var2 = new Object[]{new String("50")}; - new OkCancelDialog(var1, (DialogReceiver)null, Console.message("Too-many-names"), (String)null, Console.message("OK"), MessageFormat.format(Console.message("You-are-limitedM"), var2), true); - return false; - } - } - - public int addNameListName(String var1) { - synchronized(this.mutesMutex) { - if (var1.toLowerCase().startsWith("host")) { - return -1; - } else { - int var3 = FriendsListPart.iindexOf(this.mutes, var1); - if (var3 != -1) { - return var3; + if (!this.updates.contains(var3)) { + this.updates.addElement(var3); + } + } + } + + public boolean mayAddNameListName(Window var1) { + return true; + } + + public int addNameListName(String var1) { + synchronized(this.mutesMutex) { + if (var1.toLowerCase().startsWith("host")) { + return -1; } else { - this.mutes.addElement(var1); - this.saveMutes(); - if (!this.updates.contains(var1)) { - this.updates.addElement(var1); - } - - return this.mutes.size() - 1; - } - } - } - } + int var3 = FriendsListPart.iindexOf(this.mutes, var1); + if (var3 != -1) { + return var3; + } else { + this.mutes.addElement(var1); + this.saveMutes(); + if (!this.updates.contains(var1)) { + this.updates.addElement(var1); + } + + return this.mutes.size() - 1; + } + } + } + } } diff -ruN a/1904/NET/worlds/console/OpenWhisperDialog.java b/1904/NET/worlds/console/OpenWhisperDialog.java --- a/1904/NET/worlds/console/OpenWhisperDialog.java 1969-12-31 18:00:00.000000000 -0600 +++ b/1904/NET/worlds/console/OpenWhisperDialog.java 2023-08-21 23:27:16.000000000 -0500 @@ -0,0 +1,83 @@ +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by FernFlower decompiler) +// + +package NET.worlds.console; + +import java.awt.Button; +import java.awt.Event; +import java.awt.Font; +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.awt.Label; +import java.awt.Panel; +import java.awt.TextField; +import java.awt.Window; + +public class OpenWhisperDialog extends PolledDialog { + private Button okButton = new Button(Console.message("OK")); + private Button cancelButton = new Button(Console.message("Cancel")); + private static Font font = new Font(Console.message("MenuFont"), 0, 12); + private static Font bfont = new Font(Console.message("ButtonFont"), 0, 12); + private TextField userField = new TextField(""); + + public OpenWhisperDialog(Window var1, DialogReceiver var2, String var3) { + super(var1, var2, var3, true); + this.ready(); + } + + public String getUser() { + return this.userField.getText(); + } + + protected void build() { + this.userField = new TextField("", 40); + this.userField.setFont(font); + GridBagLayout var1 = new GridBagLayout(); + this.setLayout(var1); + GridBagConstraints var2 = new GridBagConstraints(); + var2.fill = 0; + var2.weightx = 1.0D; + var2.weighty = 1.0D; + var2.gridwidth = 2; + var2.gridheight = 1; + this.add(var1, new Label(Console.message("Name")), var2); + var2.gridwidth = 0; + var2.fill = 2; + this.add(var1, this.userField, var2); + Panel var3 = new Panel(); + this.okButton.setFont(font); + this.cancelButton.setFont(font); + var3.add(this.okButton); + var3.add(this.cancelButton); + var2.gridwidth = 0; + var2.fill = 0; + this.add(var1, var3, var2); + } + + public void show() { + super.show(); + this.userField.requestFocus(); + this.userField.selectAll(); + } + + public boolean handleEvent(Event var1) { + return var1.id == 201 ? this.done(false) : super.handleEvent(var1); + } + + public boolean action(Event var1, Object var2) { + Object var3 = var1.target; + if (var3 == this.cancelButton) { + this.done(false); + } else if (var3 == this.okButton) { + this.done(true); + } + + return false; + } + + public boolean keyDown(Event var1, int var2) { + return var2 == 27 ? this.done(false) : super.keyDown(var1, var2); + } +} diff -ruN a/1904/NET/worlds/console/OptionsDialog.java b/1904/NET/worlds/console/OptionsDialog.java --- a/1904/NET/worlds/console/OptionsDialog.java 1969-12-31 18:00:00.000000000 -0600 +++ b/1904/NET/worlds/console/OptionsDialog.java 2023-09-10 20:02:26.000000000 -0500 @@ -0,0 +1,75 @@ +package NET.worlds.console; + +import java.awt.Button; +import java.awt.Color; +import java.awt.Event; +import java.awt.Font; +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.awt.Label; +import java.awt.Panel; +import java.awt.TextField; + +public class OptionsDialog extends PolledDialog { + private Button applyButton = new Button(Console.message("Apply")); + private Button cancelButton = new Button(Console.message("Cancel")); + private static Font font = new Font(Console.message("ButtonFont"), 0, 12); + private static Font gfont = new Font(Console.message("GammaTextFont"), 0, 12); + + public OptionsDialog(java.awt.Window var1, DialogReceiver var2, String var3, String var4) { + super(var1, var2, var3, true); + this.ready(); + } + + protected void build() { + this.setBackground(Color.white); + GridBagLayout var1 = new GridBagLayout(); + this.setLayout(var1); + GridBagConstraints var2 = new GridBagConstraints(); + var2.weightx = 0.0D; + var2.weighty = 0.0D; + var2.gridheight = 1; + var2.fill = 0; + var2.anchor = 13; + var2.gridwidth = 1; + var2.weightx = 1.0D; + var2.weighty = 0.0D; + var2.gridwidth = 0; + var2.fill = 2; + var2.anchor = 17; + Panel var3 = new Panel(); + this.applyButton.setFont(font); + this.cancelButton.setFont(font); + var3.add(this.applyButton); + var3.add(this.cancelButton); + var2.gridwidth = 0; + var2.anchor = 10; + var2.fill = 0; + this.add(var1, var3, var2); + } + + public void show() { + super.show(); + } + + public boolean handleEvent(Event var1) { + return var1.id == 201 ? this.done(false) : super.handleEvent(var1); + } + + public boolean action(Event var1, Object var2) { + Object var3 = var1.target; + if (var3 == this.cancelButton) { + return this.done(false); + } else { + return var3 == this.applyButton ? this.done(true) : false; + } + } + + public boolean keyDown(Event var1, int var2) { + if (var2 == 27) { + return this.done(false); + } else { + return var2 == 10 ? this.done(true) : super.keyDown(var1, var2); + } + } +} diff -ruN a/1904/NET/worlds/console/QuitDialog.java b/1904/NET/worlds/console/QuitDialog.java --- a/1904/NET/worlds/console/QuitDialog.java 2020-08-06 15:46:26.000000000 -0500 +++ b/1904/NET/worlds/console/QuitDialog.java 2023-09-10 19:13:50.000000000 -0500 @@ -4,6 +4,7 @@ import java.awt.Component; import java.awt.Event; import java.awt.Rectangle; +import NET.worldsplus.Themer; public class QuitDialog extends PolledDialog implements ImageButtonsCallback { private ImageButtons ib; @@ -11,17 +12,17 @@ public QuitDialog(java.awt.Window var1, DialogReceiver var2) { super(var1, var2, Console.message("Quit"), true); Rectangle[] var3 = new Rectangle[2]; - int var4 = IniFile.override().getIniInt("quitYesX", 141); - int var5 = IniFile.override().getIniInt("quitYesY", 76); - int var6 = IniFile.override().getIniInt("quitYesW", 78); - int var7 = IniFile.override().getIniInt("quitYesH", 22); + int var4 = Themer.override().getIniInt("quitYesX", 141); + int var5 = Themer.override().getIniInt("quitYesY", 76); + int var6 = Themer.override().getIniInt("quitYesW", 78); + int var7 = Themer.override().getIniInt("quitYesH", 22); var3[0] = new Rectangle(var4, var5, var6, var7); - int var8 = IniFile.override().getIniInt("quitNoX", 141); - int var9 = IniFile.override().getIniInt("quitNoY", 114); - int var10 = IniFile.override().getIniInt("quitNoW", 78); - int var11 = IniFile.override().getIniInt("quitNoH", 22); + int var8 = Themer.override().getIniInt("quitNoX", 141); + int var9 = Themer.override().getIniInt("quitNoY", 114); + int var10 = Themer.override().getIniInt("quitNoW", 78); + int var11 = Themer.override().getIniInt("quitNoH", 22); var3[1] = new Rectangle(var8, var9, var10, var11); - String var12 = IniFile.override().getIniString("quitDlg", Console.message("DYRWTQ.GIF")); + String var12 = Themer.themer.asset(Console.message("DYRWTQ.GIF")); this.ib = new ImageButtons(var12, var3, this); this.ready(); } diff -ruN a/1904/NET/worlds/console/RejectHandler.java b/1904/NET/worlds/console/RejectHandler.java --- a/1904/NET/worlds/console/RejectHandler.java 1969-12-31 18:00:00.000000000 -0600 +++ b/1904/NET/worlds/console/RejectHandler.java 2023-08-21 23:27:16.000000000 -0500 @@ -0,0 +1,37 @@ +package NET.worlds.console; + +import java.util.ArrayList; +import java.util.List; + +public class RejectHandler { + + List whisperRej = null; + List teleportRej = null; + + public RejectHandler () { + if (whisperRej == null) { + whisperRej = new ArrayList(); + whisperRej.add("WORLDSMASTER"); + } + if (teleportRej == null) { + teleportRej = new ArrayList(); + teleportRej.add("WORLDSMASTER"); + } + } + + public boolean rejectTeleport(String var1) { + return teleportRej.contains(var1); + } + + public void addTeleportUser(String var1) { + teleportRej.add(var1); + } + + public boolean rejectWhisper(String var1) { + return whisperRej.contains(var1); + } + + public void addWhisperUser(String var1) { + whisperRej.add(var1); + } +} diff -ruN a/1904/NET/worlds/console/Shaper.java b/1904/NET/worlds/console/Shaper.java --- a/1904/NET/worlds/console/Shaper.java 2020-08-06 15:46:24.000000000 -0500 +++ b/1904/NET/worlds/console/Shaper.java 2023-08-21 23:27:16.000000000 -0500 @@ -1,5 +1,6 @@ package NET.worlds.console; +import NET.worlds.core.IniFile; import NET.worlds.network.URL; import NET.worlds.scape.LoadedURLSelf; import NET.worlds.scape.Manifest; @@ -9,271 +10,340 @@ import NET.worlds.scape.TeleportStatus; import NET.worlds.scape.URLSelf; import NET.worlds.scape.World; +import NET.worldsplus.ChatSaver; + import java.awt.Container; import java.awt.Event; import java.awt.Menu; import java.awt.MenuItem; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.io.FileWriter; import java.io.IOException; import java.util.Enumeration; public class Shaper implements MainCallback, DialogReceiver, LoadedURLSelf { - MenuItem newItem; - MenuItem openItem; - MenuItem saveItem; - MenuItem propItem; - MenuItem consolePropItem; - MenuItem pilotPropItem; - MenuItem undoItem; - MenuItem cutItem; - MenuItem copyItem; - MenuItem pasteItem; - MenuItem sortAttributesItem; - MenuItem snapToolItem; - MenuItem newLibraryItem; - MenuItem newLibraryEntryItem; - MenuItem iconsVisibleLibraryItem; - Menu worldsMenu; - MenuItem shaperVisibleItem; - private World newWorldTemplate; - private boolean makeNew = true; - private static URL newworld = URL.make("home:NewWorld.world"); - private boolean quitFlag; - private FileSaver fileSaver; - private boolean worldListHasChanged = false; - - public Shaper() { - Main.register(this); - } - - public void activate(Console var1, Container var2, Console var3) { - this.newItem = var1.addMenuItem(Console.message("New"), "File", 78, false); - this.openItem = var1.addMenuItem(Console.message("Open"), "File", 79, false); - this.saveItem = var1.addMenuItem(Console.message("Save"), "File", 83, false); - this.propItem = var1.addMenuItem(Console.message("World-Prop"), "File"); - this.consolePropItem = var1.addMenuItem(Console.message("Console-Prop"), "File"); - this.pilotPropItem = var1.addMenuItem(Console.message("Pilot-Prop"), "File"); - this.undoItem = var1.addMenuItem(Console.message("Undo"), "Edit", 90, false); - var1.getMenu("Edit").addSeparator(); - this.cutItem = var1.addMenuItem(Console.message("Cut"), "Edit", 88, false); - this.copyItem = var1.addMenuItem(Console.message("Copy"), "Edit", 67, false); - this.pasteItem = var1.addMenuItem(Console.message("Paste"), "Edit", 86, false); - this.sortAttributesItem = var1.addMenuItem(Console.message("Sort-Attributes"), "Edit"); - this.snapToolItem = var1.addMenuItem(Console.message("Snap-Tool-Settings"), "Edit"); - this.newLibraryItem = var1.addMenuItem(Console.message("New-Library"), "Libraries"); - this.newLibraryEntryItem = var1.addMenuItem(Console.message("New-Library-Entry"), "Libraries"); - this.iconsVisibleLibraryItem = var1.addMenuItem(Console.message("Icons-On-Off"), "Libraries", 73, false); - this.worldsMenu = var1.getMenu("Worlds"); - this.worldListChange(); - this.shaperVisibleItem = var1.addMenuItem(Console.message("Shaper-On-Off"), "Options"); - } - - public void deactivate() { - this.worldsMenu = null; - } - - public boolean action(Event var1, Object var2) { - GammaFrame var3 = Console.getFrame(); - if (var1.target == this.newItem) { - this.makeNew = true; - } else if (var1.target == this.openItem) { - new FileSysDialog(var3, this, Console.message("Open-World"), 0, "World Save Files|*.world|World Class Files|*.class|World Files|*.class;*.world", "", true); - } else if (var1.target == this.saveItem) { - new FileSysDialog(var3, this, Console.message("Save-World"), 1, "World Save Files|*.world|World Manifest (text) Files|*.mft", this.getSaveName(), true); - } else if (var1.target == this.propItem) { - if (Pilot.getActiveRoom() != null) { - var3.getEditTile().viewProperties(Pilot.getActiveWorld()); - } - } else if (var1.target == this.consolePropItem) { - var3.getEditTile().viewProperties(Console.getActive()); - } else if (var1.target == this.pilotPropItem) { - var3.getEditTile().viewProperties(Pilot.getActive()); - } else if (var1.target == this.sortAttributesItem) { - new AttributeSortPanel(var3); - } else if (var1.target == this.snapToolItem) { - new SnapToolPanel(var3); - } else if (var1.target == this.undoItem) { - var3.getEditTile().undo(); - } else if (var1.target == this.cutItem) { - var3.getEditTile().cut(); - } else if (var1.target == this.copyItem) { - var3.getEditTile().copy(); - } else if (var1.target == this.pasteItem) { - var3.getEditTile().paste(); - } else if (var1.target == this.newLibraryItem) { - var3.getLibrariesTile().addLibrary(); - } else if (var1.target == this.newLibraryEntryItem) { - var3.getLibrariesTile().addElement(); - } else if (var1.target == this.iconsVisibleLibraryItem) { - var3.getLibrariesTile().setIconsVisible(!var3.getLibrariesTile().isIconsVisible()); - } else if (var1.target == this.shaperVisibleItem) { - var3.setShaperVisible(!var3.isShaperVisible()); - } else { - int var4 = this.worldsMenu.countItems(); - - do { - --var4; - } while(var4 >= 0 && this.worldsMenu.getItem(var4) != var1.target); - - if (var4 < 0) { + MenuItem newItem; + MenuItem openItem; + MenuItem saveItem; + MenuItem propItem; + MenuItem consolePropItem; + MenuItem pilotPropItem; + MenuItem undoItem; + MenuItem cutItem; + MenuItem copyItem; + MenuItem pasteItem; + MenuItem sortAttributesItem; + MenuItem snapToolItem; + MenuItem newLibraryItem; + MenuItem newLibraryEntryItem; + MenuItem iconsVisibleLibraryItem; + Menu worldsMenu; + Menu whisperMenu; + MenuItem openWhisperItem; + MenuItem shaperVisibleItem; + private World newWorldTemplate; + private boolean makeNew = true; + private static URL newworld = URL.make("home:NewWorld.world"); + private boolean quitFlag; + private FileSaver fileSaver; + private boolean worldListHasChanged = false; + private boolean whisperListHasChanged = false; + + public Shaper() { + Main.register(this); + } + + public void activate(Console var1, Container var2, Console var3) { + this.newItem = var1.addMenuItem(Console.message("New"), "File", 78, false); + this.openItem = var1.addMenuItem(Console.message("Open"), "File", 79, false); + this.saveItem = var1.addMenuItem(Console.message("Save"), "File", 83, false); + this.propItem = var1.addMenuItem(Console.message("World-Prop"), "File"); + this.consolePropItem = var1.addMenuItem(Console.message("Console-Prop"), "File"); + this.pilotPropItem = var1.addMenuItem(Console.message("Pilot-Prop"), "File"); + this.undoItem = var1.addMenuItem(Console.message("Undo"), "Edit", 90, false); + var1.getMenu("Edit").addSeparator(); + this.cutItem = var1.addMenuItem(Console.message("Cut"), "Edit", 88, false); + this.copyItem = var1.addMenuItem(Console.message("Copy"), "Edit", 67, false); + this.pasteItem = var1.addMenuItem(Console.message("Paste"), "Edit", 86, false); + this.sortAttributesItem = var1.addMenuItem(Console.message("Sort-Attributes"), "Edit"); + this.snapToolItem = var1.addMenuItem(Console.message("Snap-Tool-Settings"), "Edit"); + this.newLibraryItem = var1.addMenuItem(Console.message("New-Library"), "Libraries"); + this.newLibraryEntryItem = var1.addMenuItem(Console.message("New-Library-Entry"), "Libraries"); + this.iconsVisibleLibraryItem = var1.addMenuItem(Console.message("Icons-On-Off"), "Libraries", 73, false); + this.worldsMenu = var1.getMenu("Worlds"); + this.whisperMenu = var1.getMenu("Whispers"); + this.openWhisperItem = var1.addMenuItem(Console.message("Open Whisper"), "Whispers"); + this.whisperMenu.addSeparator(); + + this.worldListChange(); + this.whisperListChanged(); + + this.shaperVisibleItem = var1.addMenuItem(Console.message("Shaper-On-Off"), "Options"); + } + + public void deactivate() { + this.worldsMenu = null; + this.whisperMenu = null; + } + + public boolean action(Event var1, Object var2) { + GammaFrame var3 = Console.getFrame(); + if (var1.target == this.newItem) { + this.makeNew = true; + } else if (var1.target == this.openItem) { + new FileSysDialog(var3, this, Console.message("Open-World"), 0, "World Save Files|*.world|World Class Files|*.class|World Files|*.class;*.world", "", true); + } else if (var1.target == this.saveItem) { + new FileSysDialog(var3, this, Console.message("Save-World"), 1, "World Save Files|*.world|World Manifest (text) Files|*.mft", this.getSaveName(), true); + } else if (var1.target == this.propItem) { + if (Pilot.getActiveRoom() != null) { + var3.getEditTile().viewProperties(Pilot.getActiveWorld()); + } + } else if (var1.target == this.consolePropItem) { + var3.getEditTile().viewProperties(Console.getActive()); + } else if (var1.target == this.pilotPropItem) { + var3.getEditTile().viewProperties(Pilot.getActive()); + } else if (var1.target == this.sortAttributesItem) { + new AttributeSortPanel(var3); + } else if (var1.target == this.snapToolItem) { + new SnapToolPanel(var3); + } else if (var1.target == this.undoItem) { + var3.getEditTile().undo(); + } else if (var1.target == this.cutItem) { + var3.getEditTile().cut(); + } else if (var1.target == this.copyItem) { + var3.getEditTile().copy(); + } else if (var1.target == this.pasteItem) { + var3.getEditTile().paste(); + } else if (var1.target == this.newLibraryItem) { + var3.getLibrariesTile().addLibrary(); + } else if (var1.target == this.newLibraryEntryItem) { + var3.getLibrariesTile().addElement(); + } else if (var1.target == this.iconsVisibleLibraryItem) { + var3.getLibrariesTile().setIconsVisible(!var3.getLibrariesTile().isIconsVisible()); + } else if (var1.target == this.openWhisperItem) { + new OpenWhisperDialog(var3, this, Console.message("open-whisper")); + } else if (var1.target == this.shaperVisibleItem) { + var3.setShaperVisible(!var3.isShaperVisible()); + } else { return false; - } + } + return true; + } + + public String getSaveName() { + return getSaveName(Pilot.getActive().getWorld()); + } + + public static String getSaveName(World var0) { + URL var1 = var0.getSourceURL(); + String var2 = var1.unalias(); + int var3 = var2.indexOf(58); + return var3 != -1 && var3 != 1 ? var1.getBase() : var2.replace('/', '\\'); + } + + public void dialogDone(Object var1, boolean var2) { + if (var2) { + if (var1 instanceof FileSysDialog) { + FileSysDialog var3 = (FileSysDialog) var1; + String var4 = var3.fileName(); + if (var3.getMode() == 0) { + TeleportAction.teleport(var4, (TeleportStatus) null, true); + } else { + this.doSave(var4); + } + } else if (var1 instanceof OpenWhisperDialog) { + Console.startWhispering(((OpenWhisperDialog)var1).getUser()); + } + } + } + + public void loadedURLSelf(URLSelf var1, URL var2, String var3) { + this.newWorldTemplate = (World)var1; + } + + public void mainCallback() { + if (this.quitFlag) { + if (this.fileSaver == null) { + this.fileSaver = new FileSaver(); + } + + switch(this.fileSaver.getState()) { + case 0: + GammaFrameState.saveBorder(); + Main.end(); + break; + case 2: + this.quitFlag = false; + this.fileSaver = null; + } + } + + if (this.newWorldTemplate != null) { + this.newWorldTemplate.incRef(); + } + + if (this.makeNew) { + this.makeNew = false; + if (this.newWorldTemplate == null) { + World.load(newworld, this, true); + } else { + World var1 = (World)this.newWorldTemplate.clone(); + var1.setEdited(true); + TeleportAction.teleport(var1.getSourceURL().getAbsolute(), (TeleportStatus)null); + } + } + + if (this.worldListHasChanged) { + this.worldListHasChanged = false; + this.rebuildWorldsMenu(); + } + + if (this.whisperListHasChanged) { + this.whisperListHasChanged = false; + this.rebuildWhisperMenu(); + } + } + + public void maybeQuit() { + this.quitFlag = true; + } + + public void worldListChange() { + this.worldListHasChanged = true; + } + + private void rebuildWorldsMenu() { + if (this.worldsMenu != null) { + while(this.worldsMenu.getItemCount() > 0) { + this.worldsMenu.remove(0); + } + + Enumeration var1 = World.getWorlds(); + + while(true) { + World var2; + URL var3; + String var4; + do { + if (!var1.hasMoreElements()) { + return; + } + + var2 = (World)var1.nextElement(); + var3 = var2.getSourceURL(); + if (var3 == null) { + var4 = var2.getName(); + break; + } + + var4 = var3.getAbsolute(); + } while(var3.equals(newworld)); + + if (var2.getEdited()) { + var4 = var4 + " (changed)"; + } + + MenuItem newItem = new MenuItem(var4); + newItem.addActionListener(new ActionListener() { + + public void actionPerformed(ActionEvent actionEvent) { + String var5 = ((MenuItem)actionEvent.getSource()).getLabel(); + if (var5.endsWith(" (changed)")) { + var5 = var5.substring(0, var5.length() - 10); + } + + TeleportAction.teleport(var5, (TeleportStatus) null); + } + }); + + this.worldsMenu.add(newItem); + } + } + } + + public void whisperListChanged() { + this.whisperListHasChanged = true; + } + + private void rebuildWhisperMenu() { + if (this.whisperMenu != null) { + while(this.whisperMenu.getItemCount() - 2 > 0) { + this.whisperMenu.remove(2); + } + + Enumeration var1 = WhisperManager.whisperManager().dialogs().elements(); + + + while(true) { + WhisperDialog var2; + String var4; + + do { + if (!var1.hasMoreElements()) { + return; + } + + var2 = (WhisperDialog) var1.nextElement(); + var4 = var2.partner; + } while (var4 == null); + + MenuItem newItem = new MenuItem(var4); + newItem.addActionListener(new ActionListener() { + + public void actionPerformed(ActionEvent actionEvent) { + Console.startWhispering(((MenuItem)actionEvent.getSource()).getLabel()); + } + }); + + this.whisperMenu.add(newItem); + } + } + } + + public void doSave(String var1) { + doSave(var1, Pilot.getActive().getWorld(), true); + } + + public static boolean doSave(String var0, World var1, boolean var2) { + if (var2 && var0.endsWith(".mft")) { + try { + Manifest var6 = new Manifest(var0); + var6.saveProps(var1); + var6.done(); + return true; + } catch (IOException var4) { + Console.println(Console.message("Error-manifest") + var4.toString()); + } + } else { + if (var0.toLowerCase().endsWith(".wor")) { + var0 = var0.substring(0, var0.length() - 4); + } + + if (!var0.toLowerCase().endsWith(".world")) { + var0 = var0 + ".world"; + } + + try { + Saver var3 = new Saver(new URL(URL.getCurDir(), var0)); + var3.save(var1); + var3.done(); + var1.setEdited(false); + return true; + } catch (IOException var5) { + Console.println(Console.message("Error-saving") + var5.toString()); + } + } - String var5 = (String)var2; - if (var5.endsWith(" (changed)")) { - var5 = var5.substring(0, var5.length() - 10); - } - - TeleportAction.teleport(var5, (TeleportStatus)null); - } - - return true; - } - - public String getSaveName() { - return getSaveName(Pilot.getActive().getWorld()); - } - - public static String getSaveName(World var0) { - URL var1 = var0.getSourceURL(); - String var2 = var1.unalias(); - int var3 = var2.indexOf(58); - return var3 != -1 && var3 != 1 ? var1.getBase() : var2.replace('/', '\\'); - } - - public void dialogDone(Object var1, boolean var2) { - if (var2) { - FileSysDialog var3 = (FileSysDialog)var1; - String var4 = var3.fileName(); - if (var3.getMode() == 0) { - TeleportAction.teleport(var4, (TeleportStatus)null, true); - } else { - this.doSave(var4); - } - } - - } - - public void loadedURLSelf(URLSelf var1, URL var2, String var3) { - this.newWorldTemplate = (World)var1; - } - - public void mainCallback() { - if (this.quitFlag) { - if (this.fileSaver == null) { - this.fileSaver = new FileSaver(); - } - - switch(this.fileSaver.getState()) { - case 0: - GammaFrameState.saveBorder(); - Main.end(); - break; - case 2: - this.quitFlag = false; - this.fileSaver = null; - } - } - - if (this.newWorldTemplate != null) { - this.newWorldTemplate.incRef(); - } - - if (this.makeNew) { - this.makeNew = false; - if (this.newWorldTemplate == null) { - World.load(newworld, this, true); - } else { - World var1 = (World)this.newWorldTemplate.clone(); - var1.setEdited(true); - TeleportAction.teleport(var1.getSourceURL().getAbsolute(), (TeleportStatus)null); - } - } - - if (this.worldListHasChanged) { - this.worldListHasChanged = false; - this.rebuildWorldsMenu(); - } - - } - - public void maybeQuit() { - this.quitFlag = true; - } - - public void worldListChange() { - this.worldListHasChanged = true; - } - - private void rebuildWorldsMenu() { - if (this.worldsMenu != null) { - while(this.worldsMenu.countItems() > 0) { - this.worldsMenu.remove(0); - } - - Enumeration var1 = World.getWorlds(); - - while(true) { - World var2; - URL var3; - String var4; - do { - if (!var1.hasMoreElements()) { - return; - } - - var2 = (World)var1.nextElement(); - var3 = var2.getSourceURL(); - if (var3 == null) { - var4 = var2.getName(); - break; - } - - var4 = var3.getAbsolute(); - } while(var3.equals(newworld)); - - if (var2.getEdited()) { - var4 = var4 + " (changed)"; - } - - this.worldsMenu.add(new MenuItem(var4)); - } - } - } - - public void doSave(String var1) { - doSave(var1, Pilot.getActive().getWorld(), true); - } - - public static boolean doSave(String var0, World var1, boolean var2) { - if (var2 && var0.endsWith(".mft")) { - try { - Manifest var6 = new Manifest(var0); - var6.saveProps(var1); - var6.done(); - return true; - } catch (IOException var4) { - Console.println(Console.message("Error-manifest") + var4.toString()); - } - } else { - if (var0.toLowerCase().endsWith(".wor")) { - var0 = var0.substring(0, var0.length() - 4); - } - - if (!var0.toLowerCase().endsWith(".world")) { - var0 = var0 + ".world"; - } - - try { - Saver var3 = new Saver(new URL(URL.getCurDir(), var0)); - var3.save(var1); - var3.done(); - var1.setEdited(false); - return true; - } catch (IOException var5) { - Console.println(Console.message("Error-saving") + var5.toString()); - } - } + return false; + } - return false; - } + private boolean containsItem(Menu menu, MenuItem item) { + for (int e = 0; e < menu.getItemCount(); e++) { + MenuItem curItem = menu.getItem(e); + System.out.println(curItem + " / " + item); + if (curItem == item) return true; + } + return false; + } } diff -ruN a/1904/NET/worlds/console/StyledTextCanvas.java b/1904/NET/worlds/console/StyledTextCanvas.java --- a/1904/NET/worlds/console/StyledTextCanvas.java 2020-08-06 15:46:22.000000000 -0500 +++ b/1904/NET/worlds/console/StyledTextCanvas.java 2023-08-21 23:27:16.000000000 -0500 @@ -1,5 +1,6 @@ package NET.worlds.console; +import NET.worlds.core.IniFile; import java.awt.Canvas; import java.awt.Color; import java.awt.FontMetrics; @@ -11,88 +12,196 @@ import java.awt.event.MouseEvent; class StyledTextCanvas extends Canvas { - public StyledTextCanvas() { - this.enableEvents(29L); - this.setEnabled(true); - } - - public void setBounds(int var1, int var2, int var3, int var4) { - if (this.getParent() instanceof GammaTextArea) { - GammaTextArea var5 = (GammaTextArea)this.getParent(); - var5.setWidth(var3); - var5.setHeight(var4); - var5.rewrap(); - } - - super.setBounds(var1, var2, var3, var4); - } - - protected void processMouseEvent(MouseEvent var1) { - if (var1.getID() == 500) { - this.getParent().requestFocus(); - } - - super.processMouseEvent(var1); - } - - protected void processKeyEvent(KeyEvent var1) { - if (var1.getID() == 401) { - Scrollbar var2 = null; - if (this.getParent() instanceof GammaTextArea) { - GammaTextArea var3 = (GammaTextArea)this.getParent(); - var2 = var3.getVertScrollbar(); - } - - if (var1.getKeyCode() == 33) { - if (var2 != null && var2.isEnabled()) { - var2.dispatchEvent(var1); + private static final long serialVersionUID = -2680423246934436331L; + private MouseEvent delayedMouseEvent = null; + protected int mouseX = -1; + protected int mouseY = -1; + protected int startX = -1; + protected int startY = -1; + protected int endX = -1; + protected int endY = -1; + protected long mouseWhen = 0L; + protected boolean mouseActive = false; + protected boolean mouseDoubleClick = false; + protected static long doubleClickSpeed = (long)IniFile.override().getIniInt("DoubleClickSpeed", 300); + + public StyledTextCanvas() { + this.enableEvents(61L); + this.setEnabled(true); + } + + public void sendDelayedMouseEvent(MouseEvent e) { + synchronized(this.getParent()) { + this.delayedMouseEvent = e; + } + } + + public void setBounds(int x, int y, int w, int h) { + if (this.getParent() != null && w >= 0 && h >= 0) { + synchronized(this.getParent()) { + if (this.getParent() instanceof GammaTextArea) { + GammaTextArea gta = (GammaTextArea)this.getParent(); + gta.setWidth(w); + gta.setHeight(h); + gta.rewrap(); + } + + super.setBounds(x, y, w, h); } - } else if (var1.getKeyCode() == 34 && var2 != null && var2.isEnabled()) { - var2.dispatchEvent(var1); - } - } - - super.processKeyEvent(var1); - } - - public void update(Graphics var1) { - this.paint(var1); - } - - public void paint(Graphics var1) { - if (this.getParent().isEnabled()) { - GammaTextArea var2 = (GammaTextArea)this.getParent(); - Rectangle var3 = this.getBounds(); - Image var4 = this.createImage(var3.width, var3.height); - Graphics var5 = var4.getGraphics(); - var5.setColor(GammaTextArea.getBackgroundColor()); - var5.fillRect(var3.x, var3.y, var3.width, var3.height); - var5.setColor(Color.black); - if (var2.getHasFocus()) { - var5.setColor(Color.blue); - var5.drawRect(var3.x, var3.y, var3.width - 1, var3.height - 1); - var5.drawRect(var3.x + 1, var3.y + 1, var3.width - 2, var3.height - 2); - var5.setColor(Color.black); - } - - var5.setFont(var2.getFont()); - FontMetrics var6 = var5.getFontMetrics(var2.getFont()); - int var7; - if (var2.getNumLines() <= var2.getCanvasLines()) { - for(var7 = 0; var7 < var2.getNumLines(); ++var7) { - var2.drawLine(var5, var7, (var7 + 1) * var6.getHeight()); + } + + } + + protected void processMouseMotionEvent(MouseEvent e) { + if (e.getID() == 506 && this.mouseActive) { + this.processMouseEvent(e); + } + + super.processMouseMotionEvent(e); + } + + protected void processMouseEvent(MouseEvent e) { + synchronized(this.getParent()) { + if (e.getID() == 500) { + if (this.mouseWhen > 0L && e.getWhen() - this.mouseWhen <= doubleClickSpeed) { + this.mouseDoubleClick = true; + this.mouseWhen = 0L; + this.mouseX = this.startX = this.endX = e.getX(); + this.mouseY = this.startY = this.endY = e.getY(); + ((GammaTextArea)this.getParent()).selectionConversion = true; + this.getParent().repaint(); + } else { + this.mouseDoubleClick = false; + this.mouseWhen = e.getWhen(); + if (e.getButton() == 1 && !this.mouseActive && (e.getModifiers() & 1) == 0) { + ((GammaTextArea)this.getParent()).selectionStart = -1; + ((GammaTextArea)this.getParent()).selectionEnd = -1; + } + } + + this.getParent().requestFocus(); + } else if (e.getID() == 501) { + if (e.getButton() == 1) { + if ((e.getModifiers() & 1) == 0) { + if (((GammaTextArea)this.getParent()).selectionStart >= 0 && ((GammaTextArea)this.getParent()).selectionEnd > ((GammaTextArea)this.getParent()).selectionStart) { + ((GammaTextArea)this.getParent()).selectionStart = -1; + ((GammaTextArea)this.getParent()).selectionEnd = -1; + } else { + this.mouseX = this.startX = this.endX = e.getX(); + this.mouseY = this.startY = this.endY = e.getY(); + this.mouseActive = true; + ((GammaTextArea)this.getParent()).selectionConversion = true; + } + } else { + this.mouseX = this.startX = this.endX = e.getX(); + this.mouseY = this.startY = this.endY = e.getY(); + this.mouseActive = true; + ((GammaTextArea)this.getParent()).selectionConversion = true; + } + + this.getParent().repaint(); + } + + this.getParent().requestFocus(); + } else if (!this.mouseActive || e.getID() != 506 && e.getID() != 507 && e.getID() != 507) { + if (e.getID() == 502) { + if (e.getButton() == 1 && this.mouseActive) { + this.mouseX = this.endX = e.getX(); + this.mouseY = this.endY = e.getY(); + this.mouseActive = false; + ((GammaTextArea)this.getParent()).selectionConversion = false; + this.getParent().repaint(); + } + + this.getParent().requestFocus(); + } + } else { + if ((e.getModifiers() & 16) != 0) { + this.mouseX = this.endX = e.getX(); + this.mouseY = this.endY = e.getY(); + ((GammaTextArea)this.getParent()).selectionConversion = true; + this.getParent().repaint(); + } + + this.getParent().requestFocus(); } - } else { - var7 = var2.getScrollLine(); - for(int var8 = 1; var7 < var2.getNumLines(); ++var8) { - var2.drawLine(var5, var7, var8 * var6.getHeight()); - ++var7; + ((GammaTextArea)this.getParent()).processMouseEvent(e); + super.processMouseEvent(e); + } + } + + public void update(Graphics g) { + this.paint(g); + } + + protected void processKeyEvent(KeyEvent e) { + synchronized(this.getParent()) { + if (e.getID() == 401) { + Scrollbar s = null; + if (this.getParent() instanceof GammaTextArea) { + GammaTextArea gta = (GammaTextArea)this.getParent(); + s = gta.getVertScrollbar(); + } + + if (e.getKeyCode() == 33) { + if (s != null && s.isEnabled()) { + s.dispatchEvent(e); + } + } else if (e.getKeyCode() == 34 && s != null && s.isEnabled()) { + s.dispatchEvent(e); + } } - } - var1.drawImage(var4, 0, 0, this); - } + super.processKeyEvent(e); + } + } + + public void paint(Graphics g) { + synchronized(this.getParent()) { + if (this.getParent().isEnabled()) { + GammaTextArea gta = (GammaTextArea)this.getParent(); + Rectangle r = this.getBounds(); + if (r.width <= 0 || r.height <= 0) { + return; + } + + Image offImage = this.createImage(r.width, r.height); + Graphics offGraphic = offImage.getGraphics(); + offGraphic.setColor(GammaTextArea.getBackgroundColor()); + offGraphic.fillRect(r.x, r.y, r.width, r.height); + offGraphic.setColor(Color.black); + if (gta.getHasFocus()) { + offGraphic.setColor(Color.blue); + offGraphic.drawRect(r.x, r.y, r.width - 1, r.height - 1); + offGraphic.drawRect(r.x + 1, r.y + 1, r.width - 2, r.height - 2); + offGraphic.setColor(Color.black); + } + + offGraphic.setFont(gta.getFont()); + FontMetrics fm = offGraphic.getFontMetrics(gta.getFont()); + gta._curpos = 0; + int i; + if (gta.getNumLines() <= gta.getCanvasLines()) { + for(i = 0; i < gta.getNumLines(); ++i) { + gta.drawLine(offGraphic, i, (i + 1) * fm.getHeight() - fm.getDescent()); + } + } else { + i = gta.getScrollLine(); + + for(int j = 1; i < gta.getNumLines(); ++j) { + gta.drawLine(offGraphic, i, j * fm.getHeight() - fm.getDescent()); + ++i; + } + } + + g.drawImage(offImage, 0, 0, this); + if (this.delayedMouseEvent != null) { + this.processMouseEvent(this.delayedMouseEvent); + this.delayedMouseEvent = null; + } + } - } + } + } } diff -ruN a/1904/NET/worlds/console/TarListPart.java b/1904/NET/worlds/console/TarListPart.java --- a/1904/NET/worlds/console/TarListPart.java 1969-12-31 18:00:00.000000000 -0600 +++ b/1904/NET/worlds/console/TarListPart.java 2023-08-21 23:27:16.000000000 -0500 @@ -0,0 +1,204 @@ +package NET.worlds.console; + +import NET.worlds.core.IniFile; +import NET.worlds.network.Galaxy; +import NET.worlds.network.NetworkObject; +import NET.worlds.network.ObjID; +import NET.worlds.network.WorldServer; +import NET.worlds.scape.Drone; +import NET.worlds.scape.FrameEvent; + +import java.awt.Window; +import java.awt.*; +import java.util.Enumeration; +import java.util.StringTokenizer; +import java.util.Vector; + +public class TarListPart implements FramePart, NameListOwner{ + private Galaxy galaxy; + private IniFile serverSection; + private final String name = Console.message("edit-tar-list"); + private static TarListPart active; + private DefaultConsole console; + private MenuItem editItem; + private Vector syncTars = new Vector(); + public Vector tars; + private Object tarMutex = new Object(); + private Vector updates = new Vector(); + + public void activate(Console console, Container container, Console console1) { + active = this; + this.console = (DefaultConsole)console; + this.editItem = console.addMenuItem(name, "Options"); + this.editItem.setEnabled(this.tars != null); + } + + public void deactivate() { + active = null; + this.editItem = null; + } + + public boolean action(Event event, Object o) { + if (event.target == this.editItem) { + new EditNamesDialog(this, name, Console.message("add-to-tar")); + return true; + } else { + return false; + } + } + + public boolean handle(FrameEvent frameEvent) { + synchronized(this.tarMutex) { + int var3 = this.updates.size(); + if (var3 != 0) { + WorldServer var4 = this.console.getServerNew(); + if (var4 != null) { + for(int var5 = 0; var5 < var3; ++var5) { + String var6 = (String)this.updates.elementAt(var5); + boolean var7 = this.tars.contains(var6); + NetworkObject var8 = var4.getObject(new ObjID(var6)); + if (var8 instanceof Drone) { + Drone var9 = (Drone)var8; + var9.avtStateChanged(); + } + + this.console.getFriends().changeMuteState(var6, var7); + } + + this.updates.removeAllElements(); + this.syncTars = (Vector)this.tars.clone(); + } + } + + return true; + } + } + + public int getNameListCount() { + return this.tars.size(); + } + + public String getNameListName(int i) { + return (String)this.tars.elementAt(i); + } + + public void removeNameListName(int i) { + synchronized(this.tarMutex) { + String var3 = (String)this.tars.elementAt(i); + this.tars.removeElementAt(i); + this.saveTars(); + if (!this.updates.contains(var3)) { + this.updates.addElement(var3); + } + } + } + + public boolean mayAddNameListName(Window window) { + return true; + } + + public int addNameListName(String s) { + synchronized(this.tarMutex) { + int var3 = TarListPart.iindexOf(this.tars, s); + if (var3 != -1) { + return var3; + } else { + this.tars.addElement(s); + this.saveTars(); + if (!this.updates.contains(s)) { + this.updates.addElement(s); + } + + return this.tars.size() - 1; + } + } + } + + private void loadTars() { + this.tars = new Vector(); + + for(int var1 = 0; var1 < 50; ++var1) { + String var2 = this.serverSection.getIniString("Tar" + var1, ""); + if (var2.length() == 0) { + break; + } + + if (FriendsListPart.isValidUserName(var2) && !FriendsListPart.icontains(this.tars, var2)) { + this.tars.addElement(var2); + } + } + + if (this.tars.size() == 0) { + String var4 = this.serverSection.getIniString("Tars", ""); + StringTokenizer var5 = new StringTokenizer(var4, ";"); + + while(var5.hasMoreTokens() && this.tars.size() < 50) { + String var3 = var5.nextToken(); + if (FriendsListPart.isValidUserName(var3) && !FriendsListPart.icontains(this.tars, var3)) { + this.tars.addElement(var3); + } + } + + if (this.tars.size() != 0) { + this.saveTars(); + this.serverSection.setIniString("Tars", ""); + } + } + + } + + void saveTars() { + String var1 = ""; + int var2 = this.tars.size(); + + for(int var3 = 0; var3 < var2; ++var3) { + this.serverSection.setIniString("Tar" + var3, (String)this.tars.elementAt(var3)); + } + + this.serverSection.setIniString("Tar" + var2, ""); + } + + public void setServer(WorldServer var1, IniFile var2) { + this.serverSection = var2; + this.galaxy = var1.getGalaxy(); + this.loadTars(); + if (this.editItem != null) { + this.editItem.setEnabled(true); + } + } + + public static boolean isTarred(WorldServer ws, String s) { + if (ws != null && s != null) { + Galaxy var2 = ws.getGalaxy(); + Enumeration var3 = var2.getConsoles(); + + while(var3.hasMoreElements()) { + Object var4 = var3.nextElement(); + if (var4 instanceof DefaultConsole) { + TarListPart var5 = ((DefaultConsole)var4).getTars(); + if (var5.tars != null) { + return TarListPart.icontains(var5.tars, s); + } + } + } + } + return false; + } + + public static int iindexOf(Vector var0, String var1) { + int var2 = var0.size(); + + for(int var3 = 0; var3 < var2; ++var3) { + String var4 = (String)var0.elementAt(var3); + if(var4.equalsIgnoreCase(var1)) { + return var3; + } + } + + return -1; + } + + public static boolean icontains(Vector var0, String var1) { + return iindexOf(var0, var1) != -1; + } +} diff -ruN a/1904/NET/worlds/console/UniversePanel.java b/1904/NET/worlds/console/UniversePanel.java --- a/1904/NET/worlds/console/UniversePanel.java 2020-08-06 15:46:22.000000000 -0500 +++ b/1904/NET/worlds/console/UniversePanel.java 2023-09-10 16:16:30.000000000 -0500 @@ -9,6 +9,7 @@ import NET.worlds.scape.BackgroundLoader; import NET.worlds.scape.Room; import NET.worlds.scape.World; +import NET.worldsplus.Themer; import java.awt.Component; import java.awt.Dimension; import java.awt.Event; @@ -46,7 +47,7 @@ public UniversePanel(DefaultConsole var1) { this.owningConsole = var1; this.setLayout((LayoutManager)null); - this.backButton = new ImageButtons(Console.message("back.gif"), 60, 22, this); + this.backButton = new ImageButtons(Themer.themer.asset(Console.message("back.gif")), 60, 22, this); String var2 = IniFile.override().getIniString("UniverseBgFile", bgName); String var3 = IniFile.override().getIniString("UniverseDatFile", datName); if (!(new File(datName)).exists()) { diff -ruN a/1904/NET/worlds/console/WhisperManager.java b/1904/NET/worlds/console/WhisperManager.java --- a/1904/NET/worlds/console/WhisperManager.java 2020-08-06 15:46:26.000000000 -0500 +++ b/1904/NET/worlds/console/WhisperManager.java 2023-08-21 23:27:16.000000000 -0500 @@ -1,7 +1,11 @@ package NET.worlds.console; -import NET.worlds.network.NetUpdate; import NET.worlds.scape.InventoryManager; +import NET.worlds.scape.Pilot; +import NET.worldsplus.ChatSaver; + +import java.awt.Window; +import java.io.IOException; import java.util.Enumeration; import java.util.Hashtable; @@ -9,102 +13,129 @@ private static WhisperManager manager_; private Hashtable dialogs_ = new Hashtable(); private Hashtable tradeDialogs_ = new Hashtable(); - private java.awt.Window parent; + private Window parent; private String inventory = ""; final String tradeServerName = "TRADE"; - static GiftDialog outstandingGift; - private WhisperManager() { + + private WhisperManager() + { + this.dialogs_ = new Hashtable(); + this.tradeDialogs_ = new Hashtable(); } - public static WhisperManager whisperManager() { + public static WhisperManager whisperManager() + { if (manager_ == null) { manager_ = new WhisperManager(); } - return manager_; } - void setParent(java.awt.Window var1) { - this.parent = var1; + void setParent(Window p) + { + this.parent = p; } - public Hashtable dialogs() { + public Hashtable dialogs() + { return this.dialogs_; } - public Hashtable tradeDialogs() { + public Hashtable tradeDialogs() + { return this.tradeDialogs_; } - private WhisperDialog findWhisperDialog(String var1) { - return !this.dialogs_.containsKey(var1) ? null : (WhisperDialog)this.dialogs_.get(var1); + private WhisperDialog findWhisperDialog(String to) + { + if (!this.dialogs_.containsKey(to)) { + return null; + } + return (WhisperDialog)this.dialogs_.get(to); } - private TradeDialog findTradeDialog(String var1) { - return !this.tradeDialogs_.containsKey(var1) ? null : (TradeDialog)this.tradeDialogs_.get(var1); + private TradeDialog findTradeDialog(String to) + { + if (!this.tradeDialogs_.containsKey(to)) { + return null; + } + return (TradeDialog)this.tradeDialogs_.get(to); } - private WhisperDialog start(String var1, boolean var2) { - WhisperDialog var3 = this.findWhisperDialog(var1); - if (var3 == null) { - this.dialogs_.put(var1, var3 = new WhisperDialog(this.parent, var1)); + private WhisperDialog start(String to, boolean takeFocus) + { + WhisperDialog wd = findWhisperDialog(to); + if (wd == null) { + this.dialogs_.put(to, wd = new WhisperDialog(this.parent, to)); } - - if (var2) { - var3.takeFocus(); + if (takeFocus) { + wd.takeFocus(); } - - var3.ready(); - return var3; + wd.ready(); + if (Gamma.shaperEnabled()) Gamma.shaper.whisperListChanged(); + return wd; } - public void remove(String var1) { - this.dialogs_.remove(var1); + public void remove(String name) + { + this.dialogs_.remove(name); } - public void startTo(String var1) { - this.start(var1, true); + public void startTo(String to) + { + WhisperDialog wd = start(to, true); } - public TradeDialog startToTrade(String var1) { - TradeDialog var2 = this.findTradeDialog(var1); - if (var2 == null) { - this.tradeDialogs_.put(var1, var2 = new TradeDialog(this.parent, var1)); + public TradeDialog startToTrade(String to) { + TradeDialog wd = findTradeDialog(to); + if (wd == null) { + this.tradeDialogs_.put(to, wd = new TradeDialog(this.parent, to)); } + wd.takeFocus(); + wd.ready(); + wd.setTrading(true); + wd.whisperPart.println(Console.message("trade-start")); - var2.takeFocus(); - var2.ready(); - var2.setTrading(true); - var2.whisperPart.println(Console.message("trade-start")); - return var2; + return wd; } - public void printFrom(String var1, String var2) { - if (var2.startsWith("&|+")) { - if (var2.startsWith("&|+gift>") && var1.equalsIgnoreCase("TRADE")) { - maybeQueryGift(var2.substring(8)); - } else if (var2.startsWith("&|+inv>") && var1.equalsIgnoreCase("TRADE")) { - this.tradeMsg(var2.substring(7)); - } else if (var2.startsWith("&|+trade>")) { - TradeDialog var4 = this.findTradeDialog(var1); - if (var2.equals("&|+trade>cancel") && (var4 == null || !var4.isActive() || !var4.isTrading)) { - return; - } - - var4 = this.startToTrade(var1); - var4.print(var2); + public void printFrom(String from, String msg) { + try { + ChatSaver.chatSaver.saveWhisper(from, Console.getActive().getLongID(), msg); + } catch (IOException e) { + e.printStackTrace(); + } + if (!msg.startsWith("&|+")) + { + WhisperDialog it = findWhisperDialog(from); + if ((msg.equals("&|+trade>cancel")) && ( + (it == null) || (!it.isActive()) || (!it.isTrading))) { + return; } - } else { - WhisperDialog var3 = this.findWhisperDialog(var1); - if (var2.equals("&|+trade>cancel") && (var3 == null || !var3.isActive() || !var3.isTrading)) { + it = start(from, false); + it.print(msg); + } + else if ((msg.startsWith("&|+gift>")) && + (from.equalsIgnoreCase("TRADE"))) + { + maybeQueryGift(msg.substring(8)); + } + else if ((msg.startsWith("&|+inv>")) && + (from.equalsIgnoreCase("TRADE"))) + { + tradeMsg(msg.substring(7)); + } + else if (msg.startsWith("&|+trade>")) + { + TradeDialog it = findTradeDialog(from); + if ((msg.equals("&|+trade>cancel")) && ( + (it == null) || (!it.isActive()) || (!it.isTrading))) { return; } - - var3 = this.start(var1, false); - var3.print(var2); + it = startToTrade(from); + it.print(msg); } - } public void tradeMsg(String var1) { @@ -122,26 +153,23 @@ } public void printTo(String var1, String var2) { + try { + ChatSaver.chatSaver.saveWhisper(Console.getActive().getLongID(), var1, var2); + } catch (IOException e) { + e.printStackTrace(); + } if (!var1.equals("world") && !var1.equals("TRADE")) { if (!var2.startsWith("&|+") || var2.startsWith("&|+trade>")) { WhisperDialog var3 = this.start(var1, false); var3.send(var2); } - } } - public void giftDialogDone() { - outstandingGift = null; - } - - public static void maybeQueryGift(String var0) { - if (NetUpdate.isInternalVersion()) { - Console var1 = Console.getActive(); - if (var1 != null && outstandingGift == null && !var1.isSleeping()) { - outstandingGift = new GiftDialog(var0, 3000000); - } - + public static void maybeQueryGift(String inv) { + Console c = Console.getActive(); + if ((c != null)) { + TradeDialog.sendTradeMessage("&|+deal>TRADE ," + inv); } } } diff -ruN a/1904/NET/worlds/core/IniFile.java b/1904/NET/worlds/core/IniFile.java --- a/1904/NET/worlds/core/IniFile.java 2020-08-06 15:46:08.000000000 -0500 +++ b/1904/NET/worlds/core/IniFile.java 2023-09-10 15:38:03.000000000 -0500 @@ -1,10 +1,12 @@ package NET.worlds.core; +import NET.worldsplus.Themer; + public class IniFile { String file; String section; static boolean initialized = false; - private static IniFile gamma_ = null; + private static final IniFile gamma_ = null; private static IniFile override_ = null; public IniFile(String var1) { @@ -12,22 +14,42 @@ this.section = var1; } - private IniFile(String var1, String var2) { + public IniFile(String var1, String var2) { this.file = var1; this.section = var2; } - public static IniFile gamma() { - if (gamma_ == null) { - gamma_ = new IniFile("Gamma"); + public static IniFile ini(String name) { + return ini(gamma_, name); + } + + public static IniFile ini(IniFile ini, String name) { + if (!initialized) { + nativeInit(); + initialized = true; + } + + if (ini == null) { + ini = new IniFile(name); } + return ini; + } + + public static IniFile modPlus() { return ini("WorldsPlus"); } + + public static IniFile modColorfulTags() { return ini("ColorfulTags"); } + public static IniFile modChatLog() { return ini("ChatLog"); } + + public static IniFile modPrivacy() { return ini("Privacy"); } + + public static IniFile gamma() { if (!initialized) { nativeInit(); initialized = true; } - return gamma_; + return ini(gamma_, "Gamma"); } public static IniFile override() { @@ -35,7 +57,7 @@ nativeInit(); initialized = true; } - + if (override_ == null) { override_ = new IniFile(".\\override.ini", "Runtime"); } diff -ruN a/1904/NET/worlds/network/textCmd.java b/1904/NET/worlds/network/textCmd.java --- a/1904/NET/worlds/network/textCmd.java 2020-08-06 15:46:06.000000000 -0500 +++ b/1904/NET/worlds/network/textCmd.java 2023-09-10 19:55:45.000000000 -0500 @@ -1,14 +1,12 @@ package NET.worlds.network; -import NET.worlds.console.BBChatCommand; -import NET.worlds.console.BlackBox; -import NET.worlds.console.Console; -import NET.worlds.console.GammaTextArea; -import NET.worlds.console.MuteListPart; +import NET.worlds.console.*; import NET.worlds.core.IniFile; import NET.worlds.scape.Drone; import NET.worlds.scape.Pilot; import NET.worlds.scape.PosableDrone; +import NET.worldsplus.ChatSaver; + import java.io.IOException; public class textCmd extends receivedNetPacket { @@ -24,6 +22,7 @@ super((ObjID)null, 14); this._senderID = new ObjID(""); this._text = var1; + } void parseNetData(ServerInputStream var1) throws IOException { @@ -45,19 +44,25 @@ void process(WorldServer var1) throws Exception { String var2; if (this._senderID.longID() == null) { - var2 = "[Unknown Name (#" + String.valueOf(this._senderID.shortID()) + ")]"; + var2 = "#" + String.valueOf(this._senderID.shortID()); } else { var2 = this._senderID.longID(); - if (MuteListPart.isMuted(var1, var2)) { - return; - } } + try { + ChatSaver.chatSaver.saveRoom(var2, this._text); + } catch (IOException e) { + e.printStackTrace(); + } + + if (MuteListPart.isMuted(var1, var2)) { + return; + } + handleActionText(var1, this._text, var2, this._senderID); - if (!this._text.startsWith("&|+")) { + if (!this._text.startsWith("&|+") || (IniFile.gamma().getIniInt("DisableAction2", 1) == 1 && this._text.startsWith("&|+action2>"))) { this.displayText(var2, this._text); } - } protected void displayText(String var1, String var2) { @@ -108,7 +113,7 @@ ((PosableDrone)var4).animate(var5); } - if (var1.startsWith("&|+action2>")) { + if (var1.startsWith("&|+action2>") && IniFile.gamma().getIniInt("DisableAction2", 1) == 0) { int var9 = var1.indexOf("|sender|"); var5 = null; String var6 = null; diff -ruN a/1904/NET/worlds/network/whisperCmd.java b/1904/NET/worlds/network/whisperCmd.java --- a/1904/NET/worlds/network/whisperCmd.java 2020-08-06 15:46:06.000000000 -0500 +++ b/1904/NET/worlds/network/whisperCmd.java 2023-08-21 23:27:16.000000000 -0500 @@ -3,63 +3,84 @@ import NET.worlds.console.Console; import NET.worlds.console.FriendsListPart; import NET.worlds.console.MuteListPart; +import NET.worlds.core.IniFile; import NET.worlds.scape.WorldScriptManager; +import NET.worlds.console.RejectHandler; +import NET.worldsplus.ChatSaver; + +import java.io.IOException; 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 whisperRejMSG = Console.message("not-whispers"); + private static String teleportRejMSG = Console.message("not-teleports"); + private static String reject = Console.message("rejected"); + RejectHandler rej = MuteListPart.rej; + + public whisperCmd() { + this._commandType = 17; + } + + public whisperCmd(String var1, String msg) { + super(msg); + WorldScriptManager.getInstance().onConversation(var1, msg); + this._commandType = 17; + this._objID = new ObjID(var1); + } + + void process(WorldServer var1) { + String var2; + Object[] var3; + if (this._senderID.longID() == null) { + var3 = new Object[]{new String(String.valueOf(this._senderID.shortID()))}; + var2 = MessageFormat.format(Console.message("Unknown-Name"), var3); + } else { + var2 = this._senderID.longID(); + if (MuteListPart.isMuted(var1, var2)) { + try { + ChatSaver.chatSaver.saveWhisper(var2, Console.getActive().getLongID(), this._text); + var1.sendNetworkMsg(new NET.worlds.network.whisperCmd(var2, Console.message("have-you-muted"))); + } catch (InfiniteWaitException var4) { } catch (PacketTooLargeException var5) { } catch (IOException var6) { } - public whisperCmd() { - this._commandType = 17; - } - - public whisperCmd(String var1, String var2) { - super(var2); - WorldScriptManager.getInstance().onConversation(var1, var2); - this._commandType = 17; - this._objID = new ObjID(var1); - } - - void process(WorldServer var1) throws Exception { - String var2; - Object[] var3; - if (this._senderID.longID() == null) { - var3 = new Object[]{new String(String.valueOf(this._senderID.shortID()))}; - var2 = MessageFormat.format(Console.message("Unknown-Name"), var3); - } else { - var2 = this._senderID.longID(); - if (MuteListPart.isMuted(var1, var2)) { - try { - var1.sendNetworkMsg(new whisperCmd(var2, Console.message("have-you-muted"))); - } catch (InfiniteWaitException var4) { - } catch (PacketTooLargeException var5) { + return; } - return; - } + if (!this._text.startsWith("&|+") && MuteListPart.isRejecting(var1, var2)) { + try { + if (!this._text.equals(whisperRejMSG)) { + var3 = new Object[]{"whisper", var2}; + if (IniFile.modPrivacy().getIniInt("WhisperFeedback", 1) == 1) Console.println(MessageFormat.format(Console.message("rejected"), var3)); + if (!rej.rejectWhisper(var2)) { + if (IniFile.modPrivacy().getIniInt("WhisperResponse", 1) == 1) var1.sendNetworkMsg(new NET.worlds.network.whisperCmd(var2, whisperRejMSG)); + rej.addWhisperUser(var2); + } + } + } catch (InfiniteWaitException var6) { } catch (PacketTooLargeException var7) { } catch (IOException var6) { } + return; + } - if (!this._text.startsWith("&|+") && MuteListPart.isRejecting(var1)) { - try { - if (!this._text.equals(rejectMsg)) { - var3 = new Object[]{new String(var2)}; - Console.println(MessageFormat.format(Console.message("You-rejected"), var3)); - var1.sendNetworkMsg(new whisperCmd(var2, rejectMsg)); - } - } catch (InfiniteWaitException var6) { - } catch (PacketTooLargeException var7) { + if (this._text.startsWith("&|+where?") && MuteListPart.isRejectingTele(var1, var2)) { + try { + if (!this._text.equals(teleportRejMSG)) { + var3 = new Object[]{"teleport", var2}; + if (IniFile.modPrivacy().getIniInt("TeleportFeedback", 1) == 1) Console.println(MessageFormat.format(Console.message("rejected"), var3)); + if (!rej.rejectTeleport(var2)) { + if (IniFile.modPrivacy().getIniInt("TeleportResponse", 0) == 1) var1.sendNetworkMsg(new NET.worlds.network.whisperCmd(var2, teleportRejMSG)); + rej.addTeleportUser(var2); + } + } + } catch (InfiniteWaitException var6) { } catch (PacketTooLargeException var7) { } + return; } + } - return; - } - } - - FriendsListPart.processWhisper(var1, var2, this._text); - handleActionText(var1, this._text, var2, this._senderID); - Console.printWhisper(var2, FilthFilter.get().filter(this._text)); - } - - public String toString(WorldServer var1) { - return Console.message("WHISPER") + " " + this._senderID.toString(var1) + " --> " + this._objID.toString(var1) + ": " + this._text; - } + FriendsListPart.processWhisper(var1, var2, this._text); + handleActionText(var1, this._text, var2, this._senderID); + Console.printWhisper(var2, FilthFilter.get().filter(this._text)); + } + + public String toString(WorldServer var1) { + return Console.message("WHISPER") + " " + this._senderID.toString(var1) + " --> " + this._objID.toString(var1) + ": " + this._text; + } } diff -ruN a/1904/NET/worlds/scape/ChangeAvatarDialog.java b/1904/NET/worlds/scape/ChangeAvatarDialog.java --- a/1904/NET/worlds/scape/ChangeAvatarDialog.java 2020-08-06 15:46:18.000000000 -0500 +++ b/1904/NET/worlds/scape/ChangeAvatarDialog.java 2023-09-10 16:15:47.000000000 -0500 @@ -6,6 +6,7 @@ import NET.worlds.console.ImageButtonsCallback; import NET.worlds.console.PolledDialog; import NET.worlds.core.IniFile; +import NET.worldsplus.Themer; import java.awt.Component; import java.awt.Rectangle; import java.awt.Window; @@ -18,18 +19,18 @@ super(var1, var2, Console.message("Change-Avatar"), false); this.setAlignment(1); Rectangle[] var4 = new Rectangle[2]; - int var5 = IniFile.override().getIniInt("changeavYesX", 39); - int var6 = IniFile.override().getIniInt("changeavYesY", 23); - int var7 = IniFile.override().getIniInt("changeavYesW", 48); - int var8 = IniFile.override().getIniInt("changeavYesH", 18); + int var5 = Themer.override().getIniInt("changeavYesX", 39); + int var6 = Themer.override().getIniInt("changeavYesY", 23); + int var7 = Themer.override().getIniInt("changeavYesW", 48); + int var8 = Themer.override().getIniInt("changeavYesH", 18); var4[0] = new Rectangle(var5, var6, var7, var8); - int var9 = IniFile.override().getIniInt("changeavNoX", 96); - int var10 = IniFile.override().getIniInt("changeavNoY", 23); - int var11 = IniFile.override().getIniInt("changeavNoW", 42); - int var12 = IniFile.override().getIniInt("changeavnoH", 18); + int var9 = Themer.override().getIniInt("changeavNoX", 96); + int var10 = Themer.override().getIniInt("changeavNoY", 23); + int var11 = Themer.override().getIniInt("changeavNoW", 42); + int var12 = Themer.override().getIniInt("changeavnoH", 18); var4[1] = new Rectangle(var9, var10, var11, var12); Object[] var13 = new Object[]{new String(var3)}; - this.ib = new ChangeAvatarImageButtons(IniFile.override().getIniString("changeAvDlg", Console.message("changeav.gif")), var4, this, MessageFormat.format(Console.message("Change-avatar-to"), var13)); + this.ib = new ChangeAvatarImageButtons(Themer.themer.asset(Console.message("changeav.gif")), var4, this, MessageFormat.format(Console.message("Change-avatar-to"), var13)); this.ready(); } diff -ruN a/1904/NET/worlds/scape/Drone.java b/1904/NET/worlds/scape/Drone.java --- a/1904/NET/worlds/scape/Drone.java 2020-08-06 15:46:14.000000000 -0500 +++ b/1904/NET/worlds/scape/Drone.java 2023-12-15 20:23:40.000000000 -0600 @@ -1,861 +1,974 @@ package NET.worlds.scape; -import NET.worlds.console.BBAppearDroneCommand; -import NET.worlds.console.BBDisappearDroneCommand; -import NET.worlds.console.BBDroneBitmapCommand; -import NET.worlds.console.BBDroneDeltaPosCommand; -import NET.worlds.console.BBMoveDroneCommand; -import NET.worlds.console.BlackBox; -import NET.worlds.console.Console; -import NET.worlds.console.FriendsListPart; -import NET.worlds.console.Main; -import NET.worlds.console.MainCallback; -import NET.worlds.console.MuteListPart; +import NET.worlds.console.*; import NET.worlds.core.Debug; import NET.worlds.core.IniFile; import NET.worlds.core.ServerTableManager; import NET.worlds.core.Std; -import NET.worlds.network.FilthFilter; -import NET.worlds.network.Galaxy; -import NET.worlds.network.InfiniteWaitException; -import NET.worlds.network.NetworkObject; -import NET.worlds.network.ObjID; -import NET.worlds.network.OldPropertyList; -import NET.worlds.network.PacketTooLargeException; -import NET.worlds.network.PropertyList; -import NET.worlds.network.URL; -import NET.worlds.network.WorldServer; -import NET.worlds.network.net2Property; -import NET.worlds.network.netProperty; -import NET.worlds.network.propReqCmd; -import java.awt.Color; +import NET.worlds.network.*; +import NET.worldsplus.MumbleLink; + +import java.awt.*; import java.io.IOException; import java.net.MalformedURLException; import java.util.Enumeration; import java.util.Hashtable; +import java.util.Random; import java.util.Vector; public abstract class Drone extends WObject implements NetworkObject, WobLoaded, MouseDownHandler, FrameHandler { - private int _last_FrameTime; - private int _last_PosTime; - private int _vel_x; - private int _vel_y; - private int _vel_z; - private int _vel_yaw; - private int _last_x; - private int _last_y; - private int _last_z; - private int _last_yaw; - private int _x; - private int _y; - private int _z; - private int _yaw; - private boolean inited = false; - protected WObject tag; - protected WObject tagbg; - private Console console; - private float tagHeight; - private Shape sleepBox; - static boolean showNametags; - private static String[] employeeAccounts; - private static Hashtable employeeHash; - public static Vector usableDrones; - private int lastUsed; - protected WorldServer _server; - private String sleepMode; - private static Object classCookie; - private static Object classCookieInterpolatedDrone; - - public Drone(ObjID var1, WorldServer var2) { - if (var2 != null) { - Debug.dAssert(var1 != null); - this.attachToServer(var2.getLongID(var1), var2); - } - - } - - protected Drone(String var1, WorldServer var2) { - Debug.dAssert(var1 != null); - if (var2 != null) { - this.attachToServer(var1, var2); - } - - } - - private void attachToServer(String var1, WorldServer var2) { - if (var2 != null) { - Debug.dAssert(Main.isMainThread()); - String var3 = null; - if (this.tag != null) { - var3 = this.getLongID(); - } - - this.getSharer().createDynamicFromNet(); - this.setName(var1); - String var4 = this.getLongID(); - this._server = var2; - this._server.incRefCnt(this); - this._server.regObject((String)var4, this); - - try { - this._server.sendNetworkMsg(new propReqCmd(new ObjID(this.getLongID()))); - } catch (InfiniteWaitException var6) { - } catch (PacketTooLargeException var7) { - Debug.dAssert(false); - } - - if (var4.equals(var3)) { - this.avatarHeightChangedTo(189.0F); - } else { - this.makeTag(false); - } - - Main.register(new Drone.MakeSleepBox()); - } - } - - private static void flushUnusedDrones() { - synchronized(usableDrones) { - int var1 = Std.getFastTime(); - int var2 = usableDrones.size(); - - while(true) { - --var2; - if (var2 < 0) { - return; - } - - Drone var3 = (Drone)usableDrones.elementAt(var2); - if (var1 > var3.lastUsed + 2000) { - usableDrones.removeElementAt(var2); - var3.discard(); - } - } - } - } - - public static boolean isEmployeeAccount(String var0) { - if (employeeHash == null) { - employeeHash = new Hashtable(); - - for(int var1 = 0; var1 < employeeAccounts.length; ++var1) { - employeeHash.put(employeeAccounts[var1], employeeAccounts[var1]); - } - } - - return employeeHash.get(var0) != null; - } - - public void makeTag(boolean var1) { - this.tagHeight = 195.0F; - if (this.tag != null) { - this.tagHeight = this.tag.getZ(); - this.tag.detach(); - this.tag = null; - } - - if (this.tagbg != null) { - this.tagbg.detach(); - this.tagbg = null; - } - - if ((this._server != null || var1) && !(this instanceof MutedDrone) && showNametags) { - String var2 = this.getLongID(); - String var3 = FilthFilter.get().filterName(var2); - if (var3 != null && !var3.equals("")) { - Texture[] var4 = new Texture[1]; - boolean var6 = RenderWare.get3DHardwareInUse(); - boolean var7 = var3.toLowerCase().startsWith(Console.message("host")) || var3.toLowerCase().startsWith("host"); - if (var7) { - var3 = Console.message("host-upper") + var3.substring(4); - } - - boolean var8 = var3.toLowerCase().startsWith(Console.message("guest-")) || var3.toLowerCase().startsWith("guest-"); - if (var8) { - var3 = Console.message("guest-upper") + var3.substring(5); - } - - boolean var9 = isEmployeeAccount(var3); - Color var10; - if (var8) { - var10 = Color.pink; - } else if (var7) { - var10 = Color.yellow; - } else if (var9) { - var10 = Color.cyan; - } else { - var10 = Color.lightGray; + private int _last_FrameTime; + private int _last_PosTime; + private int _vel_x; + private int _vel_y; + private int _vel_z; + private int _vel_yaw; + private int _last_x; + private int _last_y; + private int _last_z; + private int _last_yaw; + private int _x; + private int _y; + private int _z; + private int _yaw; + private boolean inited = false; + protected WObject tag; + protected WObject tagbg; + private Console console; + private float tagHeight; + private Shape sleepBox; + static boolean showNametags; + private static final String[] employeeAccounts; + private static Hashtable employeeHash; + public static final Vector usableDrones; + private int lastUsed; + protected WorldServer _server; + private String sleepMode; + private static final Object classCookie; + private static final Object classCookieInterpolatedDrone; + + public Drone(ObjID var1, WorldServer var2) { + if (var2 != null) { + Debug.dAssert(var1 != null); + this.attachToServer(var2.getLongID(var1), var2); + } + + } + + protected Drone(String var1, WorldServer var2) { + Debug.dAssert(var1 != null); + if (var2 != null) { + this.attachToServer(var1, var2); + } + } + + private void attachToServer(String var1, WorldServer var2) { + if (var2 != null) { + Debug.dAssert(Main.isMainThread()); + String var3 = null; + if (this.tag != null) { + var3 = this.getLongID(); + } + + this.getSharer().createDynamicFromNet(); + this.setName(var1); + String var4 = this.getLongID(); + this._server = var2; + this._server.incRefCnt(this); + this._server.regObject(var4, this); + + try { + this._server.sendNetworkMsg(new propReqCmd(new ObjID(this.getLongID()))); + } catch (InfiniteWaitException ignored) { + } catch (PacketTooLargeException ignored) { } - var4[0] = new StringTexture(var3, Console.message("TagFont"), 48, Color.black, var6 ? new Color(254, 254, 254) : var10); - byte var5 = 14; - int var11 = var3.length() * 10; - Hologram var12 = new Hologram((float)var11, (float)var5, var4); - var12.setViewplaneAligned(true); - var12.raise(this.tagHeight); - var12.setScaleDist(300.0F); - this.tag = var12; - this.tag.setVisible(true); - this.tag.setBumpable(false); - this.tag.setLocalShadowed(false); - this.tag.setShadowedLocally(true); - this.add(this.tag); - if (var6) { - Texture[] var13 = new Texture[]{new StringTexture(var3, Console.message("TagFont"), 48, Color.black, var10)}; - Hologram var14 = new Hologram((float)var11, (float)var5, var13); - var14.setViewplaneAligned(true); - var14.raise(this.tagHeight); - var14.setScaleDist(300.0F); - var14.setMaterial(new Material(0.75F, 0.0F, 0.0F, Color.white, (Texture)null, 0.5F, false, false)); - this.tagbg = var14; - this.tagbg.setVisible(true); - this.tagbg.setBumpable(false); - this.tagbg.setLocalShadowed(false); - this.tagbg.setShadowedLocally(true); - this.add(this.tagbg); - } - - } - } - } - - protected void avatarHeightChangedTo(float var1) { - if (this.tag != null) { - this.tag.raise(var1 + 1.0F + 5.0F - this.tag.getZ()); - } - - if (this.tagbg != null) { - this.tagbg.raise(var1 + 1.0F + 5.0F - this.tagbg.getZ()); - } - - } - - public void detachFromServer(boolean var1) { - Debug.dAssert(Main.isMainThread()); - if (this._server != null) { - this._server.delObject(new ObjID(this.getLongID())); - this._server.decRefCnt(this); - this._server = null; - } - - if (var1) { - this.lastUsed = Std.getFastTime(); - synchronized(usableDrones) { - usableDrones.addElement(this); - } - } - - } - - public static Drone make(ObjID var0, WorldServer var1) { - synchronized(usableDrones) { - if (!usableDrones.isEmpty() && var0 != null && var1 != null) { - String var3 = "!" + var1.getLongID(var0); - - int var4; - Drone var5; - for(var4 = usableDrones.size() - 1; var4 > 0; --var4) { - var5 = (Drone)usableDrones.elementAt(var4); - if (var5.getName().equals(var3)) { - break; - } - } - - var5 = (Drone)usableDrones.elementAt(var4); - if (!var5.getName().equals(var3) && usableDrones.size() < 5) { - return new HoloDrone(var0, var1); + if (var4.equals(var3)) { + this.avatarHeightChangedTo(189.0F); } else { - usableDrones.removeElementAt(var4); - var5.attachToServer(var1.getLongID(var0), var1); - return var5; - } - } else { - return new HoloDrone(var0, var1); - } - } - } - - public Drone() { - } - - public boolean handle(MouseDownEvent var1) { - if (this._server != null && (var1.key & 1) == 1) { - FriendsListPart.droneClick(this, var1); - } - - return true; - } - - public float animate(String var1) { - if (var1.equalsIgnoreCase("_hdb")) { - new Drone.BounceNametag(); - } - - return 0.0F; - } - - public Vector getAnimationList() { - return new Vector(); - } - - public void muteStateChanged() { - this.setAvatarNow(this.getCurrentURL()); - } - - public boolean shouldBeMuted() { - return MuteListPart.isMuted(this._server, this.getLongID()); - } - - private World getOwnerWorld() { - WObject var1 = (WObject)this.getOwner(); - Room var2 = var1 == null ? null : var1.getRoom(); - World var3 = var2 == null ? null : var2.getWorld(); - return var3; - } - - public boolean shouldBeForcedHuman() { - World var1 = this.getOwnerWorld(); - return var1 != null && var1.getForceHuman(); - } - - public URL getCurrentURL() { - return this instanceof PosableDrone ? ((PosableDrone)this).getPosableShapeURL() : this.getSourceURL(); - } - - public Drone setAvatarNow(URL var1) { - if (var1 == null) { - return this; - } else { - if (this.shouldBeForcedHuman()) { - var1 = PosableShape.getHuman(var1); - if (Console.getActive() != null) { - Console.getActive().pendingPilot = var1.toString(); - } - } - - var1 = PosableShape.getPermitted(var1, this.getWorld()); - boolean var2 = this.shouldBeMuted(); - if (var1.equals(this.getCurrentURL()) && var2 == (this instanceof MutedDrone)) { - return this; - } else if (!var1.endsWith(".rwx") && !var1.endsWith(".rwg") && !var1.endsWith(".mov")) { - String var7 = var1.getInternal(); - if (var7.endsWith(".pilot")) { - var7 = var7.substring(0, var7.length() - 6) + ".drone"; - } else if (!var7.endsWith(".drone")) { - var7 = var7 + ".drone"; + this.makeTag(false); } - var1 = URL.make(var7); - if (var1.equals(this.getSourceURL())) { - return this; + Main.register(new Drone$MakeSleepBox(this)); + } + } + + private static void flushUnusedDrones() { + synchronized(usableDrones) { + int var1 = Std.getFastTime(); + int var2 = usableDrones.size(); + + while(true) { + --var2; + if (var2 < 0) { + return; + } + + Drone var3 = (Drone)usableDrones.elementAt(var2); + if (var1 > var3.lastUsed + 2000) { + usableDrones.removeElementAt(var2); + var3.discard(); + } + } + } + } + + public static boolean isEmployeeAccount(String var0) { + if (employeeHash == null) { + employeeHash = new Hashtable(); + + for(int var1 = 0; var1 < employeeAccounts.length; ++var1) { + employeeHash.put(employeeAccounts[var1], employeeAccounts[var1]); + } + } + + return employeeHash.get(var0) != null; + } + + public void makeTag(boolean var1) { + this.tagHeight = 195.0F; + if (this.tag != null) { + this.tagHeight = this.tag.getZ(); + this.tag.detach(); + this.tag = null; + } + + if (this.tagbg != null) { + this.tagbg.detach(); + this.tagbg = null; + } + + if ((this._server != null || var1) && !(this instanceof MutedDrone) && showNametags) { + String var2 = this.getLongID(); + String var3 = FilthFilter.get().filterName(var2); + if (var3 != null && !var3.equals("")) { + Texture[] var4 = new Texture[1]; + boolean isHost = var3.toLowerCase().startsWith(Console.message("host")) || var3.toLowerCase().startsWith("host"); + if (isHost) { + var3 = Console.message("host-upper") + var3.substring(4); + } + + boolean isGuest = var3.toLowerCase().startsWith(Console.message("guest-")) || var3.toLowerCase().startsWith("guest-"); + if (isGuest) { + var3 = Console.message("guest-upper") + var3.substring(5); + } + + boolean colorfulMod = IniFile.gamma().getIniInt("ColorfulTags", 0) == 1; + boolean randomizeTag = false, underline = false; + boolean transparent = IniFile.modColorfulTags().getIniInt("Transparent", 0) == 1; + boolean isTar = TarListPart.isTarred(_server, var3); + Color userTextColor, employeeTextColor, hostTextColor, guestTextColor, tarTextColor; + Color userTagColor, employeeTagColor, hostTagColor, guestTagColor, tarTagColor; + try { + if (colorfulMod) { + randomizeTag = IniFile.modColorfulTags().getIniInt("RandomizeColors", 0) == 1; + underline = IniFile.modColorfulTags().getIniInt("UnderlineStaff", 1) == 1; + + /* + * Color Parsing + * + * This is setup like this so we don't have 3 values for each tag type. Keeps the INI clean. + * If the value isn't valid, given we are parsing a string into 3 ints, we should just use the default. + */ + + userTagColor = parseColor(IniFile.modColorfulTags().getIniString("UserTagColor", "192,192,192")); + userTextColor = parseColor(IniFile.modColorfulTags().getIniString("UserTextColor", "0,0,0")); + + employeeTagColor = parseColor(IniFile.modColorfulTags().getIniString("EmployeeTagColor", "0,255,255")); + employeeTextColor = parseColor(IniFile.modColorfulTags().getIniString("EmployeeTextColor", "0,0,0")); + + hostTagColor = parseColor(IniFile.modColorfulTags().getIniString("HostTagColor", "255,255,0")); + hostTextColor = parseColor(IniFile.modColorfulTags().getIniString("HostTextColor", "0,0,0")); + + guestTagColor = parseColor(IniFile.modColorfulTags().getIniString("GuestTagColor", "255,192,203")); + guestTextColor = parseColor(IniFile.modColorfulTags().getIniString("GuestTextColor", "0,0,0")); + + tarTagColor = parseColor(IniFile.modColorfulTags().getIniString("TarTagColor", "192,192,192")); + tarTextColor = parseColor(IniFile.modColorfulTags().getIniString("TarTextColor", "0,0,0")); + } else { + throw new Exception(); + } + } catch (Exception e1) { + userTagColor = new Color(192,192,192); + userTextColor = new Color(0,0,0); + employeeTagColor = new Color(0,255,255); + employeeTextColor = new Color(0,0,0); + hostTagColor = new Color(255,255,0); + hostTextColor = new Color(0,0,0); + guestTagColor = new Color(255,192,203); + guestTextColor = new Color(0,0,0); + tarTagColor = new Color(192, 192, 192); + tarTextColor = new Color(0,0,0); + } + boolean isEmployee = isEmployeeAccount(var3); + Color curTextColor, curTagColor; + if (isGuest) { + curTagColor = guestTagColor; + curTextColor = guestTextColor; + } else if (isHost) { + curTagColor = hostTagColor; + curTextColor = hostTextColor; + } else if (isEmployee) { + curTagColor = employeeTagColor; + curTextColor = employeeTextColor; + } else if (isTar) { + curTagColor = tarTagColor; + curTextColor = tarTextColor; + } else { + curTagColor = userTagColor; + curTextColor = userTextColor; + } + + if (randomizeTag && (!isEmployee && !isGuest && !isHost && !isTar)) { + Random rand = new Random(); + Color randomized = new Color( + rand.nextInt((255) + 1), + rand.nextInt((255) + 1), + rand.nextInt((255) + 1)).brighter(); + curTextColor = transparent ? randomized : userTextColor; + curTagColor = transparent ? userTagColor : randomized; + } + + if (transparent) { + if (isEmployee || isGuest || isHost || isTar) curTextColor = curTagColor; + curTagColor = new Color(254,254,254); + } + + boolean isSpecial = (isHost || isGuest || isEmployee); + + var4[0] = new StringTexture(var3, Console.message("TagFont"), IniFile.modColorfulTags().getIniInt("Fontsize", 48), curTextColor, curTagColor); + byte var5 = 18; + int var11 = var3.length() * 12; + Hologram var12 = new Hologram((float)var11, (float)var5, var4); + var12.setViewplaneAligned(true); + var12.raise(this.tagHeight); + var12.setScaleDist(300.0F); + this.tag = var12; + this.tag.setVisible(true); + this.tag.setBumpable(false); + this.tag.setLocalShadowed(true); + this.tag.setShadowedLocally(true); + this.add(this.tag); + if (colorfulMod && isSpecial && underline && transparent) { + StringBuffer underscore = new StringBuffer(); + for (int i = 0; i < var3.length(); i++) { + underscore.append("_"); + } + Texture[] var13 = new Texture[]{new StringTexture(underscore.toString(), Console.message("TagFont"), 48, curTextColor, curTagColor)}; + Hologram var14 = new Hologram((float) var11, (float) var5, var13); + var14.setViewplaneAligned(true); + var14.raise(this.tagHeight); + var14.setScaleDist(300.0F); + this.tagbg = var14; + this.tagbg.setVisible(true); + this.tagbg.setBumpable(false); + this.tagbg.setLocalShadowed(false); + this.tagbg.setShadowedLocally(true); + this.add(this.tagbg); + } + } + } + } + + private Color parseColor(String tag) { + String[] spl = tag.split(","); + return new Color(Integer.parseInt(spl[0]), Integer.parseInt(spl[1]), Integer.parseInt(spl[2])); + } + + protected void avatarHeightChangedTo(float var1) { + if (this.tag != null) { + this.tag.raise(var1 + 1.0F + 5.0F - this.tag.getZ()); + } + + if (this.tagbg != null) { + this.tagbg.raise(var1 + 1.0F + 5.0F - this.tagbg.getZ()); + } + + } + + public void detachFromServer(boolean var1) { + Debug.dAssert(Main.isMainThread()); + if (this._server != null) { + this._server.delObject(new ObjID(this.getLongID())); + this._server.decRefCnt(this); + this._server = null; + } + + if (var1) { + this.lastUsed = Std.getFastTime(); + synchronized(usableDrones) { + usableDrones.addElement(this); + } + } + + } + + public static Drone make(ObjID var0, WorldServer var1) { + synchronized(usableDrones) { + if (!usableDrones.isEmpty() && var0 != null && var1 != null) { + String var3 = "!" + var1.getLongID(var0); + + int var4; + Drone var5; + for(var4 = usableDrones.size() - 1; var4 > 0; --var4) { + var5 = (Drone)usableDrones.elementAt(var4); + if (var5.getName().equals(var3)) { + break; + } + } + + var5 = (Drone)usableDrones.elementAt(var4); + if (!var5.getName().equals(var3) && usableDrones.size() < 5) { + return new HoloDrone(var0, var1); + } else { + usableDrones.removeElementAt(var4); + var5.attachToServer(var1.getLongID(var0), var1); + return var5; + } } else { - new WobLoader(var1, this); - return this; + return new HoloDrone(var0, var1); } - } else { - WObject var3 = (WObject)this.getOwner(); - if (var3 == null) { - return this; + } + } + + public Drone() { + } + + public boolean handle(MouseDownEvent var1) { + if (this._server != null && (var1.key & 1) == 1) { + FriendsListPart.droneClick(this, var1); + } + + return true; + } + + public float animate(String var1) { + if (var1.equalsIgnoreCase("_hdb")) { + new Drone$BounceNametag(this); + } + + return 0.0F; + } + + public Vector getAnimationList() { + return new Vector(); + } + + public void muteStateChanged() { + this.setAvatarNow(this.getCurrentURL()); + } + + public void tarStateChanged() { + this.setAvatarNow(this.getCurrentURL()); + } + + public void avtStateChanged() { + this.setAvatarNow(URL.make("avatar:holden.mov")); + } + + public boolean shouldBeMuted() { + return MuteListPart.isMuted(this._server, this.getLongID()); + } + + public boolean shouldBeTarred() { + return TarListPart.isTarred(this._server, this.getLongID()); + } + + private World getOwnerWorld() { + WObject var1 = (WObject)this.getOwner(); + Room var2 = var1 == null ? null : var1.getRoom(); + World var3 = var2 == null ? null : var2.getWorld(); + return var3; + } + + public boolean shouldBeForcedHuman() { + return (this.getOwnerWorld() != null && this.getOwnerWorld().getForceHuman()); + } + + public URL getCurrentURL() { + return this instanceof PosableDrone ? ((PosableDrone)this).getPosableShapeURL() : this.getSourceURL(); + } + + public Drone setAvatarNow(URL var1) { + if (var1 == null) { + return this; + } else { + if (this.shouldBeForcedHuman()) { + var1 = PosableShape.getHuman(var1); + if (Console.getActive() != null) { + Console.getActive().pendingPilot = var1.toString(); + } + } + + var1 = PosableShape.getPermitted(var1, this.getWorld()); + boolean var2 = this.shouldBeMuted(); + boolean var12 = this.shouldBeTarred(); + if (var1.equals(this.getCurrentURL()) && (var2 == (this instanceof MutedDrone))) { + return this; + } else if (!var1.endsWith(".rwx") && !var1.endsWith(".rwg") && !var1.endsWith(".mov")) { + String var7 = var1.getInternal(); + if (var7.endsWith(".pilot")) { + var7 = var7.substring(0, var7.length() - 6) + ".drone"; + } else if (!var7.endsWith(".drone")) { + var7 = var7 + ".drone"; + } + + var1 = URL.make(var7); + if (var1.equals(this.getSourceURL())) { + return this; + } else { + new WobLoader(var1, this); + return this; + } } else { - WorldServer var4 = this._server; - String var5 = this.getLongID(); - this.detachFromServer(false); - this.detach(); - Object var6; - if (var2) { - var6 = new MutedDrone(new ObjID(var5), var4, var1); - } else if (var1.endsWith(".mov")) { - var6 = new HoloDrone(new ObjID(var5), var4); - ((Drone)var6).setAvatarNow(var1); - } else { - var6 = new PosableDrone(new ObjID(var5), var4, var1); - } - - if (var4 != null) { - ((Drone)var6).transferFrom(this); - ((Drone)var6).addTo(var3.getRoom()); - } else { - ((Drone)var6).makeIdentity().post(this); - ((Drone)var6).setName(this.getLongID()); - var3.add((WObject)var6); - } - - return (Drone)var6; - } - } - } - } - - public void wobLoaded(WobLoader var1, SuperRoot var2) { - if (var2 instanceof Drone) { - Debug.dAssert(var2 != null); - Drone var3 = (Drone)var2; - var3.setName(this.getLongID()); - if (this._server == null) { - WObject var7 = (WObject)this.getOwner(); - this.detach(); - var3.makeIdentity().post(this); - var7.add(var3); - } else { - WorldServer var4 = this._server; - String var5 = this.getLongID(); - this.detachFromServer(false); - Room var6 = this.getRoom(); - this.detach(); - var3.addTo(var6); - var3.attachToServer(var5, var4); - var3.transferFrom(this); - } - } - } - - public void addTo(Room var1) { - if (var1 != null) { - Console var2 = var1.getWorld().getConsole(); - if (this.console == null) { - this.console = var2; - if (var2 != null) { - Pilot.copySoul(var2.getDroneSoulTemplate(), this); - } - } - - var1.add(this); - } - } - - public void add(WObject var1) { - super.add(var1); - } - - protected void noteUnadding(SuperRoot var1) { - if (var1 instanceof WObject) { - WObject var2 = (WObject)var1; - if (var2.isDynamic()) { - var2.setVisible(true); - } - } - - super.noteUnadding(var1); - } - - public void setSleepMode(String var1) { - if (!var1.equals(this.sleepMode)) { - this.sleepMode = var1; - Main.register(new Drone.MakeSleepBox()); - } - } - - private void handleVAR_ASLEEP(String var1) { - if (var1 != null && var1.length() > 2 && var1.charAt(0) == 0) { - var1 = var1.substring(2); - } - - this.setSleepMode(var1); - } - - public Drone handleVAR_BITMAP(String var1) { - if (var1.equals("")) { - return this; - } else { - BlackBox.getInstance().submitEvent(new BBDroneBitmapCommand(this.getName(), var1)); - if (var1.charAt(0) == 0) { + WObject var3 = (WObject)this.getOwner(); + if (var3 == null) { + return this; + } else { + WorldServer var4 = this._server; + String var5 = this.getLongID(); + this.detachFromServer(false); + this.detach(); + Drone var6; + if (var2) { + var6 = new MutedDrone(new ObjID(var5), var4, var1); + } else if (var12) { + var6 = new TarredDrone(new ObjID(var5), var4, var1); + } else if (var1.endsWith(".mov")) { + var6 = new HoloDrone(new ObjID(var5), var4); + var6.setAvatarNow(var1); + } else { + if (IniFile.gamma().getIniInt("AllowAvatarRWX", 1) == 0 && var1.endsWith(".rwx")) { + var6 = new HoloDrone(new ObjID(var5), var4); + } else { + var6 = new PosableDrone(new ObjID(var5), var4, var1); + } + + } + + if (var4 != null) { + var6.transferFrom(this); + var6.addTo(var3.getRoom()); + } else { + var6.makeIdentity().post(this); + var6.setName(this.getLongID()); + var3.add(var6); + } + + return var6; + } + } + } + } + + public void wobLoaded(WobLoader var1, SuperRoot var2) { + if (var2 instanceof Drone) { + Debug.dAssert(var2 != null); + Drone var3 = (Drone)var2; + var3.setName(this.getLongID()); + if (this._server == null) { + WObject var7 = (WObject)this.getOwner(); + this.detach(); + var3.makeIdentity().post(this); + var7.add(var3); + } else { + WorldServer var4 = this._server; + String var5 = this.getLongID(); + this.detachFromServer(false); + Room var6 = this.getRoom(); + this.detach(); + var3.addTo(var6); + var3.attachToServer(var5, var4); + var3.transferFrom(this); + } + } + } + + public void addTo(Room var1) { + if (var1 != null) { + Console var2 = var1.getWorld().getConsole(); + if (this.console == null) { + this.console = var2; + if (var2 != null) { + Pilot.copySoul(var2.getDroneSoulTemplate(), this); + } + } + + var1.add(this); + } + } + + public void add(WObject var1) { + super.add(var1); + } + + protected void noteUnadding(SuperRoot var1) { + if (var1 instanceof WObject) { + WObject var2 = (WObject)var1; + if (var2.isDynamic()) { + var2.setVisible(true); + } + } + + super.noteUnadding(var1); + } + + public void setSleepMode(String var1) { + if (!var1.equals(this.sleepMode)) { + this.sleepMode = var1; + Main.register(new Drone$MakeSleepBox(this)); + } + } + + private void handleVAR_ASLEEP(String var1) { + if (var1 != null && var1.length() > 2 && var1.charAt(0) == 0) { var1 = var1.substring(2); - } + } + + this.setSleepMode(var1); + } - try { - return this.setAvatarNow(new URL(URL.getAvatar(), var1)); - } catch (MalformedURLException var3) { - Console.println(Console.message("Invalid-av") + var1); + public Drone handleVAR_BITMAP(String var1) { + if (var1.equals("")) { return this; - } - } - } - - public Point3Temp getVelocity() { - return Point3Temp.make((float)this._vel_x, (float)this._vel_y, (float)this._vel_z); - } - - public int getYawRate() { - return this._vel_yaw; - } - - public boolean handle(FrameEvent var1) { - if (this._server == null) { - return true; - } else { - int var2 = var1.time; - this.interpolate(var2, this._server.getUpdateTime(), this); - return true; - } - } - - public void interpolate(int var1, int var2, Transform var3) { - if (this.inited) { - if (var1 - this._last_PosTime > var2) { - this._last_PosTime = var1; - this._vel_x = this._last_x - this._x; - this._vel_y = this._last_y - this._y; - this._vel_z = this._last_z - this._z; - this._vel_yaw = ((this._last_yaw - this._yaw) % 360 + 360) % 360; - Debug.dAssert(this._vel_yaw >= 0); - if (this._vel_yaw > 180) { - this._vel_yaw -= 360; - } - } - - double var4 = (double)(var1 - this._last_FrameTime) / (double)var2; - if (var1 - this._last_FrameTime > var2) { - var4 = 0.0D; - } - - this._x += (int)(var4 * (double)this._vel_x); - this._y += (int)(var4 * (double)this._vel_y); - this._z += (int)(var4 * (double)this._vel_z); - this._yaw += (int)(var4 * (double)this._vel_yaw) % 360; - var3.makeIdentity().moveBy((float)this._x, (float)this._y, (float)this._z).yaw((float)this._yaw); - this._last_FrameTime = var1; - } - } - - public void reset(short var1, short var2, short var3, short var4) { - this._x = var1; - this._y = var2; - this._z = var3; - this._yaw = var4; - this._vel_x = this._vel_y = this._vel_z = 0; - this._vel_yaw = 0; - this._last_x = this._x; - this._last_y = this._y; - this._last_z = this._z; - this._last_yaw = this._yaw; - this._last_PosTime = this._last_FrameTime = Std.getRealTime(); - this.inited = true; - } - - protected void transferFrom(Drone var1) { - this.makeIdentity().post(var1); - this._x = var1._x; - this._y = var1._y; - this._z = var1._z; - this._yaw = var1._yaw; - this._vel_x = var1._vel_x; - this._vel_y = var1._vel_y; - this._vel_z = var1._vel_z; - this._vel_yaw = var1._vel_yaw; - this._last_x = var1._last_x; - this._last_y = var1._last_y; - this._last_z = var1._last_z; - this._last_yaw = var1._last_yaw; - this._last_PosTime = var1._last_PosTime; - this._last_FrameTime = var1._last_FrameTime; - this.inited = true; - } - - public void appear(Room var1, short var2, short var3, short var4, short var5) { - Debug.dAssert(var1 != null); - BlackBox.getInstance().submitEvent(new BBAppearDroneCommand(var1.toString(), this.getName(), var2, var3, var4, var5)); - if (this.getRoom() != var1) { - this.detach(); - var1.add(this); - } - - this.makeIdentity().moveBy((float)var2, (float)var3, (float)var4).yaw((float)var5); - this._x = var2; - this._y = var3; - this._z = var4; - this._yaw = var5; - this._vel_x = this._vel_y = this._vel_z = 0; - this._vel_yaw = 0; - this._last_x = var2; - this._last_y = var3; - this._last_z = var4; - this._last_yaw = var5; - this._last_PosTime = this._last_FrameTime = Std.getRealTime(); - URL var6 = this.getCurrentURL(); - if (var6 != null) { - this.setAvatarNow(var6); - } - - this.inited = true; - } - - public void disappear() { - BlackBox.getInstance().submitEvent(new BBDisappearDroneCommand(this.getName())); - this.detachFromServer(true); - this.detach(); - } - - public void longLoc(short var1, short var2, short var3, short var4) { - if (!(this.getOwner() instanceof Pilot)) { - BlackBox.getInstance().submitEvent(new BBMoveDroneCommand(this.getName(), var1, var2, var3, var4)); - } - - this._last_x = var1; - this._last_y = var2; - this._last_z = var3; - this._last_yaw = var4; - this._vel_x = this._last_x - this._x; - this._vel_y = this._last_y - this._y; - this._vel_z = this._last_z - this._z; - this._vel_yaw = ((this._last_yaw - this._yaw) % 360 + 360) % 360; - Debug.dAssert(this._vel_yaw >= 0); - if (this._vel_yaw > 180) { - this._vel_yaw -= 360; - } - - this._last_PosTime = Std.getRealTime(); - this.inited = true; - } - - public void property(OldPropertyList var1) { - int var3 = var1.size(); - - for(int var4 = 0; var4 < var3; ++var4) { - netProperty var2 = var1.elementAt(var4); - switch(var2.property()) { - case 5: - this.handleVAR_BITMAP(var2.value()); - break; - case 23: - this.handleVAR_ASLEEP(var2.value()); - break; - default: - byte[] var5 = new byte[var2.value().length()]; - var2.value().getBytes(0, var2.value().length(), var5, 0); - this.getSharer().setFromNetData(var2.property(), var5); - } - } - - } - - public void propertyUpdate(PropertyList var1) { - int var3 = var1.size(); - - for(int var4 = 0; var4 < var3; ++var4) { - net2Property var2 = var1.elementAt(var4); - switch(var2.property()) { - case 5: - this.handleVAR_BITMAP(var2.value()); - break; - case 23: - this.handleVAR_ASLEEP(var2.value()); - break; - default: - this.getSharer().setFromNetData(var2.property(), var2.data()); - } - } - - } - - public void roomChange(Room var1, short var2, short var3, short var4, short var5) { - this.detach(); - if (var1 != null) { - this.appear(var1, var2, var3, var4, var5); - } - - } - - public void shortLoc(byte var1, byte var2, byte var3) { - if (!(this.getOwner() instanceof Pilot)) { - BlackBox.getInstance().submitEvent(new BBDroneDeltaPosCommand(this.getName(), var1, var2, var3)); - } - - this._last_x += var1; - this._last_y += var2; - this._last_yaw += var3; - this._last_yaw %= 360; - this._vel_x = this._last_x - this._x; - this._vel_y = this._last_y - this._y; - this._vel_z = 0; - this._vel_yaw = ((this._last_yaw - this._yaw) % 360 + 360) % 360; - Debug.dAssert(this._vel_yaw >= 0); - if (this._vel_yaw > 180) { - this._vel_yaw -= 360; - } - - this._last_PosTime = Std.getRealTime(); - } - - public void teleport(WorldServer var1, byte var2, byte var3, Room var4, short var5, short var6, short var7, short var8) { - Debug.dAssert(var1.getObject(new ObjID(this.getLongID())) == this); - Room var9 = this.getRoom(); - switch(var2) { - default: - if (var9 != null) { - Debug.dAssert(var9 != null); - this.detach(); - } - case 0: - switch(var3) { - case 0: - this.detachFromServer(true); + } else { + BlackBox.getInstance().submitEvent(new BBDroneBitmapCommand(this.getName(), var1)); + if (var1.charAt(0) == 0) { + var1 = var1.substring(2); + } + + try { + return this.setAvatarNow(new URL(URL.getAvatar(), var1)); + } catch (MalformedURLException var3) { + Console.println(Console.message("Invalid-av") + var1); + return this; + } + } + } + + public Point3Temp getVelocity() { + return Point3Temp.make((float)this._vel_x, (float)this._vel_y, (float)this._vel_z); + } + + public int getYawRate() { + return this._vel_yaw; + } + + public boolean handle(FrameEvent var1) { + if (this._server == null) { + return true; + } else { + int var2 = var1.time; + this.interpolate(var2, this._server.getUpdateTime(), this); + return true; + } + } + + public void interpolate(int var1, int var2, Transform var3) { + if (this.inited) { + if (var1 - this._last_PosTime > var2) { + this._last_PosTime = var1; + this._vel_x = this._last_x - this._x; + this._vel_y = this._last_y - this._y; + this._vel_z = this._last_z - this._z; + this._vel_yaw = ((this._last_yaw - this._yaw) % 360 + 360) % 360; + Debug.dAssert(this._vel_yaw >= 0); + if (this._vel_yaw > 180) { + this._vel_yaw -= 360; + } + } + + double var4 = (double)(var1 - this._last_FrameTime) / (double)var2; + if (var1 - this._last_FrameTime > var2) { + var4 = 0.0D; + } + + this._x += (int)(var4 * (double)this._vel_x); + this._y += (int)(var4 * (double)this._vel_y); + this._z += (int)(var4 * (double)this._vel_z); + this._yaw += (int)(var4 * (double)this._vel_yaw) % 360; + var3.makeIdentity().moveBy((float)this._x, (float)this._y, (float)this._z).yaw((float)this._yaw); + this._last_FrameTime = var1; + } + } + + public void reset(short var1, short var2, short var3, short var4) { + this._x = var1; + this._y = var2; + this._z = var3; + this._yaw = var4; + this._vel_x = this._vel_y = this._vel_z = 0; + this._vel_yaw = 0; + this._last_x = this._x; + this._last_y = this._y; + this._last_z = this._z; + this._last_yaw = this._yaw; + this._last_PosTime = this._last_FrameTime = Std.getRealTime(); + this.inited = true; + } + + protected void transferFrom(Drone var1) { + this.makeIdentity().post(var1); + this._x = var1._x; + this._y = var1._y; + this._z = var1._z; + this._yaw = var1._yaw; + this._vel_x = var1._vel_x; + this._vel_y = var1._vel_y; + this._vel_z = var1._vel_z; + this._vel_yaw = var1._vel_yaw; + this._last_x = var1._last_x; + this._last_y = var1._last_y; + this._last_z = var1._last_z; + this._last_yaw = var1._last_yaw; + this._last_PosTime = var1._last_PosTime; + this._last_FrameTime = var1._last_FrameTime; + this.inited = true; + } + + public void appear(Room var1, short var2, short var3, short var4, short var5) { + Debug.dAssert(var1 != null); + BlackBox.getInstance().submitEvent(new BBAppearDroneCommand(var1.toString(), this.getName(), var2, var3, var4, var5)); + if (this.getRoom() != var1) { this.detach(); - break; - default: - if (var4 == null) { - this.detach(); - } else { - Debug.dAssert(var4 != null); - this.appear(var4, var5, var6, var7, var8); - } - } + var1.add(this); + } + + this.makeIdentity().moveBy((float)var2, (float)var3, (float)var4).yaw((float)var5); + this._x = var2; + this._y = var3; + this._z = var4; + this._yaw = var5; + this._vel_x = this._vel_y = this._vel_z = 0; + this._vel_yaw = 0; + this._last_x = var2; + this._last_y = var3; + this._last_z = var4; + this._last_yaw = var5; + this._last_PosTime = this._last_FrameTime = Std.getRealTime(); + URL var6 = this.getCurrentURL(); + if (var6 != null) { + this.setAvatarNow(var6); + } + + this.inited = true; + } + + public void disappear() { + BlackBox.getInstance().submitEvent(new BBDisappearDroneCommand(this.getName())); + this.detachFromServer(true); + this.detach(); + } + + public void longLoc(short var1, short var2, short var3, short var4) { + if (!(this.getOwner() instanceof Pilot)) { + BlackBox.getInstance().submitEvent(new BBMoveDroneCommand(this.getName(), var1, var2, var3, var4)); + } + + this._last_x = var1; + this._last_y = var2; + this._last_z = var3; + this._last_yaw = var4; + this._vel_x = this._last_x - this._x; + this._vel_y = this._last_y - this._y; + this._vel_z = this._last_z - this._z; + this._vel_yaw = ((this._last_yaw - this._yaw) % 360 + 360) % 360; + Debug.dAssert(this._vel_yaw >= 0); + if (this._vel_yaw > 180) { + this._vel_yaw -= 360; + } + + this._last_PosTime = Std.getRealTime(); + this.inited = true; + } + + public void property(OldPropertyList var1) { + int var3 = var1.size(); + + for(int var4 = 0; var4 < var3; ++var4) { + netProperty var2 = var1.elementAt(var4); + switch(var2.property()) { + case 5: + this.handleVAR_BITMAP(var2.value()); + break; + case 23: + this.handleVAR_ASLEEP(var2.value()); + break; + default: + byte[] var5 = new byte[var2.value().length()]; + var2.value().getBytes(0, var2.value().length(), var5, 0); + this.getSharer().setFromNetData(var2.property(), var5); + } + } + + } + + public void propertyUpdate(PropertyList var1) { + int var3 = var1.size(); + + for(int var4 = 0; var4 < var3; ++var4) { + net2Property var2 = var1.elementAt(var4); + switch(var2.property()) { + case 5: + this.handleVAR_BITMAP(var2.value()); + break; + case 23: + this.handleVAR_ASLEEP(var2.value()); + break; + default: + this.getSharer().setFromNetData(var2.property(), var2.data()); + } + } + + } + + public void roomChange(Room var1, short var2, short var3, short var4, short var5) { + this.detach(); + if (var1 != null) { + this.appear(var1, var2, var3, var4, var5); + } + + } + + public void shortLoc(byte var1, byte var2, byte var3) { + if (!(this.getOwner() instanceof Pilot)) { + BlackBox.getInstance().submitEvent(new BBDroneDeltaPosCommand(this.getName(), var1, var2, var3)); + } + + this._last_x += var1; + this._last_y += var2; + this._last_yaw += var3; + this._last_yaw %= 360; + this._vel_x = this._last_x - this._x; + this._vel_y = this._last_y - this._y; + this._vel_z = 0; + this._vel_yaw = ((this._last_yaw - this._yaw) % 360 + 360) % 360; + Debug.dAssert(this._vel_yaw >= 0); + if (this._vel_yaw > 180) { + this._vel_yaw -= 360; + } + this._last_PosTime = Std.getRealTime(); + } + + public void teleport(WorldServer var1, byte var2, byte var3, Room var4, short var5, short var6, short var7, short var8) { + Debug.dAssert(var1.getObject(new ObjID(this.getLongID())) == this); + Room var9 = this.getRoom(); + switch(var2) { + default: + if (var9 != null) { + Debug.dAssert(var9 != null); + this.detach(); + } + case 0: + switch(var3) { + case 0: + this.detachFromServer(true); + this.detach(); + break; + default: + if (var4 == null) { + this.detach(); + } else { + Debug.dAssert(var4 != null); + this.appear(var4, var5, var6, var7, var8); + } + } + + } + } + + public WorldServer getServer() { + return this._server; + } + + public String getLongID() { + String var1 = this.getName(); + if (var1.startsWith("!")) { + var1 = var1.substring(1); + } + + return var1; + } + + public void register() { + Debug.dAssert(false); + } + + public void galaxyDisconnected() { + Debug.dAssert(false); + } + + public void reacquireServer(WorldServer var1) { + Debug.dAssert(false); + } + + public void changeChannel(Galaxy var1, String var2, String var3) { + Debug.dAssert(false); + } + + public Object properties(int var1, int var2, int var3, Object var4) throws NoSuchPropertyException { + Object var5 = null; + switch(var1 - var2) { + default: + var5 = super.properties(var1, var2 + 0, var3, var4); + return var5; + } + } + + public void saveState(Saver var1) throws IOException { + if (this.console != null) { + System.out.println("Warning: saving drone " + this.getName() + " WITH soul, which won't restore correctly!"); + } + + var1.saveVersion(0, classCookieInterpolatedDrone); + var1.saveVersion(0, classCookie); + super.saveState(var1); + } + + public void restoreStateDrone(Restorer var1) throws IOException, TooNewException { + var1.restoreVersion(classCookieInterpolatedDrone); + switch(var1.restoreVersion(classCookie)) { + case 0: + super.restoreState(var1); + Enumeration var2 = this.getContents(); + + while(var2.hasMoreElements()) { + WObject var3 = (WObject)var2.nextElement(); + if (var3 instanceof Hologram) { + Hologram var4 = (Hologram)var3; + if (var4.getMovieName() == null) { + this.tag = var4; + } + } + } + + return; + default: + throw new TooNewException(); + } + } + + public void restoreState(Restorer var1) throws IOException, TooNewException { + this.restoreStateDrone(var1); + } + + // $FF: synthetic method + static String access$000(Drone var0) { + return var0.sleepMode; + } + + // $FF: synthetic method + static Shape access$100(Drone var0) { + return var0.sleepBox; + } + + // $FF: synthetic method + static Shape access$102(Drone var0, Shape var1) { + return var0.sleepBox = var1; + } + + // $FF: synthetic method + static void access$200() { + flushUnusedDrones(); + } + + // $FF: synthetic method + static float access$300(Drone var0) { + return var0.tagHeight; + } + + static { + Main.register(new Drone$Flusher()); + showNametags = IniFile.gamma().getIniInt("SHOWNAMETAGS", 1) == 1; + employeeAccounts = ServerTableManager.instance().getTable("employeeAccounts"); + employeeHash = null; + usableDrones = new Vector(); + classCookie = new Object(); + classCookieInterpolatedDrone = new Object(); + } +} + +class Drone$MakeSleepBox implements MainCallback { + + private final Drone this$0; - } - } - public WorldServer getServer() { - return this._server; - } - - public String getLongID() { - String var1 = this.getName(); - if (var1.startsWith("!")) { - var1 = var1.substring(1); - } - - return var1; - } - - public void register() { - Debug.dAssert(false); - } - - public void galaxyDisconnected() { - Debug.dAssert(false); - } - - public void reacquireServer(WorldServer var1) { - Debug.dAssert(false); - } - - public void changeChannel(Galaxy var1, String var2, String var3) { - Debug.dAssert(false); - } - - public Object properties(int var1, int var2, int var3, Object var4) throws NoSuchPropertyException { - Object var5 = null; - switch(var1 - var2) { - default: - var5 = super.properties(var1, var2 + 0, var3, var4); - return var5; - } - } - - public void saveState(Saver var1) throws IOException { - if (this.console != null) { - System.out.println("Warning: saving drone " + this.getName() + " WITH soul, which won't restore correctly!"); - } - - var1.saveVersion(0, classCookieInterpolatedDrone); - var1.saveVersion(0, classCookie); - super.saveState(var1); - } - - public void restoreStateDrone(Restorer var1) throws IOException, TooNewException { - var1.restoreVersion(classCookieInterpolatedDrone); - switch(var1.restoreVersion(classCookie)) { - case 0: - super.restoreState(var1); - Enumeration var2 = this.getContents(); - - while(var2.hasMoreElements()) { - WObject var3 = (WObject)var2.nextElement(); - if (var3 instanceof Hologram) { - Hologram var4 = (Hologram)var3; - if (var4.getMovieName() == null) { - this.tag = var4; - } - } - } - - return; - default: - throw new TooNewException(); - } - } - - public void restoreState(Restorer var1) throws IOException, TooNewException { - this.restoreStateDrone(var1); - } - - static { - Main.register(new Drone.Flusher()); - showNametags = IniFile.gamma().getIniInt("SHOWNAMETAGS", 1) == 1; - employeeAccounts = ServerTableManager.instance().getTable("employeeAccounts"); - employeeHash = null; - usableDrones = new Vector(); - classCookie = new Object(); - classCookieInterpolatedDrone = new Object(); - } - - class BounceNametag implements MainCallback { - int start; - WObject origTag; - WObject origTagbg; + Drone$MakeSleepBox(Drone var1) { + this.this$0 = var1; + } + + public void mainCallback() { + if(Drone.access$000(this.this$0) != null && Drone.access$000(this.this$0).equals(Console.message("asleep")) && (!(this.this$0 instanceof MutedDrone))) { + if(Drone.access$100(this.this$0) == null) { + Drone.access$102(this.this$0, new Shape()); + Drone.access$100(this.this$0).setURL(URL.make("home:idle.rwg")); + Drone.access$100(this.this$0).setBumpable(false); + Drone.access$100(this.this$0).scale(100.0F); + Drone.access$100(this.this$0).spin(0.0F, 1.0F, 1.0F, 180.0F); + Drone.access$100(this.this$0).raise(189.0F); + this.this$0.add(Drone.access$100(this.this$0)); + } + } else if(Drone.access$100(this.this$0) != null) { + Drone.access$100(this.this$0).detach(); + Drone.access$102(this.this$0, (Shape)null); + } - BounceNametag() { - if (Drone.this.tag != null) { + Main.unregister(this); + } +} + +class Drone$Flusher implements MainCallback { + + int lastTime; + + + public void mainCallback() { + int var1 = Std.getFastTime(); + if(var1 > this.lastTime + 1000) { + Drone.access$200(); + this.lastTime = var1; + } + + } +} + +class Drone$BounceNametag implements MainCallback { + + int start; + WObject origTag; + WObject origTagbg; + private final Drone this$0; + + + Drone$BounceNametag(Drone var1) { + this.this$0 = var1; + if(var1.tag != null) { this.start = Std.getFastTime(); - this.origTag = Drone.this.tag; - this.origTagbg = Drone.this.tagbg; + this.origTag = var1.tag; + this.origTagbg = var1.tagbg; Main.register(this); - } + } - } + } - public void mainCallback() { - int var1 = Std.getFastTime(); - float var2 = Drone.this.tagHeight; - if (var1 <= this.start + 6000 && this.origTag == Drone.this.tag && this.origTagbg == Drone.this.tagbg) { - if (var1 < this.start + 1500) { - var2 = Drone.this.tagHeight + 200.0F * ((float)(var1 - this.start) / 1500.0F); + public void mainCallback() { + int var1 = Std.getFastTime(); + float var2 = Drone.access$300(this.this$0); + if(var1 <= this.start + 6000 && this.origTag == this.this$0.tag && this.origTagbg == this.this$0.tagbg) { + if(var1 < this.start + 1500) { + var2 = Drone.access$300(this.this$0) + 200.0F * ((float)(var1 - this.start) / 1500.0F); } else { - float var3 = (float)(var1 - this.start) / 1500.0F; - var2 = (float)(200.0D * Math.pow(1.4140000343322754D, (double)var3) * Math.cos((double)(var3 * 3.14159F))); + float var3 = (float)(var1 - this.start) / 1500.0F; + var2 = (float)(200.0D * Math.pow(1.4140000343322754D, (double)var3) * Math.cos((double)(var3 * 3.14159F))); } - } else { + } else { Main.unregister(this); - } + } - this.origTag.setZ(var2); - if (this.origTagbg != null) { + this.origTag.setZ(var2); + if(this.origTagbg != null) { this.origTagbg.setZ(var2); - } - - } - } - - static class Flusher implements MainCallback { - int lastTime; + } - public void mainCallback() { - int var1 = Std.getFastTime(); - if (var1 > this.lastTime + 1000) { - Drone.flushUnusedDrones(); - this.lastTime = var1; - } - - } - } - - class MakeSleepBox implements MainCallback { - public void mainCallback() { - if (Drone.this.sleepMode != null && Drone.this.sleepMode.equals(Console.message("asleep")) && !(Drone.this instanceof MutedDrone)) { - if (Drone.this.sleepBox == null) { - Drone.this.sleepBox = new Shape(); - Drone.this.sleepBox.setURL(URL.make("home:idle.rwg")); - Drone.this.sleepBox.setBumpable(false); - Drone.this.sleepBox.scale(100.0F); - Drone.this.sleepBox.spin(0.0F, 1.0F, 1.0F, 180.0F); - Drone.this.sleepBox.raise(189.0F); - Drone.this.add(Drone.this.sleepBox); - } - } else if (Drone.this.sleepBox != null) { - Drone.this.sleepBox.detach(); - Drone.this.sleepBox = null; - } - - Main.unregister(this); - } - } -} + } +} diff -ruN a/1904/NET/worlds/scape/HandsOffDriver.java b/1904/NET/worlds/scape/HandsOffDriver.java --- a/1904/NET/worlds/scape/HandsOffDriver.java 2020-08-06 15:46:18.000000000 -0500 +++ b/1904/NET/worlds/scape/HandsOffDriver.java 2023-12-15 20:54:45.000000000 -0600 @@ -139,13 +139,14 @@ } public boolean handle(KeyDownEvent var1) { - if (var1.key == '\ue326') { + System.out.println(var1.key); + if (var1.key == '\ua026') { this.cameraZooming = -1; - } else if (var1.key == '\ue328') { + } else if (var1.key == '\ua028') { this.cameraZooming = 1; - } else if (var1.key == '\ue325') { + } else if (var1.key == '\ua025') { this.cameraPanning = -1; - } else if (var1.key == '\ue327') { + } else if (var1.key == '\ua027') { this.cameraPanning = 1; } @@ -153,9 +154,9 @@ } public boolean handle(KeyUpEvent var1) { - if (var1.key != '\ue326' && var1.key != '\ue328') { - if (var1.key != '\ue325' && var1.key != '\ue327') { - if (var1.key == '\ue31b') { + if (var1.key != '\ua026' && var1.key != '\ua028') { + if (var1.key != '\ua025' && var1.key != '\ua027') { + if (var1.key == '\ua01b') { this.notifyCallbacks(0); } } else { diff -ruN a/1904/NET/worlds/scape/HoloPilot.java b/1904/NET/worlds/scape/HoloPilot.java --- a/1904/NET/worlds/scape/HoloPilot.java 2020-08-06 15:46:14.000000000 -0500 +++ b/1904/NET/worlds/scape/HoloPilot.java 2023-12-15 21:20:57.000000000 -0600 @@ -6,567 +6,568 @@ import NET.worlds.network.ObjID; import NET.worlds.network.URL; import NET.worlds.network.WorldServer; + import java.io.IOException; import java.util.Enumeration; import java.util.Vector; public class HoloPilot extends Pilot implements AnimatedActionHandler, AnimatedActionCallback { - private Camera cam; - private SmoothDriver smoothDriver; - private boolean cameraIsFree = false; - private AnimatedActionHandlerImp handler; - private HandsOffDriver hod; - String lastName; - Transform lastInverse; - Point3 lastCamWorldPos; - float lastCamRadius; - float lastCamYaw; - int lastDrawTime; - int framesSinceMoved = 0; - Room lastCamRoom; - Transform defaultTransform = Transform.make(); - Point3 aimPoint = new Point3(0.0F, 0.0F, 0.0F); - float defaultCameraYaw = 0.0F; - float defaultCameraRadius = 0.0F; - public static final int CAM_MODE_VEHICLE = 99; - public static final int CAM_MODE_FIRST_PERSON = 1; - public static final int CAM_MODE_LOW_FIRST_PERSON = 2; - public static final int CAM_MODE_WAIST = 3; - public static final int CAM_MODE_SHOULDER = 4; - public static final int CAM_MODE_HEAD = 5; - public static final int CAM_MODE_OVERHEAD = 6; - public static final int CAM_MODE_BEHIND = 7; - public static final int CAM_MODE_WIDESHOT = 8; - public static final int CAM_MODE_ORTHOGRAPHIC = 9; - public static final int CAM_SPEED_SLOW = 1; - public static final int CAM_SPEED_MEDIUM = 2; - public static final int CAM_SPEED_FAST = 3; - public static final int CAM_SPEED_LOCKED = 4; - private boolean substWarned = false; - protected Point3 boxLo = new Point3(); - protected Point3 boxHi = new Point3(); - protected float stepHeight = 30.0F; - private static Object classCookie = new Object(); - - public HoloPilot(URL var1) { - this.setSourceURL(var1); - this.loadInit(); - } - - public void setSleepMode(String var1) { - Drone var2 = this.getInternalDrone(); - if (var2 != null) { - var2.setSleepMode(var1); - } - - } - - public float animate(String var1) { - super.animate(var1); - Drone var2 = this.getInternalDrone(); - return var2 != null ? var2.animate(var1) : 0.0F; - } - - public Vector getAnimationList() { - Vector var1 = super.getAnimationList(); - Drone var2 = this.getInternalDrone(); - if (var2 == null) { - return var1; - } else { - Vector var3 = (Vector)var2.getAnimationList().clone(); - - for(int var4 = 0; var4 < var1.size(); ++var4) { - var3.addElement(var1.elementAt(var4)); - } - - return var3; - } - } - - public HoloPilot() { - } - - public void loadInit() { - this.smoothDriver = new SmoothDriver(); - this.smoothDriver.setEyeHeight(0.0F); - this.cam = new Camera(); - this.add(this.cam); - Drone var1 = Drone.make((ObjID)null, (WorldServer)null); - this.add(var1); - var1.setAvatarNow(this.getSourceURL()); - this.addHandler(this.smoothDriver); - this.addHandler(new PitchDriver()); - this.handler = new AnimatedActionHandlerImp(); - this.setEyeHeight(150.0F); - } - - public void addCallback(AnimatedActionCallback var1) { - Debug.dAssert(this.handler != null); - this.handler.addCallback(var1); - } - - public void removeCallback(AnimatedActionCallback var1) { - Debug.dAssert(this.handler != null); - this.handler.removeCallback(var1); - } - - public void notifyCallbacks(int var1) { - Debug.dAssert(this.handler != null); - this.handler.notifyCallbacks(var1); - } - - public void walkTo(Point2 var1, float var2) { - this.walkTo(var1, var2, 80.0F); - } - - public void walkTo(Point2 var1, float var2, float var3) { - this.removeHandler(this.smoothDriver); - this.hod = new HandsOffDriver(); - this.hod.setDestPos(var1, var2, var3); - this.hod.addCallback(this); - this.addHandler(this.hod); - } - - public void removeSmoothDriver() { - this.removeHandler(this.smoothDriver); - } - - public void returnSmoothDriver() { - this.addHandler(this.smoothDriver); - } - - public SmoothDriver getSmoothDriver() { - return this.smoothDriver; - } - - public void removeHandsOffDriver() { - if (this.hod != null) { - this.removeHandler(this.hod); - this.hod = null; - } - - } - - public void returnHandsOffDriver() { - if (this.hod == null) { - this.hod = new HandsOffDriver(); - this.addHandler(this.hod); - } - - } - - public void motionComplete(int var1) { - this.removeHandler(this.hod); - this.hod = null; - this.addHandler(this.smoothDriver); - this.notifyCallbacks(var1); - } - - public void updateName() { - String var1 = this.getLongID(); - if (var1 != null) { - if (this.lastName == null || !this.lastName.equals(var1)) { - this.lastName = var1; - Drone var2 = this.getInternalDrone(); - if (var2 != null) { - var2.setName(var1); + private Camera cam; + private SmoothDriver smoothDriver; + private boolean cameraIsFree = false; + private AnimatedActionHandlerImp handler; + private HandsOffDriver hod; + String lastName; + Transform lastInverse; + Point3 lastCamWorldPos; + float lastCamRadius; + float lastCamYaw; + int lastDrawTime; + int framesSinceMoved = 0; + Room lastCamRoom; + Transform defaultTransform = Transform.make(); + Point3 aimPoint = new Point3(0.0F, 0.0F, 0.0F); + float defaultCameraYaw = 0.0F; + float defaultCameraRadius = 0.0F; + public static final int CAM_MODE_VEHICLE = 99; + public static final int CAM_MODE_FIRST_PERSON = 1; + public static final int CAM_MODE_LOW_FIRST_PERSON = 2; + public static final int CAM_MODE_WAIST = 3; + public static final int CAM_MODE_SHOULDER = 4; + public static final int CAM_MODE_HEAD = 5; + public static final int CAM_MODE_OVERHEAD = 6; + public static final int CAM_MODE_BEHIND = 7; + public static final int CAM_MODE_WIDESHOT = 8; + public static final int CAM_MODE_ORTHOGRAPHIC = 9; + public static final int CAM_SPEED_SLOW = 1; + public static final int CAM_SPEED_MEDIUM = 2; + public static final int CAM_SPEED_FAST = 3; + public static final int CAM_SPEED_LOCKED = 4; + private boolean substWarned = false; + protected Point3 boxLo = new Point3(); + protected Point3 boxHi = new Point3(); + protected float stepHeight = 30.0F; + private static Object classCookie = new Object(); + + public HoloPilot(URL var1) { + this.setSourceURL(var1); + this.loadInit(); + } + + public void setSleepMode(String var1) { + Drone var2 = this.getInternalDrone(); + if (var2 != null) { + var2.setSleepMode(var1); + } + + } + + public float animate(String var1) { + super.animate(var1); + Drone var2 = this.getInternalDrone(); + return var2 != null ? var2.animate(var1) : 0.0F; + } + + public Vector getAnimationList() { + Vector var1 = super.getAnimationList(); + Drone var2 = this.getInternalDrone(); + if (var2 == null) { + return var1; + } else { + Vector var3 = (Vector)var2.getAnimationList().clone(); + + for(int var4 = 0; var4 < var1.size(); ++var4) { + var3.addElement(var1.elementAt(var4)); } - } - } - } - - public Drone getInternalDrone() { - Enumeration var1 = this.getContents(); - - Object var2; - do { - if (!var1.hasMoreElements()) { - return null; - } - - var2 = var1.nextElement(); - } while(!(var2 instanceof Drone)); - - return (Drone)var2; - } - - private void setLastInverse(Transform var1) { - if (this.lastInverse != null) { - this.lastInverse.recycle(); - } - - this.lastInverse = var1; - } - - protected void transferFrom(Pilot var1) { - if (var1 != null && var1 instanceof HoloPilot) { - HoloPilot var2 = (HoloPilot)var1; - this.setOutsideCameraMode(var2.getOutsideCameraMode(), var2.getOutsideCameraSpeed()); - super.transferFrom(var1); - if (var2.lastCamWorldPos != null) { - this.setLastInverse(var2.lastInverse.getTransform()); - this.lastCamWorldPos = new Point3(var2.lastCamWorldPos); - } - - this.lastCamRoom = var2.lastCamRoom; - this.lastCamRadius = var2.lastCamRadius; - this.lastCamYaw = var2.lastCamYaw; - this.lastDrawTime = var2.lastDrawTime; - this.framesSinceMoved = this.framesSinceMoved; - } else { - super.transferFrom(var1); - } - } - - public void aboutToDraw() { - if (this.cameraMode != 1 && this.cameraMode != 2) { - if (!this.cameraIsFree) { - Transform var1 = this.getObjectToWorldMatrix(); - int var2 = Std.getRealTime(); - Room var5 = this.getRoom(); - Transform var6 = var1.getTransform().invert(); - float var3; - float var4; - float var8; - if (this.lastCamWorldPos != null && this.cameraSpeed != 4 && this.cameraMode != 99) { - if (var5 != this.lastCamRoom) { - var4 = this.lastCamYaw; - var3 = this.lastCamRadius; - } else { - Point3 var7 = this.lastCamWorldPos; - var7.times(var6); - var3 = (float)Math.sqrt((double)(var7.x * var7.x + var7.y * var7.y)); - if (var3 > this.defaultCameraRadius + 10.0F) { - var3 = this.defaultCameraRadius + 10.0F; - } - - if (this.cameraSpeed == 3) { - var3 = this.defaultCameraRadius; - } - - var4 = (float)(Math.atan2((double)var7.y, (double)var7.x) * 180.0D / 3.141592653589793D); - this.lastInverse.post(var1); - var8 = this.lastInverse.getYaw(); - if (var8 > 180.0F) { - var8 -= 360.0F; - } - - Point3Temp var9 = this.lastInverse.getPosition(); - if (this.cameraSpeed == 1 && (Math.abs(var8) >= 1.0F || var9.x * var9.x + var9.y * var9.y >= 1.0F)) { - this.framesSinceMoved = 0; - } else if (++this.framesSinceMoved > 2) { - float var10 = this.defaultCameraYaw - var4; - if (var10 < -180.0F) { - var10 += 360.0F; - } else if (var10 > 180.0F) { - var10 -= 360.0F; - } - - float var11 = this.defaultCameraRadius - var3; - float var12 = (float)(var2 - this.lastDrawTime); - float var13 = 0.04F; - float var14 = 0.03F; - if (Math.abs(var10) > 1500.0F * var13) { - var13 *= 1.5F; - } - - var13 *= var12; - if (var10 < -var13) { - var10 = -var13; - } else if (var10 > var13) { - var10 = var13; - } - - var14 *= var12; - if (var11 < -var14) { - var11 = -var14; - } else if (var11 > var14) { - var11 = var14; - } - - var4 += var10; - var3 += var11; - if (this.cameraSpeed == 3) { - if (var4 > this.defaultCameraYaw + 40.0F) { - var4 = this.defaultCameraYaw + 40.0F; - } else if (var4 < this.defaultCameraYaw - 40.0F) { - var4 = this.defaultCameraYaw - 40.0F; - } - } - } - } - } else { - this.lastCamWorldPos = new Point3(); - var3 = this.defaultCameraRadius; - var4 = this.defaultCameraYaw; + return var3; + } + } + + public HoloPilot() { + } + + public void loadInit() { + this.smoothDriver = new SmoothDriver(); + this.smoothDriver.setEyeHeight(0.0F); + this.cam = new Camera(); + this.add(this.cam); + Drone var1 = Drone.make((ObjID)null, (WorldServer)null); + this.add(var1); + var1.setAvatarNow(this.getSourceURL()); + this.addHandler(this.smoothDriver); + this.addHandler(new PitchDriver()); + this.handler = new AnimatedActionHandlerImp(); + this.setEyeHeight(150.0F); + } + + public void addCallback(AnimatedActionCallback var1) { + Debug.dAssert(this.handler != null); + this.handler.addCallback(var1); + } + + public void removeCallback(AnimatedActionCallback var1) { + Debug.dAssert(this.handler != null); + this.handler.removeCallback(var1); + } + + public void notifyCallbacks(int var1) { + Debug.dAssert(this.handler != null); + this.handler.notifyCallbacks(var1); + } + + public void walkTo(Point2 var1, float var2) { + this.walkTo(var1, var2, 80.0F); + } + + public void walkTo(Point2 var1, float var2, float var3) { + this.removeHandler(this.smoothDriver); + this.hod = new HandsOffDriver(); + this.hod.setDestPos(var1, var2, var3); + this.hod.addCallback(this); + this.addHandler(this.hod); + } + + public void removeSmoothDriver() { + this.removeHandler(this.smoothDriver); + } + + public void returnSmoothDriver() { + this.addHandler(this.smoothDriver); + } + + public SmoothDriver getSmoothDriver() { + return this.smoothDriver; + } + + public void removeHandsOffDriver() { + if (this.hod != null) { + this.removeHandler(this.hod); + this.hod = null; + } + + } + + public void returnHandsOffDriver() { + if (this.hod == null) { + this.hod = new HandsOffDriver(); + this.addHandler(this.hod); + } + + } + + public void motionComplete(int var1) { + this.removeHandler(this.hod); + this.hod = null; + this.addHandler(this.smoothDriver); + this.notifyCallbacks(var1); + } + + public void updateName() { + String var1 = this.getLongID(); + if (var1 != null) { + if (this.lastName == null || !this.lastName.equals(var1)) { + this.lastName = var1; + Drone var2 = this.getInternalDrone(); + if (var2 != null) { + var2.setName(var1); + } + } + } + } + + public Drone getInternalDrone() { + Enumeration var1 = this.getContents(); - this.setLastInverse(var6); - float var15 = this.aimPoint.z; - var8 = var4; - float var16 = var3; - if (this.hod != null) { - var8 = var4 + this.hod.getCameraPan(); - var16 = var3 + this.hod.getCameraZoom(); - if (var16 < this.defaultCameraRadius) { - var15 -= (this.defaultCameraRadius - var16) * this.smoothDriver.getEyeHeight() / this.defaultCameraRadius; - } + Object var2; + do { + if (!var1.hasMoreElements()) { + return null; } - this.cam.makeIdentity().post(this.defaultTransform); - this.cam.moveBy(var16, 0.0F, 0.0F); - this.cam.postspin(0.0F, 0.0F, 1.0F, var8); - this.cam.moveBy(this.aimPoint.x, this.aimPoint.y, var15); - this.lastCamRadius = var3; - this.lastCamYaw = var4; - double var17 = (double)var4 * 3.141592653589793D / 180.0D; - this.lastCamWorldPos.x = (float)((double)var3 * Math.cos(var17)); - this.lastCamWorldPos.y = (float)((double)var3 * Math.sin(var17)); - this.lastCamWorldPos.z = 0.0F; - this.lastCamWorldPos.times(var1); - this.lastCamWorldPos.z = 0.0F; - this.lastDrawTime = var2; - this.lastCamRoom = var5; - var1.recycle(); - } - } else { - this.lastCamWorldPos = null; - this.cam.makeIdentity(); - } - } - - public void setOutsideCameraMode(int var1, int var2) { - this.defaultTransform.makeIdentity(); - this.aimPoint.x = 0.0F; - this.aimPoint.y = 0.0F; - this.aimPoint.z = 0.0F; - this.setEyeHeight(150.0F); - if (this.getInternalDrone() != null && this.getInternalDrone() instanceof PosableDrone) { - PosableShape var3 = ((PosableDrone)this.getInternalDrone()).getInternalPosableShape(); - if (var3 != null && var3 instanceof VehicleShape) { - VehicleShape var4 = (VehicleShape)var3; - if (var4.fixedCamera) { - this.defaultTransform.moveTo(var4.camX, var4.camY, var4.camZ).postspin(1.0F, 0.0F, 0.0F, var4.camRoll).postspin(0.0F, 1.0F, 0.0F, var4.camYaw).postspin(0.0F, 0.0F, 1.0F, var4.camPitch); - this.aimPoint.x = var4.camAimX; - this.aimPoint.y = var4.camAimY; - this.aimPoint.z = var4.camAimZ; - this.setEyeHeight(var4.eyeHeight); - var1 = 99; + var2 = var1.nextElement(); + } while(!(var2 instanceof Drone)); + + return (Drone)var2; + } + + private void setLastInverse(Transform var1) { + if (this.lastInverse != null) { + this.lastInverse.recycle(); + } + + this.lastInverse = var1; + } + + protected void transferFrom(Pilot var1) { + if (var1 != null && var1 instanceof HoloPilot) { + HoloPilot var2 = (HoloPilot)var1; + this.setOutsideCameraMode(var2.getOutsideCameraMode(), var2.getOutsideCameraSpeed()); + super.transferFrom(var1); + if (var2.lastCamWorldPos != null) { + this.setLastInverse(var2.lastInverse.getTransform()); + this.lastCamWorldPos = new Point3(var2.lastCamWorldPos); } - } - } - this.cam.setAlwaysClearBackground(false); - this.cam.setBumpable(true); - switch(var1) { - case 1: - case 99: - break; - case 2: - this.setEyeHeight(100.0F); - break; - case 3: - this.defaultTransform.moveTo(0.0F, -120.0F, -60.0F).postspin(1.0F, 0.0F, 0.0F, -10.0F).postspin(0.0F, 0.0F, 1.0F, 30.0F); - this.aimPoint.x = 15.0F; - this.aimPoint.z = -10.0F; - break; - case 4: - this.defaultTransform.moveTo(0.0F, -140.0F, -40.0F).postspin(1.0F, 0.0F, 0.0F, -10.0F).postspin(0.0F, 0.0F, 1.0F, 15.0F); - this.aimPoint.x = 15.0F; - this.aimPoint.z = 10.0F; - break; - case 5: - this.defaultTransform.moveTo(0.0F, -140.0F, 0.0F).postspin(1.0F, 0.0F, 0.0F, -10.0F).postspin(0.0F, 0.0F, 1.0F, 15.0F); - this.aimPoint.x = 15.0F; - this.aimPoint.z = 10.0F; - break; - case 6: - this.defaultTransform.moveTo(0.0F, -100.0F, 0.0F).postspin(1.0F, 0.0F, 0.0F, -30.0F).postspin(0.0F, 0.0F, 1.0F, 30.0F); - this.aimPoint.x = 15.0F; - this.aimPoint.z = 10.0F; - break; - case 7: - this.defaultTransform.moveTo(0.0F, -140.0F, 0.0F).postspin(1.0F, 0.0F, 0.0F, -10.0F); - break; - case 8: - this.defaultTransform.moveTo(0.0F, -220.0F, -40.0F).postspin(1.0F, 0.0F, 0.0F, -30.0F).postspin(0.0F, 0.0F, 1.0F, 30.0F); - this.aimPoint.x = 15.0F; - this.aimPoint.z = 10.0F; - break; - case 9: - this.defaultTransform.moveTo(0.0F, -140.0F, 300.0F).postspin(1.0F, 0.0F, 0.0F, -10.0F); - this.aimPoint.x = 0.0F; - this.aimPoint.z = 300.0F; - this.cam.setAlwaysClearBackground(true); - this.cam.setBumpable(false); - var2 = 4; - break; - default: - var1 = 1; - var2 = 3; - this.defaultCameraRadius = 0.0F; - this.defaultCameraYaw = 0.0F; - } - - if (var1 != 1 && var1 != 2) { - float var5 = this.defaultTransform.getX(); - float var6 = this.defaultTransform.getY(); - Point3 var10000 = this.aimPoint; - var10000.z += this.defaultTransform.getZ(); - this.defaultCameraRadius = (float)Math.sqrt((double)(var5 * var5 + var6 * var6)); - this.defaultCameraYaw = (float)(Math.atan2((double)var6, (double)var5) * 180.0D / 3.141592653589793D); - this.defaultTransform.moveTo(0.0F, 0.0F, 0.0F); - this.defaultTransform.postspin(0.0F, 0.0F, 1.0F, -this.defaultCameraYaw); - } - - super.setOutsideCameraMode(var1, var2); - } - - public void resetAvatarNow() { - URL var1 = this.getSourceURL(); - Drone var2 = this.getInternalDrone(); - var2.setAvatarNow(var1); - if (var2.shouldBeForcedHuman() && !PosableShape.getHuman(var1).equals(var1)) { - if (!this.substWarned) { - this.substWarned = true; - Console.println(Console.message("Sub-human")); - } - } else { - this.substWarned = false; - } - - } - - public void setEyeHeight(float var1) { - float var2 = this.smoothDriver.getEyeHeight(); - if (var1 != var2) { - this.smoothDriver.setEyeHeight(var1); - this.getInternalDrone().moveBy(0.0F, 0.0F, var2 - var1); - this.setLocalBoundBox(Point3Temp.make(-30.0F, -30.0F, -var1), Point3Temp.make(30.0F, 50.0F, 20.0F)); - } - - } - - public BoundBoxTemp getLocalBoundBox() { - return BoundBoxTemp.make(this.boxLo, this.boxHi); - } - - public void setLocalBoundBox(BoundBoxTemp var1) { - this.boxLo = new Point3(var1.lo); - this.boxHi = new Point3(var1.hi); - } - - public void setLocalBoundBox(Point3Temp var1, Point3Temp var2) { - this.setLocalBoundBox(BoundBoxTemp.make(var1, var2)); - } - - public BoundBoxTemp getBoundBox() { - Point3Temp var1 = Point3Temp.make(this.boxLo); - var1.z += this.stepHeight; - Point3 var2 = this.boxHi; - Transform var3 = this.getObjectToWorldMatrix(); - Point3Temp var4 = Point3Temp.make(var1).times(var3); - BoundBoxTemp var5 = BoundBoxTemp.make(var4, var4); - var5.encompass(Point3Temp.make(var2).times(var3)); - var5.encompass(Point3Temp.make(var1.x, var1.y, var2.z).times(var3)); - var5.encompass(Point3Temp.make(var1.x, var2.y, var1.z).times(var3)); - var5.encompass(Point3Temp.make(var1.x, var2.y, var2.z).times(var3)); - var5.encompass(Point3Temp.make(var2.x, var1.y, var1.z).times(var3)); - var5.encompass(Point3Temp.make(var2.x, var1.y, var2.z).times(var3)); - var5.encompass(Point3Temp.make(var2.x, var2.y, var1.z).times(var3)); - var3.recycle(); - return var5; - } - - public float getFootHeight() { - if (this.isActive()) { - Transform var1 = this.getObjectToWorldMatrix(); - float var2 = var1.getPitch(); - var1.pitch(-var2); - float var3 = Point3Temp.make(this.boxLo).times(var1).z; - var1.recycle(); - return var3; - } else { - return 0.0F; - } - } - - public float getStepHeight() { - return this.stepHeight; - } - - public void setStepHeight(float var1) { - this.stepHeight = var1; - } - - public void releaseCamera() { - this.cameraIsFree = true; - } - - public void reclaimCamera() { - this.cameraIsFree = false; - } - - public Camera getCamera() { - return this.cam; - } - - public Object properties(int var1, int var2, int var3, Object var4) throws NoSuchPropertyException { - Object var5 = null; - switch(var1 - var2) { - case 0: - if (var3 == 0) { - var5 = Point3PropertyEditor.make(new Property(this, var1, "Bump Box Start")); - } else if (var3 == 1) { - var5 = new Point3(this.boxLo); - } else if (var3 == 2) { - this.boxLo = new Point3((Point3)var4); - } - break; - case 1: - if (var3 == 0) { - var5 = Point3PropertyEditor.make(new Property(this, var1, "Bump Box End")); - } else if (var3 == 1) { - var5 = new Point3(this.boxHi); - } else if (var3 == 2) { - this.boxHi = new Point3((Point3)var4); - } - break; - case 2: - if (var3 == 0) { - var5 = FloatPropertyEditor.make(new Property(this, var1, "Step Height")); - } else if (var3 == 1) { - var5 = new Float(this.getStepHeight()); - } else if (var3 == 2) { - this.setStepHeight((Float)var4); - } - break; - default: - var5 = super.properties(var1, var2 + 3, var3, var4); - } - - return var5; - } - - public void saveState(Saver var1) throws IOException { - var1.saveVersion(0, classCookie); - super.saveState(var1); - var1.saveFloat(this.stepHeight); - var1.save(this.boxLo); - var1.save(this.boxHi); - } - - public void restoreState(Restorer var1) throws IOException, TooNewException { - switch(var1.restoreVersion(classCookie)) { - case 0: - super.restoreState(var1); - this.stepHeight = var1.restoreFloat(); - this.boxLo = (Point3)var1.restore(); - this.boxHi = (Point3)var1.restore(); - return; - default: - throw new TooNewException(); - } - } + this.lastCamRoom = var2.lastCamRoom; + this.lastCamRadius = var2.lastCamRadius; + this.lastCamYaw = var2.lastCamYaw; + this.lastDrawTime = var2.lastDrawTime; + this.framesSinceMoved = this.framesSinceMoved; + } else { + super.transferFrom(var1); + } + } + + public void aboutToDraw() { + if (this.cameraMode != 1 && this.cameraMode != 2) { + if (!this.cameraIsFree) { + Transform var1 = this.getObjectToWorldMatrix(); + int var2 = Std.getRealTime(); + Room var5 = this.getRoom(); + Transform var6 = var1.getTransform().invert(); + float var3; + float var4; + float var8; + if (this.lastCamWorldPos != null && this.cameraSpeed != 4 && this.cameraMode != 99) { + if (var5 != this.lastCamRoom) { + var4 = this.lastCamYaw; + var3 = this.lastCamRadius; + } else { + Point3 var7 = this.lastCamWorldPos; + var7.times(var6); + var3 = (float)Math.sqrt((double)(var7.x * var7.x + var7.y * var7.y)); + if (var3 > this.defaultCameraRadius + 10.0F) { + var3 = this.defaultCameraRadius + 10.0F; + } + + if (this.cameraSpeed == 3) { + var3 = this.defaultCameraRadius; + } + + var4 = (float)(Math.atan2((double)var7.y, (double)var7.x) * 180.0D / 3.141592653589793D); + this.lastInverse.post(var1); + var8 = this.lastInverse.getYaw(); + if (var8 > 180.0F) { + var8 -= 360.0F; + } + + Point3Temp var9 = this.lastInverse.getPosition(); + if (this.cameraSpeed == 1 && (!(Math.abs(var8) < 1.0F) || !(var9.x * var9.x + var9.y * var9.y < 1.0F))) { + this.framesSinceMoved = 0; + } else if (++this.framesSinceMoved > 2) { + float var10 = this.defaultCameraYaw - var4; + if (var10 < -180.0F) { + var10 += 360.0F; + } else if (var10 > 180.0F) { + var10 -= 360.0F; + } + + float var11 = this.defaultCameraRadius - var3; + float var12 = (float)(var2 - this.lastDrawTime); + float var13 = 0.04F; + float var14 = 0.03F; + if (Math.abs(var10) > 1500.0F * var13) { + var13 *= 1.5F; + } + + var13 *= var12; + if (var10 < -var13) { + var10 = -var13; + } else if (var10 > var13) { + var10 = var13; + } + + var14 *= var12; + if (var11 < -var14) { + var11 = -var14; + } else if (var11 > var14) { + var11 = var14; + } + + var4 += var10; + var3 += var11; + if (this.cameraSpeed == 3) { + if (var4 > this.defaultCameraYaw + 40.0F) { + var4 = this.defaultCameraYaw + 40.0F; + } else if (var4 < this.defaultCameraYaw - 40.0F) { + var4 = this.defaultCameraYaw - 40.0F; + } + } + } + } + } else { + this.lastCamWorldPos = new Point3(); + var3 = this.defaultCameraRadius; + var4 = this.defaultCameraYaw; + } + + this.setLastInverse(var6); + float var15 = this.aimPoint.z; + var8 = var4; + float var16 = var3; + if (this.hod != null) { + var8 = var4 + this.hod.getCameraPan(); + var16 = var3 + this.hod.getCameraZoom(); + if (var16 < this.defaultCameraRadius) { + var15 -= (this.defaultCameraRadius - var16) * this.smoothDriver.getEyeHeight() / this.defaultCameraRadius; + } + } + + this.cam.makeIdentity().post(this.defaultTransform); + this.cam.moveBy(var16, 0.0F, 0.0F); + this.cam.postspin(0.0F, 0.0F, 1.0F, var8); + this.cam.moveBy(this.aimPoint.x, this.aimPoint.y, var15); + this.lastCamRadius = var3; + this.lastCamYaw = var4; + double var17 = (double)var4 * 3.141592653589793D / 180.0D; + this.lastCamWorldPos.x = (float)((double)var3 * Math.cos(var17)); + this.lastCamWorldPos.y = (float)((double)var3 * Math.sin(var17)); + this.lastCamWorldPos.z = 0.0F; + this.lastCamWorldPos.times(var1); + this.lastCamWorldPos.z = 0.0F; + this.lastDrawTime = var2; + this.lastCamRoom = var5; + var1.recycle(); + } + } else { + this.lastCamWorldPos = null; + this.cam.makeIdentity(); + } + } + + public void setOutsideCameraMode(int var1, int var2) { + this.defaultTransform.makeIdentity(); + this.aimPoint.x = 0.0F; + this.aimPoint.y = 0.0F; + this.aimPoint.z = 0.0F; + this.setEyeHeight(150.0F); + if (this.getInternalDrone() != null && this.getInternalDrone() instanceof PosableDrone) { + PosableShape var3 = ((PosableDrone)this.getInternalDrone()).getInternalPosableShape(); + if (var3 != null && var3 instanceof VehicleShape) { + VehicleShape var4 = (VehicleShape)var3; + if (var4.fixedCamera) { + this.defaultTransform.moveTo(var4.camX, var4.camY, var4.camZ).postspin(1.0F, 0.0F, 0.0F, var4.camRoll).postspin(0.0F, 1.0F, 0.0F, var4.camYaw).postspin(0.0F, 0.0F, 1.0F, var4.camPitch); + this.aimPoint.x = var4.camAimX; + this.aimPoint.y = var4.camAimY; + this.aimPoint.z = var4.camAimZ; + this.setEyeHeight(var4.eyeHeight); + var1 = 99; + } + } + } + + this.cam.setAlwaysClearBackground(false); + this.cam.setBumpable(true); + switch(var1) { + case 1: + case 99: + break; + case 2: + this.setEyeHeight(100.0F); + break; + case 3: + this.defaultTransform.moveTo(0.0F, -120.0F, -60.0F).postspin(1.0F, 0.0F, 0.0F, -10.0F).postspin(0.0F, 0.0F, 1.0F, 30.0F); + this.aimPoint.x = 15.0F; + this.aimPoint.z = -10.0F; + break; + case 4: + this.defaultTransform.moveTo(0.0F, -140.0F, -40.0F).postspin(1.0F, 0.0F, 0.0F, -10.0F).postspin(0.0F, 0.0F, 1.0F, 15.0F); + this.aimPoint.x = 15.0F; + this.aimPoint.z = 10.0F; + break; + case 5: + this.defaultTransform.moveTo(0.0F, -140.0F, 0.0F).postspin(1.0F, 0.0F, 0.0F, -10.0F).postspin(0.0F, 0.0F, 1.0F, 15.0F); + this.aimPoint.x = 15.0F; + this.aimPoint.z = 10.0F; + break; + case 6: + this.defaultTransform.moveTo(0.0F, -100.0F, 0.0F).postspin(1.0F, 0.0F, 0.0F, -30.0F).postspin(0.0F, 0.0F, 1.0F, 30.0F); + this.aimPoint.x = 15.0F; + this.aimPoint.z = 10.0F; + break; + case 7: + this.defaultTransform.moveTo(0.0F, -140.0F, 0.0F).postspin(1.0F, 0.0F, 0.0F, -10.0F); + break; + case 8: + this.defaultTransform.moveTo(0.0F, -220.0F, -40.0F).postspin(1.0F, 0.0F, 0.0F, -30.0F).postspin(0.0F, 0.0F, 1.0F, 30.0F); + this.aimPoint.x = 15.0F; + this.aimPoint.z = 10.0F; + break; + case 9: + this.defaultTransform.moveTo(0.0F, -140.0F, 300.0F).postspin(1.0F, 0.0F, 0.0F, -10.0F); + this.aimPoint.x = 0.0F; + this.aimPoint.z = 300.0F; + this.cam.setAlwaysClearBackground(true); + this.cam.setBumpable(false); + var2 = 4; + break; + default: + var1 = 1; + var2 = 3; + this.defaultCameraRadius = 0.0F; + this.defaultCameraYaw = 0.0F; + } + + if (var1 != 1 && var1 != 2) { + float var5 = this.defaultTransform.getX(); + float var6 = this.defaultTransform.getY(); + Point3 var10000 = this.aimPoint; + var10000.z += this.defaultTransform.getZ(); + this.defaultCameraRadius = (float)Math.sqrt((double)(var5 * var5 + var6 * var6)); + this.defaultCameraYaw = (float)(Math.atan2((double)var6, (double)var5) * 180.0D / 3.141592653589793D); + this.defaultTransform.moveTo(0.0F, 0.0F, 0.0F); + this.defaultTransform.postspin(0.0F, 0.0F, 1.0F, -this.defaultCameraYaw); + } + + super.setOutsideCameraMode(var1, var2); + } + + public void resetAvatarNow() { + URL var1 = this.getSourceURL(); + Drone var2 = this.getInternalDrone(); + var2.setAvatarNow(var1); + if (var2.shouldBeForcedHuman() && !PosableShape.getHuman(var1).equals(var1)) { + if (!this.substWarned) { + this.substWarned = true; + Console.println(Console.message("Sub-human")); + } + } else { + this.substWarned = false; + } + + } + + public void setEyeHeight(float var1) { + float var2 = this.smoothDriver.getEyeHeight(); + if (var1 != var2) { + this.smoothDriver.setEyeHeight(var1); + this.getInternalDrone().moveBy(0.0F, 0.0F, var2 - var1); + this.setLocalBoundBox(Point3Temp.make(-30.0F, -30.0F, -var1), Point3Temp.make(30.0F, 50.0F, 20.0F)); + } + + } + + public BoundBoxTemp getLocalBoundBox() { + return BoundBoxTemp.make(this.boxLo, this.boxHi); + } + + public void setLocalBoundBox(BoundBoxTemp var1) { + this.boxLo = new Point3(var1.lo); + this.boxHi = new Point3(var1.hi); + } + + public void setLocalBoundBox(Point3Temp var1, Point3Temp var2) { + this.setLocalBoundBox(BoundBoxTemp.make(var1, var2)); + } + + public BoundBoxTemp getBoundBox() { + Point3Temp var1 = Point3Temp.make(this.boxLo); + var1.z += this.stepHeight; + Point3 var2 = this.boxHi; + Transform var3 = this.getObjectToWorldMatrix(); + Point3Temp var4 = Point3Temp.make(var1).times(var3); + BoundBoxTemp var5 = BoundBoxTemp.make(var4, var4); + var5.encompass(Point3Temp.make(var2).times(var3)); + var5.encompass(Point3Temp.make(var1.x, var1.y, var2.z).times(var3)); + var5.encompass(Point3Temp.make(var1.x, var2.y, var1.z).times(var3)); + var5.encompass(Point3Temp.make(var1.x, var2.y, var2.z).times(var3)); + var5.encompass(Point3Temp.make(var2.x, var1.y, var1.z).times(var3)); + var5.encompass(Point3Temp.make(var2.x, var1.y, var2.z).times(var3)); + var5.encompass(Point3Temp.make(var2.x, var2.y, var1.z).times(var3)); + var3.recycle(); + return var5; + } + + public float getFootHeight() { + if (this.isActive()) { + Transform var1 = this.getObjectToWorldMatrix(); + float var2 = var1.getPitch(); + var1.pitch(-var2); + float var3 = Point3Temp.make(this.boxLo).times(var1).z; + var1.recycle(); + return var3; + } else { + return 0.0F; + } + } + + public float getStepHeight() { + return this.stepHeight; + } + + public void setStepHeight(float var1) { + this.stepHeight = var1; + } + + public void releaseCamera() { + this.cameraIsFree = true; + } + + public void reclaimCamera() { + this.cameraIsFree = false; + } + + public Camera getCamera() { + return this.cam; + } + + public Object properties(int var1, int var2, int var3, Object var4) throws NoSuchPropertyException { + Object var5 = null; + switch(var1 - var2) { + case 0: + if (var3 == 0) { + var5 = Point3PropertyEditor.make(new Property(this, var1, "Bump Box Start")); + } else if (var3 == 1) { + var5 = new Point3(this.boxLo); + } else if (var3 == 2) { + this.boxLo = new Point3((Point3)var4); + } + break; + case 1: + if (var3 == 0) { + var5 = Point3PropertyEditor.make(new Property(this, var1, "Bump Box End")); + } else if (var3 == 1) { + var5 = new Point3(this.boxHi); + } else if (var3 == 2) { + this.boxHi = new Point3((Point3)var4); + } + break; + case 2: + if (var3 == 0) { + var5 = FloatPropertyEditor.make(new Property(this, var1, "Step Height")); + } else if (var3 == 1) { + var5 = new Float(this.getStepHeight()); + } else if (var3 == 2) { + this.setStepHeight(((Float)var4).floatValue()); + } + break; + default: + var5 = super.properties(var1, var2 + 3, var3, var4); + } + + return var5; + } + + public void saveState(Saver var1) throws IOException { + var1.saveVersion(0, classCookie); + super.saveState(var1); + var1.saveFloat(this.stepHeight); + var1.save(this.boxLo); + var1.save(this.boxHi); + } + + public void restoreState(Restorer var1) throws IOException, TooNewException { + switch(var1.restoreVersion(classCookie)) { + case 0: + super.restoreState(var1); + this.stepHeight = var1.restoreFloat(); + this.boxLo = (Point3)var1.restore(); + this.boxHi = (Point3)var1.restore(); + return; + default: + throw new TooNewException(); + } + } } diff -ruN a/1904/NET/worlds/scape/MutedDrone.java b/1904/NET/worlds/scape/MutedDrone.java --- a/1904/NET/worlds/scape/MutedDrone.java 2020-08-06 15:46:18.000000000 -0500 +++ b/1904/NET/worlds/scape/MutedDrone.java 2023-08-21 23:27:16.000000000 -0500 @@ -1,43 +1,44 @@ package NET.worlds.scape; +import NET.worlds.console.HiddenDrone; import NET.worlds.network.ObjID; import NET.worlds.network.URL; import NET.worlds.network.WorldServer; import java.io.IOException; -public class MutedDrone extends Drone { - private static Object classCookie = new Object(); +public class MutedDrone extends Drone implements HiddenDrone { + private static Object classCookie = new Object(); - public MutedDrone(ObjID var1, WorldServer var2, URL var3) { - super(var1, var2); - this.setSourceURL(var3); - } - - public MutedDrone() { - } - - public Drone setAvatarNow(URL var1) { - if (this.shouldBeMuted()) { - this.setSourceURL(var1); - return this; - } else { - return super.setAvatarNow(var1); - } - } - - public void saveState(Saver var1) throws IOException { - var1.saveVersion(1, classCookie); - super.saveState(var1); - } - - public void restoreState(Restorer var1) throws IOException, TooNewException { - int var2 = var1.restoreVersion(classCookie); - switch(var2) { - case 1: - super.restoreState(var1); - return; - default: - throw new TooNewException(); - } - } + public MutedDrone(ObjID var1, WorldServer var2, URL var3) { + super(var1, var2); + this.setSourceURL(var3); + } + + public MutedDrone() { + } + + public Drone setAvatarNow(URL var1) { + if (this.shouldBeMuted()) { + this.setSourceURL(var1); + return this; + } else { + return super.setAvatarNow(var1); + } + } + + public void saveState(Saver var1) throws IOException { + var1.saveVersion(1, classCookie); + super.saveState(var1); + } + + public void restoreState(Restorer var1) throws IOException, TooNewException { + int var2 = var1.restoreVersion(classCookie); + switch(var2) { + case 1: + super.restoreState(var1); + return; + default: + throw new TooNewException(); + } + } } diff -ruN a/1904/NET/worlds/scape/ParallelAction.java b/1904/NET/worlds/scape/ParallelAction.java --- a/1904/NET/worlds/scape/ParallelAction.java 2020-08-06 15:46:16.000000000 -0500 +++ b/1904/NET/worlds/scape/ParallelAction.java 2023-08-21 23:27:16.000000000 -0500 @@ -6,130 +6,131 @@ import java.util.Vector; public class ParallelAction extends Action implements RunningActionCallback { - protected static final int NONE = 0; - protected static final int FIRST = 1; - protected static final int ALL = -1; - protected Vector actions = new Vector(); - protected int waitState = -1; - protected int waitingFor = 0; - protected Object currentRun = null; - private static Object classCookie = new Object(); - - public Persister trigger(Event var1, Persister var2) { - if (var2 == null) { - if (this.waitingFor == 0) { - this.currentRun = new Object(); - if (this.waitState == -1) { - this.waitingFor = this.actions.size(); - var2 = this; - } else if (this.waitState == 1) { - this.waitingFor = 1; - var2 = this; - } else { - this.waitingFor = 0; - var2 = null; - } + protected static final int NONE = 0; + protected static final int FIRST = 1; + protected static final int ALL = -1; + protected Vector actions = new Vector(); + protected int waitState = -1; + protected int waitingFor = 0; + protected Object currentRun = null; + private static Object classCookie = new Object(); + + public ParallelAction() { + } + + public Persister trigger(Event var1, Persister var2) { + if (var2 == null) { + if (this.waitingFor == 0) { + this.currentRun = new Object(); + if (this.waitState == -1) { + this.waitingFor = this.actions.size(); + var2 = this; + } else if (this.waitState == 1) { + this.waitingFor = 1; + var2 = this; + } else { + this.waitingFor = 0; + var2 = null; + } - RunningActionHandler.trigger((Vector)this.actions, this.getWorld(), var1, this, this.currentRun); - } - } else if (this.waitingFor == 0) { - var2 = null; - } - - return (Persister)var2; - } - - public void actionDone(Action var1, Event var2, Object var3) { - if (this.waitingFor > 0 && var3 == this.currentRun) { - --this.waitingFor; - } - - } - - public void setWaitForAll() { - this.waitState = -1; - } - - public void setWaitForFirst() { - this.waitState = 1; - } - - public void setWaitForNone() { - this.waitState = 0; - } - - public void addComponent(Action var1) { - Debug.dAssert(var1 != null); - this.actions.addElement(var1); - } - - public void insertComponent(Action var1, int var2) { - Debug.dAssert(var1 != null); - this.actions.insertElementAt(var1, var2); - } - - public boolean removeComponent(Action var1) { - Debug.dAssert(var1 != null); - return this.actions.removeElement(var1); - } - - public Enumeration getComponents() { - return this.actions.elements(); - } - - public Object properties(int var1, int var2, int var3, Object var4) throws NoSuchPropertyException { - Object var5 = null; - switch(var1 - var2) { - case 0: - if (var3 == 0) { - var5 = ObjectPropertyAdder.make(new VectorProperty(this, var1, "Components"), this.getRoot(), "NET.worlds.scape.Action"); - } else if (var3 == 1) { - var5 = this.actions.clone(); - } else if (var3 == 4) { - this.actions.removeElement(var4); - } else if (var3 == 3) { - this.actions.addElement((Action)var4); - } - break; - case 1: - if (var3 == 0) { - String[] var6 = new String[]{"None", "First", "All"}; - int[] var7 = new int[]{0, 1, -1}; - var5 = EnumPropertyEditor.make(new Property(this, var1, "Wait for"), var6, var7); - } else if (var3 == 1) { - var5 = new Integer(this.waitState); - } else if (var3 == 2) { - this.waitState = (Integer)var4; - } - break; - default: - var5 = super.properties(var1, var2 + 2, var3, var4); - } - - return var5; - } - - public void saveState(Saver var1) throws IOException { - var1.saveVersion(2, classCookie); - super.saveState(var1); - var1.saveVector(this.actions); - var1.saveInt(this.waitState); - } - - public void restoreState(Restorer var1) throws IOException, TooNewException { - switch(var1.restoreVersion(classCookie)) { - case 1: - super.restoreState(var1); - this.actions = var1.restoreVector(); - break; - case 2: - super.restoreState(var1); - this.actions = var1.restoreVector(); - this.waitState = var1.restoreInt(); - break; - default: - throw new TooNewException(); - } + RunningActionHandler.trigger(this.actions, this.getWorld(), var1, this, this.currentRun); + } + } else if (this.waitingFor == 0) { + var2 = null; + } + + return (Persister)var2; + } + + public void actionDone(Action var1, Event var2, Object var3) { + if (this.waitingFor > 0 && var3 == this.currentRun) { + --this.waitingFor; + } + + } + + public void setWaitForAll() { + this.waitState = -1; + } + + public void setWaitForFirst() { + this.waitState = 1; + } + + public void setWaitForNone() { + this.waitState = 0; + } + + public void addComponent(Action var1) { + Debug.dAssert(var1 != null); + this.actions.addElement(var1); + } + + public void insertComponent(Action var1, int var2) { + Debug.dAssert(var1 != null); + this.actions.insertElementAt(var1, var2); + } + + public boolean removeComponent(Action var1) { + Debug.dAssert(var1 != null); + return this.actions.removeElement(var1); + } + + public Enumeration getComponents() { + return this.actions.elements(); + } + + public Object properties(int var1, int var2, int var3, Object var4) throws NoSuchPropertyException { + Object var5 = null; + switch(var1 - var2) { + case 0: + if (var3 == 0) { + var5 = ObjectPropertyAdder.make(new VectorProperty(this, var1, "Components"), this.getRoot(), "NET.worlds.scape.Action"); + } else if (var3 == 1) { + var5 = this.actions.clone(); + } else if (var3 == 4) { + this.actions.removeElement(var4); + } else if (var3 == 3) { + this.actions.addElement((Action)var4); + } + break; + case 1: + if (var3 == 0) { + var5 = IntegerPropertyEditor.make(new Property(this, var1, "Wait for")); + } else if (var3 == 1) { + var5 = new Integer(this.waitState); + } else if (var3 == 2) { + this.waitState = ((Integer)var4).intValue(); + } + break; + default: + var5 = super.properties(var1, var2 + 2, var3, var4); + } + + return var5; + } + + public void saveState(Saver var1) throws IOException { + var1.saveVersion(2, classCookie); + super.saveState(var1); + var1.saveVector(this.actions); + var1.saveInt(this.waitState); + } + + public void restoreState(Restorer var1) throws IOException, TooNewException { + switch(var1.restoreVersion(classCookie)) { + case 1: + super.restoreState(var1); + this.actions = var1.restoreVector(); + break; + case 2: + super.restoreState(var1); + this.actions = var1.restoreVector(); + this.waitState = var1.restoreInt(); + break; + default: + throw new TooNewException(); + } - } + } } diff -ruN a/1904/NET/worlds/scape/Pilot.java b/1904/NET/worlds/scape/Pilot.java --- a/1904/NET/worlds/scape/Pilot.java 2020-08-06 15:46:18.000000000 -0500 +++ b/1904/NET/worlds/scape/Pilot.java 2023-12-15 21:43:22.000000000 -0600 @@ -26,8 +26,10 @@ import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.IOException; +import java.net.MalformedURLException; import java.util.Enumeration; import java.util.Vector; +import NET.worldsplus.MumbleLink; public abstract class Pilot extends WObject implements NetworkObject, BumpHandler { static Vector visibleRooms; @@ -49,6 +51,7 @@ protected int cameraSpeed = 0; private static World lastWorld; private Camera lastCam; + private static MumbleLink mlink; protected Console console; private static Object classCookie; @@ -160,8 +163,9 @@ addVisibleRoom(var2, 0.0F, 0.0F, 0.0F, 0.0F); } + Vector var3 = visibleRooms; Vector var4; - synchronized(visibleRooms) { + synchronized(var3) { var4 = visibleRoomInfo; visibleRoomInfo = nextVisibleRoomInfo; nextVisibleRoomInfo = var4; @@ -170,43 +174,43 @@ visibleRooms = var4; } - Vector var3 = nextVisibleRooms; - var4 = nextVisibleRoomInfo; - Object var5 = var1.source; + var4 = nextVisibleRooms; + Vector var5 = nextVisibleRoomInfo; + Object var6 = var1.source; var1.source = this; - int var6 = visibleRooms.size(); + int var7 = visibleRooms.size(); while(true) { - --var6; - if (var6 < 0) { - var6 = var3.size(); + --var7; + if (var7 < 0) { + int var12 = var4.size(); while(true) { - --var6; - if (var6 < 0) { + --var12; + if (var12 < 0) { nextVisibleRooms.removeAllElements(); nextVisibleRoomInfo.removeAllElements(); - var6 = var1.time - this.lastUpdateTime; - if (var6 > 500) { + int var9 = var1.time - this.lastUpdateTime; + if (var9 > 500) { this.subscribeRooms(); - boolean var9 = this.pilotUpdate(var1.time); - this.subscriptionUpdate(var9); + boolean var10 = this.pilotUpdate(var1.time); + this.subscriptionUpdate(var10); this.updateUnsubscribes(); this.lastUpdateTime = var1.time; } this.touchSubscribers(); - var1.source = var5; + var1.source = var6; return; } - ((Room)var3.elementAt(var6)).generateFrameEvents(var1); + ((Room)var4.elementAt(var12)).generateFrameEvents(var1); } } - Room var7 = (Room)visibleRooms.elementAt(var6); - var7.generateFrameEvents(var1); - var3.removeElement(var7); + Room var8 = (Room)visibleRooms.elementAt(var7); + var8.generateFrameEvents(var1); + var4.removeElement(var8); } } @@ -294,7 +298,7 @@ var2 = var2 + "," + var3; var3 = round(this.getZ(), 1.0F); var2 = var2 + "," + var3; - Point3Temp var4 = Point3.make(); + Point3Temp var4 = Point3Temp.make(); var3 = round(this.getSpin(var4), 1.0F); var2 = var2 + "," + var3; var3 = round(var4.x, 0.001F); @@ -344,8 +348,8 @@ if (var3 != null) { try { var3.sendNetworkMsg(var1); - } catch (InfiniteWaitException var6) { - } catch (PacketTooLargeException var7) { + } catch (InfiniteWaitException var7) { + } catch (PacketTooLargeException var8) { } } @@ -431,6 +435,7 @@ this.lasty = var3; this.lastz = var4; this.lastdir = var5; + this.updateMumble(); return true; } } @@ -687,18 +692,16 @@ } private static Camera getNextCamera(Enumeration var0) { - while(true) { - if (var0.hasMoreElements()) { - Object var1 = var0.nextElement(); - if (!(var1 instanceof Camera)) { - continue; - } - - return (Camera)var1; + Object var1; + do { + if (!var0.hasMoreElements()) { + return null; } - return null; - } + var1 = var0.nextElement(); + } while(!(var1 instanceof Camera)); + + return (Camera)var1; } protected void transferFrom(Pilot var1) { @@ -842,6 +845,23 @@ throw new TooNewException(); } } + + public void updateMumble() { + if (this == getActive() && mlink != null) { + Camera thiscam = this.getMainCamera(); + mlink.updateMumble( + this.getLongID(), + this.getX(), + this.getY(), + this.getFootHeight(), + thiscam.getX(), + thiscam.getY(), + thiscam.getZ(), + thiscam.getYaw() + ); + System.out.println("Mumble Link update called!"); + } + } static { nativeInit(); @@ -852,5 +872,10 @@ subscribers = new Vector(); lastWorld = null; classCookie = new Object(); + try { + mlink = new MumbleLink(); + System.out.println("Mumble Link loaded!"); + } catch (MalformedURLException ignored) { + } } } diff -ruN a/1904/NET/worlds/scape/PosableShape.java b/1904/NET/worlds/scape/PosableShape.java --- a/1904/NET/worlds/scape/PosableShape.java 2020-08-06 15:46:10.000000000 -0500 +++ b/1904/NET/worlds/scape/PosableShape.java 2023-08-21 23:27:16.000000000 -0500 @@ -367,7 +367,7 @@ ((Shape)var10).scale(this.getScale(var22), this.getScale(var19), this.getScale(var20)); } else if (var17 != 'Q') { if (var17 == 'C') { - Debug.assert(false); + throw new AssertionError(); } else if (var17 == 'D') { var13 += (int)(1000.0D * (Math.pow(1.0932D, (double)scanBase64(var1.charAt(this.scanPos++))) - 0.8999999761581421D)); } else if (var17 == 'A') { @@ -1226,7 +1226,8 @@ public boolean handle(FrameEvent var1) { float var2 = this.closestView; this.closestView = 10000.0F; - if (this.animator != null && var2 <= 900.0F && this.hasClump()) { + float distance = IniFile.gamma().getIniInt("AnimationQualityDistance", 900); + if (this.animator != null && var2 <= distance && this.hasClump()) { if (this.recomputeHeight) { if (this.runPrepFigure) { DroneAnimator.prepFigure(this, this.COG); @@ -1280,7 +1281,7 @@ } else if (var3 == 1) { var5 = new Boolean(this.COG); } else if (var3 == 2) { - this.COG = (Boolean)var4; + this.COG = ((Boolean)var4).booleanValue(); URL var6 = this.getURL(); this.setURL(defaultURL); this.setURL(var6); diff -ruN a/1904/NET/worlds/scape/SelectAvatarAction.java b/1904/NET/worlds/scape/SelectAvatarAction.java --- a/1904/NET/worlds/scape/SelectAvatarAction.java 2020-08-06 15:46:16.000000000 -0500 +++ b/1904/NET/worlds/scape/SelectAvatarAction.java 2023-08-21 23:27:16.000000000 -0500 @@ -1,3 +1,8 @@ +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by Fernflower decompiler) +// + package NET.worlds.scape; import NET.worlds.console.Console; @@ -8,138 +13,141 @@ import java.io.IOException; public class SelectAvatarAction extends DialogAction { - URL url = null; - String description; - static String[] avatarAliases = ServerTableManager.instance().getTable("avatarAliases"); - private static Object classCookie = new Object(); - - private URL getURLVal() { - URL var1 = this.url; - if (var1 == null) { - SuperRoot var2 = this.getOwner(); - if (var2 instanceof Drone) { - var1 = ((Drone)var2).getSourceURL(); - } else if (var2 instanceof PosableShape) { - var1 = ((Shape)var2).getURL(); - } else if (var2 instanceof Hologram) { - var1 = ((Hologram)var2).getMovieName(); - } - } - - return var1; - } - - public void doIt() { - Console var1 = Console.getActive(); - URL var2 = this.getURLVal(); - if (var1 != null && var2 != null) { - var1.setAvatar(var2); - } - - } - - public PolledDialog getDialog() { - URL var1 = this.getURLVal(); - if (!Console.getActive().getVIPAvatars() && var1.getInternal().toLowerCase().endsWith(".rwg")) { - return new OkCancelDialog(Console.getFrame(), this, Console.message("Cant-change-AV"), Console.message("OK"), (String)null, Console.message("Only-VIPs-change"), false); - } else { - String var2 = this.description; - if (var2 == null || var2.length() == 0) { - var2 = getPrettyAvatarName(var1.getBase()); - } - - return new ChangeAvatarDialog(Console.getFrame(), this, var2); - } - } - - public static String getPrettyAvatarName(String var0) { - int var1 = var0.indexOf(46); - if (var1 >= 0) { - var0 = var0.substring(0, var1).toLowerCase(); - } else { - var0 = var0.toLowerCase(); - } - - for(int var2 = 0; var2 < avatarAliases.length; var2 += 2) { - if (avatarAliases[var2].equals(var0)) { - return avatarAliases[var2 + 1]; - } - } - - String var3 = var0.substring(0, 1).toUpperCase(); - if (var0.length() > 1) { - var3 = var3 + var0.substring(1); - } - - return var3; - } - - public Persister trigger(Event var1, Persister var2) { - URL var3 = this.getURLVal(); - return var3 == null ? null : super.trigger(var1, var2); - } - - public Object properties(int var1, int var2, int var3, Object var4) throws NoSuchPropertyException { - Object var5 = null; - switch(var1 - var2) { - case 0: - if (var3 == 0) { - var5 = URLPropertyEditor.make((new Property(this, var1, "Avatar URL")).allowSetNull(), "pilot;drone;rwx;rwg;mov"); - } else if (var3 == 1) { - var5 = this.url; - } else if (var3 == 2) { - this.url = (URL)var4; - } - break; - default: - var5 = super.properties(var1, var2 + 1, var3, var4); - } - - return var5; - } - - public String toString() { - return super.toString() + "[url " + (this.url == null ? "null" : this.url.getRelativeTo((SuperRoot)this) + "]"); - } - - public void saveState(Saver var1) throws IOException { - var1.saveVersion(4, classCookie); - super.saveState(var1); - URL.save(var1, this.url); - var1.saveString(this.description); - } - - public void restoreState(Restorer var1) throws IOException, TooNewException { - int var2 = var1.restoreVersion(classCookie); - switch(var2) { - case 0: - var1.setOldFlag(); - this.dialogActionSkipRestore(var1); - this.url = URL.restore(var1, ".world"); - break; - case 1: - var1.setOldFlag(); - this.dialogActionSkipRestore(var1); - this.url = URL.restore(var1, ".world"); - this.showDialog = var1.restoreBoolean(); - break; - case 2: - this.dialogActionSkipRestore(var1); - this.url = URL.restore(var1, ".world"); - this.showDialog = var1.restoreBoolean(); - this.cancelOnly = var1.restoreBoolean(); - break; - case 3: - case 4: - super.restoreState(var1); - this.url = URL.restore(var1, ".world"); - if (var2 >= 4) { - this.description = var1.restoreString(); - } - break; - default: - throw new TooNewException(); - } + URL url = null; + String description; + static String[] avatarAliases = ServerTableManager.instance().getTable("avatarAliases"); + private static Object classCookie = new Object(); + + public SelectAvatarAction() { + } + + private URL getURLVal() { + URL var1 = this.url; + if (var1 == null) { + SuperRoot var2 = this.getOwner(); + if (var2 instanceof Drone) { + var1 = ((Drone)var2).getSourceURL(); + } else if (var2 instanceof PosableShape) { + var1 = ((Shape)var2).getURL(); + } else if (var2 instanceof Hologram) { + var1 = ((Hologram)var2).getMovieName(); + } + } + + return var1; + } + + public void doIt() { + Console var1 = Console.getActive(); + URL var2 = this.getURLVal(); + if (var1 != null && var2 != null) { + var1.setAvatar(var2); + } + + } + + public PolledDialog getDialog() { + URL var1 = this.getURLVal(); + if (!Console.getActive().getVIPAvatars() && var1.getInternal().toLowerCase().endsWith(".rwg")) { + return new OkCancelDialog(Console.getFrame(), this, Console.message("Cant-change-AV"), Console.message("OK"), (String)null, Console.message("Only-VIPs-change"), false); + } else { + String var2 = this.description; + if (var2 == null || var2.length() == 0) { + var2 = getPrettyAvatarName(var1.getBase()); + } + + return new ChangeAvatarDialog(Console.getFrame(), this, var2); + } + } + + public static String getPrettyAvatarName(String var0) { + int var1 = var0.indexOf(46); + if (var1 >= 1) { + var0 = var0.substring(0, var1).toLowerCase(); + } else { + var0 = var0.toLowerCase(); + } + + for(int var2 = 0; var2 < avatarAliases.length; var2 += 2) { + if (avatarAliases[var2].equals(var0)) { + return avatarAliases[var2 + 1]; + } + } + + String var3 = var0.substring(0, 1).toUpperCase(); + if (var0.length() > 1) { + var3 = var3 + var0.substring(1); + } + + return var3; + } + + public Persister trigger(Event var1, Persister var2) { + URL var3 = this.getURLVal(); + return var3 == null ? null : super.trigger(var1, var2); + } + + public Object properties(int var1, int var2, int var3, Object var4) throws NoSuchPropertyException { + Object var5 = null; + switch(var1 - var2) { + case 0: + if (var3 == 0) { + var5 = URLPropertyEditor.make((new Property(this, var1, "Avatar URL")).allowSetNull(), "pilot;drone;rwx;rwg;mov"); + } else if (var3 == 1) { + var5 = this.url; + } else if (var3 == 2) { + this.url = (URL)var4; + } + break; + default: + var5 = super.properties(var1, var2 + 1, var3, var4); + } + + return var5; + } + + public String toString() { + return super.toString() + "[url " + (this.url == null ? "null" : this.url.getRelativeTo(this) + "]"); + } + + public void saveState(Saver var1) throws IOException { + var1.saveVersion(4, classCookie); + super.saveState(var1); + URL.save(var1, this.url); + var1.saveString(this.description); + } + + public void restoreState(Restorer var1) throws IOException, TooNewException { + int var2 = var1.restoreVersion(classCookie); + switch(var2) { + case 0: + var1.setOldFlag(); + this.dialogActionSkipRestore(var1); + this.url = URL.restore(var1, ".world"); + break; + case 1: + var1.setOldFlag(); + this.dialogActionSkipRestore(var1); + this.url = URL.restore(var1, ".world"); + this.showDialog = var1.restoreBoolean(); + break; + case 2: + this.dialogActionSkipRestore(var1); + this.url = URL.restore(var1, ".world"); + this.showDialog = var1.restoreBoolean(); + this.cancelOnly = var1.restoreBoolean(); + break; + case 3: + case 4: + super.restoreState(var1); + this.url = URL.restore(var1, ".world"); + if (var2 >= 4) { + this.description = var1.restoreString(); + } + break; + default: + throw new TooNewException(); + } - } + } } diff -ruN a/1904/NET/worlds/scape/SuperRoot.java b/1904/NET/worlds/scape/SuperRoot.java --- a/1904/NET/worlds/scape/SuperRoot.java 2020-08-06 15:46:10.000000000 -0500 +++ b/1904/NET/worlds/scape/SuperRoot.java 2023-08-21 23:27:16.000000000 -0500 @@ -41,7 +41,7 @@ SuperRoot var4 = (SuperRoot)var3.nextElement(); if (var4.name != null && var4.name.startsWith(var2)) { try { - int var5 = Integer.valueOf(var4.name.substring(var2.length())); + int var5 = Integer.valueOf(var4.name.substring(var2.length())).intValue(); if (var5 > var1) { var1 = var5; } @@ -122,12 +122,7 @@ this.setName((String)null); } else if (var3 == 2) { String var6 = (String)var4; - if (!var6.equals(this.name) && this.owner != null && nameSearch(this.getRoot().getDeepOwned(), var6) != null) { - Object[] var7 = new Object[]{new String(var6), new String(this.getRoot().getName())}; - Console.println(MessageFormat.format(Console.message("Name-in-use"), var7)); - } else { - this.setName((String)var4); - } + this.setName((String)var4); } break; case 1: @@ -350,7 +345,7 @@ Integer var2 = (Integer)finalizedClasses.get(var1); int var3 = 0; if (var2 != null) { - var3 = var2; + var3 = var2.intValue(); } ++var3; @@ -370,7 +365,7 @@ Integer var3 = (Integer)classCounter.get(var2); int var4 = 0; if (var3 != null) { - var4 = var3; + var4 = var3.intValue(); } var4 += var1; diff -ruN a/1904/NET/worlds/scape/TalkAction.java b/1904/NET/worlds/scape/TalkAction.java --- a/1904/NET/worlds/scape/TalkAction.java 2020-08-06 15:46:10.000000000 -0500 +++ b/1904/NET/worlds/scape/TalkAction.java 2023-08-21 23:27:16.000000000 -0500 @@ -1,61 +1,64 @@ package NET.worlds.scape; +import NET.worlds.console.Console; +import NET.worlds.core.IniFile; + import java.io.IOException; public class TalkAction extends Action { - String txt = null; - private static Object classCookie = new Object(); + String txt = null; + private static final Object classCookie = new Object(); - public TalkAction() { - } + public TalkAction() { + } - public TalkAction(String var1) { - this.txt = var1; - } - - public Persister trigger(Event var1, Persister var2) { - Pilot.getActive(); - Pilot.sendText(this.txt); - return null; - } - - public Object properties(int var1, int var2, int var3, Object var4) throws NoSuchPropertyException { - Object var5 = null; - switch(var1 - var2) { - case 0: - if (var3 == 0) { - var5 = StringPropertyEditor.make(new Property(this, var1, "Message")); - } else if (var3 == 1) { - var5 = this.txt; - } else if (var3 == 2) { - this.txt = (String)var4; - } - break; - default: - var5 = super.properties(var1, var2 + 1, var3, var4); - } - - return var5; - } - - public void saveState(Saver var1) throws IOException { - var1.saveVersion(0, classCookie); - super.saveState(var1); - var1.saveString(this.txt); - } - - public void restoreState(Restorer var1) throws IOException, TooNewException { - switch(var1.restoreVersion(classCookie)) { - case 0: - super.restoreState(var1); - this.txt = var1.restoreString(); - return; - default: - throw new TooNewException(); - } - } - - public String toString() { - return super.toString() + "[" + this.txt + "]"; - } + public TalkAction(String var1) { + this.txt = var1; + } + + public Persister trigger(Event var1, Persister var2) { + if (IniFile.gamma().getIniInt("DisableTalkAction", 1) == 1) { + if (IniFile.gamma().getIniInt("classicChatBox", 1) == 1) Pilot.getActive().console.printLine(Console.getActive().getLongID() + ": " + this.txt); + else Pilot.getActive().console.printLine(" " + Console.getActive().getLongID() + ": " + this.txt + " "); + } else { + Pilot.sendText(this.txt); + } + return null; + } + + public Object properties(int var1, int var2, int var3, Object var4) throws NoSuchPropertyException { + Object var5 = null; + if (var1 - var2 == 0) { + if (var3 == 0) { + var5 = StringPropertyEditor.make(new Property(this, var1, "Message")); + } else if (var3 == 1) { + var5 = this.txt; + } else if (var3 == 2) { + this.txt = (String) var4; + } + } else { + var5 = super.properties(var1, var2 + 1, var3, var4); + } + + return var5; + } + + public void saveState(Saver var1) throws IOException { + var1.saveVersion(0, classCookie); + super.saveState(var1); + var1.saveString(this.txt); + } + + public void restoreState(Restorer var1) throws IOException, TooNewException { + if (var1.restoreVersion(classCookie) == 0) { + super.restoreState(var1); + this.txt = var1.restoreString(); + return; + } + throw new TooNewException(); + } + + public String toString() { + return super.toString() + "[" + this.txt + "]"; + } } diff -ruN a/1904/NET/worlds/scape/TarredDrone.java b/1904/NET/worlds/scape/TarredDrone.java --- a/1904/NET/worlds/scape/TarredDrone.java 1969-12-31 18:00:00.000000000 -0600 +++ b/1904/NET/worlds/scape/TarredDrone.java 2023-08-21 23:27:16.000000000 -0500 @@ -0,0 +1,44 @@ +package NET.worlds.scape; + +import NET.worlds.console.HiddenDrone; +import NET.worlds.network.ObjID; +import NET.worlds.network.URL; +import NET.worlds.network.WorldServer; +import java.io.IOException; + +public class TarredDrone extends Drone implements HiddenDrone { + private static Object classCookie = new Object(); + + public TarredDrone(ObjID var1, WorldServer var2, URL var3) { + super(var1, var2); + this.setSourceURL(var3); + } + + public TarredDrone() { + } + + public Drone setAvatarNow(URL var1) { + if (this.shouldBeTarred()) { + this.setSourceURL(URL.make("avatar:holden.mov")); + return this; + } else { + return super.setAvatarNow(var1); + } + } + + public void saveState(Saver var1) throws IOException { + var1.saveVersion(1, classCookie); + super.saveState(var1); + } + + public void restoreState(Restorer var1) throws IOException, TooNewException { + int var2 = var1.restoreVersion(classCookie); + switch(var2) { + case 1: + super.restoreState(var1); + return; + default: + throw new TooNewException(); + } + } +} diff -ruN a/1904/NET/worlds/scape/TeleportAction.java b/1904/NET/worlds/scape/TeleportAction.java --- a/1904/NET/worlds/scape/TeleportAction.java 2020-08-06 15:46:10.000000000 -0500 +++ b/1904/NET/worlds/scape/TeleportAction.java 2023-08-21 23:27:16.000000000 -0500 @@ -1,547 +1,542 @@ package NET.worlds.scape; -import NET.worlds.console.Console; -import NET.worlds.console.DialogReceiver; -import NET.worlds.console.GammaFrame; -import NET.worlds.console.Main; -import NET.worlds.console.MainCallback; -import NET.worlds.console.WorldsMarkPart; -import NET.worlds.core.Debug; +import NET.worlds.console.*; import NET.worlds.core.IniFile; import NET.worlds.network.NetUpdate; import NET.worlds.network.URL; + import java.io.IOException; import java.net.MalformedURLException; import java.text.MessageFormat; public class TeleportAction extends Action implements LoadedURLSelf, MainCallback, DialogReceiver { - private Point3 targetCoords = new Point3(); - private float targetRot = 0.0F; - private Point3 targetAxis = new Point3(0.0F, 0.0F, -1.0F); - private String targetRoomName = null; - private String targetDimension = null; - private URL targetWorldURL = null; - private boolean useDefCoordinates = false; - private boolean done = false; - private boolean showDialog = true; - private boolean forceWorldLoad = false; - private boolean forceNoWorldLoad = false; - private String targetURL; - private static TeleportAction activeTeleport = null; - private TeleportDialog dialog = null; - private TeleportStatus doneCallback; - String tempParseStr; - private static Object classCookie = new Object(); - - public TeleportAction() { - } - - public Persister trigger(Event var1, Persister var2) { - if (activeTeleport != this) { - this.targetURL = this.asURL(); - this.startTeleport(); - } - - return !this.done && activeTeleport != this ? this : null; - } - - public void stopLoading() { - this.done = true; - if (activeTeleport == this) { - this.stopTeleport((String)null); - } - - } - - public static boolean isTeleporting() { - return activeTeleport != null; - } - - public static void teleport(String var0, TeleportStatus var1) { - TeleportAction var2 = new TeleportAction(var0, var1); - if (Main.isMainThread()) { - var2.startTeleport(); - } else { - Main.register(var2); - } - - } - - public static void teleport(String var0, TeleportStatus var1, boolean var2) { - TeleportAction var3 = new TeleportAction(var0, var1); - var3.forceWorldLoad = var2; - var3.forceNoWorldLoad = !var2; - if (Main.isMainThread()) { - var3.startTeleport(); - } else { - Main.register(var3); - } - - } - - public static void teleport(String var0, TeleportStatus var1, boolean var2, boolean var3) { - TeleportAction var4 = new TeleportAction(var0, var1); - var4.showDialog = var3; - var4.forceWorldLoad = var2; - var4.forceNoWorldLoad = !var2; - if (Main.isMainThread()) { - var4.startTeleport(); - } else { - Main.register(var4); - } - - } - - public void mainCallback() { - Main.unregister(this); - this.startTeleport(); - } - - public static String toURLString(String var0) { - if (var0 == null || var0.equals("world:")) { - var0 = WorldsMarkPart.getFirstSystemMarkURL(); - } - - if (var0 == null) { - var0 = "home:NewWorld.world"; - } - - if (var0.startsWith("world:")) { - if (var0.equals("world:restart")) { - var0 = IniFile.gamma().getIniString("RestartAt", WorldsMarkPart.getFirstSystemMarkURL()); - } else if (var0.equals("world:store")) { - var0 = World.getHomeStore().getAbsolute(); - } else { - var0 = var0.substring(6); - } - - int var1 = var0.indexOf(".world?"); - if (var1 >= 0) { - var0 = var0.substring(0, var1) + ".world#" + var0.substring(var1 + 7); - } - } - - if (var0.indexOf(58) < 0) { - if (var0.indexOf(47) < 0 && var0.indexOf(92) < 0 && !var0.endsWith(".world")) { - var0 = "home:" + var0 + "/" + var0 + ".world"; - } else { - var0 = "file:" + var0; - } - } - - return var0; - } - - private TeleportAction(String var1, TeleportStatus var2) { - this.doneCallback = var2; - this.targetURL = toURLString(var1); - var1 = this.setFromURL(this.targetURL); - - try { - if (this.targetURL.startsWith("http://")) { - this.targetWorldURL = new URL(var1); - } else { - this.targetWorldURL = new URL(URL.getCurDir(), URL.maybeAddExt(var1, ".world")); - } - } catch (MalformedURLException var4) { - this.targetWorldURL = URL.make("error:\"" + var1 + '"'); - } - - } - - private float getNextFloat(float var1) { - String var2 = this.tempParseStr; - int var3 = this.tempParseStr.indexOf(44); - if (var3 == -1) { - var3 = this.tempParseStr.length(); - this.tempParseStr = ""; - } else { - this.tempParseStr = this.tempParseStr.substring(var3 + 1); - } - - try { - return Float.valueOf(var2.substring(0, var3)); - } catch (NumberFormatException var5) { - return var1; - } - } - - private String setFromURL(String var1) { - this.useDefCoordinates = true; - int var2 = var1.lastIndexOf(35); - int var4; - if (var2 >= 0) { - String var3 = var1.substring(var2 + 1); - var1 = var1.substring(0, var2); - var4 = var3.lastIndexOf(64); - if (var4 < 0) { - this.targetRoomName = var3; - } else { - this.useDefCoordinates = false; - this.targetRoomName = var3.substring(0, var4); - this.tempParseStr = var3.substring(var4 + 1); - this.targetCoords.x = this.getNextFloat(this.targetCoords.x); - this.targetCoords.y = this.getNextFloat(this.targetCoords.y); - this.targetCoords.z = this.getNextFloat(this.targetCoords.z); - this.targetRot = this.getNextFloat(this.targetRot); - this.targetAxis.x = this.getNextFloat(this.targetAxis.x); - this.targetAxis.y = this.getNextFloat(this.targetAxis.y); - this.targetAxis.z = this.getNextFloat(this.targetAxis.z); - this.tempParseStr = null; - } - } - - if (this.targetRoomName != null) { - int var5 = this.targetRoomName.lastIndexOf(62); - var4 = this.targetRoomName.lastIndexOf(60); - if (var5 + 1 == this.targetRoomName.length() && var4 >= 0) { - this.targetDimension = this.targetRoomName.substring(var4 + 1, var5); - this.targetRoomName = this.targetRoomName.substring(0, var4); - } - } - - return var1; - } - - private void makeTeleportDialog(URL var1) { - if (this.showDialog) { - GammaFrame var2 = Console.getFrame(); - if (var2 != null && var2.isShowing()) { - this.dialog = new TeleportDialog(var2, this); - } - } - - } - - private void startTeleport() { - if (activeTeleport != null) { - if (activeTeleport.doneCallback != null) { - activeTeleport.doneCallback.teleportStatus("overridden by new teleport", activeTeleport.targetURL); - } - - activeTeleport.stopTeleport((String)null); - } - - activeTeleport = this; - Console.setFreezeFrameEvents(true); - this.done = false; - Console.teleportNotification("", this.targetURL); - if (this.targetWorldURL != null) { - this.makeTeleportDialog(this.targetWorldURL); - World.load(this.targetWorldURL, this, this.forceWorldLoad); - } else { - Pilot var1 = Pilot.getActive(); - World var2; - if (var1 != null && (var2 = var1.getWorld()) != null) { - this.makeTeleportDialog(var2.getSourceURL()); - this.loadedURLSelf(var2, this.targetWorldURL, (String)null); - } else { - this.stopTeleport("Pilot not in a room for intraworld teleport"); - } - } - - } - - private Room stopTeleport(String var1) { - Debug.assert(this == activeTeleport); - this.done = true; - activeTeleport = null; - Console.setFreezeFrameEvents(false); - if (this.doneCallback != null) { - this.doneCallback.teleportStatus(var1, this.targetURL); - } - - if (var1 != null && !this.forceNoWorldLoad) { - Console.teleportNotification(var1, this.targetURL); - Console.println(var1); - } - - if (this.dialog != null) { - this.dialog.closeIt(true); - this.dialog = null; - } - - return null; - } - - public synchronized void dialogDone(Object var1, boolean var2) { - if (activeTeleport != null) { - activeTeleport.stopTeleport((String)null); - } - - } - - public static String getReadableNameOfWorld(URL var0) { - String var1 = var0.getAbsolute(); - String var2 = var1; - String var3 = null; - if (var1.startsWith("home:") && var1.length() > 6) { - var2 = var1.substring(var1.charAt(5) == '/' ? 6 : 5); - int var4 = var2.indexOf(47); - if (var4 > 0) { - var3 = var2.substring(0, var4); - if (var2.regionMatches(true, var4 + 1, var2, 0, var4)) { - var2 = var3; - String var5 = WorldsMarkPart.getExternalName(var3); - if (var5 != null) { - var2 = var5; - } - } - } - - int var6 = var2.indexOf(".world"); - if (var6 > 0) { - var2 = var2.substring(0, var6); - } - - var2 = "the " + var2 + " world"; - } - - return var2; - } - - public static String getPackageNameOfWorld(URL var0) { - String var1 = var0.getAbsolute(); - String var3 = null; - if (var1.startsWith("home:") && var1.length() > 6) { - String var2 = var1.substring(var1.charAt(5) == '/' ? 6 : 5); - int var4 = var2.indexOf(47); - if (var4 > 0) { - var3 = var2.substring(0, var4); - } - } - - return var3; - } - - public void loadedURLSelf(URLSelf var1, URL var2, String var3) { - if (activeTeleport != this) { - if (var1 != null) { - var1.decRef(); - } - - } else { - String var4; - if (var3 == null && var1 instanceof World) { - var4 = this.targetRoomName; - if (var4 == null) { - var4 = ((World)var1).getDefaultRoomName(); - } - - Room var7 = ((World)var1).getRoom(var4); - if (var7 == null) { - this.stopTeleport("Error finding room " + this.targetRoomName); - } else if (var7.getVIPOnly() && !((World)var1).getConsole().getVIP()) { - this.stopTeleport("Only VIPs may go there."); - if (this.forceNoWorldLoad) { - Console.println(Console.message("Only-VIPs-there")); - } + private Point3 targetCoords = new Point3(); + private float targetRot = 0.0F; + private Point3 targetAxis = new Point3(0.0F, 0.0F, -1.0F); + private String targetRoomName = null; + private String targetDimension = null; + private URL targetWorldURL = null; + private boolean useDefCoordinates = false; + private boolean done = false; + private boolean showDialog = true; + private boolean forceWorldLoad = false; + private boolean forceNoWorldLoad = false; + private String targetURL; + private static TeleportAction activeTeleport = null; + private TeleportDialog dialog = null; + private TeleportStatus doneCallback; + String tempParseStr; + private static final Object classCookie = new Object(); + + public TeleportAction() { + } + + public Persister trigger(Event var1, Persister var2) { + if (activeTeleport != this) { + this.targetURL = this.asURL(); + this.startTeleport(); + } + + return !this.done && activeTeleport != this ? this : null; + } + + public void stopLoading() { + this.done = true; + if (activeTeleport == this) { + this.stopTeleport((String)null); + } + + } + + public static boolean isTeleporting() { + return activeTeleport != null; + } + + public static void teleport(String var0, TeleportStatus var1) { + TeleportAction var2 = new TeleportAction(var0, var1); + if (Main.isMainThread()) { + var2.startTeleport(); + } else { + Main.register(var2); + } + + } + + public static void teleport(String var0, TeleportStatus var1, boolean var2) { + TeleportAction var3 = new TeleportAction(var0, var1); + var3.forceWorldLoad = var2; + var3.forceNoWorldLoad = !var2; + if (Main.isMainThread()) { + var3.startTeleport(); + } else { + Main.register(var3); + } + + } + + public static void teleport(String var0, TeleportStatus var1, boolean var2, boolean var3) { + TeleportAction var4 = new TeleportAction(var0, var1); + var4.showDialog = var3; + var4.forceWorldLoad = var2; + var4.forceNoWorldLoad = !var2; + if (Main.isMainThread()) { + var4.startTeleport(); + } else { + Main.register(var4); + } + + } + + public void mainCallback() { + Main.unregister(this); + this.startTeleport(); + } + + public static String toURLString(String var0) { + if (var0 == null || var0.equals("world:")) { + var0 = WorldsMarkPart.getFirstSystemMarkURL(); + } + + if (var0 == null) { + var0 = "home:NewWorld.world"; + } + + if (var0.startsWith("world:")) { + if (var0.equals("world:restart")) { + var0 = IniFile.gamma().getIniString("RestartAt", WorldsMarkPart.getFirstSystemMarkURL()); + } else if (var0.equals("world:store")) { + var0 = World.getHomeStore().getAbsolute(); + } else { + var0 = var0.substring(6); + } + + int var1 = var0.indexOf(".world?"); + if (var1 >= 0) { + var0 = var0.substring(0, var1) + ".world#" + var0.substring(var1 + 7); + } + } + if (var0.indexOf(58) < 0) { + if (var0.indexOf(47) < 0 && var0.indexOf(92) < 0 && !var0.endsWith(".world")) { + var0 = "home:" + var0 + "/" + var0 + ".world"; } else { - Console.teleportNotification((String)null, this.targetURL); - Pilot var8 = Pilot.changeActiveRoom(var7); - if (this.targetDimension != null) { - var8.changeChannel(this.targetDimension); - } - - var8.makeIdentity(); - if (this.useDefCoordinates) { - var8.moveTo(var7.getDefaultPosition()).spin(var7.getDefaultOrientationAxis(), var7.getDefaultOrientation()); - } else { - var8.moveTo(this.targetCoords).spin(this.targetAxis, this.targetRot); - } - - this.stopTeleport((String)null); - } - } else { - if (var3 == null) { - var3 = "file " + var2 + " doesn't contain a World"; - var1.decRef(); - } - - var4 = getReadableNameOfWorld(var2); - String var5 = getPackageNameOfWorld(var2); - Object[] var6 = new Object[]{new String(var4)}; - this.stopTeleport(MessageFormat.format(Console.message("cant-teleport"), var6)); - if (var5 != null && !this.forceNoWorldLoad) { - NetUpdate.loadWorld(var5, this.forceWorldLoad); - } - - } - } - } - - public Object properties(int var1, int var2, int var3, Object var4) throws NoSuchPropertyException { - Object var5 = null; - switch(var1 - var2) { - case 0: - if (var3 == 0) { - var5 = Point3PropertyEditor.make(new Property(this, var1, "X, Y, Z")); - } else if (var3 == 1) { - var5 = new Point3(this.targetCoords); - } else if (var3 == 2) { - this.targetCoords.copy((Point3)var4); - } - break; - case 1: - if (var3 == 0) { - var5 = FloatPropertyEditor.make(new Property(this, var1, "Dir")); - } else if (var3 == 1) { - var5 = new Float(this.targetRot); - } else if (var3 == 2) { - this.targetRot = (Float)var4; - } - break; - case 2: - if (var3 == 0) { - var5 = StringPropertyEditor.make((new Property(this, var1, "Room Name")).allowSetNull()); - } else if (var3 == 1) { - if (this.targetRoomName == null) { - var5 = ""; + var0 = "file:" + var0; + } + } + + return var0; + } + + private TeleportAction(String var1, TeleportStatus var2) { + this.doneCallback = var2; + this.targetURL = toURLString(var1); + var1 = this.setFromURL(this.targetURL); + + try { + if (this.targetURL.startsWith("http://") || this.targetURL.startsWith("https://")) { + this.targetWorldURL = new URL(var1); + } else { + this.targetWorldURL = new URL(URL.getCurDir(), URL.maybeAddExt(var1, ".world")); + } + } catch (MalformedURLException var4) { + this.targetWorldURL = URL.make("error:\"" + var1 + '"'); + } + + } + + private float getNextFloat(float var1) { + String var2 = this.tempParseStr; + int var3 = this.tempParseStr.indexOf(44); + if (var3 == -1) { + var3 = this.tempParseStr.length(); + this.tempParseStr = ""; + } else { + this.tempParseStr = this.tempParseStr.substring(var3 + 1); + } + + try { + return Float.valueOf(var2.substring(0, var3)).floatValue(); + } catch (NumberFormatException var5) { + return var1; + } + } + + private String setFromURL(String var1) { + this.useDefCoordinates = true; + int var2 = var1.lastIndexOf(35); + int var4; + if (var2 >= 0) { + String var3 = var1.substring(var2 + 1); + var1 = var1.substring(0, var2); + var4 = var3.lastIndexOf(64); + if (var4 < 0) { + this.targetRoomName = var3; } else { - var5 = new String(this.targetRoomName); + this.useDefCoordinates = false; + this.targetRoomName = var3.substring(0, var4); + this.tempParseStr = var3.substring(var4 + 1); + this.targetCoords.x = this.getNextFloat(this.targetCoords.x); + this.targetCoords.y = this.getNextFloat(this.targetCoords.y); + this.targetCoords.z = this.getNextFloat(this.targetCoords.z); + this.targetRot = this.getNextFloat(this.targetRot); + this.targetAxis.x = this.getNextFloat(this.targetAxis.x); + this.targetAxis.y = this.getNextFloat(this.targetAxis.y); + this.targetAxis.z = this.getNextFloat(this.targetAxis.z); + this.tempParseStr = null; } - } else if (var3 == 2) { - this.targetRoomName = (String)var4; - this.stopLoading(); - } - break; - case 3: - if (var3 == 0) { - var5 = URLPropertyEditor.make((new Property(this, var1, "World URL")).allowSetNull(), "world"); - } else if (var3 == 1) { - var5 = this.targetWorldURL; - } else if (var3 == 2) { - this.targetWorldURL = (URL)var4; - this.stopLoading(); - } - break; - case 4: - if (var3 == 0) { - var5 = BooleanPropertyEditor.make(new Property(this, var1, "Use default coordinates"), "No", "Yes"); - } else if (var3 == 1) { - var5 = new Boolean(this.useDefCoordinates); - } else if (var3 == 2) { - this.useDefCoordinates = (Boolean)var4; - } - break; - case 5: - if (var3 == 0) { - var5 = StringPropertyEditor.make((new Property(this, var1, "Dimension Name")).allowSetNull()); - } else if (var3 == 1) { - if (this.targetDimension == null) { - var5 = ""; + } + + if (this.targetRoomName != null) { + int var5 = this.targetRoomName.lastIndexOf(62); + var4 = this.targetRoomName.lastIndexOf(60); + if (var5 + 1 == this.targetRoomName.length() && var4 >= 0) { + this.targetDimension = this.targetRoomName.substring(var4 + 1, var5); + this.targetRoomName = this.targetRoomName.substring(0, var4); + } + } + + return var1; + } + + private void makeTeleportDialog(URL var1) { + if (this.showDialog) { + GammaFrame var2 = Console.getFrame(); + if (var2 != null && var2.isShowing()) { + this.dialog = new TeleportDialog(var2, this); + } + } + + } + + private void startTeleport() { + if (activeTeleport != null) { + if (activeTeleport.doneCallback != null) { + activeTeleport.doneCallback.teleportStatus("overridden by new teleport", activeTeleport.targetURL); + } + + activeTeleport.stopTeleport((String)null); + } + + activeTeleport = this; + Console.setFreezeFrameEvents(true); + this.done = false; + Console.teleportNotification("", this.targetURL); + if (this.targetWorldURL != null) { + this.makeTeleportDialog(this.targetWorldURL); + World.load(this.targetWorldURL, this, this.forceWorldLoad); + } else { + Pilot var1 = Pilot.getActive(); + World var2; + if (var1 != null && (var2 = var1.getWorld()) != null) { + this.makeTeleportDialog(var2.getSourceURL()); + this.loadedURLSelf(var2, this.targetWorldURL, (String)null); } else { - var5 = new String(this.targetDimension); + this.stopTeleport("Pilot not in a room for intraworld teleport"); + } + } + + } + + private Room stopTeleport(String var1) { + assert(this == activeTeleport); + this.done = true; + activeTeleport = null; + Console.setFreezeFrameEvents(false); + if (this.doneCallback != null) { + this.doneCallback.teleportStatus(var1, this.targetURL); + } + + if (var1 != null && !this.forceNoWorldLoad) { + Console.teleportNotification(var1, this.targetURL); + Console.println(var1); + } + + if (this.dialog != null) { + this.dialog.closeIt(true); + this.dialog = null; + } + + return null; + } + + public synchronized void dialogDone(Object var1, boolean var2) { + if (activeTeleport != null) { + activeTeleport.stopTeleport((String)null); + } + + } + + public static String getReadableNameOfWorld(URL var0) { + String var1 = var0.getAbsolute(); + String var2 = var1; + String var3 = null; + if (var1.startsWith("home:") && var1.length() > 6) { + var2 = var1.substring(var1.charAt(5) == '/' ? 6 : 5); + int var4 = var2.indexOf(47); + if (var4 > 0) { + var3 = var2.substring(0, var4); + if (var2.regionMatches(true, var4 + 1, var2, 0, var4)) { + var2 = var3; + String var5 = WorldsMarkPart.getExternalName(var3); + if (var5 != null) { + var2 = var5; + } + } + } + + int var6 = var2.indexOf(".world"); + if (var6 > 0) { + var2 = var2.substring(0, var6); + } + + var2 = "the " + var2 + " world"; + } + + return var2; + } + + public static String getPackageNameOfWorld(URL var0) { + String var1 = var0.getAbsolute(); + String var3 = null; + if (var1.startsWith("home:") && var1.length() > 6) { + String var2 = var1.substring(var1.charAt(5) == '/' ? 6 : 5); + int var4 = var2.indexOf(47); + if (var4 > 0) { + var3 = var2.substring(0, var4); + } + } + + return var3; + } + + public void loadedURLSelf(URLSelf var1, URL var2, String var3) { + if (activeTeleport != this) { + if (var1 != null) { + var1.decRef(); + } + + } else { + String var4; + if (var3 == null && var1 instanceof World) { + var4 = this.targetRoomName; + if (var4 == null) { + var4 = ((World)var1).getDefaultRoomName(); + } + + Room var7 = ((World)var1).getRoom(var4); + if (var7 == null) { + this.stopTeleport("Error finding room " + this.targetRoomName); + } else if (var7.getVIPOnly() && !((World)var1).getConsole().getVIP()) { + this.stopTeleport("Only VIPs may go there."); + if (this.forceNoWorldLoad) { + Console.println(Console.message("Only-VIPs-there")); + } + + } else { + Console.teleportNotification((String)null, this.targetURL); + Pilot var8 = Pilot.changeActiveRoom(var7); + if (this.targetDimension != null) { + var8.changeChannel(this.targetDimension); + } + + var8.makeIdentity(); + if (this.useDefCoordinates) { + var8.moveTo(var7.getDefaultPosition()).spin(var7.getDefaultOrientationAxis(), var7.getDefaultOrientation()); + } else { + var8.moveTo(this.targetCoords).spin(this.targetAxis, this.targetRot); + } + + this.stopTeleport((String)null); + } + } else { + if (var3 == null) { + var3 = "file " + var2 + " doesn't contain a World"; + var1.decRef(); + } + + var4 = getReadableNameOfWorld(var2); + String var5 = getPackageNameOfWorld(var2); + Object[] var6 = new Object[]{new String(var4)}; + this.stopTeleport(MessageFormat.format(Console.message("cant-teleport"), var6)); + if (var5 != null && !this.forceNoWorldLoad) { + NetUpdate.loadWorld(var5, this.forceWorldLoad); + } + + } + } + } + + public Object properties(int var1, int var2, int var3, Object var4) throws NoSuchPropertyException { + Object var5 = null; + switch(var1 - var2) { + case 0: + if (var3 == 0) { + var5 = Point3PropertyEditor.make(new Property(this, var1, "X, Y, Z")); + } else if (var3 == 1) { + var5 = new Point3(this.targetCoords); + } else if (var3 == 2) { + this.targetCoords.copy((Point3)var4); + } + break; + case 1: + if (var3 == 0) { + var5 = FloatPropertyEditor.make(new Property(this, var1, "Dir")); + } else if (var3 == 1) { + var5 = new Float(this.targetRot); + } else if (var3 == 2) { + this.targetRot = ((Float)var4).floatValue(); + } + break; + case 2: + if (var3 == 0) { + var5 = StringPropertyEditor.make((new Property(this, var1, "Room Name")).allowSetNull()); + } else if (var3 == 1) { + if (this.targetRoomName == null) { + var5 = ""; + } else { + var5 = new String(this.targetRoomName); + } + } else if (var3 == 2) { + this.targetRoomName = (String)var4; + this.stopLoading(); + } + break; + case 3: + if (var3 == 0) { + var5 = URLPropertyEditor.make((new Property(this, var1, "World URL")).allowSetNull(), "world"); + } else if (var3 == 1) { + var5 = this.targetWorldURL; + } else if (var3 == 2) { + this.targetWorldURL = (URL)var4; + this.stopLoading(); + } + break; + case 4: + if (var3 == 0) { + var5 = BooleanPropertyEditor.make(new Property(this, var1, "Use default coordinates"), "No", "Yes"); + } else if (var3 == 1) { + var5 = new Boolean(this.useDefCoordinates); + } else if (var3 == 2) { + this.useDefCoordinates = ((Boolean)var4).booleanValue(); + } + break; + case 5: + if (var3 == 0) { + var5 = StringPropertyEditor.make((new Property(this, var1, "Dimension Name")).allowSetNull()); + } else if (var3 == 1) { + if (this.targetDimension == null) { + var5 = ""; + } else { + var5 = new String(this.targetDimension); + } + } else if (var3 == 2) { + this.targetDimension = (String)var4; + if (this.targetDimension.equals("")) { + this.targetDimension = null; + } + + this.stopLoading(); + } + break; + case 6: + if (var3 == 0) { + var5 = BooleanPropertyEditor.make(new Property(this, var1, "Show dialog"), "No", "Yes"); + } else if (var3 == 1) { + var5 = new Boolean(this.showDialog); + } else if (var3 == 2) { + this.showDialog = ((Boolean)var4).booleanValue(); + } + break; + default: + var5 = super.properties(var1, var2 + 7, var3, var4); + } + + return var5; + } + + public void saveState(Saver var1) throws IOException { + var1.saveVersion(3, classCookie); + super.saveState(var1); + var1.save(this.targetCoords); + var1.saveFloat(this.targetRot); + var1.save(this.targetAxis); + var1.saveString(this.targetRoomName); + URL.save(var1, this.targetWorldURL); + var1.saveBoolean(this.useDefCoordinates); + var1.saveString(this.targetDimension); + } + + public void restoreState(Restorer var1) throws IOException, TooNewException { + int var2 = var1.restoreVersion(classCookie); + switch(var2) { + case 0: + super.restoreState(var1); + this.targetCoords = (Point3)var1.restore(); + this.targetRot = (float)var1.restoreInt(); + this.targetRoomName = var1.restoreString(); + this.targetWorldURL = URL.restore(var1, ".world"); + this.useDefCoordinates = var1.restoreBoolean(); + this.targetDimension = null; + break; + case 1: + case 2: + super.restoreState(var1); + this.targetCoords = (Point3)var1.restore(); + this.targetRot = var1.restoreFloat(); + this.targetAxis = (Point3)var1.restore(); + this.targetRoomName = var1.restoreString(); + this.targetWorldURL = URL.restore(var1, ".world"); + this.useDefCoordinates = var1.restoreBoolean(); + this.targetDimension = null; + break; + case 3: + super.restoreState(var1); + this.targetCoords = (Point3)var1.restore(); + this.targetRot = var1.restoreFloat(); + this.targetAxis = (Point3)var1.restore(); + this.targetRoomName = var1.restoreString(); + this.targetWorldURL = URL.restore(var1, ".world"); + this.useDefCoordinates = var1.restoreBoolean(); + this.targetDimension = var1.restoreString(); + break; + default: + throw new TooNewException(); + } + + if (var2 < 2 && this.targetAxis.x == 0.0F && this.targetAxis.y == 0.0F && this.targetAxis.z == 1.0F) { + this.targetAxis.z = -1.0F; + this.targetRot = 360.0F - this.targetRot; + } + + } + + public String toString() { + return super.toString() + "[" + this.asURL() + "]"; + } + + public String asURL() { + String var1; + if (this.targetWorldURL != null) { + var1 = this.targetWorldURL.getRelativeTo(this) + "#"; + } else { + var1 = "#"; + } + + if (this.targetRoomName != null) { + var1 = var1 + this.targetRoomName; + } + + if (this.targetDimension != null) { + var1 = var1 + "<" + this.targetDimension + ">"; + } + + if (!this.useDefCoordinates) { + var1 = var1 + "@" + this.targetCoords + "," + this.targetRot; + if (this.targetAxis.x != 0.0F || this.targetAxis.y != 0.0F || this.targetAxis.z != 1.0F) { + var1 = var1 + "," + this.targetAxis; } - } else if (var3 == 2) { - this.targetDimension = (String)var4; - if (this.targetDimension.equals("")) { - this.targetDimension = null; - } - - this.stopLoading(); - } - break; - case 6: - if (var3 == 0) { - var5 = BooleanPropertyEditor.make(new Property(this, var1, "Show dialog"), "No", "Yes"); - } else if (var3 == 1) { - var5 = new Boolean(this.showDialog); - } else if (var3 == 2) { - this.showDialog = (Boolean)var4; - } - break; - default: - var5 = super.properties(var1, var2 + 7, var3, var4); - } - - return var5; - } - - public void saveState(Saver var1) throws IOException { - var1.saveVersion(3, classCookie); - super.saveState(var1); - var1.save(this.targetCoords); - var1.saveFloat(this.targetRot); - var1.save(this.targetAxis); - var1.saveString(this.targetRoomName); - URL.save(var1, this.targetWorldURL); - var1.saveBoolean(this.useDefCoordinates); - var1.saveString(this.targetDimension); - } - - public void restoreState(Restorer var1) throws IOException, TooNewException { - int var2 = var1.restoreVersion(classCookie); - switch(var2) { - case 0: - super.restoreState(var1); - this.targetCoords = (Point3)var1.restore(); - this.targetRot = (float)var1.restoreInt(); - this.targetRoomName = var1.restoreString(); - this.targetWorldURL = URL.restore(var1, ".world"); - this.useDefCoordinates = var1.restoreBoolean(); - this.targetDimension = null; - break; - case 1: - case 2: - super.restoreState(var1); - this.targetCoords = (Point3)var1.restore(); - this.targetRot = var1.restoreFloat(); - this.targetAxis = (Point3)var1.restore(); - this.targetRoomName = var1.restoreString(); - this.targetWorldURL = URL.restore(var1, ".world"); - this.useDefCoordinates = var1.restoreBoolean(); - this.targetDimension = null; - break; - case 3: - super.restoreState(var1); - this.targetCoords = (Point3)var1.restore(); - this.targetRot = var1.restoreFloat(); - this.targetAxis = (Point3)var1.restore(); - this.targetRoomName = var1.restoreString(); - this.targetWorldURL = URL.restore(var1, ".world"); - this.useDefCoordinates = var1.restoreBoolean(); - this.targetDimension = var1.restoreString(); - break; - default: - throw new TooNewException(); - } - - if (var2 < 2 && this.targetAxis.x == 0.0F && this.targetAxis.y == 0.0F && this.targetAxis.z == 1.0F) { - this.targetAxis.z = -1.0F; - this.targetRot = 360.0F - this.targetRot; - } - - } - - public String toString() { - return super.toString() + "[" + this.asURL() + "]"; - } - - public String asURL() { - String var1; - if (this.targetWorldURL != null) { - var1 = this.targetWorldURL.getRelativeTo((SuperRoot)this) + "#"; - } else { - var1 = "#"; - } - - if (this.targetRoomName != null) { - var1 = var1 + this.targetRoomName; - } - - if (this.targetDimension != null) { - var1 = var1 + "<" + this.targetDimension + ">"; - } - - if (!this.useDefCoordinates) { - var1 = var1 + "@" + this.targetCoords + "," + this.targetRot; - if (this.targetAxis.x != 0.0F || this.targetAxis.y != 0.0F || this.targetAxis.z != 1.0F) { - var1 = var1 + "," + this.targetAxis; - } - } + } - return var1; - } + return var1; + } } diff -ruN a/1904/NET/worlds/scape/TeleportDialog.java b/1904/NET/worlds/scape/TeleportDialog.java --- a/1904/NET/worlds/scape/TeleportDialog.java 2020-08-06 15:46:10.000000000 -0500 +++ b/1904/NET/worlds/scape/TeleportDialog.java 2023-09-10 16:08:46.000000000 -0500 @@ -6,6 +6,7 @@ import NET.worlds.console.ImageButtonsCallback; import NET.worlds.console.PolledDialog; import NET.worlds.core.IniFile; +import NET.worldsplus.Themer; import java.awt.Component; import java.awt.Rectangle; import java.awt.Window; @@ -16,12 +17,12 @@ public TeleportDialog(Window var1, DialogReceiver var2) { super(var1, var2, Console.message("Teleporting"), true); Rectangle[] var3 = new Rectangle[1]; - int var4 = IniFile.override().getIniInt("teleportCancelX", 61); - int var5 = IniFile.override().getIniInt("teleportCancelY", 24); - int var6 = IniFile.override().getIniInt("teleportCancelW", 84); - int var7 = IniFile.override().getIniInt("teleportCancelH", 20); + int var4 = Themer.override().getIniInt("teleportCancelX", 61); + int var5 = Themer.override().getIniInt("teleportCancelY", 24); + int var6 = Themer.override().getIniInt("teleportCancelW", 84); + int var7 = Themer.override().getIniInt("teleportCancelH", 20); var3[0] = new Rectangle(var4, var5, var6, var7); - String var8 = IniFile.override().getIniString("teleportDlg", Console.message("hangon.gif")); + String var8 = Themer.themer.asset(Console.message("hangon.gif")); this.ib = new ImageButtons(var8, var3, this); this.ready(); } diff -ruN a/1904/NET/worldsplus/ChatSaver.java b/1904/NET/worldsplus/ChatSaver.java --- a/1904/NET/worldsplus/ChatSaver.java 1969-12-31 18:00:00.000000000 -0600 +++ b/1904/NET/worldsplus/ChatSaver.java 2023-09-10 19:59:14.000000000 -0500 @@ -0,0 +1,71 @@ +package NET.worldsplus; + +import NET.worlds.console.Console; +import NET.worlds.core.IniFile; +import NET.worlds.network.URL; +import NET.worlds.scape.Pilot; + +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.text.SimpleDateFormat; +import java.util.Arrays; +import java.util.Date; +import java.util.Vector; + +public class ChatSaver { + + public static ChatSaver chatSaver; + private final static String folder = IniFile.modChatLog().getIniString("Location", "home:chats"); + private final boolean enabled = IniFile.gamma().getIniInt("EnableChatLog", 1) == 1; + public static Vector chatBlacklist = parseChatBlacklist(); + + public ChatSaver() { + if (chatSaver == null) { + System.out.println("Initialized ChatSaver module..."); + if (enabled) { + File fold = new File(URL.make(folder).unalias()); + assert fold.exists() || fold.mkdir(); + } + chatSaver = this; + } + } + + private FileWriter grabWriter(String name) throws IOException { + String cname = stripInvalid(name); + File log = new File(URL.make(folder + "/" + cname + ".log").unalias()); + assert log.exists() || log.createNewFile(); + return new FileWriter(log, true); + } + + private void save(String name, String from, String message) throws IOException { + if (enabled && !chatBlacklist.contains(name)) { + FileWriter writer = grabWriter(name); + writer.write("[" + getCurrentDate() + "] " + from + ": " + message); + writer.write(System.getProperty("line.separator")); + writer.close(); + } + } + + public void saveRoom(String user, String message) throws IOException { + save(Pilot.getActiveRoom().toString(), user, message); + } + + public void saveWhisper(String from, String to, String message) throws IOException { + save(from.equals(Console.getActive().getLongID()) ? to : from, from, message); + } + + public String getCurrentDate() { + return new SimpleDateFormat("dd/MM/yyyy HH:mm:ss").format(new Date()); + } + + private static String stripInvalid(String s) { + return s.replaceAll("/(<[a-zA-Z0-9-_]+>)/i", ""); + } + + private static Vector parseChatBlacklist() { + String s = IniFile.modChatLog().getIniString("ChatBlacklist", "WORLDSMASTER,trade"); + String[] s1 = s.split(","); + return new Vector(Arrays.asList(s1)); + } +} diff -ruN a/1904/NET/worldsplus/IniUpdater.java b/1904/NET/worldsplus/IniUpdater.java --- a/1904/NET/worldsplus/IniUpdater.java 1969-12-31 18:00:00.000000000 -0600 +++ b/1904/NET/worldsplus/IniUpdater.java 2023-09-24 20:46:24.000000000 -0500 @@ -0,0 +1,37 @@ +package NET.worldsplus; + +import NET.worlds.core.IniFile; + +public class IniUpdater { + + private final int releaseVer = 12; + private final int currentVer = IniFile.modPlus().getIniInt("IniVersion", 11); + + public IniUpdater() { + if (currentVer < releaseVer && currentVer != -1) { + switch (currentVer) { + case 11: + // Assuming we are updating from pre-1.7 + IniFile oldPlus = IniFile.ini("Modules"); + IniFile.gamma().setIniInt("DisableTalkAction", oldPlus.getIniInt("DisableTalkAction", 1)); + IniFile.gamma().setIniInt("DisableAction2", oldPlus.getIniInt("DisableAction2", 1)); + IniFile.gamma().setIniInt("AllowSleep", oldPlus.getIniInt("AllowSleep", 1)); + IniFile.gamma().setIniInt("ColorfulTags", oldPlus.getIniInt("ColorfulTags", 0)); + IniFile.gamma().setIniInt("EnableChatLog", oldPlus.getIniInt("LogChats", 1)); + IniFile.modChatLog().setIniString("Location", oldPlus.getIniString("ChatFolder", "home:chats")); + IniFile oldFriendly = IniFile.ini("Friendly"); + IniFile.modPrivacy().setIniInt("WhisperFeedback", oldFriendly.getIniInt("WhisperFeedback", 1)); + IniFile.modPrivacy().setIniInt("TeleportFeedback", oldFriendly.getIniInt("TeleportFeedback", 1)); + IniFile.modPrivacy().setIniInt("WhisperResponse", oldFriendly.getIniInt("WhisperResponse", 1)); + IniFile.modPrivacy().setIniInt("TeleportResponse", oldFriendly.getIniInt("TeleportResponse", 0)); + IniFile.modPrivacy().setIniInt("ShowStatusUpdate", oldFriendly.getIniInt("ShowStatusUpdate", 0)); + IniFile.modPrivacy().setIniInt("WhisperPrivacy", IniFile.gamma().getIniInt("WhisperPrivacy", 0)); + IniFile.modPrivacy().setIniInt("TeleportPrivacy", IniFile.gamma().getIniInt("TeleportPrivacy", 0)); + break; + default: + break; + } + IniFile.modPlus().setIniInt("IniVersion", releaseVer); + } + } +} diff -ruN a/1904/NET/worldsplus/MumbleLink.java b/1904/NET/worldsplus/MumbleLink.java --- a/1904/NET/worldsplus/MumbleLink.java 1969-12-31 18:00:00.000000000 -0600 +++ b/1904/NET/worldsplus/MumbleLink.java 2023-08-21 23:27:18.000000000 -0500 @@ -0,0 +1,15 @@ +package NET.worldsplus; + +import java.net.MalformedURLException; + +public class MumbleLink { + + public MumbleLink() throws MalformedURLException { + initMumble(); + } + + private native void initMumble(); + + public native void updateMumble(String name, float posX, float posY, float posZ, float camX, float camY, float camZ, float direction); + +} diff -ruN a/1904/NET/worldsplus/Themer.java b/1904/NET/worldsplus/Themer.java --- a/1904/NET/worldsplus/Themer.java 1969-12-31 18:00:00.000000000 -0600 +++ b/1904/NET/worldsplus/Themer.java 2023-09-10 19:13:02.000000000 -0500 @@ -0,0 +1,51 @@ +package NET.worldsplus; + +import java.io.File; +import java.io.IOException; +import java.util.Vector; +import NET.worlds.core.IniFile; + +public class Themer { + public static Themer themer; + private static File themedir = null; + private final String theme = IniFile.gamma().getIniString("InterfaceTheme", ""); + private static IniFile override = null; + + public Themer() { + if (themer == null) { + System.out.println("Initialized Themer module..."); + File fold = new File(".\\themes"); + assert fold.exists() || fold.mkdir(); + themedir = fold; + themer = this; + } + } + + public static String[] getThemes() { + Vector themes = new Vector(); + File[] files = themedir.listFiles(); + for (int i = 0; i < files.length; i++) { + if (files[i].isDirectory()) { + themes.add(files[i].getName()); + } + } + String[] outputarr = new String[themes.size()]; + themes.toArray(outputarr); + return outputarr; + } + + public String asset(String s) { + String fasset = ".\\themes\\" + theme + "\\" + s; + if (themedir != null || (new File(fasset)).exists()) + return fasset; + else + return ".\\"+s; + } + + public static IniFile override() { + if (override == null) { + override = new IniFile(themer.asset("override.ini"), "Runtime"); + } + return override; + } +} diff -ruN a/1904/NET/worldsplus/WPlus.java b/1904/NET/worldsplus/WPlus.java --- a/1904/NET/worldsplus/WPlus.java 1969-12-31 18:00:00.000000000 -0600 +++ b/1904/NET/worldsplus/WPlus.java 2023-09-10 19:22:13.000000000 -0500 @@ -0,0 +1,14 @@ +package NET.worldsplus; + +import java.text.SimpleDateFormat; +import java.util.Date; + +public class WPlus { + static final String dateTime = new SimpleDateFormat("ddMMyyyyHHmmss").format(new Date()); + private static final boolean dev = true; + + // Hardcoded for reasons, I SWEAR + public static String getVersion(){ + return dev ? dateTime + "-dev" : "1.8.0"; + } +} diff -ruN a/1920/NET/worlds/console/AboutDialog.java b/1920/NET/worlds/console/AboutDialog.java --- a/1920/NET/worlds/console/AboutDialog.java 2024-01-08 01:46:28.000000000 -0600 +++ b/1920/NET/worlds/console/AboutDialog.java 2023-08-21 23:27:17.000000000 -0500 @@ -3,6 +3,8 @@ import NET.worlds.core.IniFile; import NET.worlds.core.Std; import NET.worlds.network.NetUpdate; +import NET.worldsplus.WPlus; + import java.awt.BorderLayout; import java.awt.Button; import java.awt.Color; @@ -19,78 +21,77 @@ import java.util.Vector; public class AboutDialog extends PolledDialog { - private static final long serialVersionUID = -2810306367601133331L; - public static final String JavaVersion = "1890a40"; - Button okButton = new Button(Console.message("OK")); - private static Font font = new Font(Console.message("ConsoleFont"), 0, 12); - private static Font bfont = new Font(Console.message("ButtonFont"), 0, 12); - String apptitle; - - AboutDialog(String apptitle, Frame frame) { - super(frame, (DialogReceiver)null, Console.message("About") + Std.getProductName(), true); - this.apptitle = apptitle; - this.ready(); - } - - private Component setConstraints(GridBagLayout gbag, Component comp, GridBagConstraints c) { - gbag.setConstraints(comp, c); - return comp; - } - - protected void build() { - this.setBackground(Color.white); - this.setLayout(new BorderLayout()); - this.add("North", new Filler(10, 10)); - this.add("South", new Filler(10, 10)); - this.add("East", new Filler(10, 10)); - this.add("West", new Filler(10, 10)); - GridBagLayout gbag = new GridBagLayout(); - Panel p = new Panel(gbag); - p.setFont(font); - GridBagConstraints c = new GridBagConstraints(); - c.fill = 0; - c.weightx = 1.0; - c.weighty = 1.0; - c.gridwidth = 0; - c.gridheight = 1; - String logo = IniFile.override().getIniString("AboutLogo", Console.message("wlogo.gif")); - p.add(this.setConstraints(gbag, new ImageCanvas(logo), c)); - c.weightx = 0.0; - c.weighty = 0.0; - p.add(this.setConstraints(gbag, new Label(this.apptitle), c)); - if (Gamma.getShaper() != null) { - p.add(this.setConstraints(gbag, new Label(Console.message("about-box-build-date") + " " + Std.getBuildInfo() + ":" + "1890a40"), c)); - } else { - p.add(this.setConstraints(gbag, new Label(Console.message("about-box-rev") + " " + Std.getVersion() + " : " + "1890a40"), c)); - } - - Vector worlds = NetUpdate.aboutWorlds(); - TextArea worldList = new TextArea(10, 40); - worldList.setEditable(false); - p.add(this.setConstraints(gbag, worldList, c)); - Enumeration e = worlds.elements(); - - while(e.hasMoreElements()) { - worldList.append((String)e.nextElement() + "\n"); - } - - p.add(this.setConstraints(gbag, new Label(Console.message("about-box-1")), c)); - p.add(this.setConstraints(gbag, new Label(Console.message("about-box-2")), c)); - this.okButton.setFont(bfont); - p.add(this.setConstraints(gbag, this.okButton, c)); - this.add("Center", p); - } - - public boolean action(Event event, Object what) { - return event.target == this.okButton ? this.done(true) : false; - } - - public boolean keyDown(Event event, int key) { - return key != 27 && key != 10 ? super.keyDown(event, key) : this.done(true); - } - - public void show() { - super.show(); - this.okButton.requestFocus(); - } + Button okButton = new Button(Console.message("OK")); + private static Font font = new Font(Console.message("ConsoleFont"), 0, 12); + private static Font bfont = new Font(Console.message("ButtonFont"), 0, 12); + String apptitle; + + AboutDialog(String var1, Frame var2) { + super(var2, (DialogReceiver)null, Console.message("About") + Std.getProductName(), true); + this.apptitle = var1; + this.ready(); + } + + private Component setConstraints(GridBagLayout var1, Component var2, GridBagConstraints var3) { + var1.setConstraints(var2, var3); + return var2; + } + + protected void build() { + this.setBackground(Color.white); + this.setLayout(new BorderLayout()); + this.add("North", new Filler(10, 10)); + this.add("South", new Filler(10, 10)); + this.add("East", new Filler(10, 10)); + this.add("West", new Filler(10, 10)); + GridBagLayout var1 = new GridBagLayout(); + Panel var2 = new Panel(var1); + var2.setFont(font); + GridBagConstraints var3 = new GridBagConstraints(); + var3.fill = 0; + var3.weightx = 1.0D; + var3.weighty = 1.0D; + var3.gridwidth = 0; + var3.gridheight = 1; + String var4 = IniFile.override().getIniString("AboutLogo", Console.message("wlogo.gif")); + var2.add(this.setConstraints(var1, new ImageCanvas(var4), var3)); + var3.weightx = 0.0D; + var3.weighty = 0.0D; + var2.add(this.setConstraints(var1, new Label(this.apptitle), var3)); + if (Gamma.getShaper() != null) { + var2.add(this.setConstraints(var1, new Label(Console.message("about-box-build-date") + " " + Std.getBuildInfo()), var3)); + } else { + var2.add(this.setConstraints(var1, new Label(Console.message("about-box-rev") + " " + Std.getVersion()), var3)); + } + var2.add(this.setConstraints(var1, new Label("Worlds+ by Wirlaburla " + WPlus.getVersion()), var3)); + + Vector var5 = NetUpdate.aboutWorlds(); + TextArea var6 = new TextArea(10, 40); + var6.setEditable(false); + var2.add(this.setConstraints(var1, var6, var3)); + Enumeration var7 = var5.elements(); + + while(var7.hasMoreElements()) { + var6.append((String)var7.nextElement() + "\n"); + } + + var2.add(this.setConstraints(var1, new Label(Console.message("about-box-1")), var3)); + var2.add(this.setConstraints(var1, new Label(Console.message("about-box-2")), var3)); + this.okButton.setFont(bfont); + var2.add(this.setConstraints(var1, this.okButton, var3)); + this.add("Center", var2); + } + + public boolean action(Event var1, Object var2) { + return var1.target == this.okButton ? this.done(true) : false; + } + + public boolean keyDown(Event var1, int var2) { + return var2 != 27 && var2 != 10 ? super.keyDown(var1, var2) : this.done(true); + } + + public void show() { + super.show(); + this.okButton.requestFocus(); + } } diff -ruN a/1920/NET/worlds/console/ChatSavePart.java b/1920/NET/worlds/console/ChatSavePart.java --- a/1920/NET/worlds/console/ChatSavePart.java 1969-12-31 18:00:00.000000000 -0600 +++ b/1920/NET/worlds/console/ChatSavePart.java 2023-08-21 23:27:17.000000000 -0500 @@ -0,0 +1,49 @@ +package NET.worlds.console; + +import java.io.BufferedReader; +import java.io.FileWriter; +import java.io.IOException; +import java.io.StringReader; + +public class ChatSavePart implements DialogReceiver { + + String chat; + + ChatSavePart(String text) { + this.chat = text; + FileSysDialog fsd = new FileSysDialog(DefaultConsole.getFrame(), this, "Save Chat", 1, "Hypertext Markup|*.html|Plain Text|*.txt", "", false); + } + + public void dialogDone(Object var1, boolean var2) { + if (var2) { + FileSysDialog var3 = (FileSysDialog)var1; + String var4 = var3.fileName(); + this.doSave(var4); + } + } + + public boolean doSave(String path) { + try { + if (path != null) { + FileWriter textWriter = new FileWriter(path); + if (path.endsWith(".html") || path.endsWith(".htm")) { + BufferedReader bufReader = new BufferedReader(new StringReader(this.chat)); + String line = null; + while( (line = bufReader.readLine()) != null ) + { + textWriter.write(line + "
"); + } + } else { + textWriter.write(this.chat); + } + textWriter.close(); + Console.println("Saved chat!"); + return true; + } else return false; + } catch (IOException var5) { + Console.println("Failed to save chat: " + var5.getMessage()); + return false; + } + } + +} diff -ruN a/1920/NET/worlds/console/DefaultConsole.java b/1920/NET/worlds/console/DefaultConsole.java --- a/1920/NET/worlds/console/DefaultConsole.java 2024-01-08 01:46:30.000000000 -0600 +++ b/1920/NET/worlds/console/DefaultConsole.java 2023-08-21 23:27:17.000000000 -0500 @@ -1,6 +1,12 @@ +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by Fernflower decompiler) +// + package NET.worlds.console; import NET.worlds.core.ArchiveMaker; +import NET.worlds.core.Debug; import NET.worlds.core.IniFile; import NET.worlds.core.Std; import NET.worlds.network.Galaxy; @@ -31,6 +37,8 @@ import NET.worlds.scape.URLPropertyEditor; import NET.worlds.scape.VehicleShape; import NET.worlds.scape.World; +import NET.worldsplus.ChatSaver; + import java.awt.BorderLayout; import java.awt.CardLayout; import java.awt.CheckboxMenuItem; @@ -46,6 +54,7 @@ import java.awt.Menu; import java.awt.MenuItem; import java.awt.Panel; +import java.awt.Point; import java.awt.PopupMenu; import java.awt.Rectangle; import java.awt.Toolkit; @@ -66,1992 +75,2081 @@ import java.util.Vector; public class DefaultConsole extends Console implements DialogReceiver, ImageButtonsCallback, RemoteFileConst { - MenuItem aboutItem; - MenuItem statisticsItem; - MenuItem upgradeItem; - MenuItem channelItem; - MenuItem infoItem; - MenuItem sleepItem; - MenuItem helpItem; - MenuItem gettingStartedItem; - MenuItem serverItem; - MenuItem numVisItem; - MenuItem checkAccountItem; - MenuItem becomeVIPItem; - MenuItem toggleVoiceChatItem; - MenuItem chatItem; - MenuItem shaperHelpItem; - MenuItem inventoryItem; - MenuItem checkInventoryItem; - MenuItem bankItem; - MenuItem ubuItem; - MenuItem proxyServerItem; - MenuItem musicManItem; - MenuItem condenseItem; - MenuItem expandItem; - MenuItem i18nTest; - MenuItem currentLang; - Menu switchLang; - Vector downItems = null; - Vector langItems = null; - Vector fontItems = null; - static final String LANGUAGES = "languages.lst"; - static final String FONTS = "fonts.lst"; - Vector viewItems = null; - Vector camSpeedItems = null; - CheckboxMenuItem currentViewItem; - CheckboxMenuItem currentCamSpeedItem; - ImageButtons driveButton; - ImageButtons quitButton; - ImageButtons exploreButton; - ImageButtons menuButtons; - ImageButtons adCubeButton; - String defaultAd = IniFile.override().getIniString("defaultAd", "home:adworlds.cmp"); - AdPart ad; - ColorFiller adFiller; - ChatPart chat; - RenderCanvas render; - Panel renderAndUniverse; - UniversePanel universe; - CardLayout renderCard; - InventoryPart inventory; - WorldsMarkPart marks; - FriendsListPart friends; - ActionsPart actions; - MuteListPart mutes; - MapPart map; - SavedAvPart savedAvs; - private static Font font = new Font(Console.message("ConsoleFont"), 0, 12); - private static Font mfont = new Font(Console.message("MenuFont"), 0, 12); - private static int chatLines = IniFile.gamma().getIniInt("ChatLines", 6); - private static int maxWebSize = 540; - CDControl cdcontrol; - boolean playedCD; - MenuItem cdPlayerItem; - MenuItem volumeItem; - MenuItem graphicsItem; - MenuItem nametagItem; - MenuItem chatBoxItem; - MenuItem broadcastToRoom; - MenuItem broadcastToAll; - MenuItem bootSomeone; - CheckboxMenuItem orthographicViewItem; - MenuItem recorderPlayItem; - MenuItem recorderRecItem; - MenuItem recorderStopItem; - boolean universeMode; - private static final int[] menuButtonHeights = new int[]{23, 21, 21, 21, 21, 21, 25, -29}; - private Vector viewNames; - private Vector speedNames; - private static final int HELP = 0; - private static final int OPTIONS = 1; - private static final int WORLDSMAIL = 2; - private static final int WORLDSMARK = 3; - private static final int LETS = 4; - private static final int ACTIONS = 5; - private static final int VIP = 6; - static String loadingString = Console.message("Loading"); - static String arrowKeyMsg = Console.message("Use-arrow-keys"); - String statusMessage; - String overrideMessage; - String lastStatus; - int lastUpdateTime; - boolean wasTeleporting; - private int lastVMCheck; - private int lastVMBigWarning; - Component bottom; - Component top; - Label status; - Label yourName; - static String[] lNames = lpList(); - static int lLength; - static MenuItem[] lLangs; - static Locale[] newLocale; - static String[][] lCodes; - Vector lList; - Vector sList; - int[] lSizes; - int dLength; - MenuItem[] dLangs; - Locale[] newdLocale; - Vector flList; - Vector fsList; - int[] fSizes; - int fLength; - MenuItem[] dFonts; - Locale[] newfLocale; - static boolean wasDelta; - static boolean doDrive; - Panel mapPanel; - private static String signIn; - private static String signOut; - private static String signingIn; - private static String noMultiUser; - private static String enable3D; - private static String disable3D; - private static String showTags; - private static String hideTags; - private static String enableClassicChat; - private static String disableClassicChat; - private static String configureChat; - Menu chatLogMenu; - AvMenu avatarMenu; - private int chooseView; - private int chooseCamSpeed; - private static String sleepStatus; - OkCancelDialog reloginDialog; - private Object nextAvatarMutex; - private URL nextAvatar; - private CheckboxMenuItem nextAvatarItem; - private CheckboxMenuItem curAvatarItem; - private static String lastWorldName; - private static String lowVMMsg; - private boolean showedMidWarn; - private static boolean startupMemCheck; - public static int physMem; - protected URL avatarURL; - private static Object classCookie; - - static { - lLength = lNames.length; - lLangs = new MenuItem[lLength]; - newLocale = new Locale[lLength]; - lCodes = new String[lLength][2]; - signIn = Console.message("Sign-In"); - signOut = Console.message("Sign-Out"); - signingIn = Console.message("Signing-In"); - noMultiUser = Console.message("Network"); - enable3D = Console.message("Enable3D"); - disable3D = Console.message("Disable3D"); - showTags = Console.message("ShowNametags"); - hideTags = Console.message("HideNametags"); - enableClassicChat = Console.message("EnableClassicChat"); - disableClassicChat = Console.message("DisableClassicChat"); - configureChat = Console.message("Config-Chat"); - sleepStatus = Console.message("Sleeping"); - lastWorldName = ""; - lowVMMsg = Console.message("Low-virt"); - startupMemCheck = true; - classCookie = new Object(); - } - - public UniversePanel getUniversePanel() { - return this.universe; - } - - public void printLine(String msg) { - this.chat.println(msg); - super.printLine(msg); - } - - protected void printWhisperFrom(String from, String msg) { - WhisperManager.whisperManager().printFrom(from, msg); - } - - protected void printWhisperTo(String to, String msg) { - WhisperManager.whisperManager().printTo(to, msg); - } - - protected void startWhisperingTo(String to) { - WhisperManager.whisperManager().startTo(to); - } - - public DefaultConsole() { - this.ad = new AdPart(URL.make(this.defaultAd)); - this.chat = new ChatPart(); - this.render = new RenderCanvas(this, new Dimension(560, 360)); - this.inventory = new InventoryPart(); - this.marks = new WorldsMarkPart(); - this.friends = new FriendsListPart(); - this.actions = new ActionsPart(); - this.mutes = new MuteListPart(); - this.map = new MapPart(); - this.savedAvs = new SavedAvPart(); - this.statusMessage = arrowKeyMsg; - this.lastStatus = ""; - this.lastUpdateTime = 0; - this.wasTeleporting = false; - this.status = new UnpaddedLabel("", 2); - this.yourName = new UnpaddedLabel("", 0); - this.lList = new Vector(); - this.sList = new Vector(); - this.lSizes = new int[10]; - this.dLength = this.dpList(this.lList, this.sList, this.lSizes); - this.dLangs = this.dLength == 0 ? null : new MenuItem[this.dLength]; - this.newdLocale = this.dLength == 0 ? null : new Locale[this.dLength]; - this.flList = new Vector(); - this.fsList = new Vector(); - this.fSizes = new int[10]; - this.fLength = this.fpList(this.flList, this.fsList, this.fSizes); - this.dFonts = this.fLength == 0 ? null : new MenuItem[this.fLength]; - this.newfLocale = this.fLength == 0 ? null : new Locale[this.fLength]; - this.chooseView = -1; - this.chooseCamSpeed = -1; - this.nextAvatarMutex = new Object(); - this.init(); - this.loadViewNames(); - this.speedNames = new Vector(); - this.speedNames.addElement(new CameraSpeed("Slow", 1)); - this.speedNames.addElement(new CameraSpeed("Medium", 2)); - this.speedNames.addElement(new CameraSpeed("Fast", 3)); - } - - public void loadViewNames() { - this.viewNames = new Vector(); - this.viewNames.addElement(new CameraView("First-person", 1)); - this.viewNames.addElement(new CameraView("Low-first-person", 2)); - this.viewNames.addElement(new CameraView("Waist", 3)); - this.viewNames.addElement(new CameraView("Shoulder", 4)); - this.viewNames.addElement(new CameraView("Head", 5)); - this.viewNames.addElement(new CameraView("Overhead", 6)); - this.viewNames.addElement(new CameraView("Behind", 7)); - this.viewNames.addElement(new CameraView("Wide-shot", 8)); - if (Gamma.getShaper() != null) { - this.viewNames.addElement(new CameraView("Orthographic", 9)); - } - - } - - public void setOrthoEnabled(boolean in) { - if (this.orthographicViewItem != null) { - this.orthographicViewItem.setEnabled(in); - } - - } - - public void loadInit() { - super.loadInit(); - } - - public void removeUseArrowStatusMsg() { - if (this.statusMessage == arrowKeyMsg) { - this.statusMessage = ""; - } - - } - - public void overrideStatusMsg(String msg) { - synchronized(this.status) { - this.overrideMessage = msg; - if (msg != null) { - this.status.setText(msg); - } else { - this.status.setText(this.lastStatus); - } - - } - } - - public String message(String Id, Locale currentLocale) { - Locale.setDefault(currentLocale); - Console.println(currentLocale.getDisplayName()); - - try { - ResourceBundle messages = ResourceBundle.getBundle("MessagesBundle", currentLocale); - return messages.getString(Id); - } catch (MissingResourceException var4) { - return "NO MESSAGE for " + Id; - } - } - - private void init() { - this.addPart(this.render); - this.addPart(this.chat); - this.addPart(this.inventory); - this.addPart(this.marks); - this.addPart(this.friends); - this.addPart(this.actions); - this.addPart(this.mutes); - this.addPart(this.ad); - this.addPart(this.map); - this.addPart(this.savedAvs); - Panel drivePanel = new Panel(new FlowLayout(1, 0, 0)); - String driveGif = IniFile.override().getIniString("driveGif", "drive.gif"); - this.addPart(this.driveButton = new ImageButtons(driveGif, 81, 19, this)); - String quitGif = IniFile.override().getIniString("quitGif", Console.message("quit.gif")); - this.addPart(this.quitButton = new ImageButtons(quitGif, 65, 19, this)); - String exploreGif = IniFile.override().getIniString("exploreGif", Console.message("explore.gif")); - this.addPart(this.exploreButton = new ImageButtons(exploreGif, 98, 22, this)); - drivePanel.add(this.driveButton); - this.driveButton.setDownUpHandler(new ImageButtonsCallback() { - public Object imageButtonsCallback(Component who, int which) { - if (which != -1) { - DefaultConsole.this.startDrive(); - } else { - DefaultConsole.this.driveButton.drawDown(); - } - - return this; - } - }); - Panel mid = new Panel(); - mid.setLayout(new GridLayout(1, 3)); - int bgR = IniFile.override().getIniInt("uiBackgroundRed", 49); - int bgG = IniFile.override().getIniInt("uiBackgroundGreen", 0); - int bgB = IniFile.override().getIniInt("uiBackgroundBlue", 255); - mid.setBackground(new Color(bgR, bgG, bgB)); - mid.add(this.yourName); - mid.add(drivePanel); - mid.add(this.status); - this.chat.line.setBackground(Color.black); - this.chat.line.setForeground(Color.white); - this.chat.line.setFont(font); - Panel chatter = new InsetPanel(new BorderLayout(0, 3), 0, 0, 3, 0); - chatter.add("North", mid); - chatter.add("Center", this.chat.listen.getComponent()); - chatter.add("South", this.chat.line); - this.chat.listen.setBackground(Color.black); - this.chat.listen.setForeground(Color.white); - this.chat.listen.setFont(font); - Panel p = new Panel(new BorderLayout()); - new Panel(new BorderLayout()); - Panel r = new Panel(new BorderLayout()); - Panel s = new Panel(new BorderLayout()); - ColorFiller rtBlack = new ColorFiller(65, 19); - rtBlack.setBackground(new Color(bgR, bgG, bgB)); - r.add("West", this.quitButton); - r.add("East", rtBlack); - int bgbR = IniFile.override().getIniInt("uiBackground2Red", 0); - int bgbG = IniFile.override().getIniInt("uiBackground2Green", 0); - int bgbB = IniFile.override().getIniInt("uiBackground2Blue", 0); - s.add("North", r); - s.add("Center", this.ad); - if (chatLines > 6) { - int h = chatLines * this.chat.listen.getComponent().getFontMetrics(this.chat.listen.getFont()).getHeight(); - h -= 96; - if (h > 0) { - this.adFiller = new ColorFiller(130, h); - this.adFiller.setBackground(new Color(bgbR, bgbG, bgbB)); - s.add("South", this.adFiller); - } - } - - p.add("West", s); - this.mapPanel = new Panel(new BorderLayout()); - this.mapPanel.add("Center", this.map); - this.mapPanel.setBackground(Color.black); - r = new Panel(new BorderLayout()); - ColorFiller qBlue = new ColorFiller(60, 19); - qBlue.setBackground(new Color(bgR, bgG, bgB)); - r.add("North", qBlue); - ColorFiller qBlack = new ColorFiller(60, 3); - qBlack.setBackground(new Color(bgbR, bgbG, bgbB)); - r.add("South", qBlack); - Panel q = new Panel(new BorderLayout()); - q.add("East", this.exploreButton); - q.add("West", r); - this.mapPanel.add("North", q); - p.add("East", this.mapPanel); - p.add("Center", chatter); - this.bottom = p; - this.renderCard = new CardLayout(); - this.renderAndUniverse = new Panel(this.renderCard); - this.renderAndUniverse.add("render", this.render); - Panel p = new InsetPanel(new BorderLayout(), 3, 3, 0, 0); - p.add("Center", this.renderAndUniverse); - int bgbR = IniFile.override().getIniInt("uiBackground3Red", 0); - int bgbG = IniFile.override().getIniInt("uiBackground3Green", 0); - int bgbB = IniFile.override().getIniInt("uiBackground3Blue", 0); - rtBlack = new ColorFiller(97, 1); - rtBlack.setBackground(new Color(bgbR, bgbG, bgbB)); - Panel rt = new Panel(new QuantizedStackedLayout(rtBlack)); - String panelGif = IniFile.override().getIniString("rtPanel", Console.message("rtpanel.gif")); - this.addPart(this.menuButtons = new ImageButtons(panelGif, 97, menuButtonHeights, this)); - rt.add(rtBlack); - rt.add(this.menuButtons); - rt.add(this.friends); - p.add("East", rt); - this.top = p; - } - - public void relayoutMap() { - this.mapPanel.invalidate(); - this.mapPanel.validate(); - this.mapPanel.doLayout(); - this.mapPanel.repaint(); - } - - public void startDrive() { - this.statusMessage = Console.message("Drag-mouse"); - doDrive = true; - Window.makeJavaReleaseCapture(); - } - - public void setOnlineState(boolean enabled, boolean online) { - synchronized(this) { - if (this.serverItem != null) { - this.serverItem.setEnabled(enabled); - if (!enabled) { - Galaxy g = this.getGalaxy(); - if (g != null && !g.isAnonymous()) { - this.serverItem.setLabel(signingIn); - } else { - this.serverItem.setLabel(noMultiUser); - } - } else if (online) { - this.serverItem.setLabel(signOut); - } else { - this.serverItem.setLabel(signIn); - } - } - - } - } - - private void handleNametagsItem() { - if (IniFile.gamma().getIniInt("SHOWNAMETAGS", 1) == 0) { - IniFile.gamma().setIniInt("SHOWNAMETAGS", 1); - this.nametagItem.setLabel(hideTags); - } else { - IniFile.gamma().setIniInt("SHOWNAMETAGS", 0); - this.nametagItem.setLabel(showTags); - } - - new OkCancelDialog(getFrame(), (DialogReceiver)null, Console.message("Alert"), (String)null, Console.message("OK"), Console.message("Change-exit"), true); - } - - private void handleGraphicsItem() { - if (IniFile.gamma().getIniInt("UserEnabled3DHardware", 0) == 0) { - IniFile.gamma().setIniInt("UserEnabled3DHardware", 1); - this.graphicsItem.setLabel(disable3D); - } else { - IniFile.gamma().setIniInt("UserEnabled3DHardware", 0); - this.graphicsItem.setLabel(enable3D); - } - - new OkCancelDialog(getFrame(), (DialogReceiver)null, Console.message("Alert"), (String)null, Console.message("OK"), Console.message("Change-exit"), true); - } - - private void handleChatBoxItem() { - if (IniFile.gamma().getIniInt("classicChatBox", 1) == 0) { - IniFile.gamma().setIniInt("classicChatBox", 1); - this.chatBoxItem.setLabel(disableClassicChat); - } else { - IniFile.gamma().setIniInt("classicChatBox", 0); - this.chatBoxItem.setLabel(enableClassicChat); - } - - new OkCancelDialog(getFrame(), (DialogReceiver)null, Console.message("Alert"), (String)null, Console.message("OK"), Console.message("Change-exit"), true); - } - - public AvMenu getAvatarMenu() { - return this.avatarMenu; - } - - public void inventoryChanged() { - super.inventoryChanged(); - if (this.avatarMenu != null) { - this.avatarMenu.buildSpecialGuestMenu(); - } - - } - - public void setMenusWRTVIP() { - if (this.avatarMenu != null) { - this.avatarMenu.setEnabled(this.getVIP()); - this.avatarMenu.customize.setEnabled(this.getVIP()); - } - - if (this.savedAvs != null) { - this.savedAvs.setEnabled(this.getVIP()); - } - - if (this.chatLogMenu != null) { - this.chatLogMenu.setEnabled(this.getVIP()); - } - - if (this.toggleVoiceChatItem != null) { - this.toggleVoiceChatItem.setLabel(this.getVIP() && VoiceChat.voiceChatEnabled ? Console.message("Reject-Voice") : Console.message("Accept-Voice")); - this.toggleVoiceChatItem.setEnabled(this.getVIP() && VoiceChat.voiceChatAvailable()); - } - - if (this.becomeVIPItem != null) { - this.becomeVIPItem.setLabel(vip > 0 ? (vip > 1 ? Console.message("Youre-a-VIP") : Console.message("Become-full-VIP")) : Console.message("Become-VIP")); - } - - if (this.numVisItem != null) { - this.numVisItem.setEnabled(this.getVIP()); - } - - } - - public void addBroadcastMenu() { - if (this.bootSomeone == null) { - if (IniFile.gamma().getIniInt("Broadcast", 0) != 0) { - Menu menu = new Menu(Console.message("Broadcast")); - menu.add(this.broadcastToRoom = new MenuItem(Console.message("Users"))); - menu.add(this.broadcastToAll = new MenuItem(Console.message("All-users"))); - this.addMenuItem(menu, "Options"); - } - - this.bootSomeone = new MenuItem(Console.message("Boot-user")); - this.addMenuItem(this.bootSomeone, "Options"); - } - - } - - private Menu updateChatLogMenu() { - if (this.chatLogMenu == null) { - this.chatLogMenu = new Menu(Console.message("View-Chat")); - } else { - this.chatLogMenu.removeAll(); - } - - ActionListener logAction = new ActionListener() { - public void actionPerformed(ActionEvent e) { - (new SendURLAction("file:" + e.getActionCommand())).startBrowser(); - } - }; - String[] list = this.logList(); - MenuItem item = null; - - for(int i = 0; i < list.length; ++i) { - int si = list[i].indexOf(".glog.html"); - if (si > 6) { - Object[] arguments = new Object[]{new String(list[i].substring(5, si))}; - item = new MenuItem(MessageFormat.format(Console.message("Chat-with"), arguments)); - } else { - if (si <= 0) { - continue; - } - - item = new MenuItem(Console.message("General-chat")); - } - - item.setActionCommand(list[i]); - item.addActionListener(logAction); - this.chatLogMenu.add(item); - } - - return this.chatLogMenu; - } - - private String[] logList() { - File dir = new File("."); - FilenameFilter f = new FilenameFilter() { - public boolean accept(File dir, String name) { - return name.startsWith("chat.") && name.endsWith(".glog.html"); - } - }; - return dir.list(f); - } - - private static String[] lpList() { - File dir = new File("."); - FilenameFilter f = new FilenameFilter() { - public boolean accept(File dir, String name) { - return name.startsWith("MessagesBundle") && name.endsWith(".properties"); - } - }; - String[] list = dir.list(f); - Collator sortCollator = Collator.getInstance(); - sortStrings(sortCollator, list); - return list; - } - - private int dpList(Vector lList, Vector sList, int[] lSizes) { - String err = NetUpdate.getLanguages(URL.make(NetUpdate.getUpgradeServerURL() + "I18N/" + "languages.lst"), lList, sList, lSizes); - if (err != null) { - System.out.println(err); - return 0; - } else { - return lList.size(); - } - } - - private int fpList(Vector lList, Vector sList, int[] lSizes) { - String err = NetUpdate.getLanguages(URL.make(NetUpdate.getUpgradeServerURL() + "I18N/" + "fonts.lst"), lList, sList, lSizes); - if (err != null) { - System.out.println(err); - return 0; - } else { - return lList.size(); - } - } - - public static void sortStrings(Collator collator, String[] words, Locale[] Locales, String[][] Codes) { - for(int i = 0; i < words.length; ++i) { - for(int j = i + 1; j < words.length; ++j) { - if (collator.compare(words[i], words[j]) > 0) { - String tmp = words[i]; - Locale ltmp = Locales[i]; - String c0 = Codes[i][0]; - String c1 = Codes[i][1]; - words[i] = words[j]; - Locales[i] = Locales[j]; - Codes[i][0] = Codes[j][0]; - Codes[i][1] = Codes[j][1]; - words[j] = tmp; - Locales[j] = ltmp; - Codes[j][0] = c0; - Codes[j][1] = c1; - } - } - } - - } - - public static void sortStrings(Collator collator, String[] words, Locale[] Locales, Vector CodeL, Vector CodeS) { - for(int i = 0; i < words.length; ++i) { - for(int j = i + 1; j < words.length; ++j) { - if (collator.compare(words[i], words[j]) > 0) { - String tmp = words[i]; - Locale ltmp = Locales[i]; - String c0 = (String)CodeL.elementAt(i); - String c1 = (String)CodeS.elementAt(i); - words[i] = words[j]; - Locales[i] = Locales[j]; - CodeL.setElementAt((String)CodeL.elementAt(j), i); - CodeS.setElementAt((String)CodeS.elementAt(j), i); - words[j] = tmp; - Locales[j] = ltmp; - CodeL.setElementAt(c0, j); - CodeS.setElementAt(c1, j); - } - } - } - - } - - public static void sortStrings(Collator collator, String[] words) { - for(int i = 0; i < words.length; ++i) { - for(int j = i + 1; j < words.length; ++j) { - if (collator.compare(words[i], words[j]) > 0) { - String tmp = words[i]; - words[i] = words[j]; - words[j] = tmp; - } - } - } - - } - - public void activate(Container c) { - super.activate(c); - c.setBackground(Color.black); - c.setForeground(Color.white); - c.setLayout(new BorderLayout()); - c.add("Center", this.top); - c.add("South", this.bottom); - this.chat.line.setBackground(Color.white); - this.chat.line.setForeground(Color.black); - boolean useShaper = Gamma.getShaper() != null; - if (useShaper) { - this.shaperHelpItem = this.addMenuItem(Console.message("using-shaper"), "Help"); - } - - if (NetUpdate.getInfoURL() != null) { - this.helpItem = this.addMenuItem(Console.message("Help-Contents"), "Help"); - this.infoItem = this.addMenuItem(Console.message("Latest-info"), "Help"); - } - - Object[] arguments = new Object[]{new String(Std.getProductName())}; - this.aboutItem = this.addMenuItem(MessageFormat.format(Console.message("About-product"), arguments), "Help"); - int cameraMode = IniFile.gamma().getIniInt("CAM_MODE", 7); - int cameraSpeed = IniFile.gamma().getIniInt("CAM_SPEED", 3); - if (!useShaper && cameraMode == 9) { - cameraMode = 7; - } - - this.pilot.setOutsideCameraMode(cameraMode, cameraSpeed); - Menu viewMenu = new Menu(Console.message("Change-View")); - this.addMenuItem(viewMenu, "Options"); - MenuItem cameraVMenu = new MenuItem(Console.message("CAMERA-VIEW")); - cameraVMenu.setFont(mfont); - viewMenu.add(cameraVMenu); - this.viewItems = new Vector(); - - for(int i = 0; i < this.viewNames.size(); ++i) { - CameraView currView = (CameraView)this.viewNames.elementAt(i); - CheckboxMenuItem item = new CheckboxMenuItem(" " + Console.message(currView.viewName), cameraMode == currView.viewID); - if (cameraMode == currView.viewID) { - this.currentViewItem = item; - } - - item.setFont(mfont); - viewMenu.add(item); - this.viewItems.addElement(item); - if (currView.viewName == "Orthographic") { - this.orthographicViewItem = item; - } - } - - viewMenu.addSeparator(); - MenuItem cameraSMenu = new MenuItem(Console.message("CAMERA-SPEED")); - cameraSMenu.setFont(mfont); - viewMenu.add(cameraSMenu); - this.camSpeedItems = new Vector(); - - for(int i = 0; i < this.speedNames.size(); ++i) { - CameraSpeed currSpeed = (CameraSpeed)this.speedNames.elementAt(i); - CheckboxMenuItem item = new CheckboxMenuItem(" " + Console.message(currSpeed.speedName), currSpeed.speedID == cameraSpeed); - if (currSpeed.speedID == cameraSpeed) { - this.currentCamSpeedItem = item; - } - - item.setFont(mfont); - viewMenu.add(item); - this.camSpeedItems.addElement(item); - } - - this.becomeVIPItem = this.addMenuItem(vip == 1 ? Console.message("Become-full-VIP") : Console.message("Become-VIP"), "VIP"); - this.addMenuItem(this.avatarMenu = new AvMenu(this, this.lastPilotRequested), "VIP"); - this.addMenuItem(this.savedAvs, "VIP"); - this.addMenuItem(this.avatarMenu.customize, "VIP"); - this.toggleVoiceChatItem = this.addMenuItem(Console.message("Enable-Voice"), "VIP"); - this.toggleVoiceChatItem.setEnabled(false); - this.numVisItem = this.addMenuItem(Console.message("Num-Visible"), "VIP"); - if (NetUpdate.isInternalVersion() || IniFile.gamma().getIniInt("EnableTrading", 0) == 1) { - this.inventoryItem = this.addMenuItem("My Stuff", "VIP"); - this.checkInventoryItem = this.addMenuItem("Check Inventory", "VIP"); - } - - if (NetUpdate.isInternalVersion() || IniFile.gamma().getIniInt("EnableBank", 0) == 1) { - this.bankItem = this.addMenuItem("Access Bank Account", "VIP"); - } - - if (IniFile.gamma().getIniInt("EnableUBU", 0) == 1) { - this.ubuItem = this.addMenuItem("U-B-U Vanatar", "VIP"); - } - - this.setMenusWRTVIP(); - this.proxyServerItem = this.addMenuItem(Console.message("Proxy-Server"), "Options"); - this.checkAccountItem = this.addMenuItem(Console.message("Account-Info"), "Options"); - if (useShaper) { - this.statisticsItem = this.addMenuItem(Console.message("Display-Stat"), "Options"); - } - - this.upgradeItem = this.addMenuItem(Console.message("Upgrade-Now"), "Options"); - if (useShaper) { - this.channelItem = this.addMenuItem(Console.message("Dimension-Sel"), "Options"); - } - - this.serverItem = this.addMenuItem(signIn, "Options"); - this.setOnlineState(this.galaxy.getOnlineEnabled(), this.galaxy.getOnline()); - Menu languageMenu; - if (IniFile.gamma().getIniInt("recorderEnabled", 1) == 1) { - languageMenu = new Menu(Console.message("Recorder")); - this.addMenuItem(languageMenu, "Options"); - this.recorderRecItem = new MenuItem(Console.message("Record")); - languageMenu.add(this.recorderRecItem); - this.recorderStopItem = new MenuItem(Console.message("Stop")); - languageMenu.add(this.recorderStopItem); - this.recorderPlayItem = new MenuItem(Console.message("Play")); - languageMenu.add(this.recorderPlayItem); - } - - if (NetUpdate.isInternalVersion()) { - languageMenu = new Menu(Console.message("Languages")); - this.addMenuItem(languageMenu, "Options"); - Menu downloadFont = new Menu(Console.message("Download-Font")); - languageMenu.add(downloadFont); - downloadFont.setFont(mfont); - this.fontItems = new Vector(); - - for(int i = 0; i < this.fLength; ++i) { - if (this.flList.elementAt(i) != null) { - String code; - if (this.fsList.elementAt(i) != null) { - this.newfLocale[i] = new Locale((String)this.flList.elementAt(i), (String)this.fsList.elementAt(i)); - code = (String)this.flList.elementAt(i) + "_" + (String)this.fsList.elementAt(i); - if (code.equals(Console.message(code))) { - this.dFonts[i] = new MenuItem(this.newfLocale[i].getDisplayName()); - } else { - this.dFonts[i] = new MenuItem(Console.message(code)); - } - } else { - code = (String)this.flList.elementAt(i); - if (code.equals(Console.message(code))) { - this.dFonts[i] = new MenuItem((String)this.flList.elementAt(i)); - } else { - this.dFonts[i] = new MenuItem(Console.message(code)); - } - } - - this.dFonts[i].setFont(mfont); - downloadFont.add(this.dFonts[i]); - this.fontItems.addElement(this.dFonts[i]); - } - } - - Menu downloadLanguage = new Menu(Console.message("Download-Language")); - languageMenu.add(downloadLanguage); - downloadLanguage.setFont(mfont); - this.downItems = new Vector(); - String[] sLangs = new String[this.dLength]; - - String lName; - for(int i = 0; i < this.dLength; ++i) { - if (this.lList.elementAt(i) != null) { - this.newdLocale[i] = new Locale((String)this.lList.elementAt(i), (String)this.sList.elementAt(i)); - String lName0; - if (i > 0) { - Locale locale0 = new Locale((String)this.lList.elementAt(i - 1), (String)this.sList.elementAt(i - 1)); - lName0 = locale0.getDisplayName(); - } else { - lName0 = this.newdLocale[i].getDisplayName(); - } - - String lName1 = this.newdLocale[i].getDisplayName(); - lName1 = lName1.substring(0, lName1.indexOf(40) - 1); - String lName; - if (i < this.dLength - 1) { - Locale locale2 = new Locale((String)this.lList.elementAt(i + 1), (String)this.sList.elementAt(i + 1)); - lName = locale2.getDisplayName(); - lName = lName.substring(0, lName.indexOf(40) - 1); - if (lName.equals(lName1)) { - lName = this.newdLocale[i].getDisplayName(); - } else { - lName = lName1; - } - } else if (i == this.dLength - 1) { - lName0 = lName0.substring(0, lName0.indexOf(40) - 1); - if (lName1.equals(lName0)) { - lName = this.newdLocale[i].getDisplayName(); - } else { - lName = lName1; - } - } else if (sLangs[i - 1].equals(lName1)) { - lName = this.newdLocale[i].getDisplayName(); - } else { - lName = lName1; - } - - String code = (String)this.lList.elementAt(i) + "_" + (String)this.sList.elementAt(i); - if (code.equals(Console.message(code))) { - sLangs[i] = lName; - } else { - sLangs[i] = Console.message(code); - } - } - } - - Collator sortCollator = Collator.getInstance(); - sortStrings(sortCollator, sLangs, this.newdLocale, this.lList, this.sList); - - for(int i = 0; i < this.dLength; ++i) { - this.dLangs[i] = new MenuItem(sLangs[i]); - this.dLangs[i].setFont(mfont); - downloadLanguage.add(this.dLangs[i]); - this.downItems.addElement(this.dLangs[i]); - } - - Menu switchLang = new Menu(Console.message("Switch-Language")); - languageMenu.add(switchLang); - switchLang.setFont(mfont); - this.langItems = new Vector(); - - int i; - for(int i = 0; i < lLength; ++i) { - i = lNames[i].indexOf(95); - if (i < 0) { - lCodes[i][0] = "en"; - lCodes[i][1] = "US"; - } else { - int ipr = lNames[i].lastIndexOf(46); - if (ipr < 0) { - ipr = 0; - } - - lCodes[i][0] = lNames[i].substring(i + 1, i + 3); - if (ipr > i + 4) { - lCodes[i][1] = lNames[i].substring(i + 4, ipr); - } else { - lCodes[i][1] = lCodes[i][0].toUpperCase(); - } - } - } - - String[] slLangs = new String[lLength]; - - for(i = 0; i < lLength; ++i) { - newLocale[i] = new Locale(lCodes[i][0], lCodes[i][1]); - String lName0; - if (i > 0) { - Locale locale0 = new Locale(lCodes[i - 1][0], lCodes[i - 1][1]); - lName0 = locale0.getDisplayName(); + MenuItem aboutItem; + MenuItem statisticsItem; + MenuItem upgradeItem; + MenuItem channelItem; + MenuItem infoItem; + MenuItem sleepItem; + MenuItem helpItem; + MenuItem gettingStartedItem; + MenuItem serverItem; + MenuItem numVisItem; + MenuItem checkAccountItem; + MenuItem becomeVIPItem; + MenuItem toggleVoiceChatItem; + MenuItem shaperHelpItem; + MenuItem inventoryItem; + MenuItem proxyServerItem; + MenuItem musicManItem; + MenuItem condenseItem; + MenuItem expandItem; + MenuItem i18nTest; + MenuItem currentLang; + Menu switchLang; + Vector downItems = null; + Vector langItems = null; + Vector fontItems = null; + static final String LANGUAGES = "languages.lst"; + static final String FONTS = "fonts.lst"; + Vector viewItems = null; + Vector camSpeedItems = null; + CheckboxMenuItem currentViewItem; + CheckboxMenuItem currentCamSpeedItem; + + Vector whisperItems = null; + Vector teleportItems = null; + CheckboxMenuItem currentWhisperItem; + CheckboxMenuItem currentTeleportItem; + + ImageButtons driveButton; + ImageButtons quitButton; + ImageButtons exploreButton; + ImageButtons menuButtons; + String defaultAd = IniFile.override().getIniString("defaultAd", "home:adworlds.cmp"); + AdPart ad; + ChatPart chat; + RenderCanvas render; + Panel renderAndUniverse; + UniversePanel universe; + CardLayout renderCard; + InventoryPart inventory; + WorldsMarkPart marks; + FriendsListPart friends; + ActionsPart actions; + MuteListPart mutes; + TarListPart tars; + MapPart map; + SavedAvPart savedAvs; + private static Font font = new Font(Console.message("ConsoleFont"), 0, 12); + private static Font mfont = new Font(Console.message("MenuFont"), 0, 12); + CDControl cdcontrol; + boolean playedCD; + MenuItem cdPlayerItem; + MenuItem volumeItem; + MenuItem graphicsItem; + MenuItem nametagItem; + MenuItem chatBoxItem; + MenuItem broadcastToRoom; + MenuItem broadcastToAll; + MenuItem bootSomeone; + MenuItem recorderPlayItem; + MenuItem recorderRecItem; + MenuItem recorderStopItem; + CheckboxMenuItem showWhispers; + CheckboxMenuItem showTeleports; + CheckboxMenuItem respondWhispers; + CheckboxMenuItem respondTeleports; + CheckboxMenuItem overrideWorldTeleport; + boolean universeMode; + private static final int[] menuButtonHeights = new int[]{23, 21, 21, 21, 21, 21, 25, -29}; + private Vector viewNames; + private Vector speedNames; + private Vector whisperNames; + private Vector teleportNames; + private static final int HELP = 0; + private static final int OPTIONS = 1; + private static final int WORLDSMAIL = 2; + private static final int WORLDSMARK = 3; + private static final int LETS = 4; + private static final int ACTIONS = 5; + private static final int VIP = 6; + static String loadingString = Console.message("Loading"); + static String arrowKeyMsg = Console.message("Use-arrow-keys"); + String statusMessage; + String overrideMessage; + String lastStatus; + int lastUpdateTime; + boolean wasTeleporting; + private int lastVMCheck; + private int lastVMBigWarning; + Component bottom; + Component top; + Label status; + Label yourName; + static String[] lNames = lpList(); + static int lLength; + static MenuItem[] lLangs; + static Locale[] newLocale; + static String[][] lCodes; + Vector lList; + Vector sList; + int[] lSizes; + int dLength; + MenuItem[] dLangs; + Locale[] newdLocale; + Vector flList; + Vector fsList; + int[] fSizes; + int fLength; + MenuItem[] dFonts; + Locale[] newfLocale; + static boolean wasDelta; + static boolean doDrive; + Panel mapPanel; + private static String signIn; + private static String signOut; + private static String signingIn; + private static String noMultiUser; + private static String enable3D; + private static String disable3D; + private static String showTags; + private static String hideTags; + private static String enableClassicChat; + private static String disableClassicChat; + Menu chatLogMenu; + AvMenu avatarMenu; + private int chooseView; + private int chooseCamSpeed; + private int chooseWhisper; + private int chooseTeleport; + private static String sleepStatus; + OkCancelDialog reloginDialog; + private Object nextAvatarMutex; + private URL nextAvatar; + private CheckboxMenuItem nextAvatarItem; + private CheckboxMenuItem curAvatarItem; + private static String lastWorldName; + private static String lowVMMsg; + private boolean showedMidWarn; + private static boolean startupMemCheck; + public static int physMem; + protected URL avatarURL; + private static Object classCookie; + + public UniversePanel getUniversePanel() { + return this.universe; + } + + public void printLine(String var1) { + this.chat.println(var1); + super.printLine(var1); + } + + protected void printWhisperFrom(String var1, String var2) { + WhisperManager.whisperManager().printFrom(var1, var2); + } + + protected void printWhisperTo(String var1, String var2) { + WhisperManager.whisperManager().printTo(var1, var2); + } + + protected void startWhisperingTo(String var1) { + WhisperManager.whisperManager().startTo(var1); + } + + public DefaultConsole() { + this.ad = new AdPart(URL.make(this.defaultAd)); + this.chat = new ChatPart(); + this.render = new RenderCanvas(this, new Dimension(560, 360)); + this.inventory = new InventoryPart(); + this.marks = new WorldsMarkPart(); + this.friends = new FriendsListPart(); + this.actions = new ActionsPart(); + this.mutes = new MuteListPart(); + this.tars = new TarListPart(); + this.map = new MapPart(); + this.savedAvs = new SavedAvPart(); + this.statusMessage = arrowKeyMsg; + this.lastStatus = ""; + this.lastUpdateTime = 0; + this.wasTeleporting = false; + this.status = new UnpaddedLabel("", 2); + this.yourName = new UnpaddedLabel("", 0); + this.lList = new Vector(); + this.sList = new Vector(); + this.lSizes = new int[]{0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + this.dLength = this.dpList(this.lList, this.sList, this.lSizes); + this.dLangs = this.dLength == 0 ? null : new MenuItem[this.dLength]; + this.newdLocale = this.dLength == 0 ? null : new Locale[this.dLength]; + this.flList = new Vector(); + this.fsList = new Vector(); + this.fSizes = new int[]{0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + this.fLength = this.fpList(this.flList, this.fsList, this.fSizes); + this.dFonts = this.fLength == 0 ? null : new MenuItem[this.fLength]; + this.newfLocale = this.fLength == 0 ? null : new Locale[this.fLength]; + this.chooseView = -1; + this.chooseCamSpeed = -1; + this.chooseWhisper = -1; + this.chooseTeleport = -1; + this.nextAvatarMutex = new Object(); + new ChatSaver(); + this.init(); + this.loadViewNames(); + this.loadSpeedNames(); + this.loadWhisperNames(); + this.loadTeleportNames(); + } + + public void loadSpeedNames() { + this.speedNames = new Vector(); + this.speedNames.addElement(new DefaultConsole.CameraSpeed("Slow", 1)); + this.speedNames.addElement(new DefaultConsole.CameraSpeed("Medium", 2)); + this.speedNames.addElement(new DefaultConsole.CameraSpeed("Fast", 3)); + this.speedNames.addElement(new DefaultConsole.CameraSpeed("Very Fast", 4)); + } + + public void loadViewNames() { + this.viewNames = new Vector(); + this.viewNames.addElement(new DefaultConsole.CameraView("First-person", 1)); + this.viewNames.addElement(new DefaultConsole.CameraView("Low-first-person", 2)); + this.viewNames.addElement(new DefaultConsole.CameraView("Waist", 3)); + this.viewNames.addElement(new DefaultConsole.CameraView("Shoulder", 4)); + this.viewNames.addElement(new DefaultConsole.CameraView("Head", 5)); + this.viewNames.addElement(new DefaultConsole.CameraView("Overhead", 6)); + this.viewNames.addElement(new DefaultConsole.CameraView("Behind", 7)); + this.viewNames.addElement(new DefaultConsole.CameraView("Wide-shot", 8)); + this.viewNames.addElement(new DefaultConsole.CameraView("Orthographic", 9)); + } + + public void loadWhisperNames() { + this.whisperNames = new Vector(); + this.whisperNames.addElement(new DefaultConsole.WhisperPrivacy("Everyone", 0)); + this.whisperNames.addElement(new DefaultConsole.WhisperPrivacy("Friends", 1)); + this.whisperNames.addElement(new DefaultConsole.WhisperPrivacy("No one", 2)); + } + + public void loadTeleportNames() { + this.teleportNames = new Vector(); + this.teleportNames.addElement(new DefaultConsole.TeleportPrivacy("Everyone", 0)); + this.teleportNames.addElement(new DefaultConsole.TeleportPrivacy("Friends", 1)); + this.teleportNames.addElement(new DefaultConsole.TeleportPrivacy("No one", 2)); + } + + public void setOrthoEnabled(boolean var1) { + + } + + public void loadInit() { + super.loadInit(); + } + + public void removeUseArrowStatusMsg() { + if (this.statusMessage.equals(arrowKeyMsg)) { + this.statusMessage = ""; + } + + } + + public void overrideStatusMsg(String var1) { + synchronized(this.status) { + this.overrideMessage = var1; + if (var1 != null) { + this.status.setText(var1); } else { - lName0 = newLocale[i].getDisplayName(); + this.status.setText(this.lastStatus); } - String lName1 = newLocale[i].getDisplayName(); - lName1 = lName1.substring(0, lName1.indexOf(40) - 1); - if (i < lLength - 1) { - Locale locale2 = new Locale(lCodes[i + 1][0], lCodes[i + 1][1]); - String lName2 = locale2.getDisplayName(); - lName2 = lName2.substring(0, lName2.indexOf(40) - 1); - if (lName2.equals(lName1)) { - lName = newLocale[i].getDisplayName(); - } else { - lName = lName1; - } - } else if (i == lLength - 1) { - lName0 = lName0.substring(0, lName0.indexOf(40) - 1); - if (lName1.equals(lName0)) { - lName = newLocale[i].getDisplayName(); - } else { - lName = lName1; - } - } else if (slLangs[i - 1].equals(lName1)) { - lName = newLocale[i].getDisplayName(); - } else { - lName = lName1; - } - - String code = lCodes[i][0] + "_" + lCodes[i][1]; - if (code.equals(Console.message(code))) { - slLangs[i] = lName; - } else { - slLangs[i] = Console.message(code); - } - } + } + } - sortStrings(sortCollator, slLangs, newLocale, lCodes); - - for(i = 0; i < lLength; ++i) { - lLangs[i] = new MenuItem(slLangs[i]); - lLangs[i].setFont(mfont); - switchLang.add(lLangs[i]); - this.langItems.addElement(lLangs[i]); - } - - this.currentLang = new MenuItem(Console.message("Current-Language")); - languageMenu.add(this.currentLang); - this.currentLang.setFont(mfont); - } - - if (useShaper) { - this.condenseItem = this.addMenuItem(Console.message("Condense-Files"), "Options"); - this.expandItem = this.addMenuItem(Console.message("Expand-Files"), "Options"); - this.musicManItem = this.addMenuItem(Console.message("Music-Manager"), "Options"); - this.i18nTest = this.addMenuItem(Console.message("I18N-Test"), "Options"); - } - - this.cdPlayerItem = this.addMenuItem(Console.message("MusicM"), "Options"); - this.volumeItem = this.addMenuItem(Console.message("Volume-control"), "Options"); - if (RenderWare.get3DHardwareAvailable()) { - if (RenderWare.get3DHardwareInUse()) { - this.graphicsItem = this.addMenuItem(disable3D, "Options"); - } else { - this.graphicsItem = this.addMenuItem(enable3D, "Options"); - } - } - - if (IniFile.gamma().getIniInt("SHOWNAMETAGS", 1) == 1) { - this.nametagItem = this.addMenuItem(hideTags, "Options"); - } else { - this.nametagItem = this.addMenuItem(showTags, "Options"); - } - - if (IniFile.gamma().getIniInt("classicChatBox", 1) == 1) { - this.chatBoxItem = this.addMenuItem(disableClassicChat, "Options"); - } else { - this.chatBoxItem = this.addMenuItem(enableClassicChat, "Options"); - this.chatItem = this.addMenuItem(configureChat, "Options"); - } - - if (Gamma.loadProgress != null) { - Gamma.loadProgress.setMessage("Preloading avatars..."); - Gamma.loadProgress.advance(); - } - - this.menuDone(); - getFrame().activate(); - LogFile.mailLogIfPresent(this.getSmtpServer()); - this.render.requestFocus(); - this.setMenusWRTVIP(); - this.bootSomeone = null; - if (this.broadcastEnabled()) { - this.addBroadcastMenu(); - } - - this.universeMode = false; - } - - public void setVIP(boolean f) { - super.setVIP(f); - this.setMenusWRTVIP(); - this.setNameStr(); - } - - public void checkCourtesyVIP() { - super.checkCourtesyVIP(); - this.setMenusWRTVIP(); - this.setNameStr(); - } - - public void setNameStr() { - String nameStr = this.galaxy.getUsernameU(); - boolean isOnline = this.galaxy.getOnline(); - if (!isOnline) { - this.yourName.setText(Console.message("Off-line")); - } else { - if (nameStr.length() > 0) { - if (nameStr.regionMatches(true, 0, "VIP ", 0, 4)) { - nameStr = nameStr.substring(4); - } - - if (vip > 0) { - if (vip > 1) { - nameStr = Console.message("VIP") + " " + nameStr; - } else { - nameStr = Console.message("vip") + " " + nameStr; - } - } - - IniFile.gamma().setIniString("LASTCHATNAME", parseExtended(nameStr)); - this.yourName.setText(Console.parseUnicode(nameStr)); - } - - } - } - - public void enableBroadcast(boolean enabled) { - super.enableBroadcast(enabled); - if (enabled) { - this.addBroadcastMenu(); - } - - } - - public void deactivate() { - super.deactivate(); - this.universeMode = false; - } - - protected void setSleepMode(String mode) { - super.setSleepMode(mode); - if (mode != null && mode.equals(Console.message("asleep"))) { - this.statusMessage = sleepStatus; - } else if (this.statusMessage == sleepStatus) { - this.statusMessage = ""; - } - - } - - private void relogin() { - if (this.serverItem.getLabel().equals(signOut)) { - this.reloginDialog = new OkCancelDialog(getFrame(), this, Console.message("Re-login"), Console.message("Cancel"), Console.message("OK"), Console.message("auto-sign-out"), true); - } - - } - - public boolean action(Event event, Object what) { - if (event.target == this.aboutItem) { - new AboutDialog(Std.getProductName(), getFrame()); - } else if (event.target == this.statisticsItem && this.statisticsItem != null) { - new StatisticsWindow(getFrame()); - } else if (this.viewItems.contains(event.target)) { - this.changeView((CheckboxMenuItem)event.target); - } else if (this.camSpeedItems.contains(event.target)) { - this.changeCamSpeed((CheckboxMenuItem)event.target); - } else if (event.target == this.gettingStartedItem) { - (new SendURLAction(this.getHelpGettingStarted())).startBrowser(); - } else { - String code; - String languageURL; - if (event.target == this.shaperHelpItem) { - languageURL = IniFile.override().getIniString("ShaperHelp", this.getScriptServer() + "shaperhelp.pl") + "?u="; - code = IniFile.gamma().getIniString("lastchatname", ""); - if (!code.equals("")) { - if (code.startsWith("VIP ")) { - code = code.substring(4); - } - - languageURL = languageURL + code; - } - - (new SendURLAction(WebControlImp.processURL(languageURL))).startBrowser(); - } else if (event.target == this.helpItem) { - languageURL = NetUpdate.getUpgradeServerURL(); - code = IniFile.override().getIniString("HelpDirectory", "help"); - String helpPage = IniFile.override().getIniString("HelpPage", Std.getVersion() + Console.message(".html")); - if (wasHttpNoSuchFile(languageURL + code + "/" + helpPage)) { - helpPage = IniFile.override().getIniString("HelpPage", Std.getVersion() + ".html"); - } - - (new SendURLAction(languageURL + code + "/" + helpPage)).startBrowser(); - } else if (event.target == this.infoItem) { - languageURL = IniFile.override().getIniString("infoOverride", ""); - if (languageURL.equals("")) { - NetUpdate.showInfo(); + public String message(String var1, Locale var2) { + Locale.setDefault(var2); + Console.println(var2.getDisplayName()); + + try { + ResourceBundle var3 = ResourceBundle.getBundle("MessagesBundle", var2); + return var3.getString(var1); + } catch (MissingResourceException var4) { + return "NO MESSAGE for " + var1; + } + } + + private void init() { + this.addPart(this.render); + this.addPart(this.chat); + this.addPart(this.inventory); + this.addPart(this.marks); + this.addPart(this.friends); + this.addPart(this.actions); + this.addPart(this.mutes); + this.addPart(this.tars); + this.addPart(this.ad); + this.addPart(this.map); + this.addPart(this.savedAvs); + Panel var1 = new Panel(new FlowLayout(1, 0, 0)); + String var2 = IniFile.override().getIniString("driveGif", "drive.gif"); + this.addPart(this.driveButton = new ImageButtons(var2, 81, 19, this)); + String var3 = IniFile.override().getIniString("quitGif", Console.message("quit.gif")); + this.addPart(this.quitButton = new ImageButtons(var3, 65, 19, this)); + String var4 = IniFile.override().getIniString("exploreGif", Console.message("explore.gif")); + this.addPart(this.exploreButton = new ImageButtons(var4, 98, 22, this)); + var1.add(this.driveButton); + this.driveButton.setDownUpHandler(new ImageButtonsCallback() { + public Object imageButtonsCallback(Component var1, int var2) { + if (var2 != -1) { + DefaultConsole.this.startDrive(); + } else { + DefaultConsole.this.driveButton.drawDown(); + } + + return this; + } + }); + Panel var5 = new Panel(); + var5.setLayout(new GridLayout(1, 3)); + int var6 = IniFile.override().getIniInt("uiBackgroundRed", 49); + int var7 = IniFile.override().getIniInt("uiBackgroundGreen", 0); + int var8 = IniFile.override().getIniInt("uiBackgroundBlue", 255); + var5.setBackground(new Color(var6, var7, var8)); + var5.add(this.yourName); + var5.add(var1); + var5.add(this.status); + this.chat.line.setBackground(Color.black); + this.chat.line.setForeground(Color.white); + this.chat.line.setFont(font); + InsetPanel var9 = new InsetPanel(new BorderLayout(0, 3), 0, 0, 3, 0); + var9.add("North", var5); + var9.add("Center", this.chat.listen.getComponent()); + var9.add("South", this.chat.line); + this.chat.listen.setBackground(Color.black); + this.chat.listen.setForeground(Color.white); + this.chat.listen.setFont(font); + Panel var10 = new Panel(new BorderLayout()); + new Panel(new BorderLayout()); + Panel var12 = new Panel(new BorderLayout()); + Panel var13 = new Panel(new BorderLayout()); + ColorFiller var14 = new ColorFiller(65, 19); + var14.setBackground(new Color(var6, var7, var8)); + var12.add("West", this.quitButton); + var12.add("East", var14); + var13.add("North", var12); + var13.add("Center", this.ad); + var10.add("West", var13); + this.mapPanel = new Panel(new BorderLayout()); + this.mapPanel.add("Center", this.map); + this.mapPanel.setBackground(Color.black); + var12 = new Panel(new BorderLayout()); + ColorFiller var15 = new ColorFiller(60, 19); + var15.setBackground(new Color(var6, var7, var8)); + var12.add("North", var15); + ColorFiller var16 = new ColorFiller(60, 3); + int var17 = IniFile.override().getIniInt("uiBackground2Red", 0); + int var18 = IniFile.override().getIniInt("uiBackground2Green", 0); + int var19 = IniFile.override().getIniInt("uiBackground2Blue", 0); + var16.setBackground(new Color(var17, var18, var19)); + var12.add("South", var16); + Panel var11 = new Panel(new BorderLayout()); + var11.add("East", this.exploreButton); + var11.add("West", var12); + this.mapPanel.add("North", var11); + var10.add("East", this.mapPanel); + var10.add("Center", var9); + this.bottom = var10; + this.renderCard = new CardLayout(); + this.renderAndUniverse = new Panel(this.renderCard); + this.renderAndUniverse.add("render", this.render); + InsetPanel var20 = new InsetPanel(new BorderLayout(), 3, 3, 0, 0); + var20.add("Center", this.renderAndUniverse); + int var21 = IniFile.override().getIniInt("uiBackground3Red", 0); + int var22 = IniFile.override().getIniInt("uiBackground3Green", 0); + int var23 = IniFile.override().getIniInt("uiBackground3Blue", 0); + var14 = new ColorFiller(97, 1); + var14.setBackground(new Color(var21, var22, var23)); + Panel var24 = new Panel(new QuantizedStackedLayout(var14)); + String var25 = IniFile.override().getIniString("rtPanel", Console.message("rtpanel.gif")); + this.addPart(this.menuButtons = new ImageButtons(var25, 97, menuButtonHeights, this)); + var24.add(var14); + var24.add(this.menuButtons); + var24.add(this.friends); + var20.add("East", var24); + this.top = var20; + } + + public void relayoutMap() { + this.mapPanel.invalidate(); + this.mapPanel.validate(); + this.mapPanel.doLayout(); + this.mapPanel.repaint(); + } + + public void startDrive() { + this.statusMessage = Console.message("Drag-mouse"); + doDrive = true; + Window.makeJavaReleaseCapture(); + } + + public void setOnlineState(boolean var1, boolean var2) { + synchronized(this) { + if (this.serverItem != null) { + this.serverItem.setEnabled(var1); + if (!var1) { + Galaxy var4 = this.getGalaxy(); + if (var4 != null && !var4.isAnonymous()) { + this.serverItem.setLabel(signingIn); + } else { + this.serverItem.setLabel(noMultiUser); + } + } else if (var2) { + this.serverItem.setLabel(signOut); + } else { + this.serverItem.setLabel(signIn); + } + } + + } + } + + private void handleNametagsItem() { + if (IniFile.gamma().getIniInt("SHOWNAMETAGS", 1) == 0) { + IniFile.gamma().setIniInt("SHOWNAMETAGS", 1); + this.nametagItem.setLabel(hideTags); + } else { + IniFile.gamma().setIniInt("SHOWNAMETAGS", 0); + this.nametagItem.setLabel(showTags); + } + + new OkCancelDialog(getFrame(), (DialogReceiver)null, Console.message("Alert"), (String)null, Console.message("OK"), Console.message("Change-exit"), true); + } + + private void handleGraphicsItem() { + if (IniFile.gamma().getIniInt("UserEnabled3DHardware", 0) == 0) { + IniFile.gamma().setIniInt("UserEnabled3DHardware", 1); + this.graphicsItem.setLabel(disable3D); + } else { + IniFile.gamma().setIniInt("UserEnabled3DHardware", 0); + this.graphicsItem.setLabel(enable3D); + } + + new OkCancelDialog(getFrame(), (DialogReceiver)null, Console.message("Alert"), (String)null, Console.message("OK"), Console.message("Change-exit"), true); + } + + private void handleChatBoxItem() { + if (IniFile.gamma().getIniInt("classicChatBox", 1) == 0) { + IniFile.gamma().setIniInt("classicChatBox", 1); + this.chatBoxItem.setLabel(disableClassicChat); + } else { + IniFile.gamma().setIniInt("classicChatBox", 0); + this.chatBoxItem.setLabel(enableClassicChat); + } + + new OkCancelDialog(getFrame(), (DialogReceiver)null, Console.message("Alert"), (String)null, Console.message("OK"), Console.message("Change-exit"), true); + } + + public AvMenu getAvatarMenu() { + return this.avatarMenu; + } + + public void inventoryChanged() { + super.inventoryChanged(); + if (this.avatarMenu != null) { + this.avatarMenu.buildSpecialGuestMenu(); + } + + } + + public void setMenusWRTVIP() { + if (this.avatarMenu != null) { + this.avatarMenu.setEnabled(this.getVIP()); + this.avatarMenu.customize.setEnabled(this.getVIP()); + } + + if (this.savedAvs != null) { + this.savedAvs.setEnabled(this.getVIP()); + } + + if (this.chatLogMenu != null) { + this.chatLogMenu.setEnabled(this.getVIP()); + } + + if (this.toggleVoiceChatItem != null) { + this.toggleVoiceChatItem.setLabel(this.getVIP() && VoiceChat.voiceChatEnabled ? Console.message("Reject-Voice") : Console.message("Accept-Voice")); + this.toggleVoiceChatItem.setEnabled(this.getVIP() && VoiceChat.voiceChatAvailable()); + } + + if (this.becomeVIPItem != null) { + this.becomeVIPItem.setLabel(vip > 0 ? (vip > 1 ? Console.message("Youre-a-VIP") : Console.message("Become-full-VIP")) : Console.message("Become-VIP")); + } + + if (this.numVisItem != null) { + this.numVisItem.setEnabled(this.getVIP()); + } + + } + + public void addBroadcastMenu() { + if (this.bootSomeone == null) { + if (IniFile.gamma().getIniInt("Broadcast", 0) != 0) { + Menu var1 = new Menu(Console.message("Broadcast")); + var1.add(this.broadcastToRoom = new MenuItem(Console.message("Users"))); + var1.add(this.broadcastToAll = new MenuItem(Console.message("All-users"))); + this.addMenuItem(var1, "Options"); + } + + this.bootSomeone = new MenuItem(Console.message("Boot-user")); + this.addMenuItem(this.bootSomeone, "Options"); + } + + } + + private Menu updateChatLogMenu() { + if (this.chatLogMenu == null) { + this.chatLogMenu = new Menu(Console.message("View-Chat")); + } else { + this.chatLogMenu.removeAll(); + } + + ActionListener var1 = new ActionListener() { + public void actionPerformed(ActionEvent var1) { + (new SendURLAction("file:" + var1.getActionCommand())).startBrowser(); + } + }; + String[] var2 = this.logList(); + MenuItem var3 = null; + + for(int var4 = 0; var4 < var2.length; ++var4) { + int var5 = var2[var4].indexOf(".glog.html"); + if (var5 > 6) { + Object[] var6 = new Object[]{new String(var2[var4].substring(5, var5))}; + var3 = new MenuItem(MessageFormat.format(Console.message("Chat-with"), var6)); } else { - (new SendURLAction(languageURL)).startBrowser(); - } - } else if (event.target == this.i18nTest) { - Locale df = Locale.getDefault(); - Console.println("Default = " + df.getDisplayName()); - DateFormat fulldate = DateFormat.getDateTimeInstance(1, 1); - Date today = new Date(); - Console.println("Today = " + fulldate.format(today)); - Locale[] list = DateFormat.getAvailableLocales(); - Console.println("Avaliable Locales are:"); - - for(int i = 0; i < list.length; ++i) { - Locale.setDefault(list[i]); - Console.println(list[i].getDisplayName() + " " + list[i]); - } - - new Locale("en", "US"); - Locale fr = new Locale("fr", "FR"); - Locale de = new Locale("de", "DE"); - Locale ja = new Locale("ja", "JP"); - Locale zh = new Locale("zh", "CN"); - Locale th = new Locale("th", "TH"); - Locale ru = new Locale("ru", "RU"); - Locale iw = new Locale("iw", "IL"); - Console.println("file.encoding = " + System.getProperty("file.encoding")); - Console.println(this.message("test-language", fr)); - Console.println(this.message("test-language", de)); - Console.println(this.message("test-language", ja)); - Console.println(this.message("test-language", zh)); - Console.println(this.message("test-language", th)); - Console.println(this.message("test-language", ru)); - Console.println(this.message("test-language", iw)); - Console.println(this.message("test-language", df)); - } else if (event.target == this.checkAccountItem) { - languageURL = IniFile.override().getIniString("accountOverride", ""); - if (languageURL.equals("")) { - code = IniFile.override().getIniString("accountInfoPage", "account" + Console.message(".pl")); - if (wasHttpNoSuchFile(this.getScriptServer() + code)) { - code = IniFile.override().getIniString("accountInfoPage", "account.pl"); - } + if (var5 <= 0) { + continue; + } + + var3 = new MenuItem(Console.message("General-chat")); + } + + var3.setActionCommand(var2[var4]); + var3.addActionListener(var1); + this.chatLogMenu.add(var3); + } + + return this.chatLogMenu; + } + + private String[] logList() { + File var1 = new File("."); + FilenameFilter var2 = new FilenameFilter() { + public boolean accept(File var1, String var2) { + return var2.startsWith("chat.") && var2.endsWith(".glog.html"); + } + }; + return var1.list(var2); + } + + private static String[] lpList() { + File var0 = new File("."); + FilenameFilter var1 = new FilenameFilter() { + public boolean accept(File var1, String var2) { + return var2.startsWith("MessagesBundle") && var2.endsWith(".properties"); + } + }; + String[] var2 = var0.list(var1); + Collator var3 = Collator.getInstance(); + sortStrings(var3, var2); + return var2; + } + + private int dpList(Vector var1, Vector var2, int[] var3) { + String var4 = NetUpdate.getLanguages(URL.make(NetUpdate.getUpgradeServerURL() + "I18N/" + "languages.lst"), var1, var2, var3); + if (var4 != null) { + System.out.println(var4); + return 0; + } else { + return var1.size(); + } + } + + private int fpList(Vector var1, Vector var2, int[] var3) { + String var4 = NetUpdate.getLanguages(URL.make(NetUpdate.getUpgradeServerURL() + "I18N/" + "fonts.lst"), var1, var2, var3); + if (var4 != null) { + System.out.println(var4); + return 0; + } else { + return var1.size(); + } + } + + public static void sortStrings(Collator var0, String[] var1, Locale[] var2, String[][] var3) { + for(int var8 = 0; var8 < var1.length; ++var8) { + for(int var9 = var8 + 1; var9 < var1.length; ++var9) { + if (var0.compare(var1[var8], var1[var9]) > 0) { + String var4 = var1[var8]; + Locale var5 = var2[var8]; + String var6 = var3[var8][0]; + String var7 = var3[var8][1]; + var1[var8] = var1[var9]; + var2[var8] = var2[var9]; + var3[var8][0] = var3[var9][0]; + var3[var8][1] = var3[var9][1]; + var1[var9] = var4; + var2[var9] = var5; + var3[var9][0] = var6; + var3[var9][1] = var7; + } + } + } + + } + + public static void sortStrings(Collator var0, String[] var1, Locale[] var2, Vector var3, Vector var4) { + for(int var9 = 0; var9 < var1.length; ++var9) { + for(int var10 = var9 + 1; var10 < var1.length; ++var10) { + if (var0.compare(var1[var9], var1[var10]) > 0) { + String var5 = var1[var9]; + Locale var6 = var2[var9]; + String var7 = (String)var3.elementAt(var9); + String var8 = (String)var4.elementAt(var9); + var1[var9] = var1[var10]; + var2[var9] = var2[var10]; + var3.setElementAt(var3.elementAt(var10), var9); + var4.setElementAt(var4.elementAt(var10), var9); + var1[var10] = var5; + var2[var10] = var6; + var3.setElementAt(var7, var10); + var4.setElementAt(var8, var10); + } + } + } + + } + + public static void sortStrings(Collator var0, String[] var1) { + for(int var3 = 0; var3 < var1.length; ++var3) { + for(int var4 = var3 + 1; var4 < var1.length; ++var4) { + if (var0.compare(var1[var3], var1[var4]) > 0) { + String var2 = var1[var3]; + var1[var3] = var1[var4]; + var1[var4] = var2; + } + } + } + + } + + public void activate(Container var1) { + super.activate(var1); + var1.setBackground(Color.black); + var1.setForeground(Color.white); + var1.setLayout(new BorderLayout()); + var1.add("Center", this.top); + var1.add("South", this.bottom); + this.chat.line.setBackground(Color.white); + this.chat.line.setForeground(Color.black); + boolean var2 = Gamma.getShaper() != null; + if (var2) { + this.shaperHelpItem = this.addMenuItem(Console.message("using-shaper"), "Help"); + } + + if (NetUpdate.getInfoURL() != null) { + this.helpItem = this.addMenuItem(Console.message("Help-Contents"), "Help"); + this.infoItem = this.addMenuItem(Console.message("Latest-info"), "Help"); + } + + Object[] var3 = new Object[]{new String(Std.getProductName())}; + this.aboutItem = this.addMenuItem(MessageFormat.format(Console.message("About-product"), var3), "Help"); + int var4 = IniFile.gamma().getIniInt("CAM_MODE", 7); + int var5 = IniFile.gamma().getIniInt("CAM_SPEED", 4); + + this.pilot.setOutsideCameraMode(var4, var5); + Menu var6 = new Menu(Console.message("Change-View")); + this.addMenuItem(var6, "Options"); + MenuItem var7 = new MenuItem(Console.message("CAMERA-VIEW")); + var7.setFont(mfont); + var6.add(var7); + this.viewItems = new Vector(); + + for(int var8 = 0; var8 < this.viewNames.size(); ++var8) { + DefaultConsole.CameraView var9 = (DefaultConsole.CameraView)this.viewNames.elementAt(var8); + CheckboxMenuItem var10 = new CheckboxMenuItem(" " + Console.message(var9.viewName), var4 == var9.viewID); + if (var4 == var9.viewID) { + this.currentViewItem = var10; + } + + var10.setFont(mfont); + var6.add(var10); + this.viewItems.addElement(var10); + } + + var6.addSeparator(); + MenuItem var25 = new MenuItem(Console.message("CAMERA-SPEED")); + var25.setFont(mfont); + var6.add(var25); + this.camSpeedItems = new Vector(); + + for(int var26 = 0; var26 < this.speedNames.size(); ++var26) { + DefaultConsole.CameraSpeed var28 = (DefaultConsole.CameraSpeed)this.speedNames.elementAt(var26); + CheckboxMenuItem var11 = new CheckboxMenuItem(" " + Console.message(var28.speedName), var28.speedID == var5); + if (var28.speedID == var5) { + this.currentCamSpeedItem = var11; + } + + var11.setFont(mfont); + var6.add(var11); + this.camSpeedItems.addElement(var11); + } + + Menu privacyMenu = new Menu(Console.message("privacy-settings")); + this.addMenuItem(privacyMenu, "Options"); + int whisperP = IniFile.gamma().getIniInt("WhisperPrivacy", 0); + int teleportP = IniFile.gamma().getIniInt("TeleportPrivacy", 0); + int whisperShow = IniFile.modFriendly().getIniInt("WhisperFeedback", 1); + int teleportShow = IniFile.modFriendly().getIniInt("TeleportFeedback", 0); + int whisperSend = IniFile.modFriendly().getIniInt("WhisperResponse", 1); + int teleportSend = IniFile.modFriendly().getIniInt("TeleportResponse", 0); + + Menu whisperMenu = new Menu(Console.message("whisper-settings")); + MenuItem whMenu = new MenuItem(Console.message("WHISPER-SETTINGS")); + whisperMenu.setFont(mfont); + whisperMenu.add(whMenu); + this.whisperItems = new Vector(); + privacyMenu.add(whisperMenu); + + for(int wi = 0; wi < this.whisperNames.size(); ++wi) { + DefaultConsole.WhisperPrivacy var28 = (DefaultConsole.WhisperPrivacy)this.whisperNames.elementAt(wi); + CheckboxMenuItem var11 = new CheckboxMenuItem(" " + Console.message(var28.whisperName), var28.whisperID == whisperP); + if (var28.whisperID == whisperP) { + this.currentWhisperItem = var11; + } + + var11.setFont(mfont); + whisperMenu.add(var11); + this.whisperItems.addElement(var11); + } + + whisperMenu.addSeparator(); + this.showWhispers = new CheckboxMenuItem(Console.message("reject-menu"), whisperShow == 1); + this.respondWhispers = new CheckboxMenuItem(Console.message("response-menu"), whisperSend == 1); + whisperMenu.add(this.showWhispers); + whisperMenu.add(respondWhispers); + + Menu teleportMenu = new Menu(Console.message("teleport-settings")); + MenuItem tpMenu = new MenuItem(Console.message("TELEPORT-SETTINGS")); + teleportMenu.setFont(mfont); + teleportMenu.add(tpMenu); + this.teleportItems = new Vector(); + privacyMenu.add(teleportMenu); + + for(int ti = 0; ti < this.teleportNames.size(); ++ti) { + DefaultConsole.TeleportPrivacy var28 = (DefaultConsole.TeleportPrivacy)this.teleportNames.elementAt(ti); + CheckboxMenuItem var11 = new CheckboxMenuItem(" " + Console.message(var28.teleportName), var28.teleportID == teleportP); + if (var28.teleportID == teleportP) { + this.currentTeleportItem = var11; + } + + var11.setFont(mfont); + teleportMenu.add(var11); + this.teleportItems.addElement(var11); + } + + teleportMenu.addSeparator(); + this.showTeleports = new CheckboxMenuItem(Console.message("reject-menu"), teleportShow == 1); + this.respondTeleports = new CheckboxMenuItem(Console.message("response-menu"), teleportSend == 1); + teleportMenu.add(this.showTeleports); + teleportMenu.add(respondTeleports); + + + this.becomeVIPItem = this.addMenuItem(vip == 1 ? Console.message("Become-full-VIP") : Console.message("Become-VIP"), "VIP"); + this.addMenuItem(this.avatarMenu = new AvMenu(this, this.lastPilotRequested), "VIP"); + this.addMenuItem(this.savedAvs, "VIP"); + this.addMenuItem(this.avatarMenu.customize, "VIP"); + this.toggleVoiceChatItem = this.addMenuItem(Console.message("Enable-Voice"), "VIP"); + this.toggleVoiceChatItem.setEnabled(false); + this.numVisItem = this.addMenuItem(Console.message("Num-Visible"), "VIP"); + this.chatLogMenu = new Menu("Chat Log"); + if (NetUpdate.isInternalVersion()) { + this.inventoryItem = this.addMenuItem("Check Inventory", "VIP"); + } + + this.setMenusWRTVIP(); + this.proxyServerItem = this.addMenuItem(Console.message("Proxy-Server"), "Options"); + this.checkAccountItem = this.addMenuItem(Console.message("Account-Info"), "Options"); + if (var2) { + this.statisticsItem = this.addMenuItem(Console.message("Display-Stat"), "Options"); + } + + this.upgradeItem = this.addMenuItem(Console.message("Upgrade-Now"), "Options"); + if (var2) { + this.channelItem = this.addMenuItem(Console.message("Dimension-Sel"), "Options"); + } + + this.serverItem = this.addMenuItem(signIn, "Options"); + this.setOnlineState(this.galaxy.getOnlineEnabled(), this.galaxy.getOnline()); + Menu var27; + if (IniFile.gamma().getIniInt("recorderEnabled", 1) == 1) { + var27 = new Menu(Console.message("Recorder")); + this.recorderRecItem = new MenuItem(Console.message("Record")); + var27.add(this.recorderRecItem); + this.recorderStopItem = new MenuItem(Console.message("Stop")); + var27.add(this.recorderStopItem); + this.recorderPlayItem = new MenuItem(Console.message("Play")); + var27.add(this.recorderPlayItem); + } + + if (NetUpdate.isInternalVersion()) { + var27 = new Menu(Console.message("Languages")); + this.addMenuItem(var27, "Options"); + Menu var29 = new Menu(Console.message("Download-Font")); + var27.add(var29); + var29.setFont(mfont); + this.fontItems = new Vector(); + + for(int var30 = 0; var30 < this.fLength; ++var30) { + if (this.flList.elementAt(var30) != null) { + String var12; + if (this.fsList.elementAt(var30) != null) { + this.newfLocale[var30] = new Locale((String)this.flList.elementAt(var30), (String)this.fsList.elementAt(var30)); + var12 = (String)this.flList.elementAt(var30) + "_" + (String)this.fsList.elementAt(var30); + if (var12.equals(Console.message(var12))) { + this.dFonts[var30] = new MenuItem(this.newfLocale[var30].getDisplayName()); + } else { + this.dFonts[var30] = new MenuItem(Console.message(var12)); + } + } else { + var12 = (String)this.flList.elementAt(var30); + if (var12.equals(Console.message(var12))) { + this.dFonts[var30] = new MenuItem((String)this.flList.elementAt(var30)); + } else { + this.dFonts[var30] = new MenuItem(Console.message(var12)); + } + } - (new SendURLAction(this.getScriptServer() + code, true)).startBrowser(); + this.dFonts[var30].setFont(mfont); + var29.add(this.dFonts[var30]); + this.fontItems.addElement(this.dFonts[var30]); + } + } + + Menu var31 = new Menu(Console.message("Download-Language")); + var27.add(var31); + var31.setFont(mfont); + this.downItems = new Vector(); + String[] var32 = new String[this.dLength]; + + String var17; + for(int var13 = 0; var13 < this.dLength; ++var13) { + if (this.lList.elementAt(var13) != null) { + this.newdLocale[var13] = new Locale((String)this.lList.elementAt(var13), (String)this.sList.elementAt(var13)); + String var15; + if (var13 > 0) { + Locale var18 = new Locale((String)this.lList.elementAt(var13 - 1), (String)this.sList.elementAt(var13 - 1)); + var15 = var18.getDisplayName(); + } else { + var15 = this.newdLocale[var13].getDisplayName(); + } + + String var16 = this.newdLocale[var13].getDisplayName(); + var16 = var16.substring(0, var16.indexOf(40) - 1); + String var14; + if (var13 < this.dLength - 1) { + Locale var20 = new Locale((String)this.lList.elementAt(var13 + 1), (String)this.sList.elementAt(var13 + 1)); + var17 = var20.getDisplayName(); + var17 = var17.substring(0, var17.indexOf(40) - 1); + if (var17.equals(var16)) { + var14 = this.newdLocale[var13].getDisplayName(); + } else { + var14 = var16; + } + } else if (var13 == this.dLength - 1) { + var15 = var15.substring(0, var15.indexOf(40) - 1); + if (var16.equals(var15)) { + var14 = this.newdLocale[var13].getDisplayName(); + } else { + var14 = var16; + } + } else if (var32[var13 - 1].equals(var16)) { + var14 = this.newdLocale[var13].getDisplayName(); + } else { + var14 = var16; + } + + String var21 = (String)this.lList.elementAt(var13) + "_" + (String)this.sList.elementAt(var13); + if (var21.equals(Console.message(var21))) { + var32[var13] = var14; + } else { + var32[var13] = Console.message(var21); + } + } + } + + Collator var33 = Collator.getInstance(); + sortStrings(var33, var32, this.newdLocale, this.lList, this.sList); + + for(int var34 = 0; var34 < this.dLength; ++var34) { + this.dLangs[var34] = new MenuItem(var32[var34]); + this.dLangs[var34].setFont(mfont); + var31.add(this.dLangs[var34]); + this.downItems.addElement(this.dLangs[var34]); + } + + Menu var37 = new Menu(Console.message("Switch-Language")); + var27.add(var37); + var37.setFont(mfont); + this.langItems = new Vector(); + + int var36; + for(int var35 = 0; var35 < lLength; ++var35) { + var36 = lNames[var35].indexOf(95); + if (var36 < 0) { + lCodes[var35][0] = "en"; + lCodes[var35][1] = "US"; + } else { + int var39 = lNames[var35].lastIndexOf(46); + if (var39 < 0) { + var39 = 0; + } + + lCodes[var35][0] = lNames[var35].substring(var36 + 1, var36 + 3); + if (var39 > var36 + 4) { + lCodes[var35][1] = lNames[var35].substring(var36 + 4, var39); + } else { + lCodes[var35][1] = lCodes[var35][0].toUpperCase(); + } + } + } + + String[] var38 = new String[lLength]; + + for(var36 = 0; var36 < lLength; ++var36) { + newLocale[var36] = new Locale(lCodes[var36][0], lCodes[var36][1]); + String var40; + if (var36 > 0) { + Locale var42 = new Locale(lCodes[var36 - 1][0], lCodes[var36 - 1][1]); + var40 = var42.getDisplayName(); + } else { + var40 = newLocale[var36].getDisplayName(); + } + + String var19 = newLocale[var36].getDisplayName(); + var19 = var19.substring(0, var19.indexOf(40) - 1); + if (var36 < lLength - 1) { + Locale var23 = new Locale(lCodes[var36 + 1][0], lCodes[var36 + 1][1]); + String var41 = var23.getDisplayName(); + var41 = var41.substring(0, var41.indexOf(40) - 1); + if (var41.equals(var19)) { + var17 = newLocale[var36].getDisplayName(); + } else { + var17 = var19; + } + } else if (var36 == lLength - 1) { + var40 = var40.substring(0, var40.indexOf(40) - 1); + if (var19.equals(var40)) { + var17 = newLocale[var36].getDisplayName(); + } else { + var17 = var19; + } + } else if (var38[var36 - 1].equals(var19)) { + var17 = newLocale[var36].getDisplayName(); + } else { + var17 = var19; + } + + String var24 = lCodes[var36][0] + "_" + lCodes[var36][1]; + if (var24.equals(Console.message(var24))) { + var38[var36] = var17; + } else { + var38[var36] = Console.message(var24); + } + } + + sortStrings(var33, var38, newLocale, lCodes); + + for(var36 = 0; var36 < lLength; ++var36) { + lLangs[var36] = new MenuItem(var38[var36]); + lLangs[var36].setFont(mfont); + var37.add(lLangs[var36]); + this.langItems.addElement(lLangs[var36]); + } + + this.currentLang = new MenuItem(Console.message("Current-Language")); + var27.add(this.currentLang); + this.currentLang.setFont(mfont); + } + + if (var2) { + this.condenseItem = this.addMenuItem(Console.message("Condense-Files"), "Options"); + this.expandItem = this.addMenuItem(Console.message("Expand-Files"), "Options"); + this.musicManItem = this.addMenuItem(Console.message("Music-Manager"), "Options"); + this.i18nTest = this.addMenuItem(Console.message("I18N-Test"), "Options"); + } + + this.cdPlayerItem = this.addMenuItem(Console.message("MusicM"), "Options"); + this.volumeItem = this.addMenuItem(Console.message("Volume-control"), "Options"); + if (RenderWare.get3DHardwareAvailable()) { + if (RenderWare.get3DHardwareInUse()) { + this.graphicsItem = this.addMenuItem(disable3D, "Options"); } else { - (new SendURLAction(languageURL)).startBrowser(); - } - - this.relogin(); - } else if (event.target == this.upgradeItem) { - NetUpdate.doUpdate(true); - } else if (event.target == this.channelItem && this.channelItem != null) { - Galaxy g = this.getGalaxy(); - code = ""; - - assert g != null; - - if (g != null) { - code = g.getChannel(); + this.graphicsItem = this.addMenuItem(enable3D, "Options"); } + } - new ChannelDialog(getFrame(), this, Console.message("Dimension-Sel"), code); - } else if (event.target == this.becomeVIPItem) { - languageURL = IniFile.override().getIniString("vipOverride", ""); - if (languageURL.equals("")) { - code = IniFile.override().getIniString("vipPage", "vip" + Console.message(".pl")); - if (wasHttpNoSuchFile(this.getScriptServer() + code)) { - code = IniFile.override().getIniString("vipPage", "vip.pl"); - } - - (new SendURLAction(this.getScriptServer() + code, true)).startBrowser(); + if (IniFile.gamma().getIniInt("SHOWNAMETAGS", 1) == 1) { + this.nametagItem = this.addMenuItem(hideTags, "Options"); + } else { + this.nametagItem = this.addMenuItem(showTags, "Options"); + } + + if (IniFile.gamma().getIniInt("classicChatBox", 1) == 1) { + this.chatBoxItem = this.addMenuItem(disableClassicChat, "Options"); + } else { + this.chatBoxItem = this.addMenuItem(enableClassicChat, "Options"); + } + + if (Gamma.loadProgress != null) { + Gamma.loadProgress.setMessage("Preloading avatars..."); + Gamma.loadProgress.advance(); + } + + this.menuDone(); + getFrame().activate(); + LogFile.mailLogIfPresent(this.getSmtpServer()); + this.render.requestFocus(); + this.setMenusWRTVIP(); + this.bootSomeone = null; + if (this.broadcastEnabled()) { + this.addBroadcastMenu(); + } + + this.universeMode = false; + } + + public void setVIP(boolean var1) { + super.setVIP(var1); + this.setMenusWRTVIP(); + this.setNameStr(); + } + + public void checkCourtesyVIP() { + super.checkCourtesyVIP(); + this.setMenusWRTVIP(); + this.setNameStr(); + } + + public void setNameStr() { + String var1 = this.galaxy.getUsernameU(); + boolean var2 = this.galaxy.getOnline(); + if (!var2) { + this.yourName.setText(Console.message("Off-line")); + } else { + if (var1.length() > 0) { + if (var1.regionMatches(true, 0, "VIP ", 0, 4)) { + var1 = var1.substring(4); + } + + if (vip > 0) { + if (vip > 1) { + var1 = Console.message("VIP") + " " + var1; + } else { + var1 = Console.message("vip") + " " + var1; + } + } + + IniFile.gamma().setIniString("LASTCHATNAME", parseExtended(var1)); + this.yourName.setText(Console.parseUnicode(var1)); + } + + } + } + + public void enableBroadcast(boolean var1) { + super.enableBroadcast(var1); + if (var1) { + this.addBroadcastMenu(); + } + + } + + public void deactivate() { + super.deactivate(); + this.universeMode = false; + } + + protected void setSleepMode(String var1) { + super.setSleepMode(var1); + if (var1 != null && var1.equals(Console.message("asleep"))) { + this.statusMessage = sleepStatus; + } else if (this.statusMessage == sleepStatus) { + this.statusMessage = ""; + } + + } + + private void relogin() { + if (this.serverItem.getLabel().equals(signOut)) { + this.reloginDialog = new OkCancelDialog(getFrame(), this, Console.message("Re-login"), Console.message("Cancel"), Console.message("OK"), Console.message("auto-sign-out"), true); + } + + } + + public void toggleWhisperRejects() { + int mainVal = IniFile.modFriendly().getIniInt("WhisperFeedback", 1); + boolean newVal = mainVal == 1; + IniFile.modFriendly().setIniInt("WhisperFeedback", newVal ? 0 : 1); + this.showWhispers.setState(!newVal); + } + + public void toggleWhisperResponse() { + int mainVal = IniFile.modFriendly().getIniInt("WhisperResponse", 1); + boolean newVal = mainVal == 1; + IniFile.modFriendly().setIniInt("WhisperResponse", newVal ? 0 : 1); + this.respondWhispers.setState(!newVal); + } + + public void toggleTeleportRejects() { + int mainVal = IniFile.modFriendly().getIniInt("TeleportFeedback", 1); + boolean newVal = mainVal == 1; + IniFile.modFriendly().setIniInt("TeleportFeedback", newVal ? 0 : 1); + this.showTeleports.setState(!newVal); + } + + public void toggleTeleportResponse() { + int mainVal = IniFile.modFriendly().getIniInt("TeleportResponse", 0); + boolean newVal = mainVal == 1; + IniFile.modFriendly().setIniInt("TeleportResponse", mainVal == 1 ? 0 : 1); + this.respondTeleports.setState(!newVal); + } + + public boolean action(Event var1, Object var2) { + if (var1.target == this.aboutItem) { + new AboutDialog(Std.getProductName(), getFrame()); + } else if (var1.target == this.statisticsItem && this.statisticsItem != null) { + new StatisticsWindow(getFrame()); + } else if (this.viewItems.contains(var1.target)) { + this.changeView((CheckboxMenuItem)var1.target); + } else if (this.camSpeedItems.contains(var1.target)) { + this.changeCamSpeed((CheckboxMenuItem)var1.target); + } else if (this.whisperItems.contains(var1.target)) { + this.changeWhispers((CheckboxMenuItem)var1.target); + } else if (this.teleportItems.contains(var1.target)) { + this.changeTeleport((CheckboxMenuItem)var1.target); + } else if (var1.target == this.showWhispers) { + toggleWhisperRejects(); + } else if (var1.target == this.respondWhispers) { + toggleWhisperResponse(); + } else if (var1.target == this.showTeleports) { + toggleTeleportRejects(); + } else if (var1.target == this.respondTeleports) { + toggleTeleportResponse(); + } else if (var1.target == this.gettingStartedItem) { + (new SendURLAction(this.getHelpGettingStarted())).startBrowser(); + } else { + String var4; + String var15; + if (var1.target == this.shaperHelpItem) { + var15 = IniFile.override().getIniString("ShaperHelp", this.getScriptServer() + "shaperhelp.pl") + "?u="; + var4 = IniFile.gamma().getIniString("lastchatname", ""); + if (!var4.equals("")) { + if (var4.startsWith("VIP ")) { + var4 = var4.substring(4); + } + + var15 = var15 + var4; + } + + (new SendURLAction(WebControlImp.processURL(var15))).startBrowser(); + } else if (var1.target == this.helpItem) { + var15 = NetUpdate.getUpgradeServerURL(); + var4 = IniFile.override().getIniString("HelpDirectory", "help"); + String var18 = IniFile.override().getIniString("HelpPage", Std.getVersion() + Console.message(".html")); + if (wasHttpNoSuchFile(var15 + var4 + "/" + var18)) { + var18 = IniFile.override().getIniString("HelpPage", Std.getVersion() + ".html"); + } + + (new SendURLAction(var15 + var4 + "/" + var18)).startBrowser(); + } else if (var1.target == this.infoItem) { + var15 = IniFile.override().getIniString("infoOverride", ""); + if (var15.equals("")) { + NetUpdate.showInfo(); + } else { + (new SendURLAction(var15)).startBrowser(); + } + } else if (var1.target == this.i18nTest) { + Locale var23 = Locale.getDefault(); + Console.println("Default = " + var23.getDisplayName()); + DateFormat var24 = DateFormat.getDateTimeInstance(1, 1); + Date var17 = new Date(); + Console.println("Today = " + var24.format(var17)); + Locale[] var19 = DateFormat.getAvailableLocales(); + Console.println("Avaliable Locales are:"); + + for(int var7 = 0; var7 < var19.length; ++var7) { + Locale.setDefault(var19[var7]); + Console.println(var19[var7].getDisplayName() + " " + var19[var7]); + } + + new Locale("en", "US"); + Locale var8 = new Locale("fr", "FR"); + Locale var9 = new Locale("de", "DE"); + Locale var10 = new Locale("ja", "JP"); + Locale var11 = new Locale("zh", "CN"); + Locale var12 = new Locale("th", "TH"); + Locale var13 = new Locale("ru", "RU"); + Locale var14 = new Locale("iw", "IL"); + Console.println("file.encoding = " + System.getProperty("file.encoding")); + Console.println(this.message("test-language", var8)); + Console.println(this.message("test-language", var9)); + Console.println(this.message("test-language", var10)); + Console.println(this.message("test-language", var11)); + Console.println(this.message("test-language", var12)); + Console.println(this.message("test-language", var13)); + Console.println(this.message("test-language", var14)); + Console.println(this.message("test-language", var23)); + } else if (var1.target == this.checkAccountItem) { + var15 = IniFile.override().getIniString("accountOverride", ""); + if (var15.equals("")) { + var4 = IniFile.override().getIniString("accountInfoPage", "account" + Console.message(".pl")); + if (wasHttpNoSuchFile(this.getScriptServer() + var4)) { + var4 = IniFile.override().getIniString("accountInfoPage", "account.pl"); + } + + (new SendURLAction(this.getScriptServer() + var4, true)).startBrowser(); + } else { + (new SendURLAction(var15)).startBrowser(); + } + + this.relogin(); + } else if (var1.target == this.upgradeItem) { + NetUpdate.doUpdate(true); + } else if (var1.target == this.channelItem && this.channelItem != null) { + Galaxy var22 = this.getGalaxy(); + var4 = ""; + assert(var22 != null); + if (var22 != null) { + var4 = var22.getChannel(); + } + + new ChannelDialog(getFrame(), this, Console.message("Dimension-Sel"), var4); + } else if (var1.target == this.becomeVIPItem) { + var15 = IniFile.override().getIniString("vipOverride", ""); + if (var15.equals("")) { + var4 = IniFile.override().getIniString("vipPage", "vip" + Console.message(".pl")); + if (wasHttpNoSuchFile(this.getScriptServer() + var4)) { + var4 = IniFile.override().getIniString("vipPage", "vip.pl"); + } + + (new SendURLAction(this.getScriptServer() + var4, true)).startBrowser(); + } else { + (new SendURLAction(var15, false)).startBrowser(); + } + + this.relogin(); + } else if (var1.target == this.numVisItem) { + new SetNumVisibleAvs(); + } else if (var1.target == this.inventoryItem) { + EquipAction var21 = new EquipAction(); + var21.trigger((NET.worlds.scape.Event)null, (Persister)null); + } else if (var1.target == this.proxyServerItem) { + System.out.println("Triggering the Proxy Server dialog."); + ProxyServerDialog var20 = new ProxyServerDialog(); + var20.show(); + } else if (var1.target == this.toggleVoiceChatItem) { + VoiceChat.setVoiceChatEnabled(!VoiceChat.voiceChatEnabled); + this.setMenusWRTVIP(); + } else if (var1.target == this.serverItem) { + this.handleServerItem(); + } else if (var1.target == this.condenseItem) { + new ArchiveMaker(true); + } else if (var1.target == this.expandItem) { + new ArchiveMaker(false); + } else if (var1.target == this.musicManItem) { + MusicManager.showDialog(); + } else if (var1.target == this.cdPlayerItem) { + if (this.cdcontrol == null) { + this.playedCD = true; + this.cdcontrol = new CDControl(getFrame(), this); + } + } else if (var1.target == this.volumeItem) { + if (!CDPlayerAction.launchVolumeControlApp()) { + new OkCancelDialog(getFrame(), (DialogReceiver)null, Console.message("No-Volume"), (String)null, Console.message("OK"), Console.message("Cannot-locate"), true); + } + } else if (var1.target == this.graphicsItem) { + this.handleGraphicsItem(); + } else if (var1.target == this.nametagItem) { + this.handleNametagsItem(); + } else if (var1.target == this.chatBoxItem) { + this.handleChatBoxItem(); + } else if (var1.target == this.bootSomeone) { + new BootDialog(getFrame(), this, Console.message("Boot-user")); + } else if (var1.target == this.broadcastToRoom) { + startWhispering("room"); + } else if (var1.target == this.broadcastToAll) { + startWhispering("world"); + } else if (var1.target == this.currentLang) { + var15 = Locale.getDefault().toString(); + if (var15 == Console.message(var15)) { + Console.println(Console.message("Current-Language") + " = " + Locale.getDefault().getDisplayName()); + } else { + Console.println(Console.message("Current-Language") + " = " + Console.message(var15)); + } + } else if (var1.target == this.recorderPlayItem) { + println(Console.message("BlackBoxPlay")); + BlackBox.getInstance().play(); + } else if (var1.target == this.recorderRecItem) { + println(Console.message("BlackBoxRec")); + BlackBox.getInstance().record(); + } else if (var1.target == this.recorderStopItem) { + println(Console.message("BlackBoxStop")); + BlackBox.getInstance().stop(); } else { - (new SendURLAction(languageURL, false)).startBrowser(); - } - - this.relogin(); - } else if (event.target == this.numVisItem) { - new SetNumVisibleAvs(); - } else if (event.target == this.inventoryItem) { - EquipAction eAction = new EquipAction(); - eAction.trigger((NET.worlds.scape.Event)null, (Persister)null); - } else if (event.target == this.checkInventoryItem) { - (new SendURLAction(this.getScriptServer() + "inventory.pl", true)).startBrowser(); - } else if (event.target == this.bankItem) { - (new SendURLAction(this.getScriptServer() + "bank.pl", true)).startBrowser(); - } else if (event.target == this.ubuItem) { - languageURL = IniFile.gamma().getIniString("UbuDestURL", this.getScriptServer() + "ubu.pl"); - (new SendURLAction(languageURL, true)).startBrowser(); - } else if (event.target == this.proxyServerItem) { - System.out.println("Triggering the Proxy Server dialog."); - ProxyServerDialog psd = new ProxyServerDialog(); - psd.show(); - } else if (event.target == this.toggleVoiceChatItem) { - VoiceChat.setVoiceChatEnabled(!VoiceChat.voiceChatEnabled); - this.setMenusWRTVIP(); - } else if (event.target == this.serverItem) { - this.handleServerItem(); - } else if (event.target == this.condenseItem) { - new ArchiveMaker(true); - } else if (event.target == this.expandItem) { - new ArchiveMaker(false); - } else if (event.target == this.musicManItem) { - MusicManager.showDialog(); - } else if (event.target == this.cdPlayerItem) { - if (this.cdcontrol == null) { - this.playedCD = true; - this.cdcontrol = new CDControl(getFrame(), this); - } - } else if (event.target == this.volumeItem) { - if (!CDPlayerAction.launchVolumeControlApp()) { - new OkCancelDialog(getFrame(), (DialogReceiver)null, Console.message("No-Volume"), (String)null, Console.message("OK"), Console.message("Cannot-locate"), true); - } - } else if (event.target == this.graphicsItem) { - this.handleGraphicsItem(); - } else if (event.target == this.nametagItem) { - this.handleNametagsItem(); - } else if (event.target == this.chatBoxItem) { - this.handleChatBoxItem(); - } else if (event.target == this.chatItem && this.chatItem != null) { - new ChatDialog(getFrame(), this, Console.message("Chat-Configuration"), IniFile.gamma().getIniInt("ChatFontSize", 12), chatLines, IniFile.gamma().getIniInt("ChatLengthLimit", 20000)); - } else if (event.target == this.bootSomeone) { - new BootDialog(getFrame(), this, Console.message("Boot-user")); - } else if (event.target == this.broadcastToRoom) { - startWhispering("room"); - } else if (event.target == this.broadcastToAll) { - startWhispering("world"); - } else if (event.target == this.currentLang) { - languageURL = Locale.getDefault().toString(); - if (languageURL == Console.message(languageURL)) { - Console.println(Console.message("Current-Language") + " = " + Locale.getDefault().getDisplayName()); + int var5; + String var6; + int var16; + if (this.fontItems != null && this.fontItems.contains(var1.target)) { + var15 = IniFile.gamma().getIniString("upgradeServer", "") + "/I18N/font_"; + + for(var16 = 0; var16 < this.fLength; ++var16) { + if (var1.target == this.fontItems.elementAt(var16)) { + if (this.fsList.elementAt(var16) != null) { + var15 = var15 + this.flList.elementAt(var16) + "_" + this.fsList.elementAt(var16) + ".EXE"; + } else { + var15 = var15 + this.flList.elementAt(var16) + ".EXE"; + } + + var5 = this.fSizes[var16]; + var6 = var15.substring(var15.lastIndexOf(47) + 1, var15.length()); + LanguageManager.handle(var15, var5, var6); + break; + } + } + } else if (this.downItems != null && this.downItems.contains(var1.target)) { + var15 = IniFile.gamma().getIniString("upgradeServer", "") + "/I18N/language_"; + + for(var16 = 0; var16 < this.dLength; ++var16) { + if (var1.target == this.downItems.elementAt(var16)) { + if (this.sList.elementAt(var16) != null) { + var15 = var15 + this.lList.elementAt(var16) + "_" + this.sList.elementAt(var16) + ".zip"; + IniFile.gamma().setIniString("DEFAULTLANGUAGE", (String)this.lList.elementAt(var16) + "_" + this.sList.elementAt(var16)); + } else { + var15 = var15 + this.lList.elementAt(var16) + ".zip"; + IniFile.gamma().setIniString("DEFAULTLANGUAGE", (String)this.lList.elementAt(var16)); + } + + var5 = this.lSizes[var16]; + var6 = var15.substring(var15.lastIndexOf(47) + 1, var15.length()); + LanguageManager.handle(var15, var5, var6); + break; + } + } + } else if (this.langItems != null && this.langItems.contains(var1.target)) { + for(int var3 = 0; var3 < lLength; ++var3) { + if (var1.target == this.langItems.elementAt(var3)) { + Locale.setDefault(newLocale[var3]); + var4 = newLocale[var3].toString(); + if (var4 == Console.message(var4)) { + Console.println(message("Setting-to") + " " + newLocale[var3].getDisplayName()); + } else { + Console.println(message("Setting-to") + " " + Console.message(var4)); + } + + IniFile.gamma().setIniString("DEFAULTLANGUAGE", lCodes[var3][0] + "_" + lCodes[var3][1]); + new OkCancelDialog(getFrame(), (DialogReceiver)null, Console.message("Alert"), (String)null, Console.message("OK"), Console.message("Change-exit"), true); + break; + } + } + } else if (this.avatarMenu == null || !this.avatarMenu.action(var1, var2)) { + return super.action(var1, var2); + } + } + } + + return true; + } + + public void setCurrentAvatarItem(CheckboxMenuItem var1) { + if (this.curAvatarItem != null) { + this.curAvatarItem.setState(false); + } + + this.curAvatarItem = var1; + if (this.curAvatarItem != null) { + this.curAvatarItem.setState(true); + } + + } + + public CheckboxMenuItem getCurrentAvatarItem() { + return this.curAvatarItem; + } + + public void deletedSavedAvatar(CheckboxMenuItem var1) { + if (this.curAvatarItem == var1) { + this.findAvatarMenuItem(this.getDefaultAvatarURL()); + } + + } + + public void setNextAvatar(URL var1, CheckboxMenuItem var2) { + synchronized(this.nextAvatarMutex) { + this.nextAvatar = var1; + this.nextAvatarItem = var2; + } + } + + private void findAvatarMenuItem(URL var1) { + synchronized(this.nextAvatarMutex) { + if (this.nextAvatarItem == null) { + Object var3; + if ((this.savedAvs == null || (var3 = this.savedAvs.findMenuItem(var1)) == null) && (this.avatarMenu == null || (var3 = this.avatarMenu.findMenuItem(var1)) == null)) { + this.setCurrentAvatarItem((CheckboxMenuItem)null); + } else { + this.setCurrentAvatarItem((CheckboxMenuItem)var3); + } + } + + } + } + + private URL getHelpGettingStarted() { + IniFile var1 = new IniFile("InstalledWorlds"); + String var2 = Console.message("Getting-started"); + String var3 = var1.getIniString("InstalledWorld0", ""); + if (!var3.equals("")) { + URL var4 = URL.make("home:" + var3 + "/" + var2); + File var5 = new File(var4.unalias()); + if (var5.exists()) { + return var4; + } + } + + return URL.make("home:" + var2); + } + + private void changeView(CheckboxMenuItem var1) { + this.chooseView = this.viewItems.indexOf(var1); + if (var1 != this.currentViewItem) { + this.currentViewItem.setState(false); + this.currentViewItem = var1; + this.currentViewItem.setState(true); + } + + } + + private int getView() { + return this.viewItems.indexOf(this.currentViewItem); + } + + private void setView(int var1) { + this.changeView((CheckboxMenuItem)this.viewItems.elementAt(var1)); + } + + private void changeCamSpeed(CheckboxMenuItem var1) { + this.chooseCamSpeed = this.camSpeedItems.indexOf(var1); + if (var1 != this.currentCamSpeedItem) { + this.currentCamSpeedItem.setState(false); + this.currentCamSpeedItem = var1; + this.currentCamSpeedItem.setState(true); + } + + } + + private void changeWhispers(CheckboxMenuItem var1) { + this.chooseWhisper = this.whisperItems.indexOf(var1); + if (var1 != this.currentWhisperItem) { + this.currentWhisperItem.setState(false); + this.currentWhisperItem = var1; + this.currentWhisperItem.setState(true); + } + } + + private void changeTeleport(CheckboxMenuItem var1) { + this.chooseTeleport = this.teleportItems.indexOf(var1); + if (var1 != this.currentTeleportItem) { + this.currentTeleportItem.setState(false); + this.currentTeleportItem = var1; + this.currentTeleportItem.setState(true); + } + } + + public void resetCamera() { + if (this.viewItems != null && this.camSpeedItems != null) { + this.chooseView = this.viewItems.indexOf(this.currentViewItem); + this.chooseCamSpeed = this.camSpeedItems.indexOf(this.currentCamSpeedItem); + } + } + + private void handleServerItem() { + if (!this.serverItem.getLabel().equals(signIn)) { + Galaxy.forceOffline(false); + } else { + this.getGalaxy().localForceOnline(); + this.getGalaxy().waitForConnection(this); + } + + } + + public UniversePanel getUniverse() { + return this.universeMode ? this.universe : null; + } + + public synchronized void setUniverseMode(boolean var1) { + if (var1 != this.universeMode) { + this.universeMode = var1; + if (this.universeMode) { + if (this.universe == null) { + this.universe = new UniversePanel(this); + this.renderAndUniverse.add("universe", this.universe); + } + + this.renderCard.show(this.renderAndUniverse, "universe"); + this.universe.startWatch(); + this.render.requestFocus(); } else { - Console.println(Console.message("Current-Language") + " = " + Console.message(languageURL)); - } - } else if (event.target == this.recorderPlayItem) { - println(Console.message("BlackBoxPlay")); - BlackBox.getInstance().play(); - } else if (event.target == this.recorderRecItem) { - println(Console.message("BlackBoxRec")); - BlackBox.getInstance().record(); - } else if (event.target == this.recorderStopItem) { - println(Console.message("BlackBoxStop")); - BlackBox.getInstance().stop(); - } else { - int sz; - String fName; - int i; - if (this.fontItems != null && this.fontItems.contains(event.target)) { - languageURL = IniFile.gamma().getIniString("upgradeServer", "") + "/I18N/font_"; - - for(i = 0; i < this.fLength; ++i) { - if (event.target == this.fontItems.elementAt(i)) { - if (this.fsList.elementAt(i) != null) { - languageURL = languageURL + (String)this.flList.elementAt(i) + "_" + (String)this.fsList.elementAt(i) + ".EXE"; - } else { - languageURL = languageURL + (String)this.flList.elementAt(i) + ".EXE"; - } - - sz = this.fSizes[i]; - fName = languageURL.substring(languageURL.lastIndexOf(47) + 1, languageURL.length()); - LanguageManager.handle(languageURL, sz, fName); - break; - } - } - } else if (this.downItems != null && this.downItems.contains(event.target)) { - languageURL = IniFile.gamma().getIniString("upgradeServer", "") + "/I18N/language_"; - - for(i = 0; i < this.dLength; ++i) { - if (event.target == this.downItems.elementAt(i)) { - if (this.sList.elementAt(i) != null) { - languageURL = languageURL + (String)this.lList.elementAt(i) + "_" + (String)this.sList.elementAt(i) + ".zip"; - IniFile.gamma().setIniString("DEFAULTLANGUAGE", (String)this.lList.elementAt(i) + "_" + (String)this.sList.elementAt(i)); - } else { - languageURL = languageURL + (String)this.lList.elementAt(i) + ".zip"; - IniFile.gamma().setIniString("DEFAULTLANGUAGE", (String)this.lList.elementAt(i)); - } - - sz = this.lSizes[i]; - fName = languageURL.substring(languageURL.lastIndexOf(47) + 1, languageURL.length()); - LanguageManager.handle(languageURL, sz, fName); - break; - } - } - } else if (this.langItems != null && this.langItems.contains(event.target)) { - for(int i = 0; i < lLength; ++i) { - if (event.target == this.langItems.elementAt(i)) { - Locale.setDefault(newLocale[i]); - code = newLocale[i].toString(); - if (code == Console.message(code)) { - Console.println(message("Setting-to") + " " + newLocale[i].getDisplayName()); - } else { - Console.println(message("Setting-to") + " " + Console.message(code)); - } - - IniFile.gamma().setIniString("DEFAULTLANGUAGE", lCodes[i][0] + "_" + lCodes[i][1]); - new OkCancelDialog(getFrame(), (DialogReceiver)null, Console.message("Alert"), (String)null, Console.message("OK"), Console.message("Change-exit"), true); - break; - } - } - } else if (this.avatarMenu == null || !this.avatarMenu.action(event, what)) { - return super.action(event, what); - } - } - } - - return true; - } - - public void setCurrentAvatarItem(CheckboxMenuItem item) { - if (this.curAvatarItem != null) { - this.curAvatarItem.setState(false); - } - - this.curAvatarItem = item; - if (this.curAvatarItem != null) { - this.curAvatarItem.setState(true); - } - - } - - public CheckboxMenuItem getCurrentAvatarItem() { - return this.curAvatarItem; - } - - public void deletedSavedAvatar(CheckboxMenuItem item) { - if (this.curAvatarItem == item) { - this.findAvatarMenuItem(this.getDefaultAvatarURL()); - } - - } - - public void setNextAvatar(URL url, CheckboxMenuItem item) { - synchronized(this.nextAvatarMutex) { - this.nextAvatar = url; - this.nextAvatarItem = item; - } - } - - private void findAvatarMenuItem(URL url) { - synchronized(this.nextAvatarMutex) { - if (this.nextAvatarItem == null) { - Object item; - if ((this.savedAvs == null || (item = this.savedAvs.findMenuItem(url)) == null) && (this.avatarMenu == null || (item = this.avatarMenu.findMenuItem(url)) == null)) { - this.setCurrentAvatarItem((CheckboxMenuItem)null); + this.renderCard.show(this.renderAndUniverse, "render"); + if (physMem < 64000000) { + this.renderAndUniverse.remove(this.universe); + this.universe.stopWatch(); + this.universe.flushImage(); + this.universe = null; + } + + this.renderAndUniverse.repaint(); + } + + } + } + + public void toggleUniverseMode() { + this.setUniverseMode(!this.universeMode); + } + + public boolean isUniverseMode() { + return this.universeMode; + } + + public Object imageButtonsCallback(Component var1, int var2) { + if (var1 != this.driveButton) { + if (var1 == this.quitButton) { + maybeQuit(); + } else if (var1 == this.exploreButton) { + this.toggleUniverseMode(); + } else if (var1 == this.menuButtons) { + switch(var2) { + case 0: + return this.getMenu("Help"); + case 1: + return this.getMenu("Options"); + case 2: + String var3 = IniFile.override().getIniString("ProductName", ""); + if (!var3.equalsIgnoreCase("RedLightWorld")) { + EMailPart.showMessage(this); + } + break; + case 3: + return (PopupMenu)this.marks.getMenu(); + case 4: + return (PopupMenu)this.marks.getLetsMenu(); + case 5: + this.actions.present(); + break; + case 6: + return this.getMenu("VIP"); + } + } + } + + return null; + } + + public RenderCanvas getRender() { + return this.render; + } + + public FriendsListPart getFriends() { + return this.friends; + } + + public MuteListPart getMutes() { + return this.mutes; + } + + public TarListPart getTars() { + return this.tars; + } + + public void generateFrameEvents(FrameEvent var1) { + if (Window.getWindowState(Window.getFrameHandle()) == 1) { + this.goToSleep(); + } + + if (doDrive) { + doDrive = false; + this.render.drive(); + wasDelta = true; + } + + super.generateFrameEvents(var1); + Pilot var2 = Pilot.getActive(); + GammaFrame var3 = getFrame(); + String var4 = var3.getTitle(); + String var5 = ""; + if (var2 != null) { + World var6 = var2.getWorld(); + if (var6 != null) { + String var7 = var6.getName(); + if (var7 != null) { + var5 = var7; + } + } + } + + if (!lastWorldName.equals(var5)) { + lastWorldName = var5; + String var14 = GammaFrame.getDefaultTitle(); + if (var5.length() != 0) { + var14 = var14 + " - " + var5; + if (!this.playedCD) { + CDAudio.startupPlay(); + this.playedCD = true; + } + } + + var3.setTitle(var14); + } + + if (var2 != null) { + if (this.chooseView != -1 || this.chooseCamSpeed != -1) { + int var15 = var2.getOutsideCameraMode(); + int var16 = var2.getOutsideCameraSpeed(); + int var8 = var15; + int var9 = var16; + if (this.chooseView != -1) { + var8 = ((DefaultConsole.CameraView)this.viewNames.elementAt(this.chooseView)).viewID; + } + + if (this.chooseCamSpeed != -1) { + var9 = ((DefaultConsole.CameraSpeed)this.speedNames.elementAt(this.chooseCamSpeed)).speedID; + } + + var2.setOutsideCameraMode(var8, var9); + if (var8 != 99) { + IniFile.gamma().setIniInt("CAM_MODE", var8); + IniFile.gamma().setIniInt("CAM_SPEED", var9); + } + + this.chooseView = -1; + this.chooseCamSpeed = -1; + } + + if (this.wasTeleporting != this.marks.isTeleporting()) { + this.wasTeleporting = this.marks.isTeleporting(); + if (this.wasTeleporting) { + this.statusMessage = loadingString; + } else if (this.statusMessage == loadingString) { + this.statusMessage = ""; + } + } + + this.checkVMWarning(); + if (wasDelta && !this.render.getDeltaMode()) { + this.statusMessage = arrowKeyMsg; + wasDelta = false; + this.driveButton.drawCursed(); + } + + if (this.chooseWhisper != -1 || this.chooseTeleport != -1) { + + int whisperValue = IniFile.gamma().getIniInt("WhisperPrivacy", 0); + int teleportValue = IniFile.gamma().getIniInt("TeleportPrivacy", 0); + + if (this.chooseWhisper != -1) { + whisperValue = ((WhisperPrivacy) this.whisperNames.elementAt(chooseWhisper)).whisperID; + } + + if (this.chooseTeleport != -1) { + teleportValue = ((TeleportPrivacy) this.teleportNames.elementAt(chooseTeleport)).teleportID; + } + + IniFile.gamma().setIniInt("WhisperPrivacy", whisperValue); + IniFile.gamma().setIniInt("TeleportPrivacy", teleportValue); + + this.chooseWhisper = -1; + this.chooseTeleport = -1; + } + + synchronized(this.status) { + if (this.statusMessage != this.lastStatus && this.overrideMessage == null) { + this.lastStatus = this.statusMessage; + this.status.setText(this.statusMessage); + } + } + + synchronized(this.nextAvatarMutex) { + if (this.nextAvatar != null) { + this.setAvatar(this.nextAvatar); + this.nextAvatar = null; + if (this.avatarMenu != null) { + this.avatarMenu.notifyOfChange(); + } + + if (this.nextAvatarItem != null) { + this.setCurrentAvatarItem(this.nextAvatarItem); + this.nextAvatarItem = null; + } + } + + } + } + } + + private void checkVMWarning() { + int var1 = Std.getFastTime(); + if (var1 > this.lastVMCheck + 10000) { + StatMemNode var2 = StatMemNode.getNode(); + var2.updateMemoryStatus(); + if (var2._availPageMem < 0) { + var2._availPageMem = 2000000000; + } + + if (var2._totPhysMem < 0) { + var2._totPhysMem = 2000000000; + } + + physMem = var2._totPhysMem; + if (var2._availPageMem >= 4194304) { + if (var2._availPageMem > 5242880 && this.lastVMBigWarning != 0) { + if (var2._availPageMem > 10485760) { + Console.println(Console.message("plenty-virt")); + this.lastVMBigWarning = 0; + } else if (!this.showedMidWarn) { + Console.println(Console.message("plenty-virt-mem")); + this.showedMidWarn = true; + } + + if (this.statusMessage == lowVMMsg) { + this.statusMessage = ""; + } + } } else { - this.setCurrentAvatarItem((CheckboxMenuItem)item); - } - } - - } - } - - private URL getHelpGettingStarted() { - IniFile ini = new IniFile("InstalledWorlds"); - String helpName = Console.message("Getting-started"); - String w = ini.getIniString("InstalledWorld0", ""); - if (!w.equals("")) { - URL name = URL.make("home:" + w + "/" + helpName); - File f = new File(name.unalias()); - if (f.exists()) { - return name; - } - } - - return URL.make("home:" + helpName); - } - - private void changeView(CheckboxMenuItem item) { - this.chooseView = this.viewItems.indexOf(item); - if (item != this.currentViewItem) { - this.currentViewItem.setState(false); - this.currentViewItem = item; - this.currentViewItem.setState(true); - } - - } - - private int getView() { - return this.viewItems.indexOf(this.currentViewItem); - } - - private void setView(int view) { - this.changeView((CheckboxMenuItem)this.viewItems.elementAt(view)); - } - - private void changeCamSpeed(CheckboxMenuItem item) { - this.chooseCamSpeed = this.camSpeedItems.indexOf(item); - if (item != this.currentCamSpeedItem) { - this.currentCamSpeedItem.setState(false); - this.currentCamSpeedItem = item; - this.currentCamSpeedItem.setState(true); - } - - } - - public void resetCamera() { - if (this.viewItems != null && this.camSpeedItems != null) { - this.chooseView = this.viewItems.indexOf(this.currentViewItem); - this.chooseCamSpeed = this.camSpeedItems.indexOf(this.currentCamSpeedItem); - } - } - - private void handleServerItem() { - if (!this.serverItem.getLabel().equals(signIn)) { - Galaxy.forceOffline(false); - } else { - this.getGalaxy().localForceOnline(); - this.getGalaxy().waitForConnection(this); - } - - } - - public UniversePanel getUniverse() { - return this.universeMode ? this.universe : null; - } - - public synchronized void setUniverseMode(boolean f) { - if (f != this.universeMode) { - this.universeMode = f; - if (this.universeMode) { - if (this.universe == null) { - this.universe = new UniversePanel(this); - this.renderAndUniverse.add("universe", this.universe); - } - - this.renderCard.show(this.renderAndUniverse, "universe"); - this.universe.startWatch(); - this.render.requestFocus(); - } else { - this.renderCard.show(this.renderAndUniverse, "render"); - if (physMem < 64000000) { - this.renderAndUniverse.remove(this.universe); - this.universe.stopWatch(); - this.universe.flushImage(); - this.universe = null; - } - - this.renderAndUniverse.repaint(); - } - - } - } - - public void toggleUniverseMode() { - this.setUniverseMode(!this.universeMode); - } - - public boolean isUniverseMode() { - return this.universeMode; - } - - public Object imageButtonsCallback(Component who, int which) { - if (who != this.driveButton) { - if (who == this.quitButton) { - maybeQuit(); - } else { - String prodName; - if (who == this.adCubeButton) { - prodName = IniFile.gamma().getIniString("AdCubeURL", "http://www.worlds.com/"); - (new SendURLAction(prodName, true)).startBrowser(); - } else if (who == this.exploreButton) { - this.toggleUniverseMode(); - } else if (who == this.menuButtons) { - switch (which) { - case 0: - return this.getMenu("Help"); - case 1: - return this.getMenu("Options"); - case 2: - prodName = IniFile.override().getIniString("ProductName", ""); - if (!prodName.equalsIgnoreCase("RedLightWorld") && !prodName.equalsIgnoreCase("RedLightCenter")) { - EMailPart.showMessage(this); - } - break; - case 3: - return (PopupMenu)this.marks.getMenu(); - case 4: - return (PopupMenu)this.marks.getLetsMenu(); - case 5: - this.actions.present(); - break; - case 6: - return this.getMenu("VIP"); - } - } - } - } - - return null; - } - - public RenderCanvas getRender() { - return this.render; - } - - public FriendsListPart getFriends() { - return this.friends; - } - - public MuteListPart getMutes() { - return this.mutes; - } - - public void generateFrameEvents(FrameEvent f) { - if (Window.getWindowState(Window.getFrameHandle()) == 1) { - this.goToSleep(); - } - - if (doDrive) { - doDrive = false; - this.render.drive(); - wasDelta = true; - } - - super.generateFrameEvents(f); - Pilot pilot = Pilot.getActive(); - GammaFrame frame = getFrame(); - String worldName = ""; - if (pilot != null) { - World world = pilot.getWorld(); - if (world != null) { - String name = world.getName(); - if (name != null) { - worldName = name; - } - } - } - - if (!lastWorldName.equals(worldName)) { - lastWorldName = worldName; - String newTitle = GammaFrame.getDefaultTitle(); - if (worldName.length() != 0) { - newTitle = newTitle + " - " + worldName; - if (!this.playedCD) { - CDAudio.startupPlay(); - this.playedCD = true; - } - } - - frame.setTitle(newTitle); - } - - if (pilot != null) { - if (this.chooseView != -1 || this.chooseCamSpeed != -1) { - int oldCameraMode = pilot.getOutsideCameraMode(); - int oldCameraSpeed = pilot.getOutsideCameraSpeed(); - int cameraMode = oldCameraMode; - int cameraSpeed = oldCameraSpeed; - if (this.chooseView != -1) { - cameraMode = ((CameraView)this.viewNames.elementAt(this.chooseView)).viewID; - } - - if (this.chooseCamSpeed != -1) { - cameraSpeed = ((CameraSpeed)this.speedNames.elementAt(this.chooseCamSpeed)).speedID; - } - - pilot.setOutsideCameraMode(cameraMode, cameraSpeed); - if (cameraMode != 99) { - IniFile.gamma().setIniInt("CAM_MODE", cameraMode); - IniFile.gamma().setIniInt("CAM_SPEED", cameraSpeed); - } - - this.chooseView = -1; - this.chooseCamSpeed = -1; - } - - if (this.wasTeleporting != this.marks.isTeleporting()) { - this.wasTeleporting = this.marks.isTeleporting(); - if (this.wasTeleporting) { - this.statusMessage = loadingString; - } else if (this.statusMessage == loadingString) { - this.statusMessage = ""; - } - } - - this.checkVMWarning(); - if (wasDelta && !this.render.getDeltaMode()) { - this.statusMessage = arrowKeyMsg; - wasDelta = false; - this.driveButton.drawCursed(); - } - - synchronized(this.status) { - if (this.statusMessage != this.lastStatus && this.overrideMessage == null) { - this.lastStatus = this.statusMessage; - this.status.setText(this.statusMessage); - } - } - - synchronized(this.nextAvatarMutex) { - if (this.nextAvatar != null) { - this.setAvatar(this.nextAvatar); - this.nextAvatar = null; - if (this.avatarMenu != null) { - this.avatarMenu.notifyOfChange(); - } - - if (this.nextAvatarItem != null) { - this.setCurrentAvatarItem(this.nextAvatarItem); - this.nextAvatarItem = null; - } - } - - } - } - } - - private void checkVMWarning() { - int now = Std.getFastTime(); - if (now > this.lastVMCheck + 10000) { - StatMemNode m = StatMemNode.getNode(); - m.updateMemoryStatus(); - if (m._availPageMem < 0) { - m._availPageMem = 2000000000; - } - - if (m._totPhysMem < 0) { - m._totPhysMem = 2000000000; - } - - physMem = m._totPhysMem; - if (m._availPageMem >= 4194304) { - if (m._availPageMem > 5242880 && this.lastVMBigWarning != 0) { - if (m._availPageMem > 10485760) { - Console.println(Console.message("plenty-virt")); - this.lastVMBigWarning = 0; - } else if (!this.showedMidWarn) { - Console.println(Console.message("plenty-virt-mem")); - this.showedMidWarn = true; - } - - if (this.statusMessage == lowVMMsg) { - this.statusMessage = ""; - } - } - } else { - if (this.lastVMBigWarning == 0 || this.showedMidWarn || now > this.lastVMBigWarning + 300000) { - Console.println(Console.message("Low-virt-mem")); - this.lastVMBigWarning = now; - this.showedMidWarn = false; - } - - this.statusMessage = lowVMMsg; - } - - Object[] arguments = new Object[]{new String(Std.getProductName()), new Integer(24)}; - if (startupMemCheck) { - if (m._totPhysMem < 24000000) { - String result = MessageFormat.format(Console.message("Mem-detected"), arguments); - new OkCancelDialog(getFrame(), (DialogReceiver)null, Console.message("Too-Little-RAM"), (String)null, Console.message("OK"), result, true); - } - - startupMemCheck = false; - System.out.println("System has " + m._totPhysMem + " bytes of physical RAM"); - } - - this.lastVMCheck = now; - } - - } - - public URL getAvatarName() { - return this.avatarURL; - } - - public void setServerURL(URL serverURL) { - super.setServerURL(serverURL); - } - - public void dialogDone(Object who, boolean confirmed) { - if (who instanceof QuitDialog) { - if (confirmed) { - Console.quit(); - } - } else { - String newChannel; - if (who instanceof BootDialog) { - if (confirmed) { - BootDialog bd = (BootDialog)who; - newChannel = bd.getBoot(); - if (!newChannel.equals("")) { - Pilot.sendText("world", "!boot " + newChannel); - } - } - } else { - int oldFontSize; - int oldLength; - if (who instanceof ChannelDialog) { - if (confirmed) { - ChannelDialog cd = (ChannelDialog)who; - newChannel = cd.getChannel(); - Pilot pilot = Pilot.getActive(); - String oldPos = pilot != null ? pilot.getURL() : null; - if (oldPos != null) { - oldFontSize = oldPos.indexOf("<"); - oldLength = oldPos.indexOf(">"); - if (oldFontSize >= 0 && oldLength > oldFontSize) { - TeleportAction.teleport(oldPos.substring(0, oldFontSize + 1) + newChannel + oldPos.substring(oldLength), (TeleportStatus)null); - } - } else { - Console.println(Console.message("cant-determine")); - } - } - } else if (who instanceof ChatDialog) { - if (confirmed) { - ChatDialog cd = (ChatDialog)who; - int newFontsize = cd.getFontsize(); - int newLines = cd.getLines(); - int newLength = cd.getLength(); - if (newLines < 6) { - newLines = 6; - } - - oldFontSize = IniFile.gamma().getIniInt("ChatFontSize", 12); - oldLength = IniFile.gamma().getIniInt("ChatLengthLimit", 20000); - if (newFontsize != oldFontSize || newLines != chatLines || newLength != oldLength) { - if (newFontsize != oldFontSize) { - IniFile.gamma().setIniInt("ChatFontSize", newFontsize); - } - - if (newLines != chatLines) { - chatLines = newLines; - IniFile.gamma().setIniInt("ChatLines", newLines); - } - - if (newLength != oldLength) { - NewSharedTextArea.chatLengthLimit = newLength; - ClassicSharedTextArea.chatLengthLimit = newLength; - IniFile.gamma().setIniInt("ChatLengthLimit", newLength); - } - - if (this.chat.listen.getComponent().getClass() == NewSharedTextArea.class) { - try { - NewSharedTextArea gta = (NewSharedTextArea)this.chat.listen.getComponent(); - gta.setFontSize(newFontsize); - gta.setRows(newLines); - gta.scrollToBottom(); - gta.setScrollBounds(); - } catch (Exception var10) { + if (this.lastVMBigWarning == 0 || this.showedMidWarn || var1 > this.lastVMBigWarning + 300000) { + Console.println(Console.message("Low-virt-mem")); + this.lastVMBigWarning = var1; + this.showedMidWarn = false; + } + + this.statusMessage = lowVMMsg; + } + + Object[] var3 = new Object[]{new String(Std.getProductName()), new Integer(24)}; + if (startupMemCheck) { + if (var2._totPhysMem < 24000000) { + String var4 = MessageFormat.format(Console.message("Mem-detected"), var3); + new OkCancelDialog(getFrame(), (DialogReceiver)null, Console.message("Too-Little-RAM"), (String)null, Console.message("OK"), var4, true); + } + + startupMemCheck = false; + System.out.println("System has " + var2._totPhysMem + " bytes of physical RAM"); + } + + this.lastVMCheck = var1; + } + + } + + public URL getAvatarName() { + return this.avatarURL; + } + + public void setServerURL(URL var1) { + super.setServerURL(var1); + } + + public void dialogDone(Object var1, boolean var2) { + if (var1 instanceof QuitDialog) { + if (var2) { + Console.quit(); + } + } else { + String var4; + if (var1 instanceof BootDialog) { + if (var2) { + BootDialog var3 = (BootDialog)var1; + var4 = var3.getBoot(); + if (!var4.equals("")) { + Pilot.sendText("world", "!boot " + var4); + } + } + } else if (var1 instanceof ChannelDialog) { + if (var2) { + ChannelDialog var9 = (ChannelDialog)var1; + var4 = var9.getChannel(); + Pilot var5 = Pilot.getActive(); + String var6 = var5 != null ? var5.getURL() : null; + if (var6 != null) { + int var7 = var6.indexOf("<"); + int var8 = var6.indexOf(">"); + if (var7 >= 0 && var8 > var7) { + TeleportAction.teleport(var6.substring(0, var7 + 1) + var4 + var6.substring(var8), (TeleportStatus)null); } - } - - int h = chatLines * this.chat.listen.getComponent().getFontMetrics(this.chat.listen.getFont()).getHeight(); - h -= 96; - if (h > 0 && this.adFiller != null) { - this.adFiller.setHeight(h); - } - - Console.frame.validate(); - Console.frame.repaint(); - } - } - } else if (who instanceof LoginWizard) { - assert false; - } else if (who instanceof CDControl) { - if (this.cdcontrol == who) { - this.cdcontrol = null; - } - } else if (who instanceof InternetConnectionDialog) { - assert false; - } else if (who == this.reloginDialog) { - if (confirmed) { - Galaxy.forceOffline(true); - } - - this.reloginDialog = null; - } - } - } - - } - - public void setAvatar(URL url) { - this.avatarURL = url; - boolean isVIPAv = url.getInternal().toLowerCase().endsWith(".rwg"); - boolean hasAmnesty = url.equals(getDefaultURL()) && !this.getGalaxy().getOnline(); - if (!this.getVIP() && isVIPAv && !hasAmnesty) { - Console.println(Console.message("Only-VIPs") + " '" + SelectAvatarAction.getPrettyAvatarName(url.getBase()) + "'."); - } else if (VehicleShape.isVehicle(url)) { - this.tempCarAvatar = url.getAbsolute(); - super.setAvatar(url); - } else { - this.tempCarAvatar = ""; - if (this.avatarMenu != null) { - this.avatarMenu.customize.setEnabled(!url.getAbsolute().endsWith("mov")); - } - - if (!url.equals(this.getDefaultAvatarURL())) { - if (this.getVIPAvatars()) { - if (!isVIPAv) { - IniFile.gamma().setIniString("VIPAVATAR", ""); - } else { - IniFile.gamma().setIniString("VIPAVATAR", url.getAbsolute()); - } - } - - if (!isVIPAv) { - IniFile.gamma().setIniString("AVATAR", url.getAbsolute()); - } - } - - super.setAvatar(url); - } - } - - private CheckboxMenuItem findAvatar(Vector items, String name) { - if (items != null) { - int count = items.size(); - - for(int i = 0; i < count; ++i) { - CheckboxMenuItem item = (CheckboxMenuItem)items.elementAt(i); - if (item.getLabel().equals(name)) { - return item; - } - } - } - - return null; - } - - protected void loadPilot(URL url) { - super.loadPilot(url); - this.findAvatarMenuItem(url); - } - - public void setChatname(String chatname) { - assert chatname != null; - - if (chatname.length() != 0) { - String nameStr = (this.getVIP() ? (vip > 1 ? Console.message("VIP") + " " : Console.message("vip")) + " " : "") + "\"" + Console.parseUnicode(chatname) + "\""; - this.yourName.setText(nameStr); - IniFile.gamma().setIniString("LASTCHATNAME", parseExtended(nameStr)); - } else { - this.yourName.setText(Console.message("Off-line")); - } - - } - - public void connectionCallback(Object caller, boolean connected) { - super.connectionCallback(caller, connected); - if (caller instanceof Galaxy) { - if (caller != this.galaxy) { - return; - } - - if (connected) { - WorldServer serv = this.getServerNew(); - this.friends.setServer(serv, this.getGalaxy().getIniSection()); - this.mutes.setServer(serv, this.getGalaxy().getIniSection()); - if (vip < 2) { - Console.println(vip == 1 ? Console.message("Press-full-VIP") : Console.message("Press-VIP")); - } - - PosableShape.downloadPermittedNames(); - } - } - - } - - public void galaxyDisconnected() { - super.galaxyDisconnected(); - this.getFriends().maybeServerDisconnect(); - } - - public boolean okToQuit() { - int quitDlg = IniFile.override().getIniInt("QuitDialog", 1); - - try { - if (quitDlg == 1) { + } else { + Console.println(Console.message("cant-determine")); + } + } + } else if (var1 instanceof LoginWizard) { + assert(false); + } else if (var1 instanceof CDControl) { + if (this.cdcontrol == var1) { + this.cdcontrol = null; + } + } else if (var1 instanceof InternetConnectionDialog) { + assert(false); + } else if (var1 == this.reloginDialog) { + if (var2) { + Galaxy.forceOffline(true); + } + + this.reloginDialog = null; + } + } + + } + + public void setAvatar(URL var1) { + this.avatarURL = var1; + boolean var2 = var1.getInternal().toLowerCase().endsWith(".rwg"); + boolean var3 = var1.equals(getDefaultURL()) && !this.getGalaxy().getOnline(); + if (!this.getVIPAvatars() && var2 && !var3) { + Console.println(Console.message("Only-VIPs") + " '" + SelectAvatarAction.getPrettyAvatarName(var1.getBase()) + "'."); + } else if (VehicleShape.isVehicle(var1)) { + this.tempCarAvatar = var1.getAbsolute(); + super.setAvatar(var1); + } else { + this.tempCarAvatar = ""; + if (this.avatarMenu != null) { + this.avatarMenu.customize.setEnabled(!var1.getAbsolute().endsWith("mov")); + } + + if (!var1.equals(this.getDefaultAvatarURL())) { + if (this.getVIPAvatars()) { + if (!var2) { + IniFile.gamma().setIniString("VIPAVATAR", ""); + } else { + IniFile.gamma().setIniString("VIPAVATAR", var1.getAbsolute()); + } + } + + if (!var2) { + IniFile.gamma().setIniString("AVATAR", var1.getAbsolute()); + } + } + + super.setAvatar(var1); + } + } + + private CheckboxMenuItem findAvatar(Vector var1, String var2) { + if (var1 != null) { + int var3 = var1.size(); + + for(int var4 = 0; var4 < var3; ++var4) { + CheckboxMenuItem var5 = (CheckboxMenuItem)var1.elementAt(var4); + if (var5.getLabel().equals(var2)) { + return var5; + } + } + } + + return null; + } + + protected void loadPilot(URL var1) { + super.loadPilot(var1); + this.findAvatarMenuItem(var1); + } + + public void setChatname(String var1) { + assert(var1 != null); + if (var1.length() != 0) { + String var2 = (this.getVIP() ? (vip > 1 ? Console.message("VIP") + " " : Console.message("vip")) + " " : "") + "\"" + Console.parseUnicode(var1) + "\""; + this.yourName.setText(var2); + IniFile.gamma().setIniString("LASTCHATNAME", parseExtended(var2)); + } else { + this.yourName.setText(Console.message("Off-line")); + } + + } + + public void connectionCallback(Object var1, boolean var2) { + super.connectionCallback(var1, var2); + if (var1 instanceof Galaxy) { + if (var1 != this.galaxy) { + return; + } + + if (var2) { + WorldServer var3 = this.getServerNew(); + this.friends.setServer(var3, this.getGalaxy().getIniSection()); + this.mutes.setServer(var3, this.getGalaxy().getIniSection()); + this.tars.setServer(var3, this.getGalaxy().getIniSection()); + if (vip < 2) { + Console.println(vip == 1 ? Console.message("Press-full-VIP") : Console.message("Press-VIP")); + } + + PosableShape.downloadPermittedNames(); + } + } + + } + + public void galaxyDisconnected() { + super.galaxyDisconnected(); + this.getFriends().maybeServerDisconnect(); + } + + public boolean okToQuit() { + int var1 = IniFile.override().getIniInt("QuitDialog", 1); + if (var1 == 1) { new QuitDialog(getFrame(), this); return false; - } - } catch (Exception var3) { - } - - return true; - } - - public Rectangle getBrowserPlacement() { - String coords = IniFile.gamma().getIniString("BROWSERWINDOW", ""); - if (coords.length() != 0) { - StringTokenizer tok = new StringTokenizer(coords, " ,"); - - try { - return new Rectangle(Integer.parseInt(tok.nextToken()), Integer.parseInt(tok.nextToken()), Integer.parseInt(tok.nextToken()), Integer.parseInt(tok.nextToken())); - } catch (NumberFormatException var9) { - } catch (NoSuchElementException var10) { - } - } - - int w = this.menuButtons.getLocationOnScreen().x - (int)((double)this.menuButtons.getSize().width * 0.7); - int frameWidth = Window.getSystemMetrics(32); - int screenWidth = Toolkit.getDefaultToolkit().getScreenSize().width; - int minWidth = Math.min(screenWidth, 640) + 2 * frameWidth; - int x = 0; - if (w != minWidth) { - if (w > minWidth) { - x += w - minWidth; - } - - w = minWidth; - } - - if (w > screenWidth) { - x += -frameWidth; - } - - int h = this.chat.listen.getLocationOnScreen().y + this.chat.listen.getSize().height - this.chat.line.getSize().height; - int y = 0; - if (h > maxWebSize) { - y += h - maxWebSize; - h = maxWebSize; - } - - return new Rectangle(x, y, w, h); - } - - 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, "Avatar"), "rwg;mov"); - } else if (mode == 1) { - ret = this.lastPilotRequested; - } else if (mode == 2) { - this.setNextAvatar((URL)value, (CheckboxMenuItem)null); - } - break; - case 1: - if (mode == 0) { - ret = BooleanPropertyEditor.make(new Property(this, index, "Collect garbage"), "No", "Yes"); - } else if (mode == 1) { - ret = new Boolean(false); - } else if (mode == 2 && (Boolean)value) { - System.gc(); - System.runFinalization(); - } - break; - default: - ret = super.properties(index, offset + 2, mode, value); - } - - return ret; - } - - public void saveState(Saver s) throws IOException { - s.saveVersion(0, classCookie); - super.saveState(s); - } - - public void restoreState(Restorer r) throws IOException, TooNewException { - int vers = r.restoreVersion(classCookie); - switch (vers) { - case 0: - super.restoreState(r); - return; - default: - throw new TooNewException(); - } - } - - public class CameraSpeed { - public String speedName; - public int speedID; - - public CameraSpeed(String sn, int sid) { - this.speedName = sn; - this.speedID = sid; - } - } - - public class CameraView { - public String viewName; - public int viewID; - - public CameraView(String vn, int vid) { - this.viewName = vn; - this.viewID = vid; - } - } + } else { + return true; + } + } + + public Rectangle getBrowserPlacement() { + String var1 = IniFile.gamma().getIniString("BROWSERWINDOW", ""); + if (var1.length() != 0) { + StringTokenizer var2 = new StringTokenizer(var1, " ,"); + + try { + return new Rectangle(Integer.parseInt(var2.nextToken()), Integer.parseInt(var2.nextToken()), Integer.parseInt(var2.nextToken()), Integer.parseInt(var2.nextToken())); + } catch (NumberFormatException var10) { + } catch (NoSuchElementException var11) { + } + } + + Point var12 = this.menuButtons.getLocationOnScreen(); + int var3 = this.menuButtons.getLocationOnScreen().x - (int)((double)this.menuButtons.getSize().width * 0.7D); + int var4 = Window.getSystemMetrics(32); + int var5 = Toolkit.getDefaultToolkit().getScreenSize().width; + int var6 = Math.min(var5, 640) + 2 * var4; + int var7 = 0; + if (var3 != var6) { + if (var3 > var6) { + var7 += var3 - var6; + } + + var3 = var6; + } + + if (var3 > var5) { + var7 += -var4; + } + + int var8 = this.chat.listen.getLocationOnScreen().y + this.chat.listen.getSize().height - this.chat.line.getSize().height; + int var9 = 0; + if (var8 > 540) { + var9 += var8 - 540; + var8 = 540; + } + + return new Rectangle(var7, var9, var3, var8); + } + + public Object properties(int var1, int var2, int var3, Object var4) throws NoSuchPropertyException { + Object var5 = null; + switch(var1 - var2) { + case 0: + if (var3 == 0) { + var5 = URLPropertyEditor.make(new Property(this, var1, "Avatar"), "rwg;mov;rwx"); + } else if (var3 == 1) { + var5 = this.lastPilotRequested; + } else if (var3 == 2) { + this.setNextAvatar((URL)var4, (CheckboxMenuItem)null); + } + break; + case 1: + if (var3 == 0) { + var5 = BooleanPropertyEditor.make(new Property(this, var1, "Collect garbage"), "No", "Yes"); + } else if (var3 == 1) { + var5 = new Boolean(false); + } else if (var3 == 2 && ((Boolean)var4).booleanValue()) { + System.gc(); + System.runFinalization(); + } + break; + default: + var5 = super.properties(var1, var2 + 2, var3, var4); + } + + return var5; + } + + public void saveState(Saver var1) throws IOException { + var1.saveVersion(0, classCookie); + super.saveState(var1); + } + + public void restoreState(Restorer var1) throws IOException, TooNewException { + int var2 = var1.restoreVersion(classCookie); + switch(var2) { + case 0: + super.restoreState(var1); + return; + default: + throw new TooNewException(); + } + } + + static { + lLength = lNames.length; + lLangs = new MenuItem[lLength]; + newLocale = new Locale[lLength]; + lCodes = new String[lLength][2]; + signIn = Console.message("Sign-In"); + signOut = Console.message("Sign-Out"); + signingIn = Console.message("Signing-In"); + noMultiUser = Console.message("Network"); + enable3D = Console.message("Enable3D"); + disable3D = Console.message("Disable3D"); + showTags = Console.message("ShowNametags"); + hideTags = Console.message("HideNametags"); + enableClassicChat = Console.message("EnableClassicChat"); + disableClassicChat = Console.message("DisableClassicChat"); + sleepStatus = Console.message("Sleeping"); + lastWorldName = ""; + lowVMMsg = Console.message("Low-virt"); + startupMemCheck = true; + classCookie = new Object(); + } + + private class CameraSpeed { + public String speedName; + public int speedID; + + public CameraSpeed(String var2, int var3) { + this.speedName = var2; + this.speedID = var3; + } + } + + private class CameraView { + public String viewName; + public int viewID; + + public CameraView(String var2, int var3) { + this.viewName = var2; + this.viewID = var3; + } + } + + private class WhisperPrivacy { + public String whisperName; + public int whisperID; + + public WhisperPrivacy(String var2, int var3) { + this.whisperName = var2; + this.whisperID = var3; + } + } + + private class TeleportPrivacy { + public String teleportName; + public int teleportID; + + public TeleportPrivacy(String var2, int var3) { + this.teleportName = var2; + this.teleportID = var3; + } + } } diff -ruN a/1920/NET/worlds/console/FriendsListPart.java b/1920/NET/worlds/console/FriendsListPart.java --- a/1920/NET/worlds/console/FriendsListPart.java 2024-01-08 01:46:28.000000000 -0600 +++ b/1920/NET/worlds/console/FriendsListPart.java 2023-08-21 23:27:17.000000000 -0500 @@ -1,15 +1,9 @@ package NET.worlds.console; +import NET.worlds.core.Debug; import NET.worlds.core.IniFile; import NET.worlds.core.Std; -import NET.worlds.network.BuddyListUpdateCmd; -import NET.worlds.network.Galaxy; -import NET.worlds.network.InfiniteWaitException; -import NET.worlds.network.NetUpdate; -import NET.worlds.network.PacketTooLargeException; -import NET.worlds.network.WorldServer; -import NET.worlds.network.netPacket; -import NET.worlds.network.whisperCmd; +import NET.worlds.network.*; import NET.worlds.scape.AnimatedActionManager; import NET.worlds.scape.Drone; import NET.worlds.scape.FrameEvent; @@ -19,6 +13,7 @@ import NET.worlds.scape.PosableShape; import NET.worlds.scape.TeleportAction; import NET.worlds.scape.TeleportStatus; + import java.awt.Color; import java.awt.Container; import java.awt.Dimension; @@ -29,961 +24,976 @@ import java.awt.Menu; import java.awt.MenuItem; import java.awt.PopupMenu; +import java.awt.Window; import java.awt.image.ImageObserver; import java.io.IOException; import java.text.MessageFormat; -import java.util.Collections; -import java.util.Comparator; import java.util.Enumeration; import java.util.StringTokenizer; import java.util.Vector; -public class FriendsListPart extends QuantizedCanvas implements FramePart, DialogReceiver, DialogDisabled, NameListOwner, Comparator { - private static final long serialVersionUID = 2875678557235430189L; - private static final String oldIniItemName = "Friends"; - private static final String iniItemName = "Friend"; - private static int maxFriends = Gamma.shaperEnabled() ? 500 : 250; - private static int absMaxFriends = 600; - private static final String separator = ";"; - private static final String whereQuery = "&|+where?"; - private static final String whereResponse = "&|+where>"; - VoiceChat chatter = new VoiceChat(); - private static final int MOUSEMOVE = 0; - private static final int MOUSEDRAG = 1; - private static final int MOUSEDOWN = 2; - private static final int MOUSEUP = 3; - private static final int MOUSEENTER = 4; - private static final int MOUSEEXIT = 5; - private static final int BLANK = 0; - private static final int NORMAL = 1; - private static final int CURSED = 2; - private static final int DOWN = 3; - private static final int TELEPORT_IDLE = 0; - private static final int TELEPORT_REQUEST_LOCATION = 1; - private static final int TELEPORT_WAIT_FOR_LOCATION = 2; - private static final int buttonWidth = 97; - private static final int buttonHeight = 11; - private static final int xText = 20; - private static final int yText = 9; - private static final int xTextClip = 94; - private static Image friendsImage; - private static Image moreFriendsImage; - private static Font font; - private static FriendsListPart active; - private Vector friends = new Vector(); - private Vector onlineFriends = new Vector(); - private Vector mutedOnlineFriends = new Vector(); - private Vector serverUpdates = new Vector(); - private Object friendsMutex = new Object(); - private int cursedButton = -1; - private int clickedButton = -1; - private boolean clickedButtonDown; - private PopupMenu menu; - private MenuItem teleportItem = new MenuItem(Console.message("Go-There")); - private MenuItem emailItem = new MenuItem(Console.message("E-Mail")); - private MenuItem muteItem = new MenuItem(Console.message("Mute")); - private MenuItem whisperItem = new MenuItem(Console.message("Whisper")); - private MenuItem voiceChatItem = new MenuItem(Console.message("Voice-Chat")); - private MenuItem infoItem = new MenuItem(Console.message("Personal-I")); - private MenuItem tradeItem = new MenuItem(Console.message("Talk-Trade")); - private PopupMenu droneMenu; - private MenuItem droneAddItem = new MenuItem(Console.message("Add-2-friends")); - private MenuItem droneEmailItem = new MenuItem(Console.message("E-Mail")); - private MenuItem droneMuteItem = new MenuItem(Console.message("Mute")); - private MenuItem droneWhisperItem = new MenuItem(Console.message("Whisper")); - private MenuItem droneVoiceChatItem = new MenuItem(Console.message("Voice-Chat")); - private MenuItem droneInfoItem = new MenuItem(Console.message("Personal-I")); - private MenuItem droneTradeItem = new MenuItem(Console.message("Talk-Trade")); - private String activeFriendName = ""; - private String teleportTarget; - private int teleportState = 0; - private int teleportWaitStartTime; - private boolean teleportWaitSentMsg; - private int friendsButtons; - private int moreFriendsButton; - private boolean moreFriendsActive; - private MenuItem editItem; - private Menu actionMenu; - private MoreFriendsDialog moreFriendsDialog; - private DefaultConsole console; - private Galaxy galaxy; - private IniFile serverSection; - private boolean isDialogDisabled; - private int showMenuY = -1; - private static final String voiceChatWhisper = "&|+voicechat"; - - public FriendsListPart() { - AnimatedActionManager.get(); - String prodName; - if (font == null) { - prodName = IniFile.override().getIniString("friendsGif", "friends.gif"); - friendsImage = ImageCanvas.getSystemImage(prodName, this); - String moreFriendsGif = IniFile.override().getIniString("moreFriendsGif", Console.message("mfriends.gif")); - moreFriendsImage = ImageCanvas.getSystemImage(moreFriendsGif, this); - int fontSize = new Integer(Console.message("FriendsPointSize")); - font = new Font(Console.message("FriendsFont"), 0, fontSize); - } - - this.teleportItem.setFont(font); - this.emailItem.setFont(font); - this.muteItem.setFont(font); - this.whisperItem.setFont(font); - this.tradeItem.setFont(font); - this.voiceChatItem.setFont(font); - this.infoItem.setFont(font); - this.menu = new PopupMenu(); - this.menu.add(this.teleportItem); - prodName = IniFile.override().getIniString("ProductName", ""); - if (!prodName.equalsIgnoreCase("RedLightWorld") && !prodName.equalsIgnoreCase("RedLightCenter")) { - this.menu.add(this.emailItem); - } - - this.menu.add(this.muteItem); - this.menu.add(this.whisperItem); - boolean allowTrading = IniFile.gamma().getIniInt("EnableTrading", 0) == 1 || NetUpdate.isInternalVersion(); - if (allowTrading) { - this.menu.add(this.tradeItem); - } - - this.menu.add(this.voiceChatItem); - if (!VoiceChat.voiceChatAvailable()) { - this.voiceChatItem.setEnabled(false); - } - - this.menu.add(this.infoItem); - this.add(this.menu); - this.droneAddItem.setFont(font); - this.droneEmailItem.setFont(font); - this.droneMuteItem.setFont(font); - this.droneWhisperItem.setFont(font); - this.droneTradeItem.setFont(font); - this.droneVoiceChatItem.setFont(font); - this.droneInfoItem.setFont(font); - this.droneMenu = new PopupMenu(); - this.droneMenu.setFont(font); - this.droneMenu.add(this.droneAddItem); - this.droneMenu.add(this.droneEmailItem); - this.droneMenu.add(this.droneMuteItem); - this.droneMenu.add(this.droneWhisperItem); - if (allowTrading) { - this.droneMenu.add(this.droneTradeItem); - } - - this.droneMenu.add(this.droneVoiceChatItem); - if (!VoiceChat.voiceChatAvailable()) { - this.droneVoiceChatItem.setEnabled(false); - } - - this.droneMenu.add(this.droneInfoItem); - } - - public void update(Graphics g) { - this.paint(g); - } - - public void paint(Graphics g) { - int height = this.getSize().height; - int buttons = height / 11; - synchronized(this.friendsMutex) { - int count = this.onlineFriends.size(); - this.moreFriendsButton = buttons - 1; - if (count >= buttons) { - this.friendsButtons = buttons - 1; - this.moreFriendsActive = true; - } else { - this.friendsButtons = count; - this.moreFriendsActive = false; - } - - int y = buttons * 11; - int extra = height - y; - if (extra > 0) { - g.setColor(Color.black); - g.fillRect(0, 0, 97, extra); - } - - for(int i = 0; i < buttons; ++i) { - int state = 1; - if (i >= this.friendsButtons && !this.isMoreFriendsButton(i)) { - state = 0; - } else if (i == this.clickedButton) { - state = this.clickedButtonDown ? 3 : 1; - } else if (i == this.cursedButton) { - state = 2; - } - - this.drawButton(g, i, state); - } - - } - } - - public int getRemainder(int proposedHeight) { - int buttons = proposedHeight / 11; - int y = buttons * 11; - return proposedHeight - y; - } - - public Dimension preferredSize() { - return new Dimension(97, 1); - } - - public Dimension minimumSize() { - return this.preferredSize(); - } - - public boolean mouseMove(Event e, int x, int y) { - return this.buttonAction(x, y, 0); - } - - public boolean mouseDown(Event e, int x, int y) { - return this.buttonAction(x, y, 2); - } - - public boolean mouseUp(Event e, int x, int y) { - if (this.buttonAction(x, y, 3)) { - if (this.showMenuY != -1) { - this.menu.show(this, 0, this.showMenuY); - this.showMenuY = -1; - } - - return true; - } else { - return false; - } - } - - public boolean mouseDrag(Event e, int x, int y) { - return this.buttonAction(x, y, 1); - } - - public boolean mouseEnter(Event e, int x, int y) { - return this.buttonAction(x, y, 4); - } - - public boolean mouseExit(Event e, int x, int y) { - return this.buttonAction(x, y, 5); - } - - public boolean handleEvent(Event event) { - return this.isDialogDisabled ? false : super.handleEvent(event); - } - - private void loadFriends() { - if (this.friends.size() != 0) { - this.friends.removeAllElements(); - } - - if (Console.getActive().broadcastEnabled()) { - maxFriends = 600; - } - - for(int i = 0; i < absMaxFriends; ++i) { - String name = this.serverSection.getIniString("Friend" + i, ""); - if (name.length() == 0) { - break; - } - - if (isValidUserName(name) && !icontains(this.friends, name)) { - this.friends.addElement(name); - } - } - - if (this.friends.size() == 0) { - String friendsStr = this.serverSection.getIniString("Friends", ""); - StringTokenizer tokens = new StringTokenizer(friendsStr, ";"); - - while(tokens.hasMoreTokens() && this.friends.size() < absMaxFriends) { - String name = tokens.nextToken(); - if (isValidUserName(name) && !icontains(this.friends, name)) { - this.friends.addElement(name); - } - } +public class FriendsListPart extends QuantizedCanvas implements FramePart, DialogReceiver, DialogDisabled, NameListOwner { - if (this.friends.size() != 0) { - this.saveFriends(); - this.serverSection.setIniString("Friends", ""); - } - } - - Collections.sort(this.friends, this); - } - - void saveFriends() { - if (this.serverSection != null) { - int count = this.friends.size(); - - for(int i = 0; i < count; ++i) { - this.serverSection.setIniString("Friend" + i, (String)this.friends.elementAt(i)); - } - - this.serverSection.setIniString("Friend" + count, ""); - } - } - - private boolean isMoreFriendsButton(int button) { - return button == this.moreFriendsButton && this.moreFriendsActive; - } - - private Graphics drawButton(Graphics g, int button, int state) { - Image image = button == this.moreFriendsButton ? moreFriendsImage : friendsImage; - if (g != null || (g = this.getGraphics()) != null) { - int y = button * 11; - Graphics g1 = g.create(0, y, 97, 11); - g1.drawImage(image, -state * 97, 0, (ImageObserver)null); - if (button >= 0 && button < this.friendsButtons && button < this.onlineFriends.size()) { - g1.clipRect(0, 0, 94, 11); - g1.setFont(font); - g1.setColor(Color.white); - g1.drawString((String)this.onlineFriends.elementAt(button), 20, 9); - } - - g1.dispose(); - } - - return g; - } - - private boolean buttonAction(int x, int y, int action) { - synchronized(this.friendsMutex) { - Graphics g = null; - int button = y / 11; - if ((button < 0 || button >= this.friendsButtons) && !this.isMoreFriendsButton(button)) { - button = -1; - } - - if (action != 0 && action != 4) { - if (action == 5) { - if (this.cursedButton != -1) { - g = this.drawButton(g, this.cursedButton, 1); - this.cursedButton = -1; - } - - if (this.clickedButton != -1 && this.clickedButtonDown) { - g = this.drawButton(g, this.clickedButton, 1); - this.clickedButtonDown = false; - } - } else if (action == 2) { - if (this.clickedButton != -1) { - g = this.drawButton(g, this.clickedButton, 1); - this.clickedButtonDown = false; - } - - if ((this.clickedButton = button) != -1) { - g = this.drawButton(g, this.clickedButton, 3); - this.clickedButtonDown = true; - } - } else if (action == 1) { - if (this.clickedButton != -1) { - if (this.clickedButtonDown) { - if (button != this.clickedButton) { - g = this.drawButton(g, this.clickedButton, 1); - this.clickedButtonDown = false; - } - } else if (button == this.clickedButton) { - g = this.drawButton(g, this.clickedButton, 3); - this.clickedButtonDown = true; - } - } - } else if (action == 3) { - this.cursedButton = button; - if (this.clickedButtonDown) { - if (this.cursedButton == this.clickedButton) { - g = this.drawButton(g, this.clickedButton, 2); - } else { - g = this.drawButton(g, this.clickedButton, 1); - } - - if (this.clickedButton == this.moreFriendsButton) { - if (this.moreFriendsDialog == null) { - this.moreFriendsDialog = new MoreFriendsDialog(this, this.menu, this.onlineFriends); - } - } else if (this.clickedButton >= 0 && this.clickedButton < this.onlineFriends.size()) { - this.activeFriendName = (String)this.onlineFriends.elementAt(this.clickedButton); - - assert this.activeFriendName != null; - - this.showMenuY = (this.clickedButton + 1) * 11; - } - } - - if (this.cursedButton != this.clickedButton) { - g = this.drawButton(g, this.cursedButton, 2); - } - - this.clickedButtonDown = false; - this.clickedButton = -1; - } - } else if (button != this.cursedButton) { - g = this.drawButton(g, this.cursedButton, 1); - g = this.drawButton(g, this.cursedButton = button, 2); - } - - if (g != null) { - g.dispose(); - } - - return true; - } - } - - private static boolean sendMsg(WorldServer server, netPacket packet) { - try { - server.sendNetworkMsg(packet); - return true; - } catch (InfiniteWaitException var3) { - } catch (PacketTooLargeException var4) { - } - - return false; - } - - public void activate(Console c, Container f, Console prev) { - active = this; - this.console = (DefaultConsole)c; - this.console.getRender().add(this.droneMenu); - this.editItem = c.addMenuItem(Console.message("Edit-Friends"), "Options"); - this.editItem.setEnabled(this.friends != null); - } - - public void deactivate() { - active = null; - this.editItem = null; - } - - public boolean action(Event event, Object what) { - if (event.target == this.editItem) { - new EditNamesDialog(this, Console.message("Edit-Friends2"), Console.message("Add-Friend")); - return true; - } else { - return this.maybeFriendAction(event.target); - } - } - - public boolean handle(FrameEvent f) { - int now; - synchronized(this.friendsMutex) { - now = this.serverUpdates.size(); - if (now != 0) { - WorldServer server = this.console.getServerNew(); - if (server != null) { - while(now-- != 0 && sendMsg(server, (netPacket)this.serverUpdates.elementAt(0))) { - this.serverUpdates.removeElementAt(0); - } - } - } - } - - synchronized(this) { - if (this.teleportState == 1) { - WorldServer server = this.console.getServerNew(); - if (server != null) { - sendMsg(server, new whisperCmd(this.teleportTarget, "&|+where?")); - this.teleportState = 2; - this.teleportWaitStartTime = Std.getRealTime(); - this.teleportWaitSentMsg = false; + private static final String oldIniItemName = "Friends"; + private static final String iniItemName = "Friend"; + private static final String separator = ";"; + private static final String whereQuery = "&|+where?"; + private static final String whereResponse = "&|+where>"; + VoiceChat chatter = new VoiceChat(); + private static final int MOUSEMOVE = 0; + private static final int MOUSEDRAG = 1; + private static final int MOUSEDOWN = 2; + private static final int MOUSEUP = 3; + private static final int MOUSEENTER = 4; + private static final int MOUSEEXIT = 5; + private static final int BLANK = 0; + private static final int NORMAL = 1; + private static final int CURSED = 2; + private static final int DOWN = 3; + private static final int TELEPORT_IDLE = 0; + private static final int TELEPORT_REQUEST_LOCATION = 1; + private static final int TELEPORT_WAIT_FOR_LOCATION = 2; + private static final int buttonWidth = 97; + private static final int buttonHeight = 11; + private static final int xText = 20; + private static final int yText = 9; + private static final int xTextClip = 94; + private static Image friendsImage; + private static Image moreFriendsImage; + private static Font font; + public static FriendsListPart active; + public static Vector friends = new Vector(); + private Vector onlineFriends = new Vector(); + private Vector mutedOnlineFriends = new Vector(); + private Vector serverUpdates = new Vector(); + private Object friendsMutex = new Object(); + private int cursedButton = -1; + private int clickedButton = -1; + private boolean clickedButtonDown; + private PopupMenu menu; + private MenuItem teleportItem = new MenuItem(Console.message("Go-There")); + private MenuItem fremoveItem = new MenuItem(Console.message("remove-friend")); + private MenuItem whereIsItem = new MenuItem(Console.message("where-is")); + private MenuItem emailItem = new MenuItem(Console.message("E-Mail")); + private MenuItem muteItem = new MenuItem(Console.message("Mute")); + private MenuItem whisperItem = new MenuItem(Console.message("Whisper")); + private MenuItem infoItem = new MenuItem(Console.message("Personal-I")); + private MenuItem tradeItem = new MenuItem(Console.message("Talk-Trade")); + private PopupMenu droneMenu; + private MenuItem droneAddItem = new MenuItem(Console.message("Add-2-friends")); + private MenuItem droneTarItem = new MenuItem(Console.message("disable-avatar")); + private MenuItem droneEmailItem = new MenuItem(Console.message("E-Mail")); + private MenuItem droneMuteItem = new MenuItem(Console.message("Mute")); + private MenuItem droneWhisperItem = new MenuItem(Console.message("Whisper")); + private MenuItem droneInfoItem = new MenuItem(Console.message("Personal-I")); + private MenuItem droneTradeItem = new MenuItem(Console.message("Talk-Trade")); + private String activeFriendName = ""; + private String teleportTarget; + private int teleportState = 0; + private int teleportWaitStartTime; + private boolean teleportWaitSentMsg; + private int friendsButtons; + private int moreFriendsButton; + private boolean moreFriendsActive; + private MenuItem editItem; + private Menu actionMenu; + private MoreFriendsDialog moreFriendsDialog; + private DefaultConsole console; + private Galaxy galaxy; + private IniFile serverSection; + private boolean isDialogDisabled; + private int showMenuY = -1; + + + public FriendsListPart() { + AnimatedActionManager.get(); + String var1; + if(font == null) { + var1 = IniFile.override().getIniString("friendsGif", "friends.gif"); + friendsImage = ImageCanvas.getSystemImage(var1, this); + String var2 = IniFile.override().getIniString("moreFriendsGif", Console.message("mfriends.gif")); + moreFriendsImage = ImageCanvas.getSystemImage(var2, this); + int var3 = (new Integer(Console.message("FriendsPointSize"))).intValue(); + font = new Font(Console.message("FriendsFont"), 0, var3); + } + + this.teleportItem.setFont(font); + this.whereIsItem.setFont(font); + this.emailItem.setFont(font); + this.muteItem.setFont(font); + this.whisperItem.setFont(font); + this.tradeItem.setFont(font); + this.infoItem.setFont(font); + this.fremoveItem.setFont(font); + this.menu = new PopupMenu(); + this.menu.add(this.teleportItem); + this.menu.add(this.whereIsItem); + this.menu.add(this.emailItem); + this.menu.add(this.muteItem); + this.menu.add(this.whisperItem); + if(NetUpdate.isInternalVersion()) { + this.menu.add(this.tradeItem); + } + this.menu.add(this.fremoveItem); + + this.menu.add(this.infoItem); + this.add(this.menu); + this.droneAddItem.setFont(font); + this.droneTarItem.setFont(font); + this.droneEmailItem.setFont(font); + this.droneMuteItem.setFont(font); + this.droneWhisperItem.setFont(font); + this.droneTradeItem.setFont(font); + this.droneInfoItem.setFont(font); + this.droneMenu = new PopupMenu(); + this.droneMenu.setFont(font); + this.droneMenu.add(this.droneAddItem); + this.droneMenu.add(this.droneTarItem); + this.droneMenu.add(this.droneEmailItem); + this.droneMenu.add(this.droneMuteItem); + this.droneMenu.add(this.droneWhisperItem); + this.droneMenu.add(this.droneTradeItem); + this.droneMenu.add(this.droneInfoItem); + + this.add(this.droneMenu); + } + + public void update(Graphics var1) { + this.paint(var1); + } + + public void paint(Graphics var1) { + int var2 = this.size().height; + int var3 = var2 / 11; + synchronized(this.friendsMutex) { + int var5 = this.onlineFriends.size(); + this.moreFriendsButton = var3 - 1; + if(var5 >= var3) { + this.friendsButtons = var3 - 1; + this.moreFriendsActive = true; } else { - Console.println(Console.message("Cant-go-there")); - this.teleportState = 0; + this.friendsButtons = var5; + this.moreFriendsActive = false; } - } - if (this.teleportState == 2) { - now = Std.getRealTime(); - if (now > this.teleportWaitStartTime + 5000) { - Object[] arguments; - if (now > this.teleportWaitStartTime + 30000) { - this.teleportState = 0; - if (this.teleportWaitSentMsg) { - arguments = new Object[]{new String(this.teleportTarget)}; - Console.println(MessageFormat.format(Console.message("Cancel-teleport"), arguments)); - } - } else if (!this.teleportWaitSentMsg) { - arguments = new Object[]{new String(this.teleportTarget)}; - Console.println(MessageFormat.format(Console.message("Delay-locating"), arguments)); - this.teleportWaitSentMsg = true; - } - } - } - - return true; - } - } - - public void dialogDisable(boolean disable) { - if (this.isDialogDisabled = disable) { - this.cursedButton = -1; - this.clickedButton = -1; - this.clickedButtonDown = false; - this.repaint(); - } - - } - - public void setServer(WorldServer server, IniFile serverSection) { - this.serverSection = serverSection; - this.galaxy = server.getGalaxy(); - - assert serverSection != null; - - assert this.galaxy != null; - - this.loadFriends(); - if (this.editItem != null) { - this.editItem.setEnabled(true); - } - - this.sendAll(server); - } - - public void maybeServerDisconnect() { - if (this.galaxy != null) { - if (this.editItem != null) { - this.editItem.setEnabled(false); - } - - this.clearAll(); - } - - } - - public static boolean tryToRun(String s) { - try { - Runtime.getRuntime().exec(s); - return true; - } catch (IOException var2) { - return false; - } - } - - private boolean maybeFriendAction(Object target) { - if (target != this.emailItem && target != this.droneEmailItem) { - if (target != this.whisperItem && target != this.droneWhisperItem) { - if (target != this.voiceChatItem && target != this.droneVoiceChatItem) { - if (target == this.droneAddItem) { - if (this.mayAddNameListName(Console.getFrame())) { - this.addNameListName(this.activeFriendName); - } - } else if (target == this.teleportItem) { - synchronized(this) { - this.teleportTarget = this.activeFriendName; - if (this.teleportState == 2 && this.teleportWaitSentMsg) { - Console.println(Console.message("Cancel-new-tele")); - } - - this.teleportState = 1; - } - } else if (target != this.muteItem && target != this.droneMuteItem) { - if (target != this.infoItem && target != this.droneInfoItem) { - if (target != this.tradeItem && target != this.droneTradeItem) { - return false; - } - - WhisperManager.whisperManager().startToTrade(this.activeFriendName); - } else { - new PersonalInfoDownload(this.activeFriendName, this.console); - } - } else if (this.console.getMutes().mayAddNameListName(Console.getFrame())) { - this.console.getMutes().addNameListName(this.activeFriendName); - } - } else { - this.chatter.beginChat(this.activeFriendName, this.console); + int var6 = var3 * 11; + int var7 = var2 - var6; + if(var7 > 0) { + var1.setColor(Color.black); + var1.fillRect(0, 0, 97, var7); } - } else { - Console.startWhispering(this.activeFriendName); - } - } else { - EMailPart.showMessage(this.console, this.activeFriendName); - } - - return true; - } - - private void clearAll() { - if (this.galaxy != null) { - synchronized(this.friendsMutex) { - this.onlineFriends.removeAllElements(); - this.mutedOnlineFriends.removeAllElements(); - } - if (active == this) { - this.repaint(); - } + for(int var8 = 0; var8 < var3; ++var8) { + int var9 = 1; + if(var8 >= this.friendsButtons && !this.isMoreFriendsButton(var8)) { + var9 = 0; + } else if(var8 == this.clickedButton) { + var9 = this.clickedButtonDown?3:1; + } else if(var8 == this.cursedButton) { + var9 = 2; + } - this.galaxy.sentFriendsList(false); - } + this.drawButton(var1, var8, var9); + } - } + } + } - private void sendAll(WorldServer server) { - if (!this.galaxy.sentFriendsList()) { - synchronized(this.friendsMutex) { - int count = this.friends.size(); - int i = 0; - - while(true) { - if (i >= count) { - break; - } - - sendMsg(server, new BuddyListUpdateCmd((String)this.friends.elementAt(i), 1)); - ++i; - } - } - - this.galaxy.sentFriendsList(true); - } - - } - - private static String getWorldName(String url) { - int rindex = url.indexOf(".world#"); - int windex; - return rindex == -1 || (windex = url.lastIndexOf(47, rindex)) == -1 && (windex = url.lastIndexOf(58, rindex)) == -1 ? null : url.substring(windex + 1, rindex); - } - - public static void processWhisper(WorldServer server, String user, String text) { - if (active != null && active.galaxy == server.getGalaxy()) { - active.instanceProcessWhisper(server, user, text); - } - - } - - private synchronized void instanceProcessWhisper(WorldServer server, String user, String text) { - if (text.startsWith("&|+where?")) { - Pilot pilot; - String url; - if ((pilot = Pilot.getActive()) != null && (url = pilot.getTeleportURL()) != null) { - if (this.console.getSpecialGuest()) { - int i = url.indexOf(60); - int j = url.indexOf(62); - url = url.substring(0, i) + url.substring(j + 1); - } - - if (Pilot.getActive().getRoom().getAllowTeleport()) { - sendMsg(server, new whisperCmd(user, "&|+where>" + url)); - } - } - } else if (text.startsWith("&|+where>")) { - if (this.teleportState == 2 && this.teleportTarget.equals(user)) { - String pos = text.substring("&|+where>".length()); - boolean valid = false; - String targetWorld = getWorldName(pos); - String url; - if (!pos.startsWith("home:") && !pos.startsWith("http://")) { - if (targetWorld != null && targetWorld.length() > 0) { - Pilot pilot = Pilot.getActive(); - if (pilot != null) { - url = pilot.getTeleportURL(); - if (url != null && targetWorld.equals(getWorldName(url))) { - valid = true; - pos = url.substring(0, url.lastIndexOf(35)) + pos.substring(pos.lastIndexOf(35)); - } - } - } - - if (!valid) { - String s = WorldsMarkPart.findPackage(targetWorld); - if (s != null) { - valid = true; - pos = "home:" + s + "/" + s + ".world" + pos.substring(pos.lastIndexOf(35)); - } - } - } else { - valid = true; + public int getRemainder(int var1) { + int var2 = var1 / 11; + int var3 = var2 * 11; + return var1 - var3; + } + + public Dimension preferredSize() { + return new Dimension(97, 1); + } + + public Dimension minimumSize() { + return this.preferredSize(); + } + + public boolean mouseMove(Event var1, int var2, int var3) { + return this.buttonAction(var2, var3, 0); + } + + public boolean mouseDown(Event var1, int var2, int var3) { + return this.buttonAction(var2, var3, 2); + } + + public boolean mouseUp(Event var1, int var2, int var3) { + if(this.buttonAction(var2, var3, 3)) { + if(this.showMenuY != -1) { + this.menu.show(this, 0, this.showMenuY); + this.showMenuY = -1; + } + + return true; + } else { + return false; + } + } + + public boolean mouseDrag(Event var1, int var2, int var3) { + return this.buttonAction(var2, var3, 1); + } + + public boolean mouseEnter(Event var1, int var2, int var3) { + return this.buttonAction(var2, var3, 4); + } + + public boolean mouseExit(Event var1, int var2, int var3) { + return this.buttonAction(var2, var3, 5); + } + + public boolean handleEvent(Event var1) { + return this.isDialogDisabled?false:super.handleEvent(var1); + } + + private void loadFriends() { + if(this.friends.size() != 0) { + this.friends.removeAllElements(); + } + + for(int var2 = 0; var2 < Integer.MAX_VALUE; ++var2) { + String var1 = this.serverSection.getIniString("Friend" + var2, ""); + if(((String)var1).length() == 0) { + break; + } + + if(isValidUserName((String)var1) && !icontains(this.friends, (String)var1)) { + this.friends.addElement(var1); + } + } + + if(this.friends.size() == 0) { + String var5 = this.serverSection.getIniString("Friends", ""); + StringTokenizer var4 = new StringTokenizer(var5, ";"); + + while(((StringTokenizer)var4).hasMoreTokens()) { + String var3 = ((StringTokenizer)var4).nextToken(); + if(isValidUserName(var3) && !icontains(this.friends, var3)) { + this.friends.addElement(var3); + } + } + + if(this.friends.size() != 0) { + this.saveFriends(); + this.serverSection.setIniString("Friends", ""); } + } + } - Object[] arguments; - if (valid) { - TeleportAction.teleport(pos, (TeleportStatus)null); - if (this.teleportWaitSentMsg) { - arguments = new Object[]{new String(this.teleportTarget)}; - Console.println(MessageFormat.format(Console.message("Found-tele"), arguments)); - } + void saveFriends() { + if(this.serverSection != null) { + int var1 = this.friends.size(); + + for(int var2 = 0; var2 < var1; ++var2) { + this.serverSection.setIniString("Friend" + var2, (String)this.friends.elementAt(var2)); + } + + this.serverSection.setIniString("Friend" + var1, ""); + } + } + + private boolean isMoreFriendsButton(int var1) { + return var1 == this.moreFriendsButton && this.moreFriendsActive; + } + + private Graphics drawButton(Graphics var1, int var2, int var3) { + Image var4 = var2 == this.moreFriendsButton?moreFriendsImage:friendsImage; + if(var1 != null || (var1 = this.getGraphics()) != null) { + int var5 = var2 * 11; + Graphics var6 = var1.create(0, var5, 97, 11); + var6.drawImage(var4, -var3 * 97, 0, (ImageObserver)null); + if(var2 >= 0 && var2 < this.friendsButtons && var2 < this.onlineFriends.size()) { + var6.clipRect(0, 0, 94, 11); + var6.setFont(font); + var6.setColor(Color.white); + var6.drawString((String)this.onlineFriends.elementAt(var2), 20, 9); + } + + var6.dispose(); + } + + return var1; + } + + private boolean buttonAction(int var1, int var2, int var3) { + synchronized(this.friendsMutex) { + Graphics var5 = null; + int var6 = var2 / 11; + if((var6 < 0 || var6 >= this.friendsButtons) && !this.isMoreFriendsButton(var6)) { + var6 = -1; + } + + if(var3 != 0 && var3 != 4) { + if(var3 == 5) { + if(this.cursedButton != -1) { + var5 = this.drawButton(var5, this.cursedButton, 1); + this.cursedButton = -1; + } + + if(this.clickedButton != -1 && this.clickedButtonDown) { + var5 = this.drawButton(var5, this.clickedButton, 1); + this.clickedButtonDown = false; + } + } else if(var3 == 2) { + if(this.clickedButton != -1) { + var5 = this.drawButton(var5, this.clickedButton, 1); + this.clickedButtonDown = false; + } + + if((this.clickedButton = var6) != -1) { + var5 = this.drawButton(var5, this.clickedButton, 3); + this.clickedButtonDown = true; + } + } else if(var3 == 1) { + if(this.clickedButton != -1) { + if(this.clickedButtonDown) { + if(var6 != this.clickedButton) { + var5 = this.drawButton(var5, this.clickedButton, 1); + this.clickedButtonDown = false; + } + } else if(var6 == this.clickedButton) { + var5 = this.drawButton(var5, this.clickedButton, 3); + this.clickedButtonDown = true; + } + } + } else if(var3 == 3) { + this.cursedButton = var6; + if(this.clickedButtonDown) { + if(this.cursedButton == this.clickedButton) { + var5 = this.drawButton(var5, this.clickedButton, 2); + } else { + var5 = this.drawButton(var5, this.clickedButton, 1); + } + + if(this.clickedButton == this.moreFriendsButton) { + if(this.moreFriendsDialog == null) { + this.moreFriendsDialog = new MoreFriendsDialog(this, this.menu, this.onlineFriends); + } + } else if(this.clickedButton >= 0 && this.clickedButton < this.onlineFriends.size()) { + this.activeFriendName = (String)this.onlineFriends.elementAt(this.clickedButton); + this.showMenuY = (this.clickedButton + 1) * 11; + } + } + + if(this.cursedButton != this.clickedButton) { + var5 = this.drawButton(var5, this.cursedButton, 2); + } + + this.clickedButtonDown = false; + this.clickedButton = -1; + } + } else if(var6 != this.cursedButton) { + var5 = this.drawButton(var5, this.cursedButton, 1); + var5 = this.drawButton(var5, this.cursedButton = var6, 2); + } + + if(var5 != null) { + var5.dispose(); + } + + return true; + } + } + + private static boolean sendMsg(WorldServer var0, netPacket var1) { + try { + var0.sendNetworkMsg(var1); + return true; + } catch (InfiniteWaitException var3) { + } catch (PacketTooLargeException var4) { + } + + return false; + } + + public void activate(Console var1, Container var2, Console var3) { + active = this; + this.console = (DefaultConsole)var1; + this.editItem = var1.addMenuItem(Console.message("Edit-Friends"), "Options"); + this.editItem.setEnabled(this.friends != null); + } + + public void deactivate() { + active = null; + this.editItem = null; + } + + public boolean action(Event var1, Object var2) { + if(var1.target == this.editItem) { + new EditNamesDialog(this, Console.message("Edit-Friends2"), Console.message("Add-Friend")); + return true; + } else { + return this.maybeFriendAction(var1.target); + } + } + + public boolean handle(FrameEvent var1) { + int var4; + synchronized(this.friendsMutex) { + var4 = this.serverUpdates.size(); + if(var4 != 0) { + WorldServer var2 = this.console.getServerNew(); + if(var2 != null) { + while(var4-- != 0 && sendMsg((WorldServer)var2, (netPacket)this.serverUpdates.elementAt(0))) { + this.serverUpdates.removeElementAt(0); + } + } + } + } + + synchronized(this) { + WorldServer var10; + if(this.teleportState == 1) { + var10 = this.console.getServerNew(); + if(var10 != null) { + sendMsg(var10, new whisperCmd(this.teleportTarget, "&|+where?")); + this.teleportState = 2; + this.teleportWaitStartTime = Std.getRealTime(); + this.teleportWaitSentMsg = false; + } else { + Console.println(Console.message("Cant-go-there")); + this.teleportState = 0; + } + } + + if(this.teleportState == 2) { + var4 = Std.getRealTime(); + if(var4 > this.teleportWaitStartTime + 5000) { + Object[] var9; + if(var4 > this.teleportWaitStartTime + 30000) { + this.teleportState = 0; + if(this.teleportWaitSentMsg) { + var9 = new Object[]{new String(this.teleportTarget)}; + Console.println(MessageFormat.format(Console.message("Cancel-teleport"), (Object[])var9)); + } + } else if(!this.teleportWaitSentMsg) { + var9 = new Object[]{new String(this.teleportTarget)}; + Console.println(MessageFormat.format(Console.message("Delay-locating"), (Object[])var9)); + this.teleportWaitSentMsg = true; + } + } + } + + if(this.teleportState == -1) { + var10 = this.console.getServerNew(); + if(var10 != null) { + sendMsg(var10, new whisperCmd(this.teleportTarget, "&|+where?")); + } else { + Console.println(Console.message("Cant-go-there")); + } + + this.teleportState = -2; + } + + return true; + } + } + + public void dialogDisable(boolean var1) { + if(this.isDialogDisabled = var1) { + this.cursedButton = -1; + this.clickedButton = -1; + this.clickedButtonDown = false; + this.repaint(); + } + + } + + public void setServer(WorldServer var1, IniFile var2) { + this.serverSection = var2; + this.galaxy = var1.getGalaxy(); + assert(var2 != null); + assert(this.galaxy != null); + this.loadFriends(); + if(this.editItem != null) { + this.editItem.setEnabled(true); + } + + this.sendAll(var1); + } + + public void maybeServerDisconnect() { + if(this.galaxy != null) { + if(this.editItem != null) { + this.editItem.setEnabled(false); + } + + this.clearAll(); + } + + } + + public static boolean tryToRun(String var0) { + try { + Runtime.getRuntime().exec(var0); + return true; + } catch (IOException var2) { + return false; + } + } + + private boolean maybeFriendAction(Object var1) { + if (var1 == this.fremoveItem || var1 == this.droneAddItem) { + if (this.mayAddNameListName(Console.getFrame())) { + if (!icontains(friends, this.activeFriendName)) { + this.addNameListName(this.activeFriendName); + Console.println(MessageFormat.format(Console.message("added-status"), new String[]{this.activeFriendName})); + } else { + this.removeNameListName(friends.indexOf(this.activeFriendName)); + Console.println(MessageFormat.format(Console.message("removed-status"), new String[]{this.activeFriendName})); + } + } + } else if (var1 == this.droneTarItem) { + if (this.console.getTars().mayAddNameListName(Console.getFrame())) { + if (!icontains(this.console.getTars().tars, this.activeFriendName)) { + this.console.getTars().addNameListName(this.activeFriendName); + } else { + this.console.getTars().removeNameListName(this.console.getTars().tars.indexOf(this.activeFriendName)); + } + } + + } else if (var1 == this.whisperItem || var1 == this.droneWhisperItem) { + Console.startWhispering(this.activeFriendName); + } else if (var1 == this.emailItem || var1 == this.droneEmailItem) { + EMailPart.showMessage(this.console, this.activeFriendName); + } else if (var1 == this.teleportItem || var1 == this.whereIsItem) { + synchronized (this) { + this.teleportTarget = this.activeFriendName; + if (this.teleportState == 2 && this.teleportWaitSentMsg) { + Console.println(Console.message("Cancel-new-tele")); + } + + this.teleportState = var1 == this.teleportItem ? 1 : -1; + } + } else if (var1 == this.muteItem || var1 == this.droneMuteItem) { + this.console.getMutes().addNameListName(this.activeFriendName); + } else if (var1 == this.infoItem || var1 == this.droneInfoItem) { + new PersonalInfoDownload(this.activeFriendName, this.console); + } else if (var1 == this.tradeItem || var1 == this.droneTradeItem) { + WhisperManager.whisperManager().startToTrade(this.activeFriendName); + } else { + return false; + } + + return true; + } + + private void clearAll() { + if(this.galaxy != null) { + synchronized(this.friendsMutex) { + this.onlineFriends.removeAllElements(); + this.mutedOnlineFriends.removeAllElements(); + } + + if(active == this) { + this.repaint(); + } + + this.galaxy.sentFriendsList(false); + } + + } + + private void sendAll(WorldServer var1) { + if(!this.galaxy.sentFriendsList()) { + synchronized(this.friendsMutex) { + int var3 = this.friends.size(); + int var4 = 0; + + while(true) { + if(var4 >= var3) { + break; + } + + sendMsg(var1, new BuddyListUpdateCmd((String)this.friends.elementAt(var4), 1)); + ++var4; + } + } + + this.galaxy.sentFriendsList(true); + } + + } + + private static String getWorldName(String var0) { + int var1 = var0.indexOf(".world#"); + int var2; + return var1 != -1 && ((var2 = var0.lastIndexOf(47, var1)) != -1 || (var2 = var0.lastIndexOf(58, var1)) != -1)?var0.substring(var2 + 1, var1):null; + } + + public static void processWhisper(WorldServer var0, String var1, String var2) { + if(active != null && active.galaxy == var0.getGalaxy()) { + active.instanceProcessWhisper(var0, var1, var2); + } + + } + + private boolean allowTeleport(String player) { + int value = IniFile.gamma().getIniInt("TeleportPrivacy", 0); + if (value != 0) { + if (value == 1 && icontains(friends, player)) return true; + else return false; + } else return true; + } + + private void sendTeleportReject(String var1) { + Object[] var2 = new Object[]{"teleport", var1}; + Console.println(MessageFormat.format(Console.message("rejected"), var2)); + } + + private synchronized void instanceProcessWhisper(WorldServer var1, String var2, String var3) { + if(var3.startsWith("&|+where?")) { + if (allowTeleport(var2)) { + Pilot var4; + String var5; + if ((var4 = Pilot.getActive()) != null && (var5 = ((Pilot) var4).getTeleportURL()) != null) { + if (this.console.getSpecialGuest()) { + int var6 = var5.indexOf(60); + int var7 = var5.indexOf(62); + var5 = var5.substring(0, var6) + var5.substring(var7 + 1); + } + + if (Pilot.getActive().getRoom().getAllowTeleport()) { + sendMsg(var1, new whisperCmd(var2, "&|+where>" + var5)); + } + } } else { - arguments = new Object[]{new String(this.teleportTarget), new String(targetWorld)}; - url = MessageFormat.format(Console.message("Cant-go-world"), arguments); - Console.println(url); - } - - this.teleportState = 0; - this.teleportTarget = null; - } - } else if (text.startsWith("&|+voicechat")) { - this.chatter.handleChatWhisper(user, text, this.console); - } else if (text.startsWith(VoiceChat.VCdebugCommand)) { - VoiceChat.setExtra(text); - } else if (text.startsWith(VoiceChat.VCdebugCommandReset)) { - VoiceChat.resetExtra(); - } - - } - - public int getNameListCount() { - return this.friends.size(); - } - - public String getNameListName(int index) { - return (String)this.friends.elementAt(index); - } - - public void removeNameListName(int index) { - synchronized(this.friendsMutex) { - String name = (String)this.friends.elementAt(index); - this.friends.removeElementAt(index); - this.saveFriends(); - if ((index = iindexOf(this.onlineFriends, name)) != -1) { - this.onlineFriends.removeElementAt(index); - if (active == this) { - this.repaint(); - } - } - - if ((index = iindexOf(this.mutedOnlineFriends, name)) != -1) { - this.mutedOnlineFriends.removeElementAt(index); - } - - this.serverUpdates.addElement(new BuddyListUpdateCmd(name, 0)); - } - } - - public boolean mayAddNameListName(java.awt.Window currentWindow) { - if (this.friends.size() < maxFriends) { - return true; - } else { - Object[] arguments = new Object[]{new String("" + maxFriends)}; - new OkCancelDialog(currentWindow, (DialogReceiver)null, Console.message("Too-many-names"), (String)null, Console.message("OK"), MessageFormat.format(Console.message("You-are-limitedF"), arguments), true); - return false; - } - } - - public int addNameListName(String name) { - synchronized(this.friendsMutex) { - int index = iindexOf(this.friends, name); - if (index != -1) { - return index; - } else { - this.friends.addElement(name); - Collections.sort(this.friends, this); + if (IniFile.modFriendly().getIniInt("TeleportFeedback", 0) == 1) sendTeleportReject(var2); + if (IniFile.modFriendly().getIniInt("TeleportResponse", 0) == 1) sendMsg(var1, new whisperCmd(var2, Console.message("not-teleports"))); + } + } else if(var3.startsWith("&|+where>")) { + boolean var11 = this.teleportState == 2 && this.teleportTarget.equals(var2); + if (var11 || this.teleportState == -2) { + String var10 = var3.substring("&|+where>".length()); + boolean var12 = false; + String var13 = getWorldName((String) var10); + String var9; + if (!((String) var10).startsWith("home:") && !((String) var10).startsWith("http://")) { + if (var13 != null && var13.length() > 0) { + Pilot var8 = Pilot.getActive(); + if (var8 != null) { + var9 = ((Pilot) var8).getTeleportURL(); + if (var9 != null && var13.equals(getWorldName(var9))) { + var12 = true; + var10 = var9.substring(0, var9.lastIndexOf(35)) + ((String) var10).substring(((String) var10).lastIndexOf(35)); + } + } + } + + if (!var12) { + String var14 = WorldsMarkPart.findPackage(var13); + if (var14 != null) { + var12 = true; + var10 = "home:" + (String) var14 + "/" + (String) var14 + ".world" + ((String) var10).substring(((String) var10).lastIndexOf(35)); + } + } + } else { + var12 = true; + } + + Object[] var15; + if (var12) { + if (var11) { + TeleportAction.teleport((String) var10, (TeleportStatus) null); + } else { + Console.println(var2 + ": " + (String) var10); + } + + if (this.teleportWaitSentMsg) { + var15 = new Object[]{new String(this.teleportTarget)}; + Console.println(MessageFormat.format(Console.message("Found-tele"), (Object[]) var15)); + } + } else { + var15 = new Object[]{new String(this.teleportTarget), new String(var13)}; + var9 = MessageFormat.format(Console.message("Cant-go-world"), (Object[]) var15); + Console.println(var9); + } + + this.teleportState = 0; + this.teleportTarget = null; + } + } + } + + public int getNameListCount() { + return this.friends.size(); + } + + public String getNameListName(int var1) { + return (String)this.friends.elementAt(var1); + } + + public void removeNameListName(int var1) { + synchronized(this.friendsMutex) { + String var3 = (String)this.friends.elementAt(var1); + this.friends.removeElementAt(var1); this.saveFriends(); - this.serverUpdates.addElement(new BuddyListUpdateCmd(name, 1)); - return this.friends.size() - 1; - } - } - } - - public int compare(String arg0, String arg1) { - return arg0.compareToIgnoreCase(arg1); - } - - public static void droneClick(Drone who, MouseDownEvent event) { - if (active != null) { - active.instanceDroneClick(who, event); - } - - } - - private void instanceDroneClick(Drone who, MouseDownEvent event) { - String tmp = who.getLongID(); - if (tmp != null) { - this.activeFriendName = tmp; - Object[] arguments = new Object[]{new String(this.activeFriendName)}; - this.droneAddItem = new MenuItem(MessageFormat.format(Console.message("Add-to-friends"), arguments)); - this.droneMenu.remove(0); - this.droneAddItem.setFont(font); - this.droneMenu.insert(this.droneAddItem, 0); - this.droneAddItem.setEnabled(!icontains(this.friends, this.activeFriendName)); - if (this.actionMenu != null) { - this.droneMenu.remove(this.actionMenu); - } - - if (who instanceof PosableDrone) { - PosableDrone pd = (PosableDrone)who; - PosableShape ps = pd.getInternalPosableShape(); - if (ps != null) { - this.actionMenu = new Menu(Console.message("Actions")); - if (AnimatedActionManager.get().buildActionMenu(this.actionMenu, ps)) { - this.droneMenu.add(this.actionMenu); - this.actionMenu.addActionListener(AnimatedActionManager.get()); - } - } - } - - this.droneMenu.show(this.console.getRender(), event.x, event.y); - } - - } - - public static void processBuddyListNotify(WorldServer server, String name, int state) { - Galaxy g = server.getGalaxy(); - Enumeration consoleList = g.getConsoles(); - - Object c; - FriendsListPart target; - while(consoleList.hasMoreElements()) { - c = consoleList.nextElement(); - if (c instanceof DefaultConsole) { - target = ((DefaultConsole)c).getFriends(); - if (state < 2) { - boolean muted = MuteListPart.isMuted(server, name); - if (state == 1) { - target.addOnlineFriend(name, muted); - } else { - target.removeOnlineFriend(name, muted); - } + if((var1 = iindexOf(this.onlineFriends, var3)) != -1) { + this.onlineFriends.removeElementAt(var1); + if(active == this) { + this.repaint(); + } + } + + if((var1 = iindexOf(this.mutedOnlineFriends, var3)) != -1) { + this.mutedOnlineFriends.removeElementAt(var1); + } + + this.serverUpdates.addElement(new BuddyListUpdateCmd(var3, 0)); + } + } + + public boolean mayAddNameListName(Window var1) { + return true; + } + + public int addNameListName(String var1) { + synchronized(this.friendsMutex) { + int var3 = iindexOf(this.friends, var1); + if(var3 != -1) { + return var3; } else { - assert name.length() == 0; + this.friends.addElement(var1); + this.saveFriends(); + this.serverUpdates.addElement(new BuddyListUpdateCmd(var1, 1)); + return this.friends.size() - 1; + } + } + } + + public static void droneClick(Drone var0, MouseDownEvent var1) { + if(active != null) { + active.instanceDroneClick(var0, var1); + } + + } + + private String parseVersion(int v) { + switch (v) { + case 2003110800: + return "1890"; + case 2004081600: + return "1904"; + case 2004111200: + return "1920a"; + case 2012071402: + return "1920"; + case 2020031200: + return "1922a10"; + default: + return String.valueOf(v); + } + } + + private void instanceDroneClick(Drone var1, MouseDownEvent var2) { + String var3 = var1.getLongID(); + if(var3 != null) { + this.activeFriendName = var3; + Object[] var4 = new Object[]{this.activeFriendName}; + this.droneAddItem = new MenuItem(icontains(this.friends, this.activeFriendName) ? MessageFormat.format("Remove {0} from friends list", var4) : MessageFormat.format(Console.message("Add-to-friends"), var4)); + this.droneTarItem = new MenuItem(this.console.getFriends().icontains(this.console.getTars().tars, this.activeFriendName) ? "Enable Avatar" : "Disable Avatar"); + + this.droneMenu.remove(0); + this.droneAddItem.setFont(font); + this.droneMenu.insert(this.droneAddItem, 0); + + this.droneMenu.remove(1); + this.droneTarItem.setFont(font); + this.droneMenu.insert(this.droneTarItem, 1); + + if(this.actionMenu != null) { + this.droneMenu.remove(this.actionMenu); + } + + if(var1 instanceof PosableDrone) { + PosableDrone var5 = (PosableDrone)var1; + PosableShape var6 = var5.getInternalPosableShape(); + if(var6 != null) { + this.actionMenu = new Menu(Console.message("Actions")); + if(AnimatedActionManager.get().buildActionMenu(this.actionMenu, var6)) { + this.droneMenu.add(this.actionMenu); + this.actionMenu.addActionListener(AnimatedActionManager.get()); + } + } + } + + this.droneMenu.show(this.console.getRender(), var2.x, var2.y); + } + + } + + public static void processBuddyListNotify(WorldServer var0, String var1, int var2) { + Galaxy var3 = var0.getGalaxy(); + Enumeration var4 = var3.getConsoles(); + + Object var5; + NET.worlds.console.FriendsListPart var6; + while(var4.hasMoreElements()) { + var5 = var4.nextElement(); + if(var5 instanceof DefaultConsole) { + var6 = ((DefaultConsole)var5).getFriends(); + if(var2 < 2) { + boolean var7 = MuteListPart.isMuted(var0, var1); + if(var2 == 1) { + var6.addOnlineFriend(var1, var7); + } else { + var6.removeOnlineFriend(var1, var7); + } + } else { + assert(var1.length() == 0); + var6.clearAll(); + } + } + } + + if(var2 == 2) { + var4 = var3.getConsoles(); + + while(var4.hasMoreElements()) { + var5 = var4.nextElement(); + if(var5 instanceof DefaultConsole) { + var6 = ((DefaultConsole)var5).getFriends(); + var6.sendAll(var0); + } + } + } + } + + public static String ilookup(Vector var0, String var1) { + int var2 = var0.size(); + + for(int var3 = 0; var3 < var2; ++var3) { + String var4 = (String)var0.elementAt(var3); + if(var4.equalsIgnoreCase(var1)) { + return var4; + } + } + + return null; + } + + public static int iindexOf(Vector var0, String var1) { + int var2 = var0.size(); + + for(int var3 = 0; var3 < var2; ++var3) { + String var4 = (String)var0.elementAt(var3); + if(var4.equalsIgnoreCase(var1)) { + return var3; + } + } + + return -1; + } + + public static boolean icontains(Vector var0, String var1) { + return iindexOf(var0, var1) != -1; + } + + public void changeMuteState(String var1, boolean var2) { + synchronized(this.friendsMutex) { + if(icontains(this.friends, var1)) { + if(var2) { + var1 = ilookup(this.onlineFriends, var1); + if(var1 != null) { + this.removeOnlineFriend(var1, false); + this.addOnlineFriend(var1, true); + } + } else { + var1 = ilookup(this.mutedOnlineFriends, var1); + if(var1 != null) { + this.removeOnlineFriend(var1, true); + this.addOnlineFriend(var1, false); + } + } + } + + } + } + + private void listChanged() { + this.cursedButton = -1; + this.clickedButton = -1; + this.clickedButtonDown = false; + this.repaint(); + } + + private void addOnlineFriend(String var1, boolean var2) { + synchronized(this.friendsMutex) { + if(this.friends != null && icontains(this.friends, var1)) { + if(!var2 && !icontains(this.onlineFriends, var1)) { + this.onlineFriends.addElement(var1); + if(active == this) { + this.listChanged(); + if(this.moreFriendsDialog != null) { + this.moreFriendsDialog.addName(var1); + } + if (IniFile.modFriendly().getIniInt("ShowStatusUpdate", 0) == 1) Console.println(MessageFormat.format("{0} is now online.", new String[]{var1})); + } + } else if(var2 && !icontains(this.mutedOnlineFriends, var1)) { + this.mutedOnlineFriends.addElement(var1); + } + } + + } + } + + private void removeOnlineFriend(String var1, boolean var2) { + synchronized(this.friendsMutex) { + if(!var2) { + int var4 = this.onlineFriends.indexOf(var1); + if(var4 != -1) { + this.onlineFriends.removeElementAt(var4); + if(active == this) { + this.listChanged(); + if(this.moreFriendsDialog != null) { + this.moreFriendsDialog.removeName(var4); + } + if (IniFile.modFriendly().getIniInt("ShowStatusUpdate", 0) == 1) Console.println(MessageFormat.format("{0} quit.", new String[]{var1})); + } + } + } else { + this.mutedOnlineFriends.removeElement(var1); + } - target.clearAll(); + } + } + + public void dialogDone(Object var1, boolean var2) { + System.out.println("TEST FRIEND"); + synchronized(this.friendsMutex) { + if(var1 == this.moreFriendsDialog) { + this.moreFriendsDialog = null; } - } - } - if (state == 2) { - consoleList = g.getConsoles(); - - while(consoleList.hasMoreElements()) { - c = consoleList.nextElement(); - if (c instanceof DefaultConsole) { - target = ((DefaultConsole)c).getFriends(); - target.sendAll(server); - break; - } - } - } - - } - - public static String ilookup(Vector v, String name) { - int count = v.size(); - - for(int i = 0; i < count; ++i) { - String ele = (String)v.elementAt(i); - if (ele.equalsIgnoreCase(name)) { - return ele; - } - } - - return null; - } - - public static int iindexOf(Vector v, String name) { - int count = v.size(); - - for(int i = 0; i < count; ++i) { - String ele = (String)v.elementAt(i); - if (ele.equalsIgnoreCase(name)) { - return i; - } - } - - return -1; - } - - public static boolean icontains(Vector v, String name) { - return iindexOf(v, name) != -1; - } - - public void changeMuteState(String name, boolean muted) { - synchronized(this.friendsMutex) { - if (icontains(this.friends, name)) { - if (muted) { - name = ilookup(this.onlineFriends, name); - if (name != null) { - this.removeOnlineFriend(name, false); - this.addOnlineFriend(name, true); - } - } else { - name = ilookup(this.mutedOnlineFriends, name); - if (name != null) { - this.removeOnlineFriend(name, true); - this.addOnlineFriend(name, false); - } - } - } - - } - } - - private void listChanged() { - this.cursedButton = -1; - this.clickedButton = -1; - this.clickedButtonDown = false; - this.repaint(); - } - - private void addOnlineFriend(String name, boolean muted) { - synchronized(this.friendsMutex) { - if (this.friends != null && icontains(this.friends, name)) { - if (!muted && !icontains(this.onlineFriends, name)) { - this.onlineFriends.addElement(name); - if (active == this) { - this.listChanged(); - if (this.moreFriendsDialog != null) { - this.moreFriendsDialog.addName(name); - } - } - } else if (muted && !icontains(this.mutedOnlineFriends, name)) { - this.mutedOnlineFriends.addElement(name); - } - } - - } - } - - private void removeOnlineFriend(String name, boolean muted) { - synchronized(this.friendsMutex) { - if (!muted) { - int index = this.onlineFriends.indexOf(name); - if (index != -1) { - this.onlineFriends.removeElementAt(index); - if (active == this) { - this.listChanged(); - if (this.moreFriendsDialog != null) { - this.moreFriendsDialog.removeName(index); - } - } - } - } else { - this.mutedOnlineFriends.removeElement(name); - } - - } - } - - public void dialogDone(Object who, boolean confirmed) { - synchronized(this.friendsMutex) { - if (who == this.moreFriendsDialog) { - this.moreFriendsDialog = null; - } - - } - } - - public static boolean isValidUserName(String name) { - String validChars = "_-"; - name = Console.parseUnicode(name); - int length = name.length(); - if (length >= 2 && length <= 16) { - char[] nameChars = name.toCharArray(); - - for(int i = 0; i < length; ++i) { - if (!Character.isLetterOrDigit(nameChars[i]) && validChars.indexOf(nameChars[i]) == -1) { - return false; - } - } - - return true; - } else { - return false; - } - } + } + } + + public static boolean isValidUserName(String var0) { + String var1 = "_-"; + var0 = Console.parseUnicode(var0); + int var2 = var0.length(); + if(var2 >= 2 && var2 <= 16) { + char[] var3 = var0.toCharArray(); + + for(int var4 = 0; var4 < var2; ++var4) { + if(!Character.isLetterOrDigit(var3[var4]) && var1.indexOf(var3[var4]) == -1) { + return false; + } + } - void moreFriendsAction(String name, MenuItem function) { - this.activeFriendName = name; + return true; + } else { + return false; + } + } - assert this.activeFriendName != null; + void moreFriendsAction(String var1, MenuItem var2) { + this.activeFriendName = var1; + this.maybeFriendAction(var2); + } - this.maybeFriendAction(function); - } } diff -ruN a/1920/NET/worlds/console/GammaTextArea.java b/1920/NET/worlds/console/GammaTextArea.java --- a/1920/NET/worlds/console/GammaTextArea.java 2024-01-08 01:46:30.000000000 -0600 +++ b/1920/NET/worlds/console/GammaTextArea.java 2023-08-21 23:27:17.000000000 -0500 @@ -1,912 +1,835 @@ package NET.worlds.console; +import NET.worlds.core.Debug; import NET.worlds.core.IniFile; -import NET.worlds.scape.SendURLAction; -import NET.worlds.scape.TeleportAction; -import NET.worlds.scape.TeleportStatus; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Font; -import java.awt.FontMetrics; -import java.awt.Graphics; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.MenuItem; -import java.awt.Panel; -import java.awt.PopupMenu; -import java.awt.Scrollbar; -import java.awt.Toolkit; +import NET.worlds.network.URL; +import NET.worlds.scape.*; + +import java.awt.*; import java.awt.datatransfer.Clipboard; import java.awt.datatransfer.ClipboardOwner; import java.awt.datatransfer.StringSelection; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.AdjustmentEvent; -import java.awt.event.AdjustmentListener; -import java.awt.event.FocusEvent; +import java.awt.event.*; import java.awt.event.KeyEvent; import java.awt.event.MouseEvent; -import java.awt.event.MouseWheelEvent; +import java.io.*; import java.util.StringTokenizer; import java.util.Vector; public class GammaTextArea extends Panel implements AdjustmentListener, ActionListener { - private static final long serialVersionUID = 4042890054976563288L; - public static final int SCROLLBARS_BOTH = 1; - public static final int SCROLLBARS_VERTICAL_ONLY = 2; - public static final int SCROLLBARS_HORIZONTAL_ONLY = 3; - public static final int SCROLLBARS_NONE = 4; - protected static final int _margin = 2; - private int _width; - private int _height; - private StyledTextCanvas _canvas; - private String _string; - private Font _font; - private int _currentStyle; - private String _currentFontName; - private int _currentPointSize; - private Color _currentColor; - private GammaTextScrollbar _vertBar; - private GammaTextScrollbar _horzBar; - private int _numLines; - private int _canvasLines; - private int _scrollLine; - private Vector _lines; - private Vector _pos; - private int _lastpos = 0; - protected int _curpos = 0; - protected boolean _hasFocus; - protected int selectionStart = -1; - protected int selectionEnd = -1; - private static final Color skyblue = new Color(135, 206, 255); - private PopupMenu rightMenu; - private MenuItem textCopyItem = new MenuItem(Console.message("Copy")); - private MenuItem textCopyTextItem = new MenuItem(Console.message("Copy Text")); - private MenuItem textCopyAllItem = new MenuItem(Console.message("Copy All")); - private MenuItem textCopyAllTextItem = new MenuItem(Console.message("Copy All Text")); - private MenuItem textOpenURLItem = new MenuItem(Console.message("Open URL")); - static Color bgColor = null; - private int _numColumns; - private int _numRows; - private static int scrollWheelStep = IniFile.gamma().getIniInt("ScrollWheelStep", 3); - public static String boldStartTag = ""; - public static String boldEndTag = ""; - public static String italicStartTag = ""; - public static String italicEndTag = ""; - public static String colorStartMagentaTag = ""; - public static String colorStartBlueTag = ""; - public static String colorStartRedTag = ""; - public static String colorStartGreenTag = ""; - public static String colorEndTag = ""; - public static String colorMagenta2Tag = ""; - public static String colorBlue2Tag = ""; - public static String colorRed2Tag = ""; - public static String colorGreen2Tag = ""; - public static String colorCyanTag = ""; - public static String colorDarkGrayTag = ""; - public static String colorGrayTag = ""; - public static String colorOrangeTag = ""; - public static String colorPinkTag = ""; - public static String colorYellowTag = ""; - public static String colorWhiteTag = ""; - public static String colorLightGrayTag = ""; - public static EmoteHandler emotes = new EmoteHandler(); - protected static String[] tagList; - private int lastWidth = 0; - protected boolean selectionConversion = false; - protected int _initialSelection = -1; - - static { - tagList = new String[]{boldStartTag, boldEndTag, italicStartTag, italicEndTag, colorStartMagentaTag, colorStartRedTag, colorStartGreenTag, colorStartBlueTag, colorEndTag, colorMagenta2Tag, colorBlue2Tag, colorRed2Tag, colorGreen2Tag, colorCyanTag, colorDarkGrayTag, colorGrayTag, colorOrangeTag, colorPinkTag, colorYellowTag, colorWhiteTag, colorLightGrayTag}; - } - - public Font getFont() { - return this._font; - } - - public int getWidth() { - return this._width; - } - - public int getHeight() { - return this._height; - } - - public synchronized void setWidth(int w) { - this._width = w - 4; - } - - public synchronized void setHeight(int h) { - this._height = h - 4; - } - - public Vector getLines() { - return this._lines; - } - - public int getScrollLine() { - return this._scrollLine; - } - - public int getCanvasLines() { - return this._canvasLines; - } - - public int getNumLines() { - return this._numLines; - } - - public boolean getHasFocus() { - return this._hasFocus; - } - - public Scrollbar getVertScrollbar() { - return this._vertBar; - } - - static Color getBackgroundColor() { - if (bgColor == null) { - int bgR = IniFile.override().getIniInt("chatBgR", 255); - int bgG = IniFile.override().getIniInt("chatBgG", 255); - int bgB = IniFile.override().getIniInt("chatBgB", 203); - bgColor = new Color(bgR, bgG, bgB); - } - - return bgColor; - } - - GammaTextArea(String text, int rows, int columns, int scrollbars) { - this._string = text; - this._numColumns = columns; - this._numRows = rows; - this._currentFontName = Console.message("GammaTextFont"); - this._currentStyle = 0; - this._currentPointSize = IniFile.gamma().getIniInt("ChatFontSize", 12); - this._currentColor = Color.black; - this._canvas = new StyledTextCanvas(); - this.setFontSize(this._currentPointSize); - this._lines = new Vector(); - this._pos = new Vector(); - this._lastpos = 0; - this._hasFocus = false; - this._numLines = this._scrollLine = this._canvasLines = 0; - switch (scrollbars) { - case 1: - this._vertBar = new GammaTextScrollbar(1); - this._horzBar = new GammaTextScrollbar(0); - break; - case 2: - this._vertBar = new GammaTextScrollbar(1); - this._horzBar = null; - break; - case 3: - this._vertBar = null; - this._horzBar = new GammaTextScrollbar(0); - break; - case 4: - this._vertBar = this._horzBar = null; - } - - GridBagLayout gridbag = new GridBagLayout(); - this.setLayout(gridbag); - GridBagConstraints c = new GridBagConstraints(); - c.fill = 1; - c.weightx = 1.0; - c.weighty = 1.0; - gridbag.setConstraints(this._canvas, c); - this.add(this._canvas); - if (this._vertBar != null) { - c = new GridBagConstraints(); - c.fill = 3; - c.gridwidth = 0; - gridbag.setConstraints(this._vertBar, c); - this.add(this._vertBar); - this._vertBar.addAdjustmentListener(this); - } - - if (this._horzBar != null) { - c = new GridBagConstraints(); - c.fill = 2; - c.gridwidth = 1; - this.add(this._horzBar); - this._horzBar.addAdjustmentListener(this); - } - - this.enableEvents(131231L); - this._canvas.repaint(); - } - - public synchronized void setFontSize(int fontsize) { - this._currentPointSize = fontsize; - this._font = new Font(this._currentFontName, this._currentStyle, this._currentPointSize); - this.recalcSize(); - } - - public synchronized void setRows(int rows) { - this._numRows = rows; - this.recalcSize(); - } - - public synchronized void recalcSize() { - FontMetrics fm = this._canvas.getFontMetrics(this._font); - - assert fm != null; - - int w = fm.charWidth('M') * this._numColumns; - int h = fm.getHeight() * this._numRows; - this.setWidth(w); - this.setHeight(h); - this._canvas.setSize(w, h); - this.setWidth(w); - this.setHeight(h); - } - - public void update(Graphics g) { - this.paint(g); - } - - protected synchronized void processMouseEvent(MouseEvent e) { - if (e.isPopupTrigger()) { - if (this.rightMenu != null && this.rightMenu.isEnabled()) { - this.hideRightMenu(); - } else { - this.showRightMenu(e.getX(), e.getY()); - } - } - - super.processMouseEvent(e); - } - - protected synchronized void processFocusEvent(FocusEvent e) { - if (e.getID() == 1004) { - this._hasFocus = true; - } else if (e.getID() == 1005) { - this._hasFocus = false; - } - - this._canvas.repaint(); - super.processFocusEvent(e); - } - - protected synchronized void processKeyEvent(KeyEvent e) { - this._canvas.dispatchEvent(e); - super.processKeyEvent(e); - } - - protected synchronized void processMouseWheelEvent(MouseWheelEvent e) { - if (e.getID() == 507) { - int move = false; - int move; - if (e.getScrollType() == 0) { - move = e.getScrollAmount() * e.getWheelRotation(); - } else { - move = scrollWheelStep * e.getWheelRotation(); - } - - if (move != 0) { - this._vertBar.setValue(this._vertBar.getValue() + move); - this.requestFocus(); - this._canvas.sendDelayedMouseEvent(e); - this.adjustmentValueChanged((AdjustmentEvent)null); - } - } - - super.processMouseWheelEvent(e); - } - - public synchronized void adjustmentValueChanged(AdjustmentEvent e) { - this._scrollLine = this._vertBar.getValue(); - this._canvas.repaint(); - } - - public void setEditable(boolean b) { - if (b) { - System.out.println("Can't set GammaTextArea to be editable."); - } - - } - - public synchronized String getText() { - return this._string; - } - - public synchronized void setText(String s) { - this._string = s; - this.wordWrapAll(); - this._scrollLine = this._numLines - this._canvasLines; - if (this._scrollLine < 0) { - this._scrollLine = 0; - } - - this.setScrollBounds(); - } - - public synchronized void repaint() { - this._canvas.repaint(); - super.repaint(); - } - - public synchronized void paint(Graphics g) { - this._canvas.paint(g); - super.paint(g); - } - - protected synchronized void wordWrapAll() { - this._lines.removeAllElements(); - this._pos.removeAllElements(); - this._numLines = 0; - this._lastpos = 0; - this.wordWrap(this._string); - } - - protected synchronized boolean isLastLineVisible() { - if (!this._canvas.mouseActive && (this.selectionStart < 0 || this.selectionEnd <= this.selectionStart)) { - return this._scrollLine >= this._numLines - this._canvasLines || this._numLines <= this._canvasLines; - } else { - return false; - } - } - - protected synchronized boolean handleTag(Graphics g, String word, int x, int y) { - String lower = word.toLowerCase(); - int color; - if (word.charAt(0) == '<') { - for(color = 0; color < tagList.length; ++color) { - if (lower.equals(tagList[color].toLowerCase())) { - switch (color) { - case 0: - this._currentStyle |= 1; - break; - case 1: - this._currentStyle &= -2; - break; - case 2: - this._currentStyle |= 2; - break; - case 3: - this._currentStyle &= -3; - break; - case 4: - this._currentColor = Color.magenta; - break; - case 5: - this._currentColor = Color.red; - break; - case 6: - this._currentColor = Color.green; - break; - case 7: - this._currentColor = Color.blue; - break; - case 8: - this._currentColor = Color.black; - break; - case 9: - this._currentColor = Color.magenta; - break; - case 10: - this._currentColor = Color.blue; - break; - case 11: - this._currentColor = Color.red; - break; - case 12: - this._currentColor = Color.green; - break; - case 13: - this._currentColor = Color.cyan; - break; - case 14: - this._currentColor = Color.darkGray; - break; - case 15: - this._currentColor = Color.gray; - break; - case 16: - this._currentColor = Color.orange; - break; - case 17: - this._currentColor = Color.pink; - break; - case 18: - this._currentColor = Color.yellow; - break; - case 19: - this._currentColor = Color.white; - break; - case 20: - this._currentColor = Color.lightGray; - } - - try { - this._font = new Font(this._currentFontName, this._currentStyle, this._currentPointSize); - } catch (IllegalArgumentException var8) { - } - - return true; - } - } - } - - if (lower.startsWith(" 15) { - color = 0; - - try { - int end = word.lastIndexOf(34); - if (end < 10 || end > 15) { - end = 15; - } - - color = Integer.parseInt(word.substring(9, end).trim(), 16); - } catch (Exception var10) { - } + public static final int SCROLLBARS_BOTH = 1; + public static final int SCROLLBARS_VERTICAL_ONLY = 2; + public static final int SCROLLBARS_HORIZONTAL_ONLY = 3; + public static final int SCROLLBARS_NONE = 4; + protected static final int _margin = 2; + private int _width; + private int _height; + private StyledTextCanvas _canvas; + private String _string; + private Font _font; + private int _currentStyle; + private String _currentFontName; + private int _currentPointSize; + private Color _currentColor; + private GammaTextScrollbar _vertBar; + private GammaTextScrollbar _horzBar; + private int _numLines; + private int _canvasLines; + private int _scrollLine; + private Vector _lines; + private Vector _pos; + private int _lastpos = 0; + protected int _curpos = 0; + private boolean _hasFocus; + protected int selectionStart = -1; + protected int selectionEnd = -1; + private static final Color skyblue = new Color(135, 206, 255); + private PopupMenu rightMenu; + private MenuItem textCopyItem = new MenuItem(Console.message("Copy")); + private MenuItem textCopyTextItem = new MenuItem(Console.message("Copy Text")); + private MenuItem textCopyAllItem = new MenuItem(Console.message("Copy All")); + private MenuItem textCopyAllTextItem = new MenuItem(Console.message("Copy All Text")); + private MenuItem textSaveItem = new MenuItem(Console.message("Save All Text")); + private MenuItem textOpenURLItem = new MenuItem(Console.message("Open URL")); + static Color bgColor = null; + private int _numColumns; + private int _numRows; + private static int scrollWheelStep = IniFile.gamma().getIniInt("ScrollWheelStep", 3); + public static String boldStartTag = ""; + public static String boldEndTag = ""; + public static String italicStartTag = ""; + public static String italicEndTag = ""; + public static String colorStartMagentaTag = ""; + public static String colorStartBlueTag = ""; + public static String colorStartRedTag = ""; + public static String colorStartGreenTag = ""; + public static String colorEndTag = ""; + public static String colorMagenta2Tag = ""; + public static String colorBlue2Tag = ""; + public static String colorRed2Tag = ""; + public static String colorGreen2Tag = ""; + public static String colorCyanTag = ""; + public static String colorDarkGrayTag = ""; + public static String colorGrayTag = ""; + public static String colorOrangeTag = ""; + public static String colorPinkTag = ""; + public static String colorYellowTag = ""; + public static String colorWhiteTag = ""; + public static String colorLightGrayTag = ""; + protected static String[] tagList; + private int lastWidth = 0; + protected boolean selectionConversion = false; + protected int _initialSelection = -1; + + public Font getFont() { + return this._font; + } + + public int getWidth() { + return this._width; + } + + public int getHeight() { + return this._height; + } + + public void setWidth(int var1) { + this._width = var1 - 4; + } + + public void setHeight(int var1) { + this._height = var1 - 4; + } + + public Vector getLines() { + return this._lines; + } + + public int getScrollLine() { + return this._scrollLine; + } + + public int getCanvasLines() { + return this._canvasLines; + } + + public int getNumLines() { + return this._numLines; + } + + public boolean getHasFocus() { + return this._hasFocus; + } + + public Scrollbar getVertScrollbar() { + return this._vertBar; + } + + static Color getBackgroundColor() { + if (bgColor == null) { + int bgR = IniFile.override().getIniInt("chatBgR", 255); + int bgG = IniFile.override().getIniInt("chatBgG", 255); + int bgB = IniFile.override().getIniInt("chatBgB", 203); + bgColor = new Color(bgR, bgG, bgB); + } + + return bgColor; + } + + GammaTextArea(String text, int rows, int columns, int scrollbars) { + this._string = text; + this._numColumns = columns; + this._numRows = rows; + this._currentFontName = Console.message("GammaTextFont"); + this._currentStyle = 0; + this._currentPointSize = IniFile.gamma().getIniInt("ChatFontSize", 12); + this._currentColor = Color.black; + this._canvas = new StyledTextCanvas(); + this.setFontSize(this._currentPointSize); + this._lines = new Vector(); + this._pos = new Vector(); + this._lastpos = 0; + this._hasFocus = false; + this._numLines = this._scrollLine = this._canvasLines = 0; + switch(scrollbars) { + case 1: + this._vertBar = new GammaTextScrollbar(1); + this._horzBar = new GammaTextScrollbar(0); + break; + case 2: + this._vertBar = new GammaTextScrollbar(1); + this._horzBar = null; + break; + case 3: + this._vertBar = null; + this._horzBar = new GammaTextScrollbar(0); + break; + case 4: + this._vertBar = this._horzBar = null; + } + + GridBagLayout gridbag = new GridBagLayout(); + this.setLayout(gridbag); + GridBagConstraints c = new GridBagConstraints(); + c.fill = 1; + c.weightx = 1.0D; + c.weighty = 1.0D; + gridbag.setConstraints(this._canvas, c); + this.add(this._canvas); + if (this._vertBar != null) { + c = new GridBagConstraints(); + c.fill = 3; + c.gridwidth = 0; + gridbag.setConstraints(this._vertBar, c); + this.add(this._vertBar); + this._vertBar.addAdjustmentListener(this); + } + + if (this._horzBar != null) { + c = new GridBagConstraints(); + c.fill = 2; + c.gridwidth = 1; + this.add(this._horzBar); + this._horzBar.addAdjustmentListener(this); + } + + this.enableEvents(131231L); + this._canvas.repaint(); + } + + public synchronized void setFontSize(int fontsize) { + this._currentPointSize = fontsize; + this._font = new Font(this._currentFontName, this._currentStyle, this._currentPointSize); + this.recalcSize(); + } + + public synchronized void recalcSize() { + FontMetrics fm = this._canvas.getFontMetrics(this._font); + + if (fm == null) throw new AssertionError(); + + int w = fm.charWidth('M') * this._numColumns; + int h = fm.getHeight() * this._numRows; + this.setWidth(w); + this.setHeight(h); + this._canvas.setSize(w, h); + this.setWidth(w); + this.setHeight(h); + } + + public void update(Graphics var1) { + this.paint(var1); + } + + protected synchronized void processMouseEvent(MouseEvent e) { + if (e.isPopupTrigger()) { + if (this.rightMenu != null && this.rightMenu.isEnabled()) { + this.hideRightMenu(); + } else { + this.showRightMenu(e.getX(), e.getY()); + } + } - this._currentColor = new Color(color); + super.processMouseEvent(e); + } - try { - this._font = new Font(this._currentFontName, this._currentStyle, this._currentPointSize); - } catch (IllegalArgumentException var9) { - } + protected synchronized void processFocusEvent(FocusEvent e) { + if (e.getID() == 1004) { + this._hasFocus = true; + } else if (e.getID() == 1005) { + this._hasFocus = false; + } + + this._canvas.repaint(); + super.processFocusEvent(e); + } + + protected synchronized void processKeyEvent(KeyEvent e) { + this._canvas.dispatchEvent(e); + super.processKeyEvent(e); + } + + protected synchronized void processMouseWheelEvent(MouseWheelEvent e) { + if (e.getID() == 507) { + int move; + if (e.getScrollType() == 0) { + move = e.getScrollAmount() * e.getWheelRotation(); + } else { + move = scrollWheelStep * e.getWheelRotation(); + } - return true; - } else { - return this.handleSmiley(g, lower, x, y); - } - } - - private synchronized boolean handleSmiley(Graphics g, String lower, int x, int y) { - ImageCanvas image = emotes.getImage(lower); - if (image != null) { - this.drawImage(g, image, x, y); - return true; - } else { - return false; - } - } - - private synchronized void drawImage(Graphics g, ImageCanvas image, int x, int y) { - if (image != null && image.loaded_) { - Dimension size = image.imageSize(); - if (g != null) { - image.paint(g, x, (int)((double)y - size.getHeight())); - } - - this.lastWidth = (int)((double)this.lastWidth - (size.getWidth() + 8.0)); - } - - } - - protected void ClearTags(Graphics g) { - if (this._currentStyle != 0) { - this._currentStyle = 0; - this._font = new Font(this._currentFontName, this._currentStyle, this._currentPointSize); - } - - if (this._currentColor != Color.black) { - this._currentColor = Color.black; - } - - g.setFont(this._font); - g.setColor(this._currentColor); - } - - protected synchronized void wordWrap(String newText) { - int canvasWidth = this._width; - if (canvasWidth > 0) { - StringTokenizer rawLines = new StringTokenizer(newText, "\n\r"); - - label82: - while(rawLines.hasMoreTokens()) { - String rawLine = rawLines.nextToken(); - StringTokenizer words = new StringTokenizer(rawLine, "\n\r\t -", true); - int lineWidth = 0; - String thisLine = ""; - this.lastWidth = 0; - FontMetrics fm = this._canvas.getFontMetrics(this._font); + if (move != 0) { + this._vertBar.setValue(this._vertBar.getValue() + move); + this.requestFocus(); + this._canvas.sendDelayedMouseEvent(e); + this.adjustmentValueChanged((AdjustmentEvent)null); + } + } - assert fm != null; + super.processMouseWheelEvent(e); + } - while(true) { - while(true) { - String word; - do { - do { - if (!words.hasMoreTokens()) { - if (!thisLine.equals("")) { - this._pos.addElement(this._lastpos); - this._lastpos += thisLine.length() + 1; - ++this._numLines; - this._lines.addElement(thisLine.trim()); - } - continue label82; - } + public synchronized void adjustmentValueChanged(AdjustmentEvent e) { + this._scrollLine = this._vertBar.getValue(); + this._canvas.repaint(); + } - word = words.nextToken(); - } while(word.equals("\n")); - } while(word.equals("\r")); - - if (this.handleTag((Graphics)null, word, 0, 0)) { - lineWidth -= this.lastWidth; - thisLine = thisLine + word; - if (words.hasMoreTokens()) { - thisLine = thisLine + words.nextToken(); - } - - this.lastWidth = 0; - fm = this._canvas.getFontMetrics(this._font); - - assert fm != null; - } else { - this.lastWidth = fm.stringWidth(word); - if (this.lastWidth >= canvasWidth) { - if (!thisLine.equals("")) { - this._pos.addElement(this._lastpos); - this._lastpos += thisLine.length(); - this._lines.addElement(thisLine.trim()); - ++this._numLines; - lineWidth = 0; - } + public void setEditable(boolean var1) { + if (var1) { + System.out.println("Can't set GammaTextArea to be editable."); + } - while(this.lastWidth >= canvasWidth) { - word = this.breakWord(word, fm); - lineWidth = this.lastWidth = 0; - thisLine = ""; - if (word != null && word.length() > 0) { - this.lastWidth = fm.stringWidth(word); - } - } - } + } - lineWidth += this.lastWidth; - if (lineWidth > 0 && word != null && word.length() > 0) { - if (lineWidth >= canvasWidth) { - this._pos.addElement(this._lastpos); - this._lastpos += thisLine.length(); - this._lines.addElement(thisLine.trim()); - ++this._numLines; - lineWidth = this.lastWidth; - thisLine = ""; - } + public synchronized String getText() { + return this._string; + } - thisLine = thisLine + word; - } - } - } - } - } - - } - } - - protected String breakWord(String longWord, FontMetrics fm) { - int lineWidth = 0; - String thisLine = ""; - - for(int c = 0; c < longWord.length(); ++c) { - char ch = longWord.charAt(c); - lineWidth += fm.charWidth(ch); - if (lineWidth >= this._width) { - this._pos.addElement(this._lastpos); - this._lastpos += thisLine.length(); - this._lines.addElement(thisLine); - ++this._numLines; - lineWidth = fm.charWidth(ch); - thisLine = ""; - } - - thisLine = thisLine + ch; - } - - if (thisLine.length() > 0) { - this._pos.addElement(this._lastpos); - this._lastpos += thisLine.length(); - this._lines.addElement(thisLine); - ++this._numLines; - } - - return ""; - } - - public synchronized void rewrap() { - if (this._width > 0 && this._height > 0) { - this.wordWrapAll(); - this._scrollLine = this._numLines - this._canvasLines; - if (this._scrollLine < 0) { + public synchronized void setText(String s) { + this._string = s; + this.wordWrapAll(); + this._scrollLine = this._numLines - this._canvasLines; + if (this._scrollLine < 0) { this._scrollLine = 0; - } + } - this.setScrollBounds(); - this._canvas.repaint(); - } - - } - - public synchronized void setScrollBounds() { - FontMetrics fm = this._canvas.getFontMetrics(this._font); - - assert fm != null; - - int lineHeight = fm.getHeight(); - this._canvasLines = (this._height + fm.getDescent()) / lineHeight; - if (this._vertBar != null) { - if (this._numLines <= this._canvasLines) { - this._vertBar.setEnabled(false); - } else { - this._vertBar.setEnabled(true); - this._vertBar.setValues(this._scrollLine, this._canvasLines, 0, this._numLines); - this._vertBar.setBlockIncrement(this._canvasLines); - } - } - - } - - public synchronized void append(String s) { - this._string = this._string + s; - this.wordWrap(s); - this._scrollLine = this._numLines - this._canvasLines; - if (this._scrollLine < 0) { - this._scrollLine = 0; - } - - this.setScrollBounds(); - } - - public synchronized void replaceRange(String s, int start, int end) { - String newString = this._string.substring(0, start) + s + this._string.substring(end); - this._string = newString; - } - - public synchronized void drawLine(Graphics g, int lineNum, int y) { - if (lineNum < this._pos.size()) { - String thisLine = (String)this._lines.elementAt(lineNum); - - assert thisLine != null; - - this._curpos = (Integer)this._pos.elementAt(lineNum); - StringTokenizer st = new StringTokenizer(thisLine, " \n\r", true); - int x = 0; - this.lastWidth = 0; - - while(st.hasMoreTokens()) { - String word = st.nextToken(); - if (!this.handleTag(g, word, 2 + x, y + 2)) { - this.drawString(g, word, 2 + x, y + 2); - this.lastWidth = g.getFontMetrics().stringWidth(word); - x += this.lastWidth; - } else { - x -= this.lastWidth; - if (st.hasMoreTokens()) { - this._curpos += st.nextToken().length(); - } - - this.lastWidth = 0; - g.setFont(this._font); - g.setColor(this._currentColor); - this._curpos += word.length(); - } - } - - this.ClearTags(g); - } - } - - private void drawString(Graphics g, String text, int x, int y) { - FontMetrics fm = g.getFontMetrics(); - int startdist; - int i; - if (this.selectionConversion) { - startdist = fm.getHeight(); - int pos = -1; - if (y - startdist < this._canvas.mouseY) { - if (y < this._canvas.mouseY) { - if (y < this._canvas.mouseY) { - if (this.selectionStart >= 0) { - pos = this._curpos + text.length(); - } - } else { - this.selectionConversion = false; - } - } else if (x <= this._canvas.mouseX) { - if (this._canvas.mouseX > x + g.getFontMetrics().stringWidth(text)) { - if (this.selectionStart >= 0 && this._curpos >= this.selectionStart) { - pos = this._curpos + text.length(); - } - } else { - if (this._canvas.mouseDoubleClick) { - this._canvas.mouseDoubleClick = false; - this.selectionStart = this._initialSelection = this._curpos; - this.selectionEnd = this._curpos + text.length(); - pos = -1; - } else { - for(i = 0; i < text.length() - 1 && x + fm.stringWidth(text.substring(0, i + 1)) < this._canvas.mouseX; ++i) { - } + this.setScrollBounds(); + } - pos = this._curpos + i; - } + public synchronized void repaint() { + this._canvas.repaint(); + super.repaint(); + } + + protected synchronized void wordWrapAll() { + this._lines.removeAllElements(); + this._pos.removeAllElements(); + this._numLines = 0; + this._lastpos = 0; + this.wordWrap(this._string); + } + + protected synchronized boolean isLastLineVisible() { + if (!this._canvas.mouseActive && (this.selectionStart < 0 || this.selectionEnd <= this.selectionStart)) { + return this._scrollLine >= this._numLines - this._canvasLines || this._numLines <= this._canvasLines; + } else { + return false; + } + } + + protected synchronized boolean handleTag(Graphics g, String word, int x, int y) { + String lower = word.toLowerCase(); + int color; + if (word.charAt(0) == '<') { + for (color = 0; color < tagList.length; ++color) { + if (lower.equals(tagList[color].toLowerCase())) { + switch (color) { + case 0: + this._currentStyle |= 1; + break; + case 1: + this._currentStyle &= -2; + break; + case 2: + this._currentStyle |= 2; + break; + case 3: + this._currentStyle &= -3; + break; + case 4: + this._currentColor = Color.magenta; + break; + case 5: + this._currentColor = Color.red; + break; + case 6: + this._currentColor = Color.green; + break; + case 7: + this._currentColor = Color.blue; + break; + case 8: + this._currentColor = Color.black; + break; + case 9: + this._currentColor = Color.magenta; + break; + case 10: + this._currentColor = Color.blue; + break; + case 11: + this._currentColor = Color.red; + break; + case 12: + this._currentColor = Color.green; + break; + case 13: + this._currentColor = Color.cyan; + break; + case 14: + this._currentColor = Color.darkGray; + break; + case 15: + this._currentColor = Color.gray; + break; + case 16: + this._currentColor = Color.orange; + break; + case 17: + this._currentColor = Color.pink; + break; + case 18: + this._currentColor = Color.yellow; + break; + case 19: + this._currentColor = Color.white; + break; + case 20: + this._currentColor = Color.lightGray; + } + + try { + this._font = new Font(this._currentFontName, this._currentStyle, this._currentPointSize); + } catch (IllegalArgumentException var4) { + } + + return true; + } + } + + return false; + } else return false; + } + + protected void ClearTags(Graphics var1) { + if (this._currentStyle != 0) { + this._currentStyle = 0; + this._font = new Font(this._currentFontName, this._currentStyle, this._currentPointSize); + } - this.selectionConversion = false; - } - } else { - this.selectionConversion = false; - } - } else if (this.selectionStart >= 0 && this._curpos >= this.selectionStart) { - this.selectionConversion = false; - } - - if (pos >= 0) { - if (this.selectionStart < 0) { - this.selectionStart = this._initialSelection = pos; - this.selectionEnd = this.selectionStart + 1; - } else if (pos < this._initialSelection) { - this.selectionStart = pos; - this.selectionEnd = this._initialSelection + 1; - } else { - this.selectionStart = this._initialSelection; - this.selectionEnd = pos + 1; - } - } - } + if (this._currentColor != Color.black) { + this._currentColor = Color.black; + } + + var1.setFont(this._font); + var1.setColor(this._currentColor); + } + + protected synchronized void wordWrap(String newText) { + int canvasWidth = this._width; + if (canvasWidth > 0) { + StringTokenizer rawLines = new StringTokenizer(newText, "\n\r"); + + label82: + while(rawLines.hasMoreTokens()) { + String rawLine = rawLines.nextToken(); + StringTokenizer words = new StringTokenizer(rawLine, "\n\r\t -", true); + int lineWidth = 0; + StringBuffer thisLine = new StringBuffer(); + this.lastWidth = 0; + FontMetrics fm = this._canvas.getFontMetrics(this._font); + + if (fm == null) throw new AssertionError(); + + while(true) { + while(true) { + String word; + do { + do { + if (!words.hasMoreTokens()) { + if (!thisLine.toString().equals("")) { + this._pos.addElement(new Integer(this._lastpos)); + this._lastpos += thisLine.length() + 1; + ++this._numLines; + this._lines.addElement(thisLine.toString().trim()); + } + continue label82; + } + + word = words.nextToken(); + } while(word.equals("\n")); + } while(word.equals("\r")); + + if (this.handleTag((Graphics)null, word, 0, 0)) { + lineWidth -= this.lastWidth; + thisLine.append(word); + if (words.hasMoreTokens()) { + thisLine.append(words.nextToken()); + } + + this.lastWidth = 0; + fm = this._canvas.getFontMetrics(this._font); + + if (fm == null) throw new AssertionError(); + } else { + this.lastWidth = fm.stringWidth(word); + if (this.lastWidth >= canvasWidth) { + if (!thisLine.toString().equals("")) { + this._pos.addElement(new Integer(this._lastpos)); + this._lastpos += thisLine.length(); + this._lines.addElement(thisLine.toString().trim()); + ++this._numLines; + lineWidth = 0; + } + + while(this.lastWidth >= canvasWidth) { + word = this.breakWord(word, fm); + lineWidth = this.lastWidth = 0; + thisLine = new StringBuffer(); + if (word != null && word.length() > 0) { + this.lastWidth = fm.stringWidth(word); + } + } + } + + lineWidth += this.lastWidth; + if (lineWidth > 0 && word != null && word.length() > 0) { + if (lineWidth >= canvasWidth) { + this._pos.addElement(new Integer(this._lastpos)); + this._lastpos += thisLine.length(); + this._lines.addElement(thisLine.toString().trim()); + ++this._numLines; + lineWidth = this.lastWidth; + thisLine = new StringBuffer(); + } - if (this.selectionStart >= 0 && this.selectionEnd > this.selectionStart) { - startdist = this.selectionStart - this._curpos; - if (startdist > 0) { - if (startdist < text.length()) { - i = text.length(); - if (this._curpos + i >= this.selectionEnd) { - i = this.selectionEnd - this._curpos; - } - - this.drawHighlight(g, text.substring(startdist, i), x + fm.stringWidth(text.substring(0, startdist)), y); - } - } else if (this.selectionEnd > this._curpos) { - if (this.selectionEnd - this._curpos < text.length()) { - this.drawHighlight(g, text.substring(0, this.selectionEnd - this._curpos), x, y); - } else { - this.drawHighlight(g, text, x, y); + thisLine.append(word); + } + } + } + } } - } - } - g.drawString(text, x, y); - this._curpos += text.length(); - } - - private void drawHighlight(Graphics g, String text, int x, int y) { - if (text != null && text.length() > 0) { - Color c = g.getColor(); - g.setColor(skyblue); - int height = g.getFontMetrics().getHeight(); - g.fillRect(x, y - (height - 2), g.getFontMetrics().stringWidth(text), height); - g.setColor(c); - } - - } - - public int getSelectionStart() { - return this.selectionStart; - } - - public int getSelectionEnd() { - return this.selectionEnd; - } - - public void setSelectionStart(int position) { - this.selectionStart = position; - } - - public void setSelectionEnd(int position) { - this.selectionEnd = position; - } - - public synchronized String getSelectionText() { - if (this.selectionStart >= 0 && this.selectionEnd > this.selectionStart) { - return this.selectionEnd >= this.getText().length() ? this.getText().substring(this.selectionStart) : this.getText().substring(this.selectionStart, this.selectionEnd); - } else { - return ""; - } - } - - private void initRightMenu() { - this.rightMenu = new PopupMenu(); - this.rightMenu.add(this.textCopyItem); - this.rightMenu.add(this.textCopyTextItem); - if (this.selectionStart >= 0 && this.selectionEnd > this.selectionStart) { - this.textCopyItem.setEnabled(true); - this.textCopyTextItem.setEnabled(true); - } else { - this.textCopyItem.setEnabled(false); - this.textCopyTextItem.setEnabled(false); - } - - this.rightMenu.add(this.textCopyAllItem); - this.rightMenu.add(this.textCopyAllTextItem); - this.rightMenu.add(this.textOpenURLItem); - this.rightMenu.addActionListener(this); - this.add(this.rightMenu); - } - - private void showRightMenu(int x, int y) { - if (this.rightMenu == null) { - this.initRightMenu(); - } - - this.rightMenu.show(this, x, y); - } - - private void hideRightMenu() { - this.remove(this.rightMenu); - this.rightMenu = null; - } - - public synchronized void actionPerformed(ActionEvent e) { - String text = null; - boolean doClean = false; - if (e.getActionCommand() == this.textCopyItem.getActionCommand()) { - text = this.getSelectionText(); - this.selectionStart = this.selectionEnd = -1; - this.repaint(); - } else if (e.getActionCommand() == this.textCopyTextItem.getActionCommand()) { - text = this.getSelectionText(); - doClean = true; - this.selectionStart = this.selectionEnd = -1; - this.repaint(); - } else if (e.getActionCommand() == this.textCopyAllItem.getActionCommand()) { - text = this.getText(); - } else if (e.getActionCommand() == this.textCopyAllTextItem.getActionCommand()) { - text = this.getText(); - doClean = true; - } else if (e.getActionCommand() == this.textOpenURLItem.getActionCommand()) { - text = this.getSelectionText().trim(); - if (text != null && text.length() > 5) { - if (!text.startsWith("http://") && !text.startsWith("https://") && !text.startsWith("world:")) { - text = "http://" + text; - } - - if (text.startsWith("world:") || text.contains(".world#") || (text.startsWith("http") || text.startsWith("file:")) && text.endsWith(".world")) { - if (text.startsWith("world:")) { - text = text.substring(6); - } + } + } - TeleportAction.teleport(text, (TeleportStatus)null); + protected String breakWord(String var1, FontMetrics var2) { + int var3 = 0; + StringBuffer var4 = new StringBuffer(); + + for(int var5 = 0; var5 < var1.length(); ++var5) { + char var6 = var1.charAt(var5); + var3 += var2.charWidth(var6); + if (var3 >= this._width) { + this._lines.addElement(var4.toString()); + ++this._numLines; + return var1.substring(var5); + } + + var4.append(var6); + } + + this._lines.addElement(var4.toString()); + ++this._numLines; + return ""; + } + + public synchronized void rewrap() { + if (this._width > 0 && this._height > 0) { + this.wordWrapAll(); + this._scrollLine = this._numLines - this._canvasLines; + if (this._scrollLine < 0) { + this._scrollLine = 0; + } + + this.setScrollBounds(); + this._canvas.repaint(); + } + + } + + private synchronized void setScrollBounds() { + FontMetrics var1 = this._canvas.getFontMetrics(this._font); + assert(var1 != null); + int var2 = var1.getHeight(); + this._canvasLines = this._height / var2; + if (this._vertBar != null) { + if (this._numLines <= this._canvasLines) { + this._vertBar.setEnabled(false); } else { - (new SendURLAction(text)).startBrowser(); - } + this._vertBar.setEnabled(true); + this._vertBar.setValues(this._scrollLine, this._canvasLines, 0, this._numLines); + this._vertBar.setBlockIncrement(this._canvasLines); + } + } + + } + + public synchronized void append(String var1) { + this._string = this._string + var1; + this.wordWrap(var1); + this._scrollLine = this._numLines - this._canvasLines; + if (this._scrollLine < 0) { + this._scrollLine = 0; + } + + this.setScrollBounds(); + } + + public synchronized void replaceRange(String var1, int var2, int var3) { + String var4 = this._string.substring(0, var2) + var1 + this._string.substring(var3); + this._string = var4; + } + public synchronized void drawLine(Graphics g, int lineNum, int y) { + if (lineNum < this._pos.size()) { + String thisLine = (String)this._lines.elementAt(lineNum); + + if (thisLine == null) throw new AssertionError(); + + this._curpos = ((Integer)this._pos.elementAt(lineNum)).intValue(); + StringTokenizer st = new StringTokenizer(thisLine, " \n\r", true); + int x = 0; + this.lastWidth = 0; + + while(st.hasMoreTokens()) { + String word = st.nextToken(); + if (!this.handleTag(g, word, 2 + x, y + 2)) { + this.drawString(g, word, 2 + x, y + 2); + this.lastWidth = g.getFontMetrics().stringWidth(word); + x += this.lastWidth; + } else { + x -= this.lastWidth; + if (st.hasMoreTokens()) { + this._curpos += st.nextToken().length(); + } + + this.lastWidth = 0; + g.setFont(this._font); + g.setColor(this._currentColor); + this._curpos += word.length(); + } + } + + this.ClearTags(g); + } + } + + private void drawString(Graphics g, String text, int x, int y) { + FontMetrics fm = g.getFontMetrics(); + int startdist; + int i; + if (this.selectionConversion) { + startdist = fm.getHeight(); + int pos = -1; + if (y - startdist < this._canvas.mouseY) { + if (y < this._canvas.mouseY) { + if (y < this._canvas.mouseY) { + if (this.selectionStart >= 0) { + pos = this._curpos + text.length(); + } + } else { + this.selectionConversion = false; + } + } else if (x <= this._canvas.mouseX) { + if (this._canvas.mouseX > x + g.getFontMetrics().stringWidth(text)) { + if (this.selectionStart >= 0 && this._curpos >= this.selectionStart) { + pos = this._curpos + text.length(); + } + } else { + if (this._canvas.mouseDoubleClick) { + this._canvas.mouseDoubleClick = false; + this.selectionStart = this._initialSelection = this._curpos; + this.selectionEnd = this._curpos + text.length(); + pos = -1; + } else { + for(i = 0; i < text.length() - 1 && x + fm.stringWidth(text.substring(0, i + 1)) < this._canvas.mouseX; ++i) { + } + + pos = this._curpos + i; + } + + this.selectionConversion = false; + } + } else { + this.selectionConversion = false; + } + } else if (this.selectionStart >= 0 && this._curpos >= this.selectionStart) { + this.selectionConversion = false; + } + + if (pos >= 0) { + if (this.selectionStart < 0) { + this.selectionStart = this._initialSelection = pos; + this.selectionEnd = this.selectionStart + 1; + } else if (pos < this._initialSelection) { + this.selectionStart = pos; + this.selectionEnd = this._initialSelection + 1; + } else { + this.selectionStart = this._initialSelection; + this.selectionEnd = pos + 1; + } + } + } + + if (this.selectionStart >= 0 && this.selectionEnd > this.selectionStart) { + startdist = this.selectionStart - this._curpos; + if (startdist > 0) { + if (startdist < text.length()) { + i = text.length(); + if (this._curpos + i >= this.selectionEnd) { + i = this.selectionEnd - this._curpos; + } + + this.drawHighlight(g, text.substring(startdist, i), x + fm.stringWidth(text.substring(0, startdist)), y); + } + } else if (this.selectionEnd > this._curpos) { + if (this.selectionEnd - this._curpos < text.length()) { + this.drawHighlight(g, text.substring(0, this.selectionEnd - this._curpos), x, y); + } else { + this.drawHighlight(g, text, x, y); + } + } + } + + g.drawString(text, x, y); + this._curpos += text.length(); + } + + private void drawHighlight(Graphics g, String text, int x, int y) { + if (text != null && text.length() > 0) { + Color c = g.getColor(); + g.setColor(skyblue); + int height = g.getFontMetrics().getHeight(); + g.fillRect(x, y - (height - 2), g.getFontMetrics().stringWidth(text), height); + g.setColor(c); + } + + } + + public int getSelectionStart() { + return this.selectionStart; + } + + public int getSelectionEnd() { + return this.selectionEnd; + } + + public void setSelectionStart(int position) { + this.selectionStart = position; + } + + public void setSelectionEnd(int position) { + this.selectionEnd = position; + } + + public synchronized String getSelectionText() { + if (this.selectionStart >= 0 && this.selectionEnd > this.selectionStart) { + return this.getText().substring(this.selectionStart, this.selectionEnd); + } else { + return ""; + } + } + + private void initRightMenu() { + this.rightMenu = new PopupMenu(); + this.rightMenu.add(this.textCopyItem); + this.rightMenu.add(this.textCopyTextItem); + if (this.selectionStart >= 0 && this.selectionEnd > this.selectionStart) { + this.textCopyItem.setEnabled(true); + this.textCopyTextItem.setEnabled(true); + } else { + this.textCopyItem.setEnabled(false); + this.textCopyTextItem.setEnabled(false); + } + + this.rightMenu.add(this.textCopyAllItem); + this.rightMenu.add(this.textCopyAllTextItem); + this.rightMenu.add(this.textSaveItem); + this.rightMenu.add(this.textOpenURLItem); + this.rightMenu.addActionListener(this); + this.add(this.rightMenu); + } + + private void showRightMenu(int x, int y) { + if (this.rightMenu == null) { + this.initRightMenu(); + } + + this.rightMenu.show(this, x, y); + } + + private void hideRightMenu() { + this.remove(this.rightMenu); + this.rightMenu = null; + } + + public synchronized void actionPerformed(ActionEvent e) { + String text = null; + boolean doClean = false; + if (e.getActionCommand() == this.textCopyItem.getActionCommand()) { + text = this.getSelectionText(); this.selectionStart = this.selectionEnd = -1; this.repaint(); - } + } else if (e.getActionCommand() == this.textCopyTextItem.getActionCommand()) { + text = this.getSelectionText(); + doClean = true; + this.selectionStart = this.selectionEnd = -1; + this.repaint(); + } else if (e.getActionCommand() == this.textCopyAllItem.getActionCommand()) { + text = this.getText(); + } else if (e.getActionCommand() == this.textCopyAllTextItem.getActionCommand()) { + text = this.getText(); + doClean = true; + } else if (e.getActionCommand() == this.textOpenURLItem.getActionCommand()) { + text = this.getSelectionText().trim(); + if (text != null && text.length() > 5) { + if (!text.startsWith("http://") && !text.startsWith("https://") && !text.startsWith("world:")) { + text = "http://" + text; + } + + if (text.startsWith("world:") || text.indexOf(".world#") != -1 || (text.startsWith("http") || text.startsWith("file:")) && text.endsWith(".world")) { + if (text.startsWith("world:")) { + text = text.substring(6); + } + + TeleportAction.teleport(text, (TeleportStatus)null); + } else { + (new SendURLAction(text)).startBrowser(); + } - this.hideRightMenu(); - return; - } - - if (doClean) { - StringTokenizer st = new StringTokenizer(text, " \n\r", true); - String newText = ""; - - while(st.hasMoreTokens()) { - String word = st.nextToken(); - if (!this.handleTag((Graphics)null, word, 0, 0)) { - newText = newText + word; - } else { - if (newText.length() > 0 && newText.substring(newText.length() - 1).toCharArray()[0] == ' ') { - newText = newText.substring(0, newText.length() - 1); - } - - if (st.hasMoreTokens()) { - st.nextToken(); - } - } - } - - text = newText; - } - - if (text != null && text.length() > 0) { - Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); - clipboard.setContents(new StringSelection(text), (ClipboardOwner)null); - } + this.selectionStart = this.selectionEnd = -1; + this.repaint(); + } - this.hideRightMenu(); - } + this.hideRightMenu(); + return; + } else if (e.getActionCommand() == this.textSaveItem.getActionCommand()) { + new ChatSavePart(this._string); + return; + } + + if (doClean) { + StringTokenizer st = new StringTokenizer(text, " \n\r", true); + String newText = ""; + + while(st.hasMoreTokens()) { + String word = st.nextToken(); + if (!this.handleTag((Graphics)null, word, 0, 0)) { + newText = newText + word; + } else { + if (newText.length() > 0 && newText.substring(newText.length() - 1).toCharArray()[0] == ' ') { + newText = newText.substring(0, newText.length() - 1); + } + + if (st.hasMoreTokens()) { + st.nextToken(); + } + } + } + + text = newText; + } + + if (text != null && text.length() > 0) { + Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); + clipboard.setContents(new StringSelection(text), (ClipboardOwner)null); + } + + this.hideRightMenu(); + } + + static { + tagList = new String[]{boldStartTag, boldEndTag, italicStartTag, italicEndTag, colorStartMagentaTag, colorStartRedTag, colorStartGreenTag, colorStartBlueTag, colorEndTag, colorMagenta2Tag, colorBlue2Tag, colorRed2Tag, colorGreen2Tag, colorCyanTag, colorDarkGrayTag, colorGrayTag, colorOrangeTag, colorPinkTag, colorYellowTag, colorWhiteTag, colorLightGrayTag}; + } } diff -ruN a/1920/NET/worlds/console/HiddenDrone.java b/1920/NET/worlds/console/HiddenDrone.java --- a/1920/NET/worlds/console/HiddenDrone.java 1969-12-31 18:00:00.000000000 -0600 +++ b/1920/NET/worlds/console/HiddenDrone.java 2023-08-21 23:27:17.000000000 -0500 @@ -0,0 +1,4 @@ +package NET.worlds.console; + +public interface HiddenDrone { +} diff -ruN a/1920/NET/worlds/console/MuteListPart.java b/1920/NET/worlds/console/MuteListPart.java --- a/1920/NET/worlds/console/MuteListPart.java 2024-01-08 01:46:30.000000000 -0600 +++ b/1920/NET/worlds/console/MuteListPart.java 2023-08-21 23:27:17.000000000 -0500 @@ -7,235 +7,246 @@ import NET.worlds.network.WorldServer; import NET.worlds.scape.Drone; import NET.worlds.scape.FrameEvent; -import java.awt.Container; -import java.awt.Event; -import java.awt.MenuItem; -import java.text.MessageFormat; + +import java.awt.*; +import java.awt.Window; import java.util.Enumeration; import java.util.StringTokenizer; import java.util.Vector; public class MuteListPart implements FramePart, NameListOwner { - private static final String oldIniItemName = "Mutes"; - private static final String iniItemName = "Mute"; - private static final int maxMutes = 50; - private static final String separator = ";"; - private static MuteListPart active; - private Vector mutes; - private Vector syncMutes = new Vector(); - private MenuItem editItem; - private MenuItem disableWhisperItem; - private boolean rejectWhispers; - private DefaultConsole console; - private Galaxy galaxy; - private IniFile serverSection; - private Object mutesMutex = new Object(); - private Vector updates = new Vector(); - - private void loadMutes() { - this.mutes = new Vector(); - - for(int i = 0; i < 50; ++i) { - String name = this.serverSection.getIniString("Mute" + i, ""); - if (name.length() == 0) { - break; - } - - if (FriendsListPart.isValidUserName(name) && !FriendsListPart.icontains(this.mutes, name)) { - this.mutes.addElement(name); - } - } - - if (this.mutes.size() == 0) { - String mutesStr = this.serverSection.getIniString("Mutes", ""); - StringTokenizer tokens = new StringTokenizer(mutesStr, ";"); - - while(tokens.hasMoreTokens() && this.mutes.size() < 50) { - String name = tokens.nextToken(); - if (FriendsListPart.isValidUserName(name) && !FriendsListPart.icontains(this.mutes, name)) { - this.mutes.addElement(name); + private static final String oldIniItemName = "Mutes"; + private static final String iniItemName = "Mute"; + private static final String separator = ";"; + private static MuteListPart active; + private Vector mutes; + private Vector syncMutes = new Vector(); + private MenuItem editItem; + private boolean rejectWhispers; + private boolean rejectTeleports; + private DefaultConsole console; + private Galaxy galaxy; + private IniFile serverSection; + private Object mutesMutex = new Object(); + private Vector updates = new Vector(); + public static RejectHandler rej = new RejectHandler(); + + public MuteListPart() { + System.out.println("Mutes Loaded"); + } + + private void loadMutes() { + this.mutes = new Vector(); + + for(int var1 = 0; var1 < 50; ++var1) { + String var2 = this.serverSection.getIniString("Mute" + var1, ""); + if (var2.length() == 0) { + break; + } + + if (FriendsListPart.isValidUserName(var2) && !FriendsListPart.icontains(this.mutes, var2)) { + this.mutes.addElement(var2); + } + } + + if (this.mutes.size() == 0) { + String var4 = this.serverSection.getIniString("Mutes", ""); + StringTokenizer var5 = new StringTokenizer(var4, ";"); + + while(var5.hasMoreTokens() && this.mutes.size() < 50) { + String var3 = var5.nextToken(); + if (FriendsListPart.isValidUserName(var3) && !FriendsListPart.icontains(this.mutes, var3)) { + this.mutes.addElement(var3); + } + } + + if (this.mutes.size() != 0) { + this.saveMutes(); + this.serverSection.setIniString("Mutes", ""); + } + } + + } + + void saveMutes() { + String var1 = ""; + int var2 = this.mutes.size(); + + for(int var3 = 0; var3 < var2; ++var3) { + this.serverSection.setIniString("Mute" + var3, (String)this.mutes.elementAt(var3)); + } + + this.serverSection.setIniString("Mute" + var2, ""); + } + + public void activate(Console var1, Container var2, Console var3) { + active = this; + this.console = (DefaultConsole)var1; + this.editItem = var1.addMenuItem(Console.message("Edit-Mute-List"), "Options"); + this.editItem.setEnabled(this.mutes != null); + } + + public void deactivate() { + active = null; + this.editItem = null; + } + + public boolean action(Event var1, Object var2) { + if (var1.target == this.editItem) { + new EditNamesDialog(this, Console.message("Edit-Mute-List"), Console.message("Add-Mute-List")); + return true; + } else { + return false; + } + } + + public boolean handle(FrameEvent var1) { + synchronized(this.mutesMutex) { + int var3 = this.updates.size(); + if (var3 != 0) { + WorldServer var4 = this.console.getServerNew(); + if (var4 != null) { + for(int var5 = 0; var5 < var3; ++var5) { + String var6 = (String)this.updates.elementAt(var5); + boolean var7 = this.mutes.contains(var6); + NetworkObject var8 = var4.getObject(new ObjID(var6)); + if (var8 instanceof Drone) { + Drone var9 = (Drone)var8; + var9.muteStateChanged(); + } + + this.console.getFriends().changeMuteState(var6, var7); + } + + this.updates.removeAllElements(); + this.syncMutes = (Vector)this.mutes.clone(); + } + } + + return true; + } + } + + public void setServer(WorldServer var1, IniFile var2) { + this.serverSection = var2; + this.galaxy = var1.getGalaxy(); + this.loadMutes(); + if (this.editItem != null) { + this.editItem.setEnabled(true); + } + + } + + public static boolean isMuted(WorldServer var0, String var1) { + if (var0 != null && var1 != null) { + Galaxy var2 = var0.getGalaxy(); + Enumeration var3 = var2.getConsoles(); + + while(var3.hasMoreElements()) { + Object var4 = var3.nextElement(); + if (var4 instanceof DefaultConsole) { + NET.worlds.console.MuteListPart var5 = ((DefaultConsole)var4).getMutes(); + if (var5.mutes != null) { + return FriendsListPart.icontains(var5.mutes, var1); + } + } } - } + } - if (this.mutes.size() != 0) { + return false; + } + + public static boolean isRejecting(WorldServer var0, String var5) { + if (var0 != null) { + Galaxy var1 = var0.getGalaxy(); + Enumeration var2 = var1.getConsoles(); + + while(var2.hasMoreElements()) { + Object var3 = var2.nextElement(); + if (var3 instanceof DefaultConsole) { + MuteListPart var4 = ((DefaultConsole)var3).getMutes(); + return var4.rejectWhispers || !allowWhisper(var5); + } + } + } + + return false; + } + + public static boolean isRejectingTele(WorldServer var0, String var5) { + if (var0 != null) { + Galaxy var1 = var0.getGalaxy(); + Enumeration var2 = var1.getConsoles(); + + while(var2.hasMoreElements()) { + Object var3 = var2.nextElement(); + if (var3 instanceof DefaultConsole) { + MuteListPart var4 = ((DefaultConsole)var3).getMutes(); + return var4.rejectTeleports || !allowTeleport(var5); + } + } + } + + return false; + } + + private static boolean allowWhisper(String player) { + int value = IniFile.gamma().getIniInt("WhisperPrivacy", 0); + if (value != 0) { + if (value == 1 && FriendsListPart.icontains(FriendsListPart.friends, player)) return true; + else return false; + } else return true; + } + + private static boolean allowTeleport(String player) { + int value = IniFile.gamma().getIniInt("TeleportPrivacy", 0); + if (value != 0) { + if (value == 1 && FriendsListPart.icontains(FriendsListPart.friends, player)) return true; + else return false; + } else return true; + } + + public int getNameListCount() { + return this.mutes.size(); + } + + public String getNameListName(int var1) { + return (String)this.mutes.elementAt(var1); + } + + public void removeNameListName(int var1) { + synchronized(this.mutesMutex) { + String var3 = (String)this.mutes.elementAt(var1); + this.mutes.removeElementAt(var1); this.saveMutes(); - this.serverSection.setIniString("Mutes", ""); - } - } - - } - - void saveMutes() { - int count = this.mutes.size(); - - for(int i = 0; i < count; ++i) { - this.serverSection.setIniString("Mute" + i, (String)this.mutes.elementAt(i)); - } - - this.serverSection.setIniString("Mute" + count, ""); - } - - private void setDisableWhisper() { - this.rejectWhispers = IniFile.gamma().getIniInt("RejectWhispers", 0) == 1; - if (this.rejectWhispers) { - this.disableWhisperItem.setLabel(Console.message("Accept-Whispers")); - } else { - this.disableWhisperItem.setLabel(Console.message("Reject-Whispers")); - } - - } - - public void activate(Console c, Container f, Console prev) { - active = this; - this.console = (DefaultConsole)c; - this.editItem = c.addMenuItem(Console.message("Edit-Mute-List"), "Options"); - this.editItem.setEnabled(this.mutes != null); - this.disableWhisperItem = c.addMenuItem(Console.message("Reject-Whispers"), "Options"); - this.setDisableWhisper(); - } - - public void deactivate() { - active = null; - this.editItem = null; - } - - public boolean action(Event event, Object what) { - if (event.target == this.editItem) { - new EditNamesDialog(this, Console.message("Edit-Mute-List"), Console.message("Add-Mute-List")); - return true; - } else { - if (event.target == this.disableWhisperItem) { - IniFile.gamma().setIniInt("RejectWhispers", this.rejectWhispers ? 0 : 1); - this.setDisableWhisper(); - } - - return false; - } - } - - public boolean handle(FrameEvent f) { - synchronized(this.mutesMutex) { - int count = this.updates.size(); - if (count != 0) { - WorldServer server = this.console.getServerNew(); - if (server != null) { - for(int i = 0; i < count; ++i) { - String name = (String)this.updates.elementAt(i); - boolean muted = this.mutes.contains(name); - NetworkObject obj = server.getObject(new ObjID(name)); - if (obj instanceof Drone) { - Drone d = (Drone)obj; - d.muteStateChanged(); - } - - this.console.getFriends().changeMuteState(name, muted); - } - - this.updates.removeAllElements(); - this.syncMutes = (Vector)this.mutes.clone(); - } - } - - return true; - } - } - - public void setServer(WorldServer server, IniFile serverSection) { - this.serverSection = serverSection; - this.galaxy = server.getGalaxy(); - this.loadMutes(); - if (this.editItem != null) { - this.editItem.setEnabled(true); - } - - } - - public static boolean isMuted(WorldServer server, String name) { - if (server != null && name != null) { - Galaxy g = server.getGalaxy(); - Enumeration consoleList = g.getConsoles(); - - while(consoleList.hasMoreElements()) { - Object c = consoleList.nextElement(); - if (c instanceof DefaultConsole) { - MuteListPart target = ((DefaultConsole)c).getMutes(); - if (target.mutes != null) { - return FriendsListPart.icontains(target.mutes, name); - } - } - } - } - - return false; - } - - public static boolean isRejecting(WorldServer server) { - if (server != null) { - Galaxy g = server.getGalaxy(); - Enumeration consoleList = g.getConsoles(); - - while(consoleList.hasMoreElements()) { - Object c = consoleList.nextElement(); - if (c instanceof DefaultConsole) { - MuteListPart target = ((DefaultConsole)c).getMutes(); - if (target.rejectWhispers) { - return true; - } - } - } - } - - return false; - } - - public int getNameListCount() { - return this.mutes.size(); - } - - public String getNameListName(int index) { - return (String)this.mutes.elementAt(index); - } - - public void removeNameListName(int index) { - synchronized(this.mutesMutex) { - String name = (String)this.mutes.elementAt(index); - this.mutes.removeElementAt(index); - this.saveMutes(); - if (!this.updates.contains(name)) { - this.updates.addElement(name); - } - - } - } - - public boolean mayAddNameListName(java.awt.Window currentWindow) { - if (this.mutes.size() < 50) { - return true; - } else { - Object[] arguments = new Object[]{new String("50")}; - new OkCancelDialog(currentWindow, (DialogReceiver)null, Console.message("Too-many-names"), (String)null, Console.message("OK"), MessageFormat.format(Console.message("You-are-limitedM"), arguments), true); - return false; - } - } - - public int addNameListName(String name) { - synchronized(this.mutesMutex) { - if (name.toLowerCase().startsWith("host")) { - return -1; - } else { - int index = FriendsListPart.iindexOf(this.mutes, name); - if (index != -1) { - return index; + if (!this.updates.contains(var3)) { + this.updates.addElement(var3); + } + } + } + + public boolean mayAddNameListName(Window var1) { + return true; + } + + public int addNameListName(String var1) { + synchronized(this.mutesMutex) { + if (var1.toLowerCase().startsWith("host")) { + return -1; } else { - this.mutes.addElement(name); - this.saveMutes(); - if (!this.updates.contains(name)) { - this.updates.addElement(name); - } - - return this.mutes.size() - 1; - } - } - } - } + int var3 = FriendsListPart.iindexOf(this.mutes, var1); + if (var3 != -1) { + return var3; + } else { + this.mutes.addElement(var1); + this.saveMutes(); + if (!this.updates.contains(var1)) { + this.updates.addElement(var1); + } + + return this.mutes.size() - 1; + } + } + } + } } diff -ruN a/1920/NET/worlds/console/OpenWhisperDialog.java b/1920/NET/worlds/console/OpenWhisperDialog.java --- a/1920/NET/worlds/console/OpenWhisperDialog.java 1969-12-31 18:00:00.000000000 -0600 +++ b/1920/NET/worlds/console/OpenWhisperDialog.java 2023-08-21 23:27:17.000000000 -0500 @@ -0,0 +1,83 @@ +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by FernFlower decompiler) +// + +package NET.worlds.console; + +import java.awt.Button; +import java.awt.Event; +import java.awt.Font; +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.awt.Label; +import java.awt.Panel; +import java.awt.TextField; +import java.awt.Window; + +public class OpenWhisperDialog extends PolledDialog { + private Button okButton = new Button(Console.message("OK")); + private Button cancelButton = new Button(Console.message("Cancel")); + private static Font font = new Font(Console.message("MenuFont"), 0, 12); + private static Font bfont = new Font(Console.message("ButtonFont"), 0, 12); + private TextField userField = new TextField(""); + + public OpenWhisperDialog(Window var1, DialogReceiver var2, String var3) { + super(var1, var2, var3, true); + this.ready(); + } + + public String getUser() { + return this.userField.getText(); + } + + protected void build() { + this.userField = new TextField("", 40); + this.userField.setFont(font); + GridBagLayout var1 = new GridBagLayout(); + this.setLayout(var1); + GridBagConstraints var2 = new GridBagConstraints(); + var2.fill = 0; + var2.weightx = 1.0D; + var2.weighty = 1.0D; + var2.gridwidth = 2; + var2.gridheight = 1; + this.add(var1, new Label(Console.message("Name")), var2); + var2.gridwidth = 0; + var2.fill = 2; + this.add(var1, this.userField, var2); + Panel var3 = new Panel(); + this.okButton.setFont(font); + this.cancelButton.setFont(font); + var3.add(this.okButton); + var3.add(this.cancelButton); + var2.gridwidth = 0; + var2.fill = 0; + this.add(var1, var3, var2); + } + + public void show() { + super.show(); + this.userField.requestFocus(); + this.userField.selectAll(); + } + + public boolean handleEvent(Event var1) { + return var1.id == 201 ? this.done(false) : super.handleEvent(var1); + } + + public boolean action(Event var1, Object var2) { + Object var3 = var1.target; + if (var3 == this.cancelButton) { + this.done(false); + } else if (var3 == this.okButton) { + this.done(true); + } + + return false; + } + + public boolean keyDown(Event var1, int var2) { + return var2 == 27 ? this.done(false) : super.keyDown(var1, var2); + } +} diff -ruN a/1920/NET/worlds/console/RejectHandler.java b/1920/NET/worlds/console/RejectHandler.java --- a/1920/NET/worlds/console/RejectHandler.java 1969-12-31 18:00:00.000000000 -0600 +++ b/1920/NET/worlds/console/RejectHandler.java 2023-08-21 23:27:17.000000000 -0500 @@ -0,0 +1,37 @@ +package NET.worlds.console; + +import java.util.ArrayList; +import java.util.List; + +public class RejectHandler { + + List whisperRej = null; + List teleportRej = null; + + public RejectHandler () { + if (whisperRej == null) { + whisperRej = new ArrayList(); + whisperRej.add("WORLDSMASTER"); + } + if (teleportRej == null) { + teleportRej = new ArrayList(); + teleportRej.add("WORLDSMASTER"); + } + } + + public boolean rejectTeleport(String var1) { + return teleportRej.contains(var1); + } + + public void addTeleportUser(String var1) { + teleportRej.add(var1); + } + + public boolean rejectWhisper(String var1) { + return whisperRej.contains(var1); + } + + public void addWhisperUser(String var1) { + whisperRej.add(var1); + } +} diff -ruN a/1920/NET/worlds/console/Shaper.java b/1920/NET/worlds/console/Shaper.java --- a/1920/NET/worlds/console/Shaper.java 2024-01-08 01:46:32.000000000 -0600 +++ b/1920/NET/worlds/console/Shaper.java 2023-08-21 23:27:17.000000000 -0500 @@ -1,5 +1,6 @@ package NET.worlds.console; +import NET.worlds.core.IniFile; import NET.worlds.network.URL; import NET.worlds.scape.LoadedURLSelf; import NET.worlds.scape.Manifest; @@ -9,273 +10,340 @@ import NET.worlds.scape.TeleportStatus; import NET.worlds.scape.URLSelf; import NET.worlds.scape.World; +import NET.worldsplus.ChatSaver; + import java.awt.Container; import java.awt.Event; import java.awt.Menu; import java.awt.MenuItem; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.io.FileWriter; import java.io.IOException; import java.util.Enumeration; public class Shaper implements MainCallback, DialogReceiver, LoadedURLSelf { - MenuItem newItem; - MenuItem openItem; - MenuItem saveItem; - MenuItem propItem; - MenuItem consolePropItem; - MenuItem pilotPropItem; - MenuItem undoItem; - MenuItem cutItem; - MenuItem copyItem; - MenuItem pasteItem; - MenuItem sortAttributesItem; - MenuItem snapToolItem; - MenuItem newLibraryItem; - MenuItem newLibraryEntryItem; - MenuItem iconsVisibleLibraryItem; - Menu worldsMenu; - MenuItem shaperVisibleItem; - private World newWorldTemplate; - private boolean makeNew = true; - private static URL newworld = URL.make("home:NewWorld.world"); - private boolean quitFlag; - private FileSaver fileSaver; - private boolean worldListHasChanged = false; - - public Shaper() { - Main.register(this); - } - - public void activate(Console c, Container f, Console prev) { - this.newItem = c.addMenuItem(Console.message("New"), "File", 78, false); - this.openItem = c.addMenuItem(Console.message("Open"), "File", 79, false); - this.saveItem = c.addMenuItem(Console.message("Save"), "File", 83, false); - this.propItem = c.addMenuItem(Console.message("World-Prop"), "File"); - this.consolePropItem = c.addMenuItem(Console.message("Console-Prop"), "File"); - this.pilotPropItem = c.addMenuItem(Console.message("Pilot-Prop"), "File"); - this.undoItem = c.addMenuItem(Console.message("Undo"), "Edit", 90, false); - c.getMenu("Edit").addSeparator(); - this.cutItem = c.addMenuItem(Console.message("Cut"), "Edit", 88, false); - this.copyItem = c.addMenuItem(Console.message("Copy"), "Edit", 67, false); - this.pasteItem = c.addMenuItem(Console.message("Paste"), "Edit", 86, false); - this.sortAttributesItem = c.addMenuItem(Console.message("Sort-Attributes"), "Edit"); - this.snapToolItem = c.addMenuItem(Console.message("Snap-Tool-Settings"), "Edit"); - this.newLibraryItem = c.addMenuItem(Console.message("New-Library"), "Libraries"); - this.newLibraryEntryItem = c.addMenuItem(Console.message("New-Library-Entry"), "Libraries"); - this.iconsVisibleLibraryItem = c.addMenuItem(Console.message("Icons-On-Off"), "Libraries", 73, false); - this.worldsMenu = c.getMenu("Worlds"); - this.worldListChange(); - this.shaperVisibleItem = c.addMenuItem(Console.message("Shaper-On-Off"), "Options"); - } - - public void deactivate() { - this.worldsMenu = null; - } - - public boolean action(Event event, Object what) { - GammaFrame f = Console.getFrame(); - if (event.target == this.newItem) { - this.makeNew = true; - } else if (event.target == this.openItem) { - new FileSysDialog(f, this, Console.message("Open-World"), 0, "World Save Files|*.world|World Class Files|*.class|World Files|*.class;*.world", "", true); - } else if (event.target == this.saveItem) { - new FileSysDialog(f, this, Console.message("Save-World"), 1, "World Save Files|*.world|World Manifest (text) Files|*.mft", this.getSaveName(), true); - } else if (event.target == this.propItem) { - if (Pilot.getActiveRoom() != null) { - f.getEditTile().viewProperties(Pilot.getActiveWorld()); - } - } else if (event.target == this.consolePropItem) { - f.getEditTile().viewProperties(Console.getActive()); - } else if (event.target == this.pilotPropItem) { - f.getEditTile().viewProperties(Pilot.getActive()); - } else if (event.target == this.sortAttributesItem) { - new AttributeSortPanel(f); - } else if (event.target == this.snapToolItem) { - new SnapToolPanel(f); - } else if (event.target == this.undoItem) { - f.getEditTile().undo(); - } else if (event.target == this.cutItem) { - f.getEditTile().cut(); - } else if (event.target == this.copyItem) { - f.getEditTile().copy(); - } else if (event.target == this.pasteItem) { - f.getEditTile().paste(); - } else if (event.target == this.newLibraryItem) { - f.getLibrariesTile().addLibrary(); - } else if (event.target == this.newLibraryEntryItem) { - f.getLibrariesTile().addElement(); - } else if (event.target == this.iconsVisibleLibraryItem) { - f.getLibrariesTile().setIconsVisible(!f.getLibrariesTile().isIconsVisible()); - } else if (event.target == this.shaperVisibleItem) { - f.setShaperVisible(!f.isShaperVisible()); - } else { - int i = this.worldsMenu.getItemCount(); - - do { - --i; - } while(i >= 0 && this.worldsMenu.getItem(i) != event.target); - - if (i < 0) { + MenuItem newItem; + MenuItem openItem; + MenuItem saveItem; + MenuItem propItem; + MenuItem consolePropItem; + MenuItem pilotPropItem; + MenuItem undoItem; + MenuItem cutItem; + MenuItem copyItem; + MenuItem pasteItem; + MenuItem sortAttributesItem; + MenuItem snapToolItem; + MenuItem newLibraryItem; + MenuItem newLibraryEntryItem; + MenuItem iconsVisibleLibraryItem; + Menu worldsMenu; + Menu whisperMenu; + MenuItem openWhisperItem; + MenuItem shaperVisibleItem; + private World newWorldTemplate; + private boolean makeNew = true; + private static URL newworld = URL.make("home:NewWorld.world"); + private boolean quitFlag; + private FileSaver fileSaver; + private boolean worldListHasChanged = false; + private boolean whisperListHasChanged = false; + + public Shaper() { + Main.register(this); + } + + public void activate(Console var1, Container var2, Console var3) { + this.newItem = var1.addMenuItem(Console.message("New"), "File", 78, false); + this.openItem = var1.addMenuItem(Console.message("Open"), "File", 79, false); + this.saveItem = var1.addMenuItem(Console.message("Save"), "File", 83, false); + this.propItem = var1.addMenuItem(Console.message("World-Prop"), "File"); + this.consolePropItem = var1.addMenuItem(Console.message("Console-Prop"), "File"); + this.pilotPropItem = var1.addMenuItem(Console.message("Pilot-Prop"), "File"); + this.undoItem = var1.addMenuItem(Console.message("Undo"), "Edit", 90, false); + var1.getMenu("Edit").addSeparator(); + this.cutItem = var1.addMenuItem(Console.message("Cut"), "Edit", 88, false); + this.copyItem = var1.addMenuItem(Console.message("Copy"), "Edit", 67, false); + this.pasteItem = var1.addMenuItem(Console.message("Paste"), "Edit", 86, false); + this.sortAttributesItem = var1.addMenuItem(Console.message("Sort-Attributes"), "Edit"); + this.snapToolItem = var1.addMenuItem(Console.message("Snap-Tool-Settings"), "Edit"); + this.newLibraryItem = var1.addMenuItem(Console.message("New-Library"), "Libraries"); + this.newLibraryEntryItem = var1.addMenuItem(Console.message("New-Library-Entry"), "Libraries"); + this.iconsVisibleLibraryItem = var1.addMenuItem(Console.message("Icons-On-Off"), "Libraries", 73, false); + this.worldsMenu = var1.getMenu("Worlds"); + this.whisperMenu = var1.getMenu("Whispers"); + this.openWhisperItem = var1.addMenuItem(Console.message("Open Whisper"), "Whispers"); + this.whisperMenu.addSeparator(); + + this.worldListChange(); + this.whisperListChanged(); + + this.shaperVisibleItem = var1.addMenuItem(Console.message("Shaper-On-Off"), "Options"); + } + + public void deactivate() { + this.worldsMenu = null; + this.whisperMenu = null; + } + + public boolean action(Event var1, Object var2) { + GammaFrame var3 = Console.getFrame(); + if (var1.target == this.newItem) { + this.makeNew = true; + } else if (var1.target == this.openItem) { + new FileSysDialog(var3, this, Console.message("Open-World"), 0, "World Save Files|*.world|World Class Files|*.class|World Files|*.class;*.world", "", true); + } else if (var1.target == this.saveItem) { + new FileSysDialog(var3, this, Console.message("Save-World"), 1, "World Save Files|*.world|World Manifest (text) Files|*.mft", this.getSaveName(), true); + } else if (var1.target == this.propItem) { + if (Pilot.getActiveRoom() != null) { + var3.getEditTile().viewProperties(Pilot.getActiveWorld()); + } + } else if (var1.target == this.consolePropItem) { + var3.getEditTile().viewProperties(Console.getActive()); + } else if (var1.target == this.pilotPropItem) { + var3.getEditTile().viewProperties(Pilot.getActive()); + } else if (var1.target == this.sortAttributesItem) { + new AttributeSortPanel(var3); + } else if (var1.target == this.snapToolItem) { + new SnapToolPanel(var3); + } else if (var1.target == this.undoItem) { + var3.getEditTile().undo(); + } else if (var1.target == this.cutItem) { + var3.getEditTile().cut(); + } else if (var1.target == this.copyItem) { + var3.getEditTile().copy(); + } else if (var1.target == this.pasteItem) { + var3.getEditTile().paste(); + } else if (var1.target == this.newLibraryItem) { + var3.getLibrariesTile().addLibrary(); + } else if (var1.target == this.newLibraryEntryItem) { + var3.getLibrariesTile().addElement(); + } else if (var1.target == this.iconsVisibleLibraryItem) { + var3.getLibrariesTile().setIconsVisible(!var3.getLibrariesTile().isIconsVisible()); + } else if (var1.target == this.openWhisperItem) { + new OpenWhisperDialog(var3, this, Console.message("open-whisper")); + } else if (var1.target == this.shaperVisibleItem) { + var3.setShaperVisible(!var3.isShaperVisible()); + } else { return false; - } + } + return true; + } + + public String getSaveName() { + return getSaveName(Pilot.getActive().getWorld()); + } + + public static String getSaveName(World var0) { + URL var1 = var0.getSourceURL(); + String var2 = var1.unalias(); + int var3 = var2.indexOf(58); + return var3 != -1 && var3 != 1 ? var1.getBase() : var2.replace('/', '\\'); + } + + public void dialogDone(Object var1, boolean var2) { + if (var2) { + if (var1 instanceof FileSysDialog) { + FileSysDialog var3 = (FileSysDialog) var1; + String var4 = var3.fileName(); + if (var3.getMode() == 0) { + TeleportAction.teleport(var4, (TeleportStatus) null, true); + } else { + this.doSave(var4); + } + } else if (var1 instanceof OpenWhisperDialog) { + Console.startWhispering(((OpenWhisperDialog)var1).getUser()); + } + } + } + + public void loadedURLSelf(URLSelf var1, URL var2, String var3) { + this.newWorldTemplate = (World)var1; + } + + public void mainCallback() { + if (this.quitFlag) { + if (this.fileSaver == null) { + this.fileSaver = new FileSaver(); + } + + switch(this.fileSaver.getState()) { + case 0: + GammaFrameState.saveBorder(); + Main.end(); + break; + case 2: + this.quitFlag = false; + this.fileSaver = null; + } + } + + if (this.newWorldTemplate != null) { + this.newWorldTemplate.incRef(); + } + + if (this.makeNew) { + this.makeNew = false; + if (this.newWorldTemplate == null) { + World.load(newworld, this, true); + } else { + World var1 = (World)this.newWorldTemplate.clone(); + var1.setEdited(true); + TeleportAction.teleport(var1.getSourceURL().getAbsolute(), (TeleportStatus)null); + } + } + + if (this.worldListHasChanged) { + this.worldListHasChanged = false; + this.rebuildWorldsMenu(); + } + + if (this.whisperListHasChanged) { + this.whisperListHasChanged = false; + this.rebuildWhisperMenu(); + } + } + + public void maybeQuit() { + this.quitFlag = true; + } + + public void worldListChange() { + this.worldListHasChanged = true; + } + + private void rebuildWorldsMenu() { + if (this.worldsMenu != null) { + while(this.worldsMenu.getItemCount() > 0) { + this.worldsMenu.remove(0); + } + + Enumeration var1 = World.getWorlds(); + + while(true) { + World var2; + URL var3; + String var4; + do { + if (!var1.hasMoreElements()) { + return; + } + + var2 = (World)var1.nextElement(); + var3 = var2.getSourceURL(); + if (var3 == null) { + var4 = var2.getName(); + break; + } + + var4 = var3.getAbsolute(); + } while(var3.equals(newworld)); + + if (var2.getEdited()) { + var4 = var4 + " (changed)"; + } + + MenuItem newItem = new MenuItem(var4); + newItem.addActionListener(new ActionListener() { + + public void actionPerformed(ActionEvent actionEvent) { + String var5 = ((MenuItem)actionEvent.getSource()).getLabel(); + if (var5.endsWith(" (changed)")) { + var5 = var5.substring(0, var5.length() - 10); + } + + TeleportAction.teleport(var5, (TeleportStatus) null); + } + }); + + this.worldsMenu.add(newItem); + } + } + } + + public void whisperListChanged() { + this.whisperListHasChanged = true; + } + + private void rebuildWhisperMenu() { + if (this.whisperMenu != null) { + while(this.whisperMenu.getItemCount() - 2 > 0) { + this.whisperMenu.remove(2); + } + + Enumeration var1 = WhisperManager.whisperManager().dialogs().elements(); + + + while(true) { + WhisperDialog var2; + String var4; + + do { + if (!var1.hasMoreElements()) { + return; + } + + var2 = (WhisperDialog) var1.nextElement(); + var4 = var2.partner; + } while (var4 == null); + + MenuItem newItem = new MenuItem(var4); + newItem.addActionListener(new ActionListener() { + + public void actionPerformed(ActionEvent actionEvent) { + Console.startWhispering(((MenuItem)actionEvent.getSource()).getLabel()); + } + }); + + this.whisperMenu.add(newItem); + } + } + } + + public void doSave(String var1) { + doSave(var1, Pilot.getActive().getWorld(), true); + } + + public static boolean doSave(String var0, World var1, boolean var2) { + if (var2 && var0.endsWith(".mft")) { + try { + Manifest var6 = new Manifest(var0); + var6.saveProps(var1); + var6.done(); + return true; + } catch (IOException var4) { + Console.println(Console.message("Error-manifest") + var4.toString()); + } + } else { + if (var0.toLowerCase().endsWith(".wor")) { + var0 = var0.substring(0, var0.length() - 4); + } + + if (!var0.toLowerCase().endsWith(".world")) { + var0 = var0 + ".world"; + } + + try { + Saver var3 = new Saver(new URL(URL.getCurDir(), var0)); + var3.save(var1); + var3.done(); + var1.setEdited(false); + return true; + } catch (IOException var5) { + Console.println(Console.message("Error-saving") + var5.toString()); + } + } - String url = (String)what; - if (url.endsWith(" (changed)")) { - url = url.substring(0, url.length() - 10); - } - - TeleportAction.teleport(url, (TeleportStatus)null); - } - - return true; - } - - public String getSaveName() { - return getSaveName(Pilot.getActive().getWorld()); - } - - public static String getSaveName(World w) { - URL url = w.getSourceURL(); - String name = url.unalias(); - int index = name.indexOf(58); - return index != -1 && index != 1 ? url.getBase() : name.replace('/', '\\'); - } - - public void dialogDone(Object who, boolean confirmed) { - if (confirmed) { - FileSysDialog fileDialog = (FileSysDialog)who; - String name = fileDialog.fileName(); - if (fileDialog.getMode() == 0) { - TeleportAction.teleport(name, (TeleportStatus)null, true); - } else { - this.doSave(name); - } - } - - } - - public void loadedURLSelf(URLSelf o, URL url, String err) { - this.newWorldTemplate = (World)o; - } - - public void mainCallback() { - if (this.quitFlag) { - if (this.fileSaver == null) { - this.fileSaver = new FileSaver(); - } - - switch (this.fileSaver.getState()) { - case 0: - GammaFrameState.saveBorder(); - Main.end(); - case 1: - default: - break; - case 2: - this.quitFlag = false; - this.fileSaver = null; - } - } - - if (this.newWorldTemplate != null) { - this.newWorldTemplate.incRef(); - } - - if (this.makeNew) { - this.makeNew = false; - if (this.newWorldTemplate == null) { - World.load(newworld, this, true); - } else { - World w = (World)this.newWorldTemplate.clone(); - w.setEdited(true); - TeleportAction.teleport(w.getSourceURL().getAbsolute(), (TeleportStatus)null); - } - } - - if (this.worldListHasChanged) { - this.worldListHasChanged = false; - this.rebuildWorldsMenu(); - } - - } - - public void maybeQuit() { - this.quitFlag = true; - } - - public void worldListChange() { - this.worldListHasChanged = true; - } - - private void rebuildWorldsMenu() { - if (this.worldsMenu != null) { - while(this.worldsMenu.getItemCount() > 0) { - this.worldsMenu.remove(0); - } - - Enumeration e = World.getWorlds(); - - while(true) { - World w; - URL url; - String name; - do { - if (!e.hasMoreElements()) { - return; - } - - w = (World)e.nextElement(); - url = w.getSourceURL(); - if (url == null) { - name = w.getName(); - break; - } - - name = url.getAbsolute(); - } while(url.equals(newworld)); - - if (w.getEdited()) { - name = name + " (changed)"; - } - - this.worldsMenu.add(new MenuItem(name)); - } - } - } - - public void doSave(String name) { - doSave(name, Pilot.getActive().getWorld(), true); - } - - public static boolean doSave(String name, World world, boolean allowManifest) { - if (allowManifest && name.endsWith(".mft")) { - try { - Manifest mft = new Manifest(name); - mft.saveProps(world); - mft.done(); - return true; - } catch (IOException var4) { - Console.println(Console.message("Error-manifest") + var4.toString()); - } - } else { - if (name.toLowerCase().endsWith(".wor")) { - name = name.substring(0, name.length() - 4); - } - - if (!name.toLowerCase().endsWith(".world")) { - name = name + ".world"; - } - - try { - Saver saver = new Saver(new URL(URL.getCurDir(), name)); - saver.save(world); - saver.done(); - world.setEdited(false); - return true; - } catch (IOException var5) { - Console.println(Console.message("Error-saving") + var5.toString()); - } - } + return false; + } - return false; - } + private boolean containsItem(Menu menu, MenuItem item) { + for (int e = 0; e < menu.getItemCount(); e++) { + MenuItem curItem = menu.getItem(e); + System.out.println(curItem + " / " + item); + if (curItem == item) return true; + } + return false; + } } diff -ruN a/1920/NET/worlds/console/StyledTextCanvas.java b/1920/NET/worlds/console/StyledTextCanvas.java --- a/1920/NET/worlds/console/StyledTextCanvas.java 2024-01-08 01:46:30.000000000 -0600 +++ b/1920/NET/worlds/console/StyledTextCanvas.java 2023-08-21 23:27:17.000000000 -0500 @@ -12,196 +12,196 @@ import java.awt.event.MouseEvent; class StyledTextCanvas extends Canvas { - private static final long serialVersionUID = -2680423246934436331L; - private MouseEvent delayedMouseEvent = null; - protected int mouseX = -1; - protected int mouseY = -1; - protected int startX = -1; - protected int startY = -1; - protected int endX = -1; - protected int endY = -1; - protected long mouseWhen = 0L; - protected boolean mouseActive = false; - protected boolean mouseDoubleClick = false; - protected static long doubleClickSpeed = (long)IniFile.override().getIniInt("DoubleClickSpeed", 300); - - public StyledTextCanvas() { - this.enableEvents(61L); - this.setEnabled(true); - } - - public void sendDelayedMouseEvent(MouseEvent e) { - synchronized(this.getParent()) { - this.delayedMouseEvent = e; - } - } - - public void setBounds(int x, int y, int w, int h) { - if (this.getParent() != null && w >= 0 && h >= 0) { - synchronized(this.getParent()) { - if (this.getParent() instanceof GammaTextArea) { - GammaTextArea gta = (GammaTextArea)this.getParent(); - gta.setWidth(w); - gta.setHeight(h); - gta.rewrap(); - } + private static final long serialVersionUID = -2680423246934436331L; + private MouseEvent delayedMouseEvent = null; + protected int mouseX = -1; + protected int mouseY = -1; + protected int startX = -1; + protected int startY = -1; + protected int endX = -1; + protected int endY = -1; + protected long mouseWhen = 0L; + protected boolean mouseActive = false; + protected boolean mouseDoubleClick = false; + protected static long doubleClickSpeed = (long)IniFile.override().getIniInt("DoubleClickSpeed", 300); + + public StyledTextCanvas() { + this.enableEvents(61L); + this.setEnabled(true); + } + + public void sendDelayedMouseEvent(MouseEvent e) { + synchronized(this.getParent()) { + this.delayedMouseEvent = e; + } + } + + public void setBounds(int x, int y, int w, int h) { + if (this.getParent() != null && w >= 0 && h >= 0) { + synchronized(this.getParent()) { + if (this.getParent() instanceof GammaTextArea) { + GammaTextArea gta = (GammaTextArea)this.getParent(); + gta.setWidth(w); + gta.setHeight(h); + gta.rewrap(); + } + + super.setBounds(x, y, w, h); + } + } + + } + + protected void processMouseMotionEvent(MouseEvent e) { + if (e.getID() == 506 && this.mouseActive) { + this.processMouseEvent(e); + } + + super.processMouseMotionEvent(e); + } + + protected void processMouseEvent(MouseEvent e) { + synchronized(this.getParent()) { + if (e.getID() == 500) { + if (this.mouseWhen > 0L && e.getWhen() - this.mouseWhen <= doubleClickSpeed) { + this.mouseDoubleClick = true; + this.mouseWhen = 0L; + this.mouseX = this.startX = this.endX = e.getX(); + this.mouseY = this.startY = this.endY = e.getY(); + ((GammaTextArea)this.getParent()).selectionConversion = true; + this.getParent().repaint(); + } else { + this.mouseDoubleClick = false; + this.mouseWhen = e.getWhen(); + if (e.getButton() == 1 && !this.mouseActive && (e.getModifiers() & 1) == 0) { + ((GammaTextArea)this.getParent()).selectionStart = -1; + ((GammaTextArea)this.getParent()).selectionEnd = -1; + } + } + + this.getParent().requestFocus(); + } else if (e.getID() == 501) { + if (e.getButton() == 1) { + if ((e.getModifiers() & 1) == 0) { + if (((GammaTextArea)this.getParent()).selectionStart >= 0 && ((GammaTextArea)this.getParent()).selectionEnd > ((GammaTextArea)this.getParent()).selectionStart) { + ((GammaTextArea)this.getParent()).selectionStart = -1; + ((GammaTextArea)this.getParent()).selectionEnd = -1; + } else { + this.mouseX = this.startX = this.endX = e.getX(); + this.mouseY = this.startY = this.endY = e.getY(); + this.mouseActive = true; + ((GammaTextArea)this.getParent()).selectionConversion = true; + } + } else { + this.mouseX = this.startX = this.endX = e.getX(); + this.mouseY = this.startY = this.endY = e.getY(); + this.mouseActive = true; + ((GammaTextArea)this.getParent()).selectionConversion = true; + } + + this.getParent().repaint(); + } + + this.getParent().requestFocus(); + } else if (!this.mouseActive || e.getID() != 506 && e.getID() != 507 && e.getID() != 507) { + if (e.getID() == 502) { + if (e.getButton() == 1 && this.mouseActive) { + this.mouseX = this.endX = e.getX(); + this.mouseY = this.endY = e.getY(); + this.mouseActive = false; + ((GammaTextArea)this.getParent()).selectionConversion = false; + this.getParent().repaint(); + } - super.setBounds(x, y, w, h); - } - } - - } - - protected void processMouseMotionEvent(MouseEvent e) { - if (e.getID() == 506 && this.mouseActive) { - this.processMouseEvent(e); - } - - super.processMouseMotionEvent(e); - } - - protected void processMouseEvent(MouseEvent e) { - synchronized(this.getParent()) { - if (e.getID() == 500) { - if (this.mouseWhen > 0L && e.getWhen() - this.mouseWhen <= doubleClickSpeed) { - this.mouseDoubleClick = true; - this.mouseWhen = 0L; - this.mouseX = this.startX = this.endX = e.getX(); - this.mouseY = this.startY = this.endY = e.getY(); - ((GammaTextArea)this.getParent()).selectionConversion = true; - this.getParent().repaint(); + this.getParent().requestFocus(); + } } else { - this.mouseDoubleClick = false; - this.mouseWhen = e.getWhen(); - if (e.getButton() == 1 && !this.mouseActive && (e.getModifiers() & 1) == 0) { - ((GammaTextArea)this.getParent()).selectionStart = -1; - ((GammaTextArea)this.getParent()).selectionEnd = -1; - } - } - - this.getParent().requestFocus(); - } else if (e.getID() == 501) { - if (e.getButton() == 1) { - if ((e.getModifiers() & 1) == 0) { - if (((GammaTextArea)this.getParent()).selectionStart >= 0 && ((GammaTextArea)this.getParent()).selectionEnd > ((GammaTextArea)this.getParent()).selectionStart) { - ((GammaTextArea)this.getParent()).selectionStart = -1; - ((GammaTextArea)this.getParent()).selectionEnd = -1; - } else { - this.mouseX = this.startX = this.endX = e.getX(); - this.mouseY = this.startY = this.endY = e.getY(); - this.mouseActive = true; - ((GammaTextArea)this.getParent()).selectionConversion = true; - } - } else { - this.mouseX = this.startX = this.endX = e.getX(); - this.mouseY = this.startY = this.endY = e.getY(); - this.mouseActive = true; - ((GammaTextArea)this.getParent()).selectionConversion = true; - } - - this.getParent().repaint(); - } - - this.getParent().requestFocus(); - } else if (!this.mouseActive || e.getID() != 506 && e.getID() != 507 && e.getID() != 507) { - if (e.getID() == 502) { - if (e.getButton() == 1 && this.mouseActive) { - this.mouseX = this.endX = e.getX(); - this.mouseY = this.endY = e.getY(); - this.mouseActive = false; - ((GammaTextArea)this.getParent()).selectionConversion = false; - this.getParent().repaint(); - } - - this.getParent().requestFocus(); - } - } else { - if ((e.getModifiers() & 16) != 0) { - this.mouseX = this.endX = e.getX(); - this.mouseY = this.endY = e.getY(); - ((GammaTextArea)this.getParent()).selectionConversion = true; - this.getParent().repaint(); - } - - this.getParent().requestFocus(); - } - - ((GammaTextArea)this.getParent()).processMouseEvent(e); - super.processMouseEvent(e); - } - } - - public void update(Graphics g) { - this.paint(g); - } - - protected void processKeyEvent(KeyEvent e) { - synchronized(this.getParent()) { - if (e.getID() == 401) { - Scrollbar s = null; - if (this.getParent() instanceof GammaTextArea) { - GammaTextArea gta = (GammaTextArea)this.getParent(); - s = gta.getVertScrollbar(); - } - - if (e.getKeyCode() == 33) { - if (s != null && s.isEnabled()) { - s.dispatchEvent(e); - } - } else if (e.getKeyCode() == 34 && s != null && s.isEnabled()) { - s.dispatchEvent(e); - } - } - - super.processKeyEvent(e); - } - } - - public void paint(Graphics g) { - synchronized(this.getParent()) { - if (this.getParent().isEnabled()) { - GammaTextArea gta = (GammaTextArea)this.getParent(); - Rectangle r = this.getBounds(); - if (r.width <= 0 || r.height <= 0) { - return; - } - - Image offImage = this.createImage(r.width, r.height); - Graphics offGraphic = offImage.getGraphics(); - offGraphic.setColor(GammaTextArea.getBackgroundColor()); - offGraphic.fillRect(r.x, r.y, r.width, r.height); - offGraphic.setColor(Color.black); - if (gta.getHasFocus()) { - offGraphic.setColor(Color.blue); - offGraphic.drawRect(r.x, r.y, r.width - 1, r.height - 1); - offGraphic.drawRect(r.x + 1, r.y + 1, r.width - 2, r.height - 2); - offGraphic.setColor(Color.black); - } - - offGraphic.setFont(gta.getFont()); - FontMetrics fm = offGraphic.getFontMetrics(gta.getFont()); - gta._curpos = 0; - int i; - if (gta.getNumLines() <= gta.getCanvasLines()) { - for(i = 0; i < gta.getNumLines(); ++i) { - gta.drawLine(offGraphic, i, (i + 1) * fm.getHeight() - fm.getDescent()); - } - } else { - i = gta.getScrollLine(); - - for(int j = 1; i < gta.getNumLines(); ++j) { - gta.drawLine(offGraphic, i, j * fm.getHeight() - fm.getDescent()); - ++i; - } - } - - g.drawImage(offImage, 0, 0, this); - if (this.delayedMouseEvent != null) { - this.processMouseEvent(this.delayedMouseEvent); - this.delayedMouseEvent = null; + if ((e.getModifiers() & 16) != 0) { + this.mouseX = this.endX = e.getX(); + this.mouseY = this.endY = e.getY(); + ((GammaTextArea)this.getParent()).selectionConversion = true; + this.getParent().repaint(); + } + + this.getParent().requestFocus(); + } + + ((GammaTextArea)this.getParent()).processMouseEvent(e); + super.processMouseEvent(e); + } + } + + public void update(Graphics g) { + this.paint(g); + } + + protected void processKeyEvent(KeyEvent e) { + synchronized(this.getParent()) { + if (e.getID() == 401) { + Scrollbar s = null; + if (this.getParent() instanceof GammaTextArea) { + GammaTextArea gta = (GammaTextArea)this.getParent(); + s = gta.getVertScrollbar(); + } + + if (e.getKeyCode() == 33) { + if (s != null && s.isEnabled()) { + s.dispatchEvent(e); + } + } else if (e.getKeyCode() == 34 && s != null && s.isEnabled()) { + s.dispatchEvent(e); + } + } + + super.processKeyEvent(e); + } + } + + public void paint(Graphics g) { + synchronized(this.getParent()) { + if (this.getParent().isEnabled()) { + GammaTextArea gta = (GammaTextArea)this.getParent(); + Rectangle r = this.getBounds(); + if (r.width <= 0 || r.height <= 0) { + return; + } + + Image offImage = this.createImage(r.width, r.height); + Graphics offGraphic = offImage.getGraphics(); + offGraphic.setColor(GammaTextArea.getBackgroundColor()); + offGraphic.fillRect(r.x, r.y, r.width, r.height); + offGraphic.setColor(Color.black); + if (gta.getHasFocus()) { + offGraphic.setColor(Color.blue); + offGraphic.drawRect(r.x, r.y, r.width - 1, r.height - 1); + offGraphic.drawRect(r.x + 1, r.y + 1, r.width - 2, r.height - 2); + offGraphic.setColor(Color.black); + } + + offGraphic.setFont(gta.getFont()); + FontMetrics fm = offGraphic.getFontMetrics(gta.getFont()); + gta._curpos = 0; + int i; + if (gta.getNumLines() <= gta.getCanvasLines()) { + for(i = 0; i < gta.getNumLines(); ++i) { + gta.drawLine(offGraphic, i, (i + 1) * fm.getHeight() - fm.getDescent()); + } + } else { + i = gta.getScrollLine(); + + for(int j = 1; i < gta.getNumLines(); ++j) { + gta.drawLine(offGraphic, i, j * fm.getHeight() - fm.getDescent()); + ++i; + } + } + + g.drawImage(offImage, 0, 0, this); + if (this.delayedMouseEvent != null) { + this.processMouseEvent(this.delayedMouseEvent); + this.delayedMouseEvent = null; + } } - } - } - } + } + } } diff -ruN a/1920/NET/worlds/console/TarListPart.java b/1920/NET/worlds/console/TarListPart.java --- a/1920/NET/worlds/console/TarListPart.java 1969-12-31 18:00:00.000000000 -0600 +++ b/1920/NET/worlds/console/TarListPart.java 2023-08-21 23:27:17.000000000 -0500 @@ -0,0 +1,204 @@ +package NET.worlds.console; + +import NET.worlds.core.IniFile; +import NET.worlds.network.Galaxy; +import NET.worlds.network.NetworkObject; +import NET.worlds.network.ObjID; +import NET.worlds.network.WorldServer; +import NET.worlds.scape.Drone; +import NET.worlds.scape.FrameEvent; + +import java.awt.Window; +import java.awt.*; +import java.util.Enumeration; +import java.util.StringTokenizer; +import java.util.Vector; + +public class TarListPart implements FramePart, NameListOwner{ + private Galaxy galaxy; + private IniFile serverSection; + private final String name = Console.message("edit-tar-list"); + private static TarListPart active; + private DefaultConsole console; + private MenuItem editItem; + private Vector syncTars = new Vector(); + public Vector tars; + private Object tarMutex = new Object(); + private Vector updates = new Vector(); + + public void activate(Console console, Container container, Console console1) { + active = this; + this.console = (DefaultConsole)console; + this.editItem = console.addMenuItem(name, "Options"); + this.editItem.setEnabled(this.tars != null); + } + + public void deactivate() { + active = null; + this.editItem = null; + } + + public boolean action(Event event, Object o) { + if (event.target == this.editItem) { + new EditNamesDialog(this, name, Console.message("add-to-tar")); + return true; + } else { + return false; + } + } + + public boolean handle(FrameEvent frameEvent) { + synchronized(this.tarMutex) { + int var3 = this.updates.size(); + if (var3 != 0) { + WorldServer var4 = this.console.getServerNew(); + if (var4 != null) { + for(int var5 = 0; var5 < var3; ++var5) { + String var6 = (String)this.updates.elementAt(var5); + boolean var7 = this.tars.contains(var6); + NetworkObject var8 = var4.getObject(new ObjID(var6)); + if (var8 instanceof Drone) { + Drone var9 = (Drone)var8; + var9.avtStateChanged(); + } + + this.console.getFriends().changeMuteState(var6, var7); + } + + this.updates.removeAllElements(); + this.syncTars = (Vector)this.tars.clone(); + } + } + + return true; + } + } + + public int getNameListCount() { + return this.tars.size(); + } + + public String getNameListName(int i) { + return (String)this.tars.elementAt(i); + } + + public void removeNameListName(int i) { + synchronized(this.tarMutex) { + String var3 = (String)this.tars.elementAt(i); + this.tars.removeElementAt(i); + this.saveTars(); + if (!this.updates.contains(var3)) { + this.updates.addElement(var3); + } + } + } + + public boolean mayAddNameListName(Window window) { + return true; + } + + public int addNameListName(String s) { + synchronized(this.tarMutex) { + int var3 = TarListPart.iindexOf(this.tars, s); + if (var3 != -1) { + return var3; + } else { + this.tars.addElement(s); + this.saveTars(); + if (!this.updates.contains(s)) { + this.updates.addElement(s); + } + + return this.tars.size() - 1; + } + } + } + + private void loadTars() { + this.tars = new Vector(); + + for(int var1 = 0; var1 < 50; ++var1) { + String var2 = this.serverSection.getIniString("Tar" + var1, ""); + if (var2.length() == 0) { + break; + } + + if (FriendsListPart.isValidUserName(var2) && !FriendsListPart.icontains(this.tars, var2)) { + this.tars.addElement(var2); + } + } + + if (this.tars.size() == 0) { + String var4 = this.serverSection.getIniString("Tars", ""); + StringTokenizer var5 = new StringTokenizer(var4, ";"); + + while(var5.hasMoreTokens() && this.tars.size() < 50) { + String var3 = var5.nextToken(); + if (FriendsListPart.isValidUserName(var3) && !FriendsListPart.icontains(this.tars, var3)) { + this.tars.addElement(var3); + } + } + + if (this.tars.size() != 0) { + this.saveTars(); + this.serverSection.setIniString("Tars", ""); + } + } + + } + + void saveTars() { + String var1 = ""; + int var2 = this.tars.size(); + + for(int var3 = 0; var3 < var2; ++var3) { + this.serverSection.setIniString("Tar" + var3, (String)this.tars.elementAt(var3)); + } + + this.serverSection.setIniString("Tar" + var2, ""); + } + + public void setServer(WorldServer var1, IniFile var2) { + this.serverSection = var2; + this.galaxy = var1.getGalaxy(); + this.loadTars(); + if (this.editItem != null) { + this.editItem.setEnabled(true); + } + } + + public static boolean isTarred(WorldServer ws, String s) { + if (ws != null && s != null) { + Galaxy var2 = ws.getGalaxy(); + Enumeration var3 = var2.getConsoles(); + + while(var3.hasMoreElements()) { + Object var4 = var3.nextElement(); + if (var4 instanceof DefaultConsole) { + TarListPart var5 = ((DefaultConsole)var4).getTars(); + if (var5.tars != null) { + return TarListPart.icontains(var5.tars, s); + } + } + } + } + return false; + } + + public static int iindexOf(Vector var0, String var1) { + int var2 = var0.size(); + + for(int var3 = 0; var3 < var2; ++var3) { + String var4 = (String)var0.elementAt(var3); + if(var4.equalsIgnoreCase(var1)) { + return var3; + } + } + + return -1; + } + + public static boolean icontains(Vector var0, String var1) { + return iindexOf(var0, var1) != -1; + } +} diff -ruN a/1920/NET/worlds/console/WhisperManager.java b/1920/NET/worlds/console/WhisperManager.java --- a/1920/NET/worlds/console/WhisperManager.java 2024-01-08 01:46:28.000000000 -0600 +++ b/1920/NET/worlds/console/WhisperManager.java 2023-08-21 23:27:17.000000000 -0500 @@ -1,7 +1,11 @@ package NET.worlds.console; -import NET.worlds.network.NetUpdate; import NET.worlds.scape.InventoryManager; +import NET.worlds.scape.Pilot; +import NET.worldsplus.ChatSaver; + +import java.awt.Window; +import java.io.IOException; import java.util.Enumeration; import java.util.Hashtable; @@ -9,139 +13,163 @@ private static WhisperManager manager_; private Hashtable dialogs_ = new Hashtable(); private Hashtable tradeDialogs_ = new Hashtable(); - private java.awt.Window parent; + private Window parent; private String inventory = ""; final String tradeServerName = "TRADE"; - static GiftDialog outstandingGift; - private WhisperManager() { + + private WhisperManager() + { + this.dialogs_ = new Hashtable(); + this.tradeDialogs_ = new Hashtable(); } - public static WhisperManager whisperManager() { + public static WhisperManager whisperManager() + { if (manager_ == null) { manager_ = new WhisperManager(); } - return manager_; } - void setParent(java.awt.Window p) { + void setParent(Window p) + { this.parent = p; } - public Hashtable dialogs() { + public Hashtable dialogs() + { return this.dialogs_; } - public Hashtable tradeDialogs() { + public Hashtable tradeDialogs() + { return this.tradeDialogs_; } - private WhisperDialog findWhisperDialog(String to) { - return !this.dialogs_.containsKey(to) ? null : (WhisperDialog)this.dialogs_.get(to); + private WhisperDialog findWhisperDialog(String to) + { + if (!this.dialogs_.containsKey(to)) { + return null; + } + return (WhisperDialog)this.dialogs_.get(to); } - private TradeDialog findTradeDialog(String to) { - return !this.tradeDialogs_.containsKey(to) ? null : (TradeDialog)this.tradeDialogs_.get(to); + private TradeDialog findTradeDialog(String to) + { + if (!this.tradeDialogs_.containsKey(to)) { + return null; + } + return (TradeDialog)this.tradeDialogs_.get(to); } - private WhisperDialog start(String to, boolean takeFocus) { - WhisperDialog wd = this.findWhisperDialog(to); + private WhisperDialog start(String to, boolean takeFocus) + { + WhisperDialog wd = findWhisperDialog(to); if (wd == null) { this.dialogs_.put(to, wd = new WhisperDialog(this.parent, to)); } - if (takeFocus) { wd.takeFocus(); } - wd.ready(); + if (Gamma.shaperEnabled()) Gamma.shaper.whisperListChanged(); return wd; } - public void remove(String name) { + public void remove(String name) + { this.dialogs_.remove(name); } - public void startTo(String to) { - this.start(to, true); + public void startTo(String to) + { + WhisperDialog wd = start(to, true); } public TradeDialog startToTrade(String to) { - TradeDialog wd = this.findTradeDialog(to); + TradeDialog wd = findTradeDialog(to); if (wd == null) { this.tradeDialogs_.put(to, wd = new TradeDialog(this.parent, to)); } - wd.takeFocus(); wd.ready(); wd.setTrading(true); wd.whisperPart.println(Console.message("trade-start")); + return wd; } public void printFrom(String from, String msg) { - if (msg.startsWith("&|+")) { - if (msg.startsWith("&|+gift>") && from.equalsIgnoreCase("TRADE")) { - maybeQueryGift(msg.substring(8)); - } else if (msg.startsWith("&|+inv>") && from.equalsIgnoreCase("TRADE")) { - this.tradeMsg(msg.substring(7)); - } else if (msg.startsWith("&|+trade>")) { - TradeDialog it = this.findTradeDialog(from); - if (msg.equals("&|+trade>cancel") && (it == null || !it.isActive() || !it.isTrading)) { - return; - } - - it = this.startToTrade(from); - it.print(msg); + try { + ChatSaver.chatSaver.saveWhisper(from, Pilot.getActive().getName(), msg); + } catch (IOException e) { + e.printStackTrace(); + } + if (!msg.startsWith("&|+")) + { + WhisperDialog it = findWhisperDialog(from); + if ((msg.equals("&|+trade>cancel")) && ( + (it == null) || (!it.isActive()) || (!it.isTrading))) { + return; } - } else { - WhisperDialog it = this.findWhisperDialog(from); - if (msg.equals("&|+trade>cancel") && (it == null || !it.isActive() || !it.isTrading)) { + it = start(from, false); + it.print(msg); + } + else if ((msg.startsWith("&|+gift>")) && + (from.equalsIgnoreCase("TRADE"))) + { + maybeQueryGift(msg.substring(8)); + } + else if ((msg.startsWith("&|+inv>")) && + (from.equalsIgnoreCase("TRADE"))) + { + tradeMsg(msg.substring(7)); + } + else if (msg.startsWith("&|+trade>")) + { + TradeDialog it = findTradeDialog(from); + if ((msg.equals("&|+trade>cancel")) && ( + (it == null) || (!it.isActive()) || (!it.isTrading))) { return; } - - it = this.start(from, false); + it = startToTrade(from); it.print(msg); } - } - public void tradeMsg(String newInv) { - if (!newInv.equals(this.inventory)) { - Enumeration e = this.tradeDialogs_.elements(); - - while(e.hasMoreElements()) { - TradeDialog wd = (TradeDialog)e.nextElement(); - wd.doneDeal(); + public void tradeMsg(String var1) { + if (!var1.equals(this.inventory)) { + Enumeration var2 = this.tradeDialogs_.elements(); + + while(var2.hasMoreElements()) { + TradeDialog var3 = (TradeDialog)var2.nextElement(); + var3.doneDeal(); } - InventoryManager.getInventoryManager().setInventory(newInv); + InventoryManager.getInventoryManager().setInventory(var1); } } - public void printTo(String to, String msg) { - if (!to.equals("world") && !to.equals("TRADE")) { - if (!msg.startsWith("&|+") || msg.startsWith("&|+trade>")) { - WhisperDialog it = this.start(to, false); - it.send(msg); + public void printTo(String var1, String var2) { + try { + ChatSaver.chatSaver.saveWhisper(Console.getActive().getLongID(), var1, var2); + } catch (IOException e) { + e.printStackTrace(); + } + if (!var1.equals("world") && !var1.equals("TRADE")) { + if (!var2.startsWith("&|+") || var2.startsWith("&|+trade>")) { + WhisperDialog var3 = this.start(var1, false); + var3.send(var2); } - } } - public void giftDialogDone() { - outstandingGift = null; - } - public static void maybeQueryGift(String inv) { - if (NetUpdate.isInternalVersion()) { - Console c = Console.getActive(); - if (c != null && outstandingGift == null && !c.isSleeping()) { - outstandingGift = new GiftDialog(inv, 3000000); - } - + Console c = Console.getActive(); + if ((c != null)) { + TradeDialog.sendTradeMessage("&|+deal>TRADE ," + inv); } } } diff -ruN a/1920/NET/worlds/core/IniFile.java b/1920/NET/worlds/core/IniFile.java --- a/1920/NET/worlds/core/IniFile.java 2024-01-08 01:46:26.000000000 -0600 +++ b/1920/NET/worlds/core/IniFile.java 2023-08-21 23:27:17.000000000 -0500 @@ -7,27 +7,47 @@ private static IniFile gamma_ = null; private static IniFile override_ = null; - public IniFile(String section) { + public IniFile(String var1) { this.file = null; - this.section = section; + this.section = var1; } - public IniFile(String inifileName, String section) { - this.file = inifileName; - this.section = section; + private IniFile(String var1, String var2) { + this.file = var1; + this.section = var2; } - public static IniFile gamma() { - if (gamma_ == null) { - gamma_ = new IniFile("Gamma"); + public static IniFile ini(String name) { + return ini(gamma_, name); + } + + public static IniFile ini(IniFile ini, String name) { + if (!initialized) { + nativeInit(); + initialized = true; + } + + if (ini == null) { + ini = new IniFile(name); } + return ini; + } + + public static IniFile modModules() { return ini("Modules"); } + + public static IniFile modPlus() { return ini("WorldsPlus"); } + public static IniFile modColorfulTags() { return ini("ColorfulTags"); } + + public static IniFile modFriendly() { return ini("Friendly"); } + + public static IniFile gamma() { if (!initialized) { nativeInit(); initialized = true; } - return gamma_; + return ini(gamma_, "Gamma"); } public static IniFile override() { diff -ruN a/1920/NET/worlds/network/textCmd.java b/1920/NET/worlds/network/textCmd.java --- a/1920/NET/worlds/network/textCmd.java 2024-01-08 01:46:34.000000000 -0600 +++ b/1920/NET/worlds/network/textCmd.java 2023-08-21 23:27:17.000000000 -0500 @@ -1,14 +1,12 @@ package NET.worlds.network; -import NET.worlds.console.BBChatCommand; -import NET.worlds.console.BlackBox; -import NET.worlds.console.Console; -import NET.worlds.console.GammaTextArea; -import NET.worlds.console.MuteListPart; +import NET.worlds.console.*; import NET.worlds.core.IniFile; import NET.worlds.scape.Drone; import NET.worlds.scape.Pilot; import NET.worlds.scape.PosableDrone; +import NET.worldsplus.ChatSaver; + import java.io.IOException; public class textCmd extends receivedNetPacket { @@ -20,112 +18,114 @@ this._commandType = 14; } - public textCmd(String text) { + public textCmd(String var1) { super((ObjID)null, 14); this._senderID = new ObjID(""); - this._text = text; + this._text = var1; } - void parseNetData(ServerInputStream data) throws IOException { + void parseNetData(ServerInputStream var1) throws IOException { this._senderID = new ObjID(); - this._senderID.parseNetData(data); - this._text = data.readUTF(); + this._senderID.parseNetData(var1); + this._text = var1.readUTF(); } int packetSize() { return ServerOutputStream.utfLength(this._text) + 1 + this._senderID.packetSize() + super.packetSize(); } - void send(ServerOutputStream o) throws IOException { - super.send(o); - this._senderID.send(o); - o.writeUTF(this._text); + void send(ServerOutputStream var1) throws IOException { + super.send(var1); + this._senderID.send(var1); + var1.writeUTF(this._text); } - void process(WorldServer _serv) throws Exception { - String name; + void process(WorldServer var1) throws Exception { + String var2; if (this._senderID.longID() == null) { - name = "[Unknown Name (#" + String.valueOf(this._senderID.shortID()) + ")]"; + var2 = "[Unknown Name (#" + String.valueOf(this._senderID.shortID()) + ")]"; } else { - name = this._senderID.longID(); - if (MuteListPart.isMuted(_serv, name)) { + var2 = this._senderID.longID(); + if (MuteListPart.isMuted(var1, var2)) { return; } } - handleActionText(_serv, this._text, name, this._senderID); - if (!this._text.startsWith("&|+")) { - this.displayText(name, this._text); + ChatSaver.chatSaver.saveChat(this._senderID.longID(), this._text); + + handleActionText(var1, this._text, var2, this._senderID); + if (!this._text.startsWith("&|+") || (IniFile.modModules().getIniInt("DisableAction2", 1) == 1 && this._text.startsWith("&|+action2>"))) { + this.displayText(var2, this._text); } } - protected void displayText(String name, String text) { - String filteredName = FilthFilter.get().filterName(name); - String line = ""; + protected void displayText(String var1, String var2) { + String var3 = FilthFilter.get().filterName(var1); + String var4 = ""; if (IniFile.gamma().getIniInt("classicChatBox", 1) == 1) { - line = filteredName + "> "; - line = line + FilthFilter.get().filter(text); - BlackBox.getInstance().submitEvent(new BBChatCommand(line)); - Console.println(line); + var4 = var3 + "> "; + var4 = var4 + FilthFilter.get().filter(var2); + BlackBox.getInstance().submitEvent(new BBChatCommand(var4)); + Console.println(var4); } else { - boolean colored = false; - if (Drone.isEmployeeAccount(name)) { - line = GammaTextArea.colorStartBlueTag + " "; - colored = true; - } else if (name.toLowerCase().startsWith(Console.message("host"))) { - line = GammaTextArea.colorStartRedTag + " "; - colored = true; - } else if (name.toLowerCase().startsWith(Console.message("guest-"))) { - line = GammaTextArea.colorStartMagentaTag + " "; - colored = true; - } - - line = line + " " + filteredName + "> "; - if (colored) { - line = line + " " + GammaTextArea.colorEndTag + " "; - } - - line = line + FilthFilter.get().filter(text); - BlackBox.getInstance().submitEvent(new BBChatCommand(line)); - Console.println(line); + boolean var5 = false; + if (Drone.isEmployeeAccount(var1)) { + var4 = GammaTextArea.colorStartBlueTag + " "; + var5 = true; + } else if (var1.toLowerCase().startsWith(Console.message("host"))) { + var4 = GammaTextArea.colorStartRedTag + " "; + var5 = true; + } else if (var1.toLowerCase().startsWith(Console.message("guest-"))) { + var4 = GammaTextArea.colorStartMagentaTag + " "; + var5 = true; + } + + var4 = var4 + " " + var3 + "> "; + if (var5) { + var4 = var4 + " " + GammaTextArea.colorEndTag + " "; + } + + var4 = var4 + FilthFilter.get().filter(var2); + BlackBox.getInstance().submitEvent(new BBChatCommand(var4)); + Console.println(var4); } } - public static void handleActionText(WorldServer _serv, String msg, String name, ObjID senderID) { - String senderAction; - if (msg.startsWith("&|+action>")) { - NetworkObject o = _serv.getObject(senderID); - if (o == null) { + public static void handleActionText(WorldServer var0, String var1, String var2, ObjID var3) { + String var5; + if (var1.startsWith("&|+action>")) { + NetworkObject var4 = var0.getObject(var3); + if (var4 == null) { return; } - senderAction = msg.substring(10); - if (!(o instanceof PosableDrone)) { + var5 = var1.substring(10); + if (!(var4 instanceof PosableDrone)) { return; } - ((PosableDrone)o).animate(senderAction); + ((PosableDrone)var4).animate(var5); } - if (msg.startsWith("&|+action2>")) { - int idx = msg.indexOf("|sender|"); - senderAction = null; - String receiverAction = null; - if (idx != -1) { - senderAction = msg.substring(idx); - receiverAction = msg.substring(11, idx); - NetworkObject o = _serv.getObject(senderID); - if (o != null && o instanceof PosableDrone) { - ((PosableDrone)o).animate(senderAction); - Pilot.sendText("&|+action>" + senderAction); + if (var1.startsWith("&|+action2>") && IniFile.modModules().getIniInt("DisableAction2", 1) == 0) { + int var9 = var1.indexOf("|sender|"); + var5 = null; + String var6 = null; + if (var9 != -1) { + var5 = var1.substring(var9); + var6 = var1.substring(11, var9); + NetworkObject var7 = var0.getObject(var3); + if (var7 != null && var7 instanceof PosableDrone) { + ((PosableDrone)var7).animate(var5); + Pilot.sendText("&|+action>" + var5); } } else { - receiverAction = msg.substring(11); + var6 = var1.substring(11); } try { - Console.getActive().getPilot().animate(receiverAction); + Console.getActive().getPilot().animate(var6); } catch (Exception var8) { System.out.println("Error animating pilot " + var8.toString()); } @@ -133,7 +133,7 @@ } - public String toString(WorldServer serv) { - return "TEXT " + this._senderID.toString(serv) + ": " + this._text; + public String toString(WorldServer var1) { + return "TEXT " + this._senderID.toString(var1) + ": " + this._text; } } 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 @@ -3,63 +3,85 @@ import NET.worlds.console.Console; import NET.worlds.console.FriendsListPart; import NET.worlds.console.MuteListPart; +import NET.worlds.core.IniFile; import NET.worlds.scape.WorldScriptManager; +import NET.worlds.console.RejectHandler; +import NET.worldsplus.ChatSaver; + +import java.io.IOException; 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 whisperRejMSG = Console.message("not-whispers"); + private static String teleportRejMSG = Console.message("not-teleport"); + private static String reject = Console.message("rejected"); + RejectHandler rej = MuteListPart.rej; + + public whisperCmd() { + this._commandType = 17; + } + + public whisperCmd(String var1, String var2) { + super(var2); + WorldScriptManager.getInstance().onConversation(var1, var2); + this._commandType = 17; + this._objID = new ObjID(var1); + } + + void process(WorldServer var1) { + String var2; + Object[] var3; + if (this._senderID.longID() == null) { + var3 = new Object[]{new String(String.valueOf(this._senderID.shortID()))}; + var2 = MessageFormat.format(Console.message("Unknown-Name"), var3); + } else { + var2 = this._senderID.longID(); + if (MuteListPart.isMuted(var1, var2)) { + try { + var1.sendNetworkMsg(new NET.worlds.network.whisperCmd(var2, 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(var1, var2)) { + try { + if (!this._text.equals(whisperRejMSG)) { + var3 = new Object[]{"whisper", var2}; + if (IniFile.modFriendly().getIniInt("WhisperFeedback", 1) == 1) Console.println(MessageFormat.format(Console.message("rejected"), var3)); + if (!rej.rejectWhisper(var2)) { + if (IniFile.modFriendly().getIniInt("WhisperResponse", 1) == 1) var1.sendNetworkMsg(new NET.worlds.network.whisperCmd(var2, whisperRejMSG)); + rej.addWhisperUser(var2); + } + } + } catch (InfiniteWaitException var6) { } catch (PacketTooLargeException var7) { } + 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("&|+where") && MuteListPart.isRejectingTele(var1, var2)) { + try { + if (!this._text.equals(teleportRejMSG)) { + var3 = new Object[]{"teleport", var2}; + if (IniFile.modFriendly().getIniInt("TeleportFeedback", 1) == 1) Console.println(MessageFormat.format(Console.message("rejected"), var3)); + if (!rej.rejectTeleport(var2)) { + if (IniFile.modFriendly().getIniInt("TeleportResponse", 0) == 1) var1.sendNetworkMsg(new NET.worlds.network.whisperCmd(var2, teleportRejMSG)); + rej.addTeleportUser(var2); + } + } + } 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(var1, var2, this._text); + handleActionText(var1, this._text, var2, this._senderID); + Console.printWhisper(var2, FilthFilter.get().filter(this._text)); + } + + public String toString(WorldServer var1) { + return Console.message("WHISPER") + " " + this._senderID.toString(var1) + " --> " + this._objID.toString(var1) + ": " + this._text; + } } diff -ruN a/1920/NET/worlds/scape/Drone.java b/1920/NET/worlds/scape/Drone.java --- a/1920/NET/worlds/scape/Drone.java 2024-01-08 01:46:34.000000000 -0600 +++ b/1920/NET/worlds/scape/Drone.java 2023-08-21 23:27:17.000000000 -0500 @@ -1,877 +1,971 @@ package NET.worlds.scape; -import NET.worlds.console.BBAppearDroneCommand; -import NET.worlds.console.BBDisappearDroneCommand; -import NET.worlds.console.BBDroneBitmapCommand; -import NET.worlds.console.BBDroneDeltaPosCommand; -import NET.worlds.console.BBMoveDroneCommand; -import NET.worlds.console.BlackBox; -import NET.worlds.console.Console; -import NET.worlds.console.FriendsListPart; -import NET.worlds.console.Main; -import NET.worlds.console.MainCallback; -import NET.worlds.console.MuteListPart; +import NET.worlds.console.*; +import NET.worlds.core.Debug; import NET.worlds.core.IniFile; import NET.worlds.core.ServerTableManager; import NET.worlds.core.Std; -import NET.worlds.network.FilthFilter; -import NET.worlds.network.Galaxy; -import NET.worlds.network.InfiniteWaitException; -import NET.worlds.network.NetworkObject; -import NET.worlds.network.ObjID; -import NET.worlds.network.OldPropertyList; -import NET.worlds.network.PacketTooLargeException; -import NET.worlds.network.PropertyList; -import NET.worlds.network.URL; -import NET.worlds.network.WorldServer; -import NET.worlds.network.net2Property; -import NET.worlds.network.netProperty; -import NET.worlds.network.propReqCmd; -import java.awt.Color; +import NET.worlds.network.*; + +import java.awt.*; import java.io.IOException; import java.net.MalformedURLException; import java.util.Enumeration; import java.util.Hashtable; +import java.util.Random; import java.util.Vector; public abstract class Drone extends WObject implements NetworkObject, WobLoaded, MouseDownHandler, FrameHandler { - private int _last_FrameTime; - private int _last_PosTime; - private int _vel_x; - private int _vel_y; - private int _vel_z; - private int _vel_yaw; - private int _last_x; - private int _last_y; - private int _last_z; - private int _last_yaw; - private int _x; - private int _y; - private int _z; - private int _yaw; - private boolean inited = false; - protected WObject tag; - protected WObject tagbg; - private Console console; - private float tagHeight; - private Shape sleepBox; - static boolean showNametags; - private static String[] employeeAccounts; - private static Hashtable employeeHash; - public static Vector usableDrones; - private int lastUsed; - protected WorldServer _server; - private String sleepMode; - private static Object classCookie; - private static Object classCookieInterpolatedDrone; - - static { - Main.register(new Flusher()); - showNametags = IniFile.gamma().getIniInt("SHOWNAMETAGS", 1) == 1; - employeeAccounts = ServerTableManager.instance().getTable("employeeAccounts"); - employeeHash = null; - usableDrones = new Vector(); - classCookie = new Object(); - classCookieInterpolatedDrone = new Object(); - } - - public Drone(ObjID id, WorldServer serv) { - if (serv != null) { - assert id != null; - - this.attachToServer(serv.getLongID(id), serv); - } - - } - - protected Drone(String longID, WorldServer serv) { - assert longID != null; - - if (serv != null) { - this.attachToServer(longID, serv); - } - - } - - private void attachToServer(String longID, WorldServer serv) { - if (serv != null) { - assert Main.isMainThread(); - - String nameWas = null; - if (this.tag != null) { - nameWas = this.getLongID(); - } - - this.getSharer().createDynamicFromNet(); - this.setName(longID); - String nameIs = this.getLongID(); - this._server = serv; - this._server.incRefCnt(this); - this._server.regObject((String)nameIs, this); - - try { - this._server.sendNetworkMsg(new propReqCmd(new ObjID(this.getLongID()))); - } catch (InfiniteWaitException var6) { - } catch (PacketTooLargeException var7) { - assert false; - } - - if (nameIs.equals(nameWas)) { - this.avatarHeightChangedTo(189.0F); - } else { - this.makeTag(false); - } - - Main.register(new MakeSleepBox()); - } - } - - private static void flushUnusedDrones() { - synchronized(usableDrones) { - int now = Std.getFastTime(); - int i = usableDrones.size(); - - while(true) { - --i; - if (i < 0) { - return; - } - - Drone d = (Drone)usableDrones.elementAt(i); - if (now > d.lastUsed + 2000) { - usableDrones.removeElementAt(i); - d.discard(); - } - } - } - } - - public static boolean isEmployeeAccount(String name) { - if (employeeHash == null) { - employeeHash = new Hashtable(); - - for(int i = 0; i < employeeAccounts.length; ++i) { - employeeHash.put(employeeAccounts[i], employeeAccounts[i]); - } - } - - return employeeHash.get(name) != null; - } - - public void makeTag(boolean force) { - this.tagHeight = 195.0F; - if (this.tag != null) { - this.tagHeight = this.tag.getPosition().z; - this.tag.detach(); - this.tag = null; - } - - if (this.tagbg != null) { - this.tagbg.detach(); - this.tagbg = null; - } - - if ((this._server != null || force) && !(this instanceof MutedDrone) && showNametags) { - String unfilteredName = this.getLongID(); - String name = FilthFilter.get().filterName(unfilteredName); - if (name != null && !name.equals("")) { - Texture[] tagText = new Texture[1]; - boolean hw = RenderWare.get3DHardwareInUse(); - boolean isHost = name.toLowerCase().startsWith(Console.message("host")) || name.toLowerCase().startsWith("host"); - if (isHost) { - name = Console.message("host-upper") + name.substring(4); - } - - boolean isSpecialGuest = name.toLowerCase().startsWith(Console.message("guest-")) || name.toLowerCase().startsWith("guest-"); - if (isSpecialGuest) { - name = Console.message("guest-upper") + name.substring(5); - } - - boolean isEmployee = isEmployeeAccount(name); - Color bgColor; - if (isSpecialGuest) { - bgColor = Color.pink; - } else if (isHost) { - bgColor = Color.yellow; - } else if (isEmployee) { - bgColor = Color.cyan; - } else { - bgColor = Color.lightGray; + private int _last_FrameTime; + private int _last_PosTime; + private int _vel_x; + private int _vel_y; + private int _vel_z; + private int _vel_yaw; + private int _last_x; + private int _last_y; + private int _last_z; + private int _last_yaw; + private int _x; + private int _y; + private int _z; + private int _yaw; + private boolean inited = false; + protected WObject tag; + protected WObject tagbg; + private Console console; + private float tagHeight; + private Shape sleepBox; + static boolean showNametags; + private static String[] employeeAccounts; + private static Hashtable employeeHash; + public static Vector usableDrones; + private int lastUsed; + protected WorldServer _server; + private String sleepMode; + private static Object classCookie; + private static Object classCookieInterpolatedDrone; + + public Drone(ObjID var1, WorldServer var2) { + if (var2 != null) { + assert(var1 != null); + this.attachToServer(var2.getLongID(var1), var2); + } + + } + + protected Drone(String var1, WorldServer var2) { + assert(var1 != null); + if (var2 != null) { + this.attachToServer(var1, var2); + } + + } + + private void attachToServer(String var1, WorldServer var2) { + if (var2 != null) { + assert(Main.isMainThread()); + String var3 = null; + if (this.tag != null) { + var3 = this.getLongID(); + } + + this.getSharer().createDynamicFromNet(); + this.setName(var1); + String var4 = this.getLongID(); + this._server = var2; + this._server.incRefCnt(this); + this._server.regObject(var4, this); + + try { + this._server.sendNetworkMsg(new propReqCmd(new ObjID(this.getLongID()))); + } catch (InfiniteWaitException var6) { + } catch (PacketTooLargeException var7) { + assert(false); } - tagText[0] = new StringTexture(name, Console.message("TagFont"), 48, Color.black, hw ? new Color(254, 254, 254) : bgColor); - int height = 14; - int width = name.length() * 10; - Hologram h = new Hologram((float)width, (float)height, tagText); - h.setViewplaneAligned(true); - h.raise(this.tagHeight); - h.setScaleDist(300.0F); - this.tag = h; - this.tag.setVisible(true); - this.tag.setBumpable(false); - this.tag.setLocalShadowed(false); - this.tag.setShadowedLocally(true); - this.add(this.tag); - if (hw) { - Texture[] bgText = new Texture[]{new StringTexture(name, Console.message("TagFont"), 48, Color.black, bgColor)}; - Hologram h2 = new Hologram((float)width, (float)height, bgText); - h2.setViewplaneAligned(true); - h2.raise(this.tagHeight); - h2.setScaleDist(300.0F); - h2.setMaterial(new Material(0.75F, 0.0F, 0.0F, Color.white, (Texture)null, 0.5F, false, false)); - this.tagbg = h2; - this.tagbg.setVisible(true); - this.tagbg.setBumpable(false); - this.tagbg.setLocalShadowed(false); - this.tagbg.setShadowedLocally(true); - this.add(this.tagbg); - } - - } - } - } - - protected void avatarHeightChangedTo(float h) { - if (this.tag != null) { - this.tag.raise(h + 1.0F + 5.0F - this.tag.getPosition().z); - } - - if (this.tagbg != null) { - this.tagbg.raise(h + 1.0F + 5.0F - this.tagbg.getPosition().z); - } - - } - - public void detachFromServer(boolean reuse) { - assert Main.isMainThread(); - - if (this._server != null) { - this._server.delObject(new ObjID(this.getLongID())); - this._server.decRefCnt(this); - this._server = null; - } - - if (reuse) { - this.lastUsed = Std.getFastTime(); - synchronized(usableDrones) { - usableDrones.addElement(this); - } - } - - } - - public static Drone make(ObjID id, WorldServer serv) { - synchronized(usableDrones) { - if (!usableDrones.isEmpty() && id != null && serv != null) { - String name = "!" + serv.getLongID(id); - - int i; - Drone d; - for(i = usableDrones.size() - 1; i > 0; --i) { - d = (Drone)usableDrones.elementAt(i); - if (d.getName().equals(name)) { - break; - } - } - - d = (Drone)usableDrones.elementAt(i); - if (!d.getName().equals(name) && usableDrones.size() < 5) { - return new HoloDrone(id, serv); + if (var4.equals(var3)) { + this.avatarHeightChangedTo(189.0F); } else { - usableDrones.removeElementAt(i); - d.attachToServer(serv.getLongID(id), serv); - return d; - } - } else { - return new HoloDrone(id, serv); - } - } - } - - public Drone() { - } - - public boolean handle(MouseDownEvent event) { - if (this._server != null && (event.key & 1) == 1) { - FriendsListPart.droneClick(this, event); - } - - return true; - } - - public float animate(String action) { - if (action.equalsIgnoreCase("_hdb")) { - new BounceNametag(); - } - - return 0.0F; - } - - public Vector getAnimationList() { - return new Vector(); - } - - public void muteStateChanged() { - this.setAvatarNow(this.getCurrentURL()); - } - - public boolean shouldBeMuted() { - return MuteListPart.isMuted(this._server, this.getLongID()); - } - - private World getOwnerWorld() { - WObject o = (WObject)this.getOwner(); - Room room = o == null ? null : o.getRoom(); - World w = room == null ? null : room.getWorld(); - return w; - } - - public boolean shouldBeForcedHuman() { - World w = this.getOwnerWorld(); - return w != null && w.getForceHuman(); - } - - public URL getCurrentURL() { - return this instanceof PosableDrone ? ((PosableDrone)this).getPosableShapeURL() : this.getSourceURL(); - } - - public Drone setAvatarNow(URL url) { - if (url == null) { - return this; - } else { - if (this.shouldBeForcedHuman()) { - url = PosableShape.getHuman(url); - if (Console.getActive() != null) { - Console.getActive().pendingPilot = url.toString(); - } - } - - url = PosableShape.getPermitted(url, this.getWorld()); - boolean muted = this.shouldBeMuted(); - if (url.equals(this.getCurrentURL()) && muted == (this instanceof MutedDrone)) { - return this; - } else if (!url.endsWith(".rwx") && !url.endsWith(".rwg") && !url.endsWith(".mov")) { - String s = url.getInternal(); - if (s.endsWith(".pilot")) { - s = s.substring(0, s.length() - 6) + ".drone"; - } else if (!s.endsWith(".drone")) { - s = s + ".drone"; + this.makeTag(false); } - url = URL.make(s); - if (url.equals(this.getSourceURL())) { - return this; + Main.register(new Drone$MakeSleepBox(this)); + } + } + + private static void flushUnusedDrones() { + synchronized(usableDrones) { + int var1 = Std.getFastTime(); + int var2 = usableDrones.size(); + + while(true) { + --var2; + if (var2 < 0) { + return; + } + + Drone var3 = (Drone)usableDrones.elementAt(var2); + if (var1 > var3.lastUsed + 2000) { + usableDrones.removeElementAt(var2); + var3.discard(); + } + } + } + } + + public static boolean isEmployeeAccount(String var0) { + if (employeeHash == null) { + employeeHash = new Hashtable(); + + for(int var1 = 0; var1 < employeeAccounts.length; ++var1) { + employeeHash.put(employeeAccounts[var1], employeeAccounts[var1]); + } + } + + return employeeHash.get(var0) != null; + } + + public void makeTag(boolean var1) { + this.tagHeight = 195.0F; + if (this.tag != null) { + this.tagHeight = this.tag.getZ(); + this.tag.detach(); + this.tag = null; + } + + if (this.tagbg != null) { + this.tagbg.detach(); + this.tagbg = null; + } + + if ((this._server != null || var1) && !(this instanceof MutedDrone) && showNametags) { + String var2 = this.getLongID(); + String var3 = FilthFilter.get().filterName(var2); + if (var3 != null && !var3.equals("")) { + Texture[] var4 = new Texture[1]; + boolean isHost = var3.toLowerCase().startsWith(Console.message("host")) || var3.toLowerCase().startsWith("host"); + if (isHost) { + var3 = Console.message("host-upper") + var3.substring(4); + } + + boolean isGuest = var3.toLowerCase().startsWith(Console.message("guest-")) || var3.toLowerCase().startsWith("guest-"); + if (isGuest) { + var3 = Console.message("guest-upper") + var3.substring(5); + } + + boolean colorfulMod = IniFile.modModules().getIniInt("ColorfulTags", 0) == 1; + boolean randomizeTag = false, underline = false; + boolean transparent = IniFile.modColorfulTags().getIniInt("Transparent", 0) == 1; + boolean isTar = TarListPart.isTarred(_server, var3); + Color userTextColor, employeeTextColor, hostTextColor, guestTextColor, tarTextColor; + Color userTagColor, employeeTagColor, hostTagColor, guestTagColor, tarTagColor; + try { + if (colorfulMod) { + randomizeTag = IniFile.modColorfulTags().getIniInt("RandomizeColors", 0) == 1; + underline = IniFile.modColorfulTags().getIniInt("UnderlineStaff", 1) == 1; + + /* + * Color Parsing + * + * This is setup like this so we don't have 3 values for each tag type. Keeps the INI clean. + * If the value isn't valid, given we are parsing a string into 3 ints, we should just use the default. + */ + + userTagColor = parseColor(IniFile.modColorfulTags().getIniString("UserTagColor", "192,192,192")); + userTextColor = parseColor(IniFile.modColorfulTags().getIniString("UserTextColor", "0,0,0")); + + employeeTagColor = parseColor(IniFile.modColorfulTags().getIniString("EmployeeTagColor", "0,255,255")); + employeeTextColor = parseColor(IniFile.modColorfulTags().getIniString("EmployeeTextColor", "0,0,0")); + + hostTagColor = parseColor(IniFile.modColorfulTags().getIniString("HostTagColor", "255,255,0")); + hostTextColor = parseColor(IniFile.modColorfulTags().getIniString("HostTextColor", "0,0,0")); + + guestTagColor = parseColor(IniFile.modColorfulTags().getIniString("GuestTagColor", "255,192,203")); + guestTextColor = parseColor(IniFile.modColorfulTags().getIniString("GuestTextColor", "0,0,0")); + + tarTagColor = parseColor(IniFile.modColorfulTags().getIniString("TarTagColor", "192,192,192")); + tarTextColor = parseColor(IniFile.modColorfulTags().getIniString("TarTextColor", "0,0,0")); + } else { + throw new Exception(); + } + } catch (Exception e1) { + userTagColor = new Color(192,192,192); + userTextColor = new Color(0,0,0); + employeeTagColor = new Color(0,255,255); + employeeTextColor = new Color(0,0,0); + hostTagColor = new Color(255,255,0); + hostTextColor = new Color(0,0,0); + guestTagColor = new Color(255,192,203); + guestTextColor = new Color(0,0,0); + tarTagColor = new Color(192, 192, 192); + tarTextColor = new Color(0,0,0); + } + boolean isEmployee = isEmployeeAccount(var3); + Color curTextColor, curTagColor; + if (isGuest) { + curTagColor = guestTagColor; + curTextColor = guestTextColor; + } else if (isHost) { + curTagColor = hostTagColor; + curTextColor = hostTextColor; + } else if (isEmployee) { + curTagColor = employeeTagColor; + curTextColor = employeeTextColor; + } else if (isTar) { + curTagColor = tarTagColor; + curTextColor = tarTextColor; + } else { + curTagColor = userTagColor; + curTextColor = userTextColor; + } + + if (randomizeTag && (!isEmployee && !isGuest && !isHost && !isTar)) { + Random rand = new Random(); + Color randomized = new Color( + rand.nextInt((255) + 1), + rand.nextInt((255) + 1), + rand.nextInt((255) + 1)).brighter(); + curTextColor = transparent ? randomized : userTextColor; + curTagColor = transparent ? userTagColor : randomized; + } + + if (transparent) { + if (isEmployee || isGuest || isHost || isTar) curTextColor = curTagColor; + curTagColor = new Color(254,254,254); + } + + boolean isSpecial = (isHost || isGuest || isEmployee); + + var4[0] = new StringTexture(var3, Console.message("TagFont"), IniFile.modColorfulTags().getIniInt("Fontsize", 48), curTextColor, curTagColor); + byte var5 = 18; + int var11 = var3.length() * 12; + Hologram var12 = new Hologram((float)var11, (float)var5, var4); + var12.setViewplaneAligned(true); + var12.raise(this.tagHeight); + var12.setScaleDist(300.0F); + this.tag = var12; + this.tag.setVisible(true); + this.tag.setBumpable(false); + this.tag.setLocalShadowed(true); + this.tag.setShadowedLocally(true); + this.add(this.tag); + if (colorfulMod && isSpecial && underline && transparent) { + StringBuffer underscore = new StringBuffer(); + for (int i = 0; i < var3.length(); i++) { + underscore.append("_"); + } + Texture[] var13 = new Texture[]{new StringTexture(underscore.toString(), Console.message("TagFont"), 48, curTextColor, curTagColor)}; + Hologram var14 = new Hologram((float) var11, (float) var5, var13); + var14.setViewplaneAligned(true); + var14.raise(this.tagHeight); + var14.setScaleDist(300.0F); + this.tagbg = var14; + this.tagbg.setVisible(true); + this.tagbg.setBumpable(false); + this.tagbg.setLocalShadowed(false); + this.tagbg.setShadowedLocally(true); + this.add(this.tagbg); + } + } + } + } + + private Color parseColor(String tag) { + String[] spl = tag.split(","); + return new Color(Integer.parseInt(spl[0]), Integer.parseInt(spl[1]), Integer.parseInt(spl[2])); + } + + protected void avatarHeightChangedTo(float var1) { + if (this.tag != null) { + this.tag.raise(var1 + 1.0F + 5.0F - this.tag.getZ()); + } + + if (this.tagbg != null) { + this.tagbg.raise(var1 + 1.0F + 5.0F - this.tagbg.getZ()); + } + + } + + public void detachFromServer(boolean var1) { + assert(Main.isMainThread()); + if (this._server != null) { + this._server.delObject(new ObjID(this.getLongID())); + this._server.decRefCnt(this); + this._server = null; + } + + if (var1) { + this.lastUsed = Std.getFastTime(); + synchronized(usableDrones) { + usableDrones.addElement(this); + } + } + + } + + public static Drone make(ObjID var0, WorldServer var1) { + synchronized(usableDrones) { + if (!usableDrones.isEmpty() && var0 != null && var1 != null) { + String var3 = "!" + var1.getLongID(var0); + + int var4; + Drone var5; + for(var4 = usableDrones.size() - 1; var4 > 0; --var4) { + var5 = (Drone)usableDrones.elementAt(var4); + if (var5.getName().equals(var3)) { + break; + } + } + + var5 = (Drone)usableDrones.elementAt(var4); + if (!var5.getName().equals(var3) && usableDrones.size() < 5) { + return new HoloDrone(var0, var1); + } else { + usableDrones.removeElementAt(var4); + var5.attachToServer(var1.getLongID(var0), var1); + return var5; + } } else { - new WobLoader(url, this); - return this; + return new HoloDrone(var0, var1); } - } else { - WObject o = (WObject)this.getOwner(); - if (o == null) { - return this; + } + } + + public Drone() { + } + + public boolean handle(MouseDownEvent var1) { + if (this._server != null && (var1.key & 1) == 1) { + FriendsListPart.droneClick(this, var1); + } + + return true; + } + + public float animate(String var1) { + if (var1.equalsIgnoreCase("_hdb")) { + new Drone$BounceNametag(this); + } + + return 0.0F; + } + + public Vector getAnimationList() { + return new Vector(); + } + + public void muteStateChanged() { + this.setAvatarNow(this.getCurrentURL()); + } + + public void tarStateChanged() { + this.setAvatarNow(this.getCurrentURL()); + } + + public void avtStateChanged() { + this.setAvatarNow(URL.make("avatar:holden.mov")); + } + + public boolean shouldBeMuted() { + return MuteListPart.isMuted(this._server, this.getLongID()); + } + + public boolean shouldBeTarred() { + return TarListPart.isTarred(this._server, this.getLongID()); + } + + private World getOwnerWorld() { + WObject var1 = (WObject)this.getOwner(); + Room var2 = var1 == null ? null : var1.getRoom(); + World var3 = var2 == null ? null : var2.getWorld(); + return var3; + } + + public boolean shouldBeForcedHuman() { + return (this.getOwnerWorld() != null && this.getOwnerWorld().getForceHuman()); + } + + public URL getCurrentURL() { + return this instanceof PosableDrone ? ((PosableDrone)this).getPosableShapeURL() : this.getSourceURL(); + } + + public Drone setAvatarNow(URL var1) { + if (var1 == null) { + return this; + } else { + if (this.shouldBeForcedHuman()) { + var1 = PosableShape.getHuman(var1); + if (Console.getActive() != null) { + Console.getActive().pendingPilot = var1.toString(); + } + } + + var1 = PosableShape.getPermitted(var1, this.getWorld()); + boolean var2 = this.shouldBeMuted(); + boolean var12 = this.shouldBeTarred(); + if (var1.equals(this.getCurrentURL()) && (var2 == (this instanceof MutedDrone))) { + return this; + } else if (!var1.endsWith(".rwx") && !var1.endsWith(".rwg") && !var1.endsWith(".mov")) { + String var7 = var1.getInternal(); + if (var7.endsWith(".pilot")) { + var7 = var7.substring(0, var7.length() - 6) + ".drone"; + } else if (!var7.endsWith(".drone")) { + var7 = var7 + ".drone"; + } + + var1 = URL.make(var7); + if (var1.equals(this.getSourceURL())) { + return this; + } else { + new WobLoader(var1, this); + return this; + } } else { - WorldServer serv = this._server; - String longID = this.getLongID(); - this.detachFromServer(false); - this.detach(); - Object d; - if (muted) { - d = new MutedDrone(new ObjID(longID), serv, url); - } else if (url.endsWith(".mov")) { - d = new HoloDrone(new ObjID(longID), serv); - ((Drone)d).setAvatarNow(url); - } else { - d = new PosableDrone(new ObjID(longID), serv, url); - } - - if (serv != null) { - ((Drone)d).transferFrom(this); - ((Drone)d).addTo(o.getRoom()); - } else { - ((Drone)d).makeIdentity().post(this); - ((Drone)d).setName(this.getLongID()); - o.add((WObject)d); - } - - return (Drone)d; - } - } - } - } - - public void wobLoaded(WobLoader loader, SuperRoot w) { - if (w instanceof Drone) { - assert w != null; - - Drone d = (Drone)w; - d.setName(this.getLongID()); - if (this._server == null) { - WObject o = (WObject)this.getOwner(); - this.detach(); - d.makeIdentity().post(this); - o.add(d); - } else { - WorldServer serv = this._server; - String longID = this.getLongID(); - this.detachFromServer(false); - Room r = this.getRoom(); - this.detach(); - d.addTo(r); - d.attachToServer(longID, serv); - d.transferFrom(this); - } - } - } - - public void addTo(Room r) { - if (r != null) { - Console c = r.getWorld().getConsole(); - if (this.console == null) { - this.console = c; - if (c != null) { - Pilot.copySoul(c.getDroneSoulTemplate(), this); - } - } - - r.add(this); - } - } - - public void add(WObject w) { - super.add(w); - } - - protected void noteUnadding(SuperRoot child) { - if (child instanceof WObject) { - WObject w = (WObject)child; - if (w.isDynamic()) { - w.setVisible(true); - } - } - - super.noteUnadding(child); - } - - public void setSleepMode(String mode) { - if (!mode.equals(this.sleepMode)) { - this.sleepMode = mode; - Main.register(new MakeSleepBox()); - } - } - - private void handleVAR_ASLEEP(String s) { - if (s != null && s.length() > 2 && s.charAt(0) == 0) { - s = s.substring(2); - } - - this.setSleepMode(s); - } - - public Drone handleVAR_BITMAP(String s) { - if (s.equals("")) { - return this; - } else { - BlackBox.getInstance().submitEvent(new BBDroneBitmapCommand(this.getName(), s)); - if (s.charAt(0) == 0) { - s = s.substring(2); - } - - try { - return this.setAvatarNow(new URL(URL.getAvatar(), s)); - } catch (MalformedURLException var3) { - Console.println(Console.message("Invalid-av") + s); + WObject var3 = (WObject)this.getOwner(); + if (var3 == null) { + return this; + } else { + WorldServer var4 = this._server; + String var5 = this.getLongID(); + this.detachFromServer(false); + this.detach(); + Drone var6; + if (var2) { + var6 = new MutedDrone(new ObjID(var5), var4, var1); + } else if (var12) { + var6 = new TarredDrone(new ObjID(var5), var4, var1); + } else if (var1.endsWith(".mov")) { + var6 = new HoloDrone(new ObjID(var5), var4); + var6.setAvatarNow(var1); + } else { + var6 = new PosableDrone(new ObjID(var5), var4, var1); + } + + if (var4 != null) { + var6.transferFrom(this); + var6.addTo(var3.getRoom()); + } else { + var6.makeIdentity().post(this); + var6.setName(this.getLongID()); + var3.add(var6); + } + + return var6; + } + } + } + } + + public void wobLoaded(WobLoader var1, SuperRoot var2) { + if (var2 instanceof Drone) { + assert(var2 != null); + Drone var3 = (Drone)var2; + var3.setName(this.getLongID()); + if (this._server == null) { + WObject var7 = (WObject)this.getOwner(); + this.detach(); + var3.makeIdentity().post(this); + var7.add(var3); + } else { + WorldServer var4 = this._server; + String var5 = this.getLongID(); + this.detachFromServer(false); + Room var6 = this.getRoom(); + this.detach(); + var3.addTo(var6); + var3.attachToServer(var5, var4); + var3.transferFrom(this); + } + } + } + + public void addTo(Room var1) { + if (var1 != null) { + Console var2 = var1.getWorld().getConsole(); + if (this.console == null) { + this.console = var2; + if (var2 != null) { + Pilot.copySoul(var2.getDroneSoulTemplate(), this); + } + } + + var1.add(this); + } + } + + public void add(WObject var1) { + super.add(var1); + } + + protected void noteUnadding(SuperRoot var1) { + if (var1 instanceof WObject) { + WObject var2 = (WObject)var1; + if (var2.isDynamic()) { + var2.setVisible(true); + } + } + + super.noteUnadding(var1); + } + + public void setSleepMode(String var1) { + if (!var1.equals(this.sleepMode)) { + this.sleepMode = var1; + Main.register(new Drone$MakeSleepBox(this)); + } + } + + private void handleVAR_ASLEEP(String var1) { + if (var1 != null && var1.length() > 2 && var1.charAt(0) == 0) { + var1 = var1.substring(2); + } + + this.setSleepMode(var1); + } + + public Drone handleVAR_BITMAP(String var1) { + if (var1.equals("")) { return this; - } - } - } - - public Point3Temp getVelocity() { - return Point3Temp.make((float)this._vel_x, (float)this._vel_y, (float)this._vel_z); - } - - public int getYawRate() { - return this._vel_yaw; - } - - public boolean handle(FrameEvent fe) { - if (this._server == null) { - return true; - } else { - int timeNow = fe.time; - this.interpolate(timeNow, this._server.getUpdateTime(), this); - return true; - } - } - - public void interpolate(int timeNow, int updateTime, Transform target) { - if (this.inited) { - if (timeNow - this._last_PosTime > updateTime) { - this._last_PosTime = timeNow; - this._vel_x = this._last_x - this._x; - this._vel_y = this._last_y - this._y; - this._vel_z = this._last_z - this._z; - this._vel_yaw = ((this._last_yaw - this._yaw) % 360 + 360) % 360; - - assert this._vel_yaw >= 0; - - if (this._vel_yaw > 180) { - this._vel_yaw -= 360; - } - } - - double timeDiff = (double)(timeNow - this._last_FrameTime) / (double)updateTime; - if (timeNow - this._last_FrameTime > updateTime) { - timeDiff = 0.0; - } - - this._x += (int)(timeDiff * (double)this._vel_x); - this._y += (int)(timeDiff * (double)this._vel_y); - this._z += (int)(timeDiff * (double)this._vel_z); - this._yaw += (int)(timeDiff * (double)this._vel_yaw) % 360; - target.makeIdentity().moveBy((float)this._x, (float)this._y, (float)this._z).yaw((float)this._yaw); - this._last_FrameTime = timeNow; - } - } - - public void reset(short x, short y, short z, short yaw) { - this._x = x; - this._y = y; - this._z = z; - this._yaw = yaw; - this._vel_x = this._vel_y = this._vel_z = 0; - this._vel_yaw = 0; - this._last_x = this._x; - this._last_y = this._y; - this._last_z = this._z; - this._last_yaw = this._yaw; - this._last_PosTime = this._last_FrameTime = Std.getRealTime(); - this.inited = true; - } - - protected void transferFrom(Drone i) { - this.makeIdentity().post(i); - this._x = i._x; - this._y = i._y; - this._z = i._z; - this._yaw = i._yaw; - this._vel_x = i._vel_x; - this._vel_y = i._vel_y; - this._vel_z = i._vel_z; - this._vel_yaw = i._vel_yaw; - this._last_x = i._last_x; - this._last_y = i._last_y; - this._last_z = i._last_z; - this._last_yaw = i._last_yaw; - this._last_PosTime = i._last_PosTime; - this._last_FrameTime = i._last_FrameTime; - this.inited = true; - } - - public void appear(Room rm, short x, short y, short z, short yaw) { - assert rm != null; - - BlackBox.getInstance().submitEvent(new BBAppearDroneCommand(rm.toString(), this.getName(), x, y, z, yaw)); - if (this.getRoom() != rm) { - this.detach(); - rm.add(this); - } - - this.makeIdentity().moveBy((float)x, (float)y, (float)z).yaw((float)yaw); - this._x = x; - this._y = y; - this._z = z; - this._yaw = yaw; - this._vel_x = this._vel_y = this._vel_z = 0; - this._vel_yaw = 0; - this._last_x = x; - this._last_y = y; - this._last_z = z; - this._last_yaw = yaw; - this._last_PosTime = this._last_FrameTime = Std.getRealTime(); - URL u = this.getCurrentURL(); - if (u != null) { - this.setAvatarNow(u); - } - - this.inited = true; - } - - public void disappear() { - BlackBox.getInstance().submitEvent(new BBDisappearDroneCommand(this.getName())); - this.detachFromServer(true); - this.detach(); - } - - public void longLoc(short x, short y, short z, short yaw) { - if (!(this.getOwner() instanceof Pilot)) { - BlackBox.getInstance().submitEvent(new BBMoveDroneCommand(this.getName(), x, y, z, yaw)); - } - - this._last_x = x; - this._last_y = y; - this._last_z = z; - this._last_yaw = yaw; - this._vel_x = this._last_x - this._x; - this._vel_y = this._last_y - this._y; - this._vel_z = this._last_z - this._z; - this._vel_yaw = ((this._last_yaw - this._yaw) % 360 + 360) % 360; - - assert this._vel_yaw >= 0; - - if (this._vel_yaw > 180) { - this._vel_yaw -= 360; - } - - this._last_PosTime = Std.getRealTime(); - this.inited = true; - } - - public void property(OldPropertyList propList) { - int end = propList.size(); - - for(int i = 0; i < end; ++i) { - netProperty tmpProp = propList.elementAt(i); - switch (tmpProp.property()) { - case 5: - this.handleVAR_BITMAP(tmpProp.value()); - break; - case 23: - this.handleVAR_ASLEEP(tmpProp.value()); - break; + } else { + BlackBox.getInstance().submitEvent(new BBDroneBitmapCommand(this.getName(), var1)); + if (var1.charAt(0) == 0) { + var1 = var1.substring(2); + } + + try { + return this.setAvatarNow(new URL(URL.getAvatar(), var1)); + } catch (MalformedURLException var3) { + Console.println(Console.message("Invalid-av") + var1); + return this; + } + } + } + + public Point3Temp getVelocity() { + return Point3Temp.make((float)this._vel_x, (float)this._vel_y, (float)this._vel_z); + } + + public int getYawRate() { + return this._vel_yaw; + } + + public boolean handle(FrameEvent var1) { + if (this._server == null) { + return true; + } else { + int var2 = var1.time; + this.interpolate(var2, this._server.getUpdateTime(), this); + return true; + } + } + + public void interpolate(int var1, int var2, Transform var3) { + if (this.inited) { + if (var1 - this._last_PosTime > var2) { + this._last_PosTime = var1; + this._vel_x = this._last_x - this._x; + this._vel_y = this._last_y - this._y; + this._vel_z = this._last_z - this._z; + this._vel_yaw = ((this._last_yaw - this._yaw) % 360 + 360) % 360; + assert(this._vel_yaw >= 0); + if (this._vel_yaw > 180) { + this._vel_yaw -= 360; + } + } + + double var4 = (double)(var1 - this._last_FrameTime) / (double)var2; + if (var1 - this._last_FrameTime > var2) { + var4 = 0.0D; + } + + this._x += (int)(var4 * (double)this._vel_x); + this._y += (int)(var4 * (double)this._vel_y); + this._z += (int)(var4 * (double)this._vel_z); + this._yaw += (int)(var4 * (double)this._vel_yaw) % 360; + var3.makeIdentity().moveBy((float)this._x, (float)this._y, (float)this._z).yaw((float)this._yaw); + this._last_FrameTime = var1; + } + } + + public void reset(short var1, short var2, short var3, short var4) { + this._x = var1; + this._y = var2; + this._z = var3; + this._yaw = var4; + this._vel_x = this._vel_y = this._vel_z = 0; + this._vel_yaw = 0; + this._last_x = this._x; + this._last_y = this._y; + this._last_z = this._z; + this._last_yaw = this._yaw; + this._last_PosTime = this._last_FrameTime = Std.getRealTime(); + this.inited = true; + } + + protected void transferFrom(Drone var1) { + this.makeIdentity().post(var1); + this._x = var1._x; + this._y = var1._y; + this._z = var1._z; + this._yaw = var1._yaw; + this._vel_x = var1._vel_x; + this._vel_y = var1._vel_y; + this._vel_z = var1._vel_z; + this._vel_yaw = var1._vel_yaw; + this._last_x = var1._last_x; + this._last_y = var1._last_y; + this._last_z = var1._last_z; + this._last_yaw = var1._last_yaw; + this._last_PosTime = var1._last_PosTime; + this._last_FrameTime = var1._last_FrameTime; + this.inited = true; + } + + public void appear(Room var1, short var2, short var3, short var4, short var5) { + assert(var1 != null); + BlackBox.getInstance().submitEvent(new BBAppearDroneCommand(var1.toString(), this.getName(), var2, var3, var4, var5)); + if (this.getRoom() != var1) { + this.detach(); + var1.add(this); + } + + this.makeIdentity().moveBy((float)var2, (float)var3, (float)var4).yaw((float)var5); + this._x = var2; + this._y = var3; + this._z = var4; + this._yaw = var5; + this._vel_x = this._vel_y = this._vel_z = 0; + this._vel_yaw = 0; + this._last_x = var2; + this._last_y = var3; + this._last_z = var4; + this._last_yaw = var5; + this._last_PosTime = this._last_FrameTime = Std.getRealTime(); + URL var6 = this.getCurrentURL(); + if (var6 != null) { + this.setAvatarNow(var6); + } + + this.inited = true; + } + + public void disappear() { + BlackBox.getInstance().submitEvent(new BBDisappearDroneCommand(this.getName())); + this.detachFromServer(true); + this.detach(); + } + + public void longLoc(short var1, short var2, short var3, short var4) { + if (!(this.getOwner() instanceof Pilot)) { + BlackBox.getInstance().submitEvent(new BBMoveDroneCommand(this.getName(), var1, var2, var3, var4)); + } + + this._last_x = var1; + this._last_y = var2; + this._last_z = var3; + this._last_yaw = var4; + this._vel_x = this._last_x - this._x; + this._vel_y = this._last_y - this._y; + this._vel_z = this._last_z - this._z; + this._vel_yaw = ((this._last_yaw - this._yaw) % 360 + 360) % 360; + assert(this._vel_yaw >= 0); + if (this._vel_yaw > 180) { + this._vel_yaw -= 360; + } + + this._last_PosTime = Std.getRealTime(); + this.inited = true; + } + + public void property(OldPropertyList var1) { + int var3 = var1.size(); + + for(int var4 = 0; var4 < var3; ++var4) { + netProperty var2 = var1.elementAt(var4); + switch(var2.property()) { + case 5: + this.handleVAR_BITMAP(var2.value()); + break; + case 23: + this.handleVAR_ASLEEP(var2.value()); + break; + default: + byte[] var5 = new byte[var2.value().length()]; + var2.value().getBytes(0, var2.value().length(), var5, 0); + this.getSharer().setFromNetData(var2.property(), var5); + } + } + + } + + public void propertyUpdate(PropertyList var1) { + int var3 = var1.size(); + + for(int var4 = 0; var4 < var3; ++var4) { + net2Property var2 = var1.elementAt(var4); + switch(var2.property()) { + case 5: + this.handleVAR_BITMAP(var2.value()); + break; + case 23: + this.handleVAR_ASLEEP(var2.value()); + break; + default: + this.getSharer().setFromNetData(var2.property(), var2.data()); + } + } + + } + + public void roomChange(Room var1, short var2, short var3, short var4, short var5) { + this.detach(); + if (var1 != null) { + this.appear(var1, var2, var3, var4, var5); + } + + } + + public void shortLoc(byte var1, byte var2, byte var3) { + if (!(this.getOwner() instanceof Pilot)) { + BlackBox.getInstance().submitEvent(new BBDroneDeltaPosCommand(this.getName(), var1, var2, var3)); + } + + this._last_x += var1; + this._last_y += var2; + this._last_yaw += var3; + this._last_yaw %= 360; + this._vel_x = this._last_x - this._x; + this._vel_y = this._last_y - this._y; + this._vel_z = 0; + this._vel_yaw = ((this._last_yaw - this._yaw) % 360 + 360) % 360; + assert(this._vel_yaw >= 0); + if (this._vel_yaw > 180) { + this._vel_yaw -= 360; + } + + this._last_PosTime = Std.getRealTime(); + } + + public void teleport(WorldServer var1, byte var2, byte var3, Room var4, short var5, short var6, short var7, short var8) { + assert(var1.getObject(new ObjID(this.getLongID())) == this); + Room var9 = this.getRoom(); + switch(var2) { + default: + if (var9 != null) { + assert(var9 != null); + this.detach(); + } + case 0: + switch(var3) { + case 0: + this.detachFromServer(true); + this.detach(); + break; + default: + if (var4 == null) { + this.detach(); + } else { + assert(var4 != null); + this.appear(var4, var5, var6, var7, var8); + } + } + + } + } + + public WorldServer getServer() { + return this._server; + } + + public String getLongID() { + String var1 = this.getName(); + if (var1.startsWith("!")) { + var1 = var1.substring(1); + } + + return var1; + } + + public void register() { + assert(false); + } + + public void galaxyDisconnected() { + assert(false); + } + + public void reacquireServer(WorldServer var1) { + assert(false); + } + + public void changeChannel(Galaxy var1, String var2, String var3) { + assert(false); + } + + public Object properties(int var1, int var2, int var3, Object var4) throws NoSuchPropertyException { + Object var5 = null; + switch(var1 - var2) { default: - byte[] data = new byte[tmpProp.value().length()]; - tmpProp.value().getBytes(0, tmpProp.value().length(), data, 0); - this.getSharer().setFromNetData(tmpProp.property(), data); - } - } - - } - - public void propertyUpdate(PropertyList propList) { - int end = propList.size(); - - for(int i = 0; i < end; ++i) { - net2Property tmpProp = propList.elementAt(i); - switch (tmpProp.property()) { - case 5: - this.handleVAR_BITMAP(tmpProp.value()); - break; - case 23: - this.handleVAR_ASLEEP(tmpProp.value()); - break; + var5 = super.properties(var1, var2 + 0, var3, var4); + return var5; + } + } + + public void saveState(Saver var1) throws IOException { + if (this.console != null) { + System.out.println("Warning: saving drone " + this.getName() + " WITH soul, which won't restore correctly!"); + } + + var1.saveVersion(0, classCookieInterpolatedDrone); + var1.saveVersion(0, classCookie); + super.saveState(var1); + } + + public void restoreStateDrone(Restorer var1) throws IOException, TooNewException { + var1.restoreVersion(classCookieInterpolatedDrone); + switch(var1.restoreVersion(classCookie)) { + case 0: + super.restoreState(var1); + Enumeration var2 = this.getContents(); + + while(var2.hasMoreElements()) { + WObject var3 = (WObject)var2.nextElement(); + if (var3 instanceof Hologram) { + Hologram var4 = (Hologram)var3; + if (var4.getMovieName() == null) { + this.tag = var4; + } + } + } + + return; default: - this.getSharer().setFromNetData(tmpProp.property(), tmpProp.data()); - } - } - - } - - public void roomChange(Room newRoom, short x, short y, short z, short yaw) { - this.detach(); - if (newRoom != null) { - this.appear(newRoom, x, y, z, yaw); - } - - } - - public void shortLoc(byte dx, byte dy, byte dyaw) { - if (!(this.getOwner() instanceof Pilot)) { - BlackBox.getInstance().submitEvent(new BBDroneDeltaPosCommand(this.getName(), dx, dy, dyaw)); - } - - this._last_x += dx; - this._last_y += dy; - this._last_yaw += dyaw; - this._last_yaw %= 360; - this._vel_x = this._last_x - this._x; - this._vel_y = this._last_y - this._y; - this._vel_z = 0; - this._vel_yaw = ((this._last_yaw - this._yaw) % 360 + 360) % 360; - - assert this._vel_yaw >= 0; - - if (this._vel_yaw > 180) { - this._vel_yaw -= 360; - } - - this._last_PosTime = Std.getRealTime(); - } - - public void teleport(WorldServer serv, byte exitType, byte entryType, Room newRoom, short x, short y, short z, short yaw) { - assert serv.getObject(new ObjID(this.getLongID())) == this; - - Room curRoom = this.getRoom(); - switch (exitType) { - default: - if (curRoom != null) { - assert curRoom != null; - - this.detach(); - } - case 0: - switch (entryType) { - case 0: - this.detachFromServer(true); - this.detach(); - break; - default: - if (newRoom == null) { - this.detach(); - } else { - assert newRoom != null; - - this.appear(newRoom, x, y, z, yaw); - } - } - - } - } - - public WorldServer getServer() { - return this._server; - } - - public String getLongID() { - String name = this.getName(); - if (name.startsWith("!")) { - name = name.substring(1); - } - - return name; - } - - public void register() { - assert false; - - } - - public void galaxyDisconnected() { - assert false; - - } - - public void reacquireServer(WorldServer oldServ) { - assert false; - - } - - public void changeChannel(Galaxy g, String oldChannel, String newChannel) { - assert false; - - } - - public Object properties(int index, int offset, int mode, Object value) throws NoSuchPropertyException { - Object ret = null; - int var10000 = index - offset; - ret = super.properties(index, offset + 0, mode, value); - return ret; - } - - public void saveState(Saver s) throws IOException { - if (this.console != null) { - System.out.println("Warning: saving drone " + this.getName() + " WITH soul, which won't restore correctly!"); - } - - s.saveVersion(0, classCookieInterpolatedDrone); - s.saveVersion(0, classCookie); - super.saveState(s); - } - - public void restoreStateDrone(Restorer r) throws IOException, TooNewException { - r.restoreVersion(classCookieInterpolatedDrone); - switch (r.restoreVersion(classCookie)) { - case 0: - super.restoreState(r); - Enumeration e = this.getContents(); - - while(e.hasMoreElements()) { - WObject w = (WObject)e.nextElement(); - if (w instanceof Hologram) { - Hologram h = (Hologram)w; - if (h.getMovieName() == null) { - this.tag = h; - } - } - } - - return; - default: - throw new TooNewException(); - } - } - - public void restoreState(Restorer r) throws IOException, TooNewException { - this.restoreStateDrone(r); - } - - class BounceNametag implements MainCallback { - int start; - WObject origTag; - WObject origTagbg; + throw new TooNewException(); + } + } + + public void restoreState(Restorer var1) throws IOException, TooNewException { + this.restoreStateDrone(var1); + } + + // $FF: synthetic method + static String access$000(Drone var0) { + return var0.sleepMode; + } + + // $FF: synthetic method + static Shape access$100(Drone var0) { + return var0.sleepBox; + } + + // $FF: synthetic method + static Shape access$102(Drone var0, Shape var1) { + return var0.sleepBox = var1; + } + + // $FF: synthetic method + static void access$200() { + flushUnusedDrones(); + } + + // $FF: synthetic method + static float access$300(Drone var0) { + return var0.tagHeight; + } + + static { + Main.register(new Drone$Flusher()); + showNametags = IniFile.gamma().getIniInt("SHOWNAMETAGS", 1) == 1; + employeeAccounts = ServerTableManager.instance().getTable("employeeAccounts"); + employeeHash = null; + usableDrones = new Vector(); + classCookie = new Object(); + classCookieInterpolatedDrone = new Object(); + } +} - BounceNametag() { - if (Drone.this.tag != null) { +class Drone$MakeSleepBox implements MainCallback { + + private final Drone this$0; + + + Drone$MakeSleepBox(Drone var1) { + this.this$0 = var1; + } + + public void mainCallback() { + if(Drone.access$000(this.this$0) != null && Drone.access$000(this.this$0).equals(Console.message("asleep")) && (!(this.this$0 instanceof MutedDrone))) { + if(Drone.access$100(this.this$0) == null) { + Drone.access$102(this.this$0, new Shape()); + Drone.access$100(this.this$0).setURL(URL.make("home:idle.rwg")); + Drone.access$100(this.this$0).setBumpable(false); + Drone.access$100(this.this$0).scale(100.0F); + Drone.access$100(this.this$0).spin(0.0F, 1.0F, 1.0F, 180.0F); + Drone.access$100(this.this$0).raise(189.0F); + this.this$0.add(Drone.access$100(this.this$0)); + } + } else if(Drone.access$100(this.this$0) != null) { + Drone.access$100(this.this$0).detach(); + Drone.access$102(this.this$0, (Shape)null); + } + + Main.unregister(this); + } +} + +class Drone$Flusher implements MainCallback { + + int lastTime; + + + public void mainCallback() { + int var1 = Std.getFastTime(); + if(var1 > this.lastTime + 1000) { + Drone.access$200(); + this.lastTime = var1; + } + + } +} + +class Drone$BounceNametag implements MainCallback { + + int start; + WObject origTag; + WObject origTagbg; + private final Drone this$0; + + + Drone$BounceNametag(Drone var1) { + this.this$0 = var1; + if(var1.tag != null) { this.start = Std.getFastTime(); - this.origTag = Drone.this.tag; - this.origTagbg = Drone.this.tagbg; + this.origTag = var1.tag; + this.origTagbg = var1.tagbg; Main.register(this); - } + } - } + } - public void mainCallback() { - int now = Std.getFastTime(); - float h = Drone.this.tagHeight; - if (now <= this.start + 6000 && this.origTag == Drone.this.tag && this.origTagbg == Drone.this.tagbg) { - if (now < this.start + 1500) { - h = Drone.this.tagHeight + 200.0F * ((float)(now - this.start) / 1500.0F); + public void mainCallback() { + int var1 = Std.getFastTime(); + float var2 = Drone.access$300(this.this$0); + if(var1 <= this.start + 6000 && this.origTag == this.this$0.tag && this.origTagbg == this.this$0.tagbg) { + if(var1 < this.start + 1500) { + var2 = Drone.access$300(this.this$0) + 200.0F * ((float)(var1 - this.start) / 1500.0F); } else { - float t = (float)(now - this.start) / 1500.0F; - h = (float)(200.0 * Math.pow(1.4140000343322754, (double)t) * Math.cos((double)(t * 3.14159F))); + float var3 = (float)(var1 - this.start) / 1500.0F; + var2 = (float)(200.0D * Math.pow(1.4140000343322754D, (double)var3) * Math.cos((double)(var3 * 3.14159F))); } - } else { + } else { Main.unregister(this); - } + } - this.origTag.setZ(h); - if (this.origTagbg != null) { - this.origTagbg.setZ(h); - } - - } - } - - static class Flusher implements MainCallback { - int lastTime; - - public void mainCallback() { - int now = Std.getFastTime(); - if (now > this.lastTime + 1000) { - Drone.flushUnusedDrones(); - this.lastTime = now; - } - - } - } - - class MakeSleepBox implements MainCallback { - public void mainCallback() { - if (Drone.this.sleepMode != null && Drone.this.sleepMode.equals(Console.message("asleep")) && !(Drone.this instanceof MutedDrone)) { - if (Drone.this.sleepBox == null) { - Drone.this.sleepBox = new Shape(); - Drone.this.sleepBox.setURL(URL.make("home:idle.rwg")); - Drone.this.sleepBox.setBumpable(false); - Drone.this.sleepBox.scale(100.0F); - Drone.this.sleepBox.spin(0.0F, 1.0F, 1.0F, 180.0F); - Drone.this.sleepBox.raise(189.0F); - Drone.this.add(Drone.this.sleepBox); - } - } else if (Drone.this.sleepBox != null) { - Drone.this.sleepBox.detach(); - Drone.this.sleepBox = null; - } - - Main.unregister(this); - } - } -} + this.origTag.setZ(var2); + if(this.origTagbg != null) { + this.origTagbg.setZ(var2); + } + + } +} diff -ruN a/1920/NET/worlds/scape/HighJump.java b/1920/NET/worlds/scape/HighJump.java --- a/1920/NET/worlds/scape/HighJump.java 2024-01-08 01:46:36.000000000 -0600 +++ b/1920/NET/worlds/scape/HighJump.java 2023-08-21 23:27:17.000000000 -0500 @@ -9,42 +9,44 @@ int start; SmoothDriver sd; - public HighJump(String id, String name) { - super(id, name); + public HighJump(String var1, String var2) { + super(var1, var2); } - public HighJump(String id, String name, int qty) { - super(id, name, qty); + public HighJump(String var1, String var2, int var3) { + super(var1, var2, var3); } - public HighJump(HighJump in) { - super(in); + public HighJump(HighJump var1) { + super(var1); } public InventoryItem cloneItem() { return new HighJump(this); } - private SmoothDriver findSD(Pilot p) { - Enumeration e = p.getHandlers(); + private SmoothDriver findSD(Pilot var1) { + Enumeration var2 = var1.getHandlers(); - while(e.hasMoreElements()) { - Object o = e.nextElement(); - if (o instanceof SmoothDriver) { - return (SmoothDriver)o; + Object var3; + do { + if (!var2.hasMoreElements()) { + return null; } - } - return null; + var3 = var2.nextElement(); + } while(!(var3 instanceof SmoothDriver)); + + return (SmoothDriver)var3; } public boolean doAction() { if (this.itemQuantity_ > 0) { - Pilot p = Pilot.getActive(); - if (p == null) { + Pilot var1 = Pilot.getActive(); + if (var1 == null) { return false; } else { - this.sd = this.findSD(p); + this.sd = this.findSD(var1); if (this.sd == null) { return false; } else { @@ -63,13 +65,13 @@ } public void mainCallback() { - int now = Std.getFastTime(); - if (now > this.start + 6000) { + int var1 = Std.getFastTime(); + if (var1 > this.start + 6000) { Main.unregister(this); this.sd.setEyeHeight(150.0F); } else { - float t = 1.0F - (float)Math.pow((double)(1.0F - (float)(now - this.start) / 3000.0F), 4.0); - this.sd.setEyeHeight(150.0F + 150.0F * t); + float var2 = 1.0F - (float)Math.pow((double)(1.0F - (float)(var1 - this.start) / 3000.0F), 4.0D); + this.sd.setEyeHeight(150.0F + 150.0F * var2); } } diff -ruN a/1920/NET/worlds/scape/InventoryManager.java b/1920/NET/worlds/scape/InventoryManager.java --- a/1920/NET/worlds/scape/InventoryManager.java 2024-01-08 01:46:42.000000000 -0600 +++ b/1920/NET/worlds/scape/InventoryManager.java 2023-08-21 23:27:17.000000000 -0500 @@ -18,9 +18,9 @@ private boolean initialized_ = false; private Vector equipped_ = new Vector(); - public synchronized void setEquippedItems(Vector equippedItems) { + public synchronized void setEquippedItems(Vector var1) { this.removeEquippedItems(); - this.equipped_ = equippedItems; + this.equipped_ = var1; this.equipItems(); } @@ -29,14 +29,14 @@ } private synchronized void removeEquippedItems() { - for(int i = 0; i < this.equipped_.size(); ++i) { - EquippableItem itemToEquip = (EquippableItem)this.equipped_.elementAt(i); - Shape ownedShape = itemToEquip.getOwnedShape(); - if (ownedShape != null) { - ownedShape.detach(); + for(int var1 = 0; var1 < this.equipped_.size(); ++var1) { + EquippableItem var2 = (EquippableItem)this.equipped_.elementAt(var1); + Shape var3 = var2.getOwnedShape(); + if (var3 != null) { + var3.detach(); } - itemToEquip.setOwnedShape((Shape)null); + var2.setOwnedShape((Shape)null); } } @@ -44,35 +44,36 @@ private synchronized void equipItems() { System.out.println("Equipped Items Size: " + this.equipped_.size()); - for(int i = 0; i < this.equipped_.size(); ++i) { - Shape itemShape = new Shape(); - EquippableItem itemToEquip = (EquippableItem)this.equipped_.elementAt(i); - if (itemToEquip != null) { + for(int var1 = 0; var1 < this.equipped_.size(); ++var1) { + Shape var2 = new Shape(); + new String(); + EquippableItem var7 = (EquippableItem)this.equipped_.elementAt(var1); + if (var7 != null) { try { - itemShape.setURL(new URL(itemToEquip.getModelLocation())); - } catch (MalformedURLException var10) { - System.out.println("Badly formed URL for " + itemToEquip.getItemName()); + var2.setURL(new URL(var7.getModelLocation())); + } catch (MalformedURLException var12) { + System.out.println("Badly formed URL for " + var7.getItemName()); continue; } - float s = itemToEquip.getScale(); - itemShape.scale(s, s, s); - itemShape.pitch((float)itemToEquip.getPitch()); - itemShape.roll((float)itemToEquip.getRoll()); - itemShape.yaw((float)itemToEquip.getYaw()); - itemShape.moveBy(itemToEquip.getXPos(), itemToEquip.getYPos(), itemToEquip.getZPos()); - int properLoc = itemToEquip.getBodyLocation(); - DeepEnumeration de = new DeepEnumeration(); - Pilot.getActive().getChildren(de); - - while(de.hasMoreElements()) { - Object obj = de.nextElement(); - if (obj instanceof Shape) { - Shape objShape = (Shape)obj; - int partType = objShape.getBodPartNum(); - if (partType == properLoc) { - objShape.add(itemShape); - itemToEquip.setOwnedShape(itemShape); + float var6 = var7.getScale(); + var2.scale(var6, var6, var6); + var2.pitch((float)var7.getPitch()); + var2.roll((float)var7.getRoll()); + var2.yaw((float)var7.getYaw()); + var2.moveBy(var7.getXPos(), var7.getYPos(), var7.getZPos()); + int var4 = var7.getBodyLocation(); + DeepEnumeration var8 = new DeepEnumeration(); + Pilot.getActive().getChildren(var8); + + while(var8.hasMoreElements()) { + Object var9 = var8.nextElement(); + if (var9 instanceof Shape) { + Shape var10 = (Shape)var9; + int var11 = var10.getBodPartNum(); + if (var11 == var4) { + var10.add(var2); + var7.setOwnedShape(var2); break; } } @@ -83,219 +84,219 @@ } public Vector getEquippableItems() { - Vector retVal = new Vector(); - Enumeration invEnum = this.inventory_.elements(); + Vector var1 = new Vector(); + Enumeration var2 = this.inventory_.elements(); - while(invEnum.hasMoreElements()) { - InventoryItem obj = (InventoryItem)invEnum.nextElement(); - if (obj instanceof EquippableItem) { - retVal.addElement(obj); + while(var2.hasMoreElements()) { + Object var3 = var2.nextElement(); + if (var3 instanceof EquippableItem) { + var1.addElement(var3); } } - return retVal; + return var1; } public Vector getInventoryAvatars() { - Vector retVal = new Vector(); - Enumeration invEnum = this.inventory_.elements(); + Vector var1 = new Vector(); + Enumeration var2 = this.inventory_.elements(); - while(invEnum.hasMoreElements()) { - InventoryItem obj = (InventoryItem)invEnum.nextElement(); - if (obj instanceof InventoryAvatar) { - retVal.addElement(obj); + while(var2.hasMoreElements()) { + Object var3 = var2.nextElement(); + if (var3 instanceof InventoryAvatar) { + var1.addElement(var3); } } - return retVal; + return var1; } public Hashtable getInventoryItems() { return this.inventory_; } - public int checkInventoryFor(String nm) { - InventoryItem it = (InventoryItem)this.inventory_.get(nm); - return it != null ? it.getItemQuantity() : 0; + public int checkInventoryFor(String var1) { + InventoryItem var2 = (InventoryItem)this.inventory_.get(var1); + return var2 != null ? var2.getItemQuantity() : 0; } public Vector getInventoryActionList() { - Vector retVal = new Vector(); - Enumeration invEnum = this.inventory_.elements(); + Vector var1 = new Vector(); + Enumeration var2 = this.inventory_.elements(); - while(invEnum.hasMoreElements()) { - InventoryItem obj = (InventoryItem)invEnum.nextElement(); - if (obj instanceof InventoryAction) { - retVal.addElement(obj); + while(var2.hasMoreElements()) { + Object var3 = var2.nextElement(); + if (var3 instanceof InventoryAction) { + var1.addElement(var3); } } - return retVal; + return var1; } - public void doInventoryAction(String act) { - Vector actVector = this.getInventoryActionList(); + public void doInventoryAction(String var1) { + Vector var2 = this.getInventoryActionList(); - for(int i = 0; i < actVector.size(); ++i) { - InventoryAction invAct = (InventoryAction)actVector.elementAt(i); - if (invAct.getItemName().equalsIgnoreCase(act)) { - invAct.doAction(); - String msg = "&|+deal>trade " + invAct.getItemId() + ","; - TradeDialog.sendTradeMessage(msg); + for(int var3 = 0; var3 < var2.size(); ++var3) { + InventoryAction var4 = (InventoryAction)var2.elementAt(var3); + if (var4.getItemName().equalsIgnoreCase(var1)) { + var4.doAction(); + String var5 = "&|+deal>trade " + var4.getItemId() + ","; + TradeDialog.sendTradeMessage(var5); } } } - public void setInventory(String invString) { + public void setInventory(String var1) { this.initialized_ = true; - Hashtable newInv = this.parseInventoryString(invString); - this.inventory_ = newInv; - Enumeration e = WhisperManager.whisperManager().tradeDialogs().elements(); - - while(e.hasMoreElements()) { - TradeDialog wd = (TradeDialog)e.nextElement(); - wd.setTrading(true); + Hashtable var2 = this.parseInventoryString(var1); + this.inventory_ = var2; + Enumeration var3 = WhisperManager.whisperManager().tradeDialogs().elements(); + + while(var3.hasMoreElements()) { + TradeDialog var4 = (TradeDialog)var3.nextElement(); + var4.setTrading(true); } if (Console.getActive() != null) { - Console a = Console.getActive(); - a.inventoryChanged(); - if (a.targetValid != a.isValidAv()) { - a.resetAvatar(); + Console var5 = Console.getActive(); + var5.inventoryChanged(); + if (var5.targetValid != var5.isValidAv()) { + var5.resetAvatar(); } } ActionsPart.updateActionDialog(); } - public Hashtable parseInventoryString(String invString) { - Hashtable newInventory = new Hashtable(); - if (invString == null) { - return newInventory; + public Hashtable parseInventoryString(String var1) { + Hashtable var2 = new Hashtable(); + if (var1 == null) { + return var2; } else { - int len = invString.length(); + int var3 = var1.length(); - int countStart; - int countLen; - for(int itemStart = 0; itemStart < len; itemStart = countStart + countLen) { - char ch = invString.charAt(itemStart); - if (ch < 'A' || ch > 'Z') { - System.out.println("Bad inventory: " + invString); - return newInventory; + int var8; + int var9; + for(int var4 = 0; var4 < var3; var4 = var8 + var9) { + char var5 = var1.charAt(var4); + if (var5 < 'A' || var5 > 'Z') { + System.out.println("Bad inventory: " + var1); + return var2; } - int descLen; - for(descLen = 1; itemStart + descLen < len; ++descLen) { - ch = invString.charAt(itemStart + descLen); - if (ch < 'a' || ch > 'z') { + int var6; + for(var6 = 1; var4 + var6 < var3; ++var6) { + var5 = var1.charAt(var4 + var6); + if (var5 < 'a' || var5 > 'z') { break; } } - String shortName = invString.substring(itemStart, itemStart + descLen); - countStart = itemStart + descLen; + String var7 = var1.substring(var4, var4 + var6); + var8 = var4 + var6; - for(countLen = 0; countLen + countStart < len; ++countLen) { - ch = invString.charAt(countStart + countLen); - if (ch < '0' || ch > '9') { + for(var9 = 0; var9 + var8 < var3; ++var9) { + var5 = var1.charAt(var8 + var9); + if (var5 < '0' || var5 > '9') { break; } } - int count = 1; - if (countLen > 0) { - count = Integer.parseInt(invString.substring(countStart, countStart + countLen)); + int var10 = 1; + if (var9 > 0) { + var10 = Integer.parseInt(var1.substring(var8, var8 + var9)); } - InventoryItem foundItem = (InventoryItem)this.masterList_.get(shortName); - if (foundItem != null) { - InventoryItem newItem = foundItem.cloneItem(); - newItem.setQuantity(count); - newInventory.put(shortName, newItem); + InventoryItem var11 = (InventoryItem)this.masterList_.get(var7); + if (var11 != null) { + InventoryItem var12 = var11.cloneItem(); + var12.setQuantity(var10); + var2.put(var7, var12); } } - return newInventory; + return var2; } } - public String properCase(String s) { - return s.equals("") ? s : s.substring(0, 1).toUpperCase() + s.substring(1); + public String properCase(String var1) { + return var1.equals("") ? var1 : var1.substring(0, 1).toUpperCase() + var1.substring(1); } - public String getSingular(String sn) { - InventoryItem item = (InventoryItem)this.masterList_.get(sn); - return item != null ? item.getItemName() : "unknown" + sn; + public String getSingular(String var1) { + InventoryItem var2 = (InventoryItem)this.masterList_.get(var1); + return var2 != null ? var2.getItemName() : "unknown" + var1; } - public String getPlural(String sn) { - return this.getSingular(sn) + "s"; + public String getPlural(String var1) { + return this.getSingular(var1) + "s"; } - public String itemName(String sn, int num) { - if (num == 1) { - return "a " + this.getSingular(sn); + public String itemName(String var1, int var2) { + if (var2 == 1) { + return "a " + this.getSingular(var1); } else { - String retVal = num + " " + this.getPlural(sn); - return retVal; + String var3 = "" + var2 + " " + this.getPlural(var1); + return var3; } } - public String itemName(InventoryItem item) { - return this.itemName(item.getItemId(), item.getItemQuantity()); + public String itemName(InventoryItem var1) { + return this.itemName(var1.getItemId(), var1.getItemQuantity()); } private InventoryManager() { - ServerTableManager stm = ServerTableManager.instance(); - int invVersion = stm.getFileVersion(); - String[] invStrings = stm.getTable("invList"); - String[] graphicStrings = new String[0]; - if (invVersion > 1) { - graphicStrings = stm.getTable("graphicList"); - } - - URL defaultImageURL = URL.make("home:..\\default.gif"); - if (invStrings != null) { - int numStringsPerItem = 12; - - for(int i = 0; i < invStrings.length; i += numStringsPerItem) { - String id = invStrings[i]; - String name = invStrings[i + 2]; - String model = invStrings[i + 3]; - int loc = Double.valueOf(invStrings[i + 4]).intValue(); - float scale = Double.valueOf(invStrings[i + 5]).floatValue(); - int pitch = Double.valueOf(invStrings[i + 6]).intValue(); - int roll = Double.valueOf(invStrings[i + 7]).intValue(); - int yaw = Double.valueOf(invStrings[i + 8]).intValue(); - float xPos = Double.valueOf(invStrings[i + 9]).floatValue(); - float yPos = Double.valueOf(invStrings[i + 10]).floatValue(); - float zPos = Double.valueOf(invStrings[i + 11]).floatValue(); - URL graphic = null; - if (invVersion > 1 && graphicStrings.length > i / 6 + 1) { - String gString = graphicStrings[i / 6 + 1]; - if (gString != "default") { - graphic = URL.make(gString); + ServerTableManager var1 = ServerTableManager.instance(); + int var2 = var1.getFileVersion(); + String[] var3 = var1.getTable("invList"); + String[] var4 = new String[0]; + if (var2 > 1) { + var4 = var1.getTable("graphicList"); + } + + URL var5 = URL.make("home:..\\default.gif"); + if (var3 != null) { + byte var6 = 12; + + for(int var19 = 0; var19 < var3.length; var19 += var6) { + String var7 = var3[var19]; + String var8 = var3[var19 + 2]; + String var9 = var3[var19 + 3]; + int var10 = Double.valueOf(var3[var19 + 4]).intValue(); + float var14 = Double.valueOf(var3[var19 + 5]).floatValue(); + int var11 = Double.valueOf(var3[var19 + 6]).intValue(); + int var12 = Double.valueOf(var3[var19 + 7]).intValue(); + int var13 = Double.valueOf(var3[var19 + 8]).intValue(); + float var15 = Double.valueOf(var3[var19 + 9]).floatValue(); + float var16 = Double.valueOf(var3[var19 + 10]).floatValue(); + float var17 = Double.valueOf(var3[var19 + 11]).floatValue(); + URL var18 = null; + if (var2 > 1 && var4.length > var19 / 6 + 1) { + String var20 = var4[var19 / 6 + 1]; + if (var20 != "default") { + var18 = URL.make(var20); } } - if (graphic == null) { - graphic = defaultImageURL; + if (var18 == null) { + var18 = var5; } - Object newItem; - if (id.charAt(0) == 'H') { - newItem = InventoryAction.createAction(id, name, 1); - } else if (id.charAt(0) == 'W') { - newItem = new EquippableItem(id, name, 1, model, scale, loc, xPos, yPos, zPos, pitch, roll, yaw); - } else if (id.charAt(0) == 'V') { - newItem = new InventoryAvatar(id, name, 1); + Object var21; + if (var7.charAt(0) == 'H') { + var21 = InventoryAction.createAction(var7, var8, 1); + } else if (var7.charAt(0) == 'W') { + var21 = new EquippableItem(var7, var8, 1, var9, var14, var10, var15, var16, var17, var11, var12, var13); + } else if (var7.charAt(0) == 'V') { + var21 = new InventoryAvatar(var7, var8, 1); } else { - newItem = new InventoryItem(id, name, 1); + var21 = new InventoryItem(var7, var8, 1); } - ((InventoryItem)newItem).setItemGraphicLocation(graphic); - this.masterList_.put(id, newItem); + ((InventoryItem)var21).setItemGraphicLocation(var18); + this.masterList_.put(var7, var21); } } diff -ruN a/1920/NET/worlds/scape/MutedDrone.java b/1920/NET/worlds/scape/MutedDrone.java --- a/1920/NET/worlds/scape/MutedDrone.java 2024-01-08 01:46:38.000000000 -0600 +++ b/1920/NET/worlds/scape/MutedDrone.java 2023-08-21 23:27:17.000000000 -0500 @@ -1,43 +1,44 @@ package NET.worlds.scape; +import NET.worlds.console.HiddenDrone; import NET.worlds.network.ObjID; import NET.worlds.network.URL; import NET.worlds.network.WorldServer; import java.io.IOException; -public class MutedDrone extends Drone { - private static Object classCookie = new Object(); +public class MutedDrone extends Drone implements HiddenDrone { + private static Object classCookie = new Object(); - public MutedDrone(ObjID objID, WorldServer serv, URL url) { - super(objID, serv); - this.setSourceURL(url); - } - - public MutedDrone() { - } - - public Drone setAvatarNow(URL url) { - if (this.shouldBeMuted()) { - this.setSourceURL(url); - return this; - } else { - return super.setAvatarNow(url); - } - } - - public void saveState(Saver s) throws IOException { - s.saveVersion(1, classCookie); - super.saveState(s); - } - - public void restoreState(Restorer r) throws IOException, TooNewException { - int vers = r.restoreVersion(classCookie); - switch (vers) { - case 1: - super.restoreState(r); - return; - default: - throw new TooNewException(); - } - } + public MutedDrone(ObjID var1, WorldServer var2, URL var3) { + super(var1, var2); + this.setSourceURL(var3); + } + + public MutedDrone() { + } + + public Drone setAvatarNow(URL var1) { + if (this.shouldBeMuted()) { + this.setSourceURL(var1); + return this; + } else { + return super.setAvatarNow(var1); + } + } + + public void saveState(Saver var1) throws IOException { + var1.saveVersion(1, classCookie); + super.saveState(var1); + } + + public void restoreState(Restorer var1) throws IOException, TooNewException { + int var2 = var1.restoreVersion(classCookie); + switch(var2) { + case 1: + super.restoreState(var1); + return; + default: + throw new TooNewException(); + } + } } diff -ruN a/1920/NET/worlds/scape/ParallelAction.java b/1920/NET/worlds/scape/ParallelAction.java --- a/1920/NET/worlds/scape/ParallelAction.java 2024-01-08 01:46:38.000000000 -0600 +++ b/1920/NET/worlds/scape/ParallelAction.java 2023-08-21 23:27:17.000000000 -0500 @@ -1,137 +1,136 @@ package NET.worlds.scape; +import NET.worlds.core.Debug; import java.io.IOException; import java.util.Enumeration; import java.util.Vector; public class ParallelAction extends Action implements RunningActionCallback { - protected static final int NONE = 0; - protected static final int FIRST = 1; - protected static final int ALL = -1; - protected Vector actions = new Vector(); - protected int waitState = -1; - protected int waitingFor = 0; - protected Object currentRun = null; - private static Object classCookie = new Object(); - - public Persister trigger(Event evt, Persister seqID) { - if (seqID == null) { - if (this.waitingFor == 0) { - this.currentRun = new Object(); - if (this.waitState == -1) { - this.waitingFor = this.actions.size(); - seqID = this; - } else if (this.waitState == 1) { - this.waitingFor = 1; - seqID = this; - } else { - this.waitingFor = 0; - seqID = null; - } + protected static final int NONE = 0; + protected static final int FIRST = 1; + protected static final int ALL = -1; + protected Vector actions = new Vector(); + protected int waitState = -1; + protected int waitingFor = 0; + protected Object currentRun = null; + private static Object classCookie = new Object(); + + public ParallelAction() { + } + + public Persister trigger(Event var1, Persister var2) { + if (var2 == null) { + if (this.waitingFor == 0) { + this.currentRun = new Object(); + if (this.waitState == -1) { + this.waitingFor = this.actions.size(); + var2 = this; + } else if (this.waitState == 1) { + this.waitingFor = 1; + var2 = this; + } else { + this.waitingFor = 0; + var2 = null; + } - RunningActionHandler.trigger((Vector)this.actions, this.getWorld(), evt, this, this.currentRun); - } - } else if (this.waitingFor == 0) { - seqID = null; - } - - return (Persister)seqID; - } - - public void actionDone(Action a, Event e, Object o) { - if (this.waitingFor > 0 && o == this.currentRun) { - --this.waitingFor; - } - - } - - public void setWaitForAll() { - this.waitState = -1; - } - - public void setWaitForFirst() { - this.waitState = 1; - } - - public void setWaitForNone() { - this.waitState = 0; - } - - public void addComponent(Action act) { - assert act != null; - - this.actions.addElement(act); - } - - public void insertComponent(Action act, int index) { - assert act != null; - - this.actions.insertElementAt(act, index); - } - - public boolean removeComponent(Action act) { - assert act != null; - - return this.actions.removeElement(act); - } - - public Enumeration getComponents() { - return this.actions.elements(); - } - - 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 = ObjectPropertyAdder.make(new VectorProperty(this, index, "Components"), this.getRoot(), "NET.worlds.scape.Action"); - } else if (mode == 1) { - ret = this.actions.clone(); - } else if (mode == 4) { - this.actions.removeElement(value); - } else if (mode == 3) { - this.actions.addElement((Action)value); - } - break; - case 1: - if (mode == 0) { - String[] names = new String[]{"None", "First", "All"}; - int[] values = new int[]{0, 1, -1}; - ret = EnumPropertyEditor.make(new Property(this, index, "Wait for"), names, values); - } else if (mode == 1) { - ret = new Integer(this.waitState); - } else if (mode == 2) { - this.waitState = (Integer)value; + RunningActionHandler.trigger(this.actions, this.getWorld(), var1, this, this.currentRun); } - break; - default: - ret = super.properties(index, offset + 2, mode, value); - } - - return ret; - } - - public void saveState(Saver s) throws IOException { - s.saveVersion(2, classCookie); - super.saveState(s); - s.saveVector(this.actions); - s.saveInt(this.waitState); - } - - public void restoreState(Restorer r) throws IOException, TooNewException { - switch (r.restoreVersion(classCookie)) { - case 1: - super.restoreState(r); - this.actions = r.restoreVector(); - break; - case 2: - super.restoreState(r); - this.actions = r.restoreVector(); - this.waitState = r.restoreInt(); - break; - default: - throw new TooNewException(); - } + } else if (this.waitingFor == 0) { + var2 = null; + } + + return (Persister)var2; + } + + public void actionDone(Action var1, Event var2, Object var3) { + if (this.waitingFor > 0 && var3 == this.currentRun) { + --this.waitingFor; + } + + } + + public void setWaitForAll() { + this.waitState = -1; + } + + public void setWaitForFirst() { + this.waitState = 1; + } + + public void setWaitForNone() { + this.waitState = 0; + } + + public void addComponent(Action var1) { + assert(var1 != null); + this.actions.addElement(var1); + } + + public void insertComponent(Action var1, int var2) { + assert(var1 != null); + this.actions.insertElementAt(var1, var2); + } + + public boolean removeComponent(Action var1) { + assert(var1 != null); + return this.actions.removeElement(var1); + } + + public Enumeration getComponents() { + return this.actions.elements(); + } + + public Object properties(int var1, int var2, int var3, Object var4) throws NoSuchPropertyException { + Object var5 = null; + switch(var1 - var2) { + case 0: + if (var3 == 0) { + var5 = ObjectPropertyAdder.make(new VectorProperty(this, var1, "Components"), this.getRoot(), "NET.worlds.scape.Action"); + } else if (var3 == 1) { + var5 = this.actions.clone(); + } else if (var3 == 4) { + this.actions.removeElement(var4); + } else if (var3 == 3) { + this.actions.addElement((Action)var4); + } + break; + case 1: + if (var3 == 0) { + var5 = IntegerPropertyEditor.make(new Property(this, var1, "Wait for")); + } else if (var3 == 1) { + var5 = new Integer(this.waitState); + } else if (var3 == 2) { + this.waitState = ((Integer)var4).intValue(); + } + break; + default: + var5 = super.properties(var1, var2 + 2, var3, var4); + } + + return var5; + } + + public void saveState(Saver var1) throws IOException { + var1.saveVersion(2, classCookie); + super.saveState(var1); + var1.saveVector(this.actions); + var1.saveInt(this.waitState); + } + + public void restoreState(Restorer var1) throws IOException, TooNewException { + switch(var1.restoreVersion(classCookie)) { + case 1: + super.restoreState(var1); + this.actions = var1.restoreVector(); + break; + case 2: + super.restoreState(var1); + this.actions = var1.restoreVector(); + this.waitState = var1.restoreInt(); + break; + default: + throw new TooNewException(); + } - } + } } diff -ruN a/1920/NET/worlds/scape/PosableShape.java b/1920/NET/worlds/scape/PosableShape.java --- a/1920/NET/worlds/scape/PosableShape.java 2024-01-08 01:46:36.000000000 -0600 +++ b/1920/NET/worlds/scape/PosableShape.java 2023-08-21 23:27:17.000000000 -0500 @@ -3,6 +3,7 @@ import NET.worlds.console.AvMenu; import NET.worlds.console.Console; import NET.worlds.console.DefaultConsole; +import NET.worlds.core.Debug; import NET.worlds.core.IniFile; import NET.worlds.core.ServerTableManager; import NET.worlds.core.Std; @@ -60,62 +61,28 @@ protected Vector expressionChanges; private static Object classCookie; - static { - int i; - if (!NetUpdate.isInternalVersion()) { - for(i = 0; i < secretList.length; ++i) { - secretNames.put(secretList[i], secretList[i]); - } - } - - for(i = 0; i < permittedList.length; i += 2) { - if (secretNames.get(permittedList[i]) == null) { - permittedNames.addElement(permittedList[i]); - if (permittedList[i + 1].indexOf("DgT") >= 0) { - faceNames.addElement(permittedList[i]); - } - } - - if (permittedList[i + 1] != null) { - permittedHash.put(permittedList[i], permittedList[i + 1]); - } - } - - for(i = 1; i < humanList.length; i += 2) { - humanHash.put(humanList[i - 1], humanList[i]); - } - - for(i = 0; i < faceList.length; i += 2) { - faceTextures.put(faceList[i], faceList[i + 1]); - } - - gotServerAvatarList = false; - serverAvatarListError = false; - classCookie = new Object(); - } - public static URL getDefaultURL() { return defaultURL; } - public PosableShape(URL url) { + public PosableShape(URL var1) { this.runPrepFigure = this.setPrepFigure; this.animator = null; this.recomputeHeight = false; this.firstURL = true; this.doLOD = false; - this.setURL(url); + this.setURL(var1); } - public PosableShape(URL url, boolean isAW) { + public PosableShape(URL var1, boolean var2) { this.runPrepFigure = this.setPrepFigure; this.animator = null; this.recomputeHeight = false; this.firstURL = true; this.doLOD = false; - this.setPrepFigure = isAW; + this.setPrepFigure = var2; this.runPrepFigure = this.setPrepFigure; - this.setURL(url); + this.setURL(var1); } public PosableShape() { @@ -143,9 +110,9 @@ super.markVoid(); } - public synchronized void recursiveAddRwChildren(WObject parent) { + public synchronized void recursiveAddRwChildren(WObject var1) { if (!this.hasClump()) { - super.recursiveAddRwChildren(parent); + super.recursiveAddRwChildren(var1); this.getRoom().addPrerenderHandler(this); if (this.isFullyLoaded() && this.figureType != -1) { DroneAnimator.addtype(this.figureType); @@ -159,7 +126,7 @@ } } - public void notifyShapeLoaded(Shape s) { + public void notifyShapeLoaded(Shape var1) { this.recomputeHeight = true; } @@ -167,35 +134,35 @@ return this.clumpID != 0 ? this.getJointedObjectToWorldMatrix(Transform.make()) : super.getObjectToWorldMatrix(); } - public static int getFigureType(URL url) { - String bodyType = getBodyType(url); - return bodyType == null ? -1 : DroneAnimator.getnameindex(bodyType); + public static int getFigureType(URL var0) { + String var1 = getBodyType(var0); + return var1 == null ? -1 : DroneAnimator.getnameindex(var1); } - public static int getFigureType(String bodyType) { - bodyType = getBodyType(bodyType); - return bodyType == null ? -1 : DroneAnimator.getnameindex(bodyType); + public static int getFigureType(String var0) { + var0 = getBodyType(var0); + return var0 == null ? -1 : DroneAnimator.getnameindex(var0); } - protected void download(URL pUrl) { - PendingDrone pd = PosableDroneLoader.makePendingDrone((PosableDrone)null, pUrl); - Enumeration e = getComponentAvatars(pd.getUrl()); - if (e != null) { - while(e.hasMoreElements()) { - String avURL = (String)e.nextElement(); - pd.download(URL.make(avURL)); + protected void download(URL var1) { + PendingDrone var2 = PosableDroneLoader.makePendingDrone((PosableDrone)null, var1); + Enumeration var3 = getComponentAvatars(var2.getUrl()); + if (var3 != null) { + while(var3.hasMoreElements()) { + String var4 = (String)var3.nextElement(); + var2.download(URL.make(var4)); } } } - public synchronized void setURL(URL newName) { - if (newName != this.url && (newName == null || !newName.equals(this.url))) { - if (newName == null || !newName.toString().startsWith("avatar:lod")) { - if (newName != null) { - this.download(newName); - int newType = getFigureType(newName); - if (newType != this.figureType) { + public synchronized void setURL(URL var1) { + if (var1 != this.url && (var1 == null || !var1.equals(this.url))) { + if (var1 == null || !var1.toString().startsWith("avatar:lod")) { + if (var1 != null) { + this.download(var1); + int var2 = getFigureType(var1); + if (var2 != this.figureType) { if (this.animator != null) { this.animator.endanimations(); if (this.figureType != -1) { @@ -204,12 +171,12 @@ } this.animator = null; - this.figureType = newType; + this.figureType = var2; this.animationList = null; } } - this.setBaseLODURL(newName); + this.setBaseLODURL(var1); if (forceLODLevel != -1 && this.numDetailLevels > 0 && this.doLOD) { this.setLOD(0.0F); return; @@ -217,197 +184,197 @@ } this.removeSubparts(); - if (newName != null && newName.getAbsolute().startsWith("avatar:")) { + if (var1 != null && var1.getAbsolute().startsWith("avatar:")) { try { - this.createSubparts(newName); + this.createSubparts(var1); } catch (MalformedURLException var3) { - System.out.println("Received bogus PosableShape URL: " + newName); + System.out.println("Received bogus PosableShape URL: " + var1); return; } } - super.setURL(newName); + super.setURL(var1); } } - private String scanName(String s) { - int start; - char c; - for(start = this.scanPos; (c = s.charAt(this.scanPos)) >= 'a' && c <= 'z' || c == '_'; ++this.scanPos) { + private String scanName(String var1) { + int var2; + char var3; + for(var2 = this.scanPos; (var3 = var1.charAt(this.scanPos)) >= 'a' && var3 <= 'z' || var3 == '_'; ++this.scanPos) { } - return s.substring(start, this.scanPos); + return var1.substring(var2, this.scanPos); } - public static String readName(String s, int pos) { - char c; + public static String readName(String var0, int var1) { + char var3; try { - while((c = s.charAt(pos)) >= 'a' && c <= 'z' || c == '_') { - ++pos; + while((var3 = var0.charAt(var1)) >= 'a' && var3 <= 'z' || var3 == '_') { + ++var1; } } catch (StringIndexOutOfBoundsException var4) { } - return s.substring(pos, pos); + return var0.substring(var1, var1); } - private int scanInt(String s) { - int start = this.scanPos; + private int scanInt(String var1) { + int var2 = this.scanPos; - int val; - char c; - for(val = 0; (c = s.charAt(this.scanPos)) >= '0' && c <= '9'; ++this.scanPos) { - val = 10 * val + (c - 48); + int var3; + char var4; + for(var3 = 0; (var4 = var1.charAt(this.scanPos)) >= '0' && var4 <= '9'; ++this.scanPos) { + var3 = 10 * var3 + (var4 - 48); } - return val; + return var3; } - private static Material scanTexture(String name, int frame) { - if (frame <= 0) { - name = "avatar:" + name + ".cmp"; + private static Material scanTexture(String var0, int var1) { + if (var1 <= 0) { + var0 = "avatar:" + var0 + ".cmp"; } else { - name = "avatar:" + name + frame + "s*.mov"; + var0 = "avatar:" + var0 + var1 + "s*.mov"; } - Material m = new Material(0.32F, 0.55F, 0.0F, colorTable[3], (Texture)null, 1.0F, true, false); - m.loadTexture(URL.make(name)); - return m; + Material var2 = new Material(0.32F, 0.55F, 0.0F, colorTable[3], (Texture)null, 1.0F, true, false); + var2.loadTexture(URL.make(var0)); + return var2; } - public static Material readTexture(String s, int p) { - int frame; - char c; - for(frame = 0; (c = s.charAt(p)) >= '0' && c <= '9'; ++p) { - frame = 10 * frame + (c - 48); + public static Material readTexture(String var0, int var1) { + int var2; + char var3; + for(var2 = 0; (var3 = var0.charAt(var1)) >= '0' && var3 <= '9'; ++var1) { + var2 = 10 * var2 + (var3 - 48); } - return scanTexture(readName(s, p), frame); + return scanTexture(readName(var0, var1), var2); } - public static boolean isValidTexture(String s) { - int len = s.length(); + public static boolean isValidTexture(String var0) { + int var1 = var0.length(); - char c; - int i; - for(i = 0; i < len && (c = s.charAt(i)) >= '0' && c <= '9'; ++i) { + char var2; + int var3; + for(var3 = 0; var3 < var1 && (var2 = var0.charAt(var3)) >= '0' && var2 <= '9'; ++var3) { } - while(i < len) { - if (((c = s.charAt(i)) < 'a' || c > 'z') && c != '_') { + while(var3 < var1) { + if (((var2 = var0.charAt(var3)) < 'a' || var2 > 'z') && var2 != '_') { return false; } - ++i; + ++var3; } return true; } - private static int scanBase64(char c) { - int i = base64.indexOf(c); - return i < 0 ? 0 : i; + private static int scanBase64(char var0) { + int var1 = base64.indexOf(var0); + return var1 < 0 ? 0 : var1; } - public static Material readColor(String s, int p) { - char c = s.charAt(p++); - Material m = null; - int color; - if (c == '_') { - color = s.charAt(p++) - 65; - if (color >= 0 && color < colorTable.length) { - m = new Material(0.32F, 0.55F, 0.0F, colorTable[color], (Texture)null, 1.0F, true, false); + public static Material readColor(String var0, int var1) { + char var2 = var0.charAt(var1++); + Material var3 = null; + int var4; + if (var2 == '_') { + var4 = var0.charAt(var1++) - 65; + if (var4 >= 0 && var4 < colorTable.length) { + var3 = new Material(0.32F, 0.55F, 0.0F, colorTable[var4], (Texture)null, 1.0F, true, false); } else { - m = origMat; + var3 = origMat; } } else { - color = 4 * scanBase64(c); - int g = 4 * scanBase64(s.charAt(p++)); - int b = 4 * scanBase64(s.charAt(p++)); - m = new Material(0.32F, 0.55F, 0.0F, new Color(color, g, b), (Texture)null, 1.0F, true, false); + var4 = 4 * scanBase64(var2); + int var5 = 4 * scanBase64(var0.charAt(var1++)); + int var6 = 4 * scanBase64(var0.charAt(var1++)); + var3 = new Material(0.32F, 0.55F, 0.0F, new Color(var4, var5, var6), (Texture)null, 1.0F, true, false); } - return m; + return var3; } - private Material scanColor(String s) { - Material m = readColor(s, this.scanPos); - if (s.charAt(this.scanPos) == '_') { + private Material scanColor(String var1) { + Material var2 = readColor(var1, this.scanPos); + if (var1.charAt(this.scanPos) == '_') { this.scanPos += 2; } else { this.scanPos += 3; } - return m; + return var2; } - private float getScale(char c) { - if (c >= 'a' && c <= 'z') { - return 1.0F - (float)(c - 97 + 1) * 0.025615385F; + private float getScale(char var1) { + if (var1 >= 'a' && var1 <= 'z') { + return 1.0F - (float)(var1 - 97 + 1) * 0.025615385F; } else { - return c >= 'A' && c <= 'Z' ? 1.0F / (1.0F - (float)(c - 65 + 1) * 0.025615385F) : 1.0F; + return var1 >= 'A' && var1 <= 'Z' ? 1.0F / (1.0F - (float)(var1 - 65 + 1) * 0.025615385F) : 1.0F; } } - private Material getMat(char c, Vector mats) { - int matNum = c - 97; - if (matNum < mats.size()) { - Material m = (Material)mats.elementAt(matNum); - return m == origMat ? origMat : (Material)m.clone(); + private Material getMat(char var1, Vector var2) { + int var3 = var1 - 97; + if (var3 < var2.size()) { + Material var4 = (Material)var2.elementAt(var3); + return var4 == origMat ? origMat : (Material)var4.clone(); } else { return null; } } - private Shape getLimb(String s, String bodyType, int pos, int partNum, Shape parent, Vector mats, boolean loadNow) { - int end = s.length() - 4; - if (bodyType == null) { - if (parent instanceof PosableShape) { - bodyType = ""; + private Shape getLimb(String var1, String var2, int var3, int var4, Shape var5, Vector var6, boolean var7) { + int var8 = var1.length() - 4; + if (var2 == null) { + if (var5 instanceof PosableShape) { + var2 = ""; } else { - bodyType = Shape.getBodBase(parent.getURL()); - if (parent.getURL().toString().indexOf("lod/") != -1) { - bodyType = "lod/" + bodyType; + var2 = Shape.getBodBase(var5.getURL()); + if (var5.getURL().toString().indexOf("lod/") != -1) { + var2 = "lod/" + var2; } } } - Shape shape = new Shape(); - Shape subshape = shape; - shape.setURL(URL.make("avatar:" + bodyType + partNum / 10 + partNum % 10 + ".bod")); - int clumpsUsed = 0; - Material lastMat = null; - int delay = 0; - int lastTime = 0; - String actName = null; - boolean haveAddedChange = false; - if (pos > 0) { - this.scanPos = pos + 1; + Shape var9 = new Shape(); + Object var10 = var9; + var9.setURL(URL.make("avatar:" + var2 + var4 / 10 + var4 % 10 + ".bod")); + int var11 = 0; + Material var12 = null; + int var13 = 0; + int var14 = 0; + Object var15 = null; + boolean var16 = false; + if (var3 > 0) { + this.scanPos = var3 + 1; while(true) { - char c = s.charAt(this.scanPos++); - int num; - if (c >= 'A' && c <= 'Z') { - if (c != 'G') { - if (c == 'S') { - char xScale = s.charAt(this.scanPos++); - char yScale = s.charAt(this.scanPos++); - char zScale = s.charAt(this.scanPos++); - if (xScale == 'Z' && yScale == 'Z' && zScale == 'Z') { + char var17 = var1.charAt(this.scanPos++); + int var21; + if (var17 >= 'A' && var17 <= 'Z') { + if (var17 != 'G') { + if (var17 == 'S') { + char var22 = var1.charAt(this.scanPos++); + char var19 = var1.charAt(this.scanPos++); + char var20 = var1.charAt(this.scanPos++); + if (var22 == 'Z' && var19 == 'Z' && var20 == 'Z') { this.runPrepFigure = false; } - ((Shape)subshape).scale(this.getScale(xScale), this.getScale(yScale), this.getScale(zScale)); - } else if (c != 'Q') { - if (c == 'C') { - assert false; - } else if (c == 'D') { - delay += (int)(1000.0 * (Math.pow(1.0932, (double)scanBase64(s.charAt(this.scanPos++))) - 0.8999999761581421)); - } else if (c == 'A') { - this.scanName(s); + ((Shape)var10).scale(this.getScale(var22), this.getScale(var19), this.getScale(var20)); + } else if (var17 != 'Q') { + if (var17 == 'C') { + throw new AssertionError(); + } else if (var17 == 'D') { + var13 += (int)(1000.0D * (Math.pow(1.0932D, (double)scanBase64(var1.charAt(this.scanPos++))) - 0.8999999761581421D)); + } else if (var17 == 'A') { + this.scanName(var1); this.animationList = null; } else { - if (c != 'T' && c != 'C') { + if (var17 != 'T' && var17 != 'C') { --this.scanPos; break; } @@ -416,175 +383,188 @@ } } } else { - num = this.scanInt(s); - if (num <= 0 || num > 99) { - num = partNum; + var21 = this.scanInt(var1); + if (var21 <= 0 || var21 > 99) { + var21 = var4; } - bodyType = this.scanName(s); - if (bodyType.equals("")) { + var2 = this.scanName(var1); + if (var2.equals("")) { break; } - ((Shape)subshape).setURL(URL.make("avatar:" + bodyType + num / 10 + num % 10 + ".bod")); + ((Shape)var10).setURL(URL.make("avatar:" + var2 + var21 / 10 + var21 % 10 + ".bod")); } - } else if (c >= 'a') { - Material m = this.getMat(c, mats); - if (m != null) { - if (delay == 0) { - delay = 50; + } else if (var17 >= 'a') { + Material var18 = this.getMat(var17, var6); + if (var18 != null) { + if (var13 == 0) { + var13 = 50; } - lastTime += delay; - if (lastMat != null) { - if (!haveAddedChange) { - haveAddedChange = true; - this.addChange(lastTime - delay, lastMat, (Shape)subshape); + var14 += var13; + if (var12 != null) { + if (!var16) { + var16 = true; + this.addChange(var14 - var13, var12, (Shape)var10); } - this.addChange(lastTime, m, (Shape)subshape); + this.addChange(var14, var18, (Shape)var10); } - if (m != origMat) { - ((Shape)subshape).setMaterial(m); + if (var18 != origMat) { + ((Shape)var10).setMaterial(var18); } - lastMat = m; - delay = 0; + var12 = var18; + var13 = 0; } } else { - if (c < '0' || c > '9') { + if (var17 < '0' || var17 > '9') { break; } --this.scanPos; - num = this.scanInt(s) - clumpsUsed; - ++clumpsUsed; - subshape = new SubclumpShape(); - ((Shape)subshape).setURL(URL.make("system:subclump" + num)); - shape.add((WObject)subshape); - lastMat = null; - haveAddedChange = false; - lastTime = 0; - delay = 0; + var21 = this.scanInt(var1) - var11; + ++var11; + var10 = new SubclumpShape(); + ((Shape)var10).setURL(URL.make("system:subclump" + var21)); + var9.add((WObject)var10); + var12 = null; + var16 = false; + var14 = 0; + var13 = 0; } - if (this.scanPos > end) { - this.scanPos = end; - return parent; + if (this.scanPos > var8) { + this.scanPos = var8; + return var5; } } } - if (bodyType.equals("")) { - return parent; + if (var2.equals("")) { + return var5; } else { - shape.addLoadListener(this); - if (ProgressiveAdder.get().enabled() && !loadNow) { - ProgressiveAdder.get().scheduleForAdd(parent, shape); + var9.addLoadListener(this); + if (ProgressiveAdder.get().enabled() && !var7) { + ProgressiveAdder.get().scheduleForAdd(var5, var9); } else { - parent.add(shape); + var5.add(var9); } if (this.subparts == null) { - this.subparts = shape; + this.subparts = var9; } - return shape; + return var9; } } - private void addChange(int when, Material mat, Shape s) { - TimedMatChange t = new TimedMatChange(); - t.when = when; - t.mat = mat; - t.limb = s; - mat.setKeepLoaded(true); - int i = 0; + private void addChange(int var1, Material var2, Shape var3) { + PosableShape.TimedMatChange var4 = new PosableShape.TimedMatChange(); + var4.when = var1; + var4.mat = var2; + var4.limb = var3; + var2.setKeepLoaded(true); + int var5 = 0; if (this.expressionChanges == null) { this.expressionChanges = new Vector(); this.expressionStart = Std.getRealTime(); this.nextChange = 0; } else { - for(i = this.expressionChanges.size(); i > 0; --i) { - TimedMatChange o = (TimedMatChange)this.expressionChanges.elementAt(i - 1); - if (when >= o.when) { + for(var5 = this.expressionChanges.size(); var5 > 0; --var5) { + PosableShape.TimedMatChange var6 = (PosableShape.TimedMatChange)this.expressionChanges.elementAt(var5 - 1); + if (var1 >= var6.when) { break; } } } - this.expressionChanges.insertElementAt(t, i); + this.expressionChanges.insertElementAt(var4, var5); } - public static Enumeration getComponentAvatars(URL pUrl) { - if (pUrl == null) { + public static Enumeration getComponentAvatars(URL var0) { + if (var0 == null) { return null; } else { - Vector v = new Vector(); - String urlString = pUrl.getAbsolute(); - if (urlString.startsWith("avatar:") && urlString.endsWith(".rwg")) { - String baseAv = urlString.substring(7, urlString.indexOf(46)); - v.addElement("avatar:" + baseAv + ".rwg"); - int pos = urlString.indexOf(46); - int len = urlString.length() - 4; + Vector var1 = new Vector(); + String var2 = var0.getAbsolute(); + if (var2.startsWith("avatar:") && var2.endsWith(".rwg")) { + String var3 = var2.substring(7, var2.indexOf(46)); + var1.addElement("avatar:" + var3 + ".rwg"); + int var4 = var2.indexOf(46); + int var5 = var2.length() - 4; while(true) { while(true) { - char c; + char var6; do { do { - if (pos >= len) { - return v.elements(); + if (var4 >= var5) { + return var1.elements(); } - c = urlString.charAt(pos++); - } while(c < 'A'); - } while(c > 'Z'); - - switch (c) { - case 'A': - case 'Q': - case 'T': - default: - break; - case 'C': - c = urlString.charAt(pos++); - if (c == '_') { - ++pos; - } else { - pos += 2; - } - break; - case 'D': - ++pos; - break; - case 'G': - while(pos < len) { - c = urlString.charAt(pos); - if (c < '0' || c > '9') { - break; - } - - ++pos; + var6 = var2.charAt(var4++); + } while(var6 < 'A'); + } while(var6 > 'Z'); + + switch(var6) { + case 'A': + case 'B': + case 'E': + case 'F': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'T': + default: + break; + case 'C': + var6 = var2.charAt(var4++); + if (var6 == '_') { + ++var4; + } else { + var4 += 2; + } + break; + case 'D': + ++var4; + break; + case 'G': + while(var4 < var5) { + var6 = var2.charAt(var4); + if (var6 < '0' || var6 > '9') { + break; } - String bodyType; - for(bodyType = ""; pos < len; ++pos) { - c = urlString.charAt(pos); - if (c >= '0' && c <= '9' || c < 'a' || c > 'z') { - break; - } + ++var4; + } - bodyType = bodyType + c; + String var7; + for(var7 = ""; var4 < var5; ++var4) { + var6 = var2.charAt(var4); + if (var6 >= '0' && var6 <= '9' || var6 < 'a' || var6 > 'z') { + break; } - if (bodyType != "" && bodyType.length() > 1) { - v.addElement("avatar:" + bodyType + ".rwg"); - } - break; - case 'S': - pos += 3; + var7 = var7 + var6; + } + + if (var7 != "" && var7.length() > 1) { + var1.addElement("avatar:" + var7 + ".rwg"); + } + break; + case 'S': + var4 += 3; } } } @@ -594,36 +574,48 @@ } } - public static int skipLimb(String s, int pos) { - int len = s.length() - 4; + public static int skipLimb(String var0, int var1) { + int var2 = var0.length() - 4; - while(pos < len) { - char c = s.charAt(pos++); - if (c >= 'A' && c <= 'Z') { - switch (c) { - case 'A': - case 'G': - case 'Q': - case 'T': - break; - case 'C': - c = s.charAt(pos++); - if (c == '_') { - ++pos; - } else { - pos += 2; - } - break; - case 'D': - ++pos; - break; - case 'S': - pos += 3; - break; - default: - return pos - 1; + while(var1 < var2) { + char var3 = var0.charAt(var1++); + if (var3 >= 'A' && var3 <= 'Z') { + switch(var3) { + case 'A': + case 'G': + case 'Q': + case 'T': + break; + case 'B': + case 'E': + case 'F': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'R': + default: + return var1 - 1; + case 'C': + var3 = var0.charAt(var1++); + if (var3 == '_') { + ++var1; + } else { + var1 += 2; + } + break; + case 'D': + ++var1; + break; + case 'S': + var1 += 3; } - } else if ((c < 'a' || c > 'z') && (c < '0' || c > '9')) { + } else if ((var3 < 'a' || var3 > 'z') && (var3 < '0' || var3 > '9')) { break; } } @@ -631,82 +623,82 @@ return -1; } - private String findStarts(String s, int end, int[] offs, String bodyType, Vector mats) { - String lastTextureName = bodyType; + private String findStarts(String var1, int var2, int[] var3, String var4, Vector var5) { + String var6 = var4; label84: - while(this.scanPos < end) { - char section = s.charAt(this.scanPos); - if (section >= 'A' && section <= 'Z') { - offs[section - 65] = this.scanPos++; + while(this.scanPos < var2) { + char var7 = var1.charAt(this.scanPos); + if (var7 >= 'A' && var7 <= 'Z') { + var3[var7 - 65] = this.scanPos++; - char c; + char var8; do { do { while(true) { - if (this.scanPos >= end) { + if (this.scanPos >= var2) { continue label84; } - c = s.charAt(this.scanPos++); - if (c < 'A' || c > 'Z') { + var8 = var1.charAt(this.scanPos++); + if (var8 < 'A' || var8 > 'Z') { break; } - if (c == 'G') { - this.scanInt(s); - this.scanName(s); - } else if (c == 'S') { + if (var8 == 'G') { + this.scanInt(var1); + this.scanName(var1); + } else if (var8 == 'S') { this.scanPos += 3; - } else if (c != 'Q') { - if (c != 'C' && c != 'T') { - if (c == 'D') { + } else if (var8 != 'Q') { + if (var8 != 'C' && var8 != 'T') { + if (var8 == 'D') { ++this.scanPos; } else { - if (c != 'A') { + if (var8 != 'A') { --this.scanPos; continue label84; } - this.scanName(s); + this.scanName(var1); } } else { - int start = this.scanPos - 1; - char letter = (char)(97 + mats.size()); - Material mat; - int num; - if (c == 'C') { - mat = this.scanColor(s); + int var9 = this.scanPos - 1; + char var10 = (char)(97 + var5.size()); + Material var11; + int var12; + if (var8 == 'C') { + var11 = this.scanColor(var1); } else { - num = this.scanInt(s); - String name = this.scanName(s); - if (name.equals("")) { - name = lastTextureName; + var12 = this.scanInt(var1); + String var13 = this.scanName(var1); + if (var13.equals("")) { + var13 = var6; } else { - lastTextureName = name; + var6 = var13; } - mat = scanTexture(name, num); + var11 = scanTexture(var13, var12); } - mats.addElement(mat); - s = s.substring(0, start) + 'Q' + letter + s.substring(this.scanPos); - num = this.scanPos - start - 2; - this.scanPos -= num; - end -= num; + var5.addElement(var11); + var1 = var1.substring(0, var9) + 'Q' + var10 + var1.substring(this.scanPos); + var12 = this.scanPos - var9 - 2; + this.scanPos -= var12; + var2 -= var12; } } } - } while(c >= '0' && c <= '9'); - } while(c >= 'a' && c <= 'z'); + } while(var8 >= '0' && var8 <= '9'); + } while(var8 >= 'a' && var8 <= 'z'); - return s.substring(0, this.scanPos - 1) + ".rwg"; + return var1.substring(0, this.scanPos - 1) + ".rwg"; } - return s; + return var1; } - return s; + return var1; } public static Vector getPermittedNames() { @@ -720,55 +712,55 @@ public static void downloadPermittedNames() { if (!gotServerAvatarList) { serverAvatarListError = false; - WorldServer w = Pilot.getActive().getServer(); - if (w != null && w.getGalaxy() != null) { - String avatarList = Console.getActive().getScriptServer() + "getavlist.pl?u=" + w.getGalaxy().getChatname(); - if (w.getGalaxy().getSerialNum() != null) { - avatarList = avatarList + "&s=" + w.getGalaxy().getSerialNum(); + WorldServer var0 = Pilot.getActive().getServer(); + if (var0 != null && var0.getGalaxy() != null) { + String var1 = Console.getActive().getScriptServer() + "getavlist.pl?u=" + var0.getGalaxy().getChatname(); + if (var0.getGalaxy().getSerialNum() != null) { + var1 = var1 + "&s=" + var0.getGalaxy().getSerialNum(); } - URL avatarListURL = URL.make(avatarList); - CacheFile cf = Cache.getFile(avatarListURL, true); - cf.waitUntilLoaded(); - if (!cf.error()) { + URL var2 = URL.make(var1); + CacheFile var3 = Cache.getFile(var2, true); + var3.waitUntilLoaded(); + if (!var3.error()) { permittedNames.removeAllElements(); humanHash.clear(); worldHash.clear(); try { - RandomAccessFile f = new RandomAccessFile(cf.getLocalName(), "r"); + RandomAccessFile var4 = new RandomAccessFile(var3.getLocalName(), "r"); label64: while(true) { - StringTokenizer st; + StringTokenizer var6; do { - String line; + String var5; do { - if (f.getFilePointer() >= f.length()) { - f.close(); + if (var4.getFilePointer() >= var4.length()) { + var4.close(); break label64; } - line = f.readLine(); - } while(line.startsWith("//")); + var5 = var4.readLine(); + } while(var5.startsWith("//")); - st = new StringTokenizer(line); - } while(st.countTokens() <= 2); + var6 = new StringTokenizer(var5); + } while(var6.countTokens() <= 2); - String name = st.nextToken(); - permittedNames.addElement(name); - String gender = st.nextToken(); - if (gender.equals("m") || gender.equals("f")) { - humanHash.put(name, gender); + String var7 = var6.nextToken(); + permittedNames.addElement(var7); + String var8 = var6.nextToken(); + if (var8.equals("m") || var8.equals("f")) { + humanHash.put(var7, var8); } - Vector worldList = new Vector(); + Vector var9 = new Vector(); - while(st.hasMoreTokens()) { - worldList.addElement(st.nextToken()); + while(var6.hasMoreTokens()) { + var9.addElement(var6.nextToken()); } - worldHash.put(name, worldList); + worldHash.put(var7, var9); } } catch (Exception var10) { System.out.println("Error parsing avatar list: " + var10.toString()); @@ -777,14 +769,14 @@ } gotServerAvatarList = true; - Console c = Console.getActive(); - if (c instanceof DefaultConsole) { - DefaultConsole dc = (DefaultConsole)c; - dc.getAvatarMenu().rebuildVIPMenu(); + Console var11 = Console.getActive(); + if (var11 instanceof DefaultConsole) { + DefaultConsole var12 = (DefaultConsole)var11; + var12.getAvatarMenu().rebuildVIPMenu(); } - if (c.getPilot() != null) { - c.getPilot().resetAvatarNow(); + if (var11.getPilot() != null) { + var11.getPilot().resetAvatarNow(); } AvMenu.rebuildHeadList(); @@ -796,61 +788,66 @@ } } - public static URL getPermitted(URL in, World world) { - if (in.endsWith(".mov")) { - return in; + public static URL getPermitted(URL var0, World var1) { + if (var0.endsWith(".mov")) { + return var0; } else if (NetUpdate.isInternalVersion()) { - return in; - } else if (!gotServerAvatarList && !serverAvatarListError) { - return in; - } else if (serverAvatarListError) { - return validateAvatar(in.getAbsolute()) ? in : getDefAv(); + return var0; } else { - Enumeration e = getComponentAvatars(in); - - while(e != null && e.hasMoreElements()) { - String baseAv = (String)e.nextElement(); - String s = getBodyType(URL.make(baseAv)); - if (s == null) { - return getDefAv(); - } - - Vector allowedWorlds = (Vector)worldHash.get(s); - if (allowedWorlds == null) { - return getDefAv(); - } - - boolean worldOK = false; - Enumeration we = allowedWorlds.elements(); + boolean var2 = IniFile.override().getIniString("ProductName", "").equalsIgnoreCase("RedLightWorld"); + if (var2) { + return var0; + } else if (!gotServerAvatarList && !serverAvatarListError) { + return var0; + } else if (serverAvatarListError) { + return validateAvatar(var0.getAbsolute()) ? var0 : getDefAv(); + } else { + Enumeration var3 = getComponentAvatars(var0); - while(we.hasMoreElements()) { - String thisWorld = (String)we.nextElement(); - if (thisWorld == null) { + while(var3 != null && var3.hasMoreElements()) { + String var4 = (String)var3.nextElement(); + String var5 = getBodyType(URL.make(var4)); + if (var5 == null) { return getDefAv(); } - if (thisWorld.equals("all")) { - worldOK = true; - break; + Vector var6 = (Vector)worldHash.get(var5); + if (var6 == null) { + return getDefAv(); } - thisWorld = thisWorld.replace('_', ' ').toLowerCase().trim(); - if (world != null) { - if (thisWorld.equals(world.toString().toLowerCase().trim())) { - worldOK = true; + boolean var7 = false; + Enumeration var8 = var6.elements(); + + while(var8.hasMoreElements()) { + String var9 = (String)var8.nextElement(); + if (var9 == null) { + return getDefAv(); + } + + if (var9.equals("all")) { + var7 = true; break; } - } else { - worldOK = true; + + var9 = var9.replace('_', ' ').toLowerCase().trim(); + if (var1 != null) { + if (var9.equals(var1.toString().toLowerCase().trim())) { + var7 = true; + break; + } + } else { + var7 = true; + } } - } - if (!worldOK) { - return getDefAv(); + if (!var7) { + return getDefAv(); + } } - } - return in; + return var0; + } } } @@ -858,44 +855,44 @@ return faceNames; } - public static URL getAvURL(String bodyType) { - Object newName = permittedHash.get(bodyType); - return newName instanceof String ? URL.make("avatar:" + (String)newName) : null; + public static URL getAvURL(String var0) { + Object var1 = permittedHash.get(var0); + return var1 instanceof String ? URL.make("avatar:" + (String)var1) : null; } - public static boolean validateAvatar(String av) { - System.out.println("Validating " + av); - String baseAv = getBodyType(URL.make(av)); - if (baseAv == null) { + public static boolean validateAvatar(String var0) { + System.out.println("Validating " + var0); + String var1 = getBodyType(URL.make(var0)); + if (var1 == null) { return false; } else { - return permittedHash.get(baseAv) != null; + return permittedHash.get(var1) != null; } } - public static String convertLODToParent(String bodyType) { - String result = bodyType; - if (bodyType.startsWith("lod/")) { - result = bodyType.substring(4, bodyType.length() - 1); + public static String convertLODToParent(String var0) { + String var1 = var0; + if (var0.startsWith("lod/")) { + var1 = var0.substring(4, var0.length() - 1); } - return result; + return var1; } - public static String getBodyType(URL url) { - if (url == null) { + public static String getBodyType(URL var0) { + if (var0 == null) { return null; } else { - String str = url.getAbsolute(); - if (str.startsWith("avatar:") && (str.endsWith(".rwg") || str.endsWith(".RWG")) && str.charAt(7) != '.') { - int pos = str.indexOf(".", 7); - String bodyType = str.substring(7, pos).toLowerCase(); - bodyType = convertLODToParent(bodyType); - if (str.charAt(pos + 1) != '0') { - bodyType = getBodyType(bodyType); + String var1 = var0.getAbsolute(); + if (var1.startsWith("avatar:") && (var1.endsWith(".rwg") || var1.endsWith(".RWG")) && var1.charAt(7) != '.') { + int var2 = var1.indexOf(".", 7); + String var3 = var1.substring(7, var2).toLowerCase(); + var3 = convertLODToParent(var3); + if (var1.charAt(var2 + 1) != '0') { + var3 = getBodyType(var3); } - return bodyType; + return var3; } else { return null; } @@ -906,56 +903,56 @@ return URL.make(IniFile.override().getIniString("DefaultArticAv", "avatar:willy.rwg")); } - public static URL getHuman(URL url) { - if (url.endsWith(".mov")) { - return HoloDrone.getHuman(url); + public static URL getHuman(URL var0) { + if (var0.endsWith(".mov")) { + return HoloDrone.getHuman(var0); } else { - String s = getBodyType(url); - if (s == null) { + String var1 = getBodyType(var0); + if (var1 == null) { return getDefAv(); } else { - String gender = (String)humanHash.get(s); - if (gender == null) { + String var2 = (String)humanHash.get(var1); + if (var2 == null) { return getDefAv(); } else { - URL def = URL.make("avatar:" + s + ".rwg"); - String str = url.getAbsolute(); - int pos = str.indexOf(".0EC_"); - if (pos >= 0 && str.length() >= pos + 7 && "_AC".indexOf(str.charAt(pos + 5)) >= 0) { - if (gender.equals("m") && str.indexOf("yank") >= 0 && (!str.regionMatches(pos + 6, "TyankshirtC_", 0, 12) || !str.regionMatches(pos + 19, "C-2bTyankstripe", 0, 15))) { - return def; + URL var3 = URL.make("avatar:" + var1 + ".rwg"); + String var4 = var0.getAbsolute(); + int var5 = var4.indexOf(".0EC_"); + if (var5 >= 0 && var4.length() >= var5 + 7 && "_AC".indexOf(var4.charAt(var5 + 5)) >= 0) { + if (var2.equals("m") && var4.indexOf("yank") >= 0 && (!var4.regionMatches(var5 + 6, "TyankshirtC_", 0, 12) || !var4.regionMatches(var5 + 19, "C-2bTyankstripe", 0, 15))) { + return var3; } else { - pos = str.lastIndexOf("HDgT2"); - if (pos >= 0 && str.length() >= pos + 7) { - String faceGender = (String)humanHash.get(readName(str, pos + 5)); - if (faceGender != null && faceGender.equals(gender)) { - pos = str.lastIndexOf("NS"); - if (pos >= 0 && str.length() >= pos + 3 && "0abcdABCD".indexOf(str.charAt(pos + 2)) >= 0) { - pos += 5; - if (str.length() < pos + 2) { - return def; + var5 = var4.lastIndexOf("HDgT2"); + if (var5 >= 0 && var4.length() >= var5 + 7) { + String var6 = (String)humanHash.get(readName(var4, var5 + 5)); + if (var6 != null && var6.equals(var2)) { + var5 = var4.lastIndexOf("NS"); + if (var5 >= 0 && var4.length() >= var5 + 3 && "0abcdABCD".indexOf(var4.charAt(var5 + 2)) >= 0) { + var5 += 5; + if (var4.length() < var5 + 2) { + return var3; } else { - if (str.charAt(pos) == 'G') { - String headGender = (String)humanHash.get(readName(str, pos + 1)); - if (headGender == null || !headGender.equals(gender)) { - return def; + if (var4.charAt(var5) == 'G') { + String var7 = (String)humanHash.get(readName(var4, var5 + 1)); + if (var7 == null || !var7.equals(var2)) { + return var3; } } - return url; + return var0; } } else { - return def; + return var3; } } else { - return def; + return var3; } } else { - return def; + return var3; } } } else { - return def; + return var3; } } } @@ -966,118 +963,118 @@ return getHuman(this.getURL()); } - public static String getBodyType(String basename) { - String str = (String)permittedHash.get(basename); - if (str != null) { - basename = str.substring(0, str.indexOf(".")); + public static String getBodyType(String var0) { + String var1 = (String)permittedHash.get(var0); + if (var1 != null) { + var0 = var1.substring(0, var1.indexOf(".")); } - return basename; + return var0; } - public static int getMatPosition(String str, char type) { - int index = "abcdef".indexOf(type); - int p; - if (index >= 0) { - p = str.indexOf(".0E"); - if (p >= 0) { - p += 3; + public static int getMatPosition(String var0, char var1) { + int var2 = "abcdef".indexOf(var1); + int var3; + if (var2 >= 0) { + var3 = var0.indexOf(".0E"); + if (var3 >= 0) { + var3 += 3; - for(int i = 0; i < index; ++i) { - p = skipMat(str, p); + for(int var4 = 0; var4 < var2; ++var4) { + var3 = skipMat(var0, var3); } } - return p; + return var3; } else { - p = str.indexOf(".0E"); - if (p >= 0) { - for(p += 2; p >= 0; p = skipLimb(str, p)) { - if (str.charAt(p++) == type) { - return p; + var3 = var0.indexOf(".0E"); + if (var3 >= 0) { + for(var3 += 2; var3 >= 0; var3 = skipLimb(var0, var3)) { + if (var0.charAt(var3++) == var1) { + return var3; } } } - return p; + return var3; } } public static String getCurrentAvCustomizable() { - URL av = Pilot.getActive().getSourceURL(); - String str = av.getAbsolute(); - if (str.startsWith("avatar:") && (str.endsWith(".rwg") || str.endsWith(".RWG")) && str.charAt(7) != '.') { - int pos = str.indexOf(".", 7); - if (!str.regionMatches(pos, ".0E", 0, 3)) { - av = getAvURL(str.substring(7, pos).toLowerCase()); - if (av == null) { - if (!str.substring(pos).equalsIgnoreCase(".rwg")) { + URL var0 = Pilot.getActive().getSourceURL(); + String var1 = var0.getAbsolute(); + if (var1.startsWith("avatar:") && (var1.endsWith(".rwg") || var1.endsWith(".RWG")) && var1.charAt(7) != '.') { + int var2 = var1.indexOf(".", 7); + if (!var1.regionMatches(var2, ".0E", 0, 3)) { + var0 = getAvURL(var1.substring(7, var2).toLowerCase()); + if (var0 == null) { + if (!var1.substring(var2).equalsIgnoreCase(".rwg")) { Console.println(Console.message("cant-cust-av")); return null; } - str = "avatar:" + str.substring(7, pos) + ".0EC__C__C__C__C__C__" + "PeBbLcMcOaRcUcVaWeXeYIeJeK" + "NS000QaHDgT2tonyT3T2T1Q0f.rwg"; + var1 = "avatar:" + var1.substring(7, var2) + ".0EC__C__C__C__C__C__" + "PeBbLcMcOaRcUcVaWeXeYIeJeK" + "NS000QaHDgT2tonyT3T2T1Q0f.rwg"; } else { - str = av.getAbsolute(); + var1 = var0.getAbsolute(); } } - return str; + return var1; } else { Console.println(Console.message("non-cust-av")); return null; } } - public static int skipMat(String s, int i) { - char c = s.charAt(i); - int matEnd = i; - if (c == 'C') { - c = s.charAt(i + 1); - if (c == '_') { - matEnd = i + 3; + public static int skipMat(String var0, int var1) { + char var2 = var0.charAt(var1); + int var3 = var1; + if (var2 == 'C') { + var2 = var0.charAt(var1 + 1); + if (var2 == '_') { + var3 = var1 + 3; } else { - matEnd = i + 4; + var3 = var1 + 4; } - } else if (c == 'T') { - for(matEnd = i + 1; (c = s.charAt(matEnd)) >= '0' && c <= '9'; ++matEnd) { + } else if (var2 == 'T') { + for(var3 = var1 + 1; (var2 = var0.charAt(var3)) >= '0' && var2 <= '9'; ++var3) { } - while((c = s.charAt(matEnd)) >= 'a' && c <= 'z') { - ++matEnd; + while((var2 = var0.charAt(var3)) >= 'a' && var2 <= 'z') { + ++var3; } - } else if (c >= 'a' && c <= 'z') { - matEnd = i + 1; + } else if (var2 >= 'a' && var2 <= 'z') { + var3 = var1 + 1; } - return matEnd; + return var3; } - public static String getFace(String bodyType) { - Object face = faceTextures.get(bodyType); - return face != null ? (String)face : "1" + bodyType; + public static String getFace(String var0) { + Object var1 = faceTextures.get(var0); + return var1 != null ? (String)var1 : "1" + var0; } - private void createSubparts(URL url) throws MalformedURLException { - String str = url.getAbsolute(); - int len = str.length(); - String bodyType = null; + private void createSubparts(URL var1) throws MalformedURLException { + String var2 = var1.getAbsolute(); + int var3 = var2.length(); + String var4 = null; this.runPrepFigure = this.setPrepFigure; - if (str.startsWith("avatar:") && (str.endsWith(".rwg") || str.endsWith(".RWG")) && str.charAt(7) != '.') { - this.scanPos = str.indexOf(".", 7); - bodyType = str.substring(7, this.scanPos).toLowerCase(); - if (str.charAt(this.scanPos + 1) != '0') { - this.scanPos = len - 4; - Object newName = permittedHash.get(bodyType); - if (newName != null) { - str = (String)newName; + if (var2.startsWith("avatar:") && (var2.endsWith(".rwg") || var2.endsWith(".RWG")) && var2.charAt(7) != '.') { + this.scanPos = var2.indexOf(".", 7); + var4 = var2.substring(7, this.scanPos).toLowerCase(); + if (var2.charAt(this.scanPos + 1) != '0') { + this.scanPos = var3 - 4; + Object var5 = permittedHash.get(var4); + if (var5 != null) { + var2 = (String)var5; this.scanPos = 0; - bodyType = this.scanName(str); - if (str.charAt(this.scanPos) != '.') { + var4 = this.scanName(var2); + if (var2.charAt(this.scanPos) != '.') { throw new MalformedURLException(); } - if (str.charAt(this.scanPos + 1) != '0') { + if (var2.charAt(this.scanPos + 1) != '0') { throw new MalformedURLException(); } @@ -1088,33 +1085,33 @@ } } else { this.scanPos = 0; - str = ".rwg"; - bodyType = "aura"; + var2 = ".rwg"; + var4 = "aura"; } - Vector mats = new Vector(); - int[] offsets = new int[26]; - str = this.findStarts(str, str.length() - 4, offsets, bodyType, mats); + Vector var24 = new Vector(); + int[] var6 = new int[26]; + var2 = this.findStarts(var2, var2.length() - 4, var6, var4, var24); if (this.subparts != null) { throw new MalformedURLException(); } else { - Shape groi = this.getLimb(str, bodyType, offsets[15], 1, this, mats, true); - Shape back = this.getLimb(str, (String)null, offsets[1], 2, groi, mats, false); - Shape neck = this.getLimb(str, (String)null, offsets[13], 3, back, mats, false); - this.getLimb(str, (String)null, offsets[7], 4, neck, mats, false); - Shape lupa = this.getLimb(str, (String)null, offsets[11], 11, back, mats, false); - Shape lfor = this.getLimb(str, (String)null, offsets[12], 12, lupa, mats, false); - this.getLimb(str, (String)null, offsets[14], 13, lfor, mats, false); - Shape rupa = this.getLimb(str, (String)null, offsets[17], 6, back, mats, false); - Shape rfor = this.getLimb(str, (String)null, offsets[20], 7, rupa, mats, false); - this.getLimb(str, (String)null, offsets[21], 8, rfor, mats, false); - Shape lthi = this.getLimb(str, (String)null, offsets[8], 19, groi, mats, false); - Shape lcal = this.getLimb(str, (String)null, offsets[9], 20, lthi, mats, false); - this.getLimb(str, (String)null, offsets[10], 21, lcal, mats, false); - Shape rthi = this.getLimb(str, (String)null, offsets[22], 15, groi, mats, false); - Shape rcal = this.getLimb(str, (String)null, offsets[23], 16, rthi, mats, false); - this.getLimb(str, (String)null, offsets[24], 17, rcal, mats, false); - this.getLimb(str, (String)null, offsets[25], 24, groi, mats, false); + Shape var7 = this.getLimb(var2, var4, var6[15], 1, this, var24, true); + Shape var8 = this.getLimb(var2, (String)null, var6[1], 2, var7, var24, false); + Shape var9 = this.getLimb(var2, (String)null, var6[13], 3, var8, var24, false); + this.getLimb(var2, (String)null, var6[7], 4, var9, var24, false); + Shape var11 = this.getLimb(var2, (String)null, var6[11], 11, var8, var24, false); + Shape var12 = this.getLimb(var2, (String)null, var6[12], 12, var11, var24, false); + this.getLimb(var2, (String)null, var6[14], 13, var12, var24, false); + Shape var14 = this.getLimb(var2, (String)null, var6[17], 6, var8, var24, false); + Shape var15 = this.getLimb(var2, (String)null, var6[20], 7, var14, var24, false); + this.getLimb(var2, (String)null, var6[21], 8, var15, var24, false); + Shape var17 = this.getLimb(var2, (String)null, var6[8], 19, var7, var24, false); + Shape var18 = this.getLimb(var2, (String)null, var6[9], 20, var17, var24, false); + this.getLimb(var2, (String)null, var6[10], 21, var18, var24, false); + Shape var20 = this.getLimb(var2, (String)null, var6[22], 15, var7, var24, false); + Shape var21 = this.getLimb(var2, (String)null, var6[23], 16, var20, var24, false); + this.getLimb(var2, (String)null, var6[24], 17, var21, var24, false); + this.getLimb(var2, (String)null, var6[25], 24, var7, var24, false); } } @@ -1127,16 +1124,16 @@ } - public void prerender(Camera cam) { + public void prerender(Camera var1) { if (this.getVisible()) { - Point3Temp p = this.inCamSpace(cam); - boolean v = p != null && p.z > 1.0F && p.x < p.z && -p.x < p.z; - if (v) { - if (this.closestView > p.z) { - this.closestView = p.z; + Point3Temp var2 = this.inCamSpace(var1); + boolean var3 = var2 != null && var2.z > 1.0F && var2.x < var2.z && -var2.x < var2.z; + if (var3) { + if (this.closestView > var2.z) { + this.closestView = var2.z; } - if (p.z > 700.0F && ++this.farViewCount > 10) { + if (var2.z > 700.0F && ++this.farViewCount > 10) { if (this.closestView > 400.0F) { this.closestView = 400.0F; } @@ -1148,65 +1145,65 @@ } } - public float animate(String action) { + public float animate(String var1) { if (this.animator == null) { return 0.0F; } else { - if (action.length() == 1) { - char lower = action.toLowerCase().charAt(0); - char upper = action.toUpperCase().charAt(0); - Vector al = this.getAnimationList(); - int len = al.size(); - - for(int i = 0; i < len; ++i) { - String[] actionAliases = ServerTableManager.instance().getTable("actionAliases"); - String displayName = (String)al.elementAt(i); - if (actionAliases != null) { - for(int j = 0; j < actionAliases.length; j += 2) { - if (displayName.toLowerCase().equals(actionAliases[j].toLowerCase())) { - displayName = actionAliases[j + 1]; + if (var1.length() == 1) { + char var2 = var1.toLowerCase().charAt(0); + char var3 = var1.toUpperCase().charAt(0); + Vector var4 = this.getAnimationList(); + int var5 = var4.size(); + + for(int var6 = 0; var6 < var5; ++var6) { + String[] var7 = ServerTableManager.instance().getTable("actionAliases"); + String var8 = (String)var4.elementAt(var6); + if (var7 != null) { + for(int var9 = 0; var9 < var7.length; var9 += 2) { + if (var8.toLowerCase().equals(var7[var9].toLowerCase())) { + var8 = var7[var9 + 1]; break; } } } - char c = displayName.charAt(0); - if (c == lower || c == upper) { - action = (String)al.elementAt(i); + char var10 = var8.charAt(0); + if (var10 == var2 || var10 == var3) { + var1 = (String)var4.elementAt(var6); break; } } } - return this.performAnimationSequence(action); + return this.performAnimationSequence(var1); } } public void timerDone() { if (this.animations.hasMoreElements()) { - String nextAnim = (String)this.animations.nextElement(); - float time = this.animator.getAnimationTime(this.figureType, nextAnim); - this.animator.animate(this.figureType, nextAnim, Std.getRealTime()); - Timer tm = new Timer(time, this); - tm.start(); + String var1 = (String)this.animations.nextElement(); + float var2 = this.animator.getAnimationTime(this.figureType, var1); + this.animator.animate(this.figureType, var1, Std.getRealTime()); + Timer var3 = new Timer(var2, this); + var3.start(); } } - private float performAnimationSequence(String action) { - float totalTime = 0.0F; - Vector vanimations = new Vector(); - StringTokenizer tok = new StringTokenizer(action, "&\t\n\r"); + private float performAnimationSequence(String var1) { + float var2 = 0.0F; + Vector var3 = new Vector(); + StringTokenizer var4 = new StringTokenizer(var1, "&\t\n\r"); - while(tok.hasMoreTokens()) { - String subAction = tok.nextToken(); - totalTime += this.animator.getAnimationTime(this.figureType, subAction); - vanimations.addElement(subAction); + while(var4.hasMoreTokens()) { + String var5 = var4.nextToken(); + var2 += this.animator.getAnimationTime(this.figureType, var5); + var3.addElement(var5); } - this.animations = vanimations.elements(); + this.animations = var3.elements(); this.timerDone(); - return totalTime; + return var2; } public Vector getAnimationList() { @@ -1218,18 +1215,19 @@ } } - public void enableLOD(boolean flag) { - this.doLOD = flag; + public void enableLOD(boolean var1) { + this.doLOD = var1; } - public boolean handle(MouseDownEvent e) { + public boolean handle(MouseDownEvent var1) { return false; } - public boolean handle(FrameEvent fe) { - float dist = this.closestView; + public boolean handle(FrameEvent var1) { + float var2 = this.closestView; this.closestView = 10000.0F; - if (this.animator != null && !(dist > 900.0F) && this.hasClump()) { + float distance = IniFile.gamma().getIniInt("AnimationQualityDistance", 900); + if (this.animator != null && var2 <= distance && this.hasClump()) { if (this.recomputeHeight) { if (this.runPrepFigure) { DroneAnimator.prepFigure(this, this.COG); @@ -1238,30 +1236,30 @@ this.recomputeHeight = false; } - if (this.doLOD && this.setLOD(dist)) { + if (this.doLOD && this.setLOD(var2)) { return true; } else { - int time = Std.getRealTime(); - Transform t = this.getObjectToWorldMatrix(); - this.animator.moveto(this.figureType, (short)((int)t.getX()), (short)((int)t.getY()), (short)((int)t.getZ()), (short)((int)(-t.getYaw())), time - 1); - this.animator.update((WObject)null, this, time, t.getScaleX(), dist > 700.0F); - t.recycle(); + int var3 = Std.getRealTime(); + Transform var4 = this.getObjectToWorldMatrix(); + this.animator.moveto(this.figureType, (short)((int)var4.getX()), (short)((int)var4.getY()), (short)((int)var4.getZ()), (short)((int)(-var4.getYaw())), var3 - 1); + this.animator.update((WObject)null, this, var3, var4.getScaleX(), var2 > 700.0F); + var4.recycle(); if (this.expressionStart > 0) { - time -= this.expressionStart; + var3 -= this.expressionStart; while(true) { - TimedMatChange t = (TimedMatChange)this.expressionChanges.elementAt(this.nextChange); - if (time < t.when) { + PosableShape.TimedMatChange var5 = (PosableShape.TimedMatChange)this.expressionChanges.elementAt(this.nextChange); + if (var3 < var5.when) { break; } - if (t.mat != origMat) { - t.limb.setMaterial(t.mat); + if (var5.mat != origMat) { + var5.limb.setMaterial(var5.mat); } if (++this.nextChange >= this.expressionChanges.size()) { this.nextChange = 0; - this.expressionStart += time; + this.expressionStart += var3; break; } } @@ -1274,50 +1272,50 @@ } } - 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 = BooleanPropertyEditor.make(new Property(this, index, "Center of Gravity"), "No", "Yes"); - } else if (mode == 1) { - ret = new Boolean(this.COG); - } else if (mode == 2) { - this.COG = (Boolean)value; - URL u = this.getURL(); - this.setURL(defaultURL); - this.setURL(u); - } - break; - default: - ret = super.properties(index, offset + 1, mode, value); - } - - return ret; - } - - public void saveState(Saver s) throws IOException { - s.saveVersion(1, classCookie); - s.saveBoolean(this.COG); + public Object properties(int var1, int var2, int var3, Object var4) throws NoSuchPropertyException { + Object var5 = null; + switch(var1 - var2) { + case 0: + if (var3 == 0) { + var5 = BooleanPropertyEditor.make(new Property(this, var1, "Center of Gravity"), "No", "Yes"); + } else if (var3 == 1) { + var5 = new Boolean(this.COG); + } else if (var3 == 2) { + this.COG = ((Boolean)var4).booleanValue(); + URL var6 = this.getURL(); + this.setURL(defaultURL); + this.setURL(var6); + } + break; + default: + var5 = super.properties(var1, var2 + 1, var3, var4); + } + + return var5; + } + + public void saveState(Saver var1) throws IOException { + var1.saveVersion(1, classCookie); + var1.saveBoolean(this.COG); if (this.subparts != null) { this.subparts.detach(); - super.saveState(s); + super.saveState(var1); this.add(this.subparts); } else { - super.saveState(s); + super.saveState(var1); } } - public void restoreState(Restorer r) throws IOException, TooNewException { - switch (r.restoreVersion(classCookie)) { - case 1: - this.COG = r.restoreBoolean(); - case 0: - super.restoreState(r); - return; - default: - throw new TooNewException(); + public void restoreState(Restorer var1) throws IOException, TooNewException { + switch(var1.restoreVersion(classCookie)) { + case 1: + this.COG = var1.restoreBoolean(); + case 0: + super.restoreState(var1); + return; + default: + throw new TooNewException(); } } @@ -1325,6 +1323,40 @@ return this.getName(); } + static { + int var0; + if (!NetUpdate.isInternalVersion()) { + for(var0 = 0; var0 < secretList.length; ++var0) { + secretNames.put(secretList[var0], secretList[var0]); + } + } + + for(var0 = 0; var0 < permittedList.length; var0 += 2) { + if (secretNames.get(permittedList[var0]) == null) { + permittedNames.addElement(permittedList[var0]); + if (permittedList[var0 + 1].indexOf("DgT") >= 0) { + faceNames.addElement(permittedList[var0]); + } + } + + if (permittedList[var0 + 1] != null) { + permittedHash.put(permittedList[var0], permittedList[var0 + 1]); + } + } + + for(var0 = 1; var0 < humanList.length; var0 += 2) { + humanHash.put(humanList[var0 - 1], humanList[var0]); + } + + for(var0 = 0; var0 < faceList.length; var0 += 2) { + faceTextures.put(faceList[var0], faceList[var0 + 1]); + } + + gotServerAvatarList = false; + serverAvatarListError = false; + classCookie = new Object(); + } + class TimedMatChange { Shape limb; Material mat; diff -ruN a/1920/NET/worlds/scape/SelectAvatarAction.java b/1920/NET/worlds/scape/SelectAvatarAction.java --- a/1920/NET/worlds/scape/SelectAvatarAction.java 2024-01-08 01:46:36.000000000 -0600 +++ b/1920/NET/worlds/scape/SelectAvatarAction.java 2023-08-21 23:27:17.000000000 -0500 @@ -1,3 +1,8 @@ +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by Fernflower decompiler) +// + package NET.worlds.scape; import NET.worlds.console.Console; @@ -8,138 +13,141 @@ import java.io.IOException; public class SelectAvatarAction extends DialogAction { - URL url = null; - String description; - static String[] avatarAliases = ServerTableManager.instance().getTable("avatarAliases"); - private static Object classCookie = new Object(); - - private URL getURLVal() { - URL val = this.url; - if (val == null) { - SuperRoot o = this.getOwner(); - if (o instanceof Drone) { - val = ((Drone)o).getSourceURL(); - } else if (o instanceof PosableShape) { - val = ((Shape)o).getURL(); - } else if (o instanceof Hologram) { - val = ((Hologram)o).getMovieName(); - } - } - - return val; - } - - public void doIt() { - Console console = Console.getActive(); - URL val = this.getURLVal(); - if (console != null && val != null) { - console.setAvatar(val); - } - - } - - public PolledDialog getDialog() { - URL val = this.getURLVal(); - if (!Console.getActive().getVIP() && val.getInternal().toLowerCase().endsWith(".rwg")) { - return new OkCancelDialog(Console.getFrame(), this, Console.message("Cant-change-AV"), Console.message("OK"), (String)null, Console.message("Only-VIPs-change"), false); - } else { - String desc = this.description; - if (desc == null || desc.length() == 0) { - desc = getPrettyAvatarName(val.getBase()); - } - - return new ChangeAvatarDialog(Console.getFrame(), this, desc); - } - } - - public static String getPrettyAvatarName(String name) { - int extIndex = name.indexOf(46); - if (extIndex >= 0) { - name = name.substring(0, extIndex).toLowerCase(); - } else { - name = name.toLowerCase(); - } - - for(int i = 0; i < avatarAliases.length; i += 2) { - if (avatarAliases[i].equals(name)) { - return avatarAliases[i + 1]; - } - } - - String properName = name.substring(0, 1).toUpperCase(); - if (name.length() > 1) { - properName = properName + name.substring(1); - } - - return properName; - } - - public Persister trigger(Event e, Persister seqID) { - URL val = this.getURLVal(); - return val == null ? null : super.trigger(e, seqID); - } - - 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, "Avatar URL")).allowSetNull(), "pilot;drone;rwx;rwg;mov"); - } else if (mode == 1) { - ret = this.url; - } else if (mode == 2) { - this.url = (URL)value; + URL url = null; + String description; + static String[] avatarAliases = ServerTableManager.instance().getTable("avatarAliases"); + private static Object classCookie = new Object(); + + public SelectAvatarAction() { + } + + private URL getURLVal() { + URL var1 = this.url; + if (var1 == null) { + SuperRoot var2 = this.getOwner(); + if (var2 instanceof Drone) { + var1 = ((Drone)var2).getSourceURL(); + } else if (var2 instanceof PosableShape) { + var1 = ((Shape)var2).getURL(); + } else if (var2 instanceof Hologram) { + var1 = ((Hologram)var2).getMovieName(); + } + } + + return var1; + } + + public void doIt() { + Console var1 = Console.getActive(); + URL var2 = this.getURLVal(); + if (var1 != null && var2 != null) { + var1.setAvatar(var2); + } + + } + + public PolledDialog getDialog() { + URL var1 = this.getURLVal(); + if (!Console.getActive().getVIPAvatars() && var1.getInternal().toLowerCase().endsWith(".rwg")) { + return new OkCancelDialog(Console.getFrame(), this, Console.message("Cant-change-AV"), Console.message("OK"), (String)null, Console.message("Only-VIPs-change"), false); + } else { + String var2 = this.description; + if (var2 == null || var2.length() == 0) { + var2 = getPrettyAvatarName(var1.getBase()); } - break; - default: - ret = super.properties(index, offset + 1, mode, value); - } - - return ret; - } - - public String toString() { - return super.toString() + "[url " + (this.url == null ? "null" : this.url.getRelativeTo((SuperRoot)this) + "]"); - } - - public void saveState(Saver s) throws IOException { - s.saveVersion(4, classCookie); - super.saveState(s); - URL.save(s, this.url); - s.saveString(this.description); - } - - public void restoreState(Restorer r) throws IOException, TooNewException { - int ver = r.restoreVersion(classCookie); - switch (ver) { - case 0: - r.setOldFlag(); - this.dialogActionSkipRestore(r); - this.url = URL.restore(r, ".world"); - break; - case 1: - r.setOldFlag(); - this.dialogActionSkipRestore(r); - this.url = URL.restore(r, ".world"); - this.showDialog = r.restoreBoolean(); - break; - case 2: - this.dialogActionSkipRestore(r); - this.url = URL.restore(r, ".world"); - this.showDialog = r.restoreBoolean(); - this.cancelOnly = r.restoreBoolean(); - break; - case 3: - case 4: - super.restoreState(r); - this.url = URL.restore(r, ".world"); - if (ver >= 4) { - this.description = r.restoreString(); + + return new ChangeAvatarDialog(Console.getFrame(), this, var2); + } + } + + public static String getPrettyAvatarName(String var0) { + int var1 = var0.indexOf(46); + if (var1 >= 1) { + var0 = var0.substring(0, var1).toLowerCase(); + } else { + var0 = var0.toLowerCase(); + } + + for(int var2 = 0; var2 < avatarAliases.length; var2 += 2) { + if (avatarAliases[var2].equals(var0)) { + return avatarAliases[var2 + 1]; } - break; - default: - throw new TooNewException(); - } + } + + String var3 = var0.substring(0, 1).toUpperCase(); + if (var0.length() > 1) { + var3 = var3 + var0.substring(1); + } + + return var3; + } + + public Persister trigger(Event var1, Persister var2) { + URL var3 = this.getURLVal(); + return var3 == null ? null : super.trigger(var1, var2); + } + + public Object properties(int var1, int var2, int var3, Object var4) throws NoSuchPropertyException { + Object var5 = null; + switch(var1 - var2) { + case 0: + if (var3 == 0) { + var5 = URLPropertyEditor.make((new Property(this, var1, "Avatar URL")).allowSetNull(), "pilot;drone;rwx;rwg;mov"); + } else if (var3 == 1) { + var5 = this.url; + } else if (var3 == 2) { + this.url = (URL)var4; + } + break; + default: + var5 = super.properties(var1, var2 + 1, var3, var4); + } + + return var5; + } + + public String toString() { + return super.toString() + "[url " + (this.url == null ? "null" : this.url.getRelativeTo(this) + "]"); + } + + public void saveState(Saver var1) throws IOException { + var1.saveVersion(4, classCookie); + super.saveState(var1); + URL.save(var1, this.url); + var1.saveString(this.description); + } + + public void restoreState(Restorer var1) throws IOException, TooNewException { + int var2 = var1.restoreVersion(classCookie); + switch(var2) { + case 0: + var1.setOldFlag(); + this.dialogActionSkipRestore(var1); + this.url = URL.restore(var1, ".world"); + break; + case 1: + var1.setOldFlag(); + this.dialogActionSkipRestore(var1); + this.url = URL.restore(var1, ".world"); + this.showDialog = var1.restoreBoolean(); + break; + case 2: + this.dialogActionSkipRestore(var1); + this.url = URL.restore(var1, ".world"); + this.showDialog = var1.restoreBoolean(); + this.cancelOnly = var1.restoreBoolean(); + break; + case 3: + case 4: + super.restoreState(var1); + this.url = URL.restore(var1, ".world"); + if (var2 >= 4) { + this.description = var1.restoreString(); + } + break; + default: + throw new TooNewException(); + } - } + } } diff -ruN a/1920/NET/worlds/scape/SuperRoot.java b/1920/NET/worlds/scape/SuperRoot.java --- a/1920/NET/worlds/scape/SuperRoot.java 2024-01-08 01:46:40.000000000 -0600 +++ b/1920/NET/worlds/scape/SuperRoot.java 2023-08-21 23:27:17.000000000 -0500 @@ -22,36 +22,36 @@ static Hashtable classCounter = new Hashtable(); public final String getShortClassName() { - String s = this.getClass().getName(); - int index; - if ((index = s.lastIndexOf(46)) != -1) { - s = s.substring(index + 1); + String var1 = this.getClass().getName(); + int var2; + if ((var2 = var1.lastIndexOf(46)) != -1) { + var1 = var1.substring(var2 + 1); } - return s; + return var1; } public String getName() { if (this.name == null) { - int digits = 0; - String classname = this.getShortClassName(); - Enumeration en = this.getRoot().getDeepOwned(); - - while(en.hasMoreElements()) { - SuperRoot x = (SuperRoot)en.nextElement(); - if (x.name != null && x.name.startsWith(classname)) { + int var1 = 0; + String var2 = this.getShortClassName(); + Enumeration var3 = this.getRoot().getDeepOwned(); + + while(var3.hasMoreElements()) { + SuperRoot var4 = (SuperRoot)var3.nextElement(); + if (var4.name != null && var4.name.startsWith(var2)) { try { - int tmp = Integer.valueOf(x.name.substring(classname.length())); - if (tmp > digits) { - digits = tmp; + int var5 = Integer.valueOf(var4.name.substring(var2.length())).intValue(); + if (var5 > var1) { + var1 = var5; } } catch (NumberFormatException var6) { } } } - ++digits; - this.name = classname + digits; + ++var1; + this.name = var2 + var1; } return this.name; @@ -61,87 +61,84 @@ return this.name; } - public void setName(String v) { - if (v == null && this.owner != null) { - Object[] arguments = new Object[]{new String(this.owner.getName())}; - Console.println(MessageFormat.format(Console.message("Warning-null-name"), arguments)); + public void setName(String var1) { + if (var1 == null && this.owner != null) { + Object[] var2 = new Object[]{new String(this.owner.getName())}; + Console.println(MessageFormat.format(Console.message("Warning-null-name"), var2)); } - this.name = v; + this.name = var1; } - public static SuperRoot nameSearch(Enumeration enumeration, String name) { - SuperRoot n; - do { - if (!enumeration.hasMoreElements()) { - return null; - } + public static SuperRoot nameSearch(Enumeration var0, String var1) { + while(true) { + if (var0.hasMoreElements()) { + SuperRoot var2 = (SuperRoot)var0.nextElement(); + if (!var1.equals(var2.name)) { + continue; + } - n = (SuperRoot)enumeration.nextElement(); - } while(!name.equals(n.name)); + return var2; + } - return n; + return null; + } } public URL getHelpURL() { - String helpString = helpURL + this.getClass().getName() + Console.message(".html"); - URL helpPage = URL.make(helpString); - if (Console.wasHttpNoSuchFile(helpString)) { - helpPage = URL.make(helpURL + this.getClass().getName() + ".html"); + String var1 = helpURL + this.getClass().getName() + Console.message(".html"); + URL var2 = URL.make(var1); + if (Console.wasHttpNoSuchFile(var1)) { + var2 = URL.make(helpURL + this.getClass().getName() + ".html"); } - return helpPage; + return var2; } - public URL getHelpURL(Property p) { - String namesub = p.getName().replace(' ', '_'); - String helpString = helpURL + this.getClass().getName() + "#" + namesub + Console.message(".html"); - URL helpPage = URL.make(helpString); - if (Console.wasHttpNoSuchFile(helpString)) { - helpPage = URL.make(helpURL + this.getClass().getName() + "#" + namesub + ".html"); + public URL getHelpURL(Property var1) { + String var2 = var1.getName().replace(' ', '_'); + String var3 = helpURL + this.getClass().getName() + "#" + var2 + Console.message(".html"); + URL var4 = URL.make(var3); + if (Console.wasHttpNoSuchFile(var3)) { + var4 = URL.make(helpURL + this.getClass().getName() + "#" + var2 + ".html"); } - return helpPage; + return var4; } public String toString() { return this.isActive() ? this.getName() : this.getName() + "(inactive)"; } - 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 = StringPropertyEditor.make(new Property(this, index, "Name")); - } else if (mode == 1) { - ret = this.getName(); - } else if (mode == 4) { - this.setName((String)null); - } else if (mode == 2) { - String s = (String)value; - if (!s.equals(this.name) && this.owner != null && nameSearch(this.getRoot().getDeepOwned(), s) != null) { - Object[] arguments = new Object[]{new String(s), new String(this.getRoot().getName())}; - Console.println(MessageFormat.format(Console.message("Name-in-use"), arguments)); - } else { - this.setName((String)value); - } - } - break; - case 1: - if (mode == 0) { - ret = URLPropertyEditor.make((new Property(this, index, "Source URL")).allowSetNull(), "*wob", false); - } else if (mode == 1) { - ret = this.sourceURL; - } else if (mode == 2) { - this.setSourceURL((URL)value); - } - break; - default: - throw new NoSuchPropertyException(); + public Object properties(int var1, int var2, int var3, Object var4) throws NoSuchPropertyException { + Object var5 = null; + switch(var1 - var2) { + case 0: + if (var3 == 0) { + var5 = StringPropertyEditor.make(new Property(this, var1, "Name")); + } else if (var3 == 1) { + var5 = this.getName(); + } else if (var3 == 4) { + this.setName((String)null); + } else if (var3 == 2) { + String var6 = (String)var4; + this.setName((String)var4); + } + break; + case 1: + if (var3 == 0) { + var5 = URLPropertyEditor.make((new Property(this, var1, "Source URL")).allowSetNull(), "*wob", false); + } else if (var3 == 1) { + var5 = this.sourceURL; + } else if (var3 == 2) { + this.setSourceURL((URL)var4); + } + break; + default: + throw new NoSuchPropertyException(); } - return ret; + return var5; } public Object propertyParent() { @@ -156,13 +153,13 @@ this.detach(); } - protected void add(SuperRoot x) { - if (x.owner != null && x.owner != this) { - System.out.println("double-setting owner of " + x + " from " + x.owner + " to " + this); - throw new Error("double-setting owner of " + x); + protected void add(SuperRoot var1) { + if (var1.owner != null && var1.owner != this) { + System.out.println("double-setting owner of " + var1 + " from " + var1.owner + " to " + this); + throw new Error("double-setting owner of " + var1); } else { - x.noteAddingTo(this); - x.owner = this; + var1.noteAddingTo(this); + var1.owner = this; } } @@ -174,10 +171,10 @@ } - protected void noteAddingTo(SuperRoot s) { + protected void noteAddingTo(SuperRoot var1) { } - protected void noteUnadding(SuperRoot s) { + protected void noteUnadding(SuperRoot var1) { } public Enumeration getOwned() { @@ -188,22 +185,22 @@ return new DeepEnumeration(this); } - public void getChildren(DeepEnumeration d) { + public void getChildren(DeepEnumeration var1) { } public World getWorld() { - SuperRoot owner = this.getOwner(); - return owner == null ? null : owner.getWorld(); + SuperRoot var1 = this.getOwner(); + return var1 == null ? null : var1.getWorld(); } public Room getRoom() { - SuperRoot owner = this.getOwner(); - return owner == null ? null : owner.getRoom(); + SuperRoot var1 = this.getOwner(); + return var1 == null ? null : var1.getRoom(); } public SuperRoot getRoot() { - SuperRoot owner = this.getOwner(); - return owner == null ? this : owner.getRoot(); + SuperRoot var1 = this.getOwner(); + return var1 == null ? this : var1.getRoot(); } public boolean isActive() { @@ -214,8 +211,8 @@ return this.sourceURL; } - public void setSourceURL(URL s) { - this.sourceURL = s; + public void setSourceURL(URL var1) { + this.sourceURL = var1; } public URL getContainingSourceURL() { @@ -233,13 +230,13 @@ } - public static SuperRoot readFile(String urlLocal, URL url) { + public static SuperRoot readFile(String var0, URL var1) { try { - Restorer r = new Restorer(urlLocal, url); - SuperRoot o = (SuperRoot)r.restore(); - r.done(); - o.setSourceURL(url); - return o; + Restorer var3 = new Restorer(var0, var1); + SuperRoot var4 = (SuperRoot)var3.restore(); + var3.done(); + var4.setSourceURL(var1); + return var4; } catch (FileNotFoundException var5) { } catch (ClassCastException var6) { } catch (IOException var7) { @@ -250,40 +247,40 @@ return null; } - public static SuperRoot readFile(URL url) { - return readFile(url.unalias(), url); + public static SuperRoot readFile(URL var0) { + return readFile(var0.unalias(), var0); } public void loadInit() { } - public void saveFile(URL url) throws IOException { + public void saveFile(URL var1) throws IOException { if (this instanceof NonPersister) { throw new IOException("Can't save NonPersister"); } else { - Saver s = new Saver(url); - s.save(this); - s.done(); - this.setSourceURL(url); + Saver var2 = new Saver(var1); + var2.save(this); + var2.done(); + this.setSourceURL(var1); } } public Object clone() { - byte[] b = this.getByteCopy(); - return getCopyFromBytes(b); + byte[] var1 = this.getByteCopy(); + return getCopyFromBytes(var1); } public byte[] getByteCopy() { if (this instanceof NonPersister) { return null; } else { - ByteArrayOutputStream buffer = new ByteArrayOutputStream(); + ByteArrayOutputStream var1 = new ByteArrayOutputStream(); try { - Saver saver = new Saver(new DataOutputStream(buffer)); - saver.save(this); - saver.done(); - return buffer.toByteArray(); + Saver var2 = new Saver(new DataOutputStream(var1)); + var2.save(this); + var2.done(); + return var1.toByteArray(); } catch (Exception var3) { var3.printStackTrace(System.out); throw new Error("Can't save"); @@ -291,15 +288,15 @@ } } - public static SuperRoot getCopyFromBytes(byte[] b) { - if (b == null) { + public static SuperRoot getCopyFromBytes(byte[] var0) { + if (var0 == null) { return null; } else { try { - Restorer r = new Restorer(new DataInputStream(new ByteArrayInputStream(b))); - SuperRoot obj = (SuperRoot)r.restore(); - r.done(); - return obj; + Restorer var1 = new Restorer(new DataInputStream(new ByteArrayInputStream(var0))); + SuperRoot var2 = (SuperRoot)var1.restore(); + var1.done(); + return var2; } catch (Exception var3) { var3.printStackTrace(System.out); throw new Error("Can't restore"); @@ -307,80 +304,80 @@ } } - public void saveState(Saver s) throws IOException { - s.saveVersion(2, classCookie); - s.saveString(this.name); - } - - public void restoreState(Restorer r) throws IOException, TooNewException { - this.restoreStateSuperRoot(r); - } - - protected final void restoreStateSuperRoot(Restorer r) throws IOException, TooNewException { - String n; - switch (r.restoreVersion(classCookie)) { - case 0: - r.setOldFlag(); - case 2: - if ((n = r.restoreString()) != null) { - this.setName(n); - } - break; - case 1: - r.setOldFlag(); - if ((n = r.restoreString()) != null) { - this.setName(n); - } + public void saveState(Saver var1) throws IOException { + var1.saveVersion(2, classCookie); + var1.saveString(this.name); + } + + public void restoreState(Restorer var1) throws IOException, TooNewException { + this.restoreStateSuperRoot(var1); + } + + protected final void restoreStateSuperRoot(Restorer var1) throws IOException, TooNewException { + String var2; + switch(var1.restoreVersion(classCookie)) { + case 0: + var1.setOldFlag(); + case 2: + if ((var2 = var1.restoreString()) != null) { + this.setName(var2); + } + break; + case 1: + var1.setOldFlag(); + if ((var2 = var1.restoreString()) != null) { + this.setName(var2); + } - r.restoreMaybeNull(); - break; - default: - throw new TooNewException(); + var1.restoreMaybeNull(); + break; + default: + throw new TooNewException(); } } - public void postRestore(int version) { + public void postRestore(int var1) { } - public static void finalizeCounter(Object o) { - Class c = o.getClass(); - Integer icnt = (Integer)finalizedClasses.get(c); - int cnt = 0; - if (icnt != null) { - cnt = icnt; + public static void finalizeCounter(Object var0) { + Class var1 = var0.getClass(); + Integer var2 = (Integer)finalizedClasses.get(var1); + int var3 = 0; + if (var2 != null) { + var3 = var2.intValue(); } - ++cnt; - if (cnt == 1000) { - System.out.println("Finalized 1000 times: " + c); - cnt = 0; + ++var3; + if (var3 == 1000) { + System.out.println("Finalized 1000 times: " + var1); + var3 = 0; } - finalizedClasses.put(o.getClass(), new Integer(cnt)); + finalizedClasses.put(var0.getClass(), new Integer(var3)); } protected void finalize() { } - public static void countClass(Object o, int inc) { - Class c = o.getClass(); - Integer icnt = (Integer)classCounter.get(c); - int cnt = 0; - if (icnt != null) { - cnt = icnt; + public static void countClass(Object var0, int var1) { + Class var2 = var0.getClass(); + Integer var3 = (Integer)classCounter.get(var2); + int var4 = 0; + if (var3 != null) { + var4 = var3.intValue(); } - cnt += inc; - classCounter.put(c, new Integer(cnt)); + var4 += var1; + classCounter.put(var2, new Integer(var4)); } public static void printClassCounts() { - Enumeration e = classCounter.keys(); + Enumeration var0 = classCounter.keys(); - while(e.hasMoreElements()) { - Class c = (Class)e.nextElement(); - System.out.println("Class " + c.getName() + " has " + classCounter.get(c)); + while(var0.hasMoreElements()) { + Class var1 = (Class)var0.nextElement(); + System.out.println("Class " + var1.getName() + " has " + classCounter.get(var1)); } } diff -ruN a/1920/NET/worlds/scape/TalkAction.java b/1920/NET/worlds/scape/TalkAction.java --- a/1920/NET/worlds/scape/TalkAction.java 2024-01-08 01:46:38.000000000 -0600 +++ b/1920/NET/worlds/scape/TalkAction.java 2023-08-21 23:27:17.000000000 -0500 @@ -1,61 +1,68 @@ package NET.worlds.scape; +import NET.worlds.console.Console; +import NET.worlds.core.IniFile; + import java.io.IOException; public class TalkAction extends Action { - String txt = null; - private static Object classCookie = new Object(); + String txt = null; + private static Object classCookie = new Object(); - public TalkAction() { - } + public TalkAction() { + } - public TalkAction(String text) { - this.txt = text; - } - - public Persister trigger(Event arg, Persister seqID) { - Pilot.getActive(); - Pilot.sendText(this.txt); - return null; - } - - 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 = StringPropertyEditor.make(new Property(this, index, "Message")); - } else if (mode == 1) { - ret = this.txt; - } else if (mode == 2) { - this.txt = (String)value; - } - break; - default: - ret = super.properties(index, offset + 1, mode, value); - } - - return ret; - } - - public void saveState(Saver s) throws IOException { - s.saveVersion(0, classCookie); - super.saveState(s); - s.saveString(this.txt); - } - - public void restoreState(Restorer r) throws IOException, TooNewException { - switch (r.restoreVersion(classCookie)) { - case 0: - super.restoreState(r); - this.txt = r.restoreString(); - return; - default: - throw new TooNewException(); - } - } - - public String toString() { - return super.toString() + "[" + this.txt + "]"; - } + public TalkAction(String var1) { + this.txt = var1; + } + + public Persister trigger(Event var1, Persister var2) { + if (IniFile.modModules().getIniInt("DisableTalkAction", 1) == 1) { + if (IniFile.gamma().getIniInt("classicChatBox", 1) == 1) Pilot.getActive().console.printLine(Console.getActive().getLongID() + ": " + this.txt); + else Pilot.getActive().console.printLine(" " + Console.getActive().getLongID() + ": " + this.txt + " "); + } else { + Pilot.sendText(this.txt); + } + return null; + } + + public Object properties(int var1, int var2, int var3, Object var4) throws NoSuchPropertyException { + Object var5 = null; + switch(var1 - var2) { + case 0: + if (var3 == 0) { + var5 = StringPropertyEditor.make(new Property(this, var1, "Message")); + } else if (var3 == 1) { + var5 = this.txt; + } else if (var3 == 2) { + this.txt = (String)var4; + } + break; + default: + var5 = super.properties(var1, var2 + 1, var3, var4); + } + + return var5; + } + + public void saveState(Saver var1) throws IOException { + var1.saveVersion(0, classCookie); + super.saveState(var1); + var1.saveString(this.txt); + } + + public void restoreState(Restorer var1) throws IOException, TooNewException { + switch(var1.restoreVersion(classCookie)) { + case 0: + super.restoreState(var1); + this.txt = var1.restoreString(); + return; + default: + throw new TooNewException(); + } + } + + public String toString() { + return super.toString() + "[" + this.txt + "]"; + } } diff -ruN a/1920/NET/worlds/scape/TarredDrone.java b/1920/NET/worlds/scape/TarredDrone.java --- a/1920/NET/worlds/scape/TarredDrone.java 1969-12-31 18:00:00.000000000 -0600 +++ b/1920/NET/worlds/scape/TarredDrone.java 2023-08-21 23:27:17.000000000 -0500 @@ -0,0 +1,44 @@ +package NET.worlds.scape; + +import NET.worlds.console.HiddenDrone; +import NET.worlds.network.ObjID; +import NET.worlds.network.URL; +import NET.worlds.network.WorldServer; +import java.io.IOException; + +public class TarredDrone extends Drone implements HiddenDrone { + private static Object classCookie = new Object(); + + public TarredDrone(ObjID var1, WorldServer var2, URL var3) { + super(var1, var2); + this.setSourceURL(var3); + } + + public TarredDrone() { + } + + public Drone setAvatarNow(URL var1) { + if (this.shouldBeTarred()) { + this.setSourceURL(URL.make("avatar:holden.mov")); + return this; + } else { + return super.setAvatarNow(var1); + } + } + + public void saveState(Saver var1) throws IOException { + var1.saveVersion(1, classCookie); + super.saveState(var1); + } + + public void restoreState(Restorer var1) throws IOException, TooNewException { + int var2 = var1.restoreVersion(classCookie); + switch(var2) { + case 1: + super.restoreState(var1); + return; + default: + throw new TooNewException(); + } + } +} diff -ruN a/1920/NET/worlds/scape/TeleportAction.java b/1920/NET/worlds/scape/TeleportAction.java --- a/1920/NET/worlds/scape/TeleportAction.java 2024-01-08 01:46:36.000000000 -0600 +++ b/1920/NET/worlds/scape/TeleportAction.java 2023-08-21 23:27:17.000000000 -0500 @@ -1,547 +1,543 @@ package NET.worlds.scape; -import NET.worlds.console.Console; -import NET.worlds.console.DialogReceiver; -import NET.worlds.console.Main; -import NET.worlds.console.MainCallback; -import NET.worlds.console.WorldsMarkPart; +import NET.worlds.console.*; +import NET.worlds.core.Debug; import NET.worlds.core.IniFile; import NET.worlds.network.NetUpdate; import NET.worlds.network.URL; -import java.awt.Frame; + import java.io.IOException; import java.net.MalformedURLException; import java.text.MessageFormat; public class TeleportAction extends Action implements LoadedURLSelf, MainCallback, DialogReceiver { - private Point3 targetCoords = new Point3(); - private float targetRot = 0.0F; - private Point3 targetAxis = new Point3(0.0F, 0.0F, -1.0F); - private String targetRoomName = null; - private String targetDimension = null; - private URL targetWorldURL = null; - private boolean useDefCoordinates = false; - private boolean done = false; - private boolean showDialog = true; - private boolean forceWorldLoad = false; - private boolean forceNoWorldLoad = false; - private String targetURL; - private static TeleportAction activeTeleport = null; - private TeleportDialog dialog = null; - private TeleportStatus doneCallback; - String tempParseStr; - private static Object classCookie = new Object(); - - public TeleportAction() { - } - - public Persister trigger(Event e, Persister seqID) { - if (activeTeleport != this) { - this.targetURL = this.asURL(); - this.startTeleport(); - } - - return !this.done && activeTeleport != this ? this : null; - } - - public void stopLoading() { - this.done = true; - if (activeTeleport == this) { - this.stopTeleport((String)null); - } - - } - - public static boolean isTeleporting() { - return activeTeleport != null; - } - - public static void teleport(String url, TeleportStatus callback) { - TeleportAction t = new TeleportAction(url, callback); - if (Main.isMainThread()) { - t.startTeleport(); - } else { - Main.register(t); - } - - } - - public static void teleport(String url, TeleportStatus callback, boolean forceWorldLoad) { - TeleportAction t = new TeleportAction(url, callback); - t.forceWorldLoad = forceWorldLoad; - t.forceNoWorldLoad = !forceWorldLoad; - if (Main.isMainThread()) { - t.startTeleport(); - } else { - Main.register(t); - } - - } - - public static void teleport(String url, TeleportStatus callback, boolean forceWorldLoad, boolean pShowDialog) { - TeleportAction t = new TeleportAction(url, callback); - t.showDialog = pShowDialog; - t.forceWorldLoad = forceWorldLoad; - t.forceNoWorldLoad = !forceWorldLoad; - if (Main.isMainThread()) { - t.startTeleport(); - } else { - Main.register(t); - } - - } - - public void mainCallback() { - Main.unregister(this); - this.startTeleport(); - } - - public static String toURLString(String url) { - if (url == null || url.equals("world:")) { - url = WorldsMarkPart.getFirstSystemMarkURL(); - } - - if (url == null) { - url = "home:NewWorld.world"; - } - - if (url.startsWith("world:")) { - if (url.equals("world:restart")) { - url = IniFile.gamma().getIniString("RestartAt", WorldsMarkPart.getFirstSystemMarkURL()); - } else if (url.equals("world:store")) { - url = World.getHomeStore().getAbsolute(); - } else { - url = url.substring(6); - } - - int i = url.indexOf(".world?"); - if (i >= 0) { - url = url.substring(0, i) + ".world#" + url.substring(i + 7); - } - } - - if (url.indexOf(58) < 0) { - if (url.indexOf(47) < 0 && url.indexOf(92) < 0 && !url.endsWith(".world")) { - url = "home:" + url + "/" + url + ".world"; - } else { - url = "file:" + url; - } - } - - return url; - } - - private TeleportAction(String url, TeleportStatus callback) { - this.doneCallback = callback; - this.targetURL = toURLString(url); - url = this.setFromURL(this.targetURL); - - try { - if (this.targetURL.startsWith("http://")) { - this.targetWorldURL = new URL(url); - } else { - this.targetWorldURL = new URL(URL.getCurDir(), URL.maybeAddExt(url, ".world")); - } - } catch (MalformedURLException var4) { - this.targetWorldURL = URL.make("error:\"" + url + '"'); - } - - } - - private float getNextFloat(float def) { - String s = this.tempParseStr; - int end = this.tempParseStr.indexOf(44); - if (end == -1) { - end = this.tempParseStr.length(); - this.tempParseStr = ""; - } else { - this.tempParseStr = this.tempParseStr.substring(end + 1); - } - - try { - return Float.valueOf(s.substring(0, end)); - } catch (NumberFormatException var5) { - return def; - } - } - - private String setFromURL(String url) { - this.useDefCoordinates = true; - int roomNameStart = url.lastIndexOf(35); - int leftAngle; - if (roomNameStart >= 0) { - String rest = url.substring(roomNameStart + 1); - url = url.substring(0, roomNameStart); - leftAngle = rest.lastIndexOf(64); - if (leftAngle < 0) { - this.targetRoomName = rest; - } else { - this.useDefCoordinates = false; - this.targetRoomName = rest.substring(0, leftAngle); - this.tempParseStr = rest.substring(leftAngle + 1); - this.targetCoords.x = this.getNextFloat(this.targetCoords.x); - this.targetCoords.y = this.getNextFloat(this.targetCoords.y); - this.targetCoords.z = this.getNextFloat(this.targetCoords.z); - this.targetRot = this.getNextFloat(this.targetRot); - this.targetAxis.x = this.getNextFloat(this.targetAxis.x); - this.targetAxis.y = this.getNextFloat(this.targetAxis.y); - this.targetAxis.z = this.getNextFloat(this.targetAxis.z); - this.tempParseStr = null; - } - } - - if (this.targetRoomName != null) { - int rightAngle = this.targetRoomName.lastIndexOf(62); - leftAngle = this.targetRoomName.lastIndexOf(60); - if (rightAngle + 1 == this.targetRoomName.length() && leftAngle >= 0) { - this.targetDimension = this.targetRoomName.substring(leftAngle + 1, rightAngle); - this.targetRoomName = this.targetRoomName.substring(0, leftAngle); - } - } - - return url; - } - - private void makeTeleportDialog(URL url) { - if (this.showDialog) { - Frame gf = Console.getFrame(); - if (gf != null && gf.isShowing()) { - this.dialog = new TeleportDialog(gf, this); - } - } - - } - - private void startTeleport() { - if (activeTeleport != null) { - if (activeTeleport.doneCallback != null) { - activeTeleport.doneCallback.teleportStatus("overridden by new teleport", activeTeleport.targetURL); - } - - activeTeleport.stopTeleport((String)null); - } - - activeTeleport = this; - Console.setFreezeFrameEvents(true); - this.done = false; - Console.teleportNotification("", this.targetURL); - if (this.targetWorldURL != null) { - this.makeTeleportDialog(this.targetWorldURL); - World.load(this.targetWorldURL, this, this.forceWorldLoad); - } else { - Pilot pilot = Pilot.getActive(); - World w; - if (pilot != null && (w = pilot.getWorld()) != null) { - this.makeTeleportDialog(w.getSourceURL()); - this.loadedURLSelf(w, this.targetWorldURL, (String)null); - } else { - this.stopTeleport("Pilot not in a room for intraworld teleport"); - } - } - - } - - private Room stopTeleport(String err) { - assert this == activeTeleport; - - this.done = true; - activeTeleport = null; - Console.setFreezeFrameEvents(false); - if (this.doneCallback != null) { - this.doneCallback.teleportStatus(err, this.targetURL); - } - - if (err != null && !this.forceNoWorldLoad) { - Console.teleportNotification(err, this.targetURL); - Console.println(err); - } - - if (this.dialog != null) { - this.dialog.closeIt(true); - this.dialog = null; - } - - return null; - } - - public synchronized void dialogDone(Object who, boolean confirmed) { - if (activeTeleport != null) { - activeTeleport.stopTeleport((String)null); - } - - } - - public static String getReadableNameOfWorld(URL url) { - String worldDir = url.getAbsolute(); - String readable = worldDir; - String packageName = null; - if (worldDir.startsWith("home:") && worldDir.length() > 6) { - readable = worldDir.substring(worldDir.charAt(5) == '/' ? 6 : 5); - int slash = readable.indexOf(47); - if (slash > 0) { - packageName = readable.substring(0, slash); - if (readable.regionMatches(true, slash + 1, readable, 0, slash)) { - readable = packageName; - String s = WorldsMarkPart.getExternalName(packageName); - if (s != null) { - readable = s; - } - } - } - - int tail = readable.indexOf(".world"); - if (tail > 0) { - readable = readable.substring(0, tail); - } - - readable = "the " + readable + " world"; - } - - return readable; - } - - public static String getPackageNameOfWorld(URL url) { - String worldDir = url.getAbsolute(); - String packageName = null; - if (worldDir.startsWith("home:") && worldDir.length() > 6) { - String readable = worldDir.substring(worldDir.charAt(5) == '/' ? 6 : 5); - int slash = readable.indexOf(47); - if (slash > 0) { - packageName = readable.substring(0, slash); - } - } - - return packageName; - } - - public void loadedURLSelf(URLSelf o, URL url, String err) { - if (activeTeleport != this) { - if (o != null) { - o.decRef(); - } - - } else { - String readable; - if (err == null && o instanceof World) { - readable = this.targetRoomName; - if (readable == null) { - readable = ((World)o).getDefaultRoomName(); - } - - Room room = ((World)o).getRoom(readable); - if (room == null) { - this.stopTeleport("Error finding room " + this.targetRoomName); - } else if (room.getVIPOnly() && !((World)o).getConsole().getVIP()) { - this.stopTeleport("Only VIPs may go there."); - if (this.forceNoWorldLoad) { - Console.println(Console.message("Only-VIPs-there")); - } + private Point3 targetCoords = new Point3(); + private float targetRot = 0.0F; + private Point3 targetAxis = new Point3(0.0F, 0.0F, -1.0F); + private String targetRoomName = null; + private String targetDimension = null; + private URL targetWorldURL = null; + private boolean useDefCoordinates = false; + private boolean done = false; + private boolean showDialog = true; + private boolean forceWorldLoad = false; + private boolean forceNoWorldLoad = false; + private String targetURL; + private static TeleportAction activeTeleport = null; + private TeleportDialog dialog = null; + private TeleportStatus doneCallback; + String tempParseStr; + private static Object classCookie = new Object(); + + public TeleportAction() { + } + + public Persister trigger(Event var1, Persister var2) { + if (activeTeleport != this) { + this.targetURL = this.asURL(); + this.startTeleport(); + } + + return !this.done && activeTeleport != this ? this : null; + } + + public void stopLoading() { + this.done = true; + if (activeTeleport == this) { + this.stopTeleport((String)null); + } + + } + + public static boolean isTeleporting() { + return activeTeleport != null; + } + + public static void teleport(String var0, TeleportStatus var1) { + TeleportAction var2 = new TeleportAction(var0, var1); + if (Main.isMainThread()) { + var2.startTeleport(); + } else { + Main.register(var2); + } + + } + + public static void teleport(String var0, TeleportStatus var1, boolean var2) { + TeleportAction var3 = new TeleportAction(var0, var1); + var3.forceWorldLoad = var2; + var3.forceNoWorldLoad = !var2; + if (Main.isMainThread()) { + var3.startTeleport(); + } else { + Main.register(var3); + } + + } + + public static void teleport(String var0, TeleportStatus var1, boolean var2, boolean var3) { + TeleportAction var4 = new TeleportAction(var0, var1); + var4.showDialog = var3; + var4.forceWorldLoad = var2; + var4.forceNoWorldLoad = !var2; + if (Main.isMainThread()) { + var4.startTeleport(); + } else { + Main.register(var4); + } + + } + + public void mainCallback() { + Main.unregister(this); + this.startTeleport(); + } + + public static String toURLString(String var0) { + if (var0 == null || var0.equals("world:")) { + var0 = WorldsMarkPart.getFirstSystemMarkURL(); + } + + if (var0 == null) { + var0 = "home:NewWorld.world"; + } + + if (var0.startsWith("world:")) { + if (var0.equals("world:restart")) { + var0 = IniFile.gamma().getIniString("RestartAt", WorldsMarkPart.getFirstSystemMarkURL()); + } else if (var0.equals("world:store")) { + var0 = World.getHomeStore().getAbsolute(); + } else { + var0 = var0.substring(6); + } + + int var1 = var0.indexOf(".world?"); + if (var1 >= 0) { + var0 = var0.substring(0, var1) + ".world#" + var0.substring(var1 + 7); + } + } + + if (var0.indexOf(58) < 0) { + if (var0.indexOf(47) < 0 && var0.indexOf(92) < 0 && !var0.endsWith(".world")) { + var0 = "home:" + var0 + "/" + var0 + ".world"; + } else { + var0 = "file:" + var0; + } + } + + return var0; + } + + private TeleportAction(String var1, TeleportStatus var2) { + this.doneCallback = var2; + this.targetURL = toURLString(var1); + var1 = this.setFromURL(this.targetURL); + try { + if (this.targetURL.startsWith("http://")) { + this.targetWorldURL = new URL(var1); } else { - Console.teleportNotification((String)null, this.targetURL); - Pilot pilot = Pilot.changeActiveRoom(room); - if (this.targetDimension != null) { - pilot.changeChannel(this.targetDimension); - } - - pilot.makeIdentity(); - if (this.useDefCoordinates) { - pilot.moveTo(room.getDefaultPosition()).spin(room.getDefaultOrientationAxis(), room.getDefaultOrientation()); - } else { - pilot.moveTo(this.targetCoords).spin(this.targetAxis, this.targetRot); - } - - this.stopTeleport((String)null); - } - } else { - if (err == null) { - err = "file " + url + " doesn't contain a World"; - o.decRef(); - } - - readable = getReadableNameOfWorld(url); - String packageName = getPackageNameOfWorld(url); - Object[] arguments = new Object[]{new String(readable)}; - this.stopTeleport(MessageFormat.format(Console.message("cant-teleport"), arguments)); - if (packageName != null && !this.forceNoWorldLoad) { - NetUpdate.loadWorld(packageName, this.forceWorldLoad); - } - - } - } - } - - 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 = Point3PropertyEditor.make(new Property(this, index, "X, Y, Z")); - } else if (mode == 1) { - ret = new Point3(this.targetCoords); - } else if (mode == 2) { - this.targetCoords.copy((Point3)value); - } - break; - case 1: - if (mode == 0) { - ret = FloatPropertyEditor.make(new Property(this, index, "Dir")); - } else if (mode == 1) { - ret = new Float(this.targetRot); - } else if (mode == 2) { - this.targetRot = (Float)value; - } - break; - case 2: - if (mode == 0) { - ret = StringPropertyEditor.make((new Property(this, index, "Room Name")).allowSetNull()); - } else if (mode == 1) { - if (this.targetRoomName == null) { - ret = ""; - } else { - ret = new String(this.targetRoomName); - } - } else if (mode == 2) { - this.targetRoomName = (String)value; - this.stopLoading(); - } - break; - case 3: - if (mode == 0) { - ret = URLPropertyEditor.make((new Property(this, index, "World URL")).allowSetNull(), "world"); - } else if (mode == 1) { - ret = this.targetWorldURL; - } else if (mode == 2) { - this.targetWorldURL = (URL)value; - this.stopLoading(); - } - break; - case 4: - if (mode == 0) { - ret = BooleanPropertyEditor.make(new Property(this, index, "Use default coordinates"), "No", "Yes"); - } else if (mode == 1) { - ret = new Boolean(this.useDefCoordinates); - } else if (mode == 2) { - this.useDefCoordinates = (Boolean)value; - } - break; - case 5: - if (mode == 0) { - ret = StringPropertyEditor.make((new Property(this, index, "Dimension Name")).allowSetNull()); - } else if (mode == 1) { - if (this.targetDimension == null) { - ret = ""; - } else { - ret = new String(this.targetDimension); - } - } else if (mode == 2) { - this.targetDimension = (String)value; - if (this.targetDimension.equals("")) { - this.targetDimension = null; - } - - this.stopLoading(); - } - break; - case 6: - if (mode == 0) { - ret = BooleanPropertyEditor.make(new Property(this, index, "Show dialog"), "No", "Yes"); - } else if (mode == 1) { - ret = new Boolean(this.showDialog); - } else if (mode == 2) { - this.showDialog = (Boolean)value; - } - break; - default: - ret = super.properties(index, offset + 7, mode, value); - } - - return ret; - } - - public void saveState(Saver s) throws IOException { - s.saveVersion(3, classCookie); - super.saveState(s); - s.save(this.targetCoords); - s.saveFloat(this.targetRot); - s.save(this.targetAxis); - s.saveString(this.targetRoomName); - URL.save(s, this.targetWorldURL); - s.saveBoolean(this.useDefCoordinates); - s.saveString(this.targetDimension); - } - - public void restoreState(Restorer r) throws IOException, TooNewException { - int vers = r.restoreVersion(classCookie); - switch (vers) { - case 0: - super.restoreState(r); - this.targetCoords = (Point3)r.restore(); - this.targetRot = (float)r.restoreInt(); - this.targetRoomName = r.restoreString(); - this.targetWorldURL = URL.restore(r, ".world"); - this.useDefCoordinates = r.restoreBoolean(); - this.targetDimension = null; - break; - case 1: - case 2: - super.restoreState(r); - this.targetCoords = (Point3)r.restore(); - this.targetRot = r.restoreFloat(); - this.targetAxis = (Point3)r.restore(); - this.targetRoomName = r.restoreString(); - this.targetWorldURL = URL.restore(r, ".world"); - this.useDefCoordinates = r.restoreBoolean(); - this.targetDimension = null; - break; - case 3: - super.restoreState(r); - this.targetCoords = (Point3)r.restore(); - this.targetRot = r.restoreFloat(); - this.targetAxis = (Point3)r.restore(); - this.targetRoomName = r.restoreString(); - this.targetWorldURL = URL.restore(r, ".world"); - this.useDefCoordinates = r.restoreBoolean(); - this.targetDimension = r.restoreString(); - break; - default: - throw new TooNewException(); - } - - if (vers < 2 && this.targetAxis.x == 0.0F && this.targetAxis.y == 0.0F && this.targetAxis.z == 1.0F) { - this.targetAxis.z = -1.0F; - this.targetRot = 360.0F - this.targetRot; - } - - } - - public String toString() { - return super.toString() + "[" + this.asURL() + "]"; - } - - public String asURL() { - String url; - if (this.targetWorldURL != null) { - url = this.targetWorldURL.getRelativeTo((SuperRoot)this) + "#"; - } else { - url = "#"; - } - - if (this.targetRoomName != null) { - url = url + this.targetRoomName; - } - - if (this.targetDimension != null) { - url = url + "<" + this.targetDimension + ">"; - } - - if (!this.useDefCoordinates) { - url = url + "@" + this.targetCoords + "," + this.targetRot; - if (this.targetAxis.x != 0.0F || this.targetAxis.y != 0.0F || this.targetAxis.z != 1.0F) { - url = url + "," + this.targetAxis; - } - } + this.targetWorldURL = new URL(URL.getCurDir(), URL.maybeAddExt(var1, ".world")); + } + } catch (MalformedURLException var4) { + this.targetWorldURL = URL.make("error:\"" + var1 + '"'); + } + + } + + private float getNextFloat(float var1) { + String var2 = this.tempParseStr; + int var3 = this.tempParseStr.indexOf(44); + if (var3 == -1) { + var3 = this.tempParseStr.length(); + this.tempParseStr = ""; + } else { + this.tempParseStr = this.tempParseStr.substring(var3 + 1); + } + + try { + return Float.valueOf(var2.substring(0, var3)).floatValue(); + } catch (NumberFormatException var5) { + return var1; + } + } + + private String setFromURL(String var1) { + this.useDefCoordinates = true; + int var2 = var1.lastIndexOf(35); + int var4; + if (var2 >= 0) { + String var3 = var1.substring(var2 + 1); + var1 = var1.substring(0, var2); + var4 = var3.lastIndexOf(64); + if (var4 < 0) { + this.targetRoomName = var3; + } else { + this.useDefCoordinates = false; + this.targetRoomName = var3.substring(0, var4); + this.tempParseStr = var3.substring(var4 + 1); + this.targetCoords.x = this.getNextFloat(this.targetCoords.x); + this.targetCoords.y = this.getNextFloat(this.targetCoords.y); + this.targetCoords.z = this.getNextFloat(this.targetCoords.z); + this.targetRot = this.getNextFloat(this.targetRot); + this.targetAxis.x = this.getNextFloat(this.targetAxis.x); + this.targetAxis.y = this.getNextFloat(this.targetAxis.y); + this.targetAxis.z = this.getNextFloat(this.targetAxis.z); + this.tempParseStr = null; + } + } + + if (this.targetRoomName != null) { + int var5 = this.targetRoomName.lastIndexOf(62); + var4 = this.targetRoomName.lastIndexOf(60); + if (var5 + 1 == this.targetRoomName.length() && var4 >= 0) { + this.targetDimension = this.targetRoomName.substring(var4 + 1, var5); + this.targetRoomName = this.targetRoomName.substring(0, var4); + } + } + + return var1; + } + + private void makeTeleportDialog(URL var1) { + if (this.showDialog) { + GammaFrame var2 = Console.getFrame(); + if (var2 != null && var2.isShowing()) { + this.dialog = new TeleportDialog(var2, this); + } + } + + } + + private void startTeleport() { + if (activeTeleport != null) { + if (activeTeleport.doneCallback != null) { + activeTeleport.doneCallback.teleportStatus("overridden by new teleport", activeTeleport.targetURL); + } + + activeTeleport.stopTeleport((String)null); + } + + activeTeleport = this; + Console.setFreezeFrameEvents(true); + this.done = false; + Console.teleportNotification("", this.targetURL); + if (this.targetWorldURL != null) { + this.makeTeleportDialog(this.targetWorldURL); + World.load(this.targetWorldURL, this, this.forceWorldLoad); + } else { + Pilot var1 = Pilot.getActive(); + World var2; + if (var1 != null && (var2 = var1.getWorld()) != null) { + this.makeTeleportDialog(var2.getSourceURL()); + this.loadedURLSelf(var2, this.targetWorldURL, (String)null); + } else { + this.stopTeleport("Pilot not in a room for intraworld teleport"); + } + } + + } + + private Room stopTeleport(String var1) { + assert(this == activeTeleport); + this.done = true; + activeTeleport = null; + Console.setFreezeFrameEvents(false); + if (this.doneCallback != null) { + this.doneCallback.teleportStatus(var1, this.targetURL); + } + + if (var1 != null && !this.forceNoWorldLoad) { + Console.teleportNotification(var1, this.targetURL); + Console.println(var1); + } + + if (this.dialog != null) { + this.dialog.closeIt(true); + this.dialog = null; + } + + return null; + } + + public synchronized void dialogDone(Object var1, boolean var2) { + if (activeTeleport != null) { + activeTeleport.stopTeleport((String)null); + } + + } + + public static String getReadableNameOfWorld(URL var0) { + String var1 = var0.getAbsolute(); + String var2 = var1; + String var3 = null; + if (var1.startsWith("home:") && var1.length() > 6) { + var2 = var1.substring(var1.charAt(5) == '/' ? 6 : 5); + int var4 = var2.indexOf(47); + if (var4 > 0) { + var3 = var2.substring(0, var4); + if (var2.regionMatches(true, var4 + 1, var2, 0, var4)) { + var2 = var3; + String var5 = WorldsMarkPart.getExternalName(var3); + if (var5 != null) { + var2 = var5; + } + } + } + + int var6 = var2.indexOf(".world"); + if (var6 > 0) { + var2 = var2.substring(0, var6); + } + + var2 = "the " + var2 + " world"; + } + + return var2; + } + + public static String getPackageNameOfWorld(URL var0) { + String var1 = var0.getAbsolute(); + String var3 = null; + if (var1.startsWith("home:") && var1.length() > 6) { + String var2 = var1.substring(var1.charAt(5) == '/' ? 6 : 5); + int var4 = var2.indexOf(47); + if (var4 > 0) { + var3 = var2.substring(0, var4); + } + } + + return var3; + } + + public void loadedURLSelf(URLSelf var1, URL var2, String var3) { + if (activeTeleport != this) { + if (var1 != null) { + var1.decRef(); + } + + } else { + String var4; + if (var3 == null && var1 instanceof World) { + var4 = this.targetRoomName; + if (var4 == null) { + var4 = ((World)var1).getDefaultRoomName(); + } + + Room var7 = ((World)var1).getRoom(var4); + if (var7 == null) { + this.stopTeleport("Error finding room " + this.targetRoomName); + } else if (var7.getVIPOnly() && !((World)var1).getConsole().getVIP()) { + this.stopTeleport("Only VIPs may go there."); + if (this.forceNoWorldLoad) { + Console.println(Console.message("Only-VIPs-there")); + } + + } else { + Console.teleportNotification((String)null, this.targetURL); + Pilot var8 = Pilot.changeActiveRoom(var7); + if (this.targetDimension != null) { + var8.changeChannel(this.targetDimension); + } + + var8.makeIdentity(); + if (this.useDefCoordinates) { + var8.moveTo(var7.getDefaultPosition()).spin(var7.getDefaultOrientationAxis(), var7.getDefaultOrientation()); + } else { + var8.moveTo(this.targetCoords).spin(this.targetAxis, this.targetRot); + } + + this.stopTeleport((String)null); + } + } else { + if (var3 == null) { + var3 = "file " + var2 + " doesn't contain a World"; + var1.decRef(); + } + + var4 = getReadableNameOfWorld(var2); + String var5 = getPackageNameOfWorld(var2); + Object[] var6 = new Object[]{new String(var4)}; + this.stopTeleport(MessageFormat.format(Console.message("cant-teleport"), var6)); + if (var5 != null && !this.forceNoWorldLoad) { + NetUpdate.loadWorld(var5, this.forceWorldLoad); + } + + } + } + } + + public Object properties(int var1, int var2, int var3, Object var4) throws NoSuchPropertyException { + Object var5 = null; + switch(var1 - var2) { + case 0: + if (var3 == 0) { + var5 = Point3PropertyEditor.make(new Property(this, var1, "X, Y, Z")); + } else if (var3 == 1) { + var5 = new Point3(this.targetCoords); + } else if (var3 == 2) { + this.targetCoords.copy((Point3)var4); + } + break; + case 1: + if (var3 == 0) { + var5 = FloatPropertyEditor.make(new Property(this, var1, "Dir")); + } else if (var3 == 1) { + var5 = new Float(this.targetRot); + } else if (var3 == 2) { + this.targetRot = ((Float)var4).floatValue(); + } + break; + case 2: + if (var3 == 0) { + var5 = StringPropertyEditor.make((new Property(this, var1, "Room Name")).allowSetNull()); + } else if (var3 == 1) { + if (this.targetRoomName == null) { + var5 = ""; + } else { + var5 = new String(this.targetRoomName); + } + } else if (var3 == 2) { + this.targetRoomName = (String)var4; + this.stopLoading(); + } + break; + case 3: + if (var3 == 0) { + var5 = URLPropertyEditor.make((new Property(this, var1, "World URL")).allowSetNull(), "world"); + } else if (var3 == 1) { + var5 = this.targetWorldURL; + } else if (var3 == 2) { + this.targetWorldURL = (URL)var4; + this.stopLoading(); + } + break; + case 4: + if (var3 == 0) { + var5 = BooleanPropertyEditor.make(new Property(this, var1, "Use default coordinates"), "No", "Yes"); + } else if (var3 == 1) { + var5 = new Boolean(this.useDefCoordinates); + } else if (var3 == 2) { + this.useDefCoordinates = ((Boolean)var4).booleanValue(); + } + break; + case 5: + if (var3 == 0) { + var5 = StringPropertyEditor.make((new Property(this, var1, "Dimension Name")).allowSetNull()); + } else if (var3 == 1) { + if (this.targetDimension == null) { + var5 = ""; + } else { + var5 = new String(this.targetDimension); + } + } else if (var3 == 2) { + this.targetDimension = (String)var4; + if (this.targetDimension.equals("")) { + this.targetDimension = null; + } + + this.stopLoading(); + } + break; + case 6: + if (var3 == 0) { + var5 = BooleanPropertyEditor.make(new Property(this, var1, "Show dialog"), "No", "Yes"); + } else if (var3 == 1) { + var5 = new Boolean(this.showDialog); + } else if (var3 == 2) { + this.showDialog = ((Boolean)var4).booleanValue(); + } + break; + default: + var5 = super.properties(var1, var2 + 7, var3, var4); + } + + return var5; + } + + public void saveState(Saver var1) throws IOException { + var1.saveVersion(3, classCookie); + super.saveState(var1); + var1.save(this.targetCoords); + var1.saveFloat(this.targetRot); + var1.save(this.targetAxis); + var1.saveString(this.targetRoomName); + URL.save(var1, this.targetWorldURL); + var1.saveBoolean(this.useDefCoordinates); + var1.saveString(this.targetDimension); + } + + public void restoreState(Restorer var1) throws IOException, TooNewException { + int var2 = var1.restoreVersion(classCookie); + switch(var2) { + case 0: + super.restoreState(var1); + this.targetCoords = (Point3)var1.restore(); + this.targetRot = (float)var1.restoreInt(); + this.targetRoomName = var1.restoreString(); + this.targetWorldURL = URL.restore(var1, ".world"); + this.useDefCoordinates = var1.restoreBoolean(); + this.targetDimension = null; + break; + case 1: + case 2: + super.restoreState(var1); + this.targetCoords = (Point3)var1.restore(); + this.targetRot = var1.restoreFloat(); + this.targetAxis = (Point3)var1.restore(); + this.targetRoomName = var1.restoreString(); + this.targetWorldURL = URL.restore(var1, ".world"); + this.useDefCoordinates = var1.restoreBoolean(); + this.targetDimension = null; + break; + case 3: + super.restoreState(var1); + this.targetCoords = (Point3)var1.restore(); + this.targetRot = var1.restoreFloat(); + this.targetAxis = (Point3)var1.restore(); + this.targetRoomName = var1.restoreString(); + this.targetWorldURL = URL.restore(var1, ".world"); + this.useDefCoordinates = var1.restoreBoolean(); + this.targetDimension = var1.restoreString(); + break; + default: + throw new TooNewException(); + } + + if (var2 < 2 && this.targetAxis.x == 0.0F && this.targetAxis.y == 0.0F && this.targetAxis.z == 1.0F) { + this.targetAxis.z = -1.0F; + this.targetRot = 360.0F - this.targetRot; + } + + } + + public String toString() { + return super.toString() + "[" + this.asURL() + "]"; + } + + public String asURL() { + String var1; + if (this.targetWorldURL != null) { + var1 = this.targetWorldURL.getRelativeTo(this) + "#"; + } else { + var1 = "#"; + } + + if (this.targetRoomName != null) { + var1 = var1 + this.targetRoomName; + } + + if (this.targetDimension != null) { + var1 = var1 + "<" + this.targetDimension + ">"; + } + + if (!this.useDefCoordinates) { + var1 = var1 + "@" + this.targetCoords + "," + this.targetRot; + if (this.targetAxis.x != 0.0F || this.targetAxis.y != 0.0F || this.targetAxis.z != 1.0F) { + var1 = var1 + "," + this.targetAxis; + } + } - return url; - } + return var1; + } } diff -ruN a/1920/NET/worldsplus/ChatSaver.java b/1920/NET/worldsplus/ChatSaver.java --- a/1920/NET/worldsplus/ChatSaver.java 1969-12-31 18:00:00.000000000 -0600 +++ b/1920/NET/worldsplus/ChatSaver.java 2023-08-21 23:27:17.000000000 -0500 @@ -0,0 +1,68 @@ +package NET.worldsplus; + +import NET.worlds.console.Console; +import NET.worlds.core.IniFile; +import NET.worlds.network.URL; +import NET.worlds.scape.Pilot; + +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.Hashtable; + +public class ChatSaver { + + public static ChatSaver chatSaver; + private final static String folder = IniFile.modModules().getIniString("ChatFolder", "home:chats/"); + private boolean enabled = IniFile.modModules().getIniInt("LogChats", 1) == 1; + + public ChatSaver() { + if (chatSaver == null) { + System.out.println("Initialized ChatSaver module..."); + if (enabled) { + File fold = new File(URL.make(folder).unalias()); + if (!fold.exists()) { + fold.mkdir(); + } + } + chatSaver = this; + } + } + + private FileWriter grabWriter(String name) throws IOException { + String cname = stripInvalid(name); + File log = new File(URL.make(folder + cname + ".log").unalias()); + if (!log.exists()) log.createNewFile(); + FileWriter fw = new FileWriter(log, true); + return fw; + } + + public void saveChat(String user, String message) throws IOException { + if (enabled) { + FileWriter writer = grabWriter(Pilot.getActiveRoom().toString()); + writer.write("[" + getCurrentDate() + "] " + user + ": " + message); + writer.write(System.getProperty("line.separator")); + writer.close(); + } + } + + public void saveWhisper(String from, String to, String message) throws IOException { + if (enabled) { + FileWriter writer = grabWriter((from.equals(Console.getActive().getLongID()) ? to : from)); + writer.write("[" + getCurrentDate() + "] " + from + ": " + message); + writer.write(System.getProperty("line.separator")); + writer.close(); + } + } + + public String getCurrentDate() { + return new SimpleDateFormat("dd/MM/yyyy HH:mm:ss").format(new Date()); + } + + private static String stripInvalid(String s) { + return s.replaceAll("/(<[a-zA-Z0-9-_]+>)/i", ""); + } + +} diff -ruN a/1920/NET/worldsplus/WPlus.java b/1920/NET/worldsplus/WPlus.java --- a/1920/NET/worldsplus/WPlus.java 1969-12-31 18:00:00.000000000 -0600 +++ b/1920/NET/worldsplus/WPlus.java 2023-08-21 23:27:17.000000000 -0500 @@ -0,0 +1,19 @@ +package NET.worldsplus; + +import java.text.SimpleDateFormat; +import java.util.Date; + +public class WPlus { + + static final String dateTime = new SimpleDateFormat("dd.MM.yyyy_HH.mm.ss").format(new Date()); + private static final boolean dev = false; + + // Hardcoded for reasons, I SWEAR + public static String getVersion(){ + if (dev) { + return dateTime + "-dev"; + } else { + return "1.7.1"; + } + } +}