Пример #1
0
        public static bool HasAccess(Mobile mob, Item item)
        {
            if (item == mob.Backpack)
                return false;
            else if (mob.AccessLevel >= AccessLevel.GameMaster) // staff have no limits
                return true;
            else if (item.IsChildOf(mob.Backpack))
                return true;
            else if (item.IsChildOf(mob.BankBox))
                return true;
            else if (CheckHouse(mob, item))
                return true;

            return false;
        }
Пример #2
0
            private void DismantleItem(Mobile from, Item item)
            {
                if (!from.InRange(item.GetWorldLocation(), 2))
                {
                    from.SendMessage("You need to be closer to it.");
                    return;
                }
                else if (!item.IsChildOf(from.Backpack) && !item.Movable)
                {
                    from.SendMessage("It can't be dismantled.");
                    return;
                }

                from.SendMessage("You dismantle the object.");
                Effects.PlaySound(item.GetWorldLocation(), item.Map, 0x3B3);

                if (item is Container)
                {
                    if (item is TrapableContainer)
                        (item as TrapableContainer).ExecuteTrap(from);

                    ((Container)item).Destroy();
                }
                else
                {
                    item.Delete();
                }
            }
Пример #3
0
		private void DestroyFurniture( Mobile from, Item item )
		{
			if ( !from.InRange( item.GetWorldLocation(), 3 ) )
			{
				from.SendLocalizedMessage( 500446 ); // That is too far away.
				return;
			}
			else if ( !item.IsChildOf( from.Backpack ) && !item.Movable )
			{
				from.SendLocalizedMessage( 500462 ); // You can't destroy that while it is here.
				return;
			}

			from.SendLocalizedMessage( 500461 ); // You destroy the item.
			Effects.PlaySound( item.GetWorldLocation(), item.Map, 0x3B3 );

			if ( item is Container )
			{
				if ( item is TrapableContainer )
					(item as TrapableContainer).ExecuteTrap( from );

				((Container)item).Destroy();
			}
			else
			{
				item.Delete();
			}
		}
Пример #4
0
        public static void DoTrash(Mobile from, Item target)
        {
            Item item = from.Backpack.FindItemByType(typeof (MiniRewardCan), true);

            if (!target.IsChildOf(from.Backpack))
            {
                from.SendAsciiMessage(mNotInBackpack);
            }
            else if (item == null || !(item is MiniRewardCan))
            {
                from.SendAsciiMessage(mNoTrashCan);
            }
            else
            {
                item.OnDragDrop(from, target);
            }
        }
Пример #5
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                Item  item  = targeted as Item;
                Arrow arrow = targeted as Arrow;
                Bolt  bolt  = targeted as Bolt;

                if (targeted is PlayerMobile || targeted is BaseCreature)
                {
                    from.SendMessage("You cannot target that.");
                }

                if (targeted != null && targeted is Arrow)
                {
                    if (it_Tub != null)
                    {
                        if (!(item.IsChildOf(from.Backpack)))
                        {
                            from.SendMessage("This must be in your backpack.");
                        }
                        else if (item.IsChildOf(from.Backpack) && arrow.Amount == 20)
                        {
                            from.SendMessage("You carefully apply the explosive material to your bundle of arrows.");

                            it_Tub.Charges--;
                            arrow.Consume(20);
                            //Note: pack.ConsumeTotal( typeof(Arrow), 20 )
                            from.AddToBackpack(new ExplosiveArrow(20));
                        }
                        else if (targeted != null && arrow.Amount != 20)
                        {
                            from.SendMessage("You must use a bundle of 20 at a time.");
                        }
                    }
                    else
                    {
                        return;
                    }
                }
                else if (targeted != null && targeted is Bolt)
                {
                    if (it_Tub != null)
                    {
                        if (!(item.IsChildOf(from.Backpack)))
                        {
                            from.SendMessage("This must be in your backpack.");
                        }
                        else if (item.IsChildOf(from.Backpack) && bolt.Amount == 20)
                        {
                            from.SendMessage("You carefully apply the explosive material to your bundle of bolts.");

                            it_Tub.Charges--;
                            bolt.Consume(20);
                            //Note: pack.ConsumeTotal( typeof(Bolt), 20 )
                            from.AddToBackpack(new ExplosiveBolt(20));
                        }
                        else if (targeted != null && bolt.Amount != 20)
                        {
                            from.SendMessage("You must use a bundle of 20 bolts at a time.");
                        }
                    }
                    else
                    {
                        return;
                    }
                }
                else
                {
                    from.SendMessage("You must target a bundle of 20.");
                }
            }
Пример #6
0
		private void DestroyFurniture( Mobile from, Item item )
		{
			if ( !from.InRange( item.GetWorldLocation(), 3 ) || !from.InLOS(item) )
			{
                from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
				return;
			}
		    if ( !item.IsChildOf( from.Backpack ) && !item.Movable )
		    {
		        from.SendLocalizedMessage( 500462 ); // You can't destroy that while it is here.
		        return;
		    }

		    from.SendLocalizedMessage( 500461 ); // You destroy the item.
			Effects.PlaySound( item.GetWorldLocation(), item.Map, 0x3B3 );

			if ( item is Container )
			{
				if ( item is TrapableContainer )
					(item as TrapableContainer).ExecuteTrap( from );

				((Container)item).Destroy();
			}
			else
			{
				item.Delete();
			}
		}
            public void TryDrop(Mobile from, Item dropped)
            {
                if (!m_Box.CheckAccessible(from, m_Box))
                {
                    from.SendLocalizedMessage(1061637);                     // You are not allowed to access this.
                }
                else if (!dropped.IsChildOf(from.Backpack))
                {
                    from.SendLocalizedMessage(1157726);                     // You must be carrying the item to add it to the jewelry box.
                    return;
                }
                else if (m_Box.IsAccept(dropped))
                {
                    if (m_Box.IsFull)
                    {
                        from.SendLocalizedMessage(1157723);                         // The jewelry box is full.
                    }
                    else
                    {
                        m_Box.DropItem(dropped);
                        from.Target = new InternalTarget(from, m_Box, m_Page);
                    }
                }
                else if (dropped is Container)
                {
                    Container c = dropped as Container;

                    int count = 0;

                    for (int i = c.Items.Count - 1; i >= 0; --i)
                    {
                        if (i < c.Items.Count && m_Box.IsAccept(c.Items[i]))
                        {
                            if (m_Box.IsFull)
                            {
                                from.SendLocalizedMessage(1157723);                                 // The jewelry box is full.
                                break;
                            }
                            else
                            {
                                m_Box.DropItem(c.Items[i]);
                                count++;
                            }
                        }
                    }

                    if (count > 0)
                    {
                        from.CloseGump(typeof(JewelryBoxGump));
                        from.SendGump(new JewelryBoxGump(from, m_Box, m_Page));
                    }
                    else
                    {
                        from.SendLocalizedMessage(1157724);                         // This is not a ring, bracelet, necklace, earring, or talisman.
                        from.SendGump(new JewelryBoxGump(from, m_Box, m_Page));
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1157724);                     // This is not a ring, bracelet, necklace, earring, or talisman.
                    from.SendGump(new JewelryBoxGump(from, m_Box, m_Page));
                }
            }
Пример #8
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted is Item)
                {
                    Item item = (Item)targeted;

                    if (item.QuestItem)
                    {
                        from.SendLocalizedMessage(1151836); // You may not dye toggled quest items.
                    }
                    else if (item is IDyable && m_Tub.AllowDyables)
                    {
                        if (!from.InRange(m_Tub.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1))
                        {
                            from.SendLocalizedMessage(500446);                               // That is too far away.
                        }
                        else if (item.Parent is Mobile)
                        {
                            from.SendLocalizedMessage(500861);                               // Can't Dye clothing that is being worn.
                        }
                        else if (((IDyable)item).Dye(from, m_Tub))
                        {
                            from.PlaySound(0x23E);
                            m_Tub.Charges--;
                            m_Tub.CheckEmpty();
                        }
                    }
                    else if ((FurnitureAttribute.Check(item) || (item is PotionKeg)) && m_Tub.AllowFurniture)
                    {
                        if (!from.InRange(m_Tub.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1))
                        {
                            from.SendLocalizedMessage(500446);                               // That is too far away.
                        }
                        else
                        {
                            bool okay = (item.IsChildOf(from.Backpack));

                            if (!okay)
                            {
                                if (item.Parent == null)
                                {
                                    BaseHouse house = BaseHouse.FindHouseAt(item);

                                    // Scriptiz : ajout pour rendre les addon furniture dyable  && !(item is AddonComponent)
                                    if (house == null || (!house.IsLockedDown(item) && !house.IsSecure(item) && !(item is AddonComponent)))
                                    {
                                        from.SendLocalizedMessage(501022);                                           // Furniture must be locked down to paint it.
                                    }
                                    else if (!house.IsCoOwner(from))
                                    {
                                        from.SendLocalizedMessage(501023);                                           // You must be the owner to use this item.
                                    }
                                    else
                                    {
                                        okay = true;
                                    }
                                }
                                else
                                {
                                    from.SendLocalizedMessage(1048135);                                       // The furniture must be in your backpack to be painted.
                                }
                            }

                            if (okay)
                            {
                                item.Hue = m_Tub.DyedHue;
                                from.PlaySound(0x23E);
                                m_Tub.Charges--;
                                m_Tub.CheckEmpty();
                            }
                        }
                    }
                    else if ((item is Runebook || item is RecallRune) && m_Tub.AllowRunebooks)
                    {
                        if (!from.InRange(m_Tub.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1))
                        {
                            from.SendLocalizedMessage(500446);                               // That is too far away.
                        }
                        else if (!item.Movable)
                        {
                            from.SendLocalizedMessage(1049776);                               // You cannot dye runes or runebooks that are locked down.
                        }
                        else
                        {
                            item.Hue = m_Tub.DyedHue;
                            from.PlaySound(0x23E);
                            m_Tub.Charges--;
                            m_Tub.CheckEmpty();
                        }
                    }
                    else if (item is MonsterStatuette && m_Tub.AllowStatuettes)
                    {
                        if (!from.InRange(m_Tub.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1))
                        {
                            from.SendLocalizedMessage(500446);                               // That is too far away.
                        }
                        else if (!item.Movable)
                        {
                            from.SendLocalizedMessage(1049779);                               // You cannot dye statuettes that are locked down.
                        }
                        else
                        {
                            item.Hue = m_Tub.DyedHue;
                            from.PlaySound(0x23E);
                            m_Tub.Charges--;
                            m_Tub.CheckEmpty();
                        }
                    }
                    else if ((item is BaseArmor && (((BaseArmor)item).MaterialType == ArmorMaterialType.Leather || ((BaseArmor)item).MaterialType == ArmorMaterialType.Studded) || item is ElvenBoots || item is WoodlandBelt) && m_Tub.AllowLeather)
                    {
                        if (!from.InRange(m_Tub.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1))
                        {
                            from.SendLocalizedMessage(500446);                               // That is too far away.
                        }
                        else if (!item.Movable)
                        {
                            from.SendLocalizedMessage(1042419);                               // You may not dye leather items which are locked down.
                        }
                        else if (item.Parent is Mobile)
                        {
                            from.SendLocalizedMessage(500861);                               // Can't Dye clothing that is being worn.
                        }
                        else
                        {
                            item.Hue = m_Tub.DyedHue;
                            from.PlaySound(0x23E);
                            m_Tub.Charges--;
                            m_Tub.CheckEmpty();
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(m_Tub.FailMessage);
                    }
                }
                else
                {
                    from.SendLocalizedMessage(m_Tub.FailMessage);
                }
            }
Пример #9
0
        public virtual void Open(Mobile from, bool checkSelfLoot)
        {
            if (from.IsStaff() || from.InRange(GetWorldLocation(), 2))
            {
                #region Self Looting
                bool selfLoot = (checkSelfLoot && (from == m_Owner));

                if (selfLoot)
                {
                    var items = new List <Item>(Items);

                    bool gathered = false;

                    for (int k = 0; k < EquipItems.Count; ++k)
                    {
                        Item item2 = EquipItems[k];

                        if (!items.Contains(item2) && item2.IsChildOf(from.Backpack))
                        {
                            items.Add(item2);
                            gathered = true;
                        }
                    }

                    bool didntFit = false;

                    Container pack = from.Backpack;

                    bool checkRobe = true;

                    for (int i = 0; !didntFit && i < items.Count; ++i)
                    {
                        Item    item = items[i];
                        Point3D loc  = item.Location;

                        if ((item.Layer == Layer.Hair || item.Layer == Layer.FacialHair) || !item.Movable)
                        {
                            continue;
                        }

                        if (checkRobe)
                        {
                            DeathRobe robe = from.FindItemOnLayer(Layer.OuterTorso) as DeathRobe;

                            if (robe != null)
                            {
                                if (Core.SA)
                                {
                                    robe.Delete();
                                }
                                else
                                {
                                    Map map = from.Map;

                                    if (map != null && map != Map.Internal)
                                    {
                                        robe.MoveToWorld(from.Location, map);
                                    }
                                }
                            }
                        }

                        if (m_EquipItems.Contains(item) && from.EquipItem(item))
                        {
                            gathered = true;
                        }
                        else if (pack != null && pack.CheckHold(from, item, false, true))
                        {
                            item.Location = loc;
                            pack.AddItem(item);
                            gathered = true;
                        }
                        else
                        {
                            didntFit = true;
                        }
                    }

                    if (gathered && !didntFit)
                    {
                        SetFlag(CorpseFlag.Carved, true);

                        if (ItemID == 0x2006)
                        {
                            ProcessDelta();
                            SendRemovePacket();
                            ItemID = Utility.Random(0xECA, 9);                             // bone graphic
                            Hue    = 0;
                            ProcessDelta();
                        }

                        from.PlaySound(0x3E3);
                        from.SendLocalizedMessage(1062471);                         // You quickly gather all of your belongings.
                        items.Clear();
                        m_EquipItems.Clear();
                        return;
                    }

                    if (gathered && didntFit)
                    {
                        from.SendLocalizedMessage(1062472);                         // You gather some of your belongings. The rest remain on the corpse.
                    }
                }
                #endregion

                if (!CheckLoot(from, null))
                {
                    return;
                }

                base.OnDoubleClick(from);
            }
            else
            {
                from.SendLocalizedMessage(500446);                 // That is too far away.
                return;
            }
        }
Пример #10
0
        public override void OnHit(Mobile attacker, Mobile defender, int damage)
        {
            if (!Validate(attacker))
            {
                return;
            }

            ClearCurrentAbility(attacker);

            if (IsImmune(defender))
            {
                attacker.SendLocalizedMessage(1111827); // Your opponent is gripping their weapon too tightly to be disarmed.
                defender.SendLocalizedMessage(1111828); // You will not be caught off guard by another disarm attack for some time.
                return;
            }

            Item toDisarm = defender.FindItemOnLayer(Layer.OneHanded);

            if (toDisarm == null || !toDisarm.Movable)
            {
                toDisarm = defender.FindItemOnLayer(Layer.TwoHanded);
            }

            Container pack = defender.Backpack;

            if (pack == null || toDisarm != null && !toDisarm.Movable)
            {
                attacker.SendLocalizedMessage(1004001); // You cannot disarm your opponent.
            }
            else if (toDisarm == null || toDisarm is BaseShield)
            {
                attacker.SendLocalizedMessage(1060849); // Your target is already unarmed!
            }
            else if (CheckMana(attacker, true))
            {
                attacker.SendLocalizedMessage(1060092); // You disarm their weapon!
                defender.SendLocalizedMessage(1060093); // Your weapon has been disarmed!

                defender.PlaySound(0x3B9);
                defender.FixedParticles(0x37BE, 232, 25, 9948, EffectLayer.LeftHand);

                pack.DropItem(toDisarm);

                BuffInfo.AddBuff(defender, new BuffInfo(BuffIcon.NoRearm, 1075637, BlockEquipDuration, defender));

                BaseWeapon.BlockEquip(defender, BlockEquipDuration);

                if (defender is BritannianInfantry)
                {
                    Timer.DelayCall(BlockEquipDuration + TimeSpan.FromSeconds(Utility.RandomMinMax(3, 10)), () =>
                    {
                        if (toDisarm != null && !toDisarm.Deleted && toDisarm.IsChildOf(defender.Backpack))
                        {
                            defender.EquipItem(toDisarm);
                        }
                    });
                }

                AddImmunity(defender, attacker.Weapon is Fists ? TimeSpan.FromSeconds(10) : TimeSpan.FromSeconds(15));
            }
        }
Пример #11
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted is Item)
                {
                    Item item = (Item)targeted;

                    if (/*item is CarpetColor || */ item is SpecialFishingNet)
                    {
                        from.SendMessage("That item cannot be dyed.");
                    }
                    else if (item is AddonComponent)
                    {
                        AddonComponent component = (AddonComponent)targeted;

                        if (component.Addon is DyeRack)
                        {
                            if (m_Tub.DyedHue < 1059)
                            {
                                from.SendMessage("This hue cannot be added to rack");
                            }
                            else
                            {
                                if (m_Tub.Charged)
                                {
                                    from.PlaySound(0x23F);
                                    from.FixedParticles(14120, 10, 15, 5011, m_Tub.DyedHue, 5, EffectLayer.Waist);

                                    ((DyeRack)component.Addon).AcquireDye(m_Tub.DyedHue, m_Tub.Charges);
                                    from.SendMessage("Hue has been added to rack with number {0}", m_Tub.DyedHue);

                                    m_Tub.Delete();
                                }
                            }
                        }
                        else
                        {
                            from.SendMessage("That item cannot be dyed.");
                        }
                    }
                    else if (FurnitureAttribute.Check(item) || item is BaseTalisman || item is BaseArmor || item is BaseWeapon || item is IDyable || item is MonsterStatuette || item is EtherealMount || item is Spellbook || item is Runebook || item is RecallRune)
                    {
                        if (!item.IsChildOf(from.Backpack))
                        {
                            from.SendMessage("The item must be in your pack.");
                        }
                        else
                        {
                            item.Hue = m_Tub.DyedHue;

                            if (m_Tub.Charged)
                            {
                                if (m_Tub.Charges <= 1)
                                {
                                    m_Tub.Delete();
                                }
                                m_Tub.Charges = m_Tub.Charges - 1;
                            }
                            from.PlaySound(0x23F);
                            from.FixedParticles(14120, 10, 15, 5011, item.Hue, 5, EffectLayer.Waist);
                        }
                    }
                    else
                    {
                        from.SendMessage("That item cannot be dyed.");
                    }
                }
                else
                {
                    from.SendMessage("You cannot dye that.");
                }
            }
Пример #12
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_Powder.Deleted || m_Powder.UsesRemaining <= 0)
                {
                    from.SendLocalizedMessage(1049086);                       // You have used up your powder of temperament.
                    return;
                }

                if (targeted is IDurability && targeted is Item)
                {
                    IDurability wearable = (IDurability)targeted;
                    Item        item     = (Item)targeted;

                    if (!wearable.CanFortify)
                    {
                        from.SendLocalizedMessage(1049083);                           // You cannot use the powder on that item.
                        return;
                    }

                    if (item.IsChildOf(from.Backpack) && m_Powder.IsChildOf(from.Backpack))
                    {
                        int origMaxHP = wearable.MaxHitPoints;
                        int origCurHP = wearable.HitPoints;

                        if (origMaxHP > 0)
                        {
                            int initMaxHP = Core.AOS ? 255 : wearable.InitMaxHits;

                            wearable.UnscaleDurability();

                            if (wearable.MaxHitPoints < initMaxHP)
                            {
                                int bonus = initMaxHP - wearable.MaxHitPoints;

                                if (bonus > 10)
                                {
                                    bonus = 10;
                                }

                                wearable.MaxHitPoints += bonus;
                                wearable.HitPoints    += bonus;

                                wearable.ScaleDurability();

                                if (wearable.MaxHitPoints > 255)
                                {
                                    wearable.MaxHitPoints = 255;
                                }
                                if (wearable.HitPoints > 255)
                                {
                                    wearable.HitPoints = 255;
                                }

                                if (wearable.MaxHitPoints > origMaxHP)
                                {
                                    from.SendLocalizedMessage(1049084);                                       // You successfully use the powder on the item.

                                    --m_Powder.UsesRemaining;

                                    if (m_Powder.UsesRemaining <= 0)
                                    {
                                        from.SendLocalizedMessage(1049086);                                           // You have used up your powder of temperament.
                                        m_Powder.Delete();
                                    }
                                }
                                else
                                {
                                    wearable.MaxHitPoints = origMaxHP;
                                    wearable.HitPoints    = origCurHP;
                                    from.SendLocalizedMessage(1049085);                                       // The item cannot be improved any further.
                                }
                            }
                            else
                            {
                                from.SendLocalizedMessage(1049085);                                   // The item cannot be improved any further.
                                wearable.ScaleDurability();
                            }
                        }
                        else
                        {
                            from.SendLocalizedMessage(1049083);                               // You cannot use the powder on that item.
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(1042001);                           // That must be in your pack for you to use it.
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1049083);                       // You cannot use the powder on that item.
                }
            }
Пример #13
0
            protected override void OnTarget(Mobile from, object target)
            {
                m_Player = from as PlayerMobile;

                if (m_Player == null)
                {
                    return;
                }

                if (m_AspectMould == null)
                {
                    return;
                }
                if (m_AspectMould.Deleted)
                {
                    return;
                }

                if (!m_AspectMould.IsChildOf(m_Player.Backpack))
                {
                    from.SendMessage("The mould you wish to use must be in your backpack in order to use it.");
                    return;
                }

                Item targetItem = target as Item;

                if (targetItem == null)
                {
                    from.SendMessage("You cannot improve that.");
                    return;
                }

                if (!(targetItem is BaseWeapon || targetItem is BaseArmor))
                {
                    from.SendMessage("You may only improve weapons and armor.");
                    return;
                }

                if (targetItem is BaseShield)
                {
                    from.SendMessage("You may only improve weapons and armor.");
                    return;
                }

                if (!(targetItem.IsChildOf(m_Player.Backpack) || targetItem.RootParent == m_Player))
                {
                    from.SendMessage("The item you wish to improve must be equipped or in your backpack.");
                    return;
                }

                Type      itemType  = targetItem.GetType();
                CraftItem craftItem = null;

                switch (m_AspectMould.MouldType)
                {
                case MouldSkillType.Blacksmithy:
                    craftItem = DefBlacksmithy.CraftSystem.CraftItems.SearchFor(itemType);

                    if (craftItem == null)
                    {
                        m_Player.SendMessage("You may only improve items craftable through blacksmithing with this mould.");
                        return;
                    }
                    break;

                case MouldSkillType.Carpentry:
                    craftItem = DefCarpentry.CraftSystem.CraftItems.SearchFor(itemType);

                    if (craftItem == null)
                    {
                        m_Player.SendMessage("You may only improve items craftable through carpentry with this mould.");
                        return;
                    }
                    break;

                case MouldSkillType.Tailoring:
                    craftItem = DefTailoring.CraftSystem.CraftItems.SearchFor(itemType);

                    if (craftItem == null)
                    {
                        m_Player.SendMessage("You may only improve items craftable through tailoring with this mould.");
                        return;
                    }
                    break;
                }

                if (targetItem.DecorativeEquipment)
                {
                    m_Player.SendMessage("Decorative equipment may not be improved.");
                    return;
                }

                if (targetItem.LootType == LootType.Newbied)
                {
                    m_Player.SendMessage("Newbied equipment may not be improved.");
                    return;
                }

                if (targetItem.LootType == LootType.Blessed && targetItem.Aspect == AspectEnum.None)
                {
                    m_Player.SendMessage("Blessed equipment may not be improved.");
                    return;
                }

                BaseWeapon weapon = targetItem as BaseWeapon;
                BaseArmor  armor  = targetItem as BaseArmor;

                if (weapon != null)
                {
                    if (weapon.TrainingWeapon)
                    {
                        m_Player.SendMessage("Training weapons may not be improved.");
                        return;
                    }

                    if (weapon.DurabilityLevel != WeaponDurabilityLevel.Regular || weapon.AccuracyLevel != WeaponAccuracyLevel.Regular || weapon.DamageLevel != WeaponDamageLevel.Regular)
                    {
                        m_Player.SendMessage("Magical weapons may not be improved.");
                        return;
                    }
                }

                if (armor != null)
                {
                    if (armor.DurabilityLevel != ArmorDurabilityLevel.Regular || armor.ProtectionLevel != ArmorProtectionLevel.Regular)
                    {
                        m_Player.SendMessage("Magical weapons may not be improved.");
                        return;
                    }
                }

                //Aspect Item
                if (targetItem.Aspect != AspectEnum.None && targetItem.TierLevel >= 1 && targetItem.TierLevel <= 10)
                {
                    if (targetItem.TierLevel == 10)
                    {
                        m_Player.SendMessage("That item is already at it's maximum tier level.");
                        return;
                    }

                    m_Player.SendSound(0x055);

                    m_Player.CloseGump(typeof(AspectGearGump));
                    m_Player.SendGump(new AspectGearGump(m_Player, m_AspectMould, targetItem, AspectEnum.Air));

                    return;
                }

                else if (targetItem.Aspect == AspectEnum.None)
                {
                    if (!(targetItem.Quality == Quality.Exceptional && targetItem.DisplayCrafter))
                    {
                        m_Player.SendMessage("Only mastermarked items may be improved.");
                        return;
                    }

                    m_Player.SendSound(0x055);

                    m_Player.CloseGump(typeof(AspectGearGump));
                    m_Player.SendGump(new AspectGearGump(m_Player, m_AspectMould, targetItem, AspectEnum.Air));

                    return;
                }
            }
Пример #14
0
        protected void Target(Mobile from, object targeted)
        {
            Item toDye = targeted as Item;

            if (toDye == null)
            {
                // You cannot dye that.
                from.SendLocalizedMessage(1042083);
            }
            else if (!IsChildOf(from.Backpack))
            {
                // You must have the object in your backpack to use it.
                from.SendLocalizedMessage(1042010);
            }
            else if (toDye.Parent is Mobile)
            {
                // Can't Dye clothing that is being worn.
                from.SendLocalizedMessage(500861);
            }
            else if (!toDye.IsChildOf(from.Backpack))
            {
                // The item must be in your backpack to use it.
                from.SendLocalizedMessage(1060640);
            }
            else if (!toDye.Movable)
            {
                // You may not dye items which are locked down.
                from.SendLocalizedMessage(1010093);
            }
            else
            {
                if (IsValidItem(toDye))
                {
                    toDye.Hue = Hue;
                }
                else if (toDye is IDyable)
                {
                    if (!((IDyable)toDye).Dye(from, this))
                    {
                        return;
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1042083);                       // You cannot dye that.
                    return;
                }

                from.PlaySound(0x23E);

                UsesRemaining--;

                if (UsesRemaining <= 0)
                {
                    // You used up the dye.
                    from.SendLocalizedMessage(500858);

                    Delete();
                }
            }
        }
Пример #15
0
        public void OnTarget(Mobile from, object obj)
        {
            if (!IsChildOf(from.Backpack))
            {
                from.SendLocalizedMessage(1042010); // You must have the object in your backpack to use it.
                return;
            }

            if (obj is IArcaneEquip && obj is Item)
            {
                Item          item     = (Item)obj;
                CraftResource resource = CraftResource.None;

                if (item is BaseClothing)
                {
                    resource = ((BaseClothing)item).Resource;
                }
                else if (item is BaseArmor)
                {
                    resource = ((BaseArmor)item).Resource;
                }
                else if (item is BaseWeapon) // Sanity, weapons cannot recieve gems...
                {
                    resource = ((BaseWeapon)item).Resource;
                }

                IArcaneEquip eq = (IArcaneEquip)obj;

                if (!item.IsChildOf(from.Backpack))
                {
                    from.SendMessage("You may only target items in your backpack.");
                    return;
                }

                int charges = GetChargesFor(from);

                if (eq.IsArcane)
                {
                    if (eq.CurArcaneCharges > 0)
                    {
                        from.SendMessage("This item still has charges left.");
                    }
                    else
                    {
                        item.Hue = eq.TempHue;

                        if (charges >= eq.MaxArcaneCharges)
                        {
                            eq.CurArcaneCharges = eq.MaxArcaneCharges;
                            from.SendMessage("Your skill in tailoring allows you to fully recharge the item.");
                        }
                        else
                        {
                            eq.CurArcaneCharges += charges;
                            from.SendMessage("You are only able to restore some of the charges.");
                        }

                        Consume();
                    }
                }
                else if (from.Skills[SkillName.Tailoring].Value >= 60.0)
                {
                    bool isExceptional = false;

                    if (item is BaseClothing)
                    {
                        isExceptional = ((BaseClothing)item).Quality == ItemQuality.Exceptional;
                    }
                    else if (item is BaseArmor)
                    {
                        isExceptional = ((BaseArmor)item).Quality == ItemQuality.Exceptional;
                    }
                    else if (item is BaseWeapon)
                    {
                        isExceptional = ((BaseWeapon)item).Quality == ItemQuality.Exceptional;
                    }

                    if (isExceptional)
                    {
                        if (item is BaseClothing)
                        {
                            BaseClothing cloth = item as BaseClothing;

                            cloth.Quality = ItemQuality.Normal;
                            cloth.Crafter = from;
                        }
                        else if (item is BaseArmor)
                        {
                            BaseArmor armor = item as BaseArmor;

                            if (armor.IsImbued || armor.IsArtifact || RunicReforging.GetArtifactRarity(armor) > 0)
                            {
                                from.SendLocalizedMessage(1049690); // Arcane gems cannot be used on that type of leather.
                                return;
                            }

                            armor.Quality       = ItemQuality.Normal;
                            armor.Crafter       = from;
                            armor.PhysicalBonus = 0;
                            armor.FireBonus     = 0;
                            armor.ColdBonus     = 0;
                            armor.PoisonBonus   = 0;
                            armor.EnergyBonus   = 0;
                        }
                        else if (item is BaseWeapon) // Sanity, weapons cannot recieve gems...
                        {
                            BaseWeapon weapon = item as BaseWeapon;

                            weapon.Quality = ItemQuality.Normal;
                            weapon.Crafter = from;
                        }

                        eq.CurArcaneCharges = eq.MaxArcaneCharges = charges;

                        item.Hue = DefaultArcaneHue;

                        if (item.LootType == LootType.Blessed)
                        {
                            item.LootType = LootType.Regular;
                        }

                        Consume();
                    }
                    else
                    {
                        from.SendMessage("You can only use this on exceptionally crafted robes, thigh boots, cloaks, or leather gloves.");
                    }
                }
                else
                {
                    from.SendMessage("You do not have enough skill in tailoring to use this.");
                }
            }
            else
            {
                from.SendMessage("You can only use this on exceptionally crafted robes, thigh boots, cloaks, or leather gloves.");
            }
        }
Пример #16
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                Item iJournal = targeted as Item;

                if (from.Backpack.FindItemByType(typeof(SewingKit)) == null)
                {
                    from.SendMessage("You need a sewing kit to add this body part.");
                }
                else if (iJournal is FrankenJournal)
                {
                    if (!iJournal.IsChildOf(from.Backpack))
                    {
                        from.SendMessage("The journal needs to be in your pack.");
                    }
                    else if (iJournal.IsChildOf(from.Backpack))
                    {
                        FrankenJournal xJournal = (FrankenJournal)iJournal;

                        if (from != null && from == xJournal.JournalOwner)
                        {
                            if (m_Part is FrankenLegLeft)
                            {
                                if (xJournal.HasLegLeft > 0)
                                {
                                    from.SendMessage("You already have a left leg.");
                                }
                                else
                                {
                                    from.SendSound(0x48); from.SendMessage("You now have a left leg for this experiment."); m_Part.Delete(); xJournal.HasLegLeft = 1; from.Backpack.FindItemByType(typeof(SewingKit)).Delete();
                                }
                            }
                            else if (m_Part is FrankenLegRight)
                            {
                                if (xJournal.HasLegRight > 0)
                                {
                                    from.SendMessage("You already have a right leg.");
                                }
                                else
                                {
                                    from.SendSound(0x48); from.SendMessage("You now have a right leg for this experiment."); m_Part.Delete(); xJournal.HasLegRight = 1; from.Backpack.FindItemByType(typeof(SewingKit)).Delete();
                                }
                            }
                            else if (m_Part is FrankenArmLeft)
                            {
                                if (xJournal.HasArmLeft > 0)
                                {
                                    from.SendMessage("You already have a left arm.");
                                }
                                else
                                {
                                    from.SendSound(0x48); from.SendMessage("You now have a left arm for this experiment."); m_Part.Delete(); xJournal.HasArmLeft = 1; from.Backpack.FindItemByType(typeof(SewingKit)).Delete();
                                }
                            }
                            else if (m_Part is FrankenArmRight)
                            {
                                if (xJournal.HasArmRight > 0)
                                {
                                    from.SendMessage("You already have a right arm.");
                                }
                                else
                                {
                                    from.SendSound(0x48); from.SendMessage("You now have a right arm for this experiment."); m_Part.Delete(); xJournal.HasArmRight = 1; from.Backpack.FindItemByType(typeof(SewingKit)).Delete();
                                }
                            }
                            else if (m_Part is FrankenHead)
                            {
                                if (xJournal.HasHead > 0)
                                {
                                    from.SendMessage("You already have a head.");
                                }
                                else
                                {
                                    from.SendSound(0x48); from.SendMessage("You now have a head for this experiment."); m_Part.Delete(); xJournal.HasHead = 1; from.Backpack.FindItemByType(typeof(SewingKit)).Delete();
                                }
                            }
                            else if (m_Part is FrankenTorso)
                            {
                                if (xJournal.HasTorso > 0)
                                {
                                    from.SendMessage("You already have a torso.");
                                }
                                else
                                {
                                    from.SendSound(0x48); from.SendMessage("You now have a torso for this experiment."); m_Part.Delete(); xJournal.HasTorso = 1; from.Backpack.FindItemByType(typeof(SewingKit)).Delete();
                                }
                            }
                            else if (m_Part is FrankenBrain)
                            {
                                FrankenBrain brain = (FrankenBrain)m_Part;

                                if (brain.BrainLevel > from.Skills[SkillName.Forensics].Value)
                                {
                                    from.SendMessage("Your forensics skill isn't good enough to work with this brain.");
                                }
                                else
                                {
                                    if (xJournal.HasBrain > 0)
                                    {
                                        from.SendMessage("The current brain is beginning to rot, so you throw it out.");
                                    }
                                    from.SendMessage("You now have a fresh brain for this experiment.");
                                    from.SendSound(0x48);
                                    xJournal.HasBrain  = brain.BrainLevel;
                                    xJournal.BrainFrom = brain.BrainSource;
                                    from.Backpack.FindItemByType(typeof(SewingKit)).Delete();
                                    m_Part.Delete();
                                }
                            }
                        }
                        else
                        {
                            from.SendMessage("That doesn't seem like a good idea.");
                        }
                    }
                    else
                    {
                        from.SendMessage("That doesn't seem like a good idea.");
                    }
                }
                else
                {
                    from.SendMessage("That isn't Frankenstein's journal.");
                }
            }
Пример #17
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                Item iOil = targeted as Item;

                if (from.Backpack.FindItemByType(typeof(OilCloth)) == null)
                {
                    from.SendMessage("You need an oil cloth to apply this.");
                }
                else if (iOil is BaseWeapon)
                {
                    BaseWeapon xOil = (BaseWeapon)iOil;

                    if (!iOil.IsChildOf(from.Backpack))
                    {
                        from.SendMessage("You can only use this oil on items in your pack.");
                    }
                    else if (iOil.IsChildOf(from.Backpack) && Server.Misc.MaterialInfo.IsMetalItem(iOil))
                    {
                        if (m_Oil.Name == "oil of metal enhancement ( dull copper )")
                        {
                            xOil.Resource = CraftResource.DullCopper;
                        }
                        else if (m_Oil.Name == "oil of metal enhancement ( shadow iron )")
                        {
                            xOil.Resource = CraftResource.ShadowIron;
                        }
                        else if (m_Oil.Name == "oil of metal enhancement ( copper )")
                        {
                            xOil.Resource = CraftResource.Copper;
                        }
                        else if (m_Oil.Name == "oil of metal enhancement ( bronze )")
                        {
                            xOil.Resource = CraftResource.Bronze;
                        }
                        else if (m_Oil.Name == "oil of metal enhancement ( gold )")
                        {
                            xOil.Resource = CraftResource.Gold;
                        }
                        else if (m_Oil.Name == "oil of metal enhancement ( agapite )")
                        {
                            xOil.Resource = CraftResource.Agapite;
                        }
                        else if (m_Oil.Name == "oil of metal enhancement ( verite )")
                        {
                            xOil.Resource = CraftResource.Verite;
                        }
                        else if (m_Oil.Name == "oil of metal enhancement ( valorite )")
                        {
                            xOil.Resource = CraftResource.Valorite;
                        }
                        else if (m_Oil.Name == "oil of metal enhancement ( steel )")
                        {
                            xOil.Resource = CraftResource.Steel;
                        }
                        else if (m_Oil.Name == "oil of metal enhancement ( brass )")
                        {
                            xOil.Resource = CraftResource.Brass;
                        }
                        else if (m_Oil.Name == "oil of metal enhancement ( mithril )")
                        {
                            xOil.Resource = CraftResource.Mithril;
                        }
                        else if (m_Oil.Name == "oil of metal enhancement ( obsidian )")
                        {
                            xOil.Resource = CraftResource.Obsidian;
                        }
                        else if (m_Oil.Name == "oil of metal enhancement ( nepturite )")
                        {
                            xOil.Resource = CraftResource.Nepturite;
                        }

                        from.RevealingAction();
                        from.PlaySound(0x23E);
                        from.AddToBackpack(new Bottle());
                        m_Oil.Consume();
                        from.Backpack.FindItemByType(typeof(OilCloth)).Delete();
                    }
                    else
                    {
                        from.SendMessage("You cannot rub this oil on that.");
                    }
                }
                else if (iOil is BaseArmor)
                {
                    BaseArmor xOil = (BaseArmor)iOil;

                    if (!iOil.IsChildOf(from.Backpack))
                    {
                        from.SendMessage("You can only use this oil on items in your pack.");
                    }
                    else if (iOil.IsChildOf(from.Backpack) && Server.Misc.MaterialInfo.IsMetalItem(iOil))
                    {
                        if (m_Oil.Name == "oil of metal enhancement ( dull copper )")
                        {
                            xOil.Resource = CraftResource.DullCopper;
                        }
                        else if (m_Oil.Name == "oil of metal enhancement ( shadow iron )")
                        {
                            xOil.Resource = CraftResource.ShadowIron;
                        }
                        else if (m_Oil.Name == "oil of metal enhancement ( copper )")
                        {
                            xOil.Resource = CraftResource.Copper;
                        }
                        else if (m_Oil.Name == "oil of metal enhancement ( bronze )")
                        {
                            xOil.Resource = CraftResource.Bronze;
                        }
                        else if (m_Oil.Name == "oil of metal enhancement ( gold )")
                        {
                            xOil.Resource = CraftResource.Gold;
                        }
                        else if (m_Oil.Name == "oil of metal enhancement ( agapite )")
                        {
                            xOil.Resource = CraftResource.Agapite;
                        }
                        else if (m_Oil.Name == "oil of metal enhancement ( verite )")
                        {
                            xOil.Resource = CraftResource.Verite;
                        }
                        else if (m_Oil.Name == "oil of metal enhancement ( valorite )")
                        {
                            xOil.Resource = CraftResource.Valorite;
                        }
                        else if (m_Oil.Name == "oil of metal enhancement ( steel )")
                        {
                            xOil.Resource = CraftResource.Steel;
                        }
                        else if (m_Oil.Name == "oil of metal enhancement ( brass )")
                        {
                            xOil.Resource = CraftResource.Brass;
                        }
                        else if (m_Oil.Name == "oil of metal enhancement ( mithril )")
                        {
                            xOil.Resource = CraftResource.Mithril;
                        }
                        else if (m_Oil.Name == "oil of metal enhancement ( obsidian )")
                        {
                            xOil.Resource = CraftResource.Obsidian;
                        }
                        else if (m_Oil.Name == "oil of metal enhancement ( nepturite )")
                        {
                            xOil.Resource = CraftResource.Nepturite;
                        }

                        from.RevealingAction();
                        from.PlaySound(0x23E);
                        from.AddToBackpack(new Bottle());
                        m_Oil.Consume();
                        from.Backpack.FindItemByType(typeof(OilCloth)).Delete();
                    }
                    else
                    {
                        from.SendMessage("You cannot rub this oil on that.");
                    }
                }
                else
                {
                    from.SendMessage("You cannot rub this oil on that.");
                }
            }
        public static void From(Mobile m)
        {
            if (m.Backpack == null)
            {
                return;
            }

            int key = m.Serial.Value;

            if (Config.AllowPlayerToggle && DisabledPlayers.Contains(key))
            {
                return;
            }

            Item weapon = m.FindItemOnLayer(Layer.OneHanded);

            if (weapon == null || !weapon.Movable)
            {
                weapon = m.FindItemOnLayer(Layer.TwoHanded);
            }

            Item lastWeapon = null;

            if (PlayerWeapons.ContainsKey(key))
            {
                lastWeapon = PlayerWeapons[key];
            }

            if (m.Warmode)
            {
                if ((weapon == null || AllowedToKeep(weapon)) && lastWeapon != null && lastWeapon.IsChildOf(m.Backpack) && lastWeapon.Movable && lastWeapon.Visible && !lastWeapon.Deleted)
                {
                    m.EquipItem(lastWeapon);

                    if (Config.SendOverheadMessage)
                    {
                        m.LocalOverheadMessage(Network.MessageType.Emote, m.EmoteHue, false, "*Unsheathes Weapon*");
                    }
                }
            }
            else
            {
                if (weapon != null && !AllowedToKeep(weapon))
                {
                    m.Backpack.DropItem(weapon);
                    PlayerWeapons[key] = weapon;

                    if (Config.SendOverheadMessage)
                    {
                        m.LocalOverheadMessage(Network.MessageType.Emote, m.EmoteHue, false, "*Sheathes Weapon*");
                    }
                }
            }
        }
Пример #19
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted is Item)
                {
                    Item item = (Item)targeted;

                    if (item is IDyable && m_Tub.AllowDyables)
                    {
                        if (!from.InRange(m_Tub.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1))
                        {
                            from.SendLocalizedMessage(500446); // That is too far away.
                        }
                        else if (item.Parent is Mobile)
                        {
                            from.SendLocalizedMessage(500861); // Can't Dye clothing that is being worn.
                        }
                        else if (((IDyable)item).Dye(from, m_Tub))
                        {
                            from.PlaySound(0x23E);
                        }
                    }
                    else if ((FurnitureAttribute.Check(item) || (item is PotionKeg)) && m_Tub.AllowFurniture)
                    {
                        if (!from.InRange(m_Tub.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1))
                        {
                            from.SendLocalizedMessage(500446); // That is too far away.
                        }
                        else
                        {
                            bool okay = (item.IsChildOf(from.Backpack));

                            if (!okay)
                            {
                                if (item.Parent == null)
                                {
                                    BaseHouse house = BaseHouse.FindHouseAt(item);

                                    if (!house.IsCoOwner(from))
                                    {
                                        from.SendLocalizedMessage(501023); // You must be the owner to use this item.
                                    }
                                    else if (house == null || (!house.IsLockedDown(item) && !house.IsSecure(item)) && (!(item is AddonComponent) || !house.Addons.ContainsKey(((AddonComponent)item).Addon)))
                                    {
                                        from.SendLocalizedMessage(501022); // Furniture must be locked down to paint it.
                                    }
                                    else
                                    {
                                        okay = true;
                                    }
                                }
                                else
                                {
                                    from.SendLocalizedMessage(1048135); // The furniture must be in your backpack to be painted.
                                }
                            }

                            if (okay)
                            {
                                item.Hue = m_Tub.DyedHue;
                                from.PlaySound(0x23E);
                            }
                        }
                    }
                    else if ((item is Runebook || item is RecallRune) && m_Tub.AllowRunebooks)
                    {
                        if (!from.InRange(m_Tub.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1))
                        {
                            from.SendLocalizedMessage(500446); // That is too far away.
                        }
                        else if (!item.Movable)
                        {
                            from.SendLocalizedMessage(1049776); // You cannot dye runes or runebooks that are locked down.
                        }
                        else
                        {
                            item.Hue = m_Tub.DyedHue;
                            from.PlaySound(0x23E);
                        }
                    }
                    else if (item is MonsterStatuette && m_Tub.AllowStatuettes)
                    {
                        if (!from.InRange(m_Tub.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1))
                        {
                            from.SendLocalizedMessage(500446); // That is too far away.
                        }
                        else if (!item.Movable)
                        {
                            from.SendLocalizedMessage(1049779); // You cannot dye statuettes that are locked down.
                        }
                        else
                        {
                            item.Hue = m_Tub.DyedHue;
                            from.PlaySound(0x23E);
                        }
                    }
                    else if (m_Tub.AllowLeather)
                    {
                        if ((item is BaseArmor && (((BaseArmor)item).MaterialType == ArmorMaterialType.Leather || ((BaseArmor)item).MaterialType == ArmorMaterialType.Studded)) ||
                            (item is BaseClothing && (((BaseClothing)item).DefaultResource == CraftResource.RegularLeather) || item is WoodlandBelt || item is BarbedWhip ||
                             item is BladedWhip || item is SpikedWhip))
                        {
                            if (!from.InRange(m_Tub.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1))
                            {
                                from.SendLocalizedMessage(500446); // That is too far away.
                            }
                            else if (!item.Movable)
                            {
                                from.SendLocalizedMessage(1042419); // You may not dye leather items which are locked down.
                            }
                            else if (item.Parent is Mobile)
                            {
                                from.SendLocalizedMessage(500861); // Can't Dye clothing that is being worn.
                            }
                            else
                            {
                                item.Hue = m_Tub.DyedHue;
                                from.PlaySound(0x23E);
                            }
                        }
                        else
                        {
                            from.SendLocalizedMessage(m_Tub.FailMessage);
                        }
                    }
                    else if ((item is BaseArmor && (((BaseArmor)item).MaterialType == ArmorMaterialType.Chainmail || ((BaseArmor)item).MaterialType == ArmorMaterialType.Ringmail || ((BaseArmor)item).MaterialType == ArmorMaterialType.Plate)) && m_Tub.AllowMetal)
                    {
                        if (!from.InRange(m_Tub.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1))
                        {
                            from.SendLocalizedMessage(500446); // That is too far away.
                        }
                        else if (!item.Movable)
                        {
                            from.SendLocalizedMessage(1042419); // You may not dye leather items which are locked down.
                        }
                        else if (item.Parent is Mobile)
                        {
                            from.SendLocalizedMessage(500861); // Can't Dye clothing that is being worn.
                        }
                        else
                        {
                            item.Hue = m_Tub.DyedHue;
                            from.PlaySound(0x23E);
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(m_Tub.FailMessage);
                    }
                }
                else
                {
                    from.SendLocalizedMessage(m_Tub.FailMessage);
                }
            }
Пример #20
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_Item.Deleted)
                {
                    return;
                }

                Item item = targeted as Item;

                if (null != item)
                {
                    if (!item.IsChildOf(from.Backpack))
                    {
                        from.SendLocalizedMessage(1060640); // The item must be in your backpack to use it.
                        return;
                    }

                    bool valid = (item is IDyable || item is BaseTalisman ||
                                  item is BaseBook || item is BaseClothing ||
                                  item is BaseJewel || item is BaseStatuette ||
                                  item is BaseWeapon || item is Runebook ||
                                  item is Spellbook || item is DecorativePlant ||
                                  item.IsArtifact || BasePigmentsOfTokuno.IsValidItem(item));

                    if (!valid && item is BaseArmor)
                    {
                        CraftResourceType restype = CraftResources.GetType(((BaseArmor)item).Resource);
                        if ((CraftResourceType.Leather == restype || CraftResourceType.Metal == restype) &&
                            ArmorMaterialType.Bone != ((BaseArmor)item).MaterialType)
                        {
                            valid = true;
                        }
                    }

                    if (!valid && FurnitureAttribute.Check(item))
                    {
                        if (!from.InRange(m_Item.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1))
                        {
                            from.SendLocalizedMessage(500446); // That is too far away.
                            return;
                        }
                        else
                        {
                            BaseHouse house = BaseHouse.FindHouseAt(item);

                            if (house == null || (!house.IsLockedDown(item) && !house.IsSecure(item)))
                            {
                                from.SendLocalizedMessage(501022); // Furniture must be locked down to paint it.
                                return;
                            }
                            else if (!house.IsCoOwner(from))
                            {
                                from.SendLocalizedMessage(501023); // You must be the owner to use this item.
                                return;
                            }
                            else
                            {
                                valid = true;
                            }
                        }
                    }

                    // need to add any bags, chests, boxes, crates not IDyable but dyable by natural dyes

                    if (valid)
                    {
                        item.Hue = PlantPigmentHueInfo.GetInfo(m_Item.PigmentHue).Hue;
                        from.PlaySound(0x23E);

                        if (--m_Item.UsesRemaining > 0)
                        {
                            m_Item.InvalidateProperties();
                        }
                        else
                        {
                            m_Item.Delete();
                        }

                        return;
                    }
                }

                from.SendLocalizedMessage(1042083); // You cannot dye that.
            }
Пример #21
0
        public override void OnHit(Mobile attacker, Mobile defender, int damage)
        {
            if (!this.Validate(attacker))
            {
                return;
            }

            ClearCurrentAbility(attacker);

            Item toDisarm = defender.FindItemOnLayer(Layer.OneHanded);

            if (toDisarm == null || !toDisarm.Movable)
            {
                toDisarm = defender.FindItemOnLayer(Layer.TwoHanded);
            }

            Container pack = defender.Backpack;

            if (pack == null || (toDisarm != null && !toDisarm.Movable))
            {
                attacker.SendLocalizedMessage(1004001); // You cannot disarm your opponent.
            }
            else if (toDisarm == null || toDisarm is BaseShield || toDisarm is Spellbook && !Core.ML)
            {
                attacker.SendLocalizedMessage(1060849); // Your target is already unarmed!
            }
            else if (this.CheckMana(attacker, true))
            {
                // Skill Masteries - removed publish 96

                /*int saveChance = Server.Spells.SkillMasteries.MasteryInfo.SavingThrowChance(defender);
                 *
                 * if (saveChance > 0 && saveChance >= Utility.Random(100))
                 * {
                 *  attacker.SendLocalizedMessage(1156033); // Your disarm attempt was blocked!
                 *  defender.SendLocalizedMessage(1156034); // You blocked a disarm attempt!
                 *  return;
                 * }*/

                attacker.SendLocalizedMessage(1060092); // You disarm their weapon!
                defender.SendLocalizedMessage(1060093); // Your weapon has been disarmed!

                defender.PlaySound(0x3B9);
                defender.FixedParticles(0x37BE, 232, 25, 9948, EffectLayer.LeftHand);

                pack.DropItem(toDisarm);

                BuffInfo.AddBuff(defender, new BuffInfo(BuffIcon.NoRearm, 1075637, BlockEquipDuration, defender));

                BaseWeapon.BlockEquip(defender, BlockEquipDuration);

                if (defender is BaseCreature && ((BaseCreature)defender).AutoRearms)
                {
                    Timer.DelayCall(BlockEquipDuration + TimeSpan.FromSeconds(Utility.RandomMinMax(3, 10)), () =>
                    {
                        if (toDisarm != null && !toDisarm.Deleted && toDisarm.IsChildOf(defender.Backpack))
                        {
                            defender.EquipItem(toDisarm);
                        }
                    });
                }
            }
        }
        protected override void OnTarget(Mobile from, object target)
        {
            //Is our target an Item?
            if (target is Item)
            {
                //Yes: So convert target to Item...
                Item item = target as Item;

                //Is our Item inside the Player's backpack?
                if (!item.IsChildOf(from.Backpack))
                {
                    //No: Send warning message and exit (return) gracefully...
                    from.SendMessage(0x22, "You must own that item before you can enhance it.");
                    return;
                }

                //Is the target Skill of the layer adequate?
                if (from.CheckTargetSkill(SkillName.ItemID, item, 0, 100))
                {
                    //Yes: Identify the Item Type and set the SkillBonus values...
                    if (item is BaseWeapon)
                    {
                        //Is the Player a Blacksmith? (We are enhancing a weapon...)
                        if (from.Skills.Blacksmith.Value < 100.0)
                        {
                            //No: Send warning and exit (return) gracefully.
                            from.SendMessage(0x22, "You don't have the required Blacksmithing skill to enhance this weapon.");
                            return;
                        }

                        //Success: Identified Item Type and set SkillBonus values, send a message, play a random sound, etc.
                        ((BaseWeapon)item).SkillBonuses.SetValues(0, _Gem.Skill, _Gem.Value);
                        from.SendMessage(0x55, "You Successfully enhance the weapon.");
                        from.PlaySound(Utility.Random(0x520, 0));
                        Server.Engines.Craft.DefBlacksmithy.CraftSystem.PlayCraftEffect(from);
                        _Gem.Use();
                    }
                    else if (item is BaseArmor)
                    {
                        //Is the Player a Blacksmith? (We are enhancing armor...)
                        if (from.Skills.Blacksmith.Value < 100.0)
                        {
                            //No: Send warning and exit (return) gracefully.
                            from.SendMessage(0x22, "You don't have the required Blacksmithing skill to enhance this armor.");
                            return;
                        }

                        //Success: Identified Item Type and set SkillBonus values, send a message, play a random sound, etc.
                        ((BaseArmor)item).SkillBonuses.SetValues(0, _Gem.Skill, _Gem.Value);
                        from.SendMessage(0x55, "You Successfully enhance the clothing.");
                        from.PlaySound(Utility.Random(0x520, 0));
                        Server.Engines.Craft.DefBlacksmithy.CraftSystem.PlayCraftEffect(from);
                        _Gem.Use();
                    }
                    else if (item is BaseJewel)
                    {
                        //Is the Player a, Inscriptor? (We are enhancing jewels...)
                        if (from.Skills.Inscribe.Value < 100.0)
                        {
                            //No: Send warning and exit (return) gracefully.
                            from.SendMessage(0x22, "You don't have the required Inscription skill to enhance this jewel.");
                            return;
                        }

                        //Success: Identified Item Type and set SkillBonus values, send a message, play a random sound, etc.
                        ((BaseJewel)item).SkillBonuses.SetValues(0, _Gem.Skill, _Gem.Value);
                        from.SendMessage(0x55, "You successfully enhance the jewel.");
                        from.PlaySound(Utility.Random(0x520, 0));
                        Server.Engines.Craft.DefInscription.CraftSystem.PlayCraftEffect(from);
                        _Gem.Use();
                    }
                    else if (item is BaseClothing)
                    {
                        //Is the Player a Tailor? (We are enhancing clothing...)
                        if (from.Skills.Tailoring.Value < 100.0)
                        {
                            //No: Send warning and exit (return) gracefully.
                            from.SendMessage(0x22, "You don't have the required Tailoring skill to enhance this clothing.");
                            return;
                        }

                        //Success: Identified Item Type and set SkillBonus values, send a message, play a random sound, etc.
                        ((BaseClothing)item).SkillBonuses.SetValues(0, _Gem.Skill, _Gem.Value);
                        from.SendMessage(0x55, "You successfully enhance the clothing.");
                        from.PlaySound(Utility.Random(0x520, 0));
                        Server.Engines.Craft.DefTailoring.CraftSystem.PlayCraftEffect(from);
                        _Gem.Use();
                    }
                    else
                    {
                        //Fail: Could not identify the Item Type, send warning message and exit (return) gracefully...
                        from.SendMessage(0x22, "That item can not be enhanced.");
                        return;
                    }
                }
                else
                {
                    //No: Send warning message and exit (return) gracefully.
                    from.SendMessage(0x22, "You have no idea about what you're trying to do, do you?");
                    return;
                }
            }
            else
            {
                //No: Send warning message and exit (return) gracefully.
                from.SendMessage(0x22, "You must target an item of clothing, armor, jewelry or a weapon.");
                return;
            }
        }
Пример #23
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted is Item)
                {
                    Item bone = targeted as Item;

                    int boneCount  = 0;
                    int skullCount = 0;

                    if (!bone.IsChildOf(from.Backpack))
                    {
                        from.SendMessage("You can only polish bones that are in your pack.");
                    }
                    else if (bone is Container)
                    {
                        from.SendMessage("You cannot polish containers.");
                    }
                    else if (bone.ItemID == 0xECA)
                    {
                        boneCount = 3; skullCount = 1;
                    }
                    else if (bone.ItemID == 0xECB)
                    {
                        boneCount = 3; skullCount = 1;
                    }
                    else if (bone.ItemID == 0xECC)
                    {
                        boneCount = 3; skullCount = 1;
                    }
                    else if (bone.ItemID == 0xECD)
                    {
                        boneCount = 3; skullCount = 1;
                    }
                    else if (bone.ItemID == 0xECE)
                    {
                        boneCount = 3; skullCount = 1;
                    }
                    else if (bone.ItemID == 0xECF)
                    {
                        boneCount = 3; skullCount = 1;
                    }
                    else if (bone.ItemID == 0xED0)
                    {
                        boneCount = 3; skullCount = 1;
                    }
                    else if (bone.ItemID == 0xED1)
                    {
                        boneCount = 3; skullCount = 1;
                    }
                    else if (bone.ItemID == 0xED2)
                    {
                        boneCount = 3; skullCount = 1;
                    }
                    else if (bone.ItemID == 0xF7E)
                    {
                        boneCount = bone.Amount; skullCount = 0;
                    }
                    else if (bone.ItemID == 0xF80)
                    {
                        boneCount = 1; skullCount = 0;
                    }
                    else if (bone.ItemID == 0x1B09)
                    {
                        boneCount = 2; skullCount = 1;
                    }
                    else if (bone.ItemID == 0x1B0A)
                    {
                        boneCount = 3; skullCount = 0;
                    }
                    else if (bone.ItemID == 0x1B0B)
                    {
                        boneCount = 3; skullCount = 1;
                    }
                    else if (bone.ItemID == 0x1B0C)
                    {
                        boneCount = 3; skullCount = 1;
                    }
                    else if (bone.ItemID == 0x1B0D)
                    {
                        boneCount = 2; skullCount = 1;
                    }
                    else if (bone.ItemID == 0x1B0E)
                    {
                        boneCount = 3; skullCount = 0;
                    }
                    else if (bone.ItemID == 0x1B0F)
                    {
                        boneCount = 3; skullCount = 1;
                    }
                    else if (bone.ItemID == 0x1B10)
                    {
                        boneCount = 3; skullCount = 1;
                    }
                    else if (bone.ItemID == 0x1B11)
                    {
                        boneCount = 1; skullCount = 0;
                    }
                    else if (bone.ItemID == 0x1B12)
                    {
                        boneCount = 1; skullCount = 0;
                    }
                    else if (bone.ItemID == 0x1B13)
                    {
                        boneCount = 1; skullCount = 0;
                    }
                    else if (bone.ItemID == 0x1B14)
                    {
                        boneCount = 1; skullCount = 0;
                    }
                    else if (bone.ItemID == 0x1B16)
                    {
                        boneCount = 1; skullCount = 0;
                    }
                    else if (bone.ItemID == 0x1B19)
                    {
                        boneCount = 2; skullCount = 0;
                    }
                    else if (bone.ItemID == 0x2C99)
                    {
                        boneCount = 1; skullCount = 0;
                    }
                    else if (bone.ItemID == 0x1B17)
                    {
                        boneCount = 2; skullCount = 0;
                    }
                    else if (bone.ItemID == 0x1B18)
                    {
                        boneCount = 2; skullCount = 0;
                    }
                    else if (bone.ItemID == 0x1B19)
                    {
                        boneCount = 2; skullCount = 0;
                    }
                    else if (bone.ItemID == 0x1B1A)
                    {
                        boneCount = 2; skullCount = 0;
                    }
                    else if (bone.ItemID == 0x1B1B)
                    {
                        boneCount = 1; skullCount = 0;
                    }
                    else if (bone.ItemID == 0x1B1C)
                    {
                        boneCount = 1; skullCount = 0;
                    }
                    else if (bone.ItemID == 0x1AE0)
                    {
                        boneCount = 0; skullCount = 1;
                    }
                    else if (bone.ItemID == 0x1AE1)
                    {
                        boneCount = 0; skullCount = 1;
                    }
                    else if (bone.ItemID == 0x1AE2)
                    {
                        boneCount = 0; skullCount = 1;
                    }
                    else if (bone.ItemID == 0x1AE3)
                    {
                        boneCount = 0; skullCount = 1;
                    }
                    else if (bone.ItemID == 0x1AE4)
                    {
                        boneCount = 0; skullCount = 1;
                    }
                    else if (bone.ItemID == 0x224)
                    {
                        boneCount = 0; skullCount = 1;
                    }
                    else if (bone.ItemID == 0x224)
                    {
                        boneCount = 0; skullCount = 1;
                    }
                    else if (bone.ItemID == 0x1853)
                    {
                        boneCount = 0; skullCount = 1;
                    }
                    else if (bone.ItemID == 0x1854)
                    {
                        boneCount = 0; skullCount = 1;
                    }
                    else if (bone.ItemID == 0x1855)
                    {
                        boneCount = 0; skullCount = 1;
                    }
                    else if (bone.ItemID == 0x1856)
                    {
                        boneCount = 0; skullCount = 1;
                    }
                    else if (bone.ItemID == 0x1857)
                    {
                        boneCount = 0; skullCount = 1;
                    }
                    else if (bone.ItemID == 0x1858)
                    {
                        boneCount = 0; skullCount = 1;
                    }
                    else if (bone.ItemID == 0x1859)
                    {
                        boneCount = 0; skullCount = 1;
                    }
                    else if (bone.ItemID == 0x185A)
                    {
                        boneCount = 0; skullCount = 1;
                    }
                    else if (bone.ItemID == 0x1AEE)
                    {
                        boneCount = 0; skullCount = 1;
                    }
                    else if (bone.ItemID == 0x1AEF)
                    {
                        boneCount = 0; skullCount = 1;
                    }
                    else if (bone.ItemID == 0x2203)
                    {
                        boneCount = 0; skullCount = 1;
                    }
                    else if (bone.ItemID == 0x2204)
                    {
                        boneCount = 0; skullCount = 10;
                    }
                    else if (bone.ItemID == 0x224E)
                    {
                        boneCount = 0; skullCount = 1;
                    }
                    else if (bone.ItemID == 0x224F)
                    {
                        boneCount = 0; skullCount = 1;
                    }
                    else if (bone.ItemID == 0x2250)
                    {
                        boneCount = 0; skullCount = 1;
                    }
                    else if (bone.ItemID == 0x2251)
                    {
                        boneCount = 0; skullCount = 1;
                    }
                    else if (bone.ItemID == 0x2C95)
                    {
                        boneCount = 0; skullCount = 1;
                    }
                    else if (bone.ItemID == 0x3DCC)
                    {
                        boneCount = 0; skullCount = 1;
                    }
                    else if (bone.ItemID == 0x3DCD)
                    {
                        boneCount = 0; skullCount = 1;
                    }
                    else if (bone.ItemID == 0x3DE0)
                    {
                        boneCount = 0; skullCount = 1;
                    }
                    else if (bone.ItemID == 0x3DE1)
                    {
                        boneCount = 0; skullCount = 1;
                    }
                    else if (bone.ItemID == 0x42B5)
                    {
                        boneCount = 0; skullCount = 3;
                    }
                    else
                    {
                        from.SendMessage("You cannot polish that.");
                    }

                    if (boneCount > 0 || skullCount > 0)
                    {
                        if (boneCount > 0)
                        {
                            from.AddToBackpack(new PolishedBone(boneCount));
                        }

                        if (skullCount > 0)
                        {
                            from.AddToBackpack(new PolishedSkull(skullCount));
                        }

                        from.SendMessage("You polish the bones so they can be used for crafting.");
                        from.RevealingAction();
                        from.PlaySound(0x04F);
                        bone.Delete();
                    }
                }
                else
                {
                    from.SendMessage("You cannot polish that.");
                }
            }
Пример #24
0
        public void OnTarget(Mobile from, object obj)
        {
            if (!IsChildOf(from.Backpack))
            {
                from.SendLocalizedMessage(1042001);                   // That must be in your pack for you to use it.
                return;
            }

            if (obj is IArcaneEquip && obj is Item)
            {
                Item          item     = (Item)obj;
                CraftResource resource = CraftResource.None;

                if (item is BaseClothing)
                {
                    resource = ((BaseClothing)item).Resource;
                }
                else if (item is BaseArmor)
                {
                    resource = ((BaseArmor)item).Resource;
                }
                else if (item is BaseWeapon)                  // Sanity, weapons cannot recieve gems...
                {
                    resource = ((BaseWeapon)item).Resource;
                }

                IArcaneEquip eq = (IArcaneEquip)obj;

                if (!item.IsChildOf(from.Backpack))
                {
                    from.SendLocalizedMessage(1042001);                       // That must be in your pack for you to use it.
                    return;
                }
                else if (item.LootType == LootType.Blessed)
                {
                    from.SendMessage("You can only use this on exceptionally crafted robes, thigh boots, cloaks, or leather gloves.");
                    return;
                }
                else if (resource != CraftResource.None && resource != CraftResource.RegularLeather)
                {
                    from.SendLocalizedMessage(1049690);                       // Arcane gems can not be used on that type of leather.
                    return;
                }

                int charges = GetChargesFor(from);

                if (eq.IsArcane)
                {
                    if (eq.CurArcaneCharges >= eq.MaxArcaneCharges)
                    {
                        from.SendMessage("That item is already fully charged.");
                    }
                    else
                    {
                        if (eq.CurArcaneCharges <= 0)
                        {
                            item.Hue = DefaultArcaneHue;
                        }

                        if ((eq.CurArcaneCharges + charges) > eq.MaxArcaneCharges)
                        {
                            eq.CurArcaneCharges = eq.MaxArcaneCharges;
                        }
                        else
                        {
                            eq.CurArcaneCharges += charges;
                        }

                        from.SendMessage("You recharge the item.");
                        if (Amount <= 1)
                        {
                            Delete();
                        }
                        else
                        {
                            Amount--;
                        }
                    }
                }
                else if (from.Skills[SkillName.Tailoring].Value >= 80.0)
                {
                    bool isExceptional = false;

                    if (item is BaseClothing)
                    {
                        isExceptional = (((BaseClothing)item).Quality == ClothingQuality.Exceptional);
                    }
                    else if (item is BaseArmor)
                    {
                        isExceptional = (((BaseArmor)item).Quality == ArmorQuality.Exceptional);
                    }
                    else if (item is BaseWeapon)
                    {
                        isExceptional = (((BaseWeapon)item).Quality == WeaponQuality.Exceptional);
                    }

                    if (isExceptional)
                    {
                        if (item is BaseClothing)
                        {
                            ((BaseClothing)item).Quality = ClothingQuality.Regular;
                            ((BaseClothing)item).Crafter = from;
                        }
                        else if (item is BaseArmor)
                        {
                            ((BaseArmor)item).Quality       = ArmorQuality.Regular;
                            ((BaseArmor)item).Crafter       = from;
                            ((BaseArmor)item).PhysicalBonus = ((BaseArmor)item).FireBonus = ((BaseArmor)item).ColdBonus = ((BaseArmor)item).PoisonBonus = ((BaseArmor)item).EnergyBonus = 0; // Is there a method to remove bonuses?
                        }
                        else if (item is BaseWeapon)                                                                                                                                         // Sanity, weapons cannot recieve gems...
                        {
                            ((BaseWeapon)item).Quality = WeaponQuality.Regular;
                            ((BaseWeapon)item).Crafter = from;
                        }

                        eq.CurArcaneCharges = eq.MaxArcaneCharges = charges;

                        item.Hue = DefaultArcaneHue;

                        from.SendMessage("You enhance the item with your gem.");
                        if (Amount <= 1)
                        {
                            Delete();
                        }
                        else
                        {
                            Amount--;
                        }
                    }
                    else
                    {
                        from.SendMessage("Only exceptional items can be enhanced with the gem.");
                    }
                }
                else
                {
                    from.SendMessage("You do not have enough skill in tailoring to enhance the item.");
                }
            }
            else
            {
                from.SendMessage("You can only use this on exceptionally crafted robes, thigh boots, cloaks, or leather gloves.");
            }
        }
Пример #25
0
        public static void OnSpunLoop(ISpinningWheel wheel, Mobile from, int hue, Item cotton)
        {
            Item item = new SpoolOfThread(3);

            item.Hue = hue;
            from.AddToBackpack(item);

            SpinningWheelQuotaAttachment att = (SpinningWheelQuotaAttachment)XmlAttach.FindAttachment(from, typeof(SpinningWheelQuotaAttachment));

            if (att == null)
            {
                att = new SpinningWheelQuotaAttachment();
                XmlAttach.AttachTo(from, att);
            }
            att.RemoveWheels((Item)wheel);

            if (from.NetState == null) // player logged off
            {
                return;
            }
            if (cotton.Deleted || cotton.Amount < 1 || !(cotton is Flax))
            {
                from.SendMessage("You finished processing all the flax.");
            }
            else if (!cotton.IsChildOf(from.Backpack))
            {
                from.SendMessage("You can not continue without the flax in your backpack.");
            }
            else if (wheel is Item)
            {
                Item wheel1 = (Item)wheel;

                if (wheel1.Deleted)
                {
                    from.SendMessage("Where did the spinning wheel go?");
                }
                else if (!from.InRange(wheel1.GetWorldLocation(), 3))
                {
                    from.SendMessage("You are too far away from the spinning wheel to continue your work.");
                }
                else if (wheel.Spinning)
                {
                    from.SendLocalizedMessage(502656); // That spinning wheel is being used.
                }
                else
                {
                    if (att.getNumWheels() < SpinningWheelQuotaAttachment.m_WheelQuotaCap)
                    {
                        att.AddWheels(wheel1);
                        if (Utility.Random(6 * att.getNumWheels()) < 1)
                        {
                            from.PublicOverheadMessage(Server.Network.MessageType.Emote, 51, false, "*spinning*");
                        }
                        cotton.Consume();
                        wheel.BeginSpin(new SpinCallback(Flax.OnSpunLoop), from, cotton.Hue, cotton);
                        return;
                    }
                    else
                    {
                        from.SendMessage("You are too occupied with the " + SpinningWheelQuotaAttachment.m_WheelQuotaCap.ToString() + " spinning wheels you are running.");
                    }
                }
            }
            from.SendLocalizedMessage(1010577); // You put the spools of thread in your backpack.
        }
        protected override void OnTarget(Mobile from, object target)           // Override the protected OnTarget() for our feature
        {
            if (m_Deed == null || from.Backpack == null || !m_Deed.IsChildOf(from.Backpack))
            {
                from.SendLocalizedMessage(1042001);
            }
            else if (target is BaseClothing)
            {
                Item item = (Item)target;
                if (item.LootType == LootType.Blessed || item.BlessedFor == from) // Check if its already newbied (blessed)
                {
                    from.SendLocalizedMessage(1045113);                           // That item is already blessed
                }
                else if (item.LootType != LootType.Regular)
                {
                    from.SendLocalizedMessage(1045114);                       // You can not bless that item
                }
                else
                {
                    if (!item.IsChildOf(from.Backpack) || item is HoodedShroudOfShadows || item is ElvenRobe) // Make sure its in their pack or they are wearing it
                    {
                        from.SendLocalizedMessage(500509);                                                    // You cannot bless that object
                    }
                    else
                    {
                        item.LootType = LootType.Blessed;
                        item.Hue      = 1154;

                        string namecheck = item.Name;
                        if (!String.IsNullOrEmpty(namecheck))
                        {
                            namecheck = namecheck.ToLower();
                        }
                        else
                        {
                            namecheck = String.Empty;
                        }

                        if (namecheck.IndexOf("blessed by unholy skull") == -1 && namecheck.IndexOf("with holy blessing") == -1)
                        {
                            if (item.Name == null)
                            {
                                item.Name = item.ItemData.Name + " with Holy Blessing";
                            }
                            else
                            {
                                item.Name = item.Name + " with Holy Blessing";
                            }
                        }

                        from.SendLocalizedMessage(1010026);

                        m_Deed.Delete();                         // Delete the bless deed
                    }
                }
            }
            else
            {
                from.SendLocalizedMessage(500509);                   // You cannot bless that object
            }
        }
Пример #27
0
            public override void OnResponse(NetState sender, RelayInfo info)
            {
                // If the item is gone, or an invalid button was pressed,
                // close the gump.
                if (_Item == null || _Item.Deleted || info.ButtonID == 0)
                {
                    _Mobile.CloseGump(typeof(MythicCharacterTokenGump));
                    return;
                }

                // If the item is no longer in the plyaer's backpack,
                // close the gump, and send them a message.
                if (!_Item.IsChildOf(_Mobile.Backpack))
                {
                    _Mobile.CloseGump(typeof(MythicCharacterTokenGump));
                    _Mobile.SendLocalizedMessage(1062334); // This item must be in your backpack to be used.
                    return;
                }

                // Set stats.
                var strengthString = info.GetTextEntry(0).Text;
                int strength;
                var dexterityString = info.GetTextEntry(1).Text;
                int dexterity;
                var intelligenceString = info.GetTextEntry(2).Text;
                int intelligence;

                if (!int.TryParse(strengthString, out strength))
                {
                    strength = _Mobile.RawStr;
                }

                if (!int.TryParse(dexterityString, out dexterity))
                {
                    dexterity = _Mobile.RawDex;
                }

                if (!int.TryParse(intelligenceString, out intelligence))
                {
                    intelligence = _Mobile.RawInt;
                }

                switch (info.ButtonID)
                {
                case _CancelButtonId:
                    _Mobile.CloseGump(typeof(MythicCharacterTokenGump));
                    break;

                case _NextButtonId:
                    _Mobile.CloseGump(typeof(MythicCharacterTokenGump));

                    if (_SelectedSkills.Count == _MaxSelectedSkills)
                    {
                        _Mobile.SendGump(new MythicCharacterTokenGump(_Item, _Mobile, _SelectedSkills, strength, dexterity, intelligence, 2));
                    }
                    else
                    {
                        _Mobile.SendGump(new MythicCharacterTokenGump(_Item, _Mobile, _SelectedSkills, strength, dexterity, intelligence, _Page + 1));
                    }
                    break;

                case _BackButtonId:
                    _Mobile.CloseGump(typeof(MythicCharacterTokenGump));
                    _Mobile.SendGump(new MythicCharacterTokenGump(_Item, _Mobile, _SelectedSkills, strength, dexterity, intelligence, _Page - 1));
                    break;

                case _ContinueButtonId:
                    // Set Stats
                    _Mobile.RawStr = _Strength;
                    _Mobile.RawDex = _Dexterity;
                    _Mobile.RawInt = _Intelligence;

                    // Set Skills
                    foreach (var skillId in _SelectedSkills)
                    {
                        var name            = _SkillMap[skillId];
                        var internalSkillId = 0;

                        foreach (var skillName in SkillInfo.Table)
                        {
                            if (skillName.Name != name)
                            {
                                continue;
                            }

                            internalSkillId = skillName.SkillID;
                            break;
                        }

                        var skill = _Mobile.Skills[internalSkillId];

                        // Make sure the lock is up
                        skill.SetLockNoRelay(SkillLock.Up);
                        skill.Base = 90;
                    }

                    _Mobile.CloseGump(typeof(MythicCharacterTokenGump));
                    _Item.Delete();
                    break;

                case _EditButtonId:
                    _Mobile.CloseGump(typeof(MythicCharacterTokenGump));
                    _Mobile.SendGump(new MythicCharacterTokenGump(_Item, _Mobile, _SelectedSkills, strength, dexterity, intelligence, _Page));
                    break;

                default:
                    if (_MagicSkills.Contains(info.ButtonID) || _CombatSkills.Contains(info.ButtonID) || _BardSkills.Contains(info.ButtonID) ||
                        _WildernessSkills.Contains(info.ButtonID) || _TradeSkills.Contains(info.ButtonID) || _MiscellaneousSkills.Contains(info.ButtonID) ||
                        _ThieverySkills.Contains(info.ButtonID))
                    {
                        if (_SelectedSkills.Contains(info.ButtonID))
                        {
                            _SelectedSkills.Remove(info.ButtonID);
                        }
                        else
                        {
                            _SelectedSkills.Add(info.ButtonID);
                        }
                    }

                    var page = _Page;

                    if (_SelectedSkills.Count == _MaxSelectedSkills)
                    {
                        page = 2;
                    }
                    else if (_SelectedSkills.Count < _MaxSelectedSkills && _Page > 1)
                    {
                        page = 0;
                    }

                    _Mobile.CloseGump(typeof(MythicCharacterTokenGump));
                    _Mobile.SendGump(new MythicCharacterTokenGump(_Item, _Mobile, _SelectedSkills, strength, dexterity, intelligence, page));
                    break;
                }
            }
Пример #28
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                bool DoEffects = false;
                Item iWear     = targeted as Item;

                string OldName = null;
                string NewName = null;

                if (!iWear.IsChildOf(from.Backpack))
                {
                    from.SendMessage("You can only use this hammer on items in your pack.");
                }
                else if (iWear is BaseArmor && Server.Misc.MaterialInfo.IsAnyKindOfMetalItem(iWear))
                {
                    if (iWear.ItemID == 0x2778 || iWear.ItemID == 0x27C3)
                    {
                        DoEffects = true; iWear.ItemID = 0x2645; NewName = "dragon helm";
                    }
                    else if (iWear.ItemID == 0x2645 || iWear.ItemID == 0x2646)
                    {
                        DoEffects = true; iWear.ItemID = 0x2FBB; NewName = "dread helm";
                    }
                    else if (iWear.ItemID == 0x2FBB)
                    {
                        DoEffects = true; iWear.ItemID = 0x2B10; NewName = "royal helm";
                    }
                    else if (iWear.ItemID == 0x2B10 || iWear.ItemID == 0x2B11)
                    {
                        DoEffects = true; iWear.ItemID = 0x1412; NewName = "platemail helm";
                    }
                    else if (iWear.ItemID == 0x1412 || iWear.ItemID == 0x1419)
                    {
                        DoEffects = true; iWear.ItemID = 0x1F0B; NewName = "orc helm";
                    }
                    else if (iWear.ItemID == 0x1F0B || iWear.ItemID == 0x1F0C)
                    {
                        DoEffects = true; iWear.ItemID = 0x140E; NewName = "norse helm";
                    }
                    else if (iWear.ItemID == 0x140E || iWear.ItemID == 0x140F)
                    {
                        DoEffects = true; iWear.ItemID = 0x140A; NewName = "helmet";
                    }
                    else if (iWear.ItemID == 0x140A || iWear.ItemID == 0x140B)
                    {
                        DoEffects = true; iWear.ItemID = 0x1451; NewName = "bone helm";
                    }
                    else if (iWear.ItemID == 0x1451 || iWear.ItemID == 0x1456)
                    {
                        DoEffects = true; iWear.ItemID = 0x13BB; NewName = "chainmail coif";
                    }
                    else if (iWear.ItemID == 0x13BB || iWear.ItemID == 0x13C0)
                    {
                        DoEffects = true; iWear.ItemID = 0x1408; NewName = "close helm";
                    }
                    else if (iWear.ItemID == 0x1408 || iWear.ItemID == 0x1409)
                    {
                        DoEffects = true; iWear.ItemID = 0x140C; NewName = "bascinet";
                    }
                    else if (iWear.ItemID == 0x140C || iWear.ItemID == 0x140D)
                    {
                        DoEffects = true; iWear.ItemID = 0x2774; NewName = "chainmail hatsuburi";
                    }
                    else if (iWear.ItemID == 0x2774)
                    {
                        DoEffects = true; iWear.ItemID = 0x2781; NewName = "platemail jingasa";
                    }
                    else if (iWear.ItemID == 0x2781)
                    {
                        DoEffects = true; iWear.ItemID = 0x2777; NewName = "platemail jingasa";
                    }
                    else if (iWear.ItemID == 0x2777)
                    {
                        DoEffects = true; iWear.ItemID = 0x2775; NewName = "platemail hatsuburi";
                    }
                    else if (iWear.ItemID == 0x2775 || iWear.ItemID == 0x27C0)
                    {
                        DoEffects = true; iWear.ItemID = 0x2789; NewName = "platemail kabuto";
                    }
                    else if (iWear.ItemID == 0x2789 || iWear.ItemID == 0x27D4)
                    {
                        DoEffects = true; iWear.ItemID = 0x2785; NewName = "platemail kabuto";
                    }
                    else if (iWear.ItemID == 0x2785 || iWear.ItemID == 0x27D0)
                    {
                        DoEffects = true; iWear.ItemID = 0x2784; NewName = "platemail jingasa";
                    }
                    else if (iWear.ItemID == 0x2784)
                    {
                        DoEffects = true; iWear.ItemID = 0x2778; NewName = "platemail kabuto";
                    }

                    else if (iWear.ItemID == 0x2FCB || iWear.ItemID == 0x3181)
                    {
                        DoEffects = true; iWear.ItemID = 0x1B72; NewName = "round shield";
                    }
                    else if (iWear.ItemID == 0x1B72)
                    {
                        DoEffects = true; iWear.ItemID = 0x1B74; NewName = "kite shield";
                    }
                    else if (iWear.ItemID == 0x1B74 || iWear.ItemID == 0x1B75)
                    {
                        DoEffects = true; iWear.ItemID = 0x1B76; NewName = "heater shield";
                    }
                    else if (iWear.ItemID == 0x1B76 || iWear.ItemID == 0x1B77)
                    {
                        DoEffects = true; iWear.ItemID = 0x1B7B; NewName = "metal shield";
                    }
                    else if (iWear.ItemID == 0x1B7B)
                    {
                        DoEffects = true; iWear.ItemID = 0x1BC3; NewName = "chaos shield";
                    }
                    else if (iWear.ItemID == 0x1BC3)
                    {
                        DoEffects = true; iWear.ItemID = 0x1BC4; NewName = "order shield";
                    }
                    else if (iWear.ItemID == 0x1BC4 || iWear.ItemID == 0x1BC5)
                    {
                        DoEffects = true; iWear.ItemID = 0x2B01; NewName = "royal shield";
                    }
                    else if (iWear.ItemID == 0x2B01)
                    {
                        DoEffects = true; iWear.ItemID = 0x2B74; NewName = "champion shield";
                    }
                    else if (iWear.ItemID == 0x2B74 || iWear.ItemID == 0x316B)
                    {
                        DoEffects = true; iWear.ItemID = 0x2B75; NewName = "jeweled shield";
                    }
                    else if (iWear.ItemID == 0x2B75 || iWear.ItemID == 0x316C)
                    {
                        DoEffects = true; iWear.ItemID = 0x2FC8; NewName = "dark shield";
                    }
                    else if (iWear.ItemID == 0x2FC8 || iWear.ItemID == 0x317E)
                    {
                        DoEffects = true; iWear.ItemID = 0x2FC9; NewName = "crested shield";
                    }
                    else if (iWear.ItemID == 0x2FC9 || iWear.ItemID == 0x317F)
                    {
                        DoEffects = true; iWear.ItemID = 0x2FCA; NewName = "elven shield";
                    }
                    else if (iWear.ItemID == 0x2FCA || iWear.ItemID == 0x3180)
                    {
                        DoEffects = true; iWear.ItemID = 0x2FCB; NewName = "guardsman shield";
                    }

                    else if (iWear.ItemID == 0x2643 || iWear.ItemID == 0x2644)
                    {
                        DoEffects = true; iWear.ItemID = 0x1450; NewName = "bone gloves";
                    }
                    else if (iWear.ItemID == 0x1450 || iWear.ItemID == 0x1455)
                    {
                        DoEffects = true; iWear.ItemID = 0x1414; NewName = "platemail gloves";
                    }
                    else if (iWear.ItemID == 0x1414 || iWear.ItemID == 0x1418)
                    {
                        DoEffects = true; iWear.ItemID = 0x2B0C; NewName = "royal bracers";
                    }
                    else if (iWear.ItemID == 0x2B0C || iWear.ItemID == 0x2B0D)
                    {
                        DoEffects = true; iWear.ItemID = 0x13eb; NewName = "ringmail gloves";
                    }
                    else if (iWear.ItemID == 0x13eb || iWear.ItemID == 0x13f2)
                    {
                        DoEffects = true; iWear.ItemID = 0x2643; NewName = "scalemail gloves";
                    }

                    else if (iWear.ItemID == 0x2641 || iWear.ItemID == 0x2642)
                    {
                        DoEffects = true; iWear.ItemID = 0x13BF; NewName = "chainmail tunic";
                    }
                    else if (iWear.ItemID == 0x13BF || iWear.ItemID == 0x13C4)
                    {
                        DoEffects = true; iWear.ItemID = 0x13EC; NewName = "ringmail tunic";
                    }
                    else if (iWear.ItemID == 0x13EC || iWear.ItemID == 0x13ED)
                    {
                        DoEffects = true; iWear.ItemID = 0x1415; NewName = "platemail tunic";
                    }
                    else if (iWear.ItemID == 0x1415 || iWear.ItemID == 0x1416)
                    {
                        DoEffects = true; iWear.ItemID = 0x2B08; NewName = "royal tunic";
                    }
                    else if (iWear.ItemID == 0x2B08 || iWear.ItemID == 0x2B09)
                    {
                        DoEffects = true; iWear.ItemID = 0x277D; NewName = "platemail do";
                    }
                    else if (iWear.ItemID == 0x277D || iWear.ItemID == 0x27C8)
                    {
                        DoEffects = true; iWear.ItemID = 0x2641; NewName = "scalemail tunic";
                    }

                    else if (iWear.ItemID == 0x2B06 || iWear.ItemID == 0x2B07)
                    {
                        DoEffects = true; iWear.ItemID = 0x2647; NewName = "scalemail leggings";
                    }
                    else if (iWear.ItemID == 0x2647 || iWear.ItemID == 0x2648)
                    {
                        DoEffects = true; iWear.ItemID = 0x2788; NewName = "platemail suneate";
                    }
                    else if (iWear.ItemID == 0x2788 || iWear.ItemID == 0x27D3)
                    {
                        DoEffects = true; iWear.ItemID = 0x278D; NewName = "platemail haidate";
                    }
                    else if (iWear.ItemID == 0x278D || iWear.ItemID == 0x27D8)
                    {
                        DoEffects = true; iWear.ItemID = 0x13BE; NewName = "chainmail leggings";
                    }
                    else if (iWear.ItemID == 0x13BE || iWear.ItemID == 0x13C3)
                    {
                        DoEffects = true; iWear.ItemID = 0x13F0; NewName = "ringmail leggings";
                    }
                    else if (iWear.ItemID == 0x13F0 || iWear.ItemID == 0x13F1)
                    {
                        DoEffects = true; iWear.ItemID = 0x1411; NewName = "platemail leggings";
                    }
                    else if (iWear.ItemID == 0x1411 || iWear.ItemID == 0x141A)
                    {
                        DoEffects = true; iWear.ItemID = 0x2B06; NewName = "royal leggings";
                    }

                    else if (iWear.ItemID == 0x2657 || iWear.ItemID == 0x2658)
                    {
                        DoEffects = true; iWear.ItemID = 0x13EE; NewName = "ringmail arms";
                    }
                    else if (iWear.ItemID == 0x13EE || iWear.ItemID == 0x13EF)
                    {
                        DoEffects = true; iWear.ItemID = 0x1410; NewName = "platemail arms";
                    }
                    else if (iWear.ItemID == 0x1410 || iWear.ItemID == 0x1417)
                    {
                        DoEffects = true; iWear.ItemID = 0x2B0A; NewName = "royal arms";
                    }
                    else if (iWear.ItemID == 0x2B0A || iWear.ItemID == 0x2B0B)
                    {
                        DoEffects = true; iWear.ItemID = 0x2780; NewName = "platemail kote";
                    }
                    else if (iWear.ItemID == 0x2780 || iWear.ItemID == 0x27CB)
                    {
                        DoEffects = true; iWear.ItemID = 0x2657; NewName = "scalemail arms";
                    }

                    else if (iWear.ItemID == 0x2779 || iWear.ItemID == 0x27C4)
                    {
                        DoEffects = true; iWear.ItemID = 0x1413; NewName = "platemail gorget";
                    }
                    else if (iWear.ItemID == 0x1413 || iWear.ItemID == 0x264B || iWear.ItemID == 0x264C)
                    {
                        DoEffects = true; iWear.ItemID = 0x2B0E; NewName = "royal gorget";
                    }
                    else if (iWear.ItemID == 0x2B0E || iWear.ItemID == 0x2B0F)
                    {
                        DoEffects = true; iWear.ItemID = 0x2779; NewName = "platemail mempo";
                    }

                    if (DoEffects)
                    {
                        iWear.Name = NewName;
                        from.PlaySound(0x2A);
                        from.SendMessage("The hammer magical transform the armor.");
                    }
                    else
                    {
                        from.SendMessage("This hammer is not really meant to do that.");
                    }
                }
                else
                {
                    from.SendMessage("This hammer is not really meant to do that.");
                }
            }
Пример #29
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_Bag.Deleted)
                {
                    return;
                }

                if (from.Region.IsPartOf(typeof(Regions.Jail)))
                {
                    from.SendMessage("You may not do that in jail.");
                }
                else if (!m_Bag.IsChildOf(from.Backpack))
                {
                    MessageHelper.SendLocalizedMessageTo(m_Bag, from, 1062334, 0x59); // The bag of sending must be in your backpack. 1054107 is gone from client, using generic response
                }
                else if (m_Bag.Charges == 0)
                {
                    MessageHelper.SendLocalizedMessageTo(m_Bag, from, 1042544, 0x59); // This item is out of charges.
                }
                else if (targeted is Item)
                {
                    Item item       = (Item)targeted;
                    int  reqCharges = (int)Math.Max(1, Math.Ceiling(item.TotalWeight / 10.0));

                    if (!item.IsChildOf(from.Backpack))
                    {
                        MessageHelper.SendLocalizedMessageTo(m_Bag, from, 1054152, 0x59); // You may only send items from your backpack to your bank box.
                    }
                    else if (item is BagOfSending || item is Container)
                    {
                        from.Send(new AsciiMessage(m_Bag.Serial, m_Bag.ItemID, MessageType.Regular, 0x3B2, 3, "", "You cannot send a container through the bag of sending."));
                    }
                    else if (item.LootType == LootType.Cursed)
                    {
                        MessageHelper.SendLocalizedMessageTo(m_Bag, from, 1054108, 0x59); // The bag of sending rejects the cursed item.
                    }
                    else if (!item.VerifyMove(from) || item is Server.Engines.Quests.QuestItem)
                    {
                        MessageHelper.SendLocalizedMessageTo(m_Bag, from, 1054109, 0x59); // The bag of sending rejects that item.
                    }
                    else if (Spells.SpellHelper.IsDoomGauntlet(from.Map, from.Location))
                    {
                        from.SendLocalizedMessage(1062089); // You cannot use that here.
                    }
                    else if (!from.BankBox.TryDropItem(from, item, false))
                    {
                        MessageHelper.SendLocalizedMessageTo(m_Bag, from, 1054110, 0x59); // Your bank box is full.
                    }
                    else if (Core.ML && reqCharges > m_Bag.Charges)
                    {
                        from.SendLocalizedMessage(1079932); //You don't have enough charges to send that much weight
                    }
                    else if (SpellHelper.CheckCombat(from))
                    {
                        from.SendAsciiMessage("You cannot use this while in combat");
                    }
                    else
                    {
                        m_Bag.Charges -= (Core.ML ? reqCharges : 1);

                        MessageHelper.SendLocalizedMessageTo(m_Bag, from, 1054150, 0x59); // The item was placed in your bank box.
                    }
                }
            }
Пример #30
0
 public static bool CheckAccessible(Item tool, Mobile m)
 {
     return(tool.IsChildOf(m) || tool.Parent == m);
 }
Пример #31
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted is Item)
                {
                    Item item = (Item)targeted;

                    if (item is IDyable && m_Tub.AllowDyables)
                    {
                        if (!from.InRange(m_Tub.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1))
                        {
                            from.SendLocalizedMessage(500446); // That is too far away.
                        }
                        else if (item.Parent is Mobile)
                        {
                            from.SendLocalizedMessage(500861); // Can't Dye clothing that is being worn.
                        }
                        else
                        {
                            from.PlaySound(0x23E);
                            item.Hue       = m_Tub.DyedHue;
                            m_Tub.Charges -= 1;
                            if (m_Tub.Charges == 0)
                            {
                                from.SendLocalizedMessage(1019073); // This item is out of charges.
                            }
                        }
                    }
                    else if ((FurnitureAttribute.Check(item) || (item is PotionKeg)) && m_Tub.AllowFurniture)
                    {
                        if (!from.InRange(m_Tub.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1))
                        {
                            from.SendLocalizedMessage(500446); // That is too far away.
                        }
                        else
                        {
                            bool okay = (item.IsChildOf(from.Backpack));

                            if (!okay)
                            {
                                if (item.Parent == null)
                                {
                                    BaseHouse house = BaseHouse.FindHouseAt(item);

                                    if (house == null || !house.IsLockedDown(item))
                                    {
                                        from.SendLocalizedMessage(501022); // Furniture must be locked down to paint it.
                                    }
                                    else if (!house.IsCoOwner(from))
                                    {
                                        from.SendLocalizedMessage(501023); // You must be the owner to use this item.
                                    }
                                    else
                                    {
                                        okay = true;
                                    }
                                }
                                else
                                {
                                    from.SendLocalizedMessage(1048135); // The furniture must be in your backpack to be painted.
                                }
                            }

                            if (okay)
                            {
                                from.PlaySound(0x23E);
                                item.Hue       = m_Tub.DyedHue;
                                m_Tub.Charges -= 1;
                                if (m_Tub.Charges == 0)
                                {
                                    from.SendLocalizedMessage(1019073); // This item is out of charges.
                                }
                            }
                        }
                    }
                    else if ((item is Runebook || item is RecallRune) && m_Tub.AllowRunebooks)
                    {
                        if (!from.InRange(m_Tub.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1))
                        {
                            from.SendLocalizedMessage(500446); // That is too far away.
                        }
                        else if (!item.Movable)
                        {
                            from.SendLocalizedMessage(1049776); // You cannot dye runes or runebooks that are locked down.
                        }
                        else
                        {
                            from.PlaySound(0x23E);
                            item.Hue       = m_Tub.DyedHue;
                            m_Tub.Charges -= 1;
                            if (m_Tub.Charges == 0)
                            {
                                from.SendLocalizedMessage(1019073); // This item is out of charges.
                            }
                        }
                    }
                    else if ((item is Spellbook) && m_Tub.AllowSpellbooks)
                    {
                        if (!from.InRange(m_Tub.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1))
                        {
                            from.SendLocalizedMessage(500446); // That is too far away.
                        }
                        else if (!item.Movable)
                        {
                            from.SendMessage("You cannot dye spellbooks that are locked down."); // You cannot dye runes or runebooks that are locked down.
                        }
                        else
                        {
                            from.PlaySound(0x23E);
                            item.Hue       = m_Tub.DyedHue;
                            m_Tub.Charges -= 1;
                            if (m_Tub.Charges == 0)
                            {
                                from.SendLocalizedMessage(1019073); // This item is out of charges.
                            }
                        }
                    }
                    else if (item is MonsterStatuette && m_Tub.AllowStatuettes)
                    {
                        if (!from.InRange(m_Tub.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1))
                        {
                            from.SendLocalizedMessage(500446); // That is too far away.
                        }
                        else if (!item.Movable)
                        {
                            from.SendLocalizedMessage(1049779); // You cannot dye statuettes that are locked down.
                        }
                        else
                        {
                            from.PlaySound(0x23E);
                            item.Hue       = m_Tub.DyedHue;
                            m_Tub.Charges -= 1;
                            if (m_Tub.Charges == 0)
                            {
                                from.SendLocalizedMessage(1019073); // This item is out of charges.
                            }
                        }
                    }
                    else if ((item is BaseArmor && (((BaseArmor)item).MaterialType == ArmorMaterialType.Leather || ((BaseArmor)item).MaterialType == ArmorMaterialType.Studded)) && m_Tub.AllowLeather)
                    {
                        if (!from.InRange(m_Tub.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1))
                        {
                            from.SendLocalizedMessage(500446); // That is too far away.
                        }
                        else if (!item.Movable)
                        {
                            from.SendLocalizedMessage(1042419); // You may not dye leather items which are locked down.
                        }
                        else if (item.Parent is Mobile)
                        {
                            from.SendLocalizedMessage(500861); // Can't Dye clothing that is being worn.
                        }
                        else
                        {
                            from.PlaySound(0x23E);
                            item.Hue       = m_Tub.DyedHue;
                            m_Tub.Charges -= 1;
                            if (m_Tub.Charges == 0)
                            {
                                from.SendLocalizedMessage(1019073); // This item is out of charges.
                            }
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(m_Tub.FailMessage);
                    }
                }
                else
                {
                    from.SendLocalizedMessage(m_Tub.FailMessage);
                }
            }
Пример #32
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_Powder.Deleted || m_Powder.UsesRemaining <= 0)
                {
                    from.SendLocalizedMessage(1049086); // You have used up your powder of temperament.
                    return;
                }

                if (targeted is Item)
                {
                    Item item    = (Item)targeted;
                    bool noGo    = false;
                    int  antique = 0;

                    if (!Engines.Craft.Repair.AllowsRepair(item, null) || (item is BaseJewel && !CanPOFJewelry))
                    {
                        from.SendLocalizedMessage(1049083); // You cannot use the powder on that item.
                        return;
                    }

                    #region SA
                    if (item is BaseWeapon)
                    {
                        if (((BaseWeapon)item).Attributes.Brittle > 0 || ((BaseWeapon)item).NegativeAttributes.Brittle > 0)
                        {
                            noGo = true;
                        }
                        antique = ((BaseWeapon)item).NegativeAttributes.Antique;
                    }
                    else if (item is BaseArmor)
                    {
                        if (((BaseArmor)item).Attributes.Brittle > 0 || ((BaseArmor)item).NegativeAttributes.Brittle > 0)
                        {
                            noGo = true;
                        }
                        antique = ((BaseArmor)item).NegativeAttributes.Antique;
                    }
                    else if (item is BaseClothing)
                    {
                        if (((BaseClothing)item).Attributes.Brittle > 0 || ((BaseClothing)item).NegativeAttributes.Brittle > 0)
                        {
                            noGo = true;
                        }
                        antique = ((BaseClothing)item).NegativeAttributes.Antique;
                    }
                    else if (item is BaseJewel)
                    {
                        if (((BaseJewel)item).Attributes.Brittle > 0 || ((BaseJewel)item).NegativeAttributes.Brittle > 0)
                        {
                            noGo = true;
                        }
                        antique = ((BaseJewel)item).NegativeAttributes.Antique;
                    }
                    else if (item is BaseTalisman && ((BaseTalisman)item).Attributes.Brittle > 0)
                    {
                        noGo = true;
                    }
                    if (noGo)
                    {
                        from.SendLocalizedMessage(1149799); //That cannot be used on brittle items.
                        return;
                    }
                    #endregion

                    if (targeted is IDurability)
                    {
                        IDurability wearable = (IDurability)targeted;

                        if (!wearable.CanFortify)
                        {
                            from.SendLocalizedMessage(1049083); // You cannot use the powder on that item.
                            return;
                        }

                        if ((item.IsChildOf(from.Backpack) || item.Parent == from) && m_Powder.IsChildOf(from.Backpack))
                        {
                            int origMaxHP = wearable.MaxHitPoints;
                            int origCurHP = wearable.HitPoints;

                            if (origMaxHP > 0)
                            {
                                int initMaxHP = antique <= 0 ? 255 : antique == 1 ? 250 : antique == 2 ? 200 : 150;

                                wearable.UnscaleDurability();

                                if (wearable.MaxHitPoints < initMaxHP)
                                {
                                    if (antique > 0)
                                    {
                                        wearable.MaxHitPoints = initMaxHP;
                                        wearable.HitPoints   += initMaxHP;
                                    }
                                    else
                                    {
                                        int bonus = initMaxHP - wearable.MaxHitPoints;

                                        if (bonus > 10)
                                        {
                                            bonus = 10;
                                        }

                                        wearable.MaxHitPoints += bonus;
                                        wearable.HitPoints    += bonus;
                                    }

                                    wearable.ScaleDurability();

                                    if (wearable.MaxHitPoints > 255)
                                    {
                                        wearable.MaxHitPoints = 255;
                                    }
                                    if (wearable.HitPoints > 255)
                                    {
                                        wearable.HitPoints = 255;
                                    }

                                    if (wearable.MaxHitPoints > origMaxHP)
                                    {
                                        from.SendLocalizedMessage(1049084); // You successfully use the powder on the item.
                                        from.PlaySound(0x247);

                                        --m_Powder.UsesRemaining;

                                        if (m_Powder.UsesRemaining <= 0)
                                        {
                                            from.SendLocalizedMessage(1049086); // You have used up your powder of fortifying.
                                            m_Powder.Delete();
                                        }

                                        if (antique > 0)
                                        {
                                            if (item is BaseWeapon)
                                            {
                                                ((BaseWeapon)item).NegativeAttributes.Antique++;
                                            }
                                            if (item is BaseArmor)
                                            {
                                                ((BaseArmor)item).NegativeAttributes.Antique++;
                                            }
                                            if (item is BaseJewel)
                                            {
                                                ((BaseJewel)item).NegativeAttributes.Antique++;
                                            }
                                            if (item is BaseClothing)
                                            {
                                                ((BaseClothing)item).NegativeAttributes.Antique++;
                                            }
                                        }
                                    }
                                    else
                                    {
                                        wearable.MaxHitPoints = origMaxHP;
                                        wearable.HitPoints    = origCurHP;
                                        from.SendLocalizedMessage(1049085); // The item cannot be improved any further.
                                    }
                                }
                                else
                                {
                                    from.SendLocalizedMessage(1049085); // The item cannot be improved any further.
                                    wearable.ScaleDurability();
                                }
                            }
                            else
                            {
                                from.SendLocalizedMessage(1049083); // You cannot use the powder on that item.
                            }
                        }
                        else
                        {
                            from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
                        }
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1049083); // You cannot use the powder on that item.
                }
            }
Пример #33
0
        public void OnTarget(Mobile from, object obj)
        {
            if (!IsChildOf(from.Backpack))
            {
                from.SendLocalizedMessage(1042001);                   // That must be in your pack for you to use it.
                return;
            }

            if (obj is IArcaneEquip && obj is Item)
            {
                Item         item = (Item)obj;
                IArcaneEquip eq   = (IArcaneEquip)obj;

                if (!item.IsChildOf(from.Backpack))
                {
                    from.SendLocalizedMessage(1042001);                       // That must be in your pack for you to use it.
                    return;
                }

                int charges = GetChargesFor(from);

                if (eq.IsArcane)
                {
                    if (eq.CurArcaneCharges >= eq.MaxArcaneCharges)
                    {
                        from.SendMessage("That item is already fully charged.");
                    }
                    else
                    {
                        if (eq.CurArcaneCharges <= 0)
                        {
                            item.Hue = DefaultArcaneHue;
                        }

                        if ((eq.CurArcaneCharges + charges) > eq.MaxArcaneCharges)
                        {
                            eq.CurArcaneCharges = eq.MaxArcaneCharges;
                        }
                        else
                        {
                            eq.CurArcaneCharges += charges;
                        }

                        from.SendMessage("You recharge the item.");
                        Delete();
                    }
                }
                else if (from.Skills[SkillName.Tailoring].Value >= 80.0)
                {
                    bool isExceptional = false;

                    if (item is BaseClothing)
                    {
                        isExceptional = (((BaseClothing)item).Quality == ClothingQuality.Exceptional);
                    }
                    else if (item is BaseArmor)
                    {
                        isExceptional = (((BaseArmor)item).Quality == ArmorQuality.Exceptional);
                    }
                    else if (item is BaseWeapon)
                    {
                        isExceptional = (((BaseWeapon)item).Quality == WeaponQuality.Exceptional);
                    }

                    if (isExceptional)
                    {
                        if (item is BaseClothing)
                        {
                            ((BaseClothing)item).Crafter = from;
                        }
                        else if (item is BaseArmor)
                        {
                            ((BaseArmor)item).Crafter = from;
                        }
                        else if (item is BaseWeapon)
                        {
                            ((BaseWeapon)item).Crafter = from;
                        }

                        eq.CurArcaneCharges = eq.MaxArcaneCharges = charges;

                        item.Hue = DefaultArcaneHue;

                        from.SendMessage("You enhance the item with your gem.");
                        Delete();
                    }
                    else
                    {
                        from.SendMessage("Only exceptional items can be enhanced with the gem.");
                    }
                }
                else
                {
                    from.SendMessage("You do not have enough skill in tailoring to enhance the item.");
                }
            }
            else
            {
                from.SendMessage("You cannot use the gem on that.");
            }
        }
Пример #34
0
        public virtual void Open(Mobile from, bool checkSelfLoot)
        {
            if (from.IsStaff() || from.InRange(GetWorldLocation(), 2))
            {
                #region Self Looting
                bool selfLoot = (checkSelfLoot && (from == m_Owner));

                if (selfLoot)
                {
                    SetFlag(CorpseFlag.SelfLooted, true);

                    var items = new List <Item>(Items);

                    bool gathered = false;

                    for (int k = 0; k < EquipItems.Count; ++k)
                    {
                        Item item2 = EquipItems[k];

                        if (!items.Contains(item2) && item2.IsChildOf(from.Backpack))
                        {
                            items.Add(item2);
                            gathered = true;
                        }
                    }

                    bool didntFit = false;

                    Container pack = from.Backpack;

                    bool checkRobe = true;

                    for (int i = 0; !didntFit && i < items.Count; ++i)
                    {
                        Item    item = items[i];
                        Point3D loc  = item.Location;

                        if ((item.Layer == Layer.Hair || item.Layer == Layer.FacialHair) || !item.Movable)
                        {
                            continue;
                        }

                        if (checkRobe)
                        {
                            DeathRobe robe = from.FindItemOnLayer(Layer.OuterTorso) as DeathRobe;

                            if (robe != null)
                            {
                                if (Core.SA)
                                {
                                    robe.Delete();
                                }
                                else
                                {
                                    Map map = from.Map;

                                    if (map != null && map != Map.Internal)
                                    {
                                        robe.MoveToWorld(from.Location, map);
                                    }
                                }
                            }
                        }

                        if (m_EquipItems.Contains(item) && from.EquipItem(item))
                        {
                            gathered = true;
                        }
                        else if (pack != null && pack.CheckHold(from, item, false, true))
                        {
                            item.Location = loc;
                            pack.AddItem(item);
                            gathered = true;
                        }
                        else
                        {
                            didntFit = true;
                        }
                    }

                    if (gathered && !didntFit)
                    {
                        SetFlag(CorpseFlag.Carved, true);

                        if (ItemID == 0x2006)
                        {
                            ProcessDelta();
                            SendRemovePacket();
                            ItemID = Utility.Random(0xECA, 9);                             // bone graphic
                            Hue    = 0;
                            ProcessDelta();
                        }

                        from.PlaySound(0x3E3);
                        from.SendLocalizedMessage(1062471);                         // You quickly gather all of your belongings.
                        items.Clear();
                        m_EquipItems.Clear();
                        return;
                    }

                    if (gathered && didntFit)
                    {
                        from.SendLocalizedMessage(1062472);                         // You gather some of your belongings. The rest remain on the corpse.
                    }
                }
                #endregion

                if (!CheckLoot(from, null))
                {
                    return;
                }

                #region Quests
                PlayerMobile player = from as PlayerMobile;

                if (player != null)
                {
                    QuestSystem qs = player.Quest;

                    if (qs is UzeraanTurmoilQuest)
                    {
                        GetDaemonBoneObjective obj = qs.FindObjective(typeof(GetDaemonBoneObjective)) as GetDaemonBoneObjective;

                        if (obj != null && obj.CorpseWithBone == this && (!obj.Completed || UzeraanTurmoilQuest.HasLostDaemonBone(player)))
                        {
                            Item bone = new QuestDaemonBone();

                            if (player.PlaceInBackpack(bone))
                            {
                                obj.CorpseWithBone = null;
                                player.SendLocalizedMessage(1049341, "", 0x22);
                                // You rummage through the bones and find a Daemon Bone!  You quickly place the item in your pack.

                                if (!obj.Completed)
                                {
                                    obj.Complete();
                                }
                            }
                            else
                            {
                                bone.Delete();
                                player.SendLocalizedMessage(1049342, "", 0x22);
                                // Rummaging through the bones you find a Daemon Bone, but can't pick it up because your pack is too full.  Come back when you have more room in your pack.
                            }

                            return;
                        }
                    }
                    else if (qs is TheSummoningQuest)
                    {
                        VanquishDaemonObjective obj = qs.FindObjective(typeof(VanquishDaemonObjective)) as VanquishDaemonObjective;

                        if (obj != null && obj.Completed && obj.CorpseWithSkull == this)
                        {
                            GoldenSkull sk = new GoldenSkull();

                            if (player.PlaceInBackpack(sk))
                            {
                                obj.CorpseWithSkull = null;
                                player.SendLocalizedMessage(1050022);
                                // For your valor in combating the devourer, you have been awarded a golden skull.
                                qs.Complete();
                            }
                            else
                            {
                                sk.Delete();
                                player.SendLocalizedMessage(1050023);                                 // You find a golden skull, but your backpack is too full to carry it.
                            }
                        }
                    }
                }
                #endregion

                base.OnDoubleClick(from);
            }
            else
            {
                from.SendLocalizedMessage(500446);                 // That is too far away.
                return;
            }
        }
Пример #35
0
            protected override void OnTarget(Mobile from, object target)
            {
                if (m_HuePlating.Deleted || m_HuePlating.RootParent != from)
                {
                    if (from == null)
                    {
                        return;
                    }
                }

                CraftResourceInfo resourceInfo = CraftResources.GetInfo(m_HuePlating.ResourceType);

                if (target is Item)
                {
                    Item item = target as Item;

                    if (!item.IsChildOf(from.Backpack))
                    {
                        from.SendMessage("You must target a wood-based weapon or shield in your backpack.");
                        return;
                    }

                    if (item is BaseWeapon || item is BaseArmor || item is BaseShield)
                    {
                        if (item.PlayerClass != PlayerClass.None)
                        {
                            from.SendMessage("Playerclass items may not be hued with this item.");
                            return;
                        }

                        if (item.LootType == LootType.Newbied || item.LootType == LootType.Blessed)
                        {
                            from.SendMessage("Newbied or blessed items may not be hued with this item.");
                            return;
                        }

                        if (item is BaseWeapon)
                        {
                            BaseWeapon weapon = item as BaseWeapon;

                            if (!(weapon is BaseStaff || weapon is BaseRanged || weapon is Club))
                            {
                                from.SendMessage("Only wood-based weapons may be hued with this item.");
                                return;
                            }
                        }

                        if (item is BaseShield)
                        {
                            BaseShield shield = item as BaseShield;

                            if (!(shield is WoodenShield || shield is WoodenKiteShield))
                            {
                                from.SendMessage("Only wood-based shields may be hued with this item.");
                                return;
                            }
                        }

                        if (item.Hue == resourceInfo.Hue)
                        {
                            from.SendMessage("That item is already that hue.");
                            return;
                        }

                        else
                        {
                            item.Hue = resourceInfo.Hue;
                            from.PlaySound(0x23E);

                            from.SendMessage("You alter the hue of the item.");

                            m_HuePlating.Delete();
                        }
                    }

                    else
                    {
                        from.SendMessage("You must target a wood-based weapon or piece or armor in your backpack.");
                        return;
                    }
                }

                else
                {
                    from.SendMessage("You must target a wood-based weapon or piece or armor in your backpack.");
                    return;
                }
            }