public virtual void Deserialize(GenericReader reader) { int version = reader.ReadInt(); switch (version) { case 0: case 1: int count = reader.ReadInt(); for (int i = 0; i < count; i++) { PlayerMobile player = reader.ReadMobile() as PlayerMobile; PointsEntry entry = GetSystemEntry(player); if (version > 0) { entry.Deserialize(reader); } else { entry.Points = reader.ReadDouble(); } if (player != null) { if (!PlayerTable.Contains(entry)) { PlayerTable.Add(entry); } } } break; } }
public virtual void Deserialize(GenericReader reader) { Version = reader.ReadInt(); switch (Version) { case 2: // added serialize/deserialize in all base classes. Poor implementation on my part, should have had from the get-go case 1: case 0: int count = reader.ReadInt(); for (int i = 0; i < count; i++) { PlayerMobile player = reader.ReadMobile() as PlayerMobile; PointsEntry entry = GetSystemEntry(player); if (Version > 0) { entry.Deserialize(reader); } else { entry.Points = reader.ReadDouble(); } if (player != null) { if (!PlayerTable.Contains(entry)) { PlayerTable.Add(entry); } } } break; } }
public virtual PointsEntry AddEntry(PlayerMobile pm) { PointsEntry entry = GetSystemEntry(pm); if (!PlayerTable.Contains(entry)) { PlayerTable.Add(entry); OnPlayerAdded(pm); } return(entry); }
public virtual PointsEntry AddEntry(PlayerMobile pm, bool existed = false) { PointsEntry entry = GetSystemEntry(pm); if (!PlayerTable.Contains(entry)) { PlayerTable.Add(entry); if (!existed) { OnPlayerAdded(pm); } } return(entry); }
public virtual void Deserialize(GenericReader reader) { int version = reader.ReadInt(); switch (version) { case 0: case 1: int count = reader.ReadInt(); for (int i = 0; i < count; i++) { PlayerMobile player = reader.ReadMobile() as PlayerMobile; PointsEntry entry = GetSystemEntry(player); if (version > 0) { entry.Deserialize(reader); } else { entry.Points = reader.ReadDouble(); } if (player != null) { PlayerTable.Add(entry); } } break; } //Old player data, not uses the above /*PlayerTable = new Dictionary<PlayerMobile, double>(); * * int count = reader.ReadInt(); * * for (int i = 0; i < count; i++) * { * PlayerMobile pm = reader.ReadMobile() as PlayerMobile; * double points = reader.ReadDouble(); * * if (pm != null) * PlayerTable.Add(pm, points); * }*/ }