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);
            }
        }
Ejemplo n.º 2
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!");
         }
     }
 }
        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
            {
                PlayerMobile        pm    = (PlayerMobile)from;
                CityManagementStone stone = (CityManagementStone)pm.City;


                if (stone == null)
                {
                    from.SendMessage("You must be a citizen of a city to use this!");
                }
                else
                {
                    Region r = stone.PCRegion;

                    if (PlayerGovernmentSystem.CheckIfHouseInCity(from, r))
                    {
                        ;
                    }
                    {
                        if (from.Region is HouseRegion)
                        {
                            BaseHouse house = BaseHouse.FindHouseAt(from);
                            if (house.Owner != from)
                            {
                                from.SendMessage("You may not place vendors in a house you do not own!");
                            }
                            else
                            {
                                Mobile v = new CityPlayerVendor(from, stone);
                                stone.Vendors.Add(v);
                                CityPlayerVendor vend = (CityPlayerVendor)v;
                                vend.TaxRate       = stone.IncomeTax;
                                vend.OriginalStone = stone;
                                v.Direction        = from.Direction & Direction.Mask;
                                v.MoveToWorld(from.Location, from.Map);

                                v.SayTo(from, 503246);                                   // Ah! it feels good to be working again.

                                this.Delete();
                            }
                        }

                        else
                        {
                            bool market = false;
                            if (from.Region is CityMarketRegion)
                            {
                                CityMarketRegion cr = (CityMarketRegion)from.Region;
                                if (cr.Stone == stone)
                                {
                                    market = true;
                                }
                            }

                            if (PlayerGovernmentSystem.IsAtCity(from) || market)
                            {
                                Mobile v = new CityPlayerVendor(from, stone);
                                stone.Vendors.Add(v);
                                CityPlayerVendor vend = (CityPlayerVendor)v;
                                vend.OriginalStone = stone;
                                vend.TaxRate       = stone.IncomeTax;
                                v.Direction        = from.Direction & Direction.Mask;
                                v.MoveToWorld(from.Location, from.Map);

                                v.SayTo(from, 503246);                                   // Ah! it feels good to be working again.

                                this.Delete();
                            }
                            else
                            {
                                from.SendMessage("You may only do this in a city you are a member of!");
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 4
0
 public void UpdateMarketRegion()
 {
     m_Region = new CityMarketRegion(m_Stone, this, this.Map, m_Area, m_Sign);
     m_Region.Register();
 }