internal static void Trash(MobileParty mobileParty) { Mod.Log("Trashing " + mobileParty.Name); PartyMilitiaMap.Remove(mobileParty); // added as workaround/fix for issue seen in 1.5.9 where TroopRoster.Count is wrong and TroopRoster.Clear() throws Traverse.Create(mobileParty.MemberRoster).Field <int>("_count").Value = mobileParty.MemberRoster.GetTroopRoster().Count(x => x.Character != null); mobileParty.MemberRoster.UpdateVersion(); mobileParty.RemoveParty(); }
private static void OnMilitiaRemoved(PartyBase partyBase) { if (!IsBM(partyBase.MobileParty)) { return; } Mod.Log($">>> OnMilitiaRemoved - {partyBase.Name}."); if (partyBase.MobileParty.LeaderHero?.CurrentSettlement != null) { Traverse.Create(HeroesWithoutParty(partyBase.MobileParty.LeaderHero?.CurrentSettlement)).Field <List <Hero> >("_list").Value.Remove(partyBase.MobileParty.LeaderHero); Mod.Log($">>> FLUSH OnMilitiaRemoved bandit hero without party - {partyBase.MobileParty.LeaderHero.Name} at {partyBase.MobileParty.LeaderHero?.CurrentSettlement}."); } PartyMilitiaMap.Remove(partyBase.MobileParty); }
private static void OnPartyRemoved(PartyBase party) { PartyMilitiaMap.Remove(party.MobileParty); }