IsValidLand() public static method

public static IsValidLand ( int index ) : bool
index int
return bool
Example #1
0
        private void DrawItemSec(object sender, DrawItemEventArgs e)
        {
            if (e.Index == -1)
            {
                return;
            }

            Brush fontBrush = Brushes.Gray;

            int i = int.Parse(listBoxOrg.Items[e.Index].ToString());

            if (listBoxSec.SelectedIndex == e.Index)
            {
                e.Graphics.FillRectangle(Brushes.LightSteelBlue, e.Bounds.X, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height);
            }
            if (!SecondArt.IsValidLand(i))
            {
                fontBrush = Brushes.Red;
            }
            else if (!Compare(i))
            {
                fontBrush = Brushes.Blue;
            }

            e.Graphics.DrawString(String.Format("0x{0:X}", i), Font, fontBrush,
                                  new PointF((float)5,
                                             e.Bounds.Y + ((e.Bounds.Height / 2) -
                                                           (e.Graphics.MeasureString(String.Format("0x{0:X}", i), Font).Height / 2))));
        }
Example #2
0
        private void OnIndexChangedSec(object sender, EventArgs e)
        {
            if ((listBoxSec.SelectedIndex == -1) || (listBoxSec.Items.Count < 1))
            {
                return;
            }

            int i = int.Parse(listBoxSec.Items[listBoxSec.SelectedIndex].ToString());

            listBoxOrg.SelectedIndex = listBoxOrg.Items.IndexOf(i);
            if (SecondArt.IsValidLand(i))
            {
                Bitmap bmp = SecondArt.GetLand(i);
                if (bmp != null)
                {
                    pictureBoxSec.BackgroundImage = bmp;
                }
                else
                {
                    pictureBoxSec.BackgroundImage = null;
                }
            }
            else
            {
                pictureBoxSec.BackgroundImage = null;
            }
            listBoxSec.Invalidate();
        }
Example #3
0
        private void OnClickCopy(object sender, EventArgs e)
        {
            if (listBoxSec.SelectedIndex == -1)
            {
                return;
            }
            int i = int.Parse(listBoxSec.Items[listBoxSec.SelectedIndex].ToString());

            if (!SecondArt.IsValidLand(i))
            {
                return;
            }
            Bitmap copy = new Bitmap(SecondArt.GetLand(i));

            Ultima.Art.ReplaceLand(i, copy);
            FiddlerControls.Options.ChangedUltimaClass["Art"] = true;
            FiddlerControls.Events.FireLandTileChangeEvent(this, i);
            m_Compare[i] = true;
            listBoxOrg.BeginUpdate();
            bool done = false;

            for (int id = 0; id < 0x4000; id++)
            {
                if (id > i)
                {
                    listBoxOrg.Items.Insert(id, i);
                    done = true;
                    break;
                }
                if (id == i)
                {
                    done = true;
                    break;
                }
            }
            if (!done)
            {
                listBoxOrg.Items.Add(i);
            }
            listBoxOrg.EndUpdate();
            listBoxOrg.Invalidate();
            listBoxSec.Invalidate();
            OnIndexChangedOrg(this, null);
        }
Example #4
0
        private void ExportAsTiff(object sender, EventArgs e)
        {
            if (listBoxSec.SelectedIndex == -1)
            {
                return;
            }
            int i = int.Parse(listBoxSec.Items[listBoxSec.SelectedIndex].ToString());

            if (!SecondArt.IsValidLand(i))
            {
                return;
            }
            string path     = FiddlerControls.Options.OutputPath;
            string FileName = Path.Combine(path, String.Format("Landtile(Sec) 0x{0:X}.tiff", i));

            SecondArt.GetLand(i).Save(FileName, ImageFormat.Tiff);
            MessageBox.Show(
                String.Format("Landtile saved to {0}", FileName),
                "Saved",
                MessageBoxButtons.OK,
                MessageBoxIcon.Information,
                MessageBoxDefaultButton.Button1);
        }
Example #5
0
        private void ExportAsBmp(object sender, EventArgs e)
        {
            if (listBoxSec.SelectedIndex == -1)
            {
                return;
            }
            int i = int.Parse(listBoxSec.Items[listBoxSec.SelectedIndex].ToString());

            if (!SecondArt.IsValidLand(i))
            {
                return;
            }
            string path     = AppDomain.CurrentDomain.SetupInformation.ApplicationBase;
            string FileName = Path.Combine(path, String.Format("Landtile(Sec) 0x{0:X}.bmp", i));

            SecondArt.GetLand(i).Save(FileName, ImageFormat.Bmp);
            MessageBox.Show(
                String.Format("Landtile saved to {0}", FileName),
                "Saved",
                MessageBoxButtons.OK,
                MessageBoxIcon.Information,
                MessageBoxDefaultButton.Button1);
        }