Any help :?: (real newb at c# scripting)
ok, I was trying to modify the gambling stone to make the options on it changable and it was a disaster so I was wondering if anyone could look at my modified version and tell me what I'm doing wrong.
[code:1]
// Gambling Stone
// By zero
using System;
using Server.Items;
namespace Server.Scripts.Items
{
public class GamblingStone : Item
{
private int m_GamblePot = 2500;
private int m_GambleAmount = 250;
private int m_GambleJackpotChance = 1;
private int m_GambleRegbagChance = 20;
private int m_GambleBigCheckChance = 40;
private int m_GambleSmallCheckChance = 100;
private int m_GambleRegBagAmount = 50;
private int m_GambleJackpotStart = m_GamblePot;
[CommandProperty( AccessLevel.GameMaster )]
public int GamblePot
{
get
{
return m_GamblePot;
}
set
{
m_GamblePot = value;
}
}
public int GambleJackpotChance
{
get
{
return m_GambleJackpotChance;
}
set
{
m_GambleJackpotChance = value;
}
}
public int RegbagChance
{
get
{
return m_RegbagChance;
}
set
{
m_RegbagChance = value;
}
}
public int GambleBigCheckChance
{
get
{
return m_GambleBigCheckChance;
}
set
{
m_GambleBigCheckChance = value;
}
}
public int GambleSmallCheckChance
{
get
{
return m_GambleSmallCheckChance;
}
set
{
m_GambleSmallCheckChance = value;
}
}
public int GambleRegBagAmount
{
get
{
return m_GambleRegBagAmount;
}
set
{
m_GambleRegBagAmount = value;
}
}
public int GambleJackpotStart
{
get
{
return m_GambleJackpotStart;
}
set
{
m_GambleJackpotStart = value;
}
}
[Constructable]
public GamblingStone() : base( 0xED4 )
{
Movable = false;
Hue = 0x56;
Name = "a gambling stone";
}
public override void OnSingleClick( Mobile from )
{
base.OnSingleClick( from );
base.LabelTo( from, "Jackpot: {0}gp", m_GamblePot );
}
public override void OnDoubleClick( Mobile from )
{
Container pack = from.Backpack;
if ( pack != null && pack.ConsumeTotal( typeof( Gold ), m_GambleAmount ) )
{
m_GamblePot += 150;
int roll = Utility.Random( 999 );
if ( roll == ( m_GambleJackpotChance - 1 ) ) // Jackpot
{
from.SendMessage( 0x35, "You win the {0}gp jackpot!", m_GamblePot );
from.AddToBackpack( new BankCheck( m_GamblePot ) );
m_GamblePot = m_GambleJackpotStart;
}
else if ( roll <= ( m_GambleRegbagChance - 1 ) ) // Chance for a regbag
{
from.SendMessage( 0x35, "You win a bag of reagents!" );
from.AddToBackpack( new BagOfReagents( m_RegBagAmount ) );
}
else if ( roll <= ( m_GambleBigCheckChance - 1 ) ) // Chance for gold
{
from.SendMessage( 0x35, "You win 1500gp!" );
from.AddToBackpack( new BankCheck( 1500 ) );
}
else if ( roll <= ( m_GamblSmallCheckChance -1 ) ) // Another chance for gold
{
from.SendMessage( 0x35, "You win 1000gp!" );
from.AddToBackpack( new BankCheck( 1000 ) );
}
else // Loser!
{
from.SendMessage( 0x22, "You lose!" );
}
}
else
{
from.SendMessage( 0x22, "You need at least (0)gp in your backpack to use this.", m_GambleAmount );
}
}
public GamblingStone( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
writer.Write( (int) m_GamblePot );
writer.Write( (int) m_GambleJackpotChance );
writer.Write( (int) m_GambleRegbagChance );
writer.Write( (int) m_GambleBigCheckChance );
writer.Write( (int) m_GambleSmallCheckChance );
writer.Write( (int) m_GambleRegBagAmount );
writer.Write( (int) m_GambleJackpotStart );
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
switch ( version )
{
case 0:
{
m_GamblePot = reader.ReadInt();
m_GambleJackpotChance = reader.ReadInt();
m_GambleRegbagChance = reader.ReadInt();
m_GambleBigCheckChance = reader.ReadInt();
m_GambleSmallCheckChance = reader.ReadInt();
m_GambleRegBagAmount = reader.ReadInt();
m_GambleJackpotStart = reader.ReadInt();
break;
}
}
}
}
}
[/code:1]
*prepares to be flamed on everything he is doing wrong*
ok, I was trying to modify the gambling stone to make the options on it changable and it was a disaster so I was wondering if anyone could look at my modified version and tell me what I'm doing wrong.
[code:1]
// Gambling Stone
// By zero
using System;
using Server.Items;
namespace Server.Scripts.Items
{
public class GamblingStone : Item
{
private int m_GamblePot = 2500;
private int m_GambleAmount = 250;
private int m_GambleJackpotChance = 1;
private int m_GambleRegbagChance = 20;
private int m_GambleBigCheckChance = 40;
private int m_GambleSmallCheckChance = 100;
private int m_GambleRegBagAmount = 50;
private int m_GambleJackpotStart = m_GamblePot;
[CommandProperty( AccessLevel.GameMaster )]
public int GamblePot
{
get
{
return m_GamblePot;
}
set
{
m_GamblePot = value;
}
}
public int GambleJackpotChance
{
get
{
return m_GambleJackpotChance;
}
set
{
m_GambleJackpotChance = value;
}
}
public int RegbagChance
{
get
{
return m_RegbagChance;
}
set
{
m_RegbagChance = value;
}
}
public int GambleBigCheckChance
{
get
{
return m_GambleBigCheckChance;
}
set
{
m_GambleBigCheckChance = value;
}
}
public int GambleSmallCheckChance
{
get
{
return m_GambleSmallCheckChance;
}
set
{
m_GambleSmallCheckChance = value;
}
}
public int GambleRegBagAmount
{
get
{
return m_GambleRegBagAmount;
}
set
{
m_GambleRegBagAmount = value;
}
}
public int GambleJackpotStart
{
get
{
return m_GambleJackpotStart;
}
set
{
m_GambleJackpotStart = value;
}
}
[Constructable]
public GamblingStone() : base( 0xED4 )
{
Movable = false;
Hue = 0x56;
Name = "a gambling stone";
}
public override void OnSingleClick( Mobile from )
{
base.OnSingleClick( from );
base.LabelTo( from, "Jackpot: {0}gp", m_GamblePot );
}
public override void OnDoubleClick( Mobile from )
{
Container pack = from.Backpack;
if ( pack != null && pack.ConsumeTotal( typeof( Gold ), m_GambleAmount ) )
{
m_GamblePot += 150;
int roll = Utility.Random( 999 );
if ( roll == ( m_GambleJackpotChance - 1 ) ) // Jackpot
{
from.SendMessage( 0x35, "You win the {0}gp jackpot!", m_GamblePot );
from.AddToBackpack( new BankCheck( m_GamblePot ) );
m_GamblePot = m_GambleJackpotStart;
}
else if ( roll <= ( m_GambleRegbagChance - 1 ) ) // Chance for a regbag
{
from.SendMessage( 0x35, "You win a bag of reagents!" );
from.AddToBackpack( new BagOfReagents( m_RegBagAmount ) );
}
else if ( roll <= ( m_GambleBigCheckChance - 1 ) ) // Chance for gold
{
from.SendMessage( 0x35, "You win 1500gp!" );
from.AddToBackpack( new BankCheck( 1500 ) );
}
else if ( roll <= ( m_GamblSmallCheckChance -1 ) ) // Another chance for gold
{
from.SendMessage( 0x35, "You win 1000gp!" );
from.AddToBackpack( new BankCheck( 1000 ) );
}
else // Loser!
{
from.SendMessage( 0x22, "You lose!" );
}
}
else
{
from.SendMessage( 0x22, "You need at least (0)gp in your backpack to use this.", m_GambleAmount );
}
}
public GamblingStone( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
writer.Write( (int) m_GamblePot );
writer.Write( (int) m_GambleJackpotChance );
writer.Write( (int) m_GambleRegbagChance );
writer.Write( (int) m_GambleBigCheckChance );
writer.Write( (int) m_GambleSmallCheckChance );
writer.Write( (int) m_GambleRegBagAmount );
writer.Write( (int) m_GambleJackpotStart );
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
switch ( version )
{
case 0:
{
m_GamblePot = reader.ReadInt();
m_GambleJackpotChance = reader.ReadInt();
m_GambleRegbagChance = reader.ReadInt();
m_GambleBigCheckChance = reader.ReadInt();
m_GambleSmallCheckChance = reader.ReadInt();
m_GambleRegBagAmount = reader.ReadInt();
m_GambleJackpotStart = reader.ReadInt();
break;
}
}
}
}
}
[/code:1]
*prepares to be flamed on everything he is doing wrong*