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

@ -4,101 +4,111 @@ using Server.Items;
namespace Server.Spells.Chivalry
{
public class ConsecrateWeaponSpell : PaladinSpell
{
private static SpellInfo m_Info = new SpellInfo(
"Consecrate Weapon", "Consecrus Arma",
-1,
9002
);
public class ConsecrateWeaponSpell : PaladinSpell
{
private static SpellInfo m_Info = new SpellInfo(
"Consecrate Weapon", "Consecrus Arma",
-1,
9002
);
public override TimeSpan CastDelayBase => TimeSpan.FromSeconds( 0.5 );
private static Hashtable m_Table = new Hashtable();
public override double RequiredSkill => 15.0;
public override int RequiredMana => 10;
public override int RequiredTithing => 10;
public override int MantraNumber => 1060720; // Consecrus Arma
public override bool BlocksMovement => false;
public ConsecrateWeaponSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
{
}
public ConsecrateWeaponSpell( Mobile caster, Item scroll ) : base( caster, scroll, m_Info )
{
}
public override TimeSpan CastDelayBase => TimeSpan.FromSeconds(0.5);
public override void OnCast()
{
BaseWeapon weapon = Caster.Weapon as BaseWeapon;
public override double RequiredSkill => 15.0;
public override int RequiredMana => 10;
public override int RequiredTithing => 10;
public override int MantraNumber => 1060720; // Consecrus Arma
public override bool BlocksMovement => false;
if ( weapon == null || weapon is Fists )
{
Caster.SendLocalizedMessage( 501078 ); // You must be holding a weapon.
}
else if ( CheckSequence() )
{
/* Temporarily enchants the weapon the caster is currently wielding.
* The type of damage the weapon inflicts when hitting a target will
* be converted to the target's worst Resistance type.
* Duration of the effect is affected by the caster's Karma and lasts for 3 to 11 seconds.
*/
public override void OnCast()
{
BaseWeapon weapon = Caster.Weapon as BaseWeapon;
int itemID, soundID;
if (weapon == null || weapon is Fists)
{
Caster.SendLocalizedMessage(501078); // You must be holding a weapon.
}
else if (CheckSequence())
{
/* Temporarily enchants the weapon the caster is currently wielding.
* The type of damage the weapon inflicts when hitting a target will
* be converted to the target's worst Resistance type.
* Duration of the effect is affected by the caster's Karma and lasts for 3 to 11 seconds.
*/
switch ( weapon.Skill )
{
case SkillName.Macing: itemID = 0xFB4; soundID = 0x232; break;
case SkillName.Archery: itemID = 0x13B1; soundID = 0x145; break;
default: itemID = 0xF5F; soundID = 0x56; break;
}
int itemID, soundID;
Caster.PlaySound( 0x20C );
Caster.PlaySound( soundID );
Caster.FixedParticles( 0x3779, 1, 30, 9964, 3, 3, EffectLayer.Waist );
switch (weapon.Skill)
{
case SkillName.Macing:
itemID = 0xFB4;
soundID = 0x232;
break;
case SkillName.Archery:
itemID = 0x13B1;
soundID = 0x145;
break;
default:
itemID = 0xF5F;
soundID = 0x56;
break;
}
IEntity from = new Entity( Serial.Zero, new Point3D( Caster.X, Caster.Y, Caster.Z ), Caster.Map );
IEntity to = new Entity( Serial.Zero, new Point3D( Caster.X, Caster.Y, Caster.Z + 50 ), Caster.Map );
Effects.SendMovingParticles( from, to, itemID, 1, 0, false, false, 33, 3, 9501, 1, 0, EffectLayer.Head, 0x100 );
Caster.PlaySound(0x20C);
Caster.PlaySound(soundID);
Caster.FixedParticles(0x3779, 1, 30, 9964, 3, 3, EffectLayer.Waist);
double seconds = ComputePowerValue( 20 );
IEntity from = new Entity(Serial.Zero, new Point3D(Caster.X, Caster.Y, Caster.Z), Caster.Map);
IEntity to = new Entity(Serial.Zero, new Point3D(Caster.X, Caster.Y, Caster.Z + 50), Caster.Map);
Effects.SendMovingParticles(from, to, itemID, 1, 0, false, false, 33, 3, 9501, 1, 0, EffectLayer.Head,
0x100);
// TODO: Should caps be applied?
if ( seconds < 3.0 )
seconds = 3.0;
else if ( seconds > 11.0 )
seconds = 11.0;
double seconds = ComputePowerValue(20);
TimeSpan duration = TimeSpan.FromSeconds( seconds );
// TODO: Should caps be applied?
if (seconds < 3.0)
seconds = 3.0;
else if (seconds > 11.0)
seconds = 11.0;
Timer t = (Timer)m_Table[weapon];
TimeSpan duration = TimeSpan.FromSeconds(seconds);
t?.Stop();
Timer t = (Timer)m_Table[weapon];
weapon.Consecrated = true;
t?.Stop();
m_Table[weapon] = t = new ExpireTimer( weapon, duration );
weapon.Consecrated = true;
t.Start();
}
m_Table[weapon] = t = new ExpireTimer(weapon, duration);
FinishSequence();
}
t.Start();
}
private static Hashtable m_Table = new Hashtable();
FinishSequence();
}
private class ExpireTimer : Timer
{
private BaseWeapon m_Weapon;
private class ExpireTimer : Timer
{
private BaseWeapon m_Weapon;
public ExpireTimer( BaseWeapon weapon, TimeSpan delay ) : base( delay )
{
m_Weapon = weapon;
Priority = TimerPriority.FiftyMS;
}
public ExpireTimer(BaseWeapon weapon, TimeSpan delay) : base(delay)
{
m_Weapon = weapon;
Priority = TimerPriority.FiftyMS;
}
protected override void OnTick()
{
m_Weapon.Consecrated = false;
Effects.PlaySound( m_Weapon.GetWorldLocation(), m_Weapon.Map, 0x1F8 );
m_Table.Remove( this );
}
}
}
}
protected override void OnTick()
{
m_Weapon.Consecrated = false;
Effects.PlaySound(m_Weapon.GetWorldLocation(), m_Weapon.Map, 0x1F8);
m_Table.Remove(this);
}
}
}
}