예제 #1
0
        private void TextBox_OnKeyDown(object sender, KeyEventArgs e)
        {
            if (e.Key != Key.Enter)
            {
                return;
            }

            try
            {
                int offset  = 0;
                var textBox = (sender as TextBox);
                switch (textBox.Name)
                {
                case "TextOverdrive":
                    Party.SetPartyMemberAttribute(_characterIndex, "OverdriveLevel", byte.Parse(TextOverdrive.Text));
                    break;

                case "TextOverdriveMax":
                    Party.SetPartyMemberAttribute(_characterIndex, "OverdriveMax", byte.Parse(TextOverdriveMax.Text));
                    break;

                case "TextAeonName":
                    AeonName.SetName(_characterIndex, TextAeonName.Text);
                    break;

                case "TextBaseHP":
                    offset = (int)Marshal.OffsetOf <PartyMember>("BaseHp") + Party.GetMemoryOffset(_characterIndex);
                    GameMemory.Write(offset, uint.Parse(TextBaseHP.Text), false);
                    break;

                case "TextBaseMP":
                    offset = (int)Marshal.OffsetOf <PartyMember>("BaseMp") + Party.GetMemoryOffset(_characterIndex);
                    GameMemory.Write(offset, uint.Parse(TextBaseMP.Text), false);
                    break;

                case "TextBaseStrength":
                    offset = (int)Marshal.OffsetOf <PartyMember>("BaseStrength") + Party.GetMemoryOffset(_characterIndex);
                    GameMemory.Write(offset, byte.Parse(TextBaseStrength.Text), false);
                    break;

                case "TextBaseDefense":
                    offset = (int)Marshal.OffsetOf <PartyMember>("BaseDefense") + Party.GetMemoryOffset(_characterIndex);
                    GameMemory.Write(offset, byte.Parse(TextBaseDefense.Text), false);
                    break;

                case "TextBaseMagic":
                    offset = (int)Marshal.OffsetOf <PartyMember>("BaseMagic") + Party.GetMemoryOffset(_characterIndex);
                    GameMemory.Write(offset, byte.Parse(TextBaseMagic.Text), false);
                    break;

                case "TextBaseMagicDef":
                    offset = (int)Marshal.OffsetOf <PartyMember>("BaseMagicDefense") + Party.GetMemoryOffset(_characterIndex);
                    GameMemory.Write(offset, byte.Parse(TextBaseMagicDef.Text), false);
                    break;

                case "TextBaseAgility":
                    offset = (int)Marshal.OffsetOf <PartyMember>("BaseAgility") + Party.GetMemoryOffset(_characterIndex);
                    GameMemory.Write(offset, byte.Parse(TextBaseAgility.Text), false);
                    break;

                case "TextBaseLuck":
                    offset = (int)Marshal.OffsetOf <PartyMember>("BaseLuck") + Party.GetMemoryOffset(_characterIndex);
                    GameMemory.Write(offset, byte.Parse(TextBaseLuck.Text), false);
                    break;

                case "TextBaseEvasion":
                    offset = (int)Marshal.OffsetOf <PartyMember>("BaseEvasion") + Party.GetMemoryOffset(_characterIndex);
                    GameMemory.Write(offset, byte.Parse(TextBaseEvasion.Text), false);
                    break;

                case "TextBaseAccuracy":
                    offset = (int)Marshal.OffsetOf <PartyMember>("BaseAccuracy") + Party.GetMemoryOffset(_characterIndex);
                    GameMemory.Write(offset, byte.Parse(TextBaseAccuracy.Text), false);
                    break;
                }
                AeonsPanel.UpdateTabs();
                textBox.SelectAll();
            }
            catch (Exception ex)
            {
                MessageBox.Show($"An error occurred:\n{ex.Message}", "Error parsing input", MessageBoxButton.OK,
                                MessageBoxImage.Error);
                return;
            }
        }
예제 #2
0
        private void TextBox_OnKeyDown(object sender, KeyEventArgs e)
        {
            if (e.Key != Key.Enter || _statsBase <= 0)
            {
                return;
            }

            try
            {
                switch ((sender as TextBox).Name)
                {
                case "TextAeonName":
                    var nameBytes   = StringConverter.ToFFXBytes(TextAeonName.Text);
                    var writeBuffer = new byte[9];
                    nameBytes.CopyTo(writeBuffer, 0);
                    MemoryReader.WriteBytes(_nameBase, writeBuffer);
                    AeonsPanel.UpdateTabs();
                    break;

                case "TextBaseHP":
                    MemoryReader.WriteBytes(_statsBase + (int)PartyStatOffset.BaseHp,
                                            BitConverter.GetBytes(uint.Parse(TextBaseHP.Text)));
                    break;

                case "TextBaseMP":
                    MemoryReader.WriteBytes(_statsBase + (int)PartyStatOffset.BaseMp,
                                            BitConverter.GetBytes(uint.Parse(TextBaseMP.Text)));
                    break;

                case "TextOverdrive":
                    MemoryReader.WriteByte(_statsBase + (int)PartyStatOffset.OverdriveLevel, byte.Parse(TextOverdrive.Text));
                    break;

                case "TextOverdriveMax":
                    MemoryReader.WriteByte(_statsBase + (int)PartyStatOffset.OverdriveMax, byte.Parse(TextOverdriveMax.Text));
                    break;

                case "TextBaseStrength":
                    MemoryReader.WriteByte(_statsBase + (int)PartyStatOffset.BaseStrength, byte.Parse(TextBaseStrength.Text));
                    break;

                case "TextBaseDefense":
                    MemoryReader.WriteByte(_statsBase + (int)PartyStatOffset.BaseDefense, byte.Parse(TextBaseDefense.Text));
                    break;

                case "TextBaseMagic":
                    MemoryReader.WriteByte(_statsBase + (int)PartyStatOffset.BaseMagic, byte.Parse(TextBaseMagic.Text));
                    break;

                case "TextBaseMagicDef":
                    MemoryReader.WriteByte(_statsBase + (int)PartyStatOffset.BaseMagicDefense, byte.Parse(TextBaseMagicDef.Text));
                    break;

                case "TextBaseAgility":
                    MemoryReader.WriteByte(_statsBase + (int)PartyStatOffset.BaseAgility, byte.Parse(TextBaseAgility.Text));
                    break;

                case "TextBaseLuck":
                    MemoryReader.WriteByte(_statsBase + (int)PartyStatOffset.BaseLuck, byte.Parse(TextBaseLuck.Text));
                    break;

                case "TextBaseEvasion":
                    MemoryReader.WriteByte(_statsBase + (int)PartyStatOffset.BaseEvasion, byte.Parse(TextBaseEvasion.Text));
                    break;

                case "TextBaseAccuracy":
                    MemoryReader.WriteByte(_statsBase + (int)PartyStatOffset.BaseAccuracy, byte.Parse(TextBaseAccuracy.Text));
                    break;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show($"An error occurred:\n{ex.Message}", "Error parsing input", MessageBoxButton.OK,
                                MessageBoxImage.Error);
                return;
            }
        }