public void HarvestPlant(Mobile from, Item i_item, BaseRegentPlant i_item2) // This is the handler for when the plant is harvested { Item item = i_item; // The regent the plant has created BaseRegentPlant regentplant = i_item2; // The plant itself Mobile m = from; // The mobile that harvested the plant item.Amount = regentplant.Held; // Sets the amount of the item harvested to that of which the plant held if (m.Skills[SkillName.Cooking].Value > 95.0 || m.Skills[SkillName.Lumberjacking].Value > 95.0) // Checks to see if the harvester is eligable for a skill bonus { item.Amount += (int)(m.Skills[SkillName.Cooking].Value - 95.0) < 0 ? 0 : (int)(m.Skills[SkillName.Cooking].Value - 95.0); // Takes 95 away from the base of their cooking skill & adds the remainer to the harvested items amount, checks if the result would be a negative number item.Amount += (int)(m.Skills[SkillName.Lumberjacking].Value - 95.0) < 0 ? 0 : (int)(m.Skills[SkillName.Lumberjacking].Value - 95.0); // same as above except for lumberjack m.SendMessage("You use you expert skill to gain more then average from the plant."); } double chance = Utility.RandomDouble(); // If it is a wild plant the chance to get a seed is 30%, else if it is potted the chance is 100% if (0.30 > chance || regentplant.Name.ToLower().Contains("potted")) { GiveSeed(m, regentplant); } m.SendMessage("You harvest from the plant."); AddHarvestToPack(m, item); regentplant.Delete(); // Deletes the harvested plant }
public void HarvestPlant(Mobile from, Item i_item, BaseRegentPlant i_item2) { item = i_item; item2 = i_item2; m = from; if (m.InRange(this.GetWorldLocation(), 2)) { item.Amount = held; if (m.Skills[SkillName.Cooking].Value > 95.0 && held >= 0 || m.Skills[SkillName.Lumberjacking].Value > 95.0 && held >= 0) { item.Amount += (int)(m.Skills[SkillName.Cooking].Value - 95.0); item.Amount += (int)(m.Skills[SkillName.Lumberjacking].Value - 95.0); m.SendMessage("You use you expert skill to gain more then average from the plant."); } if (held > 0) { double chance = Utility.RandomDouble(); if (0.30 > chance) GiveSeed(m, item2); m.SendMessage("You harvest from the plant."); AddHarvestToPack(m, item); item2.Delete(); } else { m.SendMessage("There is not enough there to harvest."); item.Delete(); return; } } }
public void HarvestPlant(Mobile from, Item i_item, BaseRegentPlant i_item2) { item = i_item; item2 = i_item2; m = from; if (m.InRange(this.GetWorldLocation(), 2)) { item.Amount = held; if (m.Skills[SkillName.Cooking].Value > 95.0 && held >= 0 || m.Skills[SkillName.Lumberjacking].Value > 95.0 && held >= 0) { item.Amount += (int)(m.Skills[SkillName.Cooking].Value - 95.0); item.Amount += (int)(m.Skills[SkillName.Lumberjacking].Value - 95.0); m.SendMessage("You use you expert skill to gain more then average from the plant."); } if (held > 0) { double chance = Utility.RandomDouble(); if (0.30 > chance) { GiveSeed(m, item2); } m.SendMessage("You harvest from the plant."); AddHarvestToPack(m, item); item2.Delete(); } else { m.SendMessage("There is not enough there to harvest."); item.Delete(); return; } } }