using System;
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.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
[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("Mia")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+899bc25fe4539c9ffdaf5c5a8b9b9fe0e11b5e61")]
[assembly: AssemblyProduct("ChatCommandChange")]
[assembly: AssemblyTitle("ChatCommandChange")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://git.sr.ht/~mia/AnimalSpa")]
[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 ChatCommandChange
{
[BepInPlugin("ChatCommandChange", "ChatCommandChange", "1.0.0")]
public class ChatCommandChange : BaseUnityPlugin
{
private readonly Harmony _harmony = new Harmony("ChatCommandChange");
internal static ManualLogSource Logger;
private static ConfigEntry<string> _chatJoinCommand;
private static ConfigEntry<string> _chatRoamCommand;
private static ConfigEntry<string> _chatBathCommand;
private static ConfigEntry<string> _chatJoyCommand;
private static ConfigEntry<string> _chatFloorCommand;
private static ConfigEntry<string> _chatExitCommand;
internal const string DefaultJoin = "!join";
internal const string DefaultRoam = "!roam";
internal const string DefaultBath = "!bath";
internal const string DefaultJoy = "!joy";
internal const string DefaultFloor = "!floor";
internal const string DefaultExit = "!exit";
public static string ChatJoinCommand
{
get
{
return _chatJoinCommand.Value;
}
set
{
if (!(value == ""))
{
_chatJoinCommand.Value = value;
Logger.LogInfo((object)("Join command changed to " + value));
}
}
}
public static string ChatRoamCommand
{
get
{
return _chatRoamCommand.Value;
}
set
{
if (!(value == ""))
{
_chatRoamCommand.Value = value;
Logger.LogInfo((object)("Roam command changed to " + value));
}
}
}
public static string ChatBathCommand
{
get
{
return _chatBathCommand.Value;
}
set
{
if (!(value == ""))
{
_chatBathCommand.Value = value;
Logger.LogInfo((object)("Bath command changed to " + value));
}
}
}
public static string ChatJoyCommand
{
get
{
return _chatJoyCommand.Value;
}
set
{
if (!(value == ""))
{
_chatJoyCommand.Value = value;
Logger.LogInfo((object)("Joy command changed to " + value));
}
}
}
public static string ChatFloorCommand
{
get
{
return _chatFloorCommand.Value;
}
set
{
if (!(value == ""))
{
_chatFloorCommand.Value = value;
Logger.LogInfo((object)("Floor command changed to " + value));
}
}
}
public static string ChatExitCommand
{
get
{
return _chatExitCommand.Value;
}
set
{
if (!(value == ""))
{
_chatExitCommand.Value = value;
Logger.LogInfo((object)("Exit command changed to " + value));
}
}
}
private void Awake()
{
Logger = ((BaseUnityPlugin)this).Logger;
((BaseUnityPlugin)this).Config.SaveOnConfigSet = true;
_chatJoinCommand = ((BaseUnityPlugin)this).Config.Bind<string>("General", "Join Command", "!join", "Command to replace `!join`");
_chatRoamCommand = ((BaseUnityPlugin)this).Config.Bind<string>("General", "Roam Command", "!roam", "Command to replace `!roam`");
_chatBathCommand = ((BaseUnityPlugin)this).Config.Bind<string>("General", "Bath Command", "!bath", "Command to replace `!bath`");
_chatJoyCommand = ((BaseUnityPlugin)this).Config.Bind<string>("General", "Joy Command", "!joy", "Command to replace `!joy`");
_chatFloorCommand = ((BaseUnityPlugin)this).Config.Bind<string>("General", "Floor Command", "!floor", "Command to replace `!floor`");
_chatExitCommand = ((BaseUnityPlugin)this).Config.Bind<string>("General", "Exit Command", "!exit", "Command to replace `!exit`");
_harmony.PatchAll(typeof(StreamingManagerPatch));
Logger.LogInfo((object)"Plugin ChatCommandChange is loaded!");
}
}
[HarmonyPatch(typeof(StreamingManager))]
internal static class StreamingManagerPatch
{
[HarmonyPatch("ChatWork")]
[HarmonyPrefix]
private static void ChatWorkPatch(string name, ref string msg)
{
if (ChatCommandChange.ChatJoinCommand != "!join")
{
msg = msg.Replace("!join", "").Replace(ChatCommandChange.ChatJoinCommand, "!join");
}
if (ChatCommandChange.ChatRoamCommand != "!roam")
{
msg = msg.Replace("!roam", "").Replace(ChatCommandChange.ChatRoamCommand, "!roam");
}
if (ChatCommandChange.ChatBathCommand != "!bath")
{
msg = msg.Replace("!bath", "").Replace(ChatCommandChange.ChatBathCommand, "!bath");
}
if (ChatCommandChange.ChatJoyCommand != "!joy")
{
msg = msg.Replace("!joy", "").Replace(ChatCommandChange.ChatJoyCommand, "!joy");
}
if (ChatCommandChange.ChatFloorCommand != "!floor")
{
msg = msg.Replace("!floor", "").Replace(ChatCommandChange.ChatFloorCommand, "!floor");
}
if (ChatCommandChange.ChatExitCommand != "!exit")
{
msg = msg.Replace("!exit", "").Replace(ChatCommandChange.ChatExitCommand, "!exit");
}
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "ChatCommandChange";
public const string PLUGIN_NAME = "ChatCommandChange";
public const string PLUGIN_VERSION = "1.0.0";
}
}