using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
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;
using System.Text.RegularExpressions;
using System.Xml.Serialization;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using OutwardEnchantmentsViewer.Enchantments;
using OutwardEnchantmentsViewer.Events;
using OutwardEnchantmentsViewer.Managers;
using OutwardEnchantmentsViewer.UI;
using OutwardEnchantmentsViewer.Utility.Enums;
using OutwardEnchantmentsViewer.Utility.Fixers;
using OutwardEnchantmentsViewer.Utility.Helpers;
using OutwardModsCommunicator.EventBus;
using OutwardModsCommunicator.Managers;
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("OutwardEnchanmentsViewer")]
[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.outward_enchantments_viewer", "Outward Enchantments Viewer", "1.0.2")]
public class OutwardEnchantmentsViewer : BaseUnityPlugin
{
[HarmonyPatch(typeof(ItemDetailsDisplay), "OnScrollDownPressed")]
public class Patch_OnScrollDownPressed
{
private static bool Prefix(ItemDetailsDisplay __instance)
{
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
if (__instance.m_movingScrollview)
{
return false;
}
Rect rect;
if (__instance.m_viewPortSize == 0f)
{
RectTransform component = ((Component)((Component)__instance).transform.Find("ItemDetails/Stats/Scroll View/Viewport")).GetComponent<RectTransform>();
if ((Object)(object)component == (Object)null)
{
SL.Log(prefix + " ItemDetailsDisplay@OnScrollDownPressed missing ViewPort for ItemDetailsDisplay");
return true;
}
rect = component.rect;
__instance.m_viewPortSize = ((Rect)(ref rect)).height;
}
float viewPortSize = __instance.m_viewPortSize;
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_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
if (__instance.m_movingScrollview)
{
return false;
}
Rect rect;
if (__instance.m_viewPortSize == 0f)
{
RectTransform component = ((Component)((Component)__instance).transform.Find("ItemDetails/Stats/Scroll View/Viewport")).GetComponent<RectTransform>();
if ((Object)(object)component == (Object)null)
{
SL.Log(prefix + " ItemDetailsDisplay@OnScrollUpPressed missing ViewPort for ItemDetailsDisplay");
return true;
}
rect = component.rect;
__instance.m_viewPortSize = ((Rect)(ref rect)).height;
}
float viewPortSize = __instance.m_viewPortSize;
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(ResourcesPrefabManager), "Load")]
public class ResourcesPrefabManager_Load
{
private static void Postfix(ResourcesPrefabManager __instance)
{
CustomEnchantmentsManager.Instance.LoadPlayerCustomEnchantmentsDescriptions();
EnchantmentsHelper.FixFilterRecipe();
}
}
[HarmonyPatch(typeof(ItemDetailsDisplay))]
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
public class ItemDetailsDisplay_AwakeInit
{
[HarmonyPostfix]
private static void Postfix(ItemDetailsDisplay __instance)
{
try
{
new ItemDescriptionScrollFixer(__instance);
ItemDisplayManager.Instance.TryCreateSection(__instance);
}
catch (Exception ex)
{
SL.Log(prefix + " ItemDetailsDisplay@StartInit error: " + ex.Message);
}
}
}
[HarmonyPatch(typeof(ItemDetailsDisplay))]
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
public class ItemDetailsDisplay_RefreshDetailsPatch
{
[HarmonyPostfix]
private static void Postfix(ItemDetailsDisplay __instance)
{
try
{
string activeSceneName = SceneManagerHelper.ActiveSceneName;
if (activeSceneName == "LowMemory_TransitionScene" || activeSceneName == "MainMenu_Empty")
{
return;
}
ItemDisplay itemDisplay = __instance.itemDisplay;
Item val = ((itemDisplay != null) ? itemDisplay.RefItem : null);
ItemDisplayManager.Instance.ShowOriginalDescription(__instance);
Character localCharacter = ((UIElement)__instance).LocalCharacter;
CharacterInventory val2 = ((localCharacter != null) ? localCharacter.Inventory : null);
if (!Object.op_Implicit((Object)(object)val2))
{
return;
}
if (ShowDescriptionsOnlyForInventory.Value && (Object)(object)val.m_lastParentItemContainer != (Object)null && val.m_lastParentItemContainer is MerchantPouch)
{
ItemDisplayManager.Instance.HideDescription(__instance);
ItemDisplayManager.Instance.HideDisabledDescription(__instance);
}
else if (!(val is Equipment))
{
EnchantmentRecipeItem val3 = (EnchantmentRecipeItem)(object)((val is EnchantmentRecipeItem) ? val : null);
if (val3 != null)
{
if (!ShowEnchantmentDescriptions.Value)
{
ItemDisplayManager.Instance.HideDescription(__instance);
ItemDisplayManager.Instance.HideDisabledDescription(__instance);
}
else
{
ItemDescriptionsManager.Instance.SetEnchantmentsDescription(val3, val2, __instance);
ItemDisplayManager.Instance.HideDisabledDescription(__instance);
}
}
else
{
ItemDisplayManager.Instance.HideDescription(__instance);
ItemDisplayManager.Instance.HideDisabledDescription(__instance);
}
}
else if (!ShowEquipmentDescriptions.Value || val.IsNonEnchantable)
{
ItemDisplayManager.Instance.HideDescription(__instance);
ItemDisplayManager.Instance.HideDisabledDescription(__instance);
}
else
{
ItemDescriptionsManager.Instance.SetEquipmentsEnchantmentsDescription(val, val2, __instance);
}
}
catch (Exception ex)
{
SL.Log(prefix + " ItemDetailsDisplay@RefreshDetails error: " + ex.Message);
}
}
}
public const string GUID = "gymmed.outward_enchantments_viewer";
public const string NAME = "Outward Enchantments Viewer";
public const string VERSION = "1.0.2";
public const string EVENT_BUS_ALL_GUID = "gymmed.outward_enchantments_viewer_*";
public static string prefix = "[GymMed-Enchantments-Viewer]";
public static ConfigEntry<bool> ShowEnchantmentDescriptions;
public static ConfigEntry<bool> ShowEquipmentDescriptions;
public static ConfigEntry<bool> ShowAllAvailableEnchantmentsCountForEquipment;
public static ConfigEntry<bool> ShowMissingEnchantmentsForEquipment;
public static ConfigEntry<bool> ShowDescriptionsOnlyForInventory;
public static ConfigEntry<bool> ShowEquipmentOwnedEnchantmentsDetailed;
public static ConfigEntry<bool> ShowEquipmentUnownedEnchantmentsDetailed;
public static ConfigEntry<bool> ShowInShopEnchantmentWithEquipmentType;
public static ManualLogSource Log { get; private set; }
public static OutwardEnchantmentsViewer Instance { get; private set; }
internal void Awake()
{
//IL_013f: 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 1.0.2!");
ShowEnchantmentDescriptions = ((BaseUnityPlugin)this).Config.Bind<bool>("Enchantments Descriptions", "ShowEnchantmentDescriptions", true, "Show detailed descriptions for enchantments?");
ShowEquipmentDescriptions = ((BaseUnityPlugin)this).Config.Bind<bool>("Equipment Descriptions", "ShowEquipmentEnchantmentsDescriptions", true, "Show enchantments for equipment?");
ShowAllAvailableEnchantmentsCountForEquipment = ((BaseUnityPlugin)this).Config.Bind<bool>("Equipment Descriptions Header", "ShowAllAvailableEnchantmentsCountForEquipment", true, "Show all available enchantments count for equipment?");
ShowMissingEnchantmentsForEquipment = ((BaseUnityPlugin)this).Config.Bind<bool>("Equipment Descriptions Body", "ShowMissingEnchantmentsForEquipment", true, "Show missing enchantments for equipment?");
ShowDescriptionsOnlyForInventory = ((BaseUnityPlugin)this).Config.Bind<bool>("Show Descriptions in Panels", "ShowDescriptionsOnlyForInventory", false, "Show descriptions only for items in inventory?");
ShowEquipmentDescriptions = ((BaseUnityPlugin)this).Config.Bind<bool>("Equipment Descriptions", "ShowEquipmentEnchantmentsDescriptions", true, "Show enchantments for equipment?");
ShowEquipmentOwnedEnchantmentsDetailed = ((BaseUnityPlugin)this).Config.Bind<bool>("Equipment Descriptions", "ShowEquipmentOwnedEnchantmentsDetailed", true, "Show owned equipment enchantments in greater detail?");
ShowEquipmentUnownedEnchantmentsDetailed = ((BaseUnityPlugin)this).Config.Bind<bool>("Equipment Descriptions", "ShowEquipmentUnownedEnchantmentsDetailed", true, "Show unowned equipment enchantments in greater detail?");
ShowInShopEnchantmentWithEquipmentType = ((BaseUnityPlugin)this).Config.Bind<bool>("Enchantments Descriptions", "ShowEnchantmentEquipmentTypeInShop", true, "Show in shop enchantment with equipment type?");
new Harmony("gymmed.outward_enchantments_viewer").PatchAll();
EventBusRegister.RegisterEvents();
EventBusSubscriber.AddSubscribers();
}
internal void Update()
{
}
}
}
namespace OutwardEnchantmentsViewer.Utility.Helpers
{
public class EnchantmentInformationHelper
{
public static string GetDamageListDescription(Enchantment enchantment)
{
string text = "";
if (enchantment.DamageBonus == null || 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";
}
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 == null || 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";
}
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_002b: 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_0038: 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_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_008b: Unknown result type (might be due to invalid IL or missing references)
string text = "";
if (enchantment.AdditionalDamages == null || 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";
}
return text;
}
public static string GetStatModificationsDescription(Enchantment enchantment)
{
string text = "";
if (enchantment.StatModifications == null || 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";
}
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 == null || 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";
}
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";
}
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()}";
}
if (!text.EndsWith("\n"))
{
text += "\n";
}
return text;
}
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";
}
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.Value}% buildup) resistance";
for (int i = 0; i < num; i++)
{
val = derivedStatusResistances[i];
text = text + ", " + val.StatusEffect.StatusName + " " + $"({val.Value}% buildup) resistance";
}
if (num > 0)
{
val = derivedStatusResistances[num];
text = text + " and " + val.StatusEffect.StatusName + " " + $"({val.Value}% 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_0033: 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_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
IngredientData[] compatibleEquipments = recipe.CompatibleEquipments.CompatibleEquipments;
int num = 0;
if (num < compatibleEquipments.Length)
{
IngredientData val = compatibleEquipments[num];
Item specificIngredient = val.SpecificIngredient;
Armor val2 = (Armor)(object)((specificIngredient is Armor) ? specificIngredient : null);
if (val2 != null)
{
return ((Equipment)val2).EquipSlot.GetArmorTypeName();
}
Item specificIngredient2 = val.SpecificIngredient;
Weapon val3 = (Weapon)(object)((specificIngredient2 is Weapon) ? specificIngredient2 : null);
if (val3 != null)
{
return val3.Type.GetWeaponTypeName();
}
if ((Object)(object)val.SpecificIngredient == (Object)null)
{
return "";
}
return val.SpecificIngredient.Name;
}
return "";
}
public static string GetDetailedEnchantmentDescription(EnchantmentRecipeItem enchantmentItem, Equipment equipment, int count = 1)
{
string text = ((Item)enchantmentItem).Name ?? "";
if (count > 1)
{
text += $" ({count})";
}
text += "\n";
Enchantment val = null;
EnchantmentRecipe[] recipes = enchantmentItem.Recipes;
foreach (EnchantmentRecipe val2 in recipes)
{
if (val2.GetHasMatchingEquipment((Item)(object)equipment))
{
val = ResourcesPrefabManager.Instance.GetEnchantmentPrefab(val2.RecipeID);
break;
}
}
if ((Object)(object)val == (Object)null)
{
return text;
}
return text + ItemEnchantmentInformationHelper.BuildDescriptions(val, equipment);
}
public static string GetDetailedEnchantmentsDescriptions(List<EnchantmentRecipeDetailedData> enchantmentRecipesDatas, Equipment equipment)
{
string text = "";
int num = enchantmentRecipesDatas.Count - 1;
for (int i = 0; i < num; i++)
{
text += GetDetailedEnchantmentDescription(enchantmentRecipesDatas[i].Data.item, equipment, enchantmentRecipesDatas[i].Count);
text += "\n";
}
if (enchantmentRecipesDatas.Count > 0)
{
text += GetDetailedEnchantmentDescription(enchantmentRecipesDatas[num].Data.item, equipment, enchantmentRecipesDatas[num].Count);
}
return text;
}
public static string GetEnchantmentDescription(EnchantmentRecipeItem enchantmentItem, int count)
{
string text = ((Item)enchantmentItem).Name ?? "";
if (count > 1)
{
text += $" ({count})";
}
return text + "\n";
}
public static string GetEnchantmentsDescriptions(List<EnchantmentRecipeDetailedData> enchantmentRecipesDatas)
{
string text = "";
foreach (EnchantmentRecipeDetailedData enchantmentRecipesData in enchantmentRecipesDatas)
{
text += GetEnchantmentDescription(enchantmentRecipesData.Data.item, enchantmentRecipesData.Count);
}
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 string GetDetailedEnchantmentsDescriptions(List<EnchantmentRecipe> enchantmentRecipes, Equipment equipment)
{
string text = "";
int num = enchantmentRecipes.Count - 1;
for (int i = 0; i < num; i++)
{
text += GetDetailedEnchantmentDescription(enchantmentRecipes[i], equipment);
text += "\n";
}
if (enchantmentRecipes.Count > 0)
{
text += GetDetailedEnchantmentDescription(enchantmentRecipes[num], equipment);
}
return text;
}
public static string GetDetailedEnchantmentDescription(EnchantmentRecipe enchantmentRecipe, Equipment equipment)
{
string text = "";
if (enchantmentRecipe.GetHasMatchingEquipment((Item)(object)equipment))
{
Enchantment enchantmentPrefab = ResourcesPrefabManager.Instance.GetEnchantmentPrefab(enchantmentRecipe.RecipeID);
if ((Object)(object)enchantmentPrefab == (Object)null)
{
return text;
}
text = text + "Enchanting: " + enchantmentPrefab.Name + " \n";
text += ItemEnchantmentInformationHelper.BuildDescriptions(enchantmentPrefab, equipment);
}
return text;
}
public static List<EnchantmentRecipeDetailedData> GetUniqueAvailableEnchantmentRecipeDatasInInventory(Item item, CharacterInventory inventory)
{
List<EnchantmentRecipeItem> allItemsOfType = ItemHelpers.GetAllItemsOfType<EnchantmentRecipeItem>(ItemHelpers.GetUniqueItemsInInventory(inventory));
Dictionary<int, EnchantmentRecipeDetailedData> dictionary = new Dictionary<int, EnchantmentRecipeDetailedData>();
foreach (EnchantmentRecipeItem item2 in allItemsOfType)
{
EnchantmentRecipe[] recipes = item2.Recipes;
foreach (EnchantmentRecipe val in recipes)
{
if (val.GetHasMatchingEquipment(item))
{
if (dictionary.TryGetValue(val.RecipeID, out var value))
{
value.Count++;
}
else
{
dictionary[val.RecipeID] = new EnchantmentRecipeDetailedData(new EnchantmentRecipeData(item2, val));
}
}
}
}
return dictionary.Values.ToList();
}
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 static bool IsEnchantmentInList(int enchantmentId, List<EnchantmentRecipeItem> enchantmentItems)
{
foreach (EnchantmentRecipeItem enchantmentItem in enchantmentItems)
{
EnchantmentRecipe[] recipes = enchantmentItem.Recipes;
for (int i = 0; i < recipes.Length; i++)
{
if (recipes[i].RecipeID == enchantmentId)
{
return true;
}
}
}
return false;
}
public static List<EnchantmentRecipe> GetEnchantmentRecipesForEnchantment(Enchantment enchantment)
{
List<EnchantmentRecipe> list = new List<EnchantmentRecipe>();
foreach (EnchantmentRecipe enchantmentRecipe in RecipeManager.Instance.GetEnchantmentRecipes())
{
if (enchantmentRecipe.ResultID == ((EffectPreset)enchantment).PresetID)
{
list.Add(enchantmentRecipe);
}
}
return list;
}
public static string GetModifiedEnchantmentDescription(Enchantment enchantment)
{
string text = "";
EnchantmentDescription enchantmentDescription = CustomEnchantmentsManager.Instance.TryGetDescription(((EffectPreset)enchantment).PresetID);
if (enchantmentDescription == null)
{
if (!string.IsNullOrWhiteSpace(enchantment.Description))
{
text = text + enchantment.Description + " \n";
}
if (!string.IsNullOrEmpty(text) && !text.EndsWith("\n"))
{
text += "\n";
}
return text;
}
if (enchantmentDescription.overwrite)
{
return text + enchantmentDescription.description + " \n";
}
text += enchantment.Description;
GenericHelper.AppendMessageWithSpace(ref text, enchantmentDescription.description);
if (!string.IsNullOrEmpty(text) && !text.EndsWith("\n"))
{
text += "\n";
}
return text;
}
public static void FixFilterRecipe()
{
Item itemPrefab = ResourcesPrefabManager.Instance.GetItemPrefab("5800047");
if ((Object)(object)itemPrefab == (Object)null)
{
return;
}
EnchantmentRecipeItem val = (EnchantmentRecipeItem)(object)((itemPrefab is EnchantmentRecipeItem) ? itemPrefab : null);
if (Object.op_Implicit((Object)(object)val))
{
_ = val.Recipes;
EnchantmentRecipe enchantmentRecipeForID = RecipeManager.Instance.GetEnchantmentRecipeForID(52);
EnchantmentRecipe enchantmentRecipeForID2 = RecipeManager.Instance.GetEnchantmentRecipeForID(53);
EnchantmentRecipe enchantmentRecipeForID3 = RecipeManager.Instance.GetEnchantmentRecipeForID(54);
if (!((Object)(object)enchantmentRecipeForID == (Object)null) && !((Object)(object)enchantmentRecipeForID2 == (Object)null) && !((Object)(object)enchantmentRecipeForID3 == (Object)null))
{
EnchantmentRecipe[] recipes = (EnchantmentRecipe[])(object)new EnchantmentRecipe[3] { enchantmentRecipeForID, enchantmentRecipeForID2, enchantmentRecipeForID3 };
val.Recipes = recipes;
}
}
}
}
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 static void TryCleaningGameObjectWithNames(Transform parent, string[] elementNames)
{
foreach (string elementName in elementNames)
{
TryCleaningGameObjectWithName(parent, elementName);
}
}
public static void TryCleaningGameObjectWithName(Transform parent, string elementName)
{
Transform val = parent.Find(elementName);
if (Object.op_Implicit((Object)(object)val))
{
Object.DestroyImmediate((Object)(object)((Component)val).gameObject);
}
}
public bool HasParentWithHiddenItemDetails(Transform targetTransform, string[] names)
{
while ((Object)(object)targetTransform != (Object)null)
{
if (Array.Exists(names, (string name) => ((Object)targetTransform).name == name))
{
return true;
}
targetTransform = targetTransform.parent;
}
return false;
}
public static void AppendMessageWithSpace(ref string message, string appendingText)
{
if (!message.EndsWith(" ") && !message.EndsWith("\n") && !appendingText.EndsWith(" ") && !appendingText.EndsWith("\n"))
{
message += " ";
}
message += appendingText;
}
}
public class ItemEnchantmentInformationHelper
{
public static DamageList CalculateChangesInItemDamageList(DamageList itemDamageList, DamageList changesDamageList)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Expected O, but got Unknown
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: 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_0068: Expected O, but got Unknown
//IL_008e: 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_00a3: Expected O, but got Unknown
DamageList val = new DamageList();
bool flag = false;
foreach (DamageType item in changesDamageList.m_list)
{
foreach (DamageType item2 in itemDamageList.m_list)
{
if (item.Type == item2.Type)
{
val.Add(new DamageType(item2.Type, item2.Damage + item.Damage));
flag = true;
break;
}
}
if (flag)
{
flag = false;
}
else
{
val.Add(new DamageType(item.Type, item.Damage));
}
}
return val;
}
public static string GetStatsModifcationDescriptions(Equipment equipment, StatModificationList stats)
{
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: Unknown result type (might be due to invalid IL or missing references)
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
//IL_00a6: 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_00d7: Expected I4, but got Unknown
string text = "";
if (stats == null || ((IEnumerable<StatModification>)stats).Count() < 1)
{
return text;
}
string text2 = "";
string text3 = "";
string text4 = "";
float num = 0f;
int num2 = 0;
foreach (StatModification statModification in stats.statModifications)
{
text2 = (((int)statModification.Type == 0) ? "%" : "");
text3 = Regex.Replace(((object)(Stat)(ref statModification.Name)).ToString(), "(?<!^)([A-Z])", " $1");
num = GetStatValueFromEquipment(equipment, statModification);
num2 = (int)Math.Round(num, MidpointRounding.AwayFromZero);
Stat name = statModification.Name;
if ((int)name != 0)
{
switch (name - 6)
{
case 7:
case 8:
case 9:
text += $"{statModification.Value * -1f}% {text3}\n";
break;
case 3:
case 4:
text4 = GetFinalCalcualtedStatValue(equipment, statModification);
text += $"{num}{text2} => {text4} passive {text3} per second\n";
break;
case 0:
text4 = GetFinalCalcualtedStatValue(equipment, statModification);
text += $"{num}{text2} => {text4} {text3}\n";
break;
default:
text4 = GetFinalCalcualtedStatValue(equipment, statModification);
text += $"{num2}{text2} => {text4} {text3}\n";
break;
}
}
else
{
text4 = GetFinalCalcualtedStatValue(equipment, statModification);
text = (((int)statModification.Type != 0) ? (text + $"{num2} => {text4} {text3}\n") : (text + $"{num2} => {text4} {text3} ({statModification.Value}%)\n"));
}
}
return text;
}
public static string GetFinalCalcualtedStatValue(Equipment equipment, StatModification stat)
{
return GetCalculatedStatModificationValue(stat, GetStatValueFromEquipment(equipment, stat));
}
public static string GetCalculatedStatModificationValue(StatModification stat, float totalValue)
{
//IL_0007: 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_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Expected I4, but got Unknown
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_00ea: 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)
float num = 0f;
Stat name = stat.Name;
switch ((int)name)
{
case 0:
if ((int)stat.Type == 0)
{
return ((double)totalValue + (double)totalValue * ((double)stat.Value / 100.0)).ToString();
}
return (totalValue + stat.Value).ToString();
case 7:
case 8:
case 13:
case 14:
case 15:
if ((int)stat.Type == 0)
{
return totalValue + stat.Value + "%";
}
return (totalValue + stat.Value).ToString();
case 2:
case 3:
case 4:
case 5:
return (int)Math.Round(totalValue + stat.Value, MidpointRounding.AwayFromZero) + "%";
default:
num = (((int)stat.Type != 0) ? (totalValue + stat.Value) : (totalValue * (stat.Value / 100f)));
if (num <= 0f)
{
return stat.Value + "%";
}
return num.ToString();
}
}
public static string GetAdditionalDescriptions(Equipment equipment, Enchantment enchantment, string previousInput = "")
{
string text = "";
if (enchantment.GlobalStatusResistance > 0f)
{
text = text + "Global Status Resistance " + enchantment.GlobalStatusResistance + " \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";
}
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";
}
if (enchantment.StaminaAbsorbRatio > 0f)
{
text = text + "Gain +" + enchantment.StaminaAbsorbRatio + "x Stamina Leech (damage dealth will restore " + enchantment.StaminaAbsorbRatio + "x the damage as Stamina) \n";
}
if (enchantment.TrackDamageRatio > 0f)
{
text = text + "Tracking Damage Ratio " + enchantment.TrackDamageRatio + " \n";
}
text += EnchantmentsHelper.GetModifiedEnchantmentDescription(enchantment);
if (text == "" && previousInput == "")
{
List<EnchantmentRecipe> enchantmentRecipesForEnchantment = EnchantmentsHelper.GetEnchantmentRecipesForEnchantment(enchantment);
if (enchantmentRecipesForEnchantment.Count > 0 && enchantmentRecipesForEnchantment[0].RecipeID < 118)
{
return "Provides neither bonuses nor penalties \n";
}
return "Doesn't give stats in traditional way and uses unknown properties \n";
}
return text;
}
public static string GetDamageListDescription(Enchantment enchantment, Weapon weapon)
{
//IL_0052: 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)
string text = "";
if (enchantment.DamageBonus == null || enchantment.DamageBonus.Count < 1)
{
return text;
}
((EquipmentStats)weapon.Stats).GetDamageAttack((Types)0, false);
float num = 0f;
int num2 = 0;
foreach (DamageType item in enchantment.DamageBonus.List)
{
num = GetDamageOfType(item.Type, weapon);
num2 = (int)Math.Round(num + item.Damage, MidpointRounding.AwayFromZero);
text += $"{(int)Math.Round(num, MidpointRounding.AwayFromZero)} => {num2} {item.Type} Damage Bonus\n";
}
return text;
}
public static float GetDamageOfType(Types _type, Weapon weapon)
{
//IL_0020: 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)
DamageType val = null;
return ((weapon.m_weaponStats == null && !((Object)(object)((EffectSynchronizer)weapon).OwnerCharacter != (Object)null)) ? GetDamageFromWeapon(weapon)[_type] : weapon.GetDamage(0, false)[_type])?.Damage ?? 0f;
}
public static DamageList GetDamageFromWeapon(Weapon weapon)
{
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Expected I4, but got Unknown
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
DamageList.EmptyCopy(weapon.Damage, ref weapon.baseDamage);
WeaponBaseData val = null;
if (weapon.m_weaponStats == null)
{
val = Global.Instance.WeaponBaseStats.WeaponStatsDict[(int)weapon.Type];
}
int num = default(int);
for (int i = 0; i < weapon.baseDamage.Count; i++)
{
if (Object.op_Implicit((Object)(object)weapon.Stats))
{
IList<float> attackDamage = weapon.Stats.GetAttackDamage(0);
if (i < attackDamage.Count)
{
weapon.baseDamage[i].Damage = attackDamage[i];
if (weapon.IsDamageAddedByEnchantment(weapon.baseDamage[i].Type, ref num))
{
DamageType obj = weapon.baseDamage[i];
obj.Damage += weapon.m_enchantmentDamageBonus[num].Damage;
}
}
else
{
weapon.baseDamage[i].Damage = weapon.Damage[i].Damage;
}
}
else if (weapon.m_weaponStats != null)
{
weapon.baseDamage[i].Damage = weapon.m_weaponStats.GetDamage(0);
}
else
{
weapon.baseDamage[i].Damage = val.GetDamage(0);
}
if (weapon.baseDamage[i].Damage == -1f)
{
if (weapon.m_weaponStats == null)
{
fixWeaponBaseDamages(weapon, val, i);
}
else
{
fixWeaponBaseDamages(weapon, weapon.m_weaponStats, i);
}
}
}
if (Object.op_Implicit((Object)(object)weapon.Stats))
{
weapon.baseDamage *= ((ItemStats)weapon.Stats).Effectiveness;
}
return weapon.baseDamage;
}
public static void fixWeaponBaseDamages(Weapon weapon, WeaponBaseData weaponStats, int type)
{
float damage = weapon.m_baseDamage[type].Damage;
if (weaponStats.Damage > 0f)
{
float damage2 = weaponStats.GetDamage(0);
if (damage2 != -1f)
{
weapon.baseDamage[type].Damage = damage * (damage2 / weaponStats.Damage);
}
else if (weapon.Damage[type].Damage != -1f)
{
weapon.baseDamage[type].Damage = damage;
}
else
{
weapon.baseDamage[type].Damage = weaponStats.Damage;
}
}
else
{
weapon.baseDamage[type].Damage = damage;
}
}
public static float GetWeaponEnchantmentDamageBonus(Weapon weapon, DamageType damageType)
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
foreach (DamageType item in weapon.GetEnchantmentDamageBonuses().List)
{
if (damageType.Type == item.Type)
{
return item.Damage;
}
}
return 0f;
}
public static string GetDamageListDescription(Enchantment enchantment, Equipment equipment)
{
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
string text = "";
if (enchantment.DamageBonus == null || enchantment.DamageBonus.Count < 1)
{
return text;
}
float damageAttack = equipment.Stats.GetDamageAttack((Types)0, false);
float num = 0f;
int num2 = 0;
foreach (DamageType item in enchantment.DamageBonus.List)
{
num = equipment.GetDamageAttack(item.Type, false);
num2 = (int)Math.Round(num + item.Damage, MidpointRounding.AwayFromZero);
text += $"{(int)Math.Round(num, MidpointRounding.AwayFromZero)}% => {num2}% from {damageAttack} {item.Type}\n";
}
return text;
}
public static string GetDamageListDescription(Enchantment enchantment, Armor armor)
{
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
string text = "";
if (enchantment.DamageBonus == null || enchantment.DamageBonus.Count < 1)
{
return text;
}
float damageAttack = ((Equipment)armor).Stats.GetDamageAttack((Types)0, false);
float num = 0f;
int num2 = 0;
foreach (DamageType item in enchantment.DamageBonus.List)
{
num = ((Equipment)armor).Stats.GetDamageAttack(item.Type, false);
num2 = (int)Math.Round(num + item.Damage, MidpointRounding.AwayFromZero);
text += $"{(int)Math.Round(num, MidpointRounding.AwayFromZero)}% => {num2}% from {damageAttack} {item.Type}\n";
}
return text;
}
public static string GetDamageListDescription(Enchantment enchantment, DamageList equipmentDamageList)
{
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
string text = "";
if (enchantment.DamageBonus == null || enchantment.DamageBonus.Count < 1)
{
return text;
}
DamageList obj = CalculateChangesInItemDamageList(equipmentDamageList, enchantment.DamageBonus);
List<DamageType> list = equipmentDamageList.List;
bool flag = false;
foreach (DamageType item in obj.List)
{
foreach (DamageType item2 in list)
{
if (item2.Type == item.Type)
{
flag = true;
text += $"{item2.Damage} => {item.Damage} {item.Type}\n";
break;
}
}
if (flag)
{
flag = false;
}
else
{
text += $"0 => {item.Damage} {item.Type}\n";
}
}
return text;
}
public static string BuildDescriptions(Enchantment enchantment, Equipment equipment)
{
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
//IL_00ea: Expected O, but got Unknown
try
{
string text = "";
Weapon val = (Weapon)(object)((equipment is Weapon) ? equipment : null);
if (val != null)
{
DamageList baseDamage = val.Stats.BaseDamage;
text += GetDamageListDescription(enchantment, val);
text += GetDamageModifiersDescription(enchantment, (Equipment)(object)val);
text += GetAdditionalDamagesDescription(enchantment, baseDamage);
text += GetEffectsDescription(enchantment, baseDamage);
text += GetStatsModifcationDescriptions(equipment, enchantment.StatModifications);
text += GetElementalResistancesDescription(enchantment, (Equipment)(object)val);
text += GetAdditionalDescriptions(equipment, enchantment, text);
}
else
{
Armor val2 = (Armor)(object)((equipment is Armor) ? equipment : null);
if (val2 != null)
{
ArmorBaseData val3 = val2.m_baseData;
if (val2.m_baseData == null)
{
val3 = Global.Instance.WeaponBaseStats.GetArmorData(((Equipment)val2).EquipSlot, val2.Class);
}
if (val3.DamageReduction == null)
{
return BuildDefaultDescriptions(enchantment, equipment);
}
DamageList damageReductions = new DamageList(val3.DamageReduction.ToArray());
text += BuildArmorDescriptions(enchantment, val2, damageReductions);
}
else
{
Bag val4 = (Bag)(object)((equipment is Bag) ? equipment : null);
if (val4 != null)
{
text += GetDamageListDescription(enchantment, (Equipment)(object)val4);
text += GetDamageModifiersDescription(enchantment, (Equipment)(object)val4);
text += GetEffectsDescription(enchantment);
text += GetStatsModifcationDescriptions(equipment, enchantment.StatModifications);
text += GetElementalResistancesDescription(enchantment, (Equipment)(object)val4);
text += GetAdditionalDescriptions(equipment, enchantment, text);
}
else
{
text += GetDamageListDescription(enchantment, equipment);
text += GetDamageModifiersDescription(enchantment, equipment);
text += GetEffectsDescription(enchantment);
text += GetStatsModifcationDescriptions(equipment, enchantment.StatModifications);
text += GetElementalResistancesDescription(enchantment, equipment);
text += GetAdditionalDescriptions(equipment, enchantment, text);
}
}
}
return text;
}
catch (Exception ex)
{
SL.Log(OutwardEnchantmentsViewer.prefix + " ItemDescriptionsManager@BuildDescriptions error: " + ex.Message);
return "Error";
}
}
public static string BuildArmorDescriptions(Enchantment enchantment, Armor armor, DamageList damageReductions)
{
string text = "";
text += GetDamageListDescription(enchantment, armor);
text += GetDamageModifiersDescription(enchantment, (Equipment)(object)armor);
text += GetAdditionalDamagesDescription(enchantment, damageReductions);
text += GetEffectsDescription(enchantment, damageReductions);
text += GetStatsModifcationDescriptions((Equipment)(object)armor, enchantment.StatModifications);
text += GetElementalResistancesDescription(enchantment, (Equipment)(object)armor);
return text + GetAdditionalDescriptions((Equipment)(object)armor, enchantment, text);
}
public static string BuildDefaultDescriptions(Enchantment enchantment, Equipment equipment)
{
try
{
string text = "";
text += GetDamageListDescription(enchantment, equipment);
text += GetDamageModifiersDescription(enchantment, equipment);
text += GetEffectsDescription(enchantment);
text += GetStatsModifcationDescriptions(equipment, enchantment.StatModifications);
text += GetElementalResistancesDescription(enchantment, equipment);
return text + GetAdditionalDescriptions(equipment, enchantment, text);
}
catch (Exception ex)
{
SL.Log(OutwardEnchantmentsViewer.prefix + " ItemDescriptionsManager@BuildDefaultDescriptions error: " + ex.Message);
return "Error";
}
}
public static string GetDamageModifiersDescription(Enchantment enchantment, Equipment equipment)
{
//IL_001e: 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_0082: Unknown result type (might be due to invalid IL or missing references)
string text = "";
if (enchantment.DamageModifier == null || enchantment.DamageModifier.Count < 1)
{
return text;
}
new DamageList();
float num = 0f;
int num2 = 0;
foreach (DamageType item in enchantment.DamageModifier.List)
{
num = equipment.Stats.GetDamageAttack(item.Type, false);
num2 = (int)Math.Round(num + item.Damage, MidpointRounding.AwayFromZero);
text += $"{num}% => {num2}% {item.Type} Damage Bonus\n";
}
return text;
}
public static string TryGetFromDamageText(DamageType physicalDamage, DamageType type)
{
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
string text = "";
if (physicalDamage != null)
{
text = $"from {physicalDamage.Damage} ";
}
return text + $"{type.Type} Damage\n";
}
public static string GetAdditionalDamagesDescription(Enchantment enchantment, DamageList equipmentDamageList)
{
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: 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_006b: 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_0109: Unknown result type (might be due to invalid IL or missing references)
//IL_010b: Unknown result type (might be due to invalid IL or missing references)
//IL_0118: Unknown result type (might be due to invalid IL or missing references)
//IL_011a: Unknown result type (might be due to invalid IL or missing references)
string text = "";
if (enchantment.AdditionalDamages == null || enchantment.AdditionalDamages.Count() < 1)
{
return text;
}
List<DamageType> list = equipmentDamageList.List;
AdditionalDamage[] additionalDamages = enchantment.AdditionalDamages;
foreach (AdditionalDamage val in additionalDamages)
{
int num = (int)Math.Round(val.ConversionRatio * 100f, 0);
num.ToString();
DamageType matchingDamageType = GetMatchingDamageType(list, val.SourceDamageType);
DamageType matchingDamageType2 = GetMatchingDamageType(list, val.BonusDamageType);
float num2 = matchingDamageType?.Damage ?? 0f;
float num3 = matchingDamageType2?.Damage ?? 0f;
float num4 = num2 * ((float)num / 100f);
int num5 = (int)Math.Round(num3 + num4, MidpointRounding.AwayFromZero);
int num6 = (int)Math.Round(num3, MidpointRounding.AwayFromZero);
if (num6 != num5)
{
text += $"{num6} => {num5} ({num}% of {(int)Math.Round(num2, MidpointRounding.AwayFromZero)} {val.SourceDamageType}) {val.BonusDamageType} Damage\n";
}
}
return text;
}
public static DamageType GetMatchingDamageType(List<DamageType> damages, Types searchingDamage)
{
//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)
foreach (DamageType damage in damages)
{
if (damage.Type == searchingDamage)
{
return damage;
}
}
return null;
}
public static string GetElementalResistancesDescription(Enchantment enchantment, Equipment equipment)
{
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
string text = "";
if (enchantment.ElementalResistances == null || enchantment.ElementalResistances.Count < 1)
{
return text;
}
float num = 0f;
int num2 = 0;
foreach (DamageType item in enchantment.ElementalResistances.List)
{
num = equipment.GetDamageResistance(item.Type);
num2 = (int)Math.Round(num + item.Damage, MidpointRounding.AwayFromZero);
text += $"{(int)Math.Round(num, MidpointRounding.AwayFromZero)}% => {num2}% {item.Type} resistance\n";
}
return text;
}
public static string GetElementalResistancesDescription(Enchantment enchantment, DamageList equipmentDamageList)
{
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
string text = "";
if (enchantment.ElementalResistances == null || enchantment.ElementalResistances.Count < 1)
{
return text;
}
new DamageList();
DamageList obj = CalculateChangesInItemDamageList(equipmentDamageList, enchantment.ElementalResistances);
List<DamageType> list = equipmentDamageList.List;
bool flag = false;
foreach (DamageType item in obj.List)
{
foreach (DamageType item2 in list)
{
if (item2.Type == item.Type)
{
flag = true;
text += $"{item.Damage} => {item2.Damage * (item.Damage / 100f)} {item.Type} resistance\n";
break;
}
}
if (flag)
{
flag = false;
}
else
{
text += $"0% => {item.Damage}% {item.Type} resistance\n";
}
}
return text;
}
public static string GetEffectsDescription(Enchantment enchantment)
{
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, AffectStatusEffectBuildUpResistance>(remainingArray, out remainingArray, out var derivedArray2);
text += GetAffectStatusEffectBuildUpResistancesDescription(derivedArray2);
GenericHelper.SplitDerivedClasses<Effect, AddStatusEffect>(remainingArray, out remainingArray, out var derivedArray3);
text += GetAddStatusEffectsDescription(derivedArray3);
Effect[] array = remainingArray;
foreach (Effect val in array)
{
text += $"Type: {((object)val).GetType()}";
}
if (!text.EndsWith("\n"))
{
text += "\n";
}
return text;
}
public static string GetEffectsDescription(Enchantment enchantment, DamageList damages)
{
//IL_00b5: 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)
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)
{
if ((Object)(object)((ShootBlast)val).BaseBlast == (Object)null)
{
continue;
}
WeaponDamage componentInChildren = ((Component)((ShootBlast)val).BaseBlast).GetComponentInChildren<WeaponDamage>();
if ((Object)(object)componentInChildren == (Object)null)
{
continue;
}
bool flag = false;
if (damages == null)
{
SL.Log(OutwardEnchantmentsViewer.prefix + " ItemDescriptionsManager@ItemEnchantmentInformationHelper couldn't find matching damage type for shootBlast converstion");
return "Weapon or it's damages are not found";
}
foreach (DamageType item in damages.List)
{
if ((int)item.Type == 0)
{
float num = item.Damage * val.DamageMultiplier;
text = text + $"Weapon deals an AoE {componentInChildren.OverrideDType} \"Blast\" with " + $"{val.DamageMultiplier}x ({num}) damage multiplier (based on Weapon's total base damage {item.Damage}) \n";
flag = true;
break;
}
}
if (!flag)
{
SL.Log(OutwardEnchantmentsViewer.prefix + " ItemDescriptionsManager@ItemEnchantmentInformationHelper couldn't find matching damage type for shootBlast converstion");
text += "Physical damage not found!";
}
}
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 += $"\nType: {((object)val2).GetType()}";
}
if (!text.EndsWith("\n"))
{
text += "\n";
}
return text;
}
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";
}
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.Value}% buildup) resistance";
for (int i = 1; i < num; i++)
{
val = derivedStatusResistances[i];
text = text + ", " + val.StatusEffect.StatusName + " " + $"({val.Value}% buildup) resistance";
}
if (num > 0)
{
val = derivedStatusResistances[num];
text = text + " and " + val.StatusEffect.StatusName + " " + $"({val.Value}% 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 static float GetStatValueFromEquipment(Equipment equipment, StatModification stat)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Expected I4, but got Unknown
Stat name = stat.Name;
switch ((int)name)
{
case 0:
return ((Item)equipment).Weight;
case 1:
return ((Item)equipment).MaxDurability;
case 2:
return equipment.Stats.ManaUseModifier * -1f;
case 3:
return equipment.Stats.StaminaCostReduction;
case 4:
return equipment.Stats.CooldownReduction * -1f;
case 5:
return equipment.Stats.MovementPenalty * -1f;
case 6:
{
Weapon val = (Weapon)(object)((equipment is Weapon) ? equipment : null);
if (val != null)
{
return val.Stats.AttackSpeed;
}
return 0f;
}
case 7:
return equipment.Stats.ImpactModifier;
case 8:
return equipment.StabilityRegenModifier;
case 9:
return equipment.HealthRegenBonus;
case 10:
return equipment.ManaRegenBonus;
case 11:
return equipment.GetDamageProtection((Types)0);
case 12:
return equipment.CorruptionResistance;
case 13:
return stat.Value;
case 14:
return stat.Value;
case 15:
return stat.Value;
case 16:
return equipment.PouchCapacityBonus;
case 17:
return equipment.Stats.ImpactResistance;
case 18:
return equipment.HeatProtection;
case 19:
return equipment.ColdProtection;
case 20:
return equipment.Stats.BarrierProtection;
default:
return 0f;
}
}
}
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();
}
}
public class XmlSerializerHelper
{
public static string GetProjectLocation()
{
return Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
}
public static T DeserializeXML<T>(string filePath)
{
XmlSerializer xmlSerializer = new XmlSerializer(typeof(T));
using FileStream stream = new FileStream(filePath, FileMode.Open);
return (T)xmlSerializer.Deserialize(stream);
}
}
}
namespace OutwardEnchantmentsViewer.Utility.Fixers
{
public class ItemDescriptionScrollFixer
{
private ItemDetailsDisplay _itemDetailsDisplay;
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 ItemDetailsDisplay ItemDetailsDisplay
{
get
{
return _itemDetailsDisplay;
}
set
{
_itemDetailsDisplay = value;
}
}
public ItemDescriptionScrollFixer(ItemDetailsDisplay itemDetailsDisplay)
{
ItemDetailsDisplay = itemDetailsDisplay;
CreateFixer(itemDetailsDisplay);
}
public void CreateFixer(ItemDetailsDisplay itemDetailsDisplay)
{
//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)itemDetailsDisplay).transform.Find("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. \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. \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. \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. \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 static class EquipmentSlotIDsExtensions
{
public static readonly Dictionary<EquipmentSlotIDs, string> ArmorTypes = new Dictionary<EquipmentSlotIDs, string>
{
{
(EquipmentSlotIDs)0,
"Helmet"
},
{
(EquipmentSlotIDs)1,
"Chest"
},
{
(EquipmentSlotIDs)2,
"Legs"
},
{
(EquipmentSlotIDs)3,
"Boots"
},
{
(EquipmentSlotIDs)4,
"Hands"
},
{
(EquipmentSlotIDs)5,
"Right Hand"
},
{
(EquipmentSlotIDs)6,
"Left Hand"
},
{
(EquipmentSlotIDs)7,
"Back"
},
{
(EquipmentSlotIDs)8,
"Quiver"
},
{
(EquipmentSlotIDs)9,
"Count"
}
};
public static string GetArmorTypeName(this EquipmentSlotIDs type)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
if (!ArmorTypes.TryGetValue(type, out var value))
{
return "Unknown";
}
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];
}
}
public static class WeaponTypeExtensions
{
public static readonly Dictionary<WeaponType, string> WeaponTypes = new Dictionary<WeaponType, string>
{
{
(WeaponType)0,
"One-Handed Sword"
},
{
(WeaponType)1,
"One-Handed Axe"
},
{
(WeaponType)2,
"One-Handed Mace"
},
{
(WeaponType)30,
"Dagger"
},
{
(WeaponType)40,
"Chakram"
},
{
(WeaponType)45,
"Pistol"
},
{
(WeaponType)50,
"Halberd"
},
{
(WeaponType)51,
"Two-Handed Sword"
},
{
(WeaponType)52,
"Two-Handed Axe"
},
{
(WeaponType)53,
"Two-Handed Mace"
},
{
(WeaponType)54,
"Two-Handed Spear"
},
{
(WeaponType)55,
"Gauntlet"
},
{
(WeaponType)100,
"Shield"
},
{
(WeaponType)150,
"Arrow"
},
{
(WeaponType)200,
"Bow"
}
};
public static string GetWeaponTypeName(this WeaponType type)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
if (!WeaponTypes.TryGetValue(type, out var value))
{
return "Unknown";
}
return value;
}
}
}
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(ItemDetailsDisplay itemDetailsDisplay)
{
CreateSection(itemDetailsDisplay);
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 ShowEnabledDescription()
{
((Component)Description).gameObject.SetActive(true);
}
public void HideEnabledDescription()
{
((Component)Description).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;
if (string.IsNullOrWhiteSpace(text))
{
HideEnabledDescription();
}
else
{
ShowEnabledDescription();
}
}
}
public void SetDisabledDescriptiontext(string text)
{
if (Object.op_Implicit((Object)(object)DisabledDescriptionText))
{
DisabledDescriptionText.text = text;
if (string.IsNullOrWhiteSpace(text))
{
HideDisabledDescription();
}
else
{
ShowDisabledDescription();
}
}
}
private void CreateSection(ItemDetailsDisplay itemDetailsDisplay)
{
//IL_0182: Unknown result type (might be due to invalid IL or missing references)
Transform val = ((Component)itemDetailsDisplay).transform.Find("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 CustomEnchantmentsManager
{
private static CustomEnchantmentsManager _instance;
private Dictionary<int, EnchantmentDescription> _enchantmentsDictionary;
public string configPath = "";
public string xmlFilePath = "";
public static CustomEnchantmentsManager Instance
{
get
{
if (_instance == null)
{
_instance = new CustomEnchantmentsManager();
}
return _instance;
}
}
public Dictionary<int, EnchantmentDescription> EnchantmentsDictionary
{
get
{
return _enchantmentsDictionary;
}
set
{
_enchantmentsDictionary = value;
}
}
private CustomEnchantmentsManager()
{
configPath = Path.Combine(PathsManager.ConfigPath, "Enchantments_Viewer");
xmlFilePath = Path.Combine(configPath, "PlayersCustomEnchantmentsDescriptions.xml");
}
public EnchantmentDescription TryGetDescription(int RecipeID)
{
if (EnchantmentsDictionary == null)
{
return null;
}
EnchantmentsDictionary.TryGetValue(RecipeID, out var value);
return value;
}
public void LoadPlayerCustomEnchantmentsDescriptions()
{
if (File.Exists(xmlFilePath))
{
LoadEnchantmentDictionaryFromXml(xmlFilePath);
}
}
public void LoadEnchantmentDictionaryFromXml(string filePath)
{
try
{
EnchantmentDescriptionsControllerXml enchantmentDescriptionsControllerXml = XmlSerializerHelper.DeserializeXML<EnchantmentDescriptionsControllerXml>(filePath);
if (enchantmentDescriptionsControllerXml != null && enchantmentDescriptionsControllerXml.enchantments != null && enchantmentDescriptionsControllerXml.enchantments.Count >= 1)
{
Dictionary<int, EnchantmentDescription> enchantmentsDictionary = enchantmentDescriptionsControllerXml.ToDictionary();
EnchantmentsDictionary = enchantmentsDictionary;
SL.Log(OutwardEnchantmentsViewer.prefix + " Successfully loaded xml: " + filePath + " for enchantment descriptions!");
}
}
catch (Exception ex)
{
SL.Log(OutwardEnchantmentsViewer.prefix + " CustomEnchantmentsManager@LoadEnchantmentDictionaryFromXml error:" + ex.Message + "!");
}
}
}
public class ItemDescriptionsManager
{
public struct EnchantmentInformationData
{
public string DynamicDescription { get; set; }
public string EquipmentType { get; set; }
public EnchantmentInformationData(string dynamicDescription, string equipmentType)
{
DynamicDescription = dynamicDescription;
EquipmentType = equipmentType;
}
}
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, ItemDetailsDisplay itemDetailsDisplay)
{
List<EnchantmentRecipe> availableEnchantmentRecipies = EnchantmentsHelper.GetAvailableEnchantmentRecipies(item);
List<EnchantmentRecipeDetailedData> uniqueAvailableEnchantmentRecipeDatasInInventory = EnchantmentsHelper.GetUniqueAvailableEnchantmentRecipeDatasInInventory(item, inventory);
List<EnchantmentRecipe> list = uniqueAvailableEnchantmentRecipeDatasInInventory.Select((EnchantmentRecipeDetailedData data) => data.Data.enchantmentRecipe).ToList();
string text = "";
Equipment val = (Equipment)(object)((item is Equipment) ? item : null);
text = ((val == null || !OutwardEnchantmentsViewer.ShowEquipmentOwnedEnchantmentsDetailed.Value) ? EnchantmentsHelper.GetEnchantmentsDescriptions(uniqueAvailableEnchantmentRecipeDatasInInventory) : EnchantmentsHelper.GetDetailedEnchantmentsDescriptions(uniqueAvailableEnchantmentRecipeDatasInInventory, val));
bool flag = false;
if (!string.IsNullOrEmpty(text))
{
text = "\n" + text;
}
else
{
flag = true;
}
string leftText = "Know Enchantments";
string text2 = list.Count.ToString();
if (OutwardEnchantmentsViewer.ShowAllAvailableEnchantmentsCountForEquipment.Value)
{
text2 = $"{text2}/{availableEnchantmentRecipies.Count}";
}
ItemDisplayManager.Instance.SetHeaderText(itemDetailsDisplay, leftText, text2);
ItemDisplayManager.Instance.ShowDescriptionContainer(itemDetailsDisplay, string.IsNullOrEmpty(item.Description));
ItemDisplayManager.Instance.SetDescriptionText(itemDetailsDisplay, text);
if (!OutwardEnchantmentsViewer.ShowMissingEnchantmentsForEquipment.Value)
{
ItemDisplayManager.Instance.HideDisabledDescription(itemDetailsDisplay);
return;
}
string text3 = (flag ? "\n" : "");
List<EnchantmentRecipe> missingEnchantments = EnchantmentsHelper.GetMissingEnchantments(availableEnchantmentRecipies, list);
Equipment val2 = (Equipment)(object)((item is Equipment) ? item : null);
text3 = ((val2 == null || !OutwardEnchantmentsViewer.ShowEquipmentUnownedEnchantmentsDetailed.Value) ? (text3 + EnchantmentsHelper.GetEnchantmentsDescriptions(missingEnchantments)) : (text3 + EnchantmentsHelper.GetDetailedEnchantmentsDescriptions(missingEnchantments, val2)));
if (missingEnchantments.Count > 0)
{
ItemDisplayManager.Instance.SetDisabledDescriptionText(itemDetailsDisplay, text3);
ItemDisplayManager.Instance.ShowDisabledDescription(itemDetailsDisplay);
}
else
{
ItemDisplayManager.Instance.HideDisabledDescription(itemDetailsDisplay);
}
}
public void SetEnchantmentsDescription(EnchantmentRecipeItem item, CharacterInventory inventory, ItemDetailsDisplay itemDetailsDisplay)
{
try
{
string text = "\n";
text += GetEnchantmentDescription(item);
ItemDisplayManager.Instance.SetHeaderText(itemDetailsDisplay, "Enchantment Properties", "");
ItemDisplayManager.Instance.ShowDescriptionContainer(itemDetailsDisplay);
ItemDisplayManager.Instance.SetDescriptionText(itemDetailsDisplay, text);
}
catch (Exception ex)
{
SL.Log(OutwardEnchantmentsViewer.prefix + " ItemDescriptionsManager@SetEnchantmentsDescription error: " + ex.Message);
}
}
public string GetEnchantmentDescription(EnchantmentRecipeItem item)
{
string text = "";
Enchantment val = null;
List<EnchantmentInformationData> list = new List<EnchantmentInformationData>();
EnchantmentRecipe[] recipes = item.Recipes;
foreach (EnchantmentRecipe val2 in recipes)
{
val = ResourcesPrefabManager.Instance.GetEnchantmentPrefab(val2.RecipeID);
if (!((Object)(object)val == (Object)null))
{
EnchantmentInformationData enchantmentInformation = GetEnchantmentInformation(val, val2);
list.Add(enchantmentInformation);
}
}
if (OutwardEnchantmentsViewer.ShowInShopEnchantmentWithEquipmentType.Value)
{
text += GetEnchantmentDescriptionWithEquipmentType(item, list);
}
else
{
foreach (EnchantmentInformationData item2 in list)
{
text = text + "Unknown Equipment\n" + item2.DynamicDescription + "\n";
}
}
return text;
}
public static string GetEnchantmentDescriptionWithEquipmentType(EnchantmentRecipeItem item, List<EnchantmentInformationData> enchantmentInformations)
{
string text = "";
List<string> equipmentTypesFromEnchantmentItem = GetEquipmentTypesFromEnchantmentItem(item);
string text2 = "";
int num = enchantmentInformations.Count - 1;
for (int i = 0; i < item.Recipes.Length; i++)
{
if (i > num)
{
text += "Error: could not retrieve that many enchantment informations as there are recipes!";
}
else if (string.IsNullOrEmpty(enchantmentInformations[i].EquipmentType))
{
if (i < equipmentTypesFromEnchantmentItem.Count)
{
text2 = equipmentTypesFromEnchantmentItem[i];
text = text + text2 + "?\n" + enchantmentInformations[i].DynamicDescription + "\n";
}
else
{
text2 = "Undetermined Equipment";
text = text + text2 + "\n" + enchantmentInformations[i].DynamicDescription + "\n";
}
}
else
{
text = text + enchantmentInformations[i].EquipmentType + enchantmentInformations[i].DynamicDescription + "\n";
}
}
return text;
}
public static List<string> GetEquipmentTypesFromEnchantmentItem(EnchantmentRecipeItem enchantmentItem)
{
string[] equipmentsFromEnchantmentItem = GetEquipmentsFromEnchantmentItem(enchantmentItem);
List<string> list = new List<string>();
string[] array = new string[0];
string text = "";
string[] array2 = equipmentsFromEnchantmentItem;
foreach (string text2 in array2)
{
array = text2.Split(new char[1] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
if (array.Length > 1)
{
text = getEquipmentTypeString(array[^1]);
if (string.IsNullOrEmpty(text))
{
list.Add(text2);
}
else
{
list.Add(text);
}
}
else
{
text = getEquipmentTypeString(text2);
if (string.IsNullOrEmpty(text))
{
list.Add(text2);
}
else
{
list.Add(text);
}
}
}
return list;
}
public static string getEquipmentTypeString(string equipmentType)
{
switch (equipmentType.ToLower())
{
case "helm":
case "helmet":
return "Helmet";
case "armor":
case "chest":
return "Chest";
case "boots":
return "Boots";
case "weapon":
return "Weapon";
case "backpack":
return "Backpack";
default:
return "";
}
}
public static string[] GetEquipmentsFromEnchantmentItem(EnchantmentRecipeItem enchantmentItem)
{
MatchCollection matchCollection = Regex.Matches(GetLocalizedEnchantmentDescription(enchantmentItem), "Equipment:\\s*(.*)");
if (matchCollection.Count > 0)
{
return (from s in matchCollection[0].Groups[1].Value.Split(new char[1] { ',' }, StringSplitOptions.RemoveEmptyEntries)
select s.Trim()).ToArray();
}
return Array.Empty<string>();
}
public static string GetLocalizedEnchantmentDescription(EnchantmentRecipeItem item)
{
string result = "";
string text = null;
if (!string.IsNullOrEmpty(item.m_shopLocalizedDescription))
{
text = item.m_shopLocalizedDescription;
item.m_shopLocalizedDescription = null;
}
if (LocalizationManager.Instance.Loaded)
{
if (((Item)item).m_lastDescLang != LocalizationManager.Instance.CurrentLanguage)
{
((Item)item).m_lastDescLang = LocalizationManager.Instance.CurrentLanguage;
}
result = GetProcessedEnchantmentItemDescription(item);
}
if (!string.IsNullOrEmpty(text))
{
item.m_shopLocalizedDescription = text;
}
return result;
}
public static string GetProcessedEnchantmentItemDescription(EnchantmentRecipeItem item)
{
//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_0177: Unknown result type (might be due to invalid IL or missing references)
//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
//IL_0248: Unknown result type (might be due to invalid IL or missing references)
//IL_0278: Unknown result type (might be due to invalid IL or missing references)
//IL_0290: Unknown result type (might be due to invalid IL or missing references)
//IL_02e4: Unknown result type (might be due to invalid IL or missing references)
//IL_06cc: Unknown result type (might be due to invalid IL or missing references)
//IL_06d1: Unknown result type (might be due to invalid IL or missing references)
//IL_06d3: Unknown result type (might be due to invalid IL or missing references)
//IL_06ea: Expected I4, but got Unknown
if (item.Recipes.Length < 1)
{
return ((Item)item).Description;
}
StringBuilder stringBuilder = new StringBuilder();
string loc = LocalizationManager.Instance.GetLoc("ItemTag_Incense");
stringBuilder.AppendLine(loc + ": " + item.Recipes[0].PillarDatas[0].CompatibleIngredients[0].SpecificIngredient.Name);
stringBuilder.AppendLine("");
StringBuilder stringBuilder2 = new StringBuilder();
for (int i = 0; i < item.Recipes[0].PillarDatas.Length; i++)
{
if (i > 0)
{
stringBuilder2.Append(", ");
}
stringBuilder2.Append(LocalizationManager.Instance.GetLoc($"Compass_{item.Recipes[0].PillarDatas[i].Direction}"));
if (item.Recipes[0].PillarDatas[i].IsFar)
{
stringBuilder2.Append(LocalizationManager.Instance.GetLoc("EnchantmentCondition_PillarFar"));
}
else
{
stringBuilder2.Append(LocalizationManager.Instance.GetLoc("EnchantmentCondition_PillarClose"));
}
}
stringBuilder.AppendLine(LocalizationManager.Instance.GetLoc("EnchantmentCondition_PillarPlacement") + ": " + stringBuilder2.ToString());
stringBuilder.AppendLine("");
bool flag = true;
for (int j = 0; j < item.Recipes.Length; j++)
{
for (int k = 0; k < item.Recipes[j].CompatibleEquipments.CompatibleEquipments.Length; k++)
{
if ((int)item.Recipes[j].CompatibleEquipments.CompatibleEquipments[k].Type == 0)
{
flag = false;
break;
}
}
if (!flag)
{
break;
}
}
StringBuilder stringBuilder3 = new StringBuilder();
HashSet<string> hashSet = new HashSet<string>();
for (int l = 0; l < item.Recipes.Length; l++)
{
if (l > 0)
{
stringBuilder3.Append(", ");
}
stringBuilder3.Append(LocalizationManager.Instance.GetLoc("ItemTag_" + item.Recipes[l].CompatibleEquipments.EquipmentTag.Tag.TagName.Replace(" ", "")));
for (int m = 0; m < item.Recipes[l].CompatibleEquipments.CompatibleEquipments.Length; m++)
{
if ((int)item.Recipes[l].CompatibleEquipments.CompatibleEquipments[m].Type == 0)
{
string text = "";
if (item.Recipes[l].CompatibleEquipments.CompatibleEquipments[m].IngredientTag.Tag == item.Recipes[l].CompatibleEquipments.EquipmentTag.Tag)
{
text = text + LocalizationManager.Instance.GetLoc("EnchantmentCondition_AnyTag") + " ";
}
text += LocalizationManager.Instance.GetLoc("ItemTag_" + item.Recipes[l].CompatibleEquipments.CompatibleEquipments[m].IngredientTag.Tag.TagName.Replace(" ", ""));
hashSet.Add(text);
}
else if ((Object)(object)item.Recipes[l].CompatibleEquipments.CompatibleEquipments[m].SpecificIngredient != (Object)null)
{
hashSet.Add(LocalizationManager.Instance.GetItemName(item.Recipes[l].CompatibleEquipments.CompatibleEquipments[m].SpecificIngredient.ItemID));
}
}
}
StringBuilder stringBuilder4 = new StringBuilder();
int num = 0;
foreach (string item2 in hashSet)
{
if (num >= 1)
{
stringBuilder4.Append(", ");
}
stringBuilder4.Append(item2);
num++;
}
if (!flag)
{
stri