public static void DrinkCure_OnCommand(CommandEventArgs e) { GreaterCurePotion m_GreaterCurePotion = (GreaterCurePotion)e.Mobile.Backpack.FindItemByType(typeof(GreaterCurePotion)); CurePotion m_CurePotion = (CurePotion)e.Mobile.Backpack.FindItemByType(typeof(CurePotion)); LesserCurePotion m_LesserCurePotion = (LesserCurePotion)e.Mobile.Backpack.FindItemByType(typeof(LesserCurePotion)); int m_Exists = e.Mobile.Backpack.GetAmount(typeof(GreaterCurePotion)); int m_Existss = e.Mobile.Backpack.GetAmount(typeof(CurePotion)); int m_Existsss = e.Mobile.Backpack.GetAmount(typeof(LesserCurePotion)); if (m_Exists != 0) { e.Mobile.SendMessage("Cure Potion found"); m_GreaterCurePotion.OnDoubleClick(e.Mobile); } else if (m_Existss != 0) { e.Mobile.SendMessage("Cure Potion found"); m_CurePotion.OnDoubleClick(e.Mobile); } else if (m_Existsss != 0) { e.Mobile.SendMessage("Cure Potion found"); m_LesserCurePotion.OnDoubleClick(e.Mobile); } else { e.Mobile.SendMessage("Cannot find Cure Potion"); } }
public override void OnThink() { base.OnThink(); // Chug pots if (this.Poisoned) { GreaterCurePotion m_CPot = (GreaterCurePotion)this.Backpack.FindItemByType(typeof(GreaterCurePotion)); if (m_CPot != null) { m_CPot.Drink(this); } } if (this.Hits <= (this.HitsMax * .7)) // Will try to use heal pots if he's at or below 70% health { GreaterHealPotion m_HPot = (GreaterHealPotion)this.Backpack.FindItemByType(typeof(GreaterHealPotion)); if (m_HPot != null) { m_HPot.Drink(this); } } if (this.Stam <= (this.StamMax * .25)) // Will use a refresh pot if he's at or below 25% stam { TotalRefreshPotion m_RPot = (TotalRefreshPotion)this.Backpack.FindItemByType(typeof(TotalRefreshPotion)); if (m_RPot != null) { m_RPot.Drink(this); } } }
public static void DrinkCure_OnCommand(CommandEventArgs e) { // Added to fix the missing check to region. Ugly fix but this script is so ugly anyways. :p if (e.Mobile.Region != null && !e.Mobile.Region.OnDoubleClick(e.Mobile, new CurePotion())) { return; } LesserCurePotion lc_potion = (LesserCurePotion)e.Mobile.Backpack.FindItemByType(typeof(LesserCurePotion)); CurePotion mc_potion = (CurePotion)e.Mobile.Backpack.FindItemByType(typeof(CurePotion)); GreaterCurePotion gc_potion = (GreaterCurePotion)e.Mobile.Backpack.FindItemByType(typeof(GreaterCurePotion)); int lcp = e.Mobile.Backpack.GetAmount(typeof(LesserCurePotion)); if (lcp != 0) { Targeting.Target.Cancel(e.Mobile); e.Mobile.SendMessage("Lesser cure potion found"); new InternalTimer(e.Mobile, lc_potion).Start(); } else { int mcp = e.Mobile.Backpack.GetAmount(typeof(CurePotion)); if (mcp != 0) { Targeting.Target.Cancel(e.Mobile); e.Mobile.SendMessage("Cure potion found"); new InternalTimer(e.Mobile, mc_potion).Start(); } else { int gcp = e.Mobile.Backpack.GetAmount(typeof(GreaterCurePotion)); if (gcp != 0) { Targeting.Target.Cancel(e.Mobile); e.Mobile.SendMessage("Greater cure potion found"); new InternalTimer(e.Mobile, gc_potion).Start(); } else { e.Mobile.SendMessage("Cure potion not found"); } } } }