コード例 #1
0
ファイル: OWSE.cs プロジェクト: bailie1912/pk3DS
        private void B_DumpZD_Click(object sender, EventArgs e)
        {
            if (Util.Prompt(MessageBoxButtons.YesNoCancel, "Export all ZD?") != DialogResult.Yes)
            {
                return;
            }

            debugToolDumping = true;
            List <string> result = new List <string>();
            List <byte[]> data   = new List <byte[]>();

            for (int i = 0; i < CB_LocationID.Items.Count; i++)
            {
                CB_LocationID.SelectedIndex = i;
                result.Add(Util.getHexString(CurrentZone.ZD.Data));
                data.Add(CurrentZone.ZD.Data);
            }
            if (Util.Prompt(MessageBoxButtons.YesNoCancel, "Write ZDs to file?") == DialogResult.Yes)
            {
                File.WriteAllBytes("ZDs.bin", data.SelectMany(z => z).ToArray());
            }

            if (Util.Prompt(MessageBoxButtons.YesNoCancel, "Copy ZDs to Clipboard?") == DialogResult.Yes)
            {
                Clipboard.SetText(string.Join(Environment.NewLine, result));
            }

            CB_LocationID.SelectedIndex = 0;
            debugToolDumping            = false;
        }
コード例 #2
0
ファイル: OWSE.cs プロジェクト: bailie1912/pk3DS
        private void getNPC()
        {
            if (NUD_NE.Value < 0)
            {
                return;
            }
            var NPC = CurrentZone.Entities.NPCs[nEntry];

            // Load new Attributes
            NUD_NID.Value     = NPC.ID;
            NUD_NModel.Value  = NPC.Model;
            NUD_NFlag.Value   = NPC.SpawnFlag;
            NUD_NScript.Value = NPC.Script;
            NUD_NFace.Value   = NPC.FaceDirection;
            NUD_NRange.Value  = NPC.SightRange;
            NUD_NX.Value      = NPC.X;
            NUD_NY.Value      = NPC.Y;
            NUD_NMove1.Value  = NPC.MovePermissions;
            NUD_NMove2.Value  = NPC.MovePermissions2;

            // Uneditables
            TB_NDeg.Text        = NPC.Deg18.ToString();
            TB_Leash.Text       = NPC.L1 == NPC.L2 && NPC.L2 == NPC.L3 && NPC.L3 == -1
                ? TB_Leash.Text = "No Leash!"
                : $"{NPC.L1}, {NPC.L2}, {NPC.L3} -- {NPC.LDir}";

            RTB_N.Text = Util.getHexString(NPC.Raw);
        }
コード例 #3
0
        private void B_DumpUnk_Click(object sender, EventArgs e)
        {
            if (WinFormsUtil.Prompt(MessageBoxButtons.YesNoCancel, "Export all Unks?") != DialogResult.Yes)
            {
                return;
            }

            debugToolDumping = true;
            List <string> result = new List <string>();
            List <byte[]> data   = new List <byte[]>();

            for (int i = 0; i < CB_LocationID.Items.Count; i++)
            {
                CB_LocationID.SelectedIndex = i;
                for (int j = 0; j < CurrentZone.Entities.UnknownCount; j++)
                {
                    result.Add(Util.getHexString(CurrentZone.Entities.Triggers2[j].Raw));
                    data.Add(CurrentZone.Entities.Triggers2[j].Raw);
                }
            }
            if (WinFormsUtil.Prompt(MessageBoxButtons.YesNoCancel, "Write Unks to file?") == DialogResult.Yes)
            {
                File.WriteAllBytes("Unks.bin", data.SelectMany(z => z).ToArray());
            }

            if (WinFormsUtil.Prompt(MessageBoxButtons.YesNoCancel, "Copy Unks to Clipboard?") == DialogResult.Yes)
            {
                Clipboard.SetText(string.Join(Environment.NewLine, result));
            }

            CB_LocationID.SelectedIndex = 0;
            debugToolDumping            = false;
        }
コード例 #4
0
ファイル: OWSE.cs プロジェクト: bailie1912/pk3DS
        private void getTrigger1()
        {
            if (NUD_TE.Value < 0)
            {
                return;
            }

            var Trigger1 = CurrentZone.Entities.Triggers1[tEntry];

            NUD_T1X.Value = Trigger1.X;
            NUD_T1Y.Value = Trigger1.Y;
            RTB_T1.Text   = Util.getHexString(Trigger1.Raw);
        }
コード例 #5
0
ファイル: OWSE.cs プロジェクト: bailie1912/pk3DS
        private void getTrigger2()
        {
            if (NUD_UE.Value < 0)
            {
                return;
            }

            // Load New Data
            var Trigger2 = CurrentZone.Entities.Triggers2[uEntry];

            NUD_T2X.Value = Trigger2.X;
            NUD_T2Y.Value = Trigger2.Y;
            RTB_T2.Text   = Util.getHexString(Trigger2.Raw);
        }
コード例 #6
0
ファイル: OWSE.cs プロジェクト: bailie1912/pk3DS
        private void getFurniture()
        {
            if (NUD_FE.Value < 0)
            {
                return;
            }

            var Furniture = CurrentZone.Entities.Furniture[fEntry];

            NUD_FX.Value  = Furniture.X;
            NUD_FY.Value  = Furniture.Y;
            NUD_FWX.Value = Furniture.WX;
            NUD_FWY.Value = Furniture.WY;
            RTB_F.Text    = Util.getHexString(Furniture.Raw);
        }
コード例 #7
0
ファイル: OWSE.cs プロジェクト: bailie1912/pk3DS
        private void getWarp()
        {
            if (NUD_WE.Value < 0)
            {
                return;
            }

            var Warp = CurrentZone.Entities.Warps[wEntry];

            RTB_W.Text = Util.getHexString(Warp.Raw);

            // Load new Attributes
            NUD_WMap.Value  = Warp.DestinationMap;
            NUD_WTile.Value = Warp.DestinationTileIndex;

            NUD_WX.Value = Warp.X;
            NUD_WY.Value = Warp.Y;

            // Flavor Mods
            L_WarpDest.Text = zdLocations[Warp.DestinationMap];
        }
コード例 #8
0
ファイル: OWSE.cs プロジェクト: bailie1912/pk3DS
        private void changeRAW_N(object sender, EventArgs e)
        {
            if (!(sender is RichTextBox) || !(sender as RichTextBox).Visible)
            {
                return;
            }

            try
            {
                byte[] data = Util.StringToByteArray((sender as RichTextBox).Text.Replace(Environment.NewLine, " ").Replace(" ", ""));
                if (data.Length != Zone.ZoneEntities.EntityNPC.Size)
                {
                    return;
                }
                CurrentZone.Entities.NPCs[nEntry].Raw = data;
                getNPC();
            }
            catch
            {
                (sender as RichTextBox).Text = Util.getHexString(CurrentZone.Entities.NPCs[nEntry].Raw);
            }
        }
コード例 #9
0
        private void ChangeRAW_F(object sender, EventArgs e)
        {
            if (!(sender is RichTextBox) || !((RichTextBox)sender).Visible)
            {
                return;
            }

            try
            {
                byte[] data = Util.StringToByteArray(((RichTextBox)sender).Text.Replace(Environment.NewLine, " ").Replace(" ", ""));
                if (data.Length != Zone.ZoneEntities.EntityFurniture.Size)
                {
                    return;
                }
                CurrentZone.Entities.Furniture[fEntry].Raw = data;
                GetFurniture();
            }
            catch
            {
                ((RichTextBox)sender).Text = Util.getHexString(CurrentZone.Entities.Furniture[fEntry].Raw);
            }
        }