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 RWF.GameModes;
using RootCore;
using UnboundLib;
using UnboundLib.GameModes;
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 RootStandardCards
{
public class GiveAnyCard : MonoBehaviour
{
[CompilerGenerated]
private sealed class <>c__DisplayClass0_0 : Object
{
public Player player;
internal bool <Start>b__1(CardInfo card)
{
if (!UtilityExtenions.IsAllowedCard(player, card))
{
return CurseManager.instance.IsCurse(card);
}
return true;
}
}
private void Start()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Expected O, but got Unknown
ExtensionMethods.ExecuteAfterFrames((MonoBehaviour)(object)Core.instance, 2, (Action)([CompilerGenerated] () =>
{
<>c__DisplayClass0_0 CS$<>8__locals0 = new <>c__DisplayClass0_0
{
player = ((Component)this).GetComponentInParent<Player>()
};
List<CardInfo> val = Enumerable.ToList<CardInfo>(Enumerable.Where<CardInfo>((IEnumerable<CardInfo>)(object)Enumerable.ToList<CardInfo>((IEnumerable<CardInfo>)(object)Cards.instance.ACTIVEANDHIDDENCARDS), (Func<CardInfo, bool>)((CardInfo card) => UtilityExtenions.IsAllowedCard(CS$<>8__locals0.player, card) || CurseManager.instance.IsCurse(card))));
ExtensionMethods.Shuffle<CardInfo>((IList<CardInfo>)(object)val);
UtilityExtenions.GiveCard(CS$<>8__locals0.player, val[0]);
}));
}
}
public class ImpendingDoomEffect : MonoBehaviour
{
private Player player;
private void Awake()
{
player = ((Component)this).GetComponentInParent<Player>();
GameModeManager.AddHook("RoundStart", (Func<IGameModeHandler, IEnumerator>)ReducePoints);
}
private void OnDestroy()
{
GameModeManager.RemoveHook("RoundStart", (Func<IGameModeHandler, IEnumerator>)ReducePoints);
}
[IteratorStateMachine(/*Could not decode attribute arguments.*/)]
public IEnumerator ReducePoints(IGameModeHandler gameModeHandler)
{
TeamScore teamScore = gameModeHandler.GetTeamScore(player.teamID);
TeamScore val = default(TeamScore);
((TeamScore)(ref val))..ctor(teamScore.points - Enumerable.Count<int>(Enumerable.Distinct<int>(Enumerable.Select<Player, int>((IEnumerable<Player>)(object)PlayerManager.instance.players, (Func<Player, int>)((Player p) => p.teamID)))), teamScore.rounds);
gameModeHandler.SetTeamScore(player.teamID, val);
yield break;
}
}
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("Systems.R00t.Standard", "Root Standard Cards ", "1.0.0")]
[BepInProcess("Rounds.exe")]
public class Main : BaseUnityPlugin
{
private const string ModId = "Systems.R00t.Standard";
private const string ModName = "Root Standard Cards ";
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.Standard").PatchAll();
AssetBundle obj = AssetUtils.LoadAssetBundleFromResources("standardassets", typeof(Main).Assembly);
Core.RegesterCards(obj.LoadAsset<GameObject>("Standard").GetComponent<CardList>(), false);
obj.LoadAsset<GameObject>("StandardPhotonPool").GetComponent<PhotonPool>().Regester();
}
private void Start()
{
}
}
public class MomentumEffect : MonoBehaviour
{
private Player player;
private TeamScore oldScore;
private void Awake()
{
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
player = ((Component)this).GetComponentInParent<Player>();
oldScore = GameModeManager.CurrentHandler.GetTeamScore(player.teamID);
GameModeManager.AddHook("PointEnd", (Func<IGameModeHandler, IEnumerator>)StorePoints);
GameModeManager.AddHook("RoundStart", (Func<IGameModeHandler, IEnumerator>)RestorePoints);
}
private void OnDestroy()
{
GameModeManager.RemoveHook("PointEnd", (Func<IGameModeHandler, IEnumerator>)StorePoints);
GameModeManager.RemoveHook("RoundStart", (Func<IGameModeHandler, IEnumerator>)RestorePoints);
}
[IteratorStateMachine(/*Could not decode attribute arguments.*/)]
public IEnumerator StorePoints(IGameModeHandler gameModeHandler)
{
TeamScore teamScore = gameModeHandler.GetTeamScore(player.teamID);
if (teamScore.points != 0 || teamScore.rounds != oldScore.rounds)
{
oldScore = teamScore;
}
yield break;
}
[IteratorStateMachine(/*Could not decode attribute arguments.*/)]
public IEnumerator RestorePoints(IGameModeHandler gameModeHandler)
{
TeamScore teamScore = gameModeHandler.GetTeamScore(player.teamID);
TeamScore val = default(TeamScore);
((TeamScore)(ref val))..ctor(teamScore.points + oldScore.points, teamScore.rounds);
gameModeHandler.SetTeamScore(player.teamID, val);
yield break;
}
}
}
namespace RootStandardCards.Patches
{
[Serializable]
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
internal class BlockPatchblocked : Object
{
private static void Prefix(Block __instance, GameObject projectile, Vector3 forward, Vector3 hitPos)
{
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Expected O, but got Unknown
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Expected O, but got Unknown
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: Unknown result type (might be due to invalid IL or missing references)
//IL_009f: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
bool flag = false;
ProjectileHit component = projectile.GetComponent<ProjectileHit>();
HealthHandler val = (HealthHandler)Traverse.Create((object)__instance).Field("health").GetValue();
Player val2 = (Player)Traverse.Create((object)val).Field("player").GetValue();
if (CharacterStatModifiersExtension.GetRootData(val2).shieldEfectiveness < 1f)
{
Vector2 val3 = Vector2.op_Implicit(((component.bulletCanDealDeamage ? component.damage : 1f) - (component.bulletCanDealDeamage ? component.damage : 1f) * CharacterStatModifiersExtension.GetRootData(val2).shieldEfectiveness) * ((Vector3)(ref forward)).normalized);
((Damagable)val).TakeDamage(val3, Vector2.op_Implicit(hitPos), component.projectileColor, component.ownWeapon, component.ownPlayer, true, true);
flag = true;
}
if (flag)
{
Object.Destroy((Object)(object)projectile);
}
}
}
[Serializable]
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
public class HealthHandlerPatchDoDamage : Object
{
[CompilerGenerated]
private sealed class <>c__DisplayClass0_0 : Object
{
public HealthHandler __instance;
internal bool <Prefix>b__0(Player p)
{
if (!p.data.dead && p.teamID == __instance.player.teamID && p.playerID != __instance.player.playerID)
{
return UtilityExtenions.HasCard(p, "Guardian");
}
return false;
}
}
private static bool Prefix(HealthHandler __instance, Vector2 damage, Vector2 position, Color blinkColor, GameObject damagingWeapon = null, Player damagingPlayer = null, bool healthRemoval = false, bool lethal = true, bool ignoreBlock = false)
{
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
<>c__DisplayClass0_0 CS$<>8__locals0 = new <>c__DisplayClass0_0();
CS$<>8__locals0.__instance = __instance;
if (!UtilityExtenions.HasCard(CS$<>8__locals0.__instance.player, "Guardian"))
{
Player val = PlayerManager.instance.players.Find((Predicate<Player>)((Player p) => !p.data.dead && p.teamID == CS$<>8__locals0.__instance.player.teamID && p.playerID != CS$<>8__locals0.__instance.player.playerID && UtilityExtenions.HasCard(p, "Guardian")));
if (val != null)
{
val.data.healthHandler.DoDamage(damage, position, blinkColor, damagingWeapon, damagingPlayer, healthRemoval, lethal, ignoreBlock);
return false;
}
}
return true;
}
}
[Serializable]
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
public class HealthHandlerPatchHeal : Object
{
[HarmonyPriority(800)]
private static void Prefix(HealthHandler __instance, ref float healAmount)
{
if (UtilityExtenions.HasCard(((Component)__instance).GetComponent<Player>(), "Rejuvenation"))
{
healAmount *= 2f;
}
}
}
[Serializable]
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
public class RWFGameModePachRPCA_NextRound : Object
{
private static void Prefix(ref int[] winningTeamIDs)
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
Enumerator<Player> enumerator = PlayerManager.instance.players.GetEnumerator();
try
{
while (enumerator.MoveNext())
{
Player current = enumerator.Current;
if ((Object)(object)current != (Object)null && (Object)(object)((Component)current).GetComponentInChildren<ImpendingDoomEffect>() != (Object)null)
{
winningTeamIDs = Enumerable.ToArray<int>(CollectionExtensions.AddItem<int>((IEnumerable<int>)(object)winningTeamIDs, current.teamID));
}
}
}
finally
{
((IDisposable)enumerator).Dispose();
}
}
private static void Postfix(int[] winningTeamIDs)
{
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
List<int> val = Enumerable.ToList<int>((IEnumerable<int>)(object)(int[])ExtensionMethods.GetFieldValue((object)GameModeManager.CurrentHandler.GameMode, "previousRoundWinners"));
ExtensionMethods.SetFieldValue((object)GameModeManager.CurrentHandler.GameMode, "previousRoundWinners", (object)Enumerable.ToArray<int>(Enumerable.Distinct<int>((IEnumerable<int>)(object)val)));
List<int> val2 = Enumerable.ToList<int>((IEnumerable<int>)(object)(int[])ExtensionMethods.GetFieldValue((object)GameModeManager.CurrentHandler.GameMode, "previousPointWinners"));
if (val2.Count != winningTeamIDs.Length)
{
return;
}
Enumerator<Player> enumerator = PlayerManager.instance.players.GetEnumerator();
try
{
while (enumerator.MoveNext())
{
Player current = enumerator.Current;
if ((Object)(object)current != (Object)null && (Object)(object)((Component)current).GetComponentInChildren<ImpendingDoomEffect>() != (Object)null)
{
val2.Remove(current.teamID);
}
}
}
finally
{
((IDisposable)enumerator).Dispose();
}
ExtensionMethods.SetFieldValue((object)GameModeManager.CurrentHandler.GameMode, "previousPointWinners", (object)val2.ToArray());
}
}
[Serializable]
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
public class RWFGameModePatchRoundOver : Object
{
private static void Prefix(RWFGameMode __instance, ref int[] winningTeamIDs)
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
winningTeamIDs = Enumerable.ToArray<int>(Enumerable.Distinct<int>((IEnumerable<int>)(object)winningTeamIDs));
Enumerator<Player> enumerator = PlayerManager.instance.players.GetEnumerator();
try
{
while (enumerator.MoveNext())
{
Player current = enumerator.Current;
if ((Object)(object)current != (Object)null && Enumerable.Contains<int>((IEnumerable<int>)(object)winningTeamIDs, current.teamID) && (Object)(object)((Component)current).GetComponentInChildren<ImpendingDoomEffect>() != (Object)null)
{
__instance.teamRounds[current.teamID] = __instance.teamRounds[current.teamID] - 1;
}
}
}
finally
{
((IDisposable)enumerator).Dispose();
}
}
}
}
namespace RootStandardCards.GunEffects
{
public class Garlic : DealtDamageEffect
{
public override void DealtDamage(Vector2 damage, bool selfDamage, Player damagedPlayer = null)
{
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)damagedPlayer != (Object)null)
{
float num = ((Vector2)(ref damage)).magnitude;
num *= damagedPlayer.data.stats.lifeSteal;
num += damagedPlayer.data.stats.regen / damagedPlayer.data.maxHealth;
((Damagable)damagedPlayer.data.healthHandler).TakeDamage(((Vector2)(ref damage)).normalized * num, Vector2.op_Implicit(((Component)damagedPlayer).transform.position), (GameObject)null, (Player)null, true, true);
}
}
}
}