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,92 +2,92 @@ using System;
namespace Server.Items
{
public class BaseFish : Item
{
private static readonly TimeSpan DeathDelay = TimeSpan.FromMinutes( 5 );
public class BaseFish : Item
{
private static readonly TimeSpan DeathDelay = TimeSpan.FromMinutes(5);
private Timer m_Timer;
private Timer m_Timer;
[CommandProperty( AccessLevel.GameMaster )]
public bool Dead => ( ItemID == 0x3B0C );
[Constructible]
public BaseFish(int itemID) : base(itemID)
{
StartTimer();
}
[Constructible]
public BaseFish( int itemID ) : base( itemID )
{
StartTimer();
}
public BaseFish(Serial serial) : base(serial)
{
}
public BaseFish( Serial serial ) : base( serial )
{
}
[CommandProperty(AccessLevel.GameMaster)]
public bool Dead => ItemID == 0x3B0C;
public virtual void StartTimer()
{
m_Timer?.Stop();
public virtual void StartTimer()
{
m_Timer?.Stop();
m_Timer = Timer.DelayCall( DeathDelay, Kill );
m_Timer = Timer.DelayCall(DeathDelay, Kill);
InvalidateProperties();
}
InvalidateProperties();
}
public virtual void StopTimer()
{
m_Timer?.Stop();
public virtual void StopTimer()
{
m_Timer?.Stop();
m_Timer = null;
m_Timer = null;
InvalidateProperties();
}
InvalidateProperties();
}
public override void OnDelete()
{
StopTimer();
}
public override void OnDelete()
{
StopTimer();
}
public virtual void Kill()
{
ItemID = 0x3B0C;
StopTimer();
public virtual void Kill()
{
ItemID = 0x3B0C;
StopTimer();
InvalidateProperties();
}
InvalidateProperties();
}
public int GetDescription()
{
// TODO: This will never return "very unusual dead aquarium creature" due to the way it is killed
if ( ItemID > 0x3B0F )
return Dead ? 1074424 : 1074422; // A very unusual [dead/live] aquarium creature
if ( Hue != 0 )
return Dead ? 1074425 : 1074423; // A [dead/live] aquarium creature of unusual color
public int GetDescription()
{
// TODO: This will never return "very unusual dead aquarium creature" due to the way it is killed
if (ItemID > 0x3B0F)
return Dead ? 1074424 : 1074422; // A very unusual [dead/live] aquarium creature
if (Hue != 0)
return Dead ? 1074425 : 1074423; // A [dead/live] aquarium creature of unusual color
return Dead ? 1073623 : 1073622; // A [dead/live] aquarium creature
}
return Dead ? 1073623 : 1073622; // A [dead/live] aquarium creature
}
public override void GetProperties( ObjectPropertyList list )
{
base.GetProperties( list );
public override void GetProperties(ObjectPropertyList list)
{
base.GetProperties(list);
list.Add( GetDescription() );
list.Add(GetDescription());
if ( !Dead && m_Timer != null )
list.Add( 1074507 ); // Gasping for air
}
if (!Dead && m_Timer != null)
list.Add(1074507); // Gasping for air
}
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();
if ( !( Parent is Aquarium ) && !( Parent is FishBowl ) )
StartTimer();
}
}
}
if (!(Parent is Aquarium) && !(Parent is FishBowl))
StartTimer();
}
}
}