Example #1
0
        public override void OnDoubleClick(Mobile from)
        {
            if (IsChildOf(from.Backpack))
            {
                BaseHouse house = BaseHouse.FindHouseAt(from);

                if (house != null && house.IsCoOwner(from))
                {
                    bool northWall = BaseAddon.IsWall(from.X, from.Y - 1, from.Z, from.Map);
                    bool westWall  = BaseAddon.IsWall(from.X - 1, from.Y, from.Z, from.Map);

                    if (northWall && westWall)
                    {
                        switch (from.Direction & Direction.Mask)
                        {
                        case Direction.North:
                        case Direction.South: northWall = true; westWall = false; break;

                        case Direction.East:
                        case Direction.West:  northWall = false; westWall = true; break;

                        default: from.SendMessage("Turn to face the wall on which to hang this trophy."); return;
                        }
                    }

                    int itemID = 0;

                    if (northWall)
                    {
                        itemID = m_NorthID;
                    }
                    else if (westWall)
                    {
                        itemID = m_WestID;
                    }
                    else
                    {
                        from.SendLocalizedMessage(1042626);                           // The trophy must be placed next to a wall.
                    }
                    if (itemID > 0)
                    {
                        house.Addons.Add(new TrophyAddon(from, itemID, m_WestID, m_NorthID, m_DeedNumber, m_AddonNumber, m_Hunter, m_AnimalWeight));
                        Delete();
                    }
                }
                else
                {
                    from.SendLocalizedMessage(502092);                       // You must be in your house to do this.
                }
            }
            else
            {
                from.SendLocalizedMessage(1042001);                   // That must be in your pack for you to use it.
            }
        }
Example #2
0
        public bool CouldFit(IPoint3D p, Map map)
        {
            if (map?.CanFit(p.X, p.Y, p.Z, ItemData.Height) != true)
            {
                return(false);
            }

            return(FacingSouth ?
                   BaseAddon.IsWall(p.X, p.Y - 1, p.Z, map) :
                   BaseAddon.IsWall(p.X - 1, p.Y, p.Z, map));
        }
Example #3
0
        public bool CouldFit(IPoint3D p, Map map)
        {
            if (!map.CanFit(p.X, p.Y, p.Z, ItemData.Height))
            {
                return(false);
            }

            if (ItemID == 0x2375)
            {
                return(BaseAddon.IsWall(p.X, p.Y - 1, p.Z, map)); // North wall
            }
            return(BaseAddon.IsWall(p.X - 1, p.Y, p.Z, map));     // West wall
        }
Example #4
0
        public bool CouldFit(IPoint3D p, Map map)
        {
            if (map == null || !map.CanFit(p.X, p.Y, p.Z, ItemData.Height))
            {
                return(false);
            }

            if (FacingEast)
            {
                return(BaseAddon.IsWall(p.X - 1, p.Y, p.Z, map)); // west wall
            }

            return(BaseAddon.IsWall(p.X, p.Y - 1, p.Z, map)); // north wall
        }
        public bool CouldFit(IPoint3D p, Map map)
        {
            if (!map.CanFit(p.X, p.Y, p.Z, ItemData.Height))
            {
                return(false);
            }

            if ((ItemID & 0x1) == 0x0)
            {
                return(BaseAddon.IsWall(p.X, p.Y - 1, p.Z, map) && BaseAddon.IsWall(p.X - 1, p.Y - 1, p.Z, map));                      // North wall + Upper wall
            }
            else
            {
                return(BaseAddon.IsWall(p.X - 1, p.Y, p.Z, map) && BaseAddon.IsWall(p.X - 1, p.Y - 1, p.Z, map));                      // West wall + Upper wall
            }
        }
        public bool CouldFit(IPoint3D p, Map map)
        {
            if (!map.CanFit(p.X, p.Y, p.Z, this.ItemData.Height))
            {
                return(false);
            }

            if (this.ItemID == m_NorthID)
            {
                return(BaseAddon.IsWall(p.X, p.Y - 1, p.Z, map));                  // North wall
            }
            else
            {
                return(BaseAddon.IsWall(p.X - 1, p.Y, p.Z, map));                  // West wall
            }
        }
        }                                                              // Where would you like to place this decoration?

        public void Placement_OnTarget(Mobile from, object targeted, object state)
        {
            if (!IsChildOf(from.Backpack))
            {
                return;
            }

            IPoint3D p = targeted as IPoint3D;

            if (p == null)
            {
                return;
            }

            Point3D loc = new Point3D(p);

            if (!from.Map.CanFit(loc.X, loc.Y, loc.Z, 1))               // TODO: Height
            {
                return;
            }

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

            if (house != null && house.IsOwner(from))
            {
                int itemID = (int)state;
                if (BaseAddon.IsWall(loc.X - 1, loc.Y - 1, loc.Z, from.Map) && ((itemID & 0x1) == 0x0 ? BaseAddon.IsWall(loc.X, loc.Y - 1, loc.Z, from.Map) : BaseAddon.IsWall(p.X - 1, p.Y, p.Z, from.Map)))
                {
                    HangingShield shield = new HangingShield(itemID);
                    shield.IsRewardItem = IsRewardItem;
                    shield.MoveToWorld(loc, from.Map);
                    house.Addons.Add(shield);
                    Delete();
                }
                else
                {
                    from.SendLocalizedMessage(1062840);                       // The decoration must be placed next to a wall.
                }
            }
            else
            {
                from.SendLocalizedMessage(1042036);                   // That location is not in your house.
            }
        }
        public bool CouldFit(IPoint3D p, Map map)
        {
            if (map == null || !map.CanFit(p.X, p.Y, p.Z, ItemData.Height))
            {
                return(false);
            }

            if (Type == StoneFaceTrapType.NorthWestWall)
            {
                return(BaseAddon.IsWall(p.X, p.Y - 1, p.Z, map) && BaseAddon.IsWall(p.X - 1, p.Y, p.Z, map));                    // north and west wall
            }
            else if (Type == StoneFaceTrapType.NorthWall)
            {
                return(BaseAddon.IsWall(p.X, p.Y - 1, p.Z, map));                  // north wall
            }
            else if (Type == StoneFaceTrapType.WestWall)
            {
                return(BaseAddon.IsWall(p.X - 1, p.Y, p.Z, map));                  // west wall
            }
            return(false);
        }
Example #9
0
        public void Placement_OnTarget(Mobile from, object targeted, object state)
        {
            IPoint3D p = targeted as IPoint3D;

            if (p == null)
            {
                return;
            }

            Point3D loc = new Point3D(p);
            Map     map = from.Map;

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

            if (house != null && house.IsCoOwner(from))
            {
                if (map.CanFit(loc, 16))
                {
                    bool northWall = BaseAddon.IsWall(loc.X, loc.Y - 1, loc.Z, from.Map);
                    bool westWall  = BaseAddon.IsWall(loc.X - 1, loc.Y, loc.Z, from.Map);

                    if (northWall && westWall)
                    {
                        from.SendGump(new HolidayMistletoeDeedGump(from, loc, this));
                    }
                    else
                    {
                        PlaceAddon(from, loc, northWall, westWall);
                    }
                }
                else
                {
                    from.SendMessage("The mistletoe must be placed next to a wall");
                }
            }
            else
            {
                from.SendLocalizedMessage(1042036);                   // That location is not in your house.
            }
        }
        public void Placement_OnTarget(Mobile from, object targeted, object state)
        {
            IPoint3D p = targeted as IPoint3D;

            if (p == null)
            {
                return;
            }

            Point3D loc = new Point3D(p);

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

            if ((house != null && house.IsCoOwner(from)) || from.AccessLevel >= AccessLevel.GameMaster)
            {
                bool northWall = BaseAddon.IsWall(loc.X, loc.Y - 1, loc.Z, from.Map);
                bool westWall  = BaseAddon.IsWall(loc.X - 1, loc.Y, loc.Z, from.Map);

                if (northWall && westWall)
                {
                    from.SendGump(new StoneFaceDeedGump(from, loc, this));
                }
                else if (northWall || westWall)
                {
                    PlaceAddon(from, loc, northWall, westWall);
                }
                else
                {
                    from.SendMessage("This must be placed next to a wall in your house.");
                }
            }
            else
            {
                from.SendLocalizedMessage(1042036);                   // That location is not in your house.
            }
        }
Example #11
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                IPoint3D p   = targeted as IPoint3D;
                Map      map = from.Map;

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

                AddonFitResult result = AddonFitResult.Valid;

                if (Deed.IsChildOf(from.Backpack))
                {
                    BaseHouse house = null;

                    if (!map.CanFit(p.X, p.Y, p.Z, 16, false, true, false))
                    {
                        result = AddonFitResult.Blocked;
                    }
                    else if (!BaseAddon.CheckHouse(from, new Point3D(p), map, 16, ref house))
                    {
                        result = AddonFitResult.NotInHouse;
                    }
                    else
                    {
                        bool east  = BaseAddon.IsWall(p.X - 1, p.Y, p.Z, map);
                        bool south = BaseAddon.IsWall(p.X, p.Y - 1, p.Z, map);

                        if (!south && !east)
                        {
                            result = AddonFitResult.NoWall;
                        }
                        else if (south && east)
                        {
                            from.SendGump(new AddonInterchangeableGump(from, Deed, p, map));
                        }
                        else
                        {
                            BaseAddon addon = Deed.DeployAddon(east, p, map);
                            house.Addons.Add(addon);

                            Deed.Delete();
                        }
                    }

                    switch (result)
                    {
                    default: break;

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

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

                    case AddonFitResult.NoWall: from.SendLocalizedMessage(500268); break;     // This object needs to be mounted on something.
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1042001);                       // That must be in your pack for you to use it.
                }
            }
Example #12
0
        public void Placement_OnTarget(Mobile from, object targeted, object state)
        {
            IPoint3D p = targeted as IPoint3D;

            if (p == null)
            {
                return;
            }

            Point3D loc = new Point3D(p);

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

            if (house != null && house.IsCoOwner(from))
            {
                bool northWall = BaseAddon.IsWall(loc.X, loc.Y - 1, loc.Z, from.Map);
                bool westWall  = BaseAddon.IsWall(loc.X - 1, loc.Y, loc.Z, from.Map);

                if (northWall && westWall)
                {
                    switch (from.Direction & Direction.Mask)
                    {
                    case Direction.North:
                    case Direction.South: northWall = true; westWall = false; break;

                    case Direction.East:
                    case Direction.West: northWall = false; westWall = true; break;

                    default: from.SendMessage("Turn to face the wall on which to hang this trophy."); return;
                    }
                }

                int itemID = 0;

                if (northWall)
                {
                    itemID = 0x9964;
                }
                else if (westWall)
                {
                    itemID = 0x9965;
                }
                else
                {
                    from.SendLocalizedMessage(1042626); // The trophy must be placed next to a wall.
                }
                if (itemID > 0)
                {
                    Item addon = new StaghornFernAddon();

                    addon.ItemID = itemID;
                    addon.MoveToWorld(loc, from.Map);

                    house.Addons[addon] = from;
                    Delete();
                }
            }
            else
            {
                from.SendLocalizedMessage(1042036); // That location is not in your house.
            }
        }
Example #13
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_FirefliesDeed?.Deleted != false)
                {
                    return;
                }

                if (m_FirefliesDeed.IsChildOf(from.Backpack))
                {
                    var house = BaseHouse.FindHouseAt(from);

                    if (house?.IsOwner(from) == true)
                    {
                        var p   = targeted as IPoint3D;
                        var map = from.Map;

                        if (p == null || map == null || map == Map.Internal)
                        {
                            return;
                        }

                        var p3d = new Point3D(p);
                        var id  = TileData.ItemTable[m_ItemID & TileData.MaxItemValue];

                        if (map.CanFit(p3d, id.Height))
                        {
                            house = BaseHouse.FindHouseAt(p3d, map, id.Height);

                            if (house?.IsOwner(from) == true)
                            {
                                var north = BaseAddon.IsWall(p3d.X, p3d.Y - 1, p3d.Z, map);
                                var west  = BaseAddon.IsWall(p3d.X - 1, p3d.Y, p3d.Z, map);

                                bool isclear = true;

                                foreach (Item item in Map.Malas.GetItemsInRange(p3d, 0))
                                {
                                    if (item is Fireflies)
                                    {
                                        isclear = false;
                                    }
                                }

                                if ((m_ItemID == 0x2336 && north || m_ItemID == 0x2332 && west) && isclear)
                                {
                                    var flies = new Fireflies(m_ItemID);

                                    house.Addons.Add(flies);

                                    flies.MoveToWorld(p3d, from.Map);

                                    m_FirefliesDeed.Delete();
                                }
                                else
                                {
                                    from.SendLocalizedMessage(1150065); // Holiday fireflies must be placed next to a wall.
                                }
                            }
                            else
                            {
                                from.SendLocalizedMessage(1042036); // That location is not in your house.
                            }
                        }
                        else
                        {
                            from.SendLocalizedMessage(500269); // You cannot build that there.
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(502092); // You must be in your house to do this.
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1042038); // You must have the object in your backpack to use it.
                }
            }
Example #14
0
        public AddonFitResult CouldFit(IPoint3D p, Map map, Mobile from, ref IHouse house)
        {
            if (Deleted)
            {
                return(AddonFitResult.Blocked);
            }

            foreach (AddonContainerComponent c in m_Components)
            {
                Point3D p3D = new Point3D(p.X + c.Offset.X, p.Y + c.Offset.Y, p.Z + c.Offset.Z);

                if (!map.CanFit(p3D.X, p3D.Y, p3D.Z, c.ItemData.Height, false, true, (c.Z == 0)))
                {
                    return(AddonFitResult.Blocked);
                }
                else if (!BaseAddon.CheckHouse(from, p3D, map, c.ItemData.Height, ref house))
                {
                    return(AddonFitResult.NotInHouse);
                }

                if (c.NeedsWall)
                {
                    Point3D wall = c.WallPosition;

                    if (!BaseAddon.IsWall(p3D.X + wall.X, p3D.Y + wall.Y, p3D.Z + wall.Z, map))
                    {
                        return(AddonFitResult.NoWall);
                    }
                }
            }

            Point3D p3 = new Point3D(p.X, p.Y, p.Z);

            if (!map.CanFit(p3.X, p3.Y, p3.Z, ItemData.Height, false, true, (Z == 0)))
            {
                return(AddonFitResult.Blocked);
            }
            else if (!BaseAddon.CheckHouse(from, p3, map, ItemData.Height, ref house))
            {
                return(AddonFitResult.NotInHouse);
            }

            if (NeedsWall)
            {
                Point3D wall = WallPosition;

                if (!BaseAddon.IsWall(p3.X + wall.X, p3.Y + wall.Y, p3.Z + wall.Z, map))
                {
                    return(AddonFitResult.NoWall);
                }
            }

            ArrayList doors = house.Doors;

            for (int i = 0; i < doors.Count; ++i)
            {
                BaseDoor door = doors[i] as BaseDoor;

                if (door != null && door.Open)
                {
                    return(AddonFitResult.DoorsNotClosed);
                }

                Point3D doorLoc    = door.GetWorldLocation();
                int     doorHeight = door.ItemData.CalcHeight;

                foreach (AddonContainerComponent c in m_Components)
                {
                    Point3D addonLoc    = new Point3D(p.X + c.Offset.X, p.Y + c.Offset.Y, p.Z + c.Offset.Z);
                    int     addonHeight = c.ItemData.CalcHeight;

                    if (doorLoc.InRange(addonLoc, 1) && (addonLoc.Z == doorLoc.Z || ((addonLoc.Z + addonHeight) > doorLoc.Z && (doorLoc.Z + doorHeight) > addonLoc.Z)))
                    {
                        return(AddonFitResult.DoorTooClose);
                    }
                }

                Point3D addonLo    = new Point3D(p.X, p.Y, p.Z);
                int     addonHeigh = ItemData.CalcHeight;

                if (doorLoc.InRange(addonLo, 1) && (addonLo.Z == doorLoc.Z || ((addonLo.Z + addonHeigh) > doorLoc.Z && (doorLoc.Z + doorHeight) > addonLo.Z)))
                {
                    return(AddonFitResult.DoorTooClose);
                }
            }

            return(AddonFitResult.Valid);
        }
Example #15
0
        public override void OnDoubleClick(Mobile m)
        {
            if (IsChildOf(m.Backpack))
            {
                m.BeginTarget(8, false, Targeting.TargetFlags.None, (from, targeted) =>
                {
                    if (targeted is IPoint3D)
                    {
                        IPoint3D p      = targeted as IPoint3D;
                        BaseHouse house = BaseHouse.FindHouseAt(new Point3D(p), m.Map, 16);

                        if (house != null && BaseHouse.FindHouseAt(m) == house && house.IsCoOwner(m))
                        {
                            Point3D pnt = new Point3D(p.X, p.Y, m.Z);

                            bool northWall = BaseAddon.IsWall(pnt.X, pnt.Y - 1, pnt.Z, m.Map);
                            bool westWall  = BaseAddon.IsWall(pnt.X - 1, pnt.Y, pnt.Z, m.Map);

                            if (northWall && westWall)
                            {
                                switch (from.Direction & Direction.Mask)
                                {
                                case Direction.North:
                                case Direction.South: northWall = true; westWall = false; break;

                                case Direction.East:
                                case Direction.West: northWall = false; westWall = true; break;

                                default: from.SendMessage("Turn to face the wall on which to place the safe."); return;
                                }
                            }

                            int itemID = 0;

                            if (northWall)
                            {
                                itemID = 0x8B8F;
                            }
                            else if (westWall)
                            {
                                itemID = 0x8B90;
                            }
                            else
                            {
                                m.SendLocalizedMessage(500268);     // This object needs to be mounted on something.
                            }
                            if (itemID != 0)
                            {
                                Item safe = new WallSafe(m);
                                safe.MoveToWorld(pnt, m.Map);

                                safe.ItemID = itemID;

                                house.Addons[safe] = m;

                                Delete();
                            }
                        }
                        else
                        {
                            m.SendLocalizedMessage(500274);     // You can only place this in a house that you own!
                        }
                    }
                });
            }
            else
            {
                m.SendLocalizedMessage(1080058); // This must be in your backpack to use it.
            }
        }
Example #16
0
        public override void OnDoubleClick(Mobile from)
        {
            if (IsChildOf(from.Backpack))
            {
                BaseHouse house = BaseHouse.FindHouseAt(from);

                if (house != null && house.IsCoOwner(from))
                {
                    bool northWall = BaseAddon.IsWall(from.X, from.Y - 1, from.Z, from.Map);
                    bool westWall  = BaseAddon.IsWall(from.X - 1, from.Y, from.Z, from.Map);

                    if (northWall && westWall)
                    {
                        switch (from.Direction & Direction.Mask)
                        {
                        case Direction.North:
                        case Direction.South: northWall = true; westWall = false; break;

                        case Direction.East:
                        case Direction.West: northWall = false; westWall = true; break;

                        default: from.SendMessage("Turn to face the wall on which to hang this trophy."); return;
                        }
                    }

                    int itemID = 0;

                    if (northWall)
                    {
                        itemID = SouthID;
                    }
                    else if (westWall)
                    {
                        itemID = EastID;
                    }
                    else
                    {
                        from.SendLocalizedMessage(1042626); // The trophy must be placed next to a wall.
                    }
                    if (itemID > 0)
                    {
                        Item trophy;

                        if (Info.Complex)
                        {
                            trophy = new HuntTrophyAddon(m_Owner, Index, m_Measurement, m_DateKilled, m_Location);
                        }
                        else
                        {
                            trophy        = new HuntTrophy(m_Owner, Index, m_Measurement, m_DateKilled, m_Location);
                            trophy.ItemID = itemID;
                        }

                        trophy.MoveToWorld(from.Location, from.Map);

                        house.Addons[trophy] = from;
                        Delete();
                    }
                }
                else
                {
                    from.SendLocalizedMessage(502092); // You must be in your house to do this.
                }
            }
            else
            {
                from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
            }
        }
Example #17
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_FirefliesDeed == null || m_FirefliesDeed.Deleted)
                {
                    return;
                }

                if (m_FirefliesDeed.IsChildOf(from.Backpack))
                {
                    BaseHouse house = BaseHouse.FindHouseAt(from);

                    if (house != null && house.IsOwner(from))
                    {
                        IPoint3D p   = targeted as IPoint3D;
                        Map      map = from.Map;

                        if (p == null || map == null || map == Map.Internal)
                        {
                            return;
                        }

                        Point3D  p3d = new Point3D(p);
                        ItemData id  = TileData.ItemTable[m_ItemID & TileData.MaxItemValue];

                        if (map.CanFit(p3d, id.Height))
                        {
                            house = BaseHouse.FindHouseAt(p3d, map, id.Height);

                            if (house != null && house.IsOwner(from))
                            {
                                bool north = BaseAddon.IsWall(p3d.X, p3d.Y - 1, p3d.Z, map);
                                bool west  = BaseAddon.IsWall(p3d.X - 1, p3d.Y, p3d.Z, map);

                                if ((m_ItemID == 0x2336 && north) || (m_ItemID == 0x2332 && west))
                                {
                                    Fireflies flies = new Fireflies(m_ItemID);

                                    house.Addons.Add(flies);

                                    flies.MoveToWorld(p3d, from.Map);

                                    m_FirefliesDeed.Delete();
                                }

                                else
                                {
                                    from.SendLocalizedMessage(1150065);                                       // Holiday fireflies must be placed next to a wall.
                                }
                            }
                            else
                            {
                                from.SendLocalizedMessage(1042036);                                   // That location is not in your house.
                            }
                        }
                        else
                        {
                            from.SendLocalizedMessage(500269);                               // You cannot build that there.
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(502092);                           // You must be in your house to do this.
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1042038);                       // You must have the object in your backpack to use it.
                }
            }
Example #18
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_Skeleton == null || m_Skeleton.Deleted)
                {
                    return;
                }

                if (m_Skeleton.IsChildOf(from.Backpack))
                {
                    var house = HousingHelper.FindHouseAt(from);

                    if (house != null && house.IsOwner(from))
                    {
                        IPoint3D p   = targeted as IPoint3D;
                        Map      map = from.Map;

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

                        Point3D  p3d = new Point3D(p);
                        ItemData id  = TileData.ItemTable[m_ItemID & TileData.MaxItemValue];

                        if (map.CanFit(p3d, id.Height))
                        {
                            house = HousingHelper.FindHouseAt(p3d, map, id.Height);

                            if (house != null && house.IsOwner(from))
                            {
                                bool north = BaseAddon.IsWall(p3d.X, p3d.Y - 1, p3d.Z, map);
                                bool west  = BaseAddon.IsWall(p3d.X - 1, p3d.Y, p3d.Z, map);

                                if (north && west)
                                {
                                    from.CloseGump(typeof(FacingGump));
                                    from.SendGump(new FacingGump(m_Skeleton, m_ItemID, p3d, house));
                                }
                                else if (north || west)
                                {
                                    HangingSkeleton banner = null;

                                    if (north)
                                    {
                                        banner = new HangingSkeleton(m_ItemID);
                                    }
                                    else if (west)
                                    {
                                        banner = new HangingSkeleton(GetWestItemID(m_ItemID));
                                    }

                                    house.Addons.Add(banner);

                                    banner.IsRewardItem = m_Skeleton.IsRewardItem;
                                    banner.MoveToWorld(p3d, map);

                                    m_Skeleton.Delete();
                                }
                                else
                                {
                                    from.SendLocalizedMessage(1042039);                                       // The banner must be placed next to a wall.
                                }
                            }
                            else
                            {
                                from.SendLocalizedMessage(1042036);                                   // That location is not in your house.
                            }
                        }
                        else
                        {
                            from.SendLocalizedMessage(500269);                               // You cannot build that there.
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(502092);                           // You must be in your house to do this.
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1042038);                       // You must have the object in your backpack to use it.
                }
            }
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_Head == null || m_Head.Deleted)
                {
                    return;
                }

                if (m_Head.IsChildOf(from.Backpack))
                {
                    BaseHouse house = BaseHouse.FindHouseAt(from);

                    if (house != null && house.IsOwner(from))
                    {
                        IPoint3D p   = targeted as IPoint3D;
                        Map      map = from.Map;

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

                        Point3D  p3d = new Point3D(p);
                        ItemData id  = TileData.ItemTable[0x10F5];

                        house = BaseHouse.FindHouseAt(p3d, map, id.Height);

                        if (house != null && house.IsOwner(from))
                        {
                            if (map.CanFit(p3d, id.Height))
                            {
                                bool north = BaseAddon.IsWall(p3d.X, p3d.Y - 1, p3d.Z, map);
                                bool west  = BaseAddon.IsWall(p3d.X - 1, p3d.Y, p3d.Z, map);

                                FlamingHead head = null;

                                if (north && west)
                                {
                                    head = new FlamingHead(StoneFaceTrapType.NorthWestWall);
                                }
                                else if (north)
                                {
                                    head = new FlamingHead(StoneFaceTrapType.NorthWall);
                                }
                                else if (west)
                                {
                                    head = new FlamingHead(StoneFaceTrapType.WestWall);
                                }

                                if (north || west)
                                {
                                    house.Addons.Add(head);

                                    head.IsRewardItem = m_Head.IsRewardItem;
                                    head.MoveToWorld(p3d, map);

                                    m_Head.Delete();
                                }
                                else
                                {
                                    from.SendLocalizedMessage(1042266);                                       // The head must be placed next to a wall.
                                }
                            }
                            else
                            {
                                from.SendLocalizedMessage(1042266);                                   // The head must be placed next to a wall.
                            }
                        }
                        else
                        {
                            from.SendLocalizedMessage(1042036);                               // That location is not in your house.
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(502115);                           // You must be in your house to do this.
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1042038);                       // You must have the object in your backpack to use it.
                }
            }
Example #20
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (this.m_Shield == null || this.m_Shield.Deleted)
                {
                    return;
                }

                if (this.m_Shield.IsChildOf(from.Backpack))
                {
                    BaseHouse house = BaseHouse.FindHouseAt(from);

                    if (house != null && house.IsOwner(from))
                    {
                        IPoint3D p   = targeted as IPoint3D;
                        Map      map = from.Map;

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

                        Point3D  p3d = new Point3D(p);
                        ItemData id  = TileData.ItemTable[this.m_ItemID & TileData.MaxItemValue];

                        if (map.CanFit(p3d, id.Height))
                        {
                            house = BaseHouse.FindHouseAt(p3d, map, id.Height);

                            if (house != null && house.IsCoOwner(from))
                            {
                                bool north = BaseAddon.IsWall(p3d.X, p3d.Y - 1, p3d.Z, map);
                                bool west  = BaseAddon.IsWall(p3d.X - 1, p3d.Y, p3d.Z, map);

                                if (north && west)
                                {
                                    from.CloseGump(typeof(FacingGump));
                                    from.SendGump(new FacingGump(this.m_Shield, this.m_ItemID, p3d, house));
                                }
                                else if (north || west)
                                {
                                    DecorativeShardShield shield = null;

                                    if (north)
                                    {
                                        shield = new DecorativeShardShield(GetSouthItemID(this.m_ItemID));
                                    }
                                    else if (west)
                                    {
                                        shield = new DecorativeShardShield(this.m_ItemID);
                                    }

                                    house.Addons[shield] = from;
                                    shield.MoveToWorld(p3d, map);

                                    this.m_Shield.Delete();
                                }
                                else
                                {
                                    from.SendLocalizedMessage(1049781); // This decoration must be placed next to a wall.
                                }
                            }
                            else
                            {
                                from.SendLocalizedMessage(1042036); // That location is not in your house.
                            }
                        }
                        else
                        {
                            from.SendLocalizedMessage(500269); // You cannot build that there.
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(502092); // You must be in your house to do this.
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1042038); // You must have the object in your backpack to use it.
                }
            }