예제 #1
0
			private static void Turn( Item item, Mobile from )
			{
				if ( item is AddonComponent || item is AddonContainerComponent || item is BaseAddonContainer )
				{
					object addon = null;

					if ( item is AddonComponent )
						addon = ((AddonComponent) item).Addon;
					else if ( item is AddonContainerComponent )
						addon = ((AddonContainerComponent) item).Addon;
					else if ( item is BaseAddonContainer )
						addon = (BaseAddonContainer) item;

					FlipableAddonAttribute[] aAttributes = (FlipableAddonAttribute[]) addon.GetType().GetCustomAttributes( typeof( FlipableAddonAttribute ), false );

					if ( aAttributes.Length > 0 )
					{
						aAttributes[ 0 ].Flip( from, (Item) addon );
						return;
					}
				}

				FlipableAttribute[] attributes = (FlipableAttribute[]) item.GetType().GetCustomAttributes( typeof( FlipableAttribute ), false );

				if ( attributes.Length > 0 )
					attributes[ 0 ].Flip( item );
				else
					from.SendLocalizedMessage( 1042273 ); // You cannot turn that.
			}
예제 #2
0
 private static bool IsKingsCollection(Item item)
 {
     return(m_KingsCollectionTypes.Any(t => t == item.GetType()));
 }
예제 #3
0
        private bool Resmelt(Mobile from, Item item, CraftResource resource)
        {
            try
            {
                if (CraftResources.GetType(resource) != CraftResourceType.Metal)
                {
                    return(false);
                }

                var info = CraftResources.GetInfo(resource);

                if (info == null || info.ResourceTypes.Length == 0)
                {
                    return(false);
                }

                var craftItem = DefBlacksmithy.CraftSystem.CraftItems.SearchFor(item.GetType());

                if (craftItem == null || craftItem.Resources.Count == 0)
                {
                    return(false);
                }

                var craftResource = craftItem.Resources[0];

                if (craftResource.Amount < 2)
                {
                    return(false); // Not enough metal to resmelt
                }

                var difficulty = resource switch
                {
                    CraftResource.DullCopper => 65.0,
                    CraftResource.ShadowIron => 70.0,
                    CraftResource.Copper => 75.0,
                    CraftResource.Bronze => 80.0,
                    CraftResource.Gold => 85.0,
                    CraftResource.Agapite => 90.0,
                    CraftResource.Verite => 95.0,
                    CraftResource.Valorite => 99.0,
                    _ => 0.0
                };

                var ingot = info.ResourceTypes[0].CreateInstance <Item>();

                if (item is DragonBardingDeed || item is BaseArmor armor && armor.PlayerConstructed ||
                    item is BaseWeapon weapon && weapon.PlayerConstructed ||
                    item is BaseClothing clothing && clothing.PlayerConstructed)
                {
                    var mining = from.Skills.Mining.Value;
                    if (mining > 100.0)
                    {
                        mining = 100.0;
                    }

                    var amount = ((4 + mining) * craftResource.Amount - 4) * 0.0068;
                    if (amount < 2)
                    {
                        ingot.Amount = 2;
                    }
                    else
                    {
                        ingot.Amount = (int)amount;
                    }
                }
                else
                {
                    ingot.Amount = 2;
                }

                if (difficulty > from.Skills.Mining.Value)
                {
                    m_Failure = true;
                    ingot.Delete();
                }
                else
                {
                    item.Delete();
                }

                from.AddToBackpack(ingot);

                from.PlaySound(0x2A);
                from.PlaySound(0x240);

                return(true);
            }
예제 #4
0
        public override bool OnEquip(Mobile from)
        {
            Item shirt = from.FindItemOnLayer(Layer.InnerTorso);
            Item glove = from.FindItemOnLayer(Layer.Gloves);
            Item pants = from.FindItemOnLayer(Layer.Pants);
            Item helm  = from.FindItemOnLayer(Layer.Helm);
            Item neck  = from.FindItemOnLayer(Layer.Neck);

            if (shirt != null && shirt.GetType() == typeof(MyrmidonChest) && glove != null && glove.GetType() == typeof(MyrmidonGloves) && pants != null && pants.GetType() == typeof(MyrmidonLegs) && helm != null && helm.GetType() == typeof(MyrmidonHelm) && neck != null && neck.GetType() == typeof(MyrmidonGorget))
            {
                Effects.PlaySound(from.Location, from.Map, 503);
                from.FixedParticles(0x376A, 9, 32, 5030, EffectLayer.Waist);

                Hue = 0x2CA;
                ArmorAttributes.SelfRepair = 3;
                PhysicalBonus = 3;
                FireBonus     = 3;
                ColdBonus     = 3;
                PoisonBonus   = 3;
                EnergyBonus   = 3;


                MyrmidonChest  chest  = from.FindItemOnLayer(Layer.InnerTorso) as MyrmidonChest;
                MyrmidonGloves gloves = from.FindItemOnLayer(Layer.Gloves) as MyrmidonGloves;
                MyrmidonLegs   legs   = from.FindItemOnLayer(Layer.Pants) as MyrmidonLegs;
                MyrmidonHelm   helmet = from.FindItemOnLayer(Layer.Helm) as MyrmidonHelm;
                MyrmidonGorget gorget = from.FindItemOnLayer(Layer.Neck) as MyrmidonGorget;

                chest.Hue = 0x2CA;
                chest.Attributes.NightSight      = 1;
                chest.Attributes.Luck            = 500;
                chest.ArmorAttributes.SelfRepair = 3;
                chest.PhysicalBonus = 3;
                chest.FireBonus     = 3;
                chest.ColdBonus     = 3;
                chest.PoisonBonus   = 3;
                chest.EnergyBonus   = 3;

                gloves.Hue = 0x2CA;
                gloves.ArmorAttributes.SelfRepair = 3;
                gloves.PhysicalBonus = 3;
                gloves.FireBonus     = 3;
                gloves.ColdBonus     = 3;
                gloves.PoisonBonus   = 3;
                gloves.EnergyBonus   = 3;

                legs.Hue = 0x2CA;
                legs.ArmorAttributes.SelfRepair = 3;
                legs.PhysicalBonus = 3;
                legs.FireBonus     = 3;
                legs.ColdBonus     = 3;
                legs.PoisonBonus   = 3;
                legs.EnergyBonus   = 3;

                helmet.Hue = 0x2CA;
                helmet.ArmorAttributes.SelfRepair = 3;
                helmet.PhysicalBonus = 3;
                helmet.FireBonus     = 3;
                helmet.ColdBonus     = 3;
                helmet.PoisonBonus   = 3;
                helmet.EnergyBonus   = 3;

                gorget.Hue = 0x2CA;
                gorget.ArmorAttributes.SelfRepair = 3;
                gorget.PhysicalBonus = 3;
                gorget.FireBonus     = 3;
                gorget.ColdBonus     = 3;
                gorget.PoisonBonus   = 3;
                gorget.EnergyBonus   = 3;

                from.SendLocalizedMessage(1072391);
            }
            this.InvalidateProperties();
            return(base.OnEquip(from));
        }
예제 #5
0
        protected override void GenerateTreasure()
        {
            DropItem(new Gold(600, 900));

            ArrayList gems = new ArrayList();

            for (int i = 0; i < 9; i++)
            {
                Item gem     = Loot.RandomGem();
                Type gemType = gem.GetType();

                foreach (Item listGem in gems)
                {
                    if (listGem.GetType() == gemType)
                    {
                        listGem.Amount++;
                        gem.Delete();
                        break;
                    }
                }

                if (!gem.Deleted)
                {
                    gems.Add(gem);
                }
            }

            foreach (Item gem in gems)
            {
                DropItem(gem);
            }


            if (0.2 > Utility.RandomDouble())
            {
                DropItem(new BagOfReagents(50));
            }

            for (int i = 0; i < 2; i++)
            {
                Item item;

                if (Core.AOS)
                {
                    item = Loot.RandomArmorOrShieldOrWeaponOrJewelry();
                }
                else
                {
                    item = Loot.RandomArmorOrShieldOrWeapon();
                }

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

                    if (Core.AOS)
                    {
                        int attributeCount;
                        int min, max;

                        GetRandomAOSStats(out attributeCount, out min, out max);

                        BaseRunicTool.ApplyAttributesTo(weapon, attributeCount, min, max);
                    }
                    else
                    {
                        weapon.DamageLevel     = (WeaponDamageLevel)Utility.Random(6);
                        weapon.AccuracyLevel   = (WeaponAccuracyLevel)Utility.Random(6);
                        weapon.DurabilityLevel = (WeaponDurabilityLevel)Utility.Random(6);
                    }

                    DropItem(item);
                }
                else if (item is BaseArmor)
                {
                    BaseArmor armor = (BaseArmor)item;

                    if (Core.AOS)
                    {
                        int attributeCount;
                        int min, max;

                        GetRandomAOSStats(out attributeCount, out min, out max);

                        BaseRunicTool.ApplyAttributesTo(armor, attributeCount, min, max);
                    }
                    else
                    {
                        armor.ProtectionLevel = (ArmorProtectionLevel)Utility.Random(6);
                        armor.Durability      = (ArmorDurabilityLevel)Utility.Random(6);
                    }

                    DropItem(item);
                }
                else if (item is BaseJewel)
                {
                    int attributeCount;
                    int min, max;

                    GetRandomAOSStats(out attributeCount, out min, out max);

                    BaseRunicTool.ApplyAttributesTo((BaseJewel)item, attributeCount, min, max);

                    DropItem(item);
                }
            }

            Solution = new PuzzleChestSolution();
        }
예제 #6
0
            protected override void OnTarget(Mobile from, object target)
            {
                Item item = target as Item;
                Type type = item.GetType();

                if (item is BaseArmor || item is BaseHat || item is BaseWeapon)
                {
                    if (Runescribing.GetProps(item) >= 7)
                    {
                        from.SendMessage("This item cannot be enhanced any further");
                    }
                    else if (item.ChantSlots >= 3)
                    {
                        from.SendMessage("This item cannot handle any more enhancments.");
                    }
                    else if (Runescribing.CheckBlacklist(type) == true)
                    {
                        from.SendMessage("This item cannot be enhanced.");
                    }
                    else
                    {
                        int value = m_Rune.BaseAmount;
                        int max   = m_Rune.MaxAmount;

                        if (item is BaseArmor)
                        {
                            BaseArmor i = item as BaseArmor;

                            if (i.ArmorAttributes.SelfRepair + value <= max)
                            {
                                i.ArmorAttributes.SelfRepair += value;
                            }
                            else
                            {
                                i.ArmorAttributes.SelfRepair = max;
                            }
                        }

                        if (item is BaseHat)
                        {
                            BaseHat i = item as BaseHat;

                            if (i.ClothingAttributes.SelfRepair + value <= max)
                            {
                                i.ClothingAttributes.SelfRepair += value;
                            }
                            else
                            {
                                i.ClothingAttributes.SelfRepair = max;
                            }
                        }

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

                            if (i.WeaponAttributes.SelfRepair + value <= max)
                            {
                                i.WeaponAttributes.SelfRepair += value;
                            }
                            else
                            {
                                i.WeaponAttributes.SelfRepair = max;
                            }
                        }

                        item.ChantSlots += 1;
                        m_Rune.Delete();
                    }
                }
                else
                {
                    from.SendMessage("You cannot use this enhancement on that.");
                }
            }