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 VAI TER CEBOLA v1.0.3
plugins/Cebola/BakaMODs.VaiTerCebola.dll
Decompiled 6 months agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BakaMODs.VaiTerCebola.NetcodePatcher; using BakaMODs.VaiTerCebola.Patches; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using LethalLib.Modules; using Microsoft.CodeAnalysis; using Unity.Netcode; using UnityEngine; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("BakaMODs.VaiTerCebola")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+0864a05544691c96bb0f101813317f1ce77b7629")] [assembly: AssemblyProduct("VaiTerCebola")] [assembly: AssemblyTitle("BakaMODs.VaiTerCebola")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] internal class <Module> { static <Module>() { NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedByMemcpy<bool>(); NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedIEquatable<bool>(); } } namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace BakaMODs.VaiTerCebola { public class CebolaEfeitos : NetworkBehaviour { [CompilerGenerated] private sealed class <RefreshScanAfterDelay>d__25 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public CebolaEfeitos <>4__this; object? IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object? IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <RefreshScanAfterDelay>d__25(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = null; <>1__state = 1; return true; case 1: <>1__state = -1; <>2__current = (object)new WaitForSeconds(0.1f); <>1__state = 2; return true; case 2: <>1__state = -1; if ((Object)(object)<>4__this.grabbableObject != (Object)null) { <>4__this.SincronizarValorDeScrap(); } <>4__this.refreshRoutine = null; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [Header("Sons da Cebola")] public AudioClip? somInteracao; public AudioClip? somSoltar; public AudioClip? somVendaMaldita; private GrabbableObject grabbableObject = null; private AudioSource audioSource = null; private Rigidbody? rigidbodyComponent; private ScanNodeProperties? scanNodeProperties; private string? originalScanHeader; private string? originalScanSubText; private Coroutine? refreshRoutine; private bool audioMutado; private NetworkVariable<bool> mutedNet = new NetworkVariable<bool>(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private float proximaSincronizacaoValor; private static readonly List<PlayerControllerB> playersComEfeitoDecaindo = new List<PlayerControllerB>(); private PlayerControllerB? jogadorSegurandoAtualmente; private float tempoSegurando; private bool mostrandoTipMute; private float tempoUltimaTip; private void Awake() { grabbableObject = ((Component)this).GetComponent<GrabbableObject>(); rigidbodyComponent = ((Component)this).GetComponent<Rigidbody>(); if ((Object)(object)rigidbodyComponent != (Object)null) { rigidbodyComponent.isKinematic = false; rigidbodyComponent.useGravity = true; rigidbodyComponent.collisionDetectionMode = (CollisionDetectionMode)2; rigidbodyComponent.interpolation = (RigidbodyInterpolation)1; } scanNodeProperties = ((Component)this).GetComponentInChildren<ScanNodeProperties>(true); if ((Object)(object)scanNodeProperties != (Object)null) { originalScanHeader = scanNodeProperties.headerText; originalScanSubText = scanNodeProperties.subText; Collider[] componentsInChildren = ((Component)scanNodeProperties).GetComponentsInChildren<Collider>(); foreach (Collider val in componentsInChildren) { val.isTrigger = true; } } audioSource = ((Component)this).GetComponent<AudioSource>(); if ((Object)(object)audioSource == (Object)null) { audioSource = ((Component)this).gameObject.AddComponent<AudioSource>(); audioSource.playOnAwake = false; audioSource.spatialBlend = 1f; } audioSource.dopplerLevel = 0f; } private void Start() { ScheduleScanRefresh(); } public override void OnNetworkSpawn() { //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) NetworkVariable<bool> obj = mutedNet; obj.OnValueChanged = (OnValueChangedDelegate<bool>)(object)Delegate.Combine((Delegate?)(object)obj.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<bool>(OnMutedNetChanged)); OnMutedNetChanged(previous: false, mutedNet.Value); if (!((Object)(object)NetworkManager.Singleton != (Object)null) || (!NetworkManager.Singleton.IsServer && !NetworkManager.Singleton.IsHost)) { return; } if ((Object)(object)grabbableObject == (Object)null) { grabbableObject = ((Component)this).GetComponent<GrabbableObject>(); } if ((Object)(object)grabbableObject != (Object)null) { if (grabbableObject.propColliders == null || grabbableObject.propColliders.Length == 0) { grabbableObject.propColliders = ((Component)this).GetComponentsInChildren<Collider>(); } if ((Object)(object)grabbableObject.propBody == (Object)null) { grabbableObject.propBody = ((Component)this).GetComponent<Rigidbody>(); } if ((Object)(object)grabbableObject.propBody != (Object)null) { Rigidbody propBody = grabbableObject.propBody; propBody.useGravity = true; propBody.isKinematic = false; propBody.collisionDetectionMode = (CollisionDetectionMode)2; propBody.interpolation = (RigidbodyInterpolation)1; propBody.velocity = Vector3.zero; propBody.angularVelocity = Vector3.zero; } } } public override void OnNetworkDespawn() { NetworkVariable<bool> obj = mutedNet; obj.OnValueChanged = (OnValueChangedDelegate<bool>)(object)Delegate.Remove((Delegate?)(object)obj.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<bool>(OnMutedNetChanged)); } private void OnMutedNetChanged(bool previous, bool current) { ApplyMuteLocal(current); } public void AtualizarValorScrap(int novoValor) { if ((Object)(object)grabbableObject != (Object)null) { grabbableObject.scrapValue = novoValor; } AtualizarTextoDoScan(novoValor); } public void ScheduleScanRefresh() { if (refreshRoutine != null) { ((MonoBehaviour)this).StopCoroutine(refreshRoutine); } refreshRoutine = ((MonoBehaviour)this).StartCoroutine(RefreshScanAfterDelay()); } [IteratorStateMachine(typeof(<RefreshScanAfterDelay>d__25))] private IEnumerator RefreshScanAfterDelay() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <RefreshScanAfterDelay>d__25(0) { <>4__this = this }; } private void AtualizarTextoDoScan(int valor) { if (!((Object)(object)scanNodeProperties == (Object)null)) { int num = 350; scanNodeProperties.scrapValue = num; if (!string.IsNullOrWhiteSpace(originalScanHeader)) { scanNodeProperties.headerText = $"{originalScanHeader} (${num})"; } string arg = (string.IsNullOrWhiteSpace(originalScanSubText) ? string.Empty : ("\n" + originalScanSubText)); string arg2 = (audioMutado ? " (MUTED)" : ""); scanNodeProperties.subText = $"Valor: {num}{arg2}{arg}"; } } private void Update() { if (playersComEfeitoDecaindo.Count > 0) { for (int num = playersComEfeitoDecaindo.Count - 1; num >= 0; num--) { PlayerControllerB val = playersComEfeitoDecaindo[num]; if ((Object)(object)val != (Object)null && val.drunkness > 0f) { val.drunkness = Mathf.Max(val.drunkness - Time.deltaTime / 120f, 0f); } else { playersComEfeitoDecaindo.RemoveAt(num); } } } if ((Object)(object)grabbableObject == (Object)null) { return; } if (Time.time >= proximaSincronizacaoValor) { proximaSincronizacaoValor = Time.time + 1f; SincronizarValorDeScrap(); } PlayerControllerB val2 = (grabbableObject.isHeld ? grabbableObject.playerHeldBy : null); if ((Object)(object)val2 != (Object)null && (Object)(object)jogadorSegurandoAtualmente == (Object)null) { OnPickup(val2); } else if ((Object)(object)val2 == (Object)null && (Object)(object)jogadorSegurandoAtualmente != (Object)null) { OnDrop(jogadorSegurandoAtualmente); } else if ((Object)(object)val2 != (Object)null) { tempoSegurando += Time.deltaTime; val2.drunkness = Mathf.Min(tempoSegurando / 60f, 1f); bool flag = (Object)(object)StartOfRound.Instance != (Object)null && (Object)(object)val2 == (Object)(object)StartOfRound.Instance.localPlayerController; if (flag && !mostrandoTipMute && Time.time - tempoUltimaTip > 5f) { MostrarTipMute(); } if (flag && Keyboard.current != null && ((ButtonControl)Keyboard.current.qKey).wasPressedThisFrame) { if ((Object)(object)NetworkManager.Singleton != (Object)null && NetworkManager.Singleton.IsListening && ((NetworkBehaviour)this).IsSpawned && (NetworkManager.Singleton.IsServer || NetworkManager.Singleton.IsHost)) { mutedNet.Value = !mutedNet.Value; } else { ApplyMuteLocal(!audioMutado); } } } jogadorSegurandoAtualmente = val2; } private void OnPickup(PlayerControllerB player) { if (playersComEfeitoDecaindo.Contains(player)) { playersComEfeitoDecaindo.Remove(player); } tempoSegurando = player.drunkness * 60f; if (!audioMutado && (Object)(object)somInteracao != (Object)null) { audioSource.Stop(); audioSource.PlayOneShot(somInteracao); } } private void OnDrop(PlayerControllerB player) { if (!playersComEfeitoDecaindo.Contains(player)) { playersComEfeitoDecaindo.Add(player); } tempoSegurando = 0f; mostrandoTipMute = false; if (!audioMutado && (Object)(object)somSoltar != (Object)null) { audioSource.Stop(); audioSource.PlayOneShot(somSoltar); } } private void SincronizarValorDeScrap() { if (!((Object)(object)grabbableObject == (Object)null)) { int num = VaiTerCebolaPlugin.CalcularValorBaseDeScrap(); if (grabbableObject.scrapValue != num) { AtualizarValorScrap(num); } else { AtualizarTextoDoScan(num); } } } private void ApplyMuteLocal(bool muted) { audioMutado = muted; if ((Object)(object)audioSource != (Object)null) { audioSource.Stop(); audioSource.mute = muted; } if ((Object)(object)grabbableObject != (Object)null) { AtualizarTextoDoScan(grabbableObject.scrapValue); } } private void MostrarTipMute() { if ((Object)(object)HUDManager.Instance != (Object)null) { HUDManager.Instance.DisplayTip("Audio Control", "[Q] to mute/unmute audio", false, false, "LC_Tip1"); mostrandoTipMute = true; tempoUltimaTip = Time.time; } } protected override void __initializeVariables() { if (mutedNet == null) { throw new Exception("CebolaEfeitos.mutedNet cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)mutedNet).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)mutedNet, "mutedNet"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)mutedNet); ((NetworkBehaviour)this).__initializeVariables(); } protected internal override string? __getTypeName() { return "CebolaEfeitos"; } } [BepInPlugin("BakaMODs.VaiTerCebola", "VaiTerCebola", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class VaiTerCebolaPlugin : BaseUnityPlugin { internal static ManualLogSource Logger; private readonly Harmony harmony = new Harmony("BakaMODs.VaiTerCebola"); private const string AssetBundleName = "cebolaassets"; private const string ScrapItemAssetPath = "Assets/ModAssets/Cebola/Cebola.asset"; internal const int ValorVendaBase = 350; public static Item? CebolaScrap; public static AssetBundle? ModAssetBundle; internal static int CalcularValorBaseDeScrap() { float num = 1f; try { StartOfRound instance = StartOfRound.Instance; if ((Object)(object)instance != (Object)null) { num = instance.companyBuyingRate; } } catch { num = 1f; } num = Mathf.Clamp(num, 0.01f, 100f); int num2 = Mathf.Max(1, Mathf.RoundToInt(350f / num)); if (Mathf.RoundToInt((float)num2 * num) == 350) { return num2; } for (int i = 1; i <= 200; i++) { int num3 = num2 + i; if (Mathf.RoundToInt((float)num3 * num) == 350) { return num3; } int num4 = num2 - i; if (num4 > 0 && Mathf.RoundToInt((float)num4 * num) == 350) { return num4; } } return num2; } private void Awake() { Logger = ((BaseUnityPlugin)this).Logger; string text = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location) ?? "", "cebolaassets"); ModAssetBundle = AssetBundle.LoadFromFile(text); if ((Object)(object)ModAssetBundle == (Object)null) { Logger.LogError((object)"Falha ao carregar o AssetBundle! Verifique se o arquivo 'cebolaassets' está na pasta do mod."); return; } CebolaScrap = ModAssetBundle.LoadAsset<Item>("Assets/ModAssets/Cebola/Cebola.asset"); if ((Object)(object)CebolaScrap == (Object)null) { Logger.LogError((object)"Falha ao carregar o asset do item 'Assets/ModAssets/Cebola/Cebola.asset' do AssetBundle."); return; } CebolaScrap.minValue = 350; CebolaScrap.maxValue = 350; CebolaScrap.creditsWorth = 350; if ((Object)(object)CebolaScrap.spawnPrefab != (Object)null) { GrabbableObject component = CebolaScrap.spawnPrefab.GetComponent<GrabbableObject>(); if ((Object)(object)component != (Object)null) { component.scrapValue = CalcularValorBaseDeScrap(); } } Items.RegisterScrap(CebolaScrap, 20, (LevelTypes)(-1)); if ((Object)(object)CebolaScrap.spawnPrefab != (Object)null) { NetworkPrefabs.RegisterNetworkPrefab(CebolaScrap.spawnPrefab); } else { Logger.LogError((object)"spawnPrefab da CebolaScrap é nulo; não foi possível registrar o NetworkPrefab."); } Logger.LogInfo((object)"Cebola registrada como sucata."); harmony.PatchAll(typeof(RoundManagerPatch)); harmony.PatchAll(typeof(GrabbableObjectPatch)); harmony.PatchAll(typeof(DepositItemsDeskPatch)); Logger.LogInfo((object)"Patch do RoundManager para spawn da cebola aplicado."); Logger.LogInfo((object)"Plugin BakaMODs.VaiTerCebola foi carregado!"); } } public static class PluginInfo { public const string PLUGIN_GUID = "BakaMODs.VaiTerCebola"; public const string PLUGIN_NAME = "VaiTerCebola"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace BakaMODs.VaiTerCebola.Patches { [HarmonyPatch(typeof(DepositItemsDesk))] internal class DepositItemsDeskPatch { [CompilerGenerated] private sealed class <VendaMalditaCoroutine>d__2 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public DepositItemsDesk desk; public CebolaEfeitos cebola; public PlayerControllerB player; private AudioClip <somVenda>5__1; private float <tempoDeEspera>5__2; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <VendaMalditaCoroutine>d__2(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <somVenda>5__1 = null; <>1__state = -2; } private bool MoveNext() { //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0135: 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_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Expected O, but got Unknown //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <somVenda>5__1 = cebola.somVendaMaldita; <tempoDeEspera>5__2 = 2.5f; if ((Object)(object)<somVenda>5__1 != (Object)null) { desk.deskAudio.PlayOneShot(<somVenda>5__1); <tempoDeEspera>5__2 = <somVenda>5__1.length; } <>2__current = (object)new WaitForSeconds(<tempoDeEspera>5__2); <>1__state = 1; return true; case 1: <>1__state = -1; if ((Object)(object)NetworkManager.Singleton != (Object)null) { if (NetworkManager.Singleton.IsServer) { desk.Attack(); } else { desk.AttackPlayersServerRpc(); } } else { desk.Attack(); } if ((Object)(object)player != (Object)null) { <>2__current = (object)new WaitForSeconds(0.15f); <>1__state = 2; return true; } break; case 2: <>1__state = -1; player.KillPlayer(Vector3.zero, true, (CauseOfDeath)0, 0, default(Vector3)); break; } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private static readonly HashSet<GrabbableObject> cebolasAmaldicoadas = new HashSet<GrabbableObject>(); [HarmonyPatch("PlaceItemOnCounter")] [HarmonyPrefix] public static bool OnPlaceItemOnCounter(DepositItemsDesk __instance, PlayerControllerB playerWhoTriggered) { GrabbableObject currentlyHeldObjectServer = playerWhoTriggered.currentlyHeldObjectServer; if ((Object)(object)currentlyHeldObjectServer == (Object)null) { return true; } CebolaEfeitos component = ((Component)currentlyHeldObjectServer).GetComponent<CebolaEfeitos>(); if ((Object)(object)component == (Object)null) { return true; } if (cebolasAmaldicoadas.Contains(currentlyHeldObjectServer)) { cebolasAmaldicoadas.Remove(currentlyHeldObjectServer); return true; } cebolasAmaldicoadas.Add(currentlyHeldObjectServer); ((MonoBehaviour)__instance).StartCoroutine(VendaMalditaCoroutine(__instance, component, playerWhoTriggered)); return false; } [IteratorStateMachine(typeof(<VendaMalditaCoroutine>d__2))] private static IEnumerator VendaMalditaCoroutine(DepositItemsDesk desk, CebolaEfeitos cebola, PlayerControllerB player) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <VendaMalditaCoroutine>d__2(0) { desk = desk, cebola = cebola, player = player }; } } [HarmonyPatch(typeof(GrabbableObject))] internal static class GrabbableObjectPatch { [HarmonyPatch("SetScrapValue")] [HarmonyPostfix] private static void OnSetScrapValue(GrabbableObject __instance, int setValueTo) { CebolaEfeitos cebolaEfeitos = default(CebolaEfeitos); if (((Component)__instance).TryGetComponent<CebolaEfeitos>(ref cebolaEfeitos)) { int num = VaiTerCebolaPlugin.CalcularValorBaseDeScrap(); if (__instance.scrapValue != num) { __instance.scrapValue = num; } cebolaEfeitos.AtualizarValorScrap(num); } } } [HarmonyPatch(typeof(RoundManager))] internal class RoundManagerPatch { [HarmonyPatch("SpawnScrapInLevel")] [HarmonyPostfix] public static void SpawnCebolasPatch(RoundManager __instance) { //IL_00be: 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_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: 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_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0111: 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_011b: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) Item cebolaScrap = VaiTerCebolaPlugin.CebolaScrap; if (!((NetworkBehaviour)__instance).IsHost || (Object)(object)cebolaScrap == (Object)null) { return; } List<Transform> list = (from s in Object.FindObjectsOfType<RandomScrapSpawn>() select ((Component)s).transform).ToList(); if (list.Count == 0) { VaiTerCebolaPlugin.Logger.LogWarning((object)"Nenhum ponto de spawn de sucata (RandomScrapSpawn) encontrado!"); return; } int num = 3; VaiTerCebolaPlugin.Logger.LogInfo((object)$"Encontrados {list.Count} pontos de spawn. Spawning de {num} cebolas..."); RaycastHit val4 = default(RaycastHit); for (int i = 0; i < num; i++) { Transform val = list[Random.Range(0, list.Count)]; Vector3 val2 = val.position; Quaternion val3 = val.rotation; if (Physics.Raycast(val2 + Vector3.up * 2f, Vector3.down, ref val4, 20f, -1, (QueryTriggerInteraction)1)) { val2 = ((RaycastHit)(ref val4)).point + ((RaycastHit)(ref val4)).normal * 0.02f; if (((RaycastHit)(ref val4)).normal != Vector3.zero) { val3 = Quaternion.FromToRotation(Vector3.up, ((RaycastHit)(ref val4)).normal) * val3; } } GameObject val5 = Object.Instantiate<GameObject>(cebolaScrap.spawnPrefab, val2, val3); GrabbableObject component = val5.GetComponent<GrabbableObject>(); CebolaEfeitos component2 = val5.GetComponent<CebolaEfeitos>(); if ((Object)(object)component != (Object)null) { if (component.propColliders == null || component.propColliders.Length == 0) { component.propColliders = val5.GetComponentsInChildren<Collider>(); } if ((Object)(object)component.propBody == (Object)null) { component.propBody = val5.GetComponent<Rigidbody>(); } if ((Object)(object)component.propBody != (Object)null) { Rigidbody propBody = component.propBody; propBody.useGravity = true; propBody.isKinematic = false; propBody.collisionDetectionMode = (CollisionDetectionMode)2; propBody.velocity = Vector3.zero; propBody.angularVelocity = Vector3.zero; } int scrapValue = VaiTerCebolaPlugin.CalcularValorBaseDeScrap(); component.SetScrapValue(scrapValue); } component2?.ScheduleScanRefresh(); NetworkObject component3 = val5.GetComponent<NetworkObject>(); if ((Object)(object)component3 != (Object)null) { component3.Spawn(false); } } VaiTerCebolaPlugin.Logger.LogInfo((object)$"{num} cebolas foram adicionadas ao mapa!"); } } } namespace BakaMODs.VaiTerCebola.Configuration { public class PluginConfig { public PluginConfig(ConfigFile cfg) { } } } namespace BakaMODs.VaiTerCebola.NetcodePatcher { [AttributeUsage(AttributeTargets.Module)] internal class NetcodePatchedAssemblyAttribute : Attribute { } }