Beispiel #1
0
        private static void InstallBorger()
        {
            var endGame3F = MERFileSystem.GetPackageFile("BioP_EndGm3.pcc");

            if (endGame3F != null && File.Exists(endGame3F))
            {
                var biopEndGm3 = MEPackageHandler.OpenMEPackage(endGame3F);

                var packageBin    = MERUtilities.GetEmbeddedStaticFilesBinaryFile("Delux2go_Edmonton_Burger.pcc");
                var burgerPackage = MEPackageHandler.OpenMEPackageFromStream(new MemoryStream(packageBin));

                // 1. Add the burger package
                var burgerMDL = PackageTools.PortExportIntoPackage(biopEndGm3, burgerPackage.FindExport("Edmonton_Burger_Delux2go.Burger_MDL"));

                // 2. Link up the textures
                TFCBuilder.RandomizeExport(biopEndGm3.FindExport("Edmonton_Burger_Delux2go.Textures.Burger_Diff"), null);
                TFCBuilder.RandomizeExport(biopEndGm3.FindExport("Edmonton_Burger_Delux2go.Textures.Burger_Norm"), null);
                TFCBuilder.RandomizeExport(biopEndGm3.FindExport("Edmonton_Burger_Delux2go.Textures.Burger_Spec"), null);

                // 3. Convert the collector base into lunch or possibly early dinner
                // It's early dinner cause that thing will keep you full all night long
                biopEndGm3.GetUExport(11276).WriteProperty(new ObjectProperty(burgerMDL.UIndex, "SkeletalMesh"));
                biopEndGm3.GetUExport(11282).WriteProperty(new ObjectProperty(burgerMDL.UIndex, "SkeletalMesh"));
                MERFileSystem.SavePackage(biopEndGm3);
            }
        }
        private static void ChangePrisonerNames()
        {
            InstallName(342079);                                        // Prisoner 780
            InstallName(342078);                                        // Prisoner 403
            var didPrisoner = InstallName(BeatPrisonerTLKID) != 0;      // Beat Prisoner
            var didGuard    = InstallName(BeatPrisonerGuardTLKID) != 0; // Beating Guard

            if (didGuard && didPrisoner)
            {
                // Make it so the beating scene shows names
                var cellBLock3F = MERFileSystem.GetPackageFile("BioD_PrsCvA_103CellBlock03.pcc");
                if (cellBLock3F != null)
                {
                    var cellBlock3P = MEPackageHandler.OpenMEPackage(cellBLock3F);

                    // Clone the turianguard pawn type so we can change the name, maybe something else if we want
                    var newGuardBPCST = EntryCloner.CloneTree(cellBlock3P.GetUExport(701), true);
                    newGuardBPCST.ObjectName = "MER_NamedBeatGuard";
                    newGuardBPCST.WriteProperty(new StringRefProperty(BeatPrisonerGuardTLKID, "ActorGameNameStrRef"));
                    cellBlock3P.GetUExport(668).WriteProperty(new ObjectProperty(newGuardBPCST, "ActorType"));

                    // Change shown name for the prisoner
                    cellBlock3P.GetUExport(699).WriteProperty(new StringRefProperty(BeatPrisonerTLKID, "ActorGameNameStrRef"));

                    // Make the two people 'selectable' so they show up with names
                    cellBlock3P.GetUExport(682).RemoveProperty("m_bTargetableOverride"); // guard
                    cellBlock3P.GetUExport(677).RemoveProperty("m_bTargetableOverride"); // prisoner

                    MERFileSystem.SavePackage(cellBlock3P);
                }
            }
        }
Beispiel #3
0
        private static void AutomatePlatforming400(RandomizationOption option)
        {
            var platformControllerF = MERFileSystem.GetPackageFile("BioD_EndGm2_420CombatZone.pcc");

            if (platformControllerF != null)
            {
                var platformController = MEPackageHandler.OpenMEPackage(platformControllerF);
                var delayToClone       = platformController.GetUExport(14314);

                // Remove completion state from squad kills as we won't be using that mechanism
                KismetHelper.RemoveOutputLinks(platformController.GetUExport(14488)); //A Platform 01
                KismetHelper.RemoveOutputLinks(platformController.GetUExport(14496)); //A Platform 02
                KismetHelper.RemoveOutputLinks(platformController.GetUExport(14504)); //A Platform 03
                KismetHelper.RemoveOutputLinks(platformController.GetUExport(14513)); //A Platform 0405 (together)
                                                                                      // there's final platform with the controls on it. we don't touch it

                // Install delays and hook them up to the complection states
                InstallPlatformAutomation(platformController.GetUExport(15057), delayToClone, platformController.GetUExport(14353), 1); //01 to 02
                InstallPlatformAutomation(platformController.GetUExport(15063), delayToClone, platformController.GetUExport(14358), 2); //02 to 03
                InstallPlatformAutomation(platformController.GetUExport(15067), delayToClone, platformController.GetUExport(14363), 3); //03 to 0405
                InstallPlatformAutomation(platformController.GetUExport(15072), delayToClone, platformController.GetUExport(14368), 4); //0405 to 06

                MERFileSystem.SavePackage(platformController);
            }
        }
        private static void MakeKensonCool()
        {
            string[] files = new[]
            {
                "BioD_ArvLvl1.pcc",
                "BioD_ArvLvl4_300Entrance.pcc",
            };
            foreach (var f in files)
            {
                var kensonFile = MERFileSystem.GetPackageFile(f, false);
                if (kensonFile != null && File.Exists(kensonFile))
                {
                    var kensonP = MEPackageHandler.OpenMEPackage(kensonFile);
                    var ifp     = kensonP.FindExport("SFXGameContentKenson.Default__SFXPawn_Kenson_01.BioPawnSkeletalMeshComponent");
                    ifp.RemoveProperty("Materials");
                    ifp.RemoveProperty("SkeletalMesh");

                    // Remove materials used in base as they're wrong
                    kensonP.FindExport("SFXGameContentKenson.Default__SFXPawn_Kenson.BioPawnSkeletalMeshComponent").RemoveProperty("Materials");

                    MERFileSystem.SavePackage(kensonP);
                }
                else
                {
                    MERLog.Information($"Kenson file not found: {f}, skipping...");
                }
            }
        }
Beispiel #5
0
        public static bool TurnOnFriendlyFire(RandomizationOption option)
        {
            var sfxgame = MEPackageHandler.OpenMEPackage(MERFileSystem.GetPackageFile("SFXGame.pcc"));
            var md      = sfxgame.GetUExport(21353);
            var patched = md.Data;

            for (int i = 0x0285; i < 0x0317; i++)
            {
                patched[i] = 0x0B; // nop
            }
            md.Data = patched;

            if (option.HasSubOptionSelected(SUBOPTIONKEY_CARELESSFF))
            {
                // Copy a 'return false' over the top of IsFriendlyBlockingSightline
                var fExport = sfxgame.GetUExport(5723);
                var fObjBin = ObjectBinary.From <UFunction>(fExport);

                var friendlyBlockingFunc = sfxgame.GetUExport(1203);
                var fbObjBin             = ObjectBinary.From <UFunction>(friendlyBlockingFunc);

                fbObjBin.ScriptBytecodeSize = fObjBin.ScriptBytecodeSize;
                fbObjBin.ScriptStorageSize  = fObjBin.ScriptStorageSize;
                fbObjBin.ScriptBytes        = fObjBin.ScriptBytes;
                friendlyBlockingFunc.WriteBinary(fbObjBin);
            }
            MERFileSystem.SavePackage(sfxgame);
            return(true);
        }
        public static bool RandomizeIconicMaleShep(RandomizationOption option)
        {
            var sfxgame = MERFileSystem.GetPackageFile("SFXGame.pcc");

            if (sfxgame != null && File.Exists(sfxgame))
            {
                var sfxgameP = MEPackageHandler.OpenMEPackage(sfxgame);
                var shepMDL  = sfxgameP.GetUExport(42539);
                var objBin   = RSkeletalMesh.FuzzSkeleton(shepMDL, option);

                if (option.HasSubOptionSelected(CharacterCreator.SUBOPTIONKEY_MALESHEP_COLORS))
                {
                    Dictionary <string, CFVector4> vectors = new();
                    Dictionary <string, float>     scalars = new();
                    var materials = objBin.Materials;
                    foreach (var mat in materials.Select(x => sfxgameP.GetUExport(x)))
                    {
                        RMaterialInstance.RandomizeSubMatInst(mat, vectors, scalars);
                    }
                }

                MERFileSystem.SavePackage(sfxgameP);
                return(true);
            }

            return(false);
        }
Beispiel #7
0
        private static void ChangeNormandyPaintings()
        {
            //BioA_Nor_230
            // BioT_NorHenMT Painting01_Diff
            // BioT_NorHenMT Painting02_Diff
            // Both square
            var nor230F = MERFileSystem.GetPackageFile("BioA_Nor_230.pcc");

            if (nor230F != null && File.Exists(nor230F))
            {
                var nor230P = MEPackageHandler.OpenMEPackage(nor230F);

                var painting1 = nor230P.FindExport("BioT_NorHenMT.Painting01_Diff");
                var painting2 = nor230P.FindExport("BioT_NorHenMT.Painting02_Diff");
                if (painting1 != null && painting2 != null)
                {
                    var assets = TFCBuilder.ListTextureAssets("Kasumi.NormandyPaintings").Select(x => $"Kasumi.NormandyPaintings.{x}").ToList();
                    assets.Shuffle();

                    RTexture2D r2d = new RTexture2D()
                    {
                        AllowedTextureAssetNames = assets,
                        LODGroup = new EnumProperty(new NameReference("TEXTUREGROUP_Environment", 1025), "TextureGroup", MEGame.ME2, "LODGroup"), // A bit higher quality
                    };

                    TFCBuilder.InstallTexture(r2d, painting1, assets.PullFirstItem());
                    TFCBuilder.InstallTexture(r2d, painting2, assets.PullFirstItem());

                    MERFileSystem.SavePackage(nor230P);
                }
            }
        }
Beispiel #8
0
        private static void MakeTubesSectionHarder()
        {
            var preReaperF = MERFileSystem.GetPackageFile("BioD_EndGm2_420CombatZone.pcc");

            if (preReaperF != null && File.Exists(preReaperF))
            {
                var preReaperP = MEPackageHandler.OpenMEPackage(preReaperF);

                // Open tubes on kills to start the attack (post platforms)----------------------
                var seq = preReaperP.GetUExport(15190);

                var attackSw = MERSeqTools.InstallRandomSwitchIntoSequence(seq, 2); //50% chance

                // killed squad member -> squad still exists to 50/50 sw
                KismetHelper.CreateOutputLink(preReaperP.GetUExport(15298), "SquadStillExists", attackSw);

                // 50/50 to just try to do reaper attack
                KismetHelper.CreateOutputLink(attackSw, "Link 1", preReaperP.GetUExport(14262));

                // Automate the platforms one after another
                KismetHelper.RemoveAllLinks(preReaperP.GetUExport(15010)); //B Plat01 Death
                KismetHelper.RemoveAllLinks(preReaperP.GetUExport(15011)); //B Plat02 Death

                // Sub automate - Remove attack completion gate inputs ----
                KismetHelper.RemoveAllLinks(preReaperP.GetUExport(15025)); //Plat03 Attack complete
                KismetHelper.RemoveAllLinks(preReaperP.GetUExport(15029)); //Plat02 Attack complete

                //// Sub automate - Remove activate input into gate
                var cmb2activated = preReaperP.GetUExport(15082);
                var cmb3activated = preReaperP.GetUExport(15087);

                KismetHelper.RemoveAllLinks(cmb2activated);
                KismetHelper.CreateOutputLink(cmb2activated, "Out", preReaperP.GetUExport(2657));

                // Delay the start of platform 3 by 4 seconds to give player a bit more time to handle first two platforms
                // Player will likely have decent weapons by now so they will be better than my testing for sure
                KismetHelper.RemoveAllLinks(cmb3activated);
                var newDelay = EntryCloner.CloneEntry(preReaperP.GetUExport(14307));
                newDelay.WriteProperty(new FloatProperty(4, "Duration"));
                KismetHelper.AddObjectToSequence(newDelay, preReaperP.GetUExport(15183), true);

                KismetHelper.CreateOutputLink(cmb3activated, "Out", newDelay);
                KismetHelper.CreateOutputLink(newDelay, "Finished", preReaperP.GetUExport(2659));
                //                preReaperP.GetUExport(14451).RemoveProperty("bOpen"); // Plat03 gate - forces gate open so when reaper attack fires it passes through
                //              preReaperP.GetUExport(14450).RemoveProperty("bOpen"); // Plat02 gate - forces gate open so when reaper attack fires it passes through


                // There is no end to Plat03 behavior until tubes are dead
                KismetHelper.CreateOutputLink(preReaperP.GetUExport(14469), "Completed", preReaperP.GetUExport(14374)); // Interp completed to Complete in Plat01
                KismetHelper.CreateOutputLink(preReaperP.GetUExport(14470), "Completed", preReaperP.GetUExport(14379)); // Interp completed to Complete in Plat02

                // if possession fails continue the possession loop on plat3 to end of pre-reaper combat
                KismetHelper.CreateOutputLink(preReaperP.GetUExport(16414), "Failed", preReaperP.GetUExport(14307));



                MERFileSystem.SavePackage(preReaperP);
            }
        }
Beispiel #9
0
 private static void ChangeFlyersInFiles(string[] files)
 {
     foreach (var f in files)
     {
         var fPath = MERFileSystem.GetPackageFile(f);
         if (fPath != null && File.Exists(fPath))
         {
             var package = MEPackageHandler.OpenMEPackage(fPath);
             GenericRandomizeFlyerSpawns(package, 3);
             MERFileSystem.SavePackage(package);
         }
     }
 }
        private static bool CompletelyRandomizeAudio()
        {
            var g2LocIntF = MERFileSystem.GetSpecificFile(@"BioGame\DLC\DLC_DHME1\CookedPC\BioD_ProNor_LOC_int.pcc");

            if (g2LocIntF != null && File.Exists(g2LocIntF))
            {
                var g2LocIntP = MEPackageHandler.OpenMEPackage(g2LocIntF);

                RandomizeAudio(g2LocIntP, 3317, true);
                RandomizeAudio(g2LocIntP, 3318, false);

                MERFileSystem.SavePackage(g2LocIntP);
            }
            return(false);
        }
Beispiel #11
0
        public static bool SetupFastStartup(RandomizationOption option)
        {
            var entrymenuF = MERFileSystem.GetPackageFile("EntryMenu.pcc");
            var entrymenuP = MEPackageHandler.OpenMEPackage(entrymenuF);
            var skipElem   = entrymenuP.GetUExport(86); // should show splash

            if (!skipElem.ObjectFlags.HasFlag(UnrealFlags.EObjectFlags.DebugPostLoad))
            {
                skipElem.ObjectFlags |= UnrealFlags.EObjectFlags.DebugPostLoad; // mark as modified so subsequent passes don't operate on this
                SeqTools.SkipSequenceElement(skipElem, outboundLinkIdx: 1);
                MERFileSystem.SavePackage(entrymenuP);
            }


            return(true);
        }
Beispiel #12
0
        public static bool RemoveStormCameraShake(RandomizationOption arg)
        {
            var sfxgame = MEPackageHandler.OpenMEPackage(MERFileSystem.GetPackageFile("SFXGame.pcc"));

            // SFXCameraMode_CombatStorm
            var md = sfxgame.GetUExport(25096);

            md.WriteProperty(new BoolProperty(false, "bIsCameraShakeEnabled"));

            //SFXCameraMode_ExporeStorm
            md = sfxgame.GetUExport(25116);
            md.WriteProperty(new BoolProperty(false, "bIsCameraShakeEnabled"));

            MERFileSystem.SavePackage(sfxgame);
            return(true);
        }
Beispiel #13
0
        private static void MakeGarrusDeadly()
        {
            // Relay at the end of the DLC
            var garrusShootSeqFile = MERFileSystem.GetPackageFile(@"BioD_OmgGrA_100Leadup.pcc");

            if (garrusShootSeqFile != null && File.Exists(garrusShootSeqFile))
            {
                var garrusSeqP = MEPackageHandler.OpenMEPackage(garrusShootSeqFile);

                // Chance to shoot Shepard
                RandSeqVarInt(garrusSeqP.GetUExport(1043), 60, 100); //60 to 100 percent chance

                // Make garrus shoot faster so he can actually kill the player
                garrusSeqP.GetUExport(974).WriteProperty(new FloatProperty(3, "PlayRate"));

                // Lower the damage so its not instant kill
                garrusSeqP.GetUExport(34).WriteProperty(new FloatProperty(550, "DamageAmount"));
                garrusSeqP.GetUExport(34).WriteProperty(new FloatProperty(2, "MomentumScale"));

                // Do not reset the chance to shoot shepard again
                SeqTools.ChangeOutlink(garrusSeqP.GetUExport(33), 0, 0, 982);

                // Make garrus damage type very deadly
                var garrusDamageTypeProps = garrusSeqP.GetUExport(8).GetProperties();
                garrusDamageTypeProps.Clear(); // Remove the old props
                garrusDamageTypeProps.AddOrReplaceProp(new BoolProperty(true, "bImmediateDeath"));
                garrusDamageTypeProps.AddOrReplaceProp(new BoolProperty(true, "bIgnoreShieldHitLimit"));
                garrusDamageTypeProps.AddOrReplaceProp(new BoolProperty(true, "bIgnoreShields"));
                garrusDamageTypeProps.AddOrReplaceProp(new BoolProperty(true, "bIgnoresBleedout"));
                garrusSeqP.GetUExport(8).WriteProperties(garrusDamageTypeProps);

                // Make shepard more vulnerable
                garrusSeqP.GetUExport(1005).WriteProperty(new IntProperty(60, "ValueB"));


                // Make garrus stand more often
                garrusSeqP.GetUExport(1039).WriteProperty(new IntProperty(60, "IntValue"));

                // Make shoot extra free bullets
                garrusSeqP.GetUExport(1037).WriteProperty(new IntProperty(75, "IntValue"));
                RandSeqVarInt(garrusSeqP.GetUExport(1042), 1, 4);

                MERFileSystem.SavePackage(garrusSeqP);
            }
        }
Beispiel #14
0
        private static void SetVeetorFootage()
        {
            var moviedata   = RTextureMovie.GetTextureMovieAssetBinary("Veetor.size_mer.bik");
            var veetorFiles = MERFileSystem.LoadedFiles.Keys.Where(x => x.StartsWith("BioD_ProFre_501Veetor")).ToList();

            foreach (var v in veetorFiles)
            {
                MERLog.Information($@"Setting veetor footage in {v}");
                var mpackage     = MERFileSystem.GetPackageFile(v);
                var package      = MEPackageHandler.OpenMEPackage(mpackage);
                var veetorExport = package.FindExport("BioVFX_Env_Hologram.ProFre_501_VeetorFootage");
                if (veetorExport != null)
                {
                    RTextureMovie.RandomizeExportDirect(veetorExport, null, moviedata);
                }
                MERFileSystem.SavePackage(package);
            }
        }
        private static void FixFirstSurvivorNameBchLmL()
        {
            // Make it so the beating scene shows names
            var beachPathF = MERFileSystem.GetPackageFile("BioD_BchLmL_102BeachFight.pcc");

            if (beachPathF != null)
            {
                var beachPathP = MEPackageHandler.OpenMEPackage(beachPathF);

                // Make memory unique
                var tlkId = InstallName();
                if (tlkId != 0)
                {
                    beachPathP.GetUExport(700).WriteProperty(new StringRefProperty(tlkId, "ActorGameNameStrRef"));
                    beachPathP.GetUExport(700).ObjectName = "survivor_female_MER";
                    MERFileSystem.SavePackage(beachPathP);
                }
            }
        }
        internal static bool PerformRandomization(RandomizationOption notUsed)
        {
            var uncFiles = MERFileSystem.LoadedFiles.Keys.Where(x => x.Contains("_Unc1", StringComparison.InvariantCultureIgnoreCase)).ToList();

            if (uncFiles.Any())
            {
                // DLC is installed
                foreach (var uncF in uncFiles)
                {
                    var package = MEPackageHandler.OpenMEPackage(MERFileSystem.GetPackageFile(Path.GetFileName(uncF)));
                    RandomizeArcherFaceColor(package);
                    RandomizeCorruptionVFX(package);
                    MakeGethCannonScary(package);
                    ChangeUNC4BaseColors(package);
                    MERFileSystem.SavePackage(package);
                }
            }

            return(true);
        }
Beispiel #17
0
        public static bool MakeShepardRagdollable(RandomizationOption option)
        {
            var sfxgame = MEPackageHandler.OpenMEPackage(MERFileSystem.GetPackageFile("SFXGame.pcc"));

            // Add ragdoll power to shep
            var sfxplayercontrollerDefaults = sfxgame.GetUExport(30777);
            var cac = sfxplayercontrollerDefaults.GetProperty <ArrayProperty <ObjectProperty> >("CustomActionClasses");

            cac[5].Value = 25988; //SFXCustomActionRagdoll
            sfxplayercontrollerDefaults.WriteProperty(cac);

            // Update power script design and patch out player physics level
            var sd = sfxgame.GetUExport(14353).Data;

            OneHitKO.NopRange(sd, 0x62, 0x27);
            sfxgame.GetUExport(14353).Data = sd;

            MERFileSystem.SavePackage(sfxgame);
            return(true);
        }
Beispiel #18
0
        public static bool RandomizePlayerMovementSpeed(RandomizationOption option)
        {
            var femaleFile    = MERFileSystem.GetPackageFile("BIOG_Female_Player_C.pcc");
            var maleFile      = MERFileSystem.GetPackageFile("BIOG_Male_Player_C.pcc");
            var femalepackage = MEPackageHandler.OpenMEPackage(femaleFile);
            var malepackage   = MEPackageHandler.OpenMEPackage(maleFile);

            SlightlyRandomizeMovementData(femalepackage.GetUExport(2917));
            SlightlyRandomizeMovementData(malepackage.GetUExport(2672));
            MERFileSystem.SavePackage(femalepackage);
            MERFileSystem.SavePackage(malepackage);

            var biogame = CoalescedHandler.GetIniFile("BIOGame.ini");
            var sfxgame = biogame.GetOrAddSection("SFXGame.SFXGame");

            sfxgame.SetSingleEntry("StormStamina", ThreadSafeRandom.NextFloat(1.5f, 12));
            sfxgame.SetSingleEntry("StormRegen", ThreadSafeRandom.NextFloat(0.3f, 1.5f));
            sfxgame.SetSingleEntry("StormStaminaNonCombat", ThreadSafeRandom.NextFloat(1.5f, 8));
            sfxgame.SetSingleEntry("StormRegenNonCombat", ThreadSafeRandom.NextFloat(0.1f, 0.8f));
            return(true);
        }
Beispiel #19
0
        private static void RandomizeALDancers()
        {
            {
                var denBar = MERFileSystem.GetPackageFile(@"BioD_OmgHub_220DenBar.pcc");
                if (denBar != null)
                {
                    var denBarP = MEPackageHandler.OpenMEPackage(denBar);
                    RandomizeDancer(denBarP.GetUExport(1287));
                    RandomizeDancer(denBarP.GetUExport(1288));
                    RandomizeDancer(denBarP.GetUExport(1289));
                    RandomizeDancer(denBarP.GetUExport(1292));
                    RandomizeDancer(denBarP.GetUExport(1293));
                    MERFileSystem.SavePackage(denBarP);
                }
            }

            var denDance = MERFileSystem.GetPackageFile(@"BioD_OmgHub_230DenDance.pcc");

            if (denDance != null)
            {
                var denDanceP = MEPackageHandler.OpenMEPackage(denDance);
                RandomizeDancer(denDanceP.GetUExport(1257)); //sit
                RandomizeDancer(denDanceP.GetUExport(1250));
                RandomizeDancer(denDanceP.GetUExport(1251));

                // shep sits at dancer. it uses different pawn.
                var entertainerBPSKM = denDanceP.GetUExport(4322);
                var newInfo          = IlliumHub.DancerOptions.RandomElement();
                while (newInfo.Location != null || newInfo.Rotation != null || newInfo.KeepHead == false || (newInfo.BodyAsset != null && !newInfo.BodyAsset.IsAssetFileAvailable()) || (newInfo.HeadAsset != null && !newInfo.HeadAsset.IsAssetFileAvailable()))
                {
                    // I don't want anything that requires specific positioning data, and I want to keep the head.
                    newInfo = IlliumHub.DancerOptions.RandomElement();
                }

                var newDancerMDL = PackageTools.PortExportIntoPackage(denDanceP, newInfo.BodyAsset.GetAsset());
                entertainerBPSKM.WriteProperty(new ObjectProperty(newDancerMDL, "SkeletalMesh"));
                MERFileSystem.SavePackage(denDanceP);
            }
        }
        public static bool RandomizeSquadmateFaces(RandomizationOption option)
        {
            var henchFiles = MERFileSystem.LoadedFiles.Where(x => x.Key.StartsWith("BioH_") ||
                                                             x.Key.StartsWith("BioP_ProCer") ||
                                                             x.Key.StartsWith("BioD_ProCer") ||
                                                             x.Key == "BioD_EndGm1_110ROMJacob.pcc");

            foreach (var h in henchFiles)
            {
                var hPackage = MERFileSystem.OpenMEPackage(MERFileSystem.GetPackageFile(h.Key));
                foreach (var smhp in SquadmateMorphHeadPaths)
                {
                    var mf = hPackage.FindExport(smhp);
                    if (mf != null)
                    {
                        RandomizeInternal(mf, henchFaceOption);
                    }
                }
                MERFileSystem.SavePackage(hPackage);
            }
            return(true);
        }
Beispiel #21
0
        private static void RandomizeVIPShepDance()
        {
            var vipLoungeLF = MERFileSystem.GetPackageFile(@"BioD_OmgHub_500DenVIP_LOC_INT.pcc");

            if (vipLoungeLF != null && File.Exists(vipLoungeLF))
            {
                var vipLounge = MEPackageHandler.OpenMEPackage(vipLoungeLF);

                var playerDanceInterpData = vipLounge.GetUExport(547);
                var c = new MERPackageCache();

                InstallShepardDanceGesture(playerDanceInterpData, c);     // Paragon
                InstallShepardDanceGesture(vipLounge.GetUExport(559), c); // Stupid shep lol


                // Make able to dance again and again in convo
                var danceTalk = vipLounge.GetUExport(217);
                var bc        = new ConversationExtended(danceTalk);
                bc.LoadConversation(null);
                bc.StartingList.Clear();
                bc.StartingList.Add(0, 2);
                bc.SerializeNodes();

                MERFileSystem.SavePackage(vipLounge);
            }

            // make able to always talk to dancer
            var vipLoungeF = MERFileSystem.GetPackageFile(@"BioD_OmgHub_500DenVIP.pcc");

            if (vipLoungeF != null && File.Exists(vipLoungeF))
            {
                var vipLounge      = MEPackageHandler.OpenMEPackage(vipLoungeF);
                var selectableBool = vipLounge.GetUExport(8845);
                selectableBool.WriteProperty(new IntProperty(1, "bValue"));
                MERFileSystem.SavePackage(vipLounge);
            }
        }
Beispiel #22
0
        private static void GateTubesAttack()
        {
            // This doesn't actually work like expected, it seems gate doesn't store input value

            // Adds a gate to the tubes attack to ensure it doesn't fire while the previous attack is running still.
            var tubesF = MERFileSystem.GetPackageFile("BioD_EndGm2_425ReaperTubes.pcc");

            if (tubesF != null && File.Exists(tubesF))
            {
                var tubesP = MEPackageHandler.OpenMEPackage(tubesF);

                // Clone a gate
                var gateToClone = tubesP.GetUExport(1316);
                var seq         = tubesP.GetUExport(1496);
                var newGate     = EntryCloner.CloneEntry(gateToClone);
                newGate.RemoveProperty("bOpen"); // Make it open by default.
                KismetHelper.AddObjectToSequence(newGate, seq, true);

                // Hook up the 'START REAPER ATTACK' to the gate, remove it's existing output.
                var sraEvent = tubesP.GetUExport(1455);
                KismetHelper.RemoveOutputLinks(sraEvent);
                KismetHelper.CreateOutputLink(sraEvent, "Out", newGate, 0); // 0 = in, which means fire or queue for fire

                // Hook up the ending of the attack to the gate for 'open' so the gate can be passed through.
                var delay = tubesP.GetUExport(1273);
                KismetHelper.CreateOutputLink(tubesP.GetUExport(103), "Out", delay); // Attack finished (CameraShake_Intimidate) to 2s delay
                KismetHelper.RemoveAllLinks(delay);
                KismetHelper.CreateOutputLink(delay, "Finished", newGate, 1);        //2s Delay to open gate

                // Make the gate automatically close itself on pass through, and configure output of gate to next item.
                KismetHelper.CreateOutputLink(newGate, "Out", newGate, 2);                 // Hook from Out to Close
                KismetHelper.CreateOutputLink(newGate, "Out", tubesP.GetUExport(1340), 0); // Hook from Out to Log (bypass the delay, we are repurposing it)

                MERFileSystem.SavePackage(tubesP);
            }
        }
Beispiel #23
0
        private static void SetupProCer()
        {
            /*
             * PLAYER
             *  Min1Health in BioD_ProCer.pcc, export 1171, sequence TheWorld.PersistentLevel.Main_Sequence, target SeqVar_Player
             *  Min1Health in BioD_ProCer_100RezRoom.pcc, export 3956, sequence TheWorld.PersistentLevel.Main_Sequence.LS0_LevelLoad, target SeqVar_Player
             */
            var DPProCerF = MERFileSystem.GetPackageFile("BioD_ProCer.pcc");

            if (DPProCerF != null && File.Exists(DPProCerF))
            {
                var bpProCerP = MEPackageHandler.OpenMEPackage(DPProCerF);
                bpProCerP.GetUExport(1171).WriteProperty(new IntProperty(0, "bValue"));
                MERFileSystem.SavePackage(bpProCerP);
            }
            var rezRoom = MERFileSystem.GetPackageFile("BioD_ProCer_100RezRoom.pcc");

            if (rezRoom != null && File.Exists(rezRoom))
            {
                var rezRoomP = MEPackageHandler.OpenMEPackage(rezRoom);
                rezRoomP.GetUExport(3956).WriteProperty(new IntProperty(0, "bValue"));
                MERFileSystem.SavePackage(rezRoomP);
            }
        }
        public static bool RandomizeIconicFemShep(RandomizationOption option)
        {
            var femF = MERFileSystem.GetPackageFile("BIOG_Female_Player_C.pcc");

            if (femF != null && File.Exists(femF))
            {
                var femP         = MEPackageHandler.OpenMEPackage(femF);
                var femMorphFace = femP.GetUExport(682);
                RBioMorphFace.RandomizeExportNonHench(femMorphFace, option);
                var matSetup = femP.GetUExport(681);
                RBioMaterialOverride.RandomizeExport(matSetup, option);

                // Copy this data into BioP_Char so you get accurate results
                var biop_charF = MERFileSystem.GetPackageFile(@"BioP_Char.pcc");
                var biop_char  = MEPackageHandler.OpenMEPackage(biop_charF);
                EntryImporter.ImportAndRelinkEntries(EntryImporter.PortingOption.ReplaceSingular, femMorphFace, biop_char, biop_char.GetUExport(3482), true, out IEntry _);
                EntryImporter.ImportAndRelinkEntries(EntryImporter.PortingOption.ReplaceSingular, matSetup, biop_char, biop_char.GetUExport(3472), true, out IEntry _);
                //biop_char.GetUExport(3482).WriteProperties(femMorphFace.GetProperties()); // Copy the morph face
                //biop_char.GetUExport(3472).WriteProperties(matSetup.GetProperties()); // Copy the material setups
                MERFileSystem.SavePackage(biop_char);
                MERFileSystem.SavePackage(femP);
            }
            return(true);
        }
        private static void RandomizeDancer()
        {
            var loungeF = MERFileSystem.GetPackageFile("BioD_TwrHub_202Lounge.pcc");

            if (loungeF != null && File.Exists(loungeF))
            {
                var package = MEPackageHandler.OpenMEPackage(loungeF);
                var bodySM  = package.GetUExport(4509);
                var headSM  = package.GetUExport(2778);

                // Install new head and body assets
                var newInfo = DancerOptions.RandomElement();
                while (newInfo.BodyAsset != null && !newInfo.BodyAsset.IsAssetFileAvailable())
                {
                    // Find another asset that is available
                    MERLog.Information($@"Asset {newInfo.BodyAsset.AssetPath} in {newInfo.BodyAsset.PackageFile} not available, repicking...");
                    newInfo = DancerOptions.RandomElement();
                }
                var newBody = PackageTools.PortExportIntoPackage(package, newInfo.BodyAsset.GetAsset());
                bodySM.WriteProperty(new ObjectProperty(newBody.UIndex, "SkeletalMesh"));

                if (newInfo.HeadAsset != null)
                {
                    var newHead = PackageTools.PortExportIntoPackage(package, newInfo.HeadAsset.GetAsset());
                    headSM.WriteProperty(new ObjectProperty(newHead.UIndex, "SkeletalMesh"));
                }
                else if (!newInfo.KeepHead)
                {
                    headSM.RemoveProperty("SkeletalMesh");
                }


                if (newInfo.DrawScale != 1)
                {
                    // Install DS3D on the archetype. It works. Not gonna question it
                    var ds = new CFVector3()
                    {
                        X = newInfo.DrawScale,
                        Y = newInfo.DrawScale,
                        Z = newInfo.DrawScale,
                    };
                    package.GetUExport(619).WriteProperty(ds.ToLocationStructProperty("DrawScale3D")); //hack
                }

                // Install any updates to locations/rotations
                var dancerInstance = package.GetUExport(4510); // contains location data for dancer which may need to be slightly adjusted
                if (newInfo.Location != null)
                {
                    dancerInstance.WriteProperty(newInfo.Location.ToLocationStructProperty("Location"));
                }
                if (newInfo.Rotation != null)
                {
                    dancerInstance.WriteProperty(newInfo.Rotation.ToRotatorStructProperty("Rotation"));
                }

                if (newInfo.MorphFace != null)
                {
                    var newHead = PackageTools.PortExportIntoPackage(package, newInfo.MorphFace.GetAsset());
                    headSM.WriteProperty(new ObjectProperty(newHead.UIndex, "MorphHead"));
                }
                MERFileSystem.SavePackage(package);
            }
        }
Beispiel #26
0
        private static void RandomizeArtGallery()
        {
            var wideAssets = TFCBuilder.ListTextureAssets("Kasumi.ArtGallery.wide").Select(x => $"Kasumi.ArtGallery.wide.{x}").ToList();
            var tallAssets = TFCBuilder.ListTextureAssets("Kasumi.ArtGallery.tall").Select(x => $"Kasumi.ArtGallery.tall.{x}").ToList();

            wideAssets.Shuffle();
            tallAssets.Shuffle();

            var artyGallery = GetKasumiArtGallerySetup();

            foreach (var kagf in artyGallery)
            {
                var artGalleryF = MERFileSystem.GetPackageFile(kagf.PackageName);
                if (artGalleryF != null && File.Exists(artGalleryF))
                {
                    var artGalleryP = MEPackageHandler.OpenMEPackage(artGalleryF);

                    // Rename instances so they're memory unique so we have a few more paintings
                    if (kagf.RenameMemoryInstances)
                    {
                        if (kagf.TallTextureUIndexes != null)
                        {
                            foreach (var uindex in kagf.TallTextureUIndexes)
                            {
                                if (!artGalleryP.GetUExport(uindex).IsTexture())
                                {
                                    Debugger.Break();
                                }
                                artGalleryP.GetUExport(uindex).ObjectName = $"ME2R_T_KASUMIPAINTING{ThreadSafeRandom.Next(15000)}";
                            }
                        }

                        // Rename mats so they're also unique
                        if (kagf.WideTextureUIndexes != null)
                        {
                            foreach (var uindex in kagf.WideTextureUIndexes)
                            {
                                if (!artGalleryP.GetUExport(uindex).IsTexture())
                                {
                                    Debugger.Break();
                                }
                                artGalleryP.GetUExport(uindex).ObjectName = $"ME2R_W_KASUMIPAINTING{ThreadSafeRandom.Next(15000)}";
                            }
                        }

                        if (kagf.MaterialUIndexes != null)
                        {
                            foreach (var uindex in kagf.MaterialUIndexes)
                            {
                                var exp = artGalleryP.GetUExport(uindex);
                                if (!exp.ClassName.Contains("Material"))
                                {
                                    Debugger.Break();
                                }
                                artGalleryP.GetUExport(uindex).ObjectName = $"ME2R_PAINTMAT_KASUMI{ThreadSafeRandom.Next(15000)}";
                            }
                        }
                    }

                    InstallARArtTextures(kagf.WideTextureUIndexes, wideAssets, artGalleryP, "Wide");
                    InstallARArtTextures(kagf.TallTextureUIndexes, tallAssets, artGalleryP, "Tall");

                    MERFileSystem.SavePackage(artGalleryP);
                }
            }
        }
Beispiel #27
0
        private static void RandomizeTheLongWalk(RandomizationOption option)
        {
            var prelongwalkfile = MERFileSystem.GetPackageFile("BioD_EndGm2_200Factory.pcc");

            if (prelongwalkfile != null)
            {
                // Pre-long walk selection
                var package       = MEPackageHandler.OpenMEPackage(prelongwalkfile);
                var bioticTeamSeq = package.GetUExport(8609);

                var activated = package.GetUExport(8484);
                KismetHelper.RemoveAllLinks(activated);

                // install new logic
                var randSwitch = MERSeqTools.InstallRandomSwitchIntoSequence(bioticTeamSeq, 13); // don't include theif or veteran as dlc might not be installed
                KismetHelper.CreateOutputLink(activated, "Out", randSwitch);

                // Outputs of random choice
                KismetHelper.CreateOutputLink(randSwitch, "Link 1", package.GetUExport(1420));  //thane
                KismetHelper.CreateOutputLink(randSwitch, "Link 2", package.GetUExport(1419));  //jack
                KismetHelper.CreateOutputLink(randSwitch, "Link 3", package.GetUExport(1403));  //garrus
                KismetHelper.CreateOutputLink(randSwitch, "Link 4", package.GetUExport(1399));  //legion
                KismetHelper.CreateOutputLink(randSwitch, "Link 5", package.GetUExport(1417));  //grunt
                KismetHelper.CreateOutputLink(randSwitch, "Link 6", package.GetUExport(1395));  //jacob
                KismetHelper.CreateOutputLink(randSwitch, "Link 7", package.GetUExport(1418));  //samara
                KismetHelper.CreateOutputLink(randSwitch, "Link 8", package.GetUExport(1415));  //mordin
                KismetHelper.CreateOutputLink(randSwitch, "Link 9", package.GetUExport(1405));  //tali
                KismetHelper.CreateOutputLink(randSwitch, "Link 10", package.GetUExport(1401)); //morinth
                KismetHelper.CreateOutputLink(randSwitch, "Link 11", package.GetUExport(1402)); //miranda

                // kasumi
                if (MERFileSystem.GetPackageFile("BioH_Thief_00.pcc") != null)
                {
                    KismetHelper.CreateOutputLink(randSwitch, "Link 12", package.GetUExport(1396)); //kasumi
                }

                // zaeed
                if (MERFileSystem.GetPackageFile("BioH_Veteran_00.pcc") != null)
                {
                    KismetHelper.CreateOutputLink(randSwitch, "Link 13", package.GetUExport(1416)); //zaeed
                }

                MERFileSystem.SavePackage(package);
            }

            var biodEndGm2F = MERFileSystem.GetPackageFile("BioD_EndGm2.pcc");

            if (biodEndGm2F != null)
            {
                var package = MEPackageHandler.OpenMEPackage(biodEndGm2F);
                var ts      = package.GetUExport(7);
                var ss      = ts.GetProperty <ArrayProperty <StructProperty> >("StreamingStates");
                // Make walk4 remain loaded while walk5 is active as enemeis may not yet be cleared out
                var conclusion   = ss[8];
                var visibleNames = conclusion.GetProp <ArrayProperty <NameProperty> >("VisibleChunkNames");
                if (!visibleNames.Any(x => x.Value == "BioD_EndGm2_300Walk04"))
                {
                    // This has pawns as part of the level so we must make sure it doesn't disappear or player will just see enemies disappear
                    visibleNames.Add(new NameProperty("BioD_EndGm2_300Walk04"));
                }

                ts.WriteProperty(ss);
                MERFileSystem.SavePackage(package);
            }

            var longwalkfile = MERFileSystem.GetPackageFile("BioD_EndGm2_300LongWalk.pcc");

            if (longwalkfile != null)
            {
                // automate TLW

                var package     = MEPackageHandler.OpenMEPackage(longwalkfile);
                var seq         = package.GetUExport(1629);
                var stopWalking = package.GetUExport(1569);

                // The auto walk delay on Stop Walking
                var delay = package.GetUExport(806).Clone();
                package.AddExport(delay);
                delay.WriteProperty(new FloatProperty(ThreadSafeRandom.NextFloat(2, 7), "Duration")); // how long to wait until auto walk
                KismetHelper.AddObjectToSequence(delay, seq, true);
                KismetHelper.CreateOutputLink(delay, "Finished", package.GetUExport(156));
                KismetHelper.CreateOutputLink(stopWalking, "Out", delay);

                // Do not allow targeting the escort
                package.GetUExport(1915).WriteProperty(new IntProperty(0, "bValue"));  // stopped walking
                package.GetUExport(1909).WriteProperty(new IntProperty(0, "bValue"));  // loading from save - we will auto start
                KismetHelper.CreateOutputLink(package.GetUExport(1232), "Out", delay); // post loaded from save init

                // Do not enable autosaves, cause it makes it easy to cheese this area. Bypass the 'savegame' item
                KismetHelper.RemoveOutputLinks(package.GetUExport(156));
                KismetHelper.CreateOutputLink(package.GetUExport(156), "Out", package.GetUExport(1106));

                // Pick a random henchman to go on a date with
                //var determineEscortLog = package.GetUExport(1118);
                //var spawnSeq = package.GetUExport(1598);

                //// disconnect old logic
                //KismetHelper.RemoveAllLinks(determineEscortLog);

                // install new logic

                /*var randSwitch = SeqTools.InstallRandomSwitchIntoSequence(spawnSeq, 12); // don't include theif or veteran as dlc might not be installed
                 * KismetHelper.CreateOutputLink(determineEscortLog, "Out", randSwitch);
                 *
                 *
                 * // Outputs of random choice
                 *
                 *
                 *
                 * KismetHelper.CreateOutputLink(randSwitch, "Link 1", package.GetUExport(1599)); //thane
                 * KismetHelper.CreateOutputLink(randSwitch, "Link 2", package.GetUExport(1601)); //jack
                 * KismetHelper.CreateOutputLink(randSwitch, "Link 3", package.GetUExport(1603)); //garrus
                 * KismetHelper.CreateOutputLink(randSwitch, "Link 4", package.GetUExport(1605)); //legion
                 * KismetHelper.CreateOutputLink(randSwitch, "Link 5", package.GetUExport(1607)); //grunt
                 * KismetHelper.CreateOutputLink(randSwitch, "Link 6", package.GetUExport(1609)); //jacob
                 * KismetHelper.CreateOutputLink(randSwitch, "Link 7", package.GetUExport(1611)); //samara
                 * KismetHelper.CreateOutputLink(randSwitch, "Link 8", package.GetUExport(1613)); //mordin
                 * KismetHelper.CreateOutputLink(randSwitch, "Link 9", package.GetUExport(1615)); //tali
                 * KismetHelper.CreateOutputLink(randSwitch, "Link 10", package.GetUExport(1619)); //morinth
                 * KismetHelper.CreateOutputLink(randSwitch, "Link 11", package.GetUExport(1624)); //miranda
                 */



                MERFileSystem.SavePackage(package);
            }

            //randomize long walk lengths.
            var endwalkexportmap = new Dictionary <string, int>()
            {
                { "BioD_EndGm2_300Walk01", 40 },
                { "BioD_EndGm2_300Walk02", 5344 },
                { "BioD_EndGm2_300Walk03", 8884 },
                { "BioD_EndGm2_300Walk04", 6370 },
                { "BioD_EndGm2_300Walk05", 3190 }
            };

            foreach (var map in endwalkexportmap)
            {
                var file = MERFileSystem.GetPackageFile(map.Key + ".pcc");
                if (file != null)
                {
                    var package = MEPackageHandler.OpenMEPackage(file);
                    var export  = package.GetUExport(map.Value);
                    export.WriteProperty(new FloatProperty(ThreadSafeRandom.NextFloat(.5, 2.5), "PlayRate"));
                    MERFileSystem.SavePackage(package);
                }
            }

            /*foreach (var f in files)
             * {
             *  var package = MEPackageHandler.OpenMEPackage(f);
             *  var animExports = package.Exports.Where(x => x.ClassName == "InterpTrackAnimControl");
             *  foreach (var anim in animExports)
             *  {
             *      var animseqs = anim.GetProperty<ArrayProperty<StructProperty>>("AnimSeqs");
             *      if (animseqs != null)
             *      {
             *          foreach (var animseq in animseqs)
             *          {
             *              var seqname = animseq.GetProp<NameProperty>("AnimSeqName").Value.Name;
             *              if (seqname.StartsWith("Walk_"))
             *              {
             *                  var playrate = animseq.GetProp<FloatProperty>("AnimPlayRate");
             *                  var oldrate = playrate.Value;
             *                  if (oldrate != 1) Debugger.Break();
             *                  playrate.Value = ThreadSafeRandom.NextFloat(.2, 6);
             *                  var data = anim.Parent.Parent as ExportEntry;
             *                  var len = data.GetProperty<FloatProperty>("InterpLength");
             *                  len.Value = len.Value * playrate; //this might need to be changed if its not 1
             *                  data.WriteProperty(len);
             *              }
             *          }
             *      }
             *      anim.WriteProperty(animseqs);
             *  }
             *  SavePackage(package);
             * }*/
        }
Beispiel #28
0
        public static bool InstallOHKO(RandomizationOption arg)
        {
            MERLog.Information("Installing One-Hit KO");

            var sfxgame = MERFileSystem.GetPackageFile("SFXGame.pcc");

            if (sfxgame != null && File.Exists(sfxgame))
            {
                var sfxgameP = MEPackageHandler.OpenMEPackage(sfxgame);

                // Blood on screen VFX
                sfxgameP.GetUExport(29336).RemoveProperty("BleedOutEventPair");
                sfxgameP.GetUExport(29336).RemoveProperty("BleedOutVFXTemplate");

                // Prevent weird landing glitch
                var fallingStateLanded = sfxgameP.GetUExport(11293);
                var landedData         = fallingStateLanded.Data;
                NopRange(landedData, 0x2C, 0x14);
                fallingStateLanded.Data = landedData;

                MERFileSystem.SavePackage(sfxgameP);
            }
            else
            {
            }


            // ProCer tutorials setting min1Health
            SetupProCer();

            // Player classes - Remove shields, set maxhealth to 1
            string[] classes = new[] { "Adept", "Engineer", "Infiltrator", "Sentinel", "Soldier", "Vanguard" };
            foreach (var c in classes)
            {
                var charClass = MERFileSystem.GetPackageFile($"SFXCharacterClass_{c}.pcc");
                if (charClass != null && File.Exists(charClass))
                {
                    var charClassP = MEPackageHandler.OpenMEPackage(charClass);
                    var ccLoadout  = charClassP.FindExport($"BioChar_Loadouts.Player.PLY_{c}");

                    var ccProps = ccLoadout.GetProperties();
                    ccProps.GetProp <ArrayProperty <StructProperty> >("ShieldLoadouts").Clear(); // Remove shields

                    // Set health to 1
                    var health = ccProps.GetProp <StructProperty>("MaxHealth");
                    health.GetProp <FloatProperty>("X").Value = 1;
                    health.GetProp <FloatProperty>("Y").Value = 1;

                    ccLoadout.WriteProperties(ccProps);

                    // Remove any passive powers
                    ZeroOutStatList(charClassP.FindExport($"SFXGameContent_Powers.SFXPower_{c}Passive"), "HealthBonus", false);
                    ZeroOutStatList(charClassP.FindExport($"SFXGameContent_Powers.SFXPower_{c}Passive_Evolved1"), "HealthBonus", false);
                    ZeroOutStatList(charClassP.FindExport($"SFXGameContent_Powers.SFXPower_{c}Passive_Evolved2"), "HealthBonus", false);

                    if (c == "Vanguard")
                    {
                        // Patch the immunity effect
                        var shieldEffectOnApplied = charClassP.GetUExport(530);
                        var seData = shieldEffectOnApplied.Data;
                        NopRange(seData, 0x2BF, 0x13);
                        shieldEffectOnApplied.Data = seData;
                    }

                    MERFileSystem.SavePackage(charClassP);
                }
            }

            // Zero out stats in tables
            MERPackageCache cache = new MERPackageCache();

            foreach (var asset in ZeroOutStatAssets)
            {
                var statClass = asset.GetAsset(cache);
                if (statClass != null)
                {
                    foreach (var zos in asset.PropertiesToZeroOut)
                    {
                        ZeroOutStatList(statClass, zos, true);
                    }
                }
            }

            foreach (var package in cache.GetPackages())
            {
                MERFileSystem.SavePackage(package);
            }

            {
                //var reaveF = MERFileSystem.GetPackageFile("SFXPower_Reave_Player.pcc");
                //if (reaveF != null && File.Exists(reaveF))
                //{
                //    var reaveP = MEPackageHandler.OpenMEPackage(reaveF);

                //    var defaultReave = reaveP.GetUExport(27);
                //    var regen = defaultReave.GetProperty<ArrayProperty<FloatProperty>>("HealthRegenMult");
                //    regen[0].Value = 0;
                //    regen[1].Value = 0;
                //    regen[2].Value = 0;
                //    regen[3].Value = 0;
                //    defaultReave.WriteProperty(regen);

                //    var bonusDuration = defaultReave.GetProperty<ArrayProperty<FloatProperty>>("HealthBonusDuration");
                //    bonusDuration[0].Value = 0;
                //    bonusDuration[1].Value = 0;
                //    bonusDuration[2].Value = 0;
                //    bonusDuration[3].Value = 0;
                //    defaultReave.WriteProperty(bonusDuration);

                //    MERFileSystem.SavePackage(reaveP);
                //}
            }

            return(true);
        }
Beispiel #29
0
        private static void RandomizeAfterlifeShepDance()
        {
            var denDanceF = MERFileSystem.GetPackageFile(@"BioD_OmgHub_230DenDance.pcc");

            if (denDanceF != null)
            {
                var loungeP  = MEPackageHandler.OpenMEPackage(denDanceF);
                var sequence = loungeP.GetUExport(3924);

                MERPackageCache cache = new MERPackageCache();
                List <InterpTools.InterpData> interpDatas = new List <InterpTools.InterpData>();
                var interp1 = loungeP.GetUExport(3813);

                // Make 2 additional dance options by cloning the interp and the data tree
                var interp2 = MERSeqTools.CloneBasicSequenceObject(interp1);
                var interp3 = MERSeqTools.CloneBasicSequenceObject(interp1);


                // Clone the interp data for attaching to 2 and 3
                var interpData1 = loungeP.GetUExport(1174);
                var interpData2 = EntryCloner.CloneTree(interpData1);
                var interpData3 = EntryCloner.CloneTree(interpData2);
                KismetHelper.AddObjectToSequence(interpData2, sequence);
                KismetHelper.AddObjectToSequence(interpData3, sequence);

                // Load ID for randomization
                interpDatas.Add(new InterpTools.InterpData(interpData1));
                interpDatas.Add(new InterpTools.InterpData(interpData2));
                interpDatas.Add(new InterpTools.InterpData(interpData3));


                // Chance the data for interp2/3
                var id2 = SeqTools.GetVariableLinksOfNode(interp2);
                id2[0].LinkedNodes[0] = interpData2;
                SeqTools.WriteVariableLinksToNode(interp2, id2);

                var id3 = SeqTools.GetVariableLinksOfNode(interp3);
                id3[0].LinkedNodes[0] = interpData3;
                SeqTools.WriteVariableLinksToNode(interp3, id3);

                // Add additional finished states for fadetoblack when done
                KismetHelper.CreateOutputLink(loungeP.GetUExport(958), "Finished", interp2, 2);
                KismetHelper.CreateOutputLink(loungeP.GetUExport(958), "Finished", interp3, 2);


                // Link up the random choice it makes
                var randSw = MERSeqTools.InstallRandomSwitchIntoSequence(sequence, 3);
                KismetHelper.CreateOutputLink(randSw, "Link 1", interp1);
                KismetHelper.CreateOutputLink(randSw, "Link 2", interp2);
                KismetHelper.CreateOutputLink(randSw, "Link 3", interp3);

                // Break the original output to start the interp, repoint it's output to the switch instead
                var sgm = loungeP.GetUExport(1003); //set gesture mode
                KismetHelper.RemoveOutputLinks(sgm);
                KismetHelper.CreateOutputLink(sgm, "Done", loungeP.GetUExport(960));
                KismetHelper.CreateOutputLink(sgm, "Done", randSw);

                // Now install the dances
                foreach (var id in interpDatas)
                {
                    var danceTrack = id.InterpGroups[0].Tracks[0];
                    OmegaHub.InstallShepardDanceGesture(danceTrack.Export, cache);
                }

                MERFileSystem.SavePackage(loungeP);
            }
        }
        public static bool RandomizeGalaxyMap(RandomizationOption option)
        {
            // Make the ship faster because otherwise it takes ages to do stuff
            // And can also consume more fuel

            var sfxgame = MERFileSystem.GetPackageFile("SFXGame.pcc");

            if (sfxgame != null && File.Exists(sfxgame))
            {
                var sfxgameP             = MEPackageHandler.OpenMEPackage(sfxgame);
                var galaxyModCamDefaults = sfxgameP.GetUExport(3899);
                var props = galaxyModCamDefaults.GetProperties();

                props.AddOrReplaceProp(new FloatProperty(150, "m_fMovementScalarGalaxy")); // is this used?
                props.AddOrReplaceProp(new FloatProperty(75, "m_fMovementScalarCluster"));
                props.AddOrReplaceProp(new FloatProperty(125, "m_fMovementScalarSystem"));

                galaxyModCamDefaults.WriteProperties(props);

                // Make it so you can't run out of a gas.
                if (option.HasSubOptionSelected(SUBOPTIONKEY_INFINITEGAS))
                {
                    var BurnFuel = sfxgameP.GetUExport(3877);
                    if (BurnFuel.ObjectName == "BurnFuel")
                    {
                        var bfData = BurnFuel.Data;
                        bfData.OverwriteRange(0x9C, BitConverter.GetBytes(50f)); // Make it so we don't run out of gas
                        BurnFuel.Data = bfData;
                    }
                }


                MERFileSystem.SavePackage(sfxgameP);
            }

            // Give a bit more starting gas
            // IDK why it's in Weapon
            // This doesn't seem to actually do anything. But i'll leave it here anyways
            var weaponini = CoalescedHandler.GetIniFile("BIOWeapon.ini");
            var sfxinvmgr = weaponini.GetOrAddSection("SFXGame.SFXInventoryManager");

            sfxinvmgr.SetSingleEntry("FuelEfficiency", 5);

            // Make faster deceleration cause its hard to stop right
            var biogameini = CoalescedHandler.GetIniFile("BIOGame.ini");
            var camgalaxy  = biogameini.GetOrAddSection("SFXGame.BioCameraBehaviorGalaxy");

            camgalaxy.SetSingleEntry("m_fShipSystemDeccel", 25);
            camgalaxy.SetSingleEntry("m_fShipClusterDeccel", .7f);

            var packageF = MERFileSystem.GetPackageFile(@"BioD_Nor_103aGalaxyMap.pcc");
            var package  = MEPackageHandler.OpenMEPackage(packageF);

            foreach (ExportEntry export in package.Exports)
            {
                switch (export.ClassName)
                {
                case "SFXCluster":
                {
                    var props     = export.GetProperties();
                    var starColor = props.GetProp <StructProperty>("StarColor");
                    if (starColor != null)
                    {
                        RStructs.RandomizeTint(starColor, false);
                    }
                    starColor = props.GetProp <StructProperty>("StarColor2");
                    if (starColor != null)
                    {
                        RStructs.RandomizeTint(starColor, false);
                    }

                    props.GetProp <IntProperty>("PosX").Value = ThreadSafeRandom.Next(800);
                    props.GetProp <IntProperty>("PosY").Value = ThreadSafeRandom.Next(800);


                    var intensity = props.GetProp <FloatProperty>("SphereIntensity");
                    if (intensity != null)
                    {
                        intensity.Value = ThreadSafeRandom.NextFloat(0, 6);
                    }
                    intensity = props.GetProp <FloatProperty>("NebularDensity");
                    if (intensity != null)
                    {
                        intensity.Value = ThreadSafeRandom.NextFloat(0, 6);
                    }
                    intensity = props.GetProp <FloatProperty>("SphereSize");
                    if (intensity != null)
                    {
                        intensity.Value = ThreadSafeRandom.NextFloat(0, 6);
                    }

                    export.WriteProperties(props);
                }
                    //RandomizeClustersXY(export);

                    break;

                case "SFXSystem":
                {
                    var props     = export.GetProperties();
                    var starColor = props.GetProp <StructProperty>("StarColor");
                    if (starColor != null)
                    {
                        RStructs.RandomizeTint(starColor, false);
                    }

                    starColor = props.GetProp <StructProperty>("FlareTint");
                    if (starColor != null)
                    {
                        RStructs.RandomizeTint(starColor, false);
                    }


                    starColor = props.GetProp <StructProperty>("SunColor");
                    if (starColor != null)
                    {
                        RStructs.RandomizeTint(starColor, false);
                    }

                    props.GetProp <IntProperty>("PosX").Value = ThreadSafeRandom.Next(1000);
                    props.GetProp <IntProperty>("PosY").Value = ThreadSafeRandom.Next(1000);


                    var scale = props.GetProp <FloatProperty>("Scale");
                    if (scale != null)
                    {
                        scale.Value = ThreadSafeRandom.NextFloat(.1, 2);
                    }


                    export.WriteProperties(props);
                }
                break;

                case "BioPlanet":
                {
                    var props     = export.GetProperties();
                    var starColor = props.GetProp <StructProperty>("SunColor");
                    if (starColor != null)
                    {
                        RStructs.RandomizeTint(starColor, false);
                    }

                    starColor = props.GetProp <StructProperty>("FlareTint");
                    if (starColor != null)
                    {
                        RStructs.RandomizeTint(starColor, false);
                    }


                    starColor = props.GetProp <StructProperty>("CloudColor");
                    if (starColor != null)
                    {
                        RStructs.RandomizeTint(starColor, false);
                    }

                    var resourceRichness = props.GetProp <FloatProperty>("ResourceRichness");
                    if (resourceRichness != null)
                    {
                        resourceRichness.Value = ThreadSafeRandom.NextFloat(0, 1.2);
                    }
                    else
                    {
                        props.AddOrReplaceProp(new FloatProperty(ThreadSafeRandom.NextFloat(0, .6), "ResourceRichness"));
                    }

                    props.GetProp <IntProperty>("PosX").Value = ThreadSafeRandom.Next(1000);
                    props.GetProp <IntProperty>("PosY").Value = ThreadSafeRandom.Next(1000);


                    var scale = props.GetProp <FloatProperty>("Scale");
                    if (scale != null)
                    {
                        scale.Value = ThreadSafeRandom.NextFloat(.1, 6);
                    }


                    export.WriteProperties(props);
                }
                break;

                case "MaterialInstanceConstant":
                    RMaterialInstance.RandomizeExport(export, null);
                    break;
                }
            }
            MERFileSystem.SavePackage(package);
            return(true);
        }