private void AddVariantReferences(Patch patch, List <OutfitDetail> outfits)
        {
            //Add the new variant references to player components
            var pcCore   = patch.AddFile(IoC.Get <OutfitConfig>().PlayerComponentsFile);
            var variants = OutfitsGenerator.GetPlayerModels(pcCore);

            var refs = variants.Select(x => x.GUID).ToHashSet();

            foreach (var outfit in outfits.Where(x => x.Modified))
            {
                if (!refs.Add(outfit.VariantId))
                {
                    continue;
                }

                var sRef = new StreamingRef <HumanoidBodyVariant>
                {
                    ExternalFile = new BaseString(outfit.Model.Source),
                    Type         = BaseRef.Types.StreamingRef,
                    GUID         = BaseGGUUID.FromOther(outfit.VariantId)
                };

                variants.Add(sRef);

                pcCore.Save();
            }
        }
 public void ReadSave(SaveState state)
 {
     if (state.SaveVersion > 15)
     {
         UnknownSaveGUID = state.ReadIndexedGUID();
     }
 }
        public async Task <string> GetString(string file, BaseGGUUID id)
        {
            if (!_cache.TryGetValue(file, out var texts))
            {
                await _lock.WaitAsync();

                try
                {
                    if (!_cache.TryGetValue(file, out texts))
                    {
                        texts = await LoadFile(file);

                        _cache[file] = texts;
                    }
                }
                finally
                {
                    _lock.Release();
                }
            }

            if (texts.TryGetValue(id, out var val))
            {
                return(val);
            }
            return(null);
        }
        public void ReadSave(SaveState state)
        {
            if (state.SaveVersion < 26)
            {
                int count = state.ReadVariableLengthOffset();

                OverlayBitmapData = state.Reader.ReadBytesStrict(count);
            }
            else
            {
                OverlayBitmapData = new byte[65536];

                for (int offset = 0; offset < OverlayBitmapData.Length;)
                {
                    int  size       = state.ReadVariableLengthInt();
                    byte visibility = state.Reader.ReadByte();

                    for (int i = offset; i < (offset + size); i++)
                    {
                        OverlayBitmapData[i] = visibility;
                    }

                    offset += size;
                }
            }

            bool unknown = state.Reader.ReadBooleanStrict();

            if (unknown)
            {
                UnknownData = state.Reader.ReadBytesStrict(24);
                UnknownGUID = state.ReadIndexedGUID();
            }
        }
Esempio n. 5
0
 public Upgrade Clone()
 {
     return(new Upgrade()
     {
         Id = BaseGGUUID.FromOther(Id),
         Name = Name,
         Value = Value,
         LocalNameId = BaseGGUUID.FromOther(LocalNameId),
         LocalNameFile = LocalNameFile
     });
 }
Esempio n. 6
0
 public Outfit Clone()
 {
     return(new Outfit()
     {
         ModelId = BaseGGUUID.FromOther(ModelId),
         ModelFile = ModelFile,
         Name = Name,
         RefId = BaseGGUUID.FromOther(RefId),
         SourceFile = SourceFile,
         LocalName = LocalName
     });
 }
        public static RTTIRefObject GetTypeById(this HzdCore core, BaseGGUUID id)
        {
            foreach (var obj in core.Binary)
            {
                if (obj is RTTIRefObject refObj && refObj.ObjectUUID.Equals(id))
                {
                    return(refObj);
                }
            }

            return(null);
        }
Esempio n. 8
0
        public static StreamHandle FromData(BinaryReader reader)
        {
            var  handle       = new StreamHandle();
            uint stringLength = reader.ReadUInt32();

            if (stringLength > 0)
            {
                handle.ResourcePath = Encoding.UTF8.GetString(reader.ReadBytesStrict(stringLength));
            }

            handle.ResourceUUID = BaseGGUUID.FromData(reader);
            handle.Unknown1     = reader.ReadUInt32();
            handle.Unknown2     = reader.ReadUInt32();
            handle.Unknown3     = reader.ReadUInt32();

            return(handle);
        }
Esempio n. 9
0
 public GGUUID(BaseGGUUID value) : base(value)
 {
 }
Esempio n. 10
0
 public LocalString(string file, BaseGGUUID id)
 {
     File = file;
     Id   = BaseGGUUID.FromOther(id);
 }