コード例 #1
0
        private static void MoveVendor_OnCommand(CommandEventArgs e)
        {
            Mobile       from = e.Mobile;
            PlayerMobile pm   = (PlayerMobile)from;

            Region r = from.Region;

            if (pm.City != null && pm.City.Mayor == pm)
            {
                CityManagementStone stone = pm.City;
                if (stone.PCRegion == r || (r is CityMarketRegion && ((CityMarketRegion)r).Stone == stone))
                {
                    from.SendMessage("Select the item you wish to move.");
                    from.Target = new VendorMoveTarget();
                }
                else
                {
                    from.SendMessage("You may only do this if you are the mayor of this town!");
                }
            }
            else
            {
                from.SendMessage("You may only do this if you are the mayor of a city");
            }
        }
コード例 #2
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
            int version = reader.ReadInt();

            m_stone = (CityManagementStone)reader.ReadItem();
        }
コード例 #3
0
 public override void OnDoubleClick(Mobile from)
 {
     if (!IsChildOf(from.Backpack))
     {
         from.SendLocalizedMessage(1042001);                   // That must be in your pack for you to use it.
     }
     else
     {
         Region r = Region.Find(from.Location, from.Map);
         if (r is CityMarketRegion)
         {
             CityMarketRegion cityreg = (CityMarketRegion)r;
             if (cityreg.Sign == this.Sign)
             {
                 VendorRentalDuration m_Expire;
                 m_Expire = VendorRentalDuration.Instances[(int)this.Duration];
                 CityRentedVendor vendor = new CityRentedVendor(m_Lord, this.Owner, m_Expire, this.Rent, true, this.Rent, this.Sign.Stone);
                 vendor.MoveToWorld(from.Location, from.Map);
                 CityManagementStone stone = this.Sign.Stone;
                 vendor.TaxRate = stone.IncomeTax;
                 stone.Vendors.Add(vendor);
                 this.Delete();
             }
             else
             {
                 from.SendMessage("You may only do this in a city market that you purchased a spot in!");
             }
         }
         else
         {
             from.SendMessage("You may only use this at a Town Market!");
         }
     }
 }
コード例 #4
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 1:
            {
                m_LandlordRemove = reader.ReadMobile();
                goto case 0;
            }


            case 0:
            {
                m_toDelete = reader.ReadItemList();
                m_Stone    = (CityManagementStone)reader.ReadItem();
                m_Type     = (CivicSignType)reader.ReadInt();

                break;
            }
            }
        }
コード例 #5
0
        public static bool IsLegitmateVendor(Mobile from, Mobile m)
        {
            PlayerMobile pm = (PlayerMobile)from;


            if ((m is CityRentedVendor || m is CityPlayerVendor) && pm.City != null)
            {
                CityManagementStone stone = pm.City;
                Region r   = m.Region;
                Region reg = from.Region;

                if (r is CityMarketRegion)
                {
                    CityMarketRegion region = (CityMarketRegion)r;
                    if (region.Stone == stone)
                    {
                        return(true);
                    }
                }
                else if (reg is CityMarketRegion)
                {
                    CityMarketRegion region = (CityMarketRegion)reg;
                    if (region.Stone == stone && ((CityPlayerVendor)m).IsVendorInTown())
                    {
                        return(true);
                    }
                }

                return(false);
            }
            else
            {
                return(false);
            }
        }
コード例 #6
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadEncodedInt();

            m_Stone    = (CityManagementStone)reader.ReadItem();
            m_Landlord = reader.ReadMobile();
            int durationID = reader.ReadEncodedInt();

            if (durationID < VendorRentalDuration.Instances.Length)
            {
                m_RentalDuration = VendorRentalDuration.Instances[durationID];
            }
            else
            {
                m_RentalDuration = VendorRentalDuration.Instances[0];
            }

            m_RentalPrice   = reader.ReadInt();
            m_LandlordRenew = reader.ReadBool();
            m_RenterRenew   = reader.ReadBool();
            m_RenewalPrice  = reader.ReadInt();

            m_RentalGold = reader.ReadInt();

            m_RentalExpireTime = reader.ReadDeltaTime();

            TimeSpan delay = m_RentalExpireTime - DateTime.Now;

            m_RentalExpireTimer = new RentalExpireTimer(this, delay > TimeSpan.Zero ? delay : TimeSpan.Zero, m_Stone);
            m_RentalExpireTimer.Start();
        }
コード例 #7
0
        public CityCitizenGump(CityManagementStone stone, Mobile from) : base(50, 50)
        {
            m_Stone = stone;

            Closable   = true;
            Disposable = true;
            Dragable   = true;
            Resizable  = false;
            AddPage(0);
            AddBackground(25, 26, 409, 363, 5120);
            AddImageTiled(29, 57, 404, 9, 5121);
            AddHtml(33, 32, 394, 21, @"<BASEFONT COLOR=WHITE><CENTER>City Option Menu</CENTER></BASEFONT>", (bool)false, (bool)false);
            AddButton(35, 70, 4005, 4006, 1, GumpButtonType.Reply, 0);
            AddButton(35, 100, 4005, 4006, 2, GumpButtonType.Reply, 0);
            AddButton(35, 130, 4005, 4006, 3, GumpButtonType.Reply, 0);
            AddButton(35, 160, 4005, 4006, 4, GumpButtonType.Reply, 0);
            AddButton(35, 190, 4005, 4006, 5, GumpButtonType.Reply, 0);
            AddLabel(70, 70, 1149, @"Resign From City");
            AddLabel(70, 100, 1149, @"Depoist To Treasury");
            AddLabel(70, 130, 1149, @"View Waring Cities");
            AddLabel(70, 160, 1149, @"View Allied Cities");
            AddLabel(70, 190, 1149, @"View Citizen List");
            AddLabel(35, 220, 1149, @"Total Citizens: " + stone.Citizens.Count.ToString());
            AddLabel(35, 240, 1149, @"Treasury Balance: " + stone.CityTreasury.ToString());
            AddLabel(35, 260, 1149, @"City Level: " + stone.Level.ToString());
            AddLabel(35, 280, 1149, @"Total Waring Cities: " + stone.Waring.Count.ToString());
            AddLabel(35, 300, 1149, @"Total Allied Cities: " + stone.Allegiances.Count.ToString());
            AddLabel(35, 320, 1149, @"Current Income Tax: " + stone.IncomeTax.ToString());
            AddLabel(35, 340, 1149, @"Current Property Tax: " + stone.HousingTax.ToString());
            AddLabel(35, 360, 1149, @"Current Travel Tax: " + stone.TravelTax.ToString());
            AddButton(250, 70, 4005, 4006, 6, GumpButtonType.Reply, 0);
            AddLabel(285, 70, 1149, @"Sponsor A Citizen");
        }
コード例 #8
0
        public SponsorGump(CityManagementStone stone, Mobile from) : base(50, 50)
        {
            m_Stone = stone;
            m_From  = from;

            Closable   = true;
            Disposable = true;
            Dragable   = true;
            Resizable  = false;
            AddPage(0);
            AddBackground(59, 80, 353, 363, 5120);
            AddImageTiled(63, 104, 348, 9, 5121);
            AddLabel(66, 82, 1149, @"You are being offered to join this city.");
            AddLabel(70, 110, 1149, @"City Name: " + stone.CityName.ToString());
            AddLabel(70, 130, 1149, @"Mayor: " + stone.Mayor.Name.ToString());
            AddLabel(70, 150, 1149, @"Current Income Tax: " + stone.IncomeTax.ToString());
            AddLabel(70, 170, 1149, @"Current Property Tax: " + stone.HousingTax.ToString());
            AddLabel(70, 190, 1149, @"Current Travel Tax: " + stone.TravelTax.ToString());
            AddHtml(70, 241, 333, 131, stone.CityRules, (bool)true, (bool)true);
            AddLabel(70, 220, 1149, @"City Rules");
            AddImageTiled(62, 401, 348, 9, 5121);
            AddLabel(70, 375, 1149, @"City URL: " + stone.CityWebURL.ToString());
            AddButton(70, 409, 4008, 4009, 1, GumpButtonType.Reply, 0);
            AddLabel(104, 409, 1149, @"I accept and wish to join.");
            AddButton(270, 409, 4017, 4018, 2, GumpButtonType.Reply, 0);
            AddLabel(305, 409, 1149, @"I Decline");
        }
コード例 #9
0
        public static bool CheckCityAlly(Mobile from, Mobile target)
        {
            if (from is PlayerMobile && target is PlayerMobile)
            {
                PlayerMobile        pm1      = (PlayerMobile)from;
                PlayerMobile        pm2      = (PlayerMobile)target;
                CityManagementStone fromCity = pm1.City;
                CityManagementStone targCity = pm2.City;

                if (fromCity != null)
                {
                    if (fromCity.Citizens.Contains(target))
                    {
                        return(true);
                    }

                    if (fromCity.Allegiances.Contains(targCity))
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
コード例 #10
0
        public ViewInvitedWarsGump(CityManagementStone stone, int listPage, ArrayList list, ArrayList count) : base(50, 50)
        {
            m_Stone     = stone;
            m_List      = list;
            m_ListPage  = listPage;
            m_CountList = count;

            Closable   = true;
            Disposable = true;
            Dragable   = true;
            Resizable  = false;
            AddPage(0);
            AddBackground(18, 15, 336, 243, 5120);
            AddImageTiled(25, 20, 323, 196, 2702);
            AddImageTiled(30, 24, 314, 187, 2604);
            AddAlphaRegion(25, 20, 323, 195);

            if (m_List == null)
            {
                ArrayList cities = m_Stone.WarsInvited;
                ArrayList a      = new ArrayList();

                foreach (Item i in cities)
                {
                    a.Add(i);
                }

                m_List = a;
            }

            if (listPage > 0)
            {
                AddButton(30, 223, 4014, 4015, 1, GumpButtonType.Reply, 0);
                AddLabel(66, 223, 1149, @"Last Page");
            }

            if ((listPage + 1) * 7 < m_List.Count)
            {
                AddButton(145, 223, 4005, 4006, 2, GumpButtonType.Reply, 0);
                AddLabel(182, 224, 1149, @"Next Page");
            }

            int k = 0;

            for (int i = 0, j = 0, index = ((listPage * 7) + k); i < 7 && index >= 0 && index < m_List.Count && j >= 0; ++i, ++j, ++index)
            {
                Item item = m_List[index] as Item;

                if (item is CityManagementStone)
                {
                    CityManagementStone citystone = (CityManagementStone)item;

                    int offset = 30 + (i * 25);

                    AddButton(35, offset, 4017, 4018, 100 + index, GumpButtonType.Reply, 0);
                    AddButton(70, offset, 4029, 4030, 1000 + index, GumpButtonType.Reply, 0);
                    AddLabel(105, offset, 1149, citystone.CityName.ToString());
                }
            }
        }
コード例 #11
0
        public static bool CheckBanLootable(Mobile from, Mobile target)
        {
            if (from is PlayerMobile && target is PlayerMobile)
            {
                if (from.Region is PlayerCityRegion)
                {
                    PlayerMobile        pm    = (PlayerMobile)from;
                    CityManagementStone stone = pm.City;

                    if (stone != null)
                    {
                        bool isBanned = false;

                        foreach (Mobile checkBan in stone.Banned)
                        {
                            if (target == checkBan)
                            {
                                isBanned = true;
                            }
                        }

                        if (isBanned == true)
                        {
                            return(true);
                        }
                    }
                }
            }

            return(false);
        }
コード例 #12
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 0:
            {
                m_Time   = reader.ReadDeltaTime();
                m_Mob1   = reader.ReadMobile();
                m_Mob2   = reader.ReadMobile();
                m_Votes1 = reader.ReadInt();
                m_Votes2 = reader.ReadInt();
                m_Voters = reader.ReadMobileList();
                m_Stone  = (CityManagementStone)reader.ReadItem();

                m_Timer = new CityElectionTimer(m_Time, this);
                m_Timer.Start();

                break;
            }
            }
        }
コード例 #13
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            Mobile from = state.Mobile;

            if (from == null)
            {
                return;
            }

            if (info.ButtonID == 1)               // Previous page
            {
                if (m_ListPage > 0)
                {
                    from.SendGump(new AdminAddGump(m_ListPage - 1, m_mobile, m_List, m_CountList));
                }
            }

            if (info.ButtonID == 2)               // Next page
            {
                if ((m_ListPage + 1) * 7 < m_List.Count)
                {
                    from.SendGump(new AdminAddGump(m_ListPage + 1, m_mobile, m_List, m_CountList));
                }
            }

            if (info.ButtonID >= 100)               // Goto City
            {
                CityManagementStone city = m_List[info.ButtonID - 100] as CityManagementStone;
                city.AdminDoJoin(from, m_mobile);
            }
        }
コード例 #14
0
            public RentalExpireTimer(CityRentedVendor vendor, TimeSpan delay, CityManagementStone stone) : base(delay, vendor.RentalDuration.Duration)
            {
                m_Vendor = vendor;
                m_Stone  = stone;

                Priority = TimerPriority.OneMinute;
            }
コード例 #15
0
        public ChangeCitizenTitleGump(CityManagementStone stone, int listPage, ArrayList list, ArrayList count) : base(50, 50)
        {
            m_Stone     = stone;
            m_List      = list;
            m_ListPage  = listPage;
            m_CountList = count;

            Closable   = true;
            Disposable = true;
            Dragable   = true;
            Resizable  = false;
            AddPage(0);
            AddBackground(18, 15, 336, 243, 5120);
            AddImageTiled(25, 20, 323, 196, 2702);
            AddImageTiled(30, 24, 314, 187, 2604);
            AddAlphaRegion(25, 20, 323, 195);

            if (m_List == null)
            {
                ArrayList mobs = m_Stone.Citizens;
                ArrayList a    = new ArrayList();

                foreach (Mobile i in mobs)
                {
                    a.Add(i);
                }

                m_List = a;
            }

            if (listPage > 0)
            {
                AddButton(30, 223, 4014, 4015, 1, GumpButtonType.Reply, 0);
                AddLabel(66, 223, 1149, @"Last Page");
            }

            if ((listPage + 1) * 7 < m_List.Count)
            {
                AddButton(145, 223, 4005, 4006, 2, GumpButtonType.Reply, 0);
                AddLabel(182, 224, 1149, @"Next Page");
            }

            int k = 0;

            for (int i = 0, j = 0, index = ((listPage * 7) + k); i < 7 && index >= 0 && index < m_List.Count && j >= 0; ++i, ++j, ++index)
            {
                Mobile m = m_List[index] as Mobile;

                Mobile sponsored = (Mobile)m;

                int offset = 30 + (i * 25);

                AddButton(35, offset, 4017, 4018, 100 + index, GumpButtonType.Reply, 0);
                AddLabel(70, offset, 1149, m.Name.ToString());
            }
        }
コード例 #16
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            Mobile from = state.Mobile;

            if (from == null)
            {
                return;
            }

            if (info.ButtonID == 0)               // Close
            {
                from.SendGump(new CityManagementGump(m_Stone, from));
            }

            if (info.ButtonID == 1)               // Previous page
            {
                if (m_ListPage > 0)
                {
                    from.SendGump(new DeclarePeaceGump(m_Stone, m_ListPage - 1, m_List, m_CountList));
                }
            }

            if (info.ButtonID == 2)               // Next page
            {
                if ((m_ListPage + 1) * 7 < m_List.Count)
                {
                    from.SendGump(new DeclarePeaceGump(m_Stone, m_ListPage + 1, m_List, m_CountList));
                }
            }

            if (info.ButtonID >= 100)               // Declare War
            {
                CityManagementStone stone = m_List[info.ButtonID - 100] as CityManagementStone;

                if (m_Stone.Waring.Contains(stone))
                {
                    m_Stone.Waring.Remove(stone);

                    foreach (Mobile m in m_Stone.Citizens)
                    {
                        m.SendMessage("CITY MESSAGE: We are now at peace with {0}.", stone.CityName);
                    }
                }

                if (stone.Waring.Contains(m_Stone))
                {
                    stone.Waring.Remove(m_Stone);

                    foreach (Mobile m in stone.Citizens)
                    {
                        m.SendMessage("CITY MESSAGE: We are now at peace with {0}.", m_Stone.CityName);
                    }
                }
            }
        }
コード例 #17
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            Mobile from = state.Mobile;

            if (from == null)
            {
                return;
            }

            if (info.ButtonID == 0)               // Close
            {
                from.SendGump(new CityManagementGump(m_Stone, from));
            }

            if (info.ButtonID == 1)               // Previous page
            {
                if (m_ListPage > 0)
                {
                    from.SendGump(new ViewDeclaredAllegiancesGump(m_Stone, m_ListPage - 1, m_List, m_CountList));
                }
            }

            if (info.ButtonID == 2)               // Next page
            {
                if ((m_ListPage + 1) * 7 < m_List.Count)
                {
                    from.SendGump(new ViewDeclaredAllegiancesGump(m_Stone, m_ListPage + 1, m_List, m_CountList));
                }
            }

            if (info.ButtonID >= 100)               // Declare Allegiances
            {
                CityManagementStone stone = m_List[info.ButtonID - 100] as CityManagementStone;

                if (m_Stone.AllegiancesDeclared.Contains(stone))
                {
                    m_Stone.AllegiancesDeclared.Remove(stone);

                    foreach (Mobile m in m_Stone.Citizens)
                    {
                        m.SendMessage("CITY MESSAGE: We have resended our allegiance invite from {0}.", stone.CityName);
                    }
                }

                if (stone.AllegiancesInvited.Contains(m_Stone))
                {
                    stone.AllegiancesInvited.Remove(m_Stone);

                    foreach (Mobile m in stone.Citizens)
                    {
                        m.SendMessage("CITY MESSAGE: {0} has resended thier allegiance invite from us.", m_Stone.CityName);
                    }
                }
            }
        }
コード例 #18
0
        public bool IsCitizen(Mobile from, CityManagementStone stone)
        {
            bool citizen = false;

            if (from == stone.Mayor || stone.Citizens.Contains(from))
            {
                citizen = true;
            }

            return(citizen);
        }
コード例 #19
0
        public override void OnDestroyed()
        {
            //get the object that it is attached to
            Item             building = AttachedTo as Item;                              //<---Building
            Point3D          p        = new Point3D(building.X, building.Y, building.Z); //<---location
            Region           r        = Region.Find(p, building.Map);                    //<---region
            PlayerCityRegion cityreg  = r as PlayerCityRegion;                           //<---region

            if (r.IsPartOf(typeof(PlayerCityRegion)))                                    //<---building is in city region
            {
                ArrayList deletelist = new ArrayList();
                foreach (Item i in World.Items.Values)
                {
                    if (i is CivicSign)
                    {
                        CivicSign z = (CivicSign)i;                              //<--- line 44 from error
                        if (z.toDelete != null && z.toDelete.Contains(building)) //<---look for the Building/Addon in the arraylist
                        {
                            deletelist.Add(z);
                        }
                    }
                }

                foreach (Item d in deletelist)
                {
                    d.Delete();
                }

                //}
                ArrayList deletelist1 = new ArrayList();
                foreach (Item t in World.Items.Values)
                {
                    if (t is CityManagementStone)
                    {
                        CityManagementStone y = (CityManagementStone)t;
                        if (y.toDelete != null && y.toDelete.Contains(building))
                        {
                            deletelist1.Add(y);
                        }
                    }
                    foreach (Item c in deletelist1)
                    {
                        c.Delete();
                        return;
                    }
                }
            }
            // add code to find all of the items associated with the building and delete them
            // and to remove the building from the city system

            // the base method will destroy the target building itself
            base.OnDestroyed();  //EDITED THIS OUT AS THERE WONT BE ANY ID TO CHANGE ANYMORE
        }
コード例 #20
0
            protected override void OnTarget(Mobile from, object target)
            {
                IPoint3D            pi  = target as IPoint3D;
                Map                 map = from.Map;
                Region              reg;
                Point3D             p;
                PlayerMobile        pm    = (PlayerMobile)from;
                CityManagementStone stone = pm.City;

                ArrayList decore = stone.isLockedDown;
                ArrayList delete = stone.toDelete;

                if (stone.CurrentDecore == stone.MaxDecore)
                {
                    from.SendMessage("You cannot secure anymore items in this city.");
                    return;
                }

                if (decore == null)
                {
                    stone.isLockedDown = new ArrayList();
                    decore             = stone.isLockedDown;
                }


                if (pi == null || map == null || m_deed.Deleted)
                {
                    return;
                }


                Server.Spells.SpellHelper.GetSurfaceTop(ref pi);
                p = new Point3D(pi.X, pi.Y, pi.Z);

                reg = Region.Find(p, map);

                if (from.Region is PlayerCityRegion && reg == from.Region && PlayerGovernmentSystem.IsAtCity(from))
                {
                    CityResourceBox box = new CityResourceBox();
                    box.Stone = stone;
                    box.MoveToWorld(new Point3D(p), map);
                    box.Movable = false;
                    decore.Add(box);
                    delete.Add(box);
                    stone.CurrentDecore += 1;
                    m_deed.Delete();
                }
                else
                {
                    from.SendMessage("You must be in your city to do this.");
                }
            }
コード例 #21
0
        public ConfirmLeaveCityGump(CityManagementStone stone, Mobile from) : base(50, 50)
        {
            m_Stone = stone;

            Closable   = true;
            Disposable = true;
            Dragable   = true;
            Resizable  = false;
            AddPage(0);
            AddBackground(32, 27, 267, 65, 5120);
            AddLabel(42, 30, 1149, @"Are you sure you want to leave the city?");
            AddButton(175, 55, 247, 248, 2, GumpButtonType.Reply, 0);
            AddButton(85, 55, 242, 243, 1, GumpButtonType.Reply, 0);
        }
コード例 #22
0
        public CityRentedVendor(Mobile landlord, Mobile owner, VendorRentalDuration duration, int rentalPrice, bool landlordRenew, int rentalGold, CityManagementStone stone) : base(owner, stone)
        {
            m_RentalDuration = duration;
            m_RentalPrice    = m_RenewalPrice = rentalPrice;
            m_LandlordRenew  = landlordRenew;
            m_RenterRenew    = false;
            m_Stone          = stone;
            m_Landlord       = landlord;


            m_RentalGold = rentalGold;

            m_RentalExpireTime  = DateTime.Now + duration.Duration;
            m_RentalExpireTimer = new RentalExpireTimer(this, duration.Duration, m_Stone);
            m_RentalExpireTimer.Start();
        }
コード例 #23
0
        public static bool CheckIfMayor(Mobile from)
        {
            foreach (Item item in World.Items.Values)
            {
                if (item is CityManagementStone)
                {
                    CityManagementStone stone = (CityManagementStone)item;
                    if (stone.Mayor == from)
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
コード例 #24
0
        public CityLandLord(CityManagementStone stone, Rectangle3D[] area, CivicSign sign, Point3D p, Map map) : base("Marketkeeper")
        {
            Frozen = true;
            Point3D loc = new Point3D(p.X - 4, p.Y, p.Z);

            Location     = loc;
            Direction    = Direction.South;
            Map          = map;
            m_Stone      = stone;
            m_Area       = area;
            m_Sign       = sign;
            m_vendorlist = new List <Mobile>();

            UpdateMarketRegion();
            CreateRandomVendors(loc, map);
        }
コード例 #25
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            m_Die       = reader.ReadDeltaTime();
            m_stone     = (CityManagementStone)reader.ReadItem();
            m_IncomeTax = reader.ReadInt();
            m_TaxRate   = reader.ReadInt();

            if (m_stone == null)
            {
                Timer t = new CityVendorDismiss(this, m_Die);
                t.Start();
            }
        }
コード例 #26
0
        public static bool CheckCityName(string text)
        {
            foreach (Item item in World.Items.Values)
            {
                if (item is CityManagementStone)
                {
                    CityManagementStone stone = (CityManagementStone)item;

                    if (stone.CityName == text)
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
コード例 #27
0
        public static bool IsAtCity(Mobile from)
        {
            PlayerMobile        pm   = (PlayerMobile)from;
            CityManagementStone city = pm.City;
            Region cityreg           = Region.Find(from.Location, from.Map);

            if (cityreg != null && city != null)
            {
                if (cityreg == city.PCRegion)
                {
                    return(true);
                }
            }


            return(false);
        }
コード例 #28
0
        public static bool IsMemberOf(Mobile from, CityManagementStone stone)
        {
            PlayerMobile pm = (PlayerMobile)from;

            if (pm.City == null)
            {
                return(false);
            }

            foreach (Mobile mob in stone.Citizens)
            {
                if (mob == from)
                {
                    return(true);
                }
            }
            return(false);
        }
コード例 #29
0
        public override void OnDelete()
        {
            BaseHouse        house   = BaseHouse.FindHouseAt((PelopsItem)this);
            Point3D          p       = new Point3D(this.X, this.Y, this.Z);
            Region           r       = Region.Find(p, this.Map);
            PlayerCityRegion cityreg = r as PlayerCityRegion;

            if (r.IsPartOf(typeof(HouseRegion)))
            {
                Point3D     v        = new Point3D(this.X, this.Y, this.Z);
                Region      u        = Region.Find(v, this.Map);
                HouseRegion housereg = u as HouseRegion;
                //house.SetLockdown( this, true );
            }
            else if (r.IsPartOf(typeof(PlayerCityRegion)))
            {
                foreach (Item i in World.Items.Values)
                {
                    if (i is CityManagementStone)
                    {
                        CityManagementStone s     = (CityManagementStone)i;
                        Point3D             q     = new Point3D(s.X, s.Y, s.Z);
                        Region           t        = Region.Find(q, s.Map);
                        PlayerCityRegion stonereg = t as PlayerCityRegion;
                        if (cityreg == stonereg)
                        {
                            ArrayList decore = s.isLockedDown;
                            if (decore == null)
                            {
                                s.isLockedDown = new ArrayList();
                                decore         = s.isLockedDown;
                            }
                            decore.Remove(this);
                            s.CurrentDecore -= 1;
                        }
                    }
                }
            }
            else
            {
                return;
            }
            base.OnDelete();
        }
コード例 #30
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
            int version = reader.ReadInt();

            m_vendorlist = reader.ReadStrongMobileList();
            m_Sign       = (CivicSign)reader.ReadItem();
            m_Stone      = (CityManagementStone)reader.ReadItem();
            m_Area       = Server.Items.CityManagementStone.ReadRect3DArray(reader);

            Frozen = true;

            foreach (Mobile m in m_vendorlist)
            {
                m.Frozen = true;
            }

            UpdateMarketRegion();
        }