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

@ -2,160 +2,158 @@ using System;
namespace Server.Items
{
[FlippableAddon( Direction.South, Direction.East )]
public class SacrificialAltarAddon : BaseAddonContainer
{
public override BaseAddonContainerDeed Deed => new SacrificialAltarDeed();
public override int LabelNumber => 1074818; // Sacrificial Altar
public override int DefaultMaxWeight => 0;
public override int DefaultGumpID => 0x107;
public override int DefaultDropSound => 0x42;
[FlippableAddon(Direction.South, Direction.East)]
public class SacrificialAltarAddon : BaseAddonContainer
{
private Timer m_Timer;
private Timer m_Timer;
[Constructible]
public SacrificialAltarAddon() : base(0x2A9B)
{
Direction = Direction.South;
[Constructible]
public SacrificialAltarAddon() : base( 0x2A9B )
{
Direction = Direction.South;
AddComponent(new LocalizedContainerComponent(0x2A9A, 1074818), 1, 0, 0);
}
AddComponent( new LocalizedContainerComponent( 0x2A9A, 1074818 ), 1, 0, 0 );
}
public SacrificialAltarAddon(Serial serial) : base(serial)
{
}
public SacrificialAltarAddon( Serial serial ) : base( serial )
{
}
public override BaseAddonContainerDeed Deed => new SacrificialAltarDeed();
public override int LabelNumber => 1074818; // Sacrificial Altar
public override int DefaultMaxWeight => 0;
public override int DefaultGumpID => 0x107;
public override int DefaultDropSound => 0x42;
public override bool OnDragDrop( Mobile from, Item dropped )
{
if ( !base.OnDragDrop( from, dropped ) )
return false;
public override bool OnDragDrop(Mobile from, Item dropped)
{
if (!base.OnDragDrop(from, dropped))
return false;
if ( TotalItems >= 50 )
{
SendLocalizedMessageTo( from, 501478 ); // The trash is full! Emptying!
Empty();
}
else
{
SendLocalizedMessageTo( from, 1010442 ); // The item will be deleted in three minutes
if (TotalItems >= 50)
{
SendLocalizedMessageTo(from, 501478); // The trash is full! Emptying!
Empty();
}
else
{
SendLocalizedMessageTo(from, 1010442); // The item will be deleted in three minutes
m_Timer?.Stop();
m_Timer?.Stop();
m_Timer = Timer.DelayCall( TimeSpan.FromMinutes( 3 ), Empty );
}
m_Timer = Timer.DelayCall(TimeSpan.FromMinutes(3), Empty);
}
return true;
}
return true;
}
public override bool OnDragDropInto( Mobile from, Item item, Point3D p )
{
if ( !base.OnDragDropInto( from, item, p ) )
return false;
public override bool OnDragDropInto(Mobile from, Item item, Point3D p)
{
if (!base.OnDragDropInto(from, item, p))
return false;
if ( TotalItems >= 50 )
{
SendLocalizedMessageTo( from, 501478 ); // The trash is full! Emptying!
Empty();
}
else
{
SendLocalizedMessageTo( from, 1010442 ); // The item will be deleted in three minutes
if (TotalItems >= 50)
{
SendLocalizedMessageTo(from, 501478); // The trash is full! Emptying!
Empty();
}
else
{
SendLocalizedMessageTo(from, 1010442); // The item will be deleted in three minutes
m_Timer?.Stop();
m_Timer?.Stop();
m_Timer = Timer.DelayCall( TimeSpan.FromMinutes( 3 ), Empty );
}
m_Timer = Timer.DelayCall(TimeSpan.FromMinutes(3), Empty);
}
return true;
}
return true;
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.WriteEncodedInt( 0 ); // version
}
writer.WriteEncodedInt(0); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadEncodedInt();
int version = reader.ReadEncodedInt();
if ( Items.Count > 0 )
m_Timer = Timer.DelayCall( TimeSpan.FromMinutes( 3 ), Empty );
}
if (Items.Count > 0)
m_Timer = Timer.DelayCall(TimeSpan.FromMinutes(3), Empty);
}
public virtual void Flip( Mobile from, Direction direction )
{
switch ( direction )
{
case Direction.East:
ItemID = 0x2A9C;
AddComponent( new LocalizedContainerComponent( 0x2A9D, 1074818 ), 0, -1, 0 );
break;
case Direction.South:
ItemID = 0x2A9B;
AddComponent( new LocalizedContainerComponent( 0x2A9A, 1074818 ), 1, 0, 0 );
break;
}
}
public virtual void Flip(Mobile from, Direction direction)
{
switch (direction)
{
case Direction.East:
ItemID = 0x2A9C;
AddComponent(new LocalizedContainerComponent(0x2A9D, 1074818), 0, -1, 0);
break;
case Direction.South:
ItemID = 0x2A9B;
AddComponent(new LocalizedContainerComponent(0x2A9A, 1074818), 1, 0, 0);
break;
}
}
public virtual void Empty()
{
if ( Items.Count > 0 )
{
Point3D location = Location;
location.Z += 10;
public virtual void Empty()
{
if (Items.Count > 0)
{
Point3D location = Location;
location.Z += 10;
Effects.SendLocationEffect( location, Map, 0x3709, 10, 10, 0x356, 0 );
Effects.PlaySound( location, Map, 0x32E );
Effects.SendLocationEffect(location, Map, 0x3709, 10, 10, 0x356, 0);
Effects.PlaySound(location, Map, 0x32E);
if ( Items.Count > 0 )
{
for ( int i = Items.Count - 1; i >= 0; --i )
{
if ( i >= Items.Count )
continue;
if (Items.Count > 0)
for (int i = Items.Count - 1; i >= 0; --i)
{
if (i >= Items.Count)
continue;
Items[ i ].Delete();
}
}
}
Items[i].Delete();
}
}
m_Timer?.Stop();
m_Timer?.Stop();
m_Timer = null;
}
}
m_Timer = null;
}
}
public class SacrificialAltarDeed : BaseAddonContainerDeed
{
public override BaseAddonContainer Addon => new SacrificialAltarAddon();
public override int LabelNumber => 1074818; // Sacrificial Altar
public class SacrificialAltarDeed : BaseAddonContainerDeed
{
[Constructible]
public SacrificialAltarDeed()
{
LootType = LootType.Blessed;
}
[Constructible]
public SacrificialAltarDeed()
{
LootType = LootType.Blessed;
}
public SacrificialAltarDeed(Serial serial) : base(serial)
{
}
public SacrificialAltarDeed( Serial serial ) : base( serial )
{
}
public override BaseAddonContainer Addon => new SacrificialAltarAddon();
public override int LabelNumber => 1074818; // Sacrificial Altar
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.WriteEncodedInt( 0 ); // version
}
writer.WriteEncodedInt(0); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadEncodedInt();
}
}
}
int version = reader.ReadEncodedInt();
}
}
}