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 HoverLoot v1.6.0
BepInEx/plugins/HoverLoot/HoverLoot.dll
Decompiled 2 weeks agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using UnityEngine; using UnityEngine.Rendering; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("HoverLoot")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.6.0.0")] [assembly: AssemblyInformationalVersion("1.6.0")] [assembly: AssemblyProduct("HoverLoot")] [assembly: AssemblyTitle("HoverLoot")] [assembly: AssemblyVersion("1.6.0.0")] namespace HoverLoot; public sealed class AdminPanel : MonoBehaviour { internal static bool Open; private static int suppressUntil = -1; private static readonly Dictionary<string, string> Names = new Dictionary<string, string>(); private PanelDraft draft; private Harmony harmony; private bool hooksReady; private Rect window = new Rect(30f, 30f, 960f, 690f); private int tab; private string status = ""; private string search = ""; private Vector2 scroll; private ItemDrop selected; private readonly List<ItemDrop> catalog = new List<ItemDrop>(); private Texture2D background; private Texture2D section; private Texture2D accent; private Texture2D halo; private GUIStyle title; private GUIStyle label; private GUIStyle small; private GUIStyle button; private GUIStyle activeButton; private GUIStyle box; private GUIStyle toggle; private GUIStyle field; private CursorLockMode oldLock; private bool oldCursor; private float scale; internal static bool BlockInput { get { if (!Open) { return Time.frameCount <= suppressUntil; } return true; } } private void Awake() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Expected O, but got Unknown //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Expected O, but got Unknown //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Expected O, but got Unknown //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Expected O, but got Unknown //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Expected O, but got Unknown try { harmony = new Harmony("local.hoverloot.panel"); harmony.Patch((MethodBase)AccessTools.Method(typeof(Player), "TakeInput", (Type[])null, (Type[])null), new HarmonyMethod(typeof(PanelInput), "PlayerInput", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); harmony.Patch((MethodBase)AccessTools.Method(typeof(GameCamera), "UpdateCamera", (Type[])null, (Type[])null), new HarmonyMethod(typeof(PanelInput), "CameraInput", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); harmony.Patch((MethodBase)AccessTools.Method(typeof(GameCamera), "UpdateMouseCapture", (Type[])null, (Type[])null), new HarmonyMethod(typeof(PanelInput), "MouseCapture", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); harmony.Patch((MethodBase)AccessTools.Method(typeof(Menu), "Update", (Type[])null, (Type[])null), new HarmonyMethod(typeof(PanelInput), "MenuInput", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); foreach (MethodInfo declaredMethod in AccessTools.GetDeclaredMethods(typeof(ZInput))) { if (declaredMethod.ReturnType == typeof(bool) && (declaredMethod.Name == "GetButton" || declaredMethod.Name == "GetButtonDown" || declaredMethod.Name == "GetButtonUp" || declaredMethod.Name == "GetKey" || declaredMethod.Name == "GetKeyDown" || declaredMethod.Name == "GetKeyUp")) { harmony.Patch((MethodBase)declaredMethod, new HarmonyMethod(typeof(PanelInput), "BlockGameButton", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } } hooksReady = true; Debug.Log((object)"HoverLoot panel input hooks ready: F6 / Option+H."); } catch (Exception ex) { Harmony obj = harmony; if (obj != null) { obj.UnpatchSelf(); } Debug.LogError((object)("HoverLoot settings input hooks unavailable: " + ex)); } } private void Update() { if ((Object)(object)Player.m_localPlayer == (Object)null) { if (Open) { Close(); } return; } bool flag = Input.GetKey((KeyCode)308) || Input.GetKey((KeyCode)307); if (Input.GetKeyDown((KeyCode)287) || (flag && Input.GetKeyDown((KeyCode)104))) { if (Open) { Close(); } else { Show(); } } if (Open && Input.GetKeyDown((KeyCode)27)) { Close(); } if (!Open && (Input.GetKeyDown((KeyCode)288) || (flag && Input.GetKeyDown((KeyCode)106)))) { Plugin.EffectsHidden = !Plugin.EffectsHidden; ModSettings.Refresh(); } } private void LateUpdate() { if (Open) { Cursor.lockState = (CursorLockMode)0; Cursor.visible = true; ZInput.IgnoreMouseInputForFrames(2); } } private void Show() { //IL_0178: 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_0210: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) if (!hooksReady) { status = "Панель не открыта: ошибка блокировки игрового ввода, см. журнал."; } else { if (Console.IsVisible() || Menu.IsVisible() || InventoryGui.IsVisible() || StoreGui.IsVisible() || TextInput.IsVisible()) { return; } draft = PanelDraft.Load(); status = "Изменения применяются кнопкой внизу."; GameObject hoverObject = ((Humanoid)Player.m_localPlayer).GetHoverObject(); selected = (((Object)(object)hoverObject != (Object)null) ? hoverObject.GetComponentInParent<ItemDrop>() : null); catalog.Clear(); Names.Clear(); if ((Object)(object)ObjectDB.instance != (Object)null) { foreach (GameObject item in ObjectDB.instance.m_items) { if (!((Object)(object)item == (Object)null)) { ItemDrop component = item.GetComponent<ItemDrop>(); if ((Object)(object)component != (Object)null && component.m_itemData != null && component.m_itemData.m_shared != null) { catalog.Add(component); } } } } catalog.Sort((ItemDrop a, ItemDrop b) => string.Compare(Name(a), Name(b), StringComparison.CurrentCultureIgnoreCase)); if ((Object)(object)selected == (Object)null) { selected = ((IEnumerable<ItemDrop>)catalog).FirstOrDefault((Func<ItemDrop, bool>)((ItemDrop x) => ((Object)x).name == "Stone")) ?? catalog.FirstOrDefault(); } oldLock = Cursor.lockState; oldCursor = Cursor.visible; scale = Mathf.Clamp(Mathf.Min((float)Screen.width / 1100f, (float)Screen.height / 800f), 0.55f, 1.35f); window = new Rect(Mathf.Max(10f, ((float)Screen.width / scale - 960f) / 2f), Mathf.Max(10f, ((float)Screen.height / scale - 690f) / 2f), 960f, 690f); Open = true; Cursor.lockState = (CursorLockMode)0; Cursor.visible = true; } } private void Close() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) Open = false; suppressUntil = Time.frameCount + 1; GUIUtility.keyboardControl = 0; Cursor.lockState = oldLock; Cursor.visible = oldCursor; ZInput.IgnoreMouseInputForFrames(2); } private static string Name(ItemDrop drop) { if ((Object)(object)drop == (Object)null || drop.m_itemData == null) { return "Предмет"; } string name = drop.m_itemData.m_shared.m_name; if (string.IsNullOrEmpty(name)) { return ModSettings.Prefab(drop); } if (!Names.TryGetValue(name, out var value)) { value = ((Localization.instance != null) ? Localization.instance.Localize(name) : name); Names[name] = value; } return value; } private Texture2D Solid(Color color) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown Texture2D val = new Texture2D(1, 1) { hideFlags = (HideFlags)61 }; val.SetPixel(0, 0, color); val.Apply(); return val; } private void Styles() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: 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_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Expected O, but got Unknown //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: 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_00e4: Expected O, but got Unknown //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_010f: 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_0121: Expected O, but got Unknown //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015d: 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_016e: Expected O, but got Unknown //IL_0173: Expected O, but got Unknown //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Expected O, but got Unknown //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Expected O, but got Unknown //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Expected O, but got Unknown //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Expected O, but got Unknown //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Unknown result type (might be due to invalid IL or missing references) //IL_023c: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Expected O, but got Unknown //IL_0258: Expected O, but got Unknown //IL_025f: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_0271: Expected O, but got Unknown //IL_02a0: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_02e7: Unknown result type (might be due to invalid IL or missing references) //IL_02ec: Unknown result type (might be due to invalid IL or missing references) if (title != null) { return; } background = Solid(new Color(0.055f, 0.07f, 0.086f, 0.98f)); section = Solid(new Color(0.09f, 0.115f, 0.14f, 0.98f)); accent = Solid(new Color(0.29f, 0.39f, 0.35f, 1f)); title = new GUIStyle(GUI.skin.label) { fontSize = 24, fontStyle = (FontStyle)1 }; title.normal.textColor = new Color(0.94f, 0.91f, 0.8f); label = new GUIStyle(GUI.skin.label) { fontSize = 14, wordWrap = true }; label.normal.textColor = new Color(0.86f, 0.89f, 0.9f); small = new GUIStyle(label) { fontSize = 12 }; small.normal.textColor = new Color(0.6f, 0.69f, 0.72f); button = new GUIStyle(GUI.skin.button) { fontSize = 13, padding = new RectOffset(9, 9, 7, 7) }; button.normal.background = section; activeButton = new GUIStyle(button); activeButton.normal.background = accent; box = new GUIStyle(GUI.skin.box); box.normal.background = background; box.padding = new RectOffset(0, 0, 0, 0); toggle = new GUIStyle(GUI.skin.toggle) { fontSize = 14 }; toggle.normal.textColor = label.normal.textColor; field = new GUIStyle(GUI.skin.textField) { fontSize = 14, padding = new RectOffset(6, 6, 4, 4) }; halo = new Texture2D(96, 96, (TextureFormat)4, false) { hideFlags = (HideFlags)61 }; Color[] array = (Color[])(object)new Color[9216]; for (int i = 0; i < 96; i++) { for (int j = 0; j < 96; j++) { Vector2 val = new Vector2(((float)j - 47.5f) / 47.5f, ((float)i - 47.5f) / 47.5f); float magnitude = ((Vector2)(ref val)).magnitude; array[i * 96 + j] = new Color(1f, 1f, 1f, Mathf.Exp((0f - magnitude) * magnitude * 5f) * Mathf.Clamp01((1f - magnitude) * 4f)); } } halo.SetPixels(array); halo.Apply(); } private void OnGUI() { //IL_0025: 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_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0051: 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_0072: Expected O, but got Unknown //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) if (Open && draft != null) { Styles(); int depth = GUI.depth; GUI.depth = -1000; Matrix4x4 matrix = GUI.matrix; GUI.matrix = Matrix4x4.Scale(new Vector3(scale, scale, 1f)); window = GUI.Window(160060, window, new WindowFunction(DrawWindow), "", box); ((Rect)(ref window)).x = Mathf.Clamp(((Rect)(ref window)).x, 0f, Mathf.Max(0f, (float)Screen.width / scale - ((Rect)(ref window)).width)); ((Rect)(ref window)).y = Mathf.Clamp(((Rect)(ref window)).y, 0f, Mathf.Max(0f, (float)Screen.height / scale - ((Rect)(ref window)).height)); GUI.matrix = matrix; GUI.depth = depth; } } private void DrawWindow(int id) { //IL_0014: 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_0066: Unknown result type (might be due to invalid IL or missing references) //IL_029c: 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_011c: 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_00fb: 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_01f5: 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_0226: Unknown result type (might be due to invalid IL or missing references) GUI.Label(new Rect(24f, 16f, 600f, 34f), "HoverLoot / Настройки", title); GUI.Label(new Rect(25f, 53f, 650f, 22f), "1.6 · F6 или Option+H — панель · F7 или Option+J — скрыть эффекты", small); if (GUI.Button(new Rect(896f, 19f, 40f, 34f), "×", button)) { Close(); } string[] array = new string[4] { "Внешний вид", "Фильтры", "Предметы", "План мода" }; for (int i = 0; i < 4; i++) { if (GUI.Button(new Rect((float)(24 + i * 150), 87f, 142f, 34f), array[i], (tab == i) ? activeButton : button)) { tab = i; scroll = Vector2.zero; } } if (GUI.Button(new Rect(745f, 87f, 191f, 34f), "Сбросить изменения", button)) { draft = PanelDraft.Load(); status = "Вернул сохранённые настройки."; } if (tab == 0) { Appearance(); } else if (tab == 1) { Filters(); } else if (tab == 2) { Items(); } else { Roadmap(); } Preview(); GUI.Label(new Rect(24f, 616f, 630f, 42f), status, small); if (Plugin.EffectsHidden) { GUI.Label(new Rect(684f, 55f, 250f, 24f), "Эффекты временно скрыты", small); } if (GUI.Button(new Rect(670f, 633f, 125f, 36f), "Отменить", button)) { Close(); } if (GUI.Button(new Rect(805f, 633f, 132f, 36f), "Применить", activeButton)) { try { string text = draft.Apply(); status = text ?? "Сохранено. Изменения применены к предметам в мире."; if (text == null) { draft = PanelDraft.Load(); } } catch (Exception ex) { status = "Не удалось сохранить: " + ex.Message; Debug.LogError((object)ex); } } GUI.DragWindow(new Rect(0f, 0f, 880f, 75f)); } private bool Check(float x, float y, float width, string text, bool value) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) return GUI.Toggle(new Rect(x, y, width, 25f), value, text, toggle); } private float Slider(float y, string text, float value, float min, float max, string unit = "", float step = 0f) { //IL_0010: 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_007a: Unknown result type (might be due to invalid IL or missing references) GUI.Label(new Rect(25f, y, 285f, 23f), text, label); GUI.Label(new Rect(450f, y, 165f, 23f), value.ToString((step >= 1f) ? "0" : "0.00") + unit, small); float num = GUI.HorizontalSlider(new Rect(310f, y + 7f, 125f, 18f), value, min, max); if (!(step > 0f)) { return num; } return Mathf.Round(num / step) * step; } private int Choices(float y, string text, string[] values, int current) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) GUI.Label(new Rect(25f, y, 580f, 22f), text, label); float num = 580f / (float)values.Length; for (int i = 0; i < values.Length; i++) { if (GUI.Button(new Rect(25f + (float)i * num, y + 27f, num - 6f, 28f), values[i], (current == i) ? activeButton : button)) { current = i; } } return current; } private void Appearance() { //IL_0314: Unknown result type (might be due to invalid IL or missing references) //IL_0285: Unknown result type (might be due to invalid IL or missing references) //IL_02b4: Unknown result type (might be due to invalid IL or missing references) //IL_02eb: Unknown result type (might be due to invalid IL or missing references) draft.enabled = Check(25f, 140f, 220f, "Мод включён", draft.enabled); draft.hover = Check(25f, 175f, 150f, "Парение", draft.hover); draft.spin = Check(205f, 175f, 160f, "Вращение", draft.spin); draft.glow = Check(395f, 175f, 200f, "Мягкое свечение", draft.glow); draft.particles = Check(25f, 208f, 420f, "Показывать ванильные частицы", draft.particles); draft.height = Slider(249f, "Высота", draft.height, 0f, 2f, " м", 0.025f); draft.speed = Slider(281f, "Скорость вращения", draft.speed, -180f, 180f, " °/с", 5f); draft.radius = Slider(313f, "Мягкость / радиус ореола", draft.radius, 1f, 6f, " px", 0.1f); draft.strength = Slider(345f, "Яркость ореола", draft.strength, 0f, 1f, "", 0.025f); draft.visibility = Choices(385f, "Когда показывать свечение", new string[3] { "Постоянно", "Только рядом", "При наведении" }, draft.visibility); draft.colorMode = Choices(453f, "Цвет свечения", new string[3] { "Палитра частиц", "Один цвет", "По категориям" }, draft.colorMode); if (draft.colorMode == 1) { GUI.Label(new Rect(25f, 520f, 180f, 25f), "Общий цвет", label); draft.single = GUI.TextField(new Rect(205f, 519f, 145f, 28f), draft.single, 9, field); Swatch(new Rect(365f, 520f, 30f, 25f), draft.single); } GUI.Label(new Rect(25f, 558f, 585f, 30f), "Изменения в мире вступают в силу после «Применить».", small); } private void Filters() { //IL_0014: 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_0075: 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) GUI.Label(new Rect(25f, 140f, 590f, 24f), "Категории: отдельно включай каждый эффект", label); GUI.Label(new Rect(270f, 174f, 340f, 22f), "Вкл. Парит Крутится Светится Цвет", small); for (int i = 0; i < 6; i++) { float num = 207 + i * 43; GUI.Label(new Rect(25f, num, 240f, 29f), ModSettings.Names[i], label); draft.categories[i] = Check(278f, num, 30f, "", draft.categories[i]); draft.floats[i] = Check(332f, num, 30f, "", draft.floats[i]); draft.spins[i] = Check(396f, num, 30f, "", draft.spins[i]); draft.glows[i] = Check(473f, num, 30f, "", draft.glows[i]); draft.colors[i] = GUI.TextField(new Rect(520f, num - 1f, 92f, 26f), draft.colors[i], 9, field); } draft.distance = Slider(487f, "Дальность эффектов", draft.distance, 5f, 100f, " м", 1f); draft.range = Slider(519f, "Дальность свечения", draft.range, 3f, Mathf.Max(3f, draft.distance), " м", 1f); draft.limit = (int)Slider(551f, "Лимит подсвеченных вещей", draft.limit, 1f, 150f, "", 1f); draft.nearby = Slider(583f, "Радиус «Только рядом»", draft.nearby, 1f, Mathf.Max(1f, draft.range), " м", 0.5f); } private void Items() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) GUI.Label(new Rect(25f, 139f, 590f, 24f), "Исключения для отдельных вещей", label); search = GUI.TextField(new Rect(25f, 173f, 585f, 30f), search, 80, field); GUI.Label(new Rect(25f, 209f, 590f, 23f), "Поиск по названию или prefab ID. Исключено: " + draft.excluded.Count, small); List<ItemDrop> list = catalog.Where((ItemDrop x) => Name(x).IndexOf(search, StringComparison.CurrentCultureIgnoreCase) >= 0 || ModSettings.Prefab(x).IndexOf(search, StringComparison.OrdinalIgnoreCase) >= 0).ToList(); scroll = GUI.BeginScrollView(new Rect(25f, 238f, 590f, 344f), scroll, new Rect(0f, 0f, 566f, (float)Mathf.Max(340, list.Count * 39))); int num = Mathf.Max(0, (int)(scroll.y / 39f) - 1); int num2 = Mathf.Min(list.Count, num + 12); for (int num3 = num; num3 < num2; num3++) { ItemDrop val = list[num3]; string text = ModSettings.Prefab(val); float num4 = num3 * 39; if (GUI.Button(new Rect(0f, num4, 368f, 34f), Name(val) + " · " + text, ((Object)(object)selected == (Object)(object)val) ? activeButton : button)) { selected = val; } bool flag = draft.excluded.Contains(text); if (GUI.Button(new Rect(377f, num4, 173f, 34f), flag ? "Исключён ↩" : "Исключить", flag ? activeButton : button)) { if (flag) { draft.excluded.Remove(text); } else { draft.excluded.Add(text); } } } GUI.EndScrollView(); } private void Roadmap() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) string text = "Сохранено для следующих итераций\n\n• Настройки источника дропа: игрок / враги.\n• Название и количество над предметом.\n• Плавное появление и исчезновение ореола.\n• Кнопка исключения прямо в инвентаре.\n• Настоящий 3D-предпросмотр.\n• Импорт и экспорт пресетов.\n• Библиотека выдачи вещей для тестирования.\n\nВ этой версии: переключатели эффектов, ползунки, цвета, категории, поиск исключений, пресеты и временное скрытие."; GUI.Label(new Rect(25f, 144f, 580f, 420f), text, label); } private void Swatch(Rect rect, string color) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //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_0015: Unknown result type (might be due to invalid IL or missing references) Color color2 = GUI.color; GUI.color = ModSettings.ReadColor(color, Color.white); GUI.DrawTexture(rect, (Texture)(object)Texture2D.whiteTexture); GUI.color = color2; } private void Preview() { //IL_0014: 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_03c6: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_0422: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: 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_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_02ce: Unknown result type (might be due to invalid IL or missing references) //IL_02fd: Unknown result type (might be due to invalid IL or missing references) //IL_0333: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_039d: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Unknown result type (might be due to invalid IL or missing references) //IL_0232: 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_02b2: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Unknown result type (might be due to invalid IL or missing references) GUI.DrawTexture(new Rect(641f, 140f, 294f, 448f), (Texture)(object)section); GUI.Label(new Rect(662f, 155f, 250f, 27f), "Предпросмотр · иконка", label); string text; int num; Color color; int num2; float num3; if ((Object)(object)selected != (Object)null) { text = ModSettings.Prefab(selected); num = ModSettings.CategoryOf(selected); string source; Color val = ParticlePalette.Read(selected, out source); color = ((draft.colorMode == 1) ? ModSettings.ReadColor(draft.single, val) : ((draft.colorMode == 2) ? ModSettings.ReadColor(draft.colors[num], val) : val)); if (draft.enabled && draft.categories[num]) { num2 = ((!draft.excluded.Contains(text)) ? 1 : 0); if (num2 != 0 && draft.hover && draft.floats[num]) { num3 = draft.height * 25f; goto IL_0135; } } else { num2 = 0; } num3 = 0f; goto IL_0135; } goto IL_03b2; IL_0135: float num4 = num3; float num5 = 302f - num4; Color color2 = GUI.color; if (num2 != 0 && draft.glow && draft.glows[num]) { color.a = draft.strength * 0.5f; GUI.color = color; float num6 = 112f + draft.radius * 12f; GUI.DrawTexture(new Rect(788f - num6 / 2f, num5 - num6 / 2f, num6, num6), (Texture)(object)halo); GUI.color = color2; } Sprite[] icons = selected.m_itemData.m_shared.m_icons; if (icons != null && icons.Length != 0 && (Object)(object)icons[0] != (Object)null) { Sprite val2 = icons[0]; Rect val3 = ((val2.packed && (int)val2.packingMode == 0) ? val2.rect : val2.textureRect); ((Rect)(ref val3))..ctor(((Rect)(ref val3)).x / (float)((Texture)val2.texture).width, ((Rect)(ref val3)).y / (float)((Texture)val2.texture).height, ((Rect)(ref val3)).width / (float)((Texture)val2.texture).width, ((Rect)(ref val3)).height / (float)((Texture)val2.texture).height); GUI.DrawTextureWithTexCoords(new Rect(736f, num5 - 52f, 104f, 104f), (Texture)(object)val2.texture, val3, true); } GUI.Label(new Rect(660f, 385f, 255f, 42f), Name(selected), label); GUI.Label(new Rect(660f, 428f, 255f, 40f), ModSettings.Names[num] + "\n" + text, small); if (GUI.Button(new Rect(660f, 485f, 255f, 30f), draft.excluded.Contains(text) ? "Вернуть эффекты предмету" : "Исключить этот предмет", button) && !draft.excluded.Remove(text)) { draft.excluded.Add(text); } GUI.Label(new Rect(660f, 529f, 255f, 45f), "Проверяй реальное вращение и ореол в мире после применения.", small); goto IL_03b2; IL_03b2: GUI.Label(new Rect(660f, 596f, 270f, 25f), "Пресеты — загрузить в панель", small); string[] array = new string[4] { "Базовый", "Минимум", "Minecraft", "Снаряжение" }; for (int i = 0; i < 4; i++) { if (GUI.Button(new Rect((float)(25 + i * 147), 633f, 139f, 36f), array[i], button)) { draft = PanelDraft.Preset(i); status = "Пресет «" + array[i] + "» загружен. Нажми «Применить»."; } } } private void OnDestroy() { if (Open) { Close(); } Harmony obj = harmony; if (obj != null) { obj.UnpatchSelf(); } Texture2D[] array = (Texture2D[])(object)new Texture2D[4] { background, section, accent, halo }; foreach (Texture2D val in array) { if ((Object)(object)val != (Object)null) { Object.Destroy((Object)(object)val); } } } } internal static class PanelInput { internal static bool PlayerInput(ref bool __result) { if (!AdminPanel.BlockInput) { return true; } __result = false; return false; } internal static bool CameraInput() { return !AdminPanel.BlockInput; } internal static bool MenuInput() { return !AdminPanel.BlockInput; } internal static bool BlockGameButton(ref bool __result) { if (!AdminPanel.BlockInput) { return true; } __result = false; return false; } internal static bool MouseCapture() { if (!AdminPanel.Open) { return true; } Cursor.lockState = (CursorLockMode)0; Cursor.visible = true; return false; } } [BepInPlugin("local.hoverloot", "HoverLoot", "1.6.0")] public sealed class Plugin : BaseUnityPlugin { internal static ConfigEntry<float> Height; internal static ConfigEntry<float> Rotation; internal static ConfigEntry<float> OutlineDistance; internal static ConfigEntry<float> GlowRadius; internal static ConfigEntry<float> GlowStrength; internal static ConfigEntry<bool> Enabled; internal static ConfigEntry<bool> OutlineEnabled; internal static Camera ViewCamera; private static readonly HashSet<string> LoggedPrefabs = new HashSet<string>(); internal static Plugin Instance; internal static bool EffectsHidden; private float nextScan; private void Awake() { Instance = this; Enabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Visual", "Enabled", true, "Enable stationary hovering dropped items."); Height = ((BaseUnityPlugin)this).Config.Bind<float>("Visual", "Height", 0.675f, "Hover lift in metres."); Rotation = ((BaseUnityPlugin)this).Config.Bind<float>("Visual", "RotationSpeed", 45f, "Spin around the vertical axis, degrees per second."); OutlineEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Glow", "Enabled", true, "Soft alpha-aware halo outside the item silhouette."); OutlineDistance = ((BaseUnityPlugin)this).Config.Bind<float>("Glow", "MaxDistance", 30f, "Halo visibility distance, metres."); GlowRadius = ((BaseUnityPlugin)this).Config.Bind<float>("Glow", "RadiusPixels", 2.2f, "Gaussian blur radius in screen pixels."); GlowStrength = ((BaseUnityPlugin)this).Config.Bind<float>("Glow", "Strength", 0.65f, "Soft halo opacity budget, 0 to 1."); ModSettings.Bind(((BaseUnityPlugin)this).Config); ((Component)this).gameObject.AddComponent<AdminPanel>(); bool flag = SoftGlow.Initialize(); if (!flag) { ((BaseUnityPlugin)this).Logger.LogWarning((object)"Alpha-mask shader unavailable; glow disabled, original item textures preserved."); } ((BaseUnityPlugin)this).Logger.LogInfo((object)("HoverLoot 1.6.0 ready: in-game settings F6 / Alt+H; alpha-aware soft glow, native palette, hover-aligned interaction. Glow ready: " + flag)); } private void Update() { if (Time.unscaledTime < nextScan) { return; } nextScan = Time.unscaledTime + 0.25f; ViewCamera = Camera.main; if (SoftGlow.Ready && (Object)(object)ViewCamera != (Object)null && (Object)(object)((Component)ViewCamera).GetComponent<SoftGlowCamera>() == (Object)null) { ((Component)ViewCamera).gameObject.AddComponent<SoftGlowCamera>(); } ItemDrop[] array = Object.FindObjectsOfType<ItemDrop>(); foreach (ItemDrop val in array) { if ((Object)(object)((Component)val).GetComponent<HoverVisual>() == (Object)null) { ((Component)val).gameObject.AddComponent<HoverVisual>(); } if ((Object)(object)((Component)val).GetComponent<LootParticles>() == (Object)null) { ((Component)val).gameObject.AddComponent<LootParticles>(); } } } private void OnDestroy() { HoverVisual[] array = Object.FindObjectsOfType<HoverVisual>(); for (int i = 0; i < array.Length; i++) { Object.DestroyImmediate((Object)(object)array[i]); } AdminPanel component = ((Component)this).GetComponent<AdminPanel>(); if ((Object)(object)component != (Object)null) { Object.DestroyImmediate((Object)(object)component); } LootParticles[] array2 = Object.FindObjectsOfType<LootParticles>(); for (int i = 0; i < array2.Length; i++) { Object.DestroyImmediate((Object)(object)array2[i]); } SoftGlow.Dispose(); LoggedPrefabs.Clear(); Instance = null; } internal static Color GlowColor(ItemDrop drop) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) string source; Color val = ParticlePalette.Read(drop, out source); string text = ((Object)drop).name.Replace("(Clone)", "").Trim(); if (LoggedPrefabs.Add(text) && (Object)(object)Instance != (Object)null) { ((BaseUnityPlugin)Instance).Logger.LogInfo((object)("Particle glow " + text + ": #" + ColorUtility.ToHtmlStringRGB(val) + " from " + source)); } return ModSettings.ColorFor(drop, val); } } public sealed class HoverVisual : MonoBehaviour { private sealed class Copy { internal Renderer original; internal MeshRenderer display; internal BoxCollider target; internal SoftGlow.Source glow; } private readonly List<Collider> hiddenColliders = new List<Collider>(); private readonly List<Copy> copies = new List<Copy>(); private readonly List<Mesh> bakedMeshes = new List<Mesh>(); private ItemDrop drop; private Rigidbody body; private Collider[] itemColliders; private GameObject pivot; private RigidbodyConstraints savedConstraints; private bool anchored; private bool constrained; private float age; private float groundedTime; private float angle; private Vector3 anchor; private void Awake() { drop = ((Component)this).GetComponent<ItemDrop>(); body = ((Component)this).GetComponent<Rigidbody>(); itemColliders = ((Component)this).GetComponentsInChildren<Collider>(); } private bool Grounded() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_006e: 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) //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_0087: 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_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: 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_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) Bounds bounds = default(Bounds); ((Bounds)(ref bounds))..ctor(((Component)this).transform.position, Vector3.zero); bool flag = false; Collider[] array = itemColliders; foreach (Collider val in array) { if (!((Object)(object)val == (Object)null) && val.enabled && !val.isTrigger) { if (!flag) { bounds = val.bounds; flag = true; } else { ((Bounds)(ref bounds)).Encapsulate(val.bounds); } } } RaycastHit[] array2 = Physics.RaycastAll(((Bounds)(ref bounds)).center + Vector3.up * 0.1f, Vector3.down, ((Bounds)(ref bounds)).extents.y + 0.35f, -5, (QueryTriggerInteraction)1); for (int i = 0; i < array2.Length; i++) { RaycastHit val2 = array2[i]; if (!((Component)((RaycastHit)(ref val2)).collider).transform.IsChildOf(((Component)this).transform) && !((Object)(object)((Component)((RaycastHit)(ref val2)).collider).GetComponentInParent<ItemDrop>() != (Object)null) && !(((RaycastHit)(ref val2)).normal.y < 0.3f)) { return true; } } return false; } private void FixedUpdate() { //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) if (!ModSettings.Applies(drop)) { return; } if (anchored) { UpdateTargets(); return; } age += Time.fixedDeltaTime; if (age < 0.25f) { return; } bool flag = Grounded() && ((Object)(object)body == (Object)null || body.isKinematic || body.velocity.y <= 0.5f); groundedTime = (flag ? (groundedTime + Time.fixedDeltaTime) : 0f); if ((groundedTime < 0.12f && !((Object)(object)body != (Object)null && body.IsSleeping() && flag)) || !BuildDisplay()) { return; } if ((Object)(object)body != (Object)null) { savedConstraints = body.constraints; if (!body.isKinematic) { body.velocity = Vector3.zero; body.angularVelocity = Vector3.zero; } body.constraints = (RigidbodyConstraints)126; constrained = true; } anchored = true; UpdateDisplayPose(); UpdateTargets(); } private bool BuildDisplay() { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Expected O, but got Unknown //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: 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_00a0: 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_0257: Unknown result type (might be due to invalid IL or missing references) //IL_026f: Unknown result type (might be due to invalid IL or missing references) //IL_027d: Unknown result type (might be due to invalid IL or missing references) //IL_02c9: Unknown result type (might be due to invalid IL or missing references) //IL_02d0: Expected O, but got Unknown //IL_0310: Unknown result type (might be due to invalid IL or missing references) //IL_0315: Unknown result type (might be due to invalid IL or missing references) //IL_0319: Unknown result type (might be due to invalid IL or missing references) //IL_0325: Unknown result type (might be due to invalid IL or missing references) //IL_032a: Unknown result type (might be due to invalid IL or missing references) //IL_032e: Unknown result type (might be due to invalid IL or missing references) //IL_0333: 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_034d: Unknown result type (might be due to invalid IL or missing references) //IL_035e: Unknown result type (might be due to invalid IL or missing references) //IL_036f: Unknown result type (might be due to invalid IL or missing references) //IL_038e: Unknown result type (might be due to invalid IL or missing references) //IL_03c4: 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_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Expected O, but got Unknown Renderer[] componentsInChildren = ((Component)this).GetComponentsInChildren<Renderer>(); Bounds bounds = default(Bounds); ((Bounds)(ref bounds))..ctor(((Component)this).transform.position, Vector3.zero); bool flag = false; Renderer[] array = componentsInChildren; foreach (Renderer val in array) { if (!val.enabled || !((Component)val).gameObject.activeInHierarchy) { continue; } MeshFilter component = ((Component)val).GetComponent<MeshFilter>(); SkinnedMeshRenderer val2 = (SkinnedMeshRenderer)(object)((val is SkinnedMeshRenderer) ? val : null); if ((val is MeshRenderer && (Object)(object)component != (Object)null && (Object)(object)component.sharedMesh != (Object)null) || ((Object)(object)val2 != (Object)null && (Object)(object)val2.sharedMesh != (Object)null)) { if (!flag) { bounds = val.bounds; flag = true; } else { ((Bounds)(ref bounds)).Encapsulate(val.bounds); } } } if (!flag) { return false; } anchor = ((Bounds)(ref bounds)).center; pivot = new GameObject("HoverLoot_Display"); pivot.transform.position = anchor; Color color = Plugin.GlowColor(drop); int layer = ((Component)this).gameObject.layer; Collider[] array2 = itemColliders; foreach (Collider val3 in array2) { if ((Object)(object)val3 != (Object)null && val3.enabled && !val3.isTrigger) { layer = ((Component)val3).gameObject.layer; break; } } array = componentsInChildren; foreach (Renderer val4 in array) { if (val4.enabled && ((Component)val4).gameObject.activeInHierarchy) { Mesh val5 = null; MeshFilter component2 = ((Component)val4).GetComponent<MeshFilter>(); SkinnedMeshRenderer val6 = (SkinnedMeshRenderer)(object)((val4 is SkinnedMeshRenderer) ? val4 : null); if (val4 is MeshRenderer && (Object)(object)component2 != (Object)null) { val5 = component2.sharedMesh; } if ((Object)(object)val6 != (Object)null && (Object)(object)val6.sharedMesh != (Object)null) { val5 = new Mesh { name = "HoverLoot_Baked" }; val6.BakeMesh(val5); bakedMeshes.Add(val5); } if (!((Object)(object)val5 == (Object)null)) { MeshRenderer val7 = CreateMesh("Model", val5, val4.sharedMaterials, pivot.transform); ((Component)val7).transform.position = ((Component)val4).transform.position; ((Component)val7).transform.rotation = ((Component)val4).transform.rotation; ((Component)val7).transform.localScale = ((Component)val4).transform.lossyScale; ((Renderer)val7).shadowCastingMode = val4.shadowCastingMode; ((Renderer)val7).receiveShadows = val4.receiveShadows; ((Component)val7).gameObject.layer = ((Component)val4).gameObject.layer; Copy copy = new Copy { original = val4, display = val7 }; GameObject val8 = new GameObject("HoverLoot_Interaction"); val8.layer = layer; val8.transform.SetParent(((Component)this).transform, false); copy.target = val8.AddComponent<BoxCollider>(); ((Collider)copy.target).enabled = false; BoxCollider target = copy.target; Bounds bounds2 = val5.bounds; target.center = ((Bounds)(ref bounds2)).center; bounds2 = val5.bounds; Vector3 size = ((Bounds)(ref bounds2)).size; copy.target.size = new Vector3(Mathf.Max(size.x, 0.025f), Mathf.Max(size.y, 0.025f), Mathf.Max(size.z, 0.025f)); ((Collider)copy.target).isTrigger = false; ((Collider)copy.target).excludeLayers = LayerMask.op_Implicit(-1); ((Collider)copy.target).layerOverridePriority = int.MaxValue; copies.Add(copy); val4.enabled = false; copy.glow = SoftGlow.Add(val7, val5, color, drop); } } } array2 = itemColliders; foreach (Collider val9 in array2) { if (!((Object)(object)val9 == (Object)null) && val9.enabled) { hiddenColliders.Add(val9); val9.enabled = false; } } return true; } private void UpdateDisplayPose() { //IL_001b: 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_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: 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) if (!((Object)(object)pivot == (Object)null)) { pivot.transform.position = anchor + Vector3.up * (ModSettings.Floats(drop) ? Mathf.Clamp(Plugin.Height.Value, 0f, 3f) : 0f); pivot.transform.rotation = Quaternion.Euler(0f, angle, 0f); } } private void UpdateTargets() { //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_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0071: 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_0078: 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_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: 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) foreach (Copy copy in copies) { if (!((Object)(object)copy.target == (Object)null) && !((Object)(object)copy.display == (Object)null)) { Transform transform = ((Component)copy.target).transform; Transform transform2 = ((Component)copy.display).transform; transform.SetPositionAndRotation(transform2.position, transform2.rotation); Vector3 lossyScale = ((Component)this).transform.lossyScale; Vector3 lossyScale2 = transform2.lossyScale; transform.localScale = new Vector3(SafeDivide(lossyScale2.x, lossyScale.x), SafeDivide(lossyScale2.y, lossyScale.y), SafeDivide(lossyScale2.z, lossyScale.z)); ((Collider)copy.target).enabled = true; } } } private static float SafeDivide(float value, float scale) { if (!(Mathf.Abs(scale) > 1E-05f)) { return value; } return value / scale; } private static MeshRenderer CreateMesh(string name, Mesh mesh, Material[] materials, Transform parent) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name); val.transform.SetParent(parent, false); val.AddComponent<MeshFilter>().sharedMesh = mesh; MeshRenderer obj = val.AddComponent<MeshRenderer>(); ((Renderer)obj).sharedMaterials = materials; return obj; } private void LateUpdate() { if (!ModSettings.Applies(drop)) { if (anchored) { Restore(); } } else { if (!anchored || (Object)(object)pivot == (Object)null) { return; } angle = (angle + (ModSettings.Rotates(drop) ? (Mathf.Clamp(Plugin.Rotation.Value, -720f, 720f) * Time.deltaTime) : 0f)) % 360f; UpdateDisplayPose(); UpdateTargets(); foreach (Copy copy in copies) { if ((Object)(object)copy.original != (Object)null) { copy.original.enabled = false; } } } } internal void ResetVisual() { Restore(); } private void Restore() { //IL_0169: Unknown result type (might be due to invalid IL or missing references) foreach (Copy copy in copies) { SoftGlow.Remove(copy.glow); if ((Object)(object)copy.original != (Object)null) { copy.original.enabled = true; } if ((Object)(object)copy.target != (Object)null) { ((Collider)copy.target).enabled = false; Object.Destroy((Object)(object)((Component)copy.target).gameObject); } } foreach (Collider hiddenCollider in hiddenColliders) { if ((Object)(object)hiddenCollider != (Object)null) { hiddenCollider.enabled = true; } } hiddenColliders.Clear(); copies.Clear(); if ((Object)(object)pivot != (Object)null) { pivot.SetActive(false); Object.Destroy((Object)(object)pivot); pivot = null; } foreach (Mesh bakedMesh in bakedMeshes) { if ((Object)(object)bakedMesh != (Object)null) { Object.Destroy((Object)(object)bakedMesh); } } bakedMeshes.Clear(); if (constrained && (Object)(object)body != (Object)null) { body.constraints = savedConstraints; } constrained = (anchored = false); age = (groundedTime = (angle = 0f)); } private void OnDisable() { Restore(); } private void OnDestroy() { Restore(); } } public sealed class LootParticles : MonoBehaviour { private sealed class State { internal ParticleSystem system; internal ParticleSystemRenderer renderer; internal bool playing; internal bool visible; } private readonly List<State> states = new List<State>(); private ItemDrop drop; private bool hidden; private void Awake() { drop = ((Component)this).GetComponent<ItemDrop>(); ParticleSystem[] componentsInChildren = ((Component)this).GetComponentsInChildren<ParticleSystem>(true); foreach (ParticleSystem val in componentsInChildren) { ParticleSystemRenderer component = ((Component)val).GetComponent<ParticleSystemRenderer>(); states.Add(new State { system = val, renderer = component, playing = val.isPlaying, visible = ((Object)(object)component != (Object)null && ((Renderer)component).enabled) }); } } private void LateUpdate() { if (!ModSettings.Allowed(drop) || ModSettings.Particles.Value) { Restore(); return; } foreach (State state in states) { if ((Object)(object)state.renderer != (Object)null) { ((Renderer)state.renderer).enabled = false; } if ((Object)(object)state.system != (Object)null && state.system.isPlaying) { state.system.Stop(true, (ParticleSystemStopBehavior)0); } } hidden = true; } private void Restore() { if (!hidden) { return; } foreach (State state in states) { if ((Object)(object)state.renderer != (Object)null) { ((Renderer)state.renderer).enabled = state.visible; } if (state.playing && (Object)(object)state.system != (Object)null) { state.system.Play(true); } } hidden = false; } private void OnDisable() { Restore(); } private void OnDestroy() { Restore(); } } internal static class ModSettings { internal sealed class Category { internal ConfigEntry<bool> Enabled; internal ConfigEntry<bool> Hover; internal ConfigEntry<bool> Spin; internal ConfigEntry<bool> Glow; internal ConfigEntry<string> Color; } internal static readonly string[] Keys = new string[6] { "Gear", "Armor", "Consumables", "Resources", "Valuables", "Other" }; internal static readonly string[] Names = new string[6] { "Оружие и инструменты", "Броня и аксессуары", "Еда и зелья", "Ресурсы", "Трофеи и ценности", "Прочее" }; internal static readonly Category[] Categories = new Category[6]; internal static ConfigEntry<bool> Hover; internal static ConfigEntry<bool> Spin; internal static ConfigEntry<bool> Particles; internal static ConfigEntry<float> EffectDistance; internal static ConfigEntry<float> NearDistance; internal static ConfigEntry<int> GlowLimit; internal static ConfigEntry<int> ColorMode; internal static ConfigEntry<int> Visibility; internal static ConfigEntry<string> SingleColor; internal static ConfigEntry<string> Excluded; internal static void Bind(ConfigFile config) { config.SaveOnConfigSet = false; Hover = config.Bind<bool>("Effects", "Hover", true, "Lift item models."); Spin = config.Bind<bool>("Effects", "Spin", true, "Rotate item models."); Particles = config.Bind<bool>("Effects", "VanillaParticles", false, "Show original particle effects."); EffectDistance = config.Bind<float>("Effects", "MaxDistance", 60f, "Maximum distance for item effects."); NearDistance = config.Bind<float>("Glow", "NearbyDistance", 8f, "Glow range in Nearby mode."); GlowLimit = config.Bind<int>("Glow", "MaxItems", 48, "Nearest item limit for glow; multi-mesh items count once."); Visibility = config.Bind<int>("Glow", "Visibility", 0, "0 constant, 1 nearby, 2 crosshair hover only."); ColorMode = config.Bind<int>("Colors", "Mode", 0, "0 native particle palette, 1 single colour, 2 category colours."); SingleColor = config.Bind<string>("Colors", "SingleColor", "#E1C24C", "Single glow colour."); Excluded = config.Bind<string>("Filters", "ExcludedPrefabs", "", "Prefab IDs excluded from effects, separated by semicolons."); string[] array = new string[6] { "#E9BE65", "#91B7E8", "#E68B87", "#A3CF99", "#C29BE8", "#D7D9DE" }; for (int i = 0; i < Keys.Length; i++) { string text = "Category." + Keys[i]; Categories[i] = new Category { Enabled = config.Bind<bool>(text, "Enabled", true, "Apply effects to this category."), Hover = config.Bind<bool>(text, "Hover", true, "Allow hovering."), Spin = config.Bind<bool>(text, "Spin", true, "Allow rotation."), Glow = config.Bind<bool>(text, "Glow", true, "Allow glow."), Color = config.Bind<string>(text, "Color", array[i], "Category glow colour.") }; } config.Save(); } internal static string Prefab(ItemDrop drop) { if (drop.m_itemData == null || !((Object)(object)drop.m_itemData.m_dropPrefab != (Object)null)) { return ((Object)drop).name.Replace("(Clone)", "").Trim(); } return ((Object)drop.m_itemData.m_dropPrefab).name; } internal static int CategoryOf(ItemDrop drop) { SharedData val = ((drop.m_itemData == null) ? null : drop.m_itemData.m_shared); if (val == null) { return 5; } return Classify(((object)Unsafe.As<ItemType, ItemType>(ref val.m_itemType)/*cast due to .constrained prefix*/).ToString(), val.m_value, val.m_questItem, val.m_food, val.m_foodStamina, val.m_foodEitr); } internal static int Classify(string type, int value, bool quest, float food, float stamina, float eitr) { if (type == "Trophy" || value > 0 || quest) { return 4; } switch (type) { case "Helmet": case "Chest": case "Legs": case "Shoulder": case "Utility": return 1; default: if (!(food > 0f) && !(stamina > 0f) && !(eitr > 0f)) { if (!type.Contains("Weapon")) { switch (type) { case "Bow": case "Tool": case "Shield": case "Torch": case "Ammo": break; case "Material": return 3; default: return 5; } } return 0; } goto case "Consumable"; case "Consumable": case "Fish": return 2; } } internal static bool IsExcluded(string prefab) { string[] array = Excluded.Value.Split(';'); for (int i = 0; i < array.Length; i++) { if (string.Equals(array[i].Trim(), prefab, StringComparison.OrdinalIgnoreCase)) { return true; } } return false; } internal static bool Allowed(ItemDrop drop) { //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)drop == (Object)null || !Plugin.Enabled.Value || Plugin.EffectsHidden) { return false; } if (!Categories[CategoryOf(drop)].Enabled.Value || IsExcluded(Prefab(drop))) { return false; } if (!((Object)(object)Player.m_localPlayer == (Object)null)) { return Vector3.Distance(((Component)Player.m_localPlayer).transform.position, ((Component)drop).transform.position) <= EffectDistance.Value; } return true; } internal static bool Applies(ItemDrop drop) { if (Allowed(drop)) { if (!Floats(drop) && !Rotates(drop)) { return Glows(drop); } return true; } return false; } internal static bool Floats(ItemDrop drop) { if (Hover.Value) { return Categories[CategoryOf(drop)].Hover.Value; } return false; } internal static bool Rotates(ItemDrop drop) { if (Spin.Value) { return Categories[CategoryOf(drop)].Spin.Value; } return false; } internal static bool Glows(ItemDrop drop) { if (Plugin.OutlineEnabled.Value) { return Categories[CategoryOf(drop)].Glow.Value; } return false; } internal static Color ReadColor(string text, Color fallback) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) Color result = default(Color); if (!ColorUtility.TryParseHtmlString(text, ref result)) { return fallback; } return result; } internal static Color ColorFor(ItemDrop drop, Color native) { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0044: 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_0033: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) if (ColorMode.Value != 1) { if (ColorMode.Value != 2) { return native; } return ReadColor(Categories[CategoryOf(drop)].Color.Value, native); } return ReadColor(SingleColor.Value, native); } internal static void Refresh() { HoverVisual[] array = Object.FindObjectsOfType<HoverVisual>(); for (int i = 0; i < array.Length; i++) { array[i].ResetVisual(); } ((BaseUnityPlugin)Plugin.Instance).Config.Save(); } } internal sealed class PanelDraft { internal bool enabled; internal bool hover; internal bool spin; internal bool glow; internal bool particles; internal float height; internal float speed; internal float radius; internal float strength; internal float range; internal float distance; internal float nearby; internal int visibility; internal int colorMode; internal int limit; internal string single; internal bool[] categories = new bool[6]; internal bool[] floats = new bool[6]; internal bool[] spins = new bool[6]; internal bool[] glows = new bool[6]; internal string[] colors = new string[6]; internal HashSet<string> excluded = new HashSet<string>(StringComparer.OrdinalIgnoreCase); internal static PanelDraft Load() { PanelDraft panelDraft = new PanelDraft { enabled = Plugin.Enabled.Value, hover = ModSettings.Hover.Value, spin = ModSettings.Spin.Value, glow = Plugin.OutlineEnabled.Value, particles = ModSettings.Particles.Value, height = Plugin.Height.Value, speed = Plugin.Rotation.Value, radius = Plugin.GlowRadius.Value, strength = Plugin.GlowStrength.Value, range = Plugin.OutlineDistance.Value, distance = ModSettings.EffectDistance.Value, nearby = ModSettings.NearDistance.Value, visibility = ModSettings.Visibility.Value, colorMode = ModSettings.ColorMode.Value, single = ModSettings.SingleColor.Value, limit = ModSettings.GlowLimit.Value }; for (int i = 0; i < 6; i++) { ModSettings.Category category = ModSettings.Categories[i]; panelDraft.categories[i] = category.Enabled.Value; panelDraft.floats[i] = category.Hover.Value; panelDraft.spins[i] = category.Spin.Value; panelDraft.glows[i] = category.Glow.Value; panelDraft.colors[i] = category.Color.Value; } string[] array = ModSettings.Excluded.Value.Split(';'); foreach (string text in array) { if (!string.IsNullOrWhiteSpace(text)) { panelDraft.excluded.Add(text.Trim()); } } return panelDraft; } internal static PanelDraft Preset(int preset) { PanelDraft panelDraft = new PanelDraft { enabled = true, hover = true, spin = true, glow = true, particles = false, height = 0.675f, speed = 45f, radius = 2.2f, strength = 0.65f, range = 30f, distance = 60f, nearby = 8f, limit = 48, single = "#E1C24C" }; string[] array = new string[6] { "#E9BE65", "#91B7E8", "#E68B87", "#A3CF99", "#C29BE8", "#D7D9DE" }; for (int i = 0; i < 6; i++) { bool[] array2 = panelDraft.categories; int num = i; bool[] array3 = panelDraft.floats; int num2 = i; bool flag; panelDraft.spins[i] = (flag = (panelDraft.glows[i] = true)); array3[num2] = (flag = flag); array2[num] = flag; panelDraft.colors[i] = array[i]; } if (preset == 1) { panelDraft.hover = (panelDraft.spin = false); panelDraft.visibility = 2; panelDraft.radius = 1.5f; panelDraft.strength = 0.35f; panelDraft.range = 15f; } if (preset == 2) { panelDraft.glow = false; } if (preset == 3) { bool[] array4 = panelDraft.categories; bool flag; panelDraft.categories[3] = (flag = (panelDraft.categories[5] = false)); array4[2] = flag; } return panelDraft; } internal string Apply() { Color val = default(Color); if (!ColorUtility.TryParseHtmlString(single, ref val)) { return "Общий цвет: нужен формат #RRGGBB."; } for (int i = 0; i < 6; i++) { if (!ColorUtility.TryParseHtmlString(colors[i], ref val)) { return "Проверь цвет категории «" + ModSettings.Names[i] + "»."; } } Plugin.Enabled.Value = enabled; ModSettings.Hover.Value = hover; ModSettings.Spin.Value = spin; Plugin.OutlineEnabled.Value = glow; ModSettings.Particles.Value = particles; Plugin.Height.Value = Mathf.Clamp(height, 0f, 2f); Plugin.Rotation.Value = Mathf.Clamp(speed, -180f, 180f); Plugin.GlowRadius.Value = Mathf.Clamp(radius, 1f, 6f); Plugin.GlowStrength.Value = Mathf.Clamp01(strength); ModSettings.EffectDistance.Value = Mathf.Clamp(distance, 5f, 100f); Plugin.OutlineDistance.Value = Mathf.Clamp(range, 3f, ModSettings.EffectDistance.Value); ModSettings.NearDistance.Value = Mathf.Clamp(nearby, 1f, Plugin.OutlineDistance.Value); ModSettings.GlowLimit.Value = Mathf.Clamp(limit, 1, 200); ModSettings.Visibility.Value = Mathf.Clamp(visibility, 0, 2); ModSettings.ColorMode.Value = Mathf.Clamp(colorMode, 0, 2); ModSettings.SingleColor.Value = single; for (int j = 0; j < 6; j++) { ModSettings.Category obj = ModSettings.Categories[j]; obj.Enabled.Value = categories[j]; obj.Hover.Value = floats[j]; obj.Spin.Value = spins[j]; obj.Glow.Value = glows[j]; obj.Color.Value = colors[j]; } ModSettings.Excluded.Value = string.Join(";", excluded.OrderBy<string, string>((string x) => x, StringComparer.OrdinalIgnoreCase)); ModSettings.Refresh(); return null; } } internal static class ParticlePalette { private static readonly string[] TintProperties = new string[3] { "_TintColor", "_BaseColor", "_Color" }; internal static Color Read(ItemDrop drop, out string source) { //IL_0053: 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_03a6: 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_0123: Expected O, but got Unknown //IL_012e: 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_015a: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: 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_01cd: 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_0188: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: 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_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_01de: 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_0218: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_021f: 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) //IL_0228: 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_01fa: 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) //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_0214: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Unknown result type (might be due to invalid IL or missing references) //IL_028a: Unknown result type (might be due to invalid IL or missing references) //IL_02e8: 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) //IL_0310: Unknown result type (might be due to invalid IL or missing references) float num = PrefabMix((drop.m_itemData != null && (Object)(object)drop.m_itemData.m_dropPrefab != (Object)null) ? ((Object)drop.m_itemData.m_dropPrefab).name : ((Object)drop).name.Replace("(Clone)", "").Trim()); Scene scene = ((Component)drop).gameObject.scene; bool flag = !((Scene)(ref scene)).IsValid(); ParticleSystem[] componentsInChildren = ((Component)drop).GetComponentsInChildren<ParticleSystem>(true); bool flag2 = false; ParticleSystem[] array = componentsInChildren; foreach (ParticleSystem val in array) { if ((flag || ((Component)val).gameObject.activeInHierarchy) && IsLoot(val)) { flag2 = true; } } Color result = default(Color); ((Color)(ref result))..ctor(0.88f, 0.76f, 0.3f, 1f); source = "fallback (no usable item particles)"; float num2 = -1f; array = componentsInChildren; foreach (ParticleSystem val2 in array) { if ((!flag && !((Component)val2).gameObject.activeInHierarchy) || (flag2 && !IsLoot(val2))) { continue; } ParticleSystemRenderer component = ((Component)val2).GetComponent<ParticleSystemRenderer>(); if ((Object)(object)component == (Object)null) { continue; } MaterialPropertyBlock val3 = new MaterialPropertyBlock(); ((Renderer)component).GetPropertyBlock(val3); ColorOverLifetimeModule colorOverLifetime = val2.colorOverLifetime; Material[] sharedMaterials = ((Renderer)component).sharedMaterials; foreach (Material val4 in sharedMaterials) { if ((Object)(object)val4 == (Object)null) { continue; } Color val5 = Color.white; string[] tintProperties = TintProperties; for (int k = 0; k < tintProperties.Length; k++) { int num3 = Shader.PropertyToID(tintProperties[k]); if (val3.HasColor(num3)) { val5 = val3.GetColor(num3); break; } if (val4.HasProperty(num3)) { val5 = val4.GetColor(num3); break; } } MainModule main = val2.main; MinMaxGradient val6 = ((MainModule)(ref main)).startColor; Color val7 = ((MinMaxGradient)(ref val6)).Evaluate(num, num); for (int l = 0; l < 5; l++) { Color val8 = val7; float num4 = 0.15f + 0.15f * (float)l; if (((ColorOverLifetimeModule)(ref colorOverLifetime)).enabled) { Color val9 = val8; val6 = ((ColorOverLifetimeModule)(ref colorOverLifetime)).color; val8 = val9 * ((MinMaxGradient)(ref val6)).Evaluate(num4, num); } val8 *= val5; float num5 = Mathf.Max(val8.r, Mathf.Max(val8.g, val8.b)); if (!(num5 < 0.025f) && !(val8.a < 0.025f)) { float num6 = Mathf.Min(val8.r, Mathf.Min(val8.g, val8.b)); float num7 = (num5 - num6) / num5; float num8 = Mathf.Clamp01(val8.a) * (0.25f + Mathf.Min(num5, 1f)) * (1f + num7 * 0.5f); if (!(num8 <= num2)) { num2 = num8; float num9 = ((num5 > 0.88f) ? (0.88f / num5) : 1f); ((Color)(ref result))..ctor(Mathf.Max(0f, val8.r * num9), Mathf.Max(0f, val8.g * num9), Mathf.Max(0f, val8.b * num9), 1f); source = ((Object)val2).name + " / " + ((Object)val4).name + " (native palette mix=" + num.ToString("F3", CultureInfo.InvariantCulture) + ")"; } } } } } return result; } internal static float PrefabMix(string name) { uint num = 2166136261u; foreach (char c in name) { num ^= c; num *= 16777619; } num ^= num >> 16; num *= 2146121005; num ^= num >> 15; num *= 2221713035u; num ^= num >> 16; return (float)(num & 0xFFFF) / 65535f; } private static bool IsLoot(ParticleSystem system) { Transform val = ((Component)system).transform; while ((Object)(object)val != (Object)null && (Object)(object)((Component)val).GetComponent<ItemDrop>() == (Object)null) { string text = ((Object)val).name.ToLowerInvariant(); if (text.Contains("loot") || text.Contains("sparkle") || text.Contains("highlight") || text.Contains("pickup")) { return true; } val = val.parent; } return false; } } internal static class SoftGlow { internal sealed class Source { internal MeshRenderer renderer; internal ItemDrop owner; internal Mesh mesh; internal Color color; internal Texture[] masks; internal Vector4[] uv; } internal static readonly List<Source> Sources = new List<Source>(); private static readonly Dictionary<string, Texture> Masks = new Dictionary<string, Texture>(); internal static Material MaskMaterial; internal static Material GlowMaterial; internal static Material ClearMaterial; internal static bool Ready; internal static bool Initialize() { Shader val = Shader.Find("UI/Default"); if ((Object)(object)val == (Object)null || !val.isSupported) { return false; } MaskMaterial = Make(val, "HoverLoot_Silhouette", 1, (StencilOp)2, (CompareFunction)8, 0, 1); GlowMaterial = Make(val, "HoverLoot_SoftHalo", 1, (StencilOp)0, (CompareFunction)6, 15, 0); ClearMaterial = Make(val, "HoverLoot_ClearMask", 0, (StencilOp)2, (CompareFunction)8, 0, 1); MaskMaterial.EnableKeyword("UNITY_UI_ALPHACLIP"); MaskMaterial.SetFloat("_UseUIAlphaClip", 1f); return Ready = MaskMaterial.HasProperty("_StencilWriteMask") && MaskMaterial.HasProperty("_ColorMask"); } private static Material Make(Shader shader, string name, int reference, StencilOp operation, CompareFunction comparison, int colorMask, int writeMask) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected I4, but got Unknown //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Expected I4, but got Unknown //IL_003a: 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_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown Material val = new Material(shader) { name = name, hideFlags = (HideFlags)61 }; val.SetInt("_Stencil", reference); val.SetInt("_StencilOp", (int)operation); val.SetInt("_StencilComp", (int)comparison); val.SetInt("_StencilReadMask", 1); val.SetInt("_StencilWriteMask", writeMask); val.SetInt("_ColorMask", colorMask); val.DisableKeyword("UNITY_UI_CLIP_RECT"); return val; } internal static Source Add(MeshRenderer renderer, Mesh mesh, Color color, ItemDrop owner) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: 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) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: 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_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: 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_00cb: Unknown result type (might be due to invalid IL or missing references) if (!Ready) { return null; } Material[] sharedMaterials = ((Renderer)renderer).sharedMaterials; Source source = new Source { owner = owner, renderer = renderer, mesh = mesh, color = color, masks = (Texture[])(object)new Texture[mesh.subMeshCount], uv = (Vector4[])(object)new Vector4[mesh.subMeshCount] }; for (int i = 0; i < source.masks.Length; i++) { Material val = ((sharedMaterials.Length == 0) ? null : sharedMaterials[Mathf.Min(i, sharedMaterials.Length - 1)]); source.masks[i] = AlphaMask(val); Vector2 val2 = (((Object)(object)val != (Object)null && val.HasProperty("_MainTex")) ? val.GetTextureScale("_MainTex") : Vector2.one); Vector2 val3 = (((Object)(object)val != (Object)null && val.HasProperty("_MainTex")) ? val.GetTextureOffset("_MainTex") : Vector2.zero); source.uv[i] = new Vector4(val2.x, val2.y, val3.x, val3.y); } Sources.Add(source); return source; } private static Texture AlphaMask(Material material) { //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Expected O, but got Unknown //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: 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) if ((Object)(object)material == (Object)null) { return (Texture)(object)Texture2D.whiteTexture; } Texture val = (material.HasProperty("_MainTex") ? material.GetTexture("_MainTex") : material.mainTexture); if ((Object)(object)val == (Object)null) { return (Texture)(object)Texture2D.whiteTexture; } if (!material.GetTag("RenderType", false, "").Contains("Transparent") && material.renderQueue < 2450 && !material.IsKeywordEnabled("_ALPHATEST_ON") && !material.IsKeywordEnabled("_ALPHACLIP_ON") && !material.HasProperty("_Cutoff")) { return (Texture)(object)Texture2D.whiteTexture; } float num = (material.HasProperty("_Cutoff") ? Mathf.Clamp01(material.GetFloat("_Cutoff")) : 0.05f); string key = ((Object)val).GetInstanceID() + ":" + Mathf.RoundToInt(num * 1000f); if (Masks.TryGetValue(key, out var value)) { return value; } RenderTexture val2 = null; RenderTexture active = RenderTexture.active; Texture2D val3 = null; try { int num2 = Mathf.Clamp(val.width, 16, 256); int num3 = Mathf.Clamp(val.height, 16, 256); val2 = RenderTexture.GetTemporary(num2, num3, 0, (RenderTextureFormat)0, (RenderTextureReadWrite)1); Graphics.Blit(val, val2); RenderTexture.active = val2; val3 = new Texture2D(num2, num3, (TextureFormat)4, false, true) { name = "HoverLoot_AlphaMask", hideFlags = (HideFlags)61, filterMode = (FilterMode)1, wrapMode = val.wrapMode }; val3.ReadPixels(new Rect(0f, 0f, (float)num2, (float)num3), 0, 0, false); Color32[] pixels = val3.GetPixels32(); for (int i = 0; i < pixels.Length; i++) { byte b = (byte)(((float)(int)pixels[i].a / 255f >= Mathf.Max(0.01f, num)) ? byte.MaxValue : 0); pixels[i] = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, b); } val3.SetPixels32(pixels); val3.Apply(false, true); value = (Texture)(object)val3; } catch (Exception ex) { if ((Object)(object)val3 != (Object)null) { Object.Destroy((Object)(object)val3); } value = val; Debug.LogWarning((object)("HoverLoot alpha readback fallback for " + ((Object)material).name + ": " + ex.Message)); } finally { RenderTexture.active = active; if ((Object)(object)val2 != (Object)null) { RenderTexture.ReleaseTemporary(val2); } } Masks[key] = value; return value; } internal static void Remove(Source source) { if (source != null) { Sources.Remove(source); } } internal static void Dispose() { SoftGlowCamera[] array = Object.FindObjectsOfType<SoftGlowCamera>(); for (int i = 0; i < array.Length; i++) { Object.DestroyImmediate((Object)(object)array[i]); } Sources.Clear(); foreach (Texture value in Masks.Values) { if ((Object)(object)value != (Object)null && ((Object)value).name == "HoverLoot_AlphaMask") { Object.Destroy((Object)(object)value); } } Masks.Clear(); if ((Object)(object)MaskMaterial != (Object)null) { Object.Destroy((Object)(object)MaskMaterial); } if ((Object)(object)GlowMaterial != (Object)null) { Object.Destroy((Object)(object)GlowMaterial); } if ((Object)(object)ClearMaterial != (Object)null) { Object.Destroy((Object)(object)ClearMaterial); } Ready = false; } } public sealed class SoftGlowCamera : MonoBehaviour { private Camera view; private CommandBuffer commands; private Mesh screenQuad; private readonly List<SoftGlow.Source> visible = new List<SoftGlow.Source>(); private readonly MaterialPropertyBlock properties = new MaterialPropertyBlock(); private static readonly int MainTex = Shader.PropertyToID("_MainTex"); private static readonly int ColorId = Shader.PropertyToID("_Color"); private static readonly int TexST = Shader.PropertyToID("_MainTex_ST"); private static readonly int GuiZ = Shader.PropertyToID("unity_GUIZTestMode"); private void OnEnable() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown //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_004b: Expected O, but got Unknown //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0082: 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_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) view = ((Component)this).GetComponent<Camera>(); commands = new CommandBuffer { name = "HoverLoot alpha-aware soft glow" }; view.AddCommandBuffer((CameraEvent)12, commands); screenQuad = new Mesh { name = "HoverLoot_StencilClear" }; screenQuad.vertices = (Vector3[])(object)new Vector3[4]; screenQuad.uv = (Vector2[])(object)new Vector2[4] { Vector2.zero, Vector2.right, Vector2.one, Vector2.up }; screenQuad.triangles = new int[6] { 0, 1, 2, 0, 2, 3 }; } private void OnPreCull() { //IL_02b0: Unknown result type (might be due to invalid IL or missing references) //IL_02b5: Unknown result type (might be due to invalid IL or missing references) //IL_02ba: Unknown result type (might be due to invalid IL or missing references) //IL_02e2: Unknown result type (might be due to invalid IL or missing references) //IL_02e7: Unknown result type (might be due to invalid IL or missing references) //IL_02ec: Unknown result type (might be due to invalid IL or missing references) //IL_0314: Unknown result type (might be due to invalid IL or missing references) //IL_0319: Unknown result type (might be due to invalid IL or missing references) //IL_031e: Unknown result type (might be due to invalid IL or missing references) //IL_0346: Unknown result type (might be due to invalid IL or missing references) //IL_034b: Unknown result type (might be due to invalid IL or missing references) //IL_0350: Unknown result type (might be due to invalid IL or missing references) //IL_039a: Unknown result type (might be due to invalid IL or missing references) //IL_03c5: 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_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0413: Unknown result type (might be due to invalid IL or missing references) //IL_041d: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_04d0: Unknown result type (might be due to invalid IL or missing references) //IL_04d5: Unknown result type (might be due to invalid IL or missing references) //IL_04d9: Unknown result type (might be due to invalid IL or missing references) //IL_04e9: Unknown result type (might be due to invalid IL or missing references) //IL_04ee: Unknown result type (might be due to invalid IL or missing references) //IL_04fe: Unknown result type (might be due to invalid IL or missing references) //IL_06bc: Unknown result type (might be due to invalid IL or missing references) //IL_06e7: Unknown result type (might be due to invalid IL or missing references) //IL_0598: Unknown result type (might be due to invalid IL or missing references) //IL_059d: Unknown result type (might be due to invalid IL or missing references) //IL_05eb: Unknown result type (might be due to invalid IL or missing references) //IL_05f7: Unknown result type (might be due to invalid IL or missing references) //IL_0607: Unknown result type (might be due to invalid IL or missing references) //IL_0613: Unknown result type (might be due to invalid IL or missing references) //IL_0618: Unknown result type (might be due to invalid IL or missing references) //IL_0628: Unknown result type (might be due to invalid IL or missing references) //IL_062d: Unknown result type (might be due to invalid IL or missing references) //IL_0632: Unknown result type (might be due to invalid IL or missing references) //IL_0634: Unknown result type (might be due to invalid IL or missing references) //IL_0640: Unknown result type (might be due to invalid IL or missing references) //IL_0645: Unknown result type (might be due to invalid IL or missing references) //IL_064f: Unknown result type (might be due to invalid IL or missing references) if (commands == null) { return; } commands.Clear(); visible.Clear(); if (!SoftGlow.Ready || !Plugin.Enabled.Value || Plugin.EffectsHidden || !Plugin.OutlineEnabled.Value) { return; } Plane[] array = GeometryUtility.CalculateFrustumPlanes(view); GameObject val = (((Object)(object)Player.m_localPlayer != (Object)null) ? ((Humanoid)Player.m_localPlayer).GetHoverObject() : null); ItemDrop val2 = (((Object)(object)val != (Object)null) ? val.GetComponentInParent<ItemDrop>() : null); Bounds bounds; foreach (SoftGlow.Source source in SoftGlow.Sources) { if ((Object)(object)source.owner == (Object)null || (Object)(object)source.renderer == (Object)null || !ModSettings.Glows(source.owner) || (ModSettings.Visibility.Value == 2 && (Object)(object)source.owner != (Object)(object)val2)) { continue; } if (ModSettings.Visibility.Value == 1 && (Object)(object)Player.m_localPlayer != (Object)null) { Vector3 position = ((Component)Player.m_localPlayer).transform.position; bounds = ((Renderer)source.renderer).bounds; if (Vector3.Distance(position, ((Bounds)(ref bounds)).center) > ModSettings.NearDistance.Value) { continue; } } if (!((Object)(object)source.renderer == (Object)null) && ((Renderer)source.renderer).enabled && ((Component)source.renderer).gameObject.activeInHierarchy) { Vector3 position2 = ((Component)view).transform.position; bounds = ((Renderer)source.renderer).bounds; if (!(Vector3.Distance(position2, ((Bounds)(ref bounds)).center) > Plugin.OutlineDistance.Value) && GeometryUtility.TestPlanesAABB(array, ((Renderer)source.renderer).bounds)) { visible.Add(source); } } } visible.Sort(delegate(SoftGlow.Source a, SoftGlow.Source b) { //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_000e: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: 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_0051: 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_005b: Unknown result type (might be due to invalid IL or missing references) Bounds bounds2 = ((Renderer)a.renderer).bounds; Vector3 val4 = ((Bounds)(ref bounds2)).center - ((Component)view).transform.position; float sqrMagnitude = ((Vector3)(ref val4)).sqrMagnitude; bounds2 = ((Renderer)b.renderer).bounds; val4 = ((Bounds)(ref bounds2)).center - ((Component)view).transform.position; return sqrMagnitude.CompareTo(((Vector3)(ref val4)).sqrMagnitude); }); HashSet<ItemDrop> hashSet = new HashSet<ItemDrop>(); int num = 0; while (num < visible.Count) { ItemDrop owner = visible[num].owner; if (!hashSet.Contains(owner) && hashSet.Count >= Mathf.Clamp(ModSettings.GlowLimit.Value, 1, 200)) { visible.RemoveAt(num); continue; } hashSet.Add(owner); num++; } if (visible.Count == 0) { return; } float globalFloat = Shader.GetGlobalFloat(GuiZ); Vector3[] vertices = (Vector3[])(object)new Vector3[4] { view.ViewportToWorldPoint(new Vector3(0f, 0f, view.nearClipPlane + 0.01f)), view.ViewportToWorldPoint(new Vector3(1f, 0f, view.nearClipPlane + 0.01f)), view.ViewportToWorldPoint(new Vector3(1f, 1f, view.nearClipPlane + 0.01f)), view.ViewportToWorldPoint(new Vector3(0f, 1f, view.nearClipPlane + 0.01f)) }; screenQuad.vertices = vertices; screenQuad.RecalculateBounds(); commands.SetGlobalFloat(GuiZ, 8f); properties.Clear(); properties.SetColor(ColorId, Color.white); properties.SetTexture(MainTex, (Texture)(object)Texture2D.whiteTexture); commands.DrawMesh(screenQuad, Matrix4x4.identity, SoftGlow.ClearMaterial, 0, 0, properties); commands.SetGlobalFloat(GuiZ, 4f); foreach (SoftGlow.Source item in visible) { Draw(item, ((Renderer)item.renderer).localToWorldMatrix, SoftGlow.MaskMaterial, Color.white); } float num2 = Mathf.Clamp(Plugin.GlowRadius.Value, 1f, 6f); float[] array2 = new float[3] { 0.65f, 1.35f, 2.1f }; float num3 = 0f; float[] array3 = array2; foreach (float num5 in array3) { num3 += 8f * Mathf.Exp(-0.5f * num5 * num5); } foreach (SoftGlow.Source item2 in visible) { bounds = ((Renderer)item2.renderer).bounds; float num6 = Vector3.Dot(((Bounds)(ref bounds)).center - ((Component)view).transform.position, ((Component)view).transform.forward); if (num6 <= view.nearClipPlane) { continue; } float num7 = (view.orthographic ? (2f * view.orthographicSize) : (2f * num6 * Mathf.Tan(view.fieldOfView * (MathF.PI / 180f) * 0.5f))) / (float)Mathf.Max(1, view.pixelHeight); for (int num8 = 0; num8 < array2.Length; num8++) { float num9 = Mathf.Exp(-0.5f * array2[num8] * array2[num8]); Color color = item2.color; color.a = Mathf.Clamp01(Plugin.GlowStrength.Value) * num9 / num3; for (int num10 = 0; num10 < 8; num10++) { float num11 = ((float)num10 + (float)(num8 % 2) * 0.5f) * MathF.PI / 4f; Vector3 val3 = (((Component)view).transform.right * Mathf.Cos(num11) + ((Component)view).transform.up * Mathf.Sin(num11)) * (num2 * array2[num8] * num7); Draw(item2, Matrix4x4.Translate(val3) * ((Renderer)item2.renderer).localToWorldMatrix, SoftGlow.GlowMaterial, color); } } } commands.SetGlobalFloat(GuiZ, 8f); properties.Clear(); properties.SetColor(ColorId, Color.white); properties.SetTexture(MainTex, (Texture)(object)Texture2D.whiteTexture); commands.DrawMesh(screenQuad, Matrix4x4.identity, SoftGlow.ClearMaterial, 0, 0, properties); commands.SetGlobalFloat(GuiZ, globalFloat); } private void Draw(SoftGlow.Source source, Matrix4x4 matrix, Material material, Color color) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0063: 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) for (int i = 0; i < source.masks.Length; i++) { properties.Clear(); properties.SetVector("_TextureSampleAdd", Vector4.zero); properties.SetColor(ColorId, color); properties.SetTexture(MainTex, source.masks[i]); properties.SetVector(TexST, source.uv[i]); commands.DrawMesh(source.mesh, matrix, material, i, 0, properties); } } private void OnDisable() { if ((Object)(object)view != (Object)null && commands != null) { view.RemoveCommandBuffer((CameraEvent)12, commands); } if (commands != null) { commands.Release(); commands = null; } if ((Object)(object)screenQuad != (Object)null) { Object.Destroy((Object)(object)screenQuad); } } }