예제 #1
0
        private void Replace()
        {
            Container c = Parent as Container;

            if (c != null)
            {
                DragonHeadAddonDeed deed = new DragonHeadAddonDeed();
                c.DropItem(deed);
            }
            else if (Parent == null)
            {
                BaseHouse house = BaseHouse.FindHouseAt(this);

                DragonHeadAddonDeed deed = new DragonHeadAddonDeed();
                deed.MoveToWorld(Location, Map);

                deed.IsLockedDown = IsLockedDown;
                deed.IsSecure     = IsSecure;
                deed.Movable      = Movable;

                if (house != null && house.LockDowns.ContainsKey(this))
                {
                    house.LockDowns.Remove(this);
                    house.LockDowns.Add(deed, house.Owner);
                }
                else if (house != null && house.IsSecure(this))
                {
                    house.ReleaseSecure(house.Owner, this);
                    house.AddSecure(house.Owner, deed);
                }
            }

            Delete();
        }
예제 #2
0
        private void Replace()
        {
            var trophy = new HuntTrophy(m_Owner, Index, m_Measurement, m_DateKilled, m_Location);

            if (Parent is Container)
            {
                ((Container)Parent).DropItem(trophy);
            }
            else
            {
                BaseHouse house = BaseHouse.FindHouseAt(this);
                trophy.MoveToWorld(GetWorldLocation(), Map);

                trophy.IsLockedDown = IsLockedDown;
                trophy.IsSecure     = IsSecure;
                trophy.Movable      = Movable;

                if (house != null && house.LockDowns.ContainsKey(this))
                {
                    house.LockDowns.Remove(this);
                    house.LockDowns.Add(trophy, house.Owner);
                }
                else if (house != null && house.IsSecure(this))
                {
                    house.ReleaseSecure(house.Owner, this);
                    house.AddSecure(house.Owner, trophy);
                }
            }

            Delete();
        }
예제 #3
0
    public void Placement_OnTarget(Mobile from, object targeted, object state)
    {
        IPoint3D p   = targeted as IPoint3D;
        Map      map = from.Map;

        if (p == null)
        {
            return;
        }

        Point3D loc = new Point3D(p);

        BaseHouse house = BaseHouse.FindHouseAt(loc, from.Map, 16);

        if (house != null && house.IsOwner(from))
        {
            DragonKnightsGhostClock dkgc = new DragonKnightsGhostClock( );
            dkgc.MoveToWorld(new Point3D(p), map);
            house.AddSecure(from, (Item)dkgc);
            Delete();
            from.PlaySound(0x482);
            from.Say("In the neighbor hood.");
            Effects.SendLocationEffect(Location, Map, 0x3709, 13, 0x3B2, 0);
            Effects.SendLocationEffect(from, Map, 0x3709, 13, 0x3B2, 0);
        }
        else
        {
            from.SendLocalizedMessage(1042036);                       // That location is not in your house.
        }
    }
예제 #4
0
        public void Placement_OnTarget(Mobile from, object targeted, object state)
        {
            IPoint3D p   = targeted as IPoint3D;
            Map      map = from.Map;

            if (p == null)
            {
                return;
            }

            Point3D loc = new Point3D(p);

            BaseHouse house = BaseHouse.FindHouseAt(loc, from.Map, 16);

            if (house != null && house.IsOwner(from))
            {
                Mailbox mailbox = new Mailbox( );
                mailbox.MoveToWorld(new Point3D(p), map);
                Delete();
                mailbox.Owner = from;
//				house.Addons.Add(mailbox);
                house.AddSecure(from, mailbox);
            }
            else
            {
                from.SendMessage(38, "You don't Own that property. You can only place this Mailbox on house property you own.");
            }
        }
            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);

                    if (res == AddonFitResult.Valid)
                    {
                        addon.MoveToWorld(new Point3D(p), map);
                    }
                    else if (res == AddonFitResult.Blocked)
                    {
                        from.SendLocalizedMessage(500269);                           // You cannot build that there.
                    }
                    else if (res == AddonFitResult.NotInHouse)
                    {
                        from.SendLocalizedMessage(500274);                           // You can only place this in a house that you own!
                    }
                    else if (res == AddonFitResult.DoorTooClose)
                    {
                        from.SendLocalizedMessage(500271);                           // You cannot build near the door.
                    }
                    else if (res == AddonFitResult.NoWall)
                    {
                        from.SendLocalizedMessage(500268);                           // This object needs to be mounted on something.
                    }
                    if (res == AddonFitResult.Valid)
                    {
                        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.
                }
            }
예제 #6
0
        public override bool OnDragLift(Mobile from)
        {
            BaseHouse house = BaseHouse.FindHouseAt(from);

            if (!BaseHouse.CheckLockedDownOrSecured(this) && house != null)
            {
                house.AddSecure(from, (Item)this);
            }
            return(false);
        }
예제 #7
0
        public static void Replace(Item oldItem, CraftableItemType type)
        {
            BaseAddon addon = oldItem is AddonComponent ? ((AddonComponent)oldItem).Addon : null;

            CraftableHouseItem item = new CraftableHouseItem(type);

            if (oldItem.Parent is Container)
            {
                ((Container)oldItem.Parent).DropItem(item);
            }
            else
            {
                BaseHouse house = BaseHouse.FindHouseAt(oldItem);

                item.MoveToWorld(oldItem.Location, oldItem.Map);

                item.IsLockedDown = oldItem.IsLockedDown;
                item.IsSecure     = oldItem.IsSecure;
                item.Movable      = oldItem.Movable;

                if (house != null)
                {
                    if (house.LockDowns.ContainsKey(oldItem))
                    {
                        house.LockDowns.Remove(oldItem);
                        house.LockDowns.Add(item, house.Owner);
                    }
                    else if (house.IsSecure(oldItem))
                    {
                        house.ReleaseSecure(house.Owner, oldItem);
                        house.AddSecure(house.Owner, item);
                    }
                    else if (addon != null)
                    {
                        if (house.Addons.ContainsKey(addon))
                        {
                            house.Addons.Remove(addon);
                        }

                        house.LockDowns.Add(item, house.Owner);
                    }
                }

                item.InvalidateProperties();
            }

            if (addon != null)
            {
                addon.Delete();
            }
            else
            {
                oldItem.Delete();
            }
        }
예제 #8
0
        public override bool OnDragLift(Mobile from)
        {
            BaseHouse house = BaseHouse.FindHouseAt(this);            //changed from (from to this)

            if (!BaseHouse.CheckLockedDownOrSecured(this) && house != null)
            {
                house.AddSecure(from, (Item)this);
                this.Owner = house.Owner;
            }
            this.Say("Needs to be choped down to be moved.");
            this.Movable = false;
            return(false);
        }
예제 #9
0
        public void Replace()
        {
            BaseDoor door;

            if (Type < DoorType.LeftMetalDoor_S_In)
            {
                door = new CraftableStoneHouseDoor(Type, CraftableMetalHouseDoor.GetDoorFacing(Type));
            }
            else
            {
                door = new CraftableMetalHouseDoor(Type, CraftableMetalHouseDoor.GetDoorFacing(Type));
            }

            if (door is IResource)
            {
                ((IResource)door).Resource = _Resource;
            }

            if (Parent is Container)
            {
                ((Container)Parent).DropItem(door);
            }
            else
            {
                BaseHouse house = BaseHouse.FindHouseAt(this);

                door.MoveToWorld(Location, Map);

                door.IsLockedDown = IsLockedDown;
                door.IsSecure     = IsSecure;
                door.Movable      = Movable;

                if (house != null && house.LockDowns.ContainsKey(this))
                {
                    house.LockDowns.Remove(this);
                    house.LockDowns.Add(door, house.Owner);
                }
                else if (house != null && house.IsSecure(this))
                {
                    house.ReleaseSecure(house.Owner, this);
                    house.AddSecure(house.Owner, door);
                }
            }

            Delete();
        }
예제 #10
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;
                }

                StablePost post  = new StablePost(m_Deed.East);
                BaseHouse  house = BaseHouse.FindHouseAt(from.Location, from.Map, 20);

                if (m_Deed.IsChildOf(from.Backpack))
                {
                    Server.Spells.SpellHelper.GetSurfaceTop(ref p);

                    if (house != null && house.IsInside(from) && house.IsOwner(from))
                    {
                        post.MoveToWorld(new Point3D(p), map);
                        house.AddSecure(from, (Item)post);
                        m_Deed.Delete();
                    }
                    else if (house != null && house.IsInside(from) && !house.IsOwner(from))
                    {
                        from.SendLocalizedMessage(500274);                           // You can only place this in a house that you own!
                        post.Delete();
                    }
                    else if (house == null)
                    {
                        from.SendLocalizedMessage(500269);                           // You cannot build that there.
                        post.Delete();
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1042001);                       // That must be in your pack for you to use it.
                }
            }
예제 #11
0
        public override void OnDoubleClick(Mobile from)
        {
            BaseHouse house = BaseHouse.FindHouseAt(from);

            from.CloseGump(typeof(HitchGump));
            if (BaseHouse.CheckLockedDownOrSecured(this))
            {
                if (CheckAccess(from))
                {
                    if (Owner == null)
                    {
                        from.Target = new StablePostTarget(this);
                        from.SendMessage(68, "What do you wish to use this on?");
                    }
                    if (Owner != null && from == Owner)
                    {
                        from.Target = new StablePostTarget(this);
                        from.SendMessage(68, "Target the animal you wish to release from the stable.");
                    }
                    else if (Owner != null && Owner != from)
                    {
                        from.SendMessage(38, "This is under the control of another owner.");
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1061637);                     // You are not allowed to access this.
                }
            }
            else
            {
                //from.SendMessage("You must secure this before it can be used!");
                if (house != null)
                {
                    house.AddSecure(from, (Item)this);
                }
            }
        }
예제 #12
0
        public override void OnMovement(Mobile m, Point3D oldLocation)
        {
            BaseHouse house = BaseHouse.FindHouseAt(m);

            if (!BaseHouse.CheckLockedDownOrSecured(this) && house != null)
            {
                house.AddSecure(m, (Item)this);
            }
            if (m is BaseCreature)
            {
                if ((BaseCreature)m == Controlled)
                {
                    if (((BaseCreature)m).Loyalty <= 100)
                    {
                        ((BaseCreature)m).Loyalty = 100;
                    }
                    if (((BaseCreature)m).RangeHome != HomeRange)
                    {
                        ((BaseCreature)m).RangeHome = HomeRange;
                    }
                }
            }
            base.OnMovement(m, oldLocation);
        }
예제 #13
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.
                }
            }
예제 #14
0
            public override void OnClick()
            {
//				contextmenu_from.SendMessage("screwed");//testing
                contextmenu_house.AddSecure(contextmenu_from, contextmenu_mailbox);
            }