diff --git a/Scripts/Engines/ConPVP/Tournament.cs b/Scripts/Engines/ConPVP/Tournament.cs index cdc6f0575..a219f1df3 100644 --- a/Scripts/Engines/ConPVP/Tournament.cs +++ b/Scripts/Engines/ConPVP/Tournament.cs @@ -2217,7 +2217,7 @@ namespace Server.Engines.ConPVP } case TournyType.Standard: { - if ( partsPerMatch == 2 && (participants.Count % 2) == 1 ) + if ( partsPerMatch >= 2 && participants.Count % partsPerMatch == 1 ) { int lowAdvances = int.MaxValue; diff --git a/Scripts/Items/Misc/Bola.cs b/Scripts/Items/Misc/Bola.cs index a27293c10..12d4e57ea 100644 --- a/Scripts/Items/Misc/Bola.cs +++ b/Scripts/Items/Misc/Bola.cs @@ -36,7 +36,7 @@ namespace Server.Items { from.SendLocalizedMessage( 1049631 ); // This bola is already being used. } - else if ( !Core.AOS && (from.FindItemOnLayer( Layer.OneHanded ) != null || from.FindItemOnLayer( Layer.TwoHanded ) != null) ) + else if ( !HasFreeHands( from ) ) { from.SendLocalizedMessage( 1040015 ); // Your hands must be free to use this } @@ -52,17 +52,6 @@ namespace Server.Items { EtherealMount.StopMounting( from ); - if ( Core.AOS ) { - Item one = from.FindItemOnLayer( Layer.OneHanded ); - Item two = from.FindItemOnLayer( Layer.TwoHanded ); - - if ( one != null ) - from.AddToBackpack( one ); - - if ( two != null ) - from.AddToBackpack( two ); - } - from.Target = new BolaTarget( this ); from.LocalOverheadMessage( MessageType.Emote, 0x3B2, 1049632 ); // * You begin to swing the bola...* from.NonlocalOverheadMessage( MessageType.Emote, 0x3B2, 1049633, from.Name ); // ~1_NAME~ begins to menacingly swing a bola... @@ -115,6 +104,48 @@ namespace Server.Items Timer.DelayCall( TimeSpan.FromSeconds( 2.0 ), new TimerStateCallback( ReleaseBolaLock ), from ); } + private static bool HasFreeHands( Mobile from ) + { + Item one = from.FindItemOnLayer( Layer.OneHanded ); + Item two = from.FindItemOnLayer( Layer.TwoHanded ); + + if ( Core.SE ) + { + Container pack = from.Backpack; + + if ( pack != null ) + { + if ( one != null && one.Movable ) + { + pack.DropItem( one ); + one = null; + } + + if ( two != null && two.Movable ) + { + pack.DropItem( two ); + two = null; + } + } + } + else if ( Core.AOS ) + { + if ( one != null && one.Movable ) + { + from.AddToBackpack( one ); + one = null; + } + + if ( two != null && two.Movable ) + { + from.AddToBackpack( two ); + two = null; + } + } + + return ( one == null && two == null ); + } + public class BolaTarget : Target { private Bola m_Bola; @@ -137,7 +168,7 @@ namespace Server.Items { from.SendLocalizedMessage( 1040019 ); // The bola must be in your pack to use it. } - else if ( !Core.AOS && (from.FindItemOnLayer( Layer.OneHanded ) != null || from.FindItemOnLayer( Layer.TwoHanded ) != null) ) + else if ( !HasFreeHands( from ) ) { from.SendLocalizedMessage( 1040015 ); // Your hands must be free to use this } @@ -160,17 +191,6 @@ namespace Server.Items { EtherealMount.StopMounting( from ); - if ( Core.AOS ) { - Item one = from.FindItemOnLayer( Layer.OneHanded ); - Item two = from.FindItemOnLayer( Layer.TwoHanded ); - - if ( one != null ) - from.AddToBackpack( one ); - - if ( two != null ) - from.AddToBackpack( two ); - } - from.DoHarmful( to ); m_Bola.Consume(); diff --git a/Scripts/Items/Misc/Teleporter.cs b/Scripts/Items/Misc/Teleporter.cs index 53d94e19d..241cbe035 100644 --- a/Scripts/Items/Misc/Teleporter.cs +++ b/Scripts/Items/Misc/Teleporter.cs @@ -910,14 +910,16 @@ namespace Server.Items [Flags] protected enum ConditionFlag { - None = 0x00, - DenyMounted = 0x01, - DenyFollowers = 0x02, - DenyPackContents = 0x04, - DenyHolding = 0x08, - DenyEquipment = 0x10, - DenyTransformed = 0x20, - StaffOnly = 0x40 + None = 0x000, + DenyMounted = 0x001, + DenyFollowers = 0x002, + DenyPackContents = 0x004, + DenyHolding = 0x008, + DenyEquipment = 0x010, + DenyTransformed = 0x020, + StaffOnly = 0x040, + DenyPackEthereals = 0x080, + DeadOnly = 0x100 } private ConditionFlag m_Flags; @@ -971,6 +973,20 @@ namespace Server.Items set { SetFlag(ConditionFlag.StaffOnly, value); InvalidateProperties(); } } + [CommandProperty(AccessLevel.GameMaster)] + public bool DenyPackEthereals + { + get { return GetFlag(ConditionFlag.DenyPackEthereals); } + set { SetFlag(ConditionFlag.DenyPackEthereals, value); InvalidateProperties(); } + } + + [CommandProperty(AccessLevel.GameMaster)] + public bool DeadOnly + { + get { return GetFlag(ConditionFlag.DeadOnly); } + set { SetFlag(ConditionFlag.DeadOnly, value); InvalidateProperties(); } + } + public override bool CanTeleport(Mobile m) { if (!base.CanTeleport(m)) @@ -991,12 +1007,21 @@ namespace Server.Items return false; } - Container pack; + Container pack = m.Backpack; - if (GetFlag(ConditionFlag.DenyPackContents) && (pack = m.Backpack) != null && pack.TotalItems != 0) + if (pack != null) { - m.SendMessage("You must empty your backpack before proceeding."); - return false; + if (GetFlag(ConditionFlag.DenyPackContents) && pack.TotalItems != 0) + { + m.SendMessage("You must empty your backpack before proceeding."); + return false; + } + + if (GetFlag(ConditionFlag.DenyPackEthereals) && (pack.FindItemByType(typeof(EtherealMount)) != null || pack.FindItemByType(typeof(BaseImprisonedMobile)) != null)) + { + m.SendMessage("You must empty your backpack of ethereal mounts before proceeding."); + return false; + } } if (GetFlag(ConditionFlag.DenyHolding) && m.Holding != null) @@ -1034,6 +1059,12 @@ namespace Server.Items return false; } + if (GetFlag(ConditionFlag.DeadOnly) && m.Alive) + { + m.SendLocalizedMessage(1060014); // Only the dead may pass. + return false; + } + return true; } @@ -1057,6 +1088,9 @@ namespace Server.Items if (GetFlag(ConditionFlag.DenyPackContents)) props.Append("
Deny Pack Contents"); + if (GetFlag(ConditionFlag.DenyPackEthereals)) + props.Append("
Deny Pack Ethereals"); + if (GetFlag(ConditionFlag.DenyHolding)) props.Append("
Deny Holding"); @@ -1069,6 +1103,9 @@ namespace Server.Items if (GetFlag(ConditionFlag.StaffOnly)) props.Append("
Staff Only"); + if (GetFlag(ConditionFlag.DeadOnly)) + props.Append("
Dead Only"); + if (props.Length != 0) { props.Remove(0, 4); diff --git a/Scripts/Misc/AOS.cs b/Scripts/Misc/AOS.cs index 304819ca3..834275fbd 100644 --- a/Scripts/Misc/AOS.cs +++ b/Scripts/Misc/AOS.cs @@ -205,6 +205,30 @@ namespace Server { return (input * percent) / 100; } + + 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; + } + } } [Flags] diff --git a/Scripts/Misc/CurrentExpansion.cs b/Scripts/Misc/CurrentExpansion.cs index 82ae8ce56..c7d449389 100644 --- a/Scripts/Misc/CurrentExpansion.cs +++ b/Scripts/Misc/CurrentExpansion.cs @@ -27,6 +27,7 @@ namespace Server PacketHandlers.SingleClickProps = true; // single click for everything is overriden to check object property list Mobile.ActionDelay = TimeSpan.FromSeconds( 1.0 ); + Mobile.AOSStatusHandler = new AOSStatusHandler( AOS.GetStatus ); } } } diff --git a/Scripts/Mobiles/PlayerMobile.cs b/Scripts/Mobiles/PlayerMobile.cs index e098a6e2c..790f2e9c5 100644 --- a/Scripts/Mobiles/PlayerMobile.cs +++ b/Scripts/Mobiles/PlayerMobile.cs @@ -539,7 +539,7 @@ namespace Server.Mobiles foreach ( Mobile m in mobiles ) { - if ( m.Z >= location.Z && m.Z < location.Z + 16 ) + if ( m.Z >= location.Z && m.Z < location.Z + 16 && ( !m.Hidden || m.AccessLevel == AccessLevel.Player ) ) { mobiles.Free(); return false; @@ -737,7 +737,7 @@ namespace Server.Mobiles public override int GetMaxResistance( ResistanceType type ) { if ( AccessLevel > AccessLevel.Player ) - return int.MaxValue; + return 100; int max = base.GetMaxResistance( type ); diff --git a/Server/Mobile.cs b/Server/Mobile.cs index c0b78b0cc..f1574d953 100644 --- a/Server/Mobile.cs +++ b/Server/Mobile.cs @@ -495,6 +495,8 @@ namespace Server public delegate Container CreateCorpseHandler( Mobile from, HairInfo hair, FacialHairInfo facialhair, List initialContent, List equipedItems ); + public delegate int AOSStatusHandler( Mobile from, int index ); + #endregion /// @@ -579,6 +581,14 @@ namespace Server set { m_SkillCheckDirectLocationHandler = value; } } + private static AOSStatusHandler m_AOSStatusHandler; + + public static AOSStatusHandler AOSStatusHandler + { + get { return m_AOSStatusHandler; } + set { m_AOSStatusHandler = value; } + } + #endregion #region Regeneration @@ -1015,6 +1025,11 @@ namespace Server return int.MaxValue; } + public int GetAOSStatus( int index ) + { + return ( m_AOSStatusHandler == null ) ? 0 : m_AOSStatusHandler( this, index ); + } + public virtual void SendPropertiesTo( Mobile from ) { from.Send( PropertyList ); diff --git a/Server/Network/Packets.cs b/Server/Network/Packets.cs index b093752c8..d76517196 100644 --- a/Server/Network/Packets.cs +++ b/Server/Network/Packets.cs @@ -3051,9 +3051,23 @@ namespace Server.Network string name = m.Name; if ( name == null ) name = ""; - bool sendMLExtended = (Core.ML && ns != null && ns.SupportsExpansion( Expansion.ML )); + int type; - this.EnsureCapacity( sendMLExtended ? 91 : 88 ); + if ( Core.HS && ns != null && ns.ExtendedStatus ) + { + type = 6; + EnsureCapacity( 121 ); + } + else if ( Core.ML && ns != null && ns.SupportsExpansion( Expansion.ML ) ) + { + type = 5; + EnsureCapacity( 91 ); + } + else + { + type = Core.AOS ? 4 : 3; + EnsureCapacity( 88 ); + } m_Stream.Write( (int) m.Serial ); m_Stream.WriteAsciiFixed( name, 30 ); @@ -3063,7 +3077,7 @@ namespace Server.Network m_Stream.Write( m.CanBeRenamedBy( m ) ); - m_Stream.Write( (byte)(sendMLExtended ? 0x05 : Core.AOS ? 0x04 : 0x03) ); // type + m_Stream.Write( (byte) type ); m_Stream.Write( m.Female ); @@ -3081,7 +3095,7 @@ namespace Server.Network m_Stream.Write( (short) (Core.AOS ? m.PhysicalResistance : (int)(m.ArmorRating + 0.5)) ); m_Stream.Write( (short) (Mobile.BodyWeight + m.TotalWeight) ); - if( sendMLExtended ) + if ( type >= 5 ) { m_Stream.Write( (short)m.MaxWeight ); m_Stream.Write( (byte)(m.Race.RaceID + 1)); // Would be 0x00 if it's a non-ML enabled account but... @@ -3092,7 +3106,7 @@ namespace Server.Network m_Stream.Write( (byte) m.Followers ); m_Stream.Write( (byte) m.FollowersMax ); - if ( Core.AOS ) + if ( type >= 4 ) { m_Stream.Write( (short) m.FireResistance ); // Fire m_Stream.Write( (short) m.ColdResistance ); // Cold @@ -3112,6 +3126,12 @@ namespace Server.Network m_Stream.Write( (int) m.TithingPoints ); } + + if ( type >= 6 ) + { + for ( int i = 0; i < 15; ++i ) + m_Stream.Write( (short) m.GetAOSStatus( i ) ); + } } } @@ -3126,9 +3146,28 @@ namespace Server.Network string name = beheld.Name; if ( name == null ) name = ""; - bool sendMLExtended = (Core.ML && ns != null && ns.SupportsExpansion( Expansion.ML )); + int type; - this.EnsureCapacity( 43 + (beholder == beheld ? (sendMLExtended ? 48 : 45) : 0) ); + if ( beholder != beheld ) + { + type = 0; + EnsureCapacity( 43 ); + } + else if ( Core.HS && ns != null && ns.ExtendedStatus ) + { + type = 6; + EnsureCapacity( 121 ); + } + else if ( Core.ML && ns != null && ns.SupportsExpansion( Expansion.ML ) ) + { + type = 5; + EnsureCapacity( 91 ); + } + else + { + type = Core.AOS ? 4 : 3; + EnsureCapacity( 88 ); + } m_Stream.Write( beheld.Serial ); @@ -3141,10 +3180,10 @@ namespace Server.Network m_Stream.Write( beheld.CanBeRenamedBy( beholder ) ); - if ( beholder == beheld ) - { - m_Stream.Write( (byte)(sendMLExtended ? 0x05 : Core.AOS ? 0x04 : 0x03) ); // type + m_Stream.Write( (byte) type ); + if ( type > 0 ) + { m_Stream.Write( beheld.Female ); m_Stream.Write( (short) beheld.Str ); @@ -3158,7 +3197,7 @@ namespace Server.Network m_Stream.Write( (short) (Core.AOS ? beheld.PhysicalResistance : (int)(beheld.ArmorRating + 0.5)) ); m_Stream.Write( (short) (Mobile.BodyWeight + beheld.TotalWeight) ); - if( sendMLExtended ) + if ( type >= 5 ) { m_Stream.Write( (short)beheld.MaxWeight ); m_Stream.Write( (byte)(beheld.Race.RaceID + 1) ); // Would be 0x00 if it's a non-ML enabled account but... @@ -3169,7 +3208,7 @@ namespace Server.Network m_Stream.Write( (byte) beheld.Followers ); m_Stream.Write( (byte) beheld.FollowersMax ); - if ( Core.AOS ) + if ( type >= 4 ) { m_Stream.Write( (short) beheld.FireResistance ); // Fire m_Stream.Write( (short) beheld.ColdResistance ); // Cold @@ -3189,10 +3228,12 @@ namespace Server.Network m_Stream.Write( (int) beheld.TithingPoints ); } - } - else - { - m_Stream.Write( (byte) 0x00 ); + + if ( type >= 6 ) + { + for ( int i = 0; i < 15; ++i ) + m_Stream.Write( (short) beheld.GetAOSStatus( i ) ); + } } }