public static void setCompanyStats(StatCollection stats)
        {
            companyStats = stats;
            bool hasCu2 = CustomUnitsAPI.Detected_V2();

            if (BiggerDrops.settings.allowUpgrades)
            {
                if (hasCu2)
                {
                    // one time upgrade of this stat for existing careers
                    if (companyStats.ContainsStatistic(AdditionalMechSlotsStat) && !companyStats.ContainsStatistic(legacyUpgradeDone))
                    {
                        companyStats.AddStatistic(legacyUpgradeDone, 1);
                        companyStats.Int_Add(companyStats.GetStatistic(AdditionalMechSlotsStat), DefaultMechSlots);
                    }
                    if (!companyStats.ContainsStatistic(legacyUpgradeDone))
                    {
                        companyStats.AddStatistic(legacyUpgradeDone, 1);
                    }
                    Dictionary <string, int> SlotCount = new Dictionary <string, int>();
                    foreach (string id in BiggerDrops.settings.CuV2InitialSlots)
                    {
                        if (SlotCount.ContainsKey(id))
                        {
                            SlotCount[id]++;
                        }
                        else
                        {
                            SlotCount.Add(id, 1);
                        }
                    }
                    foreach (string slotId in SlotOrder)
                    {
                        DropSlotDef def = CustomUnitsAPI.GetDropSlotDef(slotId);
                        if (def != null)
                        {
                            if (!companyStats.ContainsStatistic(def.StatName))
                            {
                                int val = 0;
                                if (SlotCount.ContainsKey(slotId))
                                {
                                    val = SlotCount[slotId];
                                }
                                companyStats.AddStatistic(def.StatName, val);

                                Logger.M.WL($"failed to find slotdef: {slotId}");
                            }
                        }
                        else
                        {
                            Logger.M.WL($"failed to find slotdef: {slotId}");
                        }
                    }
                }
                else
                {
                    if (!companyStats.ContainsStatistic(AdditionalMechSlotsStat))
                    {
                        companyStats.AddStatistic(AdditionalMechSlotsStat,
                                                  Math.Max(Math.Min(MaxAdditionalMechSlots, BiggerDrops.settings.additinalMechSlots), 0));
                    }

                    if (!companyStats.ContainsStatistic(AdditionPlayerMechsStat))
                    {
                        companyStats.AddStatistic(AdditionPlayerMechsStat,
                                                  Math.Max(Math.Min(MaxAdditionalMechSlots, BiggerDrops.settings.additinalPlayerMechSlots),
                                                           0));
                    }

                    if (!companyStats.ContainsStatistic(CuVehicleStat))
                    {
                        companyStats.AddStatistic(CuVehicleStat, BiggerDrops.settings.CuInitialVehicles);
                    }
                    ;
                }

                if (!companyStats.ContainsStatistic(MaxTonnageStat))
                {
                    companyStats.AddStatistic(MaxTonnageStat,
                                              Math.Max(BiggerDrops.settings.defaultMaxTonnage, 0));
                }
            }
            UpdateCULances();
        }
        private static void UpdateCULancesV2()
        {
            int UnitCount = 0;
            List <List <string> >      LanceLayout    = new List <List <string> >();
            List <string>              currentLance   = new List <string>();
            List <DropSlotDef>         separateLance  = new List <DropSlotDef>();
            List <DropSlotDef>         HotDrop        = new List <DropSlotDef>();
            List <List <DropSlotDef> > combinedLances = new List <List <DropSlotDef> >();

            foreach (string slotId in SlotOrder)
            {
                DropSlotDef def = CustomUnitsAPI.GetDropSlotDef(slotId);
                if (def != null)
                {
                    if (def.combineLanceWith.Count > 0)
                    {
                        bool bFound = false;
                        foreach (List <DropSlotDef> cLance in combinedLances)
                        {
                            foreach (DropSlotDef slot in cLance)
                            {
                                if (def.combineLanceWith.Contains(slot.Description.Id))
                                {
                                    bFound = true;
                                    break;
                                }
                            }
                            if (bFound)
                            {
                                cLance.Add(def);
                                break;
                            }
                        }

                        if (!bFound)
                        {
                            List <DropSlotDef> cLance = new List <DropSlotDef>();
                            cLance.Add(def);
                            combinedLances.Add(cLance);
                        }
                    }
                    else
                    {
                        if (def.SeparateLance || def.HotDrop)
                        {
                            if (def.HotDrop)
                            {
                                HotDrop.Add(def);
                            }
                            else
                            {
                                separateLance.Add(def);
                            }
                        }
                        else
                        {
                            int slotCount = companyStats.GetValue <int>(def.StatName);
                            UnitCount += slotCount;
                            for (int i = 0; i < slotCount; i++)
                            {
                                if (currentLance.Count >= BiggerDrops.settings.CuV2FormationSize)
                                {
                                    LanceLayout.Add(currentLance);
                                    currentLance = new List <string>();
                                }

                                currentLance.Add(slotId);
                            }
                        }
                    }
                }
            }

            if (currentLance.Count > 0)
            {
                LanceLayout.Add(currentLance);
            }

            foreach (List <DropSlotDef> cLance in combinedLances)
            {
                currentLance = new List <string>();
                foreach (DropSlotDef def in cLance)
                {
                    int slotCount = companyStats.GetValue <int>(def.StatName);
                    UnitCount += slotCount;
                    for (int i = 0; i < slotCount; i++)
                    {
                        if (currentLance.Count >= BiggerDrops.settings.CuV2FormationSize)
                        {
                            LanceLayout.Add(currentLance);
                            currentLance = new List <string>();
                        }
                        currentLance.Add(def.Description.Id);
                    }
                }
                if (currentLance.Count > 0)
                {
                    LanceLayout.Add(currentLance);
                }
            }

            foreach (DropSlotDef def in separateLance)
            {
                currentLance = new List <string>();
                int slotCount = companyStats.GetValue <int>(def.StatName);
                UnitCount += slotCount;
                for (int i = 0; i < slotCount; i++)
                {
                    if (currentLance.Count >= BiggerDrops.settings.CuV2FormationSize)
                    {
                        LanceLayout.Add(currentLance);
                        currentLance = new List <string>();
                    }
                    currentLance.Add(def.Description.Id);
                }
                if (currentLance.Count > 0)
                {
                    LanceLayout.Add(currentLance);
                }
            }

            currentLance = new List <string>();
            foreach (DropSlotDef def in HotDrop)
            {
                int slotCount = companyStats.GetValue <int>(def.StatName);
                UnitCount += slotCount;
                for (int i = 0; i < slotCount; i++)
                {
                    if (currentLance.Count >= BiggerDrops.settings.CuV2FormationSize)
                    {
                        LanceLayout.Add(currentLance);
                        currentLance = new List <string>();
                    }
                    currentLance.Add(def.Description.Id);
                }
            }
            if (currentLance.Count > 0)
            {
                LanceLayout.Add(currentLance);
            }
            CustomUnitsAPI.PushDropLayout(CustomUnitsAPI.BIGGER_DROPS_LAYOUT_ID, LanceLayout, UnitCount, new List <string>()
            {
                "Lance A", "Lance B", "Lance C"
            });
            int iBayCount = Math.Max(MinCuBays, companyStats.GetValue <int>("MechBayPods"));

            CustomUnitsAPI.setMechBayCount(iBayCount);
        }