public virtual void Plant(Mobile from, BaseCropSeed tempSeed) { m_Sower = from; Timer.DelayCall(TimeSpan.FromMinutes(30.0), new TimerStateCallback(FinishGrowth), new object[] { from.Location, from.Map, tempSeed }); }
public virtual void Plant( Mobile from, BaseCropSeed tempSeed ) { m_Sower = from; Timer.DelayCall( TimeSpan.FromMinutes( 30.0 ), new TimerStateCallback( FinishGrowth ), new object[] { from.Location, from.Map, tempSeed } ); }
public override void OnDoubleClick(Mobile from) { if (this.ItemID == 0x913) { } else if (!IsChildOf(from.Backpack)) { from.SendLocalizedMessage(CommonLocs.MustBeInPack); } else if (from.Mounted) { from.SendMessage("You cannot do that while mounted."); } else if (!CheckPlantSeed(from.Location, from.Map, 0)) { from.SendMessage("You cannot plant this so close to another crop."); } else if (CheckWeeds(from.Location, from.Map)) { from.SendMessage("These weeds will not help your crop grow!"); } else if (CanGrow(from.Location, from.Map)) { from.Animate(32, 5, 1, true, false, 0); from.SendMessage("You have planted the seed."); try { CropSeedling seedling = Activator.CreateInstance(typeof(CropSeedling), m_FullCropType, m_SeedlingID) as CropSeedling; BaseCropSeed tempSeed = new BaseCropSeed(0, null); tempSeed.ItemID = 0x913; tempSeed.Movable = false; tempSeed.MoveToWorld(from.Location, from.Map); if (seedling != null) { seedling.Plant(from, tempSeed); } } catch (Exception e) { Server.Utilities.ExceptionManager.LogException("BaseCropSeed.cs", e); from.SendMessage("A problem has ocurred while planting the seed. This exception has been logged. Please contact an administrator for further assistance."); } if (--(this.Amount) <= 0) { this.Delete(); } } else { from.SendMessage("You cannot plant this seed at this location."); } }
public override void OnDoubleClick( Mobile from ) { if( this.ItemID == 0x913 ) { } else if( !IsChildOf( from.Backpack ) ) { from.SendLocalizedMessage( CommonLocs.MustBeInPack ); } else if( from.Mounted ) { from.SendMessage( "You cannot do that while mounted." ); } else if( !CheckPlantSeed( from.Location, from.Map, 0 ) ) { from.SendMessage( "You cannot plant this so close to another crop." ); } else if( CheckWeeds( from.Location, from.Map ) ) { from.SendMessage( "These weeds will not help your crop grow!" ); } else if( CanGrow( from.Location, from.Map ) ) { from.Animate( 32, 5, 1, true, false, 0 ); from.SendMessage( "You have planted the seed." ); try { CropSeedling seedling = Activator.CreateInstance( typeof( CropSeedling ), m_FullCropType, m_SeedlingID ) as CropSeedling; BaseCropSeed tempSeed = new BaseCropSeed( 0, null ); tempSeed.ItemID = 0x913; tempSeed.Movable = false; tempSeed.MoveToWorld( from.Location, from.Map ); if( seedling != null ) seedling.Plant( from, tempSeed ); } catch( Exception e ) { Server.Utilities.ExceptionManager.LogException( "BaseCropSeed.cs", e ); from.SendMessage( "A problem has ocurred while planting the seed. This exception has been logged. Please contact an administrator for further assistance." ); } if( --(this.Amount) <= 0 ) this.Delete(); } else { from.SendMessage( "You cannot plant this seed at this location." ); } }
public virtual void FinishGrowth(object state) { object[] args = state as object[]; Point3D targetLoc = (Point3D)args[0]; Map targetMap = args[1] as Map; BaseCropSeed seed = args[2] as BaseCropSeed; MoveToWorld(targetLoc, targetMap); m_Timer = new InternalTimer(m_Sower, this); m_Timer.Start(); if (seed != null) { seed.Delete(); } }