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)) { Asparagus fruit = new Asparagus(Utility.Random(m_yield + 2)); from.AddToBackpack(fruit); } 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) { Asparagus asparagus = db.Asparaguses.Find(id); db.Asparaguses.Remove(asparagus); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Create([Bind(Include = "ID,Date")] Asparagus asparagus) { if (ModelState.IsValid) { db.Asparaguses.Add(asparagus); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(asparagus)); }
// GET: Asparagus/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Asparagus asparagus = db.Asparaguses.Find(id); if (asparagus == null) { return(HttpNotFound()); } return(View(asparagus)); }
private void GrowVegetable() { foreach (var growingVegetable in this.Database.GrowingVegetables) { if (!this.Database.Ninjas.Any(ninja => ninja.Position.Equals(growingVegetable.Position))) { growingVegetable.Grow(); } if (growingVegetable.GrowthTime == 0) { IVegetable newVegetable = null; IMatrixPosition position = growingVegetable.Position; switch (growingVegetable.VegetableHolder) { case VegetableType.Asparagus: newVegetable = new Asparagus(position); break; case VegetableType.Broccoli: newVegetable = new Broccoli(position); break; case VegetableType.CherryBerry: newVegetable = new CherryBerry(position); break; case VegetableType.Mushroom: newVegetable = new Mushroom(position); break; case VegetableType.Royal: newVegetable = new Royal(position); break; } this.Database.AddVegetable(newVegetable); this.Database.SetGameFieldObject(growingVegetable.Position, newVegetable); } } }
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(3)) // 3 seconds between picking { lastpicked = DateTime.Now; 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."); 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) { cookValue *= 2; m_lastvisit = DateTime.Now; } if (cookValue > m_yield) { cookValue = m_yield + 1; } int pick = Utility.Random(cookValue); 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; Asparagus crop = new Asparagus(pick); 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."); } } }
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; } Asparagus crop = new Asparagus(pick); from.AddToBackpack(crop); if (!regrowTimer.Running) { regrowTimer.Start(); } } } else { from.SendMessage("You are too far away to harvest anything."); } } }
public void SeedField(IList <string> inputMatrix, string firstNinjaName, string secondNinjaName) { for (int i = 0; i < inputMatrix.Count; i++) { List <IGameObject> currentRow = new List <IGameObject>(); string currentInputRow = inputMatrix[i]; for (int j = 0; j < currentInputRow.Length; j++) { char currentElement = currentInputRow[j]; IVegetable newVegetable = null; IBlankSpace newBlanckSpace = null; INinja newNinja = null; IMatrixPosition position = new MatrixPosition(i, j); switch (currentElement) { case 'A': newVegetable = new Asparagus(position); break; case 'B': newVegetable = new Broccoli(position); break; case 'C': newVegetable = new CherryBerry(position); break; case 'M': newVegetable = new Mushroom(position); break; case 'R': newVegetable = new Royal(position); break; case '*': newVegetable = new MeloLemonMelon(position); break; case '-': newBlanckSpace = new BlankSpace(position, -1, VegetableType.Blank); break; } if (currentElement.Equals(firstNinjaName[0])) { newNinja = new Ninja(position, firstNinjaName); } if (currentElement.Equals(secondNinjaName[0])) { newNinja = new Ninja(position, secondNinjaName); } if (newVegetable != null) { this.AddVegetable(newVegetable); currentRow.Add(newVegetable); } if (newNinja != null) { this.AddNinja(newNinja); currentRow.Add(newNinja); } if (newBlanckSpace != null) { currentRow.Add(newBlanckSpace); } } this.gameField.Add(currentRow); } }