示例#1
0
        private void ExtractMapJpg(object sender, EventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;
            string path     = FiddlerControls.Options.OutputPath;
            string name     = String.Format("{0}.jpg", Options.MapNames[currmapint]);
            string FileName = Path.Combine(path, name);
            Bitmap extract  = currmap.GetImage(0, 0, (currmap.Width >> 3), (currmap.Height >> 3), showStaticsToolStripMenuItem1.Checked);

            if (showMarkersToolStripMenuItem.Checked)
            {
                Graphics g = Graphics.FromImage(extract);
                foreach (TreeNode obj in OverlayObjectTree.Nodes[currmapint].Nodes)
                {
                    OverlayObject o = (OverlayObject)obj.Tag;
                    if (o.Visible)
                    {
                        o.Draw(g);
                    }
                }
                g.Save();
            }
            extract.Save(FileName, ImageFormat.Jpeg);
            Cursor.Current = Cursors.Default;
            MessageBox.Show(String.Format("Map saved to {0}", FileName), "Saved",
                            MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
        }
示例#2
0
        public static void SaveMapOverlays()
        {
            if (!Loaded)
            {
                return;
            }
            string filepath = FiddlerControls.Options.AppDataPath;

            string FileName = Path.Combine(filepath, "MapOverlays.xml");

            XmlDocument    dom  = new XmlDocument();
            XmlDeclaration decl = dom.CreateXmlDeclaration("1.0", "utf-8", null);

            dom.AppendChild(decl);
            XmlElement sr      = dom.CreateElement("Overlays");
            bool       entries = false;

            for (int i = 0; i < 5; ++i)
            {
                foreach (TreeNode obj in refmarker.OverlayObjectTree.Nodes[i].Nodes)
                {
                    OverlayObject o    = (OverlayObject)obj.Tag;
                    XmlElement    elem = dom.CreateElement("Marker");
                    o.Save(elem);
                    sr.AppendChild(elem);
                    entries = true;
                }
            }
            dom.AppendChild(sr);
            if (entries)
            {
                dom.Save(FileName);
            }
        }
示例#3
0
        private void OnPaint(object sender, PaintEventArgs e)
        {
            map = currmap.GetImage(hScrollBar.Value >> 3, vScrollBar.Value >> 3,
                                   (int)((e.ClipRectangle.Width / Zoom) + 8) >> 3, (int)((e.ClipRectangle.Height / Zoom) + 8) >> 3,
                                   showStaticsToolStripMenuItem1.Checked);
            ZoomMap(ref map);
            e.Graphics.DrawImageUnscaledAndClipped(map, e.ClipRectangle);

            if (showCenterCrossToolStripMenuItem1.Checked)
            {
                Brush brush = new SolidBrush(Color.FromArgb(180, Color.White));
                Pen   pen   = new Pen(brush);
                int   x     = Round((int)(pictureBox.Width / 2));
                int   y     = Round((int)(pictureBox.Height / 2));
                e.Graphics.DrawLine(pen, x - 4, y, x + 4, y);
                e.Graphics.DrawLine(pen, x, y - 4, x, y + 4);
                pen.Dispose();
                brush.Dispose();
            }

            if (showClientCrossToolStripMenuItem.Checked)
            {
                if (Client.Running)
                {
                    if ((ClientX > hScrollBar.Value) &&
                        (ClientX < hScrollBar.Value + e.ClipRectangle.Width / Zoom) &&
                        (ClientY > vScrollBar.Value) &&
                        (ClientY < vScrollBar.Value + e.ClipRectangle.Height / Zoom) &&
                        (ClientMap == currmapint))
                    {
                        Brush brush = new SolidBrush(Color.FromArgb(180, Color.Yellow));
                        Pen   pen   = new Pen(brush);
                        int   x     = (int)((ClientX - Round(hScrollBar.Value)) * Zoom);
                        int   y     = (int)((ClientY - Round(vScrollBar.Value)) * Zoom);
                        e.Graphics.DrawLine(pen, x - 4, y, x + 4, y);
                        e.Graphics.DrawLine(pen, x, y - 4, x, y + 4);
                        e.Graphics.DrawEllipse(pen, x - 2, y - 2, 2 * 2, 2 * 2);
                        pen.Dispose();
                        brush.Dispose();
                    }
                }
            }

            if (OverlayObjectTree.Nodes.Count > 0)
            {
                if (showMarkersToolStripMenuItem.Checked)
                {
                    foreach (TreeNode obj in OverlayObjectTree.Nodes[currmapint].Nodes)
                    {
                        OverlayObject o = (OverlayObject)obj.Tag;
                        if (o.isVisible(e.ClipRectangle, currmapint))
                        {
                            o.Draw(e.Graphics);
                        }
                    }
                }
            }
        }
示例#4
0
        private void OnClickGotoMarker(object sender, EventArgs e)
        {
            if (OverlayObjectTree.SelectedNode == null)
            {
                return;
            }
            if (OverlayObjectTree.SelectedNode.Parent == null)
            {
                return;
            }
            OverlayObject o = (OverlayObject)OverlayObjectTree.SelectedNode.Tag;

            if (currmapint != o.DefMap)
            {
                ResetCheckedMap();
                switch (o.DefMap)
                {
                case 0:
                    feluccaToolStripMenuItem.Checked = true;
                    currmap = Ultima.Map.Felucca;
                    break;

                case 1:
                    trammelToolStripMenuItem.Checked = true;
                    currmap = Ultima.Map.Trammel;
                    break;

                case 2:
                    ilshenarToolStripMenuItem.Checked = true;
                    currmap = Ultima.Map.Ilshenar;
                    break;

                case 3:
                    malasToolStripMenuItem.Checked = true;
                    currmap = Ultima.Map.Malas;
                    break;

                case 4:
                    tokunoToolStripMenuItem.Checked = true;
                    currmap = Ultima.Map.Tokuno;
                    break;

                case 5:
                    terMurToolStripMenuItem.Checked = true;
                    currmap = Ultima.Map.TerMur;
                    break;
                }
                currmapint = o.DefMap;
            }
            SetScrollBarValues();
            hScrollBar.Value = (int)Math.Max(0, o.Loc.X - pictureBox.Right / Zoom / 2);
            vScrollBar.Value = (int)Math.Max(0, o.Loc.Y - pictureBox.Bottom / Zoom / 2);
            pictureBox.Invalidate();
        }
示例#5
0
        private void OnClickSwitchVisible(object sender, EventArgs e)
        {
            if (OverlayObjectTree.SelectedNode == null)
            {
                return;
            }
            if (OverlayObjectTree.SelectedNode.Parent == null)
            {
                return;
            }
            OverlayObject o = (OverlayObject)OverlayObjectTree.SelectedNode.Tag;

            o.Visible = !o.Visible;
            if (!o.Visible)
            {
                OverlayObjectTree.SelectedNode.ForeColor = Color.Red;
            }
            else
            {
                OverlayObjectTree.SelectedNode.ForeColor = Color.Black;
            }
            OverlayObjectTree.Invalidate();
            pictureBox.Invalidate();
        }