- Weapon/Armor editing
- Monster Skill Editing
- Fixed Monster Name Bug
- Egg Editing
This commit is contained in:
secXsQuared1995 2016-11-05 00:13:36 -04:00
parent c824de0fcb
commit 6cdc6bfc21
15 changed files with 567 additions and 83 deletions

163
MHSEC-G/MHSEC-G/Armor.cs Normal file
View File

@ -0,0 +1,163 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Windows;
using MHSEC_G.Annotations;
namespace MHSEC_G
{
internal class Armor : INotifyPropertyChanged
{
private const uint OFFSETA_ARM = 0x55F0;
private const uint OFFSETA_ARM_END = 0x720E;
// 200 armors
private const uint SIZE_ARM = 0x24;
private const uint OFFSETR_ARM_ID = 0x2;
private const uint OFFSETR_ARM_LEVEL = 0x4;
private const uint OFFSETR_ARM_14h = 0x14;
private const uint OFFSETR_ARM_18h = 0x18;
private const uint OFFSETR_ARM_1C = 0x1c;
private readonly uint _offset;
private readonly Model _model;
public Armor(Model model, uint offset)
{
_offset = offset;
_model = model;
}
public string id
{
set
{
uint parsed;
if (Model.parse_hex_string(value, out parsed) && parsed <= 0xFFFF)
{
Model.write_uint16_le(_model.save_file, _offset + OFFSETR_ARM_ID, parsed);
}
else
{
MessageBox.Show("Malformed int - must be at most 0xFFFF", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
}
OnPropertyChanged(nameof(id));
}
get
{
return Model.byte_to_uint16_le(_model.save_file, _offset + OFFSETR_ARM_ID).ToString("X4");
}
}
public string level
{
set
{
uint parsed;
if (Model.parse_hex_string(value, out parsed) && parsed <= 0xFFFF)
{
Model.write_uint16_le(_model.save_file, _offset + OFFSETR_ARM_LEVEL, parsed);
}
else
{
MessageBox.Show("Malformed int - must be at most 0xFFFF", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
}
OnPropertyChanged(nameof(level));
}
get
{
return Model.byte_to_uint16_le(_model.save_file, _offset + OFFSETR_ARM_LEVEL).ToString("X4");
}
}
public string unknown_14h
{
set
{
uint parsed;
if (Model.parse_hex_string(value, out parsed))
{
Model.write_uint16_le(_model.save_file, _offset + OFFSETR_ARM_14h, parsed);
}
else
{
MessageBox.Show("Malformed int - must be at most 0xFFFFFFFF", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
}
OnPropertyChanged(nameof(unknown_14h));
}
get
{
return Model.byte_to_uint32_le(_model.save_file, _offset + OFFSETR_ARM_14h).ToString("X8");
}
}
public string unknown_18h
{
set
{
uint parsed;
if (Model.parse_hex_string(value, out parsed))
{
Model.write_uint32_le(_model.save_file, _offset + OFFSETR_ARM_18h, parsed);
}
else
{
MessageBox.Show("Malformed int - must be at most 0xFFFFFFFF", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
}
OnPropertyChanged(nameof(unknown_18h));
}
get
{
return Model.byte_to_uint32_le(_model.save_file, _offset + OFFSETR_ARM_18h).ToString("X8");
}
}
public string unknown_1ch
{
set
{
uint parsed;
if (Model.parse_hex_string(value, out parsed))
{
Model.write_uint32_le(_model.save_file, _offset + OFFSETR_ARM_1C, parsed);
}
else
{
MessageBox.Show("Malformed int - must be at most 0xFFFFFFFF", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
}
OnPropertyChanged(nameof(unknown_1ch));
}
get
{
return Model.byte_to_uint32_le(_model.save_file, _offset + OFFSETR_ARM_1C).ToString("X8");
}
}
public static ObservableCollection<Armor> read_all_armors(Model model)
{
ObservableCollection<Armor> ret = new ObservableCollection<Armor>();
for (uint i = OFFSETA_ARM; i < OFFSETA_ARM_END; i += SIZE_ARM)
{
if (Model.byte_to_uint16_le(model.save_file, i) == 0x7FFF)
{
continue;
}
ret.Add(new Armor(model, i));
}
return ret;
}
public event PropertyChangedEventHandler PropertyChanged;
[NotifyPropertyChangedInvocator]
protected virtual void OnPropertyChanged(string propertyName)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
}

View File

@ -3,7 +3,7 @@ using System.Windows;
namespace MHSEC_G
{
public class BugCheck
internal class BugCheck
{
public enum ErrorCode
{
@ -27,6 +27,11 @@ namespace MHSEC_G
// Facility Monster
MON_GENE_MAPPING_CORRUPTED = 0x31,
MON_GENE_IDX_OVERFLOW = 0x32,
// Factility OffsetObject
OFFSET_OBJ_MODEL_NULL = 0x41,
OFFSET_READ_OBJ_ARG_NULL = 0x42,
OFFSET_OBJ_MISMATCHED_TYPE = 0x43
}
public static void bug_check(ErrorCode error_code, string error_message)
{

View File

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

97
MHSEC-G/MHSEC-G/Egg.cs Normal file
View File

@ -0,0 +1,97 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Windows;
using MHSEC_G.Annotations;
namespace MHSEC_G
{
internal class Egg : INotifyPropertyChanged
{
private const int OFFSETA_EGG_START = 0x53EC0;
private const int OFFSETA_EGG_END = 0x54505;
// 200 weapons
private const int SIZE_EGG = 0x92;
private const int OFFSETR_SPE = 0x0;
private const int OFFSETR_WGT = 0x2E;
private readonly uint _offset;
private readonly Model _model;
public Egg(Model model, uint offset)
{
_offset = offset;
_model = model;
}
public string spe
{
set
{
uint parsed;
if (Model.parse_hex_string(value, out parsed) && parsed <= 0xFF)
{
Model.write_byte(_model.save_file, _offset + OFFSETR_SPE, parsed);
}
else
{
MessageBox.Show("Malformed int - must be at most 0xFF", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
}
OnPropertyChanged(nameof(spe));
}
get
{
return Model.byte_to_uint(_model.save_file[_offset + OFFSETR_SPE]).ToString("X2");
}
}
public string wgt
{
set
{
uint parsed;
if (Model.parse_hex_string(value, out parsed) && parsed <= 0xFF)
{
Model.write_byte(_model.save_file, _offset + OFFSETR_WGT, parsed);
}
else
{
MessageBox.Show("Malformed int - must be at most 0xFF", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
}
OnPropertyChanged(nameof(wgt));
}
get
{
return Model.byte_to_uint(_model.save_file[_offset + OFFSETR_WGT]).ToString("X2");
}
}
public static ObservableCollection<Egg> read_all_eggs(Model model)
{
ObservableCollection<Egg> ret = new ObservableCollection<Egg>();
for (uint i = OFFSETA_EGG_START; i < OFFSETA_EGG_END; i += SIZE_EGG)
{
if (Model.byte_to_uint(model.save_file[i + OFFSETR_SPE]) == 0xFF)
{
continue;
}
ret.Add(new Egg(model, i));
}
return ret;
}
public event PropertyChangedEventHandler PropertyChanged;
[NotifyPropertyChangedInvocator]
protected virtual void OnPropertyChanged(string propertyName)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
}

View File

@ -6,7 +6,7 @@ using MHSEC_G.Annotations;
namespace MHSEC_G
{
public class EggFragment : INotifyPropertyChanged
internal class EggFragment : INotifyPropertyChanged
{
private const uint OFFSETA_EGG_FRAGMENTS = 0x9790;
private const uint OFFSETA_EGG_FRAGMENTS_END = 0x9C3F;

View File

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

View File

@ -81,8 +81,10 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Compile Include="Armor.cs" />
<Compile Include="BugCheck.cs" />
<Compile Include="Character.cs" />
<Compile Include="Egg.cs" />
<Compile Include="EggFragment.cs" />
<Compile Include="Item.cs" />
<Compile Include="Model.cs" />
@ -95,6 +97,7 @@
</Compile>
<Compile Include="Talisman.cs" />
<Compile Include="ViewModel.cs" />
<Compile Include="Weapon.cs" />
<Page Include="MainWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>

View File

@ -10,37 +10,68 @@
<TabControl x:Name="tabControl" HorizontalAlignment="Left" Height="344" Margin="10,51,0,0"
VerticalAlignment="Top" Width="780">
<TabItem Header="Character">
<TabItem Header="Character/Items">
<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,42,0,0"
VerticalAlignment="Top" />
<Label x:Name="label_money" Content="Money" HorizontalAlignment="Left" Margin="10,40,0,0"
<Label x:Name="label_money" Content="Money" HorizontalAlignment="Left" Margin="4,69,0,0"
VerticalAlignment="Top" />
<Label x:Name="label_leve" Content="Level" HorizontalAlignment="Left" Margin="10,70,0,0"
<Label x:Name="label_leve" Content="Level" HorizontalAlignment="Left" Margin="14,95,0,0"
VerticalAlignment="Top" />
<Label x:Name="label_exp" Content="Exp" HorizontalAlignment="Left" Margin="10,100,0,0"
<Label x:Name="label_exp" Content="Exp" HorizontalAlignment="Left" Margin="22,121,0,0"
VerticalAlignment="Top" />
<TextBox x:Name="textbox_name" HorizontalAlignment="Left" Height="22" Margin="61,14,0,0"
<TextBox x:Name="textbox_name" HorizontalAlignment="Left" Height="22" Margin="61,44,0,0"
TextWrapping="NoWrap" VerticalAlignment="Top" Width="120" Text="{Binding character.name}" />
<TextBox x:Name="textbox_money" HorizontalAlignment="Left" Height="22" Margin="61,44,0,0"
<TextBox x:Name="textbox_money" HorizontalAlignment="Left" Height="22" Margin="61,72,0,0"
TextWrapping="NoWrap" VerticalAlignment="Top" Width="120" Text="{Binding character.money}" />
<TextBox x:Name="textbox_level" HorizontalAlignment="Left" Height="22" Margin="61,74,0,0"
<TextBox x:Name="textbox_level" HorizontalAlignment="Left" Height="22" Margin="61,99,0,0"
TextWrapping="NoWrap" VerticalAlignment="Top" Width="120" Text="{Binding character.level}" />
<TextBox x:Name="textbox_exp" HorizontalAlignment="Left" Height="22" Margin="61,104,0,0"
<TextBox x:Name="textbox_exp" HorizontalAlignment="Left" Height="22" Margin="61,126,0,0"
TextWrapping="NoWrap" VerticalAlignment="Top" Width="120" Text="{Binding character.exp}" />
<Button x:Name="button_char_money" Content="Max Money" HorizontalAlignment="Left"
Margin="200,44,0,0" VerticalAlignment="Top" Width="88" RenderTransformOrigin="0.065,-0.953"
Margin="200,73,0,0" VerticalAlignment="Top" Width="88" RenderTransformOrigin="0.065,-0.953"
Height="22" Click="button_char_money_Click" />
<Button x:Name="button_char_exp" Content="Max Exp" HorizontalAlignment="Left" Margin="200,104,0,0"
<Button x:Name="button_char_exp" Content="Max Exp" HorizontalAlignment="Left" Margin="200,126,0,0"
VerticalAlignment="Top" Width="88" RenderTransformOrigin="0.065,-0.953" Height="22"
Click="button_char_exp_Click" />
<DataGrid x:Name="item_table_Copy" ItemsSource="{Binding items}" HorizontalAlignment="Left"
Margin="349,44,0,0" VerticalAlignment="Top" Height="258" Width="415"
CanUserAddRows="False" AutoGenerateColumns="False">
<DataGrid.Columns>
<DataGridTextColumn CanUserReorder="False" CanUserResize="False" CanUserSort="True"
Width="80" Foreground="Gray" IsReadOnly="True" Binding="{Binding offset, StringFormat=\{0:X4\}}"
Header="Offset (Hex)" />
<DataGridTextColumn CanUserReorder="False" CanUserResize="False" CanUserSort="True"
Width="80" Foreground="Gray" IsReadOnly="True" Binding="{Binding id, StringFormat=\{0:X4\}}"
Header="ID (Hex)" />
<DataGridTextColumn CanUserReorder="False" CanUserResize="False" CanUserSort="True"
Width="100" Foreground="Gray" IsReadOnly="True"
Binding="{Binding name}"
Header="Name" />
<DataGridTextColumn CanUserReorder="False" CanUserResize="False" CanUserSort="True"
Width="*" Binding="{Binding count, Mode=TwoWay}"
Header="Count" />
</DataGrid.Columns>
</DataGrid>
<Button x:Name="button_item_all_Copy" Content="All 986x" HorizontalAlignment="Left" Margin="579,6,0,0"
VerticalAlignment="Top" Width="90" RenderTransformOrigin="0.065,-0.953" Height="30"
Click="button_item_all_Click" />
<Button x:Name="button_item_existing_Copy" Content="Existing 999x" HorizontalAlignment="Left"
Margin="674,6,0,0" VerticalAlignment="Top" Width="90"
RenderTransformOrigin="0.065,-0.953" Height="30" Click="button_item_existing_Click" />
<Label x:Name="label_items" Content="Items" HorizontalAlignment="Left" Margin="349,6,0,0" VerticalAlignment="Top" FontSize="18"/>
<Label x:Name="label_character" Content="Character" HorizontalAlignment="Left" Margin="10,5,0,0" VerticalAlignment="Top" FontSize="18"/>
</Grid>
</TabItem>
<TabItem Header="Egg Fragments">
<TabItem Header="Eggs/Fragments">
<Grid Background="#FFE5E5E5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="244*"/>
<ColumnDefinition Width="143*"/>
</Grid.ColumnDefinitions>
<DataGrid x:Name="egg_frag_grid" HorizontalAlignment="Left" Margin="10,35,0,0"
VerticalAlignment="Top" Height="271" Width="556" CanUserAddRows="False"
VerticalAlignment="Top" Height="271" Width="361" CanUserAddRows="False"
AutoGenerateColumns="False" ItemsSource="{Binding Path=egg_fragments}">
<DataGrid.Columns>
<DataGridTextColumn CanUserReorder="False" CanUserResize="False" CanUserSort="False"
@ -50,19 +81,19 @@
Width="60" Binding="{Binding pos}"
Header="Position" />
<DataGridTextColumn CanUserReorder="False" CanUserResize="False" CanUserSort="False"
Width="60" Binding="{Binding new_flag}"
Width="40" Binding="{Binding new_flag}"
Header="New?" />
<DataGridTextColumn CanUserReorder="False" CanUserResize="False" CanUserSort="False"
Width="60" Binding="{Binding rarity}"
Width="40" Binding="{Binding rarity}"
Header="Rarity" />
<DataGridTextColumn CanUserReorder="False" CanUserResize="False" CanUserSort="False"
Width="60" Binding="{Binding color}"
Width="40" Binding="{Binding color}"
Header="Color" />
<DataGridTextColumn CanUserReorder="False" CanUserResize="False" CanUserSort="False"
Width="60" Binding="{Binding dlc}"
Width="40" Binding="{Binding dlc}"
Header="DLC" />
<DataGridTextColumn CanUserReorder="False" CanUserResize="False" CanUserSort="False"
Width="60" Binding="{Binding unknown_7h}"
Width="40" Binding="{Binding unknown_7h}"
Header="0x6" />
<DataGridTextColumn CanUserReorder="False" CanUserResize="False" CanUserSort="False"
Width="*" Binding="{Binding unknown_6h}"
@ -70,61 +101,45 @@
</DataGrid.Columns>
</DataGrid>
<Button x:Name="button_give_dino" Content="Give Dinovaldo" HorizontalAlignment="Left"
Margin="622,195,0,0" VerticalAlignment="Top" Width="110" Height="30"
Click="button_give_dino_Click" />
Margin="385,175,0,0" VerticalAlignment="Top" Width="110" Height="30"
Click="button_give_dino_Click" Grid.ColumnSpan="2" />
<Button x:Name="button_give_epony" Content="Give Epony" HorizontalAlignment="Left"
Margin="622,35,0,0" VerticalAlignment="Top" Width="110" Height="30"
Click="button_give_epony_Click" />
Margin="385,35,0,0" VerticalAlignment="Top" Width="110" Height="30"
Click="button_give_epony_Click" Grid.ColumnSpan="2" />
<Button x:Name="button_give_bear" Content="Give Mascot" HorizontalAlignment="Left"
Margin="622,75,0,0" VerticalAlignment="Top" Width="110" Height="30"
Click="button_give_bear_Click" />
Margin="385,70,0,0" VerticalAlignment="Top" Width="110" Height="30"
Click="button_give_bear_Click" Grid.ColumnSpan="2" />
<Button x:Name="button_give_mtiggy" Content="Give Molten Tigrex" HorizontalAlignment="Left"
Margin="622,115,0,0" VerticalAlignment="Top" Width="110" Height="30"
Click="button_give_mtiggy_Click" />
Margin="385,105,0,0" VerticalAlignment="Top" Width="110" Height="30"
Click="button_give_mtiggy_Click" Grid.ColumnSpan="2" />
<Button x:Name="button_give_okirin" Content="Give Oroshi Kirin" HorizontalAlignment="Left"
Margin="622,155,0,0" VerticalAlignment="Top" Width="110" Height="30"
Click="button_give_okirin_Click" />
Margin="385,140,0,0" VerticalAlignment="Top" Width="110" Height="30"
Click="button_give_okirin_Click" Grid.ColumnSpan="2" />
<Button x:Name="button_give_pd" Content="Give Puzzle Dragon" HorizontalAlignment="Left"
Margin="622,235,0,0" VerticalAlignment="Top" Width="110" Height="30"
Click="button_give_pd_Click" />
Margin="385,210,0,0" VerticalAlignment="Top" Width="110" Height="30"
Click="button_give_pd_Click" Grid.ColumnSpan="2" />
<Button x:Name="button_give_wm" Content="Give W. Monoblos" HorizontalAlignment="Left"
Margin="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">
<Grid Background="#FFE5E5E5" Margin="0,0,0,0">
<DataGrid x:Name="item_table" ItemsSource="{Binding items}" HorizontalAlignment="Left"
Margin="10,30,0,0" VerticalAlignment="Top" Height="276" Width="550"
CanUserAddRows="False" AutoGenerateColumns="False">
Margin="385,245,0,0" VerticalAlignment="Top" Width="110" Height="30"
Click="button_give_wm_Click" Grid.ColumnSpan="2" />
<Button x:Name="button_eggf_new" IsEnabled="False" Content="New" HorizontalAlignment="Left" Margin="216,10,0,0" VerticalAlignment="Top" Width="75"/>
<Button x:Name="button_eggf_delete" IsEnabled="False" Content="Delete" HorizontalAlignment="Left" Margin="296,10,0,0" VerticalAlignment="Top" Width="75"/>
<DataGrid x:Name="egg_grid" HorizontalAlignment="Left" Margin="39,35,0,0"
VerticalAlignment="Top" Height="271" Width="237" CanUserAddRows="False"
AutoGenerateColumns="False" ItemsSource="{Binding eggs}" Grid.Column="1">
<DataGrid.Columns>
<DataGridTextColumn CanUserReorder="False" CanUserResize="False" CanUserSort="True"
Width="100" Foreground="Gray" IsReadOnly="True" Binding="{Binding offset , StringFormat={}{0:X4}}"
Header="Offset (Hex)" />
<DataGridTextColumn CanUserReorder="False" CanUserResize="False" CanUserSort="True"
Width="100" Foreground="Gray" IsReadOnly="True" Binding="{Binding id , StringFormat={}{0:X4}}"
Header="ID (Hex)" />
<DataGridTextColumn CanUserReorder="False" CanUserResize="False" CanUserSort="True"
Width="125" Foreground="Gray" IsReadOnly="True"
Binding="{Binding name}"
Header="Name" />
<DataGridTextColumn CanUserReorder="False" CanUserResize="False" CanUserSort="True"
Width="*" Binding="{Binding count, Mode=TwoWay}"
Header="Count" />
<DataGridTextColumn CanUserReorder="False" CanUserResize="False" CanUserSort="False"
Width="100" Binding="{Binding spe}"
Header="Species" />
<DataGridTextColumn CanUserReorder="False" CanUserResize="False" CanUserSort="False"
Width="*" Binding="{Binding wgt}"
Header="Weight" />
</DataGrid.Columns>
</DataGrid>
<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="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"/>
<Label x:Name="label1" Content="Eggs" Grid.Column="1" HorizontalAlignment="Left" Margin="39,1,0,0" VerticalAlignment="Top" FontSize="18"/>
<Label x:Name="label1_Copy" Content="Egg Fragments" HorizontalAlignment="Left" Margin="10,0,0,0" VerticalAlignment="Top" FontSize="18"/>
</Grid>
</TabItem>
<TabItem Header="Monsters" Margin="0,0,0,0">
<Grid Background="#FFE5E5E5">
<Label x:Name="label_mhp" Content="HP" HorizontalAlignment="Left" Margin="10,85,0,0"
@ -217,7 +232,7 @@
<TextBox x:Name="textbox_gene9" HorizontalAlignment="Left" Height="23" TextWrapping="Wrap"
Text="{Binding Path=cur_monster.gene9}" VerticalAlignment="Top" Width="128"
Margin="626,237,0,0" RenderTransformOrigin="0.55,-0.239" />
<Label x:Name="label_mlv" Content="Level" HorizontalAlignment="Left" Margin="150,85,0,0"
<Label x:Name="label_mlv" Content="Level" HorizontalAlignment="Left" Margin="191,84,0,0"
VerticalAlignment="Top" RenderTransformOrigin="-0.263,0.135" />
<Label x:Name="label_mex" Content="Exp" HorizontalAlignment="Left" Margin="150,115,0,0"
VerticalAlignment="Top" RenderTransformOrigin="-0.263,0.135" />
@ -236,7 +251,7 @@
VerticalAlignment="Top" />
<TextBox x:Name="textbox_mname" HorizontalAlignment="Left" Height="22" Margin="60,58,0,0"
TextWrapping="Wrap" Text="{Binding Path=cur_monster.name}" VerticalAlignment="Top"
Width="255" />
Width="118" />
<Label x:Name="label_slct" Content="Monster" HorizontalAlignment="Left" Margin="2,10,0,0"
VerticalAlignment="Top" RenderTransformOrigin="0.466,0.596" />
<ComboBox x:Name="combobox_slct" HorizontalAlignment="Left" Margin="60,10,0,0"
@ -245,11 +260,9 @@
SelectedValue="{Binding Path=cur_monster}" />
<Label x:Name="label_m_warn" Content="Warning: The sum of PowerUps should be at most 10."
HorizontalAlignment="Left" Margin="12,265,0,0" VerticalAlignment="Top" />
<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="338,4,0,0"
<TextBlock x:Name="textblock_gene101" HorizontalAlignment="Left" Margin="338,10,0,0"
TextWrapping="Wrap"
Text="Thank mana_ran@gbatemp.net for gene translations :)&#xD;Do NOT use genes that start with &quot;[D]&quot; They are potentially game-crashing."
Text="Do NOT use genes that start with &quot;[D]&quot; They are potentially game-crashing."
VerticalAlignment="Top" />
<Button x:Name="button_mexp" Content="Max" HorizontalAlignment="Left" Margin="193,119,0,0"
VerticalAlignment="Top" Width="35" Click="button_mexp_Click" />
@ -264,9 +277,13 @@
<ComboBox x:Name="comboBox_gene7" HorizontalAlignment="Left" Margin="338,269,0,0" VerticalAlignment="Top" Width="125" ItemsSource="{Binding gene_name}" SelectedIndex="{Binding Path=cur_monster.gene7_selected}"/>
<ComboBox x:Name="comboBox_gene8" HorizontalAlignment="Left" Margin="480,269,0,0" VerticalAlignment="Top" Width="129" ItemsSource="{Binding gene_name}" SelectedIndex="{Binding Path=cur_monster.gene8_selected}"/>
<ComboBox x:Name="comboBox_gene9" HorizontalAlignment="Left" Margin="625,269,0,0" VerticalAlignment="Top" Width="129" ItemsSource="{Binding gene_name}" SelectedIndex="{Binding Path=cur_monster.gene9_selected}"/>
<Label x:Name="label_mon_skill" Content="Skill (X)" HorizontalAlignment="Left" Margin="184,54,0,0" VerticalAlignment="Top"/>
<TextBox x:Name="textbox_mon_skill" HorizontalAlignment="Left" Height="24" Margin="240,58,0,0"
TextWrapping="Wrap" Text="{Binding cur_monster.skill}" VerticalAlignment="Top"
Width="75" />
</Grid>
</TabItem>
<TabItem Header="Talisman" Margin="0,0,0,0">
<TabItem Header="Talismans" Margin="0,0,0,0">
<Grid Background="#FFE5E5E5">
<DataGrid x:Name="datagrid_tali" HorizontalAlignment="Left" Margin="10,35,0,0"
VerticalAlignment="Top" Height="271" Width="556" CanUserAddRows="False"
@ -292,11 +309,50 @@
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>
<TabItem Header="Weapons/Armors" Margin="0,0,0,0">
<Grid Background="#FFE5E5E5">
<DataGrid x:Name="datagrid_wpn" HorizontalAlignment="Left" Margin="10,35,0,0"
VerticalAlignment="Top" Height="271" Width="272" CanUserAddRows="False"
AutoGenerateColumns="False" ItemsSource="{Binding weapons}">
<DataGrid.Columns>
<DataGridTextColumn CanUserReorder="False" CanUserResize="False" CanUserSort="True"
Width="80" Binding="{Binding clazz}"
Header="Class" />
<DataGridTextColumn CanUserReorder="False" CanUserResize="False" CanUserSort="False"
Width="80" Binding="{Binding id}"
Header="ID" />
<DataGridTextColumn CanUserReorder="False" CanUserResize="False" CanUserSort="False"
Width="*" Binding="{Binding level}"
Header="Level" />
</DataGrid.Columns>
</DataGrid>
<Label x:Name="label_wa_wpn" Content="Weapons" HorizontalAlignment="Left" Margin="10,0,0,0" VerticalAlignment="Top" FontSize="18"/>
<DataGrid x:Name="datagrid_wa_armor" HorizontalAlignment="Left" Margin="355,35,0,0"
VerticalAlignment="Top" Height="271" Width="409" CanUserAddRows="False"
AutoGenerateColumns="False" ItemsSource="{Binding armors}">
<DataGrid.Columns>
<DataGridTextColumn CanUserReorder="False" CanUserResize="False" CanUserSort="True"
Width="60" Binding="{Binding id}"
Header="ID" />
<DataGridTextColumn CanUserReorder="False" CanUserResize="False" CanUserSort="False"
Width="60" Binding="{Binding level}"
Header="Level" />
<DataGridTextColumn CanUserReorder="False" CanUserResize="False" CanUserSort="False"
Width="*" Binding="{Binding unknown_14h}"
Header="Unknown 14h" />
<DataGridTextColumn CanUserReorder="False" CanUserResize="False" CanUserSort="False"
Width="*" Binding="{Binding unknown_18h}"
Header="Unknown 18h" />
<DataGridTextColumn CanUserReorder="False" CanUserResize="False" CanUserSort="False"
Width="*" Binding="{Binding unknown_1ch}"
Header="Unknown 1Ch" />
</DataGrid.Columns>
</DataGrid>
<Label x:Name="label_wa_armor" Content="Armors" HorizontalAlignment="Left" Margin="355,1,0,0" VerticalAlignment="Top" FontSize="18" RenderTransformOrigin="4.647,1.074"/>
</Grid>
</TabItem>
</TabControl>
@ -307,6 +363,7 @@
<DataGrid x:Name="dataGrid" HorizontalAlignment="Left" Height="100" Margin="1046,415,-390,-95.5"
VerticalAlignment="Top" Width="100" />
<Button x:Name="button_about" Content="About" HorizontalAlignment="Left" Margin="716,10,0,0" VerticalAlignment="Top" Width="74" Click="button_about_Click"/>
<Label x:Name="label_notes" Content="Please read the notes on the forum as they contain important information regarding editing." HorizontalAlignment="Left" Margin="217,7,0,0" VerticalAlignment="Top"/>
</Grid>
</Window>

View File

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

View File

@ -9,7 +9,7 @@ using MHSEC_G.Annotations;
namespace MHSEC_G
{
public class Monster : INotifyPropertyChanged
internal class Monster : INotifyPropertyChanged
{
public static readonly List<uint> GENE_ID = new List<uint>();
public static readonly List<string> GENE_NAME = new List<string>();
@ -26,6 +26,7 @@ namespace MHSEC_G
private const uint OFFSETR_MONSTER_HPU = 0xD4;
private const uint OFFSETR_MONSTER_APU = 0xD5;
private const uint OFFSETR_MONSTER_DPU = 0xD6;
private const uint OFFSETR_MONSTER_SKILL = 0x38;
private const uint OFFSETR_MONSTER_LEVEL = 0x5C;
private const uint LIMIT_MONSTER_LEVEL = 99;
private const uint OFFSETR_MONSTER_NAME = 0;
@ -281,6 +282,26 @@ namespace MHSEC_G
}
}
public string skill
{
get { return Model.byte_to_uint16_le(_model.save_file, offset + OFFSETR_MONSTER_SKILL).ToString("X4"); }
set
{
uint parsed;
if (Model.parse_hex_string(value, out parsed))
{
Model.write_uint16_le(_model.save_file, offset + OFFSETR_MONSTER_SKILL, parsed);
}
else
{
MessageBox.Show("Malformed skill value - must be 0x0 to 0xFFFF.", "Error", MessageBoxButton.OK,
MessageBoxImage.Error);
}
OnPropertyChanged(nameof(skill));
}
}
//
// Genes
//
@ -566,7 +587,7 @@ namespace MHSEC_G
List<Monster> ret = new List<Monster>();
for (uint i = OFFSETA_MONSTER; i < OFFSETA_MONSTE_END; i += SIZE_MONSTER)
{
if (save[i] != 0)
if (Model.read_unicode_string(save, i, LIMIT_MONSTER_NAME).Length != 0)
{
byte[] each = new byte[SIZE_MONSTER];
Array.Copy(save, i, each, 0, SIZE_MONSTER);

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.2.1.0")]
[assembly: AssemblyFileVersion("0.2.1.0")]
[assembly: AssemblyVersion("0.2.2.0")]
[assembly: AssemblyFileVersion("0.2.2.0")]

View File

@ -6,7 +6,7 @@ using MHSEC_G.Annotations;
namespace MHSEC_G
{
public class Talisman
internal class Talisman
{
private const uint OFFSETA_TALI = 0x7210;
private const uint OFFSETA_TALI_END = 0x978F;

View File

@ -7,7 +7,7 @@ using MHSEC_G.Annotations;
namespace MHSEC_G
{
public class ViewModel : INotifyPropertyChanged
internal class ViewModel : INotifyPropertyChanged
{
public List<string> gene_name
{
@ -28,6 +28,13 @@ namespace MHSEC_G
get { return _character; }
}
private readonly ObservableCollection<Armor> _armors;
public ObservableCollection<Armor> armors
{
get { return _armors; }
}
private Monster _cur_monster_selection;
private readonly ObservableCollection<Monster> _monsters;
@ -51,6 +58,19 @@ namespace MHSEC_G
get { return _talismans; }
}
private readonly ObservableCollection<Egg> _eggs;
public ObservableCollection<Egg> eggs
{
get { return _eggs; }
}
private readonly ObservableCollection<Weapon> _weapons;
public ObservableCollection<Weapon> weapons
{
get { return _weapons; }
}
private readonly List<Item> _items;
@ -79,6 +99,9 @@ namespace MHSEC_G
_cur_monster_selection = _monsters.ElementAt(0);
_egg_fragments = EggFragment.read_all_egg_fragments(_model);
_talismans = Talisman.read_all_talismans(_model);
_weapons = Weapon.read_all_weapons(_model);
_armors = Armor.read_all_armors(_model);
_eggs = Egg.read_all_eggs(_model);
}
public event PropertyChangedEventHandler PropertyChanged;

115
MHSEC-G/MHSEC-G/Weapon.cs Normal file
View File

@ -0,0 +1,115 @@
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Windows;
using MHSEC_G.Annotations;
namespace MHSEC_G
{
internal class Weapon : INotifyPropertyChanged
{
private const int OFFSETA_WEAPON_START = 0x39D0;
private const int OFFSETA_WEAPON_END = 0x55EF;
// 200 weapons
private const int SIZE_WEAPON = 0x24;
private const int OFFSETR_CLASS = 0x0;
private const int OFFSETR_ID = 0x2;
private const int OFFSETR_LEVEL = 0x4;
private readonly uint _offset;
private readonly Model _model;
public Weapon(Model model, uint offset)
{
_offset = offset;
_model = model;
}
public string clazz
{
set
{
uint parsed;
if (Model.parse_hex_string(value, out parsed) && parsed <= 0xFFFF)
{
Model.write_uint16_le(_model.save_file, _offset + OFFSETR_CLASS, parsed);
}
else
{
MessageBox.Show("Malformed Weapon Class - must be at most 0xFFFF", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
}
OnPropertyChanged(nameof(clazz));
}
get
{
return Model.byte_to_uint16_le(_model.save_file, _offset + OFFSETR_CLASS).ToString("X4");
}
}
public string id
{
set
{
uint parsed;
if (Model.parse_hex_string(value, out parsed) && parsed <= 0xFFFF)
{
Model.write_uint16_le(_model.save_file, _offset + OFFSETR_ID, parsed);
}
else
{
MessageBox.Show("Malformed ID - must be at most 0xFFFF", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
}
OnPropertyChanged(nameof(id));
}
get
{
return Model.byte_to_uint16_le(_model.save_file, _offset + OFFSETR_ID).ToString("X4");
}
}
public string level
{
set
{
uint parsed;
if (Model.parse_hex_string(value, out parsed) && parsed <= 0xFFFF)
{
Model.write_uint16_le(_model.save_file, _offset + OFFSETR_LEVEL, parsed);
}
else
{
MessageBox.Show("Malformed level - must be at most 0xFFFF", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
}
OnPropertyChanged(nameof(level));
}
get
{
return Model.byte_to_uint16_le(_model.save_file, _offset + OFFSETR_LEVEL).ToString("X4");
}
}
public static ObservableCollection<Weapon> read_all_weapons(Model model)
{
ObservableCollection<Weapon> ret = new ObservableCollection<Weapon>();
for (uint i = OFFSETA_WEAPON_START; i < OFFSETA_WEAPON_END; i += SIZE_WEAPON)
{
if (Model.byte_to_uint16_le(model.save_file, i + OFFSETR_CLASS) == 0x7FFF)
{
continue;
}
ret.Add(new Weapon(model, i));
}
return ret;
}
public event PropertyChangedEventHandler PropertyChanged;
[NotifyPropertyChangedInvocator]
protected virtual void OnPropertyChanged(string propertyName)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
}

0
MHSEC-G/OffsetObject.txt Normal file
View File