Beispiel #1
0
 public override ResidentialLevelUp OnCalculateResidentialLevelUp(ResidentialLevelUp levelUp, int averageEducation, int landValue, ushort buildingID, Service service, SubService subService, Level currentLevel)
 {
     if (Hydrology.instance.isRaining == true && Hydrology.instance._preRainfallLandvalues[buildingID] > 0 && landValue > Hydrology.instance._preRainfallLandvalues[buildingID] && ModSettings.FreezeLandvalues == true)
     {
         //Debug.Log("[RF].LUEB Residence " + buildingID.ToString() + " increased in Landvalue during a storm from " + Hydrology.instance._preRainfallLandvalues[buildingID].ToString() + " to " + landValue.ToString());
         landValue = Hydrology.instance._preRainfallLandvalues[buildingID];
     }
     return(base.OnCalculateResidentialLevelUp(levelUp, averageEducation, landValue, buildingID, service, subService, currentLevel));
 }
Beispiel #2
0
        public override ResidentialLevelUp OnCalculateResidentialLevelUp(ResidentialLevelUp levelUp, int averageEducation, int landValue,
                                                                         ushort buildingID, Service service, SubService subService, Level currentLevel)
        {
            if (HistoricalStatusDataManager.Instance.IsHistorical(buildingID))
            {
                levelUp.targetLevel = currentLevel;
            }

            return(levelUp);
        }
        /// <summary>
        /// Residential level up control - game extension method.
        /// Used to override 'low land value' complaint as appropriate.
        /// </summary>
        /// <param name="levelUp">Original upgrade struct (target level and progress)</param>
        /// <param name="averageEducation">Average education for the building (ignored)</param>
        /// <param name="landValue">Land value for the building (ignored)</param>
        /// <param name="buildingID">Building instance ID</param>
        /// <param name="service">Building service (ignored)</param>
        /// <param name="subService">Building subservice (ignored)</param>
        /// <param name="currentLevel">Existing building level (ignored)</param>
        /// <returns>Revised target level (level and progress)</returns>
        public override ResidentialLevelUp OnCalculateResidentialLevelUp(ResidentialLevelUp levelUp, int averageEducation, int landValue,
                                                                         ushort buildingID, Service service, SubService subService, Level currentLevel)
        {
            // Check if this building is RICO or not.
            bool isRICO = IsRICOBuilding(buildingID);

            // Check if the relevant 'ignore low land value complaint' setting is set.
            if ((ModSettings.noValueOther && !isRICO) || (ModSettings.noValueRico && isRICO))
            {
                // It is - force land value complaint off.
                levelUp.landValueTooLow = false;
            }

            return(levelUp);
        }
 public override ResidentialLevelUp OnCalculateResidentialLevelUp(ResidentialLevelUp levelUp, int averageEducation, int landValue, ushort buildingID, Service service, SubService subService, Level currentLevel)
 {
     // Disable levelling up until I can look into land values
     levelUp.landValueTooLow = false;
     return levelUp;
 }
 public override ResidentialLevelUp OnCalculateResidentialLevelUp(ResidentialLevelUp levelUp, int averageEducation, int landValue, ushort buildingID, Service service, SubService subService, Level currentLevel)
 {
     levelUp.targetLevel = this.controlLevelUp(levelUp.targetLevel, currentLevel, buildingID);
     return(levelUp);
 }
        public override ResidentialLevelUp OnCalculateResidentialLevelUp(ResidentialLevelUp levelUp, int averageEducation, int landValue, ushort buildingID, Service service, SubService subService, Level currentLevel)
        {
            if (levelUp.landValueProgress != 0)
            {
                Level targetLevel;

                if (landValue < 15)
                {
                    targetLevel = Level.Level1;
                    levelUp.landValueProgress = 1 + (landValue * 15 + 7) / 15;
                }
                else if (landValue < 35)
                {
                    targetLevel = Level.Level2;
                    levelUp.landValueProgress = 1 + ((landValue - 15) * 15 + 10) / 20;
                }
                else if (landValue < 60)
                {
                    targetLevel = Level.Level3;
                    levelUp.landValueProgress = 1 + ((landValue - 35) * 15 + 12) / 25;
                }
                else if (landValue < 85)
                {
                    targetLevel = Level.Level4;
                    levelUp.landValueProgress = 1 + ((landValue - 60) * 15 + 12) / 25;
                }
                else
                {
                    targetLevel = Level.Level5;
                    levelUp.landValueProgress = 1;
                }

                if (targetLevel < currentLevel)
                {
                    levelUp.landValueProgress = 1;
                }
                else if (targetLevel > currentLevel)
                {
                    levelUp.landValueProgress = 15;
                }

                if (targetLevel < levelUp.targetLevel)
                {
                    levelUp.targetLevel = targetLevel;
                }
            }

            levelUp.landValueTooLow = false;
            if (currentLevel == Level.Level2)
            {
                if (landValue == 0) levelUp.landValueTooLow = true;
            }
            else if (currentLevel == Level.Level3)
            {
                if (landValue < 21) levelUp.landValueTooLow = true;
            }
            else if (currentLevel == Level.Level4)
            {
                if (landValue < 46) levelUp.landValueTooLow = true;
            }
            else if (currentLevel == Level.Level5)
            {
                if (landValue < 71) levelUp.landValueTooLow = true;
            }

            return levelUp;
        }
        public override ResidentialLevelUp OnCalculateResidentialLevelUp(ResidentialLevelUp levelUp, int averageEducation, int lv, ushort buildingID, Service service, SubService subService, Level currentLevel)
        {
            if (SaveData2.saveData.DifficultyLevel == DifficultyLevel.Vanilla)
            {
                return levelUp;
            }

            var instance = Singleton<BuildingManager>.instance.m_buildings.m_buffer[(int)buildingID];
            var zone = instance.Info.m_class.GetZone();
            int buildingWealth = instance.m_customBuffer1;
            float education = 0;
            float happy = 0;
            float commute = 0;
            var levelUpHelper = LevelUpHelper3.instance;

            var serviceScore = levelUpHelper.GetProperServiceScore(buildingID);
            levelUpHelper.GetEducationHappyScore(buildingID, out education, out happy, out commute);

            Level targetLevel = Level.Level5;
            for (var i = 0; i < 5; i += 1)
            {
                if (serviceScore < levelUpHelper.GetServiceThreshhold((ItemClass.Level)i, zone) || (buildingWealth != 0 && buildingWealth < levelUpHelper.GetWealthThreshhold((ItemClass.Level)i, zone)) || education < levelUpHelper.GetEducationThreshhold((ItemClass.Level)i, zone))
                {
                    targetLevel = (Level)i;
                    levelUp.landValueProgress = 1 + CalcProgress(serviceScore, levelUpHelper.GetServiceThreshhold((ItemClass.Level)i, zone), levelUpHelper.GetServiceThreshhold((ItemClass.Level)(i - 1), zone), 7) + CalcProgress(buildingWealth, levelUpHelper.GetWealthThreshhold((ItemClass.Level)i, zone), levelUpHelper.GetWealthThreshhold((ItemClass.Level)(i - 1), zone), 8);
                    levelUp.educationProgress = 1 + CalcProgress((int)education, levelUpHelper.GetEducationThreshhold((ItemClass.Level)i, zone), levelUpHelper.GetEducationThreshhold((ItemClass.Level)(i - 1), zone), 15);
                    break;
                }
            }

            levelUp.landValueTooLow = (serviceScore < levelUpHelper.GetServiceThreshhold((ItemClass.Level)(Math.Max(-1, (int)currentLevel - 2)), zone)) || (buildingWealth != 0 && buildingWealth < levelUpHelper.GetWealthThreshhold((ItemClass.Level)(Math.Max(-1, (int)currentLevel - 2)), zone));

            if (targetLevel < currentLevel)
            {
                levelUp.landValueProgress = 1;
                levelUp.educationProgress = 1;
            }
            else if (targetLevel > currentLevel)
            {
                levelUp.landValueProgress = 15;
                levelUp.educationProgress = 15;
            }
            if (targetLevel < levelUp.targetLevel)
            {
                levelUp.targetLevel = targetLevel;
            }
            return levelUp;
        }
 // Thread: Simulation
 public ResidentialLevelUp OnCalculateResidentialLevelUp(ResidentialLevelUp levelUp, int averageEducation, int landValue, ushort buildingID, Service service, SubService subService, Level currentLevel)
 {
     return levelUp;
 }
        public override ResidentialLevelUp OnCalculateResidentialLevelUp(ResidentialLevelUp levelUp, int averageEducation, int landValue, ushort buildingID, Service service, SubService subService, Level currentLevel)
        {
            DifficultyManager d = Singleton<DifficultyManager>.instance;

            if (levelUp.landValueProgress != 0)
            {
                Level targetLevel;

                int target2 = d.ResidentialTargetLandValue.GetValue(Level.Level2);
                int target3 = d.ResidentialTargetLandValue.GetValue(Level.Level3);
                int target4 = d.ResidentialTargetLandValue.GetValue(Level.Level4);
                int target5 = d.ResidentialTargetLandValue.GetValue(Level.Level5);

                if (landValue < target2)
                {
                    targetLevel = Level.Level1;
                    levelUp.landValueProgress = 1 + (int)(15f * landValue / target2 + 0.49f);
                }
                else if (landValue < target3)
                {
                    targetLevel = Level.Level2;
                    levelUp.landValueProgress = 1 + (int)(15f * (landValue - target2) / (target3 - target2) + 0.49f);
                }
                else if (landValue < target4)
                {
                    targetLevel = Level.Level3;
                    levelUp.landValueProgress = 1 + (int)(15f * (landValue - target3) / (target4 - target3) + 0.49f);
                }
                else if (landValue < target5)
                {
                    targetLevel = Level.Level4;
                    levelUp.landValueProgress = 1 + (int)(15f * (landValue - target4) / (target5 - target4) + 0.49f);
                }
                else
                {
                    targetLevel = Level.Level5;
                    levelUp.landValueProgress = 1;
                }

                if (targetLevel < currentLevel)
                {
                    levelUp.landValueProgress = 1;
                }
                else if (targetLevel > currentLevel)
                {
                    levelUp.landValueProgress = 15;
                }

                if (targetLevel < levelUp.targetLevel)
                {
                    levelUp.targetLevel = targetLevel;
                }
            }

            levelUp.landValueTooLow = false;
            if (currentLevel == Level.Level2)
            {
                if (landValue < d.ResidentialTargetLandValue.GetTooLowValue(Level.Level2)) levelUp.landValueTooLow = true;
            }
            else if (currentLevel == Level.Level3)
            {
                if (landValue < d.ResidentialTargetLandValue.GetTooLowValue(Level.Level3)) levelUp.landValueTooLow = true;
            }
            else if (currentLevel == Level.Level4)
            {
                if (landValue < d.ResidentialTargetLandValue.GetTooLowValue(Level.Level4)) levelUp.landValueTooLow = true;
            }
            else if (currentLevel == Level.Level5)
            {
                if (landValue < d.ResidentialTargetLandValue.GetTooLowValue(Level.Level5)) levelUp.landValueTooLow = true;
            }

            return levelUp;
        }
        public override ResidentialLevelUp OnCalculateResidentialLevelUp(ResidentialLevelUp levelUp, int averageEducation, int landValue, ushort buildingID, Service service, SubService subService, Level currentLevel)
        {
            DifficultyManager d = Singleton <DifficultyManager> .instance;

            if (levelUp.landValueProgress != 0)
            {
                Level targetLevel;

                int target2 = d.ResidentialTargetLandValue.GetValue(Level.Level2);
                int target3 = d.ResidentialTargetLandValue.GetValue(Level.Level3);
                int target4 = d.ResidentialTargetLandValue.GetValue(Level.Level4);
                int target5 = d.ResidentialTargetLandValue.GetValue(Level.Level5);

                if (landValue < target2)
                {
                    targetLevel = Level.Level1;
                    levelUp.landValueProgress = 1 + (int)(15f * landValue / target2 + 0.49f);
                }
                else if (landValue < target3)
                {
                    targetLevel = Level.Level2;
                    levelUp.landValueProgress = 1 + (int)(15f * (landValue - target2) / (target3 - target2) + 0.49f);
                }
                else if (landValue < target4)
                {
                    targetLevel = Level.Level3;
                    levelUp.landValueProgress = 1 + (int)(15f * (landValue - target3) / (target4 - target3) + 0.49f);
                }
                else if (landValue < target5)
                {
                    targetLevel = Level.Level4;
                    levelUp.landValueProgress = 1 + (int)(15f * (landValue - target4) / (target5 - target4) + 0.49f);
                }
                else
                {
                    targetLevel = Level.Level5;
                    levelUp.landValueProgress = 1;
                }

                if (targetLevel < currentLevel)
                {
                    levelUp.landValueProgress = 1;
                }
                else if (targetLevel > currentLevel)
                {
                    levelUp.landValueProgress = 15;
                }

                if (targetLevel < levelUp.targetLevel)
                {
                    levelUp.targetLevel = targetLevel;
                }
            }

            levelUp.landValueTooLow = false;
            if (currentLevel == Level.Level2)
            {
                if (landValue < d.ResidentialTargetLandValue.GetTooLowValue(Level.Level2))
                {
                    levelUp.landValueTooLow = true;
                }
            }
            else if (currentLevel == Level.Level3)
            {
                if (landValue < d.ResidentialTargetLandValue.GetTooLowValue(Level.Level3))
                {
                    levelUp.landValueTooLow = true;
                }
            }
            else if (currentLevel == Level.Level4)
            {
                if (landValue < d.ResidentialTargetLandValue.GetTooLowValue(Level.Level4))
                {
                    levelUp.landValueTooLow = true;
                }
            }
            else if (currentLevel == Level.Level5)
            {
                if (landValue < d.ResidentialTargetLandValue.GetTooLowValue(Level.Level5))
                {
                    levelUp.landValueTooLow = true;
                }
            }

            return(levelUp);
        }
        public override ResidentialLevelUp OnCalculateResidentialLevelUp(ResidentialLevelUp levelUp, int averageEducation, int landValue, ushort buildingID, Service service, SubService subService, Level currentLevel)
        {
            if (!Singleton <GameSpeedManager> .instance.values.IsHardMode)
            {
                return(levelUp);
            }

            if (levelUp.landValueProgress != 0)
            {
                Level targetLevel;

                if (landValue < 15)
                {
                    targetLevel = Level.Level1;
                    levelUp.landValueProgress = 1 + (landValue * 15 + 7) / 15;
                }
                else if (landValue < 35)
                {
                    targetLevel = Level.Level2;
                    levelUp.landValueProgress = 1 + ((landValue - 15) * 15 + 10) / 20;
                }
                else if (landValue < 60)
                {
                    targetLevel = Level.Level3;
                    levelUp.landValueProgress = 1 + ((landValue - 35) * 15 + 12) / 25;
                }
                else if (landValue < 85)
                {
                    targetLevel = Level.Level4;
                    levelUp.landValueProgress = 1 + ((landValue - 60) * 15 + 12) / 25;
                }
                else
                {
                    targetLevel = Level.Level5;
                    levelUp.landValueProgress = 1;
                }

                if (targetLevel < currentLevel)
                {
                    levelUp.landValueProgress = 1;
                }
                else if (targetLevel > currentLevel)
                {
                    levelUp.landValueProgress = 15;
                }

                if (targetLevel < levelUp.targetLevel)
                {
                    levelUp.targetLevel = targetLevel;
                }
            }

            levelUp.landValueTooLow = false;
            if (currentLevel == Level.Level2)
            {
                if (landValue == 0)
                {
                    levelUp.landValueTooLow = true;
                }
            }
            else if (currentLevel == Level.Level3)
            {
                if (landValue < 21)
                {
                    levelUp.landValueTooLow = true;
                }
            }
            else if (currentLevel == Level.Level4)
            {
                if (landValue < 46)
                {
                    levelUp.landValueTooLow = true;
                }
            }
            else if (currentLevel == Level.Level5)
            {
                if (landValue < 71)
                {
                    levelUp.landValueTooLow = true;
                }
            }

            return(levelUp);
        }
 // Thread: Simulation
 public ResidentialLevelUp OnCalculateResidentialLevelUp(ResidentialLevelUp levelUp, int averageEducation, int landValue, ushort buildingID, Service service, SubService subService, Level currentLevel)
 {
     return(levelUp);
 }