- 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
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)
{

View File

@ -39,13 +39,13 @@ namespace MHSEC_G
set
{
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);
}
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));
}

View File

@ -16,8 +16,7 @@ namespace MHSEC_G
private static readonly uint OFFSETR_ITEM_COUNT = 0x2;
private static readonly uint OFFSETA_ITEM_BOX_END = 0x2EE7;
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, string> OFFSET_NAME_MAPPING = new Dictionary<uint, string>();

View File

@ -28,7 +28,8 @@
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
<TargetFrameworkProfile />
<TargetFrameworkProfile>
</TargetFrameworkProfile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
@ -54,6 +55,10 @@
<PropertyGroup>
<ApplicationIcon>Resources\MainIcon.ico</ApplicationIcon>
</PropertyGroup>
<PropertyGroup>
<StartupObject>
</StartupObject>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
@ -150,6 +155,9 @@
<ItemGroup>
<Resource Include="Resources\MainIcon.ico" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\gene.txt" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- 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.

View File

@ -5,11 +5,11 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:MHSEC_G"
mc:Ignorable="d"
Title="" Height="447.855" Width="761.218" ResizeMode="NoResize" Icon="Resources/MainIcon.ico">
<Grid HorizontalAlignment="Left" Width="756" Margin="0,0,0,0">
Title="" Height="447.855" Width="810.218" ResizeMode="NoResize" Icon="Resources/MainIcon.ico">
<Grid HorizontalAlignment="Left" Width="800" Margin="0,0,0,-0.5">
<TabControl x:Name="tabControl" HorizontalAlignment="Left" Height="344" Margin="10,51,0,0"
VerticalAlignment="Top" Width="726">
VerticalAlignment="Top" Width="780">
<TabItem Header="Character">
<Grid Background="#FFE5E5E5" Margin="0,0,0,0">
<Label x:Name="label_name" Content="Name" HorizontalAlignment="Left" Margin="10,10,0,0"
@ -70,30 +70,29 @@
</DataGrid.Columns>
</DataGrid>
<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" />
<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" />
<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" />
<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" />
<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" />
<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"
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" />
<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" />
<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>
</TabItem>
<TabItem Header="Items">
@ -117,12 +116,13 @@
Header="Count" />
</DataGrid.Columns>
</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"
Click="button_item_all_Click" />
<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" />
<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>
</TabItem>
<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"
VerticalAlignment="Top" RenderTransformOrigin="0.564,2.072" />
<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"
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"
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"
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"
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"
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"
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"
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"
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"
TextWrapping="Wrap" Text="{Binding Path=cur_monster.hp}" VerticalAlignment="Top"
Width="75" />
@ -190,33 +190,33 @@
<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="23" TextWrapping="Wrap"
Text="{Binding Path=cur_monster.gene1}" VerticalAlignment="Top" Width="80"
Margin="385,120,0,0" />
<TextBox x:Name="textbox_gene2" HorizontalAlignment="Left" Height="23" TextWrapping="Wrap"
Text="{Binding Path=cur_monster.gene2}" VerticalAlignment="Top" Width="80"
Margin="505,120,0,0" />
<TextBox x:Name="textbox_gene3" HorizontalAlignment="Left" Height="23" TextWrapping="Wrap"
Text="{Binding Path=cur_monster.gene3}" VerticalAlignment="Top" Width="80"
Margin="625,120,0,0" />
<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="80"
Margin="385,190,0,0" />
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="80"
Margin="505,190,0,0" />
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="80"
Margin="625,190,0,0" />
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="80"
Margin="385,260,0,0" />
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="80"
Margin="505,260,0,0" />
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="80"
Margin="625,260,0,0" />
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="150,85,0,0"
VerticalAlignment="Top" RenderTransformOrigin="-0.263,0.135" />
<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" />
<Label x:Name="label_m_warn2" Content="The exact IV algorithm is unknown. Edit wisely."
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"
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" />
<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}"/>
</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>
</TabItem>
</TabControl>
@ -264,7 +306,7 @@
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="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>
</Window>

View File

@ -26,6 +26,7 @@ namespace MHSEC_G
InitializeComponent();
button_save.IsEnabled = false;
Item.read_item_mappings();
Monster.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);

View File

@ -1,6 +1,9 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Dynamic;
using System.IO;
using System.Linq;
using System.Windows;
using MHSEC_G.Annotations;
@ -8,9 +11,11 @@ namespace MHSEC_G
{
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;
private const uint OFFSETR_MONSTER_GENE = 0x424;
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
Model.byte_to_uint16_le(_model.save_file, _offset + OFFSETR_MONSTER_GENE + 0*SIZE_MONSTER_GENE)
.ToString("X4");
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
{
uint parsed;
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);
}
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
Model.byte_to_uint16_le(_model.save_file, _offset + OFFSETR_MONSTER_GENE + 1*SIZE_MONSTER_GENE)
.ToString("X4");
}
get { return extract_gene(1).ToString("X4"); }
set
{
uint parsed;
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);
}
set_gene_str(1, value);
OnPropertyChanged(nameof(gene2));
OnPropertyChanged(nameof(gene2_selected));
}
}
public string gene3
public int gene3_selected
{
get
{
return
Model.byte_to_uint16_le(_model.save_file, _offset + OFFSETR_MONSTER_GENE + 2*SIZE_MONSTER_GENE)
.ToString("X4");
}
get { return extract_gene_idx(2); }
set
{
uint parsed;
if (Model.parse_hex_string(value, out parsed) && parsed <= 0xFFFF)
{
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,
MessageBoxImage.Error);
}
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));
}
}
public string gene4
public int gene4_selected
{
get
{
return
Model.byte_to_uint16_le(_model.save_file, _offset + OFFSETR_MONSTER_GENE + 3*SIZE_MONSTER_GENE)
.ToString("X4");
}
get { return extract_gene_idx(3); }
set
{
uint parsed;
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);
}
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
Model.byte_to_uint16_le(_model.save_file, _offset + OFFSETR_MONSTER_GENE + 4*SIZE_MONSTER_GENE)
.ToString("X4");
}
get { return extract_gene(4).ToString("X4"); }
set
{
uint parsed;
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);
}
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
Model.byte_to_uint16_le(_model.save_file, _offset + OFFSETR_MONSTER_GENE + 5*SIZE_MONSTER_GENE)
.ToString("X4");
}
get { return extract_gene(5).ToString("X4"); }
set
{
uint parsed;
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);
}
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
Model.byte_to_uint16_le(_model.save_file, _offset + OFFSETR_MONSTER_GENE + 6*SIZE_MONSTER_GENE)
.ToString("X4");
}
get { return extract_gene(6).ToString("X4"); }
set
{
uint parsed;
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);
}
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
Model.byte_to_uint16_le(_model.save_file, _offset + OFFSETR_MONSTER_GENE + 7*SIZE_MONSTER_GENE)
.ToString("X4");
}
get { return extract_gene(7).ToString("X4"); }
set
{
uint parsed;
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);
}
set_gene_str(7, value);
OnPropertyChanged(nameof(gene8));
OnPropertyChanged(nameof(gene8_selected));
}
}
public string gene9
public int gene9_selected
{
get
{
return
Model.byte_to_uint16_le(_model.save_file, _offset + OFFSETR_MONSTER_GENE + 8*SIZE_MONSTER_GENE)
.ToString("X4");
}
get { return extract_gene_idx(8); }
set
{
uint parsed;
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);
}
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));
}
}
@ -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;
[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
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.1.3.0")]
[assembly: AssemblyFileVersion("0.1.3.0")]
[assembly: AssemblyVersion("0.2.0.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>
/// Looks up a localized string similar to 10 1 药草
///18 2 回复药

View File

@ -127,4 +127,7 @@
<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>
</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>

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
{
public class Talisman
{
// private const uint OFFSETA_EGG_FRAGMENTS = 0x9790;
// private const uint OFFSETA_EGG_FRAGMENTS_END = 0x9C3F;
// private const uint SIZE_EGG_FRAGMENT = 0xC;
// private const uint OFFSETR_EF_SPE = 0x0;
// private const uint OFFSETR_EF_POS = 0x1;
// private const uint OFFSETR_EF_NEW = 0x2;
// private const uint OFFSETR_EF_RAR = 0x3;
// private const uint OFFSETR_EF_COL = 0x4;
// private const uint OFFSETR_EF_DLC = 0x5;
// private const uint OFFSETR_EF_6H = 0x6;
// private const uint OFFSETR_EF_7H = 0x7;
//
// private readonly uint _offset;
//
// public uint offset
// {
// get { return _offset; }
// }
// private readonly Model _model;
// public EggFragment(uint offset, Model model)
// {
// _model = model;
// _offset = offset;
// }
//
// public string spe
// {
// get { return Model.byte_to_uint(_model.save_file[_offset + OFFSETR_EF_SPE]).ToString("X2"); }
// set
// {
// uint parsed;
// if (Model.parse_hex_string(value, out parsed) && parsed <= 0x0C)
// {
// Model.write_byte(_model.save_file, _offset + OFFSETR_EF_SPE, parsed);
// }
// else
// {
// MessageBox.Show("Malformed Species value - must be at most 0xC", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
// }
// OnPropertyChanged(nameof(spe));
// }
// }
//
// public string pos
// {
// get { return Model.byte_to_uint(_model.save_file[_offset + OFFSETR_EF_POS]).ToString("X2"); }
// set
// {
// uint parsed;
// if (Model.parse_hex_string(value, out parsed) && parsed <= 0x08)
// {
// Model.write_byte(_model.save_file, _offset + OFFSETR_EF_POS, parsed);
// }
// else
// {
// MessageBox.Show("Malformed Position value - must be at most 0x8", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
// }
// OnPropertyChanged(nameof(pos));
// }
// }
//
// public string new_flag
// {
// get { return Model.byte_to_uint(_model.save_file[_offset + OFFSETR_EF_NEW]).ToString("X2"); }
// set
// {
// uint parsed;
// if (Model.parse_hex_string(value, out parsed) && parsed <= 0x01)
// {
// Model.write_byte(_model.save_file, _offset + OFFSETR_EF_NEW, parsed);
// }
// else
// {
// MessageBox.Show("Malformed New value - must be 0 or 1", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
// }
// OnPropertyChanged(nameof(new_flag));
// }
// }
// public string rarity
// {
// get { return Model.byte_to_uint(_model.save_file[_offset + OFFSETR_EF_RAR]).ToString("X2"); }
// set
// {
// uint parsed;
// if (Model.parse_hex_string(value, out parsed) && parsed <= 0x01)
// {
// Model.write_byte(_model.save_file, _offset + OFFSETR_EF_RAR, parsed);
// }
// else
// {
// MessageBox.Show("Malformed Rarity value - must be 0 or 1", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
// }
// OnPropertyChanged(nameof(rarity));
// }
// }
//
// public string color
// {
// get { return Model.byte_to_uint(_model.save_file[_offset + OFFSETR_EF_COL]).ToString("X2"); }
// set
// {
// uint parsed;
// if (Model.parse_hex_string(value, out parsed) && parsed <= 0xFF)
// {
// Model.write_byte(_model.save_file, _offset + OFFSETR_EF_COL, parsed);
// }
// else
// {
// MessageBox.Show("Malformed Species value - must be at most 0xFF", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
// }
// OnPropertyChanged(nameof(color));
// }
// }
//
// public string dlc
// {
// get { return Model.byte_to_uint(_model.save_file[_offset + OFFSETR_EF_DLC]).ToString("X2"); }
// set
// {
// uint parsed;
// if (Model.parse_hex_string(value, out parsed) && parsed <= 0xFF)
// {
// Model.write_byte(_model.save_file, _offset + OFFSETR_EF_DLC, parsed);
// }
// else
// {
// MessageBox.Show("Malformed DLC value - must be at most 0xFF", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
// }
// OnPropertyChanged(nameof(dlc));
// }
// }
//
// public string unknown_6h
// {
// get { return Model.byte_to_uint(_model.save_file[_offset + OFFSETR_EF_6H]).ToString("X2"); }
// set
// {
// uint parsed;
// if (Model.parse_hex_string(value, out parsed) && parsed <= 0xFF)
// {
// Model.write_byte(_model.save_file, _offset + OFFSETR_EF_6H, parsed);
// }
// else
// {
// MessageBox.Show("Malformed Species value - must be at most 0xFF", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
// }
// OnPropertyChanged(nameof(unknown_6h));
// }
// }
//
// public string unknown_7h
// {
// 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));
// }
// }
private const uint OFFSETA_TALI = 0x7210;
private const uint OFFSETA_TALI_END = 0x978F;
private const uint SIZE_TALI = 0x30;
private const uint OFFSETR_TALI_RARITY = 0x24;
private const uint OFFSETR_TALI_NEW = 0x12;
private const uint OFFSETR_TALI_SKILL1 = 0x28;
private const uint OFFSETR_TALI_SKILL2 = 0x2A;
private const uint OFFSETR_TALI_ID = 0x2;
private const uint OFFSETR_EQUIPPED = 0x11;
private readonly uint _offset;
public uint offset
{
get { return _offset; }
}
private readonly Model _model;
public Talisman(uint offset, Model model)
{
_model = model;
_offset = offset;
}
public string rarity
{
get { return Model.byte_to_uint(_model.save_file[_offset + OFFSETR_TALI_RARITY]).ToString("X2"); }
set
{
uint parsed;
if (Model.parse_hex_string(value, out parsed) && parsed <= 0xFF)
{
Model.write_byte(_model.save_file, _offset + OFFSETR_TALI_RARITY, parsed);
}
else
{
MessageBox.Show("Malformed Rarity - must be at most 0xFF", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
}
OnPropertyChanged(nameof(rarity));
}
}
public string id
{
get { return Model.byte_to_uint16_le(_model.save_file, _offset + OFFSETR_TALI_ID).ToString("X4"); }
set
{
uint parsed;
if (Model.parse_hex_string(value, out parsed) && parsed <= 0xFFFF)
{
Model.write_uint16_le(_model.save_file, _offset + OFFSETR_TALI_ID, parsed);
}
else
{
MessageBox.Show("Malformed Talisman ID - must be at most 0xFFFF", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
}
OnPropertyChanged(nameof(id));
}
}
public string new_flag
{
get { return Model.byte_to_uint(_model.save_file[_offset + OFFSETR_TALI_NEW]).ToString("X2"); }
set
{
uint parsed;
if (Model.parse_hex_string(value, out parsed) && parsed <= 0x1)
{
Model.write_byte(_model.save_file, _offset + OFFSETR_TALI_NEW, parsed);
}
else
{
MessageBox.Show("Malformed New flag - must be at most 0x1", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
}
OnPropertyChanged(nameof(new_flag));
}
}
public string skill1
{
get { return Model.byte_to_uint16_le(_model.save_file, _offset + OFFSETR_TALI_SKILL1).ToString("X4"); }
set
{
uint parsed;
if (Model.parse_hex_string(value, out parsed) && parsed <= 0xFFFF)
{
Model.write_uint16_le(_model.save_file, _offset + OFFSETR_TALI_SKILL1, parsed);
}
else
{
MessageBox.Show("Malformed Skill 1 - must be at most 0xFFFF", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
}
OnPropertyChanged(nameof(skill1));
}
}
public string skill2
{
get { return Model.byte_to_uint16_le(_model.save_file, _offset + OFFSETR_TALI_SKILL2).ToString("X4"); }
set
{
uint parsed;
if (Model.parse_hex_string(value, out parsed) && parsed <= 0xFFFF)
{
Model.write_uint16_le(_model.save_file, _offset + OFFSETR_TALI_SKILL2, parsed);
}
else
{
MessageBox.Show("Malformed Skill 2 - must be at most 0xFFFF", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
}
OnPropertyChanged(nameof(skill2));
}
}
public string equipped
{
get { return Model.byte_to_uint(_model.save_file[_offset + OFFSETR_EQUIPPED]).ToString("X2"); }
set
{
uint parsed;
if (Model.parse_hex_string(value, out parsed) && parsed <= 0xFF)
{
Model.write_byte(_model.save_file, _offset + OFFSETR_EQUIPPED, parsed);
}
else
{
MessageBox.Show("Malformed Equipped value - must be at most 0xFF", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
}
OnPropertyChanged(nameof(equipped));
}
}
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;
}
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 List<string> gene_name
{
get { return Monster.GENE_NAME; }
}
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;
@ -67,6 +78,7 @@ namespace MHSEC_G
_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);
}
public event PropertyChangedEventHandler PropertyChanged;