I'm altering the PetClaimTicket for FsAts system to allow claiming two pets instead of one.
However, when I add the secondpet to the serializer it gives me an error and forces deleting the ticket on world load.
Honestly can't see what I'm doing wrong even after several days.
If i take out the secondpet parts, it will save and load fine.
I've props it in game after creation and everything is normal.
error readout is pretty typical
However, when I add the secondpet to the serializer it gives me an error and forces deleting the ticket on world load.
Honestly can't see what I'm doing wrong even after several days.
If i take out the secondpet parts, it will save and load fine.
I've props it in game after creation and everything is normal.
Code:
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 2 ); // was originally 1
// edit
writer.Write( m_SecondPet );
// end edit
writer.Write( m_AI );
writer.Write( m_Owner );
writer.Write( m_Pet );
writer.Write( m_Str );
writer.Write( m_Dex );
writer.Write( m_Int );
writer.Write( m_Hits );
writer.Write( m_Stam );
writer.Write( m_Mana );
writer.Write( m_Phys );
writer.Write( m_Fire );
writer.Write( m_Cold );
writer.Write( m_Nrgy );
writer.Write( m_Pois );
writer.Write( m_Dmin );
writer.Write( m_Dmax );
writer.Write( m_Mlev );
writer.Write( m_Gen );
writer.Write( m_Price );
writer.WriteDeltaTime( m_Time );
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize( reader );
int version = reader.ReadInt();
switch ( version )
{
// edit
case 2:
{
m_SecondPet = reader.ReadMobile();
goto case 1;
}
// end edit
case 1:
{
if( m_SecondPet != null )
m_SecondPet = reader.ReadMobile();
m_AI = reader.ReadInt(); // AI Fix
goto case 0;
}
case 0:
{
m_Owner = reader.ReadMobile();
m_Pet = reader.ReadMobile();
m_Str = reader.ReadInt();
m_Dex = reader.ReadInt();
m_Int = reader.ReadInt();
m_Hits = reader.ReadInt();
m_Stam = reader.ReadInt();
m_Mana = reader.ReadInt();
m_Phys = reader.ReadInt();
m_Fire = reader.ReadInt();
m_Cold = reader.ReadInt();
m_Nrgy = reader.ReadInt();
m_Pois = reader.ReadInt();
m_Dmin = reader.ReadInt();
m_Dmax = reader.ReadInt();
m_Mlev = reader.ReadInt();
m_Gen = reader.ReadInt();
m_Price = reader.ReadInt();
m_Time = reader.ReadDeltaTime();
break;
}
}
}
error readout is pretty typical
Error:
System.Exception: Load failed (items=True, mobiles=False, guilds=False, data=Fal
se, type=Server.Items.PetClaimTicket, serial=0x400013E8) ---> System.Exception:
***** Bad serialize on Server.Items.PetClaimTicket *****
at Server.World.Load() in ...\Server\World.cs:line 643
--- End of inner exception stack trace ---
at Server.World.Load() in ...\Server\World.cs:line 844
at Server.Core.Main(String[] args) in ...\Server\Main.cs:line 543
This exception is fatal, press return to exit