Beispiel #1
0
        public static ConfirmationGump SelectProp(Mobile from, Item item, BaseAttrInfo propToImbue)
        {
            PropCollection props         = new PropCollection(item);
            BaseAttrInfo   propToReplace = Imbuing.GetReplaced(propToImbue, props);

            int totalProperties = props.Count;
            int totalIntensity  = props.WeightedIntensity;

            if (propToReplace == null)
            {
                totalProperties++;
            }
            else
            {
                totalIntensity -= (int)(Imbuing.ComputeIntensity(item, propToReplace) * propToReplace.Weight);
            }

            if (totalProperties > 5 || totalIntensity > ((IImbuable)item).MaxIntensity)
            {
                from.SendLocalizedMessage(1079772);                   // You cannot imbue this item with any more item properties.
                from.EndAction(typeof(Imbuing));
                return(null);
            }
            else
            {
                return(new ConfirmationGump(from, item, props, propToImbue, propToReplace, 1, Imbuing.GetIntensitySteps(propToImbue)));
            }
        }
Beispiel #2
0
        public static void AddContext(Mobile m, Item item, BaseAttrInfo prop, int intensity)
        {
            if (m_ContextTable.ContainsKey(m))
            {
                m_ContextTable.Remove(m);
            }

            m_ContextTable[m] = new ImbuingContext(item, prop, intensity);
        }
Beispiel #3
0
        public override bool Replaces( BaseAttrInfo otherAttr )
        {
            Type otherType = otherAttr.GetType();

            foreach ( Type type in Imbuing.HitSpellTypes )
            {
                if ( otherType == type )
                    return true;
            }

            return false;
        }
Beispiel #4
0
        public override bool Replaces(BaseAttrInfo otherAttr)
        {
            if (otherAttr is SkillBonusInfo)
            {
                SkillBonusInfo skillAttr = otherAttr as SkillBonusInfo;

                if (m_Skill == skillAttr.Skill || Category == skillAttr.Category)
                {
                    return(true);
                }
            }

            return(false);
        }
Beispiel #5
0
        /// <summary>
        /// Returns the item property from props that newProp replaces, null if it does not replace any.
        /// </summary>
        public static BaseAttrInfo GetReplaced(BaseAttrInfo newProp, PropCollection props)
        {
            foreach (PropCollection.PropEntry entry in props.Properties)
            {
                BaseAttrInfo attr = entry.Property;

                if (newProp.Replaces(attr))
                {
                    return(attr);
                }
            }

            return(null);
        }
Beispiel #6
0
        public override bool Replaces(BaseAttrInfo otherAttr)
        {
            Type otherType = otherAttr.GetType();

            foreach (Type type in Imbuing.HitAreaTypes)
            {
                if (otherType == type)
                {
                    return(true);
                }
            }

            return(false);
        }
Beispiel #7
0
        /// <summary>
        /// Returns the intensity of the given prop on the given item.
        /// </summary>
        /// <param name="checkHold">true if we want to ensure CanHold( item ) is checked, false if we have checked it before.</param>
        public static int ComputeIntensity(Item item, BaseAttrInfo prop, bool checkHold)
        {
            if (checkHold && !prop.CanHold(item))
            {
                return(0);
            }

            int propVal = prop.GetValue(item);

            int total    = GetIntensitySteps(prop);
            int relative = Math.Max(0, 1 + (int)((propVal - prop.MinIntensity) / prop.IntensityInterval));

            int intensity = (int)(100 * ((double)relative / total));

            return(intensity);
        }
Beispiel #8
0
        private static string FormatValue(int value, BaseAttrInfo prop)
        {
            string format;

            switch (prop.Display)
            {
            default:
            case DisplayValue.Value: format = "{0}"; break;

            case DisplayValue.PlusValue: format = "+{0}"; break;

            case DisplayValue.MinusValue: format = "-{0}"; break;

            case DisplayValue.ValuePercentage: format = "{0}%"; break;
            }

            return(string.Format(format, value.ToString()));
        }
Beispiel #9
0
        private SelectPropGump(Item item, List <BaseAttrInfo> props, List <int> categories, int category)
            : base(50, 50)
        {
            m_Item          = item;
            m_Categories    = categories;
            m_AllProperties = props;
            m_Properties    = Filter(props, categories[category]);

            AddPage(0);

            AddBackground(0, 0, 520, 520, 0x13BE);
            AddImageTiled(10, 10, 500, 20, 0xA40);
            AddImageTiled(10, 40, 220, 440, 0xA40);
            AddImageTiled(240, 40, 270, 440, 0xA40);
            AddImageTiled(10, 490, 500, 20, 0xA40);
            AddAlphaRegion(10, 10, 500, 520);

            AddHtmlLocalized(10, 12, 500, 20, 1079588, 0x7FFF, false, false);               // <CENTER>IMBUING MENU</CENTER>

            /*********** Categories *************/
            AddHtmlLocalized(10, 60, 220, 20, 1044010, 0x7FFF, false, false);               // <CENTER>CATEGORIES</CENTER>

            for (int i = 0, yOffset = 0; i < m_Categories.Count; i++, yOffset += 25)
            {
                AddButton(15, 90 + yOffset, 0xFA5, 0xFA6, 101 + i, GumpButtonType.Reply, 0);
                AddHtmlLocalized(50, 92 + yOffset, 450, 20, m_Categories[i], 0x7FFF, false, false);
            }
            /************************************/

            /*********** Selections *************/
            AddHtmlLocalized(240, 60, 270, 20, 1044011, 0x7FFF, false, false);               // <CENTER>SELECTIONS</CENTER>

            for (int i = 0, yOffset = 0; i < m_Properties.Count; i++, yOffset += 20)
            {
                BaseAttrInfo prop = m_Properties[i];

                AddButton(250, 90 + yOffset, 0xFA5, 0xFA6, 201 + i, GumpButtonType.Reply, 0);
                AddHtmlLocalized(295, 92 + yOffset, 200, 20, prop.Name, 0x7FFF, false, false);
            }
            /************************************/

            AddButton(10, 490, 0xFB1, 0xFB2, 0, GumpButtonType.Reply, 0);
            AddHtmlLocalized(45, 492, 450, 20, 1060051, 0x7FFF, false, false);               // CANCEL
        }
Beispiel #10
0
        /// <summary>
        /// Returns if the mobile has the needed ingredientes. If true, it actually consumes them.
        /// </summary>
        public static bool ConsumeResources(Mobile from, BaseAttrInfo prop, int first, int second, int third)
        {
            if (from.Backpack == null)
            {
                return(false);
            }

            // Var declaration
            Dictionary <Type, int> types     = new Dictionary <Type, int>();
            List <Item>            resources = new List <Item>();
            bool hasResources = false;

            hasResources = (first == 0 || AddNeededResource(types, prop.PrimaryResource, first)) &&
                           (second == 0 || AddNeededResource(types, prop.SecondaryResource, second)) &&
                           (third == 0 || AddNeededResource(types, prop.FullResource, third));

            if (hasResources)
            {
                // Have we all the resources needed?
                foreach (KeyValuePair <Type, int> kvp in types)
                {
                    hasResources = hasResources && from.Backpack.GetAmount(kvp.Key) >= kvp.Value;

                    if (!hasResources)
                    {
                        break;
                    }
                }

                if (hasResources)
                {
                    // Yeah! we do: actually consume them.
                    foreach (KeyValuePair <Type, int> kvp in types)
                    {
                        from.Backpack.ConsumeUpTo(kvp.Key, kvp.Value);
                    }
                }
            }

            return(hasResources);
        }
Beispiel #11
0
        public static ConfirmationGump SelectProp( Mobile from, Item item, BaseAttrInfo propToImbue )
        {
            PropCollection props = new PropCollection( item );
            BaseAttrInfo propToReplace = Imbuing.GetReplaced( propToImbue, props );

            int totalProperties = props.Count;
            int totalIntensity = props.WeightedIntensity;

            if ( propToReplace == null )
                totalProperties++;
            else
                totalIntensity -= (int) ( Imbuing.ComputeIntensity( item, propToReplace ) * propToReplace.Weight );

            if ( totalProperties > 5 || totalIntensity > ( (IImbuable) item ).MaxIntensity )
            {
                from.SendLocalizedMessage( 1079772 ); // You cannot imbue this item with any more item properties.
                from.EndAction( typeof( Imbuing ) );
                return null;
            }
            else
                return new ConfirmationGump( from, item, props, propToImbue, propToReplace, 1, Imbuing.GetIntensitySteps( propToImbue ) );
        }
Beispiel #12
0
 public ImbuingContext(Item item, BaseAttrInfo property, int intensity)
 {
     m_Item      = item;
     m_Property  = property;
     m_Intensity = intensity;
 }
Beispiel #13
0
 /// <summary>
 /// Returns the number of intensity steps that the given prop can take.
 /// </summary>
 public static int GetIntensitySteps( BaseAttrInfo prop )
 {
     return Math.Max( 1, 1 + (int) ( ( prop.MaxIntensity - prop.MinIntensity ) / prop.IntensityInterval ) );
 }
Beispiel #14
0
 public PropEntry(BaseAttrInfo prop, int intensity)
 {
     m_Property  = prop;
     m_Intensity = intensity;
 }
Beispiel #15
0
        /// <summary>
        /// Returns the item property from props that newProp replaces, null if it does not replace any.
        /// </summary>
        public static BaseAttrInfo GetReplaced( BaseAttrInfo newProp, PropCollection props )
        {
            foreach ( PropCollection.PropEntry entry in props.Properties )
            {
                BaseAttrInfo attr = entry.Property;

                if ( newProp.Replaces( attr ) )
                    return attr;
            }

            return null;
        }
Beispiel #16
0
 public ImbuingContext( Item item, BaseAttrInfo property, int intensity )
 {
     m_Item = item;
     m_Property = property;
     m_Intensity = intensity;
 }
Beispiel #17
0
 // Return true if this property replaces otherAttr property.
 public virtual bool Replaces( BaseAttrInfo otherAttr )
 {
     return this.GetType() == otherAttr.GetType();
 }
Beispiel #18
0
        /// <summary>
        /// Do the imbuing stuff.
        /// </summary>
        public static void Do( Mobile from, Item item, BaseAttrInfo propToImbue, BaseAttrInfo propToReplace, int value, int wTotalIntensity, int r1, int r2, int r3, double successChance )
        {
            IImbuable imbuable = item as IImbuable;
            int curValue = propToImbue.GetValue( item );

            if ( curValue == value )
                from.SendLocalizedMessage( 1113473 ); // The item already has that property imbued at that intensity.
            else if ( wTotalIntensity > imbuable.MaxIntensity )
                from.SendLocalizedMessage( 1113364 ); // You can not imbue this property on this item at the selected intensity because it will make the item unstable.
            else if ( !Check( from, item ) )
            {
            }
            else if ( !Resources.ConsumeResources( from, propToImbue, r1, r2, r3 ) )
                from.SendLocalizedMessage( 1079773 ); // You do not have enough resources to imbue this item.
            else
            {
                bool success;

                if ( imbuable.TimesImbued >= 20 )
                {
                    from.SendLocalizedMessage( 1113377 ); // Your chance to learn while imbuing this item is diminished, as it has been imbued many times before.
                    success = successChance > Utility.RandomDouble();
                }
                else
                {
                    success = from.CheckSkill( SkillName.Imbuing, successChance );
                }

                Effects.SendPacket( from, from.Map, new GraphicalEffect( EffectType.FixedFrom, from.Serial, Server.Serial.Zero, 0x375A, from.Location, from.Location, 1, 17, true, false ) );
                Effects.SendTargetParticles( from, 0, 1, 0, 0x1593, EffectLayer.Waist );

                if ( success )
                {
                    if ( propToReplace != null )
                        propToReplace.SetValue( item, 0 );

                    propToImbue.SetValue( item, value );

                    if ( item is IArmor )
                        ( (IArmor) item ).ArmorAttributes.SelfRepair = 0;
                    else if ( item is ICloth )
                        ( (ICloth) item ).ClothingAttributes.SelfRepair = 0;
                    else if ( item is IWeapon )
                        ( (IWeapon) item ).WeaponAttributes.SelfRepair = 0;

                    imbuable.OnImbued();
                    imbuable.TimesImbued++;

                    from.SendLocalizedMessage( 1079775 ); // You successfully imbue the item!
                    from.PlaySound( 0x1EB );
                }
                else
                {
                    from.SendLocalizedMessage( 1079774 ); // You attempt to imbue the item, but fail.
                    from.PlaySound( 0x1E4 );
                }

                Timer.DelayCall( TimeSpan.FromSeconds( 1.0 ), new TimerCallback(
                    delegate
                    {
                        from.SendGump( new ImbuingMainGump() );
                    }
                ) );

                return;
            }

            from.EndAction( typeof( Imbuing ) );
        }
Beispiel #19
0
        public static void AddContext( Mobile m, Item item, BaseAttrInfo prop, int intensity )
        {
            if ( m_ContextTable.ContainsKey( m ) )
                m_ContextTable.Remove( m );

            m_ContextTable[m] = new ImbuingContext( item, prop, intensity );
        }
Beispiel #20
0
        /// <summary>
        /// Returns the intensity of the given prop on the given item.
        /// </summary>
        /// <param name="checkHold">true if we want to ensure CanHold( item ) is checked, false if we have checked it before.</param>
        public static int ComputeIntensity( Item item, BaseAttrInfo prop, bool checkHold )
        {
            if ( checkHold && !prop.CanHold( item ) )
                return 0;

            int propVal = prop.GetValue( item );

            int total = GetIntensitySteps( prop );
            int relative = Math.Max( 0, 1 + (int) ( ( propVal - prop.MinIntensity ) / prop.IntensityInterval ) );

            int intensity = (int) ( 100 * ( (double) relative / total ) );

            return intensity;
        }
Beispiel #21
0
 // Return true if this property replaces otherAttr property.
 public virtual bool Replaces(BaseAttrInfo otherAttr)
 {
     return(this.GetType() == otherAttr.GetType());
 }
Beispiel #22
0
 public PropEntry( BaseAttrInfo prop, int intensity )
 {
     m_Property = prop;
     m_Intensity = intensity;
 }
Beispiel #23
0
		public override bool Replaces( BaseAttrInfo otherAttr )
		{
			return otherAttr is SlayerPropInfo;
		}
Beispiel #24
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            Mobile from = sender.Mobile;

            switch (info.ButtonID)
            {
            default:
            case 0:                     // Cancel
            {
                from.EndAction(typeof(Imbuing));

                break;
            }

            case 1:                                 // Imbue Item
            {
                from.SendLocalizedMessage(1079589); // Target an item you wish to imbue.

                from.Target = new ImbueTarget();
                from.Target.BeginTimeout(from, TimeSpan.FromSeconds(10.0));

                break;
            }

            case 2:                                 // Unravel Item
            {
                from.SendLocalizedMessage(1080422); // Target an item you wish to magically unravel.

                from.Target = new UnravelTarget();
                from.Target.BeginTimeout(from, TimeSpan.FromSeconds(10.0));

                break;
            }

            case 3:                     // Imbue Last Item
            {
                Item item = ImbuingContext.GetLastItem(from);

                if (item == null)
                {
                    from.SendLocalizedMessage(1113572);                                       // You haven't imbued anything yet!
                    from.EndAction(typeof(Imbuing));
                }
                else if (Imbuing.Check(from, item))
                {
                    from.SendGump(new SelectPropGump(item));
                }

                break;
            }

            case 4:                     // Reimbue Last
            {
                ImbuingContext context = ImbuingContext.GetContext(from);

                if (context == null)
                {
                    from.SendLocalizedMessage(1113572);                                       // You haven't imbued anything yet!
                    from.EndAction(typeof(Imbuing));
                }
                else
                {
                    ConfirmationGump confirm = SelectPropGump.SelectProp(from, context.Item, context.Property);

                    if (confirm != null)
                    {
                        confirm.ChangeIntensity(from, context.Intensity);
                        confirm.OnResponse(sender, new RelayInfo(302, new int[0], new TextRelay[0]));
                    }
                }

                break;
            }

            case 5:                     // Imbue Last Property
            {
                BaseAttrInfo attribute = ImbuingContext.GetLastProperty(from);

                if (attribute == null)
                {
                    from.SendLocalizedMessage(1113572);                                       // You haven't imbued anything yet!
                    from.EndAction(typeof(Imbuing));
                }
                else
                {
                    from.SendLocalizedMessage(1079589);                                       // Target an item you wish to imbue.

                    from.Target = new ImbueLastPropTarget(attribute);
                    from.Target.BeginTimeout(from, TimeSpan.FromSeconds(10.0));
                }

                break;
            }

            case 6:                                 // Unravel Container
            {
                from.SendLocalizedMessage(1080422); // Target an item you wish to magically unravel.

                from.Target = new UnravelContainerTarget();
                from.Target.BeginTimeout(from, TimeSpan.FromSeconds(10.0));

                break;
            }
            }
        }
Beispiel #25
0
        /// <summary>
        /// Do the imbuing stuff.
        /// </summary>
        public static void Do(Mobile from, Item item, BaseAttrInfo propToImbue, BaseAttrInfo propToReplace, int value, int wTotalIntensity, int r1, int r2, int r3, double successChance)
        {
            IImbuable imbuable = item as IImbuable;
            int       curValue = propToImbue.GetValue(item);

            if (curValue == value)
            {
                from.SendLocalizedMessage(1113473);                   // The item already has that property imbued at that intensity.
            }
            else if (wTotalIntensity > imbuable.MaxIntensity)
            {
                from.SendLocalizedMessage(1113364);                   // You can not imbue this property on this item at the selected intensity because it will make the item unstable.
            }
            else if (!Check(from, item))
            {
            }
            else if (!Resources.ConsumeResources(from, propToImbue, r1, r2, r3))
            {
                from.SendLocalizedMessage(1079773);                   // You do not have enough resources to imbue this item.
            }
            else
            {
                bool success;

                if (imbuable.TimesImbued >= 20)
                {
                    from.SendLocalizedMessage(1113377);                       // Your chance to learn while imbuing this item is diminished, as it has been imbued many times before.
                    success = successChance > Utility.RandomDouble();
                }
                else
                {
                    success = from.CheckSkill(SkillName.Imbuing, successChance);
                }

                Effects.SendPacket(from, from.Map, new GraphicalEffect(EffectType.FixedFrom, from.Serial, Server.Serial.Zero, 0x375A, from.Location, from.Location, 1, 17, true, false));
                Effects.SendTargetParticles(from, 0, 1, 0, 0x1593, EffectLayer.Waist);

                if (success)
                {
                    if (propToReplace != null)
                    {
                        propToReplace.SetValue(item, 0);
                    }

                    propToImbue.SetValue(item, value);

                    if (item is IArmor)
                    {
                        ((IArmor)item).ArmorAttributes.SelfRepair = 0;
                    }
                    else if (item is ICloth)
                    {
                        ((ICloth)item).ClothingAttributes.SelfRepair = 0;
                    }
                    else if (item is IWeapon)
                    {
                        ((IWeapon)item).WeaponAttributes.SelfRepair = 0;
                    }

                    imbuable.OnImbued();
                    imbuable.TimesImbued++;

                    from.SendLocalizedMessage(1079775);                       // You successfully imbue the item!
                    from.PlaySound(0x1EB);
                }
                else
                {
                    from.SendLocalizedMessage(1079774);                       // You attempt to imbue the item, but fail.
                    from.PlaySound(0x1E4);
                }

                Timer.DelayCall(TimeSpan.FromSeconds(1.0), new TimerCallback(
                                    delegate
                {
                    from.SendGump(new ImbuingMainGump());
                }
                                    ));

                return;
            }

            from.EndAction(typeof(Imbuing));
        }
Beispiel #26
0
 /// <summary>
 /// Returns the number of intensity steps that the given prop can take.
 /// </summary>
 public static int GetIntensitySteps(BaseAttrInfo prop)
 {
     return(Math.Max(1, 1 + (int)((prop.MaxIntensity - prop.MinIntensity) / prop.IntensityInterval)));
 }
Beispiel #27
0
 /// <summary>
 /// Returns the intensity of the given prop on the given item.
 /// </summary>
 public static int ComputeIntensity(Item item, BaseAttrInfo prop)
 {
     return(ComputeIntensity(item, prop, true));
 }
Beispiel #28
0
        public override bool Replaces( BaseAttrInfo otherAttr )
        {
            if ( otherAttr is SkillBonusInfo )
            {
                SkillBonusInfo skillAttr = otherAttr as SkillBonusInfo;

                if ( m_Skill == skillAttr.Skill || Category == skillAttr.Category )
                    return true;
            }

            return false;
        }
Beispiel #29
0
 public ImbueLastPropTarget(BaseAttrInfo attribute)
     : base(-1, false, TargetFlags.None)
 {
     m_Attribute = attribute;
 }
Beispiel #30
0
        public ConfirmationGump(Mobile from, Item itemToImbue, PropCollection itemProperties, BaseAttrInfo propToImbue, BaseAttrInfo propToReplace, int intensityStep, int totalSteps)
            : base(50, 50)
        {
            // Var declarations
            int    intensity;                   // intensity of the prop we are imbuing
            int    wIntensity;                  // weighted intensity of the prop we are imbuing
            int    totalIntensity;              // total intensity of all props, weighted
            int    wTotalIntensity;             // total intensity of all props, weighted
            int    totalProperties;             // total number of properties the item will possess when imbued
            string newValueString;              // the new value of the prop we are imbuing

            // Save the parameters.
            m_ItemToImbue         = itemToImbue;
            m_Imbuable            = m_ItemToImbue as IImbuable;
            m_ItemProperties      = itemProperties;
            m_PropToImbue         = propToImbue;
            m_PropToReplace       = propToReplace;
            m_IntensityStep       = intensityStep;
            m_TotalIntensitySteps = totalSteps;

            // Make sure we don't perverse the intensities.
            Utility.FixMinMax(ref m_IntensityStep, 1, m_TotalIntensitySteps);

            // Gets info about the prop that we are going to imbue.
            intensity       = (int)(100 * ((double)m_IntensityStep / m_TotalIntensitySteps));
            wIntensity      = (int)(intensity * m_PropToImbue.Weight);
            totalIntensity  = m_ItemProperties.Intensity + intensity;
            wTotalIntensity = m_ItemProperties.WeightedIntensity + wIntensity;
            totalProperties = m_ItemProperties.Count;

            m_ValueToImbue = ComputeValue(m_IntensityStep, m_TotalIntensitySteps, m_PropToImbue.MinIntensity, m_PropToImbue.MaxIntensity);
            newValueString = FormatValue(m_PropToImbue.Modify(m_ItemToImbue, m_ValueToImbue), m_PropToImbue);

            // **********************
            // Gump Structure
            // **********************
            AddPage(0);

            AddBackground(0, 0, 520, 440, 0x13BE);
            AddImageTiled(10, 10, 500, 20, 0xA40);
            AddImageTiled(10, 40, 245, 140, 0xA40);
            AddImageTiled(265, 40, 245, 140, 0xA40);
            AddImageTiled(10, 190, 245, 140, 0xA40);
            AddImageTiled(265, 190, 245, 140, 0xA40);
            AddImageTiled(10, 340, 500, 60, 0xA40);
            AddImageTiled(10, 410, 500, 20, 0xA40);
            AddAlphaRegion(10, 10, 500, 420);

            AddHtmlLocalized(10, 12, 500, 20, 1079717, 0x7FFF, false, false);               // <CENTER>IMBUING CONFIRMATION</CENTER>

            // **********************
            // Property Info
            // **********************

            AddHtmlLocalized(50, 50, 250, 20, 1114269, 0x7FFF, false, false);               // PROPERTY INFORMATION

            AddHtmlLocalized(25, 80, 390, 20, 1114270, 0x7FFF, false, false);               // Property:
            AddHtmlLocalized(95, 80, 150, 20, m_PropToImbue.Name, 0x7FFF, false, false);

            AddHtmlLocalized(25, 100, 390, 20, 1114271, 0x7FFF, false, false);               // Replaces:
            if (m_PropToReplace != null)
            {
                m_ValueToReplace = m_PropToReplace.GetValue(m_ItemToImbue);

                AddHtmlLocalized(95, 100, 150, 20, m_PropToReplace.Name, 0x7FFF, false, false);

                // The intensity of the property replaced may not count in the total.
                int replaceIntensity = Imbuing.ComputeIntensity(m_ItemToImbue, m_PropToReplace);
                totalIntensity  -= replaceIntensity;
                wTotalIntensity -= (int)(m_PropToReplace.Weight * replaceIntensity);
            }
            else
            {
                // Since we are not replacing any prop, it means we are adding one ^^u
                totalProperties++;
            }

            m_WTotalIntensity = wTotalIntensity;

            AddHtmlLocalized(25, 120, 200, 20, 1114272, 0x7FFF, false, false);               // Weight:
            AddLabel(95, 120, 0x481, String.Format("{0:0.0}x", m_PropToImbue.Weight));

            AddHtmlLocalized(25, 140, 200, 20, 1114273, 0x7FFF, false, false);               // Intensity:
            AddLabel(95, 140, 0x481, String.Format("{0}%", wIntensity));

            AddHtmlLocalized(280, 55, 205, 115, m_PropToImbue.Description, 0x7FFF, false, false);

            // **********************
            // Material Info
            // **********************
            AddHtmlLocalized(100, 200, 80, 20, 1044055, 0x7FFF, false, false);               // <CENTER>MATERIALS</CENTER>

            m_Resources1 = Math.Max(1, (int)(intensity / 20));
            m_Resources2 = Math.Max(1, (int)(intensity / 10));
            m_Resources3 = Math.Max(0, (intensity - 90));

            AddHtmlLocalized(40, 220, 390, 20, (int)m_PropToImbue.PrimaryResource, 0x7FFF, false, false);
            AddLabel(210, 220, 0x481, m_Resources1.ToString());

            AddHtmlLocalized(40, 240, 390, 20, (int)m_PropToImbue.SecondaryResource, 0x7FFF, false, false);
            AddLabel(210, 240, 0x481, m_Resources2.ToString());

            if (m_Resources3 > 0)
            {
                AddHtmlLocalized(40, 260, 390, 20, (int)m_PropToImbue.FullResource, 0x7FFF, false, false);
                AddLabel(210, 260, 0x481, m_Resources3.ToString());
            }

            // **********************
            // Results
            // **********************
            AddHtmlLocalized(350, 200, 65, 20, 1113650, 0x7FFF, false, false);               // RESULTS

            AddHtmlLocalized(280, 220, 140, 20, 1113645, 0x7FFF, false, false);              // Properties:
            AddFractionLabel(430, 220, totalProperties, 5);

            AddHtmlLocalized(280, 240, 260, 20, 1113646, 0x7FFF, false, false);               // Total Property Weight:
            AddFractionLabel(430, 240, wTotalIntensity, m_Imbuable.MaxIntensity);

            AddHtmlLocalized(280, 260, 200, 20, 1113647, 0x7FFF, false, false);               // Times Imbued:
            AddFractionLabel(430, 260, m_Imbuable.TimesImbued, 20);

            // **********************
            // Choose Intensity
            // **********************
            if (m_PropToImbue.MinIntensity != m_PropToImbue.MaxIntensity)
            {
                AddHtmlLocalized(235, 350, 200, 20, 1062300, 0x7FFF, false, false);                   // New Value:
                AddLabel(256, 370, 0x481, newValueString);

                AddButton(179, 372, 0x1464, 0x1464, 310, GumpButtonType.Reply, 0);
                AddButton(187, 372, 0x1466, 0x1466, 310, GumpButtonType.Reply, 0);
                AddLabel(181, 370, 0x0, "<");
                AddLabel(185, 370, 0x0, "<");
                AddLabel(189, 370, 0x0, "<");
                AddButton(199, 372, 0x1464, 0x1464, 314, GumpButtonType.Reply, 0);
                AddButton(207, 372, 0x1466, 0x1466, 314, GumpButtonType.Reply, 0);
                AddLabel(202, 370, 0x0, "<");
                AddLabel(207, 370, 0x0, "<");
                AddButton(221, 372, 0x1464, 0x1464, 311, GumpButtonType.Reply, 0);
                AddButton(229, 372, 0x1466, 0x1466, 311, GumpButtonType.Reply, 0);
                AddLabel(224, 370, 0x0, "<");
                AddButton(280, 372, 0x1464, 0x1464, 312, GumpButtonType.Reply, 0);
                AddButton(288, 372, 0x1466, 0x1466, 312, GumpButtonType.Reply, 0);
                AddLabel(286, 370, 0x0, ">");
                AddButton(300, 372, 0x1464, 0x1464, 315, GumpButtonType.Reply, 0);
                AddButton(308, 372, 0x1466, 0x1466, 315, GumpButtonType.Reply, 0);
                AddLabel(304, 370, 0x0, ">");
                AddLabel(308, 370, 0x0, ">");
                AddButton(320, 372, 0x1464, 0x1464, 313, GumpButtonType.Reply, 0);
                AddButton(328, 372, 0x1466, 0x1466, 313, GumpButtonType.Reply, 0);
                AddLabel(322, 370, 0x0, ">");
                AddLabel(326, 370, 0x0, ">");
                AddLabel(330, 370, 0x0, ">");
            }

            // **********************
            // Self Repair Warning
            // **********************

            bool selfRepair = (m_ItemToImbue is IArmor && ((IArmor)m_ItemToImbue).ArmorAttributes.SelfRepair != 0) ||
                              (m_ItemToImbue is ICloth && ((ICloth)m_ItemToImbue).ClothingAttributes.SelfRepair != 0) ||
                              (m_ItemToImbue is IWeapon && ((IWeapon)m_ItemToImbue).WeaponAttributes.SelfRepair != 0);

            if (selfRepair)
            {
                AddHtmlLocalized(20, 330, 390, 20, 1080417, 0x7FFF, false, false);                   // WARNING! Imbuing will remove Self Repair from this item.
            }
            // **********************
            // Success Chance
            // **********************
            m_SuccessChance = Imbuing.GetSuccessChance(from, m_ItemToImbue, totalIntensity);

            AddHtmlLocalized(300, 300, 250, 20, 1044057, 0x7FFF, false, false);               // Success Chance:
            AddLabel(420, 300, GetSuccessChanceHue(), String.Format("{0:0.0}%", Math.Max(0, (m_SuccessChance * 100))));

            // **********************
            // Are we ready to rock?
            // **********************
            AddButton(15, 410, 0xFA5, 0xFA6, 301, GumpButtonType.Reply, 0);
            AddHtmlLocalized(50, 412, 100, 20, 1114268, 0x7FFF, false, false);               // Back

            AddButton(390, 410, 0xFA5, 0xFA6, 302, GumpButtonType.Reply, 0);
            AddHtmlLocalized(425, 412, 100, 20, 1114267, 0x7FFF, false, false);               // Imbue Item
        }
Beispiel #31
0
 public override bool Replaces(BaseAttrInfo otherAttr)
 {
     return(otherAttr is SlayerPropInfo);
 }
Beispiel #32
0
        /// <summary>
        /// Returns if the mobile has the needed ingredientes. If true, it actually consumes them.
        /// </summary>
        public static bool ConsumeResources( Mobile from, BaseAttrInfo prop, int first, int second, int third )
        {
            if ( from.Backpack == null )
                return false;

            // Var declaration
            Dictionary<Type, int> types = new Dictionary<Type, int>();
            List<Item> resources = new List<Item>();
            bool hasResources = false;

            hasResources = ( first == 0 || AddNeededResource( types, prop.PrimaryResource, first ) )
                        && ( second == 0 || AddNeededResource( types, prop.SecondaryResource, second ) )
                        && ( third == 0 || AddNeededResource( types, prop.FullResource, third ) );

            if ( hasResources )
            {
                // Have we all the resources needed?
                foreach ( KeyValuePair<Type, int> kvp in types )
                {
                    hasResources = hasResources && from.Backpack.GetAmount( kvp.Key ) >= kvp.Value;

                    if ( !hasResources )
                        break;
                }

                if ( hasResources )
                {
                    // Yeah! we do: actually consume them.
                    foreach ( KeyValuePair<Type, int> kvp in types )
                        from.Backpack.ConsumeUpTo( kvp.Key, kvp.Value );
                }
            }

            return hasResources;
        }
Beispiel #33
0
 /// <summary>
 /// Returns the intensity of the given prop on the given item.
 /// </summary>
 public static int ComputeIntensity( Item item, BaseAttrInfo prop )
 {
     return ComputeIntensity( item, prop, true );
 }