Alright, so I'm notoriously bad at serialization/deserialization and I need some help. As I said before I had the SF/Dreamseeker imbuing system on my server and now that ServUO has a built-in imbuing system I have attempted to remove the SF imbuing and merge in ServUO imbuing. There are distinct differences though -- SF Imbuing uses bools labeled Fire_Modded, Cold_Modded, etc and ServUO uses integers FireImbuing, ColdImbuing, etc. I'm not sure how to serialize/deserialize this -- I'm obviously doing something wrong because I'm getting an error thrown
World: Loading...An error was encountered while loading a saved object
- Type: Server.Items.Shoes
- Serial: 0x4002BA91
Delete the object? (y/n)
Here's an example of a section of the code before the merge
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write((int)9); // version
// Version 9
#region SF Imbuing
writer.Write((bool)Physical_Modded);
writer.Write((bool)Fire_Modded);
writer.Write((bool)Cold_Modded);
writer.Write((bool)Poison_Modded);
writer.Write((bool)Energy_Modded);
#endregion
// Version 8
writer.Write((int)this.m_TimesImbued);
writer.Write((Mobile)this.m_BlessedBy);
and now here's what I have it as after the merge:
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write((int)10); // version
// Version 9 and 10 -- 9 Was old SF Imbuing properties, version 10 removed them and replaced them with ServUO imbuing properties
#region Runic Reforging and Old SF Imbuing
writer.Write((int)m_ReforgedPrefix);
writer.Write((int)m_ReforgedSuffix);
writer.Write((int)m_ItemPower);
writer.Write(m_BlockRepair);
#endregion
#region Stygian Abyss
writer.Write(m_GorgonLenseCharges);
writer.Write((int)m_GorgonLenseType);
writer.Write(m_PhysImbuing);
writer.Write(m_FireImbuing);
writer.Write(m_ColdImbuing);
writer.Write(m_PoisonImbuing);
writer.Write(m_EnergyImbuing);
// Version 8
writer.Write((int)this.m_TimesImbued);
#endregion
writer.Write((Mobile)this.m_BlessedBy);
and here's deserialize before
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
switch ( version )
{
case 9:
{
#region SF Imbuing
Physical_Modded = reader.ReadBool();
Fire_Modded = reader.ReadBool();
Cold_Modded = reader.ReadBool();
Poison_Modded = reader.ReadBool();
Energy_Modded = reader.ReadBool();
#endregion
goto case 8;
}
deserialize after merge:
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
switch ( version )
{
case 10:
{
#region Runic Reforging and Old SF Imbuing
m_ReforgedPrefix = (ReforgedPrefix)reader.ReadInt();
m_ReforgedSuffix = (ReforgedSuffix)reader.ReadInt();
m_ItemPower = (ItemPower)reader.ReadInt();
m_BlockRepair = reader.ReadBool();
#endregion
#region Stygian Abyss
m_GorgonLenseCharges = reader.ReadInt();
m_GorgonLenseType = (LenseType)reader.ReadInt();
m_PhysImbuing = reader.ReadInt();
m_FireImbuing = reader.ReadInt();
m_ColdImbuing = reader.ReadInt();
m_PoisonImbuing = reader.ReadInt();
m_EnergyImbuing = reader.ReadInt();
goto case 9;
}
case 9:
{
goto case 8;
}
Do I have to keep all of those old bools even though they're not used anymore? How am I supposed to deal with having those variables removed?
EDIT: What I posted came from BaseArmor.cs, but BaseClothing and other base classes have the same issue. I might also note that I haven't successfully booted the server since all these changes -- so I'm guessing that means for now it's a deserialization issue since none of the new vars have been serialized yet?
TL;DR -- How do I deal with variables that have been serialized and then subsequently removed?