using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("ZoneNemesis")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ZoneNemesis")]
[assembly: AssemblyCopyright("Copyright © 2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("603d9b00-3c27-4be1-b478-d9341c325537")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
[HarmonyPatch]
public static class CharSelectManager_PlayPatch
{
private static MethodBase TargetMethod()
{
Type type = AccessTools.TypeByName("CharSelectManager");
return (type == null) ? null : AccessTools.Method(type, "Play", Type.EmptyTypes, (Type[])null);
}
private static void Postfix()
{
if ((Object)(object)TransmogPlugin.Instance != (Object)null)
{
((MonoBehaviour)TransmogPlugin.Instance).StartCoroutine(TransmogPlugin.Instance.DelayedInitialize());
}
}
}
[HarmonyPatch(typeof(ItemIcon), "OnPointerUp")]
public static class CtrlClickTransmogPatch
{
private static void Prefix(ItemIcon __instance, PointerEventData eventData)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Invalid comparison between Unknown and I4
//IL_0041: 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_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_008b: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Invalid comparison between Unknown and I4
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
if ((int)eventData.button == 1 && (Input.GetKey((KeyCode)306) || Input.GetKey((KeyCode)305)))
{
TransmogManager.ClearOverrideForSlot(__instance.ThisSlotType);
((AbstractEventData)eventData).Use();
}
else if ((int)eventData.button == 0 && (Input.GetKey((KeyCode)306) || Input.GetKey((KeyCode)305)))
{
Item myItem = __instance.MyItem;
if ((Object)(object)myItem != (Object)(object)GameData.PlayerInv.Empty && (int)myItem.RequiredSlot != 0 && (int)myItem.RequiredSlot != 16)
{
TransmogManager.ToggleOverride(myItem.RequiredSlot, myItem);
((AbstractEventData)eventData).Use();
}
}
}
}
[HarmonyPatch(typeof(ItemIcon), "OnPointerUp")]
public static class ItemIcon_LeftClickPickPatch
{
private static void Prefix(ItemIcon __instance, PointerEventData eventData)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
if ((int)eventData.button != 0 || Input.GetKey((KeyCode)306) || Input.GetKey((KeyCode)305))
{
return;
}
Item myItem = __instance.MyItem;
if ((Object)(object)myItem != (Object)null && (Object)(object)myItem != (Object)(object)GameData.PlayerInv.Empty)
{
Image component = ((Component)__instance).GetComponent<Image>();
Texture2D iconTexture = null;
if ((Object)(object)component != (Object)null)
{
Texture mainTexture = ((Graphic)component).mainTexture;
iconTexture = (Texture2D)(object)((mainTexture is Texture2D) ? mainTexture : null);
}
TransmogPanel.SetPickedItem(myItem, iconTexture);
}
((AbstractEventData)eventData).Use();
}
}
[HarmonyPatch(typeof(ModularParts), "UpdatePlayerVisuals", new Type[] { typeof(List<ItemIcon>) })]
public static class ModularParts_UpdatePatch
{
private static readonly Dictionary<ItemIcon, Item> _temporaries = new Dictionary<ItemIcon, Item>();
private static void Prefix(List<ItemIcon> StatSlots)
{
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
if (GameData.InCharSelect || StatSlots == null)
{
return;
}
_temporaries.Clear();
foreach (ItemIcon StatSlot in StatSlots)
{
SlotType thisSlotType = StatSlot.ThisSlotType;
if (TransmogManager.HasOverride(thisSlotType))
{
_temporaries[StatSlot] = StatSlot.MyItem;
StatSlot.MyItem = TransmogManager.GetOverride(thisSlotType);
}
}
}
private static void Postfix(List<ItemIcon> StatSlots)
{
if (GameData.InCharSelect)
{
return;
}
foreach (KeyValuePair<ItemIcon, Item> temporary in _temporaries)
{
temporary.Key.MyItem = temporary.Value;
}
_temporaries.Clear();
}
}
public static class OutlineHelper
{
private static readonly Color GlowColor = new Color(1f, 1f, 1f, 0.45f);
private static readonly Vector2[] Offsets = (Vector2[])(object)new Vector2[2]
{
new Vector2(3f, 3f),
new Vector2(-3f, -3f)
};
public static void SetOutline(GameObject iconGO, bool isActive)
{
//IL_0160: Unknown result type (might be due to invalid IL or missing references)
//IL_0165: Unknown result type (might be due to invalid IL or missing references)
//IL_0169: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_008d: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: 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_0118: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: Unknown result type (might be due to invalid IL or missing references)
//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)iconGO == (Object)null)
{
return;
}
Graphic componentInChildren = iconGO.GetComponentInChildren<Graphic>();
if ((Object)(object)componentInChildren == (Object)null)
{
Debug.LogWarning((object)("[OutlineHelper] No Graphic found on " + ((Object)iconGO).name + "; cannot add glow."));
return;
}
Color effectColor;
if (isActive)
{
Vector2[] offsets = Offsets;
foreach (Vector2 val in offsets)
{
Outline[] components = ((Component)componentInChildren).gameObject.GetComponents<Outline>();
bool flag = false;
Outline[] array = components;
foreach (Outline val2 in array)
{
effectColor = ((Shadow)val2).effectColor;
if (((Color)(ref effectColor)).Equals(GlowColor) && Mathf.Approximately(((Shadow)val2).effectDistance.x, val.x) && Mathf.Approximately(((Shadow)val2).effectDistance.y, val.y))
{
flag = true;
break;
}
}
if (!flag)
{
Outline val3 = ((Component)componentInChildren).gameObject.AddComponent<Outline>();
((Shadow)val3).effectColor = GlowColor;
((Shadow)val3).effectDistance = val;
((Shadow)val3).useGraphicAlpha = true;
}
}
return;
}
Outline[] components2 = ((Component)componentInChildren).gameObject.GetComponents<Outline>();
Outline[] array2 = components2;
foreach (Outline val4 in array2)
{
effectColor = ((Shadow)val4).effectColor;
if (((Color)(ref effectColor)).Equals(GlowColor))
{
Object.Destroy((Object)(object)val4);
}
}
}
}
public static class TransmogManager
{
private static readonly Dictionary<SlotType, Item> _overrides = new Dictionary<SlotType, Item>();
private static readonly Dictionary<SlotType, Color> _overrideColors = new Dictionary<SlotType, Color>();
public static void InitializeFromConfig()
{
//IL_0163: Unknown result type (might be due to invalid IL or missing references)
//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
//IL_01c9: 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_022a: Unknown result type (might be due to invalid IL or missing references)
//IL_022c: Unknown result type (might be due to invalid IL or missing references)
//IL_0241: 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_0203: Unknown result type (might be due to invalid IL or missing references)
//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
_overrides.Clear();
_overrideColors.Clear();
ConfigEntry<string> val = TransmogPlugin.CurrentSlotConfig();
if (val == null)
{
Debug.LogWarning((object)"[Transmog] CurrentSlotConfig() returned null; cannot load.");
return;
}
string value = val.Value;
Debug.Log((object)$"[Transmog] Raw config string for slot {GameData.CurrentCharacterSlot?.index} = \"{value}\"");
if (string.IsNullOrWhiteSpace(value))
{
Debug.Log((object)$"[Transmog] No saved overrides for slot {GameData.CurrentCharacterSlot?.index}");
}
else
{
string[] array = value.Split(new char[1] { ';' });
string[] array2 = array;
Color val5 = default(Color);
foreach (string text in array2)
{
string[] array3 = text.Split(new char[1] { ':' });
if (array3.Length < 2 || array3.Length > 3)
{
Debug.LogWarning((object)("[Transmog] Skipping malformed pair \"" + text + "\""));
continue;
}
if (!int.TryParse(array3[0], out var result))
{
Debug.LogWarning((object)("[Transmog] Cannot parse slotInt from \"" + array3[0] + "\""));
continue;
}
string text2 = array3[1];
SlotType val2 = (SlotType)result;
Item val3 = (((Object)(object)GameData.ItemDB != (Object)null) ? GameData.ItemDB.GetItemByID(text2) : null);
if ((Object)(object)val3 == (Object)null || (Object)(object)val3 == (Object)(object)GameData.PlayerInv.Empty)
{
Debug.LogWarning((object)("[Transmog] Saved itemId \"" + text2 + "\" not found in ItemDatabase."));
continue;
}
Color val4 = Color.white;
if (array3.Length == 3)
{
if (ColorUtility.TryParseHtmlString("#" + array3[2], ref val5))
{
val4 = val5;
}
else
{
Debug.LogWarning((object)$"[Transmog] Cannot parse color hex \"{array3[2]}\" for slot {val2}");
}
}
_overrides[val2] = val3;
_overrideColors[val2] = val4;
Debug.Log((object)$"[Transmog] Loaded override → slot {val2} = Item \"{val3.ItemName}\" ID={((BaseScriptableObject)val3).Id} tinted {val4}");
}
}
GameData.PlayerInv.Modulars.UpdatePlayerVisuals(GameData.PlayerInv.EquipmentSlots);
foreach (KeyValuePair<SlotType, Item> @override in _overrides)
{
ApplyGlowToSlot(@override.Key, add: true);
}
}
public static void ToggleOverride(SlotType slotType, Item clickedItem)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: 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_0026: 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_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_00b9: 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)
Item value;
bool flag = _overrides.TryGetValue(slotType, out value) && (Object)(object)value == (Object)(object)clickedItem;
if (flag)
{
_overrides.Remove(slotType);
_overrideColors.Remove(slotType);
}
else
{
_overrides[slotType] = clickedItem;
if (!_overrideColors.ContainsKey(slotType))
{
_overrideColors[slotType] = Color.white;
}
}
SaveToConfig();
GameData.PlayerInv.Modulars.UpdatePlayerVisuals(GameData.PlayerInv.EquipmentSlots);
ApplyGlowToSlot(slotType, !flag);
UpdateSocialLog.LogAdd(flag ? $"Reverted visual for {slotType}." : $"Transmog {slotType} → {clickedItem.ItemName}", "yellow");
}
public static void SetOverrideColor(SlotType slotType, Color color)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
if (_overrides.ContainsKey(slotType))
{
_overrideColors[slotType] = color;
SaveToConfig();
GameData.PlayerInv.Modulars.UpdatePlayerVisuals(GameData.PlayerInv.EquipmentSlots);
}
}
public static bool TryGetOverrideColor(SlotType slotType, out Color color)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
return _overrideColors.TryGetValue(slotType, out color);
}
public static void ClearOverrideForSlot(SlotType slotType)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
if (_overrides.Remove(slotType))
{
_overrideColors.Remove(slotType);
SaveToConfig();
GameData.PlayerInv.Modulars.UpdatePlayerVisuals(GameData.PlayerInv.EquipmentSlots);
ApplyGlowToSlot(slotType, add: false);
UpdateSocialLog.LogAdd($"Cleared transmog for {slotType}.", "yellow");
}
}
public static void ClearAllOverrides()
{
//IL_0069: 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_006f: Unknown result type (might be due to invalid IL or missing references)
if (_overrides.Count == 0)
{
return;
}
List<SlotType> list = new List<SlotType>(_overrides.Keys);
_overrides.Clear();
_overrideColors.Clear();
SaveToConfig();
GameData.PlayerInv.Modulars.UpdatePlayerVisuals(GameData.PlayerInv.EquipmentSlots);
foreach (SlotType item in list)
{
ApplyGlowToSlot(item, add: false);
}
UpdateSocialLog.LogAdd("All transmog overrides cleared.", "yellow");
}
public static bool HasOverride(SlotType slotType)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
return _overrides.ContainsKey(slotType);
}
public static Item GetOverride(SlotType slotType)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
Item value;
return _overrides.TryGetValue(slotType, out value) ? value : GameData.PlayerInv.Empty;
}
public static Dictionary<SlotType, Item> GetAllOverrides()
{
return new Dictionary<SlotType, Item>(_overrides);
}
private static void SaveToConfig()
{
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Expected I4, but got Unknown
//IL_007b: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
ConfigEntry<string> val = TransmogPlugin.CurrentSlotConfig();
if (val == null)
{
return;
}
if (_overrides.Count == 0)
{
val.Value = string.Empty;
return;
}
List<string> list = new List<string>();
foreach (KeyValuePair<SlotType, Item> @override in _overrides)
{
int num = (int)@override.Key;
string id = ((BaseScriptableObject)@override.Value).Id;
string arg = "FFFFFF";
if (_overrideColors.TryGetValue(@override.Key, out var value))
{
arg = ColorUtility.ToHtmlStringRGB(value);
}
list.Add($"{num}:{id}:{arg}");
}
val.Value = string.Join(";", list);
}
private static void ApplyGlowToSlot(SlotType slotType, bool add)
{
//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_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Invalid comparison between Unknown and I4
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Invalid comparison between Unknown and I4
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Invalid comparison between Unknown and I4
foreach (ItemIcon equipmentSlot in GameData.PlayerInv.EquipmentSlots)
{
SlotType thisSlotType = equipmentSlot.ThisSlotType;
if (slotType != thisSlotType && (((int)slotType != 13 && (int)slotType != 14) || (int)thisSlotType != 15))
{
continue;
}
OutlineHelper.SetOutline(((Component)equipmentSlot).gameObject, add);
break;
}
}
}
public class TransmogPanel : MonoBehaviour
{
private static bool _visible = false;
private static Item _pickedItem = null;
private static Texture2D _pickedTexture = null;
private static readonly Dictionary<SlotType, Texture2D> _overrideTextures = new Dictionary<SlotType, Texture2D>();
private static Rect _windowRect = new Rect(200f, 200f, 340f, 600f);
private GUIStyle _squareStyle;
private GUIStyle _headerStyle;
private bool _stylesCreated = false;
private Array _allSlotValues;
private readonly float _padding = 10f;
private readonly float _headerHeight = 30f;
private readonly int _columns = 3;
private float _squareSize;
private Vector2 _scrollPos;
private bool _dragging = false;
private void Awake()
{
if (Object.FindObjectsOfType<TransmogPanel>().Length > 1)
{
Object.Destroy((Object)(object)this);
return;
}
Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
_allSlotValues = Enum.GetValues(typeof(SlotType));
}
private void Update()
{
if (Input.GetKeyDown((KeyCode)289))
{
_visible = !_visible;
Debug.Log((object)$"[TransmogPanel] Toggle visible = {_visible}");
if (_visible)
{
RefreshCachedIcons();
return;
}
_pickedItem = null;
_pickedTexture = null;
}
}
private void OnGUI()
{
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: Expected O, but got Unknown
//IL_00a4: 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_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Expected O, but got Unknown
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: 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_0083: Expected O, but got Unknown
if (_visible)
{
if (!_stylesCreated)
{
_stylesCreated = true;
_squareStyle = new GUIStyle(GUI.skin.box)
{
alignment = (TextAnchor)4,
wordWrap = true,
fontSize = 12
};
_headerStyle = new GUIStyle(GUI.skin.label)
{
alignment = (TextAnchor)4,
fontStyle = (FontStyle)1,
fontSize = 16
};
}
_windowRect = GUI.Window(12345, _windowRect, new WindowFunction(DrawWindow), "", GUIStyle.none);
}
}
private void DrawWindow(int windowID)
{
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: 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_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_00bc: Invalid comparison between Unknown and I4
//IL_0114: Unknown result type (might be due to invalid IL or missing references)
//IL_011a: Invalid comparison between Unknown and I4
//IL_00dd: 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_01a5: 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_01eb: 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_0272: Unknown result type (might be due to invalid IL or missing references)
//IL_0274: Unknown result type (might be due to invalid IL or missing references)
//IL_0278: Unknown result type (might be due to invalid IL or missing references)
//IL_027c: Invalid comparison between Unknown and I4
//IL_0322: 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_032c: Unknown result type (might be due to invalid IL or missing references)
//IL_0331: Unknown result type (might be due to invalid IL or missing references)
//IL_0358: Unknown result type (might be due to invalid IL or missing references)
//IL_035d: Unknown result type (might be due to invalid IL or missing references)
//IL_035f: Unknown result type (might be due to invalid IL or missing references)
//IL_0363: Unknown result type (might be due to invalid IL or missing references)
//IL_0367: Invalid comparison between Unknown and I4
//IL_05cf: Unknown result type (might be due to invalid IL or missing references)
//IL_03ca: Unknown result type (might be due to invalid IL or missing references)
//IL_03d7: Unknown result type (might be due to invalid IL or missing references)
//IL_0462: Unknown result type (might be due to invalid IL or missing references)
//IL_03ea: Unknown result type (might be due to invalid IL or missing references)
//IL_0490: Unknown result type (might be due to invalid IL or missing references)
//IL_0496: Invalid comparison between Unknown and I4
//IL_0416: Unknown result type (might be due to invalid IL or missing references)
//IL_0407: Unknown result type (might be due to invalid IL or missing references)
//IL_04b7: Unknown result type (might be due to invalid IL or missing references)
//IL_04c4: Unknown result type (might be due to invalid IL or missing references)
//IL_04c9: Unknown result type (might be due to invalid IL or missing references)
//IL_04cf: Unknown result type (might be due to invalid IL or missing references)
//IL_04d4: 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_04dd: Unknown result type (might be due to invalid IL or missing references)
//IL_0447: Unknown result type (might be due to invalid IL or missing references)
//IL_0438: Unknown result type (might be due to invalid IL or missing references)
//IL_04f0: Unknown result type (might be due to invalid IL or missing references)
//IL_04f5: Unknown result type (might be due to invalid IL or missing references)
//IL_04f7: Unknown result type (might be due to invalid IL or missing references)
//IL_04f9: Unknown result type (might be due to invalid IL or missing references)
//IL_04fd: Unknown result type (might be due to invalid IL or missing references)
//IL_0501: Invalid comparison between Unknown and I4
//IL_0509: Unknown result type (might be due to invalid IL or missing references)
//IL_050d: Invalid comparison between Unknown and I4
//IL_0503: Unknown result type (might be due to invalid IL or missing references)
//IL_0507: Invalid comparison between Unknown and I4
//IL_0520: Unknown result type (might be due to invalid IL or missing references)
//IL_0532: Unknown result type (might be due to invalid IL or missing references)
GUI.Box(new Rect(0f, 0f, ((Rect)(ref _windowRect)).width, ((Rect)(ref _windowRect)).height), GUIContent.none);
Rect val = default(Rect);
((Rect)(ref val))..ctor(0f, 0f, ((Rect)(ref _windowRect)).width, _headerHeight);
GUI.Box(val, GUIContent.none);
GUI.Label(val, "Transmog Panel (F8 to toggle)", _headerStyle);
Event current = Event.current;
Vector2 mousePosition = current.mousePosition;
if ((int)current.type == 0 && current.button == 2 && ((Rect)(ref val)).Contains(mousePosition))
{
_dragging = true;
current.Use();
}
if (_dragging && (int)current.type == 3 && current.button == 2)
{
((Rect)(ref _windowRect)).x = ((Rect)(ref _windowRect)).x + current.delta.x;
((Rect)(ref _windowRect)).y = ((Rect)(ref _windowRect)).y + current.delta.y;
current.Use();
}
if ((int)current.type == 1 && current.button == 2)
{
_dragging = false;
current.Use();
}
float num = _headerHeight + _padding;
Rect val2 = default(Rect);
((Rect)(ref val2))..ctor(_padding, num, ((Rect)(ref _windowRect)).width - 2f * _padding, 20f);
if ((Object)(object)_pickedItem != (Object)null)
{
GUI.Label(val2, "Picked: " + _pickedItem.ItemName);
}
else
{
GUI.Label(val2, "Picked: (none)");
}
num += 20f + _padding;
Rect val3 = default(Rect);
((Rect)(ref val3))..ctor(_padding, num, ((Rect)(ref _windowRect)).width - 2f * _padding, 40f);
GUI.Label(val3, "Left‐Click an item in inventory to pick.\nRelease over matching slot to drop.", GUI.skin.label);
num += 40f + _padding;
float num2 = ((Rect)(ref _windowRect)).width - 2f * _padding;
_squareSize = (num2 - (float)(_columns - 1) * _padding) / (float)_columns;
float num3 = num;
int num4 = 0;
foreach (object allSlotValue in _allSlotValues)
{
SlotType val4 = (SlotType)allSlotValue;
if ((int)val4 != 0 && (int)val4 != 16)
{
num4++;
}
}
int num5 = Mathf.CeilToInt((float)num4 / (float)_columns);
float num6 = (float)num5 * (_squareSize + _padding);
float num7 = ((Rect)(ref _windowRect)).height - num3 - _padding - 30f - _padding;
Rect val5 = default(Rect);
((Rect)(ref val5))..ctor(_padding, num3, num2, num7);
Rect val6 = default(Rect);
((Rect)(ref val6))..ctor(0f, 0f, num2, num6);
_scrollPos = GUI.BeginScrollView(val5, _scrollPos, val6);
int num8 = 0;
Rect val8 = default(Rect);
foreach (object allSlotValue2 in _allSlotValues)
{
SlotType val7 = (SlotType)allSlotValue2;
if ((int)val7 == 0 || (int)val7 == 16)
{
continue;
}
int num9 = num8 / _columns;
int num10 = num8 % _columns;
float num11 = (float)num10 * (_squareSize + _padding);
float num12 = (float)num9 * (_squareSize + _padding);
((Rect)(ref val8))..ctor(num11, num12, _squareSize, _squareSize);
GUI.Box(val8, GUIContent.none);
if (TransmogManager.HasOverride(val7))
{
if (_overrideTextures.TryGetValue(val7, out var value) && (Object)(object)value != (Object)null)
{
GUI.DrawTexture(val8, (Texture)(object)value, (ScaleMode)2);
}
else
{
Item @override = TransmogManager.GetOverride(val7);
Texture2D val9 = FindTextureForItemInScene(@override);
if ((Object)(object)val9 != (Object)null)
{
GUI.DrawTexture(val8, (Texture)(object)val9, (ScaleMode)2);
}
else
{
GUI.Label(val8, @override.ItemName, _squareStyle);
}
}
}
else
{
GUI.Label(val8, ((object)(SlotType)(ref val7)).ToString(), _squareStyle);
}
if ((Object)(object)_pickedItem != (Object)null && (int)Event.current.type == 1 && Event.current.button == 0)
{
Vector2 val10 = Event.current.mousePosition - new Vector2(_padding, num3) + _scrollPos;
if (((Rect)(ref val8)).Contains(val10))
{
SlotType requiredSlot = _pickedItem.RequiredSlot;
if (requiredSlot == val7 || (((int)requiredSlot == 13 || (int)requiredSlot == 14) && (int)val7 == 15))
{
TransmogManager.ToggleOverride(val7, _pickedItem);
_overrideTextures[val7] = _pickedTexture;
_pickedItem = null;
_pickedTexture = null;
}
Event.current.Use();
}
}
num8++;
}
GUI.EndScrollView();
float num13 = 30f;
float num14 = ((Rect)(ref _windowRect)).height - _padding - num13;
Rect val11 = default(Rect);
((Rect)(ref val11))..ctor(_padding, num14, ((Rect)(ref _windowRect)).width - 2f * _padding, num13);
if (GUI.Button(val11, "Close"))
{
_visible = false;
_pickedItem = null;
_pickedTexture = null;
}
}
public static void SetPickedItem(Item item, Texture2D iconTexture)
{
_pickedItem = item;
_pickedTexture = iconTexture;
}
private void RefreshCachedIcons()
{
//IL_0027: 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_0063: 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)
_overrideTextures.Clear();
Dictionary<SlotType, Item> allOverrides = TransmogManager.GetAllOverrides();
foreach (KeyValuePair<SlotType, Item> item in allOverrides)
{
SlotType key = item.Key;
Item value = item.Value;
Texture2D val = FindTextureForItemInScene(value);
if ((Object)(object)val != (Object)null)
{
_overrideTextures[key] = val;
}
else
{
_overrideTextures[key] = null;
}
}
}
private Texture2D FindTextureForItemInScene(Item item)
{
if ((Object)(object)item == (Object)null)
{
return null;
}
ItemIcon[] array = Object.FindObjectsOfType<ItemIcon>();
ItemIcon[] array2 = array;
foreach (ItemIcon val in array2)
{
if (!((Object)(object)val.MyItem == (Object)(object)item))
{
continue;
}
Image componentInChildren = ((Component)val).GetComponentInChildren<Image>();
if ((Object)(object)componentInChildren != (Object)null)
{
Texture mainTexture = ((Graphic)componentInChildren).mainTexture;
Texture2D val2 = (Texture2D)(object)((mainTexture is Texture2D) ? mainTexture : null);
if (val2 != null)
{
return val2;
}
}
}
return null;
}
}
[BepInPlugin("com.recks.erenshor.transmog", "Transmog (Per‐Slot + Dye)", "1.3.0")]
[BepInProcess("Erenshor.exe")]
public class TransmogPlugin : BaseUnityPlugin
{
[CompilerGenerated]
private sealed class <DelayedInitialize>d__7 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public TransmogPlugin <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <DelayedInitialize>d__7(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
break;
case 1:
<>1__state = -1;
break;
}
if ((Object)(object)GameData.PlayerInv == (Object)null || GameData.PlayerInv.EquipmentSlots == null || GameData.PlayerInv.EquipmentSlots.Count == 0)
{
<>2__current = null;
<>1__state = 1;
return true;
}
TransmogManager.InitializeFromConfig();
((BaseUnityPlugin)<>4__this).Logger.LogInfo((object)$"[Transmog] Loaded overrides for slot {GameData.CurrentCharacterSlot?.index}");
return false;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
private static readonly ConfigEntry<string>[] SlotOverrideConfig = new ConfigEntry<string>[5];
public static TransmogPlugin Instance { get; private set; }
private void Awake()
{
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Expected O, but got Unknown
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: Expected O, but got Unknown
Instance = this;
for (int i = 0; i < SlotOverrideConfig.Length; i++)
{
SlotOverrideConfig[i] = ((BaseUnityPlugin)this).Config.Bind<string>("Transmog", $"Slot{i}", string.Empty, $"Serialized overrides+colors for character‐slot {i}: format \"slotInt:itemId:hexColor;...\"");
}
Harmony val = new Harmony("com.recks.erenshor.transmog");
val.PatchAll();
GameObject val2 = new GameObject("TransmogPanelHolder");
((Object)val2).hideFlags = (HideFlags)61;
val2.AddComponent<TransmogPanel>();
Object.DontDestroyOnLoad((Object)(object)val2);
((BaseUnityPlugin)this).Logger.LogInfo((object)"Transmog (Per‐Slot + Dye) mod loaded.");
}
private void Update()
{
if ((Object)(object)GameData.PlayerInv != (Object)null && Input.GetKeyDown((KeyCode)285))
{
TransmogManager.ClearAllOverrides();
}
}
[IteratorStateMachine(typeof(<DelayedInitialize>d__7))]
public IEnumerator DelayedInitialize()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <DelayedInitialize>d__7(0)
{
<>4__this = this
};
}
public static ConfigEntry<string> CurrentSlotConfig()
{
int num = GameData.CurrentCharacterSlot?.index ?? (-1);
if (num < 0 || num >= SlotOverrideConfig.Length)
{
return null;
}
return SlotOverrideConfig[num];
}
}