Ejemplo n.º 1
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);

            IHouse house = HousingHelper.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)
                {
                    from.SendGump(new WreathDeedGump(from, loc, this));
                }
                else
                {
                    PlaceAddon(from, loc, northWall, westWall);
                }
            }
            else
            {
                from.SendLocalizedMessage(1042036);                   // That location is not in your house.
            }
        }
Ejemplo n.º 2
0
        public virtual bool Dye(Mobile from, IDyeTub sender)
        {
            if (Deleted)
            {
                return(false);
            }

            IHouse house = HousingHelper.FindHouseAt(this);

            if (house != null && house.IsCoOwner(from))
            {
                if (from.InRange(GetWorldLocation(), 1))
                {
                    Hue = sender.DyedHue;
                    return(true);
                }
                else
                {
                    from.SendLocalizedMessage(500295);                       // You are too far away to do that.
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 3
0
        public override void OnDoubleClick(Mobile from)
        {
            if (IsLockedDown)
            {
                IHouse house = HousingHelper.FindHouseAt(from);

                if (house != null && house.IsCoOwner(from))
                {
                    if (m_Fire != null)
                    {
                        TurnOff();
                    }
                    else
                    {
                        TurnOn();
                    }
                }
                else
                {
                    from.SendLocalizedMessage(502436);                       // That is not accessible.
                }
            }
            else
            {
                from.SendLocalizedMessage(502692);                   // This must be in a house and be locked down to work.
            }
        }
Ejemplo n.º 4
0
        public static bool CheckHouse(Mobile from, Point3D p, Map map, int height, ref IHouse house)
        {
            house = HousingHelper.FindHouseAt(p, map, height);

            if (from == null || house == null || !(house.IsOwner(from) || house.IsCoOwner(from)))
            {
                return(false);
            }

            return(true);
        }
Ejemplo n.º 5
0
        public void OnChop(Mobile from)
        {
            IHouse house = HousingHelper.FindHouseAt(from);

            if (house != null && house.IsCoOwner(from))
            {
                Effects.PlaySound(Location, Map, 0x11C);
                from.SendLocalizedMessage(500461);                   // You destroy the item.
                Destroy();
            }
        }
Ejemplo n.º 6
0
        public override void GetContextMenuEntries(Mobile from, List <ContextMenuEntry> list)
        {
            base.GetContextMenuEntries(from, list);

            if (from.Alive && m_SculptedBy != null)
            {
                IHouse house = HousingHelper.FindHouseAt(this);

                if ((house != null && house.IsCoOwner(from)) || (int)from.AccessLevel > (int)AccessLevel.Counselor)
                {
                    list.Add(new DemolishEntry(this));
                }
            }
        }
Ejemplo n.º 7
0
        public override void OnDoubleClick(Mobile from)
        {
            IHouse house = HousingHelper.FindHouseAt(this);

            if (house != null && house.IsCoOwner(from))
            {
                if (from.InRange(this.GetWorldLocation(), 3))
                {
                    from.SendGump(new WreathAddonGump(from, this));
                }
                else
                {
                    from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045);                       // I can't reach that.
                }
            }
        }
Ejemplo n.º 8
0
        public override void OnDoubleClick(Mobile from)
        {
            IHouse house = HousingHelper.FindHouseAt(this);

            if (house != null && house.IsCoOwner(from))
            {
                if (from.InRange(GetWorldLocation(), 1))
                {
                    from.AddToBackpack(this.Deed);
                    Delete();
                }
                else
                {
                    from.SendLocalizedMessage(500295);                       // You are too far away to do that.
                }
            }
        }
Ejemplo n.º 9
0
        private void PlaceAddon(Mobile from, Point3D loc, bool northWall, bool westWall)
        {
            if (Deleted)
            {
                return;
            }

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

            if (house == null || !house.IsCoOwner(from))
            {
                from.SendLocalizedMessage(1042036);                   // That location is not in your house.
                return;
            }

            int itemID = 0;

            if (northWall)
            {
                itemID = 0x232C;
            }
            else if (westWall)
            {
                itemID = 0x232D;
            }
            else
            {
                from.SendLocalizedMessage(1062840);                   // The decoration must be placed next to a wall.
            }

            if (itemID > 0)
            {
                Item addon = new WreathAddon(this.Hue);

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

                house.Addons.Add(addon);
                Delete();
            }
        }
Ejemplo n.º 10
0
        public override void OnDoubleClick(Mobile from)
        {
            if (IsChildOf(from.Backpack))
            {
                IHouse house = HousingHelper.FindHouseAt(from);

                if (house != null && house.IsCoOwner(from))
                {
                    from.SendLocalizedMessage(1062838);                       // Where would you like to place this decoration?
                    from.BeginTarget(-1, true, TargetFlags.None, new TargetStateCallback(Placement_OnTarget), null);
                }
                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.
            }
        }
Ejemplo n.º 11
0
        public virtual void ExamineAquarium(Mobile from)
        {
            if (!from.InRange(this, 2))
            {
                from.Say(1019045);                   // I can't reach that.
                return;
            }

            IHouse house = HousingHelper.FindHouseAt(this);

            from.CloseGump(typeof(AquariumGump));

            if (house != null && house.IsCoOwner(from))
            {
                from.SendGump(new AquariumGump(this, true));
            }
            else
            {
                from.SendGump(new AquariumGump(this, false));
            }

            from.PlaySound(0x5A4);
        }
Ejemplo n.º 12
0
        public static bool InHouse(Mobile from)
        {
            IHouse house = HousingHelper.FindHouseAt(from);

            return(house != null && house.IsCoOwner(from));
        }
Ejemplo n.º 13
0
        public override bool OnDragDrop(Mobile from, Item dropped)
        {
            IHouse house = HousingHelper.FindHouseAt(this);

            if (house == null || !house.IsCoOwner(from))
            {
                from.SendLocalizedMessage(1073821);                   // You do not have access to that item for use with the aquarium.
                return(false);
            }

            if (m_VacationLeft > 0)
            {
                from.SendLocalizedMessage(1074427);                   // The aquarium is in vacation mode.
                return(false);
            }

            if (dropped is FishBowl)
            {
                FishBowl bowl = (FishBowl)dropped;

                if (bowl.Empty)
                {
                    return(false);
                }

                if (AddFish(from, bowl.Fish))
                {
                    bowl.InvalidateProperties();
                }

                return(false);
            }
            else if (dropped is BaseFish)
            {
                BaseFish fish = (BaseFish)dropped;

                if (!AddFish(from, fish))
                {
                    return(false);
                }
            }
            else if (dropped is VacationWafer)
            {
                m_VacationLeft += 7;
                ((Item)dropped).Delete();

                from.SendLocalizedMessage(1074428, "" + m_VacationLeft);                   // The aquarium will be in vacation mode for ~1_DAYS~ days
            }
            else if (dropped is AquariumFood)
            {
                m_Food.Added += 1;
                ((Item)dropped).Delete();

                from.SendLocalizedMessage(1074259, "" + 1);                   // ~1_NUM~ unit(s) of food have been added to the aquarium.
            }
            else if (dropped is BaseBeverage)
            {
                BaseBeverage beverage = (BaseBeverage)dropped;

                if (beverage.IsEmpty || !beverage.Pourable || beverage.Content != BeverageType.Water)
                {
                    from.SendLocalizedMessage(500840);                       // Can't pour that in there.
                    return(false);
                }

                m_Water.Added     += 1;
                beverage.Quantity -= 1;

                from.PlaySound(0x4E);
                from.SendLocalizedMessage(1074260, "1");                   // ~1_NUM~ unit(s) of water have been added to the aquarium.

                return(false);
            }
            else if (!AddDecoration(from, dropped))
            {
                return(false);
            }

            InvalidateProperties();

            from.CloseGump(typeof(AquariumGump));

            return(true);
        }
Ejemplo n.º 14
0
        public static bool CheckHouse( Mobile from, Point3D p, Map map, int height, ref IHouse house )
        {
            house = HousingHelper.FindHouseAt( p, map, height );

            if ( from == null || house == null || !( house.IsOwner( from ) || house.IsCoOwner( from ) ) )
                return false;

            return true;
        }