예제 #1
0
 public static void OnSave()
 {
     if (Randomizer.Sync)
     {
         RandomizerSyncManager.onSave();
     }
     RandomizerBonusSkill.OnSave();
 }
 // Token: 0x0600116F RID: 4463
 public void OnRespawn()
 {
     if (Randomizer.Sync)
     {
         RandomizerSyncManager.onDeath();
     }
     InstantiateUtility.Instantiate(this.RespawnEffect, this.m_sein.Transform.position, Quaternion.identity);
     this.m_sein.Mortality.DamageReciever.MakeInvincible(1f);
 }
예제 #3
0
 public static void OnDeath()
 {
     if (Randomizer.Sync)
     {
         RandomizerSyncManager.onDeath();
     }
     RandomizerBonusSkill.OnDeath();
     RandomizerTrackedDataManager.UpdateBitfields();
     RandomizerStatsManager.OnDeath();
 }
예제 #4
0
    public static void GivePickup(RandomizerAction Action, int coords, bool found_locally = true)
    {
        if (found_locally && Randomizer.Sync)
        {
            RandomizerSyncManager.FoundPickup(Action, coords);
        }

        switch (Action.Action)
        {
        case "AC":
            SkillPointPickup();
            break;

        case "EC":
            MaxEnergyContainerPickup();
            break;

        case "EX":
            ExpOrbPickup((int)Action.Value);
            break;

        case "KS":
            KeystonePickup();
            break;

        case "HC":
            MaxHealthContainerPickup();
            break;

        case "MS":
            MapStonePickup();
            break;

        case "SK":
            AbilityPickup((int)Action.Value);
            break;

        case "EV":
            EventPickup((int)Action.Value);
            break;

        case "RB":
            RandomizerBonus.UpgradeID((int)Action.Value);
            break;

        case "TP":
            TeleportPickup((string)Action.Value);
            break;

        case "NO":
            Randomizer.showHint("Nothing");
            return;
        }
    }
예제 #5
0
 // Token: 0x06002CE9 RID: 11497 RVA: 0x000C3C3C File Offset: 0x000C1E3C
 public static void Activate(string identifier, bool natural)
 {
     if (natural)
     {
         RandomizerSyncManager.FoundTP(identifier);
     }
     BingoController.OnActivateTeleporter(identifier);
     foreach (GameMapTeleporter gameMapTeleporter in TeleporterController.Instance.Teleporters)
     {
         if (gameMapTeleporter.Identifier == identifier)
         {
             gameMapTeleporter.Activated = true;
         }
     }
 }
예제 #6
0
 // Token: 0x06003540 RID: 13632 RVA: 0x000D9724 File Offset: 0x000D7924
 public void PerformSave()
 {
     if (!this.CanPerformSave())
     {
         return;
     }
     if (Randomizer.Sync)
     {
         RandomizerSyncManager.onSave();
     }
     SaveSlotsManager.CurrentSaveSlot.FillData();
     SaveSlotsManager.BackupIndex = -1;
     this.SaveToFile(this.CurrentSaveFilePath);
     if (Recorder.IsRecordering)
     {
         Recorder.Instance.OnPerformSave();
     }
 }
	// Token: 0x06003798 RID: 14232
	public static void CheckPickups(object sender, DownloadStringCompletedEventArgs e)
	{
		if (!e.Cancelled && e.Error == null)
		{
			string[] array = e.Result.Split(new char[]
			{
				','
			});
			int bf = int.Parse(array[0]);
			foreach (RandomizerSyncManager.SkillInfoLine skillInfoLine in RandomizerSyncManager.SkillInfos)
			{
				if (RandomizerSyncManager.getBit(bf, skillInfoLine.bit) && !Characters.Sein.PlayerAbilities.HasAbility(skillInfoLine.skill))
				{
					RandomizerSwitch.GivePickup(new RandomizerAction("SK", skillInfoLine.id), 0, false);
				}
			}
			int bf2 = int.Parse(array[1]);
			foreach (RandomizerSyncManager.EventInfoLine eventInfoLine in RandomizerSyncManager.EventInfos)
			{
				if (RandomizerSyncManager.getBit(bf2, eventInfoLine.bit) && !eventInfoLine.checker())
				{
					RandomizerSwitch.GivePickup(new RandomizerAction("EV", eventInfoLine.id), 0, false);
				}
			}
			int bf3 = int.Parse(array[2]);
			foreach (RandomizerSyncManager.UpgradeInfoLine upgradeInfoLine in RandomizerSyncManager.UpgradeInfos)
			{
				if (upgradeInfoLine.stacks)
				{
					if (RandomizerSyncManager.getTaste(bf3, upgradeInfoLine.bit) > upgradeInfoLine.counter())
					{
						RandomizerSwitch.GivePickup(new RandomizerAction("RB", upgradeInfoLine.id), 0, false);
					}
				}
				else if (RandomizerSyncManager.getBit(bf3, upgradeInfoLine.bit) && 1 != upgradeInfoLine.counter())
				{
					RandomizerSwitch.GivePickup(new RandomizerAction("RB", upgradeInfoLine.id), 0, false);
				}
			}
			int bf4 = int.Parse(array[3]);
			foreach (RandomizerSyncManager.TeleportInfoLine teleportInfoLine in RandomizerSyncManager.TeleportInfos)
			{
				if (RandomizerSyncManager.getBit(bf4, teleportInfoLine.bit) && !RandomizerSyncManager.isTeleporterActivated(teleportInfoLine.id))
				{
					RandomizerSwitch.GivePickup(new RandomizerAction("TP", teleportInfoLine.id), 0, false);
				}
			}
			if (array.Length > 4)
			{
				foreach (string text in array[4].Split('|'))
				{
					if (text == "stop")
					{
						RandomizerChaosManager.ClearEffects();
					} else if( text.StartsWith("msg:")) {
						Randomizer.showHint(text.Substring(4));
					}
					else if(text == "spawnChaos")
					{
						Randomizer.ChaosVerbose = true;
						RandomizerChaosManager.SpawnEffect();
						RandomizerSyncManager.ChaosTimeoutCounter = 3600;
					}
					RandomizerSyncManager.webClient.DownloadStringAsync(new Uri(RandomizerSyncManager.SERVER_ROOT + Randomizer.SyncId + "/signalCallback/" + text));
				}
			}
			return;
		}
		if (e.Error.GetType().Name == "WebException" && ((HttpWebResponse)((WebException)e.Error).Response).StatusCode == HttpStatusCode.PreconditionFailed)
				Randomizer.showHint("Co-op server error, try reloading the seed (Alt+L)");
				return;
		}
예제 #8
0
 public static void Update()
 {
     Randomizer.UpdateMessages();
     if (Characters.Sein && SkillTreeManager.Instance != null && SkillTreeManager.Instance.NavigationManager.IsVisible)
     {
         if (Characters.Sein.IsSuspended)
         {
             SkillTreeManager.Instance.NavigationManager.FadeAnimator.SetParentOpacity(1f);
         }
         else
         {
             SkillTreeManager.Instance.NavigationManager.FadeAnimator.SetParentOpacity(RandomizerSettings.AbilityMenuOpacity);
         }
     }
     Randomizer.Tick();
     if (Characters.Sein && !Characters.Sein.IsSuspended)
     {
         RandomizerBonus.Update();
         if (!Randomizer.ColorShift)
         {
             RandomizerColorManager.UpdateColors();
         }
         Randomizer.UpdateHoruCutsceneStatus();
         if (Characters.Sein.Inventory.GetRandomizerItem(82) > 0 && Items.NightBerry != null)
         {
             Items.NightBerry.transform.position = new Vector3(-910f, -300f);
             Characters.Sein.Inventory.SetRandomizerItem(82, 0);
         }
         if (RandomizerBonusSkill.LevelExplosionCooldown > 0)
         {
             RandomizerBonusSkill.LevelExplosionCooldown--;
             if (RandomizerBonusSkill.LevelExplosionCooldown > 10)
             {
                 Characters.Sein.Energy.SetCurrent(RandomizerBonusSkill.OldEnergy);
                 Characters.Sein.Mortality.Health.SetAmount(RandomizerBonusSkill.OldHealth);
             }
         }
         if (Randomizer.Chaos)
         {
             RandomizerChaosManager.Update();
         }
         if (Randomizer.Sync)
         {
             RandomizerSyncManager.Update();
         }
         if (Randomizer.Warping > 0)
         {
             if (Randomizer.DelayedWarp)
             {
                 Randomizer.DelayedWarp = false;
                 Randomizer.WarpTo(Randomizer.WarpTarget, Randomizer.Warping);
             }
             else
             {
                 Characters.Sein.Position = Randomizer.WarpTarget;
                 Characters.Sein.Speed    = new Vector3(0f, 0f);
                 Characters.Ori.Position  = new Vector3(Randomizer.WarpTarget.x, Randomizer.WarpTarget.y - 5);
                 bool loading = false;
                 foreach (SceneManagerScene sms in Scenes.Manager.ActiveScenes)
                 {
                     if (sms.CurrentState == SceneManagerScene.State.Loading)
                     {
                         loading = true;
                         break;
                     }
                 }
                 if (!loading)
                 {
                     Randomizer.Warping--;
                 }
                 if (Randomizer.Warping == 0 && Randomizer.SaveAfterWarp)
                 {
                     GameController.Instance.CreateCheckpoint();
                     GameController.Instance.SaveGameController.PerformSave();
                     Randomizer.SaveAfterWarp = false;
                 }
             }
         }
         else if (Randomizer.Returning)
         {
             Characters.Sein.Position = new Vector3(189f, -215f);
             if (Scenes.Manager.CurrentScene.Scene == "sunkenGladesRunaway")
             {
                 Randomizer.Returning = false;
             }
         }
     }
     if (CreditsActive)
     {
         return;
     }
     if (RandomizerRebinding.ReloadSeed.IsPressed())
     {
         Randomizer.initialize();
         Randomizer.showSeedInfo();
         return;
     }
     if (RandomizerRebinding.ShowStats.IsPressed() && Characters.Sein)
     {
         RandomizerStatsManager.ShowStats(10);
         return;
     }
     if (RandomizerRebinding.ListTrees.IsPressed() && Characters.Sein)
     {
         Randomizer.MessageQueueTime = 0;
         RandomizerTrackedDataManager.ListTrees();
         return;
     }
     if (RandomizerRebinding.ListRelics.IsPressed() && Characters.Sein)
     {
         Randomizer.MessageQueueTime = 0;
         RandomizerTrackedDataManager.ListRelics();
         return;
     }
     if (RandomizerRebinding.ListMapAltars.IsPressed() && Characters.Sein)
     {
         Randomizer.MessageQueueTime = 0;
         RandomizerTrackedDataManager.ListMapstones();
         return;
     }
     if (RandomizerRebinding.ListTeleporters.IsPressed() && Characters.Sein)
     {
         Randomizer.MessageQueueTime = 0;
         RandomizerTrackedDataManager.ListTeleporters();
         return;
     }
     if (RandomizerRebinding.BonusSwitch.IsPressed() && Characters.Sein)
     {
         RandomizerBonusSkill.SwitchBonusSkill();
         return;
     }
     if (RandomizerRebinding.BonusToggle.IsPressed() && Characters.Sein)
     {
         RandomizerBonusSkill.ActivateBonusSkill();
         return;
     }
     if (RandomizerRebinding.BonusSwitch.IsPressed() && Characters.Sein)
     {
         RandomizerBonusSkill.SwitchBonusSkill();
         return;
     }
     if (RandomizerRebinding.ReplayMessage.IsPressed())
     {
         Randomizer.playLastMessage();
         return;
     }
     if (RandomizerRebinding.ReturnToStart.IsPressed() && Characters.Sein && Randomizer.Warping <= 0)
     {
         if (Randomizer.AltRDisabled || RandomizerBonus.AltRDisabled())
         {
             Randomizer.printInfo("Return to start is disabled!");
             return;
         }
         Randomizer.returnToStart();
         return;
     }
     if (RandomizerRebinding.ShowProgress.IsPressed() && Characters.Sein)
     {
         Randomizer.MessageQueueTime = 0;
         Randomizer.showProgress();
         return;
     }
     if (RandomizerRebinding.ColorShift.IsPressed())
     {
         string obj = "Color shift enabled";
         if (Randomizer.ColorShift)
         {
             obj = "Color shift disabled";
         }
         else
         {
             Randomizer.changeColor();
         }
         Randomizer.ColorShift = !Randomizer.ColorShift;
         Randomizer.printInfo(obj);
     }
     if (RandomizerRebinding.ToggleChaos.IsPressed() && Characters.Sein)
     {
         if (Randomizer.Chaos)
         {
             Randomizer.showChaosMessage("Chaos deactivated");
             Randomizer.Chaos = false;
             RandomizerChaosManager.ClearEffects();
             return;
         }
         Randomizer.showChaosMessage("Chaos activated");
         Randomizer.Chaos = true;
         return;
     }
     else if (RandomizerRebinding.ChaosVerbosity.IsPressed() && Randomizer.Chaos)
     {
         Randomizer.ChaosVerbose = !Randomizer.ChaosVerbose;
         if (Randomizer.ChaosVerbose)
         {
             Randomizer.showChaosMessage("Chaos messages enabled");
             return;
         }
         Randomizer.showChaosMessage("Chaos messages disabled");
         return;
     }
     else
     {
         if (RandomizerRebinding.ForceChaosEffect.IsPressed() && Randomizer.Chaos && Characters.Sein)
         {
             RandomizerChaosManager.SpawnEffect();
             return;
         }
         return;
     }
 }
예제 #9
0
    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();
    }
    public static void GivePickup(RandomizerAction Action, int coords, bool found_locally = true)
    {
        try {
            switch (Action.Action)
            {
            case "RP":
            case "MU":
                string[] pieces = ((string)Action.Value).Split('/');
                for (int i = 0; i < pieces.Length; i += 2)
                {
                    string code = pieces[i];
                    if (Randomizer.StringKeyPickupTypes.Contains(code))
                    {
                        RandomizerSwitch.GivePickup(new RandomizerAction(code, pieces[i + 1]), coords, false);
                    }
                    else
                    {
                        int id;
                        int.TryParse(pieces[i + 1], out id);
                        RandomizerSwitch.GivePickup(new RandomizerAction(code, id), coords, false);
                    }
                }
                SilentMode = false;
                break;

            case "AC":
                SkillPointPickup();
                break;

            case "EC":
                MaxEnergyContainerPickup();
                break;

            case "EX":
                ExpOrbPickup((int)Action.Value);
                break;

            case "KS":
                KeystonePickup();
                break;

            case "HC":
                MaxHealthContainerPickup();
                break;

            case "MS":
                MapStonePickup();
                break;

            case "SK":
                if (Randomizer.CutscenePickupLocs.Contains(coords))
                {
                    Randomizer.FixCutscenePickup = (int)Action.Value;
                }
                AbilityPickup((int)Action.Value);
                break;

            case "EV":
                EventPickup((int)Action.Value);
                break;

            case "RB":
                RandomizerBonus.UpgradeID((int)Action.Value);
                break;

            case "TP":
                TeleportPickup((string)Action.Value);
                break;

            case "SH":
                string message = ((string)Action.Value).Replace("AltR", RandomizerRebinding.ReturnToStart.FirstBindName());
                if (message.Length > 1 && message[1] == '=')
                {
                    var parts = message.Split(',').ToList();
                    var flags = parts.FindAll(ele => ele.Length >= 2 && ele[1] == '=');
                    message = String.Join(",", parts.FindAll(ele => ele.Length < 2 || ele[1] != '=').ToArray());
                    int duration = 120;
                    foreach (var flag in flags)
                    {
                        var p = flag.Split('=');
                        if (p.Length != 2)
                        {
                            continue;
                        }
                        if (p[0] == "d")
                        {
                            int.TryParse(p[1], out duration);
                        }
                        else if (p[0] == "s")
                        {
                            SilentMode = (p[1].Trim().ToLower() == "true");
                        }
                    }
                    Randomizer.showHint(message, duration);
                }
                else
                {
                    Randomizer.showHint(message);
                }
                break;

            case "WT":
                RandomizerTrackedDataManager.SetRelic(Randomizer.RelicZoneLookup[(string)Action.Value]);
                int    relics   = Characters.Sein.Inventory.GetRandomizerItem(302);
                string relicStr = "\n(" + relics.ToString() + "/" + Randomizer.RelicCount.ToString() + ")";
                if (relics >= Randomizer.RelicCount)
                {
                    relicStr = "$" + relicStr + "$";
                }
                PickupMessage((string)Action.Value + relicStr, 480);
                break;

            case "WS":
            case "WP":
                Randomizer.SaveAfterWarp = Action.Action == "WS";
                string[] xy = ((string)Action.Value).Split(',');
                if (xy.Length > 2 && xy[2] == "force")
                {
                    Randomizer.WarpTo(new UnityEngine.Vector3(float.Parse(xy[0]), float.Parse(xy[1])), 15);
                }
                else
                {
                    Randomizer.WarpTarget = new UnityEngine.Vector3(float.Parse(xy[0]), float.Parse(xy[1]));
                    Randomizer.WarpSource = Characters.Sein.Position;
                    Randomizer.CanWarp    = 7;
                }
                break;

            case "NO":
                break;
            }
            BingoController.OnItem(Action, coords);
            RandomizerTrackedDataManager.UpdateBitfields();
        }
        catch (Exception e) {
            Randomizer.LogError("Give Pickup(" + Action.ToString() + ", " + coords.ToString() + "): " + e.Message);
        }
        if (found_locally && Randomizer.Sync)
        {
            RandomizerSyncManager.FoundPickup(Action, coords);
        }
        if (found_locally)
        {
            Randomizer.OnCoord(coords);
        }
    }
    public static void GivePickup(RandomizerAction Action, int coords, bool found_locally = true)
    {
        try {
            if (found_locally && Randomizer.Sync)
            {
                RandomizerSyncManager.FoundPickup(Action, coords);
            }

            switch (Action.Action)
            {
            case "RP":
            case "MU":
                string[] pieces = ((string)Action.Value).Split('/');
                for (int i = 0; i < pieces.Length; i += 2)
                {
                    string code = pieces[i];
                    if (Randomizer.StringKeyPickupTypes.Contains(code))
                    {
                        RandomizerSwitch.GivePickup(new RandomizerAction(code, pieces[i + 1]), coords, found_locally);
                    }
                    else
                    {
                        int id;
                        int.TryParse(pieces[i + 1], out id);
                        RandomizerSwitch.GivePickup(new RandomizerAction(code, id), coords, found_locally);
                    }
                }
                break;

            case "AC":
                SkillPointPickup();
                break;

            case "EC":
                MaxEnergyContainerPickup();
                break;

            case "EX":
                ExpOrbPickup((int)Action.Value);
                break;

            case "KS":
                KeystonePickup();
                break;

            case "HC":
                MaxHealthContainerPickup();
                break;

            case "MS":
                MapStonePickup();
                break;

            case "SK":
                AbilityPickup((int)Action.Value);
                break;

            case "EV":
                EventPickup((int)Action.Value);
                break;

            case "RB":
                RandomizerBonus.UpgradeID((int)Action.Value);
                break;

            case "TP":
                TeleportPickup((string)Action.Value);
                break;

            case "SH":
                Randomizer.showHint((string)Action.Value);
                break;

            case "WT":
                Characters.Sein.Inventory.IncRandomizerItem(302, 1);
                int relics = Characters.Sein.Inventory.GetRandomizerItem(302);
                RandomizerTrackedDataManager.SetRelic(Randomizer.RelicZoneLookup[(string)Action.Value]);
                string relicStr = "\n(" + relics.ToString() + "/" + Randomizer.RelicCount.ToString() + ")";
                if (relics >= Randomizer.RelicCount)
                {
                    relicStr = "$" + relicStr + "$";
                }
                Randomizer.showHint((string)Action.Value + relicStr, 480);
                break;

            case "WS":
            case "WP":
                Randomizer.SaveAfterWarp = Action.Action == "WS";
                string[] xy = ((string)Action.Value).Split(',');
                Randomizer.WarpTo(new UnityEngine.Vector3(float.Parse(xy[0]), float.Parse(xy[1])), 15);
                break;

            case "NO":
                break;
            }
            RandomizerTrackedDataManager.UpdateBitfields();
        }
        catch (Exception e) {
            Randomizer.LogError("Give Pickup: " + e.Message);
        }
    }
예제 #12
0
 // Token: 0x06003746 RID: 14150 RVA: 0x000E0F2C File Offset: 0x000DF12C
 public static void Update()
 {
     Randomizer.UpdateMessages();
     if (Characters.Sein && !Characters.Sein.IsSuspended)
     {
         Characters.Sein.Mortality.Health.GainHealth((float)RandomizerBonus.HealthRegeneration() * (Characters.Sein.PlayerAbilities.HealthEfficiency.HasAbility ? 0.0016f : 0.0008f));
         Characters.Sein.Energy.Gain((float)RandomizerBonus.EnergyRegeneration() * (Characters.Sein.PlayerAbilities.EnergyEfficiency.HasAbility ? 0.0003f : 0.0002f));
         if (Randomizer.ForceTrees && Scenes.Manager.CurrentScene != null && Scenes.Manager.CurrentScene.Scene == "catAndMouseResurrectionRoom" && RandomizerBonus.SkillTreeProgression() < 10)
         {
             Randomizer.MessageQueue.Enqueue("Trees (" + RandomizerBonus.SkillTreeProgression().ToString() + "/10)");
             if (Randomizer.Entrance)
             {
                 Randomizer.EnterDoor(new Vector3(-242f, 489f));
             }
             else
             {
                 Characters.Sein.Position = new Vector3(20f, 105f);
             }
         }
         if (Randomizer.Chaos)
         {
             RandomizerChaosManager.Update();
         }
         if (Randomizer.Sync)
         {
             RandomizerSyncManager.Update();
         }
         if (Randomizer.Returning)
         {
             Characters.Sein.Position = new Vector3(189f, -215f);
             Characters.Ori.Position  = new Vector3(190f, -210f);
             Randomizer.Returning     = false;
         }
     }
     if (RandomizerRebinding.ReplayMessage.IsPressed())
     {
         Randomizer.playLastMessage();
         return;
     }
     if (RandomizerRebinding.ReturnToStart.IsPressed() && Characters.Sein)
     {
         Randomizer.returnToStart();
         return;
     }
     if (RandomizerRebinding.ReloadSeed.IsPressed())
     {
         Randomizer.initialize();
         Randomizer.showSeedInfo();
         return;
     }
     if (RandomizerRebinding.ShowProgress.IsPressed() && Characters.Sein)
     {
         Randomizer.showProgress();
         return;
     }
     if (RandomizerRebinding.ColorShift.IsPressed())
     {
         string obj = "Color shift enabled";
         if (Randomizer.ColorShift)
         {
             obj = "Color shift disabled";
         }
         Randomizer.ColorShift = !Randomizer.ColorShift;
         Randomizer.MessageQueue.Enqueue(obj);
     }
     if (RandomizerRebinding.ToggleChaos.IsPressed() && Characters.Sein)
     {
         if (Randomizer.Chaos)
         {
             Randomizer.showChaosMessage("Chaos deactivated");
             Randomizer.Chaos = false;
             RandomizerChaosManager.ClearEffects();
             return;
         }
         Randomizer.showChaosMessage("Chaos activated");
         Randomizer.Chaos = true;
         return;
     }
     else if (RandomizerRebinding.ChaosVerbosity.IsPressed() && Randomizer.Chaos)
     {
         Randomizer.ChaosVerbose = !Randomizer.ChaosVerbose;
         if (Randomizer.ChaosVerbose)
         {
             Randomizer.showChaosMessage("Chaos messages enabled");
             return;
         }
         Randomizer.showChaosMessage("Chaos messages disabled");
         return;
     }
     else
     {
         if (RandomizerRebinding.ForceChaosEffect.IsPressed() && Randomizer.Chaos && Characters.Sein)
         {
             RandomizerChaosManager.SpawnEffect();
             return;
         }
         return;
     }
 }
예제 #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);
                            }
                        }
                    }
                }
            }
        }
    }
 // Token: 0x06003798 RID: 14232
 public static void CheckPickups(object sender, DownloadStringCompletedEventArgs e)
 {
     if (e.Error != null)
     {
         Randomizer.LogError("CheckPickups: " + e.Error.ToString());
     }
     if (!e.Cancelled && e.Error == null)
     {
         string[] array = e.Result.Split(new char[]
         {
             ','
         });
         int bf = int.Parse(array[0]);
         foreach (RandomizerSyncManager.SkillInfoLine skillInfoLine in RandomizerSyncManager.SkillInfos)
         {
             if (RandomizerSyncManager.getBit(bf, skillInfoLine.bit) && !Characters.Sein.PlayerAbilities.HasAbility(skillInfoLine.skill))
             {
                 RandomizerSwitch.GivePickup(new RandomizerAction("SK", skillInfoLine.id), 0, false);
             }
         }
         int bf2 = int.Parse(array[1]);
         foreach (RandomizerSyncManager.EventInfoLine eventInfoLine in RandomizerSyncManager.EventInfos)
         {
             if (RandomizerSyncManager.getBit(bf2, eventInfoLine.bit) && !eventInfoLine.checker())
             {
                 RandomizerSwitch.GivePickup(new RandomizerAction("EV", eventInfoLine.id), 0, false);
             }
         }
         int bf4 = int.Parse(array[2]);
         foreach (RandomizerSyncManager.TeleportInfoLine teleportInfoLine in RandomizerSyncManager.TeleportInfos)
         {
             if (RandomizerSyncManager.getBit(bf4, teleportInfoLine.bit) && !RandomizerSyncManager.isTeleporterActivated(teleportInfoLine.id))
             {
                 RandomizerSwitch.GivePickup(new RandomizerAction("TP", teleportInfoLine.id), 0, false);
             }
         }
         if (array[3] != "")
         {
             string[] upgrades = array[3].Split(';');
             foreach (string rawUpgrade in upgrades)
             {
                 string[] splitpair = rawUpgrade.Split('x');
                 int      id        = int.Parse(splitpair[0]);
                 int      cnt       = int.Parse(splitpair[1]);
                 if (RandomizerBonus.UpgradeCount(id) < cnt)
                 {
                     RandomizerBonus.UpgradeID(id);
                 }
                 else if (RandomizerBonus.UpgradeCount(id) > cnt)
                 {
                     RandomizerBonus.UpgradeID(-id);
                 }
             }
         }
         if (array[4] != "")
         {
             string[] hints = array[4].Split(';');
             foreach (string rawHint in hints)
             {
                 string[] splitpair = rawHint.Split(':');
                 int      coords    = int.Parse(splitpair[0]);
                 int      player    = int.Parse(splitpair[1]);
                 RandomizerSyncManager.Hints[coords] = player;
             }
         }
         if (array.Length > 5)
         {
             foreach (string text in array[5].Split(new char[] { '|' }))
             {
                 if (text == "stop")
                 {
                     RandomizerChaosManager.ClearEffects();
                 }
                 else if (text.StartsWith("msg:"))
                 {
                     Randomizer.printInfo(text.Substring(4), 360);
                 }
                 else if (text.StartsWith("pickup:"))
                 {
                     string[]         parts = text.Substring(7).Split(new char[] { '|' });
                     RandomizerAction action;
                     if (Randomizer.StringKeyPickupTypes.Contains(parts[0]))
                     {
                         action = new RandomizerAction(parts[0], parts[1]);
                     }
                     else
                     {
                         int pickup_id;
                         int.TryParse(parts[1], out pickup_id);
                         action = new RandomizerAction(parts[0], pickup_id);
                     }
                     RandomizerSwitch.GivePickup(action, 0, false);
                 }
                 else if (text == "spawnChaos")
                 {
                     Randomizer.ChaosVerbose = true;
                     RandomizerChaosManager.SpawnEffect();
                     RandomizerSyncManager.ChaosTimeoutCounter = 3600;
                 }
                 RandomizerSyncManager.webClient.DownloadStringAsync(new Uri(RandomizerSyncManager.RootUrl + "/signalCallback/" + text));
             }
         }
         return;
     }
     if (e.Error.GetType().Name == "WebException" && ((HttpWebResponse)((WebException)e.Error).Response).StatusCode == HttpStatusCode.PreconditionFailed)
     {
         if (Randomizer.SyncMode == 1)
         {
             Randomizer.printInfo("Co-op server error, try reloading the seed (Alt+L)");
         }
         else
         {
             Randomizer.LogError("Co-op server error, try reloading the seed (Alt+L)");
         }
         return;
     }
 }