private void ExtendDeadline()
 {
     if (Campaign.Current != null && Campaign.Current.QuestManager != null)
     {
         foreach (QuestBase questBase in Campaign.Current.QuestManager.Quests)
         {
             bool flag2 = questBase.GetName().ToString().StartsWith("stop_conspiracy_") && questBase.QuestDueTime < CampaignTime.DaysFromNow(5f);
             if (flag2)
             {
                 DebugHelpers.ColorGreenMessage("Extending Stop the Conspiracy quest by 1 year.");
                 questBase.ChangeQuestDueTime(CampaignTime.YearsFromNow(1f));
                 DebugHelpers.ColorGreenMessage("New quest deadline: " + questBase.QuestDueTime.ToString());
             }
             bool flag3 = questBase.StringId.StartsWith("conspiracy_quest_") && questBase.QuestDueTime < CampaignTime.DaysFromNow(7f);
             if (flag3)
             {
                 questBase.ChangeQuestDueTime(CampaignTime.WeeksFromNow(3f));
                 DebugHelpers.ColorGreenMessage("BT Extend Conspiracy Tweak: Extended conspiracy quest.");
                 float cStrngth = SecondPhase.Instance.ConspiracyStrength;
                 if (cStrngth > 1000 && cStrngth > 250)
                 {
                     SecondPhase.Instance.DecreaseConspiracyStrength(150);
                     DebugHelpers.ColorGreenMessage("BT Extend Conspiracy Tweak: Reduced conspiracy strength.");
                 }
             }
         }
     }
 }
Ejemplo n.º 2
0
        protected override void OnBeforeInitialModuleScreenSetAsRoot()
        {
            if (harmony == null)
            {
                try
                {
                    harmony = new Harmony("mod.bannerlord.tweaks");
                    harmony.PatchAll();

                    DebugHelpers.ColorOrangeMessage("Bannerlord Tweaks Loaded");
                }
                catch (Exception ex)
                {
                    MessageBox.Show($"Error Initialising Bannerlord Tweaks:\n\n{ex.ToStringFull()}");
                }
            }
        }
 public static void DailyTick()
 {
     foreach (Hero hero in Hero.All)
     {
         if (hero == null)
         {
             return;
         }
         if (hero.PartyBelongedToAsPrisoner == null && hero.IsPrisoner && hero.IsAlive && !hero.IsActive && !hero.IsNotSpawned && !hero.IsReleased)
         {
             float days = hero.CaptivityStartTime.ElapsedDaysUntilNow;
             if (BannerlordTweaksSettings.Instance is { } settings&& (days > (settings.MinimumDaysOfImprisonment + 3)))
             {
                 DebugHelpers.ColorGreenMessage("Releasing " + hero.Name + " due to Missing Hero Bug. (" + (int)days + " days)");
                 DebugHelpers.QuickInformationMessage("Releasing " + hero.Name + " due to Missing Hero Bug. (" + (int)days + " days)");
                 EndCaptivityAction.ApplyByReleasing(hero);
             }
         }
     }
 }