using System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using CardChoiceSpawnUniqueCardPatch.CustomCategories; using HarmonyLib; using Jotunn.Utils; using Microsoft.CodeAnalysis; using ModdingUtils.Patches; using ModdingUtils.Utils; using Photon.Pun; using RarityLib.Utils; using UnboundLib.Cards; using UnityEngine; [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.2.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 LuckLib { public class Luck : MonoBehaviour { [HideInInspector] public Player player; [HideInInspector] public PhotonView view; [HideInInspector] public int PlayerLuck; public int LuckAdd = 0; public float LuckMult = 1f; private void Start() { player = ((Component)this).GetComponent(); view = ((Component)this).GetComponent(); } public bool RollLuck(float chance) { if (PlayerLuck >= 0) { return Random.value <= chance * (1f + (float)PlayerLuck / 100f); } return Random.value <= chance / (1f + (float)(-PlayerLuck) / 100f); } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("Systems.R00t.Luck", "Luck", "0.2.0")] [BepInProcess("Rounds.exe")] [HarmonyPatch] public class Plugin : BaseUnityPlugin { private const string ModId = "Systems.R00t.Luck"; private const string ModName = "Luck"; public const string Version = "0.2.0"; private void Awake() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) CardInfo component = ((GameObject)AssetUtils.LoadAssetBundleFromResources("luckcard", typeof(Plugin).Assembly).LoadAsset("LuckCard")).GetComponent(); CustomCardCategories.instance.UpdateAndPullCategoriesFromCard(component); CustomCard.RegisterUnityCard(((Component)component).gameObject, "Luck", component.cardName, true, (Action)null); } private void Start() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) new Harmony("Systems.R00t.Luck").PatchAll(); PlayerAssigner.instance.playerPrefab.AddComponent(); } [HarmonyPatch(/*Could not decode attribute arguments.*/)] [HarmonyPostfix] public static void ApplyCardStatsPatch(ApplyCardStats __instance) { Luck component = ((Component)__instance.playerToUpgrade).GetComponent(); Luck component2 = ((Component)__instance).GetComponent(); if (Object.op_Implicit((Object)(object)component2)) { component.PlayerLuck = (int)((float)component.PlayerLuck * component2.LuckMult); component.PlayerLuck += component2.LuckAdd; } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] [HarmonyPostfix] public static void ResetPlayerPatch(Player __instance) { ((Component)__instance).GetComponent().PlayerLuck = 0; } [HarmonyPostfix] [HarmonyPatch(/*Could not decode attribute arguments.*/)] [HarmonyPatch(/*Could not decode attribute arguments.*/)] [HarmonyPatch(/*Could not decode attribute arguments.*/)] [HarmonyPatch(/*Could not decode attribute arguments.*/)] public static void ModdingUtilsGetRandomCardPatch(ref CardInfo __result, MethodBase __originalMethod, object[] __args) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Expected O, but got Unknown //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Expected O, but got Unknown //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_0279: Unknown result type (might be due to invalid IL or missing references) //IL_029d: Unknown result type (might be due to invalid IL or missing references) //IL_02ae: Unknown result type (might be due to invalid IL or missing references) bool flag = false; Player val = null; foreach (object obj in __args) { if (obj is Player) { flag = true; val = (Player)obj; break; } } if (!flag) { return; } MethodBase method = (MethodBase)(object)typeof(Cards).GetMethod(((MemberInfo)__originalMethod).Name, (BindingFlags)20); Luck component = ((Component)val).GetComponent(); if (component.PlayerLuck > 0) { if (Random.value <= (float)component.PlayerLuck / 100f) { Debug.Log((object)String.Format("luck sucsedded with value of {0}", (object)component.PlayerLuck)); int playerLuck = component.PlayerLuck; component.PlayerLuck /= 2; CardInfo val2 = (CardInfo)method.Invoke((object)Cards.instance, __args); Debug.Log((object)String.Format("{0}({1}),{2}({3}) {4}", (object[])(object)new Object[5] { (Object)((Object)val2).name, (object)val2.rarity, (Object)((Object)__result).name, (object)((Component)__result).GetComponent().rarity, (object)(RarityUtils.GetRarityData(val2.rarity).relativeRarity < RarityUtils.GetRarityData(((Component)__result).GetComponent().rarity).relativeRarity) })); if (RarityUtils.GetRarityData(val2.rarity).relativeRarity < RarityUtils.GetRarityData(__result.rarity).relativeRarity) { __result = val2; } component.PlayerLuck = playerLuck; } } else if (component.PlayerLuck < 0 && Random.value <= (float)(-component.PlayerLuck) / 100f) { Debug.Log((object)String.Format("bad luck sucsedded with value of {0}", (object)component.PlayerLuck)); int playerLuck2 = component.PlayerLuck; component.PlayerLuck /= 2; CardInfo val3 = (CardInfo)method.Invoke((object)Cards.instance, __args); Debug.Log((object)String.Format("{0}({1}),{2}({3}) {4}", (object[])(object)new Object[5] { (Object)((Object)val3).name, (object)val3.rarity, (Object)((Object)__result).name, (object)((Component)__result).GetComponent().rarity, (object)(RarityUtils.GetRarityData(val3.rarity).relativeRarity > RarityUtils.GetRarityData(((Component)__result).GetComponent().rarity).relativeRarity) })); if (RarityUtils.GetRarityData(val3.rarity).relativeRarity > RarityUtils.GetRarityData(__result.rarity).relativeRarity) { __result = val3; } component.PlayerLuck = playerLuck2; } } [HarmonyPostfix] [HarmonyPatch(/*Could not decode attribute arguments.*/)] public static void GetRandomCardPatch(CardInfo[] cards, ref GameObject __result) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Unknown result type (might be due to invalid IL or missing references) //IL_0278: Unknown result type (might be due to invalid IL or missing references) //IL_0287: Unknown result type (might be due to invalid IL or missing references) //IL_029d: Unknown result type (might be due to invalid IL or missing references) //IL_02c1: Unknown result type (might be due to invalid IL or missing references) //IL_02d7: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) CardChoice instance = CardChoice.instance; Player val = null; if (!instance.isPlaying || !instance.IsPicking || instance.pickrID < 0) { return; } val = (((int)instance.pickerType != 0) ? PlayerManager.instance.players[instance.pickrID] : PlayerManager.instance.GetPlayersInTeam(instance.pickrID)[0]); Luck component = ((Component)val).GetComponent(); if (component.PlayerLuck > 0) { if (Random.value <= (float)component.PlayerLuck / 50f) { Debug.Log((object)String.Format("luck sucsedded with value of {0}", (object)component.PlayerLuck)); int playerLuck = component.PlayerLuck; if (component.PlayerLuck > 200) { component.PlayerLuck = (int)((float)component.PlayerLuck * 0.75f); } else { component.PlayerLuck /= 2; } CardInfo component2 = CardChoicePatchGetRanomCard.OrignialGetRanomCard(cards).GetComponent(); Debug.Log((object)String.Format("{0}({1}),{2}({3}) {4}", (object[])(object)new Object[5] { (Object)((Object)component2).name, (object)component2.rarity, (Object)((Object)__result).name, (object)__result.GetComponent().rarity, (object)(RarityUtils.GetRarityData(component2.rarity).relativeRarity < RarityUtils.GetRarityData(__result.GetComponent().rarity).relativeRarity) })); if (RarityUtils.GetRarityData(component2.rarity).relativeRarity < RarityUtils.GetRarityData(__result.GetComponent().rarity).relativeRarity) { __result = ((Component)component2).gameObject; } component.PlayerLuck = playerLuck; } } else if (component.PlayerLuck < 0 && Random.value <= (float)(-component.PlayerLuck) / 100f) { Debug.Log((object)String.Format("bad luck sucsedded with value of {0}", (object)component.PlayerLuck)); int playerLuck2 = component.PlayerLuck; component.PlayerLuck /= 2; CardInfo component3 = CardChoicePatchGetRanomCard.OrignialGetRanomCard(cards).GetComponent(); Debug.Log((object)String.Format("{0}({1}),{2}({3}) {4}", (object[])(object)new Object[5] { (Object)((Object)component3).name, (object)component3.rarity, (Object)((Object)__result).name, (object)__result.GetComponent().rarity, (object)(RarityUtils.GetRarityData(component3.rarity).relativeRarity > RarityUtils.GetRarityData(__result.GetComponent().rarity).relativeRarity) })); if (RarityUtils.GetRarityData(component3.rarity).relativeRarity > RarityUtils.GetRarityData(__result.GetComponent().rarity).relativeRarity) { __result = ((Component)component3).gameObject; } component.PlayerLuck = playerLuck2; } } } }