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(); } }
private string GetModelName(StreamingRef <HumanoidBodyVariant> model) { var source = model.ExternalFile.ToString(); var key = "playercostume_"; var idx = source.LastIndexOf(key); return(idx < 0 ? source : source.Substring(idx + key.Length)); }