예제 #1
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                Point3D p           = from.Location;
                bool    validtarget = false;

                if (targeted is StaticTarget)
                {
                    p           = new Point3D((IPoint3D)targeted);
                    validtarget = true;
                }
                else if (targeted is Item)
                {
                    p           = new Point3D(((Item)targeted).Location);
                    validtarget = true;
                }
                if (validtarget)
                {
                    BaseHouse house = BaseHouse.FindHouseAt(p, from.Map, p.Z);
                    // Must be owner or co-owner, and requires 1 vendor slot and 125 lockdowns
                    if (house != null && house.Owner == from && house.CanPlaceNewVendor() && house.CheckAosStorage(125))
                    {
                        Steward m =
                            (Steward)Activator.CreateInstance(typeof(Steward), new object[] { from });
                        m.MoveToWorld(p, from.Map);
                        m.Direction = Direction.South;
                        mDeed.Delete();
                    }
                    else
                    {
                        from.SendMessage(
                            "You must place this in a house to which you are an owner or co-owner, and have 1 free vendor slot and 125 available lockdowns.");
                    }
                }
            }
예제 #2
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                IPoint3D p   = targeted as IPoint3D;
                Map      map = from.Map;

                if (p == null || map == null || m_Deed.Deleted)
                {
                    return;
                }

                if (m_Deed.IsChildOf(from.Backpack))
                {
                    BaseAddonContainer addon = m_Deed.Addon;
                    addon.Resource = m_Deed.Resource;

                    Server.Spells.SpellHelper.GetSurfaceTop(ref p);

                    BaseHouse house = null;

                    AddonFitResult res = addon.CouldFit(p, map, from, ref house);

                    bool isMaxSecureReached = false;
                    //Check if secure slot is already full
                    if (house != null)
                    {
                        if (!house.IsAosRules && house.SecureCount >= house.MaxSecures)
                        {
                            // The maximum number of secure items has been reached :
                            from.SendLocalizedMessage(1008142, true, house.MaxSecures.ToString());
                            isMaxSecureReached = true;
                        }
                        else if (house.IsAosRules ? !house.CheckAosLockdowns(1) : ((house.LockDownCount + 125) >= house.MaxLockDowns))
                        {
                            from.SendLocalizedMessage(1005379); // That would exceed the maximum lock down limit for this house
                            isMaxSecureReached = true;
                        }
                        else if (house.IsAosRules && !house.CheckAosStorage(addon.TotalItems))
                        {
                            from.SendLocalizedMessage(1061839); // This action would exceed the secure storage limit of the house.
                            isMaxSecureReached = true;
                        }
                    }

                    if (!isMaxSecureReached)
                    {
                        switch (res)
                        {
                        case AddonFitResult.Valid:
                            addon.MoveToWorld(new Point3D(p), map);
                            break;

                        case AddonFitResult.Blocked:
                            @from.SendLocalizedMessage(500269);     // You cannot build that there.
                            break;

                        case AddonFitResult.NotInHouse:
                            @from.SendLocalizedMessage(500274);     // You can only place this in a house that you own!
                            break;

                        case AddonFitResult.DoorsNotClosed:
                            @from.SendMessage("You must close all house doors before placing this.");
                            break;

                        case AddonFitResult.DoorTooClose:
                            @from.SendLocalizedMessage(500271);     // You cannot build near the door.
                            break;

                        case AddonFitResult.NoWall:
                            @from.SendLocalizedMessage(500268);     // This object needs to be mounted on something.
                            break;
                        }
                    }


                    if (res == AddonFitResult.Valid && house != null && !isMaxSecureReached)
                    {
                        m_Deed.Delete();
                        house.Addons.Add(addon);
                        house.AddSecure(from, addon);
                    }
                    else
                    {
                        addon.Delete();
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
                }
            }