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();
            }
        }
Exemplo n.º 2
0
        public void UpdateCharacterReference(Patch patch, string file, IEnumerable <ValuePair <Model> > npcs)
        {
            var core = patch.AddFile(file);

            var npcById = npcs.ToSoftDictionary(x => x.Default.Id, x => x.Value);

            var refs = new List <BaseRef>();

            core.Binary.VisitAllObjects <BaseRef>((refId, parent) =>
            {
                if (!(parent is HumanoidBodyVariant) && refId.GUID != null && npcById.ContainsKey(refId.GUID))
                {
                    refs.Add(refId);
                }
            });

            if (!refs.Any())
            {
                return;
            }

            foreach (var refId in refs)
            {
                var npc = npcById[refId.GUID];

                refId.Type         = BaseRef.Types.ExternalCoreUUID;
                refId.ExternalFile = npc.Source;
                refId.GUID         = npc.Id;
            }

            core.Save();
        }
Exemplo n.º 3
0
        public static void AddObject <T>(this Patch patch, T obj, string name)
        {
            var json = JsonConvert.SerializeObject(obj, new BaseGGUUIDConverter());

            using var ms = new MemoryStream(Encoding.UTF8.GetBytes(json));
            patch.AddFile(ms, $"{Prefix}{name}");
        }
Exemplo n.º 4
0
        private void RemoveMenuMusic(Patch patch)
        {
            var core = patch.AddFile(IoC.Get <MiscConfig>().MenuMusicFile);

            var param = GetMenuMusicParam(core);

            param.DefaultObject = new Ref <RTTIRefObject>();

            core.Save();
        }
Exemplo n.º 5
0
        private void RemoveIntroLogo(Patch patch)
        {
            var core = patch.AddFile(IoC.Get <MiscConfig>().IntroFile);

            var menu = GetIntroMenu(core);

            menu.PropertyAnimations.Clear();
            menu.Blendtime = 0;

            core.Save();
        }
Exemplo n.º 6
0
        public void CreatePatch(Patch patch, List <Upgrade> upgrades)
        {
            //extract original outfit files to temp
            var core = patch.AddFile(IoC.Get <UpgradeConfig>().UpgradeFile);

            var upgradeChanges = upgrades.ToDictionary(x => x.Id, x => x);

            var invMods = core.GetTypes <InventoryCapacityModificationComponentResource>();

            foreach (var invMod in invMods)
            {
                if (!upgradeChanges.TryGetValue(invMod.ObjectUUID, out var upgrade))
                {
                    continue;
                }

                if (invMod.WeaponsCapacityIncrease > 0)
                {
                    invMod.WeaponsCapacityIncrease = upgrade.Value;
                }
                else if (invMod.ModificationsCapacityIncrease > 0)
                {
                    invMod.ModificationsCapacityIncrease = upgrade.Value;
                }
                else if (invMod.OutfitsCapacityIncrease > 0)
                {
                    invMod.OutfitsCapacityIncrease = upgrade.Value;
                }
                else if (invMod.ResourcesCapacityIncrease > 0)
                {
                    invMod.ResourcesCapacityIncrease = upgrade.Value;
                }
                else if (invMod.ToolsCapacityIncrease > 0)
                {
                    invMod.ToolsCapacityIncrease = upgrade.Value;
                }
            }

            core.Save();
        }