Decompiled source of balrond constructions v1.1.3
plugins/BalrondConstructions.dll
Decompiled 3 weeks ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Collections.Specialized; 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; using System.Security.Permissions; using System.Text; using BalrondBiomes; using BepInEx; using HarmonyLib; using LitJson2; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("BalrondConstructions")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("BalrondConstructions")] [assembly: AssemblyCopyright("Copyright © 2022")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("cde312a0-cf19-4264-8616-e1c74774beed")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] public class OfferingStation : MonoBehaviour, Hoverable, Interactable { public string m_name = "Offer station"; public string m_useItemText = "Use"; public ItemDrop m_requiredItem; public int m_requiredItemAmount = 1; public string m_statusEffectName = ""; public bool m_spawnStatusEffect = true; public GameObject m_aoePrefab; public GameObject m_spawnPoint = null; public bool m_spawnItem = false; public ItemDrop m_itemPrefab; public Transform m_itemSpawnPoint; public string m_setGlobalKey = ""; public float m_SpawnDelay = 2f; public float m_spawnOffset = 0f; [Header("Effects")] public EffectList m_fuelAddedEffects = new EffectList(); public EffectList m_spawnStartEffects = new EffectList(); public EffectList m_spawnFinishEffects = new EffectList(); public GameObject m_enabledObject; public GameObject m_disabledObject; public GameObject m_haveFuelObject; public Transform m_roofCheckPoint; public bool m_requiresRoof = false; public bool m_canBeOutside = true; private float m_updateCoverTimer; public Switch m_addWoodSwitch; public bool m_useFuel = false; public ItemDrop m_fuelItem; public int m_maxFuel = 0; public float m_secPerFuel = 2000f; public bool m_requireFire = false; public Transform[] m_fireCheckPoints; public float m_fireCheckRadius = 0.25f; private bool m_blockedSmoke; public SmokeSpawner m_smokeSpawner; public Animator[] m_animators; private ZNetView m_nview; private string m_requiredItemName; private void Awake() { m_nview = ((Component)this).GetComponent<ZNetView>(); if ((Object)(object)m_nview == (Object)null || m_nview.GetZDO() == null) { ZLog.Log((object)"Missing ZnetView Component"); return; } validateAoe(); m_requiredItemName = m_requiredItem.m_itemData.m_shared.m_name; if (Object.op_Implicit((Object)(object)m_addWoodSwitch)) { } ((MonoBehaviour)this).InvokeRepeating("UpdateOfferingStation", 1f, 1f); } private bool validateAoe() { if ((Object)(object)m_aoePrefab.GetComponent<Aoe>() == (Object)null) { ZLog.Log((object)"m_aoePrefab Missing Aoe Component"); return false; } return true; } public string GetHoverText() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) if (!PrivateArea.CheckAccess(((Component)this).transform.position, 0f, false, false)) { return Localization.instance.Localize(m_name + "\n$piece_noaccess"); } return Localization.instance.Localize(m_name + "\n[<color=yellow><b>1-8</b></color>] \n" + m_useItemText) + " " + Localization.instance.Localize(((Component)m_requiredItem).GetComponent<ItemDrop>().m_itemData.m_shared.m_name) + " amount: " + m_requiredItemAmount; } public string GetHoverName() { return m_name; } public bool Interact(Humanoid user, bool hold, bool alt) { //IL_001e: 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_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) if (hold || IsSpawnQueued()) { return false; } if (!PrivateArea.CheckAccess(((Component)this).transform.position, 0f, true, false)) { return true; } if (m_blockedSmoke) { ((Character)user).Message((MessageType)2, "Smoke blocked", 0, (Sprite)null); return false; } if (!IsActive()) { return false; } if (Spawn(GetSpawnPosition())) { ((Character)user).Message((MessageType)2, "$msg_offerdone", 0, (Sprite)null); if (Object.op_Implicit((Object)(object)m_itemSpawnPoint)) { m_fuelAddedEffects.Create(m_itemSpawnPoint.position, ((Component)this).transform.rotation, (Transform)null, 1f, -1); } } return true; } public bool UseItem(Humanoid user, ItemData item) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_0245: Unknown result type (might be due to invalid IL or missing references) //IL_0250: Unknown result type (might be due to invalid IL or missing references) if (IsSpawnQueued()) { return true; } if (!PrivateArea.CheckAccess(((Component)this).transform.position, 0f, true, false)) { return true; } if (m_blockedSmoke) { ((Character)user).Message((MessageType)2, "Smoke blocked", 0, (Sprite)null); return false; } if (!IsActive()) { return false; } if ((Object)(object)m_requiredItem == (Object)null) { return false; } if (item.m_shared.m_name == m_requiredItemName) { int num = user.GetInventory().CountItems(m_requiredItemName, -1, true); if (num < m_requiredItemAmount) { ((Character)user).Message((MessageType)2, "$msg_incompleteoffering: " + Localization.instance.Localize(m_requiredItemName) + " " + num + " / " + m_requiredItemAmount, 0, (Sprite)null); return true; } if (m_spawnStatusEffect && (Object)(object)m_aoePrefab == (Object)null) { Debug.LogWarning((object)"Missing Status Effect Prefab[AoE]"); return true; } if (m_spawnItem && (Object)(object)m_itemPrefab == (Object)null) { Debug.LogWarning((object)"Missing ItemDrop Prefab"); return true; } bool flag = false; if (((Object)(object)m_aoePrefab != (Object)null && m_spawnStatusEffect) || ((Object)(object)m_itemPrefab != (Object)null && m_spawnItem)) { flag = Spawn(GetSpawnPosition()); } if (flag) { user.GetInventory().RemoveItem(item.m_shared.m_name, m_requiredItemAmount, -1, true); ((Character)user).ShowRemovedMessage(m_requiredItem.m_itemData, m_requiredItemAmount); ((Character)user).Message((MessageType)2, "$msg_offerdone", 0, (Sprite)null); if (Object.op_Implicit((Object)(object)m_itemSpawnPoint)) { m_fuelAddedEffects.Create(m_itemSpawnPoint.position, ((Component)this).transform.rotation, (Transform)null, 1f, -1); } if (!string.IsNullOrEmpty(m_setGlobalKey)) { ZoneSystem.instance.SetGlobalKey(m_setGlobalKey); } } return flag; } ((Character)user).Message((MessageType)2, "$msg_offerwrong", 0, (Sprite)null); return true; } public bool IsActive() { return (m_maxFuel == 0 || (double)GetFuel() > 0.0) && !m_blockedSmoke; } private void UpdateGameObjectState() { bool flag = IsActive(); m_enabledObject.SetActive(flag); if (Object.op_Implicit((Object)(object)m_disabledObject)) { m_disabledObject.SetActive(!flag); } if (Object.op_Implicit((Object)(object)m_haveFuelObject)) { m_haveFuelObject.SetActive((double)GetFuel() > 0.0); } SetAnimation(flag); } private void SetAnimation(bool active) { Animator[] animators = m_animators; foreach (Animator val in animators) { if (((Component)val).gameObject.activeInHierarchy) { val.SetBool("active", active); val.SetFloat("activef", active ? 1f : 0f); } } } private float GetDeltaTime() { DateTime time = ZNet.instance.GetTime(); DateTime dateTime = new DateTime(m_nview.GetZDO().GetLong("StartTime", time.Ticks)); double totalSeconds = (time - dateTime).TotalSeconds; m_nview.GetZDO().Set("StartTime", time.Ticks); return (float)totalSeconds; } private void UpdateFuel(float dt) { if (m_useFuel) { float num = dt / m_secPerFuel; float num2 = GetFuel() - num; if ((double)num2 < 0.0) { num2 = 0f; } SetFuel(num2); } } private void RPC_AddFuel(long sender) { //IL_0034: 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) if (m_nview.IsOwner()) { SetFuel(GetFuel() + 1f); m_fuelAddedEffects.Create(((Component)this).transform.position, ((Component)this).transform.rotation, ((Component)this).transform, 1f, -1); } } private void UpdateOfferingStation() { if (m_nview.IsValid()) { } } private Vector3 GetSpawnPosition() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) return ((Object)(object)m_spawnPoint != (Object)null) ? m_spawnPoint.transform.position : ((Component)this).transform.position; } private bool Spawn(Vector3 point) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) m_spawnStartEffects.Create(point, Quaternion.identity, (Transform)null, 1f, -1); ((MonoBehaviour)this).Invoke("DelayedSpawn", m_SpawnDelay); return true; } private void UpdateSmoke() { if ((Object)(object)m_smokeSpawner != (Object)null) { m_blockedSmoke = m_smokeSpawner.IsBlocked(); } else { m_blockedSmoke = false; } } private float GetFuel() { return m_nview.GetZDO().GetFloat("fuel", 0f); } private void SetFuel(float fuel) { m_nview.GetZDO().Set("fuel", fuel); } private bool OnAddFuel(Switch sw, Humanoid user, ItemData item) { if (!m_useFuel) { ((Character)user).Message((MessageType)2, "No fuel required", 0, (Sprite)null); return false; } if (item != null && item.m_shared.m_name != m_fuelItem.m_itemData.m_shared.m_name) { ((Character)user).Message((MessageType)2, "$msg_wrongitem", 0, (Sprite)null); return false; } if (!user.GetInventory().HaveItem(m_fuelItem.m_itemData.m_shared.m_name, true)) { ((Character)user).Message((MessageType)2, "$msg_donthaveany " + m_fuelItem.m_itemData.m_shared.m_name, 0, (Sprite)null); return false; } ((Character)user).Message((MessageType)2, "$msg_added " + m_fuelItem.m_itemData.m_shared.m_name, 0, (Sprite)null); user.GetInventory().RemoveItem(m_fuelItem.m_itemData.m_shared.m_name, 1, -1, true); m_nview.InvokeRPC("AddFuel", Array.Empty<object>()); return true; } private bool IsSpawnQueued() { return ((MonoBehaviour)this).IsInvoking("DelayedSpawn"); } private void DelayedSpawn() { //IL_0013: 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_0064: 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_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) if (m_spawnStatusEffect) { Aoe component = Object.Instantiate<GameObject>(m_aoePrefab, GetSpawnPosition(), Quaternion.identity).GetComponent<Aoe>(); component.m_statusEffect = m_statusEffectName; } if (m_spawnItem) { Object.Instantiate<GameObject>(((Component)m_itemPrefab).gameObject, GetSpawnPosition(), Quaternion.identity); } m_spawnFinishEffects.Create(GetSpawnPosition(), Quaternion.identity, (Transform)null, 1f, -1); } } namespace BalrondBiomes { internal class BuildPieceList { public static string[] buildPieces = new string[141] { "wood_trim_bal", "wood_trim1_bal", "wood_trim1_90_bal", "wood_trim_90_bal", "wood_trim_26_bal", "wood_trim_45_bal", "wood_pillar4_bal", "piece_sharpstakes_big_bal", "Copper_Wall_Spikes_bal", "bg_stake_wall_bal", "leather_roof_bal", "wood_fence_bal", "woven_fence_bal", "wood_long_stair_bal", "wood_ramp_bal", "wood_railing_bal", "wood_floor4x4_bal", "woodwall4m_bal", "wood_beam4_bal", "wood_double_wall_roof_26_bal", "wood_iron_log_beam4_bal", "wood_iron_log_pole4_bal", "wood_pole4_bal", "wood_plot_1m_bal", "wood_plot_3m_bal", "wood_plot_gate_bal", "piece_swamphut_bal", "clay_stair_bal", "ClayBeam_bal", "ClayCube_bal", "ClayPole_bal", "clayr_arch_bal", "ClayWall_bal", "clay_floor_2x2_bal", "stone_trim1_90_bal", "stone_trim1_bal", "stone_trim_26_bal", "stone_trim_45_bal", "stone_trim_90_bal", "stone_trim_bal", "stone_floor_slope_bal", "stone_pillar6m1_bal", "stone_pillar6m3_bal", "stone_Wall_2x2_bal", "stone_floor4m_bal", "stone_floor_triangle_bal", "stone_long_stair_bal", "stone_pole_bal", "stone_beam_bal", "stone_railing_bal", "stone_roof27_bal", "stone_platform_bal", "stone_stair_corner_bal", "stone_stair_corner_left_bal", "stone_stair_inner_bal", "stone_stair_outer_bal", "stone_stair_railing_bal", "stone_stair_railing_left_bal", "stone_stair_railing_right_bal", "stone_arch4m_bal", "stone_stepladder_bal", "stone_1x1_enforced_bal", "vigvisir_floor_bal", "rune_floor_bal", "bronze_gate_left_bal", "iron_beam1_bal", "iron_beam_bal", "iron_beam_26_bal", "iron_beam_45_bal", "iron_pole1_bal", "iron_pole_bal", "iron_trim1_bal", "iron_trim_bal", "iron_trim_26_bal", "iron_trim_45_bal", "iron_trim_1_90_bal", "iron_trim_90_bal", "crystal_tile_floor_2x2_bal", "crystal_wall_2x2_bal", "decr_wall_half_bal", "decowall_bal", "chitin_wall_spikes_bal", "blackmarble_floor4m_bal", "blackmarble_roof27_bal", "blackmarble_stair_inner_bal", "blackmarble_stair_outer_bal", "blackmarble_stone_ladder_bal", "blackmarble_gate_bal", "blackmarble_head_big01_bal", "blackmarble_head_big02_bal", "blackmarble_creep_slope_inverted_2x2x1_bal", "blackmarble_slope1x2_inverted_bal", "blackmarble_slope1x2_bal", "blackmarble_stair_corner_bal", "blackmarble_stair_corner_left_bal", "blackmarble_1x1_enforced_bal", "blackmarble_Wall_Window_2x2_bal", "blackmarble_long_stair_bal", "blackmarble_2x2x1_bal", "spiked_copper_gate_left_bal", "spiked_copper_gate_right_bal", "dverger_gate_bal", "dvergr_secretdoor_bal", "giant_metal_gate_bal", "plate_gate_bal", "bone_fence_bal", "stonemoss_tile_floor_2x2_bal", "bush_roof_bal", "bush_roof_top_bal", "bush_roof_icorner_bal", "bush_roof_ocorner_bal", "core_wood_stair_bal", "core_wood_wall_2_bal", "core_wood_wall_4_bal", "bridge_end_bal", "bridge_floor_bal", "tiledwood_floor_2x2_bal", "hardwood_door_bal", "piece_hardwood_floor2x2_bal", "piece_hardwoodwall2m_bal", "Piece_hardwood_pillar_arch_bal", "Piece_hardwood_pillar_arch_small_bal", "Piece_hardwood_pillarbase_medium_bal", "Piece_hardwood_pillarbase_small_bal", "Piece_hardwood_pillarbase_tapered_bal", "Piece_hardwood_pillarbase_tapered_inverted_bal", "Piece_hardwood_pillarbeam_medium_bal", "Piece_hardwood_pillarbeam_small_bal", "piece_hardwood_roof_45_bal", "piece_hardwood_roof_45_arch_bal", "piece_hardwood_roof_45_arch_corner_bal", "piece_hardwood_roof_45_arch_corner2_bal", "piece_hardwood_roof_45_corner_bal", "piece_hardwood_roof_45_corner2_bal", "piece_hardwood_roof_45_top_bal", "emberwood_pillar2_bal", "emberwood_pillar4_bal", "grausten_stair_corner_bal", "grausten_stair_corner_left_bal", "grausten_stair_inner_bal", "grausten_stair_outer_bal" }; } } namespace BalrondConstructions { public class BalrondTranslator { public static Dictionary<string, Dictionary<string, string>> translations = new Dictionary<string, Dictionary<string, string>>(); public static Dictionary<string, string> getLanguage(string language) { Dictionary<string, string> result = null; try { result = translations[language]; } catch (Exception) { } return result; } } [Serializable] public class BalrondConverter : MonoBehaviour { [Serializable] public class ItemConversion { public ItemDrop m_from; public ItemDrop m_to; public int m_count; } public string m_name = "BalrondConverter"; public string prefabName = null; public string m_addOreTooltip = "Add Non-Base Wood"; public string m_emptyOreTooltip = "Pick up wood"; public Switch m_addWoodSwitch; public Switch m_addOreSwitch; public Switch m_emptyOreSwitch; public Transform m_outputPoint; public Transform m_roofCheckPoint; public GameObject m_enabledObject; public GameObject m_disabledObject; public GameObject m_haveFuelObject; public GameObject m_haveOreObject; public GameObject m_noOreObject; public Animator[] m_animators; public ItemDrop m_fuelItem; public int m_maxOre = 1; public int m_maxFuel = 1; public float m_fuelPerProduct = 0f; public float m_secPerProduct = 30f; public bool m_spawnStack = true; public bool m_requiresRoof = false; public Windmill m_windmill; public SmokeSpawner m_smokeSpawner; public float m_addOreAnimationDuration; public List<ItemConversion> m_conversion = new List<ItemConversion>(); public EffectList m_oreAddedEffects = new EffectList(); public EffectList m_fuelAddedEffects = new EffectList(); public EffectList m_produceEffects = new EffectList(); private ZNetView m_nview; private bool m_haveRoof; private bool m_blockedSmoke; private float m_addedOreTime = -1000f; private StringBuilder m_sb = new StringBuilder(); private void Awake() { //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Expected O, but got Unknown //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Expected O, but got Unknown //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Expected O, but got Unknown //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Expected O, but got Unknown //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Expected O, but got Unknown //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Expected O, but got Unknown //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Expected O, but got Unknown //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Expected O, but got Unknown m_nview = ((Component)this).GetComponent<ZNetView>(); if (!((Object)(object)m_nview == (Object)null) && m_nview.GetZDO() != null) { if (Object.op_Implicit((Object)(object)m_addOreSwitch)) { Switch addOreSwitch = m_addOreSwitch; addOreSwitch.m_onUse = (Callback)Delegate.Combine((Delegate?)(object)addOreSwitch.m_onUse, (Delegate?)new Callback(OnAddWood)); m_addOreSwitch.m_onHover = new TooltipCallback(OnHoverAddWood); } if (Object.op_Implicit((Object)(object)m_addWoodSwitch)) { Switch addWoodSwitch = m_addWoodSwitch; addWoodSwitch.m_onUse = (Callback)Delegate.Combine((Delegate?)(object)addWoodSwitch.m_onUse, (Delegate?)new Callback(OnAddPowerSource)); m_addWoodSwitch.m_onHover = new TooltipCallback(OnHoverAddPowerSource); } if (Object.op_Implicit((Object)(object)m_emptyOreSwitch)) { Switch emptyOreSwitch = m_emptyOreSwitch; emptyOreSwitch.m_onUse = (Callback)Delegate.Combine((Delegate?)(object)emptyOreSwitch.m_onUse, (Delegate?)new Callback(OnEmpty)); Switch emptyOreSwitch2 = m_emptyOreSwitch; emptyOreSwitch2.m_onHover = (TooltipCallback)Delegate.Combine((Delegate?)(object)emptyOreSwitch2.m_onHover, (Delegate?)new TooltipCallback(OnHoverEmptyOre)); } m_nview.Register<string>("AddWood", (Action<long, string>)RPC_AddWood); m_nview.Register("AddPowerSource", (Action<long>)RPC_AddPowerSource); m_nview.Register("ConverterEmptyProcessed", (Action<long>)RPC_ConverterEmptyProcessed); WearNTear component = ((Component)this).GetComponent<WearNTear>(); if (Object.op_Implicit((Object)(object)component)) { component.m_onDestroyed = (Action)Delegate.Combine(component.m_onDestroyed, new Action(OnDestroyed)); } ((MonoBehaviour)this).InvokeRepeating("UpdateBalrondConverter", 1f, 1f); } } private void DropAllItems() { //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: 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_0102: 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_012d: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: 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) SpawnProcessed(); if ((Object)(object)m_fuelItem != (Object)null) { float @float = m_nview.GetZDO().GetFloat(ZDOVars.s_fuel, 0f); if (@float > 1f) { for (int i = 0; i < (int)@float; i++) { Object.Instantiate<GameObject>(((Component)m_fuelItem).gameObject, ((Component)this).transform.position + Vector3.up + Random.insideUnitSphere * 0.3f, Quaternion.Euler(0f, (float)Random.Range(0, 360), 0f)); } } } while (GetQueueSize() > 0) { string queuedOre = GetQueuedOre(); RemoveOneOre(); ItemConversion itemConversion = GetItemConversion(queuedOre); if (itemConversion != null) { Vector3 val = ((Component)this).transform.position + Vector3.up + Random.insideUnitSphere * 0.3f; Quaternion val2 = Quaternion.Euler(0f, (float)Random.Range(0, 360), 0f); Object.Instantiate<GameObject>(((Component)itemConversion.m_from).gameObject, val, val2); } } } private void OnDestroyed() { if (m_nview.IsOwner()) { DropAllItems(); } } private bool IsItemAllowed(ItemData item) { return IsItemAllowed(((Object)item.m_dropPrefab).name); } private bool IsItemAllowed(string itemName) { foreach (ItemConversion item in m_conversion) { if (((Object)((Component)item.m_from).gameObject).name == itemName) { return true; } } return false; } private ItemData FindCookableItem(Inventory inventory) { foreach (ItemConversion item2 in m_conversion) { ItemData item = inventory.GetItem(((Object)((Component)item2.m_from).gameObject).name, -1, true); if (item != null) { return item; } } return null; } private bool OnAddWood(Switch sw, Humanoid user, ItemData item) { if (item == null) { item = FindCookableItem(user.GetInventory()); if (item == null) { ((Character)user).Message((MessageType)2, "$msg_noprocessableitems", 0, (Sprite)null); return false; } } if (!IsItemAllowed(((Object)item.m_dropPrefab).name)) { ((Character)user).Message((MessageType)2, "$msg_wontwork", 0, (Sprite)null); return false; } ZLog.Log((object)("trying to add " + item.m_shared.m_name)); if (GetQueueSize() >= m_maxOre) { ((Character)user).Message((MessageType)2, "$msg_itsfull", 0, (Sprite)null); return false; } ((Character)user).Message((MessageType)2, "$msg_added " + item.m_shared.m_name, 0, (Sprite)null); user.GetInventory().RemoveItem(item, 1); m_nview.InvokeRPC("AddWood", new object[1] { ((Object)item.m_dropPrefab).name }); m_addedOreTime = Time.time; if ((double)m_addOreAnimationDuration > 0.0) { SetAnimation(active: true); } return true; } private float GetBakeTimer() { return m_nview.GetZDO().GetFloat(ZDOVars.s_bakeTimer, 0f); } private void SetBakeTimer(float t) { m_nview.GetZDO().Set(ZDOVars.s_bakeTimer, t); } private float GetFuel() { return m_nview.GetZDO().GetFloat(ZDOVars.s_fuel, 0f); } private void SetFuel(float fuel) { m_nview.GetZDO().Set(ZDOVars.s_fuel, fuel); } private int GetQueueSize() { return m_nview.GetZDO().GetInt(ZDOVars.s_queued, 0); } private void RPC_AddWood(long sender, string name) { //IL_004d: 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) if (m_nview.IsOwner()) { if (!IsItemAllowed(name)) { ZLog.Log((object)("Item not allowed " + name)); return; } QueueOre(name); m_oreAddedEffects.Create(((Component)this).transform.position, ((Component)this).transform.rotation, (Transform)null, 1f, -1); ZLog.Log((object)("Added ore " + name)); } } private void QueueOre(string name) { int queueSize = GetQueueSize(); m_nview.GetZDO().Set("item" + queueSize, name); m_nview.GetZDO().Set(ZDOVars.s_queued, queueSize + 1, false); } private string GetQueuedOre() { return (GetQueueSize() == 0) ? "" : m_nview.GetZDO().GetString(ZDOVars.s_item0, ""); } private void RemoveOneOre() { int queueSize = GetQueueSize(); if (queueSize != 0) { for (int i = 0; i < queueSize; i++) { string @string = m_nview.GetZDO().GetString("item" + (i + 1), ""); m_nview.GetZDO().Set("item" + i, @string); } m_nview.GetZDO().Set(ZDOVars.s_queued, queueSize - 1, false); } } private bool OnEmpty(Switch sw, Humanoid user, ItemData item) { if (GetProcessedQueueSize() <= 0) { return false; } m_nview.InvokeRPC("ConverterEmptyProcessed", Array.Empty<object>()); return true; } private void RPC_ConverterEmptyProcessed(long sender) { if (m_nview.IsOwner()) { SpawnProcessed(); } } private bool OnAddPowerSource(Switch sw, Humanoid user, ItemData item) { if (item != null && item.m_shared.m_name != m_fuelItem.m_itemData.m_shared.m_name) { ((Character)user).Message((MessageType)2, "$msg_wrongitem", 0, (Sprite)null); return false; } if ((double)GetFuel() > (double)(m_maxFuel - 1)) { ((Character)user).Message((MessageType)2, "$msg_itsfull", 0, (Sprite)null); return false; } if (!user.GetInventory().HaveItem(m_fuelItem.m_itemData.m_shared.m_name, true)) { ((Character)user).Message((MessageType)2, "$msg_donthaveany " + m_fuelItem.m_itemData.m_shared.m_name, 0, (Sprite)null); return false; } ((Character)user).Message((MessageType)2, "$msg_added " + m_fuelItem.m_itemData.m_shared.m_name, 0, (Sprite)null); user.GetInventory().RemoveItem(m_fuelItem.m_itemData.m_shared.m_name, 1, -1, true); m_nview.InvokeRPC("AddPowerSource", Array.Empty<object>()); return true; } private void RPC_AddPowerSource(long sender) { //IL_0034: 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) if (m_nview.IsOwner()) { SetFuel(GetFuel() + 1f); m_fuelAddedEffects.Create(((Component)this).transform.position, ((Component)this).transform.rotation, ((Component)this).transform, 1f, -1); } } private double GetDeltaTime() { DateTime time = ZNet.instance.GetTime(); DateTime dateTime = new DateTime(m_nview.GetZDO().GetLong(ZDOVars.s_startTime, time.Ticks)); double totalSeconds = (time - dateTime).TotalSeconds; m_nview.GetZDO().Set(ZDOVars.s_startTime, time.Ticks); return totalSeconds; } private float GetAccumulator() { return m_nview.GetZDO().GetFloat(ZDOVars.s_accTime, 0f); } private void SetAccumulator(float t) { m_nview.GetZDO().Set(ZDOVars.s_accTime, t); } private void UpdateRoof() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) if (m_requiresRoof) { m_haveRoof = Cover.IsUnderRoof(m_roofCheckPoint.position); } } private void UpdateSmoke() { if ((Object)(object)m_smokeSpawner != (Object)null) { m_blockedSmoke = m_smokeSpawner.IsBlocked(); } else { m_blockedSmoke = false; } } private void UpdateBalrondConverter() { if (!m_nview.IsValid()) { return; } UpdateRoof(); UpdateSmoke(); UpdateState(); if (!m_nview.IsOwner()) { return; } double deltaTime = GetDeltaTime(); float num = GetAccumulator() + (float)deltaTime; if ((double)num > 3600.0) { num = 3600f; } float num2 = (Object.op_Implicit((Object)(object)m_windmill) ? m_windmill.GetPowerOutput() : 1f); while ((double)num >= 1.0) { num -= 1f; float fuel = GetFuel(); string queuedOre = GetQueuedOre(); if ((m_maxFuel != 0 && !((double)fuel > 0.0)) || (m_maxOre != 0 && !(queuedOre != "")) || !((double)m_secPerProduct > 0.0) || (m_requiresRoof && !m_haveRoof) || m_blockedSmoke) { continue; } float num3 = 1f * num2; if (m_maxFuel > 0) { float num4 = m_secPerProduct / m_fuelPerProduct; float num5 = fuel - num3 / num4; if ((double)num5 < 9.99999974737875E-05) { num5 = 0f; } SetFuel(num5); } if (queuedOre != "") { float num6 = GetBakeTimer() + num3; SetBakeTimer(num6); if ((double)num6 >= (double)m_secPerProduct) { SetBakeTimer(0f); RemoveOneOre(); QueueProcessed(queuedOre); } } } if (GetQueuedOre() == "" || ((double)m_maxFuel > 0.0 && (double)GetFuel() == 0.0)) { SpawnProcessed(); } SetAccumulator(num); } private void QueueProcessed(string ore) { if (!m_spawnStack) { Spawn(ore, 1); return; } string @string = m_nview.GetZDO().GetString(ZDOVars.s_spawnOre, ""); int @int = m_nview.GetZDO().GetInt(ZDOVars.s_spawnAmount, 0); if (@string.Length > 0) { if (@string != ore) { SpawnProcessed(); m_nview.GetZDO().Set(ZDOVars.s_spawnOre, ore); m_nview.GetZDO().Set(ZDOVars.s_spawnAmount, 1, false); return; } ItemConversion itemConversion = GetItemConversion(ore); int num = @int + itemConversion.m_count; if (itemConversion == null || num >= itemConversion.m_to.m_itemData.m_shared.m_maxStackSize) { Spawn(ore, num); m_nview.GetZDO().Set(ZDOVars.s_spawnOre, ""); m_nview.GetZDO().Set(ZDOVars.s_spawnAmount, 0, false); } else { m_nview.GetZDO().Set(ZDOVars.s_spawnAmount, num, false); } } else { m_nview.GetZDO().Set(ZDOVars.s_spawnOre, ore); m_nview.GetZDO().Set(ZDOVars.s_spawnAmount, 1, false); } } private void SpawnProcessed() { int @int = m_nview.GetZDO().GetInt(ZDOVars.s_spawnAmount, 0); if (@int > 0) { Spawn(m_nview.GetZDO().GetString(ZDOVars.s_spawnOre, ""), @int); m_nview.GetZDO().Set(ZDOVars.s_spawnOre, ""); m_nview.GetZDO().Set(ZDOVars.s_spawnAmount, 0, false); } } private int GetProcessedQueueSize() { return m_nview.GetZDO().GetInt(ZDOVars.s_spawnAmount, 0); } private void Spawn(string ore, int stack) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_004d: 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) ItemConversion itemConversion = GetItemConversion(ore); if (itemConversion != null) { m_produceEffects.Create(((Component)this).transform.position, ((Component)this).transform.rotation, (Transform)null, 1f, -1); Object.Instantiate<GameObject>(((Component)itemConversion.m_to).gameObject, m_outputPoint.position, m_outputPoint.rotation).GetComponent<ItemDrop>().m_itemData.m_stack = stack; } } private ItemConversion GetItemConversion(string itemName) { foreach (ItemConversion item in m_conversion) { if (((Object)((Component)item.m_from).gameObject).name == itemName) { return item; } } return null; } private void UpdateState() { bool flag = IsActive(); m_enabledObject.SetActive(flag); if (Object.op_Implicit((Object)(object)m_disabledObject)) { m_disabledObject.SetActive(!flag); } if (Object.op_Implicit((Object)(object)m_haveFuelObject)) { m_haveFuelObject.SetActive((double)GetFuel() > 0.0 && !flag); } if (Object.op_Implicit((Object)(object)m_haveOreObject)) { m_haveOreObject.SetActive(GetQueueSize() > 0); } if (Object.op_Implicit((Object)(object)m_noOreObject)) { m_noOreObject.SetActive(GetQueueSize() == 0); } if ((double)m_addOreAnimationDuration > 0.0 && (double)Time.time - (double)m_addedOreTime < (double)m_addOreAnimationDuration) { flag = true; } SetAnimation(flag); } private void SetAnimation(bool active) { Animator[] animators = m_animators; foreach (Animator val in animators) { if (((Component)val).gameObject.activeInHierarchy) { val.SetBool("active", active); val.SetFloat("activef", active ? 1f : 0f); } } } public bool IsActive() { return (m_maxFuel == 0 || (double)GetFuel() > 0.0) && (m_maxOre == 0 || GetQueueSize() > 0) && (!m_requiresRoof || m_haveRoof) && !m_blockedSmoke; } private string OnHoverAddPowerSource() { return Localization.instance.Localize($"{m_name} ({m_fuelItem.m_itemData.m_shared.m_name} {Mathf.Ceil(GetFuel())}/{m_maxFuel})\n[<color=yellow><b>$KEY_Use</b></color>] Add {m_fuelItem.m_itemData.m_shared.m_name}"); } private string OnHoverEmptyOre() { return Localization.instance.Localize($"{m_name} ({GetProcessedQueueSize()} Ready) \n[<color=yellow><b>$KEY_Use</b></color>] {m_emptyOreTooltip}"); } private string OnHoverAddWood() { m_sb.Clear(); m_sb.Append($"{m_name} ({GetQueueSize()}/{m_maxOre}) "); if (m_requiresRoof && !m_haveRoof && (double)Mathf.Sin(Time.time * 10f) > 0.0) { m_sb.Append(" <color=yellow>$piece_BalrondConverter_reqroof</color>"); } m_sb.Append("\n[<color=yellow><b>$KEY_Use</b></color>] " + m_addOreTooltip); return Localization.instance.Localize(m_sb.ToString()); } } public class DatabaseAddMethods { public void AddItems(List<GameObject> items) { foreach (GameObject item in items) { AddItem(item); } } public void AddRecipes(List<Recipe> recipes) { foreach (Recipe recipe in recipes) { AddRecipe(recipe); } } public void AddStatuseffects(List<StatusEffect> statusEffects) { foreach (StatusEffect statusEffect in statusEffects) { AddStatus(statusEffect); } } private bool IsObjectDBValid() { return (Object)(object)ObjectDB.instance != (Object)null && ObjectDB.instance.m_items.Count != 0 && ObjectDB.instance.m_recipes.Count != 0 && (Object)(object)ObjectDB.instance.GetItemPrefab("Amber") != (Object)null; } private void AddStatus(StatusEffect status) { if (!IsObjectDBValid()) { return; } if ((Object)(object)status != (Object)null) { if ((Object)(object)ObjectDB.instance.GetStatusEffect(status.m_nameHash) == (Object)null) { ObjectDB.instance.m_StatusEffects.Add(status); } else { Debug.Log((object)(Launch.projectName + ": " + ((Object)status).name + " - Status already in the game")); } } else { Debug.LogError((object)(Launch.projectName + ": " + ((Object)status).name + " - Status not found")); } } private void AddRecipe(Recipe recipe) { if (!IsObjectDBValid()) { return; } if ((Object)(object)recipe != (Object)null) { if ((Object)(object)ObjectDB.instance.m_recipes.Find((Recipe x) => ((Object)x).name == ((Object)recipe).name) == (Object)null) { if ((Object)(object)recipe.m_item != (Object)null) { ObjectDB.instance.m_recipes.Add(recipe); } } else { Debug.Log((object)(Launch.projectName + ": " + ((Object)recipe).name + " - Recipe with this name already in the Game")); } } else { Debug.LogError((object)(Launch.projectName + ": " + ((Object)recipe).name + " - Recipe not found")); } } private void AddItem(GameObject newPrefab) { if (!IsObjectDBValid()) { return; } ItemDrop component = newPrefab.GetComponent<ItemDrop>(); if ((Object)(object)component != (Object)null) { if ((Object)(object)ObjectDB.instance.GetItemPrefab(((Object)newPrefab).name) == (Object)null) { ObjectDB.instance.m_items.Add(newPrefab); Dictionary<int, GameObject> dictionary = (Dictionary<int, GameObject>)typeof(ObjectDB).GetField("m_itemByHash", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(ObjectDB.instance); dictionary[((Object)newPrefab).name.GetHashCode()] = newPrefab; } else { Debug.LogWarning((object)(Launch.projectName + ": " + ((Object)newPrefab).name + " - ItemDrop already exist")); } } else { Debug.LogError((object)(Launch.projectName + ": " + ((Object)newPrefab).name + " - ItemDrop not found on prefab")); } } } public class FxReplacment { private List<GameObject> allPrefabs; private string projectName = "[BalrondBiomes]"; public void setInstance(List<GameObject> gameObjects) { allPrefabs = gameObjects; } public void ReplaceOnObject(GameObject gameObject) { if ((Object)(object)gameObject == (Object)null) { return; } SpawnArea component = gameObject.GetComponent<SpawnArea>(); if ((Object)(object)component != (Object)null) { EffectList spawnEffects = component.m_spawnEffects; if (spawnEffects != null) { findEffectsAndChange(spawnEffects.m_effectPrefabs); } } Destructible component2 = gameObject.GetComponent<Destructible>(); if ((Object)(object)component2 != (Object)null) { EffectList hitEffect = component2.m_hitEffect; if (hitEffect != null) { findEffectsAndChange(hitEffect.m_effectPrefabs); } EffectList destroyedEffect = component2.m_destroyedEffect; if (destroyedEffect != null) { findEffectsAndChange(destroyedEffect.m_effectPrefabs); } } Projectile component3 = gameObject.GetComponent<Projectile>(); if ((Object)(object)component3 != (Object)null) { EffectList hitEffects = component3.m_hitEffects; if (hitEffects != null) { findEffectsAndChange(hitEffects.m_effectPrefabs); } EffectList hitWaterEffects = component3.m_hitWaterEffects; if (hitWaterEffects != null) { findEffectsAndChange(hitWaterEffects.m_effectPrefabs); } EffectList spawnOnHitEffects = component3.m_spawnOnHitEffects; if (spawnOnHitEffects != null) { findEffectsAndChange(spawnOnHitEffects.m_effectPrefabs); } } } public void ReplaceOnVegetation(GameObject gameObject) { Pickable component = gameObject.GetComponent<Pickable>(); if ((Object)(object)component != (Object)null) { fixPlant(component); } Destructible component2 = gameObject.GetComponent<Destructible>(); if ((Object)(object)component2 != (Object)null) { fixPDestructable(component2); } MineRock5 component3 = gameObject.GetComponent<MineRock5>(); if ((Object)(object)component3 != (Object)null) { fixMineRock5(component3); } MineRock component4 = gameObject.GetComponent<MineRock>(); if ((Object)(object)component4 != (Object)null) { fixMineRock(component4); } } private void fixPlant(Pickable pickable) { EffectList pickEffector = pickable.m_pickEffector; if (pickEffector != null) { findEffectsAndChange(pickEffector.m_effectPrefabs); } } private void fixPDestructable(Destructible minerock5) { EffectList hitEffect = minerock5.m_hitEffect; if (hitEffect != null) { findEffectsAndChange(hitEffect.m_effectPrefabs); } EffectList destroyedEffect = minerock5.m_destroyedEffect; if (destroyedEffect != null) { findEffectsAndChange(destroyedEffect.m_effectPrefabs); } } private void fixMineRock5(MineRock5 minerock5) { EffectList hitEffect = minerock5.m_hitEffect; if (hitEffect != null) { findEffectsAndChange(hitEffect.m_effectPrefabs); } EffectList destroyedEffect = minerock5.m_destroyedEffect; if (destroyedEffect != null) { findEffectsAndChange(destroyedEffect.m_effectPrefabs); } } private void fixMineRock(MineRock minerock5) { EffectList hitEffect = minerock5.m_hitEffect; if (hitEffect != null) { findEffectsAndChange(hitEffect.m_effectPrefabs); } EffectList destroyedEffect = minerock5.m_destroyedEffect; if (destroyedEffect != null) { findEffectsAndChange(destroyedEffect.m_effectPrefabs); } } public void ReplaceOnMonster(GameObject gameObject) { if ((Object)(object)gameObject == (Object)null) { Debug.LogWarning((object)(projectName + ":: GameObject not found")); return; } Humanoid component = gameObject.GetComponent<Humanoid>(); if ((Object)(object)component == (Object)null) { Debug.LogWarning((object)(projectName + ":: GameObject not found")); return; } EffectList dropEffects = component.m_dropEffects; if (dropEffects != null) { findEffectsAndChange(dropEffects.m_effectPrefabs); } EffectList backstabHitEffects = ((Character)component).m_backstabHitEffects; if (backstabHitEffects != null) { findEffectsAndChange(backstabHitEffects.m_effectPrefabs); } EffectList consumeItemEffects = component.m_consumeItemEffects; if (consumeItemEffects != null) { findEffectsAndChange(consumeItemEffects.m_effectPrefabs); } EffectList critHitEffects = ((Character)component).m_critHitEffects; if (critHitEffects != null) { findEffectsAndChange(critHitEffects.m_effectPrefabs); } EffectList deathEffects = ((Character)component).m_deathEffects; if (deathEffects != null) { findEffectsAndChange(deathEffects.m_effectPrefabs); } EffectList hitEffects = ((Character)component).m_hitEffects; if (hitEffects != null) { findEffectsAndChange(hitEffects.m_effectPrefabs); } EffectList jumpEffects = ((Character)component).m_jumpEffects; if (jumpEffects != null) { findEffectsAndChange(jumpEffects.m_effectPrefabs); } EffectList perfectBlockEffect = component.m_perfectBlockEffect; if (perfectBlockEffect != null) { findEffectsAndChange(perfectBlockEffect.m_effectPrefabs); } EffectList pickupEffects = component.m_pickupEffects; if (pickupEffects != null) { findEffectsAndChange(pickupEffects.m_effectPrefabs); } EffectList slideEffects = ((Character)component).m_slideEffects; if (slideEffects != null) { findEffectsAndChange(slideEffects.m_effectPrefabs); } EffectList tarEffects = ((Character)component).m_tarEffects; if (tarEffects != null) { findEffectsAndChange(tarEffects.m_effectPrefabs); } EffectList waterEffects = ((Character)component).m_waterEffects; if (waterEffects != null) { findEffectsAndChange(waterEffects.m_effectPrefabs); } FootStep component2 = gameObject.GetComponent<FootStep>(); if (!((Object)(object)component2 != (Object)null)) { return; } List<StepEffect> effects = component2.m_effects; foreach (StepEffect item in effects) { GameObject[] effectPrefabs = item.m_effectPrefabs; List<GameObject> list = new List<GameObject>(); list.AddRange(effectPrefabs); for (int i = 0; i < list.Count; i++) { if ((Object)(object)list[i] != (Object)null) { string name = ((Object)list[i]).name; GameObject val = allPrefabs.Find((GameObject x) => ((Object)x).name == name); if (!((Object)(object)val == (Object)null)) { list[i] = val; } } } } } public void ReplaceOnItem(GameObject gameObject) { if ((Object)(object)gameObject == (Object)null) { return; } ItemDrop component = gameObject.GetComponent<ItemDrop>(); if (!((Object)(object)component == (Object)null)) { EffectList hitEffect = component.m_itemData.m_shared.m_hitEffect; if (hitEffect != null) { findEffectsAndChange(hitEffect.m_effectPrefabs); } EffectList hitTerrainEffect = component.m_itemData.m_shared.m_hitTerrainEffect; if (hitTerrainEffect != null) { findEffectsAndChange(hitTerrainEffect.m_effectPrefabs); } EffectList holdStartEffect = component.m_itemData.m_shared.m_holdStartEffect; if (holdStartEffect != null) { findEffectsAndChange(holdStartEffect.m_effectPrefabs); } EffectList trailStartEffect = component.m_itemData.m_shared.m_trailStartEffect; if (trailStartEffect != null) { findEffectsAndChange(trailStartEffect.m_effectPrefabs); } EffectList blockEffect = component.m_itemData.m_shared.m_blockEffect; if (blockEffect != null) { findEffectsAndChange(blockEffect.m_effectPrefabs); } } } public void ReplaceFxOnPiece(GameObject gameObject) { if ((Object)(object)gameObject == (Object)null) { return; } Piece component = gameObject.GetComponent<Piece>(); if ((Object)(object)component != (Object)null) { EffectList placeEffect = component.m_placeEffect; if (placeEffect != null) { findEffectsAndChange(placeEffect.m_effectPrefabs); } } WearNTear component2 = gameObject.GetComponent<WearNTear>(); if ((Object)(object)component2 != (Object)null) { EffectList hitEffect = component2.m_hitEffect; if (hitEffect != null) { findEffectsAndChange(hitEffect.m_effectPrefabs); } } } private void findEffectsAndChange(EffectData[] effects) { if (effects == null || effects.Length == 0) { return; } foreach (EffectData val in effects) { if ((Object)(object)val.m_prefab != (Object)null) { string name = ((Object)val.m_prefab).name; GameObject val2 = allPrefabs.Find((GameObject x) => ((Object)x).name == name); if (!((Object)(object)val2 == (Object)null)) { val.m_prefab = val2; } } } } } public class ModResourceLoader { public AssetBundle assetBundle; public List<GameObject> buildPrefabs = new List<GameObject>(); public List<GameObject> plantPrefabs = new List<GameObject>(); public List<GameObject> itemPrefabs = new List<GameObject>(); public List<GameObject> monsterPrefabs = new List<GameObject>(); public List<GameObject> vegetationPrefabs = new List<GameObject>(); public List<GameObject> clutterPrefabs = new List<GameObject>(); public List<GameObject> locationPrefabs = new List<GameObject>(); public List<GameObject> roomPrefabs = new List<GameObject>(); public List<GameObject> vfxPrefabs = new List<GameObject>(); public List<MappedEffectList> instructions = new List<MappedEffectList>(); public FxReplacment fxReplacment = null; public List<Recipe> recipes = new List<Recipe>(); public List<StatusEffect> statusEffects = new List<StatusEffect>(); public StatusEffect newBarleyStatus = null; public ShaderReplacment shaderReplacment = new ShaderReplacment(); public Sprite newLogo = null; public void loadAssets() { assetBundle = GetAssetBundleFromResources("balrondconstructions"); string basePath = "Assets/Custom/BalrondConstructions/"; loadPieces(basePath); loadOther(basePath); loadInstructions(basePath); } public void AddPrefabsToZnetScene(ZNetScene zNetScene) { zNetScene.m_prefabs.AddRange(vegetationPrefabs); foreach (GameObject gm in itemPrefabs) { GameObject val = zNetScene.m_prefabs.Find((GameObject x) => ((Object)x).name == ((Object)gm).name); if ((Object)(object)val == (Object)null) { zNetScene.m_prefabs.Add(gm); } else { Debug.LogWarning((object)("Object exists: " + ((Object)gm).name)); } } foreach (GameObject gm2 in buildPrefabs) { GameObject val2 = zNetScene.m_prefabs.Find((GameObject x) => ((Object)x).name == ((Object)gm2).name); if ((Object)(object)val2 == (Object)null) { zNetScene.m_prefabs.Add(gm2); } else { Debug.LogWarning((object)("Object exists: " + ((Object)gm2).name)); } } foreach (GameObject gm3 in vfxPrefabs) { GameObject val3 = zNetScene.m_prefabs.Find((GameObject x) => ((Object)x).name == ((Object)gm3).name); if ((Object)(object)val3 == (Object)null) { zNetScene.m_prefabs.Add(gm3); } else { Debug.LogWarning((object)("Object exists: " + ((Object)gm3).name)); } } zNetScene.m_prefabs.RemoveAll((GameObject x) => (Object)(object)x == (Object)null); addPlantstoCultivator(zNetScene); setupBuildPiecesList(zNetScene); } private void setupBuildPiecesList(ZNetScene zNetScene) { string[] array = new string[4] { "Hammer", "HammerIron", "HammerDverger", "HammerBlackmetal" }; GameObject val = zNetScene.m_prefabs.Find((GameObject x) => ((Object)x).name == "Hammer"); PieceTable buildPieces = val.GetComponent<ItemDrop>().m_itemData.m_shared.m_buildPieces; string[] array2 = array; foreach (string name in array2) { addBuildpiecesToOtherHammer(name, buildPieces, zNetScene); } List<GameObject> pieces = buildPieces.m_pieces; foreach (GameObject buildPrefab in buildPrefabs) { setupRavenGuide(buildPrefab, zNetScene.m_prefabs); AddToBuildList(buildPrefab, pieces); } } private void addBuildpiecesToOtherHammer(string name, PieceTable pieceTable, ZNetScene zNetScene) { GameObject val = zNetScene.m_prefabs.Find((GameObject x) => ((Object)x).name == name); if (!((Object)(object)val == (Object)null)) { val.GetComponent<ItemDrop>().m_itemData.m_shared.m_buildPieces = pieceTable; } } public void setupRavenGuide(GameObject gameObject, List<GameObject> gameObjects) { GameObject val = null; Transform val2 = gameObject.transform.Find("GuidePoint"); if ((Object)(object)val2 == (Object)null) { return; } GameObject val3 = gameObjects.Find((GameObject x) => ((Object)x).name == "piece_workbench"); if ((Object)(object)val3 != (Object)null) { GameObject gameObject2 = ((Component)val3.transform.Find("GuidePoint")).gameObject; if ((Object)(object)gameObject2 != (Object)null) { GuidePoint component = gameObject2.GetComponent<GuidePoint>(); if ((Object)(object)component != (Object)null) { val = component.m_ravenPrefab; } } } if ((Object)(object)val == (Object)null) { Debug.LogWarning((object)"Ravens not found"); } else { ((Component)val2).GetComponent<GuidePoint>().m_ravenPrefab = val; } } public void setupBuildPiecesListDB() { GameObject val = ObjectDB.instance.m_items.Find((GameObject x) => ((Object)x).name == "Hammer"); List<GameObject> pieces = val.GetComponent<ItemDrop>().m_itemData.m_shared.m_buildPieces.m_pieces; foreach (GameObject buildPrefab in buildPrefabs) { AddToBuildList(buildPrefab, pieces); } } private void AddToBuildList(GameObject prefab, List<GameObject> buildPieces) { if ((Object)(object)buildPieces.Find((GameObject x) => ((Object)x).name == ((Object)prefab).name) == (Object)null) { buildPieces.Add(prefab); } } private void addPlantstoCultivator(ZNetScene zNetScene) { GameObject val = zNetScene.m_prefabs.Find((GameObject x) => ((Object)x).name == "Cultivator"); PieceTable buildPieces = val.GetComponent<ItemDrop>().m_itemData.m_shared.m_buildPieces; List<GameObject> pieces = buildPieces.m_pieces; foreach (GameObject plantPrefab in plantPrefabs) { pieces.Add(plantPrefab); } } public void FixAllFx(FxReplacment fxReplacment) { this.fxReplacment = fxReplacment; fixBuildPiecesFX(); fixVegetationFX(); fixItemFX(); fixMonsterFX(); fixOtherFX(); } private void loadStatusFromPotion() { string[] source = new string[0]; foreach (GameObject itemPrefab in itemPrefabs) { if (source.Contains(((Object)itemPrefab).name)) { ItemDrop component = itemPrefab.GetComponent<ItemDrop>(); SharedData shared = component.m_itemData.m_shared; checkForStatus(shared.m_consumeStatusEffect); checkForStatus(shared.m_setStatusEffect); checkForStatus(shared.m_equipStatusEffect); checkForStatus(shared.m_attackStatusEffect); } } Debug.Log((object)("Loaded Potion status: " + statusEffects.Count)); } private void checkForStatus(StatusEffect status) { if ((Object)(object)status != (Object)null) { statusEffects.Add(status); } } private void fixVegetationFX() { foreach (GameObject vegetationPrefab in vegetationPrefabs) { fxReplacment.ReplaceOnVegetation(vegetationPrefab); } } private void fixBuildPiecesFX() { foreach (GameObject buildPrefab in buildPrefabs) { fxReplacment.ReplaceFxOnPiece(buildPrefab); } } private void fixItemFX() { foreach (GameObject itemPrefab in itemPrefabs) { fxReplacment.ReplaceOnItem(itemPrefab); } } private void fixMonsterFX() { foreach (GameObject monsterPrefab in monsterPrefabs) { fxReplacment.ReplaceOnMonster(monsterPrefab); } } private void fixOtherFX() { foreach (GameObject vfxPrefab in vfxPrefabs) { fxReplacment.ReplaceOnObject(vfxPrefab); } } private AssetBundle GetAssetBundleFromResources(string filename) { Assembly executingAssembly = Assembly.GetExecutingAssembly(); string name = executingAssembly.GetManifestResourceNames().Single((string str) => str.EndsWith(filename)); using Stream stream = executingAssembly.GetManifestResourceStream(name); return AssetBundle.LoadFromStream(stream); } private void loadPlants(string basePath) { string text = basePath + "Plants/"; string[] array = new string[0]; string[] array2 = array; foreach (string text2 in array2) { GameObject val = assetBundle.LoadAsset<GameObject>(text + text2 + ".prefab"); if ((Object)(object)val == (Object)null) { Debug.LogWarning((object)("Could not find plant with name: " + text2)); continue; } ShaderReplacment.Replace(val); plantPrefabs.Add(val); } } private void loadPieces(string basePath) { string text = basePath + "Pieces/"; string[] buildPieces = BuildPieceList.buildPieces; string[] array = buildPieces; foreach (string text2 in array) { GameObject val = assetBundle.LoadAsset<GameObject>(text + text2 + ".prefab"); if ((Object)(object)val == (Object)null) { Debug.LogWarning((object)("Could not find piece with name: " + text2)); continue; } ShaderReplacment.Replace(val); buildPrefabs.Add(val); } } private void loadInstructions(string basePath) { string text = basePath + "Instructions/"; string[] buildPieces = BuildPieceList.buildPieces; } private void loadItems(string basePath) { string text = basePath + "Items/"; string[] array = new string[0]; string[] array2 = array; foreach (string text2 in array2) { GameObject val = assetBundle.LoadAsset<GameObject>(text + text2 + ".prefab"); if ((Object)(object)val == (Object)null) { Debug.LogWarning((object)("Could not find item with name: " + text2)); continue; } ShaderReplacment.Replace(val); itemPrefabs.Add(val); } } private void loadVegetation(string basePath) { string text = basePath + "Vegetation/"; string[] array = new string[0]; string[] array2 = array; foreach (string text2 in array2) { GameObject val = assetBundle.LoadAsset<GameObject>(text + text2 + ".prefab"); if ((Object)(object)val == (Object)null) { Debug.LogWarning((object)("Could not find vegegation with name: " + text2)); continue; } ShaderReplacment.Replace(val); vegetationPrefabs.Add(val); } } private void loadOther(string basePath) { string text = basePath + "Other/"; string[] array = new string[1] { "sfx_queendoor_open1" }; string[] array2 = array; foreach (string text2 in array2) { GameObject val = assetBundle.LoadAsset<GameObject>(text + text2 + ".prefab"); if ((Object)(object)val == (Object)null) { Debug.LogWarning((object)("Could not find object with name: " + text2)); continue; } ShaderReplacment.Replace(val); vfxPrefabs.Add(val); } } public void setupBlessedStone(ZNetScene zNetScene) { GameObject val = zNetScene.m_prefabs.Find((GameObject x) => ((Object)x).name == "Blessed_Stone_Odin"); OfferingStation offeringStation = val.AddComponent<OfferingStation>(); offeringStation.m_aoePrefab = zNetScene.m_prefabs.Find((GameObject x) => ((Object)x).name == "Blessing_Aoe"); offeringStation.m_canBeOutside = true; offeringStation.m_requireFire = false; offeringStation.m_requiresRoof = false; offeringStation.m_requiredItem = zNetScene.m_prefabs.Find((GameObject x) => ((Object)x).name == "Iron").GetComponent<ItemDrop>(); offeringStation.m_requiredItemAmount = 2; offeringStation.m_spawnPoint = ((Component)val.transform.Find("spawnpoint")).gameObject; List<EffectData> list = new List<EffectData>(); list.AddRange(offeringStation.m_fuelAddedEffects.m_effectPrefabs); list.Add(createEffectListEffectData(zNetScene.m_prefabs.Find((GameObject x) => ((Object)x).name == "vfx_pray_accepted"))); offeringStation.m_fuelAddedEffects.m_effectPrefabs = list.ToArray(); List<EffectData> list2 = new List<EffectData>(); list2.AddRange(offeringStation.m_spawnFinishEffects.m_effectPrefabs); list2.Add(createEffectListEffectData(zNetScene.m_prefabs.Find((GameObject x) => ((Object)x).name == "fx_Blessing"))); offeringStation.m_spawnFinishEffects.m_effectPrefabs = list2.ToArray(); } public EffectData createEffectListEffectData(GameObject prefab) { //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 = prefab; val.m_variant = -1; val.m_enabled = true; return val; } public void setIronHook(ZNetScene zNetScene) { //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Expected O, but got Unknown //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Expected O, but got Unknown GameObject val = zNetScene.m_prefabs.Find((GameObject x) => ((Object)x).name == "piece_cookingstation_iron"); GameObject val2 = zNetScene.m_prefabs.Find((GameObject x) => ((Object)x).name == "piece_cookingstation"); ItemConversion val3 = new ItemConversion(); val3.m_from = zNetScene.m_prefabs.Find((GameObject x) => ((Object)x).name == "BearMeat").GetComponent<ItemDrop>(); val3.m_to = zNetScene.m_prefabs.Find((GameObject x) => ((Object)x).name == "BearMeatCooked").GetComponent<ItemDrop>(); val3.m_cookTime = 40f; ItemConversion val4 = new ItemConversion(); val4.m_from = zNetScene.m_prefabs.Find((GameObject x) => ((Object)x).name == "Potato").GetComponent<ItemDrop>(); val4.m_to = zNetScene.m_prefabs.Find((GameObject x) => ((Object)x).name == "PotatoFried").GetComponent<ItemDrop>(); val4.m_cookTime = 30f; if ((Object)(object)val != (Object)null) { CookingStation component = val.GetComponent<CookingStation>(); component.m_conversion.Add(val4); component.m_conversion.Add(val3); } if ((Object)(object)val2 != (Object)null) { CookingStation component2 = val2.GetComponent<CookingStation>(); component2.m_conversion.Add(val4); component2.m_conversion.Add(val3); } } public void setupPickableDrops(ZNetScene zNetScene) { GameObject val = zNetScene.m_prefabs.Find((GameObject x) => ((Object)x).name == "Pickable_MeadowsMeatPile01"); GameObject val2 = zNetScene.m_prefabs.Find((GameObject x) => ((Object)x).name == "Pickable_MeadowsMeatPile02"); Pickable component = val.GetComponent<Pickable>(); Pickable component2 = val2.GetComponent<Pickable>(); GameObject item = getItem(zNetScene, "RawMeat"); if ((Object)(object)item != (Object)null) { component.m_itemPrefab = item; component2.m_itemPrefab = item; } createExtraDrops(component, zNetScene); createExtraDrops(component2, zNetScene); } private void createExtraDrops(Pickable pickable, ZNetScene zNetScene) { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) List<DropData> list = new List<DropData>(); string name = ((Object)((Component)pickable).gameObject).name; string text = name; if (!(text == "Pickable_MeadowsMeatPile01")) { if (text == "Pickable_MeadowsMeatPile02") { list.Add(createDrop(zNetScene, "RawMeat", 1, 1, 0.4f)); list.Add(createDrop(zNetScene, "Coins", 5, 15, 0.2f)); list.Add(createDrop(zNetScene, "BoneFragments", 1, 3, 0.2f)); list.Add(createDrop(zNetScene, "NeckTail", 1, 2, 0.3f)); } } else { list.Add(createDrop(zNetScene, "RawMeat", 1, 1, 0.4f)); list.Add(createDrop(zNetScene, "DeerMeat", 1, 1, 0.2f)); list.Add(createDrop(zNetScene, "NeckTail", 1, 2, 0.3f)); list.Add(createDrop(zNetScene, "Honey", 1, 2, 0.1f)); } pickable.m_extraDrops.m_drops = list; } private DropData createDrop(ZNetScene zNetScene, string name, int min, int max, float chance) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) DropData result = default(DropData); result.m_stackMin = min; result.m_stackMax = max; result.m_weight = chance; result.m_item = getItem(zNetScene, name); return result; } private GameObject getItem(ZNetScene zNetScene, string name) { return zNetScene.m_prefabs.Find((GameObject x) => ((Object)x).name == name); } public void setBalrondConverter(ZNetScene zNetScene) { GameObject val = zNetScene.m_prefabs.Find((GameObject x) => ((Object)x).name == "piece_sawmill"); GameObject val2 = zNetScene.m_prefabs.Find((GameObject x) => ((Object)x).name == "piece_leatherRack"); if ((Object)(object)val.GetComponent<BalrondConverter>() == (Object)null) { Debug.LogWarning((object)"Setting up Sawmill"); transferSmelterToBalrondConverter(val, zNetScene); } if ((Object)(object)val2.GetComponent<BalrondConverter>() == (Object)null) { Debug.LogWarning((object)"Setting up Leather Rack"); transferSmelterToBalrondConverter(val2, zNetScene); } } private void transferSmelterToBalrondConverter(GameObject gameObject, ZNetScene zNetScene) { Smelter component = gameObject.GetComponent<Smelter>(); BalrondConverter balrondConverter = gameObject.AddComponent<BalrondConverter>(); balrondConverter.m_addOreAnimationDuration = 0f; balrondConverter.m_addOreSwitch = component.m_addOreSwitch; balrondConverter.m_addOreTooltip = component.m_addOreTooltip; balrondConverter.m_addWoodSwitch = component.m_addWoodSwitch; balrondConverter.m_animators = component.m_animators; balrondConverter.m_disabledObject = component.m_disabledObject; balrondConverter.m_emptyOreSwitch = component.m_emptyOreSwitch; balrondConverter.m_emptyOreTooltip = component.m_emptyOreTooltip; balrondConverter.m_enabledObject = component.m_enabledObject; balrondConverter.m_fuelAddedEffects = component.m_fuelAddedEffects; balrondConverter.m_fuelItem = component.m_fuelItem; balrondConverter.m_fuelPerProduct = component.m_fuelPerProduct; balrondConverter.m_haveFuelObject = component.m_haveFuelObject; balrondConverter.m_haveOreObject = component.m_haveOreObject; balrondConverter.m_maxFuel = component.m_maxFuel; balrondConverter.m_maxOre = component.m_maxOre; balrondConverter.m_name = component.m_name; balrondConverter.m_noOreObject = component.m_noOreObject; balrondConverter.m_oreAddedEffects = component.m_oreAddedEffects; balrondConverter.m_outputPoint = component.m_outputPoint; balrondConverter.m_produceEffects = component.m_produceEffects; balrondConverter.m_requiresRoof = component.m_requiresRoof; balrondConverter.m_roofCheckPoint = component.m_roofCheckPoint; balrondConverter.m_windmill = component.m_windmill; balrondConverter.m_secPerProduct = component.m_secPerProduct; balrondConverter.m_smokeSpawner = component.m_smokeSpawner; balrondConverter.m_spawnStack = component.m_spawnStack; Object.DestroyImmediate((Object)(object)component); if (((Object)gameObject).name == "piece_sawmill") { balrondConverter.m_maxFuel = 1; balrondConverter.m_maxOre = 10; balrondConverter.m_fuelItem = zNetScene.m_prefabs.Find((GameObject x) => ((Object)x).name == "SawBlade").GetComponent<ItemDrop>(); balrondConverter.m_fuelPerProduct = 0.01f; balrondConverter.prefabName = "piece_sawmill"; } if (((Object)gameObject).name == "piece_leatherRack") { balrondConverter.m_maxFuel = 10; balrondConverter.m_maxOre = 10; balrondConverter.m_fuelItem = zNetScene.m_prefabs.Find((GameObject x) => ((Object)x).name == "IronNails").GetComponent<ItemDrop>(); balrondConverter.m_fuelPerProduct = 1f; balrondConverter.prefabName = "piece_leatherRack"; } } public static List<GameObject> ShuffleIntList(List<GameObject> list) { Random random = new Random(); List<GameObject> list2 = new List<GameObject>(); int count = list.Count; for (int i = 0; i < count; i++) { int index = random.Next(0, list.Count); list2.Add(list[index]); list.Remove(list[index]); } return list2; } } public class ShaderReplacment { public static List<GameObject> prefabsToReplaceShader = new List<GameObject>(); public static List<Material> materialsInPrefabs = new List<Material>(); public string[] shaderlist = new string[49] { "Custom/AlphaParticle", "Custom/Blob", "Custom/Bonemass", "Custom/Clouds", "Custom/Creature", "Custom/Decal", "Custom/Distortion", "Custom/Flow", "Custom/FlowOpaque", "Custom/Grass", "Custom/GuiScroll", "Custom/Heightmap", "Custom/icon", "Custom/InteriorSide", "Custom/LitGui", "Custom/LitParticles", "Custom/mapshader", "Custom/ParticleDecal", "Custom/Piece", "Custom/Player", "Custom/Rug", "Custom/ShadowBlob", "Custom/SkyboxProcedural", "Custom/SkyObject", "Custom/StaticRock", "Custom/Tar", "Custom/Trilinearmap", "Custom/UI/BGBlur", "Custom/Vegetation", "Custom/Water", "Custom/WaterBottom", "Custom/WaterMask", "Custom/Yggdrasil", "Custom/Yggdrasil/root", "Hidden/BlitCopyHDRTonemap", "Hidden/Dof/DepthOfFieldHdr", "Hidden/Dof/DX11Dof", "Hidden/Internal-Loading", "Hidden/Internal-UIRDefaultWorld", "Hidden/SimpleClear", "Hidden/SunShaftsComposite", "Lux Lit Particles/ Bumped", "Lux Lit Particles/ Tess Bumped", "Particles/Standard Surface2", "Particles/Standard Unlit2", "Standard TwoSided", "ToonDeferredShading2017", "Unlit/DepthWrite", "Unlit/Lighting" }; public static List<Shader> shaders = new List<Shader>(); private static readonly HashSet<Shader> CachedShaders = new HashSet<Shader>(); public static bool debug = true; public static Shader findShader(string name) { Shader[] array = Resources.FindObjectsOfTypeAll<Shader>(); if (array.Length == 0) { Debug.LogWarning((object)"SHADER LIST IS EMPTY!"); return null; } if (debug) { } return shaders.Find((Shader x) => ((Object)x).name == name); } public static Shader GetShaderByName(string name) { return shaders.Find((Shader x) => ((Object)x).name == name.Trim()); } public static void debugShaderList(List<Shader> shadersRes) { foreach (Shader shadersRe in shadersRes) { Debug.LogWarning((object)("SHADER NAME IS: " + ((Object)shadersRe).name)); } debug = false; } public static void Replace(GameObject gameObject) { prefabsToReplaceShader.Add(gameObject); GetMaterialsInPrefab(gameObject); } public static void GetMaterialsInPrefab(GameObject gameObject) { Renderer[] componentsInChildren = gameObject.GetComponentsInChildren<Renderer>(true); Renderer[] array = componentsInChildren; foreach (Renderer val in array) { Material[] sharedMaterials = val.sharedMaterials; if (sharedMaterials == null || sharedMaterials.Length == 0) { continue; } Material[] array2 = sharedMaterials; foreach (Material val2 in array2) { if ((Object)(object)val2 != (Object)null) { materialsInPrefabs.Add(val2); } } } } public static void getMeShaders() { AssetBundle[] array = Resources.FindObjectsOfTypeAll<AssetBundle>(); AssetBundle[] array2 = array; foreach (AssetBundle val in array2) { IEnumerable<Shader> enumerable3; try { IEnumerable<Shader> enumerable2; if (!val.isStreamedSceneAssetBundle || !Object.op_Implicit((Object)(object)val)) { IEnumerable<Shader> enumerable = val.LoadAllAssets<Shader>(); enumerable2 = enumerable; } else { enumerable2 = from shader in ((IEnumerable<string>)val.GetAllAssetNames()).Select((Func<string, Shader>)val.LoadAsset<Shader>) where (Object)(object)shader != (Object)null select shader; } enumerable3 = enumerable2; } catch (Exception) { continue; } if (enumerable3 == null) { continue; } foreach (Shader item in enumerable3) { CachedShaders.Add(item); } } } public static void runMaterialFix() { getMeShaders(); shaders.AddRange(CachedShaders); foreach (Material materialsInPrefab in materialsInPrefabs) { Shader shader = materialsInPrefab.shader; if (!((Object)(object)shader == (Object)null)) { string name = ((Object)shader).name; if (!(name == "Standard") && name.Contains("Balrond")) { setProperValue(materialsInPrefab, name); } } } } private static void setProperValue(Material material, string shaderName) { string name = shaderName.Replace("Balrond", "Custom"); name = checkNaming(name); Shader shaderByName = GetShaderByName(name); if ((Object)(object)shaderByName == (Object)null) { Debug.LogWarning((object)("Shader not found " + name)); } else { material.shader = shaderByName; } } private static string checkNaming(string name) { string result = name; if (name.Contains("Bumped")) { result = name.Replace("Custom", "Lux Lit Particles"); } if (name.Contains("Tess Bumped")) { result = name.Replace("Custom", "Lux Lit Particles"); } if (name.Contains("Standard Surface")) { result = name.Replace("Custom", "Particles"); result = result.Replace("Standard Surface2", "Standard Surface"); } if (name.Contains("Standard Unlit")) { result = name.Replace("Custom", "Particles"); result = result.Replace("Standard Unlit", "Standard Unlit2"); result = result.Replace("Standard Unlit22", "Standard Unlit2"); } return result; } } public class TableMapper { public static CraftingStation cauldron; public static CraftingStation workbench; public static CraftingStation heavyWorkbench; public static CraftingStation forge; public static CraftingStation ironworks; public static CraftingStation blackforge; public static CraftingStation stoneCutter; public static CraftingStation artisian; public static CraftingStation magetable; public static CraftingStation runeforge; public static CraftingStation tannery; public static CraftingStation fletcher; public static CraftingStation grill; public static CraftingStation alchemylab; public static List<GameObject> pieces = new List<GameObject>(); public static void setupTables(List<GameObject> list) { pieces = list; prepareTables(); } private static CraftingStation FindStation(List<GameObject> list, string name) { GameObject val = list.Find((GameObject x) => ((Object)x).name == name); if ((Object)(object)val != (Object)null) { return val.GetComponent<CraftingStation>(); } Debug.LogWarning((object)("TableMapper - Station not found: " + name)); return null; } private static void prepareTables() { cauldron = FindStation(pieces, "piece_cauldron"); workbench = FindStation(pieces, "piece_workbench"); heavyWorkbench = FindStation(pieces, "piece_heavy_workbench_bal"); forge = FindStation(pieces, "forge"); ironworks = FindStation(pieces, "piece_metalworks_bal"); blackforge = FindStation(pieces, "blackforge"); stoneCutter = FindStation(pieces, "piece_stonecutter"); artisian = FindStation(pieces, "piece_artisanstation"); runeforge = FindStation(pieces, "piece_runeforge_bal"); magetable = FindStation(pieces, "piece_magetable"); fletcher = FindStation(pieces, "piece_fletcher_bal"); } } public class JsonLoader { public string defaultPath = string.Empty; public void loadJson() { LoadTranslations(); justDefaultPath(); } public void justDefaultPath() { string configPath = Paths.ConfigPath; string text = Path.Combine(configPath, "BalrondConstructions-translation/"); defaultPath = text; } public void createDefaultPath() { string configPath = Paths.ConfigPath; string text = Path.Combine(configPath, "BalrondConstructions-translation/"); if (!Directory.Exists(text)) { CreateFolder(text); } else { Debug.Log((object)("BalrondConstructions: Folder already exists: " + text)); } defaultPath = text; } private string[] jsonFilePath(string folderName, string extension) { string configPath = Paths.ConfigPath; string text = Path.Combine(configPath, "BalrondConstructions-translation/"); if (!Directory.Exists(text)) { CreateFolder(text); } else { Debug.Log((object)("BalrondConstructions: Folder already exists: " + text)); } string[] files = Directory.GetFiles(text, extension); Debug.Log((object)("BalrondConstructions:" + folderName + " Json Files Found: " + files.Length)); return files; } private static void CreateFolder(string path) { try { Directory.CreateDirectory(path); Debug.Log((object)"BalrondConstructions: Folder created successfully."); } catch (Exception ex) { Debug.Log((object)("BalrondConstructions: Error creating folder: " + ex.Message)); } } private void LoadTranslations() { int num = 0; string[] array = jsonFilePath("Translation", "*.json"); foreach (string text in array) { string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(text); string json = File.ReadAllText(text); JsonData jsonData = JsonMapper.ToObject(json); Dictionary<string, string> dictionary = new Dictionary<string, string>(); foreach (string key in jsonData.Keys) { dictionary[key] = jsonData[key].ToString(); } if (dictionary != null) { BalrondTranslator.translations.Add(fileNameWithoutExtension, dictionary); Debug.Log((object)("BalrondConstructions: Json Files Language: " + fileNameWithoutExtension)); num++; } else { Debug.LogError((object)("BalrondConstructions: Loading FAILED file: " + text)); } } Debug.Log((object)("BalrondConstructions: Translation JsonFiles Loaded: " + num)); } } [BepInPlugin("balrond.astafaraios.BalrondConstructions", "BalrondConstructions", "1.1.3")] public class Launch : BaseUnityPlugin { [HarmonyPatch(typeof(Player), "UseStamina")] private class Player_UseStamina { private static bool Prefix() { if (Player.m_debugMode && ((Terminal)Console.instance).IsCheatsEnabled()) { return false; } return true; } } [HarmonyPriority(800)] [HarmonyPatch(typeof(Localization), "SetupLanguage")] private class Translation_SetupLanguage { private static void Prefix(Localization __instance, string language) { Dictionary<string, string> dictionary = BalrondTranslator.getLanguage("English"); if ("English" != language) { Debug.Log((object)("BalrondConstructions: Language is: " + language)); Dictionary<string, string> language2 = BalrondTranslator.getLanguage(language); if (language2 != null) { dictionary = language2; } else { Debug.Log((object)"BalrondConstructions: Did not find translation file loading English"); } } if (dictionary != null) { foreach (KeyValuePair<string, string> item in dictionary) { __instance.AddWord(item.Key, item.Value); } return; } Debug.LogWarning((object)"BalrondConstructions: No translation file found!"); } } [HarmonyPriority(800)] [HarmonyPatch(typeof(Localization), "LoadCSV")] private class Translation_LoadCSV { private static void Prefix(Localization __instance, string language) { Dictionary<string, string> dictionary = BalrondTranslator.getLanguage("English"); if ("English" != language) { Debug.Log((object)("BalrondConstructions: Language is: " + language)); Dictionary<string, string> language2 = BalrondTranslator.getLanguage(language); if (language2 != null) { dictionary = language2; } else { Debug.Log((object)"BalrondConstructions: Did not find translation file loading English"); } } if (dictionary != null) { foreach (KeyValuePair<string, string> item in dictionary) { __instance.AddWord(item.Key, item.Value); } return; } Debug.LogWarning((object)"BalrondConstructions: No translation file found!"); } } [HarmonyPatch(typeof(FejdStartup), "SetupGui")] private class FejdStartup_SetupGUI { private static void Postfix() { string selectedLanguage = Localization.instance.GetSelectedLanguage(); Dictionary<string, string> dictionary = BalrondTranslator.getLanguage("English"); if ("English" != selectedLanguage) { Debug.Log((object)("BalrondConstructions: Language is: " + selectedLanguage)); Dictionary<string, string> language = BalrondTranslator.getLanguage(selectedLanguage); if (language != null) { dictionary = language; } else { Debug.Log((object)"BalrondConstructions: Did not find translation file loading English"); } } if (dictionary != null) { foreach (KeyValuePair<string, string> item in dictionary) { Localization.instance.AddWord(item.Key, item.Value); } return; } Debug.LogWarning((object)"BalrondConstructions: No translation file found!"); } } [HarmonyPatch(typeof(AudioMan), "Awake")] private static class AudioMan_Awake_Patch { private static void Postfix(AudioMan __instance) { foreach (GameObject itemPrefab in modResourceLoader.itemPrefabs) { AudioSource[] componentsInChildren = itemPrefab.GetComponentsInChildren<AudioSource>(true); foreach (AudioSource val in componentsInChildren) { val.outputAudioMixerGroup = __instance.m_masterMixer.outputAudioMixerGroup; } } foreach (GameObject buildPrefab in modResourceLoader.buildPrefabs) { AudioSource[] componentsInChildren2 = buildPrefab.GetComponentsInChildren<AudioSource>(true); foreach (AudioSource val2 in componentsInChildren2) { val2.outputAudioMixerGroup = __instance.m_masterMixer.outputAudioMixerGroup; } } foreach (GameObject monsterPrefab in modResourceLoader.monsterPrefabs) { AudioSource[] componentsInChildren3 = monsterPrefab.GetComponentsInChildren<AudioSource>(true); foreach (AudioSource val3 in componentsInChildren3) { val3.outputAudioMixerGroup = __instance.m_masterMixer.outputAudioMixerGroup; } } foreach (GameObject vfxPrefab in modResourceLoader.vfxPrefabs) { AudioSource[] componentsInChildren4 = vfxPrefab.GetComponentsInChildren<AudioSource>(true); foreach (AudioSource val4 in componentsInChildren4) { val4.outputAudioMixerGroup = __instance.m_masterMixer.outputAudioMixerGroup; } } foreach (GameObject vegetationPrefab in modResourceLoader.vegetationPrefabs) { AudioSource[] componentsInChildren5 = vegetationPrefab.GetComponentsInChildren<AudioSource>(true); foreach (AudioSource val5 in componentsInChildren5) { val5.outputAudioMixerGroup = __instance.m_masterMixer.outputAudioMixerGroup; } } } } [HarmonyPatch(typeof(GameCamera), "Awake")] private class GameCamers_Awake { private static void Postfix(GameCamera __instance) { __instance.m_minWaterDistance = -1000f; } } [HarmonyPatch(typeof(ObjectDB), "CopyOtherDB")] public static class Object_CopyOtherDB_Path { public static void Postfix() { if (IsObjectDBValid()) { modResourceLoader.setupBuildPiecesListDB(); StatusEffect val = ObjectDB.instance.m_StatusEffects.Find((StatusEffect x) => ((Object)x).name == "Spirit"); databaseAddMethods.AddItems(modResourceLoader.itemPrefabs); databaseAddMethods.AddStatuseffects(modResourceLoader.statusEffects); databaseAddMethods.AddRecipes(modResourceLoader.recipes); } } } [HarmonyPatch(typeof(ObjectDB), "Awake")] public static class ObjectDB_Awake_Path { public static void Postfix() { if (IsObjectDBValid()) { modResourceLoader.setupBuildPiecesListDB(); databaseAddMethods.AddItems(modResourceLoader.itemPrefabs); databaseAddMethods.AddStatuseffects(modResourceLoader.statusEffects); databaseAddMethods.AddRecipes(modResourceLoader.recipes); ObjectDB.instance.m_recipes.Sort(SortByScore); } } private static int SortByScore(Recipe p1, Recipe p2) { if ((Object)(object)p1.m_item == (Object)null) { return 0; } if ((Object)(object)p2.m_item == (Object)null) { return 1; } return ((Object)p1.m_item).name.CompareTo(((Object)p2.m_item).name); } } [HarmonyPatch(typeof(ZNetScene), "Awake")] public static class ZNetScene_Awake_Path { public static void Prefix(ZNetScene __instance) { //IL_006e: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)__instance == (Object)null) { Debug.LogWarning((object)(projectName + ": No ZnetScene found")); return; } fxReplacment.setInstance(__instance.m_prefabs); modResourceLoader.FixAllFx(fxReplacment); modResourceLoader.AddPrefabsToZnetScene(__instance); if (!hasSpawned) { buildPieceBuilder.SetupBuildPieces(__instance.m_prefabs); if (!new ZNet().IsDedicated()) { ShaderReplacment.runMaterialFix(); hasSpawned = true; } } } } private readonly Harmony harmony = new Harmony("balrond.astafaraios.BalrondConstructions"); public const string PluginGUID = "balrond.astafaraios.BalrondConstructions"; public const string PluginName = "BalrondConstructions"; public const string PluginVersion = "1.1.3"; public static ModResourceLoader modResourceLoader = new ModResourceLoader(); public static FxReplacment fxReplacment = new FxReplacment(); public static DatabaseAddMethods databaseAddMethods = new DatabaseAddMethods(); public static BuildPieceBuilder buildPieceBuilder = new BuildPieceBuilder(); public static GameObject gui; public static GameObject gui2; public static string projectName = "BalrondConstructions"; public static GameObject RootObject; public static GameObject PrefabContainer; public static bool hasSpawned = false; public static JsonLoader jsonLoader = new JsonLoader(); private void Awake() { jsonLoader.loadJson(); createPrefabContainer(); modResourceLoader.loadAssets(); harmony.PatchAll(); } private string buildUpgradeString(List<GameObject> list) { string text = "vegetation_reset "; text += buildStringFromList(list); return text + " start"; } private string buildStringFromList(List<GameObject> list) { string text = ""; foreach (GameObject item in list) { text = text + ((Object)item).name + ","; } text.Remove(text.Length - 1); return text; } public void createPrefabContainer() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown RootObject = new GameObject("_ValheimReforgedRoot"); Object.DontDestroyOnLoad((Object)(object)RootObject); PrefabContainer = new GameObject("Prefabs"); PrefabContainer.transform.parent = RootObject.transform; PrefabContainer.SetActive(false); } public static GameObject cloneMe(GameObject source, string name) { GameObject val = Object.Instantiate<GameObject>(source, PrefabContainer.transform); ((Object)val).name = name; fixMaterials(val, source); val.SetActive(true); return val; } public static void addConsumeFood(MonsterAI monsterAI, ZNetScene __instance, string name) { monsterAI.m_consumeItems.Add(__instance.m_prefabs.Find((GameObject x) => ((Object)x).name == "BugMeat").GetComponent<ItemDrop>()); } public static GameObject fixMaterials(GameObject clone, GameObject source) { MeshRenderer[] componentsInChildren = source.GetComponentsInChildren<MeshRenderer>(); foreach (MeshRenderer val in componentsInChildren) { MeshRenderer[] componentsInChildren2 = clone.GetComponentsInChildren<MeshRenderer>(); foreach (MeshRenderer val2 in componentsInChildren2) { if (((Object)val).name == ((Object)val2).name) { ((Renderer)val2).materials = ((Renderer)val).sharedMaterials; ((Renderer)val2).sharedMaterials = ((Renderer)val).sharedMaterials; break; } } } return clone; } private void OnDestroy() { harmony.UnpatchSelf(); } private static bool IsObjectDBValid() { return (Object)(object)ObjectDB.instance != (Object)null && ObjectDB.instance.m_items.Count != 0 && ObjectDB.instance.m_recipes.Count != 0 && (Object)(object)ObjectDB.instance.GetItemPrefab("Amber") != (Object)null; } private static string editZnetName(string name) { name = name.Replace("(Clone)", ""); int num = name.IndexOf("("); if (num >= 0) { name = name.Substring(0, num); } return name.Trim(); } public static GameObject cloneZnet(ZNetView znet) { GameObject val = ZNetScene.instance.m_prefabs.Find((GameObject x) => ((Object)x).name == ((Object)znet).name); if ((Object)(object)val != (Object)null) { Transform parent = val.transform.parent; GameObject val2 = val; val = cloneMe(val, ((Object)val2).name); val.transform.parent = parent; val2.transform.parent = null; RandomSpawn component = val2.GetComponent<RandomSpawn>(); if ((Object)(object)component != (Object)null) { RandomSpawn val3 = val.AddComponent<RandomSpawn>(); val3.m_chanceToSpawn = component.m_chanceToSpawn; if ((Object)(object)component.m_OffObject != (Object)null) { string name = ((Object)component.m_OffObject).name; Transform[] componentsInChildren = val.GetComponentsInChildren<Transform>(); Transform[] array = componentsInChildren; foreach (Transform val4 in array) { if (((Object)val4).name == name) { val3.m_OffObject = ((Component)val4).gameObject; break; } } } } return val; } return null; } } [Serializable] public class MappedEffectList { public List<EffectInfo> pieceEffect; public List<EffectInfo> destroyedEffects; public List<EffectInfo> hitEffects; public List<EffectInfo> switchEffect; public List<EffectInfo> blockEffect; public List<EffectInfo> equipEffect; public List<EffectInfo> hitEffect; public List<EffectInfo> hitTerrainEffect; public List<EffectInfo> holdStartEffect; public List<EffectInfo> startEffect; public List<EffectInfo> trailStartEffect; public List<EffectInfo> triggerEffect; public List<EffectInfo> unequipEffect; public EffectList createEffectListFromInfo(List<EffectInfo> list) { //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(); List<EffectData> list2 = new List<EffectData>(); val.m_effectPrefabs = list2.ToArray(); return val; } private EffectData createEffectData(EffectInfo info) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Expected O, but got Unknown EffectData val = new EffectData(); val.m_inheritParentRotation = info.inheritRotation; val.m_multiplyParentVisualScale = info.multiplyScale; val.m_childTransform = info.childName; val.m_inheritParentScale = info.inheritScale; val.m_variant = info.variant; val.m_scale = info.scale; val.m_attach = info.attach; val.m_follow = info.follow; val.m_prefab = ZNetScene.instance.m_prefabs.Find((GameObject x) => ((Object)x).name == info.name); return val; } } [Serializable] public struct EffectInfo { public string name; public bool enabled; public int variant; public bool attach; public bool follow; public bool inheritRotation; public bool inheritScale; public bool multiplyScale; public bool radnomRotation; public bool scale; public string childName; public EffectInfo(string name, bool enabled = true, int variant = -1, bool attach = false, bool follow = false, bool inheritRotation = false, bool inheritScale = false, bool multiplyScale = false, bool radnomRotation = false, bool scale = false, string childName = null) { this.name = name; this.enabled = enabled; this.variant = variant; this.attach = attach; this.follow = follow; this.inheritRotation = inheritRotation; this.inheritScale = inheritScale; this.multiplyScale = multiplyScale; this.radnomRotation = radnomRotation; this.scale = scale; this.childName = childName; } } public class BuildPieceBuilder { private List<GameObject> list; private string[] piecesNames = BuildPieceList.buildPieces; public void SetupBuildPieces(List<GameObject> list) { TableMapper.setupTables(list); this.list = list; string[] array = piecesNames; foreach (string name in array) { GameObject val = list.Find((GameObject x) => ((Object)x).name == name); if ((Object)(object)val == (Object)null) { Debug.LogWarning((object)("Cant find buildpiece with name: " + name)); } else { EditBuildPiece(val); } } } private void EditBuildPiece(GameObject gameObject) { //IL_2739: Unknown result type (might be due to invalid IL or missing references) //IL_25ee: Unknown result type (might be due to invalid IL or missing references) //IL_288f: Unknown result type (might be due to invalid IL or missing references) //IL_29a2: Unknown result type (might be due to invalid IL or missing references) //IL_24ea: Unknown result type (might be due to invalid IL or missing references) //IL_1cf8: Unknown result type (might be due to invalid IL or missing references) //IL_2207: Unknown result type (might be due to invalid IL or missing references) //IL_2127: Unknown result type (might be due to invalid IL or missing references) //IL_25ba: Unknown result type (might be due to invalid IL or missing references) //IL_24b6: Unknown result type (might be due to invalid IL or missing references) //IL_26ff: Unknown result type (might be due to invalid IL or missing references) //IL_1c54: Unknown result type (might be due to invalid IL or missing references) //IL_2dd7: Unknown result type (might be due to invalid IL or missing references) //IL_22f7: Unknown result type (might be due to invalid IL or missing references) //IL_1b61: Unknown result type (might be due to invalid IL or missing references) //IL_1b89: Unknown result type (might be due to invalid IL or missing references) //IL_2089: Unknown result type (might be due to invalid IL or missing references) //IL_2c8b: Unknown result type (might be due to invalid IL or missing references) //IL_2dff: Unknown result type (might be due to invalid IL or missing references) //IL_1fdc: Unknown result type (might be due to invalid IL or missing references) //IL_1f22: Unknown result type (might be due to invalid IL or missing references) //IL_268a: Unknown result type (might be due to invalid IL or missing references) //IL_1d8d: Unknown result type (might be due to invalid IL or missing references) //IL_1b38: Unknown result type (might be due to invalid IL or missing references) //IL_2a5c: Unknown result type (might be due to invalid IL or missing references) //IL_2663: Unknown result type (might be due to invalid IL or missing references) //IL_2daf: Unknown result type (might be due to invalid IL or missing references) //IL_23f2: Unknown result type (might be due to invalid IL or missing references) //IL_1db5: Unknown result type (might be due to invalid IL or missing references) //IL_20ce: Unknown result type (might be due to invalid IL or missing references) //IL_1e36: Unknown result type (might be due to invalid IL or missing references) //IL_2e86: Unknown result type (might be due to invalid IL or missing references) //IL_2867: Unknown result type (might be due to invalid IL or missing references) //IL_22b4: Unknown result type (might be due to invalid IL or missing references) //IL_23a4: Unknown result type (might be due to invalid IL or missing references) //IL_1b0f: Unknown result type (might be due to invalid IL or missing references) //IL_2f53: Unknown result type (might be due to invalid IL or missing references) //IL_2586: Unknown result type (might be due to invalid IL or missing references) //IL_2fdc: Unknown result type (might be due to invalid IL or missing references) //IL_251e: Unknown result type (might be due to invalid IL or missing references) //IL_1d65: Unknown result type (might be due to invalid IL or missing references) //IL_2d69: Unknown result type (might be due to invalid IL or missing references) //IL_21c0: Unknown result type (might be due to invalid IL or missing references) //IL_1dfb: Unknown result type (might be due to invalid IL or missing references) //IL_2615: Unknown result type (might be due to invalid IL or missing references) //IL_2280: Unknown result type (might be due to invalid IL or missing references) //IL_2cc4: Unknown result type (might be due to invalid IL or missing references) //IL_293a: Unknown result type (might be due to invalid IL or missing references) //IL_29d6: Unknown result type (might be due to invalid IL or missing references) //IL_1f49: Unknown result type (might be due to invalid IL or missing references) //IL_1bce: Unknown result type (might be due to invalid IL or missing references) //IL_27d7: Unknown result type (might be due to invalid IL or missing references) //IL_2ee5: Unknown result type (might be due to invalid IL or missing references) //IL_1f70: Unknown result type (might be due to invalid IL or missing references) //IL_1eac: Unknown result type (might be due to invalid IL or missing references) //IL_2482: Unknown result type (might be due to invalid IL or missing references) //IL_2f8a: Unknown result type (might be due to invalid IL or missing references) //IL_1efb: Unknown result type (might be due to invalid IL or missing references) //IL_2355: Unknown result type (might be due to invalid IL or missing references) //IL_2a0a: Unknown result type (might be due to invalid IL or missing references) //IL_263c: Unknown result type (might be due to invalid IL or missing references) //IL_2552: Unknown result type (might be due to invalid IL or missing references) //IL_1c2c: Unknown result type (might be due to invalid IL or missing references) //IL_1c04: Unknown result type (might be due to invalid IL or missing references) //IL_2c0a: Unknown result type (might be due to invalid IL or missing references) //IL_2e27: Unknown result type (might be due to invalid IL or missing references) //IL_224c: Unknown result type (might be due to invalid IL or missing references) //IL_232d: Unknown result type (might be due to invalid IL or missing references) //IL_2046: Unknown result type (might be due to invalid IL or missing references) //IL_1e84: Unknown result type (might be due to invalid IL or missing references) //IL_2003: Unknown result type (might be due to invalid IL or missing references) //IL_23cb: Unknown result type (might be due to invalid IL or missing references) //IL_296e: Unknown result type (might be due to invalid IL or missing references) //IL_2811: Unknown result type (might be due to invalid IL or missing references) //IL_2e4f: Unknown result type (might be due to invalid IL or missing references) //IL_2faf: Unknown result type (might be due to invalid IL or missing references) //IL_1c7c: Unknown result type (might be due to invalid IL or missing references) //IL_26d8: Unknown result type (might be due to invalid IL or missing references) //IL_2bd2: Unknown result type (might be due to invalid IL or missing references) //IL_2c43: Unknown result type (might be due to invalid IL or missing references) //IL_237c: Unknown result type (might be due to invalid IL or missing references) //IL_2ebd: Unknown result type (might be due to invalid IL or missing references) //IL_244e: Unknown result type (might be due to invalid IL or missing references) //IL_1e5d: Unknown result type (might be due to invalid IL or missing references) //IL_2419: Unknown result type (might be due to invalid IL or missing references) //IL_2aed: Unknown result type (might be due to invalid IL or missing references) //IL_2cfb: Unknown result type (might be due to invalid IL or missing references) //IL_2baa: Unknown result type (might be due to invalid IL or missing references) //IL_2188: Unknown result type (might be due to invalid IL or missing references) //IL_1cc1: Unknown result type (might be due to invalid IL or missing references) //IL_1ed3: Unknown result type (might be due to invalid IL or missing references) //IL_2f1c: Unknown result type (might be due to invalid IL or missing references) //IL_27af: Unknown result type (might be due to invalid IL or missing references) //IL_1fa6: Unknown result type (might be due to invalid IL or missing references) //IL_2b34: Unknown result type (might be due to invalid IL or missing references) //IL_26b1: Unknown result type (might be due to invalid IL or missing references) //IL_1d3d: Unknown result type (might be due to invalid IL or missing references) //IL_28d9: Unknown result type (might be due to invalid IL or missing references) //IL_2d32: Unknown result type (might be due to invalid IL or missing references) //IL_2774: Unknown result type (might be due to invalid IL or missing references) Piece component = gameObject.gameObject.GetComponent<Piece>(); SetStation(component, TableMapper.stoneCutter); switch (((Object)gameObject).name) { case "piece_swamphut_bal": SetStation(component, TableMapper.stoneCutter); AddResources(component, "S