Due to update 2.4.3, some mods may no longer function. FixedConfig may be necessary.
Decompiled source of BoplGooSwap v0.4.1
BoplGooSwap.dll
Decompiled 8 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.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using BoplFixedMath; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.Events; using UnityEngine.InputSystem; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyCompany("BoplGooSwap")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Adds the Grapple Goo, Swap Shot and Mirror abilities to Bopl Battle.")] [assembly: AssemblyFileVersion("0.4.1.0")] [assembly: AssemblyInformationalVersion("0.4.1")] [assembly: AssemblyProduct("BoplGooSwap")] [assembly: AssemblyTitle("BoplGooSwap")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.4.1.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace BoplGooSwap { [HarmonyPatch(typeof(AbilityGrid), "Update")] internal static class Patch_AbilityGrid_Scroll { private const float TopOffset = 122f; private static readonly Dictionary<int, int> TopRow = new Dictionary<int, int>(); private static bool _logged; private static void Postfix(AbilityGrid __instance, AbilityGridEntry[] ___grid, RectTransform ___recTrans, float ___entrySize, int ___rows, int ___y) { //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) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Unknown result type (might be due to invalid IL or missing references) try { if (___grid == null || ___grid.Length == 0 || (Object)(object)___recTrans == (Object)null || ___entrySize <= 1f) { return; } int num = Mathf.Max(1, __instance.columns); Rect rect = ___recTrans.rect; float height = ((Rect)(ref rect)).height; int num2 = Mathf.Max(3, Mathf.FloorToInt((height - 122f) / ___entrySize)); bool flag = ___rows > num2; int instanceID = ((Object)__instance).GetInstanceID(); TopRow.TryGetValue(instanceID, out var value); if (!_logged) { _logged = true; Plugin.Log.LogInfo((object)$"Ability menu: {___grid.Length} icons, {___rows} rows, {num2} fit, panel height {height}, icon size {___entrySize}."); } if (flag) { Mouse current = Mouse.current; float num3 = ((current != null) ? ((InputControl<Vector2>)(object)current.scroll).ReadValue().y : 0f); if (Mathf.Abs(num3) > 0.01f) { value += ((!(num3 > 0f)) ? 1 : (-1)); value = Mathf.Clamp(value, 0, ___rows - num2); int num4 = __instance.SelectedIcon / num; int num5 = Mathf.Clamp(num4, value, value + num2 - 1); if (num5 != num4) { int num6 = __instance.SelectedIcon % num; __instance.SelectedIcon = Mathf.Min(num5 * num + num6, ___grid.Length - 1); } } int num7 = __instance.SelectedIcon / num; if (num7 < value) { value = num7; } else if (num7 >= value + num2) { value = num7 - num2 + 1; } value = Mathf.Clamp(value, 0, ___rows - num2); } else { value = 0; } TopRow[instanceID] = value; for (int i = 0; i < ___grid.Length; i++) { AbilityGridEntry val = ___grid[i]; if (!((Object)(object)val == (Object)null)) { int num8 = i / num; bool flag2 = num8 >= value && num8 < value + num2; if (((Component)val).gameObject.activeSelf != flag2) { ((Component)val).gameObject.SetActive(flag2); } Vector2 anchoredPosition = val.rectTrans.anchoredPosition; anchoredPosition.y = height / 2f - 122f - (float)(num8 - value) * ___entrySize; val.rectTrans.anchoredPosition = anchoredPosition; } } AbilityGridEntry val2 = ___grid[Mathf.Clamp(__instance.SelectedIcon, 0, ___grid.Length - 1)]; if ((Object)(object)__instance.selectionCircle != (Object)null && (Object)(object)val2 != (Object)null) { __instance.selectionCircle.anchoredPosition = val2.rectTrans.anchoredPosition; } } catch (Exception arg) { Plugin.Log.LogError((object)$"Ability menu scroll failed: {arg}"); } } } internal static class AbilityRegistry { private enum Base { Teleport, Grenade, Spike } private sealed class AbilityDef { public string Name; public Base From; public Type CasterType; public Fix Cooldown; public bool Offensive; public Func<Sprite, Sprite> MakeIcon; public GameObject Prefab; public Sprite Icon; } private static readonly List<AbilityDef> Defs = new List<AbilityDef> { new AbilityDef { Name = "Grapple Goo", From = Base.Grenade, CasterType = null, Cooldown = Fix.Zero, Offensive = false, MakeIcon = IconFactory.MakeGooIcon }, new AbilityDef { Name = "Wall", From = Base.Spike, CasterType = null, Cooldown = Tuning.WallCooldown, Offensive = false, MakeIcon = IconFactory.MakeWallIcon }, new AbilityDef { Name = "Swap Shot", From = Base.Teleport, CasterType = typeof(SwapShotCaster), Cooldown = Tuning.SwapCooldown, Offensive = true, MakeIcon = IconFactory.MakeSwapIcon }, new AbilityDef { Name = "Mirror", From = Base.Teleport, CasterType = typeof(MirrorCaster), Cooldown = Tuning.MirrorCooldown, Offensive = false, MakeIcon = IconFactory.MakeMirrorIcon } }; private static GameObject _holder; private static bool _built; private static readonly HashSet<int> _dumpedLists = new HashSet<int>(); private static Material _spriteMaterial; public static void EnsureRegistered() { //IL_005a: 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_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) try { NamedSpriteList[] array = Resources.FindObjectsOfTypeAll<NamedSpriteList>(); if (array == null || array.Length == 0) { return; } GameObject val = null; Sprite refSprite = null; GameObject val2 = null; Sprite grenadeRef = null; GameObject val3 = null; Sprite spikeRef = null; GameObject val4 = null; NamedSpriteList[] array2 = array; foreach (NamedSpriteList val5 in array2) { if (!LooksLikeAbilityList(val5)) { continue; } DumpOnce(val5); for (int j = 0; j < val5.sprites.Count; j++) { GameObject associatedGameObject = val5.sprites[j].associatedGameObject; if (!((Object)(object)associatedGameObject == (Object)null)) { if ((Object)(object)val == (Object)null && (Object)(object)associatedGameObject.GetComponent<Teleport>() != (Object)null && (Object)(object)associatedGameObject.GetComponent<InstantAbility>() != (Object)null) { val = associatedGameObject; refSprite = val5.sprites[j].sprite; } if ((Object)(object)val2 == (Object)null && IsRealGrenade(associatedGameObject)) { val2 = associatedGameObject; grenadeRef = val5.sprites[j].sprite; } if ((Object)(object)val4 == (Object)null && (Object)(object)associatedGameObject.GetComponent<ShootDuplicator>() != (Object)null) { val4 = associatedGameObject; } if ((Object)(object)val3 == (Object)null && (Object)(object)associatedGameObject.GetComponent<Spike>() != (Object)null && (Object)(object)associatedGameObject.GetComponent<Ability>() != (Object)null) { val3 = associatedGameObject; spikeRef = val5.sprites[j].sprite; } } } } if (!_built) { if ((Object)(object)val == (Object)null || (Object)(object)val2 == (Object)null || (Object)(object)val3 == (Object)null || (Object)(object)val4 == (Object)null) { return; } BuildPrefabs(val, refSprite, val2, grenadeRef, val3, spikeRef, val4); } if (!_built) { return; } array2 = array; foreach (NamedSpriteList val6 in array2) { if (!LooksLikeAbilityList(val6)) { continue; } foreach (AbilityDef def in Defs) { if (val6.IndexOf(def.Name) < 0) { val6.sprites.Add(new NamedSprite(def.Name, def.Icon, def.Prefab, def.Offensive)); Plugin.Log.LogInfo((object)$"Added '{def.Name}' to ability list '{((Object)val6).name}' (now {val6.sprites.Count} entries)."); } } } } catch (Exception arg) { Plugin.Log.LogError((object)$"AbilityRegistry.EnsureRegistered failed: {arg}"); } } private static bool LooksLikeAbilityList(NamedSpriteList list) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)list == (Object)null || list.sprites == null || list.sprites.Count < 4) { return false; } for (int i = 0; i < list.sprites.Count; i++) { GameObject associatedGameObject = list.sprites[i].associatedGameObject; if ((Object)(object)associatedGameObject != (Object)null && (Object)(object)associatedGameObject.GetComponent<AbilityMonoBehaviour>() != (Object)null) { return true; } } return false; } private static bool IsRealGrenade(GameObject prefab) { ThrowItem2 component = prefab.GetComponent<ThrowItem2>(); if ((Object)(object)component != (Object)null && (Object)(object)prefab.GetComponent<Ability>() != (Object)null && (Object)(object)component.ItemPrefab != (Object)null) { return (Object)(object)((Component)component.ItemPrefab).GetComponent<GrenadeExplode>() != (Object)null; } return false; } private static void BuildPrefabs(GameObject basePrefab, Sprite refSprite, GameObject grenadePrefab, Sprite grenadeRef, GameObject spikePrefab, Sprite spikeRef, GameObject duplicatorPrefab) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown if ((Object)(object)_holder == (Object)null) { _holder = new GameObject("BoplGooSwap.PrefabHolder"); _holder.SetActive(false); Object.DontDestroyOnLoad((Object)(object)_holder); ((Object)_holder).hideFlags = (HideFlags)61; } foreach (AbilityDef def in Defs) { if (!((Object)(object)def.Prefab != (Object)null)) { if (def.From == Base.Grenade) { def.Icon = def.MakeIcon(grenadeRef); def.Prefab = BuildGrenadeThrowPrefab(def, grenadePrefab); } else if (def.From == Base.Spike) { def.Icon = def.MakeIcon(spikeRef); def.Prefab = BuildSpikeWallPrefab(def, spikePrefab, duplicatorPrefab); } else { def.Icon = def.MakeIcon(refSprite); def.Prefab = BuildPrefab(def, basePrefab); } } } _built = true; Plugin.Log.LogInfo((object)"Built ability prefabs from the Teleport, Grenade and Spike abilities."); } private static GameObject BuildPrefab(AbilityDef def, GameObject basePrefab) { //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Expected O, but got Unknown //IL_00ed: Unknown result type (might be due to invalid IL or missing references) GameObject val = Object.Instantiate<GameObject>(basePrefab, _holder.transform); ((Object)val).name = def.Name; MonoBehaviour[] components = val.GetComponents<MonoBehaviour>(); foreach (MonoBehaviour val2 in components) { if (!((Object)(object)val2 == (Object)null) && !(val2 is FixTransform) && !(val2 is InstantAbility)) { try { Object.DestroyImmediate((Object)(object)val2); } catch (Exception ex) { Plugin.Log.LogWarning((object)("Could not remove " + ((object)val2).GetType().Name + " from '" + def.Name + "' clone: " + ex.Message)); } } } InstantAbility component = val.GetComponent<InstantAbility>(); component.funcOnEnter = new UnityEvent(); component.EffectOnEnter = null; component.AudioOnCast = string.Empty; component.isHookshot = false; component.isInvisibilty = false; component.cooldownStoppedDuringTimeStop = false; ((AbilityMonoBehaviour)component).OnlyCastableOnGround = false; component.SetCoolDown(def.Cooldown); val.AddComponent(def.CasterType); return val; } private static GameObject BuildGrenadeThrowPrefab(AbilityDef def, GameObject grenadeAbility) { GameObject val = Object.Instantiate<GameObject>(grenadeAbility, _holder.transform); ((Object)val).name = def.Name; ThrowItem2 component = val.GetComponent<ThrowItem2>(); component.isExplosiveGrenade = false; if (val.transform.childCount > 1) { SpriteRenderer componentInChildren = ((Component)val.transform.GetChild(1)).GetComponentInChildren<SpriteRenderer>(true); if ((Object)(object)componentInChildren != (Object)null) { componentInChildren.sprite = IconFactory.MakeSlimeballHeld(componentInChildren.sprite); ((Renderer)componentInChildren).sharedMaterial = SpriteMaterial(((Renderer)componentInChildren).sharedMaterial); } } component.ItemPrefab = BuildSlimeball(component.ItemPrefab); val.AddComponent<ThrowDummyTint>(); return val; } private static GameObject BuildSpikeWallPrefab(AbilityDef def, GameObject spikeAbility, GameObject duplicatorAbility) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) GameObject obj = Object.Instantiate<GameObject>(spikeAbility, _holder.transform); ((Object)obj).name = def.Name; obj.GetComponent<Ability>().Cooldown = def.Cooldown; Spike component = obj.GetComponent<Spike>(); SetPrivate(component, "castForce", Fix.Zero); SetPrivate(component, "trauma", 0.12f); obj.AddComponent<WallMarker>(); ShootDuplicator val = (((Object)(object)duplicatorAbility != (Object)null) ? duplicatorAbility.GetComponent<ShootDuplicator>() : null); Boulder val2 = (((Object)(object)val != (Object)null) ? val.boulderPrefab : null); if ((Object)(object)val2 == (Object)null) { Plugin.Log.LogError((object)"Wall: could not find the Duplicator's boulder platform to copy."); return obj; } WallPrefab.Prefab = BuildWallPlatform(val2); return obj; } private static GameObject BuildWallPlatform(Boulder boulder) { //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_005f: 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_0074: 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_008a: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: 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_00f2: 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_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_013c: 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_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) GameObject val = Object.Instantiate<GameObject>(((Component)boulder).gameObject, _holder.transform); ((Object)val).name = "WallPlatform"; Boulder component = val.GetComponent<Boulder>(); if ((Object)(object)component != (Object)null) { Object.DestroyImmediate((Object)(object)component); } DPhysicsRoundedRect component2 = val.GetComponent<DPhysicsRoundedRect>(); FixTransform component3 = val.GetComponent<FixTransform>(); Vec2 val2 = component2.CalcExtents(); Plugin.Log.LogInfo((object)$"Wall: the boulder platform had half-extents ({(float)val2.x}, {(float)val2.y}), radius {(float)component2.radius}, offset ({(float)component3.offset.x}, {(float)component3.offset.y}), scale {val.transform.localScale}."); component2.manuallyCallInit = true; component2.radius = Tuning.WallCorner; component2.SetExtents(new Vec2(Tuning.WallHalfWidth - Tuning.WallCorner, Tuning.WallHalfHeight - Tuning.WallCorner)); component3.offset = Vec2.zero; BoplBody component4 = val.GetComponent<BoplBody>(); SetPrivate(component4, "mass", Fix.Zero); SetPrivate(component4, "momentOfInertia", Fix.Zero); component4.gravityScale = Fix.Zero; component4.StartVelocity = Vec2.zero; component4.StartAngularVelocity = Fix.Zero; val.AddComponent<WallVisual>(); return val; } private static void SetPrivate(object target, string field, object value) { try { FieldInfo fieldInfo = AccessTools.Field(target.GetType(), field); if (fieldInfo == null) { Plugin.Log.LogWarning((object)("Wall: field '" + field + "' not found on " + target.GetType().Name + ".")); } else { fieldInfo.SetValue(target, value); } } catch (Exception ex) { Plugin.Log.LogWarning((object)("Wall: could not set '" + field + "': " + ex.Message)); } } private static T GetPrivate<T>(object target, string field) where T : class { try { FieldInfo fieldInfo = AccessTools.Field(target.GetType(), field); return (fieldInfo != null) ? (fieldInfo.GetValue(target) as T) : null; } catch (Exception) { return null; } } private static BoplBody BuildSlimeball(BoplBody grenadeProjectile) { //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) GameObject val = Object.Instantiate<GameObject>(((Component)grenadeProjectile).gameObject, _holder.transform); ((Object)val).name = "GooSlimeball"; SpriteRenderer component = val.GetComponent<SpriteRenderer>(); if ((Object)(object)component != (Object)null) { component.sprite = IconFactory.MakeSlimeballThrown(component.sprite); ((Renderer)component).sharedMaterial = SpriteMaterial(((Renderer)component).sharedMaterial); component.color = Color.white; } for (int i = 0; i < val.transform.childCount; i++) { ((Component)val.transform.GetChild(i)).gameObject.SetActive(false); } Grenade component2 = val.GetComponent<Grenade>(); if ((Object)(object)component2 != (Object)null) { component2.timedExplosion = true; component2.detonationTime = Tuning.SlimeballLifetime; } val.AddComponent<Slimeball>(); return val.GetComponent<BoplBody>(); } private static Material SpriteMaterial(Material fallback) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown try { if ((Object)(object)_spriteMaterial == (Object)null) { Shader val = Shader.Find("Sprites/Default"); if ((Object)(object)val != (Object)null) { _spriteMaterial = new Material(val) { hideFlags = (HideFlags)61 }; } } } catch (Exception) { } if (!((Object)(object)_spriteMaterial != (Object)null)) { return fallback; } return _spriteMaterial; } private static void DumpOnce(NamedSpriteList list) { //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: 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_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) if (Plugin.DumpAbilityList == null || !Plugin.DumpAbilityList.Value || !_dumpedLists.Add(((Object)list).GetInstanceID())) { return; } try { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine($"Ability list '{((Object)list).name}' has {list.sprites.Count} entries:"); for (int i = 0; i < list.sprites.Count; i++) { NamedSprite val = list.sprites[i]; stringBuilder.Append(" [").Append(i).Append("] '") .Append(val.name) .Append("'"); stringBuilder.Append(val.isOffensiveAbility ? " (offensive)" : ""); if ((Object)(object)val.associatedGameObject == (Object)null) { stringBuilder.AppendLine(" prefab: <none>"); continue; } stringBuilder.Append(" prefab: ").Append(((Object)val.associatedGameObject).name).Append(" components: "); Component[] components = val.associatedGameObject.GetComponents<Component>(); for (int j = 0; j < components.Length; j++) { if (!((Object)(object)components[j] == (Object)null)) { stringBuilder.Append(((object)components[j]).GetType().Name); if (j < components.Length - 1) { stringBuilder.Append(", "); } } } stringBuilder.AppendLine(); } Plugin.Log.LogInfo((object)stringBuilder.ToString()); } catch (Exception ex) { Plugin.Log.LogWarning((object)("Could not dump ability list: " + ex.Message)); } } } internal static class Sfx { public static void Play(string sound) { try { AudioManager.Get().Play(sound); } catch (Exception) { } } } internal static class PlayerTint { public static Color Get(int playerId) { //IL_00d6: 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_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_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) Color result = default(Color); ((Color)(ref result))..ctor(0.45f, 0.9f, 0.35f, 1f); try { Player player = PlayerHandler.Get().GetPlayer(playerId); Material val = ((player != null) ? player.Color : null); if ((Object)(object)val != (Object)null && val.HasProperty("_ShadowColor")) { if (((Object)val).name.StartsWith("blackSlime")) { return new Color(0.85f, 0.85f, 0.85f, 1f); } float num = default(float); float num2 = default(float); float num3 = default(float); Color.RGBToHSV(val.GetColor("_ShadowColor"), ref num, ref num2, ref num3); if (num2 > 0.15f) { num2 = Mathf.Max(num2, 0.6f); } num3 = Mathf.Max(num3, 0.85f); result = Color.HSVToRGB(num, num2, num3); result.a = 1f; } } catch (Exception) { } return result; } } internal sealed class Slimeball : MonoBehaviour { private Item _item; private IPhysicsCollider _hitbox; private SpriteRenderer _renderer; private bool _done; private bool _tinted; private GameObject _shine; private Vector3 _lastDropPos; private static int _wallLayer = int.MinValue; private static int _waterLayer = int.MinValue; private void Awake() { //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_0080: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Expected O, but got Unknown if (_wallLayer == int.MinValue) { _wallLayer = LayerMask.NameToLayer("wall"); _waterLayer = LayerMask.NameToLayer("Water"); } _item = ((Component)this).GetComponent<Item>(); _hitbox = ((Component)this).GetComponent<IPhysicsCollider>(); _renderer = ((Component)this).GetComponent<SpriteRenderer>(); _lastDropPos = ((Component)this).transform.position; if ((Object)(object)_renderer != (Object)null && (Object)(object)IconFactory.SlimeballShineSprite != (Object)null) { _shine = new GameObject("SlimeballShine"); SpriteRenderer obj = _shine.AddComponent<SpriteRenderer>(); obj.sprite = IconFactory.SlimeballShineSprite; ((Renderer)obj).sharedMaterial = ((Renderer)_renderer).sharedMaterial; ((Renderer)obj).sortingLayerID = ((Renderer)_renderer).sortingLayerID; ((Renderer)obj).sortingOrder = ((Renderer)_renderer).sortingOrder + 1; } } private void OnDestroy() { if ((Object)(object)_shine != (Object)null) { Object.Destroy((Object)(object)_shine); } } private void Update() { //IL_0063: 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_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: 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_00ed: Unknown result type (might be due to invalid IL or missing references) if (!_tinted && (Object)(object)_item != (Object)null && (Object)(object)_renderer != (Object)null) { _renderer.color = PlayerTint.Get(_item.OwnerId); _tinted = true; } if (!_done && !((Object)(object)_renderer == (Object)null)) { float num = Mathf.Abs(((Component)this).transform.lossyScale.x); Vector3 val = ((Component)this).transform.position - _lastDropPos; if (((Vector3)(ref val)).sqrMagnitude > 0.16000001f * num * num) { _lastDropPos = ((Component)this).transform.position; SlimeDrop.Spawn(((Component)this).transform.position, new Vector2(Random.Range(-0.6f, 0.6f), Random.Range(-0.4f, 0.3f)), 0.45f * num, 0.45f, _renderer.color, _renderer); } } } private void LateUpdate() { //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_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_shine == (Object)null)) { bool flag = (Object)(object)_renderer != (Object)null && ((Renderer)_renderer).enabled && ((Component)this).gameObject.activeInHierarchy; _shine.SetActive(flag); if (flag) { Vector3 lossyScale = ((Component)this).transform.lossyScale; _shine.transform.SetPositionAndRotation(((Component)this).transform.position, Quaternion.identity); _shine.transform.localScale = new Vector3(Mathf.Abs(lossyScale.x), Mathf.Abs(lossyScale.y), 1f); } } } public void HandleCollision(CollisionInformation collision) { //IL_0009: 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_0016: 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) if (_done) { return; } if (collision.layer == _wallLayer) { FixTransform fixTrans = collision.colliderPP.fixTrans; if (!((Object)(object)fixTrans == (Object)null) && !fixTrans.IsDestroyed) { StickyRoundedRectangle component = ((Component)fixTrans).GetComponent<StickyRoundedRectangle>(); if (!((Object)(object)component == (Object)null)) { Splat(component); } } } else if (collision.layer == _waterLayer) { Fizzle(); } } private void Splat(StickyRoundedRectangle platform) { //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_0014: 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_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_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003c: 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_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_0050: 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_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) _done = true; Vec2 position = _hitbox.position; Vec2 closestPoint = platform.GetClosestPoint(position); Fix radius = Tuning.GooRadius * _hitbox.Scale; Color val = PlayerTint.Get(_item.OwnerId); GooManager.AddPatch(_item.OwnerId, platform, closestPoint, radius, val); Sfx.Play("slimeLand"); Vec2 val2 = platform.currentNormal(closestPoint); Vector2 val3 = default(Vector2); ((Vector2)(ref val3))..ctor((float)val2.x, (float)val2.y); float num = Mathf.Abs(((Component)this).transform.lossyScale.x); for (int i = 0; i < 9; i++) { Vector2 val4 = new Vector2(0f - val3.y, val3.x) * Random.Range(-5f, 5f); Vector2 velocity = val3 * Random.Range(3f, 9f) + val4; SlimeDrop.Spawn((Vector3)closestPoint, velocity, Random.Range(0.2f, 0.45f) * num, 0.6f, val, _renderer); } Updater.DestroyFix(((Component)this).gameObject); } public void Fizzle() { if (!_done) { _done = true; Updater.DestroyFix(((Component)this).gameObject); } } } internal sealed class ThrowDummyTint : MonoBehaviour { private void OnEnable() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0044: 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) try { Ability component = ((Component)this).GetComponent<Ability>(); if (!((Object)(object)component == (Object)null) && ((Component)this).transform.childCount >= 2) { PlayerInfo playerInfo = component.GetPlayerInfo(); SpriteRenderer componentInChildren = ((Component)((Component)this).transform.GetChild(1)).GetComponentInChildren<SpriteRenderer>(true); if ((Object)(object)componentInChildren != (Object)null) { componentInChildren.color = PlayerTint.Get(playerInfo.playerId); } } } catch (Exception) { } } } internal sealed class GooPatch { public int OwnerId; public StickyRoundedRectangle Platform; public Fix LocalPos; public Fix Radius; public Color Tint; public GameObject Visual; public SpriteRenderer VisualRenderer; public Vec2 WorldPoint() { //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_0011: Unknown result type (might be due to invalid IL or missing references) return Platform.PositionFromLocalPlayerPos(LocalPos, Fix.Zero); } } internal sealed class GooShot { public int OwnerId; public StickyRoundedRectangle Platform; public Fix LocalPos; public Fix Radius; public Color Tint; public Fix Remaining; public Fix Total; public Vector2 Start; public float Arc; public Vector2 LastDrip; public GameObject Visual; public SpriteRenderer VisualRenderer; } internal sealed class GooManager : MonoUpdatable { private static readonly List<GooPatch> Patches = new List<GooPatch>(); private static GooManager _instance; private static readonly PhysicsParent[] DragBuffer = (PhysicsParent[])(object)new PhysicsParent[64]; private static readonly HashSet<int> _alreadyDragged = new HashSet<int>(); private static PhysicsParent[] _dragBufferRef = DragBuffer; private static int _dragMask = int.MinValue; private static readonly Vec2[] SprayDirections = (Vec2[])(object)new Vec2[8] { new Vec2((Fix)1L, Fix.Zero), new Vec2((Fix)(-1L), Fix.Zero), new Vec2(Fix.Zero, (Fix)1L), new Vec2(Fix.Zero, (Fix)(-1L)), new Vec2((Fix)0.7071f, (Fix)0.7071f), new Vec2((Fix)(-0.7071f), (Fix)0.7071f), new Vec2((Fix)0.7071f, (Fix)(-0.7071f)), new Vec2((Fix)(-0.7071f), (Fix)(-0.7071f)) }; private static readonly List<GooShot> Shots = new List<GooShot>(); public static void AddPatch(int ownerId, StickyRoundedRectangle platform, Vec2 worldPoint, Fix radius, Color tint) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_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_0042: 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_004a: Unknown result type (might be due to invalid IL or missing references) EnsureInstance(); while (Patches.Count >= 60) { RemoveAt(0); } GooPatch gooPatch = new GooPatch { OwnerId = ownerId, Platform = platform, LocalPos = platform.LocalPlayerPosFromPos(worldPoint, Fix.Zero), Radius = radius, Tint = tint }; CreateVisual(gooPatch); Patches.Add(gooPatch); } public static Fix SlowFactor(PlayerPhysics physics) { //IL_001d: 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_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_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_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: 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_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) if (Patches.Count == 0 || (Object)(object)physics == (Object)null || !physics.IsGrounded()) { return Fix.One; } StickyRoundedRectangle attachedGround = physics.getAttachedGround(); PlayerBody playerBody = physics.GetPlayerBody(); if ((Object)(object)attachedGround == (Object)null || ((MonoUpdatable)attachedGround).IsDestroyed || (Object)(object)playerBody == (Object)null) { return Fix.One; } Vec2 closestPoint = attachedGround.GetClosestPoint(playerBody.position); Fix val = Fix.One; for (int i = 0; i < Patches.Count; i++) { GooPatch gooPatch = Patches[i]; if (!((Object)(object)gooPatch.Platform != (Object)(object)attachedGround) && Vec2.SqrMagnitude(gooPatch.WorldPoint() - closestPoint) <= gooPatch.Radius * gooPatch.Radius) { val = Fix.Min(val, Tuning.GooSlowMultiplier); } } return val; } private static void EnsureInstance() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_instance != (Object)null) || ((MonoUpdatable)_instance).IsDestroyed) { Updater.BeginRegisterPrefab(); _instance = new GameObject("BoplGooSwap.GooManager").AddComponent<GooManager>(); Updater.EndRegisterPrefab(); } } public static void ResetAll() { for (int num = Patches.Count - 1; num >= 0; num--) { DestroyVisual(Patches[num]); } Patches.Clear(); for (int num2 = Shots.Count - 1; num2 >= 0; num2--) { DestroyShotVisual(Shots[num2]); } Shots.Clear(); _instance = null; } private static void RemoveAt(int index) { DestroyVisual(Patches[index]); Patches.RemoveAt(index); } private void Awake() { Updater.RegisterUpdatable((MonoUpdatable)(object)this); } public override void Init() { } public override void UpdateSim(Fix simDeltaTime) { //IL_004b: Unknown result type (might be due to invalid IL or missing references) if (GameTime.IsTimeStopped()) { return; } _alreadyDragged.Clear(); for (int num = Patches.Count - 1; num >= 0; num--) { GooPatch p = Patches[num]; if (IsPlatformGone(p)) { RemoveAt(num); } else { DragProjectiles(p); } } UpdateShots(simDeltaTime); } private static bool IsPlatformGone(GooPatch p) { //IL_0030: 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) if ((Object)(object)p.Platform == (Object)null || ((MonoUpdatable)p.Platform).IsDestroyed || !((Component)p.Platform).gameObject.activeInHierarchy) { return true; } return p.WorldPoint().y < SceneBounds.WaterHeight; } private static void DragProjectiles(GooPatch p) { //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) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0133: 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) if (_dragMask == int.MinValue) { _dragMask = LayerMask.GetMask(new string[5] { "Projectile", "item", "weapon", "spell", "Ability" }) | (1 << Constants.itemLayer); } LayerMask val = LayerMask.op_Implicit(_dragMask); int num = DetPhysics.Get().CircleCastAll(p.WorldPoint(), p.Radius, val, ref _dragBufferRef); for (int i = 0; i < num; i++) { PhysicsParent val2 = _dragBufferRef[i]; FixTransform fixTrans = val2.fixTrans; if ((Object)(object)fixTrans == (Object)null || fixTrans.IsDestroyed || !_alreadyDragged.Add(val2.instanceId) || (Object)(object)((Component)fixTrans).GetComponent<PlayerBody>() != (Object)null) { continue; } BoplBody component = ((Component)fixTrans).GetComponent<BoplBody>(); if ((Object)(object)component != (Object)null && component.IsBeingHeld()) { continue; } Fireball component2 = ((Component)fixTrans).GetComponent<Fireball>(); if ((Object)(object)component2 != (Object)null) { ProjectileMotion.ScaleFireball(component2, Tuning.GooProjectileDrag); continue; } IPhysicsCollider monobehaviourCollider = val2.monobehaviourCollider; if (monobehaviourCollider != null && !monobehaviourCollider.IsDestroyed && monobehaviourCollider.initHasBeenCalled) { monobehaviourCollider.velocity *= Tuning.GooProjectileDrag; } } } public static void OnExplosion(Vec2 explosionPos) { //IL_000f: 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_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: 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_0051: 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_0055: 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_0063: 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_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: 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_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_006b: 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_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: 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_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_010f: 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_0126: 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_013c: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0180: 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_0187: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: 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_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) if (Patches.Count == 0) { return; } GooPatch gooPatch = null; Fix val = Fix.MaxValue; for (int i = 0; i < Patches.Count; i++) { GooPatch gooPatch2 = Patches[i]; Fix val2 = Tuning.GooBlastTrigger + gooPatch2.Radius; Fix val3 = Vec2.SqrMagnitude(gooPatch2.WorldPoint() - explosionPos); if (val3 <= val2 * val2 && val3 < val) { val = val3; gooPatch = gooPatch2; } } if (gooPatch == null) { return; } int ownerId = gooPatch.OwnerId; Color tint = gooPatch.Tint; Fix val4 = gooPatch.Radius * Tuning.GooBlastRadiusScale; Vec2 val5 = gooPatch.WorldPoint(); Vector2 start = default(Vector2); ((Vector2)(ref start))..ctor((float)val5.x, (float)val5.y); SpriteRenderer visualRenderer = gooPatch.VisualRenderer; int num = 0; for (int j = 0; j < SprayDirections.Length; j++) { RaycastInformation val6 = DetPhysics.Get().RaycastToClosestRoundedRect(explosionPos, SprayDirections[j], Tuning.GooBlastRange); if (((RaycastInformation)(ref val6)).HitSomething() && !((Object)(object)val6.pp.fixTrans == (Object)null) && !val6.pp.fixTrans.IsDestroyed) { StickyRoundedRectangle component = ((Component)val6.pp.fixTrans).GetComponent<StickyRoundedRectangle>(); if (!((Object)(object)component == (Object)null) && !IsCovered(component, val6.nearPos, val4 * (Fix)0.6f)) { Vec2 val7 = val6.nearPos - val5; Fix val8 = Fix.Max(Tuning.GooShotMinTime, Fix.Sqrt(Vec2.SqrMagnitude(val7)) / Tuning.GooShotSpeed); GooShot gooShot = new GooShot { OwnerId = ownerId, Platform = component, LocalPos = component.LocalPlayerPosFromPos(val6.nearPos, Fix.Zero), Radius = val4, Tint = tint, Remaining = val8, Total = val8, Start = start, Arc = Mathf.Clamp((float)Fix.Sqrt(Vec2.SqrMagnitude(val7)) * 0.15f, 0.6f, 2.2f) }; CreateShotVisual(gooShot, visualRenderer); Shots.Add(gooShot); num++; } } } if (num > 0) { Sfx.Play("throwSmallItem"); } } private static void UpdateShots(Fix dt) { //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_0026: 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_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) Vector2 val3 = default(Vector2); for (int num = Shots.Count - 1; num >= 0; num--) { GooShot gooShot = Shots[num]; gooShot.Remaining -= dt; if (!(gooShot.Remaining > Fix.Zero)) { Shots.RemoveAt(num); DestroyShotVisual(gooShot); if (!((Object)(object)gooShot.Platform == (Object)null) && !((MonoUpdatable)gooShot.Platform).IsDestroyed && ((Component)gooShot.Platform).gameObject.activeInHierarchy) { Vec2 val = gooShot.Platform.PositionFromLocalPlayerPos(gooShot.LocalPos, Fix.Zero); if (!(val.y < SceneBounds.WaterHeight) && !IsCovered(gooShot.Platform, val, gooShot.Radius * (Fix)0.6f)) { AddPatch(gooShot.OwnerId, gooShot.Platform, val, gooShot.Radius, gooShot.Tint); Sfx.Play("slimeLand"); Vec2 val2 = gooShot.Platform.currentNormal(val); ((Vector2)(ref val3))..ctor((float)val2.x, (float)val2.y); for (int i = 0; i < 4; i++) { Vector2 val4 = new Vector2(0f - val3.y, val3.x) * Random.Range(-4f, 4f); SlimeDrop.Spawn(new Vector3((float)val.x, (float)val.y, 0f), val3 * Random.Range(2f, 6f) + val4, Random.Range(0.2f, 0.4f), 0.5f, gooShot.Tint, null); } } } } } } private static void CreateShotVisual(GooShot s, SpriteRenderer sortLike) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("GooShot"); SpriteRenderer val2 = val.AddComponent<SpriteRenderer>(); val2.sprite = IconFactory.GooDrop(); val2.color = s.Tint; if ((Object)(object)sortLike != (Object)null) { ((Renderer)val2).sortingLayerID = ((Renderer)sortLike).sortingLayerID; ((Renderer)val2).sortingOrder = ((Renderer)sortLike).sortingOrder + 2; } else { ((Renderer)val2).sortingOrder = 50; } val.transform.localScale = Vector3.one * 0.9f; val.transform.position = new Vector3(s.Start.x, s.Start.y, 0f); s.Visual = val; s.VisualRenderer = val2; } private static void DestroyShotVisual(GooShot s) { if ((Object)(object)s.Visual != (Object)null) { Object.Destroy((Object)(object)s.Visual); } s.Visual = null; } private static void PlaceShots() { //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) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006b: 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_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) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: 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_00ad: 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_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_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_0107: 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_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0132: 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_0165: Unknown result type (might be due to invalid IL or missing references) Vector2 val2 = default(Vector2); for (int i = 0; i < Shots.Count; i++) { GooShot gooShot = Shots[i]; if (!((Object)(object)gooShot.Visual == (Object)null) && !((Object)(object)gooShot.Platform == (Object)null) && !((MonoUpdatable)gooShot.Platform).IsDestroyed) { Vec2 val = gooShot.Platform.PositionFromLocalPlayerPos(gooShot.LocalPos, Fix.Zero); ((Vector2)(ref val2))..ctor((float)val.x, (float)val.y); float num = 1f - Mathf.Clamp01((float)(gooShot.Remaining / gooShot.Total)); Vector2 val3 = Vector2.Lerp(gooShot.Start, val2, num); val3.y += gooShot.Arc * 4f * num * (1f - num); gooShot.Visual.transform.position = new Vector3(val3.x, val3.y, 0f); Vector2 val4 = val3 - gooShot.LastDrip; if (((Vector2)(ref val4)).sqrMagnitude > 0.25f) { gooShot.LastDrip = val3; SlimeDrop.Spawn(new Vector3(val3.x, val3.y, 0f), new Vector2(Random.Range(-0.5f, 0.5f), Random.Range(-0.3f, 0.3f)), 0.35f, 0.35f, gooShot.Tint, gooShot.VisualRenderer); } } } } private static bool IsCovered(StickyRoundedRectangle platform, Vec2 point, Fix distance) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_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_002f: 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) //IL_0031: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < Patches.Count; i++) { GooPatch gooPatch = Patches[i]; if ((Object)(object)gooPatch.Platform == (Object)(object)platform && Vec2.SqrMagnitude(gooPatch.WorldPoint() - point) <= distance * distance) { return true; } } return false; } public override void OnDestroyUpdatable() { if ((Object)(object)_instance == (Object)(object)this) { ResetAll(); } } private static void CreateVisual(GooPatch p) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_001f: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("GrappleGoo"); SpriteRenderer val2 = val.AddComponent<SpriteRenderer>(); val2.sprite = IconFactory.GooBlob(); val2.color = p.Tint; SpriteRenderer spriteRenderer = p.Platform.GetSpriteRenderer(); if ((Object)(object)spriteRenderer != (Object)null) { ((Renderer)val2).sortingLayerID = ((Renderer)spriteRenderer).sortingLayerID; ((Renderer)val2).sortingOrder = ((Renderer)spriteRenderer).sortingOrder + 1; } p.Visual = val; p.VisualRenderer = val2; PlaceVisual(p); } private static void DestroyVisual(GooPatch p) { if ((Object)(object)p.Visual != (Object)null) { Object.Destroy((Object)(object)p.Visual); } p.Visual = null; p.VisualRenderer = null; } private static void PlaceVisual(GooPatch p) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_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_0043: 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_0045: 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_0051: 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_0090: 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_009c: 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_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: 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_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)p.Visual == (Object)null)) { if (IsPlatformGone(p)) { p.Visual.SetActive(false); return; } p.Visual.SetActive(true); Vec2 val = p.WorldPoint(); Vec2 val2 = p.Platform.currentNormal(val); float num = Mathf.Atan2((float)val2.y, (float)val2.x) * 57.29578f - 90f; float num2 = (float)p.Radius * 2f; Transform transform = p.Visual.transform; transform.position = new Vector3((float)val.x, (float)val.y, transform.position.z); transform.rotation = Quaternion.Euler(0f, 0f, num); transform.localScale = new Vector3(num2, (float)p.Radius * 0.45f, 1f); Color tint = p.Tint; tint.a = 0.95f; p.VisualRenderer.color = tint; } } private void LateUpdate() { for (int i = 0; i < Patches.Count; i++) { PlaceVisual(Patches[i]); } PlaceShots(); } } internal static class IconFactory { private const float IconScale = 0.75f; private static Sprite _gooBlob; private static Sprite _white; private static Sprite _mirrorField; private static Sprite _wall; public static Sprite SlimeballShineSprite; private const float BallScale = 0.42f; private static Sprite _gooDrop; public static Sprite MakeGooIcon(Sprite reference) { //IL_0047: 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_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: 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) float ppu; int size = PickSize(reference, out ppu); Color32[] px = NewBuffer(size, size); float c = (float)size * 0.5f; Color32 body = new Color32((byte)110, (byte)220, (byte)80, byte.MaxValue); Color32 edge = new Color32((byte)25, (byte)95, (byte)40, byte.MaxValue); Color32 shine = new Color32((byte)220, byte.MaxValue, (byte)200, byte.MaxValue); Fill(px, size, size, delegate(int x, int y) { //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: 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_00d5: Unknown result type (might be due to invalid IL or missing references) float num = ((float)x - c) / (float)size / 0.75f; float num2 = ((float)y - c) / (float)size / 0.75f; float num3 = num / 0.6f; float num4 = num2 / 0.6f - 0.04f; return OverBubble(glyph: ShadeBlob(Mathf.Min(Mathf.Min(Dist(num3, num4, 0f, 0.02f, 0.3f), Dist(num3, num4, -0.2f, -0.22f, 0.11f)), Mathf.Min(Dist(num3, num4, 0.16f, -0.28f, 0.09f), Dist(num3, num4, 0.02f, -0.34f, 0.06f))), num3, num4, body, edge, shine), nx: num, ny: num2, size: (float)size * 0.75f); }); return Finish(px, size, size, ppu, new Vector2(0.5f, 0.5f)); } public static Sprite MakeMirrorIcon(Sprite reference) { //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_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: 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) float ppu; int size = PickSize(reference, out ppu); Color32[] px = NewBuffer(size, size); float c = (float)size * 0.5f; Color32 silver = new Color32((byte)235, (byte)245, byte.MaxValue, byte.MaxValue); Color32 glass = new Color32((byte)190, (byte)230, byte.MaxValue, byte.MaxValue); Color32 glint = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue); Color32 arrow = new Color32((byte)30, (byte)90, (byte)150, byte.MaxValue); Fill(px, size, size, delegate(int x, int y) { //IL_0100: 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_0064: 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_0069: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) float num = ((float)x - c) / (float)size / 0.75f; float num2 = ((float)y - c) / (float)size / 0.75f; float num3 = Mathf.Sqrt(num * num + num2 * num2); Color32 glyph = default(Color32); ((Color32)(ref glyph))..ctor((byte)0, (byte)0, (byte)0, (byte)0); if (num3 < 0.255f) { glyph = ((num3 > 0.215f) ? silver : glass); float num4 = num + num2; if (num3 <= 0.215f && ((num4 > -0.16f && num4 < -0.11f) || (num4 > -0.07f && num4 < -0.045f))) { glyph = glint; } if (num3 <= 0.215f && (InArrow(num * 1.7f, (num2 - 0.055f) * 1.7f, 1f) || InArrow(num * 1.7f, (num2 + 0.055f) * 1.7f, -1f))) { glyph = arrow; } } return OverBubble(num, num2, (float)size * 0.75f, glyph); }); return Finish(px, size, size, ppu, new Vector2(0.5f, 0.5f)); } public static Sprite MirrorField() { //IL_006a: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_mirrorField != (Object)null) { return _mirrorField; } Color32[] px = NewBuffer(256, 256); Fill(px, 256, 256, delegate(int x, int y) { //IL_0043: 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) float num = ((float)x + 0.5f) / 256f - 0.5f; float num2 = ((float)y + 0.5f) / 256f - 0.5f; float num3 = Mathf.Sqrt(num * num + num2 * num2); if (num3 > 0.5f) { return new Color32((byte)0, (byte)0, (byte)0, (byte)0); } float num4; if (num3 > 0.465f) { num4 = 0.95f * Mathf.Clamp01((0.5f - num3) / 0.012f); } else { num4 = 0.1f + 0.28f * Mathf.Pow(num3 / 0.465f, 3f); float num5 = num + num2; if ((num5 > -0.3f && num5 < -0.25f) || (num5 > -0.19f && num5 < -0.165f)) { num4 += 0.22f; } } return new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, (byte)Mathf.RoundToInt(Mathf.Clamp01(num4) * 255f)); }); _mirrorField = Finish(px, 256, 256, 256f, new Vector2(0.5f, 0.5f)); return _mirrorField; } public static Sprite MakeWallIcon(Sprite reference) { //IL_0047: 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_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: 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) float ppu; int size = PickSize(reference, out ppu); Color32[] px = NewBuffer(size, size); float c = (float)size * 0.5f; Color32 body = new Color32((byte)110, (byte)220, (byte)80, byte.MaxValue); Color32 edge = new Color32((byte)25, (byte)95, (byte)40, byte.MaxValue); Color32 shine = new Color32((byte)220, byte.MaxValue, (byte)200, byte.MaxValue); Fill(px, size, size, delegate(int x, int y) { //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_009f: 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_00a4: 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_00d4: Unknown result type (might be due to invalid IL or missing references) float num = ((float)x - c) / (float)size / 0.75f; float num2 = ((float)y - c) / (float)size / 0.75f; Color32 glyph = default(Color32); ((Color32)(ref glyph))..ctor((byte)0, (byte)0, (byte)0, (byte)0); float num3 = RoundRect(num, num2, 0f, 0.02f, 0.085f, 0.27f, 0.045f); float num4 = RoundRect(num, num2, 0f, -0.26f, 0.22f, 0.035f, 0.035f); float num5 = Mathf.Min(num3, num4); if (num5 < 0.01f) { glyph = ((num5 > -0.02f) ? edge : body); if (num5 <= -0.02f && num > -0.055f && num < -0.03f && num2 > -0.14f && num2 < 0.22f) { glyph = shine; } } return OverBubble(num, num2, (float)size * 0.75f, glyph); }); return Finish(px, size, size, ppu, new Vector2(0.5f, 0.5f)); } private static float RoundRect(float x, float y, float cx, float cy, float hx, float hy, float r) { float num = Mathf.Abs(x - cx) - (hx - r); float num2 = Mathf.Abs(y - cy) - (hy - r); float num3 = Mathf.Max(num, 0f); float num4 = Mathf.Max(num2, 0f); return Mathf.Sqrt(num3 * num3 + num4 * num4) + Mathf.Min(Mathf.Max(num, num2), 0f) - r; } public static Sprite WallSprite() { //IL_0061: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_wall != (Object)null) { return _wall; } Color32[] px = NewBuffer(32, 192); Fill(px, 32, 192, delegate(int x, int y) { //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) float num = (float)x + 0.5f; float num2 = (float)y + 0.5f; float num3 = RoundRect(num, num2, 16f, 96f, 16f, 96f, 6f); float num4 = Mathf.Clamp01(0.5f - num3); if (num4 <= 0f) { return new Color32((byte)0, (byte)0, (byte)0, (byte)0); } float num5; if (num3 > -2.5f) { num5 = 120f; } else { float num6 = num2 / 192f; num5 = Mathf.Lerp(200f, 245f, num6); if (num > 6f && num < 10f && num2 > 14f && num2 < 178f) { num5 = 255f; } num5 = WallBubble(num5, num, num2, 21f, 150f, 3.2f); num5 = WallBubble(num5, num, num2, 19f, 96f, 2.4f); num5 = WallBubble(num5, num, num2, 22f, 44f, 3.6f); } byte num7 = (byte)Mathf.Clamp(Mathf.RoundToInt(num5), 0, 255); return new Color32(num7, num7, num7, (byte)Mathf.RoundToInt(255f * num4)); }); _wall = Finish(px, 32, 192, 32f, new Vector2(0.5f, 0.5f)); return _wall; } private static float WallBubble(float shade, float x, float y, float cx, float cy, float r) { float num = Mathf.Sqrt((x - cx) * (x - cx) + (y - cy) * (y - cy)); if (Mathf.Abs(num - r) < 0.7f) { return 255f; } if (!(num < r)) { return shade; } return Mathf.Min(255f, shade + 14f); } public static Sprite MakeSlimeballHeld(Sprite reference) { return DrawJelly(reference, highlight: true, drip: true); } public static Sprite MakeSlimeballThrown(Sprite reference) { SlimeballShineSprite = MakeShine(reference); return DrawJelly(reference, highlight: false, drip: false); } private static Sprite MakeShine(Sprite reference) { //IL_006d: Unknown result type (might be due to invalid IL or missing references) float ppu; int size = PickSize(reference, out ppu); Color32[] px = NewBuffer(size, size); float c = (float)size * 0.5f; Fill(px, size, size, delegate(int x, int y) { //IL_0061: 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) float nx = ((float)x - c) / (float)size / 0.42f; float ny = ((float)y - c) / (float)size / 0.42f; return (!Highlight(nx, ny)) ? new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, (byte)0) : new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, (byte)235); }); return Finish(px, size, size, ppu, new Vector2(0.5f, 0.5f)); } private static bool Highlight(float nx, float ny) { float num = nx + 0.11f; float num2 = ny - 0.16f; float num3 = (num * 0.82f + num2 * 0.57f) / 0.085f; float num4 = ((0f - num) * 0.57f + num2 * 0.82f) / 0.04f; if (!(num3 * num3 + num4 * num4 < 1f)) { return Dist(nx, ny, -0.215f, 0.045f, 0.022f) < 0f; } return true; } private static Sprite DrawJelly(Sprite reference, bool highlight, bool drip) { //IL_007b: Unknown result type (might be due to invalid IL or missing references) float ppu; int size = PickSize(reference, out ppu); Color32[] px = NewBuffer(size, size); float c = (float)size * 0.5f; Fill(px, size, size, delegate(int x, int y) { //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) float num = ((float)x - c) / (float)size / 0.42f; float num2 = ((float)y - c) / (float)size / 0.42f; float num3 = Mathf.Atan2(num2, num); float num4 = 0.34f + 0.012f * Mathf.Sin(5f * num3 + 1f) + 0.008f * Mathf.Sin(9f * num3); float num5 = Mathf.Sqrt(num * num + num2 * num2) - num4; if (drip) { num5 = SmoothMin(num5, Dist(num, num2, 0.03f, -0.38f, 0.045f), 0.09f); } float num6 = Mathf.Clamp01((0.006f - num5) * (float)size * 0.42f / 1.5f + 0.5f); if (num6 <= 0f) { return new Color32((byte)0, (byte)0, (byte)0, (byte)0); } float num7; if (num5 > -0.03f) { num7 = 110f; } else { float num8 = Mathf.Clamp01(Mathf.InverseLerp(0.34f, -0.34f, num2)); num7 = Mathf.Lerp(250f, 190f, num8); if (num5 > -0.075f && num2 < -0.02f) { num7 = Mathf.Min(255f, num7 + 38f); } num7 = Bubble(num7, num, num2, 0.09f, -0.04f, 0.04f); num7 = Bubble(num7, num, num2, -0.1f, -0.13f, 0.024f); num7 = Bubble(num7, num, num2, 0.15f, 0.1f, 0.02f); if (highlight && Highlight(num, num2)) { num7 = 255f; } } byte num9 = (byte)Mathf.Clamp(Mathf.RoundToInt(num7), 0, 255); return new Color32(num9, num9, num9, (byte)Mathf.RoundToInt(255f * num6)); }); return Finish(px, size, size, ppu, new Vector2(0.5f, 0.5f)); } private static float Bubble(float shade, float nx, float ny, float cx, float cy, float r) { float num = Mathf.Sqrt((nx - cx) * (nx - cx) + (ny - cy) * (ny - cy)); if (Mathf.Abs(num - r) < 0.006f) { return 255f; } if (!(num < r)) { return shade; } return Mathf.Min(255f, shade + 14f); } private static float SmoothMin(float a, float b, float k) { float num = Mathf.Max(k - Mathf.Abs(a - b), 0f) / k; return Mathf.Min(a, b) - num * num * k * 0.25f; } public static Sprite GooDrop() { //IL_0058: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_gooDrop != (Object)null) { return _gooDrop; } Color32[] px = NewBuffer(32, 32); Fill(px, 32, 32, delegate(int x, int y) { //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) float num = ((float)x + 0.5f) / 32f - 0.5f; float num2 = ((float)y + 0.5f) / 32f - 0.5f; float num3 = Mathf.Sqrt(num * num + num2 * num2) - 0.42f; float num4 = Mathf.Clamp01((0.01f - num3) * 32f / 1.5f + 0.5f); if (num4 <= 0f) { return new Color32((byte)0, (byte)0, (byte)0, (byte)0); } int num5 = ((num3 > -0.1f) ? 150 : ((byte)((Dist(num, num2, -0.1f, 0.1f, 0.1f) < 0f) ? 255 : 235))); return new Color32((byte)num5, (byte)num5, (byte)num5, (byte)Mathf.RoundToInt(255f * num4)); }); _gooDrop = Finish(px, 32, 32, 32f, new Vector2(0.5f, 0.5f)); return _gooDrop; } public static Sprite MakeSwapIcon(Sprite reference) { //IL_004a: 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_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_007c: 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_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_00da: Unknown result type (might be due to invalid IL or missing references) float ppu; int size = PickSize(reference, out ppu); Color32[] px = NewBuffer(size, size); float c = (float)size * 0.5f; Color32 left = new Color32((byte)80, (byte)190, byte.MaxValue, byte.MaxValue); Color32 right = new Color32(byte.MaxValue, (byte)150, (byte)70, byte.MaxValue); Color32 edge = new Color32((byte)25, (byte)25, (byte)45, byte.MaxValue); Color32 arrow = new Color32((byte)245, (byte)245, byte.MaxValue, byte.MaxValue); Fill(px, size, size, delegate(int x, int y) { //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: 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_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) float x2 = ((float)x - c) / (float)size / 0.75f; float num = ((float)y - c) / (float)size / 0.75f; float num2 = Dist(x2, num, -0.24f, 0f, 0.2f); float num3 = Dist(x2, num, 0.24f, 0f, 0.2f); bool flag = InArrow(x2, num - 0.07f, 1f); bool flag2 = InArrow(x2, num + 0.07f, -1f); if (flag || flag2) { return arrow; } if (num2 < 0f || num3 < 0f) { float num4 = Mathf.Min(num2, num3); Color32 result = ((num2 < num3) ? left : right); if (!(num4 > -0.025f)) { return result; } return edge; } return (Color32)((num2 < 0.02f || num3 < 0.02f) ? edge : new Color32((byte)0, (byte)0, (byte)0, (byte)0)); }); return Finish(px, size, size, ppu, new Vector2(0.5f, 0.5f)); } public static Sprite GooBlob() { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_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_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_gooBlob != (Object)null) { return _gooBlob; } Color32[] px = NewBuffer(128, 64); Color32 body = new Color32((byte)240, (byte)240, (byte)240, byte.MaxValue); Color32 edge = new Color32((byte)160, (byte)160, (byte)160, byte.MaxValue); Color32 shine = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue); Fill(px, 128, 64, delegate(int x, int y) { //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) float num = ((float)x + 0.5f) / 128f * 2f - 1f; float num2 = ((float)y + 0.5f) / 64f; float num3 = Mathf.Sqrt(Mathf.Max(0f, 1f - num * num)) * (0.85f + 0.12f * Mathf.Sin(num * 9f)); float num4 = num2 - num3; if (num4 > 0f) { return new Color32((byte)0, (byte)0, (byte)0, (byte)0); } Color32 result = body; if (num4 > -0.1f) { result = edge; } else if (num2 > num3 - 0.34f && num > -0.55f && num < -0.15f && num2 > 0.22f) { result = shine; } return result; }); _gooBlob = Finish(px, 128, 64, 128f, new Vector2(0.5f, 0f)); return _gooBlob; } public static Sprite WhiteSquare() { //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_005b: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_white != (Object)null) { return _white; } Color32[] array = NewBuffer(4, 4); for (int i = 0; i < array.Length; i++) { array[i] = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue); } _white = Finish(array, 4, 4, 4f, new Vector2(0.5f, 0.5f)); return _white; } private static int PickSize(Sprite reference, out float ppu) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) int num = 128; ppu = 100f; if ((Object)(object)reference != (Object)null) { Rect rect = reference.rect; float num2 = Mathf.Max(1f, ((Rect)(ref rect)).width); num = Mathf.Clamp(Mathf.RoundToInt(num2), 64, 256); ppu = reference.pixelsPerUnit * ((float)num / num2); } return num; } private static Color32[] NewBuffer(int w, int h) { return (Color32[])(object)new Color32[w * h]; } private static void Fill(Color32[] px, int w, int h, Func<int, int, Color32> shader) { //IL_0011: 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) for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { px[i * w + j] = shader(j, i); } } } private static Sprite Finish(Color32[] px, int w, int h, float ppu, Vector2 pivot) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0009: 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_0017: 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_0026: Unknown result type (might be due to invalid IL or missing references) //IL_003c: 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_0049: Expected O, but got Unknown Texture2D val = new Texture2D(w, h, (TextureFormat)4, false); val.SetPixels32(px); ((Texture)val).filterMode = (FilterMode)1; ((Texture)val).wrapMode = (TextureWrapMode)1; val.Apply(false, false); ((Object)val).hideFlags = (HideFlags)61; Sprite obj = Sprite.Create(val, new Rect(0f, 0f, (float)w, (float)h), pivot, ppu); ((Object)obj).hideFlags = (HideFlags)61; return obj; } private static float Dist(float x, float y, float cx, float cy, float r) { float num = x - cx; float num2 = y - cy; return Mathf.Sqrt(num * num + num2 * num2) - r; } private static Color32 OverBubble(float nx, float ny, float size, Color32 glyph) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0038: 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_008a: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Sqrt(nx * nx + ny * ny); float num2 = 1f / size; if (num > 0.49f) { return new Color32((byte)0, (byte)0, (byte)0, (byte)0); } Color32 val = default(Color32); if (glyph.a > 0 && num < 0.42000002f) { val = glyph; } else if (num > 0.42000002f) { ((Color32)(ref val))..ctor((byte)18, (byte)87, (byte)135, byte.MaxValue); } else { ((Color32)(ref val))..ctor((byte)60, (byte)173, (byte)246, byte.MaxValue); } float num3 = Mathf.Clamp01((0.49f - num) / (1.5f * num2)); val.a = (byte)Mathf.RoundToInt((float)(int)val.a * num3); return val; } private static Color32 ShadeBlob(float d, float nx, float ny, Color32 body, Color32 edge, Color32 shine) { //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) //IL_0040: 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) if (d > 0.015f) { return new Color32((byte)0, (byte)0, (byte)0, (byte)0); } if (d > -0.035f) { return edge; } if (nx < -0.04f && nx > -0.17f && ny > 0.08f && ny < 0.22f) { return shine; } return body; } private static bool InArrow(float x, float y, float dir) { float num = x * dir; bool num2 = num > -0.17f && num < 0.08f && Mathf.Abs(y) < 0.018f; bool flag = num >= 0.04f && num <= 0.2f && Mathf.Abs(y) < (0.2f - num) * 0.55f; return num2 || flag; } } internal sealed class MirrorCaster : MonoBehaviour { private InstantAbility _instant; private void Awake() { //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Expected O, but got Unknown //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Expected O, but got Unknown _instant = ((Component)this).GetComponent<InstantAbility>(); if ((Object)(object)_instant == (Object)null) { Plugin.Log.LogError((object)"MirrorCaster is missing its InstantAbility."); return; } if (_instant.funcOnEnter == null) { _instant.funcOnEnter = new UnityEvent(); } _instant.funcOnEnter.AddListener(new UnityAction(OnCast)); } private void OnCast() { //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_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) try { _instant.ignoreNextCooldown = false; PlayerInfo playerInfo = _instant.playerInfo; if (!((Object)(object)playerInfo.slimeController == (Object)null) && !((MonoUpdatable)playerInfo.slimeController).IsDestroyed) { MirrorManager.AddField(playerInfo.playerId); Sfx.Play("transform2"); } } catch (Exception arg) { Plugin.Log.LogError((object)$"Mirror cast failed: {arg}"); } } } internal sealed class MirrorFieldState { public int OwnerId; public Vec2 Center; public Fix Radius; public Fix TimeLeft; public Color Tint; public GameObject Visual; public SpriteRenderer VisualRenderer; } internal sealed class MirrorManager : MonoUpdatable { public static readonly List<MirrorFieldState> Fields = new List<MirrorFieldState>(); private static MirrorManager _instance; private static readonly PhysicsParent[] Buffer = (PhysicsParent[])(object)new PhysicsParent[128]; private static PhysicsParent[] _bufferRef = Buffer; private static readonly HashSet<int> Reflected = new HashSet<int>(); private static int _mask = int.MinValue; private const float FadeSeconds = 0.4f; public static void AddField(int ownerId) { //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_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_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_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) EnsureInstance(); for (int num = Fields.Count - 1; num >= 0; num--) { if (Fields[num].OwnerId == ownerId) { RemoveAt(num); } } Player player = PlayerHandler.Get().GetPlayer(ownerId); if (player != null) { MirrorFieldState mirrorFieldState = new MirrorFieldState { OwnerId = ownerId, Center = player.Position, Radius = Tuning.MirrorRadius * player.Scale, TimeLeft = Tuning.MirrorDuration, Tint = Color.Lerp(PlayerTint.Get(ownerId), Color.white, 0.35f) }; CreateVisual(mirrorFieldState); Fields.Add(mirrorFieldState); } } private static void EnsureInstance() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_instance != (Object)null) || ((MonoUpdatable)_instance).IsDestroyed) { Updater.BeginRegisterPrefab(); _instance = new GameObject("BoplGooSwap.MirrorManager").AddComponent<MirrorManager>(); Updater.EndRegisterPrefab(); } } public static void ResetAll() { for (int num = Fields.Count - 1; num >= 0; num--) { DestroyVisual(Fields[num]); } Fields.Clear(); _instance = null; } private static void RemoveAt(int index) { DestroyVisual(Fields[index]); Fields.RemoveAt(index); } private void Awake() { Updater.RegisterUpdatable((MonoUpdatable)(object)this); } public override void Init() { } public override void OnDestroyUpdatable() { if ((Object)(object)_instance == (Object)(object)this) { ResetAll(); } } public override void UpdateSim(Fix simDeltaTime) { //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (m