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

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

            if (em.m_properties == null || em.m_properties.m_banks == null)
            {
                return;
            }

            for (int i = 0; i < 3; i++)
            {
                int oldAmount = em.m_properties.m_banks[i].m_loanOffers[0].m_amount;
                int oldLength = em.m_properties.m_banks[i].m_loanOffers[0].m_length;

                int newAmount = oldAmount * gs.Parameters.LoanMultiplier;
                int newLength = oldLength * (1 + gs.Parameters.LoanMultiplier) / 2; // Halve the effect to prevent too long loan length.

                em.m_properties.m_banks[i].m_loanOffers[0].m_amount = newAmount;
                em.m_properties.m_banks[i].m_loanOffers[0].m_length = newLength;

                ModLogger.Add(em.m_properties.m_banks[i].m_bankName, "amount", oldAmount, newAmount, "length", oldLength, newLength);
            }

            isAlreadySet = true;
        }
Пример #2
0
        public static void SetProductionLevelupRequirement()
        {
            GameSpeedManager gsm = Singleton <GameSpeedManager> .instance;
            DistrictManager  dm  = Singleton <DistrictManager> .instance;

            if (dm.m_properties == null || dm.m_properties.m_parkProperties == null)
            {
                return;
            }

            //System.Text.StringBuilder sb = new System.Text.StringBuilder("m_productionLevelupRequirement: ");
            int infosCount = dm.m_properties.m_parkProperties.m_industryLevelInfo.Length;

            industryLevelInfo_orig = new int[infosCount];
            for (int i = 0; i < infosCount; i++)
            {
                //sb.Append(dm.m_properties.m_parkProperties.m_industryLevelInfo[i].m_productionLevelupRequirement.ToString() + ",");
                //Original values: 0,500000,1500000,4500000,13500000,0
                int oldValue = dm.m_properties.m_parkProperties.m_industryLevelInfo[i].m_productionLevelupRequirement;
                int newValue = oldValue / 100 * gsm.Parameters.LevelupRequirement;

                industryLevelInfo_orig[i] = oldValue;
                dm.m_properties.m_parkProperties.m_industryLevelInfo[i].m_productionLevelupRequirement = newValue;

                ModLogger.Add(dm.m_properties.m_parkProperties.name, "productionLevelupRequirement" + i.ToString(), oldValue / 1000, newValue / 1000);
            }
            //Debug.Log(sb.ToString());
        }
 public static void ResetTimeFlow()
 {
     if (SimulationManager.exists && SimulationManager.instance.m_ThreadingWrapper != null)
     {
         setTimePerFrame(10);
         ModLogger.Add("Reset time flow");
     }
 }
 public static void ResetLanscapingCost()
 {
     if (costOrig > 0 && Singleton <TerrainManager> .exists && Singleton <TerrainManager> .instance.m_properties != null)
     {
         Singleton <TerrainManager> .instance.m_properties.m_dirtPrice = costOrig;
         costOrig = 0;
         ModLogger.Add("Reset lanscaping cost");
     }
 }
        public static void ResetBldPrefabs()
        {
            if (setConstructionTime(1) > 0)
            {
                ModLogger.Add("Reset all private buildings construction time", constructionTimeVanilla);
            }

            updateCemetries(false);
        }
 public static void SetTimeFlow()
 {
     if (SimulationManager.exists && SimulationManager.instance.m_ThreadingWrapper != null)
     {
         int m = Singleton <GameSpeedManager> .instance.Parameters.TimeFlowMultiplier_x10;
         setTimePerFrame(m);
         ModLogger.Add("Time flow (x times)", m / 10);
     }
 }
 public static void SetLanscapingCost()
 {
     if (costOrig == 0 && Singleton <TerrainManager> .exists && Singleton <TerrainManager> .instance.m_properties != null)
     {
         costOrig = Singleton <TerrainManager> .instance.m_properties.m_dirtPrice;
         int newCost = costOrig * Singleton <GameSpeedManager> .instance.Parameters.ConstructionCostMultiplier;
         Singleton <TerrainManager> .instance.m_properties.m_dirtPrice = newCost;
         ModLogger.Add("Lanscaping", "Cost", costOrig, newCost);
     }
 }
        public static void SetBldPrefabs()
        {
            int m     = Singleton <GameSpeedManager> .instance.Parameters.ConstructionTimeMultiplier;
            int count = setConstructionTime(m);

            if (count > 0)
            {
                ModLogger.Add("All private buildings (" + count.ToString() + ")", "construction time", constructionTimeVanilla, constructionTimeVanilla * m);
            }

            updateCemetries(true);
        }
Пример #9
0
        public static void ResetProductionLevelupRequirement()
        {
            if (industryLevelInfo_orig == null)
            {
                return;
            }

            DistrictManager dm = Singleton <DistrictManager> .instance;

            for (int i = 0; i < dm.m_properties.m_parkProperties.m_industryLevelInfo.Length; i++)
            {
                dm.m_properties.m_parkProperties.m_industryLevelInfo[i].m_productionLevelupRequirement = industryLevelInfo_orig[i];
            }

            industryLevelInfo_orig = null;

            ModLogger.Add("Reset productionLevelupRequirement");
        }
Пример #10
0
        public static void ResetVisitorsLevelupRequirement()
        {
            if (visitorLevelupRequirement_orig == null)
            {
                return;
            }

            DistrictManager dm = Singleton <DistrictManager> .instance;

            for (int i = 0; i < dm.m_properties.m_parkProperties.m_parkLevelInfo.Length; i++)
            {
                dm.m_properties.m_parkProperties.m_parkLevelInfo[i].m_visitorLevelupRequirement = visitorLevelupRequirement_orig[i];
            }

            visitorLevelupRequirement_orig = null;

            ModLogger.Add("Reset visitorLevelupRequirement");
        }
Пример #11
0
        public static void Reset()
        {
            if (float.IsNaN(percentageChanceElementaryEducation_orig))
            {
                return;                                                        // Not set
            }
            foreach (LibraryAI libAI in Helper.PrefabBuildingAIs <LibraryAI>())
            {
                libAI.m_percentageChanceElementaryEducation = percentageChanceElementaryEducation_orig;
                libAI.m_percentageChanceHighschoolEducation = percentageChanceHighschoolEducation_orig;
                libAI.m_percentageChanceUniversityEducation = percentageChanceUniversityEducation_orig;

                ModLogger.Add("Reset percentageChanceEducation for " + libAI.name);
            }

            percentageChanceElementaryEducation_orig = float.NaN;
            percentageChanceHighschoolEducation_orig = float.NaN;
            percentageChanceUniversityEducation_orig = float.NaN;
        }
Пример #12
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;
        }
Пример #13
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
                              );
            }
        }
Пример #14
0
        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);
                }
            }
        }