Terraria.Player.QuickMana C# (CSharp) Method

QuickMana() public method

public QuickMana ( ) : void
return void
        public void QuickMana()
        {
            if (this.noItems || this.statMana == this.statManaMax2)
                return;
            for (int index = 0; index < 58; ++index)
            {
                if (this.inventory[index].stack > 0 && this.inventory[index].itemId > 0 && this.inventory[index].healMana > 0 && (this.potionDelay == 0 || !this.inventory[index].potion))
                {
                    Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, this.inventory[index].useSound);
                    if (this.inventory[index].potion)
                    {
                        if (this.inventory[index].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 += this.inventory[index].healLife;
                    this.statMana += this.inventory[index].healMana;
                    if (this.statLife > this.statLifeMax2)
                        this.statLife = this.statLifeMax2;
                    if (this.statMana > this.statManaMax2)
                        this.statMana = this.statManaMax2;
                    if (this.inventory[index].healLife > 0 && Main.myPlayer == this.whoAmI)
                        this.HealEffect(this.inventory[index].healLife, true);
                    if (this.inventory[index].healMana > 0)
                    {
                        this.AddBuff(94, Player.manaSickTime, true);
                        if (Main.myPlayer == this.whoAmI)
                            this.ManaEffect(this.inventory[index].healMana);
                    }
                    --this.inventory[index].stack;
                    if (this.inventory[index].stack <= 0)
                    {
                        this.inventory[index].itemId = 0;
                        this.inventory[index].name = "";
                    }
                    Recipe.FindRecipes();
                    break;
                }
            }
        }
Player