private void SplitStockpileOnLeave(Players.Player player) { Stockpile player_Stockpile = Stockpile.GetStockPile(player); Stockpile fake_player_Stockpile = Stockpile.GetStockPile(fake_player); int split = playersOnTeam.Count + 1; player_Stockpile._items.Clear(); for (ushort item = 0; item < ItemTypes.IndexLookup.MaxRegistered; item++) { int amount = fake_player_Stockpile.AmountContained(item); amount = amount / split; if (amount > 0) { player_Stockpile.Add(item, amount); fake_player_Stockpile.TryRemove(item, amount); } } player.SendStockpileInventory(); fake_player.SendStockpileInventory(); }