Server Crashing

Helishus

Citizen
Apr 4, 2020
3
0
1
I added in bio engineering and made a couple changes to PlayerMobile but I thought I did the serialization and deserialization correctly. Any help would be great. Here is the error

- Type: Server.Mobiles.PlayerMobile
- Serial: 0x00000102
Delete the object? (y/n)
After pressing return an exception will be thrown and the server will terminate.

Error:
System.Exception: Load failed (items=False, mobiles=True, guilds=False, type=Server.Mobiles.PlayerMobile, serial=0x00000102) ---> System.ArgumentOutOfRangeException: Ticks must be between DateTime.MinValue.Ticks and DateTime.MaxValue.Ticks.
Parameter name: ticks
at System.DateTime..ctor(Int64 ticks)
at Server.BinaryFileReader.ReadDateTime()
at Server.Mobiles.PlayerMobile.Deserialize(GenericReader reader)
at Server.World.Load()
--- End of inner exception stack trace ---
at Server.World.Load()
at Server.Core.Main(String[] args)
 

Attachments

PyrO

Paladin
Jan 27, 2015
1,285
147
63
No its definitly wrong.

First of all you are saving m_Bioenginer befor NextGemOfSalvationUse, but then you load m_Bioenginer even after _BlessedItem

Another issue there is
C#:
  case 34:
                  {  if (version <40 )
                    {
                    m_Bioenginer = reader.ReadBool();
                    }
                    goto case 33;
                    }
if m_Bioenginer was added afterwards it would be either at 40 or 41 depending when you added what
 

Helishus

Citizen
Apr 4, 2020
3
0
1
No its definitly wrong.

First of all you are saving m_Bioenginer befor NextGemOfSalvationUse, but then you load m_Bioenginer even after _BlessedItem

Another issue there is
C#:
  case 34:
                  {  if (version <40 )
                    {
                    m_Bioenginer = reader.ReadBool();
                    }
                    goto case 33;
                    }
if m_Bioenginer was added afterwards it would be either at 40 or 41 depending when you added what
Thank you!I decided to grab the backup of the playermobile file and re add everything. This is the new file and so far it has been working. If anything looks wrong plz let me know.
 

Attachments

PyrO

Paladin
Jan 27, 2015
1,285
147
63
This again is not correct and will cause the same issue, you have to be aware of the order in what you write, it has to be the same order when you read it. Wich is not the case.

your reading:
C#:
                case 31:
                    {
                        DisplayGuildTitle = version > 31 && reader.ReadBool();
                        m_FameKarmaTitle = reader.ReadString();
                        m_PaperdollSkillTitle = reader.ReadString();
                        m_OverheadTitle = reader.ReadString();
                        m_SubtitleSkillTitle = reader.ReadString();

                        m_CurrentChampTitle = reader.ReadString();
                        m_CurrentVeteranTitle = reader.ReadInt();
                        goto case 30;
                    }
                case 30:
                {
                    m_Bioenginer = reader.ReadBool();
                    goto case 29;
                }
your writing:
C#:
            //BioEngineer
            writer.Write( m_Bioenginer );
            
            // Version 31/32 Titles
            writer.Write(DisplayGuildTitle);
            writer.Write(m_FameKarmaTitle);
            writer.Write(m_PaperdollSkillTitle);
            writer.Write(m_OverheadTitle);
            writer.Write(m_SubtitleSkillTitle);
            writer.Write(m_CurrentChampTitle);
            writer.Write(m_CurrentVeteranTitle);
 

Helishus

Citizen
Apr 4, 2020
3
0
1
So should I create a Case 41 and put the bioenginer there? and then put it right at the beginning/top of the write?
 

GoldDraco13

Squire
Aug 1, 2014
329
217
43
48
Canada
mycy4.com
Donate
Donate money to this user
Just to add some more information on why you are experiencing the issue, plus that you have the wrong order, order matters for all the writes and reads, you can code in between them but they must match!

The cases will allow the new value to be added to previously saved players that did not have that value prior to last save, otherwise previously saved players will cause a error as they were never saved with the new value.

Imaging the save file, when you serialize, you are writing to save, all writer values are saved from top down in the method, then when loading (Deserialize) the reader values are read from top to bottom, they must read in the same order as they are saved! Plus you do not want to ever load something that doesn't have the newly added value without doing one of the above, use the cases, or do it manually through a few restarts!