public static void Prefix(ref CarePackageInfo[] ___carePackages) { if (carePackages == null) { List <CarePackageInfo> list = new List <CarePackageInfo>(); Debug.Log("Setting up care packages:"); for (int i = 0; i < carePackages.Count(); i++) { CarePackageContainer container = CarePackageState.StateManager.State.CarePackages[i]; container.multiplier = CarePackageState.StateManager.State.multiplier; if (Assets.TryGetPrefab(container.ID) != null) { Debug.Log($" id: {container.ID} quantity: {container.amount} multiplier: {container.multiplier}"); list.Add(container.ToInfo()); } else { Debug.Log("[CarePackageMod] Illegal Prefab: " + container.ID); } } carePackages = list.ToArray(); } ___carePackages = carePackages; }
internal static bool Prefix(Immigration __instance, ref CarePackageInfo[] ___carePackages) { if (!CarePackageState.StateManager.State.enabled) { return(true); } if (carePackages == null) { List <CarePackageInfo> list = new List <CarePackageInfo>(); carePackages = new CarePackageInfo[CarePackageState.StateManager.State.CarePackages.Count()]; float multiplier = CarePackageState.StateManager.State.multiplier; Debug.Log("Setting up care packages:"); for (int i = 0; i < carePackages.Count(); i++) { CarePackageContainer container = CarePackageState.StateManager.State.CarePackages[i]; container.amount = (int)Math.Max(Math.Round(container.amount * multiplier, 0), 1f); Debug.Log(" id: " + container.ID + " quantity: " + container.amount); carePackages[i] = container.ToInfo(); } // foreach (CarePackageContainer container in CarePackageState.StateManager.State.CarePackages) // { // container.amount = (int)Math.Max(Math.Round(container.amount * multiplier, 0), 1f); // Debug.Log(" id: " + container.ID + " quantity: " + container.amount); // list.Add(container.ToInfo()); // } // carePackages = list.ToArray(); } ___carePackages = carePackages; return(false); }