private void ReadValueSection(BinaryReader reader, ObservableCollection <CharacterCustomizationAppearances.ValueEntry> collection, int count)
 {
     for (int i = 0; i < count; i++)
     {
         var entry = new CharacterCustomizationAppearances.ValueEntry();
         entry.FirstString   = reader.ReadPackedString();
         entry.SecondString  = reader.ReadPackedString();
         entry.TrailingBytes = reader.ReadBytes(8);
         collection.Add(entry);
     }
 }
        private List <CharacterCustomizationAppearances.ValueEntry> ReadValueSection(BinaryReader reader, int count)
        {
            var result = new List <CharacterCustomizationAppearances.ValueEntry>();

            for (int i = 0; i < count; i++)
            {
                var entry = new CharacterCustomizationAppearances.ValueEntry();
                entry.FirstString   = ParserUtils.ReadString(reader);
                entry.SecondString  = ParserUtils.ReadString(reader);
                entry.TrailingBytes = reader.ReadBytes(8);
                result.Add(entry);
            }
            return(result);
        }
示例#3
0
        public void SetFacialValue(string fieldName, int fieldNum, int value)
        {
            var entries = GetEntries("first.additional." + fieldName);

            if (entries.Count < 1)
            {
                var newEntry = new CharacterCustomizationAppearances.ValueEntry();
                newEntry.FirstString  = fieldName;
                newEntry.SecondString = "h000";

                CreateEntry(newEntry, new[] { "TPP", "character_customization" }, MainSections[0]);
                SetFacialValue(fieldName, fieldNum, value);
            }
            else
            {
                if (value == 1)
                {
                    foreach (CharacterCustomizationAppearances.ValueEntry entry in entries)
                    {
                        RemoveEntry(entry);
                    }
                }
                else
                {
                    foreach (CharacterCustomizationAppearances.ValueEntry entry in entries)
                    {
                        var finalValue = value;
                        if (fieldName == "nose" && BodyGender == AppearanceGender.Female)
                        {
                            //Those are some fine spaghetti values ya got there CDPR.
                            if (finalValue > 11 && finalValue < 17)
                            {
                                finalValue++;
                            }
                            else if (finalValue == 17)
                            {
                                finalValue = 12;
                            }
                        }
                        finalValue--;
                        entry.SecondString = "h" + finalValue.ToString("00") + fieldNum.ToString();
                    }
                }
            }
        }