public static void UpdateCULances() { if (CustomUnitsAPI.Detected_V2()) { if (BiggerDrops.settings.allowUpgrades) { UpdateCULancesV2(); } else { CuV2NoUpgrades(); } } else { if (CustomUnitsAPI.Detected()) { UpdateCULancesV1(); } } }
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(); }