Ejemplo n.º 1
0
            public override void RightClick(Player player)
            {
                item.stack++;
                // Get the item that the player is holding in their mouse.
                Item mouse = Main.mouseItem;

                // If the bandolier already has an item of this type,
                if (Bullets.Any(x => x.type == mouse.type))
                {
                }
                else if (Bullets.Count > 0 && (mouse.IsAir || mouse.ammo != AmmoID.Bullet || mouse.notAmmo || !mouse.consumable))
                {
                    // Don't give back more than 999
                    player.QuickSpawnItem(Bullet, Math.Min(999, Bullet.maxStack));
                    Bullets.Remove(Bullet);
                }
                // Otherwise, add a new item to the queue.
                else if (Bullets.Count < 10 && mouse.stack >= 999 || mouse.stack == mouse.maxStack)
                {
                    mouse.stack = 1;
                    Bullets.Add(mouse.Clone());

                    mouse.TurnToAir();
                    player.inventory[58] = mouse;
                }

                // Update stats, kill the item, and update the mouse item.
                Bullets.RemoveAll(x => x.IsAir);
                UpdateStats();
            }
Ejemplo n.º 2
0
            public override void RightClick(Player player)
            {
                item.stack++;
                // Get the item that the player is holding in their mouse.
                Item mouse = Main.mouseItem;

                // If the bandolier already has an item of this type,
                if (Bullets.Any(x => x.type == mouse.type))
                {
                    // just add their stacks together.
                    Item item1 = Bullets.First(x => x.type == mouse.type);
                    item1.stack += mouse.stack;

                    mouse.TurnToAir();
                    player.inventory[58] = mouse;
                }
                else if (Bullets.Count > 0 && (mouse.IsAir || mouse.ammo != AmmoID.Bullet || mouse.notAmmo || !mouse.consumable))
                {
                    if (Bullet.stack > 4995)
                    {
                        Bullet.stack -= 4995;
                        for (int i = 0; i < 5; i++)
                        {
                            player.QuickSpawnItem(Bullet, 999);
                        }
                    }
                    else
                    {
                        int numStacks = Bullet.stack / 999;
                        int remainder = Bullet.stack % 999;

                        for (int i = 0; i < numStacks; i++)
                        {
                            player.QuickSpawnItem(Bullet, 999);
                        }

                        player.QuickSpawnItem(Bullet, remainder);
                        Bullets.Remove(Bullet);
                    }
                }
                // Otherwise, add a new item to the queue.
                else if (Bullets.Count < 5)
                {
                    mouse.maxStack = 999999;
                    Bullets.Add(mouse.Clone());

                    mouse.TurnToAir();
                    player.inventory[58] = mouse;
                }

                // Update stats, kill the item, and update the mouse item.
                Bullets.RemoveAll(x => x.IsAir || x.type == 0);
                UpdateStats();
            }