public static void GiveGrapes( Mobile m, int pick, GrapeVariety variety )
		{
			switch ( variety )
			{
				case GrapeVariety.CabernetSauvignon:
				{
					CabernetSauvignonGrapes cscrop = new CabernetSauvignonGrapes( pick );
					m.AddToBackpack( cscrop );
					break;
				}
				case GrapeVariety.Chardonnay:
				{
					ChardonnayGrapes ccrop = new ChardonnayGrapes( pick );
					m.AddToBackpack( ccrop );
					break;
				}
				case GrapeVariety.CheninBlanc:
				{
					CheninBlancGrapes cbcrop = new CheninBlancGrapes( pick );
					m.AddToBackpack( cbcrop );
					break;
				}
				case GrapeVariety.Merlot:
				{
					MerlotGrapes mcrop = new MerlotGrapes( pick );
					m.AddToBackpack( mcrop );
					break;
				}
				case GrapeVariety.PinotNoir:
				{
					PinotNoirGrapes pncrop = new PinotNoirGrapes( pick );
					m.AddToBackpack( pncrop );
					break;
				}
				case GrapeVariety.Riesling:
				{
					RieslingGrapes rcrop = new RieslingGrapes( pick );
					m.AddToBackpack( rcrop );
					break;
				}
				case GrapeVariety.Sangiovese:
				{
					SangioveseGrapes scrop = new SangioveseGrapes( pick );
					m.AddToBackpack( scrop );
					break;
				}
				case GrapeVariety.SauvignonBlanc:
				{
					SauvignonBlancGrapes sbcrop = new SauvignonBlancGrapes( pick );
					m.AddToBackpack( sbcrop );
					break;
				}
				case GrapeVariety.Shiraz:
				{
					ShirazGrapes shcrop = new ShirazGrapes( pick );
					m.AddToBackpack( shcrop );
					break;
				}
				case GrapeVariety.Viognier:
				{
					ViognierGrapes vcrop = new ViognierGrapes( pick );
					m.AddToBackpack( vcrop );
					break;
				}
				case GrapeVariety.Zinfandel:
				{
					ZinfandelGrapes zcrop = new ZinfandelGrapes( pick );
					m.AddToBackpack( zcrop );
					break;
				}
				default:
				{
					Grapes crop = new Grapes( pick );
					m.AddToBackpack( crop );
					break;
				}
			}
		}
            public override void OnClick()
            {
                if (m_From.InRange(m_Fountain.GetWorldLocation(), 4))
                {
                    if (m_From.Backpack.ConsumeTotal(typeof(Gold), 1))
                    {
                        m_Fountain.Jackpot++;

                        switch (m_Fountain.MessageNum)
                        {
                        case MagicFountainAddon.FountainMessage.Cool: {
                            if (0.001 > Utility.RandomDouble())
                            {
                                Gold gold = new Gold();
                                gold.Amount = m_Fountain.Jackpot;                                         // no need to test, it's always at least 1

                                if (!m_From.AddToBackpack(gold))
                                {
                                    m_From.SendMessage("You toss a coin in ... and a shower of gold leaps back out of the fountain! But you can't hold it! You accidentally drop it back in the fountain, where it vanishes.");
                                    gold.Delete();
                                }
                                else
                                {
                                    m_From.SendMessage("You toss a coin in ... and a shower of gold leaps back out of the fountain!");
                                    m_Fountain.Jackpot = 0;
                                }
                            }
                            else if (0.001 > Utility.RandomDouble())
                            {
                                Gold gold = new Gold();
                                gold.Amount = m_Fountain.Jackpot;                                         // no need to test, it's always at least 1

                                if (!m_From.AddToBackpack(gold))
                                {
                                    m_From.SendMessage("You toss a coin in ... and a shower of gold leaps back out of the fountain! But you can't hold it! You accidentally drop it back in the fountain, where it vanishes.");
                                    gold.Delete();
                                }
                                else
                                {
                                    m_From.SendMessage("You toss a coin in ... and a shower of gold leaps back out of the fountain!");
                                    m_Fountain.Jackpot = 0;
                                }
                            }
                            else
                            {
                                m_From.SendMessage("You toss a coin in ... but nothing happens.");
                            }

                            break;
                        }


                        case MagicFountainAddon.FountainMessage.Warm: {
                            if (0.01 > Utility.RandomDouble())
                            {
                                Item item = null;

                                switch (Utility.RandomMinMax(1, 10))
                                {
                                case 1:  item = new TinkerTools();                              break;

                                case 2:  item = new Lockpick(3);                                break;

                                case 3:  item = new Pitchfork();                                break;

                                case 4:  item = new Dagger();                                   break;

                                case 5:  item = new Emerald();                                  break;

                                case 6:  item = new Ruby();                                     break;

                                case 7:  item = new Amber();                                    break;

                                case 8:  item = new Server.Engines.Mahjong.MahjongGame();       break;

                                case 9:  item = new SewingKit();                                break;

                                case 10: item = new SmithHammer();                              break;
                                }

                                if (!m_From.AddToBackpack(item))
                                {
                                    m_From.SendMessage("You toss a coin in ... and an item appears! But you can't hold it! You accidentally drop it back in the fountain, where it vanishes.");
                                    item.Delete();
                                }
                                else
                                {
                                    m_From.SendMessage("You toss a coin in ... and an item appears!");

                                    if (m_Fountain.Jackpot > 10)
                                    {
                                        m_Fountain.Jackpot = m_Fountain.Jackpot - 5;
                                    }
                                }
                            }
                            else if (0.001 > Utility.RandomDouble())
                            {
                                Gold gold = new Gold();
                                gold.Amount = m_Fountain.Jackpot;                                         // no need to test, it's always at least 1

                                if (!m_From.AddToBackpack(gold))
                                {
                                    m_From.SendMessage("You toss a coin in ... and a shower of gold leaps back out of the fountain! But you can't hold it! You accidentally drop it back in the fountain, where it vanishes.");
                                    gold.Delete();
                                }
                                else
                                {
                                    m_From.SendMessage("You toss a coin in ... and a shower of gold leaps back out of the fountain!");
                                    m_Fountain.Jackpot = 0;
                                }
                            }
                            else
                            {
                                m_From.SendMessage("You toss a coin in ... but nothing happens.");
                            }

                            break;
                        }


                        case MagicFountainAddon.FountainMessage.Clean: {
                            if (0.05 > Utility.RandomDouble())
                            {
                                Item food = null;

                                switch (Utility.RandomMinMax(1, 10))
                                {
                                case 1:  food = new Bacon();            break;

                                case 2:  food = new CookedBird();       break;

                                case 3:  food = new Ham();                      break;

                                case 4:  food = new Ribs();                     break;

                                case 5:  food = new Sausage();          break;

                                case 6:  food = new Cookies();          break;

                                case 7:  food = new Muffins(3);         break;

                                case 8:  food = new ApplePie();         break;

                                case 9:  food = new PeachCobbler();             break;

                                case 10: food = new Lime();             break;
                                }

                                if (!m_From.AddToBackpack(food))
                                {
                                    m_From.SendMessage("You toss a coin in ... and food appears! But you can't hold it! You accidentally drop it back in the fountain, where it vanishes.");
                                    food.Delete();
                                }
                                else
                                {
                                    m_From.SendMessage("You toss a coin in ... and food appears!");

                                    if (m_Fountain.Jackpot > 10)
                                    {
                                        m_Fountain.Jackpot = m_Fountain.Jackpot - 5;
                                    }
                                }
                            }
                            else if (0.001 > Utility.RandomDouble())
                            {
                                Gold gold = new Gold();
                                gold.Amount = m_Fountain.Jackpot;                                         // no need to test, it's always at least 1

                                if (!m_From.AddToBackpack(gold))
                                {
                                    m_From.SendMessage("You toss a coin in ... and a shower of gold leaps back out of the fountain! But you can't hold it! You accidentally drop it back in the fountain, where it vanishes.");
                                    gold.Delete();
                                }
                                else
                                {
                                    m_From.SendMessage("You toss a coin in ... and a shower of gold leaps back out of the fountain!");
                                    m_Fountain.Jackpot = 0;
                                }
                            }
                            else
                            {
                                m_From.SendMessage("You toss a coin in ... but nothing happens.");
                            }

                            break;
                        }

                        case MagicFountainAddon.FountainMessage.Calm: {
                            if (0.005 > Utility.RandomDouble())
                            {
                                Horse horse = new Horse();

                                horse.Map      = m_From.Map;
                                horse.Location = m_From.Location;

                                if ((m_From.Followers + horse.ControlSlots) <= m_From.FollowersMax)
                                {
                                    // set up the horse... =P
                                    horse.Controlled    = true;
                                    horse.ControlMaster = m_From;

                                    horse.OwnerAbandonTime = DateTime.MinValue;
                                    horse.BondingBegin     = DateTime.MinValue;

                                    horse.ControlOrder  = OrderType.Follow;
                                    horse.ControlTarget = m_From;
                                    horse.Owners.Add(m_From);                                                // seems to be new in 2.0
                                    // horse.Loyalty = PetLoyalty.WonderfullyHappy;  // doesn't work in 2.0 but seems unnecessary

                                    m_From.SendMessage("You toss a coin in ... and a horse appears!");
                                }
                                else
                                {
                                    m_From.SendMessage("You toss a coin in ... and a horse appears! But you have too many pets to control this one too. The horse runs off!");
                                    horse.Delete();
                                }

                                if (m_Fountain.Jackpot > 20)
                                {
                                    m_Fountain.Jackpot = m_Fountain.Jackpot - 10;
                                }
                            }
                            else if (0.001 > Utility.RandomDouble())
                            {
                                Gold gold = new Gold();
                                gold.Amount = m_Fountain.Jackpot;                                         // no need to test, it's always at least 1

                                if (!m_From.AddToBackpack(gold))
                                {
                                    m_From.SendMessage("You toss a coin in ... and a shower of gold leaps back out of the fountain! But you can't hold it! You accidentally drop it back in the fountain, where it vanishes.");
                                    gold.Delete();
                                }
                                else
                                {
                                    m_From.SendMessage("You toss a coin in ... and a shower of gold leaps back out of the fountain!");
                                    m_Fountain.Jackpot = 0;
                                }
                            }
                            else
                            {
                                m_From.SendMessage("You toss a coin in ... but nothing happens.");
                            }

                            break;
                        }


                        case MagicFountainAddon.FountainMessage.Fruit: {
                            if (0.05 > Utility.RandomDouble())
                            {
                                Item fruit = null;

                                switch (Utility.RandomMinMax(1, 10))
                                {
                                case 1:  fruit = new Watermelon();      break;

                                case 2:  fruit = new Apple();           break;

                                case 3:  fruit = new Pear();            break;

                                case 4:  fruit = new Peach();           break;

                                case 5:  fruit = new Lime();            break;

                                case 6:  fruit = new Lemon();           break;

                                case 7:  fruit = new Coconut();         break;

                                case 8:  fruit = new Grapes();          break;

                                case 9:  fruit = new Bananas();         break;

                                case 10: fruit = new Cantaloupe();      break;
                                }

                                if (!m_From.AddToBackpack(fruit))
                                {
                                    m_From.SendMessage("You toss a coin in ... and fruit appears! But you can't hold it! You accidentally drop it back in the fountain, where it vanishes.");
                                    fruit.Delete();
                                }
                                else
                                {
                                    m_From.SendMessage("You toss a coin in ... and fruit appears!");

                                    if (m_Fountain.Jackpot > 10)
                                    {
                                        m_Fountain.Jackpot = m_Fountain.Jackpot - 5;
                                    }
                                    else
                                    {
                                        m_Fountain.Jackpot = 0;
                                    }
                                }
                            }
                            else if (0.001 > Utility.RandomDouble())
                            {
                                Gold gold = new Gold();
                                gold.Amount = m_Fountain.Jackpot;                                         // no need to test, it's always at least 1

                                if (!m_From.AddToBackpack(gold))
                                {
                                    m_From.SendMessage("You toss a coin in ... and a shower of gold leaps back out of the fountain! But you can't hold it! You accidentally drop it back in the fountain, where it vanishes.");
                                    gold.Delete();
                                }
                                else
                                {
                                    m_From.SendMessage("You toss a coin in ... and a shower of gold leaps back out of the fountain!");
                                    m_Fountain.Jackpot = 0;
                                }
                            }
                            else
                            {
                                m_From.SendMessage("You toss a coin in ... but nothing happens.");
                            }

                            break;
                        }
                        }
                    }
                    else
                    {
                        m_From.SendMessage("You don't have a coin to toss in.");
                    }
                }
                else
                {
                    m_From.SendMessage("Get closer.");
                }
            }
		public override void OnDoubleClick( Mobile from ) 
		{ 
			if ( m_sower == null || m_sower.Deleted ) 
				m_sower = from;

			if ( from.Mounted && !CropHelper.CanWorkMounted )
			{
				from.SendMessage( "You cannot harvest a crop while mounted." ); 
				return; 
			}

			if ( DateTime.Now > lastpicked.AddSeconds(1) ) // 3 seconds between picking changed to 1 sec
			{
				lastpicked = DateTime.Now;
			
				int cookingValue = (int)from.Skills[SkillName.Cooking].Value / 20;  //FUTURE add two skill checks...
				if ( cookingValue == 0 )
				{
					from.SendMessage( "You have no idea how to harvest this crop." ); 
					return;
				}

				if ( from.InRange( this.GetWorldLocation(), 1 ) ) 
				{ 
					if ( m_yield < 1 )
					{
						from.SendMessage( "There is nothing here to harvest." ); 

						if ( PlayerCanDestroy && !( m_sower.AccessLevel > AccessLevel.Counselor ) )
						{  
							UpRootGump g = new UpRootGump( from, this );
							from.SendGump( g );
						}
					}
					else //check skill and sower
					{
						from.Direction = from.GetDirectionTo( this );

						from.Animate( from.Mounted ? 29:32, 5, 1, true, false, 0 ); 

						if ( from == m_sower ) 
						{
							cookingValue *= 2;
							m_lastvisit = DateTime.Now;
						}

						if ( cookingValue > m_yield ) 
							cookingValue = m_yield + 1;

						int pick = Utility.Random( cookingValue );
						if ( pick == 0 )
						{
							from.SendMessage( "You do not manage to harvest any crops." ); 
							return;
						}
					
						m_yield -= pick;
						from.SendMessage( "You harvest {0} crop{1}!", pick, ( pick == 1 ? "" : "s" ) ); 

						//PublicOverheadMessage( MessageType.Regular, 0x3BD, false, string.Format( "{0}", m_yield )); 
						((Item)this).ItemID = pickedGraphic;

						Grapes crop = new Grapes( pick ); //I MODED
						from.AddToBackpack( crop );

						if ( SowerPickTime != TimeSpan.Zero && m_lastvisit + SowerPickTime < DateTime.Now && !( m_sower.AccessLevel > AccessLevel.Counselor ) )
						{
							this.UpRoot( from );
							return;
						}

						if ( !regrowTimer.Running )
						{
							regrowTimer.Start();
						}
					}
				} 
				else 
				{ 
					from.SendMessage( "You are too far away to harvest anything." ); 
				} 
			}
		} 
Exemple #4
0
        private void Restock_Callback()
        {
            if ( TotalItems < ItemsMax )
            {
                for ( int i = TotalItems; i < ItemsMax; i++ )
                {
                    Item item = null;

                    switch ( Utility.RandomMinMax( 1, 11 ) )
                    {
                        default:
                        case 1: item = new Grapes(); break;
                        case 2: item = new Ham(); break;
                        case 3: item = new CheeseWedge(); break;
                        case 4: item = new Muffins(); break;
                        case 5: item = new FishSteak(); break;
                        case 6: item = new Ribs(); break;
                        case 7: item = new CookedBird(); break;
                        case 8: item = new Sausage(); break;
                        case 9: item = new Apple(); break;
                        case 10: item = new Peach(); break;
                        case 11: item = new Bandage(); break;
                    }

                    if ( item != null )
                        DropItem( item );
                }
            }
        }