This commit is contained in:
eos 2011-12-01 05:42:10 +00:00
parent 4e15a2aa4c
commit 4708ec4301
18 changed files with 889 additions and 800 deletions

View file

@ -3,17 +3,19 @@ using Server;
using Server.Items;
namespace Server.Items
{
{
public class BaseFish : Item
{
private Timer m_Timer;
private static readonly TimeSpan DeathDelay = TimeSpan.FromMinutes( 5 );
private Timer m_Timer;
[CommandProperty( AccessLevel.GameMaster )]
public bool Dead
{
get{ return ItemID == 0x3B0C; }
get{ return ( ItemID == 0x3B0C ); }
}
[Constructable]
public BaseFish( int itemID ) : base( itemID )
{
@ -21,65 +23,59 @@ namespace Server.Items
}
public BaseFish( Serial serial ) : base( serial )
{
{
}
public virtual void StartTimer()
{
if ( m_Timer != null )
m_Timer.Stop();
m_Timer = Timer.DelayCall( TimeSpan.FromMinutes( 5 ), new TimerCallback( Kill ) );
m_Timer = Timer.DelayCall( DeathDelay, new TimerCallback( Kill ) );
InvalidateProperties();
}
public virtual void StopTimer()
{
if ( m_Timer != null )
m_Timer.Stop();
m_Timer = null;
InvalidateProperties();
}
public override void OnDelete()
{
StopTimer();
}
public virtual void Kill()
{
ItemID = 0x3B0C;
StopTimer();
InvalidateProperties();
}
public override bool DropToItem( Mobile from, Item target, Point3D p )
{
if ( target is FishBowl || target is Aquarium )
{
if ( base.DropToItem( from, target, p ) )
{
StopTimer();
return true;
}
}
return base.DropToItem( from, target, p );
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
else if ( Hue != 0 )
return Dead ? 1074425 : 1074423; // A [dead/live] aquarium creature of unusual color
return Dead ? 1073623 : 1073622; // A [dead/live] aquarium creature
}
public override void GetProperties( ObjectPropertyList list )
{
base.GetProperties( list );
if ( !Dead && ItemID > 0x3B0F )
list.Add( 1074422 ); // A very unusual live aquarium creature
else if ( !Dead && Hue > 0 )
list.Add( 1074423 ); // A live aquarium creature of unusual color
else if ( !Dead )
list.Add( 1073622 ); // A live aquarium creature
else if ( Dead && ItemID > 0x3B0F )
list.Add( 1074424 ); // A very unusual dead aquarium creature
else if ( Dead && Hue > 0 )
list.Add( 1074425 ); // A dead aquarium creature of unusual color
else if ( Dead )
list.Add( 1073623 ); // A dead aquarium creature
list.Add( GetDescription() );
if ( !Dead && m_Timer != null )
list.Add( 1074507 ); // Gasping for air
}
@ -96,7 +92,7 @@ namespace Server.Items
base.Deserialize( reader );
int version = reader.ReadInt();
if ( !( Parent is Aquarium ) && !( Parent is FishBowl ) )
StartTimer();
}