Пример #1
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);
        }
Пример #2
0
        public void Target(LockableContainer targ)
        {
            if (HousingHelper.CheckLockedDownOrSecured(targ))
            {
                // You cannot cast this on a locked down item.
                Caster.LocalOverheadMessage(MessageType.Regular, 0x22, 501761);
            }
            else if (targ.Locked || targ.LockLevel == 0 || targ is ParagonChest)
            {
                // Target must be an unlocked chest.
                Caster.SendLocalizedMessage(501762);
            }
            else if (CheckSequence())
            {
                SpellHelper.Turn(Caster, targ);

                Point3D loc = targ.GetWorldLocation();

                Effects.SendLocationParticles(
                    EffectItem.Create(loc, targ.Map, EffectItem.DefaultDuration),
                    0x376A, 9, 32, 5020);

                Effects.PlaySound(loc, targ.Map, 0x1FA);

                // The chest is now locked!
                Caster.LocalOverheadMessage(MessageType.Regular, 0x3B2, 501763);

                targ.LockLevel = -255;                 // signal magic lock
                targ.Locked    = true;
            }

            FinishSequence();
        }
Пример #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 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 <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.
            }
        }
Пример #5
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);
        }
Пример #6
0
        public override bool CheckHold(Mobile m, Item item, bool message, bool checkItems, int plusItems, int plusWeight)
        {
            if (this.IsSecure && !HousingHelper.CheckHold(m, this, item, message, checkItems, plusItems, plusWeight))
            {
                return(false);
            }

            return(base.CheckHold(m, item, message, checkItems, plusItems, plusWeight));
        }
Пример #7
0
        public override bool IsAccessibleTo(Mobile m)
        {
            if (!HousingHelper.CheckAccessible(m, this))
            {
                return(false);
            }

            return(base.IsAccessibleTo(m));
        }
Пример #8
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;
            }
        }
Пример #9
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.
            }
        }
Пример #10
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);
        }
Пример #11
0
        public bool IsOwner(Mobile from)
        {
            if (from.AccessLevel >= AccessLevel.GameMaster)
            {
                return(true);
            }

            IHouse house = HousingHelper.FindHouseAt(this);

            return(house != null && house.IsOwner(from));
        }
Пример #12
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();
            }
        }
Пример #13
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();
                    }
                }
            }
        }
Пример #14
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));
        }
Пример #15
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);
            }
        }
Пример #16
0
        public void Target(LockableContainer targ)
        {
            if (HousingHelper.CheckSecured(targ))
            {
                // You cannot cast this on a secure item.
                Caster.SendLocalizedMessage(503098);
            }
            else if (CheckSequence())
            {
                SpellHelper.Turn(Caster, targ);

                Point3D loc = targ.GetWorldLocation();

                Effects.SendLocationParticles(
                    EffectItem.Create(loc, targ.Map, EffectItem.DefaultDuration),
                    0x376A, 9, 32, 5024);

                Effects.PlaySound(loc, targ.Map, 0x1FF);

                if (targ.Locked && targ.LockLevel != 0)
                {
                    double magery = Caster.Skills[SkillName.Magery].Value;
                    int    level  = (int)(magery * 0.8) - 4;

                    if (level >= targ.RequiredSkill && !(targ is TreasureMapChest && ((TreasureMapChest)targ).Level > 2))
                    {
                        targ.Locked = false;

                        if (targ.LockLevel == -255)
                        {
                            targ.LockLevel = targ.RequiredSkill - 10;
                        }

                        if (targ.LockLevel == 0)
                        {
                            targ.LockLevel = -1;
                        }
                    }
                    else
                    {
                        // My spell does not seem to have an effect on that lock.
                        Caster.LocalOverheadMessage(MessageType.Regular, 0x3B2, 503099);
                    }
                }
                else
                {
                    // That did not need to be unlocked.
                    Caster.LocalOverheadMessage(MessageType.Regular, 0x3B2, 503101);
                }
            }

            FinishSequence();
        }
Пример #17
0
        public override void OnDelete()
        {
            if (IsLockedDown)
            {
                var house = HousingHelper.FindHouseAt(this);

                if (house != null)
                {
                    house.VendorRentalContracts.Remove(this);
                }
            }
        }
Пример #18
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.
            }
        }
Пример #19
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.
            }
        }
Пример #20
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;
                        }
                    }
                }
            }
Пример #21
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));
                }
            }
        }
Пример #22
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);
        }
Пример #23
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));
        }
Пример #24
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.
                }
            }
        }
Пример #25
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));
        }
Пример #26
0
        public override void OnResponse(GameClient sender, RelayInfo info)
        {
            Mobile from = sender.Mobile;

            if (info.ButtonID == 0 || !m_House.IsInside(from) || !m_House.IsOwner(from) || !from.CheckAlive())
            {
                return;
            }

            int index = info.ButtonID - 1;

            if (index < 0 || index >= m_Vendors.Count)
            {
                return;
            }

            Mobile mob = (Mobile)m_Vendors[index];

            if (!m_House.InternalizedVendors.Contains(mob))
            {
                return;
            }

            if (mob.Deleted)
            {
                m_House.InternalizedVendors.Remove(mob);
            }
            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
                {
                    m_House.InternalizedVendors.Remove(mob);
                    mob.MoveToWorld(from.Location, from.Map);
                }
            }
        }
Пример #27
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();
        }
Пример #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 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.
                }
            }
        }
Пример #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));
            }
        }