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 MoonforgedVikingSense v1.0.0
MoonforgedVikingSense.dll
Decompiled 8 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using Jotunn.Configs; using Jotunn.Managers; using UnityEngine; using UnityEngine.Rendering; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyCompany("MoonforgedVikingSense")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("MoonforgedVikingSense")] [assembly: AssemblyTitle("MoonforgedVikingSense")] [assembly: AssemblyVersion("1.0.0.0")] namespace Moonforged.VikingSense; [BepInPlugin("Moonforged.VikingSense", "Moonforged Viking Sense", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public sealed class MoonforgedVikingSense : BaseUnityPlugin { private enum PulseSurfaceMode { Terrain, WaterSurface, Underwater } private enum ScanCategory { Resource, Mineable, Building, Landmark, Creature, OtherPlayer } private sealed class ScanTarget { public readonly GameObject Target; public readonly float Distance; public readonly ScanCategory Category; public bool Triggered; public ScanTarget(GameObject target, float distance, ScanCategory category) { Target = target; Distance = distance; Category = category; Triggered = false; } } private sealed class ResourceHighlight { private readonly List<RendererState> _rendererStates = new List<RendererState>(); private readonly List<ScanFillOverlay> _fillOverlays = new List<ScanFillOverlay>(); private readonly List<OutlineShell> _outlineShells = new List<OutlineShell>(); private readonly List<FloraGlowOverlay> _floraGlows = new List<FloraGlowOverlay>(); private float _startTime; private float _duration; public GameObject Target { get; private set; } public ScanCategory Category { get; private set; } public float EndTime => _startTime + _duration; public bool HasRendererStates => _rendererStates.Count > 0 || _fillOverlays.Count > 0 || _outlineShells.Count > 0 || _floraGlows.Count > 0; public ResourceHighlight(GameObject target, Renderer[] renderers, float startTime, float duration, ScanCategory category) { Target = target; Category = category; _startTime = startTime; _duration = duration; if (renderers == null) { renderers = (Renderer[])(object)new Renderer[0]; } bool flag = category == ScanCategory.Resource && IsFloraAuraTarget(target); if (flag) { foreach (Renderer val in renderers) { if (!((Object)(object)val == (Object)null) && (val is MeshRenderer || val is SkinnedMeshRenderer)) { FloraGlowOverlay floraGlowOverlay = new FloraGlowOverlay(val); if (floraGlowOverlay.IsValid) { _floraGlows.Add(floraGlowOverlay); } else { floraGlowOverlay.Dispose(); } } } return; } List<Renderer> list = SelectVisualRenderers(renderers, category); foreach (Renderer val2 in renderers) { if (!IsSupportedRenderer(val2)) { continue; } Material[] sharedMaterials = val2.sharedMaterials; if (sharedMaterials == null || sharedMaterials.Length == 0) { continue; } for (int k = 0; k < sharedMaterials.Length; k++) { Material val3 = sharedMaterials[k]; if (!((Object)(object)val3 == (Object)null)) { RendererState rendererState = new RendererState(val2, val3, k); if (rendererState.CanHighlight) { _rendererStates.Add(rendererState); } } } } bool flag2 = (category == ScanCategory.Resource && !flag) || category == ScanCategory.Mineable; bool flag3 = category == ScanCategory.Building || category == ScanCategory.Landmark || category == ScanCategory.Creature || category == ScanCategory.OtherPlayer; bool flag4 = category == ScanCategory.Mineable || category == ScanCategory.Building || category == ScanCategory.Landmark || category == ScanCategory.Creature || category == ScanCategory.OtherPlayer; float outlineScale = GetOutlineScale(category); for (int l = 0; l < list.Count; l++) { Renderer source = list[l]; if (flag2 || flag3) { bool throughOccluders = category == ScanCategory.Resource || category == ScanCategory.Mineable; float baseAlpha = (flag2 ? 0.18f : 0.035f); float peakAlpha = (flag2 ? 0.38f : 0.085f); ScanFillOverlay scanFillOverlay = new ScanFillOverlay(source, throughOccluders, baseAlpha, peakAlpha); if (scanFillOverlay.IsValid) { _fillOverlays.Add(scanFillOverlay); } else { scanFillOverlay.Dispose(); } } if (flag4) { OutlineShell outlineShell = new OutlineShell(source, outlineScale); if (outlineShell.IsValid) { _outlineShells.Add(outlineShell); } else { outlineShell.Dispose(); } } } } private static bool IsSupportedRenderer(Renderer renderer) { return (Object)(object)renderer != (Object)null && renderer.enabled && ((Component)renderer).gameObject.activeInHierarchy && (renderer is MeshRenderer || renderer is SkinnedMeshRenderer); } private static List<Renderer> SelectVisualRenderers(Renderer[] renderers, ScanCategory category) { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) List<Renderer> list = new List<Renderer>(); float num = 0f; foreach (Renderer val in renderers) { if (IsSupportedRenderer(val) && !ShouldSkipRenderer(val)) { Bounds bounds = val.bounds; float num2 = Mathf.Abs(((Bounds)(ref bounds)).size.x * ((Bounds)(ref bounds)).size.y * ((Bounds)(ref bounds)).size.z); num = Mathf.Max(num, num2); list.Add(val); } } if (list.Count <= 1) { return list; } list.Sort(delegate(Renderer a, Renderer b) { float rendererVolume = GetRendererVolume(a); return GetRendererVolume(b).CompareTo(rendererVolume); }); int num3; float num4; switch (category) { case ScanCategory.Creature: case ScanCategory.OtherPlayer: num3 = 8; num4 = 0.01f; break; case ScanCategory.Building: case ScanCategory.Landmark: num3 = 12; num4 = 0.003f; break; default: num3 = 10; num4 = 0f; break; } List<Renderer> list2 = new List<Renderer>(); for (int num5 = 0; num5 < list.Count; num5++) { if (list2.Count >= num3) { break; } Renderer val2 = list[num5]; if (!(num > 0f) || !(num4 > 0f) || !(GetRendererVolume(val2) < num * num4)) { list2.Add(val2); } } return list2; } private static float GetRendererVolume(Renderer renderer) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)renderer == (Object)null) { return 0f; } Bounds bounds = renderer.bounds; return Mathf.Abs(((Bounds)(ref bounds)).size.x * ((Bounds)(ref bounds)).size.y * ((Bounds)(ref bounds)).size.z); } private static bool ShouldSkipRenderer(Renderer renderer) { if ((Object)(object)renderer == (Object)null) { return true; } string text = ((Object)((Component)renderer).gameObject).name.ToLowerInvariant(); return text.Contains("collider") || text.Contains("collision") || text.Contains("trigger") || text.Contains("hitbox") || text.Contains("bounds") || text.Contains("bounding") || text.Contains("helper") || text.Contains("occlud") || text.Contains("shadow") || text.Contains("lod1") || text.Contains("lod2") || text.Contains("lod3") || text.Contains("lod4") || text.Contains("lod5") || text.Contains("eye") || text.Contains("pupil") || text.Contains("teeth") || text.Contains("weapon") || text.Contains("attach") || text.Contains("particle") || text.Contains("vfx"); } private static float GetOutlineScale(ScanCategory category) { switch (category) { case ScanCategory.Creature: case ScanCategory.OtherPlayer: return 1.045f; case ScanCategory.Mineable: return 1.025f; case ScanCategory.Building: case ScanCategory.Landmark: return 1.018f; default: return 1.02f; } } public void Refresh(float startTime, float duration, ScanCategory category) { _startTime = startTime; _duration = duration; Category = category; } public float GetStrength(float now) { if (_duration <= 0f) { return 0f; } float num = Mathf.Clamp01((now - _startTime) / _duration); if (num < 0.08f) { return Mathf.SmoothStep(0f, 1f, num / 0.08f); } if (num <= 0.72f) { return 1f; } return 1f - Mathf.SmoothStep(0f, 1f, Mathf.InverseLerp(0.72f, 1f, num)); } public void Apply(Color highlightColor, float intensity, float strength) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0076: 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) for (int i = 0; i < _floraGlows.Count; i++) { _floraGlows[i].Apply(highlightColor, intensity, strength); } for (int j = 0; j < _rendererStates.Count; j++) { _rendererStates[j].Apply(highlightColor, intensity, strength); } for (int k = 0; k < _fillOverlays.Count; k++) { _fillOverlays[k].Apply(highlightColor, intensity, strength); } for (int l = 0; l < _outlineShells.Count; l++) { _outlineShells[l].Apply(highlightColor, intensity, strength); } } public void Restore() { for (int i = 0; i < _floraGlows.Count; i++) { _floraGlows[i].Dispose(); } _floraGlows.Clear(); for (int j = 0; j < _rendererStates.Count; j++) { _rendererStates[j].Restore(); } for (int k = 0; k < _fillOverlays.Count; k++) { _fillOverlays[k].Dispose(); } for (int l = 0; l < _outlineShells.Count; l++) { _outlineShells[l].Dispose(); } _rendererStates.Clear(); _fillOverlays.Clear(); _outlineShells.Clear(); Target = null; } } private sealed class FloraGlowOverlay { private readonly Renderer _source; private readonly Mesh _mesh; private readonly GameObject _object; private readonly Renderer _renderer; private readonly List<Material> _materials = new List<Material>(); public bool IsValid => (Object)(object)_source != (Object)null && (Object)(object)_object != (Object)null && (Object)(object)_renderer != (Object)null && _materials.Count > 0; public FloraGlowOverlay(Renderer source) { //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Expected O, but got Unknown //IL_0095: 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_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Expected O, but got Unknown //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_0291: Unknown result type (might be due to invalid IL or missing references) //IL_02a7: Unknown result type (might be due to invalid IL or missing references) _source = source; Shader val = Shader.Find("GUI/Text Shader"); if ((Object)(object)source == (Object)null || (Object)(object)val == (Object)null) { return; } Material[] sharedMaterials = source.sharedMaterials; if (sharedMaterials == null || sharedMaterials.Length == 0) { return; } _object = new GameObject("MVS_FloraGlow"); _object.transform.SetParent(((Component)source).transform, false); _object.transform.localPosition = Vector3.zero; _object.transform.localRotation = Quaternion.identity; _object.transform.localScale = Vector3.one; SkinnedMeshRenderer val2 = (SkinnedMeshRenderer)(object)((source is SkinnedMeshRenderer) ? source : null); if ((Object)(object)val2 != (Object)null && (Object)(object)val2.sharedMesh != (Object)null) { SkinnedMeshRenderer val3 = _object.AddComponent<SkinnedMeshRenderer>(); _mesh = MakeGlowMesh(val2.sharedMesh); val3.sharedMesh = _mesh; val3.rootBone = val2.rootBone; val3.bones = val2.bones; ((Renderer)val3).localBounds = ((Renderer)val2).localBounds; val3.updateWhenOffscreen = true; _renderer = (Renderer)(object)val3; } else { MeshFilter component = ((Component)source).GetComponent<MeshFilter>(); if ((Object)(object)component == (Object)null || (Object)(object)component.sharedMesh == (Object)null) { return; } _mesh = MakeGlowMesh(component.sharedMesh); _object.AddComponent<MeshFilter>().sharedMesh = _mesh; _renderer = (Renderer)(object)_object.AddComponent<MeshRenderer>(); } Material[] array = (Material[])(object)new Material[sharedMaterials.Length]; for (int i = 0; i < sharedMaterials.Length; i++) { Material val4 = sharedMaterials[i]; Material val5 = new Material(val); ((Object)val5).name = "MVS_FloraGlow"; val5.renderQueue = 3004; val5.SetColor("_Color", Color.clear); string text = (((Object)(object)val4 != (Object)null && val4.HasProperty("_MainTex")) ? "_MainTex" : (((Object)(object)val4 != (Object)null && val4.HasProperty("_BaseMap")) ? "_BaseMap" : null)); if (text != null && (Object)(object)val4.GetTexture(text) != (Object)null) { val5.SetTexture("_MainTex", val4.GetTexture(text)); val5.SetTextureScale("_MainTex", val4.GetTextureScale(text)); val5.SetTextureOffset("_MainTex", val4.GetTextureOffset(text)); } array[i] = val5; _materials.Add(val5); } ConfigureRenderer(_renderer); _renderer.sharedMaterials = array; _renderer.enabled = false; } private static Mesh MakeGlowMesh(Mesh source) { //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) Mesh val = Object.Instantiate<Mesh>(source); ((Object)val).name = "MVS_FloraGlowMesh"; if (!val.isReadable) { return val; } Color32[] array = (Color32[])(object)new Color32[val.vertexCount]; for (int i = 0; i < array.Length; i++) { array[i] = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue); } val.colors32 = array; return val; } public void Apply(Color color, float intensity, float strength) { //IL_008f: Unknown result type (might be due to invalid IL or missing references) if (IsValid) { _renderer.enabled = _source.enabled && ((Component)_source).gameObject.activeInHierarchy && strength > 0.01f; float num = Mathf.Lerp(0.35f, 0.7f, Mathf.InverseLerp(0.1f, 1.25f, intensity)); color.a = num * Mathf.Clamp01(strength); for (int i = 0; i < _materials.Count; i++) { _materials[i].SetColor("_Color", color); } } } public void Dispose() { if ((Object)(object)_object != (Object)null) { Object.Destroy((Object)(object)_object); } for (int i = 0; i < _materials.Count; i++) { Object.Destroy((Object)(object)_materials[i]); } _materials.Clear(); if ((Object)(object)_mesh != (Object)null) { Object.Destroy((Object)(object)_mesh); } } } private sealed class RendererState { private static readonly int ColorProperty = Shader.PropertyToID("_Color"); private static readonly int BaseColorProperty = Shader.PropertyToID("_BaseColor"); private static readonly int SkinColorProperty = Shader.PropertyToID("_SkinColor"); private static readonly int TintColorProperty = Shader.PropertyToID("_TintColor"); private static readonly int MainColorProperty = Shader.PropertyToID("_MainColor"); private static readonly int EmissionColorProperty = Shader.PropertyToID("_EmissionColor"); private static readonly int EmissiveColorProperty = Shader.PropertyToID("_EmissiveColor"); private readonly Renderer _renderer; private readonly int _materialIndex; private readonly MaterialPropertyBlock _originalBlock; private readonly MaterialPropertyBlock _workingBlock; private readonly bool _hasColor; private readonly bool _hasBaseColor; private readonly bool _hasSkinColor; private readonly bool _hasTintColor; private readonly bool _hasMainColor; private readonly bool _hasEmission; private readonly bool _hasEmissive; private readonly Color _baseColor; private readonly Color _baseBaseColor; private readonly Color _baseSkinColor; private readonly Color _baseTintColor; private readonly Color _baseMainColor; private readonly Color _baseEmissionColor; private readonly Color _baseEmissiveColor; public bool CanHighlight => (Object)(object)_renderer != (Object)null && (_hasColor || _hasBaseColor || _hasSkinColor || _hasTintColor || _hasMainColor || _hasEmission || _hasEmissive); public RendererState(Renderer renderer, Material material, int materialIndex) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0155: 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_015a: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_0195: 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_019a: Unknown result type (might be due to invalid IL or missing references) _renderer = renderer; _materialIndex = materialIndex; _originalBlock = new MaterialPropertyBlock(); _workingBlock = new MaterialPropertyBlock(); renderer.GetPropertyBlock(_originalBlock, materialIndex); renderer.GetPropertyBlock(_workingBlock, materialIndex); _hasColor = material.HasProperty(ColorProperty); _hasBaseColor = material.HasProperty(BaseColorProperty); _hasSkinColor = material.HasProperty(SkinColorProperty); _hasTintColor = material.HasProperty(TintColorProperty); _hasMainColor = material.HasProperty(MainColorProperty); _hasEmission = material.HasProperty(EmissionColorProperty); _hasEmissive = material.HasProperty(EmissiveColorProperty); _baseColor = (_hasColor ? material.GetColor(ColorProperty) : Color.white); _baseBaseColor = (_hasBaseColor ? material.GetColor(BaseColorProperty) : Color.white); _baseSkinColor = (_hasSkinColor ? material.GetColor(SkinColorProperty) : Color.white); _baseTintColor = (_hasTintColor ? material.GetColor(TintColorProperty) : Color.white); _baseMainColor = (_hasMainColor ? material.GetColor(MainColorProperty) : Color.white); _baseEmissionColor = (_hasEmission ? material.GetColor(EmissionColorProperty) : Color.black); _baseEmissiveColor = (_hasEmissive ? material.GetColor(EmissiveColorProperty) : Color.black); } public void Apply(Color highlightColor, float intensity, float strength) { //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_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_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_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_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_renderer == (Object)null)) { float num = Mathf.InverseLerp(0.1f, 1.25f, Mathf.Clamp(intensity, 0.1f, 1.25f)); float num2 = Mathf.Clamp01(strength * Mathf.Lerp(0.38f, 0.68f, num)); float num3 = Mathf.Clamp(strength * Mathf.Lerp(0.12f, 0.42f, num), 0f, 0.48f); if (_hasColor) { _workingBlock.SetColor(ColorProperty, Color.Lerp(_baseColor, highlightColor, num2)); } if (_hasBaseColor) { _workingBlock.SetColor(BaseColorProperty, Color.Lerp(_baseBaseColor, highlightColor, num2)); } if (_hasSkinColor) { _workingBlock.SetColor(SkinColorProperty, Color.Lerp(_baseSkinColor, highlightColor, num2)); } if (_hasTintColor) { _workingBlock.SetColor(TintColorProperty, Color.Lerp(_baseTintColor, highlightColor, num2)); } if (_hasMainColor) { _workingBlock.SetColor(MainColorProperty, Color.Lerp(_baseMainColor, highlightColor, num2)); } if (_hasEmission) { Color val = _baseEmissionColor + highlightColor * num3; val.a = 1f; _workingBlock.SetColor(EmissionColorProperty, val); } if (_hasEmissive) { Color val2 = _baseEmissiveColor + highlightColor * num3; val2.a = 1f; _workingBlock.SetColor(EmissiveColorProperty, val2); } _renderer.SetPropertyBlock(_workingBlock, _materialIndex); } } public void Restore() { if ((Object)(object)_renderer != (Object)null) { _renderer.SetPropertyBlock(_originalBlock, _materialIndex); } } } private sealed class ScanFillOverlay { private readonly GameObject _overlayObject; private readonly Renderer _overlayRenderer; private readonly Material _overlayMaterial; private readonly float _baseAlpha; private readonly float _peakAlpha; public bool IsValid => (Object)(object)_overlayObject != (Object)null && (Object)(object)_overlayRenderer != (Object)null && (Object)(object)_overlayMaterial != (Object)null; public ScanFillOverlay(Renderer source, bool throughOccluders, float baseAlpha, float peakAlpha) { //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Expected O, but got Unknown //IL_0129: Unknown result type (might be due to invalid IL or missing references) _baseAlpha = baseAlpha; _peakAlpha = peakAlpha; if ((Object)(object)source == (Object)null) { return; } Shader val = Shader.Find("Hidden/Internal-Colored"); if ((Object)(object)val == (Object)null) { val = Shader.Find("Sprites/Default"); } if ((Object)(object)val == (Object)null) { return; } _overlayMaterial = new Material(val); ((Object)_overlayMaterial).name = "MVS_ScanFill"; _overlayMaterial.renderQueue = 3002; ConfigureMaterial(_overlayMaterial, (CullMode)0, (CompareFunction)(throughOccluders ? 8 : 4)); _overlayObject = new GameObject("MVS_ScanFill"); CopyTransformExact(((Component)source).transform, _overlayObject.transform); SkinnedMeshRenderer val2 = (SkinnedMeshRenderer)(object)((source is SkinnedMeshRenderer) ? source : null); if ((Object)(object)val2 != (Object)null && (Object)(object)val2.sharedMesh != (Object)null) { SkinnedMeshRenderer val3 = _overlayObject.AddComponent<SkinnedMeshRenderer>(); val3.sharedMesh = val2.sharedMesh; val3.rootBone = val2.rootBone; val3.bones = val2.bones; ((Renderer)val3).localBounds = ((Renderer)val2).localBounds; val3.updateWhenOffscreen = true; ConfigureRenderer((Renderer)(object)val3); ((Renderer)val3).sharedMaterials = MakeMaterialArray(((Renderer)val2).sharedMaterials.Length, _overlayMaterial); _overlayRenderer = (Renderer)(object)val3; return; } MeshRenderer val4 = (MeshRenderer)(object)((source is MeshRenderer) ? source : null); if ((Object)(object)val4 != (Object)null) { MeshFilter component = ((Component)source).GetComponent<MeshFilter>(); if (!((Object)(object)component == (Object)null) && !((Object)(object)component.sharedMesh == (Object)null)) { MeshFilter val5 = _overlayObject.AddComponent<MeshFilter>(); val5.sharedMesh = component.sharedMesh; MeshRenderer val6 = _overlayObject.AddComponent<MeshRenderer>(); ConfigureRenderer((Renderer)(object)val6); ((Renderer)val6).sharedMaterials = MakeMaterialArray(((Renderer)val4).sharedMaterials.Length, _overlayMaterial); _overlayRenderer = (Renderer)(object)val6; } } } public void Apply(Color color, float intensity, float strength) { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) if (IsValid) { float num = Mathf.Lerp(0.75f, 1.15f, Mathf.InverseLerp(0.1f, 1.25f, Mathf.Clamp(intensity, 0.1f, 1.25f))); Color val = color; val.a = Mathf.Clamp01(Mathf.Lerp(_baseAlpha, _peakAlpha, strength) * num); if (_overlayMaterial.HasProperty("_Color")) { _overlayMaterial.SetColor("_Color", val); } _overlayRenderer.enabled = strength > 0.01f; } } public void Dispose() { if ((Object)(object)_overlayObject != (Object)null) { Object.Destroy((Object)(object)_overlayObject); } if ((Object)(object)_overlayMaterial != (Object)null) { Object.Destroy((Object)(object)_overlayMaterial); } } } private sealed class OutlineShell { private readonly GameObject _outlineObject; private readonly Renderer _outlineRenderer; private readonly Material _outlineMaterial; public bool IsValid => (Object)(object)_outlineObject != (Object)null && (Object)(object)_outlineRenderer != (Object)null && (Object)(object)_outlineMaterial != (Object)null; public OutlineShell(Renderer source, float outlineScale) { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Expected O, but got Unknown //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Expected O, but got Unknown //IL_0115: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)source == (Object)null) { return; } Shader val = Shader.Find("Hidden/Internal-Colored"); if ((Object)(object)val == (Object)null) { val = Shader.Find("Unlit/Color"); } if ((Object)(object)val == (Object)null) { return; } _outlineMaterial = new Material(val); ((Object)_outlineMaterial).name = "MVS_Outline"; _outlineMaterial.renderQueue = 3003; ConfigureMaterial(_outlineMaterial, (CullMode)1, (CompareFunction)4); _outlineObject = new GameObject("MVS_Outline"); CopyTransformScaled(((Component)source).transform, _outlineObject.transform, outlineScale); SkinnedMeshRenderer val2 = (SkinnedMeshRenderer)(object)((source is SkinnedMeshRenderer) ? source : null); if ((Object)(object)val2 != (Object)null && (Object)(object)val2.sharedMesh != (Object)null) { SkinnedMeshRenderer val3 = _outlineObject.AddComponent<SkinnedMeshRenderer>(); val3.sharedMesh = val2.sharedMesh; val3.rootBone = val2.rootBone; val3.bones = val2.bones; ((Renderer)val3).localBounds = ((Renderer)val2).localBounds; val3.updateWhenOffscreen = true; ConfigureRenderer((Renderer)(object)val3); ((Renderer)val3).sharedMaterials = MakeMaterialArray(((Renderer)val2).sharedMaterials.Length, _outlineMaterial); _outlineRenderer = (Renderer)(object)val3; return; } MeshRenderer val4 = (MeshRenderer)(object)((source is MeshRenderer) ? source : null); if ((Object)(object)val4 != (Object)null) { MeshFilter component = ((Component)source).GetComponent<MeshFilter>(); if (!((Object)(object)component == (Object)null) && !((Object)(object)component.sharedMesh == (Object)null)) { MeshFilter val5 = _outlineObject.AddComponent<MeshFilter>(); val5.sharedMesh = component.sharedMesh; MeshRenderer val6 = _outlineObject.AddComponent<MeshRenderer>(); ConfigureRenderer((Renderer)(object)val6); ((Renderer)val6).sharedMaterials = MakeMaterialArray(((Renderer)val4).sharedMaterials.Length, _outlineMaterial); _outlineRenderer = (Renderer)(object)val6; } } } public void Apply(Color color, float intensity, float strength) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) if (IsValid) { Color val = color; float num = Mathf.Lerp(0.8f, 1.2f, Mathf.InverseLerp(0.1f, 1.25f, Mathf.Clamp(intensity, 0.1f, 1.25f))); val.a = Mathf.Clamp01((0.55f + strength * 0.4f) * num); if (_outlineMaterial.HasProperty("_Color")) { _outlineMaterial.SetColor("_Color", val); } _outlineRenderer.enabled = strength > 0.01f; } } public void Dispose() { if ((Object)(object)_outlineObject != (Object)null) { Object.Destroy((Object)(object)_outlineObject); } if ((Object)(object)_outlineMaterial != (Object)null) { Object.Destroy((Object)(object)_outlineMaterial); } } } public const string PluginGUID = "Moonforged.VikingSense"; public const string PluginName = "Moonforged Viking Sense"; public const string PluginVersion = "1.0.0"; private const string ScanButtonName = "MoonforgedVikingSense_Scan"; private const int PulseSegments = 96; private const int CurrentHelpVersion = 4; private static readonly string[] DefaultMineableTokens = new string[18] { "rock4_copper", "minerock_tin", "copper", "tin", "obsidian", "flametal", "magma", "meteorite", "blackmarble", "black_marble", "softtissue", "soft_tissue", "ancientroot", "ancient_root", "guck", "crystal", "leviathan", "chitin" }; private static readonly string[] ProgressionLockedMineableTokens = new string[6] { "silvervein", "silver_vein", "silver", "mudpile", "mud_pile", "iron" }; private static readonly string[] MistlandsLandmarkTokens = new string[12] { "giant_sword", "giantsword", "giant_helmet", "gianthelmet", "giant_armor", "giantarmor", "giant_ribs", "giantribs", "giant_skull", "giantskull", "giant_brain", "giantbrain" }; private static readonly string[] DefaultFloraTokens = new string[17] { "raspberry", "blueberry", "cloudberry", "berrybush", "berry_bush", "mushroom", "dandelion", "thistle", "fiddlehead", "vineberry", "flower", "carrot", "turnip", "onion", "barley", "flax", "seed" }; private static readonly string[] IgnoredPickableTokens = new string[3] { "pickable_branch", "pickable_stone", "pickable_flint" }; private ConfigEntry<bool> _enabled; private ConfigEntry<KeyCode> _scanKey; private ConfigEntry<float> _scanRadius; private ConfigEntry<float> _scanTravelSeconds; private ConfigEntry<float> _highlightDuration; private ConfigEntry<float> _cooldownSeconds; private ConfigEntry<float> _highlightIntensity; private ConfigEntry<string> _pulseColorHex; private ConfigEntry<string> _highlightColorHex; private ConfigEntry<string> _mineableColorHex; private ConfigEntry<string> _buildingColorHex; private ConfigEntry<string> _creatureColorHex; private ConfigEntry<string> _otherPlayerColorHex; private ConfigEntry<bool> _detectPickables; private ConfigEntry<bool> _detectDroppedItems; private ConfigEntry<bool> _detectMineables; private ConfigEntry<bool> _detectGenericMineables; private ConfigEntry<bool> _detectBuildings; private ConfigEntry<bool> _detectCavesAndDungeons; private ConfigEntry<bool> _detectMistlandsLandmarks; private ConfigEntry<bool> _detectWorldSpawners; private ConfigEntry<bool> _detectCreatures; private ConfigEntry<bool> _detectOtherPlayers; private ConfigEntry<string> _additionalPrefabTokens; private ConfigEntry<int> _maximumTargets; private ConfigEntry<bool> _showMessages; private ConfigEntry<bool> _showFirstRunHelp; private ConfigEntry<float> _firstRunHelpDuration; private ConfigEntry<bool> _firstRunHelpShown; private ConfigEntry<int> _firstRunHelpVersion; private ButtonConfig _scanButton; private bool _scanActive; private bool _welcomeHandledThisSession; private bool _helpPanelVisible; private PulseSurfaceMode _pulseSurfaceMode; private float _welcomeReadyAt = -1f; private float _helpPanelUntil; private float _scanStartedAt; private float _nextScanAllowedAt; private Vector3 _scanOrigin; private readonly List<ScanTarget> _scanTargets = new List<ScanTarget>(); private readonly Dictionary<int, ResourceHighlight> _activeHighlights = new Dictionary<int, ResourceHighlight>(); private GameObject _pulseObject; private LineRenderer _pulseRenderer; private Material _pulseMaterial; private GUIStyle _helpTitleStyle; private GUIStyle _helpKeyStyle; private GUIStyle _helpBodyStyle; private GUIStyle _helpLegendStyle; private GUIStyle _cooldownTitleStyle; private GUIStyle _cooldownTimeStyle; private void Awake() { BindConfig(); RegisterInput(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Moonforged Viking Sense 1.0.0 loaded."); } private void BindConfig() { //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Expected O, but got Unknown //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Expected O, but got Unknown //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Expected O, but got Unknown //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Expected O, but got Unknown //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Expected O, but got Unknown //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Expected O, but got Unknown //IL_0480: Unknown result type (might be due to invalid IL or missing references) //IL_048a: Expected O, but got Unknown ((BaseUnityPlugin)this).Config.SaveOnConfigSet = true; _enabled = ((BaseUnityPlugin)this).Config.Bind<bool>("01 - General", "Enabled", true, "Enable Moonforged Viking Sense."); _scanKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("01 - General", "Scan Key", (KeyCode)122, "Key used to activate Viking Sense."); _scanRadius = ((BaseUnityPlugin)this).Config.Bind<float>("02 - Scan", "Scan Radius", 60f, new ConfigDescription("Maximum scan radius in metres.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(5f, 100f), Array.Empty<object>())); _scanTravelSeconds = ((BaseUnityPlugin)this).Config.Bind<float>("02 - Scan", "Pulse Travel Seconds", 1.5f, new ConfigDescription("How long the visible scan wave takes to travel from the player to the maximum radius.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.25f, 8f), Array.Empty<object>())); _cooldownSeconds = ((BaseUnityPlugin)this).Config.Bind<float>("02 - Scan", "Cooldown Seconds", 10f, new ConfigDescription("Time before Viking Sense can be activated again.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 120f), Array.Empty<object>())); _maximumTargets = ((BaseUnityPlugin)this).Config.Bind<int>("02 - Scan", "Maximum Targets Per Scan", 400, new ConfigDescription("Safety limit for the number of resource objects processed by one scan.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(25, 2000), Array.Empty<object>())); _highlightDuration = ((BaseUnityPlugin)this).Config.Bind<float>("03 - Highlight", "Highlight Duration Seconds", 10f, new ConfigDescription("How long a detected object remains highlighted after the scan wave reaches it.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.5f, 30f), Array.Empty<object>())); _highlightIntensity = ((BaseUnityPlugin)this).Config.Bind<float>("03 - Highlight", "Highlight Intensity", 0.65f, new ConfigDescription("Strength of the temporary scan tint. Lower values are softer and less bright.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 2f), Array.Empty<object>())); _highlightColorHex = ((BaseUnityPlugin)this).Config.Bind<string>("03 - Highlight", "Highlight Color", "C9CDD2", "Resource highlight color as RGB or RGBA hex. Default is ASKA-style light grey."); _pulseColorHex = ((BaseUnityPlugin)this).Config.Bind<string>("03 - Highlight", "Pulse Color", "4E9DB8", "Expanding scan pulse color as RGB or RGBA hex. Example: 25D9FF."); _mineableColorHex = ((BaseUnityPlugin)this).Config.Bind<string>("03 - Highlight", "Ore And Vein Color", "C9CDD2", "Highlight color for ore veins and mineable resource deposits."); _buildingColorHex = ((BaseUnityPlugin)this).Config.Bind<string>("03 - Highlight", "Building Color", "527CAB", "Highlight color for player-buildable pieces and structures."); _creatureColorHex = ((BaseUnityPlugin)this).Config.Bind<string>("03 - Highlight", "Creature Color", "C9CDD2", "Highlight color for creatures, animals, enemies and bosses."); _otherPlayerColorHex = ((BaseUnityPlugin)this).Config.Bind<string>("03 - Highlight", "Other Player Color", "65A978", "Highlight color for other players. The local player is never highlighted."); _detectPickables = ((BaseUnityPlugin)this).Config.Bind<bool>("04 - Resources", "Detect Pickables", true, "Detect Valheim Pickable objects. This includes most berries, mushrooms, branches, stones, flint and many modded pickables."); _detectDroppedItems = ((BaseUnityPlugin)this).Config.Bind<bool>("04 - Resources", "Detect Dropped Items", true, "Detect ItemDrop objects lying in the world."); _detectMineables = ((BaseUnityPlugin)this).Config.Bind<bool>("04 - Resources", "Detect Mineable Resources", true, "Detect visible ore and resource deposits such as copper, tin, obsidian and later-biome resource nodes. Silver veins and hidden iron remain excluded so normal progression is preserved."); _detectGenericMineables = ((BaseUnityPlugin)this).Config.Bind<bool>("04 - Resources", "Detect Generic Mineable Rocks", false, "Also highlight every MineRock/MineRock5 object, including ordinary mineable stone formations."); _detectBuildings = ((BaseUnityPlugin)this).Config.Bind<bool>("04 - Resources", "Detect Buildings", true, "Detect Valheim Piece objects, including player-built structures and placed build pieces."); _detectCavesAndDungeons = ((BaseUnityPlugin)this).Config.Bind<bool>("04 - Resources", "Detect Caves And Dungeons", true, "Detect nearby cave and dungeon location entrances. They use the same blue highlight as buildings."); _detectMistlandsLandmarks = ((BaseUnityPlugin)this).Config.Bind<bool>("04 - Resources", "Detect Mistlands Ancient Objects", true, "Detect ancient giant objects such as Ancient Swords and other giant remains. They use the same blue highlight as buildings."); _detectWorldSpawners = ((BaseUnityPlugin)this).Config.Bind<bool>("04 - Resources", "Detect World Spawners", true, "Detect world spawners such as Greydwarf Nests and Monuments of Torment. They use the same blue highlight as caves and landmarks."); _detectCreatures = ((BaseUnityPlugin)this).Config.Bind<bool>("04 - Resources", "Detect Creatures", true, "Detect all Character objects except players, including animals, enemies, bosses and tamed creatures."); _detectOtherPlayers = ((BaseUnityPlugin)this).Config.Bind<bool>("04 - Resources", "Detect Other Players", true, "Detect other players in multiplayer. The local player is excluded."); _additionalPrefabTokens = ((BaseUnityPlugin)this).Config.Bind<string>("04 - Resources", "Additional Prefab Name Tokens", string.Empty, "Optional comma-separated prefab-name fragments to detect. Useful for custom/modded resources that are not Pickable or MineRock objects."); _showMessages = ((BaseUnityPlugin)this).Config.Bind<bool>("05 - Interface", "Show Messages", true, "Show a small message when Viking Sense activates or is still on cooldown."); _showFirstRunHelp = ((BaseUnityPlugin)this).Config.Bind<bool>("05 - Interface", "Show First Run Help", true, "Show a one-time description of Viking Sense when this config is first created."); _firstRunHelpDuration = ((BaseUnityPlugin)this).Config.Bind<float>("05 - Interface", "First Run Help Duration Seconds", 12f, new ConfigDescription("How long the first-run Viking Sense information panel stays on screen.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(5f, 30f), Array.Empty<object>())); _firstRunHelpShown = ((BaseUnityPlugin)this).Config.Bind<bool>("05 - Interface", "First Run Help Shown", false, "Internal flag used to remember that the one-time Viking Sense help message has already been displayed. Set to false to show it again."); _firstRunHelpVersion = ((BaseUnityPlugin)this).Config.Bind<int>("05 - Interface", "First Run Help Version", 0, "Internal version for the one-time help message."); UpgradeOldDefaults(); } private void UpgradeOldDefaults() { bool flag = false; if (Mathf.Approximately(_scanRadius.Value, 30f)) { _scanRadius.Value = 60f; flag = true; } if (Mathf.Approximately(_highlightDuration.Value, 8f)) { _highlightDuration.Value = 10f; flag = true; } if (_highlightIntensity.Value >= 3.9f) { _highlightIntensity.Value = 0.65f; flag = true; } flag |= ReplaceOldColor(_highlightColorHex, "FFD45A", "C9CDD2"); flag |= ReplaceOldColor(_highlightColorHex, "D6B75F", "C9CDD2"); flag |= ReplaceOldColor(_pulseColorHex, "25D9FF", "4E9DB8"); flag |= ReplaceOldColor(_mineableColorHex, "C06CFF", "C9CDD2"); flag |= ReplaceOldColor(_mineableColorHex, "9473B8", "C9CDD2"); flag |= ReplaceOldColor(_buildingColorHex, "3A8DFF", "527CAB"); flag |= ReplaceOldColor(_creatureColorHex, "FF5A5A", "C9CDD2"); flag |= ReplaceOldColor(_creatureColorHex, "B95F5F", "C9CDD2"); if (flag | ReplaceOldColor(_otherPlayerColorHex, "55FF7A", "65A978")) { ((BaseUnityPlugin)this).Config.Save(); } } private static bool ReplaceOldColor(ConfigEntry<string> entry, string oldValue, string newValue) { if (entry == null || !string.Equals(entry.Value, oldValue, StringComparison.OrdinalIgnoreCase)) { return false; } entry.Value = newValue; return true; } private void RegisterInput() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0028: 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_003d: Expected O, but got Unknown _scanButton = new ButtonConfig { Name = "MoonforgedVikingSense_Scan", Config = _scanKey, ActiveInGUI = false, ActiveInCustomGUI = false, BlockOtherInputs = false }; InputManager.Instance.AddButton("Moonforged.VikingSense", _scanButton); } private void Update() { //IL_00a3: Unknown result type (might be due to invalid IL or missing references) if (!_enabled.Value) { if (_scanActive || _activeHighlights.Count > 0 || (Object)(object)_pulseObject != (Object)null) { ClearAllVisuals(); } return; } UpdateActiveHighlights(); if (_scanActive) { UpdateScanWave(); } Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null || _scanButton == null) { _welcomeReadyAt = -1f; return; } TryShowFirstRunHelp(); if (UnityInput.Current.GetKeyDown(_scanKey.Value)) { TryStartScan(localPlayer); } } private void TryStartScan(Player player) { //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_003b: 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) if (_scanActive) { return; } float time = Time.time; if (!(time < _nextScanAllowedAt)) { _scanOrigin = ((Component)player).transform.position; _pulseSurfaceMode = DeterminePulseSurfaceMode(_scanOrigin); _scanStartedAt = time; _nextScanAllowedAt = time + Mathf.Max(0f, _cooldownSeconds.Value); _scanActive = true; CollectScanTargets(_scanOrigin); CreatePulseVisual(); if (_showMessages.Value) { ShowCenterMessage("Viking Sense"); } } } private void TryShowFirstRunHelp() { if (_welcomeHandledThisSession) { return; } if (!_showFirstRunHelp.Value) { _welcomeHandledThisSession = true; } else if (_firstRunHelpShown.Value && _firstRunHelpVersion.Value >= 4) { _welcomeHandledThisSession = true; } else if (!((Object)(object)MessageHud.instance == (Object)null)) { if (_welcomeReadyAt < 0f) { _welcomeReadyAt = Time.time + 4f; } else if (!(Time.time < _welcomeReadyAt)) { _helpPanelVisible = true; _helpPanelUntil = Time.time + Mathf.Max(5f, _firstRunHelpDuration.Value); _firstRunHelpShown.Value = true; _firstRunHelpVersion.Value = 4; ((BaseUnityPlugin)this).Config.Save(); _welcomeHandledThisSession = true; } } } private void OnGUI() { //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0103: 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_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_019f: 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_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Unknown result type (might be due to invalid IL or missing references) //IL_0242: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Unknown result type (might be due to invalid IL or missing references) //IL_027c: 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_0307: Unknown result type (might be due to invalid IL or missing references) //IL_0349: Unknown result type (might be due to invalid IL or missing references) //IL_035f: Unknown result type (might be due to invalid IL or missing references) //IL_0367: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Player.m_localPlayer == (Object)null) { return; } DrawCooldownHud(); if (_helpPanelVisible) { float num = _helpPanelUntil - Time.time; if (num <= 0f) { _helpPanelVisible = false; return; } EnsureHelpStyles(); float num2 = ((num < 1.5f) ? Mathf.Clamp01(num / 1.5f) : 1f); float num3 = Mathf.Min(720f, (float)Screen.width - 40f); float num4 = 218f; float num5 = ((float)Screen.width - num3) * 0.5f; float num6 = Mathf.Max(36f, (float)Screen.height * 0.08f); Rect val = default(Rect); ((Rect)(ref val))..ctor(num5, num6, num3, num4); Color color = GUI.color; Color backgroundColor = GUI.backgroundColor; GUI.color = new Color(0.035f, 0.045f, 0.055f, 0.94f * num2); GUI.DrawTexture(val, (Texture)(object)Texture2D.whiteTexture); GUI.color = new Color(0.86f, 0.68f, 0.3f, num2); GUI.DrawTexture(new Rect(((Rect)(ref val)).x, ((Rect)(ref val)).y, ((Rect)(ref val)).width, 2f), (Texture)(object)Texture2D.whiteTexture); GUI.DrawTexture(new Rect(((Rect)(ref val)).x, ((Rect)(ref val)).yMax - 2f, ((Rect)(ref val)).width, 2f), (Texture)(object)Texture2D.whiteTexture); GUI.DrawTexture(new Rect(((Rect)(ref val)).x, ((Rect)(ref val)).y, 2f, ((Rect)(ref val)).height), (Texture)(object)Texture2D.whiteTexture); GUI.DrawTexture(new Rect(((Rect)(ref val)).xMax - 2f, ((Rect)(ref val)).y, 2f, ((Rect)(ref val)).height), (Texture)(object)Texture2D.whiteTexture); GUI.color = new Color(1f, 1f, 1f, num2); GUI.Label(new Rect(((Rect)(ref val)).x + 24f, ((Rect)(ref val)).y + 16f, ((Rect)(ref val)).width - 48f, 32f), "MOONFORGED VIKING SENSE", _helpTitleStyle); string text = ((object)_scanKey.Value/*cast due to .constrained prefix*/).ToString(); GUI.Label(new Rect(((Rect)(ref val)).x + 24f, ((Rect)(ref val)).y + 56f, 106f, 34f), "PRESS " + text, _helpKeyStyle); GUI.Label(new Rect(((Rect)(ref val)).x + 145f, ((Rect)(ref val)).y + 59f, ((Rect)(ref val)).width - 169f, 30f), "Scan your surroundings for useful objects and nearby threats.", _helpBodyStyle); GUI.Label(new Rect(((Rect)(ref val)).x + 24f, ((Rect)(ref val)).y + 103f, ((Rect)(ref val)).width - 48f, 48f), "Detects resources, visible ore deposits, buildings, caves, world spawners, creatures, dropped items and nearby players.", _helpBodyStyle); GUI.Label(new Rect(((Rect)(ref val)).x + 24f, ((Rect)(ref val)).y + 165f, ((Rect)(ref val)).width - 48f, 30f), "<color=#D6B75F>Resources</color> • <color=#9473B8>Ore</color> • <color=#527CAB>Buildings & Caves</color> • <color=#C9CDD2>Creatures</color> • <color=#65A978>Players</color>", _helpLegendStyle); GUI.color = color; GUI.backgroundColor = backgroundColor; } } private void DrawCooldownHud() { //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_00bf: 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_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: 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_0213: 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_0296: Unknown result type (might be due to invalid IL or missing references) //IL_02b7: Unknown result type (might be due to invalid IL or missing references) //IL_02e1: Unknown result type (might be due to invalid IL or missing references) //IL_02f1: Unknown result type (might be due to invalid IL or missing references) if (_showMessages.Value) { float num = Mathf.Max(0f, _cooldownSeconds.Value); float num2 = _nextScanAllowedAt - Time.time; if (!(num <= 0f) && !(num2 <= 0f)) { EnsureCooldownStyles(); float num3 = 180f; float num4 = 38f; float num5 = ((float)Screen.width - num3) * 0.5f; float num6 = (float)Screen.height * 0.5f + 34f; Rect val = default(Rect); ((Rect)(ref val))..ctor(num5, num6, num3, num4); Color color = GUI.color; GUI.color = new Color(0.025f, 0.032f, 0.04f, 0.86f); GUI.DrawTexture(val, (Texture)(object)Texture2D.whiteTexture); GUI.color = new Color(0.72f, 0.58f, 0.28f, 0.9f); GUI.DrawTexture(new Rect(((Rect)(ref val)).x, ((Rect)(ref val)).y, ((Rect)(ref val)).width, 1f), (Texture)(object)Texture2D.whiteTexture); GUI.DrawTexture(new Rect(((Rect)(ref val)).x, ((Rect)(ref val)).yMax - 1f, ((Rect)(ref val)).width, 1f), (Texture)(object)Texture2D.whiteTexture); GUI.DrawTexture(new Rect(((Rect)(ref val)).x, ((Rect)(ref val)).y, 1f, ((Rect)(ref val)).height), (Texture)(object)Texture2D.whiteTexture); GUI.DrawTexture(new Rect(((Rect)(ref val)).xMax - 1f, ((Rect)(ref val)).y, 1f, ((Rect)(ref val)).height), (Texture)(object)Texture2D.whiteTexture); GUI.color = Color.white; GUI.Label(new Rect(((Rect)(ref val)).x + 8f, ((Rect)(ref val)).y + 4f, 108f, 20f), "VIKING SENSE", _cooldownTitleStyle); GUI.Label(new Rect(((Rect)(ref val)).x + 114f, ((Rect)(ref val)).y + 4f, 58f, 20f), num2.ToString("0.0") + "s", _cooldownTimeStyle); float num7 = Mathf.Clamp01(num2 / num); Rect val2 = default(Rect); ((Rect)(ref val2))..ctor(((Rect)(ref val)).x + 8f, ((Rect)(ref val)).y + 28f, ((Rect)(ref val)).width - 16f, 3f); GUI.color = new Color(0.18f, 0.2f, 0.22f, 0.95f); GUI.DrawTexture(val2, (Texture)(object)Texture2D.whiteTexture); GUI.color = new Color(0.72f, 0.58f, 0.28f, 0.95f); GUI.DrawTexture(new Rect(((Rect)(ref val2)).x, ((Rect)(ref val2)).y, ((Rect)(ref val2)).width * num7, ((Rect)(ref val2)).height), (Texture)(object)Texture2D.whiteTexture); GUI.color = color; } } } private void EnsureCooldownStyles() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Expected O, but got Unknown //IL_00d7: Unknown result type (might be due to invalid IL or missing references) if (_cooldownTitleStyle == null) { _cooldownTitleStyle = new GUIStyle(GUI.skin.label); _cooldownTitleStyle.fontSize = 12; _cooldownTitleStyle.fontStyle = (FontStyle)1; _cooldownTitleStyle.alignment = (TextAnchor)3; _cooldownTitleStyle.normal.textColor = new Color(0.88f, 0.78f, 0.52f, 1f); _cooldownTimeStyle = new GUIStyle(GUI.skin.label); _cooldownTimeStyle.fontSize = 12; _cooldownTimeStyle.fontStyle = (FontStyle)1; _cooldownTimeStyle.alignment = (TextAnchor)5; _cooldownTimeStyle.normal.textColor = new Color(0.92f, 0.94f, 0.96f, 1f); } } private void EnsureHelpStyles() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Expected O, but got Unknown //IL_00c3: 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_00e3: Expected O, but got Unknown //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Expected O, but got Unknown //IL_018a: Unknown result type (might be due to invalid IL or missing references) if (_helpTitleStyle == null) { _helpTitleStyle = new GUIStyle(GUI.skin.label); _helpTitleStyle.fontSize = 22; _helpTitleStyle.fontStyle = (FontStyle)1; _helpTitleStyle.alignment = (TextAnchor)3; _helpTitleStyle.normal.textColor = new Color(0.96f, 0.82f, 0.48f, 1f); _helpKeyStyle = new GUIStyle(GUI.skin.box); _helpKeyStyle.fontSize = 16; _helpKeyStyle.fontStyle = (FontStyle)1; _helpKeyStyle.alignment = (TextAnchor)4; _helpKeyStyle.normal.textColor = Color.white; _helpBodyStyle = new GUIStyle(GUI.skin.label); _helpBodyStyle.fontSize = 15; _helpBodyStyle.wordWrap = true; _helpBodyStyle.alignment = (TextAnchor)0; _helpBodyStyle.normal.textColor = new Color(0.9f, 0.92f, 0.94f, 1f); _helpLegendStyle = new GUIStyle(GUI.skin.label); _helpLegendStyle.fontSize = 14; _helpLegendStyle.fontStyle = (FontStyle)1; _helpLegendStyle.richText = true; _helpLegendStyle.alignment = (TextAnchor)3; _helpLegendStyle.normal.textColor = Color.white; } } private void CollectScanTargets(Vector3 origin) { //IL_004b: 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_0061: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0077: 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_008d: 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_00a3: 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_010b: Unknown result type (might be due to invalid IL or missing references) _scanTargets.Clear(); float num = Mathf.Max(1f, _scanRadius.Value); HashSet<int> seen = new HashSet<int>(); int num2 = Mathf.Max(1, _maximumTargets.Value); int num3 = Mathf.Max(20000, num2 * 10); CollectPickables(origin, num, seen, num3); CollectPlantsAndFlora(origin, num, seen, num3); CollectDroppedItems(origin, num, seen, num3); CollectMineRocks(origin, num, seen, num3); CollectMineablesAndLandmarks(origin, num, seen, num3); CollectCharacters(origin, num, seen, num3); CollectLocationProxies(origin, num, seen, num3); CollectWorldSpawners(origin, num, seen, num3); CollectBuildings(origin, num, seen, num3); if (_scanTargets.Count < num3) { Collider[] array = Physics.OverlapSphere(origin, num, -1, (QueryTriggerInteraction)2); foreach (Collider val in array) { if (!((Object)(object)val == (Object)null) && TryResolveResource(val, out var target, out var category)) { AddScanTarget(target, category, origin, num, seen, num3); if (_scanTargets.Count >= num3) { break; } } } } BalanceScanTargets(num2); _scanTargets.Sort(CompareScanTargetsByDistance); } private void BalanceScanTargets(int maximumTargets) { if (_scanTargets.Count <= maximumTargets) { return; } Dictionary<ScanCategory, List<ScanTarget>> dictionary = new Dictionary<ScanCategory, List<ScanTarget>>(); Array values = Enum.GetValues(typeof(ScanCategory)); for (int i = 0; i < values.Length; i++) { ScanCategory key = (ScanCategory)values.GetValue(i); dictionary[key] = new List<ScanTarget>(); } for (int j = 0; j < _scanTargets.Count; j++) { ScanTarget scanTarget = _scanTargets[j]; dictionary[scanTarget.Category].Add(scanTarget); } int num = 0; foreach (KeyValuePair<ScanCategory, List<ScanTarget>> item in dictionary) { item.Value.Sort(CompareScanTargetsByDistance); if (item.Value.Count > 0) { num++; } } if (num == 0) { _scanTargets.Clear(); return; } int num2 = Mathf.Max(1, maximumTargets / (num * 2)); List<ScanTarget> list = new List<ScanTarget>(maximumTargets); HashSet<int> hashSet = new HashSet<int>(); foreach (KeyValuePair<ScanCategory, List<ScanTarget>> item2 in dictionary) { List<ScanTarget> value = item2.Value; int num3 = Mathf.Min(num2, value.Count); for (int k = 0; k < num3; k++) { if (list.Count >= maximumTargets) { break; } ScanTarget scanTarget2 = value[k]; int num4 = (((Object)(object)scanTarget2.Target != (Object)null) ? ((Object)scanTarget2.Target).GetInstanceID() : 0); if (num4 != 0 && hashSet.Add(num4)) { list.Add(scanTarget2); } } } List<ScanTarget> list2 = new List<ScanTarget>(_scanTargets); list2.Sort(CompareScanTargetsByDistance); for (int l = 0; l < list2.Count; l++) { if (list.Count >= maximumTargets) { break; } ScanTarget scanTarget3 = list2[l]; if (!((Object)(object)scanTarget3.Target == (Object)null)) { int instanceID = ((Object)scanTarget3.Target).GetInstanceID(); if (hashSet.Add(instanceID)) { list.Add(scanTarget3); } } } _scanTargets.Clear(); _scanTargets.AddRange(list); } private void CollectMineRocks(Vector3 origin, float radius, HashSet<int> seen, int maximumTargets) { //IL_0092: 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) if (!_detectMineables.Value) { return; } MineRock5[] array = Object.FindObjectsByType<MineRock5>((FindObjectsSortMode)0); foreach (MineRock5 val in array) { if (!((Object)(object)val == (Object)null) && ((Component)val).gameObject.activeInHierarchy) { GameObject val2 = FindNetworkRoot(((Component)val).gameObject); if ((Object)(object)val2 != (Object)null && (IsWantedMineable(val2) || IsWantedMineable(((Component)val).gameObject))) { AddScanTarget(val2, ScanCategory.Mineable, origin, radius, seen, maximumTargets); } if (_scanTargets.Count >= maximumTargets) { return; } } } MineRock[] array2 = Object.FindObjectsByType<MineRock>((FindObjectsSortMode)0); foreach (MineRock val3 in array2) { if (!((Object)(object)val3 == (Object)null) && ((Component)val3).gameObject.activeInHierarchy) { GameObject val4 = FindNetworkRoot(((Component)val3).gameObject); if ((Object)(object)val4 != (Object)null && (IsWantedMineable(val4) || IsWantedMineable(((Component)val3).gameObject))) { AddScanTarget(val4, ScanCategory.Mineable, origin, radius, seen, maximumTargets); } if (_scanTargets.Count >= maximumTargets) { break; } } } } private void CollectPickables(Vector3 origin, float radius, HashSet<int> seen, int maximumTargets) { //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) if (!_detectPickables.Value) { return; } Pickable[] array = Object.FindObjectsByType<Pickable>((FindObjectsSortMode)0); foreach (Pickable val in array) { if (!((Object)(object)val == (Object)null) && ((Component)val).gameObject.activeInHierarchy) { AddScanTarget(FindNetworkRoot(((Component)val).gameObject), ScanCategory.Resource, origin, radius, seen, maximumTargets); if (_scanTargets.Count >= maximumTargets) { return; } } } PickableItem[] array2 = Object.FindObjectsByType<PickableItem>((FindObjectsSortMode)0); foreach (PickableItem val2 in array2) { if (!((Object)(object)val2 == (Object)null) && ((Component)val2).gameObject.activeInHierarchy) { AddScanTarget(FindNetworkRoot(((Component)val2).gameObject), ScanCategory.Resource, origin, radius, seen, maximumTargets); if (_scanTargets.Count >= maximumTargets) { break; } } } } private void CollectPlantsAndFlora(Vector3 origin, float radius, HashSet<int> seen, int maximumTargets) { //IL_005d: 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) if (!_detectPickables.Value) { return; } Plant[] array = Object.FindObjectsByType<Plant>((FindObjectsSortMode)0); foreach (Plant val in array) { if (!((Object)(object)val == (Object)null) && ((Component)val).gameObject.activeInHierarchy) { AddScanTarget(FindNetworkRoot(((Component)val).gameObject), ScanCategory.Resource, origin, radius, seen, maximumTargets); if (_scanTargets.Count >= maximumTargets) { return; } } } ZNetView[] array2 = Object.FindObjectsByType<ZNetView>((FindObjectsSortMode)0); foreach (ZNetView val2 in array2) { if ((Object)(object)val2 == (Object)null || !((Component)val2).gameObject.activeInHierarchy) { continue; } GameObject gameObject = ((Component)val2).gameObject; if (NameContainsAnyToken(((Object)gameObject).name, DefaultFloraTokens)) { AddScanTarget(gameObject, ScanCategory.Resource, origin, radius, seen, maximumTargets); if (_scanTargets.Count >= maximumTargets) { break; } } } } private void CollectBuildings(Vector3 origin, float radius, HashSet<int> seen, int maximumTargets) { //IL_0056: Unknown result type (might be due to invalid IL or missing references) if (!_detectBuildings.Value) { return; } Piece[] array = Object.FindObjectsByType<Piece>((FindObjectsSortMode)0); foreach (Piece val in array) { if (!((Object)(object)val == (Object)null) && ((Component)val).gameObject.activeInHierarchy) { AddScanTarget(FindNetworkRoot(((Component)val).gameObject), ScanCategory.Building, origin, radius, seen, maximumTargets); if (_scanTargets.Count >= maximumTargets) { break; } } } } private void CollectDroppedItems(Vector3 origin, float radius, HashSet<int> seen, int maximumTargets) { //IL_0046: Unknown result type (might be due to invalid IL or missing references) if (!_detectDroppedItems.Value) { return; } ItemDrop[] array = Object.FindObjectsByType<ItemDrop>((FindObjectsSortMode)0); foreach (ItemDrop val in array) { if (IsLooseWorldItem(val)) { AddScanTarget(FindNetworkRoot(((Component)val).gameObject), ScanCategory.Resource, origin, radius, seen, maximumTargets); if (_scanTargets.Count >= maximumTargets) { break; } } } } private void CollectCharacters(Vector3 origin, float radius, HashSet<int> seen, int maximumTargets) { //IL_00dc: 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) if (!_detectCreatures.Value && !_detectOtherPlayers.Value) { return; } Character[] array = Object.FindObjectsByType<Character>((FindObjectsSortMode)0); foreach (Character val in array) { if ((Object)(object)val == (Object)null || !((Component)val).gameObject.activeInHierarchy) { continue; } Player val2 = (Player)(object)((val is Player) ? val : null); if ((Object)(object)val2 != (Object)null) { if ((Object)(object)val2 == (Object)(object)Player.m_localPlayer || !_detectOtherPlayers.Value) { continue; } AddScanTarget(FindNetworkRoot(((Component)val2).gameObject), ScanCategory.OtherPlayer, origin, radius, seen, maximumTargets); } else if (_detectCreatures.Value) { AddScanTarget(FindNetworkRoot(((Component)val).gameObject), ScanCategory.Creature, origin, radius, seen, maximumTargets); } if (_scanTargets.Count < maximumTargets) { continue; } break; } } private void CollectLocationProxies(Vector3 origin, float radius, HashSet<int> seen, int maximumTargets) { //IL_0056: Unknown result type (might be due to invalid IL or missing references) if (!_detectCavesAndDungeons.Value) { return; } LocationProxy[] array = Object.FindObjectsByType<LocationProxy>((FindObjectsSortMode)0); foreach (LocationProxy val in array) { if (!((Object)(object)val == (Object)null) && ((Component)val).gameObject.activeInHierarchy) { AddScanTarget(FindNetworkRoot(((Component)val).gameObject), ScanCategory.Landmark, origin, radius, seen, maximumTargets); if (_scanTargets.Count >= maximumTargets) { break; } } } } private void CollectWorldSpawners(Vector3 origin, float radius, HashSet<int> seen, int maximumTargets) { //IL_0056: Unknown result type (might be due to invalid IL or missing references) if (!_detectWorldSpawners.Value) { return; } SpawnArea[] array = Object.FindObjectsByType<SpawnArea>((FindObjectsSortMode)0); foreach (SpawnArea val in array) { if (!((Object)(object)val == (Object)null) && ((Component)val).gameObject.activeInHierarchy) { AddScanTarget(FindNetworkRoot(((Component)val).gameObject), ScanCategory.Landmark, origin, radius, seen, maximumTargets); if (_scanTargets.Count >= maximumTargets) { break; } } } } private void CollectMineablesAndLandmarks(Vector3 origin, float radius, HashSet<int> seen, int maximumTargets) { //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) Destructible[] array = Object.FindObjectsByType<Destructible>((FindObjectsSortMode)0); foreach (Destructible val in array) { if ((Object)(object)val == (Object)null || !((Component)val).gameObject.activeInHierarchy) { continue; } GameObject val2 = FindNetworkRoot(((Component)val).gameObject); if (!((Object)(object)val2 == (Object)null)) { if (_detectMistlandsLandmarks.Value && NameContainsAnyToken(((Object)val2).name, MistlandsLandmarkTokens)) { AddScanTarget(val2, ScanCategory.Landmark, origin, radius, seen, maximumTargets); } else if (_detectMineables.Value && IsWantedMineable(val2)) { AddScanTarget(val2, ScanCategory.Mineable, origin, radius, seen, maximumTargets); } if (_scanTargets.Count >= maximumTargets) { break; } } } } private void AddScanTarget(GameObject target, ScanCategory category, Vector3 origin, float radius, HashSet<int> seen, int maximumTargets) { //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)target == (Object)null || !target.activeInHierarchy || _scanTargets.Count >= maximumTargets || (category == ScanCategory.Resource && ShouldIgnorePickable(target))) { return; } int instanceID = ((Object)target).GetInstanceID(); if (seen.Add(instanceID)) { float num = HorizontalDistance(origin, target.transform.position); if (!(num > radius)) { _scanTargets.Add(new ScanTarget(target, num, category)); } } } private bool TryResolveResource(Collider collider, out GameObject target, out ScanCategory category) { target = null; category = ScanCategory.Resource; Player componentInParent = ((Component)collider).GetComponentInParent<Player>(); if ((Object)(object)componentInParent != (Object)null) { if ((Object)(object)componentInParent == (Object)(object)Player.m_localPlayer) { return false; } if (_detectOtherPlayers.Value) { target = FindNetworkRoot(((Component)componentInParent).gameObject); category = ScanCategory.OtherPlayer; return (Object)(object)target != (Object)null; } return false; } if (_detectCreatures.Value) { Character componentInParent2 = ((Component)collider).GetComponentInParent<Character>(); if ((Object)(object)componentInParent2 != (Object)null) { target = FindNetworkRoot(((Component)componentInParent2).gameObject); category = ScanCategory.Creature; return (Object)(object)target != (Object)null; } } if (_detectCavesAndDungeons.Value) { LocationProxy componentInParent3 = ((Component)collider).GetComponentInParent<LocationProxy>(); if ((Object)(object)componentInParent3 != (Object)null) { target = FindNetworkRoot(((Component)componentInParent3).gameObject); category = ScanCategory.Landmark; return (Object)(object)target != (Object)null; } } if (_detectWorldSpawners.Value) { SpawnArea componentInParent4 = ((Component)collider).GetComponentInParent<SpawnArea>(); if ((Object)(object)componentInParent4 != (Object)null) { target = FindNetworkRoot(((Component)componentInParent4).gameObject); category = ScanCategory.Landmark; return (Object)(object)target != (Object)null; } } GameObject val = FindNetworkRoot(((Component)collider).gameObject); if (_detectMistlandsLandmarks.Value && (Object)(object)val != (Object)null && NameContainsAnyToken(((Object)val).name, MistlandsLandmarkTokens)) { target = val; category = ScanCategory.Landmark; return true; } if (_detectPickables.Value && (Object)(object)val != (Object)null && NameContainsAnyToken(((Object)val).name, DefaultFloraTokens)) { target = val; category = ScanCategory.Resource; return true; } if (_detectBuildings.Value) { Piece componentInParent5 = ((Component)collider).GetComponentInParent<Piece>(); if ((Object)(object)componentInParent5 != (Object)null) { target = FindNetworkRoot(((Component)componentInParent5).gameObject); category = ScanCategory.Building; return (Object)(object)target != (Object)null; } } if (_detectDroppedItems.Value) { ItemDrop componentInParent6 = ((Component)collider).GetComponentInParent<ItemDrop>(); if ((Object)(object)componentInParent6 != (Object)null && IsLooseWorldItem(componentInParent6)) { target = FindNetworkRoot(((Component)componentInParent6).gameObject); category = ScanCategory.Resource; return (Object)(object)target != (Object)null; } } if (_detectPickables.Value) { Pickable componentInParent7 = ((Component)collider).GetComponentInParent<Pickable>(); if ((Object)(object)componentInParent7 != (Object)null) { target = FindNetworkRoot(((Component)componentInParent7).gameObject); category = ScanCategory.Resource; return (Object)(object)target != (Object)null; } PickableItem componentInParent8 = ((Component)collider).GetComponentInParent<PickableItem>(); if ((Object)(object)componentInParent8 != (Object)null) { target = FindNetworkRoot(((Component)componentInParent8).gameObject); category = ScanCategory.Resource; return (Object)(object)target != (Object)null; } } if (_detectMineables.Value) { MineRock5 componentInParent9 = ((Component)collider).GetComponentInParent<MineRock5>(); if ((Object)(object)componentInParent9 != (Object)null) { GameObject val2 = FindNetworkRoot(((Component)componentInParent9).gameObject); if ((Object)(object)val2 != (Object)null && (IsWantedMineable(val2) || IsWantedMineable(((Component)componentInParent9).gameObject))) { target = val2; category = ScanCategory.Mineable; return true; } } MineRock componentInParent10 = ((Component)collider).GetComponentInParent<MineRock>(); if ((Object)(object)componentInParent10 != (Object)null) { GameObject val3 = FindNetworkRoot(((Component)componentInParent10).gameObject); if ((Object)(object)val3 != (Object)null && (IsWantedMineable(val3) || IsWantedMineable(((Component)componentInParent10).gameObject))) { target = val3; category = ScanCategory.Mineable; return true; } } Destructible componentInParent11 = ((Component)collider).GetComponentInParent<Destructible>(); if ((Object)(object)componentInParent11 != (Object)null) { GameObject val4 = FindNetworkRoot(((Component)componentInParent11).gameObject); if ((Object)(object)val4 != (Object)null && (IsWantedMineable(val4) || IsWantedMineable(((Component)componentInParent11).gameObject))) { target = val4; category = ScanCategory.Mineable; return true; } } } string value = _additionalPrefabTokens.Value; if (!string.IsNullOrWhiteSpace(value) && (Object)(object)val != (Object)null && NameContainsAnyToken(((Object)val).name, SplitTokens(value))) { target = val; category = ScanCategory.Resource; return true; } return false; } private bool IsLooseWorldItem(ItemDrop itemDrop) { if ((Object)(object)itemDrop == (Object)null || !((Component)itemDrop).gameObject.activeInHierarchy) { return false; } if ((Object)(object)((Component)itemDrop).GetComponentInParent<ItemStand>() != (Object)null) { return false; } return true; } private bool IsWantedMineable(GameObject target) { if ((Object)(object)target == (Object)null) { return false; } if (NameContainsAnyToken(((Object)target).name, ProgressionLockedMineableTokens)) { return false; } if (_detectGenericMineables.Value) { return true; } return NameContainsAnyToken(((Object)target).name, DefaultMineableTokens); } private static bool ShouldIgnorePickable(GameObject target) { return (Object)(object)target != (Object)null && NameContainsAnyToken(((Object)target).name, IgnoredPickableTokens); } private static bool IsFloraAuraTarget(GameObject target) { return (Object)(object)target != (Object)null && NameContainsAnyToken(((Object)target).name, DefaultFloraTokens); } private static bool NameContainsAnyToken(string objectName, string[] tokens) { if (string.IsNullOrEmpty(objectName) || tokens == null || tokens.Length == 0) { return false; } string text = NormalizePrefabName(objectName).ToLowerInvariant(); foreach (string text2 in tokens) { if (!string.IsNullOrWhiteSpace(text2) && text.Contains(text2.Trim().ToLowerInvariant())) { return true; } } return false; } private static string[] SplitTokens(string raw) { if (string.IsNullOrWhiteSpace(raw)) { return new string[0]; } return raw.Split(new char[1] { ',' }, StringSplitOptions.RemoveEmptyEntries); } private static string NormalizePrefabName(string objectName) { return objectName.Replace("(Clone)", string.Empty).Trim(); } private static GameObject FindNetworkRoot(GameObject source) { if ((Object)(object)source == (Object)null) { return null; } ZNetView componentInParent = source.GetComponentInParent<ZNetView>(); if ((Object)(object)componentInParent != (Object)null) { return ((Component)componentInParent).gameObject; } return source; } private void UpdateScanWave() { float num = Mathf.Max(0.05f, _scanTravelSeconds.Value); float num2 = Mathf.Clamp01((Time.time - _scanStartedAt) / num); float num3 = Mathf.SmoothStep(0f, Mathf.Max(1f, _scanRadius.Value), num2); UpdatePulseVisual(num3, num2); for (int i = 0; i < _scanTargets.Count; i++) { ScanTarget scanTarget = _scanTargets[i]; if (!scanTarget.Triggered) { if ((Object)(object)scanTarget.Target == (Object)null || !scanTarget.Target.activeInHierarchy) { scanTarget.Triggered = true; } else if (scanTarget.Distance <= num3 || num2 >= 1f) { scanTarget.Triggered = true; HighlightResource(scanTarget.Target, scanTarget.Category); } } } if (num2 >= 1f) { _scanActive = false; _scanTargets.Clear(); DestroyPulseVisual(); } } private void HighlightResource(GameObject target, ScanCategory category) { if ((Object)(object)target == (Object)null) { return; } int instanceID = ((Object)target).GetInstanceID(); if (_activeHighlights.TryGetValue(instanceID, out var value)) { value.Refresh(Time.time, Mathf.Max(0.1f, _highlightDuration.Value), category); return; } Renderer[] array = target.GetComponentsInChildren<Renderer>(true); if ((array != null && array.Length != 0) || category == ScanCategory.Landmark) { if (array == null) { array = (Renderer[])(object)new Renderer[0]; } ResourceHighlight resourceHighlight = new ResourceHighlight(target, array, Time.time, Mathf.Max(0.1f, _highlightDuration.Value), category); if (!resourceHighlight.HasRendererStates) { resourceHighlight.Restore(); } else { _activeHighlights.Add(instanceID, resourceHighlight); } } } private void UpdateActiveHighlights() { //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) if (_activeHighlights.Count == 0) { return; } float intensity = Mathf.Clamp(_highlightIntensity.Value, 0.1f, 1.25f); float time = Time.time; List<int> list = null; foreach (KeyValuePair<int, ResourceHighlight> activeHighlight in _activeHighlights) { ResourceHighlight value = activeHighlight.Value; if (value == null || (Object)(object)value.Target == (Object)null || time >= value.EndTime) { if (list == null) { list = new List<int>(); } list.Add(activeHighlight.Key); } else { Color highlightColor = GetHighlightColor(value.Target, value.Category); float strength = value.GetStrength(time); value.Apply(highlightColor, intensity, strength); } } if (list == null) { return; } for (int i = 0; i < list.Count; i++) { int key = list[i]; if (_activeHighlights.TryGetValue(key, out var value2)) { value2?.Restore(); _activeHighlights.Remove(key); } } } private Color GetHighlightColor(GameObject target, ScanCategory category) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_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_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) switch (category) { case ScanCategory.Resource: return GetResourceHighlightColor(target); case ScanCategory.Mineable: return GetMineableHighlightColor(target); case ScanCategory.Building: case ScanCategory.Landmark: return ParseColor(_buildingColorHex.Value, new Color(0.32f, 0.49f, 0.67f, 1f)); case ScanCategory.Creature: return ParseColor(_creatureColorHex.Value, new Color(0.79f, 0.8f, 0.82f, 1f)); case ScanCategory.OtherPlayer: return ParseColor(_otherPlayerColorHex.Value, new Color(0.4f, 0.66f, 0.47f, 1f)); default: return ParseColor(_highlightColorHex.Value, new Color(0.84f, 0.72f, 0.37f, 1f)); } } private Color GetResourceHighlightColor(GameObject target) { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0075: 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_02a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_0293: 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_029d: Unknown result type (might be due to invalid IL or missing references) //IL_026c: Unknown result type (might be due to invalid IL or missing references) //IL_0271: Unknown result type (might be due to invalid IL or missing references) string text = (((Object)(object)target != (Object)null) ? NormalizePrefabName(((Object)target).name).ToLowerInvariant() : string.Empty); if (text.Contains("raspberry")) { return new Color(0.82f, 0.25f, 0.28f, 1f); } if (text.Contains("blueberry")) { return new Color(0.34f, 0.5f, 0.92f, 1f); } if (text.Contains("cloudberry")) { return new Color(0.93f, 0.67f, 0.22f, 1f); } if (text.Contains("vineberry")) { return new Color(0.62f, 0.36f, 0.88f, 1f); } if (text.Contains("thistle")) { return new Color(0.42f, 0.88f, 0.9f, 1f); } if (text.Contains("dandelion") || text.Contains("flower")) { return new Color(0.92f, 0.82f, 0.27f, 1f); } if (text.Contains("mushroomyellow")) { return new Color(0.95f, 0.82f, 0.24f, 1f); } if (text.Contains("mushroomblue")) { return new Color(0.34f, 0.5f, 0.92f, 1f); } if (text.Contains("mushroomjotun")) { return new Color(0.45f, 0.72f, 0.94f, 1f); } if (text.Contains("mushroommagecap")) { return new Color(0.62f, 0.36f, 0.88f, 1f); } if (text.Contains("mushroom")) { return new Color(0.85f, 0.35f, 0.26f, 1f); } if (text.Contains("fiddlehead")) { return new Color(0.48f, 0.84f, 0.36f, 1f); } return ParseColor(_highlightColorHex.Value, new Color(0.84f, 0.72f, 0.37f, 1f)); } private Color GetMineableHighlightColor(GameObject target) { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0075: 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_0187: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: 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_00f9: 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_012a: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_0153: 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) string text = (((Object)(object)target != (Object)null) ? NormalizePrefabName(((Object)target).name).ToLowerInvariant() : string.Empty); if (text.Contains("copper")) { return new Color(0.87f, 0.53f, 0.24f, 1f); } if (text.Contains("tin")) { return new Color(0.82f, 0.85f, 0.88f, 1f); } if (text.Contains("obsidian")) { return new Color(0.46f, 0.44f, 0.56f, 1f); } if (text.Contains("flametal") || text.Contains("magma") || text.Contains("meteorite")) { return new Color(0.9f, 0.4f, 0.18f, 1f); } if (text.Contains("crystal")) { return new Color(0.58f, 0.9f, 0.96f, 1f); } if (text.Contains("guck")) { return new Color(0.48f, 0.84f, 0.36f, 1f); } return ParseColor(_mineableColorHex.Value, new Color(0.58f, 0.45f, 0.72f, 1f)); } private PulseSurfaceMode DeterminePulseSurfaceMode(Vector3 origin) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)ZoneSystem.instance == (Object)null) { return PulseSurfaceMode.Terrain; } float waterLevel = ZoneSystem.instance.m_waterLevel; float num = default(float); if (ZoneSystem.instance.GetGroundHeight(origin, ref num) && !(waterLevel > num + 0.35f)) { return PulseSurfaceMode.Terrain; } if (origin.y < waterLevel - 1f) { return PulseSurfaceMode.Underwater; } if (origin.y <= waterLevel + 1.5f) { return PulseSurfaceMode.WaterSurface; } return PulseSurfaceMode.Terrain; } private void CreatePulseVisual() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Expected O, but got Unknown DestroyPulseVisual(); _pulseObject = new GameObject("MVS_ScanPulse"); _pulseRenderer = _pulseObject.AddComponent<LineRenderer>(); _pulseRenderer.useWorldSpace = true; _pulseRenderer.loop = true; _pulseRenderer.positionCount = 96; _pulseRenderer.startWidth = 0.1f; _pulseRenderer.endWidth = 0.1f; _pulseRenderer.numCornerVertices = 2; _pulseRenderer.numCapVertices = 2; _pulseRenderer.textureMode = (LineTextureMode)0; ((Renderer)_pulseRenderer).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)_pulseRenderer).receiveShadows = false; Shader val = Shader.Find("Sprites/Default"); if ((Object)(object)val == (Object)null) { val = Shader.Find("Unlit/Color"); } if ((Object)(object)val != (Object)null) { _pulseMaterial = new Material(val); ((Object)_pulseMaterial).name = "MVS_ScanPulse_Material"; ((Renderer)_pulseRenderer).sharedMaterial = _pulseMaterial; } UpdatePulseVisual(0.2f, 0f); } private void UpdatePulseVisual(float radius, float progress) { //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_0040: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_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_00b4: 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_012c: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_pulseRenderer == (Object)null) { return; } Color val = ParseColor(_pulseColorHex.Value, new Color(0.31f, 0.62f, 0.72f, 1f)); val.a = Mathf.Lerp(0.7f, 0.08f, progress); _pulseRenderer.startColor = val; _pulseRenderer.endColor = val; float num2 = default(float); for (int i = 0; i < 96; i++) { float num = (float)i / 96f * (float)Math.PI * 2f; Vector3 val2 = _scanOrigin + new Vector3(Mathf.Cos(num) * radius, 0f, Mathf.Sin(num) * radius); if (_pulseSurfaceMode == PulseSurfaceMode.WaterSurface && (Object)(object)ZoneSystem.instance != (Object)null) { val2.y = ZoneSystem.instance.m_waterLevel + 0.12f; } else if (_pulseSurfaceMode == PulseSurfaceMode.Underwater) { val2.y = _scanOrigin.y + 0.12f; } else if ((Object)(object)ZoneSystem.instance != (Object)null && ZoneSystem.instance.GetGroundHeight(val2, ref num2)) { val2.y = num2 + 0.12f; } else { val2.y = _scanOrigin.y + 0.12f; } _pulseRenderer.SetPosition(i, val2); } } private void DestroyPulseVisual() { if ((Object)(object)_pulseObject != (Object)null) { Object.Destroy((Object)(object)_pulseObject); _pulseObject = null; _pulseRenderer = null; } if ((Object)(object)_pulseMaterial != (Object)null) { Object.Destroy((Object)(object)_pulseMaterial); _pulseMaterial = null; } } private void ClearAllVisuals() { _scanActive = false; _scanTargets.Clear(); DestroyPulseVisual(); foreach (KeyValuePair<int, ResourceHighlight> activeHighlight in _activeHighlights) { if (activeHighlight.Value != null) { activeHighlight.Value.Restore(); } } _activeHighlights.Clear(); } private void OnDestroy() { ClearAllVisuals(); } private static int CompareScanTargetsByDistance(ScanTarget left, ScanTarget right) { float distance = left.Distance; return distance.CompareTo(right.Distance); } private static float HorizontalDistance(Vector3 a, Vector3 b) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) float num = a.x - b.x; float num2 = a.z - b.z; return Mathf.Sqrt(num * num + num2 * num2); } private static Color ParseColor(string raw, Color fallback) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_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) if (string.IsNullOrWhiteSpace(raw)) { return fallback; } string text = raw.Trim(); if (!text.StartsWith("#", StringComparison.Ordinal)) { text = "#" + text; } Color result = default(Color); if (ColorUtility.TryParseHtmlString(text, ref result)) { return result; } return fallback; } private static void ShowCenterMessage(string text) { if ((Object)(object)MessageHud.instance != (Object)null) { MessageHud.instance.ShowMessage((MessageType)2, text, 0, (Sprite)null, false, true); } } private static void ShowTopLeftMessage(string text) { if ((Object)(object)MessageHud.instance != (Object)null) { MessageHud.instance.ShowMessage((MessageType)1, text, 0, (Sprite)null, false, true); } } private static void ConfigureMaterial(Material material, CullMode cull, CompareFunction zTest) { //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Expected I4, but got Unknown //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Expected I4, but got Unknown if (!((Object)(object)material == (Object)null)) { if (material.HasProperty("_SrcBlend")) { material.SetInt("_SrcBlend", 5); } if (material.HasProperty("_DstBlend")) { material.SetInt("_DstBlend", 10); } if (material.HasProperty("_Cull")) { material.SetInt("_Cull", (int)cull); } if (material.HasProperty("_ZWrite")) { material.SetInt("_ZWrite", 0); } if (material.HasProperty("_ZTest")) { material.SetInt("_ZTest", (int)zTest); } } } private static void ConfigureRenderer(Renderer renderer) { if (!((Object)(object)renderer == (Object)null)) { renderer.shadowCastingMode = (ShadowCastingMode)0; renderer.receiveShadows = false; renderer.lightProbeUsage = (LightProbeUsage)0; renderer.reflectionProbeUsage = (ReflectionProbeUsage)0; } } private static Material[] MakeMaterialArray(int count, Material material) { int num = Mathf.Max(1, count); Material[] array = (Material[])(object)new Material[num]; for (int i = 0; i < num; i++) { array[i] = material; } return array; } private static void CopyTransformExact(Transform source, Transform destination) { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0057: 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_001f: 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_0039: Unknown result type (might be due to invalid IL or missing references) Transform parent = source.parent; if ((Object)(object)parent != (Object)null) { destination.SetParent(parent, false); destination.loc