using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("Erenshor-CompareEquipment")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Erenshor-CompareEquipment")]
[assembly: AssemblyCopyright("Copyright © 2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("03679c8f-fee7-45fc-bfb1-1a12fd2df04b")]
[assembly: AssemblyFileVersion("1.2.1")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.2.1.0")]
namespace Erenshor_CompareEquipment;
public class CoroutineRunner : MonoBehaviour
{
private static CoroutineRunner _instance;
public static CoroutineRunner Instance
{
get
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Expected O, but got Unknown
if ((Object)(object)_instance == (Object)null)
{
GameObject val = new GameObject("CoroutineRunner");
Object.DontDestroyOnLoad((Object)val);
_instance = val.AddComponent<CoroutineRunner>();
}
return _instance;
}
}
public static void Run(IEnumerator coroutine)
{
((MonoBehaviour)Instance).StartCoroutine(coroutine);
}
}
public class ItemCompareWindow : MonoBehaviour
{
public TextMeshProUGUI ItemName;
public TextMeshProUGUI itemPrice;
public TextMeshProUGUI Str;
public TextMeshProUGUI End;
public TextMeshProUGUI Dex;
public TextMeshProUGUI Agi;
public TextMeshProUGUI Int;
public TextMeshProUGUI Wis;
public TextMeshProUGUI Cha;
public TextMeshProUGUI MR;
public TextMeshProUGUI PR;
public TextMeshProUGUI ER;
public TextMeshProUGUI VR;
public TextMeshProUGUI HP;
public TextMeshProUGUI Mana;
public TextMeshProUGUI AC;
public TextMeshProUGUI Lore;
public TextMeshProUGUI DMGtxt;
public TextMeshProUGUI DMGNum;
public TextMeshProUGUI DelTXT;
public TextMeshProUGUI DelNum;
public TextMeshProUGUI Slot;
public TextMeshProUGUI Usable;
public TextMeshProUGUI Res;
public GameObject ParentWindow;
public Image ItemIcon;
public GameObject StatTextParent;
public GameObject OtherTextParent;
public GameObject ItemEffect;
public TextMeshProUGUI ClickSpell;
public TextMeshProUGUI ClickDesc;
public GameObject ReqLvl;
public Color Normal;
public Color Blessed;
public Color Legendary;
public Color NormalText;
public Color BlessedText;
public Color GodlyText;
public Image Banner;
public void Awake()
{
}
public void DisplayItem(Item item, Vector2 slotLoc, int _quantity)
{
//IL_0172: Unknown result type (might be due to invalid IL or missing references)
//IL_026c: Unknown result type (might be due to invalid IL or missing references)
//IL_0277: Unknown result type (might be due to invalid IL or missing references)
//IL_027c: Unknown result type (might be due to invalid IL or missing references)
//IL_0281: Unknown result type (might be due to invalid IL or missing references)
//IL_028c: Unknown result type (might be due to invalid IL or missing references)
//IL_029a: Unknown result type (might be due to invalid IL or missing references)
//IL_02b8: Unknown result type (might be due to invalid IL or missing references)
//IL_06c5: Unknown result type (might be due to invalid IL or missing references)
//IL_02f6: Unknown result type (might be due to invalid IL or missing references)
//IL_030b: Unknown result type (might be due to invalid IL or missing references)
//IL_0320: Unknown result type (might be due to invalid IL or missing references)
//IL_08b2: Unknown result type (might be due to invalid IL or missing references)
//IL_08b9: Invalid comparison between Unknown and I4
//IL_0abc: Unknown result type (might be due to invalid IL or missing references)
//IL_0ac1: Unknown result type (might be due to invalid IL or missing references)
//IL_09d9: Unknown result type (might be due to invalid IL or missing references)
//IL_09df: Invalid comparison between Unknown and I4
//IL_0335: Unknown result type (might be due to invalid IL or missing references)
//IL_092e: Unknown result type (might be due to invalid IL or missing references)
//IL_0934: Invalid comparison between Unknown and I4
//IL_08bc: Unknown result type (might be due to invalid IL or missing references)
//IL_08c3: Invalid comparison between Unknown and I4
//IL_09e2: Unknown result type (might be due to invalid IL or missing references)
//IL_09e8: Invalid comparison between Unknown and I4
//IL_08c6: Unknown result type (might be due to invalid IL or missing references)
//IL_08cd: Invalid comparison between Unknown and I4
//IL_0a08: Unknown result type (might be due to invalid IL or missing references)
//IL_0a0d: Unknown result type (might be due to invalid IL or missing references)
//IL_0659: Unknown result type (might be due to invalid IL or missing references)
//IL_0660: Invalid comparison between Unknown and I4
//IL_0673: Unknown result type (might be due to invalid IL or missing references)
//IL_0679: Invalid comparison between Unknown and I4
//IL_0d55: Unknown result type (might be due to invalid IL or missing references)
//IL_067c: Unknown result type (might be due to invalid IL or missing references)
//IL_0682: Invalid comparison between Unknown and I4
int num = 1;
if (ParentWindow.activeSelf)
{
return;
}
if ((Object)(object)item.TeachSpell == (Object)null && (Object)(object)item.TeachSkill == (Object)null)
{
ReqLvl.SetActive(false);
}
ParentWindow.SetActive(true);
((TMP_Text)Usable).text = "";
if (item.ItemValue > 0)
{
((TMP_Text)itemPrice).text = item.ItemValue.ToString();
}
else
{
((TMP_Text)itemPrice).text = "Unsellable";
}
if (item.Classes.Count > 0)
{
if (item.Classes.Contains(GameData.ClassDB.Arcanist))
{
TextMeshProUGUI usable = Usable;
((TMP_Text)usable).text = ((TMP_Text)usable).text + " Arcanist ";
}
if (item.Classes.Contains(GameData.ClassDB.Duelist))
{
TextMeshProUGUI usable2 = Usable;
((TMP_Text)usable2).text = ((TMP_Text)usable2).text + " Duelist ";
}
if (item.Classes.Contains(GameData.ClassDB.Druid))
{
TextMeshProUGUI usable3 = Usable;
((TMP_Text)usable3).text = ((TMP_Text)usable3).text + " Druid ";
}
if (item.Classes.Contains(GameData.ClassDB.Warrior))
{
TextMeshProUGUI usable4 = Usable;
((TMP_Text)usable4).text = ((TMP_Text)usable4).text + " Paladin ";
}
}
else
{
((TMP_Text)Usable).text = "";
}
if (slotLoc.y > 0f)
{
num = -1;
}
ItemIcon.sprite = item.ItemIcon;
((TMP_Text)ItemName).text = item.ItemName;
if (!item.Template)
{
((TMP_Text)Lore).verticalAlignment = (VerticalAlignmentOptions)512;
((TMP_Text)Lore).text = item.Lore.ToString();
}
else
{
((TMP_Text)Lore).verticalAlignment = (VerticalAlignmentOptions)512;
((TMP_Text)Lore).text = "Ingredients:\n\n";
foreach (Item templateIngredient in item.TemplateIngredients)
{
TextMeshProUGUI lore = Lore;
((TMP_Text)lore).text = ((TMP_Text)lore).text + templateIngredient.ItemName + "\n";
}
TextMeshProUGUI lore2 = Lore;
((TMP_Text)lore2).text = ((TMP_Text)lore2).text + "\n<color=grey>Note: Ingredients MUST be exact quantities\n\nUse CTRL + CLICK to separate stacks.</color>";
}
ParentWindow.transform.position = Vector2.op_Implicit(slotLoc + new Vector2(-200f, (float)(100 * num)));
if ((int)item.RequiredSlot == 0)
{
((Graphic)ItemName).color = NormalText;
}
if (Object.op_Implicit((Object)(object)item.Aura))
{
((Graphic)ItemName).color = NormalText;
}
if ((Object)(object)item.Aura == (Object)null && (Object)(object)item.TeachSpell == (Object)null && (Object)(object)item.TeachSkill == (Object)null && (int)item.RequiredSlot != 0)
{
if (_quantity <= 1)
{
((Graphic)ItemName).color = NormalText;
}
if (_quantity == 2)
{
((Graphic)ItemName).color = BlessedText;
}
if (_quantity == 3)
{
((Graphic)ItemName).color = GodlyText;
}
((TMP_Text)Lore).verticalAlignment = (VerticalAlignmentOptions)1024;
ReqLvl.SetActive(false);
StatTextParent.SetActive(true);
OtherTextParent.SetActive(false);
if (item.WeaponDmg == 0 && item.WeaponDly == 0f)
{
((Component)DMGtxt).gameObject.SetActive(false);
((Component)DelTXT).gameObject.SetActive(false);
((Component)DMGNum).gameObject.SetActive(false);
((Component)DelNum).gameObject.SetActive(false);
}
else
{
((Component)DMGtxt).gameObject.SetActive(true);
((Component)DelTXT).gameObject.SetActive(true);
((Component)DMGNum).gameObject.SetActive(true);
((Component)DelNum).gameObject.SetActive(true);
}
((TMP_Text)Str).text = item.CalcStat(item.Str, _quantity).ToString();
((TMP_Text)End).text = item.CalcStat(item.End, _quantity).ToString();
((TMP_Text)Dex).text = item.CalcStat(item.Dex, _quantity).ToString();
((TMP_Text)Agi).text = item.CalcStat(item.Agi, _quantity).ToString();
((TMP_Text)Int).text = item.CalcStat(item.Int, _quantity).ToString();
((TMP_Text)Wis).text = item.CalcStat(item.Wis, _quantity).ToString();
((TMP_Text)Cha).text = item.CalcStat(item.Cha, _quantity).ToString();
((TMP_Text)Res).text = item.CalcRes(item.Res, _quantity).ToString();
((TMP_Text)MR).text = item.CalcStat(item.MR, _quantity).ToString();
((TMP_Text)PR).text = item.CalcStat(item.PR, _quantity).ToString();
((TMP_Text)VR).text = item.CalcStat(item.VR, _quantity).ToString();
((TMP_Text)ER).text = item.CalcStat(item.ER, _quantity).ToString();
((TMP_Text)AC).text = item.CalcACHPMC(item.AC, _quantity).ToString();
((TMP_Text)HP).text = item.CalcACHPMC(item.HP, _quantity).ToString();
((TMP_Text)Mana).text = item.CalcACHPMC(item.Mana, _quantity).ToString();
((TMP_Text)DMGNum).text = item.CalcDmg(item.WeaponDmg, _quantity).ToString();
((TMP_Text)DelNum).text = item.WeaponDly + " sec";
((TMP_Text)Slot).text = "Slot: " + ((object)(SlotType)(ref item.RequiredSlot)).ToString();
if ((int)item.RequiredSlot == 15)
{
((TMP_Text)Slot).text = "Primary or Secondary";
}
if ((int)item.ThisWeaponType == 2 || (int)item.ThisWeaponType == 4)
{
TextMeshProUGUI slot = Slot;
((TMP_Text)slot).text = ((TMP_Text)slot).text + " - 2-Handed";
}
if (item.Relic)
{
TextMeshProUGUI slot2 = Slot;
((TMP_Text)slot2).text = ((TMP_Text)slot2).text + " - Relic Item";
}
}
else if ((int)item.RequiredSlot == 0)
{
StatTextParent.SetActive(false);
((TMP_Text)OtherTextParent.GetComponent<TextMeshProUGUI>()).text = "";
}
else
{
OtherTextParent.SetActive(true);
((TMP_Text)OtherTextParent.GetComponent<TextMeshProUGUI>()).text = "";
}
if ((Object)(object)item.ItemEffectOnClick != (Object)null)
{
((TMP_Text)Lore).verticalAlignment = (VerticalAlignmentOptions)1024;
ReqLvl.SetActive(false);
((TMP_Text)OtherTextParent.GetComponent<TextMeshProUGUI>()).text = "";
ItemEffect.SetActive(true);
((TMP_Text)ClickSpell).text = "Activatable: " + item.ItemEffectOnClick.SpellName;
((TMP_Text)ClickDesc).text = item.ItemEffectOnClick.SpellDesc;
OtherTextParent.SetActive(true);
if (item.Disposable)
{
TextMeshProUGUI component = OtherTextParent.GetComponent<TextMeshProUGUI>();
((TMP_Text)component).text = ((TMP_Text)component).text + "Item Consumed Upon Use.\n\n";
}
((TMP_Text)OtherTextParent.GetComponent<TextMeshProUGUI>()).text = "Right click or assign to hotkey to use.";
}
else if ((Object)(object)item.WornEffect != (Object)null)
{
((TMP_Text)Lore).verticalAlignment = (VerticalAlignmentOptions)1024;
ReqLvl.SetActive(false);
((TMP_Text)OtherTextParent.GetComponent<TextMeshProUGUI>()).text = "";
ItemEffect.SetActive(true);
((TMP_Text)ClickSpell).text = "Worn Effect: " + item.WornEffect.SpellName;
((TMP_Text)ClickDesc).text = item.WornEffect.SpellDesc;
OtherTextParent.SetActive(true);
((TMP_Text)OtherTextParent.GetComponent<TextMeshProUGUI>()).text = "Effect applied once item is equipped.";
}
else if ((Object)(object)item.WeaponProcOnHit != (Object)null)
{
ItemEffect.SetActive(true);
if (!item.Shield && ((int)item.RequiredSlot == 13 || (int)item.RequiredSlot == 14 || (int)item.RequiredSlot == 15))
{
((TMP_Text)ClickSpell).text = item.WeaponProcChance + "% chance on ATTACK: \n" + item.WeaponProcOnHit.SpellName;
}
if (item.Shield)
{
((TMP_Text)ClickSpell).text = item.WeaponProcChance + "% chance on BASH: \n" + item.WeaponProcOnHit.SpellName;
}
if ((int)item.RequiredSlot == 6)
{
((TMP_Text)ClickSpell).text = item.WeaponProcChance + "% chance on CAST: \n" + item.WeaponProcOnHit.SpellName;
}
((TMP_Text)ClickDesc).text = item.WeaponProcOnHit.SpellDesc;
OtherTextParent.SetActive(true);
((TMP_Text)OtherTextParent.GetComponent<TextMeshProUGUI>()).text = "";
}
else
{
ItemEffect.SetActive(false);
((TMP_Text)ClickSpell).text = "";
((TMP_Text)ClickDesc).text = "";
}
if (item.WeaponDmg != 0)
{
float num2 = 1f;
if ((int)item.ThisWeaponType == 2 || (int)item.ThisWeaponType == 4)
{
num2 = 1.5f;
}
OtherTextParent.SetActive(true);
((TMP_Text)OtherTextParent.GetComponent<TextMeshProUGUI>()).faceColor = Color32.op_Implicit(Color.green);
float num3 = ((float)(item.WeaponDmg + (_quantity - 1)) * (float)GameData.PlayerStats.Level * 0.8f * 0.9f + ((float)GameData.PlayerStats.dexBonus() / 40f + (float)GameData.PlayerStats.strBonus() / 40f) + 5f + 2f * (float)GameData.PlayerStats.Level) / item.WeaponDly;
num3 *= num2;
((TMP_Text)OtherTextParent.GetComponent<TextMeshProUGUI>()).text = "Base DPS: " + Mathf.RoundToInt(num3);
}
else
{
((TMP_Text)OtherTextParent.GetComponent<TextMeshProUGUI>()).faceColor = Color32.op_Implicit(Color.white);
}
if ((Object)(object)item.TeachSpell != (Object)null)
{
((TMP_Text)Lore).verticalAlignment = (VerticalAlignmentOptions)1024;
StatTextParent.SetActive(false);
OtherTextParent.SetActive(true);
Spell teachSpell = item.TeachSpell;
ReqLvl.SetActive(true);
((TMP_Text)ReqLvl.GetComponent<TextMeshProUGUI>()).text = "Required Level: " + teachSpell.RequiredLevel + "\n\nMana Cost: " + teachSpell.ManaCost + "\nSpell Type: " + ((object)(SpellType)(ref teachSpell.Type)).ToString() + "\n\n" + teachSpell.SpellDesc;
}
else if ((Object)(object)item.Aura != (Object)null)
{
StatTextParent.SetActive(false);
OtherTextParent.SetActive(true);
((TMP_Text)Lore).verticalAlignment = (VerticalAlignmentOptions)512;
((TMP_Text)Lore).text = "<color=#16EC00>Aura Item</color>\nAuras effect entire party\nAuras of same type do not stack\n\n<color=#16EC00>" + item.Aura.SpellName + "</color>\n" + item.Aura.SpellDesc;
}
if ((Object)(object)item.TeachSkill != (Object)null)
{
((TMP_Text)Lore).verticalAlignment = (VerticalAlignmentOptions)1024;
StatTextParent.SetActive(false);
OtherTextParent.SetActive(true);
ReqLvl.SetActive(true);
Skill teachSkill = item.TeachSkill;
string text = "Required Level: \n";
if (teachSkill.DuelistRequiredLevel != 0)
{
text = text + "Duelist: " + teachSkill.DuelistRequiredLevel + "\n";
}
if (teachSkill.DruidRequiredLevel != 0)
{
text = text + "Druid: " + teachSkill.DruidRequiredLevel + "\n";
}
if (teachSkill.ArcanistRequiredLevel != 0)
{
text = text + "Arcanist: " + teachSkill.ArcanistRequiredLevel + "\n";
}
if (teachSkill.PaladinRequiredLevel != 0)
{
text = text + "Paladin: " + teachSkill.PaladinRequiredLevel + "\n";
}
((TMP_Text)ReqLvl.GetComponent<TextMeshProUGUI>()).text = text + "\n\nSkill Type: " + ((object)(SkillType)(ref teachSkill.TypeOfSkill)).ToString() + "\n\n" + teachSkill.SkillDesc;
if (!teachSkill.SimPlayersAutolearn)
{
((TMP_Text)Lore).text = "<color=yellow>SimPlayers DO NOT automatically learn this skill!\nHand this book to them to allow them to use it.</color>";
}
}
if ((int)item.RequiredSlot == 0 && (Object)(object)item.ItemEffectOnClick == (Object)null)
{
StatTextParent.SetActive(false);
}
_ = item.Template;
}
public void CloseItemWindow()
{
if (ParentWindow.activeSelf)
{
ParentWindow.SetActive(false);
}
}
public bool isWindowActive()
{
return ParentWindow.activeSelf;
}
}
[BepInPlugin("Brad522.CompareEquipment", "Compare Equipment", "1.2.1")]
public class CompareEquipment : BaseUnityPlugin
{
[HarmonyPatch(typeof(ItemIcon))]
[HarmonyPatch("OnPointerEnter")]
private class PlayerItemOnPointerEnterPatch
{
private static bool Prefix(ItemIcon __instance)
{
//IL_0006: 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)
//IL_0025: 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_00ad: Unknown result type (might be due to invalid IL or missing references)
//IL_00de: Unknown result type (might be due to invalid IL or missing references)
//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
if ((int)__instance.MyItem.RequiredSlot == 0)
{
return true;
}
GameData.HighlightedItem = __instance;
((Component)__instance).transform.localScale = Vector3.one * 1.33f;
if ((Object)(object)__instance.MyItem == (Object)(object)GameData.PlayerInv.Empty || __instance.dragging)
{
return false;
}
GameData.PlayerAud.PlayOneShot(GameData.Misc.Click, 0.05f * GameData.SFXVol);
curItemLook = new ItemSlotData(__instance);
float y = Input.mousePosition.y;
int num = ((y > (float)(Screen.height / 2)) ? (-225) : 225);
int num2 = -250 - 347;
DisplayItemInfoWindow(new Vector2(-250f, (float)num), y);
if (!GameData.InspectSim.InspectWindow.activeSelf)
{
DisplayCompareWindow(new Vector2((float)num2, (float)num), y);
}
else
{
DisplayCompareWindow(new Vector2((float)num2, (float)num), y, inspectSim: true);
}
HandleItemQuests();
return false;
}
}
[HarmonyPatch(typeof(ItemIcon))]
[HarmonyPatch("OnPointerExit")]
private class PlayerItemOnPointerExitPatch
{
private static bool Prefix(ItemIcon __instance)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
if ((int)__instance.MyItem.RequiredSlot == 0)
{
return true;
}
GameData.HighlightedItem = null;
if (GameData.ItemInfoWindow.isWindowActive())
{
GameData.ItemInfoWindow.CloseItemWindow();
}
if (ItemCompareWindow.isWindowActive())
{
ItemCompareWindow.CloseItemWindow();
}
return false;
}
}
[HarmonyPatch(typeof(SimItemDisplay))]
[HarmonyPatch("OnPointerEnter")]
private class SimItemOnPointerEnterPatch
{
private static bool Prefix(SimItemDisplay __instance)
{
//IL_0038: 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)
if ((Object)(object)__instance.MyItem == (Object)(object)GameData.PlayerInv.Empty)
{
return false;
}
GameData.PlayerAud.PlayOneShot(GameData.Misc.Click, 0.05f * GameData.SFXVol);
float y = Input.mousePosition.y;
int num = ((y > (float)(Screen.height / 2)) ? (-225) : 225);
curItemLook = new ItemSlotData(__instance);
DisplayItemInfoWindow(new Vector2(-250f, (float)num), y);
return false;
}
}
[HarmonyPatch(typeof(SimItemDisplay))]
[HarmonyPatch("OnPointerExit")]
private class SimItemOnPointerExitPatch
{
private static void Postfix(SimItemDisplay __instance)
{
if (GameData.ItemInfoWindow.isWindowActive())
{
GameData.ItemInfoWindow.CloseItemWindow();
}
}
}
public class ItemSlotData
{
public object Source { get; }
public Item MyItem { get; }
public SlotType ThisSlotType { get; }
public int Quantity { get; }
public Transform transform
{
get
{
object source = Source;
object obj = ((source is ItemIcon) ? source : null);
object obj2 = ((obj != null) ? ((Component)obj).transform : null);
if (obj2 == null)
{
object source2 = Source;
object obj3 = ((source2 is SimItemDisplay) ? source2 : null);
if (obj3 == null)
{
return null;
}
obj2 = ((Component)obj3).transform;
}
return (Transform)obj2;
}
}
public bool VendorSlot
{
get
{
object source = Source;
return ((ItemIcon)(((source is ItemIcon) ? source : null)?)).VendorSlot ?? false;
}
}
public bool LootSlot
{
get
{
object source = Source;
return ((ItemIcon)(((source is ItemIcon) ? source : null)?)).LootSlot ?? false;
}
}
public ItemSlotData(ItemIcon icon)
{
//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)
Source = icon;
MyItem = icon.MyItem;
ThisSlotType = icon.ThisSlotType;
Quantity = icon.Quantity;
}
public ItemSlotData(SimInvSlot slot)
{
//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)
Source = slot;
MyItem = slot.MyItem;
ThisSlotType = slot.ThisSlotType;
Quantity = slot.Quant;
}
public ItemSlotData(SimItemDisplay slot)
{
//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)
Source = slot;
MyItem = slot.MyItem;
ThisSlotType = slot.Slot;
Quantity = 1;
}
}
[CompilerGenerated]
private sealed class <WaitForCompareWindow>d__43 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public Item item;
public Vector3 position;
public int quantity;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <WaitForCompareWindow>d__43(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
break;
case 1:
<>1__state = -1;
break;
}
if ((Object)(object)ItemCompareWindow == (Object)null)
{
<>2__current = null;
<>1__state = 1;
return true;
}
ItemCompareWindow.DisplayItem(item, Vector2.op_Implicit(position), quantity);
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();
}
}
internal const string ModName = "CompareEquipment";
internal const string ModVersion = "1.2.1";
internal const string ModDescription = "Compare Equipment";
internal const string Author = "Brad522";
private const string ModGUID = "Brad522.CompareEquipment";
private readonly Harmony harmony = new Harmony("Brad522.CompareEquipment");
private GameObject gameUI;
private GameObject playerInvUI;
private GameObject inspectSimUI;
private ItemIcon dragIcon;
private static RectTransform canvasRect;
private static RectTransform positionDummy;
private bool uiInitialized;
private static float halfScaledWindowWidth;
private static float minValidX;
private static Resolution curResolution;
public static GameObject clonedItemInfo;
public static ItemCompareWindow ItemCompareWindow;
public static ItemSlotData curItemLook;
public static ItemSlotData curItemEquip;
public static List<ItemSlotData> equipSlots;
public static Vector3 compareWindowPos;
private ConfigEntry<KeyboardShortcut> switchKey;
public void Awake()
{
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
harmony.PatchAll();
uiInitialized = false;
float num = (float)Screen.width / 1920f;
float num2 = (float)Screen.height / 1080f;
float num3 = Mathf.Min(num, num2);
halfScaledWindowWidth = 350f * num3 / 2f;
curResolution = Screen.currentResolution;
minValidX = 5f;
switchKey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("General", "Hotkey", new KeyboardShortcut((KeyCode)102, Array.Empty<KeyCode>()), "Hotkey used to switch the slot you are comparing with.");
((BaseUnityPlugin)this).Logger.LogMessage((object)"CompareEquipment loaded successfully!");
}
private void OnDestroy()
{
//IL_00b6: 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)
harmony.UnpatchAll("Brad522.CompareEquipment");
if ((Object)(object)clonedItemInfo != (Object)null)
{
Object.Destroy((Object)(object)clonedItemInfo);
}
if ((Object)(object)ItemCompareWindow != (Object)null)
{
Object.Destroy((Object)(object)ItemCompareWindow);
}
if ((Object)(object)positionDummy != (Object)null)
{
Object.Destroy((Object)(object)((Component)positionDummy).gameObject);
}
if (equipSlots != null)
{
equipSlots.Clear();
}
gameUI = null;
playerInvUI = null;
inspectSimUI = null;
dragIcon = null;
canvasRect = null;
positionDummy = null;
clonedItemInfo = null;
ItemCompareWindow = null;
curItemLook = null;
curItemEquip = null;
equipSlots = null;
compareWindowPos = default(Vector3);
uiInitialized = false;
curResolution = default(Resolution);
halfScaledWindowWidth = 0f;
minValidX = 0f;
}
private void Update()
{
if (uiInitialized && !CheckUIElementsInit())
{
uiInitialized = false;
}
if (!uiInitialized)
{
TryInitializeUIReferences();
}
ClampWindows();
HandleClosingWindows();
HandleCompareWindowSwitch();
}
private bool CheckUIElementsInit()
{
if ((Object)(object)gameUI != (Object)null && (Object)(object)clonedItemInfo != (Object)null && (Object)(object)ItemCompareWindow != (Object)null && (Object)(object)playerInvUI != (Object)null && (Object)(object)inspectSimUI != (Object)null && (Object)(object)dragIcon != (Object)null && (Object)(object)canvasRect != (Object)null)
{
return (Object)(object)positionDummy != (Object)null;
}
return false;
}
private void TryInitializeUIReferences()
{
//IL_016d: Unknown result type (might be due to invalid IL or missing references)
//IL_0173: Expected O, but got Unknown
//IL_019a: Unknown result type (might be due to invalid IL or missing references)
//IL_01af: Unknown result type (might be due to invalid IL or missing references)
//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)gameUI == (Object)null)
{
gameUI = GameObject.Find("UI");
if ((Object)(object)gameUI == (Object)null)
{
return;
}
}
if ((Object)(object)clonedItemInfo == (Object)null)
{
GameObject val = FindChild(gameUI.transform, "ItemInfo");
if ((Object)(object)val != (Object)null)
{
clonedItemInfo = Object.Instantiate<GameObject>(val, gameUI.transform);
}
}
if ((Object)(object)ItemCompareWindow == (Object)null && (Object)(object)clonedItemInfo != (Object)null)
{
ItemCompareWindow = gameUI.AddComponent<ItemCompareWindow>();
}
if ((Object)(object)ItemCompareWindow != (Object)null)
{
InitItemCompareWindow();
}
if ((Object)(object)playerInvUI == (Object)null)
{
playerInvUI = FindChild(gameUI.transform, "UIElements/InvPar/PlayerInv");
}
if ((Object)(object)inspectSimUI == (Object)null)
{
inspectSimUI = FindChild(gameUI.transform, "UIElements/SimInspectPar/InspectSim");
}
if ((Object)(object)dragIcon == (Object)null && (Object)(object)playerInvUI != (Object)null)
{
dragIcon = FindAndGet<ItemIcon>(playerInvUI.transform, "Mouse Slot/ItemIcon (2)");
}
if ((Object)(object)canvasRect == (Object)null)
{
canvasRect = ((Component)gameUI.GetComponent<Canvas>()).GetComponent<RectTransform>();
}
if ((Object)(object)positionDummy == (Object)null)
{
GameObject val2 = new GameObject("PositionDummy");
val2.transform.SetParent(gameUI.transform);
RectTransform obj = val2.AddComponent<RectTransform>();
obj.anchorMin = new Vector2(0.5f, 0.5f);
obj.anchorMax = new Vector2(0.5f, 0.5f);
obj.pivot = new Vector2(0.5f, 0.5f);
obj.sizeDelta = Vector2.zero;
val2.SetActive(false);
positionDummy = obj;
}
uiInitialized = CheckUIElementsInit();
}
private void ClampWindows()
{
//IL_001f: 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_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: 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_0108: Unknown result type (might be due to invalid IL or missing references)
//IL_010a: 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_0119: Unknown result type (might be due to invalid IL or missing references)
//IL_011b: Unknown result type (might be due to invalid IL or missing references)
//IL_0120: Unknown result type (might be due to invalid IL or missing references)
//IL_0122: Unknown result type (might be due to invalid IL or missing references)
//IL_0124: Unknown result type (might be due to invalid IL or missing references)
//IL_012e: Unknown result type (might be due to invalid IL or missing references)
//IL_0130: Unknown result type (might be due to invalid IL or missing references)
//IL_0132: Unknown result type (might be due to invalid IL or missing references)
//IL_0137: Unknown result type (might be due to invalid IL or missing references)
//IL_013c: Unknown result type (might be due to invalid IL or missing references)
if (!uiInitialized || !ItemCompareWindow.isWindowActive())
{
return;
}
int width = ((Resolution)(ref curResolution)).width;
Resolution currentResolution = Screen.currentResolution;
if (width == ((Resolution)(ref currentResolution)).width)
{
int height = ((Resolution)(ref curResolution)).height;
currentResolution = Screen.currentResolution;
if (height == ((Resolution)(ref currentResolution)).height)
{
goto IL_0083;
}
}
curResolution = Screen.currentResolution;
float num = (float)Screen.width / 1920f;
float num2 = (float)Screen.height / 1080f;
float num3 = Mathf.Min(num, num2);
halfScaledWindowWidth = 350f * num3 / 2f;
goto IL_0083;
IL_0083:
if (CheckOutOfBounds())
{
Transform transform = ItemCompareWindow.ParentWindow.transform;
Transform transform2 = GameData.ItemInfoWindow.ParentWindow.transform;
Vector2 val = Vector2.op_Implicit(transform.position);
Vector2 val2 = Vector2.op_Implicit(transform2.position);
float num4 = val.x - halfScaledWindowWidth;
float num5 = Mathf.Max(0f, minValidX - num4);
Vector2 val3 = default(Vector2);
((Vector2)(ref val3))..ctor(num5, 0f);
Vector2 val4 = default(Vector2);
((Vector2)(ref val4))..ctor(200f, 100f);
transform2.position = Vector2.op_Implicit(val2 + val3);
Vector2 val5 = val + val3;
transform.position = Vector2.op_Implicit(val5);
compareWindowPos = Vector2.op_Implicit(val5 + val4);
}
}
private void HandleClosingWindows()
{
if (uiInitialized && (ItemCompareWindow.isWindowActive() || GameData.ItemInfoWindow.isWindowActive()))
{
bool flag = (Object)(object)playerInvUI == (Object)null || !playerInvUI.activeSelf;
bool num = (Object)(object)inspectSimUI == (Object)null || !inspectSimUI.activeSelf;
bool flag2 = (Object)(object)dragIcon != (Object)null && dragIcon.dragging;
bool flag3 = flag || flag2;
bool num2 = num && flag3;
if (flag3 && ItemCompareWindow.isWindowActive())
{
ItemCompareWindow.CloseItemWindow();
}
if (num2 && GameData.ItemInfoWindow.isWindowActive())
{
GameData.ItemInfoWindow.CloseItemWindow();
}
}
}
private void HandleCompareWindowSwitch()
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Invalid comparison between Unknown and I4
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_0098: Invalid comparison between Unknown and I4
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Invalid comparison between Unknown and I4
//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
//IL_00ce: Invalid comparison between Unknown and I4
//IL_009f: Unknown result type (might be due to invalid IL or missing references)
//IL_00a6: Invalid comparison between Unknown and I4
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Invalid comparison between Unknown and I4
//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
//IL_00db: Invalid comparison between Unknown and I4
//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Invalid comparison between Unknown and I4
//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Invalid comparison between Unknown and I4
//IL_014b: 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)
if (!uiInitialized || !ItemCompareWindow.isWindowActive())
{
return;
}
KeyboardShortcut value = switchKey.Value;
if (((KeyboardShortcut)(ref value)).IsDown() && curItemLook != null && curItemEquip != null && !((Object)(object)curItemLook.MyItem == (Object)(object)GameData.PlayerInv.Empty) && ((int)curItemLook.MyItem.RequiredSlot == 15 || (int)curItemLook.MyItem.RequiredSlot == 7 || (int)curItemLook.MyItem.RequiredSlot == 6) && ((int)curItemEquip.ThisSlotType == 13 || (int)curItemEquip.ThisSlotType == 14 || (int)curItemEquip.ThisSlotType == 7 || (int)curItemEquip.ThisSlotType == 6))
{
if ((int)curItemEquip.ThisSlotType == 6 || (int)curItemEquip.ThisSlotType == 7)
{
curItemEquip = GetEquippedItem(curItemEquip.ThisSlotType, switchRingWrist: true);
}
else
{
curItemEquip = GetEquippedItem(GetAlternateSlotType(curItemEquip.ThisSlotType), switchRingWrist: false);
}
if (curItemEquip != null && !((Object)(object)curItemEquip.MyItem == (Object)(object)GameData.PlayerInv.Empty))
{
ItemCompareWindow.CloseItemWindow();
ItemCompareWindow.DisplayItem(curItemEquip.MyItem, Vector2.op_Implicit(compareWindowPos), curItemEquip.Quantity);
}
}
}
private static bool CheckOutOfBounds()
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
return ItemCompareWindow.ParentWindow.transform.position.x - halfScaledWindowWidth < minValidX - 0.01f;
}
private void InitItemCompareWindow()
{
//IL_0328: Unknown result type (might be due to invalid IL or missing references)
//IL_032d: 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_036e: Unknown result type (might be due to invalid IL or missing references)
//IL_0373: Unknown result type (might be due to invalid IL or missing references)
//IL_0391: Unknown result type (might be due to invalid IL or missing references)
//IL_0396: Unknown result type (might be due to invalid IL or missing references)
//IL_03a0: Unknown result type (might be due to invalid IL or missing references)
//IL_03a5: Unknown result type (might be due to invalid IL or missing references)
//IL_03af: Unknown result type (might be due to invalid IL or missing references)
//IL_03b4: Unknown result type (might be due to invalid IL or missing references)
clonedItemInfo.SetActive(false);
Transform transform = clonedItemInfo.transform;
ItemCompareWindow.ParentWindow = clonedItemInfo;
ItemCompareWindow.OtherTextParent = FindChild(transform, "OtherText");
ItemCompareWindow.StatTextParent = FindChild(transform, "EquipmentInfo");
ItemCompareWindow.ItemEffect = FindChild(transform, "OnClick");
ItemCompareWindow.ReqLvl = FindChild(transform, "ReqLvl");
ItemCompareWindow.Banner = FindAndGet<Image>(transform, "BG");
ItemCompareWindow.ItemIcon = FindAndGet<Image>(transform, "Icon");
ItemCompareWindow.ItemName = FindAndGet<TextMeshProUGUI>(transform, "Title");
ItemCompareWindow.Lore = FindAndGet<TextMeshProUGUI>(transform, "Lore");
ItemCompareWindow.Usable = FindAndGet<TextMeshProUGUI>(transform, "UsableBy");
ItemCompareWindow.itemPrice = FindAndGet<TextMeshProUGUI>(transform, "Text (TMP) (6)");
Transform parent = ItemCompareWindow.ItemEffect.transform.Find("Image (1)");
ItemCompareWindow.ClickDesc = FindAndGet<TextMeshProUGUI>(parent, "SpellDesc");
ItemCompareWindow.ClickSpell = FindAndGet<TextMeshProUGUI>(parent, "SpellName");
Transform transform2 = ItemCompareWindow.StatTextParent.transform;
ItemCompareWindow.AC = FindAndGet<TextMeshProUGUI>(transform2, "ArmorStat");
ItemCompareWindow.Agi = FindAndGet<TextMeshProUGUI>(transform2, "AgiStat");
ItemCompareWindow.Cha = FindAndGet<TextMeshProUGUI>(transform2, "ChaStat");
ItemCompareWindow.DelNum = FindAndGet<TextMeshProUGUI>(transform2, "DelStat");
ItemCompareWindow.DelTXT = FindAndGet<TextMeshProUGUI>(transform2, "Delay");
ItemCompareWindow.Dex = FindAndGet<TextMeshProUGUI>(transform2, "DexStat");
ItemCompareWindow.DMGNum = FindAndGet<TextMeshProUGUI>(transform2, "DmgStat");
ItemCompareWindow.DMGtxt = FindAndGet<TextMeshProUGUI>(transform2, "Damage");
ItemCompareWindow.End = FindAndGet<TextMeshProUGUI>(transform2, "EndStat");
ItemCompareWindow.ER = FindAndGet<TextMeshProUGUI>(transform2, "ERStat");
ItemCompareWindow.HP = FindAndGet<TextMeshProUGUI>(transform2, "HealthStat");
ItemCompareWindow.Int = FindAndGet<TextMeshProUGUI>(transform2, "IntStat");
ItemCompareWindow.Mana = FindAndGet<TextMeshProUGUI>(transform2, "ManaStat");
ItemCompareWindow.MR = FindAndGet<TextMeshProUGUI>(transform2, "MRStat");
ItemCompareWindow.PR = FindAndGet<TextMeshProUGUI>(transform2, "PRStat");
ItemCompareWindow.Res = FindAndGet<TextMeshProUGUI>(transform2, "ResStat");
ItemCompareWindow.Slot = FindAndGet<TextMeshProUGUI>(transform2, "SlotType");
ItemCompareWindow.Str = FindAndGet<TextMeshProUGUI>(transform2, "StrStat");
ItemCompareWindow.VR = FindAndGet<TextMeshProUGUI>(transform2, "VRStat");
ItemCompareWindow.Wis = FindAndGet<TextMeshProUGUI>(transform2, "WisStat");
ItemCompareWindow.GodlyText = new Color(0.9894f, 0.533f, 1f, 1f);
ItemCompareWindow.Legendary = new Color(1f, 0f, 0.7107f, 1f);
ItemCompareWindow.Blessed = new Color(0f, 0.5583f, 1f, 1f);
ItemCompareWindow.BlessedText = new Color(0f, 0.9802f, 1f, 1f);
ItemCompareWindow.Normal = Color.white;
ItemCompareWindow.NormalText = Color.white;
}
private T FindAndGet<T>(Transform parent, string path) where T : Component
{
Transform val = parent.Find(path);
if (!((Object)(object)val != (Object)null))
{
return default(T);
}
return ((Component)val).GetComponent<T>();
}
private GameObject FindChild(Transform parent, string path)
{
Transform obj = parent.Find(path);
if (obj == null)
{
return null;
}
return ((Component)obj).gameObject;
}
public static ItemSlotData GetEquippedItem(SlotType slotNeeded, bool switchRingWrist)
{
//IL_0016: 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)
//IL_0027: 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_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Invalid comparison between Unknown and I4
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Invalid comparison between Unknown and I4
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Invalid comparison between Unknown and I4
foreach (ItemSlotData equipSlot in equipSlots)
{
SlotType thisSlotType = equipSlot.ThisSlotType;
if (!switchRingWrist || equipSlot != curItemEquip)
{
if (thisSlotType == slotNeeded)
{
return equipSlot;
}
if ((int)slotNeeded == 15 && ((int)thisSlotType == 13 || (int)thisSlotType == 14) && (Object)(object)equipSlot.MyItem != (Object)(object)GameData.PlayerInv.Empty)
{
return equipSlot;
}
}
}
return null;
}
private SlotType GetAlternateSlotType(SlotType curSlotType)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0003: Invalid comparison between Unknown and I4
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Invalid comparison between Unknown and I4
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
if ((int)curSlotType != 13)
{
if ((int)curSlotType == 14)
{
return (SlotType)13;
}
return curSlotType;
}
return (SlotType)14;
}
private static void DisplayItemInfoWindow(Vector2 offset, float mouseY)
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
Vector2 val = CalculatePosition(curItemLook.transform, offset, mouseY);
if (!(val == Vector2.zero))
{
GameData.ItemInfoWindow.DisplayItem(curItemLook.MyItem, val, curItemLook.Quantity);
}
}
private static void DisplayCompareWindow(Vector2 offset, float mouseY)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
DisplayCompareWindow(offset, mouseY, inspectSim: false);
}
private static void DisplayCompareWindow(Vector2 offset, float mouseY, bool inspectSim)
{
//IL_00b3: 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_00f7: Unknown result type (might be due to invalid IL or missing references)
//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
//IL_010b: Unknown result type (might be due to invalid IL or missing references)
//IL_010c: Unknown result type (might be due to invalid IL or missing references)
//IL_0111: Unknown result type (might be due to invalid IL or missing references)
//IL_0156: Unknown result type (might be due to invalid IL or missing references)
//IL_0132: Unknown result type (might be due to invalid IL or missing references)
//IL_0137: Unknown result type (might be due to invalid IL or missing references)
if (!inspectSim)
{
equipSlots = GameData.PlayerInv.EquipmentSlots.Select((ItemIcon slot) => new ItemSlotData(slot)).ToList();
}
else
{
equipSlots = GameData.InspectSim.Who.MyEquipment.Select((SimInvSlot slot) => new ItemSlotData(slot)).ToList();
}
if (!inspectSim && equipSlots.Any((ItemSlotData slot) => slot.Source == curItemLook.Source))
{
return;
}
curItemEquip = GetEquippedItem(curItemLook.MyItem.RequiredSlot, switchRingWrist: false);
if (curItemEquip == null || !((Object)(object)curItemEquip.MyItem != (Object)(object)GameData.PlayerInv.Empty))
{
return;
}
Vector2 val = CalculatePosition(curItemLook.transform, offset, mouseY);
if (!(val == Vector2.zero))
{
compareWindowPos = Vector2.op_Implicit(val);
if ((Object)(object)ItemCompareWindow != (Object)null)
{
ItemCompareWindow.DisplayItem(curItemEquip.MyItem, Vector2.op_Implicit(compareWindowPos), curItemEquip.Quantity);
}
else
{
CoroutineRunner.Run(WaitForCompareWindow(curItemEquip.MyItem, compareWindowPos, curItemEquip.Quantity));
}
}
}
private static Vector2 CalculatePosition(Transform itemTransform, Vector2 offset, float mouseY)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: 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_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: 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_0093: 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_00a3: 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_00a9: 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_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = (((int)curItemLook.ThisSlotType != 0 && !curItemLook.VendorSlot && !curItemLook.LootSlot) ? itemTransform.position : itemTransform.parent.position);
if ((Object)(object)canvasRect == (Object)null)
{
return Vector2.zero;
}
Vector2 val2 = default(Vector2);
RectTransformUtility.ScreenPointToLocalPointInRectangle(canvasRect, Vector2.op_Implicit(val), (Camera)null, ref val2);
int num = ((!(mouseY > (float)Screen.height * 0.5f)) ? 1 : (-1));
Vector2 val3 = default(Vector2);
((Vector2)(ref val3))..ctor(-200f, 100f * (float)num);
Vector2 val4 = default(Vector2);
RectTransformUtility.ScreenPointToLocalPointInRectangle(canvasRect, Vector2.op_Implicit(val) + val3, (Camera)null, ref val4);
Vector2 val5 = val4 - val2;
positionDummy.anchoredPosition = val2 - val5 + offset;
return Vector2.op_Implicit(((Component)positionDummy).transform.position);
}
private static void HandleItemQuests()
{
if ((Object)(object)curItemLook.MyItem.AssignQuestOnRead != (Object)null && (curItemLook.MyItem.AssignQuestOnRead.repeatable || !GameData.CompletedQuests.Contains(curItemLook.MyItem.AssignQuestOnRead.DBName)))
{
GameData.AssignQuest(curItemLook.MyItem.AssignQuestOnRead.DBName);
}
if ((Object)(object)curItemLook.MyItem.CompleteOnRead != (Object)null)
{
GameData.FinishQuest(curItemLook.MyItem.CompleteOnRead.DBName);
}
}
[IteratorStateMachine(typeof(<WaitForCompareWindow>d__43))]
private static IEnumerator WaitForCompareWindow(Item item, Vector3 position, int quantity)
{
//IL_000e: 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)
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <WaitForCompareWindow>d__43(0)
{
item = item,
position = position,
quantity = quantity
};
}
}