using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
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 BepInEx;
using BepInEx.Configuration;
using HG;
using HG.Reflection;
using RoR2;
using RoR2.CharacterAI;
using UnityEngine;
using UnityEngine.Networking;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("EnemiesWithItems")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("EnemiesWithItems")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: OptIn]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("3.0.8.0")]
[module: UnverifiableCode]
namespace BaddiesWithItems;
[BepInPlugin("com.Anreol.EnemiesWithItems", "EnemiesWithItems", "3.0.8")]
public class EnemiesWithItems : BaseUnityPlugin
{
internal const string ModIdentifier = "EnemiesWithItems";
internal const string ModVer = "3.0.8";
public static EnemiesWithItems instance;
public static ConfigEntry<bool> GenerateItems;
public static ConfigEntry<string> ItemMultiplier;
public static ConfigEntry<string> MaxItemsToGenerateMultiplier;
public static ConfigEntry<bool> FixItemMultiplierCaps;
public static ConfigEntry<bool> Scaling;
public static ConfigEntry<int> StageReq;
public static ConfigEntry<string> InheritItemsChance;
public static ConfigEntry<bool> InheranceBlacklist;
public static ConfigEntry<string> EquipGenChance;
public static ConfigEntry<string> ConfigItemBlacklist;
public static ConfigEntry<string> ConfigEquipBlacklist;
public static ConfigEntry<string> ConfigItemLimiter;
public static ConfigEntry<string> ConfigItemTiersEnabledWeights;
public static ConfigEntry<string> ConfigItemTiersCaps;
public static ConfigEntry<bool> Limiter;
public static ConfigEntry<bool> EquipItems;
public static ConfigEntry<bool> AutoBanEquipElite;
public static ConfigEntry<bool> AutoBanItemAIBlacklisted;
public static ConfigEntry<bool> AutoBanItemWorldUniqueAndScrap;
public static ConfigEntry<bool> UmbraeBlacklistLimitOperation;
public static ConfigEntry<bool> UmbraeMultiplyOperation;
public static ConfigEntry<string> DropChance;
public static EquipmentDef[] EquipmentBlackList = (EquipmentDef[])(object)new EquipmentDef[0];
public static ItemDef[] ItemBlackList = (ItemDef[])(object)new ItemDef[0];
public static ItemTierDef[] AvailableItemTierDefs = (ItemTierDef[])(object)new ItemTierDef[0];
public static float[] ItemTierWeights = new float[0];
public static int[] ItemTierCaps = new int[0];
public static Dictionary<ItemDef, int> LimitedItemsDictionary = new Dictionary<ItemDef, int>();
public void InitConfigFileValues()
{
GenerateItems = ((BaseUnityPlugin)this).Config.Bind<bool>("Generator Settings", "GenerateItems", true, "Toggles item generation for enemies.");
Scaling = ((BaseUnityPlugin)this).Config.Bind<bool>("Generator Settings", "ScaleAllPlayers", true, "Toggles how the mod balances potential item amount per enemy.\nTrue: Total items of all players\nFalse: Average item count from players");
EquipGenChance = ((BaseUnityPlugin)this).Config.Bind<string>("Generator Settings", "EquipGenChance", "10", "The percent chance for generating a Use item.");
InheritItemsChance = ((BaseUnityPlugin)this).Config.Bind<string>("Generator Settings", "InheritItemsChance", "0", "Percent chance for enemies to randomly inherit items from a random player.\nOverrides Generator Settings whenever it happens.\nSet to zero (0) or less to disable.");
InheranceBlacklist = ((BaseUnityPlugin)this).Config.Bind<bool>("Generator Settings", "InheranceBlacklist", false, "Should enemies that inherit items, including doppelgangers or gummy clones get their items removed depending on the item blacklist. Default to false to don't mess third-party item additions.");
ItemMultiplier = ((BaseUnityPlugin)this).Config.Bind<string>("Generator Settings", "ItemMultiplier", "1", "Multiplies a item generation's amount by this. If inhiring, it multiplies all stacks instead.\nKeep in mind that limiters and caps will apply if possible after multiplication.");
MaxItemsToGenerateMultiplier = ((BaseUnityPlugin)this).Config.Bind<string>("Generator Settings", "MaxItemsToGenerateMultiplier", "1", "Multiplies the maximum amount of items to generate by this.\nExtremely destructive, and scales over time. Not recommended.");
FixItemMultiplierCaps = ((BaseUnityPlugin)this).Config.Bind<bool>("Generator Settings", "FixItemMultiplierCaps", true, "Whenever item amounts that exceed the current generation cap thanks to a modified ItemMultiplier value should get capped or not.\nSet to false for pre-3.0.4 behavior.");
StageReq = ((BaseUnityPlugin)this).Config.Bind<int>("General Settings", "StageReq", 6, "Sets the stage where enemies start to inherit/generate items. If in the final stage in the first loop, it will not apply.");
Limiter = ((BaseUnityPlugin)this).Config.Bind<bool>("Generator Settings", "Limiter", true, "Should it clean up the enemies' inventories post item generation to accomodate the item limiter blacklist. Affects normal and inherance generations.");
DropChance = ((BaseUnityPlugin)this).Config.Bind<string>("General Settings", "DropChance", "0.1", "Sets the percent chance that an enemy drops one of their items.\nDefault 0.1 means average 1 in a 1000 kills will result in a drop.\nSet to zero (0) to disable dropping.");
ConfigItemTiersEnabledWeights = ((BaseUnityPlugin)this).Config.Bind<string>("General Settings", "ConfigItemTiersWeights", "Tier1-40, Tier2-20, Tier3-1, Lunar-0.5", "Percentage chance of items of a certain Item Tier enum (to be queried to ItemTierDef) to be generated.\nEnter the names of Item Tiers as X-Y separated by a comma and a space. X as tier name & Y as percentage. ex) Tier1-40, Tier2-20, VoidTier1-2.\nA item tier lacking an entry here WILL NOT be generated.");
ConfigItemTiersCaps = ((BaseUnityPlugin)this).Config.Bind<string>("General Settings", "ConfigItemTiersCaps", "Tier1-0, Tier2-0, Tier3-0, Lunar-0", "Max of items of a certain Item Tier enum (to be queried to ItemTierDef) to be generated.\nEnter the names of the Item Tiers as X-Y separated by a comma and a space. X as tier name & Y as percentage. ex) Tier1-40, Tier2-20, VoidTier1-2.\nA zero (0) disables the cap. Item tiers lacking an entry here, but that exists in ConfigItemTiersEnabledWeights/ConfigItemTiersWeights will default to zero.");
EquipItems = ((BaseUnityPlugin)this).Config.Bind<bool>("Generator Settings", "EquipItems", false, "Toggles Use items to be inherited/generated.");
AutoBanEquipElite = ((BaseUnityPlugin)this).Config.Bind<bool>("Automatic Ban Lists", "EquipAutoBanElite", true, "Should all elite equipment be automatically put in the blacklist. Works for a few unused elites or modded ones (if they were added to the game properly).");
AutoBanItemAIBlacklisted = ((BaseUnityPlugin)this).Config.Bind<bool>("Automatic Ban Lists", "ItemAutoBanAIBlacklisted", true, "Should all items with the AI blacklisted tag be automatically put in the blacklist. Disable at your own volition! They are blacklisted for a reason.");
AutoBanItemWorldUniqueAndScrap = ((BaseUnityPlugin)this).Config.Bind<bool>("Automatic Ban Lists", "AutoBanItemWorldUniqueAndScrap", true, "Should all items that are considered scrap and items that are World Unique (Halcyon Seed or pearls, for example) be banned automatically.");
ConfigItemBlacklist = ((BaseUnityPlugin)this).Config.Bind<string>("Ban Lists", "ConfigItemBlacklist", "Missile, Bear, ExplodeOnDeath, NovaOnHeal, BounceNearby, StickyBomb, RoboBallBuddy", "Enter ItemDef names separated by a comma and a space to blacklist certain items. ex) PersonalShield, Syringe\nBasegame ItemDef names: https://risk-of-thunder.github.io/R2Wiki/Mod-Creation/Developer-Reference/Items-and-Equipments-Data/");
ConfigEquipBlacklist = ((BaseUnityPlugin)this).Config.Bind<string>("Ban Lists", "ConfigEquipBlacklist", "CommandMissile, Blackhole, GhostGun, DroneBackup, OrbitalLaser, BFG, Enigma, Lightning, GoldGat, BurnNearby, Scanner, Gateway, FireBallDash, Recycle", "Enter EquipmentDef names separated by a comma and a space to blacklist certain equipments. ex) Saw, DroneBackup\nBasegame EquipmentDef names: https://risk-of-thunder.github.io/R2Wiki/Mod-Creation/Developer-Reference/Items-and-Equipments-Data/#equipments");
ConfigItemLimiter = ((BaseUnityPlugin)this).Config.Bind<string>("Ban Lists", "ConfigItemLimiter", "HealWhileSafe-10, SlowOnHit-1, Medkit-4, Behemoth-2, BleedOnHit-3, IgniteOnKill-2, AutoCastEquipment-1, NearbyDamageBonus-3, DeathMark-0, ArmorPlate-0", "Enter ItemDef names as X-Y separated by a comma and a space to apply caps to certain items. X is the item code name and Y is the number cap. ex) PersonalShield-20, Syringe-5. A zero (0) makes the item be limited by the current number of cleared stages.");
UmbraeBlacklistLimitOperation = ((BaseUnityPlugin)this).Config.Bind<bool>("Vengeance Configuration", "UmbraeBlacklistLimitOperation", false, "If UmbraeBlacklistLimitOperation is true, should umbrae or gummy clones get their inventory go through a similar operation as normal inherance does:\n1. Blacklist, if InheranceBlacklist is enabled, 2. Multiply whole inventory by the current ItemMultiplier if UmbraeMultiplyOperation is enabled. 3. Limit items by the limiter list if the Limiter is enabled.");
UmbraeMultiplyOperation = ((BaseUnityPlugin)this).Config.Bind<bool>("Vengeance Configuration", "UmbraeMultiplyOperation", false, "If UmbraeMultiplyOperation and UmbraeBlacklistLimitOperation are true, should umbrae or gummy clones get their WHOLE inventory multiplied by the current ItemMultiplier.");
}
public static float ConfigToFloat(string configline)
{
if (float.TryParse(configline, out var result))
{
return result;
}
return 1f;
}
public void Awake()
{
instance = this;
RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, (Action)delegate
{
Debug.LogWarning((object)"Loading EnemiesWithItems 3.0.8...");
InitConfigFileValues();
RebuildConfig();
Debug.Log((object)"EnemiesWithItems 3.0.8 Loaded!");
});
Run.onRunStartGlobal += delegate
{
RebuildConfig();
};
}
public static void AppendEliteEquipment()
{
EliteDef[] eliteDefs = EliteCatalog.eliteDefs;
foreach (EliteDef val in eliteDefs)
{
ArrayUtils.ArrayAppend<EquipmentDef>(ref EquipmentBlackList, ref val.eliteEquipmentDef);
}
}
public static void AppendAIBlacklisted()
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
ItemIndex[] array = ((IEnumerable<ItemIndex>)(object)ItemCatalog.allItems).Where((ItemIndex thing) => ItemCatalog.GetItemDef(thing).ContainsTag((ItemTag)4)).ToArray();
for (int i = 0; i < array.Length; i++)
{
ItemDef itemDef = ItemCatalog.GetItemDef(array[i]);
if ((Object)(object)itemDef != (Object)null)
{
ArrayUtils.ArrayAppend<ItemDef>(ref ItemBlackList, ref itemDef);
}
}
}
public static void AppendWorldUniqueAndScrap()
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
ItemIndex[] array = ((IEnumerable<ItemIndex>)(object)ItemCatalog.allItems).Where((ItemIndex thing) => ItemCatalog.GetItemDef(thing).ContainsTag((ItemTag)10) || ItemCatalog.GetItemDef(thing).ContainsTag((ItemTag)9)).ToArray();
for (int i = 0; i < array.Length; i++)
{
ItemDef itemDef = ItemCatalog.GetItemDef(array[i]);
if ((Object)(object)itemDef != (Object)null)
{
ArrayUtils.ArrayAppend<ItemDef>(ref ItemBlackList, ref itemDef);
}
}
}
public void RebuildConfig()
{
AvailableItemTierDefs = (ItemTierDef[])(object)new ItemTierDef[0];
ItemTierWeights = new float[0];
ItemBlackList = (ItemDef[])(object)new ItemDef[0];
EquipmentBlackList = (EquipmentDef[])(object)new EquipmentDef[0];
LimitedItemsDictionary.Clear();
ReadConfigItemTiers();
ReadConfigItemTierLimiter();
ReadConfigEquipmentBlacklist();
ReadConfigItemBlacklist();
ReadConfigItemLimiter();
if (AutoBanEquipElite.Value)
{
AppendEliteEquipment();
}
if (AutoBanItemAIBlacklisted.Value)
{
AppendAIBlacklisted();
}
if (AutoBanItemWorldUniqueAndScrap.Value)
{
AppendWorldUniqueAndScrap();
}
PickupLists.BuildItemAndEquipmentDictionaries();
Debug.Log((object)"EnemiesWithItems config loaded.");
}
public static void ReadConfigEquipmentBlacklist()
{
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Invalid comparison between Unknown and I4
string[] array = ConfigEquipBlacklist.Value.Split(new char[2] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries);
for (int i = 0; i < array.Length; i++)
{
EquipmentDef equipmentDef = EquipmentCatalog.GetEquipmentDef(EquipmentCatalog.FindEquipmentIndex(array[i]));
if ((Object)(object)equipmentDef != (Object)null && (int)equipmentDef.equipmentIndex != -1)
{
ArrayUtils.ArrayAppend<EquipmentDef>(ref EquipmentBlackList, ref equipmentDef);
}
}
}
public static void ReadConfigItemBlacklist()
{
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Invalid comparison between Unknown and I4
string[] array = ConfigItemBlacklist.Value.Split(new char[2] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries);
for (int i = 0; i < array.Length; i++)
{
ItemDef itemDef = ItemCatalog.GetItemDef(ItemCatalog.FindItemIndex(array[i]));
if ((Object)(object)itemDef != (Object)null && (int)itemDef.itemIndex != -1)
{
ArrayUtils.ArrayAppend<ItemDef>(ref ItemBlackList, ref itemDef);
}
}
}
public static void ReadConfigItemLimiter()
{
//IL_0042: 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_0061: Invalid comparison between Unknown and I4
string[] array = ConfigItemLimiter.Value.Split(new char[2] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries);
for (int i = 0; i < array.Length; i++)
{
string[] array2 = array[i].Split(new char[1] { '-' });
if (array2.Length == 2)
{
ItemDef itemDef = ItemCatalog.GetItemDef(ItemCatalog.FindItemIndex(array2[0]));
if (!LimitedItemsDictionary.ContainsKey(itemDef) && (int)itemDef.itemIndex != -1 && int.TryParse(array2[1], out var result))
{
LimitedItemsDictionary.Add(itemDef, result);
}
}
}
}
public static void ReadConfigItemTiers()
{
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
string[] array = ConfigItemTiersEnabledWeights.Value.Split(new char[2] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries);
for (int i = 0; i < array.Length; i++)
{
string[] array2 = array[i].Split(new char[1] { '-' });
if (array2.Length == 2)
{
ItemTierDef itemTierDef = ItemTierCatalog.GetItemTierDef((ItemTier)Enum.Parse(typeof(ItemTier), array2[0]));
if (float.TryParse(array2[1], NumberStyles.Float, CultureInfo.InvariantCulture, out var result))
{
ArrayUtils.ArrayAppend<ItemTierDef>(ref AvailableItemTierDefs, ref itemTierDef);
ArrayUtils.ArrayAppend<float>(ref ItemTierWeights, ref result);
}
}
}
}
public static void ReadConfigItemTierLimiter()
{
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
ItemTierCaps = new int[AvailableItemTierDefs.Length];
string[] array = ConfigItemTiersCaps.Value.Split(new char[2] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries);
for (int i = 0; i < array.Length; i++)
{
string[] array2 = array[i].Split(new char[1] { '-' });
if (array2.Length != 2)
{
continue;
}
ItemTierDef itemTierDef = ItemTierCatalog.GetItemTierDef((ItemTier)Enum.Parse(typeof(ItemTier), array2[0]));
for (int j = 0; j < AvailableItemTierDefs.Length; j++)
{
if ((Object)(object)AvailableItemTierDefs[j] == (Object)(object)itemTierDef && int.TryParse(array2[1], out var result))
{
ItemTierCaps[j] = result;
}
}
}
}
[ConCommand(/*Could not decode attribute arguments.*/)]
private static void ShowHelp(ConCommandArgs args)
{
Debug.Log((object)"ewi_reloadconfig - Reloads the config file, server only.\newi_dumpItemBlackList - Dumps the currently loaded item blacklist.\newi_dumpEquipBlackList - Dumps the currently loaded equipment blacklist.\newi_dumpLimiterBlackList - Dumps the currently loaded item limiter dictionary.\newi_dumpAllItemTierData - Dumps all the currently loaded arrays related to ItemTiers.\newi_dumpItemPool - Dumps the currently loaded item pool, which enemies will generate items from.\newi_dumpEquipPool - Dumps the currently loaded equipment pool, which enemies will generate equipment from.\newi_midRunData - Shows data specific to the run, such as expected amount of items to generate. Only usable in a run.");
}
[ConCommand(/*Could not decode attribute arguments.*/)]
private static void ReloadConfig(ConCommandArgs args)
{
((BaseUnityPlugin)instance).Config.Reload();
instance.RebuildConfig();
Debug.LogWarning((object)"Enemies with Items config reloaded!");
}
[ConCommand(/*Could not decode attribute arguments.*/)]
private static void DumpItemBlackList(ConCommandArgs args)
{
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Invalid comparison between Unknown and I4
Debug.Log((object)("Item Blacklist has a length of " + ItemBlackList.Length));
int num = 0;
StringBuilder stringBuilder = new StringBuilder();
ItemDef[] itemBlackList = ItemBlackList;
foreach (ItemDef val in itemBlackList)
{
if ((Object)(object)val != (Object)null && (int)val.itemIndex != -1)
{
stringBuilder.Append(((object)val)?.ToString() + " | ");
num++;
}
}
Debug.Log((object)(stringBuilder.ToString() + num));
}
[ConCommand(/*Could not decode attribute arguments.*/)]
private static void DumpEquipBlackList(ConCommandArgs args)
{
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Invalid comparison between Unknown and I4
Debug.Log((object)("Equipment Blacklist has a length of " + EquipmentBlackList.Length));
int num = 0;
StringBuilder stringBuilder = new StringBuilder();
EquipmentDef[] equipmentBlackList = EquipmentBlackList;
foreach (EquipmentDef val in equipmentBlackList)
{
if ((Object)(object)val != (Object)null && (int)val.equipmentIndex != -1)
{
stringBuilder.Append(((object)val)?.ToString() + " | ");
num++;
}
}
Debug.Log((object)(stringBuilder.ToString() + num));
}
[ConCommand(/*Could not decode attribute arguments.*/)]
private static void DumpLimiterBlackList(ConCommandArgs args)
{
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Invalid comparison between Unknown and I4
Debug.Log((object)("Item Limiter dictionary has a count of " + LimitedItemsDictionary.Count));
int num = 0;
StringBuilder stringBuilder = new StringBuilder();
foreach (KeyValuePair<ItemDef, int> item in LimitedItemsDictionary)
{
if ((Object)(object)item.Key != (Object)null && (int)item.Key.itemIndex != -1)
{
stringBuilder.Append(item.ToString() + " Amnt: " + item.Value + " | ");
num++;
}
}
Debug.Log((object)(stringBuilder.ToString() + num));
}
[ConCommand(/*Could not decode attribute arguments.*/)]
private static void DumpAllItemTierData(ConCommandArgs args)
{
Debug.Log((object)("Length of available item tiers: " + AvailableItemTierDefs.Length));
Debug.Log((object)("Length of weighted item tiers (has to be the same as previous): " + ItemTierWeights.Length));
Debug.Log((object)("Length of capped item tiers: " + ItemTierCaps.Length));
int num = 0;
StringBuilder stringBuilder = new StringBuilder();
for (int i = 0; i < AvailableItemTierDefs.Length; i++)
{
stringBuilder.Append(((object)AvailableItemTierDefs[i])?.ToString() + " W: " + ItemTierWeights[i] + " C: " + ItemTierCaps[i] + " | ");
num++;
}
Debug.Log((object)(stringBuilder.ToString() + num));
}
}
internal class EWIDeathRewards : MonoBehaviour, IOnKilledServerReceiver
{
public void OnKilledServer(DamageReport damageReport)
{
//IL_0031: 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_0105: Unknown result type (might be due to invalid IL or missing references)
//IL_010a: Unknown result type (might be due to invalid IL or missing references)
//IL_011a: Unknown result type (might be due to invalid IL or missing references)
//IL_011f: Unknown result type (might be due to invalid IL or missing references)
//IL_0129: Unknown result type (might be due to invalid IL or missing references)
//IL_012e: Unknown result type (might be due to invalid IL or missing references)
//IL_0133: Unknown result type (might be due to invalid IL or missing references)
//IL_013d: Unknown result type (might be due to invalid IL or missing references)
//IL_014d: Unknown result type (might be due to invalid IL or missing references)
//IL_0157: Unknown result type (might be due to invalid IL or missing references)
//IL_015c: Unknown result type (might be due to invalid IL or missing references)
if (damageReport == null || !Object.op_Implicit((Object)(object)damageReport.attackerBody) || !Object.op_Implicit((Object)(object)damageReport.victimBody) || !TeamManager.IsTeamEnemy(damageReport.attackerBody.master.teamIndex, damageReport.victimBody.master.teamIndex))
{
return;
}
Inventory inventory = damageReport.victimBody.master.inventory;
float num = 1f;
WeightedSelection<ItemIndex> val = new WeightedSelection<ItemIndex>(8);
int i;
for (i = 0; i < EnemiesWithItems.AvailableItemTierDefs.Length; i++)
{
num = EnemiesWithItems.ItemTierWeights[i] * 5f;
ItemIndex[] array = inventory.itemAcquisitionOrder.Where((ItemIndex x) => ItemCatalog.GetItemDef(x).tier == EnemiesWithItems.AvailableItemTierDefs[i].tier).ToArray();
if (array.Length != 0)
{
val.AddChoice(Run.instance.treasureRng.NextElementUniform<ItemIndex>(array), num);
}
}
if (val.Count > 0)
{
PickupDropletController.CreatePickupDroplet(PickupCatalog.FindPickupIndex(val.Evaluate(Run.instance.treasureRng.nextNormalizedFloat)), damageReport.victimBody.transform.position + Vector3.up * 1.5f, Vector3.up * 20f + damageReport.victimBody.transform.forward * 2f);
}
}
}
internal class ItemGeneration
{
public static readonly Func<ItemIndex, bool> ewiDefaultItemCopyFilterDelegate = EwiDefaultItemCopyFilter;
public static readonly Func<ItemIndex, bool> ewiBlacklistItemCopyFilterDelegate = EwiBlacklistCopyFilter;
private static int _cachedPlayerCount;
private static int _cachedTotalItemCount;
private static int maxItemsToGenerate;
private const int maxFailedAttempts = 5;
[SystemInitializer(new Type[]
{
typeof(ItemCatalog),
typeof(PickupCatalog),
typeof(ItemTierCatalog)
})]
private static void Init()
{
Run.onServerGameOver += onServerGameOver;
PlayerCharacterMasterController.onPlayerAdded += onPlayerAdded;
PlayerCharacterMasterController.onPlayerRemoved += onPlayerRemoved;
}
private static bool EwiDefaultItemCopyFilter(ItemIndex itemIndex)
{
return true;
}
private static bool EwiBlacklistCopyFilter(ItemIndex itemIndex)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
return !EnemiesWithItems.ItemBlackList.Contains(ItemCatalog.GetItemDef(itemIndex));
}
private static void onServerGameOver(Run arg1, GameEndingDef arg2)
{
_cachedTotalItemCount = 0;
}
private static void onPlayerRemoved(PlayerCharacterMasterController obj)
{
if (NetworkServer.active)
{
((MonoBehaviour)EnemiesWithItems.instance).StartCoroutine(RebuildPlayers(obj, removing: true));
}
}
private static void onPlayerAdded(PlayerCharacterMasterController obj)
{
if (NetworkServer.active)
{
((MonoBehaviour)EnemiesWithItems.instance).StartCoroutine(RebuildPlayers(obj, removing: false));
}
}
private static IEnumerator RebuildPlayers(PlayerCharacterMasterController playerExcited, bool removing)
{
yield return (object)new WaitForEndOfFrame();
_cachedPlayerCount = PlayerCharacterMasterController.instances.Count;
if (removing)
{
playerExcited.master.inventory.onInventoryChanged -= onInventoryChanged;
}
else
{
playerExcited.master.inventory.onInventoryChanged += onInventoryChanged;
}
}
private static void onInventoryChanged()
{
_cachedTotalItemCount = 0;
_cachedTotalItemCount = GetPlayerItems();
}
private static int GetPlayerItems()
{
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: 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)
int num = 0;
for (int i = 0; i < PlayerCharacterMasterController.instances.Count; i++)
{
CharacterMaster master = PlayerCharacterMasterController.instances[i].master;
if (!Object.op_Implicit((Object)(object)master))
{
continue;
}
for (int j = 0; j < master.inventory.itemAcquisitionOrder.Count; j++)
{
ItemIndex val = master.inventory.itemAcquisitionOrder[j];
if (!ItemCatalog.GetItemDef(val).hidden)
{
num += master.inventory.GetItemCount(val);
}
}
}
return num;
}
private static ItemDef EvaluateItem()
{
WeightedSelection<ItemDef> val = new WeightedSelection<ItemDef>(8);
int i;
for (i = 0; i < EnemiesWithItems.AvailableItemTierDefs.Length; i++)
{
ItemDef val2 = Run.instance.treasureRng.NextElementUniform<ItemDef>(PickupLists.finalItemDefList.Where((ItemDef itemDefValue) => (Object)(object)itemDefValue != (Object)null && itemDefValue.tier == EnemiesWithItems.AvailableItemTierDefs[i].tier).ToList());
val.AddChoice(val2, EnemiesWithItems.ItemTierWeights[i]);
}
return val.Evaluate(Run.instance.treasureRng.nextNormalizedFloat);
}
private static EquipmentDef EvaluateEquipment()
{
EquipmentDef val = Run.instance.treasureRng.NextElementUniform<EquipmentDef>(PickupLists.finalEquipmentDefs);
WeightedSelection<EquipmentDef> obj = new WeightedSelection<EquipmentDef>(8);
obj.AddChoice(val, EnemiesWithItems.ConfigToFloat(EnemiesWithItems.EquipGenChance.Value));
obj.AddChoice((EquipmentDef)null, 1f);
return obj.Evaluate(Run.instance.treasureRng.nextNormalizedFloat);
}
public static void GenerateItemsToInventory(Inventory inventory, CharacterMaster masterToCopyFrom)
{
//IL_02d0: Unknown result type (might be due to invalid IL or missing references)
//IL_02d6: Invalid comparison between Unknown and I4
//IL_02fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0301: Invalid comparison between Unknown and I4
//IL_030a: Unknown result type (might be due to invalid IL or missing references)
//IL_0330: Unknown result type (might be due to invalid IL or missing references)
//IL_013f: Unknown result type (might be due to invalid IL or missing references)
//IL_0145: Invalid comparison between Unknown and I4
//IL_0152: Unknown result type (might be due to invalid IL or missing references)
//IL_0185: Unknown result type (might be due to invalid IL or missing references)
maxItemsToGenerate = 0;
if ((EnemiesWithItems.ConfigToFloat(EnemiesWithItems.InheritItemsChance.Value) > 0f && Random.Range(0f, 100f) <= EnemiesWithItems.ConfigToFloat(EnemiesWithItems.InheritItemsChance.Value)) || inventory.GetItemCount(Items.InvadingDoppelganger) > 0 || inventory.GetItemCount(Items.GummyCloneIdentifier) > 0)
{
CleanInventoryDependingOnConfigAndCopyFromMaster(inventory, masterToCopyFrom);
return;
}
if (EnemiesWithItems.GenerateItems.Value)
{
if (PickupLists.finalItemDefList == null || PickupLists.finalItemDefList.Length == 0)
{
return;
}
maxItemsToGenerate = (int)Math.Pow(Run.instance.stageClearCount + 1, 2.0) + _cachedTotalItemCount;
if (!EnemiesWithItems.Scaling.Value)
{
maxItemsToGenerate = (int)Math.Pow(Run.instance.stageClearCount + 1, 2.0) + _cachedTotalItemCount / _cachedPlayerCount;
}
float num = EnemiesWithItems.ConfigToFloat(EnemiesWithItems.MaxItemsToGenerateMultiplier.Value);
if (num != 1f)
{
maxItemsToGenerate = Mathf.CeilToInt((float)maxItemsToGenerate * num);
}
int num2 = 0;
int num3 = 0;
while (num3 < maxItemsToGenerate && num2 <= 5)
{
ItemDef evaluation = EvaluateItem();
if ((Object)(object)evaluation == (Object)null || (int)evaluation.itemIndex == -1 || Run.instance.IsItemExpansionLocked(evaluation.itemIndex))
{
num2++;
continue;
}
int num4 = 0;
int num5 = 0;
for (int i = 0; i < EnemiesWithItems.AvailableItemTierDefs.Length; i++)
{
num5 = EnemiesWithItems.ItemTierCaps[i];
if (inventory.GetTotalItemCountOfTier(EnemiesWithItems.AvailableItemTierDefs[i].tier) > num5 && num5 > 0)
{
num2++;
}
}
int num6 = Random.Range(1, Mathf.Max(maxItemsToGenerate - num3, 1));
float num7 = EnemiesWithItems.ConfigToFloat(EnemiesWithItems.ItemMultiplier.Value);
if (num7 != 1f && num7 != 0f)
{
num6 = Mathf.CeilToInt((float)num6 * num7);
}
if (num6 <= 0)
{
num2++;
continue;
}
if (EnemiesWithItems.LimitedItemsDictionary.ContainsKey(evaluation) && EnemiesWithItems.Limiter.Value)
{
num4 = EnemiesWithItems.LimitedItemsDictionary.Where(delegate(KeyValuePair<ItemDef, int> kvp)
{
KeyValuePair<ItemDef, int> keyValuePair2 = kvp;
return (Object)(object)keyValuePair2.Key == (Object)(object)evaluation;
}).Select(delegate(KeyValuePair<ItemDef, int> kvp)
{
KeyValuePair<ItemDef, int> keyValuePair = kvp;
return keyValuePair.Value;
}).FirstOrDefault();
if (num4 <= 0)
{
num6 = Run.instance.stageClearCount + 1;
}
}
if (num6 > num4 && num4 > 0)
{
num6 = num4;
}
if (EnemiesWithItems.FixItemMultiplierCaps.Value && num6 > maxItemsToGenerate - num3)
{
num6 = maxItemsToGenerate - num3;
}
inventory.GiveItem(evaluation, num6);
num3 += num6;
}
}
if (EnemiesWithItems.EquipItems.Value && (int)inventory.currentEquipmentIndex == -1 && PickupLists.finalEquipmentDefs != null && PickupLists.finalEquipmentDefs.Length != 0)
{
EquipmentDef val = EvaluateEquipment();
if ((Object)(object)val != (Object)null && (int)val.equipmentIndex != -1 && !Run.instance.IsEquipmentExpansionLocked(val.equipmentIndex))
{
inventory.ResetItem(Items.AutoCastEquipment);
inventory.GiveItem(Items.AutoCastEquipment, 1);
inventory.SetEquipmentIndex(val.equipmentIndex);
}
}
}
public static void LimitItems(Inventory inventory, ItemDef item, int cap)
{
if (inventory.GetItemCount(item) > cap)
{
inventory.ResetItem(item);
inventory.GiveItem(item, cap);
}
}
public static void ResetAllItemsInInventory(Inventory inventory)
{
//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_0017: Unknown result type (might be due to invalid IL or missing references)
foreach (ItemIndex item in inventory.itemAcquisitionOrder)
{
inventory.ResetItem(item);
}
}
public static void CleanInventoryDependingOnConfigAndCopyFromMaster(Inventory inventory, CharacterMaster master)
{
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_012d: Unknown result type (might be due to invalid IL or missing references)
//IL_0134: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
int itemCount = inventory.GetItemCount(Items.InvadingDoppelganger);
int itemCount2 = inventory.GetItemCount(Items.GummyCloneIdentifier);
bool flag = itemCount2 > 0 || itemCount > 0;
if ((Object)(object)master == (Object)null || (Object)(object)master.inventory == (Object)null)
{
return;
}
if (!flag)
{
foreach (ItemIndex item in inventory.itemAcquisitionOrder)
{
ItemTierDef[] availableItemTierDefs = EnemiesWithItems.AvailableItemTierDefs;
foreach (ItemTierDef val in availableItemTierDefs)
{
if (ItemCatalog.GetItemDef(item).tier == val.tier)
{
inventory.ResetItem(item);
}
}
}
inventory.AddItemsFrom(master.inventory, EnemiesWithItems.InheranceBlacklist.Value ? ewiBlacklistItemCopyFilterDelegate : ewiDefaultItemCopyFilterDelegate);
}
BlacklistAndMultiplyAndLimitInventory(inventory, flag && EnemiesWithItems.UmbraeBlacklistLimitOperation.Value);
if (EnemiesWithItems.EquipItems.Value)
{
inventory.ResetItem(Items.AutoCastEquipment);
inventory.GiveItem(Items.AutoCastEquipment, 1);
inventory.CopyEquipmentFrom(master.inventory);
EquipmentDef[] equipmentBlackList = EnemiesWithItems.EquipmentBlackList;
foreach (EquipmentDef val2 in equipmentBlackList)
{
if (inventory.GetEquipmentIndex() == val2.equipmentIndex)
{
inventory.SetEquipmentIndex((EquipmentIndex)(-1));
break;
}
}
}
if (flag)
{
if (inventory.GetItemCount(Items.InvadingDoppelganger) != itemCount)
{
inventory.ResetItem(Items.InvadingDoppelganger);
inventory.GiveItem(Items.InvadingDoppelganger, itemCount);
}
if (inventory.GetItemCount(Items.GummyCloneIdentifier) != itemCount2)
{
inventory.ResetItem(Items.GummyCloneIdentifier);
inventory.GiveItem(Items.GummyCloneIdentifier, itemCount2);
}
}
}
public static void BlacklistAndMultiplyAndLimitInventory(Inventory inventory, bool alreadyInheriting = false)
{
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: Unknown result type (might be due to invalid IL or missing references)
float num = EnemiesWithItems.ConfigToFloat(EnemiesWithItems.ItemMultiplier.Value);
ItemDef[] array = (ItemDef[])(object)new ItemDef[0];
foreach (ItemIndex item in inventory.itemAcquisitionOrder)
{
ItemDef itemDef = ItemCatalog.GetItemDef(item);
if (EnemiesWithItems.ItemBlackList.Contains(itemDef))
{
if (EnemiesWithItems.InheranceBlacklist.Value)
{
ArrayUtils.ArrayAppend<ItemDef>(ref array, ref itemDef);
}
continue;
}
ItemTierDef[] availableItemTierDefs = EnemiesWithItems.AvailableItemTierDefs;
foreach (ItemTierDef val in availableItemTierDefs)
{
if (itemDef.tier != val.tier)
{
continue;
}
int itemCount = inventory.GetItemCount(itemDef);
itemCount = ((num != 1f && !alreadyInheriting) ? itemCount : ((int)Math.Ceiling((float)itemCount * num)));
inventory.RemoveItem(itemDef, inventory.GetItemCount(itemDef) - 1);
if (EnemiesWithItems.LimitedItemsDictionary.ContainsKey(itemDef) && EnemiesWithItems.Limiter.Value)
{
itemCount = EnemiesWithItems.LimitedItemsDictionary.Where(delegate(KeyValuePair<ItemDef, int> kvp)
{
KeyValuePair<ItemDef, int> keyValuePair2 = kvp;
return (Object)(object)keyValuePair2.Key == (Object)(object)itemDef;
}).Select(delegate(KeyValuePair<ItemDef, int> kvp)
{
KeyValuePair<ItemDef, int> keyValuePair = kvp;
return keyValuePair.Value;
}).FirstOrDefault();
if (itemCount <= 0)
{
itemCount = Run.instance.stageClearCount + 1;
}
}
inventory.GiveItem(itemDef, itemCount - 1);
}
}
ItemDef[] array2 = array;
foreach (ItemDef val2 in array2)
{
inventory.ResetItem(val2);
}
}
private static IEnumerator GetTargetOfDoppelganger(Inventory inventoryToCopyTo)
{
yield return (object)new WaitForEndOfFrame();
BaseAI baseai = ((Component)inventoryToCopyTo).gameObject.GetComponent<BaseAI>();
if ((Object)(object)baseai == (Object)null || (Object)(object)baseai.currentEnemy.characterBody == (Object)null || (Object)(object)baseai.currentEnemy.characterBody.master == (Object)null)
{
yield return null;
}
if (Object.op_Implicit((Object)(object)baseai.currentEnemy.characterBody.master.playerCharacterMasterController))
{
ResetAllItemsInInventory(inventoryToCopyTo);
inventoryToCopyTo.AddItemsFrom(baseai.currentEnemy.characterBody.inventory, EnemiesWithItems.InheranceBlacklist.Value ? ewiBlacklistItemCopyFilterDelegate : ewiDefaultItemCopyFilterDelegate);
if (EnemiesWithItems.UmbraeBlacklistLimitOperation.Value)
{
BlacklistAndMultiplyAndLimitInventory(inventoryToCopyTo);
}
yield return null;
}
}
[ConCommand(/*Could not decode attribute arguments.*/)]
private static void PrintMidRunData(ConCommandArgs args)
{
if (!Object.op_Implicit((Object)(object)Run.instance))
{
Debug.LogWarning((object)"Cannot use command, you are not in a run!");
return;
}
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.AppendLine("Cached total item count: " + _cachedTotalItemCount);
stringBuilder.AppendLine("Cached player count: " + _cachedPlayerCount);
stringBuilder.Append("Max Items To Generate: " + maxItemsToGenerate);
Debug.Log((object)stringBuilder.ToString());
}
}
internal class PickupLists
{
public static ItemDef[] finalItemDefList;
public static EquipmentDef[] finalEquipmentDefs;
public static void BuildItemAndEquipmentDictionaries()
{
//IL_010a: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_0168: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
if (!((ResourceAvailability)(ref ItemCatalog.availability)).available || !((ResourceAvailability)(ref EquipmentCatalog.availability)).available)
{
Debug.LogWarning((object)"Attempted to build Enemies With Items' lists before the required catalogs were available");
return;
}
ItemDef[] array = (ItemDef[])(object)new ItemDef[ItemCatalog.itemCount];
EquipmentDef[] array2 = (EquipmentDef[])(object)new EquipmentDef[EquipmentCatalog.equipmentCount];
if ((Object)(object)Run.instance == (Object)null)
{
(from item in (IEnumerable<ItemIndex>)(object)ItemCatalog.allItems
where (int)item != -1 && !EnemiesWithItems.ItemBlackList.Contains(ItemCatalog.GetItemDef(item))
select ItemCatalog.GetItemDef(item)).ToArray().CopyTo(array, 0);
(from item in (IEnumerable<EquipmentIndex>)(object)EquipmentCatalog.allEquipment
where (int)item != -1 && !EnemiesWithItems.EquipmentBlackList.Contains(EquipmentCatalog.GetEquipmentDef(item))
select EquipmentCatalog.GetEquipmentDef(item)).ToArray().CopyTo(array2, 0);
}
else
{
(from item in (IEnumerable<ItemIndex>)(object)ItemCatalog.allItems
where (int)item != -1 && !EnemiesWithItems.ItemBlackList.Contains(ItemCatalog.GetItemDef(item)) && !Run.instance.IsItemExpansionLocked(item)
select ItemCatalog.GetItemDef(item)).ToArray().CopyTo(array, 0);
(from item in (IEnumerable<EquipmentIndex>)(object)EquipmentCatalog.allEquipment
where (int)item != -1 && !EnemiesWithItems.EquipmentBlackList.Contains(EquipmentCatalog.GetEquipmentDef(item)) && !Run.instance.IsEquipmentExpansionLocked(item)
select EquipmentCatalog.GetEquipmentDef(item)).ToArray().CopyTo(array2, 0);
}
finalItemDefList = (ItemDef[])(object)new ItemDef[array.Length];
finalEquipmentDefs = (EquipmentDef[])(object)new EquipmentDef[array2.Length];
array.CopyTo(finalItemDefList, 0);
array2.CopyTo(finalEquipmentDefs, 0);
}
[ConCommand(/*Could not decode attribute arguments.*/)]
private static void DumpItemPool(ConCommandArgs args)
{
if (finalItemDefList == null || finalItemDefList.Length == 0)
{
Debug.Log((object)"itemDefTierPair is null or empty, cannot continue.");
return;
}
Debug.Log((object)("Item Pool list has a count of " + finalItemDefList.Length));
int num = 0;
StringBuilder stringBuilder = new StringBuilder();
ItemDef[] array = finalItemDefList;
foreach (ItemDef val in array)
{
if ((Object)(object)val != (Object)null)
{
stringBuilder.Append(((object)val)?.ToString() + " | ");
num++;
}
}
Debug.Log((object)(stringBuilder.ToString() + num));
}
[ConCommand(/*Could not decode attribute arguments.*/)]
private static void DumpEquipPool(ConCommandArgs args)
{
if (finalEquipmentDefs == null || finalEquipmentDefs.Length == 0)
{
Debug.Log((object)"equipmentDefs is null or empty, cannot continue.");
return;
}
Debug.Log((object)("Equipment Pool list has a length of " + finalEquipmentDefs.Length));
int num = 0;
StringBuilder stringBuilder = new StringBuilder();
EquipmentDef[] array = finalEquipmentDefs;
foreach (EquipmentDef val in array)
{
if ((Object)(object)val != (Object)null)
{
stringBuilder.Append(((object)val)?.ToString() + " | ");
num++;
}
}
Debug.Log((object)(stringBuilder.ToString() + num));
}
}
public static class SpawnCardSubscription
{
[SystemInitializer(new Type[] { typeof(BodyCatalog) })]
public static void BaddiesItems()
{
SpawnCard.onSpawnedServerGlobal += SpawnResultItemAdder;
SpawnCard.onSpawnedServerGlobal += ItemDropperComponentAdder;
}
public static bool CanStartGivingItems(TeamIndex? teamIndexOfBodyToGive = null)
{
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
if (Run.instance.stageClearCount + 1 < EnemiesWithItems.StageReq.Value)
{
return false;
}
if (EnemiesWithItems.StageReq.Value == 6 && SceneCatalog.mostRecentSceneDef.isFinalStage && Run.instance.loopClearCount == 0)
{
return false;
}
if (teamIndexOfBodyToGive.HasValue && !TeamManager.IsTeamEnemy(teamIndexOfBodyToGive.GetValueOrDefault(), (TeamIndex)1))
{
return false;
}
return true;
}
private static void ItemDropperComponentAdder(SpawnResult obj)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: 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)
if (!obj.success)
{
return;
}
CharacterMaster val = (Object.op_Implicit((Object)(object)obj.spawnedInstance) ? obj.spawnedInstance.GetComponent<CharacterMaster>() : null);
if (!((Object)(object)val == (Object)null) && Util.CheckRoll(EnemiesWithItems.ConfigToFloat(EnemiesWithItems.DropChance.Value), 0f, (CharacterMaster)null) && CanStartGivingItems(obj.spawnRequest.teamIndexOverride))
{
GameObject bodyObject = val.GetBodyObject();
if (Object.op_Implicit((Object)(object)bodyObject))
{
bodyObject.AddComponent<EWIDeathRewards>();
}
}
}
public static void SpawnResultItemAdder(SpawnResult spawnResult)
{
//IL_0000: 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_0025: 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)
CharacterMaster val = (Object.op_Implicit((Object)(object)spawnResult.spawnedInstance) ? spawnResult.spawnedInstance.GetComponent<CharacterMaster>() : null);
if (!((Object)(object)val == (Object)null) && spawnResult.success && !((Object)(object)val.inventory == (Object)null) && CanStartGivingItems(spawnResult.spawnRequest.teamIndexOverride) && Run.instance.livingPlayerCount > 0 && !Run.instance.isGameOverServer)
{
CharacterMaster master = PlayerCharacterMasterController.instances[Run.instance.nextStageRng.RangeInt(0, Run.instance.livingPlayerCount)].master;
master = (((Object)(object)master == (Object)null) ? PlayerCharacterMasterController.instances[0].master : master);
ItemGeneration.GenerateItemsToInventory(val.inventory, master);
}
}
}