Пример #1
0
 static bool Prefix(ClanVM __instance)
 {
     try
     {
         if (Clan.PlayerClan.IsUnderMercenaryService)
         {
             InformationManager.ShowInquiry(new InquiryData("Ending Mercenary Contract",
                                                            $"Your mercenary contract will end and you will no longer be affiliated with {Clan.PlayerClan.Kingdom.Name.ToString()}.",
                                                            true, true, new TextObject("{=5Unqsx3N}Confirm").ToString(),
                                                            GameTexts.FindText("str_cancel").ToString(),
                                                            () =>
             {
                 ChangeKingdomAction.ApplyByLeaveKingdomAsMercenaryForNoPayment(Clan.PlayerClan, Clan.PlayerClan.Kingdom);
                 __instance.ClanIsInAKingdom = (Clan.PlayerClan.Kingdom != null);
                 __instance.UpdateBannerVisuals();
             },
                                                            null));
             return(false);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show($"An error occurred in the leaving Kingdom as mercenary fix:\n\n{ex.ToStringFull()}");
     }
     return(true);
 }
Пример #2
0
        public RecruiterHook(UIContext context) : base(context)
        {
            if (ScreenManager.TopScreen is GauntletClanScreen)
            {
                GauntletClanScreen screen = (GauntletClanScreen)ScreenManager.TopScreen;
                ClanVM             clanVM = (ClanVM)screen.GetField("_dataSource");

                foreach (PartyBase recruiter in Hero.MainHero.OwnedParties.Where(party => party.Name.ToString().EndsWith("Recruiter")))
                {
                    ClanPartyItemVM partyItem = new ClanPartyItemVM(recruiter, null, null);
                    partyItem.PartyLocationText = "Travelling to " + recruiter.MobileParty.TargetSettlement;
                    partyItem.PartyMoraleText   = recruiter.MobileParty.PartyTradeGold + "G";
                    clanVM.ClanParties.Garrisons.Add(partyItem);
                }
            }
        }