Fixes code according to modern code style. Fixes a few expression bugs.

This commit is contained in:
Kamron Batman 2018-09-15 09:58:51 -07:00
parent 89eea25e5f
commit 970fd563b2
3324 changed files with 441118 additions and 433755 deletions

View file

@ -1,88 +1,109 @@
using Server.Targeting;
using Server.Network;
using Server.Items;
using Server.Multis;
using Server.Network;
using Server.Targeting;
namespace Server.Spells.Third
{
public class UnlockSpell : MagerySpell
{
private static SpellInfo m_Info = new SpellInfo(
"Unlock Spell", "Ex Por",
215,
9001,
Reagent.Bloodmoss,
Reagent.SulfurousAsh
);
public class UnlockSpell : MagerySpell
{
private static SpellInfo m_Info = new SpellInfo(
"Unlock Spell", "Ex Por",
215,
9001,
Reagent.Bloodmoss,
Reagent.SulfurousAsh
);
public override SpellCircle Circle => SpellCircle.Third;
public UnlockSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
{
}
public UnlockSpell( Mobile caster, Item scroll ) : base( caster, scroll, m_Info )
{
}
public override SpellCircle Circle => SpellCircle.Third;
public override void OnCast()
{
Caster.Target = new InternalTarget( this );
}
public override void OnCast()
{
Caster.Target = new InternalTarget(this);
}
private class InternalTarget : Target
{
private UnlockSpell m_Owner;
private class InternalTarget : Target
{
private UnlockSpell m_Owner;
public InternalTarget( UnlockSpell owner ) : base( Core.ML ? 10 : 12, false, TargetFlags.None )
{
m_Owner = owner;
}
public InternalTarget(UnlockSpell owner) : base(Core.ML ? 10 : 12, false, TargetFlags.None)
{
m_Owner = owner;
}
protected override void OnTarget( Mobile from, object o )
{
IPoint3D loc = o as IPoint3D;
protected override void OnTarget(Mobile from, object o)
{
IPoint3D loc = o as IPoint3D;
if ( loc == null )
return;
if (loc == null)
return;
if ( m_Owner.CheckSequence() ) {
SpellHelper.Turn( from, o );
if (m_Owner.CheckSequence())
{
SpellHelper.Turn(from, o);
Effects.SendLocationParticles( EffectItem.Create( new Point3D( loc ), from.Map, EffectItem.DefaultDuration ), 0x376A, 9, 32, 5024 );
Effects.SendLocationParticles(EffectItem.Create(new Point3D(loc), from.Map, EffectItem.DefaultDuration),
0x376A, 9, 32, 5024);
Effects.PlaySound( loc, from.Map, 0x1FF );
Effects.PlaySound(loc, from.Map, 0x1FF);
if ( o is Mobile )
from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 503101 ); // That did not need to be unlocked.
else if ( !( o is LockableContainer ) )
from.SendLocalizedMessage( 501666 ); // You can't unlock that!
else {
LockableContainer cont = (LockableContainer)o;
if (o is Mobile)
{
from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 503101); // That did not need to be unlocked.
}
else if (!(o is LockableContainer))
{
from.SendLocalizedMessage(501666); // You can't unlock that!
}
else
{
LockableContainer cont = (LockableContainer)o;
if ( Multis.BaseHouse.CheckSecured( cont ) )
from.SendLocalizedMessage( 503098 ); // You cannot cast this on a secure item.
else if ( !cont.Locked )
from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 503101 ); // That did not need to be unlocked.
else if ( cont.LockLevel == 0 )
from.SendLocalizedMessage( 501666 ); // You can't unlock that!
else {
int level = (int)(from.Skills[SkillName.Magery].Value * 0.8) - 4;
if (BaseHouse.CheckSecured(cont))
{
from.SendLocalizedMessage(503098); // You cannot cast this on a secure item.
}
else if (!cont.Locked)
{
from.LocalOverheadMessage(MessageType.Regular, 0x3B2,
503101); // That did not need to be unlocked.
}
else if (cont.LockLevel == 0)
{
from.SendLocalizedMessage(501666); // You can't unlock that!
}
else
{
int level = (int)(from.Skills[SkillName.Magery].Value * 0.8) - 4;
if ( level >= cont.RequiredSkill && !(cont is TreasureMapChest && ((TreasureMapChest)cont).Level > 2) ) {
cont.Locked = false;
if (level >= cont.RequiredSkill &&
!(cont is TreasureMapChest && ((TreasureMapChest)cont).Level > 2))
{
cont.Locked = false;
if ( cont.LockLevel == -255 )
cont.LockLevel = cont.RequiredSkill - 10;
}
else
from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 503099 ); // My spell does not seem to have an effect on that lock.
}
}
}
if (cont.LockLevel == -255)
cont.LockLevel = cont.RequiredSkill - 10;
}
else
{
from.LocalOverheadMessage(MessageType.Regular, 0x3B2,
503099); // My spell does not seem to have an effect on that lock.
}
}
}
}
m_Owner.FinishSequence();
}
m_Owner.FinishSequence();
}
protected override void OnTargetFinish( Mobile from )
{
m_Owner.FinishSequence();
}
}
}
}
protected override void OnTargetFinish(Mobile from)
{
m_Owner.FinishSequence();
}
}
}
}