using System;
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 BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using TMPro;
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("NPCHitPhrases")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0.0+933075a87795ced466ab4ad7e129d198765691a5")]
[assembly: AssemblyProduct("NPCHitPhrases")]
[assembly: AssemblyTitle("NPCHitPhrases")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.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 NPCHitPhrases
{
[BepInPlugin("NPCHitPhrases", "NPC Hit Phrases", "1.0.1")]
public class NPCHitPhrases : BaseUnityPlugin
{
public static ConfigEntry<string> NotificationMessages;
private Harmony Harmony;
public void Awake()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
Harmony = new Harmony("NPCHitPhrases");
((BaseUnityPlugin)this).Logger.LogInfo((object)"NPC Hit Phrases Loaded!");
Harmony.PatchAll();
NotificationMessages = ((BaseUnityPlugin)this).Config.Bind<string>("Misc", "Notification Messages", "Example1, Example2, Example3", "NPC hit phrases! Seperate them by commas");
}
public void OnDestroy()
{
((BaseUnityPlugin)this).Logger.LogInfo((object)"NPC Hit Phrases Unloaded!");
Harmony.UnpatchAll();
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "NPCHitPhrases";
public const string PLUGIN_NAME = "NPCHitPhrases";
public const string PLUGIN_VERSION = "1.0.0.0";
}
}
namespace NPCHitPhrases.Patches
{
[HarmonyPatch(typeof(NPC_Info))]
public class NPC_InfoPatches
{
private static List<string> NotificationMessages = new List<string>();
[HarmonyPrefix]
[HarmonyPatch("UserCode_RPCNotificationAboveHead__String__String")]
public static bool UserCode_RPCNotificationAboveHead__String__String(NPC_Info __instance, string message1, string messageAddon)
{
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_00af: Unknown result type (might be due to invalid IL or missing references)
//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: Unknown result type (might be due to invalid IL or missing references)
//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
if (!message1.Contains("NPCmessagehit"))
{
return true;
}
string value = NPCHitPhrases.NotificationMessages.Value;
if (string.IsNullOrEmpty(value))
{
return true;
}
NotificationMessages = (from m in value.Split(',')
select m.Trim()).ToList();
if (NotificationMessages.Any(string.IsNullOrEmpty))
{
return true;
}
GameObject val = Object.Instantiate<GameObject>(__instance.messagePrefab, ((Component)__instance).transform.position + Vector3.up * 1.8f, Quaternion.identity);
((TMP_Text)val.GetComponent<TextMeshPro>()).text = NotificationMessages[new Random().Next(NotificationMessages.Count)];
val.SetActive(true);
return false;
}
}
}