Пример #1
0
        public virtual bool ValidateUse(Mobile from, bool message)
        {
            if (Deleted)
            {
                return(false);
            }

            if (!Movable && !Fillable)
            {
                IHouse house = HousingHelper.FindHouseAt(this);

                if (house == null || !house.IsLockedDown(this))
                {
                    if (message)
                    {
                        from.SendLocalizedMessage(502946, "", 0x59);                           // That belongs to someone else.
                    }

                    return(false);
                }
            }

            if (from.Map != Map || !from.InRange(GetWorldLocation(), 2) || !from.InLOS(this))
            {
                if (message)
                {
                    from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045);                       // I can't reach that.
                }

                return(false);
            }

            return(true);
        }
Пример #2
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.
            }
        }
Пример #3
0
        public override void OnDoubleClick(Mobile from)
        {
            if (m_IsRewardItem && !RewardSystem.CheckIsUsableBy(from, this, null))
            {
                return;
            }

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

                if (house != null && house.IsOwner(from))
                {
                    from.SendLocalizedMessage(1042264);                       // Where would you like to place this head?
                    from.Target = new InternalTarget(this);
                }
                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.
            }
        }
Пример #4
0
        public virtual bool CouldFit(IPoint3D p, Map map)
        {
            Point3D point = new Point3D(p.X, p.Y, p.Z);

            if (map == null || !map.CanFit(point, 20))
            {
                return(false);
            }

            var house = HousingHelper.FindHouseAt(point, map, 20);

            if (house == null)
            {
                return(false);
            }

            AddonFitResult result = CharacterStatueTarget.CheckDoors(point, 20, house);

            if (result == AddonFitResult.Valid)
            {
                return(true);
            }

            return(false);
        }
Пример #5
0
        public static bool ValidateDefault(Mobile from, BaseBoard board)
        {
            if (from.AccessLevel >= AccessLevel.GameMaster)
            {
                return(true);
            }

            if (!from.Alive)
            {
                return(false);
            }

            if (board.IsChildOf(from.Backpack))
            {
                return(true);
            }

            object root = board.RootParent;

            if (root is Mobile && root != from)
            {
                return(false);
            }

            if (board.Deleted || board.Map != from.Map || !from.InRange(board.GetWorldLocation(), 1))
            {
                return(false);
            }

            IHouse house = HousingHelper.FindHouseAt(board);

            return(house != null && house.IsOwner(from));
        }
Пример #6
0
        public override bool OnDragDropInto(Mobile from, Item item, Point3D p, byte gridloc)
        {
            if (!CheckHold(from, item, true, true))
            {
                return(false);
            }

            var house = HousingHelper.FindHouseAt(this);

            if (house != null && house.IsLockedDown(this))
            {
                if (item is VendorRentalContract || (item is Container && ((Container)item).FindItemByType(typeof(VendorRentalContract)) != null))
                {
                    from.SendLocalizedMessage(1062492);                       // You cannot place a rental contract in a locked down container.
                    return(false);
                }

                if (!house.LockDown(from, item, false))
                {
                    return(false);
                }
            }

            item.Location = new Point3D(p.X, p.Y, 0);
            item.SetGridLocation(gridloc, this);
            AddItem(item);

            from.SendSound(GetDroppedSound(item), GetWorldLocation());

            return(true);
        }
Пример #7
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);
            }
        }
Пример #8
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.
            }
        }
Пример #9
0
        public override void OnDoubleClick(Mobile from)
        {
            if (m_IsRewardItem && !RewardSystem.CheckIsUsableBy(from, this, null))
            {
                return;
            }

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

                if (house != null && house.IsOwner(from))
                {
                    from.CloseGump(typeof(InternalGump));
                    from.SendGump(new InternalGump(this));
                }
                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.
            }
        }
Пример #10
0
        public override void OnDoubleClick(Mobile from)
        {
            if (from.InRange(this.GetWorldLocation(), 1))
            {
                if (m_Placer == null || from == m_Placer || from.AccessLevel >= AccessLevel.GameMaster)
                {
                    from.AddToBackpack(new HolidayTreeDeed());

                    Delete();

                    var house = HousingHelper.FindHouseAt(this);

                    if (house != null && house.Addons.Contains(this))
                    {
                        house.Addons.Remove(this);
                    }

                    from.SendLocalizedMessage(503393);                       // A deed for the tree has been placed in your backpack.
                }
                else
                {
                    from.SendLocalizedMessage(503396);                       // You cannot take this tree down.
                }
            }
            else
            {
                from.SendLocalizedMessage(500446);                   // That is too far away.
            }
        }
Пример #11
0
        public static void OnLogin(LoginEventArgs e)
        {
            var house = HousingHelper.FindHouseAt(e.Mobile);

            if (house != null && !house.Public && !house.IsFriend(e.Mobile))
            {
                e.Mobile.Location = house.BanLocation;
            }
        }
Пример #12
0
        public override void OnDoubleClick(Mobile from)
        {
            if (IsChildOf(from.Backpack))
            {
                var house = HousingHelper.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.
            }
        }
Пример #13
0
        public void EndPlace(Mobile from, HolidayTreeType type, Point3D loc)
        {
            this.Delete();
            HolidayTree tree  = new HolidayTree(from, type, loc);
            var         house = HousingHelper.FindHouseAt(tree);

            if (house != null)
            {
                house.Addons.Add(tree);
            }
        }
Пример #14
0
        public override void OnDoubleClick(Mobile from)
        {
            if (!IsChildOf(from.Backpack))
            {
                from.SendLocalizedMessage(1042001);                   // That must be in your pack for you to use it.
            }
            else if (from.AccessLevel >= AccessLevel.GameMaster)
            {
                from.SendLocalizedMessage(503248);                   // Your godly powers allow you to place this vendor whereever you wish.

                Mobile v = new PlayerBarkeeper(from, HousingHelper.FindHouseAt(from));

                v.Direction = from.Direction & Direction.Mask;
                v.MoveToWorld(from.Location, from.Map);

                this.Delete();
            }
            else
            {
                var house = HousingHelper.FindHouseAt(from);

                if (house == null || !house.IsOwner(from))
                {
                    from.LocalOverheadMessage(MessageType.Regular, 0x3B2, false, "You are not the full owner of this house.");
                }
                else if (!house.CanPlaceNewBarkeep())
                {
                    from.SendLocalizedMessage(1062490);                       // That action would exceed the maximum number of barkeeps for this house.
                }
                else
                {
                    bool vendor, contract;
                    HousingHelper.IsThereVendor(from.Location, from.Map, out vendor, out contract);

                    if (vendor)
                    {
                        from.SendLocalizedMessage(1062677);                           // You cannot place a vendor or barkeep at this location.
                    }
                    else if (contract)
                    {
                        from.SendLocalizedMessage(1062678);                           // You cannot place a vendor or barkeep on top of a rental contract!
                    }
                    else
                    {
                        Mobile v = new PlayerBarkeeper(from, house);

                        v.Direction = from.Direction & Direction.Mask;
                        v.MoveToWorld(from.Location, from.Map);

                        this.Delete();
                    }
                }
            }
        }
Пример #15
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();
            }
        }
Пример #16
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);
        }
Пример #17
0
        public bool CheckAccess(Mobile m)
        {
            var house = HousingHelper.FindHouseAt(this);

            if (house != null && (house.Public ? house.IsBanned(m) : !house.HasAccess(m)))
            {
                return(false);
            }

            return(house != null && house.HasSecureAccess(m, m_Level));
        }
Пример #18
0
        public bool IsOwner(Mobile from)
        {
            if (from.AccessLevel >= AccessLevel.GameMaster)
            {
                return(true);
            }

            IHouse house = HousingHelper.FindHouseAt(this);

            return(house != null && house.IsOwner(from));
        }
Пример #19
0
        public override void OnDelete()
        {
            if (IsLockedDown)
            {
                var house = HousingHelper.FindHouseAt(this);

                if (house != null)
                {
                    house.VendorRentalContracts.Remove(this);
                }
            }
        }
Пример #20
0
        public override void OnDoubleClick(Mobile from)
        {
            if (IsLockedDown)
            {
                if (!from.InRange(this.Location, 2))
                {
                    from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045);                       // I can't reach that.
                    return;
                }

                IHouse house = HousingHelper.FindHouseAt(from);

                if (house != null)
                {
                    from.PublicOverheadMessage(MessageType.Regular, 0x3B2, 1071131);                       // Praying…

                    if (m_CooldownList.Contains(from))
                    {
                        from.SendLocalizedMessage(1071145);                           // In order to summon an undead again, you have to wait for at least 90 minutes.
                    }
                    else
                    {
                        Timer.DelayCall(TimeSpan.FromSeconds(5.0), new TimerCallback(
                                            delegate
                        {
                            // Add the skill mod
                            SkillMod mod = new DefaultSkillMod(SkillName.SpiritSpeak, true, 5.0);
                            mod.ObeyCap  = true;
                            from.AddSkillMod(mod);
                            m_Table[from] = new BonusContext(Timer.DelayCall(Duration, new TimerStateCallback <Mobile>(RemoveEffect), from), mod);

                            // Set the cooldown
                            m_CooldownList.Add(from);
                            Timer.DelayCall(Cooldown, new TimerCallback(delegate { m_CooldownList.Remove(from); }));

                            // Spawn our undead friend :)
                            SummonUndead(from);

                            from.SendLocalizedMessage(1071148);                                       // You feel a greater sense.
                        }));
                    }
                }
                else
                {
                    from.SendLocalizedMessage(502436);                       // That is not accessible.
                }
            }
            else
            {
                from.SendLocalizedMessage(502692);                   // This must be in a house and be locked down to work.
            }
        }
Пример #21
0
        public override void OnComponentUsed(AddonComponent c, Mobile from)
        {
            var house = HousingHelper.FindHouseAt(this);

            if (house != null && house.HasSecureAccess(from, SecureLevel.Friends))
            {
                if (m_Logs > 0)
                {
                    Item logs = null;

                    switch (Utility.Random(7))
                    {
                    case 0: logs = new Log(); break;

                    case 1: logs = new AshLog(); break;

                    case 2: logs = new OakLog(); break;

                    case 3: logs = new YewLog(); break;

                    case 4: logs = new HeartwoodLog(); break;

                    case 5: logs = new BloodwoodLog(); break;

                    case 6: logs = new FrostwoodLog(); break;
                    }

                    int amount = Math.Min(10, m_Logs);
                    logs.Amount = amount;

                    if (!from.PlaceInBackpack(logs))
                    {
                        logs.Delete();
                        from.SendLocalizedMessage(1078837);                           // Your backpack is full! Please make room and try again.
                    }
                    else
                    {
                        m_Logs -= amount;
                        PublicOverheadMessage(MessageType.Regular, 0, 1094719, m_Logs.ToString());                           // Logs: ~1_COUNT~
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1094720);                       // There are no more logs available.
                }
            }
            else
            {
                from.SendLocalizedMessage(1061637);                   // You are not allowed to access this.
            }
        }
Пример #22
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted == m_Decorator)
                {
                    m_Decorator.Command = DecorateCommand.None;
                    from.SendGump(new InternalGump(m_Decorator));
                }
                else if (targeted is Item && InteriorDecorator.CheckUse(m_Decorator, from))
                {
                    var  house = HousingHelper.FindHouseAt(from);
                    Item item  = (Item)targeted;

                    if (house == null || !house.IsCoOwner(from))
                    {
                        from.SendLocalizedMessage(502092);                           // You must be in your house to do this.
                    }
                    else if (item.Parent != null || !house.IsInside(item))
                    {
                        from.SendLocalizedMessage(1042270);                           // That is not in your house.
                    }
                    else if (!house.IsLockedDown(item) && !house.IsSecure(item))
                    {
                        from.SendLocalizedMessage(1042271);                           // That is not locked down.
                    }
                    else if (item is VendorRentalContract)
                    {
                        from.SendLocalizedMessage(1062491);                           // You cannot use the house decorator on that object.
                    }
                    else if (item.TotalWeight + item.PileWeight > 100)
                    {
                        from.SendLocalizedMessage(1042272);                           // That is too heavy.
                    }
                    else
                    {
                        switch (m_Decorator.Command)
                        {
                        case DecorateCommand.Up:
                            Up(item, from);
                            break;

                        case DecorateCommand.Down:
                            Down(item, from);
                            break;

                        case DecorateCommand.Turn:
                            Turn(item, from);
                            break;
                        }
                    }
                }
            }
Пример #23
0
        public bool IsLandlord(Mobile m)
        {
            if (IsLockedDown)
            {
                var house = HousingHelper.FindHouseAt(this);

                if (house != null && house.DecayType != DecayType.Condemned)
                {
                    return(house.IsOwner(m));
                }
            }

            return(false);
        }
Пример #24
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));
                }
            }
        }
Пример #25
0
        public IHouse FindHouse()
        {
            Point3D loc;

            if (Open)
            {
                loc = new Point3D(X - Offset.X, Y - Offset.Y, Z - Offset.Z);
            }
            else
            {
                loc = this.Location;
            }

            return(HousingHelper.FindHouseAt(loc, Map, 20));
        }
Пример #26
0
        public bool CheckAccess(Mobile m)
        {
            if (!IsLockedDown || m.AccessLevel >= AccessLevel.GameMaster)
            {
                return(true);
            }

            IHouse house = HousingHelper.FindHouseAt(this);

            if (house != null && (house.Public ? house.IsBanned(m) : !house.HasAccess(m)))
            {
                return(false);
            }

            return(house != null && house.HasSecureAccess(m, m_Level));
        }
Пример #27
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.
                }
            }
        }
Пример #28
0
        public override void OnDoubleClick(Mobile from)
        {
            if (Offeree != null)
            {
                from.SendLocalizedMessage(1062343);                   // That item is currently in use.
            }
            else if (!IsLockedDown)
            {
                if (!IsChildOf(from.Backpack))
                {
                    from.SendLocalizedMessage(1062334);                       // This item must be in your backpack to be used.
                    return;
                }

                var house = HousingHelper.FindHouseAt(from);

                if (house == null || !house.IsOwner(from))
                {
                    from.SendLocalizedMessage(1062333);                       // You must be standing inside of a house that you own to make use of this contract.
                }
                else if (!house.Public)
                {
                    from.SendLocalizedMessage(1062335);                       // Rental contracts can only be placed in public houses.
                }
                else if (!house.CanPlaceNewVendor())
                {
                    from.SendLocalizedMessage(1062352);                       // You do not have enought storage available to place this contract.
                }
                else
                {
                    from.SendLocalizedMessage(1062337);                       // Target the exact location you wish to rent out.
                    from.Target = new RentTarget(this);
                }
            }
            else if (IsLandlord(from))
            {
                if (from.InRange(this, 5))
                {
                    from.CloseGump <VendorRentalContractGump>();
                    from.SendGump(new VendorRentalContractGump(this, from));
                }
                else
                {
                    from.SendLocalizedMessage(501853);                       // Target is too far away.
                }
            }
        }
Пример #29
0
        public void Mark(Mobile m)
        {
            m_Marked = true;

            m_House = HousingHelper.FindHouseAt(m);

            if (m_House == null)
            {
                m_Target    = m.Location;
                m_TargetMap = m.Map;
            }
            else
            {
                HouseSign sign = m_House.Sign;

                if (sign != null)
                {
                    m_Description = sign.Name;
                }
                else
                {
                    m_Description = null;
                }

                if (m_Description == null || (m_Description = m_Description.Trim()).Length == 0)
                {
                    m_Description = "an unnamed house";
                }

                int x = m_House.BanLocation.X;
                int y = m_House.BanLocation.Y + 2;
                int z = m_House.BanLocation.Z;

                Map map = m_House.Map;

                if (map != null && !map.CanFit(x, y, z, 16, false, false))
                {
                    z = map.GetAverageZ(x, y);
                }

                m_Target    = new Point3D(x, y, z);
                m_TargetMap = map;
            }

            UpdateHue();
            InvalidateProperties();
        }
Пример #30
0
        public override void OnDoubleClick(Mobile from)
        {
            var house = HousingHelper.FindHouseAt(this);

            if (house == null || !house.IsLockedDown(this))
            {
                from.SendLocalizedMessage(1062396);                   // This bulletin board must be locked down in a house to be usable.
            }
            else if (!from.InRange(this.GetWorldLocation(), 2) || !from.InLOS(this))
            {
                from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045);                   // I can't reach that.
            }
            else if (CheckAccess(house, from))
            {
                from.SendGump(new PlayerBBGump(from, house, this, 0));
            }
        }