private int DropAllYourCoins(On.Terraria.Player.orig_DropCoins orig, Terraria.Player self)
        {
            Player player = Main.LocalPlayer;
            int    num6   = 0;

            for (int i = 0; i < 59; i++)
            {
                if (player.inventory[i].type >= ItemID.CopperCoin && player.inventory[i].type <= ItemID.PlatinumCoin)
                {
                    int num5 = Item.NewItem((int)player.position.X, (int)player.position.Y, player.width, player.height, player.inventory[i].type);
                    int num4 = player.inventory[i].stack / 2;
                    if (Main.expertMode)
                    {
                        num4 = (int)((double)player.inventory[i].stack * 0.25);
                    }
                    if (SpectraWorld.professionalMode)
                    {
                        num4 = (int)((double)player.inventory[i].stack * 0);
                    }
                    num4 = player.inventory[i].stack - num4;
                    player.inventory[i].stack -= num4;
                    if (player.inventory[i].type == ItemID.CopperCoin)
                    {
                        num6 += num4;
                    }
                    if (player.inventory[i].type == ItemID.SilverCoin)
                    {
                        num6 += num4 * 100;
                    }
                    if (player.inventory[i].type == ItemID.GoldCoin)
                    {
                        num6 += num4 * 10000;
                    }
                    if (player.inventory[i].type == ItemID.PlatinumCoin)
                    {
                        num6 += num4 * 1000000;
                    }
                    if (player.inventory[i].stack <= 0)
                    {
                        player.inventory[i] = new Item();
                    }
                    Main.item[num5].stack       = num4;
                    Main.item[num5].velocity.Y  = (float)Main.rand.Next(-20, 1) * 0.2f;
                    Main.item[num5].velocity.X  = (float)Main.rand.Next(-20, 21) * 0.2f;
                    Main.item[num5].noGrabDelay = 100;
                    if (Main.netMode == 1)
                    {
                        NetMessage.SendData(21, -1, -1, null, num5);
                    }
                    if (i == 58)
                    {
                        Main.mouseItem = player.inventory[i].Clone();
                    }
                }
            }
            player.lostCoins      = num6;
            player.lostCoinString = Main.ValueToCoins(player.lostCoins);
            return(num6);
        }
Exemple #2
0
 public static int DropCoinsHook(On.Terraria.Player.orig_DropCoins orig, Player self)
 {
     if (Subworld.IsActive <DreamBattleWorld>())
     {
         self.lostCoins      = 0;
         self.lostCoinString = " ";
     }
     else
     {
         orig.Invoke(self);
     }
     return(0);
 }