Ejemplo n.º 1
0
        private static void CuV2NoUpgrades()
        {
            List <List <string> > LanceLayout  = new List <List <string> >();
            List <string>         currentLance = new List <string>();

            foreach (string slot in BiggerDrops.settings.CuV2InitialSlots)
            {
                if (currentLance.Count >= BiggerDrops.settings.CuV2FormationSize)
                {
                    LanceLayout.Add(currentLance);
                    currentLance = new List <string>();
                }
                currentLance.Add(slot);
            }
            CustomUnitsAPI.PushDropLayout(CustomUnitsAPI.BIGGER_DROPS_LAYOUT_ID, LanceLayout, BiggerDrops.settings.CuV2InitialSlots.Count, new List <string>()
            {
                "Lance A", "Lance B", "Lance C"
            });
        }
Ejemplo n.º 2
0
        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);
        }