public static void DrinkRefresh_OnCommand(CommandEventArgs e) { TotalRefreshPotion m_TotalRefreshPotion = (TotalRefreshPotion)e.Mobile.Backpack.FindItemByType(typeof(TotalRefreshPotion)); RefreshPotion m_RefreshPotion = (RefreshPotion)e.Mobile.Backpack.FindItemByType(typeof(RefreshPotion)); int m_Exists = e.Mobile.Backpack.GetAmount(typeof(TotalRefreshPotion)); int m_Existss = e.Mobile.Backpack.GetAmount(typeof(RefreshPotion)); if (m_Exists != 0) { e.Mobile.SendMessage("Refresh Potion found"); m_TotalRefreshPotion.OnDoubleClick(e.Mobile); } else if (m_Existss != 0) { e.Mobile.SendMessage("Refresh Potion found"); m_RefreshPotion.OnDoubleClick(e.Mobile); } else { e.Mobile.SendMessage("Cannot find Refresh Potion"); } }
public static void DrinkRefresh_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 RefreshPotion())) { return; } RefreshPotion r_potion = (RefreshPotion)e.Mobile.Backpack.FindItemByType(typeof(RefreshPotion)); TotalRefreshPotion tr_potion = (TotalRefreshPotion)e.Mobile.Backpack.FindItemByType(typeof(TotalRefreshPotion)); int rp = e.Mobile.Backpack.GetAmount(typeof(RefreshPotion)); if (rp != 0) { e.Mobile.SendMessage("Refresh potion found"); r_potion.OnDoubleClick(e.Mobile); Targeting.Target.Cancel(e.Mobile); } else { int trp = e.Mobile.Backpack.GetAmount(typeof(TotalRefreshPotion)); if (trp != 0) { e.Mobile.SendMessage("Total refresh potion found"); tr_potion.OnDoubleClick(e.Mobile); Targeting.Target.Cancel(e.Mobile); } else { e.Mobile.SendMessage("Refresh potion not found"); } } }
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); } } }