Some mods may be broken due to the recent Alloyed Collective update.
Decompiled source of Jetstream Sam v1.0.2
Jetstream_Sam.dll
Decompiled 2 weeks agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using MonoMod.RuntimeDetour.HookGen; using RoR2; using RoR2.ContentManagement; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Rendering; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] namespace Jetstream_Sam; [BepInPlugin("com.Dannyduartemgs.Jetstream_Sam", "Jetstream_Sam", "1.0.0")] public class Jetstream_SamPlugin : BaseUnityPlugin { private class FieldException : Exception { public FieldException(string message, Exception innerException) : base(message, innerException) { } } private static AssetBundle assetBundle; private static readonly List<Material> materialsWithRoRShader = new List<Material>(); internal static Jetstream_SamPlugin Instance { get; private set; } internal static ManualLogSource InstanceLogger { get { Jetstream_SamPlugin instance = Instance; return (instance != null) ? ((BaseUnityPlugin)instance).Logger : null; } } private void Start() { Instance = this; using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("Jetstream_Sam.dannyduartemgsjetstream_sam")) { assetBundle = AssetBundle.LoadFromStream(stream); } ((ResourceAvailability)(ref BodyCatalog.availability)).CallWhenAvailable((Action)BodyCatalogInit); HookEndpointManager.Add((MethodBase)typeof(Language).GetMethod("LoadStrings"), (Delegate)new Action<Action<Language>, Language>(LanguageLoadStrings)); ReplaceShaders(); } private static void ReplaceShaders() { LoadMaterialsWithReplacedShader("RoR2/Base/Shaders/HGStandard.shader", "Assets/Resources/JetstreamSam.mat", "Assets/Resources/sword.mat", "Assets/Resources/sheat.mat"); } private static void LoadMaterialsWithReplacedShader(string shaderPath, params string[] materialPaths) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) Shader shader = Addressables.LoadAssetAsync<Shader>((object)shaderPath).WaitForCompletion(); foreach (string text in materialPaths) { Material val = assetBundle.LoadAsset<Material>(text); val.shader = shader; materialsWithRoRShader.Add(val); } } private static void LanguageLoadStrings(Action<Language> orig, Language self) { orig(self); self.SetStringByToken("DANNYDUARTEMGS_SKIN_SAMSKIN_NAME", "Jetstream_Sam"); } private static void Nothing(Action<SkinDef> orig, SkinDef self) { } private static void BodyCatalogInit() { MethodInfo method = typeof(SkinDef).GetMethod("Awake", BindingFlags.Instance | BindingFlags.NonPublic); HookEndpointManager.Add((MethodBase)method, (Delegate)new Action<Action<SkinDef>, SkinDef>(Nothing)); AddUnforgivenBodySamSkinSkin(); HookEndpointManager.Remove((MethodBase)method, (Delegate)new Action<Action<SkinDef>, SkinDef>(Nothing)); } private static void AddUnforgivenBodySamSkinSkin() { //IL_0273: Unknown result type (might be due to invalid IL or missing references) string text = "UnforgivenBody"; string text2 = "SamSkin"; try { GameObject val = BodyCatalog.FindBodyPrefab(text); if (!Object.op_Implicit((Object)(object)val)) { InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin because \"" + text + "\" doesn't exist")); return; } ModelLocator component = val.GetComponent<ModelLocator>(); if (!Object.op_Implicit((Object)(object)component)) { InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin to \"" + text + "\" because it doesn't have \"ModelLocator\" component")); return; } GameObject gameObject = ((Component)component.modelTransform).gameObject; ModelSkinController skinController = (Object.op_Implicit((Object)(object)gameObject) ? gameObject.GetComponent<ModelSkinController>() : null); if (!Object.op_Implicit((Object)(object)skinController)) { InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin to \"" + text + "\" because it doesn't have \"ModelSkinController\" component")); return; } Renderer[] renderers = gameObject.GetComponentsInChildren<Renderer>(true); SkinDef skin = ScriptableObject.CreateInstance<SkinDef>(); TryCatchThrow("Icon", delegate { skin.icon = assetBundle.LoadAsset<Sprite>("Assets\\SkinMods\\Jetstream_Sam\\Icons\\SamSkinIcon.png"); }); ((Object)skin).name = text2; skin.nameToken = "DANNYDUARTEMGS_SKIN_SAMSKIN_NAME"; skin.rootObject = gameObject; TryCatchThrow("Base Skins", delegate { skin.baseSkins = (SkinDef[])(object)new SkinDef[1] { skinController.skins[0] }; }); TryCatchThrow("Unlockable Name", delegate { skin.unlockableDef = ((IEnumerable<UnlockableDef>)ContentManager.unlockableDefs).FirstOrDefault((Func<UnlockableDef, bool>)((UnlockableDef def) => def.cachedName == "Jetstream_Sam")); }); TryCatchThrow("Game Object Activations", delegate { skin.gameObjectActivations = Array.Empty<GameObjectActivation>(); }); TryCatchThrow("Renderer Infos", delegate { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: 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_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) skin.rendererInfos = (RendererInfo[])(object)new RendererInfo[5] { new RendererInfo { defaultMaterial = assetBundle.LoadAsset<Material>("Assets/Resources/JetstreamSam.mat"), defaultShadowCastingMode = (ShadowCastingMode)1, ignoreOverlays = false, renderer = renderers.First((Renderer r) => ((Object)r).name == "meshBody") }, new RendererInfo { defaultMaterial = assetBundle.LoadAsset<Material>("Assets/Resources/sword.mat"), defaultShadowCastingMode = (ShadowCastingMode)1, ignoreOverlays = false, renderer = renderers.First((Renderer r) => ((Object)r).name == "meshDefaultSword") }, new RendererInfo { defaultMaterial = assetBundle.LoadAsset<Material>("Assets/Resources/sheat.mat"), defaultShadowCastingMode = (ShadowCastingMode)1, ignoreOverlays = false, renderer = renderers.First((Renderer r) => ((Object)r).name == "meshSheath") }, new RendererInfo { defaultMaterial = assetBundle.LoadAsset<Material>("Assets/Resources/sword.mat"), defaultShadowCastingMode = (ShadowCastingMode)1, ignoreOverlays = false, renderer = renderers.First((Renderer r) => ((Object)r).name == "meshEmpoweredSword") }, new RendererInfo { defaultMaterial = assetBundle.LoadAsset<Material>("Assets/Resources/JetstreamSam.mat"), defaultShadowCastingMode = (ShadowCastingMode)1, ignoreOverlays = false, renderer = renderers.First((Renderer r) => ((Object)r).name == "meshArm") } }; }); TryCatchThrow("Mesh Replacements", delegate { //IL_0011: 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_005f: 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_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0164: 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_01ba: 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) skin.meshReplacements = (MeshReplacement[])(object)new MeshReplacement[5] { new MeshReplacement { mesh = assetBundle.LoadAsset<Mesh>("Assets\\SkinMods\\Jetstream_Sam\\Meshes\\sam.mesh"), renderer = renderers.First((Renderer r) => ((Object)r).name == "meshBody") }, new MeshReplacement { mesh = assetBundle.LoadAsset<Mesh>("Assets\\SkinMods\\Jetstream_Sam\\Meshes\\Murasama.mesh"), renderer = renderers.First((Renderer r) => ((Object)r).name == "meshDefaultSword") }, new MeshReplacement { mesh = assetBundle.LoadAsset<Mesh>("Assets\\SkinMods\\Jetstream_Sam\\Meshes\\Sheath.mesh"), renderer = renderers.First((Renderer r) => ((Object)r).name == "meshSheath") }, new MeshReplacement { mesh = assetBundle.LoadAsset<Mesh>("Assets\\SkinMods\\Jetstream_Sam\\Meshes\\Murasama.mesh"), renderer = renderers.First((Renderer r) => ((Object)r).name == "meshEmpoweredSword") }, new MeshReplacement { mesh = assetBundle.LoadAsset<Mesh>("Assets\\SkinMods\\Jetstream_Sam\\Meshes\\sam.mesh"), renderer = renderers.First((Renderer r) => ((Object)r).name == "meshArm") } }; }); TryCatchThrow("Minion Skin Replacements", delegate { skin.minionSkinReplacements = Array.Empty<MinionSkinReplacement>(); }); TryCatchThrow("Projectile Ghost Replacements", delegate { skin.projectileGhostReplacements = Array.Empty<ProjectileGhostReplacement>(); }); Array.Resize(ref skinController.skins, skinController.skins.Length + 1); skinController.skins[skinController.skins.Length - 1] = skin; BodyCatalog.skins[BodyCatalog.FindBodyIndex(val)] = skinController.skins; } catch (FieldException ex) { InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin to \"" + text + "\"")); InstanceLogger.LogWarning((object)("Field causing issue: " + ex.Message)); InstanceLogger.LogError((object)ex.InnerException); } catch (Exception ex2) { InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin to \"" + text + "\"")); InstanceLogger.LogError((object)ex2); } } private static void TryCatchThrow(string message, Action action) { try { action?.Invoke(); } catch (Exception innerException) { throw new FieldException(message, innerException); } } }
SamVoiceMod.dll
Decompiled 2 weeks agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BaseVoiceoverLib; using BepInEx; using BepInEx.Configuration; using Microsoft.CodeAnalysis; using R2API; using RoR2; using RoR2.ContentManagement; using SamVoiceMod.Components; using SamVoiceMod.Modules; using UnityEngine; using UnityEngine.Networking; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("SamVoiceMod")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("SamVoiceMod")] [assembly: AssemblyTitle("SamVoiceMod")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.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 SamVoiceMod { [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.Dannyduartemgs.SamVoiceMod", "SamVoiceMod", "1.0.0")] public class SamVoiceMod : BaseUnityPlugin { public class NSEInfo { public NetworkSoundEventDef nse; public uint akId; public string eventName = string.Empty; public NSEInfo(NetworkSoundEventDef source) { nse = source; akId = source.akId; eventName = source.eventName; } private void DisableSound() { nse.akId = 0u; nse.eventName = string.Empty; } private void EnableSound() { nse.akId = akId; nse.eventName = eventName; } public void ValidateParams() { if (akId == 0) { akId = nse.akId; } if (eventName == string.Empty) { eventName = nse.eventName; } if (!enableVoicelines.Value) { DisableSound(); } else { EnableSound(); } } } public static ConfigEntry<bool> enableVoicelines; public static bool playedSeasonalVoiceline = false; public static AssetBundle assetBundle; public static List<NSEInfo> nseList = new List<NSEInfo>(); public void Awake() { //IL_004b: 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: Expected O, but got Unknown //IL_0066: Expected O, but got Unknown Files.PluginInfo = ((BaseUnityPlugin)this).Info; RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, new Action(OnLoad)); new Content().Initialize(); InitNSE(); enableVoicelines = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("Settings", "Enable Voicelines"), true, new ConfigDescription("Enable Sam voicelines when using the skin.", (AcceptableValueBase)null, Array.Empty<object>())); enableVoicelines.SettingChanged += EnableVoicelines_SettingChanged; } private void EnableVoicelines_SettingChanged(object sender, EventArgs e) { RefreshNSE(); } private void OnLoad() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Invalid comparison between Unknown and I4 //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Expected O, but got Unknown //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Expected O, but got Unknown BodyIndex val = BodyCatalog.FindBodyIndex("UnforgivenBody"); SkinDef val2 = null; if ((int)val != -1) { SkinDef[] array = SkinCatalog.FindSkinsForBody(val); foreach (SkinDef val3 in array) { if (((Object)val3).name == "SamSkin") { val2 = val3; break; } } } if (!Object.op_Implicit((Object)(object)val2)) { ((BaseUnityPlugin)this).Logger.LogError((object)"[SamVoiceMod] ❌ SkinDef not found. Voicelines will not work!"); return; } VoiceoverInfo val4 = new VoiceoverInfo(typeof(SamVoiceoverComponent), val2, "UnforgivenBody"); val4.selectActions = (LobbySelectActions)Delegate.Combine((Delegate?)(object)val4.selectActions, (Delegate?)new LobbySelectActions(OnSkinSelect)); RefreshNSE(); } private void OnSkinSelect(GameObject mannequinObject) { if (!enableVoicelines.Value) { return; } bool flag = false; if (!playedSeasonalVoiceline) { if (DateTime.Today.Month == 1 && DateTime.Today.Day == 1) { Util.PlaySound("Play_Sam_NewYear", mannequinObject); flag = true; } else if (DateTime.Today.Month == 12 && (DateTime.Today.Day == 24 || DateTime.Today.Day == 25)) { Util.PlaySound("Play_Sam_Xmas", mannequinObject); flag = true; } if (flag) { playedSeasonalVoiceline = true; } } if (!flag) { if (Util.CheckRoll(10f, 0f, (CharacterMaster)null)) { Util.PlaySound("Play_Sam_select2", mannequinObject); } else { Util.PlaySound("Play_Sam_select", mannequinObject); } ((BaseUnityPlugin)this).Logger.LogInfo((object)"[SamVoiceMod] Played skin select voiceline."); } } private void InitNSE() { SamVoiceoverComponent.nseSpecial = RegisterNSE("Play_Sam_special"); SamVoiceoverComponent.nseBlock = RegisterNSE("Play_Sam_Blocked"); SamVoiceoverComponent.nseShrineFail = RegisterNSE("Play_Sam_fail"); SamVoiceoverComponent.nseShout = RegisterNSE("Play_Sam_secondary"); SamVoiceoverComponent.nseTitle = RegisterNSE("Play_Sam_TitleDrop"); SamVoiceoverComponent.nseIntro = RegisterNSE("Play_Sam_Intro"); SamVoiceoverComponent.nseHurt = RegisterNSE("Play_Sam_hurt"); SamVoiceoverComponent.nseKanpeki = RegisterNSE("Play_Sam_Kanpeki"); SamVoiceoverComponent.nseSmart = RegisterNSE("Play_Sam_Smart"); SamVoiceoverComponent.nseLogic = RegisterNSE("Play_Sam_Logic"); SamVoiceoverComponent.nseFactor = RegisterNSE("Play_Sam_Factor"); SamVoiceoverComponent.nseThanks = RegisterNSE("Play_Sam_Thanks"); SamVoiceoverComponent.nseIku = RegisterNSE("Play_Sam_jump"); SamVoiceoverComponent.nseMathTruth = RegisterNSE("Play_Sam_MathTruth"); } private NetworkSoundEventDef RegisterNSE(string eventName) { NetworkSoundEventDef val = ScriptableObject.CreateInstance<NetworkSoundEventDef>(); val.eventName = eventName; Content.networkSoundEventDefs.Add(val); nseList.Add(new NSEInfo(val)); return val; } public void RefreshNSE() { foreach (NSEInfo nse in nseList) { nse.ValidateParams(); } } } } namespace SamVoiceMod.Modules { public class Content : IContentPackProvider { [CompilerGenerated] private sealed class <FinalizeAsync>d__8 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public FinalizeAsyncArgs args; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <FinalizeAsync>d__8(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { if (<>1__state != 0) { return false; } <>1__state = -1; args.ReportProgress(1f); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <GenerateContentPackAsync>d__7 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public Content <>4__this; public GetContentPackAsyncArgs args; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <GenerateContentPackAsync>d__7(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { int num = <>1__state; Content content = <>4__this; if (num != 0) { return false; } <>1__state = -1; ContentPack.Copy(content.contentPack, args.output); args.ReportProgress(1f); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <LoadStaticContentAsync>d__6 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public Content <>4__this; public LoadStaticContentAsyncArgs args; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <LoadStaticContentAsync>d__6(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { int num = <>1__state; Content content = <>4__this; if (num != 0) { return false; } <>1__state = -1; content.contentPack.identifier = content.identifier; content.contentPack.networkSoundEventDefs.Add(networkSoundEventDefs.ToArray()); args.ReportProgress(1f); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } internal ContentPack contentPack = new ContentPack(); public static List<NetworkSoundEventDef> networkSoundEventDefs = new List<NetworkSoundEventDef>(); public string identifier => "com.Dannyduartemgs.SamVoiceMod"; public void Initialize() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown ContentManager.collectContentPackProviders += new CollectContentPackProvidersDelegate(AddContentPackProvider); } private void AddContentPackProvider(AddContentPackProviderDelegate addContentPackProvider) { addContentPackProvider.Invoke((IContentPackProvider)(object)this); } [IteratorStateMachine(typeof(<LoadStaticContentAsync>d__6))] public IEnumerator LoadStaticContentAsync(LoadStaticContentAsyncArgs args) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <LoadStaticContentAsync>d__6(0) { <>4__this = this, args = args }; } [IteratorStateMachine(typeof(<GenerateContentPackAsync>d__7))] public IEnumerator GenerateContentPackAsync(GetContentPackAsyncArgs args) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <GenerateContentPackAsync>d__7(0) { <>4__this = this, args = args }; } [IteratorStateMachine(typeof(<FinalizeAsync>d__8))] public IEnumerator FinalizeAsync(FinalizeAsyncArgs args) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <FinalizeAsync>d__8(0) { args = args }; } internal static NetworkSoundEventDef CreateNetworkSoundEventDef(string eventName) { NetworkSoundEventDef val = ScriptableObject.CreateInstance<NetworkSoundEventDef>(); val.akId = AkSoundEngine.GetIDFromString(eventName); val.eventName = eventName; networkSoundEventDefs.Add(val); return val; } } public static class Files { public static PluginInfo PluginInfo; public static string assemblyDir => Path.GetDirectoryName(PluginInfo.Location); } public static class SoundBanks { private static bool initialized; public static string SoundBankDirectory => Files.assemblyDir; public static void Init() { if (!initialized) { initialized = true; string text = Path.Combine(SoundBankDirectory, "SamSoundbank.sound"); if (!File.Exists(text)) { Debug.LogError((object)("[SamVoiceMod] ❌ Soundbank not found: " + text)); return; } SoundBanks.Add(File.ReadAllBytes(text)); Debug.Log((object)("[SamVoiceMod] ✅ Loaded soundbank: " + text)); } } } } namespace SamVoiceMod.Components { public class SamVoiceoverComponent : BaseVoiceoverComponent { public static NetworkSoundEventDef nseShout; public static NetworkSoundEventDef nseSpecial; public static NetworkSoundEventDef nseBlock; public static NetworkSoundEventDef nseShrineFail; public static NetworkSoundEventDef nseTitle; public static NetworkSoundEventDef nseIntro; public static NetworkSoundEventDef nseHurt; public static NetworkSoundEventDef nseKanpeki; public static NetworkSoundEventDef nseSmart; public static NetworkSoundEventDef nseLogic; public static NetworkSoundEventDef nseFactor; public static NetworkSoundEventDef nseThanks; public static NetworkSoundEventDef nseIku; public static NetworkSoundEventDef nseMathTruth; private float lowHealthCooldown; private float blockedCooldown; private float specialCooldown; private float levelCooldown; private float shrineOfChanceFailCooldown; private float secondaryCooldown; protected override void Start() { ((BaseVoiceoverComponent)this).Start(); } protected override void FixedUpdate() { ((BaseVoiceoverComponent)this).FixedUpdate(); if (lowHealthCooldown > 0f) { lowHealthCooldown -= Time.fixedDeltaTime; } if (blockedCooldown > 0f) { blockedCooldown -= Time.fixedDeltaTime; } if (specialCooldown > 0f) { specialCooldown -= Time.fixedDeltaTime; } if (levelCooldown > 0f) { levelCooldown -= Time.fixedDeltaTime; } if (shrineOfChanceFailCooldown > 0f) { levelCooldown -= Time.fixedDeltaTime; } if (secondaryCooldown > 0f) { secondaryCooldown -= Time.fixedDeltaTime; } } public override void PlaySpawn() { ((BaseVoiceoverComponent)this).TryPlaySound("Play_Sam_spawn", 1f, false); } public override void PlayJump() { ((BaseVoiceoverComponent)this).TryPlayNetworkSound(nseIku, 0f, false); } public override void PlayDeath() { ((BaseVoiceoverComponent)this).TryPlaySound("Play_Sam_death", 1.5f, true); } public override void PlayHurt(float percentHPLost) { if (percentHPLost >= 0.1f) { ((BaseVoiceoverComponent)this).TryPlayNetworkSound(nseHurt, 0f, false); } } public override void PlaySecondaryAuthority(GenericSkill skill) { if (!(secondaryCooldown > 0f) && ((BaseVoiceoverComponent)this).TryPlayNetworkSound(nseShout, 0f, false)) { secondaryCooldown = 3.5f; } } public override void PlayTeleporterStart() { ((BaseVoiceoverComponent)this).TryPlaySound("Play_Sam_tpstart", 3f, false); } public override void PlayTeleporterFinish() { ((BaseVoiceoverComponent)this).TryPlaySound("Play_Sam_tpend", 3.8f, false); } public override void PlayVictory() { ((BaseVoiceoverComponent)this).TryPlaySound("Play_Sam_yay", 3.8f, true); } public override void PlayLevelUp() { if (!(levelCooldown > 0f) && ((BaseVoiceoverComponent)this).TryPlaySound("Play_Sam_levelup", 3f, false)) { levelCooldown = 60f; } } public override void PlayLowHealth() { if (!(lowHealthCooldown > 0f) && ((BaseVoiceoverComponent)this).TryPlaySound("Play_Sam_lowhealth", 1f, false)) { lowHealthCooldown = 45f; } } public override void PlaySpecialAuthority(GenericSkill skill) { if (!(specialCooldown > 0f) && ((BaseVoiceoverComponent)this).TryPlayNetworkSound(nseSpecial, 0f, false)) { specialCooldown = 15f; } } public void PlayAcquireLegendary() { ((BaseVoiceoverComponent)this).TryPlaySound("Play_Sam_yay", 5.75f, false); } public override void PlayShrineOfChanceFailServer() { if (NetworkServer.active && !(shrineOfChanceFailCooldown > 0f) && ((BaseVoiceoverComponent)this).TryPlaySound("Play_Sam_fail", 1f, false)) { shrineOfChanceFailCooldown = 60f; } } public override bool ComponentEnableVoicelines() { return SamVoiceMod.enableVoicelines.Value; } } }