コード例 #1
0
ファイル: CityLoyaltySystem.cs プロジェクト: UODOC/MyShard
        public CityLoyaltySystem(City city)
        {
            City = city;

            if (Cities == null)
            {
                Cities = new List <CityLoyaltySystem>();
            }

            Election = new CityElection(this);

            Cities.Add(this);
        }
コード例 #2
0
        public CityLoyaltySystem(City city)
        {
            City = city;

            if (Cities == null)
            {
                Cities = new List <CityLoyaltySystem>();
            }

            Election    = new CityElection(this);
            CitizenWait = new Dictionary <Mobile, DateTime>();

            Cities.Add(this);
        }
コード例 #3
0
ファイル: CityLoyaltySystem.cs プロジェクト: UODOC/MyShard
        public override void Deserialize(GenericReader reader)
        {
            City = (City)reader.ReadInt();

            base.Deserialize(reader);
            int version = reader.ReadInt();

            CompletedTrades    = reader.ReadInt();
            Governor           = reader.ReadMobile();
            GovernorElect      = reader.ReadMobile();
            PendingGovernor    = reader.ReadBool();
            Treasury           = reader.ReadLong();
            ActiveTradeDeal    = (TradeDeal)reader.ReadInt();
            TradeDealStart     = reader.ReadDateTime();
            NextTradeDealCheck = reader.ReadDateTime();
            CanUtilize         = reader.ReadBool();

            Headline = reader.ReadString();
            Body     = reader.ReadString();
            PostedOn = reader.ReadDateTime();

            if (reader.ReadInt() == 0)
            {
                Election = new CityElection(this, reader);
            }
            else
            {
                Election = new CityElection(this);
            }

            if (this.City == City.Britain)
            {
                _CitizenWait = new Dictionary <Mobile, DateTime>();

                int count = reader.ReadInt();
                for (int i = 0; i < count; i++)
                {
                    Mobile   m  = reader.ReadMobile();
                    DateTime dt = reader.ReadDateTime();

                    if (m != null && dt > DateTime.UtcNow)
                    {
                        _CitizenWait[m] = dt;
                    }
                }

                Timer.DelayCall(TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(10), OnTick);
            }
        }
コード例 #4
0
ファイル: Gumps.cs プロジェクト: Tauriella/ServUO-1
        public override void OnResponse(RelayInfo info)
        {
            if (info.ButtonID < 1 || (CityLoyaltySystem.Britain.Election != null && CityLoyaltySystem.Britain.Election.Ongoing))
            {
                return;
            }

            if (info.ButtonID == 2)
            {
                foreach (CityLoyaltySystem sys in CityLoyaltySystem.Cities.Where(s => s.Election != null))
                {
                    sys.Election.GetDefaultStartTimes();
                }

                User.SendMessage("Election start times reset to default.");
                return;
            }

            TextRelay relay1 = info.GetTextEntry(1);
            TextRelay relay2 = info.GetTextEntry(2);
            TextRelay relay3 = info.GetTextEntry(3);
            TextRelay relay4 = info.GetTextEntry(4);

            List <int> times = new List <int>();

            if (relay1 != null)
            {
                int time = Utility.ToInt32(relay1.Text);

                if (time > 0 && time < 13)
                {
                    times.Add(time);
                }
            }

            if (relay2 != null)
            {
                int time = Utility.ToInt32(relay2.Text);

                if (time > 0 && time < 13)
                {
                    times.Add(time);
                }
            }

            if (relay3 != null)
            {
                int time = Utility.ToInt32(relay3.Text);

                if (time > 0 && time < 13)
                {
                    times.Add(time);
                }
            }

            if (relay4 != null)
            {
                int time = Utility.ToInt32(relay4.Text);

                if (time > 0 && time < 13)
                {
                    times.Add(time);
                }
            }

            if (times.Count > 0)
            {
                DateTime[] starttimes = CityElection.ValidateStartTimes(User, times.ToArray());

                if (starttimes != null)
                {
                    foreach (CityLoyaltySystem sys in CityLoyaltySystem.Cities.Where(s => s.Election != null))
                    {
                        sys.Election.StartTimes = starttimes;
                    }

                    User.SendMessage("Election start times reset.");
                }
            }
        }
コード例 #5
0
        public override void Deserialize(GenericReader reader)
        {
            City = (City)reader.ReadInt();

            base.Deserialize(reader);
            int version = reader.ReadInt();

            switch (version)
            {
            case 2:
            case 1:
            {
                int count = reader.ReadInt();
                for (int i = 0; i < count; i++)
                {
                    Mobile   m  = reader.ReadMobile();
                    DateTime dt = reader.ReadDateTime();

                    if (m != null && dt > DateTime.UtcNow)
                    {
                        CitizenWait[m] = dt;
                    }
                }
            }
                goto case 0;

            case 0:
            {
                CompletedTrades    = reader.ReadInt();
                Governor           = reader.ReadMobile();
                GovernorElect      = reader.ReadMobile();
                PendingGovernor    = reader.ReadBool();
                Treasury           = reader.ReadLong();
                ActiveTradeDeal    = (TradeDeal)reader.ReadInt();
                TradeDealStart     = reader.ReadDateTime();
                NextTradeDealCheck = reader.ReadDateTime();
                CanUtilize         = reader.ReadBool();

                Headline = reader.ReadString();
                Body     = reader.ReadString();
                PostedOn = reader.ReadDateTime();

                if (reader.ReadInt() == 0)
                {
                    Election = new CityElection(this, reader);
                }
                else
                {
                    Election = new CityElection(this);
                }
            }
            break;
            }

            if (version == 0 && this.City == City.Britain)
            {
                int count = reader.ReadInt();
                for (int i = 0; i < count; i++)
                {
                    Mobile   m  = reader.ReadMobile();
                    DateTime dt = reader.ReadDateTime();

                    if (m != null && dt > DateTime.UtcNow)
                    {
                        CitizenWait[m] = dt;
                    }
                }
            }

            // City Bulletin Board Location
            if (version == 1)
            {
                Timer.DelayCall(TimeSpan.FromSeconds(10), () =>
                {
                    Board = new CityMessageBoard(City, 0xA0C5);
                    Board.MoveToWorld(Definition.BoardLocation, Map.Trammel);
                    Console.WriteLine("City Message Board for {0} Converted!", City.ToString());

                    /*if (Board != null)
                     * {
                     *  //Board.ItemID = 0xA0C5;
                     *  //board.MoveToWorld(Definition.BoardLocation, Map.Trammel);
                     *
                     *
                     *  Console.WriteLine("City Message Board for {0} Converted!", City.ToString());
                     * }
                     * else
                     * {
                     *  Console.WriteLine("City Message Board for {0} not found!", City.ToString());
                     * }*/
                });
            }
        }
コード例 #6
0
        public override void Deserialize(GenericReader reader)
        {
            City = (City)reader.ReadInt();

            base.Deserialize(reader);
            int version = reader.ReadInt();

            switch (version)
            {
            case 1:
            {
                int count = reader.ReadInt();
                for (int i = 0; i < count; i++)
                {
                    Mobile   m  = reader.ReadMobile();
                    DateTime dt = reader.ReadDateTime();

                    if (m != null && dt > DateTime.UtcNow)
                    {
                        CitizenWait[m] = dt;
                    }
                }
            }
                goto case 0;

            case 0:
            {
                CompletedTrades    = reader.ReadInt();
                Governor           = reader.ReadMobile();
                GovernorElect      = reader.ReadMobile();
                PendingGovernor    = reader.ReadBool();
                Treasury           = reader.ReadLong();
                ActiveTradeDeal    = (TradeDeal)reader.ReadInt();
                TradeDealStart     = reader.ReadDateTime();
                NextTradeDealCheck = reader.ReadDateTime();
                CanUtilize         = reader.ReadBool();

                Headline = reader.ReadString();
                Body     = reader.ReadString();
                PostedOn = reader.ReadDateTime();

                if (reader.ReadInt() == 0)
                {
                    Election = new CityElection(this, reader);
                }
                else
                {
                    Election = new CityElection(this);
                }
            }
            break;
            }

            if (version == 0 && this.City == City.Britain)
            {
                int count = reader.ReadInt();
                for (int i = 0; i < count; i++)
                {
                    Mobile   m  = reader.ReadMobile();
                    DateTime dt = reader.ReadDateTime();

                    if (m != null && dt > DateTime.UtcNow)
                    {
                        CitizenWait[m] = dt;
                    }
                }
            }
        }