using System; using System.Collections; 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 HarmonyLib; using Microsoft.CodeAnalysis; using Obeliskial_Essentials; using SkilledNPCs; [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.SkilledNPCs")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.1.0.0")] [assembly: AssemblyInformationalVersion("1.1.0+fe627b5a0f9902e88de9d0bd6e9fb7cdd9f35ece")] [assembly: AssemblyProduct("SkilledNPCs")] [assembly: AssemblyTitle("com.binbin.SkilledNPCs")] [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", "Skilled NPCs", Plugin.PluginVersion, Plugin.ModDate, "https://github.com/binbinmods/SkilledNPCs", (string[])null, "", 100, (string[])null, "", true); Plugin.LogInfo(Plugin.PluginGUID + " " + Plugin.PluginVersion + " has loaded with Essentials!"); } } namespace SkilledNPCs { [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; } } [BepInPlugin("com.binbin.SkilledNPCs", "SkilledNPCs", "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.SkilledNPCs"); internal static ManualLogSource Log; public static string debugBase = "com.binbin.SkilledNPCs "; public static ConfigEntry EnableMod { get; set; } public static ConfigEntry EnableDebugging { get; set; } public static ConfigEntry NumberOfExtraCards { get; set; } public static ConfigEntry PlayMaxCards { 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_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Expected O, but got Unknown //IL_0093: Expected O, but got Unknown //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Expected O, but got Unknown //IL_00c0: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; string text = "SkilledNPCs"; EnableMod = ((BaseUnityPlugin)this).Config.Bind(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())); EnableDebugging = ((BaseUnityPlugin)this).Config.Bind(new ConfigDefinition(text, "EnableDebugging"), false, new ConfigDescription("Enables the debugging", (AcceptableValueBase)null, Array.Empty())); NumberOfExtraCards = ((BaseUnityPlugin)this).Config.Bind(new ConfigDefinition(text, "NumberOfExtraCards"), 1, new ConfigDescription("How many extra cards each NPC will play. Default is 1. Can be used to decrease enemy cards as well.", (AcceptableValueBase)null, Array.Empty())); PlayMaxCards = ((BaseUnityPlugin)this).Config.Bind(new ConfigDefinition(text, "PlayMaxCards"), false, new ConfigDescription("If True, overrides NumberOfExtraCards to make NPCs play all possible cards. ", (AcceptableValueBase)null, Array.Empty())); PluginName = "SkilledNPCs"; PluginVersion = "1.1.0"; PluginGUID = "com.binbin.SkilledNPCs"; 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(); } } [HarmonyPatch] public class SkilledNPCsPatches { [HarmonyPrefix] [HarmonyPatch(typeof(NPC), "BeginRound")] public static void BeginRound(ref NPC __instance, ref int __state) { if (__instance == null) { Plugin.LogError("BeginRound - __instance is null", "BeginRound"); return; } NPC obj = __instance; object arg; if (obj == null) { arg = null; } else { NPCData npcData = ((Character)obj).NpcData; arg = ((npcData != null) ? npcData.Id : null); } NPC obj2 = __instance; int? obj3; if (obj2 == null) { obj3 = null; } else { NPCData npcData2 = ((Character)obj2).NpcData; obj3 = ((npcData2 != null) ? new int?(npcData2.CardsInHand) : ((int?)null)); } Plugin.LogDebug($"{arg} - Cards in hand: {obj3}", "BeginRound"); __state = ((Character)__instance).NpcData.CardsInHand; if (Plugin.PlayMaxCards.Value) { NPCData npcData3 = ((Character)__instance).NpcData; npcData3.CardsInHand += 1000; return; } NPCData npcData4 = ((Character)__instance).NpcData; npcData4.CardsInHand += Plugin.NumberOfExtraCards.Value; NPC obj4 = __instance; object arg2; if (obj4 == null) { arg2 = null; } else { NPCData npcData5 = ((Character)obj4).NpcData; arg2 = ((npcData5 != null) ? npcData5.Id : null); } NPC obj5 = __instance; int? obj6; if (obj5 == null) { obj6 = null; } else { NPCData npcData6 = ((Character)obj5).NpcData; obj6 = ((npcData6 != null) ? new int?(npcData6.CardsInHand) : ((int?)null)); } Plugin.LogDebug($"{arg2} - Cards Set to: {obj6}", "BeginRound"); } [HarmonyPostfix] [HarmonyPatch(typeof(NPC), "BeginRound")] public static void BeginRoundPostfix(ref NPC __instance, int __state) { if (__instance == null) { Plugin.LogError("BeginRoundPostfix - __instance is null", "BeginRoundPostfix"); } else { ((Character)__instance).NpcData.CardsInHand = __state; } } } public static class PluginInfo { public const string PLUGIN_GUID = "com.binbin.SkilledNPCs"; public const string PLUGIN_NAME = "SkilledNPCs"; public const string PLUGIN_VERSION = "1.1.0"; } }