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))
             {
                 Blueberry fruit = new Blueberry(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);
     }
 }
        public ActionResult DeleteConfirmed(int id)
        {
            Blueberry blueberry = db.Blueberries.Find(id);

            db.Blueberries.Remove(blueberry);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Пример #3
0
 /// <summary>
 /// Retrieves the current state of the specified controller.
 /// </summary>
 public static unsafe int XInputGetState(int dwUserIndex, out Blueberry.XInput.State stateRef)
 {
     stateRef = new State();
     int state;
     fixed (State* statePtr = &stateRef)
         state = XInput.XInputGetState_(dwUserIndex, (void*)statePtr);
     return state;
 }
 public ActionResult Edit([Bind(Include = "Form_ID,Fruit_ID,Form,Average_Retail_Price_Dollars,Price_Unit,Preparation_yield_Factor,Size_Cup_Equivalent,Size_Unit,Average_Price_Per_Cup_Dollars")] Blueberry blueberry)
 {
     if (ModelState.IsValid)
     {
         db.Entry(blueberry).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.Fruit_ID = new SelectList(db.Fruits, "Fruit_ID", "Fruit_Name", blueberry.Fruit_ID);
     return(View(blueberry));
 }
        // GET: Blueberries/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Blueberry blueberry = db.Blueberries.Find(id);

            if (blueberry == null)
            {
                return(HttpNotFound());
            }
            return(View(blueberry));
        }
        // GET: Blueberries/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Blueberry blueberry = db.Blueberries.Find(id);

            if (blueberry == null)
            {
                return(HttpNotFound());
            }
            ViewBag.Fruit_ID = new SelectList(db.Fruits, "Fruit_ID", "Fruit_Name", blueberry.Fruit_ID);
            return(View(blueberry));
        }
        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;
                        }
                        Blueberry crop = new Blueberry(pick);
                        from.AddToBackpack(crop);
                        if (!regrowTimer.Running)
                        {
                            regrowTimer.Start();
                        }
                    }
                }
                else
                {
                    from.SendMessage("You are too far away to harvest anything.");
                }
            }
        }