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);
        }
    }
    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);
     }
 }