fix(codegen): Reverts & Disables codegen (for now) (#625)

After speaking with the C# devs, it is clear that code gen is not ready.
I can get around this by doing the following:
1. Creating a library
2. Splitting out the schema writing from the source generator
3. Moving the schema loading to `AdditionalFiles`
4. Writing a new post-build application using Roslyn to write the schema files after building.
This commit is contained in:
Kamron Batman 2021-05-27 19:50:22 -07:00 • committed by GitHub
parent 6e9108302a
commit f2d44e0283
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
84 changed files with 1053 additions and 487 deletions

View file

@ -1,12 +1,32 @@
namespace Server.Items
{
[Serializable(0, false)]
[Flippable(0x4F7C, 0x4F7D)]
public partial class CupidStatue : Item
public class CupidStatue : Item
{
[Constructible]
public CupidStatue() : base(0x4F7D) => LootType = LootType.Blessed;
public CupidStatue()
: base(0x4F7D) =>
LootType = LootType.Blessed;
public CupidStatue(Serial serial)
: base(serial)
{
}
public override int LabelNumber => 1099220; // cupid statue
public override void Serialize(IGenericWriter writer)
{
base.Serialize(writer);
writer.Write(0);
}
public override void Deserialize(IGenericReader reader)
{
base.Deserialize(reader);
var version = reader.ReadInt();
}
}
}

View file

@ -1,30 +1,49 @@
using System;
using Server.Targeting;
namespace Server.Items
{
[Serializable(0, false)]
public partial class CupidsArrow : Item
public class CupidsArrow : Item
{
[InternString]
[InvalidateProperties]
[SerializableField(0)]
[SerializableFieldAttr("[CommandProperty(AccessLevel.GameMaster)]")]
private string _from;
[InternString]
[InvalidateProperties]
[SerializableField(1)]
[SerializableFieldAttr("[CommandProperty(AccessLevel.GameMaster)]")]
private string _to;
private string m_From;
private string m_To;
[Constructible]
public CupidsArrow() : base(0x4F7F) => LootType = LootType.Blessed;
public CupidsArrow()
: base(0x4F7F) =>
LootType = LootType.Blessed;
public CupidsArrow(Serial serial)
: base(serial)
{
}
// TODO: Check messages
public override int LabelNumber => 1152270; // Cupid's Arrow 2012
public bool IsSigned => _from != null && _to != null;
[CommandProperty(AccessLevel.GameMaster)]
public string From
{
get => m_From;
set
{
m_From = value;
InvalidateProperties();
}
}
[CommandProperty(AccessLevel.GameMaster)]
public string To
{
get => m_To;
set
{
m_To = value;
InvalidateProperties();
}
}
public bool IsSigned => m_From != null && m_To != null;
public override void AddNameProperty(ObjectPropertyList list)
{
@ -32,7 +51,7 @@ namespace Server.Items
if (IsSigned)
{
list.Add(1152273, $"{_from}\t{_to}"); // ~1_val~ is madly in love with ~2_val~
list.Add(1152273, $"{m_From}\t{m_To}"); // ~1_val~ is madly in love with ~2_val~
}
}
@ -53,7 +72,7 @@ namespace Server.Items
if (IsSigned)
{
LabelTo(from, 1152273, $"{_from}\t{_to}"); // ~1_val~ is madly in love with ~2_val~
LabelTo(from, 1152273, $"{m_From}\t{m_To}"); // ~1_val~ is madly in love with ~2_val~
}
}
@ -91,8 +110,8 @@ namespace Server.Items
return;
}
_from = from.Name;
_to = m.Name;
m_From = from.Name;
m_To = m.Name;
InvalidateProperties();
@ -103,5 +122,25 @@ namespace Server.Items
from.SendMessage("That is not a person.");
}
}
public override void Serialize(IGenericWriter writer)
{
base.Serialize(writer);
writer.Write(0);
writer.Write(m_From);
writer.Write(m_To);
}
public override void Deserialize(IGenericReader reader)
{
base.Deserialize(reader);
var version = reader.ReadInt();
m_From = Utility.Intern(reader.ReadString());
m_To = Utility.Intern(reader.ReadString());
}
}
}

View file

@ -1,13 +1,18 @@
namespace Server.Items
{
[Serializable(0, false)]
[Flippable(0x49CA, 0x49CB)]
public partial class HeartShapedBox : BaseContainer
public class HeartShapedBox : BaseContainer
{
private static int m_DropSound;
[Constructible]
public HeartShapedBox() : base(0x49CA)
public HeartShapedBox()
: base(0x49CA)
{
}
public HeartShapedBox(Serial serial)
: base(serial)
{
}
@ -29,5 +34,19 @@ namespace Server.Items
{
m_DropSound = from.Female ? 0x430 : 0x320;
}
public override void Serialize(IGenericWriter writer)
{
base.Serialize(writer);
writer.Write(0); // version
}
public override void Deserialize(IGenericReader reader)
{
base.Deserialize(reader);
var version = reader.ReadInt();
}
}
}