using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
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("Omniscye")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("EmpressAbbreviations")]
[assembly: AssemblyTitle("EmpressAbbreviations")]
[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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
[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 EmpressAbreciations
{
[BepInPlugin("Empress.EmpressAbreciations", "EmpressAbreciations", "1.0.0")]
public class EmpressAbreciations : BaseUnityPlugin
{
[HarmonyPatch(typeof(ChatManager), "MessageSend")]
private static class Patch_ChatManager_MessageSend
{
private static readonly FieldInfo ChatMessageField = AccessTools.Field(typeof(ChatManager), "chatMessage");
private static void Prefix(object __instance)
{
if (Instance.Enabled.Value)
{
string text = (ChatMessageField.GetValue(__instance) as string) ?? string.Empty;
string text2 = Expand(text);
if (!string.Equals(text, text2, StringComparison.Ordinal))
{
ChatMessageField.SetValue(__instance, text2);
}
}
}
}
internal static Dictionary<string, string> Map = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
internal ConfigEntry<bool> Enabled = null;
internal ConfigEntry<bool> IgnoreSlashCommands = null;
internal ConfigEntry<bool> PreserveCase = null;
internal static EmpressAbreciations Instance { get; private set; } = null;
internal static ManualLogSource Logger => Instance._logger;
private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger;
internal Harmony? Harmony { get; set; }
private void Awake()
{
Instance = this;
((Component)this).gameObject.transform.parent = null;
((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
Enabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enabled", true, "Toggle the plugin");
IgnoreSlashCommands = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "IgnoreSlashCommands", true, "Do not expand text that begins with '/'");
PreserveCase = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "PreserveCase", true, "Preserve the case of the abbreviation when expanding");
LoadMap();
Patch();
Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} loaded");
}
internal void Patch()
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Expected O, but got Unknown
//IL_0026: Expected O, but got Unknown
if (Harmony == null)
{
Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID);
Harmony val2 = val;
Harmony = val;
}
Harmony.PatchAll();
}
internal void Unpatch()
{
Harmony? harmony = Harmony;
if (harmony != null)
{
harmony.UnpatchSelf();
}
}
internal static string Expand(string input)
{
if (string.IsNullOrEmpty(input))
{
return input;
}
if (!Instance.Enabled.Value)
{
return input;
}
if (Instance.IgnoreSlashCommands.Value && input.TrimStart().StartsWith("/"))
{
return input;
}
string text = input;
foreach (KeyValuePair<string, string> kv in Map)
{
string text2 = Regex.Escape(kv.Key);
string pattern = "(?<=^|[^A-Za-z0-9])" + text2 + "(?=$|[^A-Za-z0-9])";
text = Regex.Replace(text, pattern, (Match m) => ApplyCase(m.Value, kv.Value), RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);
}
return text;
}
private static string ApplyCase(string original, string expansion)
{
if (!Instance.PreserveCase.Value)
{
return expansion;
}
if (!original.Any(char.IsLetter))
{
return expansion;
}
bool flag = original.ToUpperInvariant() == original && original.ToLowerInvariant() != original;
bool flag2 = original.ToLowerInvariant() == original && original.ToUpperInvariant() != original;
bool flag3 = char.IsLetter(original[0]) && char.IsUpper(original[0]) && original.Skip(1).All((char c) => !char.IsLetter(c) || char.IsLower(c));
if (flag)
{
return expansion.ToUpperInvariant();
}
if (flag2)
{
return expansion.ToLowerInvariant();
}
if (flag3)
{
TextInfo textInfo = CultureInfo.CurrentCulture.TextInfo;
return textInfo.ToTitleCase(expansion.ToLowerInvariant());
}
return expansion;
}
private void LoadMap()
{
Map.Clear();
A("afaik", "as far as i know");
A("afk", "away from keyboard");
A("aka", "also known as");
A("ama", "ask me anything");
A("asap", "as soon as possible");
A("atm", "at the moment");
A("b/c", "because");
A("bc", "because");
A("bday", "birthday");
A("bf", "boyfriend");
A("bff", "best friends forever");
A("bfn", "bye for now");
A("brb", "be right back");
A("brb", "be right back");
A("bruh", "brother");
A("btw", "by the way");
A("b4", "before");
A("bday", "birthday");
A("cba", "cannot be arsed");
A("cc", "carbon copy");
A("cf", "compare");
A("cmiiw", "correct me if i am wrong");
A("cmon", "come on");
A("cya", "see you");
A("d8", "date");
A("dae", "does anyone else");
A("dm", "direct message");
A("dmed", "direct messaged");
A("dms", "direct messages");
A("dnd", "do not disturb");
A("doa", "dead on arrival");
A("dunno", "do not know");
A("eod", "end of day");
A("eom", "end of message");
A("eta", "estimated time of arrival");
A("etc", "et cetera");
A("f2f", "face to face");
A("fomo", "fear of missing out");
A("faq", "frequently asked questions");
A("fb", "facebook");
A("ffs", "for fucks sake");
A("fml", "fuck my life");
A("ftw", "for the win");
A("ftfy", "fixed that for you");
A("ftl", "for the loss");
A("fwiw", "for what it is worth");
A("fyi", "for your information");
A("g2g", "got to go");
A("g2m", "go to meeting");
A("g2w", "got to work");
A("g9", "good night");
A("gfy", "good for you");
A("gg", "good game");
A("gj", "good job");
A("gl", "good luck");
A("glhf", "good luck have fun");
A("gm", "good morning");
A("gn", "good night");
A("gr8", "great");
A("grats", "congratulations");
A("gtg", "got to go");
A("gud", "good");
A("hbd", "happy birthday");
A("hbu", "how about you");
A("hf", "have fun");
A("hmu", "hit me up");
A("hru", "how are you");
A("ht", "hat tip");
A("hth", "hope this helps");
A("ial", "i am listening");
A("ib", "i am back");
A("ic", "i see");
A("icymi", "in case you missed it");
A("idc", "i do not care");
A("idgaf", "i do not give a fuck");
A("idk", "i do not know");
A("ifyp", "i feel your pain");
A("ig", "instagram");
A("ig", "i guess");
A("ik", "i know");
A("ikr", "i know right");
A("ilysm", "i love you so much");
A("ily", "i love you");
A("im", "i am");
A("imo", "in my opinion");
A("imho", "in my humble opinion");
A("irl", "in real life");
A("istg", "i swear to god");
A("ita", "i totally agree");
A("iykyk", "if you know you know");
A("jfc", "jesus fucking christ");
A("jk", "just kidding");
A("jkjk", "just kidding just kidding");
A("kms", "kill myself");
A("k", "okay");
A("kk", "okay");
A("kinda", "kind of");
A("l8r", "later");
A("lb", "like back");
A("lfg", "looking for group");
A("lfm", "looking for more");
A("lft", "looking for team");
A("lmao", "laughing my ass off");
A("lmfao", "laughing my fucking ass off");
A("lmafo", "laugh my fucking ass off");
A("lmk", "let me know");
A("lmkw", "let me know when");
A("lms", "like my status");
A("lol", "laugh out loud");
A("loml", "love of my life");
A("lowkey", "low key");
A("ly", "love you");
A("lyk", "let you know");
A("m8", "mate");
A("mb", "my bad");
A("mf", "motherfucker");
A("mfw", "my face when");
A("mhm", "mm hmm");
A("mk", "okay");
A("mm", "meeting");
A("n/a", "not applicable");
A("nbd", "no big deal");
A("ngl", "not going to lie");
A("nms", "not my style");
A("nm", "not much");
A("noob", "newbie");
A("nvm", "never mind");
A("nsfw", "not safe for work");
A("nsfl", "not safe for life");
A("nyt", "not yet");
A("o7", "salute");
A("obv", "obviously");
A("ofc", "of course");
A("omg", "oh my god");
A("omfg", "oh my fucking god");
A("omw", "on my way");
A("op", "overpowered");
A("ot", "off topic");
A("otp", "one true pairing");
A("p2p", "peer to peer");
A("p2w", "pay to win");
A("p2e", "play to earn");
A("ppl", "people");
A("plz", "please");
A("pls", "please");
A("pog", "play of the game");
A("poggers", "very cool");
A("pp", "profile picture");
A("prob", "probably");
A("prolly", "probably");
A("psa", "public service announcement");
A("ptfo", "play the fuck out");
A("ptw", "pay to win");
A("qt", "cutie");
A("qotd", "question of the day");
A("rb", "rebound");
A("re", "regarding");
A("rfp", "request for proposal");
A("rn", "right now");
A("rofl", "rolling on the floor laughing");
A("rotfl", "rolling on the floor laughing");
A("rsvp", "please respond");
A("rt", "retweet");
A("smdh", "shaking my damn head");
A("smh", "shaking my head");
A("smol", "small");
A("sry", "sorry");
A("srly", "seriously");
A("sus", "suspicious");
A("tba", "to be announced");
A("tbc", "to be continued");
A("tbd", "to be decided");
A("tbf", "to be fair");
A("tbh", "to be honest");
A("tbqh", "to be quite honest");
A("tbt", "throwback thursday");
A("tc", "take care");
A("tf", "the fuck");
A("tfw", "that feeling when");
A("tgif", "thank god it is friday");
A("thx", "thanks");
A("tia", "thanks in advance");
A("til", "today i learned");
A("tl;dr", "too long did not read");
A("tldr", "too long did not read");
A("tmr", "tomorrow");
A("tmrw", "tomorrow");
A("tmi", "too much information");
A("tmm", "tomorrow morning");
A("tmo", "tomorrow");
A("tn", "tonight");
A("tnt", "till next time");
A("ttyl", "talk to you later");
A("ttys", "talk to you soon");
A("txt", "text");
A("ty", "thank you");
A("tysm", "thank you so much");
A("u", "you");
A("ur", "your");
A("urw", "you are welcome");
A("uwu", "cute face");
A("v", "very");
A("vars", "variables");
A("vs", "versus");
A("w/", "with");
A("w/o", "without");
A("w8", "wait");
A("wbu", "what about you");
A("wcw", "woman crush wednesday");
A("wdym", "what do you mean");
A("wdu", "what do you");
A("w/e", "whatever");
A("wfh", "work from home");
A("wfm", "works for me");
A("wfh", "working from home");
A("wibta", "would i be the asshole");
A("wip", "work in progress");
A("wknd", "weekend");
A("wrt", "with respect to");
A("wtf", "what the fuck");
A("wth", "what the hell");
A("wyd", "what are you doing");
A("wya", "where are you at");
A("wys", "what you saying");
A("xoxo", "hugs and kisses");
A("ya", "you");
A("yall", "you all");
A("yk", "you know");
A("ykwim", "you know what i mean");
A("ymmv", "your mileage may vary");
A("yo", "hello");
A("yolo", "you only live once");
A("yw", "you are welcome");
A("zzzz", "sleeping");
A("bbl", "be back later");
A("bbiab", "be back in a bit");
A("bbiaf", "be back in a few");
A("bbiam", "be back in a minute");
A("bbs", "be back soon");
A("btt", "back to topic");
A("cba", "cannot be bothered");
A("cbb", "could be bothered");
A("cbb", "cannot be bothered");
A("cbb", "could not be bothered");
A("ck", "check");
A("cp", "cross post");
A("cu", "see you");
A("cuz", "because");
A("cus", "because");
A("diy", "do it yourself");
A("dw", "do not worry");
A("ez", "easy");
A("faq", "frequently asked questions");
A("ffs", "for fucks sake");
A("fo", "fuck off");
A("ftl", "faster than light");
A("gf", "girlfriend");
A("gimme", "give me");
A("gmta", "great minds think alike");
A("gonna", "going to");
A("gotta", "got to");
A("gtfo", "get the fuck out");
A("hand", "have a nice day");
A("hbu", "how about you");
A("idc", "i do not care");
A("ily2", "i love you too");
A("imo", "in my opinion");
A("irl", "in real life");
A("istg", "i swear to god");
A("jw", "just wondering");
A("lmk", "let me know");
A("nvr", "never");
A("naw", "no");
A("ne1", "anyone");
A("ne", "any");
A("oic", "oh i see");
A("oml", "oh my lord");
A("otp", "on the phone");
A("pov", "point of view");
A("ppl", "people");
A("qna", "questions and answers");
A("rn", "right now");
A("sry", "sorry");
A("srsl", "seriously");
A("sup", "what is up");
A("tba", "to be announced");
A("tbc", "to be confirmed");
A("tc", "take care");
A("tfw", "that feeling when");
A("tfti", "thanks for the invite");
A("tho", "though");
A("thru", "through");
A("thx", "thanks");
A("tmrw", "tomorrow");
A("tryna", "trying to");
A("ttfn", "ta ta for now");
A("ttys", "talk to you soon");
A("u2", "you too");
A("wanna", "want to");
A("whatev", "whatever");
A("whatevs", "whatever");
A("wot", "what");
A("ya", "yes");
A("yo", "hello");
A("yr", "year");
static void A(string a, string b)
{
if (!Map.ContainsKey(a))
{
Map.Add(a, b);
}
}
}
}
}