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 TarExtractor v1.0.0
TarExtractor.dll
Decompiled 6 days agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Jotunn.Configs; using Jotunn.Entities; using Jotunn.Managers; using Jotunn.Utils; using Microsoft.CodeAnalysis; using TarExtractorMod.Core; using TarExtractorMod.Extractor; using TarExtractorMod.Prefabs; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: IgnoresAccessChecksTo("")] [assembly: AssemblyCompany("TarExtractor")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Adds a buildable Tar Extractor that passively collects Tar from Plains tar pits.")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+cca096c4a61ecf3617483e3a7f3b6c98525d6dc8")] [assembly: AssemblyProduct("TarExtractor")] [assembly: AssemblyTitle("TarExtractor")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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 TarExtractorMod { [BepInPlugin("javidahmed64592.tarextractor", "Tar Extractor", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] public class TarExtractorPlugin : BaseUnityPlugin { public const string PluginGUID = "javidahmed64592.tarextractor"; public const string PluginName = "Tar Extractor"; public const string PluginVersion = "1.0.0"; internal static ManualLogSource _log; internal static ConfigEntry<float> _secondsPerTar; internal static ConfigEntry<int> _maxTar; internal static ConfigEntry<int> _maxPerPit; private Harmony _harmony; private void Awake() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Expected O, but got Unknown //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Expected O, but got Unknown //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Expected O, but got Unknown //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Expected O, but got Unknown //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Expected O, but got Unknown //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Expected O, but got Unknown _log = ((BaseUnityPlugin)this).Logger; _secondsPerTar = ((BaseUnityPlugin)this).Config.Bind<float>("Tar Extractor", "Seconds Per Tar", 60f, new ConfigDescription("Seconds it takes the Tar Extractor to produce 1 Tar. (Synced with server)", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes { IsAdminOnly = true } })); _maxTar = ((BaseUnityPlugin)this).Config.Bind<int>("Tar Extractor", "Max Tar", 200, new ConfigDescription("Maximum amount of Tar a Tar Extractor can hold. (Synced with server)", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes { IsAdminOnly = true } })); _maxPerPit = ((BaseUnityPlugin)this).Config.Bind<int>("Tar Extractor", "Max Per Pit", 0, new ConfigDescription("Most Tar Extractors that can be built in one tar pit. 0 means no limit. Extractors already built are kept when the limit is lowered. (Synced with server)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), new object[1] { (object)new ConfigurationManagerAttributes { IsAdminOnly = true } })); Translations.Load(); PrefabManager.OnVanillaPrefabsAvailable += TarExtractorPrefab.Register; _harmony = new Harmony("javidahmed64592.tarextractor"); _harmony.PatchAll(); } private void OnDestroy() { Harmony harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } } } } namespace TarExtractorMod.Prefabs { internal static class TarExtractorPrefab { internal const string PrefabName = "piece_tarextractor"; private const string SapExtractorPrefab = "piece_sapcollector"; private static readonly Color TarTint = new Color(0.44f, 0.36f, 0.32f, 1f); private static readonly Color TarGlow = new Color(0.025f, 0.005f, 0.035f, 1f); internal const string NotEmptyEffectName = "NotEmptyEffect"; private const string GrowthPrefab = "BlobTar"; private const string GrowthOozePath = "Visual/particles/wetsplsh"; public static void Register() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Expected O, but got Unknown //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Expected O, but got Unknown //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Expected O, but got Unknown //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Expected O, but got Unknown PrefabManager.OnVanillaPrefabsAvailable -= Register; PieceConfig val = new PieceConfig(); val.Name = "$piece_tarextractor"; val.Description = "$piece_tarextractor_description"; val.PieceTable = "Hammer"; val.Category = "Crafting"; val.CraftingStation = "piece_workbench"; val.Requirements = (RequirementConfig[])(object)new RequirementConfig[3] { new RequirementConfig("YggdrasilWood", 10, 0, true), new RequirementConfig("BlackMetal", 5, 0, true), new RequirementConfig("DvergrNeedle", 1, 0, true) }; PieceConfig val2 = val; CustomPiece val3 = new CustomPiece("piece_tarextractor", "piece_sapcollector", val2); ConvertToTarExtractor(val3.PiecePrefab); PieceManager.Instance.AddPiece(val3); } private static void ConvertToTarExtractor(GameObject prefab) { Piece component = prefab.GetComponent<Piece>(); Component component2 = prefab.GetComponent("SapCollector"); if ((Object)(object)component2 != (Object)null) { Object.DestroyImmediate((Object)(object)component2); } else { TarExtractorPlugin._log.LogWarning((object)"No SapCollector component found on the cloned prefab - the vanilla component may have been renamed."); } ClearConnectionRequirement(component); prefab.AddComponent<TarExtractor>(); TintRenderers(prefab); RecolorEffects(prefab); ReplaceLightWithOoze(prefab); Transform val = FindChild(prefab.transform, "NotEmptyEffect"); if ((Object)(object)val != (Object)null) { ((Component)val).gameObject.SetActive(false); } else { TarExtractorPlugin._log.LogWarning((object)"No 'NotEmptyEffect' found on the cloned prefab - effects stay always on."); } } private static void RecolorEffects(GameObject prefab) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: 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_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_003a: 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_00b4: 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_00aa: Expected O, but got Unknown ParticleSystem[] componentsInChildren = prefab.GetComponentsInChildren<ParticleSystem>(true); foreach (ParticleSystem obj in componentsInChildren) { MainModule main = obj.main; ((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(TarGlow); ColorOverLifetimeModule colorOverLifetime = obj.colorOverLifetime; if (((ColorOverLifetimeModule)(ref colorOverLifetime)).enabled) { ((ColorOverLifetimeModule)(ref colorOverLifetime)).color = WhiteKeepAlpha(((ColorOverLifetimeModule)(ref colorOverLifetime)).color); } } Renderer[] componentsInChildren2 = prefab.GetComponentsInChildren<Renderer>(true); foreach (Renderer val in componentsInChildren2) { Material[] sharedMaterials = val.sharedMaterials; for (int j = 0; j < sharedMaterials.Length; j++) { if (!((Object)(object)sharedMaterials[j] == (Object)null) && sharedMaterials[j].HasProperty("_EmissionColor")) { if (val is ParticleSystemRenderer) { sharedMaterials[j] = new Material(sharedMaterials[j]); } sharedMaterials[j].SetColor("_EmissionColor", TarGlow); } } val.sharedMaterials = sharedMaterials; } } private static MinMaxGradient WhiteKeepAlpha(MinMaxGradient source) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected I4, but got Unknown //IL_0034: 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_0043: 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_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_005c: 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_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0086: 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_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: 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_00c8: Unknown result type (might be due to invalid IL or missing references) ParticleSystemGradientMode mode = ((MinMaxGradient)(ref source)).mode; return (MinMaxGradient)((int)mode switch { 0 => new MinMaxGradient(new Color(1f, 1f, 1f, ((MinMaxGradient)(ref source)).color.a)), 2 => new MinMaxGradient(new Color(1f, 1f, 1f, ((MinMaxGradient)(ref source)).colorMin.a), new Color(1f, 1f, 1f, ((MinMaxGradient)(ref source)).colorMax.a)), 1 => new MinMaxGradient(WhiteKeepAlpha(((MinMaxGradient)(ref source)).gradient)), 3 => new MinMaxGradient(WhiteKeepAlpha(((MinMaxGradient)(ref source)).gradientMin), WhiteKeepAlpha(((MinMaxGradient)(ref source)).gradientMax)), _ => source, }); } private static Gradient WhiteKeepAlpha(Gradient source) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown //IL_000f: 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_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) Gradient val = new Gradient(); val.SetKeys((GradientColorKey[])(object)new GradientColorKey[2] { new GradientColorKey(Color.white, 0f), new GradientColorKey(Color.white, 1f) }, source.alphaKeys); val.mode = source.mode; return val; } private static void ReplaceLightWithOoze(GameObject prefab) { //IL_0033: 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_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: 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_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) Light componentInChildren = prefab.GetComponentInChildren<Light>(true); if ((Object)(object)componentInChildren == (Object)null) { TarExtractorPlugin._log.LogWarning((object)"No light found on the cloned prefab - the ooze effect is not added."); return; } Transform parent = ((Component)componentInChildren).transform.parent; Vector3 localPosition = ((Component)componentInChildren).transform.localPosition; Object.DestroyImmediate((Object)(object)((Component)componentInChildren).gameObject); GameObject prefab2 = PrefabManager.Instance.GetPrefab("BlobTar"); Transform val = (((Object)(object)prefab2 != (Object)null) ? prefab2.transform.Find("Visual/particles/wetsplsh") : null); if ((Object)(object)val == (Object)null) { TarExtractorPlugin._log.LogWarning((object)"Could not find 'Visual/particles/wetsplsh' on 'BlobTar' - no ooze effect."); return; } GameObject obj = Object.Instantiate<GameObject>(((Component)val).gameObject, parent, false); ((Object)obj).name = "tar_ooze"; obj.transform.localPosition = localPosition; obj.SetActive(true); ParticleSystem component = obj.GetComponent<ParticleSystem>(); ShapeModule shape = component.shape; ((ShapeModule)(ref shape)).radius = ((ShapeModule)(ref shape)).radius * 0.25f; EmissionModule emission = component.emission; ((EmissionModule)(ref emission)).rateOverTimeMultiplier = ((EmissionModule)(ref emission)).rateOverTimeMultiplier * 0.3f; MainModule main = component.main; ((MainModule)(ref main)).startSizeMultiplier = ((MainModule)(ref main)).startSizeMultiplier * 0.4f; ((MainModule)(ref main)).startSpeedMultiplier = ((MainModule)(ref main)).startSpeedMultiplier * 0.5f; } internal static Transform FindChild(Transform root, string name) { Transform[] componentsInChildren = ((Component)root).GetComponentsInChildren<Transform>(true); foreach (Transform val in componentsInChildren) { if (((Object)val).name == name) { return val; } } return null; } private static void ClearConnectionRequirement(Piece piece) { FieldInfo[] fields = typeof(Piece).GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); foreach (FieldInfo fieldInfo in fields) { if (fieldInfo.Name.IndexOf("mustconnect", StringComparison.OrdinalIgnoreCase) >= 0) { object value = ((fieldInfo.FieldType == typeof(bool)) ? ((object)false) : null); fieldInfo.SetValue(piece, value); TarExtractorPlugin._log.LogInfo((object)("Cleared Piece." + fieldInfo.Name + " on the Tar Extractor prefab.")); } } } private static void TintRenderers(GameObject prefab) { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Expected O, but got Unknown //IL_0066: Unknown result type (might be due to invalid IL or missing references) Renderer[] componentsInChildren = prefab.GetComponentsInChildren<Renderer>(true); foreach (Renderer val in componentsInChildren) { if (val is ParticleSystemRenderer || val is TrailRenderer) { continue; } Material[] sharedMaterials = val.sharedMaterials; Material[] array = (Material[])(object)new Material[sharedMaterials.Length]; for (int j = 0; j < sharedMaterials.Length; j++) { if (!((Object)(object)sharedMaterials[j] == (Object)null)) { array[j] = new Material(sharedMaterials[j]); if (array[j].HasProperty("_Color")) { array[j].color = TarTint; } } } val.sharedMaterials = array; } } } } namespace TarExtractorMod.Patches { [HarmonyPatch(typeof(Player), "PlacePiece")] internal static class Player_PlacePiece_Patch { private static bool Prefix(Player __instance, Piece __0, Vector3 __1) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)__0 == (Object)null || (Object)(object)((Component)__0).GetComponent<TarExtractor>() == (Object)null) { return true; } string text = TarPit.PlacementProblem(__1); if (text == null) { return true; } PlacementState.Show(__instance, text); return false; } } [HarmonyPatch(typeof(Player), "UpdatePlacementGhost")] internal static class Player_UpdatePlacementGhost_Patch { private static void Postfix(Player __instance) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) GameObject placementGhost = __instance.m_placementGhost; if ((Object)(object)placementGhost == (Object)null || (Object)(object)placementGhost.GetComponent<TarExtractor>() == (Object)null) { PlacementState._blocked = false; return; } string text = TarPit.PlacementProblem(placementGhost.transform.position); if (text == null) { PlacementState._blocked = false; return; } PlacementState._blocked = true; PlacementState._message = text; __instance.m_placementStatus = (PlacementStatus)1; __instance.SetPlacementGhostValid(false); } } [HarmonyPatch(typeof(Player), "UpdatePlacement")] internal static class Player_UpdatePlacement_Patch { private static void Prefix(Player __instance, bool __0) { if (__0 && PlacementState._blocked && ((Character)__instance).InPlaceMode() && (ZInput.GetButtonDown("Attack") || ZInput.GetButtonDown("JoyPlace"))) { PlacementState.Show(__instance, PlacementState._message); } } } } namespace TarExtractorMod.Extractor { internal static class PlacementState { internal static bool _blocked; internal static string _message; internal static void Show(Player player, string message) { int value = TarExtractorPlugin._maxPerPit.Value; ((Character)player).Message((MessageType)2, Localization.instance.Localize(message, new string[1] { value.ToString(CultureInfo.InvariantCulture) }), 0, (Sprite)null, false); } } public class TarExtractor : MonoBehaviour, Hoverable, Interactable { private const string LevelKey = "TarExtractor_level"; private const string LastTickKey = "TarExtractor_lastTick"; private const string ExtractRpc = "TarExtractor_Extract"; private const string ResultRpc = "TarExtractor_Result"; private static readonly List<TarExtractor> Instances = new List<TarExtractor>(); private ZNetView _nview; private GameObject _notEmptyEffect; private void Awake() { _nview = ((Component)this).GetComponent<ZNetView>(); if (!((Object)(object)_nview == (Object)null) && _nview.IsValid()) { Instances.Add(this); _nview.Register("TarExtractor_Extract", (Action<long>)RPC_Extract); _nview.Register<bool>("TarExtractor_Result", (Action<long, bool>)RPC_Result); Transform val = TarExtractorPrefab.FindChild(((Component)this).transform, "NotEmptyEffect"); _notEmptyEffect = (((Object)(object)val != (Object)null) ? ((Component)val).gameObject : null); ((MonoBehaviour)this).InvokeRepeating("UpdateTick", Random.Range(0f, 2f), 2f); ((MonoBehaviour)this).InvokeRepeating("UpdateEffects", 0f, 1f); } } private void OnDestroy() { Instances.Remove(this); } internal static int CountIn(Location pit) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) int num = 0; foreach (TarExtractor instance in Instances) { if ((Object)(object)instance != (Object)null && TarPit.Contains(pit, ((Component)instance).transform.position)) { num++; } } return num; } private void UpdateEffects() { if (!((Object)(object)_notEmptyEffect == (Object)null) && _nview.IsValid()) { bool flag = _nview.GetZDO().GetInt("TarExtractor_level", 0) > 0; if (_notEmptyEffect.activeSelf != flag) { _notEmptyEffect.SetActive(flag); } } } private void UpdateTick() { if (!_nview.IsValid() || !_nview.IsOwner()) { return; } ZDO zDO = _nview.GetZDO(); long ticks = ZNet.instance.GetTime().Ticks; long num = zDO.GetLong("TarExtractor_lastTick", 0L); int num2 = zDO.GetInt("TarExtractor_level", 0); int value = TarExtractorPlugin._maxTar.Value; if (num2 > value) { num2 = value; zDO.Set("TarExtractor_level", num2); } if (num == 0L || num2 >= value) { zDO.Set("TarExtractor_lastTick", ticks); return; } long num3 = (long)(Mathf.Max(1f, TarExtractorPlugin._secondsPerTar.Value) * 10000000f); long num4 = (ticks - num) / num3; if (num4 > 0) { int num5 = (int)Math.Min(value, num2 + num4); zDO.Set("TarExtractor_level", num5); zDO.Set("TarExtractor_lastTick", (num5 >= value) ? ticks : (num + num4 * num3)); } } public bool Interact(Humanoid user, bool hold, bool alt) { if (hold || (Object)(object)_nview == (Object)null || !_nview.IsValid()) { return false; } _nview.InvokeRPC("TarExtractor_Extract", Array.Empty<object>()); return true; } private void RPC_Extract(long sender) { if (_nview.IsValid() && _nview.IsOwner()) { UpdateTick(); ZDO zDO = _nview.GetZDO(); int num = zDO.GetInt("TarExtractor_level", 0); if (num > 0) { zDO.Set("TarExtractor_level", 0); zDO.Set("TarExtractor_lastTick", ZNet.instance.GetTime().Ticks); UpdateEffects(); SpawnTar(num); } _nview.InvokeRPC(sender, "TarExtractor_Result", new object[1] { num > 0 }); } } private void RPC_Result(long sender, bool extracted) { if ((Object)(object)Player.m_localPlayer != (Object)null) { ((Character)Player.m_localPlayer).Message((MessageType)2, extracted ? "$piece_tarextractor_extracted" : "$piece_tarextractor_empty", 0, (Sprite)null, false); } } public bool UseItem(Humanoid user, ItemData item) { return false; } public string GetHoverText() { if ((Object)(object)_nview == (Object)null || !_nview.IsValid()) { return string.Empty; } int num = _nview.GetZDO().GetInt("TarExtractor_level", 0); int value = TarExtractorPlugin._maxTar.Value; return Localization.instance.Localize($"$piece_tarextractor ({num}/{value})\n" + "[<color=yellow><b>$KEY_Use</b></color>] $piece_tarextractor_extract"); } public string GetHoverName() { return Localization.instance.Localize("$piece_tarextractor"); } public float GetHoverOffset() { return 0f; } private void SpawnTar(int amount) { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //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_006a: 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_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0099: 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_00a1: 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_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) GameObject itemPrefab = ObjectDB.instance.GetItemPrefab("Tar"); if ((Object)(object)itemPrefab == (Object)null) { TarExtractorPlugin._log.LogError((object)"Could not find the 'Tar' item prefab."); return; } int num = Mathf.Max(1, itemPrefab.GetComponent<ItemDrop>().m_itemData.m_shared.m_maxStackSize); Vector3 val = ((Component)this).transform.position + Vector3.up * 1.2f + ((Component)this).transform.forward * 0.8f; while (amount > 0) { int num2 = Mathf.Min(amount, num); Vector3 val2 = val + Random.insideUnitSphere * 0.25f; GameObject obj = Object.Instantiate<GameObject>(itemPrefab, val2, Quaternion.identity); obj.GetComponent<ItemDrop>().SetStack(num2); Rigidbody component = obj.GetComponent<Rigidbody>(); if ((Object)(object)component != (Object)null) { component.linearVelocity = Vector3.up * 2f; } amount -= num2; } } } internal static class TarPit { private const string LocationPrefix = "TarPit"; private const float RefreshInterval = 2f; private static Location[] _cache = Array.Empty<Location>(); private static float _lastRefresh = -100f; internal static bool IsInTarPit(Vector3 position) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return (Object)(object)Find(position) != (Object)null; } internal static Location Find(Vector3 position) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) Refresh(); Location[] cache = _cache; foreach (Location val in cache) { if ((Object)(object)val != (Object)null && Contains(val, position)) { return val; } } return null; } internal static bool Contains(Location location, Vector3 position) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) Vector3 val = ((Component)location).transform.position - position; val.y = 0f; return ((Vector3)(ref val)).magnitude <= location.m_exteriorRadius; } internal static string PlacementProblem(Vector3 position) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) Location val = Find(position); if ((Object)(object)val == (Object)null) { return "$msg_tarextractor_needstarpit"; } int value = TarExtractorPlugin._maxPerPit.Value; if (value <= 0 || TarExtractor.CountIn(val) < value) { return null; } return "$msg_tarextractor_pitfull"; } private static void Refresh() { if (Time.time - _lastRefresh < 2f) { return; } _lastRefresh = Time.time; List<Location> list = new List<Location>(); Location[] array = Object.FindObjectsByType<Location>((FindObjectsSortMode)0); foreach (Location val in array) { if (((Object)val).name.StartsWith("TarPit", StringComparison.Ordinal)) { list.Add(val); } } _cache = list.ToArray(); } } } namespace TarExtractorMod.Core { internal static class Translations { private const string TranslationResourcePrefix = "TarExtractor.Translations."; public static void Load() { CustomLocalization localization = LocalizationManager.Instance.GetLocalization(); Assembly executingAssembly = Assembly.GetExecutingAssembly(); string[] manifestResourceNames = executingAssembly.GetManifestResourceNames(); foreach (string text in manifestResourceNames) { if (text.StartsWith("TarExtractor.Translations.", StringComparison.Ordinal) && text.EndsWith(".json", StringComparison.Ordinal)) { string text2 = text.Substring("TarExtractor.Translations.".Length, text.Length - "TarExtractor.Translations.".Length - ".json".Length); using StreamReader streamReader = new StreamReader(executingAssembly.GetManifestResourceStream(text)); localization.AddJsonFile(text2, streamReader.ReadToEnd()); } } } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { internal IgnoresAccessChecksToAttribute(string assemblyName) { } } }