static void Finalizer(Exception __exception) { if (__exception != null) { GrowthDebug.ShowError($"Mount and Blade Bannerlord has encountered an error and needs to close. See the error information below.", "Mount and Blade Bannerlord has crashed", __exception); } }
public static void Inherit(Hero targetInheriter) { if (targetInheriter == null) { return; } try { GrowthDebug.LogInfo($"Enter inherit method, handling inherit of {targetInheriter}"); targetInheriter.ClearSkills(); targetInheriter.HeroDeveloper.ClearHeroLevel(); int fatherInheritDivider = 0; int motherInheritDivider = 0; if (targetInheriter.IsFemale == true) { fatherInheritDivider = 10; motherInheritDivider = 5; } else { fatherInheritDivider = 5; motherInheritDivider = 10; } foreach (SkillObject skillIT in DefaultSkills.GetAllSkills()) { Hero InheritFather = targetInheriter.Father != null ? targetInheriter.Father : targetInheriter; Hero InheritMother = targetInheriter.Mother != null ? targetInheriter.Mother : targetInheriter; targetInheriter.HeroDeveloper.ChangeSkillLevel(skillIT, InheritFather.GetSkillValue(skillIT) / fatherInheritDivider + InheritMother.GetSkillValue(skillIT) / motherInheritDivider, false); } targetInheriter.Level = 0; targetInheriter.HeroDeveloper.UnspentFocusPoints = 10; targetInheriter.HeroDeveloper.UnspentAttributePoints = 10; } catch (Exception e) { GrowthDebug.ShowError($"Error during inheritance", "Error During Inheritance", e); } }
protected override void OnSubModuleLoad() { base.OnSubModuleLoad(); try { Harmony harmony = new Harmony("mod.growupandwork.kleinersilver"); harmony.PatchAll(); // GrowthDebug.LogInfo("Mod Loaded"); // GrowthDebug.LogInfo($"Current Language: {BannerlordConfig.Language}"); // CommunityPatchSubModule.Print("abc"); Module.CurrentModule.GlobalTextManager.LoadGameTexts($"{BasePath.Name}/Modules/{ModuleFolderName}/ModuleData/module_strings.xml"); } catch (Exception e) { GrowthDebug.ShowError($"An error occured whilst initializing the GrowUpAndWork", "Error during initialization", e); } }
protected override void OnGameStart(Game game, IGameStarter gameStarterObject) { if (gameStarterObject == null) { return; } try { base.OnGameStart(game, gameStarterObject); if (!(game.GameType is Campaign)) { return; } CampaignGameStarter gameInitializer = (CampaignGameStarter)gameStarterObject; gameInitializer.AddBehavior(GrowUpAndWorkAgingCampaignBehavior.Instance); } catch (Exception e) { GrowthDebug.ShowError($"An error occured whilst game starting initializing the GrowUpAndWork", "Game Starting GrowUpAndWork Error", e); } }