public GovernmentEntity() : base() { Name = "New Government"; Governments.Add( this ); Resources = new Dictionary<ResourceType, int>(); Resources.Add(ResourceType.Metals, 0); Resources.Add(ResourceType.Food, 0); Resources.Add(ResourceType.Water, 0); Resources.Add(ResourceType.Cloth, 0); Resources.Add(ResourceType.Wood, 0); Resources.Add(ResourceType.Influence, 0); m_MilitarySpawners = new List<MilitarySpawner>(); m_WayPoints = new List<MilitaryWayPoint>(); m_MilitaryPolicies = new MilitaryInfo(this); }
public static void Serialize(GenericWriter writer, MilitaryInfo info) { writer.Write((int)0); //version #region version 0 writer.Write((GovernmentEntity)info.Government); writer.Write((int)info.KillIndividualOnSight.Count); for (int i = 0; i < info.KillIndividualOnSight.Count; i++) writer.Write((string)info.KillIndividualOnSight[i]); writer.Write((int)info.JailIndividualOnSight.Count); for (int i = 0; i < info.JailIndividualOnSight.Count; i++) writer.Write((string)info.JailIndividualOnSight[i]); writer.Write((int)info.KillNationOnSight.Count); for(int i = 0; i < info.KillNationOnSight.Count; i++) writer.Write((int)info.KillNationOnSight[i]); writer.Write((int)info.JailNationOnSight.Count); for(int i = 0; i < info.JailNationOnSight.Count; i++) writer.Write((int)info.JailNationOnSight[i]); writer.Write((int)info.Exceptions.Count); for (int i = 0; i < info.Exceptions.Count; i++) writer.Write((string)info.Exceptions[i]); #endregion }
public static void Deserialize(GenericReader reader, MilitaryInfo info) { int version = reader.ReadInt(); //version switch (version) { case 0: { info.Government = (GovernmentEntity)reader.ReadItem(); int count = reader.ReadInt(); for (int i = 0; i < count; i++) info.KillIndividualOnSight.Add(reader.ReadString()); count = reader.ReadInt(); for (int i = 0; i < count; i++) info.JailIndividualOnSight.Add(reader.ReadString()); count = reader.ReadInt(); for (int i = 0; i < count; i++) info.KillNationOnSight.Add((Nation)reader.ReadInt()); count = reader.ReadInt(); for (int i = 0; i < count; i++) info.JailNationOnSight.Add((Nation)reader.ReadInt()); count = reader.ReadInt(); for (int i = 0; i < count; i++) info.Exceptions.Add(reader.ReadString()); break; } } }
public override void Deserialize(GenericReader reader) { base.Deserialize( reader ); int version = reader.ReadInt(); switch (version) { case 7: { #region Version 7 m_TradeInformation = new TradeInfo(); TradeInfo.Deserialize(reader, m_TradeInformation); #endregion goto case 6; } case 6: { #region Version 6 m_Employees = new List<Mobile>(); int count = reader.ReadInt(); for (int i = 0; i < count; i++) { Mobile e = reader.ReadMobile(); if(!m_Employees.Contains(e)) m_Employees.Add(e); } #endregion goto case 5; } case 5: { #region Version 5 TradeAdvisor = (TradeAdvisor)reader.ReadMobile(); int count = 0; m_MilitarySpawners = new List<MilitarySpawner>(); count = reader.ReadInt(); for (int i = 0; i < count; i++) { object o = reader.ReadItem(); if (o != null) m_MilitarySpawners.Add((MilitarySpawner)o); } m_WayPoints = new List<MilitaryWayPoint>(); count = reader.ReadInt(); for (int i = 0; i < count; i++) { object o = reader.ReadItem(); if (o != null) m_WayPoints.Add((MilitaryWayPoint)o); } m_Nation = (Nation)reader.ReadInt(); m_CityGovernment = reader.ReadBool(); m_Resources = new Dictionary<ResourceType, int>(); count = reader.ReadInt(); for (int i = 0; i < count; i++) { ResourceType r = (ResourceType)reader.ReadInt(); int a = reader.ReadInt(); m_Resources.Add(r, a); } m_Reports = new List<ReportInfo>(); count = reader.ReadInt(); for (int i = 0; i < count; i++) { ReportInfo r = new ReportInfo(null, false, false); ReportInfo.Deserialize(reader, r); m_Reports.Add(r); } m_MilitaryAdvisor = (MilitaryAdvisor)reader.ReadMobile(); m_MilitaryPolicies = new MilitaryInfo(this); MilitaryInfo.Deserialize(reader, m_MilitaryPolicies); Governments.Add(this); #endregion Version 5 break; } } }