Exemplo n.º 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;
        }
Exemplo n.º 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 void Serialize(DataSerializer s)
            {
                GameSpeedManager m = Singleton <GameSpeedManager> .instance;

                s.WriteInt32(m.values.GameSpeedIndex);
                s.WriteBool(m.values.IsMilestonePopulationThresholdUnscaled);
                s.WriteBool(m.values.IsHardMode);
            }
            public void Deserialize(DataSerializer s)
            {
                GameSpeedManager m = Singleton <GameSpeedManager> .instance;

                m.values.GameSpeedIndex = s.ReadInt32();
                m.Parameters            = new GameSpeedParameters(m.values.GameSpeedIndex);
                m.values.IsMilestonePopulationThresholdUnscaled = s.ReadBool();
                m.values.IsHardMode = s.ReadBool();
            }
Exemplo n.º 5
0
        public static int GetModdedDemand(int demandValue)
        {
            GameSpeedManager gs = Singleton <GameSpeedManager> .instance;

            if (gs.values.IsHardMode)
            {
                demandValue -= 20;
            }

            return(demandValue);
        }
Exemplo n.º 6
0
        public void GameSpeedModUpdateUI()
        {
            if (gameSpeedDropDown != null && populationThresholdUnscaledCheckBox != null && hardModeCheckBox != null)
            {
                GameSpeedManager gsm = Singleton <GameSpeedManager> .instance;

                freezeUI = true;
                gameSpeedDropDown.selectedIndex = gsm.values.GameSpeedIndex;
                populationThresholdUnscaledCheckBox.isChecked = gsm.values.IsMilestonePopulationThresholdUnscaled;
                hardModeCheckBox.isChecked = gsm.values.IsHardMode;
                freezeUI = false;
            }
        }
Exemplo n.º 7
0
        public override int OnGetPopulationTarget(int originalTarget, int scaledTarget)
        {
            if (!LoadingExtension.IsLeveLoaded)
            {
                return(999999);
            }

            GameSpeedManager gs = Singleton <GameSpeedManager> .instance;
            int value;

            if (gs.values.IsMilestonePopulationThresholdUnscaled)
            {
                value = (int)Math.Round(originalTarget * gs.Parameters.MilestonePopulationThreshholdMultiplier);
            }
            else
            {
                value = (int)Math.Round(scaledTarget * gs.Parameters.MilestonePopulationThreshholdMultiplier);
            }

            return(value);
        }
Exemplo n.º 8
0
        public override void OnLevelLoaded(LoadMode mode)
        {
            GameSpeedManager gsm = Singleton <GameSpeedManager> .instance;

            if (mode == LoadMode.NewGame || mode == LoadMode.LoadGame || mode == LoadMode.NewGameFromScenario)
            {
                gsm.SetAll();
            }

            if (mode == LoadMode.NewGame || mode == LoadMode.NewGameFromScenario)
            {
                int cash_thousands = (int)(Singleton <EconomyManager> .instance.LastCashAmount / 100000);
                int moneyToAdd     = (cash_thousands * 40 * (gsm.Parameters.ConstructionCostMultiplier - 1) / 70) * 100000;
                Singleton <EconomyManager> .instance.AddResource(EconomyManager.Resource.LoanAmount, moneyToAdd, ItemClass.Service.None, ItemClass.SubService.None, ItemClass.Level.None);
            }

            IsLeveLoaded = true;

            MainToolbar.mainToolbar.RefreshPanel();

            ModLogger.Write();
        }
Exemplo n.º 9
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;
        }
Exemplo n.º 10
0
        public void OnSettingsUI(UIHelperBase helper)
        {
            GameSpeedManager gsm = Singleton <GameSpeedManager> .instance;

            gameSpeedDropDown = (UIDropDown)helper.AddDropdown("Game speed", gsm.GameSpeeds, gsm.values.GameSpeedIndex, delegate(int sel)
            {
                if (!freezeUI)
                {
                    gsm.values.GameSpeedIndex = sel;
                    gsm.AfterOptionChanged();
                }
            });

            helper.AddSpace(20);

            populationThresholdUnscaledCheckBox = (UICheckBox)helper.AddCheckbox(
                "Do not scale milestone population threshold with water area ratio",
                gsm.values.IsMilestonePopulationThresholdUnscaled,
                delegate(bool isChecked)
            {
                if (!freezeUI)
                {
                    gsm.values.IsMilestonePopulationThresholdUnscaled = isChecked;
                    gsm.AfterOptionChanged();
                }
            });

            helper.AddSpace(20);

            hardModeCheckBox = (UICheckBox)helper.AddCheckbox("Hard Mode", gsm.values.IsHardMode, delegate(bool isChecked)
            {
                if (!freezeUI)
                {
                    gsm.values.IsHardMode = isChecked;
                    gsm.AfterOptionChanged();
                }
            });
        }
Exemplo n.º 11
0
        public override int OnGetConstructionCost(int originalConstructionCost, Service service, SubService subService, Level level)
        {
            GameSpeedManager gs = Singleton <GameSpeedManager> .instance;

            return(originalConstructionCost * gs.Parameters.ConstructionCostMultiplier);
        }
Exemplo n.º 12
0
        public override int OnGetAreaPrice(uint ore, uint oil, uint forest, uint fertility, uint water, bool road, bool train, bool ship, bool plane, float landFlatness, int originalPrice)
        {
            GameSpeedManager gs = Singleton <GameSpeedManager> .instance;

            return(originalPrice * gs.Parameters.AreaCostMultiplier);
        }