コード例 #1
0
ファイル: TextMessage.cs プロジェクト: Skinny1001/PlayUO
 public TextMessage(string Message, float Delay, IFont Font, IHue Hue)
 {
     this.m_Timestamp = Engine.Ticks;
     this.m_Image = Font.GetString(Message, Hue);
     this.m_Delay = new TimeDelay(Delay);
 }
コード例 #2
0
ファイル: Engine.cs プロジェクト: Skinny1001/PlayUO
 public static void AllNames()
 {
     if ((m_AllNames == null) || m_AllNames.ElapsedReset())
     {
         m_AllNames = new TimeDelay(1f);
         Mobile player = World.Player;
         if (player != null)
         {
             Item item;
             IEnumerator enumerator = World.Mobiles.Values.GetEnumerator();
             while (enumerator.MoveNext())
             {
                 Mobile current = (Mobile) enumerator.Current;
                 if ((current.Visible && !current.Player) && World.InRange(current))
                 {
                     current.Look();
                 }
             }
             enumerator = World.Items.Values.GetEnumerator();
             if (((m_TargetHandler == null) && !player.Ghost) && (!player.Flags[MobileFlag.Hidden] && !m_Meditating))
             {
                 ArrayList dataStore = GetDataStore();
                 while (enumerator.MoveNext())
                 {
                     item = (Item) enumerator.Current;
                     if ((item.Visible && (item.IsCorpse || item.IsBones)) && World.InRange(item))
                     {
                         item.Look();
                         if (item.InSquareRange(player, 2))
                         {
                             dataStore.Add(item);
                         }
                     }
                 }
                 if (dataStore.Count > 0)
                 {
                     dataStore.Sort(PlayerDistanceSorter.Comparer);
                     ((Item) dataStore[0]).Use();
                 }
                 ReleaseDataStore(dataStore);
             }
             else
             {
                 while (enumerator.MoveNext())
                 {
                     item = (Item) enumerator.Current;
                     if ((item.Visible && (item.IsCorpse || item.IsBones)) && World.InRange(item))
                     {
                         item.Look();
                     }
                 }
             }
         }
     }
 }
コード例 #3
0
ファイル: Engine.cs プロジェクト: Skinny1001/PlayUO
        public static void Main(string[] Args)
        {
            int num3;
            m_IniPath = Path.Combine(Application.StartupPath, "Data/Config/Client.ini");
            ParseArgs(Args);
            m_FileManager = new Client.FileManager();
            if (m_FileManager.Error)
            {
                m_FileManager = null;
                GC.Collect();
            }
            else
            {
                AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(Engine.Exception_Unhandled);
                long frequency = 0L;
                QueryPerformanceFrequency(ref frequency);
                double num2 = frequency;
                m_QPF = num2 / 1000.0;
                WantDirectory("Data/Config/");
                Debug.Trace("Entered Main()");
                Debug.Block("Environment");
                Debug.Trace("Operating System = '{0}'", Environment.OSVersion);
                Debug.Trace(".NET Framework   = '{0}'", Environment.Version);
                Debug.Trace("Base Directory   = '{0}'", m_FileManager.BasePath(""));
                Debug.Trace("Data Directory   = '{0}'", m_FileManager.ResolveMUL(""));
                Debug.EndBlock();
                Debug.Try("Setting up interop communications");
                Interop.Comm = new ExposerInterop();
                Debug.EndTry();
                Debug.Try("Initializing Strings");
                Strings.Initialize();
                Debug.EndTry();
                Benchmark benchmark = new Benchmark(6);
                Debug.Trace("Benchmarks: {0} resolution", "low");
                benchmark = null;
                m_Timers = new ArrayList();
                m_Plugins = new ArrayList();
                m_WalkTimeout = new ArrayList();
                m_Journal = new ArrayList();
                m_Doors = new ArrayList();
                m_Pings = new Queue();
                m_LoadQueue = new Queue();
                m_MapLoadQueue = new Queue();
                WantDirectory("Data/Logs/");
                Debug.Block("Main()");
                if (m_OverrideServHost != null)
                {
                    NewConfig.ServerHost = m_OverrideServHost;
                }
                if (m_OverrideServPort != -1)
                {
                    NewConfig.ServerPort = m_OverrideServPort;
                }
                switch (NewConfig.GameSize.ToLower().Trim())
                {
                    case "320x240":
                        GameWidth = 320;
                        GameHeight = 240;
                        num3 = 3;
                        goto Label_02E0;

                    case "640x480":
                        GameWidth = 640;
                        GameHeight = 480;
                        num3 = 5;
                        goto Label_02E0;

                    case "800x600":
                        GameWidth = 800;
                        GameHeight = 600;
                        num3 = 7;
                        goto Label_02E0;

                    case "1024x768":
                        GameWidth = 0x400;
                        GameHeight = 0x300;
                        num3 = 7;
                        goto Label_02E0;

                    case "1280x1024":
                        GameWidth = 0x500;
                        GameHeight = 0x400;
                        num3 = 9;
                        goto Label_02E0;

                    case "1600x1200":
                        GameWidth = 0x640;
                        GameHeight = 0x4b0;
                        num3 = 11;
                        goto Label_02E0;
                }
                MessageBox.Show(string.Format("A invalid game size of '{0}' was specified in Client.cfg. Valid sizes are: '320x240' '640x480' '800x600' '1024x768' '1280x1024' '1600x1200'", NewConfig.GameSize));
            }
            return;
            Label_02E0:;
            string[] strArray = NewConfig.ScreenSize.ToLower().Trim().Split(new char[] { 'x' });
            int num4 = -1;
            int num5 = -1;
            if (strArray.Length == 2)
            {
                num4 = num5 = 0;
                try
                {
                    num4 = int.Parse(strArray[0]);
                    num5 = int.Parse(strArray[1]);
                }
                catch
                {
                }
            }
            if ((num4 >= 320) && (num5 >= 240))
            {
                ScreenWidth = num4;
                ScreenHeight = num5;
            }
            else
            {
                MessageBox.Show(string.Format("A invalid screen size of '{0}' was specified in Client.cfg. Make sure the value is formatted correctly ('<Width>x<Height>'), and that it is 320x240 or higher.", NewConfig.ScreenSize));
            }
            GameX = (ScreenWidth - GameWidth) / 2;
            GameY = (ScreenHeight - GameHeight) / 2;
            Renderer.blockWidth = num3;
            Renderer.blockHeight = num3;
            Renderer.cellWidth = num3 << 3;
            Renderer.cellHeight = num3 << 3;
            m_ClickTimer = new Timer(new OnTick(Engine.ClickTimer_OnTick), SystemInformation.DoubleClickTime);
            Debug.Try("Initializing Display");
            m_Display = new Display();
            if (NewConfig.FullScreen)
            {
                m_Display.FormBorderStyle = FormBorderStyle.None;
                m_Display.WindowState = FormWindowState.Maximized;
            }
            m_Display.ClientSize = new Size(ScreenWidth, ScreenHeight);
            m_Display.KeyPreview = true;
            m_Display.Show();
            Debug.EndTry();
            Application.DoEvents();
            Debug.Block("Initializing DirectX");
            InitDX();
            Debug.EndBlock();
            m_Loading = true;
            m_Ingame = false;
            DrawNow();
            Benchmark benchmark2 = new Benchmark(7);
            benchmark2.Start();
            Debug.TimeBlock("Initializing Animations");
            m_Animations = new Animations();
            Debug.EndBlock();
            m_Font = new Font[10];
            m_UniFont = new UnicodeFont[3];
            Debug.TimeBlock("Initializing Gumps");
            m_Gumps = new Gumps();
            Debug.EndBlock();
            m_DefaultFont = GetUniFont(3);
            m_DefaultHue = Hues.Load(0x3b2);
            Renderer.SetText("");
            Debug.TimeBlock("Initializing Plugins");
            FindPlugins();
            Debug.EndBlock();
            Macros.Load();
            LoadParticles();
            Renderer.SetAlphaEnable(true);
            Renderer.SetFilterEnable(false);
            Renderer.AlphaTestEnable = true;
            Renderer.SetTexture(m_Halo);
            try
            {
                m_Device.ValidateDevice();
            }
            catch (Exception exception)
            {
                m_Halo.Dispose();
                m_Halo = Hues.Default.GetGump(0x71);
                m_Rain.Dispose();
                m_Rain = Texture.Empty;
                m_SkillUp.Dispose();
                m_SkillUp = Hues.Default.GetGump(0x983);
                m_SkillDown.Dispose();
                m_SkillDown = Hues.Default.GetGump(0x985);
                m_SkillLocked.Dispose();
                m_SkillLocked = Hues.Default.GetGump(0x82c);
                m_Slider.Dispose();
                m_Slider = Hues.Default.GetGump(0x845);
                for (int i = 0; i < m_Snow.Length; i++)
                {
                    m_Snow[i].Dispose();
                    m_Snow[i] = Texture.Empty;
                }
                for (int j = 0; j < m_Edge.Length; j++)
                {
                    m_Edge[j].Dispose();
                    m_Edge[j] = Texture.Empty;
                }
                Debug.Trace("ValidateDevice() failed on 32-bit textures");
                Debug.Error(exception);
            }
            Renderer.SetTexture(null);
            Renderer.SetAlphaEnable(false);
            m_Effects = new Client.Effects();
            m_Loading = false;
            Point point = m_Display.PointToClient(Cursor.Position);
            m_EventOk = true;
            MouseMove(m_Display, new MouseEventArgs(Control.MouseButtons, 0, point.X, point.Y, 0));
            Network.CheckCache();
            ShowAcctLogin();
            MouseMoveQueue();
            m_EventOk = false;
            DrawNow();
            benchmark2.StopNoLog();
            Debug.Trace("Total -> {0}", Benchmark.Format(benchmark2.Elapsed));
            m_MoveDelay = new TimeDelay(0f);
            m_LastOverCheck = new TimeDelay(0.1f);
            m_NewFrame = new TimeDelay(0.05f);
            m_SleepMode = new TimeDelay(7.5f);
            m_EventOk = true;
            PlayRandomMidi();
            bool flag = false;
            new Timer(new OnTick(Engine.Evict_OnTick), 0x9c4).Start(false);
            Animations.StartLoading();
            Unlock();
            DateTime now = DateTime.Now;
            int num10 = Ticks + 0x1388;
            bool extendProtocol = NewConfig.ExtendProtocol;
            while (!exiting)
            {
                m_SetTicks = false;
                int ticks = Ticks;
                Macros.Slice();
                if (Gumps.Invalidated)
                {
                    if (m_LastMouseArgs != null)
                    {
                        MouseMove(m_Display, m_LastMouseArgs);
                    }
                    Gumps.Invalidated = false;
                }
                if (m_MouseMoved)
                {
                    MouseMoveQueue();
                }
                if (m_NewFrame.ElapsedReset())
                {
                    Renderer.m_Frames++;
                    m_Redraw = false;
                    Renderer.Draw();
                }
                else if ((m_Redraw || m_PumpFPS) || (m_Quake || (amMoving && IsMoving())))
                {
                    m_Redraw = false;
                    Renderer.Draw();
                }
                if ((extendProtocol && m_Ingame) && ((Party.State == PartyState.Joined) && (DateTime.Now >= now)))
                {
                    now = DateTime.Now + TimeSpan.FromSeconds(0.5);
                    for (int k = 0; k < Party.Members.Length; k++)
                    {
                        Mobile mobile = Party.Members[k];
                        if (((mobile != null) && !mobile.Player) && !mobile.Visible)
                        {
                            Network.Send(new PPE_QueryPartyLocs());
                            break;
                        }
                    }
                }
                Thread.Sleep(1);
                if (GetQueueStatus(0xff) != 0)
                {
                    Application.DoEvents();
                }
                UOAM.Slice();
                if (!Network.Slice())
                {
                    flag = true;
                    break;
                }
                Network.Flush();
                TickTimers();
                if (amMoving && m_Ingame)
                {
                    DoWalk(movingDir, false);
                }
                if (m_LoadQueue.Count > 0)
                {
                    for (int m = 0; (m_LoadQueue.Count > 0) && (m < 6); m++)
                    {
                        ((ILoader) m_LoadQueue.Dequeue()).Load();
                    }
                }
                if (m_MapLoadQueue.Count > 0)
                {
                    Preload((Worker) m_MapLoadQueue.Dequeue());
                }
            }
            NewConfig.Save();
            SaveJournal();
            Thread.Sleep(5);
            if ((m_Display != null) && !m_Display.IsDisposed)
            {
                m_Display.Hide();
            }
            Thread.Sleep(5);
            Application.DoEvents();
            Thread.Sleep(5);
            Application.DoEvents();
            m_Animations.Dispose();
            if (m_ItemArt != null)
            {
                m_ItemArt.Dispose();
            }
            if (m_LandArt != null)
            {
                m_LandArt.Dispose();
            }
            if (m_TextureArt != null)
            {
                m_TextureArt.Dispose();
            }
            m_Gumps.Dispose();
            if (m_Sounds != null)
            {
                m_Sounds.Dispose();
            }
            if (m_Multis != null)
            {
                m_Multis.Dispose();
            }
            m_FileManager.Dispose();
            Cursor.Dispose();
            Music.Dispose();
            Hues.Dispose();
            GRadar.Dispose();
            if (m_Plugins != null)
            {
                m_Plugins.Clear();
                m_Plugins = null;
            }
            if (m_Rain != null)
            {
                m_Rain.Dispose();
                m_Rain = null;
            }
            if (m_Slider != null)
            {
                m_Slider.Dispose();
                m_Slider = null;
            }
            if (m_SkillUp != null)
            {
                m_SkillUp.Dispose();
                m_SkillUp = null;
            }
            if (m_SkillDown != null)
            {
                m_SkillDown.Dispose();
                m_SkillDown = null;
            }
            if (m_SkillLocked != null)
            {
                m_SkillLocked.Dispose();
                m_SkillLocked = null;
            }
            if (m_Snow != null)
            {
                for (int n = 0; n < 12; n++)
                {
                    if (m_Snow[n] != null)
                    {
                        m_Snow[n].Dispose();
                        m_Snow[n] = null;
                    }
                }
                m_Snow = null;
            }
            if (m_Edge != null)
            {
                for (int num13 = 0; num13 < 8; num13++)
                {
                    if (m_Edge[num13] != null)
                    {
                        m_Edge[num13].Dispose();
                        m_Edge[num13] = null;
                    }
                }
                m_Edge = null;
            }
            if (m_WinScrolls != null)
            {
                for (int num14 = 0; num14 < m_WinScrolls.Length; num14++)
                {
                    if (m_WinScrolls[num14] != null)
                    {
                        m_WinScrolls[num14].Dispose();
                        m_WinScrolls[num14] = null;
                    }
                }
                m_WinScrolls = null;
            }
            if (m_Halo != null)
            {
                m_Halo.Dispose();
                m_Halo = null;
            }
            if (m_Friend != null)
            {
                m_Friend.Dispose();
                m_Friend = null;
            }
            if (m_FormX != null)
            {
                m_FormX.Dispose();
                m_FormX = null;
            }
            if (m_TargetImage != null)
            {
                m_TargetImage.Dispose();
                m_TargetImage = null;
            }
            if (m_TargetCursorImage != null)
            {
                m_TargetCursorImage.Dispose();
                m_TargetCursorImage = null;
            }
            if (m_Font != null)
            {
                for (int num15 = 0; num15 < 10; num15++)
                {
                    if (m_Font[num15] != null)
                    {
                        m_Font[num15].Dispose();
                        m_Font[num15] = null;
                    }
                }
                m_Font = null;
            }
            if (m_UniFont != null)
            {
                int length = m_UniFont.Length;
                for (int num17 = 0; num17 < length; num17++)
                {
                    if (m_UniFont[num17] != null)
                    {
                        m_UniFont[num17].Dispose();
                        m_UniFont[num17] = null;
                    }
                }
                m_UniFont = null;
            }
            if (m_MidiTable != null)
            {
                m_MidiTable.Dispose();
                m_MidiTable = null;
            }
            if (m_ContainerBoundsTable != null)
            {
                m_ContainerBoundsTable.Dispose();
                m_ContainerBoundsTable = null;
            }
            Texture.DisposeAll();
            Debug.EndBlock();
            if (flag)
            {
                Debug.Trace("Network error caused termination");
            }
            Network.DumpBuffer();
            Network.Close();
            Debug.Dispose();
            Strings.Dispose();
            m_LoadQueue = null;
            m_MapLoadQueue = null;
            m_DefaultFont = null;
            m_DefaultHue = null;
            m_Display = null;
            m_Encoder = null;
            m_Effects = null;
            m_Skills = null;
            m_Features = null;
            m_Animations = null;
            m_LandArt = null;
            m_TextureArt = null;
            m_ItemArt = null;
            m_Gumps = null;
            m_Sounds = null;
            m_Multis = null;
            m_FileManager = null;
            m_Display = null;
            m_Font = null;
            m_UniFont = null;
            m_Device = null;
            m_CharacterNames = null;
            m_MoveDelay = null;
            m_Text = null;
            m_Font = null;
            m_UniFont = null;
            m_NewFrame = null;
            m_SleepMode = null;
            m_Timers = null;
            m_Plugins = null;
            m_SkillsGump = null;
            m_JournalGump = null;
            m_Journal = null;
            m_FileManager = null;
            m_Encoder = null;
            m_DefaultFont = null;
            m_DefaultHue = null;
            m_LastTarget = null;
            m_Random = null;
            m_WalkStack = null;
            m_Prompt = null;
            m_IniPath = null;
            m_Pings = null;
            m_PingTimer = null;
            m_MultiList = null;
            m_WalkTimeout = null;
            m_Servers = null;
            m_AllNames = null;
            m_Doors = null;
            m_LastOverCheck = null;
            m_LastMouseArgs = null;
            m_LastAttacker = null;
            Renderer.m_VertexPool = null;
            try
            {
                Process currentProcess = Process.GetCurrentProcess();
                currentProcess.Kill();
                currentProcess.WaitForExit();
            }
            catch
            {
            }
        }
コード例 #4
0
ファイル: Gumps.cs プロジェクト: Skinny1001/PlayUO
 private static bool RecurseMouseMove(int X, int Y, Gump g, int mX, int mY, MouseButtons mb)
 {
     if (g.Visible && (g.m_NonRestrictivePicking || (((mX >= X) && (mX < (X + g.Width))) && ((mY >= Y) && (mY < (Y + g.Height))))))
     {
         Gump[] gumpArray = g.Children.ToArray();
         for (int i = gumpArray.Length - 1; i >= 0; i--)
         {
             Gump gump = gumpArray[i];
             if (RecurseMouseMove(X + gump.X, Y + gump.Y, gump, mX, mY, mb))
             {
                 return true;
             }
         }
         if (!g.m_NonRestrictivePicking || (((mX >= X) && (mX < (X + g.Width))) && ((mY >= Y) && (mY < (Y + g.Height)))))
         {
             if ((m_Modal == null) && g.HitTest(mX - X, mY - Y))
             {
                 if (m_LastOver == g)
                 {
                     g.OnMouseMove(mX - X, mY - Y, mb);
                 }
                 else
                 {
                     if (m_LastOver != null)
                     {
                         m_LastOver.OnMouseLeave();
                     }
                     g.OnMouseEnter(mX - X, mY - Y, mb);
                     if (g.Tooltip != null)
                     {
                         m_TipDelay = new TimeDelay(g.Tooltip.Delay);
                     }
                     else
                     {
                         m_TipDelay = null;
                     }
                     m_LastOver = g;
                 }
                 return true;
             }
             if (((m_Modal != null) && g.IsChildOf(m_Modal)) && g.HitTest(mX - X, mY - Y))
             {
                 if (m_LastOver == g)
                 {
                     g.OnMouseMove(mX - X, mY - Y, mb);
                 }
                 else
                 {
                     if (m_LastOver != null)
                     {
                         m_LastOver.OnMouseLeave();
                     }
                     g.OnMouseEnter(mX - X, mY - Y, mb);
                     if (g.Tooltip != null)
                     {
                         m_TipDelay = new TimeDelay(g.Tooltip.Delay);
                     }
                     else
                     {
                         m_TipDelay = null;
                     }
                     m_LastOver = g;
                 }
                 return true;
             }
         }
     }
     return false;
 }
コード例 #5
0
ファイル: Gumps.cs プロジェクト: Skinny1001/PlayUO
 public void Dispose()
 {
     Stack stack = new Stack();
     stack.Push(m_Desktop);
     while (stack.Count > 0)
     {
         Gump gump = (Gump) stack.Pop();
         if (gump != null)
         {
             GumpList children = gump.Children;
             if (children != null)
             {
                 Gump[] gumpArray = children.ToArray();
                 for (int i = 0; i < gumpArray.Length; i++)
                 {
                     stack.Push(gumpArray[i]);
                 }
             }
             try
             {
                 gump.OnDispose();
                 continue;
             }
             catch (Exception exception)
             {
                 Debug.Trace("Exception in {0}.OnDispose()", gump);
                 Debug.Error(exception);
                 continue;
             }
         }
     }
     m_Desktop = null;
     this.m_Stream.Close();
     this.m_Stream = null;
     this.m_Verdata.Close();
     this.m_Verdata = null;
     this.m_Buffer = null;
     m_Drag = null;
     m_Capture = null;
     m_Focus = null;
     m_Modal = null;
     m_LastDragOver = null;
     m_StartDrag = null;
     m_LastOver = null;
     m_TextFocus = null;
     m_TipDelay = null;
     this.m_Index = null;
     if (this.m_Objects != null)
     {
         this.m_Objects.Clear();
         this.m_Objects = null;
     }
     if (m_ToRestore != null)
     {
         m_ToRestore.Clear();
         m_ToRestore = null;
     }
 }
コード例 #6
0
 public TextMessage(string Message, float Delay, IFont Font, IHue Hue)
 {
     this.m_Timestamp = Engine.Ticks;
     this.m_Image     = Font.GetString(Message, Hue);
     this.m_Delay     = new TimeDelay(Delay);
 }