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,112 +1,113 @@
using System;
using Server.Network;
using Server.Spells;
namespace Server.Items
{
public class Guillotine : Item
{
[Constructible]
public Guillotine()
: base( 4656 )
{
Movable = false;
}
public class Guillotine : Item
{
private DateTime m_NextUse;
private DateTime m_NextUse;
[Constructible]
public Guillotine()
: base(4656)
{
Movable = false;
}
public override void OnDoubleClick( Mobile from )
{
if ( !from.InRange( GetWorldLocation(), 2 ) || !from.InLOS( this ) )
{
from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that
}
else if ( Visible && ( ItemID == 4656 || ItemID == 4702 ) && DateTime.UtcNow >= m_NextUse )
{
Point3D p = GetWorldLocation();
public Guillotine(Serial serial)
: base(serial)
{
}
if ( 1 > Utility.Random( Math.Max( Math.Abs( from.X - p.X ), Math.Abs( from.Y - p.Y ) ) ) )
{
Effects.PlaySound( from.Location, from.Map, from.GetHurtSound() );
from.PublicOverheadMessage( MessageType.Regular, from.SpeechHue, true, "Ouch!" );
Spells.SpellHelper.Damage( TimeSpan.FromSeconds( 0.5 ), from, Utility.Dice( 2, 10, 5 ) );
}
public override void OnDoubleClick(Mobile from)
{
if (!from.InRange(GetWorldLocation(), 2) || !from.InLOS(this))
{
from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that
}
else if (Visible && (ItemID == 4656 || ItemID == 4702) && DateTime.UtcNow >= m_NextUse)
{
Point3D p = GetWorldLocation();
Effects.PlaySound( GetWorldLocation(), Map, 0x387 );
if (1 > Utility.Random(Math.Max(Math.Abs(from.X - p.X), Math.Abs(from.Y - p.Y))))
{
Effects.PlaySound(from.Location, from.Map, from.GetHurtSound());
from.PublicOverheadMessage(MessageType.Regular, from.SpeechHue, true, "Ouch!");
SpellHelper.Damage(TimeSpan.FromSeconds(0.5), from, Utility.Dice(2, 10, 5));
}
Timer.DelayCall( TimeSpan.FromSeconds( 0.25 ), Down1 );
Timer.DelayCall( TimeSpan.FromSeconds( 0.50 ), Down2 );
Effects.PlaySound(GetWorldLocation(), Map, 0x387);
Timer.DelayCall( TimeSpan.FromSeconds( 5.00 ), BackUp );
Timer.DelayCall(TimeSpan.FromSeconds(0.25), Down1);
Timer.DelayCall(TimeSpan.FromSeconds(0.50), Down2);
m_NextUse = DateTime.UtcNow + TimeSpan.FromSeconds( 10.0 );
}
}
Timer.DelayCall(TimeSpan.FromSeconds(5.00), BackUp);
private void Down1()
{
ItemID = ( ItemID == 4656 ? 4678 : 4712 );
}
m_NextUse = DateTime.UtcNow + TimeSpan.FromSeconds(10.0);
}
}
private void Down2()
{
ItemID = ( ItemID == 4678 ? 4679 : 4713 );
private void Down1()
{
ItemID = ItemID == 4656 ? 4678 : 4712;
}
Point3D p = GetWorldLocation();
Map f = Map;
private void Down2()
{
ItemID = ItemID == 4678 ? 4679 : 4713;
if ( f == null )
return;
Point3D p = GetWorldLocation();
Map f = Map;
new Blood( 4650 ).MoveToWorld( p, f );
if (f == null)
return;
for ( int i = 0; i < 4; ++i )
{
int x = p.X - 2 + Utility.Random( 5 );
int y = p.Y - 2 + Utility.Random( 5 );
int z = p.Z;
new Blood(4650).MoveToWorld(p, f);
if ( !f.CanFit( x, y, z, 1, false, false, true ) )
{
z = f.GetAverageZ( x, y );
for (int i = 0; i < 4; ++i)
{
int x = p.X - 2 + Utility.Random(5);
int y = p.Y - 2 + Utility.Random(5);
int z = p.Z;
if ( !f.CanFit( x, y, z, 1, false, false, true ) )
continue;
}
if (!f.CanFit(x, y, z, 1, false, false, true))
{
z = f.GetAverageZ(x, y);
new Blood().MoveToWorld( new Point3D( x, y, z ), f );
}
}
if (!f.CanFit(x, y, z, 1, false, false, true))
continue;
}
private void BackUp()
{
if ( ItemID == 4678 || ItemID == 4679 )
ItemID = 4656;
else if ( ItemID == 4712 || ItemID == 4713 )
ItemID = 4702;
}
new Blood().MoveToWorld(new Point3D(x, y, z), f);
}
}
public Guillotine( Serial serial )
: base( serial )
{
}
private void BackUp()
{
if (ItemID == 4678 || ItemID == 4679)
ItemID = 4656;
else if (ItemID == 4712 || ItemID == 4713)
ItemID = 4702;
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write( (byte) 0 ); // version
}
writer.Write((byte)0); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadByte();
int version = reader.ReadByte();
if ( ItemID == 4678 || ItemID == 4679 )
ItemID = 4656;
else if ( ItemID == 4712 || ItemID == 4713 )
ItemID = 4702;
}
}
if (ItemID == 4678 || ItemID == 4679)
ItemID = 4656;
else if (ItemID == 4712 || ItemID == 4713)
ItemID = 4702;
}
}
}