I am trying to create a new Custom attribute list because my AosAttribute list is full and I do not know how to go past 0x80000000 within an enum. So far what I have done will show the new attributes within the custom attribute list but the new attributes are not working properly. So far the only 2 new attributes I am trying to add are crit chance and crit damage. I have attached my files and all the additions i have made are followed by //bojangles custom. Any kind of suggestions would be most helpful. I have been hitting my head against the wall for awhile now and have actually been playing on my server more than messing with any scripts.
 

Attachments

  • AOS.cs
    101.9 KB · Views: 8
  • XmlAosAttributes.cs
    30.6 KB · Views: 16
  • owltrBaseWeapon.cs
    181.3 KB · Views: 10
Thanks to Drake11 for figuring this out, In Aos.cs change the GetValue from this
Code:
/* public static int GetValue(Mobile m, CustomAttribute attribute)
        {
            if (!Core.AOS)
                return 0;

            int value = 0;

            #region Enhancement
            value += Enhancement.GetValue(m, attribute);
            #endregion

           for (int i = 0; i < m.Items.Count; ++i)
            {
                CustomAttributes attrs = RunicReforging.GetCustomAttributes(m.Items[i]);

                if (attrs != null)
             /     value += attrs[attribute];
            }

           value += SkillMasterySpell.GetAttributeBonus(m, attribute);

            return value;
        }*/

to this

Code:
public static int GetValue(Mobile m, CustomAttribute attribute)
        {
            if (!Core.AOS)
                return 0;

            List<Item> items = m.Items;
            int value = 0;

            for (int i = 0; i < items.Count; ++i)
            {
                Item obj = items[i];

                if (obj is BaseArmor)
                {
                    CustomAttributes attrs = ((BaseArmor)obj).CustomAttributes;

                    if (attrs != null)
                        value += attrs[attribute];
                }
                else if (obj is BaseClothing)
                {
                    CustomAttributes attrs = ((BaseClothing)obj).CustomAttributes;

                    if (attrs != null)
                        value += attrs[attribute];
                }
                else if (obj is BaseWeapon)
                {
                    CustomAttributes attrs = ((BaseWeapon)obj).CustomAttributes;

                    if (attrs != null)
                        value += attrs[attribute];
                }
                else if (obj is BaseJewel)
                {
                    CustomAttributes attrs = ((BaseJewel)obj).CustomAttributes;

                    if (attrs != null)
                        value += attrs[attribute];
                }
                else if (obj is BaseQuiver)
                {
                    CustomAttributes attrs = ((BaseQuiver)obj).CustomAttributes;

                    if (attrs != null)
                        value += attrs[attribute];
                }
                else if (obj is BaseTalisman)
                {
                    CustomAttributes attrs = ((BaseTalisman)obj).CustomAttributes;

                    if (attrs != null)
                        value += attrs[attribute];
                }

You will have to go into your base scripts and add in the name of your custom attribute list in a few spots, mainly I did a search for aosattributes within the base script and add in your custom attribute either above it or below it.
 
Known bug found, again thanks to Drake11 for finding it and fixing it. When adding custom attributes to an item for whatever reason only 2 would show at all times, even if more were added from the custom attribute list. Drake11's fix requires Voxpire's Vita Nex. Once you have that installed onto your server your base script will need a few changes.
Code:
using VitaNex.Network;
Will need to be added to the top of you base script.

Code:
var opl = new ExtendedOPL(list);
            int customProp;

if ((customProp = m_CustomAttributes.CritChance) != 0)
                opl.Add("Critical Strike " + customProp.ToString() + "%");

if ((customProp = m_CustomAttributes.CritDamage) != 0)
                opl.Add("Critical Bonus " + customProp.ToString() + "%")

opl.Apply();

This is what your attribute properties should look like. Adding in any other custom attribute of your own should also look like this. For Example this is how mine has turned out so far, and it shows all the custom attributes when i mouse over an item that has more than 2 custom attributes.

Code:
 int prop;
         
            var opl = new ExtendedOPL(list);
            int customProp;
         
            #region ItemID_Mods
            if ( m_Identified )//bojangles itemid
            {
          
            m_NegativeAttributes.GetProperties(list, this);
            m_AosSkillBonuses.GetProperties(list);

            if ((prop = ArtifactRarity) > 0)
                list.Add(1061078, prop.ToString()); // artifact rarity ~1_val~
         
             if ((customProp = m_CustomAttributes.CritChance) != 0)
                opl.Add("Critical Strike " + customProp.ToString() + "%");

            if ((customProp = m_CustomAttributes.SpellCritChance) != 0)
                opl.Add("Spell Critical Strike " + customProp.ToString() + "%");

            if ((customProp = m_CustomAttributes.CritDamage) != 0)
                opl.Add("Critical Bonus " + customProp.ToString() + "%");

            if ((customProp = m_CustomAttributes.SpellCritDamage) != 0)
                opl.Add("Spell Critical Bonus " + customProp.ToString() + "%");

            if ((customProp = m_CustomAttributes.DodgeChance) != 0)
                opl.Add("Dodge " + customProp.ToString() + "%");
         
            opl.Apply();
         
            if (m_TalismanProtection != null && !m_TalismanProtection.IsEmpty && m_TalismanProtection.Amount > 0)
                list.Add(1072387, "{0}\t{1}", m_TalismanProtection.Name != null ? m_TalismanProtection.Name.ToString() : "Unknown", m_TalismanProtection.Amount); // ~1_NAME~ Protection: +~2_val~%

            #region SA
            if ((prop = m_SAAbsorptionAttributes.EaterFire) != 0)
                list.Add(1113593, prop.ToString()); // Fire Eater ~1_Val~%

            if ((prop = m_SAAbsorptionAttributes.EaterCold) != 0)
                list.Add(1113594, prop.ToString()); // Cold Eater ~1_Val~%

            if ((prop = m_SAAbsorptionAttributes.EaterPoison) != 0)
                list.Add(1113595, prop.ToString()); // Poison Eater ~1_Val~%

            if ((prop = m_SAAbsorptionAttributes.EaterEnergy) != 0)
                list.Add(1113596, prop.ToString()); // Energy Eater ~1_Val~%

            if ((prop = m_SAAbsorptionAttributes.EaterKinetic) != 0)
                list.Add(1113597, prop.ToString()); // Kinetic Eater ~1_Val~%

            if ((prop = m_SAAbsorptionAttributes.EaterDamage) != 0)
                list.Add(1113598, prop.ToString()); // Damage Eater ~1_Val~%
 

Attachments

  • 10-03-2018 17.40.28.jpg
    10-03-2018 17.40.28.jpg
    365.1 KB · Views: 82
  • 10-05-2018 19.18.22.jpg
    10-05-2018 19.18.22.jpg
    442.1 KB · Views: 81
The issue you're running into is essentially the same as creating and displaying custom properties in the Properties List.
The issue being that without using Vitanex the only fix is to alter the Clilocs with custom entries to display the custom properties.

However Vitanex is a perfect workaround for your issue, but I recalll @Voxpire saying that even that has limits on how may custom entries can be displayed
 
recalll @Voxpire saying that even that has limits on how may custom entries can be displayed

Code:
		/// <summary>
		/// Empty clilocID list extended with ~1_VAL~ *support should be the same as ~1_NOTHING~
		/// The default settings for an ExtendedOPL instance allows for up to 65 custom cliloc entries.
		/// Capacity is equal to the number of available empty clilocs multiplied by the cliloc break value.
		/// Default: 65 == 13 * 5
		/// Clilocs with multiple argument support will be parsed accordingly.
		/// It is recommended to use clilocs that contain no characters other than the argument placeholders and whitespace.
		/// </summary>
https://github.com/Vita-Nex/Core/blob/master/Network/ExtendedOPL.cs#L48

Usages:

Static instantiation using string format;
Code:
ExtendedOPL.AddTo( list, "Hello World {0}", 123 );

Static instantiation using multiple lines;
Code:
ExtendedOPL.AddTo( list, "Line 1", "Line 2", "Line 3", "Line N+1" );

Local instantiation;
Code:
using( var opl = new ExtendedOPL( list ) )
{
	for(var i = 0; i < 10; i++) // Add 10 lines
		opl.Add( "Line {0}", (Numeral)( i + 1 ) ); // "Line I", "Line II", ..., "Line X"

	opl.AddRange( "Another line!", "And another...", "Will these lines end?" );
}
// 'using' statement exits, calls opl.Dispose() which calls opl.Apply() to flush any remaining data to the list.
Footnote:
opl.Apply() can be called manually at any time to flush the current lines to the list.
This is particularly useful if you need to preserve ordering of normal cliloc additions mixed with custom
lines without using more than one ExtendedOPL object to achieve it.
 
Back