Ejemplo n.º 1
0
        protected override void OnTarget(Mobile from, object targeted)
        {
            if (m_Government != null && !m_Government.Deleted && m_Government.MilitaryAdvisor != null && !m_Government.MilitaryAdvisor.Deleted)
            {
                from.SendMessage(m_Government.Name.ToString() + " already has a military advisor stationed.");
                return;
            }

            if (CustomGuildStone.IsGuildLeader(from as PlayerMobile, m_Government))
            {
                MilitaryAdvisor newAdvisor = new MilitaryAdvisor(m_Government);

                if (targeted is Item)
                    newAdvisor.MoveToWorld((targeted as Item).Location, (targeted as Item).Map);
                else if (targeted is Mobile)
                    newAdvisor.MoveToWorld((targeted as Mobile).Location, (targeted as Mobile).Map);
                else if (targeted is LandTarget)
                    newAdvisor.MoveToWorld((targeted as LandTarget).Location, from.Map);
                else
                    newAdvisor.MoveToWorld(from.Location, from.Map);

                m_Government.MilitaryAdvisor = newAdvisor;
                newAdvisor.Home = newAdvisor.Location;
                newAdvisor.RangeHome = 0;
            }

            base.OnTarget(from, targeted);
        }
Ejemplo 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;
                    }
            }
        }