Decompiled source of InkLandscapePeaks v1.1.7
BepInEx/plugins/InkTogether.dll
Decompiled 5 days ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using ExitGames.Client.Photon; using HarmonyLib; using Microsoft.CodeAnalysis; using Newtonsoft.Json; using Photon.Pun; using Photon.Realtime; using UnityEngine; using UnityEngine.Rendering; using UnityEngine.SceneManagement; [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("InkTogether")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.1.7.0")] [assembly: AssemblyInformationalVersion("1.1.7")] [assembly: AssemblyProduct("InkTogether")] [assembly: AssemblyTitle("InkTogether")] [assembly: AssemblyVersion("1.1.7.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 InkTogether { [BepInPlugin("local.ink.peaks", "Ink Landscape Peaks", "1.1.7")] [BepInDependency(/*Could not decode attribute arguments.*/)] public sealed class FactoryRuntime : BaseUnityPlugin { private static readonly RoomSelection Selection = new RoomSelection(); private static readonly object SelectionLock = new object(); private static readonly Type Generator = Type.GetType("PeakMapForge.Generation.RuntimeGenerator, PeakWorkshop"); private static readonly Type NpcType = Type.GetType("PeakMapForge.Npc.NpcManager, PeakWorkshop"); private static readonly FieldInfo ActiveField = ((Generator == null) ? null : AccessTools.Field(Generator, "ActiveMap")); private static readonly PropertyInfo ActiveProperty = Generator?.GetProperty("ActiveMap", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); private static FactoryRuntime instance; private Harmony harmony; private Font font; private object drawnMap; private float next; private float pruneAt = -1f; private AudioSource sound; private readonly List<(GameObject go, TextMesh mesh, string condition, string full, string title)> Signs = new List<(GameObject, TextMesh, string, string, string)>(); private readonly Dictionary<string, AudioClip> Clips = new Dictionary<string, AudioClip>(); private readonly HashSet<string> Heard = new HashSet<string>(); private ConfigEntry<bool> inkWaterEnabled; private ConfigEntry<bool> inkWordsEnabled; private ConfigEntry<bool> inkMotesEnabled; private GameObject coastRoot; private Coroutine coastRoutine; private Texture2D dryBrush; private Material foamPaint; private Material shorePaint; private Material paperPaint; private Material wetPaint; private Mesh foamMesh; private Mesh shoreMesh; private Mesh paperMesh; private Mesh wetMesh; private Font coastFont; private readonly Dictionary<Renderer, bool> waterVisibility = new Dictionary<Renderer, bool>(); private readonly List<TextMesh> coastWords = new List<TextMesh>(); private ParticleSystem inkMotes; private Material motePaint; private bool? waterNight; private float seaY; internal static int CoastSegments; private Transform coastForge; private GameObject inkForest; private readonly List<GameObject> tropicalTrees = new List<GameObject>(); private Texture2D inkSeaTexture; private Material inkSeaMaterial; private Mesh inkSeaMesh; private readonly List<Vector3> skyAnchors = new List<Vector3>(); private static readonly string[] InkPhrases = new string[8] { "听潮", "留白", "云起", "山海", "归舟", "松风", "墨岚", "入画" }; private ConfigEntry<string> initialTime; private object landscapeMap; private object originalSky; private object daySky; private object nightSky; private FieldInfo skyField; internal static bool NightMode; private static int lastFirework = -1; private GameObject fireworkRoot; private ParticleSystem fireworkParticles; private Material fireworkMaterial; private Texture2D fireworkTexture; private readonly List<Vector3> festivalPeaks = new List<Vector3>(); private double fireworksStarted = -100.0; private int burstIndex; private const string DaySkyJson = "{\"time\":12,\"timeSpeed\":0,\"top\":\"#BBC6BA\",\"mid\":\"#E0E4D4\",\"bottom\":\"#F1EBD7\",\"sunColor\":\"#FFF5DC\",\"sunIntensity\":0.85,\"ambient\":0.72,\"ambientColor\":\"#DDDED2\",\"haze\":0.045,\"blend\":1,\"stars\":0,\"aurora\":0,\"fade\":0.4}"; private const string NightSkyJson = "{\"time\":22,\"timeSpeed\":0,\"top\":\"#152329\",\"mid\":\"#425652\",\"bottom\":\"#899384\",\"sunColor\":\"#D1DED9\",\"sunIntensity\":0.4,\"ambient\":0.5,\"ambientColor\":\"#9CAAA6\",\"haze\":0.035,\"blend\":1,\"stars\":0.2,\"aurora\":0,\"fade\":0.4}"; private static bool nativeTwinGeneration; private static long nextHeartbeat; private static readonly MethodInfo Heartbeat = AccessTools.Method(Type.GetType("PeakMapForge.Build.NetKeepAlive, PeakWorkshop"), "Pump", new Type[1] { typeof(bool) }, (Type[])null); private readonly Dictionary<Renderer, Material[]> NativeOriginals = new Dictionary<Renderer, Material[]>(); private readonly Dictionary<(Material, int), Material> CandyMaterials = new Dictionary<(Material, int), Material>(); private static float declutterAt = -1f; private static int declutterPasses; private static object ActiveMap { get { object obj = ActiveProperty?.GetValue(null); if (obj == null) { FieldInfo activeField = ActiveField; if ((object)activeField == null) { return null; } obj = activeField.GetValue(null); } return obj; } } private static string MapRoot => Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)instance).Info.Location), "maps", "ink_peaks"); private static object Manager { get { if (!(NpcType == null)) { return AccessTools.Property(NpcType, "Instance")?.GetValue(null); } return null; } } private static IDictionary Flags { get { if (Manager != null) { return AccessTools.Field(NpcType, "Flags")?.GetValue(Manager) as IDictionary; } return null; } } internal static bool LandscapeBuilding { get { object obj = AccessTools.Field(Generator, "InBuild")?.GetValue(null); bool flag = default(bool); int num; if (obj is bool) { flag = (bool)obj; num = 1; } else { num = 0; } return (byte)((uint)num & (flag ? 1u : 0u)) != 0; } } private static void AttachAdventure(GameObject __result, object spec) { //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Expected O, but got Unknown //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Expected O, but got Unknown //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Expected O, but got Unknown //IL_03ae: Unknown result type (might be due to invalid IL or missing references) //IL_03b5: Expected O, but got Unknown //IL_03f0: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)__result == (Object)null || !OwnMap()) { return; } string text = AccessTools.Field(spec.GetType(), "Group")?.GetValue(spec) as string; if (string.IsNullOrEmpty(text)) { return; } __result.AddComponent<InkPropTag>().Group = text; string[] array = text.Split('|'); if (array[0] == "INK1ZIP" && array.Length == 6) { __result.AddComponent<PhotonView>(); CandyZipHandle handle = __result.AddComponent<CandyZipHandle>(); handle.Id = array[1]; handle.End = new Vector3(Parse(array[2]), Parse(array[3]), Parse(array[4])); handle.Duration = Parse(array[5]); handle.Begin = __result.transform.position; Rigidbody obj = __result.AddComponent<Rigidbody>(); obj.isKinematic = true; obj.useGravity = false; obj.interpolation = (RigidbodyInterpolation)1; obj.collisionDetectionMode = (CollisionDetectionMode)3; handle.CreateTrolleyVisual(); CandyZipHandle candyZipHandle = handle; ((ClimbHandle)candyZipHandle).onHangStart = (Action<Character>)Delegate.Combine(((ClimbHandle)candyZipHandle).onHangStart, (Action<Character>)delegate(Character c) { handle.BeginRide(c); }); CandyZipHandle candyZipHandle2 = handle; ((ClimbHandle)candyZipHandle2).onHangStop = (Action)Delegate.Combine(((ClimbHandle)candyZipHandle2).onHangStop, (Action)delegate { handle.StopRide(); }); } else if (array[0] == "INK1ROPE" && array.Length == 3) { GameObject val = GameObject.Find("INK1 rope site " + array[1]); if ((Object)(object)val != (Object)null) { __result.transform.SetParent(val.transform, true); } __result.AddComponent<PhotonView>(); RopeAnchor obj2 = __result.AddComponent<RopeAnchor>(); GameObject val2 = new GameObject("Native rope attachment"); val2.transform.SetParent(__result.transform, false); obj2.anchorPoint = val2.transform; obj2.normalPart = new GameObject("Anchor visible state"); obj2.normalPart.transform.SetParent(__result.transform, false); obj2.ghostPart = new GameObject("Anchor ghost state"); obj2.ghostPart.transform.SetParent(__result.transform, false); obj2.ghostPart.SetActive(false); __result.AddComponent<CandyFixedRope>().Length = Parse(array[2]); } else if (array[0] == "INK1DOCK" && array.Length == 9) { AttachRopeDock(__result, array); } else if (array[0] == "INK1LAMP") { __result.AddComponent<InkLamp>().StringLights = array.Length > 1 && array[1] == "string"; if (array.Length > 1 && array[1] == "ground") { __result.AddComponent<InkGrounded>(); } } else if (array[0] == "INK1GROUND") { __result.AddComponent<InkGrounded>().Building = array.Length > 1 && array[1] == "building"; } else if (array[0] == "INKSEAL" && array.Length > 1 && array[1] == "ground") { __result.AddComponent<InkGrounded>(); } else if (array[0] == "INK1STATION") { __result.AddComponent<InkStationFoundation>(); } else if (array[0] == "INK1CAR") { __result.AddComponent<InkLamp>(); } else if (array[0] == "INK1DEVICE" && array.Length == 5) { string text2 = "Ink dial " + array[1]; GameObject val3 = GameObject.Find(text2); if ((Object)(object)val3 == (Object)null) { val3 = new GameObject(text2); val3.transform.SetParent(GameObject.Find("PeakMapForge").transform, true); val3.transform.position = new Vector3(Parse(array[2]), Parse(array[3]), Parse(array[4])); val3.AddComponent<InkGrounded>(); } __result.transform.SetParent(val3.transform, true); } if (array[0].StartsWith("INK1", StringComparison.Ordinal)) { object obj3 = AccessTools.Field(Generator, "InBuild")?.GetValue(null); if (obj3 is bool && !(bool)obj3) { AccessTools.Method(Type.GetType("PeakMapForge.Net.NetViews, PeakWorkshop"), "AssignLive", (Type[])null, (Type[])null)?.Invoke(null, new object[1] { __result }); } } } private static float Parse(string s) { return float.Parse(s, CultureInfo.InvariantCulture); } internal static void NormalizeFixedRope(Rope __instance) { //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) object[] instantiationData = ((MonoBehaviourPun)__instance).photonView.InstantiationData; if (instantiationData != null && instantiationData.Length >= 2 && !(instantiationData[0] as string != "ink1.fixed") && !((Object)(object)((Component)__instance).GetComponent<CandyRopeConfigured>() != (Object)null)) { ((Component)__instance).gameObject.AddComponent<CandyRopeConfigured>(); float num = Mathf.Max(0.01f, __instance.ropeSegmentPrefab.transform.localScale.y); ConfigurableJoint component = __instance.ropeSegmentPrefab.GetComponent<ConfigurableJoint>(); __instance.spacing = 1.3f / num - Mathf.Abs(((Joint)component).anchor.y); } } private static void FitLongRopeColliders(Rope __instance) { //IL_0057: Unknown result type (might be due to invalid IL or missing references) CandyRopeConfigured component = ((Component)__instance).GetComponent<CandyRopeConfigured>(); if ((Object)(object)component == (Object)null) { return; } int segmentCount = __instance.SegmentCount; if (component.CollidersFitted == segmentCount) { return; } CapsuleCollider[] componentsInChildren = ((Component)__instance).GetComponentsInChildren<CapsuleCollider>(true); foreach (CapsuleCollider val in componentsInChildren) { if (val.direction == 1) { val.height = Mathf.Max(val.height, 1.35f / Mathf.Max(0.01f, Mathf.Abs(((Component)val).transform.lossyScale.y))); } } component.CollidersFitted = segmentCount; } private static void KeepZipGrip(CharacterClimbing __instance, out Vector2? __state) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) __state = null; Character component = ((Component)__instance).GetComponent<Character>(); if ((Object)(object)component != (Object)null && component.data.currentClimbHandle is CandyZipHandle) { __state = component.input.movementInput; component.input.movementInput = Vector2.zero; } } private static void RestoreZipInput(CharacterClimbing __instance, Vector2? __state) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) if (__state.HasValue) { Character component = ((Component)__instance).GetComponent<Character>(); if ((Object)(object)component != (Object)null) { component.input.movementInput = __state.Value; } } } private static bool On(IDictionary flags, string key) { if (!(key == "wind_ready")) { bool flag = default(bool); int num; if (flags != null && flags.Contains(key)) { object obj = flags[key]; if (obj is bool) { flag = (bool)obj; num = 1; } else { num = 0; } } else { num = 0; } return (byte)((uint)num & (flag ? 1u : 0u)) != 0; } if (On(flags, "fan_a")) { return On(flags, "fan_b"); } return false; } private static bool OwnMap() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) Scene activeScene = SceneManager.GetActiveScene(); if (((Scene)(ref activeScene)).name != "WilIsland") { return false; } object activeMap = ActiveMap; if (activeMap == null) { return false; } string text = AccessTools.Field(activeMap.GetType(), "Id")?.GetValue(activeMap) as string; if (text != "ink_peaks" && text != "ink_factory_lab") { return false; } if (AccessTools.Field(activeMap.GetType(), "Tags")?.GetValue(activeMap) is IEnumerable enumerable) { foreach (string item in enumerable) { if (item == "native-ink-v1") { return true; } } } return false; } private void Awake() { //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Expected O, but got Unknown //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Expected O, but got Unknown //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Expected O, but got Unknown //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Expected O, but got Unknown //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Expected O, but got Unknown //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Expected O, but got Unknown //IL_01cf: Expected O, but got Unknown //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Expected O, but got Unknown //IL_0237: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Expected O, but got Unknown //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_0288: Unknown result type (might be due to invalid IL or missing references) //IL_0293: Expected O, but got Unknown //IL_0293: Expected O, but got Unknown //IL_02c0: Unknown result type (might be due to invalid IL or missing references) //IL_02d5: Unknown result type (might be due to invalid IL or missing references) //IL_02e2: Expected O, but got Unknown //IL_02e2: Expected O, but got Unknown instance = this; initialTime = ((BaseUnityPlugin)this).Config.Bind<string>("景观", "初始时段", "Day", "Day 为白天,Night 为夜晚;地图日晷与月盘也可切换,房间内以房主为准。"); BindInkCoast(); sound = ((Component)this).gameObject.AddComponent<AudioSource>(); sound.spatialBlend = 0f; sound.volume = 0.32f; try { harmony = new Harmony("local.ink.peaks"); Type type = Type.GetType("PeakMapForge.Airport.WorkshopLibrary, PeakWorkshop", throwOnError: true); harmony.Patch((MethodBase)AccessTools.Method(type, "Scan", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(FactoryRuntime), "AddBundledMap", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Type type2 = Type.GetType("PeakMapForge.Net.MapResolver, PeakWorkshop", throwOnError: true); harmony.Patch((MethodBase)AccessTools.Method(type2, "LocalPath", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(FactoryRuntime), "ResolveBundledMap", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); MethodInfo methodInfo = AccessTools.Method(Type.GetType("PeakMapForge.Format.MapLoader, PeakWorkshop", throwOnError: true), "TryLoad", (Type[])null, (Type[])null); MethodInfo methodInfo2 = AccessTools.Method(NpcType, "HostAction", (Type[])null, (Type[])null); if (methodInfo == null || methodInfo2 == null) { throw new MissingMethodException("Installed Workshop loader/action hooks unavailable."); } harmony.Patch((MethodBase)methodInfo, new HarmonyMethod(typeof(FactoryRuntime), "ChooseLayout", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); harmony.Patch((MethodBase)methodInfo2, new HarmonyMethod(typeof(FactoryRuntime), "UniqueFacilityCounter", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); harmony.Patch((MethodBase)AccessTools.Method(typeof(PropGrouper), "RunImmediatelySimple", (Type[])null, (Type[])null), new HarmonyMethod(typeof(FactoryRuntime), "BeforeNativeGeneration", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, new HarmonyMethod(typeof(FactoryRuntime), "AfterNativeGeneration", (Type[])null), (HarmonyMethod)null); harmony.Patch((MethodBase)AccessTools.PropertyGetter(typeof(PropGrouper), "ShouldWaitForFrame"), new HarmonyMethod(typeof(FactoryRuntime), "GenerationHeartbeat", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); harmony.Patch((MethodBase)AccessTools.Method(Type.GetType("PeakMapForge.Build.PropPlacer, PeakWorkshop", throwOnError: true), "Place", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(FactoryRuntime), "AttachAdventure", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); harmony.Patch((MethodBase)AccessTools.Method(typeof(CharacterClimbing), "HandleClimbHandle", (Type[])null, (Type[])null), new HarmonyMethod(typeof(FactoryRuntime), "KeepZipGrip", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, new HarmonyMethod(typeof(FactoryRuntime), "RestoreZipInput", (Type[])null), (HarmonyMethod)null); harmony.Patch((MethodBase)AccessTools.Method(typeof(Rope), "Update", (Type[])null, (Type[])null), new HarmonyMethod(typeof(FactoryRuntime), "NormalizeFixedRope", (Type[])null), new HarmonyMethod(typeof(FactoryRuntime), "FitLongRopeColliders", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Ink Landscape Peaks 1: native mountain climbing, lantern festival, day/night controls and room-locked daily layouts ready."); } catch (Exception ex) { Harmony obj = harmony; if (obj != null) { obj.UnpatchSelf(); } ((BaseUnityPlugin)this).Logger.LogError((object)ex); ((Behaviour)this).enabled = false; } } private static void AddBundledMap(object __result) { try { if (__result == null || !File.Exists(Path.Combine(MapRoot, "map.json")) || !(AccessTools.Field(__result.GetType(), "Entries")?.GetValue(__result) is IList list)) { return; } foreach (object item in list) { if (string.Equals(AccessTools.Field(item.GetType(), "Id")?.GetValue(item) as string, "ink_peaks", StringComparison.OrdinalIgnoreCase)) { return; } } Type? type = Type.GetType("PeakMapForge.Airport.WorkshopLibrary, PeakWorkshop", throwOnError: true); MethodInfo methodInfo = AccessTools.Method(type, "ReadEntry", (Type[])null, (Type[])null); string directoryName = Path.GetDirectoryName(MapRoot); string text = (AccessTools.Property(type, "Name")?.GetValue(null) as string) ?? "local"; object obj = methodInfo?.Invoke(null, new object[8] { directoryName, MapRoot, "ink_peaks", text, false, __result, new Stopwatch(), new Stopwatch() }); if (obj != null) { list.Add(obj); FactoryRuntime factoryRuntime = instance; if (factoryRuntime != null) { ((BaseUnityPlugin)factoryRuntime).Logger.LogInfo((object)"Ink Landscape Peaks: added bundled map to PeakWorkshop browser."); } } } catch (Exception ex) { FactoryRuntime factoryRuntime2 = instance; if (factoryRuntime2 != null) { ((BaseUnityPlugin)factoryRuntime2).Logger.LogError((object)("Ink Landscape Peaks: could not list bundled map: " + ex)); } } } private static void ResolveBundledMap(ref string __result) { if (string.IsNullOrEmpty(__result) || !File.Exists(Path.Combine(MapRoot, "map.json"))) { return; } string path = Path.GetFullPath(__result).TrimEnd(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar); if (string.Equals(Path.GetFileName(path), "ink_peaks", StringComparison.OrdinalIgnoreCase) && string.Equals(Path.GetFileName(Path.GetDirectoryName(path)), "maps", StringComparison.OrdinalIgnoreCase)) { __result = MapRoot; FactoryRuntime factoryRuntime = instance; if (factoryRuntime != null) { ((BaseUnityPlugin)factoryRuntime).Logger.LogInfo((object)"Ink Landscape Peaks: routed active map to bundled folder."); } } } private static int? Advertised() { Room currentRoom = PhotonNetwork.CurrentRoom; if (currentRoom == null || !((Dictionary<object, object>)(object)((RoomInfo)currentRoom).CustomProperties).TryGetValue((object)"ink.layout", out object value) || !(value is int num) || num < 0 || num >= 16) { return null; } return num; } private static void ChooseLayout(string path) { try { if (string.IsNullOrEmpty(path)) { return; } string a = Path.GetFullPath(path).TrimEnd(Path.DirectorySeparatorChar); if ((!string.Equals(a, MapRoot, StringComparison.OrdinalIgnoreCase) && !string.Equals(a, Path.Combine(MapRoot, "map.json"), StringComparison.OrdinalIgnoreCase)) || (PhotonNetwork.InRoom && !PhotonNetwork.IsMasterClient)) { return; } lock (SelectionLock) { RoomSelection selection = Selection; DateTimeOffset utcNow = DateTimeOffset.UtcNow; Room currentRoom = PhotonNetwork.CurrentRoom; int value = selection.Resolve(utcNow, (currentRoom != null) ? currentRoom.Name : null, isHost: true, Advertised()).Value; if (!MapSnapshot.Install(Path.Combine(MapRoot, "_daily", "layout" + value.ToString("00") + ".json"), Path.Combine(MapRoot, "map.json"))) { FactoryRuntime factoryRuntime = instance; if (factoryRuntime != null) { ((BaseUnityPlugin)factoryRuntime).Logger.LogWarning((object)"Daily variant missing; retaining transferable fallback."); } } } } catch (Exception ex) { FactoryRuntime factoryRuntime2 = instance; if (factoryRuntime2 != null) { ((BaseUnityPlugin)factoryRuntime2).Logger.LogWarning((object)("Daily fallback retained: " + ex.Message)); } } } private static bool UniqueFacilityCounter(object __instance, string a, string arg) { if (FestivalAction(a, arg)) { return false; } if (a == "add" && arg == "ink_seals" && OwnMap()) { IDictionary flags = AccessTools.Field(__instance.GetType(), "Flags")?.GetValue(__instance) as IDictionary; MethodInfo methodInfo = AccessTools.Method(__instance.GetType(), "SetFlag", new Type[2] { typeof(string), typeof(bool) }, (Type[])null); int num = 0; for (int i = 0; i < 3; i++) { if (On(flags, "ink_seal_" + i)) { num++; } } if (methodInfo != null) { for (int j = 1; j <= 3; j++) { methodInfo.Invoke(__instance, new object[2] { "ink_seals#" + j, j <= num }); } } return false; } if (a != "add" || arg != "camps" || !OwnMap()) { return true; } IDictionary flags2 = AccessTools.Field(__instance.GetType(), "Flags")?.GetValue(__instance) as IDictionary; MethodInfo methodInfo2 = AccessTools.Method(__instance.GetType(), "SetFlag", new Type[2] { typeof(string), typeof(bool) }, (Type[])null); if (flags2 == null || methodInfo2 == null) { return true; } int num2 = DailyPolicy.UniqueProgress("camps", (string key) => On(flags2, key)); for (int num3 = 1; num3 <= 4; num3++) { if (On(flags2, "camps#" + num3) != num3 <= num2) { methodInfo2.Invoke(__instance, new object[2] { "camps#" + num3, num3 <= num2 }); } } return false; } private void Update() { //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_0204: 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_022f: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Expected O, but got Unknown if (Time.unscaledTime < next) { return; } next = Time.unscaledTime + 0.3f; object obj = (OwnMap() ? ActiveMap : null); bool flag = default(bool); int num; if (obj != null) { object obj2 = AccessTools.Field(Generator, "InBuild")?.GetValue(null); if (obj2 is bool) { flag = (bool)obj2; num = 1; } else { num = 0; } } else { num = 0; } if (((uint)num & (flag ? 1u : 0u)) != 0) { return; } if (drawnMap != obj) { ClearMapPresentation(); drawnMap = obj; if (obj != null) { CreatePresentation(obj); pruneAt = Time.unscaledTime + 3f; } } if (obj != null && pruneAt > 0f && Time.unscaledTime >= pruneAt) { pruneAt = -1f; ClearGlassThorns(); } RunDeclutter(); if (!PhotonNetwork.InRoom) { lock (SelectionLock) { Selection.Reset(); return; } } if (obj == null) { return; } UpdateLandscape(); UpdateInkCoast(); IDictionary flags = Flags; string[] array = new string[4] { "assist_base", "wind_ready", "summit_lit", "home" }; foreach (string text in array) { if (On(flags, text) && Heard.Add(text) && Clips.TryGetValue(text, out var value)) { sound.PlayOneShot(value); } } if (PhotonNetwork.IsMasterClient && !Advertised().HasValue) { int num2 = ((AccessTools.Field(obj.GetType(), "Revision")?.GetValue(obj) is int num3) ? (num3 - 200) : (-1)); if (num2 >= 0 && num2 < 16) { PhotonNetwork.CurrentRoom.SetCustomProperties(new Hashtable { [(object)"ink.layout"] = num2, [(object)"ink.version"] = 1, [(object)"ink.day"] = DailyPolicy.Day(DateTimeOffset.UtcNow) }, (Hashtable)null, (WebFlags)null); } } } private void CreatePresentation(object map) { //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Expected O, but got Unknown //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) try { ApplyNativeTheme(); CreateInkScenery(); CreateLandscape(map); if ((Object)(object)font == (Object)null) { font = Font.CreateDynamicFontFromOSFont(new string[3] { "Microsoft YaHei", "SimHei", "Arial" }, 64); } CreateInkCoast(); IEnumerable enumerable = AccessTools.Field(map.GetType(), "Props")?.GetValue(map) as IEnumerable; if ((Object)(object)font != (Object)null && enumerable != null) { Color val3 = default(Color); foreach (object item2 in enumerable) { Type type = item2.GetType(); if (AccessTools.Field(type, "Group")?.GetValue(item2) is string text && text.StartsWith("INK1|", StringComparison.Ordinal)) { string[] array = text.Split(new char[1] { '|' }, 4); float[] array2 = AccessTools.Field(type, "Pos")?.GetValue(item2) as float[]; if (array.Length == 4 && array2 != null && array2.Length >= 3) { GameObject val = new GameObject("Candy mountain route sign"); val.transform.SetParent(((Component)this).transform, true); val.transform.position = new Vector3(array2[0], array2[1] + 0.5f, array2[2]); TextMesh val2 = val.AddComponent<TextMesh>(); val2.font = font; val2.fontSize = 64; val2.characterSize = 0.09f; val2.anchor = (TextAnchor)7; val2.alignment = (TextAlignment)1; val2.richText = false; val2.characterSize = 0.023f; val2.color = (ColorUtility.TryParseHtmlString(array[1], ref val3) ? val3 : Color.white); ((Renderer)val.GetComponent<MeshRenderer>()).sharedMaterial = font.material; string item = array[3].Split('\n')[0]; Signs.Add((val, val2, array[2], array[3], item)); } } } } AccessTools.Field(map.GetType(), "Id")?.GetValue(map); string path = Path.Combine(MapRoot, "sounds"); string[] array3 = new string[4] { "assist_base", "wind_ready", "summit_lit", "home" }; foreach (string text2 in array3) { string text3 = Path.Combine(path, text2 switch { "summit_lit" => "camp_chime", "wind_ready" => "wind_power", "assist_base" => "bridge_lower", _ => "home", } + ".wav"); if (File.Exists(text3)) { Clips[text2] = ReadPcm(text3, text2); } if (On(Flags, text2)) { Heard.Add(text2); } } ((BaseUnityPlugin)this).Logger.LogInfo((object)("Candy Shore: " + Signs.Count + " world signs and " + Clips.Count + " original sounds loaded.")); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Map presentation: " + ex.Message)); } } private static AudioClip ReadPcm(string file, string name) { using (BinaryReader binaryReader = new BinaryReader(File.OpenRead(file))) { if (new string(binaryReader.ReadChars(4)) != "RIFF") { throw new InvalidDataException("Not a PCM WAV."); } binaryReader.ReadInt32(); binaryReader.ReadBytes(4); int num = 1; int num2 = 22050; int num3 = 16; int num4 = 1; while (binaryReader.BaseStream.Position + 8 <= binaryReader.BaseStream.Length) { string text = new string(binaryReader.ReadChars(4)); int num5 = binaryReader.ReadInt32(); long num6 = binaryReader.BaseStream.Position + num5; if (text == "fmt ") { num4 = binaryReader.ReadInt16(); num = binaryReader.ReadInt16(); num2 = binaryReader.ReadInt32(); binaryReader.ReadInt32(); binaryReader.ReadInt16(); num3 = binaryReader.ReadInt16(); } else if (text == "data") { if (num4 != 1 || num3 != 16 || num5 < 2 || num5 > 3000000) { throw new InvalidDataException("Expected bounded PCM16 WAV."); } float[] array = new float[num5 / 2]; for (int i = 0; i < array.Length; i++) { array[i] = (float)binaryReader.ReadInt16() / 32768f; } AudioClip obj = AudioClip.Create(name, array.Length / num, num, num2, false); obj.SetData(array, 0); return obj; } binaryReader.BaseStream.Position = num6 + (num5 & 1); } } throw new InvalidDataException("WAV has no PCM samples."); } private void LateUpdate() { //IL_005d: 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_014e: 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_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) if (Signs.Count == 0) { return; } Camera main = Camera.main; if ((Object)(object)main == (Object)null) { return; } IDictionary flags = Flags; List<(float, GameObject)> list = new List<(float, GameObject)>(); Vector3 val; foreach (var sign in Signs) { if ((Object)(object)sign.go != (Object)null) { val = sign.go.transform.position - ((Component)main).transform.position; list.Add((((Vector3)(ref val)).sqrMagnitude, sign.go)); } } list.Sort(((float distance, GameObject go) a, (float distance, GameObject go) b) => a.distance.CompareTo(b.distance)); foreach (var sign2 in Signs) { if ((Object)(object)sign2.go == (Object)null) { continue; } bool flag = true; if (sign2.condition.Length > 0) { bool flag2 = sign2.condition[0] == '!'; string key = sign2.condition.Substring(flag2 ? 6 : 5); flag = On(flags, key) != flag2; } val = sign2.go.transform.position - ((Component)main).transform.position; float sqrMagnitude = ((Vector3)(ref val)).sqrMagnitude; bool flag3 = list.Count > 0 && ((Object)(object)list[0].Item2 == (Object)(object)sign2.go || (list.Count > 1 && (Object)(object)list[1].Item2 == (Object)(object)sign2.go)); bool flag4 = flag && flag3 && sqrMagnitude < 144f; if (sign2.go.activeSelf != flag4) { sign2.go.SetActive(flag4); } if (flag4) { sign2.go.transform.rotation = ((Component)main).transform.rotation; string text = ((sqrMagnitude < 25f) ? sign2.full : sign2.title); if (sign2.mesh.text != text) { sign2.mesh.text = text; } } } } private void ClearMapPresentation() { ResetDeclutter(); ClearLandscape(); ClearInkCoast(); ClearNativeTheme(); ClearInkScenery(); foreach (var sign in Signs) { if ((Object)(object)sign.go != (Object)null) { Object.Destroy((Object)(object)sign.go); } } Signs.Clear(); foreach (AudioClip value in Clips.Values) { if ((Object)(object)value != (Object)null) { Object.Destroy((Object)(object)value); } } Clips.Clear(); Heard.Clear(); } private void OnDestroy() { Harmony obj = harmony; if (obj != null) { obj.UnpatchSelf(); } ClearMapPresentation(); if ((Object)(object)font != (Object)null) { Object.Destroy((Object)(object)font); } if ((Object)(object)instance == (Object)(object)this) { instance = null; } } private void BindInkCoast() { inkWaterEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("水墨海岸", "水面与岸线", true, "地图专用淡墨水面与飞白岸线;不修改水域碰撞或游泳机制。"); inkWordsEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("水墨海岸", "空中字景", true, "海岸、山腰与峰顶的天空题字,最多两处;避开攀爬视线中央,滑索时隐藏。"); inkMotesEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("水墨海岸", "少量墨点", false, "可选本地粒子,最多24粒,不碰撞、不发网络消息;默认关闭。"); } private void CreateInkCoast() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00da: 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_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Expected O, but got Unknown //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: 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_01c7: 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_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_0204: 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_0211: Unknown result type (might be due to invalid IL or missing references) //IL_0221: 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_0240: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Expected O, but got Unknown coastRoot = new GameObject("Ink coast visuals"); coastRoot.transform.SetParent(((Component)this).transform, false); CoastSegments = 0; GameObject obj = GameObject.Find("PeakMapForge"); coastForge = ((obj != null) ? obj.transform : null); if (inkWaterEnabled.Value) { CreateInkSea(); dryBrush = BrushTexture(); foamPaint = BrushMaterial("Ink flying-white foam", new Color(0.94f, 0.93f, 0.86f, 1f)); shorePaint = BrushMaterial("Ink scorched shoreline", new Color(0.15f, 0.19f, 0.16f, 1f)); paperPaint = BrushMaterial("Paper-white beach", new Color(0.9f, 0.88f, 0.79f, 1f)); wetPaint = BrushMaterial("Pale-ink tidal wash", new Color(0.65f, 0.7f, 0.63f, 1f)); if (waterVisibility.Count > 0) { coastRoutine = ((MonoBehaviour)this).StartCoroutine(BuildCoast()); } else { ((BaseUnityPlugin)this).Logger.LogWarning((object)"Ink coast: no active compatible water found; skipping shoreline generation."); } } CreateSkyWords(); if (inkMotesEnabled.Value) { GameObject val = new GameObject("Local ink motes"); val.transform.SetParent(coastRoot.transform, false); inkMotes = val.AddComponent<ParticleSystem>(); MainModule main = inkMotes.main; ((MainModule)(ref main)).maxParticles = 24; ((MainModule)(ref main)).startLifetime = MinMaxCurve.op_Implicit(8f); ((MainModule)(ref main)).startSize = MinMaxCurve.op_Implicit(0.08f); ((MainModule)(ref main)).startSpeed = MinMaxCurve.op_Implicit(0.07f); ((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(new Color(0.2f, 0.24f, 0.21f, 0.13f)); ((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)1; EmissionModule emission = inkMotes.emission; ((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(2f); ShapeModule shape = inkMotes.shape; ((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)5; ((ShapeModule)(ref shape)).scale = new Vector3(14f, 6f, 8f); motePaint = new Material(Shader.Find("Particles/Standard Unlit") ?? Shader.Find("Sprites/Default")); ((Renderer)val.GetComponent<ParticleSystemRenderer>()).sharedMaterial = motePaint; } waterNight = null; ((BaseUnityPlugin)this).Logger.LogInfo((object)("Ink coast: " + waterVisibility.Count + " native water renderers visually replaced by one paper/ink sea; native water physics retained. Sea Y=" + seaY)); } private Texture2D BrushTexture() { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(256, 64, (TextureFormat)4, false) { name = "Original procedural dry brush", wrapMode = (TextureWrapMode)0, filterMode = (FilterMode)1 }; Color[] array = (Color[])(object)new Color[16384]; for (int i = 0; i < 64; i++) { for (int j = 0; j < 256; j++) { float num = (float)j / 256f; float num2 = (float)i / 63f; float num3 = Mathf.Sin(num * MathF.PI * 8f + (float)i * 0.73f) * 0.08f; int num4 = j * 374761393 + i * 668265263; float num5 = (float)(uint)(((num4 ^ (num4 >>> 13)) * 1274126177) & 0xFFFF) / 65535f; float num6 = Mathf.Clamp01((0.46f - Mathf.Abs(num2 - 0.5f + num3)) * 7f); float num7 = ((num5 > 0.27f && num6 > 0.15f) ? num6 : 0f); array[i * 256 + j] = new Color(num7, num7, num7, num7); } } val.SetPixels(array); val.Apply(); return val; } private Material BrushMaterial(string label, Color color) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) Material val = new Material(Shader.Find("Universal Render Pipeline/Unlit") ?? Shader.Find("Unlit/Transparent Cutout")) { name = label }; if (val.HasProperty("_BaseMap")) { val.SetTexture("_BaseMap", (Texture)(object)dryBrush); } else { val.mainTexture = (Texture)(object)dryBrush; } ColorIf(val, "_BaseColor", color); ColorIf(val, "_Color", color); FloatIf(val, "_AlphaClip", 1f); FloatIf(val, "_Cutoff", 0.35f); FloatIf(val, "_Cull", 0f); val.EnableKeyword("_ALPHATEST_ON"); val.renderQueue = 2450; return val; } private float GroundHeight(float x, float z) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) float num = -100f; RaycastHit[] array = Physics.RaycastAll(new Vector3(x, 90f, z), Vector3.down, 180f, LayerMask.GetMask(new string[2] { "Map", "Terrain" }), (QueryTriggerInteraction)1); for (int i = 0; i < array.Length; i++) { RaycastHit val = array[i]; if (!((Object)(object)coastForge != (Object)null) || !((RaycastHit)(ref val)).transform.IsChildOf(coastForge)) { string text = ((Object)((RaycastHit)(ref val)).collider).name.ToLowerInvariant(); if (text.Contains("ground") || text.Contains("rock") || text.Contains("wall") || text.Contains("basalt") || text.Contains("cliff")) { num = Mathf.Max(num, ((RaycastHit)(ref val)).point.y); } } } return num; } private IEnumerator BuildCoast() { List<Vector3> fv = new List<Vector3>(); List<Vector2> fu = new List<Vector2>(); List<int> fi = new List<int>(); List<Vector3> sv = new List<Vector3>(); List<Vector2> su = new List<Vector2>(); List<int> si = new List<int>(); List<Vector3> pv = new List<Vector3>(); List<Vector2> pu = new List<Vector2>(); List<int> pi = new List<int>(); List<Vector3> wv = new List<Vector3>(); List<Vector2> wu = new List<Vector2>(); List<int> wi = new List<int>(); float iso = seaY + 0.16f; float[] array = new float[2] { 0f, 780f }; foreach (float centre in array) { float[,] h = new float[29, 29]; int sampled = 0; for (int x = 0; x <= 28; x++) { for (int z = 0; z <= 28; z++) { h[x, z] = GroundHeight(centre - 196f + (float)x * 14f, -520f + (float)z * 14f) - iso; int num = sampled + 1; sampled = num; if (num % 24 == 0) { yield return null; } } } for (int j = 0; j < 28; j++) { for (int k = 0; k < 28; k++) { Vector3[] array2 = (Vector3[])(object)new Vector3[4] { new Vector3(centre - 196f + (float)j * 14f, seaY + 0.07f, -520f + (float)k * 14f), new Vector3(centre - 196f + (float)(j + 1) * 14f, seaY + 0.07f, -520f + (float)k * 14f), new Vector3(centre - 196f + (float)(j + 1) * 14f, seaY + 0.07f, -520f + (float)(k + 1) * 14f), new Vector3(centre - 196f + (float)j * 14f, seaY + 0.07f, -520f + (float)(k + 1) * 14f) }; float[] array3 = new float[4] { h[j, k], h[j + 1, k], h[j + 1, k + 1], h[j, k + 1] }; List<Vector3> list = new List<Vector3>(); float num2 = Mathf.Min(Mathf.Min(array3[0], array3[1]), Mathf.Min(array3[2], array3[3])); float num3 = Mathf.Max(Mathf.Max(array3[0], array3[1]), Mathf.Max(array3[2], array3[3])); if (num2 > 0.2f && num3 < 12f && num3 - num2 < 9f) { bool num4 = num3 < 2f; List<Vector3> list2 = (num4 ? wv : pv); List<Vector2> list3 = (num4 ? wu : pu); List<int> list4 = (num4 ? wi : pi); int count = list2.Count; for (int l = 0; l < 4; l++) { Vector3 val = array2[l]; val.y = array3[l] + iso + 0.055f; list2.Add(val); list3.Add(new Vector2(val.x * 0.065f, val.z * 0.065f)); } list4.AddRange(new int[6] { count, count + 3, count + 2, count, count + 2, count + 1 }); } for (int m = 0; m < 4; m++) { int num5 = (m + 1) % 4; if (array3[m] > 0f != array3[num5] > 0f) { list.Add(Vector3.Lerp(array2[m], array2[num5], Mathf.Clamp01(array3[m] / (array3[m] - array3[num5])))); } } Vector3 val2 = new Vector3(0f - (array3[1] + array3[2] - array3[0] - array3[3]), 0f, 0f - (array3[2] + array3[3] - array3[0] - array3[1])); Vector3 normalized = ((Vector3)(ref val2)).normalized; for (int n = 0; n + 1 < list.Count; n += 2) { Vector3 val3 = list[n]; Vector3 val4 = list[n + 1]; if (!(Vector3.Distance(val3, val4) < 0.3f)) { Strip(val3 + normalized * 0.85f, val4 + normalized * 0.85f, 1.7f, fv, fu, fi); Strip(val3 - normalized * 0.18f, val4 - normalized * 0.18f, 0.7f, sv, su, si); CoastSegments++; } } } } } foamMesh = DrawCoastMesh("Flying-white shoreline", fv, fu, fi, foamPaint); shoreMesh = DrawCoastMesh("Scorched ink shoreline", sv, su, si, shorePaint); paperMesh = DrawCoastMesh("Paper-white sand wash", pv, pu, pi, paperPaint); wetMesh = DrawCoastMesh("Pale-ink intertidal wash", wv, wu, wi, wetPaint); ((BaseUnityPlugin)this).Logger.LogInfo((object)("Ink coast: " + CoastSegments + " shoreline segments in two non-colliding, alpha-clipped mesh batches; no ongoing terrain rays.")); coastRoutine = null; } private static void Strip(Vector3 a, Vector3 b, float width, List<Vector3> v, List<Vector2> uv, List<int> index) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_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_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_005d: 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_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_008e: 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_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) Vector3 val = b - a; Vector3 normalized = ((Vector3)(ref val)).normalized; Vector3 val2 = new Vector3(0f - normalized.z, 0f, normalized.x) * width * 0.5f; int count = v.Count; v.Add(a - val2); v.Add(a + val2); v.Add(b + val2); v.Add(b - val2); float num = Vector3.Distance(a, b) * 0.25f; uv.Add(new Vector2(0f, 0f)); uv.Add(new Vector2(0f, 1f)); uv.Add(new Vector2(num, 1f)); uv.Add(new Vector2(num, 0f)); index.AddRange(new int[6] { count, count + 1, count + 2, count, count + 2, count + 3 }); } private Mesh DrawCoastMesh(string label, List<Vector3> v, List<Vector2> uv, List<int> triangles, Material material) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown //IL_0048: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(label); val.transform.SetParent(coastRoot.transform, false); Mesh val2 = new Mesh { name = label }; val2.SetVertices(v); val2.SetUVs(0, uv); val2.SetTriangles(triangles, 0); val2.RecalculateBounds(); val.AddComponent<MeshFilter>().sharedMesh = val2; MeshRenderer obj = val.AddComponent<MeshRenderer>(); ((Renderer)obj).sharedMaterial = material; ((Renderer)obj).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)obj).receiveShadows = false; return val2; } private void UpdateInkCoast() { //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: 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_01b0: 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_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: 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_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)coastRoot == (Object)null) { return; } if (waterNight != NightMode) { waterNight = NightMode; if ((Object)(object)foamPaint != (Object)null) { ColorIf(foamPaint, "_BaseColor", NightMode ? new Color(0.4f, 0.46f, 0.45f, 1f) : new Color(0.94f, 0.93f, 0.86f, 1f)); ColorIf(paperPaint, "_BaseColor", NightMode ? new Color(0.36f, 0.42f, 0.4f, 1f) : new Color(0.9f, 0.88f, 0.79f, 1f)); ColorIf(wetPaint, "_BaseColor", NightMode ? new Color(0.36f, 0.43f, 0.38f, 1f) : new Color(0.65f, 0.7f, 0.63f, 1f)); } } Camera main = Camera.main; Character localCharacter = Character.localCharacter; if (!((Object)(object)main == (Object)null) && !((Object)(object)localCharacter == (Object)null)) { bool enabled = !localCharacter.data.isClimbing && (Object)(object)localCharacter.data.currentClimbHandle == (Object)null; UpdateInkSea(); UpdateSkyWords(main, localCharacter); if ((Object)(object)inkMotes != (Object)null) { ((Component)inkMotes).transform.position = ((Component)main).transform.position + ((Component)main).transform.forward * 40f + Vector3.up * 6f; EmissionModule emission = inkMotes.emission; ((EmissionModule)(ref emission)).enabled = enabled; } } } private void ClearInkCoast() { if (coastRoutine != null) { ((MonoBehaviour)this).StopCoroutine(coastRoutine); coastRoutine = null; } ClearInkSea(); skyAnchors.Clear(); if ((Object)(object)coastRoot != (Object)null) { Object.Destroy((Object)(object)coastRoot); } coastRoot = null; coastForge = null; coastWords.Clear(); Object[] array = (Object[])(object)new Object[11] { (Object)dryBrush, (Object)foamPaint, (Object)shorePaint, (Object)paperPaint, (Object)wetPaint, (Object)foamMesh, (Object)shoreMesh, (Object)paperMesh, (Object)wetMesh, (Object)coastFont, (Object)motePaint }; foreach (Object val in array) { if (val != (Object)null) { Object.Destroy(val); } } inkMotes = null; waterNight = null; CoastSegments = 0; } private void CreateInkScenery() { //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Expected O, but got Unknown //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: 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_02e4: Unknown result type (might be due to invalid IL or missing references) //IL_02e9: Unknown result type (might be due to invalid IL or missing references) //IL_02ed: Unknown result type (might be due to invalid IL or missing references) //IL_030a: Unknown result type (might be due to invalid IL or missing references) //IL_030f: Unknown result type (might be due to invalid IL or missing references) //IL_0313: 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_0277: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Unknown result type (might be due to invalid IL or missing references) //IL_029a: Unknown result type (might be due to invalid IL or missing references) //IL_029e: 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_0392: Unknown result type (might be due to invalid IL or missing references) //IL_039e: Unknown result type (might be due to invalid IL or missing references) //IL_03a8: Unknown result type (might be due to invalid IL or missing references) //IL_03db: Unknown result type (might be due to invalid IL or missing references) //IL_0415: Unknown result type (might be due to invalid IL or missing references) //IL_048b: Unknown result type (might be due to invalid IL or missing references) //IL_0492: Unknown result type (might be due to invalid IL or missing references) //IL_04c4: Unknown result type (might be due to invalid IL or missing references) GameObject val = GameObject.Find("Map"); GameObject forge = GameObject.Find("PeakMapForge"); if ((Object)(object)val == (Object)null || (Object)(object)forge == (Object)null) { return; } Transform val2 = ((IEnumerable<Transform>)forge.GetComponentsInChildren<Transform>(true)).FirstOrDefault((Func<Transform, bool>)((Transform t) => ((Object)t).name == "model:ink_pine(Clone)")); if ((Object)(object)val2 == (Object)null) { return; } List<Transform> list = (from t in val.GetComponentsInChildren<Transform>(true) where ((Object)t).name.Contains("PalmTree") && ((Object)t).name.Contains("(Clone)") && !t.IsChildOf(forge.transform) orderby t.position.x * 17f + t.position.z * 31f select t).ToList(); inkForest = new GameObject("Ink pine silhouettes"); inkForest.transform.SetParent(((Component)this).transform, false); List<Vector3> list2 = new List<Vector3>(); foreach (Transform tree in list) { bool activeInHierarchy = ((Component)tree).gameObject.activeInHierarchy; if (((Component)tree).gameObject.activeSelf) { tropicalTrees.Add(((Component)tree).gameObject); ((Component)tree).gameObject.SetActive(false); } if (!activeInHierarchy || list2.Count >= 90 || list2.Exists((Vector3 p) => Vector2.Distance(new Vector2(p.x, p.z), new Vector2(tree.position.x, tree.position.z)) < 18f)) { continue; } Vector3 site = tree.position; RaycastHit? val3 = null; RaycastHit[] array = Physics.RaycastAll(site + Vector3.up * 30f, Vector3.down, 100f, LayerMask.GetMask(new string[2] { "Map", "Terrain" }), (QueryTriggerInteraction)1); RaycastHit value2; for (int num = 0; num < array.Length; num++) { RaycastHit value = array[num]; if (((RaycastHit)(ref value)).transform.IsChildOf(forge.transform)) { continue; } string text = ((Object)((RaycastHit)(ref value)).collider).name.ToLowerInvariant(); if (!text.Contains("ground") && !text.Contains("rock") && !text.Contains("wall") && !text.Contains("basalt") && !text.Contains("cliff")) { continue; } if (val3.HasValue) { float num2 = Mathf.Abs(((RaycastHit)(ref value)).point.y - site.y); value2 = val3.Value; if (!(num2 < Mathf.Abs(((RaycastHit)(ref value2)).point.y - site.y))) { continue; } } val3 = value; } if (!val3.HasValue) { continue; } value2 = val3.Value; if (((RaycastHit)(ref value2)).normal.y < 0.4f) { continue; } ref Vector3 reference = ref site; value2 = val3.Value; reference.y = ((RaycastHit)(ref value2)).point.y; if (forge.GetComponentsInChildren<CandyZipHandle>().Any((CandyZipHandle z) => SegmentDistance(site + Vector3.up * 4f, z.Begin, z.End) < 9f)) { continue; } bool flag = false; Transform[] componentsInChildren = forge.GetComponentsInChildren<Transform>(); foreach (Transform val4 in componentsInChildren) { if (((Object)val4).name == "model:guofeng_gondola(Clone)" && Vector2.Distance(new Vector2(site.x, site.z), new Vector2(val4.position.x, val4.position.z)) < 12f) { flag = true; break; } } if (!flag) { GameObject obj = Object.Instantiate<GameObject>(((Component)val2).gameObject, site, Quaternion.Euler(0f, (site.x * 13f + site.z * 7f) % 360f, 0f), inkForest.transform); ((Object)obj).name = "Ink pine"; InkGrounded component = obj.GetComponent<InkGrounded>(); if ((Object)(object)component != (Object)null) { Object.Destroy((Object)(object)component); } float num3 = 0.7f + Mathf.Abs(Mathf.Sin(site.x * 3f + site.z)) * 0.6f; obj.transform.localScale = Vector3.one * num3; Collider[] componentsInChildren2 = obj.GetComponentsInChildren<Collider>(); for (int num = 0; num < componentsInChildren2.Length; num++) { componentsInChildren2[num].enabled = false; } list2.Add(site); } } ((BaseUnityPlugin)this).Logger.LogInfo((object)("Ink scenery: replaced " + tropicalTrees.Count + " tropical palms with " + list2.Count + " spaced original pine silhouettes; native climbing rocks retained.")); } private static float SegmentDistance(Vector3 p, Vector3 a, Vector3 b) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) Vector3 val = b - a; float num = ((((Vector3)(ref val)).sqrMagnitude < 0.001f) ? 0f : Mathf.Clamp01(Vector3.Dot(p - a, val) / ((Vector3)(ref val)).sqrMagnitude)); return Vector3.Distance(p, a + val * num); } private void ClearInkScenery() { if ((Object)(object)inkForest != (Object)null) { Object.Destroy((Object)(object)inkForest); } inkForest = null; foreach (GameObject tropicalTree in tropicalTrees) { if ((Object)(object)tropicalTree != (Object)null) { tropicalTree.SetActive(true); } } tropicalTrees.Clear(); } private void CreateInkSea() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Expected O, but got Unknown //IL_00c5: 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_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: 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_01ec: 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_0208: Expected O, but got Unknown //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_0276: 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_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) //IL_02b3: Expected O, but got Unknown //IL_02c1: Unknown result type (might be due to invalid IL or missing references) //IL_02c2: 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_02cf: Unknown result type (might be due to invalid IL or missing references) //IL_02d5: Unknown result type (might be due to invalid IL or missing references) //IL_02dc: Unknown result type (might be due to invalid IL or missing references) //IL_02e1: 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_02ea: Unknown result type (might be due to invalid IL or missing references) //IL_02f1: Unknown result type (might be due to invalid IL or missing references) //IL_02f8: 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_0304: Unknown result type (might be due to invalid IL or missing references) //IL_0309: Unknown result type (might be due to invalid IL or missing references) //IL_0321: Unknown result type (might be due to invalid IL or missing references) //IL_0327: Unknown result type (might be due to invalid IL or missing references) //IL_032d: Unknown result type (might be due to invalid IL or missing references) //IL_0337: Unknown result type (might be due to invalid IL or missing references) //IL_033c: Unknown result type (might be due to invalid IL or missing references) //IL_0343: Unknown result type (might be due to invalid IL or missing references) //IL_0349: Unknown result type (might be due to invalid IL or missing references) //IL_0350: Unknown result type (might be due to invalid IL or missing references) //IL_035a: Unknown result type (might be due to invalid IL or missing references) //IL_035f: Unknown result type (might be due to invalid IL or missing references) //IL_0366: Unknown result type (might be due to invalid IL or missing references) //IL_036d: Unknown result type (might be due to invalid IL or missing references) //IL_0374: Unknown result type (might be due to invalid IL or missing references) //IL_037e: Unknown result type (might be due to invalid IL or missing references) //IL_0383: Unknown result type (might be due to invalid IL or missing references) //IL_038a: Unknown result type (might be due to invalid IL or missing references) //IL_0391: Unknown result type (might be due to invalid IL or missing references) //IL_0397: Unknown result type (might be due to invalid IL or missing references) //IL_03a1: Unknown result type (might be due to invalid IL or missing references) //IL_03a6: Unknown result type (might be due to invalid IL or missing references) //IL_03dc: Unknown result type (might be due to invalid IL or missing references) //IL_03e1: Unknown result type (might be due to invalid IL or missing references) //IL_03f8: Unknown result type (might be due to invalid IL or missing references) //IL_04ab: Unknown result type (might be due to invalid IL or missing references) //IL_04b0: Unknown result type (might be due to invalid IL or missing references) Bounds val = default(Bounds); bool flag = false; seaY = -100f; Renderer[] array = Object.FindObjectsByType<Renderer>((FindObjectsSortMode)0); foreach (Renderer val2 in array) { if (!val2.enabled || !((Component)val2).gameObject.activeInHierarchy) { continue; } bool flag2 = false; Material[] sharedMaterials = val2.sharedMaterials; foreach (Material val3 in sharedMaterials) { if ((Object)(object)val3 != (Object)null && val3.HasProperty("_WaterColorShallow") && val3.HasProperty("_WaterColorPrimary")) { flag2 = true; break; } } if (flag2) { waterVisibility[val2] = val2.enabled; if (!flag) { val = val2.bounds; flag = true; } else { ((Bounds)(ref val)).Encapsulate(val2.bounds); } float num = seaY; Bounds bounds = val2.bounds; seaY = Mathf.Max(num, ((Bounds)(ref bounds)).center.y); } } if (!flag) { return; } Shader val4 = Shader.Find("Universal Render Pipeline/Unlit"); if ((Object)(object)val4 == (Object)null || !val4.isSupported) { ((BaseUnityPlugin)this).Logger.LogWarning((object)"Ink sea: compatible Unlit shader unavailable; retaining native water."); waterVisibility.Clear(); return; } inkSeaTexture = new Texture2D(2, 2, (TextureFormat)3, true) { name = "Original seamless paper and dry ink", wrapMode = (TextureWrapMode)0, filterMode = (FilterMode)2, anisoLevel = 4 }; using (Stream stream = typeof(FactoryRuntime).Assembly.GetManifestResourceStream("InkTogether.ink-sea.png")) { if (stream == null) { throw new InvalidDataException("Embedded ink-sea.png is missing."); } using MemoryStream memoryStream = new MemoryStream(); stream.CopyTo(memoryStream); if (!ImageConversion.LoadImage(inkSeaTexture, memoryStream.ToArray(), true)) { throw new InvalidDataException("Cannot read embedded ink-sea.png."); } } inkSeaMaterial = new Material(val4) { name = "Ink sea / paper with sparse dry brush", mainTexture = (Texture)(object)inkSeaTexture }; FloatIf(inkSeaMaterial, "_Cull", 0f); FloatIf(inkSeaMaterial, "_Surface", 0f); FloatIf(inkSeaMaterial, "_ZWrite", 1f); Vector3 val5 = default(Vector3); ((Vector3)(ref val5))..ctor(((Bounds)(ref val)).min.x, seaY + 0.035f, ((Bounds)(ref val)).min.z); Vector3 val6 = default(Vector3); ((Vector3)(ref val6))..ctor(((Bounds)(ref val)).max.x, seaY + 0.035f, ((Bounds)(ref val)).max.z); inkSeaMesh = new Mesh { name = "Ink paper sea surface" }; inkSeaMesh.vertices = (Vector3[])(object)new Vector3[4] { val5, new Vector3(val5.x, val5.y, val6.z), val6, new Vector3(val6.x, val5.y, val5.z) }; inkSeaMesh.uv = (Vector2[])(object)new Vector2[4] { new Vector2(val5.x, val5.z) / 720f, new Vector2(val5.x, val6.z) / 720f, new Vector2(val6.x, val6.z) / 720f, new Vector2(val6.x, val5.z) / 720f }; inkSeaMesh.triangles = new int[6] { 0, 1, 2, 0, 2, 3 }; inkSeaMesh.RecalculateBounds(); GameObject val7 = new GameObject("Flying-white ink sea"); val7.transform.SetParent(coastRoot.transform, false); val7.AddComponent<MeshFilter>().sharedMesh = inkSeaMesh; MeshRenderer obj = val7.AddComponent<MeshRenderer>(); ((Renderer)obj).sharedMaterial = inkSeaMaterial; ((Renderer)obj).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)obj).receiveShadows = false; foreach (KeyValuePair<Renderer, bool> item in waterVisibility) { if ((Object)(object)item.Key != (Object)null) { item.Key.enabled = false; } } ((BaseUnityPlugin)this).Logger.LogInfo((object)("Ink sea ready: " + ((Texture)inkSeaTexture).width + "px mipmapped original texture, one opaque draw, zero colliders; native bounds " + ((object)((Bounds)(ref val)).size/*cast due to .constrained prefix*/).ToString() + ".")); } private void UpdateInkSea() { //IL_0045: 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_004a: 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_0081: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)inkSeaMaterial == (Object)null)) { Color c = (NightMode ? new Color(0.82f, 0.84f, 0.8f, 1f) : new Color(0.98f, 0.98f, 0.95f, 1f)); ColorIf(inkSeaMaterial, "_BaseColor", c); float num = (float)(PhotonNetwork.Time % 7200.0); inkSeaMaterial.mainTextureOffset = new Vector2(num * 1.4E-05f, num * 7E-06f); } } private void ClearInkSea() { foreach (KeyValuePair<Renderer, bool> item in waterVisibility) { if ((Object)(object)item.Key != (Object)null) { item.Key.enabled = item.Value; } } waterVisibility.Clear(); Object[] array = (Object[])(object)new Object[3] { (Object)inkSeaTexture, (Object)inkSeaMaterial, (Object)inkSeaMesh }; foreach (Object val in array) { if (val != (Object)null) { Object.Destroy(val); } } inkSeaTexture = null; inkSeaMaterial = null; inkSeaMesh = null; } private void CreateSkyWords() { //IL_0164: 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_0180: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0130: 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) coastFont = Font.CreateDynamicFontFromOSFont(new string[3] { "KaiTi", "STKaiti", "Microsoft YaHei" }, 128); coastFont.RequestCharactersInTexture(string.Join("", InkPhrases), 128); float[] array = new float[2] { 0f, 780f }; foreach (float num in array) { float[] array2 = new float[5] { 26f, 95f, 170f, 245f, 320f }; foreach (float num2 in array2) { float[] array3 = new float[2] { -250f, 250f }; foreach (float num3 in array3) { float[] array4 = new float[3] { -470f, -170f, 170f }; foreach (float num4 in array4) { skyAnchors.Add(new Vector3(num + num3, num2, num4)); } } skyAnchors.Add(new Vector3(num - 100f, num2, -560f)); skyAnchors.Add(new Vector3(num + 100f, num2, -560f)); } } for (int m = 0; m < 2; m++) { GameObject val = new GameObject("Distant ink word"); val.transform.SetParent(coastRoot.transform, false); TextMesh val2 = val.AddComponent<TextMesh>(); val2.font = coastFont; val2.fontSize = 128; val2.characterSize = 0.9f; val2.lineSpacing = 0.92f; val2.anchor = (TextAnchor)4; val2.alignment = (TextAlignment)1; val2.richText = false; MeshRenderer component = val.GetComponent<MeshRenderer>(); ((Renderer)component).sharedMaterial = coastFont.material; ((Renderer)component).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)component).receiveShadows = false; coastWords.Add(val2); val.SetActive(false); } ((BaseUnityPlugin)this).Logger.LogInfo((object)("Ink sky: " + ((Object)coastFont).name + ", " + skyAnchors.Count + " coast/midmountain/summit anchors; at most two vertical calligraphy meshes.")); } private void UpdateSkyWords(Camera camera, Character character) { //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_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_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_026e: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Unknown result type (might be due to invalid IL or missing references) //IL_022b: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_0237: 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_024a: 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_00d0: 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_02df: Unknown result type (might be due to invalid IL or missing references) //IL_02f0: Unknown result type (might be due to invalid IL or missing references) //IL_02fb: Unknown result type (might be due to invalid IL or missing references) //IL_0302: Unknown result type (might be due to invalid IL or missing references) //IL_0321: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: 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_012e: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_015c: 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_0401: Unknown result type (might be due to invalid IL or missing references) //IL_03e0: Unknown result type (might be due to invalid IL or missing references) //IL_040d: Unknown result type (might be due to invalid IL or missing references) //IL_0412: Unknown result type (might be due to invalid IL or missing references) bool num = inkWordsEnabled.Value && ((Object)(object)character.data.currentClimbHandle == (Object)null || ((object)character.data.currentClimbHandle).GetType().Name != "CandyZipHandle"); List<(float, Vector3, Vector3, int)> list = new List<(float, Vector3, Vector3, int)>(); if (num) { for (int i = 0; i < skyAnchors.Count; i++) { Vector3 val = skyAnchors[i]; float num2 = Vector3.Distance(((Component)camera).transform.position, val); if (!(num2 < 100f) && !(num2 > 650f)) { Vector3 val2 = camera.WorldToViewportPoint(val); if (!(val2.z < 0f) && !(val2.x < 0.07f) && !(val2.x > 0.93f) && !(val2.y < 0.52f) && !(val2.y > 0.88f) && (!(Mathf.Abs(val2.x - 0.5f) < 0.18f) || !(val2.y < 0.7f))) { float item = Mathf.Abs(val2.y - 0.75f) * 3f + Mathf.Abs(Mathf.Abs(val2.x - 0.5f) - 0.27f) + num2 * 0.0002f; list.Add((item, val, val2, i)); } } } } list.Sort(((float score, Vector3 point, Vector3 screen, int index) a, (float score, Vector3 point, Vector3 screen, int index) b) => a.score.CompareTo(b.score)); int num3 = 0; int num4 = 0; Vector3 val3 = Vector3.zero; int num5 = (int)(PhotonNetwork.Time / 32.0); float num6 = (float)(PhotonNetwork.Time % 32.0); float num7 = Mathf.Min(Mathf.Clamp01(num6 / 1.5f), Mathf.Clamp01((32f - num6) / 1.5f)); foreach (var item2 in list) { if (num3 == 2 || num4++ >= 10) { break; } if ((num3 <= 0 || !(Vector2.Distance(new Vector2(val3.x, val3.y), new Vector2(item2.Item3.x, item2.Item3.y)) < 0.28f)) && !Physics.Linecast(((Component)camera).transform.position, item2.Item2, LayerMask.GetMask(new string[2] { "Map", "Terrain" }), (QueryTriggerInteraction)1)) { TextMesh val4 = coastWords[num3++]; ((Component)val4).gameObject.SetActive(true); ((Component)val4).transform.position = item2.Item2; ((Component)val4).transform.rotation = ((Component)camera).transform.rotation; ((Component)val4).transform.localScale = Vector3.one * Mathf.Clamp(Vector3.Distance(((Component)camera).transform.position, item2.Item2) / 200f, 0.6f, 3f); string text = InkPhrases[(num5 + item2.Item4 * 3 + DailyPolicy.Slot(DateTimeOffset.UtcNow)) % InkPhrases.Length]; string text2 = string.Join("\n", Array.ConvertAll(text.ToCharArray(), (char c) => c.ToString())); if (val4.text != text2) { val4.text = text2; } float num8 = (character.data.isClimbing ? 0.6f : 1f); val4.color = (NightMode ? new Color(0.8f, 0.84f, 0.8f, num7 * 0.76f * num8) : new Color(0.15f, 0.2f, 0.18f, num7 * 0.72f * num8)); val3 = item2.Item3; } } for (int num9 = num3; num9 < coastWords.Count; num9++) { ((Component)coastWords[num9]).gameObject.SetActive(false); } } internal static void PlacementLog(string message) { FactoryRuntime factoryRuntime = instance; if (factoryRuntime != null) { ((BaseUnityPlugin)factoryRuntime).Logger.LogInfo((object)message); } } private void CreateLandscape(object map) { //IL_0181: Unknown result type (might be due to invalid IL or missing references) landscapeMap = map; object value = AccessTools.Field(map.GetType(), "Base").GetValue(map); skyField = AccessTools.Field(value.GetType(), "Sky"); originalSky = skyField.GetValue(value); daySky = JsonConvert.DeserializeObject("{\"time\":12,\"timeSpeed\":0,\"top\":\"#BBC6BA\",\"mid\":\"#E0E4D4\",\"bottom\":\"#F1EBD7\",\"sunColor\":\"#FFF5DC\",\"sunIntensity\":0.85,\"ambient\":0.72,\"ambientColor\":\"#DDDED2\",\"haze\":0.045,\"blend\":1,\"stars\":0,\"aurora\":0,\"fade\":0.4}", skyField.FieldType); nightSky = JsonConvert.DeserializeObject("{\"time\":22,\"timeSpeed\":0,\"top\":\"#152329\",\"mid\":\"#425652\",\"bottom\":\"#899384\",\"sunColor\":\"#D1DED9\",\"sunIntensity\":0.4,\"ambient\":0.5,\"ambientColor\":\"#9CAAA6\",\"haze\":0.035,\"blend\":1,\"stars\":0.2,\"aurora\":0,\"fade\":0.4}", skyField.FieldType); lastFirework = -1; festivalPeaks.Clear(); foreach (object item in AccessTools.Field(map.GetType(), "Props").GetValue(map) as IEnumerable) { AccessTools.Field(item.GetType(), "Group")?.GetValue(item); object obj = AccessTools.Field(item.GetType(), "Interact")?.GetValue(item); if (obj != null && AccessTools.Field(obj.GetType(), "Name")?.GetValue(obj) is string text && text.Contains("燃放烟花")) { float[] array = AccessTools.Field(item.GetType(), "Pos").GetValue(item) as float[]; festivalPeaks.Add(new Vector3(array[0] + (float)((festivalPeaks.Count == 0) ? 45 : (-45)), array[1] + 42f, array[2] + 20f)); } } } private static bool FestivalAction(string action, string arg) { //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Expected O, but got Unknown if (action != "add" || arg != "ink_fireworks" || !OwnMap()) { return false; } if (PhotonNetwork.IsMasterClient && PhotonNetwork.CurrentRoom != null) { Hashtable customProperties = ((RoomInfo)PhotonNetwork.CurrentRoom).CustomProperties; object value; double num = ((((Dictionary<object, object>)(object)customProperties).TryGetValue((object)"ink.fireworkTime", out value) && value is double num2) ? num2 : (-100.0)); object value2; int num3 = ((((Dictionary<object, object>)(object)customProperties).TryGetValue((object)"ink.fireworkSeq", out value2) && value2 is int num4) ? num4 : 0); if (PhotonNetwork.Time - num > 10.0) { PhotonNetwork.CurrentRoom.SetCustomProperties(new Hashtable { [(object)"ink.fireworkTime"] = PhotonNetwork.Time, [(object)"ink.fireworkSeq"] = num3 + 1 }, (Hashtable)null, (WebFlags)null); } } return true; } private void UpdateLandscape() { //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) if (landscapeMap == null || Flags == null) { return; } if (PhotonNetwork.IsMasterClient && !On(Flags, "ink_time_ready") && Manager != null) { MethodInfo methodInfo = AccessTools.Method(Manager.GetType(), "SetFlag", new Type[2] { typeof(string), typeof(bool) }, (Type[])null); methodInfo.Invoke(Manager, new object[2] { "ink_night", !string.Equals(initialTime.Value, "Day", StringComparison.OrdinalIgnoreCase) }); methodInfo.Invoke(Manager, new object[2] { "ink_time_ready", true }); } bool flag = (NightMode = On(Flags, "ink_night")); object value = AccessTools.Field(landscapeMap.GetType(), "Base").GetValue(landscapeMap); object obj = (flag ? nightSky : daySky); if (skyField.GetValue(value) != obj) { skyField.SetValue(value, obj); } Camera main = Camera.main; Vector3 eye = (((Object)(object)main != (Object)null) ? ((Component)main).transform.position : Vector3.zero); List<InkLamp> all = InkLamp.All; List<InkLamp> list = new List<InkLamp>(); foreach (InkLamp item in all) { if ((Object)(object)item == (Object)null) { continue; } item.SetNight(flag); item.SetPoint(on: false); if (flag && (Object)(object)item.Source != (Object)null) { Vector3 val = ((Component)item).transform.position - eye; if (((Vector3)(ref val)).sqrMagnitude < 1600f) { list.Add(item); } } } list.Sort(delegate(InkLamp a, InkLamp b) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: 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_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) Vector3 val2 = ((Component)a).transform.position - eye; float sqrMagnitude = ((Vector3)(ref val2)).sqrMagnitude; val2 = ((Component)b).transform.position - eye; return sqrMagnitude.CompareTo(((Vector3)(ref val2)).sqrMagnitude); }); for (int num = 0; num < Math.Min(12, list.Count); num++) { list[num].SetPoint(on: true); } Room currentRoom = PhotonNetwork.CurrentRoom; if (currentRoom != null && ((Dictionary<object, object>)(object)((RoomInfo)currentRoom).CustomProperties).TryGetValue((object)"ink.fireworkSeq", out object value2) && value2 is int num2 && num2 != lastFirework) { lastFirework = num2; if (((Dictionary<object, object>)(object)((RoomInfo)currentRoom).CustomProperties).TryGetValue((object)"ink.fireworkTime", out object value3) && value3 is double num3 && PhotonNetwork.Time - num3 < 12.0) { fireworksStarted = num3; burstIndex = 0; EnsureFireworks(); } } if ((Object)(object)fireworkParticles != (Object)null && PhotonNetwork.Time - fireworksStarted < 12.0 && PhotonNetwork.Time - fireworksStarted >= (double)burstIndex * 1.35) { BurstFireworks(burstIndex++); } } private void EnsureFireworks() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_007e: 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_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_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_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: 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_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Expected O, but got Unknown //IL_013a: 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_014f: 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_0160: Expected O, but got Unknown //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Expected O, but got Unknown //IL_02b8: Unknown result type (might be due to invalid IL or missing references) //IL_02c2: Expected O, but got Unknown //IL_02fb: Unknown result type (might be due to invalid IL or missing references) //IL_0300: Unknown result type (might be due to invalid IL or missing references) //IL_031d: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)fireworkParticles != (Object)null) { return; } fireworkRoot = new GameObject("Ink festival fireworks"); fireworkRoot.transform.SetParent(((Component)this).transform, false); fireworkParticles = fireworkRoot.AddComponent<ParticleSystem>(); MainModule main = fireworkParticles.main; ((MainModule)(ref main)).loop = true; ((MainModule)(ref main)).playOnAwake = false; ((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)1; ((MainModule)(ref main)).maxParticles = 1500; ((MainModule)(ref main)).startLifetime = MinMaxCurve.op_Implicit(3f); ((MainModule)(ref main)).startSize = MinMaxCurve.op_Implicit(0.3f); ((MainModule)(ref main)).gravityModifier = MinMaxCurve.op_Implicit(0.14f); EmissionModule emission = fireworkParticles.emission; ((EmissionModule)(ref emission)).enabled = false; ShapeModule shape = fireworkParticles.shape; ((ShapeModule)(ref shape)).enabled = false; SizeOverLifetimeModule sizeOverLifetime = fireworkParticles.sizeOverLifetime; ((SizeOverLifetimeModule)(ref sizeOverLifetime)).enabled = true; ((SizeOverLifetimeModule)(ref sizeOverLifetime)).size = new MinMaxCurve(1f, new AnimationCurve((Keyframe[])(object)new Keyframe[3] { new Keyframe(0f, 0.4f), new Keyframe(0.15f, 1f), new Keyframe(1f, 0f) })); ColorOverLifetimeModule colorOverLifetime = fireworkParticles.colorOverLifetime; ((ColorOverLifetimeModule)(ref colorOverLifetime)).enabled = true; Gradient val = new Gradient(); val.SetKeys((GradientColorKey[])(object)new GradientColorKey[2] { new GradientColorKey(Color.white, 0f), new GradientColorKey(Color.white, 1f) }, (GradientAlphaKey[])(object)new GradientAlphaKey[2] { new GradientAlphaKey(1f, 0f), new GradientAlphaKey(0f, 1f) }); ((ColorOverLifetimeModule)(ref colorOverLifetime)).color = MinMaxGradient.op_Implicit(val); fireworkTexture = new Texture2D(16, 16, (TextureFormat)4, false); Color[] array = (Color[])(object)new Color[256]; for (int i = 0; i < 16; i++) { for (int j = 0; j < 16; j++) { Vector2 val2 = new Vector2(((float)j - 7.5f) / 7.5f, ((float)i - 7.5f) / 7.5f); float magnitude = ((Vector2)(ref val2)).magnitude; array[i * 16 + j] = new Color(1f, 1f, 1f, Mathf.Clamp01(1f - magnitude * magnitude)); } } fireworkTexture.SetPixels(array); fireworkTexture.Apply(); fireworkMaterial = new Material(Shader.Find("Universal Render Pipeline/Particles/Unlit") ?? Shader.Find("Particles/Standard Unlit") ?? Shader.Find("Sprites/Default")); fireworkMaterial.mainTexture = (Texture)(object)fireworkTexture; ParticleSystemRenderer component = ((Component)fireworkParticles).GetComponent<ParticleSystemRenderer>(); ((Renderer)component).material = fireworkMaterial; component.maxParticleSize = 0.03f; TrailModule trails = fireworkParticles.trails; ((TrailModule)(ref trails)).enabled = true; ((TrailModule)(ref trails)).ratio = 0.8f; ((TrailModule)(ref trails)).lifetime = MinMaxCurve.op_Implicit(0.25f); ((TrailModule)(ref trails)).minVertexDistance = 0.15f; ((TrailModule)(ref trails)).dieWithParticles = true; component.trailMaterial = fireworkMaterial; fireworkParticles.Play(); } private void BurstFireworks(int index) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_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_0086: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_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_00eb: 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_0111: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0161: 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) Color[] array = (Color[])(object)new Color[4] { new Color(1f, 0.9f, 0.66f), new Color(0.82f, 0.7f, 0.52f), new Color(0.8f, 0.88f, 0.88f), new Color(0.92f, 0.83f, 0.7f) }; foreach (Vector3 festiv