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 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; } }
// Token: 0x0600379B RID: 14235 public static void RetryOnFail(object sender, DownloadStringCompletedEventArgs e) { try { if (SendingPickup == null) { Randomizer.log("Error: no sending pickup found!"); return; } if (e.Cancelled || e.Error != null) { if (e.Error.GetType().Name == "WebException") { HttpStatusCode statusCode = ((HttpWebResponse)((WebException)e.Error).Response).StatusCode; if (statusCode == HttpStatusCode.Gone) { if (SendingPickup.type == "RB") { RandomizerBonus.UpgradeID(-int.Parse(SendingPickup.id)); } } else if (statusCode != HttpStatusCode.NotAcceptable) { webClient.DownloadStringAsync(SendingPickup.GetURL()); return; } SendingPickup = null; return; } if (e.Error != null) { Randomizer.log("RetryOnFail got non-web excpetion: " + e.Error.ToString()); } } SendingPickup = null; } catch (Exception ee) { Randomizer.LogError("RetryOnFail: " + ee.Message); } }
// Token: 0x0600379B RID: 14235 public static void RetryOnFail(object sender, DownloadStringCompletedEventArgs e) { if (e.Cancelled || e.Error != null) { if (e.Error.GetType().Name == "WebException") { HttpStatusCode statusCode = ((HttpWebResponse)((WebException)e.Error).Response).StatusCode; if (statusCode == HttpStatusCode.NotAcceptable) { RandomizerSyncManager.SendingUri = null; return; } if (statusCode == HttpStatusCode.Gone) { string[] array = RandomizerSyncManager.SendingUri.ToString().Split(new char[] { '/' }); int num = array.Length; if (array[num - 2] == "RB") { RandomizerBonus.UpgradeID(-int.Parse(array[num - 1])); } RandomizerSyncManager.SendingUri = null; } } RandomizerSyncManager.webClient.DownloadStringAsync(RandomizerSyncManager.SendingUri); return; } if (e.Result.ToString().StartsWith("GC|")) { Randomizer.SyncId = e.Result.ToString().Substring(3); return; } RandomizerSyncManager.SendingUri = null; }
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); } }
// 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: 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; } }