fix(codegen): Adds default codegen option for save flags. Fixes world load issues. (#707)
This commit is contained in:
parent
3fc2b76468
commit
ca5e9342a0
19 changed files with 204 additions and 109 deletions
|
|
@ -23,6 +23,9 @@ namespace Server.Items
|
|||
[SerializableFieldSaveFlag(1)]
|
||||
private bool ShouldSerializeTitle() => _title != DefaultContent?.Title;
|
||||
|
||||
[SerializableFieldDefault(1)]
|
||||
private string TitleDefaultValue() => DefaultContent?.Title;
|
||||
|
||||
[InvalidateProperties]
|
||||
[SerializableField(2)]
|
||||
[SerializableFieldAttr("[CommandProperty(AccessLevel.GameMaster)]")]
|
||||
|
|
@ -31,6 +34,9 @@ namespace Server.Items
|
|||
[SerializableFieldSaveFlag(2)]
|
||||
private bool ShouldSerializeAuthor() => _author != DefaultContent?.Author;
|
||||
|
||||
[SerializableFieldDefault(2)]
|
||||
private string AuthorDefaultValue() => DefaultContent?.Author;
|
||||
|
||||
[SerializableField(3)]
|
||||
[SerializableFieldAttr("[CommandProperty(AccessLevel.GameMaster)]")]
|
||||
private bool _writable;
|
||||
|
|
@ -44,6 +50,9 @@ namespace Server.Items
|
|||
[SerializableFieldSaveFlag(4)]
|
||||
private bool ShouldSerializePages() => DefaultContent?.IsMatch(_pages) != true;
|
||||
|
||||
[SerializableFieldDefault(4)]
|
||||
private BookPageInfo[] PagesDefaultvalue() => DefaultContent?.Copy() ?? Array.Empty<BookPageInfo>();
|
||||
|
||||
[Constructible]
|
||||
public BaseBook(int itemID, int pageCount = 20, bool writable = true) : this(itemID, null, null, pageCount, writable)
|
||||
{
|
||||
|
|
@ -122,18 +131,6 @@ namespace Server.Items
|
|||
SetSecureLevelEntry.AddTo(from, this, list);
|
||||
}
|
||||
|
||||
[AfterDeserialization]
|
||||
private void AfterDeserialization()
|
||||
{
|
||||
var content = DefaultContent;
|
||||
|
||||
if (content != null)
|
||||
{
|
||||
_title ??= content.Title;
|
||||
_author ??= content.Author;
|
||||
}
|
||||
}
|
||||
|
||||
private void Deserialize(IGenericReader reader, int version)
|
||||
{
|
||||
Level = (SecureLevel)reader.ReadInt();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue