using System;
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 BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Mirror;
using Nessie.ATLYSS.EasySettings;
using Nessie.ATLYSS.EasySettings.UIElements;
using TMPro;
using UnityEngine;
using UnityEngine.Animations;
using UnityEngine.Events;
using UnityEngine.Playables;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("AtlyssEmotes")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("AtlyssEmotes")]
[assembly: AssemblyTitle("AtlyssEmotes")]
[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 AtlyssEmotes
{
public static class AssetHandler
{
public static Dictionary<string, AssetBundle> bundles = new Dictionary<string, AssetBundle>();
public static void GetAssetBundle(string bundlename)
{
Plugin.Logger.LogInfo((object)("Loading bundle: " + bundlename));
AssetBundle value = AssetBundle.LoadFromFile(Path.Combine(Utilities.path, bundlename));
bundles.Add(bundlename, value);
Plugin.Logger.LogInfo((object)("Bundle " + bundlename + " Loaded!"));
}
public static void RegisterAllEmotePacks()
{
Plugin.Logger.LogInfo((object)"Loading All EmotePacks...");
Plugin.Logger.LogInfo((object)"Loading Base EmotePack");
EmoteManager.RegisterEmotePackage(AssetHandler.FetchFromBundle<EmotePackage>("emotewheel", "BasePack"));
Plugin.Logger.LogInfo((object)"Base EmotePack Loaded!");
Plugin.Logger.LogInfo((object)"Finding Other EmotePacks...");
RegisterAllInPath(Utilities.pluginsFolder);
}
public static void RegisterEmotePacksInPath(string path)
{
Plugin.Logger.LogInfo((object)("Loading EmotePacks at Path: " + path));
string[] files = Directory.GetFiles(path);
foreach (string bundlepath in files)
{
RegisterEmotePack(bundlepath);
}
Plugin.Logger.LogInfo((object)("EmotePacks in path: " + path + " Loaded!"));
}
public static void RegisterAllInPath(string path)
{
string[] directories = Directory.GetDirectories(path);
foreach (string path2 in directories)
{
if (Path.GetFileName(path2).Equals(Utilities.EmoteDirectoryName))
{
RegisterEmotePacksInPath(Path.Combine(path, Utilities.EmoteDirectoryName));
}
else
{
RegisterAllInPath(path2);
}
}
}
public static void RegisterEmotePack(string bundlepath)
{
string fileName = Path.GetFileName(bundlepath);
Plugin.Logger.LogInfo((object)("Loading EmotePack: " + fileName));
AssetBundle val = AssetBundle.LoadFromFile(bundlepath);
EmotePackage emotePackage = val.LoadAsset<EmotePackage>("_Package");
if ((Object)(object)emotePackage == (Object)null)
{
Plugin.Logger.LogInfo((object)"Couldn't find _Package Object. Skipping...");
val.Unload(false);
}
else
{
EmoteManager.RegisterEmotePackage(emotePackage);
Plugin.Logger.LogInfo((object)("EmotePack " + fileName + " Loaded!"));
val.Unload(false);
}
}
public static void GetAssetBundles()
{
GetAssetBundle("emotewheel");
}
public static T FetchFromBundle<T>(string bundle, string key) where T : Object
{
return bundles[bundle].LoadAsset<T>(key);
}
}
public static class EmoteManager
{
public static Dictionary<string, ScriptableEmote> allEmotes { get; private set; } = new Dictionary<string, ScriptableEmote>();
public static List<string> publicNames { get; private set; }
public static List<string> internalNames { get; private set; }
public static List<string> registeredPackages { get; private set; } = new List<string>();
public static void ClearEmoteData()
{
allEmotes.Clear();
registeredPackages.Clear();
}
public static void RegisterEmotePackage(EmotePackage package)
{
if (!registeredPackages.Contains(package.packID))
{
registeredPackages.Add(package.packID);
}
foreach (ScriptableEmote emote in package.emotes)
{
RegisterEmote(package.packID, emote);
}
}
public static void RegisterEmote(string package, ScriptableEmote emote)
{
emote.packageName = package;
allEmotes[emote.GetName()] = emote;
}
}
public class EmoteOverrider : MonoBehaviour
{
[HarmonyPatch]
private static class Patches
{
[HarmonyPatch(typeof(PlayerVisual), "Local_CrossFadeAnim")]
[HarmonyPostfix]
private static void PlayCustomEmotes(PlayerVisual __instance, string _animName, float _animFadeTime, int _animLayer)
{
if (!((Object)(object)__instance == (Object)null) && !((Object)(object)__instance._visualAnimator == (Object)null))
{
EmoteOverrider component = ((Component)__instance._visualAnimator).GetComponent<EmoteOverrider>();
if (_animLayer == 11 && EmoteManager.allEmotes.ContainsKey(_animName) && !EmoteManager.allEmotes[_animName].isVanilla && (Object)(object)component != (Object)null)
{
component.emote = EmoteManager.allEmotes[_animName];
component.Play();
component.fadeInTime = _animFadeTime;
}
}
}
[HarmonyPatch(typeof(PlayerVisual), "Iterate_AnimationCallback")]
[HarmonyPostfix]
private static void StopEmotingAtPoints(PlayerVisual __instance, string _animName, int _animLayer)
{
EmoteOverrider component = ((Component)__instance._visualAnimator).GetComponent<EmoteOverrider>();
if ((Object)(object)component == (Object)null)
{
return;
}
switch (_animLayer)
{
case 0:
if (_animName != "Idle" && _animName != "Idle_02")
{
component.Stop();
}
break;
case 1:
if (_animName != "Empty")
{
component.Stop();
}
break;
case 3:
if (_animName != "Empty")
{
component.Stop();
}
break;
case 7:
if (_animName != "Empty")
{
component.Stop();
}
break;
case 8:
if (_animName != "Empty")
{
component.Stop();
}
break;
case 9:
component.Stop();
break;
case 10:
if (_animName == "Dash")
{
component.Stop();
}
break;
case 2:
case 4:
case 5:
case 6:
break;
}
}
}
public Animator anim;
public ScriptableEmote emote;
public bool play;
public float fadeInTime;
private PlayableGraph graph;
private AnimationClipPlayable initPlayable;
private AnimationClipPlayable loopPlayable;
private AnimatorControllerPlayable contPlayable;
private AnimationMixerPlayable channelmixer;
private PlayableOutput playableOutput;
private bool playing;
private void Start()
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
anim = ((Component)this).GetComponent<Animator>();
graph = PlayableGraph.Create();
channelmixer = AnimationMixerPlayable.Create(graph, 3);
PlayableExtensions.ConnectInput<AnimationMixerPlayable, AnimatorControllerPlayable>(channelmixer, 2, contPlayable, 0);
playableOutput = AnimationPlayableOutput.op_Implicit(AnimationPlayableOutput.Create(graph, "Animation", anim));
PlayableOutputExtensions.SetSourcePlayable<PlayableOutput, AnimationMixerPlayable>(playableOutput, channelmixer);
}
public void Stop()
{
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
playing = false;
PlayableExtensions.DisconnectInput<AnimationMixerPlayable>(channelmixer, 0);
PlayableExtensions.DisconnectInput<AnimationMixerPlayable>(channelmixer, 1);
if (PlayableExtensions.IsValid<AnimationClipPlayable>(initPlayable))
{
PlayableExtensions.Destroy<AnimationClipPlayable>(initPlayable);
}
if (PlayableExtensions.IsValid<AnimationClipPlayable>(loopPlayable))
{
PlayableExtensions.Destroy<AnimationClipPlayable>(loopPlayable);
}
PlayableExtensions.SetInputWeight<AnimationMixerPlayable>(channelmixer, 0, 0f);
PlayableExtensions.SetInputWeight<AnimationMixerPlayable>(channelmixer, 1, 0f);
((PlayableGraph)(ref graph)).Stop();
}
private void Play()
{
Stop();
playing = true;
if ((Object)(object)emote.init == (Object)null && (Object)(object)emote.loop != (Object)null)
{
Play(emote.loop, loopLayer: true);
}
else
{
Play(emote.init, loopLayer: false);
}
}
private void Play(AnimationClip clip, bool loopLayer)
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
AnimationClipPlayable val = (loopLayer ? loopPlayable : initPlayable);
if (PlayableExtensions.IsValid<AnimationClipPlayable>(val))
{
PlayableExtensions.Destroy<AnimationClipPlayable>(val);
}
val = AnimationClipPlayable.Create(graph, clip);
if (!loopLayer)
{
PlayableExtensions.SetDuration<AnimationClipPlayable>(val, (double)clip.length);
}
PlayableExtensions.SetTime<AnimationClipPlayable>(val, 0.0);
PlayableExtensions.ConnectInput<AnimationMixerPlayable, AnimationClipPlayable>(channelmixer, loopLayer ? 1 : 0, val, 0);
if (loopLayer)
{
loopPlayable = val;
}
else
{
initPlayable = val;
}
playing = true;
((PlayableGraph)(ref graph)).Play();
}
private void Update()
{
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
if (!playing)
{
return;
}
if ((Object)(object)emote.init == (Object)null && (Object)(object)emote.loop == (Object)null)
{
Stop();
}
HandleWeights();
if (PlayableExtensions.IsValid<AnimationClipPlayable>(initPlayable))
{
double normalizedTime = GetNormalizedTime(AnimationClipPlayable.op_Implicit(initPlayable));
if ((Object)(object)emote.loop != (Object)null && normalizedTime >= (double)(emote.ExitTime - emote.TransitionOffset) && GetNormalizedTime(AnimationClipPlayable.op_Implicit(initPlayable), last: true) < (double)emote.ExitTime)
{
Play(emote.loop, loopLayer: true);
}
else if ((Object)(object)emote.loop == (Object)null && PlayableExtensions.IsDone<AnimationClipPlayable>(initPlayable))
{
Stop();
}
}
}
private void HandleWeights()
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_016a: Unknown result type (might be due to invalid IL or missing references)
//IL_017a: Unknown result type (might be due to invalid IL or missing references)
//IL_0145: Unknown result type (might be due to invalid IL or missing references)
Playable val = AnimationClipPlayable.op_Implicit(PlayableExtensions.IsValid<AnimationClipPlayable>(initPlayable) ? initPlayable : loopPlayable);
double time = PlayableExtensions.GetTime<Playable>(val);
double num = (PlayableExtensions.IsValid<AnimationClipPlayable>(initPlayable) ? PlayableExtensions.GetDuration<AnimationClipPlayable>(initPlayable) : ((double)emote.loop.length));
double num2 = time / num;
float num3 = ((fadeInTime != 0f) ? Mathf.Clamp((float)(num2 / (double)fadeInTime), 0f, 1f) : 1f);
float num4;
float num5;
if ((Object)(object)emote.init == (Object)null)
{
num4 = 1f;
num5 = 0f;
}
else
{
if (num2 < (double)emote.ExitTime)
{
num5 = 1f;
num4 = 0f;
}
else if (num2 > (double)(emote.ExitTime + emote.TransitionDuration))
{
num5 = 0f;
num4 = 1f;
}
else
{
num4 = (float)((num2 - (double)emote.ExitTime) / (double)emote.TransitionDuration);
num5 = 1f - num4;
}
if (!PlayableExtensions.IsValid<AnimationClipPlayable>(loopPlayable))
{
num3 = num5;
num5 = 1f;
num4 = 0f;
}
}
PlayableExtensions.SetInputWeight<AnimationMixerPlayable>(channelmixer, 0, num5 * num3);
PlayableExtensions.SetInputWeight<AnimationMixerPlayable>(channelmixer, 1, num4 * num3);
}
private double GetNormalizedTime(Playable p, bool last = false)
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0004: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
double num = (last ? PlayableExtensions.GetPreviousTime<Playable>(p) : PlayableExtensions.GetTime<Playable>(p));
double duration = PlayableExtensions.GetDuration<Playable>(p);
return num / duration;
}
private void OnDestroy()
{
if (((PlayableGraph)(ref graph)).IsValid())
{
((PlayableGraph)(ref graph)).Destroy();
}
}
}
[CreateAssetMenu(fileName = "Emote", menuName = "ScriptableObjects/Custom/EmotePackage", order = 1)]
public class EmotePackage : ScriptableObject
{
public string packID;
public List<ScriptableEmote> emotes;
}
public class MouthReaction : MonoBehaviour
{
private Image image;
private float currentTimer;
private const float timermin = 120f;
private const float timermax = 240f;
private const float disappeartimermin = 2f;
private const float disappeartimermax = 10f;
private void Start()
{
image = ((Component)this).GetComponent<Image>();
((Behaviour)image).enabled = false;
currentTimer = Random.Range(120f, 240f);
}
private void Update()
{
if (currentTimer <= 0f)
{
((Behaviour)image).enabled = !((Behaviour)image).enabled;
if (((Behaviour)image).enabled)
{
currentTimer = Random.Range(2f, 10f);
}
else
{
currentTimer = Random.Range(120f, 240f);
}
}
else
{
currentTimer -= Time.deltaTime;
}
}
}
public class PlayerVisualPatcher : MonoBehaviour
{
[HarmonyPatch]
public static class Patches
{
[HarmonyPatch(typeof(PlayerVisual), "Awake")]
[HarmonyPrefix]
private static void AddPatcher(PlayerVisual __instance)
{
((Component)__instance).gameObject.AddComponent<PlayerVisualPatcher>();
}
}
private PlayerVisual target;
private void Awake()
{
target = ((Component)this).GetComponent<PlayerVisual>();
}
private void Update()
{
if ((Object)(object)target._visualAnimator != (Object)null)
{
AddMoreEmotes(target._visualAnimator);
Object.Destroy((Object)(object)this);
}
}
public static void AddMoreEmotes(Animator anim)
{
if ((Object)(object)((Component)anim).GetComponent<EmoteOverrider>() == (Object)null)
{
((Component)anim).gameObject.AddComponent<EmoteOverrider>();
}
}
}
[BepInPlugin("com.snivyxxy.plugins.atlyssemotes", "Atlyss Emotes", "1.3.1")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInProcess("ATLYSS.exe")]
public class Plugin : BaseUnityPlugin
{
[HarmonyPatch]
private static class GetPlayer
{
[HarmonyPatch(typeof(Player), "OnGameConditionChange")]
[HarmonyPostfix]
private static void getPlayer(ref Player __instance, GameCondition _newCondition)
{
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Invalid comparison between Unknown and I4
if ((int)__instance._currentGameCondition == 1 && ((NetworkBehaviour)__instance).isLocalPlayer)
{
Logger.LogInfo((object)"Getting Player...");
if ((Object)(object)player == (Object)null)
{
Logger.LogInfo((object)"Loading Assets...");
player = __instance;
GameObject val = AssetHandler.FetchFromBundle<GameObject>("emotewheel", "LiveMouthReaction");
GameObject val2 = AssetHandler.FetchFromBundle<GameObject>("emotewheel", "EmoteWheel");
Mouth = Object.Instantiate<GameObject>(val, ((Component)player).gameObject.transform.Find("_Canvas_DynamicPlayerUI"));
Mouth.SetActive(Settings.Mouth.Value);
Object.Instantiate<GameObject>(val2, ((Component)player).gameObject.transform);
Logger.LogInfo((object)"Assets Loaded!");
}
if ((Object)(object)player != (Object)null)
{
Logger.LogInfo((object)("Player " + ((Object)((Component)__instance).gameObject).name + " got!"));
}
else
{
Logger.LogError((object)"Player wasn't got because it was null ;-;");
}
}
}
}
public static ManualLogSource Logger;
private static Player player;
public static GameObject Mouth;
public static Plugin plugin { get; private set; }
private void Awake()
{
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Expected O, but got Unknown
Logger = ((BaseUnityPlugin)this).Logger;
Logger.LogInfo((object)"Plugin AtlyssEmotes is loaded!");
plugin = this;
new Harmony("AtlyssEmotes").PatchAll();
Harmony val = new Harmony("AtlyssEmotes");
val.PatchAll(Assembly.GetExecutingAssembly());
AssetHandler.GetAssetBundles();
AssetHandler.RegisterAllEmotePacks();
Settings.Awake();
}
}
[CreateAssetMenu(fileName = "Emote", menuName = "ScriptableObjects/Custom/Emote", order = 1)]
public class ScriptableEmote : ScriptableObject
{
public Sprite icon;
public Sprite background;
public Sprite backgroundSelected;
public string emoteName;
public string emoteID;
public bool isVanilla;
[NonSerialized]
public string packageName;
public AnimationClip init;
public AnimationClip loop;
public float ExitTime;
public float TransitionDuration;
public float TransitionOffset;
public string GetName()
{
if (((Object)this).name.Equals("None") && emoteID.Equals(""))
{
return "None";
}
return packageName + ":" + emoteName;
}
}
public static class Settings
{
[CompilerGenerated]
private static class <>O
{
public static UnityAction <0>__AddSettings;
public static UnityAction <1>__Apply;
}
private static ConfigFile saveFile;
public static string[] defaultEmotes = new string[6] { "Base:Point", "Base:Clap", "Base:Think", "Base:Shrug", "Base:Dance", "Base:Taunt" };
public static ConfigEntry<KeyCode> EmoteWheelKey { get; private set; }
public static ConfigEntry<bool> Mouth { get; private set; }
public static ConfigEntry<int> NumOfEmotes { get; private set; }
public static ConfigEntry<string>[] emotes { get; private set; }
public static void Awake()
{
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Expected O, but got Unknown
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Expected O, but got Unknown
Plugin.Logger.LogInfo((object)"Initializing Settings");
saveFile = ((BaseUnityPlugin)Plugin.plugin).Config;
InitConfiguration();
UnityEvent onInitialized = Settings.OnInitialized;
object obj = <>O.<0>__AddSettings;
if (obj == null)
{
UnityAction val = AddSettings;
<>O.<0>__AddSettings = val;
obj = (object)val;
}
onInitialized.AddListener((UnityAction)obj);
UnityEvent onApplySettings = Settings.OnApplySettings;
object obj2 = <>O.<1>__Apply;
if (obj2 == null)
{
UnityAction val2 = Apply;
<>O.<1>__Apply = val2;
obj2 = (object)val2;
}
onApplySettings.AddListener((UnityAction)obj2);
}
private static void Apply()
{
saveFile.Save();
if ((Object)(object)Plugin.Mouth != (Object)null)
{
Plugin.Mouth.SetActive(Mouth.Value);
}
if ((Object)(object)WheelBehavior.instance != (Object)null)
{
WheelBehavior.instance.Start();
}
}
private static void InitConfiguration()
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Expected O, but got Unknown
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Expected O, but got Unknown
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Expected O, but got Unknown
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Expected O, but got Unknown
//IL_008d: Unknown result type (might be due to invalid IL or missing references)
//IL_0094: Expected O, but got Unknown
//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
//IL_00d9: Expected O, but got Unknown
//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
//IL_00fc: Expected O, but got Unknown
ConfigDefinition val = new ConfigDefinition("Keys", "EmoteWheelKey");
ConfigDescription val2 = new ConfigDescription("Key to pull up the Emote Wheel.", (AcceptableValueBase)null, Array.Empty<object>());
EmoteWheelKey = saveFile.Bind<KeyCode>(val, (KeyCode)93, val2);
ConfigDefinition val3 = new ConfigDefinition("Toggles", "LiveMouthReaction");
ConfigDescription val4 = new ConfigDescription("Toggles Live Mouth Reaction", (AcceptableValueBase)null, Array.Empty<object>());
Mouth = saveFile.Bind<bool>(val3, false, val4);
ConfigDefinition val5 = new ConfigDefinition("Ints", "NumOfEmotes");
ConfigDescription val6 = new ConfigDescription("Number of Emotes in the Wheel", (AcceptableValueBase)(object)new AcceptableValueRange<int>(2, 12), Array.Empty<object>());
NumOfEmotes = saveFile.Bind<int>(val5, 6, val6);
emotes = new ConfigEntry<string>[12];
for (int i = 0; i < 12; i++)
{
ConfigDefinition val7 = new ConfigDefinition("Strs", "Emote" + i);
ConfigDescription val8 = new ConfigDescription("Emote " + i + " in the wheel", (AcceptableValueBase)null, Array.Empty<object>());
emotes[i] = saveFile.Bind<string>(val7, (i < defaultEmotes.Length) ? defaultEmotes[i] : "None", val8);
}
}
private static AtlyssDropdown AddDropdown(string label, List<string> options, string value, ConfigEntry<string> config)
{
int num = (options.Contains(value) ? options.IndexOf(value) : 0);
AtlyssDropdown val = Settings.ModTab.AddDropdown(label, options, num);
val.OnValueChanged.AddListener((UnityAction<int>)delegate(int newValue)
{
config.Value = options[newValue];
});
return val;
}
private static void AddSettings()
{
SettingsTab modTab = Settings.ModTab;
modTab.AddHeader("Emote Wheel");
modTab.AddKeyButton("Emote Wheel Key", EmoteWheelKey);
modTab.AddToggle("Live Mouth Reaction", Mouth);
modTab.AddAdvancedSlider("Number Of Emotes", NumOfEmotes);
for (int i = 0; i < 12; i++)
{
AddDropdown("Emote " + i, new List<string>(EmoteManager.allEmotes.Keys), emotes[i].Value, emotes[i]);
}
}
}
public static class Utilities
{
public static string path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
public static string pluginsFolder = Paths.PluginPath;
public static string EmoteDirectoryName = "EmotePackages";
}
public class WheelBehavior : MonoBehaviour
{
[HarmonyPatch]
private class Patches
{
[HarmonyPatch(typeof(PlayerCombat), "<Init_Attack>g__AbleToInitAttack|102_0")]
[HarmonyPostfix]
private static void PatchCanAttack(ref bool __result)
{
if ((Object)(object)instance != (Object)null && instance.active)
{
__result = false;
}
}
}
public static WheelBehavior instance;
public WheelConfig Config;
public int NumOfEmotes;
public GameObject IconPrefab;
public float WheelRadius;
public float LerpSpeed;
public float TextDistance;
public TextMeshProUGUI emoteNameText;
[SerializeField]
private bool InUnityEdtior;
private WheelIcon[] Icons;
private Vector2 centeredMousePosition;
private float mouseAngle;
private float openProgress;
private int selectedIndex;
private bool active;
private Canvas canvas;
private ChatBehaviour chat;
public void Start()
{
//IL_018f: Unknown result type (might be due to invalid IL or missing references)
//IL_0194: Unknown result type (might be due to invalid IL or missing references)
NumOfEmotes = Settings.NumOfEmotes.Value;
if ((Object)(object)Config != (Object)null)
{
Object.Destroy((Object)(object)Config);
}
Config = ScriptableObject.CreateInstance<WheelConfig>();
Config.list = new List<ScriptableEmote>();
if (Icons != null)
{
WheelIcon[] icons = Icons;
foreach (WheelIcon wheelIcon in icons)
{
Object.Destroy((Object)(object)((Component)wheelIcon).gameObject);
}
}
Icons = new WheelIcon[NumOfEmotes];
for (int j = 0; j < NumOfEmotes; j++)
{
if (EmoteManager.allEmotes.ContainsKey(Settings.emotes[j].Value))
{
Config.list.Add(EmoteManager.allEmotes[Settings.emotes[j].Value]);
}
else
{
Config.list.Add(EmoteManager.allEmotes["None"]);
}
WheelIcon component = Object.Instantiate<GameObject>(IconPrefab, ((Component)this).gameObject.transform).GetComponent<WheelIcon>();
component.index = j;
component.Emote = Config.list[j];
Icons[j] = component;
}
if (Object.op_Implicit((Object)(object)emoteNameText))
{
((Component)emoteNameText).GetComponent<RectTransform>().anchoredPosition = TextDistance * Vector2.up;
}
canvas = ((Component)this).GetComponent<Canvas>();
if ((Object)(object)instance == (Object)null)
{
instance = this;
}
if (!InUnityEdtior)
{
chat = ChatBehaviour._current;
}
}
private void Update()
{
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_0200: Unknown result type (might be due to invalid IL or missing references)
//IL_0312: Unknown result type (might be due to invalid IL or missing references)
//IL_031d: Unknown result type (might be due to invalid IL or missing references)
//IL_0328: Unknown result type (might be due to invalid IL or missing references)
//IL_0351: Unknown result type (might be due to invalid IL or missing references)
//IL_0361: Unknown result type (might be due to invalid IL or missing references)
//IL_0371: Unknown result type (might be due to invalid IL or missing references)
//IL_0381: Unknown result type (might be due to invalid IL or missing references)
if (active)
{
Cursor.lockState = (CursorLockMode)0;
Cursor.visible = true;
if (!InUnityEdtior)
{
CameraFunction._current._unlockedCamera = true;
}
openProgress = Mathf.Lerp(openProgress, 1f, 1f - Mathf.Pow(LerpSpeed, Time.deltaTime));
centeredMousePosition = Vector2.op_Implicit(Input.mousePosition - new Vector3((float)(Screen.width / 2), (float)(Screen.height / 2)));
mouseAngle = (float)Math.PI / 2f + (float)Math.PI / (float)NumOfEmotes - Mathf.Atan2(centeredMousePosition.y, centeredMousePosition.x);
float num = mouseAngle / ((float)Math.PI * 2f) * (float)NumOfEmotes;
if (num < 0f)
{
num += (float)NumOfEmotes;
}
selectedIndex = Mathf.FloorToInt(num);
if (Input.GetMouseButtonUp(0))
{
if (InUnityEdtior)
{
Debug.Log((object)selectedIndex);
}
else
{
Plugin.Logger.LogInfo((object)Settings.Mouth.Value);
active = false;
PlayEmote(selectedIndex);
CameraFunction._current._unlockedCamera = false;
}
}
((TMP_Text)emoteNameText).text = Config.list[selectedIndex].emoteName;
}
else
{
openProgress = Mathf.Lerp(openProgress, 0f, 1f - Mathf.Pow(LerpSpeed, Time.deltaTime));
}
if (InUnityEdtior)
{
if (Input.GetKeyDown((KeyCode)93))
{
active = !active;
}
}
else
{
if ((!ChatBehaviour._current._focusedInChat && Input.GetKeyDown(Settings.EmoteWheelKey.Value)) || (active && Input.GetKeyDown((KeyCode)27)))
{
active = !active;
if (!active)
{
CameraFunction._current._unlockedCamera = false;
}
}
if (SettingsManager._current._isOpen || DialogManager._current._isDialogEnabled || TabMenu._current._isOpen)
{
active = false;
}
}
((Behaviour)canvas).enabled = openProgress > 0.1f;
WheelIcon[] icons = Icons;
foreach (WheelIcon wheelIcon in icons)
{
wheelIcon.selected = wheelIcon.index == selectedIndex;
((Component)wheelIcon).GetComponent<RectTransform>().anchoredPosition = new Vector2(Mathf.Sin((float)(wheelIcon.index * 2) * (float)Math.PI / (float)NumOfEmotes), Mathf.Cos((float)(wheelIcon.index * 2) * (float)Math.PI / (float)NumOfEmotes)) * openProgress * WheelRadius;
}
((Graphic)emoteNameText).color = new Color(((Graphic)emoteNameText).color.r, ((Graphic)emoteNameText).color.g, ((Graphic)emoteNameText).color.b, openProgress);
}
private void PlayEmote(int index)
{
if (InUnityEdtior)
{
Debug.Log((object)Config.list[index].emoteID);
}
else if (chat._emoteBuffer <= 0f)
{
string text = (Config.list[index].isVanilla ? Config.list[index].emoteID : Config.list[index].GetName());
chat._player._pVisual.Cmd_CrossFadeAnim(text, 0.1f, 11);
chat._player._pVisual.Local_CrossFadeAnim(text, 0.1f, 11);
chat._emoteBuffer = 0.85f;
}
}
}
[CreateAssetMenu(fileName = "EmoteWheelEmotes", menuName = "ScriptableObjects/Custom/EmoteWheelEmotes", order = 1)]
public class WheelConfig : ScriptableObject
{
public List<ScriptableEmote> list;
}
public class WheelIcon : MonoBehaviour
{
public int index;
public Image background;
public Image icons;
public bool selected;
public ScriptableEmote Emote;
private void Update()
{
if ((Object)(object)Emote != (Object)null)
{
background.sprite = (selected ? Emote.backgroundSelected : Emote.background);
icons.sprite = Emote.icon;
}
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "AtlyssEmotes";
public const string PLUGIN_NAME = "AtlyssEmotes";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}