public void QuickBuff()
{
if (this.noItems)
return;
int Style = 0;
for (int index1 = 0; index1 < 58; ++index1)
{
if (this.CountBuffs() == 22)
return;
if (this.inventory[index1].stack > 0 && this.inventory[index1].itemId > 0 && (this.inventory[index1].buffType > 0 && !this.inventory[index1].summon) && this.inventory[index1].buffType != 90)
{
int type = this.inventory[index1].buffType;
bool flag = true;
for (int index2 = 0; index2 < 22; ++index2)
{
if (type == 27 && (this.buffType[index2] == type || this.buffType[index2] == 101 || this.buffType[index2] == 102))
{
flag = false;
break;
}
if (this.buffType[index2] == type)
{
flag = false;
break;
}
if (Main.meleeBuff[type] && Main.meleeBuff[this.buffType[index2]])
{
flag = false;
break;
}
}
if (Main.lightPet[this.inventory[index1].buffType] || Main.vanityPet[this.inventory[index1].buffType])
{
for (int index2 = 0; index2 < 22; ++index2)
{
if (Main.lightPet[this.buffType[index2]] && Main.lightPet[this.inventory[index1].buffType])
flag = false;
if (Main.vanityPet[this.buffType[index2]] && Main.vanityPet[this.inventory[index1].buffType])
flag = false;
}
}
if (this.inventory[index1].mana > 0 && flag)
{
if (this.statMana >= (int)((double)this.inventory[index1].mana * (double)this.manaCost))
{
this.manaRegenDelay = (int)this.maxRegenDelay;
this.statMana -= (int)((double)this.inventory[index1].mana * (double)this.manaCost);
}
else
flag = false;
}
if (this.whoAmI == Main.myPlayer && this.inventory[index1].itemId == 603 && !Main.cEd)
flag = false;
if (type == 27)
{
type = Main.rand.Next(3);
if (type == 0)
type = 27;
if (type == 1)
type = 101;
if (type == 2)
type = 102;
}
if (flag)
{
Style = this.inventory[index1].useSound;
int time1 = this.inventory[index1].buffTime;
if (time1 == 0)
time1 = 3600;
this.AddBuff(type, time1, true);
if (this.inventory[index1].consumable)
{
--this.inventory[index1].stack;
if (this.inventory[index1].stack <= 0)
{
this.inventory[index1].itemId = 0;
this.inventory[index1].name = "";
}
}
}
}
}
if (Style <= 0)
return;
Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, Style);
Recipe.FindRecipes();
}