/// <summary>
        /// Gets Loading Counter with user settings.
        /// </summary>
        /// <param name="labelText">Text shown while loading.</param>
        /// <param name="labelTextFinish">Text shown after loading.</param>
        private LoadingLabel MakeLabel(ModSettings settings)
        {
            const string loadingLabelSection = "LoadingLabel";

            if (!settings.GetBool(loadingLabelSection, "Enable"))
            {
                return(null);
            }

            string labelText       = settings.GetString(loadingLabelSection, "LoadingText");
            bool   isDynamic       = settings.GetBool(loadingLabelSection, "IsDynamic");
            string labelTextFinish = settings.GetString(loadingLabelSection, "EndText");
            string deathLabel      = settings.GetString(loadingLabelSection, "DeathText");

            Rect rect = GetRect(
                settings.GetTupleInt(loadingLabelSection, "Position"),
                new Tuple <int, int>(10, 3));

            return(new LoadingLabel(rect, labelText, labelTextFinish, isDynamic, ".", deathLabel)
            {
                Font = settings.GetInt(loadingLabelSection, "Font"),
                FontSize = settings.GetInt(loadingLabelSection, "FontSize"),
                FontStyle = (FontStyle)settings.GetInt(loadingLabelSection, "FontStyle"),
                FontColor = settings.GetColor(loadingLabelSection, "FontColor")
            });
        }
Esempio n. 2
0
        void Awake()
        {
            ModSettings settings            = mod.GetSettings();
            bool        bedSleeping         = settings.GetBool("Modules", "bedSleeping");
            bool        archery             = settings.GetBool("Modules", "advancedArchery");
            bool        encumbrance         = settings.GetBool("Modules", "encumbranceEffects");
            bool        bandaging           = settings.GetBool("Modules", "bandaging");
            bool        shipPorts           = settings.GetBool("Modules", "shipPorts");
            bool        expulsion           = settings.GetBool("Modules", "underworldExpulsion");
            bool        climbing            = settings.GetBool("Modules", "climbingRestriction");
            bool        weaponSpeed         = settings.GetBool("Modules", "weaponSpeed");
            bool        weaponMaterials     = settings.GetBool("Modules", "weaponMaterials");
            bool        equipDamage         = settings.GetBool("Modules", "equipDamage");
            bool        enemyAppearance     = settings.GetBool("Modules", "enemyAppearance");
            bool        purifyPot           = settings.GetBool("Modules", "purificationPotion");
            bool        autoExtinguishLight = settings.GetBool("Modules", "autoExtinguishLight");
            bool        classicStrDmgBonus  = settings.GetBool("Modules", "classicStrengthDamageBonus");
            bool        variantNpcs         = settings.GetBool("Modules", "variantNpcs");
            bool        variantResidents    = settings.GetBool("Modules", "variantResidents");

            bool riding   = settings.GetBool("EnhancedRiding", "enhancedRiding");
            bool training = settings.GetBool("RefinedTraining", "refinedTraining");

            loanMaxPerLevel = loanVals[settings.GetInt("Modules", "loanAmountPerLevel")];
            FormulaHelper.RegisterOverride(mod, "CalculateMaxBankLoan", (Func <int>)CalculateMaxBankLoan);

            InitMod(bedSleeping, archery, riding, encumbrance, bandaging, shipPorts, expulsion, climbing, weaponSpeed, weaponMaterials, equipDamage, enemyAppearance, purifyPot, autoExtinguishLight, classicStrDmgBonus, variantNpcs, variantResidents, training);

            mod.IsReady = true;
        }
        /// <summary>
        /// Gets Quests Messages with user settings.
        /// </summary>
        private QuestsMessages MakeQuestMessages(ModSettings settings)
        {
            const string questsSection = "Quests";

            if (!settings.GetBool(questsSection, "Enable"))
            {
                return(null);
            }

            Rect rect = GetRect(
                settings.GetTupleInt(questsSection, "Position"),
                settings.GetTupleInt(questsSection, "Size"));

            return(new QuestsMessages(rect)
            {
                Font = settings.GetInt(questsSection, "Font"),
                FontStyle = (FontStyle)settings.GetInt(questsSection, "FontStyle"),
                FontColor = settings.GetColor(questsSection, "FontColor")
            });
        }
        /// <summary>
        /// Gets Daggerfall Tips with user settings.
        /// </summary>
        private DfTips MakeTips(ModSettings settings)
        {
            const string tipsSection = "Tips";

            if (!settings.GetBool(tipsSection, "Enable"))
            {
                return(null);
            }

            Rect rect = GetRect(
                settings.GetTupleInt(tipsSection, "Position"),
                settings.GetTupleInt(tipsSection, "Size"));

            return(new DfTips(rect)
            {
                Font = settings.GetInt(tipsSection, "Font"),
                FontStyle = (FontStyle)settings.GetInt(tipsSection, "FontStyle"),
                FontColor = settings.GetColor(tipsSection, "FontColor")
            });
        }
Esempio n. 5
0
        private static void InitMod()
        {
            Debug.Log("Begin mod init: BasicMagicRegen");

            ModSettings settings = mod.GetSettings();

            magicRegenType      = settings.GetInt("Options", "MagicRegenType");
            tickRegenFrequency  = settings.GetInt("Options", "TickRegenFrequency");
            restRegenTickDelay  = settings.GetInt("Options", "RestRegenTickDelay");
            regenAmountModifier = settings.GetFloat("Options", "RegenAmountModifier");

            if (magicRegenType == 0)
            {
                EntityEffectBroker.OnNewMagicRound += MagicRegenFlat_OnNewMagicRound;
            }
            else if (magicRegenType == 1)
            {
                EntityEffectBroker.OnNewMagicRound += MagicRegenPercent_OnNewMagicRound;
            }

            Debug.Log("Finished mod init: BasicMagicRegen");
        }
        /// <summary>
        /// Gets Level Counter with user settings.
        /// </summary>
        private LevelCounter MakeLevelCounter(ModSettings settings)
        {
            const string levelProgressSection = "LevelProgress";

            if (!settings.GetBool(levelProgressSection, "Enable"))
            {
                return(null);
            }

            Rect rect = GetRect(
                settings.GetTupleInt(levelProgressSection, "Position"),
                settings.GetTupleInt(levelProgressSection, "Size"));

            return(new LevelCounter(rect)
            {
                LabelFormat = settings.GetString(levelProgressSection, "Text"),
                Font = settings.GetInt(levelProgressSection, "Font"),
                FontColor = settings.GetColor(levelProgressSection, "FontColor"),
            });
        }
        /// <summary>
        /// Load settings and init window.
        /// </summary>
        private void LoadSettings(ModSettings settings, ModSettingsChange change)
        {
            guiDepth = settings.GetValue <int>("UiSettings", "GuiDepth");

            // General
            const string generalSection = "General";

            dungeons    = settings.GetBool(generalSection, "Dungeons");
            buildings   = settings.GetBool(generalSection, "Buildings");
            minimumWait = settings.GetInt(generalSection, "ShowForMinimum");
            pressAnyKey = settings.GetBool(generalSection, "PressAnyKey");

            // Death Screen
            const string deathScreenSection = "DeathScreen";

            deathScreen  = settings.GetBool(deathScreenSection, "Enable");
            disableVideo = settings.GetBool(deathScreenSection, "DisableVideo");

            window = new LoadingScreenWindow(settings);
            Toggle(true);
        }
        private void LoadSettings(ModSettings settings, ModSettingsChange change)
        {
            const string
                style = "Style",
                waterPlantsSection = "WaterPlants",
                grassSection       = "Grass",
                advancedSection    = "Advanced";

            options.WaterPlants = settings.GetBool(waterPlantsSection, "Enabled");
            var properties = new PrototypesProperties()
            {
                GrassHeight = settings.GetTupleFloat(grassSection, "Height"),
                GrassWidth  = settings.GetTupleFloat(grassSection, "Width"),
                NoiseSpread = settings.GetFloat(grassSection, "NoiseSpread"),
                GrassColors = new GrassColors()
                {
                    SpringHealthy       = settings.GetColor(grassSection, "SpringHealthy"),
                    SpringDry           = settings.GetColor(grassSection, "SpringDry"),
                    SummerHealty        = settings.GetColor(grassSection, "SummerHealty"),
                    SummerDry           = settings.GetColor(grassSection, "SummerDry"),
                    FallHealty          = settings.GetColor(grassSection, "FallHealty"),
                    FallDry             = settings.GetColor(grassSection, "FallDry"),
                    SeasonInterpolation = settings.GetBool(grassSection, "SeasonInterpolation")
                },
                UseGrassShader  = !settings.GetBool(style, "Billboard"),
                TextureOverride = settings.GetBool(advancedSection, "TextureOverride")
            };

            var density = new Density()
            {
                GrassThick   = settings.GetTupleInt(grassSection, "ThickDensity"),
                GrassThin    = settings.GetTupleInt(grassSection, "ThinDensity"),
                WaterPlants  = settings.GetTupleInt(waterPlantsSection, "Density"),
                DesertPlants = settings.GetTupleInt(waterPlantsSection, "DesertDensity"),
            };

            switch (settings.GetInt(style, "Stones"))
            {
            case 0:
                options.TerrainStones = false;
                break;

            case 1:
                options.TerrainStones = true;
                density.Rocks         = 2;
                break;

            case 2:
                options.TerrainStones = true;
                density.Rocks         = 4;
                break;
            }

            if (change.HasChanged(style, "Style"))
            {
                switch (settings.GetValue <int>(style, "Style"))
                {
                case 0:
                default:
                    options.GrassStyle = GrassStyle.Classic;
                    break;

                case 1:
                    options.GrassStyle = GrassStyle.Mixed;
                    break;

                case 2:
                    options.GrassStyle = GrassStyle.Full;
                    break;
                }
            }

            if (change.HasChanged(advancedSection))
            {
                options.DetailObjectDistance = settings.GetValue <int>(advancedSection, "DetailDistance");
                string detailDistanceOverride = settings.GetValue <string>(advancedSection, "DetailDistanceOverride");
                if (!string.IsNullOrWhiteSpace(detailDistanceOverride) && int.TryParse(detailDistanceOverride, out int value))
                {
                    options.DetailObjectDistance = value;
                    Debug.Log($"{this}: override detail distance with {value}", this);
                }

                options.DetailObjectDensity = settings.GetValue <float>(advancedSection, "DetailDensity");
                options.FlyingInsects       = settings.GetValue <bool>(advancedSection, "FlyingInsects");
            }

            detailPrototypesManager = new DetailPrototypesManager(mod, transform, options, properties);
            densityManager          = new DensityManager(mod, options, density);

            if (isEnabled)
            {
                RefreshTerrainDetailsAsync();
            }
        }
 static void LoadSettings(ModSettings settings, ModSettingsChange change)
 {
     instance.ScaleFactor = settings.GetFloat("Core", "ScaleFactor") / 100f;
     instance.BaseValue   = settings.GetInt("Core", "BaseValue");
     instance.RoleplayRealismItemsWeaponBalance = RoleplayRealismItemsWeaponBalanceCompatibility();
 }
Esempio n. 10
0
        private void LoadSettings(ModSettings settings, ModSettingsChange change)
        {
            const string
                waterPlantsSection = "WaterPlants",
                grassSection       = "Grass",
                othersSection      = "Others",
                advancedSection    = "Advanced";

            // Optional details
            int waterPlantsMode = settings.GetInt(waterPlantsSection, "Mode");

            WaterPlants  = waterPlantsMode != 0;
            WinterPlants = waterPlantsMode == 2;

            // Detail prototypes settings
            var properties = new PrototypesProperties()
            {
                GrassHeight = settings.GetTupleFloat(grassSection, "Height"),
                GrassWidth  = settings.GetTupleFloat(grassSection, "Width"),
                NoiseSpread = settings.GetFloat(grassSection, "NoiseSpread"),
                GrassColors = new GrassColors()
                {
                    SpringHealthy = settings.GetColor(grassSection, "SpringHealthy"),
                    SpringDry     = settings.GetColor(grassSection, "SpringDry"),
                    SummerHealty  = settings.GetColor(grassSection, "SummerHealty"),
                    SummerDry     = settings.GetColor(grassSection, "SummerDry"),
                    FallHealty    = settings.GetColor(grassSection, "FallHealty"),
                    FallDry       = settings.GetColor(grassSection, "FallDry"),
                },
                UseGrassShader    = settings.GetInt(grassSection, "Shader") == 1,
                NoiseSpreadPlants = settings.GetFloat(waterPlantsSection, "NoiseSpread"),
                TextureOverride   = settings.GetBool(advancedSection, "TextureOverride")
            };

            // Detail prototypes density
            var density = new Density()
            {
                GrassThick   = settings.GetTupleInt(grassSection, "ThickDensity"),
                GrassThin    = settings.GetTupleInt(grassSection, "ThinDensity"),
                WaterPlants  = settings.GetTupleInt(waterPlantsSection, "Density"),
                DesertPlants = settings.GetTupleInt(waterPlantsSection, "DesertDensity"),
            };

            switch (settings.GetInt(othersSection, "Flowers"))
            {
            case 0:
                Flowers = false;
                break;

            case 1:
                Flowers         = true;
                density.Flowers = 5;
                break;

            case 2:
                Flowers         = true;
                density.Flowers = 25;
                break;

            case 3:
                Flowers         = true;
                density.Flowers = 50;
                break;
            }

            switch (settings.GetInt(othersSection, "Stones"))
            {
            case 0:
                TerrainStones = false;
                break;

            case 1:
                TerrainStones = true;
                density.Rocks = 2;
                break;

            case 2:
                TerrainStones = true;
                density.Rocks = 4;
                break;
            }

            if (change.HasChanged(grassSection, "Realistic"))
            {
                RealisticGrass = settings.GetValue <bool>(grassSection, "Realistic");
            }

            if (change.HasChanged(othersSection, "FlyingInsects"))
            {
                FlyingInsects = settings.GetValue <bool>(othersSection, "FlyingInsects");
            }

            if (change.HasChanged(advancedSection))
            {
                DetailObjectDistance = settings.GetValue <int>(advancedSection, "DetailDistance");
                DetailObjectDensity  = settings.GetValue <float>(advancedSection, "DetailDensity");
            }

            detailPrototypesManager = new DetailPrototypesManager(properties);
            densityManager          = new DensityManager(density);

            if (isEnabled)
            {
                RefreshTerrainDetailsAsync();
            }
        }