Beispiel #1
0
        public GSkillList(GSkills owner) : base(4, 4, 250, 50)
        {
            this.m_Owner   = owner;
            base.m_CanDrag = false;
            Skills skills = Engine.Skills;

            this.m_SkillGumps = new GSkillGump[0x100];
            int y = 4;

            for (int i = 0; i < skills.Groups.Length; i++)
            {
                GLabel     label;
                SkillGroup group = skills.Groups[i];
                label = new GLabel(group.Name, Engine.GetUniFont(1), Hues.Bright, 4, y)
                {
                    X = label.X - label.Image.xMin,
                    Y = label.Y - label.Image.yMin
                };
                label.SetTag("yBase", label.Y);
                base.m_Children.Add(label);
                y += 4 + (label.Image.yMax - label.Image.yMin);
                for (int j = 0; j < group.Skills.Count; j++)
                {
                    Skill      skill = (Skill)group.Skills[j];
                    GSkillGump toAdd = new GSkillGump(skill, y, base.m_Width - 20, this.m_Owner.ShowReal);
                    this.m_SkillGumps[skill.ID] = toAdd;
                    base.m_Children.Add(toAdd);
                    y += 4 + toAdd.Height;
                }
            }
            this.m_SliderBorder = new GSingleBorder(0, 0, 0x10, 100);
            base.m_Children.Add(this.m_SliderBorder);
            this.m_Slider = new GAlphaVSlider(0, 6, 0x10, 100, 0.0, 0.0, (double)(y + 1), 1.0);
            this.m_Slider.SetTag("Max", y + 1);
            this.m_Slider.OnValueChange = (OnValueChange)Delegate.Combine(this.m_Slider.OnValueChange, new OnValueChange(this.Slider_OnValueChange));
            base.m_Children.Add(this.m_Slider);
            this.m_Hotspot = new GHotspot(0, 0, 0x10, 100, this.m_Slider);
            base.m_Children.Add(this.m_Hotspot);
        }
Beispiel #2
0
 public GSkillList(GSkills owner)
     : base(4, 4, 250, 50)
 {
     this.m_Owner = owner;
     base.m_CanDrag = false;
     Skills skills = Engine.Skills;
     this.m_SkillGumps = new GSkillGump[0x100];
     int y = 4;
     for (int i = 0; i < skills.Groups.Length; i++)
     {
         GLabel label;
         SkillGroup group = skills.Groups[i];
         label = new GLabel(group.Name, Engine.GetUniFont(1), Hues.Bright, 4, y) {
             X = label.X - label.Image.xMin,
             Y = label.Y - label.Image.yMin
         };
         label.SetTag("yBase", label.Y);
         base.m_Children.Add(label);
         y += 4 + (label.Image.yMax - label.Image.yMin);
         for (int j = 0; j < group.Skills.Count; j++)
         {
             Skill skill = (Skill) group.Skills[j];
             GSkillGump toAdd = new GSkillGump(skill, y, base.m_Width - 20, this.m_Owner.ShowReal);
             this.m_SkillGumps[skill.ID] = toAdd;
             base.m_Children.Add(toAdd);
             y += 4 + toAdd.Height;
         }
     }
     this.m_SliderBorder = new GSingleBorder(0, 0, 0x10, 100);
     base.m_Children.Add(this.m_SliderBorder);
     this.m_Slider = new GAlphaVSlider(0, 6, 0x10, 100, 0.0, 0.0, (double) (y + 1), 1.0);
     this.m_Slider.SetTag("Max", y + 1);
     this.m_Slider.OnValueChange = (OnValueChange) Delegate.Combine(this.m_Slider.OnValueChange, new OnValueChange(this.Slider_OnValueChange));
     base.m_Children.Add(this.m_Slider);
     this.m_Hotspot = new GHotspot(0, 0, 0x10, 100, this.m_Slider);
     base.m_Children.Add(this.m_Hotspot);
 }
Beispiel #3
0
 public static void OpenSkills()
 {
     if (!m_SkillsOpen)
     {
         Network.Send(new PQuerySkills());
         m_SkillsOpen = true;
         m_SkillsGump = new GSkills();
         Gumps.Desktop.Children.Add(m_SkillsGump);
     }
 }
Beispiel #4
0
        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
            {
            }
        }