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 BepInEx.Configuration;
using HarmonyLib;
using HiddenCards;
using Jotunn.Utils;
using ModdingUtils.Utils;
using Photon.Pun;
using TMPro;
using UnboundLib;
using UnboundLib.GameModes;
using UnboundLib.Networking;
using UnboundLib.Utils.UI;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("HiddenCards")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("HiddenCards")]
[assembly: AssemblyTitle("HiddenCards")]
[assembly: AssemblyVersion("1.0.0.0")]
[HarmonyPatch(typeof(CardChoice))]
public class UniqueCardChoicePatch
{
[HarmonyPatch("SpawnUniqueCard")]
[HarmonyPostfix]
public static void SpawnUniqueCard_Patch(ref GameObject __result, int ___pickrID, PickerType ___pickerType, Vector3 pos, Quaternion rot)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0003: Invalid comparison between Unknown and I4
if ((int)___pickerType == 0)
{
Player val = PlayerManager.instance.GetPlayersInTeam(___pickrID)[0];
}
else
{
Player val = PlayerManager.instance.players[___pickrID];
}
if (HC.tempEnable)
{
NetworkingManager.RPC(typeof(UniqueCardChoicePatch), "RPC_HideHiddenCards", new object[2]
{
__result.GetComponent<PhotonView>().ViewID,
___pickrID
});
}
}
[UnboundRPC]
public static void RPC_HideHiddenCards(int targetCardID, int pickID)
{
//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: Expected O, but got Unknown
//IL_0145: Unknown result type (might be due to invalid IL or missing references)
GameObject gameObject = ((Component)PhotonNetwork.GetPhotonView(targetCardID)).gameObject;
Player val = PlayerManager.instance.players.Where((Player p) => p.data.view.IsMine).First();
Player val2 = PlayerManager.instance.players.Where((Player p) => p.playerID == pickID).First();
if (val.teamID == val2.teamID)
{
return;
}
CardInfo componentInChildren = gameObject.GetComponentInChildren<CardInfo>();
Canvas componentInChildren2 = ((Component)componentInChildren).gameObject.GetComponentInChildren<Canvas>();
foreach (Transform item in ((Component)componentInChildren2).transform)
{
Transform val3 = item;
((Component)((Component)val3).transform).gameObject.SetActive(false);
}
GameObject val4 = Object.Instantiate<GameObject>(HC.Assets.LoadAsset<GameObject>("C_HiddenCardCover"), ((Component)componentInChildren2).transform);
Image[] componentsInChildren = ((Component)val4.transform.GetChild(0)).GetComponentsInChildren<Image>();
foreach (Image val5 in componentsInChildren)
{
((Graphic)val5).color = new Color(0.6f, 0.6f, 0.6f);
}
}
}
namespace HiddenCards;
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("com.ancientkoala.rounds.hiddencards", "Hidden Cards", "0.0.4")]
[BepInProcess("Rounds.exe")]
public class HC : BaseUnityPlugin
{
[Serializable]
[CompilerGenerated]
private sealed class <>c
{
public static readonly <>c <>9 = new <>c();
public static UnityAction <>9__13_0;
public static Func<Player, bool> <>9__14_0;
internal void <Start>b__13_0()
{
}
internal bool <Update>b__14_0(Player p)
{
return p.data.view.IsMine;
}
}
private const string ModId = "com.ancientkoala.rounds.hiddencards";
private const string ModName = "Hidden Cards";
public const string Version = "0.0.4";
public static HC instance;
private bool gameGoing = false;
internal static AssetBundle Assets;
public static ConfigEntry<bool> hiddenOn;
public static ConfigEntry<bool> hideRaritys;
public static bool tempEnable = true;
public static bool tempRari = false;
private void EnableCardsAction(bool val)
{
hiddenOn.Value = val;
}
private void EnableRarAction(bool val)
{
hideRaritys.Value = val;
}
private void NewGUI(GameObject menu)
{
MenuHandler.CreateToggle(hiddenOn.Value, "Enabled", menu, (UnityAction<bool>)EnableCardsAction, 60, true, (Color?)null, (TMP_FontAsset)null, (Material)null, (TextAlignmentOptions?)null);
}
private void Start()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Expected O, but got Unknown
Harmony val = new Harmony("com.ancientkoala.rounds.hiddencards");
val.PatchAll();
instance = this;
object obj = <>c.<>9__13_0;
if (obj == null)
{
UnityAction val2 = delegate
{
};
<>c.<>9__13_0 = val2;
obj = (object)val2;
}
Unbound.RegisterMenu("Hidden Cards", (UnityAction)obj, (Action<GameObject>)NewGUI, (GameObject)null);
hiddenOn = ((BaseUnityPlugin)this).Config.Bind<bool>("HC", "enabled hidden", true, (ConfigDescription)null);
Assets = AssetUtils.LoadAssetBundleFromResources("hiddencards", typeof(HC).Assembly);
if ((Object)(object)Assets == (Object)null)
{
Debug.Log((object)"Hidden Cards art asset bundle either doesn't exist or failed to load.");
}
GameModeManager.AddHook("GameStart", (Func<IGameModeHandler, IEnumerator>)GameStart);
GameModeManager.AddHook("GameEnd", (Func<IGameModeHandler, IEnumerator>)GameEnd);
}
private void Update()
{
if (!tempEnable || !gameGoing)
{
return;
}
int teamID = PlayerManager.instance.players.Where((Player p) => p.data.view.IsMine).First().teamID;
foreach (Player player in PlayerManager.instance.players)
{
if (player.teamID != teamID)
{
CardBarUtils.instance.PlayersCardBar(player.playerID).ClearBar();
}
}
}
private IEnumerator GameStart(IGameModeHandler gm)
{
gameGoing = true;
if (PhotonNetwork.IsMasterClient)
{
tempEnable = hiddenOn.Value;
tempRari = hideRaritys.Value;
NetworkingManager.RPC_Others(typeof(HC), "RPC_SyncSettings", new object[2] { hiddenOn.Value, true });
}
yield return null;
}
private IEnumerator GameEnd(IGameModeHandler gm)
{
gameGoing = false;
yield return null;
}
[UnboundRPC]
private static void RPC_SyncSettings(bool isEnabled, bool rarit)
{
tempEnable = isEnabled;
tempRari = rarit;
}
public static void TestCard(GameObject card)
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Expected O, but got Unknown
//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
CardInfo componentInChildren = card.GetComponentInChildren<CardInfo>();
Canvas componentInChildren2 = ((Component)componentInChildren).gameObject.GetComponentInChildren<Canvas>();
foreach (Transform item in ((Component)componentInChildren2).transform)
{
Transform val = item;
((Component)((Component)val).transform).gameObject.SetActive(false);
}
GameObject val2 = Object.Instantiate<GameObject>(Assets.LoadAsset<GameObject>("C_HiddenCardCover"), ((Component)componentInChildren2).transform);
Image[] componentsInChildren = ((Component)val2.transform.GetChild(0)).GetComponentsInChildren<Image>();
foreach (Image val3 in componentsInChildren)
{
((Graphic)val3).color = new Color(0.6f, 0.6f, 0.6f);
}
}
}