Skip to content

Commit

Permalink
- Added UID, Party Editing.
Browse files Browse the repository at this point in the history
- Separated monster skills.
- Added NA support of "DELETE" monsters.
  • Loading branch information
quackerd committed Sep 10, 2017
1 parent 3588806 commit 9fbf4e9
Show file tree
Hide file tree
Showing 15 changed files with 275 additions and 72 deletions.
4 changes: 2 additions & 2 deletions MHSEC-G/MHSEC-G.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
# Visual Studio 15
VisualStudioVersion = 15.0.26430.14
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MHSEC-G", "MHSEC-G\MHSEC-G.csproj", "{80372081-2D34-424B-93E2-89D5815BF3E8}"
EndProject
Expand Down
14 changes: 11 additions & 3 deletions MHSEC-G/MHSEC-G/MHSEC-G.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
</TargetFrameworkProfile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<PlatformTarget>x86</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
Expand All @@ -43,7 +43,7 @@
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<PlatformTarget>x86</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
Expand Down Expand Up @@ -98,6 +98,9 @@
<DependentUpon>MonsterWindow.xaml</DependentUpon>
</Compile>
<Compile Include="Offsets.cs" />
<Compile Include="PartyWindow.xaml.cs">
<DependentUpon>PartyWindow.xaml</DependentUpon>
</Compile>
<Compile Include="Properties\Annotations.cs" />
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
Expand Down Expand Up @@ -126,6 +129,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="PartyWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs">
Expand All @@ -151,7 +158,8 @@
<AppDesigner Include="Properties\" />
<None Include="Resources\egg_dummy_template.bin" />
<None Include="Resources\egg_null_template.bin" />
<None Include="Resources\monster_null_template.bin" />
<None Include="Resources\monster_null_template_JPN.bin" />
<None Include="Resources\monster_null_template_NA.bin" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\idmap.txt" />
Expand Down
16 changes: 10 additions & 6 deletions MHSEC-G/MHSEC-G/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@
</TabItem>
<TabItem Header="Monsters" Margin="0,0,0,0">
<Grid Background="#FFE5E5E5">
<DataGrid x:Name="monster_grid" HorizontalAlignment="Left" Margin="10,24,0,0" IsReadOnly="True"
VerticalAlignment="Top" Height="293" Width="414" CanUserAddRows="False"
<DataGrid x:Name="monster_grid" HorizontalAlignment="Left" Margin="10,36,0,0" IsReadOnly="True"
VerticalAlignment="Top" Height="286" Width="414" CanUserAddRows="False"
AutoGenerateColumns="False" SelectionMode="Single" ItemsSource="{Binding monsters}">
<DataGrid.RowStyle>
<Style TargetType="{x:Type DataGridRow}">
Expand All @@ -147,20 +147,24 @@
</DataGrid.RowStyle>
<DataGrid.Columns>
<DataGridTextColumn CanUserReorder="False" CanUserResize="False" CanUserSort="False"
Width="40" Binding="{Binding box}"
Width="30" Binding="{Binding box}"
Header="Box"/>
<DataGridTextColumn CanUserReorder="False" CanUserResize="False" CanUserSort="False"
Width="40" Binding="{Binding slot}"
Width="30" Binding="{Binding slot}"
Header="Slot"/>
<DataGridTextColumn CanUserReorder="False" CanUserResize="False" CanUserSort="False"
Width="250" Binding="{Binding name}"
Width="40" Binding="{Binding uid}"
Header="UID"/>
<DataGridTextColumn CanUserReorder="False" CanUserResize="False" CanUserSort="False"
Width="200" 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"/>
<Label x:Name="label_monster" Content="Double-click an entry to edit." HorizontalAlignment="Left" Margin="10,5,0,0" VerticalAlignment="Top" RenderTransformOrigin="0.184,0.019"/>
<Button x:Name="btn_monster_party" Content="Edit Current Party" HorizontalAlignment="Left" VerticalAlignment="Top" Width="112" Margin="312,8,0,0" Click="btn_monster_party_Click"/>
</Grid>
</TabItem>
<TabItem Header="Talismans" Margin="0,0,0,0">
Expand Down
8 changes: 6 additions & 2 deletions MHSEC-G/MHSEC-G/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,8 @@ public MainWindow()
byte[] dummy = new byte[Offsets.SAVE_FILE_SIZE_JPN];
Array.Clear(dummy, 0, dummy.Length);
this.Title = "MHSEC-G Ver " + get_app_version();

Offsets.init(dummy);
init(dummy);

DataContext = this;
}

Expand Down Expand Up @@ -234,5 +232,11 @@ private void button_eggs_delete_Click(object sender, RoutedEventArgs e)
}
}
}

private void btn_monster_party_Click(object sender, RoutedEventArgs e)
{
PartyWindow partyWnd = new PartyWindow(_model);
partyWnd.Show();
}
}
}
54 changes: 47 additions & 7 deletions MHSEC-G/MHSEC-G/Monster.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,26 @@ public string spe
}
}

public string uid
{
get => Helper.byte_to_uint16_le(_data, _obj_offset + Offsets.OFFSETR_MONSTER_UID).ToString("X4");
set
{
uint parsed;
if (Helper.parse_hex_string(value, out parsed) && parsed <= 0xFFFF)
{
Helper.write_uint16_le(_data, _obj_offset + Offsets.OFFSETR_MONSTER_UID, parsed);
}
else
{
MessageBox.Show("UID must be at most 0xFFFF", "Error", MessageBoxButton.OK,
MessageBoxImage.Error);
}
OnPropertyChanged(nameof(uid));
}
}


public uint atk
{
get => Helper.byte_to_uint16_le(_data, _obj_offset + Offsets.OFFSETR_MONSTER_ATK);
Expand Down Expand Up @@ -250,26 +270,46 @@ public uint level
}
}

public string skill
public string skill1
{
get => Helper.byte_to_uint16_le(_data, _obj_offset + Offsets.OFFSETR_MONSTER_SKILL).ToString("X4");
get => Helper.byte_to_uint(_data[_obj_offset + Offsets.OFFSETR_MONSTER_SKILL]).ToString("X2");
set
{
uint parsed;
if (Helper.parse_hex_string(value, out parsed))
if (Helper.parse_hex_string(value, out parsed) && parsed <= 0xFF)
{
Helper.write_uint16_le(_data, _obj_offset + Offsets.OFFSETR_MONSTER_SKILL, parsed);
_data[_obj_offset + Offsets.OFFSETR_MONSTER_SKILL] = (byte) (parsed & 0xFF);
}
else
{
MessageBox.Show("Malformed skill value - must be 0x0 to 0xFFFF.", "Error", MessageBoxButton.OK,
MessageBox.Show("Malformed skill value - must be <= 0xFF.", "Error", MessageBoxButton.OK,
MessageBoxImage.Error);
}

OnPropertyChanged(nameof(skill));
OnPropertyChanged(nameof(skill1));
}
}


public string skill2
{
get => Helper.byte_to_uint(_data[_obj_offset + Offsets.OFFSETR_MONSTER_SKILL + 1]).ToString("X2");
set
{
uint parsed;
if (Helper.parse_hex_string(value, out parsed) && parsed <= 0xFF)
{
_data[_obj_offset + Offsets.OFFSETR_MONSTER_SKILL + 1] = (byte)(parsed & 0xFF);
}
else
{
MessageBox.Show("Malformed skill value - must be <= 0xFF.", "Error", MessageBoxButton.OK,
MessageBoxImage.Error);
}

OnPropertyChanged(nameof(skill2));
}
}


public Monster(byte[] model, uint objOffset) : base(model, objOffset, Offsets.SIZE_MONSTER)
{
Expand Down
Loading

0 comments on commit 9fbf4e9

Please sign in to comment.