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 Shrinkinator v1.0.0
Shrinkinator.dll
Decompiled 5 hours agousing System; using System.Collections.Generic; using System.Diagnostics; 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 Microsoft.CodeAnalysis; using Photon.Pun; using REPOLib.Modules; using UnityEngine; using UnityEngine.AI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: IgnoresAccessChecksTo("Autodesk.Fbx")] [assembly: IgnoresAccessChecksTo("Discord.Sdk")] [assembly: IgnoresAccessChecksTo("Domain_Reload")] [assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")] [assembly: IgnoresAccessChecksTo("FbxBuildTestAssets")] [assembly: IgnoresAccessChecksTo("Klattersynth")] [assembly: IgnoresAccessChecksTo("Photon3Unity3D")] [assembly: IgnoresAccessChecksTo("PhotonChat")] [assembly: IgnoresAccessChecksTo("PhotonRealtime")] [assembly: IgnoresAccessChecksTo("PhotonUnityNetworking")] [assembly: IgnoresAccessChecksTo("PhotonUnityNetworking.Utilities")] [assembly: IgnoresAccessChecksTo("PhotonVoice.API")] [assembly: IgnoresAccessChecksTo("PhotonVoice")] [assembly: IgnoresAccessChecksTo("PhotonVoice.PUN")] [assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime.Public")] [assembly: IgnoresAccessChecksTo("Sirenix.OdinInspector.Attributes")] [assembly: IgnoresAccessChecksTo("Sirenix.OdinInspector.Modules.Unity.Addressables")] [assembly: IgnoresAccessChecksTo("Sirenix.OdinInspector.Modules.UnityLocalization")] [assembly: IgnoresAccessChecksTo("Sirenix.Serialization.Config")] [assembly: IgnoresAccessChecksTo("Sirenix.Serialization")] [assembly: IgnoresAccessChecksTo("Sirenix.Utilities")] [assembly: IgnoresAccessChecksTo("Unity.Addressables")] [assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")] [assembly: IgnoresAccessChecksTo("Unity.Burst")] [assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")] [assembly: IgnoresAccessChecksTo("Unity.Collections")] [assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")] [assembly: IgnoresAccessChecksTo("Unity.Formats.Fbx.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")] [assembly: IgnoresAccessChecksTo("Unity.InternalAPIEngineBridge.013")] [assembly: IgnoresAccessChecksTo("Unity.Localization")] [assembly: IgnoresAccessChecksTo("Unity.Mathematics")] [assembly: IgnoresAccessChecksTo("Unity.MemoryProfiler")] [assembly: IgnoresAccessChecksTo("Unity.Postprocessing.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")] [assembly: IgnoresAccessChecksTo("Unity.ResourceManager")] [assembly: IgnoresAccessChecksTo("Unity.ScriptableBuildPipeline")] [assembly: IgnoresAccessChecksTo("Unity.Splines")] [assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")] [assembly: IgnoresAccessChecksTo("Unity.Timeline")] [assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Antlr3.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Core")] [assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Flow")] [assembly: IgnoresAccessChecksTo("Unity.VisualScripting.State")] [assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UI")] [assembly: IgnoresAccessChecksTo("websocket-sharp")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("Shrinkinator")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+e5d00ffe27eedc91626503a4d7d82b740d755858")] [assembly: AssemblyProduct("Shrinkinator")] [assembly: AssemblyTitle("Shrinkinator")] [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 Shrinkinator { internal static class ShrinkinatorConfig { internal static ConfigEntry<float> ScaleFactor; internal static ConfigEntry<float> DurationSeconds; internal static ConfigEntry<float> CloudRadius; internal static ConfigEntry<float> MistRange; internal static ConfigEntry<int> Charges; internal static ConfigEntry<bool> ValueScalePrice; internal static ConfigEntry<string> ItemName; internal static ConfigEntry<float> PriceMultiplier; internal static ConfigEntry<float> ShootCooldown; internal static ConfigEntry<bool> UseCustomModel; internal static ConfigEntry<float> AimVerticalOffset; internal static ConfigEntry<float> GrabVerticalOffset; internal static ConfigEntry<bool> CenterOfMassInGrip; internal static ConfigEntry<bool> AimAssist; internal static ConfigEntry<float> GrabStrengthMultiplier; internal static ConfigEntry<float> TorqueMultiplier; internal static void Init(ConfigFile config) { ScaleFactor = config.Bind<float>("Общее", "ScaleFactor", 0.35f, "Множитель размера при уменьшении (0.35 = цель становится в ~3 раза меньше). Масса и цена меняются пропорционально кубу множителя."); DurationSeconds = config.Bind<float>("Общее", "DurationSeconds", 20f, "Длительность уменьшения врагов и игроков в секундах. Ценности уменьшаются навсегда."); CloudRadius = config.Bind<float>("Туман", "CloudRadius", 2.5f, "Радиус облака тумана в метрах. Всё, что попало в облако, уменьшается."); MistRange = config.Bind<float>("Туман", "MistRange", 12f, "Дальность распыления тумана в метрах (если луч ни во что не попал, облако появляется на этом расстоянии)."); Charges = config.Bind<int>("Пушка", "Charges", 6, "Количество выстрелов от полной батареи. Реализовано через ванильный расход батареи (100 / Charges за выстрел)."); ValueScalePrice = config.Bind<bool>("Ценности", "ValueScalePrice", true, "Уменьшать ли стоимость ценности пропорционально кубу масштаба (true) или оставлять цену прежней (false)."); ItemName = config.Bind<string>("Пушка", "ItemName", "Уменьшитель-инатор", "Отображаемое название предмета в магазине."); PriceMultiplier = config.Bind<float>("Пушка", "PriceMultiplier", 1.5f, "Множитель цены в магазине относительно ванильного пистолета."); ShootCooldown = config.Bind<float>("Пушка", "ShootCooldown", 0.8f, "Минимальная пауза между выстрелами в секундах."); UseCustomModel = config.Bind<bool>("Пушка", "UseCustomModel", true, "Заменять визуал пушки кастомной процедурной моделью «shrink ray gun» (собирается в коде из примитивов, без ассетов). false = ванильный внешний вид пистолета. Применяется при регистрации предмета — требует перезапуска."); AimVerticalOffset = config.Bind<float>("Хват", "AimVerticalOffset", 0f, "Вертикальный угол ствола относительно направления взгляда в градусах (поле ItemGun.aimVerticalOffset). Ванильный пистолет: -10 (бьёт ниже прицела). 0 = стреляет ровно туда, куда смотрит камера."); GrabVerticalOffset = config.Bind<float>("Хват", "GrabVerticalOffset", -0.15f, "Вертикальное смещение точки удержания пушки относительно линии взгляда в метрах (поле ItemGun.grabVerticalOffset). Ванильный пистолет: -0.2. Отрицательное = ниже центра экрана, не загораживает обзор."); CenterOfMassInGrip = config.Bind<bool>("Хват", "CenterOfMassInGrip", true, "Переносить центр масс (rb.centerOfMass, точка «Center of Mass») в рукоять. Убирает «маятниковое» болтание: сила захвата приложена к точке хвата, и если она совпадает с центром масс — паразитного крутящего момента нет. Работает только с кастомной моделью (позиция рукояти известна)."); AimAssist = config.Bind<bool>("Хват", "AimAssist", true, "Выравнивать ось дула (gunMuzzle.forward) по оси transform.forward корня предмета — именно её физика удержания поворачивает по камере. Гарантирует, что луч идёт строго по направлению взгляда."); GrabStrengthMultiplier = config.Bind<float>("Хват", "GrabStrengthMultiplier", 1f, "Множитель силы пружины удержания (поле ItemGun.grabStrengthMultiplier, ваниль = 1). Больше = жёстче следует за рукой, но может дёргаться."); TorqueMultiplier = config.Bind<float>("Хват", "TorqueMultiplier", 1f, "Множитель крутящего момента доворота к камере (поле ItemGun.torqueMultiplier, ваниль = 1). Больше = быстрее доворачивается за взглядом, но возможна «рыскливость»."); } } internal static class GunHandlingTuner { private const string ForceGrabPointName = "Force Grab Point"; private const string CenterOfMassName = "Center of Mass"; internal static void Apply(GameObject clone, ItemGun gun, bool gripKnown, Vector3 gripLocalPosition) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)clone == (Object)null || (Object)(object)gun == (Object)null) { return; } try { ApplyInternal(clone, gun, gripKnown, gripLocalPosition); } catch (Exception ex) { Log.Warning("[Shrinkinator] Не удалось настроить хват пушки: " + ex); } } private static void ApplyInternal(GameObject clone, ItemGun gun, bool gripKnown, Vector3 gripLocalPosition) { //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) gun.aimVerticalOffset = ShrinkinatorConfig.AimVerticalOffset.Value; gun.grabVerticalOffset = ShrinkinatorConfig.GrabVerticalOffset.Value; gun.grabStrengthMultiplier = Mathf.Max(0.1f, ShrinkinatorConfig.GrabStrengthMultiplier.Value); gun.torqueMultiplier = Mathf.Max(0.1f, ShrinkinatorConfig.TorqueMultiplier.Value); if (!gripKnown) { return; } if ((Object)(object)EnsurePoint(clone.transform, "Force Grab Point", gripLocalPosition) != (Object)null) { Log.Info("[Shrinkinator] Точка хвата \"Force Grab Point\" перенесена в рукоять."); } if (ShrinkinatorConfig.CenterOfMassInGrip.Value) { if ((Object)(object)EnsurePoint(clone.transform, "Center of Mass", gripLocalPosition) != (Object)null) { Log.Info("[Shrinkinator] Центр масс \"Center of Mass\" перенесён в рукоять."); } Rigidbody component = clone.GetComponent<Rigidbody>(); if ((Object)(object)component != (Object)null) { component.centerOfMass = gripLocalPosition; } } } public static void AlignMuzzleForward(GameObject clone, ItemGun gun) { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0045: 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_0066: Unknown result type (might be due to invalid IL or missing references) //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_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_0084: 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_008e: 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_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: 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_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)clone == (Object)null || (Object)(object)gun == (Object)null) { return; } try { if (!ShrinkinatorConfig.AimAssist.Value || !((Object)(object)gun.gunMuzzle != (Object)null)) { return; } float num = Vector3.Angle(gun.gunMuzzle.forward, clone.transform.forward); if (num > 0.5f) { Vector3 forward = clone.transform.forward; Vector3 val = gun.gunMuzzle.up - forward * Vector3.Dot(gun.gunMuzzle.up, forward); if (((Vector3)(ref val)).sqrMagnitude < 1E-06f) { val = clone.transform.up - forward * Vector3.Dot(clone.transform.up, forward); } if (((Vector3)(ref val)).sqrMagnitude < 1E-06f) { val = Vector3.up; } gun.gunMuzzle.rotation = Quaternion.LookRotation(forward, ((Vector3)(ref val)).normalized); Log.Info("[Shrinkinator] AimAssist: ось дула выровнена по корпусу (было отклонение " + num.ToString("0.0") + "°)."); } } catch (Exception ex) { Log.Warning("[Shrinkinator] Не удалось выровнять ось дула: " + ex); } } private static Transform EnsurePoint(Transform root, string name, Vector3 localPosition) { //IL_0037: 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_0049: 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) Transform val = root.Find(name); if ((Object)(object)val == (Object)null) { val = new GameObject(name) { layer = ((Component)root).gameObject.layer }.transform; val.SetParent(root, false); } val.localPosition = localPosition; val.localRotation = Quaternion.identity; val.localScale = Vector3.one; return val; } } internal static class ItemRegistration { internal const string PrefabName = "Item Shrinkinator"; private static bool _registered; internal static Item ShrinkinatorItem { get; private set; } internal static void TryRegister() { if (_registered) { return; } try { RegisterInternal(); } catch (Exception exception) { Log.Error("[Shrinkinator] Ошибка регистрации предмета", exception); } } private static void RegisterInternal() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00f9: 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_0116: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_0273: Unknown result type (might be due to invalid IL or missing references) //IL_0278: Unknown result type (might be due to invalid IL or missing references) //IL_029a: Unknown result type (might be due to invalid IL or missing references) //IL_02e9: Unknown result type (might be due to invalid IL or missing references) Item val = null; GameObject val2 = null; foreach (Item allItem in Items.AllItems) { if (!((Object)(object)allItem == (Object)null) && (int)allItem.itemType == 9) { GameObject prefabSafe = GetPrefabSafe(allItem); if (!((Object)(object)prefabSafe == (Object)null) && !((Object)(object)prefabSafe.GetComponent<ItemGun>() == (Object)null)) { val = allItem; val2 = prefabSafe; break; } } } if ((Object)(object)val == (Object)null || (Object)(object)val2 == (Object)null) { Log.Warning("[Shrinkinator] Ванильная пушка не найдена в StatsManager — регистрация отложена."); return; } Log.Info("[Shrinkinator] Клонируем ванильный предмет \"" + val.itemName + "\"."); GameObject val3 = InstantiateInactive(val2); if ((Object)(object)val3 == (Object)null) { Log.Error("[Shrinkinator] Не удалось клонировать префаб пушки."); return; } ((Object)val3).name = "Item Shrinkinator"; Object.DontDestroyOnLoad((Object)(object)val3); Item val4 = Object.Instantiate<Item>(val); ((Object)val4).name = "Item Shrinkinator"; val4.itemName = ShrinkinatorConfig.ItemName.Value; val4.itemType = (itemType)9; val4.itemVolume = (itemVolume)1; val4.maxAmountInShop = 1; val4.maxAmount = 1; val4.emojiIcon = (emojiIcon)25; if ((Object)(object)val4.value != (Object)null) { Value val5 = Object.Instantiate<Value>(val4.value); float num = Mathf.Max(0.1f, ShrinkinatorConfig.PriceMultiplier.Value); val5.valueMin *= num; val5.valueMax *= num; val4.value = val5; } if ((Object)(object)val4.colorPreset != (Object)null) { ColorPresets val6 = Object.Instantiate<ColorPresets>(val4.colorPreset); val6.colorMain = new Color(0.25f, 0.9f, 0.35f); val6.colorLight = new Color(0.55f, 1f, 0.6f); val6.colorDark = new Color(0.08f, 0.45f, 0.15f); val4.colorPreset = val6; } ItemGun component = val3.GetComponent<ItemGun>(); if ((Object)(object)component == (Object)null) { Log.Error("[Shrinkinator] На клоне префаба нет ItemGun — регистрация отменена."); Object.Destroy((Object)(object)val3); return; } component.gunRandomSpread = 0f; component.shootCooldown = Mathf.Max(0.1f, ShrinkinatorConfig.ShootCooldown.Value); component.misfirePercentageChange = 0f; component.batteryDrainFullBar = false; component.batteryDrain = 100f / (float)Mathf.Max(1, ShrinkinatorConfig.Charges.Value); RecolorBullet(component); GunHandlingTuner.AlignMuzzleForward(val3, component); Vector3 gripLocalPosition = Vector3.zero; bool gripKnown = false; if (ShrinkinatorConfig.UseCustomModel.Value) { gripKnown = ShrinkinatorModelBuilder.Apply(val3, component, out gripLocalPosition); } GunHandlingTuner.Apply(val3, component, gripKnown, gripLocalPosition); ItemAttributes component2 = val3.GetComponent<ItemAttributes>(); if ((Object)(object)component2 == (Object)null) { Log.Error("[Shrinkinator] На клоне префаба нет ItemAttributes — регистрация отменена."); Object.Destroy((Object)(object)val3); return; } component2.item = val4; Items.RegisterItem(component2); val3.transform.position = new Vector3(0f, -1000f, 0f); val3.SetActive(true); ShrinkinatorItem = val4; _registered = true; Log.Info("[Shrinkinator] Предмет \"" + val4.itemName + "\" зарегистрирован (prefab \"Item Shrinkinator\")."); } private static void RecolorBullet(ItemGun gun) { //IL_0078: 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_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_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) try { if ((Object)(object)gun.bulletPrefab == (Object)null) { return; } GameObject val = InstantiateInactive(gun.bulletPrefab); if ((Object)(object)val == (Object)null) { return; } ((Object)val).name = "Item Shrinkinator Bullet"; Object.DontDestroyOnLoad((Object)(object)val); ItemGunBullet component = val.GetComponent<ItemGunBullet>(); Color val2 = default(Color); ((Color)(ref val2))..ctor(0.35f, 1f, 0.45f); if ((Object)(object)component != (Object)null) { if ((Object)(object)component.shootLine != (Object)null) { component.shootLine.startColor = val2; component.shootLine.endColor = val2; } ParticleSystem val3 = (((Object)(object)component.particleSmoke != (Object)null) ? component.particleSmoke : component.particleImpact); if ((Object)(object)val3 != (Object)null) { MainModule main = val3.main; ((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(val2); ParticleSystemRenderer component2 = ((Component)val3).GetComponent<ParticleSystemRenderer>(); if ((Object)(object)component2 != (Object)null) { MistVfx.Init(((Renderer)component2).sharedMaterial); } } } gun.bulletPrefab = val; } catch (Exception ex) { Log.Warning("[Shrinkinator] Не удалось перекрасить пулю: " + ex.Message); } } private static GameObject GetPrefabSafe(Item item) { try { if (item.prefab == null || !((PrefabRef<GameObject>)(object)item.prefab).IsValid()) { return null; } return ((PrefabRef<GameObject>)(object)item.prefab).Prefab; } catch (Exception) { return null; } } private static GameObject InstantiateInactive(GameObject prefab) { bool activeSelf = prefab.activeSelf; try { if (activeSelf) { prefab.SetActive(false); } return Object.Instantiate<GameObject>(prefab); } finally { if (activeSelf) { prefab.SetActive(true); } } } internal static bool IsOurGun(ItemGun gun) { if ((Object)(object)gun == (Object)null) { return false; } ItemAttributes component = ((Component)gun).GetComponent<ItemAttributes>(); if ((Object)(object)component == (Object)null || (Object)(object)component.item == (Object)null) { return false; } if ((Object)(object)ShrinkinatorItem != (Object)null && (Object)(object)component.item == (Object)(object)ShrinkinatorItem) { return true; } return ((Object)component.item).name == "Item Shrinkinator"; } } internal static class Log { private static ManualLogSource _logger; internal static void Init(ManualLogSource logger) { _logger = logger; } internal static void Info(string message) { ManualLogSource logger = _logger; if (logger != null) { logger.LogInfo((object)message); } } internal static void Warning(string message) { ManualLogSource logger = _logger; if (logger != null) { logger.LogWarning((object)message); } } internal static void Error(string message) { ManualLogSource logger = _logger; if (logger != null) { logger.LogError((object)message); } } internal static void Error(string message, Exception exception) { ManualLogSource logger = _logger; if (logger != null) { logger.LogError((object)(message + "\n" + exception)); } } } internal static class MistVfx { private static Material _material; private static bool _materialSearched; internal static void Init(Material baseMaterial) { //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) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Expected O, but got Unknown if ((Object)(object)baseMaterial == (Object)null) { return; } try { _material = new Material(baseMaterial) { color = new Color(0.35f, 1f, 0.45f, 0.6f) }; _materialSearched = true; } catch (Exception ex) { Log.Warning("[Shrinkinator] Не удалось подготовить материал тумана: " + ex.Message); } } private static Material GetMaterial() { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Expected O, but got Unknown if ((Object)(object)_material == (Object)null && !_materialSearched) { _materialSearched = true; Shader val = Shader.Find("Sprites/Default"); if ((Object)(object)val == (Object)null) { val = Shader.Find("Legacy Shaders/Particles/Alpha Blended"); } if ((Object)(object)val != (Object)null) { _material = new Material(val); } } return _material; } internal static void Spawn(Vector3 position, float radius) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: 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_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0084: 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_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: 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_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) try { GameObject val = new GameObject("ShrinkinatorMist"); val.transform.position = position; ParticleSystem val2 = val.AddComponent<ParticleSystem>(); MainModule main = val2.main; ((MainModule)(ref main)).duration = 1.2f; ((MainModule)(ref main)).startLifetime = MinMaxCurve.op_Implicit(1.5f); ((MainModule)(ref main)).startSpeed = MinMaxCurve.op_Implicit(0.4f); ((MainModule)(ref main)).startSize = MinMaxCurve.op_Implicit(Mathf.Max(0.5f, radius * 0.9f)); ((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(new Color(0.35f, 1f, 0.45f, 0.45f)); ((MainModule)(ref main)).maxParticles = 60; ((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)1; ((MainModule)(ref main)).stopAction = (ParticleSystemStopAction)2; EmissionModule emission = val2.emission; ((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(0f); ((EmissionModule)(ref emission)).SetBursts((Burst[])(object)new Burst[1] { new Burst(0f, (short)36) }); ShapeModule shape = val2.shape; ((ShapeModule)(ref shape)).enabled = true; ((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)0; ((ShapeModule)(ref shape)).radius = Mathf.Max(0.2f, radius * 0.5f); VelocityOverLifetimeModule velocityOverLifetime = val2.velocityOverLifetime; ((VelocityOverLifetimeModule)(ref velocityOverLifetime)).enabled = true; ((VelocityOverLifetimeModule)(ref velocityOverLifetime)).speedModifier = new MinMaxCurve(1f, 0f); ParticleSystemRenderer component = ((Component)val2).GetComponent<ParticleSystemRenderer>(); Material material = GetMaterial(); if ((Object)(object)material != (Object)null) { ((Renderer)component).sharedMaterial = material; } val2.Play(); } catch (Exception exception) { Log.Error("[Shrinkinator] Ошибка создания VFX тумана", exception); } } } [HarmonyPatch(typeof(StatsManager), "RunStartStats")] internal static class StatsManagerPatch { private static void Postfix() { try { ItemRegistration.TryRegister(); } catch (Exception exception) { Log.Error("[Shrinkinator] Ошибка в постфиксе RunStartStats", exception); } } } [HarmonyPatch(typeof(ItemGun), "ShootBulletRPC")] internal static class ItemGunShootPatch { private static void Postfix(ItemGun __instance, Vector3 _endPosition, bool _hit) { //IL_000b: 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_0028: 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) try { if (ItemRegistration.IsOurGun(__instance)) { Vector3 val = ComputeCloudCenter(__instance, _endPosition, _hit); float radius = Mathf.Max(0.3f, ShrinkinatorConfig.CloudRadius.Value); MistVfx.Spawn(val, radius); if (SemiFunc.IsMasterClientOrSingleplayer()) { ApplyCloud(__instance, val, radius); } } } catch (Exception exception) { Log.Error("[Shrinkinator] Ошибка в обработчике выстрела", exception); } } private static Vector3 ComputeCloudCenter(ItemGun gun, Vector3 endPosition, bool hit) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: 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_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_0036: 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_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) Transform gunMuzzle = gun.gunMuzzle; float num = Mathf.Max(1f, ShrinkinatorConfig.MistRange.Value); if ((Object)(object)gunMuzzle == (Object)null) { return endPosition; } if (hit) { Vector3 val = endPosition - gunMuzzle.position; if (((Vector3)(ref val)).magnitude > num) { return gunMuzzle.position + ((Vector3)(ref val)).normalized * num; } return endPosition; } return gunMuzzle.position + gunMuzzle.forward * num; } private static void ApplyCloud(ItemGun gun, Vector3 center, float radius) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0010: 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_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0083: 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_008d: Unknown result type (might be due to invalid IL or missing references) Transform gunMuzzle = gun.gunMuzzle; Vector3 val = (((Object)(object)gunMuzzle != (Object)null) ? gunMuzzle.position : center); LayerMask val2 = SemiFunc.LayerMaskGetPhysGrabObject(); int num = ((LayerMask)(ref val2)).value | LayerMask.GetMask(new string[2] { "Enemy", "Player" }); HashSet<ValuableObject> handledValuables = new HashSet<ValuableObject>(); HashSet<EnemyRigidbody> handledEnemies = new HashSet<EnemyRigidbody>(); HashSet<PlayerAvatar> handledPlayers = new HashSet<PlayerAvatar>(); Dictionary<PlayerAvatar, PlayerAvatarCollision> playerCollisions = CollectPlayerCollisions(); float[] array = new float[3] { 1f, 0.5f, 0.25f }; foreach (float num2 in array) { Vector3 val3 = Vector3.Lerp(val, center, num2); Collider[] array2; try { array2 = Physics.OverlapSphere(val3, radius, num, (QueryTriggerInteraction)2); } catch (Exception ex) { Log.Warning("[Shrinkinator] OverlapSphere не удался: " + ex.Message); continue; } Collider[] array3 = array2; foreach (Collider val4 in array3) { if (!((Object)(object)val4 == (Object)null)) { try { HandleCollider(val4, gun, handledValuables, handledEnemies, handledPlayers, playerCollisions); } catch (Exception exception) { Log.Error("[Shrinkinator] Ошибка обработки цели в облаке", exception); } } } } } private static void HandleCollider(Collider collider, ItemGun gun, HashSet<ValuableObject> handledValuables, HashSet<EnemyRigidbody> handledEnemies, HashSet<PlayerAvatar> handledPlayers, Dictionary<PlayerAvatar, PlayerAvatarCollision> playerCollisions) { //IL_00d8: Unknown result type (might be due to invalid IL or missing references) float scale = Mathf.Clamp(ShrinkinatorConfig.ScaleFactor.Value, 0.05f, 1f); float duration = Mathf.Max(1f, ShrinkinatorConfig.DurationSeconds.Value); ValuableObject componentInParent = ((Component)collider).GetComponentInParent<ValuableObject>(); if ((Object)(object)componentInParent != (Object)null) { if (handledValuables.Add(componentInParent)) { ValuableShrinkController valuableShrinkController = AttachPatches.EnsureValuableController(((Component)componentInParent).gameObject); if ((Object)(object)valuableShrinkController != (Object)null) { valuableShrinkController.ApplyFromHost(scale, ShrinkinatorConfig.ValueScalePrice.Value); } } } else { if ((Object)(object)((Component)collider).GetComponentInParent<ItemAttributes>() != (Object)null) { return; } EnemyRigidbody componentInParent2 = ((Component)collider).GetComponentInParent<EnemyRigidbody>(); if ((Object)(object)componentInParent2 != (Object)null) { if (handledEnemies.Add(componentInParent2)) { EnemyShrinkController enemyShrinkController = AttachPatches.EnsureEnemyController(((Component)componentInParent2).gameObject); if ((Object)(object)enemyShrinkController != (Object)null) { enemyShrinkController.ApplyFromHost(scale, duration); } } } else { if (((Component)collider).gameObject.layer != LayerMask.NameToLayer("Player")) { return; } PlayerAvatar val = FindNearestPlayer(((Component)collider).transform.position, playerCollisions, 2f); if ((Object)(object)val != (Object)null && handledPlayers.Add(val)) { PlayerShrinkController playerShrinkController = AttachPatches.EnsurePlayerController(((Component)val).gameObject); if ((Object)(object)playerShrinkController != (Object)null) { playerShrinkController.ApplyFromHost(scale, duration); } } } } } private static Dictionary<PlayerAvatar, PlayerAvatarCollision> CollectPlayerCollisions() { Dictionary<PlayerAvatar, PlayerAvatarCollision> dictionary = new Dictionary<PlayerAvatar, PlayerAvatarCollision>(); PlayerAvatarCollision[] array = Object.FindObjectsOfType<PlayerAvatarCollision>(); foreach (PlayerAvatarCollision val in array) { if ((Object)(object)val != (Object)null && (Object)(object)val.PlayerAvatar != (Object)null && !dictionary.ContainsKey(val.PlayerAvatar)) { dictionary[val.PlayerAvatar] = val; } } return dictionary; } private static PlayerAvatar FindNearestPlayer(Vector3 point, Dictionary<PlayerAvatar, PlayerAvatarCollision> playerCollisions, float maxDistance) { //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_0095: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: 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_0071: 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) if ((Object)(object)GameDirector.instance == (Object)null) { return null; } PlayerAvatar result = null; float num = maxDistance * maxDistance; foreach (PlayerAvatar player in GameDirector.instance.PlayerList) { if (!((Object)(object)player == (Object)null) && !player.isDisabled) { PlayerAvatarCollision value; Vector3 val = ((playerCollisions == null || !playerCollisions.TryGetValue(player, out value) || !((Object)(object)value != (Object)null)) ? ((Component)player).transform.position : (((Object)(object)value.CollisionTransform != (Object)null) ? value.CollisionTransform.position : ((Component)value).transform.position)); Vector3 val2 = val - point; float sqrMagnitude = ((Vector3)(ref val2)).sqrMagnitude; if (sqrMagnitude <= num) { num = sqrMagnitude; result = player; } } } return result; } } internal static class AttachPatches { [HarmonyPatch(typeof(PhysGrabObject), "Awake")] internal static class PhysGrabObjectAwakePatch { private static void Postfix(PhysGrabObject __instance) { try { if ((Object)(object)__instance != (Object)null && (Object)(object)((Component)__instance).GetComponent<ValuableObject>() != (Object)null) { EnsureValuableController(((Component)__instance).gameObject); } } catch (Exception exception) { Log.Error("[Shrinkinator] Ошибка патча PhysGrabObject.Awake", exception); } } } [HarmonyPatch(typeof(EnemyRigidbody), "Awake")] internal static class EnemyRigidbodyAwakePatch { private static void Postfix(EnemyRigidbody __instance) { try { if ((Object)(object)__instance != (Object)null) { EnsureEnemyController(((Component)__instance).gameObject); } } catch (Exception exception) { Log.Error("[Shrinkinator] Ошибка патча EnemyRigidbody.Awake", exception); } } } [HarmonyPatch(typeof(PlayerAvatar), "Start")] internal static class PlayerAvatarStartPatch { private static void Postfix(PlayerAvatar __instance) { try { if ((Object)(object)__instance != (Object)null) { EnsurePlayerController(((Component)__instance).gameObject); } } catch (Exception exception) { Log.Error("[Shrinkinator] Ошибка патча PlayerAvatar.Start", exception); } } } internal static ValuableShrinkController EnsureValuableController(GameObject target) { return EnsureController<ValuableShrinkController>(target); } internal static EnemyShrinkController EnsureEnemyController(GameObject target) { return EnsureController<EnemyShrinkController>(target); } internal static PlayerShrinkController EnsurePlayerController(GameObject target) { return EnsureController<PlayerShrinkController>(target); } private static T EnsureController<T>(GameObject target) where T : Component { if ((Object)(object)target == (Object)null) { return default(T); } T component = target.GetComponent<T>(); if ((Object)(object)component != (Object)null) { return component; } component = target.AddComponent<T>(); PhotonView componentInParent = target.GetComponentInParent<PhotonView>(); if ((Object)(object)componentInParent != (Object)null) { componentInParent.RefreshRpcMonoBehaviourCache(); } return component; } } [BepInPlugin("com.kimi.shrinkinator", "Shrinkinator", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { internal const string PluginGuid = "com.kimi.shrinkinator"; internal const string PluginName = "Shrinkinator"; internal const string PluginVersion = "1.0.0"; private void Awake() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) Log.Init(((BaseUnityPlugin)this).Logger); ShrinkinatorConfig.Init(((BaseUnityPlugin)this).Config); new Harmony("com.kimi.shrinkinator").PatchAll(); Log.Info("Shrinkinator v1.0.0 загружен."); } } internal static class ShrinkRpc { internal static void SendToAll(PhotonView photonView, string method, Action directCall, params object[] args) { if ((Object)(object)photonView == (Object)null) { Log.Warning("[Shrinkinator] Нет PhotonView для RPC " + method + " — применяем локально."); directCall(); } else if (SemiFunc.IsMultiplayer()) { photonView.RPC(method, (RpcTarget)0, args); } else { directCall(); } } } public class ValuableShrinkController : MonoBehaviour { internal void ApplyFromHost(float scale, bool scalePrice) { ShrinkRpc.SendToAll(((Component)this).GetComponent<PhotonView>(), "RPC_ApplyShrink", delegate { ApplyLocal(scale, scalePrice); }, scale, scalePrice); } [PunRPC] private void RPC_ApplyShrink(float scale, bool scalePrice) { ApplyLocal(scale, scalePrice); } private void ApplyLocal(float scale, bool scalePrice) { //IL_0012: 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_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) try { float num = scale * scale * scale; ((Component)this).transform.localScale = ((Component)this).transform.localScale * scale; Rigidbody component = ((Component)this).GetComponent<Rigidbody>(); PhysGrabObject component2 = ((Component)this).GetComponent<PhysGrabObject>(); if ((Object)(object)component != (Object)null) { float massOriginal = (component.mass = Mathf.Max(0.05f, component.mass * num)); if ((Object)(object)component2 != (Object)null) { component2.massOriginal = massOriginal; } } if (!scalePrice) { return; } ValuableObject component3 = ((Component)this).GetComponent<ValuableObject>(); if (!((Object)(object)component3 != (Object)null)) { return; } float num3 = Mathf.Max(1f, Mathf.Round(component3.dollarValueCurrent * num)); if (SemiFunc.IsMasterClientOrSingleplayer()) { PhotonView val = (((Object)(object)component3.photonView != (Object)null) ? component3.photonView : ((Component)this).GetComponent<PhotonView>()); if (SemiFunc.IsMultiplayer() && (Object)(object)val != (Object)null) { val.RPC("DollarValueSetRPC", (RpcTarget)0, new object[1] { num3 }); } else { component3.DollarValueSetRPC(num3, default(PhotonMessageInfo)); } } } catch (Exception exception) { Log.Error("[Shrinkinator] Ошибка уменьшения ценности", exception); } } } public class EnemyShrinkController : MonoBehaviour { private static int _effectCounter; private bool _active; private int _effectId; private float _scale = 1f; private float _timer; private float _failsafeTimer; private Transform _visualRoot; private Vector3 _visualRootOriginalScale; private float _massOriginal = -1f; private float _shrunkMass; private NavMeshAgent _agent; private float _navRadiusOriginal = -1f; internal void ApplyFromHost(float scale, float duration) { int effectId = ++_effectCounter; ShrinkRpc.SendToAll(((Component)this).GetComponent<PhotonView>(), "RPC_ApplyShrink", delegate { RPC_ApplyShrink(scale, duration, effectId); }, scale, duration, effectId); } [PunRPC] private void RPC_ApplyShrink(float scale, float duration, int effectId) { //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_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) try { if (_active) { if (Mathf.Approximately(_scale, scale)) { _timer = duration; _failsafeTimer = duration + 5f; _effectId = effectId; return; } RevertLocal(); } CacheTargets(); _active = true; _scale = scale; _effectId = effectId; _timer = duration; _failsafeTimer = duration + 5f; if ((Object)(object)_visualRoot != (Object)null) { _visualRootOriginalScale = _visualRoot.localScale; _visualRoot.localScale = _visualRootOriginalScale * scale; } float num = scale * scale * scale; PhysGrabObject component = ((Component)this).GetComponent<PhysGrabObject>(); Rigidbody component2 = ((Component)this).GetComponent<Rigidbody>(); float num2 = (((Object)(object)component != (Object)null) ? component.massOriginal : (((Object)(object)component2 != (Object)null) ? component2.mass : 1f)); if (num2 <= 0f) { num2 = 1f; } _massOriginal = num2; _shrunkMass = Mathf.Max(0.3f, num2 * num); if ((Object)(object)component != (Object)null) { component.massOriginal = _shrunkMass; } if ((Object)(object)component2 != (Object)null) { component2.mass = _shrunkMass; } if ((Object)(object)_agent != (Object)null) { _navRadiusOriginal = _agent.radius; _agent.radius = Mathf.Max(0.05f, _navRadiusOriginal * scale); } } catch (Exception exception) { Log.Error("[Shrinkinator] Ошибка уменьшения врага", exception); } } [PunRPC] private void RPC_Expand(int effectId) { if (_active && effectId == _effectId) { RevertLocal(); } } private void CacheTargets() { _visualRoot = null; _agent = null; EnemyRigidbody component = ((Component)this).GetComponent<EnemyRigidbody>(); EnemyParent componentInParent = ((Component)this).GetComponentInParent<EnemyParent>(); Enemy val = (((Object)(object)component != (Object)null) ? component.enemy : (((Object)(object)componentInParent != (Object)null) ? componentInParent.Enemy : null)); if ((Object)(object)componentInParent != (Object)null) { Animator componentInChildren = ((Component)componentInParent).GetComponentInChildren<Animator>(); _visualRoot = (((Object)(object)componentInChildren != (Object)null) ? ((Component)componentInChildren).transform : ((Component)componentInParent).transform); } if ((Object)(object)val != (Object)null && val.HasNavMeshAgent && (Object)(object)val.NavMeshAgent != (Object)null) { _agent = val.NavMeshAgent.Agent; } } private void Update() { if (!_active) { return; } Rigidbody component = ((Component)this).GetComponent<Rigidbody>(); if ((Object)(object)component != (Object)null && Mathf.Abs(component.mass - _shrunkMass) > 0.01f) { component.mass = _shrunkMass; } PhysGrabObject component2 = ((Component)this).GetComponent<PhysGrabObject>(); if ((Object)(object)component2 != (Object)null && Mathf.Abs(component2.massOriginal - _shrunkMass) > 0.01f) { component2.massOriginal = _shrunkMass; } float deltaTime = Time.deltaTime; _failsafeTimer -= deltaTime; if (SemiFunc.IsMasterClientOrSingleplayer()) { _timer -= deltaTime; if (_timer <= 0f) { int effectId = _effectId; ShrinkRpc.SendToAll(((Component)this).GetComponent<PhotonView>(), "RPC_Expand", delegate { RPC_Expand(effectId); }, effectId); } } if (_failsafeTimer <= 0f) { RevertLocal(); } } private void RevertLocal() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) try { if ((Object)(object)_visualRoot != (Object)null) { _visualRoot.localScale = _visualRootOriginalScale; } if (_massOriginal > 0f) { PhysGrabObject component = ((Component)this).GetComponent<PhysGrabObject>(); if ((Object)(object)component != (Object)null) { component.massOriginal = _massOriginal; } Rigidbody component2 = ((Component)this).GetComponent<Rigidbody>(); if ((Object)(object)component2 != (Object)null) { component2.mass = _massOriginal; } } if ((Object)(object)_agent != (Object)null && _navRadiusOriginal > 0f) { _agent.radius = _navRadiusOriginal; } } catch (Exception exception) { Log.Error("[Shrinkinator] Ошибка возврата размера врага", exception); } finally { _active = false; _visualRoot = null; _agent = null; _massOriginal = -1f; _navRadiusOriginal = -1f; } } private void OnDisable() { if (_active) { RevertLocal(); } } } public class PlayerShrinkController : MonoBehaviour { private static int _effectCounter; private bool _active; private int _effectId; private float _scale = 1f; private float _timer; private float _failsafeTimer; private PlayerAvatarCollision _collision; private Vector3 _collisionOriginalScale; private Vector3 _collisionShrunkScale; private Transform _visual; private Vector3 _visualOriginalScale; private bool _warnedCollisionScale; internal void ApplyFromHost(float scale, float duration) { PlayerAvatar component = ((Component)this).GetComponent<PlayerAvatar>(); PhotonView photonView = (((Object)(object)component != (Object)null) ? component.photonView : ((Component)this).GetComponent<PhotonView>()); int effectId = ++_effectCounter; ShrinkRpc.SendToAll(photonView, "RPC_ApplyShrink", delegate { RPC_ApplyShrink(scale, duration, effectId); }, scale, duration, effectId); } [PunRPC] private void RPC_ApplyShrink(float scale, float duration, int effectId) { //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_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: 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_00c2: 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) try { if (_active) { if (Mathf.Approximately(_scale, scale)) { _timer = duration; _failsafeTimer = duration + 5f; _effectId = effectId; return; } RevertLocal(); } CacheTargets(); _active = true; _scale = scale; _effectId = effectId; _timer = duration; _failsafeTimer = duration + 5f; if ((Object)(object)_collision != (Object)null) { _collisionOriginalScale = _collision.Scale; _collisionShrunkScale = _collisionOriginalScale * scale; } if ((Object)(object)_visual != (Object)null) { _visualOriginalScale = _visual.localScale; _visual.localScale = _visualOriginalScale * scale; } } catch (Exception exception) { Log.Error("[Shrinkinator] Ошибка уменьшения игрока", exception); } } [PunRPC] private void RPC_Expand(int effectId) { if (_active && effectId == _effectId) { RevertLocal(); } } private void CacheTargets() { _collision = null; _visual = null; PlayerAvatar component = ((Component)this).GetComponent<PlayerAvatar>(); if ((Object)(object)component == (Object)null) { return; } PlayerAvatarCollision[] array = Object.FindObjectsOfType<PlayerAvatarCollision>(); foreach (PlayerAvatarCollision val in array) { if ((Object)(object)val != (Object)null && (Object)(object)val.PlayerAvatar == (Object)(object)component) { _collision = val; break; } } if ((Object)(object)component.playerAvatarVisuals != (Object)null && (Object)(object)component.playerAvatarVisuals.meshParent != (Object)null) { _visual = component.playerAvatarVisuals.meshParent.transform; } } private void Update() { if (!_active) { return; } PlayerAvatar component = ((Component)this).GetComponent<PlayerAvatar>(); if ((Object)(object)component == (Object)null || component.isDisabled) { RevertLocal(); return; } float deltaTime = Time.deltaTime; _failsafeTimer -= deltaTime; if (SemiFunc.IsMasterClientOrSingleplayer()) { _timer -= deltaTime; if (_timer <= 0f) { int effectId = _effectId; ShrinkRpc.SendToAll(((Object)(object)component.photonView != (Object)null) ? component.photonView : ((Component)this).GetComponent<PhotonView>(), "RPC_Expand", delegate { RPC_Expand(effectId); }, effectId); } } if (_failsafeTimer <= 0f) { RevertLocal(); } } 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_0048: Unknown result type (might be due to invalid IL or missing references) if (!_active || (Object)(object)_collision == (Object)null) { return; } try { _collision.Scale = _collisionShrunkScale; if ((Object)(object)_collision.CollisionTransform != (Object)null) { _collision.CollisionTransform.localScale = _collisionShrunkScale; } } catch (Exception ex) { if (!_warnedCollisionScale) { _warnedCollisionScale = true; Log.Warning("[Shrinkinator] Не удалось подкрепить масштаб коллизии игрока (дальше предупреждения подавляются): " + ex.Message); } } } private void RevertLocal() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_005d: 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) try { if ((Object)(object)_collision != (Object)null) { _collision.Scale = _collisionOriginalScale; if ((Object)(object)_collision.CollisionTransform != (Object)null) { _collision.CollisionTransform.localScale = _collisionOriginalScale; } } if ((Object)(object)_visual != (Object)null) { _visual.localScale = _visualOriginalScale; } } catch (Exception exception) { Log.Error("[Shrinkinator] Ошибка возврата размера игрока", exception); } finally { _active = false; _collision = null; _visual = null; _warnedCollisionScale = false; } } private void OnDisable() { if (_active) { RevertLocal(); } } } internal static class ShrinkinatorModelBuilder { internal const string VisualRootName = "ShrinkinatorVisual"; private const float BaseLength = 0.4f; internal static readonly Vector3 GripOffsetBase = new Vector3(0f, -0.058f, 0.045f); private static Material _metalMaterial; private static Material _greenMaterial; private static readonly Color MetalColor = new Color(0.16f, 0.17f, 0.19f); private static readonly Color GreenColor = new Color(0.2f, 1f, 0.35f); private static readonly string[] ExcludedNameFragments = new string[8] { "muzzle", "flash", "bullet", "shell", "casing", "sound", "laser", "beam" }; internal static bool Apply(GameObject clone, ItemGun gun, out Vector3 gripLocalPosition) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) gripLocalPosition = Vector3.zero; if ((Object)(object)clone == (Object)null || (Object)(object)gun == (Object)null) { return false; } List<Renderer> visualRenderers = null; GameObject visualRoot = null; try { return ApplyInternal(clone, gun, out gripLocalPosition, out visualRenderers, out visualRoot); } catch (Exception ex) { RollbackToVanilla(visualRenderers, visualRoot); Log.Warning("[Shrinkinator] Не удалось построить кастомную модель, откат к ванильному визуалу: " + ex); return false; } } private static void RollbackToVanilla(List<Renderer> visualRenderers, GameObject visualRoot) { if ((Object)(object)visualRoot != (Object)null) { Object.Destroy((Object)(object)visualRoot); } if (visualRenderers == null) { return; } foreach (Renderer visualRenderer in visualRenderers) { if ((Object)(object)visualRenderer != (Object)null) { visualRenderer.enabled = true; } } } private static bool ApplyInternal(GameObject clone, ItemGun gun, out Vector3 gripLocalPosition, out List<Renderer> visualRenderers, out GameObject visualRoot) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_006c: 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_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_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_00cb: 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_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: 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_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: 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_0105: 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_010c: 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_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_011d: 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_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0127: 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_0131: 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_0186: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Expected O, but got Unknown //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_0232: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_0245: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_0250: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Unknown result type (might be due to invalid IL or missing references) //IL_0280: Unknown result type (might be due to invalid IL or missing references) //IL_0281: Unknown result type (might be due to invalid IL or missing references) //IL_028c: Unknown result type (might be due to invalid IL or missing references) //IL_028d: Unknown result type (might be due to invalid IL or missing references) //IL_0292: Unknown result type (might be due to invalid IL or missing references) gripLocalPosition = Vector3.zero; visualRenderers = null; visualRoot = null; if ((Object)(object)gun.gunMuzzle == (Object)null) { Log.Warning("[Shrinkinator] У клона нет gunMuzzle — кастомную модель не строим."); return false; } visualRenderers = CollectVisualRenderers(clone, gun); if (visualRenderers.Count == 0) { Log.Warning("[Shrinkinator] На клоне не найдено визуальных MeshRenderer/SkinnedMeshRenderer — модель не строим (иерархия изменилась?)."); return false; } Vector3 val = clone.transform.InverseTransformPoint(gun.gunMuzzle.position); Vector3 val2 = clone.transform.InverseTransformDirection(gun.gunMuzzle.forward); if (((Vector3)(ref val2)).sqrMagnitude < 1E-08f) { val2 = Vector3.forward; } ((Vector3)(ref val2)).Normalize(); Vector3 val3 = clone.transform.InverseTransformDirection(gun.gunMuzzle.up); if (((Vector3)(ref val3)).sqrMagnitude < 1E-08f || Vector3.Dot(((Vector3)(ref val3)).normalized, val2) > 0.95f) { val3 = Vector3.up; } Vector3 val4 = val3 - val2 * Vector3.Dot(val3, val2); val3 = ((Vector3)(ref val4)).normalized; float num = MeasureLengthAlongAxis(clone.transform, visualRenderers, val2); float num2 = num / 0.4f; Vector3 val5 = val - val2 * num; Quaternion val6 = Quaternion.LookRotation(val2, val3); gripLocalPosition = val5 + val6 * (GripOffsetBase * num2); foreach (Renderer visualRenderer in visualRenderers) { if ((Object)(object)visualRenderer != (Object)null) { visualRenderer.enabled = false; } } EnsureMaterials(visualRenderers); GameObject val7 = (visualRoot = new GameObject("ShrinkinatorVisual")); val7.layer = clone.layer; Transform transform = val7.transform; transform.SetParent(clone.transform, false); transform.localPosition = val5; transform.localRotation = val6; transform.localScale = Vector3.one; BuildModel(transform, num2); Vector3 val8 = val5 + val2 * num; gun.gunMuzzle.position = clone.transform.TransformPoint(val8); gun.gunMuzzle.rotation = Quaternion.LookRotation(clone.transform.TransformDirection(val2), clone.transform.TransformDirection(val3)); if ((Object)(object)gun.gunTrigger != (Object)null) { Vector3 val9 = val5 + val6 * (new Vector3(0f, -0.03f, 0.078f) * num2); gun.gunTrigger.position = clone.transform.TransformPoint(val9); gun.gunTrigger.rotation = Quaternion.LookRotation(clone.transform.TransformDirection(val2), clone.transform.TransformDirection(val3)); } Log.Info("[Shrinkinator] Кастомная модель \"ShrinkinatorVisual\" построена (длина " + num.ToString("0.00") + " м, скрыто renderer'ов: " + visualRenderers.Count + ")."); return true; } private static List<Renderer> CollectVisualRenderers(GameObject clone, ItemGun gun) { List<Renderer> list = new List<Renderer>(); Renderer[] componentsInChildren = clone.GetComponentsInChildren<Renderer>(true); foreach (Renderer val in componentsInChildren) { if (!((Object)(object)val == (Object)null) && (val is MeshRenderer || val is SkinnedMeshRenderer) && !IsExcludedBranch(((Component)val).transform, gun)) { list.Add(val); } } return list; } private static bool IsExcludedBranch(Transform transform, ItemGun gun) { Transform val = transform; while ((Object)(object)val != (Object)null) { if ((Object)(object)gun.muzzleFlashPrefab != (Object)null && (Object)(object)((Component)val).gameObject == (Object)(object)gun.muzzleFlashPrefab) { return true; } if ((Object)(object)gun.bulletPrefab != (Object)null && (Object)(object)((Component)val).gameObject == (Object)(object)gun.bulletPrefab) { return true; } string text = ((Object)val).name.ToLowerInvariant(); string[] excludedNameFragments = ExcludedNameFragments; foreach (string value in excludedNameFragments) { if (text.Contains(value)) { return true; } } val = val.parent; } return false; } private static float MeasureLengthAlongAxis(Transform root, List<Renderer> renderers, Vector3 axisLocal) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: 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_0052: 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) //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_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) float num = float.MaxValue; float num2 = float.MinValue; int num3 = 0; foreach (Renderer renderer in renderers) { if (!((Object)(object)renderer == (Object)null)) { Bounds bounds = renderer.bounds; Vector3 center = ((Bounds)(ref bounds)).center; Vector3 extents = ((Bounds)(ref bounds)).extents; for (int i = 0; i < 8; i++) { Vector3 val = center + Vector3.Scale(extents, new Vector3(((i & 1) == 0) ? (-1f) : 1f, ((i & 2) == 0) ? (-1f) : 1f, ((i & 4) == 0) ? (-1f) : 1f)); float num4 = Vector3.Dot(root.InverseTransformPoint(val), axisLocal); num = Mathf.Min(num, num4); num2 = Mathf.Max(num2, num4); num3++; } } } if (num3 == 0 || num2 - num < 0.05f) { return 0.4f; } return Mathf.Clamp(num2 - num, 0.3f, 0.5f); } private static void EnsureMaterials(List<Renderer> vanillaRenderers) { //IL_0022: 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_0037: Expected O, but got Unknown //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Expected O, but got Unknown //IL_0088: 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_00ee: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_metalMaterial != (Object)null) || !((Object)(object)_greenMaterial != (Object)null)) { Shader obj = FindGameShader(vanillaRenderers); _metalMaterial = new Material(obj) { name = "Shrinkinator Dark Metal" }; SetColorIfSupported(_metalMaterial, MetalColor); SetFloatIfSupported(_metalMaterial, "_Metallic", 0.8f); SetFloatIfSupported(_metalMaterial, "_Glossiness", 0.6f); _greenMaterial = new Material(obj) { name = "Shrinkinator Glow Green" }; SetColorIfSupported(_greenMaterial, GreenColor); SetFloatIfSupported(_greenMaterial, "_Metallic", 0.4f); SetFloatIfSupported(_greenMaterial, "_Glossiness", 0.7f); if (_greenMaterial.HasProperty("_EmissionColor")) { _greenMaterial.EnableKeyword("_EMISSION"); _greenMaterial.SetColor("_EmissionColor", GreenColor * 1.5f); } } } private static Shader FindGameShader(List<Renderer> vanillaRenderers) { Shader probeShader = GetProbeShader(); if ((Object)(object)probeShader != (Object)null) { return probeShader; } Shader val = null; foreach (Renderer vanillaRenderer in vanillaRenderers) { if ((Object)(object)vanillaRenderer == (Object)null) { continue; } Material[] sharedMaterials = vanillaRenderer.sharedMaterials; foreach (Material val2 in sharedMaterials) { if (!((Object)(object)val2 == (Object)null) && !((Object)(object)val2.shader == (Object)null)) { if ((Object)(object)val == (Object)null) { val = val2.shader; } if (val2.HasProperty("_Color") && val2.HasProperty("_Glossiness")) { return val2.shader; } } } } Shader val3 = Shader.Find("Standard"); if ((Object)(object)val3 != (Object)null) { return val3; } return val; } private static Shader GetProbeShader() { GameObject obj = GameObject.CreatePrimitive((PrimitiveType)3); Shader result = null; MeshRenderer component = obj.GetComponent<MeshRenderer>(); if ((Object)(object)component != (Object)null && (Object)(object)((Renderer)component).sharedMaterial != (Object)null) { result = ((Renderer)component).sharedMaterial.shader; } Object.Destroy((Object)(object)obj); return result; } private static void SetColorIfSupported(Material material, Color color) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) if (material.HasProperty("_Color")) { material.color = color; } } private static void SetFloatIfSupported(Material material, string property, float value) { if (material.HasProperty(property)) { material.SetFloat(property, value); } } private static void BuildModel(Transform root, float s) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: 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_006b: 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_0085: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: 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_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0128: 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_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_025e: Unknown result type (might be due to invalid IL or missing references) //IL_0272: Unknown result type (might be due to invalid IL or missing references) //IL_0286: Unknown result type (might be due to invalid IL or missing references) //IL_028c: Unknown result type (might be due to invalid IL or missing references) //IL_02b1: Unknown result type (might be due to invalid IL or missing references) //IL_02b7: Unknown result type (might be due to invalid IL or missing references) //IL_02cb: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: Unknown result type (might be due to invalid IL or missing references) //IL_030a: Unknown result type (might be due to invalid IL or missing references) //IL_0310: Unknown result type (might be due to invalid IL or missing references) //IL_0324: Unknown result type (might be due to invalid IL or missing references) //IL_0338: Unknown result type (might be due to invalid IL or missing references) //IL_033e: Unknown result type (might be due to invalid IL or missing references) //IL_0363: Unknown result type (might be due to invalid IL or missing references) //IL_0369: Unknown result type (might be due to invalid IL or missing references) //IL_037d: Unknown result type (might be due to invalid IL or missing references) //IL_0391: Unknown result type (might be due to invalid IL or missing references) //IL_0397: Unknown result type (might be due to invalid IL or missing references) //IL_03bc: Unknown result type (might be due to invalid IL or missing references) //IL_03c2: Unknown result type (might be due to invalid IL or missing references) //IL_03c7: Unknown result type (might be due to invalid IL or missing references) //IL_03db: Unknown result type (might be due to invalid IL or missing references) //IL_03e1: Unknown result type (might be due to invalid IL or missing references) //IL_03f7: Unknown result type (might be due to invalid IL or missing references) //IL_03fd: Unknown result type (might be due to invalid IL or missing references) //IL_0411: Unknown result type (might be due to invalid IL or missing references) //IL_0425: Unknown result type (might be due to invalid IL or missing references) //IL_042b: Unknown result type (might be due to invalid IL or missing references) //IL_0450: Unknown result type (might be due to invalid IL or missing references) //IL_0456: Unknown result type (might be due to invalid IL or missing references) //IL_045b: Unknown result type (might be due to invalid IL or missing references) //IL_046f: Unknown result type (might be due to invalid IL or missing references) //IL_0475: Unknown result type (might be due to invalid IL or missing references) //IL_049a: Unknown result type (might be due to invalid IL or missing references) //IL_04a0: Unknown result type (might be due to invalid IL or missing references) //IL_04a5: Unknown result type (might be due to invalid IL or missing references) //IL_04b9: Unknown result type (might be due to invalid IL or missing references) //IL_04bf: Unknown result type (might be due to invalid IL or missing references) //IL_04e4: Unknown result type (might be due to invalid IL or missing references) //IL_04ea: Unknown result type (might be due to invalid IL or missing references) //IL_04fe: Unknown result type (might be due to invalid IL or missing references) //IL_0512: Unknown result type (might be due to invalid IL or missing references) //IL_0518: Unknown result type (might be due to invalid IL or missing references) //IL_053d: Unknown result type (might be due to invalid IL or missing references) //IL_0543: Unknown result type (might be due to invalid IL or missing references) //IL_0557: Unknown result type (might be due to invalid IL or missing references) //IL_056b: Unknown result type (might be due to invalid IL or missing references) //IL_0571: Unknown result type (might be due to invalid IL or missing references) //IL_0596: Unknown result type (might be due to invalid IL or missing references) //IL_059c: Unknown result type (might be due to invalid IL or missing references) //IL_05b0: Unknown result type (might be due to invalid IL or missing references) //IL_05c4: Unknown result type (might be due to invalid IL or missing references) //IL_05ca: Unknown result type (might be due to invalid IL or missing references) //IL_05ef: Unknown result type (might be due to invalid IL or missing references) //IL_05f5: Unknown result type (might be due to invalid IL or missing references) //IL_05fa: Unknown result type (might be due to invalid IL or missing references) //IL_060e: Unknown result type (might be due to invalid IL or missing references) //IL_0614: Unknown result type (might be due to invalid IL or missing references) //IL_0639: Unknown result type (might be due to invalid IL or missing references) //IL_063f: Unknown result type (might be due to invalid IL or missing references) //IL_0644: Unknown result type (might be due to invalid IL or missing references) //IL_0658: Unknown result type (might be due to invalid IL or missing references) //IL_065e: Unknown result type (might be due to invalid IL or missing references) AddPart(root, "Body", (PrimitiveType)3, new Vector3(0f, 0f, 0.1f) * s, Vector3.zero, new Vector3(0.055f, 0.07f, 0.15f) * s, _metalMaterial); AddPart(root, "BodyRearDome", (PrimitiveType)0, new Vector3(0f, 0.005f, 0.02f) * s, Vector3.zero, new Vector3(0.06f, 0.065f, 0.06f) * s, _metalMaterial); AddPart(root, "BodyFrontDome", (PrimitiveType)0, new Vector3(0f, 0f, 0.175f) * s, Vector3.zero, new Vector3(0.058f, 0.058f, 0.058f) * s, _metalMaterial); AddPart(root, "Tank", (PrimitiveType)1, new Vector3(0f, 0.058f, 0.095f) * s, new Vector3(90f, 0f, 0f), new Vector3(0.042f, 0.05f, 0.042f) * s, _greenMaterial); AddPart(root, "TankRingFront", (PrimitiveType)2, new Vector3(0f, 0.058f, 0.048f) * s, new Vector3(90f, 0f, 0f), new Vector3(0.05f, 0.006f, 0.05f) * s, _metalMaterial); AddPart(root, "TankRingRear", (PrimitiveType)2, new Vector3(0f, 0.058f, 0.142f) * s, new Vector3(90f, 0f, 0f), new Vector3(0.05f, 0.006f, 0.05f) * s, _metalMaterial); AddPart(root, "Barrel1", (PrimitiveType)2, new Vector3(0f, 0f, 0.21f) * s, new Vector3(90f, 0f, 0f), new Vector3(0.045f, 0.03f, 0.045f) * s, _metalMaterial); AddPart(root, "BarrelRing1", (PrimitiveType)2, new Vector3(0f, 0f, 0.245f) * s, new Vector3(90f, 0f, 0f), new Vector3(0.056f, 0.007f, 0.056f) * s, _greenMaterial); AddPart(root, "Barrel2", (PrimitiveType)2, new Vector3(0f, 0f, 0.285f) * s, new Vector3(90f, 0f, 0f), new Vector3(0.034f, 0.03f, 0.034f) * s, _metalMaterial); AddPart(root, "BarrelRing2", (PrimitiveType)2, new Vector3(0f, 0f, 0.318f) * s, new Vector3(90f, 0f, 0f), new Vector3(0.043f, 0.006f, 0.043f) * s, _greenMaterial); AddPart(root, "Barrel3", (PrimitiveType)2, new Vector3(0f, 0f, 0.355f) * s, new Vector3(90f, 0f, 0f), new Vector3(0.026f, 0.03f, 0.026f) * s, _metalMaterial); AddPart(root, "Tip", (PrimitiveType)0, new Vector3(0f, 0f, 0.392f) * s, Vector3.zero, new Vector3(0.026f, 0.026f, 0.026f) * s, _greenMaterial); AddPart(root, "Grip", (PrimitiveType)3, GripOffsetBase * s, new Vector3(18f, 0f, 0f), new Vector3(0.034f, 0.085f, 0.042f) * s, _metalMaterial); AddPart(root, "Trigger", (PrimitiveType)3, new Vector3(0f, -0.03f, 0.078f) * s, Vector3.zero, new Vector3(0.01f, 0.022f, 0.012f) * s, _metalMaterial); AddPart(root, "TriggerGuard", (PrimitiveType)3, new Vector3(0f, -0.048f, 0.082f) * s, Vector3.zero, new Vector3(0.006f, 0.006f, 0.05f) * s, _metalMaterial); AddPart(root, "FinLeft", (PrimitiveType)3, new Vector3(-0.036f, 0.012f, 0.075f) * s, new Vector3(0f, 0f, 12f), new Vector3(0.008f, 0.03f, 0.055f) * s, _metalMaterial); AddPart(root, "FinRight", (PrimitiveType)3, new Vector3(0.036f, 0.012f, 0.075f) * s, new Vector3(0f, 0f, -12f), new Vector3(0.008f, 0.03f, 0.055f) * s, _metalMaterial); AddPart(root, "FinTop", (PrimitiveType)3, new Vector3(0f, 0.045f, 0.005f) * s, new Vector3(-20f, 0f, 0f), new Vector3(0.01f, 0.035f, 0.045f) * s, _metalMaterial); AddPart(root, "RivetLeft", (PrimitiveType)0, new Vector3(-0.029f, 0.01f, 0.12f) * s, Vector3.zero, new Vector3(0.012f, 0.012f, 0.012f) * s, _greenMaterial); AddPart(root, "RivetRight", (PrimitiveType)0, new Vector3(0.029f, 0.01f, 0.12f) * s, Vector3.zero, new Vector3(0.012f, 0.012f, 0.012f) * s, _greenMaterial); } private static void AddPart(Transform root, string name, PrimitiveType type, Vector3 localPosition, Vector3 localEuler, Vector3 localScale, Material material) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) GameObject obj = GameObject.CreatePrimitive(type); ((Object)obj).name = "ShrinkinatorVisual_" + name; obj.layer = ((Component)root).gameObject.layer; Collider component = obj.GetComponent<Collider>(); if ((Object)(object)component != (Object)null) { Object.Destroy((Object)(object)component); } Transform transform = obj.transform; transform.SetParent(root, false); transform.localPosition = localPosition; transform.localRotation = Quaternion.Euler(localEuler); transform.localScale = localScale; MeshRenderer component2 = obj.GetComponent<MeshRenderer>(); if ((Object)(object)component2 != (Object)null && (Object)(object)material != (Object)null) { ((Renderer)component2).sharedMaterial = material; } } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }