Decompiled source of ScoutMat v1.1.1
VendingMachineMod.dll
Decompiled a day ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Threading.Tasks; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using ExitGames.Client.Photon; using HarmonyLib; using Microsoft.CodeAnalysis; using PEAKLib.Core; using PEAKLib.Items; using Peak.Afflictions; using Photon.Pun; using Photon.Realtime; using Unity.Collections; using UnityEngine; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; using UnityEngine.Rendering; using UnityEngine.Rendering.Universal; using UnityEngine.SceneManagement; using Zorro.Core; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("VendingMachineMod")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("VendingMachineMod")] [assembly: AssemblyTitle("VendingMachineMod")] [assembly: AssemblyVersion("1.0.0.0")] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } } namespace VendingMachineMod { [BepInPlugin("com.themear.vendingmachine", "Vending Machine", "1.1.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { private class Outcome { public string Name; public ConfigEntry<float> Weight; public Action<Character> Run; public string Key; } private class ActiveEffect { public Action End; public float Start; public BiomeType? Biome; public float ChangedAt = -1f; } private class Spark { public Vector2 pos; public Vector2 vel; public float life; public float maxLife; public float size; public Color color; } private static ConfigEntry<float> MaxEffectTime; private static ConfigEntry<float> SpeedAmount; private static ConfigEntry<float> SlowAmount; private static ConfigEntry<float> JumpHighScale; private static ConfigEntry<float> JumpLowScale; private static ConfigEntry<float> JumpSkyScale; private static ConfigEntry<float> JumpFallCap; public static ConfigEntry<float> GravityScale; public static ConfigEntry<float> FragileMultiplier; public static ConfigEntry<float> FragileFallBonus; public static ConfigEntry<float> FragileMinVelDmg; private static ConfigEntry<Key> KeySpin; private static ConfigEntry<Key> KeyPanel; private static ConfigEntry<Key> KeyDump; private static ConfigEntry<Key> KeyMachine; private static ConfigEntry<float> BlindStandingAlpha; private static ConfigEntry<float> BlindMovingAlpha; private static ConfigEntry<float> BlindPingSeconds; private static ConfigEntry<bool> MachineEnabled; private static ConfigEntry<bool> SkipForcedLit; private static ConfigEntry<float> MachineRange; private static ConfigEntry<float> MachineOffset; private static ConfigEntry<float> SpinSeconds; private static ConfigEntry<float> MachineVolume; private static ConfigEntry<float> FlySpeed; private static ConfigEntry<string> MachineExclude; private static ConfigEntry<string> MachineSign; private static ConfigEntry<string> UiFontName; private static ConfigEntry<int> BannerFontSize; public static bool NoWeight; public static bool Inverted; public static bool Fragile; public static bool LowGrav; public static bool PanelOpen; public static bool Blind; public static bool Flying; public static bool PhoneOpen; public static bool CarpetFlying; private static float blindVis; private static Texture2D ringTex; private static Shader unlitShader; private static Shader glassShader; private static bool shadersReady; private static AudioClip tickClip; private static AudioClip dingClip; private static AudioClip fanfareClip; private static Font uiFont; private static MethodInfo getRigMethod; private static float blurWeight; private static ConfigEntry<float> BlurStrength; private static ConfigEntry<float> SignTextSize; private static Volume blurVolume; private static bool blurFailed; private static bool camsForced; private static bool camsLogged; private static bool scaleSaved; private static float savedScale; private static readonly Dictionary<Camera, bool> savedPost = new Dictionary<Camera, bool>(); private static readonly Dictionary<Camera, int> savedMask = new Dictionary<Camera, int>(); private static ConfigEntry<int> BlurMode; private static ConfigEntry<float> BlurMinScale; private static EchoRig echo; private static ConfigEntry<float> EchoStrength; private static ConfigEntry<float> EchoThreshold; private static ConfigEntry<float> EchoFps; private static ConfigEntry<float> EchoRange; private static ConfigEntry<int> EchoWidth; private static AssetBundle echoBundle; private static Material echoMat; private static FullScreenPassRendererFeature echoFeature; private static bool echoShaderTried; private static bool echoShaderOk; private static bool echoFeatureActive; private static ConfigEntry<int> EchoMethod; private static ConfigEntry<float> ShaderThreshold; private static ConfigEntry<float> ShaderGain; private static ConfigEntry<float> ShaderThickness; private static GameObject machinePrefab; private static bool bundleTried; private static bool prefabTried; private static ConfigEntry<bool> UseModel; private static ConfigEntry<float> ModelScale; private static Material drunkMat; private static FullScreenPassRendererFeature drunkFeature; private static bool drunkTried; private static bool drunkActive; private static ConfigEntry<float> DrunkStrength; private static ConfigEntry<float> DrunkWave; private static ConfigEntry<float> DrunkDouble; private static ConfigEntry<float> DrunkChroma; private static AudioClip sLever; private static AudioClip sTick; private static AudioClip sStop; private static AudioClip sWin; private static AudioClip sLose; private static AudioClip sJackpot; private static AudioClip loseClip; private static bool soundsTried; private static readonly HashSet<string> badKeys = new HashSet<string> { "Eat", "TakeOther", "Slow", "JumpLow", "Inverted", "Fragile", "Blind", "Curse", "Fisheye", "Zoom", "Tilt", "Upside", "OldFilm", "NightVision", "Pixels", "Acid", "Hiccup", "Bucket" }; private static ConfigEntry<bool> DevMode; private static ConfigEntry<bool> DevCombo; private static MethodInfo spawnInHand; public static Plugin Inst; private static ConfigEntry<string> PillItemName; public static ConfigEntry<string> PillDisplayName; private static ConfigEntry<float> PillScale; private static ConfigEntry<float> CurseMin; private static ConfigEntry<float> CurseMax; private static ConfigEntry<float> MushroomFart; private static ConfigEntry<Key> KeyPhone; private static ConfigEntry<float> PhoneCooldown; private static ConfigEntry<float> PhoneScale; private static ConfigEntry<bool> PhoneEnabled; private static ConfigEntry<float> CarpetSeconds; private static ConfigEntry<float> CarpetSpeed; private static ConfigEntry<string> CarpetBaseItem; private static readonly Dictionary<string, string> effectNames = new Dictionary<string, string> { { "weight", "Нет штрафа от веса" }, { "speed", "Ускорение" }, { "lowgrav", "Низкая гравитация" }, { "slow", "Замедление" }, { "jumphigh", "Высокий прыжок" }, { "jumplow", "Слабый прыжок" }, { "jumpsky", "Прыжок в небо" }, { "inverted", "Пьянчуга" }, { "fragile", "Хрупкие кости" }, { "blind", "Кто выключил свет?" }, { "nohunger", "Больше не голодаешь" }, { "curse", "Проклятие автомата" }, { "fisheye", "Рыбий глаз" }, { "zoom", "Бинокль в глазах" }, { "tilt", "Морская болезнь" }, { "upside", "Мир вверх ногами" }, { "oldfilm", "Дальтонизм" }, { "nightvision", "Ночное видение" }, { "pixels", "Пиксели" }, { "acid", "Кислотный трип" }, { "hiccup", "Икота" }, { "bucket", "Ведро на голове" } }; private readonly List<Outcome> outcomes = new List<Outcome>(); private readonly Dictionary<string, ActiveEffect> active = new Dictionary<string, ActiveEffect>(); private readonly Dictionary<int, GameObject> machines = new Dictionary<int, GameObject>(); private readonly HashSet<int> loggedFires = new HashSet<int>(); private readonly List<Spark> sparks = new List<Spark>(); private readonly List<float> burstTimes = new List<float>(); private ushort heldId; private bool hasHeld; private Vector2 scroll; private float nextScan; private float nextMachineUse; private string bannerText = ""; private string bannerSub = ""; private float bannerStart; private float bannerEnd; private Color bannerColor = new Color(1f, 0.85f, 0.25f); private bool bannerRainbow; private readonly Dictionary<string, Action<Character>> starters = new Dictionary<string, Action<Character>>(); private bool skipEat; private float nextCurse; private const byte EvSwapRequest = 171; private const byte EvSwapReply = 172; private float swapWaitUntil; private string swapPartner; private static readonly string[] pillCandidates = new string[4] { "Granola Bar", "TrailMix", "Apple Berry Red", "Marshmallow" }; public static Item pillPrefab; private static readonly string[] pillStripActions = new string[11] { "Action_RestoreHunger", "Action_ModifyStatus", "Action_GiveExtraStamina", "Action_ApplyAffliction", "Action_ApplyInfiniteStamina", "Action_TryHotDogAchievement", "Action_IncrementSteamStat", "Action_InflictPoison", "Action_RandomMushroomEffect", "Action_ClearAllStatus", "Action_MoraleBoost" }; private bool wasDead; public static readonly HashSet<string> camFx = new HashSet<string>(); private static readonly string[] camStyles = new string[4] { "oldfilm", "nightvision", "pixels", "acid" }; private static Volume fxVolume; private static LensDistortion fxLens; private static ColorAdjustments fxColor; private static FilmGrain fxGrain; private static Vignette fxVignette; private static ChannelMixer fxMixer; private static bool camHooked; private static bool fxFailed; private static bool pixelSaved; private static float pixelSavedScale; private static UpscalingFilterSelection pixelSavedFilter; private static Camera fxCam; private static float fxSavedFov; private static Quaternion fxSavedRot; private static Quaternion fxSavedRotForFx; private static Vector3 fxSavedPos; private static bool fxCamTouched; private static ConfigEntry<float> FisheyeStrength; private static ConfigEntry<float> ZoomFov; private static ConfigEntry<float> TiltAngle; public static ConfigEntry<float> BucketHeight; public static ConfigEntry<float> BucketScale; public static bool ThirdPersonTest; public static bool HiccupJump; private float nextHiccup; private float hiccupShown = -10f; public static bool BucketOn; private const byte EvLook = 174; private const byte EvChaos = 175; private static readonly Dictionary<int, GameObject> buckets = new Dictionary<int, GameObject>(); private static Texture2D bucketTex; private static Character possessTarget; private static float possessUntil; public static Item carpetPrefab; private static bool carpetRegisterTried; public static bool CarpetToggleRequested; private const byte EvCarpet = 173; private static readonly Dictionary<int, CarpetRide> carpetRides = new Dictionary<int, CarpetRide>(); private static readonly string[] carpetBaseCandidates = new string[5] { "Compass", "Guidebook", "Bugle", "Binoculars", "Flag" }; public static Texture2D rugTex; public static Material rugMat; private float nextPhoneSpin; private bool phoneSpinning; private float phoneSpinStart; private string phoneResult = ""; private string[] phoneReels = new string[3] { "7", "7", "7" }; private static readonly string[] reelSymbols = new string[8] { "7", "$", "BAR", "?", "!", "%", "#", "X" }; private static Texture2D texPhone; private static Texture2D texScreen; private static Texture2D texBtn; private static Texture2D texBtnHover; private static Texture2D texDim; private static Texture2D texGrad; private static Texture2D texGold; private static Texture2D texDot; private static Texture2D texWhite; private static Texture2D texBtnGrad; private static Texture2D texBtnGradHover; private float phoneResultTime = -10f; private bool phoneResultBad; private static readonly Dictionary<string, Color> symbolColors = new Dictionary<string, Color> { { "7", new Color(0.95f, 0.1f, 0.15f) }, { "$", new Color(0.1f, 0.65f, 0.2f) }, { "BAR", new Color(0.1f, 0.1f, 0.1f) }, { "?", new Color(0.55f, 0.15f, 0.85f) }, { "!", new Color(1f, 0.5f, 0f) }, { "%", new Color(0.1f, 0.45f, 0.95f) }, { "#", new Color(0.85f, 0.1f, 0.6f) }, { "X", new Color(0.3f, 0.3f, 0.3f) } }; public static bool AnyFlight => Flying || CarpetFlying; private void Awake() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) Inst = this; BindConfig(); new Harmony("com.themear.vendingmachine").PatchAll(); BuildOutcomes(); PhotonNetwork.NetworkingClient.EventReceived += OnNetEvent; SceneManager.activeSceneChanged += delegate(Scene a, Scene b) { wasDead = false; ResetEverything("scene " + ((Scene)(ref b)).name); }; ((BaseUnityPlugin)this).Logger.LogInfo((object)"Vending Machine 1.1.0 loaded!"); RenderPipelineAsset currentRenderPipeline = GraphicsSettings.currentRenderPipeline; ((BaseUnityPlugin)this).Logger.LogInfo((object)("Render pipeline: " + (((Object)(object)currentRenderPipeline != (Object)null) ? ((object)currentRenderPipeline).GetType().FullName : "Built-in"))); } private void BindConfig() { MaxEffectTime = ((BaseUnityPlugin)this).Config.Bind<float>("Effects", "TimeLimitSeconds", 0f, "Через сколько секунд эффект 'на биом' снимется, даже если биом не сменился (0 = только при смене биома)"); SpeedAmount = ((BaseUnityPlugin)this).Config.Bind<float>("Speed", "SpeedBoost", 1f, "Ускорение: 1.0 = примерно x2"); SlowAmount = ((BaseUnityPlugin)this).Config.Bind<float>("Speed", "SlowAmount", 0.4f, "Замедление: сколько отнимается от скорости (1.0 = полная остановка)"); JumpHighScale = ((BaseUnityPlugin)this).Config.Bind<float>("Jump", "HighJumpScale", 6f, "Множитель силы прыжка для высокого прыжка"); JumpLowScale = ((BaseUnityPlugin)this).Config.Bind<float>("Jump", "LowJumpScale", 0.6f, "Множитель силы прыжка для слабого прыжка"); JumpSkyScale = ((BaseUnityPlugin)this).Config.Bind<float>("Jump", "SkyJumpScale", 25f, "Множитель силы прыжка для прыжка в небо"); JumpFallCap = ((BaseUnityPlugin)this).Config.Bind<float>("Jump", "FallDamageCap", 0.3f, "Максимальный урон от одного падения при высоком прыжке и прыжке в небо (1.0 = вся шкала)"); GravityScale = ((BaseUnityPlugin)this).Config.Bind<float>("Gravity", "LowGravityScale", 0.5f, "Во сколько раз гравитация слабее при низкой гравитации (1.0 = обычная)"); FragileMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("FragileBones", "DamageMultiplier", 2.8f, "Множитель получаемого урона (Injury)"); FragileFallBonus = ((BaseUnityPlugin)this).Config.Bind<float>("FragileBones", "FallTimeBonus", 0.8f, "На сколько секунд падение считается длиннее"); FragileMinVelDmg = ((BaseUnityPlugin)this).Config.Bind<float>("FragileBones", "MinVelocityDamage", 0.3f, "Минимум скоростной части урона от падения"); KeySpin = ((BaseUnityPlugin)this).Config.Bind<Key>("Hotkeys", "SpinKey", (Key)99, "Клавиша рулетки (нужен предмет в руке)"); KeyPanel = ((BaseUnityPlugin)this).Config.Bind<Key>("Hotkeys", "PanelKey", (Key)100, "Клавиша панели со всеми исходами"); KeyDump = ((BaseUnityPlugin)this).Config.Bind<Key>("Hotkeys", "DumpItemsKey", (Key)101, "Клавиша вывода списка предметов в лог"); BlindStandingAlpha = ((BaseUnityPlugin)this).Config.Bind<float>("Blindness", "StandingDarkness", 1f, "Насколько темно, когда стоишь на месте (1.0 = полностью чёрный экран)"); BlindMovingAlpha = ((BaseUnityPlugin)this).Config.Bind<float>("Blindness", "MovingDarkness", 1f, "Насколько темно, когда идёшь (0 = всё видно)"); BlindPingSeconds = ((BaseUnityPlugin)this).Config.Bind<float>("Blindness", "PingSeconds", 1.2f, "Как часто расходится кольцо эхолокации (секунды)"); MachineEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Machine", "Enabled", true, "Ставить автоматы рядом с кострами"); MachineRange = ((BaseUnityPlugin)this).Config.Bind<float>("Machine", "UseRange", 3.5f, "Дистанция (м), с которой можно пользоваться автоматом"); MachineOffset = ((BaseUnityPlugin)this).Config.Bind<float>("Machine", "OffsetFromCampfire", 3.5f, "Как далеко от костра ставить автомат (м)"); KeyMachine = ((BaseUnityPlugin)this).Config.Bind<Key>("Machine", "UseKey", (Key)20, "Клавиша, чтобы бросить предмет в автомат"); SkipForcedLit = ((BaseUnityPlugin)this).Config.Bind<bool>("Machine", "SkipForcedLitCampfires", true, "Не ставить автомат у костров, которые горят с самого начала (стартовых)"); MachineExclude = ((BaseUnityPlugin)this).Config.Bind<string>("Machine", "ExcludeNames", "", "Имена костров (или их части через запятую), у которых автомат не нужен"); SpinSeconds = ((BaseUnityPlugin)this).Config.Bind<float>("Machine", "SpinSeconds", 1.8f, "Сколько секунд автомат крутит барабаны перед результатом"); MachineVolume = ((BaseUnityPlugin)this).Config.Bind<float>("Machine", "Volume", 0.6f, "Громкость звуков автомата (0-1)"); MachineSign = ((BaseUnityPlugin)this).Config.Bind<string>("Machine", "SignText", "ООО БМЫВ", "Надпись на вывеске автомата (пусто = без надписи)"); FlySpeed = ((BaseUnityPlugin)this).Config.Bind<float>("Flight", "FlySpeed", 30f, "Скорость полёта (WASD по камере, Пробел вверх, Левый Ctrl вниз)"); UiFontName = ((BaseUnityPlugin)this).Config.Bind<string>("UI", "FontName", "Impact", "Шрифт надписей и вывески (должен быть в Windows: Impact, Segoe UI Black, Arial Black, Comic Sans MS...)"); BannerFontSize = ((BaseUnityPlugin)this).Config.Bind<int>("UI", "BannerFontSize", 64, "Размер крупной надписи по центру экрана"); BlurStrength = ((BaseUnityPlugin)this).Config.Bind<float>("Blur", "Strength", 0f, "Сила размытия при инверсии (0 = выключено, 1 = максимум)"); SignTextSize = ((BaseUnityPlugin)this).Config.Bind<float>("Machine", "SignTextSize", 0.045f, "Размер букв на вывеске автомата (уменьшайте для длинных названий)"); BlurMode = ((BaseUnityPlugin)this).Config.Bind<int>("Blur", "Mode", 0, "0 = только эффект постобработки, 1 = только уменьшение разрешения, 2 = оба"); BlurMinScale = ((BaseUnityPlugin)this).Config.Bind<float>("Blur", "MinRenderScale", 0.35f, "Масштаб рендера при полном размытии (меньше = мутнее, минимум 0.1)"); EchoStrength = ((BaseUnityPlugin)this).Config.Bind<float>("Blindness", "OutlineStrength", 1f, "Яркость контуров эхолокации (0 = выключены)"); EchoThreshold = ((BaseUnityPlugin)this).Config.Bind<float>("Blindness", "OutlineThreshold", 0.1f, "Порог контуров: больше = меньше линий, меньше = больше линий"); EchoFps = ((BaseUnityPlugin)this).Config.Bind<float>("Blindness", "OutlineFps", 12f, "Сколько раз в секунду обновляются контуры (меньше = легче для компьютера)"); EchoWidth = ((BaseUnityPlugin)this).Config.Bind<int>("Blindness", "OutlineWidth", 320, "Ширина картинки для поиска контуров (меньше = быстрее, но грубее)"); EchoRange = ((BaseUnityPlugin)this).Config.Bind<float>("Blindness", "OutlineRange", 40f, "Дальность эхолокации в метрах: дальше контуры не рисуются (меньше = быстрее)"); EchoMethod = ((BaseUnityPlugin)this).Config.Bind<int>("Blindness", "OutlineMethod", 0, "0 = шейдер из пакета vendingecho (быстро), 1 = старый способ второй камерой (лагает), 2 = без контуров"); ShaderThreshold = ((BaseUnityPlugin)this).Config.Bind<float>("Blindness", "ShaderEdgeThreshold", 0.03f, "Порог контуров шейдера: больше = меньше линий"); ShaderGain = ((BaseUnityPlugin)this).Config.Bind<float>("Blindness", "ShaderEdgeGain", 15f, "Яркость и резкость контуров шейдера"); ShaderThickness = ((BaseUnityPlugin)this).Config.Bind<float>("Blindness", "ShaderEdgeThickness", 1f, "Толщина линий в пикселях"); UseModel = ((BaseUnityPlugin)this).Config.Bind<bool>("Machine", "UseModel", true, "Использовать 3D-модель автомата из пакета vendingecho (иначе - собранный из кубов)"); ModelScale = ((BaseUnityPlugin)this).Config.Bind<float>("Machine", "ModelScale", 1f, "Масштаб 3D-модели автомата"); DrunkStrength = ((BaseUnityPlugin)this).Config.Bind<float>("Drunk", "Strength", 1f, "Сила пьяного искажения (0 = выключено)"); DrunkWave = ((BaseUnityPlugin)this).Config.Bind<float>("Drunk", "Wave", 0.012f, "Сила волн"); DrunkDouble = ((BaseUnityPlugin)this).Config.Bind<float>("Drunk", "DoubleVision", 0.025f, "Сила двоения в глазах"); DrunkChroma = ((BaseUnityPlugin)this).Config.Bind<float>("Drunk", "ColorSplit", 0.006f, "Расслоение цветов"); DevMode = ((BaseUnityPlugin)this).Config.Bind<bool>("Developer", "DevMode", false, "Тестовые клавиши: рулетка без автомата, панель исходов, список предметов. У обычных игроков должно быть false"); DevCombo = ((BaseUnityPlugin)this).Config.Bind<bool>("Developer", "RequireCtrlShift", true, "Тестовые клавиши работают только вместе с Ctrl+Shift (например, Ctrl+Shift+F7)"); PillItemName = ((BaseUnityPlugin)this).Config.Bind<string>("Pill", "ItemName", "", "Какой предмет игры выдаётся как таблетка (имя из списка по Ctrl+Shift+F8). Пусто = подобрать автоматически"); PillDisplayName = ((BaseUnityPlugin)this).Config.Bind<string>("Pill", "DisplayName", "Таблетка", "Как таблетка называется в игре"); PillScale = ((BaseUnityPlugin)this).Config.Bind<float>("Pill", "Scale", 1f, "Размер модели таблетки"); CurseMin = ((BaseUnityPlugin)this).Config.Bind<float>("Curse", "MinSeconds", 30f, "Проклятие: минимум секунд до следующего случайного эффекта"); CurseMax = ((BaseUnityPlugin)this).Config.Bind<float>("Curse", "MaxSeconds", 60f, "Проклятие: максимум секунд до следующего случайного эффекта"); MushroomFart = ((BaseUnityPlugin)this).Config.Bind<float>("Mushroom", "FartForce", 1500f, "Сила подброса от реактивного пука в грибной рулетке"); PhoneEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Phone", "Enabled", true, "Телефон с автоматом"); KeyPhone = ((BaseUnityPlugin)this).Config.Bind<Key>("Phone", "Key", (Key)63, "Клавиша, чтобы достать/убрать телефон"); PhoneCooldown = ((BaseUnityPlugin)this).Config.Bind<float>("Phone", "CooldownSeconds", 300f, "Как часто можно крутить автомат в телефоне (секунды)"); PhoneScale = ((BaseUnityPlugin)this).Config.Bind<float>("Phone", "Scale", 1f, "Размер телефона на экране"); BindCamFxConfig(); CarpetSeconds = ((BaseUnityPlugin)this).Config.Bind<float>("Carpet", "FlightSeconds", 30f, "Сколько секунд полёта выдерживает ковёр"); CarpetSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("Carpet", "Speed", 16f, "Скорость полёта на ковре"); CarpetBaseItem = ((BaseUnityPlugin)this).Config.Bind<string>("Carpet", "BaseItem", "", "Предмет игры, на основе которого собирается ковёр (имя из Ctrl+Shift+F8). Пусто = выбрать автоматически"); } private void Add(string key, string name, float weight, Action<Character> run) { ConfigEntry<float> weight2 = ((BaseUnityPlugin)this).Config.Bind<float>("Chances", key, weight, "Шанс исхода '" + name + "' (чем больше, тем чаще; 0 = выключен)"); outcomes.Add(new Outcome { Key = key, Name = name, Weight = weight2, Run = run }); } private void BuildStarters() { starters["weight"] = delegate(Character ch) { Begin("weight", null, delegate { NoWeight = true; Recalc(ch); }, delegate { NoWeight = false; Recalc(ch); }); }; starters["speed"] = delegate(Character ch) { Begin("speed", "slow", delegate { //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_0026: 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_004c: Expected O, but got Unknown ch.refs.afflictions.AddAffliction((Affliction)new Affliction_FasterBoi { totalTime = EffTime(), moveSpeedMod = SpeedAmount.Value, climbSpeedMod = SpeedAmount.Value }, false); }, delegate { ch.refs.afflictions.RemoveAffliction((AfflictionType)2); }); }; starters["lowgrav"] = delegate { Begin("lowgrav", "fragile", delegate { LowGrav = true; }, delegate { LowGrav = false; }); }; starters["slow"] = delegate(Character ch) { float amount = SlowAmount.Value; Begin("slow", "speed", delegate { CharacterMovement movement = ch.refs.movement; movement.movementModifier -= amount; }, delegate { CharacterMovement movement = ch.refs.movement; movement.movementModifier += amount; }); }; starters["jumphigh"] = delegate(Character ch) { StartJump(ch, "jumphigh", JumpHighScale.Value); }; starters["jumplow"] = delegate(Character ch) { StartJump(ch, "jumplow", JumpLowScale.Value); }; starters["jumpsky"] = delegate(Character ch) { StartJump(ch, "jumpsky", JumpSkyScale.Value); }; starters["inverted"] = delegate { Begin("inverted", null, delegate { Inverted = true; }, delegate { Inverted = false; }); }; starters["fragile"] = delegate { Begin("fragile", "lowgrav", delegate { Fragile = true; }, delegate { Fragile = false; }); }; starters["blind"] = delegate { Begin("blind", null, delegate { Blind = true; }, delegate { Blind = false; }); }; starters["nohunger"] = delegate(Character ch) { Begin("nohunger", null, delegate { //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_004a: Expected O, but got Unknown ch.refs.afflictions.SetStatus((STATUSTYPE)1, 0f, true); ch.refs.afflictions.AddAffliction((Affliction)new Affliction_NoHunger { totalTime = EffTime() }, false); }, delegate { ch.refs.afflictions.RemoveAffliction((AfflictionType)21); }); }; string[] array = new string[8] { "fisheye", "zoom", "tilt", "upside", "oldfilm", "nightvision", "pixels", "acid" }; foreach (string text in array) { string k = text; starters[k] = delegate { if (Array.IndexOf(camStyles, k) >= 0) { string[] array2 = camStyles; foreach (string text2 in array2) { if (text2 != k) { End(text2); } } } if (k == "tilt") { End("upside"); } if (k == "upside") { End("tilt"); } Begin(k, null, delegate { camFx.Add(k); }, delegate { camFx.Remove(k); }); }; } starters["hiccup"] = delegate { Begin("hiccup", null, delegate { nextHiccup = Time.time + Random.Range(4f, 8f); }, delegate { }); }; starters["bucket"] = delegate { Begin("bucket", null, delegate { BucketOn = true; SendLook("bucket", on: true); }, delegate { BucketOn = false; SendLook("bucket", on: false); }); }; starters["curse"] = delegate(Character ch) { Begin("curse", null, delegate { }, delegate { }); CurseHit(ch, first: true); }; } private void StartJump(Character ch, string key, float scale) { EndJumps(); float orig = 0f; Begin(key, null, delegate { orig = ch.refs.movement.jumpImpulse; ch.refs.movement.jumpImpulse = orig * scale; }, delegate { ch.refs.movement.jumpImpulse = orig; }); } private void StartEffect(Character ch, string key) { if (starters.TryGetValue(key, out Action<Character> value)) { value(ch); } } private void AddEffect(string outcomeKey, string name, float weight, string effectKey) { Add(outcomeKey, name, weight, delegate(Character ch) { Eat(ch); StartEffect(ch, effectKey); }); } private void BuildOutcomes() { BuildStarters(); Add("Eat", "Автомат съел предмет", 1f, delegate(Character ch) { Eat(ch); }); Add("TakeOther", "Автомат забрал ещё один предмет", 1f, delegate(Character ch) { Eat(ch); TakeOther(ch); }); Add("Duplicate", "ДУБЛИКАТ!", 1f, delegate(Character ch) { Item prefab = default(Item); if (!hasHeld) { Say("Для дубликата нужен предмет в руке"); } else if (ItemDatabase.TryGetItem(heldId, ref prefab)) { GiveItem(ch, prefab); } }); AddEffect("NoWeight", "Нет штрафа от веса (на биом)", 1f, "weight"); AddEffect("Speed", "Ускорение x2 (на биом)", 1f, "speed"); AddEffect("LowGravity", "Низкая гравитация (на биом)", 1f, "lowgrav"); AddEffect("Slow", "Замедление (на биом)", 1f, "slow"); AddEffect("JumpHigh", "Высокий прыжок (на биом)", 1f, "jumphigh"); AddEffect("JumpLow", "Слабый прыжок (на биом)", 1f, "jumplow"); AddEffect("JumpSky", "ПРЫЖОК В НЕБО (на биом)", 0.3f, "jumpsky"); AddEffect("Inverted", "Пьянчуга (на биом)", 1f, "inverted"); AddEffect("Fragile", "Хрупкие кости (на биом)", 1f, "fragile"); AddEffect("Blind", "Кто выключил свет? (на биом)", 1f, "blind"); AddEffect("NoHunger", "Больше не голодаешь (на биом)", 1f, "nohunger"); AddEffect("Curse", "ПРОКЛЯТИЕ АВТОМАТА (на биом)", 0.3f, "curse"); AddEffect("Fisheye", "Рыбий глаз (на биом)", 1f, "fisheye"); AddEffect("Zoom", "Бинокль в глазах (на биом)", 1f, "zoom"); AddEffect("Tilt", "Морская болезнь (на биом)", 1f, "tilt"); AddEffect("Upside", "МИР ВВЕРХ НОГАМИ (на биом)", 0.3f, "upside"); AddEffect("OldFilm", "Дальтонизм (на биом)", 1f, "oldfilm"); AddEffect("NightVision", "Ночное видение (на биом)", 1f, "nightvision"); AddEffect("Pixels", "Пиксели (на биом)", 1f, "pixels"); AddEffect("Acid", "Кислотный трип (на биом)", 1f, "acid"); AddEffect("Hiccup", "Икота (на биом)", 1f, "hiccup"); AddEffect("Bucket", "Ведро на голове (на биом)", 1f, "bucket"); Add("Chaos", "ПЕРЕПОЛОХ! Эффект для всех", 0.5f, delegate(Character ch) { Eat(ch); RunChaos(ch); }); Add("Possess", "КТО-ТО ДРУГОЙ (20 сек)", 0.6f, delegate(Character ch) { Eat(ch); StartPossess(); }); Add("Swap", "ОБМЕН ЭФФЕКТАМИ!", 0.3f, delegate(Character ch) { Eat(ch); RequestSwap(); }); Add("Mushroom", "ГРИБНАЯ РУЛЕТКА", 0.8f, delegate(Character ch) { Eat(ch); RunMushroom(ch); }); Add("DoubleSpin", "ДВОЙНОЙ СПИН!", 0.4f, delegate(Character ch) { Eat(ch); DoubleSpin(ch); }); Add("Pill", "ТАБЛЕТКА! Съешь - уберёт случайный эффект", 0.8f, delegate(Character ch) { Eat(ch); GivePill(ch); }); Add("Jackpot", "ДЖЕКПОТ! Бесконечный спасательный захват", 0.2f, delegate(Character ch) { //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_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) Eat(ch); Item val = default(Item); if (ItemDatabase.TryGetItem("RescueHook_Infinite", ref val)) { ItemDatabase.Add(val, ch.Center + Vector3.up * 0.5f); Celebrate("ДЖЕКПОТ!", "Бесконечный спасательный захват"); } else { Say("Золотой захват не найден"); } }); Add("Carpet", "КОВЁР-САМОЛЁТ!", 0.3f, delegate(Character ch) { Eat(ch); if ((Object)(object)carpetPrefab == (Object)null) { Say("Ковёр ещё не готов"); } else { GiveItem(ch, carpetPrefab); Celebrate("КОВЁР-САМОЛЁТ!", "ЛКМ - взлететь, ещё раз - приземлиться"); } }); Add("Flight", "ПОЛЁТ (вкл/выкл)", 0f, delegate(Character ch) { ToggleFlight(ch); }); } private void DoubleSpin(Character ch) { List<Outcome> list = new List<Outcome>(); foreach (Outcome outcome3 in outcomes) { if (outcome3.Key != "DoubleSpin" && outcome3.Key != "Flight" && outcome3.Weight.Value > 0f) { list.Add(outcome3); } } if (list.Count == 0) { return; } Outcome outcome = PickFrom(list); Outcome outcome2 = PickFrom(list); Say("ДВОЙНОЙ СПИН: " + outcome.Name + " + " + outcome2.Name); skipEat = true; try { outcome.Run(ch); outcome2.Run(ch); } finally { skipEat = false; } } private static Outcome PickFrom(List<Outcome> pool) { float num = 0f; foreach (Outcome item in pool) { num += item.Weight.Value; } float num2 = Random.value * num; foreach (Outcome item2 in pool) { num2 -= item2.Weight.Value; if (num2 <= 0f) { return item2; } } return pool[pool.Count - 1]; } private void UpdateCurse() { if (active.ContainsKey("curse") && !(Time.time < nextCurse)) { Character localCharacter = Character.localCharacter; if (!((Object)(object)localCharacter == (Object)null)) { CurseHit(localCharacter, first: false); } } } private void CurseHit(Character ch, bool first) { //IL_0125: Unknown result type (might be due to invalid IL or missing references) nextCurse = Time.time + Random.Range(CurseMin.Value, CurseMax.Value); List<string> list = new List<string>(); foreach (string key2 in starters.Keys) { if (key2 != "curse") { list.Add(key2); } } string key = list[Random.Range(0, list.Count)]; StartEffect(ch, key); if (first) { Say("ПРОКЛЯТИЕ АВТОМАТА!"); bannerSub = "Первый эффект: " + EffectName(key); return; } Say("ПРОКЛЯТИЕ: " + EffectName(key)); LoadSounds(); AudioClip val = (((Object)(object)sLose != (Object)null) ? sLose : loseClip); Camera main = Camera.main; if ((Object)(object)val != (Object)null && (Object)(object)main != (Object)null) { AudioSource.PlayClipAtPoint(val, ((Component)main).transform.position, MachineVolume.Value); } } private static string EffectName(string key) { string value; return effectNames.TryGetValue(key, out value) ? value : key; } private void RunMushroom(Character ch) { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_0067: 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_0077: 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_008d: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Expected O, but got Unknown //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_00c7: Expected O, but got Unknown //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Expected O, but got Unknown //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Expected O, but got Unknown CharacterAfflictions afflictions = ch.refs.afflictions; switch (Random.Range(0, 9)) { case 0: afflictions.AddAffliction((Affliction)new Affliction_InfiniteStamina(15f), false); Say("Гриб: бесконечная выносливость"); break; case 1: afflictions.AddAffliction((Affliction)new Affliction_FasterBoi { totalTime = 10f, moveSpeedMod = 0.5f, climbSpeedMod = 1.5f, climbDelay = 1f }, false); Say("Гриб: скалолаз"); break; case 2: afflictions.AddAffliction((Affliction)new Affliction_Invincibility { totalTime = 10f }, false); Say("Гриб: неуязвимость"); break; case 3: afflictions.AdjustStatus((STATUSTYPE)0, -0.15f, false); afflictions.AdjustStatus((STATUSTYPE)1, -0.15f, false); afflictions.AdjustStatus((STATUSTYPE)2, -0.15f, false); afflictions.ClearPoisonAfflictions(); Say("Гриб: немного полечил"); break; case 4: GameUtils.instance.SpawnResourceAtPositionNetworked("VFX_SporeExploExploEdibleSpawn", ch.Center, (RpcTarget)0); Say("Гриб: БАБАХ!"); break; case 5: { GameUtils.instance.SpawnResourceAtPositionNetworked("VFX_SporeExploExploEdibleSpawn_NoKnockback", ch.Center, (RpcTarget)0); Rigidbody rig = GetRig(ch, (BodypartType)0); if ((Object)(object)rig != (Object)null) { ch.AddForceToBodyPart(rig, Vector3.zero, Vector3.up * MushroomFart.Value); } Say("Гриб: реактивный пук"); break; } case 6: afflictions.AddAffliction((Affliction)new Affliction_Blind { totalTime = 20f }, false); Say("Гриб: в глазах темнеет"); break; case 7: Traverse.Create((object)ch).Method("Fall", new Type[2] { typeof(float), typeof(float) }, (object[])null).GetValue(new object[2] { 6f, 0f }); afflictions.AdjustStatus((STATUSTYPE)10, 0.15f, false); Say("Гриб: вырубило"); break; default: afflictions.AddAffliction((Affliction)new Affliction_Numb { totalTime = 30f }, false); Say("Гриб: онемение"); break; } } private void RequestSwap() { //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Expected O, but got Unknown //IL_008e: Unknown result type (might be due to invalid IL or missing references) Player[] playerListOthers = PhotonNetwork.PlayerListOthers; if (!PhotonNetwork.InRoom || playerListOthers == null || playerListOthers.Length == 0) { Say("Обмениваться не с кем"); return; } Player val = playerListOthers[Random.Range(0, playerListOthers.Length)]; swapPartner = val.NickName; swapWaitUntil = Time.time + 4f; string[] array = new List<string>(active.Keys).ToArray(); RaiseEventOptions val2 = new RaiseEventOptions(); val2.TargetActors = new int[1] { val.ActorNumber }; PhotonNetwork.RaiseEvent((byte)171, (object)array, val2, SendOptions.SendReliable); Say("ОБМЕН ЭФФЕКТАМИ с " + swapPartner + "!"); } private void OnNetEvent(EventData ev) { //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Expected O, but got Unknown //IL_013c: Unknown result type (might be due to invalid IL or missing references) if (ev.Code == 173) { OnCarpetEvent(ev); } else if (ev.Code == 174) { OnLookEvent(ev); } else if (ev.Code == 175) { OnChaosEvent(ev); } else { if (ev.Code != 171 && ev.Code != 172) { return; } try { Character localCharacter = Character.localCharacter; if ((Object)(object)localCharacter == (Object)null) { return; } string[] array = (ev.CustomData as string[]) ?? new string[0]; Player val = ((PhotonNetwork.CurrentRoom != null) ? PhotonNetwork.CurrentRoom.GetPlayer(ev.Sender, false) : null); string text = ((val != null) ? val.NickName : "другом"); if (ev.Code == 171) { string[] array2 = new List<string>(active.Keys).ToArray(); RaiseEventOptions val2 = new RaiseEventOptions(); val2.TargetActors = new int[1] { ev.Sender }; PhotonNetwork.RaiseEvent((byte)172, (object)array2, val2, SendOptions.SendReliable); } else { if (swapWaitUntil <= 0f) { return; } swapWaitUntil = 0f; } EndAll(); string[] array3 = array; foreach (string key in array3) { StartEffect(localCharacter, key); } Say("Эффекты обменяны с " + text + " (" + array.Length + " шт.)"); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogError((object)("Swap failed: " + ex)); } } } private void UpdateSwap() { if (swapWaitUntil > 0f && Time.time > swapWaitUntil) { swapWaitUntil = 0f; Say("У " + swapPartner + " нет мода, обмен не удался"); } } private void Update() { //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: 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) Keyboard current = Keyboard.current; if (current != null) { bool flag = !DevCombo.Value || ((((ButtonControl)current.leftCtrlKey).isPressed || ((ButtonControl)current.rightCtrlKey).isPressed) && (((ButtonControl)current.leftShiftKey).isPressed || ((ButtonControl)current.rightShiftKey).isPressed)); if (PanelOpen && ((ButtonControl)current[KeyPanel.Value]).wasPressedThisFrame) { TogglePanel(); } else if (DevMode.Value && flag) { if (((ButtonControl)current[KeySpin.Value]).wasPressedThisFrame) { Spin(); } if (((ButtonControl)current[KeyPanel.Value]).wasPressedThisFrame) { TogglePanel(); } if (((ButtonControl)current[KeyDump.Value]).wasPressedThisFrame) { DumpItems(); } } } if (!DevMode.Value && PanelOpen) { TogglePanel(); } if (current != null && PhoneEnabled.Value && !PanelOpen) { if (((ButtonControl)current[KeyPhone.Value]).wasPressedThisFrame) { TogglePhone(); } else if (PhoneOpen && ((ButtonControl)current.escapeKey).wasPressedThisFrame) { TogglePhone(); } } if (PhoneOpen && (Object)(object)Character.localCharacter == (Object)null) { TogglePhone(); } CheckDeath(); CheckEffects(); EnsureCarpetRegistered(); UpdateCarpet(); UpdateCurse(); UpdateSwap(); ApplyJumpFallCap(); UpdateBlind(); UpdateMachines(); UpdateFireworks(); UpdateBlurVolume(); UpdateCamFx(); UpdateHiccup(); UpdatePossess(); UpdateDrunk(); UpdateEchoShader(); } private void LateUpdate() { if (PanelOpen || PhoneOpen) { Cursor.lockState = (CursorLockMode)0; Cursor.visible = true; } } private void TogglePanel() { PanelOpen = !PanelOpen; if (!PanelOpen) { Cursor.lockState = (CursorLockMode)1; Cursor.visible = false; } } private Outcome Pick() { float num = 0f; foreach (Outcome outcome in outcomes) { num += Mathf.Max(0f, outcome.Weight.Value); } if (num <= 0f) { return null; } float num2 = Random.value * num; Outcome result = null; foreach (Outcome outcome2 in outcomes) { float num3 = Mathf.Max(0f, outcome2.Weight.Value); if (!(num3 <= 0f)) { result = outcome2; num2 -= num3; if (num2 <= 0f) { return outcome2; } } } return result; } private void Spin() { Character localCharacter = Character.localCharacter; if ((Object)(object)localCharacter == (Object)null) { return; } if ((Object)(object)localCharacter.data.currentItem == (Object)null) { Say("Возьми предмет в руку"); return; } Outcome outcome = Pick(); if (outcome == null) { Say("Все исходы выключены в конфиге"); } else { RunOutcome(outcome); } } private void RunOutcome(Outcome o, MachineView view = null) { Character localCharacter = Character.localCharacter; if (!((Object)(object)localCharacter == (Object)null)) { Item currentItem = localCharacter.data.currentItem; hasHeld = (Object)(object)currentItem != (Object)null; heldId = (ushort)(hasHeld ? currentItem.itemID : 0); Say(o.Name); o.Run(localCharacter); PlayResult(o, view); } } private void GiveItem(Character ch, Item prefab) { if (spawnInHand == null) { spawnInHand = AccessTools.Method(typeof(CharacterItems), "SpawnItemInHand", (Type[])null, (Type[])null); } if (spawnInHand != null) { spawnInHand.Invoke(ch.refs.items, new object[1] { ((Object)prefab).name }); } else { ((BaseUnityPlugin)this).Logger.LogError((object)"SpawnItemInHand not found, item not given"); } } private void GivePill(Character ch) { if ((Object)(object)pillPrefab == (Object)null) { Say("Таблетка ещё не готова"); } else { GiveItem(ch, pillPrefab); } } private void RegisterPill(ItemDatabase db, GameObject holder, ModDefinition mod) { //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Expected O, but got Unknown //IL_0213: Unknown result type (might be due to invalid IL or missing references) //IL_0218: 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_024d: Unknown result type (might be due to invalid IL or missing references) //IL_0266: 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_02b4: Unknown result type (might be due to invalid IL or missing references) //IL_02c8: Unknown result type (might be due to invalid IL or missing references) //IL_02dc: Unknown result type (might be due to invalid IL or missing references) //IL_0300: Unknown result type (might be due to invalid IL or missing references) //IL_0322: Unknown result type (might be due to invalid IL or missing references) //IL_0336: Unknown result type (might be due to invalid IL or missing references) //IL_034a: Unknown result type (might be due to invalid IL or missing references) //IL_036e: Unknown result type (might be due to invalid IL or missing references) //IL_03bd: Unknown result type (might be due to invalid IL or missing references) Item val = null; string text = PillItemName.Value.Trim(); if (text.Length > 0) { ItemDatabase.TryGetItem(text, ref val); } if ((Object)(object)val == (Object)null) { string[] array = pillCandidates; foreach (string text2 in array) { if (ItemDatabase.TryGetItem(text2, ref val)) { break; } } } if ((Object)(object)val == (Object)null) { foreach (KeyValuePair<ushort, Item> item in db.itemLookup) { if ((Object)(object)item.Value != (Object)null && (Object)(object)((Component)item.Value).GetComponent<Action_Consume>() != (Object)null) { val = item.Value; break; } } } if ((Object)(object)val == (Object)null) { ((BaseUnityPlugin)this).Logger.LogError((object)"Pill: no base item found"); return; } ((BaseUnityPlugin)this).Logger.LogInfo((object)("Pill: base item = " + ((Object)val).name)); GameObject val2 = Object.Instantiate<GameObject>(((Component)val).gameObject, holder.transform); ((Object)val2).name = "VM_Pill"; ItemActionBase[] componentsInChildren = val2.GetComponentsInChildren<ItemActionBase>(true); foreach (ItemActionBase val3 in componentsInChildren) { if (Array.IndexOf(pillStripActions, ((object)val3).GetType().Name) >= 0) { try { Object.DestroyImmediate((Object)(object)val3); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Pill strip: " + ex.Message)); } } } Item component = val2.GetComponent<Item>(); component.UIData.itemName = PillDisplayName.Value; component.UIData.icon = MakePillIcon(); component.UIData.hasAltIcon = false; GameObject val4 = new GameObject("VM_PillLook"); val4.transform.SetParent(val2.transform, false); Vector3 lossyScale = val2.transform.lossyScale; float value = PillScale.Value; val4.transform.localScale = new Vector3(value / Mathf.Max(0.0001f, Mathf.Abs(lossyScale.x)), value / Mathf.Max(0.0001f, Mathf.Abs(lossyScale.y)), value / Mathf.Max(0.0001f, Mathf.Abs(lossyScale.z))); Shader sh = Shader.Find("Universal Render Pipeline/Lit") ?? Shader.Find("Universal Render Pipeline/Unlit"); GameObject val5 = Part(val4.transform, (PrimitiveType)1, new Vector3(-0.03f, 0f, 0f), new Vector3(0.075f, 0.075f, 0.075f), new Color(0.9f, 0.12f, 0.15f), sh); val5.transform.localRotation = Quaternion.Euler(0f, 0f, 90f); GameObject val6 = Part(val4.transform, (PrimitiveType)1, new Vector3(0.03f, 0f, 0f), new Vector3(0.078f, 0.075f, 0.078f), new Color(0.96f, 0.96f, 0.96f), sh); val6.transform.localRotation = Quaternion.Euler(0f, 0f, 90f); int layer = val2.layer; Transform[] componentsInChildren2 = val4.GetComponentsInChildren<Transform>(true); foreach (Transform val7 in componentsInChildren2) { ((Component)val7).gameObject.layer = layer; } val2.AddComponent<PillView>(); new ItemContent(component).Register(mod); pillPrefab = component; ((BaseUnityPlugin)this).Logger.LogInfo((object)("Pill registered: " + ((Object)val2).name)); } private static Texture2D MakePillIcon() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: 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_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) int num = 128; Texture2D val = new Texture2D(num, num, (TextureFormat)4, false); Color val2 = default(Color); ((Color)(ref val2))..ctor(0.9f, 0.12f, 0.15f); Color val3 = default(Color); ((Color)(ref val3))..ctor(0.97f, 0.97f, 0.97f); float num2 = 22f; float num3 = 30f; for (int i = 0; i < num; i++) { for (int j = 0; j < num; j++) { float num4 = ((float)j - (float)num / 2f + ((float)i - (float)num / 2f)) * 0.7071f; float num5 = (0f - ((float)j - (float)num / 2f) + ((float)i - (float)num / 2f)) * 0.7071f; float num6 = Mathf.Clamp(num4, 0f - num3, num3); float num7 = Mathf.Sqrt((num4 - num6) * (num4 - num6) + num5 * num5); if (num7 > num2 + 1.5f) { val.SetPixel(j, i, Color.clear); continue; } Color val4 = ((num4 < 0f) ? val2 : val3); float num8 = 1f - Mathf.Clamp01((num5 + num2 * 0.3f) / num2) * 0.25f; float num9 = Mathf.Clamp01(1f - Mathf.Abs(num5 + num2 * 0.45f) / 4f) * 0.35f; if (num7 > num2) { val4 = Color.Lerp(val4 * 0.6f, Color.clear, (num7 - num2) / 1.5f); } else if (num7 > num2 - 2.5f) { val4 *= 0.7f; } ((Color)(ref val4))..ctor(Mathf.Min(1f, val4.r * num8 + num9), Mathf.Min(1f, val4.g * num8 + num9), Mathf.Min(1f, val4.b * num8 + num9), val4.a); val.SetPixel(j, i, val4); } } val.Apply(); ((Object)val).hideFlags = (HideFlags)32; return val; } public static bool IsPill(Item item) { return (Object)(object)item != (Object)null && (Object)(object)((Component)item).GetComponent<PillView>() != (Object)null; } public void OnPillEaten(Item item) { if (active.Count == 0) { Say("Таблетка не подействовала: эффектов нет"); return; } List<string> list = new List<string>(active.Keys); string text = list[Random.Range(0, list.Count)]; End(text); if (!effectNames.TryGetValue(text, out string value)) { value = text; } Say("Таблетка сняла: " + value); } private float EffTime() { return (MaxEffectTime.Value > 0f) ? MaxEffectTime.Value : 100000f; } private void Eat(Character ch) { //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_0065: Unknown result type (might be due to invalid IL or missing references) if (skipEat) { return; } try { CharacterItems items = ch.refs.items; Optionable<byte> currentSelectedSlot = items.currentSelectedSlot; items.DestroyHeldItemRpc(); PhotonView component = ((Component)items).GetComponent<PhotonView>(); if ((Object)(object)component != (Object)null) { component.RPC("DestroyHeldItemRpc", (RpcTarget)1, Array.Empty<object>()); } if (currentSelectedSlot.IsSome) { ch.player.EmptySlot(currentSelectedSlot, true); } Recalc(ch); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogError((object)("Eat failed: " + ex)); } } private void TakeOther(Character ch) { //IL_00b4: Unknown result type (might be due to invalid IL or missing references) try { CharacterItems items = ch.refs.items; int num = (items.currentSelectedSlot.IsSome ? items.currentSelectedSlot.Value : (-1)); ItemSlot[] itemSlots = ch.player.itemSlots; List<byte> list = new List<byte>(); for (int i = 0; i < itemSlots.Length; i++) { if (i != num && !itemSlots[i].IsEmpty()) { list.Add((byte)i); } } if (list.Count == 0) { Say("Больше нечего забирать"); return; } byte b = list[Random.Range(0, list.Count)]; ch.player.EmptySlot(Optionable<byte>.Some(b), true); Recalc(ch); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogError((object)("TakeOther failed: " + ex)); } } private void Recalc(Character ch) { Traverse.Create((object)ch.refs.afflictions).Method("UpdateWeight", Array.Empty<object>()).GetValue(); } private void ApplyJumpFallCap() { if (active.ContainsKey("jumphigh") || active.ContainsKey("jumpsky")) { Character localCharacter = Character.localCharacter; if (!((Object)(object)localCharacter == (Object)null)) { localCharacter.refs.movement.CapFallDamage(JumpFallCap.Value, 1f); } } } private void EndJumps() { End("jumphigh"); End("jumplow"); End("jumpsky"); } private void Begin(string key, string opposite, Action start, Action end) { if (opposite != null) { End(opposite); } End(key); start(); active[key] = new ActiveEffect { End = end, Start = Time.time, Biome = CurrentBiome() }; } private void End(string key) { if (active.TryGetValue(key, out ActiveEffect value)) { active.Remove(key); value.End(); } } private void EndAll() { foreach (string item in new List<string>(active.Keys)) { End(item); } } private void ResetEverything(string why) { try { EndAll(); Character localCharacter = Character.localCharacter; if (CarpetFlying) { SetCarpetFlying(localCharacter, on: false); } if (Flying && (Object)(object)localCharacter != (Object)null) { ToggleFlight(localCharacter); } Flying = false; possessTarget = null; BucketOn = false; HiccupJump = false; camFx.Clear(); foreach (KeyValuePair<int, GameObject> item in new List<KeyValuePair<int, GameObject>>(buckets)) { if ((Object)(object)item.Value != (Object)null) { Object.Destroy((Object)(object)item.Value); } } buckets.Clear(); ((BaseUnityPlugin)this).Logger.LogInfo((object)("All effects reset: " + why)); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogError((object)("Reset failed: " + ex)); } } private void CheckDeath() { Character localCharacter = Character.localCharacter; bool flag = (Object)(object)localCharacter != (Object)null && (Object)(object)localCharacter.data != (Object)null && localCharacter.data.dead; if (flag && !wasDead) { ResetEverything("death"); } wasDead = flag; } private static BiomeType? CurrentBiome() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) MapHandler instance = Singleton<MapHandler>.Instance; if ((Object)(object)instance == (Object)null) { return null; } return instance.GetCurrentBiome(); } private void CheckEffects() { //IL_00a0: 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) foreach (string item in new List<string>(active.Keys)) { if (!active.TryGetValue(item, out ActiveEffect value)) { continue; } if (MaxEffectTime.Value > 0f && Time.time - value.Start > MaxEffectTime.Value) { End(item); continue; } BiomeType? val = CurrentBiome(); if (value.Biome.HasValue && val.HasValue && val.Value != value.Biome.Value) { if (value.ChangedAt < 0f) { value.ChangedAt = Time.time; } else if (Time.time - value.ChangedAt > 3f) { End(item); } } else { value.ChangedAt = -1f; } } } private void DumpItems() { foreach (KeyValuePair<ushort, Item> item in SingletonAsset<ItemDatabase>.Instance.itemLookup) { ((BaseUnityPlugin)this).Logger.LogInfo((object)("ITEM " + item.Key + ": " + ((Object)item.Value).name)); } } private void ToggleFlight(Character ch) { Flying = !Flying; if (!Flying) { ch.refs.movement.CapFallDamage(0.1f, 20f); } Say(Flying ? "ПОЛЁТ ВКЛ" : "ПОЛЁТ ВЫКЛ"); } public static Rigidbody GetRig(Character ch, BodypartType part) { //IL_004c: Unknown result type (might be due to invalid IL or missing references) if (getRigMethod == null) { getRigMethod = AccessTools.Method(typeof(Character), "GetBodypartRig", (Type[])null, (Type[])null); } if (getRigMethod == null) { return null; } object? obj = getRigMethod.Invoke(ch, new object[1] { part }); return (Rigidbody)((obj is Rigidbody) ? obj : null); } private void FixedUpdate() { //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_005c: 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_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0092: 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_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: 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_00d1: 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_00e6: 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_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_0126: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) if (!AnyFlight) { return; } Character localCharacter = Character.localCharacter; Keyboard current = Keyboard.current; if ((Object)(object)localCharacter == (Object)null || current == null) { return; } Camera main = Camera.main; Vector3 val = (((Object)(object)main != (Object)null) ? ((Component)main).transform.forward : Vector3.forward); Vector3 val2 = (((Object)(object)main != (Object)null) ? ((Component)main).transform.right : Vector3.right); Vector3 val3 = Vector3.zero; if (((ButtonControl)current.wKey).isPressed) { val3 += val; } if (((ButtonControl)current.sKey).isPressed) { val3 -= val; } if (((ButtonControl)current.dKey).isPressed) { val3 += val2; } if (((ButtonControl)current.aKey).isPressed) { val3 -= val2; } if (((ButtonControl)current.spaceKey).isPressed) { val3 += Vector3.up; } if (((ButtonControl)current.leftCtrlKey).isPressed) { val3 -= Vector3.up; } float num = (CarpetFlying ? CarpetSpeed.Value : FlySpeed.Value); Vector3 linearVelocity = ((((Vector3)(ref val3)).sqrMagnitude > 0.01f) ? (((Vector3)(ref val3)).normalized * num) : Vector3.zero); BodypartType[] array = (BodypartType[])(object)new BodypartType[3] { default(BodypartType), (BodypartType)2, (BodypartType)4 }; foreach (BodypartType part in array) { Rigidbody rig = GetRig(localCharacter, part); if ((Object)(object)rig != (Object)null) { rig.linearVelocity = linearVelocity; } } localCharacter.refs.movement.CapFallDamage(0f, 1f); } public static Camera GetCam() { Camera val = Camera.main; if ((Object)(object)val == (Object)null && (Object)(object)MainCamera.instance != (Object)null) { val = Traverse.Create((object)MainCamera.instance).Field("cam").GetValue<Camera>(); } return val; } [MethodImpl(MethodImplOptions.NoInlining)] private void EnsureBlur() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) Camera cam = GetCam(); GameObject val = new GameObject("VendingBlurVolume"); int layer = 0; if ((Object)(object)cam != (Object)null) { UniversalAdditionalCameraData universalAdditionalCameraData = CameraExtensions.GetUniversalAdditionalCameraData(cam); int num; if (!((Object)(object)universalAdditionalCameraData != (Object)null)) { num = -1; } else { LayerMask volumeLayerMask = universalAdditionalCameraData.volumeLayerMask; num = ((LayerMask)(ref volumeLayerMask)).value; } int num2 = num; layer = ((Component)cam).gameObject.layer; for (int i = 0; i < 32; i++) { if ((num2 & (1 << i)) != 0) { layer = i; break; } } } val.layer = layer; Volume val2 = val.AddComponent<Volume>(); val2.isGlobal = true; val2.priority = 1000f; val2.weight = 0f; VolumeProfile val3 = ScriptableObject.CreateInstance<VolumeProfile>(); DepthOfField val4 = val3.Add<DepthOfField>(true); ((VolumeParameter<DepthOfFieldMode>)(object)val4.mode).Override((DepthOfFieldMode)1); ((VolumeParameter<float>)(object)val4.gaussianStart).Override(0f); ((VolumeParameter<float>)(object)val4.gaussianEnd).Override(0.5f); ((VolumeParameter<float>)(object)val4.gaussianMaxRadius).Override(1.5f); ((VolumeParameter<bool>)(object)val4.highQualitySampling).Override(true); ChromaticAberration val5 = val3.Add<ChromaticAberration>(true); ((VolumeParameter<float>)(object)val5.intensity).Override(0.6f); val2.sharedProfile = val3; blurVolume = val2; } private void UpdateBlurVolume() { float num = (Inverted ? 1f : 0f); blurWeight = Mathf.MoveTowards(blurWeight, num, Time.deltaTime * 2f); float strength = blurWeight * Mathf.Clamp01(BlurStrength.Value); int value = BlurMode.Value; if (blurFailed) { return; } try { if (value != 1) { UpdateVolumePart(num, strength); } if (value != 0) { UpdateScalePart(strength); } } catch (Exception ex) { blurFailed = true; ((BaseUnityPlugin)this).Logger.LogError((object)("Blur failed: " + ex)); } } private void UpdateVolumePart(float target, float strength) { if ((Object)(object)blurVolume == (Object)null) { if (target <= 0f) { return; } EnsureBlur(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Blur volume created"); } blurVolume.weight = strength; if (strength > 0.001f) { ForceCameras(on: true); } else if (camsForced && camFx.Count == 0) { ForceCameras(on: false); } } [MethodImpl(MethodImplOptions.NoInlining)] private void ForceCameras(bool on) { //IL_008c: 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_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) Camera[] allCameras = Camera.allCameras; foreach (Camera val in allCameras) { if ((Object)(object)val == (Object)null || (Object)(object)val.targetTexture != (Object)null) { continue; } UniversalAdditionalCameraData universalAdditionalCameraData = CameraExtensions.GetUniversalAdditionalCameraData(val); if ((Object)(object)universalAdditionalCameraData == (Object)null) { continue; } if (on) { if (!savedPost.ContainsKey(val)) { savedPost[val] = universalAdditionalCameraData.renderPostProcessing; Dictionary<Camera, int> dictionary = savedMask; LayerMask volumeLayerMask = universalAdditionalCameraData.volumeLayerMask; dictionary[val] = ((LayerMask)(ref volumeLayerMask)).value; if (!camsLogged) { ManualLogSource logger = ((BaseUnityPlugin)this).Logger; string[] obj = new string[8] { "Camera ", ((Object)val).name, " post=", universalAdditionalCameraData.renderPostProcessing.ToString(), " mask=", null, null, null }; volumeLayerMask = universalAdditionalCameraData.volumeLayerMask; obj[5] = ((LayerMask)(ref volumeLayerMask)).value.ToString(); obj[6] = " layer="; obj[7] = ((Component)val).gameObject.layer.ToString(); logger.LogInfo((object)string.Concat(obj)); } } universalAdditionalCameraData.renderPostProcessing = true; } else if (savedPost.ContainsKey(val)) { universalAdditionalCameraData.renderPostProcessing = savedPost[val]; savedPost.Remove(val); savedMask.Remove(val); } } if (on) { camsLogged = true; } camsForced = on; } [MethodImpl(MethodImplOptions.NoInlining)] private void UpdateScalePart(float strength) { UniversalRenderPipelineAsset asset = UniversalRenderPipeline.asset; if ((Object)(object)asset == (Object)null) { return; } if (strength <= 0.001f) { if (scaleSaved) { asset.renderScale = savedScale; scaleSaved = false; } return; } if (!scaleSaved) { savedScale = asset.renderScale; scaleSaved = true; ((BaseUnityPlugin)this).Logger.LogInfo((object)("Render scale blur from " + savedScale)); } float num = Mathf.Lerp(savedScale, Mathf.Min(savedScale, Mathf.Max(0.1f, BlurMinScale.Value)), strength); num = Mathf.Round(num * 20f) / 20f; if (Mathf.Abs(asset.renderScale - num) > 0.001f) { asset.renderScale = num; } } [MethodImpl(MethodImplOptions.NoInlining)] private void AddEchoFeature() { //IL_00b2: 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) UniversalRenderPipelineAsset asset = UniversalRenderPipeline.asset; if ((Object)(object)asset == (Object)null) { throw new Exception("URP asset not found"); } ScriptableRendererData[] value = Traverse.Create((object)asset).Field("m_RendererDataList").GetValue<ScriptableRendererData[]>(); int num = Traverse.Create((object)asset).Field("m_DefaultRendererIndex").GetValue<int>(); if (value == null || value.Length == 0) { throw new Exception("No renderer data in URP asset"); } if (num < 0 || num >= value.Length) { num = 0; } ScriptableRendererData val = value[num]; FullScreenPassRendererFeature val2 = ScriptableObject.CreateInstance<FullScreenPassRendererFeature>(); ((Object)val2).name = "VendingEchoOutline"; val2.passMaterial = echoMat; val2.passIndex = 0; val2.injectionPoint = (InjectionPoint)600; val2.fetchColorBuffer = true; val2.requirements = (ScriptableRenderPassInput)1; ((ScriptableRendererFeature)val2).SetActive(false); val.rendererFeatures.Add((ScriptableRendererFeature)(object)val2); Traverse.Create((object)val).Method("SetDirty", Array.Empty<object>()).GetValue(); echoFeature = val2; ((BaseUnityPlugin)this).Logger.LogInfo((object)("Echo feature added to renderer '" + ((Object)val).name + "' (" + (num + 1) + " of " + value.Length + ")")); } [MethodImpl(MethodImplOptions.NoInlining)] private FullScreenPassRendererFeature AddFullscreenFeature(string name, Material mat, ScriptableRenderPassInput req) { //IL_00aa: 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_00ba: Unknown result type (might be due to invalid IL or missing references) UniversalRenderPipelineAsset asset = UniversalRenderPipeline.asset; if ((Object)(object)asset == (Object)null) { throw new Exception("URP asset not found"); } ScriptableRendererData[] value = Traverse.Create((object)asset).Field("m_RendererDataList").GetValue<ScriptableRendererData[]>(); int num = Traverse.Create((object)asset).Field("m_DefaultRendererIndex").GetValue<int>(); if (value == null || value.Length == 0) { throw new Exception("No renderer data in URP asset"); } if (num < 0 || num >= value.Length) { num = 0; } ScriptableRendererData val = value[num]; FullScreenPassRendererFeature val2 = ScriptableObject.CreateInstance<FullScreenPassRendererFeature>(); ((Object)val2).name = name; val2.passMaterial = mat; val2.passIndex = 0; val2.injectionPoint = (InjectionPoint)600; val2.fetchColorBuffer = true; val2.requirements = req; ((ScriptableRendererFeature)val2).SetActive(false); val.rendererFeatures.Add((ScriptableRendererFeature)(object)val2); Traverse.Create((object)val).Method("SetDirty", Array.Empty<object>()).GetValue(); ((BaseUnityPlugin)this).Logger.LogInfo((object)("Feature " + name + " added to renderer '" + ((Object)val).name + "'")); return val2; } private void UpdateDrunk() { //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Expected O, but got Unknown float num = blurWeight * Mathf.Clamp01(DrunkStrength.Value); bool flag = num > 0.001f; if (flag && !drunkTried) { drunkTried = true; try { AssetBundle bundle = GetBundle(); Shader val = null; if ((Object)(object)bundle != (Object)null) { Shader[] array = bundle.LoadAllAssets<Shader>(); foreach (Shader val2 in array) { if (((Object)val2).name == "VendingMachine/Drunk") { val = val2; break; } } } if ((Object)(object)val == (Object)null || !val.isSupported) { ((BaseUnityPlugin)this).Logger.LogError((object)"Drunk shader missing or not supported"); } else { drunkMat = new Material(val); drunkFeature = AddFullscreenFeature("VendingDrunk", drunkMat, (ScriptableRenderPassInput)0); } } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogError((object)("Drunk init failed: " + ex)); } } if (!((Object)(object)drunkFeature == (Object)null) && !((Object)(object)drunkMat == (Object)null)) { if (flag != drunkActive) { ((ScriptableRendererFeature)drunkFeature).SetActive(flag); drunkActive = flag; } if (flag) { drunkMat.SetFloat("_Strength", num); drunkMat.SetFloat("_Wave", DrunkWave.Value); drunkMat.SetFloat("_Double", DrunkDouble.Value); drunkMat.SetFloat("_Chroma", DrunkChroma.Value); } } } private GameObject GetMachinePrefab() { if ((Object)(object)machinePrefab != (Object)null) { return machinePrefab; } if (prefabTried) { return null; } prefabTried = true; AssetBundle bundle = GetBundle(); if ((Object)(object)bundle == (Object)null) { return null; } machinePrefab = bundle.LoadAsset<GameObject>("SlotMachine"); if ((Object)(object)machinePrefab == (Object)null) { ((BaseUnityPlugin)this).Logger.LogWarning((object)"SlotMachine prefab not found in bundle, using cube machine"); } return machinePrefab; } private bool InitEchoShader() { //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Expected O, but got Unknown if (echoShaderTried) { return echoShaderOk; } echoShaderTried = true; try { AssetBundle bundle = GetBundle(); if ((Object)(object)bundle == (Object)null) { return false; } Shader val = null; Shader[] array = bundle.LoadAllAssets<Shader>(); foreach (Shader val2 in array) { if (((Object)val2).name == "VendingMachine/EchoOutline") { val = val2; break; } } if ((Object)(object)val == (Object)null || !val.isSupported) { ((BaseUnityPlugin)this).Logger.LogError((object)"Echo shader missing or not supported"); return false; } echoMat = new Material(val); AddEchoFeature(); echoShaderOk = (Object)(object)echoFeature != (Object)null; } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogError((object)("Echo shader init failed: " + ex)); echoShaderOk = false; } return echoShaderOk; } private AssetBundle GetBundle() { if ((Object)(object)echoBundle != (Object)null) { return echoBundle; } if (bundleTried) { return null; } bundleTried = true; string text = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "vendingecho"); if (!File.Exists(text)) { ((BaseUnityPlugin)this).Logger.LogError((object)("Bundle not found: " + text)); return null; } echoBundle = AssetBundle.LoadFromFile(text); if ((Object)(object)echoBundle == (Object)null) { ((BaseUnityPlugin)this).Logger.LogError((object)"Bundle failed to load"); } else { ((BaseUnityPlugin)this).Logger.LogInfo((object)("Bundle loaded: " + string.Join(", ", echoBundle.GetAllAssetNames()))); } return echoBundle; } private void UpdateEchoShader() { //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) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) bool flag = Blind && EchoMethod.Value == 0; if (flag && !echoShaderTried) { InitEchoShader(); } if (!((Object)(object)echoFeature == (Object)null) && !((Object)(object)echoMat == (Object)null)) { bool flag2 = flag && echoShaderOk; if (flag2 != echoFeatureActive) { ((ScriptableRendererFeature)echoFeature).SetActive(flag2); echoFeatureActive = flag2; } if (flag2) { Character localCharacter = Character.localCharacter; float num = Mathf.Max(10f, EchoRange.Value); float num2 = Mathf.Max(0.3f, BlindPingSeconds.Value); float num3 = Time.time % num2 / num2; echoMat.SetVector("_Origin", ((Object)(object)localCharacter != (Object)null) ? Vector4.op_Implicit(localCharacter.Center) : Vector4.zero); echoMat.SetFloat("_WaveRadius", num3 * num * 1.25f); echoMat.SetFloat("_WaveWidth", Mathf.Max(1.5f, num * 0.05f)); echoMat.SetFloat("_Trail", num * 0.45f); echoMat.SetFloat("_Range", num); echoMat.SetFloat("_Strength", Mathf.Clamp01(blindVis * EchoStrength.Value)); echoMat.SetFloat("_Darkness", Mathf.Lerp(BlindStandingAlpha.Value, BlindMovingAlpha.Value, blindVis)); echoMat.SetFloat("_Threshold", ShaderThreshold.Value); echoMat.SetFloat("_Gain", ShaderGain.Value); echoMat.SetFloat("_Thickness", ShaderThickness.Value); } } } private void UpdateBlind() { //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Expected O, but got Unknown float num = 0f; if (Blind) { Character localCharacter = Character.localCharacter; if ((Object)(object)localCharacter != (Object)null && ((Vector2)(ref localCharacter.input.movementInput)).sqrMagnitude > 0.01f) { num = 1f; } } float num2 = ((num > blindVis) ? 3f : 1.5f); blindVis = Mathf.MoveTowards(blindVis, num, num2 * Time.deltaTime); if (Blind && (Object)(object)echo == (Object)null && EchoStrength.Value > 0f && EchoMethod.Value == 1) { GameObject val = new GameObject("EchoRig"); echo = val.AddComponent<EchoRig>(); echo.width = EchoWidth.Value; echo.fps = EchoFps.Value; echo.threshold = EchoThreshold.Value; echo.farRange = EchoRange.Value; echo.pingSeconds = Mathf.Max(0.2f, BlindPingSeconds.Value); } else if (!Blind && (Object)(object)echo != (Object)null && blindVis <= 0.01f) { Object.Destroy((Object)(object)((Component)echo).gameObject); echo = null; } } private static Texture2D MakeRing(int size) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_0070: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(size, size, (TextureFormat)4, false); float num = (float)(size - 1) / 2f; for (int i = 0; i < size; i++) { for (int j = 0; j < size; j++) { float num2 = Mathf.Sqrt(((float)j - num) * ((float)j - num) + ((float)i - num) * ((float)i - num)) / num; float num3 = Mathf.Clamp01(1f - Mathf.Abs(num2 - 0.9f) / 0.06f); val.SetPixel(j, i, new Color(1f, 1f, 1f, num3)); } } ((Texture)val).wrapMode = (TextureWrapMode)1; val.Apply(); return val; } private void UpdateMachines() { //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) if (!MachineEnabled.Value) { ClearMachines(); return; } if (Time.time >= nextScan) { nextScan = Time.time + 1f; HashSet<int> hashSet = new HashSet<int>(); Campfire[] array = Object.FindObjectsOfType<Campfire>(); foreach (Campfire val in array) { int instanceID = ((Object)val).GetInstanceID(); hashSet.Add(instanceID); if (!machines.ContainsKey(instanceID)) { bool flag = (SkipForcedLit.Value && val.forceLit) || IsExcluded(((Object)val).name); if (loggedFires.Add(instanceID)) { ((BaseUnityPlugin)this).Logger.LogInfo((object)("CAMPFIRE name=" + ((Object)val).name + " pos=" + ((object)((Component)val).transform.position/*cast due to .constrained prefix*/).ToString() + " forceLit=" + val.forceLit + " advanceTo=" + ((object)Unsafe.As<Segment, Segment>(ref val.advanceToSegment)/*cast due to .constrained prefix*/).ToString() + " skipped=" + flag)); } if (!flag) { machines[instanceID] = SpawnMachine(val); } } } foreach (int item in new List<int>(machines.Keys)) { if (!hashSet.Contains(item)) { if ((Object)(object)machines[item] != (Object)null) { Object.Destroy((Object)(object)machines[item]); } machines.Remove(item); } } } Keyboard current2 = Keyboard.current; Character localCharacter = Character.localCharacter; if (current2 == null || (Object)(object)localCharacter == (Object)null || PanelOpen || !((ButtonControl)current2[KeyMachine.Value]).wasPressedThisFrame || Time.time < nextMachineUse) { return; } GameObject val2 = NearestMachine(localCharacter); if (!((Object)(object)val2 == (Object)null)) { if ((Object)(object)localCharacter.data.currentItem == (Object)null) { Say("Возьми предмет в руку"); nextMachineUse = Time.time + 0.5f; } else { nextMachineUse = Time.time + SpinSeconds.Value + 0.6f; ((MonoBehaviour)this).StartCoroutine(SpinRoutine(val2)); } } } private bool IsExcluded(string campfireName) { string[] array = MachineExclude.Value.Split(new char[1] { ',' }, StringSplitOptions.RemoveEmptyEntries); foreach (string text in array) { string text2 = text.Trim(); if (text2.Length > 0 && campfireName.IndexOf(text2, StringComparison.OrdinalIgnoreCase) >= 0) { return true; } } return false; } private void ClearMachines() { foreach (GameObject value in machines.Values) { if ((Object)(object)value != (Object)null) { Object.Destroy((Object)(object)value); } } machines.Clear(); } private GameObject NearestMachine(Character ch) { //IL_0040: 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) GameObject result = null; float num = MachineRange.Value; foreach (GameObject value in machines.Values) { if (!((Object)(object)value == (Object)null)) { float num2 = Vector3.Distance(value.transform.position, ch.Center); if (num2 <= num) { num = num2; result = value; } } } return result; } private void LoadSounds() { if (!soundsTried) { soundsTried = true; AssetBundle bundle = GetBundle(); if (!((Object)(object)bundle == (Object)null)) { sLever = bundle.LoadAsset<AudioClip>("lever"); sTick = bundle.LoadAsset<AudioClip>("reel_tick"); sStop = bundle.LoadAsset<AudioClip>("reel_stop"); sWin = bundle.LoadAsset<AudioClip>("win"); sLose = bundle.LoadAsset<AudioClip>("lose"); sJackpot = bundle.LoadAsset<AudioClip>("jackpot"); ((BaseUnityPlugin)this).Logger.LogInfo((object)("Sounds: lever=" + ((Object)(object)sLever != (Object)null) + " tick=" + ((Object)(object)sTick != (Object)null) + " stop=" + ((Object)(object)sStop != (Object)null) + " win=" + ((Object)(object)sWin != (Object)null) + " lose=" + ((Object)(object)sLose != (Object)null) + " jackpot=" + ((Object)(object)sJackpot != (Object)null))); } } } private void PlayResult(Outcome o, MachineView view) { //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) LoadSounds(); EnsureClips(); if (o.Key == "Flight") { return; } AudioClip val; if (o.Key == "Jackpot") { if ((Object)(object)sJackpot != (Object)null) { val = sJackpot; } else { if ((Object)(object)fanfareClip == (Object)null) { fanfareClip = Tone("fanfare", new float[7] { 523f, 659f, 784f, 1047f, 784f, 1047f, 1319f }, 0.12f); } val = fanfareClip; } } else if (badKeys.Contains(o.Key)) { if ((Object)(object)sLose != (Object)null) { val = sLose; } else { if ((Object)(object)loseClip == (Object)null) { loseClip = Tone("lose", new float[4] { 400f, 330f, 260f, 200f }, 0.2f); } val = loseClip; } } else { val = (((Object)(object)sWin != (Object)null) ? sWin : dingClip); } if ((Object)(object)view != (Object)null) { view.Ding(val); } else if ((Object)(object)val != (Object)null) { Camera main = Camera.main; AudioSource.PlayClipAtPoint(val, ((Object)(object)main != (Object)null) ? ((Component)main).transform.position : Vector3.zero, MachineVolume.Value); } } private IEnumerator SpinRoutine(GameObject machine) { MachineView view = (((Object)(object)machine != (Object)null) ? machine.GetComponent<MachineView>() : null); if ((Object)(object)view != (Object)null) { view.Spin(SpinSeconds.Value); } yield return (object)new WaitForSeconds(SpinSeconds.Value); Character ch = Character.localCharacter; if ((Object)(object)ch == (Object)null) { yield break; } if ((Object)(object)ch.data.currentItem == (Object)null) { Say("Предмет пропал, ничего не вышло"); yield break; } Outcome o = Pick(); if (o == null) { Say("Все исходы выключены в конфиге"); } else { RunOutcome(o, view); } } private static Shader FindFirst(params string[] names) { foreach (string text in names) { Shader val = Shader.Find(text); if ((Object)(object)val != (Object)null) { return val; } } return null; } private void FindShaders() { if (!shadersReady) { shadersReady = true; unlitShader = FindFirst("Universal Render Pipeline/Unlit", "Unlit/Color", "Sprites/Default"); glassShader = FindFirst("Sprites/Default") ?? unlitShader; ((BaseUnityPlugin)this).Logger.LogInfo((object)("Machine shaders: unlit=" + (((Object)(object)unlitShader != (Object)null) ? ((Object)unlitShader).name : "none") + " glass=" + (((Object)(object)glassShader != (Object)null) ? ((Object)glassShader).name : "none"))); } } private static AudioClip Tone(string name, float[] freqs, float noteSeconds) { int num = (int)(44100f * noteSeconds); float[] array = new float[num * freqs.Length]; for (int i = 0; i < freqs.Length; i++) { for (int j = 0; j < num; j++) { float num2 = (float)j / 44100f; float num3 = 1f - (float)j / (float)num; array[i * num + j] = Mathf.Sin(MathF.PI * 2f * freqs[i] * num2) * num3 * 0.5f; } } AudioClip val = AudioClip.Create(name, array.Length, 1, 44100, false); val.SetData(array, 0); return val; } private static void EnsureClips() { if (!((Object)(object)tickClip != (Object)null)) { tickClip = Tone("tick", new float[1] { 900f }, 0.05f); dingClip = Tone("ding", new float[3] { 660f, 880f, 1320f }, 0.14f); } } private static GameObject Part(Transform parent, PrimitiveType type, Vector3 pos, Vector3 scale, Color color, Shader sh) { //IL_0001: 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_0042: 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_0074: Expected O, but got Unknown //IL_0076: Unknown result type (might be due to invalid IL or missing references) GameObject val = GameObject.CreatePrimitive(type); Collider component = val.GetComponent<Collider>(); if ((Object)(object)component != (Object)null) { Object.Destroy((Object)(object)component); } val.transform.SetParent(parent, false); val.transform.localPosition = pos; val.transform.localScale = scale; Renderer component2 = val.GetComponent<Renderer>(); if ((Object)(object)component2 != (Object)null && (Object)(object)sh != (Object)null) { Material val2 = new Material(sh); val2.color = color; component2.material = val2; } return val; } private static Transform FindDeep(Transform t, string name) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown if (((Object)t).name == name) { return t; } foreach (Transform item in t) { Transform t2 = item; Transform val = FindDeep(t2, name); if ((Object)(object)val != (Object)null) { return val; } } return null; } private GameObject SpawnModelMachine(Campfire fire, GameObject prefab) { //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_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003d: 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_0047: 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) //IL_0059: 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_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: 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_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: 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_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010f: 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_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0327: Unknown result type (might be due to invalid IL or missing references) //IL_037c: Unknown result type (might be due to invalid IL or missing references) //IL_0383: Expected O, but got Unknown //IL_03a9: Unknown result type (might be due to invalid IL or missing references) //IL_0415: Unknown result type (might be due to invalid IL or missing references) EnsureClips(); Vector3 right = ((Component)fire).transform.right; right.y = 0f; ((Vector3)(ref right)).Normalize(); Vector3 val = ((Component)fire).transform.position + right * MachineOffset.Value; float y = ((Component)fire).transform.position.y; RaycastHit val2 = default(RaycastHit); if (Physics.Raycast(val + Vector3.up * 1.5f, Vector3.down, ref val2, 6f, -1, (QueryTriggerInteraction)1)) { y = ((RaycastHit)(ref val2)).point.y; } GameObject val3 = Object.Instantiate<GameObject>(prefab); ((Object)val3).name = "VendingMachine"; val3.transform.position = new Vector3(val.x, y, val.z); val3.transform.localScale = Vector3.one * Mathf.Max(0.1f, ModelScale.Value); Vector3 val4 = ((Component)fire).transform.position - val3.transform.position; val4.y = 0f; if (((Vector3)(ref val4)).sqrMagnitude > 0.01f) { val3.transform.rotation = Quaternion.LookRotation(val4); } Renderer[] componentsInChildren = val3.GetComponentsInChildren<Renderer>(true); foreach (Renderer val5 in componentsInChildren) { Material[] materials = val5.materials; foreach (Material val6 in materials) { Shader val7 = Shader.Find(((Object)val6.shader).name); if ((Object)(object)val7 != (Object)null && (Object)(object)val7 != (Object)(object)val6.shader) { val6.shader = val7; } } } List<Material> list = new List<Material>(); for (int k = 0; k < 16; k++) { Transform val8 = FindDeep(val3.transform, "Bulb" + k); if ((Object)(object)val8 == (Object)null) { break; } Renderer component = ((Component)val8).GetComponent<Renderer>(); if ((Object)(object)component != (Object)null) { list.Add(component.material); } } List<Transform> list2 = new List<Transform>(); for (int l = 0; l < 8; l++) { Transform val9 = FindDeep(val3.transform, "Reel" + l); if ((Object)(object)val9 == (Object)null) { break; } list2.Add(val9); } Material beaconMat = null; Light val10 = null; Transform val11 = FindDeep(