// Token: 0x0600001D RID: 29 RVA: 0x00003474 File Offset: 0x00001674 public void CreateCompanion(CharacterObject companionTemplate) { bool flag = companionTemplate == null; if (!flag) { Settlement settlement3 = (from settlement in Settlement.All where settlement.Culture == companionTemplate.Culture && settlement.IsTown select settlement).GetRandomElement <Settlement>(); List <Settlement> list = new List <Settlement>(); foreach (Settlement settlement4 in Settlement.All) { bool flag2 = settlement4.IsVillage && Campaign.Current.Models.MapDistanceModel.GetDistance(settlement4, settlement3) < 30f; if (flag2) { list.Add(settlement4); } } settlement3 = ((list.Any <Settlement>() ? list.GetRandomElement <Settlement>().Village.Bound : settlement3) ?? Settlement.All.GetRandomElement <Settlement>()); Hero hero = HeroCreator.CreateSpecialHero(companionTemplate, settlement3, null, null, Campaign.Current.Models.AgeModel.HeroComesOfAge + 5 + MBRandom.RandomInt(27)); Campaign.Current.GetCampaignBehavior <IHeroCreationCampaignBehavior>().DeriveSkillsFromTraits(hero, companionTemplate); CharacterObject template = hero.Template; bool flag3 = ((template != null) ? template.HeroObject : null) != null && hero.Template.HeroObject.Clan != null && hero.Template.HeroObject.Clan.IsMinorFaction; if (flag3) { hero.SupporterOf = hero.Template.HeroObject.Clan; } else { hero.SupporterOf = HeroHelper.GetRandomClanForNotable(hero); } CampaignEventDispatcher.Instance.OnHeroCreated(hero, false); this._companions.Add(hero); } }