예제 #1
0
        public static void Serialize(GenericWriter writer, TradeInfo info)
        {
            writer.Write((int)0); // version

            writer.Write((int)info.BudgetMinimum);
            writer.Write((int)info.MetalSalesPrice);
            writer.Write((int)info.MetalPurchasePrice);
            writer.Write((int)info.MetalMinimum);
            writer.Write((int)info.ClothSalesPrice);
            writer.Write((int)info.ClothPurchasePrice);
            writer.Write((int)info.ClothMinimum);
            writer.Write((int)info.WoodSalesPrice);
            writer.Write((int)info.WoodPurchasePrice);
            writer.Write((int)info.WoodMinimum);
            writer.Write((int)info.VendorPrice);
            writer.Write((int)info.WageEarnerPrice);
            writer.Write((int)info.MaxWageEarners);
            writer.Write((int)info.SlavePrice);
            writer.Write((int)info.MaxSlaves);
            writer.Write((bool)info.SellsSlaves);
            writer.Write((bool)info.SellsWageEarners);
            writer.Write((int)info.VendorWages);
            writer.Write((int)info.Taxes);
            writer.Write((bool)info.FlatTax);

            writer.Write((int)info.NoBusinessList.Count);
            foreach (string name in info.NoBusinessList)
                writer.Write((string)name);

            writer.Write((int)info.NoBusinessNations.Count);
            foreach (Nation n in info.NoBusinessNations)
                writer.Write((int)n);
        }
예제 #2
0
        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;
                    }
            }
        }
예제 #3
0
        public static void Deserialize(GenericReader reader, TradeInfo info)
        {
            int version = reader.ReadInt();

            switch (version)
            {
                case 0:
                    {
                        info.BudgetMinimum = reader.ReadInt();
                        info.MetalSalesPrice = reader.ReadInt();
                        info.MetalPurchasePrice = reader.ReadInt();
                        info.MetalMinimum = reader.ReadInt();
                        info.ClothSalesPrice = reader.ReadInt();
                        info.ClothPurchasePrice = reader.ReadInt();
                        info.ClothMinimum = reader.ReadInt();
                        info.WoodSalesPrice = reader.ReadInt();
                        info.WoodPurchasePrice = reader.ReadInt();
                        info.WoodMinimum = reader.ReadInt();
                        info.VendorPrice = reader.ReadInt();
                        info.WageEarnerPrice = reader.ReadInt();
                        info.MaxWageEarners = reader.ReadInt();
                        info.SlavePrice = reader.ReadInt();
                        info.MaxSlaves = reader.ReadInt();
                        info.SellsSlaves = reader.ReadBool();
                        info.SellsWageEarners = reader.ReadBool();
                        info.VendorWages = reader.ReadInt();
                        info.Taxes = reader.ReadInt();
                        info.FlatTax = reader.ReadBool();

                        int count = 0;
                        info.NoBusinessList = new List<string>();
                        count = reader.ReadInt();
                        for(int i = 0; i < count; i++)
                        {
                            string name = reader.ReadString();
                            info.NoBusinessList.Add(name);
                        }
                        info.NoBusinessNations = new List<Nation>();
                        count = reader.ReadInt();
                        for(int i = 0; i < count; i++)
                        {
                            Nation nat = (Nation)reader.ReadInt();
                            info.NoBusinessNations.Add(nat);
                        }
                        break;
                    }
            }
        }