コード例 #1
0
	// 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;
		}
コード例 #2
0
 // 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;
     }
 }