using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using Bifrost.ConstEnum;
using Bifrost.Cooked;
using Bifrost.ItemMiscellany;
using Bifrost.LocalizationData;
using HarmonyLib;
using ItemsAPI;
using ItemsAPI.Builders;
using ItemsAPI.Descriptors;
using ItemsAPI.Enums;
using ItemsAPI.Helpers;
using MelonLoader;
using Microsoft.CodeAnalysis;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: MelonInfo(typeof(global::ItemsAPI.ItemsAPI), "ItemsAPI", "0.1.0", "Shlygly", null)]
[assembly: MelonGame("ReLUGames", "MIMESIS")]
[assembly: MelonColor(255, 0, 128, 0)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Shlygly")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ItemsAPI")]
[assembly: AssemblyTitle("ItemsAPI")]
[assembly: NeutralResourcesLanguage("en-US")]
[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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
[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 ItemsAPI
{
public class ItemsAPI : MelonMod
{
public static ItemsAPI Instance { get; private set; }
public override void OnInitializeMelon()
{
Instance = this;
((MelonBase)this).LoggerInstance.Msg("API Ready to use !");
}
public static void Log(object msg)
{
if (msg is Exception)
{
((MelonBase)Instance).LoggerInstance.Error(msg);
}
else
{
((MelonBase)Instance).LoggerInstance.Msg(msg);
}
}
}
}
namespace ItemsAPI.Patches
{
[HarmonyPatch(typeof(Hub), "Start")]
internal static class Hub_Start
{
private static void Postfix()
{
try
{
ItemsAPI.Log("Initializing loot item builder...");
LootItemBuilder.Initialize();
int num = LootItemBuilder.Items.Length;
ItemsAPI.Log($"Adding {num} item(s)...");
int num2 = LootItemBuilder.BuildAllItems().Length;
ItemsAPI.Log($"{num2} of {num} loot item(s) added to the game !");
}
catch (Exception msg)
{
ItemsAPI.Log(msg);
}
}
}
}
namespace ItemsAPI.Descriptors
{
public class LootItemDescriptor
{
public int MasterId { get; set; }
public string LootingObjectId { get; set; }
public string PrefabAssetName { get; set; }
public string IconSpriteAssetId { get; set; }
public string PosterIconSpriteId { get; set; }
public string DefaultItemName { get; set; }
public Dictionary<string, string> LocalizedItemNames { get; }
public int MinPrice { get; set; }
public int MaxPrice { get; set; }
public int Weight { get; set; }
public KeyGroup KeyGroup { get; set; }
public string AttachSocketName { get; set; }
public PuppetHandheldState PuppetHandheldState { get; set; }
public bool IsHideWhenEmote { get; set; }
public bool ForbidChange { get; set; }
public bool IsExchangeableOnVendingMachine { get; set; }
public bool IsPreservedOnWipe { get; set; }
public bool IsHidingCamera { get; set; }
public int DefaultSpawnRate { get; set; }
public Dictionary<int, int> SpawnRateByMap { get; set; }
public LootItemDescriptor(string lootingObjectId, string prefabAssetName, string defaultItemName)
{
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
LootingObjectId = lootingObjectId;
PrefabAssetName = prefabAssetName;
IconSpriteAssetId = string.Empty;
PosterIconSpriteId = string.Empty;
DefaultItemName = defaultItemName;
LocalizedItemNames = new Dictionary<string, string>();
MinPrice = 5;
MaxPrice = 10;
Weight = 4;
KeyGroup = KeyGroup.None;
AttachSocketName = string.Empty;
PuppetHandheldState = (PuppetHandheldState)0;
IsHideWhenEmote = false;
ForbidChange = false;
IsExchangeableOnVendingMachine = true;
IsPreservedOnWipe = false;
IsHidingCamera = false;
DefaultSpawnRate = 105;
SpawnRateByMap = new Dictionary<int, int> { { 999, 0 } };
base..ctor();
}
public LootItemDescriptor AddLocalizedItemName(string lang, string name)
{
if (!LocalizationTools.GetAvailableLocalizationKeys().Contains(lang))
{
throw new ArgumentException("Invalid lang key : \"" + lang + "\" is not accepted by the game.");
}
LocalizedItemNames.Add(lang, name);
return this;
}
public LootItemDescriptor AddLocalizedItemName(IDictionary<string, string> names)
{
foreach (KeyValuePair<string, string> name in names)
{
AddLocalizedItemName(name.Key, name.Value);
}
return this;
}
public LocalizationData_MasterData GetLocalizationItemName()
{
//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_0022: Expected O, but got Unknown
LocalizationData_MasterData val = new LocalizationData_MasterData
{
key = $"STRING_ITEM_NAME_{MasterId}"
};
string[] availableLocalizationKeys = LocalizationTools.GetAvailableLocalizationKeys();
foreach (string text in availableLocalizationKeys)
{
FieldInfo field = ((object)val).GetType().GetField(text);
if (LocalizedItemNames.ContainsKey(text))
{
field.SetValue(val, LocalizedItemNames[text]);
}
else
{
field.SetValue(val, DefaultItemName);
}
}
return val;
}
public LootItemDescriptor SetMapSpawnRate(int mapId, int spawnRate)
{
if (SpawnRateByMap.ContainsKey(mapId))
{
SpawnRateByMap[mapId] = spawnRate;
}
else
{
SpawnRateByMap.Add(mapId, spawnRate);
}
return this;
}
public int GetMapSpawnRate(int mapId)
{
int value;
return SpawnRateByMap.TryGetValue(mapId, out value) ? value : DefaultSpawnRate;
}
public ItemMiscellany_MasterData GetItemMiscellany()
{
//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_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: 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_0079: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: 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)
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
//IL_00b5: Expected I4, but got Unknown
//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
//IL_0101: Unknown result type (might be due to invalid IL or missing references)
//IL_0108: Unknown result type (might be due to invalid IL or missing references)
//IL_010f: Unknown result type (might be due to invalid IL or missing references)
//IL_0116: Unknown result type (might be due to invalid IL or missing references)
//IL_011d: Unknown result type (might be due to invalid IL or missing references)
//IL_0124: Unknown result type (might be due to invalid IL or missing references)
//IL_012b: Unknown result type (might be due to invalid IL or missing references)
//IL_0136: Unknown result type (might be due to invalid IL or missing references)
//IL_0141: Unknown result type (might be due to invalid IL or missing references)
//IL_0148: Unknown result type (might be due to invalid IL or missing references)
//IL_014f: Unknown result type (might be due to invalid IL or missing references)
//IL_0163: Unknown result type (might be due to invalid IL or missing references)
//IL_016a: Unknown result type (might be due to invalid IL or missing references)
//IL_0171: Unknown result type (might be due to invalid IL or missing references)
//IL_0178: Unknown result type (might be due to invalid IL or missing references)
//IL_0184: Unknown result type (might be due to invalid IL or missing references)
//IL_018b: Unknown result type (might be due to invalid IL or missing references)
//IL_0193: Expected O, but got Unknown
return new ItemMiscellany_MasterData
{
id = MasterId,
name = $"STRING_ITEM_NAME_{MasterId}",
tool_tip_string = new List<string>(1) { $"STRING_ITEM_NAME_{MasterId}" },
looting_object_id = LootingObjectId,
price_for_sell_min = MinPrice,
price_for_sell_max = MaxPrice,
weight = Weight,
key_group = KeyGroup.ToGameString(),
item_drop_id = 0,
attach_socket_name = AttachSocketName,
puppet_handheld_state = (int)PuppetHandheldState,
forbid_change = ForbidChange,
use_vending_machine_exchange = IsExchangeableOnVendingMachine,
is_preserved_on_wipe = IsPreservedOnWipe,
accessory_group = 0,
is_hide_my_camera = IsHidingCamera,
handheld_auraskill_id = 0,
handheld_abnormal_id = 0,
spawn_fieldskill_id = 0,
spawn_fieldskill_env_condition = 0,
spawn_fieldskill_enclosure_condition = 0,
spawn_fieldskill_time_min = 0,
spawn_fieldskill_time_max = 0,
spawn_fieldskill_wait_time = 0,
fieldskill_spawn_rate = 0,
spawn_fieldskill_wait_effect = new List<string>(),
scrap_animation_state_name = string.Empty,
is_moving_scrap_animation = false,
scrap_animation_loop = false,
use_bonus_item = (PosterIconSpriteId.Length > 0),
sound_aggro_per_use = 0,
sound_aggro_in_hand_per_tick = 0,
sound_aggro_in_hand_toggle_on_per_tick = 0,
hide_item_by_emote = IsHideWhenEmote,
is_promotion_item = false,
is_promotion_item_hidden = false
};
}
}
}
namespace ItemsAPI.Helpers
{
public static class AssetTools
{
private static Material cachedMeshSlicerCrossMat;
private static GameObject cachedMeshSlicerCrashEffect;
private static GameObject cachedMeshSlicerSpawningEffect;
private static GameObject cachedMeshSlicerVanishingEffect;
private static GameObject cachedMeshSlicerFragmentSpawningEffect;
private static GameObject cachedMeshSlicerFragmentVanishingEffect;
public static void FixPrefabShaders(GameObject prefab)
{
Renderer[] componentsInChildren = prefab.GetComponentsInChildren<Renderer>(true);
foreach (Renderer val in componentsInChildren)
{
Material[] materials = val.materials;
Material[] array = materials;
foreach (Material val2 in array)
{
if (!((Object)(object)((val2 != null) ? val2.shader : null) == (Object)null))
{
Shader val3 = Shader.Find(((Object)val2.shader).name);
if ((Object)(object)val3 != (Object)null)
{
val2.shader = val3;
}
}
}
val.materials = materials;
}
}
public static void FixMeshSlicers(MMLootingObjectTable sourceTable, GameObject prefab)
{
if ((Object)(object)cachedMeshSlicerCrossMat == (Object)null || (Object)(object)cachedMeshSlicerCrashEffect == (Object)null || (Object)(object)cachedMeshSlicerSpawningEffect == (Object)null || (Object)(object)cachedMeshSlicerVanishingEffect == (Object)null)
{
MeshSlicer instance = sourceTable.rows.Where((Row row) => row != null && (Object)(object)row.prefab != (Object)null).SelectMany((Row row) => row.prefab.GetComponentsInChildren<MeshSlicer>(true)).FirstOrDefault((Func<MeshSlicer, bool>)((MeshSlicer meshSlicer) => (Object)(object)meshSlicer != (Object)null && (Object)(object)((Component)meshSlicer).gameObject != (Object)null && !((Component)meshSlicer).transform.IsChildOf(prefab.transform) && ReflectionTools.GetFieldOrProperty(meshSlicer, "crossMat") != null && ReflectionTools.GetFieldOrProperty(meshSlicer, "crashEffect") != null && ReflectionTools.GetFieldOrProperty(meshSlicer, "fragmentSpawningEffect") != null && ReflectionTools.GetFieldOrProperty(meshSlicer, "fragmentVanishingEffect") != null)) ?? throw new Exception("Could not find any MeshSlicer.");
cachedMeshSlicerCrossMat = ReflectionTools.GetFieldOrProperty<Material>(instance, "crossMat");
cachedMeshSlicerCrashEffect = ReflectionTools.GetFieldOrProperty<GameObject>(instance, "crashEffect");
cachedMeshSlicerSpawningEffect = ReflectionTools.GetFieldOrProperty<GameObject>(instance, "fragmentSpawningEffect");
cachedMeshSlicerVanishingEffect = ReflectionTools.GetFieldOrProperty<GameObject>(instance, "fragmentVanishingEffect");
}
if ((Object)(object)cachedMeshSlicerFragmentSpawningEffect != (Object)null && (Object)(object)cachedMeshSlicerFragmentVanishingEffect != (Object)null)
{
MeshSlicerFragmentScript val = sourceTable.rows.Where((Row row) => row != null && (Object)(object)row.prefab != (Object)null).SelectMany((Row row) => row.prefab.GetComponentsInChildren<MeshSlicerFragmentScript>(true)).FirstOrDefault((Func<MeshSlicerFragmentScript, bool>)((MeshSlicerFragmentScript meshSlicer) => (Object)(object)meshSlicer != (Object)null && (Object)(object)((Component)meshSlicer).gameObject != (Object)null && !((Component)meshSlicer).transform.IsChildOf(prefab.transform) && (Object)(object)meshSlicer.spawningEffect != (Object)null && (Object)(object)meshSlicer.vanishingEffect != (Object)null)) ?? throw new Exception("Could not find any MeshSlicerFragmentScript.");
cachedMeshSlicerFragmentSpawningEffect = val.spawningEffect;
cachedMeshSlicerFragmentVanishingEffect = val.vanishingEffect;
}
MeshSlicer[] componentsInChildren = prefab.GetComponentsInChildren<MeshSlicer>(true);
foreach (MeshSlicer instance2 in componentsInChildren)
{
ReflectionTools.SetFieldOrProperty(instance2, "crossMat", cachedMeshSlicerCrossMat);
ReflectionTools.SetFieldOrProperty(instance2, "crashEffect", cachedMeshSlicerCrashEffect);
ReflectionTools.SetFieldOrProperty(instance2, "fragmentSpawningEffect", cachedMeshSlicerSpawningEffect);
ReflectionTools.SetFieldOrProperty(instance2, "fragmentVanishingEffect", cachedMeshSlicerVanishingEffect);
}
MeshSlicerFragmentScript[] componentsInChildren2 = prefab.GetComponentsInChildren<MeshSlicerFragmentScript>(true);
foreach (MeshSlicerFragmentScript val2 in componentsInChildren2)
{
val2.spawningEffect = cachedMeshSlicerFragmentSpawningEffect;
val2.vanishingEffect = cachedMeshSlicerFragmentVanishingEffect;
}
}
}
public static class ReflectionTools
{
public static object GetFieldOrProperty(object instance, string name)
{
Type type = instance.GetType();
FieldInfo field = type.GetField(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
if (field != null)
{
return field.GetValue(instance);
}
PropertyInfo property = type.GetProperty(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
if (property != null)
{
return property.GetValue(instance);
}
throw new Exception("Field/property '" + name + "' not found on " + type.FullName);
}
public static T GetFieldOrProperty<T>(object instance, string name)
{
return (T)GetFieldOrProperty(instance, name);
}
public static void SetFieldOrProperty(object instance, string name, object value)
{
Type type = instance.GetType();
FieldInfo field = type.GetField(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
if (field != null)
{
field.SetValue(instance, value);
return;
}
PropertyInfo property = type.GetProperty(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
if (property != null)
{
property.SetValue(instance, value);
return;
}
throw new Exception("Field/property '" + name + "' not found on " + type.FullName);
}
}
public static class LocalizationTools
{
public static string[] GetAvailableLocalizationKeys()
{
return Enum.GetNames(typeof(Language));
}
}
}
namespace ItemsAPI.Enums
{
public enum KeyGroup
{
None,
Small,
Medium,
Large
}
public static class KeyGroupExtensions
{
public static string ToGameString(this KeyGroup keyGroup)
{
if (1 == 0)
{
}
string result = keyGroup switch
{
KeyGroup.None => "",
KeyGroup.Small => "small",
KeyGroup.Medium => "medium",
KeyGroup.Large => "large",
_ => "",
};
if (1 == 0)
{
}
return result;
}
}
}
namespace ItemsAPI.Builders
{
public static class LootItemBuilder
{
private static MMSpriteTable iconSpriteTable;
private static MMLootingObjectTable lootingObjectTable;
private static DataManager dataManager;
private static readonly Dictionary<string, AssetBundle> assets = new Dictionary<string, AssetBundle>();
private static readonly List<LootItemDescriptor> items = new List<LootItemDescriptor>();
public static LootItemDescriptor[] Items => items.ToArray();
private static int GetNewItemMasterId()
{
if ((Object)(object)dataManager == (Object)null || dataManager.ExcelDataManager == null)
{
throw new NullReferenceException("DataManager / ExcelDataManager not ready.");
}
return dataManager.ExcelDataManager.ItemInfoDict.Keys.Max() + 1;
}
public static void Initialize()
{
object instance = ReflectionTools.GetFieldOrProperty(Hub.s, "<tableman>k__BackingField") ?? throw new NullReferenceException("TableManager not ready.");
iconSpriteTable = ReflectionTools.GetFieldOrProperty<MMSpriteTable>(instance, "iconSprite") ?? throw new NullReferenceException("Icon Sprite Table not ready.");
lootingObjectTable = ReflectionTools.GetFieldOrProperty<MMLootingObjectTable>(instance, "lootingObject") ?? throw new NullReferenceException("Looting Object Table not ready.");
dataManager = ReflectionTools.GetFieldOrProperty<DataManager>(Hub.s, "<dataman>k__BackingField") ?? throw new NullReferenceException("DataManager not ready.");
if (dataManager.ExcelDataManager == null)
{
throw new NullReferenceException("ExcelDataManager not ready.");
}
}
public static void RegisterAssetBundle(AssetBundle bundle)
{
string[] allAssetNames = bundle.GetAllAssetNames();
foreach (string key in allAssetNames)
{
assets.Add(key, bundle);
}
}
public static LootItemDescriptor RegisterItem(LootItemDescriptor itemDescriptor)
{
items.Add(itemDescriptor);
return itemDescriptor;
}
public static int[] BuildAllItems()
{
//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
//IL_0101: Expected O, but got Unknown
//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
//IL_01da: Unknown result type (might be due to invalid IL or missing references)
//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
//IL_01fe: Expected O, but got Unknown
//IL_0196: Unknown result type (might be due to invalid IL or missing references)
//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
//IL_02c0: Expected O, but got Unknown
List<int> list = new List<int>();
foreach (LootItemDescriptor itemDescriptor in items.OrderBy((LootItemDescriptor item) => item.LootingObjectId))
{
int newItemMasterId = GetNewItemMasterId();
itemDescriptor.MasterId = newItemMasterId;
Texture2D val = assets[itemDescriptor.IconSpriteAssetId].LoadAsset<Texture2D>(itemDescriptor.IconSpriteAssetId) ?? throw new KeyNotFoundException("Could not load icon from bundle");
Sprite sprite = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f));
Row iconRow = new Row
{
id = $"icon_miscellnary_custom_{newItemMasterId}",
sprite = sprite
};
List<Row> list2 = ReflectionTools.GetFieldOrProperty<Row[]>(iconSpriteTable, "rows").ToList();
list2.RemoveAll((Row row) => row != null && row.id == iconRow.id);
list2.Add(iconRow);
ReflectionTools.SetFieldOrProperty(iconSpriteTable, "rows", list2.ToArray());
GameObject val2 = assets[itemDescriptor.PrefabAssetName].LoadAsset<GameObject>(itemDescriptor.PrefabAssetName) ?? throw new KeyNotFoundException("Could not load prefab from bundle.");
LootingLevelObject val3 = val2.GetComponent<LootingLevelObject>() ?? throw new MissingComponentException("Could not find LootingLevelObject component in prefab.");
val3.itemMasterID = newItemMasterId;
AssetTools.FixPrefabShaders(val2);
AssetTools.FixMeshSlicers(lootingObjectTable, val2);
Row item2 = new Row
{
id = itemDescriptor.LootingObjectId,
prefab = val2,
iconSpriteId = iconRow.id,
posterIconSpriteId = itemDescriptor.PosterIconSpriteId
};
lootingObjectTable.rows.RemoveAll((Row row) => row != null && row.id == itemDescriptor.LootingObjectId);
lootingObjectTable.rows.Add(item2);
lootingObjectTable.ClearSkinnedItemInfos();
LocalizationData_MasterData localizationItemName = itemDescriptor.GetLocalizationItemName();
ImmutableDictionary<string, LocalizationData_MasterData> value = dataManager.ExcelDataManager.LocalizationDict.Remove(localizationItemName.key).Add(localizationItemName.key, localizationItemName);
PropertyInfo propertyInfo = typeof(ExcelDataManager).GetProperty("LocalizationDict", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) ?? throw new Exception("Could not find ExcelDataManager.LocalizationDict property.");
propertyInfo.SetValue(dataManager.ExcelDataManager, value);
ItemMiscellany_MasterData itemMiscellany = itemDescriptor.GetItemMiscellany();
ItemMiscellanyInfo value2 = new ItemMiscellanyInfo(itemMiscellany);
ImmutableDictionary<int, ItemMasterInfo> value3 = dataManager.ExcelDataManager.ItemInfoDict.Remove(newItemMasterId).Add(newItemMasterId, (ItemMasterInfo)(object)value2);
PropertyInfo propertyInfo2 = typeof(ExcelDataManager).GetProperty("ItemInfoDict", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) ?? throw new Exception("Could not find ExcelDataManager.ItemInfoDict property.");
propertyInfo2.SetValue(dataManager.ExcelDataManager, value3);
if (dataManager.ExcelDataManager.GetItemInfo(newItemMasterId) == null)
{
throw new Exception("Injected item could not be read back from ExcelDataManager.");
}
list.Add(newItemMasterId);
foreach (int key in dataManager.ExcelDataManager.SpawnableItemDict.Keys)
{
SpawnableItemInfo val4 = dataManager.ExcelDataManager.SpawnableItemDict[key];
int mapSpawnRate = itemDescriptor.GetMapSpawnRate(key);
val4.MiscRateDict = val4.MiscRateDict.Add(newItemMasterId, mapSpawnRate);
}
}
return list.ToArray();
}
}
}