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 System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Logging;
using CardChoiceSpawnUniqueCardPatch.CustomCategories;
using CorruptedCardsManager.Extensions;
using CorruptedCardsManager.MonoBehaviours;
using CorruptedCardsManager.StatsGroup;
using CorruptedCardsManager.Utils;
using FancyCardBar;
using HarmonyLib;
using Jotunn.Utils;
using Microsoft.CodeAnalysis;
using ModdingUtils.Patches;
using RandomCardsGenerators;
using RandomCardsGenerators.Cards;
using RandomCardsGenerators.StatsGroup;
using RandomCardsGenerators.Utils;
using RarityLib.Utils;
using TMPro;
using TabInfo.Utils;
using UnboundLib;
using UnboundLib.GameModes;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.1", FrameworkDisplayName = ".NET Framework 4.7.1")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.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 CorruptedCardsManager
{
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("com.aalund13.rounds.corrupted_cards_manager", "Corrupted Cards Manager", "1.0.1")]
[BepInProcess("Rounds.exe")]
public class Main : BaseUnityPlugin
{
private const string modId = "com.aalund13.rounds.corrupted_cards_manager";
private const string modName = "Corrupted Cards Manager";
internal const string modInitials = "CCM";
internal static Main instance;
internal static AssetBundle assets;
internal static ManualLogSource ModLogger;
internal static GameObject corruptedCardFancyIconPrefab;
private void Awake()
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
instance = this;
ModLogger = ((BaseUnityPlugin)this).Logger;
new Harmony("com.aalund13.rounds.corrupted_cards_manager").PatchAll();
assets = AssetUtils.LoadAssetBundleFromResources("corruptedmanager_assets", typeof(Main).Assembly);
corruptedCardFancyIconPrefab = assets.LoadAsset<GameObject>("I_Corrupted");
Debug.Log("Corrupted Cards Manager loaded!");
}
private void Start()
{
if (((List<BaseUnityPlugin>)typeof(Chainloader).GetField("_plugins", BindingFlags.Static | BindingFlags.NonPublic).GetValue(null)).Exists((BaseUnityPlugin plugin) => plugin.Info.Metadata.GUID == "com.willuwontu.rounds.tabinfo"))
{
TabinfoInterface.Setup();
}
GameModeManager.AddHook("BattleStart", (Func<IGameModeHandler, IEnumerator>)WhenBattleStarts);
GameModeManager.AddHook("GameStart", (Func<IGameModeHandler, IEnumerator>)WhenGameStart);
CorruptedCardsManager.Init();
}
private IEnumerator WhenBattleStarts(IGameModeHandler handler)
{
foreach (Player player in PlayerManager.instance.players)
{
player.data.GetAdditionalData().CorruptedCardSpawnChance += player.data.GetAdditionalData().CorruptedCardSpawnChancePerFight;
}
yield break;
}
private IEnumerator WhenGameStart(IGameModeHandler handler)
{
foreach (Player player in PlayerManager.instance.players)
{
player.data.GetAdditionalData().CorruptedCardSpawnChance = 0f;
}
yield break;
}
}
public enum CorruptedCardRarity
{
Trinket,
Common,
Scarce,
Uncommon,
Exotic,
Rare,
Epic,
Legendary,
Mythical,
Divine
}
public static class CorruptedCardsManager
{
public static readonly Dictionary<CardInfo, DrawableRandomCard> DrawableCorruptedCards = new Dictionary<CardInfo, DrawableRandomCard>();
public static readonly CardCategory CantCorruptedCardCategory = CustomCardCategories.instance.CardCategory("CantCorruptedCardCategory");
public static ModRandomCardsGenerators<CorruptedCardRarity> CorruptedCardsGenerators;
private static readonly Dictionary<CorruptedCardRarity, RandomCardsGenerator> cardGenerators = new Dictionary<CorruptedCardRarity, RandomCardsGenerator>();
internal static void Init()
{
CreateCardGenerators();
CorruptedCardsGenerators = new ModRandomCardsGenerators<CorruptedCardRarity>(cardGenerators);
LoggerUtils.LogInfo("Corrupted Cards Manager initialized!");
}
private static void CreateCardGenerators()
{
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Expected O, but got Unknown
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Expected O, but got Unknown
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Expected O, but got Unknown
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Expected O, but got Unknown
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Expected O, but got Unknown
//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
//IL_00ac: Expected O, but got Unknown
//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Expected O, but got Unknown
//IL_00de: Unknown result type (might be due to invalid IL or missing references)
//IL_00e8: Expected O, but got Unknown
//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
//IL_0102: Expected O, but got Unknown
//IL_0112: Unknown result type (might be due to invalid IL or missing references)
//IL_011c: Expected O, but got Unknown
//IL_012c: Unknown result type (might be due to invalid IL or missing references)
//IL_0136: Expected O, but got Unknown
//IL_0146: Unknown result type (might be due to invalid IL or missing references)
//IL_0150: Expected O, but got Unknown
//IL_0160: Unknown result type (might be due to invalid IL or missing references)
//IL_016a: Expected O, but got Unknown
//IL_017a: Unknown result type (might be due to invalid IL or missing references)
//IL_0184: Expected O, but got Unknown
//IL_018f: Unknown result type (might be due to invalid IL or missing references)
//IL_0199: Expected O, but got Unknown
//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
//IL_01da: Expected O, but got Unknown
//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
//IL_01f4: Expected O, but got Unknown
//IL_0204: Unknown result type (might be due to invalid IL or missing references)
//IL_020e: Expected O, but got Unknown
//IL_021e: Unknown result type (might be due to invalid IL or missing references)
//IL_0228: Expected O, but got Unknown
//IL_0238: Unknown result type (might be due to invalid IL or missing references)
//IL_0242: Expected O, but got Unknown
//IL_0252: Unknown result type (might be due to invalid IL or missing references)
//IL_025c: Expected O, but got Unknown
//IL_026c: Unknown result type (might be due to invalid IL or missing references)
//IL_0276: Expected O, but got Unknown
//IL_0281: Unknown result type (might be due to invalid IL or missing references)
//IL_028b: Expected O, but got Unknown
//IL_02c2: Unknown result type (might be due to invalid IL or missing references)
//IL_02cc: Expected O, but got Unknown
//IL_02dc: Unknown result type (might be due to invalid IL or missing references)
//IL_02e6: Expected O, but got Unknown
//IL_02f6: Unknown result type (might be due to invalid IL or missing references)
//IL_0300: Expected O, but got Unknown
//IL_0310: Unknown result type (might be due to invalid IL or missing references)
//IL_031a: Expected O, but got Unknown
//IL_032a: Unknown result type (might be due to invalid IL or missing references)
//IL_0334: Expected O, but got Unknown
//IL_0344: Unknown result type (might be due to invalid IL or missing references)
//IL_034e: Expected O, but got Unknown
//IL_035e: Unknown result type (might be due to invalid IL or missing references)
//IL_0368: Expected O, but got Unknown
//IL_0373: Unknown result type (might be due to invalid IL or missing references)
//IL_037d: Expected O, but got Unknown
//IL_038d: Unknown result type (might be due to invalid IL or missing references)
//IL_0397: Expected O, but got Unknown
//IL_03ac: Unknown result type (might be due to invalid IL or missing references)
//IL_03b6: Expected O, but got Unknown
//IL_03ed: Unknown result type (might be due to invalid IL or missing references)
//IL_03f7: Expected O, but got Unknown
//IL_0407: Unknown result type (might be due to invalid IL or missing references)
//IL_0411: Expected O, but got Unknown
//IL_0421: Unknown result type (might be due to invalid IL or missing references)
//IL_042b: Expected O, but got Unknown
//IL_043b: Unknown result type (might be due to invalid IL or missing references)
//IL_0445: Expected O, but got Unknown
//IL_0455: Unknown result type (might be due to invalid IL or missing references)
//IL_045f: Expected O, but got Unknown
//IL_046f: Unknown result type (might be due to invalid IL or missing references)
//IL_0479: Expected O, but got Unknown
//IL_0489: Unknown result type (might be due to invalid IL or missing references)
//IL_0493: Expected O, but got Unknown
//IL_049e: Unknown result type (might be due to invalid IL or missing references)
//IL_04a8: Expected O, but got Unknown
//IL_04b8: Unknown result type (might be due to invalid IL or missing references)
//IL_04c2: Expected O, but got Unknown
//IL_04d7: Unknown result type (might be due to invalid IL or missing references)
//IL_04e1: Expected O, but got Unknown
//IL_0518: Unknown result type (might be due to invalid IL or missing references)
//IL_0522: Expected O, but got Unknown
//IL_0532: Unknown result type (might be due to invalid IL or missing references)
//IL_053c: Expected O, but got Unknown
//IL_054c: Unknown result type (might be due to invalid IL or missing references)
//IL_0556: Expected O, but got Unknown
//IL_0566: Unknown result type (might be due to invalid IL or missing references)
//IL_0570: Expected O, but got Unknown
//IL_0580: Unknown result type (might be due to invalid IL or missing references)
//IL_058a: Expected O, but got Unknown
//IL_059a: Unknown result type (might be due to invalid IL or missing references)
//IL_05a4: Expected O, but got Unknown
//IL_05b4: Unknown result type (might be due to invalid IL or missing references)
//IL_05be: Expected O, but got Unknown
//IL_05c9: Unknown result type (might be due to invalid IL or missing references)
//IL_05d3: Expected O, but got Unknown
//IL_05e3: Unknown result type (might be due to invalid IL or missing references)
//IL_05ed: Expected O, but got Unknown
//IL_05f8: Unknown result type (might be due to invalid IL or missing references)
//IL_0602: Expected O, but got Unknown
//IL_0617: Unknown result type (might be due to invalid IL or missing references)
//IL_0621: Expected O, but got Unknown
//IL_0658: Unknown result type (might be due to invalid IL or missing references)
//IL_0662: Expected O, but got Unknown
//IL_0672: Unknown result type (might be due to invalid IL or missing references)
//IL_067c: Expected O, but got Unknown
//IL_068c: Unknown result type (might be due to invalid IL or missing references)
//IL_0696: Expected O, but got Unknown
//IL_06a6: Unknown result type (might be due to invalid IL or missing references)
//IL_06b0: Expected O, but got Unknown
//IL_06c0: Unknown result type (might be due to invalid IL or missing references)
//IL_06ca: Expected O, but got Unknown
//IL_06da: Unknown result type (might be due to invalid IL or missing references)
//IL_06e4: Expected O, but got Unknown
//IL_06f4: Unknown result type (might be due to invalid IL or missing references)
//IL_06fe: Expected O, but got Unknown
//IL_0709: Unknown result type (might be due to invalid IL or missing references)
//IL_0713: Expected O, but got Unknown
//IL_0723: Unknown result type (might be due to invalid IL or missing references)
//IL_072d: Expected O, but got Unknown
//IL_0738: Unknown result type (might be due to invalid IL or missing references)
//IL_0742: Expected O, but got Unknown
//IL_0757: Unknown result type (might be due to invalid IL or missing references)
//IL_0761: Expected O, but got Unknown
//IL_0776: Unknown result type (might be due to invalid IL or missing references)
//IL_0780: Expected O, but got Unknown
//IL_07b7: Unknown result type (might be due to invalid IL or missing references)
//IL_07c1: Expected O, but got Unknown
//IL_07d1: Unknown result type (might be due to invalid IL or missing references)
//IL_07db: Expected O, but got Unknown
//IL_07eb: Unknown result type (might be due to invalid IL or missing references)
//IL_07f5: Expected O, but got Unknown
//IL_0805: Unknown result type (might be due to invalid IL or missing references)
//IL_080f: Expected O, but got Unknown
//IL_081f: Unknown result type (might be due to invalid IL or missing references)
//IL_0829: Expected O, but got Unknown
//IL_0839: Unknown result type (might be due to invalid IL or missing references)
//IL_0843: Expected O, but got Unknown
//IL_0853: Unknown result type (might be due to invalid IL or missing references)
//IL_085d: Expected O, but got Unknown
//IL_0868: Unknown result type (might be due to invalid IL or missing references)
//IL_0872: Expected O, but got Unknown
//IL_0882: Unknown result type (might be due to invalid IL or missing references)
//IL_088c: Expected O, but got Unknown
//IL_0897: Unknown result type (might be due to invalid IL or missing references)
//IL_08a1: Expected O, but got Unknown
//IL_08b6: Unknown result type (might be due to invalid IL or missing references)
//IL_08c0: Expected O, but got Unknown
//IL_08d5: Unknown result type (might be due to invalid IL or missing references)
//IL_08df: Expected O, but got Unknown
//IL_0916: Unknown result type (might be due to invalid IL or missing references)
//IL_0920: Expected O, but got Unknown
//IL_0930: Unknown result type (might be due to invalid IL or missing references)
//IL_093a: Expected O, but got Unknown
//IL_094a: Unknown result type (might be due to invalid IL or missing references)
//IL_0954: Expected O, but got Unknown
//IL_0964: Unknown result type (might be due to invalid IL or missing references)
//IL_096e: Expected O, but got Unknown
//IL_097e: Unknown result type (might be due to invalid IL or missing references)
//IL_0988: Expected O, but got Unknown
//IL_0998: Unknown result type (might be due to invalid IL or missing references)
//IL_09a2: Expected O, but got Unknown
//IL_09b2: Unknown result type (might be due to invalid IL or missing references)
//IL_09bc: Expected O, but got Unknown
//IL_09c7: Unknown result type (might be due to invalid IL or missing references)
//IL_09d1: Expected O, but got Unknown
//IL_09e1: Unknown result type (might be due to invalid IL or missing references)
//IL_09eb: Expected O, but got Unknown
//IL_09f6: Unknown result type (might be due to invalid IL or missing references)
//IL_0a00: Expected O, but got Unknown
//IL_0a15: Unknown result type (might be due to invalid IL or missing references)
//IL_0a1f: Expected O, but got Unknown
//IL_0a34: Unknown result type (might be due to invalid IL or missing references)
//IL_0a3e: Expected O, but got Unknown
//IL_0a76: Unknown result type (might be due to invalid IL or missing references)
//IL_0a80: Expected O, but got Unknown
//IL_0a90: Unknown result type (might be due to invalid IL or missing references)
//IL_0a9a: Expected O, but got Unknown
//IL_0aaa: Unknown result type (might be due to invalid IL or missing references)
//IL_0ab4: Expected O, but got Unknown
//IL_0ac4: Unknown result type (might be due to invalid IL or missing references)
//IL_0ace: Expected O, but got Unknown
//IL_0ade: Unknown result type (might be due to invalid IL or missing references)
//IL_0ae8: Expected O, but got Unknown
//IL_0af8: Unknown result type (might be due to invalid IL or missing references)
//IL_0b02: Expected O, but got Unknown
//IL_0b12: Unknown result type (might be due to invalid IL or missing references)
//IL_0b1c: Expected O, but got Unknown
//IL_0b27: Unknown result type (might be due to invalid IL or missing references)
//IL_0b31: Expected O, but got Unknown
//IL_0b41: Unknown result type (might be due to invalid IL or missing references)
//IL_0b4b: Expected O, but got Unknown
//IL_0b56: Unknown result type (might be due to invalid IL or missing references)
//IL_0b60: Expected O, but got Unknown
//IL_0b75: Unknown result type (might be due to invalid IL or missing references)
//IL_0b7f: Expected O, but got Unknown
//IL_0b94: Unknown result type (might be due to invalid IL or missing references)
//IL_0b9e: Expected O, but got Unknown
LoggerUtils.LogInfo("Creating corrupted card generators...");
CreateRandomCardsGenerator(CorruptedCardRarity.Trinket, new List<RandomStatGenerator>
{
(RandomStatGenerator)new DamageStatGenerator(-0.15f, 0.1f, 0.05f),
(RandomStatGenerator)new ReloadTimeStatGenerator(-0.1f, 0.1f, 0.05f),
(RandomStatGenerator)new AttackSpeedStatGenerator(-0.1f, 0.1f, 0.05f),
(RandomStatGenerator)new MovementSpeedStatGenerator(-0.05f, 0.05f, 0.01f),
(RandomStatGenerator)new HealthStatGenerator(-0.1f, 0.1f, 0.05f),
(RandomStatGenerator)new BulletSpeedStatGenerator(-0.1f, 0.1f, 0.05f),
(RandomStatGenerator)new AmmoStatGenerator(-1f, 1f)
}, 1, 2);
CreateRandomCardsGenerator(CorruptedCardRarity.Common, new List<RandomStatGenerator>
{
(RandomStatGenerator)new DamageStatGenerator(-0.3f, 0.3f, 0.05f),
(RandomStatGenerator)new ReloadTimeStatGenerator(-0.3f, 0.15f, 0.05f),
(RandomStatGenerator)new AttackSpeedStatGenerator(-0.3f, 0.15f, 0.05f),
(RandomStatGenerator)new MovementSpeedStatGenerator(-0.1f, 0.1f, 0.05f),
(RandomStatGenerator)new HealthStatGenerator(-0.3f, 0.3f, 0.05f),
(RandomStatGenerator)new BlockCooldownStatGenerator(-0.05f, 0.05f, 0.025f),
(RandomStatGenerator)new BulletSpeedStatGenerator(-0.3f, 0.3f, 0.05f),
(RandomStatGenerator)new AmmoStatGenerator(-2f, 2f),
(RandomStatGenerator)(object)new CorruptedCardSpawnChanceStatGenerator(-0.05f, 0.05f)
}, 1, 3);
CreateRandomCardsGenerator(CorruptedCardRarity.Scarce, new List<RandomStatGenerator>
{
(RandomStatGenerator)new DamageStatGenerator(-0.35f, 0.4f, 0.05f),
(RandomStatGenerator)new ReloadTimeStatGenerator(-0.4f, 0.2f, 0.05f),
(RandomStatGenerator)new AttackSpeedStatGenerator(-0.4f, 0.2f, 0.05f),
(RandomStatGenerator)new MovementSpeedStatGenerator(-0.15f, 0.2f, 0.05f),
(RandomStatGenerator)new HealthStatGenerator(-0.25f, 0.4f, 0.05f),
(RandomStatGenerator)new BlockCooldownStatGenerator(-0.1f, 0.1f, 0.025f),
(RandomStatGenerator)new BulletSpeedStatGenerator(-0.3f, 0.35f, 0.05f),
(RandomStatGenerator)new AmmoStatGenerator(-2f, 3f),
(RandomStatGenerator)(object)new CorruptedCardSpawnChanceStatGenerator(-0.075f, 0.075f)
}, 1, 3);
CreateRandomCardsGenerator(CorruptedCardRarity.Uncommon, new List<RandomStatGenerator>
{
(RandomStatGenerator)new DamageStatGenerator(-0.4f, 0.5f, 0.05f),
(RandomStatGenerator)new ReloadTimeStatGenerator(-0.45f, 0.255f, 0.05f),
(RandomStatGenerator)new AttackSpeedStatGenerator(-0.45f, 0.25f, 0.05f),
(RandomStatGenerator)new MovementSpeedStatGenerator(-0.15f, 0.25f, 0.05f),
(RandomStatGenerator)new HealthStatGenerator(-0.25f, 0.5f, 0.05f),
(RandomStatGenerator)new BlockCooldownStatGenerator(-0.15f, 0.1f, 0.025f),
(RandomStatGenerator)new BulletSpeedStatGenerator(-0.3f, 0.4f, 0.05f),
(RandomStatGenerator)new AmmoStatGenerator(-2f, 4f),
(RandomStatGenerator)new RegenStatGenerator(0f, 5f, 1f),
(RandomStatGenerator)new AdditionalBlocksStatGenerator(0f, RandomStatsUtils.ScaleStatByIntensity(0.15f, 1f)),
(RandomStatGenerator)(object)new CorruptedCardSpawnChanceStatGenerator(-0.1f, 0.1f)
}, 1, 3);
CreateRandomCardsGenerator(CorruptedCardRarity.Exotic, new List<RandomStatGenerator>
{
(RandomStatGenerator)new DamageStatGenerator(-0.45f, 0.6f, 0.05f),
(RandomStatGenerator)new ReloadTimeStatGenerator(-0.5f, 0.25f, 0.05f),
(RandomStatGenerator)new AttackSpeedStatGenerator(-0.5f, 0.25f, 0.05f),
(RandomStatGenerator)new MovementSpeedStatGenerator(-0.2f, 0.3f, 0.05f),
(RandomStatGenerator)new HealthStatGenerator(-0.3f, 0.6f, 0.05f),
(RandomStatGenerator)new BlockCooldownStatGenerator(-0.2f, 0.15f, 0.025f),
(RandomStatGenerator)new BulletSpeedStatGenerator(-0.3f, 0.5f, 0.05f),
(RandomStatGenerator)new AmmoStatGenerator(-3f, 5f),
(RandomStatGenerator)new RegenStatGenerator(0f, 8f, 1f),
(RandomStatGenerator)new AdditionalBlocksStatGenerator(0f, RandomStatsUtils.ScaleStatByIntensity(0.2f, 1f)),
(RandomStatGenerator)(object)new CorruptedCardSpawnChanceStatGenerator(-0.15f, 0.15f)
}, 1, 4);
CreateRandomCardsGenerator(CorruptedCardRarity.Rare, new List<RandomStatGenerator>
{
(RandomStatGenerator)new DamageStatGenerator(-0.5f, 0.8f, 0.05f),
(RandomStatGenerator)new ReloadTimeStatGenerator(-0.6f, 0.3f, 0.05f),
(RandomStatGenerator)new AttackSpeedStatGenerator(-0.6f, 0.3f, 0.05f),
(RandomStatGenerator)new MovementSpeedStatGenerator(-0.2f, 0.35f, 0.05f),
(RandomStatGenerator)new HealthStatGenerator(-0.35f, 0.75f, 0.05f),
(RandomStatGenerator)new BlockCooldownStatGenerator(-0.25f, 0.15f, 0.025f),
(RandomStatGenerator)new BulletSpeedStatGenerator(-0.3f, 0.6f, 0.05f),
(RandomStatGenerator)new AmmoStatGenerator(-3f, 6f),
(RandomStatGenerator)new RegenStatGenerator(0f, 15f, 1f),
(RandomStatGenerator)new JumpStatGenerator(0f, 1f),
(RandomStatGenerator)new AdditionalBlocksStatGenerator(0f, RandomStatsUtils.ScaleStatByIntensity(0.25f, 1f)),
(RandomStatGenerator)(object)new CorruptedCardSpawnChanceStatGenerator(-0.2f, 0.2f)
}, 1, 4);
CreateRandomCardsGenerator(CorruptedCardRarity.Epic, new List<RandomStatGenerator>
{
(RandomStatGenerator)new DamageStatGenerator(-0.55f, 0.9f, 0.05f),
(RandomStatGenerator)new ReloadTimeStatGenerator(-0.7f, 0.35f, 0.05f),
(RandomStatGenerator)new AttackSpeedStatGenerator(-0.7f, 0.35f, 0.05f),
(RandomStatGenerator)new MovementSpeedStatGenerator(-0.25f, 0.4f, 0.05f),
(RandomStatGenerator)new HealthStatGenerator(-0.45f, 0.9f, 0.05f),
(RandomStatGenerator)new BlockCooldownStatGenerator(-0.3f, 0.2f, 0.025f),
(RandomStatGenerator)new BulletSpeedStatGenerator(-0.3f, 0.65f, 0.05f),
(RandomStatGenerator)new AmmoStatGenerator(-4f, 7f),
(RandomStatGenerator)new RegenStatGenerator(0f, 25f, 1f),
(RandomStatGenerator)new JumpStatGenerator(0f, 1.5f),
(RandomStatGenerator)new AdditionalBlocksStatGenerator(0f, RandomStatsUtils.ScaleStatByIntensity(0.3f, 1f)),
(RandomStatGenerator)new ExtraLiveStatGenerator(0f, RandomStatsUtils.ScaleStatByIntensity(0.275f, 1f)),
(RandomStatGenerator)(object)new CorruptedCardSpawnChanceStatGenerator(-0.25f, 0.25f)
}, 1, 5);
CreateRandomCardsGenerator(CorruptedCardRarity.Legendary, new List<RandomStatGenerator>
{
(RandomStatGenerator)new DamageStatGenerator(-0.6f, 1f, 0.05f),
(RandomStatGenerator)new ReloadTimeStatGenerator(-0.75f, 0.4f, 0.05f),
(RandomStatGenerator)new AttackSpeedStatGenerator(-0.75f, 0.4f, 0.05f),
(RandomStatGenerator)new MovementSpeedStatGenerator(-0.25f, 0.45f, 0.05f),
(RandomStatGenerator)new HealthStatGenerator(-0.5f, 1f, 0.05f),
(RandomStatGenerator)new BlockCooldownStatGenerator(-0.35f, 0.2f, 0.025f),
(RandomStatGenerator)new BulletSpeedStatGenerator(-0.3f, 0.75f, 0.05f),
(RandomStatGenerator)new AmmoStatGenerator(-4f, 8f),
(RandomStatGenerator)new RegenStatGenerator(0f, 35f, 1f),
(RandomStatGenerator)new JumpStatGenerator(0f, 2f),
(RandomStatGenerator)new AdditionalBlocksStatGenerator(0f, RandomStatsUtils.ScaleStatByIntensity(0.4f, 1f)),
(RandomStatGenerator)new ExtraLiveStatGenerator(0f, RandomStatsUtils.ScaleStatByIntensity(0.35f, 1f)),
(RandomStatGenerator)(object)new CorruptedCardSpawnChanceStatGenerator(-0.35f, 0.35f)
}, 1, 5);
CreateRandomCardsGenerator(CorruptedCardRarity.Mythical, new List<RandomStatGenerator>
{
(RandomStatGenerator)new DamageStatGenerator(-0.65f, 1.25f, 0.05f),
(RandomStatGenerator)new ReloadTimeStatGenerator(-0.8f, 0.45f, 0.05f),
(RandomStatGenerator)new AttackSpeedStatGenerator(-0.8f, 0.45f, 0.05f),
(RandomStatGenerator)new MovementSpeedStatGenerator(-0.3f, 0.5f, 0.05f),
(RandomStatGenerator)new HealthStatGenerator(-0.55f, 1.25f, 0.05f),
(RandomStatGenerator)new BlockCooldownStatGenerator(-0.4f, 0.25f, 0.025f),
(RandomStatGenerator)new BulletSpeedStatGenerator(-0.3f, 0.8f, 0.05f),
(RandomStatGenerator)new AmmoStatGenerator(-5f, 10f),
(RandomStatGenerator)new RegenStatGenerator(0f, 45f, 1f),
(RandomStatGenerator)new JumpStatGenerator(0f, 2.5f),
(RandomStatGenerator)new AdditionalBlocksStatGenerator(0f, RandomStatsUtils.ScaleStatByIntensity(0.5f, 1f)),
(RandomStatGenerator)new ExtraLiveStatGenerator(0f, RandomStatsUtils.ScaleStatByIntensity(0.45f, 1f)),
(RandomStatGenerator)(object)new CorruptedCardSpawnChanceStatGenerator(-0.4f, 0.4f)
}, 1, 6);
CreateRandomCardsGenerator(CorruptedCardRarity.Divine, new List<RandomStatGenerator>
{
(RandomStatGenerator)new DamageStatGenerator(-0.7f, 1.5f, 0.05f),
(RandomStatGenerator)new ReloadTimeStatGenerator(-0.85f, 0.5f, 0.05f),
(RandomStatGenerator)new AttackSpeedStatGenerator(-0.85f, 0.5f, 0.05f),
(RandomStatGenerator)new MovementSpeedStatGenerator(-0.35f, 0.55f, 0.05f),
(RandomStatGenerator)new HealthStatGenerator(-0.65f, 1.5f, 0.05f),
(RandomStatGenerator)new BlockCooldownStatGenerator(-0.45f, 0.25f, 0.025f),
(RandomStatGenerator)new BulletSpeedStatGenerator(-0.3f, 0.85f, 0.05f),
(RandomStatGenerator)new AmmoStatGenerator(-6f, 15f),
(RandomStatGenerator)new RegenStatGenerator(0f, 60f, 1f),
(RandomStatGenerator)new JumpStatGenerator(0f, 3f),
(RandomStatGenerator)new AdditionalBlocksStatGenerator(0f, RandomStatsUtils.ScaleStatByIntensity(0.2f, 2f)),
(RandomStatGenerator)new ExtraLiveStatGenerator(0f, RandomStatsUtils.ScaleStatByIntensity(0.5f, 2f)),
(RandomStatGenerator)(object)new CorruptedCardSpawnChanceStatGenerator(-0.5f, 0.5f)
}, 1, 6);
LoggerUtils.LogInfo("Created all corrupted card generators!");
}
private static void CreateRandomCardsGenerator(CorruptedCardRarity rarity, List<RandomStatGenerator> statGenerators, int min, int max)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: 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_003a: Expected O, but got Unknown
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: Expected O, but got Unknown
cardGenerators[rarity] = new RandomCardsGenerator($"CorruptedCardsGenerator_{rarity}", CreateCardOption(RarityUtils.GetRarity(rarity.ToString()), min, max), statGenerators);
RandomCardsGenerator obj = cardGenerators[rarity];
obj.OnCardGenerated = (Action<GeneratedCardInfo>)Delegate.Combine(obj.OnCardGenerated, (Action<GeneratedCardInfo>)delegate(GeneratedCardInfo generatedCardInfo)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
((Component)generatedCardInfo.CardInfo).gameObject.AddComponent<FancyIcon>().fancyIcon = Main.corruptedCardFancyIconPrefab;
((Component)generatedCardInfo.CardInfo).gameObject.AddComponent<GlitchingCardEffect>();
});
DrawableRandomCard val = new DrawableRandomCard(cardGenerators[rarity]);
DrawableCorruptedCards[val.CardInfo] = val;
LoggerUtils.LogInfo($"Created {rarity} corrupted card generator!");
}
private static RandomCardOption CreateCardOption(Rarity rarity, int min, int max)
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
return new RandomCardOption("Corrupted Card", "CCM", "A corrupted card", "CO", min, max, rarity, (CardThemeColorType)4);
}
}
public class CorruptedStatModifers : MonoBehaviour
{
public float CorruptedCardSpawnChance;
public float CorruptedCardSpawnChancePerPick;
public float CorruptedCardSpawnChancePerFight;
public void Apply(Player player)
{
CorruptedCharacterData additionalData = player.data.GetAdditionalData();
additionalData.CorruptedCardSpawnChance = Mathf.Max(additionalData.CorruptedCardSpawnChance + CorruptedCardSpawnChance, 0f);
additionalData.CorruptedCardSpawnChancePerPick += CorruptedCardSpawnChancePerPick;
additionalData.CorruptedCardSpawnChancePerFight += CorruptedCardSpawnChancePerFight;
}
}
public class TabinfoInterface
{
public static void Setup()
{
StatCategory obj = TabInfoManager.RegisterCategory("CCM Stats", 3);
TabInfoManager.RegisterStat(obj, "Corrupted Cards Spawn Chance", (Func<Player, bool>)((Player p) => p.data.GetAdditionalData().CorruptedCardSpawnChance != 0f), (Func<Player, string>)((Player p) => $"{p.data.GetAdditionalData().CorruptedCardSpawnChance * 100f:0}%"));
TabInfoManager.RegisterStat(obj, "Corrupted Cards Spawn Chance Per Pick", (Func<Player, bool>)((Player p) => p.data.GetAdditionalData().CorruptedCardSpawnChancePerPick != 0f), (Func<Player, string>)((Player p) => $"{p.data.GetAdditionalData().CorruptedCardSpawnChancePerPick * 100f:0}%"));
TabInfoManager.RegisterStat(obj, "Corrupted Cards Spawn Chance Per Fight", (Func<Player, bool>)((Player p) => p.data.GetAdditionalData().CorruptedCardSpawnChancePerFight != 0f), (Func<Player, string>)((Player p) => $"{p.data.GetAdditionalData().CorruptedCardSpawnChancePerFight * 100f:0}%"));
}
}
}
namespace CorruptedCardsManager.Utils
{
internal static class LoggerUtils
{
private const bool logging = false;
public static void LogInfo(string message)
{
}
public static void LogWarn(string message)
{
Main.ModLogger.LogWarning((object)message);
}
public static void LogError(string message)
{
Main.ModLogger.LogError((object)message);
}
}
}
namespace CorruptedCardsManager.Patches
{
[HarmonyPatch(typeof(ApplyCardStats), "ApplyStats")]
public class ApplyCardStatsPatch
{
public static void Postfix(ApplyCardStats __instance, Player ___playerToUpgrade)
{
CorruptedStatModifers component = ((Component)__instance).GetComponent<CorruptedStatModifers>();
if ((Object)(object)component != (Object)null)
{
component.Apply(___playerToUpgrade);
}
}
}
[HarmonyPatch(typeof(CardChoice), "StartPick")]
public class CardChoicePatch
{
private static void Prefix(int pickerIDToSet)
{
Player val = PlayerManager.instance.players[pickerIDToSet];
val.data.GetAdditionalData().CorruptedCardSpawnChance += val.data.GetAdditionalData().CorruptedCardSpawnChancePerPick;
}
}
[HarmonyPatch(typeof(CardChoicePatchGetRanomCard), "EfficientGetRanomCard", new Type[]
{
typeof(Player),
typeof(CardInfo[])
})]
public class CardChoicePatchGetRanomCardPatch
{
private static void Prefix(Player player, ref CardInfo[] cards)
{
if (!((Object)(object)player == (Object)null) && cards != null && cards.Length != 0 && Random.Range(0f, 1f) < player.data.GetAdditionalData().CorruptedCardSpawnChance)
{
cards = CorruptedCardsManager.DrawableCorruptedCards.Keys.ToArray();
}
}
}
[HarmonyPatch(typeof(CharacterStatModifiers), "ResetStats")]
public class CharacterStatModifiersPatch
{
public static void Prefix(CharacterStatModifiers __instance)
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Expected O, but got Unknown
CorruptedCharacterDataExtensions.GetAdditionalData((CharacterData)Traverse.Create((object)__instance).Field("data").GetValue()).Reset();
}
}
[HarmonyPatch(typeof(CardChoice), "SpawnUniqueCard")]
[HarmonyAfter(new string[] { "com.Root.Null" })]
internal class SpawnUniqueCardPatch
{
[HarmonyPriority(0)]
private static void Postfix(int ___pickrID, ref GameObject __result)
{
Player val = PlayerManager.instance.players.Find((Player p) => p.playerID == ___pickrID);
CardInfo component = __result.GetComponent<CardInfo>();
if (!((Object)(object)val == (Object)null) && !((Component)component).GetComponents<MonoBehaviour>().Any((MonoBehaviour x) => ((object)x).GetType().Name == "NullCard") && Random.Range(0f, 1f) < val.data.GetAdditionalData().CorruptedCardSpawnChance && !component.categories.Contains(CorruptedCardsManager.CantCorruptedCardCategory))
{
GameObject val2 = CardChoicePatchGetRanomCard.OrignialGetRanomCard(CorruptedCardsManager.DrawableCorruptedCards.Keys.ToArray());
__result = CorruptedCardsManager.DrawableCorruptedCards[val2.GetComponent<CardInfo>()].ReplaceCard(component);
}
}
}
}
namespace CorruptedCardsManager.MonoBehaviours
{
public class GlitchingCardEffect : MonoBehaviour
{
private void Start()
{
if (((Component)this).gameObject.transform.childCount == 0)
{
return;
}
ExtensionMethods.ExecuteAfterFrames((MonoBehaviour)(object)this, 1, (Action)delegate
{
GlitchingTextMono orAddComponent = ExtensionMethods.GetOrAddComponent<GlitchingTextMono>(((Component)this).gameObject, false);
orAddComponent.EffectAllText = false;
TextMeshProUGUI[] componentsInChildren = ((Component)((Component)this).gameObject.transform.GetChild(0).Find("Canvas/Front/Grid")).GetComponentsInChildren<TextMeshProUGUI>();
foreach (TextMeshProUGUI textMesh in componentsInChildren)
{
orAddComponent.AddTextMesh(textMesh);
}
TextMeshProUGUI component = ((Component)((Component)this).gameObject.transform.GetChild(0).Find("Canvas/Front/Text_Name")).GetComponent<TextMeshProUGUI>();
orAddComponent.AddTextMesh(component);
});
}
}
public class GlitchingTextMono : MonoBehaviour
{
private const string CHARACTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz!@#$%^&*()_+-=<>?:\"{}|,./;'[]\\'~";
private const string GLITCH_TAG_REGEX = "<glitch>(.*?)(<\\/glitch>|$)";
public static Regex regex = new Regex("<glitch>(.*?)(<\\/glitch>|$)", RegexOptions.Compiled);
public bool UseGlitchTag;
public bool EffectAllText = true;
private List<(TextMeshProUGUI, string)> textMeshes = new List<(TextMeshProUGUI, string)>();
private List<char> characters = new List<char>();
private void Start()
{
characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz!@#$%^&*()_+-=<>?:\"{}|,./;'[]\\'~".ToList();
if (EffectAllText)
{
TextMeshProUGUI[] componentsInChildren = ((Component)this).gameObject.GetComponentsInChildren<TextMeshProUGUI>();
textMeshes.AddRange(componentsInChildren.Select((TextMeshProUGUI obj) => (obj, ((TMP_Text)obj).text)));
}
}
public void AddTextMesh(TextMeshProUGUI textMesh)
{
textMeshes.Add((textMesh, ((TMP_Text)textMesh).text));
}
private void Update()
{
if (textMeshes.Count == 0)
{
return;
}
foreach (var (val, originalText) in textMeshes)
{
if (UseGlitchTag)
{
string text = ProcessTextWithGlitchTag(originalText);
((TMP_Text)val).text = text;
}
else
{
GlitchCharacters(val, originalText);
}
}
}
private void GlitchCharacters(TextMeshProUGUI textMesh, string originalText)
{
((TMP_Text)textMesh).text = "<mspace=0.5em>";
for (int i = 0; i < originalText.Length; i++)
{
((TMP_Text)textMesh).text = ((TMP_Text)textMesh).text + characters[Random.Range(0, characters.Count)];
}
}
private string ProcessTextWithGlitchTag(string originalText)
{
return regex.Replace(originalText, delegate(Match match)
{
string value = match.Groups[1].Value;
string text = GenerateGlitchedText(value.Length);
return "<mspace=0.5em>" + text + "</mspace>";
});
}
private string GenerateGlitchedText(int length)
{
char[] array = new char[length];
for (int i = 0; i < length; i++)
{
array[i] = characters[Random.Range(0, characters.Count)];
}
return new string(array);
}
}
}
namespace CorruptedCardsManager.MonoBehaviours.CardbarsScripts
{
public class EnableTextFromCardbar : MonoBehaviour
{
[HideInInspector]
public TextMeshProUGUI text;
private void OnEnable()
{
text = ((Component)((Component)this).transform.parent).GetComponentInChildren<TextMeshProUGUI>();
ExtensionMethods.ExecuteAfterFrames((MonoBehaviour)(object)this, 1, (Action)delegate
{
((Behaviour)text).enabled = true;
});
}
}
[RequireComponent(typeof(EnableTextFromCardbar))]
public class GlitchedTextCardbar : MonoBehaviour
{
public void Start()
{
ExtensionMethods.ExecuteAfterFrames((MonoBehaviour)(object)this, 1, (Action)delegate
{
((Component)((Component)this).GetComponent<EnableTextFromCardbar>().text).gameObject.AddComponent<GlitchingTextMono>();
});
}
}
}
namespace CorruptedCardsManager.Extensions
{
public class CorruptedCharacterData
{
public float CorruptedCardSpawnChance;
public float CorruptedCardSpawnChancePerPick;
public float CorruptedCardSpawnChancePerFight;
public void Reset()
{
CorruptedCardSpawnChancePerPick = 0f;
CorruptedCardSpawnChancePerFight = 0f;
}
}
public static class CorruptedCharacterDataExtensions
{
public static readonly ConditionalWeakTable<CharacterData, CorruptedCharacterData> data = new ConditionalWeakTable<CharacterData, CorruptedCharacterData>();
public static CorruptedCharacterData GetAdditionalData(this CharacterData block)
{
return data.GetOrCreateValue(block);
}
public static void AddData(this CharacterData block, CorruptedCharacterData value)
{
try
{
data.Add(block, value);
}
catch (Exception)
{
}
}
}
}
namespace CorruptedCardsManager.StatsGroup
{
public class CorruptedCardSpawnChanceStatGenerator : RandomStatGenerator
{
public float ThresholdToZero;
public override string StatName => "Corrupted Cards Spawn Chance";
public CorruptedCardSpawnChanceStatGenerator(float minValue, float maxValue, float thresholdToZero = 0.05f)
: base(minValue, maxValue)
{
ThresholdToZero = thresholdToZero;
}
public override bool ShouldApply(float value)
{
return Mathf.Abs(value) >= ThresholdToZero;
}
public override void Apply(float value, CardInfo cardInfo, Gun gun, ApplyCardStats cardStats, CharacterStatModifiers statModifiers, Block block)
{
ExtensionMethods.GetOrAddComponent<CorruptedStatModifers>(((Component)cardInfo).gameObject, false).CorruptedCardSpawnChance += value;
}
public override bool IsPositive(float value)
{
return value < 0f;
}
}
}