Various Aquarium fixes - http://jira.runuo.com/browse/RUNUO-102
This commit is contained in:
parent
4e15a2aa4c
commit
4708ec4301
18 changed files with 889 additions and 800 deletions
|
|
@ -6,77 +6,91 @@ using Server.ContextMenus;
|
|||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class FishBowl : Container
|
||||
{
|
||||
public class FishBowl : BaseContainer
|
||||
{
|
||||
public override int LabelNumber{ get{ return 1074499; } } // A fish bowl
|
||||
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public bool Empty
|
||||
{
|
||||
get{ return Items.Count == 0; }
|
||||
get{ return ( Items.Count == 0 ); }
|
||||
}
|
||||
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public BaseFish Fish
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( Empty )
|
||||
return null;
|
||||
|
||||
|
||||
if ( Items[ 0 ] is BaseFish )
|
||||
return (BaseFish) Items[ 0 ];
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public override double DefaultWeight { get { return 2.0; } }
|
||||
|
||||
[Constructable]
|
||||
public FishBowl() : base( 0x241C )
|
||||
{
|
||||
Hue = 0x47E;
|
||||
Hue = 0x47E;
|
||||
MaxItems = 1;
|
||||
Weight = 1;
|
||||
}
|
||||
|
||||
public FishBowl( Serial serial ) : base( serial )
|
||||
{
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
public override bool OnDragDrop( Mobile from, Item dropped )
|
||||
{
|
||||
if ( dropped is BaseFish && Empty )
|
||||
if ( !IsAccessibleTo( from ) )
|
||||
{
|
||||
((BaseFish) dropped).StopTimer();
|
||||
InvalidateProperties();
|
||||
|
||||
return base.OnDragDrop( from, dropped );
|
||||
from.SendLocalizedMessage( 502436 ); // That is not accessible.
|
||||
return false;
|
||||
}
|
||||
else
|
||||
|
||||
if ( !( dropped is BaseFish ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1074836 ); // The container can not hold that type of object.
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( base.OnDragDrop( from, dropped ) )
|
||||
{
|
||||
((BaseFish) dropped).StopTimer();
|
||||
InvalidateProperties();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void GetProperties( ObjectPropertyList list )
|
||||
|
||||
public override void AddNameProperties( ObjectPropertyList list )
|
||||
{
|
||||
list.Add( 1074499 ); // A fish bowl
|
||||
list.Add( 1072788, Weight.ToString() ); // Weight: ~1_WEIGHT~ stone
|
||||
|
||||
base.AddNameProperties( list );
|
||||
|
||||
if ( !Empty )
|
||||
list.Add( 1074494, "#" + Fish.LabelNumber ); // Contains: ~1_CREATURE~
|
||||
|
||||
list.Add( 1073841, "{0}\t{1}\t{2}", Items.Count, MaxItems, GetTotal( TotalType.Weight ) ); // Contents: ~1_COUNT~/~2_MAXCOUNT~ items, ~3_WEIGHT~ stones
|
||||
{
|
||||
BaseFish fish = Fish;
|
||||
|
||||
if ( fish != null )
|
||||
list.Add( 1074494, "#{0}", fish.LabelNumber ); // Contains: ~1_CREATURE~
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public override void GetContextMenuEntries( Mobile from, List<ContextMenuEntry> list )
|
||||
{
|
||||
base.GetContextMenuEntries( from, list );
|
||||
|
||||
if ( !Empty )
|
||||
|
||||
if ( !Empty && IsAccessibleTo( from ) )
|
||||
list.Add( new RemoveCreature( this ) );
|
||||
}
|
||||
|
||||
|
|
@ -84,7 +98,7 @@ namespace Server.Items
|
|||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
writer.Write( (int) 1 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
|
|
@ -92,33 +106,42 @@ namespace Server.Items
|
|||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
if ( version == 0 )
|
||||
Weight = DefaultWeight;
|
||||
}
|
||||
|
||||
|
||||
private class RemoveCreature : ContextMenuEntry
|
||||
{
|
||||
private FishBowl m_Bowl;
|
||||
|
||||
public RemoveCreature( FishBowl bowl ) : base( 6242, 0 ) // Remove creature
|
||||
|
||||
public RemoveCreature( FishBowl bowl ) : base( 6242, 3 ) // Remove creature
|
||||
{
|
||||
m_Bowl = bowl;
|
||||
}
|
||||
|
||||
|
||||
public override void OnClick()
|
||||
{
|
||||
if ( m_Bowl == null || m_Bowl.Deleted )
|
||||
if ( m_Bowl == null || m_Bowl.Deleted || !m_Bowl.IsAccessibleTo( Owner.From ) )
|
||||
return;
|
||||
|
||||
|
||||
BaseFish fish = m_Bowl.Fish;
|
||||
|
||||
|
||||
if ( fish != null )
|
||||
{
|
||||
if ( !Owner.From.PlaceInBackpack( fish ) )
|
||||
if ( fish.IsLockedDown )
|
||||
{
|
||||
Owner.From.SendLocalizedMessage( 1010449 ); // You may not use this object while it is locked down.
|
||||
}
|
||||
else if ( !Owner.From.PlaceInBackpack( fish ) )
|
||||
{
|
||||
Owner.From.SendLocalizedMessage( 1074496 ); // There is no room in your pack for the creature.
|
||||
}
|
||||
else
|
||||
{
|
||||
Owner.From.SendLocalizedMessage( 1074495 ); // The creature has been removed from the fish bowl.
|
||||
Owner.From.SendLocalizedMessage( 1074495 ); // The creature has been removed from the fish bowl.
|
||||
fish.StartTimer();
|
||||
m_Bowl.InvalidateProperties();
|
||||
m_Bowl.InvalidateProperties();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue