public void PickAmmo(Item sItem, ref int shoot, ref float speed, ref bool canShoot, ref int Damage, ref float KnockBack, bool dontConsume = false)
{
Item obj = new Item();
bool flag1 = false;
for (int index = 54; index < 58; ++index)
{
if (this.inventory[index].ammo == sItem.useAmmo && this.inventory[index].stack > 0)
{
obj = this.inventory[index];
canShoot = true;
flag1 = true;
break;
}
}
if (!flag1)
{
for (int index = 0; index < 54; ++index)
{
if (this.inventory[index].ammo == sItem.useAmmo && this.inventory[index].stack > 0)
{
obj = this.inventory[index];
canShoot = true;
break;
}
}
}
if (!canShoot)
return;
if (sItem.itemId == 1946)
shoot = 338 + obj.itemId - 771;
else if (sItem.useAmmo == 771)
shoot += obj.shoot;
else if (sItem.useAmmo == 780)
shoot += obj.shoot;
else if (obj.shoot > 0)
shoot = obj.shoot;
if (sItem.itemId == 3019 && shoot == 1)
shoot = 485;
if (sItem.itemId == 3052)
shoot = 495;
if (sItem.itemId == 3245 && shoot == 21)
shoot = 532;
if (shoot == 42)
{
if (obj.itemId == 370)
{
shoot = 65;
Damage += 5;
}
else if (obj.itemId == 408)
{
shoot = 68;
Damage += 5;
}
else if (obj.itemId == 1246)
{
shoot = 354;
Damage += 5;
}
}
if (this.inventory[this.selectedItem].itemId == 2888 && shoot == 1)
shoot = 469;
if (this.magicQuiver && (sItem.useAmmo == 1 || sItem.useAmmo == 323))
{
KnockBack = (float)(int)((double)KnockBack * 1.1);
speed *= 1.1f;
}
speed += obj.shootSpeed;
if (obj.ranged)
{
if (obj.damage > 0)
Damage += (int)((double)obj.damage * (double)this.rangedDamage);
}
else
Damage += obj.damage;
if (sItem.useAmmo == 1 && this.archery)
{
if ((double)speed < 20.0)
{
speed *= 1.2f;
if ((double)speed > 20.0)
speed = 20f;
}
Damage = (int)((double)Damage * 1.2);
}
KnockBack += obj.knockBack;
bool flag2 = dontConsume;
if (sItem.itemId == 3245)
{
if (Main.rand.Next(3) == 0)
flag2 = true;
else if (this.thrownCost33 && Main.rand.Next(100) < 33)
flag2 = true;
else if (this.thrownCost50 && Main.rand.Next(100) < 50)
flag2 = true;
}
if (sItem.itemId == 3475 && Main.rand.Next(3) != 0)
flag2 = true;
if (sItem.itemId == 3540 && Main.rand.Next(3) != 0)
flag2 = true;
if (this.magicQuiver && sItem.useAmmo == 1 && Main.rand.Next(5) == 0)
flag2 = true;
if (this.ammoBox && Main.rand.Next(5) == 0)
flag2 = true;
if (this.ammoPotion && Main.rand.Next(5) == 0)
flag2 = true;
if (sItem.itemId == 1782 && Main.rand.Next(3) == 0)
flag2 = true;
if (sItem.itemId == 98 && Main.rand.Next(3) == 0)
flag2 = true;
if (sItem.itemId == 2270 && Main.rand.Next(2) == 0)
flag2 = true;
if (sItem.itemId == 533 && Main.rand.Next(2) == 0)
flag2 = true;
if (sItem.itemId == 1929 && Main.rand.Next(2) == 0)
flag2 = true;
if (sItem.itemId == 1553 && Main.rand.Next(2) == 0)
flag2 = true;
if (sItem.itemId == 434 && this.itemAnimation < sItem.useAnimation - 2)
flag2 = true;
if (this.ammoCost80 && Main.rand.Next(5) == 0)
flag2 = true;
if (this.ammoCost75 && Main.rand.Next(4) == 0)
flag2 = true;
if (shoot == 85 && this.itemAnimation < this.itemAnimationMax - 6)
flag2 = true;
if ((shoot == 145 || shoot == 146 || (shoot == 147 || shoot == 148) || shoot == 149) && this.itemAnimation < this.itemAnimationMax - 5)
flag2 = true;
if (flag2 || !obj.consumable)
return;
--obj.stack;
if (obj.stack > 0)
return;
obj.active = false;
obj.name = "";
obj.itemId = 0;
}