Пример #1
0
        public bool RegisterVendor(BaseFactionVendor vendor)
        {
            if (vendor == null)
            {
                return(false);
            }

            VendorList vendorList = FindVendorList(vendor.GetType());

            if (vendorList == null)
            {
                return(false);
            }

            vendorList.Vendors.Add(vendor);
            return(true);
        }
Пример #2
0
        public void EndOrderFiring(Mobile from, object obj)
        {
            bool   isFinance = IsFinance(from);
            bool   isSheriff = IsSheriff(from);
            string type      = null;

            if (isFinance && isSheriff)               // GM only
            {
                type = "vendor or guard";
            }
            else if (isFinance)
            {
                type = "vendor";
            }
            else if (isSheriff)
            {
                type = "guard";
            }

            if (obj is BaseFactionVendor)
            {
                BaseFactionVendor vendor = (BaseFactionVendor)obj;

                if (vendor.Town == this && isFinance)
                {
                    vendor.Delete();
                }
            }
            else if (obj is BaseFactionGuard)
            {
                BaseFactionGuard guard = (BaseFactionGuard)obj;

                if (guard.Town == this && isSheriff)
                {
                    guard.Delete();
                }
            }
            else
            {
                from.SendMessage("That is not a {0}!", type);
            }
        }
Пример #3
0
        public bool UnregisterVendor(BaseFactionVendor vendor)
        {
            if (vendor == null)
            {
                return(false);
            }

            VendorList vendorList = FindVendorList(vendor.GetType());

            if (vendorList == null)
            {
                return(false);
            }

            if (!vendorList.Vendors.Contains(vendor))
            {
                return(false);
            }

            vendorList.Vendors.Remove(vendor);
            return(true);
        }
Пример #4
0
		public bool UnregisterVendor( BaseFactionVendor vendor )
		{
			if ( vendor == null )
				return false;

			VendorList vendorList = FindVendorList( vendor.GetType() );

			if ( vendorList == null )
				return false;

			if ( !vendorList.Vendors.Contains( vendor ) )
				return false;

			vendorList.Vendors.Remove( vendor );
			return true;
		}
Пример #5
0
		public bool RegisterVendor( BaseFactionVendor vendor )
		{
			if ( vendor == null )
				return false;

			VendorList vendorList = FindVendorList( vendor.GetType() );

			if ( vendorList == null )
				return false;

			vendorList.Vendors.Add( vendor );
			return true;
		}
Пример #6
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            if (!m_Town.IsFinance(m_From) || m_Town.Owner != m_Faction)
            {
                m_From.SendLocalizedMessage(1010339); // You no longer control this city
                return;
            }

            if (!FromButtonID(info.ButtonID, out int type, out int index))
            {
                return;
            }

            switch (type)
            {
            case 0: // general
            {
                switch (index)
                {
                case 0: // set price
                {
                    int[] switches = info.Switches;

                    if (switches.Length == 0)
                    {
                        break;
                    }

                    int opt    = switches[0];
                    int newTax = 0;

                    if (opt >= 1 && opt <= m_PriceOffsets.Length)
                    {
                        newTax = m_PriceOffsets[opt - 1];
                    }

                    if (m_Town.Tax == newTax)
                    {
                        break;
                    }

                    if (m_From.AccessLevel == AccessLevel.Player && !m_Town.TaxChangeReady)
                    {
                        TimeSpan remaining = DateTime.UtcNow - (m_Town.LastTaxChange + Town.TaxChangePeriod);

                        if (remaining.TotalMinutes < 4)
                        {
                            m_From.SendLocalizedMessage(
                                1042165); // You must wait a short while before changing prices again.
                        }
                        else if (remaining.TotalMinutes < 10)
                        {
                            m_From.SendLocalizedMessage(
                                1042166); // You must wait several minutes before changing prices again.
                        }
                        else if (remaining.TotalHours < 1)
                        {
                            m_From.SendLocalizedMessage(
                                1042167); // You must wait up to an hour before changing prices again.
                        }
                        else if (remaining.TotalHours < 4)
                        {
                            m_From.SendLocalizedMessage(
                                1042168); // You must wait a few hours before changing prices again.
                        }
                        else
                        {
                            m_From.SendLocalizedMessage(
                                1042169); // You must wait several hours before changing prices again.
                        }
                    }
                    else
                    {
                        m_Town.Tax = newTax;

                        if (m_From.AccessLevel == AccessLevel.Player)
                        {
                            m_Town.LastTaxChange = DateTime.UtcNow;
                        }
                    }

                    break;
                }
                }

                break;
            }

            case 1: // make vendor
            {
                List <VendorList> vendorLists = m_Town.VendorLists;

                if (index >= 0 && index < vendorLists.Count)
                {
                    VendorList vendorList = vendorLists[index];

                    if (Town.FromRegion(m_From.Region) != m_Town)
                    {
                        m_From.SendLocalizedMessage(1010305); // You must be in your controlled city to buy Items
                    }
                    else if (vendorList.Vendors.Count >= vendorList.Definition.Maximum)
                    {
                        m_From.SendLocalizedMessage(
                            1010306); // You currently have too many of this enhancement type to place another
                    }
                    else if (BaseBoat.FindBoatAt(m_From.Location, m_From.Map) != null)
                    {
                        m_From.SendMessage("You cannot place a vendor here");
                    }
                    else if (m_Town.Silver >= vendorList.Definition.Price)
                    {
                        BaseFactionVendor vendor = vendorList.Construct(m_Town, m_Faction);

                        if (vendor != null)
                        {
                            m_Town.Silver -= vendorList.Definition.Price;

                            vendor.MoveToWorld(m_From.Location, m_From.Map);
                            vendor.Home = vendor.Location;
                        }
                    }
                }

                break;
            }
            }
        }