Complete refactor. Added various requested features. DO NOTE THAT THIS VERSION IS STILL FOR JPN Saves.

This commit is contained in:
sy2zhao 2017-09-09 17:31:56 -04:00
parent 3e94d15c49
commit 50f336721c
24 changed files with 1018 additions and 791 deletions

1
.gitignore vendored
View File

@ -240,3 +240,4 @@ ModelManifest.xml
# FAKE - F# Make
.fake/
MHSEC-G/.idea/

View File

@ -9,7 +9,7 @@ using MHSEC_G.Annotations;
namespace MHSEC_G
{
internal class Armor : INotifyPropertyChanged
public class Armor : INotifyPropertyChanged
{
private const uint OFFSETA_ARM = 0x55F0;
private const uint OFFSETA_ARM_END = 0x720E;
@ -23,6 +23,7 @@ namespace MHSEC_G
private readonly uint _offset;
private readonly Model _model;
public uint index => (_offset - OFFSETA_ARM) / SIZE_ARM + 1;
public Armor(Model model, uint offset)
{
@ -80,7 +81,7 @@ namespace MHSEC_G
uint parsed;
if (Model.parse_hex_string(value, out parsed))
{
Model.write_uint16_le(_model.save_file, _offset + OFFSETR_ARM_14h, parsed);
Model.write_uint32_le(_model.save_file, _offset + OFFSETR_ARM_14h, parsed);
}
else
{
@ -141,10 +142,6 @@ namespace MHSEC_G
ObservableCollection<Armor> ret = new ObservableCollection<Armor>();
for (uint i = OFFSETA_ARM; i < OFFSETA_ARM_END; i += SIZE_ARM)
{
if (Model.byte_to_uint16_le(model.save_file, i) == 0x7FFF)
{
continue;
}
ret.Add(new Armor(model, i));
}
return ret;

View File

@ -4,7 +4,7 @@ using MHSEC_G.Annotations;
namespace MHSEC_G
{
internal class Character : INotifyPropertyChanged
public class Character : INotifyPropertyChanged
{
private const uint OFFSETA_CHAR_NAME = 0x9DA0;
private const uint LENGTH_CHAR_NAME = 6;

View File

@ -1,34 +1,35 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Windows;
using MHSEC_G.Annotations;
namespace MHSEC_G
{
internal class Egg : INotifyPropertyChanged
public class Egg : INotifyPropertyChanged
{
private const int OFFSETA_EGG_START = 0x53EC0;
private const int OFFSETA_EGG_END = 0x54505;
// 200 weapons
private const int OFFSETA_EGG_END = 0x54597;
private const int OFFSETR_EGG_GENE = 0x30;
private const int SIZE_EGG_GENE = 0x2;
private const int SIZE_EGG = 0x92;
private const int OFFSETR_SPE = 0x0;
private const int OFFSETR_WGT = 0x2E;
private readonly Genes _genes;
public Genes genes => _genes;
private readonly uint _offset;
private readonly Model _model;
public uint index => (_offset - OFFSETA_EGG_START) / SIZE_EGG + 1;
public Egg(Model model, uint offset)
{
_offset = offset;
_model = model;
_genes = new Genes(model, offset + OFFSETR_EGG_GENE, SIZE_EGG_GENE);
}
public string spe
{
set
@ -76,15 +77,18 @@ namespace MHSEC_G
ObservableCollection<Egg> ret = new ObservableCollection<Egg>();
for (uint i = OFFSETA_EGG_START; i < OFFSETA_EGG_END; i += SIZE_EGG)
{
if (Model.byte_to_uint(model.save_file[i + OFFSETR_SPE]) == 0xFF)
{
continue;
}
ret.Add(new Egg(model, i));
}
return ret;
}
public void setByteArray(byte[] ret)
{
Array.Copy(ret, 0, _model.save_file, _offset, SIZE_EGG);
OnPropertyChanged(null);
}
public event PropertyChangedEventHandler PropertyChanged;
[NotifyPropertyChangedInvocator]

View File

@ -6,7 +6,7 @@ using MHSEC_G.Annotations;
namespace MHSEC_G
{
internal class EggFragment : INotifyPropertyChanged
public class EggFragment : INotifyPropertyChanged
{
private const uint OFFSETA_EGG_FRAGMENTS = 0x9790;
private const uint OFFSETA_EGG_FRAGMENTS_END = 0x9C3F;
@ -21,6 +21,7 @@ namespace MHSEC_G
private const uint OFFSETR_EF_7H = 0x7;
private readonly uint _offset;
public uint idx => (_offset - OFFSETA_EGG_FRAGMENTS) / SIZE_EGG_FRAGMENT + 1;
public uint offset
{
@ -182,8 +183,6 @@ namespace MHSEC_G
byte[] buffer = model.save_file;
for (uint offset = OFFSETA_EGG_FRAGMENTS; offset < OFFSETA_EGG_FRAGMENTS_END; offset += SIZE_EGG_FRAGMENT)
{
if(buffer[offset] == 0)
continue;
ret.Add(new EggFragment(offset, model));
}
return ret;
@ -218,7 +217,6 @@ namespace MHSEC_G
each_frag.dlc = dlc.ToString("X2");
each_frag.unknown_6h = "0";
each_frag.unknown_7h = "0";
}
}

View File

@ -0,0 +1,72 @@
<Window x:Class="MHSEC_G.GeneWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:MHSEC_G"
mc:Ignorable="d"
Title="Gene Editor" Height="306.875" Width="471.214" ResizeMode="NoResize">
<Grid Height="278" VerticalAlignment="Top">
<Grid Background="#FFE5E5E5" Height="280" VerticalAlignment="Top">
<Label x:Name="label_mgen1" Content="Gene 1 (Hex)" HorizontalAlignment="Left"
VerticalAlignment="Top" Margin="35,27,0,0" RenderTransformOrigin="0.474,0.808" />
<Label x:Name="label_mgen2" Content="Gene 2 (Hex)" HorizontalAlignment="Left"
VerticalAlignment="Top" Margin="185,27,0,0" />
<Label x:Name="label_mgen3" Content="Gene 3 (Hex)" HorizontalAlignment="Left"
VerticalAlignment="Top" Margin="336,27,0,0" RenderTransformOrigin="0.537,0.19" />
<Label x:Name="label_mgen4" Content="Gene 4 (Hex)" HorizontalAlignment="Left"
VerticalAlignment="Top" Margin="35,112,0,0" />
<Label x:Name="label_mgen5" Content="Gene 5 (Hex)" HorizontalAlignment="Left"
VerticalAlignment="Top" Margin="185,112,0,0" RenderTransformOrigin="0.524,0.439" />
<Label x:Name="label_mgen6" Content="Gene 6 (Hex)" HorizontalAlignment="Left"
VerticalAlignment="Top" Margin="336,112,0,0" />
<Label x:Name="label_mgen7" Content="Gene 7 (Hex)" HorizontalAlignment="Left"
VerticalAlignment="Top" Margin="35,189,0,0" />
<Label x:Name="label_mgen8" Content="Gene 8 (Hex)" HorizontalAlignment="Left"
VerticalAlignment="Top" Margin="185,189,0,0" RenderTransformOrigin="-3.481,0.038" />
<Label x:Name="label_mgen9" Content="Gene 9 (Hex)" HorizontalAlignment="Left"
VerticalAlignment="Top" Margin="336,189,0,0" />
<TextBox x:Name="textbox_gene1" HorizontalAlignment="Left" Height="22" TextWrapping="Wrap"
Text="{Binding genes.gene1}" VerticalAlignment="Top" Width="129"
Margin="10,58,0,0" />
<TextBox x:Name="textbox_gene2" HorizontalAlignment="Left" Height="22" TextWrapping="Wrap"
Text="{Binding genes.gene2}" VerticalAlignment="Top" Width="128"
Margin="164,58,0,0" />
<TextBox x:Name="textbox_gene3" HorizontalAlignment="Left" Height="22" TextWrapping="Wrap"
Text="{Binding genes.gene3}" VerticalAlignment="Top" Width="129"
Margin="313,58,0,0" />
<TextBox x:Name="textbox_gene4" HorizontalAlignment="Left" Height="23" TextWrapping="Wrap"
Text="{Binding genes.gene4}" VerticalAlignment="Top" Width="127"
Margin="10,138,0,0" />
<TextBox x:Name="textbox_gene5" HorizontalAlignment="Left" Height="23" TextWrapping="Wrap"
Text="{Binding genes.gene5}" VerticalAlignment="Top" Width="129"
Margin="164,138,0,0" />
<TextBox x:Name="textbox_gene6" HorizontalAlignment="Left" Height="23" TextWrapping="Wrap"
Text="{Binding genes.gene6}" VerticalAlignment="Top" Width="128"
Margin="314,138,0,0" />
<TextBox x:Name="textbox_gene7" HorizontalAlignment="Left" Height="23" TextWrapping="Wrap"
Text="{Binding genes.gene7}" VerticalAlignment="Top" Width="125"
Margin="10,214,0,0" />
<TextBox x:Name="textbox_gene8" HorizontalAlignment="Left" Height="23" TextWrapping="Wrap"
Text="{Binding genes.gene8}" VerticalAlignment="Top" Width="129"
Margin="164,214,0,0" />
<TextBox x:Name="textbox_gene9" HorizontalAlignment="Left" Height="23" TextWrapping="Wrap"
Text="{Binding genes.gene9}" VerticalAlignment="Top" Width="128"
Margin="314,214,0,0" RenderTransformOrigin="0.55,-0.239" />
<TextBlock x:Name="textblock_gene101" HorizontalAlignment="Left" Margin="10,10,0,0"
TextWrapping="Wrap"
Text="Do NOT use genes that start with &quot;[D]&quot; They are potentially game-crashing."
VerticalAlignment="Top" />
<ComboBox x:Name="comboBox_gene1" HorizontalAlignment="Left" Margin="10,85,0,0" VerticalAlignment="Top" Width="129" ItemsSource="{Binding genes.gene_name}" SelectedIndex="{Binding genes.gene1_selected}"/>
<ComboBox x:Name="comboBox_gene2" HorizontalAlignment="Left" Margin="164,85,0,0" VerticalAlignment="Top" Width="129" ItemsSource="{Binding genes.gene_name}" SelectedIndex="{Binding genes.gene2_selected}"/>
<ComboBox x:Name="comboBox_gene3" HorizontalAlignment="Left" Margin="313,85,0,0" VerticalAlignment="Top" Width="129" ItemsSource="{Binding genes.gene_name}" SelectedIndex="{Binding genes.gene3_selected}"/>
<ComboBox x:Name="comboBox_gene4" HorizontalAlignment="Left" Margin="10,166,0,0" VerticalAlignment="Top" Width="125" ItemsSource="{Binding genes.gene_name}" SelectedIndex="{Binding genes.gene4_selected}"/>
<ComboBox x:Name="comboBox_gene5" HorizontalAlignment="Left" Margin="164,166,0,0" VerticalAlignment="Top" Width="129" ItemsSource="{Binding genes.gene_name}" SelectedIndex="{Binding genes.gene5_selected}" RenderTransformOrigin="-1.663,0.932"/>
<ComboBox x:Name="comboBox_gene6" HorizontalAlignment="Left" Margin="314,166,0,0" VerticalAlignment="Top" Width="129" ItemsSource="{Binding genes.gene_name}" SelectedIndex="{Binding genes.gene6_selected}"/>
<ComboBox x:Name="comboBox_gene7" HorizontalAlignment="Left" Margin="10,242,0,0" VerticalAlignment="Top" Width="125" ItemsSource="{Binding genes.gene_name}" SelectedIndex="{Binding genes.gene7_selected}"/>
<ComboBox x:Name="comboBox_gene8" HorizontalAlignment="Left" Margin="164,242,0,0" VerticalAlignment="Top" Width="129" ItemsSource="{Binding genes.gene_name}" SelectedIndex="{Binding genes.gene8_selected}"/>
<ComboBox x:Name="comboBox_gene9" HorizontalAlignment="Left" Margin="313,242,0,0" VerticalAlignment="Top" Width="129" ItemsSource="{Binding genes.gene_name}" SelectedIndex="{Binding genes.gene9_selected}"/>
</Grid>
</Grid>
</Window>

View File

@ -0,0 +1,41 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using MHSEC_G.Annotations;
namespace MHSEC_G
{
/// <summary>
/// Interaction logic for GeneWindow.xaml
/// </summary>
public partial class GeneWindow : Window, INotifyPropertyChanged
{
private readonly Genes _genes;
public Genes genes => _genes;
public GeneWindow(Genes genes)
{
this._genes = genes;
DataContext = this;
InitializeComponent();
}
public event PropertyChangedEventHandler PropertyChanged;
[NotifyPropertyChangedInvocator]
protected virtual void OnPropertyChanged(string propertyName)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
}

334
MHSEC-G/MHSEC-G/Genes.cs Normal file
View File

@ -0,0 +1,334 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Text;
using System.Windows;
using MHSEC_G.Annotations;
namespace MHSEC_G
{
public class Genes : INotifyPropertyChanged
{
public static readonly List<uint> GENE_ID = new List<uint>();
public static readonly List<string> GENE_NAME = new List<string>();
public List<string> gene_name => GENE_NAME;
private readonly uint _size;
private readonly Model _model;
private readonly uint _offset;
public Genes(Model model, uint offset, uint size)
{
this._size = size;
this._offset = offset;
this._model = model;
}
//
// Genes
//
private uint extract_gene(uint gene_idx)
{
if (gene_idx >= 9)
{
BugCheck.bug_check(BugCheck.ErrorCode.MON_GENE_IDX_OVERFLOW, "Invalid gene index: " + gene_idx);
}
return Model.byte_to_uint16_le(_model.save_file,
_offset + gene_idx * _size);
}
private void set_gene_str(uint gene_idx, string val)
{
uint parsed;
if (Model.parse_hex_string(val, out parsed))
{
set_gene(gene_idx, parsed);
}
else
{
MessageBox.Show("Malformed gene value - must be 0x0 to 0xFFFF.", "Error", MessageBoxButton.OK,
MessageBoxImage.Error);
}
}
private void set_gene(uint gene_idx, uint val)
{
if (gene_idx >= 9)
{
BugCheck.bug_check(BugCheck.ErrorCode.MON_GENE_IDX_OVERFLOW, "Invalid gene index: " + gene_idx);
}
if (val <= 0xFFFF)
{
Model.write_uint16_le(_model.save_file, _offset + gene_idx * _size,
val);
}
else
{
MessageBox.Show("Malformed gene value - must be 0x0 to 0xFFFF.", "Error", MessageBoxButton.OK,
MessageBoxImage.Error);
}
}
private int extract_gene_idx(uint gene_idx)
{
uint gene_id = extract_gene(gene_idx);
int idx = GENE_ID.IndexOf(gene_id);
if (idx == -1)
{
// unknown
return GENE_NAME.Count - 1;
}
return idx;
}
private void set_gene_idx(uint gene_idx, int val)
{
if (val != -1 && val != GENE_NAME.Count - 1)
{
set_gene(gene_idx, GENE_ID.ElementAt(val));
}
}
public int gene1_selected
{
get => extract_gene_idx(0);
set
{
set_gene_idx(0, value);
OnPropertyChanged(nameof(gene1));
OnPropertyChanged(nameof(gene1_selected));
}
}
public string gene1
{
get => extract_gene(0).ToString("X4");
set
{
set_gene_str(0, value);
OnPropertyChanged(nameof(gene1));
OnPropertyChanged(nameof(gene1_selected));
}
}
public int gene2_selected
{
get => extract_gene_idx(1);
set
{
set_gene_idx(1, value);
OnPropertyChanged(nameof(gene2));
OnPropertyChanged(nameof(gene2_selected));
}
}
public string gene2
{
get => extract_gene(1).ToString("X4");
set
{
set_gene_str(1, value);
OnPropertyChanged(nameof(gene2));
OnPropertyChanged(nameof(gene2_selected));
}
}
public int gene3_selected
{
get => extract_gene_idx(2);
set
{
set_gene_idx(2, value);
OnPropertyChanged(nameof(gene3));
OnPropertyChanged(nameof(gene3_selected));
}
}
public string gene3
{
get => extract_gene(2).ToString("X4");
set
{
set_gene_str(2, value);
OnPropertyChanged(nameof(gene3));
OnPropertyChanged(nameof(gene3_selected));
}
}
public int gene4_selected
{
get => extract_gene_idx(3);
set
{
set_gene_idx(3, value);
OnPropertyChanged(nameof(gene4));
OnPropertyChanged(nameof(gene4_selected));
}
}
public string gene4
{
get => extract_gene(3).ToString("X4");
set
{
set_gene_str(3, value);
OnPropertyChanged(nameof(gene4));
OnPropertyChanged(nameof(gene4_selected));
}
}
public int gene5_selected
{
get => extract_gene_idx(4);
set
{
set_gene_idx(4, value);
OnPropertyChanged(nameof(gene5));
OnPropertyChanged(nameof(gene5_selected));
}
}
public string gene5
{
get => extract_gene(4).ToString("X4");
set
{
set_gene_str(4, value);
OnPropertyChanged(nameof(gene5));
OnPropertyChanged(nameof(gene5_selected));
}
}
public int gene6_selected
{
get => extract_gene_idx(5);
set
{
set_gene_idx(5, value);
OnPropertyChanged(nameof(gene6));
OnPropertyChanged(nameof(gene6_selected));
}
}
public string gene6
{
get => extract_gene(5).ToString("X4");
set
{
set_gene_str(5, value);
OnPropertyChanged(nameof(gene6));
OnPropertyChanged(nameof(gene6_selected));
}
}
public int gene7_selected
{
get => extract_gene_idx(6);
set
{
set_gene_idx(6, value);
OnPropertyChanged(nameof(gene7));
OnPropertyChanged(nameof(gene7_selected));
}
}
public string gene7
{
get => extract_gene(6).ToString("X4");
set
{
set_gene_str(6, value);
OnPropertyChanged(nameof(gene7));
OnPropertyChanged(nameof(gene7_selected));
}
}
public int gene8_selected
{
get => extract_gene_idx(7);
set
{
set_gene_idx(7, value);
OnPropertyChanged(nameof(gene8));
OnPropertyChanged(nameof(gene8_selected));
}
}
public string gene8
{
get => extract_gene(7).ToString("X4");
set
{
set_gene_str(7, value);
OnPropertyChanged(nameof(gene8));
OnPropertyChanged(nameof(gene8_selected));
}
}
public int gene9_selected
{
get => extract_gene_idx(8);
set
{
set_gene_idx(8, value);
OnPropertyChanged(nameof(gene9));
OnPropertyChanged(nameof(gene9_selected));
}
}
public string gene9
{
get => extract_gene(8).ToString("X4");
set
{
set_gene_str(8, value);
OnPropertyChanged(nameof(gene9));
OnPropertyChanged(nameof(gene9_selected));
}
}
public static void read_gene_mapping()
{
string line;
StringReader file = new StringReader(Properties.Resources.gene);
while ((line = file.ReadLine()) != null)
{
if (line.Length == 0)
continue;
string[] eachline = line.Split('\t');
if (eachline.Length != 2)
{
BugCheck.bug_check(BugCheck.ErrorCode.MON_GENE_MAPPING_CORRUPTED,
"Invalid gene mapping file line:\n" + line);
}
GENE_ID.Add(uint.Parse(eachline[0], System.Globalization.NumberStyles.HexNumber));
GENE_NAME.Add(eachline[1]);
}
GENE_NAME.Add("Custom");
file.Close();
}
public event PropertyChangedEventHandler PropertyChanged;
[NotifyPropertyChangedInvocator]
protected virtual void OnPropertyChanged(string propertyName)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
}

View File

@ -8,7 +8,7 @@ using MHSEC_G.Annotations;
namespace MHSEC_G
{
internal class Item : INotifyPropertyChanged
public class Item : INotifyPropertyChanged
{
private static readonly uint OFFSETA_ITEM_BOX = 0x10;
private static readonly uint SIZE_ITEM = 0x8;

View File

@ -86,9 +86,16 @@
<Compile Include="Character.cs" />
<Compile Include="Egg.cs" />
<Compile Include="EggFragment.cs" />
<Compile Include="Genes.cs" />
<Compile Include="GeneWindow.xaml.cs">
<DependentUpon>GeneWindow.xaml</DependentUpon>
</Compile>
<Compile Include="Item.cs" />
<Compile Include="Model.cs" />
<Compile Include="Monster.cs" />
<Compile Include="MonsterWindow.xaml.cs">
<DependentUpon>MonsterWindow.xaml</DependentUpon>
</Compile>
<Compile Include="Properties\Annotations.cs" />
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
@ -96,8 +103,11 @@
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="Talisman.cs" />
<Compile Include="ViewModel.cs" />
<Compile Include="Weapon.cs" />
<Page Include="GeneWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="MainWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
@ -110,6 +120,10 @@
<DependentUpon>MainWindow.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Page Include="MonsterWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs">
@ -133,6 +147,8 @@
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<AppDesigner Include="Properties\" />
<None Include="Resources\egg_dummy_template.bin" />
<None Include="Resources\egg_null_template.bin" />
<None Include="Resources\monster_null_template.bin" />
</ItemGroup>
<ItemGroup>

View File

@ -5,38 +5,42 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:MHSEC_G"
mc:Ignorable="d"
Title="" Height="447.855" Width="810.218" ResizeMode="NoResize" Icon="Resources/MainIcon.ico">
<Grid HorizontalAlignment="Left" Width="800" Margin="0,0,0,-0.5">
Title="" Height="447.855" Width="474.968" ResizeMode="NoResize" Icon="Resources/MainIcon.ico">
<Grid HorizontalAlignment="Left" Width="465" Margin="0,0,0,-0.5">
<TabControl x:Name="tabControl" HorizontalAlignment="Left" Height="344" Margin="10,51,0,0"
VerticalAlignment="Top" Width="780">
<TabItem Header="Character/Items">
<TabControl x:Name="tabControl" HorizontalAlignment="Left" Height="375" Margin="10,35,0,0"
VerticalAlignment="Top" Width="443">
<TabItem Header="Character">
<Grid Background="#FFE5E5E5" Margin="0,0,0,0">
<Label x:Name="label_name" Content="Name" HorizontalAlignment="Left" Margin="10,42,0,0"
<Label x:Name="label_name" Content="Name" HorizontalAlignment="Left" Margin="14,10,0,0"
VerticalAlignment="Top" />
<Label x:Name="label_money" Content="Money" HorizontalAlignment="Left" Margin="4,69,0,0"
<Label x:Name="label_money" Content="Money" HorizontalAlignment="Left" Margin="10,41,0,0"
VerticalAlignment="Top" RenderTransformOrigin="0.957,0.5" />
<Label x:Name="label_leve" Content="Level" HorizontalAlignment="Left" Margin="18,70,0,0"
VerticalAlignment="Top" />
<Label x:Name="label_leve" Content="Level" HorizontalAlignment="Left" Margin="14,95,0,0"
<Label x:Name="label_exp" Content="Exp" HorizontalAlignment="Left" Margin="26,99,0,0"
VerticalAlignment="Top" />
<Label x:Name="label_exp" Content="Exp" HorizontalAlignment="Left" Margin="22,121,0,0"
VerticalAlignment="Top" />
<TextBox x:Name="textbox_name" HorizontalAlignment="Left" Height="22" Margin="61,44,0,0"
<TextBox x:Name="textbox_name" HorizontalAlignment="Left" Height="22" Margin="56,14,0,0"
TextWrapping="NoWrap" VerticalAlignment="Top" Width="120" Text="{Binding character.name}" />
<TextBox x:Name="textbox_money" HorizontalAlignment="Left" Height="22" Margin="61,72,0,0"
<TextBox x:Name="textbox_money" HorizontalAlignment="Left" Height="22" Margin="56,45,0,0"
TextWrapping="NoWrap" VerticalAlignment="Top" Width="120" Text="{Binding character.money}" />
<TextBox x:Name="textbox_level" HorizontalAlignment="Left" Height="22" Margin="61,99,0,0"
<TextBox x:Name="textbox_level" HorizontalAlignment="Left" Height="22" Margin="56,74,0,0"
TextWrapping="NoWrap" VerticalAlignment="Top" Width="120" Text="{Binding character.level}" />
<TextBox x:Name="textbox_exp" HorizontalAlignment="Left" Height="22" Margin="61,126,0,0"
<TextBox x:Name="textbox_exp" HorizontalAlignment="Left" Height="22" Margin="56,103,0,0"
TextWrapping="NoWrap" VerticalAlignment="Top" Width="120" Text="{Binding character.exp}" />
<Button x:Name="button_char_money" Content="Max Money" HorizontalAlignment="Left"
Margin="200,73,0,0" VerticalAlignment="Top" Width="88" RenderTransformOrigin="0.065,-0.953"
Margin="190,45,0,0" VerticalAlignment="Top" Width="88" RenderTransformOrigin="0.065,-0.953"
Height="22" Click="button_char_money_Click" />
<Button x:Name="button_char_exp" Content="Max Exp" HorizontalAlignment="Left" Margin="200,126,0,0"
<Button x:Name="button_char_exp" Content="Max Exp" HorizontalAlignment="Left" Margin="190,103,0,0"
VerticalAlignment="Top" Width="88" RenderTransformOrigin="0.065,-0.953" Height="22"
Click="button_char_exp_Click" />
</Grid>
</TabItem>
<TabItem Header="Items">
<Grid Background="#FFE5E5E5" HorizontalAlignment="Left" Width="442" Margin="0,0,-5,0">
<DataGrid x:Name="item_table_Copy" ItemsSource="{Binding items}" HorizontalAlignment="Left"
Margin="349,44,0,0" VerticalAlignment="Top" Height="258" Width="415"
CanUserAddRows="False" AutoGenerateColumns="False">
Margin="10,48,0,0" VerticalAlignment="Top" Height="269" Width="415"
CanUserAddRows="False" AutoGenerateColumns="False" SelectionMode="Single">
<DataGrid.Columns>
<DataGridTextColumn CanUserReorder="False" CanUserResize="False" CanUserSort="True"
Width="80" Foreground="Gray" IsReadOnly="True" Binding="{Binding offset, StringFormat=\{0:X4\}}"
@ -53,273 +57,153 @@
Header="Count" />
</DataGrid.Columns>
</DataGrid>
<Button x:Name="button_item_all_Copy" Content="All 986x" HorizontalAlignment="Left" Margin="579,6,0,0"
<Button x:Name="button_item_all_Copy" Content="All 986x" HorizontalAlignment="Left" Margin="10,10,0,0"
VerticalAlignment="Top" Width="90" RenderTransformOrigin="0.065,-0.953" Height="30"
Click="button_item_all_Click" />
<Button x:Name="button_item_existing_Copy" Content="Existing 999x" HorizontalAlignment="Left"
Margin="674,6,0,0" VerticalAlignment="Top" Width="90"
Margin="105,10,0,0" VerticalAlignment="Top" Width="90"
RenderTransformOrigin="0.065,-0.953" Height="30" Click="button_item_existing_Click" />
<Label x:Name="label_items" Content="Items" HorizontalAlignment="Left" Margin="349,6,0,0" VerticalAlignment="Top" FontSize="18"/>
<Label x:Name="label_character" Content="Character" HorizontalAlignment="Left" Margin="10,5,0,0" VerticalAlignment="Top" FontSize="18"/>
</Grid>
</TabItem>
<TabItem Header="Eggs/Fragments">
<TabItem Header="Egg Fragments">
<Grid Background="#FFE5E5E5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="244*"/>
<ColumnDefinition Width="143*"/>
<ColumnDefinition/>
<ColumnDefinition Width="0*"/>
</Grid.ColumnDefinitions>
<DataGrid x:Name="egg_frag_grid" HorizontalAlignment="Left" Margin="10,35,0,0"
VerticalAlignment="Top" Height="271" Width="361" CanUserAddRows="False"
AutoGenerateColumns="False" ItemsSource="{Binding Path=egg_fragments}">
<DataGrid x:Name="egg_frag_grid" HorizontalAlignment="Left" Margin="10,10,0,0"
VerticalAlignment="Top" Height="307" Width="417" CanUserAddRows="False"
AutoGenerateColumns="False" SelectionMode="Single" ItemsSource="{Binding Path=egg_fragments}">
<DataGrid.Columns>
<DataGridTextColumn CanUserReorder="False" CanUserResize="False" CanUserSort="False"
Width="60" Binding="{Binding spe}"
Width="50" Binding="{Binding idx}"
Header="Index" IsReadOnly="True"/>
<DataGridTextColumn CanUserReorder="False" CanUserResize="False" CanUserSort="False"
Width="50" Binding="{Binding spe}"
Header="Species" />
<DataGridTextColumn CanUserReorder="False" CanUserResize="False" CanUserSort="False"
Width="60" Binding="{Binding pos}"
Header="Position" />
<DataGridTextColumn CanUserReorder="False" CanUserResize="False" CanUserSort="False"
Width="40" Binding="{Binding new_flag}"
Header="New?" />
Header="New" />
<DataGridTextColumn CanUserReorder="False" CanUserResize="False" CanUserSort="False"
Width="40" Binding="{Binding rarity}"
Header="Rarity" />
<DataGridTextColumn CanUserReorder="False" CanUserResize="False" CanUserSort="False"
Width="40" Binding="{Binding color}"
Width="*" Binding="{Binding color}"
Header="Color" />
<DataGridTextColumn CanUserReorder="False" CanUserResize="False" CanUserSort="False"
Width="40" Binding="{Binding dlc}"
Width="*" Binding="{Binding dlc}"
Header="DLC" />
<DataGridTextColumn CanUserReorder="False" CanUserResize="False" CanUserSort="False"
Width="40" Binding="{Binding unknown_7h}"
Width="*" Binding="{Binding unknown_7h}"
Header="0x6" />
<DataGridTextColumn CanUserReorder="False" CanUserResize="False" CanUserSort="False"
Width="*" Binding="{Binding unknown_6h}"
Header="0x7" />
</DataGrid.Columns>
</DataGrid>
<Button x:Name="button_give_dino" Content="Give Dinovaldo" HorizontalAlignment="Left"
Margin="385,175,0,0" VerticalAlignment="Top" Width="110" Height="30"
Click="button_give_dino_Click" Grid.ColumnSpan="2" />
<Button x:Name="button_give_epony" Content="Give Epony" HorizontalAlignment="Left"
Margin="385,35,0,0" VerticalAlignment="Top" Width="110" Height="30"
Click="button_give_epony_Click" Grid.ColumnSpan="2" />
<Button x:Name="button_give_bear" Content="Give Mascot" HorizontalAlignment="Left"
Margin="385,70,0,0" VerticalAlignment="Top" Width="110" Height="30"
Click="button_give_bear_Click" Grid.ColumnSpan="2" />
<Button x:Name="button_give_mtiggy" Content="Give Molten Tigrex" HorizontalAlignment="Left"
Margin="385,105,0,0" VerticalAlignment="Top" Width="110" Height="30"
Click="button_give_mtiggy_Click" Grid.ColumnSpan="2" />
<Button x:Name="button_give_okirin" Content="Give Oroshi Kirin" HorizontalAlignment="Left"
Margin="385,140,0,0" VerticalAlignment="Top" Width="110" Height="30"
Click="button_give_okirin_Click" Grid.ColumnSpan="2" />
<Button x:Name="button_give_pd" Content="Give Puzzle Dragon" HorizontalAlignment="Left"
Margin="385,210,0,0" VerticalAlignment="Top" Width="110" Height="30"
Click="button_give_pd_Click" Grid.ColumnSpan="2" />
<Button x:Name="button_give_wm" Content="Give W. Monoblos" HorizontalAlignment="Left"
Margin="385,245,0,0" VerticalAlignment="Top" Width="110" Height="30"
Click="button_give_wm_Click" Grid.ColumnSpan="2" />
<Button x:Name="button_eggf_new" IsEnabled="False" Content="New" HorizontalAlignment="Left" Margin="216,10,0,0" VerticalAlignment="Top" Width="75"/>
<Button x:Name="button_eggf_delete" IsEnabled="False" Content="Delete" HorizontalAlignment="Left" Margin="296,10,0,0" VerticalAlignment="Top" Width="75"/>
<DataGrid x:Name="egg_grid" HorizontalAlignment="Left" Margin="39,35,0,0"
VerticalAlignment="Top" Height="271" Width="237" CanUserAddRows="False"
AutoGenerateColumns="False" ItemsSource="{Binding eggs}" Grid.Column="1">
</Grid>
</TabItem>
<TabItem Header="Eggs">
<Grid Background="#FFE5E5E5">
<DataGrid x:Name="egg_grid" HorizontalAlignment="Left" Margin="10,30,0,0"
VerticalAlignment="Top" Height="287" Width="417" CanUserAddRows="False"
AutoGenerateColumns="False" ItemsSource="{Binding eggs}" SelectionMode="Single">
<DataGrid.RowStyle>
<Style TargetType="{x:Type DataGridRow}">
<EventSetter Event="MouseDoubleClick" Handler="Egg_grid_OnMouseDoubleClick"/>
</Style>
</DataGrid.RowStyle>
<DataGrid.Columns>
<DataGridTextColumn CanUserReorder="False" CanUserResize="False" CanUserSort="False"
Width="100" Binding="{Binding spe}"
Header="Species" />
Width="40" Binding="{Binding index}"
Header="Index" IsReadOnly="True"/>
<DataGridTextColumn CanUserReorder="False" CanUserResize="False" CanUserSort="False"
Width="*" Binding="{Binding spe}"
Header="Hatched Monster Type" />
<DataGridTextColumn CanUserReorder="False" CanUserResize="False" CanUserSort="False"
Width="*" Binding="{Binding wgt}"
Header="Weight" />
</DataGrid.Columns>
</DataGrid>
<Label x:Name="label1" Content="Eggs" Grid.Column="1" HorizontalAlignment="Left" Margin="39,1,0,0" VerticalAlignment="Top" FontSize="18"/>
<Label x:Name="label1_Copy" Content="Egg Fragments" HorizontalAlignment="Left" Margin="10,0,0,0" VerticalAlignment="Top" FontSize="18"/>
<Label x:Name="label_monster_Copy" Content="Double-click an entry to edit genes." HorizontalAlignment="Left" Margin="10,4,0,0" VerticalAlignment="Top" RenderTransformOrigin="0.184,0.019"/>
<Button x:Name="button_eggs_delete" Content="Delete" HorizontalAlignment="Left" Margin="353,5,0,0" VerticalAlignment="Top" Width="74" RenderTransformOrigin="1.601,-0.2" Click="button_eggs_delete_Click"/>
<Button x:Name="button_eggs_dummy" Content="Set Dummy Egg" HorizontalAlignment="Left" Margin="240,5,0,0" VerticalAlignment="Top" Width="108" RenderTransformOrigin="1.601,-0.2" Click="button_eggs_dummy_Click"/>
</Grid>
</TabItem>
<TabItem Header="Monsters" Margin="0,0,0,0">
<Grid Background="#FFE5E5E5">
<Label x:Name="label_mhp" Content="HP" HorizontalAlignment="Left" Margin="10,85,0,0"
VerticalAlignment="Top" RenderTransformOrigin="0.564,2.072" />
<Label x:Name="label_mat" Content="Atk" HorizontalAlignment="Left" Margin="10,115,0,0"
VerticalAlignment="Top" RenderTransformOrigin="0.564,2.072" />
<Label x:Name="label_mdf" Content="Def" HorizontalAlignment="Left" Margin="10,145,0,0"
VerticalAlignment="Top" RenderTransformOrigin="0.564,2.072" />
<Label x:Name="label_mhiv" Content="IV-HP" HorizontalAlignment="Left" Margin="10,175,0,0"
VerticalAlignment="Top" RenderTransformOrigin="0.564,2.072" />
<Label x:Name="label_mdiv" Content="IV-Atk" HorizontalAlignment="Left" Margin="10,205,0,0"
VerticalAlignment="Top" RenderTransformOrigin="0.564,2.072" />
<Label x:Name="label_maiv" Content="IV-Def" HorizontalAlignment="Left" Margin="10,235,0,0"
VerticalAlignment="Top" RenderTransformOrigin="0.564,2.072" />
<Label x:Name="label_mhpu" Content="PowerUp-HP" HorizontalAlignment="Left" Margin="150,175,0,0"
VerticalAlignment="Top" RenderTransformOrigin="0.564,2.072" />
<Label x:Name="label_mapu" Content="PowerUp-Atk" HorizontalAlignment="Left" Margin="150,205,0,0"
VerticalAlignment="Top" RenderTransformOrigin="0.564,2.072" />
<Label x:Name="label_mdpu" Content="PowerUp-Def" HorizontalAlignment="Left" Margin="150,235,0,0"
VerticalAlignment="Top" RenderTransformOrigin="0.564,2.072" />
<Label x:Name="label_mgen1" Content="Gene 1 (Hex)" HorizontalAlignment="Left"
VerticalAlignment="Top" Margin="364,31,0,0" />
<Label x:Name="label_mgen2" Content="Gene 2 (Hex)" HorizontalAlignment="Left"
VerticalAlignment="Top" Margin="505,31,0,0" />
<Label x:Name="label_mgen3" Content="Gene 3 (Hex)" HorizontalAlignment="Left"
VerticalAlignment="Top" Margin="652,31,0,0" RenderTransformOrigin="0.537,0.19" />
<Label x:Name="label_mgen4" Content="Gene 4 (Hex)" HorizontalAlignment="Left"
VerticalAlignment="Top" Margin="364,117,0,0" />
<Label x:Name="label_mgen5" Content="Gene 5 (Hex)" HorizontalAlignment="Left"
VerticalAlignment="Top" Margin="505,117,0,0" RenderTransformOrigin="0.524,0.439" />
<Label x:Name="label_mgen6" Content="Gene 6 (Hex)" HorizontalAlignment="Left"
VerticalAlignment="Top" Margin="652,117,0,0" />
<Label x:Name="label_mgen7" Content="Gene 7 (Hex)" HorizontalAlignment="Left"
VerticalAlignment="Top" Margin="364,205,0,0" />
<Label x:Name="label_mgen8" Content="Gene 8 (Hex)" HorizontalAlignment="Left"
VerticalAlignment="Top" Margin="505,207,0,0" />
<Label x:Name="label_mgen9" Content="Gene 9 (Hex)" HorizontalAlignment="Left"
VerticalAlignment="Top" Margin="652,207,0,0" />
<TextBox x:Name="textbox_mhp" HorizontalAlignment="Left" Height="23" Margin="60,87,0,0"
TextWrapping="Wrap" Text="{Binding Path=cur_monster.hp}" VerticalAlignment="Top"
Width="75" />
<TextBox x:Name="textbox_mat" HorizontalAlignment="Left" Height="23" Margin="60,117,0,0"
TextWrapping="Wrap" Text="{Binding Path=cur_monster.atk}" VerticalAlignment="Top"
Width="75" />
<TextBox x:Name="textbox_mdf" HorizontalAlignment="Left" Height="23" Margin="60,147,0,0"
TextWrapping="Wrap" Text="{Binding Path=cur_monster.def}" VerticalAlignment="Top"
Width="75" />
<TextBox x:Name="textbox_mhiv" HorizontalAlignment="Left" Height="23" Margin="60,177,0,0"
TextWrapping="Wrap" Text="{Binding Path=cur_monster.hiv}" VerticalAlignment="Top"
Width="75" />
<TextBox x:Name="textbox_maiv" HorizontalAlignment="Left" Height="23" Margin="60,207,0,0"
TextWrapping="Wrap" Text="{Binding Path=cur_monster.aiv}" VerticalAlignment="Top"
Width="75" />
<TextBox x:Name="textbox_mdiv" HorizontalAlignment="Left" Height="23" Margin="60,237,0,0"
TextWrapping="Wrap" Text="{Binding Path=cur_monster.div}" VerticalAlignment="Top"
Width="75" />
<TextBox x:Name="textbox_mhpu" HorizontalAlignment="Left" Height="23" Margin="240,177,0,0"
TextWrapping="Wrap" Text="{Binding Path=cur_monster.hpu}" VerticalAlignment="Top"
Width="75" />
<TextBox x:Name="textbox_mapu" HorizontalAlignment="Left" Height="23" Margin="240,207,0,0"
TextWrapping="Wrap" Text="{Binding Path=cur_monster.apu}" VerticalAlignment="Top"
Width="75" />
<TextBox x:Name="textbox_mdpu" HorizontalAlignment="Left" Height="23" Margin="240,237,0,0"
TextWrapping="Wrap" Text="{Binding Path=cur_monster.dpu}" VerticalAlignment="Top"
Width="75" />
<TextBox x:Name="textbox_gene1" HorizontalAlignment="Left" Height="22" TextWrapping="Wrap"
Text="{Binding Path=cur_monster.gene1}" VerticalAlignment="Top" Width="129"
Margin="336,58,0,0" />
<TextBox x:Name="textbox_gene2" HorizontalAlignment="Left" Height="22" TextWrapping="Wrap"
Text="{Binding Path=cur_monster.gene2}" VerticalAlignment="Top" Width="129"
Margin="480,58,0,0" />
<TextBox x:Name="textbox_gene3" HorizontalAlignment="Left" Height="22" TextWrapping="Wrap"
Text="{Binding Path=cur_monster.gene3}" VerticalAlignment="Top" Width="129"
Margin="625,58,0,0" />
<TextBox x:Name="textbox_gene4" HorizontalAlignment="Left" Height="23" TextWrapping="Wrap"
Text="{Binding Path=cur_monster.gene4}" VerticalAlignment="Top" Width="127"
Margin="338,147,0,0" />
<TextBox x:Name="textbox_gene5" HorizontalAlignment="Left" Height="23" TextWrapping="Wrap"
Text="{Binding Path=cur_monster.gene5}" VerticalAlignment="Top" Width="129"
Margin="480,147,0,0" />
<TextBox x:Name="textbox_gene6" HorizontalAlignment="Left" Height="23" TextWrapping="Wrap"
Text="{Binding Path=cur_monster.gene6}" VerticalAlignment="Top" Width="128"
Margin="626,147,0,0" />
<TextBox x:Name="textbox_gene7" HorizontalAlignment="Left" Height="23" TextWrapping="Wrap"
Text="{Binding Path=cur_monster.gene7}" VerticalAlignment="Top" Width="125"
Margin="338,237,0,0" />
<TextBox x:Name="textbox_gene8" HorizontalAlignment="Left" Height="23" TextWrapping="Wrap"
Text="{Binding Path=cur_monster.gene8}" VerticalAlignment="Top" Width="129"
Margin="480,237,0,0" />
<TextBox x:Name="textbox_gene9" HorizontalAlignment="Left" Height="23" TextWrapping="Wrap"
Text="{Binding Path=cur_monster.gene9}" VerticalAlignment="Top" Width="128"
Margin="626,237,0,0" RenderTransformOrigin="0.55,-0.239" />
<Label x:Name="label_mlv" Content="Level" HorizontalAlignment="Left" Margin="191,84,0,0"
VerticalAlignment="Top" RenderTransformOrigin="-0.263,0.135" />
<Label x:Name="label_mex" Content="Exp" HorizontalAlignment="Left" Margin="150,115,0,0"
VerticalAlignment="Top" RenderTransformOrigin="-0.263,0.135" />
<Label x:Name="label_spe" Content="Species (Hex)" HorizontalAlignment="Left" Margin="150,145,0,0"
VerticalAlignment="Top" RenderTransformOrigin="-0.263,0.135" />
<TextBox x:Name="textbox_mlv" HorizontalAlignment="Left" Height="24" Margin="240,87,0,0"
TextWrapping="Wrap" Text="{Binding Path=cur_monster.level}" VerticalAlignment="Top"
Width="75" />
<TextBox x:Name="textbox_mex" HorizontalAlignment="Left" Height="24" Margin="240,117,0,0"
TextWrapping="Wrap" Text="{Binding Path=cur_monster.exp}" VerticalAlignment="Top"
Width="75" />
<TextBox x:Name="textbox_spe" HorizontalAlignment="Left" Height="24" Margin="240,147,0,0"
TextWrapping="Wrap" Text="{Binding Path=cur_monster.spe, StringFormat={}{0:X2}}" VerticalAlignment="Top"
Width="75"/>
<Label x:Name="label_mname" Content="Name" HorizontalAlignment="Left" Margin="10,54,0,0"
VerticalAlignment="Top" />
<TextBox x:Name="textbox_mname" HorizontalAlignment="Left" Height="22" Margin="60,58,0,0"
TextWrapping="Wrap" Text="{Binding Path=cur_monster.name}" VerticalAlignment="Top"
Width="118" />
<Label x:Name="label_slct" Content="Monster" HorizontalAlignment="Left" Margin="2,10,0,0"
VerticalAlignment="Top" RenderTransformOrigin="0.466,0.596" />
<ComboBox x:Name="combobox_slct" HorizontalAlignment="Left" Margin="60,10,0,0"
VerticalAlignment="Top" Width="168" ItemsSource="{Binding Path=monsters}"
DisplayMemberPath="full_name" IsReadOnly="True"
SelectedValue="{Binding Path=cur_monster}" />
<Label x:Name="label_m_warn" Content="Warning: The sum of PowerUps should be at most 10."
HorizontalAlignment="Left" Margin="12,265,0,0" VerticalAlignment="Top" />
<TextBlock x:Name="textblock_gene101" HorizontalAlignment="Left" Margin="338,10,0,0"
TextWrapping="Wrap"
Text="Do NOT use genes that start with &quot;[D]&quot; They are potentially game-crashing."
VerticalAlignment="Top" />
<Button x:Name="button_mexp" Content="Max" HorizontalAlignment="Left" Margin="193,119,0,0"
VerticalAlignment="Top" Width="35" Click="button_mexp_Click" />
<Button x:Name="button_mdel" Content="Delete" HorizontalAlignment="Left" Margin="239,10,0,0" VerticalAlignment="Top" Width="76" Click="button_mdel_Click"/>
<Label x:Name="label" Content="Don't delete monsters currently in your party." HorizontalAlignment="Left" Margin="60,30,0,0" VerticalAlignment="Top"/>
<ComboBox x:Name="comboBox_gene1" HorizontalAlignment="Left" Margin="336,89,0,0" VerticalAlignment="Top" Width="129" ItemsSource="{Binding gene_name}" SelectedIndex="{Binding Path=cur_monster.gene1_selected}"/>
<ComboBox x:Name="comboBox_gene2" HorizontalAlignment="Left" Margin="480,89,0,0" VerticalAlignment="Top" Width="129" ItemsSource="{Binding gene_name}" SelectedIndex="{Binding Path=cur_monster.gene2_selected}"/>
<ComboBox x:Name="comboBox_gene3" HorizontalAlignment="Left" Margin="625,89,0,0" VerticalAlignment="Top" Width="129" RenderTransformOrigin="0.488,0.068" Height="22" ItemsSource="{Binding gene_name}" SelectedIndex="{Binding Path=cur_monster.gene3_selected}"/>
<ComboBox x:Name="comboBox_gene4" HorizontalAlignment="Left" Margin="338,179,0,0" VerticalAlignment="Top" Width="125" ItemsSource="{Binding gene_name}" SelectedIndex="{Binding Path=cur_monster.gene4_selected}"/>
<ComboBox x:Name="comboBox_gene5" HorizontalAlignment="Left" Margin="480,179,0,0" VerticalAlignment="Top" Width="129" ItemsSource="{Binding gene_name}" SelectedIndex="{Binding Path=cur_monster.gene5_selected}"/>
<ComboBox x:Name="comboBox_gene6" HorizontalAlignment="Left" Margin="625,179,0,0" VerticalAlignment="Top" Width="129" ItemsSource="{Binding gene_name}" SelectedIndex="{Binding Path=cur_monster.gene6_selected}"/>
<ComboBox x:Name="comboBox_gene7" HorizontalAlignment="Left" Margin="338,269,0,0" VerticalAlignment="Top" Width="125" ItemsSource="{Binding gene_name}" SelectedIndex="{Binding Path=cur_monster.gene7_selected}"/>
<ComboBox x:Name="comboBox_gene8" HorizontalAlignment="Left" Margin="480,269,0,0" VerticalAlignment="Top" Width="129" ItemsSource="{Binding gene_name}" SelectedIndex="{Binding Path=cur_monster.gene8_selected}"/>
<ComboBox x:Name="comboBox_gene9" HorizontalAlignment="Left" Margin="625,269,0,0" VerticalAlignment="Top" Width="129" ItemsSource="{Binding gene_name}" SelectedIndex="{Binding Path=cur_monster.gene9_selected}"/>
<Label x:Name="label_mon_skill" Content="Skill (X)" HorizontalAlignment="Left" Margin="184,54,0,0" VerticalAlignment="Top"/>
<TextBox x:Name="textbox_mon_skill" HorizontalAlignment="Left" Height="24" Margin="240,58,0,0"
TextWrapping="Wrap" Text="{Binding cur_monster.skill}" VerticalAlignment="Top"
Width="75" />
<DataGrid x:Name="monster_grid" HorizontalAlignment="Left" Margin="10,24,0,0" IsReadOnly="True"
VerticalAlignment="Top" Height="293" Width="414" CanUserAddRows="False"
AutoGenerateColumns="False" SelectionMode="Single" ItemsSource="{Binding monsters}">
<DataGrid.RowStyle>
<Style TargetType="{x:Type DataGridRow}">
<EventSetter Event="MouseDoubleClick" Handler="Monster_grid_OnMouseDoubleClick"/>
</Style>
</DataGrid.RowStyle>
<DataGrid.Columns>
<DataGridTextColumn CanUserReorder="False" CanUserResize="False" CanUserSort="False"
Width="40" Binding="{Binding box}"
Header="Box"/>
<DataGridTextColumn CanUserReorder="False" CanUserResize="False" CanUserSort="False"
Width="40" Binding="{Binding slot}"
Header="Slot"/>
<DataGridTextColumn CanUserReorder="False" CanUserResize="False" CanUserSort="False"
Width="250" Binding="{Binding name}"
Header="Name" />
<DataGridTextColumn CanUserReorder="False" CanUserResize="False" CanUserSort="False"
Width="*" Binding="{Binding level}"
Header="Level" />
</DataGrid.Columns>
</DataGrid>
<Label x:Name="label_monster" Content="Double-click an entry to edit." HorizontalAlignment="Left" Margin="10,0,0,0" VerticalAlignment="Top" RenderTransformOrigin="0.184,0.019"/>
</Grid>
</TabItem>
<TabItem Header="Talismans" Margin="0,0,0,0">
<Grid Background="#FFE5E5E5">
<DataGrid x:Name="datagrid_tali" HorizontalAlignment="Left" Margin="10,35,0,0"
VerticalAlignment="Top" Height="271" Width="556" CanUserAddRows="False"
AutoGenerateColumns="False" ItemsSource="{Binding Path=talismans}">
<DataGrid x:Name="datagrid_tali" HorizontalAlignment="Left" Margin="10,10,0,0"
VerticalAlignment="Top" Height="307" Width="417" CanUserAddRows="False"
AutoGenerateColumns="False" ItemsSource="{Binding Path=talismans}" SelectionMode="Single">
<DataGrid.Columns>
<DataGridTextColumn CanUserReorder="False" CanUserResize="False" CanUserSort="False"
Width="80" Binding="{Binding id}"
Width="40" Binding="{Binding index}"
Header="Index" IsReadOnly="True" />
<DataGridTextColumn CanUserReorder="False" CanUserResize="False" CanUserSort="False"
Width="40" Binding="{Binding id}"
Header="ID" />
<DataGridTextColumn CanUserReorder="False" CanUserResize="False" CanUserSort="False"
Width="80" Binding="{Binding rarity}"
Width="40" Binding="{Binding rarity}"
Header="Rarity" />
<DataGridTextColumn CanUserReorder="False" CanUserResize="False" CanUserSort="False"
Width="80" Binding="{Binding new_flag}"
Header="New?" />
Width="40" Binding="{Binding new_flag}"
Header="New" />
<DataGridTextColumn CanUserReorder="False" CanUserResize="False" CanUserSort="False"
Width="80" Binding="{Binding equipped}"
Header="Equipped?" />
Width="70" Binding="{Binding equipped}"
Header="Equipped" />
<DataGridTextColumn CanUserReorder="False" CanUserResize="False" CanUserSort="False"
Width="80" Binding="{Binding skill1}"
Width="*" Binding="{Binding skill1}"
Header="Skill 1" />
<DataGridTextColumn CanUserReorder="False" CanUserResize="False" CanUserSort="False"
Width="*" Binding="{Binding skill2}"
Header="Skill 2" />
</DataGrid.Columns>
</DataGrid>
<Button x:Name="button_tali_new" Content="New" IsEnabled="False" HorizontalAlignment="Left" Margin="10,7,0,0" VerticalAlignment="Top" Width="75"/>
<Button x:Name="button_tali_delete" Content="Delete" IsEnabled="False" HorizontalAlignment="Left" Margin="100,7,0,0" VerticalAlignment="Top" Width="75"/>
</Grid>
</TabItem>
<TabItem Header="Weapons/Armors" Margin="0,0,0,0">
<TabItem Header="Weapons" Margin="0,0,0,0">
<Grid Background="#FFE5E5E5">
<DataGrid x:Name="datagrid_wpn" HorizontalAlignment="Left" Margin="10,35,0,0"
VerticalAlignment="Top" Height="271" Width="272" CanUserAddRows="False"
AutoGenerateColumns="False" ItemsSource="{Binding weapons}">
<DataGrid x:Name="datagrid_wpn" HorizontalAlignment="Left" Margin="10,10,0,0"
VerticalAlignment="Top" Height="307" Width="417" CanUserAddRows="False"
AutoGenerateColumns="False" ItemsSource="{Binding weapons}" SelectionMode="Single">
<DataGrid.Columns>
<DataGridTextColumn CanUserReorder="False" CanUserResize="False" CanUserSort="True"
<DataGridTextColumn CanUserReorder="False" CanUserResize="False" CanUserSort="False"
Width="40" Binding="{Binding index}"
Header="Index" IsReadOnly="True"/>
<DataGridTextColumn CanUserReorder="False" CanUserResize="False" CanUserSort="False"
Width="80" Binding="{Binding clazz}"
Header="Class" />
<DataGridTextColumn CanUserReorder="False" CanUserResize="False" CanUserSort="False"
@ -330,29 +214,34 @@
Header="Level" />
</DataGrid.Columns>
</DataGrid>
<Label x:Name="label_wa_wpn" Content="Weapons" HorizontalAlignment="Left" Margin="10,0,0,0" VerticalAlignment="Top" FontSize="18"/>
<DataGrid x:Name="datagrid_wa_armor" HorizontalAlignment="Left" Margin="355,35,0,0"
VerticalAlignment="Top" Height="271" Width="409" CanUserAddRows="False"
AutoGenerateColumns="False" ItemsSource="{Binding armors}">
</Grid>
</TabItem>
<TabItem Header="Armors" Margin="0,0,0,0">
<Grid Background="#FFE5E5E5">
<DataGrid x:Name="datagrid_wa_armor" HorizontalAlignment="Left" Margin="10,10,0,0"
VerticalAlignment="Top" Height="307" Width="417" CanUserAddRows="False"
AutoGenerateColumns="False" SelectionMode="Single" ItemsSource="{Binding armors}">
<DataGrid.Columns>
<DataGridTextColumn CanUserReorder="False" CanUserResize="False" CanUserSort="True"
Width="60" Binding="{Binding id}"
<DataGridTextColumn CanUserReorder="False" CanUserResize="False" CanUserSort="False"
Width="40" Binding="{Binding index}"
Header="Index" IsReadOnly="True"/>
<DataGridTextColumn CanUserReorder="False" CanUserResize="False" CanUserSort="False"
Width="50" Binding="{Binding id}"
Header="ID" />
<DataGridTextColumn CanUserReorder="False" CanUserResize="False" CanUserSort="False"
Width="60" Binding="{Binding level}"
Width="50" Binding="{Binding level}"
Header="Level" />
<DataGridTextColumn CanUserReorder="False" CanUserResize="False" CanUserSort="False"
Width="*" Binding="{Binding unknown_14h}"
Header="Unknown 14h" />
Header="Color1 (RGB)" />
<DataGridTextColumn CanUserReorder="False" CanUserResize="False" CanUserSort="False"
Width="*" Binding="{Binding unknown_18h}"
Header="Unknown 18h" />
Header="Color2 (RGB)" />
<DataGridTextColumn CanUserReorder="False" CanUserResize="False" CanUserSort="False"
Width="*" Binding="{Binding unknown_1ch}"
Header="Unknown 1Ch" />
</DataGrid.Columns>
</DataGrid>
<Label x:Name="label_wa_armor" Content="Armors" HorizontalAlignment="Left" Margin="355,1,0,0" VerticalAlignment="Top" FontSize="18" RenderTransformOrigin="4.647,1.074"/>
</Grid>
</TabItem>
</TabControl>
@ -360,10 +249,7 @@
VerticalAlignment="Top" Width="74" Click="button_save_Click" />
<Button x:Name="button_load" Content="Load" HorizontalAlignment="Left" Margin="90,10,0,0"
VerticalAlignment="Top" Width="74" Click="button_load_click" />
<DataGrid x:Name="dataGrid" HorizontalAlignment="Left" Height="100" Margin="1046,415,-390,-95.5"
VerticalAlignment="Top" Width="100" />
<Button x:Name="button_about" Content="About" HorizontalAlignment="Left" Margin="716,10,0,0" VerticalAlignment="Top" Width="74" Click="button_about_Click"/>
<Label x:Name="label_notes" Content="Please read the notes on the forum as they contain important information regarding editing." HorizontalAlignment="Left" Margin="217,7,0,0" VerticalAlignment="Top"/>
<Button x:Name="button_about" Content="About" HorizontalAlignment="Left" Margin="379,10,0,0" VerticalAlignment="Top" Width="74" Click="button_about_Click"/>
</Grid>
</Window>

View File

@ -1,23 +1,27 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Forms;
using System.Windows.Input;
using MHSEC_G.Annotations;
using MessageBox = System.Windows.MessageBox;
namespace MHSEC_G
{
public partial class MainWindow : Window
public partial class MainWindow : Window, INotifyPropertyChanged
{
private ViewModel view_model;
private readonly byte[] dummy_data = new byte[Model.SAVE_FILE_SIZE];
private readonly byte[] _dummy_data = new byte[Model.SAVE_FILE_SIZE];
private static string get_app_version()
{
Version v = Assembly.GetExecutingAssembly().GetName().Version;
string version = v.Major+ "." + v.Minor + v.Build;
string version = v.Major + "." + v.Minor + v.Build;
return version;
}
@ -26,11 +30,11 @@ namespace MHSEC_G
InitializeComponent();
button_save.IsEnabled = false;
Item.read_item_mappings();
Monster.read_gene_mapping();
Array.Clear(dummy_data, 0, dummy_data.Length);
Genes.read_gene_mapping();
Array.Clear(_dummy_data, 0, _dummy_data.Length);
this.Title = "MHSEC-G Ver " + get_app_version();
view_model = new ViewModel(dummy_data);
DataContext = view_model;
init(_dummy_data);
DataContext = this;
}
private void button_load_click(object sender, RoutedEventArgs e)
@ -51,8 +55,8 @@ namespace MHSEC_G
}
else
{
view_model = new ViewModel(buffer);
DataContext = view_model;
init(buffer);
OnPropertyChanged(null);
button_save.IsEnabled = true;
}
}
@ -60,17 +64,17 @@ namespace MHSEC_G
private void button_char_money_Click(object sender, RoutedEventArgs e)
{
view_model.character.money = Character.LIMIT_MONEY;
_character.money = Character.LIMIT_MONEY;
}
private void button_char_exp_Click(object sender, RoutedEventArgs e)
{
view_model.character.exp = Character.LIMIT_EXP;
_character.exp = Character.LIMIT_EXP;
}
private void button_item_all_Click(object sender, RoutedEventArgs e)
{
List<Item> items = view_model.items;
List<Item> items = _items;
for (uint i = 0; i < items.Count; i++)
{
if (items.ElementAt((int) i).offset >= Item.OFFSETA_FIRST_KEY_ITEM)
@ -82,7 +86,7 @@ namespace MHSEC_G
private void button_item_existing_Click(object sender, RoutedEventArgs e)
{
List<Item> items = view_model.items;
List<Item> items = _items;
for (uint i = 0; i < items.Count; i++)
{
if (items.ElementAt((int) i).offset >= Item.OFFSETA_FIRST_KEY_ITEM)
@ -95,11 +99,6 @@ namespace MHSEC_G
}
}
private void button_mexp_Click(object sender, RoutedEventArgs e)
{
view_model.cur_monster.exp = Monster.LIMIT_MONSTER_EXP;
}
private void button_save_Click(object sender, RoutedEventArgs e)
{
SaveFileDialog dialog = new SaveFileDialog();
@ -108,7 +107,7 @@ namespace MHSEC_G
dialog.FileName = "mhr_game0.sav";
if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
File.WriteAllBytes(dialog.FileName, view_model.model.save_file);
File.WriteAllBytes(dialog.FileName, _model.save_file);
MessageBox.Show("Saved to \"" + dialog.FileName + "\"", "MHSEC-G", MessageBoxButton.OK,
MessageBoxImage.Information);
}
@ -116,58 +115,150 @@ namespace MHSEC_G
private void button_give_epony_Click(object sender, RoutedEventArgs e)
{
EggFragment.write_dlc_egg_fragment(view_model.egg_fragments, view_model.model, 0x4);
EggFragment.write_dlc_egg_fragment(_egg_fragments, _model, 0x4);
}
private void button_give_bear_Click(object sender, RoutedEventArgs e)
{
EggFragment.write_dlc_egg_fragment(view_model.egg_fragments, view_model.model, 0x5);
EggFragment.write_dlc_egg_fragment(_egg_fragments, _model, 0x5);
}
private void button_give_mtiggy_Click(object sender, RoutedEventArgs e)
{
EggFragment.write_dlc_egg_fragment(view_model.egg_fragments, view_model.model, 0x20);
EggFragment.write_dlc_egg_fragment(_egg_fragments, _model, 0x20);
}
private void button_give_okirin_Click(object sender, RoutedEventArgs e)
{
EggFragment.write_dlc_egg_fragment(view_model.egg_fragments, view_model.model, 0x21);
EggFragment.write_dlc_egg_fragment(_egg_fragments, _model, 0x21);
}
private void button_give_dino_Click(object sender, RoutedEventArgs e)
{
EggFragment.write_dlc_egg_fragment(view_model.egg_fragments, view_model.model, 0x6);
EggFragment.write_dlc_egg_fragment(_egg_fragments, _model, 0x6);
}
private void button_give_wm_Click(object sender, RoutedEventArgs e)
{
EggFragment.write_dlc_egg_fragment(view_model.egg_fragments, view_model.model, 0x1F);
EggFragment.write_dlc_egg_fragment(_egg_fragments, _model, 0x1F);
}
private void button_give_pd_Click(object sender, RoutedEventArgs e)
{
EggFragment.write_dlc_egg_fragment(view_model.egg_fragments, view_model.model, 0x3);
EggFragment.write_dlc_egg_fragment(_egg_fragments, _model, 0x3);
}
private void button_about_Click(object sender, RoutedEventArgs e)
{
MessageBox.Show("MHSEC-G Version " + get_app_version() +"\nDeveloped by secXsQuared", "About", MessageBoxButton.OK, MessageBoxImage.Information);
MessageBox.Show("MHSEC-G Version " + get_app_version() + "\nDeveloped by secXsQuared", "About",
MessageBoxButton.OK, MessageBoxImage.Information);
}
private void button_mdel_Click(object sender, RoutedEventArgs e)
private Model _model;
public Model model => _model;
private Character _character;
public Character character => _character;
private ObservableCollection<Armor> _armors;
public ObservableCollection<Armor> armors => _armors;
private ObservableCollection<Monster> _monsters;
public ObservableCollection<Monster> monsters => _monsters;
private ObservableCollection<Talisman> _talismans;
public ObservableCollection<Talisman> talismans => _talismans;
private ObservableCollection<Egg> _eggs;
public ObservableCollection<Egg> eggs => _eggs;
private ObservableCollection<Weapon> _weapons;
public ObservableCollection<Weapon> weapons => _weapons;
private List<Item> _items;
public List<Item> items => _items;
private ObservableCollection<EggFragment> _egg_fragments;
public ObservableCollection<EggFragment> egg_fragments => _egg_fragments;
public void init(byte[] save)
{
if (view_model.monsters.Count <= 1)
if (save == null)
{
MessageBox.Show("Cannot delete the last monster.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
return;
BugCheck.bug_check(BugCheck.ErrorCode.VIEWMODEL_NULL_SAVE, "The save file reference is NULL.");
}
_model = new Model(save);
_character = new Character(_model);
_items = Item.read_all_items(_model);
_monsters = new ObservableCollection<Monster>(Monster.read_all_monsters(_model));
_egg_fragments = EggFragment.read_all_egg_fragments(_model);
_talismans = Talisman.read_all_talismans(_model);
_weapons = Weapon.read_all_weapons(_model);
_armors = Armor.read_all_armors(_model);
_eggs = Egg.read_all_eggs(_model);
}
Monster to_delete = view_model.cur_monster;
view_model.monsters.Remove(to_delete);
view_model.cur_monster = view_model.monsters.ElementAt(0);
public event PropertyChangedEventHandler PropertyChanged;
byte[] template = Properties.Resources.monster_null_template;
Array.Copy(template, 0, view_model.model.save_file, to_delete.offset, Monster.SIZE_MONSTER);
[NotifyPropertyChangedInvocator]
protected virtual void OnPropertyChanged(string propertyName)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
private void Monster_grid_OnMouseDoubleClick(object sender, MouseButtonEventArgs e)
{
if (sender != null)
{
DataGridRow row = sender as DataGridRow;
if (row != null)
{
MonsterWindow monsterWnd = new MonsterWindow(row.DataContext as Monster);
monsterWnd.Show();
}
}
}
private void Egg_grid_OnMouseDoubleClick(object sender, MouseButtonEventArgs e)
{
if (sender != null)
{
DataGridRow row = sender as DataGridRow;
if (row != null)
{
GeneWindow geneWnd = new GeneWindow((row.DataContext as Egg).genes);
geneWnd.Show();
}
}
}
private void button_eggs_dummy_Click(object sender, RoutedEventArgs e)
{
if (this.egg_grid.SelectedItem == null)
{
MessageBox.Show("Please select an egg.", "MHSEC-G", MessageBoxButton.OK);
}
else
{
(this.egg_grid.SelectedItem as Egg).setByteArray(Properties.Resources.egg_dummy_template);
}
}
private void button_eggs_delete_Click(object sender, RoutedEventArgs e)
{
if (this.egg_grid.SelectedItem == null)
{
MessageBox.Show("Please select an egg.", "MHSEC-G", MessageBoxButton.OK);
}
else
{
MessageBoxResult confirm = MessageBox.Show("Are you sure you want to delete the egg?", "MHSEC-G",
MessageBoxButton.YesNo);
if (confirm == MessageBoxResult.Yes)
{
(this.egg_grid.SelectedItem as Egg).setByteArray(Properties.Resources.egg_null_template);
}
}
}
}
}
}

View File

@ -4,7 +4,7 @@ using System.Text;
namespace MHSEC_G
{
internal class Model
public class Model
{
public const uint SAVE_FILE_SIZE = 483976;

View File

@ -9,11 +9,8 @@ using MHSEC_G.Annotations;
namespace MHSEC_G
{
internal class Monster : INotifyPropertyChanged
public class Monster : INotifyPropertyChanged
{
public static readonly List<uint> GENE_ID = new List<uint>();
public static readonly List<string> GENE_NAME = new List<string>();
public const uint LIMIT_MONSTER_EXP = 0xFFFFFF;
public const uint SIZE_MONSTER = 0x478;
private const uint OFFSETA_MONSTER = 0xA150;
@ -36,17 +33,20 @@ namespace MHSEC_G
private const uint OFFSETR_MONSTER_ATK = 0x48;
private const uint OFFSETR_MONSTER_HP = 0x46;
private const uint OFFSETR_MONSTER_DEF = 0x4A;
private readonly Model _model;
private readonly uint _offset;
public uint offset
{
get { return _offset; }
}
private readonly Model _model;
private readonly uint _offset;
public uint offset => _offset;
public uint box => (_offset - OFFSETA_MONSTER) / SIZE_MONSTER / 18 + 1;
public uint slot => (_offset - OFFSETA_MONSTER) / SIZE_MONSTER % 18 + 1;
private readonly Genes _genes;
public Genes genes => _genes;
public string spe
{
get { return Model.byte_to_uint(_model.save_file[_offset + OFFSETR_MONSTER_SPE]).ToString("X2"); }
get => Model.byte_to_uint(_model.save_file[_offset + OFFSETR_MONSTER_SPE]).ToString("X2");
set
{
uint parsed;
@ -56,7 +56,8 @@ namespace MHSEC_G
}
else
{
MessageBox.Show("Species must be at most 0xFF.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
MessageBox.Show("Species must be at most 0xFF.", "Error", MessageBoxButton.OK,
MessageBoxImage.Error);
}
OnPropertyChanged(nameof(spe));
}
@ -64,7 +65,7 @@ namespace MHSEC_G
public uint atk
{
get { return Model.byte_to_uint16_le(_model.save_file, _offset + OFFSETR_MONSTER_ATK); }
get => Model.byte_to_uint16_le(_model.save_file, _offset + OFFSETR_MONSTER_ATK);
set
{
if (value <= 0xFFFF)
@ -82,7 +83,7 @@ namespace MHSEC_G
public uint def
{
get { return Model.byte_to_uint16_le(_model.save_file, _offset + OFFSETR_MONSTER_DEF); }
get => Model.byte_to_uint16_le(_model.save_file, _offset + OFFSETR_MONSTER_DEF);
set
{
if (value <= 0xFFFF)
@ -100,7 +101,7 @@ namespace MHSEC_G
public uint hp
{
get { return Model.byte_to_uint16_le(_model.save_file, _offset + OFFSETR_MONSTER_HP); }
get => Model.byte_to_uint16_le(_model.save_file, _offset + OFFSETR_MONSTER_HP);
set
{
if (value <= 0xFFFF)
@ -118,7 +119,7 @@ namespace MHSEC_G
public uint hiv
{
get { return Model.byte_to_uint(_model.save_file[_offset + OFFSETR_MONSTER_HIV]); }
get => Model.byte_to_uint(_model.save_file[_offset + OFFSETR_MONSTER_HIV]);
set
{
if (value <= 0xFF)
@ -135,7 +136,7 @@ namespace MHSEC_G
public uint aiv
{
get { return Model.byte_to_uint(_model.save_file[_offset + OFFSETR_MONSTER_AIV]); }
get => Model.byte_to_uint(_model.save_file[_offset + OFFSETR_MONSTER_AIV]);
set
{
if (value <= 0xFF)
@ -152,7 +153,7 @@ namespace MHSEC_G
public uint div
{
get { return Model.byte_to_uint(_model.save_file[_offset + OFFSETR_MONSTER_DIV]); }
get => Model.byte_to_uint(_model.save_file[_offset + OFFSETR_MONSTER_DIV]);
set
{
if (value <= 0xFF)
@ -169,7 +170,7 @@ namespace MHSEC_G
public uint hpu
{
get { return Model.byte_to_uint(_model.save_file[_offset + OFFSETR_MONSTER_HPU]); }
get => Model.byte_to_uint(_model.save_file[_offset + OFFSETR_MONSTER_HPU]);
set
{
if (value <= 0xFF)
@ -178,7 +179,8 @@ namespace MHSEC_G
}
else
{
MessageBox.Show("Power up must be at most 255.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
MessageBox.Show("Power up must be at most 255.", "Error", MessageBoxButton.OK,
MessageBoxImage.Error);
}
OnPropertyChanged(nameof(hpu));
}
@ -186,7 +188,7 @@ namespace MHSEC_G
public uint apu
{
get { return Model.byte_to_uint(_model.save_file[_offset + OFFSETR_MONSTER_APU]); }
get => Model.byte_to_uint(_model.save_file[_offset + OFFSETR_MONSTER_APU]);
set
{
if (value <= 0xFF)
@ -195,7 +197,8 @@ namespace MHSEC_G
}
else
{
MessageBox.Show("Power up must be at most 255.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
MessageBox.Show("Power up must be at most 255.", "Error", MessageBoxButton.OK,
MessageBoxImage.Error);
}
OnPropertyChanged(nameof(apu));
}
@ -203,7 +206,7 @@ namespace MHSEC_G
public uint dpu
{
get { return Model.byte_to_uint(_model.save_file[_offset + OFFSETR_MONSTER_DPU]); }
get => Model.byte_to_uint(_model.save_file[_offset + OFFSETR_MONSTER_DPU]);
set
{
if (value <= 0xFF)
@ -212,23 +215,16 @@ namespace MHSEC_G
}
else
{
MessageBox.Show("Power up must be at most 255.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
MessageBox.Show("Power up must be at most 255.", "Error", MessageBoxButton.OK,
MessageBoxImage.Error);
}
OnPropertyChanged(nameof(dpu));
}
}
public string full_name
{
get { return name.Length == 0 ? "" : name + " [Lv." + level + "]"; }
}
public string name
{
get
{
return Model.read_unicode_string(_model.save_file, _offset + OFFSETR_MONSTER_NAME, LIMIT_MONSTER_NAME);
}
get => Model.read_unicode_string(_model.save_file, _offset + OFFSETR_MONSTER_NAME, LIMIT_MONSTER_NAME);
set
{
if (value.Length <= 10 && value.Length > 0)
@ -238,16 +234,16 @@ namespace MHSEC_G
}
else
{
MessageBox.Show("Name must be 1-10 characters.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
MessageBox.Show("Name must be 1-10 characters.", "Error", MessageBoxButton.OK,
MessageBoxImage.Error);
}
OnPropertyChanged(nameof(name));
OnPropertyChanged(nameof(full_name));
}
}
public uint exp
{
get { return Model.byte_to_uint32_le(_model.save_file, _offset + OFFSETR_MONSTER_EXP); }
get => Model.byte_to_uint32_le(_model.save_file, _offset + OFFSETR_MONSTER_EXP);
set
{
if (value <= LIMIT_MONSTER_EXP)
@ -265,7 +261,7 @@ namespace MHSEC_G
public uint level
{
get { return Model.byte_to_uint(_model.save_file[_offset + OFFSETR_MONSTER_LEVEL]); }
get => Model.byte_to_uint(_model.save_file[_offset + OFFSETR_MONSTER_LEVEL]);
set
{
if (value <= LIMIT_MONSTER_LEVEL)
@ -278,13 +274,12 @@ namespace MHSEC_G
MessageBoxImage.Error);
}
OnPropertyChanged(nameof(level));
OnPropertyChanged(nameof(full_name));
}
}
public string skill
{
get { return Model.byte_to_uint16_le(_model.save_file, offset + OFFSETR_MONSTER_SKILL).ToString("X4"); }
get => Model.byte_to_uint16_le(_model.save_file, offset + OFFSETR_MONSTER_SKILL).ToString("X4");
set
{
uint parsed;
@ -301,284 +296,13 @@ namespace MHSEC_G
OnPropertyChanged(nameof(skill));
}
}
//
// Genes
//
private uint extract_gene(uint gene_idx)
{
if (gene_idx >= 9)
{
BugCheck.bug_check(BugCheck.ErrorCode.MON_GENE_IDX_OVERFLOW, "Invalid gene index: " + gene_idx);
}
return Model.byte_to_uint16_le(_model.save_file, _offset + OFFSETR_MONSTER_GENE + gene_idx*SIZE_MONSTER_GENE);
}
private void set_gene_str(uint gene_idx, string val)
{
uint parsed;
if (Model.parse_hex_string(val, out parsed))
{
set_gene(gene_idx, parsed);
}
else
{
MessageBox.Show("Malformed gene value - must be 0x0 to 0xFFFF.", "Error", MessageBoxButton.OK,
MessageBoxImage.Error);
}
}
private void set_gene(uint gene_idx, uint val)
{
if (gene_idx >= 9)
{
BugCheck.bug_check(BugCheck.ErrorCode.MON_GENE_IDX_OVERFLOW, "Invalid gene index: " + gene_idx);
}
if (val <= 0xFFFF)
{
Model.write_uint16_le(_model.save_file, _offset + OFFSETR_MONSTER_GENE + gene_idx * SIZE_MONSTER_GENE,
val);
}
else
{
MessageBox.Show("Malformed gene value - must be 0x0 to 0xFFFF.", "Error", MessageBoxButton.OK,
MessageBoxImage.Error);
}
}
private int extract_gene_idx(uint gene_idx)
{
uint gene_id = extract_gene(gene_idx);
int idx = GENE_ID.IndexOf(gene_id);
if (idx == -1)
{
// unknown
return GENE_NAME.Count - 1;
}
return idx;
}
private void set_gene_idx(uint gene_idx, int val)
{
if (val != -1 && val != GENE_NAME.Count - 1)
{
set_gene(gene_idx, GENE_ID.ElementAt(val));
}
}
public int gene1_selected
{
get { return extract_gene_idx(0); }
set
{
set_gene_idx(0, value);
OnPropertyChanged(nameof(gene1));
OnPropertyChanged(nameof(gene1_selected));
}
}
public string gene1
{
get { return extract_gene(0).ToString("X4"); }
set
{
set_gene_str(0, value);
OnPropertyChanged(nameof(gene1));
OnPropertyChanged(nameof(gene1_selected));
}
}
public int gene2_selected
{
get { return extract_gene_idx(1); }
set
{
set_gene_idx(1, value);
OnPropertyChanged(nameof(gene2));
OnPropertyChanged(nameof(gene2_selected));
}
}
public string gene2
{
get { return extract_gene(1).ToString("X4"); }
set
{
set_gene_str(1, value);
OnPropertyChanged(nameof(gene2));
OnPropertyChanged(nameof(gene2_selected));
}
}
public int gene3_selected
{
get { return extract_gene_idx(2); }
set
{
set_gene_idx(2, value);
OnPropertyChanged(nameof(gene3));
OnPropertyChanged(nameof(gene3_selected));
}
}
public string gene3
{
get { return extract_gene(2).ToString("X4"); }
set
{
set_gene_str(2, value);
OnPropertyChanged(nameof(gene3));
OnPropertyChanged(nameof(gene3_selected));
}
}
public int gene4_selected
{
get { return extract_gene_idx(3); }
set
{
set_gene_idx(3, value);
OnPropertyChanged(nameof(gene4));
OnPropertyChanged(nameof(gene4_selected));
}
}
public string gene4
{
get { return extract_gene(3).ToString("X4"); }
set
{
set_gene_str(3, value);
OnPropertyChanged(nameof(gene4));
OnPropertyChanged(nameof(gene4_selected));
}
}
public int gene5_selected
{
get { return extract_gene_idx(4); }
set
{
set_gene_idx(4, value);
OnPropertyChanged(nameof(gene5));
OnPropertyChanged(nameof(gene5_selected));
}
}
public string gene5
{
get { return extract_gene(4).ToString("X4"); }
set
{
set_gene_str(4, value);
OnPropertyChanged(nameof(gene5));
OnPropertyChanged(nameof(gene5_selected));
}
}
public int gene6_selected
{
get { return extract_gene_idx(5); }
set
{
set_gene_idx(5, value);
OnPropertyChanged(nameof(gene6));
OnPropertyChanged(nameof(gene6_selected));
}
}
public string gene6
{
get { return extract_gene(5).ToString("X4"); }
set
{
set_gene_str(5, value);
OnPropertyChanged(nameof(gene6));
OnPropertyChanged(nameof(gene6_selected));
}
}
public int gene7_selected
{
get { return extract_gene_idx(6); }
set
{
set_gene_idx(6, value);
OnPropertyChanged(nameof(gene7));
OnPropertyChanged(nameof(gene7_selected));
}
}
public string gene7
{
get { return extract_gene(6).ToString("X4"); }
set
{
set_gene_str(6, value);
OnPropertyChanged(nameof(gene7));
OnPropertyChanged(nameof(gene7_selected));
}
}
public int gene8_selected
{
get { return extract_gene_idx(7); }
set
{
set_gene_idx(7, value);
OnPropertyChanged(nameof(gene8));
OnPropertyChanged(nameof(gene8_selected));
}
}
public string gene8
{
get { return extract_gene(7).ToString("X4"); }
set
{
set_gene_str(7, value);
OnPropertyChanged(nameof(gene8));
OnPropertyChanged(nameof(gene8_selected));
}
}
public int gene9_selected
{
get { return extract_gene_idx(8); }
set
{
set_gene_idx(8, value);
OnPropertyChanged(nameof(gene9));
OnPropertyChanged(nameof(gene9_selected));
}
}
public string gene9
{
get { return extract_gene(8).ToString("X4"); }
set
{
set_gene_str(8, value);
OnPropertyChanged(nameof(gene9));
OnPropertyChanged(nameof(gene9_selected));
}
}
public Monster(uint offset, Model model)
{
_offset = offset;
_model = model;
_genes = new Genes(model, offset + OFFSETR_MONSTER_GENE, SIZE_MONSTER_GENE);
}
public static List<Monster> read_all_monsters(Model model)
@ -587,48 +311,22 @@ namespace MHSEC_G
List<Monster> ret = new List<Monster>();
for (uint i = OFFSETA_MONSTER; i < OFFSETA_MONSTE_END; i += SIZE_MONSTER)
{
if (Model.read_unicode_string(save, i, LIMIT_MONSTER_NAME).Length != 0)
{
byte[] each = new byte[SIZE_MONSTER];
Array.Copy(save, i, each, 0, SIZE_MONSTER);
ret.Add(new Monster(i, model));
}
}
if (ret.Count == 0)
{
byte[] dummy = new byte[SIZE_MONSTER];
Array.Clear(dummy, 0, (int) SIZE_MONSTER);
// at least one monster
ret.Add(new Monster(OFFSETA_MONSTER, model));
ret.Add(new Monster(i, model));
}
return ret;
}
public static void read_gene_mapping()
public byte[] getByteArray()
{
string line;
StringReader file = new StringReader(Properties.Resources.gene);
byte[] ret = new byte[SIZE_MONSTER];
Array.Copy(_model.save_file, _offset, ret, 0, SIZE_MONSTER);
return ret;
}
while ((line = file.ReadLine()) != null)
{
if (line.Length == 0)
continue;
string[] eachline = line.Split('\t');
if (eachline.Length != 2)
{
BugCheck.bug_check(BugCheck.ErrorCode.MON_GENE_MAPPING_CORRUPTED,
"Invalid gene mapping file line:\n" + line);
}
GENE_ID.Add(uint.Parse(eachline[0], System.Globalization.NumberStyles.HexNumber));
GENE_NAME.Add(eachline[1]);
}
GENE_NAME.Add("Custom");
file.Close();
public void setByteArray(byte[] ret)
{
Array.Copy(ret, 0, _model.save_file, _offset, SIZE_MONSTER);
OnPropertyChanged(null);
}

View File

@ -0,0 +1,91 @@
<Window x:Class="MHSEC_G.MonsterWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:MHSEC_G"
mc:Ignorable="d"
Title="Monster Editor" Height="328" Width="337.449" ResizeMode="NoResize">
<Grid>
<Grid Background="#FFE5E5E5" Margin="0,0,0.5,-0.5">
<Label x:Name="label_mhp" Content="HP" HorizontalAlignment="Left" Margin="30,39,0,0"
VerticalAlignment="Top" RenderTransformOrigin="0.564,2.072" />
<Label x:Name="label_mat" Content="Atk" HorizontalAlignment="Left" Margin="27,68,0,0"
VerticalAlignment="Top" RenderTransformOrigin="0.564,2.072" />
<Label x:Name="label_mdf" Content="Def" HorizontalAlignment="Left" Margin="26,97,0,0"
VerticalAlignment="Top" RenderTransformOrigin="0.564,2.072" />
<Label x:Name="label_mhiv" Content="IV-HP" HorizontalAlignment="Left" Margin="15,125,0,0"
VerticalAlignment="Top" RenderTransformOrigin="0.564,2.072" />
<Label x:Name="label_mdiv" Content="IV-Atk" HorizontalAlignment="Left" Margin="12,154,0,0"
VerticalAlignment="Top" RenderTransformOrigin="0.564,2.072" />
<Label x:Name="label_maiv" Content="IV-Def" HorizontalAlignment="Left" Margin="11,182,0,0"
VerticalAlignment="Top" RenderTransformOrigin="0.564,2.072" />
<Label x:Name="label_mhpu" Content="PowerUp-HP" HorizontalAlignment="Left" Margin="157,123,0,0"
VerticalAlignment="Top" RenderTransformOrigin="0.564,2.072" />
<Label x:Name="label_mapu" Content="PowerUp-Atk" HorizontalAlignment="Left" Margin="154,151,0,0"
VerticalAlignment="Top" RenderTransformOrigin="0.564,2.072" />
<Label x:Name="label_mdpu" Content="PowerUp-Def" HorizontalAlignment="Left" Margin="154,179,0,0"
VerticalAlignment="Top" RenderTransformOrigin="0.564,2.072" />
<TextBox x:Name="textbox_mhp" HorizontalAlignment="Left" Height="23" Margin="60,39,0,0"
TextWrapping="Wrap" Text="{Binding monster.hp}" VerticalAlignment="Top"
Width="75" />
<TextBox x:Name="textbox_mat" HorizontalAlignment="Left" Height="23" Margin="60,69,0,0"
TextWrapping="Wrap" Text="{Binding monster.atk}" VerticalAlignment="Top"
Width="75" />
<TextBox x:Name="textbox_mdf" HorizontalAlignment="Left" Height="23" Margin="60,97,0,0"
TextWrapping="Wrap" Text="{Binding monster.def}" VerticalAlignment="Top"
Width="75" />
<TextBox x:Name="textbox_mhiv" HorizontalAlignment="Left" Height="23" Margin="60,126,0,0"
TextWrapping="Wrap" Text="{Binding monster.hiv}" VerticalAlignment="Top"
Width="75" />
<TextBox x:Name="textbox_maiv" HorizontalAlignment="Left" Height="23" Margin="60,154,0,0"
TextWrapping="Wrap" Text="{Binding monster.aiv}" VerticalAlignment="Top"
Width="75" />
<TextBox x:Name="textbox_mdiv" HorizontalAlignment="Left" Height="23" Margin="60,182,0,0"
TextWrapping="Wrap" Text="{Binding monster.div}" VerticalAlignment="Top"
Width="75" />
<TextBox x:Name="textbox_mhpu" HorizontalAlignment="Left" Height="23" Margin="240,126,0,0"
TextWrapping="Wrap" Text="{Binding monster.hpu}" VerticalAlignment="Top"
Width="75" />
<TextBox x:Name="textbox_mapu" HorizontalAlignment="Left" Height="23" Margin="240,154,0,0"
TextWrapping="Wrap" Text="{Binding monster.apu}" VerticalAlignment="Top"
Width="75" />
<TextBox x:Name="textbox_mdpu" HorizontalAlignment="Left" Height="23" Margin="240,182,0,0"
TextWrapping="Wrap" Text="{Binding monster.dpu}" VerticalAlignment="Top"
Width="75" />
<Label x:Name="label_mlv" Content="Level" HorizontalAlignment="Left" Margin="198,36,0,0"
VerticalAlignment="Top" RenderTransformOrigin="-0.263,0.135" />
<Label x:Name="label_mex" Content="Exp" HorizontalAlignment="Left" Margin="172,69,0,0"
VerticalAlignment="Top" RenderTransformOrigin="-0.263,0.135" />
<Label x:Name="label_spe" Content="Type (Hex)" Margin="168,97,97,0"
VerticalAlignment="Top" RenderTransformOrigin="-0.263,0.135" />
<TextBox x:Name="textbox_mlv" HorizontalAlignment="Left" Height="24" Margin="240,39,0,0"
TextWrapping="Wrap" Text="{Binding monster.level}" VerticalAlignment="Top"
Width="75" />
<TextBox x:Name="textbox_mex" HorizontalAlignment="Left" Height="24" Margin="240,68,0,0"
TextWrapping="Wrap" Text="{Binding monster.exp}" VerticalAlignment="Top"
Width="75" />
<TextBox x:Name="textbox_spe" HorizontalAlignment="Left" Height="24" Margin="240,97,0,0"
TextWrapping="Wrap" Text="{Binding monster.spe, StringFormat=\{0:X2\}}" VerticalAlignment="Top"
Width="75"/>
<Label x:Name="label_mname" Content="Name" HorizontalAlignment="Left" Margin="14,10,0,0"
VerticalAlignment="Top" />
<TextBox x:Name="textbox_mname" HorizontalAlignment="Left" Height="22" Margin="60,12,0,0"
TextWrapping="Wrap" Text="{Binding monster.name}" VerticalAlignment="Top"
Width="118" />
<Label x:Name="label_m_warn" Content="Warning: The sum of PowerUps should be at most 10."
HorizontalAlignment="Left" Margin="11,210,0,0" VerticalAlignment="Top" />
<Button x:Name="button_mexp" Content="Max" HorizontalAlignment="Left" Margin="200,72,0,0"
VerticalAlignment="Top" Width="35" Click="button_mexp_Click" />
<Button x:Name="button_mdel" Content="Export" HorizontalAlignment="Left" Margin="73,270,0,0" VerticalAlignment="Top" Width="76" Click="button_mdel_Click"/>
<Label x:Name="label_mon_skill" Content="Skill (X)" HorizontalAlignment="Left" Margin="186,10,0,0" VerticalAlignment="Top"/>
<TextBox x:Name="textbox_mon_skill" HorizontalAlignment="Left" Height="24" Margin="240,10,0,0"
TextWrapping="Wrap" Text="{Binding monster.skill}" VerticalAlignment="Top"
Width="75" />
<Button x:Name="button_mdel_import" Content="Import" HorizontalAlignment="Left" Margin="157,270,0,0" VerticalAlignment="Top" Width="76" Click="button_mimport_Click" RenderTransformOrigin="0.167,-0.328"/>
<Button x:Name="button_mdel_delete" Content="Delete" HorizontalAlignment="Left" Margin="239,270,0,0" VerticalAlignment="Top" Width="76" Click="button_mdelete_Click" Height="20"/>
<Button x:Name="button_mdel_genes" Content="Edit Genes" HorizontalAlignment="Left" Margin="239,241,0,0" VerticalAlignment="Top" Width="75" Click="button_mdel_genes_Click"/>
</Grid>
</Grid>
</Window>

View File

@ -0,0 +1,93 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Windows;
using System.Windows.Forms;
using MHSEC_G.Annotations;
using MessageBox = System.Windows.MessageBox;
namespace MHSEC_G
{
/// <summary>
/// Interaction logic for MonsterWindow.xaml
/// </summary>
public partial class MonsterWindow : Window, INotifyPropertyChanged
{
private readonly Monster _monster;
public Monster monster => _monster;
public MonsterWindow(Monster monster)
{
this._monster = monster;
DataContext = this;
InitializeComponent();
}
private void button_mimport_Click(object sender, RoutedEventArgs e)
{
OpenFileDialog dialog = new OpenFileDialog();
dialog.Filter = "Binary files (*.bin)|*.bin|All files (*.*)|*.*";
dialog.Title = "Please select the monster file.";
if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
byte[] buffer = File.ReadAllBytes(dialog.FileName);
if (buffer.Length != Monster.SIZE_MONSTER)
{
System.Windows.Forms.MessageBox.Show(
"Wrong monster file size!",
"Error",
MessageBoxButtons.OK,
MessageBoxIcon.Error);
}
else
{
_monster.setByteArray(buffer);
}
}
}
private void button_mdelete_Click(object sender, RoutedEventArgs e)
{
MessageBoxResult confirm = MessageBox.Show("Are you sure you want to delete the monster?", "MHSEC-G", MessageBoxButton.YesNo);
if (confirm == MessageBoxResult.Yes)
{
_monster.setByteArray(Properties.Resources.monster_null_template);
}
}
private void button_mdel_Click(object sender, RoutedEventArgs e)
{
SaveFileDialog dialog = new SaveFileDialog();
dialog.Filter = "Binary files (*.bin)|*.bin|All files (*.*)|*.*";
dialog.Title = "Please select the export location.";
dialog.FileName = _monster.name + ".bin";
if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
byte[] binary = _monster.getByteArray();
File.WriteAllBytes(dialog.FileName, binary);
MessageBox.Show("Exported to \"" + dialog.FileName + "\"", "MHSEC-G", MessageBoxButton.OK,
MessageBoxImage.Information);
}
}
private void button_mexp_Click(object sender, RoutedEventArgs e)
{
_monster.exp = Monster.LIMIT_MONSTER_EXP;
}
public event PropertyChangedEventHandler PropertyChanged;
[NotifyPropertyChangedInvocator]
protected virtual void OnPropertyChanged(string propertyName)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
private void button_mdel_genes_Click(object sender, RoutedEventArgs e)
{
GeneWindow geneWnd = new GeneWindow(_monster.genes);
geneWnd.Show();
}
}
}

View File

@ -12,7 +12,7 @@ using System.Windows;
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MHSEC-G")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
@ -51,5 +51,5 @@ using System.Windows;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.2.2.0")]
[assembly: AssemblyFileVersion("0.2.2.0")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -60,6 +60,26 @@ namespace MHSEC_G.Properties {
}
}
/// <summary>
/// Looks up a localized resource of type System.Byte[].
/// </summary>
internal static byte[] egg_dummy_template {
get {
object obj = ResourceManager.GetObject("egg_dummy_template", resourceCulture);
return ((byte[])(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Byte[].
/// </summary>
internal static byte[] egg_null_template {
get {
object obj = ResourceManager.GetObject("egg_null_template", resourceCulture);
return ((byte[])(obj));
}
}
/// <summary>
/// Looks up a localized string similar to 0001 Empty Slot
///0002 No Slot
@ -108,27 +128,27 @@ namespace MHSEC_G.Properties {
}
/// <summary>
/// Looks up a localized string similar to 10 1
///18 2 回复药
///20 3 回复G
///28 4 回
///30 5 生命
///38 6 生命大粉
///40 7 秘
///48 16 合のカタマリ
///50 9 活力
///58 8 いにしえの秘
///60 A 解毒
///68 B 解毒
/// Looks up a localized string similar to 10 1
///18 2 回復薬
///20 3 回復薬グレート
///28 4 回復の
///30 5 生命
///38 6 生命大粉
///40 7 秘
///48 16 合のカタマリ
///50 9 活力
///58 8 いにしえの秘
///60 A げどく
///68 B 解毒
///70 C アロエ草
///78 D 烧伤药
///78 D やけど薬
///80 E マヒワリの花
///88 F 麻痹药
///88 F マヒなおし薬
///90 10 トウガラシ
///98 11 元気ドリンコ
///A0 12 多肉ニンニク
///A8 13 熱血サプリ
///B0 14 シャボン菜
///B0 14 シャボン菜
///B8 15 爆破落とし洗剤
///C0 18 メニーベリー
///C8 19 目薬
@ -138,7 +158,7 @@ namespace MHSEC_G.Properties {
///E8 B0 こんがり肉
///F0 B1 マッスルミート
///F8 B2 タフネスミート
///100 B3 クックミート
///100 B3 クックミート
///108 B4 こんがり肉G
///110 1D ハンタードーナツ
///118 1F ロア・ル・リング
@ -146,8 +166,7 @@ namespace MHSEC_G.Properties {
///128 21 ドスドーナツ
///130 24 ギルドーナツ
///138 25 アイルーシュガー
///140 26 メラルーショコラ
///148 27 こ [rest of string was truncated]&quot;;.
///140 26 メラルーシ [rest of string was truncated]&quot;;.
/// </summary>
internal static string idmap {
get {

View File

@ -130,4 +130,10 @@
<data name="gene" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\gene.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-16</value>
</data>
<data name="egg_dummy_template" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\egg_dummy_template.bin;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="egg_null_template" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\egg_null_template.bin;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
</root>

Binary file not shown.

Binary file not shown.

View File

@ -6,7 +6,7 @@ using MHSEC_G.Annotations;
namespace MHSEC_G
{
internal class Talisman
public class Talisman
{
private const uint OFFSETA_TALI = 0x7210;
private const uint OFFSETA_TALI_END = 0x978F;
@ -19,6 +19,7 @@ namespace MHSEC_G
private const uint OFFSETR_EQUIPPED = 0x11;
private readonly uint _offset;
public uint index => (_offset - OFFSETA_TALI) / SIZE_TALI + 1;
public uint offset
{
@ -143,11 +144,8 @@ namespace MHSEC_G
public static ObservableCollection<Talisman> read_all_talismans(Model model)
{
ObservableCollection<Talisman> ret = new ObservableCollection<Talisman>();
byte[] buffer = model.save_file;
for (uint offset = OFFSETA_TALI; offset < OFFSETA_TALI_END; offset += SIZE_TALI)
{
if (Model.byte_to_uint16_le(buffer, offset + OFFSETR_TALI_ID) == 0)
continue;
ret.Add(new Talisman(offset, model));
}
return ret;

View File

@ -1,115 +0,0 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using MHSEC_G.Annotations;
namespace MHSEC_G
{
internal class ViewModel : INotifyPropertyChanged
{
public List<string> gene_name
{
get { return Monster.GENE_NAME; }
}
private readonly Model _model;
public Model model
{
get { return _model;}
}
private readonly Character _character;
public Character character
{
get { return _character; }
}
private readonly ObservableCollection<Armor> _armors;
public ObservableCollection<Armor> armors
{
get { return _armors; }
}
private Monster _cur_monster_selection;
private readonly ObservableCollection<Monster> _monsters;
public Monster cur_monster
{
get { return _cur_monster_selection; }
set { _cur_monster_selection = value; OnPropertyChanged(nameof(cur_monster)); }
}
public ObservableCollection<Monster> monsters
{
get
{
return _monsters;
}
}
private readonly ObservableCollection<Talisman> _talismans;
public ObservableCollection<Talisman> talismans
{
get { return _talismans; }
}
private readonly ObservableCollection<Egg> _eggs;
public ObservableCollection<Egg> eggs
{
get { return _eggs; }
}
private readonly ObservableCollection<Weapon> _weapons;
public ObservableCollection<Weapon> weapons
{
get { return _weapons; }
}
private readonly List<Item> _items;
public List<Item> items
{
get { return _items; }
}
private readonly ObservableCollection<EggFragment> _egg_fragments;
public ObservableCollection<EggFragment> egg_fragments
{
get { return _egg_fragments; }
}
public ViewModel(byte[] save)
{
if (save == null)
{
BugCheck.bug_check(BugCheck.ErrorCode.VIEWMODEL_NULL_SAVE, "The save file reference is NULL.");
}
_model = new Model(save);
_character = new Character(_model);
_items = Item.read_all_items(_model);
_monsters = new ObservableCollection<Monster>(Monster.read_all_monsters(_model));
_cur_monster_selection = _monsters.ElementAt(0);
_egg_fragments = EggFragment.read_all_egg_fragments(_model);
_talismans = Talisman.read_all_talismans(_model);
_weapons = Weapon.read_all_weapons(_model);
_armors = Armor.read_all_armors(_model);
_eggs = Egg.read_all_eggs(_model);
}
public event PropertyChangedEventHandler PropertyChanged;
[NotifyPropertyChangedInvocator]
protected virtual void OnPropertyChanged(string propertyName)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
}

View File

@ -6,7 +6,7 @@ using MHSEC_G.Annotations;
namespace MHSEC_G
{
internal class Weapon : INotifyPropertyChanged
public class Weapon : INotifyPropertyChanged
{
private const int OFFSETA_WEAPON_START = 0x39D0;
private const int OFFSETA_WEAPON_END = 0x55EF;
@ -19,6 +19,7 @@ namespace MHSEC_G
private readonly uint _offset;
private readonly Model _model;
public uint index => (_offset - OFFSETA_WEAPON_START) / SIZE_WEAPON + 1;
public Weapon(Model model, uint offset)
{
@ -95,10 +96,6 @@ namespace MHSEC_G
ObservableCollection<Weapon> ret = new ObservableCollection<Weapon>();
for (uint i = OFFSETA_WEAPON_START; i < OFFSETA_WEAPON_END; i += SIZE_WEAPON)
{
if (Model.byte_to_uint16_le(model.save_file, i + OFFSETR_CLASS) == 0x7FFF)
{
continue;
}
ret.Add(new Weapon(model, i));
}
return ret;