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.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using HG;
using Microsoft.CodeAnalysis;
using On.RoR2;
using R2API;
using RoR2;
using UnityEngine;
using UnityEngine.Networking;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("ArtifactofPreparation")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ArtifactofPreparation")]
[assembly: AssemblyTitle("ArtifactofPreparation")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace ArtifactOfPreparation
{
[BepInPlugin("com.scott_jc.artifactofpreparation", "Artifact of Preparation", "1.0.8")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class ArtifactOfPreparationPlugin : BaseUnityPlugin
{
public static ArtifactDef PreparationArtifact;
private static bool poolsBuilt;
private static List<ItemIndex> whitePool;
private static List<ItemIndex> greenPool;
private static List<ItemIndex> redPool;
private static List<ItemIndex> yellowPool;
private static List<ItemIndex> bluePool;
private static List<ItemIndex> purplePool;
private static List<EquipmentIndex> equipmentPool;
private static ConfigEntry<bool> configRefresh;
private static ConfigEntry<bool> configexcludescrap;
private static ConfigEntry<bool> configexcludedebugequip;
private static ConfigEntry<int> configprepgivered;
private static ConfigEntry<int> configprepgivegreen;
private static ConfigEntry<int> configprepgivewhite;
private static ConfigEntry<int> configprepgivepurple;
private static ConfigEntry<int> configprepgiveblue;
private static ConfigEntry<int> configprepgiveyellow;
private static ConfigEntry<bool> configexcludeuselessyellow;
private static ConfigEntry<bool> configexcludepearl;
private static ConfigEntry<bool> configexcludesentrykeys;
private static ConfigEntry<bool> configprepgiveequip;
private static ConfigEntry<bool> configprepgiveequiplunar;
private static ConfigEntry<string> configreditemlist;
private static ConfigEntry<string> configgreenitemlist;
private static ConfigEntry<string> configwhiteitemlist;
private static ConfigEntry<string> configyellowitemlist;
private static ConfigEntry<string> configblueitemlist;
private static ConfigEntry<string> configpurpleitemlist;
private static ConfigEntry<string> configequipmentlist;
private static ConfigEntry<string> configExcludedItems;
private static ConfigEntry<string> configGuaranteedItems;
private static string[] excludedItems;
private static string[] guaranteedItems;
private static ConfigEntry<bool> configNoDuplicates;
private static ConfigEntry<bool> configANoDuplicates;
private bool ranonce = false;
public void Awake()
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Expected O, but got Unknown
RegisterArtifact();
LoadConfig();
Run.Start += new hook_Start(Run_Start);
}
private void RegisterArtifact()
{
PreparationArtifact = ScriptableObject.CreateInstance<ArtifactDef>();
PreparationArtifact.cachedName = "ARTIFACT_PREPARATION";
PreparationArtifact.nameToken = "ARTIFACT_PREPARATION_NAME";
PreparationArtifact.descriptionToken = "ARTIFACT_PREPARATION_DESC";
Sprite smallIconSelectedSprite = LoadSprite(Path.Combine(Paths.BepInExRootPath, "plugins", "scottjc-artifactofpreparation", "icon.png"));
Sprite smallIconDeselectedSprite = LoadSprite(Path.Combine(Paths.BepInExRootPath, "plugins", "scottjc-artifactofpreparation", "starterdeIcon.png"));
PreparationArtifact.smallIconSelectedSprite = smallIconSelectedSprite;
PreparationArtifact.smallIconDeselectedSprite = smallIconDeselectedSprite;
LanguageAPI.Add("ARTIFACT_PREPARATION_NAME", "Artifact of Preparation");
LanguageAPI.Add("ARTIFACT_PREPARATION_DESC", "At the start of the run, each player receives a random set of items.");
ContentAddition.AddArtifactDef(PreparationArtifact);
}
private Sprite LoadSprite(string path)
{
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Expected O, but got Unknown
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Expected O, but got Unknown
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_009f: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
Texture2D val;
if (File.Exists(path))
{
byte[] array = File.ReadAllBytes(path);
val = new Texture2D(2, 2);
ImageConversion.LoadImage(val, array);
}
else
{
val = new Texture2D(256, 256);
Color[] array2 = (Color[])(object)new Color[65536];
for (int i = 0; i < array2.Length; i++)
{
array2[i] = Color.white;
}
val.SetPixels(array2);
val.Apply();
}
return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f));
}
private void Run_Start(orig_Start orig, Run self)
{
orig.Invoke(self);
if (!NetworkServer.active || !Object.op_Implicit((Object)(object)RunArtifactManager.instance) || !RunArtifactManager.instance.IsArtifactEnabled(PreparationArtifact))
{
return;
}
LoadConfig();
if (!poolsBuilt || configRefresh.Value)
{
whitePool = BuildItemList((ItemTier)0);
greenPool = BuildItemList((ItemTier)1);
redPool = BuildItemList((ItemTier)2);
yellowPool = BuildItemList((ItemTier)4);
bluePool = BuildItemList((ItemTier)3);
purplePool = BuildVoidItemList();
equipmentPool = BuildEquipmentList();
poolsBuilt = true;
}
foreach (CharacterMaster readOnlyInstances in CharacterMaster.readOnlyInstancesList)
{
if (!((Object)(object)((readOnlyInstances != null) ? readOnlyInstances.inventory : null) == (Object)null))
{
GiveRandomItems(readOnlyInstances.inventory, whitePool, configprepgivewhite.Value);
GiveRandomItems(readOnlyInstances.inventory, greenPool, configprepgivegreen.Value);
GiveRandomItems(readOnlyInstances.inventory, redPool, configprepgivered.Value);
GiveRandomItems(readOnlyInstances.inventory, yellowPool, configprepgiveyellow.Value);
GiveRandomItems(readOnlyInstances.inventory, bluePool, configprepgiveblue.Value);
GiveRandomItems(readOnlyInstances.inventory, purplePool, configprepgivepurple.Value);
if (configprepgiveequip.Value)
{
GiveRandomEquipment(readOnlyInstances.inventory, equipmentPool);
}
GiveGuaranteedItems(readOnlyInstances.inventory);
OrganizeInventory(readOnlyInstances.inventory);
}
}
}
private void LoadConfig()
{
if (ranonce)
{
try
{
((BaseUnityPlugin)this).Config.Reload();
}
catch
{
}
}
configRefresh = ((BaseUnityPlugin)this).Config.Bind<bool>("Main", "configRefresh", false, "Whether or not I should build the item lists every single run or not (Failsafe for other mod interactions)");
configexcludescrap = ((BaseUnityPlugin)this).Config.Bind<bool>("Main", "excludescrap", true, "Whether or not I Exclude scrap or not");
configexcludedebugequip = ((BaseUnityPlugin)this).Config.Bind<bool>("Main", "excludedebugequip", true, "Whether or not I Exclude debug equips or not");
configprepgivered = ((BaseUnityPlugin)this).Config.Bind<int>("Main", "prepgivered", 1, "How many legendary (Red) items to give");
configprepgivegreen = ((BaseUnityPlugin)this).Config.Bind<int>("Main", "prepgivegreen", 3, "How many Uncommon (Green) Items to give");
configprepgivewhite = ((BaseUnityPlugin)this).Config.Bind<int>("Main", "prepgivewhite", 5, "How many Common (White) items to give");
configprepgiveequip = ((BaseUnityPlugin)this).Config.Bind<bool>("Main", "prepgiveequip", true, "Whether to give an equipment or not");
configprepgiveequiplunar = ((BaseUnityPlugin)this).Config.Bind<bool>("Main", "prepgiveequiplunar", false, "Whether or not to include lunar equipments in the list.");
configprepgivepurple = ((BaseUnityPlugin)this).Config.Bind<int>("Main", "prepgivepurple", 0, "How many Void (Purple) Items to give");
configprepgiveyellow = ((BaseUnityPlugin)this).Config.Bind<int>("Main", "prepgiveyellow", 0, "How many Boss (Yellow) items to give");
configprepgiveblue = ((BaseUnityPlugin)this).Config.Bind<int>("Main", "prepgiveblue", 0, "How many Lunar (Blue) Items to give");
configexcludeuselessyellow = ((BaseUnityPlugin)this).Config.Bind<bool>("Main", "excludeuselessyellow", true, "Exclude boss items that do nothing until the end of a loop.");
configexcludepearl = ((BaseUnityPlugin)this).Config.Bind<bool>("Main", "excludepearl", true, "Excludes pearls");
configexcludesentrykeys = ((BaseUnityPlugin)this).Config.Bind<bool>("Main", "excludesentrykeys", true, "Exclude sentry keys (they give movement speed so you might like em)");
configExcludedItems = ((BaseUnityPlugin)this).Config.Bind<string>("Main", "ExcludedItems", "", "Items or Equipment to exclude (Seperated by Comma: Item1, Item2, etc), works for any tier of item. You must use the internal names of items i.e. PlasmaShrimp is MissileVoid, consult the RoR2 Wiki for more info.");
excludedItems = GetItemsList(configExcludedItems.Value).ToArray();
configGuaranteedItems = ((BaseUnityPlugin)this).Config.Bind<string>("Main", "guaranteedItems", "", "Item names to always start with, similar to Artifact of Rebirth's effect, separated by commas (again, you must use internal names, consult the RoR2 wiki) If you give an equipment here, it will override the random equipment setting, you can only give 1 equipment.");
guaranteedItems = GetItemsList(configGuaranteedItems.Value).ToArray();
configNoDuplicates = ((BaseUnityPlugin)this).Config.Bind<bool>("Main", "noDuplicates", false, "Prevent giving duplicate items (won't effect guaranteedItems, and will allow duplicates if pool runs out)");
configANoDuplicates = ((BaseUnityPlugin)this).Config.Bind<bool>("Main", "AnoDuplicates", false, "Absolutely no dupes, if this is set to true, you can't get more than 1 of an item (guaranteedItems exempt), this supercedes the above option");
configreditemlist = ((BaseUnityPlugin)this).Config.Bind<string>("Z_ItemLists", "reditemlist", "", "List of internal (red) items.");
configgreenitemlist = ((BaseUnityPlugin)this).Config.Bind<string>("Z_ItemLists", "greenitemlist", "", "List of internal (green) items.");
configwhiteitemlist = ((BaseUnityPlugin)this).Config.Bind<string>("Z_ItemLists", "whiteitemlist", "", "List of internal (white) items.");
configyellowitemlist = ((BaseUnityPlugin)this).Config.Bind<string>("Z_ItemLists", "yellowitemlist", "", "List of internal (yellow) items.");
configblueitemlist = ((BaseUnityPlugin)this).Config.Bind<string>("Z_ItemLists", "blueitemlist", "", "List of internal (blue) items.");
configpurpleitemlist = ((BaseUnityPlugin)this).Config.Bind<string>("Z_ItemLists", "purpleitemlist", "", "List of internal (purple) items.");
configequipmentlist = ((BaseUnityPlugin)this).Config.Bind<string>("Z_ItemLists", "equipmentlist", "", "List of internal (equipment) items.");
if (ranonce)
{
try
{
configreditemlist.Value = string.Join(",", BuildItemNameList((ItemTier)2).ToArray());
configgreenitemlist.Value = string.Join(",", BuildItemNameList((ItemTier)1).ToArray());
configwhiteitemlist.Value = string.Join(",", BuildItemNameList((ItemTier)0).ToArray());
configyellowitemlist.Value = string.Join(",", BuildItemNameList((ItemTier)4).ToArray());
configblueitemlist.Value = string.Join(",", BuildItemNameList((ItemTier)3).ToArray());
configpurpleitemlist.Value = string.Join(",", BuildVoidItemNameList().ToArray());
configequipmentlist.Value = string.Join(",", BuildEquipmentNameList().ToArray());
}
catch
{
}
try
{
((BaseUnityPlugin)this).Config.Save();
}
catch
{
}
}
ranonce = true;
}
private static List<string> GetItemsList(string InputStr)
{
List<string> list = new List<string>();
string text = "";
if (string.IsNullOrWhiteSpace(InputStr))
{
return list;
}
string[] array = InputStr.Split(',');
string[] array2 = array;
foreach (string text2 in array2)
{
text = text2;
if (text.StartsWith("ItemIndex.", StringComparison.OrdinalIgnoreCase))
{
text = text.Substring(10);
}
if (!string.IsNullOrEmpty(text.Trim()))
{
list.Add(text.Trim());
}
}
return list;
}
private static List<ItemIndex> BuildItemList(ItemTier tier, bool noexclusion = false)
{
//IL_0008: 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_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: Invalid comparison between Unknown and I4
//IL_017e: Unknown result type (might be due to invalid IL or missing references)
List<ItemIndex> list = new List<ItemIndex>();
Enumerator<ItemDef> enumerator = ItemCatalog.allItemDefs.GetEnumerator();
try
{
while (enumerator.MoveNext())
{
ItemDef current = enumerator.Current;
if (!((Object)(object)current == (Object)null) && !current.hidden && current.tier == tier && (noexclusion || !current.ContainsTag((ItemTag)10) || !configexcludescrap.Value) && (noexclusion || (int)tier != 4 || ((!configexcludeuselessyellow.Value || !(((Object)current).name == "MasterBattery")) && (!configexcludeuselessyellow.Value || !(((Object)current).name == "MasterCore")) && (!configexcludesentrykeys.Value || !(((Object)current).name == "PowerPyramid")) && (!configexcludepearl.Value || !(((Object)current).name == "Pearl")) && (!configexcludepearl.Value || !(((Object)current).name == "ShinyPearl")))) && (noexclusion || !excludedItems.Contains(((Object)current).name)))
{
list.Add(current.itemIndex);
}
}
}
finally
{
((IDisposable)enumerator).Dispose();
}
return list;
}
private static string[] BuildItemNameList(ItemTier tier)
{
//IL_0008: 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_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: 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_0041: Unknown result type (might be due to invalid IL or missing references)
List<string> list = new List<string>();
Enumerator<ItemDef> enumerator = ItemCatalog.allItemDefs.GetEnumerator();
try
{
while (enumerator.MoveNext())
{
ItemDef current = enumerator.Current;
if (!((Object)(object)current == (Object)null) && !current.hidden && current.tier == tier)
{
list.Add(((Object)current).name + " (" + Language.GetString(current.nameToken) + ")");
}
}
}
finally
{
((IDisposable)enumerator).Dispose();
}
return list.ToArray();
}
private static string[] BuildVoidItemNameList()
{
//IL_0008: 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_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: 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_0042: Invalid comparison between Unknown and I4
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Invalid comparison between Unknown and I4
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Invalid comparison between Unknown and I4
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Invalid comparison between Unknown and I4
List<string> list = new List<string>();
Enumerator<ItemDef> enumerator = ItemCatalog.allItemDefs.GetEnumerator();
try
{
while (enumerator.MoveNext())
{
ItemDef current = enumerator.Current;
if (!((Object)(object)current == (Object)null) && !current.hidden && ((int)current.tier == 6 || (int)current.tier == 7 || (int)current.tier == 8 || (int)current.tier == 9))
{
list.Add(((Object)current).name + " (" + Language.GetString(current.nameToken) + ")");
}
}
}
finally
{
((IDisposable)enumerator).Dispose();
}
return list.ToArray();
}
private static List<ItemIndex> BuildVoidItemList(bool noexclusion = false)
{
//IL_0008: 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_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Invalid comparison between Unknown and I4
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Invalid comparison between Unknown and I4
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Invalid comparison between Unknown and I4
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Invalid comparison between Unknown and I4
//IL_0093: Unknown result type (might be due to invalid IL or missing references)
List<ItemIndex> list = new List<ItemIndex>();
Enumerator<ItemDef> enumerator = ItemCatalog.allItemDefs.GetEnumerator();
try
{
while (enumerator.MoveNext())
{
ItemDef current = enumerator.Current;
if (!((Object)(object)current == (Object)null) && !current.hidden && ((int)current.tier == 6 || (int)current.tier == 7 || (int)current.tier == 8 || (int)current.tier == 9) && (noexclusion || !excludedItems.Contains(((Object)current).name)))
{
list.Add(current.itemIndex);
}
}
}
finally
{
((IDisposable)enumerator).Dispose();
}
return list;
}
private static string[] BuildEquipmentNameList()
{
List<string> list = new List<string>();
EquipmentDef[] equipmentDefs = EquipmentCatalog.equipmentDefs;
foreach (EquipmentDef val in equipmentDefs)
{
if (!((Object)(object)val == (Object)null) && val.canDrop)
{
list.Add(((Object)val).name + " (" + Language.GetString(val.nameToken) + ")");
}
}
return list.ToArray();
}
private static List<EquipmentIndex> BuildEquipmentList()
{
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
List<EquipmentIndex> list = new List<EquipmentIndex>();
EquipmentDef[] equipmentDefs = EquipmentCatalog.equipmentDefs;
foreach (EquipmentDef val in equipmentDefs)
{
if (!((Object)(object)val == (Object)null) && (!val.isLunar || configprepgiveequiplunar.Value) && val.canDrop && configexcludedebugequip.Value && !excludedItems.Contains(((Object)val).name))
{
list.Add(val.equipmentIndex);
}
}
return list;
}
private static void GiveRandomItems(Inventory inventory, List<ItemIndex> pool, int count)
{
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: 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)
if (pool.Count <= 0)
{
return;
}
bool flag = false;
List<ItemIndex> list = new List<ItemIndex>(pool);
for (int i = 0; i < count; i++)
{
if (list.Count == 0)
{
if (configANoDuplicates.Value)
{
break;
}
list = new List<ItemIndex>(pool);
flag = true;
}
ItemIndex val = list[Random.Range(0, list.Count)];
inventory.GiveItem(val, 1);
if (!flag && (configANoDuplicates.Value || configNoDuplicates.Value))
{
list.Remove(val);
}
}
}
private static void GiveRandomEquipment(Inventory inventory, List<EquipmentIndex> pool)
{
//IL_001d: 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)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
if (pool.Count != 0)
{
EquipmentIndex equipmentIndex = pool[Random.Range(0, pool.Count)];
inventory.SetEquipmentIndex(equipmentIndex);
}
}
private static void GiveGuaranteedItems(Inventory inventory)
{
//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_001a: Invalid comparison between Unknown and I4
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Invalid comparison between Unknown and I4
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
string[] array = guaranteedItems;
foreach (string text in array)
{
ItemIndex val = ItemCatalog.FindItemIndex(text);
if ((int)val != -1)
{
inventory.GiveItem(val, 1);
continue;
}
EquipmentIndex val2 = EquipmentCatalog.FindEquipmentIndex(text);
if ((int)val2 != -1)
{
inventory.SetEquipmentIndex(val2);
}
}
}
private static void OrganizeInventory(Inventory inventory)
{
//IL_0008: 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_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
//IL_0115: 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)
//IL_012a: Unknown result type (might be due to invalid IL or missing references)
Dictionary<ItemIndex, int> dictionary = new Dictionary<ItemIndex, int>();
foreach (ItemIndex item in ((IEnumerable<ItemDef>)(object)ItemCatalog.allItemDefs).Select((ItemDef def) => def.itemIndex))
{
int itemCount = inventory.GetItemCount(item);
if (itemCount > 0)
{
dictionary[item] = itemCount;
}
}
foreach (KeyValuePair<ItemIndex, int> item2 in dictionary)
{
inventory.RemoveItem(item2.Key, item2.Value);
}
ItemTier[] array = new ItemTier[9];
RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
ItemTier[] array2 = (ItemTier[])(object)array;
ItemTier[] array3 = array2;
foreach (ItemTier val in array3)
{
foreach (KeyValuePair<ItemIndex, int> item3 in dictionary)
{
ItemDef itemDef = ItemCatalog.GetItemDef(item3.Key);
if ((Object)(object)itemDef != (Object)null && itemDef.tier == val)
{
inventory.GiveItem(item3.Key, item3.Value);
}
}
}
}
}
}