using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Bootstrap;
using HarmonyLib;
using ModdingUtils.Utils;
using RarityLib.Utils;
using UnboundLib;
using UnityEngine;
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("Rarity Bundle")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Rarity Bundle")]
[assembly: AssemblyTitle("Rarity Bundle")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace RarityBundle;
[Serializable]
[HarmonyPatch(typeof(Cards))]
public class ModingUtilsCardsPatch
{
[HarmonyPatch("CardDoesNotConflictWithCards")]
public static void CardDoesNotConflictWithCardsPatch(CardInfo card, CardInfo[] cards, ref bool __result)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
if (__result && card.rarity == RarityBundle.Unique)
{
__result = !cards.Any((CardInfo c) => c.rarity == RarityBundle.Unique);
}
}
[HarmonyPatch("AddCardToPlayer", new Type[]
{
typeof(Player),
typeof(CardInfo),
typeof(bool),
typeof(string),
typeof(float),
typeof(float),
typeof(bool)
})]
public static bool AddCardToPlayerPatch(Player player, CardInfo card)
{
//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)
if ((Object)(object)player == (Object)null || (Object)(object)card == (Object)null)
{
return true;
}
return card.rarity != RarityBundle.Unique || !player.data.currentCards.Any((CardInfo c) => c.rarity == RarityBundle.Unique);
}
}
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("com.CrazyCoders.Rounds.RarityBundle", "RarityBundle", "0.2.1")]
[BepInProcess("Rounds.exe")]
public class RarityBundle : BaseUnityPlugin
{
private const string ModId = "com.CrazyCoders.Rounds.RarityBundle";
private const string ModName = "RarityBundle";
public const string Version = "0.2.1";
public static Rarity Trinket;
public static Rarity Common;
public static Rarity Scarce;
public static Rarity Uncommon;
public static Rarity Exotic;
public static Rarity Rare;
public static Rarity Epic;
public static Rarity Legendary;
public static Rarity Mythical;
public static Rarity Divine;
public static Rarity Unique;
public static RarityBundle instance { get; private set; }
private void Awake()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
//IL_0103: Unknown result type (might be due to invalid IL or missing references)
//IL_0108: Unknown result type (might be due to invalid IL or missing references)
//IL_012a: 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_013e: Unknown result type (might be due to invalid IL or missing references)
//IL_0143: 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_016a: Unknown result type (might be due to invalid IL or missing references)
//IL_0179: Unknown result type (might be due to invalid IL or missing references)
//IL_017e: Unknown result type (might be due to invalid IL or missing references)
//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
//IL_0204: Unknown result type (might be due to invalid IL or missing references)
//IL_0209: Unknown result type (might be due to invalid IL or missing references)
new Harmony("com.CrazyCoders.Rounds.RarityBundle").PatchAll();
List<BaseUnityPlugin> list = (List<BaseUnityPlugin>)typeof(Chainloader).GetField("_plugins", BindingFlags.Static | BindingFlags.NonPublic).GetValue(null);
RarityUtils.AddRarity("Trinket", list.Exists((BaseUnityPlugin plugin) => plugin.Info.Metadata.GUID == "Root.Rarity.Dard.Draw") ? 1.75f : 3f, new Color(0.38f, 0.38f, 0.38f), new Color(0.0978f, 0.1088f, 0.1321f));
RarityUtils.AddRarity("Scarce", 0.7f, Color32.op_Implicit(new Color32((byte)0, (byte)172, (byte)98, byte.MaxValue)), Color32.op_Implicit(new Color32((byte)0, (byte)95, (byte)60, byte.MaxValue)));
RarityUtils.AddRarity("Exotic", 0.25f, Color32.op_Implicit(new Color32((byte)10, (byte)50, byte.MaxValue, byte.MaxValue)), Color32.op_Implicit(new Color32((byte)5, (byte)25, (byte)150, byte.MaxValue)));
RarityUtils.AddRarity("Epic", 0.0625f, Color32.op_Implicit(new Color32((byte)225, (byte)0, (byte)50, byte.MaxValue)), Color32.op_Implicit(new Color32((byte)125, (byte)0, (byte)20, byte.MaxValue)));
RarityUtils.AddRarity("Mythical", 1f / 160f, Color32.op_Implicit(new Color32((byte)0, byte.MaxValue, (byte)70, byte.MaxValue)), Color32.op_Implicit(new Color32((byte)0, (byte)125, (byte)35, byte.MaxValue)));
RarityUtils.AddRarity("Divine", 0.0015625f, Color32.op_Implicit(new Color32(byte.MaxValue, byte.MaxValue, (byte)180, byte.MaxValue)), Color32.op_Implicit(new Color32((byte)125, (byte)125, (byte)100, byte.MaxValue)));
RarityUtils.AddRarity("Unique", 0.003f, Color32.op_Implicit(new Color32(byte.MaxValue, byte.MaxValue, (byte)130, byte.MaxValue)), Color32.op_Implicit(new Color32((byte)0, byte.MaxValue, byte.MaxValue, byte.MaxValue)));
}
private void Start()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: 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_0035: 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)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: 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_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: Unknown result type (might be due to invalid IL or missing references)
Trinket = RarityUtils.GetRarity("Trinket");
Common = (Rarity)0;
Scarce = RarityUtils.GetRarity("Scarce");
Uncommon = (Rarity)1;
Exotic = RarityUtils.GetRarity("Exotic");
Rare = (Rarity)2;
Epic = RarityUtils.GetRarity("Epic");
Legendary = RarityUtils.GetRarity("Legendary");
Mythical = RarityUtils.GetRarity("Mythical");
Divine = RarityUtils.GetRarity("Divine");
Unique = RarityUtils.GetRarity("Unique");
Cards.instance.AddCardValidationFunction((Func<Player, CardInfo, bool>)delegate(Player player, CardInfo cardinfo)
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
if (cardinfo.rarity != Unique)
{
return true;
}
if (player.data.currentCards.Any((CardInfo c) => c.rarity == Unique))
{
return false;
}
if ((Object)(object)CardChoice.instance != (Object)null && ((List<GameObject>)ExtensionMethods.GetFieldValue((object)CardChoice.instance, "spawnedCards")).Any((GameObject g) => (Object)(object)g != (Object)null && (Object)(object)g.GetComponent<CardInfo>() != (Object)null && g.GetComponent<CardInfo>().rarity == Unique))
{
return false;
}
return (!PlayerManager.instance.players.Any((Player p) => p.data.currentCards.Any((CardInfo c) => (Object)(object)c == (Object)(object)cardinfo))) ? true : false;
});
}
}
public static class Rarities
{
public static Rarity Trinket => RarityUtils.GetRarity("Trinket");
public static Rarity Common => (Rarity)0;
public static Rarity Scarce => RarityUtils.GetRarity("Scarce");
public static Rarity Uncommon => (Rarity)1;
public static Rarity Exotic => RarityUtils.GetRarity("Exotic");
public static Rarity Rare => (Rarity)2;
public static Rarity Epic => RarityUtils.GetRarity("Epic");
public static Rarity Legendary => RarityUtils.GetRarity("Legendary");
public static Rarity Mythical => RarityUtils.GetRarity("Mythical");
public static Rarity Divine => RarityUtils.GetRarity("Divine");
public static Rarity GetRarity(string name)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
return RarityUtils.GetRarity(name);
}
}
[Serializable]
[HarmonyPatch(typeof(CardRarityColor), "Toggle")]
public class UniqueRarityColor : MonoBehaviour
{
private static bool Prefix(CardRarityColor __instance)
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Invalid comparison between Unknown and I4
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: Unknown result type (might be due to invalid IL or missing references)
CardInfo componentInParent = ((Component)__instance).GetComponentInParent<CardInfo>();
if ((Object)(object)componentInParent == (Object)null || componentInParent.rarity != RarityBundle.Unique || (int)componentInParent.rarity == 0)
{
return true;
}
((Component)__instance).gameObject.AddComponent<UniqueRarityColor>();
CardVisuals componentInParent2 = ((Component)__instance).GetComponentInParent<CardVisuals>();
componentInParent2.toggleSelectionAction = (Action<bool>)Delegate.Remove(componentInParent2.toggleSelectionAction, new Action<bool>(__instance.Toggle));
Object.Destroy((Object)(object)__instance);
((Graphic)((Component)__instance).GetComponent<Image>()).color = RarityUtils.GetRarityData(RarityBundle.Unique).color;
return false;
}
private void Update()
{
//IL_002d: 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_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: 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_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_00b8: 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_00be: Unknown result type (might be due to invalid IL or missing references)
//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
Image component = ((Component)this).GetComponent<Image>();
CanvasRenderer component2 = ((Component)this).GetComponent<CanvasRenderer>();
if (!((Object)(object)component == (Object)null) && !((Object)(object)component2 == (Object)null))
{
Color32 val = Color32.op_Implicit(RarityUtils.GetRarityData(RarityBundle.Unique).color);
Color32 val2 = Color32.op_Implicit(RarityUtils.GetRarityData(RarityBundle.Unique).colorOff);
if (component2.GetColor() == Color.white)
{
((Graphic)component).color = Color.white;
component2.SetColor(Color32.op_Implicit(val2));
}
if (component2.GetColor() == Color32.op_Implicit(val2))
{
((Graphic)component).CrossFadeColor(Color32.op_Implicit(val), 0.75f, true, true);
}
else if (component2.GetColor() == Color32.op_Implicit(val))
{
((Graphic)component).CrossFadeColor(Color32.op_Implicit(val2), 0.75f, true, true);
}
}
}
}