using System; using System.Collections; using Server; using Server.Prompts; using Server.Mobiles; using Server.ContextMenus; using Server.Gumps; using Server.Items; using Server.Network; using Server.Targeting; using Server.Multis; using Server.Regions; namespace Server.Items { [FlipableAttribute( 0xE41, 0xE40 )] public class IngotBox : Item { private int m_Iron; private int m_DullCopper; private int m_ShadowIron; private int m_Copper; private int m_Bronze; private int m_Gold; private int m_Agapite; private int m_Verite; private int m_Valorite; /* private int m_Blaze; private int m_Ice; private int m_Toxic; private int m_Electrum; private int m_Platinum; */ private int m_Sand; [CommandProperty( AccessLevel.GameMaster )] public int Iron{ get{ return m_Iron; } set{ m_Iron = value; InvalidateProperties(); } } [CommandProperty( AccessLevel.GameMaster )] public int DullCopper{ get{ return m_DullCopper; } set{ m_DullCopper = value; InvalidateProperties(); } } [CommandProperty( AccessLevel.GameMaster )] public int ShadowIron{ get{ return m_ShadowIron; } set{ m_ShadowIron = value; InvalidateProperties(); } } [CommandProperty( AccessLevel.GameMaster )] public int Copper{ get{ return m_Copper; } set{ m_Copper = value; InvalidateProperties(); } } [CommandProperty( AccessLevel.GameMaster )] public int Bronze{ get{ return m_Bronze; } set{ m_Bronze = value; InvalidateProperties(); } } [CommandProperty( AccessLevel.GameMaster )] public int Gold{ get{ return m_Gold; } set{ m_Gold = value; InvalidateProperties(); } } [CommandProperty( AccessLevel.GameMaster )] public int Agapite{ get{ return m_Agapite; } set{ m_Agapite = value; InvalidateProperties(); } } [CommandProperty( AccessLevel.GameMaster )] public int Verite{ get{ return m_Verite; } set{ m_Verite = value; InvalidateProperties(); } } [CommandProperty( AccessLevel.GameMaster )] public int Valorite{ get{ return m_Valorite; } set{ m_Valorite = value; InvalidateProperties(); } } /* [CommandProperty( AccessLevel.GameMaster )] public int Blaze{ get{ return m_Blaze; } set{ m_Blaze = value; InvalidateProperties(); } } [CommandProperty( AccessLevel.GameMaster )] public int Ice{ get{ return m_Ice; } set{ m_Ice = value; InvalidateProperties(); } } [CommandProperty( AccessLevel.GameMaster )] public int Toxic{ get{ return m_Toxic; } set{ m_Toxic = value; InvalidateProperties(); } } [CommandProperty( AccessLevel.GameMaster )] public int Electrum{ get{ return m_Electrum; } set{ m_Electrum = value; InvalidateProperties(); } } [CommandProperty( AccessLevel.GameMaster )] public int Platinum{ get{ return m_Platinum; } set{ m_Platinum = value; InvalidateProperties(); } } */ [CommandProperty( AccessLevel.GameMaster )] public int Sand{ get{ return m_Sand; } set{ m_Sand = value; InvalidateProperties(); } } [Constructable] public IngotBox() : base( 0xE41 ) { Movable = true; Weight = 100.0; Hue = 0x488; Name = "Ingot Box"; } public override void OnDoubleClick( Mobile from ) { if ( Movable && from.AccessLevel == AccessLevel.Player ) { from.SendMessage( "You haven't locked it down!" ); return; } if ( !from.InRange( GetWorldLocation(), 2 ) ) from.LocalOverheadMessage( Network.MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that. else if ( from is PlayerMobile ) from.SendGump( new IngotBoxGump( (PlayerMobile)from, this ) ); } public void BeginCombine( Mobile from ) { from.Target = new IngotBoxTarget( this ); } public void EndCombine( Mobile from, object o ) { if ( o is Item && ((Item)o).IsChildOf( from.Backpack ) ) { if (!( o is BaseIngot )) { if ( o is Sand ) { if ( Sand >= 500 ) from.SendMessage( "The sand is too full to add more." ); else { ((Item)o).Delete(); Sand = ( Sand + 1 ); from.SendGump( new IngotBoxGump( (PlayerMobile)from, this ) ); BeginCombine( from ); } } else { from.SendMessage( "That is not Ingot." ); } } if ( o is DullCopperIngot ) { if ( DullCopper >= 5000 ) from.SendMessage( "That Ingot type is too full to add more." ); else { Item curItem = o as Item; DullCopper += curItem.Amount; curItem.Delete(); from.SendGump( new IngotBoxGump( (PlayerMobile)from, this ) ); BeginCombine( from ); } } if ( o is ShadowIronIngot ) { if ( ShadowIron >= 5000 ) from.SendMessage( "That Ingot type is too full to add more." ); else { Item curItem = o as Item; ShadowIron += curItem.Amount; curItem.Delete(); from.SendGump( new IngotBoxGump( (PlayerMobile)from, this ) ); BeginCombine( from ); } } if (o is CopperIngot ) { if ( Copper >= 5000 ) from.SendMessage( "That Ingot type is too full to add more." ); else { Item curItem = o as Item; Copper += curItem.Amount; curItem.Delete(); from.SendGump( new IngotBoxGump( (PlayerMobile)from, this ) ); BeginCombine( from ); } } if (o is BronzeIngot ) { if ( Bronze >= 5000 ) from.SendMessage( "That Ingot type is too full to add more." ); else { Item curItem = o as Item; Bronze += curItem.Amount; curItem.Delete(); from.SendGump( new IngotBoxGump( (PlayerMobile)from, this ) ); BeginCombine( from ); } } if (o is GoldIngot ) { if ( Gold >= 5000 ) from.SendMessage( "That Ingot type is too full to add more." ); else { Item curItem = o as Item; Gold += curItem.Amount; curItem.Delete(); from.SendGump( new IngotBoxGump( (PlayerMobile)from, this ) ); BeginCombine( from ); } } if (o is AgapiteIngot ) { if ( Agapite >= 5000 ) from.SendMessage( "That Ingot type is too full to add more." ); else { Item curItem = o as Item; Agapite += curItem.Amount; curItem.Delete(); from.SendGump( new IngotBoxGump( (PlayerMobile)from, this ) ); BeginCombine( from ); } } if (o is VeriteIngot ) { if ( Verite >= 5000 ) from.SendMessage( "That Ingot type is too full to add more." ); else { Item curItem = o as Item; Verite += curItem.Amount; curItem.Delete(); from.SendGump( new IngotBoxGump( (PlayerMobile)from, this ) ); BeginCombine( from ); } } if (o is ValoriteIngot ) { if ( Valorite >= 5000 ) from.SendMessage( "That Ingot type is too full to add more." ); else { Item curItem = o as Item; Valorite += curItem.Amount; curItem.Delete(); from.SendGump( new IngotBoxGump( (PlayerMobile)from, this ) ); BeginCombine( from ); } } if (o is IronIngot ) { if ( Iron >= 5000 ) from.SendMessage( "That Ingot type is too full to add more." ); else { Item curItem = o as Item; Iron += curItem.Amount; curItem.Delete(); from.SendGump( new IngotBoxGump( (PlayerMobile)from, this ) ); BeginCombine( from ); } } /* if (o is BlazeIngot ) { if ( Blaze >= 5000 ) from.SendMessage( "That Ingot type is too full to add more." ); else { Item curItem = o as Item; Blaze += curItem.Amount; curItem.Delete(); from.SendGump( new IngotBoxGump( (PlayerMobile)from, this ) ); BeginCombine( from ); } } if (o is IceIngot ) { if ( Ice >= 5000 ) from.SendMessage( "That Ingot type is too full to add more." ); else { Item curItem = o as Item; Ice += curItem.Amount; curItem.Delete(); from.SendGump( new IngotBoxGump( (PlayerMobile)from, this ) ); BeginCombine( from ); } } if (o is ToxicIngot ) { if ( Toxic >= 5000 ) from.SendMessage( "That Ingot type is too full to add more." ); else { Item curItem = o as Item; Toxic += curItem.Amount; curItem.Delete(); from.SendGump( new IngotBoxGump( (PlayerMobile)from, this ) ); BeginCombine( from ); } } if (o is ElectrumIngot ) { if ( Electrum >= 5000 ) from.SendMessage( "That Ingot type is too full to add more." ); else { Item curItem = o as Item; Electrum += curItem.Amount; curItem.Delete(); from.SendGump( new IngotBoxGump( (PlayerMobile)from, this ) ); BeginCombine( from ); } } if (o is PlatinumIngot ) { if ( Platinum >= 5000 ) from.SendMessage( "That Ingot type is too full to add more." ); else { Item curItem = o as Item; Platinum += curItem.Amount; curItem.Delete(); from.SendGump( new IngotBoxGump( (PlayerMobile)from, this ) ); BeginCombine( from ); } } */ } else { from.SendLocalizedMessage( 1045158 ); // You must have the item in your backpack to target it. } } public IngotBox( Serial serial ) : base( serial ) { } public override void Serialize( GenericWriter writer ) { base.Serialize( writer ); writer.Write( (int) m_Iron); writer.Write( (int) m_DullCopper); writer.Write( (int) m_ShadowIron); writer.Write( (int) m_Copper); writer.Write( (int) m_Bronze); writer.Write( (int) m_Gold); writer.Write( (int) m_Agapite); writer.Write( (int) m_Verite); writer.Write( (int) m_Valorite); /* writer.Write( (int) m_Blaze); writer.Write( (int) m_Ice); writer.Write( (int) m_Toxic); writer.Write( (int) m_Electrum); writer.Write( (int) m_Platinum); */ writer.Write( (int) m_Sand); } public override void Deserialize( GenericReader reader ) { base.Deserialize( reader ); m_Iron = reader.ReadInt(); m_DullCopper = reader.ReadInt(); m_ShadowIron = reader.ReadInt(); m_Copper = reader.ReadInt(); m_Bronze = reader.ReadInt(); m_Gold = reader.ReadInt(); m_Agapite = reader.ReadInt(); m_Verite = reader.ReadInt(); m_Valorite = reader.ReadInt(); /* m_Blaze = reader.ReadInt(); m_Ice = reader.ReadInt(); m_Toxic = reader.ReadInt(); m_Electrum = reader.ReadInt(); m_Platinum = reader.ReadInt(); */ m_Sand = reader.ReadInt(); } } } namespace Server.Items { public class IngotBoxGump : Gump { private PlayerMobile m_From; private IngotBox m_Box; public IngotBoxGump( PlayerMobile from, IngotBox box ) : base( 25, 25 ) { m_From = from; m_Box = box; m_From.CloseGump( typeof( IngotBoxGump ) ); AddPage( 0 ); AddBackground( 50, 10, 455, 260, 5054 ); AddImageTiled( 58, 20, 438, 241, 2624 ); AddAlphaRegion( 58, 20, 438, 241 ); AddLabel( 225, 25, 88, "Ingot Box" ); AddLabel( 125, 50, 0x486, "Iron" ); AddLabel( 225, 50, 0x480, box.Iron.ToString() ); AddButton( 75, 50, 4005, 4007, 1, GumpButtonType.Reply, 0 ); AddLabel( 125, 75, 0x486, "Dull Copper" ); AddLabel( 225, 75, 0x480, box.DullCopper.ToString() ); AddButton( 75, 75, 4005, 4007, 2, GumpButtonType.Reply, 0 ); AddLabel( 125, 100, 0x486, "Shadow Iron" ); AddLabel( 225, 100, 0x480, box.ShadowIron.ToString() ); AddButton( 75, 100, 4005, 4007, 3, GumpButtonType.Reply, 0 ); AddLabel( 125, 125, 0x486, "Copper" ); AddLabel( 225, 125, 0x480, box.Copper.ToString() ); AddButton( 75, 125, 4005, 4007, 4, GumpButtonType.Reply, 0 ); AddLabel( 125, 150, 0x486, "Bronze" ); AddLabel( 225, 150, 0x480, box.Bronze.ToString() ); AddButton( 75, 150, 4005, 4007, 5, GumpButtonType.Reply, 0 ); AddLabel( 125, 175, 0x486, "Gold" ); AddLabel( 225, 175, 0x480, box.Gold.ToString() ); AddButton( 75, 175, 4005, 4007, 6, GumpButtonType.Reply, 0 ); AddLabel( 125, 200, 0x486, "Agapite" ); AddLabel( 225, 200, 0x480, box.Agapite.ToString() ); AddButton( 75, 200, 4005, 4007, 7, GumpButtonType.Reply, 0 ); AddLabel( 125, 225, 0x486, "Verite" ); AddLabel( 225, 225, 0x480, box.Verite.ToString() ); AddButton( 75, 225, 4005, 4007, 8, GumpButtonType.Reply, 0 ); AddLabel( 325, 50, 0x486, "Valorite" ); AddLabel( 425, 50, 0x480, box.Valorite.ToString() ); AddButton( 275, 50, 4005, 4007, 9, GumpButtonType.Reply, 0 ); /* AddLabel( 325, 75, 0x486, "Blaze" ); AddLabel( 425, 75, 0x480, box.Blaze.ToString() ); AddButton( 275, 75, 4005, 4007, 10, GumpButtonType.Reply, 0 ); AddLabel( 325, 100, 0x486, "Ice" ); AddLabel( 425, 100, 0x480, box.Ice.ToString() ); AddButton( 275, 100, 4005, 4007, 11, GumpButtonType.Reply, 0 ); AddLabel( 325, 125, 0x486, "Toxic" ); AddLabel( 425, 125, 0x480, box.Toxic.ToString() ); AddButton( 275, 125, 4005, 4007, 12, GumpButtonType.Reply, 0 ); AddLabel( 325, 150, 0x486, "Electrum" ); AddLabel( 425, 150, 0x480, box.Electrum.ToString() ); AddButton( 275, 150, 4005, 4007, 13, GumpButtonType.Reply, 0 ); AddLabel( 325, 175, 0x486, "Platinum" ); AddLabel( 425, 175, 0x480, box.Platinum.ToString() ); AddButton( 275, 175, 4005, 4007, 14, GumpButtonType.Reply, 0 ); */ AddLabel( 325, 225, 0x486, "Sand" ); AddLabel( 425, 225, 0x480, box.Sand.ToString() ); AddButton( 275, 225, 4005, 4007, 15, GumpButtonType.Reply, 0 ); AddButton( 325, 25, 4005, 4007, 16, GumpButtonType.Reply, 0 ); AddLabel( 375, 25, 88, "Add Ingot" ); } public override void OnResponse( NetState sender, RelayInfo info ) { if ( m_Box.Deleted ) return; if ( info.ButtonID == 1 ) { if ( m_Box.Iron > 0 ) { m_From.AddToBackpack( new IronIngot(m_Box.Iron) ); m_Box.Iron = 0; m_From.SendGump( new IngotBoxGump( m_From, m_Box ) ); } else { m_From.SendMessage( "You do not have any of that Ingot!" ); m_From.SendGump( new IngotBoxGump( m_From, m_Box ) ); m_Box.BeginCombine( m_From ); } } if ( info.ButtonID == 2 ) { if ( m_Box.DullCopper > 0 ) { m_From.AddToBackpack( new DullCopperIngot(m_Box.DullCopper) ); m_Box.DullCopper = 0; m_From.SendGump( new IngotBoxGump( m_From, m_Box ) ); } else { m_From.SendMessage( "You do not have any of that Ingot!" ); m_From.SendGump( new IngotBoxGump( m_From, m_Box ) ); m_Box.BeginCombine( m_From ); } } if ( info.ButtonID == 3 ) { if ( m_Box.ShadowIron > 0 ) { m_From.AddToBackpack( new ShadowIronIngot(m_Box.ShadowIron) ); m_Box.ShadowIron = 0; m_From.SendGump( new IngotBoxGump( m_From, m_Box ) ); } else { m_From.SendMessage( "You do not have any of that Ingot!" ); m_From.SendGump( new IngotBoxGump( m_From, m_Box ) ); m_Box.BeginCombine( m_From ); } } if ( info.ButtonID == 4 ) { if ( m_Box.Copper > 0 ) { m_From.AddToBackpack( new CopperIngot(m_Box.Copper) ); m_Box.Copper = 0; m_From.SendGump( new IngotBoxGump( m_From, m_Box ) ); } else { m_From.SendMessage( "You do not have any of that Ingot!" ); m_From.SendGump( new IngotBoxGump( m_From, m_Box ) ); m_Box.BeginCombine( m_From ); } } if ( info.ButtonID == 5 ) { if ( m_Box.Bronze > 0 ) { m_From.AddToBackpack( new BronzeIngot(m_Box.Bronze) ); m_Box.Bronze = 0; m_From.SendGump( new IngotBoxGump( m_From, m_Box ) ); } else { m_From.SendMessage( "You do not have any of that Ingot!" ); m_From.SendGump( new IngotBoxGump( m_From, m_Box ) ); m_Box.BeginCombine( m_From ); } } if ( info.ButtonID == 6 ) { if ( m_Box.Gold > 0 ) { m_From.AddToBackpack( new GoldIngot(m_Box.Gold) ); m_Box.Gold = 0; m_From.SendGump( new IngotBoxGump( m_From, m_Box ) ); } else { m_From.SendMessage( "You do not have any of that Ingot!" ); m_From.SendGump( new IngotBoxGump( m_From, m_Box ) ); m_Box.BeginCombine( m_From ); } } if ( info.ButtonID == 7 ) { if ( m_Box.Agapite > 0 ) { m_From.AddToBackpack( new AgapiteIngot(m_Box.Agapite) ); m_Box.Agapite = 0; m_From.SendGump( new IngotBoxGump( m_From, m_Box ) ); } else { m_From.SendMessage( "You do not have any of that Ingot!" ); m_From.SendGump( new IngotBoxGump( m_From, m_Box ) ); m_Box.BeginCombine( m_From ); } } if ( info.ButtonID == 8 ) { if ( m_Box.Verite > 0 ) { m_From.AddToBackpack( new VeriteIngot(m_Box.Verite) ); m_Box.Verite = 0; m_From.SendGump( new IngotBoxGump( m_From, m_Box ) ); } else { m_From.SendMessage( "You do not have any of that Ingot!" ); m_From.SendGump( new IngotBoxGump( m_From, m_Box ) ); m_Box.BeginCombine( m_From ); } } if ( info.ButtonID == 9 ) { if ( m_Box.Valorite > 0 ) { m_From.AddToBackpack( new ValoriteIngot(m_Box.Valorite) ); m_Box.Valorite = 0; m_From.SendGump( new IngotBoxGump( m_From, m_Box ) ); } else { m_From.SendMessage( "You do not have any of that Ingot!" ); m_From.SendGump( new IngotBoxGump( m_From, m_Box ) ); m_Box.BeginCombine( m_From ); } } /* if ( info.ButtonID == 10 ) { if ( m_Box.Blaze > 0 ) { m_From.AddToBackpack( new BlazeIngot(m_Box.Blaze) ); m_Box.Blaze = 0; m_From.SendGump( new IngotBoxGump( m_From, m_Box ) ); } else { m_From.SendMessage( "You do not have any of that Ingot!" ); m_From.SendGump( new IngotBoxGump( m_From, m_Box ) ); m_Box.BeginCombine( m_From ); } } if ( info.ButtonID == 11 ) { if ( m_Box.Ice > 0 ) { m_From.AddToBackpack( new IceIngot(m_Box.Ice) ); m_Box.Ice = 0; m_From.SendGump( new IngotBoxGump( m_From, m_Box ) ); } else { m_From.SendMessage( "You do not have any of that Ingot!" ); m_From.SendGump( new IngotBoxGump( m_From, m_Box ) ); m_Box.BeginCombine( m_From ); } } if ( info.ButtonID == 12 ) { if ( m_Box.Toxic > 0 ) { m_From.AddToBackpack( new ToxicIngot(m_Box.Toxic) ); m_Box.Toxic = 0; m_From.SendGump( new IngotBoxGump( m_From, m_Box ) ); } else { m_From.SendMessage( "You do not have any of that Ingot!" ); m_From.SendGump( new IngotBoxGump( m_From, m_Box ) ); m_Box.BeginCombine( m_From ); } } if ( info.ButtonID == 13 ) { if ( m_Box.Electrum > 0 ) { m_From.AddToBackpack( new ElectrumIngot(m_Box.Electrum) ); m_Box.Electrum = 0; m_From.SendGump( new IngotBoxGump( m_From, m_Box ) ); } else { m_From.SendMessage( "You do not have any of that Ingot!" ); m_From.SendGump( new IngotBoxGump( m_From, m_Box ) ); m_Box.BeginCombine( m_From ); } } if ( info.ButtonID == 14 ) { if ( m_Box.Platinum > 0 ) { m_From.AddToBackpack( new PlatinumIngot(m_Box.Platinum) ); m_Box.Platinum = 0; m_From.SendGump( new IngotBoxGump( m_From, m_Box ) ); } else { m_From.SendMessage( "You do not have any of that Ingot!" ); m_From.SendGump( new IngotBoxGump( m_From, m_Box ) ); m_Box.BeginCombine( m_From ); } } */ if ( info.ButtonID == 15 ) { if ( m_Box.Sand > 0 ) { m_From.AddToBackpack( new Sand(m_Box.Sand) ); m_Box.Sand = 0; m_From.SendGump( new IngotBoxGump( m_From, m_Box ) ); } else { m_From.SendMessage( "You do not have any sand!" ); m_From.SendGump( new IngotBoxGump( m_From, m_Box ) ); m_Box.BeginCombine( m_From ); } } if ( info.ButtonID == 16) { m_From.SendGump( new IngotBoxGump( m_From, m_Box ) ); m_Box.BeginCombine( m_From ); } } } } namespace Server.Items { public class IngotBoxTarget : Target { private IngotBox m_Box; public IngotBoxTarget( IngotBox box ) : base( 18, false, TargetFlags.None ) { m_Box = box; } protected override void OnTarget( Mobile from, object targeted ) { if ( m_Box.Deleted ) return; m_Box.EndCombine( from, targeted ); } } }