/// <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 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> /// 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") }); }
public static void InitMod(bool bedSleeping, bool archery, bool riding, bool encumbrance, bool bandaging, bool shipPorts, bool expulsion, bool climbing, bool weaponSpeed, bool weaponMaterials, bool equipDamage, bool enemyAppearance, bool purifyPot, bool autoExtinguishLight, bool classicStrDmgBonus, bool variantNpcs) { Debug.Log("Begin mod init: RoleplayRealism"); Mod rrItemsMod = ModManager.Instance.GetMod("RoleplayRealismItems"); ModSettings rrItemsSettings = rrItemsMod != null?rrItemsMod.GetSettings() : null; if (bedSleeping) { PlayerActivate.RegisterCustomActivation(mod, 41000, BedActivation); PlayerActivate.RegisterCustomActivation(mod, 41001, BedActivation); PlayerActivate.RegisterCustomActivation(mod, 41002, BedActivation); } if (archery) { // Override adjust to hit and damage formulas FormulaHelper.RegisterOverride(mod, "AdjustWeaponHitChanceMod", (Func <DaggerfallEntity, DaggerfallEntity, int, int, DaggerfallUnityItem, int>)AdjustWeaponHitChanceMod); FormulaHelper.RegisterOverride(mod, "AdjustWeaponAttackDamage", (Func <DaggerfallEntity, DaggerfallEntity, int, int, DaggerfallUnityItem, int>)AdjustWeaponAttackDamage); } if (riding) { GameObject playerAdvGO = GameObject.Find("PlayerAdvanced"); if (playerAdvGO) { EnhancedRiding enhancedRiding = playerAdvGO.AddComponent <EnhancedRiding>(); if (enhancedRiding != null) { enhancedRiding.RealisticMovement = mod.GetSettings().GetBool("EnhancedRiding", "RealisticMovement"); enhancedRiding.TerrainFollowing = mod.GetSettings().GetBool("EnhancedRiding", "followTerrainEnabled"); enhancedRiding.SetFollowTerrainSoftenFactor(mod.GetSettings().GetInt("EnhancedRiding", "followTerrainSoftenFactor")); } } } if (encumbrance) { EntityEffectBroker.OnNewMagicRound += EncumbranceEffects_OnNewMagicRound; } if (rrItemsMod == null && bandaging) { DaggerfallUnity.Instance.ItemHelper.RegisterItemUseHandler((int)UselessItems2.Bandage, UseBandage); } if (shipPorts) { GameManager.Instance.TransportManager.ShipAvailiable = IsShipAvailiable; } if (expulsion) { // Register the TG/DB Guild classes if (!GuildManager.RegisterCustomGuild(FactionFile.GuildGroups.GeneralPopulace, typeof(ThievesGuildRR))) { throw new Exception("GuildGroup GeneralPopulace is already overridden, unable to register ThievesGuildRR guild class."); } if (!GuildManager.RegisterCustomGuild(FactionFile.GuildGroups.DarkBrotherHood, typeof(DarkBrotherhoodRR))) { throw new Exception("GuildGroup DarkBrotherHood is already overridden, unable to register DarkBrotherhoodRR guild class."); } } if (climbing) { FormulaHelper.RegisterOverride(mod, "CalculateClimbingChance", (Func <PlayerEntity, int, int>)CalculateClimbingChance); } if (weaponSpeed && (rrItemsSettings == null || !rrItemsSettings.GetBool("Modules", "weaponBalance"))) { FormulaHelper.RegisterOverride(mod, "GetMeleeWeaponAnimTime", (Func <PlayerEntity, WeaponTypes, ItemHands, float>)GetMeleeWeaponAnimTime); } if (weaponMaterials) { FormulaHelper.RegisterOverride(mod, "CalculateWeaponToHit", (Func <DaggerfallUnityItem, int>)CalculateWeaponToHit); } if (equipDamage) { FormulaHelper.RegisterOverride(mod, "ApplyConditionDamageThroughPhysicalHit", (Func <DaggerfallUnityItem, DaggerfallEntity, int, bool>)ApplyConditionDamageThroughPhysicalHit); } if (enemyAppearance) { UpdateEnemyClassAppearances(); } if (purifyPot) { GameManager.Instance.EntityEffectBroker.RegisterEffectTemplate(new CureDiseaseRR(), true); } if (autoExtinguishLight) { PlayerEnterExit.OnTransitionDungeonExterior += OnTransitionToDungeonExterior_ExtinguishLight; } if (classicStrDmgBonus) { FormulaHelper.RegisterOverride(mod, "DamageModifier", (Func <int, int>)DamageModifier_classicDisplay); } if (variantNpcs) { PlayerEnterExit.OnTransitionInterior += OnTransitionToInterior_VariantNPCsprites; } // Initialise the FG master quest. if (!QuestListsManager.RegisterQuestList("RoleplayRealism")) { throw new Exception("Quest list name is already in use, unable to register RoleplayRealism quest list."); } RegisterFactionIds(); // Add additional data into the quest machine for the quests QuestMachine questMachine = GameManager.Instance.QuestMachine; questMachine.PlacesTable.AddIntoTable(placesTable); questMachine.FactionsTable.AddIntoTable(factionsTable); // Register the custom armor service Services.RegisterMerchantService(1022, CustomArmorService, "Custom Armor"); Debug.Log("Finished mod init: RoleplayRealism"); }
void Awake() { ModSettings settings = mod.GetSettings(); bool bedSleeping = settings.GetBool("Modules", "bedSleeping"); bool archery = settings.GetBool("Modules", "advancedArchery"); bool riding = settings.GetBool("Modules", "enhancedRiding"); 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"); InitMod(bedSleeping, archery, riding, encumbrance, bandaging, shipPorts, expulsion, climbing, weaponSpeed, weaponMaterials, equipDamage, enemyAppearance, purifyPot, autoExtinguishLight, classicStrDmgBonus, variantNpcs); mod.IsReady = true; }
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; }
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(); } }
public static void InitMod() { Debug.Log("Begin mod init: Archaeologists"); ModSettings settings = mod.GetSettings(); RestrictGuildRankMagesGuild = settings.GetBool("General", "RestrictGuildRankMagesGuild"); bool overridePacification = settings.GetBool("General", "OverridePacification"); // Register the new faction id's if (RegisterFactionIds()) { // Register the Guild class if (!GuildManager.RegisterCustomGuild(FactionFile.GuildGroups.GGroup0, typeof(ArchaeologistsGuild))) { throw new Exception("GuildGroup GGroup0 is already in use, unable to register Archaeologists Guild."); } // Register the quest list if (!QuestListsManager.RegisterQuestList("Archaeologists")) { throw new Exception("Quest list name is already in use, unable to register Archaeologists quest list."); } // Register the quest service id Services.RegisterGuildService(1000, GuildServices.Quests); // Register the custom locator service Services.RegisterGuildService(1001, ArchaeologistsGuild.LocatorService, "Locator Devices"); // Register the custom locator item DaggerfallUnity.Instance.ItemHelper.RegisterCustomItem(LocatorItem.templateIndex, ItemGroups.MiscItems, typeof(LocatorItem)); // Register the daedra summoning service Services.RegisterGuildService(1002, GuildServices.DaedraSummoning); // Register the custom repair service for teleport mark Services.RegisterGuildService(1003, ArchaeologistsGuild.RepairMarkService, "Repair Recall Mark"); // Register the training service id Services.RegisterGuildService(1004, GuildServices.Training); // Register the indentification service id Services.RegisterGuildService(1005, GuildServices.Identify); // Register the buy potions service id Services.RegisterGuildService(1006, GuildServices.BuyPotions); // Register the make potions service id Services.RegisterGuildService(1007, GuildServices.MakePotions); // Register the make potions service id Services.RegisterGuildService(1008, GuildServices.MakeMagicItems); // Register the Teleport potion GameManager.Instance.EntityEffectBroker.RegisterEffectTemplate(new TeleportPotion(), true); } else { throw new Exception("Faction id's are already in use, unable to register factions for Archaeologists Guild."); } // Override default formula if enabled in settings if (overridePacification) { FormulaHelper.RegisterOverride(mod, "CalculateEnemyPacification", (Func <PlayerEntity, DFCareer.Skills, bool>)CalculateEnemyPacification); } // Add locator device object to scene and attach script GameObject go = new GameObject("LocatorDevice"); go.AddComponent <LocatorDevice>(); Debug.Log("Finished mod init: Archaeologists"); }
static private bool IsEnabled(ModSettings settings, string section) { return(settings.GetBool(section, "Enabled")); }
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(); } }
void Awake() { ModSettings settings = mod.GetSettings(); bool bedSleeping = settings.GetBool("Modules", "bedSleeping"); bool archery = settings.GetBool("Modules", "advancedArchery"); bool riding = settings.GetBool("Modules", "enhancedRiding"); 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 equipDamage = settings.GetBool("Modules", "equipDamage"); bool enemyAppearance = settings.GetBool("Modules", "enemyAppearance"); InitMod(bedSleeping, archery, riding, encumbrance, bandaging, shipPorts, expulsion, climbing, weaponSpeed, equipDamage, enemyAppearance); mod.IsReady = true; }