Fixes code according to modern code style. Fixes a few expression bugs.
This commit is contained in:
parent
89eea25e5f
commit
970fd563b2
3324 changed files with 441118 additions and 433755 deletions
|
|
@ -3,167 +3,167 @@ using Server.Targeting;
|
|||
|
||||
namespace Server.Items
|
||||
{
|
||||
public interface ILockpickable : IPoint2D
|
||||
{
|
||||
int LockLevel{ get; set; }
|
||||
bool Locked{ get; set; }
|
||||
Mobile Picker{ get; set; }
|
||||
int MaxLockLevel{ get; set; }
|
||||
int RequiredSkill{ get; set; }
|
||||
public interface ILockpickable : IPoint2D
|
||||
{
|
||||
int LockLevel{ get; set; }
|
||||
bool Locked{ get; set; }
|
||||
Mobile Picker{ get; set; }
|
||||
int MaxLockLevel{ get; set; }
|
||||
int RequiredSkill{ get; set; }
|
||||
|
||||
void LockPick( Mobile from );
|
||||
}
|
||||
void LockPick(Mobile from);
|
||||
}
|
||||
|
||||
|
||||
[Flippable(0x14fc, 0x14fb)]
|
||||
public class Lockpick : Item
|
||||
{
|
||||
[Constructible]
|
||||
public Lockpick() : this(1)
|
||||
{
|
||||
}
|
||||
|
||||
[FlippableAttribute( 0x14fc, 0x14fb )]
|
||||
public class Lockpick : Item
|
||||
{
|
||||
[Constructible]
|
||||
public Lockpick() : this( 1 )
|
||||
{
|
||||
}
|
||||
[Constructible]
|
||||
public Lockpick(int amount) : base(0x14FC)
|
||||
{
|
||||
Stackable = true;
|
||||
Amount = amount;
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public Lockpick( int amount ) : base( 0x14FC )
|
||||
{
|
||||
Stackable = true;
|
||||
Amount = amount;
|
||||
}
|
||||
public Lockpick(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public Lockpick( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write( (int) 1 ); // version
|
||||
}
|
||||
writer.Write(1); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
int version = reader.ReadInt();
|
||||
|
||||
if ( version == 0 && Weight == 0.1 )
|
||||
Weight = -1;
|
||||
}
|
||||
if (version == 0 && Weight == 0.1)
|
||||
Weight = -1;
|
||||
}
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
from.SendLocalizedMessage( 502068 ); // What do you want to pick?
|
||||
from.Target = new InternalTarget( this );
|
||||
}
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
from.SendLocalizedMessage(502068); // What do you want to pick?
|
||||
from.Target = new InternalTarget(this);
|
||||
}
|
||||
|
||||
private class InternalTarget : Target
|
||||
{
|
||||
private Lockpick m_Item;
|
||||
private class InternalTarget : Target
|
||||
{
|
||||
private Lockpick m_Item;
|
||||
|
||||
public InternalTarget( Lockpick item ) : base( 1, false, TargetFlags.None )
|
||||
{
|
||||
m_Item = item;
|
||||
}
|
||||
public InternalTarget(Lockpick item) : base(1, false, TargetFlags.None)
|
||||
{
|
||||
m_Item = item;
|
||||
}
|
||||
|
||||
protected override void OnTarget( Mobile from, object targeted )
|
||||
{
|
||||
if ( m_Item.Deleted )
|
||||
return;
|
||||
protected override void OnTarget(Mobile from, object targeted)
|
||||
{
|
||||
if (m_Item.Deleted)
|
||||
return;
|
||||
|
||||
if ( targeted is ILockpickable lockpickable )
|
||||
{
|
||||
Item item = lockpickable as Item;
|
||||
from.Direction = from.GetDirectionTo( item );
|
||||
if (targeted is ILockpickable lockpickable)
|
||||
{
|
||||
Item item = lockpickable as Item;
|
||||
from.Direction = from.GetDirectionTo(item);
|
||||
|
||||
if ( lockpickable.Locked )
|
||||
{
|
||||
from.PlaySound( 0x241 );
|
||||
if (lockpickable.Locked)
|
||||
{
|
||||
from.PlaySound(0x241);
|
||||
|
||||
new InternalTimer( from, lockpickable, m_Item ).Start();
|
||||
}
|
||||
else
|
||||
{
|
||||
// The door is not locked
|
||||
from.SendLocalizedMessage( 502069 ); // This does not appear to be locked
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage( 501666 ); // You can't unlock that!
|
||||
}
|
||||
}
|
||||
new InternalTimer(from, lockpickable, m_Item).Start();
|
||||
}
|
||||
else
|
||||
{
|
||||
// The door is not locked
|
||||
from.SendLocalizedMessage(502069); // This does not appear to be locked
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage(501666); // You can't unlock that!
|
||||
}
|
||||
}
|
||||
|
||||
private class InternalTimer : Timer
|
||||
{
|
||||
private Mobile m_From;
|
||||
private ILockpickable m_Item;
|
||||
private Lockpick m_Lockpick;
|
||||
private class InternalTimer : Timer
|
||||
{
|
||||
private Mobile m_From;
|
||||
private ILockpickable m_Item;
|
||||
private Lockpick m_Lockpick;
|
||||
|
||||
public InternalTimer( Mobile from, ILockpickable item, Lockpick lockpick ) : base( TimeSpan.FromSeconds( 3.0 ) )
|
||||
{
|
||||
m_From = from;
|
||||
m_Item = item;
|
||||
m_Lockpick = lockpick;
|
||||
Priority = TimerPriority.TwoFiftyMS;
|
||||
}
|
||||
public InternalTimer(Mobile from, ILockpickable item, Lockpick lockpick) : base(TimeSpan.FromSeconds(3.0))
|
||||
{
|
||||
m_From = from;
|
||||
m_Item = item;
|
||||
m_Lockpick = lockpick;
|
||||
Priority = TimerPriority.TwoFiftyMS;
|
||||
}
|
||||
|
||||
protected void BrokeLockPickTest()
|
||||
{
|
||||
// When failed, a 25% chance to break the lockpick
|
||||
if ( Utility.Random( 4 ) == 0 )
|
||||
{
|
||||
Item item = (Item)m_Item;
|
||||
protected void BrokeLockPickTest()
|
||||
{
|
||||
// When failed, a 25% chance to break the lockpick
|
||||
if (Utility.Random(4) == 0)
|
||||
{
|
||||
Item item = (Item)m_Item;
|
||||
|
||||
// You broke the lockpick.
|
||||
item.SendLocalizedMessageTo( m_From, 502074 );
|
||||
// You broke the lockpick.
|
||||
item.SendLocalizedMessageTo(m_From, 502074);
|
||||
|
||||
m_From.PlaySound( 0x3A4 );
|
||||
m_Lockpick.Consume();
|
||||
}
|
||||
}
|
||||
m_From.PlaySound(0x3A4);
|
||||
m_Lockpick.Consume();
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnTick()
|
||||
{
|
||||
Item item = (Item)m_Item;
|
||||
protected override void OnTick()
|
||||
{
|
||||
Item item = (Item)m_Item;
|
||||
|
||||
if ( !m_From.InRange( item.GetWorldLocation(), 1 ) )
|
||||
return;
|
||||
if (!m_From.InRange(item.GetWorldLocation(), 1))
|
||||
return;
|
||||
|
||||
if ( m_Item.LockLevel == 0 || m_Item.LockLevel == -255 )
|
||||
{
|
||||
// LockLevel of 0 means that the door can't be picklocked
|
||||
// LockLevel of -255 means it's magic locked
|
||||
item.SendLocalizedMessageTo( m_From, 502073 ); // This lock cannot be picked by normal means
|
||||
return;
|
||||
}
|
||||
if (m_Item.LockLevel == 0 || m_Item.LockLevel == -255)
|
||||
{
|
||||
// LockLevel of 0 means that the door can't be picklocked
|
||||
// LockLevel of -255 means it's magic locked
|
||||
item.SendLocalizedMessageTo(m_From, 502073); // This lock cannot be picked by normal means
|
||||
return;
|
||||
}
|
||||
|
||||
if ( m_From.Skills[SkillName.Lockpicking].Value < m_Item.RequiredSkill )
|
||||
{
|
||||
/*
|
||||
// Do some training to gain skills
|
||||
m_From.CheckSkill( SkillName.Lockpicking, 0, m_Item.LockLevel );*/
|
||||
if (m_From.Skills[SkillName.Lockpicking].Value < m_Item.RequiredSkill)
|
||||
{
|
||||
/*
|
||||
// Do some training to gain skills
|
||||
m_From.CheckSkill( SkillName.Lockpicking, 0, m_Item.LockLevel );*/
|
||||
|
||||
// The LockLevel is higher thant the LockPicking of the player
|
||||
item.SendLocalizedMessageTo( m_From, 502072 ); // You don't see how that lock can be manipulated.
|
||||
return;
|
||||
}
|
||||
// The LockLevel is higher thant the LockPicking of the player
|
||||
item.SendLocalizedMessageTo(m_From, 502072); // You don't see how that lock can be manipulated.
|
||||
return;
|
||||
}
|
||||
|
||||
if ( m_From.CheckTargetSkill( SkillName.Lockpicking, m_Item, m_Item.LockLevel, m_Item.MaxLockLevel ) )
|
||||
{
|
||||
// Success! Pick the lock!
|
||||
item.SendLocalizedMessageTo( m_From, 502076 ); // The lock quickly yields to your skill.
|
||||
m_From.PlaySound( 0x4A );
|
||||
m_Item.LockPick( m_From );
|
||||
}
|
||||
else
|
||||
{
|
||||
// The player failed to pick the lock
|
||||
BrokeLockPickTest();
|
||||
item.SendLocalizedMessageTo( m_From, 502075 ); // You are unable to pick the lock.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (m_From.CheckTargetSkill(SkillName.Lockpicking, m_Item, m_Item.LockLevel, m_Item.MaxLockLevel))
|
||||
{
|
||||
// Success! Pick the lock!
|
||||
item.SendLocalizedMessageTo(m_From, 502076); // The lock quickly yields to your skill.
|
||||
m_From.PlaySound(0x4A);
|
||||
m_Item.LockPick(m_From);
|
||||
}
|
||||
else
|
||||
{
|
||||
// The player failed to pick the lock
|
||||
BrokeLockPickTest();
|
||||
item.SendLocalizedMessageTo(m_From, 502075); // You are unable to pick the lock.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue