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 Statues v1.0.0
plugins/RavenwoodRelicsStatues/RavenwoodRelicsStatues.dll
Decompiled a day agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using Jotunn.Configs; using Jotunn.Entities; using Jotunn.Managers; using UnityEngine; using UnityEngine.Animations; using UnityEngine.Playables; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("0.0.0.0")] namespace RavenwoodRelicsStatues; public class DarkAngelStatueInteract : MonoBehaviour, Hoverable, Interactable { private const string RpcName = "RWS_PlayDarkAngelAnimation"; private const string InteractionObjectName = "Interaction"; private static AnimationClip sharedAnimationClip; private static Object sharedSoundAsset; private AnimationClip animationClip; private Object soundAsset; private Animator animator; private ZNetView netView; private PlayableGraph playableGraph; private Coroutine stopRoutine; private GameObject activeSoundObject; public void SetAnimationClip(AnimationClip clip) { animationClip = clip; if ((Object)(object)clip != (Object)null) { sharedAnimationClip = clip; } } public void SetSoundAsset(Object asset) { soundAsset = asset; if (asset != (Object)null) { sharedSoundAsset = asset; } } private void Awake() { if ((Object)(object)animationClip == (Object)null) { animationClip = sharedAnimationClip; } if (soundAsset == (Object)null) { soundAsset = sharedSoundAsset; } netView = ((Component)this).GetComponent<ZNetView>(); animator = ResolveAnimator(); EnsureInteractionProxy(); if ((Object)(object)netView != (Object)null) { netView.Register("RWS_PlayDarkAngelAnimation", (Action<long>)RPC_PlayAnimation); } } public string GetHoverName() { return "The Dark Angel Statue"; } public string GetHoverText() { return "The Dark Angel Statue\n[<color=yellow><b>E</b></color>] Animate"; } public bool Interact(Humanoid user, bool hold, bool alt) { if (hold) { return false; } if ((Object)(object)animationClip == (Object)null) { animationClip = sharedAnimationClip; } if ((Object)(object)animationClip == (Object)null) { return false; } if ((Object)(object)netView != (Object)null && netView.IsValid()) { netView.InvokeRPC(ZNetView.Everybody, "RWS_PlayDarkAngelAnimation", Array.Empty<object>()); } else { PlayAnimation(); } return true; } public bool UseItem(Humanoid user, ItemData item) { return false; } private void RPC_PlayAnimation(long sender) { PlayAnimation(); } private void PlayAnimation() { //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0093: 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_00a3: 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_00b4: 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_00c5: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)animationClip == (Object)null) { animationClip = sharedAnimationClip; } if (!((Object)(object)animationClip == (Object)null)) { animator = ResolveAnimator(); if (!((Object)(object)animator == (Object)null)) { StopCurrentAnimation(); playableGraph = PlayableGraph.Create("RWS_DarkAngel_Animation"); ((PlayableGraph)(ref playableGraph)).SetTimeUpdateMode((DirectorUpdateMode)1); AnimationPlayableOutput val = AnimationPlayableOutput.Create(playableGraph, "DarkAngelOutput", animator); AnimationClipPlayable val2 = AnimationClipPlayable.Create(playableGraph, animationClip); PlayableExtensions.SetTime<AnimationClipPlayable>(val2, 0.0); PlayableExtensions.SetSpeed<AnimationClipPlayable>(val2, 1.0); PlayableOutputExtensions.SetSourcePlayable<AnimationPlayableOutput, AnimationClipPlayable>(val, val2); ((PlayableGraph)(ref playableGraph)).Play(); ((PlayableGraph)(ref playableGraph)).Evaluate(0f); PlaySound(); stopRoutine = ((MonoBehaviour)this).StartCoroutine(StopAfter(animationClip.length)); } } } private void PlaySound() { //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_025d: Expected O, but got Unknown //IL_026e: Unknown result type (might be due to invalid IL or missing references) if (soundAsset == (Object)null) { soundAsset = sharedSoundAsset; } if (soundAsset == (Object)null) { return; } StopCurrentSound(); Type type = Type.GetType("UnityEngine.AudioSource, UnityEngine.AudioModule"); if (type == null) { return; } Object obj = soundAsset; GameObject val = (GameObject)(object)((obj is GameObject) ? obj : null); if (val != null) { activeSoundObject = Object.Instantiate<GameObject>(val, ((Component)this).transform.position, Quaternion.identity); ((Object)activeSoundObject).name = "sfx_RWS_The_Dark_Angel_Statue"; bool flag = false; Transform[] componentsInChildren = activeSoundObject.GetComponentsInChildren<Transform>(true); Transform[] array = componentsInChildren; foreach (Transform val2 in array) { if (!((Object)(object)val2 == (Object)null)) { Component component = ((Component)val2).GetComponent(type); if (!((Object)(object)component == (Object)null)) { type.GetProperty("playOnAwake")?.SetValue(component, false, null); type.GetProperty("loop")?.SetValue(component, false, null); type.GetProperty("volume")?.SetValue(component, 1f, null); type.GetProperty("spatialBlend")?.SetValue(component, 1f, null); type.GetProperty("minDistance")?.SetValue(component, 1f, null); type.GetProperty("maxDistance")?.SetValue(component, 25f, null); type.GetMethod("Play", Type.EmptyTypes)?.Invoke(component, null); flag = true; } } } if (!flag) { StopCurrentSound(); } return; } Type type2 = Type.GetType("UnityEngine.AudioClip, UnityEngine.AudioModule"); if (type2 == null || !type2.IsInstanceOfType(soundAsset)) { return; } activeSoundObject = new GameObject("sfx_RWS_The_Dark_Angel_Statue"); activeSoundObject.transform.position = ((Component)this).transform.position; activeSoundObject.transform.SetParent(((Component)this).transform, true); Component val3 = activeSoundObject.AddComponent(type); if ((Object)(object)val3 == (Object)null) { StopCurrentSound(); return; } type.GetProperty("clip")?.SetValue(val3, soundAsset, null); type.GetProperty("playOnAwake")?.SetValue(val3, false, null); type.GetProperty("loop")?.SetValue(val3, false, null); type.GetProperty("volume")?.SetValue(val3, 1f, null); type.GetProperty("spatialBlend")?.SetValue(val3, 1f, null); type.GetProperty("minDistance")?.SetValue(val3, 1f, null); type.GetProperty("maxDistance")?.SetValue(val3, 25f, null); type.GetMethod("Play", Type.EmptyTypes)?.Invoke(val3, null); float soundLength = GetSoundLength(soundAsset); if (soundLength > 0f) { Object.Destroy((Object)(object)activeSoundObject, soundLength + 0.1f); } } private static float GetSoundLength(Object asset) { if (asset == (Object)null) { return 0f; } return (((object)asset).GetType().GetProperty("length")?.GetValue(asset, null) is float num) ? num : 0f; } private void StopCurrentSound() { if ((Object)(object)activeSoundObject != (Object)null) { Object.Destroy((Object)(object)activeSoundObject); activeSoundObject = null; } } private Animator ResolveAnimator() { Animator val = ((Component)this).GetComponent<Animator>(); if ((Object)(object)val == (Object)null) { val = ((Component)this).gameObject.AddComponent<Animator>(); } ((Behaviour)val).enabled = true; val.cullingMode = (AnimatorCullingMode)0; return val; } private void EnsureInteractionProxy() { Transform val = null; Transform[] componentsInChildren = ((Component)this).GetComponentsInChildren<Transform>(true); Transform[] array = componentsInChildren; foreach (Transform val2 in array) { if (!((Object)(object)val2 == (Object)null) && !((Object)(object)((Component)val2).gameObject == (Object)(object)((Component)this).gameObject) && string.Equals(((Object)val2).name, "Interaction", StringComparison.OrdinalIgnoreCase)) { val = val2; break; } } if (!((Object)(object)val == (Object)null)) { ((Component)val).gameObject.layer = ((Component)this).gameObject.layer; if ((Object)(object)((Component)val).GetComponent<DarkAngelStatueInteractProxy>() == (Object)null) { ((Component)val).gameObject.AddComponent<DarkAngelStatueInteractProxy>(); } } } private IEnumerator StopAfter(float seconds) { yield return (object)new WaitForSeconds(Mathf.Max(0.05f, seconds)); StopCurrentAnimation(); } private void StopCurrentAnimation() { if (stopRoutine != null) { ((MonoBehaviour)this).StopCoroutine(stopRoutine); stopRoutine = null; } if (((PlayableGraph)(ref playableGraph)).IsValid()) { ((PlayableGraph)(ref playableGraph)).Destroy(); } } private void OnDestroy() { StopCurrentAnimation(); StopCurrentSound(); } } public class DarkAngelStatueInteractProxy : MonoBehaviour, Hoverable, Interactable { private DarkAngelStatueInteract GetOwner() { return ((Component)this).GetComponentInParent<DarkAngelStatueInteract>(); } public string GetHoverName() { DarkAngelStatueInteract owner = GetOwner(); return ((Object)(object)owner != (Object)null) ? owner.GetHoverName() : "The Dark Angel Statue"; } public string GetHoverText() { DarkAngelStatueInteract owner = GetOwner(); return ((Object)(object)owner != (Object)null) ? owner.GetHoverText() : string.Empty; } public bool Interact(Humanoid user, bool hold, bool alt) { DarkAngelStatueInteract owner = GetOwner(); return (Object)(object)owner != (Object)null && owner.Interact(user, hold, alt); } public bool UseItem(Humanoid user, ItemData item) { DarkAngelStatueInteract owner = GetOwner(); return (Object)(object)owner != (Object)null && owner.UseItem(user, item); } } public class DragonStatueInteract : MonoBehaviour, Hoverable, Interactable { private const string RpcName = "RWS_PlayDragonStatueAnimation"; private const string InteractionObjectName = "Interaction"; private const string FireObjectName = "Fire_Main"; private const float FireStartDelay = 1.691f; private const float FireDuration = 1.75f; private static AnimationClip sharedAnimationClip; private static Object sharedSoundAsset; private AnimationClip animationClip; private Object soundAsset; private Animator animator; private ZNetView netView; private PlayableGraph playableGraph; private Coroutine stopRoutine; private Coroutine fireStartRoutine; private Coroutine fireRoutine; private GameObject activeSoundObject; private Component fireParticleSystem; public void SetAnimationClip(AnimationClip clip) { animationClip = clip; if ((Object)(object)clip != (Object)null) { sharedAnimationClip = clip; } } public void SetSoundAsset(Object asset) { soundAsset = asset; if (asset != (Object)null) { sharedSoundAsset = asset; } } private void Awake() { if ((Object)(object)animationClip == (Object)null) { animationClip = sharedAnimationClip; } if (soundAsset == (Object)null) { soundAsset = sharedSoundAsset; } netView = ((Component)this).GetComponent<ZNetView>(); animator = ResolveAnimator(); fireParticleSystem = ResolveFireParticleSystem(); EnsureInteractionProxy(); StopFire(); if ((Object)(object)netView != (Object)null) { netView.Register("RWS_PlayDragonStatueAnimation", (Action<long>)RPC_PlayAnimation); } } public string GetHoverName() { return "Dragon Statue"; } public string GetHoverText() { return "Dragon Statue\n[<color=yellow><b>E</b></color>] Animate"; } public bool Interact(Humanoid user, bool hold, bool alt) { if (hold) { return false; } if ((Object)(object)animationClip == (Object)null) { animationClip = sharedAnimationClip; } if ((Object)(object)animationClip == (Object)null) { return false; } if ((Object)(object)netView != (Object)null && netView.IsValid()) { netView.InvokeRPC(ZNetView.Everybody, "RWS_PlayDragonStatueAnimation", Array.Empty<object>()); } else { PlayAnimation(); } return true; } public bool UseItem(Humanoid user, ItemData item) { return false; } private void RPC_PlayAnimation(long sender) { PlayAnimation(); } private void PlayAnimation() { //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0093: 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_00a3: 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_00b4: 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_00c5: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)animationClip == (Object)null) { animationClip = sharedAnimationClip; } if (!((Object)(object)animationClip == (Object)null)) { animator = ResolveAnimator(); if (!((Object)(object)animator == (Object)null)) { StopCurrentAnimation(); playableGraph = PlayableGraph.Create("RWS_DragonStatue_Animation"); ((PlayableGraph)(ref playableGraph)).SetTimeUpdateMode((DirectorUpdateMode)1); AnimationPlayableOutput val = AnimationPlayableOutput.Create(playableGraph, "DragonStatueOutput", animator); AnimationClipPlayable val2 = AnimationClipPlayable.Create(playableGraph, animationClip); PlayableExtensions.SetTime<AnimationClipPlayable>(val2, 0.0); PlayableExtensions.SetSpeed<AnimationClipPlayable>(val2, 1.0); PlayableOutputExtensions.SetSourcePlayable<AnimationPlayableOutput, AnimationClipPlayable>(val, val2); ((PlayableGraph)(ref playableGraph)).Play(); ((PlayableGraph)(ref playableGraph)).Evaluate(0f); PlaySound(); ScheduleFire(); stopRoutine = ((MonoBehaviour)this).StartCoroutine(StopAfter(animationClip.length)); } } } private void ScheduleFire() { StopFire(); fireStartRoutine = ((MonoBehaviour)this).StartCoroutine(StartFireAfter(1.691f)); } private IEnumerator StartFireAfter(float seconds) { yield return (object)new WaitForSeconds(Mathf.Max(0f, seconds)); fireStartRoutine = null; PlayFire(); } private void PlayFire() { if ((Object)(object)fireParticleSystem == (Object)null) { fireParticleSystem = ResolveFireParticleSystem(); } if ((Object)(object)fireParticleSystem == (Object)null) { return; } StopFire(); if (!fireParticleSystem.gameObject.activeSelf) { fireParticleSystem.gameObject.SetActive(true); } Type type = ((object)fireParticleSystem).GetType(); MethodInfo method = type.GetMethod("Play", new Type[1] { typeof(bool) }); if (method == null) { return; } try { method.Invoke(fireParticleSystem, new object[1] { true }); fireRoutine = ((MonoBehaviour)this).StartCoroutine(StopFireAfter(1.75f)); } catch (Exception) { } } private Component ResolveFireParticleSystem() { Transform[] componentsInChildren = ((Component)this).GetComponentsInChildren<Transform>(true); Transform[] array = componentsInChildren; foreach (Transform val in array) { if ((Object)(object)val == (Object)null || !string.Equals(((Object)val).name, "Fire_Main", StringComparison.OrdinalIgnoreCase)) { continue; } Type type = Type.GetType("UnityEngine.ParticleSystem, UnityEngine.ParticleSystemModule"); if (type != null) { Component component = ((Component)val).GetComponent(type); if ((Object)(object)component != (Object)null) { return component; } } Component[] components = ((Component)val).GetComponents<Component>(); Component[] array2 = components; foreach (Component val2 in array2) { if ((Object)(object)val2 != (Object)null && string.Equals(((object)val2).GetType().FullName, "UnityEngine.ParticleSystem", StringComparison.Ordinal)) { return val2; } } } return null; } private IEnumerator StopFireAfter(float seconds) { yield return (object)new WaitForSeconds(Mathf.Max(0.05f, seconds)); fireRoutine = null; StopFire(); } private void StopFire() { if (fireStartRoutine != null) { ((MonoBehaviour)this).StopCoroutine(fireStartRoutine); fireStartRoutine = null; } if (fireRoutine != null) { ((MonoBehaviour)this).StopCoroutine(fireRoutine); fireRoutine = null; } if ((Object)(object)fireParticleSystem == (Object)null) { return; } Type type = ((object)fireParticleSystem).GetType(); try { MethodInfo[] methods = type.GetMethods(); foreach (MethodInfo methodInfo in methods) { if (string.Equals(methodInfo.Name, "Stop", StringComparison.Ordinal)) { ParameterInfo[] parameters = methodInfo.GetParameters(); if (parameters.Length == 2 && !(parameters[0].ParameterType != typeof(bool)) && parameters[1].ParameterType.IsEnum) { object obj = Enum.Parse(parameters[1].ParameterType, "StopEmittingAndClear"); methodInfo.Invoke(fireParticleSystem, new object[2] { true, obj }); break; } } } type.GetMethod("Clear", new Type[1] { typeof(bool) })?.Invoke(fireParticleSystem, new object[1] { true }); } catch (Exception) { } } private void PlaySound() { //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_025d: Expected O, but got Unknown //IL_026e: Unknown result type (might be due to invalid IL or missing references) if (soundAsset == (Object)null) { soundAsset = sharedSoundAsset; } if (soundAsset == (Object)null) { return; } StopCurrentSound(); Type type = Type.GetType("UnityEngine.AudioSource, UnityEngine.AudioModule"); if (type == null) { return; } Object obj = soundAsset; GameObject val = (GameObject)(object)((obj is GameObject) ? obj : null); if (val != null) { activeSoundObject = Object.Instantiate<GameObject>(val, ((Component)this).transform.position, Quaternion.identity); ((Object)activeSoundObject).name = "sfx_RWS_Dragon_Statue"; bool flag = false; Transform[] componentsInChildren = activeSoundObject.GetComponentsInChildren<Transform>(true); Transform[] array = componentsInChildren; foreach (Transform val2 in array) { if (!((Object)(object)val2 == (Object)null)) { Component component = ((Component)val2).GetComponent(type); if (!((Object)(object)component == (Object)null)) { type.GetProperty("playOnAwake")?.SetValue(component, false, null); type.GetProperty("loop")?.SetValue(component, false, null); type.GetProperty("volume")?.SetValue(component, 1f, null); type.GetProperty("spatialBlend")?.SetValue(component, 1f, null); type.GetProperty("minDistance")?.SetValue(component, 1f, null); type.GetProperty("maxDistance")?.SetValue(component, 25f, null); type.GetMethod("Play", Type.EmptyTypes)?.Invoke(component, null); flag = true; } } } if (!flag) { StopCurrentSound(); } return; } Type type2 = Type.GetType("UnityEngine.AudioClip, UnityEngine.AudioModule"); if (type2 == null || !type2.IsInstanceOfType(soundAsset)) { return; } activeSoundObject = new GameObject("sfx_RWS_Dragon_Statue"); activeSoundObject.transform.position = ((Component)this).transform.position; activeSoundObject.transform.SetParent(((Component)this).transform, true); Component val3 = activeSoundObject.AddComponent(type); if ((Object)(object)val3 == (Object)null) { StopCurrentSound(); return; } type.GetProperty("clip")?.SetValue(val3, soundAsset, null); type.GetProperty("playOnAwake")?.SetValue(val3, false, null); type.GetProperty("loop")?.SetValue(val3, false, null); type.GetProperty("volume")?.SetValue(val3, 1f, null); type.GetProperty("spatialBlend")?.SetValue(val3, 1f, null); type.GetProperty("minDistance")?.SetValue(val3, 1f, null); type.GetProperty("maxDistance")?.SetValue(val3, 25f, null); type.GetMethod("Play", Type.EmptyTypes)?.Invoke(val3, null); float soundLength = GetSoundLength(soundAsset); if (soundLength > 0f) { Object.Destroy((Object)(object)activeSoundObject, soundLength + 0.1f); } } private static float GetSoundLength(Object asset) { if (asset == (Object)null) { return 0f; } return (((object)asset).GetType().GetProperty("length")?.GetValue(asset, null) is float num) ? num : 0f; } private void StopCurrentSound() { if ((Object)(object)activeSoundObject != (Object)null) { Object.Destroy((Object)(object)activeSoundObject); activeSoundObject = null; } } private Animator ResolveAnimator() { Animator val = ((Component)this).GetComponent<Animator>(); if ((Object)(object)val == (Object)null) { val = ((Component)this).gameObject.AddComponent<Animator>(); } ((Behaviour)val).enabled = true; val.cullingMode = (AnimatorCullingMode)0; return val; } private void EnsureInteractionProxy() { Transform val = null; Transform[] componentsInChildren = ((Component)this).GetComponentsInChildren<Transform>(true); Transform[] array = componentsInChildren; foreach (Transform val2 in array) { if (!((Object)(object)val2 == (Object)null) && !((Object)(object)((Component)val2).gameObject == (Object)(object)((Component)this).gameObject) && string.Equals(((Object)val2).name, "Interaction", StringComparison.OrdinalIgnoreCase)) { val = val2; break; } } if (!((Object)(object)val == (Object)null)) { ((Component)val).gameObject.layer = ((Component)this).gameObject.layer; if ((Object)(object)((Component)val).GetComponent<DragonStatueInteractProxy>() == (Object)null) { ((Component)val).gameObject.AddComponent<DragonStatueInteractProxy>(); } } } private IEnumerator StopAfter(float seconds) { yield return (object)new WaitForSeconds(Mathf.Max(0.05f, seconds)); StopCurrentAnimation(); } private void StopCurrentAnimation() { if (stopRoutine != null) { ((MonoBehaviour)this).StopCoroutine(stopRoutine); stopRoutine = null; } if (((PlayableGraph)(ref playableGraph)).IsValid()) { ((PlayableGraph)(ref playableGraph)).Destroy(); } StopFire(); } private void OnDestroy() { StopCurrentAnimation(); StopCurrentSound(); } } public class DragonStatueInteractProxy : MonoBehaviour, Hoverable, Interactable { private DragonStatueInteract GetOwner() { return ((Component)this).GetComponentInParent<DragonStatueInteract>(); } public string GetHoverName() { DragonStatueInteract owner = GetOwner(); return ((Object)(object)owner != (Object)null) ? owner.GetHoverName() : "Dragon Statue"; } public string GetHoverText() { DragonStatueInteract owner = GetOwner(); return ((Object)(object)owner != (Object)null) ? owner.GetHoverText() : string.Empty; } public bool Interact(Humanoid user, bool hold, bool alt) { DragonStatueInteract owner = GetOwner(); return (Object)(object)owner != (Object)null && owner.Interact(user, hold, alt); } public bool UseItem(Humanoid user, ItemData item) { DragonStatueInteract owner = GetOwner(); return (Object)(object)owner != (Object)null && owner.UseItem(user, item); } } [BepInPlugin("Ravenwood.RelicsStatues", "Ravenwood Relics Statues", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class RavenwoodRelicsStatues : BaseUnityPlugin { public const string PluginGUID = "Ravenwood.RelicsStatues"; public const string PluginName = "Ravenwood Relics Statues"; public const string PluginVersion = "1.0.0"; private AssetBundle statuesBundle; private void Awake() { //IL_0029: Unknown result type (might be due to invalid IL or missing references) RelicRegistrar.InitConfig(((BaseUnityPlugin)this).Config); foreach (string allCategory in RelicRegistrar.GetAllCategories()) { PieceManager.Instance.AddPieceCategory(allCategory); } Assembly executingAssembly = Assembly.GetExecutingAssembly(); string text = executingAssembly.GetManifestResourceNames().FirstOrDefault((string r) => r.ToLowerInvariant().Contains("ravenwoodstatues")); if (string.IsNullOrEmpty(text)) { return; } using (Stream stream = executingAssembly.GetManifestResourceStream(text)) { if (stream == null) { return; } using MemoryStream memoryStream = new MemoryStream(); stream.CopyTo(memoryStream); statuesBundle = AssetBundle.LoadFromMemory(memoryStream.ToArray()); } if (!((Object)(object)statuesBundle == (Object)null)) { PrefabManager.OnPrefabsRegistered += RegisterNow; } } private void RegisterNow() { if (!((Object)(object)statuesBundle == (Object)null)) { RelicRegistrar.RegisterAllRelics(statuesBundle); PrefabManager.OnPrefabsRegistered -= RegisterNow; } } } public class RelicRegistration { public string PrefabName; public string DisplayName; public RequirementConfig[] Requirements; public string Description; public int Comfort; public RelicRegistration(string prefab, string display, RequirementConfig[] reqs, string desc, int comfort = 0) { PrefabName = prefab; DisplayName = display; Requirements = reqs; Description = desc; Comfort = comfort; } } public static class RelicRegistrar { private static bool wasAlreadyRegistered = false; private const ComfortGroup RavenwoodThroneComfortGroup = (ComfortGroup)1381454676; private const ComfortGroup RavenwoodWerewolfBustComfortGroup = (ComfortGroup)1381454679; private const ComfortGroup RavenwoodHorseBustComfortGroup = (ComfortGroup)1381454664; private static ConfigEntry<string> customHammerTabConfig; private static readonly Dictionary<string, ConfigEntry<string>> recipeConfigs = new Dictionary<string, ConfigEntry<string>>(StringComparer.OrdinalIgnoreCase); private static readonly Dictionary<string, ConfigEntry<bool>> runeRockSoundConfigs = new Dictionary<string, ConfigEntry<bool>>(StringComparer.OrdinalIgnoreCase); private static readonly HashSet<string> RuneRockSoundPrefabs = new HashSet<string>(StringComparer.OrdinalIgnoreCase) { "RWS_Statue_RuneRock1", "RWS_Statue_RuneRock2", "RWS_Statue_RuneRock3" }; private static readonly HashSet<string> StonePlacementSoundPrefabs = new HashSet<string>(StringComparer.OrdinalIgnoreCase) { "RWS_The_White_Throne", "RWS_The_Black_Throne", "RWS_Valkyrie_Statue", "RWS_The_Grey_Throne", "RWS_The_Golden_Throne", "RWS_Odin_On_Throne", "RWS_Lion_Statue", "RWS_Horse_Bust", "RWS_Werewolf_Bust", "RWS_Gargoyle_Dog", "RWS_Gargoyle_Statue", "RWS_Statue_Dragon", "RWS_Statue_RuneRock1", "RWS_Statue_RuneRock2", "RWS_Statue_RuneRock3", "RWS_Medal_Cthulhu", "RWS_Medal_Octopus", "RWS_Medal_Sectarian", "RWS_Statue_Column", "RWS_Statue_Crab", "RWS_Statue_Cthulhu", "RWS_Statue_Demon", "RWS_Statue_Fish", "RWS_Statue_Obelisk", "RWS_Statue_Snake" }; private static readonly HashSet<string> StoneDestructionSoundPrefabs = new HashSet<string>(StringComparer.OrdinalIgnoreCase) { "RWS_The_White_Throne", "RWS_The_Black_Throne", "RWS_Valkyrie_Statue", "RWS_The_Grey_Throne", "RWS_The_Golden_Throne", "RWS_Odin_On_Throne", "RWS_Lion_Statue", "RWS_Horse_Bust", "RWS_Werewolf_Bust", "RWS_Gargoyle_Dog", "RWS_Gargoyle_Statue" }; public static readonly List<RelicRegistration> AllRegistrations = new List<RelicRegistration> { new RelicRegistration("RWS_Heimdall_Armour", "Heimdall Armour", (RequirementConfig[])(object)new RequirementConfig[2] { new RequirementConfig("Bronze", 10, 0, true), new RequirementConfig("RWc_Bear", 10, 0, true) }, "A Ravenwood statue relic."), new RelicRegistration("RWS_The_Dark_Angel_Statue", "The Dark Angel Statue (Animated)", (RequirementConfig[])(object)new RequirementConfig[4] { new RequirementConfig("RWc_Bear", 4, 0, true), new RequirementConfig("RWc_Snake", 3, 0, true), new RequirementConfig("RWc_Wolf", 2, 0, true), new RequirementConfig("RWc_Lion", 1, 0, true) }, "A Ravenwood statue relic."), new RelicRegistration("RWS_The_Dark_Knight_Armour", "The Dark Knight Armour", (RequirementConfig[])(object)new RequirementConfig[2] { new RequirementConfig("Iron", 10, 0, true), new RequirementConfig("RWc_Snake", 10, 0, true) }, "A Ravenwood statue relic."), new RelicRegistration("RWS_The_Templar_Armour", "The Templar Armour", (RequirementConfig[])(object)new RequirementConfig[4] { new RequirementConfig("Bronze", 3, 0, true), new RequirementConfig("Silver", 5, 0, true), new RequirementConfig("RWc_Bear", 2, 0, true), new RequirementConfig("RWc_Wolf", 2, 0, true) }, "A Ravenwood statue relic."), new RelicRegistration("RWS_Dragon_Statue", "Dragon Statue (Animated+Saddle)", (RequirementConfig[])(object)new RequirementConfig[1] { new RequirementConfig("RWc_Raven", 1, 0, true) }, "A Ravenwood statue relic."), new RelicRegistration("RWS_Werewolf", "Werewolf Statue (Animated)", (RequirementConfig[])(object)new RequirementConfig[2] { new RequirementConfig("RWc_Snake", 10, 0, true), new RequirementConfig("RWc_Lion", 1, 0, true) }, "A Ravenwood statue relic."), new RelicRegistration("RWS_Werewolf_Mirrored_Left", "Werewolf Statue Left", (RequirementConfig[])(object)new RequirementConfig[1] { new RequirementConfig("RWc_Snake", 5, 0, true) }, "A Ravenwood statue relic."), new RelicRegistration("RWS_Werewolf_Mirrored_Right", "Werewolf Statue Right", (RequirementConfig[])(object)new RequirementConfig[1] { new RequirementConfig("RWc_Snake", 5, 0, true) }, "A Ravenwood statue relic."), new RelicRegistration("RWS_Gargoyle_Statue", "Gargoyle Statue", (RequirementConfig[])(object)new RequirementConfig[3] { new RequirementConfig("Stone", 10, 0, true), new RequirementConfig("RWc_Bear", 1, 0, true), new RequirementConfig("RWc_Snake", 3, 0, true) }, "A Ravenwood statue relic."), new RelicRegistration("RWS_Gargoyle_Dog", "Gargoyle Dog Statue", (RequirementConfig[])(object)new RequirementConfig[3] { new RequirementConfig("Stone", 10, 0, true), new RequirementConfig("RWc_Deer", 5, 0, true), new RequirementConfig("RWc_Snake", 3, 0, true) }, "A Ravenwood statue relic."), new RelicRegistration("RWS_Werewolf_Bust", "Werewolf Bust", (RequirementConfig[])(object)new RequirementConfig[3] { new RequirementConfig("Stone", 5, 0, true), new RequirementConfig("RWc_Deer", 5, 0, true), new RequirementConfig("RWc_Snake", 2, 0, true) }, "A Ravenwood statue relic.", 1), new RelicRegistration("RWS_Horse_Bust", "Horse Bust", (RequirementConfig[])(object)new RequirementConfig[3] { new RequirementConfig("BlackMarble", 5, 0, true), new RequirementConfig("RWc_Deer", 1, 0, true), new RequirementConfig("RWc_Snake", 2, 0, true) }, "A Ravenwood statue relic.", 1), new RelicRegistration("RWS_Lion_Statue", "Lion Statue", (RequirementConfig[])(object)new RequirementConfig[2] { new RequirementConfig("Stone", 40, 0, true), new RequirementConfig("RWc_Deer", 40, 0, true) }, "A Ravenwood statue relic."), new RelicRegistration("RWS_Odin_On_Throne", "Odin On The Throne", (RequirementConfig[])(object)new RequirementConfig[3] { new RequirementConfig("Stone", 120, 0, true), new RequirementConfig("Silver", 120, 0, true), new RequirementConfig("RWc_Wolf", 12, 0, true) }, "A Ravenwood statue relic.", 1), new RelicRegistration("RWS_The_Golden_Throne", "The Golden Throne", (RequirementConfig[])(object)new RequirementConfig[3] { new RequirementConfig("Stone", 100, 0, true), new RequirementConfig("FlametalNew", 100, 0, true), new RequirementConfig("RWc_Lion", 5, 0, true) }, "A Ravenwood statue relic.", 1), new RelicRegistration("RWS_The_Grey_Throne", "The Grey Throne", (RequirementConfig[])(object)new RequirementConfig[3] { new RequirementConfig("Stone", 100, 0, true), new RequirementConfig("Iron", 100, 0, true), new RequirementConfig("RWc_Snake", 50, 0, true) }, "A Ravenwood statue relic.", 1), new RelicRegistration("RWS_The_White_Throne", "The White Throne", (RequirementConfig[])(object)new RequirementConfig[3] { new RequirementConfig("Stone", 100, 0, true), new RequirementConfig("Silver", 100, 0, true), new RequirementConfig("RWc_Wolf", 20, 0, true) }, "A Ravenwood statue relic.", 1), new RelicRegistration("RWS_The_Black_Throne", "The Black Throne", (RequirementConfig[])(object)new RequirementConfig[3] { new RequirementConfig("Stone", 100, 0, true), new RequirementConfig("BlackMetal", 100, 0, true), new RequirementConfig("RWc_Bear", 100, 0, true) }, "A Ravenwood statue relic.", 1), new RelicRegistration("RWS_Valkyrie_Statue", "A Valkyrie Statue", (RequirementConfig[])(object)new RequirementConfig[4] { new RequirementConfig("RWc_Deer", 3, 0, true), new RequirementConfig("RWc_Bear", 3, 0, true), new RequirementConfig("RWc_Wolf", 3, 0, true), new RequirementConfig("RWc_Lion", 3, 0, true) }, "A Ravenwood statue relic."), new RelicRegistration("RWS_Statue_Dragon", "Dragon Statue", (RequirementConfig[])(object)new RequirementConfig[2] { new RequirementConfig("Stone", 20, 0, true), new RequirementConfig("RWc_Snake", 5, 0, true) }, "A Ravenwood statue relic."), new RelicRegistration("RWS_Statue_RuneRock1", "Rune Rock 1 Wisplight", (RequirementConfig[])(object)new RequirementConfig[2] { new RequirementConfig("Wisp", 1, 0, true), new RequirementConfig("RWc_Wolf", 1, 0, true) }, "A Ravenwood statue relic."), new RelicRegistration("RWS_Statue_RuneRock2", "Rune Rock 2 Wisplight", (RequirementConfig[])(object)new RequirementConfig[2] { new RequirementConfig("Wisp", 1, 0, true), new RequirementConfig("RWc_Wolf", 1, 0, true) }, "A Ravenwood statue relic."), new RelicRegistration("RWS_Statue_RuneRock3", "Rune Rock 3 Wisplight", (RequirementConfig[])(object)new RequirementConfig[2] { new RequirementConfig("Wisp", 1, 0, true), new RequirementConfig("RWc_Wolf", 1, 0, true) }, "A Ravenwood statue relic."), new RelicRegistration("RWS_Medal_Cthulhu", "Cthulhu Medal", (RequirementConfig[])(object)new RequirementConfig[2] { new RequirementConfig("Stone", 5, 0, true), new RequirementConfig("RWc_Snake", 4, 0, true) }, "A Ravenwood statue relic."), new RelicRegistration("RWS_Medal_Octopus", "Octopus Medal", (RequirementConfig[])(object)new RequirementConfig[2] { new RequirementConfig("Stone", 5, 0, true), new RequirementConfig("RWc_Snake", 4, 0, true) }, "A Ravenwood statue relic."), new RelicRegistration("RWS_Medal_Sectarian", "Sectarian Medal", (RequirementConfig[])(object)new RequirementConfig[2] { new RequirementConfig("Stone", 5, 0, true), new RequirementConfig("RWc_Wolf", 2, 0, true) }, "A Ravenwood statue relic."), new RelicRegistration("RWS_Statue_Column", "Stone Column", (RequirementConfig[])(object)new RequirementConfig[2] { new RequirementConfig("Stone", 40, 0, true), new RequirementConfig("RWc_Snake", 5, 0, true) }, "A Ravenwood statue relic."), new RelicRegistration("RWS_Statue_Crab", "Crab Statue", (RequirementConfig[])(object)new RequirementConfig[2] { new RequirementConfig("Stone", 25, 0, true), new RequirementConfig("RWc_Snake", 5, 0, true) }, "A Ravenwood statue relic."), new RelicRegistration("RWS_Statue_Cthulhu", "Cthulhu Statue", (RequirementConfig[])(object)new RequirementConfig[2] { new RequirementConfig("Stone", 25, 0, true), new RequirementConfig("RWc_Snake", 5, 0, true) }, "A Ravenwood statue relic."), new RelicRegistration("RWS_Statue_Demon", "Demon Statue", (RequirementConfig[])(object)new RequirementConfig[2] { new RequirementConfig("Stone", 40, 0, true), new RequirementConfig("RWc_Snake", 5, 0, true) }, "A Ravenwood statue relic."), new RelicRegistration("RWS_Statue_Fish", "Fish Statue", (RequirementConfig[])(object)new RequirementConfig[2] { new RequirementConfig("Stone", 10, 0, true), new RequirementConfig("RWc_Snake", 3, 0, true) }, "A Ravenwood statue relic."), new RelicRegistration("RWS_Statue_Obelisk", "Obelisk", (RequirementConfig[])(object)new RequirementConfig[2] { new RequirementConfig("Stone", 30, 0, true), new RequirementConfig("RWc_Snake", 5, 0, true) }, "A Ravenwood statue relic."), new RelicRegistration("RWS_Statue_Snake", "Snake Statue", (RequirementConfig[])(object)new RequirementConfig[2] { new RequirementConfig("Stone", 25, 0, true), new RequirementConfig("RWc_Snake", 5, 0, true) }, "A Ravenwood statue relic.") }; public static void InitConfig(ConfigFile config) { if (config == null || recipeConfigs.Count > 0) { return; } customHammerTabConfig = config.Bind<string>("General", "CustomHammerTab", "Ravenwood", "Hammer build-menu tab used by all Ravenwood Relics Statues pieces. Restart Valheim after changing this setting."); foreach (string runeRockSoundPrefab in RuneRockSoundPrefabs) { runeRockSoundConfigs[runeRockSoundPrefab] = config.Bind<bool>("Rune Rock Sounds", runeRockSoundPrefab, true, "Enable the built-in sound on " + runeRockSoundPrefab + ". Set to false to disable it. Restart Valheim after changing this setting."); } foreach (RelicRegistration allRegistration in AllRegistrations) { ConfigEntry<string> val = config.Bind<string>("Recipes", allRegistration.PrefabName, GetDefaultRecipeText(allRegistration), "Build recipe for this prefab. Format: ItemPrefab:Amount. Separate multiple requirements with commas, for example: RWc_Deer:1,Wood:5. Restart Valheim after changing this setting."); if (string.Equals(val.Value?.Trim(), "Coins:1", StringComparison.OrdinalIgnoreCase)) { val.Value = "RWc_Deer:1"; } if (string.Equals(allRegistration.PrefabName, "RWS_Medal_Chthulhu", StringComparison.OrdinalIgnoreCase) && string.Equals(val.Value?.Trim(), "RWc_Deer:1", StringComparison.OrdinalIgnoreCase)) { val.Value = GetDefaultRecipeText(allRegistration); } recipeConfigs[allRegistration.PrefabName] = val; } } public static void RegisterAllRelics(AssetBundle bundle) { if (wasAlreadyRegistered || (Object)(object)bundle == (Object)null) { return; } int num = 0; int num2 = 0; foreach (RelicRegistration allRegistration in AllRegistrations) { if (RegisterRelic(bundle, allRegistration)) { num++; } else { num2++; } } wasAlreadyRegistered = true; } private static bool RegisterRelic(AssetBundle bundle, RelicRegistration reg) { //IL_010a: 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_0156: Unknown result type (might be due to invalid IL or missing references) //IL_02f3: Unknown result type (might be due to invalid IL or missing references) //IL_02f8: Unknown result type (might be due to invalid IL or missing references) //IL_0304: Unknown result type (might be due to invalid IL or missing references) //IL_0310: Unknown result type (might be due to invalid IL or missing references) //IL_031c: Unknown result type (might be due to invalid IL or missing references) //IL_032b: Expected O, but got Unknown //IL_0334: Unknown result type (might be due to invalid IL or missing references) //IL_033e: Expected O, but got Unknown if ((Object)(object)bundle == (Object)null) { return false; } if (reg == null || string.IsNullOrWhiteSpace(reg.PrefabName)) { return false; } GameObject val = bundle.LoadAsset<GameObject>(reg.PrefabName); if ((Object)(object)val == (Object)null) { return false; } ((Object)val).name = reg.PrefabName; ApplyRuneRockSoundConfig(reg.PrefabName, val); ZNetView val2 = val.GetComponent<ZNetView>(); if ((Object)(object)val2 == (Object)null) { val2 = val.AddComponent<ZNetView>(); } val2.m_persistent = true; val2.m_syncInitialScale = true; if (!Object.op_Implicit((Object)(object)val.GetComponent<ZSyncTransform>())) { val.AddComponent<ZSyncTransform>(); } Piece val3 = val.GetComponent<Piece>() ?? val.AddComponent<Piece>(); val3.m_name = reg.DisplayName; val3.m_description = reg.Description; val3.m_comfort = reg.Comfort; if (reg.PrefabName.EndsWith("_Throne", StringComparison.OrdinalIgnoreCase)) { val3.m_comfortGroup = (ComfortGroup)1381454676; } else if (string.Equals(reg.PrefabName, "RWS_Werewolf_Bust", StringComparison.OrdinalIgnoreCase)) { val3.m_comfortGroup = (ComfortGroup)1381454679; } else if (string.Equals(reg.PrefabName, "RWS_Horse_Bust", StringComparison.OrdinalIgnoreCase)) { val3.m_comfortGroup = (ComfortGroup)1381454664; } val3.m_groundOnly = false; WearNTear val4 = val.GetComponent<WearNTear>() ?? val.AddComponent<WearNTear>(); val4.m_health = 1000000f; val4.m_noRoofWear = true; val4.m_noSupportWear = false; val4.m_supports = true; if (string.Equals(reg.PrefabName, "RWS_Statue_Column", StringComparison.OrdinalIgnoreCase)) { val4.m_noSupportWear = false; val4.m_supports = true; } ConfigurePlacementAndDestructionEffects(reg.PrefabName, val3, val4); if (string.Equals(reg.PrefabName, "RWS_The_Dark_Angel_Statue", StringComparison.OrdinalIgnoreCase)) { AnimationClip animationClip = FindAnimationClip(bundle, "Mon_BlackDragon31_Btl_Skl08"); Object soundAsset = FindAssetByName(bundle, "sfx_RWS_The_Dark_Angel_Statue"); DarkAngelStatueInteract darkAngelStatueInteract = val.GetComponent<DarkAngelStatueInteract>() ?? val.AddComponent<DarkAngelStatueInteract>(); darkAngelStatueInteract.SetAnimationClip(animationClip); darkAngelStatueInteract.SetSoundAsset(soundAsset); } if (string.Equals(reg.PrefabName, "RWS_Dragon_Statue", StringComparison.OrdinalIgnoreCase)) { AnimationClip animationClip2 = FindDragonAnimationClip(bundle); Object soundAsset2 = FindAssetByName(bundle, "sfx_RWS_Dragon_Statue"); DragonStatueInteract dragonStatueInteract = val.GetComponent<DragonStatueInteract>() ?? val.AddComponent<DragonStatueInteract>(); dragonStatueInteract.SetAnimationClip(animationClip2); dragonStatueInteract.SetSoundAsset(soundAsset2); } if (string.Equals(reg.PrefabName, "RWS_Werewolf", StringComparison.OrdinalIgnoreCase)) { AnimationClip animationClip3 = FindAnimationClip(bundle, "werewolf_skeleton_howl"); Object soundAsset3 = FindAssetByName(bundle, "sfx_RWS_Werewolf"); WerewolfStatueInteract werewolfStatueInteract = val.GetComponent<WerewolfStatueInteract>() ?? val.AddComponent<WerewolfStatueInteract>(); werewolfStatueInteract.SetAnimationClip(animationClip3); werewolfStatueInteract.SetSoundAsset(soundAsset3); } Sprite val5 = bundle.LoadAsset<Sprite>(reg.PrefabName); if ((Object)(object)val5 != (Object)null) { val3.m_icon = val5; } PieceConfig val6 = new PieceConfig { PieceTable = "Hammer", Category = GetConfiguredHammerTab(), CraftingStation = "piece_workbench", Requirements = GetConfiguredRequirements(reg) }; PieceManager.Instance.AddPiece(new CustomPiece(val, true, val6)); return true; } private static AnimationClip FindAnimationClip(AssetBundle bundle, string clipName) { if ((Object)(object)bundle == (Object)null || string.IsNullOrWhiteSpace(clipName)) { return null; } AnimationClip val = bundle.LoadAsset<AnimationClip>(clipName); if ((Object)(object)val != (Object)null) { return val; } AnimationClip val2 = ((IEnumerable<AnimationClip>)bundle.LoadAllAssets<AnimationClip>()).FirstOrDefault((Func<AnimationClip, bool>)((AnimationClip clip) => (Object)(object)clip != (Object)null && string.Equals(((Object)clip).name, clipName, StringComparison.OrdinalIgnoreCase))); if ((Object)(object)val2 != (Object)null) { return val2; } string[] allAssetNames = bundle.GetAllAssetNames(); foreach (string text in allAssetNames) { AnimationClip[] source = bundle.LoadAssetWithSubAssets<AnimationClip>(text); AnimationClip val3 = ((IEnumerable<AnimationClip>)source).FirstOrDefault((Func<AnimationClip, bool>)((AnimationClip clip) => (Object)(object)clip != (Object)null && string.Equals(((Object)clip).name, clipName, StringComparison.OrdinalIgnoreCase))); if ((Object)(object)val3 != (Object)null) { return val3; } } return null; } private static Object FindAssetByName(AssetBundle bundle, string assetName) { if ((Object)(object)bundle == (Object)null || string.IsNullOrWhiteSpace(assetName)) { return null; } Object val = bundle.LoadAsset<Object>(assetName); if (val != (Object)null) { return val; } Object val2 = ((IEnumerable<Object>)bundle.LoadAllAssets<Object>()).FirstOrDefault((Func<Object, bool>)((Object asset) => asset != (Object)null && string.Equals(asset.name, assetName, StringComparison.OrdinalIgnoreCase))); if (val2 != (Object)null) { return val2; } string[] allAssetNames = bundle.GetAllAssetNames(); foreach (string text in allAssetNames) { Object[] source = bundle.LoadAssetWithSubAssets<Object>(text); Object val3 = ((IEnumerable<Object>)source).FirstOrDefault((Func<Object, bool>)((Object asset) => asset != (Object)null && string.Equals(asset.name, assetName, StringComparison.OrdinalIgnoreCase))); if (val3 != (Object)null) { return val3; } } return null; } private static AnimationClip FindDragonAnimationClip(AssetBundle bundle) { if ((Object)(object)bundle == (Object)null) { return null; } string[] array = new string[5] { "Qishilong_skill09", "RWS_Dragon_Statue", "RWS_Dragon_Statue_Animation", "Dragon_Statue", "DragonStatue" }; string[] array2 = array; foreach (string clipName in array2) { AnimationClip val = FindAnimationClip(bundle, clipName); if ((Object)(object)val != (Object)null) { return val; } } AnimationClip[] source = bundle.LoadAllAssets<AnimationClip>(); AnimationClip val2 = ((IEnumerable<AnimationClip>)source).FirstOrDefault((Func<AnimationClip, bool>)((AnimationClip clip) => (Object)(object)clip != (Object)null && ((Object)clip).name.IndexOf("dragon", StringComparison.OrdinalIgnoreCase) >= 0 && !string.Equals(((Object)clip).name, "Mon_BlackDragon31_Btl_Skl08", StringComparison.OrdinalIgnoreCase))); if ((Object)(object)val2 != (Object)null) { return val2; } AnimationClip[] array3 = source.Where((AnimationClip clip) => (Object)(object)clip != (Object)null && !string.Equals(((Object)clip).name, "Mon_BlackDragon31_Btl_Skl08", StringComparison.OrdinalIgnoreCase)).ToArray(); return (array3.Length == 1) ? array3[0] : null; } private static void ConfigurePlacementAndDestructionEffects(string prefabName, Piece piece, WearNTear wear) { //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Expected O, but got Unknown //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Expected O, but got Unknown if (!((Object)(object)piece == (Object)null) && !((Object)(object)wear == (Object)null)) { bool flag = !string.IsNullOrWhiteSpace(prefabName) && StonePlacementSoundPrefabs.Contains(prefabName); bool flag2 = !string.IsNullOrWhiteSpace(prefabName) && StoneDestructionSoundPrefabs.Contains(prefabName); GameObject prefab = PrefabManager.Instance.GetPrefab(flag ? "sfx_build_hammer_stone" : "sfx_build_hammer_metal"); GameObject prefab2 = PrefabManager.Instance.GetPrefab(flag2 ? "sfx_rock_destroyed" : "sfx_build_hammer_metal"); GameObject prefab3 = PrefabManager.Instance.GetPrefab("vfx_destroyed"); if (piece.m_placeEffect == null) { piece.m_placeEffect = new EffectList(); } if (wear.m_destroyedEffect == null) { wear.m_destroyedEffect = new EffectList(); } RemoveEffectsByName(piece.m_placeEffect, "sfx_build_hammer_metal", "sfx_build_hammer_stone"); RemoveEffectsByName(wear.m_destroyedEffect, "sfx_build_hammer_metal", "sfx_build_hammer_stone", "sfx_rock_destroyed"); AddEffectIfMissing(piece.m_placeEffect, prefab); AddEffectIfMissing(wear.m_destroyedEffect, prefab3); AddEffectIfMissing(wear.m_destroyedEffect, prefab2); } } private static void RemoveEffectsByName(EffectList effectList, params string[] prefabNames) { if (effectList == null || effectList.m_effectPrefabs == null || prefabNames == null || prefabNames.Length == 0) { return; } effectList.m_effectPrefabs = effectList.m_effectPrefabs.Where((EffectData effect) => effect == null || (Object)(object)effect.m_prefab == (Object)null || !prefabNames.Any((string name) => string.Equals(((Object)effect.m_prefab).name, name, StringComparison.OrdinalIgnoreCase))).ToArray(); } private static void AddEffectIfMissing(EffectList effectList, GameObject effectPrefab) { //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0069: 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_007c: Expected O, but got Unknown if (effectList != null && !((Object)(object)effectPrefab == (Object)null)) { List<EffectData> list = (effectList.m_effectPrefabs ?? Array.Empty<EffectData>()).ToList(); if (!list.Any((EffectData effect) => effect != null && (Object)(object)effect.m_prefab != (Object)null && string.Equals(((Object)effect.m_prefab).name, ((Object)effectPrefab).name, StringComparison.OrdinalIgnoreCase))) { list.Add(new EffectData { m_prefab = effectPrefab, m_enabled = true, m_variant = -1 }); effectList.m_effectPrefabs = list.ToArray(); } } } private static void ApplyRuneRockSoundConfig(string prefabName, GameObject prefab) { if ((Object)(object)prefab == (Object)null || string.IsNullOrWhiteSpace(prefabName) || !RuneRockSoundPrefabs.Contains(prefabName) || !runeRockSoundConfigs.TryGetValue(prefabName, out var value) || value == null || value.Value) { return; } Behaviour[] componentsInChildren = prefab.GetComponentsInChildren<Behaviour>(true); Behaviour[] array = componentsInChildren; foreach (Behaviour val in array) { if ((Object)(object)val == (Object)null || !string.Equals(((object)val).GetType().Name, "ZSFX", StringComparison.OrdinalIgnoreCase)) { continue; } DisableZSFXPlayOnAwake(val); val.enabled = false; AudioSource[] components = ((Component)val).GetComponents<AudioSource>(); AudioSource[] array2 = components; foreach (AudioSource val2 in array2) { if (!((Object)(object)val2 == (Object)null)) { val2.Stop(); val2.playOnAwake = false; val2.loop = false; val2.mute = true; ((Behaviour)val2).enabled = false; } } } } private static void DisableZSFXPlayOnAwake(Behaviour zsfx) { if (!((Object)(object)zsfx == (Object)null)) { Type type = ((object)zsfx).GetType(); FieldInfo field = type.GetField("m_playOnAwake", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field != null && field.FieldType == typeof(bool)) { field.SetValue(zsfx, false); } } } private static string GetConfiguredHammerTab() { string text = customHammerTabConfig?.Value?.Trim(); return string.IsNullOrWhiteSpace(text) ? "Ravenwood" : text; } private static string GetDefaultRecipeText(RelicRegistration reg) { if (reg?.Requirements == null || reg.Requirements.Length == 0) { return "RWc_Deer:1"; } return string.Join(", ", reg.Requirements.Select((RequirementConfig requirement) => $"{requirement.Item}:{requirement.Amount}")); } private static RequirementConfig[] GetConfiguredRequirements(RelicRegistration reg) { //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Expected O, but got Unknown if (reg == null || string.IsNullOrWhiteSpace(reg.PrefabName)) { return reg?.Requirements; } if (!recipeConfigs.TryGetValue(reg.PrefabName, out var value) || value == null) { return reg.Requirements; } string value2 = value.Value; if (string.IsNullOrWhiteSpace(value2)) { return reg.Requirements; } List<RequirementConfig> list = new List<RequirementConfig>(); string[] array = value2.Split(new char[2] { ',', ';' }, StringSplitOptions.RemoveEmptyEntries); string[] array2 = array; foreach (string text in array2) { string text2 = text.Trim(); int num = text2.IndexOf(':'); if (num > 0 && num < text2.Length - 1) { string text3 = text2.Substring(0, num).Trim(); string s = text2.Substring(num + 1).Trim(); if (!string.IsNullOrWhiteSpace(text3) && int.TryParse(s, out var result) && result > 0) { list.Add(new RequirementConfig(text3, result, 0, true)); } } } if (list.Count == 0) { return reg.Requirements; } return list.ToArray(); } public static IEnumerable<string> GetAllCategories() { return new string[1] { GetConfiguredHammerTab() }; } } public class WerewolfStatueInteract : MonoBehaviour, Hoverable, Interactable { private const string RpcName = "RWS_PlayWerewolfAnimation"; private const string InteractionObjectName = "Interaction"; private static AnimationClip sharedAnimationClip; private static Object sharedSoundAsset; private AnimationClip animationClip; private Object soundAsset; private Animator animator; private ZNetView netView; private PlayableGraph playableGraph; private Coroutine stopRoutine; private GameObject activeSoundObject; public void SetAnimationClip(AnimationClip clip) { animationClip = clip; if ((Object)(object)clip != (Object)null) { sharedAnimationClip = clip; } } public void SetSoundAsset(Object asset) { soundAsset = asset; if (asset != (Object)null) { sharedSoundAsset = asset; } } private void Awake() { if ((Object)(object)animationClip == (Object)null) { animationClip = sharedAnimationClip; } if (soundAsset == (Object)null) { soundAsset = sharedSoundAsset; } netView = ((Component)this).GetComponent<ZNetView>(); animator = ResolveAnimator(); EnsureInteractionProxy(); if ((Object)(object)netView != (Object)null) { netView.Register("RWS_PlayWerewolfAnimation", (Action<long>)RPC_PlayAnimation); } } public string GetHoverName() { return "Werewolf Statue"; } public string GetHoverText() { return "Werewolf Statue\n[<color=yellow><b>E</b></color>] Howl"; } public bool Interact(Humanoid user, bool hold, bool alt) { if (hold) { return false; } if ((Object)(object)animationClip == (Object)null) { animationClip = sharedAnimationClip; } if ((Object)(object)animationClip == (Object)null) { return false; } if ((Object)(object)netView != (Object)null && netView.IsValid()) { netView.InvokeRPC(ZNetView.Everybody, "RWS_PlayWerewolfAnimation", Array.Empty<object>()); } else { PlayAnimation(); } return true; } public bool UseItem(Humanoid user, ItemData item) { return false; } private void RPC_PlayAnimation(long sender) { PlayAnimation(); } private void PlayAnimation() { //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0093: 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_00a3: 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_00b4: 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_00c5: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)animationClip == (Object)null) { animationClip = sharedAnimationClip; } if (!((Object)(object)animationClip == (Object)null)) { animator = ResolveAnimator(); if (!((Object)(object)animator == (Object)null)) { StopCurrentAnimation(); playableGraph = PlayableGraph.Create("RWS_Werewolf_Animation"); ((PlayableGraph)(ref playableGraph)).SetTimeUpdateMode((DirectorUpdateMode)1); AnimationPlayableOutput val = AnimationPlayableOutput.Create(playableGraph, "WerewolfOutput", animator); AnimationClipPlayable val2 = AnimationClipPlayable.Create(playableGraph, animationClip); PlayableExtensions.SetTime<AnimationClipPlayable>(val2, 0.0); PlayableExtensions.SetSpeed<AnimationClipPlayable>(val2, 1.0); PlayableOutputExtensions.SetSourcePlayable<AnimationPlayableOutput, AnimationClipPlayable>(val, val2); ((PlayableGraph)(ref playableGraph)).Play(); ((PlayableGraph)(ref playableGraph)).Evaluate(0f); PlaySound(); stopRoutine = ((MonoBehaviour)this).StartCoroutine(StopAfter(animationClip.length)); } } } private void PlaySound() { //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_025d: Expected O, but got Unknown //IL_026e: Unknown result type (might be due to invalid IL or missing references) if (soundAsset == (Object)null) { soundAsset = sharedSoundAsset; } if (soundAsset == (Object)null) { return; } StopCurrentSound(); Type type = Type.GetType("UnityEngine.AudioSource, UnityEngine.AudioModule"); if (type == null) { return; } Object obj = soundAsset; GameObject val = (GameObject)(object)((obj is GameObject) ? obj : null); if (val != null) { activeSoundObject = Object.Instantiate<GameObject>(val, ((Component)this).transform.position, Quaternion.identity); ((Object)activeSoundObject).name = "sfx_RWS_Werewolf"; bool flag = false; Transform[] componentsInChildren = activeSoundObject.GetComponentsInChildren<Transform>(true); Transform[] array = componentsInChildren; foreach (Transform val2 in array) { if (!((Object)(object)val2 == (Object)null)) { Component component = ((Component)val2).GetComponent(type); if (!((Object)(object)component == (Object)null)) { type.GetProperty("playOnAwake")?.SetValue(component, false, null); type.GetProperty("loop")?.SetValue(component, false, null); type.GetProperty("volume")?.SetValue(component, 1f, null); type.GetProperty("spatialBlend")?.SetValue(component, 1f, null); type.GetProperty("minDistance")?.SetValue(component, 1f, null); type.GetProperty("maxDistance")?.SetValue(component, 25f, null); type.GetMethod("Play", Type.EmptyTypes)?.Invoke(component, null); flag = true; } } } if (!flag) { StopCurrentSound(); } return; } Type type2 = Type.GetType("UnityEngine.AudioClip, UnityEngine.AudioModule"); if (type2 == null || !type2.IsInstanceOfType(soundAsset)) { return; } activeSoundObject = new GameObject("sfx_RWS_Werewolf"); activeSoundObject.transform.position = ((Component)this).transform.position; activeSoundObject.transform.SetParent(((Component)this).transform, true); Component val3 = activeSoundObject.AddComponent(type); if ((Object)(object)val3 == (Object)null) { StopCurrentSound(); return; } type.GetProperty("clip")?.SetValue(val3, soundAsset, null); type.GetProperty("playOnAwake")?.SetValue(val3, false, null); type.GetProperty("loop")?.SetValue(val3, false, null); type.GetProperty("volume")?.SetValue(val3, 1f, null); type.GetProperty("spatialBlend")?.SetValue(val3, 1f, null); type.GetProperty("minDistance")?.SetValue(val3, 1f, null); type.GetProperty("maxDistance")?.SetValue(val3, 25f, null); type.GetMethod("Play", Type.EmptyTypes)?.Invoke(val3, null); float soundLength = GetSoundLength(soundAsset); if (soundLength > 0f) { Object.Destroy((Object)(object)activeSoundObject, soundLength + 0.1f); } } private static float GetSoundLength(Object asset) { if (asset == (Object)null) { return 0f; } return (((object)asset).GetType().GetProperty("length")?.GetValue(asset, null) is float num) ? num : 0f; } private void StopCurrentSound() { if ((Object)(object)activeSoundObject != (Object)null) { Object.Destroy((Object)(object)activeSoundObject); activeSoundObject = null; } } private Animator ResolveAnimator() { Animator val = ((Component)this).GetComponent<Animator>(); if ((Object)(object)val == (Object)null) { val = ((Component)this).gameObject.AddComponent<Animator>(); } ((Behaviour)val).enabled = true; val.cullingMode = (AnimatorCullingMode)0; return val; } private void EnsureInteractionProxy() { Transform val = null; Transform[] componentsInChildren = ((Component)this).GetComponentsInChildren<Transform>(true); Transform[] array = componentsInChildren; foreach (Transform val2 in array) { if (!((Object)(object)val2 == (Object)null) && !((Object)(object)((Component)val2).gameObject == (Object)(object)((Component)this).gameObject) && string.Equals(((Object)val2).name, "Interaction", StringComparison.OrdinalIgnoreCase)) { val = val2; break; } } if ((Object)(object)val != (Object)null) { ((Component)val).gameObject.layer = ((Component)this).gameObject.layer; if ((Object)(object)((Component)val).GetComponent<WerewolfStatueInteractProxy>() == (Object)null) { ((Component)val).gameObject.AddComponent<WerewolfStatueInteractProxy>(); } return; } Transform[] array2 = componentsInChildren; foreach (Transform val3 in array2) { if ((Object)(object)val3 == (Object)null || (Object)(object)((Component)val3).gameObject == (Object)(object)((Component)this).gameObject) { continue; } Component[] components = ((Component)val3).GetComponents<Component>(); bool flag = false; Component[] array3 = components; foreach (Component val4 in array3) { if (!((Object)(object)val4 == (Object)null)) { string fullName = ((object)val4).GetType().FullName; if (!string.IsNullOrEmpty(fullName) && fullName.StartsWith("UnityEngine.", StringComparison.Ordinal) && fullName.EndsWith("Collider", StringComparison.Ordinal)) { flag = true; break; } } } if (flag) { ((Component)val3).gameObject.layer = ((Component)this).gameObject.layer; if ((Object)(object)((Component)val3).GetComponent<WerewolfStatueInteractProxy>() == (Object)null) { ((Component)val3).gameObject.AddComponent<WerewolfStatueInteractProxy>(); } } } } private IEnumerator StopAfter(float seconds) { yield return (object)new WaitForSeconds(Mathf.Max(0.05f, seconds)); StopCurrentAnimation(); } private void StopCurrentAnimation() { if (stopRoutine != null) { ((MonoBehaviour)this).StopCoroutine(stopRoutine); stopRoutine = null; } if (((PlayableGraph)(ref playableGraph)).IsValid()) { ((PlayableGraph)(ref playableGraph)).Destroy(); } } private void OnDestroy() { StopCurrentAnimation(); StopCurrentSound(); } } public class WerewolfStatueInteractProxy : MonoBehaviour, Hoverable, Interactable { private WerewolfStatueInteract GetOwner() { return ((Component)this).GetComponentInParent<WerewolfStatueInteract>(); } public string GetHoverName() { WerewolfStatueInteract owner = GetOwner(); return ((Object)(object)owner != (Object)null) ? owner.GetHoverName() : "Werewolf Statue"; } public string GetHoverText() { WerewolfStatueInteract owner = GetOwner(); return ((Object)(object)owner != (Object)null) ? owner.GetHoverText() : string.Empty; } public bool Interact(Humanoid user, bool hold, bool alt) { WerewolfStatueInteract owner = GetOwner(); return (Object)(object)owner != (Object)null && owner.Interact(user, hold, alt); } public bool UseItem(Humanoid user, ItemData item) { WerewolfStatueInteract owner = GetOwner(); return (Object)(object)owner != (Object)null && owner.UseItem(user, item); } }