Пример #1
0
        public static void ResetLoans()
        {
            if (!isAlreadySet)
            {
                return;
            }

            EconomyManager   em = Singleton <EconomyManager> .instance;
            GameSpeedManager gs = Singleton <GameSpeedManager> .instance;

            for (int i = 0; i < 3; i++)
            {
                em.m_properties.m_banks[i].m_loanOffers[0].m_amount /= gs.Parameters.LoanMultiplier;

                int value = em.m_properties.m_banks[i].m_loanOffers[0].m_length;
                em.m_properties.m_banks[i].m_loanOffers[0].m_length = Mathf.RoundToInt(value * 2f / (1 + gs.Parameters.LoanMultiplier));
            }

            ModLogger.Add("Reset loans");

            isAlreadySet = false;
        }
Пример #2
0
        public static void Init()
        {
            if (!float.IsNaN(percentageChanceElementaryEducation_orig))
            {
                return;                                                         // Already set
            }
            float k = Singleton <GameSpeedManager> .instance.Parameters.TimeFlowMultiplier_x10 * 0.1f;

            foreach (LibraryAI libAI in Helper.PrefabBuildingAIs <LibraryAI>())
            {
                percentageChanceElementaryEducation_orig    = libAI.m_percentageChanceElementaryEducation;
                percentageChanceHighschoolEducation_orig    = libAI.m_percentageChanceHighschoolEducation;
                percentageChanceUniversityEducation_orig    = libAI.m_percentageChanceUniversityEducation;
                libAI.m_percentageChanceElementaryEducation = percentageChanceElementaryEducation_orig / k;
                libAI.m_percentageChanceHighschoolEducation = percentageChanceHighschoolEducation_orig / k;
                libAI.m_percentageChanceUniversityEducation = percentageChanceUniversityEducation_orig / k;

                ModLogger.Add("PercentageChanceEducation for " + libAI.name,
                              "Elementary", percentageChanceElementaryEducation_orig, libAI.m_percentageChanceElementaryEducation,
                              "Highschool", percentageChanceHighschoolEducation_orig, libAI.m_percentageChanceHighschoolEducation,
                              "University", percentageChanceUniversityEducation_orig, libAI.m_percentageChanceUniversityEducation
                              );
            }
        }
        private static void updateCemetries(bool isSet)
        {
            int t10 = Singleton <GameSpeedManager> .instance.Parameters.TimeFlowMultiplier_x10;

            // Decrease Hearse capacity
            int vehiclePrefabsCount = PrefabCollection <VehicleInfo> .PrefabCount();

            for (uint i = 0; i < vehiclePrefabsCount; i++)
            {
                VehicleInfo vi = PrefabCollection <VehicleInfo> .GetPrefab(i);

                if (vi == null)
                {
                    continue;
                }

                if (vi.m_vehicleAI as HearseAI == null)
                {
                    continue;
                }

                string vehicleName = vi.m_vehicleAI.name;

                string key = vehicleName + "_corpseCapacity";
                if (isSet)
                {
                    int prevValue = ((HearseAI)vi.m_vehicleAI).m_corpseCapacity;
                    int newValue  = Mathf.Max(1, prevValue * 10 / t10);
                    origValues[key] = prevValue;
                    ModLogger.Add(vehicleName, "corpseCapacity", prevValue, newValue);
                    ((HearseAI)vi.m_vehicleAI).m_corpseCapacity = newValue;
                }
                else if (origValues.ContainsKey(key))
                {
                    ModLogger.Add(vehicleName, "Reset corpseCapacity");
                    ((HearseAI)vi.m_vehicleAI).m_corpseCapacity = (int)origValues[key];
                    origValues.Remove(key);
                }
            }

            // Decrease Cemetery and Crematory capacities
            foreach (CemeteryAI cemetryAI in Helper.PrefabBuildingAIs <CemeteryAI>())
            {
                string bldName = cemetryAI.name;

                string key = bldName + "_graveCount";
                if (isSet)
                {
                    int prevValue = cemetryAI.m_graveCount;
                    int newValue  = prevValue * 10 / t10;
                    origValues[key] = prevValue;
                    ModLogger.Add(bldName, "graveCount", prevValue, newValue);
                    cemetryAI.m_graveCount = newValue;
                }
                else if (origValues.ContainsKey(key))
                {
                    ModLogger.Add(bldName, "Reset graveCount");
                    cemetryAI.m_graveCount = (int)origValues[key];
                    origValues.Remove(key);
                }

                key = bldName + "_corpseCapacity";
                if (isSet)
                {
                    int prevValue = cemetryAI.m_corpseCapacity;
                    int newValue  = prevValue * 10 / t10;
                    origValues[key] = prevValue;
                    ModLogger.Add(bldName, "corpseCapacity", prevValue, newValue);
                    cemetryAI.m_corpseCapacity = newValue;
                }
                else if (origValues.ContainsKey(key))
                {
                    ModLogger.Add(bldName, "Reset corpseCapacity");
                    cemetryAI.m_corpseCapacity = (int)origValues[key];
                    origValues.Remove(key);
                }
            }
        }