Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of Eternal v3.29.0
Eternal.dll
Decompiled a day ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.Rendering; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyCompany("Eternal")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("Eternal")] [assembly: AssemblyTitle("Eternal")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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 EndlessDungeons { internal static class BossRewards { private const string Key = "ed_nodrop"; private static HashSet<string> _banned; private static string _bannedSrc; private static HashSet<string> Banned() { string value = EndlessDungeonsPlugin.NoDropItems.Value; if (_banned != null && value == _bannedSrc) { return _banned; } _bannedSrc = value; _banned = new HashSet<string>(from x in value.Split(new char[1] { ',' }, StringSplitOptions.RemoveEmptyEntries) select x.Trim() into x where x.Length > 0 select x, StringComparer.OrdinalIgnoreCase); return _banned; } public static void Apply(Character ch) { if (!((Object)(object)ch == (Object)null) && EndlessDungeonsPlugin.NoProgressionDrops.Value) { ZNetView component = ((Component)ch).GetComponent<ZNetView>(); if ((Object)(object)component != (Object)null && component.IsValid()) { component.GetZDO().Set("ed_nodrop", true); } ClearBossKey(ch); } } private static void ClearBossKey(Character ch) { if (EndlessDungeonsPlugin.BlockBossKeys.Value && !string.IsNullOrEmpty(ch.m_defeatSetGlobalKey)) { ch.m_defeatSetGlobalKey = ""; } } private static bool Flagged(Component c) { ZNetView val = (((Object)(object)c != (Object)null) ? c.GetComponent<ZNetView>() : null); if ((Object)(object)val != (Object)null && val.IsValid()) { return val.GetZDO().GetBool("ed_nodrop", false); } return false; } public static void AwakePostfix(Character __instance) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)__instance == (Object)null || !EndlessPortal.IsSite(((Component)__instance).transform.position)) { return; } try { if (EndlessDungeonsPlugin.NoProgressionDrops.Value && Flagged((Component)(object)__instance)) { ClearBossKey(__instance); } } catch (Exception ex) { EndlessDungeonsPlugin.Log.LogWarning((object)("Boss key reapply failed: " + ex.Message)); } } public static void DropsPostfix(CharacterDrop __instance, ref List<KeyValuePair<GameObject, int>> __result) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) try { if (__result != null && !((Object)(object)__instance == (Object)null) && EndlessPortal.IsSite(((Component)__instance).transform.position) && EndlessDungeonsPlugin.NoProgressionDrops.Value && Flagged((Component)(object)__instance)) { HashSet<string> banned = Banned(); __result.RemoveAll((KeyValuePair<GameObject, int> kv) => (Object)(object)kv.Key != (Object)null && banned.Contains(Utils.GetPrefabName(kv.Key))); } } catch (Exception ex) { EndlessDungeonsPlugin.Log.LogWarning((object)("Boss drop filter failed: " + ex.Message)); } } } internal static class ButtonSkin { private sealed class Orig { public Image Img; public Sprite Sprite; public Type Type; public Color Color; public Material Material; public Transition Transition; public ColorBlock Colors; public SpriteState Sprites; public Graphic Target; public List<Image> Hidden; public GameObject Added; public Mask AddedMask; public GameObject Frame; public List<Object> Extra = new List<Object>(); public List<KeyValuePair<Graphic, Color>> Texts = new List<KeyValuePair<Graphic, Color>>(); } private struct First { public Sprite Sprite; public Type Type; public Color Color; public Material Material; } [DefaultExecutionOrder(32000)] internal sealed class SkinHover : MonoBehaviour, IPointerEnterHandler, IEventSystemHandler, IPointerExitHandler { public Outline Border; public Image Ring; public Graphic[] Labels; public Color[] LabelIdle; private static readonly Color RingIdle = new Color(0.78f, 0.9f, 1f, 1f); private static readonly Color RingLit = new Color(0.55f, 0.85f, 1.2f, 1f); private bool _over; private float _t = -1f; private float _check; private bool _contested; public void OnPointerEnter(PointerEventData e) { _over = true; } public void OnPointerExit(PointerEventData e) { _over = false; } private void OnEnable() { _t = -1f; } private void OnDisable() { _over = false; _t = 0f; Paint(); } private void LateUpdate() { //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) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: 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_0069: 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_0071: 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) if (!_contested || Labels == null) { return; } float num = Mathf.Max(0f, _t); for (int i = 0; i < Labels.Length; i++) { Graphic val = Labels[i]; if (!((Object)(object)val == (Object)null)) { Color labelLit = LabelLit; labelLit.a = LabelIdle[i].a; Color val2 = Color.Lerp(LabelIdle[i], labelLit, num); if (val.color != val2) { val.color = val2; } Plain(val); } } } private void Update() { //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) float num = (_over ? 1f : 0f); if (_t >= 0f && Mathf.Approximately(_t, num)) { if (Time.unscaledTime < _check) { return; } _check = Time.unscaledTime + 0.2f; if (Labels == null) { return; } for (int i = 0; i < Labels.Length; i++) { Graphic val = Labels[i]; if (!((Object)(object)val == (Object)null)) { Color val2 = LabelIdle[i]; if (_t > 0.5f) { val2 = LabelLit; val2.a = LabelIdle[i].a; } if (val.color != val2) { val.color = val2; _contested = true; } Plain(val); } } } else { _t = Mathf.MoveTowards(Mathf.Max(0f, _t), num, Time.unscaledDeltaTime * 8f); Paint(); } } private void Paint() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: 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_0059: 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_007d: 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_0088: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Max(0f, _t); if ((Object)(object)Border != (Object)null) { ((Shadow)Border).effectColor = Color.Lerp(VikingStyle.BorderIdle, VikingStyle.BorderLit, num); ((Shadow)Border).effectDistance = Vector2.Lerp(new Vector2(1.5f, -1.5f), new Vector2(3.5f, -3.5f), num); } if ((Object)(object)Ring != (Object)null) { ((Graphic)Ring).color = Color.Lerp(RingIdle, RingLit, num); } if (Labels == null) { return; } for (int i = 0; i < Labels.Length; i++) { if ((Object)(object)Labels[i] != (Object)null) { Color labelLit = LabelLit; labelLit.a = LabelIdle[i].a; Labels[i].color = Color.Lerp(LabelIdle[i], labelLit, num); } } } } internal static ConfigEntry<string> Style; internal static ConfigEntry<bool> Border; private static readonly Dictionary<Selectable, Orig> _done = new Dictionary<Selectable, Orig>(); private static readonly HashSet<Image> _imgs = new HashSet<Image>(); private static readonly Dictionary<Image, First> _first = new Dictionary<Image, First>(); private static readonly Regex TabName = new Regex("armor|armour|weight|purse|trash|delete|coin|gold", RegexOptions.IgnoreCase); internal static readonly Color LabelIdle = VikingStyle.TextCol; internal static readonly Color LabelLit = new Color(0.72f, 0.92f, 1f); private static readonly Dictionary<string, Sprite> _frames = new Dictionary<string, Sprite>(); internal static bool On { get { if (Style != null) { return !string.Equals(Style.Value, "Game", StringComparison.OrdinalIgnoreCase); } return true; } } private static bool Ours(Sprite s) { if ((Object)(object)s != (Object)null) { if (!Skins.IsOne(s)) { return ((Object)s).name.StartsWith("ED_frame_", StringComparison.Ordinal); } return true; } return false; } internal static Sprite Picture() { if (!On) { return null; } return Skins.Get((Style != null) ? Style.Value : "Game", button: true); } private static bool IsInventoryTab(Selectable sel) { InventoryGui instance = InventoryGui.instance; if ((Object)(object)instance == (Object)null || !((Component)sel).transform.IsChildOf(((Component)instance).transform)) { return false; } if ((Object)(object)instance.m_container != (Object)null && ((Component)sel).transform.IsChildOf((Transform)(object)instance.m_container)) { return false; } Transform val = ((Component)sel).transform; while ((Object)(object)val != (Object)null && (Object)(object)val != (Object)(object)((Component)instance).transform) { if (TabName.IsMatch(((Object)val).name)) { return true; } val = val.parent; } return false; } internal static Sprite FirstSprite(Image img) { if ((Object)(object)img == (Object)null) { return null; } if (_first.TryGetValue(img, out var value)) { return value.Sprite; } if (!Ours(img.sprite)) { return img.sprite; } return null; } private static First FirstLook(Image img) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0036: 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) if (_first.TryGetValue(img, out var value)) { return value; } value = new First { Sprite = img.sprite, Type = img.type, Color = ((Graphic)img).color, Material = ((Graphic)img).material }; if (!Ours(img.sprite)) { _first[img] = value; } return value; } public static void Init(ConfigFile cfg) { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Expected O, but got Unknown //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Expected O, but got Unknown Skins.Renumber(cfg, "Menu", "ButtonSkin", "Button-skin ", "Game"); Style = cfg.Bind<string>("Menu", "ButtonSkin", Skins.ButtonNames()[0], new ConfigDescription("What the buttons in the windows that pop up wear (the inventory, the pause menu and its windows, the game's settings, the start screen's windows, the mod's windows; not the main menu): Metal (scratched steel), or Game (their own look). Also in Window settings.", (AcceptableValueBase)(object)new AcceptableValueList<string>(Skins.ButtonNames()), Array.Empty<object>())); try { IDictionary dictionary = Traverse.Create((object)cfg).Property("OrphanedEntries", (object[])null).GetValue() as IDictionary; ConfigDefinition key = new ConfigDefinition("Menu", "GunmetalButtons"); if (dictionary != null && dictionary.Contains(key)) { if (string.Equals(dictionary[key] as string, "false", StringComparison.OrdinalIgnoreCase)) { Style.Value = "Game"; } dictionary.Remove(key); cfg.Save(); } } catch { } Border = cfg.Bind<bool>("Menu", "ButtonBorder", true, "A thin border around skinned buttons, tick circles and text boxes, in the colours of the button skin. Also in Window settings."); Border.SettingChanged += delegate { RestoreAll(); }; Style.SettingChanged += delegate { RestoreAll(); InventoryLook.RefreshSoon(); }; } internal static void Skin(Transform root, Transform skip = null, Transform leave = null) { //IL_0190: 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_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_0305: Unknown result type (might be due to invalid IL or missing references) //IL_030a: 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_0317: Unknown result type (might be due to invalid IL or missing references) //IL_032b: Unknown result type (might be due to invalid IL or missing references) //IL_0330: Unknown result type (might be due to invalid IL or missing references) //IL_0337: Unknown result type (might be due to invalid IL or missing references) //IL_033c: Unknown result type (might be due to invalid IL or missing references) //IL_0343: Unknown result type (might be due to invalid IL or missing references) //IL_0348: Unknown result type (might be due to invalid IL or missing references) //IL_029a: Unknown result type (might be due to invalid IL or missing references) //IL_029f: Unknown result type (might be due to invalid IL or missing references) //IL_02a6: Unknown result type (might be due to invalid IL or missing references) //IL_02ab: Unknown result type (might be due to invalid IL or missing references) //IL_02b2: Unknown result type (might be due to invalid IL or missing references) //IL_02b7: Unknown result type (might be due to invalid IL or missing references) //IL_0379: Unknown result type (might be due to invalid IL or missing references) //IL_03e2: Unknown result type (might be due to invalid IL or missing references) //IL_03e9: Expected O, but got Unknown //IL_0410: Unknown result type (might be due to invalid IL or missing references) //IL_0415: Unknown result type (might be due to invalid IL or missing references) //IL_0416: Unknown result type (might be due to invalid IL or missing references) //IL_0420: Unknown result type (might be due to invalid IL or missing references) //IL_0421: Unknown result type (might be due to invalid IL or missing references) //IL_042b: Unknown result type (might be due to invalid IL or missing references) //IL_042c: Unknown result type (might be due to invalid IL or missing references) //IL_0431: Unknown result type (might be due to invalid IL or missing references) //IL_0432: Unknown result type (might be due to invalid IL or missing references) //IL_0439: Unknown result type (might be due to invalid IL or missing references) //IL_0463: Unknown result type (might be due to invalid IL or missing references) //IL_0623: Unknown result type (might be due to invalid IL or missing references) //IL_066e: Unknown result type (might be due to invalid IL or missing references) //IL_0673: Unknown result type (might be due to invalid IL or missing references) //IL_068b: Unknown result type (might be due to invalid IL or missing references) //IL_06ab: Unknown result type (might be due to invalid IL or missing references) //IL_06b9: Unknown result type (might be due to invalid IL or missing references) //IL_06d9: Unknown result type (might be due to invalid IL or missing references) //IL_06f9: Unknown result type (might be due to invalid IL or missing references) //IL_071c: Unknown result type (might be due to invalid IL or missing references) //IL_0731: Unknown result type (might be due to invalid IL or missing references) //IL_051d: Unknown result type (might be due to invalid IL or missing references) //IL_0588: Unknown result type (might be due to invalid IL or missing references) //IL_058d: Unknown result type (might be due to invalid IL or missing references) //IL_05a0: Unknown result type (might be due to invalid IL or missing references) //IL_05a5: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)root == (Object)null || !On) { return; } Sprite val = Skins.Get((Style != null) ? Style.Value : "Game", button: true); if ((Object)(object)val == (Object)null) { return; } Selectable[] componentsInChildren = ((Component)root).GetComponentsInChildren<Selectable>(false); foreach (Selectable val2 in componentsInChildren) { if ((Object)(object)val2 == (Object)null || _done.ContainsKey(val2) || (!(val2 is Button) && !(val2 is Toggle) && !IsInput(val2)) || ((Object)(object)skip != (Object)null && val2 is Button && ((Component)val2).transform.IsChildOf(skip)) || ((Object)(object)leave != (Object)null && ((Component)val2).transform.IsChildOf(leave)) || ((Object)val2).name.IndexOf("Swatch", StringComparison.OrdinalIgnoreCase) >= 0 || (Object)(object)((Component)val2).GetComponent<TabLook>() != (Object)null || IsInventoryTab(val2) || (Object)(object)((Component)val2).GetComponentInParent<InventoryGrid>() != (Object)null) { continue; } Graphic targetGraphic = val2.targetGraphic; Image val3 = (Image)(((object)((targetGraphic is Image) ? targetGraphic : null)) ?? ((object)((Component)val2).GetComponent<Image>())); if ((Object)(object)val3 == (Object)null) { continue; } Toggle val4 = (Toggle)(object)((val2 is Toggle) ? val2 : null); if ((val4 != null && (Object)(object)val3 == (Object)(object)val4.graphic) || ((Object)val3).name.IndexOf("icon", StringComparison.OrdinalIgnoreCase) >= 0 || (val2 is Button && IconOnly(val2, val3)) || (val2 is Button && SquareWithoutLabel(val2, val3))) { continue; } Rect rect = ((Graphic)val3).rectTransform.rect; bool flag = val2 is Toggle; if (((Rect)(ref rect)).width < (flag ? 8f : 18f) || ((Rect)(ref rect)).height < (flag ? 8f : 14f) || ((Graphic)val3).color.a < 0.05f || !((Behaviour)val3).enabled) { continue; } Vector3[] array = (Vector3[])(object)new Vector3[4]; ((Graphic)val3).rectTransform.GetWorldCorners(array); float num = Mathf.Abs(array[2].x - array[0].x); float num2 = Mathf.Abs(array[2].y - array[0].y); if (num > (float)Screen.width * 0.35f || num2 > (float)Screen.height * 0.35f) { continue; } if (_imgs.Contains(val3)) { _done[val2] = new Orig { Img = null, Transition = val2.transition, Colors = val2.colors, Sprites = val2.spriteState, Target = val2.targetGraphic }; continue; } _imgs.Add(val3); First first = FirstLook(val3); Orig orig = new Orig { Img = val3, Sprite = first.Sprite, Type = first.Type, Color = first.Color, Material = first.Material, Transition = val2.transition, Colors = val2.colors, Sprites = val2.spriteState, Target = val2.targetGraphic }; _done[val2] = orig; Graphic val5 = (Graphic)(object)val3; if (val2 is Toggle) { ((Graphic)val3).color = Color.white; ((Graphic)val3).material = null; Mask val6 = ((Component)val3).GetComponent<Mask>(); if ((Object)(object)val6 == (Object)null) { val6 = (orig.AddedMask = ((Component)val3).gameObject.AddComponent<Mask>()); } val6.showMaskGraphic = false; GameObject val7 = new GameObject("ED_skin", new Type[2] { typeof(RectTransform), typeof(Image) }); val7.transform.SetParent(((Component)val3).transform, false); val7.transform.SetAsFirstSibling(); RectTransform val8 = (RectTransform)val7.transform; val8.anchorMin = Vector2.zero; val8.anchorMax = Vector2.one; Vector2 offsetMin = (val8.offsetMax = Vector2.zero); val8.offsetMin = offsetMin; Image component = val7.GetComponent<Image>(); component.sprite = val; component.type = (Type)0; ((Graphic)component).raycastTarget = false; ((Graphic)component).color = Color.white; orig.Added = val7; if (Border == null || Border.Value) { orig.Frame = AddFrame(((Component)val3).transform, FrameSprite(val, ring: true), (Type)0, 1); } val5 = (Graphic)(object)component; val2.targetGraphic = (Graphic)(object)component; } else { Graphic val9 = ((Toggle)(((val2 is Toggle) ? val2 : null)?)).graphic; Image[] componentsInChildren2 = ((Component)val2).GetComponentsInChildren<Image>(false); foreach (Image val10 in componentsInChildren2) { if (!((Object)(object)val10 == (Object)null) && !((Object)(object)val10 == (Object)(object)val3) && !((Object)(object)val10 == (Object)(object)val9) && ((Behaviour)val10).enabled && !(((Graphic)val10).color.a < 0.05f) && ((Object)val10).name.IndexOf("icon", StringComparison.OrdinalIgnoreCase) < 0 && !((Object)(object)((Component)val10).GetComponentInParent<Scrollbar>() != (Object)null) && !Regex.IsMatch(((Object)val10).name, "select|highlight|focus|hover|chosen|active", RegexOptions.IgnoreCase) && !((Object)(object)val10.sprite == (Object)null) && !(val10.sprite.border == Vector4.zero)) { Rect rect2 = ((Graphic)val10).rectTransform.rect; if (!(((Rect)(ref rect2)).width * ((Rect)(ref rect2)).height < ((Rect)(ref rect)).width * ((Rect)(ref rect)).height * 0.5f)) { ((Behaviour)val10).enabled = false; (orig.Hidden ?? (orig.Hidden = new List<Image>())).Add(val10); } } } val3.sprite = val; val3.type = (Type)0; ((Graphic)val3).material = null; ((Graphic)val3).color = Color.white; if (Border == null || Border.Value) { orig.Frame = AddFrame(((Component)val3).transform, FrameSprite(val, ring: false), (Type)1, -1); } } Dress(val2, val3, orig); val2.transition = (Transition)1; ColorBlock colors = val2.colors; ((ColorBlock)(ref colors)).normalColor = new Color(0.9f, 0.9f, 0.92f, 1f); ((ColorBlock)(ref colors)).highlightedColor = new Color(1.25f, 1.2f, 1.1f, 1f); ((ColorBlock)(ref colors)).selectedColor = ((ColorBlock)(ref colors)).normalColor; ((ColorBlock)(ref colors)).pressedColor = new Color(0.65f, 0.65f, 0.68f, 1f); ((ColorBlock)(ref colors)).disabledColor = new Color(0.5f, 0.5f, 0.52f, 1f); ((ColorBlock)(ref colors)).colorMultiplier = 1f; ((ColorBlock)(ref colors)).fadeDuration = 0.08f; val2.colors = colors; if ((Object)(object)val5 != (Object)null) { val5.CrossFadeColor(((ColorBlock)(ref colors)).normalColor, 0f, true, true); } } } private static bool IconOnly(Selectable sel, Image img) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: 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_00b8: Unknown result type (might be due to invalid IL or missing references) Rect rect = ((Graphic)img).rectTransform.rect; if ((Object)(object)img.sprite != (Object)null && img.sprite.border == Vector4.zero && ((Rect)(ref rect)).height > 0f) { float num = ((Rect)(ref rect)).width / ((Rect)(ref rect)).height; if (num > 0.7f && num < 1.45f) { return true; } } Graphic[] componentsInChildren = ((Component)sel).GetComponentsInChildren<Graphic>(true); foreach (Graphic val in componentsInChildren) { if (!((Object)(object)val == (Object)null) && !((Object)(object)val == (Object)(object)img)) { if (IsText(val)) { return false; } Image val2 = (Image)(object)((val is Image) ? val : null); if (val2 != null && ((Behaviour)val2).enabled && (Object)(object)val2.sprite != (Object)null && ((Graphic)val2).color.a > 0.05f) { return false; } } } return true; } private static bool IsInput(Selectable sel) { if (!(sel is InputField) && ((object)sel).GetType().Name.IndexOf("InputField", StringComparison.Ordinal) < 0) { if (((object)sel).GetType().BaseType != null) { return ((object)sel).GetType().BaseType.Name.IndexOf("InputField", StringComparison.Ordinal) >= 0; } return false; } return true; } private static Graphic Placeholder(Selectable sel) { InputField val = (InputField)(object)((sel is InputField) ? sel : null); if (val != null) { return val.placeholder; } try { object? obj = ((object)sel).GetType().GetProperty("placeholder")?.GetValue(sel, null); return (Graphic)((obj is Graphic) ? obj : null); } catch { return null; } } internal static void Plain(Graphic g) { //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)g == (Object)null || g is Text) { return; } try { Type type = ((object)g).GetType(); PropertyInfo property = type.GetProperty("enableVertexGradient"); bool flag = default(bool); int num; if (property != null) { object value = property.GetValue(g, null); if (value is bool) { flag = (bool)value; num = 1; } else { num = 0; } } else { num = 0; } if (((uint)num & (flag ? 1u : 0u)) != 0) { property.SetValue(g, false, null); } PropertyInfo property2 = type.GetProperty("overrideColorTags"); if (property2 != null) { object value = property2.GetValue(g, null); if (value is bool && !(bool)value) { property2.SetValue(g, true, null); } } PropertyInfo property3 = type.GetProperty("faceColor"); if (property3 != null && property3.GetValue(g, null) is Color32 val && (val.r != byte.MaxValue || val.g != byte.MaxValue || val.b != byte.MaxValue)) { property3.SetValue(g, (object)new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, val.a), null); } } catch { } } private static bool SquareWithoutLabel(Selectable sel, Image img) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) Rect rect = ((Graphic)img).rectTransform.rect; if (((Rect)(ref rect)).height <= 0f) { return false; } float num = ((Rect)(ref rect)).width / ((Rect)(ref rect)).height; if (num < 0.7f || num > 1.45f) { return false; } Graphic[] componentsInChildren = ((Component)sel).GetComponentsInChildren<Graphic>(false); foreach (Graphic val in componentsInChildren) { if ((Object)(object)val == (Object)null || !IsText(val) || !((Behaviour)val).enabled || val.color.a < 0.1f) { continue; } Text val2 = (Text)(object)((val is Text) ? val : null); string text = ((val2 != null) ? val2.text : null); if (text == null) { try { text = ((object)val).GetType().GetProperty("text")?.GetValue(val, null) as string; } catch { } } if (!string.IsNullOrWhiteSpace(text)) { return false; } } return true; } private static bool IsText(Graphic g) { if (!(g is Text)) { return ((object)g).GetType().Name.IndexOf("TextMeshPro", StringComparison.Ordinal) >= 0; } return true; } private static void Dress(Selectable sel, Image img, Orig o) { //IL_0063: 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) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)((Component)sel).GetComponent<RuneHover>() != (Object)null) { return; } SkinHover skinHover = ((Component)sel).gameObject.AddComponent<SkinHover>(); o.Extra.Add((Object)(object)skinHover); if (sel is Toggle) { skinHover.Ring = (((Object)(object)o.Frame != (Object)null) ? o.Frame.GetComponent<Image>() : null); } else { Outline val = ((Component)img).gameObject.AddComponent<Outline>(); ((Shadow)val).effectColor = VikingStyle.BorderIdle; ((Shadow)val).effectDistance = new Vector2(1.5f, -1.5f); ((Shadow)val).useGraphicAlpha = false; o.Extra.Add((Object)(object)val); skinHover.Border = val; Rect rect = ((Graphic)img).rectTransform.rect; if (((Rect)(ref rect)).height >= 20f) { List<GameObject> list = new List<GameObject>(); VikingStyle.Lines(((Component)img).transform, (Border == null || Border.Value) ? 6f : 3f, new Color(0.35f, 0.6f, 1f, 0.3f), 1f, list); foreach (GameObject item in list) { Image component = item.GetComponent<Image>(); if ((Object)(object)component != (Object)null) { ((Graphic)component).raycastTarget = false; } o.Extra.Add((Object)(object)item); } } } List<Graphic> list2 = new List<Graphic>(); List<Color> list3 = new List<Color>(); Graphic[] componentsInChildren = ((Component)sel).GetComponentsInChildren<Graphic>(true); foreach (Graphic val2 in componentsInChildren) { if (!((Object)(object)val2 == (Object)null) && IsText(val2)) { o.Texts.Add(new KeyValuePair<Graphic, Color>(val2, val2.color)); bool flag = (Object)(object)Placeholder(sel) == (Object)(object)val2; Color labelIdle = LabelIdle; labelIdle.a = (flag ? 0.55f : val2.color.a); val2.color = labelIdle; Plain(val2); list2.Add(val2); list3.Add(labelIdle); if (val2 is Text && (Object)(object)((Component)val2).GetComponent<Shadow>() == (Object)null) { Shadow val3 = ((Component)val2).gameObject.AddComponent<Shadow>(); val3.effectColor = new Color(0f, 0f, 0f, 0.8f); o.Extra.Add((Object)(object)val3); } } } skinHover.Labels = list2.ToArray(); skinHover.LabelIdle = list3.ToArray(); } private static GameObject AddFrame(Transform parent, Sprite sp, Type type, int sibling) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0073: 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) //IL_0079: 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_0084: 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_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Invalid comparison between Unknown and I4 if ((Object)(object)sp == (Object)null) { return null; } GameObject val = new GameObject("ED_frame", new Type[2] { typeof(RectTransform), typeof(Image) }); val.transform.SetParent(parent, false); if (sibling < 0) { val.transform.SetAsLastSibling(); } else { val.transform.SetSiblingIndex(Mathf.Min(sibling, parent.childCount - 1)); } RectTransform val2 = (RectTransform)val.transform; val2.anchorMin = Vector2.zero; val2.anchorMax = Vector2.one; Vector2 offsetMin = (val2.offsetMax = Vector2.zero); val2.offsetMin = offsetMin; Image component = val.GetComponent<Image>(); component.sprite = sp; component.type = type; ((Graphic)component).raycastTarget = false; ((Graphic)component).color = Color.white; if ((int)type == 1) { component.fillCenter = false; } return val; } private static Color Average(Sprite pic) { //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: 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_004c: 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_005a: 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_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) try { Texture2D texture = pic.texture; Color32[] pixels = texture.GetPixels32(Mathf.Min(4, ((Texture)texture).mipmapCount - 1)); double num = 0.0; double num2 = 0.0; double num3 = 0.0; Color32[] array = pixels; foreach (Color32 val in array) { num += (double)(int)val.r; num2 += (double)(int)val.g; num3 += (double)(int)val.b; } int num4 = Mathf.Max(1, pixels.Length); return new Color((float)(num / (double)num4 / 255.0), (float)(num2 / (double)num4 / 255.0), (float)(num3 / (double)num4 / 255.0), 1f); } catch { return new Color(0.55f, 0.55f, 0.57f, 1f); } } private static Sprite FrameSprite(Sprite pic, bool ring) { //IL_0036: 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) //IL_003c: 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_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0063: 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_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_021f: Expected O, but got Unknown //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Expected O, but got Unknown //IL_0347: Unknown result type (might be due to invalid IL or missing references) //IL_0356: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_026c: Unknown result type (might be due to invalid IL or missing references) //IL_026e: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_027b: Unknown result type (might be due to invalid IL or missing references) //IL_027c: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0305: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_02b0: Unknown result type (might be due to invalid IL or missing references) //IL_02b2: Unknown result type (might be due to invalid IL or missing references) //IL_02a2: Unknown result type (might be due to invalid IL or missing references) //IL_0293: Unknown result type (might be due to invalid IL or missing references) //IL_0294: Unknown result type (might be due to invalid IL or missing references) //IL_029b: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_02dc: Unknown result type (might be due to invalid IL or missing references) //IL_02de: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0175: 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) string text = ((Object)pic).name + (ring ? "_ring" : "_box"); if (_frames.TryGetValue(text, out var value) && (Object)(object)value != (Object)null) { return value; } Color val = Average(pic); Color val2 = Color.Lerp(val, Color.black, 0.8f); val2.a = 1f; Color val3 = Color.Lerp(val, Color.white, 0.55f); val3.a = 1f; Color val4 = Color.Lerp(val, Color.black, 0.35f); val4.a = 1f; Color val5 = default(Color); ((Color)(ref val5))..ctor(0f, 0f, 0f, 0f); Sprite val8; if (!ring) { Texture2D val6 = new Texture2D(16, 16, (TextureFormat)4, false) { filterMode = (FilterMode)0, wrapMode = (TextureWrapMode)1 }; for (int i = 0; i < 16; i++) { for (int j = 0; j < 16; j++) { int num = Mathf.Min(Mathf.Min(j, i), Mathf.Min(15 - j, 15 - i)); Color val7 = (Color)((num <= 1) ? val2 : (num switch { 4 => new Color(0f, 0f, 0f, 0.35f), 3 => val4, 2 => val3, _ => val5, })); if (num == 2 && ((i < 8 && i <= j && i <= 15 - j) || (j > 8 && 15 - j <= i && 15 - j <= 15 - i))) { val7 = Color.Lerp(val3, val4, 0.5f); } val6.SetPixel(j, i, val7); } } val6.Apply(); val8 = Sprite.Create(val6, new Rect(0f, 0f, 16f, 16f), new Vector2(0.5f, 0.5f), 100f, 0u, (SpriteMeshType)0, new Vector4(5f, 5f, 5f, 5f)); } else { Texture2D val9 = new Texture2D(64, 64, (TextureFormat)4, false) { filterMode = (FilterMode)1, wrapMode = (TextureWrapMode)1 }; Color val10 = default(Color); for (int k = 0; k < 64; k++) { for (int l = 0; l < 64; l++) { float num2 = 31.5f - Mathf.Sqrt(((float)l - 31.5f) * ((float)l - 31.5f) + ((float)k - 31.5f) * ((float)k - 31.5f)); if (num2 < 0f) { val10 = val5; } else if (num2 < 4f) { val10 = val2; } else if (num2 < 7f) { val10 = (((float)k > 31.5f) ? val3 : Color.Lerp(val3, val4, 0.5f)); } else if (num2 < 9f) { val10 = val4; } else if (num2 < 11f) { ((Color)(ref val10))..ctor(0f, 0f, 0f, 0.25f); } else { val10 = val5; } if (num2 >= 0f && num2 < 1f) { val10.a *= num2; } val9.SetPixel(l, k, val10); } } val9.Apply(); val8 = Sprite.Create(val9, new Rect(0f, 0f, 64f, 64f), new Vector2(0.5f, 0.5f), 100f); } ((Object)val8).name = "ED_frame_" + text; _frames[text] = val8; return val8; } private static void RestoreAll() { //IL_033b: Unknown result type (might be due to invalid IL or missing references) //IL_0353: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Invalid comparison between Unknown and I4 //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Invalid comparison between Unknown and I4 //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) foreach (KeyValuePair<Selectable, Orig> item in _done) { Selectable key = item.Key; Orig value = item.Value; if ((Object)(object)key == (Object)null) { continue; } if ((Object)(object)value.Added != (Object)null) { Object.Destroy((Object)(object)value.Added); } if ((Object)(object)value.Frame != (Object)null) { Object.Destroy((Object)(object)value.Frame); } foreach (Object item2 in value.Extra) { if (item2 != (Object)null) { Object.Destroy(item2); } } foreach (KeyValuePair<Graphic, Color> text in value.Texts) { if ((Object)(object)text.Key != (Object)null) { text.Key.color = text.Value; } } if ((Object)(object)value.AddedMask != (Object)null) { Object.Destroy((Object)(object)value.AddedMask); } Image img = value.Img; if ((Object)(object)img != (Object)null) { if (_first.TryGetValue(img, out var value2)) { value.Sprite = value2.Sprite; value.Type = value2.Type; value.Color = value2.Color; value.Material = value2.Material; } img.sprite = value.Sprite; img.type = value.Type; ((Graphic)img).color = value.Color; ((Graphic)img).material = value.Material; Color val = (((int)value.Transition == 1) ? (((ColorBlock)(ref value.Colors)).normalColor * ((ColorBlock)(ref value.Colors)).colorMultiplier) : Color.white); if ((Object)(object)key != (Object)null && !key.interactable && (int)value.Transition == 1) { val = ((ColorBlock)(ref value.Colors)).disabledColor * ((ColorBlock)(ref value.Colors)).colorMultiplier; } ((Graphic)img).CrossFadeColor(val, 0f, true, true); } key.targetGraphic = value.Target; key.transition = value.Transition; key.colors = value.Colors; key.spriteState = value.Sprites; if (value.Hidden == null) { continue; } foreach (Image item3 in value.Hidden) { if ((Object)(object)item3 != (Object)null) { ((Behaviour)item3).enabled = true; } } } _done.Clear(); _imgs.Clear(); foreach (KeyValuePair<Image, First> item4 in _first.ToList()) { if ((Object)(object)item4.Key == (Object)null) { _first.Remove(item4.Key); } else if (Ours(item4.Key.sprite)) { item4.Key.sprite = item4.Value.Sprite; item4.Key.type = item4.Value.Type; ((Graphic)item4.Key).color = item4.Value.Color; ((Graphic)item4.Key).material = item4.Value.Material; } } } } internal static class ChestWindow { internal static ConfigEntry<bool> Enabled; internal static ConfigEntry<Vector2> Offset; private static RectTransform _rt; private static bool _dragging; private static bool _haveWritten; private static Vector2 _lastMouse; private static Vector2 _lastBase; private static Vector2 _lastWritten; private static Vector2 _drag; internal static ConfigEntry<bool> ShowHint; private static Text _hint; internal static ConfigEntry<bool> Snap; internal static bool Snaps { get { if (Snap != null) { return Snap.Value; } return true; } } private static bool CanDrag { get { if (Enabled.Value) { return !Snaps; } return false; } } private static KeyCode Key { get { //IL_0012: Unknown result type (might be due to invalid IL or missing references) if (TraderWindow.DragKey == null) { return (KeyCode)306; } return TraderWindow.DragKey.Value; } } public static void Init(ConfigFile cfg) { //IL_005c: Unknown result type (might be due to invalid IL or missing references) Enabled = cfg.Bind<bool>("Menu", "MovableChestWindow", true, "Hold the drag key ([Trader] DragKey, Left Ctrl) and left-drag a chest's window to move it. Your own setting."); Snap = cfg.Bind<bool>("Menu", "ChestUnderInventory", true, "Put a chest window right under the inventory, the two rune borders touching, always on the screen (the inventory and chest get shorter and scroll when needed). Off: you place it with Ctrl + drag."); ShowHint = cfg.Bind<bool>("Menu", "ChestWindowHint", true, "A small line along a chest window's right side: \"Ctrl + drag to move\"."); Offset = cfg.Bind<Vector2>("Menu", "ChestWindowOffset", Vector2.zero, "Where you moved the chest window to, from its usual place under the inventory. 0,0 = the usual place."); } private static RectTransform Window() { InventoryGui instance = InventoryGui.instance; RectTransform val = (((Object)(object)instance != (Object)null) ? instance.m_container : null); if ((Object)(object)val != (Object)(object)_rt) { _rt = val; _haveWritten = false; } return _rt; } private static void Hint() { //IL_0089: 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_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Unknown result type (might be due to invalid IL or missing references) RectTransform val = Window(); if ((Object)(object)val == (Object)null) { return; } bool flag = ShowHint != null && ShowHint.Value && CanDrag; if ((Object)(object)_hint == (Object)null || (Object)(object)((Component)_hint).transform.parent != (Object)(object)val) { if (!flag) { return; } GameObject val2 = new GameObject("EDChestHint", new Type[3] { typeof(RectTransform), typeof(Text), typeof(Shadow) }); val2.transform.SetParent((Transform)(object)val, false); _hint = val2.GetComponent<Text>(); _hint.font = VikingStyle.Font(); _hint.fontSize = 14; _hint.alignment = (TextAnchor)4; ((Graphic)_hint).color = new Color(0.92f, 0.86f, 0.72f, 0.9f); ((Graphic)_hint).raycastTarget = false; _hint.horizontalOverflow = (HorizontalWrapMode)1; string text = ((TraderWindow.DragKey != null) ? ((object)TraderWindow.DragKey.Value/*cast due to .constrained prefix*/).ToString().Replace("Left", "").Replace("Right", "") .Replace("Control", "Ctrl") : "Ctrl"); _hint.text = text + " + drag to move"; val2.GetComponent<Shadow>().effectColor = new Color(0f, 0f, 0f, 0.9f); RectTransform rectTransform = ((Graphic)_hint).rectTransform; Vector2 val3 = default(Vector2); ((Vector2)(ref val3))..ctor(1f, 0.5f); rectTransform.anchorMax = val3; rectTransform.anchorMin = val3; rectTransform.pivot = new Vector2(0.5f, 0.5f); rectTransform.sizeDelta = new Vector2(220f, 20f); ((Transform)rectTransform).localEulerAngles = new Vector3(0f, 0f, 90f); float num = (InventoryLook.ChestRing ? InventoryLook.Ring : 0f); rectTransform.anchoredPosition = new Vector2(num + 12f, 0f); } if (((Component)_hint).gameObject.activeSelf != flag) { ((Component)_hint).gameObject.SetActive(flag); } } private static bool Open() { try { InventoryGui instance = InventoryGui.instance; if ((Object)(object)instance == (Object)null || !InventoryGui.IsVisible()) { return false; } return (Object)(object)Fast.Field<Container>(instance, "m_currentContainer") != (Object)null; } catch { return false; } } public static void Tick() { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //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_006b: 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) //IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: 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_00ab: 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) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_024f: 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) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0143: 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) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) Hint(); if (!Enabled.Value) { _dragging = false; return; } RectTransform val = Window(); if ((Object)(object)val == (Object)null || !Open()) { if (_dragging) { _dragging = false; if (Offset.Value != _drag) { Offset.Value = _drag; } } return; } Vector2 val2 = Vector2.op_Implicit(Input.mousePosition); if (_dragging) { if (!Input.GetMouseButton(0) || !Input.GetKey(Key)) { _dragging = false; if (Offset.Value != _drag) { Offset.Value = _drag; } return; } Vector2 val3 = val2 - _lastMouse; _lastMouse = val2; if (!(((Vector2)(ref val3)).sqrMagnitude < 0.01f)) { float num = (((Object)(object)((Transform)val).parent != (Object)null) ? Mathf.Max(0.01f, ((Transform)val).parent.lossyScale.x) : 1f); Canvas componentInParent = ((Component)val).GetComponentInParent<Canvas>(); if ((Object)(object)componentInParent != (Object)null && (int)componentInParent.rootCanvas.renderMode != 0) { num = Mathf.Max(0.01f, componentInParent.rootCanvas.scaleFactor); } Vector2 drag = _drag + val3 / num; Vector3[] array = (Vector3[])(object)new Vector3[4]; val.GetWorldCorners(array); Rect val4 = default(Rect); ((Rect)(ref val4))..ctor(array[0].x + val3.x, array[0].y + val3.y, array[2].x - array[0].x, array[2].y - array[0].y); if (!(((Rect)(ref val4)).xMax < 60f) && !(((Rect)(ref val4)).xMin > (float)Screen.width - 60f) && !(((Rect)(ref val4)).yMax < 60f) && !(((Rect)(ref val4)).yMin > (float)Screen.height - 60f)) { _drag = drag; } } } else if (CanDrag && Input.GetKey(Key) && Input.GetMouseButtonDown(0) && Over(val, val2)) { _dragging = true; _lastMouse = val2; _drag = Offset.Value; } } public static void Apply() { //IL_001e: 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_0031: 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) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: 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_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0053: 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_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: 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) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: 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_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) RectTransform val = Window(); if ((Object)(object)val == (Object)null || !Open()) { return; } Vector2 val2 = ((!CanDrag) ? Vector2.zero : (_dragging ? _drag : Offset.Value)); bool flag = !float.IsNaN(WindowFit.ChestTopPx); if (_haveWritten || !(val2 == Vector2.zero) || flag || !(OnScreenLift(val, val.anchoredPosition) <= 0f)) { Vector2 anchoredPosition = val.anchoredPosition; Vector2 val3 = anchoredPosition; if (_haveWritten) { val3.x = ((Mathf.Abs(anchoredPosition.x - _lastWritten.x) <= 2f) ? _lastBase.x : anchoredPosition.x); val3.y = ((Mathf.Abs(anchoredPosition.y - _lastWritten.y) <= 2f) ? _lastBase.y : anchoredPosition.y); } Vector2 val4 = val3 + val2; if (flag) { Vector3[] array = (Vector3[])(object)new Vector3[4]; val.GetWorldCorners(array); float num = (((Object)(object)((Transform)val).parent != (Object)null) ? Mathf.Max(0.0001f, ((Transform)val).parent.lossyScale.y) : 1f); float num2 = Mathf.Max(array[1].y, array[2].y) + (val4.y - anchoredPosition.y) * num; val4.y += (WindowFit.ChestTopPx - num2) / num; } if (!flag) { val4.y += OnScreenLift(val, val4); } Vector2 val5 = anchoredPosition - val4; if (((Vector2)(ref val5)).sqrMagnitude > 0.0001f) { val.anchoredPosition = val4; } _lastBase = val3; _lastWritten = val4; _haveWritten = true; } } private static float OnScreenLift(RectTransform rt, Vector2 at) { //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_0058: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) Vector3[] array = (Vector3[])(object)new Vector3[4]; rt.GetWorldCorners(array); float num = Mathf.Min(array[0].y, array[3].y) + (at.y - rt.anchoredPosition.y) * (((Object)(object)((Transform)rt).parent != (Object)null) ? ((Transform)rt).parent.lossyScale.y : 1f); float num2 = 8f - num; if (num2 <= 0f) { return 0f; } float num3 = (((Object)(object)((Transform)rt).parent != (Object)null) ? Mathf.Max(0.01f, ((Transform)rt).parent.lossyScale.y) : 1f); return num2 / num3; } private static bool Over(RectTransform rt, Vector2 mouse) { //IL_0024: 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_0041: 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_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: 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_005a: 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_006b: 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_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) Vector3[] array = (Vector3[])(object)new Vector3[4]; rt.GetWorldCorners(array); Canvas componentInParent = ((Component)rt).GetComponentInParent<Canvas>(); Camera obj = (((Object)(object)componentInParent != (Object)null && (int)componentInParent.rootCanvas.renderMode != 0) ? componentInParent.rootCanvas.worldCamera : null); Vector2 val = RectTransformUtility.WorldToScreenPoint(obj, array[0]); Vector2 val2 = RectTransformUtility.WorldToScreenPoint(obj, array[2]); Rect val3 = Rect.MinMaxRect(Mathf.Min(val.x, val2.x), Mathf.Min(val.y, val2.y), Mathf.Max(val.x, val2.x), Mathf.Max(val.y, val2.y)); return ((Rect)(ref val3)).Contains(mouse); } } internal sealed class Compass : MonoBehaviour { internal static ConfigEntry<bool> Enabled; internal static ConfigEntry<bool> ShowPins; internal static ConfigEntry<bool> ShowDistance; internal static ConfigEntry<float> Width; internal static ConfigEntry<float> Range; internal static ConfigEntry<float> TopOffset; internal static ConfigEntry<float> FieldOfView; private const float H = 40f; private CanvasGroup _group; private RectTransform _box; private RectTransform _strip; private readonly List<RectTransform> _marks = new List<RectTransform>(); private readonly List<float> _markDeg = new List<float>(); private readonly List<Image> _icons = new List<Image>(); private Text _dist; private Font _font; private bool _built; private bool _told; private static Compass _inst; public static void Init(ConfigFile cfg) { //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Expected O, but got Unknown //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Expected O, but got Unknown //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Expected O, but got Unknown Enabled = cfg.Bind<bool>("Compass", "Enabled", true, "A compass at the top of the screen."); ShowPins = cfg.Bind<bool>("Compass", "ShowMapIcons", true, "Show the map's pin icons on the compass."); ShowDistance = cfg.Bind<bool>("Compass", "ShowDistance", true, "Show the distance under the nearest icon you are facing."); Width = cfg.Bind<float>("Compass", "Width", 720f, new ConfigDescription("Width of the compass (at 1920x1080).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(300f, 1600f), Array.Empty<object>())); Range = cfg.Bind<float>("Compass", "IconRange", 1000f, new ConfigDescription("Map icons farther than this (metres) are not shown. 0 = any distance.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 10000f), Array.Empty<object>())); TopOffset = cfg.Bind<float>("Compass", "TopOffset", 14f, "Distance from the top of the screen."); FieldOfView = cfg.Bind<float>("Compass", "Degrees", 180f, new ConfigDescription("How many degrees of the horizon the strip shows.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(60f, 360f), Array.Empty<object>())); } private void Build() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown //IL_004e: 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_00be: Expected O, but got Unknown //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Expected O, but got Unknown //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_011c: 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_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Expected O, but got Unknown //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Expected O, but got Unknown //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_0252: Unknown result type (might be due to invalid IL or missing references) //IL_0464: Unknown result type (might be due to invalid IL or missing references) //IL_0469: Unknown result type (might be due to invalid IL or missing references) //IL_0495: Unknown result type (might be due to invalid IL or missing references) //IL_04be: Unknown result type (might be due to invalid IL or missing references) //IL_04c5: Unknown result type (might be due to invalid IL or missing references) //IL_04d7: Unknown result type (might be due to invalid IL or missing references) //IL_04ec: Unknown result type (might be due to invalid IL or missing references) //IL_0500: Unknown result type (might be due to invalid IL or missing references) //IL_052d: Unknown result type (might be due to invalid IL or missing references) //IL_055a: Unknown result type (might be due to invalid IL or missing references) //IL_0561: Unknown result type (might be due to invalid IL or missing references) //IL_0573: Unknown result type (might be due to invalid IL or missing references) //IL_0588: Unknown result type (might be due to invalid IL or missing references) //IL_059c: Unknown result type (might be due to invalid IL or missing references) //IL_0379: Unknown result type (might be due to invalid IL or missing references) //IL_037e: Unknown result type (might be due to invalid IL or missing references) //IL_03aa: Unknown result type (might be due to invalid IL or missing references) //IL_03ce: Unknown result type (might be due to invalid IL or missing references) //IL_03e4: Unknown result type (might be due to invalid IL or missing references) //IL_0403: Unknown result type (might be due to invalid IL or missing references) //IL_040a: 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_032f: Unknown result type (might be due to invalid IL or missing references) //IL_0345: Unknown result type (might be due to invalid IL or missing references) //IL_02fc: Unknown result type (might be due to invalid IL or missing references) _built = true; _font = VikingStyle.Font(); GameObject val = new GameObject("EDCompass"); Object.DontDestroyOnLoad((Object)(object)val); Canvas obj = val.AddComponent<Canvas>(); obj.renderMode = (RenderMode)0; obj.sortingOrder = 3; CanvasScaler obj2 = val.AddComponent<CanvasScaler>(); obj2.uiScaleMode = (ScaleMode)1; obj2.referenceResolution = new Vector2(1920f, 1080f); obj2.matchWidthOrHeight = 1f; _group = val.AddComponent<CanvasGroup>(); _group.interactable = false; _group.blocksRaycasts = false; GameObject val2 = new GameObject("Box", new Type[3] { typeof(RectTransform), typeof(Image), typeof(Outline) }); val2.transform.SetParent(val.transform, false); _box = (RectTransform)val2.transform; RectTransform box = _box; RectTransform box2 = _box; Vector2 val3 = default(Vector2); ((Vector2)(ref val3))..ctor(0.5f, 1f); box2.anchorMax = val3; box.anchorMin = val3; _box.pivot = new Vector2(0.5f, 1f); Image component = val2.GetComponent<Image>(); Color val4 = InventoryLook.InventoryBrown(); ((Graphic)component).color = new Color(val4.r, val4.g, val4.b, 0.92f); ((Graphic)component).raycastTarget = false; Outline component2 = val2.GetComponent<Outline>(); ((Shadow)component2).effectColor = new Color(0.16f, 0.09f, 0.04f, 0.95f); ((Shadow)component2).effectDistance = new Vector2(2f, -2f); try { VikingStyle.AddFrame(_box, 7f, 2f, 23, InventoryLook.Carve()); } catch { } GameObject val5 = new GameObject("Strip", new Type[2] { typeof(RectTransform), typeof(RectMask2D) }); val5.transform.SetParent(val2.transform, false); _strip = (RectTransform)val5.transform; _strip.anchorMin = Vector2.zero; _strip.anchorMax = Vector2.one; _strip.offsetMin = new Vector2(10f, 3f); _strip.offsetMax = new Vector2(-10f, -3f); for (int i = 0; i < 360; i += 15) { RectTransform rectTransform; if (i % 45 == 0) { string[] array = new string[8] { "N", "NE", "E", "SE", "S", "SW", "W", "NW" }; bool flag = i % 90 == 0; rectTransform = ((Graphic)NewText((Transform)(object)_strip, array[i / 45], flag ? 20 : 14, (i == 0) ? new Color(0.85f, 0.12f, 0.08f) : new Color(1f, 0.84f, 0.55f, flag ? 1f : 0.8f))).rectTransform; rectTransform.sizeDelta = new Vector2(40f, 24f); rectTransform.anchoredPosition = new Vector2(0f, 3f); } else { GameObject val6 = new GameObject("Tick", new Type[2] { typeof(RectTransform), typeof(Image) }); val6.transform.SetParent((Transform)(object)_strip, false); Image component3 = val6.GetComponent<Image>(); ((Graphic)component3).color = new Color(0.62f, 0.46f, 0.28f, 0.8f); ((Graphic)component3).raycastTarget = false; rectTransform = ((Graphic)component3).rectTransform; rectTransform.sizeDelta = new Vector2(2f, 9f); rectTransform.anchoredPosition = new Vector2(0f, -8f); } RectTransform obj4 = rectTransform; RectTransform obj5 = rectTransform; ((Vector2)(ref val3))..ctor(0.5f, 0.5f); obj5.anchorMax = val3; obj4.anchorMin = val3; _marks.Add(rectTransform); _markDeg.Add(i); } GameObject val7 = new GameObject("Notch", new Type[2] { typeof(RectTransform), typeof(Image) }); val7.transform.SetParent(val2.transform, false); Image component4 = val7.GetComponent<Image>(); ((Graphic)component4).color = new Color(1f, 0.78f, 0.35f, 1f); ((Graphic)component4).raycastTarget = false; RectTransform rectTransform2 = ((Graphic)component4).rectTransform; ((Vector2)(ref val3))..ctor(0.5f, 0f); rectTransform2.anchorMax = val3; rectTransform2.anchorMin = val3; rectTransform2.pivot = new Vector2(0.5f, 0f); rectTransform2.sizeDelta = new Vector2(3f, 10f); rectTransform2.anchoredPosition = new Vector2(0f, 2f); _dist = NewText(val2.transform, "", 13, new Color(1f, 0.86f, 0.6f, 1f)); RectTransform rectTransform3 = ((Graphic)_dist).rectTransform; ((Vector2)(ref val3))..ctor(0.5f, 0f); rectTransform3.anchorMax = val3; rectTransform3.anchorMin = val3; rectTransform3.pivot = new Vector2(0.5f, 1f); rectTransform3.sizeDelta = new Vector2(120f, 18f); rectTransform3.anchoredPosition = new Vector2(0f, -3f); } private Text NewText(Transform parent, string s, int size, Color c) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: 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) GameObject val = new GameObject("T", new Type[3] { typeof(RectTransform), typeof(Text), typeof(Outline) }); val.transform.SetParent(parent, false); Text component = val.GetComponent<Text>(); component.font = _font; component.fontSize = size; component.text = s; ((Graphic)component).color = c; component.alignment = (TextAnchor)4; ((Graphic)component).raycastTarget = false; component.horizontalOverflow = (HorizontalWrapMode)1; component.verticalOverflow = (VerticalWrapMode)1; Outline component2 = val.GetComponent<Outline>(); ((Shadow)component2).effectColor = new Color(0f, 0f, 0f, 0.85f); ((Shadow)component2).effectDistance = new Vector2(1f, -1f); return component; } private Image Icon(int i) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) Vector2 val2 = default(Vector2); while (_icons.Count <= i) { GameObject val = new GameObject("Pin", new Type[2] { typeof(RectTransform), typeof(Image) }); val.transform.SetParent((Transform)(object)_strip, false); Image component = val.GetComponent<Image>(); ((Graphic)component).raycastTarget = false; component.preserveAspect = true; RectTransform rectTransform = ((Graphic)component).rectTransform; ((Vector2)(ref val2))..ctor(0.5f, 0.5f); rectTransform.anchorMax = val2; rectTransform.anchorMin = val2; _icons.Add(component); } return _icons[i]; } private static bool Hidden() { if ((Object)(object)Player.m_localPlayer == (Object)null || (Object)(object)GameCamera.instance == (Object)null) { return true; } try { if (Menu.IsVisible()) { return true; } } catch { } try { if ((Object)(object)Minimap.instance != (Object)null && Fast.Field<object>(Minimap.instance, "m_mode")?.ToString() == "Large") { return true; } } catch { } try { if ((Object)(object)Hud.instance != (Object)null && Fast.Field<bool>(Hud.instance, "m_userHidden")) { return true; } } catch { } try { if ((Object)(object)EntryScreen.Root != (Object)null && ((Component)EntryScreen.Root).gameObject.activeInHierarchy) { return true; } } catch { } return false; } private static float Delta(float a, float b) { return Mathf.DeltaAngle(b, a); } private void Awake() { _inst = this; } internal static float BottomPx() { if ((Object)(object)_inst == (Object)null || (Object)(object)_inst._box == (Object)null || (Object)(object)_inst._group == (Object)null || _inst._group.alpha < 0.5f) { return float.NaN; } Vector3[] array = (Vector3[])(object)new Vector3[4]; _inst._box.GetWorldCorners(array); float num = 6f; return Mathf.Min(array[0].y, array[3].y) - num; } private void LateUpdate() { //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: 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_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_04f4: Unknown result type (might be due to invalid IL or missing references) //IL_0503: Unknown result type (might be due to invalid IL or missing references) //IL_0508: Unknown result type (might be due to invalid IL or missing references) //IL_050d: Unknown result type (might be due to invalid IL or missing references) //IL_0524: Unknown result type (might be due to invalid IL or missing references) //IL_052b: Unknown result type (might be due to invalid IL or missing references) //IL_05ce: Unknown result type (might be due to invalid IL or missing references) //IL_05e1: Unknown result type (might be due to invalid IL or missing references) //IL_0603: Unknown result type (might be due to invalid IL or missing references) //IL_062c: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Unknown result type (might be due to invalid IL or missing references) //IL_0286: Invalid comparison between Unknown and I4 //IL_028d: Unknown result type (might be due to invalid IL or missing references) //IL_0292: Unknown result type (might be due to invalid IL or missing references) //IL_0294: Unknown result type (might be due to invalid IL or missing references) //IL_0299: Unknown result type (might be due to invalid IL or missing references) //IL_02de: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: Unknown result type (might be due to invalid IL or missing references) //IL_039b: Unknown result type (might be due to invalid IL or missing references) //IL_03bd: Unknown result type (might be due to invalid IL or missing references) //IL_0418: Unknown result type (might be due to invalid IL or missing references) if (Enabled == null) { return; } if (!Enabled.Value) { if ((Object)(object)_group != (Object)null) { _group.alpha = 0f; } return; } if (!_built) { if ((Object)(object)Player.m_localPlayer == (Object)null) { return; } Build(); } if (Hidden()) { _group.alpha = 0f; return; } _group.alpha = 1f; float value = Width.Value; float num = Mathf.Max(30f, FieldOfView.Value); _box.sizeDelta = new Vector2(value, 40f); HudLayout.Own["own/compass"] = _box; Vector2 val = new Vector2(0f, 0f - TopOffset.Value) + HudLayout.OwnOffset("own/compass", _box); Vector2 val2 = _box.anchoredPosition - val; if (((Vector2)(ref val2)).sqrMagnitude > 0.01f) { _box.anchoredPosition = val; } float num2 = (value - 20f) * 0.5f; Vector3 forward = ((Component)GameCamera.instance).transform.forward; float b = Mathf.Atan2(forward.x, forward.z) * 57.29578f; for (int i = 0; i < _marks.Count; i++) { float num3 = Delta(_markDeg[i], b); bool flag = Mathf.Abs(num3) <= num * 0.5f; RectTransform val3 = _marks[i]; if (((Component)val3).gameObject.activeSelf != flag) { ((Component)val3).gameObject.SetActive(flag); } if (flag) { val3.anchoredPosition = new Vector2(num3 / (num * 0.5f) * num2, val3.anchoredPosition.y); } } int num4 = 0; string text = ""; if (ShowPins.Value && (Object)(object)Minimap.instance != (Object)null) { try { List<PinData> list = Fast.Field<List<PinData>>(Minimap.instance, "m_pins"); Vector3 position = ((Component)Player.m_localPlayer).transform.position; float num5 = 6f; if (list != null) { foreach (PinData item in list) { if (item == null || (Object)(object)item.m_icon == (Object)null || (int)item.m_type == 13) { continue; } Vector3 val4 = item.m_pos - position; val4.y = 0f; float magnitude = ((Vector3)(ref val4)).magnitude; if (magnitude < 3f || (Range.Value > 0f && magnitude > Range.Value)) { continue; } float num6 = Delta(Mathf.Atan2(val4.x, val4.z) * 57.29578f, b); if (!(Mathf.Abs(num6) > num * 0.5f)) { Image val5 = Icon(num4++); if (!((Component)val5).gameObject.activeSelf) { ((Component)val5).gameObject.SetActive(true); } val5.sprite = item.m_icon; float num7 = ((Range.Value > 0f) ? (1f - Mathf.Clamp01(magnitude / Range.Value)) : 1f); float num8 = Mathf.Lerp(18f, 26f, num7); ((Graphic)val5).rectTransform.sizeDelta = new Vector2(num8, num8); ((Graphic)val5).rectTransform.anchoredPosition = new Vector2(num6 / (num * 0.5f) * num2, -2f); float num9 = 1f - Mathf.Clamp01((Mathf.Abs(num6) / (num * 0.5f) - 0.8f) / 0.2f); ((Graphic)val5).color = new Color(1f, 1f, 1f, (item.m_checked ? 0.5f : 1f) * num9); if (Mathf.Abs(num6) < num5) { num5 = Mathf.Abs(num6); text = ((magnitude >= 1000f) ? ((magnitude / 1000f).ToString("0.0") + " km") : (Mathf.RoundToInt(magnitude) + " m")); } } } } } catch (Exception ex) { if (!_told) { _told = true; EndlessDungeonsPlugin.Log.LogWarning((object)("Compass: map icons unavailable (" + ex.Message + ").")); } } } try { Vector3? target = StoneSense.Target; if (target.HasValue && (Object)(object)Player.m_localPlayer != (Object)null) { Vector3 val6 = target.Value - ((Component)Player.m_localPlayer).transform.position; val6.y = 0f; float magnitude2 = ((Vector3)(ref val6)).magnitude; float num10 = Delta(Mathf.Atan2(val6.x, val6.z) * 57.29578f, b); float num11 = Mathf.Clamp(num10, (0f - num) * 0.5f, num * 0.5f); Image val7 = Icon(num4++); if (!((Component)val7).gameObject.activeSelf) { ((Component)val7).gameObject.SetActive(true); } val7.sprite = TotemMapCircles.StoneIconPublic() ?? val7.sprite; float num12 = 0.75f + 0.25f * Mathf.Sin(Time.unscaledTime * 4f); ((Graphic)val7).rectTransform.sizeDelta = new Vector2(26f, 26f) * (0.9f + 0.1f * num12); ((Graphic)val7).rectTransform.anchoredPosition = new Vector2(num11 / (num * 0.5f) * num2, -2f); ((Graphic)val7).color = new Color(1f, 0.35f + 0.25f * num12, 0.3f, 1f); if (Mathf.Abs(num10) <= num * 0.5f || string.IsNullOrEmpty(text)) { text = "Corrupted Stones " + ((magnitude2 >= 1000f) ? ((magnitude2 / 1000f).ToString("0.0") + " km") : (Mathf.RoundToInt(magnitude2) + " m")) + ((!(Mathf.Abs(num10) > num * 0.5f)) ? "" : ((num10 < 0f) ? " <" : " >")); } } } catch { } for (int j = num4; j < _icons.Count; j++) { if (((Component)_icons[j]).gameObject.activeSelf) { ((Component)_icons[j]).gameObject.SetActive(false); } } _dist.text = ((ShowDistance.Value || StoneSense.Target.HasValue) ? text : ""); } } internal static class ConfigSync { internal sealed class ConfigurationManagerAttributes { public bool? ReadOnly; } private const string RpcConfig = "ED_Config"; private const string RpcRequest = "ED_ConfigReq"; internal static readonly HashSet<string> LocalSections = new HashSet<string>(StringComparer.OrdinalIgnoreCase) { "Debug", "Hugin", "Multiplayer", "DungeonMap", "Menu", "Trader", "Compass", "MapIcons" }; private static ZRoutedRpc _registeredFor; private static readonly HashSet<long> Sent = new HashSet<long>(); private static bool _dirty; private static float _timer; private static float _lastRequest = -99f; private static int _requests; private static bool _clientActive; private static bool _undoFileEdit; private static bool _marked; internal static bool _applying; private static float _nextLockMsg; private static readonly ConfigurationManagerAttributes Lock = new ConfigurationManagerAttributes { ReadOnly = false }; private static readonly Dictionary<string, string> Original = new Dictionary<string, string>(); private static readonly Dictionary<string, string> FromHost = new Dictionary<string, string>(); public static void Init() { ((BaseUnityPlugin)EndlessDungeonsPlugin.Instance).Config.SettingChanged += OnChanged; } private static IEnumerable<ConfigEntryBase> Entries() { ConfigFile cfg = ((BaseUnityPlugin)EndlessDungeonsPlugin.Instance).Config; foreach (ConfigDefinition item in cfg.Keys.ToList()) { yield return cfg[item]; } } private static bool IsSynced(ConfigEntryBase e) { return !LocalSections.Contains(e.Definition.Section); } private static string Id(ConfigEntryBase e) { return e.Definition.Section + "." + e.Definition.Key; } private static void OnChanged(object sender, SettingChangedEventArgs args) { if (_applying) { return; } ConfigEntryBase val = ((args != null) ? args.ChangedSetting : null); if (val == null || !IsSynced(val)) { return; } if (_clientActive) { string key = Id(val); string serializedValue = val.GetSerializedValue(); if (!FromHost.TryGetValue(key, out var value) || !(serializedValue != value)) { return; } string value2; bool num = !Original.TryGetValue(key, out value2) || value2 != serializedValue; SetQuietly(val, value); if (!num) { return; } _undoFileEdit = true; EndlessDungeonsPlugin.Log.LogWarning((object)("Config: [" + val.Definition.Section + "] " + val.Definition.Key + " is set by the host while you are connected; your change was undone.")); if (Time.time >= _nextLockMsg) { _nextLockMsg = Time.time + 2f; Player localPlayer = Player.m_localPlayer; if (localPlayer != null) { ((Character)localPlayer).Message((MessageType)1, "Eternal: that setting is locked by the host while you are connected.", 0, (Sprite)null, false); } } } else { _dirty = true; } } public static void Tick(float dt) { _timer += dt; if (_timer < 1f) { return; } _timer = 0f; RegisterRpcs(); MarkShared(); Lock.ReadOnly = _clientActive; if (_undoFileEdit) { _undoFileEdit = false; WriteOwnValuesToFile(); } ZNet instance = ZNet.instance; if ((Object)(object)instance == (Object)null) { if (_clientActive) { RestoreOwn(); } } else if (instance.IsServer()) { ServerTick(instance); } else { ClientTick(); } } private static void RegisterRpcs() { ZRoutedRpc instance = ZRoutedRpc.instance; if (instance == null || instance == _registeredFor) { return; } try { instance.Register<ZPackage>("ED_Config", (Action<long, ZPackage>)OnConfigReceived); instance.Register<ZPackage>("ED_ConfigReq", (Action<long, ZPackage>)OnConfigRequested); _registeredFor = instance; Sent.Clear(); _requests = 0; _lastRequest = -99f; } catch (Exception ex) { EndlessDungeonsPlugin.Log.LogWarning((object)("Config sync: could not register RPCs: " + ex.Message)); } } private static void ServerTick(ZNet zn) { if (!EndlessDungeonsPlugin.SyncConfig.Value || ZRoutedRpc.instance == null) { return; } List<ZNetPeer> ready = (from p in zn.GetPeers() where p.IsReady() select p).ToList(); Sent.RemoveWhere((long id) => !ready.Any((ZNetPeer p) => p.m_uid == id)); if (_dirty) { Sent.Clear(); _dirty = false; } foreach (ZNetPeer item in ready) { if (Sent.Add(item.m_uid)) { SendTo(item.m_uid); } } } private static void OnConfigRequested(long sender, ZPackage _) { ZNet instance = ZNet.instance; if (!((Object)(object)instance == (Object)null) && instance.IsServer() && EndlessDungeonsPlugin.SyncConfig.Value) { SendTo(sender); Sent.Add(sender); } } private static void SendTo(long peerId) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown try { List<ConfigEntryBase> list = Entries().Where(IsSynced).ToList(); ZPackage val = new ZPackage(); val.Write("3.29.0"); val.Write(list.Count); foreach (ConfigEntryBase item in list) { val.Write(Id(item)); val.Write(item.GetSerializedValue()); } ZRoutedRpc.instance.InvokeRoutedRPC(peerId, "ED_Config", new object[1] { val }); } catch (Exception ex) { EndlessDungeonsPlugin.Log.LogWarning((object)("Config sync: could not send settings: " + ex.Message)); } } private static long ServerPeerId() { List<ZNetPeer> list = (((Object)(object)ZNet.instance != (Object)null) ? ZNet.instance.GetPeers() : null); if (list == null || list.Count <= 0) { return 0L; } return list[0].m_uid; } private static void ClientTick() { //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Expected O, but got Unknown if (_clientActive || ZRoutedRpc.instance == null || _requests >= 20 || Time.time - _lastRequest < 3f || ServerPeerId() == 0L) { return; } _lastRequest = Time.time; _requests++; try { ZRoutedRpc.instance.InvokeRoutedRPC(ServerPeerId(), "ED_ConfigReq", new object[1] { (object)new ZPackage() }); } catch (Exception ex) { EndlessDungeonsPlugin.Log.LogWarning((object)("Config sync: request failed: " + ex.Message)); } } private static void OnConfigReceived(long sender, ZPackage pkg) { ZNet instance = ZNet.instance; if ((Object)(object)instance == (Object)null || instance.IsServer() || ZRoutedRpc.instance == null || sender == 0L || sender != ServerPeerId()) { return; } try { string hostVersion = pkg.ReadString(); int num = pkg.ReadInt(); Dictionary<string, string> dictionary = new Dictionary<string, string>(); for (int i = 0; i < num; i++) { string key = pkg.ReadString(); dictionary[key] = pkg.ReadString(); } Apply(dictionary, hostVersion); } catch (Exception ex) { EndlessDungeonsPlugin.Log.LogWarning((object)("Config sync: bad settings message ignored: " + ex.Message)); } } private static void Apply(Dictionary<string, string> incoming, string hostVersion) { ConfigFile config = ((BaseUnityPlugin)EndlessDungeonsPlugin.Instance).Config; bool saveOnConfigSet = config.SaveOnConfigSet; config.SaveOnConfigSet = false; _applying = true; int num = 0; try { foreach (ConfigEntryBase item in Entries().Where(IsSynced)) { string text = Id(item); if (!incoming.TryGetValue(text, out var value)) { continue; } if (!Original.ContainsKey(text)) { Original[text] = item.GetSerializedValue(); } FromHost[text] = value; if (item.GetSerializedValue() != value) { try { item.SetSerializedValue(value); num++; } catch (Exception ex) { EndlessDungeonsPlugin.Log.LogWarning((object)("Config sync: could not apply " + text + ": " + ex.Message)); } } } _clientActive = true; } finally { _applying = false; config.SaveOnConfigSet = saveOnConfigSet; } AfterChange(); EndlessDungeonsPlugin.Log.LogInfo((object)$"Using the host's settings ({num} differed from yours)."); if (hostVersion != "3.29.0") { EndlessDungeonsPlugin.Log.LogWarning((object)("The host runs Eternal " + hostVersion + " but you run 3.29.0; behaviour may differ.")); } } private static void RestoreOwn() { ConfigFile config = ((BaseUnityPlugin)EndlessDungeonsPlugin.Instance).Config; bool saveOnConfigSet = config.SaveOnConfigSet; config.SaveOnConfigSet = false; _applying = true; try { foreach (ConfigEntryBase item in Entries().Where(IsSynced)) { if (Original.TryGetValue(Id(item), out var value) && item.GetSerializedValue() != value) { try { item.SetSerializedValue(value); } catch { } } } } finally { _applying = false; config.SaveOnConfigSet = saveOnConfigSet; } Original.Clear(); FromHost.Clear(); _clientActive = false; _requests = 0; _lastRequest = -99f; AfterChange(); EndlessDungeonsPlugin.Log.LogInfo((object)"Left the server: back to your own Eternal settings."); } private static void SetQuietly(ConfigEntryBase e, string value) { ConfigFile config = ((BaseUnityPlugin)EndlessDungeonsPlugin.Instance).Config; bool saveOnConfigSet = config.SaveOnConfigSet; config.SaveOnConfigSet = false; _applying = true; try { e.SetSerializedValue(value); } catch (Exception ex) { EndlessDungeonsPlugin.Log.LogWarning((object)("Config sync: could not revert " + Id(e) + ": " + ex.Message)); } finally { _applying = false; config.SaveOnConfigSet = saveOnConfigSet; } } private static void MarkShared() { //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Expected O, but got Unknown if (_marked) { return; } _marked = true; PropertyInfo propertyInfo = AccessTools.Property(typeof(ConfigEntryBase), "Description"); MethodInfo methodInfo = ((propertyInfo != null) ? propertyInfo.GetSetMethod(nonPublic: true) : null); FieldInfo fieldInfo = ((methodInfo == null) ? AccessTools.Field(typeof(ConfigEntryBase), "<Description>k__BackingField") : null); if (methodInfo == null && fieldInfo == null) { EndlessDungeonsPlugin.Log.LogInfo((object)"Config: settings cannot be greyed out in a config manager; they are still locked."); return; } int num = 0; foreach (ConfigEntryBase item in Entries().Where(IsSynced)) { try { ConfigDescription description = item.Description; object[] array = (((description != null) ? description.Tags : null) ?? new object[0]).Where((object t) => !(t is ConfigurationManagerAttributes)).Concat(new object[1] { Lock }).ToArray(); ConfigDescription val = new ConfigDescription(((description != null) ? description.Description : null) + " (Locked to the host's value in multiplayer.)", (description != null) ? description.AcceptableValues : null, array); if (methodInfo != null) { methodInfo.Invoke(item, new object[1] { val }); } else { fieldInfo.SetValue(item, val); } num++; } catch { } } EndlessDungeonsPlugin.Log.LogInfo((object)$"Config: {num} shared setting(s) are locked to the host's values while connected to a host."); } private static void WriteOwnValuesToFile() { ConfigFile config = ((BaseUnityPlugin)EndlessDungeonsPlugin.Instance).Config; bool saveOnConfigSet = config.SaveOnConfigSet; config.SaveOnConfigSet = false; _applying = true; try { foreach (ConfigEntry