Server.AosAttributes.GetValue C# (CSharp) Méthode

GetValue() public static méthode

public static GetValue ( Server.Mobile m, AosAttribute attribute ) : int
m Server.Mobile
attribute AosAttribute
Résultat int
        public static int GetValue( Mobile m, AosAttribute 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 BaseWeapon )
                {
                    AosAttributes attrs = ((BaseWeapon)obj).Attributes;

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

                    if( attribute == AosAttribute.Luck )
                        value += ((BaseWeapon)obj).GetLuckBonus();
                }
                else if( obj is BaseArmor )
                {
                    AosAttributes attrs = ((BaseArmor)obj).Attributes;

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

                    if( attribute == AosAttribute.Luck )
                        value += ((BaseArmor)obj).GetLuckBonus();
                }
                else if( obj is BaseJewel )
                {
                    AosAttributes attrs = ((BaseJewel)obj).Attributes;

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

                    if( attrs != null )
                        value += attrs[attribute];
                }
                else if( obj is Spellbook )
                {
                    AosAttributes attrs = ((Spellbook)obj).Attributes;

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

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

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

            return value;
        }

Usage Example

Exemple #1
0
 public static int GetStatus(Mobile from, int index)
 {
     return(index switch
     {
         // TODO: Account for buffs/debuffs
         0 => from.GetMaxResistance(ResistanceType.Physical),
         1 => from.GetMaxResistance(ResistanceType.Fire),
         2 => from.GetMaxResistance(ResistanceType.Cold),
         3 => from.GetMaxResistance(ResistanceType.Poison),
         4 => from.GetMaxResistance(ResistanceType.Energy),
         5 => AosAttributes.GetValue(from, AosAttribute.DefendChance),
         6 => 45,
         7 => AosAttributes.GetValue(from, AosAttribute.AttackChance),
         8 => AosAttributes.GetValue(from, AosAttribute.WeaponSpeed),
         9 => AosAttributes.GetValue(from, AosAttribute.WeaponDamage),
         10 => AosAttributes.GetValue(from, AosAttribute.LowerRegCost),
         11 => AosAttributes.GetValue(from, AosAttribute.SpellDamage),
         12 => AosAttributes.GetValue(from, AosAttribute.CastRecovery),
         13 => AosAttributes.GetValue(from, AosAttribute.CastSpeed),
         14 => AosAttributes.GetValue(from, AosAttribute.LowerManaCost),
         _ => 0
     });
All Usage Examples Of Server.AosAttributes::GetValue