GetFromType() public static method

Returns the CraftResource value for which 'resourceType' uses -or- CraftResource.None if an unregistered type was specified.
public static GetFromType ( Type resourceType ) : CraftResource
resourceType System.Type
return CraftResource
Ejemplo n.º 1
0
        public virtual int OnCraft(int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool, CraftItem craftItem, int resHue)
        {
            this.Quality = (ItemQuality)quality;

            if (makersMark)
            {
                this.Crafter = from;
            }

            if (!craftItem.ForceNonExceptional)
            {
                if (typeRes == null)
                {
                    typeRes = craftItem.Resources.GetAt(0).ItemType;
                }

                Resource = CraftResources.GetFromType(typeRes);
            }

            return(quality);
        }
Ejemplo n.º 2
0
        public virtual int OnCraft(int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool, CraftItem craftItem, int resHue)
        {
            Quality = (ClothingQuality)quality;

            if (makersMark)
            {
                Crafter       = from;
                m_CrafterName = from.Name;
            }

            if (DefaultResource != CraftResource.None)
            {
                Type resourceType = typeRes;

                if (resourceType == null)
                {
                    resourceType = craftItem.Resources.GetAt(0).ItemType;
                }

                Resource = CraftResources.GetFromType(resourceType);
            }
            else
            {
                Hue = resHue;
            }

            PlayerConstructed = true;

            CraftContext context = craftSystem.GetContext(from);

            RareteInit.InitItem(this, quality, Crafter);

            if (context != null && context.DoNotColor)
            {
                Hue = 0;
            }

            return(quality);
        }
Ejemplo n.º 3
0
        public virtual int OnCraft(int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, ITool tool, CraftItem craftItem, int resHue)
        {
            if (quality >= 2)
            {
                m_Exceptional = true;

                if (makersMark)
                {
                    m_Crafter = from;
                }
            }

            if (typeRes == null)
            {
                typeRes = craftItem.Resources.GetAt(0).ItemType;
            }

            CraftResource resource = CraftResources.GetFromType(typeRes);

            Hue = CraftResources.GetHue(resource);

            return(quality);
        }
Ejemplo n.º 4
0
        public override int OnCraft(int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, ITool tool, CraftItem craftItem, int resHue)
        {
            Quality = (ItemQuality)quality;

            PlayerConstructed = true;

            if (makersMark)
            {
                Crafter = from;
            }

            if (!craftItem.ForceNonExceptional)
            {
                if (typeRes == null)
                {
                    typeRes = craftItem.Resources.GetAt(0).ItemType;
                }

                Resource = CraftResources.GetFromType(typeRes);
            }

            return(quality);
        }
Ejemplo n.º 5
0
        public virtual int OnCraft(int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, ITool tool, CraftItem craftItem, int resHue)
        {
            Quality = (ItemQuality)quality;

            PlayerConstructed = true;

            if (makersMark) // Add to CraftItem.cs mark table
            {
                Crafter = from;
            }

            Type resourceType = typeRes;

            if (resourceType == null)
            {
                resourceType = craftItem.Resources.GetAt(0).ItemType;
            }

            Resource = CraftResources.GetFromType(resourceType);
            DistributeMaterialBonus();

            return(quality);
        }
Ejemplo n.º 6
0
        public override int OnCraft(int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool, CraftItem craftItem, int resHue)
        {
            Quality = (ArmorQuality)quality;

            if (makersMark)
            {
                Crafter = from;
            }

            if (!craftItem.ForceNonExceptional)
            {
                Type resourceType = typeRes;

                if (resourceType == null)
                {
                    resourceType = craftItem.Ressources.GetAt(0).ItemType;
                }

                Resource = CraftResources.GetFromType(resourceType);
            }

            PlayerConstructed = true;

            CraftContext context = craftSystem.GetContext(from);

            if (context != null && context.DoNotColor)
            {
                Hue = 0;
            }

            if (Core.AOS && tool is BaseRunicTool)
            {
                ((BaseRunicTool)tool).ApplyAttributesTo(this);
            }

            return(quality);
        }
Ejemplo n.º 7
0
        public virtual int OnCraft(int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool, CraftItem craftItem, int resHue)
        {
            Type resourceType = typeRes;

            if (resourceType == null)
            {
                resourceType = craftItem.Resources.GetAt(0).ItemType;
            }

            this.Resource = CraftResources.GetFromType(resourceType);

            CraftContext context = craftSystem.GetContext(from);

            if (context != null && context.DoNotColor)
            {
                this.Hue = 0;
            }
            else
            {
                this.Hue = resHue;
            }

            return(quality);
        }
Ejemplo n.º 8
0
        public bool OnCraft(bool exceptional, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool, CraftItem craftItem, int resHue)
        {
            Exceptional = exceptional;

            if (makersMark)
            {
                Crafter = from;
            }

            if (DefaultResource != CraftResource.None)
            {
                Type resourceType = typeRes;

                if (resourceType == null)
                {
                    resourceType = craftItem.Ressources.GetAt(0).ItemType;
                }

                Resource = CraftResources.GetFromType(resourceType);
            }
            else
            {
                Hue = resHue;
            }

            PlayerConstructed = true;

            CraftContext context = craftSystem.GetContext(from);

            if (context != null && context.DoNotColor)
            {
                Hue = 0;
            }

            return(exceptional);
        }
Ejemplo n.º 9
0
        public int OnCraft(int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool, CraftItem craftItem, int resHue)
        {
            Quality = (ArmorQuality)quality;

            Crafter = from;

            Type resourceType = typeRes;

            if (resourceType == null)
            {
                resourceType = craftItem.Resources.GetAt(0).ItemType;
            }

            Resource          = CraftResources.GetFromType(resourceType);
            PlayerConstructed = true;

            CraftContext context = craftSystem.GetContext(from);

            RareteInit.InitItem(this, quality, Crafter);

            if (context != null && context.DoNotColor)
            {
                Hue = 0;
            }

            if (Quality == ArmorQuality.Exceptional)
            {
                m_PhysicalBonus++;
            }
            else if (Quality == ArmorQuality.Low)
            {
                m_PhysicalBonus--;
            }

            return(quality);
        }
Ejemplo n.º 10
0
        public bool TryTransmutate(Mobile from, Item dropped)
        {
            BaseHouse house = BaseHouse.FindHouseAt(from);

            if (house != null && house.IsOwner(from))
            {
                CraftResource res = CraftResources.GetFromType(dropped.GetType());

                if (res == Resource)
                {
                    if (dropped.Amount < 3)
                    {
                        from.SendLocalizedMessage(1152634); // There is not enough to transmute
                    }
                    else if (Charges <= 0)
                    {
                        from.SendLocalizedMessage(1152635); // The cauldron's magic is exhausted
                    }
                    else
                    {
                        CraftResourceInfo info = CraftResources.GetInfo(Resource + 1);

                        if (info != null && info.ResourceTypes.Length > 0)
                        {
                            int           toDrop = Math.Min(Charges * 3, dropped.Amount);
                            CraftResource newRes = (CraftResource)(int)res + 1;

                            while (toDrop % 3 != 0)
                            {
                                toDrop--;
                            }

                            int newAmount = toDrop / 3;

                            if (toDrop < dropped.Amount)
                            {
                                dropped.Amount -= toDrop;
                            }
                            else
                            {
                                dropped.Delete();
                            }

                            Item item = Loot.Construct(info.ResourceTypes[0]);

                            if (item != null)
                            {
                                item.Amount = newAmount;
                                from.AddToBackpack(item);

                                from.SendLocalizedMessage(1152636); // The cauldron transmutes the material

                                from.PlaySound(Utility.RandomList(0x22, 0x23));

                                Charges -= newAmount;
                                Components.ForEach(c => c.InvalidateProperties());

                                return(true);
                            }
                        }
                        else
                        {
                            from.SendLocalizedMessage(1152633); // The cauldron cannot transmute that
                        }
                    }
                }
            }
            else
            {
                from.SendLocalizedMessage(1152632); // That is not yours!
            }
            return(false);
        }
Ejemplo n.º 11
0
        public int OnCraft(int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool, CraftItem craftItem, int resHue)
        {
            Type resourceType = typeRes;

            if (resourceType == null)
            {
                resourceType = craftItem.Resources.GetAt(0).ItemType;
            }

            if (!craftItem.ForceNonExceptional)
            {
                this.Resource = CraftResources.GetFromType(resourceType);
            }

            CraftContext context = craftSystem.GetContext(from);

            if (context != null && context.DoNotColor)
            {
                this.Hue = 0;
            }

            if (1 < craftItem.Resources.Count)
            {
                resourceType = craftItem.Resources.GetAt(1).ItemType;

                if (resourceType == typeof(StarSapphire))
                {
                    this.GemType = GemType.StarSapphire;
                }
                else if (resourceType == typeof(Emerald))
                {
                    this.GemType = GemType.Emerald;
                }
                else if (resourceType == typeof(Sapphire))
                {
                    this.GemType = GemType.Sapphire;
                }
                else if (resourceType == typeof(Ruby))
                {
                    this.GemType = GemType.Ruby;
                }
                else if (resourceType == typeof(Citrine))
                {
                    this.GemType = GemType.Citrine;
                }
                else if (resourceType == typeof(Amethyst))
                {
                    this.GemType = GemType.Amethyst;
                }
                else if (resourceType == typeof(Tourmaline))
                {
                    this.GemType = GemType.Tourmaline;
                }
                else if (resourceType == typeof(Amber))
                {
                    this.GemType = GemType.Amber;
                }
                else if (resourceType == typeof(Diamond))
                {
                    this.GemType = GemType.Diamond;
                }
            }

            #region Mondain's Legacy
            this.m_Quality = (ArmorQuality)quality;

            if (makersMark)
            {
                this.m_Crafter = from;
            }
            #endregion

            return(1);
        }
        public int OnCraft(int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool, CraftItem craftItem, int resHue)
        {
            if (Core.ML)
            {
                Quality = (CraftQuality)quality;

                Type resourceType = typeRes;

                if (resourceType == null)
                {
                    resourceType = craftItem.Resources.GetAt(0).ItemType;
                }

                Resource = CraftResources.GetFromType(resourceType);

                CraftContext context = craftSystem.GetContext(from);

                if (context != null && context.DoNotColor)
                {
                    Resource = DefaultResource;
                }

                if (makersMark)
                {
                    Crafter = from;
                }
            }

            if (from.CheckSkill(SkillName.Tinkering, -5.0, 15.0))
            {
                from.SendLocalizedMessage(500636);                   // Your tinker skill was sufficient to make the item lockable.

                Key key = new Key(KeyType.Copper, Key.RandomValue());

                KeyValue = key.KeyValue;
                DropItem(key);

                double tinkering = from.Skills[SkillName.Tinkering].Value;
                int    level     = (int)(tinkering * 0.8);

                RequiredSkill = level - 4;
                LockLevel     = level - 14;
                MaxLockLevel  = level + 35;

                if (LockLevel == 0)
                {
                    LockLevel = -1;
                }
                else if (LockLevel > 95)
                {
                    LockLevel = 95;
                }

                if (RequiredSkill > 95)
                {
                    RequiredSkill = 95;
                }

                if (MaxLockLevel > 95)
                {
                    MaxLockLevel = 95;
                }
            }
            else
            {
                from.SendLocalizedMessage(500637);                   // Your tinker skill was insufficient to make the item lockable.
            }

            return(quality);
        }
Ejemplo n.º 13
0
        public int OnCraft(int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, ITool tool, CraftItem craftItem, int resHue)
        {
            PlayerConstructed = true;

            Type resourceType = typeRes;

            if (resourceType == null)
            {
                resourceType = craftItem.Resources.GetAt(0).ItemType;
            }

            if (!craftItem.ForceNonExceptional)
            {
                Resource = CraftResources.GetFromType(resourceType);
            }

            if (1 < craftItem.Resources.Count)
            {
                resourceType = craftItem.Resources.GetAt(1).ItemType;

                if (resourceType == typeof(StarSapphire))
                {
                    GemType = GemType.StarSapphire;
                }
                else if (resourceType == typeof(Emerald))
                {
                    GemType = GemType.Emerald;
                }
                else if (resourceType == typeof(Sapphire))
                {
                    GemType = GemType.Sapphire;
                }
                else if (resourceType == typeof(Ruby))
                {
                    GemType = GemType.Ruby;
                }
                else if (resourceType == typeof(Citrine))
                {
                    GemType = GemType.Citrine;
                }
                else if (resourceType == typeof(Amethyst))
                {
                    GemType = GemType.Amethyst;
                }
                else if (resourceType == typeof(Tourmaline))
                {
                    GemType = GemType.Tourmaline;
                }
                else if (resourceType == typeof(Amber))
                {
                    GemType = GemType.Amber;
                }
                else if (resourceType == typeof(Diamond))
                {
                    GemType = GemType.Diamond;
                }
            }

            #region Mondain's Legacy
            m_Quality = (ItemQuality)quality;

            if (makersMark)
            {
                m_Crafter = from;
            }
            #endregion

            return(1);
        }
Ejemplo n.º 14
0
        // Genova: suporte ao UO:ML.
        public override int OnCraft(int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool, CraftItem craftItem, int resHue)
        {
            Quality = (ArmorQuality)quality;

            if (makersMark)
            {
                Crafter = from;
            }

            Type resourceType = typeRes;

            if (resourceType == null)
            {
                resourceType = craftItem.Ressources.GetAt(0).ItemType;
            }

            Resource          = CraftResources.GetFromType(resourceType);
            PlayerConstructed = true;

            CraftContext context = craftSystem.GetContext(from);

            if (context != null && context.DoNotColor)
            {
                Hue = 0;
            }

            if (Core.AOS && tool is BaseRunicTool)
            {
                ((BaseRunicTool)tool).ApplyAttributesTo(this);
            }

            switch (Resource)
            {
            case CraftResource.AshWood:
                ArmorAttributes.LowerStatReq += 20;
                break;

            case CraftResource.YewWood:
                Attributes.RegenHits += 1;
                break;

            case CraftResource.Heartwood:
                switch (Utility.Random(7))
                {
                case 0: Attributes.BonusDex += 2; break;

                case 1: Attributes.BonusStr += 2; break;

                case 2: Attributes.ReflectPhysical += 5; break;

                case 3: Attributes.SpellChanneling = 1; Attributes.CastSpeed = -1; break;

                case 4: ArmorAttributes.SelfRepair += 2; break;

                case 5: PhysicalBonus += 5; break;

                case 6: ColdBonus += 3; break;
                }
                break;

            case CraftResource.Bloodwood:
                Attributes.RegenHits += 2;
                Attributes.Luck      += 40;
                break;

            case CraftResource.Frostwood:
                Attributes.SpellChanneling = 1;
                Attributes.CastSpeed       = -1;
                break;
            }

            return(quality);
        }
Ejemplo n.º 15
0
        public int OnCraft(int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool, CraftItem craftItem, int resHue)
        {
            Type resourceType = typeRes;

            if (resourceType == null)
            {
                resourceType = craftItem.Resources.GetAt(0).ItemType;
            }

            if (!craftItem.ForceNonExceptional)
            {
                this.Resource = CraftResources.GetFromType(resourceType);
            }

            CraftContext context = craftSystem.GetContext(from);

            if (context != null && context.DoNotColor)
            {
                this.Hue = 0;
            }

            //daat99 OWLTR start - runic jewels
            if (Core.AOS && tool is BaseRunicTool && OWLTROptionsManager.IsEnabled(OWLTROptionsManager.OPTIONS_ENUM.RECIPE_CRAFT))
            {
                ((BaseRunicTool)tool).ApplyAttributesTo(this);
            }
            //daat99 OWLTR end - reunic jewels

            if (1 < craftItem.Resources.Count)
            {
                resourceType = craftItem.Resources.GetAt(1).ItemType;

                if (resourceType == typeof(StarSapphire))
                {
                    this.GemType = GemType.StarSapphire;
                }
                else if (resourceType == typeof(Emerald))
                {
                    this.GemType = GemType.Emerald;
                }
                else if (resourceType == typeof(Sapphire))
                {
                    this.GemType = GemType.Sapphire;
                }
                else if (resourceType == typeof(Ruby))
                {
                    this.GemType = GemType.Ruby;
                }
                else if (resourceType == typeof(Citrine))
                {
                    this.GemType = GemType.Citrine;
                }
                else if (resourceType == typeof(Amethyst))
                {
                    this.GemType = GemType.Amethyst;
                }
                else if (resourceType == typeof(Tourmaline))
                {
                    this.GemType = GemType.Tourmaline;
                }
                else if (resourceType == typeof(Amber))
                {
                    this.GemType = GemType.Amber;
                }
                else if (resourceType == typeof(Diamond))
                {
                    this.GemType = GemType.Diamond;
                }
            }

            #region Mondain's Legacy
            this.m_Quality = (ArmorQuality)quality;

            if (makersMark)
            {
                this.m_Crafter = from;
            }
            #endregion

            return(1);
        }
Ejemplo n.º 16
0
        public bool OnCraft(bool exceptional, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool, CraftItem craftItem, int resHue)
        {
            Exceptional = exceptional;

            if (makersMark)
            {
                Crafter = from;
            }

            PlayerConstructed = true;

            Type resourceType = typeRes;

            if (resourceType == null)
            {
                resourceType = craftItem.Ressources.GetAt(0).ItemType;
            }

            Resource = CraftResources.GetFromType(resourceType);

            CraftContext context = craftSystem.GetContext(from);

            if (context != null && context.DoNotColor)
            {
                Hue = 0;
            }

            if (1 < craftItem.Ressources.Count)
            {
                resourceType = craftItem.Ressources.GetAt(1).ItemType;

                if (resourceType == typeof(StarSapphire))
                {
                    GemType = GemType.StarSapphire;
                }
                else if (resourceType == typeof(Emerald))
                {
                    GemType = GemType.Emerald;
                }
                else if (resourceType == typeof(Sapphire))
                {
                    GemType = GemType.Sapphire;
                }
                else if (resourceType == typeof(Ruby))
                {
                    GemType = GemType.Ruby;
                }
                else if (resourceType == typeof(Citrine))
                {
                    GemType = GemType.Citrine;
                }
                else if (resourceType == typeof(Amethyst))
                {
                    GemType = GemType.Amethyst;
                }
                else if (resourceType == typeof(Tourmaline))
                {
                    GemType = GemType.Tourmaline;
                }
                else if (resourceType == typeof(Amber))
                {
                    GemType = GemType.Amber;
                }
                else if (resourceType == typeof(Diamond))
                {
                    GemType = GemType.Diamond;
                }
            }

            return(exceptional);
        }
Ejemplo n.º 17
0
        public int OnCraft(int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, ITool tool, CraftItem craftItem, int resHue)
        {
            Quality = (ItemQuality)quality;

            if (makersMark)
            {
                Crafter = from;
            }

            if (!craftItem.ForceNonExceptional)
            {
                if (typeRes == null)
                {
                    typeRes = craftItem.Resources.GetAt(0).ItemType;
                }

                Resource = CraftResources.GetFromType(typeRes);
            }

            if (from.CheckSkill(SkillName.Tinkering, -5.0, 15.0))
            {
                from.SendLocalizedMessage(500636); // Your tinker skill was sufficient to make the item lockable.

                Key key = new Key(KeyType.Copper, Key.RandomValue());

                KeyValue = key.KeyValue;
                DropItem(key);

                double tinkering = from.Skills[SkillName.Tinkering].Value;
                int    level     = (int)(tinkering * 0.8);

                RequiredSkill = level - 4;
                LockLevel     = level - 14;
                MaxLockLevel  = level + 35;

                if (LockLevel == 0)
                {
                    LockLevel = -1;
                }
                else if (LockLevel > 95)
                {
                    LockLevel = 95;
                }

                if (RequiredSkill > 95)
                {
                    RequiredSkill = 95;
                }

                if (MaxLockLevel > 95)
                {
                    MaxLockLevel = 95;
                }
            }
            else
            {
                from.SendLocalizedMessage(500637); // Your tinker skill was insufficient to make the item lockable.
            }

            return(quality);
        }
Ejemplo n.º 18
0
        public virtual int OnCraft(int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool, CraftItem craftItem, int resHue)
        {
            Quality = (ItemQuality)quality;

            if (makersMark) // Add to CraftItem.cs mark table
            {
                Crafter = from;
            }

            Type resourceType = typeRes;

            if (resourceType == null)
            {
                resourceType = craftItem.Resources.GetAt(0).ItemType;
            }

            if (!craftItem.ForceNonExceptional)
            {
                Resource = CraftResources.GetFromType(resourceType);
            }

            CraftContext context = craftSystem.GetContext(from);

            if (context != null && context.DoNotColor)
            {
                Hue = 0;
            }

            if (craftItem != null)
            {
                if (tool is BaseRunicTool)
                {
                    ((BaseRunicTool)tool).ApplyAttributesTo(this);
                }

                CraftResourceInfo resInfo = CraftResources.GetInfo(m_Resource);

                if (resInfo == null)
                {
                    return(quality);
                }

                CraftAttributeInfo attrInfo = resInfo.AttributeInfo;

                if (attrInfo == null)
                {
                    return(quality);
                }

                if (m_Resource != CraftResource.Heartwood)
                {
                    m_AosAttributes.WeaponDamage += attrInfo.WeaponDamage;
                    m_AosAttributes.WeaponSpeed  += attrInfo.WeaponSwingSpeed;
                    m_AosAttributes.AttackChance += attrInfo.WeaponHitChance;
                    m_AosAttributes.RegenHits    += attrInfo.WeaponRegenHits;
                }
                else
                {
                    switch (Utility.Random(6))
                    {
                    case 0: m_AosAttributes.WeaponDamage += attrInfo.WeaponDamage; break;

                    case 1: m_AosAttributes.WeaponSpeed += attrInfo.WeaponSwingSpeed; break;

                    case 2: m_AosAttributes.AttackChance += attrInfo.WeaponHitChance; break;

                    case 3: m_AosAttributes.Luck += attrInfo.WeaponLuck; break;
                    }
                }

                if ((m_Resource == CraftResource.Frostwood || m_Resource == CraftResource.Heartwood) && m_AosAttributes.SpellChanneling == 0)
                {
                    Attributes.SpellChanneling = 1;
                    Attributes.CastSpeed      -= 1;
                }
            }

            return(quality);
        }
Ejemplo n.º 19
0
        public int OnCraft(int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool, CraftItem craftItem, int resHue)
        {
            Type resourceType = typeRes;

            if (resourceType == null)
            {
                resourceType = craftItem.Ressources.GetAt(0).ItemType;
            }

            Resource = CraftResources.GetFromType(resourceType);

            if (Resource == CraftResource.DullCopper)
            {
                Resistances.Physical = Resistances.Physical + 6;
            }
            else if (Resource == CraftResource.ShadowIron)
            {
                Resistances.Physical = Resistances.Physical + 2;
                Resistances.Fire     = Resistances.Fire + 1;
                Resistances.Energy   = Resistances.Energy + 5;
            }
            else if (Resource == CraftResource.Copper)
            {
                Resistances.Physical = Resistances.Physical + 1;
                Resistances.Fire     = Resistances.Fire + 1;
                Resistances.Poison   = Resistances.Poison + 5;
                Resistances.Energy   = Resistances.Energy + 2;
            }
            else if (Resource == CraftResource.Bronze)
            {
                Resistances.Physical = Resistances.Physical + 3;
                Resistances.Cold     = Resistances.Cold + 5;
                Resistances.Poison   = Resistances.Poison + 1;
                Resistances.Energy   = Resistances.Energy + 1;
            }
            else if (Resource == CraftResource.Gold)
            {
                Resistances.Physical = Resistances.Physical + 1;
                Resistances.Cold     = Resistances.Cold + 2;
                Resistances.Fire     = Resistances.Fire + 1;
                Resistances.Energy   = Resistances.Energy + 2;
                Attributes.Luck      = 40;
            }
            else if (Resource == CraftResource.Agapite)
            {
                Resistances.Physical = Resistances.Physical + 2;
                Resistances.Cold     = Resistances.Cold + 2;
                Resistances.Fire     = Resistances.Fire + 3;
                Resistances.Energy   = Resistances.Energy + 2;
                Resistances.Poison   = Resistances.Poison + 2;
            }
            else if (Resource == CraftResource.Verite)
            {
                Resistances.Physical = Resistances.Physical + 3;
                Resistances.Cold     = Resistances.Cold + 3;
                Resistances.Fire     = Resistances.Fire + 3;
                Resistances.Energy   = Resistances.Energy + 1;
                Resistances.Poison   = Resistances.Poison + 3;
            }
            else if (Resource == CraftResource.Valorite)
            {
                Resistances.Physical = Resistances.Physical + 4;
                Resistances.Cold     = Resistances.Cold + 3;
                Resistances.Energy   = Resistances.Energy + 3;
                Resistances.Poison   = Resistances.Poison + 3;
            }
            else if (Resource == CraftResource.Electrum)
            {
                Resistances.Physical = Resistances.Physical + 2;
                Resistances.Fire     = Resistances.Fire + 2;
                Resistances.Cold     = Resistances.Cold + 1;
                Resistances.Energy   = Resistances.Energy + 1;
                Resistances.Poison   = Resistances.Poison + 2;

                Attributes.Luck = 50;
            }

            if (1 < craftItem.Ressources.Count)
            {
                resourceType = craftItem.Ressources.GetAt(1).ItemType;

                if (resourceType == typeof(StarSapphire))
                {
                    GemType = GemType.StarSapphire;

                    if (from.Skills[SkillName.Tinkering].Value > 80)
                    {
                        for (int i = 0; i < 4; ++i)
                        {
                            int rndm = Utility.RandomMinMax(1, 5);
                            switch (rndm)
                            {
                            case 1:
                                ++Resistances.Physical;
                                break;

                            case 2:
                                ++Resistances.Fire;
                                break;

                            case 3:
                                ++Resistances.Cold;
                                break;

                            case 4:
                                ++Resistances.Poison;
                                break;

                            case 5:
                                ++Resistances.Energy;
                                break;
                            }
                        }
                    }
                }
                else if (resourceType == typeof(Emerald))
                {
                    GemType = GemType.Emerald;

                    if (from.Skills[SkillName.Tinkering].Value > 80)
                    {
                        Resistances.Poison = Resistances.Poison + 3;
                    }
                }
                else if (resourceType == typeof(Sapphire))
                {
                    GemType = GemType.Sapphire;

                    if (from.Skills[SkillName.Tinkering].Value > 80)
                    {
                        Resistances.Cold = Resistances.Cold + 3;
                    }
                }
                else if (resourceType == typeof(Ruby))
                {
                    GemType = GemType.Ruby;

                    if (from.Skills[SkillName.Tinkering].Value > 80)
                    {
                        Resistances.Fire = Resistances.Fire + 3;
                    }
                }
                else if (resourceType == typeof(Citrine))
                {
                    GemType = GemType.Citrine;

                    if (from.Skills[SkillName.Tinkering].Value > 80)
                    {
                        int rndm = Utility.RandomMinMax(1, 5);
                        switch (rndm)
                        {
                        case 1:
                            ++Resistances.Physical;
                            break;

                        case 2:
                            ++Resistances.Fire;
                            break;

                        case 3:
                            ++Resistances.Cold;
                            break;

                        case 4:
                            ++Resistances.Poison;
                            break;

                        case 5:
                            ++Resistances.Energy;
                            break;
                        }
                    }
                }
                else if (resourceType == typeof(Amethyst))
                {
                    GemType = GemType.Amethyst;

                    if (from.Skills[SkillName.Tinkering].Value > 80)
                    {
                        Resistances.Energy = Resistances.Energy + 3;
                    }
                }
                else if (resourceType == typeof(Tourmaline))
                {
                    GemType = GemType.Tourmaline;

                    if (from.Skills[SkillName.Tinkering].Value > 80)
                    {
                        for (int i = 0; i < 2; ++i)
                        {
                            int rndm = Utility.RandomMinMax(1, 5);
                            switch (rndm)
                            {
                            case 1:
                                ++Resistances.Physical;
                                break;

                            case 2:
                                ++Resistances.Fire;
                                break;

                            case 3:
                                ++Resistances.Cold;
                                break;

                            case 4:
                                ++Resistances.Poison;
                                break;

                            case 5:
                                ++Resistances.Energy;
                                break;
                            }
                        }
                    }
                }
                else if (resourceType == typeof(Amber))
                {
                    GemType = GemType.Amber;

                    if (from.Skills[SkillName.Tinkering].Value > 80)
                    {
                        Resistances.Physical = Resistances.Physical + 3;
                    }
                }
                else if (resourceType == typeof(Diamond))
                {
                    GemType = GemType.Diamond;

                    if (from.Skills[SkillName.Tinkering].Value > 80)
                    {
                        for (int i = 0; i < 5; ++i)
                        {
                            int rndm = Utility.RandomMinMax(1, 5);
                            switch (rndm)
                            {
                            case 1:
                                ++Resistances.Physical;
                                break;

                            case 2:
                                ++Resistances.Fire;
                                break;

                            case 3:
                                ++Resistances.Cold;
                                break;

                            case 4:
                                ++Resistances.Poison;
                                break;

                            case 5:
                                ++Resistances.Energy;
                                break;
                            }
                        }
                    }
                }
            }

            return(1);
        }
Ejemplo n.º 20
0
        public override int OnCraft(int mark, double quality, bool makersMark, Mobile from, CraftSystem craftSystem,
                                    Type typeRes, BaseTool tool,
                                    CraftItem craftItem, int resHue)
        {
            if (from.CheckSkill(SkillName.Tinkering, -5.0, 15.0))
            {
                from.SendSuccessMessage(500636); // Your tinker skill was sufficient to make the item lockable.

                var key = new Key(KeyType.Copper, Key.RandomValue());

                KeyValue = key.KeyValue;
                DropItem(key);

                var tinkering = from.Skills[SkillName.Tinkering].Value;
                var level     = (int)(tinkering * 0.8);

                RequiredSkill = level - 4;
                LockLevel     = level - 14;
                MaxLockLevel  = level + 35;

                if (LockLevel == 0)
                {
                    LockLevel = -1;
                }
                else if (LockLevel > 95)
                {
                    LockLevel = 95;
                }

                if (RequiredSkill > 95)
                {
                    RequiredSkill = 95;
                }

                if (MaxLockLevel > 95)
                {
                    MaxLockLevel = 95;
                }
            }
            else
            {
                from.SendFailureMessage(500637); // Your tinker skill was insufficient to make the item lockable.
            }

            Mark = (MarkQuality)mark;

            if (makersMark)
            {
                Crafter = from;
            }

            var resourceType = typeRes;

            if (resourceType == null)
            {
                resourceType = craftItem.Resources[0].ItemType;
            }

            Resource = CraftResources.GetFromType(resourceType);

            PlayerConstructed = true;

            var context = craftSystem.GetContext(from);

            if (context != null && context.DoNotColor)
            {
                Hue = 0;
            }

            return(base.OnCraft(mark, quality, makersMark, from, craftSystem, typeRes, tool, craftItem, resHue));
        }
Ejemplo n.º 21
0
        public int OnCraft(int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool, CraftItem craftItem, int resHue)
        {
            Type resourceType = typeRes;

            if (resourceType == null)
            {
                resourceType = craftItem.Resources.GetAt(0).ItemType;
            }

            Resource = CraftResources.GetFromType(resourceType);

            CraftContext context = craftSystem.GetContext(from);

            if (context != null && context.DoNotColor)
            {
                Hue = 0;
            }

            if (1 < craftItem.Resources.Count)
            {
                resourceType = craftItem.Resources.GetAt(1).ItemType;

                if (resourceType == typeof(StarSapphire))
                {
                    GemType = GemType.StarSapphire;
                }
                else if (resourceType == typeof(Emerald))
                {
                    GemType = GemType.Emerald;
                }
                else if (resourceType == typeof(Sapphire))
                {
                    GemType = GemType.Sapphire;
                }
                else if (resourceType == typeof(Ruby))
                {
                    GemType = GemType.Ruby;
                }
                else if (resourceType == typeof(Citrine))
                {
                    GemType = GemType.Citrine;
                }
                else if (resourceType == typeof(Amethyst))
                {
                    GemType = GemType.Amethyst;
                }
                else if (resourceType == typeof(Tourmaline))
                {
                    GemType = GemType.Tourmaline;
                }
                else if (resourceType == typeof(Amber))
                {
                    GemType = GemType.Amber;
                }
                else if (resourceType == typeof(Diamond))
                {
                    GemType = GemType.Diamond;
                }
            }

            return(1);
        }
Ejemplo n.º 22
0
        public int OnCraft(int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, IBaseTool tool, CraftItem craftItem, int resHue)
        {
            if (from.CheckSkill(SkillName.Tinkering, -5.0, 15.0))
            {
                from.SendLocalizedMessage(500636);                   // Your tinker skill was sufficient to make the item lockable.

                Key key = new Key(KeyType.Copper, Key.RandomValue());

                KeyValue = key.KeyValue;
                DropItem(key);

                double tinkering = from.Skills[SkillName.Tinkering].Value;
                int    level     = (int)(tinkering * 0.8);

                RequiredSkill = level - 4;
                LockLevel     = level - 14;
                MaxLockLevel  = level + 35;

                if (LockLevel == 0)
                {
                    LockLevel = -1;
                }
                else if (LockLevel > 95)
                {
                    LockLevel = 95;
                }

                if (RequiredSkill > 95)
                {
                    RequiredSkill = 95;
                }

                if (MaxLockLevel > 95)
                {
                    MaxLockLevel = 95;
                }

                // A tinker trapped box should not explode until it is armed with a key
                Armed = false;
            }
            else
            {
                from.SendLocalizedMessage(500637);                   // Your tinker skill was insufficient to make the item lockable.
            }

            // The lockable containers never took material color into account, so this fixes it
            Type resourceType = typeRes;

            if (resourceType == null)
            {
                resourceType = craftItem.Resources.GetAt(0).ItemType;
            }

            var resource = CraftResources.GetFromType(resourceType);

            CraftContext context = craftSystem.GetContext(from);

            if (context != null && context.DoNotColor)
            {
                Hue = 0;
            }
            else
            {
                Hue = CraftResources.GetHue(resource);
            }

            return(1);
        }