public void GiveSeed(Mobile m, BaseRegentPlant plant) // Gets the kind of seed depending on the kind of plant { Backpack pack = (Backpack)m.Backpack; // References the mobiles backpack if (plant is BloodMossPlant) { pack.DropItem(new BaseRegentSeed(0)); } else if (plant is GarlicPlant) { pack.DropItem(new BaseRegentSeed(1)); } else if (plant is GinsengPlant) { pack.DropItem(new BaseRegentSeed(2)); } else if (plant is MandrakePlant) { pack.DropItem(new BaseRegentSeed(3)); } else if (plant is NightshadePlant) { pack.DropItem(new BaseRegentSeed(4)); } }
public GrowthTimer(BaseRegentPlant item) : base(TimeSpan.FromMinutes(30)) { i_item = item; Priority = TimerPriority.OneSecond; }
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 GiveSeed(Mobile m, BaseRegentPlant plant) { Backpack pack = (Backpack)m.Backpack; if (pack == null) { return; } if (plant is BloodMossPlant) { pack.DropItem(new BaseRegentSeed(0)); } else if (plant is GarlicPlant) { pack.DropItem(new BaseRegentSeed(1)); } else if (plant is GinsengPlant) { pack.DropItem(new BaseRegentSeed(2)); } else if (plant is MandrakePlant) { pack.DropItem(new BaseRegentSeed(3)); } else if (plant is NightshadePlant) { pack.DropItem(new BaseRegentSeed(4)); } }
public void GiveSeed(Mobile m, BaseRegentPlant plant) { Backpack pack = (Backpack)m.Backpack; if (pack == null) return; if (plant is BloodMossPlant) { pack.DropItem(new BaseRegentSeed(0)); } else if (plant is GarlicPlant) { pack.DropItem(new BaseRegentSeed(1)); } else if (plant is GinsengPlant) { pack.DropItem(new BaseRegentSeed(2)); } else if (plant is MandrakePlant) { pack.DropItem(new BaseRegentSeed(3)); } else if (plant is NightshadePlant) { pack.DropItem(new BaseRegentSeed(4)); } }
protected override void OnTick() { foreach (Item item in World.Items.Values) { if (item is BaseRegentPlant) { BaseRegentPlant plant = (BaseRegentPlant)item; if (plant.Held < 12) { plants.Add(plant); } else if (plant.Held >= 12 && plants.Contains(plant)) { plants.Remove(plant); } } } for (int i = 0; i < plants.Count; ++i) { BaseRegentPlant plant = (BaseRegentPlant)plants[i]; if (plant.Held < 12) { plant.Held += 1; } } Console.WriteLine("Regent Plant Growth Check."); GrowthTimer tmr = new GrowthTimer(); tmr.Start(); this.Stop(); }
public void GiveSeed(Mobile m, BaseRegentPlant plant) // Gets the kind of seed depending on the kind of plant { Backpack pack = (Backpack)m.Backpack; // References the mobiles backpack if (plant is BloodMossPlant) pack.DropItem(new BaseRegentSeed(0)); else if (plant is GarlicPlant) pack.DropItem(new BaseRegentSeed(1)); else if (plant is GinsengPlant) pack.DropItem(new BaseRegentSeed(2)); else if (plant is MandrakePlant) pack.DropItem(new BaseRegentSeed(3)); else if (plant is NightshadePlant) pack.DropItem(new BaseRegentSeed(4)); }
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; } } }
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 }
protected override void OnTarget(Mobile from, object target) { if (target is PlantItem) { PlantItem bowl = (PlantItem)target; if (bowl.PlantSystem.Water < 2) { from.SendMessage("The dirt must be softened."); return; } else if (bowl.PlantStatus > PlantStatus.BowlOfDirt) { from.SendMessage("That already contains a plant."); return; } else if (!bowl.IsChildOf(from.Backpack)) { from.SendMessage("That must be in your back pack."); return; } else { Backpack pack = (Backpack)from.Backpack; BaseRegentPlant plant = GetPlant(); plant.Held = 0; plant.Name = plant.Name + " potted"; plant.Movable = true; pack.DropItem(plant); bowl.Delete(); seed.Delete(); } } }
protected override void OnTick() // Overrides OnTick { foreach (Item item in World.Items.Values) // Iterates through all items in world { if (item is BaseRegentPlant) // Checks if item is type of 'BaseRegentPlant' { BaseRegentPlant plant = (BaseRegentPlant)item; // Casts 'item' as a 'BaseRegentPlant' to reference class specific properties if (plant.Held < 12 || plant.Held < 14 && plant.Name.ToLower().Contains("potted")) // Checks if a plant it valid to grow, if it is adds it to the 'plants' arraylist { plants.Add(plant); } } } for (int i = 0; i < plants.Count; ++i) // Iterate through 'plants' & add 1 to the held amount of each plant in the arraylist { BaseRegentPlant plant = (BaseRegentPlant)plants[i]; plant.Held += 1; } this.Stop(); // Stops/Disposes the current timer new GrowthTimer(); // Creates new timer to take place }