Decompiled source of balrond amazing nature v0.3.7
plugins/BalrondAmazingNature.dll
Decompiled a day 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 BepInEx; using BepInEx.Bootstrap; using HarmonyLib; using LitJson2; using UnityEngine; using UpgradeWorld; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("BalrondNature")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("BalrondNature")] [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; 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 UpgradeWorld { public class CommandRegistration { public string name = ""; public string description = ""; public string[] commands = new string[0]; public void AddCommand() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown //IL_0022: Unknown result type (might be due to invalid IL or missing references) new ConsoleCommand(name, description, (ConsoleEvent)delegate(ConsoleEventArgs args) { string[] array = commands; foreach (string text in array) { args.Context.TryRunCommand(text, false, false); } }, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false); } } [HarmonyPatch(typeof(Terminal), "InitTerminal")] public static class Upgrade { private static List<CommandRegistration> registrations = new List<CommandRegistration>(); public const string GUID = "upgrade_world"; public static void Register(string name, string description, params string[] commands) { if (Chainloader.PluginInfos.ContainsKey("upgrade_world")) { registrations.Add(new CommandRegistration { name = name, description = description, commands = commands }); } } private static void Postfix() { foreach (CommandRegistration registration in registrations) { registration.AddCommand(); } } } } namespace BalrondNature { 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; } } internal class ClutterList { public static string[] clutter = new string[96] { "ormbunke_bal", "magicGrass1", "magicGrass2", "DesertPlant6_1", "DesertPlant6_2", "DesertPlant6_3", "StalagmiteFloor_1", "StalagmiteFloor_2", "StalagmiteFloor_3", "StalagmiteFloor_4", "Mushroom_52", "Mushroom_51", "iceweed1", "iceweed2", "iceweed3", "iceweed4", "Mushroom_6G3", "Mushroom_6G2", "Mushroom_3G1", "Mushroom_3G2", "Mushroom_3G3", "Mushroom_31", "Mushroom_32", "Mushroom_33", "Mushroom_34", "Mushroom_35", "IvyLowerF1", "IvyLowerF2", "IvyLowerF3", "mistlandsBush6", "PlantG6", "PlantG7", "PlantG8", "seaBush10", "seaBush11", "seaBush6", "seaBush8", "seaBush9", "Seaweed2_1", "Seaweed2_2", "Seaweed2_3", "AshGrass 1", "AshGrass 2", "AshGrass 3", "DeepNorthGrass", "DesertPlantsGrassCurl_1", "DesertPlantsGrassCurl_2", "DesertPlantsGrassCurl_3", "Coral1_Bowl_1", "Coral1_Bowl_2", "CoralTussocks1_1", "CoralTussocks1_2", "CoralTussocks1_G1", "SeaweedAshlands1", "SeaweedAshlands2", "SeaweedAshlands3", "Tentacles 1", "Tentacles 2", "Tentacles 3", "plant_dn1", "plant_dn2", "plant_dn3", "plant_dn4", "plant_dn5", "plant_dn6", "Coral4_G1", "Coral4_G2", "Coral_dn1", "Coral_dn2", "Coral_dn3", "Coral_dn4", "PlantG17_1", "PlantG17_1_F", "PlantG17_2", "PlantG17_2_F", "PlantG_19", "PlantGS4_1", "PlantFlowerF7_1", "PlantFlowerF7_2", "PlantFlowerF7_3", "PlantFlowerS8_1", "PlantFlower2_1", "PlantFlower2_2", "PlantFlower2_3", "Swampy1", "Swampy2", "Swampy3", "Swampy4", "Swampy5", "Swampy6", "Swampy7", "Swampy8", "Swampy9", "Swampy10", "Swampy11", "Swampy12" }; } public class ConversionChanges { private enum ConversionType { smelter, fermenter, cooking, balrondConverter } private List<GameObject> buildPieces = new List<GameObject>(); private List<GameObject> items = new List<GameObject>(); private List<ItemConversion> smelterConversions = new List<ItemConversion>(); private List<ItemConversion> furnaceConversions = new List<ItemConversion>(); private string[] buildPiecesNames = new string[17] { "portal_wood", "piece_workbench", "forge", "blackforge", "piece_magetable", "piece_artisanstation", "piece_banner01", "piece_banner02", "piece_banner03", "piece_banner04", "piece_banner05", "piece_banner06", "piece_banner07", "piece_banner08", "piece_banner09", "piece_banner10", "piece_banner11" }; public void editBuidlPieces(List<GameObject> allprefabs) { buildPieces = allprefabs; items = allprefabs; editFermenter(); editOven(); editKiln(); editWHeel(); editWIndMIll(); editSap(); editBeehive(); editSmelter(); editFurnace(); editRefinery(); editCooking(); editIronCooking(); editSawMill(); editLeatherRack(); EditRecipes(); } private void EditRecipes() { string[] array = buildPiecesNames; foreach (string name in array) { GameObject val = FindBuildPiece(name); if ((Object)(object)val != (Object)null) { changeBuildPiece(val); } } } private void changeBuildPiece(GameObject buildPiece) { switch (((Object)buildPiece).name) { case "portal_wood": ChangeRecipe(buildPiece); break; case "forge": case "piece_workbench": case "blackforge": case "piece_magetable": case "piece_artisanstation": ChcangeCraftingStation(buildPiece, requireRoof: false); break; case "piece_banner01": case "piece_banner02": case "piece_banner03": case "piece_banner04": case "piece_banner05": case "piece_banner06": case "piece_banner07": case "piece_banner08": case "piece_banner09": case "piece_banner10": case "piece_banner11": setBannerRecipe(buildPiece); break; } } private void setBannerRecipe(GameObject gameObject) { Piece component = gameObject.GetComponent<Piece>(); component.m_resources = createResources(gameObject); } private void ChangeChest(GameObject gameObject, int height, int width) { Container component = gameObject.GetComponent<Container>(); component.m_width = width; component.m_height = height; } private void ChcangeCraftingStation(GameObject buildPiece, bool requireRoof) { CraftingStation component = buildPiece.GetComponent<CraftingStation>(); if ((Object)(object)component != (Object)null) { component.m_craftRequireRoof = requireRoof; } } private GameObject FindBuildPiece(string name) { return buildPieces.Find((GameObject x) => ((Object)x).name == name); } private void ChangeRecipe(GameObject gameObject) { Piece component = gameObject.GetComponent<Piece>(); component.m_resources = createResources(gameObject); } private Requirement[] createResources(GameObject item) { List<Requirement> list = new List<Requirement>(); switch (((Object)item).name) { case "portal_wood": list.Add(createReq("HardWood_bal", 10, 0)); list.Add(createReq("SurtlingCore", 10, 0)); list.Add(createReq("GreydwarfEye", 10, 0)); break; case "piece_banner01": case "piece_banner02": case "piece_banner03": case "piece_banner04": case "piece_banner05": case "piece_banner06": case "piece_banner07": case "piece_banner08": case "piece_banner09": case "piece_banner10": case "piece_banner11": list.Add(createReq("DyeKit_bal", 1, 0)); list.Add(createReq("FineWood", 2, 0)); list.Add(createReq("LeatherScraps", 3, 0)); list.Add(createReq("StrawThread_bal", 3, 0)); break; } return list.ToArray(); } private Requirement createReq(string name, int amount, int amountPerLevel) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown Requirement val = new Requirement(); val.m_recover = true; ItemDrop component = FindItem(name).GetComponent<ItemDrop>(); val.m_resItem = component; val.m_amount = amount; val.m_amountPerLevel = amountPerLevel; return val; } private GameObject FindItem(string name, List<GameObject> list = null) { if (items == null) { items = ZNetScene.instance.m_prefabs; } GameObject val = items.Find((GameObject x) => ((Object)x).name == name); if ((Object)(object)val != (Object)null) { return val; } Debug.LogWarning((object)("Item Not Found - " + name + ", Replaced With Wood")); return items.Find((GameObject x) => ((Object)x).name == "Wood"); } public void editLeatherRack(BalrondConverter leatherRack = null) { if (buildPieces != null && (Object)(object)leatherRack == (Object)null) { GameObject val = buildPieces.Find((GameObject x) => ((Object)x).name == "piece_leatherRack_bal"); leatherRack = val.GetComponent<BalrondConverter>(); } leatherRack.m_conversion.Clear(); addConversion(((Component)leatherRack).gameObject, "PatchworkDeer_bal", "DeerHide", ConversionType.balrondConverter, 30, 2); addConversion(((Component)leatherRack).gameObject, "PatchworkBoar_bal", "BoarHide_bal", ConversionType.balrondConverter, 30, 2); addConversion(((Component)leatherRack).gameObject, "PatchworkTroll_bal", "TrollHide", ConversionType.balrondConverter, 30, 2); addConversion(((Component)leatherRack).gameObject, "PatchworkWolf_bal", "WolfPelt", ConversionType.balrondConverter, 30, 2); addConversion(((Component)leatherRack).gameObject, "PatchworkLox_bal", "LoxPelt", ConversionType.balrondConverter, 30, 2); addConversion(((Component)leatherRack).gameObject, "PatchworkAsk_bal", "AskHide", ConversionType.balrondConverter, 30, 2); } public void editRefinery(Smelter refinery = null) { if (buildPieces != null && (Object)(object)refinery == (Object)null) { GameObject val = buildPieces.Find((GameObject x) => ((Object)x).name == "eitrrefinery"); refinery = val.GetComponent<Smelter>(); } refinery.m_maxOre = 60; refinery.m_maxFuel = 60; refinery.m_spawnStack = true; refinery.m_secPerProduct = 40f; } public void editSmelter(Smelter smelter = null) { if (buildPieces != null && (Object)(object)smelter == (Object)null) { GameObject val = buildPieces.Find((GameObject x) => ((Object)x).name == "smelter"); smelter = val.GetComponent<Smelter>(); } smelter.m_maxFuel = 45; smelter.m_maxOre = 15; smelter.m_secPerProduct = 40f; smelter.m_fuelPerProduct = 3; smelter.m_conversion.Clear(); addConversion(((Component)smelter).gameObject, "CopperOre", "Copper", ConversionType.smelter); addConversion(((Component)smelter).gameObject, "TinOre", "Tin", ConversionType.smelter); addConversion(((Component)smelter).gameObject, "IronOre", "Iron", ConversionType.smelter); addConversion(((Component)smelter).gameObject, "SilverOre", "Silver", ConversionType.smelter); addConversion(((Component)smelter).gameObject, "GoldOre_bal", "GoldBar_bal", ConversionType.smelter); smelterConversions.AddRange(smelter.m_conversion); } public void editFurnace(Smelter furnace = null) { if (buildPieces != null && (Object)(object)furnace == (Object)null) { GameObject val = buildPieces.Find((GameObject x) => ((Object)x).name == "blastfurnace"); furnace = val.GetComponent<Smelter>(); } furnace.m_maxFuel = 60; furnace.m_maxOre = 30; furnace.m_secPerProduct = 20f; furnace.m_fuelPerProduct = 2; furnace.m_conversion.Clear(); addConversion(((Component)furnace).gameObject, "CopperOre", "Copper", ConversionType.smelter); addConversion(((Component)furnace).gameObject, "TinOre", "Tin", ConversionType.smelter); addConversion(((Component)furnace).gameObject, "IronOre", "Iron", ConversionType.smelter); addConversion(((Component)furnace).gameObject, "SilverOre", "Silver", ConversionType.smelter); addConversion(((Component)furnace).gameObject, "GoldOre_bal", "GoldBar_bal", ConversionType.smelter); addConversion(((Component)furnace).gameObject, "BlackMetalOre_bal", "BlackMetal", ConversionType.smelter); addConversion(((Component)furnace).gameObject, "DarkIron_bal", "DarkSteel_bal", ConversionType.smelter); addConversion(((Component)furnace).gameObject, "CobaltOre_bal", "Cobalt_bal", ConversionType.smelter); addConversion(((Component)furnace).gameObject, "FlametalOre", "Flametal", ConversionType.smelter); addConversion(((Component)furnace).gameObject, "FlametalOreNew", "FlametalNew", ConversionType.smelter); furnaceConversions.AddRange(furnace.m_conversion); } public void editSawMill(BalrondConverter sawmill = null) { if (buildPieces != null && (Object)(object)sawmill == (Object)null) { GameObject val = buildPieces.Find((GameObject x) => ((Object)x).name == "piece_sawmill_bal"); sawmill = val.GetComponent<BalrondConverter>(); } sawmill.m_conversion.Clear(); addConversion(((Component)sawmill).gameObject, "RoundLog", "Wood", ConversionType.balrondConverter, 30, 3); addConversion(((Component)sawmill).gameObject, "FineWood", "Wood", ConversionType.balrondConverter, 30, 4); addConversion(((Component)sawmill).gameObject, "ElderBark", "Wood", ConversionType.balrondConverter, 30, 2); addConversion(((Component)sawmill).gameObject, "HardWood_bal", "FineWood", ConversionType.balrondConverter, 35, 2); addConversion(((Component)sawmill).gameObject, "YggdrasilWood", "FineWood", ConversionType.balrondConverter, 35, 3); addConversion(((Component)sawmill).gameObject, "Blackwood", "FineWood", ConversionType.balrondConverter, 35, 4); addConversion(((Component)sawmill).gameObject, "EmberWood_bal", "YggdrasilWood", ConversionType.balrondConverter, 40, 2); addConversion(((Component)sawmill).gameObject, "CrystalWood_bal", "HardWood_bal", ConversionType.balrondConverter, 40, 2); } public void editFermenter(Fermenter fermenter = null) { if (buildPieces != null && (Object)(object)fermenter == (Object)null) { GameObject val = buildPieces.Find((GameObject x) => ((Object)x).name == "fermenter"); fermenter = val.GetComponent<Fermenter>(); } fermenter.m_fermentationDuration = 2000f; } public void editOven(CookingStation oven = null) { if (buildPieces != null && (Object)(object)oven == (Object)null) { GameObject val = buildPieces.Find((GameObject x) => ((Object)x).name == "piece_oven"); oven = val.GetComponent<CookingStation>(); } addConversion(((Component)oven).gameObject, "FishWrapsUncooked_bal", "FishWraps", ConversionType.cooking, 50); } public void editCooking(CookingStation oven = null) { if (buildPieces != null && (Object)(object)oven == (Object)null) { GameObject val = buildPieces.Find((GameObject x) => ((Object)x).name == "piece_cookingstation"); oven = val.GetComponent<CookingStation>(); } addConversion(((Component)oven).gameObject, "BatWing_bal", "BatWingCooked_bal", ConversionType.cooking, 25); addConversion(((Component)oven).gameObject, "GoatMeat_bal", "GoatMeatCooked_bal", ConversionType.cooking, 40); addConversion(((Component)oven).gameObject, "RawCrowMeat_bal", "CookedCrowMeat_bal", ConversionType.cooking); addConversion(((Component)oven).gameObject, "RawSteak_bal", "SteakCooked_bal", ConversionType.cooking); addConversion(((Component)oven).gameObject, "SharkMeat_bal", "SharkMeatCooked_bal", ConversionType.cooking, 35); addConversion(((Component)oven).gameObject, "CrabLegs_bal", "CrabLegsCooked_bal", ConversionType.cooking); addConversion(((Component)oven).gameObject, "TrollMeat_bal", "TrollMeatCooked_bal", ConversionType.cooking, 60); } public void editIronCooking(CookingStation oven = null) { if (buildPieces != null && (Object)(object)oven == (Object)null) { GameObject val = buildPieces.Find((GameObject x) => ((Object)x).name == "piece_cookingstation_iron"); oven = val.GetComponent<CookingStation>(); } addConversion(((Component)oven).gameObject, "CrabLegs_bal", "CrabLegsCooked_bal", ConversionType.cooking, 25); addConversion(((Component)oven).gameObject, "SharkMeat_bal", "SharkMeatCooked_bal", ConversionType.cooking); addConversion(((Component)oven).gameObject, "FenringMeat_bal", "FenringMeatCooked_bal", ConversionType.cooking, 60); addConversion(((Component)oven).gameObject, "RawCrowMeat_bal", "CookedCrowMeat_bal", ConversionType.cooking); addConversion(((Component)oven).gameObject, "RawSteak_bal", "SteakCooked_bal", ConversionType.cooking, 20); addConversion(((Component)oven).gameObject, "BatWing_bal", "BatWingCooked_bal", ConversionType.cooking, 20); addConversion(((Component)oven).gameObject, "GoatMeat_bal", "GoatMeatCooked_bal", ConversionType.cooking, 35); addConversion(((Component)oven).gameObject, "DrakeMeat_bal", "DrakeMeatCooked_bal", ConversionType.cooking); addConversion(((Component)oven).gameObject, "TrollMeat_bal", "TrollMeatCooked_bal", ConversionType.cooking, 60); } public void editWHeel(Smelter wheel = null) { if (buildPieces != null && (Object)(object)wheel == (Object)null) { GameObject val = buildPieces.Find((GameObject x) => ((Object)x).name == "piece_spinningwheel"); wheel = val.GetComponent<Smelter>(); } wheel.m_maxOre = 80; wheel.m_secPerProduct = 25f; addConversion(((Component)wheel).gameObject, "Straw_bal", "StrawThread_bal", ConversionType.smelter); addConversion(((Component)wheel).gameObject, "RawSilk_bal", "SilkReinforcedThread_bal", ConversionType.smelter); } public void editSap(SapCollector sap = null) { if (buildPieces != null && (Object)(object)sap == (Object)null) { GameObject val = buildPieces.Find((GameObject x) => ((Object)x).name == "piece_sapcollector"); sap = val.GetComponent<SapCollector>(); } sap.m_secPerUnit = 45f; sap.m_maxLevel = 30; } public void editWIndMIll(Smelter windmill = null) { if (buildPieces != null) { GameObject val = buildPieces.Find((GameObject x) => ((Object)x).name == "windmill"); windmill = val.GetComponent<Smelter>(); } windmill.m_maxOre = 60; windmill.m_secPerProduct = 10f; } public void editKiln(Smelter kiln = null) { if (buildPieces != null) { GameObject val = buildPieces.Find((GameObject x) => ((Object)x).name == "charcoal_kiln"); kiln = val.GetComponent<Smelter>(); } kiln.m_maxOre = 50; kiln.m_secPerProduct = 10f; addConversion(((Component)kiln).gameObject, "Clay_bal", "ClayBrick_bal", ConversionType.smelter); } private void editBeehive() { GameObject val = buildPieces.Find((GameObject x) => ((Object)x).name == "piece_beehive"); Beehive component = val.GetComponent<Beehive>(); component.m_maxHoney = 20; } private void addConversion(GameObject source, string nameIn, string nameOut, ConversionType type, int time = 30, int amount = 5) { switch (type) { case ConversionType.smelter: SmelterConversion(source, nameIn, nameOut); break; case ConversionType.fermenter: FermenterConversion(source, nameIn, nameOut, amount); break; case ConversionType.cooking: CookingConversion(source, nameIn, nameOut, time); break; case ConversionType.balrondConverter: BalrondConversion(source, nameIn, nameOut, amount); break; } } private void BalrondConversion(GameObject source, string nameIn, string nameOut, int amount = 1, List<GameObject> list = null) { BalrondConverter component = source.GetComponent<BalrondConverter>(); BalrondConverter.ItemConversion itemConversion = new BalrondConverter.ItemConversion(); itemConversion.m_from = FindItem(nameIn, list).GetComponent<ItemDrop>(); itemConversion.m_to = FindItem(nameOut, list).GetComponent<ItemDrop>(); itemConversion.m_count = amount; component.m_conversion.Add(itemConversion); } private void SmelterConversion(GameObject source, string nameIn, string nameOut) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Expected O, but got Unknown Smelter component = source.GetComponent<Smelter>(); ItemConversion val = new ItemConversion(); val.m_from = FindItem(nameIn).GetComponent<ItemDrop>(); val.m_to = FindItem(nameOut).GetComponent<ItemDrop>(); component.m_conversion.Add(val); } private void FermenterConversion(GameObject source, string nameIn, string nameOut, int amount = 1) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Expected O, but got Unknown Fermenter component = source.GetComponent<Fermenter>(); ItemConversion val = new ItemConversion(); val.m_from = FindItem(nameIn).GetComponent<ItemDrop>(); val.m_to = FindItem(nameOut).GetComponent<ItemDrop>(); val.m_producedItems = amount; component.m_conversion.Add(val); } private void CookingConversion(GameObject source, string nameIn, string nameOut, int time = 25) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Expected O, but got Unknown CookingStation component = source.GetComponent<CookingStation>(); ItemConversion val = new ItemConversion(); val.m_from = FindItem(nameIn).GetComponent<ItemDrop>(); val.m_to = FindItem(nameOut).GetComponent<ItemDrop>(); val.m_cookTime = time; component.m_conversion.Add(val); } } [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 = "$tag_sawmill_addWood"; public string m_emptyOreTooltip = "$tag_sawmill_pickupWood"; 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; } 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)) { 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; } ItemConversion itemConversion = GetItemConversion(ore); 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, itemConversion.m_count, false); return; } int num = @int + itemConversion.m_count; if (itemConversion == null || num >= itemConversion.m_to.m_itemData.m_shared.m_maxStackSize) { Spawn(ore, @int); Spawn(ore, itemConversion.m_count); 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, itemConversion.m_count, 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); } 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}) "); m_sb.Append("\n[<color=yellow><b>$KEY_Use</b></color>] " + m_addOreTooltip); return Localization.instance.Localize(m_sb.ToString()); } } public class FueledHive : MonoBehaviour, Hoverable, Interactable { [Serializable] public class ItemConversion { public ItemDrop m_from; public int value; } public string m_name = "$tag_piece_birdhouse"; public Transform m_spawnPoint; public GameObject m_beeEffect; public bool m_effectOnlyInDaylight = true; [BitMask(typeof(Biome))] public Biome m_biome; public float m_secPerUnit = 12f; public int m_producedItemAmount = 20; public ItemDrop m_producedItem; public EffectList m_spawnEffect = new EffectList(); [Header("Texts")] public string m_extractText = "$tag_pickFeathers"; public string m_checkText = "$tag_birdAreBusy"; public string m_areaText = "$piece_beehive_area"; public string m_freespaceText = "$piece_beehive_freespace"; public string m_sleepText = "$tag_birdAreSleeping"; public string m_happyText = "$tag_birdAreHappy"; public string m_hungryText = "$tag_birdAreHungry"; public string m_notConnectedText; public string m_blockedText; public ZNetView m_nview; public Piece m_piece; public ItemDrop m_fuelItem; public List<ItemConversion> m_conversion = new List<ItemConversion>(); public EffectList m_fuelAddedEffects = new EffectList(); public int m_maxFuel = 10; public void Awake() { m_nview = ((Component)this).GetComponent<ZNetView>(); m_piece = ((Component)this).GetComponent<Piece>(); if (m_nview.GetZDO() != null) { if (m_nview.IsOwner() && m_nview.GetZDO().GetLong(ZDOVars.s_lastTime, 0L) == 0) { m_nview.GetZDO().Set(ZDOVars.s_lastTime, ZNet.instance.GetTime().Ticks); } m_nview.Register("RPC_ExtractFeathers", (Action<long>)RPC_ExtractFeathers); m_nview.Register("RPC_AddFuel", (Action<long>)RPC_AddFuel); 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("UpdateBirds", 0f, 10f); } } 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"); } int featherAmount = GetFeatherAmount(); if (featherAmount <= 0) { return Localization.instance.Localize($"{m_name} ({m_fuelItem.m_itemData.m_shared.m_name} {Mathf.Ceil(GetFuel())}/{m_maxFuel})\n[<color=yellow><b>1-8</b></color>] $piece_smelter_add {m_fuelItem.m_itemData.m_shared.m_name}") + Localization.instance.Localize(" ( $piece_container_empty )\n[<color=yellow><b>$KEY_Use</b></color>] " + m_checkText); } return Localization.instance.Localize($"{m_name} ({m_fuelItem.m_itemData.m_shared.m_name} {Mathf.Ceil(GetFuel())}/{m_maxFuel})\n[<color=yellow><b>1-8</b></color>] $piece_smelter_add {m_fuelItem.m_itemData.m_shared.m_name}") + Localization.instance.Localize($" ( {m_producedItem.m_itemData.m_shared.m_name} x {featherAmount} )\n[<color=yellow><b>$KEY_Use</b></color>] {m_extractText}"); } public string GetHoverName() { return m_name; } public bool Interact(Humanoid character, bool repeat, bool alt) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) if (repeat) { return false; } if (!PrivateArea.CheckAccess(((Component)this).transform.position, 0f, true, false)) { return true; } if (GetFeatherAmount() > 0) { Extract(); Game.instance.IncrementPlayerStat((PlayerStatType)76, 1f); } else { if (!HaveFuel()) { ((Character)character).Message((MessageType)2, m_hungryText, 0, (Sprite)null); return true; } if (!EnvMan.IsDaylight() && m_effectOnlyInDaylight) { ((Character)character).Message((MessageType)2, m_sleepText, 0, (Sprite)null); return true; } ((Character)character).Message((MessageType)2, m_happyText, 0, (Sprite)null); } return true; } public bool UseItem(Humanoid user, ItemData item) { if (item != null && !IsItemAllowed(item)) { ((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; } ((Character)user).Message((MessageType)2, "$msg_added " + item.m_shared.m_name, 0, (Sprite)null); user.GetInventory().RemoveItem(item.m_shared.m_name, 1, -1, true); m_nview.InvokeRPC("RPC_AddFuel", Array.Empty<object>()); return true; } public void Extract() { m_nview.InvokeRPC("RPC_ExtractFeathers", Array.Empty<object>()); } public void RPC_ExtractFeathers(long caller) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) int featherAmount = GetFeatherAmount(); if (featherAmount <= 0) { return; } m_spawnEffect.Create(m_spawnPoint.position, Quaternion.identity, (Transform)null, 1f, -1); for (int i = 0; i < featherAmount; i++) { Vector2 val = Random.insideUnitCircle * 0.5f; ItemDrop component = ((Component)Object.Instantiate<ItemDrop>(m_producedItem, m_spawnPoint.position + new Vector3(val.x, 0.25f * (float)i, val.y), Quaternion.identity)).GetComponent<ItemDrop>(); if (component != null) { component.SetStack(Game.instance.ScaleDrops(m_producedItem.m_itemData, 1)); } } ResetLevel(); } public float GetTimeSinceLastUpdate() { DateTime dateTime = new DateTime(m_nview.GetZDO().GetLong(ZDOVars.s_lastTime, ZNet.instance.GetTime().Ticks)); DateTime time = ZNet.instance.GetTime(); TimeSpan timeSpan = time - dateTime; m_nview.GetZDO().Set(ZDOVars.s_lastTime, time.Ticks); double num = timeSpan.TotalSeconds; if (num < 0.0) { num = 0.0; } return (float)num; } public void ResetLevel() { m_nview.GetZDO().Set(ZDOVars.s_level, 0, false); } public void IncreseLevel(int i) { int num = Mathf.Clamp(GetFeatherAmount() + i, 0, m_producedItemAmount); m_nview.GetZDO().Set(ZDOVars.s_level, num, false); } public int GetFeatherAmount() { return m_nview.GetZDO().GetInt(ZDOVars.s_level, 0); } public void UpdateBirds() { bool flag = HaveFuel(); if (m_nview.IsOwner() && flag) { float timeSinceLastUpdate = GetTimeSinceLastUpdate(); float num = m_nview.GetZDO().GetFloat(ZDOVars.s_product, 0f) + timeSinceLastUpdate; if ((double)num > (double)m_secPerUnit) { SetFuel(GetFuel() - 0.1f); IncreseLevel((int)((double)num / (double)m_secPerUnit)); num = 0f; } m_nview.GetZDO().Set(ZDOVars.s_product, num); } } private void OnDestroyed() { if (m_nview.IsOwner()) { DropAllItems(); } } private void DropAllItems() { //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) if ((Object)(object)m_fuelItem != (Object)null) { float num = ((m_nview.GetZDO() == null) ? 0f : m_nview.GetZDO().GetFloat(ZDOVars.s_fuel, 0f)); for (int i = 0; i < (int)num; i++) { ItemDrop.OnCreateNew(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))); } } } private float GetFuel() { return (!m_nview.IsValid()) ? 0f : m_nview.GetZDO().GetFloat(ZDOVars.s_fuel, 0f); } private bool HaveFuel() { return GetFuel() > 0f; } private void SetFuel(float fuel) { if (m_nview.IsValid()) { m_nview.GetZDO().Set(ZDOVars.s_fuel, fuel); } } 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 bool IsItemAllowed(ItemData item) { return IsItemAllowed(((Object)item.m_dropPrefab).name); } private bool IsItemAllowed(string itemName) { return ((Object)m_fuelItem).name == itemName; } } public class NatureSpawner : MonoBehaviour { public static List<PlantSeeder> plantSeeders = new List<PlantSeeder>(); public const float dt = 2f; public GameObject m_prefab; public float m_spawnIntervalSec = 600f; public float m_triggerDistance = 200f; public float m_spawnRadius = 80f; public float m_nearRadius = 25f; public float m_farRadius = 100f; public int m_maxNear = 2; public int m_maxTotal = 6; public bool m_onGroundOnly = true; public EffectList m_spawnEffects = new EffectList(); public ZNetView m_nview; public float m_spawnTimer; public void Awake() { m_nview = ((Component)this).GetComponent<ZNetView>(); m_spawnIntervalSec = Random.Range(300, 600); m_triggerDistance = Random.Range(300, 600); m_spawnRadius = m_triggerDistance * 0.8f; m_farRadius = m_triggerDistance; m_nearRadius = m_triggerDistance / 4f; ((MonoBehaviour)this).InvokeRepeating("UpdateSpawn", 10f, 10f); } public double TimeSincePlanted() { DateTime dateTime = new DateTime(m_nview.GetZDO().GetLong(ZDOVars.s_plantTime, ZNet.instance.GetTime().Ticks)); return (ZNet.instance.GetTime() - dateTime).TotalSeconds; } public void UpdateSpawn() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) if (m_nview.IsOwner() && !ZNetScene.instance.OutsideActiveArea(((Component)this).transform.position) && Player.IsPlayerInRange(((Component)this).transform.position, m_triggerDistance)) { m_spawnTimer += 10f; if (!((double)m_spawnTimer <= (double)m_spawnIntervalSec)) { m_spawnTimer = 0f; SpawnOne(); } } } public bool SpawnOne() { //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)m_prefab == (Object)null) { Debug.Log((object)("Prefab is null on tree: " + ((Object)((Component)this).gameObject).name)); return false; } GetInstances(out var near, out var total); if (near >= m_maxNear || total >= m_maxTotal) { return false; } if ((Object)(object)m_prefab == (Object)null || !FindSpawnPoint(m_prefab, out var point)) { return false; } GameObject val = Object.Instantiate<GameObject>(m_prefab, point, Quaternion.Euler(0f, (float)Random.Range(0, 360), 0f)); plantSeeders = plantSeeders.FindAll((PlantSeeder x) => (Object)(object)x != (Object)null); return true; } public bool FindSpawnPoint(GameObject prefab, out Vector3 point) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0060: 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) //IL_00be: 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_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) prefab.GetComponent<BaseAI>(); float num = default(float); for (int i = 0; i < 10; i++) { Vector3 val = ((Component)this).transform.position + Quaternion.Euler(0f, (float)Random.Range(0, 360), 0f) * Vector3.forward * Random.Range(0f, m_spawnRadius); if (ZoneSystem.instance.FindFloor(val, ref num) && (!m_onGroundOnly || !ZoneSystem.instance.IsBlocked(val))) { val.y = num + 0.1f; point = val; return true; } } point = Vector3.zero; return false; } public void GetInstances(out int near, out int total) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) near = 0; total = 0; Vector3 position = ((Component)this).transform.position; foreach (PlantSeeder plantSeeder in plantSeeders) { if (!((Object)(object)plantSeeder == (Object)null) && IsSpawnPrefab(plantSeeder)) { double num = Utils.DistanceXZ(((Component)plantSeeder).transform.position, position); if (num < (double)m_nearRadius) { near++; } if (num < (double)m_farRadius) { total++; } } } } public bool IsSpawnPrefab(PlantSeeder go) { if ((Object)(object)go == (Object)null) { return false; } string name = ((Object)go).name; if (Utils.CustomStartsWith(name, ((Object)m_prefab).name)) { return true; } return false; } public void OnDrawGizmosSelected() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) Gizmos.color = Color.red; Gizmos.DrawWireSphere(((Component)this).transform.position, m_spawnRadius); Gizmos.color = Color.yellow; Gizmos.DrawWireSphere(((Component)this).transform.position, m_nearRadius); } } public class DestructableTimeedDestruction : MonoBehaviour { public float m_timeout = 1f; public bool m_triggerOnAwake; [Tooltip("If there are objects that you always want to destroy, even if there is no owner, check this. For instance, fires in the ashlands may be created by cinder rain outside of ownership-zones, so they must be deleted even if no owner exists.")] public bool m_forceTakeOwnershipAndDestroy; public ZNetView m_nview; public Destructible m_destructible; public void Awake() { m_destructible = ((Component)this).GetComponent<Destructible>(); m_nview = ((Component)this).GetComponent<ZNetView>(); if (m_triggerOnAwake) { Trigger(); } } public void Trigger() { ((MonoBehaviour)this).InvokeRepeating("DestroyNow", m_timeout, 1f); } public void Trigger(float timeout) { ((MonoBehaviour)this).InvokeRepeating("DestroyNow", timeout, 1f); } public void DestroyNow() { m_destructible.Destroy((HitData)null); } } public class PlantSeeder : SlowUpdate { public GameObject m_prefabToGrow; public float m_growTime = 3600f; public float m_growTimeMax = 6000f; public float m_minScale = 0.75f; public float m_maxScale = 1.25f; public float m_growRadius = 0.5f; public ZNetView m_nview; public float m_updateTime; public float m_spawnTime; public int m_seed; public string m_name = "PlantSeeder"; public bool m_destroyIfCantGrow; public EffectList m_growEffect = new EffectList(); public override void Awake() { ((SlowUpdate)this).Awake(); m_nview = ((Component)this).gameObject.GetComponent<ZNetView>(); if (m_nview.GetZDO() != null) { m_seed = m_nview.GetZDO().GetInt(ZDOVars.s_seed, 0); if (m_seed == 0) { m_seed = (int)(((ZDOID)(ref m_nview.GetZDO().m_uid)).ID + ((ZDOID)(ref m_nview.GetZDO().m_uid)).UserID); m_nview.GetZDO().Set(ZDOVars.s_seed, m_seed, true); } if (m_nview.IsOwner() && m_nview.GetZDO().GetLong(ZDOVars.s_plantTime, 0L) == 0) { m_nview.GetZDO().Set(ZDOVars.s_plantTime, ZNet.instance.GetTime().Ticks); } m_spawnTime = Time.time; NatureSpawner.plantSeeders.Add(this); } } public double TimeSincePlanted() { DateTime dateTime = new DateTime(m_nview.GetZDO().GetLong(ZDOVars.s_plantTime, ZNet.instance.GetTime().Ticks)); return (ZNet.instance.GetTime() - dateTime).TotalSeconds; } public override void SUpdate() { if (m_nview.IsValid() && !((double)Time.time - (double)m_updateTime < 10.0)) { m_updateTime = Time.time; double num = TimeSincePlanted(); float growTime = GetGrowTime(); if (m_nview.IsOwner() && !((double)Time.time - (double)m_spawnTime <= 10.0) && !(num <= (double)growTime)) { Grow(); } } } public GameObject Grow() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) GameObject prefabToGrow = m_prefabToGrow; Vector3 position = ((Component)this).transform.position; Quaternion rotation = ((Component)this).transform.rotation; Vector3 val = position; Quaternion val2 = rotation; GameObject val3 = Object.Instantiate<GameObject>(prefabToGrow, val, val2); Plant component = val3.GetComponent<Plant>(); component.m_destroyIfCantGrow = true; component.m_growRadius = 1f; ZLog.Log((object)("Starting to grow plant- " + ((Object)prefabToGrow).name + " -with rotation: " + ((object)(Quaternion)(ref rotation)).ToString())); ZNetView component2 = val3.GetComponent<ZNetView>(); float num = Random.Range(m_minScale, m_maxScale); Vector3 localScale = default(Vector3); ((Vector3)(ref localScale))..ctor(num, num, num); component2.SetLocalScale(localScale); if (Object.op_Implicit((Object)(object)m_nview)) { NatureSpawner.plantSeeders.Remove(this); m_growEffect.Create(((Component)this).transform.position, rotation, (Transform)null, num, -1); m_nview.Destroy(); } return val3; } public float GetGrowTime() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) State state = Random.state; Random.InitState(m_seed); float value = Random.value; Random.state = state; return Mathf.Lerp(m_growTime, m_growTimeMax, value); } } public class TerrainMover : MonoBehaviour { private void Awake() { Transform parent = ((Component)this).transform.parent; if ((Object)(object)parent != (Object)null) { Transform parent2 = parent.parent; ((Component)this).transform.parent = parent2; } Object.DestroyImmediate((Object)(object)this); } } public class TreeBeeSpawner : MonoBehaviour { public GameObject m_prefab; public TreeBase m_treeBase; public ZNetView m_nview; public int m_chance = 90; public int m_spawnIntervalSec = 20; public float offsetX = 0f; public float offsetY = 0f; public float offsetZ = 0f; public float m_spawnTimer; public GameObject m_spawnOnDamage; private GameObject m_hive; private EffectData m_effectData; public bool m_hasFollen = false; public void Awake() { m_nview = ((Component)this).GetComponent<ZNetView>(); m_treeBase = ((Component)this).GetComponent<TreeBase>(); ((MonoBehaviour)this).InvokeRepeating("UpdateSpawn", 10f, 10f); m_spawnIntervalSec = Random.Range(120, 240); if ((Object)(object)m_prefab != (Object)null) { SpawnOnDamaged component = m_prefab.GetComponent<SpawnOnDamaged>(); if ((Object)(object)component != (Object)null) { m_spawnOnDamage = component.m_spawnOnDamage; } } AddBeeAoEToHit(); } public double TimeSincePlanted() { DateTime dateTime = new DateTime(m_nview.GetZDO().GetLong(ZDOVars.s_plantTime, ZNet.instance.GetTime().Ticks)); return (ZNet.instance.GetTime() - dateTime).TotalSeconds; } public void Damage(HitData hit) { m_nview.InvokeRPC("RPC_Damage", new object[1] { hit }); } public void UpdateSpawn() { //IL_0033: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)m_hive == (Object)null) { toggleActive(active: false); } if (m_nview.IsOwner() && !ZNetScene.instance.OutsideActiveArea(((Component)this).transform.position)) { m_spawnTimer += 10f; if (!((double)m_spawnTimer <= (double)m_spawnIntervalSec)) { m_spawnTimer = 0f; SpawnOne(); } } } public bool SpawnOne() { if ((Object)(object)m_prefab == (Object)null || (Object)(object)m_hive != (Object)null) { return false; } int num = Random.Range(1, 100); if (num <= m_chance) { spawnHive(); } return true; } public void hiveFall() { if ((Object)(object)m_hive != (Object)null && !m_hasFollen) { m_hive.GetComponent<StaticPhysics>().m_fall = true; m_hive.GetComponent<WearNTear>().m_noSupportWear = false; m_hasFollen = true; } } public bool HasHive() { return (Object)(object)m_hive != (Object)null; } private void spawnHive() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) GameObject val = Object.Instantiate<GameObject>(m_prefab, m_treeBase.m_logSpawnPoint.position, Quaternion.Euler(0f, 90f, 0f)); StaticPhysics val2 = val.AddComponent<StaticPhysics>(); val2.m_fall = false; val2.m_pushUp = true; toggleActive(active: true); m_hive = val; } private void toggleActive(bool active) { if (m_effectData != null) { m_effectData.m_enabled = active; } } private void AddBeeAoEToHit() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown if ((Object)(object)m_spawnOnDamage != (Object)null) { m_effectData = new EffectData(); m_effectData.m_prefab = m_spawnOnDamage; m_effectData.m_enabled = true; m_effectData.m_variant = -1; CollectionExtensions.AddItem<EffectData>((IEnumerable<EffectData>)m_treeBase.m_hitEffect.m_effectPrefabs, m_effectData); } } } 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 { public void ReplaceOnObject(GameObject gameObject, ZNetScene zNetScene) { 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, zNetScene); } } Destructible component2 = gameObject.GetComponent<Destructible>(); if ((Object)(object)component2 != (Object)null) { EffectList hitEffect = component2.m_hitEffect; if (hitEffect != null) { findEffectsAndChange(hitEffect.m_effectPrefabs, zNetScene); } EffectList destroyedEffect = component2.m_destroyedEffect; if (destroyedEffect != null) { findEffectsAndChange(destroyedEffect.m_effectPrefabs, zNetScene); } } Projectile component3 = gameObject.GetComponent<Projectile>(); if ((Object)(object)component3 != (Object)null) { EffectList hitEffects = component3.m_hitEffects; if (hitEffects != null) { findEffectsAndChange(hitEffects.m_effectPrefabs, zNetScene); } EffectList hitWaterEffects = component3.m_hitWaterEffects; if (hitWaterEffects != null) { findEffectsAndChange(hitWaterEffects.m_effectPrefabs, zNetScene); } EffectList spawnOnHitEffects = component3.m_spawnOnHitEffects; if (spawnOnHitEffects != null) { findEffectsAndChange(spawnOnHitEffects.m_effectPrefabs, zNetScene); } } } public void ReplaceOnVegetation(GameObject gameObject, ZNetScene zNetScene) { Pickable component = gameObject.GetComponent<Pickable>(); if ((Object)(object)component != (Object)null) { fixPlant(component, zNetScene); } Destructible component2 = gameObject.GetComponent<Destructible>(); if ((Object)(object)component2 != (Object)null) { fixPDestructable(component2, zNetScene); } MineRock5 component3 = gameObject.GetComponent<MineRock5>(); if ((Object)(object)component3 != (Object)null) { fixMineRock5(component3, zNetScene); } MineRock component4 = gameObject.GetComponent<MineRock>(); if ((Object)(object)component4 != (Object)null) { fixMineRock(component4, zNetScene); } } private void fixPlant(Pickable pickable, ZNetScene zNetScene) { EffectList pickEffector = pickable.m_pickEffector; if (pickEffector != null) { findEffectsAndChange(pickEffector.m_effectPrefabs, zNetScene); } } private void fixPDestructable(Destructible minerock5, ZNetScene zNetScene) { EffectList hitEffect = minerock5.m_hitEffect; if (hitEffect != null) { findEffectsAndChange(hitEffect.m_effectPrefabs, zNetScene); } EffectList destroyedEffect = minerock5.m_destroyedEffect; if (destroyedEffect != null) { findEffectsAndChange(destroyedEffect.m_effectPrefabs, zNetScene); } } private void fixMineRock5(MineRock5 minerock5, ZNetScene zNetScene) { EffectList hitEffect = minerock5.m_hitEffect; if (hitEffect != null) { findEffectsAndChange(hitEffect.m_effectPrefabs, zNetScene); } EffectList destroyedEffect = minerock5.m_destroyedEffect; if (destroyedEffect != null) { findEffectsAndChange(destroyedEffect.m_effectPrefabs, zNetScene); } } private void fixMineRock(MineRock minerock5, ZNetScene zNetScene) { EffectList hitEffect = minerock5.m_hitEffect; if (hitEffect != null) { findEffectsAndChange(hitEffect.m_effectPrefabs, zNetScene); } EffectList destroyedEffect = minerock5.m_destroyedEffect; if (destroyedEffect != null) { findEffectsAndChange(destroyedEffect.m_effectPrefabs, zNetScene); } } public void ReplaceOnMonster(GameObject gameObject, ZNetScene zNetScene) { if ((Object)(object)gameObject == (Object)null) { Debug.LogWarning((object)(Launch.projectName + ":: GameObject not found")); return; } Humanoid component = gameObject.GetComponent<Humanoid>(); if ((Object)(object)component == (Object)null) { Debug.LogWarning((object)(Launch.projectName + ":: GameObject not found")); return; } EffectList dropEffects = component.m_dropEffects; if (dropEffects != null) { findEffectsAndChange(dropEffects.m_effectPrefabs, zNetScene); } EffectList backstabHitEffects = ((Character)component).m_backstabHitEffects; if (backstabHitEffects != null) { findEffectsAndChange(backstabHitEffects.m_effectPrefabs, zNetScene); } EffectList consumeItemEffects = component.m_consumeItemEffects; if (consumeItemEffects != null) { findEffectsAndChange(consumeItemEffects.m_effectPrefabs, zNetScene); } EffectList critHitEffects = ((Character)component).m_critHitEffects; if (critHitEffects != null) { findEffectsAndChange(critHitEffects.m_effectPrefabs, zNetScene); } EffectList deathEffects = ((Character)component).m_deathEffects; if (deathEffects != null) { findEffectsAndChange(deathEffects.m_effectPrefabs, zNetScene); } EffectList hitEffects = ((Character)component).m_hitEffects; if (hitEffects != null) { findEffectsAndChange(hitEffects.m_effectPrefabs, zNetScene); } EffectList jumpEffects = ((Character)component).m_jumpEffects; if (jumpEffects != null) { findEffectsAndChange(jumpEffects.m_effectPrefabs, zNetScene); } EffectList perfectBlockEffect = component.m_perfectBlockEffect; if (perfectBlockEffect != null) { findEffectsAndChange(perfectBlockEffect.m_effectPrefabs, zNetScene); } EffectList pickupEffects = component.m_pickupEffects; if (pickupEffects != null) { findEffectsAndChange(pickupEffects.m_effectPrefabs, zNetScene); } EffectList slideEffects = ((Character)component).m_slideEffects; if (slideEffects != null) { findEffectsAndChange(slideEffects.m_effectPrefabs, zNetScene); } EffectList tarEffects = ((Character)component).m_tarEffects; if (tarEffects != null) { findEffectsAndChange(tarEffects.m_effectPrefabs, zNetScene); } EffectList waterEffects = ((Character)component).m_waterEffects; if (waterEffects != null) { findEffectsAndChange(waterEffects.m_effectPrefabs, zNetScene); } 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 = ZNetScene.instance.m_prefabs.Find((GameObject x) => ((Object)x).name == name); if (!((Object)(object)val == (Object)null)) { list[i] = val; } } } } } public void ReplaceOnItem(GameObject gameObject, ZNetScene zNetScene) { 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, zNetScene); } EffectList hitTerrainEffect = component.m_itemData.m_shared.m_hitTerrainEffect; if (hitTerrainEffect != null) { findEffectsAndChange(hitTerrainEffect.m_effectPrefabs, zNetScene); } EffectList holdStartEffect = component.m_itemData.m_shared.m_holdStartEffect; if (holdStartEffect != null) { findEffectsAndChange(holdStartEffect.m_effectPrefabs, zNetScene); } EffectList trailStartEffect = component.m_itemData.m_shared.m_trailStartEffect; if (trailStartEffect != null) { findEffectsAndChange(trailStartEffect.m_effectPrefabs, zNetScene); } EffectList blockEffect = component.m_itemData.m_shared.m_blockEffect; if (blockEffect != null) { findEffectsAndChange(blockEffect.m_effectPrefabs, zNetScene); } } } public void ReplaceFxOnPiece(GameObject gameObject, ZNetScene zNetScene) { 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, zNetScene); } } WearNTear component2 = gameObject.GetComponent<WearNTear>(); if ((Object)(object)component2 != (Object)null) { EffectList hitEffect = component2.m_hitEffect; if (hitEffect != null) { findEffectsAndChange(hitEffect.m_effectPrefabs, zNetScene); } } } private void findEffectsAndChange(EffectData[] effects, ZNetScene zNetScene) { 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 = zNetScene.m_prefabs.Find((GameObject x) => (Object)(object)x != (Object)null && ((Object)x).name == name); if ((Object)(object)val2 != (Object)null) { val.m_prefab = val2; } else { Debug.LogWarning((object)("Coulnt not find in Znet fx name:" + name)); } } } } } [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 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<Sprite> backgrounds = new List<Sprite>(); public FxReplacment fxReplacment = new FxReplacment(); public List<Recipe> recipes = new List<Recipe>(); public List<StatusEffect> statusEffects = new List<StatusEffect>(); public VegetationDropFix vegetationDropFix = new VegetationDropFix(); public static Sprite scrapCopper; public StatusEffect newBarleyStatus = null; public ShaderReplacment shaderReplacment = new ShaderReplacment(); public Sprite newLogo = null; public void loadAssets() { assetBundle = GetAssetBundleFromResources("balrondnature"); string text = "Assets/Custom/BalrondNature/"; scrapCopper = assetBundle.LoadAsset<Sprite>(text + "icons/scrapCopperIco_bal.png"); loadPieces(text); loadPlants(text); loadItems(text); loadVegetation(text); loadClutter(text); loadOther(text); loadBackground(text); } public void AddPrefabsToZnetScene(ZNetScene zNetScene) { zNetScene.m_prefabs.AddRange(itemPrefabs); zNetScene.m_prefabs.AddRange(plantPrefabs); zNetScene.m_prefabs.AddRange(vfxPrefabs); vegetationDropFix.items = zNetScene.m_prefabs; zNetScene.m_prefabs.AddRange(buildPrefabs); zNetScene.m_prefabs.AddRange(locationPrefabs); addTerrainMover(vegetationPrefabs); zNetScene.m_prefabs.AddRange(vegetationPrefabs); zNetScene.m_prefabs.AddRange(clutterPrefabs); zNetScene.m_prefabs.AddRange(monsterPrefabs); vegetationDropFix.fixDrops(zNetScene.m_prefabs, zNetScene); zNetScene.m_prefabs.RemoveAll((GameObject x) => (Object)(object)x == (Object)null); foreach (GameObject go in zNetScene.m_prefabs) { List<GameObject> list = zNetScene.m_prefabs.FindAll((GameObject x) => ((Object)x).name == ((Object)go).name); if (list.Count > 1) { Debug.LogWarning((object)("DUPLICATE: " + ((Object)go).name)); } } addPlantstoCultivator(zNetScene); setupBuildPiecesList(zNetScene); setBalrondConverter(zNetScene); setupBirdHouse(zNetScene); } private void addTerrainMover(List<GameObject> vegetationPrefabs) { foreach (GameObject vegetationPrefab in vegetationPrefabs) { TerrainModifier[] componentsInChildren = vegetationPrefab.GetComponentsInChildren<TerrainModifier>(); TerrainModifier[] array = componentsInChildren; foreach (TerrainModifier val in array) { if ((Object)(object)((Component)val).gameObject.AddComponent<TerrainMover>() == (Object)null) { ((Component)val).gameObject.AddComponent<TerrainMover>(); } } } } private void loadBackground(string mainPath) { string[] array = new string[5] { "ashlands1.jpg", "ashlands2.png", "blackforest.png", "mistlands.jpg", "meadows.png" }; string[] array2 = array; foreach (string text in array2) { Sprite val = assetBundle.LoadAsset<Sprite>(mainPath + "screens/" + text); if ((Object)(object)val == (Object)null) { Debug.LogWarning((object)("Could not find background with name: " + text)); } else { backgrounds.Add(val); } } } private void setupBuildPiecesList(ZNetScene zNetScene) { string[] array = new string[4] { "Hammer", "HammerIron_bal", "HammerDverger_bal", "HammerBlackmetal_bal" }; 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) { addTableToTool(name, buildPieces, zNetScene); } List<GameObject> pieces = buildPieces.m_pieces; foreach (GameObject buildPrefab in buildPrefabs) { setupRavenGuide(buildPrefab, zNetScene.m_prefabs); AddToBuildList(buildPrefab, pieces); } GameObject val2 = zNetScene.m_prefabs.Find((GameObject x) => ((Object)x).name == "Hoe"); PieceTable buildPieces2 = val2.GetComponent<ItemDrop>().m_itemData.m_shared.m_buildPieces; addTableToTool("BlackMetalHoe_bal", buildPieces2, zNetScene); GameObject val3 = zNetScene.m_prefabs.Find((GameObject x) => ((Object)x).name == "Cultivator"); PieceTable buildPieces3 = val3.GetComponent<ItemDrop>().m_itemData.m_shared.m_buildPieces; addTableToTool("BlackMetalCultivator_bal", buildPieces3, zNetScene); } private void addTableToTool(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(ZNetScene zNetScene) { fixBuildPiecesFX(zNetScene); fixVegetationFX(zNetScene); fixItemFX(zNetScene); fixMonsterFX(zNetScene); fixOtherFX(zNetScene); } private void fixVegetationFX(ZNetScene zNetScene) { foreach (GameObject vegetationPrefab in vegetationPrefabs) { fxReplacment.ReplaceOnVegetation(vegetationPrefab, zNetScene); } } private void fixBuildPiecesFX(ZNetScene zNetScene) { foreach (GameObject buildPrefab in buildPrefabs) { fxReplacment.ReplaceFxOnPiece(buildPrefab, zNetScene); } } private void fixItemFX(ZNetScene zNetScene) { foreach (GameObject itemPrefab in itemPrefabs) { fxReplacment.ReplaceOnItem(itemPrefab, zNetScene); } } private void fixMonsterFX(ZNetScene zNetScene) { foreach (GameObject monsterPrefab in monsterPrefabs) { fxReplacment.ReplaceOnMonster(monsterPrefab, zNetScene); } } private void fixOtherFX(ZNetScene zNetScene) { foreach (GameObject vfxPrefab in vfxPrefabs) { fxReplacment.ReplaceOnObject(vfxPrefab, zNetScene); } } 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[13] { "sapling_AppleTree_bal", "sapling_Straw_bal", "sapling_Cabbage_bal", "sapling_garlic_bal", "sapling_seedgarlic_bal", "sapling_CabbageSeed_bal", "sapling_Swamp_bal", "sapling_Willow_bal", "sapling_BirchAtumn_bal", "sapling_Poplar_bal", "sapling_Maple_bal", "sapling_Cypress_bal", "sapling_AcaiTree_bal" }; 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 pla