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();
    }
Exemple #2
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);
                            }
                        }
                    }
                }
            }
        }
    }