Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of ChichaDoublePisse v4.0.0
ChichaDoublePisse.dll
Decompiled 16 hours agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using UnityEngine; using UnityEngine.Audio; using UnityEngine.Networking; using UnityEngine.Rendering; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("clomonzer")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("4.0.0.0")] [assembly: AssemblyInformationalVersion("4.0.0")] [assembly: AssemblyProduct("ChichaDoublePisse")] [assembly: AssemblyTitle("ChichaDoublePisse")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("4.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace ChichaDoublePisse { public class DebugDumper : MonoBehaviour { private void Update() { //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: 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_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) if (!Input.GetKeyDown((KeyCode)290)) { return; } PlayerAvatar val = null; PlayerAvatar[] array = Object.FindObjectsOfType<PlayerAvatar>(); foreach (PlayerAvatar val2 in array) { if ((Object)(object)val2.photonView != (Object)null && val2.photonView.IsMine) { val = val2; break; } } if ((Object)(object)val == (Object)null) { Plugin.Logger.LogWarning((object)"[DUMP] Aucun PlayerAvatar local trouve."); return; } StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine("========== DUMP JOUEUR =========="); stringBuilder.AppendLine($"Avatar pos monde : {((Component)val).transform.position}"); stringBuilder.AppendLine($"Avatar scale : {((Component)val).transform.lossyScale}"); Renderer[] componentsInChildren = ((Component)val).GetComponentsInChildren<Renderer>(); if (componentsInChildren.Length != 0) { Bounds bounds = componentsInChildren[0].bounds; Renderer[] array2 = componentsInChildren; foreach (Renderer val3 in array2) { ((Bounds)(ref bounds)).Encapsulate(val3.bounds); } stringBuilder.AppendLine($"Bounds monde : centre={((Bounds)(ref bounds)).center} taille={((Bounds)(ref bounds)).size}"); stringBuilder.AppendLine($">>> HAUTEUR PERSO : {((Bounds)(ref bounds)).size.y:F3} (unites monde)"); stringBuilder.AppendLine($">>> OFFSET TETE : {((Bounds)(ref bounds)).max.y - ((Component)val).transform.position.y:F3} au-dessus de l'origine"); } Animator componentInChildren = ((Component)val).GetComponentInChildren<Animator>(); if ((Object)(object)componentInChildren != (Object)null) { stringBuilder.AppendLine($"Animator trouve. isHuman={componentInChildren.isHuman}"); if (componentInChildren.isHuman) { Transform boneTransform = componentInChildren.GetBoneTransform((HumanBodyBones)10); stringBuilder.AppendLine("Os Head (humanoid) : " + (((Object)(object)boneTransform != (Object)null) ? ((Object)boneTransform).name : "NULL")); } } else { stringBuilder.AppendLine("Aucun Animator trouve."); } stringBuilder.AppendLine("--- Transforms (nom | pos locale | hauteur relative) ---"); Transform[] componentsInChildren2 = ((Component)val).GetComponentsInChildren<Transform>(true); foreach (Transform val4 in componentsInChildren2) { float num = val4.position.y - ((Component)val).transform.position.y; if (num > 0.3f) { stringBuilder.AppendLine($" {((Object)val4).name} | rel_Y={num:F3}"); } } Plugin.Logger.LogInfo((object)stringBuilder.ToString()); } } public class GoofySystem : MonoBehaviourPun { private const float DefaultHeight = 1.8f; private const float MinPlausibleHeight = 0.4f; private const float MaxPlausibleHeight = 12f; private PlayerAvatar _avatar; private PlayerAvatarVisuals _visuals; private Transform _head; private bool _ready; private bool _soundsReady; private float _playerHeight = 1.8f; private float _headOffsetY = 1.53f; private bool _chichaActive; private bool _pisseActive; private bool _petActive; private float _noiseRadius = 30f; private float _noiseMul = 1f; private float _lastNoise; private bool _inhaling; private float _inhaleTime; private bool _pisseBusy; private bool _petBusy; private Sound _sGlouglou; private Sound _sExpiration; private Sound _sBraguette; private Sound _sPisse; private Sound _sZip; private Sound _sPet; private GameObject _chichaModel; private ParticleSystem _smoke; private ParticleSystem _stream; private ParticleSystem _fart; private PhotonView PV { get { if (!((Object)(object)_avatar != (Object)null)) { return ((MonoBehaviourPun)this).photonView; } return _avatar.photonView; } } private bool Busy { get { if (!_inhaling && !_pisseBusy) { return _petBusy; } return true; } } public void Init(PlayerAvatar avatar) { _avatar = avatar; ((MonoBehaviour)this).StartCoroutine(SetupRoutine()); ((MonoBehaviour)this).StartCoroutine(SoundRoutine()); } private IEnumerator SetupRoutine() { yield return (object)new WaitForSeconds(0.75f); if (!((Object)(object)_avatar == (Object)null)) { _visuals = _avatar.playerAvatarVisuals; if ((Object)(object)_visuals == (Object)null && (Object)(object)((Component)_avatar).transform.parent != (Object)null) { _visuals = ((Component)((Component)_avatar).transform.parent).GetComponentInChildren<PlayerAvatarVisuals>(); } MeasurePlayer(); _head = FindHead(); BuildVisuals(); Plugin.Logger.LogInfo((object)($"[CDP] Setup : hauteur={_playerHeight:F2} offsetTete={_headOffsetY:F2} " + "tete=" + (((Object)(object)_head != (Object)null) ? ((Object)_head).name : "fallback"))); _ready = true; } } private IEnumerator SoundRoutine() { float t = 0f; while (((Object)(object)SoundLoader.Instance == (Object)null || !SoundLoader.Instance.Ready) && t < 20f) { t += Time.deltaTime; yield return null; } while (!_ready && t < 25f) { t += Time.deltaTime; yield return null; } if (!((Object)(object)_avatar == (Object)null)) { Transform parent = (((Object)(object)_head != (Object)null) ? _head : ((Component)_avatar).transform); _sGlouglou = SoundLoader.BuildSound("glouglou", parent); _sExpiration = SoundLoader.BuildSound("expiration", parent); _sBraguette = SoundLoader.BuildSound("braguette", ((Component)_avatar).transform); _sPisse = SoundLoader.BuildSound("pisse", ((Component)_avatar).transform); _sZip = SoundLoader.BuildSound("zip_remonte", ((Component)_avatar).transform); _sPet = SoundLoader.BuildSound("pet", ((Component)_avatar).transform); _soundsReady = true; Plugin.Logger.LogInfo((object)("[CDP] Sons prets (pet=" + ((_sPet != null) ? "ok" : "absent") + ").")); } } private void BuildVisuals() { //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) Transform parent = (((Object)(object)_head != (Object)null) ? _head : ((Component)_avatar).transform); _smoke = ProceduralAssets.BuildSmoke(parent); ((Component)_smoke).transform.localPosition = (((Object)(object)_head != (Object)null) ? new Vector3(0f, 0f, 0.22f) : new Vector3(0f, _headOffsetY, 0.22f)); MainModule main = _smoke.main; ((MainModule)(ref main)).startSize = new MinMaxCurve(0.12f, 0.3f); ((MainModule)(ref main)).startSpeed = new MinMaxCurve(0.7f, 1.8f); _stream = ProceduralAssets.BuildStream(((Component)_avatar).transform); ApplyStreamTransform(); ApplyStreamCollision(); _fart = ProceduralAssets.BuildFart(((Component)_avatar).transform); ApplyFartTransform(); _chichaModel = ProceduralAssets.BuildChicha(((Component)_avatar).transform); ApplyChichaTransform(); _chichaModel.SetActive(false); } private void ApplyChichaTransform() { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_chichaModel == (Object)null)) { float num = _playerHeight * 0.45f * Mathf.Max(0.05f, Plugin.ChichaScale.Value); _chichaModel.transform.localScale = Vector3.one * (num / 0.4f); _chichaModel.transform.localPosition = new Vector3(_playerHeight * Plugin.ChichaOffsetX.Value * 0.55f, _playerHeight * Plugin.ChichaOffsetY.Value * 0.55f, _playerHeight * Plugin.ChichaOffsetZ.Value * 0.55f); _chichaModel.transform.localRotation = Quaternion.Euler(0f, Plugin.ChichaRotationY.Value, 0f); } } private void ApplyStreamTransform() { //IL_0033: 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) if (!((Object)(object)_stream == (Object)null)) { ((Component)_stream).transform.localPosition = new Vector3(0f, Plugin.PisseOffsetY.Value, Plugin.PisseOffsetZ.Value); ((Component)_stream).transform.localRotation = Quaternion.Euler(Plugin.PisseAngle.Value, 0f, 0f); } } private void ApplyFartTransform() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_fart == (Object)null)) { ((Component)_fart).transform.localPosition = new Vector3(0f, Plugin.PetOffsetY.Value, 0f - Plugin.PetOffsetZ.Value); ((Component)_fart).transform.localRotation = Quaternion.Euler(-8f, 180f, 0f); } } private void ApplyStreamCollision() { if (!((Object)(object)_stream == (Object)null)) { ApplyCollisionMask(_stream); } } private void ApplyCollisionMask(ParticleSystem ps) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) CollisionModule collision = ps.collision; if (!Plugin.PisseIgnorerJoueur.Value) { ((CollisionModule)(ref collision)).collidesWith = LayerMask.op_Implicit(-1); return; } int num = 0; Transform val = (((Object)(object)((Component)_avatar).transform.parent != (Object)null) ? ((Component)_avatar).transform.parent : ((Component)_avatar).transform); Collider[] componentsInChildren = ((Component)val).GetComponentsInChildren<Collider>(true); foreach (Collider val2 in componentsInChildren) { if (!((Object)(object)val2 == (Object)null)) { num |= 1 << ((Component)val2).gameObject.layer; } } if (num != 0) { ((CollisionModule)(ref collision)).collidesWith = LayerMask.op_Implicit(~num); } } private void MeasurePlayer() { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) Component val = (Component)(((Object)(object)_visuals != (Object)null) ? ((object)_visuals) : ((object)_avatar)); Renderer[] componentsInChildren = val.GetComponentsInChildren<Renderer>(); if (componentsInChildren == null || componentsInChildren.Length == 0) { return; } bool flag = false; Bounds val2 = default(Bounds); Renderer[] array = componentsInChildren; foreach (Renderer val3 in array) { if (!((Object)(object)val3 == (Object)null) && !((Object)((Component)val3).gameObject).name.StartsWith("CDP_")) { if (!flag) { val2 = val3.bounds; flag = true; } else { ((Bounds)(ref val2)).Encapsulate(val3.bounds); } } } if (!flag) { return; } float y = ((Bounds)(ref val2)).size.y; if (y < 0.4f || y > 12f) { Plugin.Logger.LogWarning((object)$"[CDP] Hauteur mesuree aberrante ({y:F3}) — defaut utilise."); _playerHeight = 1.8f; _headOffsetY = 1.53f; return; } _playerHeight = y; _headOffsetY = ((Bounds)(ref val2)).max.y - ((Component)_avatar).transform.position.y; if (_headOffsetY < y * 0.3f) { _headOffsetY = y * 0.85f; } } private Transform FindHead() { Component val = (Component)(((Object)(object)_visuals != (Object)null) ? ((object)_visuals) : ((object)_avatar)); if ((Object)(object)val == (Object)null) { return null; } Animator componentInChildren = val.GetComponentInChildren<Animator>(); if ((Object)(object)componentInChildren != (Object)null && componentInChildren.isHuman) { Transform boneTransform = componentInChildren.GetBoneTransform((HumanBodyBones)10); if ((Object)(object)boneTransform != (Object)null) { return boneTransform; } } Transform[] componentsInChildren = val.GetComponentsInChildren<Transform>(true); foreach (Transform val2 in componentsInChildren) { string text = ((Object)val2).name.ToLowerInvariant(); if (text.Contains("head") || text.Contains("tete") || text.Contains("neck") || text.Contains("face")) { return val2; } } return null; } private void Update() { //IL_00f2: Unknown result type (might be due to invalid IL or missing references) if (!_ready) { return; } if (_soundsReady) { if (_sGlouglou != null) { _sGlouglou.PlayLoop(_chichaActive, 0.4f, 0.4f, 1f, 1f); } if (_sPisse != null) { _sPisse.PlayLoop(_pisseActive, 0.2f, 0.3f, 1f, 1f); } } if ((_chichaActive || _pisseActive || _petActive) && (Object)(object)_avatar != (Object)null) { float num = Mathf.Max(0.1f, Plugin.NoiseInterval.Value); if (Time.time - _lastNoise >= num) { _lastNoise = Time.time; string label = (_petActive ? "pet" : (_pisseActive ? "pisse" : "chicha")); NoiseMaker.Emit(((Component)_avatar).transform.position, _noiseRadius * _noiseMul, label); } } if (!((Object)(object)PV == (Object)null) && PV.IsMine && !((Object)(object)_avatar == (Object)null) && !_avatar.deadSet && (!((Object)(object)ChatManager.instance != (Object)null) || !ChatManager.instance.chatActive)) { HandleChichaInput(); HandlePisseInput(); HandlePetInput(); } } private void HandleChichaInput() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) if (_pisseBusy || _petBusy) { return; } if (Input.GetKeyDown(Plugin.ChichaKey.Value) && !_inhaling) { _inhaling = true; _inhaleTime = 0f; ApplyChichaTransform(); PV.RPC("RPC_ChichaStart", (RpcTarget)0, new object[2] { Plugin.NoiseRadius.Value, Plugin.VolGlouglou.Value }); } else if (_inhaling) { _inhaleTime += Time.deltaTime; if (Input.GetKeyUp(Plugin.ChichaKey.Value)) { _inhaling = false; float num = Mathf.Clamp01(_inhaleTime / 2.5f); PV.RPC("RPC_ChichaExhale", (RpcTarget)0, new object[2] { num, Plugin.VolExpiration.Value }); } } } [PunRPC] private void RPC_ChichaStart(float noiseRadius, float volGlouglou) { _noiseRadius = noiseRadius; _noiseMul = 1f; _chichaActive = true; _lastNoise = 0f; SoundLoader.SetVolume(_sGlouglou, volGlouglou); if ((Object)(object)_chichaModel != (Object)null) { _chichaModel.SetActive(true); } } [PunRPC] private void RPC_ChichaExhale(float intensity, float volExpiration) { //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) _chichaActive = false; if ((Object)(object)_chichaModel != (Object)null) { _chichaModel.SetActive(false); } SoundLoader.SetVolume(_sExpiration, volExpiration); if (_sExpiration != null && (Object)(object)_avatar != (Object)null) { _sExpiration.Play(((Component)_avatar).transform.position, 1f, 1f, 1f, 1f); } if (!((Object)(object)_smoke == (Object)null)) { MainModule main = _smoke.main; ((MainModule)(ref main)).startLifetime = new MinMaxCurve(1.2f + intensity * 1.5f, 2.4f + intensity * 2f); ((MainModule)(ref main)).startSize = new MinMaxCurve(0.1f + intensity * 0.1f, 0.24f + intensity * 0.18f); Transform val = (((Object)(object)_head != (Object)null) ? _head : ((Component)_avatar).transform); ((Component)_smoke).transform.rotation = val.rotation; _smoke.Play(); } } private void HandlePisseInput() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) if (!Busy && Input.GetKeyDown(Plugin.PisseKey.Value)) { _pisseBusy = true; PV.RPC("RPC_PisseStart", (RpcTarget)0, new object[4] { Plugin.NoiseRadius.Value, Plugin.VolBraguette.Value, Plugin.VolPisse.Value, Plugin.VolZip.Value }); } } [PunRPC] private void RPC_PisseStart(float noiseRadius, float volBraguette, float volPisse, float volZip) { _noiseRadius = noiseRadius; _noiseMul = 1f; SoundLoader.SetVolume(_sBraguette, volBraguette); SoundLoader.SetVolume(_sPisse, volPisse); SoundLoader.SetVolume(_sZip, volZip); ((MonoBehaviour)this).StartCoroutine(PisseRoutine()); } private IEnumerator PisseRoutine() { if (_sBraguette != null && (Object)(object)_avatar != (Object)null) { _sBraguette.Play(((Component)_avatar).transform.position, 1f, 1f, 1f, 1f); } yield return (object)new WaitForSeconds(0.6f); if ((Object)(object)_stream != (Object)null && (Object)(object)_avatar != (Object)null) { ApplyStreamTransform(); ApplyStreamCollision(); Transform val = (((Object)(object)_head != (Object)null) ? _head : ((Component)_avatar).transform); Vector3 forward = val.forward; ((Component)_stream).transform.rotation = Quaternion.LookRotation(new Vector3(forward.x, Mathf.Clamp(forward.y, -0.9f, 0.15f), forward.z)); _stream.Play(); Plugin.Logger.LogInfo((object)($"[CDP] Jet emis depuis {((Component)_stream).transform.position} " + $"(joueur {((Component)_avatar).transform.position}, " + $"ecart {Vector3.Distance(((Component)_stream).transform.position, ((Component)_avatar).transform.position):F2})")); } _pisseActive = true; _lastNoise = 0f; yield return (object)new WaitForSeconds(8f); _pisseActive = false; if ((Object)(object)_stream != (Object)null) { _stream.Stop(true, (ParticleSystemStopBehavior)1); } if (_sZip != null && (Object)(object)_avatar != (Object)null) { _sZip.Play(((Component)_avatar).transform.position, 1f, 1f, 1f, 1f); } yield return (object)new WaitForSeconds(0.5f); if ((Object)(object)PV != (Object)null && PV.IsMine) { _pisseBusy = false; } } private void HandlePetInput() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) if (!Busy && Input.GetKeyDown(Plugin.PetKey.Value)) { _petBusy = true; PV.RPC("RPC_PetStart", (RpcTarget)0, new object[3] { Plugin.NoiseRadius.Value, Plugin.VolPet.Value, Plugin.PetNoiseMultiplier.Value }); } } [PunRPC] private void RPC_PetStart(float noiseRadius, float volPet, float noiseMul) { _noiseRadius = noiseRadius; _noiseMul = Mathf.Max(0.1f, noiseMul); SoundLoader.SetVolume(_sPet, volPet); ((MonoBehaviour)this).StartCoroutine(PetRoutine()); } private IEnumerator PetRoutine() { if (_sPet != null && (Object)(object)_avatar != (Object)null) { _sPet.Play(((Component)_avatar).transform.position, 1f, 1f, 1f, 1f); } if ((Object)(object)_fart != (Object)null && (Object)(object)_avatar != (Object)null) { ApplyFartTransform(); ApplyCollisionMask(_fart); Vector3 val = -((Component)_avatar).transform.forward; Transform transform = ((Component)_fart).transform; Vector3 val2 = new Vector3(val.x, -0.15f, val.z); transform.rotation = Quaternion.LookRotation(((Vector3)(ref val2)).normalized); _fart.Play(); } _petActive = true; _lastNoise = 0f; yield return (object)new WaitForSeconds(Mathf.Max(0.3f, Plugin.PetDuration.Value)); _petActive = false; if ((Object)(object)_fart != (Object)null) { _fart.Stop(true, (ParticleSystemStopBehavior)1); } yield return (object)new WaitForSeconds(0.4f); if ((Object)(object)PV != (Object)null && PV.IsMine) { _petBusy = false; } } private void OnDestroy() { _chichaActive = false; _pisseActive = false; _petActive = false; if ((Object)(object)_chichaModel != (Object)null) { Object.Destroy((Object)(object)_chichaModel); } if ((Object)(object)_smoke != (Object)null) { Object.Destroy((Object)(object)((Component)_smoke).gameObject); } if ((Object)(object)_stream != (Object)null) { Object.Destroy((Object)(object)((Component)_stream).gameObject); } if ((Object)(object)_fart != (Object)null) { Object.Destroy((Object)(object)((Component)_fart).gameObject); } } } public static class NoiseMaker { private static float _lastLog; public static void Emit(Vector3 position, float radius, string label) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) if (Plugin.NoiseEnabled.Value && !((Object)(object)EnemyDirector.instance == (Object)null)) { EnemyDirector.instance.SetInvestigate(position, radius, false); if (Time.time - _lastLog > 1f) { _lastLog = Time.time; Plugin.Logger.LogInfo((object)$"[CDP] Bruit '{label}' rayon={radius:F0}"); } } } } [HarmonyPatch(typeof(PlayerAvatar))] internal class PlayerAvatarPatch { [HarmonyPostfix] [HarmonyPatch("Start")] private static void Start_Postfix(PlayerAvatar __instance) { //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) if (!GameManager.Multiplayer()) { Plugin.Logger.LogInfo((object)"Partie solo : Chicha Double Pisse desactive."); return; } if ((Object)(object)GameManager.instance != (Object)null && GameManager.instance.connectRandom) { Plugin.Logger.LogWarning((object)"ATTENTION : lobby public detecte. Les joueurs sans le mod vont recevoir des RPC inconnus et spammer des erreurs. Utilise ce mod en lobby prive avec des potes qui l'ont installe."); } GoofySystem goofySystem = ((Component)__instance).GetComponent<GoofySystem>(); if ((Object)(object)goofySystem == (Object)null) { goofySystem = ((Component)__instance).gameObject.AddComponent<GoofySystem>(); } goofySystem.Init(__instance); if ((Object)(object)__instance.photonView != (Object)null && __instance.photonView.IsMine) { Plugin.Logger.LogInfo((object)($"Chicha Double Pisse actif — [{Plugin.ChichaKey.Value}] chicha, " + $"[{Plugin.PisseKey.Value}] pisse.")); } } } [BepInPlugin("clomonzer.chichadoublepisse", "Chicha Double Pisse", "4.0.0")] public class Plugin : BaseUnityPlugin { public const string PluginGuid = "clomonzer.chichadoublepisse"; public const string PluginName = "Chicha Double Pisse"; public const string PluginVersion = "4.0.0"; public const string PluginAuthor = "clomonzer"; public const float PisseDuration = 8f; internal Harmony Harmony; public static ConfigEntry<KeyCode> ChichaKey; public static ConfigEntry<KeyCode> PisseKey; public static ConfigEntry<KeyCode> PetKey; public static ConfigEntry<float> Volume; public static ConfigEntry<float> VolGlouglou; public static ConfigEntry<float> VolExpiration; public static ConfigEntry<float> VolBraguette; public static ConfigEntry<float> VolPisse; public static ConfigEntry<float> VolZip; public static ConfigEntry<float> VolPet; public static ConfigEntry<bool> NoiseEnabled; public static ConfigEntry<float> NoiseRadius; public static ConfigEntry<float> NoiseInterval; public static ConfigEntry<float> ChichaScale; public static ConfigEntry<float> ChichaOffsetX; public static ConfigEntry<float> ChichaOffsetY; public static ConfigEntry<float> ChichaOffsetZ; public static ConfigEntry<float> ChichaRotationY; public static ConfigEntry<float> PisseOffsetY; public static ConfigEntry<float> PisseOffsetZ; public static ConfigEntry<float> PisseAngle; public static ConfigEntry<bool> PisseIgnorerJoueur; public static ConfigEntry<float> PetOffsetY; public static ConfigEntry<float> PetOffsetZ; public static ConfigEntry<float> PetDuration; public static ConfigEntry<float> PetNoiseMultiplier; internal static Plugin Instance { get; private set; } internal static ManualLogSource Logger => Instance._log; private ManualLogSource _log => ((BaseUnityPlugin)this).Logger; public static string SoundsFolder { get; private set; } private void Awake() { //IL_043b: Unknown result type (might be due to invalid IL or missing references) //IL_0445: Expected O, but got Unknown //IL_0464: Unknown result type (might be due to invalid IL or missing references) //IL_0473: Unknown result type (might be due to invalid IL or missing references) Instance = this; ((Component)this).gameObject.transform.parent = null; ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); string text = Path.Combine(directoryName, "sounds"); SoundsFolder = ((Directory.Exists(text) && Directory.GetFiles(text).Length != 0) ? text : directoryName); ChichaKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Touches", "Chicha", (KeyCode)98, "Maintenir pour tirer sur la chicha. Relacher pour recracher."); PisseKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Touches", "Pisse", (KeyCode)110, "Appuyer pour pisser (duree fixe de 8s)."); PetKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Touches", "Pet", (KeyCode)103, "Appuyer pour peter."); Volume = ((BaseUnityPlugin)this).Config.Bind<float>("Audio", "VolumeGeneral", 0.8f, "Volume global. Reglage PERSONNEL : n'affecte que ce que TU entends."); VolGlouglou = ((BaseUnityPlugin)this).Config.Bind<float>("Volumes", "Glouglou", 2.5f, "Volume du glouglou de la chicha. Monte par defaut car ce son est souvent enregistre tres bas. Transmis aux autres joueurs : ton reglage vaut pour tout le monde."); VolExpiration = ((BaseUnityPlugin)this).Config.Bind<float>("Volumes", "Expiration", 1f, "Volume du souffle quand tu recraches. Transmis aux autres joueurs."); VolBraguette = ((BaseUnityPlugin)this).Config.Bind<float>("Volumes", "Braguette", 1f, "Volume de la braguette qui descend. Transmis aux autres joueurs."); VolPisse = ((BaseUnityPlugin)this).Config.Bind<float>("Volumes", "Pisse", 1f, "Volume du jet. Transmis aux autres joueurs."); VolZip = ((BaseUnityPlugin)this).Config.Bind<float>("Volumes", "BraguetteRemontee", 1f, "Volume de la braguette qui remonte. Transmis aux autres joueurs."); VolPet = ((BaseUnityPlugin)this).Config.Bind<float>("Volumes", "Pet", 1f, "Volume du pet. Transmis aux autres joueurs."); NoiseEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Bruit", "AlerterLesMonstres", true, "false = mod purement cosmetique."); NoiseRadius = ((BaseUnityPlugin)this).Config.Bind<float>("Bruit", "Rayon", 30f, "Rayon d'alerte. Reperes : 10 = ver, 15 = vache, 30 = de qui roule. La valeur de CELUI QUI DECLENCHE fait foi."); NoiseInterval = ((BaseUnityPlugin)this).Config.Bind<float>("Bruit", "Intervalle", 0.7f, "Secondes entre deux alertes pendant un bruit continu. Trop bas, le Chasseur reset sa visee en boucle et tire a cote. Monte cette valeur s'il rate ses tirs."); ChichaScale = ((BaseUnityPlugin)this).Config.Bind<float>("Chicha", "Echelle", 1f, "Taille de la chicha. Monte si elle est trop petite."); ChichaOffsetX = ((BaseUnityPlugin)this).Config.Bind<float>("Chicha", "DecalageX", 0.5f, "Decalage lateral (+ = a droite du joueur)."); ChichaOffsetY = ((BaseUnityPlugin)this).Config.Bind<float>("Chicha", "DecalageY", 0f, "Decalage vertical (+ = vers le haut)."); ChichaOffsetZ = ((BaseUnityPlugin)this).Config.Bind<float>("Chicha", "DecalageZ", 0.4f, "Decalage avant/arriere (+ = devant le joueur)."); ChichaRotationY = ((BaseUnityPlugin)this).Config.Bind<float>("Chicha", "RotationY", 180f, "Rotation autour de l'axe vertical, en degres."); PisseOffsetY = ((BaseUnityPlugin)this).Config.Bind<float>("Pisse", "HauteurDepart", 0.55f, "Hauteur du point de depart, en UNITES ABSOLUES (pas en fraction de la taille du joueur : la mesure n'etait pas fiable et projetait le jet a plusieurs metres devant)."); PisseOffsetZ = ((BaseUnityPlugin)this).Config.Bind<float>("Pisse", "DistanceDevant", 0.4f, "Distance devant le joueur, en UNITES ABSOLUES. Si le jet apparait loin de toi (dans un mur, sur une porte), BAISSE. S'il stagne sur place, monte legerement."); PisseAngle = ((BaseUnityPlugin)this).Config.Bind<float>("Pisse", "AngleDescente", 18f, "Inclinaison vers le bas, en degres. 0 = horizontal."); PisseIgnorerJoueur = ((BaseUnityPlugin)this).Config.Bind<bool>("Pisse", "IgnorerCollisionJoueur", true, "Empeche les particules de rebondir sur les joueurs. Si le jet traverse les MURS, passe a false."); PetOffsetY = ((BaseUnityPlugin)this).Config.Bind<float>("Pet", "HauteurDepart", 0.5f, "Hauteur du point de depart, en unites absolues."); PetOffsetZ = ((BaseUnityPlugin)this).Config.Bind<float>("Pet", "DistanceDerriere", 0.35f, "Distance DERRIERE le joueur, en unites absolues."); PetDuration = ((BaseUnityPlugin)this).Config.Bind<float>("Pet", "Duree", 1.6f, "Duree de la projection, en secondes."); PetNoiseMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Pet", "MultiplicateurBruit", 1.3f, "Le pet est plus bruyant que la chicha. 1.0 = identique."); if (!Directory.Exists(SoundsFolder)) { Directory.CreateDirectory(SoundsFolder); } Logger.LogInfo((object)("Dossier sons : " + SoundsFolder)); ((Component)this).gameObject.AddComponent<SoundLoader>(); Harmony = new Harmony("clomonzer.chichadoublepisse"); Harmony.PatchAll(); Logger.LogInfo((object)("Chicha Double Pisse v4.0.0 par clomonzer — " + $"[{ChichaKey.Value}] chicha, [{PisseKey.Value}] pisse.")); } } public static class ProceduralAssets { private static Material _unlit; private static Material GetMat(Color c) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Expected O, but got Unknown //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Expected O, but got Unknown if ((Object)(object)_unlit == (Object)null) { Shader val = Shader.Find("Sprites/Default") ?? Shader.Find("Unlit/Color") ?? Shader.Find("Standard"); _unlit = new Material(val); } Material val2 = new Material(_unlit); val2.color = c; return val2; } private static GameObject Primitive(PrimitiveType type, Transform parent, Vector3 localPos, Vector3 localScale, Color color) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) GameObject val = GameObject.CreatePrimitive(type); Collider component = val.GetComponent<Collider>(); if ((Object)(object)component != (Object)null) { Object.Destroy((Object)(object)component); } val.transform.SetParent(parent, false); val.transform.localPosition = localPos; val.transform.localScale = localScale; Renderer component2 = val.GetComponent<Renderer>(); if ((Object)(object)component2 != (Object)null) { component2.material = GetMat(color); component2.shadowCastingMode = (ShadowCastingMode)0; component2.receiveShadows = false; } return val; } public static GameObject BuildChicha(Transform parent) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_011f: 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_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0186: 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_0198: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Expected O, but got Unknown //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_025d: Unknown result type (might be due to invalid IL or missing references) //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_0276: Unknown result type (might be due to invalid IL or missing references) //IL_0290: Unknown result type (might be due to invalid IL or missing references) //IL_02a0: Unknown result type (might be due to invalid IL or missing references) //IL_02aa: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("ChichaModel"); val.transform.SetParent(parent, false); Color color = default(Color); ((Color)(ref color))..ctor(0.25f, 0.55f, 0.75f, 1f); Color color2 = default(Color); ((Color)(ref color2))..ctor(0.72f, 0.7f, 0.66f, 1f); Color color3 = default(Color); ((Color)(ref color3))..ctor(0.15f, 0.15f, 0.18f, 1f); Color color4 = default(Color); ((Color)(ref color4))..ctor(0.85f, 0.3f, 0.1f, 1f); Primitive((PrimitiveType)0, val.transform, new Vector3(0f, 0.06f, 0f), new Vector3(0.13f, 0.13f, 0.13f), color); Primitive((PrimitiveType)2, val.transform, new Vector3(0f, 0.2f, 0f), new Vector3(0.022f, 0.11f, 0.022f), color2); Primitive((PrimitiveType)2, val.transform, new Vector3(0f, 0.17f, 0f), new Vector3(0.075f, 0.006f, 0.075f), color2); Primitive((PrimitiveType)2, val.transform, new Vector3(0f, 0.315f, 0f), new Vector3(0.045f, 0.028f, 0.045f), color2); Primitive((PrimitiveType)3, val.transform, new Vector3(0f, 0.35f, 0f), new Vector3(0.04f, 0.012f, 0.04f), color4); GameObject val2 = new GameObject("Hose"); val2.transform.SetParent(val.transform, false); for (int i = 0; i < 5; i++) { float num = (float)i / 4f; GameObject val3 = Primitive((PrimitiveType)2, val2.transform, new Vector3(0.05f + num * 0.1f, 0.2f + num * 0.05f, 0f), new Vector3(0.012f, 0.035f, 0.012f), color3); val3.transform.localRotation = Quaternion.Euler(0f, 0f, 55f - num * 25f); } Primitive((PrimitiveType)2, val2.transform, new Vector3(0.17f, 0.27f, 0f), new Vector3(0.016f, 0.03f, 0.016f), color2).transform.localRotation = Quaternion.Euler(0f, 0f, 25f); val.transform.localScale = Vector3.one * 1.4f; return val; } public static ParticleSystem BuildSmoke(Transform parent) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: 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_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: 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_01be: Expected O, but got Unknown //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Expected O, but got Unknown //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_025a: 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_026d: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("CDP_Smoke"); val.transform.SetParent(parent, false); ParticleSystem val2 = val.AddComponent<ParticleSystem>(); val2.Stop(true, (ParticleSystemStopBehavior)0); MainModule main = val2.main; ((MainModule)(ref main)).duration = 2f; ((MainModule)(ref main)).loop = false; ((MainModule)(ref main)).startLifetime = new MinMaxCurve(1.6f, 3.2f); ((MainModule)(ref main)).startSpeed = new MinMaxCurve(0.7f, 1.8f); ((MainModule)(ref main)).startSize = new MinMaxCurve(0.12f, 0.3f); ((MainModule)(ref main)).startColor = new MinMaxGradient(new Color(0.92f, 0.92f, 0.95f, 0.55f), new Color(0.8f, 0.82f, 0.88f, 0.35f)); ((MainModule)(ref main)).gravityModifier = MinMaxCurve.op_Implicit(-0.06f); ((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)1; ((MainModule)(ref main)).playOnAwake = false; ((MainModule)(ref main)).maxParticles = 220; EmissionModule emission = val2.emission; ((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(0f); ((EmissionModule)(ref emission)).SetBursts((Burst[])(object)new Burst[3] { new Burst(0f, (short)26), new Burst(0.15f, (short)18), new Burst(0.35f, (short)10) }); ShapeModule shape = val2.shape; ((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)4; ((ShapeModule)(ref shape)).angle = 14f; ((ShapeModule)(ref shape)).radius = 0.045f; SizeOverLifetimeModule sizeOverLifetime = val2.sizeOverLifetime; ((SizeOverLifetimeModule)(ref sizeOverLifetime)).enabled = true; AnimationCurve val3 = new AnimationCurve((Keyframe[])(object)new Keyframe[2] { new Keyframe(0f, 0.35f), new Keyframe(1f, 1f) }); ((SizeOverLifetimeModule)(ref sizeOverLifetime)).size = new MinMaxCurve(1f, val3); ColorOverLifetimeModule colorOverLifetime = val2.colorOverLifetime; ((ColorOverLifetimeModule)(ref colorOverLifetime)).enabled = true; Gradient val4 = new Gradient(); val4.SetKeys((GradientColorKey[])(object)new GradientColorKey[2] { new GradientColorKey(Color.white, 0f), new GradientColorKey(Color.white, 1f) }, (GradientAlphaKey[])(object)new GradientAlphaKey[3] { new GradientAlphaKey(0.6f, 0f), new GradientAlphaKey(0.45f, 0.3f), new GradientAlphaKey(0f, 1f) }); ((ColorOverLifetimeModule)(ref colorOverLifetime)).color = new MinMaxGradient(val4); ParticleSystemRenderer component = val.GetComponent<ParticleSystemRenderer>(); ((Renderer)component).material = GetMat(new Color(1f, 1f, 1f, 0.5f)); component.renderMode = (ParticleSystemRenderMode)0; return val2; } public static ParticleSystem BuildFart(Transform parent) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: 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_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Expected O, but got Unknown //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Expected O, but got Unknown //IL_0213: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_0242: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Unknown result type (might be due to invalid IL or missing references) //IL_025e: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_0274: Unknown result type (might be due to invalid IL or missing references) //IL_0279: Unknown result type (might be due to invalid IL or missing references) //IL_028a: Unknown result type (might be due to invalid IL or missing references) //IL_028f: Unknown result type (might be due to invalid IL or missing references) //IL_029d: Unknown result type (might be due to invalid IL or missing references) //IL_02a8: Unknown result type (might be due to invalid IL or missing references) //IL_02ad: Unknown result type (might be due to invalid IL or missing references) //IL_02be: Unknown result type (might be due to invalid IL or missing references) //IL_02d5: Unknown result type (might be due to invalid IL or missing references) //IL_02da: Unknown result type (might be due to invalid IL or missing references) //IL_02fb: Unknown result type (might be due to invalid IL or missing references) //IL_030c: Unknown result type (might be due to invalid IL or missing references) //IL_031d: Unknown result type (might be due to invalid IL or missing references) //IL_0345: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("CDP_Fart"); val.transform.SetParent(parent, false); ParticleSystem val2 = val.AddComponent<ParticleSystem>(); val2.Stop(true, (ParticleSystemStopBehavior)0); MainModule main = val2.main; ((MainModule)(ref main)).duration = 2f; ((MainModule)(ref main)).loop = false; ((MainModule)(ref main)).startLifetime = new MinMaxCurve(1f, 2.2f); ((MainModule)(ref main)).startSpeed = new MinMaxCurve(2.5f, 6f); ((MainModule)(ref main)).startSize = new MinMaxCurve(0.06f, 0.2f); ((MainModule)(ref main)).startColor = new MinMaxGradient(new Color(0.42f, 0.26f, 0.1f, 0.9f), new Color(0.28f, 0.16f, 0.06f, 0.8f)); ((MainModule)(ref main)).gravityModifier = MinMaxCurve.op_Implicit(0.55f); ((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)1; ((MainModule)(ref main)).playOnAwake = false; ((MainModule)(ref main)).maxParticles = 500; EmissionModule emission = val2.emission; ((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(45f); ((EmissionModule)(ref emission)).SetBursts((Burst[])(object)new Burst[3] { new Burst(0f, (short)45), new Burst(0.08f, (short)25), new Burst(0.2f, (short)15) }); ShapeModule shape = val2.shape; ((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)4; ((ShapeModule)(ref shape)).angle = 28f; ((ShapeModule)(ref shape)).radius = 0.06f; SizeOverLifetimeModule sizeOverLifetime = val2.sizeOverLifetime; ((SizeOverLifetimeModule)(ref sizeOverLifetime)).enabled = true; ((SizeOverLifetimeModule)(ref sizeOverLifetime)).size = new MinMaxCurve(1f, new AnimationCurve((Keyframe[])(object)new Keyframe[3] { new Keyframe(0f, 0.5f), new Keyframe(0.4f, 1f), new Keyframe(1f, 0.75f) })); ColorOverLifetimeModule colorOverLifetime = val2.colorOverLifetime; ((ColorOverLifetimeModule)(ref colorOverLifetime)).enabled = true; Gradient val3 = new Gradient(); val3.SetKeys((GradientColorKey[])(object)new GradientColorKey[2] { new GradientColorKey(new Color(0.48f, 0.3f, 0.12f), 0f), new GradientColorKey(new Color(0.24f, 0.14f, 0.05f), 1f) }, (GradientAlphaKey[])(object)new GradientAlphaKey[3] { new GradientAlphaKey(0.95f, 0f), new GradientAlphaKey(0.7f, 0.5f), new GradientAlphaKey(0f, 1f) }); ((ColorOverLifetimeModule)(ref colorOverLifetime)).color = new MinMaxGradient(val3); NoiseModule noise = val2.noise; ((NoiseModule)(ref noise)).enabled = true; ((NoiseModule)(ref noise)).strength = MinMaxCurve.op_Implicit(0.6f); ((NoiseModule)(ref noise)).frequency = 1.2f; CollisionModule collision = val2.collision; ((CollisionModule)(ref collision)).enabled = true; ((CollisionModule)(ref collision)).type = (ParticleSystemCollisionType)1; ((CollisionModule)(ref collision)).mode = (ParticleSystemCollisionMode)0; ((CollisionModule)(ref collision)).dampen = MinMaxCurve.op_Implicit(0.4f); ((CollisionModule)(ref collision)).bounce = MinMaxCurve.op_Implicit(0.1f); ((CollisionModule)(ref collision)).lifetimeLoss = MinMaxCurve.op_Implicit(0.4f); ParticleSystemRenderer component = val.GetComponent<ParticleSystemRenderer>(); ((Renderer)component).material = GetMat(new Color(0.4f, 0.24f, 0.1f, 0.9f)); component.renderMode = (ParticleSystemRenderMode)0; return val2; } public static ParticleSystem BuildStream(Transform parent) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: 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_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("CDP_Stream"); val.transform.SetParent(parent, false); ParticleSystem val2 = val.AddComponent<ParticleSystem>(); val2.Stop(true, (ParticleSystemStopBehavior)0); MainModule main = val2.main; ((MainModule)(ref main)).duration = 10f; ((MainModule)(ref main)).loop = true; ((MainModule)(ref main)).startLifetime = new MinMaxCurve(0.8f, 1.3f); ((MainModule)(ref main)).startSpeed = new MinMaxCurve(3.2f, 4.4f); ((MainModule)(ref main)).startSize = new MinMaxCurve(0.03f, 0.055f); ((MainModule)(ref main)).startColor = new MinMaxGradient(new Color(0.98f, 0.92f, 0.35f, 0.85f), new Color(0.92f, 0.82f, 0.22f, 0.75f)); ((MainModule)(ref main)).gravityModifier = MinMaxCurve.op_Implicit(1.5f); ((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)1; ((MainModule)(ref main)).playOnAwake = false; ((MainModule)(ref main)).maxParticles = 400; EmissionModule emission = val2.emission; ((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(110f); ShapeModule shape = val2.shape; ((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)4; ((ShapeModule)(ref shape)).angle = 3.5f; ((ShapeModule)(ref shape)).radius = 0.012f; CollisionModule collision = val2.collision; ((CollisionModule)(ref collision)).enabled = true; ((CollisionModule)(ref collision)).type = (ParticleSystemCollisionType)1; ((CollisionModule)(ref collision)).mode = (ParticleSystemCollisionMode)0; ((CollisionModule)(ref collision)).dampen = MinMaxCurve.op_Implicit(0.25f); ((CollisionModule)(ref collision)).bounce = MinMaxCurve.op_Implicit(0.05f); ((CollisionModule)(ref collision)).lifetimeLoss = MinMaxCurve.op_Implicit(0.75f); ParticleSystemRenderer component = val.GetComponent<ParticleSystemRenderer>(); ((Renderer)component).material = GetMat(new Color(0.97f, 0.9f, 0.3f, 0.85f)); component.renderMode = (ParticleSystemRenderMode)1; component.velocityScale = 0.06f; component.lengthScale = 2.2f; return val2; } } public class SoundLoader : MonoBehaviour { private readonly Dictionary<string, AudioClip> _clips = new Dictionary<string, AudioClip>(); public const string GlouGlou = "glouglou"; public const string Expiration = "expiration"; public const string Braguette = "braguette"; public const string Pisse = "pisse"; public const string Zip = "zip_remonte"; public const string Pet = "pet"; private static readonly string[] Expected = new string[6] { "glouglou", "expiration", "braguette", "pisse", "zip_remonte", "pet" }; private static readonly string[] Extensions = new string[3] { ".ogg", ".wav", ".mp3" }; private static bool _templateCaptured; private static AudioMixerGroup _mixerGroup; private static AudioRolloffMode _rolloff = (AudioRolloffMode)0; private static AnimationCurve _customCurve; private static float _minDistance = 1f; private static float _maxDistance = 15f; public static SoundLoader Instance { get; private set; } public bool Ready { get; private set; } private void Awake() { Instance = this; ((MonoBehaviour)this).StartCoroutine(LoadAll()); } private IEnumerator LoadAll() { string[] expected = Expected; foreach (string text in expected) { string text2 = null; string[] extensions = Extensions; foreach (string text3 in extensions) { string text4 = Path.Combine(Plugin.SoundsFolder, text + text3); if (File.Exists(text4)) { text2 = text4; break; } } if (text2 == null) { Plugin.Logger.LogWarning((object)("Son manquant : " + text + " — effet silencieux.")); } else { yield return LoadOne(text, text2); } } Ready = true; Plugin.Logger.LogInfo((object)$"Sons charges : {_clips.Count}/{Expected.Length}"); } private IEnumerator LoadOne(string key, string path) { AudioType val = (AudioType)14; string text = Path.GetExtension(path).ToLowerInvariant(); if (text == ".wav") { val = (AudioType)20; } else if (text == ".mp3") { val = (AudioType)13; } string text2 = "file://" + path.Replace("\\", "/").Replace(" ", "%20"); UnityWebRequest req = UnityWebRequestMultimedia.GetAudioClip(text2, val); try { yield return req.SendWebRequest(); if ((int)req.result != 1) { Plugin.Logger.LogError((object)("Echec chargement '" + key + "' : " + req.error)); yield break; } AudioClip content = DownloadHandlerAudioClip.GetContent(req); if ((Object)(object)content == (Object)null) { yield break; } ((Object)content).name = key; _clips[key] = content; } finally { ((IDisposable)req)?.Dispose(); } } public AudioClip Get(string key) { if (!_clips.TryGetValue(key, out var value)) { return null; } return value; } private static void CaptureTemplate() { //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Invalid comparison between Unknown and I4 //IL_0115: Unknown result type (might be due to invalid IL or missing references) if (_templateCaptured) { return; } AudioSource val = null; float num = -1f; AudioSource[] array = Object.FindObjectsOfType<AudioSource>(); foreach (AudioSource val2 in array) { if (!((Object)(object)val2 == (Object)null) && !((Object)((Component)val2).gameObject).name.StartsWith("CDP_") && !(val2.spatialBlend < 0.5f)) { float num2 = val2.spatialBlend; if ((Object)(object)val2.outputAudioMixerGroup != (Object)null) { num2 += 2f; } if (val2.maxDistance > 0.1f) { num2 += 1f; } if (num2 > num) { num = num2; val = val2; } } } if ((Object)(object)val == (Object)null) { Plugin.Logger.LogWarning((object)"[CDP] Aucune AudioSource vanilla 3D trouvee."); return; } _mixerGroup = val.outputAudioMixerGroup; _rolloff = val.rolloffMode; _minDistance = val.minDistance; _maxDistance = val.maxDistance; if ((int)_rolloff == 2) { _customCurve = val.GetCustomCurve((AudioSourceCurveType)0); } _templateCaptured = true; Plugin.Logger.LogInfo((object)($"[CDP] Modele audio : '{((Object)((Component)val).gameObject).name}' rolloff={_rolloff} " + $"min={_minDistance:F1} max={_maxDistance:F1} " + "mixer=" + (((Object)(object)_mixerGroup != (Object)null) ? ((Object)_mixerGroup).name : "aucun"))); } private static AudioSource BuildSource(string name, Transform parent) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Invalid comparison between Unknown and I4 CaptureTemplate(); GameObject val = new GameObject("CDP_" + name); val.transform.SetParent(parent, false); val.transform.localPosition = Vector3.zero; AudioSource val2 = val.AddComponent<AudioSource>(); val2.playOnAwake = false; val2.spatialBlend = 1f; val2.outputAudioMixerGroup = _mixerGroup; val2.rolloffMode = _rolloff; val2.minDistance = _minDistance; val2.maxDistance = Mathf.Max(_maxDistance, _minDistance + 0.1f); if ((int)_rolloff == 2 && _customCurve != null) { val2.SetCustomCurve((AudioSourceCurveType)0, _customCurve); } return val2; } public static void SetVolume(Sound s, float emitterVolume) { if (s != null) { s.Volume = Mathf.Clamp(emitterVolume * Mathf.Clamp01(Plugin.Volume.Value), 0f, 4f); } } public static Sound BuildSound(string key, Transform parent, float volume = 1f) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown if ((Object)(object)Instance == (Object)null) { return null; } AudioClip val = Instance.Get(key); if ((Object)(object)val == (Object)null) { return null; } AudioSource source = BuildSource(key, parent); Sound val2 = new Sound(); val2.Source = source; val2.Sounds = (AudioClip[])(object)new AudioClip[1] { val }; val2.Volume = Mathf.Clamp(volume * Mathf.Clamp01(Plugin.Volume.Value), 0f, 4f); val2.VolumeRandom = 0f; val2.Pitch = 1f; val2.PitchRandom = 0f; val2.SpatialBlend = 1f; val2.ReverbMix = 1f; val2.Doppler = 0f; return val2; } } }