diff --git a/ZeldaTOTK/Basic.cs b/ZeldaTOTK/Basic.cs index 81b1747..e3e0675 100644 --- a/ZeldaTOTK/Basic.cs +++ b/ZeldaTOTK/Basic.cs @@ -14,7 +14,7 @@ public uint Heart set { if (value < 1) value = 1; - if (value > 20) value = 20; + if (value > 40) value = 40; SaveData.Instance().WriteNumber(0x29A44, 4, value); } } @@ -44,6 +44,21 @@ public uint Rupee } } + public float Battery + { + get + { + return BitConverter.ToSingle(SaveData.Instance().ReadValue(0x34FC4, 4)); + } + + set + { + if (value < 3000) value = 3000; + if (value > 24000) value = 24000; + SaveData.Instance().WriteValue(0x34FC4, BitConverter.GetBytes(value)); + } + } + public uint Arrow { get => SaveData.Instance().ReadNumber(0x47030, 4); @@ -53,5 +68,15 @@ public uint Arrow SaveData.Instance().WriteNumber(0x47030, 4, value); } } + + public uint EnergyCrystal + { + get => SaveData.Instance().ReadNumber(0x4EBF4, 4); + set + { + if (value > 999) value = 999; + SaveData.Instance().WriteNumber(0x4EBF4, 4, value); + } + } } } diff --git a/ZeldaTOTK/HeartConverter.cs b/ZeldaTOTK/HeartConverter.cs index 65cdb42..fb8e3fe 100644 --- a/ZeldaTOTK/HeartConverter.cs +++ b/ZeldaTOTK/HeartConverter.cs @@ -18,8 +18,10 @@ public object Convert(object value, Type targetType, object parameter, CultureIn public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { - var count = (uint)(int)value * 4; - return count; + uint count = 0; + if (!uint.TryParse(value.ToString(), out count)) return 0; + + return count * 4; } } } diff --git a/ZeldaTOTK/MainWindow.xaml b/ZeldaTOTK/MainWindow.xaml index 081a894..0731b47 100644 --- a/ZeldaTOTK/MainWindow.xaml +++ b/ZeldaTOTK/MainWindow.xaml @@ -6,7 +6,7 @@ xmlns:local="clr-namespace:ZeldaTOTK" mc:Ignorable="d" WindowStartupLocation="CenterScreen" - Title="MainWindow" Height="450" Width="650"> + Title="Switch The Legend of Zelda Tears of the Kingdom SaveDate Editor" Height="450" Width="650"> @@ -28,7 +28,10 @@ - + + + + @@ -40,13 +43,29 @@