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 FreshCommands v3.1.1
FreshCommands.dll
Decompiled 2 months ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text; using BepInEx; using HarmonyLib; using Jotunn.Configs; using Jotunn.Entities; using Jotunn.Managers; using Jotunn.Utils; using Microsoft.CodeAnalysis; using Splatform; using TMPro; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.Rendering; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("FreshCommands")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("3.1.1.0")] [assembly: AssemblyInformationalVersion("3.1.1+aa8f65604811b3216f98beb10c9bf76fa4c5090b")] [assembly: AssemblyProduct("FreshCommands")] [assembly: AssemblyTitle("FreshCommands")] [assembly: AssemblyVersion("3.1.1.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace JuStIIFrEsH.Valheim.FreshCommands { public sealed class WayfarersReachVfx : MonoBehaviour { [SerializeField] private Transform portalCore; [SerializeField] private Transform portalEnergy; [SerializeField] private Transform portalAura; [SerializeField] private Renderer portalAuraRenderer; [SerializeField] private Renderer runeRenderer; [SerializeField] private float coreDegreesPerSecond = 5.5f; [SerializeField] private float energyDegreesPerSecond = 12f; [SerializeField] private float auraDegreesPerSecond = 1.5f; [SerializeField] private float auraPulseSeconds = 3.4f; [SerializeField] private float runePulseSeconds = 2.6f; [SerializeField] private Color auraEmission = new Color(0f, 0.35f, 0.5f, 1f); [SerializeField] private Color runeEmission = new Color(0f, 1.8f, 2.4f, 1f); private Material auraMaterial; private Material runeMaterial; private Renderer crackleRenderer; private MaterialPropertyBlock crackleProperties; private Renderer flameRenderer; private MaterialPropertyBlock flameProperties; private Texture2D[] flameFrames; private int lastFlameFrame = -1; private Vector3 auraBaseScale; public void Initialize(Transform core, Transform energy, Transform aura, Renderer auraRenderer, Renderer runes) { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) portalCore = core; portalEnergy = energy; portalAura = aura; portalAuraRenderer = auraRenderer; runeRenderer = runes; auraBaseScale = (Object.op_Implicit((Object)(object)portalAura) ? portalAura.localScale : Vector3.one); InitializeMaterials(); } private void Awake() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) auraBaseScale = (Object.op_Implicit((Object)(object)portalAura) ? portalAura.localScale : Vector3.one); InitializeMaterials(); } private void InitializeMaterials() { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Expected O, but got Unknown if (Object.op_Implicit((Object)(object)portalCore) && !Object.op_Implicit((Object)(object)flameRenderer)) { flameRenderer = ((Component)portalCore).GetComponent<Renderer>(); flameProperties = new MaterialPropertyBlock(); flameFrames = WayfarersReachAsset.GetFlameFrames(); } if (Object.op_Implicit((Object)(object)portalEnergy) && !Object.op_Implicit((Object)(object)crackleRenderer)) { crackleRenderer = ((Component)portalEnergy).GetComponent<Renderer>(); crackleProperties = new MaterialPropertyBlock(); } if (Object.op_Implicit((Object)(object)portalAuraRenderer) && !Object.op_Implicit((Object)(object)auraMaterial)) { auraMaterial = portalAuraRenderer.material; auraMaterial.EnableKeyword("_EMISSION"); } if (Object.op_Implicit((Object)(object)runeRenderer) && !Object.op_Implicit((Object)(object)runeMaterial)) { runeMaterial = runeRenderer.material; runeMaterial.EnableKeyword("_EMISSION"); } } private void Update() { //IL_0208: 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_02be: Unknown result type (might be due to invalid IL or missing references) //IL_02c5: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_0344: Unknown result type (might be due to invalid IL or missing references) //IL_034b: Unknown result type (might be due to invalid IL or missing references) float time = Time.time; if (Object.op_Implicit((Object)(object)flameRenderer) && flameFrames != null) { int num = Mathf.FloorToInt(time * 16f) % flameFrames.Length; if (num != lastFlameFrame) { lastFlameFrame = num; flameRenderer.GetPropertyBlock(flameProperties); flameProperties.SetTexture("_MainTex", (Texture)(object)flameFrames[num]); flameProperties.SetTexture("_EmissionMap", (Texture)(object)flameFrames[num]); flameRenderer.SetPropertyBlock(flameProperties); } } if (Object.op_Implicit((Object)(object)portalCore)) { portalCore.Rotate(coreDegreesPerSecond * (0.35f + 0.12f * Mathf.Sin(time * 0.31f)) * Time.deltaTime, (0f - coreDegreesPerSecond) * Time.deltaTime, coreDegreesPerSecond * 0.55f * Time.deltaTime, (Space)1); } if (Object.op_Implicit((Object)(object)portalEnergy)) { portalEnergy.Rotate((0f - energyDegreesPerSecond) * 0.65f * Time.deltaTime, energyDegreesPerSecond * (0.85f + 0.18f * Mathf.Sin(time * 0.71f)) * Time.deltaTime, (0f - energyDegreesPerSecond) * 0.4f * Time.deltaTime, (Space)1); } if (Object.op_Implicit((Object)(object)portalAura)) { portalAura.Rotate(auraDegreesPerSecond * 0.55f * Time.deltaTime, auraDegreesPerSecond * Time.deltaTime, (0f - auraDegreesPerSecond) * 0.35f * Time.deltaTime, (Space)1); } if (Object.op_Implicit((Object)(object)auraMaterial)) { float num2 = Mathf.Max(0.2f, auraPulseSeconds); float num3 = Mathf.Sin(Time.time * MathF.PI * 2f / num2); float num4 = 0.72f + 0.12f * num3; if (auraMaterial.HasProperty("_EmissionColor")) { auraMaterial.SetColor("_EmissionColor", auraEmission * num4); } if (Object.op_Implicit((Object)(object)portalAura)) { portalAura.localScale = auraBaseScale * (1f + 0.006f * num3); } } if (Object.op_Implicit((Object)(object)crackleRenderer) && crackleProperties != null) { float num5 = 0.68f + 0.22f * Mathf.Sin(time * 9.7f) + 0.1f * Mathf.Sin(time * 23.3f); crackleRenderer.GetPropertyBlock(crackleProperties); crackleProperties.SetColor("_EmissionColor", new Color(0f, 1f, 1.25f, 1f) * num5); crackleRenderer.SetPropertyBlock(crackleProperties); } if (Object.op_Implicit((Object)(object)runeMaterial)) { float num6 = Mathf.Max(0.2f, runePulseSeconds); float num7 = 0.72f + 0.28f * Mathf.Sin(Time.time * MathF.PI * 2f / num6); if (runeMaterial.HasProperty("_EmissionColor")) { runeMaterial.SetColor("_EmissionColor", runeEmission * num7); } } } private void OnDestroy() { if (Object.op_Implicit((Object)(object)auraMaterial)) { Object.Destroy((Object)(object)auraMaterial); } if (Object.op_Implicit((Object)(object)runeMaterial)) { Object.Destroy((Object)(object)runeMaterial); } } } internal static class BuildIconAccents { internal static GameObject CreateReachFlames(GameObject visualRoot) { //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_0063: Expected O, but got Unknown //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) GameObject prefab = PrefabManager.Instance.GetPrefab("portal_wood"); Transform val = (Object.op_Implicit((Object)(object)prefab) ? prefab.transform.Find("_target_found_red/Particle System/blue flames") : null); if (!Object.op_Implicit((Object)(object)val) || !Object.op_Implicit((Object)(object)((Component)val).GetComponent<ParticleSystem>())) { throw new InvalidOperationException("Effigy-style portal flame is unavailable for Reach's icon."); } GameObject val2 = new GameObject("Reach build-icon flames only") { layer = visualRoot.layer }; val2.transform.SetParent(visualRoot.transform, false); for (int i = -1; i <= 1; i += 2) { CreateAndFill(val, val2.transform, "Tine fire", new Vector3((float)i * 0.27f, 1.22f, 0.11f), new Vector3(0.11f, 0.46f, 0.08f), 37f); CreateAndFill(val, val2.transform, "Tip fire", new Vector3((float)i * 0.23f, 1.52f, 0.11f), new Vector3(0.15f, 0.12f, 0.07f), 21f); } return val2; } private static void CreateAndFill(Transform source, Transform root, string name, Vector3 position, Vector3 size, float emissionRate) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0004: Unknown result type (might be due to invalid IL or missing references) ParticleSystem obj = CorpsecallerCyanVisual.CreateFlameStrip(source, root, name, position, size, emissionRate); obj.Play(); obj.Simulate(0.8f, false, false, true); } } internal static class ControllerHints { internal static bool Active => ZInput.IsGamepadActive(); internal static string AlternateUseKey { get { if (!Active || !ZInput.IsNonClassicFunctionality()) { return "$KEY_AltPlace"; } return "$KEY_AltKeys"; } } internal static string MapControls { get { if (!Active) { return "Ctrl+Shift+Click: Travel to saved marker\nAlt+Shift+Click: Save a new marker"; } return Bound("JoyDPadLeft") + " + " + Bound("JoyButtonA") + ": Travel to saved marker\n" + Bound("JoyDPadLeft") + " + " + Bound("JoyButtonY") + ": Save a new marker"; } } internal static Vector3 MapCenterScreenPoint => new Vector3((float)Screen.width * 0.5f, (float)Screen.height * 0.5f, 0f); internal static Vector3 MapScreenPoint { get { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) if (!Active) { return ZInput.pointerPosition; } return MapCenterScreenPoint; } } private static string Bound(string action) { ZInput instance = ZInput.instance; string text = ((instance != null) ? instance.GetBoundKeyString(action, false) : null); if (!string.IsNullOrEmpty(text)) { return text; } return action; } } internal static class CorpsecallerCyanVisual { private static readonly Color EyeColor = new Color(0.02f, 0.7f, 1f, 1f); internal static void Create(GameObject skull, Transform root, Bounds skullBounds) { //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_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Expected O, but got Unknown //IL_0099: 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_015e: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: 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_01f8: 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_021f: Unknown result type (might be due to invalid IL or missing references) //IL_0232: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_0250: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_0269: Unknown result type (might be due to invalid IL or missing references) //IL_027b: Unknown result type (might be due to invalid IL or missing references) //IL_028b: Unknown result type (might be due to invalid IL or missing references) //IL_02a6: Unknown result type (might be due to invalid IL or missing references) //IL_02b2: Unknown result type (might be due to invalid IL or missing references) //IL_02c5: Unknown result type (might be due to invalid IL or missing references) //IL_02d1: 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_02ea: Unknown result type (might be due to invalid IL or missing references) //IL_02fc: Unknown result type (might be due to invalid IL or missing references) //IL_030e: Unknown result type (might be due to invalid IL or missing references) //IL_031e: Unknown result type (might be due to invalid IL or missing references) Renderer[] componentsInChildren = skull.GetComponentsInChildren<Renderer>(true); foreach (Renderer val in componentsInChildren) { Material[] sharedMaterials = val.sharedMaterials; for (int j = 0; j < sharedMaterials.Length; j++) { Material val2 = sharedMaterials[j]; if (Object.op_Implicit((Object)(object)val2) && val2.HasProperty("_EmissionColor")) { Color color = val2.GetColor("_EmissionColor"); if (!(((Color)(ref color)).maxColorComponent <= 0.01f)) { Material val3 = new Material(val2) { name = "Effigy cyan " + ((Object)val2).name }; val3.EnableKeyword("_EMISSION"); val3.SetColor("_EmissionColor", EyeColor * Mathf.Clamp(((Color)(ref color)).maxColorComponent, 1.25f, 2.2f)); sharedMaterials[j] = val3; } } } val.sharedMaterials = sharedMaterials; } GameObject prefab = PrefabManager.Instance.GetPrefab("portal_wood"); Transform val4 = (Object.op_Implicit((Object)(object)prefab) ? prefab.transform.Find("_target_found_red/Particle System/blue flames") : null); if (!Object.op_Implicit((Object)(object)val4) || !Object.op_Implicit((Object)(object)((Component)val4).GetComponent<ParticleSystem>())) { throw new InvalidOperationException("Vanilla portal flame is unavailable for the Effigy."); } float num = ((((Bounds)(ref skullBounds)).center.z < 0f) ? (-1f) : 1f); float num2 = ((Bounds)(ref skullBounds)).center.z + num * ((Bounds)(ref skullBounds)).extents.z * 0.7f; float num3 = ((Bounds)(ref skullBounds)).center.y + ((Bounds)(ref skullBounds)).extents.y * 0.72f; ParticleSystem[] flames = (ParticleSystem[])(object)new ParticleSystem[3] { CreateFlameStrip(val4, root, "Effigy crown fire", new Vector3(((Bounds)(ref skullBounds)).center.x, num3, num2), new Vector3(((Bounds)(ref skullBounds)).size.x * 0.75f, ((Bounds)(ref skullBounds)).size.y * 0.11f, ((Bounds)(ref skullBounds)).size.z * 0.38f), 34f), CreateFlameStrip(val4, root, "Effigy left temple fire", new Vector3(((Bounds)(ref skullBounds)).center.x - ((Bounds)(ref skullBounds)).extents.x * 0.72f, ((Bounds)(ref skullBounds)).center.y + ((Bounds)(ref skullBounds)).extents.y * 0.12f, num2), new Vector3(((Bounds)(ref skullBounds)).size.x * 0.12f, ((Bounds)(ref skullBounds)).size.y * 0.42f, ((Bounds)(ref skullBounds)).size.z * 0.24f), 15f), CreateFlameStrip(val4, root, "Effigy right temple fire", new Vector3(((Bounds)(ref skullBounds)).center.x + ((Bounds)(ref skullBounds)).extents.x * 0.72f, ((Bounds)(ref skullBounds)).center.y + ((Bounds)(ref skullBounds)).extents.y * 0.12f, num2), new Vector3(((Bounds)(ref skullBounds)).size.x * 0.12f, ((Bounds)(ref skullBounds)).size.y * 0.42f, ((Bounds)(ref skullBounds)).size.z * 0.24f), 15f) }; ((Component)root).gameObject.AddComponent<CorpsecallerCorpseFlames>().Flames = flames; } internal static ParticleSystem CreateFlameStrip(Transform source, Transform root, string name, Vector3 position, Vector3 size, float emissionRate) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_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_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: 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_00d7: 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_00fc: 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_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) ParticleSystem obj = CloneCyanFlame(source, root, position, name); MainModule main = obj.main; ((MainModule)(ref main)).loop = true; ((MainModule)(ref main)).playOnAwake = false; ((MainModule)(ref main)).prewarm = false; ((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)0; ((MainModule)(ref main)).scalingMode = (ParticleSystemScalingMode)0; ((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(Color.white); ((MainModule)(ref main)).startSize = new MinMaxCurve(0.13f, 0.25f); ((MainModule)(ref main)).startLifetime = new MinMaxCurve(0.45f, 0.8f); ((MainModule)(ref main)).startSpeed = new MinMaxCurve(0.04f, 0.12f); ((MainModule)(ref main)).maxParticles = 80; ShapeModule shape = obj.shape; ((ShapeModule)(ref shape)).enabled = true; ((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)5; ((ShapeModule)(ref shape)).position = Vector3.zero; ((ShapeModule)(ref shape)).rotation = Vector3.zero; ((ShapeModule)(ref shape)).scale = size; EmissionModule emission = obj.emission; ((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(emissionRate); VelocityOverLifetimeModule velocityOverLifetime = obj.velocityOverLifetime; ((VelocityOverLifetimeModule)(ref velocityOverLifetime)).enabled = true; ((VelocityOverLifetimeModule)(ref velocityOverLifetime)).x = new MinMaxCurve(0f, 0f); ((VelocityOverLifetimeModule)(ref velocityOverLifetime)).y = new MinMaxCurve(0.28f, 0.48f); ((VelocityOverLifetimeModule)(ref velocityOverLifetime)).z = new MinMaxCurve(0f, 0f); NoiseModule noise = obj.noise; ((NoiseModule)(ref noise)).enabled = true; ((NoiseModule)(ref noise)).strength = MinMaxCurve.op_Implicit(0.13f); ((NoiseModule)(ref noise)).frequency = 0.7f; obj.Stop(true, (ParticleSystemStopBehavior)0); return obj; } private static ParticleSystem CloneCyanFlame(Transform source, Transform root, Vector3 position, string name) { //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_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_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) GameObject val = Object.Instantiate<GameObject>(((Component)source).gameObject, root, false); ((Object)val).name = name; val.layer = ((Component)root).gameObject.layer; MonoBehaviour[] componentsInChildren = val.GetComponentsInChildren<MonoBehaviour>(true); for (int i = 0; i < componentsInChildren.Length; i++) { Object.DestroyImmediate((Object)(object)componentsInChildren[i]); } for (int num = val.transform.childCount - 1; num >= 0; num--) { Object.DestroyImmediate((Object)(object)((Component)val.transform.GetChild(num)).gameObject); } val.transform.localPosition = position; val.transform.localRotation = Quaternion.identity; val.transform.localScale = Vector3.one; ParticleSystem component = val.GetComponent<ParticleSystem>(); CustomDataModule customData = component.customData; ((CustomDataModule)(ref customData)).enabled = true; ((CustomDataModule)(ref customData)).SetMode((ParticleSystemCustomData)0, (ParticleSystemCustomDataMode)2); ((CustomDataModule)(ref customData)).SetMode((ParticleSystemCustomData)1, (ParticleSystemCustomDataMode)2); ((CustomDataModule)(ref customData)).SetColor((ParticleSystemCustomData)0, new MinMaxGradient(new Color(0.002f, 0.035f, 0.14f, 1f))); ((CustomDataModule)(ref customData)).SetColor((ParticleSystemCustomData)1, new MinMaxGradient(new Color(0.015f, 0.44f, 0.82f, 1f))); ParticleSystemRenderer component2 = val.GetComponent<ParticleSystemRenderer>(); ((Renderer)component2).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)component2).receiveShadows = false; return component; } } public sealed class CorpsecallerCorpseFlames : MonoBehaviour { public ParticleSystem[] Flames; private ZNetView networkView; private bool active; private float nextCheck; private void Awake() { networkView = ((Component)this).GetComponent<ZNetView>(); } private void OnDisable() { active = false; if (Flames == null) { return; } ParticleSystem[] flames = Flames; foreach (ParticleSystem val in flames) { if (Object.op_Implicit((Object)(object)val)) { val.Stop(true, (ParticleSystemStopBehavior)0); } } } private void Update() { if (Time.time < nextCheck) { return; } nextCheck = Time.time + 1f; bool flag = Object.op_Implicit((Object)(object)networkView) && networkView.IsValid() && Flames != null && Plugin.LocalPlayerHasRetrievableTombstone(); if (flag == active) { return; } active = flag; if (active) { ParticleSystem[] flames = Flames; foreach (ParticleSystem val in flames) { if (Object.op_Implicit((Object)(object)val)) { val.Play(); val.Emit(8); } } } else { if (Flames == null) { return; } ParticleSystem[] flames = Flames; foreach (ParticleSystem val2 in flames) { if (Object.op_Implicit((Object)(object)val2)) { val2.Stop(true, (ParticleSystemStopBehavior)0); } } } } } public sealed class CorpsecallerEffigy : MonoBehaviour, Hoverable, Interactable { public string GetHoverName() { return "Corpsecaller's Effigy"; } public float GetHoverOffset() { return 0.35f; } public string GetHoverText() { return Localization.instance.Localize("Corpsecaller's Effigy\n[<color=yellow>$KEY_Use</color>] Recover most recent corpse\n[<color=yellow>" + ControllerHints.AlternateUseKey + " + $KEY_Use</color>] Teleport to most recent corpse"); } public bool UseItem(Humanoid user, ItemData item) { return false; } public bool Interact(Humanoid user, bool hold, bool alt) { if (hold || (Object)(object)user != (Object)(object)Player.m_localPlayer) { return false; } Plugin.UseCorpsecallerEffigy(Player.m_localPlayer, alt); return true; } } internal static class CorpsecallerPlaque { internal static void Create(Transform parent, Transform pieceRoot, Bounds skullBounds, Material source) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0074: 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_008d: 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_00c7: Expected O, but got Unknown //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0127: 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_017b: Unknown result type (might be due to invalid IL or missing references) float width = Mathf.Clamp(((Bounds)(ref skullBounds)).size.x * 1.18f, 0.56f, 0.92f); float height = Mathf.Clamp(((Bounds)(ref skullBounds)).size.y * 1.16f, 0.72f, 1.12f); float num = ((((Bounds)(ref skullBounds)).center.z < 0f) ? (-1f) : 1f); Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(((Bounds)(ref skullBounds)).center.x, ((Bounds)(ref skullBounds)).center.y, ((Bounds)(ref skullBounds)).center.z - num * (((Bounds)(ref skullBounds)).extents.z + 0.003f + 0.009f)); GameObject val2 = new GameObject("Corpsecaller's dark iron plaque") { layer = ((Component)parent).gameObject.layer }; val2.transform.SetParent(parent, false); val2.transform.localPosition = parent.InverseTransformPoint(pieceRoot.TransformPoint(val)); Quaternion val3 = ((num < 0f) ? Quaternion.Euler(0f, 180f, 0f) : Quaternion.identity); val2.transform.localRotation = Quaternion.Inverse(parent.localRotation) * val3; Material val4 = CreateMaterial(source, "Effigy plaque dark face", new Color(0.105f, 0.078f, 0.06f, 1f), 0.38f, 0.24f); Material val5 = CreateMaterial(source, "Effigy plaque warm iron rim", new Color(0.26f, 0.19f, 0.13f, 1f), 0.68f, 0.32f); Mesh sharedMesh = CreateMesh(width, height, 0.018f); val2.AddComponent<MeshFilter>().sharedMesh = sharedMesh; ((Renderer)val2.AddComponent<MeshRenderer>()).sharedMaterials = (Material[])(object)new Material[2] { val4, val5 }; CreateRivets(val2.transform, width, height, 0.018f, val5); } private static Material CreateMaterial(Material source, string name, Color color, float metallic, float smoothness) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Expected O, but got Unknown //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) Material val = new Material(source) { name = name }; if (val.HasProperty("_Color")) { val.SetColor("_Color", color); } if (val.HasProperty("_Metallic")) { val.SetFloat("_Metallic", metallic); } if (val.HasProperty("_Glossiness")) { val.SetFloat("_Glossiness", smoothness); } if (val.HasProperty("_Smoothness")) { val.SetFloat("_Smoothness", smoothness); } if (val.HasProperty("_EmissionColor")) { val.SetColor("_EmissionColor", Color.black); } return val; } private static Mesh CreateMesh(float width, float height, float depth) { //IL_008d: 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_0103: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_022c: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Unknown result type (might be due to invalid IL or missing references) //IL_0272: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Expected O, but got Unknown //IL_02a3: Unknown result type (might be due to invalid IL or missing references) //IL_02b9: 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) float num = width * 0.5f; float num2 = height * 0.5f; float num3 = (0f - depth) * 0.5f; float num4 = depth * 0.5f; Vector2[] array = Outline(num, num2, 0.055f); Vector2[] array2 = Outline(num - 0.012f, num2 - 0.012f, Mathf.Max(0.012f, 0.042999998f)); List<Vector3> list = new List<Vector3>(25); List<int> list2 = new List<int>(24); List<int> list3 = new List<int>(48); for (int i = 0; i < 8; i++) { list.Add(new Vector3(array[i].x, array[i].y, num3)); } for (int j = 0; j < 8; j++) { list.Add(new Vector3(array[j].x, array[j].y, num4)); } for (int k = 0; k < 8; k++) { list.Add(new Vector3(array2[k].x, array2[k].y, num4 - 0.004f)); } for (int l = 0; l < 8; l++) { int num5 = (l + 1) % 8; int item = l; int item2 = num5; int item3 = 8 + l; int item4 = 8 + num5; int item5 = 16 + l; int item6 = 16 + num5; list3.Add(item3); list3.Add(item); list3.Add(item2); list3.Add(item3); list3.Add(item2); list3.Add(item4); list3.Add(item3); list3.Add(item4); list3.Add(item6); list3.Add(item3); list3.Add(item6); list3.Add(item5); } int count = list.Count; list.Add(Vector3.zero); for (int m = 0; m < 8; m++) { int item7 = 16 + m; int item8 = 16 + (m + 1) % 8; list2.Add(count); list2.Add(item7); list2.Add(item8); } int count2 = list.Count; list.Add(new Vector3(0f, 0f, num3)); for (int n = 0; n < 8; n++) { int item9 = n; int item10 = (n + 1) % 8; list2.Add(count2); list2.Add(item10); list2.Add(item9); } Mesh val = new Mesh { name = "Effigy clipped-corner plaque" }; val.SetVertices(list); Vector2[] array3 = (Vector2[])(object)new Vector2[list.Count]; for (int num6 = 0; num6 < list.Count; num6++) { array3[num6] = new Vector2(list[num6].x / width + 0.5f, list[num6].y / height + 0.5f); } val.uv = array3; val.subMeshCount = 2; val.SetTriangles(list2, 0); val.SetTriangles(list3, 1); val.RecalculateNormals(); val.RecalculateBounds(); return val; } private static Vector2[] Outline(float halfWidth, float halfHeight, float clip) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_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_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) return (Vector2[])(object)new Vector2[8] { new Vector2(0f - halfWidth + clip, 0f - halfHeight), new Vector2(halfWidth - clip, 0f - halfHeight), new Vector2(halfWidth, 0f - halfHeight + clip), new Vector2(halfWidth, halfHeight - clip), new Vector2(halfWidth - clip, halfHeight), new Vector2(0f - halfWidth + clip, halfHeight), new Vector2(0f - halfWidth, halfHeight - clip), new Vector2(0f - halfWidth, 0f - halfHeight + clip) }; } private static void CreateRivets(Transform parent, float width, float height, float depth, Material material) { //IL_00a8: 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) float num = width * 0.405f; float num2 = height * 0.405f; float num3 = depth * 0.5f + 0.0015f; float[] array = new float[2] { -1f, 1f }; foreach (float num4 in array) { float[] array2 = new float[2] { -1f, 1f }; foreach (float num5 in array2) { GameObject obj = GameObject.CreatePrimitive((PrimitiveType)0); ((Object)obj).name = "Plaque corner rivet"; obj.layer = ((Component)parent).gameObject.layer; obj.transform.SetParent(parent, false); obj.transform.localPosition = new Vector3(num4 * num, num5 * num2, num3); obj.transform.localScale = new Vector3(0.038f, 0.038f, 0.008f); Object.DestroyImmediate((Object)(object)obj.GetComponent<Collider>()); ((Renderer)obj.GetComponent<MeshRenderer>()).sharedMaterial = material; } } } } internal sealed class MapLocationNameDialog : MonoBehaviour, TextReceiver { private static MapLocationNameDialog instance; private Vector3 position; private InputField nameField; private Text errorText; private GameObject panel; private Image overlayImage; private CursorLockMode previousLock; private bool previousVisible; private bool controllerMode; private bool nativeEntryOpen; private bool nameEntered; private int nativeEntryFrame; internal static bool IsOpen => Object.op_Implicit((Object)(object)instance); internal static void Show(Vector3 position) { //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_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)instance) && Object.op_Implicit((Object)(object)GUIManager.CustomGUIFront)) { GameObject val = new GameObject("FreshCommands save map location", new Type[2] { typeof(RectTransform), typeof(Image) }) { layer = 5 }; val.transform.SetParent(GUIManager.CustomGUIFront.transform, false); instance = val.AddComponent<MapLocationNameDialog>(); instance.position = position; instance.controllerMode = ControllerHints.Active || ZInput.GetButton("JoyDPadLeft"); instance.Build(); } } private void Build() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0034: 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_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: 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_00cc: 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_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: 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_0139: 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_0176: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Expected O, but got Unknown //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_029a: Unknown result type (might be due to invalid IL or missing references) //IL_02a9: Unknown result type (might be due to invalid IL or missing references) //IL_02be: Unknown result type (might be due to invalid IL or missing references) //IL_02e2: Unknown result type (might be due to invalid IL or missing references) //IL_02f8: Unknown result type (might be due to invalid IL or missing references) //IL_0302: Expected O, but got Unknown //IL_031c: Unknown result type (might be due to invalid IL or missing references) //IL_0332: Unknown result type (might be due to invalid IL or missing references) //IL_033c: Expected O, but got Unknown previousLock = Cursor.lockState; previousVisible = Cursor.visible; GUIManager.BlockInput(true); Cursor.lockState = (CursorLockMode)0; Cursor.visible = true; RectTransform val = (RectTransform)((Component)this).transform; val.anchorMin = Vector2.zero; val.anchorMax = Vector2.one; Vector2 val2 = (val.offsetMin = (val.offsetMax = Vector2.zero)); overlayImage = ((Component)this).GetComponent<Image>(); ((Graphic)overlayImage).color = new Color(0f, 0f, 0f, 0.55f); panel = Box("Panel", ((Component)this).transform, new Color(0.1f, 0.075f, 0.045f, 0.98f)); RectTransform val4 = (RectTransform)panel.transform; ((Vector2)(ref val2))..ctor(0.5f, 0.5f); val4.anchorMax = val2; val4.anchorMin = val2; val4.sizeDelta = new Vector2(720f, 370f); Text obj = Label("Title", panel.transform, "Save map location", 44); Place(((Graphic)obj).rectTransform, new Vector2(0f, 105f), new Vector2(650f, 65f)); ((Graphic)obj).color = GUIManager.Instance.ValheimOrange; GameObject val5 = Box("Name field", panel.transform, new Color(0.03f, 0.025f, 0.02f, 1f)); Place((RectTransform)val5.transform, new Vector2(0f, 20f), new Vector2(600f, 65f)); nameField = val5.AddComponent<InputField>(); nameField.characterLimit = 32; Text val6 = Label("Name", val5.transform, "", 32); val6.alignment = (TextAnchor)3; ((Graphic)val6).color = GUIManager.Instance.ValheimBeige; Stretch(((Graphic)val6).rectTransform); Text val7 = Label("Placeholder", val5.transform, "Location name", 32); val7.alignment = (TextAnchor)3; ((Graphic)val7).color = new Color(0.65f, 0.61f, 0.52f, 0.8f); Stretch(((Graphic)val7).rectTransform); nameField.textComponent = val6; nameField.placeholder = (Graphic)(object)val7; errorText = Label("Error", panel.transform, "Letters, numbers, _ and - only (max 32).", 25); Place(((Graphic)errorText).rectTransform, new Vector2(0f, -45f), new Vector2(650f, 42f)); ((Graphic)errorText).color = GUIManager.Instance.ValheimBeige; ((UnityEvent)ActionButton(panel.transform, "Save", new Vector2(-155f, -125f)).onClick).AddListener(new UnityAction(Save)); ((UnityEvent)ActionButton(panel.transform, "Cancel", new Vector2(155f, -125f)).onClick).AddListener(new UnityAction(Close)); if (controllerMode) { errorText.text = "A: enter name B: cancel"; return; } nameField.ActivateInputField(); ((Selectable)nameField).Select(); } private void Update() { if (nativeEntryOpen) { if (!TextInput.IsVisible() && Time.frameCount > nativeEntryFrame + 3) { nativeEntryOpen = false; ((Behaviour)overlayImage).enabled = true; ((Graphic)overlayImage).raycastTarget = true; panel.SetActive(true); } } else if (controllerMode) { if (ZInput.GetButtonDown("JoyButtonB")) { Close(); } else if (ZInput.GetButtonDown("JoyButtonX")) { OpenNativeEntry(); } else if (ZInput.GetButtonDown("JoyButtonA")) { if (nameEntered) { Save(); } else { OpenNativeEntry(); } } } else if (!TextInput.IsVisible()) { if (Input.GetKeyDown((KeyCode)27)) { Close(); } else if (Input.GetKeyDown((KeyCode)13) || Input.GetKeyDown((KeyCode)271)) { Save(); } } } public string GetText() { if (!Object.op_Implicit((Object)(object)nameField)) { return string.Empty; } return nameField.text; } public void SetText(string text) { if (Object.op_Implicit((Object)(object)nameField)) { nameField.text = text ?? string.Empty; nameEntered = !string.IsNullOrWhiteSpace(nameField.text); if (controllerMode) { errorText.text = (nameEntered ? "A: save X: edit B: cancel" : "A: enter name B: cancel"); } else { SaveName(text); } } } private void OpenNativeEntry() { if (Object.op_Implicit((Object)(object)TextInput.instance)) { nativeEntryOpen = true; nativeEntryFrame = Time.frameCount; panel.SetActive(false); ((Behaviour)overlayImage).enabled = false; ((Graphic)overlayImage).raycastTarget = false; TextInput.instance.RequestText((TextReceiver)(object)this, "Save map location", 32); } } private void Save() { SaveName(nameField.text); } private void SaveName(string value) { //IL_0085: Unknown result type (might be due to invalid IL or missing references) string text = (value ?? string.Empty).Trim(); if (text.Length == 0 || text.Length > 32 || text.Equals("home", StringComparison.OrdinalIgnoreCase) || text.Equals("corpse", StringComparison.OrdinalIgnoreCase)) { ShowError("Enter a name (home and corpse are reserved)."); return; } string text2 = text; foreach (char c in text2) { if (!char.IsLetterOrDigit(c) && c != '_' && c != '-') { ShowError("Names may use letters, numbers, _ and - only."); return; } } Plugin.SaveMapLocation(text, position); Close(); } private void ShowError(string message) { if (Object.op_Implicit((Object)(object)errorText)) { errorText.text = (controllerMode ? (message + " X: edit") : message); } } private void Close() { if (Object.op_Implicit((Object)(object)this)) { Object.Destroy((Object)(object)((Component)this).gameObject); } } private void OnDestroy() { //IL_002c: Unknown result type (might be due to invalid IL or missing references) if (nativeEntryOpen && TextInput.IsVisible() && Object.op_Implicit((Object)(object)TextInput.instance)) { TextInput.instance.Hide(); } GUIManager.BlockInput(false); Cursor.lockState = previousLock; Cursor.visible = previousVisible; if ((Object)(object)instance == (Object)(object)this) { instance = null; } } private static GameObject Box(string name, Transform parent, Color color) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002d: 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_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Expected O, but got Unknown GameObject val = new GameObject(name, new Type[2] { typeof(RectTransform), typeof(Image) }) { layer = 5 }; val.transform.SetParent(parent, false); ((Graphic)val.GetComponent<Image>()).color = color; return val; } private static Text Label(string name, Transform parent, string value, int size) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name, new Type[2] { typeof(RectTransform), typeof(Text) }) { layer = 5 }; val.transform.SetParent(parent, false); Text component = val.GetComponent<Text>(); component.font = GUIManager.Instance.AveriaSerif; component.fontSize = size; component.text = value; component.alignment = (TextAnchor)4; return component; } private static Button ActionButton(Transform parent, string caption, Vector2 position) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_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_0041: Expected O, but got Unknown //IL_0059: 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) GameObject val = Box(caption, parent, new Color(0.22f, 0.15f, 0.08f, 1f)); Place((RectTransform)val.transform, position, new Vector2(260f, 62f)); Button obj = val.AddComponent<Button>(); ((Selectable)obj).targetGraphic = (Graphic)(object)val.GetComponent<Image>(); ((Selectable)obj).colors = GUIManager.Instance.ValheimButtonColorBlock; Text obj2 = Label("Label", val.transform, caption, 32); ((Graphic)obj2).color = GUIManager.Instance.ValheimBeige; Stretch(((Graphic)obj2).rectTransform); return obj; } private static void Place(RectTransform rect, Vector2 position, Vector2 size) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(0.5f, 0.5f); rect.anchorMax = val; rect.anchorMin = val; rect.sizeDelta = size; rect.anchoredPosition = position; } private static void Stretch(RectTransform rect) { //IL_0001: 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_0021: 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) rect.anchorMin = Vector2.zero; rect.anchorMax = Vector2.one; rect.offsetMin = new Vector2(16f, 0f); rect.offsetMax = new Vector2(-16f, 0f); } } internal static class OathstoneShards { private static readonly float[] Heights = new float[7] { 0.28f, 0.68f, 1.15f, 1.52f, 1.86f, 2.22f, 2.46f }; private static readonly float[] LeftWidths = new float[7] { 0.3f, 0.34f, 0.26f, 0.32f, 0.19f, 0.22f, 0.025f }; private static readonly float[] RightWidths = new float[7] { 0.32f, 0.27f, 0.34f, 0.23f, 0.27f, 0.12f, 0.018f }; internal static void Create(Transform parent, Material stone, Material glow) { //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: 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_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_022c: Unknown result type (might be due to invalid IL or missing references) //IL_0235: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_0258: 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_00df: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_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_0172: 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_0320: Unknown result type (might be due to invalid IL or missing references) //IL_032b: Unknown result type (might be due to invalid IL or missing references) //IL_0332: Unknown result type (might be due to invalid IL or missing references) //IL_0337: Unknown result type (might be due to invalid IL or missing references) //IL_033c: Unknown result type (might be due to invalid IL or missing references) //IL_034a: Unknown result type (might be due to invalid IL or missing references) //IL_034f: Unknown result type (might be due to invalid IL or missing references) //IL_0354: Unknown result type (might be due to invalid IL or missing references) //IL_0362: Unknown result type (might be due to invalid IL or missing references) //IL_036b: Unknown result type (might be due to invalid IL or missing references) //IL_0372: 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_038a: 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_0394: Unknown result type (might be due to invalid IL or missing references) //IL_0398: Unknown result type (might be due to invalid IL or missing references) //IL_03ac: Unknown result type (might be due to invalid IL or missing references) //IL_03be: Unknown result type (might be due to invalid IL or missing references) //IL_03c0: 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_03cd: Unknown result type (might be due to invalid IL or missing references) //IL_03cf: Unknown result type (might be due to invalid IL or missing references) //IL_03d1: Unknown result type (might be due to invalid IL or missing references) //IL_03e0: Unknown result type (might be due to invalid IL or missing references) //IL_03e5: Unknown result type (might be due to invalid IL or missing references) //IL_03e9: Unknown result type (might be due to invalid IL or missing references) //IL_03f3: Unknown result type (might be due to invalid IL or missing references) //IL_03f8: Unknown result type (might be due to invalid IL or missing references) //IL_03fc: Unknown result type (might be due to invalid IL or missing references) //IL_03fe: Unknown result type (might be due to invalid IL or missing references) //IL_0400: Unknown result type (might be due to invalid IL or missing references) //IL_0405: Unknown result type (might be due to invalid IL or missing references) //IL_0407: Unknown result type (might be due to invalid IL or missing references) //IL_0409: Unknown result type (might be due to invalid IL or missing references) //IL_040e: Unknown result type (might be due to invalid IL or missing references) //IL_0410: Unknown result type (might be due to invalid IL or missing references) //IL_0412: Unknown result type (might be due to invalid IL or missing references) //IL_041e: Unknown result type (might be due to invalid IL or missing references) //IL_0420: Unknown result type (might be due to invalid IL or missing references) //IL_0422: Unknown result type (might be due to invalid IL or missing references) //IL_0427: Unknown result type (might be due to invalid IL or missing references) //IL_0429: Unknown result type (might be due to invalid IL or missing references) //IL_042b: Unknown result type (might be due to invalid IL or missing references) //IL_0430: Unknown result type (might be due to invalid IL or missing references) //IL_0432: Unknown result type (might be due to invalid IL or missing references) //IL_0434: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < 2; i++) { float num = ((i == 0) ? (-1f) : 1f); float[] array = ((i == 0) ? LeftWidths : RightWidths); Vector3[,] array2 = new Vector3[Heights.Length, 6]; for (int j = 0; j < Heights.Length; j++) { float num2 = Heights[j] * ((i == 0) ? 1f : 0.95f); float num3 = num * (0.31f + 0.17f * num2 + ((j % 3 == 1) ? 0.045f : (-0.025f))); float num4 = array[j]; float num5 = 0.18f + (float)(j % 2) * 0.045f; array2[j, 0] = new Vector3(num3 - num4 * 0.7f, num2, 0f - num5); array2[j, 1] = new Vector3(num3 + num4 * 0.62f, num2 + ((j == 6) ? (-0.14f) : 0f), 0f - num5); array2[j, 2] = new Vector3(num3 + num4, num2 + ((j == 6) ? (-0.26f) : 0.018f), -0.025f); array2[j, 3] = new Vector3(num3 + num4 * 0.5f, num2, num5 * 0.8f); array2[j, 4] = new Vector3(num3 - num4 * 0.8f, num2 + ((j == 6) ? (-0.2f) : 0f), num5); array2[j, 5] = new Vector3(num3 - num4, num2, 0.02f); } List<Vector3> v = new List<Vector3>(); for (int k = 0; k < Heights.Length - 1; k++) { for (int l = 0; l < 6; l++) { int num6 = (l + 1) % 6; Triangle(v, array2[k, l], array2[k + 1, l], array2[k + 1, num6]); Triangle(v, array2[k, l], array2[k + 1, num6], array2[k, num6]); } } for (int m = 1; m < 5; m++) { Triangle(v, array2[0, 0], array2[0, m + 1], array2[0, m]); Triangle(v, array2[6, 0], array2[6, m], array2[6, m + 1]); } AddMesh(parent, (i == 0) ? "Fractured left shard" : "Fractured right shard", v, stone); List<Vector3> v2 = new List<Vector3>(); for (int n = 0; n < 4; n++) { float num7 = 0.62f + (float)n * 0.34f + ((i == 1) ? 0.08f : 0f); float num8 = num * (0.31f + 0.17f * num7); int num9 = n + i * 4; Vector2[][] array3 = Glyph(num9); float num10 = 0.1f + 0.018f * (float)(num9 * 3 % 4); float num11 = (float)(num9 % 3 - 1) * 12f; Vector2[][] array4 = array3; foreach (Vector2[] array5 in array4) { for (int num13 = 1; num13 < array5.Length; num13++) { Vector3 val = Quaternion.Euler(0f, 0f, num11) * Vector2.op_Implicit(array5[num13 - 1] * num10) + new Vector3(num8, num7, 0f); Vector3 val2 = Quaternion.Euler(0f, 0f, num11) * Vector2.op_Implicit(array5[num13] * num10) + new Vector3(num8, num7, 0f); val.z = FrontDepth(val.y, i); val2.z = FrontDepth(val2.y, i); Vector3 val3 = new Vector3(0f - (val2 - val).y, (val2 - val).x, 0f); Vector3 val4 = ((Vector3)(ref val3)).normalized * 0.008f; Triangle(v2, val - val4, val + val4, val2 + val4); Triangle(v2, val - val4, val2 + val4, val2 - val4); } } } AddMesh(parent, "Individual carved runes " + i, v2, glow); } } private static float FrontDepth(float y, int side) { y /= ((side == 0) ? 1f : 0.95f); for (int i = 0; i < Heights.Length - 1; i++) { if (y <= Heights[i + 1]) { return 0f - Mathf.Lerp(0.18f + (float)(i % 2) * 0.045f, 0.18f + (float)((i + 1) % 2) * 0.045f, Mathf.InverseLerp(Heights[i], Heights[i + 1], y)) - 0.006f; } } return -0.186f; } private static Vector2[][] Glyph(int i) { //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_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_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_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_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_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0167: 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_018d: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0220: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Unknown result type (might be due to invalid IL or missing references) //IL_0272: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Unknown result type (might be due to invalid IL or missing references) //IL_0288: Unknown result type (might be due to invalid IL or missing references) //IL_028d: Unknown result type (might be due to invalid IL or missing references) //IL_029e: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: Unknown result type (might be due to invalid IL or missing references) //IL_02b4: Unknown result type (might be due to invalid IL or missing references) //IL_02b9: Unknown result type (might be due to invalid IL or missing references) //IL_02da: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Unknown result type (might be due to invalid IL or missing references) //IL_02f0: Unknown result type (might be due to invalid IL or missing references) //IL_02f5: Unknown result type (might be due to invalid IL or missing references) //IL_0306: Unknown result type (might be due to invalid IL or missing references) //IL_030b: Unknown result type (might be due to invalid IL or missing references) //IL_031c: Unknown result type (might be due to invalid IL or missing references) //IL_0321: Unknown result type (might be due to invalid IL or missing references) //IL_0346: Unknown result type (might be due to invalid IL or missing references) //IL_034b: Unknown result type (might be due to invalid IL or missing references) //IL_035c: Unknown result type (might be due to invalid IL or missing references) //IL_0361: Unknown result type (might be due to invalid IL or missing references) Vector2[] array = (Vector2[])(object)new Vector2[2] { new Vector2(0f, -1f), new Vector2(0f, 1f) }; return i switch { 0 => new Vector2[2][] { array, (Vector2[])(object)new Vector2[3] { new Vector2(0f, 1f), new Vector2(0.65f, 0.35f), new Vector2(0f, 0f) } }, 1 => new Vector2[1][] { (Vector2[])(object)new Vector2[4] { new Vector2(-0.5f, -1f), new Vector2(0.3f, 0f), new Vector2(-0.4f, 0.45f), new Vector2(0.4f, 1f) } }, 2 => new Vector2[2][] { array, (Vector2[])(object)new Vector2[3] { new Vector2(-0.6f, 0.3f), new Vector2(0f, 0.75f), new Vector2(0.5f, 0.2f) } }, 3 => new Vector2[1][] { (Vector2[])(object)new Vector2[5] { new Vector2(-0.55f, 0f), new Vector2(0f, 1f), new Vector2(0.55f, 0f), new Vector2(0f, -1f), new Vector2(-0.55f, 0f) } }, 4 => new Vector2[2][] { array, (Vector2[])(object)new Vector2[3] { new Vector2(-0.6f, -0.3f), new Vector2(0f, 0.2f), new Vector2(0.5f, -0.1f) } }, 5 => new Vector2[1][] { (Vector2[])(object)new Vector2[5] { new Vector2(-0.5f, -1f), new Vector2(-0.5f, 1f), new Vector2(0.5f, 0.4f), new Vector2(-0.5f, 0f), new Vector2(0.5f, -0.7f) } }, 6 => new Vector2[1][] { (Vector2[])(object)new Vector2[4] { new Vector2(-0.5f, 0.8f), new Vector2(0.5f, 0.2f), new Vector2(-0.3f, -0.25f), new Vector2(0.3f, -1f) } }, _ => new Vector2[2][] { array, (Vector2[])(object)new Vector2[2] { new Vector2(-0.5f, 0.9f), new Vector2(0.5f, -0.4f) } }, }; } private static void Triangle(List<Vector3> v, Vector3 a, Vector3 b, Vector3 c) { //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) v.Add(a); v.Add(b); v.Add(c); } private static void AddMesh(Transform parent, string name, List<Vector3> v, Material material) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_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_00ac: Expected O, but got Unknown //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) int count = v.Count; for (int i = 0; i < count; i += 3) { v.Add(v[i]); v.Add(v[i + 2]); v.Add(v[i + 1]); } int[] array = new int[v.Count]; Vector2[] array2 = (Vector2[])(object)new Vector2[v.Count]; for (int j = 0; j < v.Count; j++) { array[j] = j; array2[j] = new Vector2(v[j].x, v[j].y); } Mesh val = new Mesh { name = name }; val.SetVertices(v); val.uv = array2; val.triangles = array; val.RecalculateNormals(); val.RecalculateBounds(); GameObject val2 = new GameObject(name) { layer = ((Component)parent).gameObject.layer }; val2.transform.SetParent(parent, false); val2.AddComponent<MeshFilter>().sharedMesh = val; ((Renderer)val2.AddComponent<MeshRenderer>()).sharedMaterial = material; } } internal static class OathstoneVisual { private readonly struct ObjIndex { internal readonly int Vertex; internal readonly int Uv; internal ObjIndex(int vertex, int uv) { Vertex = vertex; Uv = uv; } } private sealed class MeshBuilder { private readonly string name; private readonly List<Vector3> vertices = new List<Vector3>(); private readonly List<Vector2> textureCoordinates = new List<Vector2>(); private readonly List<int> triangles = new List<int>(); internal MeshBuilder(string name) { this.name = name; } internal void Add(ObjIndex index, List<Vector3> positions, List<Vector2> uvs) { //IL_000d: 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_0042: Unknown result type (might be due to invalid IL or missing references) vertices.Add(positions[index.Vertex]); textureCoordinates.Add((index.Uv >= 0 && index.Uv < uvs.Count) ? uvs[index.Uv] : Vector2.zero); triangles.Add(vertices.Count - 1); } internal Mesh Build() { //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_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Expected O, but got Unknown int count = vertices.Count; List<Vector3> list = new List<Vector3>(count * 2); List<Vector2> list2 = new List<Vector2>(textureCoordinates.Count * 2); List<int> list3 = new List<int>(triangles.Count * 2); list.AddRange(vertices); list2.AddRange(textureCoordinates); list3.AddRange(triangles); list.AddRange(vertices); list2.AddRange(textureCoordinates); for (int i = 0; i < triangles.Count; i += 3) { list3.Add(triangles[i] + count); list3.Add(triangles[i + 2] + count); list3.Add(triangles[i + 1] + count); } Mesh val = new Mesh { name = name }; val.SetVertices(list); val.SetUVs(0, list2); val.SetTriangles(list3, 0); val.RecalculateNormals(); val.RecalculateBounds(); return val; } } private const string ObjResource = "FreshCommands.Assets.WayfarersOathstone.obj"; private static readonly Vector3 EyeAnchor = new Vector3(0f, 1.97f, 0.05f); internal static GameObject Create(Transform parent, Material stone, GameObject eyePrefab) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Expected O, but got Unknown //IL_0072: 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_00ba: 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_00cd: Expected O, but got Unknown //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_02d6: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_021f: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) string text = AssetUtils.LoadTextFromResources("FreshCommands.Assets.WayfarersOathstone.obj", Assembly.GetExecutingAssembly()); if (string.IsNullOrEmpty(text)) { throw new InvalidOperationException("Embedded Wayfarer's Oathstone mesh was not found."); } GameObject val = new GameObject("Oathstone shrine visual") { layer = ((Component)parent).gameObject.layer }; val.transform.SetParent(parent, false); Dictionary<string, Mesh> dictionary = ParseObj(text); Material val2 = CreateEyeShellMaterial(stone); Material val3 = CreateGlowMaterial(eyePrefab, stone, "Oathstone eye glow", new Color(0.02f, 0.52f, 0.95f, 1f), 2.15f); Material val4 = CreateGlowMaterial(eyePrefab, stone, "Oathstone rune glow", new Color(0.02f, 0.55f, 1f, 1f), 2.5f); Material val5 = CreatePupilMaterial(stone); GameObject val6 = new GameObject("Suspended Greydwarf Eye") { layer = val.layer }; val6.transform.SetParent(val.transform, false); val6.transform.localPosition = EyeAnchor; Renderer eyeGlowRenderer = null; Renderer runeRenderer = null; foreach (KeyValuePair<string, Mesh> item in dictionary) { bool flag = item.Key == "WO_EyeShell" || item.Key == "WO_EyeIris" || item.Key == "WO_EyePupil"; if (!flag && !(item.Key == "WO_LeftSpire") && !(item.Key == "WO_RightSpire") && !(item.Key == "WO_RuneGlow")) { Mesh value = item.Value; ApplyV2GeometryTransform(item.Key, value); Transform transform = val.transform; Material sharedMaterial = stone; if (flag) { MoveMeshOrigin(value, EyeAnchor); transform = val6.transform; sharedMaterial = ((item.Key == "WO_EyeShell") ? val2 : ((!(item.Key == "WO_EyeIris")) ? val5 : val3)); } else if (item.Key == "WO_RuneGlow") { sharedMaterial = val4; } GameObject val7 = new GameObject(item.Key) { layer = val.layer }; val7.transform.SetParent(transform, false); val7.AddComponent<MeshFilter>().sharedMesh = value; MeshRenderer val8 = val7.AddComponent<MeshRenderer>(); ((Renderer)val8).sharedMaterial = sharedMaterial; if (item.Key == "WO_EyeIris") { eyeGlowRenderer = (Renderer)(object)val8; } if (item.Key == "WO_RuneGlow") { runeRenderer = (Renderer)(object)val8; } } } OathstoneShards.Create(val.transform, stone, val4); CreateVanillaEye(val6.transform, eyePrefab); Light obj = val6.AddComponent<Light>(); obj.color = new Color(0.08f, 0.56f, 1f); obj.range = 1.35f; obj.intensity = 0.12f; obj.shadows = (LightShadows)0; val6.AddComponent<OathstoneEyeMotion>().Initialize(eyeGlowRenderer, runeRenderer); return val; } private static void CreateVanillaEye(Transform parent, GameObject prefab) { //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_001c: Expected O, but got Unknown //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Unknown result type (might be due to invalid IL or missing references) //IL_0292: Unknown result type (might be due to invalid IL or missing references) //IL_0298: 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_02af: Unknown result type (might be due to invalid IL or missing references) //IL_02b5: 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_0090: Expected O, but got Unknown //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_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Expected O, but got Unknown //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("Vanilla Greydwarf Eye visual") { layer = ((Component)parent).gameObject.layer }; val.transform.SetParent(parent, false); Bounds val2 = default(Bounds); bool flag = false; MeshFilter[] componentsInChildren = prefab.GetComponentsInChildren<MeshFilter>(true); foreach (MeshFilter val3 in componentsInChildren) { MeshRenderer component = ((Component)val3).GetComponent<MeshRenderer>(); if (!Object.op_Implicit((Object)(object)val3.sharedMesh) || !Object.op_Implicit((Object)(object)component)) { continue; } GameObject val4 = new GameObject(((Object)val3).name) { layer = ((Component)parent).gameObject.layer }; val4.transform.SetParent(val.transform, false); val4.transform.localPosition = prefab.transform.InverseTransformPoint(((Component)val3).transform.position); val4.transform.localRotation = Quaternion.Inverse(prefab.transform.rotation) * ((Component)val3).transform.rotation; val4.transform.localScale = ((Component)val3).transform.lossyScale; val4.AddComponent<MeshFilter>().sharedMesh = val3.sharedMesh; MeshRenderer val5 = val4.AddComponent<MeshRenderer>(); Material[] sharedMaterials = ((Renderer)component).sharedMaterials; for (int j = 0; j < sharedMaterials.Length; j++) { sharedMaterials[j] = new Material(sharedMaterials[j]); if (sharedMaterials[j].HasProperty("_EmissionColor")) { sharedMaterials[j].SetColor("_EmissionColor", sharedMaterials[j].GetColor("_EmissionColor") * 1.15f); } } ((Renderer)val5).sharedMaterials = sharedMaterials; Bounds bounds = val3.sharedMesh.bounds; for (int k = 0; k < 8; k++) { Vector3 val6 = ((Bounds)(ref bounds)).center + Vector3.Scale(((Bounds)(ref bounds)).extents, new Vector3((float)(((k & 1) != 0) ? 1 : (-1)), (float)(((k & 2) != 0) ? 1 : (-1)), (float)(((k & 4) != 0) ? 1 : (-1)))); val6 = val.transform.InverseTransformPoint(val4.transform.TransformPoint(val6)); if (!flag) { ((Bounds)(ref val2))..ctor(val6, Vector3.zero); flag = true; } else { ((Bounds)(ref val2)).Encapsulate(val6); } } } if (!flag) { throw new InvalidOperationException("Greydwarf Eye visual meshes unavailable."); } float num = 0.34f / Mathf.Max(new float[3] { ((Bounds)(ref val2)).size.x, ((Bounds)(ref val2)).size.y, ((Bounds)(ref val2)).size.z }); val.transform.localScale = Vector3.one * num; val.transform.localPosition = -((Bounds)(ref val2)).center * num; } private static Material CreateEyeShellMaterial(Material stone) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_0039: Unknown result type (might be due to invalid IL or missing references) Material val = new Material(stone) { name = "Oathstone eye shell" }; if (val.HasProperty("_Color")) { val.SetColor("_Color", new Color(0.48f, 0.67f, 0.7f, 1f)); } if (val.HasProperty("_Metallic")) { val.SetFloat("_Metallic", 0f); } if (val.HasProperty("_Glossiness")) { val.SetFloat("_Glossiness", 0.12f); } return val; } private static Material CreateGlowMaterial(GameObject eyePrefab, Material fallback, string name, Color color, float emission) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown //IL_0018: 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_007a: 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_00ba: Unknown result type (might be due to invalid IL or missing references) Material val = new Material(FindEmissiveEyeMaterial(eyePrefab) ?? fallback) { name = name }; Texture2D val2 = (Texture2D)(object)(val.mainTexture = (Texture)(object)SolidTexture(Color.white, name + " texture")); if (val.HasProperty("_MainTex")) { val.SetTexture("_MainTex", (Texture)(object)val2); } if (val.HasProperty("_Color")) { val.SetColor("_Color", color); } if (val.HasProperty("_TintColor")) { val.SetColor("_TintColor", color); } if (val.HasProperty("_EmissionMap")) { val.SetTexture("_EmissionMap", (Texture)(object)val2); } if (val.HasProperty("_EmissionColor")) { val.EnableKeyword("_EMISSION"); val.SetColor("_EmissionColor", color * emission); } if (val.HasProperty("_Metallic")) { val.SetFloat("_Metallic", 0f); } if (val.HasProperty("_Glossiness")) { val.SetFloat("_Glossiness", 0.08f); } return val; } private static Material CreatePupilMaterial(Material stone) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_0026: 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_009f: Unknown result type (might be due to invalid IL or missing references) Material val = new Material(stone) { name = "Oathstone eye pupil" }; Texture2D val2 = (Texture2D)(object)(val.mainTexture = (Texture)(object)SolidTexture(new Color(0.002f, 0.006f, 0.012f, 1f), "Oathstone pupil texture")); if (val.HasProperty("_MainTex")) { val.SetTexture("_MainTex", (Texture)(object)val2); } if (val.HasProperty("_Color")) { val.SetColor("_Color", Color.white); } if (val.HasProperty("_EmissionMap")) { val.SetTexture("_EmissionMap", (Texture)null); } if (val.HasProperty("_EmissionColor")) { val.SetColor("_EmissionColor", Color.black); } val.DisableKeyword("_EMISSION"); return val; } private static Material FindEmissiveEyeMaterial(GameObject eyePrefab) { if (!Object.op_Implicit((Object)(object)eyePrefab)) { return null; } Renderer[] componentsInChildren = eyePrefab.GetComponentsInChildren<Renderer>(true); for (int i = 0; i < componentsInChildren.Length; i++) { Material[] sharedMaterials = componentsInChildren[i].sharedMaterials; foreach (Material val in sharedMaterials) { if (Object.op_Implicit((Object)(object)val) && val.HasProperty("_EmissionColor")) { return val; } } } return null; } private static Texture2D SolidTexture(Color color, string name) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0040: 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) Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false) { name = name, wrapMode = (TextureWrapMode)1, filterMode = (FilterMode)1 }; val.SetPixels((Color[])(object)new Color[4] { color, color, color, color }); val.Apply(false, true); return val; } private static void ApplyV2GeometryTransform(string objectName, Mesh mesh) { //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_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: 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_0098: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) Vector3[] vertices = mesh.vertices; bool flag = objectName == "WO_LeftSpire"; bool flag2 = objectName == "WO_RightSpire"; bool flag3 = objectName == "WO_RuneGlow"; for (int i = 0; i < vertices.Length; i++) { Vector3 val = vertices[i]; Vector3 val2 = val * 2f; if (flag || flag2) { float num = (flag ? (-1f) : 1f); float num2 = Mathf.Clamp01((val.y - 0.17f) / 1.02f); float num3 = Mathf.Lerp(0.205f, 0.135f, num2); float num4 = num * num3; float num5 = val.x - num4; float num6 = 1f - 0.42f * Mathf.SmoothStep(0.78f, 1f, num2); float num7 = Mathf.Lerp(1.75f, 1.48f, num2) * num6; float num8 = Mathf.Lerp(1.38f, 1.18f, num2) * num6; float num9 = ((num2 < 0.38f) ? Mathf.Lerp(0f, -0.028f, num2 / 0.38f) : ((num2 < 0.68f) ? Mathf.Lerp(-0.028f, 0.036f, (num2 - 0.38f) / 0.3f) : Mathf.Lerp(0.036f, -0.012f, (num2 - 0.68f) / 0.32f))); val2.x = num4 * 2f + num5 * 2f * num7 + num * (0.36f * num2 + num9); val2.z = val.z * 2f * num8; val2.z += num5 * num * 0.16f * num2; } else if (flag3) { float num10 = Mathf.Sign(val.x); if (Mathf.Abs(num10) > 0.01f) { float num11 = Mathf.Clamp01((val.y - 0.2f) / 1f); val2.x += num10 * (0.36f * num11); val2.z *= 1.3f; } } vertices[i] = val2; } mesh.vertices = vertices; mesh.RecalculateBounds(); mesh.RecalculateNormals(); } private static void MoveMeshOrigin(Mesh mesh, Vector3 origin) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) Vector3[] vertices = mesh.vertices; for (int i = 0; i < vertices.Length; i++) { ref Vector3 reference = ref vertices[i]; reference -= origin; } mesh.vertices = vertices; mesh.RecalculateBounds(); } private static Dictionary<string, Mesh> ParseObj(string source) { //IL_00f0: 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) List<Vector3> list = new List<Vector3>(); List<Vector2> list2 = new List<Vector2>(); Dictionary<string, MeshBuilder> dictionary = new Dictionary<string, MeshBuilder>(StringComparer.Ordinal); MeshBuilder meshBuilder = null; using StringReader stringReader = new StringReader(source); string text; while ((text = stringReader.ReadLine()) != null) { text = text.Trim(); if (text.Length == 0 || text[0] == '#') { continue; } string[] array = text.Split(new char[1] { ' ' }, StringSplitOptions.RemoveEmptyEntries); if (array.Length == 0) { continue; } switch (array[0]) { case "o": { string text2 = ((array.Length > 1) ? array[1] : "OathstonePart"); meshBuilder = (dictionary[text2] = new MeshBuilder(text2)); break; } case "v": list.Add(new Vector3(Parse(array[1]), Parse(array[2]), Parse(array[3]))); break; case "vt": list2.Add(new Vector2(Parse(array[1]), Parse(array[2]))); break; case "f": if (meshBuilder != null && array.Length >= 4) { List<ObjIndex> list3 = new List<ObjIndex>(); for (int i = 1; i < array.Length; i++) { list3.Add(ParseIndex(array[i])); } for (int j = 1; j < list3.Count - 1; j++) { meshBuilder.Add(list3[0], list, list2); meshBuilder.Add(list3[j], list, list2); meshBuilder.Add(list3[j + 1], list, list2); } } break; } } Dictionary<string, Mesh> dictionary2 = new Dictionary<string, Mesh>(StringComparer.Ordinal); foreach (KeyValuePair<string, MeshBuilder> item in dictionary) { dictionary2[item.Key] = item.Value.Build(); } return dictionary2; } private static ObjIndex ParseIndex(string token) { string[] array = token.Split('/'); int vertex = int.Parse(array[0], CultureInfo.InvariantCulture) - 1; int uv = ((array.Length > 1 && array[1].Length > 0) ? (int.Parse(array[1], CultureInfo.InvariantCulture) - 1) : (-1)); return new ObjIndex(vertex, uv); } private static float Parse(string value) { return float.Parse(value, NumberStyles.Float, CultureInfo.InvariantCulture); } } public sealed class OathstoneEyeMotion : MonoBehaviour { private Vector3 anchor; private Light glow; private Material eyeGlowMaterial; private Material runeGlowMaterial; private static readonly Color EyeEmission = new Color(0.02f, 0.52f, 0.95f, 1f); private static readonly Color RuneEmission = new Color(0f, 0.78f, 1f, 1f); private float rotationSeed; internal void Initialize(Renderer eyeGlowRenderer, Renderer runeRenderer) { eyeGlowMaterial = (Object.op_Implicit((Object)(object)eyeGlowRenderer) ? eyeGlowRenderer.sharedMaterial : null); runeGlowMaterial = (Object.op_Implicit((Object)(object)runeRenderer) ? runeRenderer.sharedMaterial : null); } private void Start() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) anchor = ((Component)this).transform.localPosition; glow = ((Component)this).GetComponent<Light>(); rotationSeed = (float)(((Object)this).GetInstanceID() & 0x3FF) * 0.137f; } private void Update() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: 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_0118: 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_015e: 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) float num = Time.time * 1.15f; ((Component)this).transform.localPosition = anchor + Vector3.up * (0.024f * Mathf.Sin(num)); float num2 = Time.time * 0.12f; Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor((Mathf.PerlinNoise(rotationSeed, num2) - 0.5f) * 26f, 15f + 12f * Mathf.PerlinNoise(rotationSeed + 31f, num2), (Mathf.PerlinNoise(rotationSeed + 67f, num2) - 0.5f) * 22f); ((Component)this).transform.Rotate(val * Time.deltaTime, (Space)1); float num3 = 0.9f + 0.1f * Mathf.Sin(num); if (Object.op_Implicit((Object)(object)glow)) { glow.intensity = 0.24f + 0.06f * num3; } if (Object.op_Implicit((Object)(object)eyeGlowMaterial) && eyeGlowMaterial.HasProperty("_EmissionColor")) { eyeGlowMaterial.SetColor("_EmissionColor", EyeEmission * (1.9f + 0.35f * num3)); } if (Object.op_Implicit((Object)(object)runeGlowMaterial) && runeGlowMaterial.HasProperty("_EmissionColor")) { runeGlowMaterial.SetColor("_EmissionColor", RuneEmission * (1.3f + 0.2f * num3)); } } } public sealed class PlacementGhostVisual : MonoBehaviour { public GameObject VisualRoot; private ZNetView networkView; private void Awake() { networkView = ((Component)this).GetComponent<ZNetView>(); } private void LateUpdate() { if (!Object.op_Implicit((Object)(object)VisualRoot) || !Object.op_Implicit((Object)(object)networkView)) { return; } bool flag = !networkView.IsValid(); ReachPortalFire[] componentsInChildren = VisualRoot.GetComponentsInChildren<ReachPortalFire>(true); for (int i = 0; i < componentsInChildren.Length; i++) { componentsInChildren[i].SetPlacementPreview(flag); } if (flag) { if (!VisualRoot.activeSelf) { VisualRoot.SetActive(true); } Renderer[] componentsInChildren2 = VisualRoot.GetComponentsInChildren<Renderer>(true); for (int i = 0; i < componentsInChildren2.Length; i++) { componentsInChildren2[i].enabled = true; } } } } [BepInPlugin("justiifresh.valheim.freshcommands", "FreshCommands", "3.1.1")] [BepInDependency(/*Could not decode attribute arguments.*/)] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] public sealed class Plugin : BaseUnityPlugin { [HarmonyPatch(typeof(Minimap), "Update")] private static class MapCoordinatePatch { [HarmonyPostfix] private static void Postfix(Minimap __instance) { UpdateMapCoordinates(__instance); } } [HarmonyPatch(typeof(Minimap), "OnMapLeftClick")] private static class MapTeleportPatch { [HarmonyPrefix] private static bool Prefix(Minimap __instance) { //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: 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_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) if (Minimap.IsOpen() && (ZInput.GetButton("JoyDPadLeft") || gamepadMapTravelArmed || MapLocationNameDialog.IsOpen)) { return false; } bool flag = ZInput.GetKey((KeyCode)306, true) || ZInput.GetKey((KeyCode)305, true); bool flag2 = ZInput.GetKey((KeyCode)308, true) || ZInput.GetKey((KeyCode)307, true); if ((!ZInput.GetKey((KeyCode)304, true) && !ZInput.GetKey((KeyCode)303, true)) || !Minimap.IsOpen()) { return true; } Vector3 val = (Vector3)MapScreenToWorldPoint.Invoke(__instance, new object[1] { ZInput.pointerPosition }); if (flag2 && !flag) { if (!Object.op_Implicit((Object)(object)ZNet.instance) || !ZNet.instance.IsServer()) { Player localPlayer = Player.m_localPlayer; if (localPlayer != null) { ((Character)localPlayer).Message((MessageType)2, "Saving map locations requires the hosting player.", 0, (Sprite)null, false); } } else { val.y = ZoneSystem.instance.GetGroundHeight(val); MapLocationNameDialog.Show(val); } return false; } if (!flag) { return true; } object? obj = MapClosestPin.Invoke(__instance, new object[3] { val, 25f, true }); if (!TryGetSavedLocationForPin((PinData)((obj is PinData) ? obj : null), out var locationName)) { return true; } ConfirmMapTeleport(locationName); return false; } } [HarmonyPatch(typeof(Minimap), "UpdateMap")] private static class GamepadMapActionsPatch { [HarmonyPrefix] private static bool Prefix(Minimap __instance) { //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (