a few more fixes.

This commit is contained in:
xavier 2011-07-31 23:51:08 +00:00
parent 1f788d60d9
commit 53d92a9e4e
3 changed files with 45 additions and 19 deletions

View file

@ -17,6 +17,9 @@
[CommandProperty( AccessLevel.GameMaster )] [CommandProperty( AccessLevel.GameMaster )]
public virtual int currItemID { get { return ( IsEmpty ) ? voidItem_ID : fullItem_ID; } } public virtual int currItemID { get { return ( IsEmpty ) ? voidItem_ID : fullItem_ID; } }
[CommandProperty( AccessLevel.GameMaster )]
public virtual bool CanFill { get { return ( !IsFull && !IsLockedDown() ); } }
[CommandProperty( AccessLevel.GameMaster )] [CommandProperty( AccessLevel.GameMaster )]
public int Quantity public int Quantity
{ {
@ -26,7 +29,7 @@
} }
set set
{ {
if( value != m_Quantity ) if( value != m_Quantity && CanFill )
{ {
UpdateContainer( value ); UpdateContainer( value );
@ -43,6 +46,20 @@
m_Quantity = ( filled ) ? MaxQuantity : 0; m_Quantity = ( filled ) ? MaxQuantity : 0;
} }
public virtual bool IsLockedDown()
{
Multis.BaseHouse house = Multis.BaseHouse.FindHouseAt( this );
if( house == null || !house.IsLockedDown( this ) )
{
if( Parent == null )
{
return true;
}
}
return false;
}
public override void OnDoubleClick( Mobile from ) public override void OnDoubleClick( Mobile from )
{ {
if( IsEmpty ) if( IsEmpty )

View file

@ -1,6 +1,3 @@
using System;
using Server.Items;
namespace Server.Items namespace Server.Items
{ {
public class GamblingStone : Item public class GamblingStone : Item
@ -27,7 +24,8 @@ namespace Server.Items
} }
[Constructable] [Constructable]
public GamblingStone() : base( 0xED4 ) public GamblingStone()
: base( 0xED4 )
{ {
Movable = false; Movable = false;
Hue = 0x56; Hue = 0x56;
@ -50,31 +48,41 @@ namespace Server.Items
{ {
Container pack = from.Backpack; Container pack = from.Backpack;
if ( pack != null && pack.ConsumeTotal( typeof( Gold ), 250 ) ) if( pack != null && pack.ConsumeTotal( typeof( Gold ), 250 ) )
{ {
m_GamblePot += 150; m_GamblePot += 150;
InvalidateProperties(); InvalidateProperties();
int roll = Utility.Random( 1200 ); int roll = Utility.Random( 1200 );
if ( roll == 0 ) // Jackpot if( roll == 0 ) // Jackpot
{ {
int maxCheck = 1000000;
from.SendMessage( 0x35, "You win the {0}gp jackpot!", m_GamblePot ); from.SendMessage( 0x35, "You win the {0}gp jackpot!", m_GamblePot );
while( m_GamblePot > maxCheck )
{
from.AddToBackpack( new BankCheck( maxCheck ) );
m_GamblePot -= maxCheck;
}
from.AddToBackpack( new BankCheck( m_GamblePot ) ); from.AddToBackpack( new BankCheck( m_GamblePot ) );
m_GamblePot = 2500; m_GamblePot = 2500;
} }
else if ( roll <= 20 ) // Chance for a regbag else if( roll <= 20 ) // Chance for a regbag
{ {
from.SendMessage( 0x35, "You win a bag of reagents!" ); from.SendMessage( 0x35, "You win a bag of reagents!" );
from.AddToBackpack( new BagOfReagents( 50 ) ); from.AddToBackpack( new BagOfReagents( 50 ) );
} }
else if ( roll <= 40 ) // Chance for gold else if( roll <= 40 ) // Chance for gold
{ {
from.SendMessage( 0x35, "You win 1500gp!" ); from.SendMessage( 0x35, "You win 1500gp!" );
from.AddToBackpack( new BankCheck( 1500 ) ); from.AddToBackpack( new BankCheck( 1500 ) );
} }
else if ( roll <= 100 ) // Another chance for gold else if( roll <= 100 ) // Another chance for gold
{ {
from.SendMessage( 0x35, "You win 1000gp!" ); from.SendMessage( 0x35, "You win 1000gp!" );
from.AddToBackpack( new BankCheck( 1000 ) ); from.AddToBackpack( new BankCheck( 1000 ) );
@ -89,8 +97,9 @@ namespace Server.Items
from.SendMessage( 0x22, "You need at least 250gp in your backpack to use this." ); from.SendMessage( 0x22, "You need at least 250gp in your backpack to use this." );
} }
} }
public GamblingStone( Serial serial ) : base( serial ) public GamblingStone( Serial serial )
: base( serial )
{ {
} }
@ -98,9 +107,9 @@ namespace Server.Items
{ {
base.Serialize( writer ); base.Serialize( writer );
writer.Write( (int) 0 ); // version writer.Write( (int)0 ); // version
writer.Write( (int) m_GamblePot ); writer.Write( (int)m_GamblePot );
} }
public override void Deserialize( GenericReader reader ) public override void Deserialize( GenericReader reader )
@ -109,14 +118,14 @@ namespace Server.Items
int version = reader.ReadInt(); int version = reader.ReadInt();
switch ( version ) switch( version )
{ {
case 0: case 0:
{ {
m_GamblePot = reader.ReadInt(); m_GamblePot = reader.ReadInt();
break; break;
} }
} }
} }
} }