using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("HideTips")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("DSP MOD - HideTips")]
[assembly: AssemblyFileVersion("1.0.4.0")]
[assembly: AssemblyInformationalVersion("1.0.4+efa3198d812ec705e12adb55d8891e5fe413fbc9")]
[assembly: AssemblyProduct("HideTips")]
[assembly: AssemblyTitle("HideTips")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.4.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 HideTips
{
[BepInPlugin("org.soardev.hidetips", "HideTips", "1.0.4")]
public class HideTips : BaseUnityPlugin
{
private static readonly ManualLogSource Logger = Logger.CreateLogSource("HideTips");
private bool _cfgEnabled = true;
private static bool _noRandomReminderTips = true;
private static bool _noTutorialTips = true;
private static bool _noAchievementCardPopups;
private static bool _noMilestoneCardPopups = true;
private static bool _noResearchCompletionPopups = true;
private static bool _noResearchCompletionTips;
private static bool _skipPrologue = true;
private static Harmony _patch;
private void Awake()
{
_cfgEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enabled", _cfgEnabled, "enable/disable this plugin").Value;
_noRandomReminderTips = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "NoRandomReminderTips", _noRandomReminderTips, "Disable Random Reminder Tips").Value;
_noTutorialTips = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "NoTutorialTips", _noTutorialTips, "Disable Tutorial Tips").Value;
_noAchievementCardPopups = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "NoAchievementCardPopups", _noAchievementCardPopups, "Disable Achievement Card Popups").Value;
_noMilestoneCardPopups = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "NoMilestoneCardPopups", _noMilestoneCardPopups, "Disable Milestone Card Popups").Value;
_noResearchCompletionPopups = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "NoResearchCompletionPopups", _noResearchCompletionPopups, "Disable Research Completion Popup Windows").Value;
_noResearchCompletionTips = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "NoResearchCompletionTips", _noResearchCompletionTips, "Disable Research Completion Tips").Value;
_skipPrologue = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "SkipPrologue", _skipPrologue, "Skip prologue for new game").Value;
if (_cfgEnabled)
{
Harmony.CreateAndPatchAll(typeof(HideTips), (string)null);
}
}
private void OnDestroy()
{
Harmony patch = _patch;
if (patch != null)
{
patch.UnpatchSelf();
}
_patch = null;
}
[HarmonyPrefix]
[HarmonyPatch(typeof(VFPreload), "Start")]
private static void VFPreload_Start_Prefix(VFPreload __instance)
{
__instance.splashTime = -0.3f;
}
[HarmonyPostfix]
[HarmonyPatch(typeof(UIBuildMenu), "_OnCreate")]
private static void ClearRandReminderTips(UIBuildMenu __instance)
{
if (!_noRandomReminderTips)
{
return;
}
UIRandomTip[] randRemindTips = __instance.randRemindTips;
foreach (UIRandomTip val in randRemindTips)
{
if ((Object)(object)val != (Object)null)
{
((ManualBehaviour)val)._Free();
}
}
__instance.randRemindTips = Array.Empty<UIRandomTip>();
}
[HarmonyPostfix]
[HarmonyPatch(typeof(UIGameMenu), "_OnCreate")]
private static void UIGameMenu__OnCreate_Postfix(UIGameMenu __instance)
{
if (_noRandomReminderTips)
{
__instance.randTipButton0.pop = __instance.randTipButton0.popCount;
__instance.randTipButton1.pop = __instance.randTipButton1.popCount;
__instance.randTipButton2.pop = __instance.randTipButton2.popCount;
}
}
[HarmonyPrefix]
[HarmonyPatch(typeof(UITutorialTip), "PopupTutorialTip")]
private static bool UITutorialTip_PopupTutorialTip_Prefix(int tutorialId)
{
if (!_noTutorialTips)
{
return true;
}
GameMain.history.UnlockTutorial(tutorialId);
return false;
}
[HarmonyPrefix]
[HarmonyPatch(typeof(UIVariousPopupGroup), "CreateAchievementPopupCard")]
private static bool UIVariousPopupGroup_CreateAchievementPopupCard_Prefix()
{
return !_noAchievementCardPopups;
}
[HarmonyPrefix]
[HarmonyPatch(typeof(UIVariousPopupGroup), "CreateMilestonePopupCard")]
private static bool UIVariousPopupGroup_CreateMilestonePopupCard_Prefix()
{
return !_noMilestoneCardPopups;
}
[HarmonyPrefix]
[HarmonyPatch(typeof(UIResearchResultWindow), "SetTechId")]
private static bool UIResearchResultWindow_SetTechId_Prefix()
{
return !_noResearchCompletionPopups;
}
[HarmonyTranspiler]
[HarmonyPatch(typeof(UIGeneralTips), "OnTechUnlocked")]
private static IEnumerable<CodeInstruction> UIGeneralTips_OnTechUnlocked_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Expected O, but got Unknown
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Expected O, but got Unknown
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Expected O, but got Unknown
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Expected O, but got Unknown
//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
//IL_00ad: Expected O, but got Unknown
//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Expected O, but got Unknown
//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
//IL_00f6: Expected O, but got Unknown
//IL_0104: Unknown result type (might be due to invalid IL or missing references)
//IL_010a: Expected O, but got Unknown
CodeMatcher val = new CodeMatcher(instructions, generator);
val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[3]
{
new CodeMatch((OpCode?)OpCodes.Ldarg_0, (object)null, (string)null),
new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(UIGeneralTips), "researchCompleteTip"), (string)null),
new CodeMatch((OpCode?)OpCodes.Callvirt, (object)null, (string)null)
});
List<Label> labels = val.Labels;
Label label = generator.DefineLabel();
val.Labels = new List<Label>();
val.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[2]
{
CodeInstructionExtensions.WithLabels(new CodeInstruction(OpCodes.Ldsfld, (object)AccessTools.Field(typeof(HideTips), "_noResearchCompletionTips")), (IEnumerable<Label>)labels),
new CodeInstruction(OpCodes.Brtrue, (object)label)
}).MatchForward(false, (CodeMatch[])(object)new CodeMatch[2]
{
new CodeMatch((OpCode?)OpCodes.Callvirt, (object)AccessTools.Method(typeof(Animation), "Play", (Type[])null, (Type[])null), (string)null),
new CodeMatch((OpCode?)OpCodes.Pop, (object)null, (string)null)
}).Advance(2)
.Labels.Add(label);
return val.InstructionEnumeration();
}
[HarmonyPrefix]
[HarmonyPatch(typeof(DSPGame), "StartGame", new Type[] { typeof(GameDesc) })]
private static bool DSPGame_StartGame_Prefix(GameDesc _gameDesc)
{
if (!_skipPrologue)
{
return true;
}
DSPGame.StartGameSkipPrologue(_gameDesc);
return false;
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "org.soardev.hidetips";
public const string PLUGIN_NAME = "HideTips";
public const string PLUGIN_VERSION = "1.0.4";
}
}