Example #1
0
        public MobileStatus( Mobile beholder, Mobile beheld )
            : base(0x11)
        {
            string name = beheld.Name;

            if ( name == null )
                name = "";

            byte type = 0x0;

            if ( beholder == beheld )
                type = 0x6;

            int size = 0;

            bool isEnhancedClient = beholder.Client != null && beholder.Client.Version.IsEnhanced;

            if ( type == 0 )
                size = 43;
            else if ( isEnhancedClient )
                size = 149;
            else
                size = 121;

            this.EnsureCapacity( size );

            m_Stream.Write( beheld.Serial );

            m_Stream.WriteAsciiFixed( name, 30 );

            if ( type > 0x0 )
                WriteAttr( beheld.Hits, beheld.HitsMax );
            else
                WriteAttrNorm( beheld.Hits, beheld.HitsMax );

            m_Stream.Write( beheld.CanBeRenamedBy( beholder ) );

            m_Stream.Write( type );

            if ( type > 0x0 )
            {
                m_Stream.Write( beheld.Female );

                m_Stream.Write( (short) beheld.Str );
                m_Stream.Write( (short) beheld.Dex );
                m_Stream.Write( (short) beheld.Int );

                WriteAttr( beheld.Stam, beheld.StamMax );
                WriteAttr( beheld.Mana, beheld.ManaMax );

                m_Stream.Write( (int) beheld.TotalGold );
                m_Stream.Write( (short) beheld.PhysicalResistance );
                m_Stream.Write( (short) ( Mobile.BodyWeight + beheld.TotalWeight ) );

                m_Stream.Write( (short) beheld.GetMaxWeight() );
                m_Stream.Write( (byte) ( beheld.Race.RaceID + 1 ) ); // Would be 0x00 if it's a non-ML enabled account but...

                m_Stream.Write( (short) beheld.StatCap );

                m_Stream.Write( (byte) beheld.Followers );
                m_Stream.Write( (byte) beheld.FollowersMax );

                m_Stream.Write( (short) beheld.FireResistance ); // Fire
                m_Stream.Write( (short) beheld.ColdResistance ); // Cold
                m_Stream.Write( (short) beheld.PoisonResistance ); // Poison
                m_Stream.Write( (short) beheld.EnergyResistance ); // Energy
                m_Stream.Write( (short) beheld.Luck ); // Luck

                IWeapon weapon = beheld.Weapon;

                int min = 0, max = 0;

                if ( weapon != null )
                    weapon.GetStatusDamage( beheld, out min, out max );

                m_Stream.Write( (short) min ); // Damage min
                m_Stream.Write( (short) max ); // Damage max

                m_Stream.Write( (int) beheld.TithingPoints );

                if ( type >= 0x6 )
                {
                    m_Stream.Write( (short) beheld.GetMaxResistance( ResistanceType.Physical ) );
                    m_Stream.Write( (short) beheld.GetMaxResistance( ResistanceType.Fire ) );
                    m_Stream.Write( (short) beheld.GetMaxResistance( ResistanceType.Cold ) );
                    m_Stream.Write( (short) beheld.GetMaxResistance( ResistanceType.Poison ) );
                    m_Stream.Write( (short) beheld.GetMaxResistance( ResistanceType.Energy ) );
                    m_Stream.Write( (short) beheld.GetMagicalAttribute( MagicalAttribute.DefendChance ) );
                    m_Stream.Write( (short) 45 ); // Max dci
                    m_Stream.Write( (short) beheld.GetMagicalAttribute( MagicalAttribute.AttackChance ) );
                    m_Stream.Write( (short) beheld.GetMagicalAttribute( MagicalAttribute.WeaponSpeed ) );
                    m_Stream.Write( (short) beheld.GetMagicalAttribute( MagicalAttribute.WeaponDamage ) );
                    m_Stream.Write( (short) beheld.GetMagicalAttribute( MagicalAttribute.LowerRegCost ) );
                    m_Stream.Write( (short) beheld.GetMagicalAttribute( MagicalAttribute.SpellDamage ) );
                    m_Stream.Write( (short) beheld.GetMagicalAttribute( MagicalAttribute.CastRecovery ) );
                    m_Stream.Write( (short) beheld.GetMagicalAttribute( MagicalAttribute.CastSpeed ) );
                    m_Stream.Write( (short) beheld.GetMagicalAttribute( MagicalAttribute.LowerManaCost ) );

                    if ( isEnhancedClient )
                    {
                        m_Stream.Write( (short) beheld.GetMagicalAttribute( MagicalAttribute.RegenHits ) );
                        m_Stream.Write( (short) beheld.GetMagicalAttribute( MagicalAttribute.RegenStam ) );
                        m_Stream.Write( (short) beheld.GetMagicalAttribute( MagicalAttribute.RegenMana ) );
                        m_Stream.Write( (short) beheld.GetMagicalAttribute( MagicalAttribute.ReflectPhysical ) );
                        m_Stream.Write( (short) beheld.GetMagicalAttribute( MagicalAttribute.EnhancePotions ) );
                        m_Stream.Write( (short) beheld.GetStatOffset( StatType.Str ) );
                        m_Stream.Write( (short) beheld.GetStatOffset( StatType.Dex ) );
                        m_Stream.Write( (short) beheld.GetStatOffset( StatType.Int ) );
                        m_Stream.Write( (short) 0 );
                        m_Stream.Write( (short) 0 );
                        m_Stream.Write( (short) 0 );
                        m_Stream.Write( (short) beheld.GetMagicalAttribute( MagicalAttribute.BonusHits ) );
                        m_Stream.Write( (short) beheld.GetMagicalAttribute( MagicalAttribute.BonusStam ) );
                        m_Stream.Write( (short) beheld.GetMagicalAttribute( MagicalAttribute.BonusMana ) );
                    }
                }
            }
        }
Example #2
0
		public static int GetStatus( Mobile from, int index )
		{
			switch ( index )
			{
				// TODO: Account for buffs/debuffs
				case 0: return from.GetMaxResistance( ResistanceType.Physical );
				case 1: return from.GetMaxResistance( ResistanceType.Fire );
				case 2: return from.GetMaxResistance( ResistanceType.Cold );
				case 3: return from.GetMaxResistance( ResistanceType.Poison );
				case 4: return from.GetMaxResistance( ResistanceType.Energy );
				case 5: return AosAttributes.GetValue( from, AosAttribute.DefendChance );
				case 6: return 45;
				case 7: return AosAttributes.GetValue( from, AosAttribute.AttackChance );
				case 8: return AosAttributes.GetValue( from, AosAttribute.WeaponSpeed );
				case 9: return AosAttributes.GetValue( from, AosAttribute.WeaponDamage );
				case 10: return AosAttributes.GetValue( from, AosAttribute.LowerRegCost );
				case 11: return AosAttributes.GetValue( from, AosAttribute.SpellDamage );
				case 12: return AosAttributes.GetValue( from, AosAttribute.CastRecovery );
				case 13: return AosAttributes.GetValue( from, AosAttribute.CastSpeed );
				case 14: return AosAttributes.GetValue( from, AosAttribute.LowerManaCost );
				default: return 0;
			}
		}
Example #3
0
		public static int GetStatus( Mobile from, int index )
		{
			switch ( index )
			{
				// TODO: Account for buffs/debuffs
				case 0: return from.GetMaxResistance( ResistanceType.Physical );
				case 1: return from.GetMaxResistance( ResistanceType.Fire );
				case 2: return from.GetMaxResistance( ResistanceType.Cold );
				case 3: return from.GetMaxResistance( ResistanceType.Poison );
				case 4: return from.GetMaxResistance( ResistanceType.Energy );
                case 5: return Math.Min(45 + BaseArmor.GetRefinedDefenseChance(from), AosAttributes.GetValue(from, AosAttribute.DefendChance));
                case 6: return 45 + BaseArmor.GetRefinedDefenseChance(from);
                case 7: return Math.Min(from.Race == Race.Gargoyle ? 50 : 45, AosAttributes.GetValue(from, AosAttribute.AttackChance));
                case 8: return Math.Min(60, AosAttributes.GetValue(from, AosAttribute.WeaponSpeed));
                case 9: return Math.Min(100, AosAttributes.GetValue(from, AosAttribute.WeaponDamage));
                case 10: return Math.Min(100, AosAttributes.GetValue(from, AosAttribute.LowerRegCost));
                case 11: return AosAttributes.GetValue(from, AosAttribute.SpellDamage);
                case 12: return Math.Min(6, AosAttributes.GetValue(from, AosAttribute.CastRecovery));
                case 13:
                    int max = from.Skills[SkillName.Chivalry].Value < 70.0 ? 4 : 2;
                    if (ProtectionSpell.Registry.ContainsKey(from) /*|| EodonianPotion.IsUnderEffects(m, PotionEffect.Urali)*/)
                    {
                        return Math.Min(max - 2, AosAttributes.GetValue(from, AosAttribute.CastSpeed) - 2);
                    }
                    return Math.Min(max, AosAttributes.GetValue(from, AosAttribute.CastSpeed));
                case 14: return Math.Min(40, AosAttributes.GetValue(from, AosAttribute.LowerManaCost)) + BaseArmor.GetInherentLowerManaCost(from);
				default: return 0;
			}
		}