using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using HarmonyLib;
using Jotunn.Utils;
using Microsoft.CodeAnalysis;
using ModdingUtils.Utils;
using PlayerTimeScale;
using RootCore;
using TMPro;
using UnboundLib;
using UnboundLib.GameModes;
using UnboundLib.Networking;
using UnityEngine;
using WillsWackyManagers.Utils;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(/*Could not decode attribute arguments.*/)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.1", FrameworkDisplayName = ".NET Framework 4.7.1")]
[assembly: SecurityPermission(8, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Embedded]
[AttributeUsage(/*Could not decode attribute arguments.*/)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace RootCurses
{
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
public class BlindingLight : MonoBehaviour
{
[HarmonyPostfix]
[HarmonyPatch("GetCardColor")]
public static void GetCardColor(ref Color __result)
{
Patch(ref __result);
}
[HarmonyPostfix]
[HarmonyPatch("GetCardColor2")]
public static void GetCardColor2(ref Color __result)
{
Patch(ref __result);
}
public static void Patch(ref Color __result)
{
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
if (Enumerable.Any<Player>((IEnumerable<Player>)(object)PlayerManager.instance.players, (Func<Player, bool>)((Player p) => p.data.view.IsMine && (Object)(object)((Component)p).GetComponentInChildren<BlindingLight>() != (Object)null)))
{
__result = Color.white;
}
}
}
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("Systems.R00t.Curses", "Root Curses", "1.0.0")]
[BepInProcess("Rounds.exe")]
public class Main : BaseUnityPlugin
{
private const string ModId = "Systems.R00t.Curses";
private const string ModName = "Root Curses";
public const string Version = "1.0.0";
private void Awake()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
new Harmony("Systems.R00t.Curses").PatchAll();
Core.RegesterCards(AssetUtils.LoadAssetBundleFromResources("curseassets", typeof(Main).Assembly).LoadAsset<GameObject>("Curse").GetComponent<CardList>(), false);
}
private void Start()
{
}
}
public class RerollCurse : OnAddEffect
{
[CompilerGenerated]
private sealed class <>c__DisplayClass0_0 : Object
{
public Player player;
internal IEnumerator <OnAdd>b__0(IGameModeHandler _)
{
return AddHook(player);
}
}
[CompilerGenerated]
private sealed class <>c__DisplayClass1_0 : Object
{
public Player player;
internal IEnumerator <AddHook>b__0(IGameModeHandler _)
{
return DoReroll(player.playerID);
}
}
[CompilerGenerated]
private sealed class <>c__DisplayClass2_0 : Object
{
public int playerID;
internal bool <DoReroll>b__0(Player p)
{
return p.playerID == playerID;
}
}
public override void OnAdd(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
{
<>c__DisplayClass0_0 CS$<>8__locals0 = new <>c__DisplayClass0_0();
CS$<>8__locals0.player = player;
GameModeManager.AddOnceHook("PlayerPickEnd", (Func<IGameModeHandler, IEnumerator>)((IGameModeHandler _) => AddHook(CS$<>8__locals0.player)));
}
[IteratorStateMachine(/*Could not decode attribute arguments.*/)]
public static IEnumerator AddHook(Player player)
{
<>c__DisplayClass1_0 CS$<>8__locals0 = new <>c__DisplayClass1_0();
CS$<>8__locals0.player = player;
GameModeManager.AddOnceHook("PickEnd", (Func<IGameModeHandler, IEnumerator>)((IGameModeHandler _) => DoReroll(CS$<>8__locals0.player.playerID)), 0);
yield break;
}
[IteratorStateMachine(/*Could not decode attribute arguments.*/)]
public static IEnumerator DoReroll(int playerID)
{
<>c__DisplayClass2_0 CS$<>8__locals0 = new <>c__DisplayClass2_0();
CS$<>8__locals0.playerID = playerID;
Player player = PlayerManager.instance.players.Find((Predicate<Player>)((Player p) => p.playerID == CS$<>8__locals0.playerID));
if (!((Object)(object)player == (Object)null) && player.data.currentCards.Contains((CardInfo)(object)CardList.GetCardInfo("Infinite_Reroll")) && Cards.instance.RemoveCardFromPlayer(player, (CardInfo)(object)CardList.GetCardInfo("Infinite_Reroll"), (SelectionType)0, true) != 0)
{
yield return new WaitForSeconds(0.25f);
yield return RerollManager.instance.Reroll(player, false, true, (CardInfo)(object)CardList.GetCardInfo("Infinite_Reroll"));
yield return new WaitForSeconds(0.25f);
if (!UtilityExtenions.HasCard(player, "Infinite_Reroll"))
{
UtilityExtenions.GiveCard(player, "Infinite_Reroll");
}
}
}
}
public class TimeStop : MonoBehaviour
{
[CompilerGenerated]
private sealed class <>c__DisplayClass9_0 : Object
{
public int playerID;
internal bool <DoStopTime>b__0(Player p)
{
return p.playerID == playerID;
}
}
private Player player;
private PlayerTimeScale timeScale;
private float time;
private const float min = 3f;
private const float max = 10f;
private void Awake()
{
player = ((Component)this).GetComponentInParent<Player>();
timeScale = PlayerExtension.ApplyTimeScale(player, 1f);
time = Random.value * 7f + 3f;
}
private void OnDestroy()
{
Object.Destroy((Object)(object)timeScale);
}
private void Update()
{
if (player.data.view.IsMine && PlayerStatus.PlayerAliveAndSimulated(player) && time > 0f)
{
time -= TimeHandler.deltaTime;
if (time <= 0f)
{
NetworkingManager.RPC(((Object)this).GetType(), "DoStopTime", (object[])(object)new Object[2]
{
(object)player.playerID,
(object)((Component)this).transform.GetSiblingIndex()
});
}
}
}
internal void StopTime()
{
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Expected O, but got Unknown
timeScale.Scale = 0f;
((Component)this).GetComponent<ParticleSystem>().Play();
ExtensionMethods.ExecuteAfterSeconds((MonoBehaviour)(object)Core.instance, 0.5f, (Action)([CompilerGenerated] () =>
{
time = Random.value * 7f + 3f;
timeScale.Scale = 1f;
}));
}
[UnboundRPC]
public static void DoStopTime(int playerID, int index)
{
<>c__DisplayClass9_0 CS$<>8__locals0 = new <>c__DisplayClass9_0();
CS$<>8__locals0.playerID = playerID;
((Component)((Component)PlayerManager.instance.players.Find((Predicate<Player>)((Player p) => p.playerID == CS$<>8__locals0.playerID))).transform.GetChild(index)).GetComponent<TimeStop>().StopTime();
}
}
public class TunnelVision : MonoBehaviour
{
private Player player;
private Resolution lastResolution;
private bool running;
private int odds;
private void Awake()
{
player = ((Component)this).GetComponentInParent<Player>();
running = false;
odds = (int)(1f / Time.fixedDeltaTime * 15f);
}
private void FixedUpdate()
{
if (!((Object)(object)player == (Object)null) && player.data.view.IsMine && PlayerStatus.PlayerAliveAndSimulated(player) && !running && !CardChoice.instance.IsPicking && Random.Range(0, odds--) == 0)
{
Confuse();
}
}
private void Confuse()
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Expected O, but got Unknown
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
if ((int)Optionshandler.fullScreen == 0)
{
Optionshandler.fullScreen = (FullScreenOption)1;
}
running = true;
odds = (int)(1f / Time.fixedDeltaTime * 15f);
Screen.SetResolution(60, 60, (FullScreenMode)Optionshandler.fullScreen);
ExtensionMethods.ExecuteAfterSeconds((MonoBehaviour)(object)Core.instance, 2.5f, (Action)([CompilerGenerated] () =>
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
Optionshandler.instance.SetResolution(Optionshandler.resolution);
running = false;
}));
}
}
}
namespace RootCurses.Patches
{
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
public class BableEffect : Object
{
public static char[] allChars = "1234567890+-*/=abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTU?WXYZ?.,".ToCharArray();
public static void Prefix(CardVisuals __instance, bool setSelected, bool ___isSelected)
{
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Expected O, but got Unknown
Core.Debug((object)"BABLE");
if (setSelected == ___isSelected || !Enumerable.Any<Player>((IEnumerable<Player>)(object)PlayerManager.instance.players, (Func<Player, bool>)((Player p) => p.data.view.IsMine && UtilityExtenions.HasCard(p, "Babel"))))
{
return;
}
TextMeshProUGUI[] componentsInChildren = ((Component)__instance).GetComponentsInChildren<TextMeshProUGUI>();
Random val = new Random();
TextMeshProUGUI[] array = componentsInChildren;
foreach (TextMeshProUGUI val2 in array)
{
char[] array2 = ((TMP_Text)val2).text.ToCharArray();
for (int j = 0; j < array2.Length; j++)
{
if (!Char.IsWhiteSpace(array2[j]))
{
array2[j] = allChars[val.Next(0, allChars.Length)];
}
}
((TMP_Text)val2).text = TMPro_ExtensionMethods.ArrayToString(array2);
}
}
}
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
public class MapBlindEffect : Object
{
[CompilerGenerated]
private sealed class <>c__DisplayClass0_0 : Object
{
public Map __instance;
public Action <>9__1;
internal void <Postfix>b__0()
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Expected O, but got Unknown
//IL_0028: Expected O, but got Unknown
Core instance = Core.instance;
Action obj = <>9__1;
if (obj == null)
{
Action val = delegate
{
if (Enumerable.Any<Player>((IEnumerable<Player>)(object)PlayerManager.instance.players, (Func<Player, bool>)((Player p) => p.data.view.IsMine && UtilityExtenions.HasCard(p, "Map_Blind"))))
{
SpriteRenderer[] componentsInChildren = ((Component)__instance).GetComponentsInChildren<SpriteRenderer>();
for (int i = 0; i < componentsInChildren.Length; i++)
{
Object.Destroy((Object)(object)componentsInChildren[i]);
}
}
};
Action val2 = val;
<>9__1 = val;
obj = val2;
}
ExtensionMethods.ExecuteAfterSeconds((MonoBehaviour)(object)instance, 1.5f, obj);
}
internal void <Postfix>b__1()
{
if (Enumerable.Any<Player>((IEnumerable<Player>)(object)PlayerManager.instance.players, (Func<Player, bool>)((Player p) => p.data.view.IsMine && UtilityExtenions.HasCard(p, "Map_Blind"))))
{
SpriteRenderer[] componentsInChildren = ((Component)__instance).GetComponentsInChildren<SpriteRenderer>();
for (int i = 0; i < componentsInChildren.Length; i++)
{
Object.Destroy((Object)(object)componentsInChildren[i]);
}
}
}
}
private static void Postfix(Map __instance)
{
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Expected O, but got Unknown
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Expected O, but got Unknown
<>c__DisplayClass0_0 CS$<>8__locals0 = new <>c__DisplayClass0_0();
CS$<>8__locals0.__instance = __instance;
Map _instance = CS$<>8__locals0.__instance;
_instance.mapIsReadyAction = (Action)Delegate.Combine((Delegate)(object)_instance.mapIsReadyAction, (Delegate)(Action)delegate
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Expected O, but got Unknown
//IL_0028: Expected O, but got Unknown
Core instance = Core.instance;
Action obj = CS$<>8__locals0.<>9__1;
if (obj == null)
{
Action val = delegate
{
if (Enumerable.Any<Player>((IEnumerable<Player>)(object)PlayerManager.instance.players, (Func<Player, bool>)((Player p) => p.data.view.IsMine && UtilityExtenions.HasCard(p, "Map_Blind"))))
{
SpriteRenderer[] componentsInChildren = ((Component)CS$<>8__locals0.__instance).GetComponentsInChildren<SpriteRenderer>();
for (int i = 0; i < componentsInChildren.Length; i++)
{
Object.Destroy((Object)(object)componentsInChildren[i]);
}
}
};
Action val2 = val;
CS$<>8__locals0.<>9__1 = val;
obj = val2;
}
ExtensionMethods.ExecuteAfterSeconds((MonoBehaviour)(object)instance, 1.5f, obj);
});
}
}
}