So here the deal: I must add a new stat (experience points) to the playerMobile. So i got an Experience class that look like this for now:

public class Experience
{
public int pointXP { get; set; }

public Experience()
{
pointXP = 0;
}
}

so a get; set; and something to initialize when it's called. after that i placed it in playerMobile like this

public PlayerMobile(){
blablabla;
blablabla;
blabalala;

Experience m_exp=New Experience(); //around line 3950 of playerMobile

after i call the serialize/deserialize

public override void Deserialize(GenericReader reader)
{

blablablabala;
blablalbablal;

case 1:
{
m_LongTermElapse = reader.ReadTimeSpan();
m_ShortTermElapse = reader.ReadTimeSpan();
m_GameTime = reader.ReadTimeSpan();
m_exp.pointXP = reader.ReadInt(); //supose to read the IO stream for m_exp.PointXP
goto case 0;
}
}

public override void Serialize(GenericWriter writer)
{
blablabla;
blablabla;
blabla;

writer.Write(m_LongTermElapse);
writer.Write(m_ShortTermElapse);
writer.Write(GameTime);
writer.Write(m_exp.pointXP);

}

So here the problem, there must be something wrong in the way I use the writer and the reader because when i shut down the server i have to erase created PlayerMobile because it Say it can't read the IOstream to the end. Ideas on what I did wrong?
 
Adding a new property in Deserialize to an existing switch case will cause any existing playermobiles to be deleted.

you have to create a new switch for the new property
 
ok so it would have to look like this then?:

public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();

switch (version)
{
case 36:
m_exp = new Experience(reader);
...

public override void Serialize(GenericWriter writer)
{
//cleanup our anti-macro table
...
}

CheckKillDecay();
HumilityHunt = false;
CheckAtrophies(this);

base.Serialize(writer);

writer.Write(36); // version

m_exp.Serialize(writer);

because i still have saving problems
 
Back