Decompiled source of HoshinoBandit v1.0.1
HoshinoBandit.dll
Decompiled a month 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.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Security.Permissions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using HG; using IL.RoR2; using Mono.Cecil.Cil; using MonoMod.Cil; using MonoMod.RuntimeDetour; using MonoMod.RuntimeDetour.HookGen; using On.EntityStates; using On.RoR2; using RiskOfOptions; using RiskOfOptions.OptionConfigs; using RiskOfOptions.Options; using RoR2; using RoR2.Audio; using RoR2.ContentManagement; using RuneFoxMods.DynamicSkins; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Networking; using UnityEngine.Rendering; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] namespace HoshinoBandit { [BepInPlugin("com.Miyowi.HoshinoBandit", "HoshinoBandit", "1.0.1")] public class HoshinoBanditPlugin : BaseUnityPlugin { private class FieldException : Exception { public FieldException(string message, Exception innerException) : base(message, innerException) { } } public class DynamicSkinExtension { private Modification DefHoshinoBandithalobaseModification; private Modification DefHoshinoBanditbackhair_01Modification; internal void BeforeStart() { //IL_0038: Unknown result type (might be due to invalid IL or missing references) _DynamicSkinManager.InstanceLogger = ((BaseUnityPlugin)Instance).Logger; new Hook((MethodBase)typeof(SkinDef).GetMethod("ApplyAsync"), (Delegate)new Func<Func<SkinDef, GameObject, List<AssetReferenceT<Material>>, List<AssetReferenceT<Mesh>>, int, IEnumerator>, SkinDef, GameObject, List<AssetReferenceT<Material>>, List<AssetReferenceT<Mesh>>, int, IEnumerator>(_DynamicSkinManager.SkinDefApply)).Apply(); } internal void AfterStart() { InitializeModifications(); InitializeDynamicBones(); AddModificationsToList(); } internal void BeforeBodyCatalogInit() { Bandit2BodyDefHoshinoBanditSkinAddedEvent += onSkinAdded; } internal void AfterBodyCatalogInit() { } private void InitializeModifications() { DefHoshinoBandithalobaseModification = new Modification("halobase.prefab", "head", "Bandit2Body", "MIYOWI_SKIN_DEFHOSHINOBANDIT_NAME", 24, AffectsBaseModel: true, assetBundle); DefHoshinoBanditbackhair_01Modification = new Modification("backhair_01.prefab", "head", "Bandit2Body", "MIYOWI_SKIN_DEFHOSHINOBANDIT_NAME", 27, AffectsBaseModel: true, assetBundle); } private void InitializeDynamicBones() { //IL_003d: 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_0065: 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_00b5: 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_0151: 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_0179: 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_01c9: 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_0229: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Unknown result type (might be due to invalid IL or missing references) DefHoshinoBandithalobaseModification.dynamicBoneData = new DynamicBoneData("halobase", 0.55f, null, 0.5f, null, 0.2f, null, 0f, null, 0f, null, 0f, new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new List<DynamicBoneColliderData> { new DynamicBoneColliderData("head", (Direction)1, new Vector3(0f, 0f, 0f), (Bound)0, 0.21f, 0f), new DynamicBoneColliderData("chest", (Direction)1, new Vector3(0f, 0f, 0f), (Bound)0, 0.17f, 1.02f), new DynamicBoneColliderData("stomach", (Direction)1, new Vector3(0f, -0.08f, 0f), (Bound)0, 0.18f, 0.31f) }, new List<string>(), (FreezeAxis)0, 120f); DefHoshinoBanditbackhair_01Modification.dynamicBoneData = new DynamicBoneData("backhair_01", 0.421f, null, 0.12f, null, 0.71f, null, 0f, null, 0.03f, null, 0f, new Vector3(0f, 0f, 0f), new Vector3(0f, -0.01f, 0f), new Vector3(0f, 0f, 0f), new List<DynamicBoneColliderData> { new DynamicBoneColliderData("stomach", (Direction)1, new Vector3(0f, -0.08f, 0f), (Bound)0, 0.18f, 0.31f), new DynamicBoneColliderData("chest", (Direction)1, new Vector3(0f, 0f, 0f), (Bound)0, 0.17f, 1.02f), new DynamicBoneColliderData("head", (Direction)1, new Vector3(0f, 0f, 0f), (Bound)0, 0.21f, 0f), new DynamicBoneColliderData("upper_arm.l", (Direction)1, new Vector3(0f, 0.13f, 0f), (Bound)0, 0.12f, 0f), new DynamicBoneColliderData("upper_arm.r", (Direction)1, new Vector3(0f, 0.13f, 0f), (Bound)0, 0.12f, 0f) }, new List<string>(), (FreezeAxis)0, 45f); } private void AddModificationsToList() { _DynamicSkinManager.AddModification("MIYOWI_SKIN_DEFHOSHINOBANDIT_NAME", 24, DefHoshinoBandithalobaseModification); _DynamicSkinManager.AddModification("MIYOWI_SKIN_DEFHOSHINOBANDIT_NAME", 27, DefHoshinoBanditbackhair_01Modification); } private static void onSkinAdded(object sender, SkinAddedArgs e) { _DynamicSkinManager.AddSkinDef(e.skinDef); } } public delegate void VoidDelegate(); public class SkinAddedArgs : EventArgs { public SkinDef skinDef { get; } public GameObject bodyPrefab { get; } public SkinAddedArgs(SkinDef newSkinDef, GameObject newGameObject) { skinDef = newSkinDef; bodyPrefab = newGameObject; } } public static AssetBundle assetBundle; public static ConfigFile config; private static readonly List<Material> materialsWithRoRShader = new List<Material>(); private static DynamicSkinExtension _DynamicSkinExtension = new DynamicSkinExtension(); private static DynamicSkinManager _DynamicSkinManager = new DynamicSkinManager(); private static VoidDelegate BeforeStartDelegate; private static VoidDelegate AfterStartDelegate; private static VoidDelegate BeforeBodyCatalogDelegate; private static VoidDelegate AfterBodyCatalogDelegate; internal static HoshinoBanditPlugin Instance { get; private set; } internal static ManualLogSource InstanceLogger { get { HoshinoBanditPlugin instance = Instance; if (instance == null) { return null; } return ((BaseUnityPlugin)instance).Logger; } } private static event EventHandler<SkinAddedArgs> Bandit2BodyDefHoshinoBanditSkinAddedEvent; private void Awake() { Instance = this; config = ((BaseUnityPlugin)this).Config; HoshinoVoiceAssets.Init(); } private void Start() { Instance = this; BeforeStart(); using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("HoshinoBandit.miyowihoshinobandit")) { 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(); AfterStart(); Options.Init(); } private void BeforeStart() { BeforeStartDelegate = (VoidDelegate)Delegate.Combine(BeforeStartDelegate, new VoidDelegate(_DynamicSkinExtension.BeforeStart)); BeforeStartDelegate?.Invoke(); } private void AfterStart() { AfterStartDelegate = (VoidDelegate)Delegate.Combine(AfterStartDelegate, new VoidDelegate(_DynamicSkinExtension.AfterStart)); AfterStartDelegate?.Invoke(); } private static void BeforeBodyCatalogInit() { BeforeBodyCatalogDelegate = (VoidDelegate)Delegate.Combine(BeforeBodyCatalogDelegate, new VoidDelegate(_DynamicSkinExtension.BeforeBodyCatalogInit)); BeforeBodyCatalogDelegate?.Invoke(); } private static void AfterBodyCatalogInit() { AfterBodyCatalogDelegate = (VoidDelegate)Delegate.Combine(AfterBodyCatalogDelegate, new VoidDelegate(_DynamicSkinExtension.AfterBodyCatalogInit)); AfterBodyCatalogDelegate?.Invoke(); } private static void ReplaceShaders() { LoadMaterialsWithReplacedShader("RoR2/Base/Shaders/HGStandard.shader", "Assets/Skins/HoshinoBandit/Skin/matBody.mat", "Assets/Skins/HoshinoBandit/Skin/matShotgun.mat", "Assets/Skins/HoshinoBandit/Skin/matSkirt.mat", "Assets/Skins/HoshinoBandit/Skin/matHalo.mat"); } private static void LoadMaterialsWithReplacedShader(string shaderPath, params string[] materialPaths) { //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) 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("MIYOWI_SKIN_DEFHOSHINOBANDIT_NAME", "Hoshino"); } private static void BodyCatalogInit() { BeforeBodyCatalogInit(); AddBandit2BodyDefHoshinoBanditSkin(); AfterBodyCatalogInit(); } private static void Bandit2BodyDefHoshinoBanditSkinAdded(SkinDef skinDef, GameObject bodyPrefab) { HoshinoBanditPlugin.Bandit2BodyDefHoshinoBanditSkinAddedEvent(Instance, new SkinAddedArgs(skinDef, bodyPrefab)); } private static void AddBandit2BodyDefHoshinoBanditSkin() { string text = "Bandit2Body"; string text2 = "DefHoshinoBandit"; 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); gameObject.GetComponentsInChildren<Light>(true); SkinDef skin = ScriptableObject.CreateInstance<SkinDef>(); SkinDefParams skinParams = ScriptableObject.CreateInstance<SkinDefParams>(); skin.skinDefParams = skinParams; TryCatchThrow("Icon", delegate { skin.icon = assetBundle.LoadAsset<Sprite>("Assets\\SkinMods\\HoshinoBandit\\Icons\\DefHoshinoBanditIcon.png"); }); ((Object)skin).name = text2; skin.nameToken = "MIYOWI_SKIN_DEFHOSHINOBANDIT_NAME"; skin.rootObject = gameObject; TryCatchThrow("Base Skins", delegate { skin.baseSkins = (SkinDef[])(object)new SkinDef[1] { skinController.skins[0] }; }); TryCatchThrow("Unlockable Name", delegate { skin.unlockableDef = null; }); TryCatchThrow("Game Object Activations", delegate { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0055: 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_00a2: 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) skinParams.gameObjectActivations = (GameObjectActivation[])(object)new GameObjectActivation[2] { new GameObjectActivation { gameObject = ((Component)renderers.First((Renderer r) => ((Object)r).name == "Bandit2HatMesh")).gameObject, shouldActivate = false }, new GameObjectActivation { gameObject = ((Component)renderers.First((Renderer r) => ((Object)r).name == "Bandit2ArmsMesh")).gameObject, shouldActivate = false } }; }); TryCatchThrow("Renderer Infos", delegate { //IL_0010: 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_006d: 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_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0096: 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_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: 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_01ac: 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_0209: 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) skinParams.rendererInfos = (RendererInfo[])(object)new RendererInfo[5] { new RendererInfo { defaultMaterial = assetBundle.LoadAsset<Material>("Assets/Skins/HoshinoBandit/Skin/matBody.mat"), defaultShadowCastingMode = (ShadowCastingMode)0, ignoreOverlays = false, renderer = renderers.First((Renderer r) => ((Object)r).name == "Bandit2BodyMesh") }, new RendererInfo { defaultMaterial = assetBundle.LoadAsset<Material>("Assets/Skins/HoshinoBandit/Skin/matShotgun.mat"), defaultShadowCastingMode = (ShadowCastingMode)0, ignoreOverlays = false, renderer = renderers.First((Renderer r) => ((Object)r).name == "BanditShotgunMesh") }, new RendererInfo { defaultMaterial = assetBundle.LoadAsset<Material>("Assets/Skins/HoshinoBandit/Skin/matBody.mat"), defaultShadowCastingMode = (ShadowCastingMode)0, ignoreOverlays = false, renderer = renderers.First((Renderer r) => ((Object)r).name == "BanditPistolMesh") }, new RendererInfo { defaultMaterial = assetBundle.LoadAsset<Material>("Assets/Skins/HoshinoBandit/Skin/matSkirt.mat"), defaultShadowCastingMode = (ShadowCastingMode)0, ignoreOverlays = false, renderer = renderers.First((Renderer r) => ((Object)r).name == "Bandit2AccessoriesMesh") }, new RendererInfo { defaultMaterial = assetBundle.LoadAsset<Material>("Assets/Skins/HoshinoBandit/Skin/matHalo.mat"), defaultShadowCastingMode = (ShadowCastingMode)0, ignoreOverlays = false, renderer = renderers.First((Renderer r) => ((Object)r).name == "Bandit2CoatMesh") } }; }); TryCatchThrow("Mesh Replacements", delegate { //IL_0010: 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_005e: 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_00b4: 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_00be: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_010c: 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_0162: 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_016c: 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_01ba: Unknown result type (might be due to invalid IL or missing references) skinParams.meshReplacements = (MeshReplacement[])(object)new MeshReplacement[5] { new MeshReplacement { mesh = assetBundle.LoadAsset<Mesh>("Assets\\SkinMods\\HoshinoBandit\\Meshes\\HoshinoMesh.mesh"), renderer = renderers.First((Renderer r) => ((Object)r).name == "Bandit2BodyMesh") }, new MeshReplacement { mesh = assetBundle.LoadAsset<Mesh>("Assets\\SkinMods\\HoshinoBandit\\Meshes\\Hosino_Origninal_Weapon.mesh"), renderer = renderers.First((Renderer r) => ((Object)r).name == "BanditShotgunMesh") }, new MeshReplacement { mesh = assetBundle.LoadAsset<Mesh>("Assets\\SkinMods\\HoshinoBandit\\Meshes\\HoshinoPistolMesh.mesh"), renderer = renderers.First((Renderer r) => ((Object)r).name == "BanditPistolMesh") }, new MeshReplacement { mesh = assetBundle.LoadAsset<Mesh>("Assets\\SkinMods\\HoshinoBandit\\Meshes\\HoshinoMeshSkirt.mesh"), renderer = renderers.First((Renderer r) => ((Object)r).name == "Bandit2AccessoriesMesh") }, new MeshReplacement { mesh = assetBundle.LoadAsset<Mesh>("Assets\\SkinMods\\HoshinoBandit\\Meshes\\HoshinoMeshHalo.mesh"), renderer = renderers.First((Renderer r) => ((Object)r).name == "Bandit2CoatMesh") } }; }); TryCatchThrow("Light Infos", delegate { skinParams.lightReplacements = (LightInfo[])(object)new LightInfo[0]; }); TryCatchThrow("Minion Skin Replacements", delegate { skinParams.minionSkinReplacements = Array.Empty<MinionSkinReplacement>(); }); TryCatchThrow("Projectile Ghost Replacements", delegate { skinParams.projectileGhostReplacements = Array.Empty<ProjectileGhostReplacement>(); }); Array.Resize(ref skinController.skins, skinController.skins.Length + 1); skinController.skins[skinController.skins.Length - 1] = skin; MwSkinEvents.Init(skin); Bandit2BodyDefHoshinoBanditSkinAdded(skin, val); } 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); } } private static void TryAddComponent<T>(GameObject obj) where T : Component { if (!Object.op_Implicit((Object)(object)obj.GetComponent<T>())) { obj.AddComponent<T>(); } } } internal class Content { internal static void AddNetworkSoundEventDef(NetworkSoundEventDef networkSoundEventDef) { ContentPacks.networkSoundEventDefs.Add(networkSoundEventDef); } internal static NetworkSoundEventDef CreateAndAddNetworkSoundEventDef(string eventName) { NetworkSoundEventDef obj = ScriptableObject.CreateInstance<NetworkSoundEventDef>(); obj.akId = AkSoundEngine.GetIDFromString(eventName); obj.eventName = eventName; AddNetworkSoundEventDef(obj); return obj; } } internal class ContentPacks : IContentPackProvider { internal ContentPack contentPack = new ContentPack(); public static List<NetworkSoundEventDef> networkSoundEventDefs = new List<NetworkSoundEventDef>(); public string identifier => "com.Miyowi.HoshinoBandit"; 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(ContentManager_collectContentPackProviders); } private void ContentManager_collectContentPackProviders(AddContentPackProviderDelegate addContentPackProvider) { addContentPackProvider.Invoke((IContentPackProvider)(object)this); } public IEnumerator LoadStaticContentAsync(LoadStaticContentAsyncArgs args) { contentPack.identifier = identifier; contentPack.networkSoundEventDefs.Add(networkSoundEventDefs.ToArray()); args.ReportProgress(1f); yield break; } public IEnumerator GenerateContentPackAsync(GetContentPackAsyncArgs args) { ContentPack.Copy(contentPack, args.output); args.ReportProgress(1f); yield break; } public IEnumerator FinalizeAsync(FinalizeAsyncArgs args) { args.ReportProgress(1f); yield break; } } public static class HoshinoVoiceAssets { public class VoiceInfo { public NetworkSoundEventDef sound; public float approxDuration; } public static VoiceInfo[] skinSelect; public static VoiceInfo[] leavePod; public static VoiceInfo[] idle; public static VoiceInfo[] death; public static VoiceInfo[] useEquipment; public static VoiceInfo[] useSpecial; public static VoiceInfo[] useUtility; public static VoiceInfo[] useSecondary; public static VoiceInfo[] usePrimary; public static VoiceInfo[] jump; public static VoiceInfo[] startTP; public static VoiceInfo[] defeatTPBoss; public static VoiceInfo[] endTP; public static VoiceInfo[] getItem; public static VoiceInfo[] hurt; public static VoiceInfo[] heavyHeal; public static VoiceInfo[] leaveStage; public static VoiceInfo[] hugeFailShrine; public static void Init() { CreateSounds(); RoR2Application.onLoadFinished = (Action)Delegate.Combine(RoR2Application.onLoadFinished, new Action(Options.OnLoadFinished)); MwVoiceController.Init(); new ContentPacks().Initialize(); } private static void CreateSounds() { skinSelect = new VoiceInfo[4] { new VoiceInfo { sound = Content.CreateAndAddNetworkSoundEventDef("Play_Hoshino_Select_1"), approxDuration = 1.8f }, new VoiceInfo { sound = Content.CreateAndAddNetworkSoundEventDef("Play_Hoshino_Select_2"), approxDuration = 5.8f }, new VoiceInfo { sound = Content.CreateAndAddNetworkSoundEventDef("Play_Hoshino_Select_3"), approxDuration = 7.5f }, new VoiceInfo { sound = Content.CreateAndAddNetworkSoundEventDef("Play_Hoshino_Select_4"), approxDuration = 2f } }; leavePod = new VoiceInfo[2] { new VoiceInfo { sound = Content.CreateAndAddNetworkSoundEventDef("Play_Hoshino_Pod_1"), approxDuration = 1.4f }, new VoiceInfo { sound = Content.CreateAndAddNetworkSoundEventDef("Play_Hoshino_Pod_2"), approxDuration = 2.3f } }; idle = new VoiceInfo[9] { new VoiceInfo { sound = Content.CreateAndAddNetworkSoundEventDef("Play_Hoshino_Idle_2"), approxDuration = 2.5f }, new VoiceInfo { sound = Content.CreateAndAddNetworkSoundEventDef("Play_Hoshino_Idle_3"), approxDuration = 6f }, new VoiceInfo { sound = Content.CreateAndAddNetworkSoundEventDef("Play_Hoshino_Idle_4"), approxDuration = 2.9f }, new VoiceInfo { sound = Content.CreateAndAddNetworkSoundEventDef("Play_Hoshino_Idle_5"), approxDuration = 5.3f }, new VoiceInfo { sound = Content.CreateAndAddNetworkSoundEventDef("Play_Hoshino_Idle_6"), approxDuration = 3.6f }, new VoiceInfo { sound = Content.CreateAndAddNetworkSoundEventDef("Play_Hoshino_Idle_7"), approxDuration = 2.2f }, new VoiceInfo { sound = Content.CreateAndAddNetworkSoundEventDef("Play_Hoshino_Idle_8"), approxDuration = 7.4f }, new VoiceInfo { sound = Content.CreateAndAddNetworkSoundEventDef("Play_Hoshino_Idle_9"), approxDuration = 1.5f }, new VoiceInfo { sound = Content.CreateAndAddNetworkSoundEventDef("Play_Hoshino_Idle_10"), approxDuration = 1.4f } }; death = new VoiceInfo[4] { new VoiceInfo { sound = Content.CreateAndAddNetworkSoundEventDef("Play_Hoshino_Death_1"), approxDuration = 2.8f }, new VoiceInfo { sound = Content.CreateAndAddNetworkSoundEventDef("Play_Hoshino_Death_2"), approxDuration = 2.3f }, new VoiceInfo { sound = Content.CreateAndAddNetworkSoundEventDef("Play_Hoshino_Death_3"), approxDuration = 2.8f }, new VoiceInfo { sound = Content.CreateAndAddNetworkSoundEventDef("Play_Hoshino_Death_4"), approxDuration = 2.6f } }; useEquipment = new VoiceInfo[4] { new VoiceInfo { sound = Content.CreateAndAddNetworkSoundEventDef("Play_Hoshino_Equipment_1"), approxDuration = 1.9f }, new VoiceInfo { sound = Content.CreateAndAddNetworkSoundEventDef("Play_Hoshino_Select_1"), approxDuration = 1.8f }, new VoiceInfo { sound = Content.CreateAndAddNetworkSoundEventDef("Play_Hoshino_TPStart_2"), approxDuration = 1.3f }, new VoiceInfo { sound = Content.CreateAndAddNetworkSoundEventDef("Play_Hoshino_TPStart_5"), approxDuration = 1.4f } }; useSpecial = new VoiceInfo[6] { new VoiceInfo { sound = Content.CreateAndAddNetworkSoundEventDef("Play_Hoshino_Special_1"), approxDuration = 0.9f }, new VoiceInfo { sound = Content.CreateAndAddNetworkSoundEventDef("Play_Hoshino_Special_3"), approxDuration = 1.4f }, new VoiceInfo { sound = Content.CreateAndAddNetworkSoundEventDef("Play_Hoshino_Special_4"), approxDuration = 1f }, new VoiceInfo { sound = Content.CreateAndAddNetworkSoundEventDef("Play_Hoshino_Special_5"), approxDuration = 2f }, new VoiceInfo { sound = Content.CreateAndAddNetworkSoundEventDef("Play_Hoshino_Primary_4"), approxDuration = 0.8f }, new VoiceInfo { sound = Content.CreateAndAddNetworkSoundEventDef("Play_Hoshino_Special_6"), approxDuration = 2f } }; useUtility = new VoiceInfo[5] { new VoiceInfo { sound = Content.CreateAndAddNetworkSoundEventDef("Play_Hoshino_Utility_1"), approxDuration = 1.3f }, new VoiceInfo { sound = Content.CreateAndAddNetworkSoundEventDef("Play_Hoshino_Utility_2"), approxDuration = 1f }, new VoiceInfo { sound = Content.CreateAndAddNetworkSoundEventDef("Play_Hoshino_Utility_3"), approxDuration = 1.3f }, new VoiceInfo { sound = Content.CreateAndAddNetworkSoundEventDef("Play_Hoshino_Utility_4"), approxDuration = 1f }, new VoiceInfo { sound = Content.CreateAndAddNetworkSoundEventDef("Play_Hoshino_Special_2"), approxDuration = 2f } }; useSecondary = new VoiceInfo[4] { new VoiceInfo { sound = Content.CreateAndAddNetworkSoundEventDef("Play_Hoshino_Secondary_1"), approxDuration = 0.6f }, new VoiceInfo { sound = Content.CreateAndAddNetworkSoundEventDef("Play_Hoshino_Secondary_2"), approxDuration = 0.8f }, new VoiceInfo { sound = Content.CreateAndAddNetworkSoundEventDef("Play_Hoshino_Secondary_3"), approxDuration = 0.4f }, new VoiceInfo { sound = Content.CreateAndAddNetworkSoundEventDef("Play_Hoshino_Secondary_4"), approxDuration = 0.5f } }; usePrimary = new VoiceInfo[3] { new VoiceInfo { sound = Content.CreateAndAddNetworkSoundEventDef("Play_Hoshino_Primary_1"), approxDuration = 0.4f }, new VoiceInfo { sound = Content.CreateAndAddNetworkSoundEventDef("Play_Hoshino_Primary_2"), approxDuration = 0.4f }, new VoiceInfo { sound = Content.CreateAndAddNetworkSoundEventDef("Play_Hoshino_Primary_3"), approxDuration = 0.4f } }; jump = new VoiceInfo[3] { new VoiceInfo { sound = Content.CreateAndAddNetworkSoundEventDef("Play_Hoshino_Jump_1"), approxDuration = 0.4f }, new VoiceInfo { sound = Content.CreateAndAddNetworkSoundEventDef("Play_Hoshino_Jump_2"), approxDuration = 0.4f }, new VoiceInfo { sound = Content.CreateAndAddNetworkSoundEventDef("Play_Hoshino_Jump_3"), approxDuration = 0.4f } }; startTP = new VoiceInfo[5] { new VoiceInfo { sound = Content.CreateAndAddNetworkSoundEventDef("Play_Hoshino_TPStart_1"), approxDuration = 1f }, new VoiceInfo { sound = Content.CreateAndAddNetworkSoundEventDef("Play_Hoshino_TPStart_3"), approxDuration = 1.8f }, new VoiceInfo { sound = Content.CreateAndAddNetworkSoundEventDef("Play_Hoshino_TPStart_4"), approxDuration = 2.2f }, new VoiceInfo { sound = Content.CreateAndAddNetworkSoundEventDef("Play_Hoshino_TPStart_5"), approxDuration = 1.4f }, new VoiceInfo { sound = Content.CreateAndAddNetworkSoundEventDef("Play_Hoshino_TPStart_6"), approxDuration = 1.4f } }; defeatTPBoss = new VoiceInfo[4] { new VoiceInfo { sound = Content.CreateAndAddNetworkSoundEventDef("Play_Hoshino_TPBossDefeat_1"), approxDuration = 2.1f }, new VoiceInfo { sound = Content.CreateAndAddNetworkSoundEventDef("Play_Hoshino_TPBossDefeat_2"), approxDuration = 3.8f }, new VoiceInfo { sound = Content.CreateAndAddNetworkSoundEventDef("Play_Hoshino_TPBossDefeat_3"), approxDuration = 1.6f }, new VoiceInfo { sound = Content.CreateAndAddNetworkSoundEventDef("Play_Hoshino_TPBossDefeat_4"), approxDuration = 2.2f } }; endTP = new VoiceInfo[5] { new VoiceInfo { sound = Content.CreateAndAddNetworkSoundEventDef("Play_Hoshino_TPEnd_1"), approxDuration = 7f }, new VoiceInfo { sound = Content.CreateAndAddNetworkSoundEventDef("Play_Hoshino_TPEnd_2"), approxDuration = 4.2f }, new VoiceInfo { sound = Content.CreateAndAddNetworkSoundEventDef("Play_Hoshino_TPEnd_3"), approxDuration = 1.6f }, new VoiceInfo { sound = Content.CreateAndAddNetworkSoundEventDef("Play_Hoshino_TPEnd_5"), approxDuration = 1.5f }, new VoiceInfo { sound = Content.CreateAndAddNetworkSoundEventDef("Play_Hoshino_TPEnd_6"), approxDuration = 2f } }; getItem = new VoiceInfo[5] { new VoiceInfo { sound = Content.CreateAndAddNetworkSoundEventDef("Play_Hoshino_Item_1"), approxDuration = 1.6f }, new VoiceInfo { sound = Content.CreateAndAddNetworkSoundEventDef("Play_Hoshino_Item_2"), approxDuration = 2f }, new VoiceInfo { sound = Content.CreateAndAddNetworkSoundEventDef("Play_Hoshino_Item_3"), approxDuration = 2f }, new VoiceInfo { sound = Content.CreateAndAddNetworkSoundEventDef("Play_Hoshino_Item_4"), approxDuration = 1.4f }, new VoiceInfo { sound = Content.CreateAndAddNetworkSoundEventDef("Play_Hoshino_Item_5"), approxDuration = 1f } }; hurt = new VoiceInfo[7] { new VoiceInfo { sound = Content.CreateAndAddNetworkSoundEventDef("Play_Hoshino_Hurt_1"), approxDuration = 1.4f }, new VoiceInfo { sound = Content.CreateAndAddNetworkSoundEventDef("Play_Hoshino_Hurt_2"), approxDuration = 0.5f }, new VoiceInfo { sound = Content.CreateAndAddNetworkSoundEventDef("Play_Hoshino_Hurt_3"), approxDuration = 0.6f }, new VoiceInfo { sound = Content.CreateAndAddNetworkSoundEventDef("Play_Hoshino_Hurt_4"), approxDuration = 0.9f }, new VoiceInfo { sound = Content.CreateAndAddNetworkSoundEventDef("Play_Hoshino_Hurt_5"), approxDuration = 0.9f }, new VoiceInfo { sound = Content.CreateAndAddNetworkSoundEventDef("Play_Hoshino_Hurt_6"), approxDuration = 0.7f }, new VoiceInfo { sound = Content.CreateAndAddNetworkSoundEventDef("Play_Hoshino_Hurt_7"), approxDuration = 0.7f } }; heavyHeal = new VoiceInfo[1] { new VoiceInfo { sound = Content.CreateAndAddNetworkSoundEventDef("Play_Hoshino_HeavyHeal_1"), approxDuration = 1.2f } }; leaveStage = new VoiceInfo[5] { new VoiceInfo { sound = Content.CreateAndAddNetworkSoundEventDef("Play_Hoshino_Teleport_1"), approxDuration = 1.3f }, new VoiceInfo { sound = Content.CreateAndAddNetworkSoundEventDef("Play_Hoshino_Teleport_2"), approxDuration = 0.9f }, new VoiceInfo { sound = Content.CreateAndAddNetworkSoundEventDef("Play_Hoshino_Teleport_3"), approxDuration = 1.2f }, new VoiceInfo { sound = Content.CreateAndAddNetworkSoundEventDef("Play_Hoshino_Teleport_4"), approxDuration = 1.4f }, new VoiceInfo { sound = Content.CreateAndAddNetworkSoundEventDef("Play_Hoshino_Teleport_5"), approxDuration = 2f } }; hugeFailShrine = new VoiceInfo[1] { new VoiceInfo { sound = Content.CreateAndAddNetworkSoundEventDef("Play_Hoshino_LetsGoGambling_1"), approxDuration = 2.3f } }; } } public class MwExpressionController : MonoBehaviour { private enum Feature { Eyes, Brows, Mouth } private class ExpressionState { public Coroutine coroutine; public Feature feature; public int blendShapeIndex; } private Coroutine eyesCoroutine; private Coroutine browsCoroutine; private Coroutine mouthCoroutine; private Dictionary<Feature, ExpressionState> featureCoroutines = new Dictionary<Feature, ExpressionState> { { Feature.Eyes, null }, { Feature.Brows, null }, { Feature.Mouth, null } }; private Dictionary<Feature, bool> featureActive = new Dictionary<Feature, bool> { { Feature.Eyes, false }, { Feature.Brows, false }, { Feature.Mouth, false } }; private bool inDeathState; private float blinkInterval; private float blinkStopwatch; private bool doubleBlink; private static bool hasLoadedBlendShapes; private static int eyesBlinkIndex; private static int eyesSquintIndex; private static int eyesConfusedIndex; private static int browsHurtIndex; private static int mouthSeriousIndex; private static int mouthAngryIndex; private static int hideHaloIndex; public static void Init() { SubscribeEvents(); } private static void SubscribeEvents() { MwSkinEvents.SkinAppliedRun += AddExpressionController; MwSkinEvents.SkinAppliedRun += LoadBlendShapes; MwSkinEvents.TakeDamage += ExpressionOnHit; MwSkinEvents.Death += ExpressionOnDeath; } private static void LoadBlendShapes(GameObject body) { if (!hasLoadedBlendShapes) { GetBlendShapesIndexes(body); } } private void CancelCurrentExpressions(SkinnedMeshRenderer renderer) { foreach (ExpressionState value in featureCoroutines.Values) { if (value != null) { CancelExpression(renderer, value); } } } private void CancelExpression(SkinnedMeshRenderer renderer, ExpressionState expressionState) { ((MonoBehaviour)this).StopCoroutine(expressionState.coroutine); renderer.SetBlendShapeWeight(expressionState.blendShapeIndex, 0f); } private static void GetBlendShapesIndexes(GameObject body) { SkinnedMeshRenderer skinnedMeshRenderer = GetSkinnedMeshRenderer(body, "Bandit2BodyMesh"); if ((Object)(object)skinnedMeshRenderer != (Object)null) { eyesBlinkIndex = skinnedMeshRenderer.sharedMesh.GetBlendShapeIndex("e-blink"); eyesSquintIndex = skinnedMeshRenderer.sharedMesh.GetBlendShapeIndex("f-><"); eyesConfusedIndex = skinnedMeshRenderer.sharedMesh.GetBlendShapeIndex("f-confused"); browsHurtIndex = skinnedMeshRenderer.sharedMesh.GetBlendShapeIndex("b-hurt"); mouthSeriousIndex = skinnedMeshRenderer.sharedMesh.GetBlendShapeIndex("m-serious"); mouthAngryIndex = skinnedMeshRenderer.sharedMesh.GetBlendShapeIndex("m-angry"); hideHaloIndex = skinnedMeshRenderer.sharedMesh.GetBlendShapeIndex("h-hide"); hasLoadedBlendShapes = true; } } private static void AddExpressionController(GameObject body) { body.AddComponent<MwExpressionController>(); } private static SkinnedMeshRenderer GetSkinnedMeshRenderer(GameObject body, string meshName) { if (body == null) { return null; } CharacterBody component = body.GetComponent<CharacterBody>(); if (component == null) { return null; } ModelLocator modelLocator = component.modelLocator; if (modelLocator == null) { return null; } Transform modelTransform = modelLocator.modelTransform; if (modelTransform == null) { return null; } Transform obj = modelTransform.Find(meshName); if (obj == null) { return null; } return ((Component)obj).GetComponent<SkinnedMeshRenderer>(); } private void SetExpressionRoutine(Func<Feature, SkinnedMeshRenderer, int, float, IEnumerator> Routine, Feature feature, SkinnedMeshRenderer renderer, int index, float time, bool shouldOverride = true) { ExpressionState expressionState = featureCoroutines[feature]; if (expressionState != null) { CancelExpression(renderer, expressionState); } if (shouldOverride || !featureActive[feature]) { featureCoroutines[feature] = new ExpressionState { coroutine = ((MonoBehaviour)this).StartCoroutine(Routine(feature, renderer, index, time)), feature = feature, blendShapeIndex = index }; } } private IEnumerator ExpressionRoutine(Feature feature, SkinnedMeshRenderer renderer, int index, float time) { featureActive[feature] = true; renderer.SetBlendShapeWeight(index, 100f); yield return (object)new WaitForSeconds(time); renderer.SetBlendShapeWeight(index, 0f); featureActive[feature] = false; } private IEnumerator LerpExpressionRoutine(Feature feature, SkinnedMeshRenderer renderer, int index, float time) { float stopwatch = 0f; float middle = time / 2f; featureActive[feature] = true; while (stopwatch < time) { stopwatch += Time.deltaTime; if (stopwatch < middle) { renderer.SetBlendShapeWeight(index, Mathf.Lerp(0f, 100f, stopwatch / middle)); } else { renderer.SetBlendShapeWeight(index, Mathf.Lerp(100f, 0f, (stopwatch - middle) / middle)); } yield return null; } renderer.SetBlendShapeWeight(index, 0f); featureActive[feature] = false; } private static void ExpressionOnHit(GameObject body, DamageReport damageReport) { SkinnedMeshRenderer skinnedMeshRenderer = GetSkinnedMeshRenderer(body, "Bandit2BodyMesh"); if (Object.op_Implicit((Object)(object)skinnedMeshRenderer)) { MwExpressionController component = body.GetComponent<MwExpressionController>(); component.SetExpressionRoutine(component.ExpressionRoutine, Feature.Eyes, skinnedMeshRenderer, eyesSquintIndex, 0.3f); component.SetExpressionRoutine(component.ExpressionRoutine, Feature.Brows, skinnedMeshRenderer, browsHurtIndex, 0.3f); component.SetExpressionRoutine(component.ExpressionRoutine, Feature.Mouth, skinnedMeshRenderer, mouthSeriousIndex, 0.3f); } } private static void ExpressionOnDeath(GameObject body) { SkinnedMeshRenderer skinnedMeshRenderer = GetSkinnedMeshRenderer(body, "Bandit2BodyMesh"); if ((Object)(object)skinnedMeshRenderer != (Object)null) { MwExpressionController component = body.GetComponent<MwExpressionController>(); component.CancelCurrentExpressions(skinnedMeshRenderer); skinnedMeshRenderer.SetBlendShapeWeight(hideHaloIndex, 100f); skinnedMeshRenderer.SetBlendShapeWeight(eyesConfusedIndex, 100f); skinnedMeshRenderer.SetBlendShapeWeight(mouthAngryIndex, 100f); component.inDeathState = true; } } private void Update() { BlinkUpdate(); } private void BlinkUpdate() { blinkStopwatch += Time.deltaTime; if (!(blinkStopwatch >= blinkInterval)) { return; } SkinnedMeshRenderer skinnedMeshRenderer = GetSkinnedMeshRenderer(((Component)this).gameObject, "Bandit2BodyMesh"); if ((!inDeathState || !featureActive[Feature.Eyes]) && (Object)(object)skinnedMeshRenderer != (Object)null) { SetExpressionRoutine(LerpExpressionRoutine, Feature.Eyes, skinnedMeshRenderer, eyesBlinkIndex, 0.2f, shouldOverride: false); if (doubleBlink) { doubleBlink = false; } else if (Random.value <= 0.1f) { doubleBlink = true; } } else { doubleBlink = false; } blinkStopwatch = 0f; if (doubleBlink) { blinkInterval = 0.3f; } else { blinkInterval = Random.Range(3f, 8f); } } } public static class MwSkinEvents { private static SkinDef _eventSkin; private static HashSet<CharacterBody> HoldOffIdleInvocation = new HashSet<CharacterBody>(); public static SkinDef eventSkin => _eventSkin; public static event Action<GameObject> SkinAppliedLobby; public static event Action<GameObject> SkinAppliedRun; public static event Action<GameObject> LeavePod; public static event Action<GameObject> Idle; public static event Action<GameObject> TeleporterStart; public static event Action<GameObject> DefeatBossGroup; public static event Action<GameObject> TeleporterEnd; public static event Action<GameObject> UsePrimary; public static event Action<GameObject> UseSecondary; public static event Action<GameObject> UseUtility; public static event Action<GameObject> UseSpecial; public static event Action<GameObject> UseEquipment; public static event Action<GameObject, DamageReport> TakeDamage; public static event Action<GameObject, float> Heal; public static event Action<GameObject> Death; public static event Action<GameObject> Jump; public static event Action<GameObject> LeaveStage; public static event Action<GameObject> ShrineSuccess; public static event Action<GameObject> ShrineFailure; public static event Action<GameObject> GetItem; public static void Init(SkinDef skin) { _eventSkin = skin; MwExpressionController.Init(); SubscribeEvents(); } private static void SubscribeEvents() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Expected O, but got Unknown //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Expected O, but got Unknown //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Expected O, but got Unknown //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Expected O, but got Unknown //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Expected O, but got Unknown //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Expected O, but got Unknown ModelSkinController.ApplySkinAsync += new hook_ApplySkinAsync(OnSkinAppliedBody); TeleporterInteraction.OnInteractionBegin += new hook_OnInteractionBegin(OnTeleporterStart); CharacterBody.OnDeathStart += new hook_OnDeathStart(OnDeath); GenericCharacterMain.ApplyJumpVelocity += new hook_ApplyJumpVelocity(OnJump); VehicleSeat.EjectPassenger_GameObject += new hook_EjectPassenger_GameObject(OnLeavePod); CharacterBody.Update += new hook_Update(OnBodyUpdate); SceneExitController.Begin += new hook_Begin(OnLeaveStage); CharacterBody.OnSkillActivated += new hook_OnSkillActivated(OnSkillActivated); ShrineChanceBehavior.AddShrineStack += new hook_AddShrineStack(OnChanceShrineInteract); GenericPickupController.AttemptGrant += new Manipulator(OnPickupAttemptGrant); EquipmentSlot.onServerEquipmentActivated += OnUseEquipment; BossGroup.onBossGroupDefeatedServer += OnDefeatBossGroup; TeleporterInteraction.onTeleporterChargedGlobal += OnTeleporterEnd; GlobalEventManager.onServerDamageDealt += OnTakeDamage; HealthComponent.onCharacterHealServer += OnHeal; } public static bool HasEventSkin(GameObject obj) { return (Object)(object)eventSkin == (Object)(object)SkinCatalog.FindCurrentSkinDefForBodyInstance(obj); } private static IEnumerator OnSkinAppliedBody(orig_ApplySkinAsync orig, ModelSkinController self, int skinIndex, AsyncReferenceHandleUnloadType unloadType) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) yield return orig.Invoke(self, skinIndex, unloadType); object obj; if (self == null) { obj = null; } else { CharacterModel characterModel = self.characterModel; if (characterModel == null) { obj = null; } else { CharacterBody body = characterModel.body; obj = ((body != null) ? ((Component)body).gameObject : null); } } GameObject val = (GameObject)obj; if ((Object)(object)val != (Object)null && HasEventSkin(val)) { MwSkinEvents.SkinAppliedRun?.Invoke(val); } else if ((Object)(object)val == (Object)null && (Object)(object)ArrayUtils.GetSafe<SkinDef>(self.skins, self.currentSkinIndex) == (Object)(object)eventSkin) { MwSkinEvents.SkinAppliedLobby?.Invoke(((Component)self).gameObject); } } private static void OnTeleporterStart(orig_OnInteractionBegin orig, TeleporterInteraction self, Interactor activator) { orig.Invoke(self, activator); TeleporterInteraction instance = TeleporterInteraction.instance; if (instance != null && !instance.isCharged && HasEventSkin(((Component)activator).gameObject)) { MwSkinEvents.TeleporterStart?.Invoke(((Component)activator).gameObject); } } private static void OnDeath(orig_OnDeathStart orig, CharacterBody self) { orig.Invoke(self); if (HasEventSkin(((Component)self).gameObject)) { MwSkinEvents.Death?.Invoke(((Component)self).gameObject); } } private static void OnJump(orig_ApplyJumpVelocity orig, CharacterMotor characterMotor, CharacterBody characterBody, float horizontalBonus, float verticalBonus, bool vault) { orig.Invoke(characterMotor, characterBody, horizontalBonus, verticalBonus, vault); if (HasEventSkin(((Component)characterBody).gameObject)) { MwSkinEvents.Jump?.Invoke(((Component)characterBody).gameObject); } } private static void OnLeavePod(orig_EjectPassenger_GameObject orig, VehicleSeat self, GameObject body) { orig.Invoke(self, body); if (self.isSurvivorPod && HasEventSkin(body)) { MwSkinEvents.LeavePod?.Invoke(body); } } private static void OnBodyUpdate(orig_Update orig, CharacterBody self) { orig.Invoke(self); if (!((Object)(object)self == (Object)null) && self.notMovingStopwatch > 10f && HasEventSkin(((Component)self).gameObject) && self.notMovingStopwatch % 10f < 0.1f && !HoldOffIdleInvocation.Contains(self)) { MwSkinEvents.Idle?.Invoke(((Component)self).gameObject); ((MonoBehaviour)RoR2Application.instance).StartCoroutine(HoldBodyFromIdleUpdate(self)); } } private static IEnumerator HoldBodyFromIdleUpdate(CharacterBody body) { HoldOffIdleInvocation?.Add(body); yield return (object)new WaitForSeconds(1f); HoldOffIdleInvocation?.Remove(body); } private static void OnLeaveStage(orig_Begin orig, SceneExitController self) { orig.Invoke(self); foreach (CharacterMaster readOnlyInstances in CharacterMaster.readOnlyInstancesList) { GameObject val = ((readOnlyInstances != null) ? readOnlyInstances.GetBodyObject() : null); if ((Object)(object)val != (Object)null && HasEventSkin(val)) { MwSkinEvents.LeaveStage?.Invoke(val); } } } private static void OnSkillActivated(orig_OnSkillActivated orig, CharacterBody self, GenericSkill skill) { orig.Invoke(self, skill); if (HasEventSkin(((Component)self).gameObject)) { if ((Object)(object)skill == (Object)(object)self.skillLocator.primary) { MwSkinEvents.UsePrimary?.Invoke(((Component)self).gameObject); } else if ((Object)(object)skill == (Object)(object)self.skillLocator.secondary) { MwSkinEvents.UseSecondary?.Invoke(((Component)self).gameObject); } else if ((Object)(object)skill == (Object)(object)self.skillLocator.utility) { MwSkinEvents.UseUtility?.Invoke(((Component)self).gameObject); } else if ((Object)(object)skill == (Object)(object)self.skillLocator.special) { MwSkinEvents.UseSpecial?.Invoke(((Component)self).gameObject); } } } private static void OnChanceShrineInteract(orig_AddShrineStack orig, ShrineChanceBehavior self, Interactor activator) { int successfulPurchaseCount = self.successfulPurchaseCount; orig.Invoke(self, activator); if (HasEventSkin(((Component)activator).gameObject)) { if (successfulPurchaseCount < self.successfulPurchaseCount) { MwSkinEvents.ShrineSuccess?.Invoke(((Component)activator).gameObject); } else { MwSkinEvents.ShrineFailure?.Invoke(((Component)activator).gameObject); } } } private static void OnPickupAttemptGrant(ILContext il) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown //IL_00c4: Unknown result type (might be due to invalid IL or missing references) Action<CharacterBody> action = delegate(CharacterBody body) { if (HasEventSkin(((Component)body).gameObject)) { MwSkinEvents.GetItem?.Invoke(((Component)body).gameObject); } }; ILCursor c = new ILCursor(il); if (c.TryGotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0) }) && c.TryGotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 2) }) && c.TryGotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdfld<GrantContext>(x, "shouldDestroy") && c.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchStfld<GenericPickupController>(x, "consumed") }) })) { c.Emit(OpCodes.Ldarg_1); c.EmitDelegate<Action<CharacterBody>>(action); } else { HoshinoBanditPlugin.InstanceLogger.LogError((object)"OnPickupAttemptGrant ILHook failed. Pickup interaction related events will not occur"); } } private static void OnUseEquipment(EquipmentSlot self, EquipmentIndex index) { if (HasEventSkin(((Component)self.characterBody).gameObject)) { MwSkinEvents.UseEquipment?.Invoke(((Component)self.characterBody).gameObject); } } private static void OnDefeatBossGroup(BossGroup bossGroup) { foreach (CharacterMaster readOnlyInstances in CharacterMaster.readOnlyInstancesList) { GameObject val = ((readOnlyInstances != null) ? readOnlyInstances.GetBodyObject() : null); if ((Object)(object)val != (Object)null && HasEventSkin(val)) { MwSkinEvents.DefeatBossGroup?.Invoke(val); } } } private static void OnTeleporterEnd(TeleporterInteraction teleporterInteraction) { foreach (CharacterMaster readOnlyInstances in CharacterMaster.readOnlyInstancesList) { GameObject val = ((readOnlyInstances != null) ? readOnlyInstances.GetBodyObject() : null); if ((Object)(object)val != (Object)null && HasEventSkin(val)) { MwSkinEvents.TeleporterEnd?.Invoke(val); } } } private static void OnTakeDamage(DamageReport damageReport) { if (!((Object)(object)damageReport?.victimBody != (Object)null)) { return; } object obj; if (damageReport == null) { obj = null; } else { CharacterBody victimBody = damageReport.victimBody; obj = ((victimBody != null) ? ((Component)victimBody).gameObject : null); } SkinDef val = SkinCatalog.FindCurrentSkinDefForBodyInstance((GameObject)obj); if (!((Object)(object)eventSkin == (Object)(object)val)) { return; } Action<GameObject, DamageReport> takeDamage = MwSkinEvents.TakeDamage; if (takeDamage != null) { object arg; if (damageReport == null) { arg = null; } else { CharacterBody victimBody2 = damageReport.victimBody; arg = ((victimBody2 != null) ? ((Component)victimBody2).gameObject : null); } takeDamage((GameObject)arg, damageReport); } } private static void OnHeal(HealthComponent self, float amount, ProcChainMask procChainMaskn) { object obj; if (self == null) { obj = null; } else { CharacterBody body = self.body; obj = ((body != null) ? ((Component)body).gameObject : null); } GameObject val = (GameObject)obj; if (HasEventSkin(val)) { MwSkinEvents.Heal?.Invoke(val, amount); } } } public static class MwUtils { public static Random rand = new Random(); public static object RandomChoices(IEnumerable<object> choices, IEnumerable<float> weights) { List<float> list = new List<float>(); float num = 0f; foreach (float weight in weights) { num += weight; list.Add(num); } float num2 = (float)rand.NextDouble() * num; int num3 = 0; foreach (object choice in choices) { if (num2 <= list[num3]) { return choice; } num3++; } HoshinoBanditPlugin.InstanceLogger.LogWarning((object)"RandomChoices: Couldn't make a choice - returning null!"); return null; } public static object RandomChoice(IEnumerable<object> choices) { IList<object> list = (choices as IList<object>) ?? choices.ToList(); if (list.Count > 0) { return list[rand.Next(list.Count)]; } HoshinoBanditPlugin.InstanceLogger.LogWarning((object)"RandomChoice: Got passed an empty enumerable - returning null!"); return null; } public static object RandomChoice(object[] choices) { if (choices.Length != 0) { return choices[rand.Next(choices.Length)]; } HoshinoBanditPlugin.InstanceLogger.LogWarning((object)"RandomChoice: Got passed an empty enumerable - returning null!"); return null; } public static IEnumerator ExecuteWhenNearPosition(Action action, GameObject gameObject, Vector3 position, float maxWait = 1f) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) float stopwatch = 0f; while (Vector3.Distance(gameObject.transform.position, position) > 0.5f && stopwatch < maxWait) { stopwatch += Time.deltaTime; yield return null; } action?.Invoke(); } } public class MwVoiceController : MonoBehaviour { private int consecutiveShrineFails; private static float nextLobbyLineTime; private float timeSinceLastRolledLine; private const float soundWaitPadding = 0.5f; private float currentSoundWait; private Dictionary<HoshinoVoiceAssets.VoiceInfo[], float> soundArrayStopwatches; private Dictionary<HoshinoVoiceAssets.VoiceInfo[], float> soundArrayMinWait; private Dictionary<HoshinoVoiceAssets.VoiceInfo[], float> soundArrayMaxWait; private Dictionary<HoshinoVoiceAssets.VoiceInfo[], int> soundArrayPrevIndex; private Dictionary<HoshinoVoiceAssets.VoiceInfo[], HoshinoVoiceAssets.VoiceInfo[]> sharingArrays; public static void Init() { SubscribeStaticEvents(); } private static void SubscribeStaticEvents() { MwSkinEvents.SkinAppliedRun += AddVoiceController; MwSkinEvents.SkinAppliedLobby += SkinSelectLine; } private void SubscribeInstanceEvents() { MwSkinEvents.TeleporterStart += StartTPLine; MwSkinEvents.DefeatBossGroup += DefeatTPBossLine; MwSkinEvents.TeleporterEnd += EndTPLine; MwSkinEvents.Death += DeathLine; MwSkinEvents.TakeDamage += TakeDamageLine; MwSkinEvents.LeavePod += LeavePodLine; MwSkinEvents.Idle += IdleLine; MwSkinEvents.UseEquipment += EquipmentLine; MwSkinEvents.UseSpecial += SpecialLine; MwSkinEvents.UseUtility += UtilityLine; MwSkinEvents.UseSecondary += SecondaryLine; MwSkinEvents.UsePrimary += PrimaryLine; MwSkinEvents.GetItem += GetItemLine; MwSkinEvents.LeaveStage += LeaveStageLine; MwSkinEvents.Heal += HeavyHealLine; MwSkinEvents.ShrineSuccess += ShrineSuccessTrack; MwSkinEvents.ShrineFailure += ShrineFailureTrack; MwSkinEvents.Jump += JumpLine; } private void UnsubscribeInstanceEvents() { MwSkinEvents.TeleporterStart -= StartTPLine; MwSkinEvents.DefeatBossGroup -= DefeatTPBossLine; MwSkinEvents.TeleporterEnd -= EndTPLine; MwSkinEvents.Death -= DeathLine; MwSkinEvents.TakeDamage -= TakeDamageLine; MwSkinEvents.LeavePod -= LeavePodLine; MwSkinEvents.Idle -= IdleLine; MwSkinEvents.UseEquipment -= EquipmentLine; MwSkinEvents.UseSpecial -= SpecialLine; MwSkinEvents.UseUtility -= UtilityLine; MwSkinEvents.UseSecondary -= SecondaryLine; MwSkinEvents.UsePrimary -= PrimaryLine; MwSkinEvents.GetItem -= GetItemLine; MwSkinEvents.LeaveStage -= LeaveStageLine; MwSkinEvents.Heal -= HeavyHealLine; MwSkinEvents.ShrineSuccess -= ShrineSuccessTrack; MwSkinEvents.ShrineFailure -= ShrineFailureTrack; MwSkinEvents.Jump -= JumpLine; } private static void AddVoiceController(GameObject body) { body.AddComponent<MwVoiceController>(); } private static void TakeDamageLine(GameObject body, DamageReport damageReport) { if (body != null) { body.GetComponent<MwVoiceController>()?.TryPlayRandomUniqueSoundServer(HoshinoVoiceAssets.hurt, body, 0.5f); } } private static void DeathLine(GameObject body) { if (body != null) { body.GetComponent<MwVoiceController>()?.TryPlayRandomSoundServer(HoshinoVoiceAssets.death, body); } } private static void StartTPLine(GameObject body) { if (body != null) { body.GetComponent<MwVoiceController>()?.TryPlayRandomSoundServer(HoshinoVoiceAssets.startTP, body); } } private static void DefeatTPBossLine(GameObject body) { if (body != null) { body.GetComponent<MwVoiceController>()?.TryPlayRandomUniqueSoundServer(HoshinoVoiceAssets.defeatTPBoss, body); } } private static void EndTPLine(GameObject body) { if (body != null) { body.GetComponent<MwVoiceController>()?.TryPlayRandomSoundServer(HoshinoVoiceAssets.endTP, body); } } private static void LeavePodLine(GameObject body) { if (body != null) { body.GetComponent<MwVoiceController>()?.TryPlayRandomSoundServer(HoshinoVoiceAssets.leavePod, body); } } private static void IdleLine(GameObject body) { if (body != null) { body.GetComponent<MwVoiceController>()?.TryPlayRandomUniqueSoundServer(HoshinoVoiceAssets.idle, body); } } private static void EquipmentLine(GameObject body) { if (body != null) { body.GetComponent<MwVoiceController>()?.TryPlayRandomUniqueSoundServer(HoshinoVoiceAssets.useEquipment, body, 0.8f); } } private static void SpecialLine(GameObject body) { if (body != null) { body.GetComponent<MwVoiceController>()?.TryPlayRandomUniqueSoundServer(HoshinoVoiceAssets.useSpecial, body, 0.5f); } } private static void UtilityLine(GameObject body) { if (body != null) { body.GetComponent<MwVoiceController>()?.TryPlayRandomUniqueSoundServer(HoshinoVoiceAssets.useUtility, body, 0.5f); } } private static void SecondaryLine(GameObject body) { if (body != null) { body.GetComponent<MwVoiceController>()?.TryPlayRandomUniqueSoundServer(HoshinoVoiceAssets.useSecondary, body, 0.5f); } } private static void PrimaryLine(GameObject body) { if (body != null) { body.GetComponent<MwVoiceController>()?.TryPlayRandomUniqueSoundServer(HoshinoVoiceAssets.usePrimary, body, 0.05f); } } private static void GetItemLine(GameObject body) { if (body != null) { body.GetComponent<MwVoiceController>()?.TryPlayRandomUniqueSoundServer(HoshinoVoiceAssets.getItem, body, 0.75f); } } private static void LeaveStageLine(GameObject body) { if (body != null) { body.GetComponent<MwVoiceController>()?.TryPlayRandomSoundServer(HoshinoVoiceAssets.leaveStage, body); } } private static void HeavyHealLine(GameObject body, float amount) { MwVoiceController mwVoiceController = ((body != null) ? body.GetComponent<MwVoiceController>() : null); if ((Object)(object)mwVoiceController != (Object)null) { object obj; if (body == null) { obj = null; } else { CharacterBody component = body.GetComponent<CharacterBody>(); obj = ((component != null) ? component.healthComponent : null); } HealthComponent val = (HealthComponent)obj; if ((Object)(object)val != (Object)null && amount >= 0.5f * val.fullCombinedHealth) { mwVoiceController.TryPlayRandomSoundServer(HoshinoVoiceAssets.heavyHeal, body); } } } private static void ShrineSuccessTrack(GameObject body) { MwVoiceController mwVoiceController = ((body != null) ? body.GetComponent<MwVoiceController>() : null); if ((Object)(object)mwVoiceController != (Object)null) { mwVoiceController.consecutiveShrineFails = 0; } } private static void ShrineFailureTrack(GameObject body) { MwVoiceController mwVoiceController = ((body != null) ? body.GetComponent<MwVoiceController>() : null); if ((Object)(object)mwVoiceController != (Object)null) { mwVoiceController.consecutiveShrineFails++; if (mwVoiceController.consecutiveShrineFails % 5 == 0) { mwVoiceController.TryPlayRandomSoundServer(HoshinoVoiceAssets.hugeFailShrine, body); } } } private static void JumpLine(GameObject body) { if (body != null) { body.GetComponent<MwVoiceController>()?.TryPlayRandomUniqueSoundServer(HoshinoVoiceAssets.jump, body, 0.1f); } } private static void SkinSelectLine(GameObject body) { if (Time.time > nextLobbyLineTime) { object[] skinSelect = HoshinoVoiceAssets.skinSelect; HoshinoVoiceAssets.VoiceInfo voiceInfo = (HoshinoVoiceAssets.VoiceInfo)MwUtils.RandomChoice(skinSelect); nextLobbyLineTime = Time.time + voiceInfo.approxDuration + 0.5f; PlaySound(voiceInfo, body); } } private void Awake() { if (!NetworkServer.active || !Options.playVoicelines.Value) { Object.Destroy((Object)(object)this); return; } SubscribeInstanceEvents(); soundArrayStopwatches = new Dictionary<HoshinoVoiceAssets.VoiceInfo[], float>(); soundArrayMinWait = new Dictionary<HoshinoVoiceAssets.VoiceInfo[], float>(); soundArrayMaxWait = new Dictionary<HoshinoVoiceAssets.VoiceInfo[], float>(); soundArrayPrevIndex = new Dictionary<HoshinoVoiceAssets.VoiceInfo[], int>(); sharingArrays = new Dictionary<HoshinoVoiceAssets.VoiceInfo[], HoshinoVoiceAssets.VoiceInfo[]>(); RegisterArray(HoshinoVoiceAssets.skinSelect, 10f, 10f); RegisterArray(HoshinoVoiceAssets.leavePod, 0.5f, 0.5f); RegisterArray(HoshinoVoiceAssets.idle, 10f, 20f); RegisterArray(HoshinoVoiceAssets.death, 5f, 5f); RegisterArray(HoshinoVoiceAssets.hugeFailShrine, 5f, 5f); RegisterArray(HoshinoVoiceAssets.leaveStage, 10f, 10f); RegisterArray(HoshinoVoiceAssets.heavyHeal, 30f, 50f, 30f); RegisterArray(HoshinoVoiceAssets.getItem, 15f, 60f, 15f); RegisterArray(HoshinoVoiceAssets.useEquipment, 45f, 100f, 45f); RegisterArray(HoshinoVoiceAssets.usePrimary, 0.5f, 8f); RegisterSharedStopwatch(HoshinoVoiceAssets.useSecondary, HoshinoVoiceAssets.usePrimary); RegisterSharedStopwatch(HoshinoVoiceAssets.useUtility, HoshinoVoiceAssets.usePrimary); RegisterSharedStopwatch(HoshinoVoiceAssets.useSpecial, HoshinoVoiceAssets.usePrimary); RegisterSharedStopwatch(HoshinoVoiceAssets.hurt, HoshinoVoiceAssets.usePrimary); RegisterSharedStopwatch(HoshinoVoiceAssets.jump, HoshinoVoiceAssets.usePrimary); RegisterArray(HoshinoVoiceAssets.startTP, 5f, 10f); RegisterSharedStopwatch(HoshinoVoiceAssets.defeatTPBoss, HoshinoVoiceAssets.startTP); RegisterSharedStopwatch(HoshinoVoiceAssets.endTP, HoshinoVoiceAssets.startTP); } private void OnDestroy() { UnsubscribeInstanceEvents(); } private void Update() { float deltaTime = Time.deltaTime; HoshinoVoiceAssets.VoiceInfo[][] array = soundArrayStopwatches.Keys.ToArray(); foreach (HoshinoVoiceAssets.VoiceInfo[] key in array) { soundArrayStopwatches[key] += deltaTime; } timeSinceLastRolledLine += deltaTime; } public void RegisterSharedStopwatch(HoshinoVoiceAssets.VoiceInfo[] newArray, HoshinoVoiceAssets.VoiceInfo[] registeredArray) { if (sharingArrays.ContainsKey(registeredArray) || soundArrayStopwatches.ContainsKey(newArray)) { HoshinoBanditPlugin.InstanceLogger.LogError((object)"newArray already has a stopwatch or registeredArray is not a stopwatch owner! Couldn't share a stopwatch."); } else if (soundArrayStopwatches.ContainsKey(registeredArray)) { sharingArrays[newArray] = registeredArray; } else { HoshinoBanditPlugin.InstanceLogger.LogError((object)"registeredArray has not already been registered! Couldn't share a stopwatch."); } } public void RegisterArray(HoshinoVoiceAssets.VoiceInfo[] array, float minWait, float maxWait, float offset = 0f) { soundArrayStopwatches[array] = offset; soundArrayMinWait[array] = minWait; soundArrayMaxWait[array] = maxWait; } public bool RollForSoundEvent(HoshinoVoiceAssets.VoiceInfo[] soundArray, float maxProbability = 1f) { if (timeSinceLastRolledLine < currentSoundWait) { return false; } float num = 0f; if (sharingArrays.ContainsKey(soundArray)) { soundArray = sharingArrays[soundArray]; num = soundArrayStopwatches[soundArray]; } else { if (!soundArrayStopwatches.ContainsKey(soundArray)) { HoshinoBanditPlugin.InstanceLogger.LogError((object)"soundArray has not been registered! Couldn't roll."); return false; } num = soundArrayStopwatches[soundArray]; } float num2 = soundArrayMaxWait[soundArray] - soundArrayMinWait[soundArray]; float num3 = ((num2 != 0f) ? Mathf.Min(maxProbability, (num - soundArrayMinWait[soundArray]) / num2) : 1f); if (num > soundArrayMinWait[soundArray] && Random.value <= num3) { soundArrayStopwatches[soundArray] = 0f; timeSinceLastRolledLine = 0f; return true; } return false; } public void TryPlayRandomUniqueSoundServer(HoshinoVoiceAssets.VoiceInfo[] soundArray, GameObject source, float maxProbability = 1f) { if (!NetworkServer.active || !RollForSoundEvent(soundArray, maxProbability)) { return; } int num; if (soundArrayPrevIndex.ContainsKey(soundArray)) { num = MwUtils.rand.Next(soundArray.Length - 1); if (num >= soundArrayPrevIndex[soundArray]) { num++; num %= soundArray.Length; } } else { num = MwUtils.rand.Next(soundArray.Length); soundArrayPrevIndex.Add(soundArray, num); } soundArrayPrevIndex[soundArray] = num; PlaySoundServer(soundArray[num], source, this); } public void TryPlayRandomSoundServer(HoshinoVoiceAssets.VoiceInfo[] soundArray, GameObject source, float maxProbability = 1f) { if (NetworkServer.active && RollForSoundEvent(soundArray, maxProbability)) { PlayRandomSoundServer(soundArray, source, this); } } public void TryPlayRandomSoundServer(HoshinoVoiceAssets.VoiceInfo[] soundArray, Vector3 position, float maxProbability = 1f) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) if (NetworkServer.active && RollForSoundEvent(soundArray, maxProbability)) { PlayRandomSoundServer(soundArray, position, this); } } public void TryPlayRandomSound(HoshinoVoiceAssets.VoiceInfo[] soundArray, GameObject source, float maxProbability = 1f) { if (RollForSoundEvent(soundArray, maxProbability)) { PlayRandomSound(soundArray, source, this); } } public void TryPlayRandomSound(HoshinoVoiceAssets.VoiceInfo[] soundArray, Vector3 position, float maxProbability = 1f) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) if (RollForSoundEvent(soundArray, maxProbability)) { PlayRandomSound(soundArray, position, this); } } public static void PlayRandomSoundServer(HoshinoVoiceAssets.VoiceInfo[] soundArray, GameObject source, MwVoiceController voiceController = null) { if (NetworkServer.active) { PlaySoundServer((HoshinoVoiceAssets.VoiceInfo)MwUtils.RandomChoice(soundArray), source, voiceController); } } public static void PlayRandomSoundServer(HoshinoVoiceAssets.VoiceInfo[] soundArray, Vector3 position, MwVoiceController voiceController = null) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) if (NetworkServer.active) { PlaySoundServer((HoshinoVoiceAssets.VoiceInfo)MwUtils.RandomChoice(soundArray), position, voiceController); } } public static void PlayRandomSound(HoshinoVoiceAssets.VoiceInfo[] soundArray, GameObject source, MwVoiceController voiceController = null) { PlaySound((HoshinoVoiceAssets.VoiceInfo)MwUtils.RandomChoice(soundArray), source, voiceController); } public static void PlayRandomSound(HoshinoVoiceAssets.VoiceInfo[] soundArray, Vector3 position, MwVoiceController voiceController = null) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) PlaySound((HoshinoVoiceAssets.VoiceInfo)MwUtils.RandomChoice(soundArray), position, voiceController); } public static void PlaySoundServer(HoshinoVoiceAssets.VoiceInfo voiceInfo, GameObject source, MwVoiceController voiceController = null) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) if (NetworkServer.active) { EntitySoundManager.EmitSoundServer(AkEventIdArg.op_Implicit(voiceInfo.sound.akId), source); if ((Object)(object)voiceController != (Object)null) { voiceController.currentSoundWait = voiceInfo.approxDuration + 0.5f; } } } public static void PlaySoundServer(HoshinoVoiceAssets.VoiceInfo voiceInfo, Vector3 position, MwVoiceController voiceController = null) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) if (NetworkServer.active) { EffectManager.SimpleSoundEffect(voiceInfo.sound.index, position, true); if ((Object)(object)voiceController != (Object)null) { voiceController.currentSoundWait = voiceInfo.approxDuration + 0.5f; } } } public static void PlaySound(HoshinoVoiceAssets.VoiceInfo voiceInfo, GameObject source, MwVoiceController voiceController = null) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) EntitySoundManager.EmitSoundLocal(AkEventIdArg.op_Implicit(voiceInfo.sound.akId), source); if ((Object)(object)voiceController != (Object)null) { voiceController.currentSoundWait = voiceInfo.approxDuration + 0.5f; } } public static void PlaySound(HoshinoVoiceAssets.VoiceInfo voiceInfo, Vector3 position, MwVoiceController voiceController = null) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) EffectManager.SimpleSoundEffect(voiceInfo.sound.index, position, false); if ((Object)(object)voiceController != (Object)null) { voiceController.currentSoundWait = voiceInfo.approxDuration + 0.5f; } } } public class Options { private static bool? _rooEnabled; public static bool rooEnabled { get { if (!_rooEnabled.HasValue) { _rooEnabled = Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions"); } return _rooEnabled.Value; } } public static ConfigEntry<float> hoshinoVoiceVolume { get; set; } public static ConfigEntry<bool> playVoicelines { get; set; } private static void HoshinoVoiceVolumeSettingChanged() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) AkSoundEngine.SetRTPCValue("HoshinoVoiceVolume", hoshinoVoiceVolume.Value * 50f); } public static void Init() { hoshinoVoiceVolume = HoshinoBanditPlugin.config.Bind<float>("Sound", "Hoshino Voice Volume", 1f, "How loud Hoshino's voice is relative to other sound effects."); hoshinoVoiceVolume.SettingChanged += delegate { HoshinoVoiceVolumeSettingChanged(); }; playVoicelines = HoshinoBanditPlugin.config.Bind<bool>("Sound", "Network Voicelines", true, "Whether or not to try playing voicelines in a run. Turn this off before a run if you're the host and for some reason the clients don't have the mod installed. If you simply don't want to hear the voicelines, turn the above slider down."); if (rooEnabled) { RoOInit(); } } public static void OnLoadFinished() { HoshinoVoiceVolumeSettingChanged(); } private static void RoOInit() { //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_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Expected O, but got Unknown //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Expected O, but got Unknown ModSettingsManager.AddOption((BaseOption)new StepSliderOption(hoshinoVoiceVolume, new StepSliderConfig { min = 0f, max = 2f, increment = 0.01f })); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(playVoicelines, new CheckBoxConfig())); ModSettingsManager.SetModDescription("Config options relating to the Hoshino Bandit skin mod."); ModSettingsManager.SetModIcon(HoshinoBanditPlugin.assetBundle.LoadAsset<Sprite>("Assets\\SkinMods\\HoshinoBandit\\Icons\\DefHoshinoBanditIcon.png")); } } } namespace RuneFoxMods { internal class Utils { public static void PrintBodyCatalog() { Debug.Log((object)"\nBodyCatalog"); foreach (GameObject allBodyPrefab in BodyCatalog.allBodyPrefabs) { Debug.Log((object)((Object)allBodyPrefab).name); } Debug.Log((object)"\n"); } public static void ReadChildren(GameObject parent, int tabs, bool includecomponents = true) { //IL_0082: 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) string text = ""; for (int i = 0; i < tabs; i++) { text += " "; } for (int j = 0; j < parent.transform.childCount; j++) { Transform child = parent.transform.GetChild(j); if ((Object)(object)child == (Object)null) { break; } string text2 = ((Component)child).gameObject.activeInHierarchy.ToString(); string[] obj = new string[6] { text, ((Object)child).name, " ", text2, " ", null }; Vector3 position = ((Component)child).transform.position; obj[5] = ((object)(Vector3)(ref position)).ToString(); Debug.Log((object)string.Concat(obj)); if (includecomponents) { ReadComponents(((Component)child).gameObject, tabs + 1); Debug.Log((object)""); } ReadChildren(((Component)child).gameObject, tabs + 1, includecomponents); } } public static void readheiarchy(GameObject parent, bool includeComponents = true) { Debug.Log((object)((Object)parent).name); if (includeComponents) { ReadComponents(parent, 1); Debug.Log((object)""); } ReadChildren(parent, 1, includeComponents); } public static void ReadComponents(GameObject obj, int tabs) { string text = ""; for (int i = 0; i < tabs; i++) { text += " "; } Component[] components = obj.GetComponents(typeof(Component)); foreach (Component val in components) { string text2 = ""; Debug.Log((object)(text + "Comp: " + ((object)val).GetType().ToString() + " " + text2)); } } public static void PrintAllPaths(GameObject parent) { Debug.Log((object)((Object)parent).name); PrintAllPathsInner(parent, ((Object)parent).name); } private static void PrintAllPathsInner(GameObject parent, string parent_string) { int childCount = parent.transform.childCount; for (int i = 0; i < childCount; i++) { Transform child = parent.transform.GetChild(i); if (!((Object)child).name.EndsWith("_end")) { string text = parent_string + "/" + ((Object)child).name; Debug.Log((object)(" " + ((Object)child).name + "\t\t" + text)); PrintAllPathsInner(((Component)child).gameObject, text); continue; } break; } } public static void PrintDynamicBone(DynamicBone DB) { //IL_0168: 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_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: 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_026b: Unknown result type (might be due to invalid IL or missing references) Debug.Log((object)("Root: " + (object)DB.m_Root)); Debug.Log((object)("Damping: " + DB.m_Damping)); Debug.Log((object)("Damping Dist: " + (object)DB.m_DampingDistrib)); Debug.Log((object)("Elasticity: " + DB.m_Elasticity)); Debug.Log((object)("Elasticity Dist: " + (object)DB.m_ElasticityDistrib)); Debug.Log((object)("Stiffness: " + DB.m_Stiffness)); Debug.Log((object)("Stiffness Dist: " + (object)DB.m_StiffnessDistrib)); Debug.Log((object)("Inert: " + DB.m_Inert)); Debug.Log((object)("Inert Dist: " + (object)DB.m_InertDistrib)); Debug.Log((object)("Radius: " + DB.m_Radius)); Debug.Log((object)("Radius Dist: " + (object)DB.m_RadiusDistrib)); Debug.Log((object)("End Length: " + DB.m_EndLength)); Vector3 val = DB.m_EndOffset; Debug.Log((object)("End Offset: " + ((object)(Vector3)(ref val)).ToString())); val = DB.m_Gravity; Debug.Log((object)("Gravity: " + ((object)(Vector3)(ref val)).ToString())); val = DB.m_Force; Debug.Log((object)("Force: " + ((object)(Vector3)(ref val)).ToString())); Debug.Log((object)("FreezeAxis: " + ((object)(FreezeAxis)(ref DB.m_FreezeAxis)).ToString())); Debug.Log((object)("Colliders: " + DB.m_Colliders.Count)); foreach (DynamicBoneCollider collider in DB.m_Colliders) { Debug.Log((object)("\t Parent: " + ((Object)((Component)collider).transform).name)); Debug.Log((object)("\t Direction: " + ((object)(Direction)(ref collider.m_Direction)).ToString())); val = collider.m_Center; Debug.Log((object)("\t Center " + ((object)(Vector3)(ref val)).ToString())); Debug.Log((object)("\t Bound " + ((object)(Bound)(ref collider.m_Bound)).ToString())); Debug.Log((object)("\t Radius " + collider.m_Radius)); Debug.Log((object)("\t Height " + collider.m_Height)); } Debug.Log((object)("Exclusions: " + DB.m_Exclusions.Count)); foreach (Transform exclusion in DB.m_Exclusions) { Debug.Log((object)("\t Transform: " + ((Object)exclusion).name)); } } public static ChildLocator GetChildLocator(GameObject body) { ChildLocator val = null; Transform child = body.transform.GetChild(0); if (Object.op_Implicit((Object)(object)child)) { Transform child2 = child.GetChild(0); if (Object.op_Implicit((Object)(object)child2)) { val = ((Component)child2).GetComponent<ChildLocator>(); if (Object.op_Implicit((Object)(object)val)) { Debug.Log((object)"Locator Found"); } } } return val; } public static Transform FindChildInTree(Transform Root, string name) { Queue<Transform> queue = new Queue<Transform>(); queue.Enqueue(Root); while (queue.Count != 0) { Transform val = queue.Dequeue(); if (((Object)val).name == name) { return val; } for (int i = 0; i < val.childCount; i++) { Transform child = val.GetChild(i); queue.Enqueue(child); } } return null; } public static string RemoveCloneNaming(string str) { return str.Remove(str.Length - 7); } } } namespace RuneFoxMods.DynamicSkins { public static class DynamicSkinHelpers { public static SkinnedMeshRenderer[] GetBaseSkinRenderers(GameObject modelObject) { SkinnedMeshRenderer[] componentsInChildren = modelObject.GetComponentsInChildren<SkinnedMeshRenderer>(true); List<SkinnedMeshRenderer> list = new List<SkinnedMeshRenderer>(); SkinnedMeshRenderer[] array = componentsInChildren; foreach (SkinnedMeshRenderer val in array) { if ((Object)(object)((Component)val).transform.parent == (Object)(object)modelObject.transform) { list.Add(val); } } return list.ToArray(); } public static Transform[] BoneArrayBuilder(Transform NewBoneRoot) { List<Transform> list = new List<Transform>(); BoneArrayBuilderHelper(NewBoneRoot, list); return list.ToArray(); } public static void BoneArrayBuilderHelper(Transform parent, List<Transform> list) { if (!((Object)parent).name.EndsWith("_end")) { list.Add(parent); } for (int i = 0; i < parent.childCount; i++) { BoneArrayBuilderHelper(parent.GetChild(i), list); } } public static Transform GetArmature(GameObject obj) { return GetArmatureHelper(obj); } public static Transform GetArmatureHelper(GameObject obj) { if (((Object)obj).name.ToLower().Contains("armature")) { return obj.transform; } for (int i = 0; i < obj.transform.childCount; i++) { Transform armatureHelper = GetArmatureHelper(((Component)obj.transform.GetChild(i)).gameObject); if (Object.op_Implicit((Object)(object)armatureHelper)) { return armatureHelper; } } return null; } public static Transform GetTopParent(Transform obj) { Transform val = obj; while ((Object)(object)val.parent != (Object)null) { val = val.parent; } return val; } public static string GetPrevBoneInList(Transform targetBone, SkinnedMeshRenderer meshRenderer) { Transform[] bones = meshRenderer.bones; for (int i = 0; i <= bones.Length - 1; i++) { if (((Object)bones[i + 1]).name == ((Object)targetBone).name) { return ((Object)bones[i]).name; } } return null; } public static int GetBoneIndexInList(Transform targetBone, SkinnedMeshRenderer meshRenderer) { Transform[] bones = meshRenderer.bones; for (int i = 0; i <= bones.Length; i++) { if (((Object)bones[i]).name == ((Object)targetBone).name) { return i; } } return -1; } public static int GetPrevBoneIndexInList(Transform targetBone, SkinnedMeshRenderer meshRenderer) { Transform[] bones = meshRenderer.bones; for (int i = 0; i <= bones.Length - 1; i++) { if (((Object)bones[i + 1]).name == ((Object)targetBone).name) { return i; } } return -1; } } internal class DynamicSkinManager { internal Dictionary<string, SkinDef> SkinDefs = new Dictionary<string, SkinDef>(); private GameObject LastModelObject; internal Dictionary<string, SortedList<int, Modification>> ModificationList = new Dictionary<string, SortedList<int, Modification>>(); private Dictionary<GameObject, AppliedModifications> ModifiedObjects = new Dictionary<GameObject, AppliedModifications>(); internal ManualLogSource InstanceLogger; internal void AddModification(string skinNameToken, int boneIndex, Modification modification) { if (!ModificationList.TryGetValue(skinNameToken, out var value)) { value = new SortedList<int, Modification>(); ModificationList.Add(skinNameToken, value); } value.Add(boneIndex, modification); } internal void AddSkinDef(SkinDef skinDef) { SkinDefs.Add(skinDef.nameToken, skinDef); } internal IEnumerator SkinDefApply(Func<SkinDef, GameObject, List<AssetReferenceT<Material>>, List<AssetReferenceT<Mesh>>, int, IEnumerator> orig, SkinDef self, GameObject modelObject, List<AssetReferenceT<Material>> loadedMaterials, List<AssetReferenceT<Mesh>> loadedMeshes, int unloadType) { IEnumerator result = orig(self, modelObject, loadedMaterials, loadedMeshes, unloadType); RemoveInvalidModelObjects(); ModifiedObjects.TryGetValue(modelObject, out var value); try { if (!SkinDefs.TryGetValue(self.nameToken, out var _)) { if (value != null) { ClearSkinModifications(LastModelObject, value); } return result; } if (value == null) { AppliedModifications appliedModifications = new AppliedModifications(); ModifiedObjects.Add(modelObject, appliedModifications); ApplySkinModifications(self, modelObject, appliedModifications); } } catch (Exception ex) { InstanceLogger.LogWarning((object)"An error occured while adding accessories to a skin"); InstanceLogger.LogError((object)ex); } return result; } private void RemoveInvalidModelObjects() { foreach (GameObject item in ModifiedObjects.Keys.Where((GameObject el) => !Object.op_Implicit((Object)(object)el)).ToList()) { ModifiedObjects.Remove(item); } } private void ClearSkinModifications(GameObject modelObject, AppliedModifications modifications) { while (modifications.BaseModelModifications.Count != 0) { Modification modification = modifications.BaseModelModifications.Pop(); clearModification(modification, modelObject, modifications); } while (modifications.OtherModifications.Count != 0) { clearModification(modifications.OtherModifications[0], modelObject, modifications); } ModifiedObjects.Remove(modelObject); } private void ApplySkinModifications(SkinDef skindef, GameObject modelObject, AppliedModifications modifications) { CharacterModel component = modelObject.GetComponent<CharacterModel>(); LastModelObject = modelObject; if (!ModificationList.TryGetValue(skindef.nameToken, out var value)) { return; } foreach (KeyValuePair<int, Modification> item in value) { ApplyModification(modelObject, component, item.Value, modifications); } } private static void ApplyModification(GameObject modelObject, CharacterModel characterModel, Modification modification, AppliedModifications modifications) { _ = modification.bodyname; string parentname = modification.parentname; Transform val = Utils.FindChildInTree(modelObject.transform, parentname); GameObject val2; if (modification.affectsbasemodel) { val2 = Object.Instantiate<GameObject>(modification.prefab, val, false); ((Object)val2).name = Utils.RemoveCloneNaming(((Object)val2).name); modification.instance = val2; modification.inst_armature = val2; ModificationApplyBones(modelObject, modification, modifications); } else { val2 = Object.Instantiate<GameObject>(modification.prefab, modelObject.transform, false); ((Object)val2).name = Utils.RemoveCloneNaming(((Object)val2).name); modification.instance = val2; Transform armature = DynamicSkinHelpers.GetArmature(val2); ((Component)armature).transform.SetParent(val, false); modification.inst_armature = ((Component)armature).gameObject; } modification.instance = val2; if (modification.dynamicBoneData != null) { ModificationApplyDynamicBones(modelObject, modification); } ModificationAddRenderers(val2, characterModel); modifications.OtherModifications.Add(modification); } private static void ModificationApplyBones(GameObject modelObject, Modification modification, AppliedModifications modifications) { SkinnedMeshRenderer[] baseSkinRenderers = DynamicSkinHelpers.GetBaseSkinRenderers(modelObject); List<Transform> list = baseSkinRenderers[0].bones.ToList(); Transform[] array = DynamicSkinHelpers.BoneArrayBuilder(modification.instance.transform); list.InsertRange(modification.boneIndex, array); modification.boneCount = array.Length; SkinnedMeshRenderer[] array2 = baseSkinRenderers; for (int i = 0; i < array2.Length; i++) { array2[i].bones = list.ToArray(); } modifications.BaseModelModifications.Push(modification); } private static void ModificationApplyDynamicBones(GameObject modelObject, Modification modification) { //IL_0057: 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_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0073: 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_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) DynamicBone val = (modification.inst_dynamicBone = modification.instance.AddComponent<DynamicBone>()); List<DynamicBoneCollider> list = new List<DynamicBoneCollider>(); foreach (DynamicBoneColliderData collider in modification.dynamicBoneData.m_Colliders) { DynamicBoneCollider val2 = ((Component)Utils.FindChildInTree(modelObject.transform, collider.m_parent_name)).gameObject.AddComponent<DynamicBoneCollider>(); val2.m_Direction = collider.m_Direction; val2.m_Center = collider.m_Center; val2.m_Bound = collider.m_Bound; val2.m_Radius = collider.m_Radius; val2.m_Height = collider.m_Height; list.Add(val2); } modification.inst_DB_colliders = list; Transform root = (val.m_Root = Utils.FindChildInTree(modification.inst_armature.transform, modification.dynamicBoneData.m_Root)); val.m_Damping = modification.dynamicBoneData.m_Damping; val.m_DampingDistrib = modification.dynamicBoneData.m_DampingDistrib; val.m_Elasticity = modification.dynamicBoneData.m_Elasticity; val.m_ElasticityDistrib = modification.dynamicBoneData.m_ElasticityDistrib; val.m_Stiffness = modification.dynamicBoneData.m_Stiffness; val.m_StiffnessDistrib = modification.dynamicBoneData.m_StiffnessDistrib; val.m_Inert = modification.dynamicBoneData.m_Inert; val.m_InertDistrib = modification.dynamicBoneData.m_InertDistrib; val.m_Radius = modification.dynamicBoneData.m_Radius; val.m_RadiusDistrib = modification.dynamicBoneData.m_RadiusDistrib; val.m_EndLength = modification.dynamicBoneData.m_EndLength; val.m_EndOffset = modification.dynamicBoneData.m_EndOffset; val.m_Gravity = modification.dynamicBoneData.m_Gravity; val.m_Force = modification.dynamicBoneData.m_Force; val.m_UpdateRate = modification.dynamicBoneData.m_updateRate; val.m_Colliders = list; val.m_Exclusions = new List<Transform>(); foreach (string exclusion in modification.dynamicBoneData.m_Exclusions) { Transform val3 = Utils.FindChildInTree(root, exclusion); if ((Object)(object)val3 != (Object)null) { val.m_Exclusions.Add(val3); } else { Debug.LogWarning((object)"Tried to exclude a transform that could not be found"); } } val.m_FreezeAxis = modification.dynamicBoneData.m_FreezeAxis; } private static void ModificationAddRenderers(GameObject newPart, CharacterModel characterModel) { //IL_0044: 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_0076: 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) SkinnedMeshRenderer[] componentsInChildren = newPart.GetComponentsInChildren<SkinnedMeshRenderer>(true); Array.Resize(ref characterModel.baseRendererInfos, characterModel.baseRendererInfos.Length + componentsInChildren.Length); if (componentsInChildren.Length != 0) { int num = componentsInChildren.Length; SkinnedMeshRenderer[] array = componentsInChildren; foreach (SkinnedMeshRenderer val in array) { characterModel.baseRendererInfos[characterModel.baseRendererInfos.Length - num] = new RendererInfo { renderer = (Renderer)(object)componentsInChildren[^num], ignoreOverlays = false, defaultShadowCastingMode = (ShadowCastingMode)1, defaultMaterial = ((Renderer)val).sharedMaterial }; num--; } } } private void clearModification(Modification modification, GameObject modelObject, AppliedModifications modifications) { if (modification.inst_DB_colliders != null) { foreach (DynamicBoneCollider inst_DB_collider in modification.inst_DB_colliders) { Object.Destroy((Object)(object)inst_DB_collider); } } if (modification.affectsbasemodel) { SkinnedMeshRenderer[] baseSkinRenderers = DynamicSkinHelpers.GetBaseSkinRenderers(modelObject); List<Transform> list = baseSkinRenderers[0].bones.ToList(); list.RemoveRange(modification.boneIndex, modification.boneCount); SkinnedMeshRenderer[] array = baseSkinRenderers; for (int i = 0; i < array.Length; i++) { array[i].bones = list.ToArray(); } } Object.Destroy((Object)(object)modifications.OtherModifications[0].inst_dynamicBone); Object.Destroy((Object)(object)modifications.OtherModifications[0].inst_armature); Object.Destroy((Object)(object)modifications.OtherModifications[0].instance); if (!modifications.OtherModifications.Remove(modification)) { InstanceLogger.LogError((object)"Skin Modification was not removed"); } } } internal class Modification { public string prefabpath; public string bodyname; public string parentname; public GameObject prefab; public bool affectsbasemodel; public DynamicBoneData dynamicBoneData; public string parentSkinToken; public int boneIndex; public int boneCount; public GameObject instance; public GameObject inst_armature; public DynamicBone inst_dynamicBone; public List<DynamicBoneCollider> inst_DB_colliders = new List<DynamicBoneCollider>(); public Modification(string PrefabPath, string ParentName, string BodyName, string ParentSkinToken, int BoneIndex, bool AffectsBaseModel, AssetBundle assetBundle) { bodyname = BodyName; prefabpath = PrefabPath; parentname = ParentName; parentSkinToken = ParentSkinToken; affectsbasemodel = AffectsBaseModel; boneIndex = BoneIndex; prefab = assetBundle.LoadAsset<GameObject>(prefabpath); if ((Object)(object)prefab == (Object)null) { Debug.LogWarning((object)("Asset at " + PrefabPath + " was not loaded")); } } } internal class AppliedModifications { public Stack<Modification> BaseModelModifications = new Stack<Modification>(); public List<Modification> OtherModifications = new List<Modification>(); } internal class DynamicBoneData { public string m_Root; public float m_Damping; public AnimationCurve m_DampingDistrib; public float m_Elasticity; public AnimationCurve m_ElasticityDistrib; public float m_Stiffness; public AnimationCurve m_StiffnessDistrib; public float m_Inert; public AnimationCurve m_InertDistrib; public float m_Radius; public AnimationCurve m_RadiusDistrib; public float m_EndLength; public Vector3 m_EndOffset; public Vector3 m_Gravity; public Vector3 m_Force; public List<DynamicBoneColliderData> m_Colliders; public List<string> m_Exclusions; public FreezeAxis m_FreezeAxis; public float m_updateRate; public DynamicBoneData(string root, float damping, AnimationCurve damping_dist, float elasticity, AnimationCurve elasticity_dist, float stiffness, AnimationCurve stiffness_dist, float inert, AnimationCurve inert_dist, float radius, AnimationCurve radius_dist, float end_length, Vector3 end_offset, Vector3 gravity, Vector3 force, List<DynamicBoneColliderData> colliders, List<string> exclusions, FreezeAxis freeze_axis, float update_rate) { //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_006c: 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_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_008c: 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) m_Root = root; m_Damping = damping; m_DampingDistrib = damping_dist; m_Elasticity = elasticity; m_ElasticityDistrib = elasticity_dist; m_Stiffness = stiffness; m_StiffnessDistrib = stiffness_dist; m_Inert = inert; m_InertDistrib = inert_dist; m_Radius = radius; m_RadiusDistrib = radius_dist; m_EndLength = end_length; m_EndOffset = end_offset; m_Gravity = gravity; m_Force = force; m_Colliders = colliders; m_Exclusions = exclusions; m_FreezeAxis = freeze_axis; m_updateRate = update_rate; } } internal class DynamicBoneColliderData { public string m_parent_name; public Direction m_Direction; public Vector3 m_Center; public Bound m_Bound; public float m_Radius; public float m_Height; public DynamicBoneColliderData(string parent_name, Direction direction, Vector3 Center, Bound bound, float radius, float heaight) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) m_parent_name = parent_name; m_Direction = direction; m_Cen