using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using Cards;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using MultitudinousMythics;
using Obeliskial_Essentials;
using UnityEngine;
[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("com.binbin.MultitudinousMythics")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.1.0.0")]
[assembly: AssemblyInformationalVersion("1.1.0+d7666e4f1d869697bf5dbd5b78d5ac0fb0b4e9dc")]
[assembly: AssemblyProduct("MultitudinousMythics")]
[assembly: AssemblyTitle("com.binbin.MultitudinousMythics")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.0.0")]
[module: UnverifiableCode]
[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;
}
}
}
public static class EssentialsCompatibility
{
private static bool? _enabled;
public static bool Enabled
{
get
{
bool valueOrDefault = _enabled == true;
if (!_enabled.HasValue)
{
valueOrDefault = Chainloader.PluginInfos.ContainsKey("com.stiffmeds.obeliskialessentials");
_enabled = valueOrDefault;
}
return _enabled.Value;
}
}
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
public static void EssentialsRegister()
{
Essentials.RegisterMod(Plugin.PluginName, "binbin", "Multitudinous Mythics", Plugin.PluginVersion, Plugin.ModDate, "https://github.com/binbinmods/MultitudinousMythics", (string[])null, "", 100, (string[])null, "", true);
Plugin.LogInfo(Plugin.PluginVersion + " has loaded with Essentials!");
}
}
namespace MultitudinousMythics
{
[HarmonyPatch]
public class AntiCheat
{
[HarmonyPrefix]
[HarmonyPatch(typeof(SteamManager), "SetObeliskScore")]
public static bool SetObeliskScorePrefix(ref SteamManager __instance, int score, bool singleplayer = true)
{
return false;
}
[HarmonyPrefix]
[HarmonyPatch(typeof(SteamManager), "SetScore")]
public static bool SetScorePrefix(ref SteamManager __instance, int score, bool singleplayer = true)
{
return false;
}
[HarmonyPrefix]
[HarmonyPatch(typeof(SteamManager), "SetSingularityScore")]
public static bool SetSingularityScorePrefix(ref SteamManager __instance, int score, bool singleplayer = true)
{
return false;
}
[HarmonyPrefix]
[HarmonyPatch(typeof(SteamManager), "SetObeliskScoreLeaderboard")]
public static bool SetObeliskScoreLeaderboardPrefix(ref SteamManager __instance, int score, bool singleplayer = true)
{
return false;
}
[HarmonyPrefix]
[HarmonyPatch(typeof(SteamManager), "SetScoreLeaderboard")]
public static bool SetScoreLeaderboardPrefix(ref SteamManager __instance, int score, bool singleplayer = true)
{
return false;
}
[HarmonyPrefix]
[HarmonyPatch(typeof(SteamManager), "SetSingularityScoreLeaderboard")]
public static bool SetSingularityScoreLeaderboardPrefix(ref SteamManager __instance, int score, bool singleplayer = true)
{
return false;
}
[HarmonyPrefix]
[HarmonyPatch(typeof(SteamManager), "SetWeeklyScore")]
public static bool SetWeeklyScorePrefix(ref SteamManager __instance, int score, int week, string nick, string nickgroup, bool singleplayer = true)
{
return false;
}
[HarmonyPrefix]
[HarmonyPatch(typeof(SteamManager), "SetWeeklyScoreLeaderboard")]
public static bool SetWeeklyScoreLeaderboardPrefix(ref SteamManager __instance, int score, int week, string nick, string nickgroup, bool singleplayer = true)
{
return false;
}
}
[HarmonyPatch]
public class MultitudinousMythicsPatches
{
private static readonly List<string> BossCombatNodes = new List<string>(8) { "sen_33", "aqua_35", "velka_32", "faen_38", "ulmin_56", "sahti_62", "voidlow_25", "voidhigh_13" };
public static bool IsBossCombat = false;
public static bool IsEndOfActBossCombatReward()
{
Plugin.LogDebug("IsEndOfActBossCombatReward: Current Map Node: " + AtOManager.Instance.currentMapNode, "IsEndOfActBossCombatReward");
return (Object)(object)RewardsManager.Instance != (Object)null && BossCombatNodes.Contains(AtOManager.Instance.currentMapNode);
}
public static bool IsBossCombatReward()
{
CombatData value = Traverse.Create((object)AtOManager.Instance).Field("currentCombatData").GetValue<CombatData>();
if ((Object)(object)value == (Object)null)
{
Plugin.LogError("IsBossCombatReward: currentCombatData is null, cannot determine if it is a boss combat.", "IsBossCombatReward");
return false;
}
NPCData[] nPCList = value.NPCList;
foreach (NPCData val in nPCList)
{
if (val.IsBoss)
{
IsBossCombat = true;
}
}
return (Object)(object)RewardsManager.Instance != (Object)null && IsBossCombat;
}
[HarmonyPrefix]
[HarmonyPatch(typeof(RewardsManager), "SetRewards")]
public static void SetRewardsPrefix(ref int ___numCardsReward)
{
try
{
if (IsEndOfActBossCombatReward() && Plugin.EnableIncreasedRewards.Value)
{
___numCardsReward = 4;
}
if (IsBossCombatReward() && Plugin.EnableIncreasedRewardsForAllBosses.Value)
{
___numCardsReward = 4;
}
}
catch (Exception arg)
{
Plugin.LogError($"SetRewardsPrefix: Error {arg}", "SetRewardsPrefix");
}
}
[HarmonyPrefix]
[HarmonyPatch(typeof(RewardsManager), "ShowRewards")]
public static void ShowRewardsPrefix(ref Dictionary<int, string[]> ___cardsByOrder)
{
if (!IsEndOfActBossCombatReward())
{
Plugin.LogDebug("Not End of Act Boss Combat Reward", "ShowRewardsPrefix");
return;
}
foreach (int key in ___cardsByOrder.Keys)
{
if (___cardsByOrder[key] != null && ___cardsByOrder[key].Length != 0)
{
Random.InitState(Functions.GetDeterministicHashCode(AtOManager.Instance.currentMapNode + key + AtOManager.Instance.GetGameId()));
int num = Random.Range(0, 100);
if (num < Plugin.ChanceAtMythic.Value)
{
Hero hero = AtOManager.Instance.team.GetHero(key);
string randomCardByCardRarity = GetRandomCardByCardRarity((CardRarity)4, hero);
___cardsByOrder[key][0] = randomCardByCardRarity;
}
}
}
}
public static string GetRandomCardByCardRarity(CardRarity cardRarity, Hero hero = null)
{
//IL_0042: 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_006c: 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_00a3: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_00ad: Invalid comparison between Unknown and I4
//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
//IL_00dc: Invalid comparison between Unknown and I4
//IL_011c: Unknown result type (might be due to invalid IL or missing references)
//IL_0121: Unknown result type (might be due to invalid IL or missing references)
try
{
object obj = hero;
if (obj == null)
{
MatchManager instance = MatchManager.Instance;
obj = ((instance != null) ? instance.GetHeroHeroActive() : null);
}
Hero val = (Hero)obj;
if (val == null)
{
Plugin.LogError("GetRandomCardByCardRarity: Hero is null, cannot determine card class.", "GetRandomCardByCardRarity");
return "";
}
CardClass result = (CardClass)11;
Enum.TryParse<CardClass>(Enum.GetName(typeof(HeroClass), ((Character)val).HeroData.HeroClass), out result);
CardClass result2 = (CardClass)11;
Enum.TryParse<CardClass>(Enum.GetName(typeof(HeroClass), ((Character)val).HeroData.HeroSubClass.HeroClassSecondary), out result2);
List<string> list = Globals.Instance.CardListNotUpgradedByClass[result];
List<string> list2 = (((int)result2 == 11) ? new List<string>() : Globals.Instance.CardListNotUpgradedByClass[result2]);
bool flag = false;
CardRealtimeData val2 = null;
while (!flag)
{
bool flag2 = false;
val2 = Globals.Instance.GetCardData(((int)result2 == 11) ? list[Random.Range(0, list.Count)] : list2[Random.Range(0, list2.Count)], false);
if (!flag2 && val2.CardRarity == cardRarity)
{
flag = true;
}
}
return ((val2 != null) ? val2.Id.ToLower() : null) ?? "";
}
catch (Exception arg)
{
Plugin.LogError($"GetRandomCardByCardRarity: Error {arg}", "GetRandomCardByCardRarity");
return "";
}
}
}
[BepInPlugin("com.binbin.MultitudinousMythics", "MultitudinousMythics", "1.1.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInProcess("AcrossTheObelisk.exe")]
public class Plugin : BaseUnityPlugin
{
public static string PluginName;
public static string PluginVersion;
public static string PluginGUID;
internal static int ModDate = int.Parse(DateTime.Today.ToString("yyyyMMdd"));
private readonly Harmony harmony = new Harmony("com.binbin.MultitudinousMythics");
internal static ManualLogSource Log;
public static string debugBase = "com.binbin.MultitudinousMythics ";
public static ConfigEntry<bool> EnableMod { get; set; }
public static ConfigEntry<bool> EnableDebugging { get; set; }
public static ConfigEntry<int> ChanceAtMythic { get; set; }
public static ConfigEntry<bool> EnableIncreasedRewards { get; set; }
public static ConfigEntry<bool> EnableIncreasedRewardsForAllBosses { get; set; }
private void Awake()
{
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Expected O, but got Unknown
//IL_0039: Expected O, but got Unknown
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Expected O, but got Unknown
//IL_0066: Expected O, but got Unknown
//IL_0078: 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_0094: Expected O, but got Unknown
//IL_0094: Expected O, but got Unknown
//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Expected O, but got Unknown
//IL_00c1: Expected O, but got Unknown
//IL_00d3: 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_00ee: Expected O, but got Unknown
//IL_00ee: Expected O, but got Unknown
Log = ((BaseUnityPlugin)this).Logger;
string text = "MultitudinousMythics";
EnableMod = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition(text, "EnableMod"), true, new ConfigDescription("Enables the mod. If false, the mod will not work then next time you load the game.", (AcceptableValueBase)null, Array.Empty<object>()));
EnableDebugging = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition(text, "EnableDebugging"), false, new ConfigDescription("Enables the debugging", (AcceptableValueBase)null, Array.Empty<object>()));
ChanceAtMythic = ((BaseUnityPlugin)this).Config.Bind<int>(new ConfigDefinition(text, "ChanceAtMythic"), 50, new ConfigDescription("The percent chance that the end of act boss will drop a mythic card. 0-100.", (AcceptableValueBase)null, Array.Empty<object>()));
EnableIncreasedRewards = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition(text, "EnableIncreasedRewards"), true, new ConfigDescription("End of Act Bosses drop 4 cards rather than 3", (AcceptableValueBase)null, Array.Empty<object>()));
EnableIncreasedRewardsForAllBosses = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition(text, "IncreasedRewardsForAllBosses"), true, new ConfigDescription("All Bosses drop 4 cards rather than 3", (AcceptableValueBase)null, Array.Empty<object>()));
ChanceAtMythic.Value = Math.Clamp(ChanceAtMythic.Value, 0, 100);
EnableMod.SettingChanged += delegate
{
LogDebug($"EnableMod setting changed to {EnableMod.Value}", "Awake");
};
EnableDebugging.SettingChanged += delegate
{
LogDebug($"EnableDebugging setting changed to {EnableDebugging.Value}", "Awake");
};
PluginName = "MultitudinousMythics";
PluginVersion = "1.1.0";
PluginGUID = "com.binbin.MultitudinousMythics";
if (EnableMod.Value)
{
if (EssentialsCompatibility.Enabled)
{
EssentialsCompatibility.EssentialsRegister();
}
else
{
LogInfo(PluginGUID + " " + PluginVersion + " has loaded!");
}
harmony.PatchAll();
}
}
internal static void LogDebug(string msg, [CallerMemberName] string caller = "")
{
if (EnableDebugging.Value)
{
Log.LogDebug((object)(debugBase + "- " + caller + " - " + msg));
}
}
internal static void LogInfo(string msg)
{
Log.LogInfo((object)(debugBase + msg));
}
internal static void LogError(string msg, [CallerMemberName] string caller = "")
{
Log.LogError((object)(debugBase + "- " + caller + " - " + msg));
}
public static IEnumerator RunAfter(IEnumerator original, Action action)
{
while (original.MoveNext())
{
yield return original.Current;
}
action();
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "com.binbin.MultitudinousMythics";
public const string PLUGIN_NAME = "MultitudinousMythics";
public const string PLUGIN_VERSION = "1.1.0";
}
}