예제 #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.
            }
        }
예제 #2
0
        public bool CouldFit(IPoint3D p, Map map)
        {
            if (!map.CanFit(p.X, p.Y, p.Z, this.ItemData.Height))
            {
                return(false);
            }

            if (this.ItemID == 0x232C)
            {
                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
            }
        }
예제 #3
0
        public bool CouldFit(IPoint3D p, Map map)
        {
            if (map == null || !map.CanFit(p.X, p.Y, p.Z, ItemData.Height))
            {
                return(false);
            }

            if (FacingSouth)
            {
                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
            }
        }
예제 #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 (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);
        }
예제 #5
0
            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.
                }
            }
예제 #6
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_Banner == null || m_Banner.Deleted)
                {
                    return;
                }

                if (m_Banner.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[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 (north && west)
                                {
                                    from.CloseGump(typeof(FacingGump));
                                    from.SendGump(new FacingGump(m_Banner, m_ItemID, p3d, house));
                                }
                                else if (north || west)
                                {
                                    Banner banner = null;

                                    if (north)
                                    {
                                        banner = new Banner(m_ItemID);
                                    }
                                    else if (west)
                                    {
                                        banner = new Banner(m_ItemID + 1);
                                    }

                                    house.Addons.Add(banner);

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

                                    m_Banner.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.
                }
            }
예제 #7
0
        public AddonFitResult CouldFit(IPoint3D p, Map map, Mobile from, ref BaseHouse 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);
                }
            }

            if (house != null)
            {
                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 (Utility.InRange(doorLoc, 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 (Utility.InRange(doorLoc, addonLo, 1) && (addonLo.Z == doorLoc.Z || ((addonLo.Z + addonHeigh) > doorLoc.Z && (doorLoc.Z + doorHeight) > addonLo.Z)))
                    {
                        return(AddonFitResult.DoorTooClose);
                    }
                }
            }

            return(AddonFitResult.Valid);
        }
예제 #8
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);

                                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)
                                {
                                    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.
                }
            }