private static void Prefix(RandomSpawnObject __instance)
            {
                if (!IsSpawnerRSO(__instance))
                {
                    return;
                }
                if (GameManager.IsStoryMode() && !WildlifeBegone.Config.enableInStoryMode)
                {
                    return;
                }

                float oldRerollTime = __instance.m_RerollAfterGameHours;
                int   oldMaxObjects = __instance.m_NumObjectsToEnableStalker;

                RSOSettings rsoSettings            = WildlifeBegone.Config.rsoSettings;
                float       maximumCountMultiplier = rsoSettings.ActiveSpawnerCountMultiplier;

                __instance.m_RerollAfterGameHours *= rsoSettings.RerollActiveSpawnersTimeMultiplier;
                RoundingMultiply(ref __instance.m_NumObjectsToEnablePilgrim, maximumCountMultiplier);
                RoundingMultiply(ref __instance.m_NumObjectsToEnableVoyageur, maximumCountMultiplier);
                RoundingMultiply(ref __instance.m_NumObjectsToEnableStalker, maximumCountMultiplier);
                RoundingMultiply(ref __instance.m_NumObjectsToEnableInterloper, maximumCountMultiplier);

                if (WildlifeBegone.Config.logging)
                {
                    Debug.LogFormat("Adjusted RSO {0}: Reroll time {1:F1} -> {2:F1}, maximum active {3:D} -> {4:D}",
                                    __instance.name,
                                    oldRerollTime, __instance.m_RerollAfterGameHours,
                                    oldMaxObjects, __instance.m_NumObjectsToEnableStalker);
                }
            }
Beispiel #2
0
        private WildlifeBegoneConfig(ConfigProxy proxy)
        {
            logging           = proxy.Logging;
            enableInStoryMode = proxy.EnableInStoryMode;

            rsoSettings = proxy.SpawnerGroups;
            if (rsoSettings == null)
            {
                Debug.LogError("[WildlifeBegone] Couldn't load the \"SpawnerGroups\" configuration entry, not modifying group spawns.");
                rsoSettings = new RSOSettings();
            }

            if (proxy.SpawnRates == null)
            {
                Debug.LogError("[WildlifeBegone] Couldn't load the \"SpawnRates\" configuration entry, not modifying spawn settings.");
                proxy.SpawnRates = new Dictionary <string, SpawnRateSetting>();
            }

            Array values = Enum.GetValues(typeof(AiSubType));

            string[] names = Enum.GetNames(typeof(AiSubType));

            spawnRates = new Dictionary <int, SpawnRateSetting>(values.Length);
            for (int i = 0; i < values.Length; ++i)
            {
                int    value = (int)values.GetValue(i);
                string name  = names[i];

                if (!proxy.SpawnRates.TryGetValue(name, out SpawnRateSetting setting))
                {
                    Debug.LogError("[WildlifeBegone] Couldn't find a spawn rate setting for animal type \"" + name + "\". Not modifying spawn rates.");
                    setting = new SpawnRateSetting();
                }

                spawnRates[value] = setting;
            }
        }