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,215 +1,221 @@
using System;
using System.Collections;
using Server.Items;
using Server.Factions;
using Server.Gumps;
using Server.Items;
using Server.Mobiles;
using Server.Spells.Fifth;
namespace Server.Spells.Seventh
{
public class PolymorphSpell : MagerySpell
{
private static SpellInfo m_Info = new SpellInfo(
"Polymorph", "Vas Ylem Rel",
221,
9002,
Reagent.Bloodmoss,
Reagent.SpidersSilk,
Reagent.MandrakeRoot
);
public class PolymorphSpell : MagerySpell
{
private static SpellInfo m_Info = new SpellInfo(
"Polymorph", "Vas Ylem Rel",
221,
9002,
Reagent.Bloodmoss,
Reagent.SpidersSilk,
Reagent.MandrakeRoot
);
public override SpellCircle Circle => SpellCircle.Seventh;
private static Hashtable m_Timers = new Hashtable();
private int m_NewBody;
private int m_NewBody;
public PolymorphSpell( Mobile caster, Item scroll, int body ) : base( caster, scroll, m_Info )
{
m_NewBody = body;
}
public PolymorphSpell(Mobile caster, Item scroll, int body) : base(caster, scroll, m_Info)
{
m_NewBody = body;
}
public PolymorphSpell( Mobile caster, Item scroll ) : this(caster,scroll,0)
{
}
public PolymorphSpell(Mobile caster, Item scroll) : this(caster, scroll, 0)
{
}
public override bool CheckCast()
{
/*if ( Caster.Mounted )
{
Caster.SendLocalizedMessage( 1042561 ); //Please dismount first.
return false;
}
else */
if ( Factions.Sigil.ExistsOn( Caster ) )
{
Caster.SendLocalizedMessage( 1010521 ); // You cannot polymorph while you have a Town Sigil
return false;
}
public override SpellCircle Circle => SpellCircle.Seventh;
if ( TransformationSpellHelper.UnderTransformation( Caster ) )
{
Caster.SendLocalizedMessage( 1061633 ); // You cannot polymorph while in that form.
return false;
}
if ( DisguiseTimers.IsDisguised( Caster ) )
{
Caster.SendLocalizedMessage( 502167 ); // You cannot polymorph while disguised.
return false;
}
if ( Caster.BodyMod == 183 || Caster.BodyMod == 184 )
{
Caster.SendLocalizedMessage( 1042512 ); // You cannot polymorph while wearing body paint
return false;
}
if ( !Caster.CanBeginAction( typeof( PolymorphSpell ) ) )
{
if ( Core.ML )
EndPolymorph( Caster );
else
Caster.SendLocalizedMessage( 1005559 ); // This spell is already in effect.
return false;
}
if ( m_NewBody == 0 )
{
Gump gump;
if ( Core.SE )
gump = new NewPolymorphGump( Caster, Scroll );
else
gump = new PolymorphGump( Caster, Scroll );
public override bool CheckCast()
{
/*if ( Caster.Mounted )
{
Caster.SendLocalizedMessage( 1042561 ); //Please dismount first.
return false;
}
else */
if (Sigil.ExistsOn(Caster))
{
Caster.SendLocalizedMessage(1010521); // You cannot polymorph while you have a Town Sigil
return false;
}
Caster.SendGump( gump );
return false;
}
if (TransformationSpellHelper.UnderTransformation(Caster))
{
Caster.SendLocalizedMessage(1061633); // You cannot polymorph while in that form.
return false;
}
return true;
}
if (DisguiseTimers.IsDisguised(Caster))
{
Caster.SendLocalizedMessage(502167); // You cannot polymorph while disguised.
return false;
}
public override void OnCast()
{
/*if ( Caster.Mounted )
{
Caster.SendLocalizedMessage( 1042561 ); //Please dismount first.
}
else */
if ( Factions.Sigil.ExistsOn( Caster ) )
{
Caster.SendLocalizedMessage( 1010521 ); // You cannot polymorph while you have a Town Sigil
}
else if ( !Caster.CanBeginAction( typeof( PolymorphSpell ) ) )
{
if ( Core.ML )
EndPolymorph( Caster );
else
Caster.SendLocalizedMessage( 1005559 ); // This spell is already in effect.
}
else if ( TransformationSpellHelper.UnderTransformation( Caster ) )
{
Caster.SendLocalizedMessage( 1061633 ); // You cannot polymorph while in that form.
}
else if ( DisguiseTimers.IsDisguised( Caster ) )
{
Caster.SendLocalizedMessage( 502167 ); // You cannot polymorph while disguised.
}
else if ( Caster.BodyMod == 183 || Caster.BodyMod == 184 )
{
Caster.SendLocalizedMessage( 1042512 ); // You cannot polymorph while wearing body paint
}
else if ( !Caster.CanBeginAction( typeof( IncognitoSpell ) ) || Caster.IsBodyMod )
{
DoFizzle();
}
else if ( CheckSequence() )
{
if ( Caster.BeginAction( typeof( PolymorphSpell ) ) )
{
if ( m_NewBody != 0 )
{
if ( !((Body)m_NewBody).IsHuman )
{
Mobiles.IMount mt = Caster.Mount;
if (Caster.BodyMod == 183 || Caster.BodyMod == 184)
{
Caster.SendLocalizedMessage(1042512); // You cannot polymorph while wearing body paint
return false;
}
if ( mt != null )
mt.Rider = null;
}
if (!Caster.CanBeginAction(typeof(PolymorphSpell)))
{
if (Core.ML)
EndPolymorph(Caster);
else
Caster.SendLocalizedMessage(1005559); // This spell is already in effect.
return false;
}
Caster.BodyMod = m_NewBody;
if (m_NewBody == 0)
{
Gump gump;
if (Core.SE)
gump = new NewPolymorphGump(Caster, Scroll);
else
gump = new PolymorphGump(Caster, Scroll);
if ( m_NewBody == 400 || m_NewBody == 401 )
Caster.HueMod = Utility.RandomSkinHue();
else
Caster.HueMod = 0;
Caster.SendGump(gump);
return false;
}
BaseArmor.ValidateMobile( Caster );
BaseClothing.ValidateMobile( Caster );
return true;
}
if ( !Core.ML )
{
StopTimer( Caster );
public override void OnCast()
{
/*if ( Caster.Mounted )
{
Caster.SendLocalizedMessage( 1042561 ); //Please dismount first.
}
else */
if (Sigil.ExistsOn(Caster))
{
Caster.SendLocalizedMessage(1010521); // You cannot polymorph while you have a Town Sigil
}
else if (!Caster.CanBeginAction(typeof(PolymorphSpell)))
{
if (Core.ML)
EndPolymorph(Caster);
else
Caster.SendLocalizedMessage(1005559); // This spell is already in effect.
}
else if (TransformationSpellHelper.UnderTransformation(Caster))
{
Caster.SendLocalizedMessage(1061633); // You cannot polymorph while in that form.
}
else if (DisguiseTimers.IsDisguised(Caster))
{
Caster.SendLocalizedMessage(502167); // You cannot polymorph while disguised.
}
else if (Caster.BodyMod == 183 || Caster.BodyMod == 184)
{
Caster.SendLocalizedMessage(1042512); // You cannot polymorph while wearing body paint
}
else if (!Caster.CanBeginAction(typeof(IncognitoSpell)) || Caster.IsBodyMod)
{
DoFizzle();
}
else if (CheckSequence())
{
if (Caster.BeginAction(typeof(PolymorphSpell)))
{
if (m_NewBody != 0)
{
if (!((Body)m_NewBody).IsHuman)
{
IMount mt = Caster.Mount;
Timer t = new InternalTimer( Caster );
if (mt != null)
mt.Rider = null;
}
m_Timers[Caster] = t;
Caster.BodyMod = m_NewBody;
t.Start();
}
}
}
else
{
Caster.SendLocalizedMessage( 1005559 ); // This spell is already in effect.
}
}
if (m_NewBody == 400 || m_NewBody == 401)
Caster.HueMod = Utility.RandomSkinHue();
else
Caster.HueMod = 0;
FinishSequence();
}
BaseArmor.ValidateMobile(Caster);
BaseClothing.ValidateMobile(Caster);
private static Hashtable m_Timers = new Hashtable();
if (!Core.ML)
{
StopTimer(Caster);
public static bool StopTimer( Mobile m )
{
Timer t = (Timer)m_Timers[m];
Timer t = new InternalTimer(Caster);
if ( t != null )
{
t.Stop();
m_Timers.Remove( m );
}
m_Timers[Caster] = t;
return ( t != null );
}
t.Start();
}
}
}
else
{
Caster.SendLocalizedMessage(1005559); // This spell is already in effect.
}
}
private static void EndPolymorph( Mobile m )
{
if ( !m.CanBeginAction( typeof( PolymorphSpell ) ) )
{
m.BodyMod = 0;
m.HueMod = -1;
m.EndAction( typeof( PolymorphSpell ) );
FinishSequence();
}
BaseArmor.ValidateMobile( m );
BaseClothing.ValidateMobile( m );
}
}
public static bool StopTimer(Mobile m)
{
Timer t = (Timer)m_Timers[m];
private class InternalTimer : Timer
{
private Mobile m_Owner;
if (t != null)
{
t.Stop();
m_Timers.Remove(m);
}
public InternalTimer( Mobile owner ) : base( TimeSpan.FromSeconds( 0 ) )
{
m_Owner = owner;
return t != null;
}
int val = (int)owner.Skills[SkillName.Magery].Value;
private static void EndPolymorph(Mobile m)
{
if (!m.CanBeginAction(typeof(PolymorphSpell)))
{
m.BodyMod = 0;
m.HueMod = -1;
m.EndAction(typeof(PolymorphSpell));
if ( val > 120 )
val = 120;
BaseArmor.ValidateMobile(m);
BaseClothing.ValidateMobile(m);
}
}
Delay = TimeSpan.FromSeconds( val );
Priority = TimerPriority.OneSecond;
}
private class InternalTimer : Timer
{
private Mobile m_Owner;
protected override void OnTick()
{
EndPolymorph( m_Owner );
}
}
}
}
public InternalTimer(Mobile owner) : base(TimeSpan.FromSeconds(0))
{
m_Owner = owner;
int val = (int)owner.Skills[SkillName.Magery].Value;
if (val > 120)
val = 120;
Delay = TimeSpan.FromSeconds(val);
Priority = TimerPriority.OneSecond;
}
protected override void OnTick()
{
EndPolymorph(m_Owner);
}
}
}
}