fix summon+logout problem, fix for an exploit.

This commit is contained in:
xavier 2010-11-18 15:19:29 +00:00
parent fa782484a9
commit 638065dcde
4 changed files with 40 additions and 17 deletions

View file

@ -4,13 +4,13 @@ using Server.Targeting;
using System.Collections;
using System.Collections.Generic;
using Server.ContextMenus;
using Server.Mobiles;
namespace Server.Items
{
[FlipableAttribute( 0x27AA, 0x27F5 )]
public class Fukiya : Item, IUsesRemaining
{
private bool m_Using;
private int m_UsesRemaining;
private Poison m_Poison;
@ -70,7 +70,7 @@ namespace Server.Items
// You have no fukiya darts!
from.SendLocalizedMessage( 1063325 );
}
else if ( m_Using )
else if (((PlayerMobile)from).NinjaWepCooldown)
{
// You are already using that fukiya.
from.SendLocalizedMessage( 1063326 );
@ -96,7 +96,7 @@ namespace Server.Items
// You have no fukiya darts!
from.SendLocalizedMessage( 1063325 );
}
else if ( m_Using )
else if (((PlayerMobile)from).NinjaWepCooldown)
{
// You are already using that fukiya.
from.SendLocalizedMessage( 1063326 );
@ -108,7 +108,7 @@ namespace Server.Items
}
else if ( from.CanBeHarmful( target ) )
{
m_Using = true;
((PlayerMobile)from).NinjaWepCooldown = true;
from.Direction = from.GetDirectionTo( target );
@ -125,7 +125,7 @@ namespace Server.Items
else
ConsumeUse();
Timer.DelayCall( TimeSpan.FromSeconds( 2.5 ), new TimerCallback( ResetUsing ) );
Timer.DelayCall( TimeSpan.FromSeconds( 2.5 ), new TimerStateCallback( ResetUsing ), from );
}
}
@ -164,9 +164,10 @@ namespace Server.Items
}
}
public void ResetUsing()
public void ResetUsing(object state)
{
m_Using = false;
PlayerMobile from = (PlayerMobile)state;
from.NinjaWepCooldown = false;
}
private const int MaxUses = 10;

View file

@ -4,6 +4,7 @@ using Server.Targeting;
using System.Collections;
using System.Collections.Generic;
using Server.ContextMenus;
using Server.Mobiles;
namespace Server.Items
{
@ -12,7 +13,6 @@ namespace Server.Items
{
public override CraftResource DefaultResource{ get{ return CraftResource.RegularLeather; } }
private bool m_Using;
private int m_UsesRemaining;
private Poison m_Poison;
@ -81,7 +81,7 @@ namespace Server.Items
// You have no shuriken in your ninja belt!
from.SendLocalizedMessage( 1063297 );
}
else if ( m_Using )
else if (((PlayerMobile)from).NinjaWepCooldown)
{
// You cannot throw another shuriken yet.
from.SendLocalizedMessage( 1063298 );
@ -107,7 +107,7 @@ namespace Server.Items
// You have no shuriken in your ninja belt!
from.SendLocalizedMessage( 1063297 );
}
else if ( m_Using )
else if (((PlayerMobile)from).NinjaWepCooldown)
{
// You cannot throw another shuriken yet.
from.SendLocalizedMessage( 1063298 );
@ -123,7 +123,7 @@ namespace Server.Items
}
else if ( from.CanBeHarmful( target ) )
{
m_Using = true;
((PlayerMobile)from).NinjaWepCooldown = true;
from.Direction = from.GetDirectionTo( target );
@ -140,7 +140,7 @@ namespace Server.Items
else
ConsumeUse();
Timer.DelayCall( TimeSpan.FromSeconds( 2.5 ), new TimerCallback( ResetUsing ) );
Timer.DelayCall(TimeSpan.FromSeconds(2.5), new TimerStateCallback( ResetUsing ), from );
}
}
@ -179,9 +179,10 @@ namespace Server.Items
}
}
public void ResetUsing()
public void ResetUsing(object state)
{
m_Using = false;
PlayerMobile from = (PlayerMobile)state;
from.NinjaWepCooldown = false;
}
private const int MaxUses = 10;

View file

@ -132,7 +132,6 @@ namespace Server.Mobiles
[AttributeUsage( AttributeTargets.Class )]
public class FriendlyNameAttribute : Attribute
{
//future use: Talisman 'Protection/Bonus vs. Specific Creature
private TextDefinition m_FriendlyName;

View file

@ -105,7 +105,7 @@ namespace Server.Mobiles
private bool m_IsStealthing; // IsStealthing should be moved to Server.Mobiles
private bool m_IgnoreMobiles; // IgnoreMobiles should be moved to Server.Mobiles
private int m_NonAutoreinsuredItems; // number of items that could not be automaitically reinsured because gold in bank was not enough
private bool m_NinjaWepCooldown;
/*
* a value of zero means, that the mobile is not executing the spell. Otherwise,
* the value should match the BaseMana required
@ -123,6 +123,18 @@ namespace Server.Mobiles
#region Getters & Setters
public List<Mobile> AutoStabled { get { return m_AutoStabled; } }
public bool NinjaWepCooldown
{
get
{
return m_NinjaWepCooldown;
}
set
{
m_NinjaWepCooldown = value;
}
}
public List<Mobile> AllFollowers
{
get
@ -4247,9 +4259,19 @@ namespace Server.Mobiles
{
BaseCreature pet = AllFollowers[i] as BaseCreature;
if ( pet == null || pet.ControlMaster == null || pet.Summoned )
if (pet == null || pet.ControlMaster == null)
continue;
if (pet.Summoned)
{
if (pet.Map != Map)
{
pet.PlaySound(pet.GetAngerSound());
pet.Delete();
}
continue;
}
if ( pet is IMount && ((IMount)pet).Rider != null )
continue;