using System;
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 System.Security;
using System.Security.Permissions;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using OutwardEnchantmentsViewer.Enchantments;
using OutwardEnchantmentsViewer.Managers;
using OutwardEnchantmentsViewer.UI;
using OutwardEnchantmentsViewer.Utility.Enums;
using OutwardEnchantmentsViewer.Utility.Fixers;
using OutwardEnchantmentsViewer.Utility.Helpers;
using SideLoader;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("OutwardEnchantmentsViewer")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OutwardEnchanmentsViewe")]
[assembly: AssemblyCopyright("Copyright © 2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("c5450fe0-edcf-483f-b9ea-4b1ef9d36da7")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace OutwardEnchantmentsViewer
{
[BepInPlugin("gymmed.outwardenchantmentsviewer", "Outward Enchantments Viewer", "0.0.1")]
public class OutwardEnchantmentsViewer : BaseUnityPlugin
{
[HarmonyPatch(typeof(ItemDetailsDisplay), "OnScrollDownPressed")]
public class Patch_OnScrollDownPressed
{
private static bool Prefix(ItemDetailsDisplay __instance)
{
//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)
if (__instance.m_movingScrollview)
{
return false;
}
float viewPortSize = __instance.m_viewPortSize;
Rect rect = __instance.m_contentScrollView.content.rect;
float num = viewPortSize / ((Rect)(ref rect)).height;
__instance.m_targetScrollPos = Mathf.Clamp(__instance.m_contentScrollView.verticalNormalizedPosition - num, 0f, 1f);
__instance.m_movingScrollview = true;
((Selectable)__instance.m_btnScrollDown).interactable = false;
((Selectable)__instance.m_btnScrollUp).interactable = false;
return false;
}
}
[HarmonyPatch(typeof(ItemDetailsDisplay), "OnScrollUpPressed")]
public class Patch_OnScrollUpPressed
{
private static bool Prefix(ItemDetailsDisplay __instance)
{
//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)
if (__instance.m_movingScrollview)
{
return false;
}
float viewPortSize = __instance.m_viewPortSize;
Rect rect = __instance.m_contentScrollView.content.rect;
float num = viewPortSize / ((Rect)(ref rect)).height;
__instance.m_targetScrollPos = Mathf.Clamp(__instance.m_contentScrollView.verticalNormalizedPosition + num, 0f, 1f);
__instance.m_movingScrollview = true;
((Selectable)__instance.m_btnScrollDown).interactable = false;
((Selectable)__instance.m_btnScrollUp).interactable = false;
return false;
}
}
[HarmonyPatch(typeof(CharacterUI))]
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
public class CharacterUI_SetTargetCharacterPatch
{
[HarmonyPostfix]
private static void Postfix(CharacterUI __instance)
{
try
{
new ItemDescriptionScrollFixer(__instance);
ItemDisplayManager.Instance.CreateSection(__instance);
}
catch (Exception ex)
{
SL.Log(prefix + " CharacterUI@SetTargetCharacter error: " + ex.Message);
}
}
}
[HarmonyPatch(typeof(ItemDetailsDisplay))]
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
public class ItemDetailsDisplay_RefreshDetailsPatch
{
[HarmonyPostfix]
private static void Postfix(ItemDetailsDisplay __instance)
{
try
{
CharacterUI characterUI = ((UIElement)__instance).CharacterUI;
if (!Object.op_Implicit((Object)(object)characterUI))
{
return;
}
ItemDisplay itemDisplay = __instance.itemDisplay;
Item val = ((itemDisplay != null) ? itemDisplay.RefItem : null);
ItemDisplayManager.Instance.ShowOriginalDescription(characterUI);
Character localCharacter = ((UIElement)__instance).LocalCharacter;
CharacterInventory val2 = ((localCharacter != null) ? localCharacter.Inventory : null);
if (!Object.op_Implicit((Object)(object)val2))
{
return;
}
if (!(val is Equipment))
{
EnchantmentRecipeItem val3 = (EnchantmentRecipeItem)(object)((val is EnchantmentRecipeItem) ? val : null);
if (val3 != null)
{
ItemDescriptionsManager.Instance.SetEnchantmentsDescription(val3, val2, characterUI);
ItemDisplayManager.Instance.HideDisabledDescription(characterUI);
}
else
{
ItemDisplayManager.Instance.HideDescription(characterUI);
ItemDisplayManager.Instance.HideDisabledDescription(characterUI);
}
}
else if (val.IsNonEnchantable)
{
ItemDisplayManager.Instance.HideDescription(characterUI);
ItemDisplayManager.Instance.HideDisabledDescription(characterUI);
}
else
{
ItemDescriptionsManager.Instance.SetEquipmentsEnchantmentsDescription(val, val2, characterUI);
}
}
catch (Exception ex)
{
SL.Log(prefix + " ItemDetailsDisplay@RefreshDetails error: " + ex.Message);
}
}
}
public const string GUID = "gymmed.outwardenchantmentsviewer";
public const string NAME = "Outward Enchantments Viewer";
public const string VERSION = "0.0.1";
public static string prefix = "[gymmed-Enchantments-Viewer]";
public static ConfigEntry<bool> ExampleConfig;
public static ManualLogSource Log { get; private set; }
public static OutwardEnchantmentsViewer Instance { get; private set; }
internal void Awake()
{
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
Log = ((BaseUnityPlugin)this).Logger;
Log.LogMessage((object)"Hello world from Outward Enchantments Viewer 0.0.1!");
Log.LogMessage((object)(prefix + " Logger!"));
ExampleConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("ExampleCategory", "ExampleSetting", false, "This is an example setting.");
new Harmony("gymmed.outwardenchantmentsviewer").PatchAll();
}
internal void Update()
{
}
}
}
namespace OutwardEnchantmentsViewer.Utility.Helpers
{
public class EnchantmentInformationHelper
{
public static string GetDamageListDescription(Enchantment enchantment)
{
string text = "";
if (enchantment.DamageBonus.Count < 1)
{
return text;
}
int num = enchantment.DamageBonus.Count - 1;
DamageType damageType = enchantment.DamageBonus[0];
text += GetDamageDescription(damageType, fullGrowthWords: true);
for (int i = 1; i < num; i++)
{
damageType = enchantment.DamageBonus[i];
text = text + ", " + GetDamageDescription(damageType);
}
if (num > 0)
{
damageType = enchantment.DamageBonus[num];
text = text + " and " + GetDamageDescription(damageType);
}
return text + "\n\n";
}
private static string GetDamageDescription(DamageType damageType, bool fullGrowthWords = false)
{
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
string arg = "";
if (fullGrowthWords)
{
arg = "Lose ";
if (damageType.Damage > 0f)
{
arg = "Gain +";
}
}
else if (damageType.Damage > 0f)
{
arg = "+";
}
return $"{arg}{damageType.Damage} flat {damageType.Type} damage";
}
public static string GetModifiersListDescriptions(Enchantment enchantment)
{
string text = "";
if (enchantment.DamageModifier.Count < 1)
{
return text;
}
int num = enchantment.DamageModifier.Count - 1;
DamageType damageType = enchantment.DamageModifier[0];
text += GetModifierDescription(damageType, fullGrowthWords: true);
for (int i = 1; i < num; i++)
{
damageType = enchantment.DamageModifier[i];
text = text + ", " + GetModifierDescription(damageType);
}
if (num > 0)
{
damageType = enchantment.DamageModifier[num];
text = text + " and " + GetModifierDescription(damageType);
}
return text + "\n\n";
}
private static string GetModifierDescription(DamageType damageType, bool fullGrowthWords = false)
{
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
string arg = "";
if (fullGrowthWords)
{
arg = "Lose ";
if (damageType.Damage > 0f)
{
arg = "Gain +";
}
}
else if (damageType.Damage > 0f)
{
arg = "+";
}
return $"{arg}{damageType.Damage}% {damageType.Type} Damage Bonus";
}
public static string GetAdditionalDamagesDescription(Enchantment enchantment)
{
//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_0030: 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_006d: 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_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)
string text = "";
if (enchantment.AdditionalDamages.Count() < 1)
{
return text;
}
AdditionalDamage[] additionalDamages = enchantment.AdditionalDamages;
foreach (AdditionalDamage val in additionalDamages)
{
string arg = "Removes ";
if (val.ConversionRatio > 0f)
{
arg = "Adds +";
}
string arg2 = ((int)Math.Round(val.ConversionRatio * 100f, 0)).ToString();
text = text + $"{arg}{arg2}% of the existing weapon's {val.SourceDamageType}" + $" damage as {val.BonusDamageType} damage \n\n";
}
return text;
}
public static string GetStatModificationsDescription(Enchantment enchantment)
{
string text = "";
if (enchantment.StatModifications.Count < 1)
{
return text;
}
int num = enchantment.StatModifications.Count - 1;
StatModification statModification = enchantment.StatModifications[0];
text += GetStatModificationDescription(statModification, fullGrowthWords: true);
for (int i = 1; i < num; i++)
{
statModification = enchantment.StatModifications[i];
text = text + ", " + GetStatModificationDescription(statModification);
}
if (num > 0)
{
statModification = enchantment.StatModifications[num];
text = text + " and " + GetStatModificationDescription(statModification);
}
return text + "\n\n";
}
private static string GetStatModificationDescription(StatModification statModification, bool fullGrowthWords = false)
{
string text = "";
string text2 = Regex.Replace(((object)(Stat)(ref statModification.Name)).ToString(), "(?<!^)([A-Z])", " $1");
if (fullGrowthWords)
{
text = "Removes ";
if (statModification.Value > 0f)
{
text = "Adds +";
}
}
else if (statModification.Value > 0f)
{
text = "+";
}
string text3 = ((((object)(BonusType)(ref statModification.Type)).ToString() == "Modifier") ? "% " : (" " + ((object)(BonusType)(ref statModification.Type)).ToString() + " "));
return text + statModification.Value + text3 + text2;
}
public static string GetElementalResistancesDescription(Enchantment enchantment)
{
string text = "";
if (enchantment.ElementalResistances.Count < 1)
{
return text;
}
int num = enchantment.ElementalResistances.Count - 1;
DamageType damageType = enchantment.ElementalResistances[0];
text += GetElementalResistanceDescription(damageType, fullGrowthWords: true);
for (int i = 1; i < num; i++)
{
damageType = enchantment.ElementalResistances[i];
text = text + ", " + GetElementalResistanceDescription(damageType);
}
if (num > 0)
{
damageType = enchantment.ElementalResistances[num];
text = text + " and " + GetElementalResistanceDescription(damageType);
}
return text + "\n\n";
}
private static string GetElementalResistanceDescription(DamageType damageType, bool fullGrowthWords = false)
{
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
string arg = "";
if (fullGrowthWords)
{
arg = "Removes ";
if (damageType.Damage > 0f)
{
arg = "Adds +";
}
}
else if (damageType.Damage > 0f)
{
arg = "+";
}
return $"{arg}{damageType.Damage}% {damageType.Type} resistance";
}
public static string GetEffectsDescription(Enchantment enchantment)
{
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
string text = "";
if (enchantment.Effects.Count() < 1)
{
return text;
}
GenericHelper.SplitDerivedClasses<Effect, AddStatusEffectBuildUp>(enchantment.Effects, out var remainingArray, out var derivedArray);
text += GetAddStatusEffectBuildUpDescription(derivedArray);
GenericHelper.SplitDerivedClasses<Effect, ShootEnchantmentBlast>(remainingArray, out remainingArray, out var derivedArray2);
ShootEnchantmentBlast[] array = derivedArray2;
foreach (ShootEnchantmentBlast val in array)
{
string text2 = text;
Blast baseBlast = ((ShootBlast)val).BaseBlast;
text = text2 + $"Weapon deals an AoE {((baseBlast != null) ? ((Component)baseBlast).GetComponentInChildren<WeaponDamage>()?.OverrideDType : null)} \"Blast\" with " + $"{val.DamageMultiplier}x damage multiplier (based on Weapon's total base damage) \n\n";
}
GenericHelper.SplitDerivedClasses<Effect, AffectStatusEffectBuildUpResistance>(remainingArray, out remainingArray, out var derivedArray3);
text += GetAffectStatusEffectBuildUpResistancesDescription(derivedArray3);
GenericHelper.SplitDerivedClasses<Effect, AddStatusEffect>(remainingArray, out remainingArray, out var derivedArray4);
text += GetAddStatusEffectsDescription(derivedArray4);
Effect[] array2 = remainingArray;
foreach (Effect val2 in array2)
{
text += $"Type: {((object)val2).GetType()}";
}
return text + "\n";
}
private static string GetAddStatusEffectBuildUpDescription(AddStatusEffectBuildUp[] derivedStatusEffects)
{
string text = "";
if (derivedStatusEffects.Length < 1)
{
return text;
}
int num = derivedStatusEffects.Length - 1;
AddStatusEffectBuildUp val = derivedStatusEffects[0];
text = text + "Weapon now inflicts " + val.Status.StatusName + " " + $"({val.BuildUpValue}% buildup)";
for (int i = 1; i < num; i++)
{
val = derivedStatusEffects[i];
text = text + ", " + val.Status.StatusName + " " + $"({val.BuildUpValue}% buildup)";
}
if (num > 0)
{
val = derivedStatusEffects[num];
text = text + " and " + val.Status.StatusName + " " + $"({val.BuildUpValue}% buildup) \n\n";
}
return text;
}
private static string GetAffectStatusEffectBuildUpResistancesDescription(AffectStatusEffectBuildUpResistance[] derivedStatusResistances)
{
string text = "";
if (derivedStatusResistances.Length < 1)
{
return text;
}
int num = derivedStatusResistances.Length - 1;
AffectStatusEffectBuildUpResistance val = derivedStatusResistances[0];
text = text + "Euipment now provides " + val.StatusEffect.StatusName + " " + $"({val.RealValue}% buildup) resistance";
for (int i = 0; i < num; i++)
{
val = derivedStatusResistances[i];
text = text + ", " + val.StatusEffect.StatusName + " " + $"({val.RealValue}% buildup) resistance";
}
if (num > 0)
{
val = derivedStatusResistances[num];
text = text + " and " + val.StatusEffect.StatusName + " " + $"({val.RealValue}% buildup) resistance \n";
}
return text;
}
private static string GetAddStatusEffectsDescription(AddStatusEffect[] derivedAddStatusEffect)
{
string text = "";
if (derivedAddStatusEffect.Length < 1)
{
return text;
}
int num = derivedAddStatusEffect.Length - 1;
AddStatusEffect val = null;
string text2 = "";
for (int i = 0; i < derivedAddStatusEffect.Length; i++)
{
val = derivedAddStatusEffect[i];
text2 = ((val.ChancesToContract <= 0) ? "" : "+");
text = ((i != 0) ? ((i != num) ? (text + ", " + val.Status.StatusName + " " + $"({text2}{val.ChancesToContract})") : (text + " and " + val.Status.StatusName + " " + $"({text2}{val.ChancesToContract}) \n")) : (text + "Euipment now contracts " + val.Status.StatusName + " " + $"({text2}{val.ChancesToContract})"));
}
return text;
}
}
public class EnchantmentsHelper
{
public static string GetEnchantmentArmorIngrediantType(EnchantmentRecipe recipe)
{
//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_0018: 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)
IngredientData[] compatibleEquipments = recipe.CompatibleEquipments.CompatibleEquipments;
foreach (IngredientData val in compatibleEquipments)
{
Item specificIngredient = val.SpecificIngredient;
Armor val2 = (Armor)(object)((specificIngredient is Armor) ? specificIngredient : null);
if (val2 != null)
{
return ((object)(EquipmentSlotIDs)(ref ((Equipment)val2).EquipSlot)).ToString();
}
Item specificIngredient2 = val.SpecificIngredient;
Weapon val3 = (Weapon)(object)((specificIngredient2 is Weapon) ? specificIngredient2 : null);
if (val3 != null)
{
return ((Item)val3).TypeDisplay.ToString();
}
}
return "";
}
public static string GetEnchantmentDescription(EnchantmentRecipeItem enchantmentItem)
{
return ((Item)enchantmentItem).Name + " \n";
}
public static string GetEnchantmentsDescriptions(List<EnchantmentRecipeData> enchantmentRecipesDatas)
{
string text = "";
foreach (EnchantmentRecipeData enchantmentRecipesData in enchantmentRecipesDatas)
{
text += GetEnchantmentDescription(enchantmentRecipesData.item);
}
return text;
}
public static string GetEnchantmentsDescriptions(List<EnchantmentRecipe> enchantmentRecipes)
{
string text = "";
foreach (EnchantmentRecipe enchantmentRecipe in enchantmentRecipes)
{
Enchantment enchantmentPrefab = ResourcesPrefabManager.Instance.GetEnchantmentPrefab(enchantmentRecipe.RecipeID);
text = text + "Enchanting: " + enchantmentPrefab.Name + " \n";
}
return text;
}
public static List<EnchantmentRecipeData> GetAvailableEnchantmentRecipeDatasInInventory(Item item, CharacterInventory inventory)
{
List<EnchantmentRecipeItem> allItemsOfType = ItemHelpers.GetAllItemsOfType<EnchantmentRecipeItem>(ItemHelpers.GetUniqueItemsInInventory(inventory));
List<EnchantmentRecipeData> list = new List<EnchantmentRecipeData>();
foreach (EnchantmentRecipeItem item2 in allItemsOfType)
{
EnchantmentRecipe[] recipes = item2.Recipes;
foreach (EnchantmentRecipe val in recipes)
{
if (val.GetHasMatchingEquipment(item))
{
list.Add(new EnchantmentRecipeData(item2, val));
}
}
}
return list;
}
public static List<EnchantmentRecipeItem> GetAvailableEnchantmentRecipeItemsInInventory(Item item, CharacterInventory inventory)
{
List<EnchantmentRecipeItem> allItemsOfType = ItemHelpers.GetAllItemsOfType<EnchantmentRecipeItem>(ItemHelpers.GetUniqueItemsInInventory(inventory));
List<EnchantmentRecipeItem> list = new List<EnchantmentRecipeItem>();
foreach (EnchantmentRecipeItem item2 in allItemsOfType)
{
EnchantmentRecipe[] recipes = item2.Recipes;
for (int i = 0; i < recipes.Length; i++)
{
if (recipes[i].GetHasMatchingEquipment(item))
{
list.Add(item2);
}
}
}
return list;
}
public static List<EnchantmentRecipe> GetAvailableEnchantmentRecipies(Item item)
{
List<EnchantmentRecipe> enchantmentRecipes = RecipeManager.Instance.GetEnchantmentRecipes();
List<EnchantmentRecipe> list = new List<EnchantmentRecipe>();
foreach (EnchantmentRecipe item2 in enchantmentRecipes)
{
if (item2.GetHasMatchingEquipment(item))
{
list.Add(item2);
}
}
return list;
}
public static List<EnchantmentRecipe> GetMissingEnchantments(List<EnchantmentRecipe> availableEnchantments, List<EnchantmentRecipe> haveEnchantments)
{
List<EnchantmentRecipe> list = new List<EnchantmentRecipe>();
bool flag = false;
foreach (EnchantmentRecipe availableEnchantment in availableEnchantments)
{
foreach (EnchantmentRecipe haveEnchantment in haveEnchantments)
{
if (availableEnchantment.RecipeID == haveEnchantment.RecipeID)
{
flag = true;
}
}
if (flag)
{
flag = false;
}
else
{
list.Add(availableEnchantment);
}
}
return list;
}
}
public class GenericHelper
{
public static void SplitDerivedClasses<TBase, TDerived>(TBase[] sourceArray, out TBase[] remainingArray, out TDerived[] derivedArray)
{
List<TDerived> list = new List<TDerived>();
List<TBase> list2 = new List<TBase>();
foreach (TBase val in sourceArray)
{
if (val is TDerived)
{
object obj = val;
TDerived item = (TDerived)((obj is TDerived) ? obj : null);
list.Add(item);
}
else
{
list2.Add(val);
}
}
derivedArray = list.ToArray();
remainingArray = list2.ToArray();
}
public static int CountDerivedClassesInArray<T>(T[] array, Type TypeToCount)
{
int num = 0;
for (int i = 0; i < array.Length; i++)
{
T val = array[i];
if (val != null && TypeToCount.IsAssignableFrom(val.GetType()))
{
num++;
}
}
return num;
}
public static int CountDerivedClassesInList<T>(List<T> list, Type TypeToCount)
{
int num = 0;
foreach (T item in list)
{
if (item != null && TypeToCount.IsAssignableFrom(item.GetType()))
{
num++;
}
}
return num;
}
}
public class ItemHelpers
{
public static List<T> GetAllItemsOfType<T>(List<Item> items) where T : Item
{
List<T> list = new List<T>();
foreach (Item item in items)
{
T val = (T)(object)((item is T) ? item : null);
if (val != null)
{
list.Add(val);
}
}
return list;
}
public static List<Item> GetUniqueItemsInInventory(CharacterInventory inventory)
{
ItemContainer pouch = inventory.Pouch;
List<Item> first = ((pouch != null) ? pouch.GetContainedItems() : null);
List<Item> second = new List<Item>();
if (inventory.HasABag)
{
second = ((ItemContainer)inventory.EquippedBag.Container).GetContainedItems();
}
return first.Union(second).ToList();
}
}
}
namespace OutwardEnchantmentsViewer.Utility.Fixers
{
public class ItemDescriptionScrollFixer
{
private CharacterUI _characterUI;
private Button _btnScrollUpButton;
private Button _btnScrollDownButton;
private ScrollRect _scrollView;
private RectTransform _viewport;
public Button BtnScrollUpButton
{
get
{
return _btnScrollUpButton;
}
set
{
_btnScrollUpButton = value;
}
}
public Button BtnScrollDownButton
{
get
{
return _btnScrollDownButton;
}
set
{
_btnScrollDownButton = value;
}
}
public ScrollRect ScrollView
{
get
{
return _scrollView;
}
set
{
_scrollView = value;
}
}
public RectTransform Viewport
{
get
{
return _viewport;
}
set
{
_viewport = value;
}
}
public CharacterUI CharacterUI
{
get
{
return _characterUI;
}
set
{
_characterUI = value;
}
}
public ItemDescriptionScrollFixer(CharacterUI characterUI)
{
CharacterUI = characterUI;
CreateFixer(characterUI);
}
public void CreateFixer(CharacterUI characterUI)
{
//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
//IL_00ee: Expected O, but got Unknown
//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
//IL_00fe: Expected O, but got Unknown
//IL_0115: Unknown result type (might be due to invalid IL or missing references)
//IL_011f: Expected O, but got Unknown
//IL_0136: Unknown result type (might be due to invalid IL or missing references)
//IL_0140: Expected O, but got Unknown
Transform val = ((Component)characterUI).transform.Find("Canvas/GameplayPanels/Menus/CharacterMenus/MainPanel/Content/MiddlePanel/Inventory/DetailPanel/ItemDetailsPanel/ItemDetails/");
if (Object.op_Implicit((Object)(object)val))
{
Transform obj = val.Find("btnScrollUp");
BtnScrollUpButton = ((obj != null) ? ((Component)obj).GetComponent<Button>() : null);
Transform obj2 = val.Find("btnScrollDown");
BtnScrollDownButton = ((obj2 != null) ? ((Component)obj2).GetComponent<Button>() : null);
Transform obj3 = val.Find("Stats/Scroll View");
ScrollView = ((obj3 != null) ? ((Component)obj3).GetComponent<ScrollRect>() : null);
ScrollRect scrollView = ScrollView;
Viewport = ((scrollView != null) ? scrollView.viewport : null);
if (Object.op_Implicit((Object)(object)BtnScrollDownButton) && Object.op_Implicit((Object)(object)BtnScrollUpButton) && Object.op_Implicit((Object)(object)ScrollView) && Object.op_Implicit((Object)(object)Viewport))
{
((UnityEventBase)BtnScrollUpButton.onClick).RemoveAllListeners();
((UnityEventBase)BtnScrollDownButton.onClick).RemoveAllListeners();
BtnScrollDownButton.onClick = new ButtonClickedEvent();
BtnScrollUpButton.onClick = new ButtonClickedEvent();
((UnityEvent)((Component)BtnScrollUpButton).GetComponent<Button>().onClick).AddListener(new UnityAction(ScrollUp));
((UnityEvent)((Component)BtnScrollDownButton).GetComponent<Button>().onClick).AddListener(new UnityAction(ScrollDown));
}
}
}
private void ScrollUp()
{
//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_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)
Rect rect = Viewport.rect;
float height = ((Rect)(ref rect)).height;
rect = ScrollView.content.rect;
float num = height / ((Rect)(ref rect)).height;
ScrollView.verticalNormalizedPosition = Mathf.Clamp(ScrollView.verticalNormalizedPosition + num, 0f, 1f);
}
private void ScrollDown()
{
//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_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)
Rect rect = Viewport.rect;
float height = ((Rect)(ref rect)).height;
rect = ScrollView.content.rect;
float num = height / ((Rect)(ref rect)).height;
ScrollView.verticalNormalizedPosition = Mathf.Clamp(ScrollView.verticalNormalizedPosition - num, 0f, 1f);
}
}
}
namespace OutwardEnchantmentsViewer.Utility.Enums
{
public enum CustomEnchantmentsDescriptions
{
AngelLight = 20,
BlazeBlue = 21,
CopperFlame = 19,
SanguineFlame = 18
}
public static class CustomEnchantmentsDescriptionsExtensions
{
public static readonly Dictionary<CustomEnchantmentsDescriptions, string> CustomEnchantmentRecipesDescriptions = new Dictionary<CustomEnchantmentsDescriptions, string>
{
{
CustomEnchantmentsDescriptions.AngelLight,
"Changes the color of the lantern to white and effects of Flamethrower to Electric. \n\nLantern can no longer be refueled, however it passively gains fuel when equipped but not lit."
},
{
CustomEnchantmentsDescriptions.BlazeBlue,
"Changes the color of the lantern to blue and effects of Flamethrower to Frost. \n\nLantern can no longer be refueled, however it passively gains fuel when equipped but not lit."
},
{
CustomEnchantmentsDescriptions.CopperFlame,
"Changes the color of the lantern to green and effects of Flamethrower to Rust. \n\nLantern can no longer be refueled, however it passively gains fuel when equipped but not lit."
},
{
CustomEnchantmentsDescriptions.SanguineFlame,
"Changes the color of the lantern to Red and effects of Flamethrower to Decay Decay. \n\nLantern can no longer be refueled, however it passively gains fuel when equipped but not lit."
}
};
public static string GetDescription(this CustomEnchantmentsDescriptions enchantmentEnum)
{
return CustomEnchantmentRecipesDescriptions[enchantmentEnum];
}
public static string GetDescription(int recipeID)
{
string value = "";
if (Enum.IsDefined(typeof(CustomEnchantmentsDescriptions), recipeID))
{
CustomEnchantmentRecipesDescriptions.TryGetValue((CustomEnchantmentsDescriptions)recipeID, out value);
return value;
}
return value;
}
}
public enum StatColor
{
Default,
Disabled,
Health,
Stamina,
Mana,
Needs,
Corruption,
StatusEffect,
StatusCures,
Enchantment
}
public static class StatColorExtensions
{
public static readonly Dictionary<StatColor, Color> Colors = new Dictionary<StatColor, Color>
{
{
StatColor.Default,
new Color(0.8627f, 0.8627f, 0.8627f, 1f)
},
{
StatColor.Disabled,
new Color(0.5882f, 0.5882f, 0.5882f, 1f)
},
{
StatColor.Health,
new Color(0.765f, 0.522f, 0.525f, 1f)
},
{
StatColor.Stamina,
new Color(0.827f, 0.757f, 0.584f, 1f)
},
{
StatColor.Mana,
new Color(0.529f, 0.702f, 0.816f, 1f)
},
{
StatColor.Needs,
new Color(0.584f, 0.761f, 0.522f, 1f)
},
{
StatColor.Corruption,
new Color(0.655f, 0.647f, 0.282f, 1f)
},
{
StatColor.StatusEffect,
new Color(0.78f, 1f, 0.702f, 1f)
},
{
StatColor.StatusCures,
new Color(1f, 0.702f, 0.706f, 1f)
},
{
StatColor.Enchantment,
new Color(0.961f, 0.157f, 0.569f, 1f)
}
};
public static Color GetColor(this StatColor stat)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
return Colors[stat];
}
}
}
namespace OutwardEnchantmentsViewer.UI
{
public class AdditionalTextContainer
{
private List<Transform> _additionalTexts = new List<Transform>();
private Transform _additionalTextsContainer;
public List<Transform> AdditionalTexts
{
get
{
return _additionalTexts;
}
set
{
_additionalTexts = value;
}
}
public Transform AdditionalTextsContainer
{
get
{
return _additionalTextsContainer;
}
set
{
_additionalTextsContainer = value;
}
}
public void ShowAdditionalTextsContainer()
{
((Component)AdditionalTextsContainer).gameObject.SetActive(true);
}
public void HideAdditionalTextsContainer()
{
((Component)AdditionalTextsContainer).gameObject.SetActive(false);
}
}
public class ItemDisplaySection
{
private Transform _separator;
private Transform _description;
private Transform _disabledDescription;
private Transform _originalSeparator;
private Transform _originalDescription;
private Text _descriptionText;
private Text _disabledDescriptionText;
private Row _headerRow;
public Transform Separator
{
get
{
return _separator;
}
set
{
_separator = value;
}
}
public Transform Description
{
get
{
return _description;
}
set
{
_description = value;
}
}
public Text DescriptionText
{
get
{
return _descriptionText;
}
set
{
_descriptionText = value;
}
}
public Text DisabledDescriptionText
{
get
{
return _disabledDescriptionText;
}
set
{
_disabledDescriptionText = value;
}
}
public Row HeaderRow
{
get
{
return _headerRow;
}
set
{
_headerRow = value;
}
}
public Transform OriginalSeparator
{
get
{
return _originalSeparator;
}
set
{
_originalSeparator = value;
}
}
public Transform OriginalDescription
{
get
{
return _originalDescription;
}
set
{
_originalDescription = value;
}
}
public Transform DisabledDescription
{
get
{
return _disabledDescription;
}
set
{
_disabledDescription = value;
}
}
public ItemDisplaySection(CharacterUI characterUI)
{
CreateSection(characterUI);
HideDescription();
}
public void ShowDescription()
{
((Component)Separator).gameObject.SetActive(true);
((Component)Description).gameObject.SetActive(true);
HeaderRow.GameObject.SetActive(true);
}
public void HideDescription()
{
((Component)Separator).gameObject.SetActive(false);
((Component)Description).gameObject.SetActive(false);
HeaderRow.GameObject.SetActive(false);
}
public void ShowDisabledDescription()
{
((Component)DisabledDescription).gameObject.SetActive(true);
}
public void HideDisabledDescription()
{
((Component)DisabledDescription).gameObject.SetActive(false);
}
public void ShowOriginalDescription()
{
((Component)OriginalSeparator).gameObject.SetActive(true);
((Component)OriginalDescription).gameObject.SetActive(true);
}
public void HideOriginalDescription()
{
((Component)OriginalSeparator).gameObject.SetActive(false);
((Component)OriginalDescription).gameObject.SetActive(false);
}
public void SetHeaderText(string leftText = null, string rightText = null)
{
if (HeaderRow != null)
{
if (leftText != null)
{
HeaderRow.ChangeLeftText(leftText);
}
if (rightText != null)
{
HeaderRow.ChangeRightText(rightText);
}
}
}
public void SetDescriptiontext(string text)
{
if (Object.op_Implicit((Object)(object)DescriptionText))
{
DescriptionText.text = text;
}
}
public void SetDisabledDescriptiontext(string text)
{
if (Object.op_Implicit((Object)(object)DisabledDescriptionText))
{
DisabledDescriptionText.text = text;
}
}
private void CreateSection(CharacterUI characterUI)
{
//IL_0182: Unknown result type (might be due to invalid IL or missing references)
Transform val = ((Component)characterUI).transform.Find("Canvas/GameplayPanels/Menus/CharacterMenus/MainPanel/Content/MiddlePanel/Inventory/DetailPanel/ItemDetailsPanel/ItemDetails/Stats/Scroll View/Viewport");
if (!Object.op_Implicit((Object)(object)val))
{
return;
}
OriginalSeparator = val.Find("Content/Separator");
OriginalDescription = val.Find("Content/Description");
if (!Object.op_Implicit((Object)(object)OriginalSeparator) || !Object.op_Implicit((Object)(object)OriginalDescription))
{
return;
}
Separator = Object.Instantiate<Transform>(OriginalSeparator, OriginalSeparator.parent);
Transform obj = OriginalDescription.Find("lblDescription");
object textFont;
if (obj == null)
{
textFont = null;
}
else
{
Text component = ((Component)obj).GetComponent<Text>();
textFont = ((component != null) ? component.font : null);
}
Row.TextFont = (Font)textFont;
HeaderRow = new Row(OriginalSeparator.parent);
Description = Object.Instantiate<Transform>(OriginalDescription, OriginalDescription.parent);
DisabledDescription = Object.Instantiate<Transform>(OriginalDescription, OriginalDescription.parent);
((Object)Separator).name = "gymmed-Separator";
((Object)Description).name = "gymmed-Description";
((Object)DisabledDescription).name = "gymmed-Disabled-Description";
HeaderRow.GameObject.SetActive(false);
Transform val2 = Description.Find("lblDescription");
if (Object.op_Implicit((Object)(object)val2))
{
Transform val3 = DisabledDescription.Find("lblDescription");
if (Object.op_Implicit((Object)(object)val3))
{
DescriptionText = ((Component)val2).GetComponent<Text>();
DisabledDescriptionText = ((Component)val3).GetComponent<Text>();
((Graphic)DisabledDescriptionText).color = StatColor.Disabled.GetColor();
}
}
}
}
public class Row
{
private Text _rightText;
private Text _leftText;
private GameObject _gameObject;
public static Font TextFont;
public Text RightText
{
get
{
return _rightText;
}
set
{
_rightText = value;
}
}
public Text LeftText
{
get
{
return _leftText;
}
set
{
_leftText = value;
}
}
public GameObject GameObject
{
get
{
return _gameObject;
}
set
{
_gameObject = value;
}
}
public Row(Transform parentTransform)
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Expected O, but got Unknown
GameObject = new GameObject("gymmed-Row");
((Transform)GameObject.AddComponent<RectTransform>()).SetParent(parentTransform, false);
HorizontalLayoutGroup obj = GameObject.AddComponent<HorizontalLayoutGroup>();
((LayoutGroup)obj).childAlignment = (TextAnchor)6;
((HorizontalOrVerticalLayoutGroup)obj).childControlWidth = true;
((HorizontalOrVerticalLayoutGroup)obj).childForceExpandWidth = true;
((HorizontalOrVerticalLayoutGroup)obj).spacing = 10f;
GameObject val = CreateTextChild("LeftText", "Left Side", GameObject.transform, (TextAnchor)6);
LeftText = val.GetComponent<Text>();
GameObject val2 = CreateTextChild("RightText", "Right Side", GameObject.transform, (TextAnchor)8);
RightText = val2.GetComponent<Text>();
}
public void ChangeRightText(string text)
{
RightText.text = text;
}
public void ChangeLeftText(string text)
{
LeftText.text = text;
}
private GameObject CreateTextChild(string name, string textValue, Transform parent, TextAnchor anchor = 4, bool isFlexible = false)
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Expected O, but got Unknown
//IL_002a: 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_0044: 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_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: 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_00de: Expected O, but got Unknown
//IL_00d2: Expected O, but got Unknown
GameObject val = new GameObject("gymmed-" + name + "-container");
((Transform)val.AddComponent<RectTransform>()).SetParent(parent, false);
HorizontalLayoutGroup obj = val.AddComponent<HorizontalLayoutGroup>();
((LayoutGroup)obj).childAlignment = anchor;
((HorizontalOrVerticalLayoutGroup)obj).childControlWidth = false;
((HorizontalOrVerticalLayoutGroup)obj).childForceExpandWidth = false;
GameObject val2 = new GameObject(name);
((Transform)val2.AddComponent<RectTransform>()).SetParent(val.transform, false);
Text obj2 = val2.AddComponent<Text>();
obj2.text = textValue;
obj2.alignment = anchor;
obj2.font = (Object.op_Implicit((Object)(object)TextFont) ? TextFont : Resources.GetBuiltinResource<Font>("Ariel.tff"));
obj2.fontSize = 19;
((Graphic)obj2).color = StatColor.Enchantment.GetColor();
obj2.horizontalOverflow = (HorizontalWrapMode)1;
obj2.verticalOverflow = (VerticalWrapMode)1;
LayoutElement val3 = val2.AddComponent<LayoutElement>();
val3.minWidth = 50f;
if (!isFlexible)
{
val3.flexibleWidth = 0f;
return val2;
}
val3.flexibleWidth = 1f;
return val2;
}
}
}
namespace OutwardEnchantmentsViewer.Managers
{
public class ItemDescriptionsManager
{
private static ItemDescriptionsManager _instance;
public static ItemDescriptionsManager Instance
{
get
{
if (_instance == null)
{
_instance = new ItemDescriptionsManager();
}
return _instance;
}
}
private ItemDescriptionsManager()
{
}
public void SetEquipmentsEnchantmentsDescription(Item item, CharacterInventory inventory, CharacterUI characterUI)
{
List<EnchantmentRecipe> availableEnchantmentRecipies = EnchantmentsHelper.GetAvailableEnchantmentRecipies(item);
List<EnchantmentRecipeData> availableEnchantmentRecipeDatasInInventory = EnchantmentsHelper.GetAvailableEnchantmentRecipeDatasInInventory(item, inventory);
List<EnchantmentRecipe> list = availableEnchantmentRecipeDatasInInventory.Select((EnchantmentRecipeData data) => data.enchantmentRecipe).ToList();
string enchantmentsDescriptions = EnchantmentsHelper.GetEnchantmentsDescriptions(availableEnchantmentRecipeDatasInInventory);
string leftText = "Unlocked Enchantments";
string rightText = $"{list.Count}/{availableEnchantmentRecipies.Count}";
ItemDisplayManager.Instance.SetHeaderText(characterUI, leftText, rightText);
ItemDisplayManager.Instance.SetDescriptionText(characterUI, enchantmentsDescriptions);
ItemDisplayManager.Instance.ShowDescription(characterUI, string.IsNullOrEmpty(item.Description));
List<EnchantmentRecipe> missingEnchantments = EnchantmentsHelper.GetMissingEnchantments(availableEnchantmentRecipies, list);
string enchantmentsDescriptions2 = EnchantmentsHelper.GetEnchantmentsDescriptions(missingEnchantments);
if (missingEnchantments.Count > 0)
{
ItemDisplayManager.Instance.SetDisabledDescriptionText(characterUI, enchantmentsDescriptions2);
ItemDisplayManager.Instance.ShowDisabledDescription(characterUI);
}
else
{
ItemDisplayManager.Instance.HideDisabledDescription(characterUI);
}
}
public void SetEnchantmentsDescription(EnchantmentRecipeItem item, CharacterInventory inventory, CharacterUI characterUI)
{
try
{
string text = "";
EnchantmentRecipe[] recipes = item.Recipes;
foreach (EnchantmentRecipe val in recipes)
{
Enchantment enchantmentPrefab = ResourcesPrefabManager.Instance.GetEnchantmentPrefab(val.RecipeID);
if ((Object)(object)enchantmentPrefab == (Object)null)
{
return;
}
string enchantmentArmorIngrediantType = EnchantmentsHelper.GetEnchantmentArmorIngrediantType(val);
if (!string.IsNullOrEmpty(enchantmentArmorIngrediantType))
{
text = text + enchantmentArmorIngrediantType + "\n";
}
text += GetEnchantmentInformation(enchantmentPrefab);
text += CustomEnchantmentsDescriptionsExtensions.GetDescription(val.RecipeID);
}
ItemDisplayManager.Instance.SetHeaderText(characterUI, "Enchantment Properties", "");
ItemDisplayManager.Instance.SetDescriptionText(characterUI, text);
ItemDisplayManager.Instance.ShowDescription(characterUI);
}
catch (Exception ex)
{
SL.Log(OutwardEnchantmentsViewer.prefix + " ItemDescriptionsManager@SetEnchantmentsDescription error: " + ex.Message);
}
}
public string GetEnchantmentInformation(Enchantment enchantment)
{
try
{
string text = "";
text += EnchantmentInformationHelper.GetDamageListDescription(enchantment);
text += EnchantmentInformationHelper.GetModifiersListDescriptions(enchantment);
text += EnchantmentInformationHelper.GetAdditionalDamagesDescription(enchantment);
text += EnchantmentInformationHelper.GetEffectsDescription(enchantment);
text += EnchantmentInformationHelper.GetStatModificationsDescription(enchantment);
text += EnchantmentInformationHelper.GetElementalResistancesDescription(enchantment);
if (enchantment.GlobalStatusResistance > 0f)
{
text = text + "Global Status Resistance " + enchantment.GlobalStatusResistance + " \n\n";
}
if (enchantment.HealthAbsorbRatio > 0f)
{
text = text + "Gain +" + enchantment.HealthAbsorbRatio + "x Health Leech (damage dealth will restore " + enchantment.HealthAbsorbRatio + "x the damage as Health) \n\n";
}
if (enchantment.Indestructible)
{
text += "Provides indestructibility \n";
}
if (enchantment.ManaAbsorbRatio > 0f)
{
text = text + "Gain +" + enchantment.ManaAbsorbRatio + "x Mana Leech (damage dealth will restore " + enchantment.ManaAbsorbRatio + "x the damage as Mana) \n\n";
}
if (enchantment.StaminaAbsorbRatio > 0f)
{
text = text + "Gain +" + enchantment.StaminaAbsorbRatio + "x Stamina Leech (damage dealth will restore " + enchantment.StaminaAbsorbRatio + "x the damage as Stamina) \n\n";
}
if (enchantment.TrackDamageRatio > 0f)
{
text = text + "Track Damage Ratio " + enchantment.TrackDamageRatio + " \n\n";
}
return text;
}
catch (Exception ex)
{
SL.Log(OutwardEnchantmentsViewer.prefix + " ItemDescriptionsManager@GetEnchantmentInformation error: " + ex.Message);
return "Error";
}
}
}
public class ItemDisplayManager
{
private Dictionary<CharacterUI, ItemDisplaySection> _dictionaryDisplaySections = new Dictionary<CharacterUI, ItemDisplaySection>();
private static ItemDisplayManager _instance;
public static ItemDisplayManager Instance
{
get
{
if (_instance == null)
{
_instance = new ItemDisplayManager();
}
return _instance;
}
}
public Dictionary<CharacterUI, ItemDisplaySection> DictionaryDisplaySections
{
get
{
return _dictionaryDisplaySections;
}
set
{
_dictionaryDisplaySections = value;
}
}
private ItemDisplayManager()
{
}
public void CreateSection(CharacterUI characterUI)
{
DictionaryDisplaySections.Add(characterUI, new ItemDisplaySection(characterUI));
}
public void ShowDescription(CharacterUI characterUI, bool hideOrginalDescription = false)
{
ItemDisplaySection itemDisplaySection = GetItemDisplaySection(characterUI);
itemDisplaySection.ShowDescription();
if (hideOrginalDescription)
{
itemDisplaySection.HideOriginalDescription();
}
}
public void ShowDisabledDescription(CharacterUI characterUI)
{
GetItemDisplaySection(characterUI).ShowDisabledDescription();
}
public void HideDisabledDescription(CharacterUI characterUI)
{
GetItemDisplaySection(characterUI).HideDisabledDescription();
}
public void ShowOriginalDescription(CharacterUI characterUI)
{
GetItemDisplaySection(characterUI).ShowOriginalDescription();
}
public void HideOriginalDescription(CharacterUI characterUI)
{
GetItemDisplaySection(characterUI).HideOriginalDescription();
}
public void HideDescription(CharacterUI characterUI)
{
GetItemDisplaySection(characterUI).HideDescription();
}
public void SetDescriptionText(CharacterUI characterUI, string text)
{
GetItemDisplaySection(characterUI).SetDescriptiontext(text);
}
public void SetDisabledDescriptionText(CharacterUI characterUI, string text)
{
GetItemDisplaySection(characterUI).SetDisabledDescriptiontext(text);
}
public void SetHeaderText(CharacterUI characterUI, string leftText, string rightText)
{
GetItemDisplaySection(characterUI).SetHeaderText(leftText, rightText);
}
public ItemDisplaySection GetItemDisplaySection(CharacterUI characterUI)
{
return DictionaryDisplaySections[characterUI] ?? throw new Exception("Tried to retrieve missing characterUI from dictionary!");
}
}
}
namespace OutwardEnchantmentsViewer.Enchantments
{
public class EnchantmentRecipeData
{
public EnchantmentRecipeItem item;
public EnchantmentRecipe enchantmentRecipe;
public EnchantmentRecipeData(EnchantmentRecipeItem item, EnchantmentRecipe enchantmentRecipe)
{
this.item = item;
this.enchantmentRecipe = enchantmentRecipe;
}
}
}