Пример #1
0
    // Token: 0x06003742 RID: 14146 RVA: 0x000E0520 File Offset: 0x000DE720
    public static void getPickup(Vector3 position)
    {
        int num = (int)(Math.Floor((double)((int)position.x) / Randomizer.GridFactor) * Randomizer.GridFactor) * 10000 + (int)(Math.Floor((double)((int)position.y) / Randomizer.GridFactor) * Randomizer.GridFactor);

        if (Randomizer.Table.ContainsKey(num))
        {
            RandomizerSwitch.GivePickup((RandomizerAction)Randomizer.Table[num]);
            return;
        }
        for (int i = -1; i <= 1; i++)
        {
            for (int j = -1; j <= 1; j++)
            {
                if (Randomizer.Table.ContainsKey(num + (int)Randomizer.GridFactor * (10000 * i + j)))
                {
                    RandomizerSwitch.GivePickup((RandomizerAction)Randomizer.Table[num + (int)Randomizer.GridFactor * (10000 * i + j)]);
                    return;
                }
            }
        }
        for (int k = -2; k <= 2; k += 4)
        {
            for (int l = -1; l <= 1; l++)
            {
                if (Randomizer.Table.ContainsKey(num + (int)Randomizer.GridFactor * (10000 * k + l)))
                {
                    RandomizerSwitch.GivePickup((RandomizerAction)Randomizer.Table[num + (int)Randomizer.GridFactor * (10000 * k + l)]);
                    return;
                }
            }
        }
        Randomizer.showHint("Error finding pickup at " + ((int)position.x).ToString() + ", " + ((int)position.y).ToString());
    }
Пример #2
0
    // Token: 0x06003801 RID: 14337
    public static void FoundBonusSkill(int ID)
    {
        bool psuedo = (ID == 108 || ID == 1587);

        if (get(ID) > 0)
        {
            if (!psuedo)
            {
                RandomizerSwitch.PickupMessage(RandomizerBonusSkill.BonusSkillNames[ID] + " (duplicate)");
            }
            return;
        }
        if (!psuedo)
        {
            RandomizerSwitch.PickupMessage("Unlocked Bonus Skill: " + RandomizerBonusSkill.BonusSkillNames[ID]);
        }
        int offset = 0;
        Dictionary <int, int> ubs = new Dictionary <int, int>(UnlockedBonusSkills);

        if (ubs.Count > 0)
        {
            offset = (1 + ubs.Keys.Max()) << 2;
        }
        set(ID, offset + 1);
        if (ActiveBonus == 0)
        {
            ActiveBonus = ID;
        }
    }
Пример #3
0
 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);
     }
 }
Пример #4
0
 public static void getEvent(int ID)
 {
     RandomizerBonus.CollectPickup();
     if (Randomizer.ColorShift)
     {
         Randomizer.changeColor();
     }
     RandomizerSwitch.GivePickup((RandomizerAction)Randomizer.Table[ID * 4], ID * 4, true);
 }
Пример #5
0
 // Token: 0x06003746 RID: 14150 RVA: 0x000E08C4 File Offset: 0x000DEAC4
 public static void getMapStone()
 {
     if (!Randomizer.ProgressiveMapStones)
     {
         Randomizer.getPickup();
         return;
     }
     Characters.Sein.Inventory.SkillPointsCollected += 8388608;
     RandomizerSwitch.GivePickup((RandomizerAction)Randomizer.Table[20 + RandomizerBonus.MapStoneProgression() * 4]);
 }
Пример #6
0
    public static void getMapStone()
    {
        if (!Randomizer.ProgressiveMapStones)
        {
            Randomizer.getPickup();
            return;
        }
        RandomizerBonus.CollectMapstone();
        RandomizerStatsManager.FoundMapstone();

        if (Randomizer.ColorShift)
        {
            Randomizer.changeColor();
        }
        RandomizerSwitch.GivePickup((RandomizerAction)Randomizer.Table[20 + RandomizerBonus.MapStoneProgression() * 4], 20 + RandomizerBonus.MapStoneProgression() * 4, true);
    }
	// 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
 // Token: 0x0600373B RID: 14139 RVA: 0x0002B45A File Offset: 0x0002965A
 public static void getEvent(int ID)
 {
     RandomizerSwitch.GivePickup((RandomizerAction)Randomizer.Table[ID * 4]);
 }
Пример #9
0
    // 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 {
            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);
     }
 }
Пример #13
0
    // Token: 0x0600376D RID: 14189 RVA: 0x000E2764 File Offset: 0x000E0964
    public static void UpgradeID(int ID)
    {
        bool flag = ID < 0;

        if (flag)
        {
            ID = -ID;
        }
        if (RandomizerBonusSkill.BonusSkillNames.ContainsKey(ID))
        {
            RandomizerBonusSkill.FoundBonusSkill(ID);
            return;
        }
        if (ID >= 200 && ID < 260)
        {
            int     abilityId = (ID - 200) % 30;
            Ability ability   = abilities[abilityId];
            if (ID < 230)
            {
                ability.Found();
            }
            else
            {
                ability.Lost();
            }
            return;
        }
        switch (ID)
        {
        case 0:
            if (!flag)
            {
                Characters.Sein.Mortality.Health.SetAmount((float)(Characters.Sein.Mortality.Health.MaxHealth + 20));
                RandomizerSwitch.PickupMessage("Mega Health");
                return;
            }
            break;

        case 1:
            if (!flag)
            {
                Characters.Sein.Energy.SetCurrent(Characters.Sein.Energy.Max + 5f);
                RandomizerSwitch.PickupMessage("Mega Energy");
                return;
            }
            break;

        case 2:
            Randomizer.returnToStart();
            RandomizerSwitch.PickupMessage("Go Home!");
            return;

        case 20:
            break;

        case 6:
            if (!flag)
            {
                Characters.Sein.Inventory.IncRandomizerItem(ID, 1);
                RandomizerSwitch.PickupMessage("Attack Upgrade (" + RandomizerBonus.SpiritFlameLevel().ToString() + ")");
                return;
            }
            if (RandomizerBonus.SpiritFlameLevel() > 0)
            {
                Characters.Sein.Inventory.IncRandomizerItem(ID, -1);
                RandomizerSwitch.PickupMessage("Attack Upgrade (" + RandomizerBonus.SpiritFlameLevel().ToString() + ")");
                return;
            }
            break;

        case 8:
            RandomizerSwitch.PickupMessage("Explosion Power Upgrade");
            if (!RandomizerBonus.ExplosionPower())
            {
                Characters.Sein.Inventory.IncRandomizerItem(ID, 1);
                return;
            }
            break;

        case 9:
            if (!flag)
            {
                Characters.Sein.Inventory.IncRandomizerItem(ID, 1);
            }
            else if (Characters.Sein.Inventory.GetRandomizerItem(ID) > 0)
            {
                Characters.Sein.Inventory.IncRandomizerItem(ID, -1);
            }
            if (Characters.Sein.Inventory.GetRandomizerItem(ID) == 1)
            {
                RandomizerSwitch.PickupMessage("Spirit Light Efficiency");
            }
            else
            {
                RandomizerSwitch.PickupMessage("Spirit Light Efficiency (" + Characters.Sein.Inventory.GetRandomizerItem(ID).ToString() + ")");
            }
            break;

        case 10:
            RandomizerSwitch.PickupMessage("Extra Air Dash");
            if (!RandomizerBonus.DoubleAirDash())
            {
                Characters.Sein.Inventory.SetRandomizerItem(ID, 1);
                return;
            }
            break;

        case 11:
            RandomizerSwitch.PickupMessage("Charge Dash Efficiency");
            if (!RandomizerBonus.ChargeDashEfficiency())
            {
                Characters.Sein.Inventory.SetRandomizerItem(ID, 1);
                return;
            }
            break;

        case 12:
            if (!flag)
            {
                Characters.Sein.Inventory.IncRandomizerItem(ID, 1);
                if (RandomizerBonus.DoubleJumpUpgrades() == 1)
                {
                    RandomizerSwitch.PickupMessage("Extra Double Jump");
                    return;
                }
                RandomizerSwitch.PickupMessage("Extra Double Jump (" + RandomizerBonus.DoubleJumpUpgrades().ToString() + ")");
                return;
            }
            else if (RandomizerBonus.DoubleJumpUpgrades() > 0)
            {
                Characters.Sein.Inventory.IncRandomizerItem(ID, -1);
                if (RandomizerBonus.DoubleJumpUpgrades() == 1)
                {
                    RandomizerSwitch.PickupMessage("Extra Double Jump");
                    return;
                }
                RandomizerSwitch.PickupMessage("Extra Double Jump (" + RandomizerBonus.DoubleJumpUpgrades().ToString() + ")");
                return;
            }
            break;

        case 13:
            if (!flag)
            {
                Characters.Sein.Inventory.IncRandomizerItem(ID, 1);
                RandomizerSwitch.PickupMessage("Health Regeneration (" + RandomizerBonus.HealthRegeneration().ToString() + ")");
                return;
            }
            if (RandomizerBonus.HealthRegeneration() > 0)
            {
                Characters.Sein.Inventory.IncRandomizerItem(ID, -1);
                RandomizerSwitch.PickupMessage("Health Regeneration (" + RandomizerBonus.HealthRegeneration().ToString() + ")");
                return;
            }
            break;

        case 15:
            if (!flag)
            {
                Characters.Sein.Inventory.IncRandomizerItem(ID, 1);
                RandomizerSwitch.PickupMessage("Energy Regeneration (" + RandomizerBonus.EnergyRegeneration().ToString() + ")");
                return;
            }
            if (RandomizerBonus.EnergyRegeneration() > 0)
            {
                Characters.Sein.Inventory.IncRandomizerItem(ID, -1);
                RandomizerSwitch.PickupMessage("Energy Regeneration (" + RandomizerBonus.EnergyRegeneration().ToString() + ")");
                return;
            }
            break;

        case 17:
            if (flag)
            {
                if (RandomizerBonus.WaterVeinShards() > 0)
                {
                    Characters.Sein.Inventory.IncRandomizerItem(ID, -1);
                    RandomizerSwitch.PickupMessage("*Water Vein Shard (" + RandomizerBonus.WaterVeinShards().ToString() + "/3)*");
                }
            }
            else if (RandomizerBonus.WaterVeinShards() >= 3)
            {
                RandomizerSwitch.PickupMessage("*Water Vein Shard (extra)*");
            }
            else
            {
                Characters.Sein.Inventory.IncRandomizerItem(ID, 1);
                RandomizerSwitch.PickupMessage("*Water Vein Shard (" + RandomizerBonus.WaterVeinShards().ToString() + "/3)*", 300);
            }
            Keys.GinsoTree = (RandomizerBonus.WaterVeinShards() >= 3);
            if (Keys.GinsoTree)
            {
                RandomizerStatsManager.FoundEvent(0);
            }
            return;

        case 19:
            if (flag)
            {
                if (RandomizerBonus.GumonSealShards() > 0)
                {
                    Characters.Sein.Inventory.IncRandomizerItem(ID, -1);
                    RandomizerSwitch.PickupMessage("#Gumon Seal Shard (" + RandomizerBonus.GumonSealShards().ToString() + "/3)#");
                }
            }
            else if (RandomizerBonus.GumonSealShards() >= 3)
            {
                RandomizerSwitch.PickupMessage("#Gumon Seal Shard (extra)#");
            }
            else
            {
                Characters.Sein.Inventory.IncRandomizerItem(ID, 1);
                RandomizerSwitch.PickupMessage("#Gumon Seal Shard (" + RandomizerBonus.GumonSealShards().ToString() + "/3)#", 300);
            }
            Keys.ForlornRuins = (RandomizerBonus.GumonSealShards() >= 3);
            if (Keys.ForlornRuins)
            {
                RandomizerStatsManager.FoundEvent(2);
            }
            return;

        case 21:
            if (flag)
            {
                if (RandomizerBonus.SunstoneShards() > 0)
                {
                    Characters.Sein.Inventory.IncRandomizerItem(ID, -1);
                    RandomizerSwitch.PickupMessage("@Sunstone Shard (" + RandomizerBonus.SunstoneShards().ToString() + "/3)@");
                }
            }
            else if (RandomizerBonus.SunstoneShards() >= 3)
            {
                RandomizerSwitch.PickupMessage("@Sunstone Shard (extra)@");
            }
            else
            {
                Characters.Sein.Inventory.IncRandomizerItem(ID, 1);
                RandomizerSwitch.PickupMessage("@Sunstone Shard (" + RandomizerBonus.SunstoneShards().ToString() + "/3)@", 300);
            }
            Keys.MountHoru = (RandomizerBonus.SunstoneShards() >= 3);
            if (Keys.MountHoru)
            {
                RandomizerStatsManager.FoundEvent(4);
            }
            return;

        case 28:
            if (!flag)
            {
                Characters.Sein.Inventory.IncRandomizerItem(ID, 1);
            }
            else if (RandomizerBonus.WarmthFrags() > 0)
            {
                Characters.Sein.Inventory.IncRandomizerItem(ID, -1);
            }
            if (Randomizer.fragKeyFinish < RandomizerBonus.WarmthFrags())
            {
                RandomizerSwitch.PickupMessage("@Warmth Fragment (extra)@", 300);
                return;
            }
            RandomizerSwitch.PickupMessage(string.Concat(new object[] { "@Warmth Fragment (", RandomizerBonus.WarmthFrags().ToString(), "/", Randomizer.fragKeyFinish, ")@" }), 300);
            break;

        case 29:
            return;

        case 30:
            if (!flag)
            {
                Characters.Sein.Inventory.IncRandomizerItem(ID, 1);
                RandomizerSwitch.PickupMessage("Bleeding x" + RandomizerBonus.Bleeding().ToString());
                return;
            }
            if (RandomizerBonus.Bleeding() > 0)
            {
                Characters.Sein.Inventory.IncRandomizerItem(ID, -1);
                RandomizerSwitch.PickupMessage("Bleeding x" + RandomizerBonus.Bleeding().ToString());
                return;
            }
            break;

        case 31:
            if (!flag)
            {
                Characters.Sein.Inventory.IncRandomizerItem(ID, 1);
            }
            else if (RandomizerBonus.Lifesteal() > 0)
            {
                Characters.Sein.Inventory.IncRandomizerItem(ID, -1);
            }
            if (Lifesteal() == 1)
            {
                RandomizerSwitch.PickupMessage("Health Leech");
            }
            else
            {
                RandomizerSwitch.PickupMessage("Health Leech x" + RandomizerBonus.Lifesteal().ToString());
            }
            break;

        case 32:
            if (!flag)
            {
                Characters.Sein.Inventory.IncRandomizerItem(ID, 1);
            }
            else if (RandomizerBonus.Manavamp() > 0)
            {
                Characters.Sein.Inventory.IncRandomizerItem(ID, -1);
            }
            if (Manavamp() == 1)
            {
                RandomizerSwitch.PickupMessage("Energy Leech");
            }
            else
            {
                RandomizerSwitch.PickupMessage("Energy Leech x" + RandomizerBonus.Manavamp().ToString());
            }
            break;

        case 33:
            if (!flag)
            {
                int v = Characters.Sein.Inventory.IncRandomizerItem(ID, 1);
                RandomizerSwitch.PickupMessage("Skill Velocity Upgrade x" + v.ToString());
                if (Characters.Sein.Inventory.GetRandomizerItem(108) == 0)
                {
                    RandomizerBonusSkill.FoundBonusSkill(108);
                }
                return;
            }
            if (RandomizerBonus.Velocity() > 0)
            {
                int v = Characters.Sein.Inventory.IncRandomizerItem(ID, -1);
                RandomizerSwitch.PickupMessage("Skill Velocity Upgrade x" + v.ToString());
                return;
            }
            break;

        case 34:
            Characters.Sein.Inventory.SetRandomizerItem(34, 1);
            RandomizerSwitch.PickupMessage("Return to start disabled!");
            break;

        case 35:
            Characters.Sein.Inventory.SetRandomizerItem(34, 0);
            RandomizerSwitch.PickupMessage("Return to start enabled!");
            break;

        case 36:
            RandomizerSwitch.PickupMessage("Underwater Skill Usage");
            Characters.Sein.Inventory.SetRandomizerItem(36, 1);
            break;

        case 37:
            if (!flag)
            {
                int v = Characters.Sein.Inventory.IncRandomizerItem(ID, 1);
                RandomizerSwitch.PickupMessage("Jump Upgrade x" + v.ToString());
                if (Characters.Sein.Inventory.GetRandomizerItem(108) == 0)
                {
                    RandomizerBonusSkill.FoundBonusSkill(108);
                }
                return;
            }
            if (RandomizerBonus.Jumpgrades() > 0)
            {
                int v = Characters.Sein.Inventory.IncRandomizerItem(ID, -1);
                RandomizerSwitch.PickupMessage("Jump Upgrade x" + v.ToString());
                return;
            }
            break;

        case 40:
            if (!Characters.Sein || flag)
            {
                return;
            }
            RandomizerSwitch.PickupMessage("@Wall Jump Lost!!@", 240);
            Characters.Sein.PlayerAbilities.WallJump.HasAbility = false;
            Characters.Sein.Prefabs.EnsureRightPrefabsAreThereForAbilities();
            return;

        case 41:
            if (!Characters.Sein || flag)
            {
                return;
            }
            RandomizerSwitch.PickupMessage("@ChargeFlame Lost!!@", 240);
            Characters.Sein.PlayerAbilities.ChargeFlame.HasAbility = false;
            Characters.Sein.Prefabs.EnsureRightPrefabsAreThereForAbilities();
            return;

        case 42:
            if (!Characters.Sein || flag)
            {
                return;
            }
            RandomizerSwitch.PickupMessage("@DoubleJump Lost!!@", 240);
            Characters.Sein.PlayerAbilities.DoubleJump.HasAbility = false;
            Characters.Sein.Prefabs.EnsureRightPrefabsAreThereForAbilities();
            return;

        case 43:
            if (!Characters.Sein || flag)
            {
                return;
            }
            RandomizerSwitch.PickupMessage("@Bash Lost!!@", 240);
            Characters.Sein.PlayerAbilities.Bash.HasAbility = false;
            Characters.Sein.Prefabs.EnsureRightPrefabsAreThereForAbilities();
            return;

        case 44:
            if (!Characters.Sein || flag)
            {
                return;
            }
            RandomizerSwitch.PickupMessage("@Stomp Lost!!@", 240);
            Characters.Sein.PlayerAbilities.Stomp.HasAbility = false;
            Characters.Sein.Prefabs.EnsureRightPrefabsAreThereForAbilities();
            return;

        case 45:
            if (!Characters.Sein || flag)
            {
                return;
            }
            RandomizerSwitch.PickupMessage("@Glide Lost!!@", 240);
            Characters.Sein.PlayerAbilities.Glide.HasAbility = false;
            Characters.Sein.Prefabs.EnsureRightPrefabsAreThereForAbilities();
            return;

        case 46:
            if (!Characters.Sein || flag)
            {
                return;
            }
            RandomizerSwitch.PickupMessage("@Climb Lost!!@", 240);
            Characters.Sein.PlayerAbilities.Climb.HasAbility = false;
            Characters.Sein.Prefabs.EnsureRightPrefabsAreThereForAbilities();
            return;

        case 47:
            if (!Characters.Sein || flag)
            {
                return;
            }
            RandomizerSwitch.PickupMessage("@Charge Jump Lost!!@", 240);
            Characters.Sein.PlayerAbilities.ChargeJump.HasAbility = false;
            Characters.Sein.Prefabs.EnsureRightPrefabsAreThereForAbilities();
            return;

        case 48:
            if (!Characters.Sein || flag)
            {
                return;
            }
            RandomizerSwitch.PickupMessage("@Dash Lost!!@", 240);
            Characters.Sein.PlayerAbilities.Dash.HasAbility = false;
            Characters.Sein.Prefabs.EnsureRightPrefabsAreThereForAbilities();
            return;

        case 49:
            if (!Characters.Sein || flag)
            {
                return;
            }
            RandomizerSwitch.PickupMessage("@Grenade Lost!!@", 240);
            Characters.Sein.PlayerAbilities.Grenade.HasAbility = false;
            Characters.Sein.Prefabs.EnsureRightPrefabsAreThereForAbilities();
            return;

        case 81:
            if (Characters.Sein.Inventory.GetRandomizerItem(ID) > 0)
            {
                return;
            }
            Characters.Sein.Inventory.IncRandomizerItem(ID, 1);
            string s_color = "";
            string g_color = "";
            if (Characters.Sein.PlayerAbilities.HasAbility(AbilityType.Stomp))
            {
                s_color = "$";
            }
            if (Characters.Sein.PlayerAbilities.HasAbility(AbilityType.Grenade))
            {
                g_color = "$";
            }
            RandomizerSwitch.PickupMessage(s_color + "Stomp: " + Randomizer.StompZone + s_color + g_color + "    Grenade: " + Randomizer.GrenadeZone + g_color, 480);
            break;

        default:
            if (flag)
            {
                Characters.Sein.Inventory.IncRandomizerItem(ID, -1);
            }
            else
            {
                Characters.Sein.Inventory.IncRandomizerItem(ID, 1);
            }
            return;
        }
    }
 // 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;
     }
 }