using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using On.RoR2;
using RoR2;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("PublicShaming")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("PublicShaming")]
[assembly: AssemblyTitle("PublicShaming")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace PublicShaming;
[BepInPlugin("com.Viliger.PublicShaming", "PublicShaming", "1.0.0")]
public class PublicShaming : BaseUnityPlugin
{
public const string Author = "Viliger";
public const string ModName = "PublicShaming";
public const string Version = "1.0.0";
public const string GUID = "com.Viliger.PublicShaming";
public const string LanguageFolder = "Language";
private void Awake()
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Expected O, but got Unknown
GlobalEventManager.OnInteractionsGlobal += GlobalEventManager_OnInteractionsGlobal;
ShrineRebirthController.StoreRebirthItemChoice += new hook_StoreRebirthItemChoice(ShrineRebirthController_StoreRebirthItemChoice);
Language.collectLanguageRootFolders += Language_collectLanguageRootFolders;
}
private void ShrineRebirthController_StoreRebirthItemChoice(orig_StoreRebirthItemChoice orig, ShrineRebirthController self, int itemChoice)
{
orig.Invoke(self, itemChoice);
if (Object.op_Implicit((Object)(object)self.rebirthCandidate))
{
SendChatMessage(self.rebirthCandidate, ((Component)self).gameObject);
}
}
private void GlobalEventManager_OnInteractionsGlobal(Interactor interactor, IInteractable interactable, GameObject interactableObject)
{
if (interactable is TeleporterInteraction)
{
SendChatMessage(interactor, interactableObject);
}
else if (interactable is GenericInteraction && Object.op_Implicit((Object)(object)interactableObject.GetComponent<SceneExitController>()))
{
SendChatMessage(interactor, interactableObject);
}
}
private static void SendChatMessage(Interactor activator, GameObject gameObject)
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Expected O, but got Unknown
string text = ((Object)gameObject).name;
IDisplayNameProvider val = default(IDisplayNameProvider);
if (gameObject.TryGetComponent<IDisplayNameProvider>(ref val))
{
text = val.GetDisplayName();
}
SimpleChatMessage val2 = new SimpleChatMessage();
val2.baseToken = "PUBLIC_SHAMING_INTERACTABLE_ACTIVATED";
val2.paramTokens = new string[2]
{
Util.GetBestBodyName(((Component)activator).gameObject),
text
};
Chat.SendBroadcastChat((ChatMessageBase)(object)val2);
}
private void Language_collectLanguageRootFolders(List<string> folders)
{
folders.Add(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "Language"));
}
}