protected override void OnTick()
{
Item item = (Item)m_Item;
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_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;
}
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.
}
}
}