Example #1
0
 // Token: 0x0600381C RID: 14364 RVA: 0x000E7E28 File Offset: 0x000E6028
 public static void ParseSettings()
 {
     DefaultSettings = new Dictionary <string, string>()
     {
         { "Controller Bash Deadzone", "0.5" },
         { "Ability Menu Opacity", "0.5" },
         { "Instant Grenade Aim", "False" },
         { "Grenade Aim Speed", "1.0" },
         { "Cold Color", "0, 255, 255, 255" },
         { "Hot Color", "255, 85, 0, 255" },
         { "Invert Swim", "False" },
         { "Dev", "False" }
     };
     if (!File.Exists("RandomizerSettings.txt"))
     {
         RandomizerSettings.WriteDefaultFile();
     }
     try
     {
         List <string> unseenSettings = new List <string>(DefaultSettings.Keys);
         unseenSettings.Remove("Dev");
         List <string> writeList = new List <string>();
         string[]      lines     = File.ReadAllLines("RandomizerSettings.txt");
         // parse step 1: read settings from file
         foreach (string line in lines)
         {
             if (!line.Contains(":"))
             {
                 continue;
             }
             string[] parts   = line.Split(':');
             string   setting = parts[0].Trim();
             if (!DefaultSettings.ContainsKey(setting))
             {
                 continue;
             }
             string value = parts[1].Trim();
             ParseSettingLine(setting, value);
             unseenSettings.Remove(setting);
         }
         foreach (string missing in unseenSettings)
         {
             ParseSettingLine(missing, DefaultSettings[missing]);
             writeList.Add(missing);
         }
         if (writeList.Count > 0)
         {
             Randomizer.printInfo("Default Settings written for these missing settings: " + String.Join(", ", writeList.ToArray()), 480);
             string writeText = "";
             foreach (string writeKey in writeList)
             {
                 writeText += Environment.NewLine + writeKey + ": " + DefaultSettings[writeKey];
             }
             File.AppendAllText("RandomizerSettings.txt", writeText);
         }
     }
     catch (Exception e) {
         Randomizer.LogError("Error parsing settings: " + e.Message);
     }
 }
        public static RandomizerSettings GenerateFromFlags(string flags)
        {
            //I don't like generatefromflags there, will move it to here eventually
            var settings = new RandomizerSettings();

            settings.GenerateFromFlags(flags);
            return(settings);
        }
Example #3
0
        public static void GenerateRom(RandomizerSettings settings, Options o)
        {
            Console.WriteLine("Generating...", Color.Blue);
            //TODO we can remove the Seed param
            var romGenerator = new Hyrule(settings.GetRandomizerProperties(o.RomPath));

            romGenerator.GenerateRom();
            Console.WriteLine("Done...", Color.Green);
        }
Example #4
0
        string GenerateDefaultFilename(string rom, RandomizerSettings settings)
        {
            var baseName = rom.Substring(
                0,
                rom.LastIndexOf(".", StringComparison.InvariantCulture)
                );

            return($"{baseName}_{settings.SeedString}_{settings.FlagString}.nes");
        }
Example #5
0
    public static void ParseSettingLine(string setting, string value)
    {
        try {
            switch (setting)
            {
            case "Controller Bash Deadzone":
                RandomizerSettings.BashDeadzone = float.Parse(value);
                break;

            case "Ability Menu Opacity":
                RandomizerSettings.AbilityMenuOpacity = float.Parse(value);
                break;

            case "Instant Grenade Aim":
                RandomizerSettings.FastGrenadeAim = (value.Trim().ToLower() == "true");
                break;

            case "Grenade Aim Speed":
                RandomizerSettings.GrenadeAimSpeed = float.Parse(value);
                break;

            case "Cold Color":
                RandomizerSettings.ColdColor = RandomizerSettings.ParseColor(value);
                break;

            case "Hot Color":
                RandomizerSettings.HotColor = RandomizerSettings.ParseColor(value);
                break;

            case "Invert Swim":
                RandomizerSettings.InvertSwim = (value.Trim().ToLower() == "true");
                break;

            case "Dev":
                RandomizerSettings.Dev = (value.Trim().ToLower() == "true");
                break;

            case "Disco Sense":
                RandomizerSettings.DiscoSense = (value.Trim().ToLower() == "true");
                break;

            case "Cursor Lock":
                RandomizerSettings.CursorLock = (value.Trim().ToLower() == "true");
                break;
            }
        } catch (Exception) {
            ParseSettingLine(setting, DefaultSettings[setting]);
            Randomizer.printInfo("@" + setting + ": failed to parse value '" + value + "'. Using default value: '" + DefaultSettings[setting] + "'@", 240);
        }
    }
Example #6
0
        public static void GenerateFromJson(Options o)
        {
            try
            {
                var settings = JsonConvert.DeserializeObject <RandomizerSettings>(File.ReadAllText(o.JsonPath));
                if (o.Seed)
                {
                    settings.Seed = RandomizerSettings.GenerateSeed();
                }

                GenerateRom(settings, o);
            }
            catch (Exception e)
            {
                Error("Error generating file from json. You might want to double check the json file.", e);
            }
        }
Example #7
0
 // Token: 0x060037D1 RID: 14289
 public static void ParseSettings()
 {
     if (!File.Exists("RandomizerSettings.txt"))
     {
         RandomizerSettings.WriteDefaultFile();
     }
     try
     {
         if (!float.TryParse(File.ReadAllLines("RandomizerSettings.txt")[0].Split(new char[]
         {
             ':'
         })[1], out RandomizerSettings.BashDeadzone))
         {
             RandomizerSettings.LoadDefaultSettings();
         }
         RandomizerSettings.BashDeadzone = Math.Max(0f, Math.Min(1f, RandomizerSettings.BashDeadzone));
     }
     catch (Exception)
     {
         RandomizerSettings.LoadDefaultSettings();
     }
 }
Example #8
0
        private RandomizerSettings GetSettings(List <Rule> noteRules, List <Rule> mineRules)
        {
            var settings = new RandomizerSettings();

            //var panelConfig = new bool[,]
            //{
            //	{ true, false, true, false, false, false },
            //	{ true, false, true, false, false, false },
            //	{ true, false, true, false, false, false }
            //};
            //settings.panelConfig = panelConfig;

            settings.rhPath       = @"C:\Users\Tyler\AppData\Roaming\Rhythm Horizon\GameData\1c4823c6-f77c-4a20-9c5c-4877f5e80799.rhc";
            settings.panelConfig  = RandomizerTestUtil.config9Panel;
            settings.random       = new Random();
            settings.noteRules    = noteRules;
            settings.mineRules    = mineRules;
            settings.disableJumps = false;
            settings.disableMines = false;
            settings.disableHolds = false;

            return(settings);
        }
    public static void initialize()
    {
        Randomizer.OHKO                 = false;
        Randomizer.ZeroXP               = false;
        Randomizer.BonusActive          = true;
        Randomizer.GiveAbility          = false;
        Randomizer.Chaos                = false;
        Randomizer.ChaosVerbose         = false;
        Randomizer.Returning            = false;
        Randomizer.Sync                 = false;
        Randomizer.ForceMaps            = false;
        Randomizer.SyncMode             = 4;
        Randomizer.StringKeyPickupTypes = new List <string> {
            "TP", "SH", "NO", "WT", "MU", "HN", "WP", "RP", "WS"
        };
        Randomizer.ShareParams = "";
        RandomizerChaosManager.initialize();
        Randomizer.DamageModifier             = 1f;
        Randomizer.Table                      = new Hashtable();
        Randomizer.GridFactor                 = 4.0;
        Randomizer.Message                    = "Good luck on your rando!";
        Randomizer.MessageProvider            = (RandomizerMessageProvider)ScriptableObject.CreateInstance(typeof(RandomizerMessageProvider));
        Randomizer.ProgressiveMapStones       = true;
        Randomizer.ForceTrees                 = false;
        Randomizer.CluesMode                  = false;
        Randomizer.Shards                     = false;
        Randomizer.WorldTour                  = false;
        Randomizer.SeedMeta                   = "";
        Randomizer.MistySim                   = new WorldEvents();
        Randomizer.MistySim.MoonGuid          = new MoonGuid(1061758509, 1206015992, 824243626, -2026069462);
        Randomizer.TeleportTable              = new Hashtable();
        Randomizer.TeleportTable["Forlorn"]   = "forlorn";
        Randomizer.TeleportTable["Grotto"]    = "moonGrotto";
        Randomizer.TeleportTable["Sorrow"]    = "valleyOfTheWind";
        Randomizer.TeleportTable["Grove"]     = "spiritTree";
        Randomizer.TeleportTable["Swamp"]     = "swamp";
        Randomizer.TeleportTable["Valley"]    = "sorrowPass";
        Randomizer.TeleportTable["Ginso"]     = "ginsoTree";
        Randomizer.TeleportTable["Horu"]      = "mountHoru";
        Randomizer.TeleportTable["Glades"]    = "sunkenGlades";
        Randomizer.TeleportTable["Blackroot"] = "mangroveFalls";
        Randomizer.Entrance                   = false;
        Randomizer.DoorTable                  = new Hashtable();
        Randomizer.ColorShift                 = false;
        Randomizer.MessageQueue               = new Queue();
        Randomizer.MessageQueueTime           = 0;
        Randomizer.QueueBash                  = false;
        Randomizer.BashWasQueued              = false;
        Randomizer.BashTap                    = false;
        Randomizer.fragsEnabled               = false;
        Randomizer.LastTick                   = 10000000L;
        Randomizer.LockedCount                = 0;
        Randomizer.ResetTrackerCount          = 0;
        Randomizer.HotCold                    = false;
        Randomizer.HotColdTypes               = new string[] { "EV", "RB17", "RB19", "RB21", "RB28", "SK" };
        Randomizer.HotColdItems               = new Dictionary <int, RandomizerHotColdItem>();
        Randomizer.HotColdMaps                = new List <int>();
        int HotColdSaveId = 2000;

        Randomizer.HoruScene = "";
        Randomizer.HoruMap   = new Hashtable();
        Randomizer.HoruMap["mountHoruStomperSystemsR"]    = 2640380;
        Randomizer.HoruMap["mountHoruProjectileCorridor"] = 1720288;
        Randomizer.HoruMap["mountHoruMovingPlatform"]     = 3040304;
        Randomizer.HoruMap["mountHoruLaserTurretsR"]      = 2160192;
        Randomizer.HoruMap["mountHoruBlockableLasers"]    = -919624;
        Randomizer.HoruMap["mountHoruBigPushBlock"]       = -199724;
        Randomizer.HoruMap["mountHoruBreakyPathTop"]      = -1639664;
        Randomizer.HoruMap["mountHoruFallingBlocks"]      = -959848;
        Randomizer.OpenMode  = true;
        Randomizer.OpenWorld = false;
        RandomizerDataMaps.LoadGladesData();
        RandomizerDataMaps.LoadGinsoData();
        RandomizerDataMaps.LoadForlornData();
        RandomizerDataMaps.LoadHoruData();
        RandomizerDataMaps.LoadValleyData();
        RandomizerColorManager.Initialize();
        RandomizerPlantManager.Initialize();
        RandomizerRebinding.ParseRebinding();
        RandomizerSettings.ParseSettings();
        Randomizer.RelicZoneLookup = new Dictionary <string, string>();
        RandomizerTrackedDataManager.Initialize();
        RandomizerStatsManager.Initialize();
        Randomizer.RelicCount        = 0;
        Randomizer.GrenadeZone       = "MIA";
        Randomizer.StompZone         = "MIA";
        Randomizer.RepeatablePickups = new HashSet <int>();
        Randomizer.StompTriggers     = false;
        Randomizer.SpawnWith         = "";
        Randomizer.IgnoreEnemyExp    = false;
        bool relicCountOverride = false;

        try {
            if (File.Exists("randomizer.dat"))
            {
                string[] allLines = File.ReadAllLines("randomizer.dat");
                string[] flagLine = allLines[0].Split(new char[] { '|' });
                string   s        = flagLine[1];
                string[] flags    = flagLine[0].Split(new char[] { ',' });
                Randomizer.SeedMeta = allLines[0];
                foreach (string rawFlag in flags)
                {
                    string flag = rawFlag.ToLower();
                    if (flag == "ohko")
                    {
                        Randomizer.OHKO = true;
                    }
                    if (flag.StartsWith("worldtour"))
                    {
                        Randomizer.WorldTour = true;
                        if (flag.Contains("="))
                        {
                            relicCountOverride    = true;
                            Randomizer.RelicCount = int.Parse(flag.Substring(10));
                        }
                    }
                    if (flag.StartsWith("sync"))
                    {
                        Randomizer.Sync   = true;
                        Randomizer.SyncId = flag.Substring(4);
                        RandomizerSyncManager.Initialize();
                    }
                    if (flag.StartsWith("frags/"))
                    {
                        Randomizer.fragsEnabled = true;
                        string[] fragParams = flag.Split(new char[]
                        {
                            '/'
                        });
                        Randomizer.maxFrags      = int.Parse(fragParams[2]);
                        Randomizer.fragKeyFinish = int.Parse(fragParams[1]);
                    }
                    if (flag.StartsWith("mode="))
                    {
                        string modeStr = flag.Substring(5).ToLower();
                        int    syncMode;
                        if (modeStr == "shared")
                        {
                            syncMode = 1;
                        }
                        else if (modeStr == "none")
                        {
                            syncMode = 4;
                        }
                        else
                        {
                            syncMode = int.Parse(modeStr);
                        }
                        Randomizer.SyncMode = syncMode;
                    }
                    if (flag.StartsWith("shared="))
                    {
                        Randomizer.ShareParams = flag.Substring(7);
                    }
                    if (flag == "noextraexp")
                    {
                        Randomizer.IgnoreEnemyExp = true;
                    }
                    if (flag == "0xp")
                    {
                        Randomizer.IgnoreEnemyExp = true;
                        Randomizer.ZeroXP         = true;
                    }
                    if (flag == "nobonus")
                    {
                        Randomizer.BonusActive = false;
                    }
                    if (flag == "nonprogressivemapstones")
                    {
                        Randomizer.ProgressiveMapStones = false;
                    }
                    if (flag == "forcetrees")
                    {
                        Randomizer.ForceTrees = true;
                    }
                    if (flag == "forcemaps")
                    {
                        Randomizer.ForceMaps = true;
                    }
                    if (flag == "clues")
                    {
                        Randomizer.CluesMode = true;
                        RandomizerClues.initialize();
                    }
                    if (flag == "shards")
                    {
                        Randomizer.Shards = true;
                    }
                    if (flag == "entrance")
                    {
                        Randomizer.Entrance = true;
                    }
                    if (flag == "closeddungeons")
                    {
                        Randomizer.OpenMode = false;
                    }
                    if (flag == "openworld")
                    {
                        Randomizer.OpenWorld = true;
                    }
                    if (flag.StartsWith("hotcold="))
                    {
                        Randomizer.HotCold      = true;
                        Randomizer.HotColdTypes = flag.Substring(8).Split(new char[] { '+' });
                        Array.Sort(Randomizer.HotColdTypes);
                    }
                    if (flag.StartsWith("sense="))
                    {
                        Randomizer.HotColdTypes = flag.Substring(6).Split(new char[] { '+' });
                        Array.Sort(Randomizer.HotColdTypes);
                    }
                    if (flag == "noaltr")
                    {
                        Randomizer.AltRDisabled = true;
                    }
                    if (flag == "stomptriggers")
                    {
                        Randomizer.StompTriggers = true;
                    }
                }
                for (int i = 1; i < allLines.Length; i++)
                {
                    string[] lineParts = allLines[i].Split(new char[] { '|' });
                    int      coords;
                    int.TryParse(lineParts[0], out coords);
                    if (coords == 2)
                    {
                        SpawnWith = lineParts[1] + lineParts[2];
                        continue;
                    }
                    int index = Array.BinarySearch <string>(Randomizer.HotColdTypes, lineParts[1]);
                    if (index < 0)
                    {
                        index = -index - 1;
                    }
                    while (index < Randomizer.HotColdTypes.Length && Randomizer.HotColdTypes[index].Substring(0, 2) == lineParts[1])
                    {
                        if (Randomizer.HotColdTypes[index] == lineParts[1] || Randomizer.HotColdTypes[index].Substring(2) == lineParts[2])
                        {
                            if (Math.Abs(coords) > 100)
                            {
                                Randomizer.HotColdItems.Add(coords, new RandomizerHotColdItem(Randomizer.HashKeyToVector(coords), HotColdSaveId));
                                HotColdSaveId++;
                            }
                            else
                            {
                                Randomizer.HotColdMaps.Add(coords);
                            }
                        }
                        index++;
                    }
                    if (Randomizer.StringKeyPickupTypes.Contains(lineParts[1]))
                    {
                        Randomizer.Table[coords] = new RandomizerAction(lineParts[1], lineParts[2]);
                        if (lineParts[1] == "WT")
                        {
                            Randomizer.RelicZoneLookup[lineParts[2]] = lineParts[3];
                            if (!relicCountOverride)
                            {
                                Randomizer.RelicCount++;
                            }
                        }
                        if (lineParts[1] == "RP")
                        {
                            Randomizer.RepeatablePickups.Add(coords);
                        }
                    }
                    else
                    {
                        int id;
                        int.TryParse(lineParts[2], out id);
                        if (lineParts[1] == "EN")
                        {
                            // door entries are coord|EN|targetX|targetY
                            int doorY;
                            int.TryParse(lineParts[3], out doorY);
                            Randomizer.DoorTable[coords] = new Vector3((float)id, (float)doorY);
                        }
                        else
                        {
                            Randomizer.Table[coords] = new RandomizerAction(lineParts[1], id);
                            if (lineParts[1] == "SK")
                            {
                                if (id == 51)
                                {
                                    GrenadeZone = lineParts[3];
                                }
                                else if (id == 4)
                                {
                                    StompZone = lineParts[3];
                                }
                            }
                            if (Randomizer.CluesMode && lineParts[1] == "EV" && id % 2 == 0)
                            {
                                RandomizerClues.AddClue(lineParts[3], id / 2);
                            }
                        }
                    }
                }
                Randomizer.HotColdMaps.Sort();
                if (Randomizer.CluesMode)
                {
                    RandomizerClues.FinishClues();
                }
            }
            else
            {
                Randomizer.printInfo("Error: randomizer.dat not found");
            }
        }
        catch (Exception e) {
            Randomizer.printInfo("Error parsing randomizer.dat:" + e.Message, 300);
        }
        RandomizerBonusSkill.Reset();
    }
Example #10
0
        //string path = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\tmos_goodseeds.txt";
        // File outputFile = new File(path);

        //File RomFile;
        public RandomizeScript(FileStream romFileStream, RandomizerSettings randomizerSettings)
        {
        }
Example #11
0
    // Token: 0x06000174 RID: 372
    public void UpdateSwimMovingUnderwaterState()
    {
        this.UpdateDrowning();
        if (this.UnderwaterSwimmingSoundProvider && !this.UnderwaterSwimmingSoundProvider.IsPlaying)
        {
            this.UnderwaterSwimmingSoundProvider.Play();
        }
        this.m_sein.PlatformBehaviour.PlatformMovement.ForceKeepInAir = true;
        Vector2 vector = (!this.m_sein.Controller.CanMove) ? Vector2.zero : this.m_sein.Input.Axis;

        this.m_swimAccelerationTime += 2f * Time.deltaTime;
        Vector2 vector2 = Vector3.down * this.MaxFallSpeed;

        if (vector.magnitude > 0.3f)
        {
            this.m_swimIdleTime = 0f;
            vector.Normalize();
            float   swimAngle = this.SwimAngle;
            Vector2 v         = MoonMath.Angle.VectorFromAngle(this.SwimAngle);
            if (Vector3.Dot(-vector, v) > Mathf.Cos(1.04719758f))
            {
                if (this.IsUpsideDown)
                {
                    this.HorizontalVerticalFlip();
                }
                else
                {
                    this.HorizontalFlip();
                }
            }
            else
            {
                float target = MoonMath.Angle.AngleFromVector(vector);
                this.SwimAngle = Mathf.MoveTowardsAngle(this.SwimAngle, target, this.SwimAngleDeltaLimit * Time.deltaTime);
                vector         = MoonMath.Angle.VectorFromAngle(this.SwimAngle);
                vector2        = vector * this.SwimSpeed;
                if (this.m_sein.Controller.CanMove && RandomizerSettings.IsSwimBoosting())
                {
                    this.m_isBoosting = true;
                    this.m_boostTime  = Mathf.Min(this.m_boostTime, this.BoostPeakTime);
                }
                if (this.m_sein.Controller.CanMove && RandomizerSettings.SwimBoostPressed() && this.m_boostAnimationRemainingTime <= 0f && this.BoostSwimsoundProvider)
                {
                    Sound.Play(this.BoostSwimsoundProvider.GetSound(null), base.transform.position, null);
                    this.m_boostAnimationRemainingTime = 0.6666667f;
                }
                if (this.m_isBoosting)
                {
                    this.m_boostTime += Time.deltaTime / this.BoostDuration;
                    vector2          *= this.SwimSpeedBoostCurve.Evaluate(this.m_boostTime);
                }
                if (this.m_isBoosting && this.m_boostTime > this.BoostDuration)
                {
                    this.m_isBoosting = false;
                    this.m_boostTime  = 0f;
                }
            }
            float b = MoonMath.Angle.AngleSubtract(this.SwimAngle, swimAngle) / Time.deltaTime;
            this.SmoothAngleDelta = Mathf.Lerp(this.SmoothAngleDelta, b, 0.1f);
        }
        else
        {
            if (this.m_swimAccelerationTime > 0f)
            {
                this.m_swimAccelerationTime = 0f;
            }
            if (this.m_isBoosting)
            {
                this.m_isBoosting = false;
                this.m_boostTime  = 0f;
                this.m_boostAnimationRemainingTime = 0f;
            }
            if (this.m_swimIdleTime > 0.1f)
            {
                this.m_swimMovingTime = 0f;
                if (this.m_swimAccelerationTime > 0f)
                {
                    this.m_swimAccelerationTime = 0f;
                }
                if (this.IsUpsideDown)
                {
                    this.VerticalFlip();
                }
                bool  faceLeft = this.m_sein.Controller.FaceLeft;
                float target2  = (float)((!faceLeft) ? 0 : 180);
                if (MoonMath.Angle.AngleSubtract(this.SwimAngle, target2) > 0f)
                {
                    this.m_sein.PlatformBehaviour.Visuals.Animation.Play(faceLeft ? this.Animations.SwimMiddleToIdleClockwise : this.Animations.SwimMiddleToIdleAntiClockwise, 10, new Func <bool>(this.ShouldIdleUnderwaterAnimationPlay));
                }
                else
                {
                    this.m_sein.PlatformBehaviour.Visuals.Animation.Play((!faceLeft) ? this.Animations.SwimMiddleToIdleClockwise : this.Animations.SwimMiddleToIdleAntiClockwise, 10, new Func <bool>(this.ShouldIdleUnderwaterAnimationPlay));
                }
                this.ChangeState(SeinSwimming.State.SwimIdleUnderwater);
            }
            this.m_swimIdleTime += Time.deltaTime;
        }
        this.PlatformMovement.LocalSpeed = Vector3.Lerp(this.PlatformMovement.LocalSpeed, vector2, this.AccelerationOverTime.Evaluate(this.m_swimAccelerationTime));
        if (this.IsUpsideDown && Math.Abs(this.SmoothAngleDelta) < 10f)
        {
            this.VerticalFlip();
        }
        this.ApplySwimmingUnderwaterStuff();
        if (this.m_boostAnimationRemainingTime > 0f)
        {
            this.m_boostAnimationRemainingTime -= Time.deltaTime;
            int min = Mathf.RoundToInt(this.Animations.AnimationFromBend.Evaluate(this.SmoothAngleDelta * (float)((!this.m_sein.Controller.FaceLeft) ? -1 : 1)) * (float)(this.Animations.SwimJumpLeft.Length - 1));
            int num = Mathf.Clamp(0, min, this.Animations.SwimJumpLeft.Length - 1);
            this.m_sein.PlatformBehaviour.Visuals.Animation.PlayLoop(this.Animations.SwimJumpLeft[num], 9, new Func <bool>(this.ShouldSwimUnderwaterAnimationPlay), true);
        }
        else
        {
            int min2 = Mathf.RoundToInt(this.Animations.AnimationFromBend.Evaluate(this.SmoothAngleDelta * (float)((!this.m_sein.Controller.FaceLeft) ? -1 : 1)) * (float)(this.Animations.SwimHorizontal.Length - 1));
            int num2 = Mathf.Clamp(0, min2, this.Animations.SwimHorizontal.Length - 1);
            this.m_sein.PlatformBehaviour.Visuals.Animation.PlayLoop(this.Animations.SwimHorizontal[num2], 9, new Func <bool>(this.ShouldSwimUnderwaterAnimationPlay), true);
        }
        this.HandleLeavingWater();
    }
Example #12
0
        int OnExecute(IConsole console)
        {
            RandomizerSettings settings;

            if (!String.IsNullOrEmpty(Preset))
            {
                try
                {
                    settings = new RandomizerSettings(
                        Seed,
                        FFR.Common.Presets.Load(Preset).Flags
                        );
                }
                catch (System.IO.FileNotFoundException)
                {
                    console.Error.WriteLine($"Preset not found: '{Preset}'");
                    return(1);
                }
            }
            else if (!String.IsNullOrEmpty(Import))
            {
                try
                {
                    settings = RandomizerSettings.FromImportString(Import);
                }
                catch
                {
                    console.Error.WriteLine("Ensure that you are using an import string in a format as supplied by crim_bot or the finalfantasyrandomizer.com web version.");
                    return(1);
                }
            }
            else
            {
                try
                {
                    settings = new RandomizerSettings(Seed, FlagString);
                }
                catch (Exception e)
                {
                    console.Error.WriteLine(e.ToString());
                    console.Error.WriteLine("Ensure that you are using an 8 character hexadecimal string as a seed and a valid base64 encoded set of flags.");
                    return(1);
                }
            }

            var outFile = String.IsNullOrEmpty(OutFile)
                                ? GenerateDefaultFilename(RomPath, settings)
                                : OutFile;

            var rom = new FF1Rom(RomPath);

            rom.Randomize(settings.Seed, settings.Flags);
            rom.Save(outFile);

            if (Verbose)
            {
                console.WriteLine($"Seed: {settings.Seed.ToHex()}");
                console.WriteLine($"Flags: {Flags.EncodeFlagsText(settings.Flags)}");
                console.WriteLine($"ROM created at: {outFile}");
            }

            return(0);
        }
Example #13
0
    // Token: 0x0600373B RID: 14139
    public static void initialize()
    {
        Randomizer.OHKO         = false;
        Randomizer.ZeroXP       = false;
        Randomizer.BonusActive  = true;
        Randomizer.GiveAbility  = false;
        Randomizer.Chaos        = false;
        Randomizer.ChaosVerbose = false;
        Randomizer.Returning    = false;
        Randomizer.Sync         = false;
        Randomizer.SyncMode     = 1;
        Randomizer.ShareParams  = "";
        RandomizerChaosManager.initialize();
        Randomizer.DamageModifier           = 1f;
        Randomizer.Table                    = new Hashtable();
        Randomizer.GridFactor               = 4.0;
        Randomizer.Message                  = "Good luck on your rando!";
        Randomizer.MessageProvider          = (RandomizerMessageProvider)ScriptableObject.CreateInstance(typeof(RandomizerMessageProvider));
        Randomizer.ProgressiveMapStones     = true;
        Randomizer.ForceTrees               = false;
        Randomizer.CluesMode                = false;
        Randomizer.SeedMeta                 = "";
        Randomizer.MistySim                 = new WorldEvents();
        Randomizer.MistySim.MoonGuid        = new MoonGuid(1061758509, 1206015992, 824243626, -2026069462);
        Randomizer.TeleportTable            = new Hashtable();
        Randomizer.TeleportTable["Forlorn"] = "forlorn";
        Randomizer.TeleportTable["Grotto"]  = "moonGrotto";
        Randomizer.TeleportTable["Sorrow"]  = "valleyOfTheWind";
        Randomizer.TeleportTable["Grove"]   = "spiritTree";
        Randomizer.TeleportTable["Swamp"]   = "swamp";
        Randomizer.TeleportTable["Valley"]  = "sorrowPass";
        Randomizer.Entrance                 = false;
        Randomizer.DoorTable                = new Hashtable();
        Randomizer.ColorShift               = false;
        Randomizer.MessageQueue             = new Queue();
        Randomizer.MessageQueueTime         = 0;
        Randomizer.QueueBash                = false;
        Randomizer.BashWasQueued            = false;
        Randomizer.BashTap                  = false;
        bool flag = false;

        RandomizerRebinding.ParseRebinding();
        RandomizerSettings.ParseSettings();
        if (File.Exists("randomizer.dat"))
        {
            string[] array  = File.ReadAllLines("randomizer.dat");
            string[] array3 = array[0].Split(new char[]
            {
                '|'
            })[0].Split(new char[]
            {
                ','
            });
            Randomizer.SeedMeta = array[0];
            foreach (string text in array3)
            {
                if (text.ToLower() == "ohko")
                {
                    Randomizer.OHKO = true;
                }
                if (text.ToLower().StartsWith("sync"))
                {
                    Randomizer.Sync   = true;
                    Randomizer.SyncId = text.Substring(4);
                    RandomizerSyncManager.Initialize();
                }
                if (text.ToLower().StartsWith("mode="))
                {
                    string text2 = text.Substring(5).ToLower();
                    int    syncMode;
                    if (text2 == "shared")
                    {
                        syncMode = 1;
                    }
                    else if (text2 == "swap")
                    {
                        syncMode = 2;
                    }
                    else if (text2 == "split")
                    {
                        syncMode = 3;
                    }
                    else if (text2 == "none")
                    {
                        syncMode = 4;
                    }
                    else
                    {
                        syncMode = int.Parse(text2);
                    }
                    Randomizer.SyncMode = syncMode;
                }
                if (text.ToLower().StartsWith("shared="))
                {
                    Randomizer.ShareParams = text.Substring(7);
                }
                if (text.ToLower() == "0xp")
                {
                    Randomizer.ZeroXP = true;
                }
                if (text.ToLower() == "nobonus")
                {
                    Randomizer.BonusActive = false;
                }
                if (text.ToLower() == "nonprogressivemapstones")
                {
                    Randomizer.ProgressiveMapStones = false;
                }
                if (text.ToLower() == "forcetrees")
                {
                    Randomizer.ForceTrees = true;
                }
                if (text.ToLower() == "clues")
                {
                    Randomizer.CluesMode = true;
                    RandomizerClues.initialize();
                }
                if (text.ToLower() == "entrance")
                {
                    Randomizer.Entrance = true;
                }
                if (text.ToLower() == "encrypted")
                {
                    flag = true;
                }
            }
            if (flag)
            {
                array = Decoder.Decode(array[1]);
            }
            for (int i = 1; i < array.Length; i++)
            {
                if (!(array[i].Trim() == ""))
                {
                    string[] array2 = array[i].Split(new char[]
                    {
                        '|'
                    });
                    int num;
                    int.TryParse(array2[0], out num);
                    if (array2[1] == "TP")
                    {
                        Randomizer.Table[num] = new RandomizerAction(array2[1], array2[2]);
                    }
                    else
                    {
                        int num2;
                        int.TryParse(array2[2], out num2);
                        if (array2[1] == "EN")
                        {
                            int num3;
                            int.TryParse(array2[3], out num3);
                            Randomizer.DoorTable[num] = new Vector3((float)num2, (float)num3);
                        }
                        else
                        {
                            Randomizer.Table[num] = new RandomizerAction(array2[1], num2);
                            if (Randomizer.CluesMode && array2[1] == "EV" && num2 % 2 == 0)
                            {
                                RandomizerClues.AddClue(array2[3], num2 / 2);
                            }
                        }
                    }
                }
            }
        }
    }