Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of TheFisher v0.3.6
TheFisher/TheFisher.dll
Decompiled 5 days 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.Concurrent; using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.IO; using System.IO.Compression; using System.Linq; using System.Linq.Expressions; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Serialization; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using System.Threading; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using ItemManager; using JetBrains.Annotations; using LocalizationManager; using LocationManager; using Microsoft.CodeAnalysis; using PieceManager; using ServerSync; using SoftReferenceableAssets; using TMPro; using UnityEngine; using UnityEngine.UI; using UpgradeWorld; using YamlDotNet.Core; using YamlDotNet.Core.Events; using YamlDotNet.Core.ObjectPool; using YamlDotNet.Core.Tokens; using YamlDotNet.Helpers; using YamlDotNet.Serialization; using YamlDotNet.Serialization.BufferedDeserialization; using YamlDotNet.Serialization.BufferedDeserialization.TypeDiscriminators; using YamlDotNet.Serialization.Callbacks; using YamlDotNet.Serialization.Converters; using YamlDotNet.Serialization.EventEmitters; using YamlDotNet.Serialization.NamingConventions; using YamlDotNet.Serialization.NodeDeserializers; using YamlDotNet.Serialization.NodeTypeResolvers; using YamlDotNet.Serialization.ObjectFactories; using YamlDotNet.Serialization.ObjectGraphTraversalStrategies; using YamlDotNet.Serialization.ObjectGraphVisitors; using YamlDotNet.Serialization.Schemas; using YamlDotNet.Serialization.TypeInspectors; using YamlDotNet.Serialization.TypeResolvers; using YamlDotNet.Serialization.Utilities; using YamlDotNet.Serialization.ValueDeserializers; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("TheFisher")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyProduct("TheFisher")] [assembly: AssemblyCopyright("Copyright © 2022")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("E74EB49A-461D-48EA-85BC-F462D60C98C4")] [assembly: AssemblyFileVersion("0.3.6")] [assembly: AssemblyCompany("Marlthon")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.3.6.0")] [module: UnverifiableCode] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [<ab18ee67-272f-452b-86e5-1b26bfcd0a80>Embedded] internal sealed class <ab18ee67-272f-452b-86e5-1b26bfcd0a80>EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [<ab18ee67-272f-452b-86e5-1b26bfcd0a80>Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class <f790232b-01fd-467a-96f4-30823fb5c82f>NullableAttribute : Attribute { public readonly byte[] NullableFlags; public <f790232b-01fd-467a-96f4-30823fb5c82f>NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public <f790232b-01fd-467a-96f4-30823fb5c82f>NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [<ab18ee67-272f-452b-86e5-1b26bfcd0a80>Embedded] internal sealed class <62587ffe-2ae2-456b-878e-3d41b7daf150>NullableContextAttribute : Attribute { public readonly byte Flag; public <62587ffe-2ae2-456b-878e-3d41b7daf150>NullableContextAttribute(byte P_0) { Flag = P_0; } } } [Obfuscation(Exclude = true, ApplyToMembers = true)] public class AquariumFish : MonoBehaviour { private enum FishState { Swimming, Decelerating, Idle, GoingToFeed, Feeding } private FishState currentState; [Header("Configurações de Nado")] public float swimSpeed = 1f; public float turnSpeed = 2f; [Range(0f, 90f)] public float maxPitchAngle = 45f; public float decelerationSpeed = 2f; public float stoppingDistance = 0.5f; [Header("Comportamento de Parada")] [Range(0f, 1f)] public float chanceToStop = 0.2f; public float minIdleTime = 2f; public float maxIdleTime = 6f; [Header("Área do Aquário")] [<f790232b-01fd-467a-96f4-30823fb5c82f>Nullable(1)] public Collider swimArea; public bool debugLogs = false; private Vector3 destination; private float idleTimer; private float currentSpeed; private bool isFeeding = false; private Vector3 feedingCenter; private float feedingTimer = 0f; private const float feedingDuration = 10f; private float orbitRadius; private float orbitAngle; private float orbitSpeed; private float orbitHeightOffset; private void Start() { if ((Object)(object)swimArea == (Object)null) { Transform parent = ((Component)this).transform.parent; while ((Object)(object)parent != (Object)null && (Object)(object)swimArea == (Object)null) { Collider[] componentsInChildren = ((Component)parent).GetComponentsInChildren<Collider>(true); Collider[] array = componentsInChildren; foreach (Collider val in array) { if ((Object)(object)val != (Object)null && val.isTrigger && ((Object)val).name.ToLower().Contains("colliderarea")) { swimArea = val; break; } } parent = parent.parent; } if ((Object)(object)swimArea == (Object)null) { Debug.LogError((object)("[Fish] " + ((Object)this).name + ": swimArea não encontrada!"), (Object)(object)this); ((Behaviour)this).enabled = false; return; } } ((MonoBehaviour)this).Invoke("InicializarPeixe", 0.1f); } private void InicializarPeixe() { //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_0019: Unknown result type (might be due to invalid IL or missing references) Collider obj = swimArea; Vector3 randomPositionInsideCollider = GetRandomPositionInsideCollider((BoxCollider)(object)((obj is BoxCollider) ? obj : null)); ((Component)this).transform.position = randomPositionInsideCollider; currentSpeed = swimSpeed; StartSwimming(); } private void Update() { if (!((Object)(object)swimArea == (Object)null)) { switch (currentState) { case FishState.Swimming: UpdateSwimmingState(); break; case FishState.Decelerating: UpdateDeceleratingState(); break; case FishState.Idle: UpdateIdleState(); break; case FishState.GoingToFeed: UpdateGoingToFeed(); break; case FishState.Feeding: UpdateFeeding(); break; } } } private void LateUpdate() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //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_002a: 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_0046: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)swimArea == (Object)null)) { Vector3 val = swimArea.ClosestPoint(((Component)this).transform.position); if (val != ((Component)this).transform.position) { ((Component)this).transform.position = val; SetNewDestination(); } } } private void UpdateSwimmingState() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) if (Vector3.Distance(((Component)this).transform.position, destination) < stoppingDistance) { if (Random.value < chanceToStop) { StartDecelerating(); } else { SetNewDestination(); } } else { MoveAndRotate(); } } private void UpdateDeceleratingState() { currentSpeed = Mathf.MoveTowards(currentSpeed, 0f, decelerationSpeed * Time.deltaTime); if (currentSpeed <= 0f) { StartIdling(); } else { MoveAndRotate(); } } private void UpdateIdleState() { idleTimer -= Time.deltaTime; if (idleTimer <= 0f) { StartSwimming(); } } private void MoveAndRotate() { //IL_0007: 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_001d: 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_002c: 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_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: 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) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0066: 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_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: 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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) Vector3 val = ((Component)this).transform.position + ((Component)this).transform.forward * currentSpeed * Time.deltaTime; Vector3 val2 = swimArea.ClosestPoint(val); if (val2 != val) { ref Vector3 reference = ref destination; Collider obj = swimArea; reference = GetRandomPositionInsideCollider((BoxCollider)(object)((obj is BoxCollider) ? obj : null)); } Vector3 val3 = destination - ((Component)this).transform.position; Vector3 normalized = ((Vector3)(ref val3)).normalized; val3 = new Vector3(normalized.x, 0f, normalized.z); Vector3 val4 = ((Vector3)(ref val3)).normalized; if (val4 == Vector3.zero) { val4 = ((Component)this).transform.forward; } Vector3 val5 = Vector3.RotateTowards(val4, normalized, maxPitchAngle * ((float)Math.PI / 180f), 1f); Quaternion val6 = Quaternion.LookRotation(val5); ((Component)this).transform.rotation = Quaternion.Slerp(((Component)this).transform.rotation, val6, turnSpeed * Time.deltaTime); Transform transform = ((Component)this).transform; transform.position += ((Component)this).transform.forward * currentSpeed * Time.deltaTime; } private void StartSwimming() { currentState = FishState.Swimming; currentSpeed = swimSpeed; SetNewDestination(); } private void StartDecelerating() { currentState = FishState.Decelerating; } private void StartIdling() { currentState = FishState.Idle; idleTimer = Random.Range(minIdleTime, maxIdleTime); } private void SetNewDestination() { //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) ref Vector3 reference = ref destination; Collider obj = swimArea; reference = GetRandomPositionInsideCollider((BoxCollider)(object)((obj is BoxCollider) ? obj : null)); } [<62587ffe-2ae2-456b-878e-3d41b7daf150>NullableContext(1)] private Vector3 GetRandomPositionInsideCollider(BoxCollider box) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0048: 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_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: 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_0017: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)box == (Object)null) { return ((Component)this).transform.position; } Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(Random.Range((0f - box.size.x) * 0.5f, box.size.x * 0.5f), Random.Range((0f - box.size.y) * 0.5f, box.size.y * 0.5f), Random.Range((0f - box.size.z) * 0.5f, box.size.z * 0.5f)); val += box.center; return ((Component)box).transform.TransformPoint(val); } public void MoveToTarget(Vector3 target) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: 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_005a: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)swimArea != (Object)null) { Vector3 val = swimArea.ClosestPoint(target); target = val; } feedingCenter = target; currentState = FishState.GoingToFeed; isFeeding = true; currentSpeed = swimSpeed; if (debugLogs) { Debug.Log((object)$"[Fish:{((Object)this).name}] indo comer em {feedingCenter}"); } } private void UpdateGoingToFeed() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //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_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_006a: 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_0080: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) Vector3 val = feedingCenter - ((Component)this).transform.position; float magnitude = ((Vector3)(ref val)).magnitude; if (magnitude > 0.2f) { ((Vector3)(ref val)).Normalize(); ((Component)this).transform.rotation = Quaternion.Slerp(((Component)this).transform.rotation, Quaternion.LookRotation(val), turnSpeed * Time.deltaTime); Transform transform = ((Component)this).transform; transform.position += ((Component)this).transform.forward * currentSpeed * Time.deltaTime; } else { orbitRadius = Random.Range(0.25f, 0.4f); orbitAngle = Random.Range(0f, 360f); orbitSpeed = Random.Range(45f, 60f); orbitHeightOffset = Random.Range(-0.1f, 0.15f); feedingTimer = 10f; currentState = FishState.Feeding; } } private void UpdateFeeding() { //IL_004a: 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_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_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: 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) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) feedingTimer -= Time.deltaTime; orbitAngle += orbitSpeed * Time.deltaTime; float num = orbitAngle * ((float)Math.PI / 180f); Vector3 val = new Vector3(Mathf.Cos(num), 0f, Mathf.Sin(num)) * orbitRadius; Vector3 val2 = feedingCenter + val; val2.y += orbitHeightOffset; Vector3 val3 = val2 - ((Component)this).transform.position; Vector3 normalized = ((Vector3)(ref val3)).normalized; Transform transform = ((Component)this).transform; transform.position += normalized * currentSpeed * Time.deltaTime; Vector3 val4 = default(Vector3); ((Vector3)(ref val4))..ctor(0f - Mathf.Sin(num), 0f, Mathf.Cos(num)); Quaternion val5 = Quaternion.LookRotation(((Vector3)(ref val4)).normalized, Vector3.up); ((Component)this).transform.rotation = Quaternion.Slerp(((Component)this).transform.rotation, val5, turnSpeed * Time.deltaTime); if (feedingTimer <= 0f) { isFeeding = false; currentState = FishState.Swimming; SetNewDestination(); } } } [Serializable] [<62587ffe-2ae2-456b-878e-3d41b7daf150>NullableContext(1)] [<f790232b-01fd-467a-96f4-30823fb5c82f>Nullable(0)] [Obfuscation(Exclude = true, ApplyToMembers = true)] public class MapeamentoPeixe { [Tooltip("Nome do item/prefab que o jogador usa (ex: TF1WhiteMulletDrop)")] public string nomeDoItem; [Tooltip("GameObject do peixe no aquário que será ativado")] public GameObject objetoDoPeixe; } [<62587ffe-2ae2-456b-878e-3d41b7daf150>NullableContext(1)] [Obfuscation(Exclude = true, ApplyToMembers = true)] [<f790232b-01fd-467a-96f4-30823fb5c82f>Nullable(0)] public class AquariumManager : MonoBehaviour, Hoverable, Interactable { [Header("Configuração")] public List<MapeamentoPeixe> mapeamentoDePeixes = new List<MapeamentoPeixe>(); public bool usarDeteccaoAutomatica = true; [Header("Textos de Interação")] public string m_hoverName = "$piece_aquarium_hoverName"; public string m_addFishText = "$piece_aquarium_addFishText"; public string m_feedFishText = "$piece_aquarium_feedFishText"; public string m_fishAlreadyExistsText = "$piece_aquarium_fishAlreadyExistsText"; public string m_fishAddedSuccessText = "$piece_aquarium_fishAddedSuccessText"; public string m_fishNotFoundText = "$piece_aquarium_fishNotFoundText"; [Header("Efeito de Alimentação")] public GameObject foodEffect; private ZNetView m_nview; private Dictionary<string, GameObject> peixesNoAquario = new Dictionary<string, GameObject>(); private bool peixesMapeados = false; private void Awake() { m_nview = ((Component)this).GetComponent<ZNetView>(); if ((Object)(object)m_nview == (Object)null) { m_nview = ((Component)this).GetComponentInParent<ZNetView>(); } if ((Object)(object)m_nview == (Object)null) { ((Behaviour)this).enabled = false; return; } m_nview.Register<string>("RPC_AddFish", (Action<long, string>)RPC_AddFish); m_nview.Register("RPC_FeedFish", (Action<long>)RPC_FeedFish); } private void Start() { MapearPeixesDoAquario(); if ((Object)(object)m_nview != (Object)null && m_nview.IsValid()) { CarregarEstadoDosPeixes(); } if ((Object)(object)foodEffect != (Object)null) { foodEffect.SetActive(false); } } private void MapearPeixesDoAquario() { if (peixesMapeados) { return; } if (mapeamentoDePeixes != null && mapeamentoDePeixes.Count > 0) { foreach (MapeamentoPeixe mapeamentoDePeix in mapeamentoDePeixes) { if (!((Object)(object)mapeamentoDePeix.objetoDoPeixe == (Object)null) && !string.IsNullOrEmpty(mapeamentoDePeix.nomeDoItem)) { string text = LimparNomeDoItem(mapeamentoDePeix.nomeDoItem); string key = ((Object)mapeamentoDePeix.objetoDoPeixe).name.Replace("(Clone)", "").Trim(); if (!peixesNoAquario.ContainsKey(key)) { peixesNoAquario.Add(key, mapeamentoDePeix.objetoDoPeixe); } } } } if (usarDeteccaoAutomatica) { Transform val = ((Component)this).transform; if ((Object)(object)m_nview != (Object)null) { Transform transform = ((Component)m_nview).transform; if ((Object)(object)transform != (Object)null) { val = transform; } } Transform[] componentsInChildren = ((Component)val).GetComponentsInChildren<Transform>(true); foreach (Transform val2 in componentsInChildren) { if (((Object)val2).name.StartsWith("TF")) { string key2 = ((Object)val2).name.Replace("(Clone)", "").Trim(); if (!peixesNoAquario.ContainsKey(key2)) { peixesNoAquario.Add(key2, ((Component)val2).gameObject); } } } } peixesMapeados = true; } public string GetHoverText() { return Localization.instance.Localize(m_hoverName + "\n[<color=yellow><b>1-8</b></color>] " + m_addFishText + "\n[<color=yellow><b>Use</b></color>] " + m_feedFishText); } public string GetHoverName() { return Localization.instance.Localize(m_hoverName); } public bool Interact(Humanoid user, bool hold, bool alt) { if (hold) { return false; } if ((Object)(object)m_nview == (Object)null || !m_nview.IsValid()) { return false; } m_nview.InvokeRPC(ZNetView.Everybody, "RPC_FeedFish", Array.Empty<object>()); ((Character)user).Message((MessageType)2, Localization.instance.Localize("$piece_aquarium_feed_success_msg"), 0, (Sprite)null); return true; } public bool UseItem(Humanoid user, ItemData item) { if ((Object)(object)m_nview == (Object)null || !m_nview.IsValid()) { return false; } if (item == null || (Object)(object)item.m_dropPrefab == (Object)null) { return false; } string nomeDoItem = LimparNomeDoItem(((Object)item.m_dropPrefab).name); string text = EncontrarPeixeNoAquario(nomeDoItem); if (text == null) { ((Character)user).Message((MessageType)2, m_fishNotFoundText, 0, (Sprite)null); return true; } string text2 = "fish_" + text; if (m_nview.GetZDO().GetBool(text2, false)) { ((Character)user).Message((MessageType)2, m_fishAlreadyExistsText, 0, (Sprite)null); return true; } m_nview.InvokeRPC("RPC_AddFish", new object[1] { text }); user.GetInventory().RemoveItem(item, 1); ((Character)user).Message((MessageType)2, m_fishAddedSuccessText, 0, (Sprite)null); return true; } private void RPC_AddFish(long sender, string nomePeixe) { if (!peixesNoAquario.ContainsKey(nomePeixe)) { return; } GameObject val = peixesNoAquario[nomePeixe]; if (!((Object)(object)val == (Object)null)) { val.SetActive(true); if (m_nview.IsOwner()) { string text = "fish_" + nomePeixe; m_nview.GetZDO().Set(text, true); } } } private void RPC_FeedFish(long sender) { //IL_00f0: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)foodEffect != (Object)null) { foodEffect.SetActive(true); ((MonoBehaviour)this).CancelInvoke("DesativarEfeito"); ((MonoBehaviour)this).Invoke("DesativarEfeito", 15f); } int num = 0; foreach (KeyValuePair<string, GameObject> item in peixesNoAquario) { GameObject value = item.Value; if ((Object)(object)value == (Object)null) { continue; } AquariumFish[] componentsInChildren = value.GetComponentsInChildren<AquariumFish>(true); if (componentsInChildren == null || componentsInChildren.Length == 0) { continue; } AquariumFish[] array = componentsInChildren; foreach (AquariumFish aquariumFish in array) { if (!((Object)(object)aquariumFish == (Object)null) && ((Component)aquariumFish).gameObject.activeInHierarchy && (Object)(object)foodEffect != (Object)null) { aquariumFish.MoveToTarget(foodEffect.transform.position); num++; } } } } private void DesativarEfeito() { if ((Object)(object)foodEffect != (Object)null) { foodEffect.SetActive(false); } } private string LimparNomeDoItem(string nome) { return nome.Replace("(Clone)", "").Replace("Drop", "").Trim() .ToLower(); } private string EncontrarPeixeNoAquario(string nomeDoItem) { foreach (KeyValuePair<string, GameObject> item in peixesNoAquario) { string text = item.Key.Replace("Drop", "").Trim().ToLower(); if (text == nomeDoItem || text.Contains(nomeDoItem) || nomeDoItem.Contains(text)) { return item.Key; } } return null; } private void CarregarEstadoDosPeixes() { foreach (KeyValuePair<string, GameObject> item in peixesNoAquario) { string key = item.Key; GameObject value = item.Value; if (!((Object)(object)value == (Object)null)) { string text = "fish_" + key; bool active = m_nview.GetZDO().GetBool(text, false); value.SetActive(active); } } } } namespace TheFisher { [<f790232b-01fd-467a-96f4-30823fb5c82f>Nullable(0)] [<62587ffe-2ae2-456b-878e-3d41b7daf150>NullableContext(1)] [HarmonyPatch(typeof(ObjectDB), "Awake")] public static class FishRawConversions { private static bool _initialized = false; private static readonly int TF1_Amount = 1; private static readonly int TF2_Amount = 2; private static readonly int TF3_Amount = 3; private const string CauldronPrefab = "piece_cauldron"; private const string PrepTablePrefab = "piece_preptable"; private static void Postfix(ObjectDB __instance) { if (_initialized || (Object)(object)__instance == (Object)null || (Object)(object)__instance.GetItemPrefab("FishRaw") == (Object)null) { return; } _initialized = true; GameObject itemPrefab = __instance.GetItemPrefab("FishRaw"); ZNetScene instance = ZNetScene.instance; GameObject val = ((instance != null) ? instance.GetPrefab("piece_cauldron") : null); ZNetScene instance2 = ZNetScene.instance; GameObject val2 = ((instance2 != null) ? instance2.GetPrefab("piece_preptable") : null); if (!((Object)(object)itemPrefab == (Object)null)) { if ((Object)(object)val != (Object)null) { AddCauldronRecipes(__instance, itemPrefab, val); } if ((Object)(object)val2 != (Object)null) { AddPrepTableRecipes(__instance, itemPrefab, val2); } } } private static void AddCauldronRecipes(ObjectDB db, GameObject fishRaw, GameObject cauldronPrefab) { CraftingStation component = cauldronPrefab.GetComponent<CraftingStation>(); if ((Object)(object)component == (Object)null) { Debug.LogWarning((object)"[TheFisher] Cauldron missing CraftingStation component!"); return; } int num = 0; foreach (GameObject item in db.m_items) { if (!((Object)(object)item == (Object)null) && ((Object)item).name.StartsWith("TF1")) { AddFishRecipe(db, item, fishRaw, component, TF1_Amount); num++; } } } private static void AddPrepTableRecipes(ObjectDB db, GameObject fishRaw, GameObject prepTablePrefab) { CraftingStation component = prepTablePrefab.GetComponent<CraftingStation>(); if ((Object)(object)component == (Object)null) { return; } int num = 0; foreach (GameObject item in db.m_items) { if ((Object)(object)item == (Object)null) { continue; } string name = ((Object)item).name; int num2 = 0; if (name.StartsWith("TF1")) { num2 = TF1_Amount; } else if (name.StartsWith("TF2")) { num2 = TF2_Amount; } else { if (!name.StartsWith("TF3")) { continue; } num2 = TF3_Amount; } AddFishRecipe(db, item, fishRaw, component, num2); num++; } } private static void AddFishRecipe(ObjectDB db, GameObject fish, GameObject fishRaw, CraftingStation station, int amount) { //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Expected O, but got Unknown ItemDrop component = fish.GetComponent<ItemDrop>(); ItemDrop component2 = fishRaw.GetComponent<ItemDrop>(); if (!((Object)(object)component == (Object)null) && !((Object)(object)component2 == (Object)null)) { Recipe val = ScriptableObject.CreateInstance<Recipe>(); ((Object)val).name = "Recipe_" + ((Object)fish).name + "_ToFishRaw_" + ((Object)station).name; val.m_item = component2; val.m_amount = amount; val.m_craftingStation = station; val.m_resources = (Requirement[])(object)new Requirement[1] { new Requirement { m_resItem = component, m_amount = 1 } }; db.m_recipes.Add(val); } } } [BepInPlugin("marlthon.TheFisher", "TheFisher", "0.3.6")] [<f790232b-01fd-467a-96f4-30823fb5c82f>Nullable(0)] [<62587ffe-2ae2-456b-878e-3d41b7daf150>NullableContext(1)] public class TheFisherPlugin : BaseUnityPlugin { [<62587ffe-2ae2-456b-878e-3d41b7daf150>NullableContext(0)] private class ConfigurationManagerAttributes { public bool? Browsable = false; } internal const string ModName = "TheFisher"; internal const string ModVersion = "0.3.6"; internal const string Author = "marlthon"; private const string ModGUID = "marlthon.TheFisher"; private static string ConfigFileName = "marlthon.TheFisher.cfg"; private static string ConfigFileFullPath; private readonly Harmony _harmony = new Harmony("marlthon.TheFisher"); public static readonly ManualLogSource TheFisherLogger; public Texture2D tex = null; private static readonly ConfigSync ConfigSync; [<f790232b-01fd-467a-96f4-30823fb5c82f>Nullable(2)] private static ConfigEntry<bool> _serverConfigLocked; public void Start() { Upgrade.Register("thefisher_add", "Adds TheFisher localizations to already explored areas.", "locations_add Spawn1_TheFisher, Spawn2_TheFisher, Spawn3_TheFisher, Spawn4_TheFisher start"); Upgrade.Register("thefisher_remove", "Remove all TheFisher localizations to the map.", "locations_remove Spawn1_TheFisher, Spawn2_TheFisher, Spawn3_TheFisher, Spawn4_TheFisher start"); } [Obfuscation(Exclude = true, ApplyToMembers = true)] private void CarregarLocalizacoes() { Localizer.Load(); } public void Awake() { //IL_0725: Unknown result type (might be due to invalid IL or missing references) //IL_072c: Unknown result type (might be due to invalid IL or missing references) //IL_07a8: Unknown result type (might be due to invalid IL or missing references) //IL_07af: Unknown result type (might be due to invalid IL or missing references) //IL_082e: Unknown result type (might be due to invalid IL or missing references) //IL_0835: Unknown result type (might be due to invalid IL or missing references) //IL_08b7: Unknown result type (might be due to invalid IL or missing references) //IL_08be: Unknown result type (might be due to invalid IL or missing references) CarregarLocalizacoes(); _serverConfigLocked = config("General", "Force Server Config", value: true, "Force Server Config"); ConfigSync.AddLockingConfigEntry<bool>(_serverConfigLocked); Item item = new Item("mar_fishs", "TF1Amberjack"); item.Configurable = Configurability.Disabled; Item item2 = new Item("mar_fishs", "TF1BlackSpotted"); item2.Configurable = Configurability.Disabled; Item item3 = new Item("mar_fishs", "TF1WhiteMullet"); item3.Configurable = Configurability.Disabled; Item item4 = new Item("mar_fishs", "TF1YellowBoxfish"); item4.Configurable = Configurability.Disabled; Item item5 = new Item("mar_fishs", "TF1Turtle"); item5.Configurable = Configurability.Disabled; Item item6 = new Item("mar_fishs", "TF1PicassoTriggerfish"); item6.Configurable = Configurability.Disabled; Item item7 = new Item("mar_fishs", "TF1Purplefish"); item7.Configurable = Configurability.Disabled; Item item8 = new Item("mar_fishs", "TF1Lionfish"); item8.Configurable = Configurability.Disabled; Item item9 = new Item("mar_fishs", "TF1Clownfish"); item9.Configurable = Configurability.Disabled; Item item10 = new Item("mar_fishs", "TF1Foureyebutterflyfish"); item10.Configurable = Configurability.Disabled; Item item11 = new Item("mar_fishs", "TF1Bluetang"); item11.Configurable = Configurability.Disabled; Item item12 = new Item("mar_fishs", "TF1Rainbowcichlid"); item12.Configurable = Configurability.Disabled; Item item13 = new Item("mar_fishs", "TF1Trumpetfish"); item13.Configurable = Configurability.Disabled; Item item14 = new Item("mar_fishs", "TF2Boba"); item14.Configurable = Configurability.Disabled; Item item15 = new Item("mar_fishs", "TF2BrownTrout"); item15.Configurable = Configurability.Disabled; Item item16 = new Item("mar_fishs", "TF2Butterflyfish"); item16.Configurable = Configurability.Disabled; Item item17 = new Item("mar_fishs", "TF2Cuttlefish"); item17.Configurable = Configurability.Disabled; Item item18 = new Item("mar_fishs", "TF2EmperorAngelfish"); item18.Configurable = Configurability.Disabled; Item item19 = new Item("mar_fishs", "TF2Frontosa"); item19.Configurable = Configurability.Disabled; Item item20 = new Item("mar_fishs", "TF2GoldCarp"); item20.Configurable = Configurability.Disabled; Item item21 = new Item("mar_fishs", "TF2GoldRedeye"); item21.Configurable = Configurability.Disabled; Item item22 = new Item("mar_fishs", "TF2LongearSunfish"); item22.Configurable = Configurability.Disabled; Item item23 = new Item("mar_fishs", "TF2MoorishIdol"); item23.Configurable = Configurability.Disabled; Item item24 = new Item("mar_fishs", "TF2Nimbochromis"); item24.Configurable = Configurability.Disabled; Item item25 = new Item("mar_fishs", "TF2OrangespineUnicornfish"); item25.Configurable = Configurability.Disabled; Item item26 = new Item("mar_fishs", "TF2Oreochromis"); item26.Configurable = Configurability.Disabled; Item item27 = new Item("mar_fishs", "TF3AtlanticCod"); item27.Configurable = Configurability.Disabled; Item item28 = new Item("mar_fishs", "TF3Barracuda"); item28.Configurable = Configurability.Disabled; Item item29 = new Item("mar_fishs", "TF3BlueMarlin"); item29.Configurable = Configurability.Disabled; Item item30 = new Item("mar_fishs", "TF3Cobia"); item30.Configurable = Configurability.Disabled; Item item31 = new Item("mar_fishs", "TF3Corvina"); item31.Configurable = Configurability.Disabled; Item item32 = new Item("mar_fishs", "TF3GiantSeaBass"); item32.Configurable = Configurability.Disabled; Item item33 = new Item("mar_fishs", "TF3GoliathGrouper"); item33.Configurable = Configurability.Disabled; Item item34 = new Item("mar_fishs", "TF3MahiMahi"); item34.Configurable = Configurability.Disabled; Item item35 = new Item("mar_fishs", "TF3Stingray"); item35.Configurable = Configurability.Disabled; Item item36 = new Item("mar_fishs", "TF3Xip"); item36.Configurable = Configurability.Disabled; Item item37 = new Item("mar_fishs", "TF3YellowfinTuna"); item37.Configurable = Configurability.Disabled; PrefabManager.RegisterPrefab("mar_fishs", "PickStarfishblack"); Item item38 = new Item("mar_fishs", "TF3Starfishblack"); item38.Configurable = Configurability.Disabled; PrefabManager.RegisterPrefab("mar_fishs", "PickStarfishblue"); Item item39 = new Item("mar_fishs", "TF3Starfishblue"); item39.Configurable = Configurability.Disabled; PrefabManager.RegisterPrefab("mar_fishs", "PickStarfishgreen"); Item item40 = new Item("mar_fishs", "TF3Starfishgreen"); item40.Configurable = Configurability.Disabled; PrefabManager.RegisterPrefab("mar_fishs", "PickStarfishOrange"); Item item41 = new Item("mar_fishs", "TF3Starfishorange"); item41.Configurable = Configurability.Disabled; PrefabManager.RegisterPrefab("mar_fishs", "PickStarfishpurple"); Item item42 = new Item("mar_fishs", "TF3Starfishpurple"); item42.Configurable = Configurability.Disabled; PrefabManager.RegisterPrefab("mar_fishs", "PickStarfishred"); Item item43 = new Item("mar_fishs", "TF3Starfishred"); item43.Configurable = Configurability.Disabled; PrefabManager.RegisterPrefab("mar_fishs", "PickStarfishwhite"); Item item44 = new Item("mar_fishs", "TF3Starfishwhite"); item44.Configurable = Configurability.Disabled; PrefabManager.RegisterPrefab("mar_fishs", "TFPickableCrab"); Item item45 = new Item("mar_fishs", "TFCrab"); item45.Configurable = Configurability.Stats; Location location = new Location("mar_fishs", "Spawn1_TheFisher") { MapIcon = "IcoTheFisherCoral.png", ShowMapIcon = ShowIcon.Never, Biome = (Biome)1, SpawnArea = (BiomeArea)3, Rotation = Rotation.Random, SpawnDistance = new LocationManager.Range(80f, 7500f), SpawnAltitude = new LocationManager.Range(-4f, -2f), MinimumDistanceFromGroup = 100f, Count = 80, Unique = false }; Location location2 = new Location("mar_fishs", "Spawn2_TheFisher") { MapIcon = "IcoTheFisherCoral.png", ShowMapIcon = ShowIcon.Never, Biome = (Biome)16, SpawnArea = (BiomeArea)3, Rotation = Rotation.Random, SpawnDistance = new LocationManager.Range(400f, 8500f), SpawnAltitude = new LocationManager.Range(-4f, -2f), MinimumDistanceFromGroup = 100f, Count = 80, Unique = false }; Location location3 = new Location("mar_fishs", "Spawn3_TheFisher") { MapIcon = "IcoTheFisherCoral.png", ShowMapIcon = ShowIcon.Never, Biome = (Biome)256, SpawnArea = (BiomeArea)3, Rotation = Rotation.Random, SnapToWater = true, SpawnDistance = new LocationManager.Range(40f, 9500f), SpawnAltitude = new LocationManager.Range(-100f, -1f), MinimumDistanceFromGroup = 100f, Count = 80, Unique = false }; Location location4 = new Location("mar_fishs", "Spawn4_TheFisher") { MapIcon = "IcoTheFisherCoral.png", ShowMapIcon = ShowIcon.Never, Biome = (Biome)1, SpawnArea = (BiomeArea)3, Rotation = Rotation.Random, SpawnDistance = new LocationManager.Range(40f, 7500f), SpawnAltitude = new LocationManager.Range(-2f, -1f), MinimumDistanceFromGroup = 80f, Count = 80, Unique = false }; BuildPiece buildPiece = new BuildPiece("mar_fishs", "Trophy_Amberjack"); buildPiece.Category.Set("TheFisher"); buildPiece.Crafting.Set(PieceManager.CraftingTable.Workbench); buildPiece.RequiredItems.Add("Wood", 4, recover: true); buildPiece.RequiredItems.Add("Resin", 4, recover: true); buildPiece.RequiredItems.Add("TF1Amberjack", 1, recover: true); BuildPiece buildPiece2 = new BuildPiece("mar_fishs", "Trophy_SeaTurtle1"); buildPiece2.Category.Set("TheFisher"); buildPiece2.Crafting.Set(PieceManager.CraftingTable.Workbench); buildPiece2.RequiredItems.Add("Wood", 4, recover: true); buildPiece2.RequiredItems.Add("Resin", 4, recover: true); buildPiece2.RequiredItems.Add("TF1Turtle", 1, recover: true); BuildPiece buildPiece3 = new BuildPiece("mar_fishs", "Trophy_SeaTurtle2"); buildPiece3.Category.Set("TheFisher"); buildPiece3.Crafting.Set(PieceManager.CraftingTable.Workbench); buildPiece3.RequiredItems.Add("Wood", 4, recover: true); buildPiece3.RequiredItems.Add("Resin", 4, recover: true); buildPiece3.RequiredItems.Add("TF1Turtle", 1, recover: true); BuildPiece buildPiece4 = new BuildPiece("mar_fishs", "Trophy_TF1PicassoTriggerFish"); buildPiece4.Category.Set("TheFisher"); buildPiece4.Crafting.Set(PieceManager.CraftingTable.Workbench); buildPiece4.RequiredItems.Add("Wood", 4, recover: true); buildPiece4.RequiredItems.Add("Resin", 4, recover: true); buildPiece4.RequiredItems.Add("TF1PicassoTriggerfish", 1, recover: true); BuildPiece buildPiece5 = new BuildPiece("mar_fishs", "Trophy_TF1BlackSpotted"); buildPiece5.Category.Set("TheFisher"); buildPiece5.Crafting.Set(PieceManager.CraftingTable.Workbench); buildPiece5.RequiredItems.Add("Wood", 4, recover: true); buildPiece5.RequiredItems.Add("Resin", 4, recover: true); buildPiece5.RequiredItems.Add("TF1BlackSpotted", 1, recover: true); BuildPiece buildPiece6 = new BuildPiece("mar_fishs", "Trophy_TF1Bluetang"); buildPiece6.Category.Set("TheFisher"); buildPiece6.Crafting.Set(PieceManager.CraftingTable.Workbench); buildPiece6.RequiredItems.Add("Wood", 4, recover: true); buildPiece6.RequiredItems.Add("Resin", 4, recover: true); buildPiece6.RequiredItems.Add("TF1Bluetang", 1, recover: true); BuildPiece buildPiece7 = new BuildPiece("mar_fishs", "Trophy_TF1Clownfish"); buildPiece7.Category.Set("TheFisher"); buildPiece7.Crafting.Set(PieceManager.CraftingTable.Workbench); buildPiece7.RequiredItems.Add("Wood", 4, recover: true); buildPiece7.RequiredItems.Add("Resin", 4, recover: true); buildPiece7.RequiredItems.Add("TF1Clownfish", 1, recover: true); BuildPiece buildPiece8 = new BuildPiece("mar_fishs", "Trophy_TF1Foureyebutterflyfish"); buildPiece8.Category.Set("TheFisher"); buildPiece8.Crafting.Set(PieceManager.CraftingTable.Workbench); buildPiece8.RequiredItems.Add("Wood", 4, recover: true); buildPiece8.RequiredItems.Add("Resin", 4, recover: true); buildPiece8.RequiredItems.Add("TF1Foureyebutterflyfish", 1, recover: true); BuildPiece buildPiece9 = new BuildPiece("mar_fishs", "Trophy_TF1Lionfish"); buildPiece9.Category.Set("TheFisher"); buildPiece9.Crafting.Set(PieceManager.CraftingTable.Workbench); buildPiece9.RequiredItems.Add("Wood", 4, recover: true); buildPiece9.RequiredItems.Add("Resin", 4, recover: true); buildPiece9.RequiredItems.Add("TF1Lionfish", 1, recover: true); BuildPiece buildPiece10 = new BuildPiece("mar_fishs", "Trophy_TF1Purplefish"); buildPiece10.Category.Set("TheFisher"); buildPiece10.Crafting.Set(PieceManager.CraftingTable.Workbench); buildPiece10.RequiredItems.Add("Wood", 4, recover: true); buildPiece10.RequiredItems.Add("Resin", 4, recover: true); buildPiece10.RequiredItems.Add("TF1Purplefish", 1, recover: true); BuildPiece buildPiece11 = new BuildPiece("mar_fishs", "Trophy_TF1Rainbowcichlid"); buildPiece11.Category.Set("TheFisher"); buildPiece11.Crafting.Set(PieceManager.CraftingTable.Workbench); buildPiece11.RequiredItems.Add("Wood", 4, recover: true); buildPiece11.RequiredItems.Add("Resin", 4, recover: true); buildPiece11.RequiredItems.Add("TF1Rainbowcichlid", 1, recover: true); BuildPiece buildPiece12 = new BuildPiece("mar_fishs", "Trophy_TF1Trumpetfish"); buildPiece12.Category.Set("TheFisher"); buildPiece12.Crafting.Set(PieceManager.CraftingTable.Workbench); buildPiece12.RequiredItems.Add("Wood", 4, recover: true); buildPiece12.RequiredItems.Add("Resin", 4, recover: true); buildPiece12.RequiredItems.Add("TF1Trumpetfish", 1, recover: true); BuildPiece buildPiece13 = new BuildPiece("mar_fishs", "Trophy_TF1WhiteMullet"); buildPiece13.Category.Set("TheFisher"); buildPiece13.Crafting.Set(PieceManager.CraftingTable.Workbench); buildPiece13.RequiredItems.Add("Wood", 4, recover: true); buildPiece13.RequiredItems.Add("Resin", 4, recover: true); buildPiece13.RequiredItems.Add("TF1WhiteMullet", 1, recover: true); BuildPiece buildPiece14 = new BuildPiece("mar_fishs", "Trophy_TF1YellowBoxfish"); buildPiece14.Category.Set("TheFisher"); buildPiece14.Crafting.Set(PieceManager.CraftingTable.Workbench); buildPiece14.RequiredItems.Add("Wood", 4, recover: true); buildPiece14.RequiredItems.Add("Resin", 4, recover: true); buildPiece14.RequiredItems.Add("TF1YellowBoxfish", 1, recover: true); BuildPiece buildPiece15 = new BuildPiece("mar_fishs", "Trophy_TF2Boba"); buildPiece15.Category.Set("TheFisher"); buildPiece15.Crafting.Set(PieceManager.CraftingTable.Workbench); buildPiece15.RequiredItems.Add("Wood", 4, recover: true); buildPiece15.RequiredItems.Add("Resin", 4, recover: true); buildPiece15.RequiredItems.Add("TF2Boba", 1, recover: true); BuildPiece buildPiece16 = new BuildPiece("mar_fishs", "Trophy_TF2BrownTrout"); buildPiece16.Category.Set("TheFisher"); buildPiece16.Crafting.Set(PieceManager.CraftingTable.Workbench); buildPiece16.RequiredItems.Add("Wood", 4, recover: true); buildPiece16.RequiredItems.Add("Resin", 4, recover: true); buildPiece16.RequiredItems.Add("TF2BrownTrout", 1, recover: true); BuildPiece buildPiece17 = new BuildPiece("mar_fishs", "Trophy_TF2Butterflyfish"); buildPiece17.Category.Set("TheFisher"); buildPiece17.Crafting.Set(PieceManager.CraftingTable.Workbench); buildPiece17.RequiredItems.Add("Wood", 4, recover: true); buildPiece17.RequiredItems.Add("Resin", 4, recover: true); buildPiece17.RequiredItems.Add("TF2Butterflyfish", 1, recover: true); BuildPiece buildPiece18 = new BuildPiece("mar_fishs", "Trophy_TF2Cuttlefish"); buildPiece18.Category.Set("TheFisher"); buildPiece18.Crafting.Set(PieceManager.CraftingTable.Workbench); buildPiece18.RequiredItems.Add("Wood", 4, recover: true); buildPiece18.RequiredItems.Add("Resin", 4, recover: true); buildPiece18.RequiredItems.Add("TF2Cuttlefish", 1, recover: true); BuildPiece buildPiece19 = new BuildPiece("mar_fishs", "Trophy_TF2EmperorAngelfish"); buildPiece19.Category.Set("TheFisher"); buildPiece19.Crafting.Set(PieceManager.CraftingTable.Workbench); buildPiece19.RequiredItems.Add("Wood", 4, recover: true); buildPiece19.RequiredItems.Add("Resin", 4, recover: true); buildPiece19.RequiredItems.Add("TF2EmperorAngelfish", 1, recover: true); BuildPiece buildPiece20 = new BuildPiece("mar_fishs", "Trophy_TF2Frontosa"); buildPiece20.Category.Set("TheFisher"); buildPiece20.Crafting.Set(PieceManager.CraftingTable.Workbench); buildPiece20.RequiredItems.Add("Wood", 4, recover: true); buildPiece20.RequiredItems.Add("Resin", 4, recover: true); buildPiece20.RequiredItems.Add("TF2Frontosa", 1, recover: true); BuildPiece buildPiece21 = new BuildPiece("mar_fishs", "Trophy_TF2GoldCarp"); buildPiece21.Category.Set("TheFisher"); buildPiece21.Crafting.Set(PieceManager.CraftingTable.Workbench); buildPiece21.RequiredItems.Add("Wood", 4, recover: true); buildPiece21.RequiredItems.Add("Resin", 4, recover: true); buildPiece21.RequiredItems.Add("TF2GoldCarp", 1, recover: true); BuildPiece buildPiece22 = new BuildPiece("mar_fishs", "Trophy_TF2GoldRedeye"); buildPiece22.Category.Set("TheFisher"); buildPiece22.Crafting.Set(PieceManager.CraftingTable.Workbench); buildPiece22.RequiredItems.Add("Wood", 4, recover: true); buildPiece22.RequiredItems.Add("Resin", 4, recover: true); buildPiece22.RequiredItems.Add("TF2GoldRedeye", 1, recover: true); BuildPiece buildPiece23 = new BuildPiece("mar_fishs", "Trophy_TF2LongearSunfish"); buildPiece23.Category.Set("TheFisher"); buildPiece23.Crafting.Set(PieceManager.CraftingTable.Workbench); buildPiece23.RequiredItems.Add("Wood", 4, recover: true); buildPiece23.RequiredItems.Add("Resin", 4, recover: true); buildPiece23.RequiredItems.Add("TF2LongearSunfish", 1, recover: true); BuildPiece buildPiece24 = new BuildPiece("mar_fishs", "Trophy_TF2MoorishIdol"); buildPiece24.Category.Set("TheFisher"); buildPiece24.Crafting.Set(PieceManager.CraftingTable.Workbench); buildPiece24.RequiredItems.Add("Wood", 4, recover: true); buildPiece24.RequiredItems.Add("Resin", 4, recover: true); buildPiece24.RequiredItems.Add("TF2MoorishIdol", 1, recover: true); BuildPiece buildPiece25 = new BuildPiece("mar_fishs", "Trophy_TF2Nimbochromis"); buildPiece25.Category.Set("TheFisher"); buildPiece25.Crafting.Set(PieceManager.CraftingTable.Workbench); buildPiece25.RequiredItems.Add("Wood", 4, recover: true); buildPiece25.RequiredItems.Add("Resin", 4, recover: true); buildPiece25.RequiredItems.Add("TF2Nimbochromis", 1, recover: true); BuildPiece buildPiece26 = new BuildPiece("mar_fishs", "Trophy_TF2OrangespineUnicornfish"); buildPiece26.Category.Set("TheFisher"); buildPiece26.Crafting.Set(PieceManager.CraftingTable.Workbench); buildPiece26.RequiredItems.Add("Wood", 4, recover: true); buildPiece26.RequiredItems.Add("Resin", 4, recover: true); buildPiece26.RequiredItems.Add("TF2OrangespineUnicornfish", 1, recover: true); BuildPiece buildPiece27 = new BuildPiece("mar_fishs", "Trophy_TF2Oreochromis"); buildPiece27.Category.Set("TheFisher"); buildPiece27.Crafting.Set(PieceManager.CraftingTable.Workbench); buildPiece27.RequiredItems.Add("Wood", 4, recover: true); buildPiece27.RequiredItems.Add("Resin", 4, recover: true); buildPiece27.RequiredItems.Add("TF2Oreochromis", 1, recover: true); BuildPiece buildPiece28 = new BuildPiece("mar_fishs", "Trophy_TF3AtlanticCod"); buildPiece28.Category.Set("TheFisher"); buildPiece28.Crafting.Set(PieceManager.CraftingTable.Workbench); buildPiece28.RequiredItems.Add("Wood", 4, recover: true); buildPiece28.RequiredItems.Add("Resin", 4, recover: true); buildPiece28.RequiredItems.Add("TF3AtlanticCod", 1, recover: true); BuildPiece buildPiece29 = new BuildPiece("mar_fishs", "Trophy_TF3Barracuda"); buildPiece29.Category.Set("TheFisher"); buildPiece29.Crafting.Set(PieceManager.CraftingTable.Workbench); buildPiece29.RequiredItems.Add("Wood", 4, recover: true); buildPiece29.RequiredItems.Add("Resin", 4, recover: true); buildPiece29.RequiredItems.Add("TF3Barracuda", 1, recover: true); BuildPiece buildPiece30 = new BuildPiece("mar_fishs", "Trophy_TF3BlueMarlin"); buildPiece30.Category.Set("TheFisher"); buildPiece30.Crafting.Set(PieceManager.CraftingTable.Workbench); buildPiece30.RequiredItems.Add("Wood", 4, recover: true); buildPiece30.RequiredItems.Add("Resin", 4, recover: true); buildPiece30.RequiredItems.Add("TF3BlueMarlin", 1, recover: true); BuildPiece buildPiece31 = new BuildPiece("mar_fishs", "Trophy_TF3Cobia"); buildPiece31.Category.Set("TheFisher"); buildPiece31.Crafting.Set(PieceManager.CraftingTable.Workbench); buildPiece31.RequiredItems.Add("Wood", 4, recover: true); buildPiece31.RequiredItems.Add("Resin", 4, recover: true); buildPiece31.RequiredItems.Add("TF3Cobia", 1, recover: true); BuildPiece buildPiece32 = new BuildPiece("mar_fishs", "Trophy_TF3Corvina"); buildPiece32.Category.Set("TheFisher"); buildPiece32.Crafting.Set(PieceManager.CraftingTable.Workbench); buildPiece32.RequiredItems.Add("Wood", 4, recover: true); buildPiece32.RequiredItems.Add("Resin", 4, recover: true); buildPiece32.RequiredItems.Add("TF3Corvina", 1, recover: true); BuildPiece buildPiece33 = new BuildPiece("mar_fishs", "Trophy_TF3GiantSeaBass"); buildPiece33.Category.Set("TheFisher"); buildPiece33.Crafting.Set(PieceManager.CraftingTable.Workbench); buildPiece33.RequiredItems.Add("Wood", 4, recover: true); buildPiece33.RequiredItems.Add("Resin", 4, recover: true); buildPiece33.RequiredItems.Add("TF3GiantSeaBass", 1, recover: true); BuildPiece buildPiece34 = new BuildPiece("mar_fishs", "Trophy_TF3GoliathGrouper"); buildPiece34.Category.Set("TheFisher"); buildPiece34.Crafting.Set(PieceManager.CraftingTable.Workbench); buildPiece34.RequiredItems.Add("Wood", 4, recover: true); buildPiece34.RequiredItems.Add("Resin", 4, recover: true); buildPiece34.RequiredItems.Add("TF3GoliathGrouper", 1, recover: true); BuildPiece buildPiece35 = new BuildPiece("mar_fishs", "Trophy_TF3MahiMahi"); buildPiece35.Category.Set("TheFisher"); buildPiece35.Crafting.Set(PieceManager.CraftingTable.Workbench); buildPiece35.RequiredItems.Add("Wood", 4, recover: true); buildPiece35.RequiredItems.Add("Resin", 4, recover: true); buildPiece35.RequiredItems.Add("TF3MahiMahi", 1, recover: true); BuildPiece buildPiece36 = new BuildPiece("mar_fishs", "Trophy_TF3Stingray"); buildPiece36.Category.Set("TheFisher"); buildPiece36.Crafting.Set(PieceManager.CraftingTable.Workbench); buildPiece36.RequiredItems.Add("Wood", 4, recover: true); buildPiece36.RequiredItems.Add("Resin", 4, recover: true); buildPiece36.RequiredItems.Add("TF3Stingray", 1, recover: true); BuildPiece buildPiece37 = new BuildPiece("mar_fishs", "Trophy_TF3Xip"); buildPiece37.Category.Set("TheFisher"); buildPiece37.Crafting.Set(PieceManager.CraftingTable.Workbench); buildPiece37.RequiredItems.Add("Wood", 4, recover: true); buildPiece37.RequiredItems.Add("Resin", 4, recover: true); buildPiece37.RequiredItems.Add("TF3Xip", 1, recover: true); BuildPiece buildPiece38 = new BuildPiece("mar_fishs", "Trophy_TF3YellowfinTuna"); buildPiece38.Category.Set("TheFisher"); buildPiece38.Crafting.Set(PieceManager.CraftingTable.Workbench); buildPiece38.RequiredItems.Add("Wood", 4, recover: true); buildPiece38.RequiredItems.Add("Resin", 4, recover: true); buildPiece38.RequiredItems.Add("TF3YellowfinTuna", 1, recover: true); BuildPiece buildPiece39 = new BuildPiece("mar_fishs", "TrophyStarfishBlack"); buildPiece39.Category.Set("TheFisher"); buildPiece39.Crafting.Set(PieceManager.CraftingTable.Workbench); buildPiece39.RequiredItems.Add("Wood", 4, recover: true); buildPiece39.RequiredItems.Add("Resin", 4, recover: true); buildPiece39.RequiredItems.Add("TF3Starfishblack", 1, recover: true); BuildPiece buildPiece40 = new BuildPiece("mar_fishs", "TrophyStarfishBlue"); buildPiece40.Category.Set("TheFisher"); buildPiece40.Crafting.Set(PieceManager.CraftingTable.Workbench); buildPiece40.RequiredItems.Add("Wood", 4, recover: true); buildPiece40.RequiredItems.Add("Resin", 4, recover: true); buildPiece40.RequiredItems.Add("TF3Starfishblue", 1, recover: true); BuildPiece buildPiece41 = new BuildPiece("mar_fishs", "TrophyStarfishGreen"); buildPiece41.Category.Set("TheFisher"); buildPiece41.Crafting.Set(PieceManager.CraftingTable.Workbench); buildPiece41.RequiredItems.Add("Wood", 4, recover: true); buildPiece41.RequiredItems.Add("Resin", 4, recover: true); buildPiece41.RequiredItems.Add("TF3Starfishgreen", 1, recover: true); BuildPiece buildPiece42 = new BuildPiece("mar_fishs", "TrophyStarfishOrange"); buildPiece42.Category.Set("TheFisher"); buildPiece42.Crafting.Set(PieceManager.CraftingTable.Workbench); buildPiece42.RequiredItems.Add("Wood", 4, recover: true); buildPiece42.RequiredItems.Add("Resin", 4, recover: true); buildPiece42.RequiredItems.Add("TF3Starfishorange", 1, recover: true); BuildPiece buildPiece43 = new BuildPiece("mar_fishs", "TrophyStarfishPurple"); buildPiece43.Category.Set("TheFisher"); buildPiece43.Crafting.Set(PieceManager.CraftingTable.Workbench); buildPiece43.RequiredItems.Add("Wood", 4, recover: true); buildPiece43.RequiredItems.Add("Resin", 4, recover: true); buildPiece43.RequiredItems.Add("TF3Starfishpurple", 1, recover: true); BuildPiece buildPiece44 = new BuildPiece("mar_fishs", "TrophyStarfishRed"); buildPiece44.Category.Set("TheFisher"); buildPiece44.Crafting.Set(PieceManager.CraftingTable.Workbench); buildPiece44.RequiredItems.Add("Wood", 4, recover: true); buildPiece44.RequiredItems.Add("Resin", 4, recover: true); buildPiece44.RequiredItems.Add("TF3Starfishred", 1, recover: true); BuildPiece buildPiece45 = new BuildPiece("mar_fishs", "TrophyStarfishWhite"); buildPiece45.Category.Set("TheFisher"); buildPiece45.Crafting.Set(PieceManager.CraftingTable.Workbench); buildPiece45.RequiredItems.Add("Wood", 4, recover: true); buildPiece45.RequiredItems.Add("Resin", 4, recover: true); buildPiece45.RequiredItems.Add("TF3Starfishwhite", 1, recover: true); BuildPiece buildPiece46 = new BuildPiece("mar_fishs", "TheFisherTank_v1"); buildPiece46.Category.Set("TheFisher"); buildPiece46.Crafting.Set(PieceManager.CraftingTable.Workbench); buildPiece46.RequiredItems.Add("FineWood", 40, recover: true); buildPiece46.RequiredItems.Add("Resin", 10, recover: true); buildPiece46.RequiredItems.Add("Crystal", 10, recover: true); BuildPiece buildPiece47 = new BuildPiece("mar_fishs", "TheFisherTank_v2"); buildPiece47.Category.Set("TheFisher"); buildPiece47.Crafting.Set(PieceManager.CraftingTable.Workbench); buildPiece47.RequiredItems.Add("FineWood", 40, recover: true); buildPiece47.RequiredItems.Add("Resin", 10, recover: true); buildPiece47.RequiredItems.Add("Crystal", 10, recover: true); PrefabManager.RegisterPrefab("mar_fishs", "sfx_build_hammer_wood_thefisher"); PrefabManager.RegisterPrefab("mar_fishs", "sfx_crow_death_thefisher"); PrefabManager.RegisterPrefab("mar_fishs", "sfx_wood_destroyed_thefisher"); PrefabManager.RegisterPrefab("mar_fishs", "vfx_crow_death_thefisher"); PrefabManager.RegisterPrefab("mar_fishs", "vfx_Place_wood_thefisher"); PrefabManager.RegisterPrefab("mar_fishs", "vfx_SawDust_thefisher"); PrefabManager.RegisterPrefab("mar_fishs", "vfx_spawnfish"); PrefabManager.RegisterPrefab("mar_fishs", "sfx_pickable_pick_thefisher"); PrefabManager.RegisterPrefab("mar_fishs", "vfx_pickable_pick_thefisher"); SetupWatcher(); _harmony.PatchAll(); } private void OnDestroy() { ((BaseUnityPlugin)this).Config.Save(); } private void SetupWatcher() { FileSystemWatcher fileSystemWatcher = new FileSystemWatcher(Paths.ConfigPath, ConfigFileName); fileSystemWatcher.Changed += ReadConfigValues; fileSystemWatcher.Created += ReadConfigValues; fileSystemWatcher.Renamed += ReadConfigValues; fileSystemWatcher.IncludeSubdirectories = true; fileSystemWatcher.SynchronizingObject = ThreadingHelper.SynchronizingObject; fileSystemWatcher.EnableRaisingEvents = true; } private void ReadConfigValues(object sender, FileSystemEventArgs e) { if (!File.Exists(ConfigFileFullPath)) { return; } try { TheFisherLogger.LogDebug((object)"ReadConfigValues called"); ((BaseUnityPlugin)this).Config.Reload(); } catch { TheFisherLogger.LogError((object)("There was an issue loading your " + ConfigFileName)); TheFisherLogger.LogError((object)"Please check your config entries for spelling and format!"); } } private ConfigEntry<T> config<[<f790232b-01fd-467a-96f4-30823fb5c82f>Nullable(2)] T>(string group, string name, T value, ConfigDescription description, bool synchronizedSetting = true) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown ConfigDescription val = new ConfigDescription(description.Description + (synchronizedSetting ? " [Synced with Server]" : " [Not Synced with Server]"), description.AcceptableValues, description.Tags); ConfigEntry<T> val2 = ((BaseUnityPlugin)this).Config.Bind<T>(group, name, value, val); SyncedConfigEntry<T> syncedConfigEntry = ConfigSync.AddConfigEntry<T>(val2); syncedConfigEntry.SynchronizedConfig = synchronizedSetting; return val2; } private ConfigEntry<T> config<[<f790232b-01fd-467a-96f4-30823fb5c82f>Nullable(2)] T>(string group, string name, T value, string description, bool synchronizedSetting = true) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown return config(group, name, value, new ConfigDescription(description, (AcceptableValueBase)null, Array.Empty<object>()), synchronizedSetting); } private static int GetZDO(int prefabHash) { int num = 0; List<ZDO>[] objectsBySector = ZDOMan.instance.m_objectsBySector; foreach (List<ZDO> list in objectsBySector) { if (list == null) { continue; } for (int j = 0; j < list.Count; j++) { ZDO val = list[j]; if (val.GetPrefab() == prefabHash) { num++; } } } return num; } private static int GetPrefabCount(int prefabHash) { int num = 0; List<ZDO>[] objectsBySector = ZDOMan.instance.m_objectsBySector; foreach (List<ZDO> list in objectsBySector) { if (list == null) { continue; } for (int j = 0; j < list.Count; j++) { ZDO val = list[j]; if (val.GetPrefab() == prefabHash) { num++; } } } return num; } static TheFisherPlugin() { string configPath = Paths.ConfigPath; char directorySeparatorChar = Path.DirectorySeparatorChar; ConfigFileFullPath = configPath + directorySeparatorChar + ConfigFileName; TheFisherLogger = Logger.CreateLogSource("TheFisher"); ConfigSync = new ConfigSync("marlthon.TheFisher") { DisplayName = "TheFisher", CurrentVersion = "0.3.6", MinimumRequiredVersion = "0.3.6" }; } } } namespace UpgradeWorld { [<62587ffe-2ae2-456b-878e-3d41b7daf150>NullableContext(1)] [<f790232b-01fd-467a-96f4-30823fb5c82f>Nullable(0)] 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)([<62587ffe-2ae2-456b-878e-3d41b7daf150>NullableContext(0)] (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")] [<f790232b-01fd-467a-96f4-30823fb5c82f>Nullable(0)] [<62587ffe-2ae2-456b-878e-3d41b7daf150>NullableContext(1)] 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 PieceManager { [PublicAPI] [<62587ffe-2ae2-456b-878e-3d41b7daf150>NullableContext(1)] [<f790232b-01fd-467a-96f4-30823fb5c82f>Nullable(0)] public static class MaterialReplacer { [<62587ffe-2ae2-456b-878e-3d41b7daf150>NullableContext(0)] public enum ShaderType { PieceShader, VegetationShader, RockShader, RugShader, GrassShader, CustomCreature, UseUnityShader } private static readonly Dictionary<GameObject, bool> ObjectToSwap; private static readonly Dictionary<string, Material> OriginalMaterials; private static readonly Dictionary<GameObject, ShaderType> ObjectsForShaderReplace; private static readonly HashSet<Shader> CachedShaders; private static bool hasRun; static MaterialReplacer() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Expected O, but got Unknown CachedShaders = new HashSet<Shader>(); hasRun = false; OriginalMaterials = new Dictionary<string, Material>(); ObjectToSwap = new Dictionary<GameObject, bool>(); ObjectsForShaderReplace = new Dictionary<GameObject, ShaderType>(); Harmony val = new Harmony("org.bepinex.helpers.PieceManager"); val.Patch((MethodBase)AccessTools.DeclaredMethod(typeof(ZoneSystem), "Start", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(MaterialReplacer), "ReplaceAllMaterialsWithOriginal", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } public static void RegisterGameObjectForShaderSwap(GameObject go, ShaderType type) { if (!ObjectsForShaderReplace.ContainsKey(go)) { ObjectsForShaderReplace.Add(go, type); } } public static void RegisterGameObjectForMatSwap(GameObject go, bool isJotunnMock = false) { if (!ObjectToSwap.ContainsKey(go)) { ObjectToSwap.Add(go, isJotunnMock); } } private static void GetAllMaterials() { Material[] array = Resources.FindObjectsOfTypeAll<Material>(); foreach (Material val in array) { OriginalMaterials[((Object)val).name] = val; } } [HarmonyPriority(700)] private static void ReplaceAllMaterialsWithOriginal() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Invalid comparison between Unknown and I4 if ((int)SystemInfo.graphicsDeviceType == 4 || hasRun) { return; } if (OriginalMaterials.Count == 0) { GetAllMaterials(); } foreach (KeyValuePair<GameObject, bool> item in ObjectToSwap) { GameObject key = item.Key; bool value = item.Value; ProcessGameObjectMaterials(key, value); } AssetBundle[] array = Resources.FindObjectsOfTypeAll<AssetBundle>(); AssetBundle[] array2 = array; foreach (AssetBundle val in array2) { IEnumerable<Shader> enumerable3; try { IEnumerable<Shader> enumerable2; if (!val.isStreamedSceneAssetBundle || !Object.op_Implicit((Object)(object)val)) { IEnumerable<Shader> enumerable = val.LoadAllAssets<Shader>(); enumerable2 = enumerable; } else { enumerable2 = from shader in ((IEnumerable<string>)val.GetAllAssetNames()).Select((Func<string, Shader>)val.LoadAsset<Shader>) where (Object)(object)shader != (Object)null select shader; } enumerable3 = enumerable2; } catch (Exception) { continue; } if (enumerable3 == null) { continue; } foreach (Shader item2 in enumerable3) { CachedShaders.Add(item2); } } foreach (KeyValuePair<GameObject, ShaderType> item3 in ObjectsForShaderReplace) { GameObject key2 = item3.Key; ShaderType value2 = item3.Value; ProcessGameObjectShaders(key2, value2); } hasRun = true; } private static void ProcessGameObjectMaterials(GameObject go, bool isJotunnMock) { Renderer[] componentsInChildren = go.GetComponentsInChildren<Renderer>(true); Renderer[] array = componentsInChildren; foreach (Renderer val in array) { Material[] sharedMaterials = val.sharedMaterials.Select([<62587ffe-2ae2-456b-878e-3d41b7daf150>NullableContext(0)] (Material material) => ReplaceMaterial(material, isJotunnMock)).ToArray(); val.sharedMaterials = sharedMaterials; } } private static Material ReplaceMaterial(Material originalMaterial, bool isJotunnMock) { string text = (isJotunnMock ? "JVLmock_" : "_REPLACE_"); if (!((Object)originalMaterial).name.StartsWith(text, StringComparison.Ordinal)) { return originalMaterial; } string text2 = ((Object)originalMaterial).name.Replace(" (Instance)", "").Replace(text, ""); if (OriginalMaterials.TryGetValue(text2, out var value)) { return value; } Debug.LogWarning((object)("No suitable material found to replace: " + text2)); return originalMaterial; } private static void ProcessGameObjectShaders(GameObject go, ShaderType shaderType) { Renderer[] componentsInChildren = go.GetComponentsInChildren<Renderer>(true); Renderer[] array = componentsInChildren; foreach (Renderer val in array) { Material[] sharedMaterials = val.sharedMaterials; foreach (Material val2 in sharedMaterials) { if ((Object)(object)val2 != (Object)null) { val2.shader = GetShaderForType(val2.shader, shaderType, ((Object)val2.shader).name); } } } } private static Shader GetShaderForType(Shader orig, ShaderType shaderType, string originalShaderName) { return (Shader)(shaderType switch { ShaderType.PieceShader => FindShaderWithName(orig, "Custom/Piece"), ShaderType.VegetationShader => FindShaderWithName(orig, "Custom/Vegetation"), ShaderType.RockShader => FindShaderWithName(orig, "Custom/StaticRock"), ShaderType.RugShader => FindShaderWithName(orig, "Custom/Rug"), ShaderType.GrassShader => FindShaderWithName(orig, "Custom/Grass"), ShaderType.CustomCreature => FindShaderWithName(orig, "Custom/Creature"), ShaderType.UseUnityShader => FindShaderWithName(orig, ((Object)(object)FindShaderWithName(orig, originalShaderName) != (Object)null) ? originalShaderName : "ToonDeferredShading2017"), _ => FindShaderWithName(orig, "Standard"), }); } public static Shader FindShaderWithName(Shader origShader, string name) { foreach (Shader cachedShader in CachedShaders) { if (((Object)cachedShader).name == name) { return cachedShader; } } return origShader; } } [PublicAPI] public enum CraftingTable { None, [InternalName("piece_workbench")] Workbench, [InternalName("piece_cauldron")] Cauldron, [InternalName("forge")] Forge, [InternalName("piece_artisanstation")] ArtisanTable, [InternalName("piece_stonecutter")] StoneCutter, [InternalName("piece_magetable")] MageTable, [InternalName("blackforge")] BlackForge, [InternalName("piece_preptable")] FoodPreparationTable, [InternalName("piece_MeadCauldron")] MeadKetill, Custom } [<62587ffe-2ae2-456b-878e-3d41b7daf150>NullableContext(1)] [<f790232b-01fd-467a-96f4-30823fb5c82f>Nullable(0)] public class InternalName : Attribute { public readonly string internalName; public InternalName(string internalName) { this.internalName = internalName; } } [<62587ffe-2ae2-456b-878e-3d41b7daf150>NullableContext(1)] [<f790232b-01fd-467a-96f4-30823fb5c82f>Nullable(0)] [PublicAPI] public class ExtensionList { public readonly List<ExtensionConfig> ExtensionStations = new List<ExtensionConfig>(); public void Set(CraftingTable table, int maxStationDistance = 5) { ExtensionStations.Add(new ExtensionConfig { Table = table, maxStationDistance = maxStationDistance }); } public void Set(string customTable, int maxStationDistance = 5) { ExtensionStations.Add(new ExtensionConfig { Table = CraftingTable.Custom, custom = customTable, maxStationDistance = maxStationDistance }); } } public struct ExtensionConfig { public CraftingTable Table; public float maxStationDistance; [<f790232b-01fd-467a-96f4-30823fb5c82f>Nullable(2)] public string custom; } [PublicAPI] [<f790232b-01fd-467a-96f4-30823fb5c82f>Nullable(0)] [<62587ffe-2ae2-456b-878e-3d41b7daf150>NullableContext(1)] public class CraftingStationList { public readonly List<CraftingStationConfig> Stations = new List<CraftingStationConfig>(); public void Set(CraftingTable table) { Stations.Add(new CraftingStationConfig { Table = table }); } public void Set(string customTable) { Stations.Add(new CraftingStationConfig { Table = CraftingTable.Custom, custom = customTable }); } } public struct CraftingStationConfig { public CraftingTable Table; public int level; [<f790232b-01fd-467a-96f4-30823fb5c82f>Nullable(2)] public string custom; } [PublicAPI] public enum BuildPieceCategory { Misc = 0, Crafting = 1, BuildingWorkbench = 2, BuildingStonecutter = 3, Furniture = 4, All = 100, Custom = 99 } [PublicAPI] [<f790232b-01fd-467a-96f4-30823fb5c82f>Nullable(0)] [<62587ffe-2ae2-456b-878e-3d41b7daf150>NullableContext(1)] public class RequiredResourcesList { public readonly List<Requirement> Requirements = new List<Requirement>(); public void Add(string item, int amount, bool recover) { Requirements.Add(new Requirement { itemName = item, amount = amount, recover = recover }); } } public struct Requirement { [<f790232b-01fd-467a-96f4-30823fb5c82f>Nullable(1)] public string itemName; public int amount; public bool recover; } public struct SpecialProperties { [Description("Admins should be the only ones that can build this piece.")] public bool AdminOnly; [Description("Turns off generating a config for this build piece.")] public bool NoConfig; } [PublicAPI] [<f790232b-01fd-467a-96f4-30823fb5c82f>Nullable(0)] [<62587ffe-2ae2-456b-878e-3d41b7daf150>NullableContext(1)] public class BuildingPieceCategory { public BuildPieceCategory Category; public string custom = ""; public void Set(BuildPieceCategory category) { Category = category; } public void Set(string customCategory) { Category = BuildPieceCategory.Custom; custom = customCategory; } } [PublicAPI] [<f790232b-01fd-467a-96f4-30823fb5c82f>Nullable(0)] [<62587ffe-2ae2-456b-878e-3d41b7daf150>NullableContext(1)] public class PieceTool { public readonly HashSet<string> Tools = new HashSet<string>(); public void Add(string tool) { Tools.Add(tool); } } [PublicAPI] [<62587ffe-2ae2-456b-878e-3d41b7daf150>NullableContext(1)] [<f790232b-01fd-467a-96f4-30823fb5c82f>Nullable(0)] public class BuildPiece { [<f790232b-01fd-467a-96f4-30823fb5c82f>Nullable(0)] internal class PieceConfig { public ConfigEntry<string> craft = null; public ConfigEntry<BuildPieceCategory> category = null; public ConfigEntry<string> customCategory = null; public ConfigEntry<string> tools = null; public ConfigEntry<CraftingTable> extensionTable = null; public ConfigEntry<string> customExtentionTable = null; public ConfigEntry<float> maxStationDistance = null; public ConfigEntry<CraftingTable> table = null; public ConfigEntry<string> customTable = null; } [<62587ffe-2ae2-456b-878e-3d41b7daf150>NullableContext(0)] private class ConfigurationManagerAttributes { [UsedImplicitly] public int? Order; [UsedImplicitly] public bool? Browsable; [<f790232b-01fd-467a-96f4-30823fb5c82f>Nullable(2)] [UsedImplicitly] public string Category; [UsedImplicitly] [<f790232b-01fd-467a-96f4-30823fb5c82f>Nullable(new byte[] { 2, 1 })] public Action<ConfigEntryBase> CustomDrawer; } [<f790232b-01fd-467a-96f4-30823fb5c82f>Nullable(0)] private class SerializedRequirements { public readonly List<Requirement> Reqs; public SerializedRequirements(List<Requirement> reqs) { Reqs = reqs; } public SerializedRequirements(string reqs) { Reqs = reqs.Split(new char[1] { ',' }).Select([<62587ffe-2ae2-456b-878e-3d41b7daf150>NullableContext(0)] (string r) => { string[] array = r.Split(new char[1] { ':' }); int result; bool result2 = default(bool); return new Requirement { itemName = array[0], amount = ((array.Length <= 1 || !int.TryParse(array[1], out result)) ? 1 : result), recover = (array.Length <= 2 || !bool.TryParse(array[2], out result2) || result2) }; }).ToList(); } public override string ToString() { return string.Join(",", Reqs.Select([<62587ffe-2ae2-456b-878e-3d41b7daf150>NullableContext(0)] (Requirement r) => $"{r.itemName}:{r.amount}:{r.recover}")); } [return: <f790232b-01fd-467a-96f4-30823fb5c82f>Nullable(2)] public static ItemDrop fetchByName(ObjectDB objectDB, string name) { GameObject itemPrefab = objectDB.GetItemPrefab(name); ItemDrop val = ((itemPrefab != null) ? itemPrefab.GetComponent<ItemDrop>() : null); if ((Object)(object)val == (Object)null) { Debug.LogWarning((object)(((!string.IsNullOrWhiteSpace(((Object)plugin).name)) ? ("[" + ((Object)plugin).name + "]") : "") + " The required item '" + name + "' does not exist.")); } return val; } public static Requirement[] toPieceReqs(SerializedRequirements craft) { Dictionary<string, Requirement> dictionary = craft.Reqs.Where((Requirement r) => r.itemName != "").ToDictionary((Func<Requirement, string>)([<62587ffe-2ae2-456b-878e-3d41b7daf150>NullableContext(0)] (Requirement r) => r.itemName), (Func<Requirement, Requirement>)([<62587ffe-2ae2-456b-878e-3d41b7daf150>NullableContext(0)] (Requirement r) => { //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_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) ItemDrop val = ResItem(r); return (val == null) ? ((Requirement)null) : new Requirement { m_amount = r.amount, m_resItem = val, m_recover = r.recover }; })); return dictionary.Values.Where([<62587ffe-2ae2-456b-878e-3d41b7daf150>NullableContext(0)] (Requirement v) => v != null).ToArray(); [<62587ffe-2ae2-456b-878e-3d41b7daf150>NullableContext(2)] static ItemDrop ResItem(Requirement r) { return fetchByName(ObjectDB.instance, r.itemName); } } } internal static readonly List<BuildPiece> registeredPieces = new List<BuildPiece>(); private static readonly Dictionary<Piece, BuildPiece> pieceMap = new Dictionary<Piece, BuildPiece>(); internal static Dictionary<BuildPiece, PieceConfig> pieceConfigs = new Dictionary<BuildPiece, PieceConfig>(); internal List<Conversion> Conversions = new List<Conversion>(); internal List<ItemConversion> conversions = new List<ItemConversion>(); [Description("Disables generation of the configs for your pieces. This is global, this turns it off for all pieces in your mod.")] public static bool ConfigurationEnabled = true; public readonly GameObject Prefab; [Description("Specifies the resources needed to craft the piece.\nUse .Add to add resources with their internal ID and an amount.\nUse one .Add for each resource type the building piece should need.")] public readonly RequiredResourcesList RequiredItems = new RequiredResourcesList(); [Description("Sets the category for the building piece.")] public readonly BuildingPieceCategory Category = new BuildingPieceCategory(); [Description("Specifies the tool needed to build your piece.\nUse .Add to add a tool.")] public readonly PieceTool Tool = new PieceTool(); [Description("Specifies the crafting station needed to build your piece.\nUse .Add to add a crafting station, using the CraftingTable enum and a minimum level for the crafting station.")] public CraftingStationList Crafting = new CraftingStationList(); [Description("Makes this piece a station extension")] public ExtensionList Extension = new ExtensionList(); [Description("Change the extended/special properties of your build piece.")] public SpecialProperties SpecialProperties; [Description("Specifies a config entry which toggles whether a recipe is active.")] [<f790232b-01fd-467a-96f4-30823fb5c82f>Nullable(2)] public ConfigEntryBase RecipeIsActive = null; [<f790232b-01fd-467a-96f4-30823fb5c82f>Nullable(2)] private LocalizeKey _name; [<f790232b-01fd-467a-96f4-30823fb5c82f>Nullable(2)] private LocalizeKey _description; internal string[] activeTools = null; [<f790232b-01fd-467a-96f4-30823fb5c82f>Nullable(2)] private static object configManager; [<f790232b-01fd-467a-96f4-30823fb5c82f>Nullable(2)] private static Localization _english; [<f790232b-01fd-467a-96f4-30823fb5c82f>Nullable(2)] internal static BaseUnityPlugin _plugin = null; private static bool hasConfigSync = true; [<f790232b-01fd-467a-96f4-30823fb5c82f>Nullable(2)] private static object _configSync; public LocalizeKey Name { get { LocalizeKey name = _name; if (name != null) { return name; } Piece component = Prefab.GetComponent<Piece>(); if (component.m_name.StartsWith("$")) { _name = new LocalizeKey(component.m_name); } else { string text = "$piece_" + ((Object)Prefab).name.Replace(" ", "_"); _name = new LocalizeKey(text).English(component.m_name); component.m_name = text; } return _name; } } public LocalizeKey Description { get { LocalizeKey description = _description; if (description != null) { return description; } Piece component = Prefab.GetComponent<Piece>(); if (component.m_description.StartsWith("$")) { _description = new LocalizeKey(component.m_description); } else { string text = "$piece_" + ((Object)Prefab).name.Replace(" ", "_") + "_description"; _description = new LocalizeKey(text).English(component.m_description); component.m_description = text; } return _description; } } private static Localization english => _english ?? (_english = LocalizationCache.ForLanguage("English")); internal static BaseUnityPlugin plugin { get { //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Expected O, but got Unknown if (_plugin != null) { return _plugin; } IEnumerable<TypeInfo> source; try { source = Assembly.GetExecutingAssembly().DefinedTypes.ToList(); } catch (ReflectionTypeLoadException ex) { source = from t in ex.Types where t != null select t.GetTypeInfo(); } _plugin = (BaseUnityPlugin)Chainloader.ManagerObject.GetComponent((Type)source.First([<62587ffe-2ae2-456b-878e-3d41b7daf150>NullableContext(0)] (TypeInfo t) => t.IsClass && typeof(BaseUnityPlugin).IsAssignableFrom(t))); return _plugin; } } [<f790232b-01fd-467a-96f4-30823fb5c82f>Nullable(2)] private static object configSync { [<62587ffe-2ae2-456b-878e-3d41b7daf150>NullableContext(2)] get { if (_configSync != null || !hasConfigSync) { return _configSync; } Type type = Assembly.GetExecutingAssembly().GetType("ServerSync.ConfigSync"); if ((object)type != null) { _configSync = Activator.CreateInstance(type, plugin.Info.Metadata.GUID + " PieceManager"); type.GetField("CurrentVersion").SetValue(_configSync, plugin.Info.Metadata.Version.ToString()); type.GetProperty("IsLocked").SetValue(_configSync, true); } else { hasConfigSync = false; } return _configSync; } } public BuildPiece(string assetBundleFileName, string prefabName, string folderName = "assets") : this(PiecePrefabManager.RegisterAssetBundle(assetBundleFileName, folderName), prefabName) { } public BuildPiece(AssetBundle bundle, string prefabName) { Prefab = PiecePrefabManager.RegisterPrefab(bundle, prefabName); registeredPieces.Add(this); } internal static void Patch_FejdStartup(FejdStartup __instance) { //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_02e1: Unknown result type (might be due to invalid IL or missing references) //IL_02eb: Expected O, but got Unknown //IL_0389: Unknown result type (might be due to invalid IL or missing references) //IL_0393: Expected O, but got Unknown //IL_0431: Unknown result type (might be due to invalid IL or missing references) //IL_040b: Unknown result type (might be due to invalid IL or missing references) //IL_0410: Unknown result type (might be due to invalid IL or missing references) //IL_048c: Unknown result type (might be due to invalid IL or missing references) //IL_0496: Expected O, but got Unknown //IL_0606: Unknown result type (might be due to invalid IL or missing references) //IL_0610: Expected O, but got Unknown //IL_08ea: Unknown result type (might be due to invalid IL or missing references) //IL_08f4: Expected O, but got Unknown //IL_067b: Unknown result type (might be due to invalid IL or missing references) //IL_0685: Expected O, but got Unknown //IL_0721: Unknown result type (might be due to invalid IL or missing references) //IL_072b: Expected O, but got Unknown //IL_095f: Unknown result type (might be due to invalid IL or missing references) //IL_0969: Expected O, but got Unknown //IL_0b7e: Unknown result type (might be due to invalid IL or missing references) //IL_0b88: Expected O, but got Unknown //IL_0c18: Unknown result type (might be due to invalid IL or missing references) //IL_0c22: Expected O, but got Unknown Type configManagerType = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault([<62587ffe-2ae2-456b-878e-3d41b7daf150>NullableContext(0)] (Assembly a) => a.GetName().Name == "ConfigurationManager")?.GetType("ConfigurationManager.ConfigurationManager"); configManager = ((configManagerType == null) ? null : Chainloader.ManagerObject.GetComponent(configManagerType)); foreach (BuildPiece registeredPiece in registeredPieces) { registeredPiece.activeTools = registeredPiece.Tool.Tools.DefaultIfEmpty("Hammer").ToArray(); if (registeredPiece.Category.Category != BuildPieceCategory.Custom) { registeredPiece.Prefab.GetComponent<Piece>().m_category = (PieceCategory)registeredPiece.Category.Category; } else { registeredPiece.Prefab.GetComponent<Piece>().m_category = PiecePrefabManager.GetCategory(registeredPiece.Category.custom); } } if (!ConfigurationEnabled) { return; } bool saveOnConfigSet = plugin.Config.SaveOnConfigSet; plugin.Config.SaveOnConfigSet = false; foreach (BuildPiece registeredPiece2 in registeredPieces) { BuildPiece piece = registeredPiece2; if (piece.SpecialProperties.NoConfig) { continue; } PieceConfig pieceConfig = (pieceConfigs[piece] = new PieceConfig()); PieceConfig cfg = pieceConfig; Piece piecePrefab = piece.Prefab.GetComponent<Piece>(); string pieceName = piecePrefab.m_name; string englishName = new Regex("[=\\n\\t\\\\\"\\'\\[\\]]*").Replace(english.Localize(pieceName), "").Trim(); string localizedName = Localization.instance.Localize(pieceName).Trim(); int order = 0; cfg.category = config(englishName, "Build Table Category", piece.Category.Category, new ConfigDescription("Build Category where " + localizedName + " is available.", (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { Order = (order -= 1), Category = localizedName } })); ConfigurationManagerAttributes customTableAttributes = new ConfigurationManagerAttributes { Order = (order -= 1), Browsable = (cfg.category.Value == BuildPieceCategory.Custom), Category = localizedName }; cfg.customCategory = config(englishName, "Custom Build Category", piece.Category.custom, new ConfigDescription("", (AcceptableValueBase)null, new object[1] { customTableAttributes })); cfg.category.SettingChanged += BuildTableConfigChanged; cfg.customCategory.SettingChanged += BuildTableConfigChanged; if (cfg.category.Value == BuildPieceCategory.Custom) { piecePrefab.m_category = PiecePrefabManager.GetCategory(cfg.customCategory.Value); } else { piecePrefab.m_category = (PieceCategory)cfg.category.Value; } cfg.tools = config(englishName, "Tools", string.Join(", ", piece.activeTools), new ConfigDescription("Comma separated list of tools where " + localizedName + " is available.", (AcceptableValueBase)null, new object[1] { customTableAttributes })); piece.activeTools = (from s in cfg.tools.Value.Split(new char[1] { ',' }) select s.Trim()).ToArray(); cfg.tools.SettingChanged += [<62587ffe-2ae2-456b-878e-3d41b7daf150>NullableContext(0)] (object _, EventArgs _) => { Inventory[] source = (from c in Player.s_players.Select([<62587ffe-2ae2-456b-878e-3d41b7daf150>NullableContext(0)] (Player p) => ((Humanoid)p).GetInventory()).Concat(from c in Object.FindObjectsOfType<Container>() select c.GetInventory()) where c != null select c).ToArray(); Dictionary<string, List<PieceTable>> dictionary = (from kv in (from i in (from p in ObjectDB.instance.m_items select p.GetComponent<ItemDrop>() into c where Object.op_Implicit((Object)(object)c) && Object.op_Implicit((Object)(object)((Component)c).GetComponent<ZNetView>()) select c).Concat(ItemDrop.s_instances) select new KeyValuePair<string, ItemData>(Utils.GetPrefabName(((Component)i).gameObject), i.m_itemData)).Concat(from i in source.SelectMany([<62587ffe-2ae2-456b-878e-3d41b7daf150>NullableContext(0)] (Inventory i) => i.GetAllItems()) select new KeyValuePair<string, ItemData>(((Object)i.m_dropPrefab).name, i)) where Object.op_Implicit((Object)(object)kv.Value.m_shared.m_buildPieces) group kv by kv.Key).ToDictionary([<62587ffe-2ae2-456b-878e-3d41b7daf150>NullableContext(0)] (IGrouping<string, KeyValuePair<string, ItemData>> g) => g.Key, [<62587ffe-2ae2-456b-878e-3d41b7daf150>NullableContext(0)] (IGrouping<string, KeyValuePair<string, ItemData>> g) => g.Select([<62587ffe-2ae2-456b-878e-3d41b7daf150>NullableContext(0)] (KeyValuePair<string, ItemData> kv) => kv.Value.m_shared.m_buildPieces).Distinct().ToList()); string[] array4 = piece.activeTools; foreach (string key in array4) { if (dictionary.TryGetValue(key, out var value)) { foreach (PieceTable item3 in value) { item3.m_pieces.Remove(piece.Prefab); } } } piece.activeTools = (from s in cfg.tools.Value.Split(new char[1] { ',' }) select s.Trim()).ToArray(); if (Object.op_Implicit((Object)(object)ObjectDB.instance)) { string[] array5 = piece.activeTools; foreach (string key2 in array5) { if (dictionary.TryGetValue(key2, out var value2)) { foreach (PieceTable item4 in value2) { if (!item4.m_pieces.Contains(piece.Prefab)) { item4.m_pieces.Add(piece.Prefab); } } } } if (Object.op_Implicit((Object)(object)Player.m_localPlayer) && Object.op_Implicit((Object)(object)Player.m_localPlayer.m_buildPieces)) { PiecePrefabManager.CategoryRefreshNeeded = true; ((Humanoid)Player.m_localPlayer).SetPlaceMode(Player.m_localPlayer.m_buildPieces); } } }; StationExtension pieceExtensionComp; List<ConfigurationManagerAttributes> hideWhenNoneAttributes; if (piece.Extension.ExtensionStations.Count > 0) { pieceExtensionComp = piece.Prefab.GetOrAddComponent<StationExtension>(); PieceConfig pieceConfig3 = cfg; string text = englishName; CraftingTable table = piece.Extension.ExtensionStations.First().Table; string text2 = "Crafting station that " + localizedName + " extends."; object[] array = new object[1]; ConfigurationManagerAttributes configurationManagerAttributes = new ConfigurationManagerAttributes(); int num = order - 1; order = num; configurationManagerAttributes.Order = num; array[0] = configurationManagerAttributes; pieceConfig3.extensionTable = config(text, "Extends Station", table, new ConfigDescription(text2, (AcceptableValueBase)null, array)); cfg.customExtentionTable = config(englishName, "Custom Extend Station", piece.Extension.ExtensionStations.First().custom ?? "", new ConfigDescription("", (AcceptableValueBase)null, new object[1] { customTableAttributes })); PieceConfig pieceConfig4 = cfg; string text3 = englishName; float maxStationDistance = piece.Extension.ExtensionStations.First().maxStationDistance; string text4 = "Distance from the station that " + localizedName + " can be placed."; object[] array2 = new object[1]; ConfigurationManagerAttributes configurationManagerAttributes2 = new ConfigurationManagerAttributes(); num = order - 1; order = num; configurationManagerAttributes2.Order = num; array2[0] = configurationManagerAttributes2; pieceConfig4.maxStationDistance = config(text3, "Max Station Distance", maxStationDistance, new ConfigDescription(text4, (AcceptableValueBase)null, array2)); hideWhenNoneAttributes = new List<ConfigurationManagerAttributes>(); cfg.extensionTable.SettingChanged += ExtensionTableConfigChanged; cfg.customExtentionTable.SettingChanged += ExtensionTableConfigChanged; cfg.maxStationDistance.SettingChanged += ExtensionTableConfigChanged; ConfigurationManagerAttributes configurationManagerAttributes3 = new ConfigurationManagerAttributes(); num = order - 1; order = num; configurationManagerAttributes3.Order = num; configurationManagerAttributes3.Browsable = cfg.extensionTable.Value != CraftingTable.None; ConfigurationManagerAttributes item = configurationManagerAttributes3; hideWhenNoneAttributes.Add(item); } List<ConfigurationManagerAttributes> hideWhenNoneAttributes2; if (piece.Crafting.Stations.Count > 0) { hideWhenNoneAttributes2 = new List<ConfigurationManagerAttributes>(); PieceConfig pieceConfig5 = cfg; string text5 = englishName; CraftingTable table2 = piece.Crafting.Stations.First().Table; string text6 = "Crafting station where " + localizedName + " is available."; object[] array3 = new object[1]; ConfigurationManagerAttributes configurationManagerAttributes4 = new ConfigurationManagerAttributes(); int num = order - 1; order = num; configurationManagerAttributes4.Order = num; array3[0] = configurationManagerAttributes4; pieceConfig5.table = config(text5, "Crafting Station", table2, new ConfigDescription(text6, (AcceptableValueBase)null, array3)); cfg.customTable = config(englishName, "Custom Crafting Station", piece.Crafting.Stations.First().custom ?? "", new ConfigDescription("", (AcceptableValueBase)null, new object[1] { customTableAttributes })); cfg.table.SettingChanged += TableConfigChanged; cfg.customTable.SettingChanged += TableConfigChanged; ConfigurationManagerAttributes configurationManagerAttributes5 = new ConfigurationManagerAttributes(); num = order - 1; order = num; configurationManagerAttributes5.Order = num; configurationManagerAttributes5.Browsable = cfg.table.Value != CraftingTable.None; ConfigurationManagerAttributes item2 = configurationManagerAttributes5; hideWhenNoneAttributes2.Add(item2); } cfg.craft = itemConfig("Crafting Costs", new SerializedRequirements(piece.RequiredItems.Requirements).ToString(), "Item costs to craft " + localizedName); cfg.craft.SettingChanged += [<62587ffe-2ae2-456b-878e-3d41b7daf150>NullableContext(0)] (object _, EventArgs _) => { if (Object.op_Implicit((Object)(object)ObjectDB.instance) && (Object)(object)ObjectDB.instance.GetItemPrefab("YmirRemains") != (Object)null) { Requirement[] resources = SerializedRequirements.toPieceReqs(new SerializedRequirements(cfg.craft.Value)); piecePrefab.m_resources = resources; Piece[] array4 = Object.FindObjectsOfType<Piece>(); foreach (Piece val in array4) { if (val.m_name == pieceName) { val.m_resources = resources; } } } }; for (int num2 = 0; num2 < piece.Conversions.Count; num2++) { string text7 = ((piece.Conversions.Count > 1) ? $"{num2 + 1}. " : ""); Conversion conversion = piece.Conversions[num2]; conversion.config = new Conversion.ConversionConfig(); int index = num2; conversion.config.input = config(englishName, text7 + "Conversion Input Item", conversion.Input, new ConfigDescription("Conversion input item within " + englishName, (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { Category = localizedName } })); conversion.config.input.SettingChanged += [<62587ffe-2ae2-456b-878e-3d41b7daf150>NullableContext(0)] (object _, EventArgs _) => { if (index < piece.conversions.Count) { ObjectDB instance = ObjectDB.instance; if (instance != null) { ItemDrop val = SerializedRequirements.fetchByName(instance, conversion.config.input.Value); piece.conversions[index].m_from = val; } } }; conversion.config.output = config(englishName, text7 + "Conversion Output Item", conversion.Output, new ConfigDescription("Conversion output item within " + englishName, (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { Category = localizedName } })); conversion.config.output.SettingChanged += [<62587ffe-2ae2-456b-878e-3d41b7daf150>NullableContext(0)] (object _, EventArgs _) => { if (index < piece.conversions.Count) { ObjectDB instance = ObjectDB.instance; if (instance != null) {