private static void ParentsOnInit(CharacterCreation characterCreation)
        {
            characterCreation.ClearFaceGenMounts();
            characterCreation.ClearFaceGenPrefab();
            FaceGenChar mother;
            FaceGenChar father;

            BodyProperties player = CharacterObject.PlayerCharacter.GetBodyProperties(CharacterObject.PlayerCharacter.Equipment, -1);
            BodyProperties motherBodyProperties = player;
            BodyProperties fatherBodyProperties = player;

            FaceGen.GenerateParentKey(player, ref motherBodyProperties, ref fatherBodyProperties);
            motherBodyProperties = new BodyProperties(new DynamicBodyProperties(33f, 0.3f, 0.2f), motherBodyProperties.StaticProperties);
            fatherBodyProperties = new BodyProperties(new DynamicBodyProperties(33f, 0.5f, 0.5f), fatherBodyProperties.StaticProperties);
            CharacterObject characterObject1 = Game.Current.ObjectManager.GetObject <CharacterObject>("village_woman_empire");
            CharacterObject characterObject2 = Game.Current.ObjectManager.GetObject <CharacterObject>("townsman_empire");

            mother = new FaceGenChar(motherBodyProperties, characterObject1.Equipment, true, "anim_mother_1");
            father = new FaceGenChar(fatherBodyProperties, characterObject2.Equipment, false, "anim_father_1");

            CharacterCreation  characterCreation1 = characterCreation;
            List <FaceGenChar> faceGenCharList    = new List <FaceGenChar>();

            faceGenCharList.Add(mother);
            faceGenCharList.Add(father);
            characterCreation1.ChangeFaceGenChars(faceGenCharList);
            ChangeParentsOutfit(characterCreation);
            ChangeParentsAnimation(characterCreation);
        }
Exemplo n.º 2
0
        private void FillFrom(BasicCharacterObject character, int seed = -1)
        {
            if (_teamConfig != null)
            {
                Character.ArmorColor1    = _teamConfig.Color1;
                Character.ArmorColor2    = _teamConfig.Color2;
                Character.BannerCodeText = _teamConfig.BannerKey;
            }
            else
            {
                Character.ArmorColor1    = 0;
                Character.ArmorColor2    = 0;
                Character.BannerCodeText = "";
            }
            Character.CharStringId = character.StringId;
            Character.IsFemale     = _config.FemaleRatio > 0.5;
            var equipment = character.Equipment;

            Character.EquipmentCode  = equipment.CalculateEquipmentCode();
            Character.BodyProperties = null;
            Character.BodyProperties = FaceGen.GetRandomBodyProperties(_config.FemaleRatio > 0.5,
                                                                       character.GetBodyPropertiesMin(false), character.GetBodyPropertiesMax(),
                                                                       (int)equipment.HairCoverType, seed, character.HairTags, character.BeardTags,
                                                                       character.TattooTags).ToString();
            Character.MountCreationKey =
                MountCreationKey.GetRandomMountKey(equipment[10].Item, Common.GetDJB2(character.StringId));
        }
        private static void BranchsOnInit(CharacterCreation characterCreation)
        {
            //Init
            List <FaceGenChar> list           = new List <FaceGenChar>();
            BodyProperties     bodyProperties = CharacterObject.PlayerCharacter.GetBodyProperties(CharacterObject.PlayerCharacter.Equipment, -1);

            bodyProperties = FaceGen.GetBodyPropertiesWithAge(ref bodyProperties, 23f);
            list.Add(new FaceGenChar(bodyProperties, CharacterObject.PlayerCharacter.Equipment, CharacterObject.PlayerCharacter.IsFemale, "act_childhood_schooled"));
            characterCreation.ChangeFaceGenChars(list);
            //Doing this to add menus late to allow previous selections to work. But have to make sure it's not already added. No good way in menu class so forced to use text
            TextObject backstory;
            TextObject backstory2;

            backstory  = new TextObject("{=jg3T5AyE}Like many families in Calradia, your life was upended by war. Your home was ravaged by the passage of army after army. Eventually, you sold your property and set off with your father, mother, brother, and your two younger siblings to a new town you'd heard was safer. But you did not make it. Along the way, the inn at which you were staying was attacked by raiders. Your parents were slain and your two youngest siblings seized, but you and your brother survived because...", null);
            backstory2 = new TextObject("{=jg3T5AyE} During your journies you were ambushed by raiders you survived because...", null);

            List <CharacterCreationMenu> CurMenus = (List <CharacterCreationMenu>)AccessTools.Field(typeof(CharacterCreation), "CharacterCreationMenu").GetValue(characterCreation);
            bool loaded = false;

            foreach (CharacterCreationMenu x in CurMenus)
            {
                if (x.Text.ToString() == backstory.ToString() || x.Text.ToString() == backstory2.ToString())
                {
                    loaded = true;
                    break;
                }
            }
            ;
            if (!loaded)
            {
                CharacterCreationContent.Instance.GetType().GetMethod("AddEscapeMenu", BindingFlags.NonPublic | BindingFlags.Static).Invoke(CharacterCreationContent.Instance, new object[] { characterCreation });
            }
        }
Exemplo n.º 4
0
 public void FillFrom(Hero hero, int seed = -1)
 {
     if (FaceGen.GetMaturityTypeWithAge(hero.Age) > BodyMeshMaturityType.Child)
     {
         this._hero          = hero;
         this.isNonEquipment = false;
         base.FillFrom(hero.CharacterObject, seed);
         base.MountCreationKey = TaleWorlds.Core.MountCreationKey.GetRandomMountKey(hero.CharacterObject.Equipment[10].Item, hero.CharacterObject.GetMountKeySeed());
         this.IsDead           = hero.IsDead;
         if (hero.Noncombatant)
         {
             Equipment expr_69 = hero.CivilianEquipment;
             this._equipment = ((expr_69 != null) ? expr_69.Clone(false) : null);
         }
         else
         {
             Equipment expr_84 = hero.BattleEquipment;
             this._equipment = ((expr_84 != null) ? expr_84.Clone(false) : null);
         }
         Equipment expr_9D = this._equipment;
         base.EquipmentCode = ((expr_9D != null) ? expr_9D.CalculateEquipmentCode() : null);
         if (((hero != null) ? hero.ClanBanner : null) != null)
         {
             base.BannerCodeText = BannerCode.CreateFrom(hero.ClanBanner).Code;
         }
         IFaction expr_D9 = hero.MapFaction;
         base.ArmorColor1 = ((expr_D9 != null) ? expr_D9.Color : 0u);
         IFaction expr_F1 = hero.MapFaction;
         base.ArmorColor2 = ((expr_F1 != null) ? expr_F1.Color2 : 0u);
     }
 }
Exemplo n.º 5
0
      private static void EscapeOnInit(CharacterCreation characterCreation)   //Different from Base
      {
          //Use these to get private fields
          FaceGenChar mother = (FaceGenChar)CharacterCreationContent.Instance.GetType().GetField("_mother", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(CharacterCreationContent.Instance);
          FaceGenChar father = (FaceGenChar)CharacterCreationContent.Instance.GetType().GetField("_father", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(CharacterCreationContent.Instance);

          characterCreation.CurrentStage = CharacterCreation.Stages.EscapeMenu;
          characterCreation.ClearFaceGenPrefab();
          ClearCharacters(characterCreation);
          ClearMountEntity(characterCreation);
          Hero @object                      = MBObjectManager.Instance.GetObject <Hero>("tutorial_npc_brother");
          List <FaceGenChar> list           = new List <FaceGenChar>();
          BodyProperties     bodyProperties = CharacterObject.PlayerCharacter.GetBodyProperties(CharacterObject.PlayerCharacter.Equipment, -1);

          bodyProperties = FaceGen.GetBodyPropertiesWithAge(ref bodyProperties, 23f);
          BodyProperties randomBodyProperties = BodyProperties.GetRandomBodyProperties(CharacterObject.PlayerCharacter.IsFemale, mother.BodyProperties, father.BodyProperties, 1, Hero.MainHero.Mother.CharacterObject.GetDefaultFaceSeed(1), Hero.MainHero.Father.CharacterObject.HairTags, Hero.MainHero.Father.CharacterObject.BeardTags, Hero.MainHero.Father.CharacterObject.TattooTags);

          randomBodyProperties = new BodyProperties(new DynamicBodyProperties(randomBodyProperties.Age, 0.5f, 0.5f), randomBodyProperties.StaticProperties);
          @object.ModifyPlayersFamilyAppearance(randomBodyProperties.StaticProperties);
          @object.DynamicBodyProperties = randomBodyProperties.DynamicProperties;
          list.Add(new FaceGenChar(bodyProperties, new Equipment(), CharacterObject.PlayerCharacter.IsFemale, "act_childhood_schooled"));
          //
          if (CSCharCreationOption.CSWithFamily)
          {
              list.Add(new FaceGenChar(@object.BodyProperties, new Equipment(), @object.CharacterObject.IsFemale, "act_brotherhood_schooled"));
              characterCreation.ChangeFaceGenChars(list);
              characterCreation.ChangeCharsAnimation(new List <string>
                {
                    "act_childhood_schooled",
                    "act_brotherhood_schooled"
                });
          }
          else
          {
              characterCreation.ChangeFaceGenChars(list);
              characterCreation.ChangeCharsAnimation(new List <string>
                {
                    "act_childhood_schooled",
                });
          }

          //CharacterCreationContent.Instance.GetType().GetMethod("ChangeStoryStageEquipments", BindingFlags.NonPublic | BindingFlags.Static).Invoke(CharacterCreationContent.Instance, new object[] { characterCreation }); **Cant invoke due to Hardcoded change brother
          ChangeStoryStageEquipments(characterCreation);
          List <FaceGenMount> list2 = new List <FaceGenMount>();

          if (CharacterObject.PlayerCharacter.HasMount())
          {
              ItemObject item = CharacterObject.PlayerCharacter.Equipment[EquipmentIndex.ArmorItemEndSlot].Item;
              list2.Add(new FaceGenMount(MountCreationKey.FromString(MountCreationKey.GetRandomMountKey(item, 2)), CharacterObject.PlayerCharacter.Equipment[EquipmentIndex.ArmorItemEndSlot].Item, CharacterObject.PlayerCharacter.Equipment[EquipmentIndex.HorseHarness].Item, "act_inventory_idle_start"));
          }
          if (@object.CharacterObject.HasMount())
          {
              ItemObject item2 = @object.CharacterObject.Equipment[EquipmentIndex.ArmorItemEndSlot].Item;
              list2.Add(new FaceGenMount(MountCreationKey.FromString(MountCreationKey.GetRandomMountKey(item2, 2)), @object.CharacterObject.Equipment[EquipmentIndex.ArmorItemEndSlot].Item, @object.CharacterObject.Equipment[EquipmentIndex.HorseHarness].Item, "act_inventory_idle_start"));
          }
      }
Exemplo n.º 6
0
 public void FillFrom(BodyProperties bodyProperties, Equipment equipment, CultureObject culture, bool isFemale = false)
 {
     if (FaceGen.GetMaturityTypeWithAge(bodyProperties.Age) > BodyMeshMaturityType.Child)
     {
         if (culture != null)
         {
             this.ArmorColor1 = culture.Color;
             this.ArmorColor2 = culture.Color2;
         }
         //this.CharStringId = character.StringId;
         this.IsFemale = isFemale;
         FillEquipment(bodyProperties, equipment);
     }
 }
Exemplo n.º 7
0
        public void FillFrom(CharacterObject character, int seed = -1)
        {
            if (FaceGen.GetMaturityTypeWithAge(character.Age) > BodyMeshMaturityType.Child)
            {
                this._character = character;

                if (character.Culture != null)
                {
                    this.ArmorColor1 = character.Culture.Color;
                    this.ArmorColor2 = character.Culture.Color2;
                }
                this.CharStringId = character.StringId;
                this.IsFemale     = character.IsFemale;

                ChangeClothesBySelectedIndex();
            }
        }
Exemplo n.º 8
0
 //Lazy just adding all the methods for default patch to make compiler happy
 public static BodyProperties GetRandomBodyProperties(bool isFemale, BodyProperties bodyPropertiesMin, BodyProperties bodyPropertiesMax, int hairCoverType, int seed, string hairTags, string beardTags, string tattooTags)
 {
     return(FaceGen.GetRandomBodyProperties(isFemale, bodyPropertiesMin, bodyPropertiesMax, hairCoverType, seed, hairTags, beardTags, tattooTags));
 }