using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyCompany("DontSpoilMurderType")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.1.0.0")]
[assembly: AssemblyInformationalVersion("0.1.0+c2699ac0f0acd2ac053886d298e5bbd039ebe655")]
[assembly: AssemblyProduct("Don't Spoil Murder Type")]
[assembly: AssemblyTitle("DontSpoilMurderType")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.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 DontSpoilMurderType
{
[BepInPlugin("dema77sr.SOD.DontSpoilMurderType", "DontSpoilMurderType", "0.1.0")]
public class Plugin : BasePlugin
{
public const string PLUGIN_GUID = "dema77sr.SOD.DontSpoilMurderType";
public const string PLUGIN_NAME = "DontSpoilMurderType";
public const string PLUGIN_VERSION = "0.1.0";
public override void Load()
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
ManualLogSource log = ((BasePlugin)this).Log;
bool flag = default(bool);
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(18, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Plugin ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("dema77sr.SOD.DontSpoilMurderType");
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is loaded.");
}
log.LogInfo(val);
new Harmony("dema77sr.SOD.DontSpoilMurderType").PatchAll();
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "DontSpoilMurderType";
public const string PLUGIN_NAME = "Don't Spoil Murder Type";
public const string PLUGIN_VERSION = "0.1.0";
}
}
namespace DontSpoilMurderType.Features.MurderCaseName
{
internal static class CaseNameLocalization
{
private const string UiInterfaceScope = "ui.interface";
private const string NewMurderCaseKey = "New Murder Case";
private const string NeutralCaseKey = "Murder Case";
internal static string GetNeutralCaseName()
{
return GetLocalizedString("Murder Case", "Murder Case");
}
internal static string GetNewMurderCaseName()
{
return GetLocalizedString("New Murder Case", "New Murder Case");
}
private static string GetLocalizedString(string key, string fallback)
{
try
{
string text = Strings.Get("ui.interface", key, (Casing)0, false, false, false, (Human)null);
if (!string.IsNullOrWhiteSpace(text))
{
return text;
}
}
catch
{
}
return fallback;
}
}
[HarmonyPatch(typeof(Murder), "GetMonkier")]
internal static class MurderMonikerPatch
{
private static bool Prefix(Murder __instance, ref string __result)
{
__result = CaseNameLocalization.GetNeutralCaseName();
return false;
}
}
[HarmonyPatch(typeof(Case), "ApplyMonikerToCaseCheck")]
internal static class CaseMonikerPatch
{
private static bool Prefix(Case __instance)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Invalid comparison between Unknown and I4
if (__instance == null)
{
return false;
}
if ((int)__instance.caseType != 1)
{
return true;
}
string newMurderCaseName = CaseNameLocalization.GetNewMurderCaseName();
if (!string.Equals(__instance.name, newMurderCaseName, StringComparison.Ordinal))
{
return true;
}
__instance.name = CaseNameLocalization.GetNeutralCaseName();
CasePanelController instance = CasePanelController.Instance;
if ((Object)(object)instance != (Object)null)
{
instance.UpdateCaseControls();
}
return false;
}
}
}