- Fixed Egg fragment 0xC speices range check
- Added monster gene selection
- Added talisman editing
This commit is contained in:
secXsQuared1995 2016-10-26 01:35:52 -04:00
parent a9e982a0fd
commit e1c4760efc
13 changed files with 564 additions and 427 deletions

View File

@ -22,8 +22,11 @@ namespace MHSEC_G
// Faciltiy Item // Faciltiy Item
ITEM_NO_CORRESPONDENCE = 0x21, ITEM_NO_CORRESPONDENCE = 0x21,
ITEM_MAPPING_CORRUPTED = 0x22 ITEM_MAPPING_CORRUPTED = 0x22,
// Facility Monster
MON_GENE_MAPPING_CORRUPTED = 0x31,
MON_GENE_IDX_OVERFLOW = 0x32,
} }
public static void bug_check(ErrorCode error_code, string error_message) public static void bug_check(ErrorCode error_code, string error_message)
{ {

View File

@ -39,13 +39,13 @@ namespace MHSEC_G
set set
{ {
uint parsed; uint parsed;
if (Model.parse_hex_string(value, out parsed) && parsed <= 0x0C) if (Model.parse_hex_string(value, out parsed) && parsed <= 0x0E)
{ {
Model.write_byte(_model.save_file, _offset + OFFSETR_EF_SPE, parsed); Model.write_byte(_model.save_file, _offset + OFFSETR_EF_SPE, parsed);
} }
else else
{ {
MessageBox.Show("Malformed Species value - must be at most 0xC", "Error", MessageBoxButton.OK, MessageBoxImage.Error); MessageBox.Show("Malformed Species value - must be at most 0xE", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
} }
OnPropertyChanged(nameof(spe)); OnPropertyChanged(nameof(spe));
} }

View File

@ -16,8 +16,7 @@ namespace MHSEC_G
private static readonly uint OFFSETR_ITEM_COUNT = 0x2; private static readonly uint OFFSETR_ITEM_COUNT = 0x2;
private static readonly uint OFFSETA_ITEM_BOX_END = 0x2EE7; private static readonly uint OFFSETA_ITEM_BOX_END = 0x2EE7;
public static readonly uint OFFSETA_FIRST_KEY_ITEM = 0x17B0; public static readonly uint OFFSETA_FIRST_KEY_ITEM = 0x17B0;
private static readonly string ID_MAPPING_FILE_NAME = "idmap.txt";
private static readonly Dictionary<uint, uint> OFFSET_ID_MAPPING = new Dictionary<uint, uint>(); private static readonly Dictionary<uint, uint> OFFSET_ID_MAPPING = new Dictionary<uint, uint>();
private static readonly Dictionary<uint, string> OFFSET_NAME_MAPPING = new Dictionary<uint, string>(); private static readonly Dictionary<uint, string> OFFSET_NAME_MAPPING = new Dictionary<uint, string>();

View File

@ -28,7 +28,8 @@
<IsWebBootstrapper>false</IsWebBootstrapper> <IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust> <UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled> <BootstrapperEnabled>true</BootstrapperEnabled>
<TargetFrameworkProfile /> <TargetFrameworkProfile>
</TargetFrameworkProfile>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget> <PlatformTarget>AnyCPU</PlatformTarget>
@ -54,6 +55,10 @@
<PropertyGroup> <PropertyGroup>
<ApplicationIcon>Resources\MainIcon.ico</ApplicationIcon> <ApplicationIcon>Resources\MainIcon.ico</ApplicationIcon>
</PropertyGroup> </PropertyGroup>
<PropertyGroup>
<StartupObject>
</StartupObject>
</PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Data" /> <Reference Include="System.Data" />
@ -150,6 +155,9 @@
<ItemGroup> <ItemGroup>
<Resource Include="Resources\MainIcon.ico" /> <Resource Include="Resources\MainIcon.ico" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Resource Include="Resources\gene.txt" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets. Other similar extension points exist, see Microsoft.Common.targets.

View File

@ -5,11 +5,11 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:MHSEC_G" xmlns:local="clr-namespace:MHSEC_G"
mc:Ignorable="d" mc:Ignorable="d"
Title="" Height="447.855" Width="761.218" ResizeMode="NoResize" Icon="Resources/MainIcon.ico"> Title="" Height="447.855" Width="810.218" ResizeMode="NoResize" Icon="Resources/MainIcon.ico">
<Grid HorizontalAlignment="Left" Width="756" Margin="0,0,0,0"> <Grid HorizontalAlignment="Left" Width="800" Margin="0,0,0,-0.5">
<TabControl x:Name="tabControl" HorizontalAlignment="Left" Height="344" Margin="10,51,0,0" <TabControl x:Name="tabControl" HorizontalAlignment="Left" Height="344" Margin="10,51,0,0"
VerticalAlignment="Top" Width="726"> VerticalAlignment="Top" Width="780">
<TabItem Header="Character"> <TabItem Header="Character">
<Grid Background="#FFE5E5E5" Margin="0,0,0,0"> <Grid Background="#FFE5E5E5" Margin="0,0,0,0">
<Label x:Name="label_name" Content="Name" HorizontalAlignment="Left" Margin="10,10,0,0" <Label x:Name="label_name" Content="Name" HorizontalAlignment="Left" Margin="10,10,0,0"
@ -70,30 +70,29 @@
</DataGrid.Columns> </DataGrid.Columns>
</DataGrid> </DataGrid>
<Button x:Name="button_give_dino" Content="Give Dinovaldo" HorizontalAlignment="Left" <Button x:Name="button_give_dino" Content="Give Dinovaldo" HorizontalAlignment="Left"
Margin="584,195,0,0" VerticalAlignment="Top" Width="110" Height="30" Margin="622,195,0,0" VerticalAlignment="Top" Width="110" Height="30"
Click="button_give_dino_Click" /> Click="button_give_dino_Click" />
<Button x:Name="button_give_epony" Content="Give Epony" HorizontalAlignment="Left" <Button x:Name="button_give_epony" Content="Give Epony" HorizontalAlignment="Left"
Margin="584,35,0,0" VerticalAlignment="Top" Width="110" Height="30" Margin="622,35,0,0" VerticalAlignment="Top" Width="110" Height="30"
Click="button_give_epony_Click" /> Click="button_give_epony_Click" />
<Button x:Name="button_give_bear" Content="Give Mascot" HorizontalAlignment="Left" <Button x:Name="button_give_bear" Content="Give Mascot" HorizontalAlignment="Left"
Margin="584,75,0,0" VerticalAlignment="Top" Width="110" Height="30" Margin="622,75,0,0" VerticalAlignment="Top" Width="110" Height="30"
Click="button_give_bear_Click" /> Click="button_give_bear_Click" />
<Button x:Name="button_give_mtiggy" Content="Give Molten Tigrex" HorizontalAlignment="Left" <Button x:Name="button_give_mtiggy" Content="Give Molten Tigrex" HorizontalAlignment="Left"
Margin="584,115,0,0" VerticalAlignment="Top" Width="110" Height="30" Margin="622,115,0,0" VerticalAlignment="Top" Width="110" Height="30"
Click="button_give_mtiggy_Click" /> Click="button_give_mtiggy_Click" />
<Button x:Name="button_give_okirin" Content="Give Oroshi Kirin" HorizontalAlignment="Left" <Button x:Name="button_give_okirin" Content="Give Oroshi Kirin" HorizontalAlignment="Left"
Margin="584,155,0,0" VerticalAlignment="Top" Width="110" Height="30" Margin="622,155,0,0" VerticalAlignment="Top" Width="110" Height="30"
Click="button_give_okirin_Click" /> Click="button_give_okirin_Click" />
<TextBlock x:Name="textblock_egg_frag_n" HorizontalAlignment="Left" Margin="10,10,0,0"
TextWrapping="Wrap"
Text="If interested, try giving yourself DLC eggs and modify each shard's DLC byte to 0x4 and up. You can get other DLC monsters!"
VerticalAlignment="Top" />
<Button x:Name="button_give_pd" Content="Give Puzzle Dragon" HorizontalAlignment="Left" <Button x:Name="button_give_pd" Content="Give Puzzle Dragon" HorizontalAlignment="Left"
Margin="584,235,0,0" VerticalAlignment="Top" Width="110" Height="30" Margin="622,235,0,0" VerticalAlignment="Top" Width="110" Height="30"
Click="button_give_pd_Click" /> Click="button_give_pd_Click" />
<Button x:Name="button_give_wm" Content="Give W. Monoblos" HorizontalAlignment="Left" <Button x:Name="button_give_wm" Content="Give W. Monoblos" HorizontalAlignment="Left"
Margin="584,275,0,0" VerticalAlignment="Top" Width="110" Height="30" Margin="622,275,0,0" VerticalAlignment="Top" Width="110" Height="30"
Click="button_give_wm_Click" /> Click="button_give_wm_Click" />
<Button x:Name="button_eggf_new" IsEnabled="False" Content="New" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" Width="75"/>
<Button x:Name="button_eggf_delete" IsEnabled="False" Content="Delete" HorizontalAlignment="Left" Margin="101,10,0,0" VerticalAlignment="Top" Width="75"/>
<Label x:Name="temp_label_eggf" Content="New/Delete coming soon..." HorizontalAlignment="Left" Margin="181,7,0,0" VerticalAlignment="Top"/>
</Grid> </Grid>
</TabItem> </TabItem>
<TabItem Header="Items"> <TabItem Header="Items">
@ -117,12 +116,13 @@
Header="Count" /> Header="Count" />
</DataGrid.Columns> </DataGrid.Columns>
</DataGrid> </DataGrid>
<Button x:Name="button_item_all" Content="All 986x" HorizontalAlignment="Left" Margin="586,30,0,0" <Button x:Name="button_item_all" Content="All 986x" HorizontalAlignment="Left" Margin="615,30,0,0"
VerticalAlignment="Top" Width="108" RenderTransformOrigin="0.065,-0.953" Height="45" VerticalAlignment="Top" Width="108" RenderTransformOrigin="0.065,-0.953" Height="45"
Click="button_item_all_Click" /> Click="button_item_all_Click" />
<Button x:Name="button_item_existing" Content="Existing 999x" HorizontalAlignment="Left" <Button x:Name="button_item_existing" Content="Existing 999x" HorizontalAlignment="Left"
Margin="586,94,0,0" VerticalAlignment="Top" Width="108" Margin="615,96,0,0" VerticalAlignment="Top" Width="108"
RenderTransformOrigin="0.065,-0.953" Height="45" Click="button_item_existing_Click" /> RenderTransformOrigin="0.065,-0.953" Height="45" Click="button_item_existing_Click" />
<Label x:Name="label_item_ack" Content="Thank 妾发@bbs.duowan.com for item id mappings :)" HorizontalAlignment="Left" Margin="10,4,0,0" VerticalAlignment="Top"/>
</Grid> </Grid>
</TabItem> </TabItem>
<TabItem Header="Monsters" Margin="0,0,0,0"> <TabItem Header="Monsters" Margin="0,0,0,0">
@ -146,23 +146,23 @@
<Label x:Name="label_mdpu" Content="PowerUp-Def" HorizontalAlignment="Left" Margin="150,235,0,0" <Label x:Name="label_mdpu" Content="PowerUp-Def" HorizontalAlignment="Left" Margin="150,235,0,0"
VerticalAlignment="Top" RenderTransformOrigin="0.564,2.072" /> VerticalAlignment="Top" RenderTransformOrigin="0.564,2.072" />
<Label x:Name="label_mgen1" Content="Gene 1 (Hex)" HorizontalAlignment="Left" <Label x:Name="label_mgen1" Content="Gene 1 (Hex)" HorizontalAlignment="Left"
VerticalAlignment="Top" Margin="385,85,0,0" /> VerticalAlignment="Top" Margin="364,31,0,0" />
<Label x:Name="label_mgen2" Content="Gene 2 (Hex)" HorizontalAlignment="Left" <Label x:Name="label_mgen2" Content="Gene 2 (Hex)" HorizontalAlignment="Left"
VerticalAlignment="Top" Margin="505,85,0,0" /> VerticalAlignment="Top" Margin="505,31,0,0" />
<Label x:Name="label_mgen3" Content="Gene 3 (Hex)" HorizontalAlignment="Left" <Label x:Name="label_mgen3" Content="Gene 3 (Hex)" HorizontalAlignment="Left"
VerticalAlignment="Top" Margin="625,85,0,0" RenderTransformOrigin="0.537,0.19" /> VerticalAlignment="Top" Margin="652,31,0,0" RenderTransformOrigin="0.537,0.19" />
<Label x:Name="label_mgen4" Content="Gene 4 (Hex)" HorizontalAlignment="Left" <Label x:Name="label_mgen4" Content="Gene 4 (Hex)" HorizontalAlignment="Left"
VerticalAlignment="Top" Margin="385,155,0,0" /> VerticalAlignment="Top" Margin="364,117,0,0" />
<Label x:Name="label_mgen5" Content="Gene 5 (Hex)" HorizontalAlignment="Left" <Label x:Name="label_mgen5" Content="Gene 5 (Hex)" HorizontalAlignment="Left"
VerticalAlignment="Top" Margin="505,155,0,0" RenderTransformOrigin="0.524,0.439" /> VerticalAlignment="Top" Margin="505,117,0,0" RenderTransformOrigin="0.524,0.439" />
<Label x:Name="label_mgen6" Content="Gene 6 (Hex)" HorizontalAlignment="Left" <Label x:Name="label_mgen6" Content="Gene 6 (Hex)" HorizontalAlignment="Left"
VerticalAlignment="Top" Margin="625,155,0,0" /> VerticalAlignment="Top" Margin="652,117,0,0" />
<Label x:Name="label_mgen7" Content="Gene 7 (Hex)" HorizontalAlignment="Left" <Label x:Name="label_mgen7" Content="Gene 7 (Hex)" HorizontalAlignment="Left"
VerticalAlignment="Top" Margin="385,225,0,0" /> VerticalAlignment="Top" Margin="364,205,0,0" />
<Label x:Name="label_mgen8" Content="Gene 8 (Hex)" HorizontalAlignment="Left" <Label x:Name="label_mgen8" Content="Gene 8 (Hex)" HorizontalAlignment="Left"
VerticalAlignment="Top" Margin="505,225,0,0" /> VerticalAlignment="Top" Margin="505,207,0,0" />
<Label x:Name="label_mgen9" Content="Gene 9 (Hex)" HorizontalAlignment="Left" <Label x:Name="label_mgen9" Content="Gene 9 (Hex)" HorizontalAlignment="Left"
VerticalAlignment="Top" Margin="625,225,0,0" /> VerticalAlignment="Top" Margin="652,207,0,0" />
<TextBox x:Name="textbox_mhp" HorizontalAlignment="Left" Height="23" Margin="60,87,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" TextWrapping="Wrap" Text="{Binding Path=cur_monster.hp}" VerticalAlignment="Top"
Width="75" /> Width="75" />
@ -190,33 +190,33 @@
<TextBox x:Name="textbox_mdpu" HorizontalAlignment="Left" Height="23" Margin="240,237,0,0" <TextBox x:Name="textbox_mdpu" HorizontalAlignment="Left" Height="23" Margin="240,237,0,0"
TextWrapping="Wrap" Text="{Binding Path=cur_monster.dpu}" VerticalAlignment="Top" TextWrapping="Wrap" Text="{Binding Path=cur_monster.dpu}" VerticalAlignment="Top"
Width="75" /> Width="75" />
<TextBox x:Name="textbox_gene1" HorizontalAlignment="Left" Height="23" TextWrapping="Wrap" <TextBox x:Name="textbox_gene1" HorizontalAlignment="Left" Height="22" TextWrapping="Wrap"
Text="{Binding Path=cur_monster.gene1}" VerticalAlignment="Top" Width="80" Text="{Binding Path=cur_monster.gene1}" VerticalAlignment="Top" Width="129"
Margin="385,120,0,0" /> Margin="336,58,0,0" />
<TextBox x:Name="textbox_gene2" HorizontalAlignment="Left" Height="23" TextWrapping="Wrap" <TextBox x:Name="textbox_gene2" HorizontalAlignment="Left" Height="22" TextWrapping="Wrap"
Text="{Binding Path=cur_monster.gene2}" VerticalAlignment="Top" Width="80" Text="{Binding Path=cur_monster.gene2}" VerticalAlignment="Top" Width="129"
Margin="505,120,0,0" /> Margin="480,58,0,0" />
<TextBox x:Name="textbox_gene3" HorizontalAlignment="Left" Height="23" TextWrapping="Wrap" <TextBox x:Name="textbox_gene3" HorizontalAlignment="Left" Height="22" TextWrapping="Wrap"
Text="{Binding Path=cur_monster.gene3}" VerticalAlignment="Top" Width="80" Text="{Binding Path=cur_monster.gene3}" VerticalAlignment="Top" Width="129"
Margin="625,120,0,0" /> Margin="625,58,0,0" />
<TextBox x:Name="textbox_gene4" HorizontalAlignment="Left" Height="23" TextWrapping="Wrap" <TextBox x:Name="textbox_gene4" HorizontalAlignment="Left" Height="23" TextWrapping="Wrap"
Text="{Binding Path=cur_monster.gene4}" VerticalAlignment="Top" Width="80" Text="{Binding Path=cur_monster.gene4}" VerticalAlignment="Top" Width="127"
Margin="385,190,0,0" /> Margin="338,147,0,0" />
<TextBox x:Name="textbox_gene5" HorizontalAlignment="Left" Height="23" TextWrapping="Wrap" <TextBox x:Name="textbox_gene5" HorizontalAlignment="Left" Height="23" TextWrapping="Wrap"
Text="{Binding Path=cur_monster.gene5}" VerticalAlignment="Top" Width="80" Text="{Binding Path=cur_monster.gene5}" VerticalAlignment="Top" Width="129"
Margin="505,190,0,0" /> Margin="480,147,0,0" />
<TextBox x:Name="textbox_gene6" HorizontalAlignment="Left" Height="23" TextWrapping="Wrap" <TextBox x:Name="textbox_gene6" HorizontalAlignment="Left" Height="23" TextWrapping="Wrap"
Text="{Binding Path=cur_monster.gene6}" VerticalAlignment="Top" Width="80" Text="{Binding Path=cur_monster.gene6}" VerticalAlignment="Top" Width="128"
Margin="625,190,0,0" /> Margin="626,147,0,0" />
<TextBox x:Name="textbox_gene7" HorizontalAlignment="Left" Height="23" TextWrapping="Wrap" <TextBox x:Name="textbox_gene7" HorizontalAlignment="Left" Height="23" TextWrapping="Wrap"
Text="{Binding Path=cur_monster.gene7}" VerticalAlignment="Top" Width="80" Text="{Binding Path=cur_monster.gene7}" VerticalAlignment="Top" Width="125"
Margin="385,260,0,0" /> Margin="338,237,0,0" />
<TextBox x:Name="textbox_gene8" HorizontalAlignment="Left" Height="23" TextWrapping="Wrap" <TextBox x:Name="textbox_gene8" HorizontalAlignment="Left" Height="23" TextWrapping="Wrap"
Text="{Binding Path=cur_monster.gene8}" VerticalAlignment="Top" Width="80" Text="{Binding Path=cur_monster.gene8}" VerticalAlignment="Top" Width="129"
Margin="505,260,0,0" /> Margin="480,237,0,0" />
<TextBox x:Name="textbox_gene9" HorizontalAlignment="Left" Height="23" TextWrapping="Wrap" <TextBox x:Name="textbox_gene9" HorizontalAlignment="Left" Height="23" TextWrapping="Wrap"
Text="{Binding Path=cur_monster.gene9}" VerticalAlignment="Top" Width="80" Text="{Binding Path=cur_monster.gene9}" VerticalAlignment="Top" Width="128"
Margin="625,260,0,0" /> Margin="626,237,0,0" RenderTransformOrigin="0.55,-0.239" />
<Label x:Name="label_mlv" Content="Level" HorizontalAlignment="Left" Margin="150,85,0,0" <Label x:Name="label_mlv" Content="Level" HorizontalAlignment="Left" Margin="150,85,0,0"
VerticalAlignment="Top" RenderTransformOrigin="-0.263,0.135" /> VerticalAlignment="Top" RenderTransformOrigin="-0.263,0.135" />
<Label x:Name="label_mex" Content="Exp" HorizontalAlignment="Left" Margin="150,115,0,0" <Label x:Name="label_mex" Content="Exp" HorizontalAlignment="Left" Margin="150,115,0,0"
@ -247,14 +247,56 @@
HorizontalAlignment="Left" Margin="12,265,0,0" VerticalAlignment="Top" /> HorizontalAlignment="Left" Margin="12,265,0,0" VerticalAlignment="Top" />
<Label x:Name="label_m_warn2" Content="The exact IV algorithm is unknown. Edit wisely." <Label x:Name="label_m_warn2" Content="The exact IV algorithm is unknown. Edit wisely."
HorizontalAlignment="Left" Margin="62,285,0,0" VerticalAlignment="Top" /> HorizontalAlignment="Left" Margin="62,285,0,0" VerticalAlignment="Top" />
<TextBlock x:Name="textblock_gene101" HorizontalAlignment="Left" Margin="385,16,0,0" <TextBlock x:Name="textblock_gene101" HorizontalAlignment="Left" Margin="385,10,0,0"
TextWrapping="Wrap" TextWrapping="Wrap"
Text="MHST Gene 101:&#x0a;0x0001 = Empty Slot&#x0a;0x0002 = No Slot&#x0a;For other gene codes, refer to the gene code mapping." Text="Thank mana_ran@gbatemp.net for gene translations :)"
VerticalAlignment="Top" /> VerticalAlignment="Top" />
<Button x:Name="button_mexp" Content="Max" HorizontalAlignment="Left" Margin="193,119,0,0" <Button x:Name="button_mexp" Content="Max" HorizontalAlignment="Left" Margin="193,119,0,0"
VerticalAlignment="Top" Width="35" Click="button_mexp_Click" /> 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"/> <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"/> <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}"/>
</Grid>
</TabItem>
<TabItem Header="Talisman" 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.Columns>
<DataGridTextColumn CanUserReorder="False" CanUserResize="False" CanUserSort="False"
Width="80" Binding="{Binding id}"
Header="ID" />
<DataGridTextColumn CanUserReorder="False" CanUserResize="False" CanUserSort="False"
Width="80" Binding="{Binding rarity}"
Header="Rarity" />
<DataGridTextColumn CanUserReorder="False" CanUserResize="False" CanUserSort="False"
Width="80" Binding="{Binding new_flag}"
Header="New?" />
<DataGridTextColumn CanUserReorder="False" CanUserResize="False" CanUserSort="False"
Width="80" Binding="{Binding equipped}"
Header="Equipped?" />
<DataGridTextColumn CanUserReorder="False" CanUserResize="False" CanUserSort="False"
Width="80" Binding="{Binding skill1}"
Header="Skill 1" />
<DataGridTextColumn CanUserReorder="False" CanUserResize="False" CanUserSort="False"
Width="*" Binding="{Binding skill2}"
Header="Skill 2" />
</DataGrid.Columns>
</DataGrid>
<Label x:Name="label_tali_ack" Content="Thank 苹果菠萝与芒果@bbs.duowan.com for offsets :)" HorizontalAlignment="Left" Margin="468,4,0,0" VerticalAlignment="Top"/>
<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"/>
<Label x:Name="label_tali_temp" Content="New/Delete coming soon..." HorizontalAlignment="Left" Margin="180,4,0,0" VerticalAlignment="Top"/>
<TextBlock x:Name="label_tali_101" HorizontalAlignment="Left" Margin="571,35,0,0" TextWrapping="Wrap" Text="MHST Talisman 101:&#10;&#10;Rarity is the actual rarity in game minus 1, e.g. Rare 2 = Rarity 0x1.&#10;&#10;Skill 1 and Skill 2 seem to always begin with 4 or 5.&#10;&#10;Equipped can be either 0x4 (Equipped) or 0x0 (Not Equipped).&#10;&#10;Not entirely sure how IDs work. ID is not unique. 0x13E seems to display the actual names of the two skills the talisman has in game. Maybe use that by default but don't quote me on that..." VerticalAlignment="Top"/>
</Grid> </Grid>
</TabItem> </TabItem>
</TabControl> </TabControl>
@ -264,7 +306,7 @@
VerticalAlignment="Top" Width="74" Click="button_load_click" /> VerticalAlignment="Top" Width="74" Click="button_load_click" />
<DataGrid x:Name="dataGrid" HorizontalAlignment="Left" Height="100" Margin="1046,415,-390,-95.5" <DataGrid x:Name="dataGrid" HorizontalAlignment="Left" Height="100" Margin="1046,415,-390,-95.5"
VerticalAlignment="Top" Width="100" /> VerticalAlignment="Top" Width="100" />
<Button x:Name="button_about" Content="About" HorizontalAlignment="Left" Margin="662,10,0,0" VerticalAlignment="Top" Width="74" Click="button_about_Click"/> <Button x:Name="button_about" Content="About" HorizontalAlignment="Left" Margin="716,10,0,0" VerticalAlignment="Top" Width="74" Click="button_about_Click"/>
</Grid> </Grid>
</Window> </Window>

View File

@ -26,6 +26,7 @@ namespace MHSEC_G
InitializeComponent(); InitializeComponent();
button_save.IsEnabled = false; button_save.IsEnabled = false;
Item.read_item_mappings(); Item.read_item_mappings();
Monster.read_gene_mapping();
Array.Clear(dummy_data, 0, dummy_data.Length); Array.Clear(dummy_data, 0, dummy_data.Length);
this.Title = "MHSEC-G Ver " + get_app_version(); this.Title = "MHSEC-G Ver " + get_app_version();
view_model = new ViewModel(dummy_data); view_model = new ViewModel(dummy_data);

View File

@ -1,6 +1,9 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Dynamic;
using System.IO;
using System.Linq;
using System.Windows; using System.Windows;
using MHSEC_G.Annotations; using MHSEC_G.Annotations;
@ -8,9 +11,11 @@ namespace MHSEC_G
{ {
public 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 LIMIT_MONSTER_EXP = 0xFFFFFF;
public const uint SIZE_MONSTER = 0x478; public const uint SIZE_MONSTER = 0x478;
private const uint OFFSETA_MONSTER = 0xA150; private const uint OFFSETA_MONSTER = 0xA150;
private const uint OFFSETR_MONSTER_GENE = 0x424; private const uint OFFSETR_MONSTER_GENE = 0x424;
private const uint SIZE_MONSTER_GENE = 0x4; private const uint SIZE_MONSTER_GENE = 0x4;
@ -276,219 +281,275 @@ namespace MHSEC_G
} }
} }
public string gene1 //
// Genes
//
private uint extract_gene(uint gene_idx)
{ {
get if (gene_idx >= 9)
{ {
return BugCheck.bug_check(BugCheck.ErrorCode.MON_GENE_IDX_OVERFLOW, "Invalid gene index: " + gene_idx);
Model.byte_to_uint16_le(_model.save_file, _offset + OFFSETR_MONSTER_GENE + 0*SIZE_MONSTER_GENE)
.ToString("X4");
} }
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
{ {
uint parsed; set_gene_idx(0, value);
if (Model.parse_hex_string(value, out parsed) && parsed <= 0xFFFF)
{
Model.write_uint16_le(_model.save_file, _offset + OFFSETR_MONSTER_GENE + 0*SIZE_MONSTER_GENE, parsed);
}
else
{
MessageBox.Show("Malformed gene value - must be 0x0 to 0xFFFF.", "Error", MessageBoxButton.OK,
MessageBoxImage.Error);
}
OnPropertyChanged(nameof(gene1)); 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 public string gene2
{ {
get get { return extract_gene(1).ToString("X4"); }
{
return
Model.byte_to_uint16_le(_model.save_file, _offset + OFFSETR_MONSTER_GENE + 1*SIZE_MONSTER_GENE)
.ToString("X4");
}
set set
{ {
uint parsed; set_gene_str(1, value);
if (Model.parse_hex_string(value, out parsed) && parsed <= 0xFFFF)
{
Model.write_uint16_le(_model.save_file, _offset + OFFSETR_MONSTER_GENE + 1*SIZE_MONSTER_GENE, parsed);
}
else
{
MessageBox.Show("Malformed gene value - must be 0x0 to 0xFFFF.", "Error", MessageBoxButton.OK,
MessageBoxImage.Error);
}
OnPropertyChanged(nameof(gene2)); OnPropertyChanged(nameof(gene2));
OnPropertyChanged(nameof(gene2_selected));
} }
} }
public string gene3 public int gene3_selected
{ {
get get { return extract_gene_idx(2); }
{
return
Model.byte_to_uint16_le(_model.save_file, _offset + OFFSETR_MONSTER_GENE + 2*SIZE_MONSTER_GENE)
.ToString("X4");
}
set set
{ {
uint parsed; set_gene_idx(2, value);
if (Model.parse_hex_string(value, out parsed) && parsed <= 0xFFFF) OnPropertyChanged(nameof(gene3));
{ OnPropertyChanged(nameof(gene3_selected));
Model.write_uint16_le(_model.save_file, _offset + OFFSETR_MONSTER_GENE + 2*SIZE_MONSTER_GENE, parsed); }
} }
else
{
MessageBox.Show("Malformed gene value - must be 0x0 to 0xFFFF.", "Error", MessageBoxButton.OK, public string gene3
MessageBoxImage.Error); {
} get { return extract_gene(2).ToString("X4"); }
set
{
set_gene_str(2, value);
OnPropertyChanged(nameof(gene3)); OnPropertyChanged(nameof(gene3));
} }
} }
public string gene4 public int gene4_selected
{ {
get get { return extract_gene_idx(3); }
{
return
Model.byte_to_uint16_le(_model.save_file, _offset + OFFSETR_MONSTER_GENE + 3*SIZE_MONSTER_GENE)
.ToString("X4");
}
set set
{ {
uint parsed; set_gene_idx(3, value);
if (Model.parse_hex_string(value, out parsed) && parsed <= 0xFFFF)
{
Model.write_uint16_le(_model.save_file, _offset + OFFSETR_MONSTER_GENE + 3*SIZE_MONSTER_GENE, parsed);
}
else
{
MessageBox.Show("Malformed gene value - must be 0x0 to 0xFFFF.", "Error", MessageBoxButton.OK,
MessageBoxImage.Error);
}
OnPropertyChanged(nameof(gene4)); 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 public string gene5
{ {
get get { return extract_gene(4).ToString("X4"); }
{
return
Model.byte_to_uint16_le(_model.save_file, _offset + OFFSETR_MONSTER_GENE + 4*SIZE_MONSTER_GENE)
.ToString("X4");
}
set set
{ {
uint parsed; set_gene_str(4, value);
if (Model.parse_hex_string(value, out parsed) && parsed <= 0xFFFF)
{
Model.write_uint16_le(_model.save_file, _offset + OFFSETR_MONSTER_GENE + 4*SIZE_MONSTER_GENE, parsed);
}
else
{
MessageBox.Show("Malformed gene value - must be 0x0 to 0xFFFF.", "Error", MessageBoxButton.OK,
MessageBoxImage.Error);
}
OnPropertyChanged(nameof(gene5)); 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 public string gene6
{ {
get get { return extract_gene(5).ToString("X4"); }
{
return
Model.byte_to_uint16_le(_model.save_file, _offset + OFFSETR_MONSTER_GENE + 5*SIZE_MONSTER_GENE)
.ToString("X4");
}
set set
{ {
uint parsed; set_gene_str(5, value);
if (Model.parse_hex_string(value, out parsed) && parsed <= 0xFFFF)
{
Model.write_uint16_le(_model.save_file, _offset + OFFSETR_MONSTER_GENE + 5*SIZE_MONSTER_GENE, parsed);
}
else
{
MessageBox.Show("Malformed gene value - must be 0x0 to 0xFFFF.", "Error", MessageBoxButton.OK,
MessageBoxImage.Error);
}
OnPropertyChanged(nameof(gene6)); 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 public string gene7
{ {
get get { return extract_gene(6).ToString("X4"); }
{
return
Model.byte_to_uint16_le(_model.save_file, _offset + OFFSETR_MONSTER_GENE + 6*SIZE_MONSTER_GENE)
.ToString("X4");
}
set set
{ {
uint parsed; set_gene_str(6, value);
if (Model.parse_hex_string(value, out parsed) && parsed <= 0xFFFF)
{
Model.write_uint16_le(_model.save_file, _offset + OFFSETR_MONSTER_GENE + 6*SIZE_MONSTER_GENE, parsed);
}
else
{
MessageBox.Show("Malformed gene value - must be 0x0 to 0xFFFF.", "Error", MessageBoxButton.OK,
MessageBoxImage.Error);
}
OnPropertyChanged(nameof(gene7)); 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 public string gene8
{ {
get get { return extract_gene(7).ToString("X4"); }
{
return
Model.byte_to_uint16_le(_model.save_file, _offset + OFFSETR_MONSTER_GENE + 7*SIZE_MONSTER_GENE)
.ToString("X4");
}
set set
{ {
uint parsed; set_gene_str(7, value);
if (Model.parse_hex_string(value, out parsed) && parsed <= 0xFFFF)
{
Model.write_uint16_le(_model.save_file, _offset + OFFSETR_MONSTER_GENE + 7*SIZE_MONSTER_GENE, parsed);
}
else
{
MessageBox.Show("Malformed gene value - must be 0x0 to 0xFFFF.", "Error", MessageBoxButton.OK,
MessageBoxImage.Error);
}
OnPropertyChanged(nameof(gene8)); OnPropertyChanged(nameof(gene8));
OnPropertyChanged(nameof(gene8_selected));
} }
} }
public string gene9
public int gene9_selected
{ {
get get { return extract_gene_idx(8); }
{
return
Model.byte_to_uint16_le(_model.save_file, _offset + OFFSETR_MONSTER_GENE + 8*SIZE_MONSTER_GENE)
.ToString("X4");
}
set set
{ {
uint parsed; set_gene_idx(8, value);
if (Model.parse_hex_string(value, out parsed) && parsed <= 0xFFFF)
{
Model.write_uint16_le(_model.save_file, _offset + OFFSETR_MONSTER_GENE + 8*SIZE_MONSTER_GENE, parsed);
}
else
{
MessageBox.Show("Malformed gene value - must be 0x0 to 0xFFFF.", "Error", MessageBoxButton.OK,
MessageBoxImage.Error);
}
OnPropertyChanged(nameof(gene9)); 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));
} }
} }
@ -523,6 +584,32 @@ namespace MHSEC_G
} }
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; public event PropertyChangedEventHandler PropertyChanged;
[NotifyPropertyChangedInvocator] [NotifyPropertyChangedInvocator]

View File

@ -51,5 +51,5 @@ using System.Windows;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.1.3.0")] [assembly: AssemblyVersion("0.2.0.0")]
[assembly: AssemblyFileVersion("0.1.3.0")] [assembly: AssemblyFileVersion("0.2.0.0")]

View File

@ -60,6 +60,53 @@ namespace MHSEC_G.Properties {
} }
} }
/// <summary>
/// Looks up a localized string similar to 0001 Empty Slot
///0002 No Slot
///0003 アプトノス遺伝子
///0004 ポポ遺伝子
///0005 アプケロス遺伝子
///0006 怪鳥遺伝子
///0007 青怪鳥遺伝子
///0008 毒怪鳥遺伝子
///0009 紫毒怪鳥遺伝子
///000A 黒狼鳥遺伝子
///000B 青熊獣遺伝子
///000C 白兔獣遺伝子
///000D ドスランポス遺伝子
///000E ドスイーオス遺伝子
///000F ドスゲネポス遺伝子
///0010 大猪遺伝子
///0011 化け鮫遺伝子
///0012 フルフル遺伝子
///0013 フルフル亜種遺伝子
///0014 轟竜遺伝子
///0015 黒轟竜遺伝子
///0016 迅竜遺伝子
///0017 緑迅竜遺伝子
///0018 雌火竜遺伝子
///0019 桜火竜遺伝子
///001A 金火竜遺伝子
///001B 火竜遺伝子
///001C 蒼火竜遺伝子
///001D 銀火竜遺伝子
///001E 隻眼の火竜遺伝子
///001F 角竜遺伝子
///0020 黒角竜遺伝子
///0021 一角竜遺伝子
///0022 白一角竜遺伝子
///0023 岩竜遺伝子
///0024 桃岩竜遺伝子
///0025 鎧竜遺伝子
///0026 黒鎧竜遺伝子
///0 [rest of string was truncated]&quot;;.
/// </summary>
internal static string gene {
get {
return ResourceManager.GetString("gene", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to 10 1 药草 /// Looks up a localized string similar to 10 1 药草
///18 2 回复药 ///18 2 回复药

View File

@ -127,4 +127,7 @@
<data name="monster_null_template" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="monster_null_template" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\monster_null_template.bin;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>..\Resources\monster_null_template.bin;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data> </data>
<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>
</root> </root>

Binary file not shown.

View File

@ -1,230 +1,165 @@
using System.ComponentModel; using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Windows;
using MHSEC_G.Annotations;
namespace MHSEC_G namespace MHSEC_G
{ {
public class Talisman public class Talisman
{ {
// private const uint OFFSETA_EGG_FRAGMENTS = 0x9790; private const uint OFFSETA_TALI = 0x7210;
// private const uint OFFSETA_EGG_FRAGMENTS_END = 0x9C3F; private const uint OFFSETA_TALI_END = 0x978F;
// private const uint SIZE_EGG_FRAGMENT = 0xC; private const uint SIZE_TALI = 0x30;
// private const uint OFFSETR_EF_SPE = 0x0; private const uint OFFSETR_TALI_RARITY = 0x24;
// private const uint OFFSETR_EF_POS = 0x1; private const uint OFFSETR_TALI_NEW = 0x12;
// private const uint OFFSETR_EF_NEW = 0x2; private const uint OFFSETR_TALI_SKILL1 = 0x28;
// private const uint OFFSETR_EF_RAR = 0x3; private const uint OFFSETR_TALI_SKILL2 = 0x2A;
// private const uint OFFSETR_EF_COL = 0x4; private const uint OFFSETR_TALI_ID = 0x2;
// private const uint OFFSETR_EF_DLC = 0x5; private const uint OFFSETR_EQUIPPED = 0x11;
// private const uint OFFSETR_EF_6H = 0x6;
// private const uint OFFSETR_EF_7H = 0x7; private readonly uint _offset;
//
// private readonly uint _offset; public uint offset
// {
// public uint offset get { return _offset; }
// { }
// get { return _offset; }
// } private readonly Model _model;
// private readonly Model _model;
// public EggFragment(uint offset, Model model) public Talisman(uint offset, Model model)
// { {
// _model = model; _model = model;
// _offset = offset; _offset = offset;
// } }
//
// public string spe public string rarity
// { {
// get { return Model.byte_to_uint(_model.save_file[_offset + OFFSETR_EF_SPE]).ToString("X2"); } get { return Model.byte_to_uint(_model.save_file[_offset + OFFSETR_TALI_RARITY]).ToString("X2"); }
// set set
// { {
// uint parsed; uint parsed;
// if (Model.parse_hex_string(value, out parsed) && parsed <= 0x0C) if (Model.parse_hex_string(value, out parsed) && parsed <= 0xFF)
// { {
// Model.write_byte(_model.save_file, _offset + OFFSETR_EF_SPE, parsed); Model.write_byte(_model.save_file, _offset + OFFSETR_TALI_RARITY, parsed);
// } }
// else else
// { {
// MessageBox.Show("Malformed Species value - must be at most 0xC", "Error", MessageBoxButton.OK, MessageBoxImage.Error); MessageBox.Show("Malformed Rarity - must be at most 0xFF", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
// } }
// OnPropertyChanged(nameof(spe)); OnPropertyChanged(nameof(rarity));
// } }
// } }
//
// public string pos public string id
// { {
// get { return Model.byte_to_uint(_model.save_file[_offset + OFFSETR_EF_POS]).ToString("X2"); } get { return Model.byte_to_uint16_le(_model.save_file, _offset + OFFSETR_TALI_ID).ToString("X4"); }
// set set
// { {
// uint parsed; uint parsed;
// if (Model.parse_hex_string(value, out parsed) && parsed <= 0x08) if (Model.parse_hex_string(value, out parsed) && parsed <= 0xFFFF)
// { {
// Model.write_byte(_model.save_file, _offset + OFFSETR_EF_POS, parsed); Model.write_uint16_le(_model.save_file, _offset + OFFSETR_TALI_ID, parsed);
// } }
// else else
// { {
// MessageBox.Show("Malformed Position value - must be at most 0x8", "Error", MessageBoxButton.OK, MessageBoxImage.Error); MessageBox.Show("Malformed Talisman ID - must be at most 0xFFFF", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
// } }
// OnPropertyChanged(nameof(pos)); OnPropertyChanged(nameof(id));
// } }
// } }
//
// public string new_flag public string new_flag
// { {
// get { return Model.byte_to_uint(_model.save_file[_offset + OFFSETR_EF_NEW]).ToString("X2"); } get { return Model.byte_to_uint(_model.save_file[_offset + OFFSETR_TALI_NEW]).ToString("X2"); }
// set set
// { {
// uint parsed; uint parsed;
// if (Model.parse_hex_string(value, out parsed) && parsed <= 0x01) if (Model.parse_hex_string(value, out parsed) && parsed <= 0x1)
// { {
// Model.write_byte(_model.save_file, _offset + OFFSETR_EF_NEW, parsed); Model.write_byte(_model.save_file, _offset + OFFSETR_TALI_NEW, parsed);
// } }
// else else
// { {
// MessageBox.Show("Malformed New value - must be 0 or 1", "Error", MessageBoxButton.OK, MessageBoxImage.Error); MessageBox.Show("Malformed New flag - must be at most 0x1", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
// } }
// OnPropertyChanged(nameof(new_flag)); OnPropertyChanged(nameof(new_flag));
// } }
// } }
// public string rarity public string skill1
// { {
// get { return Model.byte_to_uint(_model.save_file[_offset + OFFSETR_EF_RAR]).ToString("X2"); } get { return Model.byte_to_uint16_le(_model.save_file, _offset + OFFSETR_TALI_SKILL1).ToString("X4"); }
// set set
// { {
// uint parsed; uint parsed;
// if (Model.parse_hex_string(value, out parsed) && parsed <= 0x01) if (Model.parse_hex_string(value, out parsed) && parsed <= 0xFFFF)
// { {
// Model.write_byte(_model.save_file, _offset + OFFSETR_EF_RAR, parsed); Model.write_uint16_le(_model.save_file, _offset + OFFSETR_TALI_SKILL1, parsed);
// } }
// else else
// { {
// MessageBox.Show("Malformed Rarity value - must be 0 or 1", "Error", MessageBoxButton.OK, MessageBoxImage.Error); MessageBox.Show("Malformed Skill 1 - must be at most 0xFFFF", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
// } }
// OnPropertyChanged(nameof(rarity)); OnPropertyChanged(nameof(skill1));
// } }
// } }
//
// public string color public string skill2
// { {
// get { return Model.byte_to_uint(_model.save_file[_offset + OFFSETR_EF_COL]).ToString("X2"); } get { return Model.byte_to_uint16_le(_model.save_file, _offset + OFFSETR_TALI_SKILL2).ToString("X4"); }
// set set
// { {
// uint parsed; uint parsed;
// if (Model.parse_hex_string(value, out parsed) && parsed <= 0xFF) if (Model.parse_hex_string(value, out parsed) && parsed <= 0xFFFF)
// { {
// Model.write_byte(_model.save_file, _offset + OFFSETR_EF_COL, parsed); Model.write_uint16_le(_model.save_file, _offset + OFFSETR_TALI_SKILL2, parsed);
// } }
// else else
// { {
// MessageBox.Show("Malformed Species value - must be at most 0xFF", "Error", MessageBoxButton.OK, MessageBoxImage.Error); MessageBox.Show("Malformed Skill 2 - must be at most 0xFFFF", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
// } }
// OnPropertyChanged(nameof(color)); OnPropertyChanged(nameof(skill2));
// } }
// } }
//
// public string dlc public string equipped
// { {
// get { return Model.byte_to_uint(_model.save_file[_offset + OFFSETR_EF_DLC]).ToString("X2"); } get { return Model.byte_to_uint(_model.save_file[_offset + OFFSETR_EQUIPPED]).ToString("X2"); }
// set set
// { {
// uint parsed; uint parsed;
// if (Model.parse_hex_string(value, out parsed) && parsed <= 0xFF) if (Model.parse_hex_string(value, out parsed) && parsed <= 0xFF)
// { {
// Model.write_byte(_model.save_file, _offset + OFFSETR_EF_DLC, parsed); Model.write_byte(_model.save_file, _offset + OFFSETR_EQUIPPED, parsed);
// } }
// else else
// { {
// MessageBox.Show("Malformed DLC value - must be at most 0xFF", "Error", MessageBoxButton.OK, MessageBoxImage.Error); MessageBox.Show("Malformed Equipped value - must be at most 0xFF", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
// } }
// OnPropertyChanged(nameof(dlc)); OnPropertyChanged(nameof(equipped));
// } }
// } }
//
// public string unknown_6h public static ObservableCollection<Talisman> read_all_talismans(Model model)
// { {
// get { return Model.byte_to_uint(_model.save_file[_offset + OFFSETR_EF_6H]).ToString("X2"); } ObservableCollection<Talisman> ret = new ObservableCollection<Talisman>();
// set byte[] buffer = model.save_file;
// { for (uint offset = OFFSETA_TALI; offset < OFFSETA_TALI_END; offset += SIZE_TALI)
// uint parsed; {
// if (Model.parse_hex_string(value, out parsed) && parsed <= 0xFF) if (Model.byte_to_uint16_le(buffer, offset + OFFSETR_TALI_ID) == 0)
// { continue;
// Model.write_byte(_model.save_file, _offset + OFFSETR_EF_6H, parsed); ret.Add(new Talisman(offset, model));
// } }
// else return ret;
// { }
// MessageBox.Show("Malformed Species value - must be at most 0xFF", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
// } public event PropertyChangedEventHandler PropertyChanged;
// OnPropertyChanged(nameof(unknown_6h));
// } [NotifyPropertyChangedInvocator]
// } protected virtual void OnPropertyChanged(string propertyName)
// {
// public string unknown_7h PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
// { }
// get { return Model.byte_to_uint(_model.save_file[_offset + OFFSETR_EF_7H]).ToString("X2"); }
// set
// {
// uint parsed;
// if (Model.parse_hex_string(value, out parsed) && parsed <= 0xFF)
// {
// Model.write_byte(_model.save_file, _offset + OFFSETR_EF_7H, parsed);
// }
// else
// {
// MessageBox.Show("Malformed 7h value - must be at most 0xFF", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
// }
// OnPropertyChanged(nameof(unknown_7h));
// }
// }
//
// public static ObservableCollection<EggFragment> read_all_egg_fragments(Model model)
// {
// ObservableCollection<EggFragment> ret = new ObservableCollection<EggFragment>();
// 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;
// }
//
//
// private static EggFragment egg_frag_offset_exist(ObservableCollection<EggFragment> fragments, uint offset)
// {
// for (uint i = 0; i < fragments.Count; i++)
// {
// if (fragments.ElementAt((int)i).offset == offset)
// return fragments.ElementAt((int)i);
// }
// return null;
// }
//
// public static void write_dlc_egg_fragment(ObservableCollection<EggFragment> fragments, Model model, uint dlc)
// {
// for (uint offset = OFFSETA_EGG_FRAGMENTS; offset < OFFSETA_EGG_FRAGMENTS + 9 * SIZE_EGG_FRAGMENT; offset += SIZE_EGG_FRAGMENT)
// {
// EggFragment each_frag = egg_frag_offset_exist(fragments, offset);
// if (each_frag == null)
// {
// each_frag = new EggFragment(offset, model);
// fragments.Insert((int)((offset - OFFSETA_EGG_FRAGMENTS) / SIZE_EGG_FRAGMENT), each_frag);
// }
// each_frag.new_flag = "0";
// each_frag.spe = "08";
// each_frag.pos = ((offset - OFFSETA_EGG_FRAGMENTS) / SIZE_EGG_FRAGMENT).ToString();
// each_frag.rarity = "0";
// each_frag.color = "0";
// each_frag.dlc = dlc.ToString("X2");
// each_frag.unknown_6h = "0";
// each_frag.unknown_7h = "0";
//
// }
// }
//
// public event PropertyChangedEventHandler PropertyChanged;
//
// [NotifyPropertyChangedInvocator]
// protected virtual void OnPropertyChanged(string propertyName)
// {
// PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
// }
// }
} }
} }

View File

@ -9,6 +9,10 @@ namespace MHSEC_G
{ {
public class ViewModel : INotifyPropertyChanged public class ViewModel : INotifyPropertyChanged
{ {
public List<string> gene_name
{
get { return Monster.GENE_NAME; }
}
private readonly Model _model; private readonly Model _model;
@ -40,6 +44,13 @@ namespace MHSEC_G
} }
} }
private readonly ObservableCollection<Talisman> _talismans;
public ObservableCollection<Talisman> talismans
{
get { return _talismans; }
}
private readonly List<Item> _items; private readonly List<Item> _items;
@ -67,6 +78,7 @@ namespace MHSEC_G
_monsters = new ObservableCollection<Monster>(Monster.read_all_monsters(_model)); _monsters = new ObservableCollection<Monster>(Monster.read_all_monsters(_model));
_cur_monster_selection = _monsters.ElementAt(0); _cur_monster_selection = _monsters.ElementAt(0);
_egg_fragments = EggFragment.read_all_egg_fragments(_model); _egg_fragments = EggFragment.read_all_egg_fragments(_model);
_talismans = Talisman.read_all_talismans(_model);
} }
public event PropertyChangedEventHandler PropertyChanged; public event PropertyChangedEventHandler PropertyChanged;