public InternalTarget(JarHoney item) : base(1, false, TargetFlags.None) { m_Item = item; }
public override void OnResponse( NetState sender, RelayInfo info ) { Mobile from = sender.Mobile; if ( info.ButtonID == 0 || m_hive.Deleted || !from.InRange( m_hive.GetWorldLocation(), 3 ) ) return; if( !m_hive.IsAccessibleTo( from ) ) { m_hive.LabelTo( from, "You cannot use that." ); return; } switch ( info.ButtonID ) { case (int)Buttons.butExit: //Exit back to main gump { from.SendGump( new BeehiveMainGump(from,m_hive) ); break; } case (int)Buttons.butHoney: //Honey { //ToDo: get hurt or poisoned when harvesting Item hivetool = GetHiveTool( from ); if( NeedHiveTool ) { if( hivetool == null || !(hivetool is HiveTool) ) { m_hive.LabelTo( from, "You need a hive tool to extract the excess honey!" ); from.SendGump( new BeehiveProductionGump( from, m_hive ) ); return; } } if( m_hive.Honey < 3 ) { m_hive.LabelTo( from, "There isn't enough honey in the hive to fill a bottle!" ); from.SendGump( new BeehiveProductionGump( from, m_hive ) ); break; } Container pack = from.Backpack; if ( pack != null && pack.ConsumeTotal( typeof( Bottle ), 1 ) ) { JarHoney honey = new JarHoney(); if ( !from.PlaceInBackpack( honey ) ) { honey.Delete(); from.PlaceInBackpack( new Bottle() ); //add the consumed bottle m_hive.LabelTo( from, "There is not enough room in your backpack for the honey!" ); from.SendGump( new BeehiveProductionGump( from, m_hive ) ); break; } if( NeedHiveTool ) { ((HiveTool)hivetool).UsesRemaining--; if( ((HiveTool)hivetool).UsesRemaining < 1 ) { from.SendMessage("You wear out the hive tool."); hivetool.Delete(); } } m_hive.Honey -= 3; m_hive.LabelTo( from, "You fill a bottle with golden honey and place it in your pack." ); from.SendGump( new BeehiveProductionGump(from,m_hive) ); break; } else { m_hive.LabelTo( from, "You need a bottle to fill with honey!" ); from.SendGump( new BeehiveProductionGump( from, m_hive ) ); break; } } case (int)Buttons.butWax: //Wax { //ToDo: get hurt or poisoned when harvesting Item hivetool = GetHiveTool( from ); if( NeedHiveTool ) { if( hivetool == null || !(hivetool is HiveTool) ) { m_hive.LabelTo( from, "You need a hive tool to scrape the excess beeswax!" ); from.SendGump( new BeehiveProductionGump( from, m_hive ) ); return; } } if( m_hive.Wax < 1 ) { m_hive.LabelTo( from, "There isn't enough excess wax in the hive to harvest!" ); return; } Item wax; if( PureWax ) { wax = new Beeswax(m_hive.Wax); } else { wax = new RawBeeswax(m_hive.Wax); } if ( !from.PlaceInBackpack( wax ) ) { wax.Delete(); m_hive.LabelTo( from, "There is not enough room in your backpack for the wax!" ); from.SendGump( new BeehiveProductionGump( from, m_hive ) ); break; } if( NeedHiveTool ) { ((HiveTool)hivetool).UsesRemaining--; if( ((HiveTool)hivetool).UsesRemaining < 1 ) { from.SendMessage("You wear out the hive tool."); hivetool.Delete(); } } m_hive.Wax = 0; m_hive.LabelTo( from, "You collect the excess beeswax and place it in your pack." ); from.SendGump( new BeehiveProductionGump(from,m_hive) ); break; } } }
public InternalTarget(JarHoney item) : base(1, false, TargetFlags.None) { this.m_Item = item; }
public override void OnDoubleClick(Mobile from ) { if (! from.InRange( this.GetWorldLocation(), 1 )) { from.LocalOverheadMessage( MessageType.Regular, 906, 1019045 ); // I can't reach that. } else { if ( m_wax == 0 && m_honey == 0 ) from.SendMessage( "The hive is empty." ); else { bool givehoney = false, givewax = false; if ( m_wax > 0 ) { Beeswax wax = new Beeswax( m_wax ); if ( !from.AddToBackpack( wax ) ) { wax.Delete(); } else givewax = true; } if ( m_honey > 0 ) { JarHoney honey = new JarHoney( m_honey ); if ( !from.AddToBackpack( honey ) ) { honey.Delete(); } else givehoney = true; } if ( givehoney && givewax ) { from.SendMessage( String.Format( "You gather {0} honey and {1} wax.", m_honey, m_wax ) ); m_wax = 0; m_honey = 0; } else if ( givehoney ) { from.SendMessage( String.Format( "You gather {0} honey.", m_honey ) ); m_honey = 0; } else if ( givewax ) { from.SendMessage( String.Format( "You gather {0} wax.", m_wax ) ); m_wax = 0; } else from.SendMessage( "You do not manage to gather anything from the hive." ); } if ( m_timer == null ) { m_timer = new CommunityBeeHiveTimer( this ); m_timer.Start(); } else if ( m_timer != null && !m_timer.Running ) { m_timer.Stop(); m_timer = new CommunityBeeHiveTimer( this ); m_timer.Start(); } } }