Ejemplo n.º 1
0
 private void onKeyDownAdd(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         int index;
         if (Utils.ConvertStringToInt(AddTextBox.Text, out index, 0, Art.StaticLength - 1))
         {
             if (Animdata.GetAnimData(index) == null)
             {
                 Animdata.AnimData[index] = new Animdata.Data(new sbyte[64], 0, 1, 0, 0);
                 TreeNode node = new TreeNode();
                 node.Tag  = index;
                 node.Text = String.Format("0x{0:X4} {1}", index, TileData.ItemTable[index].Name);
                 if ((TileData.ItemTable[index].Flags & TileFlag.Animation) == 0)
                 {
                     node.ForeColor = Color.Blue;
                 }
                 treeView1.Nodes.Add(node);
                 TreeNode subnode = new TreeNode();
                 subnode.Text = String.Format("0x{0:X4} {1}", index, TileData.ItemTable[index].Name);
                 node.Nodes.Add(subnode);
                 node.EnsureVisible();
                 treeView1.SelectedNode = node;
                 Options.ChangedUltimaClass["Animdata"] = true;
             }
         }
     }
 }
Ejemplo n.º 2
0
        private void UpdateDetail(int id)
        {
            Ultima.ItemData item = Ultima.TileData.ItemTable[id];
            Bitmap          bit  = Ultima.Art.GetStatic(id);

            DetailPictureBox.Tag = id;
            if (bit == null)
            {
                splitContainer2.SplitterDistance = 10;
            }
            else
            {
                splitContainer2.SplitterDistance = bit.Size.Height + 10;
            }
            DetailPictureBox.Invalidate();
            DetailTextBox.Clear();
            DetailTextBox.AppendText(String.Format("Name: {0}\n", item.Name));
            DetailTextBox.AppendText(String.Format("Graphic: 0x{0:X4}\n", id));
            DetailTextBox.AppendText(String.Format("Height/Capacity: {0}\n", item.Height));
            DetailTextBox.AppendText(String.Format("Weight: {0}\n", item.Weight));
            DetailTextBox.AppendText(String.Format("Animation: {0}\n", item.Animation));
            DetailTextBox.AppendText(String.Format("Quality/Layer/Light: {0}\n", item.Quality));
            DetailTextBox.AppendText(String.Format("Quantity: {0}\n", item.Quantity));
            DetailTextBox.AppendText(String.Format("Hue: {0}\n", item.Hue));
            DetailTextBox.AppendText(String.Format("StackingOffset/Unk4: {0}\n", item.StackingOffset));
            DetailTextBox.AppendText(String.Format("Flags: {0}\n", item.Flags));
            if ((item.Flags & TileFlag.Animation) != 0)
            {
                Animdata.Data info = Animdata.GetAnimData(id);
                if (info != null)
                {
                    DetailTextBox.AppendText(String.Format("Animation FrameCount: {0} Interval: {1}\n", info.FrameCount, info.FrameInterval));
                }
            }
        }
Ejemplo n.º 3
0
 private void onClickSave(object sender, EventArgs e)
 {
     Cursor.Current = Cursors.WaitCursor;
     Animdata.Save(AppDomain.CurrentDomain.SetupInformation.ApplicationBase);
     Cursor.Current = Cursors.Default;
     MessageBox.Show(String.Format("Saved to {0}", AppDomain.CurrentDomain.SetupInformation.ApplicationBase),
                     "Save",
                     MessageBoxButtons.OK,
                     MessageBoxIcon.Information,
                     MessageBoxDefaultButton.Button1);
     Options.ChangedUltimaClass["Animdata"] = false;
 }
Ejemplo n.º 4
0
 private void onClickSave(object sender, EventArgs e)
 {
     Cursor.Current = Cursors.WaitCursor;
     Animdata.Save(FiddlerControls.Options.OutputPath);
     Cursor.Current = Cursors.Default;
     MessageBox.Show(String.Format("Saved to {0}", FiddlerControls.Options.OutputPath),
                     "Save",
                     MessageBoxButtons.OK,
                     MessageBoxIcon.Information,
                     MessageBoxDefaultButton.Button1);
     Options.ChangedUltimaClass["Animdata"] = false;
 }
Ejemplo n.º 5
0
        private void UpdateDetail(int id)
        {
            ItemData item = TileData.ItemTable[id];
            Bitmap   bit  = Art.GetStatic(id);

            splitContainer2.SplitterDistance = bit?.Size.Height + 10 ?? 10;

            int xMin = 0;
            int xMax = 0;
            int yMin = 0;
            int yMax = 0;

            if (bit != null)
            {
                Art.Measure(bit, out xMin, out yMin, out xMax, out yMax);
            }

            DetailPictureBox.Tag = id;
            DetailPictureBox.Invalidate();

            DetailTextBox.Clear();
            DetailTextBox.AppendText($"Name: {item.Name}\n");
            DetailTextBox.AppendText($"Graphic: 0x{id:X4}\n");
            DetailTextBox.AppendText($"Height/Capacity: {item.Height}\n");
            DetailTextBox.AppendText($"Weight: {item.Weight}\n");
            DetailTextBox.AppendText($"Animation: {item.Animation}\n");
            DetailTextBox.AppendText($"Quality/Layer/Light: {item.Quality}\n");
            DetailTextBox.AppendText($"Quantity: {item.Quantity}\n");
            DetailTextBox.AppendText($"Hue: {item.Hue}\n");
            DetailTextBox.AppendText($"StackingOffset/Unk4: {item.StackingOffset}\n");
            DetailTextBox.AppendText($"Flags: {item.Flags}\n");
            DetailTextBox.AppendText($"Graphic pixel size width, height: {bit?.Width ?? 0} {bit?.Height ?? 0} \n");
            DetailTextBox.AppendText($"Graphic pixel offset xMin, yMin, xMax, yMax: {xMin} {yMin} {xMax} {yMax}\n");

            if ((item.Flags & TileFlag.Animation) == 0)
            {
                return;
            }

            Animdata.AnimdataEntry info = Animdata.GetAnimData(id);
            if (info != null)
            {
                DetailTextBox.AppendText(
                    $"Animation FrameCount: {info.FrameCount} Interval: {info.FrameInterval}\n");
            }
        }
Ejemplo n.º 6
0
        private void onLoad(object sender, EventArgs e)
        {
            this.animateToolStripMenuItem.Visible = false;
            Ultima.ItemData item = Ultima.TileData.ItemTable[index];
            Bitmap          bit  = Ultima.Art.GetStatic(index);

            this.Text = String.Format("Item Detail 0x{0:X} '{1}'", index, item.Name);
            if (bit == null)
            {
                this.splitContainer1.SplitterDistance = 10;
            }
            else
            {
                this.Size = new System.Drawing.Size(300, bit.Size.Height + this.Data.Size.Height + 10);
                this.splitContainer1.SplitterDistance = bit.Size.Height + 10;
                this.Graphic.Size = new System.Drawing.Size(300, bit.Size.Height + 10);
                Graphic.Tag       = bit;
                Graphic.Invalidate();
            }

            this.Data.AppendText(String.Format("Name: {0}\n", item.Name));
            this.Data.AppendText(String.Format("Graphic: 0x{0:X4} ({0})\n", index));
            this.Data.AppendText(String.Format("Height/Capacity: {0}\n", item.Height));
            this.Data.AppendText(String.Format("Weight: {0}\n", item.Weight));
            this.Data.AppendText(String.Format("Animation: {0}\n", item.Animation));
            this.Data.AppendText(String.Format("Quality/Layer/Light: {0}\n", item.Quality));
            this.Data.AppendText(String.Format("Quantity: {0}\n", item.Quantity));
            this.Data.AppendText(String.Format("Hue: {0}\n", item.Hue));
            this.Data.AppendText(String.Format("StackingOffset/Unk4: {0}\n", item.StackingOffset));
            this.Data.AppendText(String.Format("Flags: {0}\n", item.Flags));
            if ((item.Flags & TileFlag.PartialHue) != 0)
            {
                partialHue = true;
            }
            if ((item.Flags & TileFlag.Animation) != 0)
            {
                info = Animdata.GetAnimData(index);
                if (info != null)
                {
                    this.animateToolStripMenuItem.Visible = true;
                    this.Data.AppendText(String.Format("Animation FrameCount: {0} Interval: {1}\n", info.FrameCount, info.FrameInterval));
                }
            }
        }
Ejemplo n.º 7
0
        private void UpdateDetail(int id)
        {
            Ultima.ItemData item = Ultima.TileData.ItemTable[id];
            Bitmap          bit  = Ultima.Art.GetStatic(id);

            if (bit == null)
            {
                splitContainer2.SplitterDistance = 10;
                Bitmap   newbit   = new Bitmap(DetailPictureBox.Size.Width, DetailPictureBox.Size.Height);
                Graphics newgraph = Graphics.FromImage(newbit);
                newgraph.Clear(Color.FromArgb(-1));
                DetailPictureBox.Image = newbit;
            }
            else
            {
                splitContainer2.SplitterDistance = bit.Size.Height + 10;
                Bitmap   newbit   = new Bitmap(DetailPictureBox.Size.Width, DetailPictureBox.Size.Height);
                Graphics newgraph = Graphics.FromImage(newbit);
                newgraph.Clear(Color.FromArgb(-1));
                newgraph.DrawImage(bit, (DetailPictureBox.Size.Width - bit.Width) / 2, 5);
                DetailPictureBox.Image = newbit;
            }

            DetailTextBox.Clear();
            DetailTextBox.AppendText(String.Format("Name: {0}\n", item.Name));
            DetailTextBox.AppendText(String.Format("Graphic: 0x{0:X4}\n", id));
            DetailTextBox.AppendText(String.Format("Height/Capacity: {0}\n", item.Height));
            DetailTextBox.AppendText(String.Format("Weight: {0}\n", item.Weight));
            DetailTextBox.AppendText(String.Format("Animation: {0}\n", item.Animation));
            DetailTextBox.AppendText(String.Format("Quality/Layer/Light: {0}\n", item.Quality));
            DetailTextBox.AppendText(String.Format("Quantity: {0}\n", item.Quantity));
            DetailTextBox.AppendText(String.Format("Hue: {0}\n", item.Hue));
            DetailTextBox.AppendText(String.Format("StackingOffset/Unk4: {0}\n", item.StackingOffset));
            DetailTextBox.AppendText(String.Format("Flags: {0}\n", item.Flags));
            if ((item.Flags & TileFlag.Animation) != 0)
            {
                Animdata.Data info = Animdata.GetAnimData(id);
                if (info != null)
                {
                    DetailTextBox.AppendText(String.Format("Animation FrameCount: {0} Interval: {1}\n", info.FrameCount, info.FrameInterval));
                }
            }
        }
Ejemplo n.º 8
0
        private void onTextChangeAdd(object sender, EventArgs e)
        {
            int index;

            if (Utils.ConvertStringToInt(AddTextBox.Text, out index, 0, Art.StaticLength - 1))
            {
                if (Animdata.GetAnimData(index) != null)
                {
                    AddTextBox.ForeColor = Color.Red;
                }
                else
                {
                    AddTextBox.ForeColor = Color.Black;
                }
            }
            else
            {
                AddTextBox.ForeColor = Color.Red;
            }
        }