Decompiled source of SoleSurvivor v1.0.0

plugins/SoleSurvivor.dll

Decompiled a day ago
using System;
using System.Collections;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using Microsoft.CodeAnalysis;
using ModdingUtils.Utils;
using Photon.Pun;
using RWF;
using RWF.GameModes;
using RWF.UI;
using UnboundLib;
using UnboundLib.GameModes;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("0.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace SoleSurvivor
{
	public class GM_SoleSurvivor : RWFGameMode
	{
		private const float CardDisplayTime = 2f;

		public override IEnumerator RoundTransition(int[] winningTeamIDs)
		{
			yield return GameModeManager.TriggerHook("PointEnd");
			yield return GameModeManager.TriggerHook("RoundEnd");
			if (GameModeManager.CurrentHandler.GetGameWinners().Any())
			{
				((RWFGameMode)this).GameOver(winningTeamIDs);
				yield break;
			}
			((MonoBehaviour)this).StartCoroutine(PointVisualizerExtensions.DoWinSequence(PointVisualizer.instance, base.teamPoints, base.teamRounds, winningTeamIDs));
			yield return (object)new WaitForSecondsRealtime(1f);
			MapManager.instance.LoadNextLevel(false, false);
			yield return (object)new WaitForSecondsRealtime(1.3f);
			PlayerManager.instance.SetPlayersSimulated(false);
			TimeHandler.instance.DoSpeedUp();
			yield return GameModeManager.TriggerHook("PickStart");
			yield return GiveRandomCardsToLosers(winningTeamIDs);
			yield return GameModeManager.TriggerHook("PickEnd");
			yield return ((MonoBehaviour)this).StartCoroutine(((RWFGameMode)this).WaitForSyncUp());
			PlayerSpotlight.FadeIn(0.5f, 0f);
			TimeHandler.instance.DoSlowDown();
			MapManager.instance.CallInNewMapAndMovePlayers(MapManager.instance.currentLevelID);
			PlayerManager.instance.RevivePlayers();
			yield return (object)new WaitForSecondsRealtime(0.3f);
			TimeHandler.instance.DoSpeedUp();
			GameManager.instance.battleOngoing = true;
			base.isTransitioning = false;
			UIHandlerExtensions.ShowRoundCounterSmall(UIHandler.instance, base.teamPoints, base.teamRounds);
			((MonoBehaviour)this).StartCoroutine(((RWFGameMode)this).DoRoundStart());
		}

		private IEnumerator GiveRandomCardsToLosers(int[] winningTeamIDs)
		{
			if (PhotonNetwork.IsMasterClient || PhotonNetwork.OfflineMode)
			{
				foreach (Player item in PlayerManager.instance.players.ToList())
				{
					if (!winningTeamIDs.Contains(item.teamID))
					{
						CardInfo randomCardWithCondition = Cards.instance.GetRandomCardWithCondition(item, (Gun)null, (GunAmmo)null, (CharacterData)null, (HealthHandler)null, (Gravity)null, (Block)null, (CharacterStatModifiers)null, (Func<CardInfo, Player, Gun, GunAmmo, CharacterData, HealthHandler, Gravity, Block, CharacterStatModifiers, bool>)((CardInfo c, Player p, Gun g, GunAmmo ga, CharacterData d, HealthHandler h, Gravity gr, Block b, CharacterStatModifiers s) => true), 1000);
						if ((Object)(object)randomCardWithCondition == (Object)null)
						{
							Debug.LogWarning((object)string.Format("[{0}] No valid card for player {1}", "Sole Survivor", item.playerID));
						}
						else
						{
							Cards.instance.AddCardToPlayer(item, randomCardWithCondition, false, "", 2f, 0f);
						}
					}
				}
			}
			yield return ((RWFGameMode)this).WaitForSyncUp();
			yield return (object)new WaitForSecondsRealtime(2f);
		}
	}
	public class SoleSurvivorHandler : RWFGameModeHandler<GM_SoleSurvivor>
	{
		internal const string GameModeName = "Sole Survivor";

		internal const string GameModeID = "SoleSurvivor";

		public SoleSurvivorHandler()
			: base("Sole Survivor", "SoleSurvivor", false, 1, 5, (int?)null, (int?)null, (int?)null, (int?)null, "Free for all, one life each. The last one standing wins the round - everyone else gets a random card.", (int?)null, (string)null)
		{
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.stinkybussybois.rounds.solesurvivor", "Sole Survivor", "1.0.0")]
	[BepInProcess("Rounds.exe")]
	public class SoleSurvivorPlugin : BaseUnityPlugin
	{
		public const string ModId = "com.stinkybussybois.rounds.solesurvivor";

		public const string ModName = "Sole Survivor";

		public const string Version = "1.0.0";

		private void Start()
		{
			Unbound.RegisterHandshake("com.stinkybussybois.rounds.solesurvivor", (Action)delegate
			{
			});
			Unbound.RegisterCredits("Sole Survivor", new string[1] { "Free-for-all, one life per round. Losers get a random card." }, new string[0], new string[0]);
			GameModeManager.AddHandler<GM_SoleSurvivor>("SoleSurvivor", (IGameModeHandler)(object)new SoleSurvivorHandler());
		}
	}
}