Due to update 2.4.3, some mods may no longer function. FixedConfig may be necessary.
Decompiled source of Freeze Ray Plus v1.0.0
plugins/FreezeRayPlus.dll
Decompiled 13 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using BoplFixedMath; using HarmonyLib; using Microsoft.CodeAnalysis; using PoyrazBoplMod.Abilities.FreezeRay; using PoyrazBoplMod.Abilities.FreezeRay.Combos; using PoyrazBoplMod.Core; using UnityEngine; using UnityEngine.InputSystem; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("FreezeRayPlus")] [assembly: AssemblyConfiguration("FreezeRay")] [assembly: AssemblyFileVersion("0.1.0.0")] [assembly: AssemblyInformationalVersion("0.1.0")] [assembly: AssemblyProduct("FreezeRayPlus")] [assembly: AssemblyTitle("FreezeRayPlus")] [assembly: AssemblyVersion("0.1.0.0")] [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 PoyrazBoplMod { [BepInPlugin("com.poyraz.freezerayplus", "Freeze Ray Plus", "1.0.0")] public class Plugin : BaseUnityPlugin { public const string Guid = "com.poyraz.freezerayplus"; public const string Name = "Freeze Ray Plus"; public const string Version = "1.0.0"; internal static ManualLogSource Log; internal static string PluginDir; private static bool loggedSounds; private void Awake() { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; PluginDir = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location); FreezeRayAbility.Register(); PatchAll(new Harmony("com.poyraz.freezerayplus")); SceneManager.sceneLoaded += OnSceneLoaded; AbilityRegistry.EnsureRegistered(); Log.LogInfo((object)"Freeze Ray Plus 1.0.0 yuklendi."); } private static void OnSceneLoaded(Scene scene, LoadSceneMode mode) { AbilityRegistry.EnsureRegistered(); } private static void PatchAll(Harmony harmony) { foreach (Type item in from t in typeof(Plugin).Assembly.GetTypes() where t.GetCustomAttributes(typeof(HarmonyPatch), inherit: false).Any() select t) { try { harmony.CreateClassProcessor(item).Patch(); } catch (Exception arg) { Log.LogError((object)$"Patch uygulanamadi: {item.FullName}\n{arg}"); } } } } } namespace PoyrazBoplMod.UI { internal sealed class AbilityGridScroll : MonoBehaviour { public const int VisibleRows = 10; private const float ScrollSharpness = 14f; private const float CircleSharpness = 22f; private const float GrowSharpness = 18f; private const float BarWidth = 22f; private static readonly FieldRef<AbilityGrid, AbilityGridEntry[]> gridRef = AccessTools.FieldRefAccess<AbilityGrid, AbilityGridEntry[]>("grid"); private static readonly FieldRef<AbilityGrid, int> rowsRef = AccessTools.FieldRefAccess<AbilityGrid, int>("rows"); private static readonly FieldRef<AbilityGrid, float> entrySizeRef = AccessTools.FieldRefAccess<AbilityGrid, float>("entrySize"); private static readonly FieldRef<AbilityGrid, bool> keyboardMouseRef = AccessTools.FieldRefAccess<AbilityGrid, bool>("usesKeyboardAndMouse"); private static readonly Vector2 GridPadding = new Vector2(126f, -122f); private static Sprite roundSprite; private AbilityGrid owner; private AbilityGridEntry[] entries; private RectTransform content; private RectTransform track; private RectTransform thumb; private Vector2 contentBase; private int columns; private int rows; private int visibleRows; private float entrySize; private int firstRow; private float offset; private int lastSelected = -1; private Vector2 circlePos; private float[] grow; private bool snap = true; public int FirstRow => firstRow; public int MaxFirstRow => Mathf.Max(0, rows - visibleRows); public static void Install(AbilityGrid grid) { if ((Object)(object)grid == (Object)null || (Object)(object)((Component)grid).GetComponent<AbilityGridScroll>() != (Object)null) { return; } AbilityGridEntry[] array = gridRef.Invoke(grid); if (array == null || array.Length == 0 || (Object)(object)grid.selectionCircle == (Object)null) { return; } AbilityGridScroll abilityGridScroll = ((Component)grid).gameObject.AddComponent<AbilityGridScroll>(); try { abilityGridScroll.Build(grid, array); } catch (Exception ex) { Plugin.Log.LogError((object)("Yetenek listesi kaydirma kurulamadi: " + ex)); Object.Destroy((Object)(object)abilityGridScroll); } } public void SnapToSelection() { snap = true; lastSelected = -1; } public void ScrollBy(int rowsDelta) { firstRow = Mathf.Clamp(firstRow + rowsDelta, 0, MaxFirstRow); } private void Build(AbilityGrid grid, AbilityGridEntry[] gridEntries) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_0220: Unknown result type (might be due to invalid IL or missing references) //IL_023c: 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) owner = grid; entries = gridEntries; RectTransform val = (RectTransform)((Component)grid).transform; Rect rect = val.rect; columns = Mathf.Max(1, grid.columns); rows = Mathf.Max(1, rowsRef.Invoke(grid)); visibleRows = Mathf.Min(rows, 10); entrySize = Mathf.Sqrt(((Rect)(ref rect)).width * ((Rect)(ref rect)).height * 0.9f / (float)(columns * visibleRows)); entrySizeRef.Invoke(grid) = entrySize; RectTransform val2 = NewRect("PoyrazMod_GridViewport", val); ((Transform)val2).SetSiblingIndex(((Transform)grid.selectionCircle).GetSiblingIndex()); content = NewRect("PoyrazMod_GridContent", val2); contentBase = content.anchoredPosition; ((Transform)grid.selectionCircle).SetParent((Transform)(object)content, false); grow = new float[entries.Length]; for (int i = 0; i < entries.Length; i++) { AbilityGridEntry obj = entries[i]; ((Transform)obj.rectTrans).SetParent((Transform)(object)content, false); int num = i / columns; int num2 = i % columns; obj.rectTrans.anchoredPosition = GridPadding + new Vector2((float)num2 * entrySize - ((Rect)(ref rect)).width / 2f, (float)(-num) * entrySize + ((Rect)(ref rect)).height / 2f); grow[i] = 1f; ApplyScale(i); } float y = VisualCenter(entries[0]).y; float num3 = y - (float)(visibleRows - 1) * entrySize; float num4 = y + entrySize * 0.64f; float num5 = num3 - entrySize * 0.55f; RectMask2D obj2 = ((Component)val2).gameObject.AddComponent<RectMask2D>(); obj2.padding = new Vector4(-400f, num5 - ((Rect)(ref rect)).yMin, -400f, ((Rect)(ref rect)).yMax - num4); obj2.softness = new Vector2Int(0, Mathf.RoundToInt(entrySize * 0.08f)); if (rows > visibleRows) { BuildScrollbar(val, VisualCenter(entries[Mathf.Min(columns, entries.Length) - 1]).x + entrySize * 0.75f, num4, num5); } } private static RectTransform NewRect(string name, RectTransform parent) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: 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_002c: 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_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0043: 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_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Expected O, but got Unknown RectTransform val = (RectTransform)new GameObject(name, new Type[1] { typeof(RectTransform) }).transform; ((Transform)val).SetParent((Transform)(object)parent, false); val.anchorMin = Vector2.zero; val.anchorMax = Vector2.one; val.pivot = parent.pivot; val.offsetMin = Vector2.zero; val.offsetMax = Vector2.zero; return val; } private Vector2 VisualCenter(AbilityGridEntry e) { //IL_0008: 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_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) RectTransform rectTrans = e.rectTrans; Rect rect = rectTrans.rect; Vector2 val = Vector2.Scale(((Rect)(ref rect)).size, Vector2.op_Implicit(((Transform)rectTrans).localScale)); return Vector2.op_Implicit(((Transform)rectTrans).localPosition) + Vector2.Scale(new Vector2(0.5f, 0.5f) - rectTrans.pivot, val); } private void BuildScrollbar(RectTransform parent, float x, float top, float bottom) { //IL_0028: 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_005a: 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_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: 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_0109: Unknown result type (might be due to invalid IL or missing references) float num = entrySize * 0.25f; track = NewBar("PoyrazMod_GridScrollbar", parent, new Color(0f, 0f, 0f, 0.22f)); RectTransform obj = track; RectTransform obj2 = track; Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(0.5f, 0.5f); obj2.anchorMax = val; obj.anchorMin = val; track.sizeDelta = new Vector2(22f, top - bottom - num * 2f); ((Transform)track).localPosition = new Vector3(x, (top + bottom) / 2f, 0f); thumb = NewBar("Thumb", track, new Color(1f, 1f, 1f, 0.9f)); RectTransform obj3 = thumb; RectTransform obj4 = thumb; ((Vector2)(ref val))..ctor(0.5f, 1f); obj4.anchorMax = val; obj3.anchorMin = val; thumb.pivot = new Vector2(0.5f, 1f); } private static RectTransform NewBar(string name, RectTransform parent, Color color) { //IL_0014: 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_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name, new Type[1] { typeof(RectTransform) }); RectTransform val2 = (RectTransform)val.transform; ((Transform)val2).SetParent((Transform)(object)parent, false); Image obj = val.AddComponent<Image>(); obj.sprite = RoundSprite(); obj.type = (Type)1; ((Graphic)obj).color = color; ((Graphic)obj).raycastTarget = false; return val2; } private static Sprite RoundSprite() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0087: 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) if ((Object)(object)roundSprite != (Object)null) { return roundSprite; } Texture2D val = new Texture2D(32, 32, (TextureFormat)4, false); Color[] array = (Color[])(object)new Color[1024]; for (int i = 0; i < 32; i++) { for (int j = 0; j < 32; j++) { float num = (float)j + 0.5f - 16f; float num2 = (float)i + 0.5f - 16f; float num3 = Mathf.Clamp01(16f - Mathf.Sqrt(num * num + num2 * num2)); array[i * 32 + j] = new Color(1f, 1f, 1f, num3); } } val.SetPixels(array); val.Apply(); ((Texture)val).wrapMode = (TextureWrapMode)1; ((Object)val).hideFlags = (HideFlags)32; roundSprite = Sprite.Create(val, new Rect(0f, 0f, 32f, 32f), new Vector2(0.5f, 0.5f), 100f, 0u, (SpriteMeshType)0, new Vector4(15f, 15f, 15f, 15f)); ((Object)roundSprite).hideFlags = (HideFlags)32; return roundSprite; } private void ApplyScale(int i) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) RectTransform rectTrans = entries[i].rectTrans; Rect rect = rectTrans.rect; float num = owner.nonSelectedScale * grow[i] * entrySize; ((Transform)rectTrans).localScale = new Vector3(num / ((Rect)(ref rect)).width, num / ((Rect)(ref rect)).height, 1f); } private static float Approach(float k, float dt) { return 1f - Mathf.Exp((0f - k) * dt); } private void LateUpdate() { //IL_0070: 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_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_0243: 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_024f: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_0261: 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_027b: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)owner == (Object)null || (Object)(object)content == (Object)null || !((Behaviour)owner).enabled) { return; } float unscaledDeltaTime = Time.unscaledDeltaTime; int num = Mathf.Clamp(owner.SelectedIcon, 0, entries.Length - 1); if (keyboardMouseRef.Invoke(owner) && Mouse.current != null) { float y = ((InputControl<Vector2>)(object)Mouse.current.scroll).ReadValue().y; if (y > 0.01f) { firstRow--; } else if (y < -0.01f) { firstRow++; } } if (num != lastSelected) { int num2 = num / columns; if (num2 < firstRow) { firstRow = num2; } else if (num2 > firstRow + visibleRows - 1) { firstRow = num2 - visibleRows + 1; } lastSelected = num; } firstRow = Mathf.Clamp(firstRow, 0, MaxFirstRow); float num3 = (float)firstRow * entrySize; offset = (snap ? num3 : Mathf.Lerp(offset, num3, Approach(14f, unscaledDeltaTime))); if (Mathf.Abs(offset - num3) < 0.5f) { offset = num3; } content.anchoredPosition = contentBase + new Vector2(0f, offset); float num4 = ((owner.nonSelectedScale > 0.0001f) ? (owner.selectedScale / owner.nonSelectedScale) : 1f); float num5 = (snap ? 1f : Approach(18f, unscaledDeltaTime)); for (int i = 0; i < entries.Length; i++) { if (!((Object)(object)entries[i] == (Object)null)) { grow[i] = Mathf.Lerp(grow[i], (i == num) ? num4 : 1f, num5); ApplyScale(i); } } Vector2 anchoredPosition = entries[num].rectTrans.anchoredPosition; circlePos = (snap ? anchoredPosition : Vector2.Lerp(circlePos, anchoredPosition, Approach(22f, unscaledDeltaTime))); owner.selectionCircle.anchoredPosition = circlePos; UpdateScrollbar(); snap = false; } private void UpdateScrollbar() { //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_0076: 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) if (!((Object)(object)track == (Object)null)) { Rect rect = track.rect; float height = ((Rect)(ref rect)).height; float num = Mathf.Max(height * (float)visibleRows / (float)rows, 44f); float num2 = ((MaxFirstRow > 0) ? Mathf.Clamp01(offset / ((float)MaxFirstRow * entrySize)) : 0f); thumb.sizeDelta = new Vector2(22f, num); thumb.anchoredPosition = new Vector2(0f, (0f - (height - num)) * num2); } } } [HarmonyPatch(typeof(AbilityGrid), "Awake")] internal static class Patch_AbilityGrid_Awake { private static void Postfix(AbilityGrid __instance) { AbilityGridScroll.Install(__instance); } } [HarmonyPatch(typeof(AbilityGrid), "Init")] internal static class Patch_AbilityGrid_Init { private static void Postfix(AbilityGrid __instance) { AbilityGridScroll component = ((Component)__instance).GetComponent<AbilityGridScroll>(); if ((Object)(object)component != (Object)null) { component.SnapToSelection(); } } } } namespace PoyrazBoplMod.Core { internal class CustomAbility { public string Name; public string IconFile; public Color PlaceholderColor = Color.white; public Func<NamedSprite, bool> IsTemplate; public Action<GameObject, NamedSprite> Setup; public Dictionary<Language, string> Translations = new Dictionary<Language, string>(); public GameObject Prefab; public Sprite Icon; public bool IsOffensive; internal string TemplateName; internal GameObject TemplateSource; internal bool BuildFailed; } internal static class AbilityRegistry { private static readonly List<CustomAbility> abilities = new List<CustomAbility>(); private static readonly Dictionary<string, CustomAbility> byLowerName = new Dictionary<string, CustomAbility>(); private static GameObject templateHolder; public static IReadOnlyList<CustomAbility> All => abilities; public static void Add(CustomAbility ability) { abilities.Add(ability); byLowerName[ability.Name.ToLowerInvariant()] = ability; } public static bool TryTranslate(string enText, Language lang, out string result) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) result = null; if (enText == null || !byLowerName.TryGetValue(enText.ToLowerInvariant(), out var value)) { return false; } if (!value.Translations.TryGetValue(lang, out result)) { result = enText; } return true; } public static void EnsureRegistered() { //IL_012c: Unknown result type (might be due to invalid IL or missing references) NamedSpriteList[] array; try { array = Resources.FindObjectsOfTypeAll<NamedSpriteList>(); } catch (Exception ex) { Plugin.Log.LogError((object)("Yetenek listeleri bulunamadi: " + ex)); return; } if (array == null || array.Length == 0) { return; } foreach (CustomAbility ability in abilities) { if ((Object)(object)ability.Prefab == (Object)null && !ability.BuildFailed) { TryBuild(ability, array); } } NamedSpriteList[] array2 = array; foreach (NamedSpriteList val in array2) { if ((Object)(object)val == (Object)null || val.sprites == null || ((Object)val).name.IndexOf("demo", StringComparison.OrdinalIgnoreCase) >= 0) { continue; } foreach (CustomAbility ability2 in abilities) { if (!((Object)(object)ability2.Prefab == (Object)null) && val.IndexOf(ability2.Name) < 0 && ContainsTemplate(val, ability2)) { val.sprites.Add(new NamedSprite(ability2.Name, ability2.Icon, ability2.Prefab, ability2.IsOffensive)); Plugin.Log.LogInfo((object)$"'{ability2.Name}' yetenegi '{((Object)val).name}' listesine eklendi (sira: {val.sprites.Count - 1})."); } } } } private static bool ContainsTemplate(NamedSpriteList list, CustomAbility ability) { //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_0016: 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) foreach (NamedSprite sprite in list.sprites) { if (sprite.name == ability.TemplateName) { return true; } if ((Object)(object)ability.TemplateSource != (Object)null && (Object)(object)sprite.associatedGameObject == (Object)(object)ability.TemplateSource) { return true; } } return false; } private static void TryBuild(CustomAbility ability, NamedSpriteList[] lists) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003b: 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_005b: Unknown result type (might be due to invalid IL or missing references) foreach (NamedSpriteList val in lists) { if ((Object)(object)val == (Object)null || val.sprites == null) { continue; } foreach (NamedSprite sprite in val.sprites) { if (!((Object)(object)sprite.associatedGameObject == (Object)null) && ability.IsTemplate(sprite)) { try { Build(ability, sprite); return; } catch (Exception arg) { ability.BuildFailed = true; Plugin.Log.LogError((object)$"'{ability.Name}' olusturulamadi:\n{arg}"); return; } } } } } private static void Build(CustomAbility ability, NamedSprite source) { //IL_0031: 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_0061: 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_0079: 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_0091: 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_00d5: 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_001c: Expected O, but got Unknown //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0110: 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) if ((Object)(object)templateHolder == (Object)null) { templateHolder = new GameObject("PoyrazBoplMod_Templates"); templateHolder.SetActive(false); Object.DontDestroyOnLoad((Object)(object)templateHolder); } GameObject val = Object.Instantiate<GameObject>(source.associatedGameObject, templateHolder.transform); ((Object)val).name = ability.Name; ability.Setup(val, source); ability.TemplateName = source.name; ability.TemplateSource = source.associatedGameObject; ability.IsOffensive = source.isOffensiveAbility; ability.Icon = IconLoader.LoadOrPlaceholder(ability.IconFile, ability.PlaceholderColor, source.sprite); ability.Prefab = val; Sprite sprite = source.sprite; ManualLogSource log = Plugin.Log; string[] obj = new string[6] { "'", ability.Name, "' olusturuldu ('", source.name, "' kopyalandi). Ikon boyutu: ", null }; object obj2; if (!((Object)(object)sprite != (Object)null)) { obj2 = "?"; } else { Rect rect = sprite.rect; object arg = (int)((Rect)(ref rect)).width; rect = sprite.rect; obj2 = $"{arg}x{(int)((Rect)(ref rect)).height}"; } obj[5] = (string)obj2; log.LogInfo((object)string.Concat(obj)); } } [HarmonyPatch(typeof(SteamManager), "Awake")] internal static class Patch_SteamManager_Awake { private static void Postfix() { AbilityRegistry.EnsureRegistered(); } } [HarmonyPatch(typeof(AbilityGrid), "Awake")] internal static class Patch_AbilityGrid_Awake { private static void Prefix() { AbilityRegistry.EnsureRegistered(); } } [HarmonyPatch(typeof(LocalizationTable), "GetText")] internal static class Patch_LocalizationTable_GetText { private static bool Prefix(string enText, Language lang, ref string __result) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) if (!AbilityRegistry.TryTranslate(enText, lang, out var result)) { return true; } __result = result; return false; } } internal static class GameLayers { private static bool initialized; public static int Player; public static int Water; public static int Wall; public static int Projectile; public static int Explosion; public static int LethalTerrain; public static int Orb; public static int RigidBodyAffector; public static void Init() { if (!initialized) { Player = LayerMask.NameToLayer("Player"); Water = LayerMask.NameToLayer("Water"); Wall = LayerMask.NameToLayer("wall"); Projectile = LayerMask.NameToLayer("Projectile"); Explosion = LayerMask.NameToLayer("Explosion"); LethalTerrain = LayerMask.NameToLayer("LethalTerrain"); Orb = LayerMask.NameToLayer("orb"); RigidBodyAffector = LayerMask.NameToLayer("RigidBodyAffector"); initialized = true; } } public static string Name(int layer) { if (layer < 0) { return "?"; } return LayerMask.LayerToName(layer); } } internal static class Sfx { private static HashSet<string> known; private static readonly FieldInfo instanceField = AccessTools.Field(typeof(AudioManager), "instance"); public static AudioManager Audio { get { object? obj = instanceField?.GetValue(null); return (AudioManager)((obj is AudioManager) ? obj : null); } } public static void Play(params string[] candidates) { AudioManager audio = Audio; if ((Object)(object)audio == (Object)null || audio.sounds == null) { return; } if (known == null || known.Count == 0) { known = new HashSet<string>(from s in audio.sounds where s.name != null select s.name); } foreach (string text in candidates) { if (known.Contains(text)) { audio.Play(text); break; } } } public static void LogAllSoundNames() { AudioManager audio = Audio; if (!((Object)(object)audio == (Object)null) && audio.sounds != null) { Plugin.Log.LogInfo((object)("Oyundaki sesler: " + string.Join(", ", audio.sounds.Select((Sound s) => s.name)))); } } } internal static class PhysicsUtil { public delegate void BodyEditor(ref PhysicsBody body); public static readonly Fix PinnedInverseMass = Fix.FromRaw(65536L); public static readonly Fix PinnedInverseMassLimit = Fix.FromRaw(131072L); public static void EditBody(IPhysicsCollider col, BodyEditor edit) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected I4, but got Unknown if (IsAlive(col) && !col.IsComposite()) { DetPhysics val = DetPhysics.Get(); int instanceId = col.GetPhysicsParent().instanceId; Shape shape = col.shape; switch ((int)shape) { case 0: edit(ref val.circles.physicsBodies[val.circles.ColliderIndex(instanceId)]); break; case 1: edit(ref val.boxes.physicsBodies[val.boxes.ColliderIndex(instanceId)]); break; case 2: edit(ref val.roundedRects.physicsBodies[val.roundedRects.ColliderIndex(instanceId)]); break; } } } public static PhysicsBody ReadBody(IPhysicsCollider col) { //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_001b: Unknown result type (might be due to invalid IL or missing references) if (!IsAlive(col) || col.IsComposite()) { return default(PhysicsBody); } return col.GetBody(); } public static void Pin(IPhysicsCollider col) { EditBody(col, delegate(ref PhysicsBody body) { //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_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_0017: 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_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) body.velocity = Vec2.zero; body.angularVelocity = Fix.Zero; body.force = Vec2.zero; body.gravityScale = Fix.Zero; }); } public static Fix GetGravityScale(IPhysicsCollider col) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) if (!IsAlive(col) || col.IsComposite()) { return Fix.One; } return col.GetBody().gravityScale; } public static void SetGravityScale(IPhysicsCollider col, Fix value) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) EditBody(col, delegate(ref PhysicsBody body) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) body.gravityScale = value; }); } public static bool IsAlive(IPhysicsCollider col) { if (col != null && !col.IsDestroyed && (Object)(object)((col is Object) ? col : null) != (Object)null && col.initHasBeenCalled) { return IsRegistered(col); } return false; } private static bool IsRegistered(IPhysicsCollider col) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: 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_0036: Expected I4, but got Unknown DetPhysics val = DetPhysics.Get(); if ((Object)(object)val == (Object)null) { return false; } int instanceId = col.GetPhysicsParent().instanceId; Shape shape = col.shape; return (int)shape switch { 0 => val.circles.ContainsParent(instanceId), 1 => val.boxes.ContainsParent(instanceId), 2 => val.roundedRects.ContainsParent(instanceId), _ => false, }; } public static void ClearForce(IPhysicsCollider col) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected I4, but got Unknown //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) if (IsAlive(col) && !col.IsComposite()) { DetPhysics val = DetPhysics.Get(); int instanceId = col.GetPhysicsParent().instanceId; Shape shape = col.shape; switch ((int)shape) { case 0: val.circles.physicsBodies[val.circles.ColliderIndex(instanceId)].force = Vec2.zero; break; case 1: val.boxes.physicsBodies[val.boxes.ColliderIndex(instanceId)].force = Vec2.zero; break; case 2: val.roundedRects.physicsBodies[val.roundedRects.ColliderIndex(instanceId)].force = Vec2.zero; break; } } } } internal sealed class ReferenceComparer<T> : IEqualityComparer<T> where T : class { public static readonly ReferenceComparer<T> Instance = new ReferenceComparer<T>(); public bool Equals(T x, T y) { return x == y; } public int GetHashCode(T obj) { return RuntimeHelpers.GetHashCode(obj); } } internal static class GamePrefabs { private static Boulder boulder; public static Boulder Boulder { get { Find(); return boulder; } } private static void Find() { //IL_004b: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)boulder != (Object)null) { return; } NamedSpriteList val = (((Object)(object)SteamManager.instance != (Object)null) ? SteamManager.instance.abilityIcons : null); if ((Object)(object)val == (Object)null || val.sprites == null) { return; } foreach (NamedSprite sprite in val.sprites) { GameObject associatedGameObject = sprite.associatedGameObject; if (!((Object)(object)associatedGameObject == (Object)null)) { ShootDuplicator component = associatedGameObject.GetComponent<ShootDuplicator>(); if ((Object)(object)component != (Object)null && (Object)(object)component.boulderPrefab != (Object)null) { boulder = component.boulderPrefab; } } } } } internal static class IconLoader { public static Sprite LoadOrPlaceholder(string fileName, Color placeholderColor, Sprite reference) { //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_0045: 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_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007f: 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_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0130: 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_00d6: Expected O, but got Unknown int num = 128; int height = 128; float num2 = 100f; Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(0.5f, 0.5f); if ((Object)(object)reference != (Object)null) { Rect rect = reference.rect; num = Mathf.Max(1, (int)((Rect)(ref rect)).width); rect = reference.rect; height = Mathf.Max(1, (int)((Rect)(ref rect)).height); num2 = reference.pixelsPerUnit; float x = reference.pivot.x; rect = reference.rect; float num3 = x / ((Rect)(ref rect)).width; float y = reference.pivot.y; rect = reference.rect; ((Vector2)(ref val))..ctor(num3, y / ((Rect)(ref rect)).height); } Texture2D val2 = null; string text = (string.IsNullOrEmpty(fileName) ? null : Path.Combine(Plugin.PluginDir, "icons", fileName)); if (text != null && File.Exists(text)) { try { val2 = new Texture2D(2, 2, (TextureFormat)4, false); if (!ImageConversion.LoadImage(val2, File.ReadAllBytes(text))) { val2 = null; } else { num2 *= (float)((Texture)val2).width / (float)num; } } catch (Exception ex) { Plugin.Log.LogWarning((object)("Ikon okunamadi (" + text + "): " + ex.Message)); val2 = null; } } if ((Object)(object)val2 == (Object)null) { val2 = SolidTexture(num, height, placeholderColor); } ((Texture)val2).filterMode = (FilterMode)1; ((Texture)val2).wrapMode = (TextureWrapMode)1; ((Object)val2).hideFlags = (HideFlags)32; Sprite obj = Sprite.Create(val2, new Rect(0f, 0f, (float)((Texture)val2).width, (float)((Texture)val2).height), val, num2); ((Object)obj).name = Path.GetFileNameWithoutExtension(fileName ?? "icon"); ((Object)obj).hideFlags = (HideFlags)32; return obj; } private static Texture2D SolidTexture(int width, int height, Color color) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Expected O, but got Unknown //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0014: 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_0020: 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) Texture2D val = new Texture2D(width, height, (TextureFormat)4, false); Color32[] array = (Color32[])(object)new Color32[width * height]; Color32 val2 = Color32.op_Implicit(color); for (int i = 0; i < array.Length; i++) { array[i] = val2; } val.SetPixels32(array); val.Apply(); return val; } } } namespace PoyrazBoplMod.Abilities.FreezeRay { internal static class BeamOvercharge { private sealed class Charge { public Beam Beam; public int PlayerId; public int ButtonIndex; public Fix Time; } internal struct ForcedButton { public InputProfile Inputs; public int Index; public bool Previous; public bool Active; public void Restore() { if (Active) { Set(Inputs, Index, Previous); } } } private static readonly FieldRef<Beam, BeamState> stateRef = AccessTools.FieldRefAccess<Beam, BeamState>("state"); private static readonly FieldRef<Beam, bool> onFirstFrameRef = AccessTools.FieldRefAccess<Beam, bool>("onFirstFrame"); private static readonly FieldRef<Beam, Fix> timeSinceBeamStartRef = AccessTools.FieldRefAccess<Beam, Fix>("timeSinceBeamStart"); private static readonly FieldRef<Beam, int> beamIndexRef = AccessTools.FieldRefAccess<Beam, int>("beamIndex"); private static readonly FieldRef<Beam, PlayerInfo> playerInfoRef = AccessTools.FieldRefAccess<Beam, PlayerInfo>("playerInfo"); private static readonly FieldRef<Beam, InterruptableAudio> loadingSoundRef = AccessTools.FieldRefAccess<Beam, InterruptableAudio>("loadingSound"); private static readonly Action<Beam> startBeam = AccessTools.MethodDelegate<Action<Beam>>(AccessTools.Method(typeof(Beam), "StartBeam", (Type[])null, (Type[])null), (object)null, true); private static readonly Action<Beam> stopBeam = AccessTools.MethodDelegate<Action<Beam>>(AccessTools.Method(typeof(Beam), "Stop", (Type[])null, (Type[])null), (object)null, true); private static readonly FieldRef<Player, InputProfile> inputsRef = AccessTools.FieldRefAccess<Player, InputProfile>("Inputs"); private static readonly List<Charge> active = new List<Charge>(); public static bool Any => active.Count > 0; public static bool IsCharging(Beam beam) { return (int)stateRef.Invoke(beam) == 0; } public static void OnBeamFrozen(Beam beam) { //IL_000b: 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_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002e: 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_003d: Unknown result type (might be due to invalid IL or missing references) InterruptableAudio val = loadingSoundRef.Invoke(beam); AudioManager audio = Sfx.Audio; if ((Object)(object)audio != (Object)null && (Object)(object)val.source != (Object)null && val.timesPlayed == audio.TimesSoundsPlayed(val)) { val.source.Stop(); } } public static void Start(Beam beam) { //IL_002b: 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_002e: Invalid comparison between Unknown and I4 //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0057: 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_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_00b8: 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_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_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) if ((Object)(object)beam == (Object)null || ((MonoUpdatable)beam).IsDestroyed || !((Component)beam).gameObject.activeInHierarchy) { return; } BeamState val = stateRef.Invoke(beam); if ((int)val == 2) { return; } if ((int)val == 0) { onFirstFrameRef.Invoke(beam) = false; startBeam(beam); } timeSinceBeamStartRef.Invoke(beam) = Fix.Zero; foreach (Charge item in active) { if ((Object)(object)item.Beam == (Object)(object)beam) { item.Time = Fix.Zero; return; } } PlayerInfo val2 = playerInfoRef.Invoke(beam); active.Add(new Charge { Beam = beam, PlayerId = val2.playerId, ButtonIndex = val2.AbilityButtonUsedIndex012, Time = Fix.Zero }); Sfx.Play("beamFire"); IceVisuals.ShakeCamera(0.9f); } private static Fix ScaleFactor(Charge c) { //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_000b: 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_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) Fix val = Fix.Clamp01(c.Time / FreezeTuning.OverchargeTime); return Fix.Lerp(FreezeTuning.OverchargeStartScale, FreezeTuning.OverchargeEndScale, val); } private static Charge Find(Beam beam) { foreach (Charge item in active) { if ((Object)(object)item.Beam == (Object)(object)beam) { return item; } } return null; } public static void Tick(Fix dt) { //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0081: 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_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) for (int num = active.Count - 1; num >= 0; num--) { Charge charge = active[num]; if ((Object)(object)charge.Beam == (Object)null || ((MonoUpdatable)charge.Beam).IsDestroyed || !((Component)charge.Beam).gameObject.activeInHierarchy || (int)stateRef.Invoke(charge.Beam) != 1) { active.RemoveAt(num); } else if (!GameTime.IsTimeStoppedFor(charge.PlayerId)) { charge.Time += dt; if (charge.Time >= FreezeTuning.OverchargeTime) { active.RemoveAt(num); stopBeam(charge.Beam); } } } } public static void ResetAll() { active.Clear(); } internal static void AfterUpdateBeam(Beam beam) { //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) //IL_0059: Unknown result type (might be due to invalid IL or missing references) Charge charge = Find(beam); if (charge != null) { int num = beamIndexRef.Invoke(beam); DetPhysics val = DetPhysics.Get(); if (num >= 0 && !((Object)(object)val == (Object)null) && num < val.beamBodies.Length) { ref Fix scale = ref val.beamBodies[num].scale; scale *= ScaleFactor(charge); } } } internal static ForcedButton ForceButton(Beam beam) { Charge charge = Find(beam); if (charge == null) { return default(ForcedButton); } Player player = PlayerHandler.Get().GetPlayer(charge.PlayerId); if (player == null) { return default(ForcedButton); } InputProfile val = inputsRef.Invoke(player); if (val == null) { return default(ForcedButton); } ForcedButton result = new ForcedButton { Inputs = val, Index = charge.ButtonIndex, Previous = Get(val, charge.ButtonIndex), Active = true }; Set(val, charge.ButtonIndex, value: true); return result; } private static bool Get(InputProfile p, int index) { return index switch { 0 => p.firstAbilityButton_IS_DOWN, 1 => p.secondAbilityButton_IS_DOWN, 2 => p.thirdAbilityButton_IS_DOWN, _ => false, }; } private static void Set(InputProfile p, int index, bool value) { switch (index) { case 0: p.firstAbilityButton_IS_DOWN = value; break; case 1: p.secondAbilityButton_IS_DOWN = value; break; case 2: p.thirdAbilityButton_IS_DOWN = value; break; } } } [HarmonyPatch(typeof(Beam), "UpdateBeam")] internal static class Patch_Beam_UpdateBeam { private static void Postfix(Beam __instance) { if (BeamOvercharge.Any) { BeamOvercharge.AfterUpdateBeam(__instance); } } } [HarmonyPatch(typeof(Beam), "UpdateSim")] internal static class Patch_Beam_UpdateSim { private static BeamOvercharge.ForcedButton pending; private static void Prefix(Beam __instance) { pending = (BeamOvercharge.Any ? BeamOvercharge.ForceButton(__instance) : default(BeamOvercharge.ForcedButton)); } private static Exception Finalizer(Exception __exception) { pending.Restore(); pending = default(BeamOvercharge.ForcedButton); return __exception; } } internal sealed class ColdAura : MonoBehaviour { private static readonly Color AuraColor = new Color(0.55f, 0.88f, 1f, 1f); private SpriteRenderer ren; private float baseAlpha; private float phase; public float Fade = 1f; public static ColdAura Add(Transform parent, Vector2 size, int layer, int order, float alpha = 0.3f) { //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) GameObject val = new GameObject("ColdAura"); val.transform.SetParent(parent, false); ColdAura coldAura = val.AddComponent<ColdAura>(); coldAura.ren = val.AddComponent<SpriteRenderer>(); coldAura.ren.sprite = IceArt.Glow; ((Renderer)coldAura.ren).sortingLayerID = layer; ((Renderer)coldAura.ren).sortingOrder = order; coldAura.baseAlpha = alpha; coldAura.phase = VisualRandom.Range(0f, 6.28f); coldAura.SetSize(size); coldAura.Apply(); return coldAura; } public void SetSize(Vector2 size) { //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_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_002b: 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_0044: 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) Bounds bounds = IceArt.Glow.bounds; Vector3 size2 = ((Bounds)(ref bounds)).size; ((Component)this).transform.localScale = new Vector3((size.x * 1.3f + 1.1f) / size2.x, (size.y * 1.6f + 1.1f) / size2.y, 1f); } private void Update() { phase += Time.deltaTime * 2.2f; Apply(); } private void Apply() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: 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) Color auraColor = AuraColor; auraColor.a = baseAlpha * Mathf.Clamp01(Fade) * (0.8f + 0.2f * Mathf.Sin(phase)); ren.color = auraColor; } } internal static class FreezeManager { private class GraceTimer { public Fix Remaining; public readonly List<PlayerCollision> Collisions = new List<PlayerCollision>(); } private static readonly List<FrozenEntry> entries = new List<FrozenEntry>(); private static readonly List<GraceTimer> graces = new List<GraceTimer>(); private static readonly List<IPhysicsCollider> pinned = new List<IPhysicsCollider>(); private static readonly Dictionary<int, FrozenObject> objectsById = new Dictionary<int, FrozenObject>(); private static readonly Dictionary<MonoUpdatable, int> skipped = new Dictionary<MonoUpdatable, int>(ReferenceComparer<MonoUpdatable>.Instance); private static readonly FieldRef<PlayerCollision, int> ignoredBeamIdRef = AccessTools.FieldRefAccess<PlayerCollision, int>("ignoredBeamId"); private static bool briefPlayerFreeze; private static readonly PhysicsParent[] damageBuffer = (PhysicsParent[])(object)new PhysicsParent[16]; private static int damageMask = -1; public static bool HasFrozenObjects => objectsById.Count > 0; public static bool HasSkips => skipped.Count > 0; internal static List<FrozenEntry> Entries => entries; internal static void RegisterObject(FrozenObject obj) { objectsById[obj.InstanceId] = obj; } internal static void UnregisterObject(FrozenObject obj) { if (objectsById.TryGetValue(obj.InstanceId, out var value) && value == obj) { objectsById.Remove(obj.InstanceId); } } public static FrozenObject FindObjectById(int instanceId) { if (!objectsById.TryGetValue(instanceId, out var value) || value.Ended) { return null; } return value; } public static bool ShouldSkip(MonoUpdatable updatable) { return skipped.ContainsKey(updatable); } internal static void AddSkip(MonoUpdatable updatable) { skipped.TryGetValue(updatable, out var value); skipped[updatable] = value + 1; } internal static void RemoveSkip(MonoUpdatable updatable) { if (skipped.TryGetValue(updatable, out var value)) { if (value <= 1) { skipped.Remove(updatable); } else { skipped[updatable] = value - 1; } } } internal static void RegisterPinned(IPhysicsCollider col) { if (col != null && !pinned.Contains(col)) { pinned.Add(col); } } internal static void UnregisterPinned(IPhysicsCollider col) { pinned.Remove(col); } public static void PinBodies() { for (int num = pinned.Count - 1; num >= 0; num--) { IPhysicsCollider col = pinned[num]; if (!PhysicsUtil.IsAlive(col)) { pinned.RemoveAt(num); } else { PhysicsUtil.Pin(col); } } foreach (FrozenObject value in objectsById.Values) { value.HoldAgainstForces(); } IcePlatforms.HoldStopped(); } public static void OnRayHit(RaycastInformation hit, int shooterId) { //IL_0005: 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_002b: 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_0085: 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_0107: Unknown result type (might be due to invalid IL or missing references) GameLayers.Init(); FixTransform fixTrans = hit.pp.fixTrans; if ((Object)(object)fixTrans == (Object)null || fixTrans.IsDestroyed) { return; } GameObject gameObject = ((Component)fixTrans).gameObject; if (RocketEngineFreeze.TryExtinguish(gameObject, hit.nearPos)) { return; } SpikeAttack component = gameObject.GetComponent<SpikeAttack>(); if ((Object)(object)component != (Object)null) { Icicles.FromSpike(component); } else { if (IceTesla.TryFreeze(gameObject)) { return; } FlammableSmoke component2 = gameObject.GetComponent<FlammableSmoke>(); if ((Object)(object)component2 != (Object)null) { SnowClouds.Convert(component2); } else if ((Object)(object)gameObject.GetComponent<BlackHole>() != (Object)null) { FreezeObject(gameObject); } else if (hit.layer == GameLayers.Wall || gameObject.layer == GameLayers.Wall) { StickyRoundedRectangle component3 = gameObject.GetComponent<StickyRoundedRectangle>(); if (!((Object)(object)component3 == (Object)null)) { GameObject val = IceStands.OwnerOf(component3); if ((Object)(object)val != (Object)null) { FreezeObject(val); } else if (!Icicles.TryAddLayer(component3) && !IceTesla.TryRefreshBridge(component3) && !IceSurfaces.TryRefresh(component3) && !FrozenBeams.TryRefresh(component3)) { IcePlatforms.OnPlatformHit(component3); } } } else { if (hit.layer == GameLayers.RigidBodyAffector) { return; } if (hit.layer == GameLayers.Player || gameObject.layer == GameLayers.Player) { PlayerCollision val2 = gameObject.GetComponent<PlayerCollision>(); if ((Object)(object)val2 == (Object)null) { val2 = gameObject.GetComponentInParent<PlayerCollision>(); } BounceBall val3 = (((Object)(object)val2 != (Object)null) ? ((Component)val2).GetComponent<BounceBall>() : gameObject.GetComponentInParent<BounceBall>()); if ((Object)(object)val3 != (Object)null) { FreezePlayer(((Component)val3).gameObject, val2, FrozenPlayer.Kind.Rock); return; } if ((Object)(object)val2 != (Object)null) { Beam component4 = ((Component)val2).GetComponent<Beam>(); if ((Object)(object)component4 != (Object)null && FrozenBeams.IsFiring(component4)) { FreezePlayer(((Component)val2).gameObject, val2, FrozenPlayer.Kind.BeamFrozen); FrozenBeams.Freeze(component4, FindEntry(((Component)val2).gameObject)); } else { bool flag = (Object)(object)component4 != (Object)null && BeamOvercharge.IsCharging(component4); FreezePlayer(((Component)val2).gameObject, val2, flag ? FrozenPlayer.Kind.BeamMelt : (briefPlayerFreeze ? FrozenPlayer.Kind.Brief : FrozenPlayer.Kind.Normal)); } return; } } if (FrozenObject.CanFreeze(gameObject)) { FreezeObject(gameObject); } } } } public static void FreezeTarget(GameObject go, bool brief = true) { //IL_0025: 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_0048: 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_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_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_0077: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)go == (Object)null) { return; } IPhysicsCollider component = go.GetComponent<IPhysicsCollider>(); if (component == null || component.IsDestroyed) { return; } briefPlayerFreeze = brief; try { OnRayHit(new RaycastInformation { layer = go.layer, pp = component.GetPhysicsParent(), nearPos = component.position, farPos = component.position, nearDist = Fix.One, farDist = Fix.One }, -1); } finally { briefPlayerFreeze = false; } } private static void FreezePlayer(GameObject go, PlayerCollision collision, FrozenPlayer.Kind kind) { FrozenEntry frozenEntry = FindEntry(go); if (frozenEntry != null) { frozenEntry.AddLayer(); return; } FrozenPlayer frozenPlayer = new FrozenPlayer(go, collision, kind); entries.Add(frozenPlayer); frozenPlayer.Begin(); } private static void FreezeObject(GameObject go) { FrozenEntry frozenEntry = FindEntry(go); if (frozenEntry != null) { frozenEntry.AddLayer(); return; } FrozenObject frozenObject = new FrozenObject(go); entries.Add(frozenObject); frozenObject.Begin(); } private static FrozenEntry FindEntry(GameObject go) { foreach (FrozenEntry entry in entries) { if (!entry.Ended && (Object)(object)entry.Go == (Object)(object)go) { return entry; } } return null; } public static bool IsFrozen(GameObject go) { if ((Object)(object)go != (Object)null) { return FindEntry(go) != null; } return false; } public static bool IsPlayerFrozen(int playerId) { foreach (FrozenEntry entry in entries) { if (!entry.Ended && entry is FrozenPlayer frozenPlayer && (Object)(object)frozenPlayer.Collision != (Object)null && !((MonoUpdatable)frozenPlayer.Collision).IsDestroyed && frozenPlayer.Collision.GetPlayerId() == playerId) { return true; } } return false; } public static FrozenEntry FindEntryFor(GameObject go) { if ((Object)(object)go == (Object)null) { return null; } foreach (FrozenEntry entry in entries) { if (!entry.Ended && (Object)(object)entry.Go != (Object)null && ((Object)(object)entry.Go == (Object)(object)go || go.transform.IsChildOf(entry.Go.transform))) { return entry; } } return null; } internal static string Describe() { //IL_006a: Unknown result type (might be due to invalid IL or missing references) List<string> list = new List<string>(); foreach (FrozenEntry entry in entries) { if (!entry.Ended) { string arg = ((entry is FrozenPlayer frozenPlayer) ? ("oyuncu/" + frozenPlayer.Type) : "cisim"); list.Add($"{((Object)entry.Go).name}({arg}, kalan {(float)entry.Remaining:0.00} sn)"); } } if (list.Count != 0) { return string.Join(", ", list); } return "(donuk bir sey yok)"; } internal static Fix DebugRemaining(GameObject go) { //IL_0011: 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) return FindEntry(go)?.Remaining ?? Fix.Zero; } internal static void DebugSetRemaining(GameObject go, Fix remaining) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) FrozenEntry frozenEntry = FindEntry(go); if (frozenEntry != null) { frozenEntry.Remaining = remaining; } } internal static int DebugCrackStage(GameObject go) { return FindEntry(go)?.CrackStage ?? (-1); } internal static float DebugIceScale(GameObject go) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) FrozenEntry frozenEntry = FindEntry(go); if (frozenEntry == null) { return 0f; } return (float)frozenEntry.IceScale; } internal static int DebugIceLayers(GameObject go) { return FindEntry(go)?.IceLayers ?? 0; } internal static void DebugIceBox(GameObject go, out Vec2 center, out Fix half) { //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_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) center = Vec2.zero; half = Fix.One; FrozenEntry frozenEntry = FindEntry(go); if (frozenEntry != null) { RayBounce.CubeBox(frozenEntry, out center, out half); } } internal static int DebugMashCount(GameObject go) { if (!(FindEntry(go) is FrozenPlayer frozenPlayer)) { return -1; } return frozenPlayer.MashCount; } internal static bool DebugHasIceCube(GameObject go) { return FindEntry(go)?.HasIceBlock ?? false; } internal static void DebugExpire(GameObject go) { //IL_000b: 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) FrozenEntry frozenEntry = FindEntry(go); if (frozenEntry != null) { frozenEntry.Remaining = Fix.Zero; } } public static bool TryHandleFrozenPlayerCollision(PlayerCollision collision, CollisionInformation info) { //IL_005a: 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) FrozenPlayer frozenPlayer = null; foreach (FrozenEntry entry in entries) { if (!entry.Ended && entry is FrozenPlayer frozenPlayer2 && (Object)(object)frozenPlayer2.Collision == (Object)(object)collision) { frozenPlayer = frozenPlayer2; break; } } if (frozenPlayer == null) { return false; } if (WouldKill(collision, info)) { frozenPlayer.Break(); } else { frozenPlayer.TryPush(info); } return true; } public static bool AnyDamagingNear(Vec2 center, Fix radius, int ignoreInstanceId) { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_004c: 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) if (damageMask == -1) { damageMask = LayerMask.GetMask(new string[5] { "Projectile", "Explosion", "LethalTerrain", "Player", "orb" }); } PhysicsParent[] array = damageBuffer; int num = DetPhysics.Get().CircleCastAll(center, radius, LayerMask.op_Implicit(damageMask), ref array); for (int i = 0; i < num; i++) { FixTransform fixTrans = array[i].fixTrans; if (array[i].instanceId != ignoreInstanceId && !((Object)(object)fixTrans == (Object)null) && !fixTrans.IsDestroyed && IsDamaging(((Component)fixTrans).gameObject)) { return true; } } return false; } public static bool IsDamaging(GameObject go) { if ((Object)(object)go == (Object)null || IsFrozen(go) || IceTesla.IsInert(((Object)go).GetInstanceID()) || Icicles.IsInert(((Object)go).GetInstanceID())) { return false; } int layer = go.layer; if (layer == GameLayers.Explosion || layer == GameLayers.LethalTerrain) { if (!((Object)(object)go.GetComponent<Explosion>() != (Object)null)) { return (Object)(object)go.GetComponent<Hitbox>() != (Object)null; } return true; } if (layer == GameLayers.Projectile) { return (Object)(object)go.GetComponent<RopeHook>() == (Object)null; } if (layer == GameLayers.Orb) { Orb component = go.GetComponent<Orb>(); if ((Object)(object)component != (Object)null) { return component.killsOnContact(); } return false; } if (layer == GameLayers.Player) { Ability val = go.GetComponent<Ability>(); if ((Object)(object)val == (Object)null) { val = go.GetComponentInParent<Ability>(); } if ((Object)(object)val != (Object)null && val.KillPlayersOnContact) { return FindEntryFor(go) == null; } return false; } return false; } private static bool WouldKill(PlayerCollision victim, CollisionInformation info) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) FixTransform fixTrans = info.colliderPP.fixTrans; if ((Object)(object)fixTrans == (Object)null || fixTrans.IsDestroyed) { return false; } GameObject gameObject = ((Component)fixTrans).gameObject; if (IsFrozen(gameObject)) { return false; } int layer = gameObject.layer; int playerId = victim.GetPlayerId(); int num; bool flag; if (layer == GameLayers.Explosion || layer == GameLayers.LethalTerrain) { Explosion component = gameObject.GetComponent<Explosion>(); if ((Object)(object)component != (Object)null) { num = component.PlayerOwnerId; flag = component.canHurtOwner; BeamObject component2 = gameObject.GetComponent<BeamObject>(); int num2 = ignoredBeamIdRef.Invoke(victim); if ((Object)(object)component2 != (Object)null && num2 >= 0 && Mathf.Abs(component2.beamId) == num2) { return false; } } else { Hitbox component3 = gameObject.GetComponent<Hitbox>(); if ((Object)(object)component3 == (Object)null) { return false; } num = component3.GetPlayerId(); flag = true; } } else if (layer == GameLayers.Projectile || layer == GameLayers.Orb) { if (layer == GameLayers.Orb) { Orb component4 = gameObject.GetComponent<Orb>(); if ((Object)(object)component4 == (Object)null || !component4.killsOnContact()) { return false; } } Projectile component5 = gameObject.GetComponent<Projectile>(); if ((Object)(object)component5 != (Object)null) { num = component5.GetPlayerId(); flag = component5.canHurtOwner; } else { IPlayerIdHolder component6 = gameObject.GetComponent<IPlayerIdHolder>(); if (component6 == null) { return false; } num = component6.GetPlayerId(); flag = false; } } else { if (layer != GameLayers.Player) { return false; } Ability val = gameObject.GetComponent<Ability>(); if ((Object)(object)val == (Object)null) { val = gameObject.GetComponentInParent<Ability>(); } if ((Object)(object)val == (Object)null || !val.KillPlayersOnContact) { return false; } IPlayerIdHolder componentInParent = gameObject.GetComponentInParent<IPlayerIdHolder>(); if (componentInParent == null) { return false; } num = componentInParent.GetPlayerId(); flag = true; } return num != playerId || flag; } public static void GiveGrace(IEnumerable<PlayerCollision> collisions, Fix time) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) GraceTimer graceTimer = new GraceTimer { Remaining = time }; foreach (PlayerCollision collision in collisions) { if (!((Object)(object)collision == (Object)null) && !((MonoUpdatable)collision).IsDestroyed) { collision.SetInvulnerable(true, 2097152u); graceTimer.Collisions.Add(collision); } } if (graceTimer.Collisions.Count > 0) { graces.Add(graceTimer); } } public static void Tick(Fix dt) { //IL_0034: 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_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) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0060: 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) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_019b: 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_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: 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_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_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) bool flag = GameTime.IsTimeStopped(); Heat.EndTick(); for (int i = 0; i < entries.Count; i++) { FrozenEntry frozenEntry = entries[i]; if (frozenEntry.Ended) { continue; } if (!frozenEntry.IsValid()) { frozenEntry.EndSilently(); continue; } frozenEntry.Tick(dt, flag); if (!flag && !frozenEntry.Ended) { frozenEntry.ApplyHeat(dt); frozenEntry.Remaining -= dt; if (frozenEntry.Remaining <= Fix.Zero) { frozenEntry.OnTimeout(); } } } for (int num = entries.Count - 1; num >= 0; num--) { if (entries[num].Ended) { entries[num].AfterEnded(); entries.RemoveAt(num); } } for (int num2 = graces.Count - 1; num2 >= 0; num2--) { GraceTimer graceTimer = graces[num2]; if (!flag) { graceTimer.Remaining -= dt; } if (!(graceTimer.Remaining > Fix.Zero)) { foreach (PlayerCollision collision in graceTimer.Collisions) { if ((Object)(object)collision != (Object)null && !((MonoUpdatable)collision).IsDestroyed) { collision.SetInvulnerable(false, 2097152u); } } graces.RemoveAt(num2); } } BeamOvercharge.Tick(dt); MissileFreeze.Tick(); IcePlatforms.Tick(dt, flag); IceSurfaces.Tick(dt, flag); SnowClouds.Tick(dt, flag); IceTesla.Tick(dt, flag); Icicles.Tick(dt, flag); IcePortal.Tick(dt); FrozenBeams.Tick(); } public static void ResetAll() { IceStands.ResetAll(); foreach (FrozenEntry entry in entries) { try { if (!entry.Ended) { entry.EndSilently(); } entry.AfterEnded(); } catch (Exception ex) { Plugin.Log.LogDebug((object)("Bolum gecisinde temizlik hatasi (onemsiz): " + ex.Message)); } } entries.Clear(); graces.Clear(); skipped.Clear(); pinned.Clear(); objectsById.Clear(); BeamOvercharge.ResetAll(); MissileFreeze.ResetAll(); IcePlatforms.ResetAll(); IceSurfaces.ResetAll(); SnowClouds.ResetAll(); RopeAnchors.ResetAll(); Patch_Drill_IceSlow.ResetAll(); Patch_Drill_IceDigVisual.ResetAll(); IceRocks.ResetAll(); IceTesla.ResetAll(); FrozenBeams.ResetAll(); Icicles.ResetAll(); IceBoulders.ResetAll(); IcePortal.ResetAll(); IceCoffin.ResetAll(); Heat.ResetAll(); } } [HarmonyPatch(typeof(MonoUpdatable), "IsEnabled")] internal static class Patch_MonoUpdatable_IsEnabled { private static bool Prefix(MonoUpdatable __instance, ref bool __result) { if (!FreezeManager.HasSkips || !FreezeManager.ShouldSkip(__instance)) { return true; } __result = false; return false; } } [HarmonyPatch(typeof(PlayerBody), "IsEnabled")] internal static class Patch_PlayerBody_IsEnabled { private static bool Prefix(PlayerBody __instance, ref bool __result) { if (!FreezeManager.HasSkips || !FreezeManager.ShouldSkip((MonoUpdatable)(object)__instance)) { return true; } __result = false; return false; } } [HarmonyPatch(typeof(Arrow), "IsEnabled")] internal static class Patch_Arrow_IsEnabled { private static bool Prefix(Arrow __instance, ref bool __result) { if (!FreezeManager.HasSkips || !FreezeManager.ShouldSkip((MonoUpdatable)(object)__instance)) { return true; } __result = false; return false; } } [HarmonyPatch(typeof(DetPhysics), "PrepareCollisionCallBacks")] internal static class Patch_DetPhysics_PrepareCollisionCallBacks { private static readonly FieldRef<DetPhysics, List<CollisionInformation>> callbacksRef = AccessTools.FieldRefAccess<DetPhysics, List<CollisionInformation>>("ToMakeCallBacks"); private static bool Prefix(DetPhysics __instance, CollisionManifold manifold, IShape shapeA, IShape shapeB, PhysicsParent p1, PhysicsParent p2, Vec2 velA, Vec2 velB) { //IL_0007: 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_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_0081: 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_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_009d: 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_0138: 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_0118: 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_011c: Unknown result type (might be due to invalid IL or missing references) //IL_011e: 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_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0151: 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_0155: Unknown result type (might be due to invalid IL or missing references) if (IceTesla.HasInert && (IceTesla.IsInert(p1.instanceId) || IceTesla.IsInert(p2.instanceId))) { return false; } if (Icicles.HasInert && (Icicles.IsInert(p1.instanceId) || Icicles.IsInert(p2.instanceId))) { return false; } if (IceBoulders.HasGhosts && (IceBoulders.IsGhost(p1.instanceId) || IceBoulders.IsGhost(p2.instanceId))) { PhysicsParent val = (IceBoulders.IsGhost(p1.instanceId) ? p2 : p1); if ((Object)(object)val.fixTrans != (Object)null && !val.fixTrans.IsDestroyed && (Object)(object)((Component)val.fixTrans).GetComponent<SpikeAttack>() != (Object)null) { return false; } } if (!FreezeManager.HasFrozenObjects) { return true; } FrozenObject frozenObject = FreezeManager.FindObjectById(p1.instanceId); FrozenObject frozenObject2 = FreezeManager.FindObjectById(p2.instanceId); if (frozenObject == null && frozenObject2 == null) { return true; } frozenObject?.OnContact(p2); frozenObject2?.OnContact(p1); if (frozenObject != null && frozenObject2 == null && frozenObject.Hookable && RopeAnchors.IsHook(p2)) { callbacksRef.Invoke(__instance).Add(Info(manifold, shapeA, velA, p1, p2)); } else if (frozenObject2 != null && frozenObject == null && frozenObject2.Hookable && RopeAnchors.IsHook(p1)) { callbacksRef.Invoke(__instance).Add(Info(manifold, shapeB, velB, p2, p1)); } return false; } private static CollisionInformation Info(CollisionManifold manifold, IShape otherShape, Vec2 otherVelocity, PhysicsParent other, PhysicsParent receiver) { //IL_0002: 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_0013: 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_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0034: 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_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_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_004f: 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_0058: 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) return new CollisionInformation { collider = otherShape, colliderImpactVelocity = otherVelocity, contactPoint = manifold.contactPoint, layer = otherShape.Layer(), normal = manifold.normal, penetration = manifold.penetration, colliderPP = other, pp = receiver }; } } [HarmonyPatch(typeof(DetPhysics), "Simulate")] internal static class Patch_DetPhysics_Simulate { private static void Prefix() { FreezeManager.PinBodies(); } } [HarmonyPatch(typeof(BlackHole), "Grow")] internal static class Patch_BlackHole_Grow { private static void Prefix(BlackHole __instance, ref Fix inverseMass, ref Fix extra) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: 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_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0058: 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_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_002d: 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_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0081: 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_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_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) Fix pinnedInverseMassLimit = PhysicsUtil.PinnedInverseMassLimit; if (inverseMass != Fix.Zero && inverseMass < pinnedInverseMassLimit && inverseMass > -pinnedInverseMassLimit) { inverseMass = Fix.One; } Fix boost = RayBounce.Boost; if (boost != Fix.One && inverseMass != Fix.Zero) { extra += (boost - Fix.One) * (Fix.One / inverseMass + __instance.baseGrowth); } } } [HarmonyPatch(typeof(Updater), "TickSimulation")] internal static class Patch_Updater_TickSimulation { private static void Postfix(Fix deltaTime) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) FreezeManager.Tick(deltaTime); } } [HarmonyPatch(typeof(Updater), "PreLevelLoad")] internal static class Patch_Updater_PreLevelLoad { private static void Postfix() { FreezeManager.ResetAll(); } } [HarmonyPatch(typeof(SlimeController), "OnCollide")] internal static class Patch_SlimeController_OnCollide { private static bool Prefix(SlimeController __instance) { if (FreezeManager.HasSkips) { return !FreezeManager.ShouldSkip((MonoUpdatable)(object)__instance); } return true; } } [HarmonyPatch(typeof(PlayerCollision), "KillPlayerOnCollision")] internal static class Patch_PlayerCollision_KillPlayerOnCollision { private static readonly FieldRef<PlayerCollision, PlayerPhysics> physicsRef = AccessTools.FieldRefAccess<PlayerCollision, PlayerPhysics>("physics"); private static bool Prefix(PlayerCollision __instance, CollisionInformation collision, ref bool __result) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) GameLayers.Init(); if (IceBoulders.HasGhosts && collision.layer == GameLayers.Wall && IsGhostSquish(__instance, collision)) { __result = false; return false; } if (!FreezeManager.TryHandleFrozenPlayerCollision(__instance, collision)) { return true; } __result = false; return false; } private static bool IsGhostSquish(PlayerCollision player, CollisionInformation collision) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: 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) if (IceBoulders.IsGhost(collision.colliderPP.instanceId)) { return true; } PlayerPhysics val = physicsRef.Invoke(player); StickyRoundedRectangle val2 = (((Object)(object)val != (Object)null && val.IsGrounded()) ? val.getAttachedGround() : null); if ((Object)(object)val2 != (Object)null && !((MonoUpdatable)val2).IsDestroyed && (Object)(object)val2.rr != (Object)null) { return IceBoulders.IsGhost(val2.rr.GetPhysicsParent().instanceId); } return false; } } internal static class FreezeRayAbility { public const string AbilityName = "Freeze ray"; public static void Register() { //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) AbilityRegistry.Add(new CustomAbility { Name = "Freeze ray", IconFile = "FreezeRay.png", PlaceholderColor = new Color(0.15f, 0.45f, 1f), IsTemplate = (NamedSprite entry) => (Object)(object)entry.associatedGameObject.GetComponent<ShootScaleChange>() != (Object)null, Setup = SetupTemplate, Translations = { [(Language)11] = "dondurucu ışın" } }); } private static void SetupTemplate(GameObject template, NamedSprite source) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_005f: 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_00a1: Unknown result type (might be due to invalid IL or missing references) ShootScaleChange component = template.GetComponent<ShootScaleChange>(); FreezeRayAssets.CollisionMask = component.collisionMask; FreezeRayAssets.CollisionMaskNoWater = component.collisionMaskNoWater; FreezeRayAssets.WaterRing = component.WaterRing; FreezeRayAssets.RayParticlePrefab = component.RaycastParticlePrefab; FreezeRayAssets.RayHitParticlePrefab = component.RaycastParticleHitPrefab; IceArt.Warmup(); Object.DestroyImmediate((Object)(object)component); template.AddComponent<FreezeRayGun>(); Ability component2 = template.GetComponent<Ability>(); if ((Object)(object)component2 != (Object)null) { component2.Cooldown = FreezeTuning.Cooldown; } Plugin.Log.LogInfo((object)("Freeze ray: bekleme suresi " + (((Object)(object)component2 != (Object)null) ? ((float)component2.Cooldown).ToString("0.##") : "?") + " sn, isin maskesi " + LayerList(FreezeRayAssets.CollisionMask))); } private static string LayerList(LayerMask mask) { List<string> list = new List<string>(); for (int i = 0; i < 32; i++) { if ((((LayerMask)(ref mask)).value & (1 << i)) != 0) { list.Add(LayerMask.LayerToName(i)); } } return string.Join("/", list); } } internal static class FreezeRayAssets { public static LayerMask CollisionMask; public static LayerMask CollisionMaskNoWater; public static GameObject WaterRing; public static ParticleSystem RayParticlePrefab; public static ParticleSystem RayHitParticlePrefab; } public class FreezeRayGun : MonoBehaviour, IGun { private struct SmokeOnPath { public Fix Along; public FlammableSmoke Smoke; } private static readonly Fix MaxDistance = (Fix)100L; private ParticleSystem rayParticle; private ParticleSystem rayParticleChild; private ParticleSystem hitParticle; private float rayDensity; private float rayDensityChild; private static int smokeLayer = -2; private static readonly List<SmokeOnPath> smokesOnPath = new List<SmokeOnPath>(); private void Awake() { if ((Object)(object)FreezeRayAssets.RayParticlePrefab != (Object)null) { rayParticle = Object.Instantiate<ParticleSystem>(FreezeRayAssets.RayParticlePrefab); IceRayColors.MakeIcy(rayParticle); rayParticleChild = ((((Component)rayParticle).transform.childCount > 0) ? ((Component)((Component)rayParticle).transform.GetChild(0)).GetComponent<ParticleSystem>() : null); rayDensity = Density(rayParticle); rayDensityChild = (((Object)(object)rayParticleChild != (Object)null) ? Density(rayParticleChild) : 0f); } if ((Object)(object)FreezeRayAssets.RayHitParticlePrefab != (Object)null) { hitParticle = Object.Instantiate<ParticleSystem>(FreezeRayAssets.RayHitParticlePrefab); IceRayColors.MakeIcy(hitParticle); } } private static float Density(ParticleSystem ps) { //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_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0025: 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_002d: Unknown result type (might be due to invalid IL or missing references) EmissionModule emission = ps.emission; Burst burst = ((EmissionModule)(ref emission)).GetBurst(0); MinMaxCurve count = ((Burst)(ref burst)).count; float constant = ((MinMaxCurve)(ref count)).constant; ShapeModule shape = ps.shape; return constant / Mathf.Max(0.0001f, ((ShapeModule)(ref shape)).scale.x); } private void OnDestroy() { if ((Object)(object)rayParticle != (Object)null) { Object.Destroy((Object)(object)((Component)rayParticle).gameObject); } if ((Object)(object)hitParticle != (Object)null) { Object.Destroy((Object)(object)((Component)hitParticle).gameObject); } } public void Shoot(Vec2 firepointFIX, Vec2 directionFIX, ref bool hasFired, int playerId, bool alreadyHitWater = false) { //IL_0005: 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_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_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_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: 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_004b: Unknown result type (might be due to invalid IL or missing references) //IL_004c: 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_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: 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_005e: 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_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: 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_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0081: 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_0090: 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_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00de: 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_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: 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_00f7: 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_010d: 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_0111: Unknown result type (might be due to invalid IL or missing references) //IL_011c: 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_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0123: 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_012f: 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_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be du