コード例 #1
0
        public static bool RandomizeWeapons(RandomizationOption option)
        {
            var me2rbioweapon = CoalescedHandler.GetIniFile("BIOWeapon.ini");

            // We must manually fetch game files cause MERFS will return the ini from the dlc mod instead.
            ME2Coalesced me2basegamecoalesced = new ME2Coalesced(MERFileSystem.GetSpecificFile(@"BioGame\Config\PC\Cooked\Coalesced.ini"));

            MERLog.Information("Randomizing basegame weapon ini");
            var bioweapon = me2basegamecoalesced.Inis.FirstOrDefault(x => Path.GetFileName(x.Key) == "BIOWeapon.ini").Value;

            RandomizeWeaponIni(bioweapon, me2rbioweapon);

            var weaponInis = Directory.GetFiles(MEDirectories.GetDLCPath(MERFileSystem.Game), "BIOWeapon.ini", SearchOption.AllDirectories).ToList();

            foreach (var wi in weaponInis)
            {
                if (wi.Contains($"DLC_MOD_{MERFileSystem.Game}Randomizer"))
                {
                    continue; // Skip randomizer folders
                }
                MERLog.Information($@"Randomizing weapon ini {wi}");
                //Log.Information("Randomizing weapons in ini: " + wi);
                var dlcWeapIni = DuplicatingIni.LoadIni(wi);
                RandomizeWeaponIni(dlcWeapIni, me2rbioweapon);
                //if (!MERFileSystem.UsingDLCModFS)
                //{
                //    Log.Information("Writing DLC BioWeapon: " + wi);
                //    File.WriteAllText(wi, dlcWeapIni.ToString());
                //}
            }

            return(true);
        }
コード例 #2
0
        public static bool PerformRandomization(RandomizationOption option)
        {
            var ini = CoalescedHandler.GetIniFile("BioGame.ini");

            var section = ini.GetOrAddSection("SFXGame.SFXVehicleHover");

            section.SetSingleEntry("JumpForce", GenerateRandomVectorStruct(-400, 400, 0, 0, 1200, 4000));
            section.SetSingleEntry("OnGroundJumpMultiplier", ThreadSafeRandom.NextFloat(.5, 2));
            section.SetSingleEntry("MaxThrustJuice", ThreadSafeRandom.NextFloat(0.5, 1));
            section.SetSingleEntry("BoostForce", GenerateRandomVectorStruct(600, 2000, 0, 0, -200, 50));
            section.SetSingleEntry("ThrustRegenerationFactor", ThreadSafeRandom.NextFloat(0.45, 0.7));
            section.SetSingleEntry("SelfRepairRate", ThreadSafeRandom.NextFloat(50, 150));
            section.SetSingleEntry("SelfRepairDelay", ThreadSafeRandom.NextFloat(3, 8));
            section.SetSingleEntry("OffGroundForce", GenerateRandomVectorStruct(0, 0, 0, 0, -2200, -10));
            section.SetSingleEntry("ThrustRegenerationDelay", ThreadSafeRandom.NextFloat(0.2, 1));
            section.SetSingleEntry("VerticalThrustBurnRate", ThreadSafeRandom.NextFloat(0.5, 1.5));
            section.SetSingleEntry("BurnOutPercentage", ThreadSafeRandom.NextFloat(0.1, 0.3));
            section.SetSingleEntry("MaxPitchAngle", ThreadSafeRandom.NextFloat(25, 55));

            ini     = CoalescedHandler.GetIniFile("BioWeapon.ini");
            section = ini.GetOrAddSection("SFXGameContent_Inventory.SFXHeavyWeapon_VehicleMissileLauncher");
            section.SetSingleEntry("Damage", ThreadSafeRandom.NextFloat(200, 500));
            section.SetSingleEntry("RateOfFire", ThreadSafeRandom.NextFloat(100, 300));
            return(true);
        }
コード例 #3
0
        public static bool RandomizeSquadmateWeapons(RandomizationOption option)
        {
            var bg             = CoalescedHandler.GetIniFile("BIOGame.ini");
            var loadoutSection = bg.GetOrAddSection("SFXGame.SFXPlayerSquadLoadoutData");

            // We need to minus them out
            loadoutSection.Entries.Add(new DuplicatingIni.IniEntry("!PlayerLoadoutInfo", "CLEAR"));
            loadoutSection.Entries.Add(new DuplicatingIni.IniEntry("!HenchLoadoutInfo", "CLEAR"));


            var pawns = new[]
            {
                "SFXPawn_PlayerAdept",
                "SFXPawn_PlayerEngineer",
                "SFXPawn_PlayerSoldier",
                "SFXPawn_PlayerSentinel",
                "SFXPawn_PlayerInfiltrator",
                "SFXPawn_PlayerVanguard",
                "SFXPawn_Garrus",
                "SFXPawn_Grunt",
                "SFXPawn_Jack",
                "SFXPawn_Jacob",
                "SFXPawn_Legion",
                "SFXPawn_Miranda",
                "SFXPawn_Mordin",
                "SFXPawn_Samara",
                "SFXPawn_Tali",
                "SFXPawn_Thane",
                "SFXPawn_Wilson", //Not used afaik

                // DLC
                "SFXPawn_Zaeed",  //VT
                "SFXPawn_Kasumi", //MT
                "SFXPawn_Liara",  //EXP_Part01
            };

            foreach (var p in pawns)
            {
                loadoutSection.Entries.Add(BuildLoadout(p));
            }

            return(true);
        }
コード例 #4
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);
        }
コード例 #5
0
        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);
        }
コード例 #6
0
        public static bool RandomizeCharacterCreator(RandomizationOption option)
        {
            var biop_charF         = MERFileSystem.GetPackageFile(@"BioP_Char.pcc");
            var biop_char          = MEPackageHandler.OpenMEPackage(biop_charF);
            var maleFrontEndData   = biop_char.GetUExport(18753);
            var femaleFrontEndData = biop_char.GetUExport(18754);

            var codeMapMale   = CalculateCodeMap(maleFrontEndData);
            var codeMapFemale = CalculateCodeMap(femaleFrontEndData);

            var bioUI                  = CoalescedHandler.GetIniFile("BIOUI.ini");
            var bgr                    = CoalescedHandler.GetIniFile("BIOGuiResources.ini");
            var charCreatorPCS         = bgr.GetOrAddSection("SFXGame.BioSFHandler_PCNewCharacter");
            var charCreatorControllerS = bioUI.GetOrAddSection("SFXGame.BioSFHandler_NewCharacter");

            charCreatorPCS.Entries.Add(new DuplicatingIni.IniEntry("!MalePregeneratedHeadCodes", "CLEAR"));
            charCreatorControllerS.Entries.Add(new DuplicatingIni.IniEntry("!MalePregeneratedHeadCodes", "CLEAR"));

            int numToMake = 20;
            int i         = 0;

            // Male: 34 chars
            while (i < numToMake)
            {
                i++;
                charCreatorPCS.Entries.Add(GenerateHeadCode(codeMapMale, false));
                charCreatorControllerS.Entries.Add(GenerateHeadCode(codeMapMale, false));
            }



            // Female: 36 chars
            charCreatorPCS.Entries.Add(new DuplicatingIni.IniEntry(""));         //blank line
            charCreatorControllerS.Entries.Add(new DuplicatingIni.IniEntry("")); //blank line
            charCreatorPCS.Entries.Add(new DuplicatingIni.IniEntry("!FemalePregeneratedHeadCodes", "CLEAR"));
            charCreatorControllerS.Entries.Add(new DuplicatingIni.IniEntry("!FemalePregeneratedHeadCodes", "CLEAR"));
            charCreatorPCS.Entries.Add(new DuplicatingIni.IniEntry("!FemalePregeneratedHeadCodes", "CLEAR"));

            i = 0;
            while (i < numToMake)
            {
                i++;
                charCreatorPCS.Entries.Add(GenerateHeadCode(codeMapFemale, true));
                charCreatorControllerS.Entries.Add(GenerateHeadCode(codeMapFemale, true));
            }


            randomizeFrontEnd(maleFrontEndData);
            randomizeFrontEnd(femaleFrontEndData);


            //Copy the final skeleton from female into male.
            var femBase  = biop_char.GetUExport(3480);
            var maleBase = biop_char.GetUExport(3481);

            maleBase.WriteProperty(femBase.GetProperty <ArrayProperty <StructProperty> >("m_aFinalSkeleton"));

            var randomizeColors = !option.HasSubOptionSelected(CharacterCreator.SUBOPTIONKEY_CHARCREATOR_NO_COLORS);

            foreach (var export in biop_char.Exports)
            {
                if (export.ClassName == "BioMorphFace" && !export.ObjectName.Name.Contains("Iconic"))
                {
                    RBioMorphFace.RandomizeExportNonHench(export, SuperRandomOption); //.3 default
                }
                else if (export.ClassName == "MorphTarget")
                {
                    if (
                        export.ObjectName.Name.StartsWith("jaw") || export.ObjectName.Name.StartsWith("mouth") ||
                        export.ObjectName.Name.StartsWith("eye") ||
                        export.ObjectName.Name.StartsWith("cheek") ||
                        export.ObjectName.Name.StartsWith("nose") ||
                        export.ObjectName.Name.StartsWith("teeth")
                        )
                    {
                        RMorphTarget.RandomizeExport(export, option);
                    }
                }
                else if (export.ClassName == "BioMorphFaceFESliderColour" && randomizeColors)
                {
                    var colors = export.GetProperty <ArrayProperty <StructProperty> >("m_acColours");
                    foreach (var color in colors)
                    {
                        RStructs.RandomizeColor(color, true, .5, 1.5);
                    }
                    export.WriteProperty(colors);
                }
                else if (export.ClassName == "BioMorphFaceFESliderMorph")
                {
                    // These don't work becuase of the limits in the morph system
                    // So all this does is change how much the values change, not the max/min
                }
                else if (export.ClassName == "BioMorphFaceFESliderScalar" || export.ClassName == "BioMorphFaceFESliderSetMorph")
                {
                    //no idea how to randomize this lol
                    var floats   = export.GetProperty <ArrayProperty <FloatProperty> >("m_afValues");
                    var minfloat = floats.Min();
                    var maxfloat = floats.Max();
                    if (minfloat == maxfloat)
                    {
                        if (minfloat == 0)
                        {
                            maxfloat = 1;
                        }
                        else
                        {
                            var vari = minfloat / 2;
                            maxfloat = ThreadSafeRandom.NextFloat(-vari, vari) + minfloat; //+/- 50%
                        }
                    }
                    foreach (var floatval in floats)
                    {
                        floatval.Value = ThreadSafeRandom.NextFloat(minfloat, maxfloat);
                    }
                    export.WriteProperty(floats);
                }
                else if (export.ClassName == "BioMorphFaceFESliderTexture")
                {
                }
            }
            MERFileSystem.SavePackage(biop_char);
            return(true);
        }