public static MobileParty CreateBanditParty(Clan clan)
        {
            var hero = Helper.CreateHero();

            try
            {
                var nameIndex = (int)Traverse.Create(NameGenerator.Current)
                                .Method("SelectNameIndex", hero, GangLeaderNames(NameGenerator.Current), 0, true, false)
                                .GetValue();
                NameGenerator.Current.AddName(
                    (uint)Traverse.Create(NameGenerator.Current)
                    .Method("CreateNameCode", hero.CharacterObject, GangLeaderNames(NameGenerator.Current), nameIndex)
                    .GetValue());
                var textObject = GangLeaderNames(NameGenerator.Current)[nameIndex].CopyTextObject();
                textObject.SetTextVariable("FIRST_NAME", hero.FirstName);
                StringHelpers.SetCharacterProperties("HERO", hero.CharacterObject, textObject);
                hero.SetName(textObject, hero.FirstName);
            }
            catch (Exception ex)
            {
                Mod.Log(ex);
            }

            hero.Clan = clan;
            var mobileParty = MobileParty.CreateParty("Bandit_Militia", new ModBanditMilitiaPartyComponent(hero), m =>
            {
                m.ActualClan = clan;
            });

            mobileParty.MemberRoster.AddToCounts(hero.CharacterObject, 1, false, 0, 0, true, 0);
            return(mobileParty);
        }
예제 #2
0
        private static MobileParty CreatePartyInstance(Settlement spawnedSettlement, Clan clan, PartyTemplateObject templateObject,
                                                       Track.PartyTypeEnum partyType, TextObject partyName = null)
        {
            if (clan.IsBanditFaction)
            {
                return(BanditPartyComponent.CreateBanditParty(templateObject.StringId + "_" + 1, clan,
                                                              spawnedSettlement.Hideout, false));
            }

            return(MobileParty.CreateParty(templateObject.StringId + "_" + 1, null));
        }