Exemplo n.º 1
0
        protected override void OnTarget(Mobile from, object targeted)
        {
            Item item = targeted as Item;

            if (Imbuing.Check(from, item))
            {
                IImbuable imbuable = item as IImbuable;

                if (imbuable != null && m_Attribute.CanHold(item) && Imbuing.ValidateFlags(imbuable.ImbuingFlags, m_Attribute.Flags) && m_Attribute.Validate(item))
                {
                    Gump confirm = SelectPropGump.SelectProp(from, item, m_Attribute);

                    if (confirm != null)
                    {
                        from.SendGump(confirm);
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1114291);                       // You cannot imbue the last property on that item.
                    from.EndAction(typeof(Imbuing));
                }
            }
            else
            {
                from.EndAction(typeof(Imbuing));
            }
        }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
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;
        }