public override void Serialize(GenericWriter writer) { base.Serialize(writer); writer.Write((int)2);//version; writer.Write((int)m_CreatureType); writer.Write((int)m_SousTypes.Count); for (int st = 0; st < m_SousTypes.Count; st++) { MobileSousType mst = m_SousTypes[st]; writer.Write((int)mst); } //Charac additionelles writer.Write((int)mRawCha); writer.Write((int)mRawCons); writer.Write((int)mRawSag); //Compétences writer.Write((int)Competences.Lenght); for (int i = 0; i < (int)CompType.Maximum; i++) { if (!(Competences[(CompType)i] is NullCompetence)) { writer.Write((int)i); //Comptype writer.Write((int)Competences[(CompType)i].Achat); } } //#Blessure writer.Write((int)m_blessureList.Count); for (int i = 0; i < m_blessureList.Count; i++) { NubiaBlessure blessure = m_blessureList[i] as NubiaBlessure; writer.Write((DateTime)blessure.TimeEnd); writer.Write((int)blessure.BType); writer.Write((int)blessure.BGravite); writer.Write((bool)blessure.Hemo); writer.Write((int)blessure.CurrentHemo); writer.Write((int)blessure.SoinStatut); writer.Write((int)blessure.Localisation); } writer.Write((int)m_ChakraColor); }
public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); m_CreatureType = (MobileType)reader.ReadInt(); int countSt = reader.ReadInt(); for (int st = 0; st < countSt; st++) { MobileSousType mst = (MobileSousType)reader.ReadInt(); m_SousTypes.Add(mst); } if (version >= 1) { //Charac additionelles mRawCha = reader.ReadInt(); mRawCons = reader.ReadInt(); mRawSag = reader.ReadInt(); //Compétences int lenght = reader.ReadInt(); mCompetences = new CompetenceStack(this); for (int i = 0; i < lenght; i++) { CompType comp = (CompType)reader.ReadInt(); int achats = reader.ReadInt(); if (mCompetences[comp] is NullCompetence) { mCompetences.AddCompetence(comp); } mCompetences[comp].Achat = achats; } } if (version >= 2) { //### Blessures m_blessureList = new ArrayList(); int count2 = reader.ReadInt(); for (int i = 0; i < count2; i++) { DateTime btime = reader.ReadDateTime(); BlessureType btype = (BlessureType)reader.ReadInt(); BlessureGravite bgrav = (BlessureGravite)reader.ReadInt(); bool bhemo = reader.ReadBool(); int bhemoc = reader.ReadInt(); int sta = reader.ReadInt(); BlessureLocalisation bloc = (BlessureLocalisation)reader.ReadInt(); NubiaBlessure blessure = new NubiaBlessure(bhemo, bgrav, btype, bhemoc); blessure.SoinStatut = sta; blessure.setTimeEnd(btime); blessure.setLocalisation(bloc); m_blessureList.Add(blessure); } } m_ChakraColor = reader.ReadInt(); }