Decompiled source of CrusherMod v1.0.4

ModConcasseur.dll

Decompiled 6 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security.Permissions;
using BepInEx;
using HarmonyLib;
using Jotunn.Configs;
using Jotunn.Entities;
using Jotunn.Managers;
using Jotunn.Utils;
using UnityEngine;
using UnityEngine.UI;
using mod_data;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("JotunnModStub")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("JotunnModStub")]
[assembly: AssemblyCopyright("Copyright ©  2021")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("e3243d22-4307-4008-ba36-9f326008cde5")]
[assembly: AssemblyFileVersion("0.0.1.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.1.0")]
public class piece_recycler : MonoBehaviour, Hoverable, Interactable
{
	protected Inventory m_inventory;

	protected Animator m_animator;

	protected ZSyncAnimation m_zsync_animation;

	public float ratio = 0.5f;

	public List<ItemData> m_itemsdata => m_inventory.GetAllItems();

	public static piece_recycler SET_Prefab(string prefabname)
	{
		GameObject prefab = PrefabManager.Instance.GetPrefab(prefabname);
		prefab.AddComponent<piece_recycler>();
		return prefab.GetComponent<piece_recycler>();
	}

	public void Awake()
	{
		m_inventory = ((Component)((Component)this).transform.root.Find("Container")).GetComponent<Container>().GetInventory();
		m_animator = ((Component)((Component)this).transform.root).GetComponent<Animator>();
		m_zsync_animation = ((Component)((Component)this).transform.root).GetComponent<ZSyncAnimation>();
	}

	public string GetHoverName()
	{
		return "$piece_recycler";
	}

	public string GetHoverText()
	{
		if (m_itemsdata == null || m_itemsdata.Count == 0)
		{
			return "Rien à concasser";
		}
		return "[<color=yellow><b>E</b></color>] Concasser";
	}

	public bool Interact(Humanoid user, bool hold, bool alt)
	{
		//IL_00af: Unknown result type (might be due to invalid IL or missing references)
		if (m_itemsdata == null || m_itemsdata.Count == 0)
		{
			MessageHud.instance.ShowMessage((MessageType)2, "Concasseur vide...", 0, (Sprite)null);
			return false;
		}
		if (((Object)((AnimatorClipInfo)(ref m_animator.GetCurrentAnimatorClipInfo(0)[0])).clip).name != "Idle")
		{
			return false;
		}
		Debug.Log((object)("Interaction at" + Time.time));
		m_zsync_animation.SetTrigger("start_anim");
		((MonoBehaviour)this).Invoke("OnPress", 2.15f);
		FX.Play(FX.RefSFX.sfx_concasseur_crank, ((Component)this).transform.position);
		return true;
	}

	public bool UseItem(Humanoid user, ItemData item)
	{
		return false;
	}

	public List<(string item_name, float quantity)> GetCostList(Inventory inventory)
	{
		List<(string, float)> list = new List<(string, float)>();
		List<Recipe> recipes = ObjectDB.instance.m_recipes;
		foreach (ItemData allItem in inventory.GetAllItems())
		{
			float num = allItem.m_stack;
			float num2 = allItem.m_quality;
			string name = allItem.m_shared.m_name;
			Recipe val = allItem.m_shared.EX_GetRecipe();
			if (!((Object)(object)val != (Object)null))
			{
				continue;
			}
			float num3 = val.m_amount;
			foreach (Requirement item4 in val.m_resources.ToList())
			{
				string res_name = ((Object)item4.m_resItem).name;
				float num4 = (float)item4.m_amount * (num / num3);
				if (num2 > 1f)
				{
					num4 += (float)(int)Math.Floor(0.5f * num2 * (num2 - 1f) * (float)item4.m_amountPerLevel);
				}
				int num5 = list.FindIndex(((string item_name, float number) x) => x.item_name == res_name);
				if (num5 >= 0)
				{
					float item = list[num5].Item2;
					list[num5] = (res_name, item + num4);
				}
				else
				{
					list.Add((res_name, num4));
				}
			}
		}
		foreach (var item5 in list)
		{
			string item2 = item5.Item1;
			float item3 = item5.Item2;
			Debug.LogError((object)(item2 + " " + item3));
		}
		return list;
	}

	public void OnPress()
	{
		//IL_0025: 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_0058: 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_0071: 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_00f4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
		Debug.Log((object)("OnPress at :" + Time.time));
		FX.Play(FX.RefSFX.sfx_destruction_01, ((Component)this).transform.position);
		FX.Play(FX.RefSFX.sfx_small_explosion_02, ((Component)this).transform.position);
		FX.Play("vfx_Place_forge", ((Component)this).transform.position + new Vector3(0f, 0.5f, 0f));
		List<(string, float)> costList = GetCostList(m_inventory);
		foreach (ItemData allItem in m_inventory.GetAllItems())
		{
			if ((Object)(object)allItem.m_shared.EX_GetRecipe() == (Object)null)
			{
				_MAIN.Imanip.spawnItemMaxStack(((Object)allItem.m_dropPrefab).name, allItem.m_stack, -1, ((Component)this).transform.root.position + new Vector3(-2f, 2f, 0f));
			}
		}
		m_inventory.RemoveAll();
		foreach (var item2 in costList)
		{
			int num = (int)Math.Floor(item2.Item2 * ratio);
			string item = item2.Item1;
			GameObject prefab = PrefabManager.Instance.GetPrefab(item);
			int maxStackSize = prefab.GetComponent<ItemDrop>().m_itemData.m_shared.m_maxStackSize;
			for (int i = 0; i < num / maxStackSize; i++)
			{
				m_inventory.AddItem(prefab, maxStackSize);
			}
			m_inventory.AddItem(prefab, num % maxStackSize);
		}
	}
}
internal class _log
{
	public static void warning(string title, string msg)
	{
		Debug.LogWarning((object)(title + ":" + msg));
	}

	public static void error(string msg, string class_name)
	{
		Debug.LogError((object)("ERROR: " + msg));
		Debug.LogError((object)("POSITION: " + class_name));
	}

	public static void message(string msg, string class_name = "")
	{
		Debug.LogWarning((object)("MESSAGE: " + msg));
		if (class_name != "")
		{
			Debug.LogWarning((object)("POSITION: " + class_name));
		}
	}

	public static void local_chat_message(string msg)
	{
		((Terminal)Chat.instance).AddString("", Localization.instance.Localize(msg), (Type)1, false);
		Traverse.Create((object)Chat.instance).Field("m_hideTimer").SetValue((object)0);
	}
}
internal class FX
{
	public enum RefSFX
	{
		sfx_rune_drop,
		sfx_transaction_complete,
		sfx_coin_transfer,
		wav_button_click01,
		sfx_event_complete,
		sfx_destruction_01,
		sfx_magical_poof_01,
		sfx_quest_complete,
		sfx_zhonya_in,
		sfx_zhonya_out,
		sfx_concasseur_crank,
		sfx_small_explosion_02,
		NULL
	}

	public enum RefVFX
	{
		vfx_interact_lifmunk,
		vfx_interact_fireworks01,
		vfx_strike_01,
		vfx_zhonya,
		vfx_piece_chest_reward01_destruction
	}

	public static string[] namedmusiclist = new string[2] { "bg1_sewers", "kaldeim" };

	public static GameObject Play(RefSFX REF, Vector3? pos = null)
	{
		return Play(REF.ToString(), pos);
	}

	public static GameObject Play(RefVFX REF, Vector3? pos = null)
	{
		return Play(REF.ToString(), pos);
	}

	public static GameObject Play(string sfx_name, Vector3? pos = null)
	{
		//IL_001c: 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_0046: Unknown result type (might be due to invalid IL or missing references)
		if (!pos.HasValue)
		{
			pos = ((Component)Player.m_localPlayer).transform.position;
		}
		GameObject prefab = PrefabManager.Instance.GetPrefab(sfx_name);
		if (Object.op_Implicit((Object)(object)prefab))
		{
			return Object.Instantiate<GameObject>(prefab, pos.Value, Quaternion.identity);
		}
		_log.error("FX: '" + sfx_name + "' was not found.", "FX");
		return null;
	}

	private static EffectData GetFXData(string fx_name)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Expected O, but got Unknown
		EffectData val = new EffectData();
		val.m_prefab = PrefabManager.Instance.GetPrefab(fx_name);
		val.m_enabled = true;
		return val;
	}

	public static EffectList GetFXList(params string[] fx_names)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Expected O, but got Unknown
		EffectList val = new EffectList();
		val.m_effectPrefabs = (EffectData[])(object)new EffectData[fx_names.Length];
		for (int i = 0; i < fx_names.Length; i++)
		{
			val.m_effectPrefabs[i] = GetFXData(fx_names[i]);
		}
		return val;
	}

	public static StepEffect GetFootFXList(string name, MotionType type_motion, GroundMaterial ground_mat, params string[] fx_names)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Expected O, but got Unknown
		//IL_000f: 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_0016: 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)
		StepEffect val = new StepEffect();
		val.m_name = name;
		val.m_motionType = type_motion;
		val.m_material = ground_mat;
		val.m_effectPrefabs = (GameObject[])(object)new GameObject[fx_names.Length];
		for (int i = 0; i < fx_names.Length; i++)
		{
			val.m_effectPrefabs[i] = PrefabManager.Instance.GetPrefab(fx_names[i]);
		}
		return val;
	}

	public static void AddFXList(EffectList an_effect_list, params string[] names)
	{
		if (an_effect_list.m_effectPrefabs == null)
		{
			an_effect_list.m_effectPrefabs = (EffectData[])(object)new EffectData[0];
		}
		List<EffectData> list = an_effect_list.m_effectPrefabs.ToList();
		foreach (string fx_name in names)
		{
			list.Add(GetFXData(fx_name));
		}
		an_effect_list.m_effectPrefabs = list.ToArray();
	}
}
public static class ItemSharedData
{
	public static Recipe EX_GetRecipe(this SharedData shared_data)
	{
		List<Recipe> list = (from x in ObjectDB.instance.m_recipes
			where (Object)(object)x != (Object)null && (Object)(object)x.m_item != (Object)null
			where x.m_item.m_itemData.m_shared.m_name == shared_data.m_name
			select x).ToList();
		if (list != null && list.Count != 0)
		{
			return list[0];
		}
		return null;
	}
}
public static class PrefabManagerExtension
{
	public static T GetComp<T>(this PrefabManager man, string item_name) where T : Component
	{
		GameObject prefab = man.GetPrefab(item_name);
		if ((Object)(object)prefab == (Object)null)
		{
			return default(T);
		}
		return prefab.GetComponent<T>();
	}
}
[BepInPlugin("com.jotunn.sifmod", "Mod Concasseur", "1.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
internal class _MAIN : BaseUnityPlugin
{
	public class Imanip
	{
		public static List<GameObject> spawnItemMaxStack(string name, int quantity, int quality = -1, Vector3 position = default(Vector3))
		{
			//IL_0009: 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)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: 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_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: 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_0099: 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_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			List<GameObject> list = new List<GameObject>();
			int num = 1;
			Vector3 val = Random.insideUnitSphere * ((num == 1) ? 0f : 0.5f);
			GameObject prefab = PrefabManager.Instance.GetPrefab(name);
			ItemDrop component = prefab.GetComponent<ItemDrop>();
			int maxStackSize = component.m_itemData.m_shared.m_maxStackSize;
			int num2 = quantity / maxStackSize;
			int num3 = quantity % maxStackSize;
			Vector3 val2 = ((Component)Player.m_localPlayer).transform.position + ((Component)Player.m_localPlayer).transform.forward * 2f + Vector3.up + val;
			if (position != default(Vector3))
			{
				val2 = position;
			}
			if (num3 > 0)
			{
				GameObject val3 = Object.Instantiate<GameObject>(prefab, val2, Quaternion.identity);
				val3.GetComponent<ItemDrop>().SetStack(num3);
				val3.GetComponent<ItemDrop>().m_itemData.m_quality = quality;
				val3.GetComponent<ItemDrop>().m_autoPickup = true;
				list.Add(val3);
			}
			if (num2 > 0)
			{
				for (int i = 0; i < num2; i++)
				{
					GameObject val4 = Object.Instantiate<GameObject>(prefab, val2, Quaternion.identity);
					val4.GetComponent<ItemDrop>().SetStack(maxStackSize);
					val4.GetComponent<ItemDrop>().m_itemData.m_quality = quality;
					val4.GetComponent<ItemDrop>().m_autoPickup = true;
					list.Add(val4);
				}
			}
			return list;
		}
	}

	public static _MAIN Instance;

	public static string dir_root = Application.dataPath + "/";

	public const string PluginGUID = "com.jotunn.sifmod";

	public const string PluginName = "Mod Concasseur";

	public const string PluginVersion = "1.0";

	private readonly Harmony harmony = new Harmony("com.jotunn.sifmod");

	public static NumberFormatInfo floatinfo = new CultureInfo("en-US").NumberFormat;

	public static CustomLocalization Localizations = LocalizationManager.Instance.GetLocalization();

	public bool DEBUG_NOTMYSELF = false;

	public bool IS_ADMIN = false;

	private void Awake()
	{
		_log.warning("AWAKE", "Start of Awake function.");
		Instance = this;
		U.awake();
		PrefabManager.OnVanillaPrefabsAvailable += load_assets;
		ItemManager.OnItemsRegistered += OnItemsRegistered;
		Assembly executingAssembly = Assembly.GetExecutingAssembly();
		harmony.PatchAll(executingAssembly);
		_log.warning("AWAKE", "End of Awake function.");
	}

	private void load_assets()
	{
		//IL_0065: Unknown result type (might be due to invalid IL or missing references)
		_log.warning("ASSETS", "Start of load_assets function.");
		Data.load_assets();
		PrefabManager.OnVanillaPrefabsAvailable -= load_assets;
		((Graphic)((Component)((Component)FejdStartup.instance).transform.Find("Menu").Find("Logo").Find("LOGO")).GetComponent<Image>()).color = new Color(1f, 0f, 1f);
		_log.warning("ASSETS", "End of load_assets function.");
	}

	private void OnItemsRegistered()
	{
		Data.RecipeModification("Iron", "BlackMetal", "HelmetPadded", "ArmorPaddedCuirass", "ArmorPaddedGreaves");
	}
}
namespace mod_data;

public class U
{
	public static void awake()
	{
		Data.data_awake();
	}
}
internal class Data
{
	private static string[] bundle_names = new string[2] { "bundle_fx", "bundle_pa" };

	public static AssetBundle bundle_fx;

	public static AssetBundle bundle_pa;

	public static void data_awake()
	{
		string[] array = bundle_names;
		foreach (string bundlename in array)
		{
			load_bundle(bundlename);
		}
		load_language_pack();
	}

	public static void load_bundle(string bundlename)
	{
		typeof(Data).GetField(bundlename).SetValue(null, AssetUtils.LoadAssetBundle("LFVA-CrusherMod/" + bundlename));
		object? value = typeof(Data).GetField(bundlename).GetValue(null);
		AssetBundle val = (AssetBundle)((value is AssetBundle) ? value : null);
	}

	public static void load_language_pack()
	{
		DirectoryInfo directoryInfo = new DirectoryInfo(Paths.PluginPath + "/LFVA-CrusherMod/");
		FileInfo[] files = directoryInfo.GetFiles("*.json");
		FileInfo[] array = files;
		foreach (FileInfo fileInfo in array)
		{
			if (fileInfo.Name.Contains("DICT"))
			{
				string text = File.ReadAllText(fileInfo.FullName);
				LocalizationManager.Instance.AddJson("French", text);
			}
		}
	}

	public static void load_assets()
	{
		_log.warning("ASSETS", "Loading FX...");
		load_FX_prefabs();
		_log.warning("ASSETS", "Loading Music...");
		load_Extra_Music();
		_log.warning("ASSETS", "Loading x_common...");
		load_x_common();
	}

	public static void load_Extra_Music()
	{
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		//IL_0027: Expected O, but got Unknown
		string[] namedmusiclist = FX.namedmusiclist;
		string[] array = namedmusiclist;
		foreach (string text in array)
		{
			AudioClip val = bundle_fx.LoadAsset<AudioClip>(text);
			NamedMusic val2 = new NamedMusic();
			val2.m_name = text;
			val2.m_clips = (AudioClip[])(object)new AudioClip[1] { val };
			val2.m_alwaysFadeout = true;
			val2.m_loop = true;
			val2.m_ambientMusic = true;
			MusicMan.instance.m_music.Add(val2);
		}
	}

	public static void load_FX_prefabs()
	{
		GameObject[] array = bundle_fx.LoadAllAssets<GameObject>();
		GameObject[] array2 = array;
		foreach (GameObject val in array2)
		{
			PrefabManager.Instance.AddPrefab(val);
		}
	}

	public static void load_x_common()
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Expected O, but got Unknown
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0069: Expected O, but got Unknown
		//IL_0074: Unknown result type (might be due to invalid IL or missing references)
		//IL_007e: Expected O, but got Unknown
		//IL_0089: Unknown result type (might be due to invalid IL or missing references)
		//IL_0093: Expected O, but got Unknown
		//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b5: Expected O, but got Unknown
		PieceConfig val = new PieceConfig();
		string text = "recycler";
		val.Name = "$piece_" + text;
		val.Description = "$piece_description_" + text;
		val.PieceTable = PieceTables.Hammer;
		val.CraftingStation = CraftingStations.None;
		val.Category = PieceCategories.Misc;
		val.AddRequirement(new RequirementConfig("Stone", 50, 0, true));
		val.AddRequirement(new RequirementConfig("Flint", 10, 0, true));
		val.AddRequirement(new RequirementConfig("Copper", 10, 0, true));
		PieceManager.Instance.AddPiece(new CustomPiece(bundle_pa, "piece_" + text, false, val));
		FIX_Piece("piece_" + text);
		Debug.Log((object)"est");
		Debug.Log((object)((Object)(object)PrefabManager.Instance.GetPrefab("piece_recycler") == (Object)null));
		Debug.Log((object)((Object)null == (Object)(object)PrefabManager.Instance.GetPrefab("piece_recycler").transform.Find("Visual")));
		Debug.Log((object)((Object)(object)PrefabManager.Instance.GetPrefab("piece_recycler").transform.Find("Visual").Find("Wheels") == (Object)null));
		((Component)PrefabManager.Instance.GetPrefab("piece_recycler").transform.Find("Visual").Find("Wheels")).gameObject.AddComponent<piece_recycler>();
	}

	public static Piece FIX_Piece(string prefabname)
	{
		//IL_003b: 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_0042: 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_0046: Unknown result type (might be due to invalid IL or missing references)
		//IL_0059: Expected I4, but got Unknown
		//IL_012d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0134: Expected O, but got Unknown
		//IL_017a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0181: Expected O, but got Unknown
		Piece component = PrefabManager.Instance.GetPrefab(prefabname).GetComponent<Piece>();
		WearNTear component2 = ((Component)((Component)component).transform).GetComponent<WearNTear>();
		if ((Object)(object)component2 != (Object)null)
		{
			List<string> list = new List<string>();
			List<string> list2 = new List<string>();
			MaterialType materialType = component2.m_materialType;
			MaterialType val = materialType;
			switch ((int)val)
			{
			case 0:
				list.Add("sfx_build_hammer_wood");
				list.Add("vfx_Place_wood_wall");
				list2.Add("sfx_wood_destroyed");
				list2.Add("vfx_SawDust");
				break;
			case 1:
				list.Add("sfx_build_hammer_stone");
				list.Add("vfx_Place_wood_wall");
				list2.Add("sfx_rock_destroyed");
				list2.Add("vfx_RockDestroyed");
				break;
			case 2:
				list.Add("sfx_build_hammer_metal");
				list.Add("vfx_Place_wood_wall");
				list2.Add("sfx_metal_blocked");
				list2.Add("vfx_HitSparks");
				break;
			}
			component.m_placeEffect.m_effectPrefabs = (EffectData[])(object)new EffectData[list.Count];
			component2.m_destroyedEffect.m_effectPrefabs = (EffectData[])(object)new EffectData[list2.Count];
			for (int i = 0; i < list.Count; i++)
			{
				EffectData val2 = new EffectData();
				val2.m_prefab = PrefabManager.Instance.GetPrefab(list[i]);
				component.m_placeEffect.m_effectPrefabs[i] = val2;
			}
			for (int j = 0; j < list2.Count; j++)
			{
				EffectData val3 = new EffectData();
				val3.m_prefab = PrefabManager.Instance.GetPrefab(list[j]);
				component2.m_destroyedEffect.m_effectPrefabs[j] = val3;
			}
		}
		return component;
	}

	public static void RecipeModification(string previous_ressource_name_big, string new_ressource_name, params string[] collection_to_modify)
	{
		string name = PrefabManager.Instance.GetComp<ItemDrop>(previous_ressource_name_big).m_itemData.m_shared.m_name;
		foreach (string item_name in collection_to_modify)
		{
			Recipe recipe = ObjectDB.instance.GetRecipe(PrefabManager.Instance.GetComp<ItemDrop>(item_name).m_itemData);
			Requirement[] resources = recipe.m_resources;
			foreach (Requirement val in resources)
			{
				if (val.m_resItem.m_itemData.m_shared.m_name == name)
				{
					val.m_resItem = ObjectDB.instance.GetItemPrefab(new_ressource_name).GetComponent<ItemDrop>();
				}
			}
		}
	}
}