Fixes to bola: thrower+target dismount time is equal, Core.ML is 10s, 4 sec delay from throw to hit victim, dismount info moved to playermobile rather than mount, to prevent exploit.
This commit is contained in:
parent
48e08198fe
commit
2120f4fb5b
5 changed files with 208 additions and 176 deletions
|
|
@ -32,22 +32,6 @@ namespace Server.Mobiles
|
|||
m_InternalItem = new MountItem( this, itemID );
|
||||
}
|
||||
|
||||
public BaseMount( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 1 ); // version
|
||||
|
||||
writer.Write( m_NextMountAbility );
|
||||
|
||||
writer.Write( m_Rider );
|
||||
writer.Write( m_InternalItem );
|
||||
}
|
||||
|
||||
[Hue, CommandProperty( AccessLevel.GameMaster )]
|
||||
public override int Hue
|
||||
{
|
||||
|
|
@ -88,6 +72,23 @@ namespace Server.Mobiles
|
|||
base.OnDelete();
|
||||
}
|
||||
|
||||
public BaseMount( Serial serial )
|
||||
: base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( ( int )1 ); // version
|
||||
|
||||
writer.Write( m_NextMountAbility );
|
||||
|
||||
writer.Write( m_Rider );
|
||||
writer.Write( m_InternalItem );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
|
@ -134,7 +135,7 @@ namespace Server.Mobiles
|
|||
return;
|
||||
}
|
||||
|
||||
if ( !CheckMountAllowed( from, true ) )
|
||||
if ( !CheckMountAllowed( from ) )
|
||||
return;
|
||||
|
||||
if ( from.Mounted )
|
||||
|
|
@ -262,97 +263,22 @@ namespace Server.Mobiles
|
|||
}
|
||||
}
|
||||
|
||||
private class BlockEntry
|
||||
// 1040024 You are still too dazed from being knocked off your mount to ride!
|
||||
// 1062910 You cannot mount while recovering from a bola throw.
|
||||
// 1070859 You cannot mount while recovering from a dismount special maneuver.
|
||||
|
||||
public static bool CheckMountAllowed( Mobile mob )
|
||||
{
|
||||
public BlockMountType m_Type;
|
||||
public DateTime m_Expiration;
|
||||
bool result = true;
|
||||
|
||||
public bool IsExpired{ get{ return ( DateTime.Now >= m_Expiration ); } }
|
||||
|
||||
public BlockEntry( BlockMountType type, DateTime expiration )
|
||||
if( ( mob is PlayerMobile ) && ( mob as PlayerMobile ).BlockReason != BlockMountType.None )
|
||||
{
|
||||
m_Type = type;
|
||||
m_Expiration = expiration;
|
||||
}
|
||||
}
|
||||
mob.SendLocalizedMessage( ( int )( mob as PlayerMobile ).BlockReason );
|
||||
|
||||
private static Hashtable m_Table = new Hashtable();
|
||||
|
||||
public static void SetMountPrevention( Mobile mob, BlockMountType type, TimeSpan duration )
|
||||
{
|
||||
if ( mob == null )
|
||||
return;
|
||||
|
||||
DateTime expiration = DateTime.Now + duration;
|
||||
|
||||
BlockEntry entry = m_Table[mob] as BlockEntry;
|
||||
|
||||
if ( entry != null )
|
||||
{
|
||||
entry.m_Type = type;
|
||||
entry.m_Expiration = expiration;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Table[mob] = entry = new BlockEntry( type, expiration );
|
||||
}
|
||||
}
|
||||
|
||||
public static void ClearMountPrevention( Mobile mob )
|
||||
{
|
||||
if ( mob != null )
|
||||
m_Table.Remove( mob );
|
||||
}
|
||||
|
||||
public static BlockMountType GetMountPrevention( Mobile mob )
|
||||
{
|
||||
if ( mob == null )
|
||||
return BlockMountType.None;
|
||||
|
||||
BlockEntry entry = m_Table[mob] as BlockEntry;
|
||||
|
||||
if ( entry == null )
|
||||
return BlockMountType.None;
|
||||
|
||||
if ( entry.IsExpired )
|
||||
{
|
||||
m_Table.Remove( mob );
|
||||
return BlockMountType.None;
|
||||
result = false;
|
||||
}
|
||||
|
||||
return entry.m_Type;
|
||||
}
|
||||
|
||||
public static bool CheckMountAllowed( Mobile mob, bool message )
|
||||
{
|
||||
BlockMountType type = GetMountPrevention( mob );
|
||||
|
||||
if ( type == BlockMountType.None )
|
||||
return true;
|
||||
|
||||
if ( message )
|
||||
{
|
||||
switch ( type )
|
||||
{
|
||||
case BlockMountType.Dazed:
|
||||
{
|
||||
mob.SendLocalizedMessage( 1040024 ); // You are still too dazed from being knocked off your mount to ride!
|
||||
break;
|
||||
}
|
||||
case BlockMountType.BolaRecovery:
|
||||
{
|
||||
mob.SendLocalizedMessage( 1062910 ); // You cannot mount while recovering from a bola throw.
|
||||
break;
|
||||
}
|
||||
case BlockMountType.DismountRecovery:
|
||||
{
|
||||
mob.SendLocalizedMessage( 1070859 ); // You cannot mount while recovering from a dismount special maneuver.
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return result;
|
||||
}
|
||||
|
||||
public virtual void OnRiderDamaged( int amount, Mobile from, bool willKill )
|
||||
|
|
@ -451,12 +377,5 @@ namespace Server.Mobiles
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public enum BlockMountType
|
||||
{
|
||||
None = -1,
|
||||
Dazed,
|
||||
BolaRecovery,
|
||||
DismountRecovery
|
||||
}
|
||||
}
|
||||
|
|
@ -133,7 +133,7 @@ namespace Server.Mobiles
|
|||
// CheckIsUsableBy sends the message
|
||||
return false;
|
||||
}
|
||||
else if( !BaseMount.CheckMountAllowed( from, true ) )
|
||||
else if( !BaseMount.CheckMountAllowed( from ) )
|
||||
{
|
||||
// CheckMountAllowed sends the message
|
||||
return false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue