public void Chop(Mobile from)
 {
     if (from.InRange(this.GetWorldLocation(), 1))
     {
         if (from == m_sower)
         {
             from.Direction = from.GetDirectionTo(this);
             double lumberValue = from.Skills[SkillName.Lumberjacking].Value / 100;
             if ((lumberValue > .5) && (Utility.RandomDouble() <= lumberValue))
             {
                 Blackberry fruit = new Blackberry(Utility.Random(m_yield + 2));
                 from.AddToBackpack(fruit);
                 if (Utility.RandomDouble() <= .1)
                 {
                     Log logs = new Log(Utility.Random(5) + 1); from.AddToBackpack(logs);
                 }
             }
             this.Delete();
             from.SendMessage("You chop the plant up");
         }
         else
         {
             from.SendMessage("You do not own this plant !!!");
         }
     }
     else
     {
         from.SendLocalizedMessage(500446);
     }
 }
Example #2
0
 //Populate the script lists here.  Follow the example on how to add to a list
 #region Populate Tests
 /// <summary>
 /// Use this method to populate the lists.  They are already set to be selected from the
 /// CycleScripts method and no other work is required.
 /// </summary>
 public override void PopulateLists()
 {
     SignIn.Clear();
     AccountCreation.Clear();
     Tracker.Clear();
     Registration.Clear();
     SoftwareUpdates.Clear();
     Blackberry.Clear();
     MapUpdates.Clear();
     Navigation.Clear();
     base.PopulateLists();
     //**below is a sample of how to add in a test.  Simply add in the name of the test in replace of Connect_SignIn
     //SignIn.Add(new Connect_SignIn(base.baseURL, base.webdriver, base.verificationErrors));
     SignIn.Add(new MyGarmin_SignIn(base.baseURL, base.webdriver, base.verificationErrors));
 }
        public bool AddNewProduct(Blackberry b)
        {
            SqlConnection cnn = new SqlConnection(strConnect);
            string        sql = "Insert Lamb Values(@name,@manu,@model,@price,@year)";
            SqlCommand    cmd = new SqlCommand(sql, cnn);

            cmd.Parameters.AddWithValue("@name", b.LambName);
            cmd.Parameters.AddWithValue("@manu", b.Manufacturer);
            cmd.Parameters.AddWithValue("@model", b.Model);
            cmd.Parameters.AddWithValue("@price", b.Price);
            cmd.Parameters.AddWithValue("@year", b.ReleasedYear);
            if (cnn.State == ConnectionState.Closed)
            {
                cnn.Open();
            }
            int count = cmd.ExecuteNonQuery();

            return(count > 0);
        }
        public bool UpdateProducts(Blackberry b)
        {
            SqlConnection cnn = new SqlConnection(strConnect);
            string        sql = "Update Lamb Set LambName = @name, Manufacturer=@manu, Model = @model," +
                                " Price = @price, ReleasedYear= @year  Where LambID = @id";
            SqlCommand cmd = new SqlCommand(sql, cnn);

            cmd.Parameters.AddWithValue("@id", b.LambID);
            cmd.Parameters.AddWithValue("@name", b.LambName);
            cmd.Parameters.AddWithValue("@manu", b.Manufacturer);
            cmd.Parameters.AddWithValue("@model", b.Model);
            cmd.Parameters.AddWithValue("@price", b.Price);
            cmd.Parameters.AddWithValue("@year", b.ReleasedYear);
            if (cnn.State == ConnectionState.Closed)
            {
                cnn.Open();
            }
            int count = cmd.ExecuteNonQuery();

            return(count > 0);
        }
        static void ConversionExample1()
        {
            Samsung    samsung    = new Samsung("Samsung", "Galaxy", "S8+");
            Blackberry blackberry = new Blackberry("Blackberry", "", "Priv");
            Apple      apple      = new Apple("Apple", "iPhone", "x", OperatingSystemEnum.iOS.ToString(), "10.0", 5.8, 1125, 2436);

            object[] objectArray = { samsung, blackberry, apple };
            IPhoneFunctionality[] phoneFunctionalityArray = { samsung, blackberry };

            foreach (var _class in objectArray)
            {
                if (_class is IPhoneFunctionality)
                {
                    Console.WriteLine($"{_class.ToString()} is type IPhoneFunctionality interface");
                }
                else if (_class is PhoneExtented)
                {
                    Console.WriteLine($"{_class.ToString()} is type PhoneExtended abstract class");
                }
            }
        }
        static void InterfaceExample1()
        {
            try
            {
                Samsung samsung = new Samsung("Samsung", "Galaxy", "S8+");
                samsung.SetScreenDimensions(6.2, 1440, 2960);
                samsung.DisplayAspectRatio();
                Console.WriteLine(samsung.ToString());

                samsung.TurnOn();
                samsung.TurnOff();
                samsung.Restart();
            }
            catch (Exception ex)
            {
                var errorMessage = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
                Console.WriteLine($"Error message: {errorMessage}");
            }

            try
            {
                Blackberry blackberry = new Blackberry("Blackberry", "", "Priv");
                blackberry.OperatingSystem        = OperatingSystemEnum.Android.ToString();
                blackberry.OperatingSystemVersion = "7.1.0";
                blackberry.SetScreenDimensions(5.4, 1440, 2560);
                Console.WriteLine(blackberry.ToString());

                blackberry.Restart();
                blackberry.TurnOff();
                blackberry.TurnOn();
            }
            catch (Exception ex)
            {
                var errorMessage = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
                Console.WriteLine($"Error message: {errorMessage}");
            }
        }
Example #7
0
 public void StartBlackberryPushService(Blackberry.BlackberryPushChannelSettings channelSettings, PushServiceSettings serviceSettings = null)
 {
     bbService = new Blackberry.BlackberryPushService(channelSettings, serviceSettings);
     bbService.Events.RegisterProxyHandler(this.Events);
 }
        public override void OnDoubleClick(Mobile from)
        {
            if (m_sower == null || m_sower.Deleted)
            {
                m_sower = from;
            }
            if (from != m_sower)
            {
                from.SendMessage("You do not own this plant !!!"); return;
            }

            if (from.Mounted && !CropHelper.CanWorkMounted)
            {
                from.SendMessage("You cannot harvest a crop while mounted."); return;
            }
            if (DateTime.UtcNow > lastpicked.AddSeconds(3))
            {
                lastpicked = DateTime.UtcNow;
                int cookValue = (int)from.Skills[SkillName.Cooking].Value / 20;
                if (cookValue == 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.");
                    }
                    else
                    {
                        from.Direction = from.GetDirectionTo(this);
                        from.Animate(from.Mounted ? 29:32, 5, 1, true, false, 0);
                        m_lastvisit = DateTime.UtcNow;
                        if (cookValue > m_yield)
                        {
                            cookValue = m_yield + 1;
                        }
                        int pick = Utility.RandomMinMax(cookValue - 4, cookValue);
                        if (pick < 0)
                        {
                            pick = 0;
                        }
                        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"));
                        if (m_yield < 1)
                        {
                            ((Item)this).ItemID = pickedGraphic;
                        }
                        Blackberry crop = new Blackberry(pick);
                        from.AddToBackpack(crop);
                        if (!regrowTimer.Running)
                        {
                            regrowTimer.Start();
                        }
                    }
                }
                else
                {
                    from.SendMessage("You are too far away to harvest anything.");
                }
            }
        }