public void QuickHeal()
{
if (this.noItems || this.statLife == this.statLifeMax2 || this.potionDelay > 0)
return;
int num1 = this.statLifeMax2 - this.statLife;
Item obj1 = (Item)null;
int num2 = -this.statLifeMax2;
for (int index = 0; index < 58; ++index)
{
Item obj2 = this.inventory[index];
if (obj2.stack > 0 && obj2.itemId > 0 && (obj2.potion && obj2.healLife > 0))
{
int num3 = obj2.healLife - num1;
if (num2 < 0)
{
if (num3 > num2)
{
obj1 = obj2;
num2 = num3;
}
}
else if (num3 < num2 && num3 >= 0)
{
obj1 = obj2;
num2 = num3;
}
}
}
if (obj1 == null)
return;
Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, obj1.useSound);
if (obj1.potion)
{
if (obj1.itemId == 227)
{
this.potionDelay = this.restorationDelayTime;
this.AddBuff(21, this.potionDelay, true);
}
else
{
this.potionDelay = this.potionDelayTime;
this.AddBuff(21, this.potionDelay, true);
}
}
this.statLife += obj1.healLife;
this.statMana += obj1.healMana;
if (this.statLife > this.statLifeMax2)
this.statLife = this.statLifeMax2;
if (this.statMana > this.statManaMax2)
this.statMana = this.statManaMax2;
if (obj1.healLife > 0 && Main.myPlayer == this.whoAmI)
this.HealEffect(obj1.healLife, true);
if (obj1.healMana > 0 && Main.myPlayer == this.whoAmI)
this.ManaEffect(obj1.healMana);
--obj1.stack;
if (obj1.stack <= 0)
{
obj1.itemId = 0;
obj1.name = "";
}
Recipe.FindRecipes();
}