Anyone have any luck switching over from Dreamseeker's Imbuing to the imbuing that is integrated in ServUO now? The coding between them is noticeably different and looks like it will require a bit of edits -- just wondering if anyone's done it yet. Also is there anything in Dreamseeker's imbuing that isn't in the ServUO imbuing, or visa versa?

I may answer this question myself eventually but it'd be much easier if someone else who has done it already could go over it with me. I'm in the process of manually merging the commits to ServUO over the past year to my local server (since I never set it up with Git in the first place -- yes shame on me). I intend to get all the updates functioning on my local server so I can set up a proper fork and just do a folder compare between my local folder and the fork and finally commit all my custom changes to the fork so it's setup properly with Git. Then I should rarely have to deal with manually merging after that.
 
I did it, I switched from the one you told to the ServUO version, I cannot say for sure but by a few tests I can definitely say it looked working.

I am not running a public server so tests done are very basic ones.
 
Did you have to do any weird changes to serialization/deserialization or was it a fairly simply overwrite of the old code?
 
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
Code:
        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:
Code:
        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
Code:
        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:
Code:
        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?
 
Last edited:
Omg, I have no much C# skills to give you a professional answer to this, but all I can say is that I have merged the ServUO job and removed all other Imbuing scripts apart from soulforges so I can still place them.

I suppose you cant have it both ways, just you have to figure out which fit better for you and get rid of the other.

Then in your pants I would press y :D
 
So just to get it working I added back in the variables from SF Imbuing (even though they're unused) and made the respective changes to serialize/deserialize. I was able to do the initial load from the saved backup (I had to remove all GargishEarrings from the server because ServUO changed them to BaseArmor) but was actually crashing upon save due to problems in serialization of BaseClothing. Drove me friggin nuts all night because no matter how many times I went over serialization it looked correct!

Well it turns out I was overlooking something very small under deserialize:
Code:
 case 6:
                    {
                        if(version == 6)
                            m_SAAbsorptionAttributes = new SAAbsorptionAttributes(this);
was supposed to be version == 7 since I am one version ahead. I did not think of it because I was only looking at case 7 and newer since I figured nothing before that would've been changed (turns out I didn't have that method in my case 6 before the merge). Doh. Now everything saves & loads fine.

I'm still curious about the question above however: how do you deal with variables that have been serialized and that you subsequently want to remove from the code because they're no longer used?
 
I'm still curious about the question above however: how do you deal with variables that have been serialized and that you subsequently want to remove from the code because they're no longer used?

What you mean?
If is only about deleting item issue since I am not running public server I do not hesitate if needed...
 
Well deleting the items is an option but many people don't have that option. I suppose I COULD do that since I don't run a public server, but I want to know how to code those things properly regardless -- mainly so if I fix something I can do it properly and submit it as a pull request to the ServUO repo. And in the case above even when I tried deleting the items I was still crashing when I did a world save so sometimes when you code serialization/deserialization wrong it has other problems than just "Do you want to delete this item?".

Also for code optimization purposes you don't really want declared variables in the code that you aren't using/don't intend to use. So I'm sure there's got to be some way to be able to remove the old declared variables that aren't being used and make it work with serialization.
 
Back