// Token: 0x0600379C RID: 14236 public static void FoundPickup(RandomizerAction action, int coords) { RandomizerSyncManager.Pickup pickup = new RandomizerSyncManager.Pickup(action, coords); if (pickup.type == "HN") { string[] hintParts = pickup.id.Split('-'); string name = hintParts[0]; string type = hintParts[1]; string owner = hintParts[2]; string hintText = type + " for " + owner; if (RandomizerSyncManager.Hints.ContainsKey(coords)) { if (RandomizerSyncManager.Hints[coords] > 0) { Randomizer.showHint("$" + owner + " found " + name + " here$"); } else { Randomizer.showHint(hintText); } } else { Randomizer.showHint("@" + hintText + "@"); } } if (RandomizerSyncManager.LoseOnDeath.Contains(pickup.type + pickup.id)) { RandomizerSyncManager.UnsavedPickups.Add(pickup); return; } RandomizerSyncManager.UriQueue.Enqueue(pickup.GetURL()); }
public static void Randomize() { rand = new Random(RandomizerMod.Instance.Settings.Seed); while (true) { randomizationError = false; overflow = false; startProgression = null; startItems = null; StartName = null; RandomizerMod.Instance.Settings.ResetPlacements(); RandomizeNonShopCosts(); RandomizeStartingItems(); RandomizeStartingLocation(); if (RandomizerMod.Instance.Settings.RandomizeTransitions) { RandomizeTransitions(); } RandomizeItems(); if (!randomizationError) { break; } } PostRandomizationTasks(); RandomizerAction.CreateActions(RandomizerMod.Instance.Settings.ItemPlacements, RandomizerMod.Instance.Settings); }
public SaveSettings() { AfterDeserialize += () => { RandomizerAction.CreateActions(ItemPlacements, Seed); }; }
// Token: 0x0600379C RID: 14236 public static void FoundPickup(RandomizerAction action, int coords) { try { Pickup pickup = new Pickup(action, coords); PickupQueue.Enqueue(pickup); } catch (Exception e) { Randomizer.LogError("FoundPickup: " + e.Message); } }
public void OnLoadLocal(SaveSettings saveSettings) { Settings = saveSettings; if (saveSettings.Randomizer) { HookRandomizer(); RandomizerAction.CreateActions(saveSettings.ItemPlacements, saveSettings); } }
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; } }
public SaveSettings() { AfterDeserialize += () => { if (Randomizer) { RandomizerMod.Instance.HookRandomizer(); RandomizerAction.CreateActions(ItemPlacements, this); } }; }
public SaveSettings() { AfterDeserialize += () => { foreach (var pair in VariableCosts) { ReqDef def = LogicManager.GetItemDef(pair.Item1); def.cost = pair.Item2; LogicManager.EditItemDef(pair.Item1, def); } RandomizerAction.CreateActions(ItemPlacements, Seed); }; }
public static void GivePickup(RandomizerAction Action) { 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; } }
public static void PatchRandoCornifer ( Action <RandomizerAction, string, object> orig, RandomizerAction self, string scene, object changeObj ) { orig(self, scene, changeObj); // This is a call to the originally hooked method to make it run. If you don't do this the original method will never run, which is something BingoUI does not want (but you might) // Below this it's mostly things not related to hooking but to BingoUI execution so I won't bother adding comments. if (!CorniferPositions.Keys.Contains(scene)) { return; } Type createNewShiny = Type.GetType("RandomizerMod.Actions.CreateNewShiny, RandomizerMod3.0"); if (createNewShiny == null) { return; } // ReSharper disable PossibleNullReferenceException float x = (float)createNewShiny.GetField("_x", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(self); float y = (float)createNewShiny.GetField("_y", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(self); // ReSharper enable PossibleNullReferenceException if ((CorniferPositions[scene] - new Vector2(x, y)).magnitude > 3.0f) { return; } BingoUI.Log("Patching rando cornifer"); GameObject cornifer = GameObject.Find ( (string)createNewShiny .GetField("_newShinyName", BindingFlags.NonPublic | BindingFlags.Instance)? .GetValue(self) ); PlayMakerFSM shinyControl = cornifer.LocateMyFSM("Shiny Control"); shinyControl.InsertMethod("Hero Down", 0, () => OnCorniferLocation.Invoke(scene)); }
public SaveSettings() { AfterDeserialize += () => { /* * foreach (var pair in VariableCosts) * { * ReqDef def = LogicManager.GetItemDef(pair.Item1); * def.cost = pair.Item2; * LogicManager.EditItemDef(pair.Item1, def); * } * * foreach (var pair in ShopCosts) * { * ReqDef def = LogicManager.GetItemDef(pair.Item1); * def.shopCost = pair.Item2; * LogicManager.EditItemDef(pair.Item1, def); * } */ RandomizerAction.CreateActions(ItemPlacements, this); }; }
public static void Randomize() { rand = new Random(RandomizerMod.Instance.Settings.Seed); while (true) { RandomizerMod.Instance.Settings.ResetPlacements(); RandomizeCosts(); if (RandomizerMod.Instance.Settings.RandomizeTransitions) { RandomizeTransitions(); } RandomizeItems(); if (!randomizationError) { break; } } PostRandomizationTasks(); RandomizerAction.CreateActions(RandomizerMod.Instance.Settings.ItemPlacements, RandomizerMod.Instance.Settings.Seed); }
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); } }
// Token: 0x06003798 RID: 14232 public static void CheckPickups(object sender, UploadValuesCompletedEventArgs e) { try { if (e.Error != null) { if (e.Error is System.NullReferenceException) { return; } Randomizer.LogError("CheckPickups got error: " + e.Error.ToString()); } if (!e.Cancelled && e.Error == null) { if (!Characters.Sein) { return; } string[] array = System.Text.Encoding.UTF8.GetString(e.Result).Split(new char[] { ',' }); int bf = int.Parse(array[0]); foreach (SkillInfoLine skillInfoLine in SkillInfos) { if (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 (EventInfoLine eventInfoLine in EventInfos) { if (getBit(bf2, eventInfoLine.bit) && !eventInfoLine.checker()) { RandomizerSwitch.GivePickup(new RandomizerAction("EV", eventInfoLine.id), 0, false); } } int bf4 = int.Parse(array[2]); foreach (TeleportInfoLine teleportInfoLine in TeleportInfos) { if (getBit(bf4, teleportInfoLine.bit) && !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 (id >= 100) { if (id >= 900) { if (id < 910) { int tree = id - 899; string treeName = RandomizerTrackedDataManager.Trees[tree]; if (RandomizerTrackedDataManager.SetTree(tree)) { Randomizer.showHint(treeName + " tree (activated by teammate)"); } } else if (id < 922) { string relicZone = RandomizerTrackedDataManager.Zones[id - 911]; if (RandomizerTrackedDataManager.SetRelic(relicZone)) { Randomizer.showHint("#" + relicZone + " relic# (found by teammate)", 300); } } } else if (!RandomizerBonusSkill.UnlockedBonusSkills.ContainsValue(id) && cnt > 0) { RandomizerBonus.UpgradeID(id); } } else if (RandomizerBonus.UpgradeCount(id) < cnt) { RandomizerBonus.UpgradeID(id); } else if (!PickupQueue.Where((Pickup p) => p.type == "RB" && p.id == splitpair[0]).Any() && RandomizerBonus.UpgradeCount(id) > cnt) { RandomizerBonus.UpgradeID(-id); } } } if (array.Length > 5) { foreach (string text in array[5].Split(new char[] { '|' })) { if (CurrentSignals.Contains(text)) { continue; } if (text == "stop") { RandomizerChaosManager.ClearEffects(); } else if (text.StartsWith("msg:")) { Randomizer.printInfo(text.Substring(4), 360); } else if (text.StartsWith("win:")) { if (!RandomizerBonusSkill.UnlockCreditWarp(text.Substring(4))) { Randomizer.Print(text.Substring(4), 10, false, true, false, false); RandomizerStatsManager.WriteStatsFile(); } } 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(); ChaosTimeoutCounter = 3600; } var client = new WebClient(); client.DownloadStringAsync(new Uri(RootUrl + "/callback/" + text)); CurrentSignals.Add(text); } } else { CurrentSignals.Clear(); } 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; } } catch (Exception e2) { Randomizer.LogError("CheckPickups threw error: " + e2.Message); } }
// Token: 0x060037A1 RID: 14241 public Pickup(RandomizerAction action, int _coords) { this.type = action.Action; this.id = (Randomizer.StringKeyPickupTypes.Contains(this.type) ? ((string)action.Value) : ((int)action.Value).ToString()); this.coords = _coords; }
// 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; }
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); } }
// Token: 0x060037A1 RID: 14241 public Pickup(RandomizerAction action, int _coords) { this.type = action.Action; this.id = ((this.type == "TP") ? ((string)action.Value) : ((int)action.Value).ToString()); this.coords = _coords; }
// 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; } }