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 RunicUtilities v1.0.0
plugins\RunicUtilities.dll
Decompiled 5 days ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using Jotunn.Configs; using Jotunn.Entities; using Jotunn.Managers; using Jotunn.Utils; using Microsoft.CodeAnalysis; using RunicUtilities.Content; using RunicUtilities.Effects; using RunicUtilities.Spells; using RunicUtilities.StatusEffects; using RunicUtilities.Storage; using RunicUtilities.Totems; using RunicUtilities.Utility; using RunicUtilities.Visuals; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("Runic Utilities")] [assembly: AssemblyDescription("Early-game utility Eitr progression and runic utility spells for Valheim")] [assembly: AssemblyCompany("RunicUtilities")] [assembly: AssemblyProduct("Runic Utilities")] [assembly: ComVisible(false)] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace RunicUtilities { [BepInPlugin("com.runicutilities.valheim", "Runic Utilities", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] public sealed class RunicUtilitiesPlugin : BaseUnityPlugin { public const string PluginGuid = "com.runicutilities.valheim"; public const string PluginName = "Runic Utilities"; public const string PluginVersion = "1.0.0"; internal static RunicUtilitiesPlugin Instance { get; private set; } internal Harmony Harmony { get; private set; } internal static void LogError(string message) { RunicUtilitiesPlugin instance = Instance; if (instance != null) { ((BaseUnityPlugin)instance).Logger.LogError((object)message); } } internal static void LogWarning(string message) { RunicUtilitiesPlugin instance = Instance; if (instance != null) { ((BaseUnityPlugin)instance).Logger.LogWarning((object)message); } } private void Awake() { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Expected O, but got Unknown Instance = this; RunicHeldTuning.Initialize(((BaseUnityPlugin)this).Config); SpellRegistry.RegisterDefaults(); PrefabManager.OnVanillaPrefabsAvailable += RegisterContent; Harmony = new Harmony("com.runicutilities.valheim"); Harmony.PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Runic Utilities 1.0.0 loaded."); } private void RegisterContent() { PrefabManager.OnVanillaPrefabsAvailable -= RegisterContent; FoodRegistrar.RegisterAll(); RunicItemRegistrar.RegisterAll(); RunicStatusRegistrar.RegisterAll(); RunicTotemRegistrar.RegisterAll(); } private void Update() { RavensEyeService.Update(); RunicShelterService.Update(); FrostpathService.Update(); } private void LateUpdate() { RavensEyeService.LateUpdate(); } private void OnDestroy() { RavensEyeService.End(null); RunicShelterService.Clear(); FrostpathService.Clear(); PrefabManager.OnVanillaPrefabsAvailable -= RegisterContent; Harmony harmony = Harmony; if (harmony != null) { harmony.UnpatchSelf(); } } } } namespace RunicUtilities.Visuals { internal static class RunicHeldTuning { private static ConfigEntry<float> offsetX; private static ConfigEntry<float> offsetY; private static ConfigEntry<float> offsetZ; private static ConfigEntry<float> rotationX; private static ConfigEntry<float> rotationY; private static ConfigEntry<float> rotationZ; private static ConfigEntry<float> scaleMultiplier; internal static void Initialize(ConfigFile config) { if (config != null && offsetX == null) { offsetX = config.Bind<float>("Held Rune Fine Tuning", "FineOffsetX", 0f, "Global local X offset added to every held rune/staff visual. Small steps like 0.005 are recommended."); offsetY = config.Bind<float>("Held Rune Fine Tuning", "FineOffsetY", 0f, "Global local Y offset added to every held rune/staff visual. Positive/negative directions depend on the hand attachment space."); offsetZ = config.Bind<float>("Held Rune Fine Tuning", "FineOffsetZ", 0f, "Global local Z offset added to every held rune/staff visual. Small steps like 0.005 are recommended."); rotationX = config.Bind<float>("Held Rune Fine Tuning", "FineRotationX", 0f, "Global local X rotation in degrees added to every held rune/staff visual."); rotationY = config.Bind<float>("Held Rune Fine Tuning", "FineRotationY", 0f, "Global local Y rotation in degrees added to every held rune/staff visual."); rotationZ = config.Bind<float>("Held Rune Fine Tuning", "FineRotationZ", 0f, "Global local Z rotation in degrees added to every held rune/staff visual."); scaleMultiplier = config.Bind<float>("Held Rune Fine Tuning", "FineScaleMultiplier", 1f, "Global multiplier applied to the base held rune/staff scale. 1.0 keeps the shipped size."); } } internal static Vector3 ApplyOffset(Vector3 basePosition) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) return basePosition + new Vector3((offsetX != null) ? offsetX.Value : 0f, (offsetY != null) ? offsetY.Value : 0f, (offsetZ != null) ? offsetZ.Value : 0f); } internal static Vector3 ApplyRotation(Vector3 baseRotationEuler) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) return baseRotationEuler + new Vector3((rotationX != null) ? rotationX.Value : 0f, (rotationY != null) ? rotationY.Value : 0f, (rotationZ != null) ? rotationZ.Value : 0f); } internal static Vector3 ApplyScale(float baseScale) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) float num = ((scaleMultiplier != null) ? Mathf.Max(0.05f, scaleMultiplier.Value) : 1f); return Vector3.one * (baseScale * num); } } internal static class RunicIconFactory { private static readonly Dictionary<string, Sprite> Cache = new Dictionary<string, Sprite>(); private const int OutputSize = 128; private const int MarginPixels = 8; internal static Sprite RenderAndCache(string key, GameObject prefab) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) if (string.IsNullOrEmpty(key) || (Object)(object)prefab == (Object)null) { return null; } Sprite val = null; try { val = RenderManager.Instance.Render(prefab, RenderManager.IsometricRotation); } catch { } if ((Object)(object)val != (Object)null) { Sprite val2 = TightCrop(val) ?? val; Cache[key] = val2; return val2; } return null; } internal static void CacheExisting(string key, Sprite sprite) { if (!string.IsNullOrEmpty(key) && (Object)(object)sprite != (Object)null) { Cache[key] = sprite; } } internal static Sprite Get(string key) { if (!string.IsNullOrEmpty(key) && Cache.TryGetValue(key, out var value)) { return value; } return null; } internal static Sprite GetStatus(string statusName) { string text = statusName switch { "Frostwalker" => "RU_RuneOfFrostpath", "Warding Flame" => "RU_RuneOfWarmth", "Windstep" => "RU_RuneOfGale", "Fleetfoot" => "RU_RuneOfFleetfoot", _ => null, }; if (text != null) { return Get(text); } return null; } private static Sprite TightCrop(Sprite sourceSprite) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Expected O, but got Unknown //IL_02de: Unknown result type (might be due to invalid IL or missing references) //IL_02ed: Unknown result type (might be due to invalid IL or missing references) //IL_0291: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)sourceSprite == (Object)null || (Object)(object)sourceSprite.texture == (Object)null) { return null; } Texture2D val = CopyReadable((Texture)(object)sourceSprite.texture); if ((Object)(object)val == (Object)null) { return null; } try { Rect rect = sourceSprite.rect; int num = Mathf.Clamp(Mathf.RoundToInt(((Rect)(ref rect)).x), 0, ((Texture)val).width - 1); int num2 = Mathf.Clamp(Mathf.RoundToInt(((Rect)(ref rect)).y), 0, ((Texture)val).height - 1); int num3 = Mathf.Clamp(Mathf.RoundToInt(((Rect)(ref rect)).width), 1, ((Texture)val).width - num); int num4 = Mathf.Clamp(Mathf.RoundToInt(((Rect)(ref rect)).height), 1, ((Texture)val).height - num2); Color32[] pixels = val.GetPixels32(); int num5 = num3; int num6 = num4; int num7 = -1; int num8 = -1; for (int i = 0; i < num4; i++) { int num9 = (num2 + i) * ((Texture)val).width; for (int j = 0; j < num3; j++) { if (pixels[num9 + num + j].a > 8) { if (j < num5) { num5 = j; } if (j > num7) { num7 = j; } if (i < num6) { num6 = i; } if (i > num8) { num8 = i; } } } } if (num7 < num5 || num8 < num6) { return null; } int num10 = num7 - num5 + 1; int num11 = num8 - num6 + 1; float num12 = 112f; float num13 = Mathf.Min(num12 / (float)num10, num12 / (float)num11); if (num13 <= 0f) { return null; } float num14 = (float)num10 * num13; float num15 = (float)num11 * num13; float num16 = (128f - num14) * 0.5f; float num17 = (128f - num15) * 0.5f; Texture2D val2 = new Texture2D(128, 128, (TextureFormat)4, false) { name = "RU_ZoomedIcon_" + ((Object)sourceSprite).name, filterMode = (FilterMode)1, wrapMode = (TextureWrapMode)1 }; Color32[] pixels2 = (Color32[])(object)new Color32[16384]; val2.SetPixels32(pixels2); for (int k = 0; k < 128; k++) { for (int l = 0; l < 128; l++) { float num18 = ((float)l + 0.5f - num16) / num13; float num19 = ((float)k + 0.5f - num17) / num13; if (!(num18 < 0f) && !(num19 < 0f) && !(num18 >= (float)num10) && !(num19 >= (float)num11)) { float num20 = (float)(num + num5) + num18; float num21 = (float)(num2 + num6) + num19; float num22 = Mathf.Clamp01((num20 + 0.5f) / (float)((Texture)val).width); float num23 = Mathf.Clamp01((num21 + 0.5f) / (float)((Texture)val).height); val2.SetPixel(l, k, val.GetPixelBilinear(num22, num23)); } } } val2.Apply(false, false); return Sprite.Create(val2, new Rect(0f, 0f, 128f, 128f), new Vector2(0.5f, 0.5f), 100f); } catch { return null; } finally { Object.Destroy((Object)(object)val); } } private static Texture2D CopyReadable(Texture source) { //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Expected O, but got Unknown if ((Object)(object)source == (Object)null || source.width <= 0 || source.height <= 0) { return null; } RenderTexture active = RenderTexture.active; RenderTexture val = null; try { val = RenderTexture.GetTemporary(source.width, source.height, 0, (RenderTextureFormat)0, (RenderTextureReadWrite)0); Graphics.Blit(source, val); RenderTexture.active = val; Texture2D val2 = new Texture2D(source.width, source.height, (TextureFormat)4, false) { filterMode = (FilterMode)1, wrapMode = (TextureWrapMode)1 }; val2.ReadPixels(new Rect(0f, 0f, (float)source.width, (float)source.height), 0, 0, false); val2.Apply(false, false); return val2; } catch { return null; } finally { RenderTexture.active = active; if ((Object)(object)val != (Object)null) { RenderTexture.ReleaseTemporary(val); } } } } internal static class RunicModelFactory { internal static void ApplyItemVisual(GameObject prefab, string itemPrefabName) { if (!((Object)(object)prefab == (Object)null)) { HideOriginalRenderers(prefab); Transform root = CreateVisualRoot(FindAttachmentAnchor(prefab.transform) ?? prefab.transform, "RU_KitbashItemVisual"); ConfigureHeldItemTransform(root, itemPrefabName); switch (itemPrefabName) { case "RU_RuneOfForaging": BuildForaging(root); break; case "RU_RuneOfFleetfoot": BuildFleetfoot(root); break; case "RU_RuneOfSeeking": BuildSeeking(root); break; case "RU_StonebreakerRune": BuildStonebreaker(root); break; case "RU_SpectralHatchet": BuildSpectralHatchet(root); break; case "RU_RuneOfReaping": BuildReaping(root); break; case "RU_RuneOfMending": BuildMending(root); break; case "RU_RuneOfRestoration": BuildRestoration(root); break; case "RU_TimberRune": BuildTimber(root); break; case "RU_RuneOfGale": BuildGale(root); break; case "RU_RuneOfWarmth": BuildWarmth(root); break; case "RU_RuneOfFrostpath": BuildFrostpath(root); break; case "RU_RuneOfShelter": BuildShelter(root); break; case "RU_RuneOfForge": BuildForge(root); break; case "RU_RuneOfHomecoming": BuildHomecoming(root); break; case "RU_RavensEyeRune": BuildRavensEye(root); break; case "RU_AstralCacheRune": BuildAstralCache(root); break; case "RU_RuneOfSorting": BuildSorting(root); break; } AttachRuneParts(root); } } internal static void ApplyFoodVisual(GameObject prefab, string foodPrefabName) { //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0070: 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_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: 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_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_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_0166: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_021c: 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_0248: Unknown result type (might be due to invalid IL or missing references) //IL_0252: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Unknown result type (might be due to invalid IL or missing references) //IL_028c: Unknown result type (might be due to invalid IL or missing references) //IL_0291: Unknown result type (might be due to invalid IL or missing references) //IL_029b: Unknown result type (might be due to invalid IL or missing references) //IL_02af: Unknown result type (might be due to invalid IL or missing references) //IL_02d6: Unknown result type (might be due to invalid IL or missing references) //IL_02db: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: Unknown result type (might be due to invalid IL or missing references) //IL_02f9: Unknown result type (might be due to invalid IL or missing references) //IL_031f: Unknown result type (might be due to invalid IL or missing references) //IL_0324: Unknown result type (might be due to invalid IL or missing references) //IL_032e: Unknown result type (might be due to invalid IL or missing references) //IL_0333: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)prefab == (Object)null)) { Transform val = FindAttachmentAnchor(prefab.transform) ?? prefab.transform; if (foodPrefabName == "RU_RunicCloudberryPudding") { val.localScale = Vector3.Scale(val.localScale, Vector3.one * 0.38f); } Transform val2 = CreateVisualRoot(val, "RU_KitbashFoodAccents"); val2.localPosition = Vector3.zero; val2.localRotation = Quaternion.identity; val2.localScale = Vector3.one; switch (foodPrefabName) { case "RU_RunicBerryMash": AddVisual(val2, "Dandelion", "Petal", new Vector3(0.08f, 0.08f, -0.06f), Vector3.one * 0.2f, Quaternion.Euler(15f, 25f, 5f)); AddVisual(val2, "Honey", "Honey", new Vector3(-0.08f, 0.05f, -0.05f), Vector3.one * 0.15f, Quaternion.identity); break; case "RU_EnchantedBlueberryStew": AddVisual(val2, "Blueberries", "Blueberries", new Vector3(0.08f, 0.1f, -0.05f), Vector3.one * 0.22f, Quaternion.Euler(5f, 30f, 0f)); AddVisual(val2, "GreydwarfEye", "EyeAccent", new Vector3(-0.1f, 0.08f, -0.05f), Vector3.one * 0.11f, Quaternion.Euler(0f, 30f, 0f)); break; case "RU_RunicTurnipStew": AddVisual(val2, "Thistle", "Thistle", new Vector3(0.1f, 0.11f, -0.05f), Vector3.one * 0.16f, Quaternion.Euler(0f, 15f, 18f)); break; case "RU_FrostEitrCream": AddVisual(val2, "FreezeGland", "Frost", new Vector3(0.08f, 0.09f, -0.05f), Vector3.one * 0.12f, Quaternion.Euler(0f, 25f, 0f)); AddVisual(val2, "Crystal", "Crystal", new Vector3(-0.1f, 0.1f, -0.05f), Vector3.one * 0.1f, Quaternion.Euler(20f, 15f, 0f)); break; case "RU_RunicCloudberryPudding": AddVisual(val2, "Cloudberry", "Cloudberry", new Vector3(0.09f, 0.08f, -0.05f), Vector3.one * 0.2f, Quaternion.Euler(0f, 20f, 0f)); AddVisual(val2, "BarleyFlour", "Barley", new Vector3(-0.08f, 0.06f, -0.05f), Vector3.one * 0.12f, Quaternion.identity); break; } } } internal static void ApplyTotemVisual(GameObject prefab, string totemPrefabName) { //IL_0028: 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_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: 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_00c2: 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_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_0220: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Unknown result type (might be due to invalid IL or missing references) //IL_0245: Unknown result type (might be due to invalid IL or missing references) //IL_024f: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_027f: 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_0159: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0192: 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_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01db: 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) if (!((Object)(object)prefab == (Object)null)) { DisableInheritedWardVisualEffects(prefab); HideOriginalRenderers(prefab); Transform val = CreateVisualRoot(prefab.transform, "RU_KitbashTotemVisual"); val.localPosition = Vector3.zero; val.localRotation = Quaternion.identity; val.localScale = Vector3.one; GameObject val2 = AddVisual(val, "Stone", "Base", Vector3.zero, new Vector3(0.72f, 0.32f, 0.72f), Quaternion.Euler(0f, 18f, 0f)); GameObject val3 = null; GameObject val4 = null; GameObject val5 = null; if (totemPrefabName == "RU_FleetfootTotem") { val3 = AddVisual(val, "Wood", "Post", Vector3.zero, new Vector3(0.3f, 0.86f, 0.3f), Quaternion.identity); val4 = AddVisual(val, "HardAntler", "AntlerCrown", Vector3.zero, new Vector3(0.42f, 0.42f, 0.42f), Quaternion.Euler(0f, 0f, 0f)); val5 = AddVisual(val, "Amber", "RuneStone", Vector3.zero, Vector3.one * 0.13f, Quaternion.identity); } else if (totemPrefabName == "RU_WindstepTotem") { val3 = AddVisual(val, "RoundLog", "Post", Vector3.zero, new Vector3(0.3f, 0.9f, 0.3f), Quaternion.identity, "Wood"); val4 = AddVisual(val, "Crystal", "CrystalTop", Vector3.zero, Vector3.one * 0.3f, Quaternion.Euler(0f, 28f, 0f)); val5 = AddVisual(val, "WolfFang", "FangCharm", Vector3.zero, new Vector3(0.16f, 0.22f, 0.16f), Quaternion.Euler(0f, 0f, -18f)); } else { val3 = AddVisual(val, "FineWood", "Post", Vector3.zero, new Vector3(0.3f, 0.88f, 0.3f), Quaternion.identity, "Wood"); val4 = AddVisual(val, "SurtlingCore", "Ember", Vector3.zero, Vector3.one * 0.28f, Quaternion.identity); val5 = AddVisual(val, "Iron", "IronCharm", Vector3.zero, new Vector3(0.14f, 0.1f, 0.1f), Quaternion.Euler(0f, 0f, 18f)); } if ((Object)(object)val2 != (Object)null && (Object)(object)val3 != (Object)null) { StackOnTop(val3.transform, val2.transform, val, 0.035f); } if ((Object)(object)val3 != (Object)null && (Object)(object)val4 != (Object)null) { StackOnTop(val4.transform, val3.transform, val, 0.045f); } if ((Object)(object)val3 != (Object)null && (Object)(object)val5 != (Object)null) { MountOnFront(val5.transform, val3.transform, val, 0.6f, 0.018f); } DisableInheritedWardVisualEffects(prefab); } } private static void BuildForaging(Transform root) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) BuildShieldRune(root, new Color(0.52f, 0.88f, 0.36f, 1f)); } private static void BuildFleetfoot(Transform root) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) BuildShieldRune(root, new Color(0.78f, 0.96f, 0.24f, 1f)); } private static void BuildSeeking(Transform root) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) BuildShieldRune(root, new Color(0.95f, 0.66f, 0.18f, 1f)); } private static void BuildStonebreaker(Transform root) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) BuildShieldRune(root, new Color(0.62f, 0.6f, 0.56f, 1f)); } private static void BuildSpectralHatchet(Transform root) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) BuildShieldRune(root, new Color(0.45f, 0.95f, 0.82f, 1f)); } private static void BuildReaping(Transform root) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) BuildShieldRune(root, new Color(0.4f, 0.74f, 0.35f, 1f)); } private static void BuildMending(Transform root) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) BuildShieldRune(root, new Color(0.78f, 0.88f, 0.98f, 1f)); } private static void BuildRestoration(Transform root) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) BuildShieldRune(root, new Color(1f, 0.82f, 0.32f, 1f)); } private static void BuildTimber(Transform root) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) BuildShieldRune(root, new Color(0.56f, 0.74f, 0.3f, 1f)); } private static void BuildGale(Transform root) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) BuildShieldRune(root, new Color(0.48f, 0.78f, 1f, 1f)); } private static void BuildWarmth(Transform root) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) BuildShieldRune(root, new Color(1f, 0.44f, 0.12f, 1f)); } private static void BuildFrostpath(Transform root) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) BuildShieldRune(root, new Color(0.35f, 0.95f, 1f, 1f)); } private static void BuildShelter(Transform root) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) BuildShieldRune(root, new Color(0.22f, 0.75f, 0.88f, 1f)); } private static void BuildForge(Transform root) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) BuildShieldRune(root, new Color(1f, 0.56f, 0.1f, 1f)); } private static void BuildHomecoming(Transform root) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) BuildShieldRune(root, new Color(0.78f, 0.52f, 1f, 1f)); } private static void BuildRavensEye(Transform root) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) BuildShieldRune(root, new Color(0.32f, 0.38f, 1f, 1f)); } private static void BuildAstralCache(Transform root) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) BuildShieldRune(root, new Color(0.16f, 0.9f, 0.78f, 1f)); } private static void BuildSorting(Transform root) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) BuildShieldRune(root, new Color(0.95f, 0.3f, 0.72f, 1f)); } private static void BuildShieldRune(Transform root, Color tint) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) BuildStaffRune(root, new string[1] { "StaffShield" }, tint); } private static void BuildStaffRune(Transform root, string[] candidatePrefabs, Color tint) { //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) GameObject val = null; if (candidatePrefabs != null) { foreach (string text in candidatePrefabs) { if (!string.IsNullOrWhiteSpace(text)) { val = AddVisual(root, text, "StaffBody", new Vector3(0f, 0.12f, 0f), Vector3.one * 0.68f, Quaternion.Euler(0f, 0f, -8f)); if ((Object)(object)val != (Object)null) { break; } } } } if ((Object)(object)val == (Object)null) { val = AddVisual(root, "StaffFireball", "StaffBody", new Vector3(0f, 0.12f, 0f), Vector3.one * 0.68f, Quaternion.Euler(0f, 0f, -8f)); } TintVisual(val, tint); } private static void TintVisual(GameObject visual, Color tint) { //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Expected O, but got Unknown //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00be: 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_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_0101: 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_019f: 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_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)visual == (Object)null) { return; } Renderer component = visual.GetComponent<Renderer>(); if ((Object)(object)component == (Object)null) { return; } Material[] sharedMaterials = component.sharedMaterials; if (sharedMaterials == null || sharedMaterials.Length == 0) { return; } Material[] array = (Material[])(object)new Material[sharedMaterials.Length]; for (int i = 0; i < sharedMaterials.Length; i++) { Material val = sharedMaterials[i]; if ((Object)(object)val == (Object)null) { array[i] = null; continue; } Material val2 = new Material(val); RecolorRedTextureProperty(val2, "_MainTex", tint); RecolorRedTextureProperty(val2, "_BaseMap", tint); RecolorRedTextureProperty(val2, "_EmissionMap", tint); RecolorRedTextureProperty(val2, "_EmissiveColorMap", tint); if (val2.HasProperty("_EmissionColor")) { Color color = val2.GetColor("_EmissionColor"); if (IsRedDominant(color)) { float num = Mathf.Max(color.r, Mathf.Max(color.g, color.b)); Color val3 = tint * Mathf.Max(0.2f, num); val3.a = color.a; val2.SetColor("_EmissionColor", val3); val2.EnableKeyword("_EMISSION"); } } array[i] = val2; } component.materials = array; MeshFilter component2 = visual.GetComponent<MeshFilter>(); if (!((Object)(object)component2 != (Object)null) || !((Object)(object)component2.sharedMesh != (Object)null)) { return; } Mesh sharedMesh = component2.sharedMesh; Color[] colors = sharedMesh.colors; if (colors == null || colors.Length != sharedMesh.vertexCount || colors.Length == 0) { return; } Mesh val4 = Object.Instantiate<Mesh>(sharedMesh); bool flag = false; for (int j = 0; j < colors.Length; j++) { Color val5 = colors[j]; if (IsRedDominant(val5)) { float num2 = Mathf.Max(val5.r, Mathf.Max(val5.g, val5.b)); Color val6 = tint * num2; val6.a = val5.a; colors[j] = val6; flag = true; } } if (flag) { val4.colors = colors; component2.sharedMesh = val4; } } private static void RecolorRedTextureProperty(Material material, string propertyName, Color tint) { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: 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_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_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_011a: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)material == (Object)null || !material.HasProperty(propertyName)) { return; } Texture texture = material.GetTexture(propertyName); if ((Object)(object)texture == (Object)null) { return; } Texture2D val = CloneReadableTexture(texture); if ((Object)(object)val == (Object)null) { return; } Color32[] pixels = val.GetPixels32(); bool flag = false; for (int i = 0; i < pixels.Length; i++) { Color32 val2 = pixels[i]; if (val2.a != 0) { Color val3 = Color32.op_Implicit(val2); if (IsRedDominant(val3)) { float num = Mathf.Max(val3.r, Mathf.Max(val3.g, val3.b)); float num2 = ((num <= 0.0001f) ? 0f : ((num - Mathf.Min(val3.r, Mathf.Min(val3.g, val3.b))) / num)); Color val4 = tint * num; Color val5 = Color.Lerp(new Color(num, num, num, val3.a), val4, Mathf.Clamp01(0.6f + num2 * 0.35f)); val5.a = val3.a; pixels[i] = Color32.op_Implicit(val5); flag = true; } } } if (!flag) { Object.Destroy((Object)(object)val); return; } val.SetPixels32(pixels); val.Apply(false, false); ((Object)val).name = "RU_Recolor_" + ((Object)texture).name; material.SetTexture(propertyName, (Texture)(object)val); } private static bool IsRedDominant(Color c) { //IL_0000: 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_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) if (c.r > 0.18f && c.r > c.g * 1.18f) { return c.r > c.b * 1.12f; } return false; } private static Texture2D CloneReadableTexture(Texture source) { //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005c: 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_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_008b: 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_00a1: Expected O, but got Unknown if ((Object)(object)source == (Object)null || source.width <= 0 || source.height <= 0) { return null; } RenderTexture active = RenderTexture.active; RenderTexture val = null; try { val = RenderTexture.GetTemporary(source.width, source.height, 0, (RenderTextureFormat)0, (RenderTextureReadWrite)0); Graphics.Blit(source, val); RenderTexture.active = val; Texture2D val2 = new Texture2D(source.width, source.height, (TextureFormat)4, false) { filterMode = source.filterMode, wrapMode = source.wrapMode }; val2.ReadPixels(new Rect(0f, 0f, (float)source.width, (float)source.height), 0, 0, false); val2.Apply(false, false); return val2; } catch { return null; } finally { RenderTexture.active = active; if ((Object)(object)val != (Object)null) { RenderTexture.ReleaseTemporary(val); } } } private static void AddHandle(Transform root, string sourcePrefab) { //IL_0016: 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_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) AddVisual(root, sourcePrefab, "Handle", new Vector3(0f, 0.34f, 0f), new Vector3(0.18f, 0.52f, 0.18f), Quaternion.Euler(0f, 0f, 90f), "Wood"); AddVisual(root, "LeatherScraps", "Grip", new Vector3(0f, 0.18f, 0f), new Vector3(0.13f, 0.15f, 0.11f), Quaternion.identity, "DeerHide"); } private static void ConfigureHeldItemTransform(Transform root, string itemPrefabName) { //IL_0094: 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_00a5: 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_00b2: Unknown result type (might be due to invalid IL or missing references) Vector3 baseRotationEuler = default(Vector3); ((Vector3)(ref baseRotationEuler))..ctor(90f, 0f, 0f); Vector3 basePosition = default(Vector3); ((Vector3)(ref basePosition))..ctor(-0.012f, -0.01f, -0.158f); float baseScale = 0.39f; switch (itemPrefabName) { case "RU_SpectralHatchet": ((Vector3)(ref basePosition))..ctor(-0.016f, -0.006f, -0.164f); baseScale = 0.42f; break; case "RU_StonebreakerRune": case "RU_RuneOfHomecoming": ((Vector3)(ref basePosition))..ctor(-0.008f, -0.01f, -0.158f); baseScale = 0.37f; break; } root.localRotation = Quaternion.Euler(RunicHeldTuning.ApplyRotation(baseRotationEuler)); root.localPosition = RunicHeldTuning.ApplyOffset(basePosition); root.localScale = RunicHeldTuning.ApplyScale(baseScale); } private static GameObject AddVisual(Transform parent, string sourcePrefabName, string name, Vector3 localPosition, Vector3 localScale, Quaternion localRotation, string fallbackPrefabName = null) { //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Expected O, but got Unknown GameObject prefab = PrefabManager.Instance.GetPrefab(sourcePrefabName); if ((Object)(object)prefab == (Object)null && !string.IsNullOrEmpty(fallbackPrefabName)) { prefab = PrefabManager.Instance.GetPrefab(fallbackPrefabName); } if ((Object)(object)prefab == (Object)null) { return null; } Transform val = FindAttachmentAnchor(prefab.transform) ?? prefab.transform; Renderer val2 = FindLargestUsableRenderer(((Component)val).gameObject); if ((Object)(object)val2 == (Object)null && (Object)(object)val != (Object)(object)prefab.transform) { val2 = FindLargestUsableRenderer(prefab); } if ((Object)(object)val2 == (Object)null) { return null; } Mesh rendererMesh = GetRendererMesh(val2); if ((Object)(object)rendererMesh == (Object)null) { return null; } bool alignLongestAxisToY = name == "Post" || name == "Handle"; Mesh val3 = BuildCenteredMesh(rendererMesh, ((Component)val2).transform, val, alignLongestAxisToY); if ((Object)(object)val3 == (Object)null) { return null; } GameObject val4 = new GameObject("RU_" + name); val4.transform.SetParent(parent, false); val4.transform.localPosition = localPosition; val4.transform.localRotation = localRotation; val4.transform.localScale = localScale; val4.AddComponent<MeshFilter>().sharedMesh = val3; MeshRenderer obj = val4.AddComponent<MeshRenderer>(); ((Renderer)obj).sharedMaterials = val2.sharedMaterials; ((Renderer)obj).enabled = true; return val4; } private static Renderer FindLargestUsableRenderer(GameObject sourcePrefab) { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0050: 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_005f: Unknown result type (might be due to invalid IL or missing references) Renderer result = null; float num = -1f; Renderer[] componentsInChildren = sourcePrefab.GetComponentsInChildren<Renderer>(true); foreach (Renderer val in componentsInChildren) { if (!(val is MeshRenderer) && !(val is SkinnedMeshRenderer)) { continue; } Mesh rendererMesh = GetRendererMesh(val); if (!((Object)(object)rendererMesh == (Object)null)) { Bounds bounds = rendererMesh.bounds; Vector3 size = ((Bounds)(ref bounds)).size; float num2 = Mathf.Abs(size.x * size.y * size.z); if (num2 > num) { num = num2; result = val; } } } return result; } private static Mesh GetRendererMesh(Renderer renderer) { SkinnedMeshRenderer val = (SkinnedMeshRenderer)(object)((renderer is SkinnedMeshRenderer) ? renderer : null); if (val != null) { return val.sharedMesh; } MeshFilter component = ((Component)renderer).GetComponent<MeshFilter>(); if (!((Object)(object)component != (Object)null)) { return null; } return component.sharedMesh; } private static Mesh BuildCenteredMesh(Mesh sourceMesh, Transform rendererTransform, Transform sourceVisual, bool alignLongestAxisToY) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_022c: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_0235: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Unknown result type (might be due to invalid IL or missing references) //IL_0255: 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_0245: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_025e: Unknown result type (might be due to invalid IL or missing references) //IL_0265: 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_02c2: Unknown result type (might be due to invalid IL or missing references) //IL_02c9: Unknown result type (might be due to invalid IL or missing references) //IL_02d0: Unknown result type (might be due to invalid IL or missing references) //IL_02d7: Unknown result type (might be due to invalid IL or missing references) //IL_02a6: Unknown result type (might be due to invalid IL or missing references) //IL_02ad: Unknown result type (might be due to invalid IL or missing references) //IL_02b4: Unknown result type (might be due to invalid IL or missing references) //IL_02bb: Unknown result type (might be due to invalid IL or missing references) //IL_02dc: Unknown result type (might be due to invalid IL or missing references) //IL_02ef: Unknown result type (might be due to invalid IL or missing references) //IL_02f4: Unknown result type (might be due to invalid IL or missing references) //IL_0319: Unknown result type (might be due to invalid IL or missing references) //IL_0320: Unknown result type (might be due to invalid IL or missing references) //IL_0327: Unknown result type (might be due to invalid IL or missing references) //IL_032e: Unknown result type (might be due to invalid IL or missing references) //IL_02fd: Unknown result type (might be due to invalid IL or missing references) //IL_0304: Unknown result type (might be due to invalid IL or missing references) //IL_030b: Unknown result type (might be due to invalid IL or missing references) //IL_0312: Unknown result type (might be due to invalid IL or missing references) //IL_0333: Unknown result type (might be due to invalid IL or missing references) Mesh val = Object.Instantiate<Mesh>(sourceMesh); ((Object)val).name = "RU_Flattened_" + ((Object)sourceMesh).name; Vector3[] vertices = val.vertices; Matrix4x4 val2 = sourceVisual.worldToLocalMatrix * rendererTransform.localToWorldMatrix; for (int i = 0; i < vertices.Length; i++) { vertices[i] = ((Matrix4x4)(ref val2)).MultiplyPoint3x4(vertices[i]); } val.vertices = vertices; Vector3[] normals = val.normals; if (normals != null && normals.Length == vertices.Length) { Matrix4x4 inverse = ((Matrix4x4)(ref val2)).inverse; Matrix4x4 transpose = ((Matrix4x4)(ref inverse)).transpose; for (int j = 0; j < normals.Length; j++) { Vector3[] array = normals; int num = j; Vector3 val3 = ((Matrix4x4)(ref transpose)).MultiplyVector(normals[j]); array[num] = ((Vector3)(ref val3)).normalized; } val.normals = normals; } val.RecalculateBounds(); Bounds bounds = val.bounds; Vector3 center = ((Bounds)(ref bounds)).center; vertices = val.vertices; for (int k = 0; k < vertices.Length; k++) { ref Vector3 reference = ref vertices[k]; reference -= center; } val.vertices = vertices; val.RecalculateBounds(); bounds = val.bounds; Vector3 size = ((Bounds)(ref bounds)).size; float num2 = Mathf.Max(new float[3] { Mathf.Abs(size.x), Mathf.Abs(size.y), Mathf.Abs(size.z) }); if (num2 > 0.0001f) { float num3 = 1f / num2; vertices = val.vertices; for (int l = 0; l < vertices.Length; l++) { ref Vector3 reference2 = ref vertices[l]; reference2 *= num3; } val.vertices = vertices; val.RecalculateBounds(); } bounds = val.bounds; Vector3 center2 = ((Bounds)(ref bounds)).center; if (((Vector3)(ref center2)).sqrMagnitude > 1E-07f) { vertices = val.vertices; for (int m = 0; m < vertices.Length; m++) { ref Vector3 reference3 = ref vertices[m]; reference3 -= center2; } val.vertices = vertices; val.RecalculateBounds(); } if (alignLongestAxisToY) { bounds = val.bounds; Vector3 size2 = ((Bounds)(ref bounds)).size; int num4 = ((!(size2.x >= size2.y) || !(size2.x >= size2.z)) ? ((!(size2.z >= size2.x) || !(size2.z >= size2.y)) ? 1 : 2) : 0); if (num4 != 1) { vertices = val.vertices; normals = val.normals; for (int n = 0; n < vertices.Length; n++) { Vector3 val4 = vertices[n]; vertices[n] = ((num4 == 0) ? new Vector3(val4.y, val4.x, val4.z) : new Vector3(val4.x, val4.z, val4.y)); if (normals != null && normals.Length == vertices.Length) { Vector3 val5 = normals[n]; normals[n] = ((num4 == 0) ? new Vector3(val5.y, val5.x, val5.z) : new Vector3(val5.x, val5.z, val5.y)); } } val.vertices = vertices; if (normals != null && normals.Length == vertices.Length) { val.normals = normals; } val.RecalculateBounds(); } } return val; } private static void StripNonVisualComponents(GameObject visual) { Collider[] componentsInChildren = visual.GetComponentsInChildren<Collider>(true); for (int i = 0; i < componentsInChildren.Length; i++) { Object.DestroyImmediate((Object)(object)componentsInChildren[i]); } Rigidbody[] componentsInChildren2 = visual.GetComponentsInChildren<Rigidbody>(true); for (int i = 0; i < componentsInChildren2.Length; i++) { Object.DestroyImmediate((Object)(object)componentsInChildren2[i]); } MonoBehaviour[] componentsInChildren3 = visual.GetComponentsInChildren<MonoBehaviour>(true); for (int i = 0; i < componentsInChildren3.Length; i++) { Object.DestroyImmediate((Object)(object)componentsInChildren3[i]); } Component[] componentsInChildren4 = visual.GetComponentsInChildren<Component>(true); foreach (Component val in componentsInChildren4) { if ((Object)(object)val == (Object)null) { continue; } switch (((object)val).GetType().Name) { case "Light": case "ParticleSystem": case "ParticleSystemRenderer": case "TrailRenderer": case "LineRenderer": case "Projector": { Behaviour val2 = (Behaviour)(object)((val is Behaviour) ? val : null); if ((Object)(object)val2 != (Object)null) { val2.enabled = false; } if ((Object)(object)val.transform != (Object)(object)visual.transform) { val.gameObject.SetActive(false); } break; } } } } private static void EnableRenderers(GameObject visual) { Renderer[] componentsInChildren = visual.GetComponentsInChildren<Renderer>(true); foreach (Renderer obj in componentsInChildren) { obj.enabled = true; ((Component)obj).gameObject.SetActive(true); } } private static void AttachRuneParts(Transform root) { //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0147: 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_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)root == (Object)null) { return; } Transform val = FindDirectChild(root, "RU_Handle") ?? FindDirectChild(root, "RU_Axe") ?? FindDirectChild(root, "RU_Hoe") ?? FindDirectChild(root, "RU_Hammer"); if ((Object)(object)val == (Object)null && root.childCount > 0) { val = root.GetChild(0); } if ((Object)(object)val == (Object)null || !TryGetBoundsInRoot(val, root, out var bounds)) { return; } Vector3 val2 = default(Vector3); for (int i = 0; i < root.childCount; i++) { Transform child = root.GetChild(i); if (!((Object)(object)child == (Object)null) && !((Object)(object)child == (Object)(object)val) && TryGetBoundsInRoot(child, root, out var bounds2)) { float num = ((((Object)child).name.IndexOf("Grip", StringComparison.OrdinalIgnoreCase) >= 0 || ((Object)child).name.IndexOf("Leather", StringComparison.OrdinalIgnoreCase) >= 0 || ((Object)child).name.IndexOf("Wrap", StringComparison.OrdinalIgnoreCase) >= 0) ? 0.3f : 0.76f); float num2 = Mathf.Clamp(child.localPosition.x, -0.07f, 0.07f); ((Vector3)(ref val2))..ctor(((Bounds)(ref bounds)).center.x + num2, Mathf.Lerp(((Bounds)(ref bounds)).min.y, ((Bounds)(ref bounds)).max.y, num), ((Bounds)(ref bounds)).center.z - ((Bounds)(ref bounds)).extents.z * 0.3f); child.localPosition += val2 - ((Bounds)(ref bounds2)).center; } } } private static void StackOnTop(Transform moving, Transform target, Transform root, float overlap) { //IL_0037: 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_004f: 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_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)moving == (Object)null) && !((Object)(object)target == (Object)null) && !((Object)(object)root == (Object)null) && TryGetBoundsInRoot(moving, root, out var bounds) && TryGetBoundsInRoot(target, root, out var bounds2)) { Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(((Bounds)(ref bounds2)).center.x, ((Bounds)(ref bounds2)).max.y + ((Bounds)(ref bounds)).extents.y - overlap, ((Bounds)(ref bounds2)).center.z); moving.localPosition += val - ((Bounds)(ref bounds)).center; } } private static void MountOnFront(Transform moving, Transform target, Transform root, float heightFraction, float overlap) { //IL_0037: 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_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)moving == (Object)null) && !((Object)(object)target == (Object)null) && !((Object)(object)root == (Object)null) && TryGetBoundsInRoot(moving, root, out var bounds) && TryGetBoundsInRoot(target, root, out var bounds2)) { Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(((Bounds)(ref bounds2)).center.x, Mathf.Lerp(((Bounds)(ref bounds2)).min.y, ((Bounds)(ref bounds2)).max.y, Mathf.Clamp01(heightFraction)), ((Bounds)(ref bounds2)).min.z - ((Bounds)(ref bounds)).extents.z + overlap); moving.localPosition += val - ((Bounds)(ref bounds)).center; } } private static void AttachTotemParts(Transform root) { if ((Object)(object)root == (Object)null) { return; } Transform val = FindDirectChild(root, "RU_Base"); Transform val2 = FindDirectChild(root, "RU_Post"); if ((Object)(object)val == (Object)null || (Object)(object)val2 == (Object)null) { return; } SnapBoundsIntoContact(val2, val, root, 0.025f); for (int i = 0; i < root.childCount; i++) { Transform child = root.GetChild(i); if (!((Object)(object)child == (Object)null) && !((Object)(object)child == (Object)(object)val) && !((Object)(object)child == (Object)(object)val2)) { SnapBoundsIntoContact(child, val2, root, 0.022f); } } } private static Transform FindDirectChild(Transform root, string childName) { if ((Object)(object)root == (Object)null) { return null; } for (int i = 0; i < root.childCount; i++) { Transform child = root.GetChild(i); if ((Object)(object)child != (Object)null && string.Equals(((Object)child).name, childName, StringComparison.Ordinal)) { return child; } } return null; } private static void SnapBoundsIntoContact(Transform moving, Transform target, Transform root, float overlap) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: 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_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_007a: 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_0092: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: 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_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: 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) if (!((Object)(object)moving == (Object)null) && !((Object)(object)target == (Object)null) && !((Object)(object)root == (Object)null) && TryGetBoundsInRoot(moving, root, out var bounds) && TryGetBoundsInRoot(target, root, out var bounds2)) { Vector3 zero = Vector3.zero; zero.x = AxisContactShift(((Bounds)(ref bounds)).min.x, ((Bounds)(ref bounds)).max.x, ((Bounds)(ref bounds2)).min.x, ((Bounds)(ref bounds2)).max.x, overlap); zero.y = AxisContactShift(((Bounds)(ref bounds)).min.y, ((Bounds)(ref bounds)).max.y, ((Bounds)(ref bounds2)).min.y, ((Bounds)(ref bounds2)).max.y, overlap); zero.z = AxisContactShift(((Bounds)(ref bounds)).min.z, ((Bounds)(ref bounds)).max.z, ((Bounds)(ref bounds2)).min.z, ((Bounds)(ref bounds2)).max.z, overlap); moving.localPosition += zero; } } private static float AxisContactShift(float movingMin, float movingMax, float targetMin, float targetMax, float overlap) { if (movingMin > targetMax) { return targetMax - movingMin + overlap; } if (movingMax < targetMin) { return targetMin - movingMax - overlap; } return 0f; } private static bool TryGetBoundsInRoot(Transform part, Transform root, out Bounds bounds) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) bounds = default(Bounds); if ((Object)(object)part == (Object)null || (Object)(object)root == (Object)null) { return false; } MeshFilter component = ((Component)part).GetComponent<MeshFilter>(); if ((Object)(object)component == (Object)null || (Object)(object)component.sharedMesh == (Object)null) { return false; } Bounds bounds2 = component.sharedMesh.bounds; Matrix4x4 val = root.worldToLocalMatrix * part.localToWorldMatrix; Vector3 min = ((Bounds)(ref bounds2)).min; Vector3 max = ((Bounds)(ref bounds2)).max; bool flag = false; Vector3 val2 = default(Vector3); for (int i = 0; i < 2; i++) { for (int j = 0; j < 2; j++) { for (int k = 0; k < 2; k++) { ((Vector3)(ref val2))..ctor((i == 0) ? min.x : max.x, (j == 0) ? min.y : max.y, (k == 0) ? min.z : max.z); Vector3 val3 = ((Matrix4x4)(ref val)).MultiplyPoint3x4(val2); if (!flag) { bounds = new Bounds(val3, Vector3.zero); flag = true; } else { ((Bounds)(ref bounds)).Encapsulate(val3); } } } } return flag; } private static Transform FindAttachmentAnchor(Transform root) { if ((Object)(object)root == (Object)null) { return null; } for (int i = 0; i < root.childCount; i++) { Transform child = root.GetChild(i); if ((Object)(object)child != (Object)null && string.Equals(((Object)child).name, "attach", StringComparison.OrdinalIgnoreCase)) { return child; } Transform val = FindAttachmentAnchor(child); if ((Object)(object)val != (Object)null) { return val; } } return null; } private static Transform CreateVisualRoot(Transform parent, string name) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) Transform val = parent.Find(name); if ((Object)(object)val != (Object)null) { Object.DestroyImmediate((Object)(object)((Component)val).gameObject); } GameObject val2 = new GameObject(name); val2.transform.SetParent(parent, false); val2.transform.localPosition = Vector3.zero; val2.transform.localRotation = Quaternion.identity; val2.transform.localScale = Vector3.one; return val2.transform; } private static void HideOriginalRenderers(GameObject prefab) { Renderer[] componentsInChildren = prefab.GetComponentsInChildren<Renderer>(true); foreach (Renderer val in componentsInChildren) { if ((Object)(object)val != (Object)null && !((Object)((Component)val).transform).name.StartsWith("RU_", StringComparison.Ordinal)) { val.enabled = false; } } } internal static void DisableInheritedWardVisualEffects(GameObject prefab) { if ((Object)(object)prefab == (Object)null) { return; } Component[] componentsInChildren = prefab.GetComponentsInChildren<Component>(true); foreach (Component val in componentsInChildren) { if ((Object)(object)val == (Object)null) { continue; } string name = ((object)val).GetType().Name; switch (name) { default: if (!(name == "LineRenderer")) { continue; } break; case "Light": case "ParticleSystem": case "ParticleSystemRenderer": case "Projector": case "TrailRenderer": break; } Behaviour val2 = (Behaviour)(object)((val is Behaviour) ? val : null); if ((Object)(object)val2 != (Object)null) { val2.enabled = false; } if ((Object)(object)val.transform != (Object)(object)prefab.transform && !((Object)val.transform).name.StartsWith("RU_", StringComparison.Ordinal)) { val.gameObject.SetActive(false); } } } } internal sealed class RunicPulse : MonoBehaviour { private float _created; private float _duration; private Vector3 _startScale; private Vector3 _endScale; private Renderer _renderer; private Color _color; internal static void Spawn(Vector3 position, Color color, float duration = 0.65f, float radius = 3f) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0047: 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_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_016d: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Expected O, but got Unknown //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: 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_0107: 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) GameObject val = GameObject.CreatePrimitive((PrimitiveType)0); ((Object)val).name = "RU_CastPulse"; val.transform.position = position + Vector3.up * 0.08f; val.transform.localScale = new Vector3(0.18f, 0.025f, 0.18f); Collider component = val.GetComponent<Collider>(); if ((Object)(object)component != (Object)null) { Object.Destroy((Object)(object)component); } Renderer component2 = val.GetComponent<Renderer>(); if ((Object)(object)component2 != (Object)null) { Shader val2 = Shader.Find("Sprites/Default") ?? Shader.Find("GUI/Text Shader") ?? Shader.Find("Standard"); if ((Object)(object)val2 != (Object)null) { Material val3 = new Material(val2); if (val3.HasProperty("_Color")) { val3.color = new Color(color.r, color.g, color.b, 0.72f); } if (val3.HasProperty("_EmissionColor")) { val3.EnableKeyword("_EMISSION"); val3.SetColor("_EmissionColor", color * 1.2f); } component2.material = val3; } } RunicPulse runicPulse = val.AddComponent<RunicPulse>(); runicPulse._created = Time.time; runicPulse._duration = Mathf.Max(0.15f, duration); runicPulse._startScale = val.transform.localScale; runicPulse._endScale = new Vector3(radius, 0.04f, radius); runicPulse._renderer = component2; runicPulse._color = color; Object.Destroy((Object)(object)val, runicPulse._duration + 0.1f); } private void Update() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Clamp01((Time.time - _created) / _duration); ((Component)this).transform.localScale = Vector3.Lerp(_startScale, _endScale, num); if ((Object)(object)_renderer != (Object)null && (Object)(object)_renderer.material != (Object)null && _renderer.material.HasProperty("_Color")) { Color color = _color; color.a = Mathf.Lerp(0.65f, 0f, num); _renderer.material.color = color; } } } internal static class RunicVfx { internal static readonly Color Meadows = new Color(0.66f, 0.95f, 0.24f, 1f); internal static readonly Color Forest = new Color(0.12f, 0.9f, 0.96f, 1f); internal static readonly Color Swamp = new Color(0.3f, 0.78f, 0.36f, 1f); internal static readonly Color Mountain = new Color(0.48f, 0.82f, 1f, 1f); internal static readonly Color Warmth = new Color(1f, 0.33f, 0.06f, 1f); internal static readonly Color Plains = new Color(1f, 0.63f, 0.13f, 1f); } } namespace RunicUtilities.Utility { internal static class AxeTierResolver { internal static bool TryGetBestUsableAxe(Player player, out int toolTier) { //IL_0040: Unknown result type (might be due to invalid IL or missing references) toolTier = -1; if ((Object)(object)player == (Object)null || ((Humanoid)player).GetInventory() == null) { return false; } foreach (ItemData allItem in ((Humanoid)player).GetInventory().GetAllItems()) { if (allItem?.m_shared != null && !(allItem.GetDamage().m_chop <= 0f) && (!allItem.m_shared.m_useDurability || !(allItem.m_durability <= 0.01f)) && allItem.m_shared.m_toolTier > toolTier) { toolTier = allItem.m_shared.m_toolTier; } } return toolTier >= 0; } } internal static class CooldownTracker { private static readonly Dictionary<string, float> ReadyAt = new Dictionary<string, float>(); internal static bool IsReady(string key, out float secondsRemaining) { secondsRemaining = 0f; if (!ReadyAt.TryGetValue(key, out var value)) { return true; } secondsRemaining = value - Time.time; return secondsRemaining <= 0f; } internal static void Start(string key, float seconds) { ReadyAt[key] = Time.time + Mathf.Max(0f, seconds); } } internal static class MineableClassifier { private static readonly HashSet<string> KnownOreDrops = new HashSet<string>(StringComparer.OrdinalIgnoreCase) { "CopperOre", "TinOre", "IronScrap", "SilverOre", "Obsidian", "FlametalOreNew", "CopperScrap", "BlackMarble", "Softtissue" }; internal static bool IsOreMineRock(MineRock rock) { if ((Object)(object)rock != (Object)null) { return DropTableContainsOre(rock.m_dropItems); } return false; } internal static bool IsOreMineRock(MineRock5 rock) { if ((Object)(object)rock != (Object)null) { return DropTableContainsOre(rock.m_dropItems); } return false; } internal static bool IsOreDestructible(Destructible destructible) { if ((Object)(object)destructible == (Object)null) { return false; } DropOnDestroyed component = ((Component)destructible).GetComponent<DropOnDestroyed>(); if ((Object)(object)component != (Object)null && DropTableContainsOre(component.m_dropWhenDestroyed)) { return true; } GameObject spawnWhenDestroyed = destructible.m_spawnWhenDestroyed; if ((Object)(object)spawnWhenDestroyed == (Object)null) { return false; } MineRock component2 = spawnWhenDestroyed.GetComponent<MineRock>(); if ((Object)(object)component2 != (Object)null && IsOreMineRock(component2)) { return true; } MineRock5 component3 = spawnWhenDestroyed.GetComponent<MineRock5>(); if ((Object)(object)component3 != (Object)null) { return IsOreMineRock(component3); } return false; } internal static bool IsNaturalMineable(Destructible destructible) { if ((Object)(object)destructible == (Object)null || (Object)(object)((Component)destructible).GetComponent<Piece>() != (Object)null) { return false; } if (IsOreDestructible(destructible)) { return true; } DropOnDestroyed component = ((Component)destructible).GetComponent<DropOnDestroyed>(); if ((Object)(object)component != (Object)null) { return DropTableContainsStone(component.m_dropWhenDestroyed); } return false; } private static bool DropTableContainsOre(DropTable table) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) if (table?.m_drops == null) { return false; } foreach (DropData drop in table.m_drops) { GameObject item = drop.m_item; if (!((Object)(object)item == (Object)null)) { string prefabName = PrefabNameUtility.GetPrefabName(item); if (KnownOreDrops.Contains(prefabName) || LooksLikeModdedOre(prefabName)) { return true; } } } return false; } private static bool DropTableContainsStone(DropTable table) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) if (table?.m_drops == null) { return false; } foreach (DropData drop in table.m_drops) { if ((Object)(object)drop.m_item != (Object)null && PrefabNameUtility.GetPrefabName(drop.m_item) == "Stone") { return true; } } return false; } private static bool LooksLikeModdedOre(string prefabName) { if (string.IsNullOrEmpty(prefabName)) { return false; } string text = prefabName.ToLowerInvariant(); if (!text.EndsWith("ore") && !text.Contains("ore_") && !text.Contains("_ore") && !text.Contains("orescrap")) { return text.Contains("scrapore"); } return true; } } internal static class PickaxeTierResolver { internal static bool TryGetBestUsablePickaxe(Player player, out int toolTier) { //IL_0040: Unknown result type (might be due to invalid IL or missing references) toolTier = -1; if ((Object)(object)player == (Object)null || ((Humanoid)player).GetInventory() == null) { return false; } foreach (ItemData allItem in ((Humanoid)player).GetInventory().GetAllItems()) { if (allItem?.m_shared != null && !(allItem.GetDamage().m_pickaxe <= 0f) && (!allItem.m_shared.m_useDurability || !(allItem.m_durability <= 0.01f)) && allItem.m_shared.m_toolTier > toolTier) { toolTier = allItem.m_shared.m_toolTier; } } return toolTier >= 0; } } internal static class PrefabNameUtility { internal static string GetPrefabName(GameObject gameObject) { if (!((Object)(object)gameObject == (Object)null)) { return GetPrefabName(((Object)gameObject).name); } return string.Empty; } internal static string GetPrefabName(string objectName) { if (string.IsNullOrEmpty(objectName)) { return string.Empty; } int num = objectName.IndexOf('('); int num2 = objectName.IndexOf(' '); int num3 = -1; if (num >= 0 && num2 >= 0) { num3 = ((num < num2) ? num : num2); } else if (num >= 0) { num3 = num; } else if (num2 >= 0) { num3 = num2; } if (num3 >= 0) { return objectName.Substring(0, num3); } return objectName; } } internal static class ReflectionUtility { internal static bool TryInvokeDamage(Component target, HitData hit) { if ((Object)(object)target == (Object)null || hit == null) { return false; } MethodInfo methodInfo = AccessTools.Method(((object)target).GetType(), "Damage", new Type[1] { typeof(HitData) }, (Type[])null); if (methodInfo == null) { return false; } methodInfo.Invoke(target, new object[1] { hit }); return true; } internal static bool TryInteract(Component target, Humanoid user) { if ((Object)(object)target == (Object)null || (Object)(object)user == (Object)null) { return false; } MethodInfo[] methods = ((object)target).GetType().GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); bool flag = default(bool); bool flag2 = default(bool); foreach (MethodInfo methodInfo in methods) { if (methodInfo.Name != "Interact") { continue; } ParameterInfo[] parameters = methodInfo.GetParameters(); try { if (parameters.Length == 3 && typeof(Humanoid).IsAssignableFrom(parameters[0].ParameterType) && parameters[1].ParameterType == typeof(bool) && parameters[2].ParameterType == typeof(bool)) { object obj = methodInfo.Invoke(target, new object[3] { user, false, false }); int num; if (obj is bool) { flag = (bool)obj; num = ((1 == 0) ? 1 : 0); } else { num = 1; } return (byte)((uint)num | (flag ? 1u : 0u)) != 0; } if (parameters.Length == 2 && typeof(Humanoid).IsAssignableFrom(parameters[0].ParameterType) && parameters[1].ParameterType == typeof(bool)) { object obj2 = methodInfo.Invoke(target, new object[2] { user, false }); int num2; if (obj2 is bool) { flag2 = (bool)obj2; num2 = ((1 == 0) ? 1 : 0); } else { num2 = 1; } return (byte)((uint)num2 | (flag2 ? 1u : 0u)) != 0; } } catch { } } return false; } internal static object GetFieldOrProperty(object instance, string name) { if (instance == null) { return null; } Type type = instance.GetType(); FieldInfo fieldInfo = AccessTools.Field(type, name); if (fieldInfo != null) { return fieldInfo.GetValue(instance); } return AccessTools.Property(type, name)?.GetValue(instance, null); } internal static bool SetFieldOrProperty(object instance, string name, object value) { if (instance == null) { return false; } Type type = instance.GetType(); FieldInfo fieldInfo = AccessTools.Field(type, name); if (fieldInfo != null) { fieldInfo.SetValue(instance, value); return true; } PropertyInfo propertyInfo = AccessTools.Property(type, name); if (propertyInfo != null && propertyInfo.CanWrite) { propertyInfo.SetValue(instance, value, null); return true; } return false; } internal static bool TryCallPlayerTeleport(Player player, Vector3 destination, Quaternion rotation) { //IL_005d: 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_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)player == (Object)null) { return false; } MethodInfo methodInfo = AccessTools.Method(((object)player).GetType(), "TeleportTo", new Type[3] { typeof(Vector3), typeof(Quaternion), typeof(bool) }, (Type[])null); if (methodInfo != null) { methodInfo.Invoke(player, new object[3] { destination, rotation, true }); return true; } methodInfo = AccessTools.Method(((object)player).GetType(), "TeleportTo", new Type[2] { typeof(Vector3), typeof(Quaternion) }, (Type[])null); if (methodInfo != null) { methodInfo.Invoke(player, new object[2] { destination, rotation }); return true; } return false; } internal static bool TryGetPlayerSpawnPoint(Player player, out Vector3 point) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_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_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0144: 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_0197: 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_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) point = Vector3.zero; if ((Object)(object)player == (Object)null) { return false; } string[] array = new string[2] { "GetSpawnPoint", "GetCustomSpawnPoint" }; foreach (string text in array) { MethodInfo methodInfo = AccessTools.Method(((object)player).GetType(), text, Type.EmptyTypes, (Type[])null); if (methodInfo != null && methodInfo.ReturnType == typeof(Vector3)) { point = (Vector3)methodInfo.Invoke(player, null); if (point != Vector3.zero) { return true; } } } object instance = Game.instance; if (instance != null) { object obj = AccessTools.Method(instance.GetType(), "GetPlayerProfile", Type.EmptyTypes, (Type[])null)?.Invoke(instance, null); if (obj != null) { array = new string[2] { "GetCustomSpawnPoint", "GetSpawnPoint" }; foreach (string text2 in array) { MethodInfo methodInfo2 = AccessTools.Method(obj.GetType(), text2, Type.EmptyTypes, (Type[])null); if (methodInfo2 != null && methodInfo2.ReturnType == typeof(Vector3)) { point = (Vector3)methodInfo2.Invoke(obj, null); if (point != Vector3.zero) { return true; } } } array = new string[2] { "m_customSpawnPoint", "m_spawnPoint" }; foreach (string name in array) { if (GetFieldOrProperty(obj, name) is Vector3 val && val != Vector3.zero) { point = val; return true; } } } } return false; } internal static bool HasNonTeleportableItems(Player player) { if (((player != null) ? ((Humanoid)player).GetInventory() : null) == null) { return false; } foreach (ItemData allItem in ((Humanoid)player).GetInventory().GetAllItems()) { if (allItem?.m_shared != null && !allItem.m_shared.m_teleportable) { return true; } } return false; } internal static void RemoveColdAndFreezing(Player player) { RemoveStatusEffectsByName(player, "Cold", "Freezing", "$se_cold", "$se_freezing"); } internal static bool IsColdOrFreezing(StatusEffect effect) { if ((Object)(object)effect == (Object)null) { return false; } if (!IsColdOrFreezingName(((Object)effect).name)) { return IsColdOrFreezingName(effect.m_name); } return true; } internal static bool IsColdOrFreezingHash(int nameHash) { return IsColdOrFreezing(GetStatusEffectByHash(nameHash)); } private static bool IsColdOrFreezingName(string value) { if (string.IsNullOrEmpty(value)) { return false; } string text = value.ToLowerInvariant(); if (!text.Contains("freez")) { return text.Contains("cold"); } return true; } internal static StatusEffect GetStatusEffectByHash(int nameHash) { object instance = ObjectDB.instance; if (instance == null) { return null; } object? obj = AccessTools.Method(instance.GetType(), "GetStatusEffect", new Type[1] { typeof(int) }, (Type[])null)?.Invoke(instance, new object[1] { nameHash }); return (StatusEffect)((obj is StatusEffect) ? obj : null); } internal static void RemoveStatusEffectsByName(Player player, params string[] names) { if ((Object)(object)player == (Object)null) { return; } object fieldOrProperty = GetFieldOrProperty(player, "m_seman"); if (fieldOrProperty == null || !(GetFieldOrProperty(fieldOrProperty, "m_statusEffects") is IList list)) { return; } List<StatusEffect> list2 = new List<StatusEffect>(); for (int i = 0; i < list.Count; i++) { object? obj = list[i]; StatusEffect val = (StatusEffect)((obj is StatusEffect) ? obj : null); if (val == null) { continue; } bool flag = false; foreach (string text in names) { if (!string.IsNullOrEmpty(text) && (string.Equals(((Object)val).name, text, StringComparison.OrdinalIgnoreCase) || string.Equals(val.m_name, text, StringComparison.OrdinalIgnoreCase) || (!string.IsNullOrEmpty(((Object)val).name) && ((Object)val).name.IndexOf(text, StringComparison.OrdinalIgnoreCase) >= 0) || (!string.IsNullOrEmpty(val.m_name) && val.m_name.IndexOf(text, StringComparison.OrdinalIgnoreCase) >= 0))) { flag = true; break; } } if (flag) { list2.Add(val); } } foreach (StatusEffect item in list2) { if (!TryRemoveStatusEffect(fieldOrProperty, item)) { list.Remove(item); } } } private static bool TryRemoveStatusEffect(object seman, StatusEffect effect) { if (seman == null || (Object)(object)effect == (Object)null) { return false; } MethodInfo[] methods = seman.GetType().GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); foreach (MethodInfo methodInfo in methods) { if (methodInfo.Name != "RemoveStatusEffect") { continue; } ParameterInfo[] parameters = methodInfo.GetParameters(); try { if (parameters.Length == 2 && parameters[0].ParameterType == typeof(StatusEffect) && parameters[1].ParameterType == typeof(bool)) { methodInfo.Invoke(seman, new object[2] { effect, true }); return true; } if (parameters.Length == 2 && parameters[0].ParameterType == typeof(int) && parameters[1].ParameterType == typeof(bool)) { methodInfo.Invoke(seman, new object[2] { effect.NameHash(), true }); return true; } if (parameters.Length == 1 && parameters[0].ParameterType == typeof(StatusEffect)) { methodInfo.Invoke(seman, new object[1] { effect }); return true; } if (parameters.Length == 1 && parameters[0].ParameterType == typeof(int)) { methodInfo.Invoke(seman, new object[1] { effect.NameHash() }); return true; } } catch { } } return false; } internal static bool TryApplyStatusEffect(Player player, StatusEffect effect) { if ((Object)(object)player == (Object)null || (Object)(object)effect == (Object)null) { return false; } object fieldOrProperty = GetFieldOrProperty(player, "m_seman"); if (fieldOrProperty == null) { return false; } MethodInfo[] methods = fieldOrProperty.GetType().GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); foreach (MethodInfo methodInfo in methods) { if (methodInfo.Name != "AddStatusEffect") { continue; } ParameterInfo[] parameters = methodInfo.GetParameters(); try { if (parameters.Length == 5 && parameters[0].ParameterType == typeof(StatusEffect)) { methodInfo.Invoke(fieldOrProperty, new object[5] { effect, true, 0, 0f, (short)(-1) }); return true; } if (parameters.Length == 4 && parameters[0].ParameterType == typeof(StatusEffect)) { methodInfo.Invoke(fieldOrProperty, new object[4] { effect, true, 0, 0f }); return true; } if (parameters.Length == 2 && parameters[0].ParameterType == typeof(StatusEffect) && parameters[1].ParameterType == typeof(bool)) { methodInfo.Invoke(fieldOrProperty, new object[2] { effect, true }); return true; } if (parameters.Length == 1 && parameters[0].ParameterType == typeof(StatusEffect)) { methodInfo.Invoke(fieldOrProperty, new object[1] { effect }); return true; } } catch { } } return false; } } } namespace RunicUtilities.Totems { internal enum RunicTotemEffect { Fleetfoot, Windstep, Warmth, Frostwalker, Sorting } internal sealed class RunicTotemInteract : MonoBehaviour, Hoverable, Interactable { [SerializeField] private RunicTotemEffect effect; internal RunicTotemEffect Effect { get { return effect; } set { effect = value; } } private void Awake() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) RecoverEffectFromPrefabName(); RunicTotemRegistrar.ApplyWardGlowTint(((Component)this).gameObject, RunicTotemRegistrar.GetGlowColor(effect)); RunicTotemRegistrar.DisableAmbientWardEffects(((Component)this).gameObject); } private void OnEnable() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) RecoverEffectFromPrefabName(); RunicTotemRegistrar.ApplyWardGlowTint(((Component)this).gameObject, RunicTotemRegistrar.GetGlowColor(effect)); RunicTotemRegistrar.DisableAmbientWardEffects(((Component)this).gameObject); } private void RecoverEffectFromPrefabName() { switch (PrefabNameUtility.GetPrefabName(((Component)this).gameObject)) { case "RU_FrostwalkerTotem": effect = RunicTotemEffect.Frostwalker; break; case "RU_SortingTotem": effect = RunicTotemEffect.Sorting; break; case "RU_WindstepTotem": effect = RunicTotemEffect.Windstep; break; case "RU_WarmthTotem": effect = RunicTotemEffect.Warmth; break; case "RU_FleetfootTotem": effect = RunicTotemEffect.Fleetfoot; break; } } public string GetHo