Due to update 2.4.3, some mods may no longer function. FixedConfig may be necessary.
Decompiled source of Aqua Maps v1.0.0
plugins/AquaMaps.dll
Decompiled 2 weeks ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text; using System.Threading; using System.Threading.Tasks; using BepInEx; using BepInEx.Logging; using BoplFixedMath; using HarmonyLib; using Microsoft.CodeAnalysis; using PoyrazBoplMod.Abilities.CancerBeam; using PoyrazBoplMod.Abilities.Possession; using PoyrazBoplMod.Core; using PoyrazBoplMod.Maps.Aqua; using PoyrazBoplMod.Shared; using UnityEngine; using UnityEngine.InputSystem; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("AquaMaps")] [assembly: AssemblyConfiguration("AquaMaps")] [assembly: AssemblyFileVersion("0.1.0.0")] [assembly: AssemblyInformationalVersion("0.1.0")] [assembly: AssemblyProduct("AquaMaps")] [assembly: AssemblyTitle("AquaMaps")] [assembly: AssemblyVersion("0.1.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace PoyrazBoplMod { [BepInPlugin("com.poyraz.aquamaps", "Aqua Maps", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { public const string Guid = "com.poyraz.aquamaps"; public const string Name = "Aqua Maps"; public const string Version = "1.0.0"; internal static ManualLogSource Log; internal static string PluginDir; private static bool loggedSounds; private void Awake() { //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; PluginDir = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location); AquaMaps.OnlyAquaMaps = ((BaseUnityPlugin)this).Config.Bind<bool>("Aqua", "OnlyAquaMaps", false, "Deneme: true olursa rastgele bolum hep Aqua haritasi olur (yerel oyunda ilk bolum de). Online'da host'un ayari gecerli.").Value; AquaMaps.OnlyDepthsMaps = ((BaseUnityPlugin)this).Config.Bind<bool>("Aqua", "OnlyDepthsMaps", false, "Deneme: true olursa rastgele bolum hep Derinler haritasi olur (okyanus derinlikleri; yerel oyunda ilk bolum de). Online'da host'un ayari gecerli.").Value; CityGate.AlwaysOpen = ((BaseUnityPlugin)this).Config.Bind<bool>("Aqua", "AlwaysOpenCityGate", false, "Deneme: true olursa Kayip Sehir'in muhurlu kapisi her oynayista acilir (normalde 5 oynayista bir). Sadece yerel oyunda calisir.").Value; PatchAll(new Harmony("com.poyraz.aquamaps")); SceneManager.sceneLoaded += OnSceneLoaded; AbilityRegistry.EnsureRegistered(); Log.LogInfo((object)"Aqua Maps 1.0.0 yuklendi."); } private static void OnSceneLoaded(Scene scene, LoadSceneMode mode) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) AbilityRegistry.EnsureRegistered(); AquaMaps.OnSceneLoaded(scene); } private static void PatchAll(Harmony harmony) { foreach (Type item in from t in typeof(Plugin).Assembly.GetTypes() where t.GetCustomAttributes(typeof(HarmonyPatch), inherit: false).Any() select t) { try { harmony.CreateClassProcessor(item).Patch(); } catch (Exception arg) { Log.LogError((object)$"Patch uygulanamadi: {item.FullName}\n{arg}"); } } } } } namespace PoyrazBoplMod.Abilities.Possession { internal static class ShadowClones { private static bool looked; private static Func<IEnumerable<Player>> combatants; private static Func<int, int, bool> sameSide; private static void Look() { if (looked) { return; } looked = true; Assembly assembly = typeof(ShadowClones).Assembly; Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); foreach (Assembly assembly2 in assemblies) { if (assembly2 == assembly) { continue; } Type type; try { type = assembly2.GetType("PoyrazBoplMod.Abilities.Possession.ShadowClones", throwOnError: false); } catch (Exception) { continue; } if (type == null) { continue; } MethodInfo c = type.GetMethod("Combatants", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic, null, Type.EmptyTypes, null); if (c != null && typeof(IEnumerable<Player>).IsAssignableFrom(c.ReturnType)) { combatants = ((Func<IEnumerable<Player>>)Delegate.CreateDelegate(typeof(Func<IEnumerable<Player>>), c, throwOnBindFailure: false)) ?? ((Func<IEnumerable<Player>>)(() => c.Invoke(null, null) as IEnumerable<Player>)); } MethodInfo s = type.GetMethod("SameSide", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic, null, new Type[2] { typeof(int), typeof(int) }, null); if (s != null && s.ReturnType == typeof(bool)) { sameSide = ((Func<int, int, bool>)Delegate.CreateDelegate(typeof(Func<int, int, bool>), s, throwOnBindFailure: false)) ?? ((Func<int, int, bool>)((int a, int b) => (bool)s.Invoke(null, new object[2] { a, b }))); } break; } } public static IEnumerable<Player> Combatants() { Look(); if (combatants != null) { IEnumerable<Player> enumerable = combatants(); if (enumerable != null) { return enumerable; } } PlayerHandler val = PlayerHandler.Get(); if (val == null) { return Enumerable.Empty<Player>(); } return val.PlayerList(); } public static bool SameSide(int a, int b) { Look(); if (sameSide != null) { return sameSide(a, b); } if (a == b) { return true; } PlayerHandler obj = PlayerHandler.Get(); Player val = ((obj != null) ? obj.GetPlayer(a) : null); Player val2 = ((obj != null) ? obj.GetPlayer(b) : null); if (val != null && val2 != null) { return val.Team == val2.Team; } return false; } } } namespace PoyrazBoplMod.Abilities.CancerBeam { internal static class PlayerLocks { private sealed class Lock { public SlimeController Slime; public Vec2 At; public Fix Left; public bool Stun; public bool Hidden; } private static readonly Dictionary<int, Lock> locks = new Dictionary<int, Lock>(); private static readonly List<int> keys = new List<int>(); internal static int DebugStuns; public static bool Any => locks.Count > 0; public static bool Locked(int playerId) { return locks.ContainsKey(playerId); } public static bool Stunned(int playerId) { if (locks.TryGetValue(playerId, out var value)) { return value.Stun; } return false; } public static bool Hidden(int playerId) { if (locks.TryGetValue(playerId, out var value)) { return value.Hidden; } return false; } public static void Hold(int playerId, SlimeController slime, Vec2 at, bool hidden = false) { //IL_003b: 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_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)slime == (Object)null) && !((MonoUpdatable)slime).IsDestroyed) { if (!locks.TryGetValue(playerId, out var value)) { value = (locks[playerId] = new Lock()); } value.Slime = slime; value.At = at; value.Left = Fix.Max(value.Left, (Fix)2L * GameTime.FixedTimeStep); value.Stun = false; value.Hidden = hidden; Pin(value); } } public static void Release(int playerId) { locks.Remove(playerId); } private static void Pin(Lock l) { //IL_002e: 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_004e: 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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: 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) SlimeController slime = l.Slime; if (!((Object)(object)slime == (Object)null) && !((MonoUpdatable)slime).IsDestroyed && !((Object)(object)slime.body == (Object)null)) { slime.body.position = l.At; slime.body.selfImposedVelocity = Vec2.zero; slime.body.externalVelocity = Vec2.zero; ((Component)slime).transform.position = Vector2.op_Implicit((Vector2)l.At); PlayerHandler obj = PlayerHandler.Get(); Player val = ((obj != null) ? obj.GetPlayer(slime.playerNumber) : null); if (val != null) { val.Position = l.At; } } } public static void Tick(Fix dt) { //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) if (locks.Count == 0) { return; } bool flag = GameTime.IsTimeStopped(); keys.Clear(); keys.AddRange(locks.Keys); keys.Sort(); foreach (int key in keys) { Lock obj = locks[key]; Player player = PlayerHandler.Get().GetPlayer(key); if (player == null || !player.IsAlive || (Object)(object)obj.Slime == (Object)null || ((MonoUpdatable)obj.Slime).IsDestroyed) { locks.Remove(key); continue; } if (!flag) { obj.Left -= dt; } if (obj.Left <= Fix.Zero) { locks.Remove(key); } else { Pin(obj); } } } public static void ResetAll() { locks.Clear(); } } [HarmonyPatch(typeof(SlimeController), "UpdateSim")] internal static class Patch_Slime_Locked { [HarmonyPriority(600)] private static bool Prefix(SlimeController __instance) { if (PlayerLocks.Any) { return !PlayerLocks.Locked(__instance.playerNumber); } return true; } } } namespace PoyrazBoplMod.UI { internal sealed class AbilityGridScroll : MonoBehaviour { public const int VisibleRows = 10; private const float ScrollSharpness = 14f; private const float CircleSharpness = 22f; private const float GrowSharpness = 18f; private const float BarWidth = 22f; private static readonly FieldRef<AbilityGrid, AbilityGridEntry[]> gridRef = AccessTools.FieldRefAccess<AbilityGrid, AbilityGridEntry[]>("grid"); private static readonly FieldRef<AbilityGrid, int> rowsRef = AccessTools.FieldRefAccess<AbilityGrid, int>("rows"); private static readonly FieldRef<AbilityGrid, float> entrySizeRef = AccessTools.FieldRefAccess<AbilityGrid, float>("entrySize"); private static readonly FieldRef<AbilityGrid, bool> keyboardMouseRef = AccessTools.FieldRefAccess<AbilityGrid, bool>("usesKeyboardAndMouse"); private static readonly Vector2 GridPadding = new Vector2(126f, -122f); private static Sprite roundSprite; private AbilityGrid owner; private AbilityGridEntry[] entries; private RectTransform content; private RectTransform track; private RectTransform thumb; private Vector2 contentBase; private int columns; private int rows; private int visibleRows; private float entrySize; private int firstRow; private float offset; private int lastSelected = -1; private Vector2 circlePos; private float[] grow; private bool snap = true; public int FirstRow => firstRow; public int MaxFirstRow => Mathf.Max(0, rows - visibleRows); private static bool OtherModInstalled(AbilityGrid grid) { MonoBehaviour[] components = ((Component)grid).GetComponents<MonoBehaviour>(); foreach (MonoBehaviour val in components) { if ((Object)(object)val != (Object)null && ((object)val).GetType().Name == "AbilityGridScroll" && ((object)val).GetType() != typeof(AbilityGridScroll)) { return true; } } return false; } public static void Install(AbilityGrid grid) { if ((Object)(object)grid == (Object)null || (Object)(object)((Component)grid).GetComponent<AbilityGridScroll>() != (Object)null || OtherModInstalled(grid)) { return; } AbilityGridEntry[] array = gridRef.Invoke(grid); if (array == null || array.Length == 0 || (Object)(object)grid.selectionCircle == (Object)null) { return; } AbilityGridScroll abilityGridScroll = ((Component)grid).gameObject.AddComponent<AbilityGridScroll>(); try { abilityGridScroll.Build(grid, array); } catch (Exception ex) { Plugin.Log.LogError((object)("Yetenek listesi kaydirma kurulamadi: " + ex)); Object.Destroy((Object)(object)abilityGridScroll); } } public void SnapToSelection() { snap = true; lastSelected = -1; } public void ScrollBy(int rowsDelta) { firstRow = Mathf.Clamp(firstRow + rowsDelta, 0, MaxFirstRow); } private void Build(AbilityGrid grid, AbilityGridEntry[] gridEntries) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_0220: Unknown result type (might be due to invalid IL or missing references) //IL_023c: Unknown result type (might be due to invalid IL or missing references) //IL_0273: Unknown result type (might be due to invalid IL or missing references) owner = grid; entries = gridEntries; RectTransform val = (RectTransform)((Component)grid).transform; Rect rect = val.rect; columns = Mathf.Max(1, grid.columns); rows = Mathf.Max(1, rowsRef.Invoke(grid)); visibleRows = Mathf.Min(rows, 10); entrySize = Mathf.Sqrt(((Rect)(ref rect)).width * ((Rect)(ref rect)).height * 0.9f / (float)(columns * visibleRows)); entrySizeRef.Invoke(grid) = entrySize; RectTransform val2 = NewRect("PoyrazMod_GridViewport", val); ((Transform)val2).SetSiblingIndex(((Transform)grid.selectionCircle).GetSiblingIndex()); content = NewRect("PoyrazMod_GridContent", val2); contentBase = content.anchoredPosition; ((Transform)grid.selectionCircle).SetParent((Transform)(object)content, false); grow = new float[entries.Length]; for (int i = 0; i < entries.Length; i++) { AbilityGridEntry obj = entries[i]; ((Transform)obj.rectTrans).SetParent((Transform)(object)content, false); int num = i / columns; int num2 = i % columns; obj.rectTrans.anchoredPosition = GridPadding + new Vector2((float)num2 * entrySize - ((Rect)(ref rect)).width / 2f, (float)(-num) * entrySize + ((Rect)(ref rect)).height / 2f); grow[i] = 1f; ApplyScale(i); } float y = VisualCenter(entries[0]).y; float num3 = y - (float)(visibleRows - 1) * entrySize; float num4 = y + entrySize * 0.64f; float num5 = num3 - entrySize * 0.55f; RectMask2D obj2 = ((Component)val2).gameObject.AddComponent<RectMask2D>(); obj2.padding = new Vector4(-400f, num5 - ((Rect)(ref rect)).yMin, -400f, ((Rect)(ref rect)).yMax - num4); obj2.softness = new Vector2Int(0, Mathf.RoundToInt(entrySize * 0.08f)); if (rows > visibleRows) { BuildScrollbar(val, VisualCenter(entries[Mathf.Min(columns, entries.Length) - 1]).x + entrySize * 0.75f, num4, num5); } } private static RectTransform NewRect(string name, RectTransform parent) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Expected O, but got Unknown RectTransform val = (RectTransform)new GameObject(name, new Type[1] { typeof(RectTransform) }).transform; ((Transform)val).SetParent((Transform)(object)parent, false); val.anchorMin = Vector2.zero; val.anchorMax = Vector2.one; val.pivot = parent.pivot; val.offsetMin = Vector2.zero; val.offsetMax = Vector2.zero; return val; } private Vector2 VisualCenter(AbilityGridEntry e) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) RectTransform rectTrans = e.rectTrans; Rect rect = rectTrans.rect; Vector2 val = Vector2.Scale(((Rect)(ref rect)).size, Vector2.op_Implicit(((Transform)rectTrans).localScale)); return Vector2.op_Implicit(((Transform)rectTrans).localPosition) + Vector2.Scale(new Vector2(0.5f, 0.5f) - rectTrans.pivot, val); } private void BuildScrollbar(RectTransform parent, float x, float top, float bottom) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) float num = entrySize * 0.25f; track = NewBar("PoyrazMod_GridScrollbar", parent, new Color(0f, 0f, 0f, 0.22f)); RectTransform obj = track; RectTransform obj2 = track; Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(0.5f, 0.5f); obj2.anchorMax = val; obj.anchorMin = val; track.sizeDelta = new Vector2(22f, top - bottom - num * 2f); ((Transform)track).localPosition = new Vector3(x, (top + bottom) / 2f, 0f); thumb = NewBar("Thumb", track, new Color(1f, 1f, 1f, 0.9f)); RectTransform obj3 = thumb; RectTransform obj4 = thumb; ((Vector2)(ref val))..ctor(0.5f, 1f); obj4.anchorMax = val; obj3.anchorMin = val; thumb.pivot = new Vector2(0.5f, 1f); } private static RectTransform NewBar(string name, RectTransform parent, Color color) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name, new Type[1] { typeof(RectTransform) }); RectTransform val2 = (RectTransform)val.transform; ((Transform)val2).SetParent((Transform)(object)parent, false); Image obj = val.AddComponent<Image>(); obj.sprite = RoundSprite(); obj.type = (Type)1; ((Graphic)obj).color = color; ((Graphic)obj).raycastTarget = false; return val2; } private static Sprite RoundSprite() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)roundSprite != (Object)null) { return roundSprite; } Texture2D val = new Texture2D(32, 32, (TextureFormat)4, false); Color[] array = (Color[])(object)new Color[1024]; for (int i = 0; i < 32; i++) { for (int j = 0; j < 32; j++) { float num = (float)j + 0.5f - 16f; float num2 = (float)i + 0.5f - 16f; float num3 = Mathf.Clamp01(16f - Mathf.Sqrt(num * num + num2 * num2)); array[i * 32 + j] = new Color(1f, 1f, 1f, num3); } } val.SetPixels(array); val.Apply(); ((Texture)val).wrapMode = (TextureWrapMode)1; ((Object)val).hideFlags = (HideFlags)32; roundSprite = Sprite.Create(val, new Rect(0f, 0f, 32f, 32f), new Vector2(0.5f, 0.5f), 100f, 0u, (SpriteMeshType)0, new Vector4(15f, 15f, 15f, 15f)); ((Object)roundSprite).hideFlags = (HideFlags)32; return roundSprite; } private void ApplyScale(int i) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) RectTransform rectTrans = entries[i].rectTrans; Rect rect = rectTrans.rect; float num = owner.nonSelectedScale * grow[i] * entrySize; ((Transform)rectTrans).localScale = new Vector3(num / ((Rect)(ref rect)).width, num / ((Rect)(ref rect)).height, 1f); } private static float Approach(float k, float dt) { return 1f - Mathf.Exp((0f - k) * dt); } private void LateUpdate() { //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Unknown result type (might be due to invalid IL or missing references) //IL_024f: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Unknown result type (might be due to invalid IL or missing references) //IL_027b: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)owner == (Object)null || (Object)(object)content == (Object)null || !((Behaviour)owner).enabled) { return; } float unscaledDeltaTime = Time.unscaledDeltaTime; int num = Mathf.Clamp(owner.SelectedIcon, 0, entries.Length - 1); if (keyboardMouseRef.Invoke(owner) && Mouse.current != null) { float y = ((InputControl<Vector2>)(object)Mouse.current.scroll).ReadValue().y; if (y > 0.01f) { firstRow--; } else if (y < -0.01f) { firstRow++; } } if (num != lastSelected) { int num2 = num / columns; if (num2 < firstRow) { firstRow = num2; } else if (num2 > firstRow + visibleRows - 1) { firstRow = num2 - visibleRows + 1; } lastSelected = num; } firstRow = Mathf.Clamp(firstRow, 0, MaxFirstRow); float num3 = (float)firstRow * entrySize; offset = (snap ? num3 : Mathf.Lerp(offset, num3, Approach(14f, unscaledDeltaTime))); if (Mathf.Abs(offset - num3) < 0.5f) { offset = num3; } content.anchoredPosition = contentBase + new Vector2(0f, offset); float num4 = ((owner.nonSelectedScale > 0.0001f) ? (owner.selectedScale / owner.nonSelectedScale) : 1f); float num5 = (snap ? 1f : Approach(18f, unscaledDeltaTime)); for (int i = 0; i < entries.Length; i++) { if (!((Object)(object)entries[i] == (Object)null)) { grow[i] = Mathf.Lerp(grow[i], (i == num) ? num4 : 1f, num5); ApplyScale(i); } } Vector2 anchoredPosition = entries[num].rectTrans.anchoredPosition; circlePos = (snap ? anchoredPosition : Vector2.Lerp(circlePos, anchoredPosition, Approach(22f, unscaledDeltaTime))); owner.selectionCircle.anchoredPosition = circlePos; UpdateScrollbar(); snap = false; } private void UpdateScrollbar() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)track == (Object)null)) { Rect rect = track.rect; float height = ((Rect)(ref rect)).height; float num = Mathf.Max(height * (float)visibleRows / (float)rows, 44f); float num2 = ((MaxFirstRow > 0) ? Mathf.Clamp01(offset / ((float)MaxFirstRow * entrySize)) : 0f); thumb.sizeDelta = new Vector2(22f, num); thumb.anchoredPosition = new Vector2(0f, (0f - (height - num)) * num2); } } } [HarmonyPatch(typeof(AbilityGrid), "Awake")] internal static class Patch_AbilityGrid_Awake { private static void Postfix(AbilityGrid __instance) { AbilityGridScroll.Install(__instance); } } [HarmonyPatch(typeof(AbilityGrid), "Init")] internal static class Patch_AbilityGrid_Init { private static void Postfix(AbilityGrid __instance) { AbilityGridScroll component = ((Component)__instance).GetComponent<AbilityGridScroll>(); if ((Object)(object)component != (Object)null) { component.SnapToSelection(); } } } } namespace PoyrazBoplMod.Shared { internal static class AquaWater { private sealed class Copy { public FieldInfo Active; public FieldInfo Surface; public FieldInfo Abyss; public FieldInfo Hook; } public static bool Active; public static Fix Surface = (Fix)(-11.22f); public static Fix Abyss = (Fix)(-27L); public static readonly Fix RayRange = (Fix)7L; public static readonly Fix BeamRange = (Fix)8L; public static Func<FixTransform, bool> RayHitHook; private static List<Copy> copies; private static bool lastActive; private static Fix lastSurface = Fix.MinValue; private static Fix lastAbyss = Fix.MinValue; private static Func<FixTransform, bool> lastHook; public static bool InWater(Vec2 p) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) if (Active) { return p.y < Surface; } return false; } public static bool InWater(Fix y) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) if (Active) { return y < Surface; } return false; } public static void Mirror() { //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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) if (copies == null) { FindCopies(); } if (copies.Count == 0 || (Active == lastActive && Surface == lastSurface && Abyss == lastAbyss && RayHitHook == lastHook)) { return; } lastActive = Active; lastSurface = Surface; lastAbyss = Abyss; lastHook = RayHitHook; foreach (Copy copy in copies) { try { copy.Active?.SetValue(null, Active); copy.Surface?.SetValue(null, Surface); copy.Abyss?.SetValue(null, Abyss); copy.Hook?.SetValue(null, RayHitHook); } catch (Exception) { } } } private static void FindCopies() { copies = new List<Copy>(); Type typeFromHandle = typeof(AquaWater); Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); foreach (Assembly assembly in assemblies) { if (!(assembly == typeFromHandle.Assembly)) { Type type; try { type = assembly.GetType(typeFromHandle.FullName, throwOnError: false); } catch (Exception) { continue; } if (!(type == null)) { Copy item = new Copy { Active = Field(type, "Active", typeof(bool), BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic), Surface = Field(type, "Surface", typeof(Fix), BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic), Abyss = Field(type, "Abyss", typeof(Fix), BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic), Hook = Field(type, "RayHitHook", typeof(Func<FixTransform, bool>), BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic) }; copies.Add(item); } } } } private static FieldInfo Field(Type t, string name, Type type, BindingFlags flags) { FieldInfo field = t.GetField(name, flags); if (!(field != null) || !(field.FieldType == type) || field.IsInitOnly) { return null; } return field; } } internal static class ModAudio { public const int SampleRate = 44100; private static readonly FieldRef<AudioManager, float> masterRef = AccessTools.FieldRefAccess<AudioManager, float>("currentMasterVolume"); private static readonly Random jitter = new Random(); private static AudioSource[] pool; private static int next; public static void Play(AudioClip clip, float volume = 1f, float pitch = 1f) { if ((Object)(object)clip == (Object)null) { return; } try { if (Ready()) { AudioSource obj = pool[next++ % pool.Length]; obj.clip = clip; obj.pitch = pitch * (1f + ((float)jitter.NextDouble() - 0.5f) * 0.06f); obj.volume = Mathf.Clamp01(volume * GameVolume()); obj.Play(); } } catch (Exception ex) { Plugin.Log.LogDebug((object)("Ses calinamadi: " + ex.Message)); } } public static float GameVolume() { AudioManager val = AudioManager.Get(); if ((Object)(object)val == (Object)null) { return 0.5f; } float num = 1f; try { num = masterRef.Invoke(val); } catch { } return val.sfxVolume * num; } private static bool Ready() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown if (pool != null && (Object)(object)pool[0] != (Object)null) { return true; } GameObject val = new GameObject("PoyrazMod_ModAudio"); Object.DontDestroyOnLoad((Object)(object)val); pool = (AudioSource[])(object)new AudioSource[10]; for (int i = 0; i < pool.Length; i++) { AudioSource val2 = val.AddComponent<AudioSource>(); val2.playOnAwake = false; val2.spatialBlend = 0f; pool[i] = val2; } return true; } public static AudioClip LoadWavIfExists(string fileName) { try { if (!File.Exists(Path.Combine(Plugin.PluginDir, "sounds", fileName))) { return null; } } catch { return null; } return LoadWav(fileName); } public static AudioClip LoadWav(string fileName) { try { string text = Path.Combine(Plugin.PluginDir, "sounds", fileName); if (!File.Exists(text)) { Plugin.Log.LogWarning((object)("Ses dosyasi yok (yedek ses calinacak): " + text)); return null; } byte[] array = File.ReadAllBytes(text); if (array.Length < 44 || Encoding.ASCII.GetString(array, 0, 4) != "RIFF" || Encoding.ASCII.GetString(array, 8, 4) != "WAVE") { return null; } int num = 1; int num2 = 44100; int num3 = 16; int num4 = 12; while (num4 + 8 <= array.Length) { string text2 = Encoding.ASCII.GetString(array, num4, 4); int num5 = BitConverter.ToInt32(array, num4 + 4); int num6 = num4 + 8; if (text2 == "fmt ") { num = BitConverter.ToInt16(array, num6 + 2); num2 = BitConverter.ToInt32(array, num6 + 4); num3 = BitConverter.ToInt16(array, num6 + 14); } else if (text2 == "data") { if (num3 != 16) { return null; } int num7 = Mathf.Min(num5, array.Length - num6) / (2 * num); float[] array2 = new float[num7]; for (int i = 0; i < num7; i++) { float num8 = 0f; for (int j = 0; j < num; j++) { num8 += (float)BitConverter.ToInt16(array, num6 + (i * num + j) * 2) / 32768f; } array2[i] = num8 / (float)num; } AudioClip obj = AudioClip.Create("Poyraz_" + fileName, num7, 1, num2, false); obj.SetData(array2, 0); ((Object)obj).hideFlags = (HideFlags)32; return obj; } num4 = num6 + num5 + (num5 & 1); } } catch (Exception ex) { Plugin.Log.LogWarning((object)("Ses dosyasi okunamadi: " + fileName + " (" + ex.Message + ")")); } return null; } public static AudioClip FromSamples(string name, float[] data) { float num = 0.0001f; foreach (float num2 in data) { num = Mathf.Max(num, Mathf.Abs(num2)); } for (int j = 0; j < data.Length; j++) { data[j] = data[j] / num * 0.9f; } AudioClip obj = AudioClip.Create(name, data.Length, 1, 44100, false); obj.SetData(data, 0); ((Object)obj).hideFlags = (HideFlags)32; return obj; } } internal static class PlayerKill { private static readonly FieldRef<SlimeController, List<AbilityMonoBehaviour>> abilitiesRef = AccessTools.FieldRefAccess<SlimeController, List<AbilityMonoBehaviour>>("abilities"); private static readonly FieldRef<Player, SlimeController> setterRef = AccessTools.FieldRefAccess<Player, SlimeController>("positionSetterLastFrame"); private static readonly FieldRef<Player, SlimeController> setterNowRef = AccessTools.FieldRefAccess<Player, SlimeController>("positionSetterThisFrame"); public static SlimeController SlimeOf(Player player) { if (player == null) { return null; } SlimeController val = setterNowRef.Invoke(player); if ((Object)(object)val == (Object)null || ((MonoUpdatable)val).IsDestroyed) { val = setterRef.Invoke(player); } if ((Object)(object)val != (Object)null && !((MonoUpdatable)val).IsDestroyed) { return val; } SlimeController[] array = Object.FindObjectsOfType<SlimeController>(); foreach (SlimeController val2 in array) { if ((Object)(object)val2 != (Object)null && !((MonoUpdatable)val2).IsDestroyed && val2.playerNumber == player.Id) { return val2; } } return null; } public static bool CanKillNow(SlimeController slime) { if ((Object)(object)slime == (Object)null || ((MonoUpdatable)slime).IsDestroyed) { return false; } if (((Component)slime).gameObject.activeInHierarchy) { return true; } List<AbilityMonoBehaviour> list = abilitiesRef.Invoke(slime); if (list == null) { return false; } foreach (AbilityMonoBehaviour item in list) { if ((Object)(object)item != (Object)null && !((MonoUpdatable)item).IsDestroyed && ((Component)item).gameObject.activeInHierarchy && ((Component)item).GetComponent<IAbilityComponent>() != null) { return true; } } return false; } public static AbilityMonoBehaviour ActiveForm(SlimeController slime) { if ((Object)(object)slime == (Object)null || ((MonoUpdatable)slime).IsDestroyed || ((Component)slime).gameObject.activeInHierarchy) { return null; } List<AbilityMonoBehaviour> list = abilitiesRef.Invoke(slime); if (list == null) { return null; } foreach (AbilityMonoBehaviour item in list) { if ((Object)(object)item != (Object)null && !((MonoUpdatable)item).IsDestroyed && ((Component)item).gameObject.activeInHierarchy && ((Component)item).GetComponent<IAbilityComponent>() != null) { return item; } } return null; } public static void Kill(SlimeController slime, Player player, int killerId, bool spawnEffect) { //IL_004e: 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_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0109: 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) if ((Object)(object)slime == (Object)null || ((MonoUpdatable)slime).IsDestroyed || player == null) { return; } int alive = player.playersAndClonesStillAlive; ReviveStatus extra = player.ExtraLife; List<AbilityMonoBehaviour> list = abilitiesRef.Invoke(slime); if (list != null) { foreach (AbilityMonoBehaviour item in new List<AbilityMonoBehaviour>(list)) { if (Died()) { return; } if (!((Object)(object)item == (Object)null) && !((MonoUpdatable)item).IsDestroyed && ((Component)item).gameObject.activeInHierarchy) { IAbilityComponent component = ((Component)item).GetComponent<IAbilityComponent>(); if (component != null) { FixTransform component2 = ((Component)item).GetComponent<FixTransform>(); component.ExitAbility(new AbilityExitInfo { isDead = true, killerId = killerId, position = (((Object)(object)component2 != (Object)null) ? component2.position : player.Position), causeOfDeath = (CauseOfDeath)0 }); } } } } if (!Died()) { PlayerCollision activePlayerCollision = slime.GetActivePlayerCollision(); if ((Object)(object)activePlayerCollision != (Object)null && !((MonoUpdatable)activePlayerCollision).IsDestroyed) { activePlayerCollision.killPlayer(killerId, spawnEffect, true, (CauseOfDeath)0); } } bool Died() { //IL_0034: 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)slime == (Object)null) && !((MonoUpdatable)slime).IsDestroyed && player.playersAndClonesStillAlive == alive) { return player.ExtraLife != extra; } return true; } } } } namespace PoyrazBoplMod.Maps.Aqua { internal static class AquaArrival { public static readonly Fix Depth = (Fix)64L; private static readonly FieldRef<GameSessionHandler, Vec2[]> startRef = AccessTools.FieldRefAccess<GameSessionHandler, Vec2[]>("startPositions"); private static readonly FieldRef<GameSessionHandler, Vec2[]> targetRef = AccessTools.FieldRefAccess<GameSessionHandler, Vec2[]>("targetPositions"); private static readonly FieldRef<GameSessionHandler, Fix[]> delayRef = AccessTools.FieldRefAccess<GameSessionHandler, Fix[]>("randomDelay"); private static readonly FieldRef<GameSessionHandler, StickyRoundedRectangle[]> groundsRef = AccessTools.FieldRefAccess<GameSessionHandler, StickyRoundedRectangle[]>("grounds"); internal static int DebugArranged; internal static bool DebugSawArrival; internal static float DebugSpread; private static StickyRoundedRectangle probe; private static AnimateVelocity probeAv; private static Vector2 probeHome; private static bool Ours => AquaMaps.Current != null; internal static void AfterAwake(GameSessionHandler gsh) { //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_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_006c: 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_0082: Unknown result type (might be due to invalid IL or missing references) if (!Ours) { return; } StickyRoundedRectangle[] array = groundsRef.Invoke(gsh); Vec2[] array2 = startRef.Invoke(gsh); Vec2[] array3 = targetRef.Invoke(gsh); int num = 0; for (int i = 0; i < array.Length; i++) { if (!((Object)(object)array[i] == (Object)null) && !((MonoUpdatable)array[i]).IsDestroyed) { array2[i] = array3[i] - Vec2.up * Depth; ((Component)array[i]).GetComponent<FixTransform>().position = array2[i]; num++; } } DebugArranged = num; } internal static void AfterInit(GameSessionHandler gsh) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) if (Ours) { Fix[] array = delayRef.Invoke(gsh); for (int i = 0; i < array.Length; i++) { array[i] = Fix.Zero; } } } private static bool FindProbe() { //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)probe != (Object)null && !((MonoUpdatable)probe).IsDestroyed && ((Component)probe).gameObject.activeSelf) { return true; } AquaMapDef current = AquaMaps.Current; if (current == null) { return false; } List<StickyRoundedRectangle> blocks = AquaBuilder.Blocks; for (int i = 0; i < blocks.Count && i < current.Blocks.Length; i++) { if (!((Object)(object)blocks[i] == (Object)null) && !((MonoUpdatable)blocks[i]).IsDestroyed && ((Component)blocks[i]).gameObject.activeSelf) { probe = blocks[i]; probeAv = ((Component)probe).GetComponent<AnimateVelocity>(); probeHome = new Vector2(current.Blocks[i].X, current.Blocks[i].Y); return (Object)(object)probeAv != (Object)null; } } return false; } public static float VisualOffset() { //IL_0023: 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_009f: Unknown result type (might be due to invalid IL or missing references) if (!FindProbe() || ((Behaviour)probeAv).enabled) { return 0f; } float num = ((Component)probe).transform.position.y - probeHome.y; if (Mathf.Abs(num) > 0.5f) { DebugSawArrival = true; foreach (DeepSim.Chunk chunk in DeepSim.Chunks) { if ((Object)(object)chunk.Go != (Object)null && chunk.Go.activeSelf) { DebugSpread = Mathf.Max(DebugSpread, Mathf.Abs(chunk.Go.transform.position.y - (float)chunk.Home.y - num)); } } } return num; } } [HarmonyPatch(typeof(GameSessionHandler), "Awake")] internal static class Patch_GameSessionHandler_Awake_Arrival { private static void Postfix(GameSessionHandler __instance) { AquaArrival.AfterAwake(__instance); } } [HarmonyPatch(typeof(GameSessionHandler), "Init")] internal static class Patch_GameSessionHandler_Init_Arrival { private static void Postfix(GameSessionHandler __instance) { AquaArrival.AfterInit(__instance); } } [HarmonyPatch(typeof(MachoThrow2), "OnEnterAbility")] internal static class Patch_MachoThrow_AquaRock { private static readonly FieldRef<MachoThrow2, SpriteRenderer> dummyRef = AccessTools.FieldRefAccess<MachoThrow2, SpriteRenderer>("boulderDummy"); private static readonly FieldRef<MachoThrow2, PlayerPhysics> physicsRef = AccessTools.FieldRefAccess<MachoThrow2, PlayerPhysics>("physics"); internal static string DebugLast; private static void Postfix(MachoThrow2 __instance) { //IL_00d0: 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_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //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_012b: 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) AquaMapDef current = AquaMaps.Current; PlayerPhysics obj = physicsRef.Invoke(__instance); StickyRoundedRectangle val = ((obj != null) ? obj.getAttachedGround() : null); SpriteRenderer val2 = dummyRef.Invoke(__instance); if (current == null || (Object)(object)val == (Object)null || (Object)(object)val2 == (Object)null || (Object)(object)val2.sprite == (Object)null) { return; } int num = AquaBuilder.Blocks.IndexOf(val); if (num < 0 || num >= current.Blocks.Length) { SpriteRenderer component = ((Component)val).GetComponent<SpriteRenderer>(); if ((Object)(object)component != (Object)null && ((Component)val).CompareTag("boulder") && (Object)(object)component.sprite != (Object)null) { val2.sprite = component.sprite; val2.color = component.color; } } else { AquaStyle style = current.Blocks[num].Style; AquaStyle style2 = style; Bounds bounds = val2.sprite.bounds; val2.sprite = AquaSprites.Boulder(style2, ((Bounds)(ref bounds)).size.x); val2.color = Color.white; DebugLast = style.ToString(); Color[] array = (Color[])__instance.boulderSmokeColors.Clone(); array[val.platformType] = AquaGroundFx.Debris(style); __instance.boulderSmokeColors = array; } } } [HarmonyPatch(typeof(RocketEngine), "RocketEngineInit")] internal static class Patch_RocketEngine_Sand { internal static int DebugOnSand; private static void Postfix(StickyRoundedRectangle srr, Vec2 position) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) if (DeepSim.ChunkOf(srr) != null) { DebugOnSand++; SandField.Instance?.Sink((float)position.x, 1.5f, 0.75f, 2.6f); AquaParticles.Instance?.Bubbles((Vector2)position, 10, 0.5f, 1.6f, 0.26f); } } } internal enum AquaStyle { Coral, Sand, Moss, Wreck, Seabed, Abyss, Bone, Rust, Metal, Ruins, Vent, Tentacle, DeepSand, GhostWreck } internal sealed class ArtImage { public readonly int W; public readonly int H; public readonly Color32[] Px; public readonly float Ppu; public float PivotX = 0.5f; public float PivotY = 0.5f; public ArtImage(int w, int h, float ppu) { W = w; H = h; Ppu = ppu; Px = (Color32[])(object)new Color32[w * h]; } } internal static class AquaArt { internal struct Cell { public float F1; public float F2; public float Cx; public float Cy; public int Ix; public int Iy; } private sealed class Palette { public Color Outline; public Color RimLight; public Color Rim; public Color RimDark; public Color RimLine; public float RimMax = 0.78f; public float LobeLen = 1.05f; public float LobeAmp = 0.55f; public int LobeShape; } internal static bool IsDeep(AquaStyle s) { return s >= AquaStyle.Abyss; } internal static uint Hash(int x, int y, int seed) { int num = x * 374761393 + y * 668265263 + seed * 1442695041; int num2 = (num ^ (num >>> 13)) * 1274126177; int num3 = (num2 ^ (num2 >>> 16)) * -2048144777; return (uint)(num3 ^ (num3 >>> 15)); } internal static float Hash01(int x, int y, int seed) { return (float)(Hash(x, y, seed) & 0xFFFFFF) / 16777216f; } internal static float Noise(float x, float y, int seed) { int num = Mathf.FloorToInt(x); int num2 = Mathf.FloorToInt(y); float num3 = x - (float)num; float num4 = y - (float)num2; num3 = num3 * num3 * (3f - 2f * num3); num4 = num4 * num4 * (3f - 2f * num4); float num5 = Hash01(num, num2, seed); float num6 = Hash01(num + 1, num2, seed); float num7 = Hash01(num, num2 + 1, seed); float num8 = Hash01(num + 1, num2 + 1, seed); return Mathf.Lerp(Mathf.Lerp(num5, num6, num3), Mathf.Lerp(num7, num8, num3), num4); } internal static float Fbm(float x, float y, int seed, int octaves = 3) { float num = 0f; float num2 = 0.5f; float num3 = 0f; for (int i = 0; i < octaves; i++) { num += Noise(x, y, seed + i * 101) * num2; num3 += num2; x *= 2.03f; y *= 2.03f; num2 *= 0.5f; } return num / num3; } internal static Cell Voronoi(float x, float y, float size, float jitter, int seed) { float num = x / size; float num2 = y / size; int num3 = Mathf.FloorToInt(num); int num4 = Mathf.FloorToInt(num2); Cell result = new Cell { F1 = 1E+09f, F2 = 1E+09f }; for (int i = -1; i <= 1; i++) { for (int j = -1; j <= 1; j++) { int num5 = num3 + j; int num6 = num4 + i; float num7 = ((float)num5 + 0.5f + (Hash01(num5, num6, seed) - 0.5f) * jitter) * size; float num8 = ((float)num6 + 0.5f + (Hash01(num5, num6, seed + 7) - 0.5f) * jitter) * size; float num9 = x - num7; float num10 = y - num8; float num11 = Mathf.Sqrt(num9 * num9 + num10 * num10); if (num11 < result.F1) { result.F2 = result.F1; result.F1 = num11; result.Cx = num7; result.Cy = num8; result.Ix = num5; result.Iy = num6; } else if (num11 < result.F2) { result.F2 = num11; } } } return result; } internal static float Smooth(float a, float b, float x) { float num = Mathf.Clamp01((x - a) / (b - a)); return num * num * (3f - 2f * num); } internal static Color32 C(int r, int g, int b, int a = 255) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) return new Color32((byte)r, (byte)g, (byte)b, (byte)a); } internal static Color Mul(Color c, float k) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0010: 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_001e: Unknown result type (might be due to invalid IL or missing references) return new Color(c.r * k, c.g * k, c.b * k, c.a); } internal static float RoundRectSd(float x, float y, float w, float h, float r) { float num = Mathf.Abs(x) - w; float num2 = Mathf.Abs(y) - h; 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; } internal static float Perimeter(float x, float y, float w, float h, float r) { float num = Mathf.Clamp(x, 0f - w, w); float num2 = Mathf.Clamp(y, 0f - h, h); float num3 = x - num; float num4 = y - num2; if (Mathf.Abs(num3) < 1E-05f && Mathf.Abs(num4) < 1E-05f) { float num5 = w - Mathf.Abs(x); if (h - Mathf.Abs(y) <= num5) { num4 = ((y >= 0f) ? 2E-05f : (-2E-05f)); num3 = 0f; } else { num3 = ((x >= 0f) ? 2E-05f : (-2E-05f)); num4 = 0f; } } float num6 = MathF.PI / 2f * r; bool flag = Mathf.Abs(num3) >= 1E-05f; bool flag2 = Mathf.Abs(num4) >= 1E-05f; if (!flag && num4 > 0f) { return num + w; } if (flag && flag2 && num3 > 0f && num4 > 0f) { return 2f * w + (MathF.PI / 2f - Mathf.Atan2(num4, num3)) * r; } if (!flag2 && num3 > 0f) { return 2f * w + num6 + (h - num2); } if (flag && flag2 && num3 > 0f && num4 < 0f) { return 2f * w + num6 + 2f * h + Mathf.Atan2(0f - num4, num3) * r; } if (!flag && num4 < 0f) { return 2f * w + 2f * num6 + 2f * h + (w - num); } if (flag && flag2 && num3 < 0f && num4 < 0f) { return 4f * w + 2f * num6 + 2f * h + (MathF.PI / 2f - Mathf.Atan2(0f - num4, 0f - num3)) * r; } if (!flag2 && num3 < 0f) { return 4f * w + 3f * num6 + 2f * h + (num2 + h); } return 4f * w + 3f * num6 + 4f * h + Mathf.Atan2(num4, 0f - num3) * r; } private static Palette PaletteOf(AquaStyle style) { //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_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_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0144: 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_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0184: 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_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_096f: Unknown result type (might be due to invalid IL or missing references) //IL_0974: Unknown result type (might be due to invalid IL or missing references) //IL_0979: Unknown result type (might be due to invalid IL or missing references) //IL_0993: Unknown result type (might be due to invalid IL or missing references) //IL_0998: Unknown result type (might be due to invalid IL or missing references) //IL_099d: Unknown result type (might be due to invalid IL or missing references) //IL_09b4: Unknown result type (might be due to invalid IL or missing references) //IL_09b9: Unknown result type (might be due to invalid IL or missing references) //IL_09be: Unknown result type (might be due to invalid IL or missing references) //IL_09d2: Unknown result type (might be due to invalid IL or missing references) //IL_09d7: Unknown result type (might be due to invalid IL or missing references) //IL_09dc: Unknown result type (might be due to invalid IL or missing references) //IL_09ed: Unknown result type (might be due to invalid IL or missing references) //IL_09f2: Unknown result type (might be due to invalid IL or missing references) //IL_09f7: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: 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) //IL_0213: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_02a2: Unknown result type (might be due to invalid IL or missing references) //IL_02a7: Unknown result type (might be due to invalid IL or missing references) //IL_02ac: Unknown result type (might be due to invalid IL or missing references) //IL_02c3: Unknown result type (might be due to invalid IL or missing references) //IL_02c8: Unknown result type (might be due to invalid IL or missing references) //IL_02cd: Unknown result type (might be due to invalid IL or missing references) //IL_02de: Unknown result type (might be due to invalid IL or missing references) //IL_02e3: Unknown result type (might be due to invalid IL or missing references) //IL_02e8: Unknown result type (might be due to invalid IL or missing references) //IL_02f9: Unknown result type (might be due to invalid IL or missing references) //IL_02fe: Unknown result type (might be due to invalid IL or missing references) //IL_0303: Unknown result type (might be due to invalid IL or missing references) //IL_0314: Unknown result type (might be due to invalid IL or missing references) //IL_0319: Unknown result type (might be due to invalid IL or missing references) //IL_031e: Unknown result type (might be due to invalid IL or missing references) //IL_035d: Unknown result type (might be due to invalid IL or missing references) //IL_0362: Unknown result type (might be due to invalid IL or missing references) //IL_0367: Unknown result type (might be due to invalid IL or missing references) //IL_0381: Unknown result type (might be due to invalid IL or missing references) //IL_0386: Unknown result type (might be due to invalid IL or missing references) //IL_038b: Unknown result type (might be due to invalid IL or missing references) //IL_03a5: Unknown result type (might be due to invalid IL or missing references) //IL_03aa: Unknown result type (might be due to invalid IL or missing references) //IL_03af: Unknown result type (might be due to invalid IL or missing references) //IL_03c9: Unknown result type (might be due to invalid IL or missing references) //IL_03ce: Unknown result type (might be due to invalid IL or missing references) //IL_03d3: Unknown result type (might be due to invalid IL or missing references) //IL_03ea: Unknown result type (might be due to invalid IL or missing references) //IL_03ef: Unknown result type (might be due to invalid IL or missing references) //IL_03f4: Unknown result type (might be due to invalid IL or missing references) //IL_0433: Unknown result type (might be due to invalid IL or missing references) //IL_0438: Unknown result type (might be due to invalid IL or missing references) //IL_043d: Unknown result type (might be due to invalid IL or missing references) //IL_0451: Unknown result type (might be due to invalid IL or missing references) //IL_0456: Unknown result type (might be due to invalid IL or missing references) //IL_045b: Unknown result type (might be due to invalid IL or missing references) //IL_046f: Unknown result type (might be due to invalid IL or missing references) //IL_0474: Unknown result type (might be due to invalid IL or missing references) //IL_0479: Unknown result type (might be due to invalid IL or missing references) //IL_048a: Unknown result type (might be due to invalid IL or missing references) //IL_048f: Unknown result type (might be due to invalid IL or missing references) //IL_0494: Unknown result type (might be due to invalid IL or missing references) //IL_04a5: Unknown result type (might be due to invalid IL or missing references) //IL_04aa: Unknown result type (might be due to invalid IL or missing references) //IL_04af: Unknown result type (might be due to invalid IL or missing references) //IL_04ee: Unknown result type (might be due to invalid IL or missing references) //IL_04f3: Unknown result type (might be due to invalid IL or missing references) //IL_04f8: Unknown result type (might be due to invalid IL or missing references) //IL_050f: Unknown result type (might be due to invalid IL or missing references) //IL_0514: Unknown result type (might be due to invalid IL or missing references) //IL_0519: Unknown result type (might be due to invalid IL or missing references) //IL_0530: Unknown result type (might be due to invalid IL or missing references) //IL_0535: Unknown result type (might be due to invalid IL or missing references) //IL_053a: Unknown result type (might be due to invalid IL or missing references) //IL_0551: Unknown result type (might be due to invalid IL or missing references) //IL_0556: Unknown result type (might be due to invalid IL or missing references) //IL_055b: Unknown result type (might be due to invalid IL or missing references) //IL_056c: Unknown result type (might be due to invalid IL or missing references) //IL_0571: Unknown result type (might be due to invalid IL or missing references) //IL_0576: Unknown result type (might be due to invalid IL or missing references) //IL_05b5: Unknown result type (might be due to invalid IL or missing references) //IL_05ba: Unknown result type (might be due to invalid IL or missing references) //IL_05bf: Unknown result type (might be due to invalid IL or missing references) //IL_05d9: Unknown result type (might be due to invalid IL or missing references) //IL_05de: Unknown result type (might be due to invalid IL or missing references) //IL_05e3: Unknown result type (might be due to invalid IL or missing references) //IL_05fa: Unknown result type (might be due to invalid IL or missing references) //IL_05ff: Unknown result type (might be due to invalid IL or missing references) //IL_0604: Unknown result type (might be due to invalid IL or missing references) //IL_0615: Unknown result type (might be due to invalid IL or missing references) //IL_061a: Unknown result type (might be due to invalid IL or missing references) //IL_061f: Unknown result type (might be due to invalid IL or missing references) //IL_0630: Unknown result type (might be due to invalid IL or missing references) //IL_0635: Unknown result type (might be due to invalid IL or missing references) //IL_063a: Unknown result type (might be due to invalid IL or missing references) //IL_0677: Unknown result type (might be due to invalid IL or missing references) //IL_067c: Unknown result type (might be due to invalid IL or missing references) //IL_0681: Unknown result type (might be due to invalid IL or missing references) //IL_0692: Unknown result type (might be due to invalid IL or missing references) //IL_0697: Unknown result type (might be due to invalid IL or missing references) //IL_069c: Unknown result type (might be due to invalid IL or missing references) //IL_06ad: Unknown result type (might be due to invalid IL or missing references) //IL_06b2: Unknown result type (might be due to invalid IL or missing references) //IL_06b7: Unknown result type (might be due to invalid IL or missing references) //IL_06c8: Unknown result type (might be due to invalid IL or missing references) //IL_06cd: Unknown result type (might be due to invalid IL or missing references) //IL_06d2: Unknown result type (might be due to invalid IL or missing references) //IL_06e2: Unknown result type (might be due to invalid IL or missing references) //IL_06e7: Unknown result type (might be due to invalid IL or missing references) //IL_06ec: Unknown result type (might be due to invalid IL or missing references) //IL_072a: Unknown result type (might be due to invalid IL or missing references) //IL_072f: Unknown result type (might be due to invalid IL or missing references) //IL_0734: Unknown result type (might be due to invalid IL or missing references) //IL_074e: Unknown result type (might be due to invalid IL or missing references) //IL_0753: Unknown result type (might be due to invalid IL or missing references) //IL_0758: Unknown result type (might be due to invalid IL or missing references) //IL_076c: Unknown result type (might be due to invalid IL or missing references) //IL_0771: Unknown result type (might be due to invalid IL or missing references) //IL_0776: Unknown result type (might be due to invalid IL or missing references) //IL_0787: Unknown result type (might be due to invalid IL or missing references) //IL_078c: Unknown result type (might be due to invalid IL or missing references) //IL_0791: Unknown result type (might be due to invalid IL or missing references) //IL_07a2: Unknown result type (might be due to invalid IL or missing references) //IL_07a7: Unknown result type (might be due to invalid IL or missing references) //IL_07ac: Unknown result type (might be due to invalid IL or missing references) //IL_07eb: Unknown result type (might be due to invalid IL or missing references) //IL_07f0: Unknown result type (might be due to invalid IL or missing references) //IL_07f5: Unknown result type (might be due to invalid IL or missing references) //IL_080f: Unknown result type (might be due to invalid IL or missing references) //IL_0814: Unknown result type (might be due to invalid IL or missing references) //IL_0819: Unknown result type (might be due to invalid IL or missing references) //IL_0830: Unknown result type (might be due to invalid IL or missing references) //IL_0835: Unknown result type (might be due to invalid IL or missing references) //IL_083a: Unknown result type (might be due to invalid IL or missing references) //IL_084b: Unknown result type (might be due to invalid IL or missing references) //IL_0850: Unknown result type (might be due to invalid IL or missing references) //IL_0855: Unknown result type (might be due to invalid IL or missing references) //IL_0866: Unknown result type (might be due to invalid IL or missing references) //IL_086b: Unknown result type (might be due to invalid IL or missing references) //IL_0870: Unknown result type (might be due to invalid IL or missing references) //IL_08ae: Unknown result type (might be due to invalid IL or missing references) //IL_08b3: Unknown result type (might be due to invalid IL or missing references) //IL_08b8: Unknown result type (might be due to invalid IL or missing references) //IL_08d2: Unknown result type (might be due to invalid IL or missing references) //IL_08d7: Unknown result type (might be due to invalid IL or missing references) //IL_08dc: Unknown result type (might be due to invalid IL or missing references) //IL_08f0: Unknown result type (might be due to invalid IL or missing references) //IL_08f5: Unknown result type (might be due to invalid IL or missing references) //IL_08fa: Unknown result type (might be due to invalid IL or missing references) //IL_090b: Unknown result type (might be due to invalid IL or missing references) //IL_0910: Unknown result type (might be due to invalid IL or missing references) //IL_0915: Unknown result type (might be due to invalid IL or missing references) //IL_0926: Unknown result type (might be due to invalid IL or missing references) //IL_092b: Unknown result type (might be due to invalid IL or missing references) //IL_0930: Unknown result type (might be due to invalid IL or missing references) switch (style) { case AquaStyle.Coral: return new Palette { Outline = Color32.op_Implicit(C(74, 22, 44)), RimLight = Color32.op_Implicit(C(255, 178, 170)), Rim = Color32.op_Implicit(C(246, 118, 128)), RimDark = Color32.op_Implicit(C(190, 66, 92)), RimLine = Color32.op_Implicit(C(120, 34, 62)), RimMax = 0.95f, LobeLen = 0.95f, LobeAmp = 0.62f, LobeShape = 1 }; case AquaStyle.Sand: case AquaStyle.Seabed: return new Palette { Outline = Color32.op_Implicit(C(92, 60, 30)), RimLight = Color32.op_Implicit(C(255, 241, 196)), Rim = Color32.op_Implicit(C(244, 214, 146)), RimDark = Color32.op_Implicit(C(206, 164, 96)), RimLine = Color32.op_Implicit(C(150, 108, 58)), RimMax = 0.7f, LobeLen = 1.4f, LobeAmp = 0.5f, LobeShape = 2 }; case AquaStyle.Wreck: return new Palette { Outline = Color32.op_Implicit(C(40, 24, 14)), RimLight = Color32.op_Implicit(C(150, 112, 74)), Rim = Color32.op_Implicit(C(112, 76, 46)), RimDark = Color32.op_Implicit(C(78, 50, 30)), RimLine = Color32.op_Implicit(C(46, 28, 16)), RimMax = 0.3f, LobeLen = 2f, LobeAmp = 0f, LobeShape = 3 }; case AquaStyle.Abyss: return new Palette { Outline = Color32.op_Implicit(C(6, 12, 22)), RimLight = Color32.op_Implicit(C(96, 176, 196)), Rim = Color32.op_Implicit(C(44, 100, 124)), RimDark = Color32.op_Implicit(C(24, 60, 84)), RimLine = Color32.op_Implicit(C(10, 30, 46)), RimMax = 0.62f, LobeLen = 0.8f, LobeAmp = 0.7f, LobeShape = 4 }; case AquaStyle.Bone: return new Palette { Outline = Color32.op_Implicit(C(58, 46, 34)), RimLight = Color32.op_Implicit(C(255, 251, 236)), Rim = Color32.op_Implicit(C(238, 228, 204)), RimDark = Color32.op_Implicit(C(204, 190, 158)), RimLine = Color32.op_Implicit(C(154, 136, 106)), RimMax = 0.32f, LobeLen = 2f, LobeAmp = 0f, LobeShape = 3 }; case AquaStyle.Rust: return new Palette { Outline = Color32.op_Implicit(C(28, 16, 10)), RimLight = Color32.op_Implicit(C(198, 124, 82)), Rim = Color32.op_Implicit(C(150, 80, 48)), RimDark = Color32.op_Implicit(C(104, 54, 32)), RimLine = Color32.op_Implicit(C(58, 28, 16)), RimMax = 0.3f, LobeLen = 2f, LobeAmp = 0f, LobeShape = 3 }; case AquaStyle.Metal: return new Palette { Outline = Color32.op_Implicit(C(18, 20, 24)), RimLight = Color32.op_Implicit(C(255, 222, 104)), Rim = Color32.op_Implicit(C(236, 184, 42)), RimDark = Color32.op_Implicit(C(184, 130, 22)), RimLine = Color32.op_Implicit(C(92, 64, 12)), RimMax = 0.36f, LobeLen = 2f, LobeAmp = 0f, LobeShape = 3 }; case AquaStyle.Ruins: return new Palette { Outline = Color32.op_Implicit(C(22, 28, 28)), RimLight = Color32.op_Implicit(C(176, 200, 184)), Rim = Color32.op_Implicit(C(122, 152, 138)), RimDark = Color32.op_Implicit(C(82, 110, 98)), RimLine = Color32.op_Implicit(C(44, 60, 54)), RimMax = 0.34f, LobeLen = 0.9f, LobeAmp = 0.25f, LobeShape = 4 }; case AquaStyle.Vent: return new Palette { Outline = Color32.op_Implicit(C(10, 6, 4)), RimLight = Color32.op_Implicit(C(116, 94, 84)), Rim = Color32.op_Implicit(C(64, 50, 44)), RimDark = Color32.op_Implicit(C(38, 28, 24)), RimLine = Color32.op_Implicit(C(20, 12, 8)), RimMax = 0.5f, LobeLen = 0.75f, LobeAmp = 0.65f, LobeShape = 4 }; case AquaStyle.Tentacle: return new Palette { Outline = Color32.op_Implicit(C(38, 8, 28)), RimLight = Color32.op_Implicit(C(236, 128, 168)), Rim = Color32.op_Implicit(C(180, 64, 112)), RimDark = Color32.op_Implicit(C(124, 36, 82)), RimLine = Color32.op_Implicit(C(72, 18, 50)), RimMax = 0.4f, LobeLen = 0.62f, LobeAmp = 0.3f, LobeShape = 5 }; case AquaStyle.DeepSand: return new Palette { Outline = Color32.op_Implicit(C(38, 34, 32)), RimLight = Color32.op_Implicit(C(200, 190, 164)), Rim = Color32.op_Implicit(C(152, 142, 120)), RimDark = Color32.op_Implicit(C(112, 104, 88)), RimLine = Color32.op_Implicit(C(70, 64, 54)), RimMax = 0.6f, LobeLen = 1.4f, LobeAmp = 0.5f, LobeShape = 2 }; case AquaStyle.GhostWreck: return new Palette { Outline = Color32.op_Implicit(C(8, 16, 14)), RimLight = Color32.op_Implicit(C(150, 186, 146)), Rim = Color32.op_Implicit(C(98, 128, 98)), RimDark = Color32.op_Implicit(C(64, 84, 66)), RimLine = Color32.op_Implicit(C(30, 42, 32)), RimMax = 0.3f, LobeLen = 2f, LobeAmp = 0f, LobeShape = 3 }; default: return new Palette { Outline = Color32.op_Implicit(C(14, 56, 52)), RimLight = Color32.op_Implicit(C(150, 244, 198)), Rim = Color32.op_Implicit(C(62, 202, 152)), RimDark = Color32.op_Implicit(C(28, 128, 104)), RimLine = Color32.op_Implicit(C(16, 86, 74)), RimMax = 1f, LobeLen = 1.05f, LobeAmp = 0.75f, LobeShape = 0 }; } } private static float Lobe(int shape, float t, float jitter) { float num = 1f - Mathf.Abs(2f * t - 1f); return shape switch { 0 => Mathf.Pow(num, 1.7f) * (0.75f + 0.5f * jitter), 1 => Mathf.Sqrt(Mathf.Max(0f, 1f - (2f * t - 1f) * (2f * t - 1f))) * (0.7f + 0.45f * jitter), 2 => (0.5f - 0.5f * Mathf.Cos(t * MathF.PI * 2f)) * (0.6f + 0.6f * jitter), 4 => Mathf.Pow(num, 0.75f) * (0.45f + 1f * jitter), 5 => Mathf.Sqrt(Mathf.Max(0f, 1f - (2f * t - 1f) * (2f * t - 1f))) * (0.35f + 0.3f * jitter), _ => 0f, }; } internal static float MaxPpuFor(float halfW, float halfH) { return Mathf.Sqrt(900000f / Mathf.Max(1f, 4f * halfW * halfH)); } public static ArtImage Platform(AquaStyle style, float w, float h, float r, int seed, float maxPpu = 40f) { //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_024f: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_0272: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Unknown result type (might be due to invalid IL or missing references) //IL_0287: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_02c5: Unknown result type (might be due to invalid IL or missing references) //IL_02e1: Unknown result type (might be due to invalid IL or missing references) //IL_02e6: Unknown result type (might be due to invalid IL or missing references) //IL_02ff: Unknown result type (might be due to invalid IL or missing references) //IL_0301: Unknown result type (might be due to invalid IL or missing references) //IL_0306: Unknown result type (might be due to invalid IL or missing references) //IL_02a6: Unknown result type (might be due to invalid IL or missing references) //IL_02ab: Unknown result type (might be due to invalid IL or missing references) //IL_02be: Unknown result type (might be due to invalid IL or missing references) //IL_02c3: Unknown result type (might be due to invalid IL or missing references) float num = w + r + 0.3f; float num2 = h + r + 0.3f; float num3 = Mathf.Min(new float[4] { maxPpu, 4080f / (2f * num), 4080f / (2f * num2), MaxPpuFor(num, num2) }); int num4 = Mathf.CeilToInt(2f * num * num3); int num5 = Mathf.CeilToInt(2f * num2 * num3); ArtImage artImage = new ArtImage(num4, num5, num3); num = (float)num4 / num3 * 0.5f; num2 = (float)num5 / num3 * 0.5f; Palette palette = PaletteOf(style); float num6 = Mathf.Clamp((Mathf.Min(w, h) + r) * 0.4f, 0.22f, palette.RimMax); float num7 = 4f * w + 4f * h + MathF.PI * 2f * r; int num8 = Mathf.Max(4, Mathf.RoundToInt(num7 / palette.LobeLen)); float num9 = num7 / (float)num8; float num10 = h + r; float wide = w + r; float num11 = 1f / num3; for (int i = 0; i < num5; i++) { float num12 = ((float)i + 0.5f) / num3 - num2; for (int j = 0; j < num4; j++) { float num13 = ((float)j + 0.5f) / num3 - num; float num14 = RoundRectSd(num13, num12, w, h, r); if (!(num14 > num11)) { float num15 = 0f - num14; float a = Mathf.Clamp01(0.5f - num14 * num3); float num16 = Perimeter(num13, num12, w, h, r) / num9; int num17 = Mathf.FloorToInt(num16); float num18 = num16 - (float)num17; float jitter = Hash01(num17 % num8, 3, seed); float num19 = Lobe(palette.LobeShape, num18, jitter); float num20 = num6 * (1f - palette.LobeAmp * 0.45f + palette.LobeAmp * num19); float num21 = Mathf.Clamp(num12 / num10, -1f, 1f); Color val; if (num15 < 0.075f) { val = palette.Outline; } else if (num15 < num20) { val = RimColor(style, palette, num13, num12, num15, num20, num18, num21, seed); float num22 = Smooth(num20 - 0.07f, num20 - 0.025f, num15); val = Color.Lerp(val, palette.RimLine, num22 * 0.85f); } else { val = Interior(style, num13, num12, num15, w, h, r, num10, wide, seed); float num23 = 1f - Smooth(0f, 0.45f, num15 - num20); val = Mul(val, 1f - 0.28f * num23); } if (num15 >= 0.075f && num15 < 0.075f + num11 * 1.5f) { val = Color.Lerp(palette.Outline, val, (num15 - 0.075f) / (num11 * 1.5f)); } val = Mul(val, 0.88f + 0.16f * (num21 * 0.5f + 0.5f)); val.a = a; artImage.Px[i * num4 + j] = Color32.op_Implicit(val); } } } return artImage; } private static Color RimColor(AquaStyle style, Palette pal, float lx, float ly, float din, float rimIn, float lt, float vt, int seed) { //IL_0022: 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_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_0095: 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_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: 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_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_028e: Unknown result type (might be due to invalid IL or missing references) //IL_02a4: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016b: 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_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: 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_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_0296: Unknown result type (might be due to invalid IL or missing references) //IL_029e: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Clamp01((din - 0.075f) / Mathf.Max(0.05f, rimIn - 0.075f)); Color val = Color.Lerp(pal.Rim, pal.RimDark, Smooth(0.35f, 1f, num) * 0.75f); if (vt > 0f) { val = Color.Lerp(val, pal.RimLight, Smooth(0.45f, 0f, num) * Smooth(-0.1f, 0.7f, vt) * 0.75f); } float num2 = Mathf.Sin(lt * MathF.PI); val = Mul(val, 0.9f + 0.14f * num2); float num3 = Fbm(lx * 2.2f, ly * 2.2f, seed + 11, 2); val = Mul(val, 0.93f + 0.14f * num3); switch (style) { default: if (style != AquaStyle.GhostWreck) { if (style >= AquaStyle.Abyss) { val = DeepArt.RimDetail(style, val, lx, ly, num, lt, seed); } break; } goto case AquaStyle.Wreck; case AquaStyle.Coral: { Cell cell = Voronoi(lx, ly, 0.34f, 0.8f, seed + 21); if (Hash01(cell.Ix, cell.Iy, seed + 22) < 0.55f) { float num6 = 0.06f + 0.03f * Hash01(cell.Ix, cell.Iy, seed + 23); if (cell.F1 < num6) { val = Color.Lerp(val, pal.RimLine, 0.55f * (1f - cell.F1 / num6)); } else if (cell.F1 < num6 + 0.035f) { val = Color.Lerp(val, pal.RimLight, 0.5f); } } break; } case AquaStyle.Moss: if (Mathf.Abs(lt - 0.5f) < 0.035f && num > 0.25f) { val = Color.Lerp(val, pal.RimDark, 0.45f); } break; case AquaStyle.Sand: case AquaStyle.Seabed: { float num4 = Hash01(Mathf.FloorToInt(lx * 30f), Mathf.FloorToInt(ly * 30f), seed + 31); if (num4 > 0.93f) { val = Mul(val, 0.86f); } else if (num4 < 0.05f) { val = Color.Lerp(val, Color.white, 0.25f); } break; } case AquaStyle.Wreck: { float num5 = Mathf.Sin(lx * 9f + Fbm(lx * 0.8f, ly * 3f, seed + 41, 2) * 6f); val = Mul(val, 0.94f + 0.06f * num5); break; } } return val; } private static Color Interior(AquaStyle style, float lx, float ly, float din, float w, float h, float r, float tall, float wide, int seed) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_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_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: 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_0200: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0144: 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_015b: 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_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_018a: 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_01f5: 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_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: 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_0212: Unknown result type (might be due to invalid IL or missing references) switch (style) { case AquaStyle.Coral: return Stones(lx, ly, seed, 1.45f, (Color32[])(object)new Color32[5] { C(234, 216, 182), C(220, 198, 160), C(206, 182, 144), C(242, 228, 200), C(236, 186, 172) }, C(128, 94, 84), pores: true); case AquaStyle.Moss: { Color val = Stones(lx, ly, seed, 1.6f, (Color32[])(object)new Color32[5] { C(112, 132, 152), C(96, 116, 140), C(128, 148, 168), C(86, 102, 124), C(104, 126, 132) }, C(38, 48, 64), pores: false); float num = Fbm(lx * 0.45f, ly * 0.45f, seed + 61); if (num > 0.58f) { val = Color.Lerp(val, new Color(0.3f, 0.62f, 0.46f), Smooth(0.58f, 0.7f, num) * 0.6f); } return val; } case AquaStyle.Wreck: return Planks(lx, ly, w, h, r, seed); case AquaStyle.Sand: case AquaStyle.Seabed: return Strata(style, lx, ly, seed); default: return DeepArt.Interior(style, lx, ly, din, w, h, r, seed); } } internal static Color Stones(float lx, float ly, int seed, float size, Color32[] pal, Color32 crack, bool pores) { //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_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_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: 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_0144: 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_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0226: 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_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: 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_01fc: 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_0220: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Unknown result type (might be due to invalid IL or missing references) float num = (Fbm(lx * 0.9f, ly * 0.9f, seed + 3, 2) - 0.5f) * 0.45f; Cell cell = Voronoi(lx + num, ly - num, size, 0.85f, seed); int num2 = (int)(Hash(cell.Ix, cell.Iy, seed + 5) % (uint)pal.Length); Color c = Color32.op_Implicit(pal[num2]); c = Mul(c, 0.9f + 0.18f * Hash01(cell.Ix, cell.Iy, seed + 9)); float num3 = lx + num - cell.Cx; float num4 = ly - num - cell.Cy; float num5 = Mathf.Sqrt(num3 * num3 + num4 * num4) + 0.0001f; float num6 = ((0f - num3) * 0.55f + num4 * 0.8f) / num5 * Mathf.Clamp01(num5 / (size * 0.6f)); c = Mul(c, 1f + 0.2f * num6); float num7 = cell.F2 - cell.F1; c = ((!(num7 < 0.1f)) ? Mul(c, 0.86f + 0.14f * Smooth(0.1f, 0.34f, num7)) : Color.Lerp(c, Color32.op_Implicit(crack), Smooth(0.1f, 0.045f, num7))); c = Mul(c, 0.95f + 0.1f * Noise(lx * 6f, ly * 6f, seed + 13)); if (pores) { Cell cell2 = Voronoi(lx, ly, 0.3f, 0.9f, seed + 17); if (Hash01(cell2.Ix, cell2.Iy, seed + 18) < 0.3f) { float num8 = 0.035f + 0.04f * Hash01(cell2.Ix, cell2.Iy, seed + 19); if (cell2.F1 < num8) { c = Color.Lerp(c, Mul(Color32.op_Implicit(crack), 1.2f), 0.75f); } else if (cell2.F1 < num8 + 0.03f && cell2.Cy > ly) { c = Mul(c, 1.08f); } } } return c; } internal static Color Strata(AquaStyle style, float lx, float ly, int seed) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //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_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_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_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_02ec: Unknown result type (might be due to invalid IL or missing references) //IL_027d: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Unknown result type (might be due to invalid IL or missing references) //IL_02b2: Unknown result type (might be due to invalid IL or missing references) //IL_02b7: Unknown result type (might be due to invalid IL or missing references) //IL_0262: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_02c9: Unknown result type (might be due to invalid IL or missing references) //IL_02d6: Unknown result type (might be due to invalid IL or missing references) //IL_02db: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: Unknown result type (might be due to invalid IL or missing references) //IL_02c5: Unknown result type (might be due to invalid IL or missing references) //IL_02ea: Unknown result type (might be due to invalid IL or missing references) Color32[] array = (Color32[])(object)new Color32[5] { C(238, 200, 136), C(224, 178, 110), C(212, 162, 98), C(242, 214, 158), C(228, 188, 124) }; float num = (Fbm(lx * 0.35f, ly * 0.35f, seed + 71) - 0.5f) * 1.1f + Mathf.Sin(lx * 0.6f + (float)seed) * 0.12f; float num2 = (ly + num) / 0.55f; int num3 = Mathf.FloorToInt(num2); float num4 = num2 - (float)num3; Color val = Color32.op_Implicit(array[Hash((num3 % 97 + 97) % 97, 1, seed + 73) % (uint)array.Length]); if (style == AquaStyle.Seabed) { val = Mul(val, 0.97f); } if (num4 < 0.09f) { val = Color.Lerp(val, Color32.op_Implicit(C(176, 126, 74)), 0.55f * (1f - num4 / 0.09f)); } val = Mul(val, 0.94f + 0.12f * Noise(lx * 3f, ly * 7f, seed + 77)); Cell cell = Voronoi(lx, ly, 1.05f, 0.9f, seed + 79); float num5 = Hash01(cell.Ix, cell.Iy, seed + 80); if (num5 < 0.24f) { float num6 = 0.17f + 0.15f * Hash01(cell.Ix, cell.Iy, seed + 81); float num7 = (lx - cell.Cx) / 1.25f; float num8 = ly - cell.Cy; float num9 = Mathf.Sqrt(num7 * num7 + num8 * num8); if (num9 < num6) { Color val2 = Mul(Color32.op_Implicit((num5 < 0.1f) ? C(150, 146, 140) : ((num5 < 0.18f) ? C(178, 140, 104) : C(208, 204, 196))), 0.85f + 0.3f * Mathf.Clamp01((num8 - num7 * 0.4f) / num6 * 0.5f + 0.5f)); val = ((num9 > num6 - 0.03f) ? Color.Lerp(val2, Color32.op_Implicit(C(90, 70, 50)), 0.6f)