using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Nessie.ATLYSS.EasySettings;
using UnityEngine;
using UnityEngine.Events;
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: TargetFramework(".NETFramework,Version=v4.6", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("EzVanity")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("0.1.0.0")]
[assembly: AssemblyInformationalVersion("0.1.0+8dcd8744c49e566eb6831e601a3b7468a756bd6a")]
[assembly: AssemblyProduct("EzVanity")]
[assembly: AssemblyTitle("EzVanity")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace EzVanity
{
[BepInPlugin("ez.vanity", "Easy Vanity", "1.0")]
public class Plugin : BaseUnityPlugin
{
[HarmonyPatch(typeof(VanityMirrorManager), "Update")]
public class VanityMirrorManagerCostPatch
{
private static void Postfix(VanityMirrorManager __instance)
{
if (!Instance.IsFreeAppearanceEnabled())
{
return;
}
FieldInfo field = typeof(VanityMirrorManager).GetField("_currentAppearanceCost", BindingFlags.Instance | BindingFlags.NonPublic);
FieldInfo field2 = typeof(VanityMirrorManager).GetField("_appearanceCostCounter", BindingFlags.Instance | BindingFlags.NonPublic);
FieldInfo field3 = typeof(VanityMirrorManager).GetField("_applyAppearanceButton", BindingFlags.Instance | BindingFlags.NonPublic);
if (field != null && field2 != null && field3 != null)
{
field.SetValue(__instance, 0);
object? value = field2.GetValue(__instance);
Text val = (Text)((value is Text) ? value : null);
if ((Object)(object)val != (Object)null)
{
val.text = $"Cost: x{0}";
}
object? value2 = field3.GetValue(__instance);
Button val2 = (Button)((value2 is Button) ? value2 : null);
if ((Object)(object)val2 != (Object)null)
{
((Selectable)val2).interactable = true;
}
}
}
}
[HarmonyPatch(typeof(PlayerEquipment), "<Init_TransmogItem>g__Retrieve_IllusionStoneCount|22_0")]
public class PatchRetrieveIllusionStoneCount
{
private static bool Prefix(ref int __result)
{
if (!Instance.IsFreeTransmogEnabled())
{
return true;
}
__result = 1;
return false;
}
}
[HarmonyPatch(typeof(PlayerInventory), "Remove_Item")]
public class PatchRemoveIllusionStone
{
private static bool Prefix(PlayerInventory __instance, ItemData _itemData, int _quantity)
{
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Invalid comparison between Unknown and I4
if (!Instance.IsFreeTransmogEnabled())
{
return true;
}
if ((int)TabMenu._current._itemCell._currentEquipCellTab != 1)
{
return true;
}
if (_itemData._itemName == "Illusion Stone" && _quantity > 0)
{
return false;
}
return true;
}
}
[HarmonyPatch(typeof(ItemListDataEntry), "CanTransmogItem")]
public class PatchCanTransmogItem
{
private static bool Prefix(ItemListDataEntry __instance, ref bool __result)
{
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Invalid comparison between Unknown and I4
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Expected O, but got Unknown
if (!Instance.IsUnlockedTransmogEnabled())
{
return true;
}
if ((int)__instance._scriptableItem._itemType == 0)
{
ScriptableEquipment scriptableEquipment = (ScriptableEquipment)__instance._scriptableItem;
Instance.CheckEquipmentType(scriptableEquipment);
if (Instance.IsNotWeaponOrRing())
{
__result = true;
return false;
}
}
__result = false;
return false;
}
}
[HarmonyPatch(typeof(ItemMenuCell), "AbleToTransmogEquip")]
public class PatchAbleToTransmogEquip
{
private static void Postfix(ItemMenuCell __instance, ItemListDataEntry _listEntry, ref bool __result)
{
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Invalid comparison between Unknown and I4
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Expected O, but got Unknown
if (Instance.IsUnlockedTransmogEnabled() && (int)_listEntry._scriptableItem._itemType == 0)
{
ScriptableEquipment scriptableEquipment = (ScriptableEquipment)_listEntry._scriptableItem;
Instance.CheckEquipmentType(scriptableEquipment);
if (Instance.IsNotWeaponOrRing())
{
__result = true;
}
}
}
}
private const string modGUID = "ez.vanity";
private const string modName = "Easy Vanity";
private const string modVersion = "1.0";
private static ConfigEntry<bool> ConfigEnableFree;
private static ConfigEntry<bool> ConfigEnableFreeTransmog;
private static ConfigEntry<bool> ConfigEnableUnlockedTransmog;
private bool isNotWeaponOrRing;
private ScriptableEquipment currentScriptableEquipment;
public static Plugin Instance { get; private set; }
private void Awake()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Expected O, but got Unknown
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Expected O, but got Unknown
Instance = this;
new Harmony("Easy Vanity").PatchAll();
((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin ez.vanity is loaded!");
InitConfig();
Settings.OnInitialized.AddListener(new UnityAction(AddSettings));
Settings.OnApplySettings.AddListener((UnityAction)delegate
{
((BaseUnityPlugin)this).Config.Save();
});
}
private void InitConfig()
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Expected O, but got Unknown
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Expected O, but got Unknown
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Expected O, but got Unknown
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Expected O, but got Unknown
//IL_0085: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Expected O, but got Unknown
ConfigDefinition val = new ConfigDefinition("Free Appearance Change", "EnableFreeAppearance");
ConfigDescription val2 = new ConfigDescription("Enable or disable changing appearance for free.", (AcceptableValueBase)null, Array.Empty<object>());
ConfigEnableFree = ((BaseUnityPlugin)this).Config.Bind<bool>(val, true, val2);
ConfigDefinition val3 = new ConfigDefinition("Free Transmog", "EnableFreeTransmog");
ConfigDescription val4 = new ConfigDescription("Enable or disable transmogging for free.", (AcceptableValueBase)null, Array.Empty<object>());
ConfigEnableFreeTransmog = ((BaseUnityPlugin)this).Config.Bind<bool>(val3, true, val4);
ConfigDefinition val5 = new ConfigDefinition("Unlocked Transmog", "EnableUnlockedTransmog");
ConfigDescription val6 = new ConfigDescription("Enable or disable transmogging for free.", (AcceptableValueBase)null, Array.Empty<object>());
ConfigEnableUnlockedTransmog = ((BaseUnityPlugin)this).Config.Bind<bool>(val5, true, val6);
}
private void AddSettings()
{
SettingsTab modTab = Settings.ModTab;
modTab.AddHeader("Easy Vanity");
modTab.AddToggle("Free Appearance Changes", ConfigEnableFree);
modTab.AddToggle("Free Transmog", ConfigEnableFreeTransmog);
modTab.AddToggle("Unlocked Transmog", ConfigEnableUnlockedTransmog);
}
private bool IsFreeAppearanceEnabled()
{
return ConfigEnableFree.Value;
}
private bool IsFreeTransmogEnabled()
{
return ConfigEnableFreeTransmog.Value;
}
private bool IsUnlockedTransmogEnabled()
{
return ConfigEnableUnlockedTransmog.Value;
}
public void CheckEquipmentType(ScriptableEquipment scriptableEquipment)
{
currentScriptableEquipment = scriptableEquipment;
isNotWeaponOrRing = !(((object)scriptableEquipment).GetType() == typeof(ScriptableWeapon)) && !(((object)scriptableEquipment).GetType() == typeof(ScriptableRing));
}
public bool IsNotWeaponOrRing()
{
return isNotWeaponOrRing;
}
}
}