From c7a9d4a6bd53ed7d61731770f2f10e8b9fd435f9 Mon Sep 17 00:00:00 2001 From: Fuwn Date: Thu, 12 Feb 2026 22:33:32 -0800 Subject: Initial commit --- META-INF/MANIFEST.MF | 2 + NET/worlds/console/AboutDialog.java | 100 ++ NET/worlds/console/ActionDialog.java | 150 ++ NET/worlds/console/ActionsPart.java | 122 ++ NET/worlds/console/ActiveX.java | 147 ++ NET/worlds/console/AdBanner.java | 37 + NET/worlds/console/AdPart.java | 221 +++ NET/worlds/console/AddHandler.java | 90 + NET/worlds/console/AddNameDialog.java | 85 + NET/worlds/console/AnimationButton.java | 123 ++ NET/worlds/console/ArmyOfZombies.java | 120 ++ NET/worlds/console/AttributeList.java | 38 + NET/worlds/console/AttributeSortPanel.java | 160 ++ NET/worlds/console/AvMenu.java | 508 ++++++ NET/worlds/console/AvMenuItem.java | 19 + NET/worlds/console/AvMenuItemSortable.java | 15 + NET/worlds/console/AvatarDialog.java | 164 ++ NET/worlds/console/AvatarDialogCallback.java | 13 + NET/worlds/console/AvatarDialogTest.java | 43 + NET/worlds/console/BBAnimateDroneCommand.java | 54 + NET/worlds/console/BBAppearDroneCommand.java | 70 + NET/worlds/console/BBChatCommand.java | 37 + NET/worlds/console/BBDisappearDroneCommand.java | 37 + NET/worlds/console/BBDroneBitmapCommand.java | 55 + NET/worlds/console/BBDroneDeltaPosCommand.java | 71 + NET/worlds/console/BBMoveDroneCommand.java | 75 + NET/worlds/console/BBTeleportCommand.java | 82 + NET/worlds/console/BBWObjClickedCommand.java | 82 + NET/worlds/console/BackButton.java | 11 + NET/worlds/console/BlackBox.java | 389 ++++ NET/worlds/console/BlackBoxCallback.java | 5 + NET/worlds/console/BlackBoxCommand.java | 48 + NET/worlds/console/BlockingDialog.java | 47 + NET/worlds/console/BookmarkAddDialog.java | 36 + NET/worlds/console/BookmarkDeleteDialog.java | 138 ++ NET/worlds/console/BookmarkEditDialog.java | 146 ++ NET/worlds/console/BookmarkListDialog.java | 182 ++ NET/worlds/console/BookmarkMenuItem.java | 53 + NET/worlds/console/BootDialog.java | 83 + NET/worlds/console/CameraConveyor.java | 90 + NET/worlds/console/ChannelDialog.java | 84 + NET/worlds/console/ChatArea.java | 248 +++ NET/worlds/console/ChatDialog.java | 143 ++ NET/worlds/console/ChatPart.java | 72 + NET/worlds/console/ClassicSharedTextArea.java | 258 +++ NET/worlds/console/ColorFiller.java | 41 + NET/worlds/console/ConfirmDialog.java | 40 + NET/worlds/console/ConnectionRecord.java | 47 + NET/worlds/console/Console.java | 1542 ++++++++++++++++ NET/worlds/console/ConsoleLoader.java | 29 + NET/worlds/console/Conveyor.java | 60 + NET/worlds/console/Cursor.java | 218 +++ NET/worlds/console/DefaultConsole.java | 1999 +++++++++++++++++++++ NET/worlds/console/DialogDisabled.java | 5 + NET/worlds/console/DialogReceiver.java | 5 + NET/worlds/console/DuplexPart.java | 160 ++ NET/worlds/console/EMailPart.java | 11 + NET/worlds/console/EditNamesDialog.java | 143 ++ NET/worlds/console/EmoteHandler.java | 78 + NET/worlds/console/Escalator.java | 67 + NET/worlds/console/ExpireDialog.java | 48 + NET/worlds/console/ExposedPanel.java | 19 + NET/worlds/console/FileSaver.java | 77 + NET/worlds/console/FileSysDialog.java | 179 ++ NET/worlds/console/Filler.java | 25 + NET/worlds/console/FixedSizePanel.java | 43 + NET/worlds/console/FixedWidthPanel.java | 22 + NET/worlds/console/FocusPreservingTextField.java | 89 + NET/worlds/console/ForwardButton.java | 11 + NET/worlds/console/FourTilePanel.java | 229 +++ NET/worlds/console/FourTileSwapper.java | 25 + NET/worlds/console/FramePart.java | 15 + NET/worlds/console/FriendsListPart.java | 988 ++++++++++ NET/worlds/console/Gamma.java | 555 ++++++ NET/worlds/console/GammaFrame.java | 144 ++ NET/worlds/console/GammaFrameState.java | 232 +++ NET/worlds/console/GammaPhoneMonitor.java | 149 ++ NET/worlds/console/GammaTextArea.java | 923 ++++++++++ NET/worlds/console/GammaTextScrollbar.java | 22 + NET/worlds/console/GiftDialog.java | 45 + NET/worlds/console/IClassFactory.java | 123 ++ NET/worlds/console/IDispatch.java | 42 + NET/worlds/console/IEWebControlImp.java | 130 ++ NET/worlds/console/INetscapeRegistry.java | 18 + NET/worlds/console/IUnknown.java | 166 ++ NET/worlds/console/IWebBrowserApp.java | 26 + NET/worlds/console/IllegalPilotException.java | 12 + NET/worlds/console/ImageButtons.java | 392 ++++ NET/worlds/console/ImageButtonsCallback.java | 7 + NET/worlds/console/ImageCanvas.java | 193 ++ NET/worlds/console/InsetPanel.java | 30 + NET/worlds/console/InternetConnectionDialog.java | 79 + NET/worlds/console/InternetExplorer.java | 82 + NET/worlds/console/InventoryPart.java | 30 + NET/worlds/console/LanguageManager.java | 163 ++ NET/worlds/console/LocationDialog.java | 94 + NET/worlds/console/LogFile.java | 218 +++ NET/worlds/console/LogFileMailMessage.java | 22 + NET/worlds/console/LogMailDialog.java | 57 + NET/worlds/console/LoginWizard.java | 941 ++++++++++ NET/worlds/console/MailDialog.java | 107 ++ NET/worlds/console/MailDialogReceiver.java | 35 + NET/worlds/console/MailMessage.java | 297 +++ NET/worlds/console/Main.java | 93 + NET/worlds/console/MainCallback.java | 5 + NET/worlds/console/MainTerminalCallback.java | 5 + NET/worlds/console/MapFrame.java | 19 + NET/worlds/console/MapPart.java | 234 +++ NET/worlds/console/MapTile.java | 7 + NET/worlds/console/MoreFriendsDialog.java | 159 ++ NET/worlds/console/MoveablePolygon.java | 58 + NET/worlds/console/MultiLineLabel.java | 179 ++ NET/worlds/console/MuteListPart.java | 254 +++ NET/worlds/console/NSProtocolHandler.java | 36 + NET/worlds/console/NameListOwner.java | 13 + NET/worlds/console/Netscape.java | 55 + NET/worlds/console/NewSharedTextArea.java | 223 +++ NET/worlds/console/NoWebControlException.java | 12 + NET/worlds/console/OLEInvalidObjectException.java | 12 + NET/worlds/console/OkCancelDialog.java | 150 ++ NET/worlds/console/Overlay.java | 53 + NET/worlds/console/PersonalInfoDialog.java | 113 ++ NET/worlds/console/PersonalInfoDownload.java | 99 + NET/worlds/console/PolledDialog.java | 286 +++ NET/worlds/console/PolledDialogSaver.java | 31 + NET/worlds/console/ProgressBar.java | 142 ++ NET/worlds/console/ProxyServerDialog.java | 63 + NET/worlds/console/PublicObservable.java | 13 + NET/worlds/console/QuantizedCanvas.java | 9 + NET/worlds/console/QuantizedStackedLayout.java | 63 + NET/worlds/console/QuitDialog.java | 49 + NET/worlds/console/RealG2.java | 251 +++ NET/worlds/console/RemoveHandler.java | 93 + NET/worlds/console/RenderCanvas.java | 233 +++ NET/worlds/console/RenderCanvasOverlay.java | 129 ++ NET/worlds/console/RightMenu.java | 119 ++ NET/worlds/console/SavedAvAddDialog.java | 79 + NET/worlds/console/SavedAvDeleteDialog.java | 119 ++ NET/worlds/console/SavedAvMenuItem.java | 53 + NET/worlds/console/SavedAvPart.java | 155 ++ NET/worlds/console/ScapePicCanvas.java | 55 + NET/worlds/console/ScapePicImage.java | 37 + NET/worlds/console/ScapePicPanel.java | 150 ++ NET/worlds/console/SetNumVisibleAvs.java | 101 ++ NET/worlds/console/Shaper.java | 277 +++ NET/worlds/console/SharedTextArea.java | 39 + NET/worlds/console/SnapTool.java | 114 ++ NET/worlds/console/SnapToolPanel.java | 135 ++ NET/worlds/console/SplashCanvas.java | 126 ++ NET/worlds/console/SplashScreen.java | 53 + NET/worlds/console/StackedLayout.java | 69 + NET/worlds/console/Stair.java | 194 ++ NET/worlds/console/Staircase.java | 251 +++ NET/worlds/console/Startup.java | 12 + NET/worlds/console/StatMan.java | 58 + NET/worlds/console/StatMemNode.java | 105 ++ NET/worlds/console/StatNetMUNode.java | 92 + NET/worlds/console/StatNetNode.java | 23 + NET/worlds/console/StatNetRefNode.java | 106 ++ NET/worlds/console/StatRateNode.java | 66 + NET/worlds/console/StatTreeNode.java | 43 + NET/worlds/console/StatisticsRoot.java | 21 + NET/worlds/console/StatisticsWindow.java | 91 + NET/worlds/console/StyledTextCanvas.java | 209 +++ NET/worlds/console/TextCanvas.java | 82 + NET/worlds/console/TextImageButtons.java | 77 + NET/worlds/console/TradeDialog.java | 526 ++++++ NET/worlds/console/Tree.java | 282 +++ NET/worlds/console/TreeCallback.java | 7 + NET/worlds/console/TreeNode.java | 64 + NET/worlds/console/TreePanel.java | 315 ++++ NET/worlds/console/URLLine.java | 184 ++ NET/worlds/console/UniverseImage.java | 24 + NET/worlds/console/UniversePanel.java | 407 +++++ NET/worlds/console/UnpaddedLabel.java | 22 + NET/worlds/console/UpdateableDialog.java | 170 ++ NET/worlds/console/UserInventoryCallback.java | 26 + NET/worlds/console/VCTimerThread.java | 24 + NET/worlds/console/VoiceChat.java | 395 ++++ NET/worlds/console/WebBrowser.java | 340 ++++ NET/worlds/console/WebControl.java | 91 + NET/worlds/console/WebControlFactory.java | 12 + NET/worlds/console/WebControlImp.java | 122 ++ NET/worlds/console/WebControlListener.java | 5 + NET/worlds/console/WhisperDialog.java | 135 ++ NET/worlds/console/WhisperManager.java | 143 ++ NET/worlds/console/WhisperPart.java | 21 + NET/worlds/console/WideScrollPane.java | 32 + NET/worlds/console/WiderScrollbar.java | 22 + NET/worlds/console/Window.java | 195 ++ NET/worlds/console/WindowNotFoundException.java | 12 + NET/worlds/console/WorldButton.java | 125 ++ NET/worlds/console/WorldButtonBullet.java | 74 + NET/worlds/console/WorldsMarkPart.java | 647 +++++++ NET/worlds/console/YesNoCancelDialog.java | 89 + NET/worlds/core/Archive.java | 224 +++ NET/worlds/core/ArchiveMaker.java | 376 ++++ NET/worlds/core/AssertionException.java | 12 + NET/worlds/core/Debug.java | 13 + NET/worlds/core/FastDataInput.java | 70 + NET/worlds/core/Hashtable.java | 105 ++ NET/worlds/core/IniFile.java | 55 + NET/worlds/core/Recycler.java | 19 + NET/worlds/core/RegKey.java | 50 + NET/worlds/core/RegKeyNotFoundException.java | 12 + NET/worlds/core/ServerTableManager.java | 278 +++ NET/worlds/core/Sort.java | 91 + NET/worlds/core/Std.java | 191 ++ NET/worlds/core/Std_A.java | 4 + NET/worlds/core/Std_B.java | 4 + NET/worlds/core/Std_IA.java | 4 + NET/worlds/core/Std_IB.java | 4 + NET/worlds/core/SystemInfo.java | 114 ++ NET/worlds/core/TestInstanceOf.java | 45 + NET/worlds/core/Timer.java | 21 + NET/worlds/core/TimerCallback.java | 5 + NET/worlds/network/AnonRoomServer.java | 78 + NET/worlds/network/AnonUserServer.java | 75 + NET/worlds/network/AutoServer.java | 85 + NET/worlds/network/BuddyListNotifyCmd.java | 30 + NET/worlds/network/BuddyListUpdateCmd.java | 32 + NET/worlds/network/Cache.java | 385 ++++ NET/worlds/network/CacheEntry.java | 479 +++++ NET/worlds/network/CacheFile.java | 91 + NET/worlds/network/ChannelCmd.java | 29 + NET/worlds/network/ConnectionWaiter.java | 5 + NET/worlds/network/DDEMLClass.java | 23 + NET/worlds/network/DNSLookup.java | 132 ++ NET/worlds/network/DirTimeStamp.java | 102 ++ NET/worlds/network/ExceptionCmd.java | 26 + NET/worlds/network/FilthFilter.java | 210 +++ NET/worlds/network/FilthyPhrase.java | 80 + NET/worlds/network/FingerReplyCmd.java | 29 + NET/worlds/network/FingerReqCmd.java | 33 + NET/worlds/network/Galaxy.java | 768 ++++++++ NET/worlds/network/IPhone.java | 121 ++ NET/worlds/network/InfiniteWaitException.java | 12 + NET/worlds/network/InvalidServerURLException.java | 12 + NET/worlds/network/LoginMode.java | 9 + NET/worlds/network/NetUpdate.java | 919 ++++++++++ NET/worlds/network/NetworkMulti.java | 106 ++ NET/worlds/network/NetworkNobody.java | 67 + NET/worlds/network/NetworkObject.java | 19 + NET/worlds/network/NetworkRoom.java | 483 +++++ NET/worlds/network/NewVersionDialog.java | 83 + NET/worlds/network/ObjID.java | 66 + NET/worlds/network/ObjectMgr.java | 70 + NET/worlds/network/OldPropertyList.java | 75 + NET/worlds/network/P17UserServer.java | 12 + NET/worlds/network/PacketTooLargeException.java | 14 + NET/worlds/network/ProgressBar.java | 78 + NET/worlds/network/ProgressDialog.java | 223 +++ NET/worlds/network/PropertyList.java | 84 + NET/worlds/network/PropertySetCmd.java | 58 + NET/worlds/network/PropertyUpdateCmd.java | 33 + NET/worlds/network/RedirectCmd.java | 40 + NET/worlds/network/RedirectIDCmd.java | 31 + NET/worlds/network/RemoteFileConst.java | 7 + NET/worlds/network/RoomMgr.java | 82 + NET/worlds/network/RoomServer.java | 68 + NET/worlds/network/SMState.java | 59 + NET/worlds/network/ServerInputStream.java | 248 +++ NET/worlds/network/ServerOutputStream.java | 97 + NET/worlds/network/ServerTracker.java | 202 +++ NET/worlds/network/ServerURL.java | 59 + NET/worlds/network/SubscribeDistCmd.java | 32 + NET/worlds/network/SubscribeRoomCmd.java | 42 + NET/worlds/network/Timer.java | 21 + NET/worlds/network/URL.java | 604 +++++++ NET/worlds/network/UnsubscribeRoomCmd.java | 29 + NET/worlds/network/UpgradeDialog.java | 246 +++ NET/worlds/network/UserServer.java | 73 + NET/worlds/network/VarErrorException.java | 171 ++ NET/worlds/network/WSConnecting.java | 147 ++ NET/worlds/network/WaitList.java | 48 + NET/worlds/network/WorldServer.java | 1319 ++++++++++++++ NET/worlds/network/appInitCmd.java | 37 + NET/worlds/network/appearActorCmd.java | 42 + NET/worlds/network/disappearActorCmd.java | 29 + NET/worlds/network/longLocCmd.java | 65 + NET/worlds/network/net2Property.java | 171 ++ NET/worlds/network/netCmds.java | 68 + NET/worlds/network/netConst.java | 94 + NET/worlds/network/netData.java | 114 ++ NET/worlds/network/netPacket.java | 58 + NET/worlds/network/netPacketReader.java | 160 ++ NET/worlds/network/netProperty.java | 50 + NET/worlds/network/propCmd.java | 58 + NET/worlds/network/propReqCmd.java | 50 + NET/worlds/network/receivedNetPacket.java | 20 + NET/worlds/network/regObjIDCmd.java | 29 + NET/worlds/network/roomChangeCmd.java | 77 + NET/worlds/network/roomIDCmd.java | 29 + NET/worlds/network/roomIDReqCmd.java | 29 + NET/worlds/network/sessionExitCmd.java | 37 + NET/worlds/network/sessionInitCmd.java | 120 ++ NET/worlds/network/shortLocCmd.java | 45 + NET/worlds/network/teleportCmd.java | 103 ++ NET/worlds/network/textCmd.java | 141 ++ NET/worlds/network/whisperCmd.java | 66 + NET/worlds/scape/ASFSoundPlayer.java | 108 ++ NET/worlds/scape/ASFThread.java | 83 + NET/worlds/scape/Action.java | 70 + NET/worlds/scape/Action_Animation.java | 24 + NET/worlds/scape/Action_Motion.java | 38 + NET/worlds/scape/Action_Toggle.java | 23 + NET/worlds/scape/AddObjectAction.java | 69 + NET/worlds/scape/AdvancingAction.java | 114 ++ NET/worlds/scape/Animatable.java | 7 + NET/worlds/scape/AnimateAction.java | 202 +++ NET/worlds/scape/AnimatedAction.java | 203 +++ NET/worlds/scape/AnimatedActionCallback.java | 5 + NET/worlds/scape/AnimatedActionHandler.java | 9 + NET/worlds/scape/AnimatedActionHandlerImp.java | 37 + NET/worlds/scape/AnimatedActionManager.java | 329 ++++ NET/worlds/scape/AnimatingDoor.java | 301 ++++ NET/worlds/scape/Animation.java | 285 +++ NET/worlds/scape/Attribute.java | 383 ++++ NET/worlds/scape/AudibilityFilter.java | 292 +++ NET/worlds/scape/AudibleParams.java | 8 + NET/worlds/scape/BGLoaded.java | 11 + NET/worlds/scape/BackgroundLoader.java | 95 + NET/worlds/scape/BackgroundLoaderElement.java | 87 + NET/worlds/scape/BackgroundLoaderQueue.java | 158 ++ NET/worlds/scape/BackgroundLoaderVector.java | 16 + NET/worlds/scape/BadFormatException.java | 10 + NET/worlds/scape/Billboard.java | 428 +++++ NET/worlds/scape/BizCard.java | 126 ++ NET/worlds/scape/BooleanFieldEditorDialog.java | 21 + NET/worlds/scape/BooleanPropertyEditor.java | 26 + NET/worlds/scape/BoundBoxTemp.java | 84 + NET/worlds/scape/BoxBumpCalc.java | 61 + NET/worlds/scape/BuildRamp.java | 310 ++++ NET/worlds/scape/BuildStairs.java | 248 +++ NET/worlds/scape/BumpAttribute.java | 56 + NET/worlds/scape/BumpCalc.java | 10 + NET/worlds/scape/BumpEventTemp.java | 151 ++ NET/worlds/scape/BumpHandler.java | 5 + NET/worlds/scape/BumpSensor.java | 21 + NET/worlds/scape/CDAudio.java | 518 ++++++ NET/worlds/scape/CDControl.java | 88 + NET/worlds/scape/CDDBConnection.java | 75 + NET/worlds/scape/CDDBHash.java | 76 + NET/worlds/scape/CDDBHost.java | 24 + NET/worlds/scape/CDDBLookup.java | 363 ++++ NET/worlds/scape/CDDBStatus.java | 52 + NET/worlds/scape/CDDiskInfo.java | 94 + NET/worlds/scape/CDPlayerAction.java | 258 +++ NET/worlds/scape/CDPositionEditorDialog.java | 33 + NET/worlds/scape/CDPositionPropertyEditor.java | 42 + NET/worlds/scape/CDTrackInfo.java | 82 + NET/worlds/scape/CallbackPropertyOperator.java | 44 + NET/worlds/scape/Camera.java | 357 ++++ NET/worlds/scape/CameraHeightAction.java | 75 + NET/worlds/scape/ChangeAvatarDialog.java | 60 + NET/worlds/scape/ChangeAvatarImageButtons.java | 42 + NET/worlds/scape/CheckboxEditorDialog.java | 64 + NET/worlds/scape/ClassProperty.java | 7 + NET/worlds/scape/ClickEventHandler.java | 13 + NET/worlds/scape/ClickSensor.java | 359 ++++ NET/worlds/scape/ClickWidget.java | 17 + NET/worlds/scape/ClipboardEntry.java | 44 + NET/worlds/scape/ColorAttribute.java | 81 + NET/worlds/scape/ColorEditorDialog.java | 68 + NET/worlds/scape/ColorPropertyEditor.java | 19 + NET/worlds/scape/CopyWidget.java | 14 + NET/worlds/scape/CrashAction.java | 56 + NET/worlds/scape/CutWidget.java | 14 + NET/worlds/scape/DPAction.java | 220 +++ NET/worlds/scape/DPLoadTracker.java | 44 + NET/worlds/scape/DPState.java | 118 ++ NET/worlds/scape/DeepEnumeration.java | 114 ++ NET/worlds/scape/DialogAction.java | 118 ++ NET/worlds/scape/DiffRoomSensor.java | 49 + NET/worlds/scape/DirectShow.java | 51 + NET/worlds/scape/DiskShadow.java | 61 + NET/worlds/scape/DispenserAction.java | 98 + NET/worlds/scape/DoorBasedFilter.java | 142 ++ NET/worlds/scape/DoorBasedParams.java | 10 + NET/worlds/scape/Drone.java | 864 +++++++++ NET/worlds/scape/DroneAnimator.java | 92 + NET/worlds/scape/DroneLoader.java | 80 + NET/worlds/scape/DropInfo.java | 19 + NET/worlds/scape/DynamicForwardAttribute.java | 172 ++ NET/worlds/scape/EditMusicDialog.java | 166 ++ NET/worlds/scape/EditRoomDialog.java | 122 ++ NET/worlds/scape/EditTile.java | 664 +++++++ NET/worlds/scape/EnumFieldEditorDialog.java | 23 + NET/worlds/scape/EnumProperties.java | 46 + NET/worlds/scape/EnumPropertyEditor.java | 47 + NET/worlds/scape/EquipAction.java | 35 + NET/worlds/scape/EquippableItem.java | 136 ++ NET/worlds/scape/Event.java | 74 + NET/worlds/scape/EventQueue.java | 125 ++ NET/worlds/scape/ExtensionFilter.java | 17 + NET/worlds/scape/Facer.java | 14 + NET/worlds/scape/FieldEditorDialog.java | 47 + NET/worlds/scape/FieldWithListEditorDialog.java | 83 + NET/worlds/scape/FileList.java | 132 ++ NET/worlds/scape/FileTexture.java | 50 + NET/worlds/scape/FileTextureDecoder.java | 15 + NET/worlds/scape/FloatArrayEditorDialog.java | 50 + NET/worlds/scape/FloatArrayPropertyEditor.java | 19 + NET/worlds/scape/FloatFieldEditorDialog.java | 34 + NET/worlds/scape/FloatPropertyEditor.java | 35 + NET/worlds/scape/FloorPatch.java | 9 + NET/worlds/scape/ForwardAttribute.java | 61 + NET/worlds/scape/FrameEvent.java | 44 + NET/worlds/scape/FrameHandler.java | 5 + NET/worlds/scape/FrameSensor.java | 18 + NET/worlds/scape/GravityAction.java | 189 ++ NET/worlds/scape/HTransWidget.java | 20 + NET/worlds/scape/Handler.java | 5 + NET/worlds/scape/HandsOffDriver.java | 175 ++ NET/worlds/scape/HighJump.java | 78 + NET/worlds/scape/HoloCallback.java | 5 + NET/worlds/scape/HoloDrone.java | 261 +++ NET/worlds/scape/HoloPilot.java | 579 ++++++ NET/worlds/scape/Hologram.java | 568 ++++++ NET/worlds/scape/HorizontalRect.java | 38 + NET/worlds/scape/Iconic.java | 9 + NET/worlds/scape/ImageConverter.java | 181 ++ NET/worlds/scape/IncrementalRestorer.java | 5 + NET/worlds/scape/IndentStream.java | 94 + NET/worlds/scape/IntegerFieldEditorDialog.java | 34 + NET/worlds/scape/IntegerPropertyEditor.java | 35 + NET/worlds/scape/InterpolatedDrone.java | 247 +++ NET/worlds/scape/InventoryAction.java | 28 + NET/worlds/scape/InventoryAvatar.java | 20 + NET/worlds/scape/InventoryCallback.java | 5 + NET/worlds/scape/InventoryDialog.java | 310 ++++ NET/worlds/scape/InventoryItem.java | 65 + NET/worlds/scape/InventoryList.java | 26 + NET/worlds/scape/InventoryManager.java | 315 ++++ NET/worlds/scape/ItemNotAvailableDialog.java | 42 + NET/worlds/scape/Key.java | 53 + NET/worlds/scape/KeyCharEvent.java | 12 + NET/worlds/scape/KeyCharHandler.java | 5 + NET/worlds/scape/KeyDownEvent.java | 12 + NET/worlds/scape/KeyDownHandler.java | 5 + NET/worlds/scape/KeyEvent.java | 19 + NET/worlds/scape/KeyHandler.java | 5 + NET/worlds/scape/KeyUpEvent.java | 12 + NET/worlds/scape/KeyUpHandler.java | 5 + NET/worlds/scape/LibEntContentEditorDialog.java | 131 ++ NET/worlds/scape/LibEntContentPropertyEditor.java | 18 + NET/worlds/scape/LibEventHandler.java | 5 + NET/worlds/scape/LibrariesTile.java | 374 ++++ NET/worlds/scape/Library.java | 191 ++ NET/worlds/scape/LibraryDrop.java | 5 + NET/worlds/scape/LibraryDropTarget.java | 4 + NET/worlds/scape/LibraryEntry.java | 141 ++ NET/worlds/scape/Light.java | 58 + NET/worlds/scape/ListAdderDialog.java | 84 + NET/worlds/scape/ListChooserDialog.java | 55 + NET/worlds/scape/ListEditorDialog.java | 36 + NET/worlds/scape/LoadedAttribute.java | 5 + NET/worlds/scape/LoadedURLSelf.java | 7 + NET/worlds/scape/MCISoundCommand.java | 14 + NET/worlds/scape/MCISoundPlayer.java | 161 ++ NET/worlds/scape/MCIThread.java | 44 + NET/worlds/scape/Manifest.java | 92 + NET/worlds/scape/Material.java | 783 ++++++++ NET/worlds/scape/MaterialTexture.java | 201 +++ NET/worlds/scape/MaybeNullDialog.java | 24 + NET/worlds/scape/MaybeNullPropertyEditor.java | 21 + NET/worlds/scape/MetaEnumeration.java | 38 + NET/worlds/scape/Mirror.java | 34 + NET/worlds/scape/MomentumBehavior.java | 7 + NET/worlds/scape/MontyDoor.java | 185 ++ NET/worlds/scape/MoreInfoDialog.java | 54 + NET/worlds/scape/Motion.java | 398 ++++ NET/worlds/scape/MouseButtonEvent.java | 15 + NET/worlds/scape/MouseButtonHandler.java | 5 + NET/worlds/scape/MouseDeltaEvent.java | 17 + NET/worlds/scape/MouseDeltaHandler.java | 5 + NET/worlds/scape/MouseDownEvent.java | 27 + NET/worlds/scape/MouseDownHandler.java | 5 + NET/worlds/scape/MouseDragEvent.java | 12 + NET/worlds/scape/MouseDragHandler.java | 5 + NET/worlds/scape/MouseEnterEvent.java | 12 + NET/worlds/scape/MouseEnterHandler.java | 5 + NET/worlds/scape/MouseEvent.java | 17 + NET/worlds/scape/MouseExitEvent.java | 12 + NET/worlds/scape/MouseExitHandler.java | 5 + NET/worlds/scape/MouseHandler.java | 5 + NET/worlds/scape/MouseMoveEvent.java | 12 + NET/worlds/scape/MouseMoveHandler.java | 5 + NET/worlds/scape/MousePositionEvent.java | 12 + NET/worlds/scape/MousePositionHandler.java | 5 + NET/worlds/scape/MouseUpEvent.java | 17 + NET/worlds/scape/MouseUpHandler.java | 5 + NET/worlds/scape/MoveAction.java | 444 +++++ NET/worlds/scape/MoveCameraAction.java | 85 + NET/worlds/scape/MultiManifestAction.java | 112 ++ NET/worlds/scape/MultiMotion.java | 531 ++++++ NET/worlds/scape/MusicManager.java | 258 +++ NET/worlds/scape/MusicManagerDialog.java | 397 ++++ NET/worlds/scape/MusicRoom.java | 32 + NET/worlds/scape/MusicTrack.java | 52 + NET/worlds/scape/MutedDrone.java | 46 + NET/worlds/scape/MyButton.java | 14 + NET/worlds/scape/NamedPortal.java | 33 + NET/worlds/scape/NametagDrone.java | 50 + NET/worlds/scape/NoSuchPropertyException.java | 4 + NET/worlds/scape/NonPersister.java | 4 + NET/worlds/scape/NotifyScriptAction.java | 57 + NET/worlds/scape/NumberAttribute.java | 81 + NET/worlds/scape/ObjEditorDialog.java | 12 + NET/worlds/scape/ObjPropertyEditor.java | 37 + NET/worlds/scape/ObjectAdderDialog.java | 12 + NET/worlds/scape/ObjectPropertyAdder.java | 42 + NET/worlds/scape/ObjectSelectorDialog.java | 91 + NET/worlds/scape/OpenURLAction.java | 124 ++ NET/worlds/scape/ParallelAction.java | 140 ++ NET/worlds/scape/PassthroughBumpCalc.java | 33 + NET/worlds/scape/PasteWidget.java | 14 + NET/worlds/scape/PathMoveAction.java | 24 + NET/worlds/scape/PendingCacheDrone.java | 66 + NET/worlds/scape/PendingDrone.java | 303 ++++ NET/worlds/scape/PeriodicTimeSensor.java | 80 + NET/worlds/scape/Persister.java | 11 + NET/worlds/scape/PickEvent.java | 19 + NET/worlds/scape/PickHandler.java | 5 + NET/worlds/scape/PickUpAction.java | 33 + NET/worlds/scape/Pilot.java | 853 +++++++++ NET/worlds/scape/PitchDriver.java | 196 ++ NET/worlds/scape/PitchWidget.java | 19 + NET/worlds/scape/PlaneBumpCalc.java | 65 + NET/worlds/scape/PlaybackRecordingAction.java | 59 + NET/worlds/scape/Point2.java | 129 ++ NET/worlds/scape/Point2EditorDialog.java | 66 + NET/worlds/scape/Point2PropertyEditor.java | 19 + NET/worlds/scape/Point3.java | 47 + NET/worlds/scape/Point3EditorDialog.java | 71 + NET/worlds/scape/Point3PropertyEditor.java | 19 + NET/worlds/scape/Point3Temp.java | 168 ++ NET/worlds/scape/Polygon.java | 75 + NET/worlds/scape/Portal.java | 831 +++++++++ NET/worlds/scape/PosableAction.java | 74 + NET/worlds/scape/PosableDrone.java | 197 ++ NET/worlds/scape/PosableDroneLoader.java | 84 + NET/worlds/scape/PosableShape.java | 1331 ++++++++++++++ NET/worlds/scape/Postrenderable.java | 5 + NET/worlds/scape/PostspinBehavior.java | 130 ++ NET/worlds/scape/Prerenderable.java | 5 + NET/worlds/scape/PrintAction.java | 71 + NET/worlds/scape/ProgressiveAdder.java | 49 + NET/worlds/scape/PropAdder.java | 48 + NET/worlds/scape/PropEditor.java | 18 + NET/worlds/scape/PropList.java | 119 ++ NET/worlds/scape/PropPropEditor.java | 27 + NET/worlds/scape/PropPropEditorDialog.java | 55 + NET/worlds/scape/PropTreeNode.java | 142 ++ NET/worlds/scape/Properties.java | 14 + NET/worlds/scape/Property.java | 153 ++ NET/worlds/scape/ProximitySensor.java | 149 ++ NET/worlds/scape/RPAction.java | 12 + NET/worlds/scape/Rect.java | 421 +++++ NET/worlds/scape/RectPatch.java | 401 +++++ NET/worlds/scape/Recycler.java | 75 + NET/worlds/scape/RelativeMoveAction.java | 196 ++ NET/worlds/scape/RemotePortal.java | 73 + NET/worlds/scape/RemoveObjectAction.java | 72 + NET/worlds/scape/RenderWare.java | 7 + NET/worlds/scape/Restorer.java | 430 +++++ NET/worlds/scape/RollBehavior.java | 79 + NET/worlds/scape/RollWidget.java | 21 + NET/worlds/scape/RollingAttribute.java | 188 ++ NET/worlds/scape/Room.java | 996 ++++++++++ NET/worlds/scape/RoomEnvironment.java | 116 ++ NET/worlds/scape/RoomSubscribeInfo.java | 15 + NET/worlds/scape/RunningActionCallback.java | 5 + NET/worlds/scape/RunningActionHandler.java | 153 ++ NET/worlds/scape/SameRoomSensor.java | 60 + NET/worlds/scape/SaveWidget.java | 31 + NET/worlds/scape/Saver.java | 174 ++ NET/worlds/scape/ScaleWidget.java | 23 + NET/worlds/scape/ScapePicMovie.java | 140 ++ NET/worlds/scape/ScapePicTexture.java | 94 + NET/worlds/scape/ScapePicTextureDecoder.java | 15 + NET/worlds/scape/ScrollingImagePanel.java | 398 ++++ NET/worlds/scape/ScrollingListElement.java | 17 + NET/worlds/scape/SelectAvatarAction.java | 152 ++ NET/worlds/scape/SendURLAction.java | 442 +++++ NET/worlds/scape/Sensor.java | 99 + NET/worlds/scape/SensorFrameHandler.java | 17 + NET/worlds/scape/SeqFile.java | 29 + NET/worlds/scape/SequenceAction.java | 135 ++ NET/worlds/scape/SequenceActionState.java | 91 + NET/worlds/scape/SetBooleanAction.java | 57 + NET/worlds/scape/SetColorAction.java | 108 ++ NET/worlds/scape/SetFloatAction.java | 82 + NET/worlds/scape/SetIntegerAction.java | 82 + NET/worlds/scape/SetPoint2Action.java | 115 ++ NET/worlds/scape/SetPoint3Action.java | 125 ++ NET/worlds/scape/SetPropertyAction.java | 270 +++ NET/worlds/scape/SetStringAction.java | 57 + NET/worlds/scape/SetURLAction.java | 68 + NET/worlds/scape/SetVisibleBumpableAction.java | 73 + NET/worlds/scape/SetZoomMode.java | 61 + NET/worlds/scape/Shadow.java | 5 + NET/worlds/scape/ShallowEnumeration.java | 38 + NET/worlds/scape/Shape.java | 557 ++++++ NET/worlds/scape/ShapeLoader.java | 113 ++ NET/worlds/scape/ShapeLoaderListener.java | 5 + NET/worlds/scape/ShapeTextureLoader.java | 27 + NET/worlds/scape/Sharer.java | 590 ++++++ NET/worlds/scape/SlidePropertyAction.java | 65 + NET/worlds/scape/SmoothDriver.java | 473 +++++ NET/worlds/scape/Sound.java | 623 +++++++ NET/worlds/scape/SoundCallback.java | 28 + NET/worlds/scape/SoundPlayer.java | 31 + NET/worlds/scape/SoundResource.java | 89 + NET/worlds/scape/SoundState.java | 307 ++++ NET/worlds/scape/SpinBehavior.java | 122 ++ NET/worlds/scape/StandardTexture.java | 45 + NET/worlds/scape/StandardTextureDecoder.java | 15 + NET/worlds/scape/StartupSensor.java | 41 + NET/worlds/scape/State.java | 5 + NET/worlds/scape/StateContext.java | 5 + NET/worlds/scape/StdoutAction.java | 96 + NET/worlds/scape/StopRecordingAction.java | 36 + NET/worlds/scape/StringAttribute.java | 81 + NET/worlds/scape/StringFieldEditorDialog.java | 31 + NET/worlds/scape/StringPropertyEditor.java | 19 + NET/worlds/scape/StringTexture.java | 103 ++ NET/worlds/scape/SubclumpShape.java | 47 + NET/worlds/scape/SuperRoot.java | 388 ++++ NET/worlds/scape/Surface.java | 190 ++ NET/worlds/scape/SwitchableBehavior.java | 62 + NET/worlds/scape/TCompressor.java | 465 +++++ NET/worlds/scape/TabbedDisplayPanel.java | 98 + NET/worlds/scape/TabbedPanel.java | 274 +++ NET/worlds/scape/TalkAction.java | 66 + NET/worlds/scape/Teleport.java | 122 ++ NET/worlds/scape/TeleportAction.java | 539 ++++++ NET/worlds/scape/TeleportDialog.java | 44 + NET/worlds/scape/TeleportStatus.java | 5 + NET/worlds/scape/Texture.java | 102 ++ NET/worlds/scape/TextureDecoder.java | 73 + NET/worlds/scape/TextureSurface.java | 85 + NET/worlds/scape/TextureSurfaceRenderer.java | 5 + NET/worlds/scape/Toggle.java | 165 ++ NET/worlds/scape/ToggleZoomMode.java | 20 + NET/worlds/scape/TooNewException.java | 10 + NET/worlds/scape/ToolBar.java | 238 +++ NET/worlds/scape/ToolTipManager.java | 102 ++ NET/worlds/scape/TradeAction.java | 151 ++ NET/worlds/scape/TrajectoryBehavior.java | 305 ++++ NET/worlds/scape/TransAttribute.java | 214 +++ NET/worlds/scape/Transform.java | 362 ++++ NET/worlds/scape/TransformEditorDialog.java | 341 ++++ NET/worlds/scape/TransformPropertyEditor.java | 19 + NET/worlds/scape/Trigger.java | 199 ++ NET/worlds/scape/TriggeredSwitchableBehavior.java | 11 + NET/worlds/scape/TwoWayPortal.java | 64 + NET/worlds/scape/URLEditorDialog.java | 54 + NET/worlds/scape/URLPropertyEditor.java | 73 + NET/worlds/scape/URLSelf.java | 13 + NET/worlds/scape/URLSelfLoader.java | 182 ++ NET/worlds/scape/UndoStack.java | 41 + NET/worlds/scape/UndoWidget.java | 14 + NET/worlds/scape/UndoabCopy.java | 14 + NET/worlds/scape/UndoablAdd.java | 21 + NET/worlds/scape/UndoablCut.java | 23 + NET/worlds/scape/UndoablDelete.java | 19 + NET/worlds/scape/UndoablPaste.java | 16 + NET/worlds/scape/UndoablSet.java | 17 + NET/worlds/scape/UndoablTransform.java | 16 + NET/worlds/scape/Undoable.java | 5 + NET/worlds/scape/UniqueHasher.java | 31 + NET/worlds/scape/UnitEnumeration.java | 23 + NET/worlds/scape/UniverseHandler.java | 66 + NET/worlds/scape/UserEvent.java | 12 + NET/worlds/scape/UserHandler.java | 5 + NET/worlds/scape/VTransWidget.java | 19 + NET/worlds/scape/ValueEvent.java | 15 + NET/worlds/scape/ValueHandler.java | 5 + NET/worlds/scape/VectorProperty.java | 76 + NET/worlds/scape/VehicleDriver.java | 653 +++++++ NET/worlds/scape/VehicleShape.java | 571 ++++++ NET/worlds/scape/VelocityBehavior.java | 260 +++ NET/worlds/scape/VideoControlAction.java | 115 ++ NET/worlds/scape/VideoManager.java | 29 + NET/worlds/scape/VideoSurface.java | 53 + NET/worlds/scape/VideoTexture.java | 232 +++ NET/worlds/scape/VideoWall.java | 191 ++ NET/worlds/scape/VisiAttribute.java | 56 + NET/worlds/scape/WMPSoundPlayer.java | 65 + NET/worlds/scape/WObject.java | 1450 +++++++++++++++ NET/worlds/scape/WObjectHighlighter.java | 52 + NET/worlds/scape/WaitAction.java | 91 + NET/worlds/scape/WaitActionState.java | 41 + NET/worlds/scape/WavSoundPlayer.java | 275 +++ NET/worlds/scape/WavSoundTerminator.java | 21 + NET/worlds/scape/WearAction.java | 339 ++++ NET/worlds/scape/WearWall.java | 223 +++ NET/worlds/scape/WebPageWall.java | 408 +++++ NET/worlds/scape/WebWallControlAction.java | 128 ++ NET/worlds/scape/Whiteboard.java | 96 + NET/worlds/scape/WidgetButton.java | 125 ++ NET/worlds/scape/WobClassLoader.java | 96 + NET/worlds/scape/WobLoaded.java | 5 + NET/worlds/scape/WobLoader.java | 107 ++ NET/worlds/scape/World.java | 1157 ++++++++++++ NET/worlds/scape/WorldRedirector.java | 79 + NET/worlds/scape/WorldScript.java | 47 + NET/worlds/scape/WorldScriptLoader.java | 109 ++ NET/worlds/scape/WorldScriptManager.java | 164 ++ NET/worlds/scape/WorldScriptToolkit.java | 100 ++ NET/worlds/scape/WorldScriptToolkitImp.java | 429 +++++ NET/worlds/scape/WorldValidator.java | 84 + NET/worlds/scape/WrRamp.java | 207 +++ NET/worlds/scape/WrRectPatch.java | 19 + NET/worlds/scape/WrStaircase.java | 137 ++ NET/worlds/scape/WrVisiRectPatch.java | 46 + NET/worlds/scape/YawWidget.java | 21 + NET/worlds/scape/sendURL.java | 156 ++ 719 files changed, 90348 insertions(+) create mode 100644 META-INF/MANIFEST.MF create mode 100644 NET/worlds/console/AboutDialog.java create mode 100644 NET/worlds/console/ActionDialog.java create mode 100644 NET/worlds/console/ActionsPart.java create mode 100644 NET/worlds/console/ActiveX.java create mode 100644 NET/worlds/console/AdBanner.java create mode 100644 NET/worlds/console/AdPart.java create mode 100644 NET/worlds/console/AddHandler.java create mode 100644 NET/worlds/console/AddNameDialog.java create mode 100644 NET/worlds/console/AnimationButton.java create mode 100644 NET/worlds/console/ArmyOfZombies.java create mode 100644 NET/worlds/console/AttributeList.java create mode 100644 NET/worlds/console/AttributeSortPanel.java create mode 100644 NET/worlds/console/AvMenu.java create mode 100644 NET/worlds/console/AvMenuItem.java create mode 100644 NET/worlds/console/AvMenuItemSortable.java create mode 100644 NET/worlds/console/AvatarDialog.java create mode 100644 NET/worlds/console/AvatarDialogCallback.java create mode 100644 NET/worlds/console/AvatarDialogTest.java create mode 100644 NET/worlds/console/BBAnimateDroneCommand.java create mode 100644 NET/worlds/console/BBAppearDroneCommand.java create mode 100644 NET/worlds/console/BBChatCommand.java create mode 100644 NET/worlds/console/BBDisappearDroneCommand.java create mode 100644 NET/worlds/console/BBDroneBitmapCommand.java create mode 100644 NET/worlds/console/BBDroneDeltaPosCommand.java create mode 100644 NET/worlds/console/BBMoveDroneCommand.java create mode 100644 NET/worlds/console/BBTeleportCommand.java create mode 100644 NET/worlds/console/BBWObjClickedCommand.java create mode 100644 NET/worlds/console/BackButton.java create mode 100644 NET/worlds/console/BlackBox.java create mode 100644 NET/worlds/console/BlackBoxCallback.java create mode 100644 NET/worlds/console/BlackBoxCommand.java create mode 100644 NET/worlds/console/BlockingDialog.java create mode 100644 NET/worlds/console/BookmarkAddDialog.java create mode 100644 NET/worlds/console/BookmarkDeleteDialog.java create mode 100644 NET/worlds/console/BookmarkEditDialog.java create mode 100644 NET/worlds/console/BookmarkListDialog.java create mode 100644 NET/worlds/console/BookmarkMenuItem.java create mode 100644 NET/worlds/console/BootDialog.java create mode 100644 NET/worlds/console/CameraConveyor.java create mode 100644 NET/worlds/console/ChannelDialog.java create mode 100644 NET/worlds/console/ChatArea.java create mode 100644 NET/worlds/console/ChatDialog.java create mode 100644 NET/worlds/console/ChatPart.java create mode 100644 NET/worlds/console/ClassicSharedTextArea.java create mode 100644 NET/worlds/console/ColorFiller.java create mode 100644 NET/worlds/console/ConfirmDialog.java create mode 100644 NET/worlds/console/ConnectionRecord.java create mode 100644 NET/worlds/console/Console.java create mode 100644 NET/worlds/console/ConsoleLoader.java create mode 100644 NET/worlds/console/Conveyor.java create mode 100644 NET/worlds/console/Cursor.java create mode 100644 NET/worlds/console/DefaultConsole.java create mode 100644 NET/worlds/console/DialogDisabled.java create mode 100644 NET/worlds/console/DialogReceiver.java create mode 100644 NET/worlds/console/DuplexPart.java create mode 100644 NET/worlds/console/EMailPart.java create mode 100644 NET/worlds/console/EditNamesDialog.java create mode 100644 NET/worlds/console/EmoteHandler.java create mode 100644 NET/worlds/console/Escalator.java create mode 100644 NET/worlds/console/ExpireDialog.java create mode 100644 NET/worlds/console/ExposedPanel.java create mode 100644 NET/worlds/console/FileSaver.java create mode 100644 NET/worlds/console/FileSysDialog.java create mode 100644 NET/worlds/console/Filler.java create mode 100644 NET/worlds/console/FixedSizePanel.java create mode 100644 NET/worlds/console/FixedWidthPanel.java create mode 100644 NET/worlds/console/FocusPreservingTextField.java create mode 100644 NET/worlds/console/ForwardButton.java create mode 100644 NET/worlds/console/FourTilePanel.java create mode 100644 NET/worlds/console/FourTileSwapper.java create mode 100644 NET/worlds/console/FramePart.java create mode 100644 NET/worlds/console/FriendsListPart.java create mode 100644 NET/worlds/console/Gamma.java create mode 100644 NET/worlds/console/GammaFrame.java create mode 100644 NET/worlds/console/GammaFrameState.java create mode 100644 NET/worlds/console/GammaPhoneMonitor.java create mode 100644 NET/worlds/console/GammaTextArea.java create mode 100644 NET/worlds/console/GammaTextScrollbar.java create mode 100644 NET/worlds/console/GiftDialog.java create mode 100644 NET/worlds/console/IClassFactory.java create mode 100644 NET/worlds/console/IDispatch.java create mode 100644 NET/worlds/console/IEWebControlImp.java create mode 100644 NET/worlds/console/INetscapeRegistry.java create mode 100644 NET/worlds/console/IUnknown.java create mode 100644 NET/worlds/console/IWebBrowserApp.java create mode 100644 NET/worlds/console/IllegalPilotException.java create mode 100644 NET/worlds/console/ImageButtons.java create mode 100644 NET/worlds/console/ImageButtonsCallback.java create mode 100644 NET/worlds/console/ImageCanvas.java create mode 100644 NET/worlds/console/InsetPanel.java create mode 100644 NET/worlds/console/InternetConnectionDialog.java create mode 100644 NET/worlds/console/InternetExplorer.java create mode 100644 NET/worlds/console/InventoryPart.java create mode 100644 NET/worlds/console/LanguageManager.java create mode 100644 NET/worlds/console/LocationDialog.java create mode 100644 NET/worlds/console/LogFile.java create mode 100644 NET/worlds/console/LogFileMailMessage.java create mode 100644 NET/worlds/console/LogMailDialog.java create mode 100644 NET/worlds/console/LoginWizard.java create mode 100644 NET/worlds/console/MailDialog.java create mode 100644 NET/worlds/console/MailDialogReceiver.java create mode 100644 NET/worlds/console/MailMessage.java create mode 100644 NET/worlds/console/Main.java create mode 100644 NET/worlds/console/MainCallback.java create mode 100644 NET/worlds/console/MainTerminalCallback.java create mode 100644 NET/worlds/console/MapFrame.java create mode 100644 NET/worlds/console/MapPart.java create mode 100644 NET/worlds/console/MapTile.java create mode 100644 NET/worlds/console/MoreFriendsDialog.java create mode 100644 NET/worlds/console/MoveablePolygon.java create mode 100644 NET/worlds/console/MultiLineLabel.java create mode 100644 NET/worlds/console/MuteListPart.java create mode 100644 NET/worlds/console/NSProtocolHandler.java create mode 100644 NET/worlds/console/NameListOwner.java create mode 100644 NET/worlds/console/Netscape.java create mode 100644 NET/worlds/console/NewSharedTextArea.java create mode 100644 NET/worlds/console/NoWebControlException.java create mode 100644 NET/worlds/console/OLEInvalidObjectException.java create mode 100644 NET/worlds/console/OkCancelDialog.java create mode 100644 NET/worlds/console/Overlay.java create mode 100644 NET/worlds/console/PersonalInfoDialog.java create mode 100644 NET/worlds/console/PersonalInfoDownload.java create mode 100644 NET/worlds/console/PolledDialog.java create mode 100644 NET/worlds/console/PolledDialogSaver.java create mode 100644 NET/worlds/console/ProgressBar.java create mode 100644 NET/worlds/console/ProxyServerDialog.java create mode 100644 NET/worlds/console/PublicObservable.java create mode 100644 NET/worlds/console/QuantizedCanvas.java create mode 100644 NET/worlds/console/QuantizedStackedLayout.java create mode 100644 NET/worlds/console/QuitDialog.java create mode 100644 NET/worlds/console/RealG2.java create mode 100644 NET/worlds/console/RemoveHandler.java create mode 100644 NET/worlds/console/RenderCanvas.java create mode 100644 NET/worlds/console/RenderCanvasOverlay.java create mode 100644 NET/worlds/console/RightMenu.java create mode 100644 NET/worlds/console/SavedAvAddDialog.java create mode 100644 NET/worlds/console/SavedAvDeleteDialog.java create mode 100644 NET/worlds/console/SavedAvMenuItem.java create mode 100644 NET/worlds/console/SavedAvPart.java create mode 100644 NET/worlds/console/ScapePicCanvas.java create mode 100644 NET/worlds/console/ScapePicImage.java create mode 100644 NET/worlds/console/ScapePicPanel.java create mode 100644 NET/worlds/console/SetNumVisibleAvs.java create mode 100644 NET/worlds/console/Shaper.java create mode 100644 NET/worlds/console/SharedTextArea.java create mode 100644 NET/worlds/console/SnapTool.java create mode 100644 NET/worlds/console/SnapToolPanel.java create mode 100644 NET/worlds/console/SplashCanvas.java create mode 100644 NET/worlds/console/SplashScreen.java create mode 100644 NET/worlds/console/StackedLayout.java create mode 100644 NET/worlds/console/Stair.java create mode 100644 NET/worlds/console/Staircase.java create mode 100644 NET/worlds/console/Startup.java create mode 100644 NET/worlds/console/StatMan.java create mode 100644 NET/worlds/console/StatMemNode.java create mode 100644 NET/worlds/console/StatNetMUNode.java create mode 100644 NET/worlds/console/StatNetNode.java create mode 100644 NET/worlds/console/StatNetRefNode.java create mode 100644 NET/worlds/console/StatRateNode.java create mode 100644 NET/worlds/console/StatTreeNode.java create mode 100644 NET/worlds/console/StatisticsRoot.java create mode 100644 NET/worlds/console/StatisticsWindow.java create mode 100644 NET/worlds/console/StyledTextCanvas.java create mode 100644 NET/worlds/console/TextCanvas.java create mode 100644 NET/worlds/console/TextImageButtons.java create mode 100644 NET/worlds/console/TradeDialog.java create mode 100644 NET/worlds/console/Tree.java create mode 100644 NET/worlds/console/TreeCallback.java create mode 100644 NET/worlds/console/TreeNode.java create mode 100644 NET/worlds/console/TreePanel.java create mode 100644 NET/worlds/console/URLLine.java create mode 100644 NET/worlds/console/UniverseImage.java create mode 100644 NET/worlds/console/UniversePanel.java create mode 100644 NET/worlds/console/UnpaddedLabel.java create mode 100644 NET/worlds/console/UpdateableDialog.java create mode 100644 NET/worlds/console/UserInventoryCallback.java create mode 100644 NET/worlds/console/VCTimerThread.java create mode 100644 NET/worlds/console/VoiceChat.java create mode 100644 NET/worlds/console/WebBrowser.java create mode 100644 NET/worlds/console/WebControl.java create mode 100644 NET/worlds/console/WebControlFactory.java create mode 100644 NET/worlds/console/WebControlImp.java create mode 100644 NET/worlds/console/WebControlListener.java create mode 100644 NET/worlds/console/WhisperDialog.java create mode 100644 NET/worlds/console/WhisperManager.java create mode 100644 NET/worlds/console/WhisperPart.java create mode 100644 NET/worlds/console/WideScrollPane.java create mode 100644 NET/worlds/console/WiderScrollbar.java create mode 100644 NET/worlds/console/Window.java create mode 100644 NET/worlds/console/WindowNotFoundException.java create mode 100644 NET/worlds/console/WorldButton.java create mode 100644 NET/worlds/console/WorldButtonBullet.java create mode 100644 NET/worlds/console/WorldsMarkPart.java create mode 100644 NET/worlds/console/YesNoCancelDialog.java create mode 100644 NET/worlds/core/Archive.java create mode 100644 NET/worlds/core/ArchiveMaker.java create mode 100644 NET/worlds/core/AssertionException.java create mode 100644 NET/worlds/core/Debug.java create mode 100644 NET/worlds/core/FastDataInput.java create mode 100644 NET/worlds/core/Hashtable.java create mode 100644 NET/worlds/core/IniFile.java create mode 100644 NET/worlds/core/Recycler.java create mode 100644 NET/worlds/core/RegKey.java create mode 100644 NET/worlds/core/RegKeyNotFoundException.java create mode 100644 NET/worlds/core/ServerTableManager.java create mode 100644 NET/worlds/core/Sort.java create mode 100644 NET/worlds/core/Std.java create mode 100644 NET/worlds/core/Std_A.java create mode 100644 NET/worlds/core/Std_B.java create mode 100644 NET/worlds/core/Std_IA.java create mode 100644 NET/worlds/core/Std_IB.java create mode 100644 NET/worlds/core/SystemInfo.java create mode 100644 NET/worlds/core/TestInstanceOf.java create mode 100644 NET/worlds/core/Timer.java create mode 100644 NET/worlds/core/TimerCallback.java create mode 100644 NET/worlds/network/AnonRoomServer.java create mode 100644 NET/worlds/network/AnonUserServer.java create mode 100644 NET/worlds/network/AutoServer.java create mode 100644 NET/worlds/network/BuddyListNotifyCmd.java create mode 100644 NET/worlds/network/BuddyListUpdateCmd.java create mode 100644 NET/worlds/network/Cache.java create mode 100644 NET/worlds/network/CacheEntry.java create mode 100644 NET/worlds/network/CacheFile.java create mode 100644 NET/worlds/network/ChannelCmd.java create mode 100644 NET/worlds/network/ConnectionWaiter.java create mode 100644 NET/worlds/network/DDEMLClass.java create mode 100644 NET/worlds/network/DNSLookup.java create mode 100644 NET/worlds/network/DirTimeStamp.java create mode 100644 NET/worlds/network/ExceptionCmd.java create mode 100644 NET/worlds/network/FilthFilter.java create mode 100644 NET/worlds/network/FilthyPhrase.java create mode 100644 NET/worlds/network/FingerReplyCmd.java create mode 100644 NET/worlds/network/FingerReqCmd.java create mode 100644 NET/worlds/network/Galaxy.java create mode 100644 NET/worlds/network/IPhone.java create mode 100644 NET/worlds/network/InfiniteWaitException.java create mode 100644 NET/worlds/network/InvalidServerURLException.java create mode 100644 NET/worlds/network/LoginMode.java create mode 100644 NET/worlds/network/NetUpdate.java create mode 100644 NET/worlds/network/NetworkMulti.java create mode 100644 NET/worlds/network/NetworkNobody.java create mode 100644 NET/worlds/network/NetworkObject.java create mode 100644 NET/worlds/network/NetworkRoom.java create mode 100644 NET/worlds/network/NewVersionDialog.java create mode 100644 NET/worlds/network/ObjID.java create mode 100644 NET/worlds/network/ObjectMgr.java create mode 100644 NET/worlds/network/OldPropertyList.java create mode 100644 NET/worlds/network/P17UserServer.java create mode 100644 NET/worlds/network/PacketTooLargeException.java create mode 100644 NET/worlds/network/ProgressBar.java create mode 100644 NET/worlds/network/ProgressDialog.java create mode 100644 NET/worlds/network/PropertyList.java create mode 100644 NET/worlds/network/PropertySetCmd.java create mode 100644 NET/worlds/network/PropertyUpdateCmd.java create mode 100644 NET/worlds/network/RedirectCmd.java create mode 100644 NET/worlds/network/RedirectIDCmd.java create mode 100644 NET/worlds/network/RemoteFileConst.java create mode 100644 NET/worlds/network/RoomMgr.java create mode 100644 NET/worlds/network/RoomServer.java create mode 100644 NET/worlds/network/SMState.java create mode 100644 NET/worlds/network/ServerInputStream.java create mode 100644 NET/worlds/network/ServerOutputStream.java create mode 100644 NET/worlds/network/ServerTracker.java create mode 100644 NET/worlds/network/ServerURL.java create mode 100644 NET/worlds/network/SubscribeDistCmd.java create mode 100644 NET/worlds/network/SubscribeRoomCmd.java create mode 100644 NET/worlds/network/Timer.java create mode 100644 NET/worlds/network/URL.java create mode 100644 NET/worlds/network/UnsubscribeRoomCmd.java create mode 100644 NET/worlds/network/UpgradeDialog.java create mode 100644 NET/worlds/network/UserServer.java create mode 100644 NET/worlds/network/VarErrorException.java create mode 100644 NET/worlds/network/WSConnecting.java create mode 100644 NET/worlds/network/WaitList.java create mode 100644 NET/worlds/network/WorldServer.java create mode 100644 NET/worlds/network/appInitCmd.java create mode 100644 NET/worlds/network/appearActorCmd.java create mode 100644 NET/worlds/network/disappearActorCmd.java create mode 100644 NET/worlds/network/longLocCmd.java create mode 100644 NET/worlds/network/net2Property.java create mode 100644 NET/worlds/network/netCmds.java create mode 100644 NET/worlds/network/netConst.java create mode 100644 NET/worlds/network/netData.java create mode 100644 NET/worlds/network/netPacket.java create mode 100644 NET/worlds/network/netPacketReader.java create mode 100644 NET/worlds/network/netProperty.java create mode 100644 NET/worlds/network/propCmd.java create mode 100644 NET/worlds/network/propReqCmd.java create mode 100644 NET/worlds/network/receivedNetPacket.java create mode 100644 NET/worlds/network/regObjIDCmd.java create mode 100644 NET/worlds/network/roomChangeCmd.java create mode 100644 NET/worlds/network/roomIDCmd.java create mode 100644 NET/worlds/network/roomIDReqCmd.java create mode 100644 NET/worlds/network/sessionExitCmd.java create mode 100644 NET/worlds/network/sessionInitCmd.java create mode 100644 NET/worlds/network/shortLocCmd.java create mode 100644 NET/worlds/network/teleportCmd.java create mode 100644 NET/worlds/network/textCmd.java create mode 100644 NET/worlds/network/whisperCmd.java create mode 100644 NET/worlds/scape/ASFSoundPlayer.java create mode 100644 NET/worlds/scape/ASFThread.java create mode 100644 NET/worlds/scape/Action.java create mode 100644 NET/worlds/scape/Action_Animation.java create mode 100644 NET/worlds/scape/Action_Motion.java create mode 100644 NET/worlds/scape/Action_Toggle.java create mode 100644 NET/worlds/scape/AddObjectAction.java create mode 100644 NET/worlds/scape/AdvancingAction.java create mode 100644 NET/worlds/scape/Animatable.java create mode 100644 NET/worlds/scape/AnimateAction.java create mode 100644 NET/worlds/scape/AnimatedAction.java create mode 100644 NET/worlds/scape/AnimatedActionCallback.java create mode 100644 NET/worlds/scape/AnimatedActionHandler.java create mode 100644 NET/worlds/scape/AnimatedActionHandlerImp.java create mode 100644 NET/worlds/scape/AnimatedActionManager.java create mode 100644 NET/worlds/scape/AnimatingDoor.java create mode 100644 NET/worlds/scape/Animation.java create mode 100644 NET/worlds/scape/Attribute.java create mode 100644 NET/worlds/scape/AudibilityFilter.java create mode 100644 NET/worlds/scape/AudibleParams.java create mode 100644 NET/worlds/scape/BGLoaded.java create mode 100644 NET/worlds/scape/BackgroundLoader.java create mode 100644 NET/worlds/scape/BackgroundLoaderElement.java create mode 100644 NET/worlds/scape/BackgroundLoaderQueue.java create mode 100644 NET/worlds/scape/BackgroundLoaderVector.java create mode 100644 NET/worlds/scape/BadFormatException.java create mode 100644 NET/worlds/scape/Billboard.java create mode 100644 NET/worlds/scape/BizCard.java create mode 100644 NET/worlds/scape/BooleanFieldEditorDialog.java create mode 100644 NET/worlds/scape/BooleanPropertyEditor.java create mode 100644 NET/worlds/scape/BoundBoxTemp.java create mode 100644 NET/worlds/scape/BoxBumpCalc.java create mode 100644 NET/worlds/scape/BuildRamp.java create mode 100644 NET/worlds/scape/BuildStairs.java create mode 100644 NET/worlds/scape/BumpAttribute.java create mode 100644 NET/worlds/scape/BumpCalc.java create mode 100644 NET/worlds/scape/BumpEventTemp.java create mode 100644 NET/worlds/scape/BumpHandler.java create mode 100644 NET/worlds/scape/BumpSensor.java create mode 100644 NET/worlds/scape/CDAudio.java create mode 100644 NET/worlds/scape/CDControl.java create mode 100644 NET/worlds/scape/CDDBConnection.java create mode 100644 NET/worlds/scape/CDDBHash.java create mode 100644 NET/worlds/scape/CDDBHost.java create mode 100644 NET/worlds/scape/CDDBLookup.java create mode 100644 NET/worlds/scape/CDDBStatus.java create mode 100644 NET/worlds/scape/CDDiskInfo.java create mode 100644 NET/worlds/scape/CDPlayerAction.java create mode 100644 NET/worlds/scape/CDPositionEditorDialog.java create mode 100644 NET/worlds/scape/CDPositionPropertyEditor.java create mode 100644 NET/worlds/scape/CDTrackInfo.java create mode 100644 NET/worlds/scape/CallbackPropertyOperator.java create mode 100644 NET/worlds/scape/Camera.java create mode 100644 NET/worlds/scape/CameraHeightAction.java create mode 100644 NET/worlds/scape/ChangeAvatarDialog.java create mode 100644 NET/worlds/scape/ChangeAvatarImageButtons.java create mode 100644 NET/worlds/scape/CheckboxEditorDialog.java create mode 100644 NET/worlds/scape/ClassProperty.java create mode 100644 NET/worlds/scape/ClickEventHandler.java create mode 100644 NET/worlds/scape/ClickSensor.java create mode 100644 NET/worlds/scape/ClickWidget.java create mode 100644 NET/worlds/scape/ClipboardEntry.java create mode 100644 NET/worlds/scape/ColorAttribute.java create mode 100644 NET/worlds/scape/ColorEditorDialog.java create mode 100644 NET/worlds/scape/ColorPropertyEditor.java create mode 100644 NET/worlds/scape/CopyWidget.java create mode 100644 NET/worlds/scape/CrashAction.java create mode 100644 NET/worlds/scape/CutWidget.java create mode 100644 NET/worlds/scape/DPAction.java create mode 100644 NET/worlds/scape/DPLoadTracker.java create mode 100644 NET/worlds/scape/DPState.java create mode 100644 NET/worlds/scape/DeepEnumeration.java create mode 100644 NET/worlds/scape/DialogAction.java create mode 100644 NET/worlds/scape/DiffRoomSensor.java create mode 100644 NET/worlds/scape/DirectShow.java create mode 100644 NET/worlds/scape/DiskShadow.java create mode 100644 NET/worlds/scape/DispenserAction.java create mode 100644 NET/worlds/scape/DoorBasedFilter.java create mode 100644 NET/worlds/scape/DoorBasedParams.java create mode 100644 NET/worlds/scape/Drone.java create mode 100644 NET/worlds/scape/DroneAnimator.java create mode 100644 NET/worlds/scape/DroneLoader.java create mode 100644 NET/worlds/scape/DropInfo.java create mode 100644 NET/worlds/scape/DynamicForwardAttribute.java create mode 100644 NET/worlds/scape/EditMusicDialog.java create mode 100644 NET/worlds/scape/EditRoomDialog.java create mode 100644 NET/worlds/scape/EditTile.java create mode 100644 NET/worlds/scape/EnumFieldEditorDialog.java create mode 100644 NET/worlds/scape/EnumProperties.java create mode 100644 NET/worlds/scape/EnumPropertyEditor.java create mode 100644 NET/worlds/scape/EquipAction.java create mode 100644 NET/worlds/scape/EquippableItem.java create mode 100644 NET/worlds/scape/Event.java create mode 100644 NET/worlds/scape/EventQueue.java create mode 100644 NET/worlds/scape/ExtensionFilter.java create mode 100644 NET/worlds/scape/Facer.java create mode 100644 NET/worlds/scape/FieldEditorDialog.java create mode 100644 NET/worlds/scape/FieldWithListEditorDialog.java create mode 100644 NET/worlds/scape/FileList.java create mode 100644 NET/worlds/scape/FileTexture.java create mode 100644 NET/worlds/scape/FileTextureDecoder.java create mode 100644 NET/worlds/scape/FloatArrayEditorDialog.java create mode 100644 NET/worlds/scape/FloatArrayPropertyEditor.java create mode 100644 NET/worlds/scape/FloatFieldEditorDialog.java create mode 100644 NET/worlds/scape/FloatPropertyEditor.java create mode 100644 NET/worlds/scape/FloorPatch.java create mode 100644 NET/worlds/scape/ForwardAttribute.java create mode 100644 NET/worlds/scape/FrameEvent.java create mode 100644 NET/worlds/scape/FrameHandler.java create mode 100644 NET/worlds/scape/FrameSensor.java create mode 100644 NET/worlds/scape/GravityAction.java create mode 100644 NET/worlds/scape/HTransWidget.java create mode 100644 NET/worlds/scape/Handler.java create mode 100644 NET/worlds/scape/HandsOffDriver.java create mode 100644 NET/worlds/scape/HighJump.java create mode 100644 NET/worlds/scape/HoloCallback.java create mode 100644 NET/worlds/scape/HoloDrone.java create mode 100644 NET/worlds/scape/HoloPilot.java create mode 100644 NET/worlds/scape/Hologram.java create mode 100644 NET/worlds/scape/HorizontalRect.java create mode 100644 NET/worlds/scape/Iconic.java create mode 100644 NET/worlds/scape/ImageConverter.java create mode 100644 NET/worlds/scape/IncrementalRestorer.java create mode 100644 NET/worlds/scape/IndentStream.java create mode 100644 NET/worlds/scape/IntegerFieldEditorDialog.java create mode 100644 NET/worlds/scape/IntegerPropertyEditor.java create mode 100644 NET/worlds/scape/InterpolatedDrone.java create mode 100644 NET/worlds/scape/InventoryAction.java create mode 100644 NET/worlds/scape/InventoryAvatar.java create mode 100644 NET/worlds/scape/InventoryCallback.java create mode 100644 NET/worlds/scape/InventoryDialog.java create mode 100644 NET/worlds/scape/InventoryItem.java create mode 100644 NET/worlds/scape/InventoryList.java create mode 100644 NET/worlds/scape/InventoryManager.java create mode 100644 NET/worlds/scape/ItemNotAvailableDialog.java create mode 100644 NET/worlds/scape/Key.java create mode 100644 NET/worlds/scape/KeyCharEvent.java create mode 100644 NET/worlds/scape/KeyCharHandler.java create mode 100644 NET/worlds/scape/KeyDownEvent.java create mode 100644 NET/worlds/scape/KeyDownHandler.java create mode 100644 NET/worlds/scape/KeyEvent.java create mode 100644 NET/worlds/scape/KeyHandler.java create mode 100644 NET/worlds/scape/KeyUpEvent.java create mode 100644 NET/worlds/scape/KeyUpHandler.java create mode 100644 NET/worlds/scape/LibEntContentEditorDialog.java create mode 100644 NET/worlds/scape/LibEntContentPropertyEditor.java create mode 100644 NET/worlds/scape/LibEventHandler.java create mode 100644 NET/worlds/scape/LibrariesTile.java create mode 100644 NET/worlds/scape/Library.java create mode 100644 NET/worlds/scape/LibraryDrop.java create mode 100644 NET/worlds/scape/LibraryDropTarget.java create mode 100644 NET/worlds/scape/LibraryEntry.java create mode 100644 NET/worlds/scape/Light.java create mode 100644 NET/worlds/scape/ListAdderDialog.java create mode 100644 NET/worlds/scape/ListChooserDialog.java create mode 100644 NET/worlds/scape/ListEditorDialog.java create mode 100644 NET/worlds/scape/LoadedAttribute.java create mode 100644 NET/worlds/scape/LoadedURLSelf.java create mode 100644 NET/worlds/scape/MCISoundCommand.java create mode 100644 NET/worlds/scape/MCISoundPlayer.java create mode 100644 NET/worlds/scape/MCIThread.java create mode 100644 NET/worlds/scape/Manifest.java create mode 100644 NET/worlds/scape/Material.java create mode 100644 NET/worlds/scape/MaterialTexture.java create mode 100644 NET/worlds/scape/MaybeNullDialog.java create mode 100644 NET/worlds/scape/MaybeNullPropertyEditor.java create mode 100644 NET/worlds/scape/MetaEnumeration.java create mode 100644 NET/worlds/scape/Mirror.java create mode 100644 NET/worlds/scape/MomentumBehavior.java create mode 100644 NET/worlds/scape/MontyDoor.java create mode 100644 NET/worlds/scape/MoreInfoDialog.java create mode 100644 NET/worlds/scape/Motion.java create mode 100644 NET/worlds/scape/MouseButtonEvent.java create mode 100644 NET/worlds/scape/MouseButtonHandler.java create mode 100644 NET/worlds/scape/MouseDeltaEvent.java create mode 100644 NET/worlds/scape/MouseDeltaHandler.java create mode 100644 NET/worlds/scape/MouseDownEvent.java create mode 100644 NET/worlds/scape/MouseDownHandler.java create mode 100644 NET/worlds/scape/MouseDragEvent.java create mode 100644 NET/worlds/scape/MouseDragHandler.java create mode 100644 NET/worlds/scape/MouseEnterEvent.java create mode 100644 NET/worlds/scape/MouseEnterHandler.java create mode 100644 NET/worlds/scape/MouseEvent.java create mode 100644 NET/worlds/scape/MouseExitEvent.java create mode 100644 NET/worlds/scape/MouseExitHandler.java create mode 100644 NET/worlds/scape/MouseHandler.java create mode 100644 NET/worlds/scape/MouseMoveEvent.java create mode 100644 NET/worlds/scape/MouseMoveHandler.java create mode 100644 NET/worlds/scape/MousePositionEvent.java create mode 100644 NET/worlds/scape/MousePositionHandler.java create mode 100644 NET/worlds/scape/MouseUpEvent.java create mode 100644 NET/worlds/scape/MouseUpHandler.java create mode 100644 NET/worlds/scape/MoveAction.java create mode 100644 NET/worlds/scape/MoveCameraAction.java create mode 100644 NET/worlds/scape/MultiManifestAction.java create mode 100644 NET/worlds/scape/MultiMotion.java create mode 100644 NET/worlds/scape/MusicManager.java create mode 100644 NET/worlds/scape/MusicManagerDialog.java create mode 100644 NET/worlds/scape/MusicRoom.java create mode 100644 NET/worlds/scape/MusicTrack.java create mode 100644 NET/worlds/scape/MutedDrone.java create mode 100644 NET/worlds/scape/MyButton.java create mode 100644 NET/worlds/scape/NamedPortal.java create mode 100644 NET/worlds/scape/NametagDrone.java create mode 100644 NET/worlds/scape/NoSuchPropertyException.java create mode 100644 NET/worlds/scape/NonPersister.java create mode 100644 NET/worlds/scape/NotifyScriptAction.java create mode 100644 NET/worlds/scape/NumberAttribute.java create mode 100644 NET/worlds/scape/ObjEditorDialog.java create mode 100644 NET/worlds/scape/ObjPropertyEditor.java create mode 100644 NET/worlds/scape/ObjectAdderDialog.java create mode 100644 NET/worlds/scape/ObjectPropertyAdder.java create mode 100644 NET/worlds/scape/ObjectSelectorDialog.java create mode 100644 NET/worlds/scape/OpenURLAction.java create mode 100644 NET/worlds/scape/ParallelAction.java create mode 100644 NET/worlds/scape/PassthroughBumpCalc.java create mode 100644 NET/worlds/scape/PasteWidget.java create mode 100644 NET/worlds/scape/PathMoveAction.java create mode 100644 NET/worlds/scape/PendingCacheDrone.java create mode 100644 NET/worlds/scape/PendingDrone.java create mode 100644 NET/worlds/scape/PeriodicTimeSensor.java create mode 100644 NET/worlds/scape/Persister.java create mode 100644 NET/worlds/scape/PickEvent.java create mode 100644 NET/worlds/scape/PickHandler.java create mode 100644 NET/worlds/scape/PickUpAction.java create mode 100644 NET/worlds/scape/Pilot.java create mode 100644 NET/worlds/scape/PitchDriver.java create mode 100644 NET/worlds/scape/PitchWidget.java create mode 100644 NET/worlds/scape/PlaneBumpCalc.java create mode 100644 NET/worlds/scape/PlaybackRecordingAction.java create mode 100644 NET/worlds/scape/Point2.java create mode 100644 NET/worlds/scape/Point2EditorDialog.java create mode 100644 NET/worlds/scape/Point2PropertyEditor.java create mode 100644 NET/worlds/scape/Point3.java create mode 100644 NET/worlds/scape/Point3EditorDialog.java create mode 100644 NET/worlds/scape/Point3PropertyEditor.java create mode 100644 NET/worlds/scape/Point3Temp.java create mode 100644 NET/worlds/scape/Polygon.java create mode 100644 NET/worlds/scape/Portal.java create mode 100644 NET/worlds/scape/PosableAction.java create mode 100644 NET/worlds/scape/PosableDrone.java create mode 100644 NET/worlds/scape/PosableDroneLoader.java create mode 100644 NET/worlds/scape/PosableShape.java create mode 100644 NET/worlds/scape/Postrenderable.java create mode 100644 NET/worlds/scape/PostspinBehavior.java create mode 100644 NET/worlds/scape/Prerenderable.java create mode 100644 NET/worlds/scape/PrintAction.java create mode 100644 NET/worlds/scape/ProgressiveAdder.java create mode 100644 NET/worlds/scape/PropAdder.java create mode 100644 NET/worlds/scape/PropEditor.java create mode 100644 NET/worlds/scape/PropList.java create mode 100644 NET/worlds/scape/PropPropEditor.java create mode 100644 NET/worlds/scape/PropPropEditorDialog.java create mode 100644 NET/worlds/scape/PropTreeNode.java create mode 100644 NET/worlds/scape/Properties.java create mode 100644 NET/worlds/scape/Property.java create mode 100644 NET/worlds/scape/ProximitySensor.java create mode 100644 NET/worlds/scape/RPAction.java create mode 100644 NET/worlds/scape/Rect.java create mode 100644 NET/worlds/scape/RectPatch.java create mode 100644 NET/worlds/scape/Recycler.java create mode 100644 NET/worlds/scape/RelativeMoveAction.java create mode 100644 NET/worlds/scape/RemotePortal.java create mode 100644 NET/worlds/scape/RemoveObjectAction.java create mode 100644 NET/worlds/scape/RenderWare.java create mode 100644 NET/worlds/scape/Restorer.java create mode 100644 NET/worlds/scape/RollBehavior.java create mode 100644 NET/worlds/scape/RollWidget.java create mode 100644 NET/worlds/scape/RollingAttribute.java create mode 100644 NET/worlds/scape/Room.java create mode 100644 NET/worlds/scape/RoomEnvironment.java create mode 100644 NET/worlds/scape/RoomSubscribeInfo.java create mode 100644 NET/worlds/scape/RunningActionCallback.java create mode 100644 NET/worlds/scape/RunningActionHandler.java create mode 100644 NET/worlds/scape/SameRoomSensor.java create mode 100644 NET/worlds/scape/SaveWidget.java create mode 100644 NET/worlds/scape/Saver.java create mode 100644 NET/worlds/scape/ScaleWidget.java create mode 100644 NET/worlds/scape/ScapePicMovie.java create mode 100644 NET/worlds/scape/ScapePicTexture.java create mode 100644 NET/worlds/scape/ScapePicTextureDecoder.java create mode 100644 NET/worlds/scape/ScrollingImagePanel.java create mode 100644 NET/worlds/scape/ScrollingListElement.java create mode 100644 NET/worlds/scape/SelectAvatarAction.java create mode 100644 NET/worlds/scape/SendURLAction.java create mode 100644 NET/worlds/scape/Sensor.java create mode 100644 NET/worlds/scape/SensorFrameHandler.java create mode 100644 NET/worlds/scape/SeqFile.java create mode 100644 NET/worlds/scape/SequenceAction.java create mode 100644 NET/worlds/scape/SequenceActionState.java create mode 100644 NET/worlds/scape/SetBooleanAction.java create mode 100644 NET/worlds/scape/SetColorAction.java create mode 100644 NET/worlds/scape/SetFloatAction.java create mode 100644 NET/worlds/scape/SetIntegerAction.java create mode 100644 NET/worlds/scape/SetPoint2Action.java create mode 100644 NET/worlds/scape/SetPoint3Action.java create mode 100644 NET/worlds/scape/SetPropertyAction.java create mode 100644 NET/worlds/scape/SetStringAction.java create mode 100644 NET/worlds/scape/SetURLAction.java create mode 100644 NET/worlds/scape/SetVisibleBumpableAction.java create mode 100644 NET/worlds/scape/SetZoomMode.java create mode 100644 NET/worlds/scape/Shadow.java create mode 100644 NET/worlds/scape/ShallowEnumeration.java create mode 100644 NET/worlds/scape/Shape.java create mode 100644 NET/worlds/scape/ShapeLoader.java create mode 100644 NET/worlds/scape/ShapeLoaderListener.java create mode 100644 NET/worlds/scape/ShapeTextureLoader.java create mode 100644 NET/worlds/scape/Sharer.java create mode 100644 NET/worlds/scape/SlidePropertyAction.java create mode 100644 NET/worlds/scape/SmoothDriver.java create mode 100644 NET/worlds/scape/Sound.java create mode 100644 NET/worlds/scape/SoundCallback.java create mode 100644 NET/worlds/scape/SoundPlayer.java create mode 100644 NET/worlds/scape/SoundResource.java create mode 100644 NET/worlds/scape/SoundState.java create mode 100644 NET/worlds/scape/SpinBehavior.java create mode 100644 NET/worlds/scape/StandardTexture.java create mode 100644 NET/worlds/scape/StandardTextureDecoder.java create mode 100644 NET/worlds/scape/StartupSensor.java create mode 100644 NET/worlds/scape/State.java create mode 100644 NET/worlds/scape/StateContext.java create mode 100644 NET/worlds/scape/StdoutAction.java create mode 100644 NET/worlds/scape/StopRecordingAction.java create mode 100644 NET/worlds/scape/StringAttribute.java create mode 100644 NET/worlds/scape/StringFieldEditorDialog.java create mode 100644 NET/worlds/scape/StringPropertyEditor.java create mode 100644 NET/worlds/scape/StringTexture.java create mode 100644 NET/worlds/scape/SubclumpShape.java create mode 100644 NET/worlds/scape/SuperRoot.java create mode 100644 NET/worlds/scape/Surface.java create mode 100644 NET/worlds/scape/SwitchableBehavior.java create mode 100644 NET/worlds/scape/TCompressor.java create mode 100644 NET/worlds/scape/TabbedDisplayPanel.java create mode 100644 NET/worlds/scape/TabbedPanel.java create mode 100644 NET/worlds/scape/TalkAction.java create mode 100644 NET/worlds/scape/Teleport.java create mode 100644 NET/worlds/scape/TeleportAction.java create mode 100644 NET/worlds/scape/TeleportDialog.java create mode 100644 NET/worlds/scape/TeleportStatus.java create mode 100644 NET/worlds/scape/Texture.java create mode 100644 NET/worlds/scape/TextureDecoder.java create mode 100644 NET/worlds/scape/TextureSurface.java create mode 100644 NET/worlds/scape/TextureSurfaceRenderer.java create mode 100644 NET/worlds/scape/Toggle.java create mode 100644 NET/worlds/scape/ToggleZoomMode.java create mode 100644 NET/worlds/scape/TooNewException.java create mode 100644 NET/worlds/scape/ToolBar.java create mode 100644 NET/worlds/scape/ToolTipManager.java create mode 100644 NET/worlds/scape/TradeAction.java create mode 100644 NET/worlds/scape/TrajectoryBehavior.java create mode 100644 NET/worlds/scape/TransAttribute.java create mode 100644 NET/worlds/scape/Transform.java create mode 100644 NET/worlds/scape/TransformEditorDialog.java create mode 100644 NET/worlds/scape/TransformPropertyEditor.java create mode 100644 NET/worlds/scape/Trigger.java create mode 100644 NET/worlds/scape/TriggeredSwitchableBehavior.java create mode 100644 NET/worlds/scape/TwoWayPortal.java create mode 100644 NET/worlds/scape/URLEditorDialog.java create mode 100644 NET/worlds/scape/URLPropertyEditor.java create mode 100644 NET/worlds/scape/URLSelf.java create mode 100644 NET/worlds/scape/URLSelfLoader.java create mode 100644 NET/worlds/scape/UndoStack.java create mode 100644 NET/worlds/scape/UndoWidget.java create mode 100644 NET/worlds/scape/UndoabCopy.java create mode 100644 NET/worlds/scape/UndoablAdd.java create mode 100644 NET/worlds/scape/UndoablCut.java create mode 100644 NET/worlds/scape/UndoablDelete.java create mode 100644 NET/worlds/scape/UndoablPaste.java create mode 100644 NET/worlds/scape/UndoablSet.java create mode 100644 NET/worlds/scape/UndoablTransform.java create mode 100644 NET/worlds/scape/Undoable.java create mode 100644 NET/worlds/scape/UniqueHasher.java create mode 100644 NET/worlds/scape/UnitEnumeration.java create mode 100644 NET/worlds/scape/UniverseHandler.java create mode 100644 NET/worlds/scape/UserEvent.java create mode 100644 NET/worlds/scape/UserHandler.java create mode 100644 NET/worlds/scape/VTransWidget.java create mode 100644 NET/worlds/scape/ValueEvent.java create mode 100644 NET/worlds/scape/ValueHandler.java create mode 100644 NET/worlds/scape/VectorProperty.java create mode 100644 NET/worlds/scape/VehicleDriver.java create mode 100644 NET/worlds/scape/VehicleShape.java create mode 100644 NET/worlds/scape/VelocityBehavior.java create mode 100644 NET/worlds/scape/VideoControlAction.java create mode 100644 NET/worlds/scape/VideoManager.java create mode 100644 NET/worlds/scape/VideoSurface.java create mode 100644 NET/worlds/scape/VideoTexture.java create mode 100644 NET/worlds/scape/VideoWall.java create mode 100644 NET/worlds/scape/VisiAttribute.java create mode 100644 NET/worlds/scape/WMPSoundPlayer.java create mode 100644 NET/worlds/scape/WObject.java create mode 100644 NET/worlds/scape/WObjectHighlighter.java create mode 100644 NET/worlds/scape/WaitAction.java create mode 100644 NET/worlds/scape/WaitActionState.java create mode 100644 NET/worlds/scape/WavSoundPlayer.java create mode 100644 NET/worlds/scape/WavSoundTerminator.java create mode 100644 NET/worlds/scape/WearAction.java create mode 100644 NET/worlds/scape/WearWall.java create mode 100644 NET/worlds/scape/WebPageWall.java create mode 100644 NET/worlds/scape/WebWallControlAction.java create mode 100644 NET/worlds/scape/Whiteboard.java create mode 100644 NET/worlds/scape/WidgetButton.java create mode 100644 NET/worlds/scape/WobClassLoader.java create mode 100644 NET/worlds/scape/WobLoaded.java create mode 100644 NET/worlds/scape/WobLoader.java create mode 100644 NET/worlds/scape/World.java create mode 100644 NET/worlds/scape/WorldRedirector.java create mode 100644 NET/worlds/scape/WorldScript.java create mode 100644 NET/worlds/scape/WorldScriptLoader.java create mode 100644 NET/worlds/scape/WorldScriptManager.java create mode 100644 NET/worlds/scape/WorldScriptToolkit.java create mode 100644 NET/worlds/scape/WorldScriptToolkitImp.java create mode 100644 NET/worlds/scape/WorldValidator.java create mode 100644 NET/worlds/scape/WrRamp.java create mode 100644 NET/worlds/scape/WrRectPatch.java create mode 100644 NET/worlds/scape/WrStaircase.java create mode 100644 NET/worlds/scape/WrVisiRectPatch.java create mode 100644 NET/worlds/scape/YawWidget.java create mode 100644 NET/worlds/scape/sendURL.java diff --git a/META-INF/MANIFEST.MF b/META-INF/MANIFEST.MF new file mode 100644 index 0000000..58630c0 --- /dev/null +++ b/META-INF/MANIFEST.MF @@ -0,0 +1,2 @@ +Manifest-Version: 1.0 + diff --git a/NET/worlds/console/AboutDialog.java b/NET/worlds/console/AboutDialog.java new file mode 100644 index 0000000..4fea336 --- /dev/null +++ b/NET/worlds/console/AboutDialog.java @@ -0,0 +1,100 @@ +package NET.worlds.console; + +import NET.worlds.core.IniFile; +import NET.worlds.core.Std; +import NET.worlds.network.NetUpdate; +import java.awt.BorderLayout; +import java.awt.Button; +import java.awt.Color; +import java.awt.Component; +import java.awt.Event; +import java.awt.Font; +import java.awt.Frame; +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.awt.Label; +import java.awt.Panel; +import java.awt.TextArea; +import java.util.Enumeration; +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, 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; + } + + @Override + 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(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); + } + + @Override + public boolean action(Event event, Object what) { + return event.target == this.okButton ? this.done(true) : false; + } + + @Override + public boolean keyDown(Event event, int key) { + return key != 27 && key != 10 ? super.keyDown(event, key) : this.done(true); + } + + @Override + public void show() { + super.show(); + this.okButton.requestFocus(); + } +} diff --git a/NET/worlds/console/ActionDialog.java b/NET/worlds/console/ActionDialog.java new file mode 100644 index 0000000..93deea2 --- /dev/null +++ b/NET/worlds/console/ActionDialog.java @@ -0,0 +1,150 @@ +package NET.worlds.console; + +import NET.worlds.core.IniFile; +import NET.worlds.core.ServerTableManager; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Component; +import java.awt.Event; +import java.awt.GridLayout; +import java.awt.Panel; +import java.awt.Point; +import java.util.Vector; + +class ActionDialog extends PolledDialog implements ImageButtonsCallback { + private static final long serialVersionUID = -1190930869038557992L; + BorderLayout overall = new BorderLayout(); + static Point lastWindowLocation = null; + private Vector hunks = new Vector(); + private Vector names = new Vector(); + private static final int buttonsPerHunk = 1; + 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"); + + ActionDialog(Vector inNames) { + super(Console.getFrame(), null, Console.message("Actions"), false); + String[] hiddenActions = ServerTableManager.instance().getTable("hiddenActions"); + String[] actionAliases = ServerTableManager.instance().getTable("actionAliases"); + if (IniFile.gamma().getIniInt("HideActions", 1) == 0) { + hiddenActions = (String[])null; + } + + this.names = new Vector(); + + for (int i = 0; i < inNames.size(); i++) { + boolean hide = false; + if (hiddenActions != null) { + String inStr = inNames.elementAt(i); + inStr = inStr.toLowerCase(); + + for (int j = 0; j < hiddenActions.length; j++) { + if (inStr.equals(hiddenActions[j])) { + hide = true; + } + } + } + + if (!hide) { + String prettyName = inNames.elementAt(i); + if (actionAliases != null) { + String var11 = prettyName.toLowerCase(); + + for (int jx = 0; jx < actionAliases.length; jx += 2) { + if (var11.equals(actionAliases[jx])) { + prettyName = actionAliases[jx + 1]; + } + } + } + + this.names.addElement(upperFirst(prettyName)); + } + } + + this.setResizable(false); + this.setAlignment(2); + this.setLayout(this.overall); + this.ready(); + } + + @Override + protected boolean done(boolean confirmed) { + ActionsPart.showDialog = false; + lastWindowLocation = this.getLocation(); + return super.done(confirmed); + } + + private static String upperFirst(String text) { + String ret = text.substring(0, 1).toUpperCase(); + if (text.length() > 1) { + ret = ret + text.substring(1); + } + + return ret.replace('_', ' '); + } + + @Override + public synchronized Object imageButtonsCallback(Component who, int which) { + int whichHunk = this.hunks.indexOf(who); + if (whichHunk == -1) { + return null; + } else { + Console.wake(); + ActionsPart.actionToPerform = whichHunk * 1 + which; + return null; + } + } + + @Override + protected void build() { + int numHunks = (this.names.size() + 1 - 1) / 1; + int numRows = (numHunks + 1) / 2; + numHunks = numRows * 2; + Panel hunky = new Panel(new GridLayout(numRows, 2)); + hunky.setBackground(Color.black); + int nextNameIndex = 0; + + for (int i = 0; i < numHunks; i++) { + String[] strings = new String[1]; + + for (int s = 0; s < 1; nextNameIndex++) { + if (nextNameIndex < this.names.size()) { + strings[s] = this.names.elementAt(nextNameIndex); + } + + s++; + } + + TextImageButtons hunk = new TextImageButtons(buttonImageName, 72, buttonHeights, xText, strings, this); + this.hunks.addElement(hunk); + hunky.add(hunk); + } + + this.add("North", new ImageCanvas(topImageName)); + this.add("Center", hunky); + this.add("South", new ImageCanvas(bottomImageName)); + } + + @Override + protected void initialSize(int width, int height) { + if (lastWindowLocation == null) { + super.initialSize(width, height); + } else { + this.setLocation(lastWindowLocation); + this.setSize(width, height); + } + } + + @Override + public boolean handleEvent(Event event) { + if (event.id == 1004) { + Console.getFrame().requestFocus(); + return true; + } else { + return super.handleEvent(event); + } + } +} diff --git a/NET/worlds/console/ActionsPart.java b/NET/worlds/console/ActionsPart.java new file mode 100644 index 0000000..aed4c7c --- /dev/null +++ b/NET/worlds/console/ActionsPart.java @@ -0,0 +1,122 @@ +package NET.worlds.console; + +import NET.worlds.scape.FrameEvent; +import NET.worlds.scape.InventoryAction; +import NET.worlds.scape.InventoryItem; +import NET.worlds.scape.InventoryManager; +import NET.worlds.scape.Pilot; +import java.awt.Container; +import java.awt.Event; +import java.util.Vector; + +public class ActionsPart implements FramePart { + static int actionToPerform = -1; + private Pilot curPilot; + private Vector curAnimations; + private int numPilotAnims; + private static ActionsPart activePart; + private static ActionDialog dialog; + static boolean showDialog; + + public void present() { + showDialog = true; + this.curPilot = null; + } + + @Override + public void activate(Console c, Container f, Console prev) { + } + + @Override + public void deactivate() { + } + + @Override + public boolean action(Event event, Object what) { + return false; + } + + public static boolean listEquals(Vector a, Vector b) { + if (a != null && b != null) { + if (a.size() != b.size()) { + return false; + } else { + int i = a.size(); + + while (--i >= 0) { + Object ao = a.elementAt(i); + Object bo = b.elementAt(i); + if (ao == null || bo == null) { + if (ao != null || bo != null) { + return false; + } + } else if (!ao.equals(bo)) { + return false; + } + } + + return true; + } + } else { + return a == null == (b == null); + } + } + + public static void updateActionDialog() { + if (activePart != null && dialog != null && showDialog && dialog.isVisible()) { + Main.register(new MainCallback() { + @Override + public void mainCallback() { + ActionsPart.activePart.regenActionDialog(); + Main.unregister(this); + } + }); + } + } + + public void regenActionDialog() { + Vector newAnimations = this.curPilot.getAnimationList(); + this.numPilotAnims = newAnimations.size(); + Vector specials = InventoryManager.getInventoryManager().getInventoryActionList(); + + for (int i = 0; i < specials.size(); i++) { + InventoryAction act = (InventoryAction)specials.elementAt(i); + newAnimations.addElement(act.getItemName()); + } + + if (dialog != null) { + boolean showWas = showDialog; + if (showWas && dialog.isVisible() && listEquals(newAnimations, this.curAnimations)) { + return; + } + + dialog.done(true); + showDialog = showWas; + } + + this.curAnimations = newAnimations; + if (showDialog) { + dialog = new ActionDialog(this.curAnimations); + } + } + + @Override + public synchronized boolean handle(FrameEvent f) { + Pilot pilot = Pilot.getActive(); + if (pilot != this.curPilot) { + this.curPilot = pilot; + activePart = this; + this.regenActionDialog(); + } else if (actionToPerform != -1 && actionToPerform < this.curAnimations.size()) { + String act = this.curAnimations.elementAt(actionToPerform); + if (actionToPerform < this.numPilotAnims) { + pilot.animate(act); + } else { + InventoryManager.getInventoryManager().doInventoryAction(act); + } + } + + actionToPerform = -1; + return true; + } +} diff --git a/NET/worlds/console/ActiveX.java b/NET/worlds/console/ActiveX.java new file mode 100644 index 0000000..19b59e3 --- /dev/null +++ b/NET/worlds/console/ActiveX.java @@ -0,0 +1,147 @@ +package NET.worlds.console; + +import NET.worlds.core.IniFile; +import java.io.IOException; +import java.util.Vector; + +public class ActiveX implements MainCallback, MainTerminalCallback { + private static boolean disabled = IniFile.gamma().getIniInt("DISABLEACTIVEX", 0) != 0; + private static ActiveX _instance; + private static int _references; + private static Vector _referrers = new Vector(); + private static int _serverLocks; + private static int _activeComponents; + private static int _debugLevel = IniFile.gamma().getIniInt("oledebug", 0); + public int _shutdownCounter = 0; + + static { + if (_debugLevel > 0) { + System.out.println("OLE DEBUGGING LEVEL = " + _debugLevel); + } + } + + public static int getDebugLevel() { + return _debugLevel; + } + + public static ActiveX getInstance() { + if (_instance == null) { + _instance = new ActiveX(); + } + + return _instance; + } + + private ActiveX() { + Main.register(this); + } + + @Override + public void mainCallback() { + this.winProc(); + } + + @Override + public void terminalCallback() { + assert this == _instance; + + if (_serverLocks <= 0 && _activeComponents <= 0) { + synchronized (this) { + assert _references == _referrers.size(); + + while (_references > 0) { + for (int i = _referrers.size() - 1; i >= 0; i--) { + IUnknown pUnk = _referrers.elementAt(i); + + try { + pUnk.Release(); + } catch (OLEInvalidObjectException var5) { + var5.printStackTrace(System.out); + System.out.println("ActiveX: misbehaved object detected: " + pUnk); + _referrers.removeElementAt(i); + } + } + + if (_referrers.size() > 0) { + System.out.println("ActiveX: bad referrers found:"); + + for (int i = _referrers.size() - 1; i >= 0; i--) { + IUnknown pUnk = _referrers.elementAt(i); + System.out.println("\t" + pUnk); + } + } + } + + assert _references == 0; + + Main.unregister(this); + } + } else { + this._shutdownCounter++; + if (this._shutdownCounter == 10) { + this._shutdownCounter = 0; + System.out.println("Shutdown ignored: _serverLocks = " + _serverLocks + ", _activeComponents = " + _activeComponents); + Exception e = new Exception(); + e.printStackTrace(System.out); + } + } + } + + public static void init(IUnknown referrer) throws IOException { + synchronized (getInstance()) { + assert !_referrers.contains(referrer); + + if (_references == 0) { + initActiveX(); + } + + _references++; + _referrers.addElement(referrer); + if ((_debugLevel & 1) > 0) { + System.out.println("ActiveX.init() - refCnt = " + _references); + } + } + } + + public static void uninit(IUnknown referrer) { + synchronized (getInstance()) { + assert _references > 0; + + assert _referrers.contains(referrer); + + _references--; + if (_references == 0) { + uninitActiveX(); + } + + _referrers.removeElement(referrer); + if ((_debugLevel & 1) > 0) { + System.out.println("ActiveX.uninit() - refCnt = " + _references); + } + } + } + + public static synchronized void incServerLocks(int amt) { + _serverLocks += amt; + + assert _serverLocks >= 0; + } + + public static synchronized void incActiveComponents(int amt) { + _activeComponents += amt; + + assert _activeComponents >= 0; + } + + private static native void initActiveX() throws IOException; + + private static native void uninitActiveX(); + + public static native int getClassFClsID(String var0, String var1) throws IOException; + + public static native int getClassFProgID(String var0, String var1) throws IOException; + + private static native int getClass(int var0, String var1) throws IOException; + + private native void winProc(); +} diff --git a/NET/worlds/console/AdBanner.java b/NET/worlds/console/AdBanner.java new file mode 100644 index 0000000..c4e8e63 --- /dev/null +++ b/NET/worlds/console/AdBanner.java @@ -0,0 +1,37 @@ +package NET.worlds.console; + +import NET.worlds.core.IniFile; + +public class AdBanner { + private WebControl wc = null; + + public AdBanner(int width, int height, String url) { + if (IniFile.gamma().getIniInt("NoAdBanners", 0) != 1) { + Console c = Console.getActive(); + if (c != null && c instanceof DefaultConsole) { + DefaultConsole dc = (DefaultConsole)c; + + try { + RenderCanvas canvas = dc.getRender(); + if (canvas == null) { + return; + } + + this.wc = new WebControl(canvas, width, height, false, true, true); + this.wc.activate(); + this.wc.setURL(url); + } catch (NoWebControlException var7) { + System.out.println("Error creating IE control; " + var7.toString()); + } + } + } + } + + public void detach() { + if (this.wc != null) { + this.wc.detach(); + } + + this.wc = null; + } +} diff --git a/NET/worlds/console/AdPart.java b/NET/worlds/console/AdPart.java new file mode 100644 index 0000000..bf7c02e --- /dev/null +++ b/NET/worlds/console/AdPart.java @@ -0,0 +1,221 @@ +package NET.worlds.console; + +import NET.worlds.core.IniFile; +import NET.worlds.core.Std; +import NET.worlds.network.URL; +import NET.worlds.scape.BGLoaded; +import NET.worlds.scape.BackgroundLoader; +import NET.worlds.scape.Camera; +import NET.worlds.scape.FrameEvent; +import NET.worlds.scape.LoadedURLSelf; +import NET.worlds.scape.Material; +import NET.worlds.scape.Pilot; +import NET.worlds.scape.Rect; +import NET.worlds.scape.Room; +import NET.worlds.scape.SendURLAction; +import NET.worlds.scape.SuperRoot; +import NET.worlds.scape.Transform; +import NET.worlds.scape.URLSelf; +import NET.worlds.scape.WObject; +import NET.worlds.scape.World; +import java.awt.Container; +import java.awt.Dimension; +import java.awt.Event; +import java.awt.Point; +import java.io.File; +import java.text.MessageFormat; + +public class AdPart extends RenderCanvas implements LoadedURLSelf, BGLoaded { + private static final long serialVersionUID = 4290496811864911807L; + private static World world; + private static Room room; + private static Material[] faces = new Material[4]; + private static WObject cube; + private static Transform cubeStart; + private float angle; + private int currentFace = -1; + private int lastAd = -1; + private boolean lastAdIsRemote = false; + private boolean initialized; + URL image0; + int nextAdNumber; + int nextLoadTime; + int lastFrame; + static boolean cycleAds = IniFile.gamma().getIniInt("CYCLEADS", 1) == 1; + + public AdPart(URL defaultImage) { + super(new Dimension(130, 130)); + this.image0 = defaultImage; + } + + private void init() { + if (!this.initialized) { + if (world == null) { + World.load(URL.make("home:ad.world"), this, true); + } else { + this.initCamera(); + } + } + } + + private void initCamera() { + this.setCamera(new Camera()); + room.add(this.getCamera()); + this.getCamera().moveTo(room.getDefaultPosition()).spin(room.getDefaultOrientationAxis(), room.getDefaultOrientation()); + } + + @Override + public synchronized void loadedURLSelf(URLSelf o, URL url, String err) { + if (world != null) { + this.initCamera(); + } else if (o == null) { + Object[] arguments = new Object[]{new String("" + url)}; + Console.println(MessageFormat.format(Console.message("Error-ad"), arguments)); + } else { + world = (World)o; + room = world.getRoom(world.getDefaultRoomName()); + this.initCamera(); + cube = (WObject)SuperRoot.nameSearch(room.getContents(), "Cube"); + if (cube != null) { + cubeStart = cube.getTransform(); + + for (int i = 0; i < 4; i++) { + Rect r = (Rect)SuperRoot.nameSearch(cube.getContents(), "Rect" + (i + 1)); + if (r != null) { + faces[i] = r.getMaterial(); + } + } + } + } + } + + private String getAdBaseURL() { + World world = Pilot.getActiveWorld(); + return world == null ? "ads/ad" : world.getAdCubeBaseURL(); + } + + @Override + public boolean action(Event event, Object what) { + return false; + } + + @Override + public boolean mouseDown(Event e, int x, int y) { + World w = Pilot.getActiveWorld(); + if (w == null || !w.getHasClickableAdCube()) { + return false; + } else if ((e.modifiers & 12) != 0) { + return false; + } else { + if (this.nextAdNumber > 1 && this.getAdBaseURL() != null) { + new SendURLAction(this.getAdBaseURL() + (this.nextAdNumber - 1) + ".html").startBrowser(); + } else { + new SendURLAction(w.getDefaultAdCubeURL()).startBrowser(); + } + + return true; + } + } + + @Override + public Object asyncBackgroundLoad(String localName, URL remoteURL) { + return localName; + } + + @Override + public boolean syncBackgroundLoad(Object obj, URL remoteURL) { + String localName = (String)obj; + if (remoteURL != null != this.lastAdIsRemote) { + this.lastAd = -1; + } + + this.lastAdIsRemote = remoteURL != null; + if (localName != null && new File(localName).exists()) { + remoteURL = URL.make(localName); + } else { + this.lastAd = this.nextAdNumber; + this.nextAdNumber = 0; + remoteURL = this.image0; + } + + if (++this.currentFace > 3) { + this.currentFace = 0; + } + + Material m = faces[this.currentFace]; + if (m != null) { + m.loadTexture(remoteURL); + } + + if (++this.nextAdNumber == this.lastAd) { + this.nextAdNumber = 0; + } + + this.nextLoadTime = Std.getFastTime() + 10000; + return false; + } + + @Override + public Room getBackgroundLoadRoom() { + return null; + } + + @Override + public synchronized boolean handle(FrameEvent f) { + if (this.getCamera() != null && cube != null) { + int now = Std.getRealTime(); + if (now >= this.nextLoadTime) { + if (this.nextAdNumber == 0) { + this.syncBackgroundLoad(null, null); + } else if (cycleAds) { + String extension = ".cmp"; + World w = Pilot.getActiveWorld(); + if (w != null && w.getAdCubeFormatIsGif()) { + extension = ".gif"; + } + + String name = this.getAdBaseURL() + this.nextAdNumber + extension; + BackgroundLoader.get(this, URL.make(name)); + this.nextLoadTime = now + 10000; + } + } else { + float targetAngle = (float) (Math.PI / 2) * this.currentFace; + if (targetAngle != this.angle) { + int duration = now - this.lastFrame; + float rot = (float) (Math.PI / 4) * (duration / 1000.0F); + if (targetAngle == 0.0F) { + targetAngle = (float) (Math.PI * 2); + } + + float dist = targetAngle - this.angle; + if (rot >= dist) { + this.angle = (float) (Math.PI / 2) * this.currentFace; + } else { + this.angle += rot; + } + + cube.setTransform(cubeStart); + cube.spin(0.0F, 0.0F, -1.0F, this.angle * 180.0F / (float) Math.PI); + } + } + + this.lastFrame = now; + if (this.checkForWindow(false)) { + Point pt = this.getLocationOnScreen(); + Dimension dim = this.getSize(); + this.getWindow().reShape(pt.x, pt.y, dim.width, dim.height); + this.getCamera().renderToCanvas(); + } + + return true; + } else { + return true; + } + } + + @Override + public void activate(Console c, Container f, Console prev) { + super.activate(c, f, prev); + this.init(); + } +} diff --git a/NET/worlds/console/AddHandler.java b/NET/worlds/console/AddHandler.java new file mode 100644 index 0000000..ef9287c --- /dev/null +++ b/NET/worlds/console/AddHandler.java @@ -0,0 +1,90 @@ +package NET.worlds.console; + +import NET.worlds.scape.BumpEventTemp; +import NET.worlds.scape.BumpHandler; +import NET.worlds.scape.NoSuchPropertyException; +import NET.worlds.scape.Portal; +import NET.worlds.scape.Restorer; +import NET.worlds.scape.Room; +import NET.worlds.scape.Saver; +import NET.worlds.scape.SuperRoot; +import NET.worlds.scape.TooNewException; +import NET.worlds.scape.VectorProperty; +import java.io.IOException; +import java.util.Enumeration; +import java.util.Vector; + +public class AddHandler extends SuperRoot implements BumpHandler { + private Vector handlers = new Vector(1); + private static Object classCookie = new Object(); + + public AddHandler() { + } + + public AddHandler(SuperRoot newhandler) { + this.handlers.addElement(newhandler); + } + + @Override + public boolean handle(BumpEventTemp e) { + Room sc = ((Portal)e.target).farSide().getRoom(); + + assert sc instanceof Staircase || sc instanceof Stair; + + Enumeration enh = this.handlers.elements(); + + while (enh.hasMoreElements()) { + sc.addHandler(enh.nextElement()); + } + + return true; + } + + @Override + public void saveState(Saver s) throws IOException { + s.saveVersion(2, classCookie); + super.saveState(s); + s.saveVector(this.handlers); + } + + @Override + public void restoreState(Restorer r) throws IOException, TooNewException { + switch (r.restoreVersion(classCookie)) { + case 1: + super.restoreState(r); + case 0: + if (r.restoreBoolean()) { + this.handlers.addElement((SuperRoot)r.restore()); + } + break; + case 2: + super.restoreState(r); + this.handlers = r.restoreVectorSuperRoot(); + break; + default: + throw new TooNewException(); + } + } + + @Override + 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 = new VectorProperty(this, index, "Handlers to Add"); + } else if (mode == 1) { + ret = this.handlers.clone(); + } else if (mode == 4) { + this.handlers.removeElement(value); + } else if (mode == 3) { + this.handlers.addElement((SuperRoot)value); + } + break; + default: + ret = super.properties(index, offset + 1, mode, value); + } + + return ret; + } +} diff --git a/NET/worlds/console/AddNameDialog.java b/NET/worlds/console/AddNameDialog.java new file mode 100644 index 0000000..79615e1 --- /dev/null +++ b/NET/worlds/console/AddNameDialog.java @@ -0,0 +1,85 @@ +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; + +class AddNameDialog extends PolledDialog { + private static final long serialVersionUID = -6679739808485406091L; + private TextField nameField; + private Button okButton = new Button(Console.message("OK")); + private Button cancelButton = new Button(Console.message("Cancel")); + private String newName; + private static Font font = new Font(Console.message("ButtonFont"), 0, 12); + + AddNameDialog(EditNamesDialog parent, String title) { + super(parent, parent, title, true); + this.ready(); + } + + @Override + protected void build() { + this.nameField = new TextField("", 40); + this.nameField.setFont(font); + GridBagLayout gbag = new GridBagLayout(); + this.setLayout(gbag); + GridBagConstraints c = new GridBagConstraints(); + c.fill = 0; + c.weightx = 1.0; + c.weighty = 1.0; + c.gridwidth = 2; + c.gridheight = 1; + this.add(gbag, new Label(Console.message("Name")), c); + c.gridwidth = 0; + c.fill = 2; + this.add(gbag, this.nameField, c); + Panel buttons = new Panel(); + this.okButton.setFont(font); + this.cancelButton.setFont(font); + buttons.add(this.okButton); + buttons.add(this.cancelButton); + c.gridwidth = 0; + c.fill = 0; + this.add(gbag, buttons, c); + } + + @Override + public boolean action(Event event, Object what) { + Object target = event.target; + if (target == this.okButton && this.mayConfirm()) { + return this.done(true); + } else { + return target == this.cancelButton ? this.done(false) : false; + } + } + + @Override + public String getName() { + return this.newName; + } + + private boolean mayConfirm() { + return FriendsListPart.isValidUserName(this.newName = this.nameField.getText().trim()); + } + + @Override + public boolean keyDown(Event event, int key) { + if (key == 27) { + return this.done(false); + } else { + return key == 10 && this.mayConfirm() ? this.done(true) : super.keyDown(event, key); + } + } + + @Override + public void show() { + super.show(); + this.nameField.requestFocus(); + this.nameField.selectAll(); + } +} diff --git a/NET/worlds/console/AnimationButton.java b/NET/worlds/console/AnimationButton.java new file mode 100644 index 0000000..22b1aa8 --- /dev/null +++ b/NET/worlds/console/AnimationButton.java @@ -0,0 +1,123 @@ +package NET.worlds.console; + +import NET.worlds.scape.FrameEvent; +import java.awt.Container; +import java.awt.Dimension; +import java.awt.Event; +import java.awt.Graphics; + +public class AnimationButton extends ImageCanvas implements MainCallback, FramePart, DialogDisabled { + private static final long serialVersionUID = 5605353426438467905L; + private static final int frameInterval = 33; + private String movieName; + private int frameCount; + private int curFrame; + private int width; + private int height; + private boolean playVideoNext; + private int videoHandle = -1; + private boolean isDialogDisabled; + + public AnimationButton(String imageName, int frameCount, String movieName) { + super(imageName); + this.frameCount = frameCount; + this.movieName = movieName; + } + + @Override + public void paint(Graphics g) { + g.clipRect(0, 0, this.width, this.height); + g.drawImage(this.image_, -this.width * this.curFrame, 0, null); + } + + @Override + public Dimension preferredSize() { + Dimension d = super.preferredSize(); + return new Dimension(this.width = d.width / this.frameCount, this.height = d.height); + } + + @Override + public Dimension minimumSize() { + return this.preferredSize(); + } + + @Override + public void mainCallback() { + if (this.videoHandle == -1) { + this.videoHandle = Window.playVideoClip(this, this.movieName); + if (this.videoHandle == -1) { + this.videoHandle = Window.playVideoClip(this, "..\\" + this.movieName); + if (this.videoHandle == -1) { + Main.unregister(this); + } + } + } else if (!Window.isVideoPlaying(this.videoHandle)) { + Main.unregister(this); + this.videoHandle = -1; + this.repaint(); + } + } + + @Override + public boolean mouseDown(Event e, int x, int y) { + if (this.isDialogDisabled) { + return false; + } else { + if (this.playVideoNext) { + Main.register(this); + this.playVideoNext = false; + } else if (this.videoHandle == -1) { + Graphics g = this.getGraphics(); + g.clipRect(0, 0, this.width, this.height); + int nextFrameIncr = this.curFrame == 0 ? 1 : -1; + long startTime = System.currentTimeMillis(); + long frameTime = 0L; + + for (int i = 1; i < this.frameCount; i++) { + this.curFrame += nextFrameIncr; + g.drawImage(this.image_, -this.width * this.curFrame, 0, null); + long elapsedTime = System.currentTimeMillis() - startTime; + frameTime += 33L; + long sleepTime = frameTime - elapsedTime; + if (sleepTime > 0L) { + try { + Thread.sleep(sleepTime); + } catch (InterruptedException var16) { + } + } + } + + if (this.curFrame == this.frameCount - 1) { + this.playVideoNext = true; + } + + g.dispose(); + } + + return true; + } + } + + @Override + public void activate(Console c, Container f, Console prev) { + } + + @Override + public void deactivate() { + } + + @Override + public boolean action(Event event, Object what) { + return false; + } + + @Override + public boolean handle(FrameEvent f) { + return false; + } + + @Override + public void dialogDisable(boolean disable) { + this.isDialogDisabled = disable; + } +} diff --git a/NET/worlds/console/ArmyOfZombies.java b/NET/worlds/console/ArmyOfZombies.java new file mode 100644 index 0000000..5cfb094 --- /dev/null +++ b/NET/worlds/console/ArmyOfZombies.java @@ -0,0 +1,120 @@ +package NET.worlds.console; + +import NET.worlds.scape.DeepEnumeration; +import NET.worlds.scape.Drone; +import NET.worlds.scape.Pilot; +import NET.worlds.scape.Point3Temp; +import NET.worlds.scape.Room; +import NET.worlds.scape.SuperRoot; +import NET.worlds.scape.WObject; +import java.util.Enumeration; +import java.util.Hashtable; + +class ArmyOfZombies { + Hashtable zombies = new Hashtable(); + private static ArmyOfZombies instance = new ArmyOfZombies(); + + public static ArmyOfZombies instance() { + return instance; + } + + protected ArmyOfZombies() { + } + + public void killZombies() { + Enumeration e = this.zombies.elements(); + + while (e.hasMoreElements()) { + Drone id = e.nextElement(); + Enumeration en = (Enumeration)id.getContents(); + + while (en.hasMoreElements()) { + WObject wob = en.nextElement(); + wob.detach(); + } + + id.detach(); + id.discard(); + } + + this.zombies.clear(); + } + + public void addZombie(Drone id) { + String name = id.getName(); + if (name.charAt(0) == '!') { + name = name.substring(1); + } + + this.zombies.put(name, id); + } + + public void replaceZombie(String name, Drone id) { + Drone oldId = this.get(name); + if (oldId != id) { + this.zombies.remove(name); + this.addZombie(id); + id.makeTag(true); + } + } + + public void killZombie(String name) { + Drone id = this.get(name); + if (id != null) { + this.zombies.remove(name); + id.detach(); + } + } + + public void zombify() { + if (Pilot.getActive() != null) { + if (Pilot.getActive().getRoom() != null) { + if (Pilot.getActive().getRoom().getWorld() != null) { + Enumeration rooms = Pilot.getActive().getRoom().getWorld().getRooms(); + + while (rooms.hasMoreElements()) { + Room r = (Room)rooms.nextElement(); + if (r != null) { + DeepEnumeration de = new DeepEnumeration(); + r.getChildren(de); + + while (de.hasMoreElements()) { + Object o = de.nextElement(); + if (o instanceof Drone) { + Drone d = (Drone)o; + Point3Temp pos = d.getPosition(); + short dir = (short)(-d.getYaw() + 90.0F); + dir = (short)(dir % 360); + + while (dir < 0) { + dir = (short)(dir + 360); + } + + SuperRoot wobj = d.getOwner(); + if (wobj != null) { + Room rm = wobj.getRoom(); + if (rm != null && d.getName() != null) { + BlackBox.getInstance() + .submitEvent(new BBAppearDroneCommand(r.getRoom().toString(), d.getName(), (short)pos.x, (short)pos.y, (short)pos.z, dir)); + if (d.getCurrentURL() != null) { + BlackBox.getInstance().submitEvent(new BBDroneBitmapCommand(d.getName(), d.getCurrentURL().toString())); + } + } + } + } + } + } + } + } + } + } + } + + Drone get(String name) { + if (name.charAt(0) == '!') { + name = name.substring(1); + } + + return this.zombies.get(name); + } +} diff --git a/NET/worlds/console/AttributeList.java b/NET/worlds/console/AttributeList.java new file mode 100644 index 0000000..25292a7 --- /dev/null +++ b/NET/worlds/console/AttributeList.java @@ -0,0 +1,38 @@ +package NET.worlds.console; + +import NET.worlds.core.IniFile; +import NET.worlds.scape.PropList; +import java.awt.List; +import java.util.Vector; + +class AttributeList extends List { + private static final long serialVersionUID = 4867320900648345562L; + + public AttributeList(int numVisibleRows) { + super(numVisibleRows); + Vector sortOrder = new Vector(); + int numUserPreferences = IniFile.gamma().getIniInt("PropertyOrderCount", -1); + if (numUserPreferences >= 0) { + sortOrder = new Vector(numUserPreferences); + + for (int i = 0; i < numUserPreferences; i++) { + sortOrder.addElement(IniFile.gamma().getIniString("PropertyOrder" + i, "")); + } + } + + for (int idx = 0; idx < sortOrder.size(); idx++) { + String attToAdd = sortOrder.elementAt(idx); + this.add(attToAdd); + } + } + + public void save() { + int numProperties = this.getItemCount(); + PropList.setPreferences(this.getItems()); + IniFile.gamma().setIniInt("PropertyOrderCount", numProperties); + + for (int i = 0; i < numProperties; i++) { + IniFile.gamma().setIniString("PropertyOrder" + i, this.getItem(i)); + } + } +} diff --git a/NET/worlds/console/AttributeSortPanel.java b/NET/worlds/console/AttributeSortPanel.java new file mode 100644 index 0000000..6856e7b --- /dev/null +++ b/NET/worlds/console/AttributeSortPanel.java @@ -0,0 +1,160 @@ +package NET.worlds.console; + +import java.awt.Button; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Event; +import java.awt.Frame; +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.awt.Label; +import java.awt.Point; +import java.awt.TextField; + +public class AttributeSortPanel extends Frame implements MainCallback, MainTerminalCallback { + private static final long serialVersionUID = -7230661745931320369L; + private AttributeList list; + private Button addButton = new Button("Add"); + private Button deleteButton = new Button("Delete"); + private Button moveUpButton = new Button("MoveUp"); + private Button moveDownButton = new Button("MoveDown"); + private Button okButton = new Button("Ok"); + private Button cancelButton = new Button("Cancel"); + private Button clearButton = new Button("Clear"); + private TextField attNameField = new TextField(32); + private Label attNameLabel = new Label("Attribute Name: "); + + public AttributeSortPanel(java.awt.Window parent) { + super("Attribute Sorting"); + this.list = new AttributeList(10); + GridBagLayout gbag = new GridBagLayout(); + GridBagConstraints c = new GridBagConstraints(); + this.setLayout(gbag); + this.setBackground(Color.gray); + c.gridx = 1; + c.gridy = 1; + c.gridheight = 7; + c.gridwidth = 3; + c.anchor = 18; + gbag.setConstraints(this.list, c); + this.add(this.list); + c.gridx = 4; + c.gridy = 1; + c.gridwidth = 1; + c.gridheight = 1; + gbag.setConstraints(this.moveUpButton, c); + this.add(this.moveUpButton); + c.gridx = 4; + c.gridy = 2; + c.gridwidth = 1; + c.gridheight = 1; + gbag.setConstraints(this.moveDownButton, c); + this.add(this.moveDownButton); + c.gridx = 4; + c.gridy = 5; + c.gridheight = 1; + c.gridwidth = 3; + gbag.setConstraints(this.attNameLabel, c); + this.add(this.attNameLabel); + c.gridy = 6; + c.gridheight = 1; + c.gridwidth = 3; + gbag.setConstraints(this.attNameField, c); + this.add(this.attNameField); + c.gridx = 7; + c.gridy = 6; + c.gridheight = 1; + c.gridwidth = 1; + gbag.setConstraints(this.addButton, c); + this.add(this.addButton); + c.gridx = 7; + c.gridy = 1; + c.gridwidth = 1; + c.gridheight = 1; + gbag.setConstraints(this.deleteButton, c); + this.add(this.deleteButton); + c.gridx = 7; + c.gridy = 2; + gbag.setConstraints(this.clearButton, c); + this.add(this.clearButton); + c.gridx = 5; + c.gridy = 8; + gbag.setConstraints(this.okButton, c); + this.add(this.okButton); + c.gridx = 7; + gbag.setConstraints(this.cancelButton, c); + this.add(this.cancelButton); + this.pack(); + Point loc = parent.location(); + Dimension size = parent.getSize(); + this.reshape(loc.x + (size.width - 512) / 2, loc.y + (size.height - 240) / 2, 512, 240); + this.show(); + Main.register(this); + } + + @Override + public boolean handleEvent(Event ev) { + switch (ev.id) { + case 201: + this.dispose(); + return true; + default: + return super.handleEvent(ev); + } + } + + @Override + public boolean action(Event e, Object o) { + if (e.target == this.addButton) { + String attToAdd = this.attNameField.getText(); + if (attToAdd != "") { + this.list.add(attToAdd); + } + + this.attNameField.setText(""); + return true; + } else if (e.target == this.deleteButton) { + this.list.remove(this.list.getSelectedIndex()); + return true; + } else if (e.target == this.moveUpButton) { + int index = this.list.getSelectedIndex(); + if (index > 0) { + String toPutBack = this.list.getItem(index - 1); + this.list.remove(index - 1); + this.list.add(toPutBack, index); + } + + return true; + } else if (e.target == this.moveDownButton) { + int index = this.list.getSelectedIndex(); + if (index < this.list.getItemCount()) { + String toPutBack = this.list.getItem(index + 1); + this.list.remove(index + 1); + this.list.add(toPutBack, index); + } + + return true; + } else if (e.target == this.cancelButton) { + this.dispose(); + return true; + } else if (e.target == this.clearButton) { + this.list.removeAll(); + return true; + } else if (e.target == this.okButton) { + this.list.save(); + this.dispose(); + return true; + } else { + return false; + } + } + + @Override + public void mainCallback() { + } + + @Override + public void terminalCallback() { + Main.unregister(this); + } +} diff --git a/NET/worlds/console/AvMenu.java b/NET/worlds/console/AvMenu.java new file mode 100644 index 0000000..e406673 --- /dev/null +++ b/NET/worlds/console/AvMenu.java @@ -0,0 +1,508 @@ +package NET.worlds.console; + +import NET.worlds.network.URL; +import NET.worlds.scape.HoloDrone; +import NET.worlds.scape.InventoryAvatar; +import NET.worlds.scape.InventoryItem; +import NET.worlds.scape.InventoryManager; +import NET.worlds.scape.PosableShape; +import NET.worlds.scape.SelectAvatarAction; +import NET.worlds.scape.WearAction; +import java.awt.Event; +import java.awt.Font; +import java.awt.Menu; +import java.awt.MenuItem; +import java.net.MalformedURLException; +import java.util.Arrays; +import java.util.Enumeration; +import java.util.StringTokenizer; +import java.util.Vector; + +public class AvMenu extends Menu implements AvatarDialogCallback { + private static final long serialVersionUID = 333613242466644876L; + DefaultConsole defcon; + Menu articMenuAF; + Menu articMenuGO; + Menu articMenuPZ; + Menu specialGuestMenu; + public MenuItem customize; + static AvatarDialog avDialog; + private static Font font = new Font(Console.message("MenuFont"), 0, 12); + Vector articulatedAvatarItemsAF; + Vector articulatedAvatarItemsGO; + Vector articulatedAvatarItemsPZ; + Vector holographicAvatarItemsAL; + Vector holographicAvatarItemsMZ; + Vector specialGuestAvatarItems; + private static Vector parts = new Vector(); + private static Vector sizes = new Vector(); + private static Vector colors = new Vector(); + private static Vector faceTypes = new Vector(); + private static Vector headTypes = new Vector(); + + static { + parts.addElement(Console.message("Head")); + parts.addElement(Console.message("Head-size")); + parts.addElement(Console.message("Face")); + parts.addElement(Console.message("Hair")); + parts.addElement(Console.message("Skin")); + parts.addElement(Console.message("Shirt")); + parts.addElement(Console.message("Coat")); + parts.addElement(Console.message("Dress")); + parts.addElement(Console.message("Pants")); + parts.addElement(Console.message("Left-glove")); + parts.addElement(Console.message("Right-glove")); + parts.addElement(Console.message("Left-shoe")); + parts.addElement(Console.message("Right-shoe")); + sizes.addElement(Console.message("m30")); + sizes.addElement(Console.message("m20")); + sizes.addElement(Console.message("m10")); + sizes.addElement(Console.message("standard")); + sizes.addElement(Console.message("p10")); + sizes.addElement(Console.message("p20")); + sizes.addElement(Console.message("p30")); + colors.addElement(Console.message("Original")); + colors.addElement(Console.message("Black")); + colors.addElement(Console.message("Blue")); + colors.addElement(Console.message("Tan")); + colors.addElement(Console.message("Red-orange")); + colors.addElement(Console.message("Pale-pink")); + colors.addElement(Console.message("Bright-green")); + colors.addElement(Console.message("Green")); + colors.addElement(Console.message("Dark-blue")); + colors.addElement(Console.message("Blue-purple")); + colors.addElement(Console.message("Light-blue")); + colors.addElement(Console.message("Dark-pink")); + colors.addElement(Console.message("Light-green")); + colors.addElement(Console.message("Pale-orange")); + colors.addElement(Console.message("Dark-grey")); + colors.addElement(Console.message("Orange")); + colors.addElement(Console.message("Pink")); + colors.addElement(Console.message("Purple")); + colors.addElement(Console.message("Red")); + colors.addElement(Console.message("Burgundy")); + colors.addElement(Console.message("Brown")); + colors.addElement(Console.message("Light-grey")); + colors.addElement(Console.message("Violet")); + colors.addElement(Console.message("White")); + colors.addElement(Console.message("Golden-yellow")); + colors.addElement(Console.message("Medium-yellow")); + colors.addElement(Console.message("Light-yellow")); + headTypes.addElement(Console.message("Original")); + addProperCasedEntries(headTypes, PosableShape.getPermittedNames()); + faceTypes.addElement(Console.message("Original")); + addProperCasedEntries(faceTypes, PosableShape.getFaceNames()); + } + + AvMenu(DefaultConsole d, URL lastPilotRequested) { + super(Console.message("choose-av")); + this.defcon = d; + URL url = URL.getAvatar(); + String curAvatar = ""; + if (lastPilotRequested != null) { + curAvatar = lastPilotRequested.getAbsolute(); + String avaStr = url.getAbsolute(); + if (curAvatar.startsWith(avaStr)) { + curAvatar = curAvatar.substring(avaStr.length()); + } + } + + this.articMenuAF = new Menu(Console.message("Articulated-A-F")); + this.articMenuGO = new Menu(Console.message("Articulated-G-O")); + this.articMenuPZ = new Menu(Console.message("Articulated-P-Z")); + this.articMenuAF.setFont(font); + this.articMenuGO.setFont(font); + this.articMenuPZ.setFont(font); + this.add(this.articMenuAF); + this.add(this.articMenuGO); + this.add(this.articMenuPZ); + this.addAvatars(url, "abcdef", "bod", this.articMenuAF, curAvatar, this.articulatedAvatarItemsAF = new Vector()); + this.addAvatars(url, "ghijklmno", "bod", this.articMenuGO, curAvatar, this.articulatedAvatarItemsGO = new Vector()); + this.addAvatars(url, "0123456789pqrstuvwxyz", "bod", this.articMenuPZ, curAvatar, this.articulatedAvatarItemsPZ = new Vector()); + Menu holoMenuAL = new Menu(Console.message("Holographic-A-L")); + Menu holoMenuMZ = new Menu(Console.message("Holographic-M-Z")); + holoMenuAL.setFont(font); + holoMenuMZ.setFont(font); + this.add(holoMenuAL); + this.add(holoMenuMZ); + this.addAvatars("abcdefghijkl", holoMenuAL, curAvatar, this.holographicAvatarItemsAL = new Vector()); + this.addAvatars("0123456789mnopqrstuvwxyz", holoMenuMZ, curAvatar, this.holographicAvatarItemsMZ = new Vector()); + this.specialGuestMenu = null; + this.specialGuestAvatarItems = new Vector(); + this.buildSpecialGuestMenu(); + this.customize = new MenuItem(Console.message("customize-av")); + } + + public void rebuildVIPMenu() { + this.articMenuAF.removeAll(); + this.articulatedAvatarItemsAF.removeAllElements(); + this.articMenuGO.removeAll(); + this.articulatedAvatarItemsGO.removeAllElements(); + this.articMenuPZ.removeAll(); + this.articulatedAvatarItemsPZ.removeAllElements(); + URL url = URL.getAvatar(); + this.addAvatars(url, "abcdef", "bod", this.articMenuAF, null, this.articulatedAvatarItemsAF); + this.addAvatars(url, "ghijklmno", "bod", this.articMenuGO, null, this.articulatedAvatarItemsGO); + this.addAvatars(url, "0123456789pqrstuvwxyz", "bod", this.articMenuPZ, null, this.articulatedAvatarItemsPZ); + } + + public void buildSpecialGuestMenu() { + Vector specialGuests = InventoryManager.getInventoryManager().getInventoryAvatars(); + if (specialGuests != null && specialGuests.size() > 0) { + if (this.specialGuestMenu != null) { + this.specialGuestMenu.removeAll(); + this.specialGuestAvatarItems.removeAllElements(); + } else { + this.specialGuestMenu = new Menu(Console.message("special-av")); + this.add(this.specialGuestMenu); + } + + Enumeration e = specialGuests.elements(); + + while (e.hasMoreElements()) { + InventoryAvatar invItem = (InventoryAvatar)e.nextElement(); + String fullName = invItem.getItemName(); + StringTokenizer tok = new StringTokenizer(fullName); + if (tok.countTokens() < 1) { + System.out.println("ERROR: Special avatar inventory item " + fullName + " does not conform to the form \" avatar\""); + } else { + String finalName = ""; + String raw = tok.nextToken(); + if (raw.length() > 1) { + finalName = raw.substring(0, 1).toUpperCase() + raw.substring(1); + AvMenuItem item = new AvMenuItem(finalName, false); + item.intAvatar = "_vv" + raw + ".rwg"; + this.specialGuestAvatarItems.addElement(item); + this.specialGuestMenu.add(item); + } + } + } + } + } + + private void addAvatars(URL url, String initChar, String ext, Menu menu, String curAvatar, Vector menuItems) { + if (curAvatar != null) { + curAvatar = SelectAvatarAction.getPrettyAvatarName(curAvatar); + } + + Vector names = PosableShape.getPermittedNames(); + Vector menuItemList = new Vector(); + int count = names.size(); + + for (int i = 0; i < count; i++) { + String name = names.elementAt(i); + if (!name.substring(0, 1).equals("_")) { + String properName = SelectAvatarAction.getPrettyAvatarName(name); + if (initChar.indexOf(properName.toLowerCase().substring(0, 1)) >= 0) { + AvMenuItem item = new AvMenuItem(properName, false); + item.intAvatar = AvMenuItem.avify(name, ".rwg"); + item.setFont(font); + menuItemList.addElement(item); + } + } + } + + try { + this.SortMenu(menuItemList, menu, menuItems); + } catch (NoClassDefFoundError var14) { + count = menuItemList.size(); + + for (int ix = 0; ix < count; ix++) { + AvMenuItem item = menuItemList.elementAt(ix); + menuItems.addElement(item); + menu.add(item); + } + } + } + + private void SortMenu(Vector menuItemList, Menu menu, Vector menuItems) throws NoClassDefFoundError { + Vector sortableArray = new Vector(); + int count = menuItemList.size(); + + for (int i = 0; i < count; i++) { + AvMenuItem item = menuItemList.elementAt(i); + sortableArray.add(new AvMenuItemSortable(item)); + } + + Object[] itemList = sortableArray.toArray(); + Arrays.sort(itemList); + count = itemList.length; + + for (int i = 0; i < count; i++) { + AvMenuItem item = ((AvMenuItemSortable)itemList[i]).menuItem; + menuItems.addElement(item); + menu.add(item); + } + } + + private void addAvatars(String initChar, Menu menu, String curAvatar, Vector menuItems) { + curAvatar = SelectAvatarAction.getPrettyAvatarName(curAvatar); + String[] list = HoloDrone.getPermittedList(); + Vector menuItemList = new Vector(); + + for (String name : list) { + if (!name.substring(0, 1).equals("_")) { + String properName = SelectAvatarAction.getPrettyAvatarName(name); + if (initChar.indexOf(properName.toLowerCase().substring(0, 1).toLowerCase()) >= 0) { + AvMenuItem item = new AvMenuItem(properName, false); + item.intAvatar = AvMenuItem.avify(name, ".mov"); + item.setFont(font); + menuItemList.addElement(item); + } + } + } + + try { + this.SortMenu(menuItemList, menu, menuItems); + } catch (NoClassDefFoundError var12) { + int var14 = menuItemList.size(); + + for (int i = 0; i < var14; i++) { + AvMenuItem item = menuItemList.elementAt(i); + menuItems.addElement(item); + menu.add(item); + } + } + } + + public boolean action(Event event, Object what) { + if (this.articulatedAvatarItemsAF == null + || !this.articulatedAvatarItemsAF.contains(event.target) + && !this.articulatedAvatarItemsGO.contains(event.target) + && !this.articulatedAvatarItemsPZ.contains(event.target)) { + if (this.holographicAvatarItemsAL == null + || !this.holographicAvatarItemsAL.contains(event.target) && !this.holographicAvatarItemsMZ.contains(event.target)) { + if (event.target == this.customize && this.customize != null) { + if (avDialog != null) { + avDialog.closeWin(); + } + + avDialog = new AvatarDialog(Console.getFrame(), null, Console.message("customize-av"), this); + } else { + if (this.specialGuestAvatarItems == null || !this.specialGuestAvatarItems.contains(event.target)) { + return false; + } + + AvMenuItem item = (AvMenuItem)event.target; + this.changeAvatar(item, "rwg", URL.make(URL.getAvatar(), "_vv" + item.getLabel().toLowerCase() + ".rwg")); + } + } else { + this.changeAvatar((AvMenuItem)event.target, "mov", null); + } + } else { + this.changeAvatar((AvMenuItem)event.target, "rwg", null); + } + + return true; + } + + public void notifyOfChange() { + if (avDialog != null) { + avDialog.setChangeCheck(); + } + } + + @Override + public Vector getChoices(int index) { + switch (index) { + case 0: + return headTypes; + case 1: + return sizes; + case 2: + return faceTypes; + default: + return colors; + } + } + + private static void addProperCasedEntries(Vector dest, Vector source) { + for (int i = 0; i < source.size(); i++) { + String s = source.elementAt(i); + if (s.charAt(0) != '_') { + dest.addElement(s.substring(0, 1).toUpperCase() + s.substring(1)); + } + } + } + + public static void rebuildHeadList() { + headTypes.removeAllElements(); + headTypes.addElement(Console.message("Original")); + addProperCasedEntries(headTypes, PosableShape.getPermittedNames()); + } + + @Override + public Vector getComponents() { + return parts; + } + + public static int findIndex(Vector v, String match) { + int end = v.size(); + + for (int i = 0; i < end; i++) { + String s = v.elementAt(i); + if (s.equalsIgnoreCase(match)) { + return i; + } + } + + return -1; + } + + @Override + public int getCurrentSelection(int index) { + String str = PosableShape.getCurrentAvCustomizable(); + if (str == null) { + return 0; + } else { + int pos = str.indexOf(".", 7); + String bodyType = str.substring(7, pos).toLowerCase(); + int result = -1; + switch (index) { + case 0: + int p = str.lastIndexOf("NS"); + if (p >= 0 && str.charAt(p + 5) == 'G') { + result = findIndex(headTypes, PosableShape.readName(str, p + 6)); + if (result >= 0) { + return result; + } + } + + result = findIndex(headTypes, bodyType); + return result < 0 ? 0 : result; + case 1: + int p = str.lastIndexOf("NS"); + if (p >= 0) { + result = "qhd0DHQ".indexOf(str.charAt(p + 2)); + } + + return result < 0 ? 3 : result; + case 2: + int head = str.lastIndexOf("NS"); + int p = str.lastIndexOf("DgT"); + if (p > head) { + p += 3; + + while (str.charAt(p) >= '0' && str.charAt(p) <= '9') { + p++; + } + + String texName = PosableShape.readName(str, p); + Vector v = faceTypes; + int i = v.size(); + + while (--i >= 1) { + String s = v.elementAt(i); + if (s.regionMatches(true, 0, texName, 0, s.length())) { + result = i; + break; + } + } + + if (result < 0) { + result = findIndex(faceTypes, bodyType); + } + + if (result > 0 && faceTypes.elementAt(result).equals(headTypes.elementAt(this.getCurrentSelection(0)))) { + result = 0; + } + } else { + result = 0; + } + + return result < 0 ? 0 : result; + default: + int p = PosableShape.getMatPosition(str, "fabcdeOVKY".charAt(index - 3)); + if (p >= 0 && str.charAt(p) == 'C' && str.charAt(p + 1) == '_') { + char letter = str.charAt(p + 2); + if (letter >= 'A' && letter <= 'Z') { + result = 1 + (letter - 'A'); + } + } + + return result < 0 ? 0 : result; + } + } + } + + @Override + public void setCurrentSelection(int index, int choice) { + String str = PosableShape.getCurrentAvCustomizable(); + if (str != null) { + String val; + char limb; + if (index >= 3) { + limb = "fabcdeOVKY".charAt(index - 3); + + assert choice >= 0; + + assert choice <= PosableShape.colorTable.length; + + val = choice == 0 ? null : "C_" + (char)(65 + choice - 1); + } else if (index == 1) { + char scale = "qhd0DHQ".charAt(choice); + char[] scaleStr = new char[]{scale, scale, scale}; + limb = 'Q'; + val = new String(scaleStr); + } else { + limb = (char)(index == 0 ? 72 : 69); + Vector choices = index == 0 ? headTypes : faceTypes; + val = choice == 0 ? null : choices.elementAt(choice).toLowerCase(); + } + + WearAction.setAvLimb(limb, val); + } + } + + private void changeAvatar(AvMenuItem item, String ext, URL url) { + if (url == null) { + try { + url = new URL(URL.getAvatar(), item.intAvatar); + } catch (MalformedURLException var5) { + Console.println(Console.message("invalid-URL") + " " + var5); + return; + } + } + + this.defcon.setNextAvatar(url, item); + } + + private AvMenuItem findAvatar(Vector items, String name) { + if (items != null) { + int count = items.size(); + + for (int i = 0; i < count; i++) { + AvMenuItem item = items.elementAt(i); + if (item.getLabel().equals(name)) { + return item; + } + } + } + + return null; + } + + public AvMenuItem findMenuItem(URL url) { + String prefix = URL.getAvatar().getAbsolute(); + String name = url.getAbsolute().substring(prefix.length()); + String pname = SelectAvatarAction.getPrettyAvatarName(name); + String suffix = name.substring(name.lastIndexOf(46) + 1); + AvMenuItem item; + return ( + !suffix.equalsIgnoreCase("rwg") + || this.articulatedAvatarItemsAF == null + || (item = this.findAvatar(this.articulatedAvatarItemsAF, pname)) == null + ) + && (item = this.findAvatar(this.articulatedAvatarItemsGO, pname)) == null + && (item = this.findAvatar(this.articulatedAvatarItemsPZ, pname)) == null + && (item = this.findAvatar(this.specialGuestAvatarItems, pname)) == null + && ( + !suffix.equalsIgnoreCase("mov") + || this.holographicAvatarItemsAL == null + || (item = this.findAvatar(this.holographicAvatarItemsAL, pname)) == null + && (item = this.findAvatar(this.holographicAvatarItemsMZ, pname)) == null + ) + ? null + : item; + } +} diff --git a/NET/worlds/console/AvMenuItem.java b/NET/worlds/console/AvMenuItem.java new file mode 100644 index 0000000..2be2470 --- /dev/null +++ b/NET/worlds/console/AvMenuItem.java @@ -0,0 +1,19 @@ +package NET.worlds.console; + +import java.awt.CheckboxMenuItem; + +class AvMenuItem extends CheckboxMenuItem { + private static final long serialVersionUID = 8358406033091883856L; + public String intAvatar; + public String prettyAvatar; + + AvMenuItem(String s, boolean b) { + super(s, b); + this.prettyAvatar = s; + } + + public static String avify(String in, String ext) { + int idx = in.indexOf(46); + return idx != -1 ? in.substring(0, idx).toLowerCase() + ext : in.toLowerCase() + ext; + } +} diff --git a/NET/worlds/console/AvMenuItemSortable.java b/NET/worlds/console/AvMenuItemSortable.java new file mode 100644 index 0000000..49cae0e --- /dev/null +++ b/NET/worlds/console/AvMenuItemSortable.java @@ -0,0 +1,15 @@ +package NET.worlds.console; + +class AvMenuItemSortable implements Comparable { + public AvMenuItem menuItem; + + AvMenuItemSortable(AvMenuItem i) { + this.menuItem = i; + } + + @Override + public int compareTo(Object o) { + AvMenuItemSortable b = (AvMenuItemSortable)o; + return this.menuItem.prettyAvatar.compareTo(b.menuItem.prettyAvatar); + } +} diff --git a/NET/worlds/console/AvatarDialog.java b/NET/worlds/console/AvatarDialog.java new file mode 100644 index 0000000..6e50502 --- /dev/null +++ b/NET/worlds/console/AvatarDialog.java @@ -0,0 +1,164 @@ +package NET.worlds.console; + +import NET.worlds.scape.EventQueue; +import java.awt.Button; +import java.awt.Choice; +import java.awt.Color; +import java.awt.Event; +import java.awt.Font; +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.awt.GridLayout; +import java.awt.Label; +import java.awt.Panel; +import java.awt.Point; +import java.util.Vector; + +public class AvatarDialog extends PolledDialog { + private static final long serialVersionUID = 8661992825430619335L; + private Button okButton = new Button(Console.message("Close")); + private AvatarDialogCallback callback; + private Vector choices = new Vector(); + private Vector changes = new Vector(); + private static Font font = new Font(Console.message("MenuFont"), 0, 12); + private static Font bfont = new Font(Console.message("ButtonFont"), 0, 12); + private int checkChanges; + static Point lastWindowLocation = null; + + public AvatarDialog(java.awt.Window parent, DialogReceiver receiver, String title, AvatarDialogCallback callback) { + super(parent, receiver, title, false); + this.callback = callback; + this.setResizable(false); + this.setAlignment(3); + this.ready(); + } + + public void setChangeCheck() { + this.checkChanges = 2; + } + + @Override + protected void build() { + Vector headings = this.callback.getComponents(); + int rows = headings.size(); + Panel top = new Panel(new GridLayout(rows, 2, 2, 2)); + top.setFont(font); + top.setBackground(Color.black); + + for (int i = 0; i < rows; i++) { + Label label = new Label(headings.elementAt(i), 2); + label.setForeground(Color.white); + label.setFont(font); + top.add(label); + Choice choice = new Choice(); + choice.setForeground(Color.white); + choice.setBackground(Color.black); + choice.setFont(font); + top.add(choice); + this.choices.addElement(choice); + Vector items = this.callback.getChoices(i); + int count = items.size(); + + for (int j = 0; j < count; j++) { + choice.add(items.elementAt(j)); + } + + choice.select(this.callback.getCurrentSelection(i)); + } + + GridBagLayout gbag = new GridBagLayout(); + this.setLayout(gbag); + GridBagConstraints c = new GridBagConstraints(); + c.weightx = 1.0; + c.weighty = 1.0; + c.gridheight = rows; + c.gridwidth = 0; + c.fill = 0; + this.add(gbag, top, c); + Panel bottom = new Panel(); + this.okButton.setFont(bfont); + bottom.add(this.okButton); + bottom.setBackground(Color.black); + c.gridheight = 1; + c.weightx = 0.0; + c.weighty = 0.0; + c.fill = 1; + this.add(gbag, bottom, c); + this.okButton.setBackground(Color.black); + this.okButton.setForeground(Color.white); + } + + @Override + public boolean handleEvent(Event event) { + if (EventQueue.redirectDrivingKeys(event)) { + return true; + } else { + return event.id == 201 ? this.done(false) : super.handleEvent(event); + } + } + + @Override + public boolean action(Event event, Object what) { + Object target = event.target; + if (target == this.okButton) { + return this.done(true); + } else { + int count = this.choices.size(); + + for (int i = 0; i < count; i++) { + Choice choice = this.choices.elementAt(i); + if (target == choice) { + int[] change = new int[]{i, choice.getSelectedIndex()}; + this.changes.addElement(change); + return true; + } + } + + return false; + } + } + + @Override + public boolean done(boolean confirmed) { + lastWindowLocation = this.getLocation(); + return super.done(confirmed); + } + + public void closeWin() { + if (lastWindowLocation == null) { + this.done(true); + } + } + + @Override + protected void initialSize(int width, int height) { + if (lastWindowLocation == null) { + super.initialSize(width, height); + } else { + this.setLocation(lastWindowLocation); + lastWindowLocation = null; + this.setSize(width, height); + } + } + + @Override + protected void activeCallback() { + if (this.checkChanges > 0 && --this.checkChanges == 0) { + for (int i = 0; i < this.choices.size(); i++) { + this.choices.elementAt(i).select(this.callback.getCurrentSelection(i)); + } + } + + while (this.changes.size() != 0) { + int[] change = this.changes.elementAt(0); + this.callback.setCurrentSelection(change[0], change[1]); + this.checkChanges = 1; + this.changes.removeElementAt(0); + } + } + + @Override + public boolean keyDown(Event event, int key) { + return key == 27 ? this.done(false) : super.keyDown(event, key); + } +} diff --git a/NET/worlds/console/AvatarDialogCallback.java b/NET/worlds/console/AvatarDialogCallback.java new file mode 100644 index 0000000..03efa25 --- /dev/null +++ b/NET/worlds/console/AvatarDialogCallback.java @@ -0,0 +1,13 @@ +package NET.worlds.console; + +import java.util.Vector; + +public interface AvatarDialogCallback { + Vector getComponents(); + + Vector getChoices(int var1); + + int getCurrentSelection(int var1); + + void setCurrentSelection(int var1, int var2); +} diff --git a/NET/worlds/console/AvatarDialogTest.java b/NET/worlds/console/AvatarDialogTest.java new file mode 100644 index 0000000..4587c87 --- /dev/null +++ b/NET/worlds/console/AvatarDialogTest.java @@ -0,0 +1,43 @@ +package NET.worlds.console; + +import java.util.Vector; + +public class AvatarDialogTest implements AvatarDialogCallback { + private static final String[] components = new String[]{"Color", "Weather", "Height", "Shape"}; + private static final String[] colors = new String[]{"Red", "Orange", "Yellow", "Green", "Blue", "Violet"}; + private static final String[] weather = new String[]{"Sunny", "Cloudy", "Raining", "Snowing"}; + private static final String[] heights = new String[]{"Short", "Medium", "Tall"}; + private static final String[] shapes = new String[]{"Circle", "Rectangle", "Triangle"}; + private static final String[][] items = new String[][]{colors, weather, heights, shapes}; + private static int[] settings = new int[components.length]; + + @Override + public Vector getComponents() { + return stringsToVector(components); + } + + @Override + public Vector getChoices(int index) { + return stringsToVector(items[index]); + } + + @Override + public int getCurrentSelection(int index) { + return settings[index]; + } + + @Override + public void setCurrentSelection(int index, int choice) { + settings[index] = choice; + } + + private static Vector stringsToVector(String[] strings) { + Vector v = new Vector(); + + for (int i = 0; i < strings.length; i++) { + v.addElement(strings[i]); + } + + return v; + } +} diff --git a/NET/worlds/console/BBAnimateDroneCommand.java b/NET/worlds/console/BBAnimateDroneCommand.java new file mode 100644 index 0000000..347edfb --- /dev/null +++ b/NET/worlds/console/BBAnimateDroneCommand.java @@ -0,0 +1,54 @@ +package NET.worlds.console; + +import NET.worlds.scape.Drone; +import NET.worlds.scape.Pilot; +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; + +public class BBAnimateDroneCommand extends BlackBoxCommand { + private String animation; + private String droneName; + + public BBAnimateDroneCommand() { + this.commandType = 9; + } + + public BBAnimateDroneCommand(String drone, String cmd) { + this(); + this.animation = new String(cmd); + this.droneName = new String(drone); + } + + @Override + public boolean execute() { + if (this.droneName.equals("@Pilot")) { + Pilot p = Pilot.getActive(); + if (p != null) { + p.animate(this.animation); + } + } else { + Drone d = ArmyOfZombies.instance().get(this.droneName); + if (d != null) { + d.animate(this.animation); + } + } + + this.doCallback(true); + return true; + } + + @Override + public void save(DataOutputStream dos) throws IOException { + super.save(dos); + dos.writeUTF(this.animation); + dos.writeUTF(this.droneName); + } + + @Override + public void load(DataInputStream dis) throws IOException { + super.load(dis); + this.animation = new String(dis.readUTF()); + this.droneName = new String(dis.readUTF()); + } +} diff --git a/NET/worlds/console/BBAppearDroneCommand.java b/NET/worlds/console/BBAppearDroneCommand.java new file mode 100644 index 0000000..1a12af4 --- /dev/null +++ b/NET/worlds/console/BBAppearDroneCommand.java @@ -0,0 +1,70 @@ +package NET.worlds.console; + +import NET.worlds.scape.HoloDrone; +import NET.worlds.scape.Room; +import NET.worlds.scape.World; +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; + +public class BBAppearDroneCommand extends BlackBoxCommand { + private short x; + private short y; + private short z; + private short dir; + private String room; + private String name; + + public BBAppearDroneCommand(String roomName, String pName, short px, short py, short pz, short pdir) { + this(); + this.x = px; + this.y = py; + this.z = pz; + this.dir = pdir; + this.room = new String(roomName); + this.name = new String(pName); + } + + public BBAppearDroneCommand() { + this.commandType = 5; + } + + @Override + public boolean execute() { + HoloDrone d = new HoloDrone(null, null); + d.setName(this.name); + Room r = World.findRoomByName(this.room); + if (r != null) { + d.appear(r, this.x, this.y, this.z, this.dir); + d.makeTag(true); + ArmyOfZombies.instance().addZombie(d); + this.doCallback(true); + } else { + this.doCallback(false); + } + + return true; + } + + @Override + public void save(DataOutputStream dos) throws IOException { + super.save(dos); + dos.writeShort(this.x); + dos.writeShort(this.y); + dos.writeShort(this.z); + dos.writeShort(this.dir); + dos.writeUTF(this.room); + dos.writeUTF(this.name); + } + + @Override + public void load(DataInputStream dis) throws IOException { + super.load(dis); + this.x = dis.readShort(); + this.y = dis.readShort(); + this.z = dis.readShort(); + this.dir = dis.readShort(); + this.room = new String(dis.readUTF()); + this.name = new String(dis.readUTF()); + } +} diff --git a/NET/worlds/console/BBChatCommand.java b/NET/worlds/console/BBChatCommand.java new file mode 100644 index 0000000..2fc6c61 --- /dev/null +++ b/NET/worlds/console/BBChatCommand.java @@ -0,0 +1,37 @@ +package NET.worlds.console; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; + +public class BBChatCommand extends BlackBoxCommand { + private String chatLine; + + public BBChatCommand(String line) { + this(); + this.chatLine = new String(line); + } + + public BBChatCommand() { + this.commandType = 0; + } + + @Override + public boolean execute() { + Console.println(this.chatLine); + this.doCallback(true); + return true; + } + + @Override + public void save(DataOutputStream dos) throws IOException { + super.save(dos); + dos.writeUTF(this.chatLine); + } + + @Override + public void load(DataInputStream dis) throws IOException { + super.load(dis); + this.chatLine = new String(dis.readUTF()); + } +} diff --git a/NET/worlds/console/BBDisappearDroneCommand.java b/NET/worlds/console/BBDisappearDroneCommand.java new file mode 100644 index 0000000..eb302b7 --- /dev/null +++ b/NET/worlds/console/BBDisappearDroneCommand.java @@ -0,0 +1,37 @@ +package NET.worlds.console; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; + +public class BBDisappearDroneCommand extends BlackBoxCommand { + private String name; + + public BBDisappearDroneCommand(String pName) { + this(); + this.name = new String(pName); + } + + public BBDisappearDroneCommand() { + this.commandType = 6; + } + + @Override + public boolean execute() { + ArmyOfZombies.instance().killZombie(this.name); + this.doCallback(true); + return true; + } + + @Override + public void save(DataOutputStream dos) throws IOException { + super.save(dos); + dos.writeUTF(this.name); + } + + @Override + public void load(DataInputStream dis) throws IOException { + super.load(dis); + this.name = new String(dis.readUTF()); + } +} diff --git a/NET/worlds/console/BBDroneBitmapCommand.java b/NET/worlds/console/BBDroneBitmapCommand.java new file mode 100644 index 0000000..48e2412 --- /dev/null +++ b/NET/worlds/console/BBDroneBitmapCommand.java @@ -0,0 +1,55 @@ +package NET.worlds.console; + +import NET.worlds.network.URL; +import NET.worlds.scape.Drone; +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; + +public class BBDroneBitmapCommand extends BlackBoxCommand { + private String name; + private String bitmap; + + public BBDroneBitmapCommand(String pName, String pBitmap) { + this(); + this.name = new String(pName); + this.bitmap = new String(pBitmap); + } + + public BBDroneBitmapCommand() { + this.commandType = 7; + } + + @Override + public boolean execute() { + Drone id = ArmyOfZombies.instance().get(this.name); + if (id != null) { + Drone newDrone = id.handleVAR_BITMAP(this.bitmap); + ArmyOfZombies.instance().replaceZombie(this.name, newDrone); + } else if (this.name.equals("@Pilot")) { + Console c = Console.getActive(); + if (c != null) { + c.setAvatar(URL.make(this.bitmap)); + } + } else { + System.out.println("Couldn't find drone " + this.name + " for bitmap command."); + } + + this.doCallback(true); + return true; + } + + @Override + public void save(DataOutputStream dos) throws IOException { + super.save(dos); + dos.writeUTF(this.name); + dos.writeUTF(this.bitmap); + } + + @Override + public void load(DataInputStream dis) throws IOException { + super.load(dis); + this.name = new String(dis.readUTF()); + this.bitmap = new String(dis.readUTF()); + } +} diff --git a/NET/worlds/console/BBDroneDeltaPosCommand.java b/NET/worlds/console/BBDroneDeltaPosCommand.java new file mode 100644 index 0000000..09cfdf0 --- /dev/null +++ b/NET/worlds/console/BBDroneDeltaPosCommand.java @@ -0,0 +1,71 @@ +package NET.worlds.console; + +import NET.worlds.scape.Drone; +import NET.worlds.scape.HoloPilot; +import NET.worlds.scape.Pilot; +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; + +public class BBDroneDeltaPosCommand extends BlackBoxCommand { + private byte dx; + private byte dy; + private byte dyaw; + private String droneID; + + public BBDroneDeltaPosCommand() { + this.commandType = 8; + } + + public BBDroneDeltaPosCommand(String pdroneID, byte pdx, byte pdy, byte pdyaw) { + this(); + this.droneID = pdroneID; + this.dx = pdx; + this.dy = pdy; + this.dyaw = pdyaw; + } + + @Override + public boolean execute() { + Drone id = null; + if (this.droneID.equals("@Pilot")) { + Pilot p = Pilot.getActive(); + if (p != null && p instanceof HoloPilot) { + HoloPilot hp = (HoloPilot)p; + Drone d = hp.getInternalDrone(); + if (d != null && d instanceof Drone) { + id = d; + } + } + } else { + id = ArmyOfZombies.instance().get(this.droneID); + } + + if (id != null) { + id.shortLoc(this.dx, this.dy, this.dyaw); + this.doCallback(true); + return true; + } else { + this.doCallback(true); + return true; + } + } + + @Override + public void save(DataOutputStream dos) throws IOException { + super.save(dos); + dos.writeUTF(this.droneID); + dos.writeByte(this.dx); + dos.writeByte(this.dy); + dos.writeByte(this.dyaw); + } + + @Override + public void load(DataInputStream dis) throws IOException { + super.load(dis); + this.droneID = dis.readUTF(); + this.dx = dis.readByte(); + this.dy = dis.readByte(); + this.dyaw = dis.readByte(); + } +} diff --git a/NET/worlds/console/BBMoveDroneCommand.java b/NET/worlds/console/BBMoveDroneCommand.java new file mode 100644 index 0000000..464bd12 --- /dev/null +++ b/NET/worlds/console/BBMoveDroneCommand.java @@ -0,0 +1,75 @@ +package NET.worlds.console; + +import NET.worlds.scape.Drone; +import NET.worlds.scape.HoloPilot; +import NET.worlds.scape.Pilot; +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; + +public class BBMoveDroneCommand extends BlackBoxCommand { + private short x; + private short y; + private short z; + private short dir; + private String droneID; + + public BBMoveDroneCommand() { + this.commandType = 3; + } + + public BBMoveDroneCommand(String pdroneID, short px, short py, short pz, short pdir) { + this(); + this.droneID = pdroneID; + this.x = px; + this.y = py; + this.z = pz; + this.dir = pdir; + } + + @Override + public boolean execute() { + Drone id = null; + if (this.droneID.equals("@Pilot")) { + Pilot p = Pilot.getActive(); + if (p != null && p instanceof HoloPilot) { + HoloPilot hp = (HoloPilot)p; + id = hp.getInternalDrone(); + } + } else { + id = ArmyOfZombies.instance().get(this.droneID); + } + + if (id != null) { + short _dir = this.dir; + _dir = (short)(90 - _dir); + _dir = (short)(360 - _dir); + id.longLoc(this.x, this.y, this.z, _dir); + this.doCallback(true); + return true; + } else { + this.doCallback(true); + return true; + } + } + + @Override + public void save(DataOutputStream dos) throws IOException { + super.save(dos); + dos.writeUTF(this.droneID); + dos.writeShort(this.x); + dos.writeShort(this.y); + dos.writeShort(this.z); + dos.writeShort(this.dir); + } + + @Override + public void load(DataInputStream dis) throws IOException { + super.load(dis); + this.droneID = dis.readUTF(); + this.x = dis.readShort(); + this.y = dis.readShort(); + this.z = dis.readShort(); + this.dir = dis.readShort(); + } +} diff --git a/NET/worlds/console/BBTeleportCommand.java b/NET/worlds/console/BBTeleportCommand.java new file mode 100644 index 0000000..620e9c4 --- /dev/null +++ b/NET/worlds/console/BBTeleportCommand.java @@ -0,0 +1,82 @@ +package NET.worlds.console; + +import NET.worlds.scape.Drone; +import NET.worlds.scape.HoloPilot; +import NET.worlds.scape.Pilot; +import NET.worlds.scape.Point3Temp; +import NET.worlds.scape.TeleportAction; +import NET.worlds.scape.TeleportStatus; +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; + +public class BBTeleportCommand extends BlackBoxCommand implements TeleportStatus { + private String location; + + public BBTeleportCommand() { + this.commandType = 1; + } + + public BBTeleportCommand(String pLocation) { + this(); + if (pLocation != null) { + this.location = new String(pLocation); + } + } + + @Override + public boolean execute() { + if (this.location != null) { + TeleportAction.teleport(this.location, this); + } + + return true; + } + + @Override + public void save(DataOutputStream dos) throws IOException { + super.save(dos); + if (this.location == null) { + dos.writeUTF(""); + } else { + dos.writeUTF(this.location); + } + } + + @Override + public void load(DataInputStream dis) throws IOException { + super.load(dis); + this.location = dis.readUTF(); + if (this.location.equals("")) { + this.location = null; + } + } + + @Override + public void teleportStatus(String err, String targetURL) { + Pilot p = Pilot.getActive(); + if (p instanceof HoloPilot) { + HoloPilot hp = (HoloPilot)p; + Drone d = hp.getInternalDrone(); + if (d != null) { + short dir = (short)(-p.getYaw() + 90.0F); + dir = (short)(dir % 360); + + while (dir < 0) { + dir = (short)(dir + 360); + } + + dir = (short)(90 - dir); + dir = (short)(360 - dir); + Point3Temp pos = p.getPosition(); + d.reset((short)pos.x, (short)pos.y, (short)p.getFootHeight(), dir); + } + } + + if (err == null) { + this.doCallback(true); + } else { + this.doCallback(false); + } + } +} diff --git a/NET/worlds/console/BBWObjClickedCommand.java b/NET/worlds/console/BBWObjClickedCommand.java new file mode 100644 index 0000000..e0d93b7 --- /dev/null +++ b/NET/worlds/console/BBWObjClickedCommand.java @@ -0,0 +1,82 @@ +package NET.worlds.console; + +import NET.worlds.scape.DeepEnumeration; +import NET.worlds.scape.MouseDownEvent; +import NET.worlds.scape.MouseDownHandler; +import NET.worlds.scape.Pilot; +import NET.worlds.scape.Room; +import NET.worlds.scape.SuperRoot; +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; + +public class BBWObjClickedCommand extends BlackBoxCommand { + private String objUrl; + int x; + int y; + char key; + + public BBWObjClickedCommand() { + this.commandType = 4; + } + + public BBWObjClickedCommand(String obj, char pkey, int px, int py) { + this(); + this.objUrl = new String(obj); + this.key = pkey; + this.x = px; + this.y = py; + } + + @Override + public boolean execute() { + MouseDownHandler target = null; + if (Pilot.getActive() == null) { + return false; + } else { + Room r = Pilot.getActive().getRoom(); + if (r == null) { + return false; + } else { + DeepEnumeration de = new DeepEnumeration(); + r.getChildren(de); + + while (de.hasMoreElements()) { + Object o = de.nextElement(); + if (o instanceof MouseDownHandler && ((SuperRoot)o).getName().equals(this.objUrl)) { + target = (MouseDownHandler)o; + break; + } + } + + if (target == null) { + this.doCallback(false); + return false; + } else { + MouseDownEvent e = new MouseDownEvent(0, null, this.key, this.x, this.y); + target.handle(e); + this.doCallback(true); + return true; + } + } + } + } + + @Override + public void save(DataOutputStream dos) throws IOException { + super.save(dos); + dos.writeInt(this.x); + dos.writeInt(this.y); + dos.writeChar(this.key); + dos.writeUTF(this.objUrl); + } + + @Override + public void load(DataInputStream dis) throws IOException { + super.load(dis); + this.x = dis.readInt(); + this.y = dis.readInt(); + this.key = dis.readChar(); + this.objUrl = dis.readUTF(); + } +} diff --git a/NET/worlds/console/BackButton.java b/NET/worlds/console/BackButton.java new file mode 100644 index 0000000..6d5c386 --- /dev/null +++ b/NET/worlds/console/BackButton.java @@ -0,0 +1,11 @@ +package NET.worlds.console; + +import java.awt.Button; + +class BackButton extends Button { + private static final long serialVersionUID = -3040398427896332517L; + + public BackButton(String name) { + super(name); + } +} diff --git a/NET/worlds/console/BlackBox.java b/NET/worlds/console/BlackBox.java new file mode 100644 index 0000000..8ab5868 --- /dev/null +++ b/NET/worlds/console/BlackBox.java @@ -0,0 +1,389 @@ +package NET.worlds.console; + +import NET.worlds.core.IniFile; +import NET.worlds.core.Std; +import NET.worlds.network.Galaxy; +import NET.worlds.network.URL; +import NET.worlds.scape.Camera; +import NET.worlds.scape.Drone; +import NET.worlds.scape.FrameEvent; +import NET.worlds.scape.FrameHandler; +import NET.worlds.scape.HoloPilot; +import NET.worlds.scape.Pilot; +import NET.worlds.scape.Postrenderable; +import NET.worlds.scape.Sound; +import NET.worlds.scape.SoundPlayer; +import NET.worlds.scape.WMPSoundPlayer; +import NET.worlds.scape.WavSoundPlayer; +import java.awt.FileDialog; +import java.awt.Frame; +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.EOFException; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.util.Enumeration; +import java.util.Properties; +import java.util.Vector; + +public class BlackBox implements BlackBoxCallback, FrameHandler, Postrenderable { + private static BlackBox instance = new BlackBox(); + private boolean disable = IniFile.gamma().getIniInt("disableRecorder", 0) == 1; + private String autoFile = null; + private SoundPlayer autoSound = null; + static final int PLAYING = 0; + static final int RECORDING = 1; + static final int STOPPED = 2; + private int state = 2; + static final int CHATCMD = 0; + static final int TELEPORTCMD = 1; + static final int ACTORLISTCMD = 2; + static final int MOVEDRONECMD = 3; + static final int OBJCLICKEDCMD = 4; + static final int APPEARDRONECMD = 5; + static final int DISAPPEARDRONECMD = 6; + static final int DRONEBITMAPCMD = 7; + static final int DRONEDELTACMD = 8; + static final int ANIMATECMD = 9; + public static final String PilotID = "@Pilot"; + private Vector commandList = new Vector(); + private int commandIdx; + private long basetime; + static final int NOCMD = 0; + static final int PLAYCMD = 1; + static final int RECCMD = 2; + static final int STOPCMD = 3; + private int pendingCommand = 0; + static final int FILE_VERSION = 1; + + public static BlackBox getInstance() { + return instance; + } + + private BlackBox() { + this.autoFile = IniFile.override().getIniString("AutoPlaybackFile", ""); + if (!this.autoFile.equals("")) { + this.play(); + } else { + this.autoFile = null; + } + + String soundFile = IniFile.override().getIniString("AutoPlaybackSound", ""); + if (!soundFile.equals("")) { + Sound owner = new Sound(URL.make(soundFile)); + if (soundFile.toLowerCase().endsWith(".wav")) { + this.autoSound = new WavSoundPlayer(owner); + } else { + this.autoSound = new WMPSoundPlayer(owner); + } + } + } + + @Override + public void finalize() { + this.stop(); + } + + @Override + public void postrender(Camera cam) { + if (!this.disable) { + if (Std.getSynchronizedTime() % 2 != 0) { + if (this.isPlaying()) { + cam.nDrawText(Console.message("PLAY"), 10, 10, 18, 16711680); + } else if (this.isRecording()) { + cam.nDrawText(Console.message("REC"), 10, 10, 18, 16711680); + } + } + } + } + + public synchronized void record() { + this.pendingCommand = 2; + } + + private boolean doRecord() { + if (this.state != 2) { + this.stop(); + } + + this.commandList.removeAllElements(); + this.basetime = Std.getFastTime(); + String url = ""; + Pilot pilot = Pilot.getActive(); + if (pilot == null) { + return false; + } else { + url = pilot.getURL(); + this.state = 1; + this.submitEvent(new BBTeleportCommand(url)); + URL avatar = Console.getActive().getAvatarName(); + if (avatar != null) { + this.submitEvent(new BBDroneBitmapCommand("@Pilot", avatar.toString())); + } + + ArmyOfZombies.instance().zombify(); + return true; + } + } + + public synchronized void play() { + this.pendingCommand = 1; + } + + public synchronized void play(URL recFile) { + this.autoFile = recFile.unalias(); + this.pendingCommand = 1; + } + + private void doPlay() { + if (this.state != 2) { + this.stop(); + } + + if (this.restore()) { + Galaxy.forceOffline(false); + Console.getActive().setChatname(""); + Pilot p = Pilot.getActive(); + if (p instanceof HoloPilot) { + HoloPilot hp = (HoloPilot)p; + hp.removeSmoothDriver(); + } + + if (this.autoSound != null) { + this.autoSound.start(1); + this.autoSound = null; + } + + this.commandIdx = 0; + this.basetime = Std.getFastTime(); + this.state = 0; + } + } + + @Override + public void commandCompleted(BlackBoxCommand c, boolean ok) { + if (ok) { + this.commandIdx++; + } else { + System.out.println("Failed command!"); + this.stop(); + } + } + + @Override + public boolean handle(FrameEvent e) { + if (this.disable) { + return false; + } else { + switch (this.pendingCommand) { + case 1: + this.doPlay(); + this.pendingCommand = 0; + break; + case 2: + this.doRecord(); + this.pendingCommand = 0; + break; + case 3: + this.doStop(); + this.pendingCommand = 0; + } + + if (this.isPlaying()) { + if (this.commandIdx >= this.commandList.size()) { + this.stop(); + return false; + } + + long elapsedTime = Std.getFastTime() - this.basetime; + BlackBoxCommand c = this.commandList.elementAt(this.commandIdx); + if (c.startTime <= elapsedTime) { + c.execute(this); + } + + Pilot p = Pilot.getActive(); + if (p instanceof HoloPilot) { + HoloPilot hp = (HoloPilot)p; + Drone d = hp.getInternalDrone(); + if (d != null) { + d.interpolate(e.time, 2000, p); + p.setZ(p.getPosition().z + hp.getSmoothDriver().getEyeHeight()); + } + } + } + + return false; + } + } + + public boolean isRecording() { + return this.state == 1; + } + + public boolean isPlaying() { + return this.state == 0; + } + + public void submitEvent(BlackBoxCommand c) { + if (!this.disable) { + if (this.isRecording()) { + c.timestamp(this.basetime); + this.commandList.addElement(c); + } + } + } + + public synchronized void stop() { + this.pendingCommand = 3; + } + + private void doStop() { + if (this.state != 2) { + if (this.isRecording()) { + this.save(); + } + + if (this.isPlaying()) { + ArmyOfZombies.instance().killZombies(); + Pilot p = Pilot.getActive(); + if (p instanceof HoloPilot) { + HoloPilot hp = (HoloPilot)p; + hp.returnSmoothDriver(); + } + + Console c = Console.getActive(); + if (c instanceof DefaultConsole) { + DefaultConsole dc = (DefaultConsole)c; + dc.getGalaxy().localForceOnline(); + dc.getGalaxy().waitForConnection(dc); + } + } + + this.state = 2; + } + } + + private void save() { + Frame parent = Console.getFrame(); + Properties p = System.getProperties(); + String oldDir = p.getProperty("user.dir"); + FileDialog fd = new FileDialog(parent, Console.message("Save-recording"), 1); + fd.setFile("record.rec"); + fd.show(); + String fname = fd.getFile(); + String path = fd.getDirectory(); + p.remove("user.dir"); + p.put("user.dir", oldDir); + System.setProperties(p); + if (fname != null) { + File f = new File(path, fname); + + try { + FileOutputStream fos = new FileOutputStream(f); + DataOutputStream dos = new DataOutputStream(fos); + dos.writeInt(1); + Enumeration e = this.commandList.elements(); + + while (e.hasMoreElements()) { + BlackBoxCommand cmd = e.nextElement(); + cmd.save(dos); + } + + dos.close(); + fos.close(); + } catch (Exception var12) { + System.out.println(var12); + } + } + } + + private boolean restore() { + if (this.autoFile != null) { + this.restoreFile(new File(this.autoFile)); + this.autoFile = null; + return true; + } else { + Frame parent = Console.getFrame(); + Properties p = System.getProperties(); + String oldDir = p.getProperty("user.dir"); + FileDialog fd = new FileDialog(parent, Console.message("Load-recording"), 0); + fd.show(); + String filename = fd.getFile(); + String directory = fd.getDirectory(); + p.remove("user.dir"); + p.put("user.dir", oldDir); + System.setProperties(p); + if (filename == null) { + return false; + } else { + File f = new File(directory, filename); + this.restoreFile(f); + return true; + } + } + } + + private void restoreFile(File f) { + this.commandList.removeAllElements(); + + try { + FileInputStream fis = new FileInputStream(f); + DataInputStream dis = new DataInputStream(fis); + int version = dis.readInt(); + if (version != 1) { + Console.println("Invalid recorder file."); + return; + } + + try { + while (true) { + int cmdId = dis.readInt(); + BlackBoxCommand cmd = null; + switch (cmdId) { + case 0: + cmd = new BBChatCommand(); + break; + case 1: + cmd = new BBTeleportCommand(); + break; + case 2: + default: + System.out.println("Error! Unknown command type."); + break; + case 3: + cmd = new BBMoveDroneCommand(); + break; + case 4: + cmd = new BBWObjClickedCommand(); + break; + case 5: + cmd = new BBAppearDroneCommand(); + break; + case 6: + cmd = new BBDisappearDroneCommand(); + break; + case 7: + cmd = new BBDroneBitmapCommand(); + break; + case 8: + cmd = new BBDroneDeltaPosCommand(); + break; + case 9: + cmd = new BBAnimateDroneCommand(); + } + + if (cmd != null) { + cmd.load(dis); + this.commandList.addElement(cmd); + } + } + } catch (EOFException var7) { + dis.close(); + fis.close(); + } + } catch (Exception var8) { + System.out.println(var8); + } + } +} diff --git a/NET/worlds/console/BlackBoxCallback.java b/NET/worlds/console/BlackBoxCallback.java new file mode 100644 index 0000000..37e9c97 --- /dev/null +++ b/NET/worlds/console/BlackBoxCallback.java @@ -0,0 +1,5 @@ +package NET.worlds.console; + +public interface BlackBoxCallback { + void commandCompleted(BlackBoxCommand var1, boolean var2); +} diff --git a/NET/worlds/console/BlackBoxCommand.java b/NET/worlds/console/BlackBoxCommand.java new file mode 100644 index 0000000..bfafc43 --- /dev/null +++ b/NET/worlds/console/BlackBoxCommand.java @@ -0,0 +1,48 @@ +package NET.worlds.console; + +import NET.worlds.core.Std; +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; + +public abstract class BlackBoxCommand { + int commandType; + long startTime; + BlackBoxCallback callback; + boolean waiting = false; + + void timestamp(long basetime) { + this.startTime = Std.getFastTime() - basetime; + } + + public boolean execute(BlackBoxCallback c) { + if (this.waiting) { + return false; + } else { + this.callback = c; + if (c != null) { + this.waiting = true; + } + + return this.execute(); + } + } + + abstract boolean execute(); + + void save(DataOutputStream dos) throws IOException { + dos.writeInt(this.commandType); + dos.writeLong(this.startTime); + } + + void load(DataInputStream dis) throws IOException { + this.startTime = dis.readLong(); + } + + void doCallback(boolean ok) { + if (this.callback != null) { + this.waiting = false; + this.callback.commandCompleted(this, ok); + } + } +} diff --git a/NET/worlds/console/BlockingDialog.java b/NET/worlds/console/BlockingDialog.java new file mode 100644 index 0000000..b32b5b8 --- /dev/null +++ b/NET/worlds/console/BlockingDialog.java @@ -0,0 +1,47 @@ +package NET.worlds.console; + +import java.awt.Dialog; +import java.awt.Frame; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; + +public class BlockingDialog extends Dialog implements ActionListener { + private static final long serialVersionUID = 8379457384966170912L; + boolean stillWaiting = true; + + public BlockingDialog(Frame parent, String title, boolean modal) { + super(parent, title, modal); + this.addWindowListener(new WindowAdapter() { + @Override + public void windowClosing(WindowEvent e) { + BlockingDialog.this.finish(); + } + }); + } + + @Override + public void actionPerformed(ActionEvent e) { + this.finish(); + } + + public void finish() { + this.responded(); + this.setVisible(false); + } + + public synchronized void waitForResponse() { + try { + while (this.stillWaiting) { + this.wait(); + } + } catch (Exception var2) { + } + } + + public synchronized void responded() { + this.stillWaiting = false; + this.notifyAll(); + } +} diff --git a/NET/worlds/console/BookmarkAddDialog.java b/NET/worlds/console/BookmarkAddDialog.java new file mode 100644 index 0000000..f2ad3d2 --- /dev/null +++ b/NET/worlds/console/BookmarkAddDialog.java @@ -0,0 +1,36 @@ +package NET.worlds.console; + +class BookmarkAddDialog implements MainCallback, DialogReceiver { + private java.awt.Window parent; + private DialogReceiver receiver; + private BookmarkEditDialog editor; + + BookmarkAddDialog(java.awt.Window parent, DialogReceiver receiver) { + this.parent = parent; + this.receiver = receiver; + Main.register(this); + } + + @Override + public void mainCallback() { + this.editor = new BookmarkEditDialog( + this.parent, + this, + Console.message("Add-WorldsMark2"), + WorldsMarkPart.getCurrentPositionName(), + Console.message("Add"), + Console.message("Cancel"), + WorldsMarkPart.getCurrentPositionURL(false) + ); + Main.unregister(this); + } + + public BookmarkEditDialog getEditor() { + return this.editor; + } + + @Override + public void dialogDone(Object who, boolean confirmed) { + this.receiver.dialogDone(this, confirmed); + } +} diff --git a/NET/worlds/console/BookmarkDeleteDialog.java b/NET/worlds/console/BookmarkDeleteDialog.java new file mode 100644 index 0000000..c88e8b5 --- /dev/null +++ b/NET/worlds/console/BookmarkDeleteDialog.java @@ -0,0 +1,138 @@ +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.List; + +class BookmarkDeleteDialog extends PolledDialog implements DialogReceiver { + private static final long serialVersionUID = 7297733090895837320L; + private List listbox = new List(10); + private Button delButton = new Button(Console.message("Delete")); + private Button cancelButton = new Button(Console.message("Done")); + private WorldsMarkPart bookmarks; + private static Font font = new Font(Console.message("MenuFont"), 0, 12); + private static Font bfont = new Font(Console.message("ButtonFont"), 0, 12); + + BookmarkDeleteDialog(WorldsMarkPart bookmarks) { + super(Console.getFrame(), null, Console.message("Delete-WorldsMark"), true); + this.bookmarks = bookmarks; + this.ready(); + } + + @Override + protected void build() { + int count = WorldsMarkPart.getBookmarkCount(); + + for (int i = 0; i < count; i++) { + this.listbox.add(WorldsMarkPart.getBookmarkName(i)); + } + + Label caption = new Label(Console.message("Choose-WorldsMark")); + GridBagLayout gbag = new GridBagLayout(); + this.setLayout(gbag); + GridBagConstraints c = new GridBagConstraints(); + c.fill = 2; + c.gridwidth = 0; + c.gridheight = 1; + c.weightx = 1.0; + c.weighty = 0.0; + caption.setFont(font); + this.add(gbag, caption, c); + c.fill = 1; + c.gridwidth = 0; + c.gridheight = 6; + c.weightx = 1.0; + c.weighty = 1.0; + this.listbox.setFont(font); + this.add(gbag, this.listbox, c); + c.fill = 0; + c.gridwidth = -1; + c.gridheight = 0; + c.anchor = 14; + c.weightx = 0.45; + c.weighty = 0.0; + this.delButton.setFont(bfont); + this.cancelButton.setFont(bfont); + this.add(gbag, this.delButton, c); + c.gridwidth = 0; + c.anchor = 16; + c.weightx = 0.55; + this.add(gbag, this.cancelButton, c); + } + + private void select(boolean state) { + this.delButton.setEnabled(state); + } + + @Override + public void show() { + super.show(); + if (this.listbox.getItemCount() != 0) { + this.listbox.select(0); + this.select(true); + } else { + this.select(false); + } + + this.listbox.requestFocus(); + } + + @Override + public boolean handleEvent(Event event) { + if (event.id == 701) { + this.select(true); + } else if (event.id == 702) { + this.select(false); + } + + return super.handleEvent(event); + } + + @Override + public boolean action(Event event, Object what) { + Object target = event.target; + if (target == this.cancelButton) { + return this.done(false); + } else if (target == this.delButton) { + int index = this.listbox.getSelectedIndex(); + if (index != -1) { + this.listbox.remove(index); + this.bookmarks.removeBookmark(index); + int count = this.listbox.getItemCount(); + if (index < count - 1) { + this.listbox.select(index); + } else if (count > 0) { + this.listbox.select(count - 1); + } else { + this.select(false); + this.listbox.requestFocus(); + } + } + + return true; + } else { + return false; + } + } + + @Override + public boolean keyDown(Event event, int key) { + return key != 27 && key != 10 ? super.keyDown(event, key) : this.done(false); + } + + private void add(String name, String target) { + this.bookmarks.addBookmark(name, target); + this.listbox.add(name); + this.listbox.makeVisible(this.listbox.getItemCount() - 1); + this.listbox.select(this.listbox.getItemCount() - 1); + this.select(true); + } + + @Override + public void dialogDone(Object who, boolean confirmed) { + } +} diff --git a/NET/worlds/console/BookmarkEditDialog.java b/NET/worlds/console/BookmarkEditDialog.java new file mode 100644 index 0000000..7d42600 --- /dev/null +++ b/NET/worlds/console/BookmarkEditDialog.java @@ -0,0 +1,146 @@ +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; + +class BookmarkEditDialog extends PolledDialog { + private static final long serialVersionUID = 3386024535827699136L; + private TextField nameField; + private TextField URLField; + private Button okButton; + private Button cancelButton; + private String newName; + private String newTarget; + private int index; + private static Font font = new Font(Console.message("MenuFont"), 0, 12); + private static Font bfont = new Font(Console.message("ButtonFont"), 0, 12); + + BookmarkEditDialog(java.awt.Window parent, DialogReceiver receiver, String title, String name, String url) { + this(parent, receiver, title, name, Console.message("OK"), Console.message("Cancel"), url, -1); + } + + BookmarkEditDialog(java.awt.Window parent, DialogReceiver receiver, String title, String name, String ok, String cancel, String url) { + this(parent, receiver, title, name, ok, cancel, url, -1); + } + + BookmarkEditDialog(java.awt.Window parent, DialogReceiver receiver, String name, String url, int index) { + this(parent, receiver, Console.message("Edit-WorldsMark"), name, Console.message("OK"), Console.message("Cancel"), url, index); + } + + private BookmarkEditDialog(java.awt.Window parent, DialogReceiver receiver, String title, String name, String ok, String cancel, String url, int index) { + super(parent, receiver, title, true); + this.index = index; + this.nameField = new TextField(name, 40); + this.URLField = new TextField(url, 40); + this.okButton = new Button(ok); + this.cancelButton = new Button(cancel); + this.ready(); + } + + @Override + protected void build() { + GridBagLayout gbag = new GridBagLayout(); + this.setLayout(gbag); + GridBagConstraints c = new GridBagConstraints(); + c.fill = 0; + c.weightx = 1.0; + c.weighty = 1.0; + c.gridwidth = 2; + c.gridheight = 1; + Label lName = new Label(Console.message("Name")); + this.add(gbag, lName, c); + c.gridwidth = 0; + c.fill = 2; + this.nameField.setFont(font); + this.URLField.setFont(font); + this.add(gbag, this.nameField, c); + c.fill = 0; + c.gridwidth = 2; + this.add(gbag, new Label("URL:"), c); + c.gridwidth = 0; + c.fill = 2; + this.add(gbag, this.URLField, c); + Panel buttons = new Panel(); + this.okButton.setFont(bfont); + this.cancelButton.setFont(bfont); + buttons.add(this.okButton); + buttons.add(this.cancelButton); + c.gridwidth = 0; + c.fill = 0; + this.add(gbag, buttons, c); + } + + @Override + public boolean action(Event event, Object what) { + Object target = event.target; + if (target == this.okButton && this.mayConfirm()) { + return this.done(true); + } else { + return target == this.cancelButton ? this.done(false) : false; + } + } + + @Override + public String getName() { + return this.newName; + } + + public String getTarget() { + return this.newTarget; + } + + public int getIndex() { + return this.index; + } + + private boolean mayConfirm() { + this.newName = this.nameField.getText(); + int i = this.newName.length(); + + do { + i--; + } while (i >= 0 && this.newName.charAt(i) == ' '); + + this.newName = this.newName.substring(0, i + 1); + this.newTarget = this.URLField.getText().trim(); + return this.newName.length() != 0 && this.newTarget.length() != 0; + } + + @Override + public boolean keyDown(Event event, int key) { + if (key == 27) { + return this.done(false); + } else { + if (key == 10) { + if (this.mayConfirm()) { + return this.done(true); + } + } else if (key == 9) { + if (event.target == this.nameField) { + this.URLField.requestFocus(); + this.URLField.selectAll(); + } else if (event.target == this.URLField) { + this.nameField.requestFocus(); + this.nameField.selectAll(); + } + + return true; + } + + return super.keyDown(event, key); + } + } + + @Override + public void show() { + super.show(); + this.nameField.requestFocus(); + this.nameField.selectAll(); + } +} diff --git a/NET/worlds/console/BookmarkListDialog.java b/NET/worlds/console/BookmarkListDialog.java new file mode 100644 index 0000000..e8586d5 --- /dev/null +++ b/NET/worlds/console/BookmarkListDialog.java @@ -0,0 +1,182 @@ +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.List; + +class BookmarkListDialog extends PolledDialog implements DialogReceiver { + private static final long serialVersionUID = 2134767291802432777L; + private List listbox = new List(10); + private Button editButton = new Button(Console.message("Edit")); + private Button addButton = new Button(Console.message("Add")); + private Button copyButton = new Button(Console.message("Copy")); + private Button delButton = new Button(Console.message("Delete")); + private Button okButton = new Button(Console.message("Go-To")); + private Button cancelButton = new Button(Console.message("Done")); + private WorldsMarkPart bookmarks; + private static Font font = new Font(Console.message("MenuFont"), 0, 12); + private static Font bfont = new Font(Console.message("ButtonFont"), 0, 12); + + BookmarkListDialog(WorldsMarkPart bookmarks) { + super(Console.getFrame(), null, Console.message("Edit-WorldsMarkL"), true); + this.bookmarks = bookmarks; + this.ready(); + } + + @Override + protected void build() { + int count = WorldsMarkPart.getBookmarkCount(); + + for (int i = 0; i < count; i++) { + this.listbox.add(WorldsMarkPart.getBookmarkName(i)); + } + + GridBagLayout gbag = new GridBagLayout(); + this.setLayout(gbag); + GridBagConstraints c = new GridBagConstraints(); + c.fill = 1; + c.weightx = 1.0; + c.weighty = 1.0; + c.gridwidth = 2; + c.gridheight = 6; + this.listbox.setFont(font); + this.add(gbag, this.listbox, c); + c.weightx = 0.0; + c.weighty = 0.0; + c.gridwidth = 0; + c.gridheight = 1; + c.fill = 2; + this.editButton.setFont(bfont); + this.addButton.setFont(bfont); + this.delButton.setFont(bfont); + this.okButton.setFont(bfont); + this.cancelButton.setFont(bfont); + this.add(gbag, this.editButton, c); + this.add(gbag, this.addButton, c); + this.add(gbag, this.copyButton, c); + this.add(gbag, this.delButton, c); + c.weighty = 1.0; + c.anchor = 15; + this.add(gbag, this.okButton, c); + c.weighty = 0.0; + this.add(gbag, this.cancelButton, c); + } + + private void select(boolean state) { + this.editButton.setEnabled(state); + this.delButton.setEnabled(state); + this.copyButton.setEnabled(state); + this.okButton.setEnabled(state); + } + + @Override + public void show() { + super.show(); + if (this.listbox.getItemCount() != 0) { + this.listbox.select(0); + this.select(true); + } else { + this.select(false); + } + + this.listbox.requestFocus(); + } + + @Override + public boolean handleEvent(Event event) { + if (event.id == 701) { + this.select(true); + } else if (event.id == 702) { + this.select(false); + } + + return super.handleEvent(event); + } + + @Override + public boolean action(Event event, Object what) { + Object target = event.target; + if (target == this.okButton || target == this.listbox) { + WorldsMarkPart.gotoBookmark(this.listbox.getSelectedIndex()); + return this.done(true); + } else if (target == this.cancelButton) { + return this.done(false); + } else if (target == this.delButton) { + int index = this.listbox.getSelectedIndex(); + if (index != -1) { + this.listbox.remove(index); + this.bookmarks.removeBookmark(index); + int count = this.listbox.getItemCount(); + if (index < count - 1) { + this.listbox.select(index); + } else if (count > 0) { + this.listbox.select(count - 1); + } else { + this.select(false); + this.listbox.requestFocus(); + } + } + + return true; + } else if (target == this.copyButton) { + int index = this.listbox.getSelectedIndex(); + if (index != -1) { + this.add(WorldsMarkPart.getBookmarkName(index), WorldsMarkPart.getBookmarkTarget(index)); + } + + return true; + } else if (target == this.addButton) { + new BookmarkAddDialog(this, this); + return true; + } else if (target == this.editButton) { + int index = this.listbox.getSelectedIndex(); + new BookmarkEditDialog(this, this, WorldsMarkPart.getBookmarkName(index), WorldsMarkPart.getBookmarkTarget(index), index); + return true; + } else { + return false; + } + } + + @Override + public boolean keyDown(Event event, int key) { + if (key == 27) { + return this.done(false); + } else if (key == 10) { + WorldsMarkPart.gotoBookmark(this.listbox.getSelectedIndex()); + return this.done(true); + } else { + return super.keyDown(event, key); + } + } + + private void add(String name, String target) { + this.bookmarks.addBookmark(name, target); + this.listbox.add(name); + this.listbox.makeVisible(this.listbox.getItemCount() - 1); + this.listbox.select(this.listbox.getItemCount() - 1); + this.select(true); + } + + @Override + public void dialogDone(Object who, boolean confirmed) { + if (confirmed) { + if (who instanceof BookmarkAddDialog) { + BookmarkAddDialog adder = (BookmarkAddDialog)who; + BookmarkEditDialog editor = adder.getEditor(); + this.add(editor.getName(), editor.getTarget()); + } else if (who instanceof BookmarkEditDialog) { + BookmarkEditDialog edit = (BookmarkEditDialog)who; + int index = edit.getIndex(); + String name = edit.getName(); + String target = edit.getTarget(); + this.bookmarks.changeBookmark(index, name, target); + this.listbox.replaceItem(name, index); + this.listbox.makeVisible(index); + this.listbox.select(index); + } + } + } +} diff --git a/NET/worlds/console/BookmarkMenuItem.java b/NET/worlds/console/BookmarkMenuItem.java new file mode 100644 index 0000000..6108bcf --- /dev/null +++ b/NET/worlds/console/BookmarkMenuItem.java @@ -0,0 +1,53 @@ +package NET.worlds.console; + +import NET.worlds.scape.Persister; +import NET.worlds.scape.Restorer; +import NET.worlds.scape.Saver; +import NET.worlds.scape.TooNewException; +import java.awt.MenuItem; +import java.io.IOException; + +public class BookmarkMenuItem extends MenuItem implements Persister { + private static final long serialVersionUID = -6078093402030113754L; + private String target; + private static Object classCookie = new Object(); + + public BookmarkMenuItem(String name, String target) { + super(name); + this.target = target; + } + + public BookmarkMenuItem() { + } + + public String getTarget() { + return this.target; + } + + public void setTarget(String loc) { + this.target = loc; + } + + @Override + public void saveState(Saver s) throws IOException { + s.saveVersion(1, classCookie); + s.saveString(this.getLabel()); + s.saveString(this.target); + } + + @Override + public void restoreState(Restorer r) throws IOException, TooNewException { + switch (r.restoreVersion(classCookie)) { + case 1: + this.setLabel(r.restoreString()); + this.target = r.restoreString(); + return; + default: + throw new TooNewException(); + } + } + + @Override + public void postRestore(int version) { + } +} diff --git a/NET/worlds/console/BootDialog.java b/NET/worlds/console/BootDialog.java new file mode 100644 index 0000000..e37de7d --- /dev/null +++ b/NET/worlds/console/BootDialog.java @@ -0,0 +1,83 @@ +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; + +public class BootDialog extends PolledDialog { + private static final long serialVersionUID = -4574101262059937239L; + private Label bootLabel = new Label(Console.message("User-to-Boot")); + 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 bootField = new TextField(""); + + public BootDialog(java.awt.Window parent, DialogReceiver receiver, String title) { + super(parent, receiver, title, true); + this.ready(); + } + + public String getBoot() { + return this.bootField.getText(); + } + + @Override + protected void build() { + GridBagLayout gbag = new GridBagLayout(); + this.setLayout(gbag); + GridBagConstraints c = new GridBagConstraints(); + c.weightx = 1.0; + c.weighty = 1.0; + c.gridheight = 1; + c.fill = 0; + c.gridwidth = 2; + this.add(gbag, this.bootLabel, c); + c.gridwidth = 0; + c.fill = 2; + this.bootField.setFont(font); + this.add(gbag, this.bootField, c); + Panel buttons = new Panel(); + this.okButton.setFont(bfont); + buttons.add(this.okButton); + this.cancelButton.setFont(bfont); + buttons.add(this.cancelButton); + c.gridwidth = 0; + c.fill = 0; + this.add(gbag, buttons, c); + } + + @Override + public void show() { + this.initialSize(320, 140); + super.show(); + this.bootField.requestFocus(); + } + + @Override + public boolean handleEvent(Event event) { + return event.id == 201 ? this.done(false) : super.handleEvent(event); + } + + @Override + public boolean action(Event event, Object what) { + Object target = event.target; + if (target == this.cancelButton) { + this.done(false); + } else if (target == this.okButton) { + this.done(true); + } + + return false; + } + + @Override + public boolean keyDown(Event event, int key) { + return key == 27 ? this.done(false) : super.keyDown(event, key); + } +} diff --git a/NET/worlds/console/CameraConveyor.java b/NET/worlds/console/CameraConveyor.java new file mode 100644 index 0000000..c271e80 --- /dev/null +++ b/NET/worlds/console/CameraConveyor.java @@ -0,0 +1,90 @@ +package NET.worlds.console; + +import NET.worlds.scape.FrameEvent; +import NET.worlds.scape.FrameHandler; +import NET.worlds.scape.NoSuchPropertyException; +import NET.worlds.scape.Pilot; +import NET.worlds.scape.Point3; +import NET.worlds.scape.Point3Temp; +import NET.worlds.scape.Property; +import NET.worlds.scape.Restorer; +import NET.worlds.scape.Saver; +import NET.worlds.scape.SuperRoot; +import NET.worlds.scape.TooNewException; +import NET.worlds.scape.WObject; +import java.io.IOException; +import java.util.Enumeration; + +public class CameraConveyor extends SuperRoot implements FrameHandler { + private Point3 vector; + private static Object classCookie = new Object(); + + public CameraConveyor() { + } + + public CameraConveyor(Point3Temp direction, float speed) { + this.vector = new Point3(direction.normalize().times(speed)); + } + + public CameraConveyor(Point3Temp v) { + this.vector = new Point3(v); + } + + @Override + public boolean handle(FrameEvent e) { + if (e.dt == 0) { + return true; + } else { + Enumeration stuff = (Enumeration)e.receiver.getContents(); + Point3Temp delta = Point3Temp.make(this.vector); + delta.times(e.dt / 1000.0F); + + while (stuff.hasMoreElements()) { + WObject thing = stuff.nextElement(); + if (thing instanceof Pilot) { + thing.moveThrough(delta); + } + } + + return true; + } + } + + @Override + public void saveState(Saver s) throws IOException { + s.saveVersion(1, classCookie); + super.saveState(s); + s.save(this.vector); + } + + @Override + public void restoreState(Restorer r) throws IOException, TooNewException { + switch (r.restoreVersion(classCookie)) { + case 1: + super.restoreState(r); + case 0: + this.vector = (Point3)r.restore(); + return; + default: + throw new TooNewException(); + } + } + + @Override + 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 = new Property(this, index, "Velocity"); + } else if (mode == 1) { + ret = this.vector; + } + break; + default: + ret = super.properties(index, offset + 1, mode, value); + } + + return ret; + } +} diff --git a/NET/worlds/console/ChannelDialog.java b/NET/worlds/console/ChannelDialog.java new file mode 100644 index 0000000..b2df8ac --- /dev/null +++ b/NET/worlds/console/ChannelDialog.java @@ -0,0 +1,84 @@ +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; + +public class ChannelDialog extends PolledDialog { + private static final long serialVersionUID = -3677512952231237135L; + private Label channelLabel = new Label(Console.message("New-channel")); + 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 TextField channelField; + + public ChannelDialog(java.awt.Window parent, DialogReceiver receiver, String title, String defChannel) { + super(parent, receiver, title, true); + this.channelField = new TextField(defChannel); + this.ready(); + } + + public String getChannel() { + return this.channelField.getText(); + } + + @Override + protected void build() { + GridBagLayout gbag = new GridBagLayout(); + this.setLayout(gbag); + GridBagConstraints c = new GridBagConstraints(); + c.weightx = 1.0; + c.weighty = 1.0; + c.gridheight = 1; + c.fill = 0; + c.gridwidth = 2; + this.channelLabel.setFont(font); + this.add(gbag, this.channelLabel, c); + c.gridwidth = 0; + c.fill = 2; + this.channelField.setFont(font); + this.add(gbag, this.channelField, c); + Panel buttons = new Panel(); + buttons.add(this.okButton); + buttons.add(this.cancelButton); + this.okButton.setFont(font); + this.cancelButton.setFont(font); + c.gridwidth = 0; + c.fill = 0; + this.add(gbag, buttons, c); + } + + @Override + public void show() { + this.initialSize(320, 140); + super.show(); + this.channelField.requestFocus(); + } + + @Override + public boolean handleEvent(Event event) { + return event.id == 201 ? this.done(false) : super.handleEvent(event); + } + + @Override + public boolean action(Event event, Object what) { + Object target = event.target; + if (target == this.cancelButton) { + this.done(false); + } else if (target == this.okButton) { + this.done(true); + } + + return false; + } + + @Override + public boolean keyDown(Event event, int key) { + return key == 27 ? this.done(false) : super.keyDown(event, key); + } +} diff --git a/NET/worlds/console/ChatArea.java b/NET/worlds/console/ChatArea.java new file mode 100644 index 0000000..a25f1e6 --- /dev/null +++ b/NET/worlds/console/ChatArea.java @@ -0,0 +1,248 @@ +package NET.worlds.console; + +import java.awt.Component; +import java.awt.Event; +import java.io.BufferedReader; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.IOException; +import java.io.PrintWriter; +import java.text.DateFormat; +import java.util.Date; +import java.util.Observer; +import javax.swing.JScrollPane; +import javax.swing.JTextArea; + +public class ChatArea extends JScrollPane implements SharedTextArea { + private JTextArea textArea; + private static String sharedText; + private boolean isShared; + private String unsharedText; + private String unaddedText; + private boolean haveFocus; + private PrintWriter logFile; + private String logFileName; + private static final long oneMeg = 1048576L; + private static final long logLengthLimit = 524288L; + private static PublicObservable obsLogFile = new PublicObservable(); + + public ChatArea(int rows, int cols, boolean isShared) { + this.textArea = new JTextArea(rows, cols); + this.isShared = isShared; + this.textArea.setEditable(false); + this.setViewportView(this.textArea); + super.setHorizontalScrollBarPolicy(31); + super.setVerticalScrollBarPolicy(20); + } + + @Override + public Component getComponent() { + return this; + } + + @Override + public void finalize() { + this.disableLogging(); + } + + @Override + public synchronized void validate() { + super.validate(); + String text = this.isShared ? sharedText : this.unsharedText; + if (text != null) { + this.textArea.replaceRange("", 0, this.textArea.getText().length()); + this.textArea.append(text); + } + } + + @Override + public synchronized void enableLogging(String fileName, String title, boolean append) { + if (this.logFile != null) { + if (this.logFileName.equals(fileName)) { + return; + } + + this.logFile.close(); + } + + try { + if (append && new File(fileName).exists()) { + this.truncateIfExceeds(fileName, title, 524288L); + this.logFile = new PrintWriter(new FileWriter(fileName, true)); + } else { + this.logFile = new PrintWriter(new FileWriter(fileName, false)); + obsLogFile.setChanged(true); + this.logFile.println(""); + this.logFile.println(""); + this.logFile.println("" + title + ""); + this.logFile.println(""); + this.logFile.println(""); + } + + this.logFileName = fileName; + this.logFile.println("
"); + this.logFile.println("

Conversation of " + DateFormat.getDateTimeInstance().format(new Date()) + "

"); + this.logFile.flush(); + obsLogFile.notifyObservers(this); + } catch (IOException var5) { + System.out.println("Log file not opened: " + var5); + } + } + + public static void addLogObserver(Observer o) { + obsLogFile.addObserver(o); + } + + public static void deleteLogObserver(Observer o) { + obsLogFile.deleteObserver(o); + } + + private synchronized void truncateIfExceeds(String fileName, String title, long lengthLimit) { + File f = new File(fileName); + if (f.length() > lengthLimit) { + File tf = new File(fileName + ".temp"); + + try { + BufferedReader in = new BufferedReader(new FileReader(f)); + PrintWriter out = new PrintWriter(new FileWriter(tf)); + out.println(""); + out.println(""); + out.println("" + title + ""); + out.println(""); + out.println(""); + in.skip(f.length() - lengthLimit / 2L); + String line = in.readLine(); + + for (String var13 = in.readLine(); var13 != null; var13 = in.readLine()) { + out.println(var13); + } + + in.close(); + out.close(); + f.delete(); + f = new File(fileName); + tf.renameTo(f); + } catch (FileNotFoundException var10) { + System.out.println("DuplexPart fatal: " + var10); + } catch (IOException var11) { + System.out.println("DuplexPart: Unable to write, " + var11); + } + } + } + + @Override + public synchronized void disableLogging() { + if (this.logFile != null) { + this.logFile.close(); + this.logFile = null; + } + } + + @Override + public boolean canAddText() { + return !this.haveFocus; + } + + private String toHtml(String s) { + assert s != null; + + String h = ""; + + for (int i = 0; i < s.length(); i++) { + char c = s.charAt(i); + switch (c) { + case '"': + h = h + """; + break; + case '&': + h = h + "&"; + break; + case '<': + h = h + "<"; + break; + case '>': + h = h + ">"; + break; + default: + h = h + c; + } + } + + return h; + } + + @Override + public synchronized void println(String msg) { + if (this.logFile != null && msg != null) { + this.logFile.println(this.toHtml(msg) + "
"); + this.logFile.flush(); + } + + if (this.unaddedText == null) { + this.unaddedText = msg; + } else if (msg != null) { + this.unaddedText = this.unaddedText + "\n" + msg; + } + + if (this.unaddedText != null && this.canAddText()) { + if (this.textArea.getText().length() == 0) { + this.textArea.append(this.unaddedText); + } else { + this.textArea.append("\n" + this.unaddedText); + } + + this.unaddedText = null; + String text = this.textArea.getText(); + if (text.length() > 20000) { + int linePos = text.indexOf(10, 10240); + if (linePos >= 0) { + text = text.substring(linePos + 1); + linePos = text.lastIndexOf(10); + if (linePos > 0) { + this.textArea.setText(text.substring(0, linePos)); + this.textArea.append(text.substring(linePos)); + } + } + } + + if (this.isShared) { + sharedText = text; + } else { + this.unsharedText = text; + } + } + } + + @Override + public synchronized void scrollToBottom() { + String text = this.textArea.getText(); + int textlen = text.length(); + this.textArea.select(textlen, textlen); + } + + @Override + public synchronized boolean handleEvent(Event event) { + if (event.id == 1004) { + this.haveFocus = true; + } else if (event.id == 1005) { + this.haveFocus = false; + } + + this.poll(); + return super.handleEvent(event); + } + + @Override + public void poll() { + if (this.unaddedText != null) { + this.println(null); + } + } + + @Override + public boolean isFocusTraversable() { + return false; + } +} diff --git a/NET/worlds/console/ChatDialog.java b/NET/worlds/console/ChatDialog.java new file mode 100644 index 0000000..0f4821e --- /dev/null +++ b/NET/worlds/console/ChatDialog.java @@ -0,0 +1,143 @@ +package NET.worlds.console; + +import java.awt.Button; +import java.awt.Choice; +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 ChatDialog extends PolledDialog { + private static final long serialVersionUID = 2346715931784644393L; + private Label fontsizeLabel = new Label(Console.message("Font-Size")); + private Label linesLabel = new Label(Console.message("Chat-Lines")); + private Label chatlengthLabel = new Label(Console.message("Chat-Buffer-Length")); + 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 Choice fontsizeChoice = new Choice(); + private Choice linesChoice = new Choice(); + private TextField chatlengthField; + + public ChatDialog(java.awt.Window parent, DialogReceiver receiver, String title, int defSize, int defLines, int defLength) { + super(parent, receiver, title, true); + this.chatlengthField = new TextField("" + defLength); + + for (int i = 0; i <= 16; i++) { + this.fontsizeChoice.insert(i + 10 + "pt", i); + } + + if (defSize >= 10 && defSize <= 16) { + this.fontsizeChoice.select(defSize - 10); + } else { + this.fontsizeChoice.select(2); + } + + for (int i = 0; i < 24; i++) { + this.linesChoice.insert(i + 6 + " lines", i); + } + + if (defLines >= 6 && defLines <= 30) { + this.linesChoice.select(defLines - 6); + } else { + this.linesChoice.select(0); + } + + this.ready(); + } + + public int getFontsize() { + try { + return this.fontsizeChoice.getSelectedIndex() + 10; + } catch (Exception var2) { + return 12; + } + } + + public int getLines() { + try { + return this.linesChoice.getSelectedIndex() + 6; + } catch (Exception var2) { + return 6; + } + } + + public int getLength() { + try { + return Integer.parseInt(this.chatlengthField.getText()); + } catch (Exception var2) { + return 20000; + } + } + + @Override + protected void build() { + GridBagLayout gbag = new GridBagLayout(); + this.setLayout(gbag); + GridBagConstraints c = new GridBagConstraints(); + c.weightx = 1.0; + c.weighty = 1.0; + c.gridheight = 1; + c.fill = 0; + c.gridwidth = 2; + this.fontsizeLabel.setFont(font); + this.add(gbag, this.fontsizeLabel, c); + c.gridwidth = 0; + c.fill = 2; + this.add(gbag, this.fontsizeChoice, c); + c.fill = 0; + c.gridwidth = 2; + this.linesLabel.setFont(font); + this.add(gbag, this.linesLabel, c); + c.gridwidth = 0; + c.fill = 2; + this.add(gbag, this.linesChoice, c); + c.gridwidth = 2; + this.chatlengthLabel.setFont(font); + this.add(gbag, this.chatlengthLabel, c); + c.gridwidth = 0; + c.fill = 2; + this.chatlengthField.setFont(font); + this.add(gbag, this.chatlengthField, c); + Panel buttons = new Panel(); + buttons.add(this.okButton); + buttons.add(this.cancelButton); + this.okButton.setFont(font); + this.cancelButton.setFont(font); + c.gridwidth = 0; + c.fill = 0; + this.add(gbag, buttons, c); + } + + @Override + public void show() { + this.initialSize(320, 160); + super.show(); + this.fontsizeChoice.requestFocus(); + } + + @Override + public boolean handleEvent(Event event) { + return event.id == 201 ? this.done(false) : super.handleEvent(event); + } + + @Override + public boolean action(Event event, Object what) { + Object target = event.target; + if (target == this.cancelButton) { + this.done(false); + } else if (target == this.okButton) { + this.done(true); + } + + return false; + } + + @Override + public boolean keyDown(Event event, int key) { + return key == 27 ? this.done(false) : super.keyDown(event, key); + } +} diff --git a/NET/worlds/console/ChatPart.java b/NET/worlds/console/ChatPart.java new file mode 100644 index 0000000..dfdf161 --- /dev/null +++ b/NET/worlds/console/ChatPart.java @@ -0,0 +1,72 @@ +package NET.worlds.console; + +import NET.worlds.scape.FrameEvent; +import NET.worlds.scape.Pilot; +import java.awt.Container; + +public class ChatPart extends DuplexPart { + private Window renderWindow; + private DefaultConsole console; + private static final String activateVCselfWhisper = "&|+debug= 0 && ii < s.length() - 1 && s.charAt(ii + 1) == 'u') { + Pilot.sendText(Console.parseUnicode(s)); + } else { + Pilot.sendText(s); + } + } + + @Override + public void activate(Console c, Container f, Console prev) { + super.activate(c, f, prev); + this.console = (DefaultConsole)c; + } + + @Override + public void deactivate() { + super.deactivate(); + this.renderWindow = null; + this.console = null; + } + + @Override + public synchronized boolean handle(FrameEvent f) { + boolean ret = super.handle(f); + if (this.renderWindow == null && this.console != null) { + RenderCanvas rc = this.console.getRender(); + if (rc != null) { + Window w = rc.getWindow(); + if (w != null) { + try { + w.hookChatLine(this.line); + this.renderWindow = w; + } catch (WindowNotFoundException var6) { + } + } + } + } + + return ret; + } + + private void triggerLocalDebug(String s) { + if (s.startsWith("&|+debug"); + this.logFile.println(""); + this.logFile.println("" + title + ""); + this.logFile.println(""); + this.logFile.println(""); + } + + this.logFileName = fileName; + this.logFile.println("
"); + this.logFile.println("

Conversation of " + DateFormat.getDateTimeInstance().format(new Date()) + "

"); + this.logFile.flush(); + obsLogFile.notifyObservers(this); + } catch (IOException var5) { + System.out.println("Log file not opened: " + var5); + } + } + + public static void addLogObserver(Observer o) { + obsLogFile.addObserver(o); + } + + public static void deleteLogObserver(Observer o) { + obsLogFile.deleteObserver(o); + } + + private void truncateIfExceeds(String fileName, String title, long lengthLimit) { + File f = new File(fileName); + if (f.length() > lengthLimit) { + File tf = new File(fileName + ".temp"); + + try { + BufferedReader in = new BufferedReader(new FileReader(f)); + PrintWriter out = new PrintWriter(new FileWriter(tf)); + out.println(""); + out.println(""); + out.println("" + title + ""); + out.println(""); + out.println(""); + in.skip(f.length() - lengthLimit / 2L); + String line = in.readLine(); + + for (String var13 = in.readLine(); var13 != null; var13 = in.readLine()) { + out.println(var13); + } + + in.close(); + out.close(); + f.delete(); + f = new File(fileName); + tf.renameTo(f); + } catch (FileNotFoundException var10) { + System.out.println("DuplexPart fatal: " + var10); + } catch (IOException var11) { + System.out.println("DuplexPart: Unable to write, " + var11); + } + } + } + + @Override + public synchronized void disableLogging() { + if (this.logFile != null) { + this.logFile.close(); + this.logFile = null; + } + } + + @Override + public boolean canAddText() { + return !this.haveFocus ? true : true; + } + + @Override + public synchronized void println(String msg) { + if (this.logFile != null && msg != null) { + this.logFile.println(DuplexPart.toHtml(msg) + "
"); + this.logFile.flush(); + } + + if (this.unaddedText == null) { + this.unaddedText = msg; + } else if (msg != null) { + this.unaddedText = this.unaddedText + "\n" + msg; + } + + if (this.unaddedText != null && this.canAddText()) { + if (this.getText().length() == 0) { + this.append(this.unaddedText); + } else { + this.append("\n" + this.unaddedText); + } + + this.unaddedText = null; + String text = this.getText(); + if (text.length() > chatLengthLimit) { + int linePos = text.indexOf(10, chatLengthLimit / 2 - 80); + if (linePos >= 0) { + text = text.substring(linePos + 1); + linePos = text.lastIndexOf(10); + if (linePos > 0) { + this.setText(text.substring(0, linePos)); + this.append(text.substring(linePos)); + } + } + } + + if (this.isShared) { + sharedText = text; + } else { + this.unsharedText = text; + } + } + } + + @Override + public synchronized void scrollToBottom() { + String text = this.getText(); + int textlen = text.length(); + this.select(textlen, textlen); + } + + @Override + public boolean handleEvent(Event event) { + if (event.id == 1004) { + this.haveFocus = true; + } else if (event.id == 1005) { + this.haveFocus = false; + } + + this.poll(); + return super.handleEvent(event); + } + + @Override + public void poll() { + if (this.unaddedText != null) { + this.println(null); + } + } + + @Override + public boolean isFocusTraversable() { + return false; + } + + @Override + public synchronized void paint(Graphics g) { + String[] fulltext = this.getText().split("\n"); + Rectangle r = this.getBounds(); + if (r.height >= 0 && r.width >= 0) { + Point offset = new Point(0, 0); + 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); + offGraphic.setFont(this.getFont()); + FontMetrics fm = offGraphic.getFontMetrics(this.getFont()); + int windowY = offset.y; + int curY = fm.getHeight(); + int curLine = 0; + int curPos = 0; + int mode = -1; + System.out + .println("paint (" + r.x + "," + r.y + "):" + r.height + "," + r.width + " Offset=" + offset.x + "," + offset.y + " lines=" + fulltext.length); + System.out.println("curLine=" + curLine + " curY=" + curY); + + for (int i = curLine; i < fulltext.length && curY <= windowY + r.height; i++) { + if (mode != 0) { + offGraphic.drawString(fulltext[i], offset.x, curY); + curY += fm.getHeight(); + } + } + } + } +} diff --git a/NET/worlds/console/ColorFiller.java b/NET/worlds/console/ColorFiller.java new file mode 100644 index 0000000..3749678 --- /dev/null +++ b/NET/worlds/console/ColorFiller.java @@ -0,0 +1,41 @@ +package NET.worlds.console; + +import java.awt.Dimension; +import java.awt.Panel; +import java.awt.Rectangle; + +class ColorFiller extends Panel { + private static final long serialVersionUID = 7047615493861713512L; + private int w; + private int h; + + ColorFiller(int width, int height) { + this.w = width; + this.h = height; + } + + public void setHeight(int newH) { + this.h = newH; + } + + public void setWidth(int newW) { + this.w = newW; + } + + @Override + public Dimension preferredSize() { + return new Dimension(this.w, this.h); + } + + @Override + public Dimension getMaximumSize() { + return this.preferredSize(); + } + + @Override + public void setBounds(Rectangle r) { + r.width = this.w; + r.height = this.h; + super.setBounds(r); + } +} diff --git a/NET/worlds/console/ConfirmDialog.java b/NET/worlds/console/ConfirmDialog.java new file mode 100644 index 0000000..f0613e4 --- /dev/null +++ b/NET/worlds/console/ConfirmDialog.java @@ -0,0 +1,40 @@ +package NET.worlds.console; + +import java.awt.GridBagConstraints; +import java.awt.Label; + +public class ConfirmDialog extends OkCancelDialog { + private static final long serialVersionUID = 2839131701328189735L; + private String prompt; + + public ConfirmDialog(java.awt.Window parent, DialogReceiver target, String title, String prompt) { + super(parent, target, title, Console.message("No"), Console.message("Yes")); + this.prompt = prompt; + this.ready(); + } + + public ConfirmDialog(java.awt.Window parent, String title, String prompt) { + this(parent, (DialogReceiver)parent, title, prompt); + } + + @Override + protected void build() { + GridBagConstraints c = new GridBagConstraints(); + c.weightx = 1.0; + c.weighty = 1.0; + c.gridwidth = 0; + this.add(this.gbag, new Label(this.prompt), c); + super.build(); + } + + @Override + protected boolean setValue() { + return true; + } + + @Override + public void show() { + super.show(); + this.okButton.requestFocus(); + } +} diff --git a/NET/worlds/console/ConnectionRecord.java b/NET/worlds/console/ConnectionRecord.java new file mode 100644 index 0000000..74e7867 --- /dev/null +++ b/NET/worlds/console/ConnectionRecord.java @@ -0,0 +1,47 @@ +package NET.worlds.console; + +import java.util.Date; +import java.util.Vector; + +class ConnectionRecord { + private static Vector recordList = new Vector(); + private String _who = null; + private Date _startDelayTime = null; + + public ConnectionRecord(String who) { + this._who = who; + this._startDelayTime = new Date(); + } + + public boolean isExpired(Date now) { + return now.getTime() - this._startDelayTime.getTime() > 15000L; + } + + public String getWho() { + return this._who; + } + + public static Vector getList() { + return recordList; + } + + public static synchronized boolean checkList(String w) { + boolean delayed = false; + int i = 0; + Date now = new Date(); + + while (!recordList.isEmpty() && i < recordList.size()) { + ConnectionRecord r = recordList.elementAt(i); + if (r.isExpired(now)) { + recordList.removeElementAt(i); + } else { + i++; + if (r.getWho().equals(w)) { + delayed = true; + } + } + } + + return delayed; + } +} diff --git a/NET/worlds/console/Console.java b/NET/worlds/console/Console.java new file mode 100644 index 0000000..1fc32ab --- /dev/null +++ b/NET/worlds/console/Console.java @@ -0,0 +1,1542 @@ +package NET.worlds.console; + +import NET.worlds.core.IniFile; +import NET.worlds.core.Std; +import NET.worlds.network.ConnectionWaiter; +import NET.worlds.network.DNSLookup; +import NET.worlds.network.Galaxy; +import NET.worlds.network.InfiniteWaitException; +import NET.worlds.network.InvalidServerURLException; +import NET.worlds.network.NetworkObject; +import NET.worlds.network.OldPropertyList; +import NET.worlds.network.PacketTooLargeException; +import NET.worlds.network.PropertyList; +import NET.worlds.network.PropertySetCmd; +import NET.worlds.network.URL; +import NET.worlds.network.VarErrorException; +import NET.worlds.network.WorldServer; +import NET.worlds.network.net2Property; +import NET.worlds.scape.Attribute; +import NET.worlds.scape.BooleanPropertyEditor; +import NET.worlds.scape.Drone; +import NET.worlds.scape.FrameEvent; +import NET.worlds.scape.FrameHandler; +import NET.worlds.scape.HoloDrone; +import NET.worlds.scape.HoloPilot; +import NET.worlds.scape.InventoryManager; +import NET.worlds.scape.LoadedURLSelf; +import NET.worlds.scape.NoSuchPropertyException; +import NET.worlds.scape.Pilot; +import NET.worlds.scape.ProgressiveAdder; +import NET.worlds.scape.PropAdder; +import NET.worlds.scape.Property; +import NET.worlds.scape.Restorer; +import NET.worlds.scape.Room; +import NET.worlds.scape.Saver; +import NET.worlds.scape.StringPropertyEditor; +import NET.worlds.scape.SuperRoot; +import NET.worlds.scape.TeleportStatus; +import NET.worlds.scape.TooNewException; +import NET.worlds.scape.URLPropertyEditor; +import NET.worlds.scape.URLSelf; +import NET.worlds.scape.URLSelfLoader; +import NET.worlds.scape.VectorProperty; +import NET.worlds.scape.WObject; +import NET.worlds.scape.WobLoaded; +import NET.worlds.scape.WobLoader; +import NET.worlds.scape.World; +import java.awt.CardLayout; +import java.awt.CheckboxMenuItem; +import java.awt.Container; +import java.awt.Event; +import java.awt.Font; +import java.awt.Menu; +import java.awt.MenuBar; +import java.awt.MenuItem; +import java.awt.MenuShortcut; +import java.awt.Panel; +import java.awt.PopupMenu; +import java.io.File; +import java.io.IOException; +import java.net.HttpURLConnection; +import java.net.MalformedURLException; +import java.net.URLConnection; +import java.text.MessageFormat; +import java.util.Enumeration; +import java.util.Hashtable; +import java.util.Locale; +import java.util.MissingResourceException; +import java.util.ResourceBundle; +import java.util.Vector; + +public abstract class Console extends SuperRoot implements URLSelf, MainCallback, NetworkObject, WobLoaded, DialogDisabled, ConnectionWaiter { + private static Vector storedLines = new Vector(); + protected boolean disableShaperAccess = false; + protected boolean disableSingleUserAccess = false; + private static Console active; + private Panel myCard; + private static int nameCounter; + private static Font font = new Font(message("MenuFont"), 0, 12); + private URL targetAv; + private static String activeTeleportURL; + private static String lastTeleportURL; + private static FrameEvent frameEvent; + private static int freezeFrameEvents = 0; + private String sleepMode = ""; + private int lastUserAction; + private Vector parts = new Vector(); + private static MenuBar menuBar = new MenuBar(); + protected boolean enableMenu = false; + protected MenuItem exitItem; + private Hashtable menus = new Hashtable(); + protected static boolean autoFullVIP = IniFile.override().getIniInt("tieredVIP", 0) == 0; + protected static boolean isRedLightWorld = IniFile.override().getIniString("ProductName", "").equalsIgnoreCase("RedLightWorld") + || IniFile.override().getIniString("ProductName", "").equalsIgnoreCase("RedLightCenter"); + protected static int vip = IniFile.gamma().getIniInt("VIP", 0) != 0 ? (autoFullVIP ? 2 : 1) : 0; + protected static int spguest = IniFile.gamma().getIniInt("SPGUEST", 0) != 0 ? 2 : 0; + private boolean canBroadcast = false; + protected URL lastPilotRequested; + public String pendingPilot = ""; + protected boolean setFromMenu = false; + private String postFix = ""; + public static boolean selfCustom = false; + protected Vector callbacks = new Vector(); + private String defaultAction = ""; + protected String tempCarAvatar = ""; + protected static String defaultConsole = IniFile.gamma().getIniString("DEFAULTCONSOLE", "NET.worlds.console.DefaultConsole"); + private static Hashtable defConsoles = new Hashtable(); + private static Console defaultUnshared; + private int refcnt = 0; + protected Pilot pilotSoulTemplate; + protected Drone droneSoulTemplate; + protected Pilot pilot; + public boolean targetValid = false; + private String sleepStr = message("asleep"); + protected static GammaFrame frame = new GammaFrame(); + protected Galaxy galaxy = null; + protected URL _galaxyURL; + private Cursor cursor = new Cursor(URL.make("system:WAIT_CURSOR")); + private Vector tempArea = new Vector(); + private static Object classCookie = new Object(); + + static { + WhisperManager.whisperManager().setParent(frame); + } + + public static synchronized void println(String msg) { + if (active != null) { + active.printLine(msg); + } else { + storedLines.addElement(msg); + } + } + + public static void printWhisper(String from, String msg) { + if (active != null) { + active.printWhisperFrom(from, msg); + } + } + + public static void printOwnWhisper(String to, String msg) { + if (active != null) { + active.printWhisperTo(to, msg); + } + } + + public static void startWhispering(String to) { + if (active != null) { + active.startWhisperingTo(to); + } + } + + public static synchronized String message(String Id) { + Locale currentLocale = Locale.getDefault(); + + try { + String bundlePrefix = IniFile.override().getIniString("BundlePrefix", "MessagesBundle"); + ResourceBundle messages = ResourceBundle.getBundle(bundlePrefix, currentLocale); + String mess = messages.getString(Id); + if (mess.indexOf(123) == -1 && mess.indexOf(125) == -1) { + mess = Std.replaceStr(mess, "''", "'"); + } + + if (mess.lastIndexOf(".gif") > 0 || mess.lastIndexOf(".jpg") > 0 || mess.lastIndexOf(".bmp") > 0) { + File f = new File(mess); + if (!f.exists()) { + return Id; + } + } + + return mess; + } catch (MissingResourceException var6) { + if (Galaxy.getDebugLevel() != 0) { + System.out.println("MRE: " + var6.getClassName() + " " + var6.getKey()); + System.out.println("NO MESSAGE for " + Id); + } + + return Id; + } + } + + public static synchronized String parseUnicode(String s) { + if (s == null) { + return s; + } else { + int idx; + while ((idx = s.indexOf("\\u")) != -1) { + if (idx >= s.length() - 5) { + return s; + } + + String x = s.substring(idx + 2, idx + 6); + char p = (char)Integer.parseInt(x, 16); + String tmp = s.substring(0, idx) + p + s.substring(idx + 6); + s = tmp; + } + + return s; + } + } + + public static synchronized Vector parseUnicode(Vector cc) { + for (int i = 0; i < cc.size(); i++) { + String s = cc.elementAt(i); + String s2 = parseUnicode(s); + cc.setElementAt(s2, i); + } + + return cc; + } + + public static synchronized String parseExtended(String s) { + String uc = ""; + + for (int i = 0; i < s.length(); i++) { + char c = s.charAt(i); + if (c > 255) { + int ii = c; + + try { + uc = uc + "\\u" + Integer.toHexString(ii); + } catch (NumberFormatException var6) { + uc = uc + "?"; + } + } else { + uc = uc + c; + } + } + + return uc; + } + + public static boolean wasHttpNoSuchFile(String us) { + java.net.URL u = null; + URLConnection uc = null; + + try { + u = DNSLookup.lookup(new java.net.URL(us)); + uc = u.openConnection(); + } catch (Exception var5) { + return true; + } + + try { + return ((HttpURLConnection)uc).getResponseCode() == 404; + } catch (Exception var4) { + return true; + } + } + + protected void printWhisperFrom(String from, String msg) { + if (!msg.startsWith("&|+")) { + Object[] arguments = new Object[]{new String(from), new String(msg)}; + println(MessageFormat.format(message("whispered"), arguments)); + } + } + + protected void printWhisperTo(String to, String msg) { + if (!msg.startsWith("&|+")) { + Object[] arguments = new Object[]{new String(to), new String(msg)}; + println(MessageFormat.format(message("You-whispered"), arguments)); + } + } + + protected void startWhisperingTo(String to) { + Object[] arguments = new Object[]{new String(to)}; + println(MessageFormat.format(message("You-want-whisp"), arguments)); + } + + public void printLine(String msg) { + System.out.println(msg); + } + + public boolean isShaperAccessDisabled() { + return this.disableShaperAccess; + } + + public boolean isSingleUserAccessDisabled() { + return this.disableSingleUserAccess; + } + + public static Console getActive() { + return active; + } + + public void inventoryChanged() { + } + + public void forPilotOnlyActivate() { + if (active != this) { + this.myCard = new Panel(); + String myCardName = "" + nameCounter++; + Container consoleTile = frame.getConsoleTile(); + consoleTile.add(myCardName, this.myCard); + Console prev = active; + this.activate(this.myCard); + ((CardLayout)consoleTile.getLayout()).show(consoleTile, myCardName); + getFrame().validate(); + if (prev != null) { + consoleTile.remove(prev.myCard); + prev.myCard.removeAll(); + } + } + } + + protected void setEnableMenu(boolean enable) { + this.enableMenu = enable; + if (this == active) { + enable |= Gamma.shaper != null; + boolean enabled = frame.getMenuBar() == menuBar && menuBar != null; + if (enable != enabled) { + frame.setMenuBar(enable ? menuBar : null); + frame.pack(); + } + } + } + + private static synchronized void setActive(Console active) { + Console.active = active; + int sz = storedLines.size(); + if (sz > 0) { + for (int i = 0; i < sz; i++) { + active.printLine(storedLines.elementAt(i)); + } + + storedLines.removeAllElements(); + } + } + + protected void activate(Container c) { + assert this.pilot != null; + + Console prev = active; + if (active != null) { + active.deactivate(); + } + + setActive(this); + Main.register(this); + this.menus.clear(); + menuBar = new MenuBar(); + this.getMenu("File"); + if (Gamma.shaper != null) { + Gamma.shaper.activate(this, c, prev); + } + + int len = this.parts.size(); + + for (int i = 0; i < len; i++) { + this.parts.elementAt(i).activate(this, c, prev); + } + + this.exitItem = this.addMenuItem(message("Exit"), "File"); + if (activeTeleportURL != null) { + teleportNotification("", activeTeleportURL); + } + + this.cursor.activate(); + } + + protected void menuDone() { + this.setEnableMenu(this.enableMenu); + } + + protected void deactivate() { + if (active == this) { + setActive(null); + Main.unregister(this); + int len = this.parts.size(); + + for (int i = 0; i < len; i++) { + this.parts.elementAt(i).deactivate(); + } + + if (Gamma.shaper != null) { + Gamma.shaper.deactivate(); + } + + this.cursor.deactivate(); + frame.deactivate(); + } + } + + public String getActiveTeleportURL() { + return lastTeleportURL == null ? "" : lastTeleportURL; + } + + public static void teleportNotification(String err, String url) { + if (err != null && err.length() == 0) { + activeTeleportURL = url; + lastTeleportURL = url.toString(); + } else { + activeTeleportURL = null; + } + + if (active != null) { + if (active instanceof TeleportStatus) { + ((TeleportStatus)active).teleportStatus(err, url); + } + + int len = active.parts.size(); + + for (int i = 0; i < len; i++) { + Object fp = active.parts.elementAt(i); + if (fp instanceof TeleportStatus) { + ((TeleportStatus)fp).teleportStatus(err, url); + } + } + } + } + + public static void setFreezeFrameEvents(boolean x) { + if (x) { + freezeFrameEvents++; + } else { + freezeFrameEvents--; + + assert freezeFrameEvents >= 0; + } + } + + @Override + public void mainCallback() { + if (frameEvent == null) { + frameEvent = new FrameEvent(null, null); + } + + if (freezeFrameEvents <= 0) { + frameEvent.newFrameTime(); + frameEvent.source = this; + this.generateFrameEvents(frameEvent); + frameEvent.target = null; + frameEvent.receiver = null; + frameEvent.source = null; + } + } + + public void generateFrameEvents(FrameEvent f) { + World.generateFrameEvents(f); + int now = Std.getFastTime(); + if (Window.getAndResetUserActionCount() != 0) { + this.setSleepMode(null); + this.lastUserAction = now; + } else if (now > this.lastUserAction + 300000) { + if (this.lastUserAction == 0) { + this.lastUserAction = now; + } else { + this.goToSleep(); + } + } + + int len = this.parts.size(); + if (Main.profile != 0) { + for (int i = 0; i < len; i++) { + FramePart fp = this.parts.elementAt(i); + int start = Std.getRealTime(); + long startBytes = Runtime.getRuntime().freeMemory(); + fp.handle(f); + int dur = Std.getRealTime() - start; + long used = startBytes - Runtime.getRuntime().freeMemory(); + if (dur > Main.profile) { + System.out.println("Took " + dur + "ms and " + used + " bytes to call framePart " + fp); + } + } + } else { + for (int ix = 0; ix < len; ix++) { + this.parts.elementAt(ix).handle(f); + } + } + + ProgressiveAdder.get().handle(f); + if (this instanceof FrameHandler) { + ((FrameHandler)this).handle(f); + } + + if (this.pilot != null) { + this.pilot.generateFrameEvents(f); + } + } + + public void addPart(FramePart p) { + this.parts.addElement(p); + } + + public Enumeration getParts() { + return this.parts.elements(); + } + + public boolean action(Event event, Object what) { + if (event.target == this.exitItem) { + return maybeQuit(); + } else if (Gamma.shaper != null && Gamma.shaper.action(event, what)) { + return true; + } else { + int len = this.parts.size(); + + for (int i = 0; i < len; i++) { + if (this.parts.elementAt(i).action(event, what)) { + return true; + } + } + + return false; + } + } + + public boolean handleEvent(Event e) { + return e.id == 201 ? maybeQuit() : false; + } + + public boolean okToQuit() { + return true; + } + + public static void quit() { + if (Gamma.getShaper() != null) { + Gamma.getShaper().maybeQuit(); + } else { + GammaFrameState.saveBorder(); + Main.end(); + } + } + + public static boolean maybeQuit() { + Console c = getActive(); + if (c == null || c.okToQuit()) { + quit(); + } + + return true; + } + + public static MenuBar getMenuBar() { + return menuBar; + } + + public Menu getMenu(String name) { + Menu menu = this.menus.get(name); + if (menu == null) { + if (!name.equals("Help") && !name.equals("Options") && !name.equals("VIP")) { + menu = new Menu(name); + menuBar.add(menu); + } else { + menu = new PopupMenu(); + } + + this.menus.put(name, menu); + } + + return menu; + } + + public void addMenuItem(MenuItem item, String menuName) { + this.getMenu(menuName).add(item); + item.setFont(font); + } + + public MenuItem addMenuItem(String itemName, String menuName) { + MenuItem item = new MenuItem(itemName); + this.getMenu(menuName).add(item); + item.setFont(font); + return item; + } + + public MenuItem addMenuItem(String itemName, String menuName, int keyCode, boolean shiftKey) { + MenuItem item = new MenuItem(itemName); + MenuShortcut shortcut = new MenuShortcut(keyCode, shiftKey); + item.setShortcut(shortcut); + this.getMenu(menuName).add(item); + item.setFont(font); + return item; + } + + public CheckboxMenuItem addMenuCheckbox(String itemName, String menuName) { + CheckboxMenuItem item = new CheckboxMenuItem(itemName); + this.getMenu(menuName).add(item); + item.setFont(font); + return item; + } + + @Override + public void dialogDisable(boolean disable) { + int len = this.parts.size(); + + for (int i = 0; i < len; i++) { + FramePart part = this.parts.elementAt(i); + if (part instanceof DialogDisabled) { + ((DialogDisabled)part).dialogDisable(disable); + } + } + } + + public static final native String encrypt(String var0); + + public static final native String decrypt(String var0); + + public static String encode(String password) { + String coded = ""; + if (password != null) { + char[] cryptChars = encrypt(password).toCharArray(); + + for (int i = 0; i < cryptChars.length; i++) { + String hex = Integer.toHexString(cryptChars[i]); + if (hex.length() == 1) { + hex = "0" + hex; + } + + coded = coded + hex; + } + } + + return coded; + } + + public static String decode(String password) { + try { + int length = password.length(); + if (length != 0 && (length & 1) == 0) { + char[] cryptChars = new char[length / 2]; + int j = 0; + + for (int i = 0; i < cryptChars.length; j += 2) { + cryptChars[i] = (char)Integer.parseInt(password.substring(j, j + 2), 16); + i++; + } + + String ret = decrypt(new String(cryptChars)); + if (ret != null && ret.length() != 0) { + return ret; + } + } + } catch (NumberFormatException var5) { + } + + return null; + } + + public static final native int getVolumeInfo(); + + public boolean getVIPAvatars() { + return vip > 0 || isRedLightWorld; + } + + public boolean getVIP() { + return vip > 0; + } + + public void setVIP(boolean vip) { + Console.vip = vip ? 1 : 0; + this.checkCourtesyVIP(); + IniFile.gamma().setIniInt("VIP", Console.vip); + if (autoFullVIP && vip) { + Console.vip = 2; + } + } + + public boolean getFullVIP() { + return vip == 2; + } + + public void setFullVIP(boolean fullVIP) { + if (fullVIP) { + vip = 2; + } + + IniFile.gamma().setIniInt("VIP", vip); + } + + public boolean getSpecialGuest() { + return spguest > 0; + } + + public void setSpecialGuest(boolean spguest) { + if (Console.spguest > 1 != spguest) { + Console.spguest = spguest ? 1 : 0; + IniFile.gamma().setIniInt("SPGUEST", Console.spguest); + Console.spguest = Console.spguest + Console.spguest; + } + } + + public void checkCourtesyVIP() { + int oldVIP = vip; + if (vip < 1) { + World w = this.getPilot().getWorld(); + vip = w != null && w.isHomeWorld() && w.getCourtesyVIP() ? 1 : 0; + } + + if (vip != oldVIP) { + if (vip == 1) { + println(message("You-VIP")); + } else { + println(message("You-no-VIP")); + } + } + + URL av = this.getDefaultAvatarURL(); + if (!av.equals(this.getAvatarName())) { + this.setAvatar(av); + } + } + + public boolean broadcastEnabled() { + return this.canBroadcast; + } + + public void enableBroadcast(boolean enabled) { + this.canBroadcast = enabled; + } + + public abstract URL getAvatarName(); + + public abstract void setChatname(String var1); + + public void serverStatus(WorldServer serv, VarErrorException ve) { + System.out.println("status-- " + serv + ": " + ve.getMsg()); + } + + @Override + public void property(OldPropertyList propList) { + assert false; + } + + @Override + public void propertyUpdate(PropertyList propList) { + assert false; + } + + @Override + public WorldServer getServer() { + URL url = this.getGalaxyURL(); + if (url != null && this.galaxy != null) { + try { + return this.getGalaxy().getServer(url); + } catch (InvalidServerURLException var3) { + println(">>" + var3.getMessage()); + return null; + } + } else { + return null; + } + } + + public WorldServer getServerNew() { + URL url = this.getGalaxyURL(); + if (url != null && this.galaxy != null) { + try { + return this.getGalaxy().getServer(url); + } catch (InvalidServerURLException var3) { + println(">>" + var3.getMessage()); + return null; + } + } else { + return null; + } + } + + @Override + public String getLongID() { + return this.galaxy.getChatname(); + } + + @Override + public void register() { + } + + @Override + public void galaxyDisconnected() { + this.setChatname(""); + this.galaxy.waitForConnection(this); + } + + @Override + public void reacquireServer(WorldServer oldServ) { + } + + @Override + public void changeChannel(Galaxy g, String oldChannel, String newChannel) { + this.pilot.changeChannel(g, oldChannel, newChannel); + } + + protected void handleVAR_BITMAP(String s) { + if (s.charAt(0) == 0) { + s = s.substring(2); + } + + try { + this.loadPilot(new URL(URL.getAvatar(), s)); + } catch (MalformedURLException var3) { + this.loadPilot(URL.make("error:\"" + s + '"')); + } + } + + protected void loadPilot(URL url) { + if (!url.equals(this.lastPilotRequested)) { + this.lastPilotRequested = url; + this.pendingPilot = url.toString(); + Pilot.load(url, this); + this.setFromMenu = false; + } + } + + @Override + public void wobLoaded(WobLoader loader, SuperRoot w) { + String err = null; + if (w == null) { + err = message("no-load-pilot"); + println(err + " " + loader.getWobName()); + } else if (!(w instanceof Pilot)) { + err = message("not-pilot"); + println(loader.getWobName().toString() + " " + err); + } else { + try { + this.setPilot((Pilot)w); + } catch (IllegalPilotException var7) { + err = var7.getMessage(); + } + } + + if (this.pilot == null && err != null && !this.disableSingleUserAccess) { + this.useDefaultPilot(); + err = null; + } + + int end = this.callbacks.size(); + + for (int i = 0; i < end; i++) { + LoadedURLSelf callback = this.callbacks.elementAt(i); + if (err == null) { + callback.loadedURLSelf(this, this.getSourceURL(), null); + } else { + this.decRef(); + callback.loadedURLSelf(null, this.getSourceURL(), err); + } + } + + this.callbacks.removeAllElements(); + } + + public static URL getDefaultURL() { + String defaultAvatar = IniFile.override().getIniString("DefaultAvatar", "avatar:pengo.mov"); + return URL.make(defaultAvatar); + } + + protected void useDefaultPilot() { + try { + this.setPilot(new HoloPilot(getDefaultURL())); + } catch (IllegalPilotException var2) { + assert false; + } + } + + public abstract void setOnlineState(boolean var1, boolean var2); + + @Override + public void connectionCallback(Object caller, boolean connected) { + if (caller instanceof Galaxy) { + if (caller != this.galaxy) { + return; + } + + if (!connected) { + return; + } + + this.setAvatar(this.lastPilotRequested); + this.displayAds(); + } + } + + public void displayAds() { + Pilot p = Pilot.getActive(); + if (p != null) { + World w = p.getWorld(); + if (w != null) { + w.setupAdBanner(); + } + } + } + + public void setDefaultAction(String newda) { + this.defaultAction = newda; + } + + public String getDefaultAction() { + return this.defaultAction; + } + + public URL getDefaultAvatarURL() { + String defAv = getDefaultURL().toString(); + String av = IniFile.gamma().getIniString("AVATAR", defAv); + String vav = IniFile.gamma().getIniString("VIPAVATAR", ""); + boolean isVIPAv = av.toLowerCase().endsWith(".rwg"); + if (vav.equals("")) { + vav = av; + if (isVIPAv) { + IniFile.gamma().setIniString("VIPAVATAR", av); + } + } + + if (this.tempCarAvatar != "") { + av = this.tempCarAvatar; + } else if (this.getVIPAvatars()) { + av = vav; + } else if (isVIPAv) { + av = defAv; + } + + return URL.make(av); + } + + public Console() { + this.add(this.cursor); + this.galaxy = Galaxy.getAnonGalaxy(); + this.regWithGalaxy(); + this.setServerURL(null); + } + + public Console(URL serverURL) { + this.add(this.cursor); + this.galaxy = Galaxy.getAnonGalaxy(); + this.regWithGalaxy(); + this.setServerURL(serverURL); + this.templateInit(); + } + + @Override + public void loadInit() { + this.templateInit(); + this.add(this.cursor); + } + + public void addCursor(Cursor c) { + this.add(c); + } + + private void templateInit() { + this.pilotSoulTemplate = new HoloPilot(); + this.droneSoulTemplate = new HoloDrone(); + this.add(this.pilotSoulTemplate); + this.add(this.droneSoulTemplate); + } + + public static void load(URL url, LoadedURLSelf callback) { + if (url != null && url.endsWith(".console")) { + new ConsoleLoader(url, callback); + } else { + Console c; + if (url == null) { + c = defaultUnshared; + } else { + c = defConsoles.get(url); + } + + if (c != null && c.galaxy == null) { + if (c.getGalaxyURL() == null) { + c.galaxy = Galaxy.getAnonGalaxy(); + } else { + try { + c.galaxy = Galaxy.getGalaxy(c.getGalaxyURL()); + } catch (InvalidServerURLException var5) { + System.out.println("Illegal ServerURL = " + c.getGalaxyURL()); + c.galaxy = Galaxy.getAnonGalaxy(); + c.setServerURL(null); + } + } + + c.regWithGalaxy(); + c.regPilot(); + } + + assert c == null || c.galaxy != null; + + if (c == null) { + try { + Class cl = Class.forName(defaultConsole); + c = (Console)cl.newInstance(); + } catch (Exception var4) { + System.out.println("Can't use class " + defaultConsole + ", using DefaultConsole instead."); + var4.printStackTrace(System.out); + c = new DefaultConsole(); + } + + assert c != null; + + if (c.galaxy == null) { + c.galaxy = Galaxy.getAnonGalaxy(); + c.regWithGalaxy(); + c.regPilot(); + } + + assert c.galaxy != null; + + c.loadInit(); + c.setServerURL(url); + if (url == null) { + c.setName("unshared"); + defaultUnshared = c; + } else { + defConsoles.put(c.getGalaxyURL(), c); + } + } + + c.incRef(); + c.initPilot(url, callback); + } + } + + protected void initPilot(URL pilotURL, LoadedURLSelf callback) { + this.loadPilot(this.getDefaultAvatarURL()); + if (this.pilot == null) { + this.useDefaultPilot(); + } + + callback.loadedURLSelf(this, pilotURL, null); + } + + @Override + public void incRef() { + this.refcnt++; + } + + @Override + public void decRef() { + if (--this.refcnt == 0) { + if (this.galaxy != null) { + this.unregWithGalaxy(); + this.unregPilot(); + this.galaxy.decWorldCount(); + Galaxy oldGalaxy = this.galaxy; + this.galaxy = null; + } + + this.pilot = null; + URL url = this.getSourceURL(); + if (url != null) { + if (url.endsWith(".console")) { + URLSelfLoader.unload(this); + } else { + defConsoles.remove(url); + } + } + } + } + + @Override + public String toString() { + return super.toString() + "[" + this.getSourceURL() + "]"; + } + + public Pilot getPilotSoulTemplate() { + return this.pilotSoulTemplate; + } + + public Drone getDroneSoulTemplate() { + return this.droneSoulTemplate; + } + + public Pilot getPilot() { + return this.pilot; + } + + public boolean isValidAv() { + if (this.targetAv == null) { + return false; + } else if (!InventoryManager.getInventoryManager().inventoryInitialized()) { + return true; + } else { + String av = this.targetAv.getAbsolute(); + int len = av.length(); + + for (int i = 1; i < len; i++) { + if (av.charAt(i - 1) == '_') { + char firstChar = av.charAt(i); + if (Character.isLowerCase(firstChar)) { + StringBuffer item = new StringBuffer(); + item.append(Character.toUpperCase(firstChar)); + + while (++i < len) { + char c = av.charAt(i); + if (!Character.isLowerCase(c)) { + break; + } + + item.append(c); + } + + if (InventoryManager.getInventoryManager().checkInventoryFor(item.toString()) <= 0) { + return false; + } + } + } + } + + return true; + } + } + + public void resetAvatar() { + this.setAvatar(this.targetAv); + } + + public void setAvatar(URL url) { + if (url != null) { + BlackBox.getInstance().submitEvent(new BBDroneBitmapCommand("@Pilot", url.toString())); + this.targetAv = url; + this.targetValid = true; + if (url.getAbsolute().length() > 220) { + println(message("av-too-complex")); + url = URL.make("avatar:holden.mov"); + this.targetValid = false; + } else if (!this.isValidAv()) { + println(message("av-has-inventory")); + url = URL.make("avatar:holden.mov"); + this.targetValid = false; + } + + this.loadPilot(url); + WorldServer serv = this.getServerNew(); + if (serv != null) { + assert serv.getVersion() >= 18; + + PropertyList propList = new PropertyList(); + propList.addProperty(new net2Property(5, 64, 1, url.getAbsolute())); + + try { + serv.sendNetworkMsg(new PropertySetCmd(propList)); + } catch (PacketTooLargeException var5) { + assert url.getAbsolute().length() < 220; + + assert false; + } catch (InfiniteWaitException var6) { + } + } + } + } + + public static void wake() { + if (active != null) { + active.setSleepMode(null); + } + } + + public void goToSleep() { + this.setSleepMode(this.sleepStr); + Window.getAndResetUserActionCount(); + } + + public boolean isSleeping() { + return !this.sleepMode.equals(""); + } + + protected void setSleepMode(String mode) { + if (mode == null) { + mode = ""; + this.lastUserAction = Std.getFastTime(); + } + + if (this.pilot != null) { + this.pilot.setSleepMode(mode); + } + + if (!mode.equals(this.sleepMode)) { + WorldServer serv = this.getServerNew(); + if (serv != null) { + PropertyList propList = new PropertyList(); + propList.addProperty(new net2Property(23, 64, 1, mode)); + + try { + serv.sendNetworkMsg(new PropertySetCmd(propList)); + } catch (PacketTooLargeException var5) { + assert false; + } catch (InfiniteWaitException var6) { + } + + this.sleepMode = mode; + } + } + } + + public void setPilot(Pilot a) throws IllegalPilotException { + assert a != null; + + Room prevRoom = null; + if (this.pilot != null) { + prevRoom = this.pilot.getRoom(); + this.unregPilot(); + } + + this.pilot = a; + this.pilot.getSharer().createDynamicFromNet(); + this.pilot.setConsole(this); + this.regPilot(); + if (active == this) { + Pilot.changeActiveRoom(prevRoom); + } + + this.pilot.setSleepMode(this.sleepMode); + if (this instanceof DefaultConsole) { + ((DefaultConsole)this).resetCamera(); + } + } + + public static GammaFrame getFrame() { + return frame; + } + + public Galaxy getGalaxy() { + assert this.galaxy != null; + + return this.galaxy; + } + + public URL getGalaxyURL() { + return this._galaxyURL; + } + + public void setServerURL(URL serverURL) { + try { + if (serverURL != null) { + this._galaxyURL = URL.make("worldserver://" + getServerHost(serverURL) + "/"); + } + } catch (InvalidServerURLException var5) { + println(">>" + var5.getMessage()); + + assert false; + + this._galaxyURL = null; + } + + Galaxy oldGalaxy = this.galaxy; + this.unregWithGalaxy(); + this.unregPilot(); + if (this._galaxyURL != null) { + try { + this.galaxy = Galaxy.getGalaxy(this._galaxyURL); + } catch (InvalidServerURLException var4) { + println(">>" + var4.getMessage()); + this.galaxy = Galaxy.getAnonGalaxy(); + } + } else { + this.galaxy = Galaxy.getAnonGalaxy(); + } + + assert this.galaxy != null; + + this.regWithGalaxy(); + this.regPilot(); + if (oldGalaxy != null) { + oldGalaxy.decWorldCount(); + if (oldGalaxy != this.galaxy) { + oldGalaxy.forceObjectRereg(); + } + } + } + + private void regWithGalaxy() { + assert this.galaxy != null; + + this.galaxy.addConsole(this); + this.galaxy.waitForConnection(this); + } + + private void unregWithGalaxy() { + assert this.galaxy != null; + + this.galaxy.delConsole(this); + } + + protected void regPilot() { + if (this.pilot != null) { + this.pilot.getSharer().adjustShare(); + } + } + + public static String getServerHost(URL url) throws InvalidServerURLException { + String s = url.unalias(); + int len = s.length(); + if (len > 14 && s.startsWith("worldserver://")) { + if (s.charAt(len - 1) == '/') { + len--; + } + + s = s.substring(14, len); + if (s.equals("209.67.68.214:6650")) { + s = "www.3dcd.com:6650"; + } + + return s; + } else { + throw new InvalidServerURLException("Bad worldserver:// URL format"); + } + } + + public static URL makeServerURL(String host) { + assert host != null && host.length() > 0; + + return URL.make("worldserver://" + host + "/"); + } + + protected void unregPilot() { + if (this.pilot != null) { + this.pilot.getSharer().adjustShare(); + } + } + + public Cursor getCursor() { + return this.cursor; + } + + public String getScriptServer() { + String Fred = "Fred"; + String override = IniFile.override().getIniString("ScriptServer", Fred); + if (!override.equals(Fred)) { + return new String(override); + } else { + WorldServer server = this.getServerNew(); + if (server != null) { + String sname = server.getScriptServer(); + if (sname != null) { + return new String(sname); + } + } + + return new String("http://www-dynamic.us.worlds.net/cgi-bin/"); + } + } + + public String getSmtpServer() { + WorldServer server = this.getServerNew(); + if (server != null) { + String sname = server.getSmtpServer(); + if (sname != null) { + return sname; + } + } + + return "www.3dcd.com:25"; + } + + public String getMailDomain() { + WorldServer server = this.getServerNew(); + if (server != null) { + String dname = server.getMailDomain(); + if (dname != null) { + return dname; + } + } + + return "3dcd.com"; + } + + @Override + public Object properties(int index, int offset, int mode, Object value) throws NoSuchPropertyException { + Object ret = null; + switch (index - offset) { + case 0: + if (mode == 0) { + ret = URLPropertyEditor.make(new Property(this, index, "Server URL").allowSetNull(), null); + } else if (mode == 1) { + ret = this.getGalaxyURL(); + } else if (mode == 2) { + if (value == null) { + this.setServerURL(null); + } else { + URL u = (URL)value; + if (u != null && !u.unalias().startsWith("worldserver:")) { + println(message("server-URL")); + } else { + this.setServerURL(u); + } + } + } + break; + case 1: + if (mode == 0) { + ret = BooleanPropertyEditor.make(new Property(this, index, "Enable Menu Bar"), "No", "Yes"); + } else if (mode == 1) { + ret = new Boolean(this.enableMenu); + } else if (mode == 2) { + this.setEnableMenu((Boolean)value); + } + break; + case 2: + if (mode == 0) { + ret = BooleanPropertyEditor.make(new Property(this, index, "Disable Shaper Access (irreversible!)"), "No", "Yes"); + } else if (mode == 1) { + ret = new Boolean(this.disableShaperAccess); + } else if (mode == 2) { + this.disableShaperAccess = (Boolean)value; + } + break; + case 3: + if (mode == 0) { + ret = BooleanPropertyEditor.make(new Property(this, index, "Disable Single-user Access"), "No", "Yes"); + } else if (mode == 1) { + ret = new Boolean(this.disableSingleUserAccess); + } else if (mode == 2) { + this.disableSingleUserAccess = (Boolean)value; + } + break; + case 4: + if (mode == 0) { + ret = new Property(this, index, "Pilot Soul Template"); + } else if (mode == 1) { + ret = this.pilotSoulTemplate; + } + break; + case 5: + if (mode == 0) { + ret = new Property(this, index, "Drone Soul Template"); + } else if (mode == 1) { + ret = this.droneSoulTemplate; + } + break; + case 6: + if (mode == 0) { + ret = new Property(this, index, "Cursor"); + } else if (mode == 1) { + ret = this.getCursor(); + } + break; + case 7: + if (mode == 0) { + ret = PropAdder.make(new VectorProperty(this, index, "Temporary Area")); + } else if (mode == 1) { + ret = this.tempArea.clone(); + } else if (mode == 4) { + this.tempArea.removeElement(value); + ((SuperRoot)value).detach(); + } else if (mode == 3) { + this.tempArea.addElement(value); + this.add((SuperRoot)value); + if (value instanceof Console) { + Console c = (Console)value; + if (c.pilotSoulTemplate == null) { + c.loadInit(); + } + } + } else if (mode == 5 && value instanceof SuperRoot && !(value instanceof Room)) { + ret = value; + } + break; + case 8: + if (mode == 0) { + ret = StringPropertyEditor.make(new Property(this, index, "Default Action")); + } else if (mode == 1) { + ret = this.getDefaultAction(); + } else if (mode == 2) { + this.setDefaultAction((String)value); + } + break; + default: + ret = super.properties(index, offset + 9, mode, value); + } + + return ret; + } + + @Override + public void saveState(Saver s) throws IOException { + s.saveVersion(4, classCookie); + super.saveState(s); + URL.save(s, this.getGalaxyURL()); + s.saveBoolean(this.enableMenu); + s.saveBoolean(this.disableShaperAccess); + s.saveString(this.defaultAction); + s.save(this.pilotSoulTemplate); + s.save(this.droneSoulTemplate); + s.save(this.cursor); + } + + private static URL restoreOldURL(Restorer r) throws IOException { + String s = r.restoreString(); + return s != null && !s.equals("UNSHARED") ? makeServerURL(s) : null; + } + + @Override + public void restoreState(Restorer r) throws IOException, TooNewException { + int vers = r.restoreVersion(classCookie); + switch (vers) { + case 0: + case 1: + WObject w = new WObject(); + w.restoreState(r); + this.setName(w.getName()); + this.templateInit(); + Enumeration e = w.getAttributes(); + + while (e.hasMoreElements()) { + Attribute a = e.nextElement(); + a.setAttrID(a.getForwardAttrID()); + } + + Pilot.copySoul(w, this.pilotSoulTemplate); + this.setServerURL(restoreOldURL(r)); + this.enableMenu = r.restoreBoolean(); + this.disableShaperAccess = r.restoreBoolean(); + if (vers == 1) { + this.cursor = (Cursor)r.restore(); + } + break; + case 2: + super.restoreState(r); + this.setServerURL(restoreOldURL(r)); + this.enableMenu = r.restoreBoolean(); + this.disableShaperAccess = r.restoreBoolean(); + this.pilotSoulTemplate = (Pilot)r.restore(); + this.add(this.pilotSoulTemplate); + this.droneSoulTemplate = (Drone)r.restore(); + this.add(this.droneSoulTemplate); + this.cursor = (Cursor)r.restore(); + break; + case 3: + super.restoreState(r); + this.setServerURL(restoreOldURL(r)); + this.enableMenu = r.restoreBoolean(); + this.disableShaperAccess = r.restoreBoolean(); + this.defaultAction = r.restoreString(); + this.pilotSoulTemplate = (Pilot)r.restore(); + this.add(this.pilotSoulTemplate); + this.droneSoulTemplate = (Drone)r.restore(); + this.add(this.droneSoulTemplate); + this.cursor = (Cursor)r.restore(); + break; + case 4: + super.restoreState(r); + this.setServerURL(URL.restore(r)); + this.enableMenu = r.restoreBoolean(); + this.disableShaperAccess = r.restoreBoolean(); + this.defaultAction = r.restoreString(); + this.pilotSoulTemplate = (Pilot)r.restore(); + this.add(this.pilotSoulTemplate); + this.droneSoulTemplate = (Drone)r.restore(); + this.add(this.droneSoulTemplate); + this.cursor = (Cursor)r.restore(); + break; + default: + throw new TooNewException(); + } + + this.add(this.cursor); + } +} diff --git a/NET/worlds/console/ConsoleLoader.java b/NET/worlds/console/ConsoleLoader.java new file mode 100644 index 0000000..5bb2fd8 --- /dev/null +++ b/NET/worlds/console/ConsoleLoader.java @@ -0,0 +1,29 @@ +package NET.worlds.console; + +import NET.worlds.network.URL; +import NET.worlds.scape.LoadedURLSelf; +import NET.worlds.scape.URLSelf; +import NET.worlds.scape.URLSelfLoader; + +class ConsoleLoader implements LoadedURLSelf { + private LoadedURLSelf callback; + + public ConsoleLoader(URL url, LoadedURLSelf callback) { + this.callback = callback; + URLSelfLoader.load(url, this, true); + } + + @Override + public void loadedURLSelf(URLSelf o, URL url, String err) { + Console c = (Console)o; + if (err == null && c.pilot == null) { + if (c.disableSingleUserAccess) { + c.callbacks.addElement(this.callback); + } else { + c.initPilot(url, this.callback); + } + } else { + this.callback.loadedURLSelf(o, url, err); + } + } +} diff --git a/NET/worlds/console/Conveyor.java b/NET/worlds/console/Conveyor.java new file mode 100644 index 0000000..a0e899e --- /dev/null +++ b/NET/worlds/console/Conveyor.java @@ -0,0 +1,60 @@ +package NET.worlds.console; + +import NET.worlds.scape.FrameEvent; +import NET.worlds.scape.FrameHandler; +import NET.worlds.scape.Point3; +import NET.worlds.scape.Point3Temp; +import NET.worlds.scape.Restorer; +import NET.worlds.scape.Saver; +import NET.worlds.scape.SuperRoot; +import NET.worlds.scape.TooNewException; +import NET.worlds.scape.WObject; +import java.io.IOException; +import java.util.Enumeration; + +public class Conveyor extends SuperRoot implements FrameHandler { + private Point3 vector; + private static Object classCookie = new Object(); + + public Conveyor(Point3Temp direction, float speed) { + this.vector = new Point3(direction.normalize().times(speed)); + } + + public Conveyor(Point3Temp v) { + this.vector = new Point3(v); + } + + @Override + public boolean handle(FrameEvent e) { + Enumeration stuff = (Enumeration)e.receiver.getContents(); + Point3Temp delta = this.vector; + delta.times(e.dt / 1000.0F); + + while (stuff.hasMoreElements()) { + WObject thing = stuff.nextElement(); + thing.moveThrough(delta); + } + + return true; + } + + @Override + public void saveState(Saver s) throws IOException { + s.saveVersion(1, classCookie); + super.saveState(s); + s.save(this.vector); + } + + @Override + public void restoreState(Restorer r) throws IOException, TooNewException { + switch (r.restoreVersion(classCookie)) { + case 1: + super.restoreState(r); + case 0: + this.vector = (Point3)r.restore(); + return; + default: + throw new TooNewException(); + } + } +} diff --git a/NET/worlds/console/Cursor.java b/NET/worlds/console/Cursor.java new file mode 100644 index 0000000..a9c9f3c --- /dev/null +++ b/NET/worlds/console/Cursor.java @@ -0,0 +1,218 @@ +package NET.worlds.console; + +import NET.worlds.network.URL; +import NET.worlds.scape.BGLoaded; +import NET.worlds.scape.BackgroundLoader; +import NET.worlds.scape.NoSuchPropertyException; +import NET.worlds.scape.Property; +import NET.worlds.scape.Restorer; +import NET.worlds.scape.Room; +import NET.worlds.scape.Saver; +import NET.worlds.scape.SuperRoot; +import NET.worlds.scape.TooNewException; +import NET.worlds.scape.URLPropertyEditor; +import java.io.IOException; +import java.text.MessageFormat; +import java.util.Enumeration; +import java.util.Hashtable; + +public class Cursor extends SuperRoot implements BGLoaded { + private URL url = URL.make("system:DEFAULT_CURSOR"); + private int hCursor; + private static Cursor active; + private static Hashtable sysCursors = new Hashtable(); + private static int defaultCursor = retrieveSystemCursor(addCursor("DEFAULT_CURSOR", "IDC_ARROW")); + private static Object classCookie; + + static { + assert defaultCursor != 0; + + addCursor("CROSSHAIR_CURSOR", "IDC_CROSS"); + addCursor("TEXT_CURSOR", "IDC_IBEAM"); + addCursor("WAIT_CURSOR", "IDC_WAIT"); + addCursor("NE_RESIZE_CURSOR", "IDC_SIZENESW"); + addCursor("SW_RESIZE_CURSOR", "IDC_SIZENESW"); + addCursor("NW_RESIZE_CURSOR", "IDC_SIZENWSE"); + addCursor("SE_RESIZE_CURSOR", "IDC_SIZENWSE"); + addCursor("N_RESIZE_CURSOR", "IDC_SIZENS"); + addCursor("S_RESIZE_CURSOR", "IDC_SIZENS"); + addCursor("W_RESIZE_CURSOR", "IDC_SIZEWE"); + addCursor("E_RESIZE_CURSOR", "IDC_SIZEWE"); + addCursor("HAND_CURSOR", "IDC_UPARROW"); + addCursor("MOVE_CURSOR", "IDC_SIZEALL"); + addCursor("CANNOT_CURSOR", "IDC_NO"); + classCookie = new Object(); + } + + private static URL addCursor(String javaName, String win32Name) { + URL url = URL.make("system:" + javaName); + sysCursors.put(url, win32Name); + return url; + } + + public Cursor() { + } + + public Cursor(URL url) { + this.setURL(url); + } + + public void setURL(URL url) { + this.url = url; + if (!url.unalias().startsWith("system:")) { + BackgroundLoader.get(this, url); + } else { + this.activate(); + } + } + + public static Cursor getActive() { + return active; + } + + public void activate() { + SuperRoot owner = this.getOwner(); + if (owner != null && owner == Console.getActive()) { + int sysCurs = retrieveSystemCursor(this.url); + if (sysCurs != 0) { + Window.setCursor(sysCurs); + this.maybeDestroyCursor(); + this.hCursor = sysCurs; + } else if (this.hCursor != 0) { + Window.setCursor(this.hCursor); + } + + active = this; + } + } + + public void deactivate() { + if (active == this) { + active = null; + } + } + + public URL getURL() { + return this.url; + } + + public static Enumeration getSysCursorURLs() { + return sysCursors.keys(); + } + + public static native int getSystemCursorWidth(); + + public static native int getSystemCursorHeight(); + + public static native int getSystemCursorDepth(); + + private static native int loadCursor(String var0); + + private static native int loadSystemCursor(String var0); + + private static native void destroyCursor(int var0); + + private static int retrieveSystemCursor(URL url) { + int handle = 0; + Object c = sysCursors.get(url); + if (c != null) { + if (c instanceof String) { + handle = loadSystemCursor((String)c); + sysCursors.put(url, new Integer(handle)); + } else { + handle = (Integer)c; + } + } + + return handle; + } + + private void maybeDestroyCursor() { + if (this.hCursor != 0) { + if (!sysCursors.contains(new Integer(this.hCursor))) { + destroyCursor(this.hCursor); + } + + this.hCursor = 0; + } + } + + @Override + public Object asyncBackgroundLoad(String localName, URL remoteName) { + this.deactivate(); + this.maybeDestroyCursor(); + if (localName == null) { + return null; + } else { + if ((this.hCursor = loadCursor(localName)) != 0) { + this.activate(); + } + + return null; + } + } + + @Override + public boolean syncBackgroundLoad(Object obj, URL remoteURL) { + if (this.hCursor == 0) { + Object[] arguments = new Object[]{new String("" + this.url)}; + Console.println(MessageFormat.format(Console.message("Load-cursor"), arguments)); + } + + return false; + } + + @Override + public Room getBackgroundLoadRoom() { + SuperRoot owner = this.getOwner(); + return owner != null && owner instanceof Console ? ((Console)owner).getPilot().getRoom() : null; + } + + @Override + 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, "File"), "cur;ani", getSysCursorURLs()); + } else if (mode == 1) { + ret = this.getURL(); + } else if (mode == 2) { + this.setURL((URL)value); + } + break; + default: + ret = super.properties(index, offset + 1, mode, value); + } + + return ret; + } + + @Override + public void saveState(Saver s) throws IOException { + s.saveVersion(1, classCookie); + super.saveState(s); + URL.save(s, this.url); + } + + @Override + public void restoreState(Restorer r) throws IOException, TooNewException { + switch (r.restoreVersion(classCookie)) { + case 0: + r.restoreMaybeNull(); + String s = r.restoreString(); + if (!s.endsWith(".cur") && !s.endsWith(".ani")) { + this.setURL(URL.make("system:" + this.url)); + } else { + this.setURL(URL.restore(r, s, null)); + } + break; + case 1: + super.restoreState(r); + this.setURL(URL.restore(r)); + break; + default: + throw new TooNewException(); + } + } +} diff --git a/NET/worlds/console/DefaultConsole.java b/NET/worlds/console/DefaultConsole.java new file mode 100644 index 0000000..557bd71 --- /dev/null +++ b/NET/worlds/console/DefaultConsole.java @@ -0,0 +1,1999 @@ +package NET.worlds.console; + +import NET.worlds.core.ArchiveMaker; +import NET.worlds.core.IniFile; +import NET.worlds.core.Std; +import NET.worlds.network.Galaxy; +import NET.worlds.network.NetUpdate; +import NET.worlds.network.RemoteFileConst; +import NET.worlds.network.URL; +import NET.worlds.network.WorldServer; +import NET.worlds.scape.BooleanPropertyEditor; +import NET.worlds.scape.CDAudio; +import NET.worlds.scape.CDControl; +import NET.worlds.scape.CDPlayerAction; +import NET.worlds.scape.EquipAction; +import NET.worlds.scape.FrameEvent; +import NET.worlds.scape.MusicManager; +import NET.worlds.scape.NoSuchPropertyException; +import NET.worlds.scape.Pilot; +import NET.worlds.scape.PosableShape; +import NET.worlds.scape.Property; +import NET.worlds.scape.RenderWare; +import NET.worlds.scape.Restorer; +import NET.worlds.scape.Saver; +import NET.worlds.scape.SelectAvatarAction; +import NET.worlds.scape.SendURLAction; +import NET.worlds.scape.TeleportAction; +import NET.worlds.scape.TooNewException; +import NET.worlds.scape.URLPropertyEditor; +import NET.worlds.scape.VehicleShape; +import NET.worlds.scape.World; +import java.awt.BorderLayout; +import java.awt.CardLayout; +import java.awt.CheckboxMenuItem; +import java.awt.Color; +import java.awt.Component; +import java.awt.Container; +import java.awt.Dimension; +import java.awt.Event; +import java.awt.FlowLayout; +import java.awt.Font; +import java.awt.GridLayout; +import java.awt.Label; +import java.awt.Menu; +import java.awt.MenuItem; +import java.awt.Panel; +import java.awt.PopupMenu; +import java.awt.Rectangle; +import java.awt.Toolkit; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.io.File; +import java.io.FilenameFilter; +import java.io.IOException; +import java.text.Collator; +import java.text.DateFormat; +import java.text.MessageFormat; +import java.util.Date; +import java.util.Locale; +import java.util.MissingResourceException; +import java.util.NoSuchElementException; +import java.util.ResourceBundle; +import java.util.StringTokenizer; +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 = new AdPart(URL.make(this.defaultAd)); + ColorFiller adFiller; + ChatPart chat = new ChatPart(); + RenderCanvas render = new RenderCanvas(this, new Dimension(560, 360)); + Panel renderAndUniverse; + UniversePanel universe; + CardLayout renderCard; + InventoryPart inventory = new InventoryPart(); + WorldsMarkPart marks = new WorldsMarkPart(); + FriendsListPart friends = new FriendsListPart(); + ActionsPart actions = new ActionsPart(); + MuteListPart mutes = new MuteListPart(); + MapPart map = new MapPart(); + SavedAvPart savedAvs = new SavedAvPart(); + 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 = arrowKeyMsg; + String overrideMessage; + String lastStatus = ""; + int lastUpdateTime = 0; + boolean wasTeleporting = false; + private int lastVMCheck; + private int lastVMBigWarning; + Component bottom; + Component top; + Label status = new UnpaddedLabel("", 2); + Label yourName = new UnpaddedLabel("", 0); + static String[] lNames = lpList(); + static int lLength = lNames.length; + static MenuItem[] lLangs = new MenuItem[lLength]; + static Locale[] newLocale = new Locale[lLength]; + static String[][] lCodes = new String[lLength][2]; + Vector lList = new Vector(); + Vector sList = new Vector(); + int[] lSizes = new int[10]; + int dLength = this.dpList(this.lList, this.sList, this.lSizes); + MenuItem[] dLangs = this.dLength == 0 ? null : new MenuItem[this.dLength]; + Locale[] newdLocale = this.dLength == 0 ? null : new Locale[this.dLength]; + Vector flList = new Vector(); + Vector fsList = new Vector(); + int[] fSizes = new int[10]; + int fLength = this.fpList(this.flList, this.fsList, this.fSizes); + MenuItem[] dFonts = this.fLength == 0 ? null : new MenuItem[this.fLength]; + Locale[] newfLocale = this.fLength == 0 ? null : new Locale[this.fLength]; + static boolean wasDelta; + static boolean doDrive; + Panel mapPanel; + private static String signIn = Console.message("Sign-In"); + private static String signOut = Console.message("Sign-Out"); + private static String signingIn = Console.message("Signing-In"); + private static String noMultiUser = Console.message("Network"); + private static String enable3D = Console.message("Enable3D"); + private static String disable3D = Console.message("Disable3D"); + private static String showTags = Console.message("ShowNametags"); + private static String hideTags = Console.message("HideNametags"); + private static String enableClassicChat = Console.message("EnableClassicChat"); + private static String disableClassicChat = Console.message("DisableClassicChat"); + private static String configureChat = Console.message("Config-Chat"); + Menu chatLogMenu; + AvMenu avatarMenu; + private int chooseView = -1; + private int chooseCamSpeed = -1; + private static String sleepStatus = Console.message("Sleeping"); + OkCancelDialog reloginDialog; + private Object nextAvatarMutex = new Object(); + private URL nextAvatar; + private CheckboxMenuItem nextAvatarItem; + private CheckboxMenuItem curAvatarItem; + private static String lastWorldName = ""; + private static String lowVMMsg = Console.message("Low-virt"); + private boolean showedMidWarn; + private static boolean startupMemCheck = true; + public static int physMem; + protected URL avatarURL; + private static Object classCookie = new Object(); + + public UniversePanel getUniversePanel() { + return this.universe; + } + + @Override + public void printLine(String msg) { + this.chat.println(msg); + super.printLine(msg); + } + + @Override + protected void printWhisperFrom(String from, String msg) { + WhisperManager.whisperManager().printFrom(from, msg); + } + + @Override + protected void printWhisperTo(String to, String msg) { + WhisperManager.whisperManager().printTo(to, msg); + } + + @Override + protected void startWhisperingTo(String to) { + WhisperManager.whisperManager().startTo(to); + } + + public DefaultConsole() { + 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 in) { + if (this.orthographicViewItem != null) { + this.orthographicViewItem.setEnabled(in); + } + } + + @Override + 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() { + @Override + 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 qBlue1 = new ColorFiller(65, 19); + qBlue1.setBackground(new Color(bgR, bgG, bgB)); + r.add("West", this.quitButton); + r.add("East", qBlue1); + 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 bgbRx = new Panel(new BorderLayout()); + bgbRx.add("East", this.exploreButton); + bgbRx.add("West", r); + this.mapPanel.add("North", bgbRx); + 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); + p = new InsetPanel(new BorderLayout(), 3, 3, 0, 0); + p.add("Center", this.renderAndUniverse); + int bgbRxx = IniFile.override().getIniInt("uiBackground3Red", 0); + int bgbGx = IniFile.override().getIniInt("uiBackground3Green", 0); + int bgbBx = IniFile.override().getIniInt("uiBackground3Blue", 0); + qBlue1 = new ColorFiller(97, 1); + qBlue1.setBackground(new Color(bgbRxx, bgbGx, bgbBx)); + Panel rt = new Panel(new QuantizedStackedLayout(qBlue1)); + String panelGif = IniFile.override().getIniString("rtPanel", Console.message("rtpanel.gif")); + this.addPart(this.menuButtons = new ImageButtons(panelGif, 97, menuButtonHeights, this)); + rt.add(qBlue1); + 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(); + } + + @Override + 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(), null, Console.message("Alert"), 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(), null, Console.message("Alert"), 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(), null, Console.message("Alert"), null, Console.message("OK"), Console.message("Change-exit"), true); + } + + public AvMenu getAvatarMenu() { + return this.avatarMenu; + } + + @Override + 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() { + @Override + 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() { + @Override + 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() { + @Override + 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 = CodeL.elementAt(i); + String c1 = CodeS.elementAt(i); + words[i] = words[j]; + Locales[i] = Locales[j]; + CodeL.setElementAt(CodeL.elementAt(j), i); + CodeS.setElementAt(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; + } + } + } + } + + @Override + 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++) { + DefaultConsole.CameraView currView = 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++) { + DefaultConsole.CameraSpeed currSpeed = this.speedNames.elementAt(i); + CheckboxMenuItem itemx = new CheckboxMenuItem(" " + Console.message(currSpeed.speedName), currSpeed.speedID == cameraSpeed); + if (currSpeed.speedID == cameraSpeed) { + this.currentCamSpeedItem = itemx; + } + + itemx.setFont(mfont); + viewMenu.add(itemx); + this.camSpeedItems.addElement(itemx); + } + + 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()); + if (IniFile.gamma().getIniInt("recorderEnabled", 1) == 1) { + Menu recorderMenu = new Menu(Console.message("Recorder")); + this.addMenuItem(recorderMenu, "Options"); + this.recorderRecItem = new MenuItem(Console.message("Record")); + recorderMenu.add(this.recorderRecItem); + this.recorderStopItem = new MenuItem(Console.message("Stop")); + recorderMenu.add(this.recorderStopItem); + this.recorderPlayItem = new MenuItem(Console.message("Play")); + recorderMenu.add(this.recorderPlayItem); + } + + if (NetUpdate.isInternalVersion()) { + Menu 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) { + if (this.fsList.elementAt(i) != null) { + this.newfLocale[i] = new Locale(this.flList.elementAt(i), this.fsList.elementAt(i)); + String code = this.flList.elementAt(i) + "_" + 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 { + String code = this.flList.elementAt(i); + if (code.equals(Console.message(code))) { + this.dFonts[i] = new MenuItem(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]; + + for (int ix = 0; ix < this.dLength; ix++) { + if (this.lList.elementAt(ix) != null) { + this.newdLocale[ix] = new Locale(this.lList.elementAt(ix), this.sList.elementAt(ix)); + String lName0; + if (ix > 0) { + Locale locale0 = new Locale(this.lList.elementAt(ix - 1), this.sList.elementAt(ix - 1)); + lName0 = locale0.getDisplayName(); + } else { + lName0 = this.newdLocale[ix].getDisplayName(); + } + + String lName1 = this.newdLocale[ix].getDisplayName(); + lName1 = lName1.substring(0, lName1.indexOf(40) - 1); + String lName; + if (ix < this.dLength - 1) { + Locale locale2 = new Locale(this.lList.elementAt(ix + 1), this.sList.elementAt(ix + 1)); + String lName2 = locale2.getDisplayName(); + lName2 = lName2.substring(0, lName2.indexOf(40) - 1); + if (lName2.equals(lName1)) { + lName = this.newdLocale[ix].getDisplayName(); + } else { + lName = lName1; + } + } else if (ix == this.dLength - 1) { + lName0 = lName0.substring(0, lName0.indexOf(40) - 1); + if (lName1.equals(lName0)) { + lName = this.newdLocale[ix].getDisplayName(); + } else { + lName = lName1; + } + } else if (sLangs[ix - 1].equals(lName1)) { + lName = this.newdLocale[ix].getDisplayName(); + } else { + lName = lName1; + } + + String code = this.lList.elementAt(ix) + "_" + this.sList.elementAt(ix); + if (code.equals(Console.message(code))) { + sLangs[ix] = lName; + } else { + sLangs[ix] = Console.message(code); + } + } + } + + Collator sortCollator = Collator.getInstance(); + sortStrings(sortCollator, sLangs, this.newdLocale, this.lList, this.sList); + + for (int ixx = 0; ixx < this.dLength; ixx++) { + this.dLangs[ixx] = new MenuItem(sLangs[ixx]); + this.dLangs[ixx].setFont(mfont); + downloadLanguage.add(this.dLangs[ixx]); + this.downItems.addElement(this.dLangs[ixx]); + } + + Menu switchLang = new Menu(Console.message("Switch-Language")); + languageMenu.add(switchLang); + switchLang.setFont(mfont); + this.langItems = new Vector(); + + for (int ixx = 0; ixx < lLength; ixx++) { + int imb = lNames[ixx].indexOf(95); + if (imb < 0) { + lCodes[ixx][0] = "en"; + lCodes[ixx][1] = "US"; + } else { + int ipr = lNames[ixx].lastIndexOf(46); + if (ipr < 0) { + ipr = 0; + } + + lCodes[ixx][0] = lNames[ixx].substring(imb + 1, imb + 3); + if (ipr > imb + 4) { + lCodes[ixx][1] = lNames[ixx].substring(imb + 4, ipr); + } else { + lCodes[ixx][1] = lCodes[ixx][0].toUpperCase(); + } + } + } + + String[] slLangs = new String[lLength]; + + for (int ixxx = 0; ixxx < lLength; ixxx++) { + newLocale[ixxx] = new Locale(lCodes[ixxx][0], lCodes[ixxx][1]); + String lName0x; + if (ixxx > 0) { + Locale locale0 = new Locale(lCodes[ixxx - 1][0], lCodes[ixxx - 1][1]); + lName0x = locale0.getDisplayName(); + } else { + lName0x = newLocale[ixxx].getDisplayName(); + } + + String lName1x = newLocale[ixxx].getDisplayName(); + lName1x = lName1x.substring(0, lName1x.indexOf(40) - 1); + String lNamex; + if (ixxx < lLength - 1) { + Locale locale2 = new Locale(lCodes[ixxx + 1][0], lCodes[ixxx + 1][1]); + String lName2 = locale2.getDisplayName(); + lName2 = lName2.substring(0, lName2.indexOf(40) - 1); + if (lName2.equals(lName1x)) { + lNamex = newLocale[ixxx].getDisplayName(); + } else { + lNamex = lName1x; + } + } else if (ixxx == lLength - 1) { + lName0x = lName0x.substring(0, lName0x.indexOf(40) - 1); + if (lName1x.equals(lName0x)) { + lNamex = newLocale[ixxx].getDisplayName(); + } else { + lNamex = lName1x; + } + } else if (slLangs[ixxx - 1].equals(lName1x)) { + lNamex = newLocale[ixxx].getDisplayName(); + } else { + lNamex = lName1x; + } + + String code = lCodes[ixxx][0] + "_" + lCodes[ixxx][1]; + if (code.equals(Console.message(code))) { + slLangs[ixxx] = lNamex; + } else { + slLangs[ixxx] = Console.message(code); + } + } + + sortStrings(sortCollator, slLangs, newLocale, lCodes); + + for (int ixxx = 0; ixxx < lLength; ixxx++) { + lLangs[ixxx] = new MenuItem(slLangs[ixxx]); + lLangs[ixxx].setFont(mfont); + switchLang.add(lLangs[ixxx]); + this.langItems.addElement(lLangs[ixxx]); + } + + 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; + } + + @Override + public void setVIP(boolean f) { + super.setVIP(f); + this.setMenusWRTVIP(); + this.setNameStr(); + } + + @Override + 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)); + } + } + } + + @Override + public void enableBroadcast(boolean enabled) { + super.enableBroadcast(enabled); + if (enabled) { + this.addBroadcastMenu(); + } + } + + @Override + public void deactivate() { + super.deactivate(); + this.universeMode = false; + } + + @Override + 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 + ); + } + } + + @Override + 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 if (event.target == this.shaperHelpItem) { + String helpURL = IniFile.override().getIniString("ShaperHelp", this.getScriptServer() + "shaperhelp.pl") + "?u="; + String lastName = IniFile.gamma().getIniString("lastchatname", ""); + if (!lastName.equals("")) { + if (lastName.startsWith("VIP ")) { + lastName = lastName.substring(4); + } + + helpURL = helpURL + lastName; + } + + new SendURLAction(WebControlImp.processURL(helpURL)).startBrowser(); + } else if (event.target == this.helpItem) { + String serv = NetUpdate.getUpgradeServerURL(); + String directory = IniFile.override().getIniString("HelpDirectory", "help"); + String helpPage = IniFile.override().getIniString("HelpPage", Std.getVersion() + Console.message(".html")); + if (wasHttpNoSuchFile(serv + directory + "/" + helpPage)) { + helpPage = IniFile.override().getIniString("HelpPage", Std.getVersion() + ".html"); + } + + new SendURLAction(serv + directory + "/" + helpPage).startBrowser(); + } else if (event.target == this.infoItem) { + String infoOverride = IniFile.override().getIniString("infoOverride", ""); + if (infoOverride.equals("")) { + NetUpdate.showInfo(); + } else { + new SendURLAction(infoOverride).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) { + String accountOverride = IniFile.override().getIniString("accountOverride", ""); + if (accountOverride.equals("")) { + String accountScript = IniFile.override().getIniString("accountInfoPage", "account" + Console.message(".pl")); + if (wasHttpNoSuchFile(this.getScriptServer() + accountScript)) { + accountScript = IniFile.override().getIniString("accountInfoPage", "account.pl"); + } + + new SendURLAction(this.getScriptServer() + accountScript, true).startBrowser(); + } else { + new SendURLAction(accountOverride).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(); + String channel = ""; + + assert g != null; + + if (g != null) { + channel = g.getChannel(); + } + + new ChannelDialog(getFrame(), this, Console.message("Dimension-Sel"), channel); + } else if (event.target == this.becomeVIPItem) { + String completeOverride = IniFile.override().getIniString("vipOverride", ""); + if (completeOverride.equals("")) { + String vipScript = IniFile.override().getIniString("vipPage", "vip" + Console.message(".pl")); + if (wasHttpNoSuchFile(this.getScriptServer() + vipScript)) { + vipScript = IniFile.override().getIniString("vipPage", "vip.pl"); + } + + new SendURLAction(this.getScriptServer() + vipScript, true).startBrowser(); + } else { + new SendURLAction(completeOverride, false).startBrowser(); + } + + this.relogin(); + } else if (event.target == this.numVisItem) { + new SetNumVisibleAvs(); + } else if (event.target == this.inventoryItem) { + EquipAction eAction = new EquipAction(); + eAction.trigger(null, 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) { + String ubuDest = IniFile.gamma().getIniString("UbuDestURL", this.getScriptServer() + "ubu.pl"); + new SendURLAction(ubuDest, 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(), null, Console.message("No-Volume"), 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) { + String code = Locale.getDefault().toString(); + if (code == Console.message(code)) { + Console.println(Console.message("Current-Language") + " = " + Locale.getDefault().getDisplayName()); + } else { + Console.println(Console.message("Current-Language") + " = " + Console.message(code)); + } + } 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 if (this.fontItems != null && this.fontItems.contains(event.target)) { + String languageURL = IniFile.gamma().getIniString("upgradeServer", "") + "/I18N/font_"; + + for (int i = 0; i < this.fLength; i++) { + if (event.target == this.fontItems.elementAt(i)) { + if (this.fsList.elementAt(i) != null) { + languageURL = languageURL + this.flList.elementAt(i) + "_" + this.fsList.elementAt(i) + ".EXE"; + } else { + languageURL = languageURL + this.flList.elementAt(i) + ".EXE"; + } + + int sz = this.fSizes[i]; + String 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)) { + String languageURL = IniFile.gamma().getIniString("upgradeServer", "") + "/I18N/language_"; + + for (int ix = 0; ix < this.dLength; ix++) { + if (event.target == this.downItems.elementAt(ix)) { + if (this.sList.elementAt(ix) != null) { + languageURL = languageURL + this.lList.elementAt(ix) + "_" + this.sList.elementAt(ix) + ".zip"; + IniFile.gamma().setIniString("DEFAULTLANGUAGE", this.lList.elementAt(ix) + "_" + this.sList.elementAt(ix)); + } else { + languageURL = languageURL + this.lList.elementAt(ix) + ".zip"; + IniFile.gamma().setIniString("DEFAULTLANGUAGE", this.lList.elementAt(ix)); + } + + int sz = this.lSizes[ix]; + String 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 ixx = 0; ixx < lLength; ixx++) { + if (event.target == this.langItems.elementAt(ixx)) { + Locale.setDefault(newLocale[ixx]); + String code = newLocale[ixx].toString(); + if (code == Console.message(code)) { + Console.println(message("Setting-to") + " " + newLocale[ixx].getDisplayName()); + } else { + Console.println(message("Setting-to") + " " + Console.message(code)); + } + + IniFile.gamma().setIniString("DEFAULTLANGUAGE", lCodes[ixx][0] + "_" + lCodes[ixx][1]); + new OkCancelDialog(getFrame(), null, Console.message("Alert"), 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) { + CheckboxMenuItem item; + if ((this.savedAvs == null || (item = this.savedAvs.findMenuItem(url)) == null) + && (this.avatarMenu == null || (item = this.avatarMenu.findMenuItem(url)) == null)) { + this.setCurrentAvatarItem(null); + } else { + this.setCurrentAvatarItem(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(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; + } + + @Override + public Object imageButtonsCallback(Component who, int which) { + if (who != this.driveButton) { + if (who == this.quitButton) { + maybeQuit(); + } else if (who == this.adCubeButton) { + String adURL = IniFile.gamma().getIniString("AdCubeURL", "http://www.worlds.com/"); + new SendURLAction(adURL, 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: + String 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; + } + + @Override + 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 = this.viewNames.elementAt(this.chooseView).viewID; + } + + if (this.chooseCamSpeed != -1) { + 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(), null, Console.message("Too-Little-RAM"), null, Console.message("OK"), result, true); + } + + startupMemCheck = false; + System.out.println("System has " + m._totPhysMem + " bytes of physical RAM"); + } + + this.lastVMCheck = now; + } + } + + @Override + public URL getAvatarName() { + return this.avatarURL; + } + + @Override + public void setServerURL(URL serverURL) { + super.setServerURL(serverURL); + } + + @Override + public void dialogDone(Object who, boolean confirmed) { + if (who instanceof QuitDialog) { + if (confirmed) { + Console.quit(); + } + } else if (who instanceof BootDialog) { + if (confirmed) { + BootDialog bd = (BootDialog)who; + String bname = bd.getBoot(); + if (!bname.equals("")) { + Pilot.sendText("world", "!boot " + bname); + } + } + } else if (who instanceof ChannelDialog) { + if (confirmed) { + ChannelDialog cd = (ChannelDialog)who; + String newChannel = cd.getChannel(); + Pilot pilot = Pilot.getActive(); + String oldPos = pilot != null ? pilot.getURL() : null; + if (oldPos != null) { + int channelIndex = oldPos.indexOf("<"); + int channelEndIndex = oldPos.indexOf(">"); + if (channelIndex >= 0 && channelEndIndex > channelIndex) { + TeleportAction.teleport(oldPos.substring(0, channelIndex + 1) + newChannel + oldPos.substring(channelEndIndex), 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; + } + + int oldFontSize = IniFile.gamma().getIniInt("ChatFontSize", 12); + int 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) { + } + } + + 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; + } + } + + @Override + 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 = items.elementAt(i); + if (item.getLabel().equals(name)) { + return item; + } + } + } + + return null; + } + + @Override + protected void loadPilot(URL url) { + super.loadPilot(url); + this.findAvatarMenuItem(url); + } + + @Override + 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")); + } + } + + @Override + 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(); + } + } + } + + @Override + public void galaxyDisconnected() { + super.galaxyDisconnected(); + this.getFriends().maybeServerDisconnect(); + } + + @Override + public boolean okToQuit() { + int quitDlg = IniFile.override().getIniInt("QuitDialog", 1); + + try { + if (quitDlg == 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)(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); + } + + @Override + 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, 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; + } + + @Override + public void saveState(Saver s) throws IOException { + s.saveVersion(0, classCookie); + super.saveState(s); + } + + @Override + 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; + } + } +} diff --git a/NET/worlds/console/DialogDisabled.java b/NET/worlds/console/DialogDisabled.java new file mode 100644 index 0000000..830043a --- /dev/null +++ b/NET/worlds/console/DialogDisabled.java @@ -0,0 +1,5 @@ +package NET.worlds.console; + +public interface DialogDisabled { + void dialogDisable(boolean var1); +} diff --git a/NET/worlds/console/DialogReceiver.java b/NET/worlds/console/DialogReceiver.java new file mode 100644 index 0000000..1412344 --- /dev/null +++ b/NET/worlds/console/DialogReceiver.java @@ -0,0 +1,5 @@ +package NET.worlds.console; + +public interface DialogReceiver { + void dialogDone(Object var1, boolean var2); +} diff --git a/NET/worlds/console/DuplexPart.java b/NET/worlds/console/DuplexPart.java new file mode 100644 index 0000000..abeb4be --- /dev/null +++ b/NET/worlds/console/DuplexPart.java @@ -0,0 +1,160 @@ +package NET.worlds.console; + +import NET.worlds.core.IniFile; +import NET.worlds.scape.FrameEvent; +import java.awt.Color; +import java.awt.Container; +import java.awt.Event; +import java.awt.TextField; +import java.util.Observer; +import java.util.Vector; + +public abstract class DuplexPart implements FramePart { + private boolean classicTextArea; + public TextField line = new FocusPreservingTextField(); + public SharedTextArea listen; + private Vector talkVec = new Vector(); + + public DuplexPart() { + this(true); + } + + public DuplexPart(boolean isShared) { + this(isShared, 3); + } + + public DuplexPart(boolean isShared, int height) { + this.classicTextArea = IniFile.gamma().getIniInt("classicChatBox", 1) == 1; + if (this.classicTextArea) { + this.listen = new ClassicSharedTextArea(height, 30, isShared); + this.listen.setBackground(Color.white); + } else { + this.listen = new NewSharedTextArea(height, 30, isShared); + this.listen.setBackground(GammaTextArea.getBackgroundColor()); + } + + this.listen.setForeground(Color.black); + } + + public void forceTakeFocus() { + ((FocusPreservingTextField)this.line).takeNextFocus(); + } + + @Override + public synchronized void activate(Console c, Container f, Console prev) { + if (this instanceof ChatPart) { + ((FocusPreservingTextField)this.line).isChatLine(); + } + + if (!this.classicTextArea) { + Color bg = GammaTextArea.getBackgroundColor(); + this.line.setBackground(bg); + this.listen.setBackground(bg); + this.line.setForeground(Color.black); + this.listen.setForeground(Color.black); + this.line.repaint(); + this.listen.repaint(); + } else { + this.listen.setBackground(Color.white); + this.listen.setForeground(Color.black); + } + } + + @Override + public void deactivate() { + } + + public void println(String msg) { + this.listen.println(msg); + } + + public synchronized void trigger() { + this.talkVec.addElement(this.line.getText()); + this.line.setText(""); + } + + public synchronized void say(String s) { + this.talkVec.addElement(s); + } + + public void scrollToBottom() { + this.listen.scrollToBottom(); + } + + @Override + public boolean action(Event event, Object what) { + if (event.target == this.line) { + this.trigger(); + return true; + } else { + return false; + } + } + + public void enableLogging(String fileName, String title, boolean append) { + this.listen.enableLogging(fileName, title, append); + } + + public void disableLogging() { + this.listen.disableLogging(); + } + + public static void addLogObserver(Observer o) { + NewSharedTextArea.addLogObserver(o); + ClassicSharedTextArea.addLogObserver(o); + } + + public static void deleteLogObserver(Observer o) { + NewSharedTextArea.deleteLogObserver(o); + ClassicSharedTextArea.addLogObserver(o); + } + + @Override + public synchronized boolean handle(FrameEvent f) { + this.listen.poll(); + + while (this.talkVec.size() > 0) { + String text = null; + synchronized (this) { + text = this.talkVec.firstElement(); + this.talkVec.removeElementAt(0); + } + + if (text != null) { + this.sendText(text); + } + } + + return true; + } + + public static String toHtml(String s) { + assert s != null; + + String h = ""; + + for (int i = 0; i < s.length(); i++) { + char c = s.charAt(i); + switch (c) { + case '"': + h = h + """; + break; + case '&': + h = h + "&"; + break; + case '<': + h = h + "<"; + break; + case '>': + h = h + ">"; + break; + default: + h = h + c; + } + } + + return h; + } + + protected abstract void sendText(String var1); +} diff --git a/NET/worlds/console/EMailPart.java b/NET/worlds/console/EMailPart.java new file mode 100644 index 0000000..3df639a --- /dev/null +++ b/NET/worlds/console/EMailPart.java @@ -0,0 +1,11 @@ +package NET.worlds.console; + +public class EMailPart { + public static void showMessage(Console console) { + new MailDialog(console); + } + + public static void showMessage(Console console, String recipient) { + new MailDialog(console, recipient); + } +} diff --git a/NET/worlds/console/EditNamesDialog.java b/NET/worlds/console/EditNamesDialog.java new file mode 100644 index 0000000..6134ae5 --- /dev/null +++ b/NET/worlds/console/EditNamesDialog.java @@ -0,0 +1,143 @@ +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.List; + +class EditNamesDialog extends PolledDialog implements DialogReceiver { + private static final long serialVersionUID = -3309806087387084117L; + private List listbox = new List(10); + private Button addButton = new Button(Console.message("Add")); + private Button delButton = new Button(Console.message("Delete")); + private Button cancelButton = new Button(Console.message("Done")); + private NameListOwner owner; + private String addTitle; + private static Font font = new Font(Console.message("ButtonFont"), 0, 12); + + EditNamesDialog(NameListOwner owner, String title, String addTitle) { + super(Console.getFrame(), null, title, true); + this.owner = owner; + this.addTitle = addTitle; + this.ready(); + } + + @Override + protected void build() { + int count = this.owner.getNameListCount(); + + for (int i = 0; i < count; i++) { + this.listbox.add(this.owner.getNameListName(i)); + } + + GridBagLayout gbag = new GridBagLayout(); + this.setLayout(gbag); + GridBagConstraints c = new GridBagConstraints(); + c.fill = 1; + c.weightx = 1.0; + c.weighty = 1.0; + c.gridwidth = 2; + c.gridheight = 3; + this.add(gbag, this.listbox, c); + c.weightx = 0.0; + c.weighty = 0.0; + c.gridwidth = 0; + c.gridheight = 1; + c.fill = 2; + this.addButton.setFont(font); + this.delButton.setFont(font); + this.cancelButton.setFont(font); + this.add(gbag, this.addButton, c); + this.add(gbag, this.delButton, c); + c.weighty = 1.0; + c.anchor = 15; + this.add(gbag, this.cancelButton, c); + } + + private void select(boolean state) { + this.delButton.setEnabled(state); + } + + @Override + public void show() { + super.show(); + if (this.listbox.getItemCount() != 0) { + this.listbox.select(0); + this.select(true); + } else { + this.select(false); + } + + this.listbox.requestFocus(); + } + + @Override + public boolean handleEvent(Event event) { + if (event.id == 701) { + this.select(true); + } else if (event.id == 702) { + this.select(false); + } + + return super.handleEvent(event); + } + + @Override + public boolean action(Event event, Object what) { + Object target = event.target; + if (target == this.cancelButton) { + return this.done(false); + } else if (target == this.delButton) { + int index = this.listbox.getSelectedIndex(); + if (index != -1) { + this.listbox.remove(index); + this.owner.removeNameListName(index); + int count = this.listbox.getItemCount(); + if (index < count - 1) { + this.listbox.select(index); + } else if (count > 0) { + this.listbox.select(count - 1); + } else { + this.select(false); + this.listbox.requestFocus(); + } + } + + return true; + } else if (target == this.addButton) { + if (this.owner.mayAddNameListName(this)) { + new AddNameDialog(this, this.addTitle); + } + + return true; + } else { + return false; + } + } + + @Override + public boolean keyDown(Event event, int key) { + return key != 27 && key != 10 ? super.keyDown(event, key) : this.done(false); + } + + @Override + public void dialogDone(Object who, boolean confirmed) { + if (confirmed) { + String name = Console.parseUnicode(((AddNameDialog)who).getName()); + int pos = this.owner.addNameListName(name); + if (pos == -1) { + return; + } + + if (pos == this.listbox.getItemCount()) { + this.listbox.add(name); + } + + this.listbox.makeVisible(pos); + this.listbox.select(pos); + this.select(true); + } + } +} diff --git a/NET/worlds/console/EmoteHandler.java b/NET/worlds/console/EmoteHandler.java new file mode 100644 index 0000000..96d3ec5 --- /dev/null +++ b/NET/worlds/console/EmoteHandler.java @@ -0,0 +1,78 @@ +package NET.worlds.console; + +import NET.worlds.network.Cache; +import NET.worlds.network.CacheFile; +import NET.worlds.network.NetUpdate; +import NET.worlds.network.URL; +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.util.Hashtable; + +public class EmoteHandler { + private Hashtable emoteHash = new Hashtable(); + + public EmoteHandler() { + this.Load("EmoteList.txt"); + } + + public EmoteHandler(String filename) { + this.Load(filename); + } + + public void Load(String filename) { + File file = null; + + try { + CacheFile cf = Cache.getFile(URL.make(NetUpdate.getUpgradeServerURL() + filename)); + if (cf != null) { + file = new File(cf.getLocalName()); + cf.waitUntilLoaded(); + } + + if (file != null) { + this.LoadFile(file); + } + } catch (Exception var4) { + } + + file = new File(filename); + if (file != null) { + this.LoadFile(file); + } + } + + private void LoadFile(File file) { + if (file != null && file.exists()) { + try { + BufferedReader reader = new BufferedReader(new FileReader(file)); + String line = ""; + + while ((line = reader.readLine()) != null) { + String[] words = line.split("[ \t]"); + + for (int i = 1; i < words.length; i++) { + this.put(words[i].toLowerCase(), words[0]); + } + } + + reader.close(); + } catch (Exception var6) { + var6.printStackTrace(); + } + } + } + + public void put(String emote, String imagename) { + this.emoteHash.put(emote, imagename); + } + + public String get(String emote) { + return this.emoteHash.get(emote); + } + + public ImageCanvas getImage(String emote) { + String imagename = this.get(emote); + return imagename != null && imagename.length() > 0 ? new ImageCanvas(imagename) : null; + } +} diff --git a/NET/worlds/console/Escalator.java b/NET/worlds/console/Escalator.java new file mode 100644 index 0000000..880ca65 --- /dev/null +++ b/NET/worlds/console/Escalator.java @@ -0,0 +1,67 @@ +package NET.worlds.console; + +import NET.worlds.scape.Material; +import NET.worlds.scape.Point3; +import NET.worlds.scape.Point3Temp; +import NET.worlds.scape.Portal; +import NET.worlds.scape.Rect; +import NET.worlds.scape.Room; +import NET.worlds.scape.RoomEnvironment; +import NET.worlds.scape.World; + +public class Escalator { + public Portal bottom; + public Portal top; + private Room antelower; + private Stair stairs; + private Room anteupper; + + public Escalator( + World world, + String name, + float width, + float length, + float ascent, + float height, + float antelen, + int numsteps, + Material riser, + Material tread, + Material floor, + Material left, + Material right, + Material head, + Material ceiling, + float traveltime + ) { + this.stairs = new Stair(world, name, width, length, ascent, ascent + height, numsteps, riser, tread, left, right, head, ceiling); + this.antelower = new Room(world, "antelower." + name); + RoomEnvironment lenv = this.antelower.getEnvironment(); + lenv.add(new Rect(0.0F, 0.0F, 0.0F, 0.0F, antelen, height, left)); + lenv.add(new Rect(width, antelen, 0.0F, width, 0.0F, height, right)); + Portal bp = new Portal(0.0F, antelen, 0.0F, width, antelen, height).biconnect(this.stairs.bottom); + lenv.add(bp); + this.bottom = new Portal(width, 0.0F, 0.0F, 0.0F, 0.0F, height); + lenv.add(this.bottom); + lenv.add(Rect.floor(0.0F, 0.0F, 0.0F, width, antelen, floor)); + lenv.add(Rect.ceiling(0.0F, 0.0F, height, width, antelen, ceiling)); + this.anteupper = new Room(world, "anteupper." + name); + RoomEnvironment uenv = this.anteupper.getEnvironment(); + uenv.add(new Rect(0.0F, 0.0F, 0.0F, 0.0F, antelen, height, left)); + uenv.add(new Rect(width, antelen, 0.0F, width, 0.0F, height, right)); + Portal tp = new Portal(0.0F, antelen, 0.0F, width, antelen, height).biconnect(this.stairs.top); + uenv.add(tp); + this.top = new Portal(width, 0.0F, 0.0F, 0.0F, 0.0F, height); + uenv.add(this.top); + uenv.add(Rect.floor(0.0F, 0.0F, 0.0F, width, antelen, floor)); + uenv.add(Rect.ceiling(0.0F, 0.0F, height, width, antelen, ceiling)); + CameraConveyor convup = new CameraConveyor(Point3Temp.make(0.0F, length / traveltime, 0.0F)); + CameraConveyor convdn = new CameraConveyor(new Point3(0.0F, -length / traveltime, 0.0F)); + bp.addHandler(new AddHandler(convup)); + tp.addHandler(new AddHandler(convdn)); + this.stairs.bottom.addHandler(new RemoveHandler(convup)); + this.stairs.bottom.addHandler(new RemoveHandler(convdn)); + this.stairs.top.addHandler(new RemoveHandler(convup)); + this.stairs.top.addHandler(new RemoveHandler(convdn)); + } +} diff --git a/NET/worlds/console/ExpireDialog.java b/NET/worlds/console/ExpireDialog.java new file mode 100644 index 0000000..7b1f80f --- /dev/null +++ b/NET/worlds/console/ExpireDialog.java @@ -0,0 +1,48 @@ +package NET.worlds.console; + +import java.awt.BorderLayout; +import java.awt.Button; +import java.awt.Dialog; +import java.awt.Event; +import java.awt.FlowLayout; +import java.awt.Font; +import java.awt.Panel; +import java.text.DateFormat; +import java.util.Date; + +class ExpireDialog extends Dialog { + private static final long serialVersionUID = -1622362025617429254L; + protected Button button; + private static Font font = new Font(Console.message("ButtonFont"), 0, 12); + + public ExpireDialog(Date expireDate) { + super(null, GammaFrame.getDefaultTitle(), false); + this.setLayout(new BorderLayout(15, 15)); + this.add("Center", new MultiLineLabel(Console.message("beta-expired") + DateFormat.getDateTimeInstance().format(expireDate), 20, 20)); + this.button = new Button(Console.message("OK")); + this.button.setFont(font); + Panel p = new Panel(); + p.setLayout(new FlowLayout(1, 15, 15)); + p.add(this.button); + this.add("South", p); + this.pack(); + } + + @Override + public boolean action(Event e, Object arg) { + if (e.target == this.button) { + this.hide(); + this.dispose(); + Main.end(); + return true; + } else { + return false; + } + } + + @Override + public boolean gotFocus(Event e, Object arg) { + this.button.requestFocus(); + return true; + } +} diff --git a/NET/worlds/console/ExposedPanel.java b/NET/worlds/console/ExposedPanel.java new file mode 100644 index 0000000..15f1f99 --- /dev/null +++ b/NET/worlds/console/ExposedPanel.java @@ -0,0 +1,19 @@ +package NET.worlds.console; + +import java.awt.Color; +import java.awt.Graphics; +import java.awt.Panel; + +public class ExposedPanel extends Panel { + private static final long serialVersionUID = 6772016496031107748L; + + public ExposedPanel() { + this.setBackground(Color.white); + } + + @Override + public void paint(Graphics g) { + g.setColor(this.getBackground()); + g.fillRect(0, 0, this.getSize().width, this.getSize().height); + } +} diff --git a/NET/worlds/console/FileSaver.java b/NET/worlds/console/FileSaver.java new file mode 100644 index 0000000..dce997d --- /dev/null +++ b/NET/worlds/console/FileSaver.java @@ -0,0 +1,77 @@ +package NET.worlds.console; + +import NET.worlds.scape.World; +import java.text.MessageFormat; +import java.util.Enumeration; +import java.util.Vector; + +class FileSaver implements DialogReceiver { + private Vector saveList = new Vector(); + private int state; + public static final int QUIT = 0; + public static final int SAVING = 1; + public static final int CANCEL = 2; + + FileSaver() { + Enumeration e = World.getWorlds(); + + while (e.hasMoreElements()) { + World w = e.nextElement(); + if (w.getEdited()) { + this.saveList.addElement(w); + } + } + + this.saveNext(false); + } + + public int getState() { + return this.state; + } + + private World getWorld() { + return this.saveList.elementAt(0); + } + + private void saveNext(boolean removeFirst) { + if (removeFirst) { + this.saveList.removeElementAt(0); + } + + if (this.saveList.size() != 0) { + this.state = 1; + Object[] arguments = new Object[]{new String(this.getWorld().getName())}; + new YesNoCancelDialog(Console.getFrame(), this, Console.message("Save-Changes2"), MessageFormat.format(Console.message("has-changed"), arguments)); + } else { + this.state = 0; + } + } + + @Override + public void dialogDone(Object who, boolean confirmed) { + if (who instanceof YesNoCancelDialog) { + switch (((YesNoCancelDialog)who).getChoice()) { + case -1: + this.state = 2; + break; + case 0: + this.saveNext(true); + break; + case 1: + new FileSysDialog( + Console.getFrame(), this, Console.message("Save-World"), 1, "World Save Files|*.world", Shaper.getSaveName(this.getWorld()), true + ); + } + } else { + if (confirmed) { + FileSysDialog fileDialog = (FileSysDialog)who; + if (Shaper.doSave(fileDialog.fileName(), this.getWorld(), false)) { + this.saveNext(true); + return; + } + } + + this.state = 2; + } + } +} diff --git a/NET/worlds/console/FileSysDialog.java b/NET/worlds/console/FileSysDialog.java new file mode 100644 index 0000000..699f1ec --- /dev/null +++ b/NET/worlds/console/FileSysDialog.java @@ -0,0 +1,179 @@ +package NET.worlds.console; + +import java.awt.Frame; +import java.io.File; +import javax.swing.JFileChooser; +import javax.swing.SwingUtilities; +import javax.swing.UIManager; +import javax.swing.UnsupportedLookAndFeelException; +import javax.swing.filechooser.FileNameExtensionFilter; + +public class FileSysDialog implements Runnable { + public static final int OPEN = 0; + public static final int SAVE = 1; + private String title; + private String typesAndExts; + private String fileName; + private static File lastFile; + private int mode; + private DialogReceiver receiver; + private boolean parentDisabled = false; + private Frame parent; + JFileChooser fc = null; + private static String OpenFileText = "Open File"; + private static String SaveFileText = "Save File"; + private boolean disableParent; + + public FileSysDialog(Frame parent, DialogReceiver receiver, String title, int mode, String typesAndExts, String fileName, boolean disableParent) { + this.receiver = receiver; + this.title = title; + this.typesAndExts = typesAndExts; + this.mode = mode; + this.fileName = fileName; + this.parent = parent; + this.disableParent = disableParent; + SwingUtilities.invokeLater(this); + } + + @Override + public void run() { + if (this.disableParent && this.parent.isEnabled()) { + this.parent.setEnabled(false); + this.parentDisabled = true; + } + + try { + UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); + } catch (ClassNotFoundException var3) { + var3.printStackTrace(); + return; + } catch (InstantiationException var4) { + var4.printStackTrace(); + return; + } catch (IllegalAccessException var5) { + var5.printStackTrace(); + return; + } catch (UnsupportedLookAndFeelException var6) { + var6.printStackTrace(); + return; + } + + File file = null; + + try { + if (this.fileName != null && this.fileName != "") { + file = new File(this.fileName); + if (file != null && file.getParent() != null) { + this.fc = new JFileChooser(file.getParent()); + } + } + + if (this.fc == null && lastFile != null && lastFile.getParent() != null) { + this.fc = new JFileChooser(lastFile.getParent()); + } + + if (this.fc == null) { + this.fc = new JFileChooser("."); + } + } catch (Exception var7) { + var7.printStackTrace(); + return; + } + + this.fc.setFileSelectionMode(0); + this.fc.setDialogType(this.mode == 0 ? 0 : 1); + if (this.title != null) { + this.fc.setDialogTitle(this.title); + } + + if (this.typesAndExts != null) { + buildFileChooser(this.fc, this.typesAndExts); + } + + if (file != null) { + this.fc.setSelectedFile(file); + } + + int retval = this.fc.showDialog(null, this.mode == 0 ? OpenFileText : SaveFileText); + if (retval == 0) { + this.approveSelection(); + } else { + this.cancelSelection(); + } + + if (this.disableParent && this.parentDisabled) { + this.parent.setEnabled(true); + this.parentDisabled = false; + } + } + + private static void buildFileChooser(JFileChooser fc2, String specString) { + String[] entries = specString.split("\\|"); + boolean even = false; + String desc = ""; + FileNameExtensionFilter first = null; + + for (String entry : entries) { + if (!even) { + desc = entry; + even = true; + } else { + String[] fields = entry.split(";"); + + for (int i = 0; i < fields.length; i++) { + String[] ext = fields[i].split("\\."); + if (ext.length > 0) { + fields[i] = ext[ext.length - 1]; + } + } + + FileNameExtensionFilter ff = null; + switch (fields.length) { + case 1: + ff = new FileNameExtensionFilter(desc, fields[0]); + break; + case 2: + ff = new FileNameExtensionFilter(desc, fields[0], fields[1]); + break; + case 3: + ff = new FileNameExtensionFilter(desc, fields[0], fields[1], fields[2]); + break; + case 4: + ff = new FileNameExtensionFilter(desc, fields[0], fields[1], fields[2], fields[3]); + } + + if (ff != null) { + fc2.addChoosableFileFilter(ff); + if (first == null) { + first = ff; + } + } + + even = false; + } + } + + if (first != null) { + fc2.setFileFilter(first); + } + } + + public int getMode() { + return this.mode; + } + + public void approveSelection() { + File file = this.fc.getSelectedFile(); + lastFile = file; + this.fileName = file.getAbsolutePath(); + this.receiver.dialogDone(this, this.fileName != null); + } + + public void cancelSelection() { + this.receiver.dialogDone(this, false); + } + + public String fileName() { + return this.fileName; + } +} diff --git a/NET/worlds/console/Filler.java b/NET/worlds/console/Filler.java new file mode 100644 index 0000000..6aa4d89 --- /dev/null +++ b/NET/worlds/console/Filler.java @@ -0,0 +1,25 @@ +package NET.worlds.console; + +import java.awt.Dimension; +import java.awt.Panel; + +public class Filler extends Panel { + private static final long serialVersionUID = 2578188264762528538L; + int wForced; + int hForced; + + public Filler(int w, int h) { + this.wForced = w; + this.hForced = h; + } + + @Override + public Dimension preferredSize() { + return this.minimumSize(); + } + + @Override + public Dimension minimumSize() { + return new Dimension(this.wForced, this.hForced); + } +} diff --git a/NET/worlds/console/FixedSizePanel.java b/NET/worlds/console/FixedSizePanel.java new file mode 100644 index 0000000..145d82a --- /dev/null +++ b/NET/worlds/console/FixedSizePanel.java @@ -0,0 +1,43 @@ +package NET.worlds.console; + +import java.awt.Dimension; +import java.awt.Panel; + +class FixedSizePanel extends Panel { + private static final long serialVersionUID = 3707537728341782609L; + int w; + int h; + + public FixedSizePanel(int w, int h) { + this.w = w; + this.h = h; + } + + @Override + public Dimension preferredSize() { + Dimension d = super.preferredSize(); + if (this.w >= 0) { + d.width = this.w; + } + + if (this.h >= 0) { + d.height = this.h; + } + + return d; + } + + @Override + public Dimension minimumSize() { + Dimension d = super.minimumSize(); + if (this.w >= 0) { + d.width = this.w; + } + + if (this.h >= 0) { + d.height = this.h; + } + + return d; + } +} diff --git a/NET/worlds/console/FixedWidthPanel.java b/NET/worlds/console/FixedWidthPanel.java new file mode 100644 index 0000000..d97e122 --- /dev/null +++ b/NET/worlds/console/FixedWidthPanel.java @@ -0,0 +1,22 @@ +package NET.worlds.console; + +import java.awt.Dimension; +import java.awt.LayoutManager; +import java.awt.Panel; + +class FixedWidthPanel extends Panel { + private static final long serialVersionUID = 1256222162739133960L; + private int width; + + public FixedWidthPanel(LayoutManager layout, int width) { + super(layout); + this.width = width; + } + + @Override + public Dimension preferredSize() { + Dimension d = super.preferredSize(); + d.width = this.width; + return d; + } +} diff --git a/NET/worlds/console/FocusPreservingTextField.java b/NET/worlds/console/FocusPreservingTextField.java new file mode 100644 index 0000000..57b656b --- /dev/null +++ b/NET/worlds/console/FocusPreservingTextField.java @@ -0,0 +1,89 @@ +package NET.worlds.console; + +import NET.worlds.scape.EventQueue; +import NET.worlds.scape.Pilot; +import java.awt.Event; +import java.awt.Font; +import java.awt.TextField; + +class FocusPreservingTextField extends TextField { + private static final long serialVersionUID = 7475622191515920214L; + private static FocusPreservingTextField lostFocus; + private static FocusPreservingTextField hasFocus; + private static FocusPreservingTextField chatLine; + private static Object hasFocusMutex = new Object(); + private static Font font = new Font(Console.message("GammaTextFont"), 0, 12); + boolean preserveFocus; + boolean takeNextFocus; + + public FocusPreservingTextField() { + super(30); + this.setFocusable(true); + this.setFont(font); + } + + public void isChatLine() { + chatLine = this; + } + + @Override + public void requestFocus() { + if (!this.takeNextFocus) { + synchronized (hasFocusMutex) { + this.preserveFocus = hasFocus != null && hasFocus.getText().length() != 0 || chatLine != null && chatLine.getText().length() != 0; + } + } else { + this.takeNextFocus = false; + } + + if (!this.preserveFocus) { + super.requestFocus(); + } + } + + public void takeNextFocus() { + this.preserveFocus = false; + this.takeNextFocus = true; + } + + @Override + public boolean handleEvent(Event e) { + synchronized (hasFocusMutex) { + if (e.id == 1005) { + if (hasFocus == this) { + lostFocus = this; + hasFocus = null; + this.preserveFocus = false; + } + } else if (e.id == 1004) { + hasFocus = this; + if (this.preserveFocus && lostFocus != null) { + lostFocus.takeNextFocus(); + lostFocus.requestFocus(); + } + + lostFocus = null; + this.preserveFocus = false; + } + } + + if (e.id == 401) { + Console.wake(); + if (e.key == 27) { + this.setText(""); + return true; + } + + if ((e.modifiers & 2) != 0 && e.key >= 1 && e.key <= 26 && e.key != 22) { + Pilot pilot = Pilot.getActive(); + if (pilot != null) { + pilot.animate("abcdefghijklmnopqrstuvwxyz".substring(e.key - 1, e.key)); + } + + return true; + } + } + + return EventQueue.redirectDrivingKeys(e) ? true : super.handleEvent(e); + } +} diff --git a/NET/worlds/console/ForwardButton.java b/NET/worlds/console/ForwardButton.java new file mode 100644 index 0000000..9e1b1f0 --- /dev/null +++ b/NET/worlds/console/ForwardButton.java @@ -0,0 +1,11 @@ +package NET.worlds.console; + +import java.awt.Button; + +class ForwardButton extends Button { + private static final long serialVersionUID = -1872202502789241725L; + + public ForwardButton(String name) { + super(name); + } +} diff --git a/NET/worlds/console/FourTilePanel.java b/NET/worlds/console/FourTilePanel.java new file mode 100644 index 0000000..f010994 --- /dev/null +++ b/NET/worlds/console/FourTilePanel.java @@ -0,0 +1,229 @@ +package NET.worlds.console; + +import java.awt.Color; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.Event; +import java.awt.Graphics; +import java.awt.Panel; +import java.awt.Rectangle; + +public class FourTilePanel extends Panel { + private static final long serialVersionUID = -7002173409842219262L; + private static final int tw = 5; + private static final int th = 5; + private static final int aw = 7; + private static final int ah = 4; + private static final int bw = 3; + private static Color widgetColor = new Color(255, 238, 177); + private static Color lineColor = new Color(162, 162, 162); + private Component[] comps = new Component[4]; + private int[] order = new int[]{0, 1, 2, 3}; + private float[] divider = new float[]{0.22F, 0.63F}; + private int tx; + private int ty; + private int prevWidth; + private int prevHeight; + private Rectangle moveWidget = new Rectangle(); + private FourTileSwapper swap01 = new FourTileSwapper(this, 0, 1); + private FourTileSwapper swap02 = new FourTileSwapper(this, 0, 2); + private FourTileSwapper swap23 = new FourTileSwapper(this, 2, 3); + private FourTileSwapper swap13 = new FourTileSwapper(this, 1, 3); + private FourTileSwapper[] swaps = new FourTileSwapper[]{this.swap01, this.swap02, this.swap23, this.swap13}; + private boolean dragging; + private int offsetx; + private int offsety; + private int minx; + private int miny; + private int maxx; + private int maxy; + private int specialTileIndex; + private Component oneTile; + + public FourTilePanel(Component ul, Component ur, Component ll, Component lr, int special) { + this.setLayout(null); + this.specialTileIndex = special; + this.add(this.comps[0] = ul); + this.add(this.comps[1] = ur); + this.add(this.comps[2] = ll); + this.add(this.comps[3] = lr); + this.setBackground(Color.black); + if (GammaFrameState.restoreLayout(this.order, this.divider)) { + this.useOneTileMode(); + } else { + this.useFourTileMode(); + } + } + + public boolean isOneTileMode() { + return this.oneTile != null; + } + + public void useOneTileMode() { + if (this.oneTile == null) { + this.oneTile = this.comps[this.specialTileIndex]; + + for (int i = 0; i < 4; i++) { + if (i != this.specialTileIndex) { + this.remove(this.comps[i]); + } + } + + this.moveComponents(); + this.saveLayout(); + this.validate(); + } + } + + public void useFourTileMode() { + if (this.oneTile != null) { + this.oneTile = null; + + for (int i = 0; i < 4; i++) { + if (i != this.specialTileIndex) { + this.add(this.comps[i]); + } + } + + this.moveComponents(); + this.saveLayout(); + this.validate(); + } + } + + @Override + public void reshape(int x, int y, int width, int height) { + super.reshape(x, y, width, height); + if (!GammaFrameState.isIconic()) { + if (this.prevWidth != width) { + this.tx = Math.max((int)(this.divider[0] * width), 12); + this.prevWidth = width; + } + + if (this.prevHeight != height) { + this.ty = Math.max((int)(this.divider[1] * height), 9); + this.prevHeight = height; + } + + this.moveComponents(width, height); + } + } + + private void saveLayout() { + GammaFrameState.saveLayout(this.order, this.divider, this.oneTile != null); + } + + private void moveComponents() { + Dimension size = this.getSize(); + this.moveComponents(size.width, size.height); + } + + private void moveComponents(int width, int height) { + if (this.oneTile == null) { + this.comps[this.order[0]].reshape(3, 3, this.tx - 3, this.ty - 3); + this.comps[this.order[1]].reshape(this.tx + 5, 3, width - this.tx - 5 - 3, this.ty - 3); + this.comps[this.order[2]].reshape(3, this.ty + 5, this.tx - 3, height - this.ty - 5 - 3); + this.comps[this.order[3]].reshape(this.tx + 5, this.ty + 5, width - this.tx - 5 - 3, height - this.ty - 5 - 3); + } else { + this.oneTile.reshape(0, 0, width, height); + } + + this.repaint(); + } + + @Override + public void paint(Graphics g) { + Dimension size = this.getSize(); + g.setColor(this.getBackground()); + if (this.oneTile == null) { + g.fillRect(0, 0, 3, size.height); + g.fillRect(0, 0, size.width, 3); + g.fillRect(0, size.height - 3, size.width, 3); + g.fillRect(size.width - 3, 0, 3, size.height); + g.fillRect(0, this.ty, size.width, 5); + g.fillRect(this.tx, 0, 5, size.height); + g.setColor(lineColor); + g.drawLine(0, this.ty + 2, size.width, this.ty + 2); + g.drawLine(this.tx + 2, 0, this.tx + 2, size.height); + g.setColor(widgetColor); + g.fillRect(this.tx, this.ty, 5, 5); + this.moveWidget.reshape(this.tx, this.ty, 5, 5); + int tmp = (this.tx + 2 - 7) / 2; + g.fillArc(tmp, this.ty - 2, 7, 4, 0, -180); + g.fillArc(tmp, this.ty + 5 - 2, 7, 4, 0, 180); + this.swap02.reshape(tmp, this.ty, 7, 5); + tmp = (this.tx + 2 + size.width - 7) / 2; + g.fillArc(tmp, this.ty - 2, 7, 4, 0, -180); + g.fillArc(tmp, this.ty + 5 - 2, 7, 4, 0, 180); + this.swap13.reshape(tmp, this.ty, 7, 5); + tmp = (this.ty + 2 - 7) / 2; + g.fillArc(this.tx - 2, tmp, 4, 7, 90, -180); + g.fillArc(this.tx + 5 - 2, tmp, 4, 7, 90, 180); + this.swap01.reshape(this.tx, tmp, 5, 7); + tmp = (this.ty + 2 + size.height - 7) / 2; + g.fillArc(this.tx - 2, tmp, 4, 7, 90, -180); + g.fillArc(this.tx + 5 - 2, tmp, 4, 7, 90, 180); + this.swap23.reshape(this.tx, tmp, 5, 7); + } + } + + @Override + public boolean mouseDrag(Event evt, int x, int y) { + if (this.dragging) { + this.tx = x + this.offsetx; + this.ty = y + this.offsety; + this.divider[0] = (float)this.tx / this.getSize().width; + this.divider[1] = (float)this.ty / this.getSize().height; + this.tx = Math.max(this.tx, this.minx); + this.ty = Math.max(this.ty, this.miny); + this.tx = Math.min(this.tx, this.maxx); + this.ty = Math.min(this.ty, this.maxy); + this.moveComponents(); + } + + return true; + } + + @Override + public boolean mouseUp(Event evt, int x, int y) { + if (this.dragging) { + this.validate(); + this.saveLayout(); + } + + this.dragging = false; + return true; + } + + @Override + public boolean mouseDown(Event evt, int x, int y) { + for (int i = 0; i < this.swaps.length; i++) { + if (this.swaps[i].maybeSwap(x, y)) { + return true; + } + } + + if (this.moveWidget.inside(x, y)) { + this.offsetx = this.tx - x; + this.offsety = this.ty - y; + this.minx = 12; + this.maxx = this.getSize().width - this.minx; + this.miny = 12; + this.maxy = this.getSize().height - this.miny; + if (this.minx < this.maxx && this.miny < this.maxy) { + this.dragging = true; + } + } + + return true; + } + + void swap(int c1, int c2) { + int tmp = this.order[c1]; + this.order[c1] = this.order[c2]; + this.order[c2] = tmp; + this.moveComponents(); + this.validate(); + this.saveLayout(); + } +} diff --git a/NET/worlds/console/FourTileSwapper.java b/NET/worlds/console/FourTileSwapper.java new file mode 100644 index 0000000..c174fdf --- /dev/null +++ b/NET/worlds/console/FourTileSwapper.java @@ -0,0 +1,25 @@ +package NET.worlds.console; + +import java.awt.Rectangle; + +class FourTileSwapper extends Rectangle { + private static final long serialVersionUID = 6045056218784091538L; + private FourTilePanel parent; + private int c1; + private int c2; + + FourTileSwapper(FourTilePanel parent, int c1, int c2) { + this.parent = parent; + this.c1 = c1; + this.c2 = c2; + } + + boolean maybeSwap(int x, int y) { + if (this.inside(x, y)) { + this.parent.swap(this.c1, this.c2); + return true; + } else { + return false; + } + } +} diff --git a/NET/worlds/console/FramePart.java b/NET/worlds/console/FramePart.java new file mode 100644 index 0000000..d2cfe65 --- /dev/null +++ b/NET/worlds/console/FramePart.java @@ -0,0 +1,15 @@ +package NET.worlds.console; + +import NET.worlds.scape.FrameEvent; +import java.awt.Container; +import java.awt.Event; + +public interface FramePart { + void activate(Console var1, Container var2, Console var3); + + void deactivate(); + + boolean action(Event var1, Object var2); + + boolean handle(FrameEvent var1); +} diff --git a/NET/worlds/console/FriendsListPart.java b/NET/worlds/console/FriendsListPart.java new file mode 100644 index 0000000..583ee9a --- /dev/null +++ b/NET/worlds/console/FriendsListPart.java @@ -0,0 +1,988 @@ +package NET.worlds.console; + +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.NetworkObject; +import NET.worlds.network.PacketTooLargeException; +import NET.worlds.network.WorldServer; +import NET.worlds.network.netPacket; +import NET.worlds.network.whisperCmd; +import NET.worlds.scape.AnimatedActionManager; +import NET.worlds.scape.Drone; +import NET.worlds.scape.FrameEvent; +import NET.worlds.scape.MouseDownEvent; +import NET.worlds.scape.Pilot; +import NET.worlds.scape.PosableDrone; +import NET.worlds.scape.PosableShape; +import NET.worlds.scape.TeleportAction; +import java.awt.Color; +import java.awt.Container; +import java.awt.Dimension; +import java.awt.Event; +import java.awt.Font; +import java.awt.Graphics; +import java.awt.Image; +import java.awt.Menu; +import java.awt.MenuItem; +import java.awt.PopupMenu; +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(); + if (font == null) { + String friendsGif = IniFile.override().getIniString("friendsGif", "friends.gif"); + friendsImage = ImageCanvas.getSystemImage(friendsGif, 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); + String 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); + } + + @Override + public void update(Graphics g) { + this.paint(g); + } + + @Override + 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); + } + } + } + + @Override + public int getRemainder(int proposedHeight) { + int buttons = proposedHeight / 11; + int y = buttons * 11; + return proposedHeight - y; + } + + @Override + public Dimension preferredSize() { + return new Dimension(97, 1); + } + + @Override + public Dimension minimumSize() { + return this.preferredSize(); + } + + @Override + public boolean mouseMove(Event e, int x, int y) { + return this.buttonAction(x, y, 0); + } + + @Override + public boolean mouseDown(Event e, int x, int y) { + return this.buttonAction(x, y, 2); + } + + @Override + 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; + } + } + + @Override + public boolean mouseDrag(Event e, int x, int y) { + return this.buttonAction(x, y, 1); + } + + @Override + public boolean mouseEnter(Event e, int x, int y) { + return this.buttonAction(x, y, 4); + } + + @Override + public boolean mouseExit(Event e, int x, int y) { + return this.buttonAction(x, y, 5); + } + + @Override + 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 namex = tokens.nextToken(); + if (isValidUserName(namex) && !icontains(this.friends, namex)) { + this.friends.addElement(namex); + } + } + + 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, 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, 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(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 = 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; + } + + @Override + 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); + } + + @Override + public void deactivate() { + active = null; + this.editItem = null; + } + + @Override + 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); + } + } + + @Override + public boolean handle(FrameEvent f) { + synchronized (this.friendsMutex) { + int count = this.serverUpdates.size(); + if (count != 0) { + WorldServer server = this.console.getServerNew(); + if (server != null) { + while (count-- != 0 && sendMsg(server, 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; + } else { + Console.println(Console.message("Cant-go-there")); + this.teleportState = 0; + } + } + + if (this.teleportState == 2) { + int now = Std.getRealTime(); + if (now > this.teleportWaitStartTime + 5000) { + if (now > this.teleportWaitStartTime + 30000) { + this.teleportState = 0; + if (this.teleportWaitSentMsg) { + Object[] arguments = new Object[]{new String(this.teleportTarget)}; + Console.println(MessageFormat.format(Console.message("Cancel-teleport"), arguments)); + } + } else if (!this.teleportWaitSentMsg) { + Object[] arguments = new Object[]{new String(this.teleportTarget)}; + Console.println(MessageFormat.format(Console.message("Delay-locating"), arguments)); + this.teleportWaitSentMsg = true; + } + } + } + + return true; + } + } + + @Override + 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) { + EMailPart.showMessage(this.console, this.activeFriendName); + } else if (target == this.whisperItem || target == this.droneWhisperItem) { + Console.startWhispering(this.activeFriendName); + } else if (target == this.voiceChatItem || target == this.droneVoiceChatItem) { + this.chatter.beginChat(this.activeFriendName, this.console); + } else 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 (this.console.getMutes().mayAddNameListName(Console.getFrame())) { + this.console.getMutes().addNameListName(this.activeFriendName); + } + } else 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); + } + + 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 server) { + if (!this.galaxy.sentFriendsList()) { + synchronized (this.friendsMutex) { + int count = this.friends.size(); + + for (int i = 0; i < count; i++) { + sendMsg(server, new BuddyListUpdateCmd(this.friends.elementAt(i), 1)); + } + } + + 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); + if (!pos.startsWith("home:") && !pos.startsWith("http://")) { + if (targetWorld != null && targetWorld.length() > 0) { + Pilot pilot = Pilot.getActive(); + if (pilot != null) { + String 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; + } + + if (valid) { + TeleportAction.teleport(pos, null); + if (this.teleportWaitSentMsg) { + Object[] arguments = new Object[]{new String(this.teleportTarget)}; + Console.println(MessageFormat.format(Console.message("Found-tele"), arguments)); + } + } else { + Object[] arguments = new Object[]{new String(this.teleportTarget), new String(targetWorld)}; + String msg = MessageFormat.format(Console.message("Cant-go-world"), arguments); + Console.println(msg); + } + + 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(); + } + } + + @Override + public int getNameListCount() { + return this.friends.size(); + } + + @Override + public String getNameListName(int index) { + return this.friends.elementAt(index); + } + + @Override + public void removeNameListName(int index) { + synchronized (this.friendsMutex) { + String name = 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)); + } + } + + @Override + 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, + null, + Console.message("Too-many-names"), + null, + Console.message("OK"), + MessageFormat.format(Console.message("You-are-limitedF"), arguments), + true + ); + return false; + } + } + + @Override + 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); + 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(); + + while (consoleList.hasMoreElements()) { + Object c = consoleList.nextElement(); + if (c instanceof DefaultConsole) { + FriendsListPart 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); + } + } else { + assert name.length() == 0; + + target.clearAll(); + } + } + } + + if (state == 2) { + consoleList = g.getConsoles(); + + while (consoleList.hasMoreElements()) { + Object c = consoleList.nextElement(); + if (c instanceof DefaultConsole) { + FriendsListPart 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 = 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 = 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); + } + } + } + + @Override + 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; + } + } + + void moreFriendsAction(String name, MenuItem function) { + this.activeFriendName = name; + + assert this.activeFriendName != null; + + this.maybeFriendAction(function); + } +} diff --git a/NET/worlds/console/Gamma.java b/NET/worlds/console/Gamma.java new file mode 100644 index 0000000..422a88b --- /dev/null +++ b/NET/worlds/console/Gamma.java @@ -0,0 +1,555 @@ +package NET.worlds.console; + +import NET.worlds.core.IniFile; +import NET.worlds.core.Std; +import NET.worlds.network.NetUpdate; +import NET.worlds.scape.MusicManager; +import NET.worlds.scape.Pilot; +import NET.worlds.scape.TeleportAction; +import NET.worlds.scape.TeleportStatus; +import NET.worlds.scape.World; +import java.awt.Button; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Frame; +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.net.MalformedURLException; +import java.net.URL; +import java.net.URLConnection; +import java.text.MessageFormat; +import java.util.Enumeration; +import java.util.Hashtable; +import java.util.NoSuchElementException; +import java.util.Properties; +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 ver) { + StringTokenizer tok = new StringTokenizer(ver, "._"); + float version = 0.0F; + + try { + Integer i = new Integer(tok.nextToken()); + version = i.intValue(); + i = new Integer(tok.nextToken()); + float min = i.floatValue() / 10.0F; + if (!(min < 1.0F)) { + return true; + } + + version += min; + i = new Integer(tok.nextToken()); + min = i.floatValue() / 100.0F; + version += min; + } catch (NoSuchElementException var9) { + } + + if (version <= 1.13F) { + BlockingDialog d = new BlockingDialog(new Frame(), "Worlds.com: Error", true); + GridBagLayout gbl = new GridBagLayout(); + d.setLayout(gbl); + d.setSize(200, 150); + MultiLineLabel mll = new MultiLineLabel("Your system's Java Virtual Machine\nis out of date. Please download our\nfull installer and try again."); + GridBagConstraints c = new GridBagConstraints(); + c.gridx = 0; + c.gridy = 0; + gbl.setConstraints(mll, c); + d.add(mll); + Button b = new Button("OK"); + b.addActionListener(d); + GridBagConstraints c2 = new GridBagConstraints(); + c2.gridx = 0; + c2.gridy = 1; + gbl.setConstraints(b, c2); + d.add(b); + d.validate(); + d.show(); + d.waitForResponse(); + return false; + } else { + return true; + } + } + + public static void main(String[] args) { + String worldURL = parseCommandLine(args); + String s = System.getProperty("java.version"); + if (!checkVersion(s)) { + System.exit(0); + } + + String vendor = System.getProperty("java.vendor"); + System.out.println("User running java version " + s + " from vendor " + System.getProperty("java.vendor")); + String awtDll = "winawt"; + String netDll = "net"; + boolean msvm = false; + if (vendor.indexOf("Microsoft") != -1) { + awtDll = "MSAWT"; + netDll = "MSNET32"; + msvm = true; + } + + System.out.println("Loading: " + earlyURLUnalias(_dllPath + "gamma.dll")); + System.load(earlyURLUnalias(_dllPath + "gamma.dll")); + if (msvm) { + Window.doMicrosoftVMHacks(); + } + + if (IniFile.gamma().getIniInt("MULTIRUN", 0) == 0 && !Startup.synchronizeStartup(worldURL, _autoplay)) { + System.exit(0); + } + + if (s.charAt(2) <= '1' && !msvm) { + try { + System.loadLibrary(awtDll); + } catch (UnsatisfiedLinkError var35) { + } + + try { + System.loadLibrary(netDll); + } catch (UnsatisfiedLinkError var34) { + } + } else { + if (!msvm) { + awtDll = "awt"; + } + + new Color(0, 0, 0); + + try { + URL stupid = new URL("http://127.0.0.1/"); + URLConnection uc = stupid.openConnection(); + uc.connect(); + } catch (MalformedURLException var36) { + } catch (IOException var37) { + } + } + + if (!msvm) { + Window.hookWinAPIs(awtDll); + } + + String inihome = earlyURLUnalias("home:worlds.ini"); + Std.initProductName(); + IniFile install = IniFile.override(); + String splashgif = install.getIniString("splashgif", Console.message("Opnscrnc.gif")); + splash = new SplashScreen(GammaFrame.getDefaultTitle(), splashgif); + splash.show(); + splash.toFront(); + String proxyIP = IniFile.gamma().getIniString("Proxy Server IP", ""); + String proxyPort = IniFile.gamma().getIniString("Proxy Server Port", ""); + if (proxyIP.length() > 7) { + Properties p = System.getProperties(); + System.out.println("Using Proxy Server: " + proxyIP + ":" + proxyPort); + p.remove("socksProxyHost"); + p.remove("socksProxyPort"); + p.put("socksProxyHost", proxyIP); + p.put("socksProxyPort", proxyPort); + System.setProperties(p); + } + + loadProgress = new ProgressBar("Loading Worldsplayer...", 12); + Dimension sd = splash.getSize(); + Dimension d = loadProgress.getSize(); + int px = splash.getLocationOnScreen().x + (sd.width >> 1) - (d.width >> 1); + int py = splash.getLocationOnScreen().y + sd.height; + loadProgress.setLocation(px, py); + loadProgress.show(); + java.awt.Cursor c = java.awt.Cursor.getPredefinedCursor(3); + loadProgress.setCursor(c); + splash.setCursor(c); + if (inihome.length() > 1 && inihome.charAt(1) == ':') { + Startup.computeVolumeInfo(inihome.charAt(0) + ":\\"); + } else { + Startup.computeVolumeInfo(null); + } + + try { + LogFile.open(); + Gamma g = new Gamma(worldURL); + Main.register(g); + if (loadProgress != null) { + loadProgress.setMessage("Starting main thread..."); + loadProgress.advance(); + } + + Thread mainThread = new Thread(g, "Gamma Main"); + mainThread.setDaemon(true); + mainThread.start(); + new Gamma.PriorityAdjuster(mainThread); + if (loadProgress != null) { + loadProgress.setMessage("Initializing ActiveX..."); + loadProgress.advance(); + } + + new Netscape(); + + try { + mainThread.join(); + } catch (InterruptedException var30) { + throw new Error(var30.toString()); + } + + GammaFrame frame = Console.getFrame(); + if (frame != null) { + frame.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 url) { + if (url.startsWith("home:")) { + url = _home + url.substring(5); + } + + if (url.startsWith("file:")) { + url = url.substring(5); + } + + url = url.replace('\\', '/'); + if (url.length() < 2 || url.charAt(1) != ':' && !url.startsWith("//")) { + String curDir = System.getProperty("user.dir").replace('\\', '/'); + if (!curDir.endsWith("/")) { + curDir = curDir + "/"; + } + + url = curDir + url; + } + + return url; + } + + public static String getParam(String name) { + return _params.get(name); + } + + private static String parseCommandLine(String[] args) { + String world = null; + + for (int i = 0; i < args.length; i++) { + if (args[i].length() > 0 && args[i].charAt(0) == '-') { + if (args[i].equalsIgnoreCase("-help")) { + usage("Help message"); + } else if (args[i].equalsIgnoreCase("-home")) { + if (++i == args.length) { + usage("-home must be followed by a path:"); + } + + _home = "file:" + args[i]; + System.out.println("Home: " + args[i]); + } else if (args[i].equalsIgnoreCase("-dllpath")) { + if (++i == args.length) { + usage("-dllpath must be followed by a path:"); + } + + _dllPath = args[i]; + } else if (args[i].equalsIgnoreCase("-set")) { + label51: { + if (++i != args.length) { + if (++i != args.length) { + break label51; + } + } + + usage("-set must be followed by a name of a parameter to set and its value"); + } + + _params.put(args[i - 1], args[i]); + } else if (args[i].equalsIgnoreCase("-autoplay")) { + _autoplay = true; + } else if (!args[i].equalsIgnoreCase("-embedding") + && !args[i].equalsIgnoreCase("/embedding") + && !args[i].equalsIgnoreCase("-automation") + && !args[i].equalsIgnoreCase("/automation")) { + usage("Unrecognized command line option: " + args[i]); + } + } else { + if (world != null) { + usage("There may be only one command-line world URL"); + } + + world = args[i]; + } + } + + _home = makeEndWithSlash(_home); + _dllPath = makeEndWithSlash(_dllPath); + return world; + } + + private static String makeEndWithSlash(String url) { + if (!url.endsWith("\\") && !url.endsWith("/") && !url.endsWith(":")) { + url = url + "\\"; + } + + return url; + } + + public static void usage(String msg) { + 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(msg); + } + + public static String getHome() { + return _home; + } + + public static String getExePath() { + return getHome() + "bin\\"; + } + + public static void dllLoad(String dll) { + System.load(NET.worlds.network.URL.make(_dllPath + dll).unalias()); + } + + public static Shaper getShaper() { + return shaper; + } + + public static boolean shaperEnabled() { + return IniFile.gamma().getIniInt("DISABLESHAPER", 1) == 0 || IniFile.override().getIniInt("DISABLESHAPER", 1) == 0; + } + + private Gamma(String url) { + this.startingURL = url; + } + + private void die(Throwable e) { + e.printStackTrace(System.out); + if (getShaper() != null) { + Console.println(Console.message("Saving-modified")); + Enumeration worlds = World.getWorlds(); + + while (worlds.hasMoreElements()) { + World w = worlds.nextElement(); + if (w.getEdited()) { + String base = w.getSourceURL().unalias(); + if (base.toLowerCase().endsWith(".wor")) { + base = base.substring(0, base.length() - 4); + } + + if (base.toLowerCase().endsWith(".world")) { + base = base.substring(0, base.length() - 6); + } + + int dash = base.lastIndexOf("-"); + if (dash != -1) { + for (int i = dash + 1; i < base.length(); i++) { + if (!Character.isDigit(base.charAt(i))) { + dash = -1; + break; + } + } + } + + if (dash != -1) { + base = base.substring(0, dash); + } + + String name = base + ".world"; + + for (int number = 1; new File(name).exists(); number++) { + name = base + "-" + number + ".world"; + } + + Object[] arguments = new Object[]{new String(w.getName()), new String("" + w.getSourceURL()), new String(name)}; + Console.println(MessageFormat.format(Console.message("Saving-name"), arguments)); + + try { + Shaper.doSave(name, w, false); + } catch (Exception var10) { + Console.println(Console.message("Ignoring") + var10); + } catch (Error var11) { + Console.println(Console.message("Ignoring") + var11); + } + } + } + } + } + + @Override + public void run() { + Main.register(new Gamma.RecordPosition()); + + try { + Main.mainLoop(); + } catch (Throwable var2) { + this.die(var2); + } + } + + @Override + public void mainCallback() { + Main.unregister(this); + if (NetUpdate.doUpdate(false)) { + Main.end(); + } else { + File bin = new File(earlyURLUnalias("home:bin")); + File prg = new File(bin, "gdkup.prg"); + File exe = new File(bin, "gdkup.exe"); + if (prg.exists() && (!exe.exists() || prg.lastModified() > exe.lastModified())) { + if (exe.exists()) { + exe.delete(); + } + + try { + FileInputStream i = new FileInputStream(prg); + FileOutputStream o = new FileOutputStream(exe); + byte[] buf = new byte[8192]; + + int len; + while ((len = i.read(buf)) > 0) { + o.write(buf, 0, len); + } + + i.close(); + o.close(); + } catch (Exception var10) { + var10.printStackTrace(System.out); + throw new Error("Can't copy gdkup.prg"); + } + } + + if (shaperEnabled()) { + shaper = new Shaper(); + } + + IniFile install = IniFile.override(); + String splashOver = install.getIniString("splashover", Console.message("Pwc.gif")); + int splashXOver = install.getIniInt("splashxover", 141); + int splashYOver = install.getIniInt("splashyover", 140); + if (splashXOver >= 0) { + splash.addOverlay(splashOver, splashXOver, splashYOver); + } + + 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(); + } + } + + @Override + public void teleportStatus(String err, String url) { + if (err == null) { + this.loadErr = null; + } else { + this.loadErr = err; + } + } + + static class PriorityAdjuster implements MainCallback { + private Thread mainThread; + boolean wasActivated = true; + + PriorityAdjuster(Thread t) { + this.mainThread = t; + this.mainThread.setPriority(5); + Main.register(this); + } + + @Override + 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 { + @Override + public void mainCallback() { + } + + @Override + public void terminalCallback() { + Pilot pilot = Pilot.getActive(); + if (pilot != null) { + IniFile.gamma().setIniString("RestartAt", pilot.getURL()); + } + + Main.unregister(this); + } + } + + class StartupTeleport implements MainCallback { + @Override + 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) { + } + } + } + } +} diff --git a/NET/worlds/console/GammaFrame.java b/NET/worlds/console/GammaFrame.java new file mode 100644 index 0000000..4aec0db --- /dev/null +++ b/NET/worlds/console/GammaFrame.java @@ -0,0 +1,144 @@ +package NET.worlds.console; + +import NET.worlds.core.Std; +import NET.worlds.scape.EditTile; +import NET.worlds.scape.LibrariesTile; +import java.awt.BorderLayout; +import java.awt.CardLayout; +import java.awt.Container; +import java.awt.Event; +import java.awt.Frame; + +public class GammaFrame extends Frame implements DialogDisabled { + private static final long serialVersionUID = 2725752068161032112L; + private Container consoleTile; + private Tree treeTile; + private EditTile editTile; + private LibrariesTile librariesTile; + private FourTilePanel fourTile; + private boolean isDialogDisabled; + + @Override + public boolean handleEvent(Event e) { + if (this.isDialogDisabled) { + return false; + } else { + Console c = Console.getActive(); + if (c != null && c.handleEvent(e)) { + return true; + } else { + return e.id == 201 ? Console.maybeQuit() : super.handleEvent(e); + } + } + } + + public static String getDefaultTitle() { + return Std.getProductName(); + } + + public GammaFrame() { + super(getDefaultTitle()); + } + + @Override + public void show() { + Gamma.hideSplash(); + Window.allowFGJavaPalette(false); + Console cons = Console.getActive(); + if (cons instanceof DefaultConsole) { + ((DefaultConsole)cons).setOrthoEnabled(this.isShaperVisible()); + } + + super.show(); + } + + public Container getConsoleTile() { + this.makeTiles(); + return this.consoleTile; + } + + public Tree getTreeTile() { + this.makeTiles(); + return this.treeTile; + } + + public EditTile getEditTile() { + this.makeTiles(); + return this.editTile; + } + + public LibrariesTile getLibrariesTile() { + this.makeTiles(); + return this.librariesTile; + } + + private void makeTiles() { + if (this.consoleTile == null) { + if (Gamma.getShaper() == null) { + this.consoleTile = this; + } else { + this.consoleTile = new ExposedPanel(); + this.treeTile = new Tree(); + this.editTile = new EditTile(this.treeTile); + this.librariesTile = new LibrariesTile(); + this.setLayout(new BorderLayout()); + this.fourTile = new FourTilePanel(this.librariesTile, this.consoleTile, this.treeTile, this.editTile, 1); + this.add("Center", this.fourTile); + } + + this.consoleTile.setLayout(new CardLayout()); + } + } + + public void setShaperVisible(boolean f) { + if (Gamma.getShaper() != null) { + if (this.fourTile.isOneTileMode() == f) { + if (f) { + this.fourTile.useFourTileMode(); + } else { + this.fourTile.useOneTileMode(); + } + } + + Console cons = Console.getActive(); + if (cons instanceof DefaultConsole) { + ((DefaultConsole)cons).setOrthoEnabled(f); + } + } + } + + public boolean isShaperVisible() { + return Gamma.getShaper() != null && this.fourTile != null && !this.fourTile.isOneTileMode(); + } + + public void deactivate() { + } + + public void activate() { + if (!this.isShowing()) { + new GammaFrameState(this); + this.show(); + } + } + + @Override + public boolean action(Event event, Object what) { + Console c = Console.getActive(); + return c != null && c.action(event, what) ? true : super.action(event, what); + } + + @Override + public void dialogDisable(boolean disable) { + this.isDialogDisabled = disable; + Console c = Console.getActive(); + if (c != null) { + c.dialogDisable(disable); + } + + if (this.isShaperVisible()) { + this.getTreeTile().dialogDisable(disable); + this.getLibrariesTile().dialogDisable(disable); + this.getEditTile().dialogDisable(disable); + } + } +} diff --git a/NET/worlds/console/GammaFrameState.java b/NET/worlds/console/GammaFrameState.java new file mode 100644 index 0000000..16497a6 --- /dev/null +++ b/NET/worlds/console/GammaFrameState.java @@ -0,0 +1,232 @@ +package NET.worlds.console; + +import NET.worlds.core.IniFile; +import java.awt.Dimension; +import java.awt.Point; +import java.awt.Toolkit; +import java.util.StringTokenizer; + +public class GammaFrameState implements MainCallback { + private static final int defaultWidth = 568; + private static final int defaultHeight = 424; + private static final int minimumWidth = 142; + private static final int minimumHeight = 106; + private static int[] frameState = new int[5]; + private static GammaFrame frame; + private static int handle; + private static String borderKey; + private static final String layoutKey = "ShaperLayout"; + private static final String modeKey = "ChangeVideoMode"; + private static final float scale = 100.0F; + private boolean initMaximized; + private int[] videoMode; + + GammaFrameState(GammaFrame f) { + frame = f; + if (borderKey == null) { + borderKey = Gamma.shaperEnabled() ? "ShaperWindow" : "Window"; + } + + this.restoreBorder(); + int[] mode = new int[2]; + if (strToInts(IniFile.gamma().getIniString("ChangeVideoMode", ""), mode) == 2) { + this.videoMode = mode; + } + + Main.register(this); + } + + public static void saveBorder() { + int state; + if (handle != 0 && !isIconic(state = getFrameState())) { + Point loc = frame.getLocation(); + Dimension size = new Dimension(Window.getWindowWidth(handle), Window.getWindowHeight(handle)); + int[] newState = new int[frameState.length]; + if (!isMaximized(newState[4] = state)) { + newState[0] = loc.x; + newState[1] = loc.y; + newState[2] = size.width; + newState[3] = size.height; + } else { + for (int i = 0; i < 4; i++) { + newState[i] = frameState[i]; + } + } + + for (int i = 0; i < frameState.length; i++) { + if (newState[i] != frameState[i]) { + IniFile var10000 = IniFile.gamma(); + String var10001 = makeKey(borderKey); + frameState = newState; + var10000.setIniString(var10001, intsToStr(newState)); + break; + } + } + } + } + + private void restoreBorder() { + if (strToInts(IniFile.gamma().getIniString(makeKey(borderKey), ""), frameState) == 5) { + if (frameState[0] >= 0 && frameState[2] >= 142 && frameState[1] >= 0 && frameState[3] >= 106) { + if (isMaximized(frameState[4])) { + this.initMaximized = true; + } else { + frameState[4] = 0; + this.initMaximized = false; + } + + frame.reshape(frameState[0], frameState[1], frameState[2], frameState[3]); + } else { + this.makeDefaultBorder(); + } + } else { + this.makeDefaultBorder(); + } + } + + private void makeDefaultBorder() { + Dimension size = getScreenSize(); + int dx = size.width - 568; + int dy = size.height - 424; + if (dx <= 0) { + dx = 0; + } else { + dx /= 2; + } + + if (dy <= 0) { + dy = 0; + } else { + dy /= 2; + } + + frameState[0] = dx; + frameState[1] = dy; + frameState[2] = 568; + frameState[3] = 424; + frameState[4] = 0; + this.initMaximized = false; + frame.reshape(dx, dy, 568, 424); + } + + public static void saveLayout(int[] layout, float[] divider, boolean oneTile) { + IniFile.gamma().setIniString(makeKey("ShaperLayout"), intsToStr(layout) + " " + floatsToStr(divider) + " " + (oneTile ? "0" : "1")); + } + + public static boolean restoreLayout(int[] argLayout, float[] argDivider) { + int[] layout = new int[argLayout.length]; + float[] divider = new float[argDivider.length]; + int[] tmp = new int[layout.length + divider.length + 1]; + tmp[layout.length + divider.length] = 0; + if (strToInts(IniFile.gamma().getIniString(makeKey("ShaperLayout"), ""), tmp) < layout.length + divider.length) { + return true; + } else { + int[] used = new int[layout.length]; + + for (int i = 0; i < layout.length; i++) { + try { + used[layout[i] = tmp[i]]++; + } catch (ArrayIndexOutOfBoundsException var8) { + return true; + } + } + + for (int i = 0; i < layout.length; i++) { + if (used[i] != 1) { + return true; + } + } + + for (int ix = 0; ix < divider.length; ix++) { + float f = tmp[ix + layout.length] / 100.0F; + if (f < 0.0F || f > 1.0F) { + return true; + } + + divider[ix] = f; + } + + System.arraycopy(layout, 0, argLayout, 0, argLayout.length); + System.arraycopy(divider, 0, argDivider, 0, argDivider.length); + return tmp[layout.length + divider.length] == 0; + } + } + + private static int getFrameState() { + return Window.getWindowState(handle); + } + + public static boolean isIconic() { + return handle != 0 ? isIconic(getFrameState()) : false; + } + + private static boolean isIconic(int state) { + return state == 1; + } + + private static boolean isMaximized(int state) { + return state == 2; + } + + private static Dimension getScreenSize() { + return Toolkit.getDefaultToolkit().getScreenSize(); + } + + private static String makeKey(String prefix) { + Dimension screenSize = getScreenSize(); + return prefix + screenSize.width + "X" + screenSize.height; + } + + private static String intsToStr(int[] arr) { + String s = "" + arr[0]; + + for (int i = 1; i < arr.length; i++) { + s = s + " " + arr[i]; + } + + return s; + } + + private static String floatsToStr(float[] arr) { + int[] iarr = new int[arr.length]; + + for (int i = 0; i < arr.length; i++) { + iarr[i] = (int)(arr[i] * 100.0F); + } + + return intsToStr(iarr); + } + + private static int strToInts(String s, int[] arr) { + if (s == null) { + return 0; + } else { + StringTokenizer tok = new StringTokenizer(s, " "); + + int i; + for (i = 0; i < arr.length && tok.hasMoreTokens(); i++) { + try { + arr[i] = Integer.parseInt(tok.nextToken()); + } catch (NumberFormatException var5) { + break; + } + } + + return i; + } + } + + @Override + public void mainCallback() { + handle = Window.findWindow(frame.getTitle()); + if (handle != 0) { + if (this.videoMode != null) { + Window.setVideoMode(handle, this.videoMode[0], this.videoMode[1]); + } else if (this.initMaximized) { + Window.setWindowState(handle, 2); + } + + Main.unregister(this); + } + } +} diff --git a/NET/worlds/console/GammaPhoneMonitor.java b/NET/worlds/console/GammaPhoneMonitor.java new file mode 100644 index 0000000..b943d38 --- /dev/null +++ b/NET/worlds/console/GammaPhoneMonitor.java @@ -0,0 +1,149 @@ +package NET.worlds.console; + +import NET.worlds.scape.WavSoundPlayer; + +public class GammaPhoneMonitor extends Thread { + public static final int GA_FAILEDCONNECT = 100; + public static final int GPE_WHATEVER = 0; + public static final int GPE_OUT_OF_MEM = 1; + public static final int GPE_WEIRD = 2; + public static final int GPE_SOCKET = 3; + public static final int GPE_COMM = 4; + public static final int GPE_HOST = 5; + public static final int GPE_FILE = 6; + public static final int GPE_CRYPTO = 7; + public static final int GPE_MULTICAST = 8; + public static final int GPE_RECORD = 9; + public static final int GPE_WAVE_INPUT = 10; + public static final int GPE_PLAY = 11; + public static final int GPE_WAVE_OUTPUT = 12; + public static final int GPE_PORT = 13; + public static final int GPE_SOCKETS_VERSION = 14; + public static final int GPE_HALF_DUPLEX = 15; + public static final int GPE_USAGE = 16; + public static final int GPE_IS_HALF_DUPLEX = 17; + public static final int GPE_IS_FULL_DUPLEX = 18; + public static final int GPE_LWL = 19; + public static final int GPE_TIMEOUT = 20; + public static final int GPE_WAVE_IN_USE = 21; + public static final int GPE_CONNECTION_LOST = 22; + public static final int GPE_SUCCESS = 900; + public static final int GPE_STARTUP = 901; + public static final int GPE_SHUTDOWN = 902; + private VoiceChat _vc = null; + + public GammaPhoneMonitor(VoiceChat v) { + this._vc = v; + } + + private void release() { + this._vc.release(); + } + + @Override + public void run() { + int m = 0; + Window w = Window.getMainWindow(); + + try { + while (true) { + if (Window.getVoiceChatWParam() != 0) { + this.processMessage(Window.getVoiceChatWParam(), Window.getVoiceChatLParam()); + Window.resetVoiceChatMsg(); + } + + Thread.sleep(1000L); + } + } catch (InterruptedException var4) { + this.stop(); + } + } + + private void processMessage(int wParam, int lParam) { + switch (wParam) { + case 0: + this._vc.inform(wParam, "whatever "); + break; + case 1: + this._vc.inform(wParam, "out of memory "); + break; + case 2: + this._vc.inform(wParam, "! "); + break; + case 3: + this._vc.inform(wParam, "An error occurred while setting up the socket for Voice Chat."); + break; + case 4: + this._vc.inform(wParam, "communications "); + break; + case 5: + this._vc.inform(wParam, "can't find host "); + break; + case 6: + this._vc.inform(wParam, "can't open/read/write file "); + break; + case 7: + this._vc.inform(wParam, "we don't even use this! "); + break; + case 8: + this._vc.inform(wParam, "we don't even use this! "); + break; + case 9: + this._vc.inform(wParam, "can't record at 8000 or 11200 samp/sec"); + break; + case 10: + this._vc.inform(wParam, "error opening wave input device "); + break; + case 11: + this._vc.inform(wParam, "sound card can't play at 8000 or 11200"); + break; + case 12: + this._vc.inform(wParam, "error opening wave output device "); + break; + case 13: + this._vc.inform(wParam, "invalid port number specified "); + break; + case 14: + this._vc.inform(wParam, "incompatible (old) sockets library "); + break; + case 15: + this._vc.inform(wParam, "sound drivers can't support full duplex"); + break; + case 16: + this._vc.inform(wParam, "command line syntax error "); + break; + case 17: + this._vc.inform(wParam, "response to isFullDuplex command "); + break; + case 18: + this._vc.inform(wParam, "response to isFullDuplex command "); + break; + case 19: + this._vc.inform(wParam, " -Look Who's Listening- error, weird! "); + break; + case 20: + this._vc.inform(wParam, "Never heard back. "); + break; + case 21: + this._vc.inform(wParam, "VoiceChat failed because a wav device is in use."); + break; + case 22: + this._vc.inform(wParam, "VoiceChat has lost its connection."); + break; + case 100: + Console.println(Console.message("Voice-failed")); + break; + case 900: + this._vc.inform(wParam, "It worked o.k. "); + break; + case 901: + this._vc.registerProcess(lParam); + break; + case 902: + WavSoundPlayer.resumeSystem(); + break; + default: + Console.println(Console.message("Unrec-message") + wParam); + } + } +} diff --git a/NET/worlds/console/GammaTextArea.java b/NET/worlds/console/GammaTextArea.java new file mode 100644 index 0000000..d470e42 --- /dev/null +++ b/NET/worlds/console/GammaTextArea.java @@ -0,0 +1,923 @@ +package NET.worlds.console; + +import NET.worlds.core.IniFile; +import NET.worlds.scape.SendURLAction; +import NET.worlds.scape.TeleportAction; +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 java.awt.datatransfer.Clipboard; +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.KeyEvent; +import java.awt.event.MouseEvent; +import java.awt.event.MouseWheelEvent; +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 = new String[]{ + boldStartTag, + boldEndTag, + italicStartTag, + italicEndTag, + colorStartMagentaTag, + colorStartRedTag, + colorStartGreenTag, + colorStartBlueTag, + colorEndTag, + colorMagenta2Tag, + colorBlue2Tag, + colorRed2Tag, + colorGreen2Tag, + colorCyanTag, + colorDarkGrayTag, + colorGrayTag, + colorOrangeTag, + colorPinkTag, + colorYellowTag, + colorWhiteTag, + colorLightGrayTag + }; + private int lastWidth = 0; + protected boolean selectionConversion = false; + protected int _initialSelection = -1; + + @Override + public Font getFont() { + return this._font; + } + + @Override + public int getWidth() { + return this._width; + } + + @Override + 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); + } + + @Override + public void update(Graphics g) { + this.paint(g); + } + + @Override + 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); + } + + @Override + 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); + } + + @Override + protected synchronized void processKeyEvent(KeyEvent e) { + this._canvas.dispatchEvent(e); + super.processKeyEvent(e); + } + + @Override + protected synchronized void processMouseWheelEvent(MouseWheelEvent e) { + if (e.getID() == 507) { + int move = 0; + 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(null); + } + } + + super.processMouseWheelEvent(e); + } + + @Override + 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(); + } + + @Override + public synchronized void repaint() { + this._canvas.repaint(); + super.repaint(); + } + + @Override + 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() { + return !this._canvas.mouseActive && (this.selectionStart < 0 || this.selectionEnd <= this.selectionStart) + ? this._scrollLine >= this._numLines - this._canvasLines || this._numLines <= this._canvasLines + : false; + } + + protected synchronized boolean handleTag(Graphics g, String word, int x, int y) { + String lower = word.toLowerCase(); + if (word.charAt(0) == '<') { + for (int i = 0; i < tagList.length; i++) { + if (lower.equals(tagList[i].toLowerCase())) { + switch (i) { + 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) { + int 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) { + } + + this._currentColor = new Color(color); + + try { + this._font = new Font(this._currentFontName, this._currentStyle, this._currentPointSize); + } catch (IllegalArgumentException var9) { + } + + 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)(y - size.getHeight())); + } + + this.lastWidth = (int)(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"); + + 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); + + assert fm != null; + + while (words.hasMoreTokens()) { + String word = words.nextToken(); + if (!word.equals("\n") && !word.equals("\r")) { + if (this.handleTag(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 = 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(this._lastpos); + this._lastpos = this._lastpos + thisLine.length(); + this._lines.addElement(thisLine.trim()); + this._numLines++; + lineWidth = this.lastWidth; + thisLine = ""; + } + + thisLine = thisLine + word; + } + } + } + } + + if (!thisLine.equals("")) { + this._pos.addElement(this._lastpos); + this._lastpos = this._lastpos + thisLine.length() + 1; + this._numLines++; + this._lines.addElement(thisLine.trim()); + } + } + } + } + + 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 = 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 = 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) { + 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 = this._lines.elementAt(lineNum); + + assert thisLine != null; + + this._curpos = 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 = this._curpos + st.nextToken().length(); + } + + this.lastWidth = 0; + g.setFont(this._font); + g.setColor(this._currentColor); + this._curpos = this._curpos + word.length(); + } + } + + this.ClearTags(g); + } + } + + private void drawString(Graphics g, String text, int x, int y) { + FontMetrics fm = g.getFontMetrics(); + if (this.selectionConversion) { + int height = fm.getHeight(); + int pos = -1; + if (y - height < 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 { + int i = 0; + + while (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) { + int startdist = this.selectionStart - this._curpos; + if (startdist > 0) { + if (startdist < text.length()) { + int end = text.length(); + if (this._curpos + end >= this.selectionEnd) { + end = this.selectionEnd - this._curpos; + } + + this.drawHighlight(g, text.substring(startdist, end), 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 = 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; + } + + @Override + 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, null); + } else { + new SendURLAction(text).startBrowser(); + } + + this.selectionStart = this.selectionEnd = -1; + this.repaint(); + } + + 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(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), null); + } + + this.hideRightMenu(); + } +} diff --git a/NET/worlds/console/GammaTextScrollbar.java b/NET/worlds/console/GammaTextScrollbar.java new file mode 100644 index 0000000..c3eed33 --- /dev/null +++ b/NET/worlds/console/GammaTextScrollbar.java @@ -0,0 +1,22 @@ +package NET.worlds.console; + +import java.awt.Scrollbar; +import java.awt.event.MouseEvent; + +class GammaTextScrollbar extends Scrollbar { + private static final long serialVersionUID = -3376693721088718777L; + + GammaTextScrollbar(int orientation) { + super(orientation); + this.enableEvents(20L); + } + + @Override + protected void processMouseEvent(MouseEvent e) { + if (e.getID() == 501) { + this.getParent().requestFocus(); + } + + super.processMouseEvent(e); + } +} diff --git a/NET/worlds/console/GiftDialog.java b/NET/worlds/console/GiftDialog.java new file mode 100644 index 0000000..73cfc10 --- /dev/null +++ b/NET/worlds/console/GiftDialog.java @@ -0,0 +1,45 @@ +package NET.worlds.console; + +import NET.worlds.core.Std; +import NET.worlds.scape.InventoryItem; +import NET.worlds.scape.InventoryManager; +import java.text.MessageFormat; +import java.util.Hashtable; + +class GiftDialog extends OkCancelDialog { + private static final long serialVersionUID = -5698666260017940591L; + private String inv; + private int autoCloseTime; + + public static String calcMsg(String inv, int duration) { + InventoryManager im = InventoryManager.getInventoryManager(); + Hashtable inventory = im.parseInventoryString(inv); + String hr = TradeDialog.buildInvDesc(inventory); + Object[] arguments = new Object[]{new String(hr), new String("" + duration / 1000)}; + return MessageFormat.format(Console.message("To-claim-hr"), arguments); + } + + public GiftDialog(String _inv, int duration) { + super(Console.getFrame(), null, Console.message("A-Gift"), null, "Accept", calcMsg(_inv, duration), false); + this.autoCloseTime = Std.getFastTime() + duration; + this.inv = _inv; + } + + @Override + protected void activeCallback() { + super.activeCallback(); + if (Std.getFastTime() > this.autoCloseTime && this.autoCloseTime != 0) { + this.done(false); + } + } + + @Override + protected synchronized boolean done(boolean confirmed) { + WhisperManager.whisperManager().giftDialogDone(); + if (confirmed) { + TradeDialog.sendTradeMessage("&|+deal>TRADE ," + this.inv); + } + + return super.done(confirmed); + } +} diff --git a/NET/worlds/console/IClassFactory.java b/NET/worlds/console/IClassFactory.java new file mode 100644 index 0000000..566a130 --- /dev/null +++ b/NET/worlds/console/IClassFactory.java @@ -0,0 +1,123 @@ +package NET.worlds.console; + +import NET.worlds.core.RegKey; +import NET.worlds.core.RegKeyNotFoundException; +import java.io.IOException; + +public class IClassFactory extends IUnknown { + private static final String IID_IClassFactory = "{00000001-0000-0000-C000-000000000046}"; + private long _registerID; + + public IClassFactory() throws IOException { + } + + public IClassFactory(String svrID) throws IOException { + super(svrID, "{00000001-0000-0000-C000-000000000046}"); + } + + public IClassFactory(IUnknown pIUnknown) throws IOException, OLEInvalidObjectException { + super(pIUnknown, "{00000001-0000-0000-C000-000000000046}"); + } + + public synchronized void activate(String CLSID) throws IOException { + assert this._registerID == 0L; + + assert Main.isMainThread(); + + if ((ActiveX.getDebugLevel() & 8) > 0) { + System.out.println(this + ": activating server as " + CLSID); + } + + this._registerID = this.nActivate(CLSID); + if ((ActiveX.getDebugLevel() & 8) > 0) { + System.out.println(this + ": successful"); + } + } + + public synchronized void deactivate() throws IOException { + assert this._registerID != 0L; + + assert Main.isMainThread(); + + if ((ActiveX.getDebugLevel() & 8) > 0) { + System.out.println(this + ": deactivating server"); + } + + this.nDeactivate(this._registerID); + } + + @Override + public synchronized void Release() throws OLEInvalidObjectException { + if (this._refs == 1 && this._registerID != 0L) { + if ((ActiveX.getDebugLevel() & 4) > 0) { + System.out.println(this + ": deactivating before Release"); + } + + try { + this.deactivate(); + } catch (IOException var2) { + System.out.println("DEBUG: " + this); + var2.printStackTrace(System.out); + + assert false; + } + + this._registerID = 0L; + } + + super.Release(); + } + + @Override + public String internalData() { + return "_registerID = " + this._registerID + ", " + super.internalData(); + } + + @Override + public String toString() { + return "IClassFactory(" + this.internalData() + ")"; + } + + public void register(String friendlyName, String CLSID, String VerIndProgID, String ProgID) { + try { + RegKey root = RegKey.getRootKey(0); + RegKey gammaKey = new RegKey(root, "world\\shell\\open\\command", 0); + String gammaPath = gammaKey.getStringValue(""); + int argIndx = gammaPath.indexOf(" \"%1\""); + gammaPath = gammaPath.substring(0, argIndx); + RegKey classKey = new RegKey(root, "CLSID\\" + CLSID, 2); + classKey.setStringValue("", friendlyName, false); + RegKey subKey = new RegKey(classKey, "LocalServer32", 2); + subKey.setStringValue("", gammaPath, false); + subKey.close(); + subKey = new RegKey(classKey, "ProgID", 2); + subKey.setStringValue("", ProgID, false); + subKey.close(); + subKey = new RegKey(classKey, "VersionIndependentProgID", 2); + subKey.setStringValue("", VerIndProgID, false); + subKey.close(); + classKey.close(); + RegKey verIndKey = new RegKey(root, VerIndProgID, 2); + verIndKey.setStringValue("", friendlyName, false); + subKey = new RegKey(verIndKey, "CLSID", 2); + subKey.setStringValue("", CLSID, false); + subKey.close(); + subKey = new RegKey(verIndKey, "CurVer", 2); + subKey.setStringValue("", ProgID, false); + subKey.close(); + verIndKey.close(); + RegKey progKey = new RegKey(root, ProgID, 2); + progKey.setStringValue("", friendlyName, false); + subKey = new RegKey(progKey, "CLSID", 2); + subKey.setStringValue("", CLSID, false); + subKey.close(); + progKey.close(); + } catch (RegKeyNotFoundException var13) { + System.out.println("Warning: System Registry not configured properly by Worlds."); + } + } + + private native long nActivate(String var1) throws IOException; + + private native void nDeactivate(long var1) throws IOException; +} diff --git a/NET/worlds/console/IDispatch.java b/NET/worlds/console/IDispatch.java new file mode 100644 index 0000000..858576b --- /dev/null +++ b/NET/worlds/console/IDispatch.java @@ -0,0 +1,42 @@ +package NET.worlds.console; + +import java.io.IOException; + +public class IDispatch extends IUnknown { + private static final String IID_IDispatch = "{00020400-0000-0000-C000-000000000046}"; + + public IDispatch(String svrID) throws IOException { + try { + this.init(svrID, "{00020400-0000-0000-C000-000000000046}"); + } catch (IOException var16) { + IUnknown tmpUnk = new IUnknown(svrID); + + try { + this.init(tmpUnk, "{00020400-0000-0000-C000-000000000046}"); + } catch (OLEInvalidObjectException var14) { + System.out.println("DEBUG: " + this); + + assert false; + } finally { + try { + tmpUnk.Release(); + } catch (OLEInvalidObjectException var13) { + System.out.println("DEBUG: " + this); + + assert false; + } + } + } + } + + public IDispatch(IUnknown pIUnknown) throws IOException, OLEInvalidObjectException { + super(pIUnknown, "{00020400-0000-0000-C000-000000000046}"); + } + + public native void Invoke(String var1); + + @Override + public String toString() { + return "IDispatch(" + this.internalData() + ")"; + } +} diff --git a/NET/worlds/console/IEWebControlImp.java b/NET/worlds/console/IEWebControlImp.java new file mode 100644 index 0000000..e06310a --- /dev/null +++ b/NET/worlds/console/IEWebControlImp.java @@ -0,0 +1,130 @@ +package NET.worlds.console; + +class IEWebControlImp extends WebControlImp { + private int nativeIEInstance; + private int m_hwnd; + private boolean detached; + + private native boolean nativeInit(int var1, boolean var2); + + private native void nativeDestroy(); + + private native void nativeSetURL(String var1, String var2); + + private native void nativeGoBack(); + + private native void nativeGoForward(); + + private native void nativeStop(); + + private native void nativeRefresh(); + + private native void nativeHome(); + + private native void nativePrint(int var1, int var2); + + private native void nativeResize(int var1, int var2, int var3, int var4); + + private native void nativeAddToolbar(); + + private native int nativeGetHWND(); + + public IEWebControlImp(int hwnd, boolean toolbar, boolean isBanner) throws NoWebControlException { + super(hwnd); + this.m_hwnd = hwnd; + this.nativeIEInstance = 0; + this.detached = false; + if (!this.nativeInit(hwnd, isBanner)) { + this.detached = true; + throw new NoWebControlException("Could not initialize IE control"); + } else { + if (toolbar) { + this.nativeAddToolbar(); + } + } + } + + @Override + public void finalize() { + this.detach(); + } + + @Override + public void renderTo(int dc) { + this.nativePrint(dc, this.m_hwnd); + } + + @Override + public boolean setURL(String pURL) { + pURL = processURL(pURL); + if (pURL == null) { + return false; + } else { + this.nativeSetURL(pURL, null); + return true; + } + } + + @Override + public boolean setURL(String pURL, String pPostData) { + pURL = processURL(pURL); + if (pURL == null) { + return false; + } else { + if (pPostData != null) { + pPostData = processURL(pPostData); + if (pPostData == null) { + return false; + } + } + + this.nativeSetURL(pURL, pPostData); + return true; + } + } + + @Override + public void detach() { + if (!this.detached) { + this.nativeDestroy(); + super.detach(); + this.nativeIEInstance = 0; + this.detached = true; + } + } + + @Override + public void resize(int w, int h, int xPer, int yPer) { + this.nativeResize(w, h, xPer, yPer); + } + + @Override + public void goBack() { + this.nativeGoBack(); + } + + @Override + public void goForward() { + this.nativeGoForward(); + } + + @Override + public void stop() { + this.nativeStop(); + } + + @Override + public void refresh() { + this.nativeRefresh(); + } + + @Override + public void home() { + this.nativeHome(); + } + + @Override + public int getHWND() { + return this.nativeGetHWND(); + } +} diff --git a/NET/worlds/console/INetscapeRegistry.java b/NET/worlds/console/INetscapeRegistry.java new file mode 100644 index 0000000..f7f78ee --- /dev/null +++ b/NET/worlds/console/INetscapeRegistry.java @@ -0,0 +1,18 @@ +package NET.worlds.console; + +import java.io.IOException; + +public class INetscapeRegistry extends IDispatch { + public INetscapeRegistry() throws IOException { + super("Netscape.Registry.1"); + } + + public native boolean RegisterViewer(String var1, String var2) throws IOException; + + public native boolean RegisterProtocol(String var1, String var2) throws IOException; + + @Override + public String toString() { + return "INetscapeRegistry(" + this.internalData() + ")"; + } +} diff --git a/NET/worlds/console/IUnknown.java b/NET/worlds/console/IUnknown.java new file mode 100644 index 0000000..3a80b20 --- /dev/null +++ b/NET/worlds/console/IUnknown.java @@ -0,0 +1,166 @@ +package NET.worlds.console; + +import java.io.IOException; + +public class IUnknown { + protected int _pInterface = 0; + protected int _refs = 0; + private static final String IID_IUnknown = "{00000000-0000-0000-c000-000000000046}"; + + public IUnknown() throws IOException { + } + + protected synchronized void init(int pInterface) throws IOException { + assert pInterface != 0; + + ActiveX.init(this); + this._pInterface = pInterface; + this._refs = 1; + } + + public IUnknown(String svrID) throws IOException { + if ((ActiveX.getDebugLevel() & 2) > 0) { + System.out.println(this + ": constructor: svrID = " + svrID); + } + + ActiveX.init(this); + + try { + try { + this._pInterface = ActiveX.getClassFClsID(svrID, "{00000000-0000-0000-c000-000000000046}"); + this._refs++; + } catch (IOException var3) { + this._pInterface = ActiveX.getClassFProgID(svrID, "{00000000-0000-0000-c000-000000000046}"); + this._refs++; + } + } catch (IOException var4) { + ActiveX.uninit(this); + throw var4; + } + + if ((ActiveX.getDebugLevel() & 2) > 0) { + System.out.println("IUnknown: constructed " + this); + } + } + + public IUnknown(String svrID, String intfID) throws IOException { + if ((ActiveX.getDebugLevel() & 2) > 0) { + System.out.println(this + ": constructor: svrID = " + svrID + ", intfID = " + intfID); + } + + this.init(svrID, intfID); + if ((ActiveX.getDebugLevel() & 2) > 0) { + System.out.println("IUnknown: constructed " + this); + } + } + + protected synchronized void init(String svrID, String intfID) throws IOException { + ActiveX.init(this); + + try { + try { + this._pInterface = ActiveX.getClassFClsID(svrID, intfID); + this._refs++; + } catch (IOException var4) { + this._pInterface = ActiveX.getClassFProgID(svrID, intfID); + this._refs++; + } + } catch (IOException var5) { + ActiveX.uninit(this); + throw var5; + } + } + + public IUnknown(IUnknown parent, String intfID) throws IOException, OLEInvalidObjectException { + if ((ActiveX.getDebugLevel() & 2) > 0) { + System.out.println(this + ": constructor: parent = " + parent + ", intfID = " + intfID); + } + + this.init(parent, intfID); + if ((ActiveX.getDebugLevel() & 2) > 0) { + System.out.println("IUnknown: constructed " + this); + } + } + + protected synchronized void init(IUnknown parent, String intfID) throws IOException, OLEInvalidObjectException { + assert parent != null; + + ActiveX.init(this); + + try { + this._pInterface = parent.QueryInterface(intfID); + this._refs = 1; + } catch (IOException var4) { + ActiveX.uninit(this); + throw var4; + } catch (OLEInvalidObjectException var5) { + ActiveX.uninit(this); + throw var5; + } + } + + public synchronized void Release() throws OLEInvalidObjectException { + if ((ActiveX.getDebugLevel() & 4) > 0) { + System.out.println(this + ": Releasing"); + } + + if (this._pInterface == 0) { + throw new OLEInvalidObjectException(); + } else { + if (this._pInterface != 0 && this._refs > 0) { + this.true_Release(); + } + + this._refs--; + if (this._refs == 0) { + this._pInterface = 0; + ActiveX.uninit(this); + } + } + } + + @Override + public void finalize() { + if (this._pInterface != 0) { + while (this._refs > 0) { + try { + this.Release(); + } catch (OLEInvalidObjectException var2) { + System.out.println("DEBUG: " + this); + + assert false; + } + } + } + } + + public synchronized void AddRef() throws OLEInvalidObjectException { + if ((ActiveX.getDebugLevel() & 4) > 0) { + System.out.println(this + ": AddingRef"); + } + + if (this._pInterface == 0) { + throw new OLEInvalidObjectException(); + } else { + this._refs++; + this.true_AddRef(); + } + } + + public native void true_AddRef(); + + public native int QueryInterface(String var1) throws IOException, OLEInvalidObjectException; + + public native void true_Release() throws OLEInvalidObjectException; + + protected native int getPtr() throws OLEInvalidObjectException; + + public String internalData() { + return "_pInterface=" + this._pInterface + ", _refs=" + this._refs; + } + + @Override + public String toString() { + return "IUnknown(" + this.internalData() + ")"; + } +} diff --git a/NET/worlds/console/IWebBrowserApp.java b/NET/worlds/console/IWebBrowserApp.java new file mode 100644 index 0000000..88451da --- /dev/null +++ b/NET/worlds/console/IWebBrowserApp.java @@ -0,0 +1,26 @@ +package NET.worlds.console; + +import java.io.IOException; + +public class IWebBrowserApp extends IUnknown { + public static final String CLSID_InternetExplorer = "{0002DF01-0000-0000-C000-000000000046}"; + public static final String IID_IWebBrowserApp = "{0002DF05-0000-0000-C000-000000000046}"; + + public IWebBrowserApp() throws IOException { + super("{0002DF01-0000-0000-C000-000000000046}", "{0002DF05-0000-0000-C000-000000000046}"); + } + + public IWebBrowserApp(IUnknown parent) throws IOException, OLEInvalidObjectException { + super(parent, "{0002DF05-0000-0000-C000-000000000046}"); + } + + public native void put_Visible(boolean var1); + + public native void put_StatusBar(boolean var1); + + public native void put_MenuBar(boolean var1); + + public native void Navigate(String var1); + + public native void Quit(); +} diff --git a/NET/worlds/console/IllegalPilotException.java b/NET/worlds/console/IllegalPilotException.java new file mode 100644 index 0000000..c4d8c8b --- /dev/null +++ b/NET/worlds/console/IllegalPilotException.java @@ -0,0 +1,12 @@ +package NET.worlds.console; + +public class IllegalPilotException extends Exception { + private static final long serialVersionUID = 421670050791293454L; + + IllegalPilotException(String s) { + super(s); + } + + IllegalPilotException() { + } +} diff --git a/NET/worlds/console/ImageButtons.java b/NET/worlds/console/ImageButtons.java new file mode 100644 index 0000000..b27f9e5 --- /dev/null +++ b/NET/worlds/console/ImageButtons.java @@ -0,0 +1,392 @@ +package NET.worlds.console; + +import NET.worlds.scape.FrameEvent; +import java.awt.Container; +import java.awt.Dimension; +import java.awt.Event; +import java.awt.Graphics; +import java.awt.PopupMenu; +import java.awt.Rectangle; +import java.awt.event.MouseEvent; + +public class ImageButtons extends ImageCanvas implements FramePart, DialogDisabled { + private static final long serialVersionUID = -1495360044843592740L; + protected static final int BLANK = 0; + protected static final int NORMAL = 1; + protected static final int CURSED = 2; + protected static final int DOWN = 3; + private static final int TITLE = 0; + private static final int BUTTON = 1; + private int width; + private int height; + private Dimension ghostImageDimension; + protected Rectangle[] buttons; + private int[] types; + private boolean background = false; + private int cursedButton = -1; + private int clickedButton = -1; + private boolean clickedButtonDown; + private ImageButtonsCallback handler; + private ImageButtonsCallback downUpHandler; + private PopupMenu menu; + private boolean isDialogDisabled; + + private void initEvents() { + this.enableEvents(16L); + this.enableEvents(32L); + } + + protected ImageButtons() { + this.buttons = new Rectangle[0]; + this.initEvents(); + } + + public ImageButtons(String imageName, int buttonWidth, int buttonHeight, ImageButtonsCallback handler) { + this(imageName, buttonWidth, intToInts(buttonHeight), handler); + } + + public ImageButtons(String imageName, Rectangle[] buttonRects, ImageButtonsCallback handler) { + super(imageName); + this.handler = handler; + this.background = true; + this.setHotspots(buttonRects); + this.initEvents(); + } + + public ImageButtons(String imageName, int buttonWidth, int[] buttonHeights, ImageButtonsCallback handler) { + super(imageName); + this.handler = handler; + this.buttons = new Rectangle[buttonHeights.length]; + this.types = new int[buttonHeights.length]; + int y = 0; + + for (int i = 0; i < buttonHeights.length; i++) { + int h = buttonHeights[i]; + int rh; + if (h > 0) { + rh = h; + this.types[i] = 1; + } else { + rh = -h; + this.types[i] = 0; + } + + this.buttons[i] = new Rectangle(0, y, buttonWidth, rh); + y += rh; + } + + this.ghostImageDimension = new Dimension(buttonWidth * 4, buttonHeights[0]); + this.initEvents(); + } + + public void setHandler(ImageButtonsCallback handler) { + this.handler = handler; + } + + public void setDownUpHandler(ImageButtonsCallback handler) { + this.downUpHandler = handler; + } + + protected void setBackground(boolean background) { + this.background = background; + } + + protected void setWidth(int width) { + this.width = width; + } + + protected void setHeight(int height) { + this.height = height; + } + + protected synchronized void setHotspots(Rectangle[] buttonRects) { + this.buttons = new Rectangle[buttonRects.length]; + this.types = new int[buttonRects.length]; + + for (int i = 0; i < buttonRects.length; i++) { + this.types[i] = 1; + this.buttons[i] = new Rectangle(buttonRects[i]); + } + + this.cursedButton = -1; + this.clickedButton = -1; + this.clickedButtonDown = false; + } + + @Override + public synchronized void paint(Graphics g) { + g.clipRect(0, 0, this.width, this.height); + if (this.background && this.image_ != null) { + g.drawImage(this.image_, -1 * this.width, 0, null); + } + + for (int i = 0; i < this.buttons.length; i++) { + int state = 1; + if (i == this.cursedButton) { + state = 2; + } + + if (i == this.clickedButton) { + state = this.clickedButtonDown ? 3 : 1; + } + + this.drawButton(g, i, state); + } + } + + @Override + public Dimension preferredSize() { + Dimension d = super.preferredSize(); + if (d.width == 0 && d.height == 0 && this.ghostImageDimension != null) { + d = this.ghostImageDimension; + } + + return new Dimension(this.width = d.width / 4, this.height = d.height); + } + + @Override + public Dimension minimumSize() { + return this.preferredSize(); + } + + @Override + public void processMouseMotionEvent(MouseEvent e) { + if (!this.isDialogDisabled) { + switch (e.getID()) { + case 503: + case 506: + this.buttonAction(e.getX(), e.getY(), e.getID()); + case 504: + case 505: + } + } + + super.processMouseEvent(e); + } + + @Override + public void processMouseEvent(MouseEvent e) { + if (!this.isDialogDisabled) { + switch (e.getID()) { + case 501: + case 502: + case 504: + case 505: + this.buttonAction(e.getX(), e.getY(), e.getID()); + case 503: + } + } + + super.processMouseEvent(e); + } + + @Override + public boolean mouseMove(Event e, int x, int y) { + return this.buttonAction(x, y, 503); + } + + @Override + public boolean mouseDown(Event e, int x, int y) { + return (e.modifiers & 12) != 0 ? false : this.buttonAction(x, y, 501); + } + + @Override + public boolean mouseUp(Event e, int x, int y) { + return (e.modifiers & 12) != 0 ? false : this.buttonAction(x, y, 502); + } + + @Override + public boolean mouseDrag(Event e, int x, int y) { + return this.buttonAction(x, y, 506); + } + + @Override + public boolean mouseEnter(Event e, int x, int y) { + return this.buttonAction(x, y, 504); + } + + @Override + public boolean mouseExit(Event e, int x, int y) { + return this.buttonAction(x, y, 505); + } + + @Override + public boolean handleEvent(Event event) { + return this.isDialogDisabled ? false : super.handleEvent(event); + } + + protected Graphics drawButton(Graphics g, int button, int state) { + if (button != -1) { + Rectangle r = this.buttons[button]; + if (this.image_ != null && (g != null || (g = this.getGraphics()) != null)) { + Graphics g1 = g.create(r.x, r.y, r.width, r.height); + g1.drawImage(this.image_, -state * this.width - r.x, -r.y, null); + g1.dispose(); + } + } + + return g; + } + + private synchronized boolean buttonAction(int x, int y, int action) { + return this.buttonAction(this.locateButton(x, y), action); + } + + private int locateButton(int x, int y) { + for (int i = 0; i < this.buttons.length; i++) { + if (this.types[i] == 1 && this.buttons[i].inside(x, y)) { + return i; + } + } + + return -1; + } + + public void drawFirstButton(int state) { + if (this.buttons.length > 0) { + Graphics g = this.drawButton(null, 0, state); + if (g != null) { + g.dispose(); + } + } + } + + public void drawNormal() { + this.drawFirstButton(1); + } + + public void drawCursed() { + this.drawFirstButton(2); + } + + public void drawDown() { + this.drawFirstButton(3); + } + + boolean buttonAction(int button, int action) { + Graphics g = null; + if (action != 503 && action != 504) { + if (action == 505) { + if (this.cursedButton != -1) { + g = this.drawButton(g, this.cursedButton, 1); + this.cursedButton = -1; + } + + if (this.downUpHandler == null && this.clickedButton != -1 && this.clickedButtonDown) { + g = this.drawButton(g, this.clickedButton, 1); + this.clickedButtonDown = false; + } + } else if (action == 501) { + if (this.clickedButton != -1) { + g = this.drawButton(g, this.clickedButton, 1); + if (this.downUpHandler != null) { + this.downUpHandler.imageButtonsCallback(this, -1); + } + + this.clickedButtonDown = false; + } + + if (this.cursedButton != -1) { + g = this.drawButton(g, this.cursedButton, 1); + this.cursedButton = -1; + } + + if ((this.clickedButton = button) != -1) { + g = this.drawButton(g, this.clickedButton, 3); + this.clickedButtonDown = true; + if (this.downUpHandler != null) { + this.downUpHandler.imageButtonsCallback(this, button); + } + } + } else if (action == 506) { + if (this.downUpHandler == null && 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 == 502) { + this.cursedButton = button; + if (this.cursedButton != -1) { + g = this.drawButton(g, this.cursedButton, 2); + } + + if (this.clickedButtonDown) { + if (this.cursedButton != this.clickedButton) { + g = this.drawButton(g, this.clickedButton, 1); + } + + Object ret = this.handler.imageButtonsCallback(this, this.clickedButton); + if (ret instanceof PopupMenu && this.clickedButton != -1) { + if (this.menu != null) { + this.remove(this.menu); + } + + this.add(this.menu = (PopupMenu)ret); + this.menu.show(this, this.buttons[this.clickedButton].x, this.buttons[this.clickedButton].y + this.buttons[this.clickedButton].height); + } + + if (this.downUpHandler != null && this.downUpHandler.imageButtonsCallback(this, -1) != null) { + this.cursedButton = -1; + } + + 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 (this.clickedButton != -1 && this.clickedButton != button && this.downUpHandler == null) { + g = this.drawButton(g, this.clickedButton, 1); + this.clickedButtonDown = false; + } + } + + if (g != null) { + g.dispose(); + } + + return true; + } + + public static int[] intToInts(int value) { + return new int[]{value}; + } + + @Override + public void activate(Console c, Container f, Console prev) { + } + + @Override + public void deactivate() { + } + + @Override + public boolean action(Event event, Object what) { + return false; + } + + @Override + public boolean handle(FrameEvent f) { + return false; + } + + @Override + public void dialogDisable(boolean disable) { + if (this.isDialogDisabled = disable) { + this.cursedButton = -1; + this.clickedButton = -1; + this.clickedButtonDown = false; + this.repaint(); + } + } +} diff --git a/NET/worlds/console/ImageButtonsCallback.java b/NET/worlds/console/ImageButtonsCallback.java new file mode 100644 index 0000000..4458803 --- /dev/null +++ b/NET/worlds/console/ImageButtonsCallback.java @@ -0,0 +1,7 @@ +package NET.worlds.console; + +import java.awt.Component; + +public interface ImageButtonsCallback { + Object imageButtonsCallback(Component var1, int var2); +} diff --git a/NET/worlds/console/ImageCanvas.java b/NET/worlds/console/ImageCanvas.java new file mode 100644 index 0000000..9610438 --- /dev/null +++ b/NET/worlds/console/ImageCanvas.java @@ -0,0 +1,193 @@ +package NET.worlds.console; + +import NET.worlds.network.URL; +import NET.worlds.scape.BGLoaded; +import NET.worlds.scape.BackgroundLoader; +import NET.worlds.scape.Room; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.Image; +import java.awt.MediaTracker; +import java.awt.Toolkit; + +public class ImageCanvas extends Component implements BGLoaded { + private static final long serialVersionUID = 1687513733496926512L; + protected URL imageURL_; + protected Image image_; + protected boolean loaded_; + protected Dimension dim_; + protected static final URL defaultImageURL = URL.make("home:..\\default.gif"); + + public ImageCanvas(URL inURL) { + this.setNewImage(inURL); + } + + protected ImageCanvas() { + } + + public ImageCanvas(String nm) { + this.loadImage(nm); + } + + private Image loadImage(String nm) { + this.imageURL_ = URL.make("home:" + nm); + this.image_ = this.loadLocalImage(this.imageURL_.unalias()); + if (this.image_ == null) { + this.imageURL_ = URL.make("home:..\\" + nm); + this.image_ = this.loadLocalImage(this.imageURL_.unalias()); + } + + if (this.image_ == null) { + this.setNewImage(URL.make(nm)); + } + + return this.image_; + } + + public void setNewImage(URL newImageURL, Graphics g) { + this.setNewImage(newImageURL); + } + + public void setNewImage(URL newImageURL) { + this.imageURL_ = newImageURL; + this.flushImage(); + this.loaded_ = false; + this.loadRemoteImage(); + } + + protected void flushImage() { + if (this.image_ != null) { + this.image_.flush(); + this.image_ = null; + } + } + + @Override + public void update(Graphics g) { + if (g != null) { + Dimension d = this.getSize(); + if (this.image_ == null || d.width > this.dim_.width || d.height > this.dim_.height) { + super.update(g); + } + + this.paint(g); + } + } + + @Override + public void paint(Graphics g) { + if (this.image_ != null && g != null) { + g.drawImage(this.image_, 0, 0, this); + } + } + + public void paint(Graphics g, int x, int y) { + if (this.image_ != null && g != null) { + g.drawImage(this.image_, x, y, this); + } + } + + public Dimension imageSize() { + if (this.image_ == null) { + this.dim_ = new Dimension(0, 0); + } else { + int width = this.image_.getWidth(this); + int height = this.image_.getHeight(this); + if (width != -1 && height != -1) { + this.dim_ = new Dimension(width, height); + } + } + + return this.dim_; + } + + @Override + public Object asyncBackgroundLoad(String localName, URL remoteURL) { + this.image_ = this.loadLocalImage(localName); + if (this.getGraphics() != null) { + this.update(this.getGraphics()); + } + + return localName; + } + + @Override + public boolean syncBackgroundLoad(Object obj, URL remoteURL) { + String localName = (String)obj; + this.image_ = this.loadLocalImage(localName); + if (this.getGraphics() != null) { + this.update(this.getGraphics()); + } + + return false; + } + + @Override + public Room getBackgroundLoadRoom() { + return null; + } + + private void loadRemoteImage() { + this.image_ = this.loadLocalImage(defaultImageURL.unalias()); + if (this.imageURL_ != defaultImageURL) { + BackgroundLoader.get(this, this.imageURL_); + } + } + + private Image loadLocalImage(String fName) { + Image image = Toolkit.getDefaultToolkit().getImage(fName); + MediaTracker tracker = new MediaTracker(this); + tracker.addImage(image, 0); + + try { + tracker.waitForAll(); + } catch (InterruptedException var5) { + } + + if (!tracker.isErrorAny()) { + this.loaded_ = true; + return image; + } else { + return null; + } + } + + public static Image loadImage(URL url, Component comp) { + Image image = Toolkit.getDefaultToolkit().getImage(url.unalias()); + MediaTracker tracker = new MediaTracker(comp); + tracker.addImage(image, 0); + + try { + tracker.waitForAll(); + } catch (InterruptedException var5) { + } + + return !tracker.isErrorAny() ? image : null; + } + + public static Image getSystemImage(String name, Component comp) { + for (int pass = 0; pass < 2; pass++) { + Image image = loadImage(URL.make("home:" + name), comp); + if (image != null) { + return image; + } + + if (pass == 0) { + name = "..\\" + name; + } + } + + return null; + } + + @Override + public Dimension preferredSize() { + return this.imageSize(); + } + + @Override + public Dimension minimumSize() { + return this.imageSize(); + } +} diff --git a/NET/worlds/console/InsetPanel.java b/NET/worlds/console/InsetPanel.java new file mode 100644 index 0000000..b22d0f6 --- /dev/null +++ b/NET/worlds/console/InsetPanel.java @@ -0,0 +1,30 @@ +package NET.worlds.console; + +import java.awt.Color; +import java.awt.Insets; +import java.awt.LayoutManager; +import java.awt.Panel; + +class InsetPanel extends Panel { + private static final long serialVersionUID = -8045587676805647253L; + private Insets insets; + + InsetPanel(LayoutManager layout, int top, int left, int bottom, int right) { + super(layout); + this.init(top, left, bottom, right); + } + + InsetPanel(int top, int left, int bottom, int right) { + this.init(top, left, bottom, right); + } + + private void init(int top, int left, int bottom, int right) { + this.insets = new Insets(top, left, bottom, right); + this.setBackground(Color.black); + } + + @Override + public Insets getInsets() { + return this.insets; + } +} diff --git a/NET/worlds/console/InternetConnectionDialog.java b/NET/worlds/console/InternetConnectionDialog.java new file mode 100644 index 0000000..66a3c7c --- /dev/null +++ b/NET/worlds/console/InternetConnectionDialog.java @@ -0,0 +1,79 @@ +package NET.worlds.console; + +import NET.worlds.network.Galaxy; +import NET.worlds.network.VarErrorException; +import java.awt.BorderLayout; +import java.awt.Button; +import java.awt.Event; +import java.awt.Font; +import java.awt.Panel; + +public class InternetConnectionDialog extends PolledDialog { + private static final long serialVersionUID = 612016940893432560L; + private String msg; + private Button okButton = new Button(Console.message("Retry")); + private Button cancelButton = new Button(Console.message("Single-user")); + private static boolean firstTimeDone; + private static boolean choseSingleUserMode; + private static Font bfont = new Font(Console.message("ButtonFont"), 0, 12); + + public static boolean isFirstTimeDone() { + return firstTimeDone; + } + + public static boolean choseSingleUserMode() { + return choseSingleUserMode; + } + + public InternetConnectionDialog(Galaxy galaxy, VarErrorException ve) { + super(Console.getFrame(), galaxy, Console.message("Internet-Connection"), true); + this.setAlignment(1); + this.msg = ve.getMsg().replace('\n', ' '); + this.ready(); + } + + @Override + protected boolean done(boolean confirmed) { + boolean ret = super.done(confirmed); + choseSingleUserMode = !confirmed; + firstTimeDone = true; + return ret; + } + + @Override + protected void build() { + this.setLayout(new BorderLayout()); + Panel txtPanel = new Panel(new BorderLayout()); + txtPanel.add("Center", new TextCanvas(this.msg, 400)); + txtPanel.add("North", new Filler(10, 10)); + txtPanel.add("South", new Filler(10, 10)); + txtPanel.add("East", new Filler(10, 10)); + txtPanel.add("West", new Filler(10, 10)); + this.add("Center", txtPanel); + Panel buttons = new Panel(); + this.okButton.setFont(bfont); + this.cancelButton.setFont(bfont); + buttons.add(this.okButton); + buttons.add(this.cancelButton); + this.add("South", buttons); + } + + @Override + public boolean action(Event event, Object what) { + Object target = event.target; + if (target == this.okButton) { + return this.done(true); + } else { + return target == this.cancelButton ? this.done(false) : false; + } + } + + @Override + public boolean keyDown(Event event, int key) { + if (key == 27) { + return this.done(false); + } else { + return key == 10 ? this.done(true) : super.keyDown(event, key); + } + } +} diff --git a/NET/worlds/console/InternetExplorer.java b/NET/worlds/console/InternetExplorer.java new file mode 100644 index 0000000..5a72487 --- /dev/null +++ b/NET/worlds/console/InternetExplorer.java @@ -0,0 +1,82 @@ +package NET.worlds.console; + +import NET.worlds.scape.CDAudio; +import NET.worlds.scape.WavSoundPlayer; +import java.io.IOException; + +public class InternetExplorer extends IUnknown implements MainCallback, MainTerminalCallback { + WebBrowser _parent; + + public InternetExplorer(WebBrowser parent) throws IOException { + ActiveX.init(this); + this._parent = parent; + this._refs = 1; + Main.register(this); + } + + @Override + public synchronized void Release() throws OLEInvalidObjectException { + if (this._refs > 0) { + this._refs--; + if (this._parent != null) { + this._parent.close(); + } + + ActiveX.uninit(this); + } + } + + @Override + public String toString() { + return "InternetExplorer(" + this.internalData() + ")"; + } + + @Override + public void mainCallback() { + boolean justActivated = Window.getActivated(); + if (justActivated) { + WebBrowser killMe = WebBrowser.findTag("sound:"); + if (killMe != null) { + killMe.close(); + } + + killMe = WebBrowser.findTag("videoMap:"); + if (killMe != null) { + killMe.close(); + } + + killMe = WebBrowser.findTag("videoAd:"); + if (killMe != null) { + killMe.close(); + } + + killMe = WebBrowser.findTag("zoom:"); + if (killMe != null) { + killMe.close(); + } + + killMe = WebBrowser.findTag("zoomLeft:"); + if (killMe != null) { + killMe.close(); + } + + killMe = WebBrowser.findTag("outside:"); + if (killMe != null) { + killMe.close(); + } + + try { + Thread.sleep(1L); + } catch (InterruptedException var4) { + } + + WavSoundPlayer.resumeSystem(); + CDAudio.get().setEnabled(true); + } + } + + @Override + public void terminalCallback() { + Main.unregister(this); + } +} diff --git a/NET/worlds/console/InventoryPart.java b/NET/worlds/console/InventoryPart.java new file mode 100644 index 0000000..a5e2997 --- /dev/null +++ b/NET/worlds/console/InventoryPart.java @@ -0,0 +1,30 @@ +package NET.worlds.console; + +import NET.worlds.scape.FrameEvent; +import java.awt.Container; +import java.awt.Event; +import java.awt.MenuItem; + +public class InventoryPart implements FramePart { + MenuItem inventoryItem; + + @Override + public void activate(Console c, Container f, Console prev) { + this.inventoryItem = c.addMenuItem(Console.message("Inventory") + "...", "File"); + } + + @Override + public void deactivate() { + this.inventoryItem = null; + } + + @Override + public boolean handle(FrameEvent f) { + return true; + } + + @Override + public boolean action(Event event, Object what) { + return false; + } +} diff --git a/NET/worlds/console/LanguageManager.java b/NET/worlds/console/LanguageManager.java new file mode 100644 index 0000000..c8fe072 --- /dev/null +++ b/NET/worlds/console/LanguageManager.java @@ -0,0 +1,163 @@ +package NET.worlds.console; + +import NET.worlds.core.Std; +import NET.worlds.network.ProgressDialog; +import NET.worlds.network.URL; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.Enumeration; +import java.util.Vector; +import java.util.zip.ZipEntry; +import java.util.zip.ZipFile; + +public class LanguageManager implements Runnable { + private String m_Name; + private String m_FinishName; + private int m_fSize; + + public static void handle(String name, int fSize, String finishName) { + LanguageManager lm = new LanguageManager(name, fSize, finishName); + Thread t = new Thread(lm); + t.setDaemon(true); + t.start(); + } + + public LanguageManager(String name, int fSize, String finishName) { + this.m_Name = name; + this.m_fSize = fSize; + this.m_FinishName = finishName; + } + + @Override + public void run() { + String fName = this.m_Name.substring(this.m_Name.lastIndexOf(47) + 1, this.m_Name.length()); + Console.println(Console.message("Downloading-update") + fName); + Vector names = new Vector(); + names.addElement(fName); + Vector urls = new Vector(); + urls.addElement(URL.make(this.m_Name)); + int now = Std.getFastTime(); + ProgressDialog progD = new ProgressDialog(this.m_fSize); + + try { + System.out.println("ProgressDialog start, now = " + now); + System.out.println("fName = " + fName + ", name = " + this.m_Name); + if (!progD.loadFiles(names, urls)) { + System.out.println("Can't load " + fName); + return; + } + + now = Std.getFastTime(); + System.out.println("ProgressDialog end, now = " + now); + } catch (IOException var7) { + System.out.println("Exception " + var7.toString() + " loading file " + fName); + } + + this.finishDownload(this.m_FinishName); + } + + public synchronized boolean finishDownload(String localName) { + String fType = localName.substring(localName.lastIndexOf(46), localName.length()); + System.out.println("Finished Downloading " + localName); + if (fType.equals(".EXE")) { + if (tryToRun(localName)) { + System.out.println(Console.message("Loading2") + localName); + } else { + Console.println(Console.message("Loading2") + localName + " " + Console.message("failed")); + } + } else if (fType.equals(".zip")) { + ZipFile langZip; + try { + langZip = new ZipFile(localName); + } catch (IOException var12) { + System.out.println("Error opening language file " + localName); + this.notify(); + return false; + } + + System.out.println("Expanding language file."); + Enumeration enums = langZip.entries(); + + while (enums.hasMoreElements()) { + ZipEntry ze = enums.nextElement(); + String filename = ze.getName(); + String langFile = filename; + String[] validExtensions = new String[]{".properties", ".jpg", ".bmp", ".gif"}; + boolean validFile = false; + + for (int idx = 0; idx < validExtensions.length; idx++) { + if (langFile.toString().endsWith(validExtensions[idx])) { + validFile = true; + break; + } + } + + if (validFile) { + this.CopyLangFile(langZip, ze, langFile); + System.out.println(langFile); + } + } + + try { + langZip.close(); + } catch (IOException var11) { + } + } + + this.notify(); + new OkCancelDialog(Console.getFrame(), null, Console.message("Alert"), null, Console.message("OK"), Console.message("Change-exit"), true); + return false; + } + + private void CopyLangFile(ZipFile langZip, ZipEntry ze, String langFile) { + InputStream is; + try { + is = langZip.getInputStream(ze); + } catch (IOException var11) { + return; + } + + FileOutputStream os; + try { + os = new FileOutputStream(langFile); + } catch (IOException var10) { + try { + is.close(); + } catch (IOException var8) { + } + + return; + } + + byte[] buffer = new byte[1024]; + + while (true) { + try { + int bytesRead = is.read(buffer); + if (bytesRead == -1) { + break; + } + + os.write(buffer, 0, bytesRead); + } catch (IOException var12) { + break; + } + } + + try { + is.close(); + os.close(); + } catch (IOException var9) { + } + } + + public static boolean tryToRun(String s) { + try { + Runtime.getRuntime().exec(s); + return true; + } catch (IOException var2) { + return false; + } + } +} diff --git a/NET/worlds/console/LocationDialog.java b/NET/worlds/console/LocationDialog.java new file mode 100644 index 0000000..468e544 --- /dev/null +++ b/NET/worlds/console/LocationDialog.java @@ -0,0 +1,94 @@ +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 LocationDialog extends PolledDialog { + private static final long serialVersionUID = -6550771504344935484L; + private Button okButton = new Button(Console.message("OK")); + private Button cancelButton = new Button(Console.message("Cancel")); + private Label label = new Label(Console.message("New-URL")); + private static Font font = new Font(Console.message("ButtonFont"), 0, 12); + private static Font gfont = new Font(Console.message("GammaTextFont"), 0, 12); + private TextField locationField; + + public LocationDialog(java.awt.Window parent, DialogReceiver receiver, String title, String location) { + super(parent, receiver, title, true); + this.locationField = new TextField(location, 40); + this.locationField.setFont(gfont); + this.ready(); + } + + public String getLocationURL() { + return this.locationField.getText(); + } + + @Override + protected void build() { + this.setBackground(Color.white); + GridBagLayout gbag = new GridBagLayout(); + this.setLayout(gbag); + GridBagConstraints c = new GridBagConstraints(); + c.weightx = 0.0; + c.weighty = 0.0; + c.gridheight = 1; + c.fill = 0; + c.anchor = 13; + c.gridwidth = 1; + this.label.setFont(font); + this.add(gbag, this.label, c); + c.weightx = 1.0; + c.weighty = 0.0; + c.gridwidth = 0; + c.fill = 2; + c.anchor = 17; + this.locationField.setFont(gfont); + this.add(gbag, this.locationField, c); + Panel buttons = new Panel(); + this.okButton.setFont(font); + this.cancelButton.setFont(font); + buttons.add(this.okButton); + buttons.add(this.cancelButton); + c.gridwidth = 0; + c.anchor = 10; + c.fill = 0; + this.add(gbag, buttons, c); + } + + @Override + public void show() { + super.show(); + this.locationField.requestFocus(); + } + + @Override + public boolean handleEvent(Event event) { + return event.id == 201 ? this.done(false) : super.handleEvent(event); + } + + @Override + public boolean action(Event event, Object what) { + Object target = event.target; + if (target == this.cancelButton) { + return this.done(false); + } else { + return target == this.okButton ? this.done(true) : false; + } + } + + @Override + public boolean keyDown(Event event, int key) { + if (key == 27) { + return this.done(false); + } else { + return key == 10 ? this.done(true) : super.keyDown(event, key); + } + } +} diff --git a/NET/worlds/console/LogFile.java b/NET/worlds/console/LogFile.java new file mode 100644 index 0000000..54fa2d4 --- /dev/null +++ b/NET/worlds/console/LogFile.java @@ -0,0 +1,218 @@ +package NET.worlds.console; + +import NET.worlds.core.IniFile; +import NET.worlds.core.Std; +import NET.worlds.core.SystemInfo; +import java.io.BufferedOutputStream; +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.PrintStream; +import java.text.DateFormat; +import java.util.Date; + +public class LogFile { + private static PrintStream out = null; + private static String baseName = null; + private static final String tempSuffix = ".open"; + private static final String mailSuffix = ".mail"; + private static final String noCloseTag = ", it terminated unexpectedly.\nPlease fill in the box below with an explanation of which\nfeatures you were exercising at the time, then click the\nReport button to automatically email the report to Worlds.\n"; + private static final String errorFoundTag = ", it generated a debugging log.\nPlease fill in the box below with an explanation of anything\nunusual that occurred (if anything), then click the Report\nbutton to automatically email the report to Worlds.\n"; + private static final String includeEmail = "Also, please include your email address.\n"; + private static String mailReason = "error encountered"; + private static String mailTag = ", it generated a debugging log.\nPlease fill in the box below with an explanation of anything\nunusual that occurred (if anything), then click the Report\nbutton to automatically email the report to Worlds.\n"; + private static final String iniFile = "worlds.ini"; + + public static void open() { + baseName = IniFile.gamma().getIniString("logfile", ""); + if (baseName.length() != 0) { + baseName = Gamma.earlyURLUnalias("home:" + baseName); + File f = new File(baseName + ".open"); + if (f.isFile()) { + if (scanFileForException(f)) { + mailReason = "logfile not closed--probable crash"; + mailTag = ", it terminated unexpectedly.\nPlease fill in the box below with an explanation of which\nfeatures you were exercising at the time, then click the\nReport button to automatically email the report to Worlds.\n"; + File mf = new File(baseName + ".mail"); + f.renameTo(mf); + mf = null; + } else { + f.delete(); + } + } + + f = new File(baseName); + if (f.isFile()) { + f.delete(); + } + + File var9 = null; + FileOutputStream FOout = null; + + try { + FOout = new FileOutputStream(baseName + ".open"); + } catch (IOException var6) { + System.out.println("Error opening logfile \"" + baseName + "\""); + return; + } + + out = new PrintStream(new BufferedOutputStream(FOout), true); + System.setOut(out); + System.setErr(out); + out.println("Logfile of " + DateFormat.getDateTimeInstance().format(new Date())); + out.println( + "Gamma " + + Std.getVersion() + + ":" + + "1890a40" + + ", build " + + Std.getBuildInfo() + + " of " + + DateFormat.getDateTimeInstance().format(new Date(Std.getBuildDate())) + ); + out.println("system info---------------------------------"); + SystemInfo.Record(out); + out.println("worlds.ini----------------------------------"); + + try { + String from = System.getProperty("file.encoding"); + InputStream in = new FileInputStream("worlds.ini"); + BufferedReader ini = new BufferedReader(new InputStreamReader(in, from)); + + for (String s = ini.readLine(); s != null; s = ini.readLine()) { + out.println(s); + } + + ini.close(); + } catch (IOException var7) { + } + + out.println("--------------------------------------------"); + } + } + + public static void close() { + if (out != null) { + out.println("Logfile closed."); + out.close(); + } + + File f = new File(baseName + ".open"); + if (scanFileForException(f)) { + File mf = new File(baseName + ".mail"); + f.renameTo(mf); + mf = null; + } else { + File nf = new File(baseName); + if (f.isFile()) { + f.renameTo(nf); + } + + nf = null; + } + + File var2 = null; + } + + public static void mailLogIfPresent(final String server) { + DialogReceiver rcvr = new DialogReceiver() { + @Override + public void dialogDone(Object who, boolean confirmed) { + LogMailDialog dlg = (LogMailDialog)who; + File f = new File(LogFile.baseName + ".mail"); + if (f.isFile()) { + if (confirmed) { + LogFile.sendCrashMail(server, f, LogFile.mailReason, dlg.getComment()); + } else { + f.delete(); + } + } + } + }; + File f = new File(baseName + ".mail"); + if (f.isFile()) { + String tag = "The last time you ran " + Std.getProductName() + mailTag; + if (IniFile.gamma().getIniString("LASTCHATNAME", "").length() == 0) { + new LogMailDialog(rcvr, tag + "Also, please include your email address.\n"); + } else { + new LogMailDialog(rcvr, tag); + } + } + } + + private static void sendCrashMail(String server, File logFile, String tagLine, String comment) { + MailMessage msg = new LogFileMailMessage(server, logFile); + + try { + if (tagLine != null) { + msg.appendBody(" (" + tagLine + ")"); + } + + msg.appendBody(".\n\n"); + if (comment != null) { + msg.appendBody("The user reports:\n"); + msg.appendParagraphs(comment); + msg.appendBody("\n\n"); + } + + msg.appendBody("The log file reads:\n\n"); + String from = System.getProperty("file.encoding"); + InputStream in = new FileInputStream(logFile); + BufferedReader log = new BufferedReader(new InputStreamReader(in, from)); + long fl = logFile.length(); + if (fl <= 64000L) { + for (String s = log.readLine(); s != null; s = log.readLine()) { + msg.appendBody(s + "\n"); + } + } else { + int lc = 0; + long cc = 0L; + + for (String s = log.readLine(); s != null && lc < 2048; s = log.readLine()) { + msg.appendBody(s + "\n"); + lc++; + cc += s.length(); + } + + msg.appendBody("-------------------------------------...\n"); + msg.appendBody(" Log file too long; skipping center\n"); + msg.appendBody("...-------------------------------------\n"); + log.skip(fl - (cc + 16030L)); + log.readLine(); + + for (String s = log.readLine(); s != null; s = log.readLine()) { + msg.appendBody(s + "\n"); + } + } + + log.close(); + } catch (IOException var14) { + System.out.println("Error writing logfile to mail note: " + var14); + } + + msg.send(); + } + + private static boolean scanFileForException(File logFile) { + try { + String from = System.getProperty("file.encoding"); + InputStream in = new FileInputStream(logFile); + BufferedReader log = new BufferedReader(new InputStreamReader(in, from)); + + for (String s = log.readLine(); s != null; s = log.readLine()) { + if (s.indexOf("\tat NET.worlds") != -1 || s.indexOf("\tat java.lang") != -1 || s.indexOf("\tat sun.awt") != -1) { + log.close(); + return true; + } + } + + log.close(); + } catch (IOException var5) { + } + + return false; + } +} diff --git a/NET/worlds/console/LogFileMailMessage.java b/NET/worlds/console/LogFileMailMessage.java new file mode 100644 index 0000000..af068bd --- /dev/null +++ b/NET/worlds/console/LogFileMailMessage.java @@ -0,0 +1,22 @@ +package NET.worlds.console; + +import java.io.File; + +class LogFileMailMessage extends MailMessage { + private static final String mailTo = "bugs@3dcd.com"; + private File logFile; + + LogFileMailMessage(String server, File logFile) { + super(server, "bugs@3dcd.com", "bugs@3dcd.com", "Gamma Log: Abnormal Termination", "A Gamma log with potential errors has been detected"); + this.logFile = logFile; + } + + @Override + protected void finished(boolean wasError) { + if (!wasError) { + this.logFile.delete(); + } else { + Console.println(Console.message("Error-mailing")); + } + } +} diff --git a/NET/worlds/console/LogMailDialog.java b/NET/worlds/console/LogMailDialog.java new file mode 100644 index 0000000..add5948 --- /dev/null +++ b/NET/worlds/console/LogMailDialog.java @@ -0,0 +1,57 @@ +package NET.worlds.console; + +import java.awt.GridBagConstraints; +import java.awt.TextArea; + +class LogMailDialog extends OkCancelDialog { + private static final long serialVersionUID = -6276776216084519247L; + private TextArea commentArea; + private String tagString; + + public LogMailDialog(DialogReceiver rcvr, String tag) { + super(Console.getFrame(), rcvr, Console.message("Log-Mailer"), Console.message("Dont-Report"), Console.message("Report"), null, false); + this.tagString = tag; + this.commentArea = new TextArea("", 5, 60, 1); + this.commentArea.setEditable(true); + this.setConfirmKey(-1); + } + + @Override + protected void build() { + GridBagConstraints c = new GridBagConstraints(); + if (this.tagString != null) { + c.weightx = 1.0; + c.weighty = 1.0; + c.gridwidth = 0; + this.add(this.gbag, new MultiLineLabel(this.tagString, 5, 5), c); + } + + c.weightx = 1.0; + c.weighty = 1.0; + c.gridwidth = 0; + this.add(this.gbag, this.commentArea, c); + int count = 0; + if (this.okButton != null) { + count++; + } + + if (this.cancelButton != null) { + count++; + } + + c.gridwidth = count; + c.weightx = 1.0; + c.weighty = 0.0; + if (this.okButton != null) { + this.add(this.gbag, this.okButton, c); + } + + if (this.cancelButton != null) { + this.add(this.gbag, this.cancelButton, c); + } + } + + public String getComment() { + return this.commentArea.getText(); + } +} diff --git a/NET/worlds/console/LoginWizard.java b/NET/worlds/console/LoginWizard.java new file mode 100644 index 0000000..60d6f69 --- /dev/null +++ b/NET/worlds/console/LoginWizard.java @@ -0,0 +1,941 @@ +package NET.worlds.console; + +import NET.worlds.core.IniFile; +import NET.worlds.core.Std; +import NET.worlds.network.Cache; +import NET.worlds.network.CacheFile; +import NET.worlds.network.Galaxy; +import NET.worlds.network.NetworkObject; +import NET.worlds.network.RemoteFileConst; +import NET.worlds.network.URL; +import NET.worlds.scape.SendURLAction; +import java.awt.Button; +import java.awt.CardLayout; +import java.awt.Checkbox; +import java.awt.Component; +import java.awt.Container; +import java.awt.Dimension; +import java.awt.Event; +import java.awt.Font; +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.awt.GridLayout; +import java.awt.Label; +import java.awt.Panel; +import java.awt.TextField; +import java.io.DataInputStream; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.text.MessageFormat; +import java.util.Enumeration; +import java.util.Random; +import java.util.Vector; + +public class LoginWizard extends PolledDialog implements DialogReceiver, DialogDisabled, RemoteFileConst { + private static final long serialVersionUID = -1951115972999605117L; + private static final int HAVE_USERS = 0; + private static final int ACCOUNT_TYPE = 1; + private static final int REGWAIT = 2; + private static final int WELCOME = 3; + private static final int CODEWORD_WAIT = 4; + private static final int NEW_USER_INFO = 5; + private static final int LOGGING_IN = 7; + private static final int NOT_LOGGED_IN = 8; + private static final int ERROR = 9; + private static final int CONNECTION_DIED = 10; + private static final int AUTO_LOGIN_FAILED = 11; + private static final int REGWAIT2 = 12; + private static final int BAD_PASSWORD = 13; + private static final int SCREEN_COUNT = 14; + private static final int STATE_GET_INFO = 0; + private static final int STATE_SEND_INFO = 1; + private static final int STATE_WAIT = 2; + private static final int STATE_AUTO_LOGIN = 3; + private static final int STATE_LOGGED_IN = 4; + private static final String defaultRegisterScriptL = "register" + Console.message(".pl"); + private static final String defaultRegisterScript = "register.pl"; + private static final String nameConstraints = Console.message("n-contain-letters"); + private static final String passwordConstraints1 = Console.message("p-contain-letters"); + private static final int oldMinPasswordLen = 4; + private static final int newMinPasswordLen = 6; + private static final String savePasswordText = Console.message("Remember-password"); + private static final String passwordMismatchText = Console.message("do-not-match"); + private static final String userNameIniKey = "User"; + private static final String passwordIniKey = "Password"; + private static final String serialNumIniKey = "SNum"; + private static final String handshakeIDIniKey = "handshakeID"; + private static final String defaultUserIniKey = "DefaultUser"; + static final int width = 480; + static final int height = 280; + static final int textWidth = 400; + private Galaxy galaxy; + private IniFile iniFile; + private CardLayout cardLayout = new CardLayout(); + private int currentScreen = -1; + private int lastScreen = -1; + private int loginFrom = -1; + private int errorFrom; + private Panel[] screens = new Panel[14]; + private boolean queryingServer; + private Button createNewUsernameButton; + private Button alternateBrowserButton; + private Button signInButton; + private Button noEmailButton; + private Button showRegButton; + private Button pwMailbackButtonKnown; + private Button typeUsername; + private TextField codewordField = null; + private TextField newUserName = null; + private TextField newPassword1 = null; + private TextField newPassword2 = null; + private TextField typedUsername = null; + private static Font font = new Font(Console.message("GammaTextFont"), 0, 12); + private static Font bfont = new Font(Console.message("ButtonFont"), 0, 12); + private TextField knownPassword = null; + private Checkbox savePassword = new Checkbox(savePasswordText, true); + private Vector users = new Vector(); + private Vector passwords = new Vector(); + private int defaultUser; + private String loginUserName; + private String loginPassword; + private String loginSerialNumber; + private String newSerialNumber; + private String newHandshakeID; + private int loginMode; + private int loginIndex = 0; + private int loginState; + private String errMsg; + private boolean isDialogDisabled; + private Component defComponent; + private int id; + private static boolean startUp = true; + private static boolean firstTimeDone; + private static int seq; + private CacheFile cf; + + public static boolean isFirstTimeDone() { + return firstTimeDone; + } + + public boolean safeToQueryServer() { + return this.queryingServer; + } + + public LoginWizard(Galaxy galaxy, IniFile iniFile) { + this(galaxy, iniFile, null); + } + + boolean isAnonServer() { + return this.galaxy.getGalaxyType() == 4 || this.galaxy.getGalaxyType() == 2; + } + + public LoginWizard(Galaxy galaxy, IniFile iniFile, String errMsg) { + super(Console.getFrame(), galaxy, "", false); + this.galaxy = galaxy; + this.iniFile = iniFile; + this.errMsg = errMsg; + this.id = seq++; + this.queryingServer = false; + int userNum = 0; + + while (true) { + String user = iniFile.getIniString("User" + userNum, ""); + if (user.length() == 0) { + this.defaultUser = iniFile.getIniInt("DefaultUser", 0); + this.newSerialNumber = iniFile.getIniString("SNum", ""); + if (this.newSerialNumber.length() == 0) { + this.newSerialNumber = null; + } + + this.newHandshakeID = iniFile.getIniString("handshakeID", ""); + if (this.newHandshakeID.length() == 0) { + this.newHandshakeID = null; + } + + this.setTitle(Console.message("Logging-in")); + this.setLayout(this.cardLayout); + this.loginState = 0; + if (errMsg != null) { + this.currentScreen = 10; + } else if (this.users.size() <= 0 && !this.isAnonServer() && IniFile.override().getIniInt("nocreateaccount", 0) != 1) { + this.setTitle(Console.message("Setting-Up-Acct")); + if (this.newSerialNumber == null) { + if (this.newHandshakeID == null) { + this.currentScreen = 1; + } else { + this.currentScreen = 12; + } + } else { + this.currentScreen = 5; + } + } else { + this.currentScreen = 0; + } + + startUp = false; + if (this.loginState != 3) { + this.disableParent(); + this.ready(); + } + + return; + } + + this.users.addElement(user); + this.passwords.addElement(Console.decode(iniFile.getIniString("Password" + userNum, ""))); + userNum++; + } + } + + public boolean waitingForConnection() { + return this.loginState == 3 || this.loginState == 2; + } + + public void setConnected() { + int oldState = this.loginState; + this.loginState = 4; + if (this.loginFrom != 0 || this.users.size() <= this.loginIndex) { + this.users.addElement(this.loginUserName); + this.passwords.addElement(null); + this.iniFile.setIniString("User" + this.loginIndex, this.loginUserName); + if (this.loginFrom == 5) { + this.iniFile.setIniString("SNum" + this.loginIndex, this.loginSerialNumber); + } + } + + boolean save = this.savePassword.getState(); + String pass = this.galaxy.getPassword(); + if (this.loginPassword != null + && pass != null + && (save != this.isPasswordSaved(this.loginIndex) || !pass.equals(this.passwords.elementAt(this.loginIndex)))) { + String val = save ? pass : null; + this.passwords.setElementAt(val, this.loginIndex); + this.iniFile.setIniString("Password" + this.loginIndex, Console.encode(val)); + } + + String name = this.galaxy.getChatname(); + String nameU = this.galaxy.getUsernameU(); + if (this.loginFrom != 5 && !name.equals(this.users.elementAt(this.loginIndex))) { + this.users.setElementAt(name, this.loginIndex); + this.iniFile.setIniString("User" + this.loginIndex, nameU); + } + + this.iniFile.setIniInt("DefaultUser", this.loginIndex); + this.defaultUser = this.loginIndex; + if (this.newSerialNumber != null) { + this.newHandshakeID = null; + this.newSerialNumber = null; + this.iniFile.setIniString("handshakeID", ""); + this.iniFile.setIniString("SNum", ""); + } + + if (this.loginFrom != 0) { + this.selectScreen(3); + } else if (oldState != 3) { + this.done(true); + } else { + assert Main.isMainThread(); + + this.galaxy.dialogDone(this, true); + firstTimeDone = true; + } + } + + public void loginError(String errMsg) { + this.removeScreen(8); + if (errMsg == null) { + errMsg = Console.message("Unknown-error"); + } + + this.errMsg = errMsg; + if (this.loginState == 3) { + this.currentScreen = 11; + this.disableParent(); + this.ready(); + } else { + if (this.loginFrom == -1) { + this.loginFrom = 0; + } + + this.selectScreen(8); + } + + this.loginState = 0; + } + + @Override + public void show() { + super.show(); + if (this.defComponent != null) { + this.defComponent.requestFocus(); + } + } + + @Override + public void dispose() { + super.dispose(); + } + + @Override + protected void activeCallback() { + if (this.loginState == 1) { + this.loginState = 2; + this.galaxy.setAuthInfo(this.loginUserName, null, this.loginPassword, null, this.loginSerialNumber, this.loginMode); + } + } + + @Override + protected void build() { + this.selectScreen(this.currentScreen); + } + + @Override + public Dimension size() { + return new Dimension(480, 280); + } + + private void selectScreen(int which) { + String name = "" + which; + if (this.screens[which] == null) { + this.add(name, this.screens[which] = this.buildScreen(which)); + } + + this.cardLayout.show(this, name); + if (this.lastScreen != which && this.lastScreen >= 0 && this.screens[this.lastScreen] != null) { + this.removeScreen(this.lastScreen); + } + + this.currentScreen = which; + this.lastScreen = which; + if (which == 2) { + new SendURLAction(this.getRegisterScriptName()).startBrowser(); + } else if (which == 4) { + new LoginWizard.AwaitCodeword(this.codewordField.getText()); + } + } + + private Panel buildScreen(int which) { + GridBagLayout gbag = new GridBagLayout(); + GridBagConstraints c = new GridBagConstraints(); + Panel p = new Panel(gbag); + c.weightx = 1.0; + c.weighty = 1.0; + c.gridwidth = 0; + switch (which) { + case 0: + return this.buildKnownUsersScreen(p, gbag, c); + case 1: + return this.buildAccountTypeScreen(p, gbag, c); + case 2: + return this.buildRegWait(p, gbag, c); + case 3: + return this.buildWelcome(p, gbag, c); + case 4: + return this.buildCodewordWaitScreen(p, gbag, c); + case 5: + return this.buildNewUserInfoScreen(p, gbag, c); + case 6: + default: + return null; + case 7: + return this.buildLoggingInScreen(p, gbag, c); + case 8: + case 9: + case 10: + case 11: + return this.buildErrorScreen(p, gbag, c, which); + case 12: + return this.buildRegWait2(p, gbag, c); + } + } + + private void removeScreen(int screen) { + if (this.screens[screen] != null) { + this.remove(this.screens[screen]); + this.screens[screen] = null; + } + } + + private void selectErrorScreen(String msg) { + this.errMsg = msg; + this.errorFrom = this.currentScreen; + this.selectScreen(9); + } + + private Panel buildKnownUsersScreen(Panel p, GridBagLayout gbag, GridBagConstraints c) { + this.typedUsername = new TextField(16); + this.knownPassword = new TextField(12); + this.knownPassword.setEchoChar('*'); + Panel tmp = new Panel(); + String enterText = Console.message("one-username"); + if (this.isAnonServer()) { + enterText = Console.message("a-username"); + } + + TextCanvas text = new TextCanvas(enterText, 400); + tmp.add(text); + add(p, tmp, gbag, c); + if (this.createNewUsernameButton == null) { + this.createNewUsernameButton = new Button(Console.message("Create-Username")); + } + + if (this.pwMailbackButtonKnown == null) { + this.pwMailbackButtonKnown = new Button(Console.message("Remind-Me")); + } + + if (this.defaultUser < this.users.size()) { + String pass = this.passwords.elementAt(this.defaultUser); + boolean knowPassword = pass != null; + this.knownPassword.setText(knowPassword ? pass : ""); + this.savePassword.setState(knowPassword); + this.typedUsername.setText(this.users.elementAt(this.defaultUser)); + } + + tmp = new Panel(new GridLayout(2, 2)); + Label uName = new Label(Console.message("Username"), 1); + uName.setFont(font); + this.typedUsername.setFont(font); + this.knownPassword.setFont(font); + tmp.add(uName); + tmp.add(this.typedUsername); + if (this.isAnonServer()) { + this.knownPassword.setText(Console.message("anonymous")); + add(p, tmp, gbag, c); + } else { + Label pWord = new Label(Console.message("Password"), 1); + pWord.setFont(font); + tmp.add(pWord); + tmp.add(this.knownPassword); + add(p, tmp, gbag, c); + this.savePassword.setFont(font); + add(p, this.savePassword, gbag, c); + } + + tmp = new Panel(); + String help = Console.message("youve-upgraded"); + if (this.iniFile.getIniString("AutoLogin", "").equals("") && this.iniFile.getIniString("User1", "").equals("")) { + help = ""; + } + + String instr = Console.message("first-time-user" + help); + if (this.isAnonServer()) { + instr = help; + } + + text = new TextCanvas(instr, 400); + tmp.add(text); + add(p, tmp, gbag, c); + if (!this.isAnonServer() && IniFile.override().getIniInt("nocreateaccount", 0) != 1) { + this.addButtons( + p, + gbag, + this.users.size() > 0 ? Console.message("Cancel") : "<< " + Console.message("Back"), + this.createNewUsernameButton, + this.pwMailbackButtonKnown, + Console.message("Sign-In") + ); + } else { + this.addButtons(p, gbag, Console.message("Cancel"), null, null, Console.message("Sign-In")); + } + + if (this.knownPassword.getText().length() == 0) { + if (this.typedUsername.getText().length() == 0) { + this.defComponent = this.typedUsername; + } else { + this.defComponent = this.knownPassword; + } + } + + return p; + } + + private void validateKnownUserInfo() { + if (this.acceptLoginUserName(this.typedUsername.getText()) && this.acceptLoginPassword(this.knownPassword.getText(), this.loginUserName, 4)) { + this.loginSerialNumber = null; + this.loginMode = 2; + this.loginIndex = 0; + this.doLogin(); + } + } + + private Panel buildAccountTypeScreen(Panel p, GridBagLayout gbag, GridBagConstraints c) { + TextCanvas text = new TextCanvas(Console.message("first-time-user2"), 400); + add(p, text, gbag, c); + if (this.alternateBrowserButton == null) { + this.alternateBrowserButton = new Button(Console.message("Alt-Browser")); + } + + if (this.signInButton == null) { + this.signInButton = new Button(Console.message("Sign-In")); + } + + return this.addButtons(p, gbag, Console.message("Cancel"), this.signInButton, this.alternateBrowserButton, Console.message("Next")); + } + + private Panel buildRegWaitCommon(Panel p, GridBagLayout gbag, GridBagConstraints c, int which) { + String start = ""; + if (which == 0) { + start = Console.message("registration"); + } + + TextCanvas text = new TextCanvas(start + Console.message("completed"), 400); + add(p, text, gbag, c); + Panel tmp = new Panel(new GridLayout()); + Label code = new Label(Console.message("Codeword"), 1); + code.setFont(font); + tmp.add(code); + this.codewordField = new TextField(10); + if (this.newSerialNumber != null) { + this.codewordField.setText(this.newSerialNumber); + } + + this.codewordField.setFont(font); + tmp.add(this.codewordField); + add(p, tmp, gbag, c); + String browserSpecific = new String(); + if (WebBrowser.isDisabled()) { + if (which == 0) { + browserSpecific = browserSpecific + Console.message("manually-view"); + } else { + browserSpecific = browserSpecific + Console.message("just-view"); + } + + browserSpecific = browserSpecific + this.getRegisterScriptName(); + } else { + browserSpecific = browserSpecific + Console.message("click-Back"); + } + + if (this.users.size() == 0) { + String ifText = Console.message("within-20"); + if (which == 1) { + ifText = Console.message("Show-Reg-Form1"); + } + + text = new TextCanvas(new String(ifText + browserSpecific), 400); + add(p, text, gbag, c); + } else if (which == 1) { + text = new TextCanvas(Console.message("Show-Reg-Form1"), 400); + add(p, text, gbag, c); + } + + if (this.noEmailButton == null) { + this.noEmailButton = new Button(Console.message("Didnt-Get-Email")); + } + + if (this.showRegButton == null) { + this.showRegButton = new Button(Console.message("Show-Reg-Form3")); + } + + Button showReg = which == 0 ? null : this.showRegButton; + return this.addButtons(p, gbag, "<< " + Console.message("Back"), showReg, this.noEmailButton, Console.message("Next") + " >>"); + } + + private Panel buildRegWait(Panel p, GridBagLayout gbag, GridBagConstraints c) { + return this.buildRegWaitCommon(p, gbag, c, 0); + } + + private Panel buildRegWait2(Panel p, GridBagLayout gbag, GridBagConstraints c) { + return this.buildRegWaitCommon(p, gbag, c, 1); + } + + private Panel buildWelcome(Panel p, GridBagLayout gbag, GridBagConstraints c) { + add(p, new Label(""), gbag, c); + Object[] arguments = new Object[]{new String(Std.getProductName())}; + add(p, new Label(MessageFormat.format(Console.message("Youre-signed"), arguments), 1), gbag, c); + Panel tmp = new Panel(); + TextCanvas text = new TextCanvas(Console.message("Use-arrow-keys2"), 400); + tmp.add(text); + add(p, tmp, gbag, c); + add(p, new Label(""), gbag, c); + return this.addButtons(p, gbag, null, null, null, Console.message("Enter-Worlds")); + } + + private static boolean isMadeOf(String test, String set) { + char[] testChars = test.toCharArray(); + + for (int i = 0; i < testChars.length; i++) { + if (set.indexOf(testChars[i]) == -1) { + return false; + } + } + + return true; + } + + private Panel buildCodewordWaitScreen(Panel p, GridBagLayout gbag, GridBagConstraints c) { + TextCanvas text = new TextCanvas(Console.message("Checking-codeword"), 400); + add(p, text, gbag, c); + return this.addButtons(p, gbag, Console.message("Cancel"), null, null, null); + } + + private Panel buildNewUserInfoScreen(Panel p, GridBagLayout gbag, GridBagConstraints c) { + this.newUserName = new TextField(16); + this.newPassword1 = new TextField(12); + this.newPassword2 = new TextField(12); + Object[] arguments = new Object[]{new String(Std.getProductName())}; + TextCanvas text = new TextCanvas(MessageFormat.format(Console.message("Enter-username"), arguments), 400); + text.setFont(font); + add(p, text, gbag, c); + Panel tmp = new Panel(); + tmp.setFont(font); + tmp.add(new Label(Console.message("Type-username"))); + tmp.add(this.newUserName); + add(p, tmp, gbag, c); + text = new TextCanvas(Console.message("Enter-password"), 400); + add(p, text, gbag, c); + tmp = new Panel(new GridLayout(2, 2)); + tmp.setFont(font); + tmp.add(new Label(Console.message("Type-password"), 1)); + this.newPassword1.setEchoChar('*'); + tmp.add(this.newPassword1); + tmp.add(new Label(Console.message("Re-type-password"), 1)); + this.newPassword2.setEchoChar('*'); + tmp.add(this.newPassword2); + add(p, tmp, gbag, c); + add(p, this.savePassword, gbag, c); + return this.addButtons( + p, gbag, this.newHandshakeID == null ? Console.message("Finish-Later") : "<< " + Console.message("Back"), null, null, Console.message("Next") + " >>" + ); + } + + private void validateNewUserInfo() { + if (this.acceptLoginUserName(this.newUserName.getText()) && this.acceptLoginPassword(this.newPassword1.getText(), this.newUserName.getText(), 6)) { + if (!this.loginPassword.equals(this.newPassword2.getText())) { + this.selectErrorScreen(passwordMismatchText); + } else { + this.loginMode = 1; + this.loginSerialNumber = this.newSerialNumber; + this.loginIndex = 0; + this.doLogin(); + } + } + } + + private Panel buildLoggingInScreen(Panel p, GridBagLayout gbag, GridBagConstraints c) { + Label logging = new Label(Console.message("Logging-in-wait")); + logging.setFont(font); + add(p, logging, gbag, c); + return p; + } + + private Panel buildErrorScreen(Panel p, GridBagLayout gbag, GridBagConstraints c, int which) { + this.errMsg = this.errMsg.replace('\n', ' ').replace('\t', '\n'); + TextCanvas text = new TextCanvas(this.errMsg, 400); + this.errMsg = null; + add(p, text, gbag, c); + return this.addButtons(p, gbag, which != 9 && which != 8 ? Console.message("Continue") : "<< " + Console.message("Back"), null, null, null); + } + + private boolean acceptLoginPassword(String password, String username, int minLength) { + if (FriendsListPart.isValidUserName(password) && password.length() >= minLength) { + this.loginPassword = password; + return true; + } else { + Object[] arguments = new Object[]{new String("" + minLength)}; + String text = Console.message("password-not-valid") + MessageFormat.format(passwordConstraints1, arguments); + this.selectErrorScreen(text); + return false; + } + } + + private boolean acceptLoginUserName(String name) { + if (!FriendsListPart.isValidUserName(name)) { + this.selectErrorScreen(Console.message("username-not-valid") + nameConstraints + " - " + name); + return false; + } else { + this.loginUserName = name; + return true; + } + } + + private void doLogin() { + this.loginFrom = this.currentScreen; + this.selectScreen(7); + this.loginState = 1; + } + + private boolean isPasswordSaved(int user) { + return user < this.passwords.size() && this.passwords.elementAt(user) != null; + } + + private static void add(Container cont, Component comp, GridBagLayout gbag, GridBagConstraints c) { + gbag.setConstraints(comp, c); + cont.add(comp); + } + + private Panel addButtons(Panel p, GridBagLayout gbag, String prev, Button mid1, Button mid2, String next) { + Panel buttons = new Panel(); + buttons.setFont(bfont); + if (prev != null) { + buttons.add(new BackButton(prev)); + } + + if (mid1 != null) { + buttons.add(mid1); + } + + if (mid2 != null) { + buttons.add(mid2); + } + + if (next != null) { + buttons.add(this.defComponent = new ForwardButton(next)); + } + + GridBagConstraints c = new GridBagConstraints(); + c.anchor = 14; + add(p, buttons, gbag, c); + return p; + } + + private String getScriptServer() { + Enumeration e = this.galaxy.getConsoles(); + + assert e.hasMoreElements(); + + this.queryingServer = true; + String ret = ((Console)e.nextElement()).getScriptServer(); + this.queryingServer = false; + System.out.println("Scriptserver is " + ret); + return ret; + } + + private String getRegisterScriptName() { + if (this.newHandshakeID == null) { + int id = new Random(((long)Startup.getVolumeInfo() << 30) + (int)(Math.random() * 1.0737418E9F)).nextInt(); + if (id < 0) { + id = -id; + } + + this.newHandshakeID = "" + id; + this.iniFile.setIniString("handshakeID", this.newHandshakeID); + } + + IniFile ini = IniFile.override(); + String url = ini.getIniString("register", ""); + if (url.equals("")) { + url = defaultRegisterScriptL; + if (Console.wasHttpNoSuchFile(url)) { + url = "register.pl"; + } + + ini = new IniFile("InstalledWorlds"); + String w = ini.getIniString("InstalledWorld0", ""); + if (!w.equals("")) { + String fn = URL.make("home:" + w + "/register.txt").unalias(); + DataInputStream in = null; + + try { + in = new DataInputStream(new FileInputStream(fn)); + String line = in.readLine(); + if (line != null) { + url = line; + } + } catch (IOException var15) { + } finally { + try { + if (in != null) { + in.close(); + } + } catch (IOException var14) { + } + } + } + } + + return new String(this.getScriptServer() + url + "?id=" + this.newHandshakeID); + } + + @Override + public boolean action(Event event, Object what) { + Object target = event.target; + if (target instanceof ForwardButton) { + if (this.currentScreen == 0) { + this.validateKnownUserInfo(); + } else if (this.currentScreen == 1) { + WebBrowser.setDisabled(false); + this.selectScreen(2); + } else if (this.currentScreen == 2 || this.currentScreen == 12) { + this.selectScreen(4); + } else if (this.currentScreen == 5) { + this.validateNewUserInfo(); + } else if (this.currentScreen == 3) { + this.done(true); + } + } else if (target instanceof BackButton) { + if (this.currentScreen == 0) { + if (this.users.size() > 0) { + this.done(false); + } else { + this.selectScreen(1); + } + } else if (this.currentScreen == 1) { + if (this.users.size() == 0) { + this.done(false); + } else { + this.selectScreen(0); + } + } else if (this.currentScreen == 2 || this.currentScreen == 12) { + this.selectScreen(this.users.size() > 0 ? 0 : 1); + } else if (this.currentScreen == 5) { + if (this.newSerialNumber != null && this.newSerialNumber.length() > 6 && this.newHandshakeID != null) { + this.selectScreen(12); + } else if (this.users.size() > 0) { + this.selectScreen(0); + } else { + this.done(false); + } + } else if (this.currentScreen == 4) { + if (this.cf != null) { + this.cf.close(); + } + + this.selectScreen(12); + } else if (this.currentScreen == 8) { + this.selectScreen(this.loginFrom); + } else if (this.currentScreen == 9) { + this.selectScreen(this.errorFrom); + } else if (this.currentScreen == 11 || this.currentScreen == 10) { + this.selectScreen(0); + } + } else if (target == this.pwMailbackButtonKnown) { + new SendURLAction(this.getScriptServer() + "emailback.pl", true).startBrowser(); + } else if (target == this.typedUsername) { + this.knownPassword.requestFocus(); + } else if (target == this.knownPassword) { + this.validateKnownUserInfo(); + } else if (target == this.createNewUsernameButton) { + String redir = IniFile.override().getIniString("CreateUserRedirect", "Fred"); + if (redir.equals("Fred")) { + if (this.newHandshakeID != null) { + this.selectScreen(12); + } else if (this.newSerialNumber == null) { + this.selectScreen(2); + } else { + this.selectScreen(5); + } + } else { + new SendURLAction(URL.make(redir)).startBrowser(); + } + } else if (target == this.alternateBrowserButton) { + WebBrowser.setDisabled(true); + this.selectScreen(2); + } else if (target == this.signInButton) { + this.selectScreen(0); + } else { + if (target != this.noEmailButton && target != this.showRegButton) { + return false; + } + + this.selectScreen(2); + } + + return true; + } + + @Override + public boolean keyDown(Event event, int key) { + if (key == 10) { + this.action(event, null); + return true; + } else { + return super.keyDown(event, key); + } + } + + @Override + public boolean handleEvent(Event event) { + if (this.isDialogDisabled) { + return false; + } else { + return event.id == 201 && this.loginState == 2 ? true : super.handleEvent(event); + } + } + + @Override + protected boolean done(boolean confirmed) { + boolean ret = super.done(confirmed); + firstTimeDone = true; + return ret; + } + + @Override + public void dialogDone(Object who, boolean confirmed) { + } + + @Override + public void dialogDisable(boolean disable) { + this.isDialogDisabled = disable; + super.dialogDisable(disable); + } + + @Override + public String toString() { + return "LoginWizard" + this.id; + } + + class AwaitCodeword extends Thread { + public AwaitCodeword(String cw) { + if (cw.length() > 6) { + LoginWizard.this.selectScreen(5); + LoginWizard.this.newSerialNumber = cw; + LoginWizard.this.iniFile.setIniString("SNum", LoginWizard.this.newSerialNumber); + } else { + LoginWizard.this.cf = Cache.getFile( + URL.make(LoginWizard.this.getScriptServer() + "codeword.pl?id=" + LoginWizard.this.newHandshakeID + "&codeword=" + cw) + ); + this.setDaemon(true); + this.start(); + } + } + + @Override + public void run() { + LoginWizard.this.cf.waitUntilLoaded(); + if (LoginWizard.this.cf.isActive()) { + if (LoginWizard.this.cf.error()) { + LoginWizard.this.currentScreen = 12; + LoginWizard.this.selectErrorScreen(Console.message("Error-accessing")); + } else { + DataInputStream in = null; + + label114: { + try { + in = new DataInputStream(new FileInputStream(LoginWizard.this.cf.getLocalName())); + String line = in.readLine(); + if (!line.startsWith("1,0,") && !line.startsWith("1,1,")) { + break label114; + } + + LoginWizard.this.newSerialNumber = line.substring(4); + LoginWizard.this.iniFile.setIniString("SNum", LoginWizard.this.newSerialNumber); + LoginWizard.this.newHandshakeID = null; + LoginWizard.this.iniFile.setIniString("handshakeID", ""); + LoginWizard.this.selectScreen(5); + LoginWizard.this.cf.close(); + } catch (FileNotFoundException var14) { + break label114; + } catch (IOException var15) { + break label114; + } finally { + try { + if (in != null) { + in.close(); + } + } catch (IOException var13) { + } + } + + return; + } + + LoginWizard.this.currentScreen = 12; + LoginWizard.this.selectErrorScreen(Console.message("codeword-no-match")); + } + + LoginWizard.this.cf.close(); + } + } + } +} diff --git a/NET/worlds/console/MailDialog.java b/NET/worlds/console/MailDialog.java new file mode 100644 index 0000000..95b976b --- /dev/null +++ b/NET/worlds/console/MailDialog.java @@ -0,0 +1,107 @@ +package NET.worlds.console; + +import java.awt.Component; +import java.awt.Font; +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.awt.Label; +import java.awt.TextArea; +import java.awt.TextField; +import java.util.StringTokenizer; + +class MailDialog extends OkCancelDialog { + private static final long serialVersionUID = -5118823076163262543L; + private TextField recipientField; + private TextField subjectField; + private TextArea bodyTextArea; + private static Font font = new Font(Console.message("ConsoleFont"), 0, 12); + + public MailDialog(Console console) { + super(Console.getFrame(), new MailDialogReceiver(console), Console.message("Mail"), Console.message("Dont-Send"), Console.message("Send"), null, false); + this.setConfirmKey(0); + this.recipientField = new TextField(); + this.recipientField.setFont(font); + this.subjectField = new TextField(); + this.subjectField.setFont(font); + this.bodyTextArea = new TextArea("", 5, 50, 1); + this.bodyTextArea.setEditable(true); + this.bodyTextArea.setFont(font); + this.setAlignment(1); + } + + public MailDialog(Console console, String recipient) { + this(console); + this.recipientField.setText(Console.parseExtended(recipient)); + this.recipientField.setFont(font); + } + + @Override + protected void build() { + GridBagConstraints c = new GridBagConstraints(); + int line = 0; + c.fill = 0; + c.anchor = 13; + this.add(this.gbag, new Label(Console.message("To")), c, 0, line, 1, 1, 0, 0); + c.fill = 2; + c.anchor = 17; + this.add(this.gbag, this.recipientField, c, 1, line, 3, 1, 100, 0); + line++; + c.fill = 0; + c.anchor = 13; + Label subjectLabel = new Label(Console.message("Subject")); + subjectLabel.setFont(font); + this.add(this.gbag, subjectLabel, c, 0, line, 1, 1, 0, 0); + c.fill = 2; + c.anchor = 17; + this.add(this.gbag, this.subjectField, c, 1, line, 3, 1, 100, 0); + line++; + c.anchor = 10; + c.fill = 1; + this.add(this.gbag, this.bodyTextArea, c, 0, line, 4, 1, 100, 100); + line++; + c.fill = 0; + if (this.okButton != null) { + this.okButton.setFont(font); + this.add(this.gbag, this.okButton, c, 1, line, 1, 1, 100, 0); + } + + if (this.cancelButton != null) { + this.cancelButton.setFont(font); + this.add(this.gbag, this.cancelButton, c, 2, line, 1, 1, 100, 0); + } + } + + private void add(GridBagLayout gbag, Component comp, GridBagConstraints cont, int x, int y, int w, int h, int wx, int wy) { + cont.gridx = x; + cont.gridy = y; + cont.gridwidth = w; + cont.gridheight = h; + cont.weightx = wx; + cont.weighty = wy; + this.add(gbag, comp, cont); + } + + public String[] getTo() { + Console console = Console.getActive(); + String toLine = this.recipientField.getText(); + StringTokenizer tokenizer = new StringTokenizer(toLine, ","); + String[] to = new String[tokenizer.countTokens()]; + + for (int i = 0; tokenizer.hasMoreTokens(); i++) { + to[i] = tokenizer.nextToken().trim(); + if (to[i].indexOf("@") == -1 && console != null) { + to[i] = to[i] + "@" + console.getMailDomain(); + } + } + + return to; + } + + public String getSubject() { + return this.subjectField.getText(); + } + + public String getBody() { + return this.bodyTextArea.getText(); + } +} diff --git a/NET/worlds/console/MailDialogReceiver.java b/NET/worlds/console/MailDialogReceiver.java new file mode 100644 index 0000000..4a403b1 --- /dev/null +++ b/NET/worlds/console/MailDialogReceiver.java @@ -0,0 +1,35 @@ +package NET.worlds.console; + +import java.awt.Font; + +class MailDialogReceiver implements DialogReceiver { + Console console; + private static Font font = new Font(Console.message("ConsoleFont"), 0, 12); + + public MailDialogReceiver(Console console) { + this.console = console; + } + + @Override + public void dialogDone(Object who, boolean confirmed) { + MailDialog dlg = (MailDialog)who; + dlg.setFont(font); + if (confirmed) { + String[] to = dlg.getTo(); + if (to.length > 0) { + MailMessage msg = new MailMessage( + this.console.getSmtpServer(), this.console.getLongID() + "@" + this.console.getMailDomain(), to[0], dlg.getSubject(), null + ); + + for (int i = 1; i < to.length; i++) { + msg.addCC(to[i]); + } + + msg.appendParagraphs(dlg.getBody()); + msg.send(); + } else { + Console.println(Console.message("No-recipient")); + } + } + } +} diff --git a/NET/worlds/console/MailMessage.java b/NET/worlds/console/MailMessage.java new file mode 100644 index 0000000..fbc5828 --- /dev/null +++ b/NET/worlds/console/MailMessage.java @@ -0,0 +1,297 @@ +package NET.worlds.console; + +import NET.worlds.network.DNSLookup; +import java.io.IOException; +import java.io.InputStream; +import java.io.PrintWriter; +import java.net.Socket; +import java.util.Enumeration; +import java.util.Vector; + +public class MailMessage extends Thread { + private String server; + private String from; + private String to; + private Vector cc; + private String subject; + private Vector body; + private boolean lock = false; + + public MailMessage(String server) { + this(server, null, null, null, null); + } + + public MailMessage(String server, String from, String to) { + this(server, from, to, null, null); + } + + public MailMessage(String server, String from, String to, String subject, String body) { + this.server = server; + this.from = from; + this.to = to; + this.cc = new Vector(); + this.subject = subject; + this.body = new Vector(); + if (body != null) { + this.body.addElement(body); + } + } + + public void setFrom(String f) { + if (!this.locked()) { + this.from = f; + } + } + + public void setTo(String t) { + if (!this.locked()) { + this.to = t; + } + } + + public void addCC(String c) { + if (!this.locked()) { + this.cc.addElement(c); + } + } + + public void setSubject(String s) { + if (!this.locked()) { + this.subject = s; + } + } + + public void setBody(String b) { + if (!this.locked()) { + this.body = new Vector(); + this.body.addElement(b); + } + } + + public void appendBody(String b) { + if (!this.locked()) { + this.body.addElement(b); + } + } + + public void appendParagraphs(String text, String sepStr, int lineLen) { + if (!this.locked()) { + String b = ""; + String white = ""; + String word = ""; + boolean startParagraph = false; + int len = 0; + + for (int i = 0; i < text.length(); i++) { + char c = text.charAt(i); + if (word.length() > 0 && Character.isWhitespace(c)) { + len += white.length() + word.length(); + if (len > lineLen) { + b = b + sepStr; + len = word.length(); + } else { + b = b + white; + } + + b = b + word; + word = ""; + white = ""; + } + + if (c != '\n' && c != '\r') { + startParagraph = false; + if (Character.isWhitespace(c)) { + white = white + c; + } else { + word = word + c; + } + } else if (!startParagraph) { + len = 0; + b = b + sepStr; + b = b + sepStr; + startParagraph = true; + } + } + + if (word.length() > 0) { + b = b + white; + b = b + word; + } + + this.body.addElement(b); + } + } + + public void appendParagraphs(String text) { + this.appendParagraphs(text, "\n", 70); + } + + private synchronized void lockMessage() { + this.lock = true; + } + + private synchronized void unlockMessage() { + this.lock = false; + } + + private synchronized boolean locked() { + return this.lock; + } + + protected void finished(boolean wasError) { + } + + public void send() { + this.start(); + } + + @Override + public void run() { + this.lockMessage(); + this.from = Console.parseUnicode(this.from); + this.to = Console.parseUnicode(this.to); + this.cc = Console.parseUnicode(this.cc); + this.subject = Console.parseUnicode(this.subject); + this.body = Console.parseUnicode(this.body); + boolean wasError = !sendNote(this.server, this.from, this.to, this.cc, this.subject, this.body); + this.unlockMessage(); + this.finished(wasError); + } + + public static synchronized boolean sendNote(String server, String from, String to, Vector cc, String subject, Vector body) { + int port = 25; + int cindex = server.indexOf(58); + if (cindex != -1) { + port = Integer.parseInt(server.substring(cindex + 1)); + server = server.substring(0, cindex); + } + + Socket smtpSocket = null; + + label123: { + try { + smtpSocket = new Socket(DNSLookup.lookup(server), port); + InputStream smtpIn = smtpSocket.getInputStream(); + PrintWriter smtpOut = new PrintWriter(smtpSocket.getOutputStream()); + if (getReply(smtpIn) + && print(smtpOut, "HELO worlds.net\r\n") + && getReply(smtpIn) + && print(smtpOut, "MAIL FROM:<" + from + ">\r\n") + && getReply(smtpIn) + && print(smtpOut, "RCPT TO:<" + to + ">\r\n") + && getReply(smtpIn) + && printCCcmd(smtpOut, smtpIn, cc) + && print(smtpOut, "DATA\r\n") + && getReply(smtpIn) + && print(smtpOut, "MIME-Version: 1.0\r\n") + && print(smtpOut, "MContent-Type: text/plain; charset=\"us-ascii\"\r\n") + && print(smtpOut, "From: " + from + "\r\n") + && print(smtpOut, "To: " + to + "\r\n") + && printCCline(smtpOut, cc) + && print(smtpOut, "Subject: " + subject + "\r\n\r\n") + && print(smtpOut, body) + && print(smtpOut, "\r\n.\r\n")) { + getReply(smtpIn); + } + break label123; + } catch (IOException var19) { + System.out.println("Error communicating with mail server: " + var19); + } finally { + try { + if (smtpSocket != null) { + smtpSocket.close(); + } + } catch (IOException var18) { + } + } + + return false; + } + + System.out.println("MailMessage.sendNote: complete."); + return true; + } + + private static boolean print(PrintWriter out, String text) { + out.print(text); + return !out.checkError(); + } + + private static boolean print(PrintWriter out, Vector text) { + int size = text.size(); + + for (int i = 0; i < size; i++) { + out.print(text.elementAt(i)); + if (out.checkError()) { + return false; + } + } + + return true; + } + + private static boolean printCCcmd(PrintWriter out, InputStream in, Vector cc) { + if (cc.size() > 0) { + Enumeration en = cc.elements(); + + while (en.hasMoreElements()) { + String rcp = en.nextElement(); + if (!print(out, "RCPT TO:<" + rcp + ">\r\n")) { + return false; + } + + if (!getReply(in)) { + return false; + } + } + } + + return true; + } + + private static boolean printCCline(PrintWriter out, Vector cc) { + int num = cc.size(); + if (num > 0) { + if (!print(out, "cc: ")) { + return false; + } + + Enumeration en = cc.elements(); + + while (en.hasMoreElements()) { + String rcp = en.nextElement(); + if (num-- > 1) { + rcp = rcp + ", "; + } + + if (!print(out, rcp)) { + return false; + } + } + + if (!print(out, "\r\n")) { + return false; + } + } + + return true; + } + + private static boolean getReply(InputStream in) { + try { + int result; + while ((result = in.read()) >= 0 && result != 10) { + } + + return true; + } catch (IOException var2) { + return false; + } + } + + public static void main(String[] args) { + Vector body = new Vector(); + body.addElement("Looks like it worked...\n"); + sendNote("www.3dcd.com:25", "Gamma Mail Service", "thumper@alumni.caltech.edu", new Vector(), "this is a test", body); + } +} diff --git a/NET/worlds/console/Main.java b/NET/worlds/console/Main.java new file mode 100644 index 0000000..49f89bd --- /dev/null +++ b/NET/worlds/console/Main.java @@ -0,0 +1,93 @@ +package NET.worlds.console; + +import NET.worlds.core.IniFile; +import NET.worlds.core.Std; +import java.util.Vector; + +public class Main { + public static int profile = IniFile.gamma().getIniInt("Profile", 0); + private static Thread mainThread; + private static boolean stopFlag = false; + private static Vector v = new Vector(); + private static int lastAt = -1; + + private Main() { + } + + public static void mainLoop() { + for (mainThread = Thread.currentThread(); !stopFlag; Thread.yield()) { + MainCallback cb = getNextCallback(); + if (cb != null) { + if (profile != 0) { + int start = Std.getRealTime(); + long startBytes = Runtime.getRuntime().freeMemory(); + cb.mainCallback(); + int dur = Std.getRealTime() - start; + long used = startBytes - Runtime.getRuntime().freeMemory(); + if (dur > profile && !(cb instanceof Console)) { + System.out.println("Took " + dur + "ms and " + used + " bytes to call mainCallback " + cb); + } + } else { + cb.mainCallback(); + } + } + } + + MainCallback cb; + while ((cb = getNextCallback()) != null) { + if (cb instanceof MainTerminalCallback) { + ((MainTerminalCallback)cb).terminalCallback(); + Thread.yield(); + } else { + unregister(cb); + } + } + + mainThread = null; + } + + public static void end() { + stopFlag = true; + } + + public static boolean isMainThread() { + return Thread.currentThread() == mainThread; + } + + public static int queueLength() { + return v.size(); + } + + private static MainCallback getNextCallback() { + synchronized (v) { + int n = v.size(); + MainCallback cb; + if (n == 0) { + lastAt = -1; + cb = null; + } else { + if (++lastAt >= n) { + lastAt = 0; + } + + cb = v.elementAt(lastAt); + } + + return cb; + } + } + + public static void register(MainCallback x) { + v.addElement(x); + } + + public static void unregister(MainCallback x) { + synchronized (v) { + int i = v.indexOf(x); + v.removeElementAt(i); + if (lastAt >= i) { + lastAt--; + } + } + } +} diff --git a/NET/worlds/console/MainCallback.java b/NET/worlds/console/MainCallback.java new file mode 100644 index 0000000..37deb6d --- /dev/null +++ b/NET/worlds/console/MainCallback.java @@ -0,0 +1,5 @@ +package NET.worlds.console; + +public interface MainCallback { + void mainCallback(); +} diff --git a/NET/worlds/console/MainTerminalCallback.java b/NET/worlds/console/MainTerminalCallback.java new file mode 100644 index 0000000..fc07fa9 --- /dev/null +++ b/NET/worlds/console/MainTerminalCallback.java @@ -0,0 +1,5 @@ +package NET.worlds.console; + +public interface MainTerminalCallback { + void terminalCallback(); +} diff --git a/NET/worlds/console/MapFrame.java b/NET/worlds/console/MapFrame.java new file mode 100644 index 0000000..184afce --- /dev/null +++ b/NET/worlds/console/MapFrame.java @@ -0,0 +1,19 @@ +package NET.worlds.console; + +import java.awt.FlowLayout; +import java.awt.Frame; + +public class MapFrame extends Frame { + private static final long serialVersionUID = 1756423575260176209L; + MapTile mp; + + public MapFrame() { + super(Console.message("Map-Tile")); + this.setLayout(new FlowLayout()); + this.mp = new MapTile(); + this.add(this.mp); + this.resize(325, 300); + this.validate(); + this.show(); + } +} diff --git a/NET/worlds/console/MapPart.java b/NET/worlds/console/MapPart.java new file mode 100644 index 0000000..76188fe --- /dev/null +++ b/NET/worlds/console/MapPart.java @@ -0,0 +1,234 @@ +package NET.worlds.console; + +import NET.worlds.network.URL; +import NET.worlds.scape.BGLoaded; +import NET.worlds.scape.BackgroundLoader; +import NET.worlds.scape.FrameEvent; +import NET.worlds.scape.Pilot; +import NET.worlds.scape.Room; +import NET.worlds.scape.SendURLAction; +import NET.worlds.scape.TeleportAction; +import NET.worlds.scape.World; +import java.awt.Component; +import java.awt.Container; +import java.awt.Dimension; +import java.awt.Event; +import java.awt.Graphics; +import java.awt.Rectangle; +import java.io.DataInputStream; +import java.io.FileInputStream; +import java.io.IOException; +import java.util.StringTokenizer; + +public class MapPart extends ImageButtons implements FramePart, ImageButtonsCallback, BGLoaded { + private static final long serialVersionUID = 1886153221201046188L; + private static final int width = 158; + private static final int height = 124; + private URL lastURL; + private URL mapURL; + private URL infURL; + private int filesLoaded; + private Rectangle[] hotspots; + private String[] names; + private String[] locations; + private int cursedButton; + private DefaultConsole console; + + public MapPart() { + this.setHandler(this); + this.setBackground(true); + this.setWidth(158); + this.setHeight(124); + } + + private synchronized void changeURL(URL url) { + this.lastURL = url; + String path = url.getAbsolute(); + path = path.substring(0, path.lastIndexOf(46)); + this.filesLoaded = 0; + this.setHotspots(new Rectangle[0]); + this.console.exploreButton.setVisible(true); + this.console.relayoutMap(); + this.locations = null; + this.repaint(); + BackgroundLoader.get(this, this.mapURL = URL.make(path + "-map.gif"), true); + BackgroundLoader.get(this, this.infURL = URL.make(path + "-map.inf"), true); + } + + private boolean readInfo(String localName) { + DataInputStream in = null; + + try { + in = new DataInputStream(new FileInputStream(localName)); + + String line; + for (int item = -1; (line = in.readLine()) != null; item++) { + line = line.trim(); + if (item == -1) { + int count = Integer.parseInt(line); + this.hotspots = new Rectangle[count]; + this.names = new String[count]; + this.locations = new String[count]; + } else { + StringTokenizer tok = new StringTokenizer(line); + this.hotspots[item] = new Rectangle( + Integer.parseInt(tok.nextToken()), Integer.parseInt(tok.nextToken()), Integer.parseInt(tok.nextToken()), Integer.parseInt(tok.nextToken()) + ); + this.names[item] = tok.nextToken().replace('_', ' '); + this.locations[item] = tok.nextToken(); + + while (tok.hasMoreTokens()) { + this.locations[item] = this.locations[item] + " " + tok.nextToken(); + } + } + } + + return true; + } catch (Exception var14) { + } finally { + try { + if (in != null) { + in.close(); + } + } catch (IOException var13) { + } + } + + return false; + } + + private int hasLink(String name) { + if (this.locations != null) { + for (int i = 0; i < this.locations.length; i++) { + if (name.equals(this.locations[i])) { + return i; + } + } + } + + return -1; + } + + @Override + public synchronized void paint(Graphics g) { + if (this.filesLoaded == 2) { + super.paint(g); + } + } + + @Override + public synchronized boolean handleEvent(Event event) { + return super.handleEvent(event); + } + + @Override + public Dimension preferredSize() { + return new Dimension(158, 124); + } + + @Override + protected Graphics drawButton(Graphics g, int button, int state) { + Graphics ret = super.drawButton(g, button, state); + if (state == 2 || state == 3) { + this.cursedButton = button; + if (button != -1 && this.console != null) { + this.console.overrideStatusMsg(this.names[button]); + } + } else if (state == 1 && button == this.cursedButton) { + this.cursedButton = -1; + if (this.console != null) { + this.console.overrideStatusMsg(null); + } + } + + return ret; + } + + @Override + public synchronized Object imageButtonsCallback(Component who, int which) { + String loc = this.locations[which]; + if (loc.startsWith("pnm:")) { + new SendURLAction(loc).startBrowser(); + return null; + } else if (loc.equals("system:universe")) { + this.console.toggleUniverseMode(); + return null; + } else { + if (loc.charAt(0) == '-') { + loc = loc.substring(1); + } else { + loc = this.lastURL.getAbsolute() + "#" + loc; + } + + TeleportAction.teleport(loc, null); + return null; + } + } + + @Override + public void activate(Console c, Container f, Console prev) { + this.console = (DefaultConsole)c; + } + + @Override + public void deactivate() { + } + + @Override + public synchronized boolean handle(FrameEvent f) { + Pilot pilot = Pilot.getActive(); + if (pilot != null) { + World world = pilot.getWorld(); + if (world != null) { + URL sourceURL = world.getSourceURL(); + if (sourceURL != this.lastURL && sourceURL != null) { + this.changeURL(sourceURL); + } + } + } + + return true; + } + + @Override + public Object asyncBackgroundLoad(String localName, URL remoteURL) { + boolean success = false; + if (localName != null) { + if (remoteURL == this.mapURL) { + this.image_ = loadImage(URL.make(localName), this); + success = this.image_ != null; + if (success) { + this.setWidth(this.image_.getWidth(null) / 4); + this.setHeight(this.image_.getHeight(null)); + } + } else { + success = this.readInfo(localName); + if (this.hasLink("system:universe") >= 0) { + this.console.exploreButton.hide(); + this.console.relayoutMap(); + } + } + } + + if (success) { + synchronized (this) { + if (++this.filesLoaded == 2) { + this.setHotspots(this.hotspots); + this.repaint(); + } + } + } + + return null; + } + + @Override + public boolean syncBackgroundLoad(Object obj, URL remoteURL) { + return false; + } + + @Override + public Room getBackgroundLoadRoom() { + return null; + } +} diff --git a/NET/worlds/console/MapTile.java b/NET/worlds/console/MapTile.java new file mode 100644 index 0000000..672f893 --- /dev/null +++ b/NET/worlds/console/MapTile.java @@ -0,0 +1,7 @@ +package NET.worlds.console; + +import java.awt.Canvas; + +public class MapTile extends Canvas { + private static final long serialVersionUID = -7698366766402434599L; +} diff --git a/NET/worlds/console/MoreFriendsDialog.java b/NET/worlds/console/MoreFriendsDialog.java new file mode 100644 index 0000000..29c7f01 --- /dev/null +++ b/NET/worlds/console/MoreFriendsDialog.java @@ -0,0 +1,159 @@ +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.List; +import java.awt.Menu; +import java.awt.MenuItem; +import java.util.Vector; + +class MoreFriendsDialog extends PolledDialog { + private static final long serialVersionUID = -2543183536371825585L; + private List listbox = new List(10); + private Button cancelButton = new Button(Console.message("Close")); + private FriendsListPart friends; + private Menu menu; + private Vector