-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ver 1.10. Supports both JPN and USA/EUR version.
- Loading branch information
Showing
19 changed files
with
918 additions
and
608 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,102 +1,92 @@ | ||
using System.ComponentModel; | ||
using System; | ||
using System.ComponentModel; | ||
using System.Windows; | ||
using MHSEC_G.Annotations; | ||
|
||
namespace MHSEC_G | ||
{ | ||
public class Character : INotifyPropertyChanged | ||
public class Character : InMemoryObject | ||
{ | ||
private const uint OFFSETA_CHAR_NAME = 0x9DA0; | ||
private const uint LENGTH_CHAR_NAME = 6; | ||
private const uint OFFSETA_CHAR_MONEY = 0x5B404; | ||
private const uint OFFSETA_CHAR_EXP = 0x9E68; | ||
private const uint OFFSETA_CHAR_LEVEL = 0x9E64; | ||
public const uint LIMIT_LEVEL = 99; | ||
public const uint LIMIT_MONEY = 9999999; | ||
public const uint LIMIT_EXP = 25165822; | ||
|
||
private readonly Model _model; | ||
|
||
public uint level | ||
{ | ||
get { return Model.byte_to_uint(_model.save_file[OFFSETA_CHAR_LEVEL]); } | ||
get { return Helper.byte_to_uint(_data[Offsets.OFFSETA_CHAR_LEVEL]); } | ||
set | ||
{ | ||
if (value <= LIMIT_LEVEL) | ||
if (value <= Offsets.LIMIT_LEVEL) | ||
{ | ||
Model.write_byte(_model.save_file, OFFSETA_CHAR_LEVEL, value); | ||
Helper.write_byte(_data, Offsets.OFFSETA_CHAR_LEVEL, value); | ||
} | ||
else | ||
{ | ||
MessageBox.Show("Level must be less than " + LIMIT_LEVEL, "Error", MessageBoxButton.OK, MessageBoxImage.Error); | ||
MessageBox.Show("Level must be less than " + Offsets.LIMIT_LEVEL, "Error", MessageBoxButton.OK, MessageBoxImage.Error); | ||
} | ||
OnPropertyChanged(nameof(level)); | ||
} | ||
} | ||
|
||
public uint exp | ||
{ | ||
get { return Model.byte_to_uint32_le(_model.save_file, OFFSETA_CHAR_EXP); } | ||
get { return Helper.byte_to_uint32_le(_data, Offsets.OFFSETA_CHAR_EXP); } | ||
set | ||
{ | ||
if (value <= LIMIT_EXP) | ||
if (value <= Offsets.LIMIT_EXP) | ||
{ | ||
Model.write_uint32_le(_model.save_file, OFFSETA_CHAR_EXP, value); | ||
Helper.write_uint32_le(_data, Offsets.OFFSETA_CHAR_EXP, value); | ||
} | ||
else | ||
{ | ||
MessageBox.Show("Exp must be less than " + LIMIT_EXP, "Error", MessageBoxButton.OK, MessageBoxImage.Error); | ||
MessageBox.Show("Exp must be less than " + Offsets.LIMIT_EXP, "Error", MessageBoxButton.OK, MessageBoxImage.Error); | ||
} | ||
OnPropertyChanged(nameof(exp)); | ||
} | ||
} | ||
|
||
public uint money | ||
{ | ||
get { return Model.byte_to_uint32_le(_model.save_file, OFFSETA_CHAR_MONEY); } | ||
get { return Helper.byte_to_uint32_le(_data, Offsets.OFFSETA_CHAR_MONEY); } | ||
set | ||
{ | ||
if (value <= LIMIT_MONEY) | ||
if (value <= Offsets.LIMIT_MONEY) | ||
{ | ||
Model.write_uint32_le(_model.save_file, OFFSETA_CHAR_MONEY, value); | ||
Helper.write_uint32_le(_data, Offsets.OFFSETA_CHAR_MONEY, value); | ||
} | ||
else | ||
{ | ||
MessageBox.Show("Money must be less than " + LIMIT_MONEY, "Error", MessageBoxButton.OK, MessageBoxImage.Error); | ||
MessageBox.Show("Money must be less than " + Offsets.LIMIT_MONEY, "Error", MessageBoxButton.OK, MessageBoxImage.Error); | ||
} | ||
OnPropertyChanged(nameof(money)); | ||
} | ||
} | ||
|
||
public string name | ||
{ | ||
get { return Model.read_unicode_string(_model.save_file, OFFSETA_CHAR_NAME, LENGTH_CHAR_NAME); } | ||
get { return Helper.read_unicode_string(_data, Offsets.OFFSETA_CHAR_NAME, Offsets.LENGTH_CHAR_NAME); } | ||
set | ||
{ | ||
if (value.Length <= LENGTH_CHAR_NAME && value.Length > 0) | ||
if (value.Length <= Offsets.LENGTH_CHAR_NAME && value.Length > 0) | ||
{ | ||
Model.write_unicode_string(_model.save_file, OFFSETA_CHAR_NAME, value, LENGTH_CHAR_NAME); | ||
Helper.write_unicode_string(_data, Offsets.OFFSETA_CHAR_NAME, value, Offsets.LENGTH_CHAR_NAME); | ||
} | ||
else | ||
{ | ||
MessageBox.Show("Name must be 1-" + LENGTH_CHAR_NAME + " characters.", "Error", MessageBoxButton.OK, MessageBoxImage.Error); | ||
MessageBox.Show("Name must be 1-" + Offsets.LENGTH_CHAR_NAME + " characters.", "Error", MessageBoxButton.OK, MessageBoxImage.Error); | ||
} | ||
OnPropertyChanged(nameof(name)); | ||
} | ||
} | ||
|
||
|
||
public Character(Model model) | ||
public Character(byte[] model) : base(model, Offsets.OFFSETA_CHAR_NAME, 0) | ||
{ | ||
_model = model; | ||
} | ||
|
||
public event PropertyChangedEventHandler PropertyChanged; | ||
|
||
[NotifyPropertyChangedInvocator] | ||
protected virtual void OnPropertyChanged(string propertyName) | ||
public override byte[] toByteArray() | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
public override void setByteArray(byte[] data) | ||
{ | ||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); | ||
throw new NotImplementedException(); | ||
} | ||
} | ||
} |
Oops, something went wrong.