public override void OnClick()
            {
                Mobile from = Owner.From;

                if (m_Contract.IsUsableBy(from, true, true, true, true))
                {
                    from.CloseGump(typeof(VendorRentalContractGump));
                    from.SendGump(new VendorRentalContractGump(m_Contract, from));
                }
            }
예제 #2
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (!m_Contract.IsUsableBy(from, false, true, true, true))
                {
                    return;
                }

                IPoint3D location = targeted as IPoint3D;

                if (location == null)
                {
                    return;
                }

                Point3D pLocation = new Point3D(location);
                Map     map       = from.Map;

                BaseHouse house = BaseHouse.FindHouseAt(pLocation, map, 0);

                if (house == null || !house.IsOwner(from))
                {
                    from.SendLocalizedMessage(1062338);                       // The location being rented out must be inside of your house.
                }
                else if (BaseHouse.FindHouseAt(from) != house)
                {
                    from.SendLocalizedMessage(1062339);                       // You must be located inside of the house in which you are trying to place the contract.
                }

                else if (!house.Public)
                {
                    from.SendLocalizedMessage(1062335);                       // Rental contracts can only be placed in public houses.
                }
                else if (house.FindTownshipNPC() != null)
                {
                    from.SendMessage("Rental contracts cannot be used in houses containing a Township NPC.");
                }
                else if (!map.CanFit(pLocation, 16, CanFitFlags.requireSurface))
                {
                    from.SendLocalizedMessage(1062486);                       // A vendor cannot exist at that location.  Please try again.
                }
                else
                {
                    m_Contract.MoveToWorld(pLocation, map);

                    if (!house.LockDown(from, m_Contract))
                    {
                        from.AddToBackpack(m_Contract);
                    }
                }
            }
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (!m_Contract.IsUsableBy(from, false, true, true, true))
                {
                    return;
                }

                IPoint3D location = targeted as IPoint3D;

                if (location == null)
                {
                    return;
                }

                Point3D pLocation = new Point3D(location);
                Map     map       = from.Map;

                BaseHouse house = BaseHouse.FindHouseAt(pLocation, map, 0);

                if (house == null || !house.IsOwner(from))
                {
                    from.SendLocalizedMessage(1062338);                       // The location being rented out must be inside of your house.
                }
                else if (BaseHouse.FindHouseAt(from) != house)
                {
                    from.SendLocalizedMessage(1062339);                       // You must be located inside of the house in which you are trying to place the contract.
                }
                else if (!house.IsAosRules)
                {
                    from.SendMessage("Rental contracts can only be placed in AOS-enabled houses.");
                }
                else if (!house.Public)
                {
                    from.SendLocalizedMessage(1062335);                       // Rental contracts can only be placed in public houses.
                }
                else if (house.DecayType == DecayType.Condemned)
                {
                    from.SendLocalizedMessage(1062468);                       // You cannot place a contract in a condemned house.
                }
                else if (!house.CanPlaceNewVendor())
                {
                    from.SendLocalizedMessage(1062352);                       // You do not have enought storage available to place this contract.
                }
                else if (!map.CanFit(pLocation, 16, false, false))
                {
                    from.SendLocalizedMessage(1062486);                       // A vendor cannot exist at that location.  Please try again.
                }
                else
                {
                    bool vendor, contract;
                    BaseHouse.IsThereVendor(pLocation, map, out vendor, out contract);

                    if (vendor)
                    {
                        from.SendLocalizedMessage(1062342);                           // You may not place a rental contract at this location while other beings occupy it.
                    }
                    else if (contract)
                    {
                        from.SendLocalizedMessage(1062341);                           // That location is cluttered.  Please clear out any objects there and try again.
                    }
                    else
                    {
                        m_Contract.MoveToWorld(pLocation, map);

                        if (!house.LockDown(from, m_Contract))
                        {
                            from.AddToBackpack(m_Contract);
                        }
                    }
                }
            }