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,115 +4,114 @@ using Server.Regions;
namespace Server.Items
{
public class Kindling : Item
{
[Constructible]
public Kindling() : this( 1 )
{
}
public class Kindling : Item
{
[Constructible]
public Kindling() : this(1)
{
}
[Constructible]
public Kindling( int amount ) : base( 0xDE1 )
{
Stackable = true;
Weight = 5.0;
Amount = amount;
}
[Constructible]
public Kindling(int amount) : base(0xDE1)
{
Stackable = true;
Weight = 5.0;
Amount = amount;
}
public Kindling( Serial serial ) : base( serial )
{
}
public Kindling(Serial serial) : base(serial)
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write( (int) 0 ); // version
}
writer.Write(0); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
}
int version = reader.ReadInt();
}
public override void OnDoubleClick( Mobile from )
{
if ( !VerifyMove( from ) )
return;
public override void OnDoubleClick(Mobile from)
{
if (!VerifyMove(from))
return;
if ( !from.InRange( GetWorldLocation(), 2 ) )
{
from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that.
return;
}
if (!from.InRange(GetWorldLocation(), 2))
{
from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
return;
}
Point3D fireLocation = GetFireLocation( from );
Point3D fireLocation = GetFireLocation(from);
if ( fireLocation == Point3D.Zero )
{
from.SendLocalizedMessage( 501695 ); // There is not a spot nearby to place your campfire.
}
else if ( !from.CheckSkill( SkillName.Camping, 0.0, 100.0 ) )
{
from.SendLocalizedMessage( 501696 ); // You fail to ignite the campfire.
}
else
{
Consume();
if (fireLocation == Point3D.Zero)
{
from.SendLocalizedMessage(501695); // There is not a spot nearby to place your campfire.
}
else if (!from.CheckSkill(SkillName.Camping, 0.0, 100.0))
{
from.SendLocalizedMessage(501696); // You fail to ignite the campfire.
}
else
{
Consume();
if ( !Deleted && Parent == null )
from.PlaceInBackpack( this );
if (!Deleted && Parent == null)
from.PlaceInBackpack(this);
new Campfire().MoveToWorld( fireLocation, from.Map );
}
}
new Campfire().MoveToWorld(fireLocation, from.Map);
}
}
private Point3D GetFireLocation( Mobile from )
{
if ( from.Region.IsPartOf( typeof( DungeonRegion ) ) )
return Point3D.Zero;
private Point3D GetFireLocation(Mobile from)
{
if (from.Region.IsPartOf(typeof(DungeonRegion)))
return Point3D.Zero;
if ( Parent == null )
return Location;
if (Parent == null)
return Location;
ArrayList list = new ArrayList( 4 );
ArrayList list = new ArrayList(4);
AddOffsetLocation( from, 0, -1, list );
AddOffsetLocation( from, -1, 0, list );
AddOffsetLocation( from, 0, 1, list );
AddOffsetLocation( from, 1, 0, list );
AddOffsetLocation(from, 0, -1, list);
AddOffsetLocation(from, -1, 0, list);
AddOffsetLocation(from, 0, 1, list);
AddOffsetLocation(from, 1, 0, list);
if ( list.Count == 0 )
return Point3D.Zero;
if (list.Count == 0)
return Point3D.Zero;
int idx = Utility.Random( list.Count );
return (Point3D) list[idx];
}
int idx = Utility.Random(list.Count);
return (Point3D)list[idx];
}
private void AddOffsetLocation( Mobile from, int offsetX, int offsetY, ArrayList list )
{
Map map = from.Map;
private void AddOffsetLocation(Mobile from, int offsetX, int offsetY, ArrayList list)
{
Map map = from.Map;
int x = from.X + offsetX;
int y = from.Y + offsetY;
int x = from.X + offsetX;
int y = from.Y + offsetY;
Point3D loc = new Point3D( x, y, from.Z );
Point3D loc = new Point3D(x, y, from.Z);
if ( map.CanFit( loc, 1 ) && from.InLOS( loc ) )
{
list.Add( loc );
}
else
{
loc = new Point3D( x, y, map.GetAverageZ( x, y ) );
if (map.CanFit(loc, 1) && from.InLOS(loc))
{
list.Add(loc);
}
else
{
loc = new Point3D(x, y, map.GetAverageZ(x, y));
if ( map.CanFit( loc, 1 ) && from.InLOS( loc ) )
list.Add( loc );
}
}
}
if (map.CanFit(loc, 1) && from.InLOS(loc))
list.Add(loc);
}
}
}
}