Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of Thoracle v1.0.0
Thoracle/Thoracle.dll
Decompiled 3 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Text; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using MagicaCloth2; using UnityEngine; using UnityEngine.Rendering; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("Thoracle")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Thoracle")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("99ec345a-6acb-4712-9da9-5f623d38a6fe")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace Thoracle; internal class Boat : MonoBehaviour { private VisionControllerOcean VisionControllerOcean; private GameObject boatObject; public GameObject m_mastObject; public MagicaCloth m_sailCloth; public AnimationCurve m_sailBlendWeightCurve = AnimationCurve.Linear(0f, 0f, 1f, 1f); private float m_sailPosition; private bool m_sailWasInPosition; public EffectList m_changeSailPosEffect = new EffectList(); private Speed m_speed; private Transform boatTransform; public Transform m_sailBottomTransform; public Transform m_sailFurledPosition; public Transform m_sailMidfurledPosition; public Transform m_sailUnfurledPosition; public Transform m_karveSail1; public Transform m_sailTop; private Transform m_sailSkeleton; private bool resetCloth; private float lastAngle = -1000f; public void Initialize(ThoracleMod.IThoracleController controller, Transform parent, float sphereRadius, float waterLevel) { //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) VisionControllerOcean = (VisionControllerOcean)controller; boatObject = MiniKarve.CreateSafeMiniBoat(parent, sphereRadius, waterLevel); Traverse.Create((object)boatObject); typeof(Ship).GetField("m_speed", BindingFlags.Instance | BindingFlags.NonPublic); boatTransform = boatObject.transform; Transform val = TransformUtility.FindRecursive(boatObject.transform, "mast"); m_mastObject = ((Component)val).gameObject; m_sailCloth = boatObject.GetComponentInChildren<MagicaCloth>(); m_sailCloth.ResetCloth(false); m_sailBottomTransform = TransformUtility.FindRecursive(val, "Sail_Bottom"); m_sailUnfurledPosition = TransformUtility.FindRecursive(val, "UnfurledPosition"); m_sailFurledPosition = TransformUtility.FindRecursive(val, "FurledPosition"); m_sailMidfurledPosition = TransformUtility.FindRecursive(val, "MidFurledPosition"); m_sailTop = TransformUtility.FindRecursive(val, "Sail_Top"); m_karveSail1 = TransformUtility.FindRecursive(val, "Karve_Sail"); m_sailSkeleton = TransformUtility.FindRecursive(val, "Karve_Sail_Skeleton"); _ = ((Component)m_sailBottomTransform).transform.rotation * Vector3.forward; resetCloth = true; m_sailCloth.DisableAutoBuild(); } public void Reinit() { } public GameObject GetBoatObject() { return boatObject; } public void Update() { if (!((Object)(object)VisionControllerOcean == (Object)null)) { Weather weather = VisionControllerOcean.GetWeather(); if (weather != null) { _ = weather.InterpolatedWindIntensity; UpdateShip(); } } } private void UpdateShip() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) Weather weather = VisionControllerOcean.GetWeather(); _ = weather.InterpolatedWindDirection; float interpolatedWindIntensity = weather.InterpolatedWindIntensity; float num = Mathf.PerlinNoise(Time.time * 6f, 0f); bool num2 = interpolatedWindIntensity > 0.8f; interpolatedWindIntensity += num * weather.InterpolatedWindIntensity * 0.3f; float num3 = (num2 ? (interpolatedWindIntensity * 0.5f) : interpolatedWindIntensity); float fixedDeltaTime = Time.fixedDeltaTime; UpdateSailSize(weather, fixedDeltaTime); if ((Object)(object)m_sailCloth != (Object)null && m_sailCloth.IsValid()) { if (resetCloth) { m_sailCloth.ResetCloth(false); resetCloth = false; } Vector3 interpolatedWindDirection = weather.InterpolatedWindDirection; m_sailCloth.GetCustomMesh((Renderer)null); m_sailCloth.GetOriginalMesh((Renderer)null); Transform transform = boatObject.transform; interpolatedWindDirection = Vector3.Cross(Vector3.Cross(interpolatedWindDirection, transform.up), transform.up); Vector3 val = boatObject.transform.InverseTransformDirection(interpolatedWindDirection); m_sailCloth.AddForce(val, num3, (ClothForceMode)2); } else { AnimateSailManual(weather, num3, fixedDeltaTime); } } private void AdjustSailInertia(MagicaCloth cloth) { if (!((Object)(object)cloth == (Object)null)) { cloth.SerializeData.inertiaConstraint.worldInertia = 0f; cloth.SerializeData.inertiaConstraint.localInertia = 0f; cloth.SerializeData.inertiaConstraint.centrifualAcceleration = 0f; cloth.SerializeData.inertiaConstraint.movementSpeedLimit.use = true; cloth.SerializeData.inertiaConstraint.movementSpeedLimit.value = 3f; cloth.SerializeData.inertiaConstraint.rotationSpeedLimit.use = true; cloth.SerializeData.inertiaConstraint.rotationSpeedLimit.value = 180f; cloth.SetParameterChange(); } } public void AnimateSailManual(Weather weather, float windIntensity, float dt) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: 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_0048: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0131: 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_0154: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)m_sailBottomTransform == (Object)null)) { Vector3 interpolatedWindDirection = weather.InterpolatedWindDirection; Vector3 direction = -boatTransform.InverseTransformDirection(((Vector3)(ref interpolatedWindDirection)).normalized); float num = Mathf.Clamp01(windIntensity); float num2 = Mathf.Max(20f, num * 100f); float num3 = CalculateAngleToNorth(direction, 0); if (num3 > 180f) { num3 -= 360f; } if (num3 < -60f) { num3 = -60f; } else if (num3 > 60f) { num3 = 60f; } if (lastAngle > -1000f) { Mathf.Abs(lastAngle - num3); _ = 3f; } float num4 = (0f - num3) * num * 1.5f; float num5 = Mathf.Sign(num4); float num6 = Mathf.Clamp(Mathf.Abs(num3), 0f, 100f) / 5f; num4 = num5 * Mathf.Min(Mathf.Abs(num4), 35f); if (weather.InterpolatedWindIntensity > 0.8f) { num4 *= 0.5f; } Quaternion val = Quaternion.Euler(0f, num4, num2); m_sailBottomTransform.localRotation = Quaternion.RotateTowards(m_sailBottomTransform.localRotation, val, 10f * num6 * dt); lastAngle = num3; Quaternion val2 = Quaternion.Euler(0f, num3, 0f); m_mastObject.transform.localRotation = Quaternion.RotateTowards(m_mastObject.transform.localRotation, val2, num6 * dt); } } private float CalculateAngleToNorth(Vector3 direction, int offset) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) Transform parent = boatObject.transform.parent; return Mathf.Repeat(Vector3.SignedAngle(parent.forward, direction, parent.up) + (float)offset, 360f); } private void UpdateSailSize(Weather weather, float dt) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Invalid comparison between Unknown and I4 //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Invalid comparison between Unknown and I4 //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) _ = weather.InterpolatedWindDirection; _ = weather.InterpolatedWindIntensity; _ = m_speed; m_speed = (Speed)(weather.weatherType.Equals(WeatherForecast.WeatherConditionType.Thunderstorm) ? 3 : 4); float num = 0f; Speed speed = m_speed; if ((int)speed != 3) { if ((int)speed == 4) { num = 1f; } } else { num = 0.5f; } m_sailPosition = Mathf.MoveTowards(m_sailPosition, num, dt); bool flag = Mathf.Approximately(m_sailPosition, num); Vector3 position = m_sailFurledPosition.position; Vector3 position2 = m_sailMidfurledPosition.position; if (m_sailPosition >= 0.5f) { position = m_sailMidfurledPosition.position; position2 = m_sailUnfurledPosition.position; } if (!flag && m_sailWasInPosition) { m_changeSailPosEffect.Create(boatObject.transform.position, Quaternion.identity, (Transform)null, 1f, -1, ZDOID.None); Debug.Log((object)"Event"); } float num2 = Utils.Frac(Mathf.Clamp(m_sailPosition, 0f, 0.999f) * 2f); m_sailBottomTransform.position = Vector3.Lerp(position, position2, num2); float blendWeight = m_sailBlendWeightCurve.Evaluate(m_sailPosition); m_sailCloth.SerializeData.blendWeight = blendWeight; m_sailCloth.SetParameterChange(); m_sailWasInPosition = flag; } } public static class ColorHelper { public struct ValheimColors { public Color ZenithColor; public Color HorizonColor; public Color CloudZenithColor; public Color CloudHorizonColor; public Color SunColor; public float Exposure; public Color rainDropColor; public Color windStreakColor; public Color fogColor; public float rainBlend; public float stormFactor; public float lightIntensity; } public class ColorEntry { public Color top; public Color bottom; } public struct GradientColors { public Color ZenitColor; public Color HorizontColor; } private static Dictionary<int, ColorEntry> timeIndex2Color = new Dictionary<int, ColorEntry>(); private static ColorEntry stormColor; private static ColorEntry fogColor; private static bool initialized = false; public static float m_sunHorizonTransitionH = 0.08f; public static float m_sunHorizonTransitionL = 0.02f; public static ValheimColors GetValheimColors(Weather weather) { //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: 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_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0152: 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_015a: 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: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0188: 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_0194: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: 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_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_020f: 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_0228: 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_024b: Unknown result type (might be due to invalid IL or missing references) //IL_0250: Unknown result type (might be due to invalid IL or missing references) //IL_0373: Unknown result type (might be due to invalid IL or missing references) //IL_0377: Unknown result type (might be due to invalid IL or missing references) //IL_037c: Unknown result type (might be due to invalid IL or missing references) //IL_037e: Unknown result type (might be due to invalid IL or missing references) //IL_0382: Unknown result type (might be due to invalid IL or missing references) //IL_0387: 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_038d: Unknown result type (might be due to invalid IL or missing references) //IL_0394: Unknown result type (might be due to invalid IL or missing references) //IL_0396: Unknown result type (might be due to invalid IL or missing references) //IL_039d: Unknown result type (might be due to invalid IL or missing references) //IL_03a4: Unknown result type (might be due to invalid IL or missing references) //IL_03ae: Unknown result type (might be due to invalid IL or missing references) //IL_03b3: Unknown result type (might be due to invalid IL or missing references) //IL_03ba: Unknown result type (might be due to invalid IL or missing references) //IL_03c1: Unknown result type (might be due to invalid IL or missing references) //IL_03cb: Unknown result type (might be due to invalid IL or missing references) //IL_03d0: Unknown result type (might be due to invalid IL or missing references) //IL_03d7: Unknown result type (might be due to invalid IL or missing references) //IL_03d9: Unknown result type (might be due to invalid IL or missing references) //IL_03ef: Unknown result type (might be due to invalid IL or missing references) //IL_03f4: Unknown result type (might be due to invalid IL or missing references) //IL_0401: Unknown result type (might be due to invalid IL or missing references) //IL_0406: Unknown result type (might be due to invalid IL or missing references) //IL_040f: Unknown result type (might be due to invalid IL or missing references) //IL_0414: Unknown result type (might be due to invalid IL or missing references) //IL_0421: Unknown result type (might be due to invalid IL or missing references) //IL_0426: Unknown result type (might be due to invalid IL or missing references) //IL_0433: Unknown result type (might be due to invalid IL or missing references) //IL_0438: Unknown result type (might be due to invalid IL or missing references) //IL_027e: Unknown result type (might be due to invalid IL or missing references) //IL_0280: Unknown result type (might be due to invalid IL or missing references) //IL_0284: Unknown result type (might be due to invalid IL or missing references) //IL_029c: 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_02c4: Unknown result type (might be due to invalid IL or missing references) //IL_02cb: Unknown result type (might be due to invalid IL or missing references) //IL_02d0: Unknown result type (might be due to invalid IL or missing references) //IL_02d2: Unknown result type (might be due to invalid IL or missing references) //IL_02d4: Unknown result type (might be due to invalid IL or missing references) //IL_02de: Unknown result type (might be due to invalid IL or missing references) //IL_02e3: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: Unknown result type (might be due to invalid IL or missing references) //IL_02f9: Unknown result type (might be due to invalid IL or missing references) //IL_02fe: Unknown result type (might be due to invalid IL or missing references) float currentDayFraction = weather.GetCurrentDayFraction(); EnvSetup interpolatedSetup = weather.InterpolatedSetup; GetTimeWeights(currentDayFraction, out var morning, out var day, out var evening, out var night); ValheimColors result = default(ValheimColors); result.rainBlend = Mathf.Clamp01((weather.ClearToRain - 0.2f) * 1.5f); result.stormFactor = Mathf.Clamp01((result.rainBlend - 0.7f) * 3.3f); float exposure = (night + 0.5f * morning + 0.5f * evening) * 2.5f; Color val = interpolatedSetup.m_fogColorDay * day + interpolatedSetup.m_fogColorMorning * morning + interpolatedSetup.m_fogColorEvening * evening + interpolatedSetup.m_fogColorNight * night; Color val2 = Color.Lerp(interpolatedSetup.m_fogColorDay * 0.7f, interpolatedSetup.m_fogColorSunDay, 0.3f) * day + interpolatedSetup.m_fogColorSunMorning * morning + interpolatedSetup.m_fogColorSunEvening * evening + interpolatedSetup.m_fogColorSunNight * night; Color sunColor = interpolatedSetup.m_sunColorDay * day + interpolatedSetup.m_sunColorMorning * morning + interpolatedSetup.m_sunColorEvening * evening + interpolatedSetup.m_sunColorNight * night; _ = interpolatedSetup.m_fogColorDay * day + interpolatedSetup.m_fogColorMorning * morning + interpolatedSetup.m_fogColorEvening * evening + interpolatedSetup.m_fogColorNight * night; if (day > 0f) { float num = Mathf.Min(val2.g, val2.b * 0.85f); float num2 = Mathf.Max(val2.b, 0.6f); Color val3 = default(Color); ((Color)(ref val3))..ctor(val2.r * 0.9f, num, num2, val2.a); val2 = Color.Lerp(val2, val3, day * 1.5f); } if (result.rainBlend > 0f) { val2 = ShiftSaturation(val2, 1f - weather.ClearToRain * 0.7f); } if (weather.ClearToFog > 0f) { val2 = ShiftSaturation(val2, 1f - weather.ClearToFog * 0.7f); } float num3 = morning + evening; if (num3 > 0f) { Color val4 = default(Color); ((Color)(ref val4))..ctor(0.95f, 0.45f, 0.1f, 1f); Color val5 = val; val5.r = Mathf.Max(val5.r, 0.55f); val5.g = Mathf.Max(val5.g, 0.35f); val5.b *= 0.6f; val5 = Color.Lerp(val5, val4, 0.3f); val = Color.Lerp(val, val5, num3 * 0.8f); val = ShiftSaturation(val, 1f - weather.ClearToFog * 0.4f); } float num4 = day + morning * 0.5f + evening * 0.5f; float num5 = night + morning * 0.5f + evening * 0.5f; float num6 = interpolatedSetup.m_lightIntensityDay * num4 + interpolatedSetup.m_lightIntensityNight * num5; float num7 = interpolatedSetup.m_lightIntensityDay * num4 + interpolatedSetup.m_lightIntensityNight * num5; float num8 = Mathf.Clamp(num6, 0.15f, 1f); float num9 = Mathf.Clamp(num7, 0.15f, 1f); Color val6 = val2 * num8; Color val7 = val * num9; result.ZenithColor = val6; result.HorizonColor = val7; result.CloudZenithColor = ShiftSaturation(ShiftValue(val6, 1.4f), 0.4f); result.CloudHorizonColor = ShiftSaturation(ShiftValue(val7, 1.4f), 0.8f); result.SunColor = sunColor; result.Exposure = exposure; result.rainDropColor = GetRainColor(interpolatedSetup, morning, day, evening, night); result.windStreakColor = GetWindStreakColor(interpolatedSetup, morning, day, evening, night); result.windStreakColor = result.SunColor; result.windStreakColor = GetWindColor(interpolatedSetup, morning, day, evening, night); result.fogColor = GetFogColor(interpolatedSetup, morning, day, evening, night); result.lightIntensity += 2f + (morning + 2f * day + evening) * ((Color)(ref result.SunColor)).grayscale; return result; } private static float GetGreyFactor(Weather weather, bool zenith) { float num = 0f; float num2 = Mathf.Max(weather.ClearToFog, weather.ClearToRain); num = ((!(num2 < 0.5f)) ? Mathf.Lerp(0.35f, 0.7f, (num2 - 0.5f) * 2f) : Mathf.Lerp(0.2f, 0.35f, num2 * 2f)); if (!zenith) { num -= 0.05f; } return Mathf.Max(0f, num); } private static Color GetRainColor(EnvSetup setup, float morningWeight, float dayWeight, float eveningWeight, float nightWeight) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_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) Color val = GetFogColor(setup, morningWeight, dayWeight, eveningWeight, nightWeight); float num = 0.6f; float num2 = default(float); float num4 = default(float); float num3 = default(float); Color.RGBToHSV(val, ref num2, ref num3, ref num4); if (num4 < num) { num4 = num; num3 *= 0.5f; val = Color.HSVToRGB(num2, num3, num4); } val.a = 0.6f; return val; } private static Color GetWindStreakColor(EnvSetup setup, float morningWeight, float dayWeight, float eveningWeight, float nightWeight) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) MixColor(GetFogColor(setup, morningWeight, dayWeight, eveningWeight, nightWeight), Color.yellow, 0.2f); return ShiftSaturation(GetWindColor(setup, morningWeight, dayWeight, eveningWeight, nightWeight), 0.7f); } private static Color GetWindLineColor(EnvSetup setup, float morningWeight, float dayWeight, float eveningWeight, float nightWeight) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_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_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) Color color = MaterialCreator.GetWindLineMaterial().color; Color result = MixColor(GetFogColor(setup, morningWeight, dayWeight, eveningWeight, nightWeight), color, 0.8f); result.a = 1f; return result; } public static Color GetWindColor(EnvSetup setup, float morningWeight, float dayWeight, float eveningWeight, float nightWeight) { //IL_0000: 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_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: 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_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_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_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) _ = Color.white; _ = Color.white; Color sunColorDay = setup.m_sunColorDay; Color sunColorNight = setup.m_sunColorNight; Color color = ((morningWeight > 0f) ? ((!(dayWeight > 0f)) ? Color.Lerp(sunColorNight, sunColorDay, 0.5f - 0.5f * nightWeight) : Color.Lerp(sunColorNight, sunColorDay, 0.5f + 0.5f * dayWeight)) : ((eveningWeight > 0f) ? ((!(dayWeight > 0f)) ? Color.Lerp(sunColorNight, sunColorDay, 0.5f - 0.5f * nightWeight) : Color.Lerp(sunColorNight, sunColorDay, 0.5f + 0.5f * dayWeight)) : ((!(dayWeight > 0f)) ? sunColorNight : sunColorDay))); return ShiftValue(ShiftSaturation(color, 0.5f), 0.7f); } private static Color GetFogColor(EnvSetup setup, float morningWeight, float dayWeight, float eveningWeight, float nightWeight) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: 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_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0079: 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_0049: 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_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: 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_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) _ = setup.m_fogColorDay; _ = setup.m_fogColorMorning; _ = setup.m_fogColorEvening; Color white = Color.white; Color val = Color.white; float num = -1f; float num2 = -1f; if (dayWeight > 0f) { white = setup.m_fogColorDay; num = dayWeight; if (morningWeight > 0f) { num2 = morningWeight; val = setup.m_fogColorMorning; } else if (eveningWeight > 0f) { num2 = eveningWeight; val = setup.m_fogColorEvening; } } else { white = setup.m_fogColorNight; num = nightWeight; if (morningWeight > 0f) { num2 = morningWeight; val = setup.m_fogColorMorning; } else if (eveningWeight > 0f) { num2 = eveningWeight; val = setup.m_fogColorEvening; } } Color result = white; if (num2 > 0f) { result = Color.Lerp(val, white, num); } return result; } public static Color ShiftValue(Color color, float value) { //IL_0000: 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) float num = default(float); float num2 = default(float); float num3 = default(float); Color.RGBToHSV(color, ref num, ref num2, ref num3); return Color.HSVToRGB(num, num2, Mathf.Clamp(num3 * value, 0f, 1f)); } public static Color ShiftSaturation(Color color, float saturation) { //IL_0000: 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) float num = default(float); float num2 = default(float); float num3 = default(float); Color.RGBToHSV(color, ref num, ref num2, ref num3); return Color.HSVToRGB(num, num2 * saturation, num3); } private static Color Desaturate(Color color, float amount) { //IL_0000: 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_0019: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) float num = color.r * 0.3f + color.g * 0.59f + color.b * 0.11f; Color val = default(Color); ((Color)(ref val))..ctor(num, num, num, color.a); return Color.Lerp(color, val, amount); } public static Color MixColor(Color colorA, Color colorB, float range) { //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_0003: Unknown result type (might be due to invalid IL or missing references) return Color.Lerp(colorA, colorB, range); } private static void GetTimeWeights(float fraction, out float morning, out float day, out float evening, out float night) { morning = 0f; day = 0f; evening = 0f; night = 0f; if (fraction >= 0.15f && fraction < 0.25f) { morning = Mathf.SmoothStep(0f, 1f, (fraction - 0.15f) / 0.1f); night = 1f - morning; } else if (fraction >= 0.25f && fraction < 0.35f) { day = Mathf.SmoothStep(0f, 1f, (fraction - 0.25f) / 0.1f); morning = 1f - day; } else if (fraction >= 0.35f && fraction < 0.65f) { day = 1f; } else if (fraction >= 0.65f && fraction < 0.75f) { evening = Mathf.SmoothStep(0f, 1f, (fraction - 0.65f) / 0.1f); day = 1f - evening; } else if (fraction >= 0.75f && fraction < 0.85f) { night = Mathf.SmoothStep(0f, 1f, (fraction - 0.75f) / 0.1f); evening = 1f - night; } else { night = 1f; } float num = Mathf.Max(morning + day + evening + night, 0.1f); morning *= 1f / num; day *= 1f / num; evening *= 1f / num; night *= 1f / num; } } internal class JsonHelper { public static Dictionary<string, string> ParseFullTextContent(string content) { Dictionary<string, string> dictionary = new Dictionary<string, string>(); int i = 0; while (i < content.Length) { string text = ExtractNextString(content, ref i); if (text == null) { break; } for (; i < content.Length && content[i] != ':'; i++) { } i++; string text2 = ExtractNextString(content, ref i); if (text2 == null) { break; } dictionary[text] = text2; for (; i < content.Length && content[i] != '"'; i++) { } } return dictionary; } private static string ExtractNextString(string text, ref int index) { while (index < text.Length && text[index] != '"') { index++; } if (index >= text.Length) { return null; } index++; StringBuilder stringBuilder = new StringBuilder(); bool flag = false; while (index < text.Length) { char c = text[index]; if (flag) { switch (c) { case '"': stringBuilder.Append('"'); break; case '\\': stringBuilder.Append('\\'); break; case 'n': stringBuilder.Append('\n'); break; case 't': stringBuilder.Append('\t'); break; default: stringBuilder.Append(c); break; } flag = false; } else { switch (c) { case '\\': flag = true; break; case '"': index++; return stringBuilder.ToString(); default: stringBuilder.Append(c); break; } } index++; } return stringBuilder.ToString(); } } [HarmonyPatch(typeof(Localization), "SetupLanguage")] public static class Localization_Patch { private static readonly Action<Localization, string, string> AddWordDelegate = AccessTools.MethodDelegate<Action<Localization, string, string>>(AccessTools.Method(typeof(Localization), "AddWord", new Type[2] { typeof(string), typeof(string) }, (Type[])null), (object)null, true); [HarmonyPostfix] private static void Postfix(Localization __instance) { Assembly assembly = typeof(ThoracleMod).Assembly; string text = PlayerPrefs.GetString("language", "English"); string targetResource = "Thoracle.Languages." + text + ".json"; string fallbackResource = "Thoracle.Languages.English.json"; string[] manifestResourceNames = assembly.GetManifestResourceNames(); string text2 = null; if (Array.Exists(manifestResourceNames, (string r) => r.Equals(targetResource, StringComparison.OrdinalIgnoreCase))) { text2 = targetResource; } else if (Array.Exists(manifestResourceNames, (string r) => r.Equals(fallbackResource, StringComparison.OrdinalIgnoreCase))) { Debug.LogWarning((object)("[Thoracle] Language '" + text + "' not found. Use Fallback (English).")); text2 = fallbackResource; } if (text2 != null) { Debug.Log((object)("Loading data " + text)); try { foreach (KeyValuePair<string, string> item in LoadEmbeddedJson(text2)) { AddWordDelegate(__instance, item.Key, item.Value); } return; } catch (Exception ex) { Debug.LogError((object)("[Thoracle] Error reading language resource '" + text2 + "': " + ex.Message)); return; } } Debug.LogError((object)("[Thoracle] Neither '" + targetResource + "' nor fallback '" + fallbackResource + "' were found in assembly!")); } public static Dictionary<string, string> LoadEmbeddedJson(string resourceName) { using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(resourceName); if (stream == null) { Debug.LogError((object)("[Thoracle] Resource '" + resourceName + "' nicht gefunden!")); return new Dictionary<string, string>(); } using StreamReader streamReader = new StreamReader(stream, Encoding.UTF8); return JsonHelper.ParseFullTextContent(streamReader.ReadToEnd()); } private static Dictionary<string, string> ReadJson(string jsonContent) { Dictionary<string, string> dictionary = new Dictionary<string, string>(); string pattern = "\"([^\"]+)\"\\s*:\\s*\"([^\"]+)\""; foreach (Match item in Regex.Matches(jsonContent, pattern)) { string value = item.Groups[1].Value; string value2 = item.Groups[2].Value.Replace("\\n", "\n").Replace("\\r", "\r"); dictionary[value] = value2; } return dictionary; } } public static class PieceMaker { private static string[] componentsToDestroy = new string[2] { "Piece", "WearNTear" }; private static List<string> childNames = new List<string>(); private static GameObject pieceContainer; private static readonly object _lockZNetScene = new object(); private static readonly object _lockObjectDB = new object(); public static void ExtractObjects(ZoneSystem __instance, string debugString) { ExtractObjectThoracle(Thoracle.pieceName); } private static void ExtractObjectThoracle(string name) { GameObject orCreatePieceContainer = GetOrCreatePieceContainer(); Thoracle.CreateThoracle().GetPieceObject(orCreatePieceContainer.transform); childNames.Add(name); } private static float GetRadius() { return 2f; } private static GameObject GetOrCreatePieceContainer() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown //IL_003b: 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_0063: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)pieceContainer == (Object)null) { pieceContainer = new GameObject(ThoracleMod.MOD_NAME + "PieceContainer"); pieceContainer.SetActive(false); pieceContainer.transform.localRotation = Quaternion.identity; pieceContainer.transform.localScale = Vector3.one; pieceContainer.transform.localPosition = Vector3.zero; Object.DontDestroyOnLoad((Object)(object)pieceContainer); } return pieceContainer; } private static void Register(ZNetScene __instance, string name) { //IL_00c0: 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_0146: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) GameObject gameObject = ((Component)GetOrCreatePieceContainer().transform.Find(name)).gameObject; ((Object)gameObject).name = name; DestroyComponents(gameObject); ZNetView val = gameObject.GetComponent<ZNetView>(); if ((Object)(object)val == (Object)null) { val = gameObject.AddComponent<ZNetView>(); } val.m_persistent = true; WearNTear component = gameObject.GetComponent<WearNTear>(); if ((Object)(object)component == (Object)null) { component = gameObject.AddComponent<WearNTear>(); component.m_health = 200f; GameObject prefab = __instance.GetPrefab("piece_chair"); if ((Object)(object)prefab != (Object)null) { WearNTear component2 = prefab.GetComponent<WearNTear>(); if ((Object)(object)component2 != (Object)null) { component.m_destroyedEffect = component2.m_destroyedEffect; component.m_hitEffect = component2.m_hitEffect; } } } Piece val2 = gameObject.GetComponent<Piece>(); if ((Object)(object)val2 == (Object)null) { val2 = gameObject.AddComponent<Piece>(); val2.m_category = (PieceCategory)0; val2.m_usage = (UsageTagFlags)1; GameObject prefab2 = __instance.GetPrefab("piece_chair"); if ((Object)(object)prefab2 != (Object)null) { Piece component3 = prefab2.GetComponent<Piece>(); if ((Object)(object)component3 != (Object)null) { val2.m_placeEffect = component3.m_placeEffect; } } val2.m_groundOnly = false; val2.m_cultivatedGroundOnly = false; val2.m_waterPiece = false; val2.m_noInWater = false; } FixCollidersAndLayers(gameObject); if ((Object)(object)val2 != (Object)null) { val2.m_name = Thoracle.pieceName; val2.m_description = Thoracle.pieceDescription; val2.m_category = (PieceCategory)0; val2.m_usage = (UsageTagFlags)1; val2.m_icon = ResourceLoader.LoadBuildMenuIcon(); val2.m_resources = GetRequirement(); } if (!__instance.m_prefabs.Contains(gameObject)) { __instance.m_prefabs.Add(gameObject); } if (typeof(ZNetScene).GetField("m_namedPrefabs", BindingFlags.Instance | BindingFlags.NonPublic)?.GetValue(__instance) is Dictionary<int, GameObject> dictionary) { dictionary[StringExtensionMethods.GetStableHashCode(((Object)gameObject).name)] = gameObject; } } private static Requirement[] GetRequirement() { return (Requirement[])(object)new Requirement[4] { CreateRequirement("Thunderstone", 1, recover: true), CreateRequirement("Tin", 3, recover: true), CreateRequirement("FineWood", 9, recover: true), CreateRequirement("RoundLog", 9, recover: true) }; } private static Requirement CreateRequirement(string prefabName, int amount, bool recover) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_003b: 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_004a: Expected O, but got Unknown GameObject itemPrefab = ObjectDB.instance.GetItemPrefab(prefabName); if ((Object)(object)itemPrefab == (Object)null) { Debug.Log((object)("Thoracle, BuildPiece " + prefabName + " not found")); } return new Requirement { m_resItem = itemPrefab.GetComponent<ItemDrop>(), m_amount = amount, m_recover = true }; } private static void DestroyComponents(GameObject go) { string[] array = componentsToDestroy; foreach (string text in array) { Component component = go.GetComponent(text); if ((Object)(object)component != (Object)null) { Object.DestroyImmediate((Object)(object)component); } Component[] componentsInChildren = go.GetComponentsInChildren<Component>(true); foreach (Component val in componentsInChildren) { if (((object)val).GetType().Name == text) { Object.DestroyImmediate((Object)(object)val); } } } Transform[] componentsInChildren2 = go.GetComponentsInChildren<Transform>(true); foreach (Transform val2 in componentsInChildren2) { if (((Object)val2).name.StartsWith("attach_") || ((Object)val2).name.StartsWith("snap") || ((Component)val2).tag == "snappoint") { Object.DestroyImmediate((Object)(object)((Component)val2).gameObject); } } } public static void Register(ObjectDB __instance, string myObjectName) { if ((Object)(object)__instance.GetItemPrefab("Hammer") == (Object)null) { return; } GameObject itemPrefab = __instance.GetItemPrefab("Hammer"); ItemDrop val = ((itemPrefab != null) ? itemPrefab.GetComponent<ItemDrop>() : null); if ((Object)(object)val != (Object)null && (Object)(object)val.m_itemData.m_shared.m_buildPieces != (Object)null) { PieceTable buildPieces = val.m_itemData.m_shared.m_buildPieces; ZNetScene instance = ZNetScene.instance; GameObject val2 = ((instance != null) ? instance.GetPrefab(myObjectName) : null); Piece component = val2.GetComponent<Piece>(); if ((Object)(object)component != (Object)null) { ((object)Unsafe.As<PieceCategory, PieceCategory>(ref component.m_category)/*cast due to .constrained prefix*/).ToString(); } if ((Object)(object)val2 != (Object)null && !buildPieces.m_pieces.Contains(val2)) { buildPieces.m_pieces.Add(val2); } } } public static void TryRegisterToZNetScene(string source) { lock (_lockZNetScene) { Debug.Log((object)("TryRegister to ZNetScene lock successfull " + source)); if ((Object)(object)ZNetScene.instance != (Object)null && (Object)(object)pieceContainer != (Object)null) { ZNetScene.instance.GetPrefab(Thoracle.pieceName); Register(ZNetScene.instance, Thoracle.pieceName); } } } public static void TryRegisterToObjectDB(string source) { lock (_lockObjectDB) { if ((Object)(object)ObjectDB.instance != (Object)null && (Object)(object)pieceContainer != (Object)null) { Register(ObjectDB.instance, Thoracle.pieceName); } } } private static void FixCollidersAndLayers(GameObject pieceObj) { //IL_00c2: 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_0065: 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_006f: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) int num = LayerMask.NameToLayer("piece"); if (num != -1) { pieceObj.layer = num; Transform[] componentsInChildren = pieceObj.GetComponentsInChildren<Transform>(true); for (int i = 0; i < componentsInChildren.Length; i++) { ((Component)componentsInChildren[i]).gameObject.layer = num; } } Collider componentInChildren = pieceObj.GetComponentInChildren<Collider>(); if ((Object)(object)pieceObj.GetComponent<Collider>() == (Object)null) { BoxCollider val = pieceObj.AddComponent<BoxCollider>(); if ((Object)(object)componentInChildren != (Object)null) { Bounds bounds = ((Collider)val).bounds; ((Bounds)(ref bounds)).Encapsulate(componentInChildren.bounds); bounds = componentInChildren.bounds; val.size = ((Bounds)(ref bounds)).size; Transform transform = pieceObj.transform; bounds = componentInChildren.bounds; val.center = transform.InverseTransformPoint(((Bounds)(ref bounds)).center); } else { val.size = new Vector3(2f, 1.5f, 2f); val.center = new Vector3(0f, 0.75f, 0f); } } } public static bool IsModObject(GameObject obj) { if ((Object)(object)obj != (Object)null) { return childNames.Contains(((Object)obj).name); } return false; } public static void Clear() { childNames.Clear(); pieceContainer = null; } } public interface IBuildPiece { GameObject GetPieceObject(Transform parent); } public static class Registry { public enum ChildObject { OuterSphere, OceanSurface, OceanCup, ShipPivot, MiniKarve, StarField, Atmosphere, Clouds, Fog, Rain, Wind, Snow, SacrificeHook } public static int GetRenderQueue(ChildObject child) { return child switch { ChildObject.OuterSphere => 3100, ChildObject.OceanSurface => 3899, ChildObject.OceanCup => 1998, ChildObject.MiniKarve => 2000, ChildObject.StarField => 3995, ChildObject.Atmosphere => 3990, ChildObject.Clouds => 3997, ChildObject.Rain => 3998, ChildObject.Fog => 3998, ChildObject.Snow => 3998, ChildObject.Wind => 3999, _ => 1000, }; } public static string GetChildName(ChildObject child) { return child switch { ChildObject.OuterSphere => "OuterSphere", ChildObject.OceanSurface => "OceanSurface", ChildObject.OceanCup => "OceanCup", ChildObject.ShipPivot => "ShipPivot", ChildObject.MiniKarve => "ThoracleBoat", ChildObject.StarField => "SkyStarField", ChildObject.Atmosphere => "SkyAtmosphere", ChildObject.Clouds => "SkyClouds", ChildObject.Rain => "EmitterRain", ChildObject.Fog => "EmitterFog", ChildObject.Snow => "EmitterSnow", ChildObject.Wind => "EmitterWind", ChildObject.SacrificeHook => "SacrificeHook", _ => "Unknown", }; } } public static class ResourceLoader { public static Dictionary<string, string> LoadEmbeddedJson(string resourceName) { using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(resourceName); if (stream == null) { Debug.LogError((object)("[Thoracle] Resource '" + resourceName + "' nicht gefunden!")); return new Dictionary<string, string>(); } using StreamReader streamReader = new StreamReader(stream, Encoding.UTF8); return JsonHelper.ParseFullTextContent(streamReader.ReadToEnd()); } public static Sprite LoadBuildMenuIcon() { return LoadEmbeddedIcon("Thoracle.Perthro.png"); } public static Sprite LoadEmbeddedIcon(string resourceName) { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Expected O, but got Unknown //IL_013b: 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) using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(resourceName); if (stream == null) { Debug.LogError((object)("[Thoracle] Resource '" + resourceName + "' wurde nicht gefunden!")); return null; } byte[] array = new byte[stream.Length]; stream.Read(array, 0, array.Length); Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false); MethodInfo method = typeof(Texture2D).GetMethod("LoadImage", new Type[1] { typeof(byte[]) }); if (method != null) { method.Invoke(val, new object[1] { array }); } else { ((AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault((Assembly a) => a.GetName().Name == "UnityEngine.ImageConversionModule")?.GetType("UnityEngine.ImageConversion"))?.GetMethod("LoadImage", new Type[2] { typeof(Texture2D), typeof(byte[]) }))?.Invoke(null, new object[2] { val, array }); } return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f), 100f); } } public class SacrificeHook : MonoBehaviour, Hoverable, Interactable { private string m_hookName = "$Thoracle_Piece_OfferingMount"; private string attachFish = "$Thoracle_Attach_Fish"; private string takeFish = "$Thoracle_Take_Fish"; public int HookIndex; public ThoracleAltar ParentAltar; public string GetHoverText() { if ((Object)(object)ParentAltar == (Object)null || ParentAltar.GetHoverText().Equals("")) { return ""; } string text = Localization.instance.Localize("$KEY_Use"); string text2 = Localization.instance.Localize("$ui_hold"); string attachedItem = ParentAltar.GetAttachedItem(HookIndex); string text3 = Localization.instance.Localize(m_hookName); if (string.IsNullOrEmpty(attachedItem)) { string text4 = Localization.instance.Localize(attachFish); return text3 + " \n[<color=yellow><b>[1-8]</b></color>] " + text4; } string text5 = Localization.instance.Localize("$animal_" + attachedItem.ToLower()); if (attachedItem.ToLower().Equals("fish4_cave")) { text5 = Localization.instance.Localize("$animal_fish4"); } string text6 = Localization.instance.Localize(takeFish); return text3 + " ( " + text5 + " )\n[<color=yellow><b>" + text2 + " " + text + "</b></color>] " + text6; } public float GetHoverOffset() { return 0f; } public string GetHoverName() { return m_hookName; } public bool Interact(Humanoid user, bool hold, bool alt) { if (!hold || (Object)(object)ParentAltar == (Object)null) { return false; } return ParentAltar.OnHookInteracted(user, HookIndex); } public bool UseItem(Humanoid user, ItemData item) { if ((Object)(object)ParentAltar == (Object)null) { return false; } return ParentAltar.OnHookUseItem(user, item, HookIndex); } } public class SoundEffect { public enum DayTime { Day, Night, Unspecified } private bool inside = true; public WeatherForecast.WeatherConditionType weatherConditionType = WeatherForecast.WeatherConditionType.Unknown; private DayTime dayTime = DayTime.Unspecified; public Transform target; public GameObject prefab; public bool m_loop; public float m_minDelay; public float m_maxDelay; public float m_maxVol = 1f; public float m_minVol = 1f; public bool isPlaying; public bool IsConditionMet(Weather weather, float currentDayFraction) { if (isPlaying) { return false; } if (weatherConditionType != WeatherForecast.WeatherConditionType.Unknown && !weatherConditionType.Equals(weather.weatherType)) { return false; } if (dayTime.Equals(DayTime.Day)) { if (currentDayFraction < 0.25f || currentDayFraction > 0.75f) { return false; } } else if (dayTime.Equals(DayTime.Night) && currentDayFraction < 0.75f && currentDayFraction > 0.25f) { return false; } return true; } public float GetPlayTime(Weather weather, float currentDayFraction) { float num = GetHoursOfSameWeather(weather); if (HasDayTimeTimeout()) { num = Mathf.Min(num, GetDayTimeTimeout(currentDayFraction)); } return num; } public bool HasDayTimeTimeout() { return dayTime != DayTime.Unspecified; } public float GetDayTimeTimeout(float currentDayFraction) { if (dayTime.Equals(DayTime.Day)) { return Mathf.Max(0f, (0.75f - currentDayFraction) * 24f); } if (dayTime.Equals(DayTime.Night)) { if (currentDayFraction > 0.75f) { return 1f - currentDayFraction + 0.25f; } if (currentDayFraction < 0.25f) { return 0.25f - currentDayFraction; } } return 0f; } private float GetHoursOfSameWeather(Weather weather) { return GetHours(weather, weather.weatherType, equals: false); } private int GetHoursUntilTargetWeatherType(Weather weather, WeatherForecast.WeatherConditionType targetType) { return GetHours(weather, targetType, equals: true); } private int GetHours(Weather weather, WeatherForecast.WeatherConditionType targetType, bool equals) { int num = 0; foreach (WeatherForecast.WeatherCondition followingWeatherCondition in weather.followingWeatherConditions) { if (equals ? followingWeatherCondition.weatherConditionType.Equals(targetType) : (!followingWeatherCondition.weatherConditionType.Equals(targetType))) { break; } num++; } return num; } public void SetWeatherConditionType(WeatherForecast.WeatherConditionType weatherConditionType) { this.weatherConditionType = weatherConditionType; } public void SetDayTime(DayTime dayTime) { this.dayTime = dayTime; } public void SetDelay(float minDelay, float maxDelay) { m_minDelay = minDelay; m_maxDelay = maxDelay; } public void SetVolume(float minVolume, float maxVolume) { m_minVol = minVolume; m_maxVol = maxVolume; } public void SetParentTransform(Transform transform) { target = transform; } public void SetPrefab(GameObject prefab) { this.prefab = prefab; if ((Object)(object)prefab != (Object)null) { ZSFX component = prefab.GetComponent<ZSFX>(); if ((Object)(object)component != (Object)null) { m_minVol = component.m_minVol; m_maxVol = component.m_maxVol; AudioSource component2 = prefab.GetComponent<AudioSource>(); m_loop = component2.loop; _ = component.m_audioClips; } } } } public class Thoracle : IBuildPiece { public class Trigger { } public static string pieceName = "$Thoracle_Piece_Altar"; public static string pieceDescription = "$Thoracle_Piece_Description"; private GameObject pieceThoracle; private string finewood = "finewood_log"; private string tin = "tin"; private string bronze = "bronze"; private string bronzenails = "bronzenails"; private string corewood = "roundlog"; private string normalWood = "woodpole"; private string thunderstone = "ThunderStone_mat"; public static string Seagull = "SeagullDecoration"; public static string Serpent = "SerpentDecoration"; public static Thoracle CreateThoracle() { return new Thoracle(); } public GameObject GetPieceObject(Transform parent) { if ((Object)(object)pieceThoracle == (Object)null) { pieceThoracle = CreatePieceThoracle(parent); } return pieceThoracle; } private static GameObject GetLocationAsset(ZoneSystem __instance, string locationName) { ZoneLocation val = __instance.m_locations.Find((ZoneLocation l) => l.m_prefabName == locationName); if (val != null) { val.m_prefab.LoadAsync(); val.m_prefab.WaitForLoadToComplete(); return val.m_prefab.Asset; } return null; } private GameObject CreatePieceThoracle(Transform parent) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //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_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_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_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: 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_0104: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) GameObject val = CreateSphere(parent, pieceName); ZNetView obj = val.AddComponent<ZNetView>(); val.AddComponent<ThoracleAltar>(); obj.m_persistent = true; val.transform.localRotation = Quaternion.identity; Quaternion identity = Quaternion.identity; CreateLowerPerthro(val.transform, Vector3.down * 1.35f + Vector3.back * 0.5f, Vector3.one, identity); CreateBackPerthro(val.transform, Vector3.down * 0.8f + Vector3.back * 1.31f, Vector3.one, identity); CreateSeagull(val.transform, Vector3.forward * 0.35f + Vector3.up * 0.67999995f, new Vector3(0.25f, 0.25f, 0.25f), identity * Quaternion.Euler(-110f, 180f, 0f)); CreateSerpent(val.transform, Vector3.down * 0.76f + 0.25f * Vector3.forward, new Vector3(0.15f, 0.15f, 0.15f), identity * Quaternion.Euler(-60f, 0f, 0f)); return val; } private GameObject AddDebugSphere(Transform parent, Vector3 o, Color color, float dist, float size) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Expected O, but got Unknown //IL_006d: Unknown result type (might be due to invalid IL or missing references) GameObject val = GameObject.CreatePrimitive((PrimitiveType)0); val.transform.localScale = Vector3.one * size; val.transform.SetParent(parent, false); val.transform.localPosition = o * dist; Collider[] componentsInChildren = val.GetComponentsInChildren<Collider>(true); for (int i = 0; i < componentsInChildren.Length; i++) { Object.DestroyImmediate((Object)(object)componentsInChildren[i]); } Material val2 = new Material(MaterialCreator.GetOuterSphereMaterial()); val2.SetColor("_Color", color); MeshRenderer component = val.GetComponent<MeshRenderer>(); ((Renderer)component).material = val2; ((Renderer)component).sharedMaterial = val2; return val; } private void CreateLowerPerthro(Transform parent, Vector3 localPosition, Vector3 localScale, Quaternion localRotation) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003c: 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_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: 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_00c1: 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_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00db: 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_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_0157: 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_0161: 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_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_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_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_02ac: Unknown result type (might be due to invalid IL or missing references) //IL_02b6: Unknown result type (might be due to invalid IL or missing references) //IL_02bb: Unknown result type (might be due to invalid IL or missing references) //IL_02c0: Unknown result type (might be due to invalid IL or missing references) //IL_02c1: Unknown result type (might be due to invalid IL or missing references) GameObject prefab = ZNetScene.instance.GetPrefab("wood_pole_log"); GameObject prefab2 = ZNetScene.instance.GetPrefab("wood_wall_log"); float num = 1f; float num2 = 0.25f; Vector3 scale = default(Vector3); ((Vector3)(ref scale))..ctor(localScale.x * num, localScale.y, localScale.z); Vector3 offset = localPosition + Vector3.down * num2; GameObject obj = Instantiate(prefab2, parent, offset, scale); obj.transform.localRotation = localRotation; ((Object)obj).name = "LowerPerthroCentralBeam"; float num3 = 0.25f; float num4 = 0.66f; float num5 = (0.1f * (1f - num4) + num3) * localScale.y; Vector3 scale2 = default(Vector3); ((Vector3)(ref scale2))..ctor(localScale.x, localScale.y * num4, localScale.z); Vector3 val = Vector3.left * num; Vector3 val2 = Vector3.right * num; Vector3 val3 = Vector3.up * num4 - Vector3.up * num5 - Vector3.up * localScale.y * 0.16f; Vector3 offset2 = localPosition + val + val3; GameObject obj2 = Instantiate(prefab, parent, offset2, scale2); ((Object)obj2).name = "LowerPerthroLeftArm"; obj2.transform.localRotation = localRotation; Vector3 offset3 = localPosition + val2 + val3; GameObject obj3 = Instantiate(prefab, parent, offset3, scale2); obj3.transform.localRotation = localRotation * Quaternion.Euler(0f, 180f, 0f); ((Object)obj3).name = "LowerPerthroRightArm"; float num6 = 0.15f; Vector3 val4 = new Vector3(0f, localPosition.y, 0f) + 2f * Vector3.up * num4 - Vector3.up * num5 - Vector3.up * num6; float num7 = 0.06f; float radius = 0.94f * num; int bumps = 9; float bumpHeight = 0.18f; GameObject val5 = CreateHoop(radius, num6, num7, 256, bumps, bumpHeight); val5.transform.localRotation = Quaternion.Euler(0f, 90f, 0f); Instantiate(val5, parent, val4, localScale); float num8 = 20f; float num9 = 10f; float[] array = new float[9]; for (int i = 0; i < 9; i++) { array[i] = (float)i * num8; array[i] = (float)i * num8 + num9; } CreateSacrificeStands(parent, array, 0.94f * num + num7, val4 - Vector3.up * num6 * 0.5f, localScale, localRotation); } private void CreateBackPerthro(Transform parent, Vector3 localPosition, Vector3 localScale, Quaternion localRotation) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: 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_012a: 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_0148: 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_0166: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_0250: Unknown result type (might be due to invalid IL or missing references) //IL_025b: 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_0274: Unknown result type (might be due to invalid IL or missing references) //IL_028a: Unknown result type (might be due to invalid IL or missing references) //IL_028c: Unknown result type (might be due to invalid IL or missing references) //IL_02aa: 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_02d9: Unknown result type (might be due to invalid IL or missing references) //IL_02eb: 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_0304: Unknown result type (might be due to invalid IL or missing references) //IL_0329: Unknown result type (might be due to invalid IL or missing references) //IL_0331: 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_0350: Unknown result type (might be due to invalid IL or missing references) //IL_0352: Unknown result type (might be due to invalid IL or missing references) //IL_0370: Unknown result type (might be due to invalid IL or missing references) //IL_038f: Unknown result type (might be due to invalid IL or missing references) //IL_039f: Unknown result type (might be due to invalid IL or missing references) //IL_03b1: Unknown result type (might be due to invalid IL or missing references) //IL_03b6: Unknown result type (might be due to invalid IL or missing references) //IL_03c2: Unknown result type (might be due to invalid IL or missing references) //IL_03ca: Unknown result type (might be due to invalid IL or missing references) //IL_03d0: Unknown result type (might be due to invalid IL or missing references) //IL_03e6: Unknown result type (might be due to invalid IL or missing references) //IL_03e8: Unknown result type (might be due to invalid IL or missing references) //IL_0406: Unknown result type (might be due to invalid IL or missing references) //IL_0425: Unknown result type (might be due to invalid IL or missing references) //IL_0435: Unknown result type (might be due to invalid IL or missing references) //IL_0448: Unknown result type (might be due to invalid IL or missing references) //IL_044d: Unknown result type (might be due to invalid IL or missing references) string text = "VerticalPerthro"; GameObject prefab = ZNetScene.instance.GetPrefab("wood_pole_log"); GameObject prefab2 = ZNetScene.instance.GetPrefab("wood_wall_log"); float num = 0.125f; Vector3 scale = AdaptWoodPoleLog(Vector3.one * localScale.y, 1f, 1f - num); ((Object)Instantiate(prefab, parent, localPosition - num * 0.5f * Vector3.up, scale)).name = text + "LowerBackPole"; ((Object)Instantiate(prefab, parent, localPosition + (2f - 2.5f * num) * Vector3.up, scale)).name = text + "UpperBackPole"; float num2 = 0.25f; float num3 = 0.1f; float num4 = 1f; int num5 = 10; float num6 = Mathf.Cos((float)Math.PI / 180f * (float)num5); num4 = (Mathf.Abs(localPosition.z) + num2) / num6 * 0.5f; float num7 = num4 * 0.5f * Mathf.Sin((float)Math.PI / 180f * (float)num5); float num8 = (Mathf.Abs(localPosition.z) + num2) * 0.5f; Vector3 offset = default(Vector3); ((Vector3)(ref offset))..ctor(localPosition.x, 2f * localPosition.y + num7 + 1.5f * num3, localPosition.z - Vector3.back.z * (num8 - num3)); Vector3 scale2 = default(Vector3); ((Vector3)(ref scale2))..ctor(localScale.x * num4, localScale.y, localScale.z); GameObject obj = Instantiate(prefab2, parent, offset, scale2); ((Object)obj).name = text + "BottomHorizontalBack"; obj.transform.localRotation = Quaternion.identity; obj.transform.localRotation = Quaternion.Euler(0f, 90f, 0f); Transform transform = obj.transform; transform.localRotation *= Quaternion.Euler(0f, 0f, (float)(-num5)); int num9 = 80; num6 = Mathf.Cos((float)Math.PI / 180f * (float)num9); float num10 = num7 / num6; num10 *= 1f - num3; float num11 = 2f * (num8 - num3) + num10 * 0.5f; Vector3 scale3 = default(Vector3); ((Vector3)(ref scale3))..ctor(localScale.x * num10, localScale.y, localScale.z); Vector3 offset2 = default(Vector3); ((Vector3)(ref offset2))..ctor(localPosition.x, 2f * localPosition.y + num7 + 1.5f * num3, localPosition.z - Vector3.back.z * num11); GameObject obj2 = Instantiate(prefab2, parent, offset2, scale3); ((Object)obj2).name = text + "BottomHorizontalFront"; obj2.transform.localRotation = Quaternion.identity; obj2.transform.localRotation = Quaternion.Euler(0f, 90f, 0f); Transform transform2 = obj2.transform; transform2.localRotation *= Quaternion.Euler(0f, 0f, (float)num9); float num12 = 4f - 2f * Mathf.Abs(localPosition.y) - num7 - 2f * num2 - 2f * num; Vector3 offset3 = default(Vector3); ((Vector3)(ref offset3))..ctor(localPosition.x, num12, localPosition.z - Vector3.back.z * (num8 - num3)); GameObject obj3 = Instantiate(prefab2, parent, offset3, scale2); ((Object)obj3).name = text + "TopHorizontalBack"; obj3.transform.localRotation = Quaternion.identity; obj3.transform.localRotation = Quaternion.Euler(0f, 90f, 0f); Transform transform3 = obj3.transform; transform3.localRotation *= Quaternion.Euler(0f, 0f, (float)num5); Vector3 offset4 = default(Vector3); ((Vector3)(ref offset4))..ctor(localPosition.x, num12, localPosition.z - Vector3.back.z * num11); GameObject obj4 = Instantiate(prefab2, parent, offset4, scale3); ((Object)obj4).name = text + "TopHorizontalFront"; obj4.transform.localRotation = Quaternion.identity; obj4.transform.localRotation = Quaternion.Euler(0f, 90f, 0f); Transform transform4 = obj4.transform; transform4.localRotation *= Quaternion.Euler(0f, 0f, (float)(-num9)); } private GameObject CreateSphere(Transform parent, string name) { //IL_001a: 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_003a: 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_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_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_00a6: Unknown result type (might be due to invalid IL or missing references) GameObject val = GameObject.CreatePrimitive((PrimitiveType)0); val.transform.SetParent(parent, false); val.transform.localPosition = Vector3.zero; val.transform.localRotation = Quaternion.identity; val.transform.localScale = Vector3.one * GetSphereDiameter(); ((Object)val).name = name; val.SetActive(true); Mesh mesh = val.GetComponent<MeshFilter>().mesh; List<Vector3> list = new List<Vector3>(); mesh.GetVertices(list); List<Vector3> list2 = new List<Vector3>(); foreach (Vector3 item in list) { list2.Add(Quaternion.Euler(0f, -90f, 0f) * item); } mesh.vertices = list2.ToArray(); ((Renderer)val.GetComponent<MeshRenderer>()).sharedMaterial = MaterialCreator.GetStaffShieldShardMaterial(); VisionControllerOcean.CleanUp(val); return val; } private float GetSphereDiameter() { return 2f; } private float GetLocalScale() { return 1f / GetSphereDiameter(); } private GameObject Instantiate(GameObject prefab, Transform parent, Vector3 offset, Vector3 scale) { //IL_000f: 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) GameObject obj = Instantiate(prefab, parent); TransformUtility.AttachWithFixedScale(obj.transform, parent, offset, scale); return obj; } private GameObject Instantiate(GameObject prefab, Transform parent) { GameObject obj = Object.Instantiate<GameObject>(prefab, parent); WearNTear component = obj.GetComponent<WearNTear>(); if ((Object)(object)component != (Object)null) { Object.DestroyImmediate((Object)(object)component); } Piece component2 = obj.GetComponent<Piece>(); if ((Object)(object)component2 != (Object)null) { Object.DestroyImmediate((Object)(object)component2); } ZNetView component3 = obj.GetComponent<ZNetView>(); if ((Object)(object)component3 != (Object)null) { Object.DestroyImmediate((Object)(object)component3); } return obj; } private void CreateSerpent(Transform parent, Vector3 localPosition, Vector3 localScale, Quaternion localRotation) { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Expected O, but got Unknown //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) GameObject prefab = ZNetScene.instance.GetPrefab("TrophySerpent"); if ((Object)(object)prefab != (Object)null) { Material materialByName = MaterialCreator.GetMaterialByName(normalWood); materialByName = MaterialCreator.GetMaterialByName(corewood); GameObject obj = CreateCopiedObject(prefab, "miniSerpent", new Material(materialByName)); obj.transform.SetParent(parent, false); obj.transform.localPosition = localPosition; obj.transform.localRotation = Quaternion.Euler(-60f, 0f, 0f); obj.transform.localScale = new Vector3(0.15f, 0.15f, 0.15f); } } private void CreateSeagull(Transform parent, Vector3 localPosition, Vector3 localScale, Quaternion localRotation) { //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: 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_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Expected O, but got Unknown //IL_02f9: Unknown result type (might be due to invalid IL or missing references) //IL_02fe: Unknown result type (might be due to invalid IL or missing references) //IL_030b: 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_0329: Unknown result type (might be due to invalid IL or missing references) //IL_032f: Unknown result type (might be due to invalid IL or missing references) //IL_0335: Unknown result type (might be due to invalid IL or missing references) //IL_033b: Unknown result type (might be due to invalid IL or missing references) //IL_0347: 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_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0139: 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_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_014b: 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_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: 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_01d4: 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_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_0213: Unknown result type (might be due to invalid IL or missing references) //IL_0220: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_0290: Unknown result type (might be due to invalid IL or missing references) //IL_0299: Unknown result type (might be due to invalid IL or missing references) //IL_02a2: Unknown result type (might be due to invalid IL or missing references) //IL_02ab: Unknown result type (might be due to invalid IL or missing references) //IL_02b4: Unknown result type (might be due to invalid IL or missing references) //IL_02bd: Unknown result type (might be due to invalid IL or missing references) GameObject prefab = ZNetScene.instance.GetPrefab("Seagal"); if ((Object)(object)prefab != (Object)null) { SkinnedMeshRenderer componentInChildren = prefab.GetComponentInChildren<SkinnedMeshRenderer>(true); Animator componentInChildren2 = prefab.GetComponentInChildren<Animator>(true); bool enabled = false; if ((Object)(object)componentInChildren2 != (Object)null) { enabled = ((Behaviour)componentInChildren2).enabled; ((Behaviour)componentInChildren2).enabled = false; } Transform val = prefab.transform.Find("crow_anim/Armature/l_wing1"); Transform val2 = prefab.transform.Find("crow_anim/Armature/r_wing1"); Transform val3 = prefab.transform.Find("crow_anim/Armature/l_wing1/l_wing2"); Transform val4 = prefab.transform.Find("crow_anim/Armature/r_wing1/r_wing2"); Transform val5 = prefab.transform.Find("crow_anim/Armature/l_wing1/l_wing2/l_wing2_end"); Transform val6 = prefab.transform.Find("crow_anim/Armature/r_wing1/r_wing2/r_wing2_end"); Quaternion localRotation2 = Quaternion.identity; Quaternion localRotation3 = Quaternion.identity; Quaternion localRotation4 = Quaternion.identity; Quaternion localRotation5 = Quaternion.identity; Quaternion localRotation6 = Quaternion.identity; Quaternion localRotation7 = Quaternion.identity; if ((Object)(object)val != (Object)null && (Object)(object)val2 != (Object)null && (Object)(object)val3 != (Object)null && (Object)(object)val4 != (Object)null && (Object)(object)val5 != (Object)null && (Object)(object)val6 != (Object)null) { localRotation2 = val.localRotation; localRotation3 = val2.localRotation; localRotation4 = val3.localRotation; localRotation5 = val4.localRotation; localRotation6 = val5.localRotation; localRotation7 = val6.localRotation; val.localRotation *= Quaternion.Euler(-30f, 0f, 0f); val2.localRotation *= Quaternion.Euler(-30f, 0f, 0f); val3.localRotation *= Quaternion.Euler(-35f, 0f, 0f); val4.localRotation *= Quaternion.Euler(-35f, 0f, 0f); val5.localRotation *= Quaternion.Euler(-30f, 0f, 30f); val6.localRotation *= Quaternion.Euler(-30f, 0f, 30f); } Mesh val7 = new Mesh(); componentInChildren.BakeMesh(val7); if ((Object)(object)val != (Object)null && (Object)(object)val2 != (Object)null && (Object)(object)val3 != (Object)null && (Object)(object)val4 != (Object)null && (Object)(object)val5 != (Object)null && (Object)(object)val6 != (Object)null) { val.localRotation = localRotation2; val2.localRotation = localRotation3; val3.localRotation = localRotation4; val4.localRotation = localRotation5; val5.localRotation = localRotation6; val6.localRotation = localRotation7; } if ((Object)(object)componentInChildren2 != (Object)null) { ((Behaviour)componentInChildren2).enabled = enabled; } Material materialByName = MaterialCreator.GetMaterialByName(tin); if ((Object)(object)componentInChildren != (Object)null && (Object)(object)materialByName != (Object)null) { GameObject val8 = new GameObject(Seagull); val8.transform.SetParent(parent, false); MeshFilter val9 = val8.AddComponent<MeshFilter>(); MeshRenderer obj = val8.AddComponent<MeshRenderer>(); val9.sharedMesh = val7; ((Renderer)obj).sharedMaterial = materialByName; val8.transform.localPosition = localPosition; val8.transform.localRotation = localRotation; val8.transform.localScale = localScale; } } } private GameObject CreateHoop(float radius, float width, float thickness, int segments, int bumps, float bumpHeight) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Expected O, but got Unknown GameObject val = new GameObject("hoop"); MeshFilter val2 = val.AddComponent<MeshFilter>(); MeshRenderer obj = val.AddComponent<MeshRenderer>(); Material materialByName = MaterialCreator.GetMaterialByName(corewood); ((Renderer)obj).sharedMaterial = materialByName; Mesh val3 = MeshCreator.CreateHoopMesh(radius, width, thickness, segments); val3 = MeshCreator.CreateSerpentMesh(radius, width, thickness, segments, bumps, bumpHeight); val2.mesh = val3; return val; } private static GameObject CreateCopiedObject(GameObject prefab, string targetName, Material targetMaterial) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Expected O, but got Unknown if ((Object)(object)prefab != (Object)null) { MeshFilter componentInChildren = prefab.GetComponentInChildren<MeshFilter>(true); MeshRenderer componentInChildren2 = prefab.GetComponentInChildren<MeshRenderer>(true); if ((Object)(object)componentInChildren != (Object)null && (Object)(object)componentInChildren2 != (Object)null) { GameObject val = new GameObject(targetName); MeshFilter val2 = val.AddComponent<MeshFilter>(); MeshRenderer val3 = val.AddComponent<MeshRenderer>(); Material[] sharedMaterials = ((Renderer)componentInChildren2).sharedMaterials; Material[] sharedMaterials2 = ((Renderer)componentInChildren2).sharedMaterials; for (int i = 0; i < sharedMaterials.Length; i++) { sharedMaterials2[i] = new Material(targetMaterial); } val2.sharedMesh = componentInChildren.sharedMesh; ((Renderer)val3).sharedMaterials = sharedMaterials2; return val; } } return null; } private void CreateSacrificeStands(Transform parent, float[] angles, float distance, Vector3 central, Vector3 localScale, Quaternion localRotation) { //IL_0045: 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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0081: 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_00ba: Unknown result type (might be due to invalid IL or missing references)