using System; using System.Collections; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using HarmonyLib; using Jotunn.Utils; using Microsoft.CodeAnalysis; using ModdingUtils.Utils; using TMPro; using UnboundLib; using UnboundLib.Extensions; using UnboundLib.GameModes; using UnboundLib.Utils; 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(".NETFramework,Version=v4.7.1", FrameworkDisplayName = ".NET Framework 4.7.1")] [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 FancyCardBar { [HarmonyPatch(typeof(ExtraPlayerSkins))] public class RSMindTeam { private static PlayerSkin Skin; private static readonly PlayerSkin SkinPrefeb = new PlayerSkin { color = new Color(0.4117647f, 0f, 0.55f, 1f), backgroundColor = new Color(0f, 0f, 0f, 1f), winText = new Color(0.4117647f, 0f, 0.55f, 1f), particleEffect = new Color(0f, 0f, 0f, 1f) }; private const int TeamID = 165; [HarmonyPatch("GetTeamColorName")] [HarmonyPostfix] public static void PatchName(int teamID, ref string __result) { if (teamID == 165) { __result = "RS_Mind"; } } [HarmonyPatch("GetPlayerSkinColors")] [HarmonyPrefix] public static bool PatchGetSkin(int colorID, ref PlayerSkin __result) { if (colorID != 165) { return true; } if ((Object)(object)Skin == (Object)null) { Skin = CreateSkins(colorID, SkinPrefeb); } __result = Skin; return false; } private static PlayerSkin CreateSkins(int colorID, PlayerSkin skinPrefab) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //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_0097: 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_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) PropertyInfo property = typeof(PlayerSkinBank).GetProperty("Instance", BindingFlags.Static | BindingFlags.NonPublic); PlayerSkinBank val = (PlayerSkinBank)((property != null) ? property.GetValue(null, null) : null); PlayerSkin val2 = (((Object)(object)val != (Object)null) ? val.skins[colorID % 4].currentPlayerSkin : null); PlayerSkin component = ((Component)Object.Instantiate(val2)).gameObject.GetComponent(); Object.DontDestroyOnLoad((Object)(object)component); component.color = skinPrefab.color; component.backgroundColor = skinPrefab.backgroundColor; component.winText = skinPrefab.winText; component.particleEffect = skinPrefab.particleEffect; PlayerSkinParticle componentInChildren = ((Component)component).GetComponentInChildren(); ParticleSystem component2 = ((Component)componentInChildren).GetComponent(); MainModule main = component2.main; MinMaxGradient startColor = ((MainModule)(ref main)).startColor; ((MinMaxGradient)(ref startColor)).colorMin = skinPrefab.backgroundColor; ((MinMaxGradient)(ref startColor)).colorMax = skinPrefab.color; ((MainModule)(ref main)).startColor = startColor; ExtensionMethods.SetFieldValue((object)componentInChildren, "startColor1", (object)skinPrefab.backgroundColor); ExtensionMethods.SetFieldValue((object)componentInChildren, "startColor2", (object)skinPrefab.color); return component; } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.rsmind.rounds.fancycardbar", "Fancy Card Bar", "1.3.5")] [BepInProcess("Rounds.exe")] public class FancyCardBar : BaseUnityPlugin { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static UnityAction <>9__10_0; public static UnityAction <>9__19_0; public static UnityAction <>9__19_1; internal void b__10_0() { } internal void b__19_0(bool val) { modActive = val; } internal void b__19_1(bool val) { genIcons = val; } } private const string ModId = "com.rsmind.rounds.fancycardbar"; private const string ModName = "Fancy Card Bar"; private const string CompatibilityModName = "FancyCardBar"; public const string Version = "1.3.5"; public const string ModInitials = "FCB"; public static bool Debug; internal static AssetBundle assets; internal static GameObject blankIcon; internal static GameObject rgbIcon; internal static CardBar rsCardBar; public static FancyCardBar instance { get; private set; } public static bool modActive { get { return PlayerPrefs.GetInt(GetConfigKey("modActive"), 1) == 1; } internal set { PlayerPrefs.SetInt(GetConfigKey("modActive"), value ? 1 : 0); } } public static bool genIcons { get { return PlayerPrefs.GetInt(GetConfigKey("genIcons"), 0) == 1; } internal set { PlayerPrefs.SetInt(GetConfigKey("genIcons"), value ? 1 : 0); } } private void Awake() { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown Unbound.RegisterClientSideMod("com.rsmind.rounds.fancycardbar"); assets = AssetUtils.LoadAssetBundleFromResources("fancycardbar", typeof(FancyCardBar).Assembly); if ((Object)(object)assets == (Object)null) { Debug.Log((object)"Failed to load Fancy Card Bar asset bundle"); } Harmony val = new Harmony("com.rsmind.rounds.fancycardbar"); val.PatchAll(); } private void Start() { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown instance = this; blankIcon = assets.LoadAsset("I_Template"); rgbIcon = assets.LoadAsset("I_RGB"); object obj = <>c.<>9__10_0; if (obj == null) { UnityAction val = delegate { }; <>c.<>9__10_0 = val; obj = (object)val; } Unbound.RegisterMenu("Fancy Card Bar", (UnityAction)obj, (Action)NewGUI, (GameObject)null, false); GameModeManager.AddHook("GameStart", (Func)GameStart); } private IEnumerator GameStart(IGameModeHandler gm) { foreach (Player player in PlayerManager.instance.players) { if (PlayerExtensions.GetAdditionalData(player).colorID == 165) { rsCardBar = CardBarUtils.instance.PlayersCardBar(player.playerID); } } yield break; } internal static string GetConfigKey(string name) { return "FancyCardBar_" + name.ToLower(); } private static void NewGUI(GameObject menu) { TextMeshProUGUI val = default(TextMeshProUGUI); MenuHandler.CreateText("Fancy Card Bar Options", menu, ref val, 60, true, (Color?)null, (TMP_FontAsset)null, (Material)null, (TextAlignmentOptions?)null); MenuHandler.CreateText(" ", menu, ref val, 30, true, (Color?)null, (TMP_FontAsset)null, (Material)null, (TextAlignmentOptions?)null); MenuHandler.CreateToggle(modActive, "Use Fancy Icons", menu, (UnityAction)delegate(bool flag) { modActive = flag; }, 60, true, (Color?)null, (TMP_FontAsset)null, (Material)null, (TextAlignmentOptions?)null); MenuHandler.CreateText(" ", menu, ref val, 30, true, (Color?)null, (TMP_FontAsset)null, (Material)null, (TextAlignmentOptions?)null); MenuHandler.CreateToggle(genIcons, "Automatically Generate Card Icons", menu, (UnityAction)delegate(bool flag) { genIcons = flag; }, 60, true, (Color?)null, (TMP_FontAsset)null, (Material)null, (TextAlignmentOptions?)null); } } public class FancyIcon : MonoBehaviour { public GameObject fancyIcon; } public class RGBColorShift : MonoBehaviour { private static float hue; public Image image; private void Update() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) float num = default(float); float num2 = default(float); float num3 = default(float); Color.RGBToHSV(((Graphic)image).color, ref num, ref num2, ref num3); hue = Time.realtimeSinceStartup * 0.5f % 1f; ((Graphic)image).color = Color.HSVToRGB(hue, num2, num3); } } } namespace FancyCardBar.Patches { internal class FancyIconAdder { internal static void addIcon(CardBar __instance) { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Expected O, but got Unknown //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Unknown result type (might be due to invalid IL or missing references) GameObject gameObject = ((Component)((Component)__instance).transform.GetChild(((Component)__instance).transform.childCount - 1)).gameObject; GameObject val = null; if ((Object)(object)__instance == (Object)(object)FancyCardBar.rsCardBar) { val = Object.Instantiate(FancyCardBar.rgbIcon, gameObject.transform); val.transform.localScale = Vector3.one * (gameObject.GetComponent().sizeDelta.x / 128f); } if (!FancyCardBar.modActive) { return; } FancyIcon component = ((Component)(CardInfo)ExtensionMethods.GetFieldValue((object)gameObject.GetComponent(), "card")).GetComponent(); if (component != null) { GameObject fancyIcon = component.fancyIcon; if (fancyIcon != null) { GameObject val2 = Object.Instantiate(fancyIcon, gameObject.transform); val2.transform.localScale = Vector3.one * (gameObject.GetComponent().sizeDelta.x / 128f); ((Behaviour)gameObject.GetComponentInChildren()).enabled = false; } } else if (FancyCardBar.genIcons) { GameObject val3 = (GameObject)ExtensionMethods.GetFieldValue(ExtensionMethods.GetFieldValue((object)gameObject.GetComponent(), "card"), "cardArt"); if (val3 != null) { GameObject val4 = Object.Instantiate(FancyCardBar.blankIcon, gameObject.transform); GameObject val5 = Object.Instantiate(val3, val4.transform); val5.transform.SetAsFirstSibling(); val5.transform.localScale = new Vector3(0.15f, 0.15f, 0.15f); Animator[] components = val5.GetComponents(); Animator[] array = components; foreach (Animator val6 in array) { Object.Destroy((Object)(object)val6); } components = val5.GetComponentsInChildren(); Animator[] array2 = components; foreach (Animator val7 in array2) { Object.Destroy((Object)(object)val7); } PositionNoise[] componentsInChildren = val5.GetComponentsInChildren(); PositionNoise[] array3 = componentsInChildren; foreach (PositionNoise val8 in array3) { Object.Destroy((Object)(object)val8); } val4.transform.localScale = Vector3.one * (gameObject.GetComponent().sizeDelta.x / 128f); ((Behaviour)gameObject.GetComponentInChildren()).enabled = false; } } if ((Object)(object)__instance == (Object)(object)FancyCardBar.rsCardBar) { val.transform.SetAsLastSibling(); } } } [HarmonyPatch(typeof(CardBar), "AddCard")] internal class CardBarPatch { private static void Postfix(CardBar __instance) { FancyIconAdder.addIcon(__instance); } } [HarmonyPatch(typeof(Cards), "SilentAddToCardBar", new Type[] { typeof(int), typeof(CardInfo), typeof(string), typeof(float), typeof(float) })] internal class CardBarUtilsPatch { private static void Postfix(int playerID) { CardBar _instance = CardBarUtils.instance.PlayersCardBar(playerID); FancyIconAdder.addIcon(_instance); } } [HarmonyPatch(typeof(CardBarUtils), "SilentAddToCardBar", new Type[] { typeof(int), typeof(CardInfo), typeof(string) })] internal class CardBarUtilsPatch2 { private static void Postfix(int playerID) { CardBar _instance = CardBarUtils.instance.PlayersCardBar(playerID); FancyIconAdder.addIcon(_instance); } } [Serializable] [HarmonyPatch(typeof(CardBarUtils))] internal class ModdingUtilsPatch { [HarmonyPrefix] [HarmonyPatch("ResetPlayersLineColor", new Type[] { typeof(int) })] public static bool FixResetPlayersLineColor(int playerID) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) Transform transform = ((Component)CardBarUtils.instance.PlayersCardBar(playerID)).transform; for (int i = 1; i < transform.childCount; i++) { Transform child = transform.GetChild(i); ((Component)child).GetComponent().color = new Color(0.462f, 0.462f, 0.462f, 1f); ((Component)child.GetChild(1)).GetComponent().color = new Color(0.6509f, 0.6509f, 0.6509f, 1f); } return false; } [HarmonyPrefix] [HarmonyPatch("ChangePlayersLineColor", new Type[] { typeof(int), typeof(Color) })] public static bool FixChangePlayersLineColor(int playerID, Color color) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) Transform transform = ((Component)CardBarUtils.instance.PlayersCardBar(playerID)).transform; for (int i = 1; i < transform.childCount; i++) { Transform child = transform.GetChild(i); ((Component)child).GetComponent().color = color; ((Component)child.GetChild(1)).GetComponent().color = color; } return false; } } }