public static void getPickup(Vector3 position) { try { RandomizerBonus.CollectPickup(); RandomizerStatsManager.IncPickup(); if (Randomizer.ColorShift) { Randomizer.changeColor(); } int hashKey = GetHashKey(position); if (hashKey != -1) { RandomizerSwitch.GivePickup((RandomizerAction)Randomizer.Table[hashKey], hashKey, true); if (Randomizer.HotColdItems.ContainsKey(hashKey)) { Characters.Sein.Inventory.SetRandomizerItem(Randomizer.HotColdItems[hashKey].Id, 1); RandomizerColorManager.UpdateHotColdTarget(); } return; } } catch (Exception e) { Randomizer.LogError("GetPickup: " + e.Message); } }
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; } }
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(); }
// Token: 0x06003848 RID: 14408 public static void Tick() { long tick = DateTime.Now.Ticks % 10000000L; if (tick < Randomizer.LastTick) { if (ResetVolume == 1) { ResetVolume = 0; GameSettings.Instance.SoundEffectsVolume = CachedVolume; } else if (ResetVolume > 1) { ResetVolume--; } if (RepeatableCooldown > 0) { RepeatableCooldown--; } if (RandomizerStatsManager.StatsTimer > 0) { RandomizerStatsManager.StatsTimer--; } RandomizerStatsManager.IncTime(); if (Scenes.Manager.CurrentScene != null) { string scene = Scenes.Manager.CurrentScene.Scene; if (scene == "titleScreenSwallowsNest") { ResetTrackerCount++; if (ResetTrackerCount > 10) { RandomizerTrackedDataManager.Reset(); ResetTrackerCount = 0; } if (RandomizerCreditsManager.CreditsDone) { RandomizerCreditsManager.CreditsDone = false; } } else if (scene == "creditsScreen") { if (!CreditsActive && !RandomizerCreditsManager.CreditsDone) { CreditsActive = true; RandomizerCreditsManager.Initialize(); } } else if (scene == "theSacrifice" && RandomizerStatsManager.Active) { foreach (SceneManagerScene sms in Scenes.Manager.ActiveScenes) { if (sms.MetaData.Scene == "creditsScreen" && sms.CurrentState == SceneManagerScene.State.Loading) { RandomizerStatsManager.Finish(); } } } } if (CreditsActive && !RandomizerCreditsManager.CreditsDone) { RandomizerCreditsManager.Tick(); } if (Characters.Sein) { if (JustSpawned && SpawnWith != "" && Characters.Sein.Inventory) { JustSpawned = false; RandomizerAction spawnItem; if (Randomizer.StringKeyPickupTypes.Contains(SpawnWith.Substring(0, 2))) { spawnItem = new RandomizerAction(SpawnWith.Substring(0, 2), SpawnWith.Substring(2)); } else { spawnItem = new RandomizerAction(SpawnWith.Substring(0, 2), int.Parse(SpawnWith.Substring(2))); } RandomizerSwitch.GivePickup(spawnItem, 2, true); } if (!Characters.Sein.IsSuspended && Scenes.Manager.CurrentScene != null) { ResetTrackerCount = 0; RandomizerTrackedDataManager.UpdateBitfields(); RandomizerColorManager.UpdateHotColdTarget(); if (Characters.Sein.Position.y > 937f && Sein.World.Events.WarmthReturned && Scenes.Manager.CurrentScene.Scene == "ginsoTreeWaterRisingEnd") { if (Characters.Sein.Abilities.Bash.IsBashing) { Characters.Sein.Abilities.Bash.BashGameComplete(0f); } Characters.Sein.Position = new Vector3(750f, -120f); return; } if (Scenes.Manager.CurrentScene.Scene == "catAndMouseResurrectionRoom" && !Randomizer.canFinalEscape()) { if (Randomizer.Entrance) { Randomizer.EnterDoor(new Vector3(-242f, 489f)); return; } Characters.Sein.Position = new Vector3(20f, 105f); return; } else if (!Characters.Sein.Controller.CanMove && Scenes.Manager.CurrentScene.Scene == "moonGrottoGumosHideoutB") { Randomizer.LockedCount++; if (Randomizer.LockedCount >= 4) { GameController.Instance.ResetInputLocks(); return; } } else { Randomizer.LockedCount = 0; } } } } Randomizer.LastTick = tick; }