using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using UnityEngine;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("EmoteWheel")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("EmoteWheel")]
[assembly: AssemblyCopyright("Copyright © 2021")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("48f4900a-7fbb-4274-9a65-0cff9eb9bb2c")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.5", FrameworkDisplayName = "")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace EmoteWheel;
[BepInPlugin("virtuacode.valheim.emotewheel", "Emote Wheel Mod", "1.4.1")]
public class EmoteWheel : BaseUnityPlugin
{
private static Harmony harmony;
public static ConfigEntry<KeyboardShortcut> Hotkey;
public static ConfigEntry<bool> TriggerOnRelease;
public static ConfigEntry<bool> TriggerOnClick;
public static ConfigEntry<Color> HighlightColor;
public static ConfigEntry<float> GuiScale;
public static ConfigEntry<int> IgnoreJoyStickDuration;
public static ConfigEntry<bool> ToggleMenu;
public static ConfigEntry<bool> ModEnabled;
public static ConfigEntry<string> ProtectedBindings;
public static ConfigEntry<KeyboardShortcut> HotkeyGamepad;
public static KeyCode replacedKey = (KeyCode)0;
public static List<string> replacedButtons = new List<string>();
public static ManualLogSource MyLogger = Logger.CreateLogSource(Assembly.GetExecutingAssembly().GetName().Name);
public static float JoyStickIgnoreTime = 0f;
public static bool inventoryVisible = false;
public static Color GetHighlightColor => HighlightColor.Value;
public static bool CanOpenMenu
{
get
{
Player localPlayer = Player.m_localPlayer;
if (!((Object)(object)localPlayer == (Object)null) && !((Character)localPlayer).IsDead() && !((Character)localPlayer).InCutscene() && !((Character)localPlayer).IsTeleporting() && !inventoryVisible && ((Object)(object)Chat.instance == (Object)null || !Chat.instance.HasFocus()) && !Console.IsVisible() && !Menu.IsVisible() && (Object)(object)TextViewer.instance != (Object)null && !TextViewer.instance.IsVisible() && !GameCamera.InFreeFly())
{
return !Minimap.IsOpen();
}
return false;
}
}
public static bool IsShortcutDown
{
get
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: 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)
KeyboardShortcut val = (ZInput.IsGamepadActive() ? HotkeyGamepad.Value : Hotkey.Value);
KeyCode mainKey = ((KeyboardShortcut)(ref val)).MainKey;
KeyCode[] source = ((KeyboardShortcut)(ref val)).Modifiers.ToArray();
if (Input.GetKeyDown(mainKey))
{
return ((IEnumerable<KeyCode>)source).All((Func<KeyCode, bool>)Input.GetKey);
}
return false;
}
}
public static bool IsShortcutUp
{
get
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: 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)
KeyboardShortcut val = (ZInput.IsGamepadActive() ? HotkeyGamepad.Value : Hotkey.Value);
KeyCode mainKey = ((KeyboardShortcut)(ref val)).MainKey;
KeyCode[] source = ((KeyboardShortcut)(ref val)).Modifiers.ToArray();
if (!Input.GetKeyUp(mainKey))
{
return ((IEnumerable<KeyCode>)source).Any((Func<KeyCode, bool>)Input.GetKeyUp);
}
return true;
}
}
public static bool IsShortcutPressed
{
get
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: 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)
KeyboardShortcut val = (ZInput.IsGamepadActive() ? HotkeyGamepad.Value : Hotkey.Value);
KeyCode mainKey = ((KeyboardShortcut)(ref val)).MainKey;
KeyCode[] source = ((KeyboardShortcut)(ref val)).Modifiers.ToArray();
if (Input.GetKey(mainKey))
{
return ((IEnumerable<KeyCode>)source).All((Func<KeyCode, bool>)Input.GetKey);
}
return false;
}
}
public static void Log(string msg)
{
ManualLogSource myLogger = MyLogger;
if (myLogger != null)
{
myLogger.LogInfo((object)msg);
}
}
public static void LogErr(string msg)
{
ManualLogSource myLogger = MyLogger;
if (myLogger != null)
{
myLogger.LogError((object)msg);
}
}
public static void LogWarn(string msg)
{
ManualLogSource myLogger = MyLogger;
if (myLogger != null)
{
myLogger.LogWarning((object)msg);
}
}
public static bool IsDedicated()
{
MethodInfo method = typeof(ZNet).GetMethod("IsDedicated", BindingFlags.Instance | BindingFlags.Public);
return ((Func<ZNet, bool>)Delegate.CreateDelegate(typeof(Func<ZNet, bool>), method))(null);
}
public void Awake()
{
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Unknown result type (might be due to invalid IL or missing references)
//IL_0132: Unknown result type (might be due to invalid IL or missing references)
//IL_0195: Unknown result type (might be due to invalid IL or missing references)
//IL_019f: Expected O, but got Unknown
MyLogger = ((BaseUnityPlugin)this).Logger;
if (IsDedicated())
{
LogWarn("Mod not loaded because game instance is a dedicated server.");
return;
}
ModEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "ModEnabled", true, "Enable mod when value is true");
Hotkey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("General", "Hotkey", KeyboardShortcut.Deserialize("T"), "Hotkey for opening emote wheel menu");
HotkeyGamepad = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Input", "HotkeyGamepad", KeyboardShortcut.Deserialize("JoystickButton2"), "Hotkey on gamepads for opening emote wheel menu");
ProtectedBindings = ((BaseUnityPlugin)this).Config.Bind<string>("Input", "ProtectedBindings", "JoyTabLeft JoyTabRight JoyButtonA JoyButtonB JoyButtonX JoyButtonY", "Button bindings that should never be overriden");
TriggerOnRelease = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "TriggerOnRelease", true, "Releasing the Hotkey will trigger the selected emote");
TriggerOnClick = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "TriggerOnClick", false, "Click with left mouse button will trigger the selected emote");
ToggleMenu = ((BaseUnityPlugin)this).Config.Bind<bool>("Input", "ToggleMenu", false, "When enabled the emote wheel will toggle between hidden/visible when the hotkey was pressed");
HighlightColor = ((BaseUnityPlugin)this).Config.Bind<Color>("Appereance", "HighlightColor", new Color(1f, 0.82f, 0f), "Color of the highlighted selection");
GuiScale = ((BaseUnityPlugin)this).Config.Bind<float>("Appereance", "GuiScale", 0.75f, "Scale factor of the user interface");
IgnoreJoyStickDuration = ((BaseUnityPlugin)this).Config.Bind<int>("Input", "IgnoreJoyStickDuration", 300, new ConfigDescription("Duration in milliseconds for ignoring left joystick input after button release", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 2000), new object[0]));
if (!ModEnabled.Value)
{
LogWarn("Mod not loaded because it was disabled via config.");
return;
}
HotkeyGamepad.SettingChanged += delegate
{
RestoreGamepadButton();
ReplaceGamepadButton();
};
harmony = Harmony.CreateAndPatchAll(typeof(Patcher), (string)null);
Log("EmoteWheel Loaded!");
}
private void OnDestroy()
{
Harmony obj = harmony;
if (obj != null)
{
obj.UnpatchAll((string)null);
}
}
private static void SetButtonKey(string name, KeyCode keyCode)
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
GetButtonsFromZInput()[name].m_key = keyCode;
}
private static Dictionary<string, ButtonDef> GetButtonsFromZInput()
{
return (Dictionary<string, ButtonDef>)typeof(ZInput).GetField("m_buttons", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(ZInput.instance);
}
public static void ReplaceGamepadButton()
{
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: 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_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: 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_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
if (ZInput.instance == null)
{
return;
}
Dictionary<string, ButtonDef> obj = (Dictionary<string, ButtonDef>)typeof(ZInput).GetField("m_buttons", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(ZInput.instance);
string[] array = ParseTokens(ProtectedBindings.Value);
foreach (KeyValuePair<string, ButtonDef> item in obj)
{
KeyCode key = item.Value.m_key;
if (Array.IndexOf(array, item.Key) <= -1 && (int)key != 0)
{
KeyboardShortcut value = HotkeyGamepad.Value;
if (key == ((KeyboardShortcut)(ref value)).MainKey)
{
replacedButtons.Add(item.Key);
replacedKey = key;
SetButtonKey(item.Key, (KeyCode)0);
}
}
}
}
public static void RestoreGamepadButton()
{
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
if (ZInput.instance == null || replacedButtons.Count <= 0)
{
return;
}
foreach (string replacedButton in replacedButtons)
{
SetButtonKey(replacedButton, replacedKey);
}
replacedButtons.Clear();
replacedKey = (KeyCode)0;
}
public static string[] ParseTokens(string value)
{
char[] separator = new char[5] { ' ', ',', '.', ':', '\t' };
return value.Split(separator, StringSplitOptions.RemoveEmptyEntries);
}
}
public class EmoteGui : MonoBehaviour
{
private EmoteWheelUI ui;
public static AssetBundle assets;
public static bool visible;
public int toggleVisible;
private void Awake()
{
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
LoadAssets();
GameObject obj = assets.LoadAsset<GameObject>("assets/selectionwheel/selectionwheel.prefab");
RectTransform val = ((Component)this).gameObject.AddComponent<RectTransform>();
GameObject val2 = Object.Instantiate<GameObject>(obj, new Vector3(0f, 0f, 0f), ((Component)this).transform.rotation, (Transform)(object)val);
ui = val2.AddComponent<EmoteWheelUI>();
val2.SetActive(false);
visible = false;
assets.Unload(false);
}
private void Start()
{
//IL_000c: 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_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: 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)
RectTransform component = ((Component)this).gameObject.GetComponent<RectTransform>();
component.offsetMin = Vector2.zero;
component.offsetMax = Vector2.zero;
component.anchorMax = new Vector2(1f, 1f);
component.anchorMin = new Vector2(0f, 0f);
component.anchoredPosition = new Vector2(0f, 0f);
if (!((Object)(object)Hud.instance == (Object)null))
{
EmoteWheel.RestoreGamepadButton();
EmoteWheel.ReplaceGamepadButton();
}
}
private void LoadAssets()
{
Stream manifestResourceStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("EmoteWheel.res.selectionwheel");
using MemoryStream memoryStream = new MemoryStream();
manifestResourceStream.CopyTo(memoryStream);
assets = AssetBundle.LoadFromMemory(memoryStream.ToArray());
}
public void Hide()
{
((Component)ui).gameObject.SetActive(false);
visible = false;
toggleVisible = 0;
}
private void Update()
{
if (EmoteWheel.JoyStickIgnoreTime > 0f)
{
EmoteWheel.JoyStickIgnoreTime -= Time.deltaTime;
}
if (!EmoteWheel.CanOpenMenu)
{
Hide();
return;
}
if (EmoteWheel.IsShortcutDown && EmoteWheel.ToggleMenu.Value && toggleVisible < 2)
{
toggleVisible++;
}
bool flag = EmoteWheel.IsShortcutDown && EmoteWheel.ToggleMenu.Value && toggleVisible == 2;
bool flag2 = EmoteWheel.IsShortcutUp && !EmoteWheel.ToggleMenu.Value;
if ((EmoteWheel.ToggleMenu.Value && toggleVisible > 0 && !flag) || (EmoteWheel.IsShortcutPressed && !EmoteWheel.ToggleMenu.Value))
{
((Component)ui).gameObject.SetActive(true);
visible = true;
if (EmoteWheel.TriggerOnClick.Value && (Input.GetMouseButtonDown(0) || Input.GetKeyDown((KeyCode)330)) && ui.CurrentEmote != null)
{
PlayEmote(ui.CurrentEmote);
}
if (!flag)
{
return;
}
}
if (EmoteWheel.TriggerOnRelease.Value && (flag || flag2))
{
if (ui.CurrentEmote != null)
{
PlayEmote(ui.CurrentEmote);
}
EmoteWheel.JoyStickIgnoreTime = (float)EmoteWheel.IgnoreJoyStickDuration.Value / 1000f;
}
Hide();
}
private void PlayEmote(string emote)
{
Player localPlayer = Player.m_localPlayer;
if (!((Character)localPlayer).IsSitting())
{
StopEmote(localPlayer);
}
switch (emote)
{
case "blowkiss":
case "challenge":
case "bow":
case "comehere":
case "nonono":
case "wave":
case "thumbsup":
case "point":
localPlayer.FaceLookDirection();
localPlayer.StartEmote(emote, true);
break;
case "sit":
if (((Character)localPlayer).IsSitting())
{
StopEmote(localPlayer);
}
else
{
localPlayer.StartEmote(emote, false);
}
break;
default:
localPlayer.StartEmote(emote, true);
break;
}
ui.Flash();
}
private void StopEmote(Player player)
{
typeof(Player).GetMethod("StopEmote", BindingFlags.Instance | BindingFlags.NonPublic).Invoke(player, new object[0]);
}
}
public class EmoteWheelUI : MonoBehaviour
{
[Serializable]
private class Emote
{
public string name;
public string command;
}
public readonly float INNER_DIAMETER = 340f;
private readonly Emote[] EMOTES = new Emote[18]
{
new Emote
{
name = "Bow",
command = "bow"
},
new Emote
{
name = "Roar",
command = "roar"
},
new Emote
{
name = "Cower",
command = "cower"
},
new Emote
{
name = "Blow Kiss",
command = "blowkiss"
},
new Emote
{
name = "Challenge",
command = "challenge"
},
new Emote
{
name = "Headbang",
command = "headbang"
},
new Emote
{
name = "Dance",
command = "dance"
},
new Emote
{
name = "Despair",
command = "despair"
},
new Emote
{
name = "Flex",
command = "flex"
},
new Emote
{
name = "Sit",
command = "sit"
},
new Emote
{
name = "Kneel",
command = "kneel"
},
new Emote
{
name = "Point",
command = "point"
},
new Emote
{
name = "Cheer",
command = "cheer"
},
new Emote
{
name = "Come Here",
command = "comehere"
},
new Emote
{
name = "No No No",
command = "nonono"
},
new Emote
{
name = "Thumbs Up",
command = "thumbsup"
},
new Emote
{
name = "Wave",
command = "wave"
},
new Emote
{
name = "Cry",
command = "cry"
}
};
private Font font;
private GameObject cursor;
private GameObject highlight;
private GameObject textPrefab;
private Transform itemsRoot;
private Text[] itemTexts;
private Color NormalColor = new Color(1f, 1f, 1f, 0.5f);
private Color HighlightColor = Color.white;
private int previous = -1;
public int Current
{
get
{
if ((!ZInput.IsGamepadActive() && MouseInCenter) || JoyStickInCenter)
{
return -1;
}
int num = Mod((int)Mathf.Round(Angle / (360f / (float)EMOTES.Length)), EMOTES.Length);
if (num >= EMOTES.Length)
{
return -1;
}
return num;
}
}
public bool JoyStickInCenter
{
get
{
float joyLeftStickX = ZInput.GetJoyLeftStickX(false);
float joyLeftStickY = ZInput.GetJoyLeftStickY(true);
if (ZInput.IsGamepadActive() && joyLeftStickX == 0f)
{
return joyLeftStickY == 0f;
}
return false;
}
}
public string CurrentEmote
{
get
{
if (Current < 0)
{
return null;
}
return EMOTES[Current].command;
}
}
public bool MouseInCenter
{
get
{
//IL_0017: 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_0033: 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_003d: Unknown result type (might be due to invalid IL or missing references)
float num = INNER_DIAMETER / 2f * ((Component)this).gameObject.transform.lossyScale.x;
Vector3 val = Input.mousePosition - cursor.transform.position;
return ((Vector3)(ref val)).magnitude <= num;
}
}
public float Angle
{
get
{
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: 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_005b: Unknown result type (might be due to invalid IL or missing references)
if (ZInput.IsGamepadActive())
{
float joyLeftStickX = ZInput.GetJoyLeftStickX(false);
float num = 0f - ZInput.GetJoyLeftStickY(true);
if (joyLeftStickX != 0f || num != 0f)
{
return Mathf.Atan2(num, joyLeftStickX) * 57.29578f - 90f;
}
}
Vector3 val = Input.mousePosition - cursor.transform.position;
return Mathf.Atan2(val.y, val.x) * 57.29578f - 90f;
}
}
public IEnumerator FlashCoroutine(float aTime)
{
Color color = EmoteWheel.GetHighlightColor;
for (float t = 0f; t < 1f; t += Time.deltaTime / aTime)
{
((Graphic)highlight.GetComponent<Image>()).color = Color.Lerp(Color.white, color, t);
yield return null;
}
}
public GameObject BuildTextPrefab()
{
//IL_0000: 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_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: 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_0047: 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_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Expected O, but got Unknown
GameObject val = new GameObject();
RectTransform val2 = val.AddComponent<RectTransform>();
Text obj = val.AddComponent<Text>();
val2.sizeDelta = new Vector2(200f, 100f);
val2.anchorMax = new Vector2(0.5f, 0.5f);
val2.anchorMin = new Vector2(0.5f, 0.5f);
val2.pivot = new Vector2(0.5f, 0.5f);
val2.anchoredPosition = Vector2.op_Implicit(new Vector3(0f, 300f, 0f));
obj.fontSize = 28;
((Graphic)obj).color = Color.white;
obj.font = font;
obj.fontStyle = (FontStyle)1;
obj.alignByGeometry = true;
obj.alignment = (TextAnchor)4;
val.SetActive(false);
return val;
}
private int Mod(int a, int b)
{
return (a % b + b) % b;
}
public void Flash()
{
((MonoBehaviour)this).StartCoroutine(FlashCoroutine(0.4f));
}
private void Awake()
{
//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
//IL_0127: Unknown result type (might be due to invalid IL or missing references)
//IL_012c: Unknown result type (might be due to invalid IL or missing references)
//IL_016f: Unknown result type (might be due to invalid IL or missing references)
Font[] array = Resources.FindObjectsOfTypeAll<Font>();
foreach (Font val in array)
{
if (((Object)val).name == "AveriaSerifLibre-Bold")
{
font = val;
break;
}
}
cursor = ((Component)((Component)this).transform.Find("Cursor")).gameObject;
highlight = ((Component)((Component)this).transform.Find("Highlight")).gameObject;
((Graphic)highlight.GetComponent<Image>()).material.SetFloat("_Degree", 360f / (float)EMOTES.Length);
textPrefab = BuildTextPrefab();
itemsRoot = ((Component)this).transform.Find("Items");
itemTexts = (Text[])(object)new Text[EMOTES.Length];
for (int j = 0; j < EMOTES.Length; j++)
{
GameObject val2 = Object.Instantiate<GameObject>(textPrefab);
val2.transform.SetParent(itemsRoot);
val2.transform.RotateAround(((Component)this).transform.position, Vector3.forward, (float)j * (360f / (float)EMOTES.Length));
val2.transform.localRotation = Quaternion.AngleAxis(0f, Vector3.forward);
val2.GetComponent<Text>().text = EMOTES[j].name;
val2.SetActive(true);
itemTexts[j] = val2.GetComponent<Text>();
((Graphic)itemTexts[j]).color = NormalColor;
}
}
private void OnEnable()
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
((Graphic)highlight.GetComponent<Image>()).color = EmoteWheel.GetHighlightColor;
float value = EmoteWheel.GuiScale.Value;
((Transform)((Component)this).GetComponent<RectTransform>()).localScale = new Vector3(value, value, value);
Update();
}
private void OnDisable()
{
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
highlight.SetActive(false);
Image[] componentsInChildren = cursor.GetComponentsInChildren<Image>(true);
foreach (Image val in componentsInChildren)
{
((Graphic)val).color = new Color(0f, 0f, 0f, 0.5f);
if (((Object)((Component)val).gameObject).name == "Image")
{
((Component)val).gameObject.SetActive(false);
}
}
}
private void Update()
{
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_0121: Unknown result type (might be due to invalid IL or missing references)
//IL_0126: Unknown result type (might be due to invalid IL or missing references)
//IL_0154: Unknown result type (might be due to invalid IL or missing references)
//IL_0159: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: 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_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
if (Current != previous)
{
if (previous > -1)
{
((Graphic)itemTexts[previous]).color = NormalColor;
}
if (Current > -1)
{
((Graphic)itemTexts[Current]).color = HighlightColor;
InventoryGui.instance.m_moveItemEffects.Create(((Component)this).transform.position, Quaternion.identity, (Transform)null, 1f, -1);
}
previous = Current;
}
highlight.SetActive(Current > -1);
Image[] componentsInChildren = cursor.GetComponentsInChildren<Image>(true);
foreach (Image val in componentsInChildren)
{
((Graphic)val).color = (Color)((Current < 0) ? new Color(0f, 0f, 0f, 0.5f) : EmoteWheel.GetHighlightColor);
if (((Object)((Component)val).gameObject).name == "Image")
{
((Component)val).gameObject.SetActive(Current > -1);
}
}
cursor.transform.rotation = Quaternion.AngleAxis(Angle, Vector3.forward);
float num = (float)Current * (360f / (float)EMOTES.Length);
highlight.transform.rotation = Quaternion.AngleAxis(num, Vector3.forward);
}
}
public class Patcher
{
public static readonly KeyCode[] NUMBERS;
[HarmonyPatch(typeof(InventoryGui), "IsVisible")]
[HarmonyPostfix]
public static void IsVisible_Postfix(ref bool __result)
{
EmoteWheel.inventoryVisible = __result;
__result = __result || EmoteGui.visible;
}
[HarmonyPatch(typeof(ZInput), "GetJoyLeftStickX")]
[HarmonyPostfix]
public static void GetJoyLeftStickX_Postfix(ref float __result)
{
if (EmoteWheel.JoyStickIgnoreTime > 0f)
{
__result = 0f;
}
}
[HarmonyPatch(typeof(ZInput), "GetJoyLeftStickY")]
[HarmonyPostfix]
public static void GetJoyLeftStickY_Postfix(ref float __result)
{
if (EmoteWheel.JoyStickIgnoreTime > 0f)
{
__result = 0f;
}
}
[HarmonyPatch(typeof(Player), "Awake")]
[HarmonyPostfix]
public static void Awake_Postfix()
{
//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)
string text = "EquipGui (" + Assembly.GetExecutingAssembly().GetName().Name + ")";
if (!((Object)(object)Menu.instance == (Object)null) && !Object.op_Implicit((Object)(object)GameObject.Find(text)))
{
GameObject val = new GameObject(text);
val.AddComponent<EmoteGui>();
val.transform.SetParent(((Component)Menu.instance).transform.parent, false);
EmoteWheel.Log("Spawned EquipGui!");
}
}
[HarmonyPatch(typeof(Player), "UseHotbarItem")]
[HarmonyPrefix]
public static bool UseHotbarItem(int index)
{
//IL_000a: 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_0012: Unknown result type (might be due to invalid IL or missing references)
KeyCode[] nUMBERS = NUMBERS;
KeyboardShortcut value = EmoteWheel.Hotkey.Value;
bool num = Array.IndexOf(nUMBERS, ((KeyboardShortcut)(ref value)).MainKey) != index - 1;
bool flag = !EmoteWheel.IsShortcutDown;
if (!(num || flag) && EmoteWheel.CanOpenMenu)
{
return ZInput.IsGamepadActive();
}
return true;
}
static Patcher()
{
KeyCode[] array = new KeyCode[8];
RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
NUMBERS = (KeyCode[])(object)array;
}
}