コード例 #1
0
ファイル: UO.cs プロジェクト: byterj/phoenix
        public static void Info()
        {
            IClientTarget target = UIManager.Target();

            if (target.Serial != 0)
            {
                Info(target.Serial);
            }
            else
            {
                string name = null;
                if (target.Graphic != 0 && target.Graphic < DataFiles.Tiledata.Count)
                {
                    name = DataFiles.Tiledata.GetArt(target.Graphic).Name;
                }

                string format = "Tile X={0} Y={1} Z={2} Graphic=0x{3:X4}";
                if (name != null && name.Length > 0)
                {
                    format += " Name={4}";
                }

                Notepad.WriteLine(format, target.X, target.Y, target.Z, target.Graphic, name);
                Notepad.WriteLine();
            }
        }
コード例 #2
0
ファイル: UO.cs プロジェクト: byterj/phoenix
        public static void Info(Serial serial)
        {
            UOObject obj = World.GetObject(serial);

            if (obj.Exist)
            {
                Notepad.WriteLine(obj.Description);
                Notepad.WriteLine();
            }
        }
コード例 #3
0
        internal static void Initialize()
        {
            if (initialized)
            {
                throw new InvalidProgramException();
            }
            initialized = true;

            System.Windows.Forms.Application.EnableVisualStyles();
            System.Windows.Forms.Application.SetCompatibleTextRenderingDefault(false);

            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
            AppDomain.CurrentDomain.AssemblyResolve    += new ResolveEventHandler(CurrentDomain_AssemblyResolve);

            Core.LoginComplete += new EventHandler(Core_LoginComplete);
            Core.Disconnected  += new EventHandler(Core_Disconnected);

            launchData = LaunchData.FromCmdLine(System.Environment.CommandLine);

            clientThreadId = Thread.CurrentThread.ManagedThreadId;

            SetInitEvent();
            InitLogging();

            // TODO: Set security

            try {
                culture = CultureInfo.GetCultureInfo(launchData.Culture);
            }
            catch (Exception e) {
                culture = CultureInfo.GetCultureInfo("en-US");
                ExceptionDialog.Show(e, "Error creating requested culture.");
            }

            Thread.CurrentThread.CurrentCulture   = culture;
            Thread.CurrentThread.CurrentUICulture = culture;

            System.Windows.Forms.Control.CheckForIllegalCrossThreadCalls = true;

            if (!clientKeys.Load())
            {
                ShowMessageBoxAsync("Unknown Client. Please use the same account and password you specified in launcher.", "Information");
            }
            spellList = new SpellList();

            Config.InternalSettings.Path = Path.Combine(launchData.PhoenixDir, SettingsFile);

            Config.Init();
            Config.Profile.ProfileChanged += new EventHandler(Profile_ProfileChanged);

            guiThread = new PhoenixGuiThread();

            // Run DataFiles.Load in different thread.
            Thread loadDataFilesThread = new Thread(new ParameterizedThreadStart(DataFiles.Load));

            loadDataFilesThread.Start(launchData.UltimaDir);

            Phoenix.Logging.JournalHandler.Init();
            Notepad.Init();
            Phoenix.Runtime.ReportViewer.Init();
            Journal.Init();
            WorldPacketHandler.Init();
            Aliases.Init();
            LoginInfo.Init();
            UIManager.Init();
            SpeechColorOverride.Init();
            Phoenix.Runtime.ClientMessageHandler.Init();
            Phoenix.Runtime.RuntimeCore.Hotkeys.Init();
            LatencyMeasurement.Init();

            // Create scripts and plugins dir if doesn't exists
            DirectoryInfo scriptsDir = new DirectoryInfo(Phoenix.Runtime.RuntimeCore.ScriptsDirectory);

            if (!scriptsDir.Exists)
            {
                scriptsDir.Create();
            }

            DirectoryInfo pluginsDir = new DirectoryInfo(Phoenix.Runtime.RuntimeCore.PluginsDirectory);

            if (!pluginsDir.Exists)
            {
                pluginsDir.Create();
            }

            Core.RegisterServerMessageCallback(0xA9, new MessageCallback(OnCharacterList), CallbackPriority.Highest);
            Core.RegisterServerMessageCallback(0x1B, new MessageCallback(OnLoginConfirmedPacket), CallbackPriority.Normal);
            Core.RegisterServerMessageCallback(0x55, new MessageCallback(OnLoginCompletePacket), CallbackPriority.Highest);

            loadDataFilesThread.Join();

            PlayerSkills.Init();

            Config.Profile.FpsLimit.Changed += new EventHandler(FrameLimit_Changed);

            Config.InternalSettings.Load();
            Config.Profile.LoadDefault();

            Phoenix.Runtime.RuntimeCore.RegisterPhoenix();
            Phoenix.Runtime.RuntimeCore.ReloadPlugins();
            Phoenix.Runtime.RuntimeCore.CompileScripts(true);

            Trace.WriteLine("Phoenix initialized.", DateTime.Now.ToString());
        }